From 27207edfca3dae72b6e0e8f24156195ecfb7fc5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Wed, 2 Mar 2011 13:26:40 +0100 Subject: [PATCH 0001/1507] Initial commit for the Qt-Compositor. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The project goal is to be a toolbox which all Qt based Wayland compositors use. Initial work is done by: Samuel Rødal Paul Olav Tvete and myself --- src/3rdparty/ffi-arm/LICENSE | 21 + src/3rdparty/ffi-arm/ffi.c | 309 ++++++ src/3rdparty/ffi-arm/ffi.h | 399 ++++++++ src/3rdparty/ffi-arm/ffi.pro | 13 + src/3rdparty/ffi-arm/ffi_common.h | 122 +++ src/3rdparty/ffi-arm/fficonfig.h | 182 ++++ src/3rdparty/ffi-arm/ffitarget.h | 49 + src/3rdparty/ffi-arm/prep_cif.c | 174 ++++ src/3rdparty/ffi-arm/sysv.S | 306 ++++++ src/3rdparty/ffi-arm/types.c | 77 ++ src/3rdparty/wayland/client/client.pro | 19 + src/3rdparty/wayland/connection.c | 729 ++++++++++++++ src/3rdparty/wayland/connection.h | 68 ++ src/3rdparty/wayland/event-loop.c | 444 +++++++++ src/3rdparty/wayland/server/server.pro | 20 + .../wayland/wayland-client-protocol.h | 919 ++++++++++++++++++ src/3rdparty/wayland/wayland-client.c | 565 +++++++++++ src/3rdparty/wayland/wayland-client.h | 75 ++ src/3rdparty/wayland/wayland-egl.h | 82 ++ src/3rdparty/wayland/wayland-hash.c | 296 ++++++ src/3rdparty/wayland/wayland-protocol.c | 228 +++++ .../wayland/wayland-server-protocol.h | 265 +++++ src/3rdparty/wayland/wayland-server.c | 726 ++++++++++++++ src/3rdparty/wayland/wayland-server.h | 265 +++++ src/3rdparty/wayland/wayland-util.c | 123 +++ src/3rdparty/wayland/wayland-util.h | 157 +++ src/3rdparty/wayland/wayland.pro | 3 + 27 files changed, 6636 insertions(+) create mode 100644 src/3rdparty/ffi-arm/LICENSE create mode 100644 src/3rdparty/ffi-arm/ffi.c create mode 100644 src/3rdparty/ffi-arm/ffi.h create mode 100644 src/3rdparty/ffi-arm/ffi.pro create mode 100644 src/3rdparty/ffi-arm/ffi_common.h create mode 100644 src/3rdparty/ffi-arm/fficonfig.h create mode 100644 src/3rdparty/ffi-arm/ffitarget.h create mode 100644 src/3rdparty/ffi-arm/prep_cif.c create mode 100644 src/3rdparty/ffi-arm/sysv.S create mode 100644 src/3rdparty/ffi-arm/types.c create mode 100644 src/3rdparty/wayland/client/client.pro create mode 100644 src/3rdparty/wayland/connection.c create mode 100644 src/3rdparty/wayland/connection.h create mode 100644 src/3rdparty/wayland/event-loop.c create mode 100644 src/3rdparty/wayland/server/server.pro create mode 100644 src/3rdparty/wayland/wayland-client-protocol.h create mode 100644 src/3rdparty/wayland/wayland-client.c create mode 100644 src/3rdparty/wayland/wayland-client.h create mode 100644 src/3rdparty/wayland/wayland-egl.h create mode 100644 src/3rdparty/wayland/wayland-hash.c create mode 100644 src/3rdparty/wayland/wayland-protocol.c create mode 100644 src/3rdparty/wayland/wayland-server-protocol.h create mode 100644 src/3rdparty/wayland/wayland-server.c create mode 100644 src/3rdparty/wayland/wayland-server.h create mode 100644 src/3rdparty/wayland/wayland-util.c create mode 100644 src/3rdparty/wayland/wayland-util.h create mode 100644 src/3rdparty/wayland/wayland.pro diff --git a/src/3rdparty/ffi-arm/LICENSE b/src/3rdparty/ffi-arm/LICENSE new file mode 100644 index 00000000000..ec2fd694878 --- /dev/null +++ b/src/3rdparty/ffi-arm/LICENSE @@ -0,0 +1,21 @@ +libffi - Copyright (c) 1996-2009 Anthony Green, Red Hat, Inc and others. +See source files for details. + +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 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. diff --git a/src/3rdparty/ffi-arm/ffi.c b/src/3rdparty/ffi-arm/ffi.c new file mode 100644 index 00000000000..f6a64758f73 --- /dev/null +++ b/src/3rdparty/ffi-arm/ffi.c @@ -0,0 +1,309 @@ +/* ----------------------------------------------------------------------- + ffi.c - Copyright (c) 1998, 2008 Red Hat, Inc. + + ARM Foreign Function Interface + + 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 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 +#include + +#include + +/* ffi_prep_args is called by the assembly routine once stack space + has been allocated for the function's arguments */ + +void ffi_prep_args(char *stack, extended_cif *ecif) +{ + register unsigned int i; + register void **p_argv; + register char *argp; + register ffi_type **p_arg; + + argp = stack; + + if ( ecif->cif->flags == FFI_TYPE_STRUCT ) { + *(void **) argp = ecif->rvalue; + argp += 4; + } + + p_argv = ecif->avalue; + + for (i = ecif->cif->nargs, p_arg = ecif->cif->arg_types; + (i != 0); + i--, p_arg++) + { + size_t z; + + /* Align if necessary */ + if (((*p_arg)->alignment - 1) & (unsigned) argp) { + argp = (char *) ALIGN(argp, (*p_arg)->alignment); + } + + if ((*p_arg)->type == FFI_TYPE_STRUCT) + argp = (char *) ALIGN(argp, 4); + + z = (*p_arg)->size; + if (z < sizeof(int)) + { + z = sizeof(int); + switch ((*p_arg)->type) + { + case FFI_TYPE_SINT8: + *(signed int *) argp = (signed int)*(SINT8 *)(* p_argv); + break; + + case FFI_TYPE_UINT8: + *(unsigned int *) argp = (unsigned int)*(UINT8 *)(* p_argv); + break; + + case FFI_TYPE_SINT16: + *(signed int *) argp = (signed int)*(SINT16 *)(* p_argv); + break; + + case FFI_TYPE_UINT16: + *(unsigned int *) argp = (unsigned int)*(UINT16 *)(* p_argv); + break; + + case FFI_TYPE_STRUCT: + memcpy(argp, *p_argv, (*p_arg)->size); + break; + + default: + FFI_ASSERT(0); + } + } + else if (z == sizeof(int)) + { + *(unsigned int *) argp = (unsigned int)*(UINT32 *)(* p_argv); + } + else + { + memcpy(argp, *p_argv, z); + } + p_argv++; + argp += z; + } + + return; +} + +/* Perform machine dependent cif processing */ +ffi_status ffi_prep_cif_machdep(ffi_cif *cif) +{ + /* Round the stack up to a multiple of 8 bytes. This isn't needed + everywhere, but it is on some platforms, and it doesn't harm anything + when it isn't needed. */ + cif->bytes = (cif->bytes + 7) & ~7; + + /* Set the return type flag */ + switch (cif->rtype->type) + { + case FFI_TYPE_VOID: + case FFI_TYPE_FLOAT: + case FFI_TYPE_DOUBLE: + cif->flags = (unsigned) cif->rtype->type; + break; + + case FFI_TYPE_SINT64: + case FFI_TYPE_UINT64: + cif->flags = (unsigned) FFI_TYPE_SINT64; + break; + + case FFI_TYPE_STRUCT: + if (cif->rtype->size <= 4) + /* A Composite Type not larger than 4 bytes is returned in r0. */ + cif->flags = (unsigned)FFI_TYPE_INT; + else + /* A Composite Type larger than 4 bytes, or whose size cannot + be determined statically ... is stored in memory at an + address passed [in r0]. */ + cif->flags = (unsigned)FFI_TYPE_STRUCT; + break; + + default: + cif->flags = FFI_TYPE_INT; + break; + } + + return FFI_OK; +} + +extern void ffi_call_SYSV(void (*)(char *, extended_cif *), extended_cif *, + unsigned, unsigned, unsigned *, void (*fn)(void)); + +void ffi_call(ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue) +{ + extended_cif ecif; + + int small_struct = (cif->flags == FFI_TYPE_INT + && cif->rtype->type == FFI_TYPE_STRUCT); + + ecif.cif = cif; + ecif.avalue = avalue; + + unsigned int temp; + + /* If the return value is a struct and we don't have a return */ + /* value address then we need to make one */ + + if ((rvalue == NULL) && + (cif->flags == FFI_TYPE_STRUCT)) + { + ecif.rvalue = alloca(cif->rtype->size); + } + else if (small_struct) + ecif.rvalue = &temp; + else + ecif.rvalue = rvalue; + + switch (cif->abi) + { + case FFI_SYSV: + ffi_call_SYSV(ffi_prep_args, &ecif, cif->bytes, cif->flags, ecif.rvalue, + fn); + + break; + default: + FFI_ASSERT(0); + break; + } + if (small_struct) + memcpy (rvalue, &temp, cif->rtype->size); +} + +/** private members **/ + +static void ffi_prep_incoming_args_SYSV (char *stack, void **ret, + void** args, ffi_cif* cif); + +void ffi_closure_SYSV (ffi_closure *); + +/* This function is jumped to by the trampoline */ + +unsigned int +ffi_closure_SYSV_inner (closure, respp, args) + ffi_closure *closure; + void **respp; + void *args; +{ + // our various things... + ffi_cif *cif; + void **arg_area; + + cif = closure->cif; + arg_area = (void**) alloca (cif->nargs * sizeof (void*)); + + /* this call will initialize ARG_AREA, such that each + * element in that array points to the corresponding + * value on the stack; and if the function returns + * a structure, it will re-set RESP to point to the + * structure return address. */ + + ffi_prep_incoming_args_SYSV(args, respp, arg_area, cif); + + (closure->fun) (cif, *respp, arg_area, closure->user_data); + + return cif->flags; +} + +/*@-exportheader@*/ +static void +ffi_prep_incoming_args_SYSV(char *stack, void **rvalue, + void **avalue, ffi_cif *cif) +/*@=exportheader@*/ +{ + register unsigned int i; + register void **p_argv; + register char *argp; + register ffi_type **p_arg; + + argp = stack; + + if ( cif->flags == FFI_TYPE_STRUCT ) { + *rvalue = *(void **) argp; + argp += 4; + } + + p_argv = avalue; + + for (i = cif->nargs, p_arg = cif->arg_types; (i != 0); i--, p_arg++) + { + size_t z; + + size_t alignment = (*p_arg)->alignment; + if (alignment < 4) + alignment = 4; + /* Align if necessary */ + if ((alignment - 1) & (unsigned) argp) { + argp = (char *) ALIGN(argp, alignment); + } + + z = (*p_arg)->size; + + /* because we're little endian, this is what it turns into. */ + + *p_argv = (void*) argp; + + p_argv++; + argp += z; + } + + return; +} + +/* How to make a trampoline. */ + +#define FFI_INIT_TRAMPOLINE(TRAMP,FUN,CTX) \ +({ unsigned char *__tramp = (unsigned char*)(TRAMP); \ + unsigned int __fun = (unsigned int)(FUN); \ + unsigned int __ctx = (unsigned int)(CTX); \ + *(unsigned int*) &__tramp[0] = 0xe92d000f; /* stmfd sp!, {r0-r3} */ \ + *(unsigned int*) &__tramp[4] = 0xe59f0000; /* ldr r0, [pc] */ \ + *(unsigned int*) &__tramp[8] = 0xe59ff000; /* ldr pc, [pc] */ \ + *(unsigned int*) &__tramp[12] = __ctx; \ + *(unsigned int*) &__tramp[16] = __fun; \ + __clear_cache((&__tramp[0]), (&__tramp[19])); \ + }) + + +/* the cif must already be prep'ed */ + +ffi_status +ffi_prep_closure_loc (ffi_closure* closure, + ffi_cif* cif, + void (*fun)(ffi_cif*,void*,void**,void*), + void *user_data, + void *codeloc) +{ + FFI_ASSERT (cif->abi == FFI_SYSV); + + FFI_INIT_TRAMPOLINE (&closure->tramp[0], \ + &ffi_closure_SYSV, \ + codeloc); + + closure->cif = cif; + closure->user_data = user_data; + closure->fun = fun; + + return FFI_OK; +} diff --git a/src/3rdparty/ffi-arm/ffi.h b/src/3rdparty/ffi-arm/ffi.h new file mode 100644 index 00000000000..1f578d9a6fc --- /dev/null +++ b/src/3rdparty/ffi-arm/ffi.h @@ -0,0 +1,399 @@ +/* -----------------------------------------------------------------*-C-*- + libffi 3.0.9 - Copyright (c) 1996-2003, 2007, 2008 Red Hat, Inc. + + 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 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. + + ----------------------------------------------------------------------- */ + +/* ------------------------------------------------------------------- + The basic API is described in the README file. + + The raw API is designed to bypass some of the argument packing + and unpacking on architectures for which it can be avoided. + + The closure API allows interpreted functions to be packaged up + inside a C function pointer, so that they can be called as C functions, + with no understanding on the client side that they are interpreted. + It can also be used in other cases in which it is necessary to package + up a user specified parameter and a function pointer as a single + function pointer. + + The closure API must be implemented in order to get its functionality, + e.g. for use by gij. Routines are provided to emulate the raw API + if the underlying platform doesn't allow faster implementation. + + More details on the raw and cloure API can be found in: + + http://gcc.gnu.org/ml/java/1999-q3/msg00138.html + + and + + http://gcc.gnu.org/ml/java/1999-q3/msg00174.html + -------------------------------------------------------------------- */ + +#ifndef LIBFFI_H +#define LIBFFI_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* Specify which architecture libffi is configured for. */ +#define ARM + +/* ---- System configuration information --------------------------------- */ + +#include + +#ifndef LIBFFI_ASM + +#ifdef _MSC_VER +#define __attribute__(X) +#endif + +#include +#include + +/* LONG_LONG_MAX is not always defined (not if STRICT_ANSI, for example). + But we can find it either under the correct ANSI name, or under GNU + C's internal name. */ +#ifdef LONG_LONG_MAX +# define FFI_LONG_LONG_MAX LONG_LONG_MAX +#else +# ifdef LLONG_MAX +# define FFI_LONG_LONG_MAX LLONG_MAX +# else +# ifdef __GNUC__ +# define FFI_LONG_LONG_MAX __LONG_LONG_MAX__ +# endif +# endif +#endif + +/* The closure code assumes that this works on pointers, i.e. a size_t */ +/* can hold a pointer. */ + +typedef struct _ffi_type +{ + size_t size; + unsigned short alignment; + unsigned short type; + struct _ffi_type **elements; +} ffi_type; + +#ifndef LIBFFI_HIDE_BASIC_TYPES +#if SCHAR_MAX == 127 +# define ffi_type_uchar ffi_type_uint8 +# define ffi_type_schar ffi_type_sint8 +#else + #error "char size not supported" +#endif + +#if SHRT_MAX == 32767 +# define ffi_type_ushort ffi_type_uint16 +# define ffi_type_sshort ffi_type_sint16 +#elif SHRT_MAX == 2147483647 +# define ffi_type_ushort ffi_type_uint32 +# define ffi_type_sshort ffi_type_sint32 +#else + #error "short size not supported" +#endif + +#if INT_MAX == 32767 +# define ffi_type_uint ffi_type_uint16 +# define ffi_type_sint ffi_type_sint16 +#elif INT_MAX == 2147483647 +# define ffi_type_uint ffi_type_uint32 +# define ffi_type_sint ffi_type_sint32 +#elif INT_MAX == 9223372036854775807 +# define ffi_type_uint ffi_type_uint64 +# define ffi_type_sint ffi_type_sint64 +#else + #error "int size not supported" +#endif + +#if LONG_MAX == 2147483647 +# if FFI_LONG_LONG_MAX != 9223372036854775807 + #error "no 64-bit data type supported" +# endif +#elif LONG_MAX != 9223372036854775807 + #error "long size not supported" +#endif + +#if LONG_MAX == 2147483647 +# define ffi_type_ulong ffi_type_uint32 +# define ffi_type_slong ffi_type_sint32 +#elif LONG_MAX == 9223372036854775807 +# define ffi_type_ulong ffi_type_uint64 +# define ffi_type_slong ffi_type_sint64 +#else + #error "long size not supported" +#endif + +/* These are defined in types.c */ +extern ffi_type ffi_type_void; +extern ffi_type ffi_type_uint8; +extern ffi_type ffi_type_sint8; +extern ffi_type ffi_type_uint16; +extern ffi_type ffi_type_sint16; +extern ffi_type ffi_type_uint32; +extern ffi_type ffi_type_sint32; +extern ffi_type ffi_type_uint64; +extern ffi_type ffi_type_sint64; +extern ffi_type ffi_type_float; +extern ffi_type ffi_type_double; +extern ffi_type ffi_type_pointer; + +#if 1 +extern ffi_type ffi_type_longdouble; +#else +#define ffi_type_longdouble ffi_type_double +#endif +#endif /* LIBFFI_HIDE_BASIC_TYPES */ + +typedef enum { + FFI_OK = 0, + FFI_BAD_TYPEDEF, + FFI_BAD_ABI +} ffi_status; + +typedef unsigned FFI_TYPE; + +typedef struct { + ffi_abi abi; + unsigned nargs; + ffi_type **arg_types; + ffi_type *rtype; + unsigned bytes; + unsigned flags; +#ifdef FFI_EXTRA_CIF_FIELDS + FFI_EXTRA_CIF_FIELDS; +#endif +} ffi_cif; + +/* ---- Definitions for the raw API -------------------------------------- */ + +#ifndef FFI_SIZEOF_ARG +# if LONG_MAX == 2147483647 +# define FFI_SIZEOF_ARG 4 +# elif LONG_MAX == 9223372036854775807 +# define FFI_SIZEOF_ARG 8 +# endif +#endif + +#ifndef FFI_SIZEOF_JAVA_RAW +# define FFI_SIZEOF_JAVA_RAW FFI_SIZEOF_ARG +#endif + +typedef union { + ffi_sarg sint; + ffi_arg uint; + float flt; + char data[FFI_SIZEOF_ARG]; + void* ptr; +} ffi_raw; + +#if FFI_SIZEOF_JAVA_RAW == 4 && FFI_SIZEOF_ARG == 8 +/* This is a special case for mips64/n32 ABI (and perhaps others) where + sizeof(void *) is 4 and FFI_SIZEOF_ARG is 8. */ +typedef union { + signed int sint; + unsigned int uint; + float flt; + char data[FFI_SIZEOF_JAVA_RAW]; + void* ptr; +} ffi_java_raw; +#else +typedef ffi_raw ffi_java_raw; +#endif + + +void ffi_raw_call (ffi_cif *cif, + void (*fn)(void), + void *rvalue, + ffi_raw *avalue); + +void ffi_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_raw *raw); +void ffi_raw_to_ptrarray (ffi_cif *cif, ffi_raw *raw, void **args); +size_t ffi_raw_size (ffi_cif *cif); + +/* This is analogous to the raw API, except it uses Java parameter */ +/* packing, even on 64-bit machines. I.e. on 64-bit machines */ +/* longs and doubles are followed by an empty 64-bit word. */ + +void ffi_java_raw_call (ffi_cif *cif, + void (*fn)(void), + void *rvalue, + ffi_java_raw *avalue); + +void ffi_java_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_java_raw *raw); +void ffi_java_raw_to_ptrarray (ffi_cif *cif, ffi_java_raw *raw, void **args); +size_t ffi_java_raw_size (ffi_cif *cif); + +/* ---- Definitions for closures ----------------------------------------- */ + +#if FFI_CLOSURES + +typedef struct { + char tramp[FFI_TRAMPOLINE_SIZE]; + ffi_cif *cif; + void (*fun)(ffi_cif*,void*,void**,void*); + void *user_data; +#ifdef __GNUC__ +} ffi_closure __attribute__((aligned (8))); +#else +} ffi_closure; +#endif + +void *ffi_closure_alloc (size_t size, void **code); +void ffi_closure_free (void *); + +ffi_status +ffi_prep_closure (ffi_closure*, + ffi_cif *, + void (*fun)(ffi_cif*,void*,void**,void*), + void *user_data); + +ffi_status +ffi_prep_closure_loc (ffi_closure*, + ffi_cif *, + void (*fun)(ffi_cif*,void*,void**,void*), + void *user_data, + void*codeloc); + +typedef struct { + char tramp[FFI_TRAMPOLINE_SIZE]; + + ffi_cif *cif; + +#if !FFI_NATIVE_RAW_API + + /* if this is enabled, then a raw closure has the same layout + as a regular closure. We use this to install an intermediate + handler to do the transaltion, void** -> ffi_raw*. */ + + void (*translate_args)(ffi_cif*,void*,void**,void*); + void *this_closure; + +#endif + + void (*fun)(ffi_cif*,void*,ffi_raw*,void*); + void *user_data; + +} ffi_raw_closure; + +typedef struct { + char tramp[FFI_TRAMPOLINE_SIZE]; + + ffi_cif *cif; + +#if !FFI_NATIVE_RAW_API + + /* if this is enabled, then a raw closure has the same layout + as a regular closure. We use this to install an intermediate + handler to do the transaltion, void** -> ffi_raw*. */ + + void (*translate_args)(ffi_cif*,void*,void**,void*); + void *this_closure; + +#endif + + void (*fun)(ffi_cif*,void*,ffi_java_raw*,void*); + void *user_data; + +} ffi_java_raw_closure; + +ffi_status +ffi_prep_raw_closure (ffi_raw_closure*, + ffi_cif *cif, + void (*fun)(ffi_cif*,void*,ffi_raw*,void*), + void *user_data); + +ffi_status +ffi_prep_raw_closure_loc (ffi_raw_closure*, + ffi_cif *cif, + void (*fun)(ffi_cif*,void*,ffi_raw*,void*), + void *user_data, + void *codeloc); + +ffi_status +ffi_prep_java_raw_closure (ffi_java_raw_closure*, + ffi_cif *cif, + void (*fun)(ffi_cif*,void*,ffi_java_raw*,void*), + void *user_data); + +ffi_status +ffi_prep_java_raw_closure_loc (ffi_java_raw_closure*, + ffi_cif *cif, + void (*fun)(ffi_cif*,void*,ffi_java_raw*,void*), + void *user_data, + void *codeloc); + +#endif /* FFI_CLOSURES */ + +/* ---- Public interface definition -------------------------------------- */ + +ffi_status ffi_prep_cif(ffi_cif *cif, + ffi_abi abi, + unsigned int nargs, + ffi_type *rtype, + ffi_type **atypes); + +void ffi_call(ffi_cif *cif, + void (*fn)(void), + void *rvalue, + void **avalue); + +/* Useful for eliminating compiler warnings */ +#define FFI_FN(f) ((void (*)(void))f) + +/* ---- Definitions shared with assembly code ---------------------------- */ + +#endif + +/* If these change, update src/mips/ffitarget.h. */ +#define FFI_TYPE_VOID 0 +#define FFI_TYPE_INT 1 +#define FFI_TYPE_FLOAT 2 +#define FFI_TYPE_DOUBLE 3 +#if 1 +#define FFI_TYPE_LONGDOUBLE 4 +#else +#define FFI_TYPE_LONGDOUBLE FFI_TYPE_DOUBLE +#endif +#define FFI_TYPE_UINT8 5 +#define FFI_TYPE_SINT8 6 +#define FFI_TYPE_UINT16 7 +#define FFI_TYPE_SINT16 8 +#define FFI_TYPE_UINT32 9 +#define FFI_TYPE_SINT32 10 +#define FFI_TYPE_UINT64 11 +#define FFI_TYPE_SINT64 12 +#define FFI_TYPE_STRUCT 13 +#define FFI_TYPE_POINTER 14 + +/* This should always refer to the last type code (for sanity checks) */ +#define FFI_TYPE_LAST FFI_TYPE_POINTER + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/src/3rdparty/ffi-arm/ffi.pro b/src/3rdparty/ffi-arm/ffi.pro new file mode 100644 index 00000000000..1e9106292fd --- /dev/null +++ b/src/3rdparty/ffi-arm/ffi.pro @@ -0,0 +1,13 @@ +TEMPLATE = lib +TARGET = ffi +DESTDIR=$$PWD/../../../lib/ + +CONFIG -= qt +CONFIG += shared + +SOURCES = ffi.c \ + prep_cif.c \ + types.c \ + sysv.S + +OBJECTS_DIR = .obj diff --git a/src/3rdparty/ffi-arm/ffi_common.h b/src/3rdparty/ffi-arm/ffi_common.h new file mode 100644 index 00000000000..42cace91502 --- /dev/null +++ b/src/3rdparty/ffi-arm/ffi_common.h @@ -0,0 +1,122 @@ +/* ----------------------------------------------------------------------- + ffi_common.h - Copyright (c) 1996 Red Hat, Inc. + Copyright (C) 2007 Free Software Foundation, Inc + + Common internal definitions and macros. Only necessary for building + libffi. + ----------------------------------------------------------------------- */ + +#ifndef FFI_COMMON_H +#define FFI_COMMON_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +/* Do not move this. Some versions of AIX are very picky about where + this is positioned. */ +#ifdef __GNUC__ +/* mingw64 defines this already in malloc.h. */ +#ifndef alloca +# define alloca __builtin_alloca +#endif +# define MAYBE_UNUSED __attribute__((__unused__)) +#else +# define MAYBE_UNUSED +# if HAVE_ALLOCA_H +# include +# else +# ifdef _AIX + #pragma alloca +# else +# ifndef alloca /* predefined by HP cc +Olibcalls */ +# ifdef _MSC_VER +# define alloca _alloca +# else +char *alloca (); +# endif +# endif +# endif +# endif +#endif + +/* Check for the existence of memcpy. */ +#if STDC_HEADERS +# include +#else +# ifndef HAVE_MEMCPY +# define memcpy(d, s, n) bcopy ((s), (d), (n)) +# endif +#endif + +#if defined(FFI_DEBUG) +#include +#endif + +#ifdef FFI_DEBUG +void ffi_assert(char *expr, char *file, int line); +void ffi_stop_here(void); +void ffi_type_test(ffi_type *a, char *file, int line); + +#define FFI_ASSERT(x) ((x) ? (void)0 : ffi_assert(#x, __FILE__,__LINE__)) +#define FFI_ASSERT_AT(x, f, l) ((x) ? 0 : ffi_assert(#x, (f), (l))) +#define FFI_ASSERT_VALID_TYPE(x) ffi_type_test (x, __FILE__, __LINE__) +#else +#define FFI_ASSERT(x) +#define FFI_ASSERT_AT(x, f, l) +#define FFI_ASSERT_VALID_TYPE(x) +#endif + +#define ALIGN(v, a) (((((size_t) (v))-1) | ((a)-1))+1) +#define ALIGN_DOWN(v, a) (((size_t) (v)) & -a) + +/* Perform machine dependent cif processing */ +ffi_status ffi_prep_cif_machdep(ffi_cif *cif); + +/* Extended cif, used in callback from assembly routine */ +typedef struct +{ + ffi_cif *cif; + void *rvalue; + void **avalue; +} extended_cif; + +/* Terse sized type definitions. */ +#if defined(_MSC_VER) || defined(__sgi) +typedef unsigned char UINT8; +typedef signed char SINT8; +typedef unsigned short UINT16; +typedef signed short SINT16; +typedef unsigned int UINT32; +typedef signed int SINT32; +# ifdef _MSC_VER +typedef unsigned __int64 UINT64; +typedef signed __int64 SINT64; +# else +# include +typedef uint64_t UINT64; +typedef int64_t SINT64; +# endif +#else +typedef unsigned int UINT8 __attribute__((__mode__(__QI__))); +typedef signed int SINT8 __attribute__((__mode__(__QI__))); +typedef unsigned int UINT16 __attribute__((__mode__(__HI__))); +typedef signed int SINT16 __attribute__((__mode__(__HI__))); +typedef unsigned int UINT32 __attribute__((__mode__(__SI__))); +typedef signed int SINT32 __attribute__((__mode__(__SI__))); +typedef unsigned int UINT64 __attribute__((__mode__(__DI__))); +typedef signed int SINT64 __attribute__((__mode__(__DI__))); +#endif + +typedef float FLOAT32; + + +#ifdef __cplusplus +} +#endif + +#endif + + diff --git a/src/3rdparty/ffi-arm/fficonfig.h b/src/3rdparty/ffi-arm/fficonfig.h new file mode 100644 index 00000000000..61b3a1db6e9 --- /dev/null +++ b/src/3rdparty/ffi-arm/fficonfig.h @@ -0,0 +1,182 @@ +/* fficonfig.h. Generated from fficonfig.h.in by configure. */ +/* fficonfig.h.in. Generated from configure.ac by autoheader. */ + +/* Define if building universal (internal helper macro) */ +/* #undef AC_APPLE_UNIVERSAL_BUILD */ + +/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP + systems. This function is required for `alloca.c' support on those systems. + */ +/* #undef CRAY_STACKSEG_END */ + +/* Define to 1 if using `alloca.c'. */ +/* #undef C_ALLOCA */ + +/* Define to the flags needed for the .section .eh_frame directive. */ +#define EH_FRAME_FLAGS "a" + +/* Define this if you want extra debugging. */ +/* #undef FFI_DEBUG */ + +/* Cannot use malloc on this target, so, we revert to alternative means */ +/* #undef FFI_MMAP_EXEC_WRIT */ + +/* Define this is you do not want support for the raw API. */ +/* #undef FFI_NO_RAW_API */ + +/* Define this is you do not want support for aggregate types. */ +/* #undef FFI_NO_STRUCTS */ + +/* Define to 1 if you have `alloca', as a function or macro. */ +#define HAVE_ALLOCA 1 + +/* Define to 1 if you have and it should be used (not on Ultrix). + */ +#define HAVE_ALLOCA_H 1 + +/* Define if your assembler supports .cfi_* directives. */ +#define HAVE_AS_CFI_PSEUDO_OP 1 + +/* Define if your assembler supports .register. */ +/* #undef HAVE_AS_REGISTER_PSEUDO_OP */ + +/* Define if your assembler and linker support unaligned PC relative relocs. + */ +/* #undef HAVE_AS_SPARC_UA_PCREL */ + +/* Define if your assembler supports PC relative relocs. */ +/* #undef HAVE_AS_X86_PCREL */ + +/* Define to 1 if you have the header file. */ +#define HAVE_DLFCN_H 1 + +/* Define if __attribute__((visibility("hidden"))) is supported. */ +#define HAVE_HIDDEN_VISIBILITY_ATTRIBUTE 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_INTTYPES_H 1 + +/* Define if you have the long double type and it is bigger than a double */ +#define HAVE_LONG_DOUBLE 1 + +/* Define to 1 if you have the `memcpy' function. */ +#define HAVE_MEMCPY 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_MEMORY_H 1 + +/* Define to 1 if you have the `mmap' function. */ +#define HAVE_MMAP 1 + +/* Define if mmap with MAP_ANON(YMOUS) works. */ +#define HAVE_MMAP_ANON 1 + +/* Define if mmap of /dev/zero works. */ +#define HAVE_MMAP_DEV_ZERO 1 + +/* Define if read-only mmap of a plain file works. */ +#define HAVE_MMAP_FILE 1 + +/* Define if .eh_frame sections should be read-only. */ +#define HAVE_RO_EH_FRAME 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDINT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDLIB_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRINGS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRING_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_MMAN_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_UNISTD_H 1 + +/* Define to the sub-directory in which libtool stores uninstalled libraries. + */ +#define LT_OBJDIR ".libs/" + +/* Define to 1 if your C compiler doesn't accept -c and -o together. */ +/* #undef NO_MINUS_C_MINUS_O */ + +/* Name of package */ +#define PACKAGE "libffi" + +/* Define to the address where bug reports for this package should be sent. */ +#define PACKAGE_BUGREPORT "http://gcc.gnu.org/bugs.html" + +/* Define to the full name of this package. */ +#define PACKAGE_NAME "libffi" + +/* Define to the full name and version of this package. */ +#define PACKAGE_STRING "libffi 3.0.9" + +/* Define to the one symbol short name of this package. */ +#define PACKAGE_TARNAME "libffi" + +/* Define to the version of this package. */ +#define PACKAGE_VERSION "3.0.9" + +/* The size of `double', as computed by sizeof. */ +#define SIZEOF_DOUBLE 8 + +/* The size of `long double', as computed by sizeof. */ +#define SIZEOF_LONG_DOUBLE 12 + +/* If using the C implementation of alloca, define if you know the + direction of stack growth for your system; otherwise it will be + automatically deduced at runtime. + STACK_DIRECTION > 0 => grows toward higher addresses + STACK_DIRECTION < 0 => grows toward lower addresses + STACK_DIRECTION = 0 => direction of growth unknown */ +/* #undef STACK_DIRECTION */ + +/* Define to 1 if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* Define this if you are using Purify and want to suppress spurious messages. + */ +/* #undef USING_PURIFY */ + +/* Version number of package */ +#define VERSION "3.0.9" + +/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most + significant byte first (like Motorola and SPARC, unlike Intel). */ +#if defined AC_APPLE_UNIVERSAL_BUILD +# if defined __BIG_ENDIAN__ +# define WORDS_BIGENDIAN 1 +# endif +#else +# ifndef WORDS_BIGENDIAN +/* # undef WORDS_BIGENDIAN */ +# endif +#endif + + +#ifdef HAVE_HIDDEN_VISIBILITY_ATTRIBUTE +#ifdef LIBFFI_ASM +#define FFI_HIDDEN(name) .hidden name +#else +#define FFI_HIDDEN __attribute__ ((visibility ("hidden"))) +#endif +#else +#ifdef LIBFFI_ASM +#define FFI_HIDDEN(name) +#else +#define FFI_HIDDEN +#endif +#endif + diff --git a/src/3rdparty/ffi-arm/ffitarget.h b/src/3rdparty/ffi-arm/ffitarget.h new file mode 100644 index 00000000000..a9574266954 --- /dev/null +++ b/src/3rdparty/ffi-arm/ffitarget.h @@ -0,0 +1,49 @@ +/* -----------------------------------------------------------------*-C-*- + ffitarget.h - Copyright (c) 1996-2003 Red Hat, Inc. + Target configuration macros for ARM. + + 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 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. + + ----------------------------------------------------------------------- */ + +#ifndef LIBFFI_TARGET_H +#define LIBFFI_TARGET_H + +#ifndef LIBFFI_ASM +typedef unsigned long ffi_arg; +typedef signed long ffi_sarg; + +typedef enum ffi_abi { + FFI_FIRST_ABI = 0, + FFI_SYSV, + FFI_DEFAULT_ABI = FFI_SYSV, + FFI_LAST_ABI = FFI_DEFAULT_ABI + 1 +} ffi_abi; +#endif + +/* ---- Definitions for closures ----------------------------------------- */ + +#define FFI_CLOSURES 1 +#define FFI_TRAMPOLINE_SIZE 20 +#define FFI_NATIVE_RAW_API 0 + +#endif + diff --git a/src/3rdparty/ffi-arm/prep_cif.c b/src/3rdparty/ffi-arm/prep_cif.c new file mode 100644 index 00000000000..eb78f9a2ed1 --- /dev/null +++ b/src/3rdparty/ffi-arm/prep_cif.c @@ -0,0 +1,174 @@ +/* ----------------------------------------------------------------------- + prep_cif.c - Copyright (c) 1996, 1998, 2007 Red Hat, Inc. + + 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 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 +#include +#include + +/* Round up to FFI_SIZEOF_ARG. */ + +#define STACK_ARG_SIZE(x) ALIGN(x, FFI_SIZEOF_ARG) + +/* Perform machine independent initialization of aggregate type + specifications. */ + +static ffi_status initialize_aggregate(ffi_type *arg) +{ + ffi_type **ptr; + + FFI_ASSERT(arg != NULL); + + FFI_ASSERT(arg->elements != NULL); + FFI_ASSERT(arg->size == 0); + FFI_ASSERT(arg->alignment == 0); + + ptr = &(arg->elements[0]); + + while ((*ptr) != NULL) + { + if (((*ptr)->size == 0) && (initialize_aggregate((*ptr)) != FFI_OK)) + return FFI_BAD_TYPEDEF; + + /* Perform a sanity check on the argument type */ + FFI_ASSERT_VALID_TYPE(*ptr); + + arg->size = ALIGN(arg->size, (*ptr)->alignment); + arg->size += (*ptr)->size; + + arg->alignment = (arg->alignment > (*ptr)->alignment) ? + arg->alignment : (*ptr)->alignment; + + ptr++; + } + + /* Structure size includes tail padding. This is important for + structures that fit in one register on ABIs like the PowerPC64 + Linux ABI that right justify small structs in a register. + It's also needed for nested structure layout, for example + struct A { long a; char b; }; struct B { struct A x; char y; }; + should find y at an offset of 2*sizeof(long) and result in a + total size of 3*sizeof(long). */ + arg->size = ALIGN (arg->size, arg->alignment); + + if (arg->size == 0) + return FFI_BAD_TYPEDEF; + else + return FFI_OK; +} + +#ifndef __CRIS__ +/* The CRIS ABI specifies structure elements to have byte + alignment only, so it completely overrides this functions, + which assumes "natural" alignment and padding. */ + +/* Perform machine independent ffi_cif preparation, then call + machine dependent routine. */ + +ffi_status ffi_prep_cif(ffi_cif *cif, ffi_abi abi, unsigned int nargs, + ffi_type *rtype, ffi_type **atypes) +{ + unsigned bytes = 0; + unsigned int i; + ffi_type **ptr; + + FFI_ASSERT(cif != NULL); + FFI_ASSERT((abi > FFI_FIRST_ABI) && (abi <= FFI_DEFAULT_ABI)); + + cif->abi = abi; + cif->arg_types = atypes; + cif->nargs = nargs; + cif->rtype = rtype; + + cif->flags = 0; + + /* Initialize the return type if necessary */ + if ((cif->rtype->size == 0) && (initialize_aggregate(cif->rtype) != FFI_OK)) + return FFI_BAD_TYPEDEF; + + /* Perform a sanity check on the return type */ + FFI_ASSERT_VALID_TYPE(cif->rtype); + + /* x86-64 and s390 stack space allocation is handled in prep_machdep. */ +#if !defined M68K && !defined __x86_64__ && !defined S390 && !defined PA + /* Make space for the return structure pointer */ + if (cif->rtype->type == FFI_TYPE_STRUCT +#ifdef SPARC + && (cif->abi != FFI_V9 || cif->rtype->size > 32) +#endif +#ifdef X86_DARWIN + && (cif->rtype->size > 8) +#endif + ) + bytes = STACK_ARG_SIZE(sizeof(void*)); +#endif + + for (ptr = cif->arg_types, i = cif->nargs; i > 0; i--, ptr++) + { + + /* Initialize any uninitialized aggregate type definitions */ + if (((*ptr)->size == 0) && (initialize_aggregate((*ptr)) != FFI_OK)) + return FFI_BAD_TYPEDEF; + + /* Perform a sanity check on the argument type, do this + check after the initialization. */ + FFI_ASSERT_VALID_TYPE(*ptr); + +#if !defined __x86_64__ && !defined S390 && !defined PA +#ifdef SPARC + if (((*ptr)->type == FFI_TYPE_STRUCT + && ((*ptr)->size > 16 || cif->abi != FFI_V9)) + || ((*ptr)->type == FFI_TYPE_LONGDOUBLE + && cif->abi != FFI_V9)) + bytes += sizeof(void*); + else +#endif + { + /* Add any padding if necessary */ + if (((*ptr)->alignment - 1) & bytes) + bytes = ALIGN(bytes, (*ptr)->alignment); + + bytes += STACK_ARG_SIZE((*ptr)->size); + } +#endif + } + + cif->bytes = bytes; + + /* Perform machine dependent cif processing */ + return ffi_prep_cif_machdep(cif); +} +#endif /* not __CRIS__ */ + +#if FFI_CLOSURES + +ffi_status +ffi_prep_closure (ffi_closure* closure, + ffi_cif* cif, + void (*fun)(ffi_cif*,void*,void**,void*), + void *user_data) +{ + return ffi_prep_closure_loc (closure, cif, fun, user_data, closure); +} + +#endif diff --git a/src/3rdparty/ffi-arm/sysv.S b/src/3rdparty/ffi-arm/sysv.S new file mode 100644 index 00000000000..4c289c697c7 --- /dev/null +++ b/src/3rdparty/ffi-arm/sysv.S @@ -0,0 +1,306 @@ +/* ----------------------------------------------------------------------- + sysv.S - Copyright (c) 1998, 2008 Red Hat, Inc. + + ARM Foreign Function Interface + + 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 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. + ----------------------------------------------------------------------- */ + +#define LIBFFI_ASM +#include +#include +#ifdef HAVE_MACHINE_ASM_H +#include +#else +#ifdef __USER_LABEL_PREFIX__ +#define CONCAT1(a, b) CONCAT2(a, b) +#define CONCAT2(a, b) a ## b + +/* Use the right prefix for global labels. */ +#define CNAME(x) CONCAT1 (__USER_LABEL_PREFIX__, x) +#else +#define CNAME(x) x +#endif +#define ENTRY(x) .globl CNAME(x); .type CNAME(x),%function; CNAME(x): +#endif + +#ifdef __ELF__ +#define LSYM(x) .x +#else +#define LSYM(x) x +#endif + +/* We need a better way of testing for this, but for now, this is all + we can do. */ +@ This selects the minimum architecture level required. +#define __ARM_ARCH__ 3 + +#if defined(__ARM_ARCH_4__) || defined(__ARM_ARCH_4T__) +# undef __ARM_ARCH__ +# define __ARM_ARCH__ 4 +#endif + +#if defined(__ARM_ARCH_5__) || defined(__ARM_ARCH_5T__) \ + || defined(__ARM_ARCH_5E__) || defined(__ARM_ARCH_5TE__) \ + || defined(__ARM_ARCH_5TEJ__) +# undef __ARM_ARCH__ +# define __ARM_ARCH__ 5 +#endif + +#if defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) \ + || defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6Z__) \ + || defined(__ARM_ARCH_6ZK__) || defined(__ARM_ARCH_6T2__) \ + || defined(__ARM_ARCH_6M__) +# undef __ARM_ARCH__ +# define __ARM_ARCH__ 6 +#endif + +#if defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) \ + || defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7M__) +# undef __ARM_ARCH__ +# define __ARM_ARCH__ 7 +#endif + +#if __ARM_ARCH__ >= 5 +# define call_reg(x) blx x +#elif defined (__ARM_ARCH_4T__) +# define call_reg(x) mov lr, pc ; bx x +# if defined(__thumb__) || defined(__THUMB_INTERWORK__) +# define __INTERWORKING__ +# endif +#else +# define call_reg(x) mov lr, pc ; mov pc, x +#endif + +/* Conditionally compile unwinder directives. */ +#ifdef __ARM_EABI__ +#define UNWIND +#else +#define UNWIND @ +#endif + + +#if defined(__thumb__) && !defined(__THUMB_INTERWORK__) +.macro ARM_FUNC_START name + .text + .align 0 + .thumb + .thumb_func + ENTRY(\name) + bx pc + nop + .arm + UNWIND .fnstart +/* A hook to tell gdb that we've switched to ARM mode. Also used to call + directly from other local arm routines. */ +_L__\name: +.endm +#else +.macro ARM_FUNC_START name + .text + .align 0 + .arm + ENTRY(\name) + UNWIND .fnstart +.endm +#endif + +.macro RETLDM regs=, cond=, dirn=ia +#if defined (__INTERWORKING__) + .ifc "\regs","" + ldr\cond lr, [sp], #4 + .else + ldm\cond\dirn sp!, {\regs, lr} + .endif + bx\cond lr +#else + .ifc "\regs","" + ldr\cond pc, [sp], #4 + .else + ldm\cond\dirn sp!, {\regs, pc} + .endif +#endif +.endm + + + @ r0: ffi_prep_args + @ r1: &ecif + @ r2: cif->bytes + @ r3: fig->flags + @ sp+0: ecif.rvalue + @ sp+4: fn + + @ This assumes we are using gas. +ARM_FUNC_START ffi_call_SYSV + @ Save registers + stmfd sp!, {r0-r3, fp, lr} + UNWIND .save {r0-r3, fp, lr} + mov fp, sp + + UNWIND .setfp fp, sp + + @ Make room for all of the new args. + sub sp, fp, r2 + + @ Place all of the ffi_prep_args in position + mov ip, r0 + mov r0, sp + @ r1 already set + + @ Call ffi_prep_args(stack, &ecif) + call_reg(ip) + + @ move first 4 parameters in registers + ldmia sp, {r0-r3} + + @ and adjust stack + ldr ip, [fp, #8] + cmp ip, #16 + movhs ip, #16 + add sp, sp, ip + + @ call (fn) (...) + ldr ip, [fp, #28] + call_reg(ip) + + @ Remove the space we pushed for the args + mov sp, fp + + @ Load r2 with the pointer to storage for the return value + ldr r2, [sp, #24] + + @ Load r3 with the return type code + ldr r3, [sp, #12] + + @ If the return value pointer is NULL, assume no return value. + cmp r2, #0 + beq LSYM(Lepilogue) + +@ return INT + cmp r3, #FFI_TYPE_INT +#if defined(__SOFTFP__) || defined(__ARM_EABI__) + cmpne r3, #FFI_TYPE_FLOAT +#endif + streq r0, [r2] + beq LSYM(Lepilogue) + + @ return INT64 + cmp r3, #FFI_TYPE_SINT64 +#if defined(__SOFTFP__) || defined(__ARM_EABI__) + cmpne r3, #FFI_TYPE_DOUBLE +#endif + stmeqia r2, {r0, r1} + +#if !defined(__SOFTFP__) && !defined(__ARM_EABI__) + beq LSYM(Lepilogue) + +@ return FLOAT + cmp r3, #FFI_TYPE_FLOAT + stfeqs f0, [r2] + beq LSYM(Lepilogue) + +@ return DOUBLE or LONGDOUBLE + cmp r3, #FFI_TYPE_DOUBLE + stfeqd f0, [r2] +#endif + +LSYM(Lepilogue): + RETLDM "r0-r3,fp" + +.ffi_call_SYSV_end: + UNWIND .fnend + .size CNAME(ffi_call_SYSV),.ffi_call_SYSV_end-CNAME(ffi_call_SYSV) + +/* + unsigned int FFI_HIDDEN + ffi_closure_SYSV_inner (closure, respp, args) + ffi_closure *closure; + void **respp; + void *args; +*/ + +ARM_FUNC_START ffi_closure_SYSV + UNWIND .pad #16 + add ip, sp, #16 + stmfd sp!, {ip, lr} + UNWIND .save {r0, lr} + add r2, sp, #8 + .pad #16 + sub sp, sp, #16 + str sp, [sp, #8] + add r1, sp, #8 + bl ffi_closure_SYSV_inner + cmp r0, #FFI_TYPE_INT + beq .Lretint + + cmp r0, #FFI_TYPE_FLOAT +#if defined(__SOFTFP__) || defined(__ARM_EABI__) + beq .Lretint +#else + beq .Lretfloat +#endif + + cmp r0, #FFI_TYPE_DOUBLE +#if defined(__SOFTFP__) || defined(__ARM_EABI__) + beq .Lretlonglong +#else + beq .Lretdouble +#endif + + cmp r0, #FFI_TYPE_LONGDOUBLE +#if defined(__SOFTFP__) || defined(__ARM_EABI__) + beq .Lretlonglong +#else + beq .Lretlongdouble +#endif + + cmp r0, #FFI_TYPE_SINT64 + beq .Lretlonglong +.Lclosure_epilogue: + add sp, sp, #16 + ldmfd sp, {sp, pc} +.Lretint: + ldr r0, [sp] + b .Lclosure_epilogue +.Lretlonglong: + ldr r0, [sp] + ldr r1, [sp, #4] + b .Lclosure_epilogue + +#if !defined(__SOFTFP__) && !defined(__ARM_EABI__) +.Lretfloat: + ldfs f0, [sp] + b .Lclosure_epilogue +.Lretdouble: + ldfd f0, [sp] + b .Lclosure_epilogue +.Lretlongdouble: + ldfd f0, [sp] + b .Lclosure_epilogue +#endif + +.ffi_closure_SYSV_end: + UNWIND .fnend + .size CNAME(ffi_closure_SYSV),.ffi_closure_SYSV_end-CNAME(ffi_closure_SYSV) + +#if defined __ELF__ && defined __linux__ + .section .note.GNU-stack,"",%progbits +#endif diff --git a/src/3rdparty/ffi-arm/types.c b/src/3rdparty/ffi-arm/types.c new file mode 100644 index 00000000000..0a11eb0fb4b --- /dev/null +++ b/src/3rdparty/ffi-arm/types.c @@ -0,0 +1,77 @@ +/* ----------------------------------------------------------------------- + types.c - Copyright (c) 1996, 1998 Red Hat, Inc. + + Predefined ffi_types needed by libffi. + + 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 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. + ----------------------------------------------------------------------- */ + +/* Hide the basic type definitions from the header file, so that we + can redefine them here as "const". */ +#define LIBFFI_HIDE_BASIC_TYPES + +#include +#include + +/* Type definitions */ + +#define FFI_TYPEDEF(name, type, id) \ +struct struct_align_##name { \ + char c; \ + type x; \ +}; \ +const ffi_type ffi_type_##name = { \ + sizeof(type), \ + offsetof(struct struct_align_##name, x), \ + id, NULL \ +} + +/* Size and alignment are fake here. They must not be 0. */ +const ffi_type ffi_type_void = { + 1, 1, FFI_TYPE_VOID, NULL +}; + +FFI_TYPEDEF(uint8, UINT8, FFI_TYPE_UINT8); +FFI_TYPEDEF(sint8, SINT8, FFI_TYPE_SINT8); +FFI_TYPEDEF(uint16, UINT16, FFI_TYPE_UINT16); +FFI_TYPEDEF(sint16, SINT16, FFI_TYPE_SINT16); +FFI_TYPEDEF(uint32, UINT32, FFI_TYPE_UINT32); +FFI_TYPEDEF(sint32, SINT32, FFI_TYPE_SINT32); +FFI_TYPEDEF(uint64, UINT64, FFI_TYPE_UINT64); +FFI_TYPEDEF(sint64, SINT64, FFI_TYPE_SINT64); + +FFI_TYPEDEF(pointer, void*, FFI_TYPE_POINTER); + +FFI_TYPEDEF(float, float, FFI_TYPE_FLOAT); +FFI_TYPEDEF(double, double, FFI_TYPE_DOUBLE); + +#ifdef __alpha__ +/* Even if we're not configured to default to 128-bit long double, + maintain binary compatibility, as -mlong-double-128 can be used + at any time. */ +/* Validate the hard-coded number below. */ +# if defined(__LONG_DOUBLE_128__) && FFI_TYPE_LONGDOUBLE != 4 +# error FFI_TYPE_LONGDOUBLE out of date +# endif +const ffi_type ffi_type_longdouble = { 16, 16, 4, NULL }; +#elif FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE +FFI_TYPEDEF(longdouble, long double, FFI_TYPE_LONGDOUBLE); +#endif diff --git a/src/3rdparty/wayland/client/client.pro b/src/3rdparty/wayland/client/client.pro new file mode 100644 index 00000000000..ebf24b4ee76 --- /dev/null +++ b/src/3rdparty/wayland/client/client.pro @@ -0,0 +1,19 @@ +TEMPLATE = lib +TARGET = wayland-client +DESTDIR=$$PWD/../../../../lib/ + +CONFIG -= qt +CONFIG += shared + +INCLUDEPATH += $$PWD/.. \ + $$PWD/../../ffi + +LIBS += -L $$PWD/../../../../lib/ -lffi + +SOURCES = ../wayland-client.c \ + ../wayland-protocol.c \ + ../connection.c \ + ../wayland-util.c \ + ../wayland-hash.c + +OBJECTS_DIR = .obj diff --git a/src/3rdparty/wayland/connection.c b/src/3rdparty/wayland/connection.c new file mode 100644 index 00000000000..4a004705b45 --- /dev/null +++ b/src/3rdparty/wayland/connection.c @@ -0,0 +1,729 @@ +/* + * Copyright © 2008 Kristian Høgsberg + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that copyright + * notice and this permission notice appear in supporting documentation, and + * that the name of the copyright holders not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. The copyright holders make no representations + * about the suitability of this software for any purpose. It is provided "as + * is" without express or implied warranty. + * + * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THIS SOFTWARE. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "wayland-util.h" +#include "connection.h" + +#define ARRAY_LENGTH(a) (sizeof (a) / sizeof (a)[0]) + +struct wl_buffer { + char data[4096]; + int head, tail; +}; + +#define MASK(i) ((i) & 4095) + +struct wl_closure { + int count; + const struct wl_message *message; + ffi_type *types[20]; + ffi_cif cif; + void *args[20]; + uint32_t buffer[64]; + uint32_t *start; +}; + +struct wl_connection { + struct wl_buffer in, out; + struct wl_buffer fds_in, fds_out; + int fd; + void *data; + wl_connection_update_func_t update; + struct wl_closure receive_closure, send_closure; +}; + +union wl_value { + uint32_t uint32; + char *string; + struct wl_object *object; + uint32_t new_id; + struct wl_array *array; +}; + +static void +wl_buffer_put(struct wl_buffer *b, const void *data, size_t count) +{ + int head, size; + + head = MASK(b->head); + if (head + count <= sizeof b->data) { + memcpy(b->data + head, data, count); + } else { + size = sizeof b->data - head; + memcpy(b->data + head, data, size); + memcpy(b->data, (const char *) data + size, count - size); + } + + b->head += count; +} + +static void +wl_buffer_put_iov(struct wl_buffer *b, struct iovec *iov, int *count) +{ + int head, tail; + + head = MASK(b->head); + tail = MASK(b->tail); + if (head < tail) { + iov[0].iov_base = b->data + head; + iov[0].iov_len = tail - head; + *count = 1; + } else if (tail == 0) { + iov[0].iov_base = b->data + head; + iov[0].iov_len = sizeof b->data - head; + *count = 1; + } else { + iov[0].iov_base = b->data + head; + iov[0].iov_len = sizeof b->data - head; + iov[1].iov_base = b->data; + iov[1].iov_len = tail; + *count = 2; + } +} + +static void +wl_buffer_get_iov(struct wl_buffer *b, struct iovec *iov, int *count) +{ + int head, tail; + + head = MASK(b->head); + tail = MASK(b->tail); + if (tail < head) { + iov[0].iov_base = b->data + tail; + iov[0].iov_len = head - tail; + *count = 1; + } else if (head == 0) { + iov[0].iov_base = b->data + tail; + iov[0].iov_len = sizeof b->data - tail; + *count = 1; + } else { + iov[0].iov_base = b->data + tail; + iov[0].iov_len = sizeof b->data - tail; + iov[1].iov_base = b->data; + iov[1].iov_len = head; + *count = 2; + } +} + +static void +wl_buffer_copy(struct wl_buffer *b, void *data, size_t count) +{ + int tail, size; + + tail = MASK(b->tail); + if (tail + count <= sizeof b->data) { + memcpy(data, b->data + tail, count); + } else { + size = sizeof b->data - tail; + memcpy(data, b->data + tail, size); + memcpy((char *) data + size, b->data, count - size); + } +} + +struct wl_connection * +wl_connection_create(int fd, + wl_connection_update_func_t update, + void *data) +{ + struct wl_connection *connection; + + connection = malloc(sizeof *connection); + memset(connection, 0, sizeof *connection); + connection->fd = fd; + connection->update = update; + connection->data = data; + + connection->update(connection, + WL_CONNECTION_READABLE, + connection->data); + + return connection; +} + +void +wl_connection_destroy(struct wl_connection *connection) +{ + close(connection->fd); + free(connection); +} + +void +wl_connection_copy(struct wl_connection *connection, void *data, size_t size) +{ + wl_buffer_copy(&connection->in, data, size); +} + +void +wl_connection_consume(struct wl_connection *connection, size_t size) +{ + connection->in.tail += size; +} + +static void +build_cmsg(struct wl_buffer *buffer, char *data, int *clen) +{ + struct cmsghdr *cmsg; + size_t size; + + size = buffer->head - buffer->tail; + if (size > 0) { + cmsg = (struct cmsghdr *) data; + cmsg->cmsg_level = SOL_SOCKET; + cmsg->cmsg_type = SCM_RIGHTS; + cmsg->cmsg_len = CMSG_LEN(size); + wl_buffer_copy(buffer, CMSG_DATA(cmsg), size); + *clen = cmsg->cmsg_len; + } else { + *clen = 0; + } +} + +static void +close_fds(struct wl_buffer *buffer) +{ + int fds[32], i, count; + size_t size; + + size = buffer->head - buffer->tail; + if (size == 0) + return; + + wl_buffer_copy(buffer, fds, size); + count = size / sizeof fds[0]; + for (i = 0; i < count; i++) + close(fds[i]); + buffer->tail += size; +} + +static void +decode_cmsg(struct wl_buffer *buffer, struct msghdr *msg) +{ + struct cmsghdr *cmsg; + size_t size; + + for (cmsg = CMSG_FIRSTHDR(msg); cmsg != NULL; + cmsg = CMSG_NXTHDR(msg, cmsg)) { + if (cmsg->cmsg_level == SOL_SOCKET && + cmsg->cmsg_type == SCM_RIGHTS) { + size = cmsg->cmsg_len - CMSG_LEN(0); + wl_buffer_put(buffer, CMSG_DATA(cmsg), size); + } + } +} + +int +wl_connection_data(struct wl_connection *connection, uint32_t mask) +{ + struct iovec iov[2]; + struct msghdr msg; + char cmsg[128]; + int len, count, clen; + + if (mask & WL_CONNECTION_WRITABLE) { + wl_buffer_get_iov(&connection->out, iov, &count); + + build_cmsg(&connection->fds_out, cmsg, &clen); + + msg.msg_name = NULL; + msg.msg_namelen = 0; + msg.msg_iov = iov; + msg.msg_iovlen = count; + msg.msg_control = cmsg; + msg.msg_controllen = clen; + msg.msg_flags = 0; + + do { + len = sendmsg(connection->fd, &msg, MSG_NOSIGNAL); + } while (len < 0 && errno == EINTR); + + if (len == -1 && errno == EPIPE) { + return -1; + } else if (len < 0) { + fprintf(stderr, + "write error for connection %p, fd %d: %m\n", + connection, connection->fd); + return -1; + } + + close_fds(&connection->fds_out); + + connection->out.tail += len; + if (connection->out.tail == connection->out.head) + connection->update(connection, + WL_CONNECTION_READABLE, + connection->data); + } + + if (mask & WL_CONNECTION_READABLE) { + wl_buffer_put_iov(&connection->in, iov, &count); + + msg.msg_name = NULL; + msg.msg_namelen = 0; + msg.msg_iov = iov; + msg.msg_iovlen = count; + msg.msg_control = cmsg; + msg.msg_controllen = sizeof cmsg; + msg.msg_flags = 0; + + do { + len = recvmsg(connection->fd, &msg, 0); + } while (len < 0 && errno == EINTR); + + if (len < 0) { + fprintf(stderr, + "read error from connection %p: %m (%d)\n", + connection, errno); + return -1; + } else if (len == 0) { + /* FIXME: Handle this better? */ + return -1; + } + + decode_cmsg(&connection->fds_in, &msg); + + connection->in.head += len; + } + + return connection->in.head - connection->in.tail; +} + +void +wl_connection_write(struct wl_connection *connection, + const void *data, size_t count) +{ + wl_buffer_put(&connection->out, data, count); + + if (connection->out.head - connection->out.tail == count) + connection->update(connection, + WL_CONNECTION_READABLE | + WL_CONNECTION_WRITABLE, + connection->data); +} + +static int +wl_message_size_extra(const struct wl_message *message) +{ + int i, extra; + + for (i = 0, extra = 0; message->signature[i]; i++) { + + switch (message->signature[i]) { + case 's': + case 'o': + extra += sizeof (void *); + break; + case 'a': + extra += sizeof (void *) + sizeof (struct wl_array); + break; + case 'h': + extra += sizeof (uint32_t); + break; + default: + break; + } + } + + return extra; +} + +struct wl_closure * +wl_connection_vmarshal(struct wl_connection *connection, + struct wl_object *sender, + uint32_t opcode, va_list ap, + const struct wl_message *message) +{ + struct wl_closure *closure = &connection->send_closure; + struct wl_object **objectp, *object; + uint32_t length, *p, *start, size; + int dup_fd; + struct wl_array **arrayp, *array; + const char **sp, *s; + char *extra; + int i, count, fd, extra_size, *fd_ptr; + + extra_size = wl_message_size_extra(message); + count = strlen(message->signature) + 2; + extra = (char *) closure->buffer; + start = &closure->buffer[DIV_ROUNDUP(extra_size, sizeof *p)]; + p = &start[2]; + for (i = 2; i < count; i++) { + switch (message->signature[i - 2]) { + case 'u': + closure->types[i] = &ffi_type_uint32; + closure->args[i] = p; + *p++ = va_arg(ap, uint32_t); + break; + case 'i': + closure->types[i] = &ffi_type_sint32; + closure->args[i] = p; + *p++ = va_arg(ap, int32_t); + break; + case 's': + closure->types[i] = &ffi_type_pointer; + closure->args[i] = extra; + sp = (const char **) extra; + extra += sizeof *sp; + + s = va_arg(ap, const char *); + length = s ? strlen(s) + 1: 0; + *p++ = length; + + if (length > 0) + *sp = (const char *) p; + else + *sp = NULL; + + memcpy(p, s, length); + p += DIV_ROUNDUP(length, sizeof *p); + break; + case 'o': + closure->types[i] = &ffi_type_pointer; + closure->args[i] = extra; + objectp = (struct wl_object **) extra; + extra += sizeof *objectp; + + object = va_arg(ap, struct wl_object *); + *objectp = object; + *p++ = object ? object->id : 0; + break; + + case 'n': + closure->types[i] = &ffi_type_uint32; + closure->args[i] = p; + object = va_arg(ap, struct wl_object *); + *p++ = object->id; + break; + + case 'a': + closure->types[i] = &ffi_type_pointer; + closure->args[i] = extra; + arrayp = (struct wl_array **) extra; + extra += sizeof *arrayp; + + *arrayp = (struct wl_array *) extra; + extra += sizeof **arrayp; + + array = va_arg(ap, struct wl_array *); + if (array == NULL || array->size == 0) { + *p++ = 0; + break; + } + *p++ = array->size; + memcpy(p, array->data, array->size); + + (*arrayp)->size = array->size; + (*arrayp)->alloc = array->alloc; + (*arrayp)->data = p; + + p += DIV_ROUNDUP(array->size, sizeof *p); + break; + + case 'h': + closure->types[i] = &ffi_type_sint; + closure->args[i] = extra; + fd_ptr = (int *) extra; + extra += sizeof *fd_ptr; + + fd = va_arg(ap, int); + dup_fd = dup(fd); + if (dup_fd < 0) { + fprintf(stderr, "dup failed: %m"); + abort(); + } + *fd_ptr = dup_fd; + wl_buffer_put(&connection->fds_out, + &dup_fd, sizeof dup_fd); + break; + default: + assert(0); + break; + } + } + + size = (p - start) * sizeof *p; + start[0] = sender->id; + start[1] = opcode | (size << 16); + + closure->start = start; + closure->message = message; + closure->count = count; + + return closure; +} + +struct wl_closure * +wl_connection_demarshal(struct wl_connection *connection, + uint32_t size, + struct wl_hash_table *objects, + const struct wl_message *message) +{ + uint32_t *p, *next, *end, length; + int *fd; + char *extra, **s; + int i, count, extra_space; + struct wl_object **object; + struct wl_array **array; + struct wl_closure *closure = &connection->receive_closure; + + count = strlen(message->signature) + 2; + if (count > ARRAY_LENGTH(closure->types)) { + printf("too many args (%d)\n", count); + assert(0); + } + + extra_space = wl_message_size_extra(message); + if (sizeof closure->buffer < size + extra_space) { + printf("request too big, should malloc tmp buffer here\n"); + assert(0); + } + + closure->message = message; + closure->types[0] = &ffi_type_pointer; + closure->types[1] = &ffi_type_pointer; + + wl_connection_copy(connection, closure->buffer, size); + p = &closure->buffer[2]; + end = (uint32_t *) ((char *) (p + size)); + extra = (char *) end; + for (i = 2; i < count; i++) { + if (p + 1 > end) { + printf("message too short, " + "object (%d), message %s(%s)\n", + *p, message->name, message->signature); + errno = EINVAL; + goto err; + } + + switch (message->signature[i - 2]) { + case 'u': + closure->types[i] = &ffi_type_uint32; + closure->args[i] = p++; + break; + case 'i': + closure->types[i] = &ffi_type_sint32; + closure->args[i] = p++; + break; + case 's': + closure->types[i] = &ffi_type_pointer; + length = *p++; + + next = p + DIV_ROUNDUP(length, sizeof *p); + if (next > end) { + printf("message too short, " + "object (%d), message %s(%s)\n", + *p, message->name, message->signature); + errno = EINVAL; + goto err; + } + + s = (char **) extra; + extra += sizeof *s; + closure->args[i] = s; + + if (length == 0) { + *s = NULL; + } else { + *s = (char *) p; + } + + if (length > 0 && (*s)[length - 1] != '\0') { + printf("string not nul-terminated, " + "message %s(%s)\n", + message->name, message->signature); + errno = EINVAL; + goto err; + } + p = next; + break; + case 'o': + closure->types[i] = &ffi_type_pointer; + object = (struct wl_object **) extra; + extra += sizeof *object; + closure->args[i] = object; + + *object = wl_hash_table_lookup(objects, *p); + if (*object == NULL && *p != 0) { + printf("unknown object (%d), message %s(%s)\n", + *p, message->name, message->signature); + errno = EINVAL; + goto err; + } + + p++; + break; + case 'n': + closure->types[i] = &ffi_type_uint32; + closure->args[i] = p; + object = wl_hash_table_lookup(objects, *p); + if (object != NULL) { + printf("not a new object (%d), " + "message %s(%s)\n", + *p, message->name, message->signature); + errno = EINVAL; + goto err; + } + p++; + break; + case 'a': + closure->types[i] = &ffi_type_pointer; + length = *p++; + + next = p + DIV_ROUNDUP(length, sizeof *p); + if (next > end) { + printf("message too short, " + "object (%d), message %s(%s)\n", + *p, message->name, message->signature); + errno = EINVAL; + goto err; + } + + array = (struct wl_array **) extra; + extra += sizeof *array; + closure->args[i] = array; + + *array = (struct wl_array *) extra; + extra += sizeof **array; + + (*array)->size = length; + (*array)->alloc = 0; + (*array)->data = p; + p = next; + break; + case 'h': + closure->types[i] = &ffi_type_sint; + + fd = (int *) extra; + extra += sizeof *fd; + closure->args[i] = fd; + + wl_buffer_copy(&connection->fds_in, fd, sizeof *fd); + connection->fds_in.tail += sizeof *fd; + break; + default: + printf("unknown type\n"); + assert(0); + break; + } + } + + closure->count = i; + ffi_prep_cif(&closure->cif, FFI_DEFAULT_ABI, + closure->count, &ffi_type_uint32, closure->types); + + wl_connection_consume(connection, size); + + return closure; + + err: + closure->count = i; + wl_closure_destroy(closure); + wl_connection_consume(connection, size); + + return NULL; +} + +void +wl_closure_invoke(struct wl_closure *closure, + struct wl_object *target, void (*func)(void), void *data) +{ + int result; + + closure->args[0] = &data; + closure->args[1] = ⌖ + + ffi_call(&closure->cif, func, &result, closure->args); +} + +void +wl_closure_send(struct wl_closure *closure, struct wl_connection *connection) +{ + uint32_t size; + + size = closure->start[1] >> 16; + wl_connection_write(connection, closure->start, size); +} + +void +wl_closure_print(struct wl_closure *closure, struct wl_object *target) +{ + union wl_value *value; + int i; + + fprintf(stderr, "%s@%d.%s(", + target->interface->name, target->id, + closure->message->name); + + for (i = 2; i < closure->count; i++) { + if (i > 2) + fprintf(stderr, ", "); + + value = closure->args[i]; + switch (closure->message->signature[i - 2]) { + case 'u': + fprintf(stderr, "%u", value->uint32); + break; + case 'i': + fprintf(stderr, "%d", value->uint32); + break; + case 's': + fprintf(stderr, "\"%s\"", value->string); + break; + case 'o': + if (value->object) + fprintf(stderr, "%s@%u", + value->object->interface->name, + value->object->id); + else + fprintf(stderr, "nil"); + break; + case 'n': + fprintf(stderr, "new id %u", value->uint32); + break; + case 'a': + fprintf(stderr, "array"); + break; + case 'h': + fprintf(stderr, "fd %d", value->uint32); + break; + } + } + + fprintf(stderr, ")\n"); +} + +void +wl_closure_destroy(struct wl_closure *closure) +{ +} diff --git a/src/3rdparty/wayland/connection.h b/src/3rdparty/wayland/connection.h new file mode 100644 index 00000000000..413977dffe9 --- /dev/null +++ b/src/3rdparty/wayland/connection.h @@ -0,0 +1,68 @@ +/* + * Copyright © 2008 Kristian Høgsberg + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that copyright + * notice and this permission notice appear in supporting documentation, and + * that the name of the copyright holders not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. The copyright holders make no representations + * about the suitability of this software for any purpose. It is provided "as + * is" without express or implied warranty. + * + * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THIS SOFTWARE. + */ + +#ifndef _CONNECTION_H_ +#define _CONNECTION_H_ + +#include +#include "wayland-util.h" + +struct wl_connection; +struct wl_closure; + +#define WL_CONNECTION_READABLE 0x01 +#define WL_CONNECTION_WRITABLE 0x02 + +typedef int (*wl_connection_update_func_t)(struct wl_connection *connection, + uint32_t mask, void *data); + +struct wl_connection *wl_connection_create(int fd, + wl_connection_update_func_t update, + void *data); +void wl_connection_destroy(struct wl_connection *connection); +void wl_connection_copy(struct wl_connection *connection, void *data, size_t size); +void wl_connection_consume(struct wl_connection *connection, size_t size); +int wl_connection_data(struct wl_connection *connection, uint32_t mask); +void wl_connection_write(struct wl_connection *connection, const void *data, size_t count); + +struct wl_closure * +wl_connection_vmarshal(struct wl_connection *connection, + struct wl_object *sender, + uint32_t opcode, va_list ap, + const struct wl_message *message); + +struct wl_closure * +wl_connection_demarshal(struct wl_connection *connection, + uint32_t size, + struct wl_hash_table *objects, + const struct wl_message *message); +void +wl_closure_invoke(struct wl_closure *closure, + struct wl_object *target, void (*func)(void), void *data); +void +wl_closure_send(struct wl_closure *closure, struct wl_connection *connection); +void +wl_closure_print(struct wl_closure *closure, struct wl_object *target); +void +wl_closure_destroy(struct wl_closure *closure); + +#endif diff --git a/src/3rdparty/wayland/event-loop.c b/src/3rdparty/wayland/event-loop.c new file mode 100644 index 00000000000..bf2a9aafb85 --- /dev/null +++ b/src/3rdparty/wayland/event-loop.c @@ -0,0 +1,444 @@ +/* + * Copyright © 2008 Kristian Høgsberg + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that copyright + * notice and this permission notice appear in supporting documentation, and + * that the name of the copyright holders not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. The copyright holders make no representations + * about the suitability of this software for any purpose. It is provided "as + * is" without express or implied warranty. + * + * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THIS SOFTWARE. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "wayland-server.h" + +struct wl_event_loop { + int epoll_fd; + struct wl_list idle_list; +}; + +struct wl_event_source_interface { + void (*dispatch)(struct wl_event_source *source, + struct epoll_event *ep); + int (*remove)(struct wl_event_source *source); +}; + +struct wl_event_source { + struct wl_event_source_interface *interface; + struct wl_event_loop *loop; +}; + +struct wl_event_source_fd { + struct wl_event_source base; + int fd; + wl_event_loop_fd_func_t func; + void *data; +}; + +static void +wl_event_source_fd_dispatch(struct wl_event_source *source, + struct epoll_event *ep) +{ + struct wl_event_source_fd *fd_source = (struct wl_event_source_fd *) source; + uint32_t mask; + + mask = 0; + if (ep->events & EPOLLIN) + mask |= WL_EVENT_READABLE; + if (ep->events & EPOLLOUT) + mask |= WL_EVENT_WRITEABLE; + + fd_source->func(fd_source->fd, mask, fd_source->data); +} + +static int +wl_event_source_fd_remove(struct wl_event_source *source) +{ + struct wl_event_source_fd *fd_source = + (struct wl_event_source_fd *) source; + struct wl_event_loop *loop = source->loop; + int fd; + + fd = fd_source->fd; + free(source); + + return epoll_ctl(loop->epoll_fd, EPOLL_CTL_DEL, fd, NULL); +} + +struct wl_event_source_interface fd_source_interface = { + wl_event_source_fd_dispatch, + wl_event_source_fd_remove +}; + +WL_EXPORT struct wl_event_source * +wl_event_loop_add_fd(struct wl_event_loop *loop, + int fd, uint32_t mask, + wl_event_loop_fd_func_t func, + void *data) +{ + struct wl_event_source_fd *source; + struct epoll_event ep; + + source = malloc(sizeof *source); + if (source == NULL) + return NULL; + + source->base.interface = &fd_source_interface; + source->base.loop = loop; + source->fd = fd; + source->func = func; + source->data = data; + + memset(&ep, 0, sizeof ep); + if (mask & WL_EVENT_READABLE) + ep.events |= EPOLLIN; + if (mask & WL_EVENT_WRITEABLE) + ep.events |= EPOLLOUT; + ep.data.ptr = source; + + if (epoll_ctl(loop->epoll_fd, EPOLL_CTL_ADD, fd, &ep) < 0) { + free(source); + return NULL; + } + + return &source->base; +} + +WL_EXPORT int +wl_event_source_fd_update(struct wl_event_source *source, uint32_t mask) +{ + struct wl_event_source_fd *fd_source = + (struct wl_event_source_fd *) source; + struct wl_event_loop *loop = source->loop; + struct epoll_event ep; + + memset(&ep, 0, sizeof ep); + if (mask & WL_EVENT_READABLE) + ep.events |= EPOLLIN; + if (mask & WL_EVENT_WRITEABLE) + ep.events |= EPOLLOUT; + ep.data.ptr = source; + + return epoll_ctl(loop->epoll_fd, + EPOLL_CTL_MOD, fd_source->fd, &ep); +} + +struct wl_event_source_timer { + struct wl_event_source base; + int fd; + wl_event_loop_timer_func_t func; + void *data; +}; + +static void +wl_event_source_timer_dispatch(struct wl_event_source *source, + struct epoll_event *ep) +{ + struct wl_event_source_timer *timer_source = + (struct wl_event_source_timer *) source; + uint64_t expires; + + read(timer_source->fd, &expires, sizeof expires); + + timer_source->func(timer_source->data); +} + +static int +wl_event_source_timer_remove(struct wl_event_source *source) +{ + struct wl_event_source_timer *timer_source = + (struct wl_event_source_timer *) source; + struct wl_event_loop *loop = source->loop; + int fd; + + fd = timer_source->fd; + free(source); + + return epoll_ctl(loop->epoll_fd, EPOLL_CTL_DEL, fd, NULL); +} + +struct wl_event_source_interface timer_source_interface = { + wl_event_source_timer_dispatch, + wl_event_source_timer_remove +}; + +WL_EXPORT struct wl_event_source * +wl_event_loop_add_timer(struct wl_event_loop *loop, + wl_event_loop_timer_func_t func, + void *data) +{ + struct wl_event_source_timer *source; + struct epoll_event ep; + + source = malloc(sizeof *source); + if (source == NULL) + return NULL; + + source->base.interface = &timer_source_interface; + source->base.loop = loop; + + source->fd = timerfd_create(CLOCK_MONOTONIC, 0); + if (source->fd < 0) { + fprintf(stderr, "could not create timerfd\n: %m"); + free(source); + return NULL; + } + + source->func = func; + source->data = data; + + memset(&ep, 0, sizeof ep); + ep.events = EPOLLIN; + ep.data.ptr = source; + + if (epoll_ctl(loop->epoll_fd, EPOLL_CTL_ADD, source->fd, &ep) < 0) { + free(source); + return NULL; + } + + return &source->base; +} + +WL_EXPORT int +wl_event_source_timer_update(struct wl_event_source *source, int ms_delay) +{ + struct wl_event_source_timer *timer_source = + (struct wl_event_source_timer *) source; + struct itimerspec its; + + its.it_interval.tv_sec = 0; + its.it_interval.tv_nsec = 0; + its.it_value.tv_sec = 0; + its.it_value.tv_nsec = ms_delay * 1000 * 1000; + if (timerfd_settime(timer_source->fd, 0, &its, NULL) < 0) { + fprintf(stderr, "could not set timerfd\n: %m"); + return -1; + } + + return 0; +} + +struct wl_event_source_signal { + struct wl_event_source base; + int fd; + int signal_number; + wl_event_loop_signal_func_t func; + void *data; +}; + +static void +wl_event_source_signal_dispatch(struct wl_event_source *source, + struct epoll_event *ep) +{ + struct wl_event_source_signal *signal_source = + (struct wl_event_source_signal *) source; + struct signalfd_siginfo signal_info; + + read(signal_source->fd, &signal_info, sizeof signal_info); + + signal_source->func(signal_source->signal_number, signal_source->data); +} + +static int +wl_event_source_signal_remove(struct wl_event_source *source) +{ + struct wl_event_source_signal *signal_source = + (struct wl_event_source_signal *) source; + struct wl_event_loop *loop = source->loop; + int fd; + + fd = signal_source->fd; + free(source); + + return epoll_ctl(loop->epoll_fd, EPOLL_CTL_DEL, fd, NULL); +} + +struct wl_event_source_interface signal_source_interface = { + wl_event_source_signal_dispatch, + wl_event_source_signal_remove +}; + +WL_EXPORT struct wl_event_source * +wl_event_loop_add_signal(struct wl_event_loop *loop, + int signal_number, + wl_event_loop_signal_func_t func, + void *data) +{ + struct wl_event_source_signal *source; + struct epoll_event ep; + sigset_t mask; + + source = malloc(sizeof *source); + if (source == NULL) + return NULL; + + source->base.interface = &signal_source_interface; + source->base.loop = loop; + + sigemptyset(&mask); + sigaddset(&mask, signal_number); + source->fd = signalfd(-1, &mask, 0); + if (source->fd < 0) { + fprintf(stderr, "could not create fd to watch signal\n: %m"); + free(source); + return NULL; + } + sigprocmask(SIG_BLOCK, &mask, NULL); + + source->func = func; + source->data = data; + + memset(&ep, 0, sizeof ep); + ep.events = EPOLLIN; + ep.data.ptr = source; + + if (epoll_ctl(loop->epoll_fd, EPOLL_CTL_ADD, source->fd, &ep) < 0) { + free(source); + return NULL; + } + + return &source->base; +} + +struct wl_event_source_idle { + struct wl_event_source base; + struct wl_list link; + wl_event_loop_idle_func_t func; + void *data; +}; + +static void +wl_event_source_idle_dispatch(struct wl_event_source *source, + struct epoll_event *ep) +{ + assert(0); +} + +static int +wl_event_source_idle_remove(struct wl_event_source *source) +{ + struct wl_event_source_idle *idle_source = + (struct wl_event_source_idle *) source; + + wl_list_remove(&idle_source->link); + free(source); + + return 0; +} + +struct wl_event_source_interface idle_source_interface = { + wl_event_source_idle_dispatch, + wl_event_source_idle_remove +}; + +WL_EXPORT struct wl_event_source * +wl_event_loop_add_idle(struct wl_event_loop *loop, + wl_event_loop_idle_func_t func, + void *data) +{ + struct wl_event_source_idle *source; + + source = malloc(sizeof *source); + if (source == NULL) + return NULL; + + source->base.interface = &idle_source_interface; + source->base.loop = loop; + + source->func = func; + source->data = data; + wl_list_insert(loop->idle_list.prev, &source->link); + + return &source->base; +} + +WL_EXPORT int +wl_event_source_remove(struct wl_event_source *source) +{ + source->interface->remove(source); + + return 0; +} + +WL_EXPORT struct wl_event_loop * +wl_event_loop_create(void) +{ + struct wl_event_loop *loop; + + loop = malloc(sizeof *loop); + if (loop == NULL) + return NULL; + + loop->epoll_fd = epoll_create(16); + if (loop->epoll_fd < 0) { + free(loop); + return NULL; + } + wl_list_init(&loop->idle_list); + + return loop; +} + +WL_EXPORT void +wl_event_loop_destroy(struct wl_event_loop *loop) +{ + close(loop->epoll_fd); + free(loop); +} + +WL_EXPORT int +wl_event_loop_dispatch(struct wl_event_loop *loop, int timeout) +{ + struct epoll_event ep[32]; + struct wl_event_source *source; + struct wl_event_source_idle *idle; + int i, count; + + count = epoll_wait(loop->epoll_fd, ep, ARRAY_LENGTH(ep), timeout); + if (count < 0) + return -1; + + for (i = 0; i < count; i++) { + source = ep[i].data.ptr; + source->interface->dispatch(source, &ep[i]); + } + + while (!wl_list_empty(&loop->idle_list)) { + idle = container_of(loop->idle_list.next, + struct wl_event_source_idle, link); + wl_list_remove(&idle->link); + idle->func(idle->data); + free(idle); + } + + return 0; +} + +WL_EXPORT int +wl_event_loop_get_fd(struct wl_event_loop *loop) +{ + return loop->epoll_fd; +} diff --git a/src/3rdparty/wayland/server/server.pro b/src/3rdparty/wayland/server/server.pro new file mode 100644 index 00000000000..2c1788ce242 --- /dev/null +++ b/src/3rdparty/wayland/server/server.pro @@ -0,0 +1,20 @@ +TEMPLATE = lib +TARGET = wayland-server +DESTDIR=$$PWD/../../../../lib/ + +CONFIG -= qt +CONFIG += shared + +INCLUDEPATH += $$PWD/.. \ + $$PWD/../../ffi + +LIBS += -L $$PWD/../../../../lib/ -lffi + +SOURCES = ../event-loop.c \ + ../wayland-server.c \ + ../wayland-protocol.c \ + ../connection.c \ + ../wayland-util.c \ + ../wayland-hash.c + +OBJECTS_DIR = .obj diff --git a/src/3rdparty/wayland/wayland-client-protocol.h b/src/3rdparty/wayland/wayland-client-protocol.h new file mode 100644 index 00000000000..0af6645bbd1 --- /dev/null +++ b/src/3rdparty/wayland/wayland-client-protocol.h @@ -0,0 +1,919 @@ +/* + * Copyright © 2010 Kristian Høgsberg + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that copyright + * notice and this permission notice appear in supporting documentation, and + * that the name of the copyright holders not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. The copyright holders make no representations + * about the suitability of this software for any purpose. It is provided "as + * is" without express or implied warranty. + * + * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THIS SOFTWARE. + */ + + +#ifndef WAYLAND_CLIENT_PROTOCOL_H +#define WAYLAND_CLIENT_PROTOCOL_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include "wayland-util.h" + +struct wl_client; + +struct wl_display; +struct wl_compositor; +struct wl_drm; +struct wl_shm; +struct wl_buffer; +struct wl_shell; +struct wl_selection; +struct wl_selection_offer; +struct wl_drag; +struct wl_drag_offer; +struct wl_surface; +struct wl_input_device; +struct wl_output; +struct wl_visual; + +struct wl_proxy; + +extern void +wl_proxy_marshal(struct wl_proxy *p, uint32_t opcode, ...); +extern struct wl_proxy * +wl_proxy_create(struct wl_proxy *factory, + const struct wl_interface *interface); +extern struct wl_proxy * +wl_proxy_create_for_id(struct wl_display *display, + const struct wl_interface *interface, uint32_t id); +extern void +wl_proxy_destroy(struct wl_proxy *proxy); + +extern int +wl_proxy_add_listener(struct wl_proxy *proxy, + void (**implementation)(void), void *data); + +extern void +wl_proxy_set_user_data(struct wl_proxy *proxy, void *user_data); + +extern void * +wl_proxy_get_user_data(struct wl_proxy *proxy); + +extern const struct wl_interface wl_display_interface; +extern const struct wl_interface wl_compositor_interface; +extern const struct wl_interface wl_drm_interface; +extern const struct wl_interface wl_shm_interface; +extern const struct wl_interface wl_buffer_interface; +extern const struct wl_interface wl_shell_interface; +extern const struct wl_interface wl_selection_interface; +extern const struct wl_interface wl_selection_offer_interface; +extern const struct wl_interface wl_drag_interface; +extern const struct wl_interface wl_drag_offer_interface; +extern const struct wl_interface wl_surface_interface; +extern const struct wl_interface wl_input_device_interface; +extern const struct wl_interface wl_output_interface; +extern const struct wl_interface wl_visual_interface; + +struct wl_display_listener { + void (*invalid_object)(void *data, + struct wl_display *display, + uint32_t object_id); + void (*invalid_method)(void *data, + struct wl_display *display, + uint32_t object_id, + uint32_t opcode); + void (*no_memory)(void *data, + struct wl_display *display); + void (*global)(void *data, + struct wl_display *display, + uint32_t id, + const char *name, + uint32_t version); + void (*range)(void *data, + struct wl_display *display, + uint32_t base); + void (*key)(void *data, + struct wl_display *display, + uint32_t key, + uint32_t time); +}; + +static inline int +wl_display_add_listener(struct wl_display *display, + const struct wl_display_listener *listener, void *data) +{ + return wl_proxy_add_listener((struct wl_proxy *) display, + (void (**)(void)) listener, data); +} + +#define WL_DISPLAY_SYNC 0 +#define WL_DISPLAY_FRAME 1 + +static inline void +wl_display_set_user_data(struct wl_display *display, void *user_data) +{ + wl_proxy_set_user_data((struct wl_proxy *) display, user_data); +} + +static inline void * +wl_display_get_user_data(struct wl_display *display) +{ + return wl_proxy_get_user_data((struct wl_proxy *) display); +} + +static inline void +wl_display_sync(struct wl_display *display, uint32_t key) +{ + wl_proxy_marshal((struct wl_proxy *) display, + WL_DISPLAY_SYNC, key); +} + +static inline void +wl_display_frame(struct wl_display *display, uint32_t key) +{ + wl_proxy_marshal((struct wl_proxy *) display, + WL_DISPLAY_FRAME, key); +} + +#define WL_COMPOSITOR_CREATE_SURFACE 0 + +static inline struct wl_compositor * +wl_compositor_create(struct wl_display *display, uint32_t id) +{ + return (struct wl_compositor *) + wl_proxy_create_for_id(display, &wl_compositor_interface, id); +} + +static inline void +wl_compositor_set_user_data(struct wl_compositor *compositor, void *user_data) +{ + wl_proxy_set_user_data((struct wl_proxy *) compositor, user_data); +} + +static inline void * +wl_compositor_get_user_data(struct wl_compositor *compositor) +{ + return wl_proxy_get_user_data((struct wl_proxy *) compositor); +} + +static inline void +wl_compositor_destroy(struct wl_compositor *compositor) +{ + wl_proxy_destroy((struct wl_proxy *) compositor); +} + +static inline struct wl_surface * +wl_compositor_create_surface(struct wl_compositor *compositor) +{ + struct wl_proxy *id; + + id = wl_proxy_create((struct wl_proxy *) compositor, + &wl_surface_interface); + if (!id) + return NULL; + + wl_proxy_marshal((struct wl_proxy *) compositor, + WL_COMPOSITOR_CREATE_SURFACE, id); + + return (struct wl_surface *) id; +} + +struct wl_drm_listener { + void (*device)(void *data, + struct wl_drm *drm, + const char *name); + void (*authenticated)(void *data, + struct wl_drm *drm); +}; + +static inline int +wl_drm_add_listener(struct wl_drm *drm, + const struct wl_drm_listener *listener, void *data) +{ + return wl_proxy_add_listener((struct wl_proxy *) drm, + (void (**)(void)) listener, data); +} + +#define WL_DRM_AUTHENTICATE 0 +#define WL_DRM_CREATE_BUFFER 1 + +static inline struct wl_drm * +wl_drm_create(struct wl_display *display, uint32_t id) +{ + return (struct wl_drm *) + wl_proxy_create_for_id(display, &wl_drm_interface, id); +} + +static inline void +wl_drm_set_user_data(struct wl_drm *drm, void *user_data) +{ + wl_proxy_set_user_data((struct wl_proxy *) drm, user_data); +} + +static inline void * +wl_drm_get_user_data(struct wl_drm *drm) +{ + return wl_proxy_get_user_data((struct wl_proxy *) drm); +} + +static inline void +wl_drm_destroy(struct wl_drm *drm) +{ + wl_proxy_destroy((struct wl_proxy *) drm); +} + +static inline void +wl_drm_authenticate(struct wl_drm *drm, uint32_t id) +{ + wl_proxy_marshal((struct wl_proxy *) drm, + WL_DRM_AUTHENTICATE, id); +} + +static inline struct wl_buffer * +wl_drm_create_buffer(struct wl_drm *drm, uint32_t name, int width, int height, uint32_t stride, struct wl_visual *visual) +{ + struct wl_proxy *id; + + id = wl_proxy_create((struct wl_proxy *) drm, + &wl_buffer_interface); + if (!id) + return NULL; + + wl_proxy_marshal((struct wl_proxy *) drm, + WL_DRM_CREATE_BUFFER, id, name, width, height, stride, visual); + + return (struct wl_buffer *) id; +} + +#define WL_SHM_CREATE_BUFFER 0 + +static inline struct wl_shm * +wl_shm_create(struct wl_display *display, uint32_t id) +{ + return (struct wl_shm *) + wl_proxy_create_for_id(display, &wl_shm_interface, id); +} + +static inline void +wl_shm_set_user_data(struct wl_shm *shm, void *user_data) +{ + wl_proxy_set_user_data((struct wl_proxy *) shm, user_data); +} + +static inline void * +wl_shm_get_user_data(struct wl_shm *shm) +{ + return wl_proxy_get_user_data((struct wl_proxy *) shm); +} + +static inline void +wl_shm_destroy(struct wl_shm *shm) +{ + wl_proxy_destroy((struct wl_proxy *) shm); +} + +static inline struct wl_buffer * +wl_shm_create_buffer(struct wl_shm *shm, int fd, int width, int height, uint32_t stride, struct wl_visual *visual) +{ + struct wl_proxy *id; + + id = wl_proxy_create((struct wl_proxy *) shm, + &wl_buffer_interface); + if (!id) + return NULL; + + wl_proxy_marshal((struct wl_proxy *) shm, + WL_SHM_CREATE_BUFFER, id, fd, width, height, stride, visual); + + return (struct wl_buffer *) id; +} + +#define WL_BUFFER_DESTROY 0 + +static inline struct wl_buffer * +wl_buffer_create(struct wl_display *display, uint32_t id) +{ + return (struct wl_buffer *) + wl_proxy_create_for_id(display, &wl_buffer_interface, id); +} + +static inline void +wl_buffer_set_user_data(struct wl_buffer *buffer, void *user_data) +{ + wl_proxy_set_user_data((struct wl_proxy *) buffer, user_data); +} + +static inline void * +wl_buffer_get_user_data(struct wl_buffer *buffer) +{ + return wl_proxy_get_user_data((struct wl_proxy *) buffer); +} + +static inline void +wl_buffer_destroy(struct wl_buffer *buffer) +{ + wl_proxy_marshal((struct wl_proxy *) buffer, + WL_BUFFER_DESTROY); + + wl_proxy_destroy((struct wl_proxy *) buffer); +} + +#ifndef WL_SHELL_RESIZE_ENUM +#define WL_SHELL_RESIZE_ENUM +enum wl_shell_resize { + WL_SHELL_RESIZE_NONE = 0, + WL_SHELL_RESIZE_TOP = 1, + WL_SHELL_RESIZE_BOTTOM = 2, + WL_SHELL_RESIZE_LEFT = 4, + WL_SHELL_RESIZE_TOP_LEFT = 5, + WL_SHELL_RESIZE_BOTTOM_LEFT = 6, + WL_SHELL_RESIZE_RIGHT = 8, + WL_SHELL_RESIZE_TOP_RIGHT = 9, + WL_SHELL_RESIZE_BOTTOM_RIGHT = 10, +}; +#endif /* WL_SHELL_RESIZE_ENUM */ + +struct wl_shell_listener { + void (*configure)(void *data, + struct wl_shell *shell, + uint32_t time, + uint32_t edges, + struct wl_surface *surface, + int width, + int height); +}; + +static inline int +wl_shell_add_listener(struct wl_shell *shell, + const struct wl_shell_listener *listener, void *data) +{ + return wl_proxy_add_listener((struct wl_proxy *) shell, + (void (**)(void)) listener, data); +} + +#define WL_SHELL_MOVE 0 +#define WL_SHELL_RESIZE 1 +#define WL_SHELL_CREATE_DRAG 2 +#define WL_SHELL_CREATE_SELECTION 3 + +static inline struct wl_shell * +wl_shell_create(struct wl_display *display, uint32_t id) +{ + return (struct wl_shell *) + wl_proxy_create_for_id(display, &wl_shell_interface, id); +} + +static inline void +wl_shell_set_user_data(struct wl_shell *shell, void *user_data) +{ + wl_proxy_set_user_data((struct wl_proxy *) shell, user_data); +} + +static inline void * +wl_shell_get_user_data(struct wl_shell *shell) +{ + return wl_proxy_get_user_data((struct wl_proxy *) shell); +} + +static inline void +wl_shell_destroy(struct wl_shell *shell) +{ + wl_proxy_destroy((struct wl_proxy *) shell); +} + +static inline void +wl_shell_move(struct wl_shell *shell, struct wl_surface *surface, struct wl_input_device *input_device, uint32_t time) +{ + wl_proxy_marshal((struct wl_proxy *) shell, + WL_SHELL_MOVE, surface, input_device, time); +} + +static inline void +wl_shell_resize(struct wl_shell *shell, struct wl_surface *surface, struct wl_input_device *input_device, uint32_t time, uint32_t edges) +{ + wl_proxy_marshal((struct wl_proxy *) shell, + WL_SHELL_RESIZE, surface, input_device, time, edges); +} + +static inline struct wl_drag * +wl_shell_create_drag(struct wl_shell *shell) +{ + struct wl_proxy *id; + + id = wl_proxy_create((struct wl_proxy *) shell, + &wl_drag_interface); + if (!id) + return NULL; + + wl_proxy_marshal((struct wl_proxy *) shell, + WL_SHELL_CREATE_DRAG, id); + + return (struct wl_drag *) id; +} + +static inline struct wl_selection * +wl_shell_create_selection(struct wl_shell *shell) +{ + struct wl_proxy *id; + + id = wl_proxy_create((struct wl_proxy *) shell, + &wl_selection_interface); + if (!id) + return NULL; + + wl_proxy_marshal((struct wl_proxy *) shell, + WL_SHELL_CREATE_SELECTION, id); + + return (struct wl_selection *) id; +} + +struct wl_selection_listener { + void (*send)(void *data, + struct wl_selection *selection, + const char *mime_type, + int fd); + void (*cancelled)(void *data, + struct wl_selection *selection); +}; + +static inline int +wl_selection_add_listener(struct wl_selection *selection, + const struct wl_selection_listener *listener, void *data) +{ + return wl_proxy_add_listener((struct wl_proxy *) selection, + (void (**)(void)) listener, data); +} + +#define WL_SELECTION_OFFER 0 +#define WL_SELECTION_ACTIVATE 1 +#define WL_SELECTION_DESTROY 2 + +static inline struct wl_selection * +wl_selection_create(struct wl_display *display, uint32_t id) +{ + return (struct wl_selection *) + wl_proxy_create_for_id(display, &wl_selection_interface, id); +} + +static inline void +wl_selection_set_user_data(struct wl_selection *selection, void *user_data) +{ + wl_proxy_set_user_data((struct wl_proxy *) selection, user_data); +} + +static inline void * +wl_selection_get_user_data(struct wl_selection *selection) +{ + return wl_proxy_get_user_data((struct wl_proxy *) selection); +} + +static inline void +wl_selection_offer(struct wl_selection *selection, const char *type) +{ + wl_proxy_marshal((struct wl_proxy *) selection, + WL_SELECTION_OFFER, type); +} + +static inline void +wl_selection_activate(struct wl_selection *selection, struct wl_input_device *input_device, uint32_t time) +{ + wl_proxy_marshal((struct wl_proxy *) selection, + WL_SELECTION_ACTIVATE, input_device, time); +} + +static inline void +wl_selection_destroy(struct wl_selection *selection) +{ + wl_proxy_marshal((struct wl_proxy *) selection, + WL_SELECTION_DESTROY); + + wl_proxy_destroy((struct wl_proxy *) selection); +} + +struct wl_selection_offer_listener { + void (*offer)(void *data, + struct wl_selection_offer *selection_offer, + const char *type); + void (*keyboard_focus)(void *data, + struct wl_selection_offer *selection_offer, + struct wl_input_device *input_device); +}; + +static inline int +wl_selection_offer_add_listener(struct wl_selection_offer *selection_offer, + const struct wl_selection_offer_listener *listener, void *data) +{ + return wl_proxy_add_listener((struct wl_proxy *) selection_offer, + (void (**)(void)) listener, data); +} + +#define WL_SELECTION_OFFER_RECEIVE 0 + +static inline struct wl_selection_offer * +wl_selection_offer_create(struct wl_display *display, uint32_t id) +{ + return (struct wl_selection_offer *) + wl_proxy_create_for_id(display, &wl_selection_offer_interface, id); +} + +static inline void +wl_selection_offer_set_user_data(struct wl_selection_offer *selection_offer, void *user_data) +{ + wl_proxy_set_user_data((struct wl_proxy *) selection_offer, user_data); +} + +static inline void * +wl_selection_offer_get_user_data(struct wl_selection_offer *selection_offer) +{ + return wl_proxy_get_user_data((struct wl_proxy *) selection_offer); +} + +static inline void +wl_selection_offer_destroy(struct wl_selection_offer *selection_offer) +{ + wl_proxy_destroy((struct wl_proxy *) selection_offer); +} + +static inline void +wl_selection_offer_receive(struct wl_selection_offer *selection_offer, const char *mime_type, int fd) +{ + wl_proxy_marshal((struct wl_proxy *) selection_offer, + WL_SELECTION_OFFER_RECEIVE, mime_type, fd); +} + +struct wl_drag_listener { + void (*target)(void *data, + struct wl_drag *drag, + const char *mime_type); + void (*finish)(void *data, + struct wl_drag *drag, + int fd); + void (*reject)(void *data, + struct wl_drag *drag); +}; + +static inline int +wl_drag_add_listener(struct wl_drag *drag, + const struct wl_drag_listener *listener, void *data) +{ + return wl_proxy_add_listener((struct wl_proxy *) drag, + (void (**)(void)) listener, data); +} + +#define WL_DRAG_OFFER 0 +#define WL_DRAG_ACTIVATE 1 +#define WL_DRAG_DESTROY 2 + +static inline struct wl_drag * +wl_drag_create(struct wl_display *display, uint32_t id) +{ + return (struct wl_drag *) + wl_proxy_create_for_id(display, &wl_drag_interface, id); +} + +static inline void +wl_drag_set_user_data(struct wl_drag *drag, void *user_data) +{ + wl_proxy_set_user_data((struct wl_proxy *) drag, user_data); +} + +static inline void * +wl_drag_get_user_data(struct wl_drag *drag) +{ + return wl_proxy_get_user_data((struct wl_proxy *) drag); +} + +static inline void +wl_drag_offer(struct wl_drag *drag, const char *type) +{ + wl_proxy_marshal((struct wl_proxy *) drag, + WL_DRAG_OFFER, type); +} + +static inline void +wl_drag_activate(struct wl_drag *drag, struct wl_surface *surface, struct wl_input_device *input_device, uint32_t time) +{ + wl_proxy_marshal((struct wl_proxy *) drag, + WL_DRAG_ACTIVATE, surface, input_device, time); +} + +static inline void +wl_drag_destroy(struct wl_drag *drag) +{ + wl_proxy_marshal((struct wl_proxy *) drag, + WL_DRAG_DESTROY); + + wl_proxy_destroy((struct wl_proxy *) drag); +} + +struct wl_drag_offer_listener { + void (*offer)(void *data, + struct wl_drag_offer *drag_offer, + const char *type); + void (*pointer_focus)(void *data, + struct wl_drag_offer *drag_offer, + uint32_t time, + struct wl_surface *surface, + int x, + int y, + int surface_x, + int surface_y); + void (*motion)(void *data, + struct wl_drag_offer *drag_offer, + uint32_t time, + int x, + int y, + int surface_x, + int surface_y); + void (*drop)(void *data, + struct wl_drag_offer *drag_offer); +}; + +static inline int +wl_drag_offer_add_listener(struct wl_drag_offer *drag_offer, + const struct wl_drag_offer_listener *listener, void *data) +{ + return wl_proxy_add_listener((struct wl_proxy *) drag_offer, + (void (**)(void)) listener, data); +} + +#define WL_DRAG_OFFER_ACCEPT 0 +#define WL_DRAG_OFFER_RECEIVE 1 +#define WL_DRAG_OFFER_REJECT 2 + +static inline struct wl_drag_offer * +wl_drag_offer_create(struct wl_display *display, uint32_t id) +{ + return (struct wl_drag_offer *) + wl_proxy_create_for_id(display, &wl_drag_offer_interface, id); +} + +static inline void +wl_drag_offer_set_user_data(struct wl_drag_offer *drag_offer, void *user_data) +{ + wl_proxy_set_user_data((struct wl_proxy *) drag_offer, user_data); +} + +static inline void * +wl_drag_offer_get_user_data(struct wl_drag_offer *drag_offer) +{ + return wl_proxy_get_user_data((struct wl_proxy *) drag_offer); +} + +static inline void +wl_drag_offer_destroy(struct wl_drag_offer *drag_offer) +{ + wl_proxy_destroy((struct wl_proxy *) drag_offer); +} + +static inline void +wl_drag_offer_accept(struct wl_drag_offer *drag_offer, uint32_t time, const char *type) +{ + wl_proxy_marshal((struct wl_proxy *) drag_offer, + WL_DRAG_OFFER_ACCEPT, time, type); +} + +static inline void +wl_drag_offer_receive(struct wl_drag_offer *drag_offer, int fd) +{ + wl_proxy_marshal((struct wl_proxy *) drag_offer, + WL_DRAG_OFFER_RECEIVE, fd); +} + +static inline void +wl_drag_offer_reject(struct wl_drag_offer *drag_offer) +{ + wl_proxy_marshal((struct wl_proxy *) drag_offer, + WL_DRAG_OFFER_REJECT); +} + +#define WL_SURFACE_DESTROY 0 +#define WL_SURFACE_ATTACH 1 +#define WL_SURFACE_MAP_TOPLEVEL 2 +#define WL_SURFACE_MAP_TRANSIENT 3 +#define WL_SURFACE_MAP_FULLSCREEN 4 +#define WL_SURFACE_DAMAGE 5 + +static inline struct wl_surface * +wl_surface_create(struct wl_display *display, uint32_t id) +{ + return (struct wl_surface *) + wl_proxy_create_for_id(display, &wl_surface_interface, id); +} + +static inline void +wl_surface_set_user_data(struct wl_surface *surface, void *user_data) +{ + wl_proxy_set_user_data((struct wl_proxy *) surface, user_data); +} + +static inline void * +wl_surface_get_user_data(struct wl_surface *surface) +{ + return wl_proxy_get_user_data((struct wl_proxy *) surface); +} + +static inline void +wl_surface_destroy(struct wl_surface *surface) +{ + wl_proxy_marshal((struct wl_proxy *) surface, + WL_SURFACE_DESTROY); + + wl_proxy_destroy((struct wl_proxy *) surface); +} + +static inline void +wl_surface_attach(struct wl_surface *surface, struct wl_buffer *buffer, int x, int y) +{ + wl_proxy_marshal((struct wl_proxy *) surface, + WL_SURFACE_ATTACH, buffer, x, y); +} + +static inline void +wl_surface_map_toplevel(struct wl_surface *surface) +{ + wl_proxy_marshal((struct wl_proxy *) surface, + WL_SURFACE_MAP_TOPLEVEL); +} + +static inline void +wl_surface_map_transient(struct wl_surface *surface, struct wl_surface *parent, int x, int y, uint32_t flags) +{ + wl_proxy_marshal((struct wl_proxy *) surface, + WL_SURFACE_MAP_TRANSIENT, parent, x, y, flags); +} + +static inline void +wl_surface_map_fullscreen(struct wl_surface *surface) +{ + wl_proxy_marshal((struct wl_proxy *) surface, + WL_SURFACE_MAP_FULLSCREEN); +} + +static inline void +wl_surface_damage(struct wl_surface *surface, int x, int y, int width, int height) +{ + wl_proxy_marshal((struct wl_proxy *) surface, + WL_SURFACE_DAMAGE, x, y, width, height); +} + +struct wl_input_device_listener { + void (*motion)(void *data, + struct wl_input_device *input_device, + uint32_t time, + int x, + int y, + int surface_x, + int surface_y); + void (*button)(void *data, + struct wl_input_device *input_device, + uint32_t time, + uint32_t button, + uint32_t state); + void (*key)(void *data, + struct wl_input_device *input_device, + uint32_t time, + uint32_t key, + uint32_t state); + void (*pointer_focus)(void *data, + struct wl_input_device *input_device, + uint32_t time, + struct wl_surface *surface, + int x, + int y, + int surface_x, + int surface_y); + void (*keyboard_focus)(void *data, + struct wl_input_device *input_device, + uint32_t time, + struct wl_surface *surface, + struct wl_array *keys); +}; + +static inline int +wl_input_device_add_listener(struct wl_input_device *input_device, + const struct wl_input_device_listener *listener, void *data) +{ + return wl_proxy_add_listener((struct wl_proxy *) input_device, + (void (**)(void)) listener, data); +} + +#define WL_INPUT_DEVICE_ATTACH 0 + +static inline struct wl_input_device * +wl_input_device_create(struct wl_display *display, uint32_t id) +{ + return (struct wl_input_device *) + wl_proxy_create_for_id(display, &wl_input_device_interface, id); +} + +static inline void +wl_input_device_set_user_data(struct wl_input_device *input_device, void *user_data) +{ + wl_proxy_set_user_data((struct wl_proxy *) input_device, user_data); +} + +static inline void * +wl_input_device_get_user_data(struct wl_input_device *input_device) +{ + return wl_proxy_get_user_data((struct wl_proxy *) input_device); +} + +static inline void +wl_input_device_destroy(struct wl_input_device *input_device) +{ + wl_proxy_destroy((struct wl_proxy *) input_device); +} + +static inline void +wl_input_device_attach(struct wl_input_device *input_device, uint32_t time, struct wl_buffer *buffer, int hotspot_x, int hotspot_y) +{ + wl_proxy_marshal((struct wl_proxy *) input_device, + WL_INPUT_DEVICE_ATTACH, time, buffer, hotspot_x, hotspot_y); +} + +struct wl_output_listener { + void (*geometry)(void *data, + struct wl_output *output, + int x, + int y, + int width, + int height); +}; + +static inline int +wl_output_add_listener(struct wl_output *output, + const struct wl_output_listener *listener, void *data) +{ + return wl_proxy_add_listener((struct wl_proxy *) output, + (void (**)(void)) listener, data); +} + +static inline struct wl_output * +wl_output_create(struct wl_display *display, uint32_t id) +{ + return (struct wl_output *) + wl_proxy_create_for_id(display, &wl_output_interface, id); +} + +static inline void +wl_output_set_user_data(struct wl_output *output, void *user_data) +{ + wl_proxy_set_user_data((struct wl_proxy *) output, user_data); +} + +static inline void * +wl_output_get_user_data(struct wl_output *output) +{ + return wl_proxy_get_user_data((struct wl_proxy *) output); +} + +static inline void +wl_output_destroy(struct wl_output *output) +{ + wl_proxy_destroy((struct wl_proxy *) output); +} + +static inline struct wl_visual * +wl_visual_create(struct wl_display *display, uint32_t id) +{ + return (struct wl_visual *) + wl_proxy_create_for_id(display, &wl_visual_interface, id); +} + +static inline void +wl_visual_set_user_data(struct wl_visual *visual, void *user_data) +{ + wl_proxy_set_user_data((struct wl_proxy *) visual, user_data); +} + +static inline void * +wl_visual_get_user_data(struct wl_visual *visual) +{ + return wl_proxy_get_user_data((struct wl_proxy *) visual); +} + +static inline void +wl_visual_destroy(struct wl_visual *visual) +{ + wl_proxy_destroy((struct wl_proxy *) visual); +} + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/src/3rdparty/wayland/wayland-client.c b/src/3rdparty/wayland/wayland-client.c new file mode 100644 index 00000000000..e3198c729ea --- /dev/null +++ b/src/3rdparty/wayland/wayland-client.c @@ -0,0 +1,565 @@ +/* + * Copyright © 2008 Kristian Høgsberg + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that copyright + * notice and this permission notice appear in supporting documentation, and + * that the name of the copyright holders not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. The copyright holders make no representations + * about the suitability of this software for any purpose. It is provided "as + * is" without express or implied warranty. + * + * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THIS SOFTWARE. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "wayland-client-protocol.h" +#include "connection.h" +#include "wayland-util.h" +#include "wayland-client.h" + +struct wl_global_listener { + wl_display_global_func_t handler; + void *data; + struct wl_list link; +}; + +struct wl_listener { + void (**implementation)(void); + void *data; + struct wl_list link; +}; + +struct wl_proxy { + struct wl_object object; + struct wl_display *display; + struct wl_list listener_list; + void *user_data; +}; + +struct wl_sync_handler { + wl_display_sync_func_t func; + uint32_t key; + void *data; + struct wl_list link; +}; + +struct wl_frame_handler { + wl_display_frame_func_t func; + uint32_t key; + void *data; + struct wl_list link; +}; + +struct wl_display { + struct wl_proxy proxy; + struct wl_connection *connection; + int fd; + uint32_t id, id_count, next_range; + uint32_t mask; + struct wl_hash_table *objects; + struct wl_listener listener; + struct wl_list global_listener_list; + + struct wl_visual *argb_visual; + struct wl_visual *premultiplied_argb_visual; + struct wl_visual *rgb_visual; + + wl_display_update_func_t update; + void *update_data; + + wl_display_global_func_t global_handler; + void *global_handler_data; + + struct wl_list sync_list, frame_list; + uint32_t key; +}; + +static int wl_debug = 0; + +static int +connection_update(struct wl_connection *connection, + uint32_t mask, void *data) +{ + struct wl_display *display = data; + + display->mask = mask; + if (display->update) + return display->update(display->mask, + display->update_data); + + return 0; +} + +WL_EXPORT struct wl_global_listener * +wl_display_add_global_listener(struct wl_display *display, + wl_display_global_func_t handler, void *data) +{ + struct wl_global_listener *listener; + + listener = malloc(sizeof *listener); + if (listener == NULL) + return NULL; + + listener->handler = handler; + listener->data = data; + wl_list_insert(display->global_listener_list.prev, &listener->link); + + return listener; +} + +WL_EXPORT void +wl_display_remove_global_listener(struct wl_display *display, + struct wl_global_listener *listener) +{ + wl_list_remove(&listener->link); + free(listener); +} + +WL_EXPORT struct wl_proxy * +wl_proxy_create_for_id(struct wl_display *display, + const struct wl_interface *interface, uint32_t id) +{ + struct wl_proxy *proxy; + + proxy = malloc(sizeof *proxy); + if (proxy == NULL) + return NULL; + + proxy->object.interface = interface; + proxy->object.id = id; + proxy->display = display; + wl_list_init(&proxy->listener_list); + wl_hash_table_insert(display->objects, proxy->object.id, proxy); + + return proxy; +} + +WL_EXPORT struct wl_proxy * +wl_proxy_create(struct wl_proxy *factory, + const struct wl_interface *interface) +{ + return wl_proxy_create_for_id(factory->display, interface, + wl_display_allocate_id(factory->display)); +} + +WL_EXPORT void +wl_proxy_destroy(struct wl_proxy *proxy) +{ + struct wl_listener *listener, *next; + + wl_list_for_each_safe(listener, next, &proxy->listener_list, link) + free(listener); + + wl_hash_table_remove(proxy->display->objects, proxy->object.id); + free(proxy); +} + +WL_EXPORT int +wl_proxy_add_listener(struct wl_proxy *proxy, + void (**implementation)(void), void *data) +{ + struct wl_listener *listener; + + listener = malloc(sizeof *listener); + if (listener == NULL) + return -1; + + listener->implementation = (void (**)(void)) implementation; + listener->data = data; + wl_list_insert(proxy->listener_list.prev, &listener->link); + + return 0; +} + +WL_EXPORT void +wl_proxy_marshal(struct wl_proxy *proxy, uint32_t opcode, ...) +{ + struct wl_closure *closure; + va_list ap; + + va_start(ap, opcode); + closure = wl_connection_vmarshal(proxy->display->connection, + &proxy->object, opcode, ap, + &proxy->object.interface->methods[opcode]); + va_end(ap); + + wl_closure_send(closure, proxy->display->connection); + + if (wl_debug) { + fprintf(stderr, " -> "); + wl_closure_print(closure, &proxy->object); + } + + wl_closure_destroy(closure); +} + +static void +add_visual(struct wl_display *display, uint32_t id) +{ + struct wl_visual *visual; + + visual = (struct wl_visual *) + wl_proxy_create_for_id(display, &wl_visual_interface, id); + if (display->argb_visual == NULL) + display->argb_visual = visual; + else if (display->premultiplied_argb_visual == NULL) + display->premultiplied_argb_visual = visual; + else + display->rgb_visual = visual; +} + +WL_EXPORT struct wl_visual * +wl_display_get_argb_visual(struct wl_display *display) +{ + return display->argb_visual; +} + +WL_EXPORT struct wl_visual * +wl_display_get_premultiplied_argb_visual(struct wl_display *display) +{ + return display->premultiplied_argb_visual; +} + +WL_EXPORT struct wl_visual * +wl_display_get_rgb_visual(struct wl_display *display) +{ + return display->rgb_visual; +} + +static void +display_handle_invalid_object(void *data, + struct wl_display *display, uint32_t id) +{ + fprintf(stderr, "sent request to invalid object\n"); + abort(); +} + +static void +display_handle_invalid_method(void *data, + struct wl_display *display, + uint32_t id, uint32_t opcode) +{ + fprintf(stderr, "sent invalid request opcode\n"); + abort(); +} + +static void +display_handle_no_memory(void *data, + struct wl_display *display) +{ + fprintf(stderr, "server out of memory\n"); + abort(); +} + +static void +display_handle_global(void *data, + struct wl_display *display, + uint32_t id, const char *interface, uint32_t version) +{ + struct wl_global_listener *listener; + + if (strcmp(interface, "display") == 0) + wl_hash_table_insert(display->objects, + id, &display->proxy.object); + else if (strcmp(interface, "visual") == 0) + add_visual(display, id); + + wl_list_for_each(listener, &display->global_listener_list, link) + (*listener->handler)(display, + id, interface, version, listener->data); +} + +static void +display_handle_range(void *data, + struct wl_display *display, uint32_t range) +{ + display->next_range = range; +} + +static void +display_handle_key(void *data, + struct wl_display *display, uint32_t key, uint32_t time) +{ + struct wl_sync_handler *sync_handler; + struct wl_frame_handler *frame_handler; + + sync_handler = container_of(display->sync_list.next, + struct wl_sync_handler, link); + if (!wl_list_empty(&display->sync_list) && sync_handler->key == key) { + wl_list_remove(&sync_handler->link); + sync_handler->func(sync_handler->data); + free(sync_handler); + return; + } + + frame_handler = container_of(display->frame_list. next, + struct wl_frame_handler, link); + if (!wl_list_empty(&display->frame_list) && + frame_handler->key == key) { + wl_list_remove(&frame_handler->link); + frame_handler->func(frame_handler->data, time); + free(frame_handler); + return; + } + + fprintf(stderr, "unsolicited sync event, client gone?\n"); +} + +static const struct wl_display_listener display_listener = { + display_handle_invalid_object, + display_handle_invalid_method, + display_handle_no_memory, + display_handle_global, + display_handle_range, + display_handle_key +}; + +WL_EXPORT struct wl_display * +wl_display_connect(const char *name) +{ + struct wl_display *display; + struct sockaddr_un addr; + socklen_t size; + const char *runtime_dir; + const char *debug; + size_t name_size; + + debug = getenv("WAYLAND_DEBUG"); + if (debug) + wl_debug = 1; + + display = malloc(sizeof *display); + if (display == NULL) + return NULL; + + memset(display, 0, sizeof *display); + display->fd = socket(PF_LOCAL, SOCK_STREAM, 0); + if (display->fd < 0) { + free(display); + return NULL; + } + + runtime_dir = getenv("XDG_RUNTIME_DIR"); + if (runtime_dir == NULL) { + runtime_dir = "."; + fprintf(stderr, + "XDG_RUNTIME_DIR not set, falling back to %s\n", + runtime_dir); + } + + if (name == NULL) + name = getenv("WAYLAND_DISPLAY"); + if (name == NULL) + name = "wayland-0"; + + memset(&addr, 0, sizeof addr); + addr.sun_family = AF_LOCAL; + name_size = + snprintf(addr.sun_path, sizeof addr.sun_path, + "%s/%s", runtime_dir, name) + 1; + + size = offsetof (struct sockaddr_un, sun_path) + name_size; + + if (connect(display->fd, (struct sockaddr *) &addr, size) < 0) { + close(display->fd); + free(display); + return NULL; + } + + display->objects = wl_hash_table_create(); + wl_list_init(&display->global_listener_list); + + display->proxy.object.interface = &wl_display_interface; + display->proxy.object.id = 1; + display->proxy.display = display; + wl_list_init(&display->proxy.listener_list); + + wl_list_init(&display->sync_list); + wl_list_init(&display->frame_list); + + display->listener.implementation = (void(**)(void)) &display_listener; + wl_list_insert(display->proxy.listener_list.prev, &display->listener.link); + + display->connection = wl_connection_create(display->fd, + connection_update, + display); + + return display; +} + +WL_EXPORT void +wl_display_destroy(struct wl_display *display) +{ + wl_connection_destroy(display->connection); + close(display->fd); + free(display); +} + +WL_EXPORT int +wl_display_get_fd(struct wl_display *display, + wl_display_update_func_t update, void *data) +{ + display->update = update; + display->update_data = data; + + display->update(display->mask, display->update_data); + + return display->fd; +} + +WL_EXPORT int +wl_display_sync_callback(struct wl_display *display, + wl_display_sync_func_t func, void *data) +{ + struct wl_sync_handler *handler; + + handler = malloc(sizeof *handler); + if (handler == NULL) + return -1; + + handler->func = func; + handler->key = display->key++; + handler->data = data; + + wl_list_insert(display->sync_list.prev, &handler->link); + wl_display_sync(display, handler->key); + + return 0; +} + +WL_EXPORT int +wl_display_frame_callback(struct wl_display *display, + wl_display_frame_func_t func, void *data) +{ + struct wl_frame_handler *handler; + + handler = malloc(sizeof *handler); + if (handler == NULL) + return -1; + + handler->func = func; + handler->key = display->key++; + handler->data = data; + + wl_list_insert(display->frame_list.prev, &handler->link); + wl_display_frame(display, handler->key); + + return 0; +} + +static void +handle_event(struct wl_display *display, + uint32_t id, uint32_t opcode, uint32_t size) +{ + uint32_t p[32]; + struct wl_listener *listener; + struct wl_proxy *proxy; + struct wl_closure *closure; + const struct wl_message *message; + + wl_connection_copy(display->connection, p, size); + if (id == 1) + proxy = &display->proxy; + else + proxy = wl_hash_table_lookup(display->objects, id); + + if (proxy == NULL) { + wl_connection_consume(display->connection, size); + return; + } + + message = &proxy->object.interface->events[opcode]; + closure = wl_connection_demarshal(display->connection, + size, display->objects, message); + + if (wl_debug) + wl_closure_print(closure, &proxy->object); + + wl_list_for_each(listener, &proxy->listener_list, link) + wl_closure_invoke(closure, &proxy->object, + listener->implementation[opcode], + listener->data); + + wl_closure_destroy(closure); +} + +WL_EXPORT void +wl_display_iterate(struct wl_display *display, uint32_t mask) +{ + uint32_t p[2], object, opcode, size; + int len; + + mask &= display->mask; + if (mask == 0) { + fprintf(stderr, + "wl_display_iterate called with unsolicited flags"); + return; + } + + len = wl_connection_data(display->connection, mask); + while (len > 0) { + if (len < sizeof p) + break; + + wl_connection_copy(display->connection, p, sizeof p); + object = p[0]; + opcode = p[1] & 0xffff; + size = p[1] >> 16; + if (len < size) + break; + + handle_event(display, object, opcode, size); + len -= size; + } + + if (len < 0) { + fprintf(stderr, "read error: %m\n"); + exit(EXIT_FAILURE); + } +} + +WL_EXPORT uint32_t +wl_display_allocate_id(struct wl_display *display) +{ + if (display->id_count == 0) { + display->id_count = 256; + display->id = display->next_range; + } + + display->id_count--; + + return display->id++; +} + +WL_EXPORT void +wl_proxy_set_user_data(struct wl_proxy *proxy, void *user_data) +{ + proxy->user_data = user_data; +} + +WL_EXPORT void * +wl_proxy_get_user_data(struct wl_proxy *proxy) +{ + return proxy->user_data; +} diff --git a/src/3rdparty/wayland/wayland-client.h b/src/3rdparty/wayland/wayland-client.h new file mode 100644 index 00000000000..d207b0763df --- /dev/null +++ b/src/3rdparty/wayland/wayland-client.h @@ -0,0 +1,75 @@ +/* + * Copyright © 2008 Kristian Høgsberg + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that copyright + * notice and this permission notice appear in supporting documentation, and + * that the name of the copyright holders not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. The copyright holders make no representations + * about the suitability of this software for any purpose. It is provided "as + * is" without express or implied warranty. + * + * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THIS SOFTWARE. + */ + +#ifndef _WAYLAND_CLIENT_H +#define _WAYLAND_CLIENT_H + +#include "wayland-util.h" +#include "wayland-client-protocol.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define WL_DISPLAY_READABLE 0x01 +#define WL_DISPLAY_WRITABLE 0x02 + +typedef int (*wl_display_update_func_t)(uint32_t mask, void *data); +typedef void (*wl_display_sync_func_t)(void *data); +typedef void (*wl_display_frame_func_t)(void *data, uint32_t time); + +struct wl_display *wl_display_connect(const char *name); +void wl_display_destroy(struct wl_display *display); +int wl_display_get_fd(struct wl_display *display, + wl_display_update_func_t update, void *data); +uint32_t wl_display_allocate_id(struct wl_display *display); +void wl_display_iterate(struct wl_display *display, uint32_t mask); +int wl_display_sync_callback(struct wl_display *display, + wl_display_sync_func_t func, void *data); +int wl_display_frame_callback(struct wl_display *display, + wl_display_frame_func_t func, void *data); + +struct wl_global_listener; +typedef void (*wl_display_global_func_t)(struct wl_display *display, + uint32_t id, + const char *interface, + uint32_t version, + void *data); +void +wl_display_remove_global_listener(struct wl_display *display, + struct wl_global_listener *listener); + +struct wl_global_listener * +wl_display_add_global_listener(struct wl_display *display, + wl_display_global_func_t handler, void *data); +struct wl_visual * +wl_display_get_argb_visual(struct wl_display *display); +struct wl_visual * +wl_display_get_premultiplied_argb_visual(struct wl_display *display); +struct wl_visual * +wl_display_get_rgb_visual(struct wl_display *display); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/src/3rdparty/wayland/wayland-egl.h b/src/3rdparty/wayland/wayland-egl.h new file mode 100644 index 00000000000..d3de87c79af --- /dev/null +++ b/src/3rdparty/wayland/wayland-egl.h @@ -0,0 +1,82 @@ +/* + * Copyright © 2011 Kristian Høgsberg + * Copyright © 2011 Benjamin Franzke + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that copyright + * notice and this permission notice appear in supporting documentation, and + * that the name of the copyright holders not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. The copyright holders make no representations + * about the suitability of this software for any purpose. It is provided "as + * is" without express or implied warranty. + * + * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THIS SOFTWARE. + */ + +#ifndef _WAYLAND_EGL_H +#define _WAYLAND_EGL_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#define WL_EGL_PLATFORM 1 + +struct wl_egl_display; +struct wl_egl_window; +struct wl_egl_pixmap; + +struct wl_egl_display * +wl_egl_display_create(struct wl_display *egl_display); + +void +wl_egl_display_destroy(struct wl_egl_display *egl_display); + +struct wl_egl_window * +wl_egl_window_create(struct wl_egl_display *egl_display, + struct wl_surface *surface, + int width, int height, + struct wl_visual *visual); + +void +wl_egl_window_destroy(struct wl_egl_window *egl_window); + +void +wl_egl_window_resize(struct wl_egl_window *egl_window, + int width, int height, + int dx, int dy); + +void +wl_egl_window_get_attached_size(struct wl_egl_window *egl_window, + int *width, int *height); + +struct wl_egl_pixmap * +wl_egl_pixmap_create(struct wl_egl_display *egl_display, + int width, int height, + struct wl_visual *visual, uint32_t flags); +void +wl_egl_pixmap_destroy(struct wl_egl_pixmap *egl_pixmap); + +struct wl_buffer * +wl_egl_pixmap_create_buffer(struct wl_egl_display *egl_display, + struct wl_egl_pixmap *egl_pixmap); + +void +wl_egl_pixmap_flush(struct wl_egl_display *egl_display, + struct wl_egl_pixmap *egl_pixmap); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/src/3rdparty/wayland/wayland-hash.c b/src/3rdparty/wayland/wayland-hash.c new file mode 100644 index 00000000000..b299a33da11 --- /dev/null +++ b/src/3rdparty/wayland/wayland-hash.c @@ -0,0 +1,296 @@ +/* + * Copyright © 2009 Intel Corporation + * Copyright © 1988-2004 Keith Packard and Bart Massey. + * + * 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. + * + * Except as contained in this notice, the names of the authors + * or their institutions shall not be used in advertising or + * otherwise to promote the sale, use or other dealings in this + * Software without prior written authorization from the + * authors. + * + * Authors: + * Eric Anholt + * Keith Packard + */ + +#include + +#include "wayland-util.h" + +struct hash_entry { + uint32_t hash; + void *data; +}; + +struct wl_hash_table { + struct hash_entry *table; + uint32_t size; + uint32_t rehash; + uint32_t max_entries; + uint32_t size_index; + uint32_t entries; + uint32_t deleted_entries; +}; + +#define ARRAY_SIZE(array) (sizeof(array) / sizeof(array[0])) + +/* + * From Knuth -- a good choice for hash/rehash values is p, p-2 where + * p and p-2 are both prime. These tables are sized to have an extra 10% + * free to avoid exponential performance degradation as the hash table fills + */ + +static const uint32_t deleted_data; + +static const struct { + uint32_t max_entries, size, rehash; +} hash_sizes[] = { + { 2, 5, 3 }, + { 4, 7, 5 }, + { 8, 13, 11 }, + { 16, 19, 17 }, + { 32, 43, 41 }, + { 64, 73, 71 }, + { 128, 151, 149 }, + { 256, 283, 281 }, + { 512, 571, 569 }, + { 1024, 1153, 1151 }, + { 2048, 2269, 2267 }, + { 4096, 4519, 4517 }, + { 8192, 9013, 9011 }, + { 16384, 18043, 18041 }, + { 32768, 36109, 36107 }, + { 65536, 72091, 72089 }, + { 131072, 144409, 144407 }, + { 262144, 288361, 288359 }, + { 524288, 576883, 576881 }, + { 1048576, 1153459, 1153457 }, + { 2097152, 2307163, 2307161 }, + { 4194304, 4613893, 4613891 }, + { 8388608, 9227641, 9227639 }, + { 16777216, 18455029, 18455027 }, + { 33554432, 36911011, 36911009 }, + { 67108864, 73819861, 73819859 }, + { 134217728, 147639589, 147639587 }, + { 268435456, 295279081, 295279079 }, + { 536870912, 590559793, 590559791 }, + { 1073741824, 1181116273, 1181116271}, + { 2147483648ul, 2362232233ul, 2362232231ul} +}; + +static int +entry_is_free(struct hash_entry *entry) +{ + return entry->data == NULL; +} + +static int +entry_is_deleted(struct hash_entry *entry) +{ + return entry->data == &deleted_data; +} + +static int +entry_is_present(struct hash_entry *entry) +{ + return entry->data != NULL && entry->data != &deleted_data; +} + +WL_EXPORT struct wl_hash_table * +wl_hash_table_create(void) +{ + struct wl_hash_table *ht; + + ht = malloc(sizeof(*ht)); + if (ht == NULL) + return NULL; + + ht->size_index = 0; + ht->size = hash_sizes[ht->size_index].size; + ht->rehash = hash_sizes[ht->size_index].rehash; + ht->max_entries = hash_sizes[ht->size_index].max_entries; + ht->table = calloc(ht->size, sizeof(*ht->table)); + ht->entries = 0; + ht->deleted_entries = 0; + + if (ht->table == NULL) { + free(ht); + return NULL; + } + + return ht; +} + +/** + * Frees the given hash table. + */ +WL_EXPORT void +wl_hash_table_destroy(struct wl_hash_table *ht) +{ + if (!ht) + return; + + free(ht->table); + free(ht); +} + +/** + * Finds a hash table entry with the given key and hash of that key. + * + * Returns NULL if no entry is found. Note that the data pointer may be + * modified by the user. + */ +static void * +hash_table_search(struct wl_hash_table *ht, uint32_t hash) +{ + uint32_t hash_address; + + hash_address = hash % ht->size; + do { + uint32_t double_hash; + + struct hash_entry *entry = ht->table + hash_address; + + if (entry_is_free(entry)) { + return NULL; + } else if (entry_is_present(entry) && entry->hash == hash) { + return entry; + } + + double_hash = hash % ht->rehash; + if (double_hash == 0) + double_hash = 1; + + hash_address = (hash_address + double_hash) % ht->size; + } while (hash_address != hash % ht->size); + + return NULL; +} + +WL_EXPORT void * +wl_hash_table_lookup(struct wl_hash_table *ht, uint32_t hash) +{ + struct hash_entry *entry; + + entry = hash_table_search(ht, hash); + if (entry != NULL) + return entry->data; + + return NULL; +} + +static void +hash_table_rehash(struct wl_hash_table *ht, int new_size_index) +{ + struct wl_hash_table old_ht; + struct hash_entry *table, *entry; + + if (new_size_index >= ARRAY_SIZE(hash_sizes)) + return; + + table = calloc(hash_sizes[new_size_index].size, sizeof(*ht->table)); + if (table == NULL) + return; + + old_ht = *ht; + + ht->table = table; + ht->size_index = new_size_index; + ht->size = hash_sizes[ht->size_index].size; + ht->rehash = hash_sizes[ht->size_index].rehash; + ht->max_entries = hash_sizes[ht->size_index].max_entries; + ht->entries = 0; + ht->deleted_entries = 0; + + for (entry = old_ht.table; + entry != old_ht.table + old_ht.size; + entry++) { + if (entry_is_present(entry)) { + wl_hash_table_insert(ht, entry->hash, entry->data); + } + } + + free(old_ht.table); +} + +/** + * Inserts the data with the given hash into the table. + * + * Note that insertion may rearrange the table on a resize or rehash, + * so previously found hash_entries are no longer valid after this function. + */ +WL_EXPORT int +wl_hash_table_insert(struct wl_hash_table *ht, uint32_t hash, void *data) +{ + uint32_t hash_address; + + if (ht->entries >= ht->max_entries) { + hash_table_rehash(ht, ht->size_index + 1); + } else if (ht->deleted_entries + ht->entries >= ht->max_entries) { + hash_table_rehash(ht, ht->size_index); + } + + hash_address = hash % ht->size; + do { + struct hash_entry *entry = ht->table + hash_address; + uint32_t double_hash; + + if (!entry_is_present(entry)) { + if (entry_is_deleted(entry)) + ht->deleted_entries--; + entry->hash = hash; + entry->data = data; + ht->entries++; + return 0; + } + + double_hash = hash % ht->rehash; + if (double_hash == 0) + double_hash = 1; + + hash_address = (hash_address + double_hash) % ht->size; + } while (hash_address != hash % ht->size); + + /* We could hit here if a required resize failed. An unchecked-malloc + * application could ignore this result. + */ + return -1; +} + +/** + * This function deletes the given hash table entry. + * + * Note that deletion doesn't otherwise modify the table, so an iteration over + * the table deleting entries is safe. + */ +WL_EXPORT void +wl_hash_table_remove(struct wl_hash_table *ht, uint32_t hash) +{ + struct hash_entry *entry; + + entry = hash_table_search(ht, hash); + if (entry != NULL) { + entry->data = (void *) &deleted_data; + ht->entries--; + ht->deleted_entries++; + } +} diff --git a/src/3rdparty/wayland/wayland-protocol.c b/src/3rdparty/wayland/wayland-protocol.c new file mode 100644 index 00000000000..1b00ac44c5e --- /dev/null +++ b/src/3rdparty/wayland/wayland-protocol.c @@ -0,0 +1,228 @@ +/* + * Copyright © 2010 Kristian Høgsberg + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that copyright + * notice and this permission notice appear in supporting documentation, and + * that the name of the copyright holders not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. The copyright holders make no representations + * about the suitability of this software for any purpose. It is provided "as + * is" without express or implied warranty. + * + * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THIS SOFTWARE. + */ + + +#include +#include +#include "wayland-util.h" + +static const struct wl_message display_requests[] = { + { "sync", "u" }, + { "frame", "u" }, +}; + +static const struct wl_message display_events[] = { + { "invalid_object", "u" }, + { "invalid_method", "uu" }, + { "no_memory", "" }, + { "global", "nsu" }, + { "range", "u" }, + { "key", "uu" }, +}; + +WL_EXPORT const struct wl_interface wl_display_interface = { + "display", 1, + ARRAY_LENGTH(display_requests), display_requests, + ARRAY_LENGTH(display_events), display_events, +}; + +static const struct wl_message compositor_requests[] = { + { "create_surface", "n" }, +}; + +WL_EXPORT const struct wl_interface wl_compositor_interface = { + "compositor", 1, + ARRAY_LENGTH(compositor_requests), compositor_requests, + 0, NULL, +}; + +static const struct wl_message drm_requests[] = { + { "authenticate", "u" }, + { "create_buffer", "nuiiuo" }, +}; + +static const struct wl_message drm_events[] = { + { "device", "s" }, + { "authenticated", "" }, +}; + +WL_EXPORT const struct wl_interface wl_drm_interface = { + "drm", 1, + ARRAY_LENGTH(drm_requests), drm_requests, + ARRAY_LENGTH(drm_events), drm_events, +}; + +static const struct wl_message shm_requests[] = { + { "create_buffer", "nhiiuo" }, +}; + +WL_EXPORT const struct wl_interface wl_shm_interface = { + "shm", 1, + ARRAY_LENGTH(shm_requests), shm_requests, + 0, NULL, +}; + +static const struct wl_message buffer_requests[] = { + { "destroy", "" }, +}; + +WL_EXPORT const struct wl_interface wl_buffer_interface = { + "buffer", 1, + ARRAY_LENGTH(buffer_requests), buffer_requests, + 0, NULL, +}; + +static const struct wl_message shell_requests[] = { + { "move", "oou" }, + { "resize", "oouu" }, + { "create_drag", "n" }, + { "create_selection", "n" }, +}; + +static const struct wl_message shell_events[] = { + { "configure", "uuoii" }, +}; + +WL_EXPORT const struct wl_interface wl_shell_interface = { + "shell", 1, + ARRAY_LENGTH(shell_requests), shell_requests, + ARRAY_LENGTH(shell_events), shell_events, +}; + +static const struct wl_message selection_requests[] = { + { "offer", "s" }, + { "activate", "ou" }, + { "destroy", "" }, +}; + +static const struct wl_message selection_events[] = { + { "send", "sh" }, + { "cancelled", "" }, +}; + +WL_EXPORT const struct wl_interface wl_selection_interface = { + "selection", 1, + ARRAY_LENGTH(selection_requests), selection_requests, + ARRAY_LENGTH(selection_events), selection_events, +}; + +static const struct wl_message selection_offer_requests[] = { + { "receive", "sh" }, +}; + +static const struct wl_message selection_offer_events[] = { + { "offer", "s" }, + { "keyboard_focus", "o" }, +}; + +WL_EXPORT const struct wl_interface wl_selection_offer_interface = { + "selection_offer", 1, + ARRAY_LENGTH(selection_offer_requests), selection_offer_requests, + ARRAY_LENGTH(selection_offer_events), selection_offer_events, +}; + +static const struct wl_message drag_requests[] = { + { "offer", "s" }, + { "activate", "oou" }, + { "destroy", "" }, +}; + +static const struct wl_message drag_events[] = { + { "target", "s" }, + { "finish", "h" }, + { "reject", "" }, +}; + +WL_EXPORT const struct wl_interface wl_drag_interface = { + "drag", 1, + ARRAY_LENGTH(drag_requests), drag_requests, + ARRAY_LENGTH(drag_events), drag_events, +}; + +static const struct wl_message drag_offer_requests[] = { + { "accept", "us" }, + { "receive", "h" }, + { "reject", "" }, +}; + +static const struct wl_message drag_offer_events[] = { + { "offer", "s" }, + { "pointer_focus", "uoiiii" }, + { "motion", "uiiii" }, + { "drop", "" }, +}; + +WL_EXPORT const struct wl_interface wl_drag_offer_interface = { + "drag_offer", 1, + ARRAY_LENGTH(drag_offer_requests), drag_offer_requests, + ARRAY_LENGTH(drag_offer_events), drag_offer_events, +}; + +static const struct wl_message surface_requests[] = { + { "destroy", "" }, + { "attach", "oii" }, + { "map_toplevel", "" }, + { "map_transient", "oiiu" }, + { "map_fullscreen", "" }, + { "damage", "iiii" }, +}; + +WL_EXPORT const struct wl_interface wl_surface_interface = { + "surface", 1, + ARRAY_LENGTH(surface_requests), surface_requests, + 0, NULL, +}; + +static const struct wl_message input_device_requests[] = { + { "attach", "uoii" }, +}; + +static const struct wl_message input_device_events[] = { + { "motion", "uiiii" }, + { "button", "uuu" }, + { "key", "uuu" }, + { "pointer_focus", "uoiiii" }, + { "keyboard_focus", "uoa" }, +}; + +WL_EXPORT const struct wl_interface wl_input_device_interface = { + "input_device", 1, + ARRAY_LENGTH(input_device_requests), input_device_requests, + ARRAY_LENGTH(input_device_events), input_device_events, +}; + +static const struct wl_message output_events[] = { + { "geometry", "iiii" }, +}; + +WL_EXPORT const struct wl_interface wl_output_interface = { + "output", 1, + 0, NULL, + ARRAY_LENGTH(output_events), output_events, +}; + +WL_EXPORT const struct wl_interface wl_visual_interface = { + "visual", 1, + 0, NULL, + 0, NULL, +}; + diff --git a/src/3rdparty/wayland/wayland-server-protocol.h b/src/3rdparty/wayland/wayland-server-protocol.h new file mode 100644 index 00000000000..8da6b7aa7b6 --- /dev/null +++ b/src/3rdparty/wayland/wayland-server-protocol.h @@ -0,0 +1,265 @@ +/* + * Copyright © 2010 Kristian Høgsberg + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that copyright + * notice and this permission notice appear in supporting documentation, and + * that the name of the copyright holders not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. The copyright holders make no representations + * about the suitability of this software for any purpose. It is provided "as + * is" without express or implied warranty. + * + * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THIS SOFTWARE. + */ + + +#ifndef WAYLAND_SERVER_PROTOCOL_H +#define WAYLAND_SERVER_PROTOCOL_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include "wayland-util.h" + +struct wl_client; + +struct wl_display; +struct wl_compositor; +struct wl_drm; +struct wl_shm; +struct wl_buffer; +struct wl_shell; +struct wl_selection; +struct wl_selection_offer; +struct wl_drag; +struct wl_drag_offer; +struct wl_surface; +struct wl_input_device; +struct wl_output; +struct wl_visual; + +extern const struct wl_interface wl_display_interface; +extern const struct wl_interface wl_compositor_interface; +extern const struct wl_interface wl_drm_interface; +extern const struct wl_interface wl_shm_interface; +extern const struct wl_interface wl_buffer_interface; +extern const struct wl_interface wl_shell_interface; +extern const struct wl_interface wl_selection_interface; +extern const struct wl_interface wl_selection_offer_interface; +extern const struct wl_interface wl_drag_interface; +extern const struct wl_interface wl_drag_offer_interface; +extern const struct wl_interface wl_surface_interface; +extern const struct wl_interface wl_input_device_interface; +extern const struct wl_interface wl_output_interface; +extern const struct wl_interface wl_visual_interface; + +struct wl_display_interface { + void (*sync)(struct wl_client *client, + struct wl_display *display, + uint32_t key); + void (*frame)(struct wl_client *client, + struct wl_display *display, + uint32_t key); +}; + +#define WL_DISPLAY_INVALID_OBJECT 0 +#define WL_DISPLAY_INVALID_METHOD 1 +#define WL_DISPLAY_NO_MEMORY 2 +#define WL_DISPLAY_GLOBAL 3 +#define WL_DISPLAY_RANGE 4 +#define WL_DISPLAY_KEY 5 + +struct wl_compositor_interface { + void (*create_surface)(struct wl_client *client, + struct wl_compositor *compositor, + uint32_t id); +}; + +struct wl_drm_interface { + void (*authenticate)(struct wl_client *client, + struct wl_drm *drm, + uint32_t id); + void (*create_buffer)(struct wl_client *client, + struct wl_drm *drm, + uint32_t id, + uint32_t name, + int width, + int height, + uint32_t stride, + struct wl_visual *visual); +}; + +#define WL_DRM_DEVICE 0 +#define WL_DRM_AUTHENTICATED 1 + +struct wl_shm_interface { + void (*create_buffer)(struct wl_client *client, + struct wl_shm *shm, + uint32_t id, + int fd, + int width, + int height, + uint32_t stride, + struct wl_visual *visual); +}; + +struct wl_buffer_interface { + void (*destroy)(struct wl_client *client, + struct wl_buffer *buffer); +}; + +#ifndef WL_SHELL_RESIZE_ENUM +#define WL_SHELL_RESIZE_ENUM +enum wl_shell_resize { + WL_SHELL_RESIZE_NONE = 0, + WL_SHELL_RESIZE_TOP = 1, + WL_SHELL_RESIZE_BOTTOM = 2, + WL_SHELL_RESIZE_LEFT = 4, + WL_SHELL_RESIZE_TOP_LEFT = 5, + WL_SHELL_RESIZE_BOTTOM_LEFT = 6, + WL_SHELL_RESIZE_RIGHT = 8, + WL_SHELL_RESIZE_TOP_RIGHT = 9, + WL_SHELL_RESIZE_BOTTOM_RIGHT = 10, +}; +#endif /* WL_SHELL_RESIZE_ENUM */ + +struct wl_shell_interface { + void (*move)(struct wl_client *client, + struct wl_shell *shell, + struct wl_surface *surface, + struct wl_input_device *input_device, + uint32_t time); + void (*resize)(struct wl_client *client, + struct wl_shell *shell, + struct wl_surface *surface, + struct wl_input_device *input_device, + uint32_t time, + uint32_t edges); + void (*create_drag)(struct wl_client *client, + struct wl_shell *shell, + uint32_t id); + void (*create_selection)(struct wl_client *client, + struct wl_shell *shell, + uint32_t id); +}; + +#define WL_SHELL_CONFIGURE 0 + +struct wl_selection_interface { + void (*offer)(struct wl_client *client, + struct wl_selection *selection, + const char *type); + void (*activate)(struct wl_client *client, + struct wl_selection *selection, + struct wl_input_device *input_device, + uint32_t time); + void (*destroy)(struct wl_client *client, + struct wl_selection *selection); +}; + +#define WL_SELECTION_SEND 0 +#define WL_SELECTION_CANCELLED 1 + +struct wl_selection_offer_interface { + void (*receive)(struct wl_client *client, + struct wl_selection_offer *selection_offer, + const char *mime_type, + int fd); +}; + +#define WL_SELECTION_OFFER_OFFER 0 +#define WL_SELECTION_OFFER_KEYBOARD_FOCUS 1 + +struct wl_drag_interface { + void (*offer)(struct wl_client *client, + struct wl_drag *drag, + const char *type); + void (*activate)(struct wl_client *client, + struct wl_drag *drag, + struct wl_surface *surface, + struct wl_input_device *input_device, + uint32_t time); + void (*destroy)(struct wl_client *client, + struct wl_drag *drag); +}; + +#define WL_DRAG_TARGET 0 +#define WL_DRAG_FINISH 1 +#define WL_DRAG_REJECT 2 + +struct wl_drag_offer_interface { + void (*accept)(struct wl_client *client, + struct wl_drag_offer *drag_offer, + uint32_t time, + const char *type); + void (*receive)(struct wl_client *client, + struct wl_drag_offer *drag_offer, + int fd); + void (*reject)(struct wl_client *client, + struct wl_drag_offer *drag_offer); +}; + +#define WL_DRAG_OFFER_OFFER 0 +#define WL_DRAG_OFFER_POINTER_FOCUS 1 +#define WL_DRAG_OFFER_MOTION 2 +#define WL_DRAG_OFFER_DROP 3 + +struct wl_surface_interface { + void (*destroy)(struct wl_client *client, + struct wl_surface *surface); + void (*attach)(struct wl_client *client, + struct wl_surface *surface, + struct wl_buffer *buffer, + int x, + int y); + void (*map_toplevel)(struct wl_client *client, + struct wl_surface *surface); + void (*map_transient)(struct wl_client *client, + struct wl_surface *surface, + struct wl_surface *parent, + int x, + int y, + uint32_t flags); + void (*map_fullscreen)(struct wl_client *client, + struct wl_surface *surface); + void (*damage)(struct wl_client *client, + struct wl_surface *surface, + int x, + int y, + int width, + int height); +}; + +struct wl_input_device_interface { + void (*attach)(struct wl_client *client, + struct wl_input_device *input_device, + uint32_t time, + struct wl_buffer *buffer, + int hotspot_x, + int hotspot_y); +}; + +#define WL_INPUT_DEVICE_MOTION 0 +#define WL_INPUT_DEVICE_BUTTON 1 +#define WL_INPUT_DEVICE_KEY 2 +#define WL_INPUT_DEVICE_POINTER_FOCUS 3 +#define WL_INPUT_DEVICE_KEYBOARD_FOCUS 4 + +#define WL_OUTPUT_GEOMETRY 0 + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/src/3rdparty/wayland/wayland-server.c b/src/3rdparty/wayland/wayland-server.c new file mode 100644 index 00000000000..dece0d1b23c --- /dev/null +++ b/src/3rdparty/wayland/wayland-server.c @@ -0,0 +1,726 @@ +/* + * Copyright © 2008 Kristian Høgsberg + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that copyright + * notice and this permission notice appear in supporting documentation, and + * that the name of the copyright holders not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. The copyright holders make no representations + * about the suitability of this software for any purpose. It is provided "as + * is" without express or implied warranty. + * + * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THIS SOFTWARE. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "wayland-server.h" +#include "wayland-server-protocol.h" +#include "connection.h" + +struct wl_socket { + int fd; + struct sockaddr_un addr; + struct wl_list link; +}; + +struct wl_client { + struct wl_connection *connection; + struct wl_event_source *source; + struct wl_display *display; + struct wl_list resource_list; + uint32_t id_count; +}; + +struct wl_display { + struct wl_object object; + struct wl_event_loop *loop; + struct wl_hash_table *objects; + int run; + + struct wl_list frame_list; + uint32_t client_id_range; + uint32_t id; + + struct wl_list global_list; + struct wl_list socket_list; +}; + +struct wl_frame_listener { + struct wl_resource resource; + struct wl_client *client; + uint32_t key; + struct wl_list link; +}; + +struct wl_global { + struct wl_object *object; + wl_client_connect_func_t func; + struct wl_list link; +}; + +static int wl_debug = 0; + +WL_EXPORT void +wl_client_post_event(struct wl_client *client, struct wl_object *sender, + uint32_t opcode, ...) +{ + struct wl_closure *closure; + va_list ap; + + va_start(ap, opcode); + closure = wl_connection_vmarshal(client->connection, + sender, opcode, ap, + &sender->interface->events[opcode]); + va_end(ap); + + wl_closure_send(closure, client->connection); + + if (wl_debug) { + fprintf(stderr, " -> "); + wl_closure_print(closure, sender); + } + + wl_closure_destroy(closure); +} + +static void +wl_client_connection_data(int fd, uint32_t mask, void *data) +{ + struct wl_client *client = data; + struct wl_connection *connection = client->connection; + struct wl_object *object; + struct wl_closure *closure; + const struct wl_message *message; + uint32_t p[2], opcode, size; + uint32_t cmask = 0; + int len; + + if (mask & WL_EVENT_READABLE) + cmask |= WL_CONNECTION_READABLE; + if (mask & WL_EVENT_WRITEABLE) + cmask |= WL_CONNECTION_WRITABLE; + + len = wl_connection_data(connection, cmask); + if (len < 0) { + wl_client_destroy(client); + return; + } + + while (len >= sizeof p) { + wl_connection_copy(connection, p, sizeof p); + opcode = p[1] & 0xffff; + size = p[1] >> 16; + if (len < size) + break; + + object = wl_hash_table_lookup(client->display->objects, p[0]); + if (object == NULL) { + wl_client_post_event(client, &client->display->object, + WL_DISPLAY_INVALID_OBJECT, p[0]); + wl_connection_consume(connection, size); + len -= size; + continue; + } + + if (opcode >= object->interface->method_count) { + wl_client_post_event(client, &client->display->object, + WL_DISPLAY_INVALID_METHOD, p[0], opcode); + wl_connection_consume(connection, size); + len -= size; + continue; + } + + message = &object->interface->methods[opcode]; + closure = wl_connection_demarshal(client->connection, size, + client->display->objects, + message); + len -= size; + + if (closure == NULL && errno == EINVAL) { + wl_client_post_event(client, &client->display->object, + WL_DISPLAY_INVALID_METHOD, + p[0], opcode); + continue; + } else if (closure == NULL && errno == ENOMEM) { + wl_client_post_no_memory(client); + continue; + } + + + if (wl_debug) + wl_closure_print(closure, object); + + wl_closure_invoke(closure, object, + object->implementation[opcode], client); + + wl_closure_destroy(closure); + } +} + +static int +wl_client_connection_update(struct wl_connection *connection, + uint32_t mask, void *data) +{ + struct wl_client *client = data; + uint32_t emask = 0; + + if (mask & WL_CONNECTION_READABLE) + emask |= WL_EVENT_READABLE; + if (mask & WL_CONNECTION_WRITABLE) + emask |= WL_EVENT_WRITEABLE; + + return wl_event_source_fd_update(client->source, emask); +} + +WL_EXPORT struct wl_display * +wl_client_get_display(struct wl_client *client) +{ + return client->display; +} + +static void +wl_display_post_range(struct wl_display *display, struct wl_client *client) +{ + wl_client_post_event(client, &client->display->object, + WL_DISPLAY_RANGE, display->client_id_range); + display->client_id_range += 256; + client->id_count += 256; +} + +static struct wl_client * +wl_client_create(struct wl_display *display, int fd) +{ + struct wl_client *client; + struct wl_global *global; + + client = malloc(sizeof *client); + if (client == NULL) + return NULL; + + memset(client, 0, sizeof *client); + client->display = display; + client->source = wl_event_loop_add_fd(display->loop, fd, + WL_EVENT_READABLE, + wl_client_connection_data, client); + client->connection = + wl_connection_create(fd, wl_client_connection_update, client); + + wl_list_init(&client->resource_list); + + wl_display_post_range(display, client); + + wl_list_for_each(global, &display->global_list, link) + wl_client_post_event(client, &client->display->object, + WL_DISPLAY_GLOBAL, + global->object, + global->object->interface->name, + global->object->interface->version); + + wl_list_for_each(global, &display->global_list, link) + if (global->func) + global->func(client, global->object); + + return client; +} + +WL_EXPORT void +wl_client_add_resource(struct wl_client *client, + struct wl_resource *resource) +{ + struct wl_display *display = client->display; + + if (client->id_count-- < 64) + wl_display_post_range(display, client); + + wl_hash_table_insert(client->display->objects, + resource->object.id, resource); + wl_list_insert(client->resource_list.prev, &resource->link); +} + +WL_EXPORT void +wl_client_post_no_memory(struct wl_client *client) +{ + wl_client_post_event(client, + &client->display->object, + WL_DISPLAY_NO_MEMORY); +} + +WL_EXPORT void +wl_client_post_global(struct wl_client *client, struct wl_object *object) +{ + wl_client_post_event(client, + &client->display->object, + WL_DISPLAY_GLOBAL, + object, + object->interface->name, + object->interface->version); +} + +WL_EXPORT void +wl_resource_destroy(struct wl_resource *resource, struct wl_client *client) +{ + struct wl_display *display = client->display; + + wl_list_remove(&resource->link); + if (resource->object.id > 0) + wl_hash_table_remove(display->objects, resource->object.id); + resource->destroy(resource, client); +} + +WL_EXPORT void +wl_client_destroy(struct wl_client *client) +{ + struct wl_resource *resource, *tmp; + + printf("disconnect from client %p\n", client); + + wl_list_for_each_safe(resource, tmp, &client->resource_list, link) + wl_resource_destroy(resource, client); + + wl_event_source_remove(client->source); + wl_connection_destroy(client->connection); + free(client); +} + +static void +lose_pointer_focus(struct wl_listener *listener, + struct wl_surface *surface, uint32_t time) +{ + struct wl_input_device *device = + container_of(listener, struct wl_input_device, + pointer_focus_listener); + + wl_input_device_set_pointer_focus(device, NULL, time, 0, 0, 0, 0); +} + +static void +lose_keyboard_focus(struct wl_listener *listener, + struct wl_surface *surface, uint32_t time) +{ + struct wl_input_device *device = + container_of(listener, struct wl_input_device, + keyboard_focus_listener); + + wl_input_device_set_keyboard_focus(device, NULL, time); +} + +WL_EXPORT void +wl_input_device_init(struct wl_input_device *device, + struct wl_compositor *compositor) +{ + wl_list_init(&device->pointer_focus_listener.link); + device->pointer_focus_listener.func = lose_pointer_focus; + wl_list_init(&device->keyboard_focus_listener.link); + device->keyboard_focus_listener.func = lose_keyboard_focus; + + device->x = 100; + device->y = 100; + device->compositor = compositor; +} + +WL_EXPORT void +wl_input_device_set_pointer_focus(struct wl_input_device *device, + struct wl_surface *surface, + uint32_t time, + int32_t x, int32_t y, + int32_t sx, int32_t sy) +{ + if (device->pointer_focus == surface) + return; + + if (device->pointer_focus && + (!surface || device->pointer_focus->client != surface->client)) + wl_client_post_event(device->pointer_focus->client, + &device->object, + WL_INPUT_DEVICE_POINTER_FOCUS, + time, NULL, 0, 0, 0, 0); + if (surface) + wl_client_post_event(surface->client, + &device->object, + WL_INPUT_DEVICE_POINTER_FOCUS, + time, surface, x, y, sx, sy); + + device->pointer_focus = surface; + device->pointer_focus_time = time; + + wl_list_remove(&device->pointer_focus_listener.link); + if (surface) + wl_list_insert(surface->destroy_listener_list.prev, + &device->pointer_focus_listener.link); +} + +WL_EXPORT void +wl_input_device_set_keyboard_focus(struct wl_input_device *device, + struct wl_surface *surface, + uint32_t time) +{ + if (device->keyboard_focus == surface) + return; + + if (device->keyboard_focus && + (!surface || device->keyboard_focus->client != surface->client)) + wl_client_post_event(device->keyboard_focus->client, + &device->object, + WL_INPUT_DEVICE_KEYBOARD_FOCUS, + time, NULL, &device->keys); + + if (surface) + wl_client_post_event(surface->client, + &device->object, + WL_INPUT_DEVICE_KEYBOARD_FOCUS, + time, surface, &device->keys); + + device->keyboard_focus = surface; + device->keyboard_focus_time = time; + + wl_list_remove(&device->keyboard_focus_listener.link); + if (surface) + wl_list_insert(surface->destroy_listener_list.prev, + &device->keyboard_focus_listener.link); +} + +WL_EXPORT void +wl_input_device_end_grab(struct wl_input_device *device, uint32_t time) +{ + const struct wl_grab_interface *interface; + + interface = device->grab->interface; + interface->end(device->grab, time); + device->grab->input_device = NULL; + device->grab = NULL; + + wl_list_remove(&device->grab_listener.link); +} + +static void +lose_grab_surface(struct wl_listener *listener, + struct wl_surface *surface, uint32_t time) +{ + struct wl_input_device *device = + container_of(listener, + struct wl_input_device, grab_listener); + + wl_input_device_end_grab(device, time); +} + +WL_EXPORT void +wl_input_device_start_grab(struct wl_input_device *device, + struct wl_grab *grab, + uint32_t button, uint32_t time) +{ + struct wl_surface *focus = device->pointer_focus; + + device->grab = grab; + device->grab_button = button; + device->grab_time = time; + device->grab_x = device->x; + device->grab_y = device->y; + + device->grab_listener.func = lose_grab_surface; + wl_list_insert(focus->destroy_listener_list.prev, + &device->grab_listener.link); + + grab->input_device = device; +} + +WL_EXPORT int +wl_input_device_update_grab(struct wl_input_device *device, + struct wl_grab *grab, + struct wl_surface *surface, uint32_t time) +{ + if (device->grab != &device->motion_grab || + device->grab_time != time || + device->pointer_focus != surface) + return -1; + + device->grab = grab; + grab->input_device = device; + + return 0; +} + +static void +display_sync(struct wl_client *client, + struct wl_display *display, uint32_t key) +{ + wl_client_post_event(client, &display->object, WL_DISPLAY_KEY, key, 0); +} + +static void +destroy_frame_listener(struct wl_resource *resource, struct wl_client *client) +{ + struct wl_frame_listener *listener = + container_of(resource, struct wl_frame_listener, resource); + + wl_list_remove(&listener->link); + free(listener); +} + +static void +display_frame(struct wl_client *client, + struct wl_display *display, uint32_t key) +{ + struct wl_frame_listener *listener; + + listener = malloc(sizeof *listener); + if (listener == NULL) { + wl_client_post_no_memory(client); + return; + } + + /* The listener is a resource so we destroy it when the client + * goes away. */ + listener->resource.destroy = destroy_frame_listener; + listener->resource.object.id = 0; + listener->client = client; + listener->key = key; + wl_list_insert(client->resource_list.prev, &listener->resource.link); + wl_list_insert(display->frame_list.prev, &listener->link); +} + +struct wl_display_interface display_interface = { + display_sync, + display_frame +}; + + +WL_EXPORT struct wl_display * +wl_display_create(void) +{ + struct wl_display *display; + const char *debug; + + debug = getenv("WAYLAND_DEBUG"); + if (debug) + wl_debug = 1; + + display = malloc(sizeof *display); + if (display == NULL) + return NULL; + + display->loop = wl_event_loop_create(); + if (display->loop == NULL) { + free(display); + return NULL; + } + + display->objects = wl_hash_table_create(); + if (display->objects == NULL) { + free(display); + return NULL; + } + + wl_list_init(&display->frame_list); + wl_list_init(&display->global_list); + wl_list_init(&display->socket_list); + + display->client_id_range = 256; /* Gah, arbitrary... */ + + display->id = 1; + display->object.interface = &wl_display_interface; + display->object.implementation = (void (**)(void)) &display_interface; + wl_display_add_object(display, &display->object); + if (wl_display_add_global(display, &display->object, NULL)) { + wl_event_loop_destroy(display->loop); + free(display); + return NULL; + } + + return display; +} + +WL_EXPORT void +wl_display_destroy(struct wl_display *display) +{ + struct wl_socket *s, *next; + + wl_event_loop_destroy(display->loop); + wl_hash_table_destroy(display->objects); + + wl_list_for_each_safe(s, next, &display->socket_list, link) { + close(s->fd); + unlink(s->addr.sun_path); + free(s); + } + + free(display); +} + +WL_EXPORT void +wl_display_add_object(struct wl_display *display, struct wl_object *object) +{ + object->id = display->id++; + wl_hash_table_insert(display->objects, object->id, object); +} + +WL_EXPORT int +wl_display_add_global(struct wl_display *display, + struct wl_object *object, wl_client_connect_func_t func) +{ + struct wl_global *global; + + global = malloc(sizeof *global); + if (global == NULL) + return -1; + + global->object = object; + global->func = func; + wl_list_insert(display->global_list.prev, &global->link); + + return 0; +} + +WL_EXPORT void +wl_display_post_frame(struct wl_display *display, uint32_t time) +{ + struct wl_frame_listener *listener, *next; + + wl_list_for_each_safe(listener, next, &display->frame_list, link) { + wl_client_post_event(listener->client, &display->object, + WL_DISPLAY_KEY, listener->key, time); + wl_resource_destroy(&listener->resource, listener->client); + } +} + +WL_EXPORT struct wl_event_loop * +wl_display_get_event_loop(struct wl_display *display) +{ + return display->loop; +} + +WL_EXPORT void +wl_display_terminate(struct wl_display *display) +{ + display->run = 0; +} + +WL_EXPORT void +wl_display_run(struct wl_display *display) +{ + display->run = 1; + + while (display->run) + wl_event_loop_dispatch(display->loop, -1); +} + +static void +socket_data(int fd, uint32_t mask, void *data) +{ + struct wl_display *display = data; + struct sockaddr_un name; + socklen_t length; + int client_fd; + + length = sizeof name; + client_fd = accept (fd, (struct sockaddr *) &name, &length); + if (client_fd < 0) + fprintf(stderr, "failed to accept\n"); + + wl_client_create(display, client_fd); +} + +WL_EXPORT int +wl_display_add_socket(struct wl_display *display, const char *name) +{ + struct wl_socket *s; + socklen_t size, name_size; + const char *runtime_dir; + + s = malloc(sizeof *s); + if (s == NULL) + return -1; + + s->fd = socket(PF_LOCAL, SOCK_STREAM, 0); + if (s->fd < 0) + return -1; + + runtime_dir = getenv("XDG_RUNTIME_DIR"); + if (runtime_dir == NULL) { + runtime_dir = "."; + fprintf(stderr, + "XDG_RUNTIME_DIR not set, falling back to %s\n", + runtime_dir); + } + + if (name == NULL) + name = getenv("WAYLAND_DISPLAY"); + if (name == NULL) + name = "wayland-0"; + + memset(&s->addr, 0, sizeof s->addr); + s->addr.sun_family = AF_LOCAL; + name_size = snprintf(s->addr.sun_path, sizeof s->addr.sun_path, + "%s/%s", runtime_dir, name) + 1; + fprintf(stderr, "using socket %s\n", s->addr.sun_path); + + size = offsetof (struct sockaddr_un, sun_path) + name_size; + if (bind(s->fd, (struct sockaddr *) &s->addr, size) < 0) + return -1; + + if (listen(s->fd, 1) < 0) + return -1; + + wl_event_loop_add_fd(display->loop, s->fd, + WL_EVENT_READABLE, + socket_data, display); + wl_list_insert(display->socket_list.prev, &s->link); + + return 0; +} + +WL_EXPORT int +wl_compositor_init(struct wl_compositor *compositor, + const struct wl_compositor_interface *interface, + struct wl_display *display) +{ + compositor->object.interface = &wl_compositor_interface; + compositor->object.implementation = (void (**)(void)) interface; + wl_display_add_object(display, &compositor->object); + if (wl_display_add_global(display, &compositor->object, NULL)) + return -1; + + compositor->argb_visual.object.interface = &wl_visual_interface; + compositor->argb_visual.object.implementation = NULL; + wl_display_add_object(display, &compositor->argb_visual.object); + wl_display_add_global(display, &compositor->argb_visual.object, NULL); + + compositor->premultiplied_argb_visual.object.interface = + &wl_visual_interface; + compositor->premultiplied_argb_visual.object.implementation = NULL; + wl_display_add_object(display, + &compositor->premultiplied_argb_visual.object); + wl_display_add_global(display, + &compositor->premultiplied_argb_visual.object, + NULL); + + compositor->rgb_visual.object.interface = &wl_visual_interface; + compositor->rgb_visual.object.implementation = NULL; + wl_display_add_object(display, + &compositor->rgb_visual.object); + wl_display_add_global(display, + &compositor->rgb_visual.object, NULL); + + return 0; +} diff --git a/src/3rdparty/wayland/wayland-server.h b/src/3rdparty/wayland/wayland-server.h new file mode 100644 index 00000000000..f74cbae0420 --- /dev/null +++ b/src/3rdparty/wayland/wayland-server.h @@ -0,0 +1,265 @@ +/* + * Copyright © 2008 Kristian Høgsberg + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that copyright + * notice and this permission notice appear in supporting documentation, and + * that the name of the copyright holders not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. The copyright holders make no representations + * about the suitability of this software for any purpose. It is provided "as + * is" without express or implied warranty. + * + * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THIS SOFTWARE. + */ + +#ifndef WAYLAND_H +#define WAYLAND_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include "wayland-util.h" +#include "wayland-server-protocol.h" + +enum { + WL_EVENT_READABLE = 0x01, + WL_EVENT_WRITEABLE = 0x02 +}; + +struct wl_event_loop; +struct wl_event_source; +typedef void (*wl_event_loop_fd_func_t)(int fd, uint32_t mask, void *data); +typedef void (*wl_event_loop_timer_func_t)(void *data); +typedef void (*wl_event_loop_signal_func_t)(int signal_number, void *data); +typedef void (*wl_event_loop_idle_func_t)(void *data); + +struct wl_event_loop *wl_event_loop_create(void); +void wl_event_loop_destroy(struct wl_event_loop *loop); +struct wl_event_source *wl_event_loop_add_fd(struct wl_event_loop *loop, + int fd, uint32_t mask, + wl_event_loop_fd_func_t func, + void *data); +int wl_event_source_fd_update(struct wl_event_source *source, uint32_t mask); +struct wl_event_source *wl_event_loop_add_timer(struct wl_event_loop *loop, + wl_event_loop_timer_func_t func, + void *data); +struct wl_event_source * +wl_event_loop_add_signal(struct wl_event_loop *loop, + int signal_number, + wl_event_loop_signal_func_t func, + void *data); + +int wl_event_source_timer_update(struct wl_event_source *source, + int ms_delay); +int wl_event_source_remove(struct wl_event_source *source); + + +int wl_event_loop_dispatch(struct wl_event_loop *loop, int timeout); +struct wl_event_source *wl_event_loop_add_idle(struct wl_event_loop *loop, + wl_event_loop_idle_func_t func, + void *data); +int wl_event_loop_get_fd(struct wl_event_loop *loop); + +struct wl_client; +struct wl_display; +struct wl_input_device; + +struct wl_display *wl_display_create(void); +void wl_display_destroy(struct wl_display *display); +struct wl_event_loop *wl_display_get_event_loop(struct wl_display *display); +int wl_display_add_socket(struct wl_display *display, const char *name); +void wl_display_terminate(struct wl_display *display); +void wl_display_run(struct wl_display *display); + +void wl_display_add_object(struct wl_display *display, struct wl_object *object); + +typedef void (*wl_client_connect_func_t)(struct wl_client *client, struct wl_object *global); + +int wl_display_add_global(struct wl_display *display, struct wl_object *object, wl_client_connect_func_t func); + +void wl_client_destroy(struct wl_client *client); +void wl_client_post_no_memory(struct wl_client *client); +void wl_client_post_global(struct wl_client *client, struct wl_object *object); + +struct wl_visual { + struct wl_object object; +}; + +struct wl_compositor { + struct wl_object object; + struct wl_visual argb_visual; + struct wl_visual premultiplied_argb_visual; + struct wl_visual rgb_visual; +}; + +struct wl_resource { + struct wl_object object; + void (*destroy)(struct wl_resource *resource, + struct wl_client *client); + struct wl_list link; +}; + +struct wl_buffer { + struct wl_resource resource; + struct wl_compositor *compositor; + struct wl_visual *visual; + int32_t width, height; + void (*attach)(struct wl_buffer *buffer, struct wl_surface *surface); + void (*damage)(struct wl_buffer *buffer, + struct wl_surface *surface, + int32_t x, int32_t y, int32_t width, int32_t height); +}; + +struct wl_listener { + struct wl_list link; + void (*func)(struct wl_listener *listener, + struct wl_surface *surface, uint32_t time); +}; + +struct wl_surface { + struct wl_resource resource; + struct wl_client *client; + struct wl_list destroy_listener_list; +}; + +struct wl_shell { + struct wl_object object; +}; + +struct wl_grab; +struct wl_grab_interface { + void (*motion)(struct wl_grab *grab, + uint32_t time, int32_t x, int32_t y); + void (*button)(struct wl_grab *grab, + uint32_t time, int32_t button, int32_t state); + void (*end)(struct wl_grab *grab, uint32_t time); +}; + +struct wl_grab { + const struct wl_grab_interface *interface; + struct wl_input_device *input_device; +}; + +struct wl_input_device { + struct wl_object object; + struct wl_compositor *compositor; + struct wl_surface *pointer_focus; + struct wl_surface *keyboard_focus; + struct wl_array keys; + uint32_t pointer_focus_time; + uint32_t keyboard_focus_time; + struct wl_listener pointer_focus_listener; + struct wl_listener keyboard_focus_listener; + + int32_t x, y; + struct wl_grab *grab; + struct wl_grab motion_grab; + uint32_t grab_time; + int32_t grab_x, grab_y; + uint32_t grab_button; + struct wl_listener grab_listener; +}; + +struct wl_drag_offer { + struct wl_object object; +}; + +struct wl_drag { + struct wl_resource resource; + struct wl_grab grab; + struct wl_drag_offer drag_offer; + struct wl_surface *source; + struct wl_surface *drag_focus; + struct wl_client *target; + int32_t x, y, sx, sy; + struct wl_array types; + const char *type; + uint32_t pointer_focus_time; + struct wl_listener drag_focus_listener; +}; + +struct wl_selection_offer { + struct wl_object object; +}; + +struct wl_selection { + struct wl_resource resource; + struct wl_client *client; + struct wl_input_device *input_device; + struct wl_selection_offer selection_offer; + struct wl_surface *selection_focus; + struct wl_client *target; + struct wl_array types; + struct wl_listener selection_focus_listener; +}; + +void +wl_client_post_event(struct wl_client *client, + struct wl_object *sender, + uint32_t event, ...); + +int +wl_display_set_compositor(struct wl_display *display, + struct wl_compositor *compositor, + const struct wl_compositor_interface *implementation); + +void +wl_display_post_frame(struct wl_display *display, uint32_t msecs); + +void +wl_client_add_resource(struct wl_client *client, + struct wl_resource *resource); + +struct wl_display * +wl_client_get_display(struct wl_client *client); + +void +wl_resource_destroy(struct wl_resource *resource, struct wl_client *client); + +void +wl_input_device_init(struct wl_input_device *device, + struct wl_compositor *compositor); + +void +wl_input_device_set_pointer_focus(struct wl_input_device *device, + struct wl_surface *surface, + uint32_t time, + int32_t x, int32_t y, + int32_t sx, int32_t sy); + +void +wl_input_device_set_keyboard_focus(struct wl_input_device *device, + struct wl_surface *surface, + uint32_t time); + +void +wl_input_device_end_grab(struct wl_input_device *device, uint32_t time); +void +wl_input_device_start_grab(struct wl_input_device *device, + struct wl_grab *grab, + uint32_t button, uint32_t time); +int +wl_input_device_update_grab(struct wl_input_device *device, + struct wl_grab *grab, + struct wl_surface *surface, uint32_t time); + +int +wl_compositor_init(struct wl_compositor *compositor, + const struct wl_compositor_interface *interface, + struct wl_display *display); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/src/3rdparty/wayland/wayland-util.c b/src/3rdparty/wayland/wayland-util.c new file mode 100644 index 00000000000..3643274333c --- /dev/null +++ b/src/3rdparty/wayland/wayland-util.c @@ -0,0 +1,123 @@ +/* + * Copyright © 2008 Kristian Høgsberg + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that copyright + * notice and this permission notice appear in supporting documentation, and + * that the name of the copyright holders not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. The copyright holders make no representations + * about the suitability of this software for any purpose. It is provided "as + * is" without express or implied warranty. + * + * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THIS SOFTWARE. + */ + +#include +#include +#include +#include "wayland-util.h" + +WL_EXPORT void +wl_list_init(struct wl_list *list) +{ + list->prev = list; + list->next = list; +} + +WL_EXPORT void +wl_list_insert(struct wl_list *list, struct wl_list *elm) +{ + elm->prev = list; + elm->next = list->next; + list->next = elm; + elm->next->prev = elm; +} + +WL_EXPORT void +wl_list_remove(struct wl_list *elm) +{ + elm->prev->next = elm->next; + elm->next->prev = elm->prev; +} + +WL_EXPORT int +wl_list_length(struct wl_list *list) +{ + struct wl_list *e; + int count; + + count = 0; + e = list->next; + while (e != list) { + e = e->next; + count++; + } + + return count; +} + +WL_EXPORT int +wl_list_empty(struct wl_list *list) +{ + return list->next == list; +} + +WL_EXPORT void +wl_array_init(struct wl_array *array) +{ + memset(array, 0, sizeof *array); +} + +WL_EXPORT void +wl_array_release(struct wl_array *array) +{ + free(array->data); +} + +WL_EXPORT void * +wl_array_add(struct wl_array *array, int size) +{ + int alloc; + void *data, *p; + + if (array->alloc > 0) + alloc = array->alloc; + else + alloc = 16; + + while (alloc < array->size + size) + alloc *= 2; + + if (array->alloc < alloc) { + if (array->alloc > 0) + data = realloc(array->data, alloc); + else + data = malloc(alloc); + + if (data == NULL) + return 0; + array->data = data; + array->alloc = alloc; + } + + p = array->data + array->size; + array->size += size; + + return p; +} + +WL_EXPORT void +wl_array_copy(struct wl_array *array, struct wl_array *source) +{ + array->size = 0; + wl_array_add(array, source->size); + memcpy(array->data, source->data, source->size); +} diff --git a/src/3rdparty/wayland/wayland-util.h b/src/3rdparty/wayland/wayland-util.h new file mode 100644 index 00000000000..6c1231a9972 --- /dev/null +++ b/src/3rdparty/wayland/wayland-util.h @@ -0,0 +1,157 @@ +/* + * Copyright © 2008 Kristian Høgsberg + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that copyright + * notice and this permission notice appear in supporting documentation, and + * that the name of the copyright holders not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. The copyright holders make no representations + * about the suitability of this software for any purpose. It is provided "as + * is" without express or implied warranty. + * + * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THIS SOFTWARE. + */ + +#ifndef WAYLAND_UTIL_H +#define WAYLAND_UTIL_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +/* GCC visibility */ +#if defined(__GNUC__) && __GNUC__ >= 4 +#define WL_EXPORT __attribute__ ((visibility("default"))) +#else +#define WL_EXPORT +#endif + +#define ARRAY_LENGTH(a) (sizeof (a) / sizeof (a)[0]) +#define ALIGN(n, a) ( ((n) + ((a) - 1)) & ~((a) - 1) ) +#define DIV_ROUNDUP(n, a) ( ((n) + ((a) - 1)) / (a) ) + +#define container_of(ptr, type, member) ({ \ + const typeof( ((type *)0)->member ) *__mptr = (ptr); \ + (type *)( (char *)__mptr - offsetof(type,member) );}) + +struct wl_argument { + uint32_t type; + void *data; +}; + +struct wl_message { + const char *name; + const char *signature; + const void **types; +}; + +struct wl_interface { + const char *name; + int version; + int method_count; + const struct wl_message *methods; + int event_count; + const struct wl_message *events; +}; + +struct wl_object { + const struct wl_interface *interface; + void (**implementation)(void); + uint32_t id; +}; + +struct wl_hash_table; +struct wl_hash_table *wl_hash_table_create(void); +void wl_hash_table_destroy(struct wl_hash_table *ht); +void *wl_hash_table_lookup(struct wl_hash_table *ht, uint32_t hash); +int wl_hash_table_insert(struct wl_hash_table *ht, uint32_t hash, void *data); +void wl_hash_table_remove(struct wl_hash_table *ht, uint32_t hash); + +/** + * wl_list - linked list + * + * The list head is of "struct wl_list" type, and must be initialized + * using wl_list_init(). All entries in the list must be of the same + * type. The item type must have a "struct wl_list" member. This + * member will be initialized by wl_list_insert(). There is no need to + * call wl_list_init() on the individual item. To query if the list is + * empty in O(1), use wl_list_empty(). + * + * Let's call the list reference "struct wl_list foo_list", the item type as + * "item_t", and the item member as "struct wl_list link". The following code + * + * The following code will initialize a list: + * + * wl_list_init(foo_list); + * wl_list_insert(foo_list, item1); Pushes item1 at the head + * wl_list_insert(foo_list, item2); Pushes item2 at the head + * wl_list_insert(item2, item3); Pushes item3 after item2 + * + * The list now looks like [item2, item3, item1] + * + * Will iterate the list in ascending order: + * + * item_t *item; + * wl_list_for_each(item, foo_list, link) { + * Do_something_with_item(item); + * } + */ +struct wl_list { + struct wl_list *prev; + struct wl_list *next; +}; + +void wl_list_init(struct wl_list *list); +void wl_list_insert(struct wl_list *list, struct wl_list *elm); +void wl_list_remove(struct wl_list *elm); +int wl_list_length(struct wl_list *list); +int wl_list_empty(struct wl_list *list); + +#define __container_of(ptr, sample, member) \ + (void *)((char *)(ptr) - \ + ((char *)&(sample)->member - (char *)(sample))) + +#define wl_list_for_each(pos, head, member) \ + for (pos = 0, pos = __container_of((head)->next, pos, member); \ + &pos->member != (head); \ + pos = __container_of(pos->member.next, pos, member)) + +#define wl_list_for_each_safe(pos, tmp, head, member) \ + for (pos = 0, tmp = 0, \ + pos = __container_of((head)->next, pos, member), \ + tmp = __container_of((pos)->member.next, tmp, member); \ + &pos->member != (head); \ + pos = tmp, \ + tmp = __container_of(pos->member.next, tmp, member)) + +#define wl_list_for_each_reverse(pos, head, member) \ + for (pos = 0, pos = __container_of((head)->prev, pos, member); \ + &pos->member != (head); \ + pos = __container_of(pos->member.prev, pos, member)) + +struct wl_array { + uint32_t size; + uint32_t alloc; + void *data; +}; + +void wl_array_init(struct wl_array *array); +void wl_array_release(struct wl_array *array); +void *wl_array_add(struct wl_array *array, int size); +void wl_array_copy(struct wl_array *array, struct wl_array *source); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/src/3rdparty/wayland/wayland.pro b/src/3rdparty/wayland/wayland.pro new file mode 100644 index 00000000000..214ed995566 --- /dev/null +++ b/src/3rdparty/wayland/wayland.pro @@ -0,0 +1,3 @@ +TEMPLATE = subdirs + +SUBDIRS = client server From b667ca007efdcbd7de8042628a46d35f0a8589ad Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Wed, 2 Mar 2011 15:35:37 +0100 Subject: [PATCH 0002/1507] Update to latest Wayland version --- .../wayland/wayland-client-protocol.h | 69 ------------------- src/3rdparty/wayland/wayland-client.c | 43 ++++-------- src/3rdparty/wayland/wayland-protocol.c | 16 ----- .../wayland/wayland-server-protocol.h | 19 ----- 4 files changed, 13 insertions(+), 134 deletions(-) diff --git a/src/3rdparty/wayland/wayland-client-protocol.h b/src/3rdparty/wayland/wayland-client-protocol.h index 0af6645bbd1..5f4a5c4867d 100644 --- a/src/3rdparty/wayland/wayland-client-protocol.h +++ b/src/3rdparty/wayland/wayland-client-protocol.h @@ -36,7 +36,6 @@ struct wl_client; struct wl_display; struct wl_compositor; -struct wl_drm; struct wl_shm; struct wl_buffer; struct wl_shell; @@ -74,7 +73,6 @@ wl_proxy_get_user_data(struct wl_proxy *proxy); extern const struct wl_interface wl_display_interface; extern const struct wl_interface wl_compositor_interface; -extern const struct wl_interface wl_drm_interface; extern const struct wl_interface wl_shm_interface; extern const struct wl_interface wl_buffer_interface; extern const struct wl_interface wl_shell_interface; @@ -191,73 +189,6 @@ wl_compositor_create_surface(struct wl_compositor *compositor) return (struct wl_surface *) id; } -struct wl_drm_listener { - void (*device)(void *data, - struct wl_drm *drm, - const char *name); - void (*authenticated)(void *data, - struct wl_drm *drm); -}; - -static inline int -wl_drm_add_listener(struct wl_drm *drm, - const struct wl_drm_listener *listener, void *data) -{ - return wl_proxy_add_listener((struct wl_proxy *) drm, - (void (**)(void)) listener, data); -} - -#define WL_DRM_AUTHENTICATE 0 -#define WL_DRM_CREATE_BUFFER 1 - -static inline struct wl_drm * -wl_drm_create(struct wl_display *display, uint32_t id) -{ - return (struct wl_drm *) - wl_proxy_create_for_id(display, &wl_drm_interface, id); -} - -static inline void -wl_drm_set_user_data(struct wl_drm *drm, void *user_data) -{ - wl_proxy_set_user_data((struct wl_proxy *) drm, user_data); -} - -static inline void * -wl_drm_get_user_data(struct wl_drm *drm) -{ - return wl_proxy_get_user_data((struct wl_proxy *) drm); -} - -static inline void -wl_drm_destroy(struct wl_drm *drm) -{ - wl_proxy_destroy((struct wl_proxy *) drm); -} - -static inline void -wl_drm_authenticate(struct wl_drm *drm, uint32_t id) -{ - wl_proxy_marshal((struct wl_proxy *) drm, - WL_DRM_AUTHENTICATE, id); -} - -static inline struct wl_buffer * -wl_drm_create_buffer(struct wl_drm *drm, uint32_t name, int width, int height, uint32_t stride, struct wl_visual *visual) -{ - struct wl_proxy *id; - - id = wl_proxy_create((struct wl_proxy *) drm, - &wl_buffer_interface); - if (!id) - return NULL; - - wl_proxy_marshal((struct wl_proxy *) drm, - WL_DRM_CREATE_BUFFER, id, name, width, height, stride, visual); - - return (struct wl_buffer *) id; -} - #define WL_SHM_CREATE_BUFFER 0 static inline struct wl_shm * diff --git a/src/3rdparty/wayland/wayland-client.c b/src/3rdparty/wayland/wayland-client.c index e3198c729ea..ad35c30ae55 100644 --- a/src/3rdparty/wayland/wayland-client.c +++ b/src/3rdparty/wayland/wayland-client.c @@ -44,16 +44,9 @@ struct wl_global_listener { struct wl_list link; }; -struct wl_listener { - void (**implementation)(void); - void *data; - struct wl_list link; -}; - struct wl_proxy { struct wl_object object; struct wl_display *display; - struct wl_list listener_list; void *user_data; }; @@ -78,7 +71,6 @@ struct wl_display { uint32_t id, id_count, next_range; uint32_t mask; struct wl_hash_table *objects; - struct wl_listener listener; struct wl_list global_listener_list; struct wl_visual *argb_visual; @@ -147,9 +139,9 @@ wl_proxy_create_for_id(struct wl_display *display, return NULL; proxy->object.interface = interface; + proxy->object.implementation = NULL; proxy->object.id = id; proxy->display = display; - wl_list_init(&proxy->listener_list); wl_hash_table_insert(display->objects, proxy->object.id, proxy); return proxy; @@ -166,11 +158,6 @@ wl_proxy_create(struct wl_proxy *factory, WL_EXPORT void wl_proxy_destroy(struct wl_proxy *proxy) { - struct wl_listener *listener, *next; - - wl_list_for_each_safe(listener, next, &proxy->listener_list, link) - free(listener); - wl_hash_table_remove(proxy->display->objects, proxy->object.id); free(proxy); } @@ -179,15 +166,13 @@ WL_EXPORT int wl_proxy_add_listener(struct wl_proxy *proxy, void (**implementation)(void), void *data) { - struct wl_listener *listener; - - listener = malloc(sizeof *listener); - if (listener == NULL) + if (proxy->object.implementation) { + fprintf(stderr, "proxy already has listener\n"); return -1; + } - listener->implementation = (void (**)(void)) implementation; - listener->data = data; - wl_list_insert(proxy->listener_list.prev, &listener->link); + proxy->object.implementation = implementation; + proxy->user_data = data; return 0; } @@ -393,13 +378,13 @@ wl_display_connect(const char *name) display->proxy.object.interface = &wl_display_interface; display->proxy.object.id = 1; display->proxy.display = display; - wl_list_init(&display->proxy.listener_list); wl_list_init(&display->sync_list); wl_list_init(&display->frame_list); - display->listener.implementation = (void(**)(void)) &display_listener; - wl_list_insert(display->proxy.listener_list.prev, &display->listener.link); + display->proxy.object.implementation = + (void(**)(void)) &display_listener; + display->proxy.user_data = display; display->connection = wl_connection_create(display->fd, connection_update, @@ -473,7 +458,6 @@ handle_event(struct wl_display *display, uint32_t id, uint32_t opcode, uint32_t size) { uint32_t p[32]; - struct wl_listener *listener; struct wl_proxy *proxy; struct wl_closure *closure; const struct wl_message *message; @@ -484,7 +468,7 @@ handle_event(struct wl_display *display, else proxy = wl_hash_table_lookup(display->objects, id); - if (proxy == NULL) { + if (proxy == NULL || proxy->object.implementation == NULL) { wl_connection_consume(display->connection, size); return; } @@ -496,10 +480,9 @@ handle_event(struct wl_display *display, if (wl_debug) wl_closure_print(closure, &proxy->object); - wl_list_for_each(listener, &proxy->listener_list, link) - wl_closure_invoke(closure, &proxy->object, - listener->implementation[opcode], - listener->data); + wl_closure_invoke(closure, &proxy->object, + proxy->object.implementation[opcode], + proxy->user_data); wl_closure_destroy(closure); } diff --git a/src/3rdparty/wayland/wayland-protocol.c b/src/3rdparty/wayland/wayland-protocol.c index 1b00ac44c5e..5686f9a222c 100644 --- a/src/3rdparty/wayland/wayland-protocol.c +++ b/src/3rdparty/wayland/wayland-protocol.c @@ -55,22 +55,6 @@ WL_EXPORT const struct wl_interface wl_compositor_interface = { 0, NULL, }; -static const struct wl_message drm_requests[] = { - { "authenticate", "u" }, - { "create_buffer", "nuiiuo" }, -}; - -static const struct wl_message drm_events[] = { - { "device", "s" }, - { "authenticated", "" }, -}; - -WL_EXPORT const struct wl_interface wl_drm_interface = { - "drm", 1, - ARRAY_LENGTH(drm_requests), drm_requests, - ARRAY_LENGTH(drm_events), drm_events, -}; - static const struct wl_message shm_requests[] = { { "create_buffer", "nhiiuo" }, }; diff --git a/src/3rdparty/wayland/wayland-server-protocol.h b/src/3rdparty/wayland/wayland-server-protocol.h index 8da6b7aa7b6..da61042cbb5 100644 --- a/src/3rdparty/wayland/wayland-server-protocol.h +++ b/src/3rdparty/wayland/wayland-server-protocol.h @@ -36,7 +36,6 @@ struct wl_client; struct wl_display; struct wl_compositor; -struct wl_drm; struct wl_shm; struct wl_buffer; struct wl_shell; @@ -51,7 +50,6 @@ struct wl_visual; extern const struct wl_interface wl_display_interface; extern const struct wl_interface wl_compositor_interface; -extern const struct wl_interface wl_drm_interface; extern const struct wl_interface wl_shm_interface; extern const struct wl_interface wl_buffer_interface; extern const struct wl_interface wl_shell_interface; @@ -86,23 +84,6 @@ struct wl_compositor_interface { uint32_t id); }; -struct wl_drm_interface { - void (*authenticate)(struct wl_client *client, - struct wl_drm *drm, - uint32_t id); - void (*create_buffer)(struct wl_client *client, - struct wl_drm *drm, - uint32_t id, - uint32_t name, - int width, - int height, - uint32_t stride, - struct wl_visual *visual); -}; - -#define WL_DRM_DEVICE 0 -#define WL_DRM_AUTHENTICATED 1 - struct wl_shm_interface { void (*create_buffer)(struct wl_client *client, struct wl_shm *shm, From e5df2dd4c59dd0fb3b108e6caf630ae3d44e0d05 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Fri, 4 Mar 2011 17:29:17 +0100 Subject: [PATCH 0003/1507] Add the DRM protocol files This interface was removed from Wayland, and is now the responsibility of the EGL implementation. --- .../wayland/wayland-drm-client-protocol.h | 135 ++++++++++++++++++ src/3rdparty/wayland/wayland-drm-protocol.c | 43 ++++++ .../wayland/wayland-drm-server-protocol.h | 62 ++++++++ 3 files changed, 240 insertions(+) create mode 100644 src/3rdparty/wayland/wayland-drm-client-protocol.h create mode 100644 src/3rdparty/wayland/wayland-drm-protocol.c create mode 100644 src/3rdparty/wayland/wayland-drm-server-protocol.h diff --git a/src/3rdparty/wayland/wayland-drm-client-protocol.h b/src/3rdparty/wayland/wayland-drm-client-protocol.h new file mode 100644 index 00000000000..66ab7bad10b --- /dev/null +++ b/src/3rdparty/wayland/wayland-drm-client-protocol.h @@ -0,0 +1,135 @@ +/* + * Copyright © 2010 Kristian Høgsberg + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that copyright + * notice and this permission notice appear in supporting documentation, and + * that the name of the copyright holders not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. The copyright holders make no representations + * about the suitability of this software for any purpose. It is provided "as + * is" without express or implied warranty. + * + * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THIS SOFTWARE. + */ + + +#ifndef DRM_CLIENT_PROTOCOL_H +#define DRM_CLIENT_PROTOCOL_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include "wayland-util.h" + +struct wl_client; + +struct wl_drm; + +struct wl_proxy; + +extern void +wl_proxy_marshal(struct wl_proxy *p, uint32_t opcode, ...); +extern struct wl_proxy * +wl_proxy_create(struct wl_proxy *factory, + const struct wl_interface *interface); +extern struct wl_proxy * +wl_proxy_create_for_id(struct wl_display *display, + const struct wl_interface *interface, uint32_t id); +extern void +wl_proxy_destroy(struct wl_proxy *proxy); + +extern int +wl_proxy_add_listener(struct wl_proxy *proxy, + void (**implementation)(void), void *data); + +extern void +wl_proxy_set_user_data(struct wl_proxy *proxy, void *user_data); + +extern void * +wl_proxy_get_user_data(struct wl_proxy *proxy); + +extern const struct wl_interface wl_drm_interface; + +struct wl_drm_listener { + void (*device)(void *data, + struct wl_drm *drm, + const char *name); + void (*authenticated)(void *data, + struct wl_drm *drm); +}; + +static inline int +wl_drm_add_listener(struct wl_drm *drm, + const struct wl_drm_listener *listener, void *data) +{ + return wl_proxy_add_listener((struct wl_proxy *) drm, + (void (**)(void)) listener, data); +} + +#define WL_DRM_AUTHENTICATE 0 +#define WL_DRM_CREATE_BUFFER 1 + +static inline struct wl_drm * +wl_drm_create(struct wl_display *display, uint32_t id) +{ + return (struct wl_drm *) + wl_proxy_create_for_id(display, &wl_drm_interface, id); +} + +static inline void +wl_drm_set_user_data(struct wl_drm *drm, void *user_data) +{ + wl_proxy_set_user_data((struct wl_proxy *) drm, user_data); +} + +static inline void * +wl_drm_get_user_data(struct wl_drm *drm) +{ + return wl_proxy_get_user_data((struct wl_proxy *) drm); +} + +static inline void +wl_drm_destroy(struct wl_drm *drm) +{ + wl_proxy_destroy((struct wl_proxy *) drm); +} + +static inline void +wl_drm_authenticate(struct wl_drm *drm, uint32_t id) +{ + wl_proxy_marshal((struct wl_proxy *) drm, + WL_DRM_AUTHENTICATE, id); +} + +static inline struct wl_buffer * +wl_drm_create_buffer(struct wl_drm *drm, uint32_t name, int width, int height, uint32_t stride, struct wl_visual *visual) +{ + struct wl_proxy *id; + + id = wl_proxy_create((struct wl_proxy *) drm, + &wl_buffer_interface); + if (!id) + return NULL; + + wl_proxy_marshal((struct wl_proxy *) drm, + WL_DRM_CREATE_BUFFER, id, name, width, height, stride, visual); + + return (struct wl_buffer *) id; +} + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/src/3rdparty/wayland/wayland-drm-protocol.c b/src/3rdparty/wayland/wayland-drm-protocol.c new file mode 100644 index 00000000000..f69318ec35d --- /dev/null +++ b/src/3rdparty/wayland/wayland-drm-protocol.c @@ -0,0 +1,43 @@ +/* + * Copyright © 2010 Kristian Høgsberg + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that copyright + * notice and this permission notice appear in supporting documentation, and + * that the name of the copyright holders not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. The copyright holders make no representations + * about the suitability of this software for any purpose. It is provided "as + * is" without express or implied warranty. + * + * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THIS SOFTWARE. + */ + + +#include +#include +#include "wayland-util.h" + +static const struct wl_message drm_requests[] = { + { "authenticate", "u" }, + { "create_buffer", "nuiiuo" }, +}; + +static const struct wl_message drm_events[] = { + { "device", "s" }, + { "authenticated", "" }, +}; + +WL_EXPORT const struct wl_interface wl_drm_interface = { + "drm", 1, + ARRAY_LENGTH(drm_requests), drm_requests, + ARRAY_LENGTH(drm_events), drm_events, +}; + diff --git a/src/3rdparty/wayland/wayland-drm-server-protocol.h b/src/3rdparty/wayland/wayland-drm-server-protocol.h new file mode 100644 index 00000000000..1b9f11738ed --- /dev/null +++ b/src/3rdparty/wayland/wayland-drm-server-protocol.h @@ -0,0 +1,62 @@ +/* + * Copyright © 2010 Kristian Høgsberg + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that copyright + * notice and this permission notice appear in supporting documentation, and + * that the name of the copyright holders not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. The copyright holders make no representations + * about the suitability of this software for any purpose. It is provided "as + * is" without express or implied warranty. + * + * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THIS SOFTWARE. + */ + + +#ifndef DRM_SERVER_PROTOCOL_H +#define DRM_SERVER_PROTOCOL_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include "wayland-util.h" + +struct wl_client; + +struct wl_drm; + +extern const struct wl_interface wl_drm_interface; + +struct wl_drm_interface { + void (*authenticate)(struct wl_client *client, + struct wl_drm *drm, + uint32_t id); + void (*create_buffer)(struct wl_client *client, + struct wl_drm *drm, + uint32_t id, + uint32_t name, + int width, + int height, + uint32_t stride, + struct wl_visual *visual); +}; + +#define WL_DRM_DEVICE 0 +#define WL_DRM_AUTHENTICATED 1 + +#ifdef __cplusplus +} +#endif + +#endif From abb03aa734a63535bec7b045054bf6e5ab0fc1d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Tue, 22 Mar 2011 12:13:29 +0100 Subject: [PATCH 0004/1507] Fix how wayland is compiled so that we can pick up libffi from pkg-config --- src/3rdparty/wayland/client/client.pro | 6 ++---- src/3rdparty/wayland/server/server.pro | 6 ++---- src/3rdparty/wayland/shared.pri | 9 +++++++++ 3 files changed, 13 insertions(+), 8 deletions(-) create mode 100644 src/3rdparty/wayland/shared.pri diff --git a/src/3rdparty/wayland/client/client.pro b/src/3rdparty/wayland/client/client.pro index ebf24b4ee76..71af897a592 100644 --- a/src/3rdparty/wayland/client/client.pro +++ b/src/3rdparty/wayland/client/client.pro @@ -4,11 +4,9 @@ DESTDIR=$$PWD/../../../../lib/ CONFIG -= qt CONFIG += shared +CONFIG += use_pkgconfig -INCLUDEPATH += $$PWD/.. \ - $$PWD/../../ffi - -LIBS += -L $$PWD/../../../../lib/ -lffi +include(../shared.pri) SOURCES = ../wayland-client.c \ ../wayland-protocol.c \ diff --git a/src/3rdparty/wayland/server/server.pro b/src/3rdparty/wayland/server/server.pro index 2c1788ce242..da2bf36431d 100644 --- a/src/3rdparty/wayland/server/server.pro +++ b/src/3rdparty/wayland/server/server.pro @@ -4,11 +4,9 @@ DESTDIR=$$PWD/../../../../lib/ CONFIG -= qt CONFIG += shared +CONFIG += use_pkgconfig -INCLUDEPATH += $$PWD/.. \ - $$PWD/../../ffi - -LIBS += -L $$PWD/../../../../lib/ -lffi +include(../shared.pri) SOURCES = ../event-loop.c \ ../wayland-server.c \ diff --git a/src/3rdparty/wayland/shared.pri b/src/3rdparty/wayland/shared.pri new file mode 100644 index 00000000000..44194dca7ad --- /dev/null +++ b/src/3rdparty/wayland/shared.pri @@ -0,0 +1,9 @@ +INCLUDEPATH += $$PWD + +use_pkgconfig { + CONFIG += link_pkgconfig + PKGCONFIG += libffi +} else { + LIBS += -L $$PWD/../../../../lib/ -lffi + INCLUDEPATH += $$PWD/../ffi +} From 7b34bad810c2daf5286571bd04ecd4ffc3acc80a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Tue, 22 Mar 2011 12:49:23 +0100 Subject: [PATCH 0005/1507] Adding destination directory for wayland build --- src/3rdparty/wayland/client/client.pro | 1 - src/3rdparty/wayland/server/server.pro | 1 - src/3rdparty/wayland/shared.pri | 7 +++++++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/3rdparty/wayland/client/client.pro b/src/3rdparty/wayland/client/client.pro index 71af897a592..c2c5eccce38 100644 --- a/src/3rdparty/wayland/client/client.pro +++ b/src/3rdparty/wayland/client/client.pro @@ -1,6 +1,5 @@ TEMPLATE = lib TARGET = wayland-client -DESTDIR=$$PWD/../../../../lib/ CONFIG -= qt CONFIG += shared diff --git a/src/3rdparty/wayland/server/server.pro b/src/3rdparty/wayland/server/server.pro index da2bf36431d..0898b443d7d 100644 --- a/src/3rdparty/wayland/server/server.pro +++ b/src/3rdparty/wayland/server/server.pro @@ -1,6 +1,5 @@ TEMPLATE = lib TARGET = wayland-server -DESTDIR=$$PWD/../../../../lib/ CONFIG -= qt CONFIG += shared diff --git a/src/3rdparty/wayland/shared.pri b/src/3rdparty/wayland/shared.pri index 44194dca7ad..a8b3695005f 100644 --- a/src/3rdparty/wayland/shared.pri +++ b/src/3rdparty/wayland/shared.pri @@ -1,5 +1,12 @@ INCLUDEPATH += $$PWD +WAYLAND_INSTALL_DIR = $$(WAYLAND_INSTALL_DIR) +isEmpty(WAYLAND_INSTALL_DIR) { + DESTDIR=$$PWD/../../../lib/ +} else { + DESTDIR=$$WAYLAND_INSTALL_DIR +} + use_pkgconfig { CONFIG += link_pkgconfig PKGCONFIG += libffi From 6981020be6e39cb2711a269bc463563c622c4e06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Thu, 14 Apr 2011 10:04:50 +0200 Subject: [PATCH 0006/1507] Updating src/3rdparty/wayland to head of Wayland master In git://anongit.freedesktop.org/wayland/wayland its sha f04e05ad76cd6af890b7b741a9e0f5181bd0ac10 --- src/3rdparty/wayland/connection.c | 2 + src/3rdparty/wayland/event-loop.c | 27 ++-- .../wayland/wayland-client-protocol.h | 4 +- src/3rdparty/wayland/wayland-client.c | 79 +++++++--- src/3rdparty/wayland/wayland-client.h | 4 +- src/3rdparty/wayland/wayland-protocol.c | 2 +- .../wayland/wayland-server-protocol.h | 1 + src/3rdparty/wayland/wayland-server.c | 146 ++++++++++++++---- src/3rdparty/wayland/wayland-server.h | 4 +- 9 files changed, 200 insertions(+), 69 deletions(-) diff --git a/src/3rdparty/wayland/connection.c b/src/3rdparty/wayland/connection.c index 4a004705b45..0d705b5d255 100644 --- a/src/3rdparty/wayland/connection.c +++ b/src/3rdparty/wayland/connection.c @@ -160,6 +160,8 @@ wl_connection_create(int fd, struct wl_connection *connection; connection = malloc(sizeof *connection); + if (connection == NULL) + return NULL; memset(connection, 0, sizeof *connection); connection->fd = fd; connection->update = update; diff --git a/src/3rdparty/wayland/event-loop.c b/src/3rdparty/wayland/event-loop.c index bf2a9aafb85..8166356f179 100644 --- a/src/3rdparty/wayland/event-loop.c +++ b/src/3rdparty/wayland/event-loop.c @@ -171,13 +171,10 @@ wl_event_source_timer_remove(struct wl_event_source *source) { struct wl_event_source_timer *timer_source = (struct wl_event_source_timer *) source; - struct wl_event_loop *loop = source->loop; - int fd; - fd = timer_source->fd; + close(timer_source->fd); free(source); - - return epoll_ctl(loop->epoll_fd, EPOLL_CTL_DEL, fd, NULL); + return 0; } struct wl_event_source_interface timer_source_interface = { @@ -200,7 +197,7 @@ wl_event_loop_add_timer(struct wl_event_loop *loop, source->base.interface = &timer_source_interface; source->base.loop = loop; - source->fd = timerfd_create(CLOCK_MONOTONIC, 0); + source->fd = timerfd_create(CLOCK_MONOTONIC, TFD_CLOEXEC); if (source->fd < 0) { fprintf(stderr, "could not create timerfd\n: %m"); free(source); @@ -215,6 +212,7 @@ wl_event_loop_add_timer(struct wl_event_loop *loop, ep.data.ptr = source; if (epoll_ctl(loop->epoll_fd, EPOLL_CTL_ADD, source->fd, &ep) < 0) { + close(source->fd); free(source); return NULL; } @@ -231,8 +229,8 @@ wl_event_source_timer_update(struct wl_event_source *source, int ms_delay) its.it_interval.tv_sec = 0; its.it_interval.tv_nsec = 0; - its.it_value.tv_sec = 0; - its.it_value.tv_nsec = ms_delay * 1000 * 1000; + its.it_value.tv_sec = ms_delay / 1000; + its.it_value.tv_nsec = (ms_delay % 1000) * 1000 * 1000; if (timerfd_settime(timer_source->fd, 0, &its, NULL) < 0) { fprintf(stderr, "could not set timerfd\n: %m"); return -1; @@ -267,13 +265,10 @@ wl_event_source_signal_remove(struct wl_event_source *source) { struct wl_event_source_signal *signal_source = (struct wl_event_source_signal *) source; - struct wl_event_loop *loop = source->loop; - int fd; - fd = signal_source->fd; + close(signal_source->fd); free(source); - - return epoll_ctl(loop->epoll_fd, EPOLL_CTL_DEL, fd, NULL); + return 0; } struct wl_event_source_interface signal_source_interface = { @@ -297,10 +292,11 @@ wl_event_loop_add_signal(struct wl_event_loop *loop, source->base.interface = &signal_source_interface; source->base.loop = loop; + source->signal_number = signal_number; sigemptyset(&mask); sigaddset(&mask, signal_number); - source->fd = signalfd(-1, &mask, 0); + source->fd = signalfd(-1, &mask, SFD_CLOEXEC); if (source->fd < 0) { fprintf(stderr, "could not create fd to watch signal\n: %m"); free(source); @@ -316,6 +312,7 @@ wl_event_loop_add_signal(struct wl_event_loop *loop, ep.data.ptr = source; if (epoll_ctl(loop->epoll_fd, EPOLL_CTL_ADD, source->fd, &ep) < 0) { + close(source->fd); free(source); return NULL; } @@ -392,7 +389,7 @@ wl_event_loop_create(void) if (loop == NULL) return NULL; - loop->epoll_fd = epoll_create(16); + loop->epoll_fd = epoll_create1(EPOLL_CLOEXEC); if (loop->epoll_fd < 0) { free(loop); return NULL; diff --git a/src/3rdparty/wayland/wayland-client-protocol.h b/src/3rdparty/wayland/wayland-client-protocol.h index 5f4a5c4867d..4cd84297171 100644 --- a/src/3rdparty/wayland/wayland-client-protocol.h +++ b/src/3rdparty/wayland/wayland-client-protocol.h @@ -140,10 +140,10 @@ wl_display_sync(struct wl_display *display, uint32_t key) } static inline void -wl_display_frame(struct wl_display *display, uint32_t key) +wl_display_frame(struct wl_display *display, struct wl_surface *surface, uint32_t key) { wl_proxy_marshal((struct wl_proxy *) display, - WL_DISPLAY_FRAME, key); + WL_DISPLAY_FRAME, surface, key); } #define WL_COMPOSITOR_CREATE_SURFACE 0 diff --git a/src/3rdparty/wayland/wayland-client.c b/src/3rdparty/wayland/wayland-client.c index ad35c30ae55..da89b5bc81b 100644 --- a/src/3rdparty/wayland/wayland-client.c +++ b/src/3rdparty/wayland/wayland-client.c @@ -31,6 +31,7 @@ #include #include #include +#include #include #include "wayland-client-protocol.h" @@ -61,6 +62,7 @@ struct wl_frame_handler { wl_display_frame_func_t func; uint32_t key; void *data; + struct wl_surface *surface; struct wl_list link; }; @@ -303,7 +305,8 @@ display_handle_key(void *data, if (!wl_list_empty(&display->frame_list) && frame_handler->key == key) { wl_list_remove(&frame_handler->link); - frame_handler->func(frame_handler->data, time); + frame_handler->func(frame_handler->surface, + frame_handler->data, time); free(frame_handler); return; } @@ -320,30 +323,17 @@ static const struct wl_display_listener display_listener = { display_handle_key }; -WL_EXPORT struct wl_display * -wl_display_connect(const char *name) +static int +connect_to_socket(struct wl_display *display, const char *name) { - struct wl_display *display; struct sockaddr_un addr; socklen_t size; const char *runtime_dir; - const char *debug; size_t name_size; - debug = getenv("WAYLAND_DEBUG"); - if (debug) - wl_debug = 1; - - display = malloc(sizeof *display); - if (display == NULL) - return NULL; - - memset(display, 0, sizeof *display); - display->fd = socket(PF_LOCAL, SOCK_STREAM, 0); - if (display->fd < 0) { - free(display); - return NULL; - } + display->fd = socket(PF_LOCAL, SOCK_STREAM | SOCK_CLOEXEC, 0); + if (display->fd < 0) + return -1; runtime_dir = getenv("XDG_RUNTIME_DIR"); if (runtime_dir == NULL) { @@ -368,11 +358,50 @@ wl_display_connect(const char *name) if (connect(display->fd, (struct sockaddr *) &addr, size) < 0) { close(display->fd); + return -1; + } + + return 0; +} + +WL_EXPORT struct wl_display * +wl_display_connect(const char *name) +{ + struct wl_display *display; + const char *debug; + char *connection, *end; + int flags; + + debug = getenv("WAYLAND_DEBUG"); + if (debug) + wl_debug = 1; + + display = malloc(sizeof *display); + if (display == NULL) + return NULL; + + memset(display, 0, sizeof *display); + connection = getenv("WAYLAND_SOCKET"); + if (connection) { + display->fd = strtol(connection, &end, 0); + if (*end != '\0') { + free(display); + return NULL; + } + flags = fcntl(display->fd, F_GETFD); + if (flags != -1) + fcntl(display->fd, F_SETFD, flags | FD_CLOEXEC); + } else if (connect_to_socket(display, name) < 0) { free(display); return NULL; } display->objects = wl_hash_table_create(); + if (display->objects == NULL) { + close(display->fd); + free(display); + return NULL; + } wl_list_init(&display->global_listener_list); display->proxy.object.interface = &wl_display_interface; @@ -389,7 +418,12 @@ wl_display_connect(const char *name) display->connection = wl_connection_create(display->fd, connection_update, display); - + if (display->connection == NULL) { + wl_hash_table_destroy(display->objects); + close(display->fd); + free(display); + return NULL; + } return display; } @@ -397,6 +431,7 @@ WL_EXPORT void wl_display_destroy(struct wl_display *display) { wl_connection_destroy(display->connection); + wl_hash_table_destroy(display->objects); close(display->fd); free(display); } @@ -435,6 +470,7 @@ wl_display_sync_callback(struct wl_display *display, WL_EXPORT int wl_display_frame_callback(struct wl_display *display, + struct wl_surface *surface, wl_display_frame_func_t func, void *data) { struct wl_frame_handler *handler; @@ -446,9 +482,10 @@ wl_display_frame_callback(struct wl_display *display, handler->func = func; handler->key = display->key++; handler->data = data; + handler->surface = surface; wl_list_insert(display->frame_list.prev, &handler->link); - wl_display_frame(display, handler->key); + wl_display_frame(display, handler->surface, handler->key); return 0; } diff --git a/src/3rdparty/wayland/wayland-client.h b/src/3rdparty/wayland/wayland-client.h index d207b0763df..1064a3a1939 100644 --- a/src/3rdparty/wayland/wayland-client.h +++ b/src/3rdparty/wayland/wayland-client.h @@ -35,7 +35,8 @@ extern "C" { typedef int (*wl_display_update_func_t)(uint32_t mask, void *data); typedef void (*wl_display_sync_func_t)(void *data); -typedef void (*wl_display_frame_func_t)(void *data, uint32_t time); +typedef void (*wl_display_frame_func_t)(struct wl_surface *surface, + void *data, uint32_t time); struct wl_display *wl_display_connect(const char *name); void wl_display_destroy(struct wl_display *display); @@ -46,6 +47,7 @@ void wl_display_iterate(struct wl_display *display, uint32_t mask); int wl_display_sync_callback(struct wl_display *display, wl_display_sync_func_t func, void *data); int wl_display_frame_callback(struct wl_display *display, + struct wl_surface *surface, wl_display_frame_func_t func, void *data); struct wl_global_listener; diff --git a/src/3rdparty/wayland/wayland-protocol.c b/src/3rdparty/wayland/wayland-protocol.c index 5686f9a222c..9ae296a4c00 100644 --- a/src/3rdparty/wayland/wayland-protocol.c +++ b/src/3rdparty/wayland/wayland-protocol.c @@ -27,7 +27,7 @@ static const struct wl_message display_requests[] = { { "sync", "u" }, - { "frame", "u" }, + { "frame", "ou" }, }; static const struct wl_message display_events[] = { diff --git a/src/3rdparty/wayland/wayland-server-protocol.h b/src/3rdparty/wayland/wayland-server-protocol.h index da61042cbb5..6529ead04e3 100644 --- a/src/3rdparty/wayland/wayland-server-protocol.h +++ b/src/3rdparty/wayland/wayland-server-protocol.h @@ -68,6 +68,7 @@ struct wl_display_interface { uint32_t key); void (*frame)(struct wl_client *client, struct wl_display *display, + struct wl_surface *surface, uint32_t key); }; diff --git a/src/3rdparty/wayland/wayland-server.c b/src/3rdparty/wayland/wayland-server.c index dece0d1b23c..66ad86105e1 100644 --- a/src/3rdparty/wayland/wayland-server.c +++ b/src/3rdparty/wayland/wayland-server.c @@ -20,6 +20,8 @@ * OF THIS SOFTWARE. */ +#define _GNU_SOURCE + #include #include #include @@ -33,6 +35,9 @@ #include #include #include +#include +#include +#include #include #include "wayland-server.h" @@ -41,7 +46,9 @@ struct wl_socket { int fd; + int fd_lock; struct sockaddr_un addr; + char lock_addr[113]; struct wl_list link; }; @@ -71,6 +78,7 @@ struct wl_frame_listener { struct wl_resource resource; struct wl_client *client; uint32_t key; + struct wl_surface *surface; struct wl_list link; }; @@ -209,7 +217,7 @@ wl_display_post_range(struct wl_display *display, struct wl_client *client) client->id_count += 256; } -static struct wl_client * +WL_EXPORT struct wl_client * wl_client_create(struct wl_display *display, int fd) { struct wl_client *client; @@ -226,6 +234,10 @@ wl_client_create(struct wl_display *display, int fd) wl_client_connection_data, client); client->connection = wl_connection_create(fd, wl_client_connection_update, client); + if (client->connection == NULL) { + free(client); + return NULL; + } wl_list_init(&client->resource_list); @@ -356,19 +368,21 @@ wl_input_device_set_pointer_focus(struct wl_input_device *device, &device->object, WL_INPUT_DEVICE_POINTER_FOCUS, time, NULL, 0, 0, 0, 0); - if (surface) + if (device->pointer_focus) + wl_list_remove(&device->pointer_focus_listener.link); + + if (surface) { wl_client_post_event(surface->client, &device->object, WL_INPUT_DEVICE_POINTER_FOCUS, time, surface, x, y, sx, sy); + wl_list_insert(surface->destroy_listener_list.prev, + &device->pointer_focus_listener.link); + } device->pointer_focus = surface; device->pointer_focus_time = time; - wl_list_remove(&device->pointer_focus_listener.link); - if (surface) - wl_list_insert(surface->destroy_listener_list.prev, - &device->pointer_focus_listener.link); } WL_EXPORT void @@ -385,20 +399,20 @@ wl_input_device_set_keyboard_focus(struct wl_input_device *device, &device->object, WL_INPUT_DEVICE_KEYBOARD_FOCUS, time, NULL, &device->keys); + if (device->keyboard_focus) + wl_list_remove(&device->keyboard_focus_listener.link); - if (surface) + if (surface) { wl_client_post_event(surface->client, &device->object, WL_INPUT_DEVICE_KEYBOARD_FOCUS, time, surface, &device->keys); + wl_list_insert(surface->destroy_listener_list.prev, + &device->keyboard_focus_listener.link); + } device->keyboard_focus = surface; device->keyboard_focus_time = time; - - wl_list_remove(&device->keyboard_focus_listener.link); - if (surface) - wl_list_insert(surface->destroy_listener_list.prev, - &device->keyboard_focus_listener.link); } WL_EXPORT void @@ -480,7 +494,9 @@ destroy_frame_listener(struct wl_resource *resource, struct wl_client *client) static void display_frame(struct wl_client *client, - struct wl_display *display, uint32_t key) + struct wl_display *display, + struct wl_surface *surface, + uint32_t key) { struct wl_frame_listener *listener; @@ -496,6 +512,7 @@ display_frame(struct wl_client *client, listener->resource.object.id = 0; listener->client = client; listener->key = key; + listener->surface = surface; wl_list_insert(client->resource_list.prev, &listener->resource.link); wl_list_insert(display->frame_list.prev, &listener->link); } @@ -528,6 +545,7 @@ wl_display_create(void) display->objects = wl_hash_table_create(); if (display->objects == NULL) { + wl_event_loop_destroy(display->loop); free(display); return NULL; } @@ -543,6 +561,7 @@ wl_display_create(void) display->object.implementation = (void (**)(void)) &display_interface; wl_display_add_object(display, &display->object); if (wl_display_add_global(display, &display->object, NULL)) { + wl_hash_table_destroy(display->objects); wl_event_loop_destroy(display->loop); free(display); return NULL; @@ -562,6 +581,8 @@ wl_display_destroy(struct wl_display *display) wl_list_for_each_safe(s, next, &display->socket_list, link) { close(s->fd); unlink(s->addr.sun_path); + close(s->fd_lock); + unlink(s->lock_addr); free(s); } @@ -593,11 +614,14 @@ wl_display_add_global(struct wl_display *display, } WL_EXPORT void -wl_display_post_frame(struct wl_display *display, uint32_t time) +wl_display_post_frame(struct wl_display *display, struct wl_surface *surface, + uint32_t time) { struct wl_frame_listener *listener, *next; wl_list_for_each_safe(listener, next, &display->frame_list, link) { + if (listener->surface != surface) + continue; wl_client_post_event(listener->client, &display->object, WL_DISPLAY_KEY, listener->key, time); wl_resource_destroy(&listener->resource, listener->client); @@ -634,13 +658,56 @@ socket_data(int fd, uint32_t mask, void *data) int client_fd; length = sizeof name; - client_fd = accept (fd, (struct sockaddr *) &name, &length); + client_fd = + accept4(fd, (struct sockaddr *) &name, &length, SOCK_CLOEXEC); if (client_fd < 0) fprintf(stderr, "failed to accept\n"); wl_client_create(display, client_fd); } +static int +get_socket_lock(struct wl_socket *socket, socklen_t name_size) +{ + struct stat socket_stat; + int lock_size = name_size + 5; + + snprintf(socket->lock_addr, lock_size, + "%s.lock", socket->addr.sun_path); + + socket->fd_lock = open(socket->lock_addr, O_CREAT | O_CLOEXEC, + (S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP)); + + if (socket->fd_lock < 0) { + fprintf(stderr, + "unable to open lockfile %s check permissions\n", + socket->lock_addr); + return -1; + } + + if (flock(socket->fd_lock, LOCK_EX | LOCK_NB) < 0) { + fprintf(stderr, + "unable to lock lockfile %s, maybe another compositor is running\n", + socket->lock_addr); + close(socket->fd_lock); + return -1; + } + + if (stat(socket->addr.sun_path, &socket_stat) < 0 ) { + if (errno != ENOENT) { + fprintf(stderr, "did not manage to stat file %s\n", + socket->addr.sun_path); + close(socket->fd_lock); + return -1; + } + } else if (socket_stat.st_mode & S_IWUSR || + socket_stat.st_mode & S_IWGRP) { + unlink(socket->addr.sun_path); + } + + return 0; +} + WL_EXPORT int wl_display_add_socket(struct wl_display *display, const char *name) { @@ -652,9 +719,11 @@ wl_display_add_socket(struct wl_display *display, const char *name) if (s == NULL) return -1; - s->fd = socket(PF_LOCAL, SOCK_STREAM, 0); - if (s->fd < 0) + s->fd = socket(PF_LOCAL, SOCK_STREAM | SOCK_CLOEXEC, 0); + if (s->fd < 0) { + free(s); return -1; + } runtime_dir = getenv("XDG_RUNTIME_DIR"); if (runtime_dir == NULL) { @@ -675,16 +744,34 @@ wl_display_add_socket(struct wl_display *display, const char *name) "%s/%s", runtime_dir, name) + 1; fprintf(stderr, "using socket %s\n", s->addr.sun_path); + if (get_socket_lock(s,name_size) < 0) { + close(s->fd); + free(s); + return -1; + } + size = offsetof (struct sockaddr_un, sun_path) + name_size; - if (bind(s->fd, (struct sockaddr *) &s->addr, size) < 0) + if (bind(s->fd, (struct sockaddr *) &s->addr, size) < 0) { + close(s->fd); + free(s); return -1; + } - if (listen(s->fd, 1) < 0) + if (listen(s->fd, 1) < 0) { + close(s->fd); + unlink(s->addr.sun_path); + free(s); return -1; + } - wl_event_loop_add_fd(display->loop, s->fd, - WL_EVENT_READABLE, - socket_data, display); + if (wl_event_loop_add_fd(display->loop, s->fd, + WL_EVENT_READABLE, + socket_data, display) == NULL) { + close(s->fd); + unlink(s->addr.sun_path); + free(s); + return -1; + } wl_list_insert(display->socket_list.prev, &s->link); return 0; @@ -704,23 +791,26 @@ wl_compositor_init(struct wl_compositor *compositor, compositor->argb_visual.object.interface = &wl_visual_interface; compositor->argb_visual.object.implementation = NULL; wl_display_add_object(display, &compositor->argb_visual.object); - wl_display_add_global(display, &compositor->argb_visual.object, NULL); + if (wl_display_add_global(display, &compositor->argb_visual.object, NULL)) + return -1; compositor->premultiplied_argb_visual.object.interface = &wl_visual_interface; compositor->premultiplied_argb_visual.object.implementation = NULL; wl_display_add_object(display, &compositor->premultiplied_argb_visual.object); - wl_display_add_global(display, - &compositor->premultiplied_argb_visual.object, - NULL); + if (wl_display_add_global(display, + &compositor->premultiplied_argb_visual.object, + NULL)) + return -1; compositor->rgb_visual.object.interface = &wl_visual_interface; compositor->rgb_visual.object.implementation = NULL; wl_display_add_object(display, &compositor->rgb_visual.object); - wl_display_add_global(display, - &compositor->rgb_visual.object, NULL); + if (wl_display_add_global(display, + &compositor->rgb_visual.object, NULL)) + return -1; return 0; } diff --git a/src/3rdparty/wayland/wayland-server.h b/src/3rdparty/wayland/wayland-server.h index f74cbae0420..8032866ca88 100644 --- a/src/3rdparty/wayland/wayland-server.h +++ b/src/3rdparty/wayland/wayland-server.h @@ -87,6 +87,7 @@ typedef void (*wl_client_connect_func_t)(struct wl_client *client, struct wl_obj int wl_display_add_global(struct wl_display *display, struct wl_object *object, wl_client_connect_func_t func); +struct wl_client *wl_client_create(struct wl_display *display, int fd); void wl_client_destroy(struct wl_client *client); void wl_client_post_no_memory(struct wl_client *client); void wl_client_post_global(struct wl_client *client, struct wl_object *object); @@ -214,7 +215,8 @@ wl_display_set_compositor(struct wl_display *display, const struct wl_compositor_interface *implementation); void -wl_display_post_frame(struct wl_display *display, uint32_t msecs); +wl_display_post_frame(struct wl_display *display, struct wl_surface *surface, + uint32_t msecs); void wl_client_add_resource(struct wl_client *client, From e039efc63cf36ef7f521bf5570d23b9e33ec4ed6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Tue, 19 Apr 2011 09:03:33 +0200 Subject: [PATCH 0007/1507] Dont use accept4 && SOCK_CLOEXEC --- src/3rdparty/wayland/wayland-server.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/3rdparty/wayland/wayland-server.c b/src/3rdparty/wayland/wayland-server.c index 66ad86105e1..358fa489922 100644 --- a/src/3rdparty/wayland/wayland-server.c +++ b/src/3rdparty/wayland/wayland-server.c @@ -659,9 +659,10 @@ socket_data(int fd, uint32_t mask, void *data) length = sizeof name; client_fd = - accept4(fd, (struct sockaddr *) &name, &length, SOCK_CLOEXEC); +// accept4(fd, (struct sockaddr *) &name, &length, SOCK_CLOEXEC); + accept (fd, (struct sockaddr *) &name, &length); if (client_fd < 0) - fprintf(stderr, "failed to accept\n"); + fprintf(stderr, "failed to accept: %m\n"); wl_client_create(display, client_fd); } From 49adfa9d0f677315f775c62134a69d9260b1ab3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Tue, 3 May 2011 12:44:43 +0200 Subject: [PATCH 0008/1507] Update 3rd party Wayland and reapplied e039efc63cf36ef7f521bf5570d23b9e33ec4ed6 --- src/3rdparty/wayland/event-loop.c | 95 ++-- src/3rdparty/wayland/server/server.pro | 3 +- .../wayland/wayland-client-protocol.h | 445 +++++++++--------- src/3rdparty/wayland/wayland-client.c | 40 +- src/3rdparty/wayland/wayland-client.h | 24 +- src/3rdparty/wayland/wayland-egl.h | 22 +- src/3rdparty/wayland/wayland-protocol.c | 104 ++-- .../wayland/wayland-server-protocol.h | 63 ++- src/3rdparty/wayland/wayland-server.c | 39 +- src/3rdparty/wayland/wayland-server.h | 60 ++- src/3rdparty/wayland/wayland-shm.c | 228 +++++++++ 11 files changed, 744 insertions(+), 379 deletions(-) create mode 100644 src/3rdparty/wayland/wayland-shm.c diff --git a/src/3rdparty/wayland/event-loop.c b/src/3rdparty/wayland/event-loop.c index 8166356f179..0f41034b403 100644 --- a/src/3rdparty/wayland/event-loop.c +++ b/src/3rdparty/wayland/event-loop.c @@ -37,28 +37,29 @@ struct wl_event_loop { int epoll_fd; - struct wl_list idle_list; + struct wl_list check_list; }; struct wl_event_source_interface { - void (*dispatch)(struct wl_event_source *source, - struct epoll_event *ep); + int (*dispatch)(struct wl_event_source *source, + struct epoll_event *ep); int (*remove)(struct wl_event_source *source); }; struct wl_event_source { struct wl_event_source_interface *interface; struct wl_event_loop *loop; + struct wl_list link; + void *data; }; struct wl_event_source_fd { struct wl_event_source base; int fd; wl_event_loop_fd_func_t func; - void *data; }; -static void +static int wl_event_source_fd_dispatch(struct wl_event_source *source, struct epoll_event *ep) { @@ -71,7 +72,7 @@ wl_event_source_fd_dispatch(struct wl_event_source *source, if (ep->events & EPOLLOUT) mask |= WL_EVENT_WRITEABLE; - fd_source->func(fd_source->fd, mask, fd_source->data); + return fd_source->func(fd_source->fd, mask, fd_source->base.data); } static int @@ -108,9 +109,10 @@ wl_event_loop_add_fd(struct wl_event_loop *loop, source->base.interface = &fd_source_interface; source->base.loop = loop; + wl_list_init(&source->base.link); source->fd = fd; source->func = func; - source->data = data; + source->base.data = data; memset(&ep, 0, sizeof ep); if (mask & WL_EVENT_READABLE) @@ -150,10 +152,9 @@ struct wl_event_source_timer { struct wl_event_source base; int fd; wl_event_loop_timer_func_t func; - void *data; }; -static void +static int wl_event_source_timer_dispatch(struct wl_event_source *source, struct epoll_event *ep) { @@ -163,7 +164,7 @@ wl_event_source_timer_dispatch(struct wl_event_source *source, read(timer_source->fd, &expires, sizeof expires); - timer_source->func(timer_source->data); + return timer_source->func(timer_source->base.data); } static int @@ -196,6 +197,7 @@ wl_event_loop_add_timer(struct wl_event_loop *loop, source->base.interface = &timer_source_interface; source->base.loop = loop; + wl_list_init(&source->base.link); source->fd = timerfd_create(CLOCK_MONOTONIC, TFD_CLOEXEC); if (source->fd < 0) { @@ -205,7 +207,7 @@ wl_event_loop_add_timer(struct wl_event_loop *loop, } source->func = func; - source->data = data; + source->base.data = data; memset(&ep, 0, sizeof ep); ep.events = EPOLLIN; @@ -244,10 +246,9 @@ struct wl_event_source_signal { int fd; int signal_number; wl_event_loop_signal_func_t func; - void *data; }; -static void +static int wl_event_source_signal_dispatch(struct wl_event_source *source, struct epoll_event *ep) { @@ -257,7 +258,8 @@ wl_event_source_signal_dispatch(struct wl_event_source *source, read(signal_source->fd, &signal_info, sizeof signal_info); - signal_source->func(signal_source->signal_number, signal_source->data); + return signal_source->func(signal_source->signal_number, + signal_source->base.data); } static int @@ -292,6 +294,7 @@ wl_event_loop_add_signal(struct wl_event_loop *loop, source->base.interface = &signal_source_interface; source->base.loop = loop; + wl_list_init(&source->base.link); source->signal_number = signal_number; sigemptyset(&mask); @@ -305,7 +308,7 @@ wl_event_loop_add_signal(struct wl_event_loop *loop, sigprocmask(SIG_BLOCK, &mask, NULL); source->func = func; - source->data = data; + source->base.data = data; memset(&ep, 0, sizeof ep); ep.events = EPOLLIN; @@ -322,16 +325,20 @@ wl_event_loop_add_signal(struct wl_event_loop *loop, struct wl_event_source_idle { struct wl_event_source base; - struct wl_list link; wl_event_loop_idle_func_t func; - void *data; }; -static void +static int wl_event_source_idle_dispatch(struct wl_event_source *source, struct epoll_event *ep) { - assert(0); + struct wl_event_source_idle *idle_source = + (struct wl_event_source_idle *) source; + + idle_source->func(idle_source->base.data); + wl_event_source_remove(&idle_source->base); + + return 1; } static int @@ -340,7 +347,7 @@ wl_event_source_idle_remove(struct wl_event_source *source) struct wl_event_source_idle *idle_source = (struct wl_event_source_idle *) source; - wl_list_remove(&idle_source->link); + wl_list_remove(&idle_source->base.link); free(source); return 0; @@ -366,15 +373,24 @@ wl_event_loop_add_idle(struct wl_event_loop *loop, source->base.loop = loop; source->func = func; - source->data = data; - wl_list_insert(loop->idle_list.prev, &source->link); + source->base.data = data; + wl_event_source_check(&source->base); return &source->base; } +WL_EXPORT void +wl_event_source_check(struct wl_event_source *source) +{ + wl_list_insert(source->loop->check_list.prev, &source->link); +} + WL_EXPORT int wl_event_source_remove(struct wl_event_source *source) { + if (!wl_list_empty(&source->link)) + wl_list_remove(&source->link); + source->interface->remove(source); return 0; @@ -394,7 +410,7 @@ wl_event_loop_create(void) free(loop); return NULL; } - wl_list_init(&loop->idle_list); + wl_list_init(&loop->check_list); return loop; } @@ -406,31 +422,40 @@ wl_event_loop_destroy(struct wl_event_loop *loop) free(loop); } +static int +post_dispatch_check(struct wl_event_loop *loop) +{ + struct epoll_event ep; + struct wl_event_source *source, *next; + int n; + + ep.events = 0; + n = 0; + wl_list_for_each_safe(source, next, &loop->check_list, link) + n += source->interface->dispatch(source, &ep); + + return n; +} + WL_EXPORT int wl_event_loop_dispatch(struct wl_event_loop *loop, int timeout) { struct epoll_event ep[32]; struct wl_event_source *source; - struct wl_event_source_idle *idle; - int i, count; + int i, count, n; count = epoll_wait(loop->epoll_fd, ep, ARRAY_LENGTH(ep), timeout); if (count < 0) return -1; - + n = 0; for (i = 0; i < count; i++) { source = ep[i].data.ptr; - source->interface->dispatch(source, &ep[i]); - } - - while (!wl_list_empty(&loop->idle_list)) { - idle = container_of(loop->idle_list.next, - struct wl_event_source_idle, link); - wl_list_remove(&idle->link); - idle->func(idle->data); - free(idle); + n += source->interface->dispatch(source, &ep[i]); } + while (n > 0) + n = post_dispatch_check(loop); + return 0; } diff --git a/src/3rdparty/wayland/server/server.pro b/src/3rdparty/wayland/server/server.pro index 0898b443d7d..9f52b5c007a 100644 --- a/src/3rdparty/wayland/server/server.pro +++ b/src/3rdparty/wayland/server/server.pro @@ -12,6 +12,7 @@ SOURCES = ../event-loop.c \ ../wayland-protocol.c \ ../connection.c \ ../wayland-util.c \ - ../wayland-hash.c + ../wayland-hash.c \ + ../wayland-shm.c OBJECTS_DIR = .obj diff --git a/src/3rdparty/wayland/wayland-client-protocol.h b/src/3rdparty/wayland/wayland-client-protocol.h index 4cd84297171..564168401bc 100644 --- a/src/3rdparty/wayland/wayland-client-protocol.h +++ b/src/3rdparty/wayland/wayland-client-protocol.h @@ -48,29 +48,6 @@ struct wl_input_device; struct wl_output; struct wl_visual; -struct wl_proxy; - -extern void -wl_proxy_marshal(struct wl_proxy *p, uint32_t opcode, ...); -extern struct wl_proxy * -wl_proxy_create(struct wl_proxy *factory, - const struct wl_interface *interface); -extern struct wl_proxy * -wl_proxy_create_for_id(struct wl_display *display, - const struct wl_interface *interface, uint32_t id); -extern void -wl_proxy_destroy(struct wl_proxy *proxy); - -extern int -wl_proxy_add_listener(struct wl_proxy *proxy, - void (**implementation)(void), void *data); - -extern void -wl_proxy_set_user_data(struct wl_proxy *proxy, void *user_data); - -extern void * -wl_proxy_get_user_data(struct wl_proxy *proxy); - extern const struct wl_interface wl_display_interface; extern const struct wl_interface wl_compositor_interface; extern const struct wl_interface wl_shm_interface; @@ -87,103 +64,113 @@ extern const struct wl_interface wl_visual_interface; struct wl_display_listener { void (*invalid_object)(void *data, - struct wl_display *display, + struct wl_display *wl_display, uint32_t object_id); void (*invalid_method)(void *data, - struct wl_display *display, + struct wl_display *wl_display, uint32_t object_id, uint32_t opcode); void (*no_memory)(void *data, - struct wl_display *display); + struct wl_display *wl_display); void (*global)(void *data, - struct wl_display *display, + struct wl_display *wl_display, uint32_t id, const char *name, uint32_t version); void (*range)(void *data, - struct wl_display *display, + struct wl_display *wl_display, uint32_t base); void (*key)(void *data, - struct wl_display *display, + struct wl_display *wl_display, uint32_t key, uint32_t time); }; static inline int -wl_display_add_listener(struct wl_display *display, - const struct wl_display_listener *listener, void *data) +wl_display_add_listener(struct wl_display *wl_display, + const struct wl_display_listener *listener, void *data) { - return wl_proxy_add_listener((struct wl_proxy *) display, + return wl_proxy_add_listener((struct wl_proxy *) wl_display, (void (**)(void)) listener, data); } -#define WL_DISPLAY_SYNC 0 -#define WL_DISPLAY_FRAME 1 +#define WL_DISPLAY_BIND 0 +#define WL_DISPLAY_SYNC 1 +#define WL_DISPLAY_FRAME 2 static inline void -wl_display_set_user_data(struct wl_display *display, void *user_data) +wl_display_set_user_data(struct wl_display *wl_display, void *user_data) { - wl_proxy_set_user_data((struct wl_proxy *) display, user_data); + wl_proxy_set_user_data((struct wl_proxy *) wl_display, user_data); } static inline void * -wl_display_get_user_data(struct wl_display *display) +wl_display_get_user_data(struct wl_display *wl_display) { - return wl_proxy_get_user_data((struct wl_proxy *) display); + return wl_proxy_get_user_data((struct wl_proxy *) wl_display); } static inline void -wl_display_sync(struct wl_display *display, uint32_t key) +wl_display_bind(struct wl_display *wl_display, uint32_t id, const char *interface, uint32_t version) { - wl_proxy_marshal((struct wl_proxy *) display, + wl_proxy_marshal((struct wl_proxy *) wl_display, + WL_DISPLAY_BIND, id, interface, version); +} + +static inline void +wl_display_sync(struct wl_display *wl_display, uint32_t key) +{ + wl_proxy_marshal((struct wl_proxy *) wl_display, WL_DISPLAY_SYNC, key); } static inline void -wl_display_frame(struct wl_display *display, struct wl_surface *surface, uint32_t key) +wl_display_frame(struct wl_display *wl_display, struct wl_surface *surface, uint32_t key) { - wl_proxy_marshal((struct wl_proxy *) display, + wl_proxy_marshal((struct wl_proxy *) wl_display, WL_DISPLAY_FRAME, surface, key); } #define WL_COMPOSITOR_CREATE_SURFACE 0 static inline struct wl_compositor * -wl_compositor_create(struct wl_display *display, uint32_t id) +wl_compositor_create(struct wl_display *display, uint32_t id, uint32_t version) { + wl_display_bind(display, id, "wl_compositor", version); + return (struct wl_compositor *) wl_proxy_create_for_id(display, &wl_compositor_interface, id); } static inline void -wl_compositor_set_user_data(struct wl_compositor *compositor, void *user_data) +wl_compositor_set_user_data(struct wl_compositor *wl_compositor, void *user_data) { - wl_proxy_set_user_data((struct wl_proxy *) compositor, user_data); + wl_proxy_set_user_data((struct wl_proxy *) wl_compositor, user_data); } static inline void * -wl_compositor_get_user_data(struct wl_compositor *compositor) +wl_compositor_get_user_data(struct wl_compositor *wl_compositor) { - return wl_proxy_get_user_data((struct wl_proxy *) compositor); + return wl_proxy_get_user_data((struct wl_proxy *) wl_compositor); } static inline void -wl_compositor_destroy(struct wl_compositor *compositor) +wl_compositor_destroy(struct wl_compositor *wl_compositor) { - wl_proxy_destroy((struct wl_proxy *) compositor); + wl_proxy_destroy((struct wl_proxy *) wl_compositor); } static inline struct wl_surface * -wl_compositor_create_surface(struct wl_compositor *compositor) +wl_compositor_create_surface(struct wl_compositor *wl_compositor) { struct wl_proxy *id; - id = wl_proxy_create((struct wl_proxy *) compositor, + id = wl_proxy_create((struct wl_proxy *) wl_compositor, &wl_surface_interface); if (!id) return NULL; - wl_proxy_marshal((struct wl_proxy *) compositor, + wl_proxy_marshal((struct wl_proxy *) wl_compositor, WL_COMPOSITOR_CREATE_SURFACE, id); return (struct wl_surface *) id; @@ -192,74 +179,86 @@ wl_compositor_create_surface(struct wl_compositor *compositor) #define WL_SHM_CREATE_BUFFER 0 static inline struct wl_shm * -wl_shm_create(struct wl_display *display, uint32_t id) +wl_shm_create(struct wl_display *display, uint32_t id, uint32_t version) { + wl_display_bind(display, id, "wl_shm", version); + return (struct wl_shm *) wl_proxy_create_for_id(display, &wl_shm_interface, id); } static inline void -wl_shm_set_user_data(struct wl_shm *shm, void *user_data) +wl_shm_set_user_data(struct wl_shm *wl_shm, void *user_data) { - wl_proxy_set_user_data((struct wl_proxy *) shm, user_data); + wl_proxy_set_user_data((struct wl_proxy *) wl_shm, user_data); } static inline void * -wl_shm_get_user_data(struct wl_shm *shm) +wl_shm_get_user_data(struct wl_shm *wl_shm) { - return wl_proxy_get_user_data((struct wl_proxy *) shm); + return wl_proxy_get_user_data((struct wl_proxy *) wl_shm); } static inline void -wl_shm_destroy(struct wl_shm *shm) +wl_shm_destroy(struct wl_shm *wl_shm) { - wl_proxy_destroy((struct wl_proxy *) shm); + wl_proxy_destroy((struct wl_proxy *) wl_shm); } static inline struct wl_buffer * -wl_shm_create_buffer(struct wl_shm *shm, int fd, int width, int height, uint32_t stride, struct wl_visual *visual) +wl_shm_create_buffer(struct wl_shm *wl_shm, int fd, int width, int height, uint32_t stride, struct wl_visual *visual) { struct wl_proxy *id; - id = wl_proxy_create((struct wl_proxy *) shm, + id = wl_proxy_create((struct wl_proxy *) wl_shm, &wl_buffer_interface); if (!id) return NULL; - wl_proxy_marshal((struct wl_proxy *) shm, + wl_proxy_marshal((struct wl_proxy *) wl_shm, WL_SHM_CREATE_BUFFER, id, fd, width, height, stride, visual); return (struct wl_buffer *) id; } -#define WL_BUFFER_DESTROY 0 +#define WL_BUFFER_DAMAGE 0 +#define WL_BUFFER_DESTROY 1 static inline struct wl_buffer * -wl_buffer_create(struct wl_display *display, uint32_t id) +wl_buffer_create(struct wl_display *display, uint32_t id, uint32_t version) { + wl_display_bind(display, id, "wl_buffer", version); + return (struct wl_buffer *) wl_proxy_create_for_id(display, &wl_buffer_interface, id); } static inline void -wl_buffer_set_user_data(struct wl_buffer *buffer, void *user_data) +wl_buffer_set_user_data(struct wl_buffer *wl_buffer, void *user_data) { - wl_proxy_set_user_data((struct wl_proxy *) buffer, user_data); + wl_proxy_set_user_data((struct wl_proxy *) wl_buffer, user_data); } static inline void * -wl_buffer_get_user_data(struct wl_buffer *buffer) +wl_buffer_get_user_data(struct wl_buffer *wl_buffer) { - return wl_proxy_get_user_data((struct wl_proxy *) buffer); + return wl_proxy_get_user_data((struct wl_proxy *) wl_buffer); } static inline void -wl_buffer_destroy(struct wl_buffer *buffer) +wl_buffer_damage(struct wl_buffer *wl_buffer, int x, int y, int width, int height) { - wl_proxy_marshal((struct wl_proxy *) buffer, + wl_proxy_marshal((struct wl_proxy *) wl_buffer, + WL_BUFFER_DAMAGE, x, y, width, height); +} + +static inline void +wl_buffer_destroy(struct wl_buffer *wl_buffer) +{ + wl_proxy_marshal((struct wl_proxy *) wl_buffer, WL_BUFFER_DESTROY); - wl_proxy_destroy((struct wl_proxy *) buffer); + wl_proxy_destroy((struct wl_proxy *) wl_buffer); } #ifndef WL_SHELL_RESIZE_ENUM @@ -279,7 +278,7 @@ enum wl_shell_resize { struct wl_shell_listener { void (*configure)(void *data, - struct wl_shell *shell, + struct wl_shell *wl_shell, uint32_t time, uint32_t edges, struct wl_surface *surface, @@ -288,10 +287,10 @@ struct wl_shell_listener { }; static inline int -wl_shell_add_listener(struct wl_shell *shell, - const struct wl_shell_listener *listener, void *data) +wl_shell_add_listener(struct wl_shell *wl_shell, + const struct wl_shell_listener *listener, void *data) { - return wl_proxy_add_listener((struct wl_proxy *) shell, + return wl_proxy_add_listener((struct wl_proxy *) wl_shell, (void (**)(void)) listener, data); } @@ -301,71 +300,73 @@ wl_shell_add_listener(struct wl_shell *shell, #define WL_SHELL_CREATE_SELECTION 3 static inline struct wl_shell * -wl_shell_create(struct wl_display *display, uint32_t id) +wl_shell_create(struct wl_display *display, uint32_t id, uint32_t version) { + wl_display_bind(display, id, "wl_shell", version); + return (struct wl_shell *) wl_proxy_create_for_id(display, &wl_shell_interface, id); } static inline void -wl_shell_set_user_data(struct wl_shell *shell, void *user_data) +wl_shell_set_user_data(struct wl_shell *wl_shell, void *user_data) { - wl_proxy_set_user_data((struct wl_proxy *) shell, user_data); + wl_proxy_set_user_data((struct wl_proxy *) wl_shell, user_data); } static inline void * -wl_shell_get_user_data(struct wl_shell *shell) +wl_shell_get_user_data(struct wl_shell *wl_shell) { - return wl_proxy_get_user_data((struct wl_proxy *) shell); + return wl_proxy_get_user_data((struct wl_proxy *) wl_shell); } static inline void -wl_shell_destroy(struct wl_shell *shell) +wl_shell_destroy(struct wl_shell *wl_shell) { - wl_proxy_destroy((struct wl_proxy *) shell); + wl_proxy_destroy((struct wl_proxy *) wl_shell); } static inline void -wl_shell_move(struct wl_shell *shell, struct wl_surface *surface, struct wl_input_device *input_device, uint32_t time) +wl_shell_move(struct wl_shell *wl_shell, struct wl_surface *surface, struct wl_input_device *input_device, uint32_t time) { - wl_proxy_marshal((struct wl_proxy *) shell, + wl_proxy_marshal((struct wl_proxy *) wl_shell, WL_SHELL_MOVE, surface, input_device, time); } static inline void -wl_shell_resize(struct wl_shell *shell, struct wl_surface *surface, struct wl_input_device *input_device, uint32_t time, uint32_t edges) +wl_shell_resize(struct wl_shell *wl_shell, struct wl_surface *surface, struct wl_input_device *input_device, uint32_t time, uint32_t edges) { - wl_proxy_marshal((struct wl_proxy *) shell, + wl_proxy_marshal((struct wl_proxy *) wl_shell, WL_SHELL_RESIZE, surface, input_device, time, edges); } static inline struct wl_drag * -wl_shell_create_drag(struct wl_shell *shell) +wl_shell_create_drag(struct wl_shell *wl_shell) { struct wl_proxy *id; - id = wl_proxy_create((struct wl_proxy *) shell, + id = wl_proxy_create((struct wl_proxy *) wl_shell, &wl_drag_interface); if (!id) return NULL; - wl_proxy_marshal((struct wl_proxy *) shell, + wl_proxy_marshal((struct wl_proxy *) wl_shell, WL_SHELL_CREATE_DRAG, id); return (struct wl_drag *) id; } static inline struct wl_selection * -wl_shell_create_selection(struct wl_shell *shell) +wl_shell_create_selection(struct wl_shell *wl_shell) { struct wl_proxy *id; - id = wl_proxy_create((struct wl_proxy *) shell, + id = wl_proxy_create((struct wl_proxy *) wl_shell, &wl_selection_interface); if (!id) return NULL; - wl_proxy_marshal((struct wl_proxy *) shell, + wl_proxy_marshal((struct wl_proxy *) wl_shell, WL_SHELL_CREATE_SELECTION, id); return (struct wl_selection *) id; @@ -373,18 +374,18 @@ wl_shell_create_selection(struct wl_shell *shell) struct wl_selection_listener { void (*send)(void *data, - struct wl_selection *selection, + struct wl_selection *wl_selection, const char *mime_type, int fd); void (*cancelled)(void *data, - struct wl_selection *selection); + struct wl_selection *wl_selection); }; static inline int -wl_selection_add_listener(struct wl_selection *selection, - const struct wl_selection_listener *listener, void *data) +wl_selection_add_listener(struct wl_selection *wl_selection, + const struct wl_selection_listener *listener, void *data) { - return wl_proxy_add_listener((struct wl_proxy *) selection, + return wl_proxy_add_listener((struct wl_proxy *) wl_selection, (void (**)(void)) listener, data); } @@ -393,114 +394,118 @@ wl_selection_add_listener(struct wl_selection *selection, #define WL_SELECTION_DESTROY 2 static inline struct wl_selection * -wl_selection_create(struct wl_display *display, uint32_t id) +wl_selection_create(struct wl_display *display, uint32_t id, uint32_t version) { + wl_display_bind(display, id, "wl_selection", version); + return (struct wl_selection *) wl_proxy_create_for_id(display, &wl_selection_interface, id); } static inline void -wl_selection_set_user_data(struct wl_selection *selection, void *user_data) +wl_selection_set_user_data(struct wl_selection *wl_selection, void *user_data) { - wl_proxy_set_user_data((struct wl_proxy *) selection, user_data); + wl_proxy_set_user_data((struct wl_proxy *) wl_selection, user_data); } static inline void * -wl_selection_get_user_data(struct wl_selection *selection) +wl_selection_get_user_data(struct wl_selection *wl_selection) { - return wl_proxy_get_user_data((struct wl_proxy *) selection); + return wl_proxy_get_user_data((struct wl_proxy *) wl_selection); } static inline void -wl_selection_offer(struct wl_selection *selection, const char *type) +wl_selection_offer(struct wl_selection *wl_selection, const char *type) { - wl_proxy_marshal((struct wl_proxy *) selection, + wl_proxy_marshal((struct wl_proxy *) wl_selection, WL_SELECTION_OFFER, type); } static inline void -wl_selection_activate(struct wl_selection *selection, struct wl_input_device *input_device, uint32_t time) +wl_selection_activate(struct wl_selection *wl_selection, struct wl_input_device *input_device, uint32_t time) { - wl_proxy_marshal((struct wl_proxy *) selection, + wl_proxy_marshal((struct wl_proxy *) wl_selection, WL_SELECTION_ACTIVATE, input_device, time); } static inline void -wl_selection_destroy(struct wl_selection *selection) +wl_selection_destroy(struct wl_selection *wl_selection) { - wl_proxy_marshal((struct wl_proxy *) selection, + wl_proxy_marshal((struct wl_proxy *) wl_selection, WL_SELECTION_DESTROY); - wl_proxy_destroy((struct wl_proxy *) selection); + wl_proxy_destroy((struct wl_proxy *) wl_selection); } struct wl_selection_offer_listener { void (*offer)(void *data, - struct wl_selection_offer *selection_offer, + struct wl_selection_offer *wl_selection_offer, const char *type); void (*keyboard_focus)(void *data, - struct wl_selection_offer *selection_offer, + struct wl_selection_offer *wl_selection_offer, struct wl_input_device *input_device); }; static inline int -wl_selection_offer_add_listener(struct wl_selection_offer *selection_offer, - const struct wl_selection_offer_listener *listener, void *data) +wl_selection_offer_add_listener(struct wl_selection_offer *wl_selection_offer, + const struct wl_selection_offer_listener *listener, void *data) { - return wl_proxy_add_listener((struct wl_proxy *) selection_offer, + return wl_proxy_add_listener((struct wl_proxy *) wl_selection_offer, (void (**)(void)) listener, data); } #define WL_SELECTION_OFFER_RECEIVE 0 static inline struct wl_selection_offer * -wl_selection_offer_create(struct wl_display *display, uint32_t id) +wl_selection_offer_create(struct wl_display *display, uint32_t id, uint32_t version) { + wl_display_bind(display, id, "wl_selection_offer", version); + return (struct wl_selection_offer *) wl_proxy_create_for_id(display, &wl_selection_offer_interface, id); } static inline void -wl_selection_offer_set_user_data(struct wl_selection_offer *selection_offer, void *user_data) +wl_selection_offer_set_user_data(struct wl_selection_offer *wl_selection_offer, void *user_data) { - wl_proxy_set_user_data((struct wl_proxy *) selection_offer, user_data); + wl_proxy_set_user_data((struct wl_proxy *) wl_selection_offer, user_data); } static inline void * -wl_selection_offer_get_user_data(struct wl_selection_offer *selection_offer) +wl_selection_offer_get_user_data(struct wl_selection_offer *wl_selection_offer) { - return wl_proxy_get_user_data((struct wl_proxy *) selection_offer); + return wl_proxy_get_user_data((struct wl_proxy *) wl_selection_offer); } static inline void -wl_selection_offer_destroy(struct wl_selection_offer *selection_offer) +wl_selection_offer_destroy(struct wl_selection_offer *wl_selection_offer) { - wl_proxy_destroy((struct wl_proxy *) selection_offer); + wl_proxy_destroy((struct wl_proxy *) wl_selection_offer); } static inline void -wl_selection_offer_receive(struct wl_selection_offer *selection_offer, const char *mime_type, int fd) +wl_selection_offer_receive(struct wl_selection_offer *wl_selection_offer, const char *mime_type, int fd) { - wl_proxy_marshal((struct wl_proxy *) selection_offer, + wl_proxy_marshal((struct wl_proxy *) wl_selection_offer, WL_SELECTION_OFFER_RECEIVE, mime_type, fd); } struct wl_drag_listener { void (*target)(void *data, - struct wl_drag *drag, + struct wl_drag *wl_drag, const char *mime_type); void (*finish)(void *data, - struct wl_drag *drag, + struct wl_drag *wl_drag, int fd); void (*reject)(void *data, - struct wl_drag *drag); + struct wl_drag *wl_drag); }; static inline int -wl_drag_add_listener(struct wl_drag *drag, - const struct wl_drag_listener *listener, void *data) +wl_drag_add_listener(struct wl_drag *wl_drag, + const struct wl_drag_listener *listener, void *data) { - return wl_proxy_add_listener((struct wl_proxy *) drag, + return wl_proxy_add_listener((struct wl_proxy *) wl_drag, (void (**)(void)) listener, data); } @@ -509,53 +514,55 @@ wl_drag_add_listener(struct wl_drag *drag, #define WL_DRAG_DESTROY 2 static inline struct wl_drag * -wl_drag_create(struct wl_display *display, uint32_t id) +wl_drag_create(struct wl_display *display, uint32_t id, uint32_t version) { + wl_display_bind(display, id, "wl_drag", version); + return (struct wl_drag *) wl_proxy_create_for_id(display, &wl_drag_interface, id); } static inline void -wl_drag_set_user_data(struct wl_drag *drag, void *user_data) +wl_drag_set_user_data(struct wl_drag *wl_drag, void *user_data) { - wl_proxy_set_user_data((struct wl_proxy *) drag, user_data); + wl_proxy_set_user_data((struct wl_proxy *) wl_drag, user_data); } static inline void * -wl_drag_get_user_data(struct wl_drag *drag) +wl_drag_get_user_data(struct wl_drag *wl_drag) { - return wl_proxy_get_user_data((struct wl_proxy *) drag); + return wl_proxy_get_user_data((struct wl_proxy *) wl_drag); } static inline void -wl_drag_offer(struct wl_drag *drag, const char *type) +wl_drag_offer(struct wl_drag *wl_drag, const char *type) { - wl_proxy_marshal((struct wl_proxy *) drag, + wl_proxy_marshal((struct wl_proxy *) wl_drag, WL_DRAG_OFFER, type); } static inline void -wl_drag_activate(struct wl_drag *drag, struct wl_surface *surface, struct wl_input_device *input_device, uint32_t time) +wl_drag_activate(struct wl_drag *wl_drag, struct wl_surface *surface, struct wl_input_device *input_device, uint32_t time) { - wl_proxy_marshal((struct wl_proxy *) drag, + wl_proxy_marshal((struct wl_proxy *) wl_drag, WL_DRAG_ACTIVATE, surface, input_device, time); } static inline void -wl_drag_destroy(struct wl_drag *drag) +wl_drag_destroy(struct wl_drag *wl_drag) { - wl_proxy_marshal((struct wl_proxy *) drag, + wl_proxy_marshal((struct wl_proxy *) wl_drag, WL_DRAG_DESTROY); - wl_proxy_destroy((struct wl_proxy *) drag); + wl_proxy_destroy((struct wl_proxy *) wl_drag); } struct wl_drag_offer_listener { void (*offer)(void *data, - struct wl_drag_offer *drag_offer, + struct wl_drag_offer *wl_drag_offer, const char *type); void (*pointer_focus)(void *data, - struct wl_drag_offer *drag_offer, + struct wl_drag_offer *wl_drag_offer, uint32_t time, struct wl_surface *surface, int x, @@ -563,21 +570,21 @@ struct wl_drag_offer_listener { int surface_x, int surface_y); void (*motion)(void *data, - struct wl_drag_offer *drag_offer, + struct wl_drag_offer *wl_drag_offer, uint32_t time, int x, int y, int surface_x, int surface_y); void (*drop)(void *data, - struct wl_drag_offer *drag_offer); + struct wl_drag_offer *wl_drag_offer); }; static inline int -wl_drag_offer_add_listener(struct wl_drag_offer *drag_offer, - const struct wl_drag_offer_listener *listener, void *data) +wl_drag_offer_add_listener(struct wl_drag_offer *wl_drag_offer, + const struct wl_drag_offer_listener *listener, void *data) { - return wl_proxy_add_listener((struct wl_proxy *) drag_offer, + return wl_proxy_add_listener((struct wl_proxy *) wl_drag_offer, (void (**)(void)) listener, data); } @@ -586,48 +593,50 @@ wl_drag_offer_add_listener(struct wl_drag_offer *drag_offer, #define WL_DRAG_OFFER_REJECT 2 static inline struct wl_drag_offer * -wl_drag_offer_create(struct wl_display *display, uint32_t id) +wl_drag_offer_create(struct wl_display *display, uint32_t id, uint32_t version) { + wl_display_bind(display, id, "wl_drag_offer", version); + return (struct wl_drag_offer *) wl_proxy_create_for_id(display, &wl_drag_offer_interface, id); } static inline void -wl_drag_offer_set_user_data(struct wl_drag_offer *drag_offer, void *user_data) +wl_drag_offer_set_user_data(struct wl_drag_offer *wl_drag_offer, void *user_data) { - wl_proxy_set_user_data((struct wl_proxy *) drag_offer, user_data); + wl_proxy_set_user_data((struct wl_proxy *) wl_drag_offer, user_data); } static inline void * -wl_drag_offer_get_user_data(struct wl_drag_offer *drag_offer) +wl_drag_offer_get_user_data(struct wl_drag_offer *wl_drag_offer) { - return wl_proxy_get_user_data((struct wl_proxy *) drag_offer); + return wl_proxy_get_user_data((struct wl_proxy *) wl_drag_offer); } static inline void -wl_drag_offer_destroy(struct wl_drag_offer *drag_offer) +wl_drag_offer_destroy(struct wl_drag_offer *wl_drag_offer) { - wl_proxy_destroy((struct wl_proxy *) drag_offer); + wl_proxy_destroy((struct wl_proxy *) wl_drag_offer); } static inline void -wl_drag_offer_accept(struct wl_drag_offer *drag_offer, uint32_t time, const char *type) +wl_drag_offer_accept(struct wl_drag_offer *wl_drag_offer, uint32_t time, const char *type) { - wl_proxy_marshal((struct wl_proxy *) drag_offer, + wl_proxy_marshal((struct wl_proxy *) wl_drag_offer, WL_DRAG_OFFER_ACCEPT, time, type); } static inline void -wl_drag_offer_receive(struct wl_drag_offer *drag_offer, int fd) +wl_drag_offer_receive(struct wl_drag_offer *wl_drag_offer, int fd) { - wl_proxy_marshal((struct wl_proxy *) drag_offer, + wl_proxy_marshal((struct wl_proxy *) wl_drag_offer, WL_DRAG_OFFER_RECEIVE, fd); } static inline void -wl_drag_offer_reject(struct wl_drag_offer *drag_offer) +wl_drag_offer_reject(struct wl_drag_offer *wl_drag_offer) { - wl_proxy_marshal((struct wl_proxy *) drag_offer, + wl_proxy_marshal((struct wl_proxy *) wl_drag_offer, WL_DRAG_OFFER_REJECT); } @@ -639,88 +648,90 @@ wl_drag_offer_reject(struct wl_drag_offer *drag_offer) #define WL_SURFACE_DAMAGE 5 static inline struct wl_surface * -wl_surface_create(struct wl_display *display, uint32_t id) +wl_surface_create(struct wl_display *display, uint32_t id, uint32_t version) { + wl_display_bind(display, id, "wl_surface", version); + return (struct wl_surface *) wl_proxy_create_for_id(display, &wl_surface_interface, id); } static inline void -wl_surface_set_user_data(struct wl_surface *surface, void *user_data) +wl_surface_set_user_data(struct wl_surface *wl_surface, void *user_data) { - wl_proxy_set_user_data((struct wl_proxy *) surface, user_data); + wl_proxy_set_user_data((struct wl_proxy *) wl_surface, user_data); } static inline void * -wl_surface_get_user_data(struct wl_surface *surface) +wl_surface_get_user_data(struct wl_surface *wl_surface) { - return wl_proxy_get_user_data((struct wl_proxy *) surface); + return wl_proxy_get_user_data((struct wl_proxy *) wl_surface); } static inline void -wl_surface_destroy(struct wl_surface *surface) +wl_surface_destroy(struct wl_surface *wl_surface) { - wl_proxy_marshal((struct wl_proxy *) surface, + wl_proxy_marshal((struct wl_proxy *) wl_surface, WL_SURFACE_DESTROY); - wl_proxy_destroy((struct wl_proxy *) surface); + wl_proxy_destroy((struct wl_proxy *) wl_surface); } static inline void -wl_surface_attach(struct wl_surface *surface, struct wl_buffer *buffer, int x, int y) +wl_surface_attach(struct wl_surface *wl_surface, struct wl_buffer *buffer, int x, int y) { - wl_proxy_marshal((struct wl_proxy *) surface, + wl_proxy_marshal((struct wl_proxy *) wl_surface, WL_SURFACE_ATTACH, buffer, x, y); } static inline void -wl_surface_map_toplevel(struct wl_surface *surface) +wl_surface_map_toplevel(struct wl_surface *wl_surface) { - wl_proxy_marshal((struct wl_proxy *) surface, + wl_proxy_marshal((struct wl_proxy *) wl_surface, WL_SURFACE_MAP_TOPLEVEL); } static inline void -wl_surface_map_transient(struct wl_surface *surface, struct wl_surface *parent, int x, int y, uint32_t flags) +wl_surface_map_transient(struct wl_surface *wl_surface, struct wl_surface *parent, int x, int y, uint32_t flags) { - wl_proxy_marshal((struct wl_proxy *) surface, + wl_proxy_marshal((struct wl_proxy *) wl_surface, WL_SURFACE_MAP_TRANSIENT, parent, x, y, flags); } static inline void -wl_surface_map_fullscreen(struct wl_surface *surface) +wl_surface_map_fullscreen(struct wl_surface *wl_surface) { - wl_proxy_marshal((struct wl_proxy *) surface, + wl_proxy_marshal((struct wl_proxy *) wl_surface, WL_SURFACE_MAP_FULLSCREEN); } static inline void -wl_surface_damage(struct wl_surface *surface, int x, int y, int width, int height) +wl_surface_damage(struct wl_surface *wl_surface, int x, int y, int width, int height) { - wl_proxy_marshal((struct wl_proxy *) surface, + wl_proxy_marshal((struct wl_proxy *) wl_surface, WL_SURFACE_DAMAGE, x, y, width, height); } struct wl_input_device_listener { void (*motion)(void *data, - struct wl_input_device *input_device, + struct wl_input_device *wl_input_device, uint32_t time, int x, int y, int surface_x, int surface_y); void (*button)(void *data, - struct wl_input_device *input_device, + struct wl_input_device *wl_input_device, uint32_t time, uint32_t button, uint32_t state); void (*key)(void *data, - struct wl_input_device *input_device, + struct wl_input_device *wl_input_device, uint32_t time, uint32_t key, uint32_t state); void (*pointer_focus)(void *data, - struct wl_input_device *input_device, + struct wl_input_device *wl_input_device, uint32_t time, struct wl_surface *surface, int x, @@ -728,57 +739,59 @@ struct wl_input_device_listener { int surface_x, int surface_y); void (*keyboard_focus)(void *data, - struct wl_input_device *input_device, + struct wl_input_device *wl_input_device, uint32_t time, struct wl_surface *surface, struct wl_array *keys); }; static inline int -wl_input_device_add_listener(struct wl_input_device *input_device, - const struct wl_input_device_listener *listener, void *data) +wl_input_device_add_listener(struct wl_input_device *wl_input_device, + const struct wl_input_device_listener *listener, void *data) { - return wl_proxy_add_listener((struct wl_proxy *) input_device, + return wl_proxy_add_listener((struct wl_proxy *) wl_input_device, (void (**)(void)) listener, data); } #define WL_INPUT_DEVICE_ATTACH 0 static inline struct wl_input_device * -wl_input_device_create(struct wl_display *display, uint32_t id) +wl_input_device_create(struct wl_display *display, uint32_t id, uint32_t version) { + wl_display_bind(display, id, "wl_input_device", version); + return (struct wl_input_device *) wl_proxy_create_for_id(display, &wl_input_device_interface, id); } static inline void -wl_input_device_set_user_data(struct wl_input_device *input_device, void *user_data) +wl_input_device_set_user_data(struct wl_input_device *wl_input_device, void *user_data) { - wl_proxy_set_user_data((struct wl_proxy *) input_device, user_data); + wl_proxy_set_user_data((struct wl_proxy *) wl_input_device, user_data); } static inline void * -wl_input_device_get_user_data(struct wl_input_device *input_device) +wl_input_device_get_user_data(struct wl_input_device *wl_input_device) { - return wl_proxy_get_user_data((struct wl_proxy *) input_device); + return wl_proxy_get_user_data((struct wl_proxy *) wl_input_device); } static inline void -wl_input_device_destroy(struct wl_input_device *input_device) +wl_input_device_destroy(struct wl_input_device *wl_input_device) { - wl_proxy_destroy((struct wl_proxy *) input_device); + wl_proxy_destroy((struct wl_proxy *) wl_input_device); } static inline void -wl_input_device_attach(struct wl_input_device *input_device, uint32_t time, struct wl_buffer *buffer, int hotspot_x, int hotspot_y) +wl_input_device_attach(struct wl_input_device *wl_input_device, uint32_t time, struct wl_buffer *buffer, int hotspot_x, int hotspot_y) { - wl_proxy_marshal((struct wl_proxy *) input_device, + wl_proxy_marshal((struct wl_proxy *) wl_input_device, WL_INPUT_DEVICE_ATTACH, time, buffer, hotspot_x, hotspot_y); } struct wl_output_listener { void (*geometry)(void *data, - struct wl_output *output, + struct wl_output *wl_output, int x, int y, int width, @@ -786,61 +799,65 @@ struct wl_output_listener { }; static inline int -wl_output_add_listener(struct wl_output *output, - const struct wl_output_listener *listener, void *data) +wl_output_add_listener(struct wl_output *wl_output, + const struct wl_output_listener *listener, void *data) { - return wl_proxy_add_listener((struct wl_proxy *) output, + return wl_proxy_add_listener((struct wl_proxy *) wl_output, (void (**)(void)) listener, data); } static inline struct wl_output * -wl_output_create(struct wl_display *display, uint32_t id) +wl_output_create(struct wl_display *display, uint32_t id, uint32_t version) { + wl_display_bind(display, id, "wl_output", version); + return (struct wl_output *) wl_proxy_create_for_id(display, &wl_output_interface, id); } static inline void -wl_output_set_user_data(struct wl_output *output, void *user_data) +wl_output_set_user_data(struct wl_output *wl_output, void *user_data) { - wl_proxy_set_user_data((struct wl_proxy *) output, user_data); + wl_proxy_set_user_data((struct wl_proxy *) wl_output, user_data); } static inline void * -wl_output_get_user_data(struct wl_output *output) +wl_output_get_user_data(struct wl_output *wl_output) { - return wl_proxy_get_user_data((struct wl_proxy *) output); + return wl_proxy_get_user_data((struct wl_proxy *) wl_output); } static inline void -wl_output_destroy(struct wl_output *output) +wl_output_destroy(struct wl_output *wl_output) { - wl_proxy_destroy((struct wl_proxy *) output); + wl_proxy_destroy((struct wl_proxy *) wl_output); } static inline struct wl_visual * -wl_visual_create(struct wl_display *display, uint32_t id) +wl_visual_create(struct wl_display *display, uint32_t id, uint32_t version) { + wl_display_bind(display, id, "wl_visual", version); + return (struct wl_visual *) wl_proxy_create_for_id(display, &wl_visual_interface, id); } static inline void -wl_visual_set_user_data(struct wl_visual *visual, void *user_data) +wl_visual_set_user_data(struct wl_visual *wl_visual, void *user_data) { - wl_proxy_set_user_data((struct wl_proxy *) visual, user_data); + wl_proxy_set_user_data((struct wl_proxy *) wl_visual, user_data); } static inline void * -wl_visual_get_user_data(struct wl_visual *visual) +wl_visual_get_user_data(struct wl_visual *wl_visual) { - return wl_proxy_get_user_data((struct wl_proxy *) visual); + return wl_proxy_get_user_data((struct wl_proxy *) wl_visual); } static inline void -wl_visual_destroy(struct wl_visual *visual) +wl_visual_destroy(struct wl_visual *wl_visual) { - wl_proxy_destroy((struct wl_proxy *) visual); + wl_proxy_destroy((struct wl_proxy *) wl_visual); } #ifdef __cplusplus diff --git a/src/3rdparty/wayland/wayland-client.c b/src/3rdparty/wayland/wayland-client.c index da89b5bc81b..531807dba7a 100644 --- a/src/3rdparty/wayland/wayland-client.c +++ b/src/3rdparty/wayland/wayland-client.c @@ -34,7 +34,6 @@ #include #include -#include "wayland-client-protocol.h" #include "connection.h" #include "wayland-util.h" #include "wayland-client.h" @@ -66,6 +65,13 @@ struct wl_frame_handler { struct wl_list link; }; +struct wl_global { + uint32_t id; + char *interface; + uint32_t version; + struct wl_list link; +}; + struct wl_display { struct wl_proxy proxy; struct wl_connection *connection; @@ -74,6 +80,7 @@ struct wl_display { uint32_t mask; struct wl_hash_table *objects; struct wl_list global_listener_list; + struct wl_list global_list; struct wl_visual *argb_visual; struct wl_visual *premultiplied_argb_visual; @@ -234,6 +241,22 @@ wl_display_get_rgb_visual(struct wl_display *display) return display->rgb_visual; } +/* Can't do this, there may be more than one instance of an + * interface... */ +WL_EXPORT uint32_t +wl_display_get_global(struct wl_display *display, + const char *interface, uint32_t version) +{ + struct wl_global *global; + + wl_list_for_each(global, &display->global_list, link) + if (strcmp(interface, global->interface) == 0 && + version <= global->version) + return global->id; + + return 0; +} + static void display_handle_invalid_object(void *data, struct wl_display *display, uint32_t id) @@ -265,13 +288,20 @@ display_handle_global(void *data, uint32_t id, const char *interface, uint32_t version) { struct wl_global_listener *listener; + struct wl_global *global; - if (strcmp(interface, "display") == 0) + if (strcmp(interface, "wl_display") == 0) wl_hash_table_insert(display->objects, id, &display->proxy.object); - else if (strcmp(interface, "visual") == 0) + else if (strcmp(interface, "wl_visual") == 0) add_visual(display, id); + global = malloc(sizeof *global); + global->id = id; + global->interface = strdup(interface); + global->version = version; + wl_list_insert(display->global_list.prev, &global->link); + wl_list_for_each(listener, &display->global_listener_list, link) (*listener->handler)(display, id, interface, version, listener->data); @@ -403,6 +433,7 @@ wl_display_connect(const char *name) return NULL; } wl_list_init(&display->global_listener_list); + wl_list_init(&display->global_list); display->proxy.object.interface = &wl_display_interface; display->proxy.object.id = 1; @@ -424,6 +455,9 @@ wl_display_connect(const char *name) free(display); return NULL; } + + wl_display_bind(display, 1, "wl_display", 1); + return display; } diff --git a/src/3rdparty/wayland/wayland-client.h b/src/3rdparty/wayland/wayland-client.h index 1064a3a1939..f1ac7978c48 100644 --- a/src/3rdparty/wayland/wayland-client.h +++ b/src/3rdparty/wayland/wayland-client.h @@ -24,12 +24,28 @@ #define _WAYLAND_CLIENT_H #include "wayland-util.h" -#include "wayland-client-protocol.h" #ifdef __cplusplus extern "C" { #endif +struct wl_proxy; +struct wl_display; + +void wl_proxy_marshal(struct wl_proxy *p, uint32_t opcode, ...); +struct wl_proxy *wl_proxy_create(struct wl_proxy *factory, + const struct wl_interface *interface); +struct wl_proxy *wl_proxy_create_for_id(struct wl_display *display, + const struct wl_interface *interface, + uint32_t id); +void wl_proxy_destroy(struct wl_proxy *proxy); +int wl_proxy_add_listener(struct wl_proxy *proxy, + void (**implementation)(void), void *data); +void wl_proxy_set_user_data(struct wl_proxy *proxy, void *user_data); +void *wl_proxy_get_user_data(struct wl_proxy *proxy); + +#include "wayland-client-protocol.h" + #define WL_DISPLAY_READABLE 0x01 #define WL_DISPLAY_WRITABLE 0x02 @@ -59,10 +75,13 @@ typedef void (*wl_display_global_func_t)(struct wl_display *display, void wl_display_remove_global_listener(struct wl_display *display, struct wl_global_listener *listener); - struct wl_global_listener * wl_display_add_global_listener(struct wl_display *display, wl_display_global_func_t handler, void *data); +WL_EXPORT uint32_t +wl_display_get_global(struct wl_display *display, + const char *interface, uint32_t version); + struct wl_visual * wl_display_get_argb_visual(struct wl_display *display); struct wl_visual * @@ -70,6 +89,7 @@ wl_display_get_premultiplied_argb_visual(struct wl_display *display); struct wl_visual * wl_display_get_rgb_visual(struct wl_display *display); + #ifdef __cplusplus } #endif diff --git a/src/3rdparty/wayland/wayland-egl.h b/src/3rdparty/wayland/wayland-egl.h index d3de87c79af..85fe73d90bc 100644 --- a/src/3rdparty/wayland/wayland-egl.h +++ b/src/3rdparty/wayland/wayland-egl.h @@ -32,19 +32,11 @@ extern "C" { #define WL_EGL_PLATFORM 1 -struct wl_egl_display; struct wl_egl_window; struct wl_egl_pixmap; -struct wl_egl_display * -wl_egl_display_create(struct wl_display *egl_display); - -void -wl_egl_display_destroy(struct wl_egl_display *egl_display); - struct wl_egl_window * -wl_egl_window_create(struct wl_egl_display *egl_display, - struct wl_surface *surface, +wl_egl_window_create(struct wl_surface *surface, int width, int height, struct wl_visual *visual); @@ -58,22 +50,16 @@ wl_egl_window_resize(struct wl_egl_window *egl_window, void wl_egl_window_get_attached_size(struct wl_egl_window *egl_window, - int *width, int *height); + int *width, int *height); struct wl_egl_pixmap * -wl_egl_pixmap_create(struct wl_egl_display *egl_display, - int width, int height, +wl_egl_pixmap_create(int width, int height, struct wl_visual *visual, uint32_t flags); void wl_egl_pixmap_destroy(struct wl_egl_pixmap *egl_pixmap); struct wl_buffer * -wl_egl_pixmap_create_buffer(struct wl_egl_display *egl_display, - struct wl_egl_pixmap *egl_pixmap); - -void -wl_egl_pixmap_flush(struct wl_egl_display *egl_display, - struct wl_egl_pixmap *egl_pixmap); +wl_egl_pixmap_create_buffer(struct wl_egl_pixmap *egl_pixmap); #ifdef __cplusplus } diff --git a/src/3rdparty/wayland/wayland-protocol.c b/src/3rdparty/wayland/wayland-protocol.c index 9ae296a4c00..afcd2c9d3ee 100644 --- a/src/3rdparty/wayland/wayland-protocol.c +++ b/src/3rdparty/wayland/wayland-protocol.c @@ -25,12 +25,13 @@ #include #include "wayland-util.h" -static const struct wl_message display_requests[] = { +static const struct wl_message wl_display_requests[] = { + { "bind", "usu" }, { "sync", "u" }, { "frame", "ou" }, }; -static const struct wl_message display_events[] = { +static const struct wl_message wl_display_events[] = { { "invalid_object", "u" }, { "invalid_method", "uu" }, { "no_memory", "" }, @@ -40,115 +41,116 @@ static const struct wl_message display_events[] = { }; WL_EXPORT const struct wl_interface wl_display_interface = { - "display", 1, - ARRAY_LENGTH(display_requests), display_requests, - ARRAY_LENGTH(display_events), display_events, + "wl_display", 1, + ARRAY_LENGTH(wl_display_requests), wl_display_requests, + ARRAY_LENGTH(wl_display_events), wl_display_events, }; -static const struct wl_message compositor_requests[] = { +static const struct wl_message wl_compositor_requests[] = { { "create_surface", "n" }, }; WL_EXPORT const struct wl_interface wl_compositor_interface = { - "compositor", 1, - ARRAY_LENGTH(compositor_requests), compositor_requests, + "wl_compositor", 1, + ARRAY_LENGTH(wl_compositor_requests), wl_compositor_requests, 0, NULL, }; -static const struct wl_message shm_requests[] = { +static const struct wl_message wl_shm_requests[] = { { "create_buffer", "nhiiuo" }, }; WL_EXPORT const struct wl_interface wl_shm_interface = { - "shm", 1, - ARRAY_LENGTH(shm_requests), shm_requests, + "wl_shm", 1, + ARRAY_LENGTH(wl_shm_requests), wl_shm_requests, 0, NULL, }; -static const struct wl_message buffer_requests[] = { +static const struct wl_message wl_buffer_requests[] = { + { "damage", "iiii" }, { "destroy", "" }, }; WL_EXPORT const struct wl_interface wl_buffer_interface = { - "buffer", 1, - ARRAY_LENGTH(buffer_requests), buffer_requests, + "wl_buffer", 1, + ARRAY_LENGTH(wl_buffer_requests), wl_buffer_requests, 0, NULL, }; -static const struct wl_message shell_requests[] = { +static const struct wl_message wl_shell_requests[] = { { "move", "oou" }, { "resize", "oouu" }, { "create_drag", "n" }, { "create_selection", "n" }, }; -static const struct wl_message shell_events[] = { +static const struct wl_message wl_shell_events[] = { { "configure", "uuoii" }, }; WL_EXPORT const struct wl_interface wl_shell_interface = { - "shell", 1, - ARRAY_LENGTH(shell_requests), shell_requests, - ARRAY_LENGTH(shell_events), shell_events, + "wl_shell", 1, + ARRAY_LENGTH(wl_shell_requests), wl_shell_requests, + ARRAY_LENGTH(wl_shell_events), wl_shell_events, }; -static const struct wl_message selection_requests[] = { +static const struct wl_message wl_selection_requests[] = { { "offer", "s" }, { "activate", "ou" }, { "destroy", "" }, }; -static const struct wl_message selection_events[] = { +static const struct wl_message wl_selection_events[] = { { "send", "sh" }, { "cancelled", "" }, }; WL_EXPORT const struct wl_interface wl_selection_interface = { - "selection", 1, - ARRAY_LENGTH(selection_requests), selection_requests, - ARRAY_LENGTH(selection_events), selection_events, + "wl_selection", 1, + ARRAY_LENGTH(wl_selection_requests), wl_selection_requests, + ARRAY_LENGTH(wl_selection_events), wl_selection_events, }; -static const struct wl_message selection_offer_requests[] = { +static const struct wl_message wl_selection_offer_requests[] = { { "receive", "sh" }, }; -static const struct wl_message selection_offer_events[] = { +static const struct wl_message wl_selection_offer_events[] = { { "offer", "s" }, { "keyboard_focus", "o" }, }; WL_EXPORT const struct wl_interface wl_selection_offer_interface = { - "selection_offer", 1, - ARRAY_LENGTH(selection_offer_requests), selection_offer_requests, - ARRAY_LENGTH(selection_offer_events), selection_offer_events, + "wl_selection_offer", 1, + ARRAY_LENGTH(wl_selection_offer_requests), wl_selection_offer_requests, + ARRAY_LENGTH(wl_selection_offer_events), wl_selection_offer_events, }; -static const struct wl_message drag_requests[] = { +static const struct wl_message wl_drag_requests[] = { { "offer", "s" }, { "activate", "oou" }, { "destroy", "" }, }; -static const struct wl_message drag_events[] = { +static const struct wl_message wl_drag_events[] = { { "target", "s" }, { "finish", "h" }, { "reject", "" }, }; WL_EXPORT const struct wl_interface wl_drag_interface = { - "drag", 1, - ARRAY_LENGTH(drag_requests), drag_requests, - ARRAY_LENGTH(drag_events), drag_events, + "wl_drag", 1, + ARRAY_LENGTH(wl_drag_requests), wl_drag_requests, + ARRAY_LENGTH(wl_drag_events), wl_drag_events, }; -static const struct wl_message drag_offer_requests[] = { +static const struct wl_message wl_drag_offer_requests[] = { { "accept", "us" }, { "receive", "h" }, { "reject", "" }, }; -static const struct wl_message drag_offer_events[] = { +static const struct wl_message wl_drag_offer_events[] = { { "offer", "s" }, { "pointer_focus", "uoiiii" }, { "motion", "uiiii" }, @@ -156,12 +158,12 @@ static const struct wl_message drag_offer_events[] = { }; WL_EXPORT const struct wl_interface wl_drag_offer_interface = { - "drag_offer", 1, - ARRAY_LENGTH(drag_offer_requests), drag_offer_requests, - ARRAY_LENGTH(drag_offer_events), drag_offer_events, + "wl_drag_offer", 1, + ARRAY_LENGTH(wl_drag_offer_requests), wl_drag_offer_requests, + ARRAY_LENGTH(wl_drag_offer_events), wl_drag_offer_events, }; -static const struct wl_message surface_requests[] = { +static const struct wl_message wl_surface_requests[] = { { "destroy", "" }, { "attach", "oii" }, { "map_toplevel", "" }, @@ -171,16 +173,16 @@ static const struct wl_message surface_requests[] = { }; WL_EXPORT const struct wl_interface wl_surface_interface = { - "surface", 1, - ARRAY_LENGTH(surface_requests), surface_requests, + "wl_surface", 1, + ARRAY_LENGTH(wl_surface_requests), wl_surface_requests, 0, NULL, }; -static const struct wl_message input_device_requests[] = { +static const struct wl_message wl_input_device_requests[] = { { "attach", "uoii" }, }; -static const struct wl_message input_device_events[] = { +static const struct wl_message wl_input_device_events[] = { { "motion", "uiiii" }, { "button", "uuu" }, { "key", "uuu" }, @@ -189,23 +191,23 @@ static const struct wl_message input_device_events[] = { }; WL_EXPORT const struct wl_interface wl_input_device_interface = { - "input_device", 1, - ARRAY_LENGTH(input_device_requests), input_device_requests, - ARRAY_LENGTH(input_device_events), input_device_events, + "wl_input_device", 1, + ARRAY_LENGTH(wl_input_device_requests), wl_input_device_requests, + ARRAY_LENGTH(wl_input_device_events), wl_input_device_events, }; -static const struct wl_message output_events[] = { +static const struct wl_message wl_output_events[] = { { "geometry", "iiii" }, }; WL_EXPORT const struct wl_interface wl_output_interface = { - "output", 1, + "wl_output", 1, 0, NULL, - ARRAY_LENGTH(output_events), output_events, + ARRAY_LENGTH(wl_output_events), wl_output_events, }; WL_EXPORT const struct wl_interface wl_visual_interface = { - "visual", 1, + "wl_visual", 1, 0, NULL, 0, NULL, }; diff --git a/src/3rdparty/wayland/wayland-server-protocol.h b/src/3rdparty/wayland/wayland-server-protocol.h index 6529ead04e3..bd6f91c9822 100644 --- a/src/3rdparty/wayland/wayland-server-protocol.h +++ b/src/3rdparty/wayland/wayland-server-protocol.h @@ -63,11 +63,16 @@ extern const struct wl_interface wl_output_interface; extern const struct wl_interface wl_visual_interface; struct wl_display_interface { + void (*bind)(struct wl_client *client, + struct wl_display *wl_display, + uint32_t id, + const char *interface, + uint32_t version); void (*sync)(struct wl_client *client, - struct wl_display *display, + struct wl_display *wl_display, uint32_t key); void (*frame)(struct wl_client *client, - struct wl_display *display, + struct wl_display *wl_display, struct wl_surface *surface, uint32_t key); }; @@ -81,13 +86,13 @@ struct wl_display_interface { struct wl_compositor_interface { void (*create_surface)(struct wl_client *client, - struct wl_compositor *compositor, + struct wl_compositor *wl_compositor, uint32_t id); }; struct wl_shm_interface { void (*create_buffer)(struct wl_client *client, - struct wl_shm *shm, + struct wl_shm *wl_shm, uint32_t id, int fd, int width, @@ -97,8 +102,14 @@ struct wl_shm_interface { }; struct wl_buffer_interface { + void (*damage)(struct wl_client *client, + struct wl_buffer *wl_buffer, + int x, + int y, + int width, + int height); void (*destroy)(struct wl_client *client, - struct wl_buffer *buffer); + struct wl_buffer *wl_buffer); }; #ifndef WL_SHELL_RESIZE_ENUM @@ -118,21 +129,21 @@ enum wl_shell_resize { struct wl_shell_interface { void (*move)(struct wl_client *client, - struct wl_shell *shell, + struct wl_shell *wl_shell, struct wl_surface *surface, struct wl_input_device *input_device, uint32_t time); void (*resize)(struct wl_client *client, - struct wl_shell *shell, + struct wl_shell *wl_shell, struct wl_surface *surface, struct wl_input_device *input_device, uint32_t time, uint32_t edges); void (*create_drag)(struct wl_client *client, - struct wl_shell *shell, + struct wl_shell *wl_shell, uint32_t id); void (*create_selection)(struct wl_client *client, - struct wl_shell *shell, + struct wl_shell *wl_shell, uint32_t id); }; @@ -140,14 +151,14 @@ struct wl_shell_interface { struct wl_selection_interface { void (*offer)(struct wl_client *client, - struct wl_selection *selection, + struct wl_selection *wl_selection, const char *type); void (*activate)(struct wl_client *client, - struct wl_selection *selection, + struct wl_selection *wl_selection, struct wl_input_device *input_device, uint32_t time); void (*destroy)(struct wl_client *client, - struct wl_selection *selection); + struct wl_selection *wl_selection); }; #define WL_SELECTION_SEND 0 @@ -155,7 +166,7 @@ struct wl_selection_interface { struct wl_selection_offer_interface { void (*receive)(struct wl_client *client, - struct wl_selection_offer *selection_offer, + struct wl_selection_offer *wl_selection_offer, const char *mime_type, int fd); }; @@ -165,15 +176,15 @@ struct wl_selection_offer_interface { struct wl_drag_interface { void (*offer)(struct wl_client *client, - struct wl_drag *drag, + struct wl_drag *wl_drag, const char *type); void (*activate)(struct wl_client *client, - struct wl_drag *drag, + struct wl_drag *wl_drag, struct wl_surface *surface, struct wl_input_device *input_device, uint32_t time); void (*destroy)(struct wl_client *client, - struct wl_drag *drag); + struct wl_drag *wl_drag); }; #define WL_DRAG_TARGET 0 @@ -182,14 +193,14 @@ struct wl_drag_interface { struct wl_drag_offer_interface { void (*accept)(struct wl_client *client, - struct wl_drag_offer *drag_offer, + struct wl_drag_offer *wl_drag_offer, uint32_t time, const char *type); void (*receive)(struct wl_client *client, - struct wl_drag_offer *drag_offer, + struct wl_drag_offer *wl_drag_offer, int fd); void (*reject)(struct wl_client *client, - struct wl_drag_offer *drag_offer); + struct wl_drag_offer *wl_drag_offer); }; #define WL_DRAG_OFFER_OFFER 0 @@ -199,24 +210,24 @@ struct wl_drag_offer_interface { struct wl_surface_interface { void (*destroy)(struct wl_client *client, - struct wl_surface *surface); + struct wl_surface *wl_surface); void (*attach)(struct wl_client *client, - struct wl_surface *surface, + struct wl_surface *wl_surface, struct wl_buffer *buffer, int x, int y); void (*map_toplevel)(struct wl_client *client, - struct wl_surface *surface); + struct wl_surface *wl_surface); void (*map_transient)(struct wl_client *client, - struct wl_surface *surface, + struct wl_surface *wl_surface, struct wl_surface *parent, int x, int y, uint32_t flags); void (*map_fullscreen)(struct wl_client *client, - struct wl_surface *surface); + struct wl_surface *wl_surface); void (*damage)(struct wl_client *client, - struct wl_surface *surface, + struct wl_surface *wl_surface, int x, int y, int width, @@ -225,7 +236,7 @@ struct wl_surface_interface { struct wl_input_device_interface { void (*attach)(struct wl_client *client, - struct wl_input_device *input_device, + struct wl_input_device *wl_input_device, uint32_t time, struct wl_buffer *buffer, int hotspot_x, diff --git a/src/3rdparty/wayland/wayland-server.c b/src/3rdparty/wayland/wayland-server.c index 358fa489922..d9f14adf462 100644 --- a/src/3rdparty/wayland/wayland-server.c +++ b/src/3rdparty/wayland/wayland-server.c @@ -84,7 +84,7 @@ struct wl_frame_listener { struct wl_global { struct wl_object *object; - wl_client_connect_func_t func; + wl_global_bind_func_t func; struct wl_list link; }; @@ -113,7 +113,7 @@ wl_client_post_event(struct wl_client *client, struct wl_object *sender, wl_closure_destroy(closure); } -static void +static int wl_client_connection_data(int fd, uint32_t mask, void *data) { struct wl_client *client = data; @@ -133,7 +133,7 @@ wl_client_connection_data(int fd, uint32_t mask, void *data) len = wl_connection_data(connection, cmask); if (len < 0) { wl_client_destroy(client); - return; + return 1; } while (len >= sizeof p) { @@ -185,6 +185,8 @@ wl_client_connection_data(int fd, uint32_t mask, void *data) wl_closure_destroy(closure); } + + return 1; } static int @@ -244,15 +246,7 @@ wl_client_create(struct wl_display *display, int fd) wl_display_post_range(display, client); wl_list_for_each(global, &display->global_list, link) - wl_client_post_event(client, &client->display->object, - WL_DISPLAY_GLOBAL, - global->object, - global->object->interface->name, - global->object->interface->version); - - wl_list_for_each(global, &display->global_list, link) - if (global->func) - global->func(client, global->object); + wl_client_post_global(client, global->object); return client; } @@ -475,6 +469,18 @@ wl_input_device_update_grab(struct wl_input_device *device, return 0; } +static void +display_bind(struct wl_client *client, + struct wl_display *display, uint32_t id, + const char *interface, uint32_t version) +{ + struct wl_global *global; + + wl_list_for_each(global, &display->global_list, link) + if (global->object->id == id && global->func) + global->func(client, global->object, version); +} + static void display_sync(struct wl_client *client, struct wl_display *display, uint32_t key) @@ -518,6 +524,7 @@ display_frame(struct wl_client *client, } struct wl_display_interface display_interface = { + display_bind, display_sync, display_frame }; @@ -598,7 +605,7 @@ wl_display_add_object(struct wl_display *display, struct wl_object *object) WL_EXPORT int wl_display_add_global(struct wl_display *display, - struct wl_object *object, wl_client_connect_func_t func) + struct wl_object *object, wl_global_bind_func_t func) { struct wl_global *global; @@ -610,7 +617,7 @@ wl_display_add_global(struct wl_display *display, global->func = func; wl_list_insert(display->global_list.prev, &global->link); - return 0; + return 0; } WL_EXPORT void @@ -649,7 +656,7 @@ wl_display_run(struct wl_display *display) wl_event_loop_dispatch(display->loop, -1); } -static void +static int socket_data(int fd, uint32_t mask, void *data) { struct wl_display *display = data; @@ -665,6 +672,8 @@ socket_data(int fd, uint32_t mask, void *data) fprintf(stderr, "failed to accept: %m\n"); wl_client_create(display, client_fd); + + return 1; } static int diff --git a/src/3rdparty/wayland/wayland-server.h b/src/3rdparty/wayland/wayland-server.h index 8032866ca88..649bb6b0b4d 100644 --- a/src/3rdparty/wayland/wayland-server.h +++ b/src/3rdparty/wayland/wayland-server.h @@ -38,9 +38,9 @@ enum { struct wl_event_loop; struct wl_event_source; -typedef void (*wl_event_loop_fd_func_t)(int fd, uint32_t mask, void *data); -typedef void (*wl_event_loop_timer_func_t)(void *data); -typedef void (*wl_event_loop_signal_func_t)(int signal_number, void *data); +typedef int (*wl_event_loop_fd_func_t)(int fd, uint32_t mask, void *data); +typedef int (*wl_event_loop_timer_func_t)(void *data); +typedef int (*wl_event_loop_signal_func_t)(int signal_number, void *data); typedef void (*wl_event_loop_idle_func_t)(void *data); struct wl_event_loop *wl_event_loop_create(void); @@ -62,6 +62,7 @@ wl_event_loop_add_signal(struct wl_event_loop *loop, int wl_event_source_timer_update(struct wl_event_source *source, int ms_delay); int wl_event_source_remove(struct wl_event_source *source); +void wl_event_source_check(struct wl_event_source *source); int wl_event_loop_dispatch(struct wl_event_loop *loop, int timeout); @@ -81,11 +82,16 @@ int wl_display_add_socket(struct wl_display *display, const char *name); void wl_display_terminate(struct wl_display *display); void wl_display_run(struct wl_display *display); -void wl_display_add_object(struct wl_display *display, struct wl_object *object); +void wl_display_add_object(struct wl_display *display, + struct wl_object *object); -typedef void (*wl_client_connect_func_t)(struct wl_client *client, struct wl_object *global); +typedef void (*wl_global_bind_func_t)(struct wl_client *client, + struct wl_object *global, + uint32_t version); -int wl_display_add_global(struct wl_display *display, struct wl_object *object, wl_client_connect_func_t func); +int wl_display_add_global(struct wl_display *display, + struct wl_object *object, + wl_global_bind_func_t func); struct wl_client *wl_client_create(struct wl_display *display, int fd); void wl_client_destroy(struct wl_client *client); @@ -96,6 +102,16 @@ struct wl_visual { struct wl_object object; }; +struct wl_shm_callbacks { + void (*buffer_created)(struct wl_buffer *buffer); + + void (*buffer_damaged)(struct wl_buffer *buffer, + int32_t x, int32_t y, + int32_t width, int32_t height); + + void (*buffer_destroyed)(struct wl_buffer *buffer); +}; + struct wl_compositor { struct wl_object object; struct wl_visual argb_visual; @@ -115,10 +131,7 @@ struct wl_buffer { struct wl_compositor *compositor; struct wl_visual *visual; int32_t width, height; - void (*attach)(struct wl_buffer *buffer, struct wl_surface *surface); - void (*damage)(struct wl_buffer *buffer, - struct wl_surface *surface, - int32_t x, int32_t y, int32_t width, int32_t height); + void *user_data; }; struct wl_listener { @@ -133,10 +146,6 @@ struct wl_surface { struct wl_list destroy_listener_list; }; -struct wl_shell { - struct wl_object object; -}; - struct wl_grab; struct wl_grab_interface { void (*motion)(struct wl_grab *grab, @@ -255,6 +264,29 @@ wl_input_device_update_grab(struct wl_input_device *device, struct wl_grab *grab, struct wl_surface *surface, uint32_t time); +struct wl_shm; + +void * +wl_shm_buffer_get_data(struct wl_buffer *buffer); + +int32_t +wl_shm_buffer_get_stride(struct wl_buffer *buffer); + +struct wl_buffer * +wl_shm_buffer_create(struct wl_shm *shm, int width, int height, + int stride, struct wl_visual *visual, + void *data); + +int +wl_buffer_is_shm(struct wl_buffer *buffer); + +struct wl_shm * +wl_shm_init(struct wl_display *display, + const struct wl_shm_callbacks *callbacks); + +void +wl_shm_finish(struct wl_shm *shm); + int wl_compositor_init(struct wl_compositor *compositor, const struct wl_compositor_interface *interface, diff --git a/src/3rdparty/wayland/wayland-shm.c b/src/3rdparty/wayland/wayland-shm.c new file mode 100644 index 00000000000..5f46293fc29 --- /dev/null +++ b/src/3rdparty/wayland/wayland-shm.c @@ -0,0 +1,228 @@ +/* + * Copyright © 2008 Kristian Høgsberg + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that copyright + * notice and this permission notice appear in supporting documentation, and + * that the name of the copyright holders not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. The copyright holders make no representations + * about the suitability of this software for any purpose. It is provided "as + * is" without express or implied warranty. + * + * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THIS SOFTWARE. + * + * Authors: + * Kristian Høgsberg + * Benjamin Franzke + * + */ + +#include +#include +#include +#include +#include + +#include "wayland-server.h" + +struct wl_shm { + struct wl_object object; + const struct wl_shm_callbacks *callbacks; +}; + +struct wl_shm_buffer { + struct wl_buffer buffer; + struct wl_shm *shm; + int32_t stride; + void *data; +}; + +static void +destroy_buffer(struct wl_resource *resource, struct wl_client *client) +{ + struct wl_shm_buffer *buffer = + container_of(resource, struct wl_shm_buffer, buffer.resource); + + munmap(buffer->data, buffer->stride * buffer->buffer.height); + + buffer->shm->callbacks->buffer_destroyed(&buffer->buffer); + + free(buffer); +} + +static void +shm_buffer_damage(struct wl_client *client, struct wl_buffer *buffer_base, + int32_t x, int32_t y, int32_t width, int32_t height) +{ + struct wl_shm_buffer *buffer = (struct wl_shm_buffer *) buffer_base; + + buffer->shm->callbacks->buffer_damaged(buffer_base, x, y, + width, height); +} + +static void +shm_buffer_destroy(struct wl_client *client, struct wl_buffer *buffer) +{ + wl_resource_destroy(&buffer->resource, client); +} + +const static struct wl_buffer_interface shm_buffer_interface = { + shm_buffer_damage, + shm_buffer_destroy +}; + +static struct wl_shm_buffer * +wl_shm_buffer_init(struct wl_shm *shm, uint32_t id, + int32_t width, int32_t height, + int32_t stride, struct wl_visual *visual, + void *data) +{ + struct wl_shm_buffer *buffer; + + buffer = malloc(sizeof *buffer); + if (buffer == NULL) + return NULL; + + buffer->buffer.width = width; + buffer->buffer.height = height; + buffer->buffer.visual = visual; + buffer->stride = stride; + buffer->data = data; + + buffer->buffer.resource.object.id = id; + buffer->buffer.resource.object.interface = &wl_buffer_interface; + buffer->buffer.resource.object.implementation = (void (**)(void)) + &shm_buffer_interface; + + buffer->buffer.resource.destroy = destroy_buffer; + + buffer->shm = shm; + + buffer->shm->callbacks->buffer_created(&buffer->buffer); + + return buffer; +} + +static void +shm_create_buffer(struct wl_client *client, struct wl_shm *shm, + uint32_t id, int fd, int32_t width, int32_t height, + uint32_t stride, struct wl_visual *visual) +{ + struct wl_shm_buffer *buffer; + struct wl_display *display = wl_client_get_display(client); + + void *data; + + /* FIXME: Define a real exception event instead of abusing the + * display.invalid_object error */ + if (visual->object.interface != &wl_visual_interface) { + wl_client_post_event(client, (struct wl_object *) display, + WL_DISPLAY_INVALID_OBJECT, 0); + fprintf(stderr, "invalid visual in create_buffer\n"); + close(fd); + return; + } + + if (width < 0 || height < 0 || stride < width) { + wl_client_post_event(client, (struct wl_object *) display, + WL_DISPLAY_INVALID_OBJECT, 0); + fprintf(stderr, + "invalid width, height or stride in create_buffer\n"); + close(fd); + return; + } + + data = mmap(NULL, stride * height, + PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); + + close(fd); + if (data == MAP_FAILED) { + /* FIXME: Define a real exception event instead of + * abusing this one */ + wl_client_post_event(client, (struct wl_object *) display, + WL_DISPLAY_INVALID_OBJECT, 0); + fprintf(stderr, "failed to create image for fd %d\n", fd); + return; + } + + buffer = wl_shm_buffer_init(shm, id, + width, height, stride, visual, + data); + if (buffer == NULL) { + munmap(data, stride * height); + wl_client_post_no_memory(client); + return; + } + + wl_client_add_resource(client, &buffer->buffer.resource); +} + +const static struct wl_shm_interface shm_interface = { + shm_create_buffer +}; + + +WL_EXPORT struct wl_shm * +wl_shm_init(struct wl_display *display, + const struct wl_shm_callbacks *callbacks) +{ + struct wl_shm *shm; + + shm = malloc(sizeof *shm); + if (!shm) + return NULL; + + shm->object.interface = &wl_shm_interface; + shm->object.implementation = (void (**)(void)) &shm_interface; + wl_display_add_object(display, &shm->object); + wl_display_add_global(display, &shm->object, NULL); + + shm->callbacks = callbacks; + + return shm; +} + +WL_EXPORT void +wl_shm_finish(struct wl_shm *shm) +{ + /* FIXME: add wl_display_del_{object,global} */ + + free(shm); +} + +WL_EXPORT int +wl_buffer_is_shm(struct wl_buffer *buffer) +{ + return buffer->resource.object.implementation == + (void (**)(void)) &shm_buffer_interface; +} + +WL_EXPORT int32_t +wl_shm_buffer_get_stride(struct wl_buffer *buffer_base) +{ + struct wl_shm_buffer *buffer = (struct wl_shm_buffer *) buffer_base; + + if (!wl_buffer_is_shm(buffer_base)) + return 0; + + return buffer->stride; +} + +WL_EXPORT void * +wl_shm_buffer_get_data(struct wl_buffer *buffer_base) +{ + struct wl_shm_buffer *buffer = (struct wl_shm_buffer *) buffer_base; + + if (!wl_buffer_is_shm(buffer_base)) + return NULL; + + return buffer->data; +} From 19262dae332b981ec393a2394046ed02c205a8c0 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Wed, 11 May 2011 14:14:44 +0200 Subject: [PATCH 0009/1507] Remove Wayland copy, now that we have wayland_sha1.txt --- src/3rdparty/wayland/client/client.pro | 16 - src/3rdparty/wayland/connection.c | 731 --------------- src/3rdparty/wayland/connection.h | 68 -- src/3rdparty/wayland/event-loop.c | 466 ---------- src/3rdparty/wayland/server/server.pro | 18 - src/3rdparty/wayland/shared.pri | 16 - .../wayland/wayland-client-protocol.h | 867 ------------------ src/3rdparty/wayland/wayland-client.c | 619 ------------- src/3rdparty/wayland/wayland-client.h | 97 -- src/3rdparty/wayland/wayland-egl.h | 68 -- src/3rdparty/wayland/wayland-hash.c | 296 ------ src/3rdparty/wayland/wayland-protocol.c | 214 ----- .../wayland/wayland-server-protocol.h | 258 ------ src/3rdparty/wayland/wayland-server.c | 826 ----------------- src/3rdparty/wayland/wayland-server.h | 299 ------ src/3rdparty/wayland/wayland-shm.c | 228 ----- src/3rdparty/wayland/wayland-util.c | 123 --- src/3rdparty/wayland/wayland-util.h | 157 ---- src/3rdparty/wayland/wayland.pro | 3 - 19 files changed, 5370 deletions(-) delete mode 100644 src/3rdparty/wayland/client/client.pro delete mode 100644 src/3rdparty/wayland/connection.c delete mode 100644 src/3rdparty/wayland/connection.h delete mode 100644 src/3rdparty/wayland/event-loop.c delete mode 100644 src/3rdparty/wayland/server/server.pro delete mode 100644 src/3rdparty/wayland/shared.pri delete mode 100644 src/3rdparty/wayland/wayland-client-protocol.h delete mode 100644 src/3rdparty/wayland/wayland-client.c delete mode 100644 src/3rdparty/wayland/wayland-client.h delete mode 100644 src/3rdparty/wayland/wayland-egl.h delete mode 100644 src/3rdparty/wayland/wayland-hash.c delete mode 100644 src/3rdparty/wayland/wayland-protocol.c delete mode 100644 src/3rdparty/wayland/wayland-server-protocol.h delete mode 100644 src/3rdparty/wayland/wayland-server.c delete mode 100644 src/3rdparty/wayland/wayland-server.h delete mode 100644 src/3rdparty/wayland/wayland-shm.c delete mode 100644 src/3rdparty/wayland/wayland-util.c delete mode 100644 src/3rdparty/wayland/wayland-util.h delete mode 100644 src/3rdparty/wayland/wayland.pro diff --git a/src/3rdparty/wayland/client/client.pro b/src/3rdparty/wayland/client/client.pro deleted file mode 100644 index c2c5eccce38..00000000000 --- a/src/3rdparty/wayland/client/client.pro +++ /dev/null @@ -1,16 +0,0 @@ -TEMPLATE = lib -TARGET = wayland-client - -CONFIG -= qt -CONFIG += shared -CONFIG += use_pkgconfig - -include(../shared.pri) - -SOURCES = ../wayland-client.c \ - ../wayland-protocol.c \ - ../connection.c \ - ../wayland-util.c \ - ../wayland-hash.c - -OBJECTS_DIR = .obj diff --git a/src/3rdparty/wayland/connection.c b/src/3rdparty/wayland/connection.c deleted file mode 100644 index 0d705b5d255..00000000000 --- a/src/3rdparty/wayland/connection.c +++ /dev/null @@ -1,731 +0,0 @@ -/* - * Copyright © 2008 Kristian Høgsberg - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting documentation, and - * that the name of the copyright holders not be used in advertising or - * publicity pertaining to distribution of the software without specific, - * written prior permission. The copyright holders make no representations - * about the suitability of this software for any purpose. It is provided "as - * is" without express or implied warranty. - * - * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "wayland-util.h" -#include "connection.h" - -#define ARRAY_LENGTH(a) (sizeof (a) / sizeof (a)[0]) - -struct wl_buffer { - char data[4096]; - int head, tail; -}; - -#define MASK(i) ((i) & 4095) - -struct wl_closure { - int count; - const struct wl_message *message; - ffi_type *types[20]; - ffi_cif cif; - void *args[20]; - uint32_t buffer[64]; - uint32_t *start; -}; - -struct wl_connection { - struct wl_buffer in, out; - struct wl_buffer fds_in, fds_out; - int fd; - void *data; - wl_connection_update_func_t update; - struct wl_closure receive_closure, send_closure; -}; - -union wl_value { - uint32_t uint32; - char *string; - struct wl_object *object; - uint32_t new_id; - struct wl_array *array; -}; - -static void -wl_buffer_put(struct wl_buffer *b, const void *data, size_t count) -{ - int head, size; - - head = MASK(b->head); - if (head + count <= sizeof b->data) { - memcpy(b->data + head, data, count); - } else { - size = sizeof b->data - head; - memcpy(b->data + head, data, size); - memcpy(b->data, (const char *) data + size, count - size); - } - - b->head += count; -} - -static void -wl_buffer_put_iov(struct wl_buffer *b, struct iovec *iov, int *count) -{ - int head, tail; - - head = MASK(b->head); - tail = MASK(b->tail); - if (head < tail) { - iov[0].iov_base = b->data + head; - iov[0].iov_len = tail - head; - *count = 1; - } else if (tail == 0) { - iov[0].iov_base = b->data + head; - iov[0].iov_len = sizeof b->data - head; - *count = 1; - } else { - iov[0].iov_base = b->data + head; - iov[0].iov_len = sizeof b->data - head; - iov[1].iov_base = b->data; - iov[1].iov_len = tail; - *count = 2; - } -} - -static void -wl_buffer_get_iov(struct wl_buffer *b, struct iovec *iov, int *count) -{ - int head, tail; - - head = MASK(b->head); - tail = MASK(b->tail); - if (tail < head) { - iov[0].iov_base = b->data + tail; - iov[0].iov_len = head - tail; - *count = 1; - } else if (head == 0) { - iov[0].iov_base = b->data + tail; - iov[0].iov_len = sizeof b->data - tail; - *count = 1; - } else { - iov[0].iov_base = b->data + tail; - iov[0].iov_len = sizeof b->data - tail; - iov[1].iov_base = b->data; - iov[1].iov_len = head; - *count = 2; - } -} - -static void -wl_buffer_copy(struct wl_buffer *b, void *data, size_t count) -{ - int tail, size; - - tail = MASK(b->tail); - if (tail + count <= sizeof b->data) { - memcpy(data, b->data + tail, count); - } else { - size = sizeof b->data - tail; - memcpy(data, b->data + tail, size); - memcpy((char *) data + size, b->data, count - size); - } -} - -struct wl_connection * -wl_connection_create(int fd, - wl_connection_update_func_t update, - void *data) -{ - struct wl_connection *connection; - - connection = malloc(sizeof *connection); - if (connection == NULL) - return NULL; - memset(connection, 0, sizeof *connection); - connection->fd = fd; - connection->update = update; - connection->data = data; - - connection->update(connection, - WL_CONNECTION_READABLE, - connection->data); - - return connection; -} - -void -wl_connection_destroy(struct wl_connection *connection) -{ - close(connection->fd); - free(connection); -} - -void -wl_connection_copy(struct wl_connection *connection, void *data, size_t size) -{ - wl_buffer_copy(&connection->in, data, size); -} - -void -wl_connection_consume(struct wl_connection *connection, size_t size) -{ - connection->in.tail += size; -} - -static void -build_cmsg(struct wl_buffer *buffer, char *data, int *clen) -{ - struct cmsghdr *cmsg; - size_t size; - - size = buffer->head - buffer->tail; - if (size > 0) { - cmsg = (struct cmsghdr *) data; - cmsg->cmsg_level = SOL_SOCKET; - cmsg->cmsg_type = SCM_RIGHTS; - cmsg->cmsg_len = CMSG_LEN(size); - wl_buffer_copy(buffer, CMSG_DATA(cmsg), size); - *clen = cmsg->cmsg_len; - } else { - *clen = 0; - } -} - -static void -close_fds(struct wl_buffer *buffer) -{ - int fds[32], i, count; - size_t size; - - size = buffer->head - buffer->tail; - if (size == 0) - return; - - wl_buffer_copy(buffer, fds, size); - count = size / sizeof fds[0]; - for (i = 0; i < count; i++) - close(fds[i]); - buffer->tail += size; -} - -static void -decode_cmsg(struct wl_buffer *buffer, struct msghdr *msg) -{ - struct cmsghdr *cmsg; - size_t size; - - for (cmsg = CMSG_FIRSTHDR(msg); cmsg != NULL; - cmsg = CMSG_NXTHDR(msg, cmsg)) { - if (cmsg->cmsg_level == SOL_SOCKET && - cmsg->cmsg_type == SCM_RIGHTS) { - size = cmsg->cmsg_len - CMSG_LEN(0); - wl_buffer_put(buffer, CMSG_DATA(cmsg), size); - } - } -} - -int -wl_connection_data(struct wl_connection *connection, uint32_t mask) -{ - struct iovec iov[2]; - struct msghdr msg; - char cmsg[128]; - int len, count, clen; - - if (mask & WL_CONNECTION_WRITABLE) { - wl_buffer_get_iov(&connection->out, iov, &count); - - build_cmsg(&connection->fds_out, cmsg, &clen); - - msg.msg_name = NULL; - msg.msg_namelen = 0; - msg.msg_iov = iov; - msg.msg_iovlen = count; - msg.msg_control = cmsg; - msg.msg_controllen = clen; - msg.msg_flags = 0; - - do { - len = sendmsg(connection->fd, &msg, MSG_NOSIGNAL); - } while (len < 0 && errno == EINTR); - - if (len == -1 && errno == EPIPE) { - return -1; - } else if (len < 0) { - fprintf(stderr, - "write error for connection %p, fd %d: %m\n", - connection, connection->fd); - return -1; - } - - close_fds(&connection->fds_out); - - connection->out.tail += len; - if (connection->out.tail == connection->out.head) - connection->update(connection, - WL_CONNECTION_READABLE, - connection->data); - } - - if (mask & WL_CONNECTION_READABLE) { - wl_buffer_put_iov(&connection->in, iov, &count); - - msg.msg_name = NULL; - msg.msg_namelen = 0; - msg.msg_iov = iov; - msg.msg_iovlen = count; - msg.msg_control = cmsg; - msg.msg_controllen = sizeof cmsg; - msg.msg_flags = 0; - - do { - len = recvmsg(connection->fd, &msg, 0); - } while (len < 0 && errno == EINTR); - - if (len < 0) { - fprintf(stderr, - "read error from connection %p: %m (%d)\n", - connection, errno); - return -1; - } else if (len == 0) { - /* FIXME: Handle this better? */ - return -1; - } - - decode_cmsg(&connection->fds_in, &msg); - - connection->in.head += len; - } - - return connection->in.head - connection->in.tail; -} - -void -wl_connection_write(struct wl_connection *connection, - const void *data, size_t count) -{ - wl_buffer_put(&connection->out, data, count); - - if (connection->out.head - connection->out.tail == count) - connection->update(connection, - WL_CONNECTION_READABLE | - WL_CONNECTION_WRITABLE, - connection->data); -} - -static int -wl_message_size_extra(const struct wl_message *message) -{ - int i, extra; - - for (i = 0, extra = 0; message->signature[i]; i++) { - - switch (message->signature[i]) { - case 's': - case 'o': - extra += sizeof (void *); - break; - case 'a': - extra += sizeof (void *) + sizeof (struct wl_array); - break; - case 'h': - extra += sizeof (uint32_t); - break; - default: - break; - } - } - - return extra; -} - -struct wl_closure * -wl_connection_vmarshal(struct wl_connection *connection, - struct wl_object *sender, - uint32_t opcode, va_list ap, - const struct wl_message *message) -{ - struct wl_closure *closure = &connection->send_closure; - struct wl_object **objectp, *object; - uint32_t length, *p, *start, size; - int dup_fd; - struct wl_array **arrayp, *array; - const char **sp, *s; - char *extra; - int i, count, fd, extra_size, *fd_ptr; - - extra_size = wl_message_size_extra(message); - count = strlen(message->signature) + 2; - extra = (char *) closure->buffer; - start = &closure->buffer[DIV_ROUNDUP(extra_size, sizeof *p)]; - p = &start[2]; - for (i = 2; i < count; i++) { - switch (message->signature[i - 2]) { - case 'u': - closure->types[i] = &ffi_type_uint32; - closure->args[i] = p; - *p++ = va_arg(ap, uint32_t); - break; - case 'i': - closure->types[i] = &ffi_type_sint32; - closure->args[i] = p; - *p++ = va_arg(ap, int32_t); - break; - case 's': - closure->types[i] = &ffi_type_pointer; - closure->args[i] = extra; - sp = (const char **) extra; - extra += sizeof *sp; - - s = va_arg(ap, const char *); - length = s ? strlen(s) + 1: 0; - *p++ = length; - - if (length > 0) - *sp = (const char *) p; - else - *sp = NULL; - - memcpy(p, s, length); - p += DIV_ROUNDUP(length, sizeof *p); - break; - case 'o': - closure->types[i] = &ffi_type_pointer; - closure->args[i] = extra; - objectp = (struct wl_object **) extra; - extra += sizeof *objectp; - - object = va_arg(ap, struct wl_object *); - *objectp = object; - *p++ = object ? object->id : 0; - break; - - case 'n': - closure->types[i] = &ffi_type_uint32; - closure->args[i] = p; - object = va_arg(ap, struct wl_object *); - *p++ = object->id; - break; - - case 'a': - closure->types[i] = &ffi_type_pointer; - closure->args[i] = extra; - arrayp = (struct wl_array **) extra; - extra += sizeof *arrayp; - - *arrayp = (struct wl_array *) extra; - extra += sizeof **arrayp; - - array = va_arg(ap, struct wl_array *); - if (array == NULL || array->size == 0) { - *p++ = 0; - break; - } - *p++ = array->size; - memcpy(p, array->data, array->size); - - (*arrayp)->size = array->size; - (*arrayp)->alloc = array->alloc; - (*arrayp)->data = p; - - p += DIV_ROUNDUP(array->size, sizeof *p); - break; - - case 'h': - closure->types[i] = &ffi_type_sint; - closure->args[i] = extra; - fd_ptr = (int *) extra; - extra += sizeof *fd_ptr; - - fd = va_arg(ap, int); - dup_fd = dup(fd); - if (dup_fd < 0) { - fprintf(stderr, "dup failed: %m"); - abort(); - } - *fd_ptr = dup_fd; - wl_buffer_put(&connection->fds_out, - &dup_fd, sizeof dup_fd); - break; - default: - assert(0); - break; - } - } - - size = (p - start) * sizeof *p; - start[0] = sender->id; - start[1] = opcode | (size << 16); - - closure->start = start; - closure->message = message; - closure->count = count; - - return closure; -} - -struct wl_closure * -wl_connection_demarshal(struct wl_connection *connection, - uint32_t size, - struct wl_hash_table *objects, - const struct wl_message *message) -{ - uint32_t *p, *next, *end, length; - int *fd; - char *extra, **s; - int i, count, extra_space; - struct wl_object **object; - struct wl_array **array; - struct wl_closure *closure = &connection->receive_closure; - - count = strlen(message->signature) + 2; - if (count > ARRAY_LENGTH(closure->types)) { - printf("too many args (%d)\n", count); - assert(0); - } - - extra_space = wl_message_size_extra(message); - if (sizeof closure->buffer < size + extra_space) { - printf("request too big, should malloc tmp buffer here\n"); - assert(0); - } - - closure->message = message; - closure->types[0] = &ffi_type_pointer; - closure->types[1] = &ffi_type_pointer; - - wl_connection_copy(connection, closure->buffer, size); - p = &closure->buffer[2]; - end = (uint32_t *) ((char *) (p + size)); - extra = (char *) end; - for (i = 2; i < count; i++) { - if (p + 1 > end) { - printf("message too short, " - "object (%d), message %s(%s)\n", - *p, message->name, message->signature); - errno = EINVAL; - goto err; - } - - switch (message->signature[i - 2]) { - case 'u': - closure->types[i] = &ffi_type_uint32; - closure->args[i] = p++; - break; - case 'i': - closure->types[i] = &ffi_type_sint32; - closure->args[i] = p++; - break; - case 's': - closure->types[i] = &ffi_type_pointer; - length = *p++; - - next = p + DIV_ROUNDUP(length, sizeof *p); - if (next > end) { - printf("message too short, " - "object (%d), message %s(%s)\n", - *p, message->name, message->signature); - errno = EINVAL; - goto err; - } - - s = (char **) extra; - extra += sizeof *s; - closure->args[i] = s; - - if (length == 0) { - *s = NULL; - } else { - *s = (char *) p; - } - - if (length > 0 && (*s)[length - 1] != '\0') { - printf("string not nul-terminated, " - "message %s(%s)\n", - message->name, message->signature); - errno = EINVAL; - goto err; - } - p = next; - break; - case 'o': - closure->types[i] = &ffi_type_pointer; - object = (struct wl_object **) extra; - extra += sizeof *object; - closure->args[i] = object; - - *object = wl_hash_table_lookup(objects, *p); - if (*object == NULL && *p != 0) { - printf("unknown object (%d), message %s(%s)\n", - *p, message->name, message->signature); - errno = EINVAL; - goto err; - } - - p++; - break; - case 'n': - closure->types[i] = &ffi_type_uint32; - closure->args[i] = p; - object = wl_hash_table_lookup(objects, *p); - if (object != NULL) { - printf("not a new object (%d), " - "message %s(%s)\n", - *p, message->name, message->signature); - errno = EINVAL; - goto err; - } - p++; - break; - case 'a': - closure->types[i] = &ffi_type_pointer; - length = *p++; - - next = p + DIV_ROUNDUP(length, sizeof *p); - if (next > end) { - printf("message too short, " - "object (%d), message %s(%s)\n", - *p, message->name, message->signature); - errno = EINVAL; - goto err; - } - - array = (struct wl_array **) extra; - extra += sizeof *array; - closure->args[i] = array; - - *array = (struct wl_array *) extra; - extra += sizeof **array; - - (*array)->size = length; - (*array)->alloc = 0; - (*array)->data = p; - p = next; - break; - case 'h': - closure->types[i] = &ffi_type_sint; - - fd = (int *) extra; - extra += sizeof *fd; - closure->args[i] = fd; - - wl_buffer_copy(&connection->fds_in, fd, sizeof *fd); - connection->fds_in.tail += sizeof *fd; - break; - default: - printf("unknown type\n"); - assert(0); - break; - } - } - - closure->count = i; - ffi_prep_cif(&closure->cif, FFI_DEFAULT_ABI, - closure->count, &ffi_type_uint32, closure->types); - - wl_connection_consume(connection, size); - - return closure; - - err: - closure->count = i; - wl_closure_destroy(closure); - wl_connection_consume(connection, size); - - return NULL; -} - -void -wl_closure_invoke(struct wl_closure *closure, - struct wl_object *target, void (*func)(void), void *data) -{ - int result; - - closure->args[0] = &data; - closure->args[1] = ⌖ - - ffi_call(&closure->cif, func, &result, closure->args); -} - -void -wl_closure_send(struct wl_closure *closure, struct wl_connection *connection) -{ - uint32_t size; - - size = closure->start[1] >> 16; - wl_connection_write(connection, closure->start, size); -} - -void -wl_closure_print(struct wl_closure *closure, struct wl_object *target) -{ - union wl_value *value; - int i; - - fprintf(stderr, "%s@%d.%s(", - target->interface->name, target->id, - closure->message->name); - - for (i = 2; i < closure->count; i++) { - if (i > 2) - fprintf(stderr, ", "); - - value = closure->args[i]; - switch (closure->message->signature[i - 2]) { - case 'u': - fprintf(stderr, "%u", value->uint32); - break; - case 'i': - fprintf(stderr, "%d", value->uint32); - break; - case 's': - fprintf(stderr, "\"%s\"", value->string); - break; - case 'o': - if (value->object) - fprintf(stderr, "%s@%u", - value->object->interface->name, - value->object->id); - else - fprintf(stderr, "nil"); - break; - case 'n': - fprintf(stderr, "new id %u", value->uint32); - break; - case 'a': - fprintf(stderr, "array"); - break; - case 'h': - fprintf(stderr, "fd %d", value->uint32); - break; - } - } - - fprintf(stderr, ")\n"); -} - -void -wl_closure_destroy(struct wl_closure *closure) -{ -} diff --git a/src/3rdparty/wayland/connection.h b/src/3rdparty/wayland/connection.h deleted file mode 100644 index 413977dffe9..00000000000 --- a/src/3rdparty/wayland/connection.h +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright © 2008 Kristian Høgsberg - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting documentation, and - * that the name of the copyright holders not be used in advertising or - * publicity pertaining to distribution of the software without specific, - * written prior permission. The copyright holders make no representations - * about the suitability of this software for any purpose. It is provided "as - * is" without express or implied warranty. - * - * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#ifndef _CONNECTION_H_ -#define _CONNECTION_H_ - -#include -#include "wayland-util.h" - -struct wl_connection; -struct wl_closure; - -#define WL_CONNECTION_READABLE 0x01 -#define WL_CONNECTION_WRITABLE 0x02 - -typedef int (*wl_connection_update_func_t)(struct wl_connection *connection, - uint32_t mask, void *data); - -struct wl_connection *wl_connection_create(int fd, - wl_connection_update_func_t update, - void *data); -void wl_connection_destroy(struct wl_connection *connection); -void wl_connection_copy(struct wl_connection *connection, void *data, size_t size); -void wl_connection_consume(struct wl_connection *connection, size_t size); -int wl_connection_data(struct wl_connection *connection, uint32_t mask); -void wl_connection_write(struct wl_connection *connection, const void *data, size_t count); - -struct wl_closure * -wl_connection_vmarshal(struct wl_connection *connection, - struct wl_object *sender, - uint32_t opcode, va_list ap, - const struct wl_message *message); - -struct wl_closure * -wl_connection_demarshal(struct wl_connection *connection, - uint32_t size, - struct wl_hash_table *objects, - const struct wl_message *message); -void -wl_closure_invoke(struct wl_closure *closure, - struct wl_object *target, void (*func)(void), void *data); -void -wl_closure_send(struct wl_closure *closure, struct wl_connection *connection); -void -wl_closure_print(struct wl_closure *closure, struct wl_object *target); -void -wl_closure_destroy(struct wl_closure *closure); - -#endif diff --git a/src/3rdparty/wayland/event-loop.c b/src/3rdparty/wayland/event-loop.c deleted file mode 100644 index 0f41034b403..00000000000 --- a/src/3rdparty/wayland/event-loop.c +++ /dev/null @@ -1,466 +0,0 @@ -/* - * Copyright © 2008 Kristian Høgsberg - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting documentation, and - * that the name of the copyright holders not be used in advertising or - * publicity pertaining to distribution of the software without specific, - * written prior permission. The copyright holders make no representations - * about the suitability of this software for any purpose. It is provided "as - * is" without express or implied warranty. - * - * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "wayland-server.h" - -struct wl_event_loop { - int epoll_fd; - struct wl_list check_list; -}; - -struct wl_event_source_interface { - int (*dispatch)(struct wl_event_source *source, - struct epoll_event *ep); - int (*remove)(struct wl_event_source *source); -}; - -struct wl_event_source { - struct wl_event_source_interface *interface; - struct wl_event_loop *loop; - struct wl_list link; - void *data; -}; - -struct wl_event_source_fd { - struct wl_event_source base; - int fd; - wl_event_loop_fd_func_t func; -}; - -static int -wl_event_source_fd_dispatch(struct wl_event_source *source, - struct epoll_event *ep) -{ - struct wl_event_source_fd *fd_source = (struct wl_event_source_fd *) source; - uint32_t mask; - - mask = 0; - if (ep->events & EPOLLIN) - mask |= WL_EVENT_READABLE; - if (ep->events & EPOLLOUT) - mask |= WL_EVENT_WRITEABLE; - - return fd_source->func(fd_source->fd, mask, fd_source->base.data); -} - -static int -wl_event_source_fd_remove(struct wl_event_source *source) -{ - struct wl_event_source_fd *fd_source = - (struct wl_event_source_fd *) source; - struct wl_event_loop *loop = source->loop; - int fd; - - fd = fd_source->fd; - free(source); - - return epoll_ctl(loop->epoll_fd, EPOLL_CTL_DEL, fd, NULL); -} - -struct wl_event_source_interface fd_source_interface = { - wl_event_source_fd_dispatch, - wl_event_source_fd_remove -}; - -WL_EXPORT struct wl_event_source * -wl_event_loop_add_fd(struct wl_event_loop *loop, - int fd, uint32_t mask, - wl_event_loop_fd_func_t func, - void *data) -{ - struct wl_event_source_fd *source; - struct epoll_event ep; - - source = malloc(sizeof *source); - if (source == NULL) - return NULL; - - source->base.interface = &fd_source_interface; - source->base.loop = loop; - wl_list_init(&source->base.link); - source->fd = fd; - source->func = func; - source->base.data = data; - - memset(&ep, 0, sizeof ep); - if (mask & WL_EVENT_READABLE) - ep.events |= EPOLLIN; - if (mask & WL_EVENT_WRITEABLE) - ep.events |= EPOLLOUT; - ep.data.ptr = source; - - if (epoll_ctl(loop->epoll_fd, EPOLL_CTL_ADD, fd, &ep) < 0) { - free(source); - return NULL; - } - - return &source->base; -} - -WL_EXPORT int -wl_event_source_fd_update(struct wl_event_source *source, uint32_t mask) -{ - struct wl_event_source_fd *fd_source = - (struct wl_event_source_fd *) source; - struct wl_event_loop *loop = source->loop; - struct epoll_event ep; - - memset(&ep, 0, sizeof ep); - if (mask & WL_EVENT_READABLE) - ep.events |= EPOLLIN; - if (mask & WL_EVENT_WRITEABLE) - ep.events |= EPOLLOUT; - ep.data.ptr = source; - - return epoll_ctl(loop->epoll_fd, - EPOLL_CTL_MOD, fd_source->fd, &ep); -} - -struct wl_event_source_timer { - struct wl_event_source base; - int fd; - wl_event_loop_timer_func_t func; -}; - -static int -wl_event_source_timer_dispatch(struct wl_event_source *source, - struct epoll_event *ep) -{ - struct wl_event_source_timer *timer_source = - (struct wl_event_source_timer *) source; - uint64_t expires; - - read(timer_source->fd, &expires, sizeof expires); - - return timer_source->func(timer_source->base.data); -} - -static int -wl_event_source_timer_remove(struct wl_event_source *source) -{ - struct wl_event_source_timer *timer_source = - (struct wl_event_source_timer *) source; - - close(timer_source->fd); - free(source); - return 0; -} - -struct wl_event_source_interface timer_source_interface = { - wl_event_source_timer_dispatch, - wl_event_source_timer_remove -}; - -WL_EXPORT struct wl_event_source * -wl_event_loop_add_timer(struct wl_event_loop *loop, - wl_event_loop_timer_func_t func, - void *data) -{ - struct wl_event_source_timer *source; - struct epoll_event ep; - - source = malloc(sizeof *source); - if (source == NULL) - return NULL; - - source->base.interface = &timer_source_interface; - source->base.loop = loop; - wl_list_init(&source->base.link); - - source->fd = timerfd_create(CLOCK_MONOTONIC, TFD_CLOEXEC); - if (source->fd < 0) { - fprintf(stderr, "could not create timerfd\n: %m"); - free(source); - return NULL; - } - - source->func = func; - source->base.data = data; - - memset(&ep, 0, sizeof ep); - ep.events = EPOLLIN; - ep.data.ptr = source; - - if (epoll_ctl(loop->epoll_fd, EPOLL_CTL_ADD, source->fd, &ep) < 0) { - close(source->fd); - free(source); - return NULL; - } - - return &source->base; -} - -WL_EXPORT int -wl_event_source_timer_update(struct wl_event_source *source, int ms_delay) -{ - struct wl_event_source_timer *timer_source = - (struct wl_event_source_timer *) source; - struct itimerspec its; - - its.it_interval.tv_sec = 0; - its.it_interval.tv_nsec = 0; - its.it_value.tv_sec = ms_delay / 1000; - its.it_value.tv_nsec = (ms_delay % 1000) * 1000 * 1000; - if (timerfd_settime(timer_source->fd, 0, &its, NULL) < 0) { - fprintf(stderr, "could not set timerfd\n: %m"); - return -1; - } - - return 0; -} - -struct wl_event_source_signal { - struct wl_event_source base; - int fd; - int signal_number; - wl_event_loop_signal_func_t func; -}; - -static int -wl_event_source_signal_dispatch(struct wl_event_source *source, - struct epoll_event *ep) -{ - struct wl_event_source_signal *signal_source = - (struct wl_event_source_signal *) source; - struct signalfd_siginfo signal_info; - - read(signal_source->fd, &signal_info, sizeof signal_info); - - return signal_source->func(signal_source->signal_number, - signal_source->base.data); -} - -static int -wl_event_source_signal_remove(struct wl_event_source *source) -{ - struct wl_event_source_signal *signal_source = - (struct wl_event_source_signal *) source; - - close(signal_source->fd); - free(source); - return 0; -} - -struct wl_event_source_interface signal_source_interface = { - wl_event_source_signal_dispatch, - wl_event_source_signal_remove -}; - -WL_EXPORT struct wl_event_source * -wl_event_loop_add_signal(struct wl_event_loop *loop, - int signal_number, - wl_event_loop_signal_func_t func, - void *data) -{ - struct wl_event_source_signal *source; - struct epoll_event ep; - sigset_t mask; - - source = malloc(sizeof *source); - if (source == NULL) - return NULL; - - source->base.interface = &signal_source_interface; - source->base.loop = loop; - wl_list_init(&source->base.link); - source->signal_number = signal_number; - - sigemptyset(&mask); - sigaddset(&mask, signal_number); - source->fd = signalfd(-1, &mask, SFD_CLOEXEC); - if (source->fd < 0) { - fprintf(stderr, "could not create fd to watch signal\n: %m"); - free(source); - return NULL; - } - sigprocmask(SIG_BLOCK, &mask, NULL); - - source->func = func; - source->base.data = data; - - memset(&ep, 0, sizeof ep); - ep.events = EPOLLIN; - ep.data.ptr = source; - - if (epoll_ctl(loop->epoll_fd, EPOLL_CTL_ADD, source->fd, &ep) < 0) { - close(source->fd); - free(source); - return NULL; - } - - return &source->base; -} - -struct wl_event_source_idle { - struct wl_event_source base; - wl_event_loop_idle_func_t func; -}; - -static int -wl_event_source_idle_dispatch(struct wl_event_source *source, - struct epoll_event *ep) -{ - struct wl_event_source_idle *idle_source = - (struct wl_event_source_idle *) source; - - idle_source->func(idle_source->base.data); - wl_event_source_remove(&idle_source->base); - - return 1; -} - -static int -wl_event_source_idle_remove(struct wl_event_source *source) -{ - struct wl_event_source_idle *idle_source = - (struct wl_event_source_idle *) source; - - wl_list_remove(&idle_source->base.link); - free(source); - - return 0; -} - -struct wl_event_source_interface idle_source_interface = { - wl_event_source_idle_dispatch, - wl_event_source_idle_remove -}; - -WL_EXPORT struct wl_event_source * -wl_event_loop_add_idle(struct wl_event_loop *loop, - wl_event_loop_idle_func_t func, - void *data) -{ - struct wl_event_source_idle *source; - - source = malloc(sizeof *source); - if (source == NULL) - return NULL; - - source->base.interface = &idle_source_interface; - source->base.loop = loop; - - source->func = func; - source->base.data = data; - wl_event_source_check(&source->base); - - return &source->base; -} - -WL_EXPORT void -wl_event_source_check(struct wl_event_source *source) -{ - wl_list_insert(source->loop->check_list.prev, &source->link); -} - -WL_EXPORT int -wl_event_source_remove(struct wl_event_source *source) -{ - if (!wl_list_empty(&source->link)) - wl_list_remove(&source->link); - - source->interface->remove(source); - - return 0; -} - -WL_EXPORT struct wl_event_loop * -wl_event_loop_create(void) -{ - struct wl_event_loop *loop; - - loop = malloc(sizeof *loop); - if (loop == NULL) - return NULL; - - loop->epoll_fd = epoll_create1(EPOLL_CLOEXEC); - if (loop->epoll_fd < 0) { - free(loop); - return NULL; - } - wl_list_init(&loop->check_list); - - return loop; -} - -WL_EXPORT void -wl_event_loop_destroy(struct wl_event_loop *loop) -{ - close(loop->epoll_fd); - free(loop); -} - -static int -post_dispatch_check(struct wl_event_loop *loop) -{ - struct epoll_event ep; - struct wl_event_source *source, *next; - int n; - - ep.events = 0; - n = 0; - wl_list_for_each_safe(source, next, &loop->check_list, link) - n += source->interface->dispatch(source, &ep); - - return n; -} - -WL_EXPORT int -wl_event_loop_dispatch(struct wl_event_loop *loop, int timeout) -{ - struct epoll_event ep[32]; - struct wl_event_source *source; - int i, count, n; - - count = epoll_wait(loop->epoll_fd, ep, ARRAY_LENGTH(ep), timeout); - if (count < 0) - return -1; - n = 0; - for (i = 0; i < count; i++) { - source = ep[i].data.ptr; - n += source->interface->dispatch(source, &ep[i]); - } - - while (n > 0) - n = post_dispatch_check(loop); - - return 0; -} - -WL_EXPORT int -wl_event_loop_get_fd(struct wl_event_loop *loop) -{ - return loop->epoll_fd; -} diff --git a/src/3rdparty/wayland/server/server.pro b/src/3rdparty/wayland/server/server.pro deleted file mode 100644 index 9f52b5c007a..00000000000 --- a/src/3rdparty/wayland/server/server.pro +++ /dev/null @@ -1,18 +0,0 @@ -TEMPLATE = lib -TARGET = wayland-server - -CONFIG -= qt -CONFIG += shared -CONFIG += use_pkgconfig - -include(../shared.pri) - -SOURCES = ../event-loop.c \ - ../wayland-server.c \ - ../wayland-protocol.c \ - ../connection.c \ - ../wayland-util.c \ - ../wayland-hash.c \ - ../wayland-shm.c - -OBJECTS_DIR = .obj diff --git a/src/3rdparty/wayland/shared.pri b/src/3rdparty/wayland/shared.pri deleted file mode 100644 index a8b3695005f..00000000000 --- a/src/3rdparty/wayland/shared.pri +++ /dev/null @@ -1,16 +0,0 @@ -INCLUDEPATH += $$PWD - -WAYLAND_INSTALL_DIR = $$(WAYLAND_INSTALL_DIR) -isEmpty(WAYLAND_INSTALL_DIR) { - DESTDIR=$$PWD/../../../lib/ -} else { - DESTDIR=$$WAYLAND_INSTALL_DIR -} - -use_pkgconfig { - CONFIG += link_pkgconfig - PKGCONFIG += libffi -} else { - LIBS += -L $$PWD/../../../../lib/ -lffi - INCLUDEPATH += $$PWD/../ffi -} diff --git a/src/3rdparty/wayland/wayland-client-protocol.h b/src/3rdparty/wayland/wayland-client-protocol.h deleted file mode 100644 index 564168401bc..00000000000 --- a/src/3rdparty/wayland/wayland-client-protocol.h +++ /dev/null @@ -1,867 +0,0 @@ -/* - * Copyright © 2010 Kristian Høgsberg - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting documentation, and - * that the name of the copyright holders not be used in advertising or - * publicity pertaining to distribution of the software without specific, - * written prior permission. The copyright holders make no representations - * about the suitability of this software for any purpose. It is provided "as - * is" without express or implied warranty. - * - * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - - -#ifndef WAYLAND_CLIENT_PROTOCOL_H -#define WAYLAND_CLIENT_PROTOCOL_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include -#include "wayland-util.h" - -struct wl_client; - -struct wl_display; -struct wl_compositor; -struct wl_shm; -struct wl_buffer; -struct wl_shell; -struct wl_selection; -struct wl_selection_offer; -struct wl_drag; -struct wl_drag_offer; -struct wl_surface; -struct wl_input_device; -struct wl_output; -struct wl_visual; - -extern const struct wl_interface wl_display_interface; -extern const struct wl_interface wl_compositor_interface; -extern const struct wl_interface wl_shm_interface; -extern const struct wl_interface wl_buffer_interface; -extern const struct wl_interface wl_shell_interface; -extern const struct wl_interface wl_selection_interface; -extern const struct wl_interface wl_selection_offer_interface; -extern const struct wl_interface wl_drag_interface; -extern const struct wl_interface wl_drag_offer_interface; -extern const struct wl_interface wl_surface_interface; -extern const struct wl_interface wl_input_device_interface; -extern const struct wl_interface wl_output_interface; -extern const struct wl_interface wl_visual_interface; - -struct wl_display_listener { - void (*invalid_object)(void *data, - struct wl_display *wl_display, - uint32_t object_id); - void (*invalid_method)(void *data, - struct wl_display *wl_display, - uint32_t object_id, - uint32_t opcode); - void (*no_memory)(void *data, - struct wl_display *wl_display); - void (*global)(void *data, - struct wl_display *wl_display, - uint32_t id, - const char *name, - uint32_t version); - void (*range)(void *data, - struct wl_display *wl_display, - uint32_t base); - void (*key)(void *data, - struct wl_display *wl_display, - uint32_t key, - uint32_t time); -}; - -static inline int -wl_display_add_listener(struct wl_display *wl_display, - const struct wl_display_listener *listener, void *data) -{ - return wl_proxy_add_listener((struct wl_proxy *) wl_display, - (void (**)(void)) listener, data); -} - -#define WL_DISPLAY_BIND 0 -#define WL_DISPLAY_SYNC 1 -#define WL_DISPLAY_FRAME 2 - -static inline void -wl_display_set_user_data(struct wl_display *wl_display, void *user_data) -{ - wl_proxy_set_user_data((struct wl_proxy *) wl_display, user_data); -} - -static inline void * -wl_display_get_user_data(struct wl_display *wl_display) -{ - return wl_proxy_get_user_data((struct wl_proxy *) wl_display); -} - -static inline void -wl_display_bind(struct wl_display *wl_display, uint32_t id, const char *interface, uint32_t version) -{ - wl_proxy_marshal((struct wl_proxy *) wl_display, - WL_DISPLAY_BIND, id, interface, version); -} - -static inline void -wl_display_sync(struct wl_display *wl_display, uint32_t key) -{ - wl_proxy_marshal((struct wl_proxy *) wl_display, - WL_DISPLAY_SYNC, key); -} - -static inline void -wl_display_frame(struct wl_display *wl_display, struct wl_surface *surface, uint32_t key) -{ - wl_proxy_marshal((struct wl_proxy *) wl_display, - WL_DISPLAY_FRAME, surface, key); -} - -#define WL_COMPOSITOR_CREATE_SURFACE 0 - -static inline struct wl_compositor * -wl_compositor_create(struct wl_display *display, uint32_t id, uint32_t version) -{ - wl_display_bind(display, id, "wl_compositor", version); - - return (struct wl_compositor *) - wl_proxy_create_for_id(display, &wl_compositor_interface, id); -} - -static inline void -wl_compositor_set_user_data(struct wl_compositor *wl_compositor, void *user_data) -{ - wl_proxy_set_user_data((struct wl_proxy *) wl_compositor, user_data); -} - -static inline void * -wl_compositor_get_user_data(struct wl_compositor *wl_compositor) -{ - return wl_proxy_get_user_data((struct wl_proxy *) wl_compositor); -} - -static inline void -wl_compositor_destroy(struct wl_compositor *wl_compositor) -{ - wl_proxy_destroy((struct wl_proxy *) wl_compositor); -} - -static inline struct wl_surface * -wl_compositor_create_surface(struct wl_compositor *wl_compositor) -{ - struct wl_proxy *id; - - id = wl_proxy_create((struct wl_proxy *) wl_compositor, - &wl_surface_interface); - if (!id) - return NULL; - - wl_proxy_marshal((struct wl_proxy *) wl_compositor, - WL_COMPOSITOR_CREATE_SURFACE, id); - - return (struct wl_surface *) id; -} - -#define WL_SHM_CREATE_BUFFER 0 - -static inline struct wl_shm * -wl_shm_create(struct wl_display *display, uint32_t id, uint32_t version) -{ - wl_display_bind(display, id, "wl_shm", version); - - return (struct wl_shm *) - wl_proxy_create_for_id(display, &wl_shm_interface, id); -} - -static inline void -wl_shm_set_user_data(struct wl_shm *wl_shm, void *user_data) -{ - wl_proxy_set_user_data((struct wl_proxy *) wl_shm, user_data); -} - -static inline void * -wl_shm_get_user_data(struct wl_shm *wl_shm) -{ - return wl_proxy_get_user_data((struct wl_proxy *) wl_shm); -} - -static inline void -wl_shm_destroy(struct wl_shm *wl_shm) -{ - wl_proxy_destroy((struct wl_proxy *) wl_shm); -} - -static inline struct wl_buffer * -wl_shm_create_buffer(struct wl_shm *wl_shm, int fd, int width, int height, uint32_t stride, struct wl_visual *visual) -{ - struct wl_proxy *id; - - id = wl_proxy_create((struct wl_proxy *) wl_shm, - &wl_buffer_interface); - if (!id) - return NULL; - - wl_proxy_marshal((struct wl_proxy *) wl_shm, - WL_SHM_CREATE_BUFFER, id, fd, width, height, stride, visual); - - return (struct wl_buffer *) id; -} - -#define WL_BUFFER_DAMAGE 0 -#define WL_BUFFER_DESTROY 1 - -static inline struct wl_buffer * -wl_buffer_create(struct wl_display *display, uint32_t id, uint32_t version) -{ - wl_display_bind(display, id, "wl_buffer", version); - - return (struct wl_buffer *) - wl_proxy_create_for_id(display, &wl_buffer_interface, id); -} - -static inline void -wl_buffer_set_user_data(struct wl_buffer *wl_buffer, void *user_data) -{ - wl_proxy_set_user_data((struct wl_proxy *) wl_buffer, user_data); -} - -static inline void * -wl_buffer_get_user_data(struct wl_buffer *wl_buffer) -{ - return wl_proxy_get_user_data((struct wl_proxy *) wl_buffer); -} - -static inline void -wl_buffer_damage(struct wl_buffer *wl_buffer, int x, int y, int width, int height) -{ - wl_proxy_marshal((struct wl_proxy *) wl_buffer, - WL_BUFFER_DAMAGE, x, y, width, height); -} - -static inline void -wl_buffer_destroy(struct wl_buffer *wl_buffer) -{ - wl_proxy_marshal((struct wl_proxy *) wl_buffer, - WL_BUFFER_DESTROY); - - wl_proxy_destroy((struct wl_proxy *) wl_buffer); -} - -#ifndef WL_SHELL_RESIZE_ENUM -#define WL_SHELL_RESIZE_ENUM -enum wl_shell_resize { - WL_SHELL_RESIZE_NONE = 0, - WL_SHELL_RESIZE_TOP = 1, - WL_SHELL_RESIZE_BOTTOM = 2, - WL_SHELL_RESIZE_LEFT = 4, - WL_SHELL_RESIZE_TOP_LEFT = 5, - WL_SHELL_RESIZE_BOTTOM_LEFT = 6, - WL_SHELL_RESIZE_RIGHT = 8, - WL_SHELL_RESIZE_TOP_RIGHT = 9, - WL_SHELL_RESIZE_BOTTOM_RIGHT = 10, -}; -#endif /* WL_SHELL_RESIZE_ENUM */ - -struct wl_shell_listener { - void (*configure)(void *data, - struct wl_shell *wl_shell, - uint32_t time, - uint32_t edges, - struct wl_surface *surface, - int width, - int height); -}; - -static inline int -wl_shell_add_listener(struct wl_shell *wl_shell, - const struct wl_shell_listener *listener, void *data) -{ - return wl_proxy_add_listener((struct wl_proxy *) wl_shell, - (void (**)(void)) listener, data); -} - -#define WL_SHELL_MOVE 0 -#define WL_SHELL_RESIZE 1 -#define WL_SHELL_CREATE_DRAG 2 -#define WL_SHELL_CREATE_SELECTION 3 - -static inline struct wl_shell * -wl_shell_create(struct wl_display *display, uint32_t id, uint32_t version) -{ - wl_display_bind(display, id, "wl_shell", version); - - return (struct wl_shell *) - wl_proxy_create_for_id(display, &wl_shell_interface, id); -} - -static inline void -wl_shell_set_user_data(struct wl_shell *wl_shell, void *user_data) -{ - wl_proxy_set_user_data((struct wl_proxy *) wl_shell, user_data); -} - -static inline void * -wl_shell_get_user_data(struct wl_shell *wl_shell) -{ - return wl_proxy_get_user_data((struct wl_proxy *) wl_shell); -} - -static inline void -wl_shell_destroy(struct wl_shell *wl_shell) -{ - wl_proxy_destroy((struct wl_proxy *) wl_shell); -} - -static inline void -wl_shell_move(struct wl_shell *wl_shell, struct wl_surface *surface, struct wl_input_device *input_device, uint32_t time) -{ - wl_proxy_marshal((struct wl_proxy *) wl_shell, - WL_SHELL_MOVE, surface, input_device, time); -} - -static inline void -wl_shell_resize(struct wl_shell *wl_shell, struct wl_surface *surface, struct wl_input_device *input_device, uint32_t time, uint32_t edges) -{ - wl_proxy_marshal((struct wl_proxy *) wl_shell, - WL_SHELL_RESIZE, surface, input_device, time, edges); -} - -static inline struct wl_drag * -wl_shell_create_drag(struct wl_shell *wl_shell) -{ - struct wl_proxy *id; - - id = wl_proxy_create((struct wl_proxy *) wl_shell, - &wl_drag_interface); - if (!id) - return NULL; - - wl_proxy_marshal((struct wl_proxy *) wl_shell, - WL_SHELL_CREATE_DRAG, id); - - return (struct wl_drag *) id; -} - -static inline struct wl_selection * -wl_shell_create_selection(struct wl_shell *wl_shell) -{ - struct wl_proxy *id; - - id = wl_proxy_create((struct wl_proxy *) wl_shell, - &wl_selection_interface); - if (!id) - return NULL; - - wl_proxy_marshal((struct wl_proxy *) wl_shell, - WL_SHELL_CREATE_SELECTION, id); - - return (struct wl_selection *) id; -} - -struct wl_selection_listener { - void (*send)(void *data, - struct wl_selection *wl_selection, - const char *mime_type, - int fd); - void (*cancelled)(void *data, - struct wl_selection *wl_selection); -}; - -static inline int -wl_selection_add_listener(struct wl_selection *wl_selection, - const struct wl_selection_listener *listener, void *data) -{ - return wl_proxy_add_listener((struct wl_proxy *) wl_selection, - (void (**)(void)) listener, data); -} - -#define WL_SELECTION_OFFER 0 -#define WL_SELECTION_ACTIVATE 1 -#define WL_SELECTION_DESTROY 2 - -static inline struct wl_selection * -wl_selection_create(struct wl_display *display, uint32_t id, uint32_t version) -{ - wl_display_bind(display, id, "wl_selection", version); - - return (struct wl_selection *) - wl_proxy_create_for_id(display, &wl_selection_interface, id); -} - -static inline void -wl_selection_set_user_data(struct wl_selection *wl_selection, void *user_data) -{ - wl_proxy_set_user_data((struct wl_proxy *) wl_selection, user_data); -} - -static inline void * -wl_selection_get_user_data(struct wl_selection *wl_selection) -{ - return wl_proxy_get_user_data((struct wl_proxy *) wl_selection); -} - -static inline void -wl_selection_offer(struct wl_selection *wl_selection, const char *type) -{ - wl_proxy_marshal((struct wl_proxy *) wl_selection, - WL_SELECTION_OFFER, type); -} - -static inline void -wl_selection_activate(struct wl_selection *wl_selection, struct wl_input_device *input_device, uint32_t time) -{ - wl_proxy_marshal((struct wl_proxy *) wl_selection, - WL_SELECTION_ACTIVATE, input_device, time); -} - -static inline void -wl_selection_destroy(struct wl_selection *wl_selection) -{ - wl_proxy_marshal((struct wl_proxy *) wl_selection, - WL_SELECTION_DESTROY); - - wl_proxy_destroy((struct wl_proxy *) wl_selection); -} - -struct wl_selection_offer_listener { - void (*offer)(void *data, - struct wl_selection_offer *wl_selection_offer, - const char *type); - void (*keyboard_focus)(void *data, - struct wl_selection_offer *wl_selection_offer, - struct wl_input_device *input_device); -}; - -static inline int -wl_selection_offer_add_listener(struct wl_selection_offer *wl_selection_offer, - const struct wl_selection_offer_listener *listener, void *data) -{ - return wl_proxy_add_listener((struct wl_proxy *) wl_selection_offer, - (void (**)(void)) listener, data); -} - -#define WL_SELECTION_OFFER_RECEIVE 0 - -static inline struct wl_selection_offer * -wl_selection_offer_create(struct wl_display *display, uint32_t id, uint32_t version) -{ - wl_display_bind(display, id, "wl_selection_offer", version); - - return (struct wl_selection_offer *) - wl_proxy_create_for_id(display, &wl_selection_offer_interface, id); -} - -static inline void -wl_selection_offer_set_user_data(struct wl_selection_offer *wl_selection_offer, void *user_data) -{ - wl_proxy_set_user_data((struct wl_proxy *) wl_selection_offer, user_data); -} - -static inline void * -wl_selection_offer_get_user_data(struct wl_selection_offer *wl_selection_offer) -{ - return wl_proxy_get_user_data((struct wl_proxy *) wl_selection_offer); -} - -static inline void -wl_selection_offer_destroy(struct wl_selection_offer *wl_selection_offer) -{ - wl_proxy_destroy((struct wl_proxy *) wl_selection_offer); -} - -static inline void -wl_selection_offer_receive(struct wl_selection_offer *wl_selection_offer, const char *mime_type, int fd) -{ - wl_proxy_marshal((struct wl_proxy *) wl_selection_offer, - WL_SELECTION_OFFER_RECEIVE, mime_type, fd); -} - -struct wl_drag_listener { - void (*target)(void *data, - struct wl_drag *wl_drag, - const char *mime_type); - void (*finish)(void *data, - struct wl_drag *wl_drag, - int fd); - void (*reject)(void *data, - struct wl_drag *wl_drag); -}; - -static inline int -wl_drag_add_listener(struct wl_drag *wl_drag, - const struct wl_drag_listener *listener, void *data) -{ - return wl_proxy_add_listener((struct wl_proxy *) wl_drag, - (void (**)(void)) listener, data); -} - -#define WL_DRAG_OFFER 0 -#define WL_DRAG_ACTIVATE 1 -#define WL_DRAG_DESTROY 2 - -static inline struct wl_drag * -wl_drag_create(struct wl_display *display, uint32_t id, uint32_t version) -{ - wl_display_bind(display, id, "wl_drag", version); - - return (struct wl_drag *) - wl_proxy_create_for_id(display, &wl_drag_interface, id); -} - -static inline void -wl_drag_set_user_data(struct wl_drag *wl_drag, void *user_data) -{ - wl_proxy_set_user_data((struct wl_proxy *) wl_drag, user_data); -} - -static inline void * -wl_drag_get_user_data(struct wl_drag *wl_drag) -{ - return wl_proxy_get_user_data((struct wl_proxy *) wl_drag); -} - -static inline void -wl_drag_offer(struct wl_drag *wl_drag, const char *type) -{ - wl_proxy_marshal((struct wl_proxy *) wl_drag, - WL_DRAG_OFFER, type); -} - -static inline void -wl_drag_activate(struct wl_drag *wl_drag, struct wl_surface *surface, struct wl_input_device *input_device, uint32_t time) -{ - wl_proxy_marshal((struct wl_proxy *) wl_drag, - WL_DRAG_ACTIVATE, surface, input_device, time); -} - -static inline void -wl_drag_destroy(struct wl_drag *wl_drag) -{ - wl_proxy_marshal((struct wl_proxy *) wl_drag, - WL_DRAG_DESTROY); - - wl_proxy_destroy((struct wl_proxy *) wl_drag); -} - -struct wl_drag_offer_listener { - void (*offer)(void *data, - struct wl_drag_offer *wl_drag_offer, - const char *type); - void (*pointer_focus)(void *data, - struct wl_drag_offer *wl_drag_offer, - uint32_t time, - struct wl_surface *surface, - int x, - int y, - int surface_x, - int surface_y); - void (*motion)(void *data, - struct wl_drag_offer *wl_drag_offer, - uint32_t time, - int x, - int y, - int surface_x, - int surface_y); - void (*drop)(void *data, - struct wl_drag_offer *wl_drag_offer); -}; - -static inline int -wl_drag_offer_add_listener(struct wl_drag_offer *wl_drag_offer, - const struct wl_drag_offer_listener *listener, void *data) -{ - return wl_proxy_add_listener((struct wl_proxy *) wl_drag_offer, - (void (**)(void)) listener, data); -} - -#define WL_DRAG_OFFER_ACCEPT 0 -#define WL_DRAG_OFFER_RECEIVE 1 -#define WL_DRAG_OFFER_REJECT 2 - -static inline struct wl_drag_offer * -wl_drag_offer_create(struct wl_display *display, uint32_t id, uint32_t version) -{ - wl_display_bind(display, id, "wl_drag_offer", version); - - return (struct wl_drag_offer *) - wl_proxy_create_for_id(display, &wl_drag_offer_interface, id); -} - -static inline void -wl_drag_offer_set_user_data(struct wl_drag_offer *wl_drag_offer, void *user_data) -{ - wl_proxy_set_user_data((struct wl_proxy *) wl_drag_offer, user_data); -} - -static inline void * -wl_drag_offer_get_user_data(struct wl_drag_offer *wl_drag_offer) -{ - return wl_proxy_get_user_data((struct wl_proxy *) wl_drag_offer); -} - -static inline void -wl_drag_offer_destroy(struct wl_drag_offer *wl_drag_offer) -{ - wl_proxy_destroy((struct wl_proxy *) wl_drag_offer); -} - -static inline void -wl_drag_offer_accept(struct wl_drag_offer *wl_drag_offer, uint32_t time, const char *type) -{ - wl_proxy_marshal((struct wl_proxy *) wl_drag_offer, - WL_DRAG_OFFER_ACCEPT, time, type); -} - -static inline void -wl_drag_offer_receive(struct wl_drag_offer *wl_drag_offer, int fd) -{ - wl_proxy_marshal((struct wl_proxy *) wl_drag_offer, - WL_DRAG_OFFER_RECEIVE, fd); -} - -static inline void -wl_drag_offer_reject(struct wl_drag_offer *wl_drag_offer) -{ - wl_proxy_marshal((struct wl_proxy *) wl_drag_offer, - WL_DRAG_OFFER_REJECT); -} - -#define WL_SURFACE_DESTROY 0 -#define WL_SURFACE_ATTACH 1 -#define WL_SURFACE_MAP_TOPLEVEL 2 -#define WL_SURFACE_MAP_TRANSIENT 3 -#define WL_SURFACE_MAP_FULLSCREEN 4 -#define WL_SURFACE_DAMAGE 5 - -static inline struct wl_surface * -wl_surface_create(struct wl_display *display, uint32_t id, uint32_t version) -{ - wl_display_bind(display, id, "wl_surface", version); - - return (struct wl_surface *) - wl_proxy_create_for_id(display, &wl_surface_interface, id); -} - -static inline void -wl_surface_set_user_data(struct wl_surface *wl_surface, void *user_data) -{ - wl_proxy_set_user_data((struct wl_proxy *) wl_surface, user_data); -} - -static inline void * -wl_surface_get_user_data(struct wl_surface *wl_surface) -{ - return wl_proxy_get_user_data((struct wl_proxy *) wl_surface); -} - -static inline void -wl_surface_destroy(struct wl_surface *wl_surface) -{ - wl_proxy_marshal((struct wl_proxy *) wl_surface, - WL_SURFACE_DESTROY); - - wl_proxy_destroy((struct wl_proxy *) wl_surface); -} - -static inline void -wl_surface_attach(struct wl_surface *wl_surface, struct wl_buffer *buffer, int x, int y) -{ - wl_proxy_marshal((struct wl_proxy *) wl_surface, - WL_SURFACE_ATTACH, buffer, x, y); -} - -static inline void -wl_surface_map_toplevel(struct wl_surface *wl_surface) -{ - wl_proxy_marshal((struct wl_proxy *) wl_surface, - WL_SURFACE_MAP_TOPLEVEL); -} - -static inline void -wl_surface_map_transient(struct wl_surface *wl_surface, struct wl_surface *parent, int x, int y, uint32_t flags) -{ - wl_proxy_marshal((struct wl_proxy *) wl_surface, - WL_SURFACE_MAP_TRANSIENT, parent, x, y, flags); -} - -static inline void -wl_surface_map_fullscreen(struct wl_surface *wl_surface) -{ - wl_proxy_marshal((struct wl_proxy *) wl_surface, - WL_SURFACE_MAP_FULLSCREEN); -} - -static inline void -wl_surface_damage(struct wl_surface *wl_surface, int x, int y, int width, int height) -{ - wl_proxy_marshal((struct wl_proxy *) wl_surface, - WL_SURFACE_DAMAGE, x, y, width, height); -} - -struct wl_input_device_listener { - void (*motion)(void *data, - struct wl_input_device *wl_input_device, - uint32_t time, - int x, - int y, - int surface_x, - int surface_y); - void (*button)(void *data, - struct wl_input_device *wl_input_device, - uint32_t time, - uint32_t button, - uint32_t state); - void (*key)(void *data, - struct wl_input_device *wl_input_device, - uint32_t time, - uint32_t key, - uint32_t state); - void (*pointer_focus)(void *data, - struct wl_input_device *wl_input_device, - uint32_t time, - struct wl_surface *surface, - int x, - int y, - int surface_x, - int surface_y); - void (*keyboard_focus)(void *data, - struct wl_input_device *wl_input_device, - uint32_t time, - struct wl_surface *surface, - struct wl_array *keys); -}; - -static inline int -wl_input_device_add_listener(struct wl_input_device *wl_input_device, - const struct wl_input_device_listener *listener, void *data) -{ - return wl_proxy_add_listener((struct wl_proxy *) wl_input_device, - (void (**)(void)) listener, data); -} - -#define WL_INPUT_DEVICE_ATTACH 0 - -static inline struct wl_input_device * -wl_input_device_create(struct wl_display *display, uint32_t id, uint32_t version) -{ - wl_display_bind(display, id, "wl_input_device", version); - - return (struct wl_input_device *) - wl_proxy_create_for_id(display, &wl_input_device_interface, id); -} - -static inline void -wl_input_device_set_user_data(struct wl_input_device *wl_input_device, void *user_data) -{ - wl_proxy_set_user_data((struct wl_proxy *) wl_input_device, user_data); -} - -static inline void * -wl_input_device_get_user_data(struct wl_input_device *wl_input_device) -{ - return wl_proxy_get_user_data((struct wl_proxy *) wl_input_device); -} - -static inline void -wl_input_device_destroy(struct wl_input_device *wl_input_device) -{ - wl_proxy_destroy((struct wl_proxy *) wl_input_device); -} - -static inline void -wl_input_device_attach(struct wl_input_device *wl_input_device, uint32_t time, struct wl_buffer *buffer, int hotspot_x, int hotspot_y) -{ - wl_proxy_marshal((struct wl_proxy *) wl_input_device, - WL_INPUT_DEVICE_ATTACH, time, buffer, hotspot_x, hotspot_y); -} - -struct wl_output_listener { - void (*geometry)(void *data, - struct wl_output *wl_output, - int x, - int y, - int width, - int height); -}; - -static inline int -wl_output_add_listener(struct wl_output *wl_output, - const struct wl_output_listener *listener, void *data) -{ - return wl_proxy_add_listener((struct wl_proxy *) wl_output, - (void (**)(void)) listener, data); -} - -static inline struct wl_output * -wl_output_create(struct wl_display *display, uint32_t id, uint32_t version) -{ - wl_display_bind(display, id, "wl_output", version); - - return (struct wl_output *) - wl_proxy_create_for_id(display, &wl_output_interface, id); -} - -static inline void -wl_output_set_user_data(struct wl_output *wl_output, void *user_data) -{ - wl_proxy_set_user_data((struct wl_proxy *) wl_output, user_data); -} - -static inline void * -wl_output_get_user_data(struct wl_output *wl_output) -{ - return wl_proxy_get_user_data((struct wl_proxy *) wl_output); -} - -static inline void -wl_output_destroy(struct wl_output *wl_output) -{ - wl_proxy_destroy((struct wl_proxy *) wl_output); -} - -static inline struct wl_visual * -wl_visual_create(struct wl_display *display, uint32_t id, uint32_t version) -{ - wl_display_bind(display, id, "wl_visual", version); - - return (struct wl_visual *) - wl_proxy_create_for_id(display, &wl_visual_interface, id); -} - -static inline void -wl_visual_set_user_data(struct wl_visual *wl_visual, void *user_data) -{ - wl_proxy_set_user_data((struct wl_proxy *) wl_visual, user_data); -} - -static inline void * -wl_visual_get_user_data(struct wl_visual *wl_visual) -{ - return wl_proxy_get_user_data((struct wl_proxy *) wl_visual); -} - -static inline void -wl_visual_destroy(struct wl_visual *wl_visual) -{ - wl_proxy_destroy((struct wl_proxy *) wl_visual); -} - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/src/3rdparty/wayland/wayland-client.c b/src/3rdparty/wayland/wayland-client.c deleted file mode 100644 index 531807dba7a..00000000000 --- a/src/3rdparty/wayland/wayland-client.c +++ /dev/null @@ -1,619 +0,0 @@ -/* - * Copyright © 2008 Kristian Høgsberg - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting documentation, and - * that the name of the copyright holders not be used in advertising or - * publicity pertaining to distribution of the software without specific, - * written prior permission. The copyright holders make no representations - * about the suitability of this software for any purpose. It is provided "as - * is" without express or implied warranty. - * - * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "connection.h" -#include "wayland-util.h" -#include "wayland-client.h" - -struct wl_global_listener { - wl_display_global_func_t handler; - void *data; - struct wl_list link; -}; - -struct wl_proxy { - struct wl_object object; - struct wl_display *display; - void *user_data; -}; - -struct wl_sync_handler { - wl_display_sync_func_t func; - uint32_t key; - void *data; - struct wl_list link; -}; - -struct wl_frame_handler { - wl_display_frame_func_t func; - uint32_t key; - void *data; - struct wl_surface *surface; - struct wl_list link; -}; - -struct wl_global { - uint32_t id; - char *interface; - uint32_t version; - struct wl_list link; -}; - -struct wl_display { - struct wl_proxy proxy; - struct wl_connection *connection; - int fd; - uint32_t id, id_count, next_range; - uint32_t mask; - struct wl_hash_table *objects; - struct wl_list global_listener_list; - struct wl_list global_list; - - struct wl_visual *argb_visual; - struct wl_visual *premultiplied_argb_visual; - struct wl_visual *rgb_visual; - - wl_display_update_func_t update; - void *update_data; - - wl_display_global_func_t global_handler; - void *global_handler_data; - - struct wl_list sync_list, frame_list; - uint32_t key; -}; - -static int wl_debug = 0; - -static int -connection_update(struct wl_connection *connection, - uint32_t mask, void *data) -{ - struct wl_display *display = data; - - display->mask = mask; - if (display->update) - return display->update(display->mask, - display->update_data); - - return 0; -} - -WL_EXPORT struct wl_global_listener * -wl_display_add_global_listener(struct wl_display *display, - wl_display_global_func_t handler, void *data) -{ - struct wl_global_listener *listener; - - listener = malloc(sizeof *listener); - if (listener == NULL) - return NULL; - - listener->handler = handler; - listener->data = data; - wl_list_insert(display->global_listener_list.prev, &listener->link); - - return listener; -} - -WL_EXPORT void -wl_display_remove_global_listener(struct wl_display *display, - struct wl_global_listener *listener) -{ - wl_list_remove(&listener->link); - free(listener); -} - -WL_EXPORT struct wl_proxy * -wl_proxy_create_for_id(struct wl_display *display, - const struct wl_interface *interface, uint32_t id) -{ - struct wl_proxy *proxy; - - proxy = malloc(sizeof *proxy); - if (proxy == NULL) - return NULL; - - proxy->object.interface = interface; - proxy->object.implementation = NULL; - proxy->object.id = id; - proxy->display = display; - wl_hash_table_insert(display->objects, proxy->object.id, proxy); - - return proxy; -} - -WL_EXPORT struct wl_proxy * -wl_proxy_create(struct wl_proxy *factory, - const struct wl_interface *interface) -{ - return wl_proxy_create_for_id(factory->display, interface, - wl_display_allocate_id(factory->display)); -} - -WL_EXPORT void -wl_proxy_destroy(struct wl_proxy *proxy) -{ - wl_hash_table_remove(proxy->display->objects, proxy->object.id); - free(proxy); -} - -WL_EXPORT int -wl_proxy_add_listener(struct wl_proxy *proxy, - void (**implementation)(void), void *data) -{ - if (proxy->object.implementation) { - fprintf(stderr, "proxy already has listener\n"); - return -1; - } - - proxy->object.implementation = implementation; - proxy->user_data = data; - - return 0; -} - -WL_EXPORT void -wl_proxy_marshal(struct wl_proxy *proxy, uint32_t opcode, ...) -{ - struct wl_closure *closure; - va_list ap; - - va_start(ap, opcode); - closure = wl_connection_vmarshal(proxy->display->connection, - &proxy->object, opcode, ap, - &proxy->object.interface->methods[opcode]); - va_end(ap); - - wl_closure_send(closure, proxy->display->connection); - - if (wl_debug) { - fprintf(stderr, " -> "); - wl_closure_print(closure, &proxy->object); - } - - wl_closure_destroy(closure); -} - -static void -add_visual(struct wl_display *display, uint32_t id) -{ - struct wl_visual *visual; - - visual = (struct wl_visual *) - wl_proxy_create_for_id(display, &wl_visual_interface, id); - if (display->argb_visual == NULL) - display->argb_visual = visual; - else if (display->premultiplied_argb_visual == NULL) - display->premultiplied_argb_visual = visual; - else - display->rgb_visual = visual; -} - -WL_EXPORT struct wl_visual * -wl_display_get_argb_visual(struct wl_display *display) -{ - return display->argb_visual; -} - -WL_EXPORT struct wl_visual * -wl_display_get_premultiplied_argb_visual(struct wl_display *display) -{ - return display->premultiplied_argb_visual; -} - -WL_EXPORT struct wl_visual * -wl_display_get_rgb_visual(struct wl_display *display) -{ - return display->rgb_visual; -} - -/* Can't do this, there may be more than one instance of an - * interface... */ -WL_EXPORT uint32_t -wl_display_get_global(struct wl_display *display, - const char *interface, uint32_t version) -{ - struct wl_global *global; - - wl_list_for_each(global, &display->global_list, link) - if (strcmp(interface, global->interface) == 0 && - version <= global->version) - return global->id; - - return 0; -} - -static void -display_handle_invalid_object(void *data, - struct wl_display *display, uint32_t id) -{ - fprintf(stderr, "sent request to invalid object\n"); - abort(); -} - -static void -display_handle_invalid_method(void *data, - struct wl_display *display, - uint32_t id, uint32_t opcode) -{ - fprintf(stderr, "sent invalid request opcode\n"); - abort(); -} - -static void -display_handle_no_memory(void *data, - struct wl_display *display) -{ - fprintf(stderr, "server out of memory\n"); - abort(); -} - -static void -display_handle_global(void *data, - struct wl_display *display, - uint32_t id, const char *interface, uint32_t version) -{ - struct wl_global_listener *listener; - struct wl_global *global; - - if (strcmp(interface, "wl_display") == 0) - wl_hash_table_insert(display->objects, - id, &display->proxy.object); - else if (strcmp(interface, "wl_visual") == 0) - add_visual(display, id); - - global = malloc(sizeof *global); - global->id = id; - global->interface = strdup(interface); - global->version = version; - wl_list_insert(display->global_list.prev, &global->link); - - wl_list_for_each(listener, &display->global_listener_list, link) - (*listener->handler)(display, - id, interface, version, listener->data); -} - -static void -display_handle_range(void *data, - struct wl_display *display, uint32_t range) -{ - display->next_range = range; -} - -static void -display_handle_key(void *data, - struct wl_display *display, uint32_t key, uint32_t time) -{ - struct wl_sync_handler *sync_handler; - struct wl_frame_handler *frame_handler; - - sync_handler = container_of(display->sync_list.next, - struct wl_sync_handler, link); - if (!wl_list_empty(&display->sync_list) && sync_handler->key == key) { - wl_list_remove(&sync_handler->link); - sync_handler->func(sync_handler->data); - free(sync_handler); - return; - } - - frame_handler = container_of(display->frame_list. next, - struct wl_frame_handler, link); - if (!wl_list_empty(&display->frame_list) && - frame_handler->key == key) { - wl_list_remove(&frame_handler->link); - frame_handler->func(frame_handler->surface, - frame_handler->data, time); - free(frame_handler); - return; - } - - fprintf(stderr, "unsolicited sync event, client gone?\n"); -} - -static const struct wl_display_listener display_listener = { - display_handle_invalid_object, - display_handle_invalid_method, - display_handle_no_memory, - display_handle_global, - display_handle_range, - display_handle_key -}; - -static int -connect_to_socket(struct wl_display *display, const char *name) -{ - struct sockaddr_un addr; - socklen_t size; - const char *runtime_dir; - size_t name_size; - - display->fd = socket(PF_LOCAL, SOCK_STREAM | SOCK_CLOEXEC, 0); - if (display->fd < 0) - return -1; - - runtime_dir = getenv("XDG_RUNTIME_DIR"); - if (runtime_dir == NULL) { - runtime_dir = "."; - fprintf(stderr, - "XDG_RUNTIME_DIR not set, falling back to %s\n", - runtime_dir); - } - - if (name == NULL) - name = getenv("WAYLAND_DISPLAY"); - if (name == NULL) - name = "wayland-0"; - - memset(&addr, 0, sizeof addr); - addr.sun_family = AF_LOCAL; - name_size = - snprintf(addr.sun_path, sizeof addr.sun_path, - "%s/%s", runtime_dir, name) + 1; - - size = offsetof (struct sockaddr_un, sun_path) + name_size; - - if (connect(display->fd, (struct sockaddr *) &addr, size) < 0) { - close(display->fd); - return -1; - } - - return 0; -} - -WL_EXPORT struct wl_display * -wl_display_connect(const char *name) -{ - struct wl_display *display; - const char *debug; - char *connection, *end; - int flags; - - debug = getenv("WAYLAND_DEBUG"); - if (debug) - wl_debug = 1; - - display = malloc(sizeof *display); - if (display == NULL) - return NULL; - - memset(display, 0, sizeof *display); - connection = getenv("WAYLAND_SOCKET"); - if (connection) { - display->fd = strtol(connection, &end, 0); - if (*end != '\0') { - free(display); - return NULL; - } - flags = fcntl(display->fd, F_GETFD); - if (flags != -1) - fcntl(display->fd, F_SETFD, flags | FD_CLOEXEC); - } else if (connect_to_socket(display, name) < 0) { - free(display); - return NULL; - } - - display->objects = wl_hash_table_create(); - if (display->objects == NULL) { - close(display->fd); - free(display); - return NULL; - } - wl_list_init(&display->global_listener_list); - wl_list_init(&display->global_list); - - display->proxy.object.interface = &wl_display_interface; - display->proxy.object.id = 1; - display->proxy.display = display; - - wl_list_init(&display->sync_list); - wl_list_init(&display->frame_list); - - display->proxy.object.implementation = - (void(**)(void)) &display_listener; - display->proxy.user_data = display; - - display->connection = wl_connection_create(display->fd, - connection_update, - display); - if (display->connection == NULL) { - wl_hash_table_destroy(display->objects); - close(display->fd); - free(display); - return NULL; - } - - wl_display_bind(display, 1, "wl_display", 1); - - return display; -} - -WL_EXPORT void -wl_display_destroy(struct wl_display *display) -{ - wl_connection_destroy(display->connection); - wl_hash_table_destroy(display->objects); - close(display->fd); - free(display); -} - -WL_EXPORT int -wl_display_get_fd(struct wl_display *display, - wl_display_update_func_t update, void *data) -{ - display->update = update; - display->update_data = data; - - display->update(display->mask, display->update_data); - - return display->fd; -} - -WL_EXPORT int -wl_display_sync_callback(struct wl_display *display, - wl_display_sync_func_t func, void *data) -{ - struct wl_sync_handler *handler; - - handler = malloc(sizeof *handler); - if (handler == NULL) - return -1; - - handler->func = func; - handler->key = display->key++; - handler->data = data; - - wl_list_insert(display->sync_list.prev, &handler->link); - wl_display_sync(display, handler->key); - - return 0; -} - -WL_EXPORT int -wl_display_frame_callback(struct wl_display *display, - struct wl_surface *surface, - wl_display_frame_func_t func, void *data) -{ - struct wl_frame_handler *handler; - - handler = malloc(sizeof *handler); - if (handler == NULL) - return -1; - - handler->func = func; - handler->key = display->key++; - handler->data = data; - handler->surface = surface; - - wl_list_insert(display->frame_list.prev, &handler->link); - wl_display_frame(display, handler->surface, handler->key); - - return 0; -} - -static void -handle_event(struct wl_display *display, - uint32_t id, uint32_t opcode, uint32_t size) -{ - uint32_t p[32]; - struct wl_proxy *proxy; - struct wl_closure *closure; - const struct wl_message *message; - - wl_connection_copy(display->connection, p, size); - if (id == 1) - proxy = &display->proxy; - else - proxy = wl_hash_table_lookup(display->objects, id); - - if (proxy == NULL || proxy->object.implementation == NULL) { - wl_connection_consume(display->connection, size); - return; - } - - message = &proxy->object.interface->events[opcode]; - closure = wl_connection_demarshal(display->connection, - size, display->objects, message); - - if (wl_debug) - wl_closure_print(closure, &proxy->object); - - wl_closure_invoke(closure, &proxy->object, - proxy->object.implementation[opcode], - proxy->user_data); - - wl_closure_destroy(closure); -} - -WL_EXPORT void -wl_display_iterate(struct wl_display *display, uint32_t mask) -{ - uint32_t p[2], object, opcode, size; - int len; - - mask &= display->mask; - if (mask == 0) { - fprintf(stderr, - "wl_display_iterate called with unsolicited flags"); - return; - } - - len = wl_connection_data(display->connection, mask); - while (len > 0) { - if (len < sizeof p) - break; - - wl_connection_copy(display->connection, p, sizeof p); - object = p[0]; - opcode = p[1] & 0xffff; - size = p[1] >> 16; - if (len < size) - break; - - handle_event(display, object, opcode, size); - len -= size; - } - - if (len < 0) { - fprintf(stderr, "read error: %m\n"); - exit(EXIT_FAILURE); - } -} - -WL_EXPORT uint32_t -wl_display_allocate_id(struct wl_display *display) -{ - if (display->id_count == 0) { - display->id_count = 256; - display->id = display->next_range; - } - - display->id_count--; - - return display->id++; -} - -WL_EXPORT void -wl_proxy_set_user_data(struct wl_proxy *proxy, void *user_data) -{ - proxy->user_data = user_data; -} - -WL_EXPORT void * -wl_proxy_get_user_data(struct wl_proxy *proxy) -{ - return proxy->user_data; -} diff --git a/src/3rdparty/wayland/wayland-client.h b/src/3rdparty/wayland/wayland-client.h deleted file mode 100644 index f1ac7978c48..00000000000 --- a/src/3rdparty/wayland/wayland-client.h +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Copyright © 2008 Kristian Høgsberg - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting documentation, and - * that the name of the copyright holders not be used in advertising or - * publicity pertaining to distribution of the software without specific, - * written prior permission. The copyright holders make no representations - * about the suitability of this software for any purpose. It is provided "as - * is" without express or implied warranty. - * - * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#ifndef _WAYLAND_CLIENT_H -#define _WAYLAND_CLIENT_H - -#include "wayland-util.h" - -#ifdef __cplusplus -extern "C" { -#endif - -struct wl_proxy; -struct wl_display; - -void wl_proxy_marshal(struct wl_proxy *p, uint32_t opcode, ...); -struct wl_proxy *wl_proxy_create(struct wl_proxy *factory, - const struct wl_interface *interface); -struct wl_proxy *wl_proxy_create_for_id(struct wl_display *display, - const struct wl_interface *interface, - uint32_t id); -void wl_proxy_destroy(struct wl_proxy *proxy); -int wl_proxy_add_listener(struct wl_proxy *proxy, - void (**implementation)(void), void *data); -void wl_proxy_set_user_data(struct wl_proxy *proxy, void *user_data); -void *wl_proxy_get_user_data(struct wl_proxy *proxy); - -#include "wayland-client-protocol.h" - -#define WL_DISPLAY_READABLE 0x01 -#define WL_DISPLAY_WRITABLE 0x02 - -typedef int (*wl_display_update_func_t)(uint32_t mask, void *data); -typedef void (*wl_display_sync_func_t)(void *data); -typedef void (*wl_display_frame_func_t)(struct wl_surface *surface, - void *data, uint32_t time); - -struct wl_display *wl_display_connect(const char *name); -void wl_display_destroy(struct wl_display *display); -int wl_display_get_fd(struct wl_display *display, - wl_display_update_func_t update, void *data); -uint32_t wl_display_allocate_id(struct wl_display *display); -void wl_display_iterate(struct wl_display *display, uint32_t mask); -int wl_display_sync_callback(struct wl_display *display, - wl_display_sync_func_t func, void *data); -int wl_display_frame_callback(struct wl_display *display, - struct wl_surface *surface, - wl_display_frame_func_t func, void *data); - -struct wl_global_listener; -typedef void (*wl_display_global_func_t)(struct wl_display *display, - uint32_t id, - const char *interface, - uint32_t version, - void *data); -void -wl_display_remove_global_listener(struct wl_display *display, - struct wl_global_listener *listener); -struct wl_global_listener * -wl_display_add_global_listener(struct wl_display *display, - wl_display_global_func_t handler, void *data); -WL_EXPORT uint32_t -wl_display_get_global(struct wl_display *display, - const char *interface, uint32_t version); - -struct wl_visual * -wl_display_get_argb_visual(struct wl_display *display); -struct wl_visual * -wl_display_get_premultiplied_argb_visual(struct wl_display *display); -struct wl_visual * -wl_display_get_rgb_visual(struct wl_display *display); - - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/src/3rdparty/wayland/wayland-egl.h b/src/3rdparty/wayland/wayland-egl.h deleted file mode 100644 index 85fe73d90bc..00000000000 --- a/src/3rdparty/wayland/wayland-egl.h +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright © 2011 Kristian Høgsberg - * Copyright © 2011 Benjamin Franzke - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting documentation, and - * that the name of the copyright holders not be used in advertising or - * publicity pertaining to distribution of the software without specific, - * written prior permission. The copyright holders make no representations - * about the suitability of this software for any purpose. It is provided "as - * is" without express or implied warranty. - * - * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#ifndef _WAYLAND_EGL_H -#define _WAYLAND_EGL_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -#define WL_EGL_PLATFORM 1 - -struct wl_egl_window; -struct wl_egl_pixmap; - -struct wl_egl_window * -wl_egl_window_create(struct wl_surface *surface, - int width, int height, - struct wl_visual *visual); - -void -wl_egl_window_destroy(struct wl_egl_window *egl_window); - -void -wl_egl_window_resize(struct wl_egl_window *egl_window, - int width, int height, - int dx, int dy); - -void -wl_egl_window_get_attached_size(struct wl_egl_window *egl_window, - int *width, int *height); - -struct wl_egl_pixmap * -wl_egl_pixmap_create(int width, int height, - struct wl_visual *visual, uint32_t flags); -void -wl_egl_pixmap_destroy(struct wl_egl_pixmap *egl_pixmap); - -struct wl_buffer * -wl_egl_pixmap_create_buffer(struct wl_egl_pixmap *egl_pixmap); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/src/3rdparty/wayland/wayland-hash.c b/src/3rdparty/wayland/wayland-hash.c deleted file mode 100644 index b299a33da11..00000000000 --- a/src/3rdparty/wayland/wayland-hash.c +++ /dev/null @@ -1,296 +0,0 @@ -/* - * Copyright © 2009 Intel Corporation - * Copyright © 1988-2004 Keith Packard and Bart Massey. - * - * 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. - * - * Except as contained in this notice, the names of the authors - * or their institutions shall not be used in advertising or - * otherwise to promote the sale, use or other dealings in this - * Software without prior written authorization from the - * authors. - * - * Authors: - * Eric Anholt - * Keith Packard - */ - -#include - -#include "wayland-util.h" - -struct hash_entry { - uint32_t hash; - void *data; -}; - -struct wl_hash_table { - struct hash_entry *table; - uint32_t size; - uint32_t rehash; - uint32_t max_entries; - uint32_t size_index; - uint32_t entries; - uint32_t deleted_entries; -}; - -#define ARRAY_SIZE(array) (sizeof(array) / sizeof(array[0])) - -/* - * From Knuth -- a good choice for hash/rehash values is p, p-2 where - * p and p-2 are both prime. These tables are sized to have an extra 10% - * free to avoid exponential performance degradation as the hash table fills - */ - -static const uint32_t deleted_data; - -static const struct { - uint32_t max_entries, size, rehash; -} hash_sizes[] = { - { 2, 5, 3 }, - { 4, 7, 5 }, - { 8, 13, 11 }, - { 16, 19, 17 }, - { 32, 43, 41 }, - { 64, 73, 71 }, - { 128, 151, 149 }, - { 256, 283, 281 }, - { 512, 571, 569 }, - { 1024, 1153, 1151 }, - { 2048, 2269, 2267 }, - { 4096, 4519, 4517 }, - { 8192, 9013, 9011 }, - { 16384, 18043, 18041 }, - { 32768, 36109, 36107 }, - { 65536, 72091, 72089 }, - { 131072, 144409, 144407 }, - { 262144, 288361, 288359 }, - { 524288, 576883, 576881 }, - { 1048576, 1153459, 1153457 }, - { 2097152, 2307163, 2307161 }, - { 4194304, 4613893, 4613891 }, - { 8388608, 9227641, 9227639 }, - { 16777216, 18455029, 18455027 }, - { 33554432, 36911011, 36911009 }, - { 67108864, 73819861, 73819859 }, - { 134217728, 147639589, 147639587 }, - { 268435456, 295279081, 295279079 }, - { 536870912, 590559793, 590559791 }, - { 1073741824, 1181116273, 1181116271}, - { 2147483648ul, 2362232233ul, 2362232231ul} -}; - -static int -entry_is_free(struct hash_entry *entry) -{ - return entry->data == NULL; -} - -static int -entry_is_deleted(struct hash_entry *entry) -{ - return entry->data == &deleted_data; -} - -static int -entry_is_present(struct hash_entry *entry) -{ - return entry->data != NULL && entry->data != &deleted_data; -} - -WL_EXPORT struct wl_hash_table * -wl_hash_table_create(void) -{ - struct wl_hash_table *ht; - - ht = malloc(sizeof(*ht)); - if (ht == NULL) - return NULL; - - ht->size_index = 0; - ht->size = hash_sizes[ht->size_index].size; - ht->rehash = hash_sizes[ht->size_index].rehash; - ht->max_entries = hash_sizes[ht->size_index].max_entries; - ht->table = calloc(ht->size, sizeof(*ht->table)); - ht->entries = 0; - ht->deleted_entries = 0; - - if (ht->table == NULL) { - free(ht); - return NULL; - } - - return ht; -} - -/** - * Frees the given hash table. - */ -WL_EXPORT void -wl_hash_table_destroy(struct wl_hash_table *ht) -{ - if (!ht) - return; - - free(ht->table); - free(ht); -} - -/** - * Finds a hash table entry with the given key and hash of that key. - * - * Returns NULL if no entry is found. Note that the data pointer may be - * modified by the user. - */ -static void * -hash_table_search(struct wl_hash_table *ht, uint32_t hash) -{ - uint32_t hash_address; - - hash_address = hash % ht->size; - do { - uint32_t double_hash; - - struct hash_entry *entry = ht->table + hash_address; - - if (entry_is_free(entry)) { - return NULL; - } else if (entry_is_present(entry) && entry->hash == hash) { - return entry; - } - - double_hash = hash % ht->rehash; - if (double_hash == 0) - double_hash = 1; - - hash_address = (hash_address + double_hash) % ht->size; - } while (hash_address != hash % ht->size); - - return NULL; -} - -WL_EXPORT void * -wl_hash_table_lookup(struct wl_hash_table *ht, uint32_t hash) -{ - struct hash_entry *entry; - - entry = hash_table_search(ht, hash); - if (entry != NULL) - return entry->data; - - return NULL; -} - -static void -hash_table_rehash(struct wl_hash_table *ht, int new_size_index) -{ - struct wl_hash_table old_ht; - struct hash_entry *table, *entry; - - if (new_size_index >= ARRAY_SIZE(hash_sizes)) - return; - - table = calloc(hash_sizes[new_size_index].size, sizeof(*ht->table)); - if (table == NULL) - return; - - old_ht = *ht; - - ht->table = table; - ht->size_index = new_size_index; - ht->size = hash_sizes[ht->size_index].size; - ht->rehash = hash_sizes[ht->size_index].rehash; - ht->max_entries = hash_sizes[ht->size_index].max_entries; - ht->entries = 0; - ht->deleted_entries = 0; - - for (entry = old_ht.table; - entry != old_ht.table + old_ht.size; - entry++) { - if (entry_is_present(entry)) { - wl_hash_table_insert(ht, entry->hash, entry->data); - } - } - - free(old_ht.table); -} - -/** - * Inserts the data with the given hash into the table. - * - * Note that insertion may rearrange the table on a resize or rehash, - * so previously found hash_entries are no longer valid after this function. - */ -WL_EXPORT int -wl_hash_table_insert(struct wl_hash_table *ht, uint32_t hash, void *data) -{ - uint32_t hash_address; - - if (ht->entries >= ht->max_entries) { - hash_table_rehash(ht, ht->size_index + 1); - } else if (ht->deleted_entries + ht->entries >= ht->max_entries) { - hash_table_rehash(ht, ht->size_index); - } - - hash_address = hash % ht->size; - do { - struct hash_entry *entry = ht->table + hash_address; - uint32_t double_hash; - - if (!entry_is_present(entry)) { - if (entry_is_deleted(entry)) - ht->deleted_entries--; - entry->hash = hash; - entry->data = data; - ht->entries++; - return 0; - } - - double_hash = hash % ht->rehash; - if (double_hash == 0) - double_hash = 1; - - hash_address = (hash_address + double_hash) % ht->size; - } while (hash_address != hash % ht->size); - - /* We could hit here if a required resize failed. An unchecked-malloc - * application could ignore this result. - */ - return -1; -} - -/** - * This function deletes the given hash table entry. - * - * Note that deletion doesn't otherwise modify the table, so an iteration over - * the table deleting entries is safe. - */ -WL_EXPORT void -wl_hash_table_remove(struct wl_hash_table *ht, uint32_t hash) -{ - struct hash_entry *entry; - - entry = hash_table_search(ht, hash); - if (entry != NULL) { - entry->data = (void *) &deleted_data; - ht->entries--; - ht->deleted_entries++; - } -} diff --git a/src/3rdparty/wayland/wayland-protocol.c b/src/3rdparty/wayland/wayland-protocol.c deleted file mode 100644 index afcd2c9d3ee..00000000000 --- a/src/3rdparty/wayland/wayland-protocol.c +++ /dev/null @@ -1,214 +0,0 @@ -/* - * Copyright © 2010 Kristian Høgsberg - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting documentation, and - * that the name of the copyright holders not be used in advertising or - * publicity pertaining to distribution of the software without specific, - * written prior permission. The copyright holders make no representations - * about the suitability of this software for any purpose. It is provided "as - * is" without express or implied warranty. - * - * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - - -#include -#include -#include "wayland-util.h" - -static const struct wl_message wl_display_requests[] = { - { "bind", "usu" }, - { "sync", "u" }, - { "frame", "ou" }, -}; - -static const struct wl_message wl_display_events[] = { - { "invalid_object", "u" }, - { "invalid_method", "uu" }, - { "no_memory", "" }, - { "global", "nsu" }, - { "range", "u" }, - { "key", "uu" }, -}; - -WL_EXPORT const struct wl_interface wl_display_interface = { - "wl_display", 1, - ARRAY_LENGTH(wl_display_requests), wl_display_requests, - ARRAY_LENGTH(wl_display_events), wl_display_events, -}; - -static const struct wl_message wl_compositor_requests[] = { - { "create_surface", "n" }, -}; - -WL_EXPORT const struct wl_interface wl_compositor_interface = { - "wl_compositor", 1, - ARRAY_LENGTH(wl_compositor_requests), wl_compositor_requests, - 0, NULL, -}; - -static const struct wl_message wl_shm_requests[] = { - { "create_buffer", "nhiiuo" }, -}; - -WL_EXPORT const struct wl_interface wl_shm_interface = { - "wl_shm", 1, - ARRAY_LENGTH(wl_shm_requests), wl_shm_requests, - 0, NULL, -}; - -static const struct wl_message wl_buffer_requests[] = { - { "damage", "iiii" }, - { "destroy", "" }, -}; - -WL_EXPORT const struct wl_interface wl_buffer_interface = { - "wl_buffer", 1, - ARRAY_LENGTH(wl_buffer_requests), wl_buffer_requests, - 0, NULL, -}; - -static const struct wl_message wl_shell_requests[] = { - { "move", "oou" }, - { "resize", "oouu" }, - { "create_drag", "n" }, - { "create_selection", "n" }, -}; - -static const struct wl_message wl_shell_events[] = { - { "configure", "uuoii" }, -}; - -WL_EXPORT const struct wl_interface wl_shell_interface = { - "wl_shell", 1, - ARRAY_LENGTH(wl_shell_requests), wl_shell_requests, - ARRAY_LENGTH(wl_shell_events), wl_shell_events, -}; - -static const struct wl_message wl_selection_requests[] = { - { "offer", "s" }, - { "activate", "ou" }, - { "destroy", "" }, -}; - -static const struct wl_message wl_selection_events[] = { - { "send", "sh" }, - { "cancelled", "" }, -}; - -WL_EXPORT const struct wl_interface wl_selection_interface = { - "wl_selection", 1, - ARRAY_LENGTH(wl_selection_requests), wl_selection_requests, - ARRAY_LENGTH(wl_selection_events), wl_selection_events, -}; - -static const struct wl_message wl_selection_offer_requests[] = { - { "receive", "sh" }, -}; - -static const struct wl_message wl_selection_offer_events[] = { - { "offer", "s" }, - { "keyboard_focus", "o" }, -}; - -WL_EXPORT const struct wl_interface wl_selection_offer_interface = { - "wl_selection_offer", 1, - ARRAY_LENGTH(wl_selection_offer_requests), wl_selection_offer_requests, - ARRAY_LENGTH(wl_selection_offer_events), wl_selection_offer_events, -}; - -static const struct wl_message wl_drag_requests[] = { - { "offer", "s" }, - { "activate", "oou" }, - { "destroy", "" }, -}; - -static const struct wl_message wl_drag_events[] = { - { "target", "s" }, - { "finish", "h" }, - { "reject", "" }, -}; - -WL_EXPORT const struct wl_interface wl_drag_interface = { - "wl_drag", 1, - ARRAY_LENGTH(wl_drag_requests), wl_drag_requests, - ARRAY_LENGTH(wl_drag_events), wl_drag_events, -}; - -static const struct wl_message wl_drag_offer_requests[] = { - { "accept", "us" }, - { "receive", "h" }, - { "reject", "" }, -}; - -static const struct wl_message wl_drag_offer_events[] = { - { "offer", "s" }, - { "pointer_focus", "uoiiii" }, - { "motion", "uiiii" }, - { "drop", "" }, -}; - -WL_EXPORT const struct wl_interface wl_drag_offer_interface = { - "wl_drag_offer", 1, - ARRAY_LENGTH(wl_drag_offer_requests), wl_drag_offer_requests, - ARRAY_LENGTH(wl_drag_offer_events), wl_drag_offer_events, -}; - -static const struct wl_message wl_surface_requests[] = { - { "destroy", "" }, - { "attach", "oii" }, - { "map_toplevel", "" }, - { "map_transient", "oiiu" }, - { "map_fullscreen", "" }, - { "damage", "iiii" }, -}; - -WL_EXPORT const struct wl_interface wl_surface_interface = { - "wl_surface", 1, - ARRAY_LENGTH(wl_surface_requests), wl_surface_requests, - 0, NULL, -}; - -static const struct wl_message wl_input_device_requests[] = { - { "attach", "uoii" }, -}; - -static const struct wl_message wl_input_device_events[] = { - { "motion", "uiiii" }, - { "button", "uuu" }, - { "key", "uuu" }, - { "pointer_focus", "uoiiii" }, - { "keyboard_focus", "uoa" }, -}; - -WL_EXPORT const struct wl_interface wl_input_device_interface = { - "wl_input_device", 1, - ARRAY_LENGTH(wl_input_device_requests), wl_input_device_requests, - ARRAY_LENGTH(wl_input_device_events), wl_input_device_events, -}; - -static const struct wl_message wl_output_events[] = { - { "geometry", "iiii" }, -}; - -WL_EXPORT const struct wl_interface wl_output_interface = { - "wl_output", 1, - 0, NULL, - ARRAY_LENGTH(wl_output_events), wl_output_events, -}; - -WL_EXPORT const struct wl_interface wl_visual_interface = { - "wl_visual", 1, - 0, NULL, - 0, NULL, -}; - diff --git a/src/3rdparty/wayland/wayland-server-protocol.h b/src/3rdparty/wayland/wayland-server-protocol.h deleted file mode 100644 index bd6f91c9822..00000000000 --- a/src/3rdparty/wayland/wayland-server-protocol.h +++ /dev/null @@ -1,258 +0,0 @@ -/* - * Copyright © 2010 Kristian Høgsberg - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting documentation, and - * that the name of the copyright holders not be used in advertising or - * publicity pertaining to distribution of the software without specific, - * written prior permission. The copyright holders make no representations - * about the suitability of this software for any purpose. It is provided "as - * is" without express or implied warranty. - * - * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - - -#ifndef WAYLAND_SERVER_PROTOCOL_H -#define WAYLAND_SERVER_PROTOCOL_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include -#include "wayland-util.h" - -struct wl_client; - -struct wl_display; -struct wl_compositor; -struct wl_shm; -struct wl_buffer; -struct wl_shell; -struct wl_selection; -struct wl_selection_offer; -struct wl_drag; -struct wl_drag_offer; -struct wl_surface; -struct wl_input_device; -struct wl_output; -struct wl_visual; - -extern const struct wl_interface wl_display_interface; -extern const struct wl_interface wl_compositor_interface; -extern const struct wl_interface wl_shm_interface; -extern const struct wl_interface wl_buffer_interface; -extern const struct wl_interface wl_shell_interface; -extern const struct wl_interface wl_selection_interface; -extern const struct wl_interface wl_selection_offer_interface; -extern const struct wl_interface wl_drag_interface; -extern const struct wl_interface wl_drag_offer_interface; -extern const struct wl_interface wl_surface_interface; -extern const struct wl_interface wl_input_device_interface; -extern const struct wl_interface wl_output_interface; -extern const struct wl_interface wl_visual_interface; - -struct wl_display_interface { - void (*bind)(struct wl_client *client, - struct wl_display *wl_display, - uint32_t id, - const char *interface, - uint32_t version); - void (*sync)(struct wl_client *client, - struct wl_display *wl_display, - uint32_t key); - void (*frame)(struct wl_client *client, - struct wl_display *wl_display, - struct wl_surface *surface, - uint32_t key); -}; - -#define WL_DISPLAY_INVALID_OBJECT 0 -#define WL_DISPLAY_INVALID_METHOD 1 -#define WL_DISPLAY_NO_MEMORY 2 -#define WL_DISPLAY_GLOBAL 3 -#define WL_DISPLAY_RANGE 4 -#define WL_DISPLAY_KEY 5 - -struct wl_compositor_interface { - void (*create_surface)(struct wl_client *client, - struct wl_compositor *wl_compositor, - uint32_t id); -}; - -struct wl_shm_interface { - void (*create_buffer)(struct wl_client *client, - struct wl_shm *wl_shm, - uint32_t id, - int fd, - int width, - int height, - uint32_t stride, - struct wl_visual *visual); -}; - -struct wl_buffer_interface { - void (*damage)(struct wl_client *client, - struct wl_buffer *wl_buffer, - int x, - int y, - int width, - int height); - void (*destroy)(struct wl_client *client, - struct wl_buffer *wl_buffer); -}; - -#ifndef WL_SHELL_RESIZE_ENUM -#define WL_SHELL_RESIZE_ENUM -enum wl_shell_resize { - WL_SHELL_RESIZE_NONE = 0, - WL_SHELL_RESIZE_TOP = 1, - WL_SHELL_RESIZE_BOTTOM = 2, - WL_SHELL_RESIZE_LEFT = 4, - WL_SHELL_RESIZE_TOP_LEFT = 5, - WL_SHELL_RESIZE_BOTTOM_LEFT = 6, - WL_SHELL_RESIZE_RIGHT = 8, - WL_SHELL_RESIZE_TOP_RIGHT = 9, - WL_SHELL_RESIZE_BOTTOM_RIGHT = 10, -}; -#endif /* WL_SHELL_RESIZE_ENUM */ - -struct wl_shell_interface { - void (*move)(struct wl_client *client, - struct wl_shell *wl_shell, - struct wl_surface *surface, - struct wl_input_device *input_device, - uint32_t time); - void (*resize)(struct wl_client *client, - struct wl_shell *wl_shell, - struct wl_surface *surface, - struct wl_input_device *input_device, - uint32_t time, - uint32_t edges); - void (*create_drag)(struct wl_client *client, - struct wl_shell *wl_shell, - uint32_t id); - void (*create_selection)(struct wl_client *client, - struct wl_shell *wl_shell, - uint32_t id); -}; - -#define WL_SHELL_CONFIGURE 0 - -struct wl_selection_interface { - void (*offer)(struct wl_client *client, - struct wl_selection *wl_selection, - const char *type); - void (*activate)(struct wl_client *client, - struct wl_selection *wl_selection, - struct wl_input_device *input_device, - uint32_t time); - void (*destroy)(struct wl_client *client, - struct wl_selection *wl_selection); -}; - -#define WL_SELECTION_SEND 0 -#define WL_SELECTION_CANCELLED 1 - -struct wl_selection_offer_interface { - void (*receive)(struct wl_client *client, - struct wl_selection_offer *wl_selection_offer, - const char *mime_type, - int fd); -}; - -#define WL_SELECTION_OFFER_OFFER 0 -#define WL_SELECTION_OFFER_KEYBOARD_FOCUS 1 - -struct wl_drag_interface { - void (*offer)(struct wl_client *client, - struct wl_drag *wl_drag, - const char *type); - void (*activate)(struct wl_client *client, - struct wl_drag *wl_drag, - struct wl_surface *surface, - struct wl_input_device *input_device, - uint32_t time); - void (*destroy)(struct wl_client *client, - struct wl_drag *wl_drag); -}; - -#define WL_DRAG_TARGET 0 -#define WL_DRAG_FINISH 1 -#define WL_DRAG_REJECT 2 - -struct wl_drag_offer_interface { - void (*accept)(struct wl_client *client, - struct wl_drag_offer *wl_drag_offer, - uint32_t time, - const char *type); - void (*receive)(struct wl_client *client, - struct wl_drag_offer *wl_drag_offer, - int fd); - void (*reject)(struct wl_client *client, - struct wl_drag_offer *wl_drag_offer); -}; - -#define WL_DRAG_OFFER_OFFER 0 -#define WL_DRAG_OFFER_POINTER_FOCUS 1 -#define WL_DRAG_OFFER_MOTION 2 -#define WL_DRAG_OFFER_DROP 3 - -struct wl_surface_interface { - void (*destroy)(struct wl_client *client, - struct wl_surface *wl_surface); - void (*attach)(struct wl_client *client, - struct wl_surface *wl_surface, - struct wl_buffer *buffer, - int x, - int y); - void (*map_toplevel)(struct wl_client *client, - struct wl_surface *wl_surface); - void (*map_transient)(struct wl_client *client, - struct wl_surface *wl_surface, - struct wl_surface *parent, - int x, - int y, - uint32_t flags); - void (*map_fullscreen)(struct wl_client *client, - struct wl_surface *wl_surface); - void (*damage)(struct wl_client *client, - struct wl_surface *wl_surface, - int x, - int y, - int width, - int height); -}; - -struct wl_input_device_interface { - void (*attach)(struct wl_client *client, - struct wl_input_device *wl_input_device, - uint32_t time, - struct wl_buffer *buffer, - int hotspot_x, - int hotspot_y); -}; - -#define WL_INPUT_DEVICE_MOTION 0 -#define WL_INPUT_DEVICE_BUTTON 1 -#define WL_INPUT_DEVICE_KEY 2 -#define WL_INPUT_DEVICE_POINTER_FOCUS 3 -#define WL_INPUT_DEVICE_KEYBOARD_FOCUS 4 - -#define WL_OUTPUT_GEOMETRY 0 - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/src/3rdparty/wayland/wayland-server.c b/src/3rdparty/wayland/wayland-server.c deleted file mode 100644 index d9f14adf462..00000000000 --- a/src/3rdparty/wayland/wayland-server.c +++ /dev/null @@ -1,826 +0,0 @@ -/* - * Copyright © 2008 Kristian Høgsberg - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting documentation, and - * that the name of the copyright holders not be used in advertising or - * publicity pertaining to distribution of the software without specific, - * written prior permission. The copyright holders make no representations - * about the suitability of this software for any purpose. It is provided "as - * is" without express or implied warranty. - * - * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#define _GNU_SOURCE - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "wayland-server.h" -#include "wayland-server-protocol.h" -#include "connection.h" - -struct wl_socket { - int fd; - int fd_lock; - struct sockaddr_un addr; - char lock_addr[113]; - struct wl_list link; -}; - -struct wl_client { - struct wl_connection *connection; - struct wl_event_source *source; - struct wl_display *display; - struct wl_list resource_list; - uint32_t id_count; -}; - -struct wl_display { - struct wl_object object; - struct wl_event_loop *loop; - struct wl_hash_table *objects; - int run; - - struct wl_list frame_list; - uint32_t client_id_range; - uint32_t id; - - struct wl_list global_list; - struct wl_list socket_list; -}; - -struct wl_frame_listener { - struct wl_resource resource; - struct wl_client *client; - uint32_t key; - struct wl_surface *surface; - struct wl_list link; -}; - -struct wl_global { - struct wl_object *object; - wl_global_bind_func_t func; - struct wl_list link; -}; - -static int wl_debug = 0; - -WL_EXPORT void -wl_client_post_event(struct wl_client *client, struct wl_object *sender, - uint32_t opcode, ...) -{ - struct wl_closure *closure; - va_list ap; - - va_start(ap, opcode); - closure = wl_connection_vmarshal(client->connection, - sender, opcode, ap, - &sender->interface->events[opcode]); - va_end(ap); - - wl_closure_send(closure, client->connection); - - if (wl_debug) { - fprintf(stderr, " -> "); - wl_closure_print(closure, sender); - } - - wl_closure_destroy(closure); -} - -static int -wl_client_connection_data(int fd, uint32_t mask, void *data) -{ - struct wl_client *client = data; - struct wl_connection *connection = client->connection; - struct wl_object *object; - struct wl_closure *closure; - const struct wl_message *message; - uint32_t p[2], opcode, size; - uint32_t cmask = 0; - int len; - - if (mask & WL_EVENT_READABLE) - cmask |= WL_CONNECTION_READABLE; - if (mask & WL_EVENT_WRITEABLE) - cmask |= WL_CONNECTION_WRITABLE; - - len = wl_connection_data(connection, cmask); - if (len < 0) { - wl_client_destroy(client); - return 1; - } - - while (len >= sizeof p) { - wl_connection_copy(connection, p, sizeof p); - opcode = p[1] & 0xffff; - size = p[1] >> 16; - if (len < size) - break; - - object = wl_hash_table_lookup(client->display->objects, p[0]); - if (object == NULL) { - wl_client_post_event(client, &client->display->object, - WL_DISPLAY_INVALID_OBJECT, p[0]); - wl_connection_consume(connection, size); - len -= size; - continue; - } - - if (opcode >= object->interface->method_count) { - wl_client_post_event(client, &client->display->object, - WL_DISPLAY_INVALID_METHOD, p[0], opcode); - wl_connection_consume(connection, size); - len -= size; - continue; - } - - message = &object->interface->methods[opcode]; - closure = wl_connection_demarshal(client->connection, size, - client->display->objects, - message); - len -= size; - - if (closure == NULL && errno == EINVAL) { - wl_client_post_event(client, &client->display->object, - WL_DISPLAY_INVALID_METHOD, - p[0], opcode); - continue; - } else if (closure == NULL && errno == ENOMEM) { - wl_client_post_no_memory(client); - continue; - } - - - if (wl_debug) - wl_closure_print(closure, object); - - wl_closure_invoke(closure, object, - object->implementation[opcode], client); - - wl_closure_destroy(closure); - } - - return 1; -} - -static int -wl_client_connection_update(struct wl_connection *connection, - uint32_t mask, void *data) -{ - struct wl_client *client = data; - uint32_t emask = 0; - - if (mask & WL_CONNECTION_READABLE) - emask |= WL_EVENT_READABLE; - if (mask & WL_CONNECTION_WRITABLE) - emask |= WL_EVENT_WRITEABLE; - - return wl_event_source_fd_update(client->source, emask); -} - -WL_EXPORT struct wl_display * -wl_client_get_display(struct wl_client *client) -{ - return client->display; -} - -static void -wl_display_post_range(struct wl_display *display, struct wl_client *client) -{ - wl_client_post_event(client, &client->display->object, - WL_DISPLAY_RANGE, display->client_id_range); - display->client_id_range += 256; - client->id_count += 256; -} - -WL_EXPORT struct wl_client * -wl_client_create(struct wl_display *display, int fd) -{ - struct wl_client *client; - struct wl_global *global; - - client = malloc(sizeof *client); - if (client == NULL) - return NULL; - - memset(client, 0, sizeof *client); - client->display = display; - client->source = wl_event_loop_add_fd(display->loop, fd, - WL_EVENT_READABLE, - wl_client_connection_data, client); - client->connection = - wl_connection_create(fd, wl_client_connection_update, client); - if (client->connection == NULL) { - free(client); - return NULL; - } - - wl_list_init(&client->resource_list); - - wl_display_post_range(display, client); - - wl_list_for_each(global, &display->global_list, link) - wl_client_post_global(client, global->object); - - return client; -} - -WL_EXPORT void -wl_client_add_resource(struct wl_client *client, - struct wl_resource *resource) -{ - struct wl_display *display = client->display; - - if (client->id_count-- < 64) - wl_display_post_range(display, client); - - wl_hash_table_insert(client->display->objects, - resource->object.id, resource); - wl_list_insert(client->resource_list.prev, &resource->link); -} - -WL_EXPORT void -wl_client_post_no_memory(struct wl_client *client) -{ - wl_client_post_event(client, - &client->display->object, - WL_DISPLAY_NO_MEMORY); -} - -WL_EXPORT void -wl_client_post_global(struct wl_client *client, struct wl_object *object) -{ - wl_client_post_event(client, - &client->display->object, - WL_DISPLAY_GLOBAL, - object, - object->interface->name, - object->interface->version); -} - -WL_EXPORT void -wl_resource_destroy(struct wl_resource *resource, struct wl_client *client) -{ - struct wl_display *display = client->display; - - wl_list_remove(&resource->link); - if (resource->object.id > 0) - wl_hash_table_remove(display->objects, resource->object.id); - resource->destroy(resource, client); -} - -WL_EXPORT void -wl_client_destroy(struct wl_client *client) -{ - struct wl_resource *resource, *tmp; - - printf("disconnect from client %p\n", client); - - wl_list_for_each_safe(resource, tmp, &client->resource_list, link) - wl_resource_destroy(resource, client); - - wl_event_source_remove(client->source); - wl_connection_destroy(client->connection); - free(client); -} - -static void -lose_pointer_focus(struct wl_listener *listener, - struct wl_surface *surface, uint32_t time) -{ - struct wl_input_device *device = - container_of(listener, struct wl_input_device, - pointer_focus_listener); - - wl_input_device_set_pointer_focus(device, NULL, time, 0, 0, 0, 0); -} - -static void -lose_keyboard_focus(struct wl_listener *listener, - struct wl_surface *surface, uint32_t time) -{ - struct wl_input_device *device = - container_of(listener, struct wl_input_device, - keyboard_focus_listener); - - wl_input_device_set_keyboard_focus(device, NULL, time); -} - -WL_EXPORT void -wl_input_device_init(struct wl_input_device *device, - struct wl_compositor *compositor) -{ - wl_list_init(&device->pointer_focus_listener.link); - device->pointer_focus_listener.func = lose_pointer_focus; - wl_list_init(&device->keyboard_focus_listener.link); - device->keyboard_focus_listener.func = lose_keyboard_focus; - - device->x = 100; - device->y = 100; - device->compositor = compositor; -} - -WL_EXPORT void -wl_input_device_set_pointer_focus(struct wl_input_device *device, - struct wl_surface *surface, - uint32_t time, - int32_t x, int32_t y, - int32_t sx, int32_t sy) -{ - if (device->pointer_focus == surface) - return; - - if (device->pointer_focus && - (!surface || device->pointer_focus->client != surface->client)) - wl_client_post_event(device->pointer_focus->client, - &device->object, - WL_INPUT_DEVICE_POINTER_FOCUS, - time, NULL, 0, 0, 0, 0); - if (device->pointer_focus) - wl_list_remove(&device->pointer_focus_listener.link); - - if (surface) { - wl_client_post_event(surface->client, - &device->object, - WL_INPUT_DEVICE_POINTER_FOCUS, - time, surface, x, y, sx, sy); - wl_list_insert(surface->destroy_listener_list.prev, - &device->pointer_focus_listener.link); - } - - device->pointer_focus = surface; - device->pointer_focus_time = time; - -} - -WL_EXPORT void -wl_input_device_set_keyboard_focus(struct wl_input_device *device, - struct wl_surface *surface, - uint32_t time) -{ - if (device->keyboard_focus == surface) - return; - - if (device->keyboard_focus && - (!surface || device->keyboard_focus->client != surface->client)) - wl_client_post_event(device->keyboard_focus->client, - &device->object, - WL_INPUT_DEVICE_KEYBOARD_FOCUS, - time, NULL, &device->keys); - if (device->keyboard_focus) - wl_list_remove(&device->keyboard_focus_listener.link); - - if (surface) { - wl_client_post_event(surface->client, - &device->object, - WL_INPUT_DEVICE_KEYBOARD_FOCUS, - time, surface, &device->keys); - wl_list_insert(surface->destroy_listener_list.prev, - &device->keyboard_focus_listener.link); - } - - device->keyboard_focus = surface; - device->keyboard_focus_time = time; -} - -WL_EXPORT void -wl_input_device_end_grab(struct wl_input_device *device, uint32_t time) -{ - const struct wl_grab_interface *interface; - - interface = device->grab->interface; - interface->end(device->grab, time); - device->grab->input_device = NULL; - device->grab = NULL; - - wl_list_remove(&device->grab_listener.link); -} - -static void -lose_grab_surface(struct wl_listener *listener, - struct wl_surface *surface, uint32_t time) -{ - struct wl_input_device *device = - container_of(listener, - struct wl_input_device, grab_listener); - - wl_input_device_end_grab(device, time); -} - -WL_EXPORT void -wl_input_device_start_grab(struct wl_input_device *device, - struct wl_grab *grab, - uint32_t button, uint32_t time) -{ - struct wl_surface *focus = device->pointer_focus; - - device->grab = grab; - device->grab_button = button; - device->grab_time = time; - device->grab_x = device->x; - device->grab_y = device->y; - - device->grab_listener.func = lose_grab_surface; - wl_list_insert(focus->destroy_listener_list.prev, - &device->grab_listener.link); - - grab->input_device = device; -} - -WL_EXPORT int -wl_input_device_update_grab(struct wl_input_device *device, - struct wl_grab *grab, - struct wl_surface *surface, uint32_t time) -{ - if (device->grab != &device->motion_grab || - device->grab_time != time || - device->pointer_focus != surface) - return -1; - - device->grab = grab; - grab->input_device = device; - - return 0; -} - -static void -display_bind(struct wl_client *client, - struct wl_display *display, uint32_t id, - const char *interface, uint32_t version) -{ - struct wl_global *global; - - wl_list_for_each(global, &display->global_list, link) - if (global->object->id == id && global->func) - global->func(client, global->object, version); -} - -static void -display_sync(struct wl_client *client, - struct wl_display *display, uint32_t key) -{ - wl_client_post_event(client, &display->object, WL_DISPLAY_KEY, key, 0); -} - -static void -destroy_frame_listener(struct wl_resource *resource, struct wl_client *client) -{ - struct wl_frame_listener *listener = - container_of(resource, struct wl_frame_listener, resource); - - wl_list_remove(&listener->link); - free(listener); -} - -static void -display_frame(struct wl_client *client, - struct wl_display *display, - struct wl_surface *surface, - uint32_t key) -{ - struct wl_frame_listener *listener; - - listener = malloc(sizeof *listener); - if (listener == NULL) { - wl_client_post_no_memory(client); - return; - } - - /* The listener is a resource so we destroy it when the client - * goes away. */ - listener->resource.destroy = destroy_frame_listener; - listener->resource.object.id = 0; - listener->client = client; - listener->key = key; - listener->surface = surface; - wl_list_insert(client->resource_list.prev, &listener->resource.link); - wl_list_insert(display->frame_list.prev, &listener->link); -} - -struct wl_display_interface display_interface = { - display_bind, - display_sync, - display_frame -}; - - -WL_EXPORT struct wl_display * -wl_display_create(void) -{ - struct wl_display *display; - const char *debug; - - debug = getenv("WAYLAND_DEBUG"); - if (debug) - wl_debug = 1; - - display = malloc(sizeof *display); - if (display == NULL) - return NULL; - - display->loop = wl_event_loop_create(); - if (display->loop == NULL) { - free(display); - return NULL; - } - - display->objects = wl_hash_table_create(); - if (display->objects == NULL) { - wl_event_loop_destroy(display->loop); - free(display); - return NULL; - } - - wl_list_init(&display->frame_list); - wl_list_init(&display->global_list); - wl_list_init(&display->socket_list); - - display->client_id_range = 256; /* Gah, arbitrary... */ - - display->id = 1; - display->object.interface = &wl_display_interface; - display->object.implementation = (void (**)(void)) &display_interface; - wl_display_add_object(display, &display->object); - if (wl_display_add_global(display, &display->object, NULL)) { - wl_hash_table_destroy(display->objects); - wl_event_loop_destroy(display->loop); - free(display); - return NULL; - } - - return display; -} - -WL_EXPORT void -wl_display_destroy(struct wl_display *display) -{ - struct wl_socket *s, *next; - - wl_event_loop_destroy(display->loop); - wl_hash_table_destroy(display->objects); - - wl_list_for_each_safe(s, next, &display->socket_list, link) { - close(s->fd); - unlink(s->addr.sun_path); - close(s->fd_lock); - unlink(s->lock_addr); - free(s); - } - - free(display); -} - -WL_EXPORT void -wl_display_add_object(struct wl_display *display, struct wl_object *object) -{ - object->id = display->id++; - wl_hash_table_insert(display->objects, object->id, object); -} - -WL_EXPORT int -wl_display_add_global(struct wl_display *display, - struct wl_object *object, wl_global_bind_func_t func) -{ - struct wl_global *global; - - global = malloc(sizeof *global); - if (global == NULL) - return -1; - - global->object = object; - global->func = func; - wl_list_insert(display->global_list.prev, &global->link); - - return 0; -} - -WL_EXPORT void -wl_display_post_frame(struct wl_display *display, struct wl_surface *surface, - uint32_t time) -{ - struct wl_frame_listener *listener, *next; - - wl_list_for_each_safe(listener, next, &display->frame_list, link) { - if (listener->surface != surface) - continue; - wl_client_post_event(listener->client, &display->object, - WL_DISPLAY_KEY, listener->key, time); - wl_resource_destroy(&listener->resource, listener->client); - } -} - -WL_EXPORT struct wl_event_loop * -wl_display_get_event_loop(struct wl_display *display) -{ - return display->loop; -} - -WL_EXPORT void -wl_display_terminate(struct wl_display *display) -{ - display->run = 0; -} - -WL_EXPORT void -wl_display_run(struct wl_display *display) -{ - display->run = 1; - - while (display->run) - wl_event_loop_dispatch(display->loop, -1); -} - -static int -socket_data(int fd, uint32_t mask, void *data) -{ - struct wl_display *display = data; - struct sockaddr_un name; - socklen_t length; - int client_fd; - - length = sizeof name; - client_fd = -// accept4(fd, (struct sockaddr *) &name, &length, SOCK_CLOEXEC); - accept (fd, (struct sockaddr *) &name, &length); - if (client_fd < 0) - fprintf(stderr, "failed to accept: %m\n"); - - wl_client_create(display, client_fd); - - return 1; -} - -static int -get_socket_lock(struct wl_socket *socket, socklen_t name_size) -{ - struct stat socket_stat; - int lock_size = name_size + 5; - - snprintf(socket->lock_addr, lock_size, - "%s.lock", socket->addr.sun_path); - - socket->fd_lock = open(socket->lock_addr, O_CREAT | O_CLOEXEC, - (S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP)); - - if (socket->fd_lock < 0) { - fprintf(stderr, - "unable to open lockfile %s check permissions\n", - socket->lock_addr); - return -1; - } - - if (flock(socket->fd_lock, LOCK_EX | LOCK_NB) < 0) { - fprintf(stderr, - "unable to lock lockfile %s, maybe another compositor is running\n", - socket->lock_addr); - close(socket->fd_lock); - return -1; - } - - if (stat(socket->addr.sun_path, &socket_stat) < 0 ) { - if (errno != ENOENT) { - fprintf(stderr, "did not manage to stat file %s\n", - socket->addr.sun_path); - close(socket->fd_lock); - return -1; - } - } else if (socket_stat.st_mode & S_IWUSR || - socket_stat.st_mode & S_IWGRP) { - unlink(socket->addr.sun_path); - } - - return 0; -} - -WL_EXPORT int -wl_display_add_socket(struct wl_display *display, const char *name) -{ - struct wl_socket *s; - socklen_t size, name_size; - const char *runtime_dir; - - s = malloc(sizeof *s); - if (s == NULL) - return -1; - - s->fd = socket(PF_LOCAL, SOCK_STREAM | SOCK_CLOEXEC, 0); - if (s->fd < 0) { - free(s); - return -1; - } - - runtime_dir = getenv("XDG_RUNTIME_DIR"); - if (runtime_dir == NULL) { - runtime_dir = "."; - fprintf(stderr, - "XDG_RUNTIME_DIR not set, falling back to %s\n", - runtime_dir); - } - - if (name == NULL) - name = getenv("WAYLAND_DISPLAY"); - if (name == NULL) - name = "wayland-0"; - - memset(&s->addr, 0, sizeof s->addr); - s->addr.sun_family = AF_LOCAL; - name_size = snprintf(s->addr.sun_path, sizeof s->addr.sun_path, - "%s/%s", runtime_dir, name) + 1; - fprintf(stderr, "using socket %s\n", s->addr.sun_path); - - if (get_socket_lock(s,name_size) < 0) { - close(s->fd); - free(s); - return -1; - } - - size = offsetof (struct sockaddr_un, sun_path) + name_size; - if (bind(s->fd, (struct sockaddr *) &s->addr, size) < 0) { - close(s->fd); - free(s); - return -1; - } - - if (listen(s->fd, 1) < 0) { - close(s->fd); - unlink(s->addr.sun_path); - free(s); - return -1; - } - - if (wl_event_loop_add_fd(display->loop, s->fd, - WL_EVENT_READABLE, - socket_data, display) == NULL) { - close(s->fd); - unlink(s->addr.sun_path); - free(s); - return -1; - } - wl_list_insert(display->socket_list.prev, &s->link); - - return 0; -} - -WL_EXPORT int -wl_compositor_init(struct wl_compositor *compositor, - const struct wl_compositor_interface *interface, - struct wl_display *display) -{ - compositor->object.interface = &wl_compositor_interface; - compositor->object.implementation = (void (**)(void)) interface; - wl_display_add_object(display, &compositor->object); - if (wl_display_add_global(display, &compositor->object, NULL)) - return -1; - - compositor->argb_visual.object.interface = &wl_visual_interface; - compositor->argb_visual.object.implementation = NULL; - wl_display_add_object(display, &compositor->argb_visual.object); - if (wl_display_add_global(display, &compositor->argb_visual.object, NULL)) - return -1; - - compositor->premultiplied_argb_visual.object.interface = - &wl_visual_interface; - compositor->premultiplied_argb_visual.object.implementation = NULL; - wl_display_add_object(display, - &compositor->premultiplied_argb_visual.object); - if (wl_display_add_global(display, - &compositor->premultiplied_argb_visual.object, - NULL)) - return -1; - - compositor->rgb_visual.object.interface = &wl_visual_interface; - compositor->rgb_visual.object.implementation = NULL; - wl_display_add_object(display, - &compositor->rgb_visual.object); - if (wl_display_add_global(display, - &compositor->rgb_visual.object, NULL)) - return -1; - - return 0; -} diff --git a/src/3rdparty/wayland/wayland-server.h b/src/3rdparty/wayland/wayland-server.h deleted file mode 100644 index 649bb6b0b4d..00000000000 --- a/src/3rdparty/wayland/wayland-server.h +++ /dev/null @@ -1,299 +0,0 @@ -/* - * Copyright © 2008 Kristian Høgsberg - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting documentation, and - * that the name of the copyright holders not be used in advertising or - * publicity pertaining to distribution of the software without specific, - * written prior permission. The copyright holders make no representations - * about the suitability of this software for any purpose. It is provided "as - * is" without express or implied warranty. - * - * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#ifndef WAYLAND_H -#define WAYLAND_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include "wayland-util.h" -#include "wayland-server-protocol.h" - -enum { - WL_EVENT_READABLE = 0x01, - WL_EVENT_WRITEABLE = 0x02 -}; - -struct wl_event_loop; -struct wl_event_source; -typedef int (*wl_event_loop_fd_func_t)(int fd, uint32_t mask, void *data); -typedef int (*wl_event_loop_timer_func_t)(void *data); -typedef int (*wl_event_loop_signal_func_t)(int signal_number, void *data); -typedef void (*wl_event_loop_idle_func_t)(void *data); - -struct wl_event_loop *wl_event_loop_create(void); -void wl_event_loop_destroy(struct wl_event_loop *loop); -struct wl_event_source *wl_event_loop_add_fd(struct wl_event_loop *loop, - int fd, uint32_t mask, - wl_event_loop_fd_func_t func, - void *data); -int wl_event_source_fd_update(struct wl_event_source *source, uint32_t mask); -struct wl_event_source *wl_event_loop_add_timer(struct wl_event_loop *loop, - wl_event_loop_timer_func_t func, - void *data); -struct wl_event_source * -wl_event_loop_add_signal(struct wl_event_loop *loop, - int signal_number, - wl_event_loop_signal_func_t func, - void *data); - -int wl_event_source_timer_update(struct wl_event_source *source, - int ms_delay); -int wl_event_source_remove(struct wl_event_source *source); -void wl_event_source_check(struct wl_event_source *source); - - -int wl_event_loop_dispatch(struct wl_event_loop *loop, int timeout); -struct wl_event_source *wl_event_loop_add_idle(struct wl_event_loop *loop, - wl_event_loop_idle_func_t func, - void *data); -int wl_event_loop_get_fd(struct wl_event_loop *loop); - -struct wl_client; -struct wl_display; -struct wl_input_device; - -struct wl_display *wl_display_create(void); -void wl_display_destroy(struct wl_display *display); -struct wl_event_loop *wl_display_get_event_loop(struct wl_display *display); -int wl_display_add_socket(struct wl_display *display, const char *name); -void wl_display_terminate(struct wl_display *display); -void wl_display_run(struct wl_display *display); - -void wl_display_add_object(struct wl_display *display, - struct wl_object *object); - -typedef void (*wl_global_bind_func_t)(struct wl_client *client, - struct wl_object *global, - uint32_t version); - -int wl_display_add_global(struct wl_display *display, - struct wl_object *object, - wl_global_bind_func_t func); - -struct wl_client *wl_client_create(struct wl_display *display, int fd); -void wl_client_destroy(struct wl_client *client); -void wl_client_post_no_memory(struct wl_client *client); -void wl_client_post_global(struct wl_client *client, struct wl_object *object); - -struct wl_visual { - struct wl_object object; -}; - -struct wl_shm_callbacks { - void (*buffer_created)(struct wl_buffer *buffer); - - void (*buffer_damaged)(struct wl_buffer *buffer, - int32_t x, int32_t y, - int32_t width, int32_t height); - - void (*buffer_destroyed)(struct wl_buffer *buffer); -}; - -struct wl_compositor { - struct wl_object object; - struct wl_visual argb_visual; - struct wl_visual premultiplied_argb_visual; - struct wl_visual rgb_visual; -}; - -struct wl_resource { - struct wl_object object; - void (*destroy)(struct wl_resource *resource, - struct wl_client *client); - struct wl_list link; -}; - -struct wl_buffer { - struct wl_resource resource; - struct wl_compositor *compositor; - struct wl_visual *visual; - int32_t width, height; - void *user_data; -}; - -struct wl_listener { - struct wl_list link; - void (*func)(struct wl_listener *listener, - struct wl_surface *surface, uint32_t time); -}; - -struct wl_surface { - struct wl_resource resource; - struct wl_client *client; - struct wl_list destroy_listener_list; -}; - -struct wl_grab; -struct wl_grab_interface { - void (*motion)(struct wl_grab *grab, - uint32_t time, int32_t x, int32_t y); - void (*button)(struct wl_grab *grab, - uint32_t time, int32_t button, int32_t state); - void (*end)(struct wl_grab *grab, uint32_t time); -}; - -struct wl_grab { - const struct wl_grab_interface *interface; - struct wl_input_device *input_device; -}; - -struct wl_input_device { - struct wl_object object; - struct wl_compositor *compositor; - struct wl_surface *pointer_focus; - struct wl_surface *keyboard_focus; - struct wl_array keys; - uint32_t pointer_focus_time; - uint32_t keyboard_focus_time; - struct wl_listener pointer_focus_listener; - struct wl_listener keyboard_focus_listener; - - int32_t x, y; - struct wl_grab *grab; - struct wl_grab motion_grab; - uint32_t grab_time; - int32_t grab_x, grab_y; - uint32_t grab_button; - struct wl_listener grab_listener; -}; - -struct wl_drag_offer { - struct wl_object object; -}; - -struct wl_drag { - struct wl_resource resource; - struct wl_grab grab; - struct wl_drag_offer drag_offer; - struct wl_surface *source; - struct wl_surface *drag_focus; - struct wl_client *target; - int32_t x, y, sx, sy; - struct wl_array types; - const char *type; - uint32_t pointer_focus_time; - struct wl_listener drag_focus_listener; -}; - -struct wl_selection_offer { - struct wl_object object; -}; - -struct wl_selection { - struct wl_resource resource; - struct wl_client *client; - struct wl_input_device *input_device; - struct wl_selection_offer selection_offer; - struct wl_surface *selection_focus; - struct wl_client *target; - struct wl_array types; - struct wl_listener selection_focus_listener; -}; - -void -wl_client_post_event(struct wl_client *client, - struct wl_object *sender, - uint32_t event, ...); - -int -wl_display_set_compositor(struct wl_display *display, - struct wl_compositor *compositor, - const struct wl_compositor_interface *implementation); - -void -wl_display_post_frame(struct wl_display *display, struct wl_surface *surface, - uint32_t msecs); - -void -wl_client_add_resource(struct wl_client *client, - struct wl_resource *resource); - -struct wl_display * -wl_client_get_display(struct wl_client *client); - -void -wl_resource_destroy(struct wl_resource *resource, struct wl_client *client); - -void -wl_input_device_init(struct wl_input_device *device, - struct wl_compositor *compositor); - -void -wl_input_device_set_pointer_focus(struct wl_input_device *device, - struct wl_surface *surface, - uint32_t time, - int32_t x, int32_t y, - int32_t sx, int32_t sy); - -void -wl_input_device_set_keyboard_focus(struct wl_input_device *device, - struct wl_surface *surface, - uint32_t time); - -void -wl_input_device_end_grab(struct wl_input_device *device, uint32_t time); -void -wl_input_device_start_grab(struct wl_input_device *device, - struct wl_grab *grab, - uint32_t button, uint32_t time); -int -wl_input_device_update_grab(struct wl_input_device *device, - struct wl_grab *grab, - struct wl_surface *surface, uint32_t time); - -struct wl_shm; - -void * -wl_shm_buffer_get_data(struct wl_buffer *buffer); - -int32_t -wl_shm_buffer_get_stride(struct wl_buffer *buffer); - -struct wl_buffer * -wl_shm_buffer_create(struct wl_shm *shm, int width, int height, - int stride, struct wl_visual *visual, - void *data); - -int -wl_buffer_is_shm(struct wl_buffer *buffer); - -struct wl_shm * -wl_shm_init(struct wl_display *display, - const struct wl_shm_callbacks *callbacks); - -void -wl_shm_finish(struct wl_shm *shm); - -int -wl_compositor_init(struct wl_compositor *compositor, - const struct wl_compositor_interface *interface, - struct wl_display *display); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/src/3rdparty/wayland/wayland-shm.c b/src/3rdparty/wayland/wayland-shm.c deleted file mode 100644 index 5f46293fc29..00000000000 --- a/src/3rdparty/wayland/wayland-shm.c +++ /dev/null @@ -1,228 +0,0 @@ -/* - * Copyright © 2008 Kristian Høgsberg - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting documentation, and - * that the name of the copyright holders not be used in advertising or - * publicity pertaining to distribution of the software without specific, - * written prior permission. The copyright holders make no representations - * about the suitability of this software for any purpose. It is provided "as - * is" without express or implied warranty. - * - * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - * - * Authors: - * Kristian Høgsberg - * Benjamin Franzke - * - */ - -#include -#include -#include -#include -#include - -#include "wayland-server.h" - -struct wl_shm { - struct wl_object object; - const struct wl_shm_callbacks *callbacks; -}; - -struct wl_shm_buffer { - struct wl_buffer buffer; - struct wl_shm *shm; - int32_t stride; - void *data; -}; - -static void -destroy_buffer(struct wl_resource *resource, struct wl_client *client) -{ - struct wl_shm_buffer *buffer = - container_of(resource, struct wl_shm_buffer, buffer.resource); - - munmap(buffer->data, buffer->stride * buffer->buffer.height); - - buffer->shm->callbacks->buffer_destroyed(&buffer->buffer); - - free(buffer); -} - -static void -shm_buffer_damage(struct wl_client *client, struct wl_buffer *buffer_base, - int32_t x, int32_t y, int32_t width, int32_t height) -{ - struct wl_shm_buffer *buffer = (struct wl_shm_buffer *) buffer_base; - - buffer->shm->callbacks->buffer_damaged(buffer_base, x, y, - width, height); -} - -static void -shm_buffer_destroy(struct wl_client *client, struct wl_buffer *buffer) -{ - wl_resource_destroy(&buffer->resource, client); -} - -const static struct wl_buffer_interface shm_buffer_interface = { - shm_buffer_damage, - shm_buffer_destroy -}; - -static struct wl_shm_buffer * -wl_shm_buffer_init(struct wl_shm *shm, uint32_t id, - int32_t width, int32_t height, - int32_t stride, struct wl_visual *visual, - void *data) -{ - struct wl_shm_buffer *buffer; - - buffer = malloc(sizeof *buffer); - if (buffer == NULL) - return NULL; - - buffer->buffer.width = width; - buffer->buffer.height = height; - buffer->buffer.visual = visual; - buffer->stride = stride; - buffer->data = data; - - buffer->buffer.resource.object.id = id; - buffer->buffer.resource.object.interface = &wl_buffer_interface; - buffer->buffer.resource.object.implementation = (void (**)(void)) - &shm_buffer_interface; - - buffer->buffer.resource.destroy = destroy_buffer; - - buffer->shm = shm; - - buffer->shm->callbacks->buffer_created(&buffer->buffer); - - return buffer; -} - -static void -shm_create_buffer(struct wl_client *client, struct wl_shm *shm, - uint32_t id, int fd, int32_t width, int32_t height, - uint32_t stride, struct wl_visual *visual) -{ - struct wl_shm_buffer *buffer; - struct wl_display *display = wl_client_get_display(client); - - void *data; - - /* FIXME: Define a real exception event instead of abusing the - * display.invalid_object error */ - if (visual->object.interface != &wl_visual_interface) { - wl_client_post_event(client, (struct wl_object *) display, - WL_DISPLAY_INVALID_OBJECT, 0); - fprintf(stderr, "invalid visual in create_buffer\n"); - close(fd); - return; - } - - if (width < 0 || height < 0 || stride < width) { - wl_client_post_event(client, (struct wl_object *) display, - WL_DISPLAY_INVALID_OBJECT, 0); - fprintf(stderr, - "invalid width, height or stride in create_buffer\n"); - close(fd); - return; - } - - data = mmap(NULL, stride * height, - PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); - - close(fd); - if (data == MAP_FAILED) { - /* FIXME: Define a real exception event instead of - * abusing this one */ - wl_client_post_event(client, (struct wl_object *) display, - WL_DISPLAY_INVALID_OBJECT, 0); - fprintf(stderr, "failed to create image for fd %d\n", fd); - return; - } - - buffer = wl_shm_buffer_init(shm, id, - width, height, stride, visual, - data); - if (buffer == NULL) { - munmap(data, stride * height); - wl_client_post_no_memory(client); - return; - } - - wl_client_add_resource(client, &buffer->buffer.resource); -} - -const static struct wl_shm_interface shm_interface = { - shm_create_buffer -}; - - -WL_EXPORT struct wl_shm * -wl_shm_init(struct wl_display *display, - const struct wl_shm_callbacks *callbacks) -{ - struct wl_shm *shm; - - shm = malloc(sizeof *shm); - if (!shm) - return NULL; - - shm->object.interface = &wl_shm_interface; - shm->object.implementation = (void (**)(void)) &shm_interface; - wl_display_add_object(display, &shm->object); - wl_display_add_global(display, &shm->object, NULL); - - shm->callbacks = callbacks; - - return shm; -} - -WL_EXPORT void -wl_shm_finish(struct wl_shm *shm) -{ - /* FIXME: add wl_display_del_{object,global} */ - - free(shm); -} - -WL_EXPORT int -wl_buffer_is_shm(struct wl_buffer *buffer) -{ - return buffer->resource.object.implementation == - (void (**)(void)) &shm_buffer_interface; -} - -WL_EXPORT int32_t -wl_shm_buffer_get_stride(struct wl_buffer *buffer_base) -{ - struct wl_shm_buffer *buffer = (struct wl_shm_buffer *) buffer_base; - - if (!wl_buffer_is_shm(buffer_base)) - return 0; - - return buffer->stride; -} - -WL_EXPORT void * -wl_shm_buffer_get_data(struct wl_buffer *buffer_base) -{ - struct wl_shm_buffer *buffer = (struct wl_shm_buffer *) buffer_base; - - if (!wl_buffer_is_shm(buffer_base)) - return NULL; - - return buffer->data; -} diff --git a/src/3rdparty/wayland/wayland-util.c b/src/3rdparty/wayland/wayland-util.c deleted file mode 100644 index 3643274333c..00000000000 --- a/src/3rdparty/wayland/wayland-util.c +++ /dev/null @@ -1,123 +0,0 @@ -/* - * Copyright © 2008 Kristian Høgsberg - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting documentation, and - * that the name of the copyright holders not be used in advertising or - * publicity pertaining to distribution of the software without specific, - * written prior permission. The copyright holders make no representations - * about the suitability of this software for any purpose. It is provided "as - * is" without express or implied warranty. - * - * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include -#include -#include -#include "wayland-util.h" - -WL_EXPORT void -wl_list_init(struct wl_list *list) -{ - list->prev = list; - list->next = list; -} - -WL_EXPORT void -wl_list_insert(struct wl_list *list, struct wl_list *elm) -{ - elm->prev = list; - elm->next = list->next; - list->next = elm; - elm->next->prev = elm; -} - -WL_EXPORT void -wl_list_remove(struct wl_list *elm) -{ - elm->prev->next = elm->next; - elm->next->prev = elm->prev; -} - -WL_EXPORT int -wl_list_length(struct wl_list *list) -{ - struct wl_list *e; - int count; - - count = 0; - e = list->next; - while (e != list) { - e = e->next; - count++; - } - - return count; -} - -WL_EXPORT int -wl_list_empty(struct wl_list *list) -{ - return list->next == list; -} - -WL_EXPORT void -wl_array_init(struct wl_array *array) -{ - memset(array, 0, sizeof *array); -} - -WL_EXPORT void -wl_array_release(struct wl_array *array) -{ - free(array->data); -} - -WL_EXPORT void * -wl_array_add(struct wl_array *array, int size) -{ - int alloc; - void *data, *p; - - if (array->alloc > 0) - alloc = array->alloc; - else - alloc = 16; - - while (alloc < array->size + size) - alloc *= 2; - - if (array->alloc < alloc) { - if (array->alloc > 0) - data = realloc(array->data, alloc); - else - data = malloc(alloc); - - if (data == NULL) - return 0; - array->data = data; - array->alloc = alloc; - } - - p = array->data + array->size; - array->size += size; - - return p; -} - -WL_EXPORT void -wl_array_copy(struct wl_array *array, struct wl_array *source) -{ - array->size = 0; - wl_array_add(array, source->size); - memcpy(array->data, source->data, source->size); -} diff --git a/src/3rdparty/wayland/wayland-util.h b/src/3rdparty/wayland/wayland-util.h deleted file mode 100644 index 6c1231a9972..00000000000 --- a/src/3rdparty/wayland/wayland-util.h +++ /dev/null @@ -1,157 +0,0 @@ -/* - * Copyright © 2008 Kristian Høgsberg - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting documentation, and - * that the name of the copyright holders not be used in advertising or - * publicity pertaining to distribution of the software without specific, - * written prior permission. The copyright holders make no representations - * about the suitability of this software for any purpose. It is provided "as - * is" without express or implied warranty. - * - * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#ifndef WAYLAND_UTIL_H -#define WAYLAND_UTIL_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -/* GCC visibility */ -#if defined(__GNUC__) && __GNUC__ >= 4 -#define WL_EXPORT __attribute__ ((visibility("default"))) -#else -#define WL_EXPORT -#endif - -#define ARRAY_LENGTH(a) (sizeof (a) / sizeof (a)[0]) -#define ALIGN(n, a) ( ((n) + ((a) - 1)) & ~((a) - 1) ) -#define DIV_ROUNDUP(n, a) ( ((n) + ((a) - 1)) / (a) ) - -#define container_of(ptr, type, member) ({ \ - const typeof( ((type *)0)->member ) *__mptr = (ptr); \ - (type *)( (char *)__mptr - offsetof(type,member) );}) - -struct wl_argument { - uint32_t type; - void *data; -}; - -struct wl_message { - const char *name; - const char *signature; - const void **types; -}; - -struct wl_interface { - const char *name; - int version; - int method_count; - const struct wl_message *methods; - int event_count; - const struct wl_message *events; -}; - -struct wl_object { - const struct wl_interface *interface; - void (**implementation)(void); - uint32_t id; -}; - -struct wl_hash_table; -struct wl_hash_table *wl_hash_table_create(void); -void wl_hash_table_destroy(struct wl_hash_table *ht); -void *wl_hash_table_lookup(struct wl_hash_table *ht, uint32_t hash); -int wl_hash_table_insert(struct wl_hash_table *ht, uint32_t hash, void *data); -void wl_hash_table_remove(struct wl_hash_table *ht, uint32_t hash); - -/** - * wl_list - linked list - * - * The list head is of "struct wl_list" type, and must be initialized - * using wl_list_init(). All entries in the list must be of the same - * type. The item type must have a "struct wl_list" member. This - * member will be initialized by wl_list_insert(). There is no need to - * call wl_list_init() on the individual item. To query if the list is - * empty in O(1), use wl_list_empty(). - * - * Let's call the list reference "struct wl_list foo_list", the item type as - * "item_t", and the item member as "struct wl_list link". The following code - * - * The following code will initialize a list: - * - * wl_list_init(foo_list); - * wl_list_insert(foo_list, item1); Pushes item1 at the head - * wl_list_insert(foo_list, item2); Pushes item2 at the head - * wl_list_insert(item2, item3); Pushes item3 after item2 - * - * The list now looks like [item2, item3, item1] - * - * Will iterate the list in ascending order: - * - * item_t *item; - * wl_list_for_each(item, foo_list, link) { - * Do_something_with_item(item); - * } - */ -struct wl_list { - struct wl_list *prev; - struct wl_list *next; -}; - -void wl_list_init(struct wl_list *list); -void wl_list_insert(struct wl_list *list, struct wl_list *elm); -void wl_list_remove(struct wl_list *elm); -int wl_list_length(struct wl_list *list); -int wl_list_empty(struct wl_list *list); - -#define __container_of(ptr, sample, member) \ - (void *)((char *)(ptr) - \ - ((char *)&(sample)->member - (char *)(sample))) - -#define wl_list_for_each(pos, head, member) \ - for (pos = 0, pos = __container_of((head)->next, pos, member); \ - &pos->member != (head); \ - pos = __container_of(pos->member.next, pos, member)) - -#define wl_list_for_each_safe(pos, tmp, head, member) \ - for (pos = 0, tmp = 0, \ - pos = __container_of((head)->next, pos, member), \ - tmp = __container_of((pos)->member.next, tmp, member); \ - &pos->member != (head); \ - pos = tmp, \ - tmp = __container_of(pos->member.next, tmp, member)) - -#define wl_list_for_each_reverse(pos, head, member) \ - for (pos = 0, pos = __container_of((head)->prev, pos, member); \ - &pos->member != (head); \ - pos = __container_of(pos->member.prev, pos, member)) - -struct wl_array { - uint32_t size; - uint32_t alloc; - void *data; -}; - -void wl_array_init(struct wl_array *array); -void wl_array_release(struct wl_array *array); -void *wl_array_add(struct wl_array *array, int size); -void wl_array_copy(struct wl_array *array, struct wl_array *source); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/src/3rdparty/wayland/wayland.pro b/src/3rdparty/wayland/wayland.pro deleted file mode 100644 index 214ed995566..00000000000 --- a/src/3rdparty/wayland/wayland.pro +++ /dev/null @@ -1,3 +0,0 @@ -TEMPLATE = subdirs - -SUBDIRS = client server From a46d4baad8a7cf0ecb2bb6e62bd7e33fbcdf8238 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Tue, 17 Jan 2012 15:32:32 +0200 Subject: [PATCH 0010/1507] Implement selection offers from compositor to clients. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It is a hack but works beautifully. It allows the compositor to participate in copy-paste which becomes mandatory when there is UI running in the compositor process. Change-Id: I1993d8705a26159eff0c9947244b66e954b9f460 Sanity-Review: Qt Sanity Bot Reviewed-by: Jørgen Lind --- .../wayland/shared/qwaylandmimehelper.cpp | 83 +++++++++++++++++++ .../wayland/shared/qwaylandmimehelper.h | 55 ++++++++++++ 2 files changed, 138 insertions(+) create mode 100644 src/plugins/platforms/wayland/shared/qwaylandmimehelper.cpp create mode 100644 src/plugins/platforms/wayland/shared/qwaylandmimehelper.h diff --git a/src/plugins/platforms/wayland/shared/qwaylandmimehelper.cpp b/src/plugins/platforms/wayland/shared/qwaylandmimehelper.cpp new file mode 100644 index 00000000000..ffdaeef2205 --- /dev/null +++ b/src/plugins/platforms/wayland/shared/qwaylandmimehelper.cpp @@ -0,0 +1,83 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qwaylandmimehelper.h" +#include +#include +#include +#include +#include + +QByteArray QWaylandMimeHelper::getByteArray(QMimeData *mimeData, const QString &mimeType) +{ + QByteArray content; + if (mimeType == QLatin1String("text/plain")) { + content = mimeData->text().toUtf8(); + } else if (mimeData->hasImage() + && (mimeType == QLatin1String("application/x-qt-image") + || mimeType.startsWith(QLatin1String("image/")))) { + QImage image = qvariant_cast(mimeData->imageData()); + if (!image.isNull()) { + QBuffer buf; + buf.open(QIODevice::ReadWrite); + QByteArray fmt = "BMP"; + if (mimeType.startsWith(QLatin1String("image/"))) { + QByteArray imgFmt = mimeType.mid(6).toUpper().toAscii(); + if (QImageWriter::supportedImageFormats().contains(imgFmt)) + fmt = imgFmt; + } + QImageWriter wr(&buf, fmt); + wr.write(image); + content = buf.buffer(); + } + } else if (mimeType == QLatin1String("application/x-color")) { + content = qvariant_cast(mimeData->colorData()).name().toAscii(); + } else if (mimeType == QLatin1String("text/uri-list")) { + QList urls = mimeData->urls(); + for (int i = 0; i < urls.count(); ++i) { + content.append(urls.at(i).toEncoded()); + content.append('\n'); + } + } else { + content = mimeData->data(mimeType); + } + return content; +} diff --git a/src/plugins/platforms/wayland/shared/qwaylandmimehelper.h b/src/plugins/platforms/wayland/shared/qwaylandmimehelper.h new file mode 100644 index 00000000000..f38c74b90ae --- /dev/null +++ b/src/plugins/platforms/wayland/shared/qwaylandmimehelper.h @@ -0,0 +1,55 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWAYLANDMIMEHELPER_H +#define QWAYLANDMIMEHELPER_H + +#include +#include +#include + +class QWaylandMimeHelper +{ +public: + static QByteArray getByteArray(QMimeData *mimeData, const QString &mimeType); +}; + +#endif From 319282843753cafd6376ae318c7786633afb780a Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Fri, 20 Jan 2012 15:26:51 +1000 Subject: [PATCH 0011/1507] Update obsolete contact address. Replace Nokia contact email address with Qt Project website. Change-Id: Ib67c393df41c539deae0ef71e0acc13029ceb46d Sanity-Review: Qt Sanity Bot Reviewed-by: Rohan McGovern --- src/plugins/platforms/wayland/shared/qwaylandmimehelper.cpp | 2 +- src/plugins/platforms/wayland/shared/qwaylandmimehelper.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/wayland/shared/qwaylandmimehelper.cpp b/src/plugins/platforms/wayland/shared/qwaylandmimehelper.cpp index ffdaeef2205..7cc4d24aa26 100644 --- a/src/plugins/platforms/wayland/shared/qwaylandmimehelper.cpp +++ b/src/plugins/platforms/wayland/shared/qwaylandmimehelper.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the plugins of the Qt Toolkit. ** diff --git a/src/plugins/platforms/wayland/shared/qwaylandmimehelper.h b/src/plugins/platforms/wayland/shared/qwaylandmimehelper.h index f38c74b90ae..bf4a45c3160 100644 --- a/src/plugins/platforms/wayland/shared/qwaylandmimehelper.h +++ b/src/plugins/platforms/wayland/shared/qwaylandmimehelper.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the plugins of the Qt Toolkit. ** From b3da8baef146b258094d45c96660e3247aed7fc2 Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Tue, 24 Jan 2012 15:35:27 +1000 Subject: [PATCH 0012/1507] Remove "All rights reserved" line from license headers. As in the past, to avoid rewriting various autotests that contain line-number information, an extra blank line has been inserted at the end of the license text to ensure that this commit does not change the total number of lines in the license header. Change-Id: I08d8673382f0230d5c5a22a25efaf5c45cef539a Sanity-Review: Qt Sanity Bot Reviewed-by: Rohan McGovern --- src/plugins/platforms/wayland/shared/qwaylandmimehelper.cpp | 2 +- src/plugins/platforms/wayland/shared/qwaylandmimehelper.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/wayland/shared/qwaylandmimehelper.cpp b/src/plugins/platforms/wayland/shared/qwaylandmimehelper.cpp index 7cc4d24aa26..b2d4af56219 100644 --- a/src/plugins/platforms/wayland/shared/qwaylandmimehelper.cpp +++ b/src/plugins/platforms/wayland/shared/qwaylandmimehelper.cpp @@ -1,7 +1,6 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. ** Contact: http://www.qt-project.org/ ** ** This file is part of the plugins of the Qt Toolkit. @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/plugins/platforms/wayland/shared/qwaylandmimehelper.h b/src/plugins/platforms/wayland/shared/qwaylandmimehelper.h index bf4a45c3160..877271a42d3 100644 --- a/src/plugins/platforms/wayland/shared/qwaylandmimehelper.h +++ b/src/plugins/platforms/wayland/shared/qwaylandmimehelper.h @@ -1,7 +1,6 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. ** Contact: http://www.qt-project.org/ ** ** This file is part of the plugins of the Qt Toolkit. @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ From 8feb960ff8c2b7645f05218024646edd61ab6911 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Tue, 6 Mar 2012 10:29:45 +0100 Subject: [PATCH 0013/1507] Added auto-test for wayland plugin. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Similar to the compositor auto-test, except this time we mock the compositor, and test the client code, by forcing the wayland plugin to be used. Change-Id: I363019ff7e136db6822993f1881fec48a02a7db4 Reviewed-by: Jørgen Lind --- tests/auto/wayland/client.pro | 34 ++++ tests/auto/wayland/mockcompositor.cpp | 269 ++++++++++++++++++++++++++ tests/auto/wayland/mockcompositor.h | 179 +++++++++++++++++ tests/auto/wayland/mockinput.cpp | 125 ++++++++++++ tests/auto/wayland/mockoutput.cpp | 81 ++++++++ tests/auto/wayland/mockshell.cpp | 159 +++++++++++++++ tests/auto/wayland/mockshm.cpp | 100 ++++++++++ tests/auto/wayland/mocksurface.cpp | 145 ++++++++++++++ tests/auto/wayland/mocksurface.h | 67 +++++++ tests/auto/wayland/tst_client.cpp | 195 +++++++++++++++++++ 10 files changed, 1354 insertions(+) create mode 100644 tests/auto/wayland/client.pro create mode 100644 tests/auto/wayland/mockcompositor.cpp create mode 100644 tests/auto/wayland/mockcompositor.h create mode 100644 tests/auto/wayland/mockinput.cpp create mode 100644 tests/auto/wayland/mockoutput.cpp create mode 100644 tests/auto/wayland/mockshell.cpp create mode 100644 tests/auto/wayland/mockshm.cpp create mode 100644 tests/auto/wayland/mocksurface.cpp create mode 100644 tests/auto/wayland/mocksurface.h create mode 100644 tests/auto/wayland/tst_client.cpp diff --git a/tests/auto/wayland/client.pro b/tests/auto/wayland/client.pro new file mode 100644 index 00000000000..5d1f43d690a --- /dev/null +++ b/tests/auto/wayland/client.pro @@ -0,0 +1,34 @@ +CONFIG += testcase +TARGET = tst_client + +QT += testlib +QT += core-private gui-private + +use_pkgconfig { + CONFIG += link_pkgconfig + PKGCONFIG += wayland-server + + #set the rpath + !isEmpty(QMAKE_LFLAGS_RPATH) { + WAYLAND_NEEDS_RPATH = $$system(pkg-config --libs-only-L wayland-server) + !isEmpty(WAYLAND_NEEDS_RPATH) { + WAYLAND_LIBDIR = $$system(pkg-config --variable=libdir wayland-server) + !isEmpty(WAYLAND_LIBDIR):QMAKE_LFLAGS += $${QMAKE_LFLAGS_RPATH}$${WAYLAND_LIBDIR} + } + } +} else { + INCLUDEPATH += $$QMAKE_INCDIR_WAYLAND + !isEmpty(QMAKE_LIBDIR_WAYLAND) { + LIBS += -L$$QMAKE_LIBDIR_WAYLAND + } + LIBS += -lwayland-server -lffi +} + +SOURCES += tst_client.cpp \ + mockcompositor.cpp \ + mockinput.cpp \ + mockshell.cpp \ + mockshm.cpp \ + mocksurface.cpp \ + mockoutput.cpp +HEADERS += mockcompositor.h mocksurface.h diff --git a/tests/auto/wayland/mockcompositor.cpp b/tests/auto/wayland/mockcompositor.cpp new file mode 100644 index 00000000000..39bd6e3e7d1 --- /dev/null +++ b/tests/auto/wayland/mockcompositor.cpp @@ -0,0 +1,269 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "mockcompositor.h" +#include "mocksurface.h" + +MockCompositor::MockCompositor() + : m_alive(true) + , m_ready(false) + , m_compositor(0) +{ + pthread_create(&m_thread, 0, run, this); + + m_mutex.lock(); + m_waitCondition.wait(&m_mutex); + m_mutex.unlock(); +} + +MockCompositor::~MockCompositor() +{ + m_alive = false; + m_waitCondition.wakeOne(); + pthread_join(m_thread, 0); +} + +void MockCompositor::lock() +{ + m_mutex.lock(); +} + +void MockCompositor::unlock() +{ + m_mutex.unlock(); +} + +void MockCompositor::applicationInitialized() +{ + m_ready = true; +} + +int MockCompositor::waylandFileDescriptor() const +{ + return m_compositor->fileDescriptor(); +} + +void MockCompositor::processWaylandEvents() +{ + m_waitCondition.wakeOne(); +} + +void MockCompositor::setOutputGeometry(const QRect &rect) +{ + Command command = makeCommand(Impl::Compositor::setOutputGeometry, m_compositor); + command.parameters << rect; + processCommand(command); +} + +void MockCompositor::setKeyboardFocus(const QSharedPointer &surface) +{ + Command command = makeCommand(Impl::Compositor::setKeyboardFocus, m_compositor); + command.parameters << QVariant::fromValue(surface); + processCommand(command); +} + +void MockCompositor::sendMousePress(const QSharedPointer &surface, const QPoint &pos) +{ + Command command = makeCommand(Impl::Compositor::sendMousePress, m_compositor); + command.parameters << QVariant::fromValue(surface) << pos; + processCommand(command); +} + +void MockCompositor::sendMouseRelease(const QSharedPointer &surface) +{ + Command command = makeCommand(Impl::Compositor::sendMouseRelease, m_compositor); + command.parameters << QVariant::fromValue(surface); + processCommand(command); +} + +QSharedPointer MockCompositor::surface() +{ + QSharedPointer result; + lock(); + QVector surfaces = m_compositor->surfaces(); + if (!surfaces.isEmpty()) + result = surfaces.first()->mockSurface(); + unlock(); + return result; +} + +MockCompositor::Command MockCompositor::makeCommand(Command::Callback callback, void *target) +{ + Command command; + command.callback = callback; + command.target = target; + return command; +} + +void MockCompositor::processCommand(const Command &command) +{ + lock(); + m_commandQueue << command; + unlock(); + + m_waitCondition.wakeOne(); +} + +void MockCompositor::dispatchCommands() +{ + foreach (const Command &command, m_commandQueue) + command.callback(command.target, command.parameters); + m_commandQueue.clear(); +} + +void *MockCompositor::run(void *data) +{ + MockCompositor *controller = static_cast(data); + + Impl::Compositor compositor; + + controller->m_compositor = &compositor; + controller->m_waitCondition.wakeOne(); + + while (!controller->m_ready) { + controller->dispatchCommands(); + compositor.dispatchEvents(20); + } + + while (controller->m_alive) { + QMutexLocker locker(&controller->m_mutex); + controller->m_waitCondition.wait(&controller->m_mutex); + controller->dispatchCommands(); + compositor.dispatchEvents(20); + } + + return 0; +} + +namespace Impl { + +Compositor::Compositor() + : m_display(wl_display_create()) + , m_time(0) +{ + wl_list_init(&m_outputResources); + + wl_display_add_socket(m_display, 0); + + wl_input_device_init(&m_input); + + wl_display_add_global(m_display, &wl_compositor_interface, this, bindCompositor); + wl_display_add_global(m_display, &wl_input_device_interface, this, bindInput); + wl_display_add_global(m_display, &wl_output_interface, this, bindOutput); + wl_display_add_global(m_display, &wl_shell_interface, this, bindShell); + + initShm(); + + m_loop = wl_display_get_event_loop(m_display); + m_fd = wl_event_loop_get_fd(m_loop); +} + +Compositor::~Compositor() +{ + wl_shm_finish(m_shm); + wl_display_destroy(m_display); +} + +void Compositor::dispatchEvents(int timeout) +{ + wl_event_loop_dispatch(m_loop, timeout); +} + +static void compositor_create_surface(wl_client *client, wl_resource *compositorResource, uint32_t id) +{ + Compositor *compositor = static_cast(compositorResource->data); + compositor->addSurface(new Surface(client, id, compositor)); +} + +static void compositor_create_region(wl_client *client, wl_resource *compositorResource, uint32_t id) +{ + Q_UNUSED(client); + Q_UNUSED(compositorResource); + Q_UNUSED(id); +} + +void Compositor::bindCompositor(wl_client *client, void *compositorData, uint32_t version, uint32_t id) +{ + static const struct wl_compositor_interface compositorInterface = { + compositor_create_surface, + compositor_create_region + }; + + Q_UNUSED(version); + wl_client_add_object(client, &wl_compositor_interface, &compositorInterface, id, compositorData); +} + +static void unregisterResourceCallback(wl_listener *listener, + wl_resource *resource, + uint32_t time) +{ + Q_UNUSED(time); + wl_list_remove(&resource->link); + delete listener; +} + +void registerResource(wl_list *list, wl_resource *resource) +{ + wl_list_insert(list, &resource->link); + + wl_listener *listener = new wl_listener; + listener->func = unregisterResourceCallback; + + wl_list_insert(&resource->destroy_listener_list, &listener->link); +} + +QVector Compositor::surfaces() const +{ + return m_surfaces; +} + +void Compositor::addSurface(Surface *surface) +{ + m_surfaces << surface; +} + +void Compositor::removeSurface(Surface *surface) +{ + m_surfaces.remove(m_surfaces.indexOf(surface)); +} + +} + diff --git a/tests/auto/wayland/mockcompositor.h b/tests/auto/wayland/mockcompositor.h new file mode 100644 index 00000000000..ece19727717 --- /dev/null +++ b/tests/auto/wayland/mockcompositor.h @@ -0,0 +1,179 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef MOCKCOMPOSITOR_H +#define MOCKCOMPOSITOR_H + +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +namespace Impl { + +typedef void (**Implementation)(void); + +class Surface; + +class Compositor +{ +public: + Compositor(); + ~Compositor(); + + int fileDescriptor() const { return m_fd; } + void dispatchEvents(int timeout = 0); + + uint32_t time() { return ++m_time; } + + static void setOutputGeometry(void *compositor, const QList ¶meters); + + QVector surfaces() const; + + void addSurface(Surface *surface); + void removeSurface(Surface *surface); + + static void setKeyboardFocus(void *data, const QList ¶meters); + static void sendMousePress(void *data, const QList ¶meters); + static void sendMouseRelease(void *data, const QList ¶meters); + +private: + static void bindCompositor(wl_client *client, void *data, uint32_t version, uint32_t id); + static void bindInput(wl_client *client, void *data, uint32_t version, uint32_t id); + static void bindOutput(wl_client *client, void *data, uint32_t version, uint32_t id); + static void bindShell(wl_client *client, void *data, uint32_t version, uint32_t id); + + static void destroyInputResource(wl_resource *resource); + + void initShm(); + + void sendOutputGeometry(wl_resource *resource); + void sendOutputMode(wl_resource *resource); + + QRect m_outputGeometry; + + wl_display *m_display; + wl_event_loop *m_loop; + wl_shm *m_shm; + int m_fd; + + wl_list m_outputResources; + uint32_t m_time; + + wl_input_device m_input; + QVector m_surfaces; +}; + +void registerResource(wl_list *list, wl_resource *resource); + +} + +class MockSurface +{ +public: + Impl::Surface *handle() const { return m_surface; } + +private: + MockSurface(Impl::Surface *surface); + friend class Impl::Compositor; + friend class Impl::Surface; + + Impl::Surface *m_surface; +}; + +Q_DECLARE_METATYPE(QSharedPointer) + +class MockCompositor +{ +public: + MockCompositor(); + ~MockCompositor(); + + void applicationInitialized(); + + int waylandFileDescriptor() const; + void processWaylandEvents(); + + void setOutputGeometry(const QRect &rect); + void setKeyboardFocus(const QSharedPointer &surface); + void sendMousePress(const QSharedPointer &surface, const QPoint &pos); + void sendMouseRelease(const QSharedPointer &surface); + + QSharedPointer surface(); + + void lock(); + void unlock(); + +private: + struct Command + { + typedef void (*Callback)(void *target, const QList ¶meters); + + Callback callback; + void *target; + QList parameters; + }; + + static Command makeCommand(Command::Callback callback, void *target); + + void processCommand(const Command &command); + void dispatchCommands(); + + static void *run(void *data); + + bool m_alive; + bool m_ready; + pthread_t m_thread; + QMutex m_mutex; + QWaitCondition m_waitCondition; + + Impl::Compositor *m_compositor; + + QList m_commandQueue; +}; + +#endif diff --git a/tests/auto/wayland/mockinput.cpp b/tests/auto/wayland/mockinput.cpp new file mode 100644 index 00000000000..9d6286db24b --- /dev/null +++ b/tests/auto/wayland/mockinput.cpp @@ -0,0 +1,125 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "mockcompositor.h" +#include "mocksurface.h" + +namespace Impl { + +void Compositor::destroyInputResource(wl_resource *resource) +{ + Compositor *compositor = static_cast(resource->data); + wl_input_device *input = &compositor->m_input; + + if (input->keyboard_focus_resource == resource) + input->keyboard_focus_resource = 0; + if (input->pointer_focus_resource == resource) + input->pointer_focus_resource = 0; + + wl_list_remove(&resource->link); + + free(resource); +} + +void input_device_attach(wl_client *client, + wl_resource *device_resource, + uint32_t time, + wl_resource *buffer_resource, int32_t x, int32_t y) +{ + Q_UNUSED(client); + Q_UNUSED(device_resource); + Q_UNUSED(time); + Q_UNUSED(buffer_resource); + Q_UNUSED(QPoint(x, y)); +} + +void Compositor::bindInput(wl_client *client, void *compositorData, uint32_t version, uint32_t id) +{ + static const struct wl_input_device_interface inputDeviceInterface = { + input_device_attach, + }; + + Q_UNUSED(version); + wl_resource *resource = wl_client_add_object(client, &wl_input_device_interface, &inputDeviceInterface, id, compositorData); + resource->destroy = destroyInputResource; + + Compositor *compositor = static_cast(compositorData); + wl_list_insert(&compositor->m_input.resource_list, &resource->link); +} + +static wl_surface *resolveSurface(const QVariant &v) +{ + QSharedPointer mockSurface = v.value >(); + Surface *surface = mockSurface ? mockSurface->handle() : 0; + return surface ? surface->handle() : 0; +} + +void Compositor::setKeyboardFocus(void *data, const QList ¶meters) +{ + Compositor *compositor = static_cast(data); + wl_input_device_set_keyboard_focus(&compositor->m_input, resolveSurface(parameters.first()), compositor->time()); +} + +void Compositor::sendMousePress(void *data, const QList ¶meters) +{ + Compositor *compositor = static_cast(data); + wl_surface *surface = resolveSurface(parameters.first()); + if (!surface) + return; + + QPoint pos = parameters.last().toPoint(); + wl_input_device_set_pointer_focus(&compositor->m_input, surface, compositor->time(), pos.x(), pos.y()); + wl_input_device_send_motion(compositor->m_input.pointer_focus_resource, compositor->time(), pos.x(), pos.y()); + wl_input_device_send_button(compositor->m_input.pointer_focus_resource, compositor->time(), 0x110, 1); +} + +void Compositor::sendMouseRelease(void *data, const QList ¶meters) +{ + Compositor *compositor = static_cast(data); + wl_surface *surface = resolveSurface(parameters.first()); + if (!surface) + return; + + wl_input_device_send_button(compositor->m_input.pointer_focus_resource, compositor->time(), 0x110, 0); +} + +} + diff --git a/tests/auto/wayland/mockoutput.cpp b/tests/auto/wayland/mockoutput.cpp new file mode 100644 index 00000000000..18773f021fe --- /dev/null +++ b/tests/auto/wayland/mockoutput.cpp @@ -0,0 +1,81 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "mockcompositor.h" + +namespace Impl { + +void Compositor::bindOutput(wl_client *client, void *compositorData, uint32_t version, uint32_t id) +{ + Q_UNUSED(version); + + wl_resource *resource = wl_client_add_object(client, &wl_output_interface, 0, id, compositorData); + + Compositor *compositor = static_cast(compositorData); + registerResource(&compositor->m_outputResources, resource); + + compositor->sendOutputGeometry(resource); + compositor->sendOutputMode(resource); +} + +void Compositor::sendOutputGeometry(wl_resource *resource) +{ + const QRect &r = m_outputGeometry; + wl_output_send_geometry(resource, r.x(), r.y(), r.width(), r.height(), 0, "", ""); +} + +void Compositor::sendOutputMode(wl_resource *resource) +{ + wl_output_send_mode(resource, WL_OUTPUT_MODE_CURRENT | WL_OUTPUT_MODE_PREFERRED, 640, 480, 60); +} + +void Compositor::setOutputGeometry(void *c, const QList ¶meters) +{ + Compositor *compositor = static_cast(c); + compositor->m_outputGeometry = parameters.first().toRect(); + + wl_resource *resource; + wl_list_for_each(resource, &compositor->m_outputResources, link) + compositor->sendOutputGeometry(resource); +} + +} + diff --git a/tests/auto/wayland/mockshell.cpp b/tests/auto/wayland/mockshell.cpp new file mode 100644 index 00000000000..ede240d8ec6 --- /dev/null +++ b/tests/auto/wayland/mockshell.cpp @@ -0,0 +1,159 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "mockcompositor.h" + +namespace Impl { + +void shell_surface_move(wl_client *client, + wl_resource *surface_resource, + wl_resource *input_device_resource, + uint32_t time) +{ + Q_UNUSED(client); + Q_UNUSED(surface_resource); + Q_UNUSED(input_device_resource); + Q_UNUSED(time); +} + +void shell_surface_resize(wl_client *client, + wl_resource *surface_resource, + wl_resource *input_device_resource, + uint32_t time, + uint32_t edges) +{ + Q_UNUSED(client); + Q_UNUSED(surface_resource); + Q_UNUSED(input_device_resource); + Q_UNUSED(time); + Q_UNUSED(edges); + +} + +void shell_surface_set_toplevel(wl_client *client, + wl_resource *surface_resource) +{ + Q_UNUSED(client); + Q_UNUSED(surface_resource); +} + +void shell_surface_set_transient(wl_client *client, + wl_resource *surface_resource, + wl_resource *parent_surface_resource, + int x, + int y, + uint32_t flags) +{ + + Q_UNUSED(client); + Q_UNUSED(surface_resource); + Q_UNUSED(parent_surface_resource); + Q_UNUSED(x); + Q_UNUSED(y); + Q_UNUSED(flags); +} + +void shell_surface_set_fullscreen(wl_client *client, + wl_resource *surface_resource, + uint32_t method, + uint32_t framerate, + wl_resource *output) +{ + Q_UNUSED(client); + Q_UNUSED(surface_resource); + Q_UNUSED(method); + Q_UNUSED(framerate); + Q_UNUSED(output); +} + +void shell_surface_set_popup(wl_client *client, wl_resource *resource, + wl_resource *input_device, uint32_t time, + wl_resource *parent, + int32_t x, int32_t y, + uint32_t flags) +{ + Q_UNUSED(client); + Q_UNUSED(resource); + Q_UNUSED(input_device); + Q_UNUSED(time); + Q_UNUSED(parent); + Q_UNUSED(x); + Q_UNUSED(y); + Q_UNUSED(flags); +} + +void shell_surface_set_maximized(wl_client *client, + wl_resource *surface_resource, + wl_resource *output) +{ + Q_UNUSED(client); + Q_UNUSED(surface_resource); + Q_UNUSED(output); +} + +static void get_shell_surface(wl_client *client, wl_resource *compositorResource, uint32_t id, wl_resource *surfaceResource) +{ + const struct wl_shell_surface_interface shellSurfaceInterface = { + shell_surface_move, + shell_surface_resize, + shell_surface_set_toplevel, + shell_surface_set_transient, + shell_surface_set_fullscreen, + shell_surface_set_popup, + shell_surface_set_maximized + }; + + Q_UNUSED(compositorResource); + wl_client_add_object(client, &wl_shell_surface_interface, &shellSurfaceInterface, id, surfaceResource->data); +} + +void Compositor::bindShell(wl_client *client, void *compositorData, uint32_t version, uint32_t id) +{ + static const struct wl_shell_interface shellInterface = { + get_shell_surface + }; + + Q_UNUSED(version); + wl_client_add_object(client, &wl_shell_interface, &shellInterface, id, compositorData); +} + +} + diff --git a/tests/auto/wayland/mockshm.cpp b/tests/auto/wayland/mockshm.cpp new file mode 100644 index 00000000000..9deceebbb75 --- /dev/null +++ b/tests/auto/wayland/mockshm.cpp @@ -0,0 +1,100 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "mockcompositor.h" + +#include + +namespace Impl { + +class ShmBuffer +{ +public: + ShmBuffer(wl_buffer *buffer) + : m_buffer(buffer) + { + refresh(); + } + + void refresh() + { + m_image = QImage(static_cast(wl_shm_buffer_get_data(m_buffer)), + m_buffer->width, m_buffer->height, + wl_shm_buffer_get_stride(m_buffer), + QImage::Format_ARGB32_Premultiplied); + } + +private: + wl_buffer *m_buffer; + QImage m_image; +}; + +static void shm_buffer_created(wl_buffer *buffer) +{ + buffer->user_data = new ShmBuffer(buffer); +} + +static void shm_buffer_damaged(wl_buffer *buffer, + int32_t x, int32_t y, + int32_t width, int32_t height) +{ + Q_UNUSED(QRect(x, y, width, height)); + static_cast(buffer->user_data)->refresh(); +} + +static void shm_buffer_destroyed(wl_buffer *buffer) +{ + delete static_cast(buffer->user_data); +} + +void Compositor::initShm() +{ + static struct wl_shm_callbacks shmCallbacks = { + shm_buffer_created, + shm_buffer_damaged, + shm_buffer_destroyed + }; + + m_shm = wl_shm_init(m_display, &shmCallbacks); +} + +} + diff --git a/tests/auto/wayland/mocksurface.cpp b/tests/auto/wayland/mocksurface.cpp new file mode 100644 index 00000000000..38fc955e5e9 --- /dev/null +++ b/tests/auto/wayland/mocksurface.cpp @@ -0,0 +1,145 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "mocksurface.h" +#include "mockcompositor.h" + +namespace Impl { + +void destroy_surface(wl_resource *resource) +{ + Surface *surface = static_cast(resource->data); + surface->compositor()->removeSurface(surface); + delete surface; +} + +static void surface_destroy(wl_client *, wl_resource *surfaceResource) +{ + Surface *surface = static_cast(surfaceResource->data); + wl_resource_destroy(surfaceResource, surface->compositor()->time()); +} + +void surface_attach(wl_client *client, wl_resource *surface, + wl_resource *buffer, int x, int y) +{ + Q_UNUSED(client); + Q_UNUSED(surface); + Q_UNUSED(buffer); + Q_UNUSED(x); + Q_UNUSED(y); + //resolve(surface)->attach(buffer ? reinterpret_cast(buffer->data) : 0); +} + +void surface_damage(wl_client *client, wl_resource *surface, + int32_t x, int32_t y, int32_t width, int32_t height) +{ + Q_UNUSED(client); + Q_UNUSED(surface); + Q_UNUSED(x); + Q_UNUSED(y); + Q_UNUSED(width); + Q_UNUSED(height); + //resolve(surface)->damage(QRect(x, y, width, height)); +} + +void surface_frame(wl_client *client, + wl_resource *surface, + uint32_t callback) +{ + Q_UNUSED(client); + Q_UNUSED(surface); + Q_UNUSED(callback); +// Surface *surface = resolve(resource); +// wl_resource *frame_callback = wl_client_add_object(client, &wl_callback_interface, 0, callback, surface); +// wl_list_insert(&surface->m_frame_callback_list, &frame_callback->link); +} + +void surface_set_opaque_region(wl_client *client, wl_resource *surfaceResource, + wl_resource *region) +{ + Q_UNUSED(client); + Q_UNUSED(surfaceResource); + Q_UNUSED(region); +} + +void surface_set_input_region(wl_client *client, wl_resource *surfaceResource, + wl_resource *region) +{ + Q_UNUSED(client); + Q_UNUSED(surfaceResource); + Q_UNUSED(region); +} + +Surface::Surface(wl_client *client, uint32_t id, Compositor *compositor) + : m_surface(wl_surface()) + , m_compositor(compositor) + , m_mockSurface(new MockSurface(this)) +{ + static const struct wl_surface_interface surfaceInterface = { + surface_destroy, + surface_attach, + surface_damage, + surface_frame, + surface_set_opaque_region, + surface_set_input_region + }; + + m_surface.resource.object.id = id; + m_surface.resource.object.interface = &wl_surface_interface; + m_surface.resource.object.implementation = (Implementation)&surfaceInterface; + m_surface.resource.data = this; + m_surface.resource.destroy = destroy_surface; + + wl_client_add_resource(client, &m_surface.resource); + +} + +Surface::~Surface() +{ + m_mockSurface->m_surface = 0; +} + +} + +MockSurface::MockSurface(Impl::Surface *surface) + : m_surface(surface) +{ +} diff --git a/tests/auto/wayland/mocksurface.h b/tests/auto/wayland/mocksurface.h new file mode 100644 index 00000000000..69ae8024842 --- /dev/null +++ b/tests/auto/wayland/mocksurface.h @@ -0,0 +1,67 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include + +#include "mockcompositor.h" + +namespace Impl { + +class Surface +{ +public: + Surface(wl_client *client, uint32_t id, Compositor *compositor); + ~Surface(); + + Compositor *compositor() const { return m_compositor; } + wl_surface *handle() { return &m_surface; } + + QSharedPointer mockSurface() const { return m_mockSurface; } + +private: + wl_surface m_surface; + + Compositor *m_compositor; + QSharedPointer m_mockSurface; +}; + +} diff --git a/tests/auto/wayland/tst_client.cpp b/tests/auto/wayland/tst_client.cpp new file mode 100644 index 00000000000..fdcb12991fc --- /dev/null +++ b/tests/auto/wayland/tst_client.cpp @@ -0,0 +1,195 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "mockcompositor.h" + +#include + +static const QSize screenSize(1600, 1200); + +class TestWindow : public QWindow +{ +public: + TestWindow() + : focusInEventCount(0) + , focusOutEventCount(0) + , keyPressEventCount(0) + , keyReleaseEventCount(0) + , mousePressEventCount(0) + , mouseReleaseEventCount(0) + { + setSurfaceType(QSurface::RasterSurface); + setGeometry(0, 0, 32, 32); + create(); + } + + void focusInEvent(QFocusEvent *) + { + ++focusInEventCount; + } + + void focusOutEvent(QFocusEvent *) + { + ++focusOutEventCount; + } + + void keyPressEvent(QKeyEvent *) + { + ++keyPressEventCount; + } + + void keyReleaseEvent(QKeyEvent *) + { + ++keyReleaseEventCount; + } + + void mousePressEvent(QMouseEvent *event) + { + ++mousePressEventCount; + mousePressPos = event->pos(); + } + + void mouseReleaseEvent(QMouseEvent *) + { + ++mouseReleaseEventCount; + } + + int focusInEventCount; + int focusOutEventCount; + int keyPressEventCount; + int keyReleaseEventCount; + int mousePressEventCount; + int mouseReleaseEventCount; + + QPoint mousePressPos; +}; + +class tst_WaylandClient : public QObject +{ + Q_OBJECT +public: + tst_WaylandClient(MockCompositor *c) + : compositor(c) + { + QSocketNotifier *notifier = new QSocketNotifier(compositor->waylandFileDescriptor(), QSocketNotifier::Read, this); + connect(notifier, SIGNAL(activated(int)), this, SLOT(processWaylandEvents())); + } + +public slots: + void processWaylandEvents() + { + compositor->processWaylandEvents(); + } + +private slots: + void screen(); + void createDestroyWindow(); + void events(); + +private: + MockCompositor *compositor; +}; + +void tst_WaylandClient::screen() +{ + QTRY_COMPARE(QGuiApplication::primaryScreen()->size(), screenSize); +} + +void tst_WaylandClient::createDestroyWindow() +{ + TestWindow window; + window.show(); + + QTRY_VERIFY(compositor->surface()); + + window.destroy(); + QTRY_VERIFY(!compositor->surface()); +} + +void tst_WaylandClient::events() +{ + TestWindow window; + window.show(); + + QSharedPointer surface; + QTRY_VERIFY(surface = compositor->surface()); + + QCOMPARE(window.focusInEventCount, 0); + compositor->setKeyboardFocus(surface); + QTRY_COMPARE(window.focusInEventCount, 1); + QTRY_COMPARE(QGuiApplication::focusWindow(), &window); + + QCOMPARE(window.focusOutEventCount, 0); + compositor->setKeyboardFocus(QSharedPointer(0)); + QTRY_COMPARE(window.focusOutEventCount, 1); + QTRY_COMPARE(QGuiApplication::focusWindow(), static_cast(0)); + + compositor->setKeyboardFocus(surface); + QTRY_COMPARE(window.focusInEventCount, 2); + QTRY_COMPARE(QGuiApplication::focusWindow(), &window); + + QPoint mousePressPos(16, 16); + QCOMPARE(window.mousePressEventCount, 0); + compositor->sendMousePress(surface, mousePressPos); + QTRY_COMPARE(window.mousePressEventCount, 1); + QTRY_COMPARE(window.mousePressPos, mousePressPos); + + QCOMPARE(window.mouseReleaseEventCount, 0); + compositor->sendMouseRelease(surface); + QTRY_COMPARE(window.mouseReleaseEventCount, 1); +} + +int main(int argc, char **argv) +{ + setenv("XDG_RUNTIME_DIR", ".", 1); + setenv("QT_QPA_PLATFORM", "wayland", 1); // force QGuiApplication to use wayland plugin + + MockCompositor compositor; + compositor.setOutputGeometry(QRect(QPoint(), screenSize)); + + QGuiApplication app(argc, argv); + compositor.applicationInitialized(); + + tst_WaylandClient tc(&compositor); + return QTest::qExec(&tc, argc, argv); +} + +#include From 54331754cbb33edd334c79ccfdbd0fea7017b14c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Wed, 7 Mar 2012 10:40:31 +0100 Subject: [PATCH 0014/1507] Added testing of key events to client auto test. This requires passing on the native key code as well when calling into QWindowSystemInterface from QWaylandInputDevice. Change-Id: Iea1f98dcc9e050bb42cc48927da17aa54085a5e8 Reviewed-by: Laszlo Agocs --- tests/auto/wayland/mockcompositor.cpp | 14 ++++++++++++++ tests/auto/wayland/mockcompositor.h | 4 ++++ tests/auto/wayland/mockinput.cpp | 21 +++++++++++++++++++++ tests/auto/wayland/tst_client.cpp | 19 +++++++++++++++++-- 4 files changed, 56 insertions(+), 2 deletions(-) diff --git a/tests/auto/wayland/mockcompositor.cpp b/tests/auto/wayland/mockcompositor.cpp index 39bd6e3e7d1..c751bccb27d 100644 --- a/tests/auto/wayland/mockcompositor.cpp +++ b/tests/auto/wayland/mockcompositor.cpp @@ -114,6 +114,20 @@ void MockCompositor::sendMouseRelease(const QSharedPointer &surface processCommand(command); } +void MockCompositor::sendKeyPress(const QSharedPointer &surface, uint code) +{ + Command command = makeCommand(Impl::Compositor::sendKeyPress, m_compositor); + command.parameters << QVariant::fromValue(surface) << code; + processCommand(command); +} + +void MockCompositor::sendKeyRelease(const QSharedPointer &surface, uint code) +{ + Command command = makeCommand(Impl::Compositor::sendKeyRelease, m_compositor); + command.parameters << QVariant::fromValue(surface) << code; + processCommand(command); +} + QSharedPointer MockCompositor::surface() { QSharedPointer result; diff --git a/tests/auto/wayland/mockcompositor.h b/tests/auto/wayland/mockcompositor.h index ece19727717..18de0e6cbe4 100644 --- a/tests/auto/wayland/mockcompositor.h +++ b/tests/auto/wayland/mockcompositor.h @@ -80,6 +80,8 @@ public: static void setKeyboardFocus(void *data, const QList ¶meters); static void sendMousePress(void *data, const QList ¶meters); static void sendMouseRelease(void *data, const QList ¶meters); + static void sendKeyPress(void *data, const QList ¶meters); + static void sendKeyRelease(void *data, const QList ¶meters); private: static void bindCompositor(wl_client *client, void *data, uint32_t version, uint32_t id); @@ -142,6 +144,8 @@ public: void setKeyboardFocus(const QSharedPointer &surface); void sendMousePress(const QSharedPointer &surface, const QPoint &pos); void sendMouseRelease(const QSharedPointer &surface); + void sendKeyPress(const QSharedPointer &surface, uint code); + void sendKeyRelease(const QSharedPointer &surface, uint code); QSharedPointer surface(); diff --git a/tests/auto/wayland/mockinput.cpp b/tests/auto/wayland/mockinput.cpp index 9d6286db24b..b5c90d7ed7e 100644 --- a/tests/auto/wayland/mockinput.cpp +++ b/tests/auto/wayland/mockinput.cpp @@ -121,5 +121,26 @@ void Compositor::sendMouseRelease(void *data, const QList ¶meters) wl_input_device_send_button(compositor->m_input.pointer_focus_resource, compositor->time(), 0x110, 0); } +void Compositor::sendKeyPress(void *data, const QList ¶meters) +{ + Compositor *compositor = static_cast(data); + wl_surface *surface = resolveSurface(parameters.first()); + if (!surface) + return; + + QPoint pos = parameters.last().toPoint(); + wl_input_device_send_key(compositor->m_input.keyboard_focus_resource, compositor->time(), parameters.last().toUInt() - 8, 1); +} + +void Compositor::sendKeyRelease(void *data, const QList ¶meters) +{ + Compositor *compositor = static_cast(data); + wl_surface *surface = resolveSurface(parameters.first()); + if (!surface) + return; + + wl_input_device_send_key(compositor->m_input.keyboard_focus_resource, compositor->time(), parameters.last().toUInt() - 8, 0); +} + } diff --git a/tests/auto/wayland/tst_client.cpp b/tests/auto/wayland/tst_client.cpp index fdcb12991fc..9b63337c5da 100644 --- a/tests/auto/wayland/tst_client.cpp +++ b/tests/auto/wayland/tst_client.cpp @@ -55,6 +55,7 @@ public: , keyReleaseEventCount(0) , mousePressEventCount(0) , mouseReleaseEventCount(0) + , keyCode(0) { setSurfaceType(QSurface::RasterSurface); setGeometry(0, 0, 32, 32); @@ -71,14 +72,16 @@ public: ++focusOutEventCount; } - void keyPressEvent(QKeyEvent *) + void keyPressEvent(QKeyEvent *event) { ++keyPressEventCount; + keyCode = event->nativeScanCode(); } - void keyReleaseEvent(QKeyEvent *) + void keyReleaseEvent(QKeyEvent *event) { ++keyReleaseEventCount; + keyCode = event->nativeScanCode(); } void mousePressEvent(QMouseEvent *event) @@ -99,6 +102,7 @@ public: int mousePressEventCount; int mouseReleaseEventCount; + uint keyCode; QPoint mousePressPos; }; @@ -166,6 +170,17 @@ void tst_WaylandClient::events() QTRY_COMPARE(window.focusInEventCount, 2); QTRY_COMPARE(QGuiApplication::focusWindow(), &window); + uint keyCode = 80; // arbitrarily chosen + QCOMPARE(window.keyPressEventCount, 0); + compositor->sendKeyPress(surface, keyCode); + QTRY_COMPARE(window.keyPressEventCount, 1); + QTRY_COMPARE(window.keyCode, keyCode); + + QCOMPARE(window.keyReleaseEventCount, 0); + compositor->sendKeyRelease(surface, keyCode); + QTRY_COMPARE(window.keyReleaseEventCount, 1); + QCOMPARE(window.keyCode, keyCode); + QPoint mousePressPos(16, 16); QCOMPARE(window.mousePressEventCount, 0); compositor->sendMousePress(surface, mousePressPos); From 621af3b83678eacee90b00945590c3ef1c035de3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Wed, 7 Mar 2012 13:52:50 +0100 Subject: [PATCH 0015/1507] Added testing of QBackingStore backend in wayland plugin. Change-Id: I4db26cbee88f329a926914ff878e6efa9b0c8395 Reviewed-by: Laszlo Agocs --- tests/auto/wayland/client.pro | 4 ++- tests/auto/wayland/mockcompositor.h | 5 ++- tests/auto/wayland/mockshm.cpp | 36 ++++++++++------------ tests/auto/wayland/mocksurface.cpp | 45 ++++++++++++++++++--------- tests/auto/wayland/mocksurface.h | 9 ++++++ tests/auto/wayland/tst_client.cpp | 47 +++++++++++++++++++++++++++++ 6 files changed, 110 insertions(+), 36 deletions(-) diff --git a/tests/auto/wayland/client.pro b/tests/auto/wayland/client.pro index 5d1f43d690a..12dad35501a 100644 --- a/tests/auto/wayland/client.pro +++ b/tests/auto/wayland/client.pro @@ -31,4 +31,6 @@ SOURCES += tst_client.cpp \ mockshm.cpp \ mocksurface.cpp \ mockoutput.cpp -HEADERS += mockcompositor.h mocksurface.h +HEADERS += mockcompositor.h \ + mockshm.h \ + mocksurface.h diff --git a/tests/auto/wayland/mockcompositor.h b/tests/auto/wayland/mockcompositor.h index 18de0e6cbe4..2d1e4183661 100644 --- a/tests/auto/wayland/mockcompositor.h +++ b/tests/auto/wayland/mockcompositor.h @@ -46,8 +46,9 @@ #include #include -#include +#include #include +#include #include #include #include @@ -119,6 +120,8 @@ class MockSurface public: Impl::Surface *handle() const { return m_surface; } + QImage image; + private: MockSurface(Impl::Surface *surface); friend class Impl::Compositor; diff --git a/tests/auto/wayland/mockshm.cpp b/tests/auto/wayland/mockshm.cpp index 9deceebbb75..5c0ba38a35d 100644 --- a/tests/auto/wayland/mockshm.cpp +++ b/tests/auto/wayland/mockshm.cpp @@ -40,32 +40,28 @@ ****************************************************************************/ #include "mockcompositor.h" - -#include +#include "mockshm.h" namespace Impl { -class ShmBuffer +ShmBuffer::ShmBuffer(wl_buffer *buffer) + : m_buffer(buffer) { -public: - ShmBuffer(wl_buffer *buffer) - : m_buffer(buffer) - { - refresh(); - } + refresh(); +} - void refresh() - { - m_image = QImage(static_cast(wl_shm_buffer_get_data(m_buffer)), - m_buffer->width, m_buffer->height, - wl_shm_buffer_get_stride(m_buffer), - QImage::Format_ARGB32_Premultiplied); - } +void ShmBuffer::refresh() +{ + m_image = QImage(static_cast(wl_shm_buffer_get_data(m_buffer)), + m_buffer->width, m_buffer->height, + wl_shm_buffer_get_stride(m_buffer), + QImage::Format_ARGB32_Premultiplied); +} -private: - wl_buffer *m_buffer; - QImage m_image; -}; +QImage ShmBuffer::image() const +{ + return m_image; +} static void shm_buffer_created(wl_buffer *buffer) { diff --git a/tests/auto/wayland/mocksurface.cpp b/tests/auto/wayland/mocksurface.cpp index 38fc955e5e9..68c18bac634 100644 --- a/tests/auto/wayland/mocksurface.cpp +++ b/tests/auto/wayland/mocksurface.cpp @@ -41,6 +41,7 @@ #include "mocksurface.h" #include "mockcompositor.h" +#include "mockshm.h" namespace Impl { @@ -57,39 +58,54 @@ static void surface_destroy(wl_client *, wl_resource *surfaceResource) wl_resource_destroy(surfaceResource, surface->compositor()->time()); } -void surface_attach(wl_client *client, wl_resource *surface, +void surface_attach(wl_client *client, wl_resource *surfaceResource, wl_resource *buffer, int x, int y) { Q_UNUSED(client); - Q_UNUSED(surface); - Q_UNUSED(buffer); Q_UNUSED(x); Q_UNUSED(y); - //resolve(surface)->attach(buffer ? reinterpret_cast(buffer->data) : 0); + + Surface *surface = static_cast(surfaceResource->data); + surface->m_buffer = buffer ? static_cast(buffer->data) : 0; + + if (!buffer) + surface->m_mockSurface->image = QImage(); } -void surface_damage(wl_client *client, wl_resource *surface, +void surface_damage(wl_client *client, wl_resource *surfaceResource, int32_t x, int32_t y, int32_t width, int32_t height) { Q_UNUSED(client); - Q_UNUSED(surface); Q_UNUSED(x); Q_UNUSED(y); Q_UNUSED(width); Q_UNUSED(height); - //resolve(surface)->damage(QRect(x, y, width, height)); + + Surface *surface = static_cast(surfaceResource->data); + wl_buffer *buffer = surface->m_buffer; + + if (!buffer) + return; + + if (wl_buffer_is_shm(buffer)) + surface->m_mockSurface->image = static_cast(buffer->user_data)->image(); + + wl_resource *frameCallback; + wl_list_for_each(frameCallback, &surface->m_frameCallbackList, link) { + wl_callback_send_done(frameCallback, surface->m_compositor->time()); + wl_resource_destroy(frameCallback, surface->m_compositor->time()); + } + + wl_list_init(&surface->m_frameCallbackList); } void surface_frame(wl_client *client, - wl_resource *surface, + wl_resource *surfaceResource, uint32_t callback) { - Q_UNUSED(client); - Q_UNUSED(surface); - Q_UNUSED(callback); -// Surface *surface = resolve(resource); -// wl_resource *frame_callback = wl_client_add_object(client, &wl_callback_interface, 0, callback, surface); -// wl_list_insert(&surface->m_frame_callback_list, &frame_callback->link); + Surface *surface = static_cast(surfaceResource->data); + wl_resource *frameCallback = wl_client_add_object(client, &wl_callback_interface, 0, callback, surface); + wl_list_insert(&surface->m_frameCallbackList, &frameCallback->link); } void surface_set_opaque_region(wl_client *client, wl_resource *surfaceResource, @@ -130,6 +146,7 @@ Surface::Surface(wl_client *client, uint32_t id, Compositor *compositor) wl_client_add_resource(client, &m_surface.resource); + wl_list_init(&m_frameCallbackList); } Surface::~Surface() diff --git a/tests/auto/wayland/mocksurface.h b/tests/auto/wayland/mocksurface.h index 69ae8024842..da77b3638ff 100644 --- a/tests/auto/wayland/mocksurface.h +++ b/tests/auto/wayland/mocksurface.h @@ -59,9 +59,18 @@ public: private: wl_surface m_surface; + wl_buffer *m_buffer; Compositor *m_compositor; QSharedPointer m_mockSurface; + + wl_list m_frameCallbackList; + + friend void surface_attach(wl_client *client, wl_resource *surface, + wl_resource *buffer, int x, int y); + friend void surface_damage(wl_client *client, wl_resource *surface, + int32_t x, int32_t y, int32_t width, int32_t height); + friend void surface_frame(wl_client *client, wl_resource *surface, uint32_t callback); }; } diff --git a/tests/auto/wayland/tst_client.cpp b/tests/auto/wayland/tst_client.cpp index 9b63337c5da..b6d434f8a5f 100644 --- a/tests/auto/wayland/tst_client.cpp +++ b/tests/auto/wayland/tst_client.cpp @@ -41,6 +41,9 @@ #include "mockcompositor.h" +#include +#include + #include static const QSize screenSize(1600, 1200); @@ -123,10 +126,18 @@ public slots: compositor->processWaylandEvents(); } + void cleanup() + { + // make sure the surfaces from the last test are properly cleaned up + // and don't show up as false positives in the next test + QTRY_VERIFY(!compositor->surface()); + } + private slots: void screen(); void createDestroyWindow(); void events(); + void backingStore(); private: MockCompositor *compositor; @@ -192,6 +203,42 @@ void tst_WaylandClient::events() QTRY_COMPARE(window.mouseReleaseEventCount, 1); } +void tst_WaylandClient::backingStore() +{ + TestWindow window; + window.show(); + + QSharedPointer surface; + QTRY_VERIFY(surface = compositor->surface()); + + QRect rect(QPoint(), window.size()); + + QBackingStore backingStore(&window); + backingStore.resize(rect.size()); + + backingStore.beginPaint(rect); + + QColor color = Qt::magenta; + + QPainter p(backingStore.paintDevice()); + p.fillRect(rect, color); + p.end(); + + backingStore.endPaint(); + + QVERIFY(surface->image.isNull()); + + backingStore.flush(rect); + + QTRY_COMPARE(surface->image.size(), rect.size()); + QTRY_COMPARE(surface->image.pixel(0, 0), color.rgba()); + + window.hide(); + + // hiding the window should detach the buffer + QTRY_VERIFY(surface->image.isNull()); +} + int main(int argc, char **argv) { setenv("XDG_RUNTIME_DIR", ".", 1); From d862ff8c7f39b8d42fdc5bae02d40e9c67ea5fa7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Mon, 12 Mar 2012 08:58:10 +0100 Subject: [PATCH 0016/1507] Added missing header for client autotest. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Iabfaf1b570be7a2082f15fc25d5e715a9613b4d7 Reviewed-by: Jørgen Lind --- tests/auto/wayland/mockshm.h | 62 ++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 tests/auto/wayland/mockshm.h diff --git a/tests/auto/wayland/mockshm.h b/tests/auto/wayland/mockshm.h new file mode 100644 index 00000000000..96c77129fad --- /dev/null +++ b/tests/auto/wayland/mockshm.h @@ -0,0 +1,62 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include + +#include + +namespace Impl { + +class ShmBuffer +{ +public: + ShmBuffer(wl_buffer *buffer); + + void refresh(); + QImage image() const; + +private: + wl_buffer *m_buffer; + QImage m_image; +}; + +} From c0b041ce053fa155c36fbdcf34197d8fa4409a6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Sun, 11 Mar 2012 13:05:08 +0100 Subject: [PATCH 0017/1507] Make the module not depend on QtBase configure This is convenient if we want to reconfigure without reconfiguring QtBase. Change-Id: I719ba0d89905287a557e962ed6d804514e44b7f5 Reviewed-by: Laszlo Agocs --- tests/auto/wayland/client.pro | 35 ++++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/tests/auto/wayland/client.pro b/tests/auto/wayland/client.pro index 12dad35501a..6bfe82b78f5 100644 --- a/tests/auto/wayland/client.pro +++ b/tests/auto/wayland/client.pro @@ -4,24 +4,29 @@ TARGET = tst_client QT += testlib QT += core-private gui-private -use_pkgconfig { - CONFIG += link_pkgconfig - PKGCONFIG += wayland-server +!contains(QT_CONFIG, no-pkg-config) { + #If Qt uses pkg-config then override pkgconfig from mkspec + QMAKE_CFLAGS_WAYLAND=$$system(pkg-config --cflags wayland-client 2>/dev/null) + QMAKE_LIBS_WAYLAND_CLIENT=$$system(pkg-config --libs-only-l wayland-client 2>/dev/null) + QMAKE_LIBS_WAYLAND_SERVER=$$system(pkg-config --libs-only-l wayland-server 2>/dev/null) + QMAKE_INCDIR_WAYLAND=$$system("pkg-config --cflags-only-I wayland-client 2>/dev/null | sed -e 's,^-I,,g' -e 's, -I, ,g'") + QMAKE_LIBDIR_WAYLAND=$$system("pkg-config --libs-only-L wayland-client 2>/dev/null | sed -e 's,^-L,,g' -e 's, -L, ,g'") + QMAKE_DEFINES_WAYLAND="" +} - #set the rpath - !isEmpty(QMAKE_LFLAGS_RPATH) { - WAYLAND_NEEDS_RPATH = $$system(pkg-config --libs-only-L wayland-server) - !isEmpty(WAYLAND_NEEDS_RPATH) { - WAYLAND_LIBDIR = $$system(pkg-config --variable=libdir wayland-server) - !isEmpty(WAYLAND_LIBDIR):QMAKE_LFLAGS += $${QMAKE_LFLAGS_RPATH}$${WAYLAND_LIBDIR} - } - } -} else { - INCLUDEPATH += $$QMAKE_INCDIR_WAYLAND +QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_WAYLAND +QMAKE_CFLAGS += $$QMAKE_CFLAGS_WAYLAND +DEFINES += $$QMAKE_DEFINES_WAYLAND +LIBS += $$QMAKE_LIBS_WAYLAND_CLIENT +LIBS += $$QMAKE_LIBS_WAYLAND_SERVER +!isEmpty(QMAKE_LIBDIR_WAYLAND) { + LIBS += -L$$QMAKE_LIBDIR_WAYLAND +} + +!isEmpty(QMAKE_LFLAGS_RPATH) { !isEmpty(QMAKE_LIBDIR_WAYLAND) { - LIBS += -L$$QMAKE_LIBDIR_WAYLAND + QMAKE_LFLAGS += $${QMAKE_LFLAGS_RPATH}$${QMAKE_LIBS_WAYLAND} } - LIBS += -lwayland-server -lffi } SOURCES += tst_client.cpp \ From fa72d60dbee1f1e5236a21cc232c44c21fc47e05 Mon Sep 17 00:00:00 2001 From: Andy Nichols Date: Fri, 30 Mar 2012 15:17:25 +0200 Subject: [PATCH 0018/1507] Fixed mockshell error in client auto test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Ibcb6bd807d281fbc14c35c98f4dabd4d7f82077b Reviewed-by: Samuel Rødal --- tests/auto/wayland/mockshell.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/wayland/mockshell.cpp b/tests/auto/wayland/mockshell.cpp index ede240d8ec6..f11a5303354 100644 --- a/tests/auto/wayland/mockshell.cpp +++ b/tests/auto/wayland/mockshell.cpp @@ -131,7 +131,7 @@ void shell_surface_set_maximized(wl_client *client, static void get_shell_surface(wl_client *client, wl_resource *compositorResource, uint32_t id, wl_resource *surfaceResource) { - const struct wl_shell_surface_interface shellSurfaceInterface = { + static const struct wl_shell_surface_interface shellSurfaceInterface = { shell_surface_move, shell_surface_resize, shell_surface_set_toplevel, From e009b62037099dfb418d05c64cf237ffd3088aa2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Fri, 6 Apr 2012 13:35:43 +0200 Subject: [PATCH 0019/1507] Update wayland_sha1 and implement buffer_pool interface MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I0628a7655a6deb061a5d0b6c6304c89d8655cf11 Reviewed-by: Samuel Rødal --- tests/auto/wayland/client.pro | 2 - tests/auto/wayland/mockcompositor.cpp | 3 +- tests/auto/wayland/mockshm.cpp | 96 --------------------------- tests/auto/wayland/mockshm.h | 62 ----------------- tests/auto/wayland/mocksurface.cpp | 12 +++- tests/auto/wayland/tst_client.cpp | 4 +- 6 files changed, 12 insertions(+), 167 deletions(-) delete mode 100644 tests/auto/wayland/mockshm.cpp delete mode 100644 tests/auto/wayland/mockshm.h diff --git a/tests/auto/wayland/client.pro b/tests/auto/wayland/client.pro index 6bfe82b78f5..9a7e2c8c2b7 100644 --- a/tests/auto/wayland/client.pro +++ b/tests/auto/wayland/client.pro @@ -33,9 +33,7 @@ SOURCES += tst_client.cpp \ mockcompositor.cpp \ mockinput.cpp \ mockshell.cpp \ - mockshm.cpp \ mocksurface.cpp \ mockoutput.cpp HEADERS += mockcompositor.h \ - mockshm.h \ mocksurface.h diff --git a/tests/auto/wayland/mockcompositor.cpp b/tests/auto/wayland/mockcompositor.cpp index c751bccb27d..119adc0544a 100644 --- a/tests/auto/wayland/mockcompositor.cpp +++ b/tests/auto/wayland/mockcompositor.cpp @@ -204,7 +204,7 @@ Compositor::Compositor() wl_display_add_global(m_display, &wl_output_interface, this, bindOutput); wl_display_add_global(m_display, &wl_shell_interface, this, bindShell); - initShm(); + wl_display_init_shm(m_display); m_loop = wl_display_get_event_loop(m_display); m_fd = wl_event_loop_get_fd(m_loop); @@ -212,7 +212,6 @@ Compositor::Compositor() Compositor::~Compositor() { - wl_shm_finish(m_shm); wl_display_destroy(m_display); } diff --git a/tests/auto/wayland/mockshm.cpp b/tests/auto/wayland/mockshm.cpp deleted file mode 100644 index 5c0ba38a35d..00000000000 --- a/tests/auto/wayland/mockshm.cpp +++ /dev/null @@ -1,96 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "mockcompositor.h" -#include "mockshm.h" - -namespace Impl { - -ShmBuffer::ShmBuffer(wl_buffer *buffer) - : m_buffer(buffer) -{ - refresh(); -} - -void ShmBuffer::refresh() -{ - m_image = QImage(static_cast(wl_shm_buffer_get_data(m_buffer)), - m_buffer->width, m_buffer->height, - wl_shm_buffer_get_stride(m_buffer), - QImage::Format_ARGB32_Premultiplied); -} - -QImage ShmBuffer::image() const -{ - return m_image; -} - -static void shm_buffer_created(wl_buffer *buffer) -{ - buffer->user_data = new ShmBuffer(buffer); -} - -static void shm_buffer_damaged(wl_buffer *buffer, - int32_t x, int32_t y, - int32_t width, int32_t height) -{ - Q_UNUSED(QRect(x, y, width, height)); - static_cast(buffer->user_data)->refresh(); -} - -static void shm_buffer_destroyed(wl_buffer *buffer) -{ - delete static_cast(buffer->user_data); -} - -void Compositor::initShm() -{ - static struct wl_shm_callbacks shmCallbacks = { - shm_buffer_created, - shm_buffer_damaged, - shm_buffer_destroyed - }; - - m_shm = wl_shm_init(m_display, &shmCallbacks); -} - -} - diff --git a/tests/auto/wayland/mockshm.h b/tests/auto/wayland/mockshm.h deleted file mode 100644 index 96c77129fad..00000000000 --- a/tests/auto/wayland/mockshm.h +++ /dev/null @@ -1,62 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include - -#include - -namespace Impl { - -class ShmBuffer -{ -public: - ShmBuffer(wl_buffer *buffer); - - void refresh(); - QImage image() const; - -private: - wl_buffer *m_buffer; - QImage m_image; -}; - -} diff --git a/tests/auto/wayland/mocksurface.cpp b/tests/auto/wayland/mocksurface.cpp index 68c18bac634..f149822f68e 100644 --- a/tests/auto/wayland/mocksurface.cpp +++ b/tests/auto/wayland/mocksurface.cpp @@ -41,7 +41,6 @@ #include "mocksurface.h" #include "mockcompositor.h" -#include "mockshm.h" namespace Impl { @@ -87,8 +86,15 @@ void surface_damage(wl_client *client, wl_resource *surfaceResource, if (!buffer) return; - if (wl_buffer_is_shm(buffer)) - surface->m_mockSurface->image = static_cast(buffer->user_data)->image(); + if (wl_buffer_is_shm(buffer)) { + int stride = wl_shm_buffer_get_stride(buffer); + uint format = wl_shm_buffer_get_format(buffer); + (void) format; + void *data = wl_shm_buffer_get_data(buffer); + const uchar *char_data = static_cast(data); + QImage img(char_data, buffer->width, buffer->height, stride, QImage::Format_ARGB32_Premultiplied); + surface->m_mockSurface->image = img; + } wl_resource *frameCallback; wl_list_for_each(frameCallback, &surface->m_frameCallbackList, link) { diff --git a/tests/auto/wayland/tst_client.cpp b/tests/auto/wayland/tst_client.cpp index b6d434f8a5f..5b594198e75 100644 --- a/tests/auto/wayland/tst_client.cpp +++ b/tests/auto/wayland/tst_client.cpp @@ -230,8 +230,8 @@ void tst_WaylandClient::backingStore() backingStore.flush(rect); - QTRY_COMPARE(surface->image.size(), rect.size()); - QTRY_COMPARE(surface->image.pixel(0, 0), color.rgba()); + QTRY_COMPARE(surface->image.size(), window.frameGeometry().size()); + QTRY_COMPARE(surface->image.pixel(window.frameMargins().left(), window.frameMargins().top()), color.rgba()); window.hide(); From d4884fa940976871eea5dd30e84de4034eaac93c Mon Sep 17 00:00:00 2001 From: Hannu Lyytinen Date: Wed, 18 Apr 2012 23:14:47 +0300 Subject: [PATCH 0020/1507] Sync up with the latest wayland developments. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit makes the qtwayland module compatible with wayland sha1 677c5180e67be18b7a0867fafb7f205b57a6e9ff. Change-Id: I5af0510034b7e4a038313b80f1f6e0b18fa48eb3 Reviewed-by: Jørgen Lind Reviewed-by: Laszlo Agocs Reviewed-by: Samuel Rødal --- tests/auto/wayland/mockcompositor.cpp | 15 +++++++++------ tests/auto/wayland/mockcompositor.h | 1 + tests/auto/wayland/mockinput.cpp | 16 ++++++++++------ tests/auto/wayland/mocksurface.cpp | 5 ++--- 4 files changed, 22 insertions(+), 15 deletions(-) diff --git a/tests/auto/wayland/mockcompositor.cpp b/tests/auto/wayland/mockcompositor.cpp index 119adc0544a..6c7c66fa786 100644 --- a/tests/auto/wayland/mockcompositor.cpp +++ b/tests/auto/wayland/mockcompositor.cpp @@ -244,11 +244,9 @@ void Compositor::bindCompositor(wl_client *client, void *compositorData, uint32_ wl_client_add_object(client, &wl_compositor_interface, &compositorInterface, id, compositorData); } -static void unregisterResourceCallback(wl_listener *listener, - wl_resource *resource, - uint32_t time) +static void unregisterResourceCallback(wl_listener *listener, void *data) { - Q_UNUSED(time); + struct wl_resource *resource = reinterpret_cast(data); wl_list_remove(&resource->link); delete listener; } @@ -258,9 +256,9 @@ void registerResource(wl_list *list, wl_resource *resource) wl_list_insert(list, &resource->link); wl_listener *listener = new wl_listener; - listener->func = unregisterResourceCallback; + listener->notify = unregisterResourceCallback; - wl_list_insert(&resource->destroy_listener_list, &listener->link); + wl_signal_add(&resource->destroy_signal, listener); } QVector Compositor::surfaces() const @@ -268,6 +266,11 @@ QVector Compositor::surfaces() const return m_surfaces; } +uint32_t Compositor::nextSerial() +{ + return wl_display_next_serial(m_display); +} + void Compositor::addSurface(Surface *surface) { m_surfaces << surface; diff --git a/tests/auto/wayland/mockcompositor.h b/tests/auto/wayland/mockcompositor.h index 2d1e4183661..c47f5f2d191 100644 --- a/tests/auto/wayland/mockcompositor.h +++ b/tests/auto/wayland/mockcompositor.h @@ -69,6 +69,7 @@ public: int fileDescriptor() const { return m_fd; } void dispatchEvents(int timeout = 0); + uint32_t nextSerial(); uint32_t time() { return ++m_time; } static void setOutputGeometry(void *compositor, const QList ¶meters); diff --git a/tests/auto/wayland/mockinput.cpp b/tests/auto/wayland/mockinput.cpp index b5c90d7ed7e..4138e8f3808 100644 --- a/tests/auto/wayland/mockinput.cpp +++ b/tests/auto/wayland/mockinput.cpp @@ -95,7 +95,7 @@ static wl_surface *resolveSurface(const QVariant &v) void Compositor::setKeyboardFocus(void *data, const QList ¶meters) { Compositor *compositor = static_cast(data); - wl_input_device_set_keyboard_focus(&compositor->m_input, resolveSurface(parameters.first()), compositor->time()); + wl_input_device_set_keyboard_focus(&compositor->m_input, resolveSurface(parameters.first())); } void Compositor::sendMousePress(void *data, const QList ¶meters) @@ -106,9 +106,10 @@ void Compositor::sendMousePress(void *data, const QList ¶meters) return; QPoint pos = parameters.last().toPoint(); - wl_input_device_set_pointer_focus(&compositor->m_input, surface, compositor->time(), pos.x(), pos.y()); + wl_input_device_set_pointer_focus(&compositor->m_input, surface, pos.x(), pos.y()); wl_input_device_send_motion(compositor->m_input.pointer_focus_resource, compositor->time(), pos.x(), pos.y()); - wl_input_device_send_button(compositor->m_input.pointer_focus_resource, compositor->time(), 0x110, 1); + wl_input_device_send_button(compositor->m_input.pointer_focus_resource, + compositor->nextSerial(), compositor->time(), 0x110, 1); } void Compositor::sendMouseRelease(void *data, const QList ¶meters) @@ -118,7 +119,8 @@ void Compositor::sendMouseRelease(void *data, const QList ¶meters) if (!surface) return; - wl_input_device_send_button(compositor->m_input.pointer_focus_resource, compositor->time(), 0x110, 0); + wl_input_device_send_button(compositor->m_input.pointer_focus_resource, + compositor->nextSerial(), compositor->time(), 0x110, 0); } void Compositor::sendKeyPress(void *data, const QList ¶meters) @@ -129,7 +131,8 @@ void Compositor::sendKeyPress(void *data, const QList ¶meters) return; QPoint pos = parameters.last().toPoint(); - wl_input_device_send_key(compositor->m_input.keyboard_focus_resource, compositor->time(), parameters.last().toUInt() - 8, 1); + wl_input_device_send_key(compositor->m_input.keyboard_focus_resource, + compositor->nextSerial(), compositor->time(), parameters.last().toUInt() - 8, 1); } void Compositor::sendKeyRelease(void *data, const QList ¶meters) @@ -139,7 +142,8 @@ void Compositor::sendKeyRelease(void *data, const QList ¶meters) if (!surface) return; - wl_input_device_send_key(compositor->m_input.keyboard_focus_resource, compositor->time(), parameters.last().toUInt() - 8, 0); + wl_input_device_send_key(compositor->m_input.keyboard_focus_resource, + compositor->nextSerial(), compositor->time(), parameters.last().toUInt() - 8, 0); } } diff --git a/tests/auto/wayland/mocksurface.cpp b/tests/auto/wayland/mocksurface.cpp index f149822f68e..43d63af6d3e 100644 --- a/tests/auto/wayland/mocksurface.cpp +++ b/tests/auto/wayland/mocksurface.cpp @@ -53,8 +53,7 @@ void destroy_surface(wl_resource *resource) static void surface_destroy(wl_client *, wl_resource *surfaceResource) { - Surface *surface = static_cast(surfaceResource->data); - wl_resource_destroy(surfaceResource, surface->compositor()->time()); + wl_resource_destroy(surfaceResource); } void surface_attach(wl_client *client, wl_resource *surfaceResource, @@ -99,7 +98,7 @@ void surface_damage(wl_client *client, wl_resource *surfaceResource, wl_resource *frameCallback; wl_list_for_each(frameCallback, &surface->m_frameCallbackList, link) { wl_callback_send_done(frameCallback, surface->m_compositor->time()); - wl_resource_destroy(frameCallback, surface->m_compositor->time()); + wl_resource_destroy(frameCallback); } wl_list_init(&surface->m_frameCallbackList); From 98c1cf6b4b050956a3bf3e95b1cd05b909789f9d Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 3 May 2012 17:12:58 +0200 Subject: [PATCH 0021/1507] Change uses of {to,from}Ascii to {to,from}Latin1 This operation should be a no-op anyway, since at this point in time, the fromAscii and toAscii functions simply call their fromLatin1 and toLatin1 counterparts. Task-number: QTBUG-21872 Change-Id: I70205b0d86451d31e81a4be4a521e454e1eff83f Reviewed-by: Paul Olav Tvete --- src/plugins/platforms/wayland/shared/qwaylandmimehelper.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/wayland/shared/qwaylandmimehelper.cpp b/src/plugins/platforms/wayland/shared/qwaylandmimehelper.cpp index b2d4af56219..e0b4c33609b 100644 --- a/src/plugins/platforms/wayland/shared/qwaylandmimehelper.cpp +++ b/src/plugins/platforms/wayland/shared/qwaylandmimehelper.cpp @@ -60,7 +60,7 @@ QByteArray QWaylandMimeHelper::getByteArray(QMimeData *mimeData, const QString & buf.open(QIODevice::ReadWrite); QByteArray fmt = "BMP"; if (mimeType.startsWith(QLatin1String("image/"))) { - QByteArray imgFmt = mimeType.mid(6).toUpper().toAscii(); + QByteArray imgFmt = mimeType.mid(6).toUpper().toLatin1(); if (QImageWriter::supportedImageFormats().contains(imgFmt)) fmt = imgFmt; } @@ -69,7 +69,7 @@ QByteArray QWaylandMimeHelper::getByteArray(QMimeData *mimeData, const QString & content = buf.buffer(); } } else if (mimeType == QLatin1String("application/x-color")) { - content = qvariant_cast(mimeData->colorData()).name().toAscii(); + content = qvariant_cast(mimeData->colorData()).name().toLatin1(); } else if (mimeType == QLatin1String("text/uri-list")) { QList urls = mimeData->urls(); for (int i = 0; i < urls.count(); ++i) { From 66e41e57a8a49a7f201e0196d995a4d3f0c3a6f8 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Tue, 8 May 2012 12:41:30 +0300 Subject: [PATCH 0022/1507] Update to wayland head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Ie012861bc40e3bc448d85c9d8c27f798434020ed Reviewed-by: Samuel Rødal --- tests/auto/wayland/mockshell.cpp | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/tests/auto/wayland/mockshell.cpp b/tests/auto/wayland/mockshell.cpp index f11a5303354..cfc439063b2 100644 --- a/tests/auto/wayland/mockshell.cpp +++ b/tests/auto/wayland/mockshell.cpp @@ -43,6 +43,15 @@ namespace Impl { +void shell_surface_pong(wl_client *client, + wl_resource *surface_resource, + uint32_t serial) +{ + Q_UNUSED(client); + Q_UNUSED(surface_resource); + Q_UNUSED(serial); +} + void shell_surface_move(wl_client *client, wl_resource *surface_resource, wl_resource *input_device_resource, @@ -129,16 +138,37 @@ void shell_surface_set_maximized(wl_client *client, Q_UNUSED(output); } +void shell_surface_set_title(wl_client *client, + wl_resource *surface_resource, + const char *title) +{ + Q_UNUSED(client); + Q_UNUSED(surface_resource); + Q_UNUSED(title); +} + +void shell_surface_set_class(wl_client *client, + wl_resource *surface_resource, + const char *class_) +{ + Q_UNUSED(client); + Q_UNUSED(surface_resource); + Q_UNUSED(class_); +} + static void get_shell_surface(wl_client *client, wl_resource *compositorResource, uint32_t id, wl_resource *surfaceResource) { static const struct wl_shell_surface_interface shellSurfaceInterface = { + shell_surface_pong, shell_surface_move, shell_surface_resize, shell_surface_set_toplevel, shell_surface_set_transient, shell_surface_set_fullscreen, shell_surface_set_popup, - shell_surface_set_maximized + shell_surface_set_maximized, + shell_surface_set_title, + shell_surface_set_class }; Q_UNUSED(compositorResource); From 837edd2e7818f85c2889f29e6f8fd6712004157a Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Wed, 9 May 2012 11:25:44 +0300 Subject: [PATCH 0023/1507] Start using the new wl_fixed_t type properly MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The mouse and touch coordinates cannot just be treated as integers anymore, they need to be converted from/to double using the helper functions. Some necessary QPoint -> QPointF changes have also been made. For the Qt-specific touch extension we will not switch to wl_fixed_t though. This is because the precision is unfortunately quite small (factor of 256 vs. 10000). Change-Id: I23deaaffe478a39495b12d336985bc62e38a6af4 Reviewed-by: Samuel Rødal --- tests/auto/wayland/mockinput.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/auto/wayland/mockinput.cpp b/tests/auto/wayland/mockinput.cpp index 4138e8f3808..f2a7640b55d 100644 --- a/tests/auto/wayland/mockinput.cpp +++ b/tests/auto/wayland/mockinput.cpp @@ -106,8 +106,10 @@ void Compositor::sendMousePress(void *data, const QList ¶meters) return; QPoint pos = parameters.last().toPoint(); - wl_input_device_set_pointer_focus(&compositor->m_input, surface, pos.x(), pos.y()); - wl_input_device_send_motion(compositor->m_input.pointer_focus_resource, compositor->time(), pos.x(), pos.y()); + wl_input_device_set_pointer_focus(&compositor->m_input, surface, + wl_fixed_from_int(pos.x()), wl_fixed_from_int(pos.y())); + wl_input_device_send_motion(compositor->m_input.pointer_focus_resource, compositor->time(), + wl_fixed_from_double(pos.x()), wl_fixed_from_double(pos.y())); wl_input_device_send_button(compositor->m_input.pointer_focus_resource, compositor->nextSerial(), compositor->time(), 0x110, 1); } From 5e002bc961bc4873e82b7637f1ec4c310e107cc1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Fri, 4 May 2012 16:31:52 +0200 Subject: [PATCH 0024/1507] Implemented refresh rate support. Implements QWaylandScreen::refreshRate() based on the wl_output mode information we get from the compositor. In the compositor, adds API to override the refresh rate, with the default set to whatever QScreen reports on the compositor-side. Change-Id: I5f5175f2498940875c6ec68d29d25cf5993a1e65 Reviewed-by: Laszlo Agocs --- tests/auto/wayland/mockoutput.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/auto/wayland/mockoutput.cpp b/tests/auto/wayland/mockoutput.cpp index 18773f021fe..8066c217248 100644 --- a/tests/auto/wayland/mockoutput.cpp +++ b/tests/auto/wayland/mockoutput.cpp @@ -64,7 +64,8 @@ void Compositor::sendOutputGeometry(wl_resource *resource) void Compositor::sendOutputMode(wl_resource *resource) { - wl_output_send_mode(resource, WL_OUTPUT_MODE_CURRENT | WL_OUTPUT_MODE_PREFERRED, 640, 480, 60); + const QRect &r = m_outputGeometry; + wl_output_send_mode(resource, WL_OUTPUT_MODE_CURRENT | WL_OUTPUT_MODE_PREFERRED, r.width(), r.height(), 60); } void Compositor::setOutputGeometry(void *c, const QList ¶meters) From ab9a05f21324afe8c4e4193321e25418c3774c20 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Thu, 17 May 2012 13:03:57 +0300 Subject: [PATCH 0025/1507] Migrate from wl_input_device to wl_seat MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I0d218c32478c2acce4d7012bdb26b0cde50ee633 Reviewed-by: Samuel Rødal --- tests/auto/wayland/mockcompositor.cpp | 10 ++- tests/auto/wayland/mockcompositor.h | 10 ++- tests/auto/wayland/mockinput.cpp | 109 +++++++++++++++++++------- 3 files changed, 96 insertions(+), 33 deletions(-) diff --git a/tests/auto/wayland/mockcompositor.cpp b/tests/auto/wayland/mockcompositor.cpp index 6c7c66fa786..4e5537e2698 100644 --- a/tests/auto/wayland/mockcompositor.cpp +++ b/tests/auto/wayland/mockcompositor.cpp @@ -197,10 +197,14 @@ Compositor::Compositor() wl_display_add_socket(m_display, 0); - wl_input_device_init(&m_input); + wl_seat_init(&m_seat); + wl_pointer_init(&m_pointer); + wl_seat_set_pointer(&m_seat, &m_pointer); + wl_keyboard_init(&m_keyboard); + wl_seat_set_keyboard(&m_seat, &m_keyboard); wl_display_add_global(m_display, &wl_compositor_interface, this, bindCompositor); - wl_display_add_global(m_display, &wl_input_device_interface, this, bindInput); + wl_display_add_global(m_display, &wl_seat_interface, this, bindSeat); wl_display_add_global(m_display, &wl_output_interface, this, bindOutput); wl_display_add_global(m_display, &wl_shell_interface, this, bindShell); @@ -212,6 +216,8 @@ Compositor::Compositor() Compositor::~Compositor() { + wl_pointer_release(&m_pointer); + wl_keyboard_release(&m_keyboard); wl_display_destroy(m_display); } diff --git a/tests/auto/wayland/mockcompositor.h b/tests/auto/wayland/mockcompositor.h index c47f5f2d191..8805d7bf2ca 100644 --- a/tests/auto/wayland/mockcompositor.h +++ b/tests/auto/wayland/mockcompositor.h @@ -87,10 +87,14 @@ public: private: static void bindCompositor(wl_client *client, void *data, uint32_t version, uint32_t id); - static void bindInput(wl_client *client, void *data, uint32_t version, uint32_t id); + static void bindSeat(wl_client *client, void *data, uint32_t version, uint32_t id); static void bindOutput(wl_client *client, void *data, uint32_t version, uint32_t id); static void bindShell(wl_client *client, void *data, uint32_t version, uint32_t id); + static void get_pointer(wl_client *client, wl_resource *resource, uint32_t id); + static void get_keyboard(wl_client *client, wl_resource *resource, uint32_t id); + static void get_touch(wl_client *client, wl_resource *resource, uint32_t id); + static void destroyInputResource(wl_resource *resource); void initShm(); @@ -108,7 +112,9 @@ private: wl_list m_outputResources; uint32_t m_time; - wl_input_device m_input; + wl_seat m_seat; + wl_pointer m_pointer; + wl_keyboard m_keyboard; QVector m_surfaces; }; diff --git a/tests/auto/wayland/mockinput.cpp b/tests/auto/wayland/mockinput.cpp index f2a7640b55d..8e67fc0eaad 100644 --- a/tests/auto/wayland/mockinput.cpp +++ b/tests/auto/wayland/mockinput.cpp @@ -47,22 +47,29 @@ namespace Impl { void Compositor::destroyInputResource(wl_resource *resource) { Compositor *compositor = static_cast(resource->data); - wl_input_device *input = &compositor->m_input; + wl_keyboard *keyboard = &compositor->m_keyboard; + wl_pointer *pointer = &compositor->m_pointer; - if (input->keyboard_focus_resource == resource) - input->keyboard_focus_resource = 0; - if (input->pointer_focus_resource == resource) - input->pointer_focus_resource = 0; + if (keyboard->focus_resource == resource) + keyboard->focus_resource = 0; + if (pointer->focus_resource == resource) + pointer->focus_resource = 0; wl_list_remove(&resource->link); free(resource); } -void input_device_attach(wl_client *client, - wl_resource *device_resource, - uint32_t time, - wl_resource *buffer_resource, int32_t x, int32_t y) +static void destroyInputDevice(wl_resource *resource) +{ + wl_list_remove(&resource->link); + free(resource); +} + +void pointer_attach(wl_client *client, + wl_resource *device_resource, + uint32_t time, + wl_resource *buffer_resource, int32_t x, int32_t y) { Q_UNUSED(client); Q_UNUSED(device_resource); @@ -71,18 +78,64 @@ void input_device_attach(wl_client *client, Q_UNUSED(QPoint(x, y)); } -void Compositor::bindInput(wl_client *client, void *compositorData, uint32_t version, uint32_t id) +void Compositor::get_pointer(wl_client *client, + wl_resource *resource, + uint32_t id) { - static const struct wl_input_device_interface inputDeviceInterface = { - input_device_attach, + static const struct wl_pointer_interface pointer_interface = { + pointer_attach + }; + Compositor *compositor = static_cast(resource->data); + wl_pointer *pointer = &compositor->m_pointer; + wl_resource *clientResource = wl_client_add_object(client, + &wl_pointer_interface, + &pointer_interface, + id, + pointer); + wl_list_insert(&pointer->resource_list, &clientResource->link); + clientResource->destroy = destroyInputDevice; +} + +void Compositor::get_keyboard(wl_client *client, + wl_resource *resource, + uint32_t id) +{ + Compositor *compositor = static_cast(resource->data); + wl_keyboard *keyboard = &compositor->m_keyboard; + wl_resource *clientResource = wl_client_add_object(client, + &wl_keyboard_interface, + 0, + id, + keyboard); + wl_list_insert(&keyboard->resource_list, &clientResource->link); + clientResource->destroy = destroyInputDevice; +} + +void Compositor::get_touch(wl_client *client, + wl_resource *resource, + uint32_t id) +{ + Q_UNUSED(client); + Q_UNUSED(resource); + Q_UNUSED(id); +} + +void Compositor::bindSeat(wl_client *client, void *compositorData, uint32_t version, uint32_t id) +{ + static const struct wl_seat_interface seatInterface = { + get_pointer, + get_keyboard, + get_touch }; Q_UNUSED(version); - wl_resource *resource = wl_client_add_object(client, &wl_input_device_interface, &inputDeviceInterface, id, compositorData); + wl_resource *resource = wl_client_add_object(client, &wl_seat_interface, &seatInterface, id, compositorData); resource->destroy = destroyInputResource; Compositor *compositor = static_cast(compositorData); - wl_list_insert(&compositor->m_input.resource_list, &resource->link); + wl_list_insert(&compositor->m_seat.base_resource_list, &resource->link); + + wl_seat_send_capabilities(resource, WL_SEAT_CAPABILITY_POINTER | WL_SEAT_CAPABILITY_KEYBOARD); } static wl_surface *resolveSurface(const QVariant &v) @@ -95,7 +148,7 @@ static wl_surface *resolveSurface(const QVariant &v) void Compositor::setKeyboardFocus(void *data, const QList ¶meters) { Compositor *compositor = static_cast(data); - wl_input_device_set_keyboard_focus(&compositor->m_input, resolveSurface(parameters.first())); + wl_keyboard_set_focus(&compositor->m_keyboard, resolveSurface(parameters.first())); } void Compositor::sendMousePress(void *data, const QList ¶meters) @@ -106,12 +159,12 @@ void Compositor::sendMousePress(void *data, const QList ¶meters) return; QPoint pos = parameters.last().toPoint(); - wl_input_device_set_pointer_focus(&compositor->m_input, surface, - wl_fixed_from_int(pos.x()), wl_fixed_from_int(pos.y())); - wl_input_device_send_motion(compositor->m_input.pointer_focus_resource, compositor->time(), - wl_fixed_from_double(pos.x()), wl_fixed_from_double(pos.y())); - wl_input_device_send_button(compositor->m_input.pointer_focus_resource, - compositor->nextSerial(), compositor->time(), 0x110, 1); + wl_pointer_set_focus(&compositor->m_pointer, surface, + wl_fixed_from_int(pos.x()), wl_fixed_from_int(pos.y())); + wl_pointer_send_motion(compositor->m_pointer.focus_resource, compositor->time(), + wl_fixed_from_double(pos.x()), wl_fixed_from_double(pos.y())); + wl_pointer_send_button(compositor->m_pointer.focus_resource, + compositor->nextSerial(), compositor->time(), 0x110, 1); } void Compositor::sendMouseRelease(void *data, const QList ¶meters) @@ -121,8 +174,8 @@ void Compositor::sendMouseRelease(void *data, const QList ¶meters) if (!surface) return; - wl_input_device_send_button(compositor->m_input.pointer_focus_resource, - compositor->nextSerial(), compositor->time(), 0x110, 0); + wl_pointer_send_button(compositor->m_pointer.focus_resource, + compositor->nextSerial(), compositor->time(), 0x110, 0); } void Compositor::sendKeyPress(void *data, const QList ¶meters) @@ -132,9 +185,8 @@ void Compositor::sendKeyPress(void *data, const QList ¶meters) if (!surface) return; - QPoint pos = parameters.last().toPoint(); - wl_input_device_send_key(compositor->m_input.keyboard_focus_resource, - compositor->nextSerial(), compositor->time(), parameters.last().toUInt() - 8, 1); + wl_keyboard_send_key(compositor->m_keyboard.focus_resource, + compositor->nextSerial(), compositor->time(), parameters.last().toUInt() - 8, 1); } void Compositor::sendKeyRelease(void *data, const QList ¶meters) @@ -144,9 +196,8 @@ void Compositor::sendKeyRelease(void *data, const QList ¶meters) if (!surface) return; - wl_input_device_send_key(compositor->m_input.keyboard_focus_resource, - compositor->nextSerial(), compositor->time(), parameters.last().toUInt() - 8, 0); + wl_keyboard_send_key(compositor->m_keyboard.focus_resource, + compositor->nextSerial(), compositor->time(), parameters.last().toUInt() - 8, 0); } } - From 3ae7c408f92bf3c6b378d10ae6d6a36bbb80fcec Mon Sep 17 00:00:00 2001 From: Donald Carr Date: Wed, 6 Jun 2012 20:10:11 +0000 Subject: [PATCH 0026/1507] Introduce standard pkg-config usage MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use our own qualified pkg-config mkspec feature rather than directly executing the system binary Change-Id: I4b162cd8d2d9a8bd5d0b3adb9ca935df9ff96a69 Reviewed-by: Jørgen Lind --- tests/auto/wayland/client.pro | 27 ++++----------------------- 1 file changed, 4 insertions(+), 23 deletions(-) diff --git a/tests/auto/wayland/client.pro b/tests/auto/wayland/client.pro index 9a7e2c8c2b7..a92aa88b7e2 100644 --- a/tests/auto/wayland/client.pro +++ b/tests/auto/wayland/client.pro @@ -1,32 +1,13 @@ -CONFIG += testcase +CONFIG += testcase link_pkgconfig TARGET = tst_client QT += testlib QT += core-private gui-private !contains(QT_CONFIG, no-pkg-config) { - #If Qt uses pkg-config then override pkgconfig from mkspec - QMAKE_CFLAGS_WAYLAND=$$system(pkg-config --cflags wayland-client 2>/dev/null) - QMAKE_LIBS_WAYLAND_CLIENT=$$system(pkg-config --libs-only-l wayland-client 2>/dev/null) - QMAKE_LIBS_WAYLAND_SERVER=$$system(pkg-config --libs-only-l wayland-server 2>/dev/null) - QMAKE_INCDIR_WAYLAND=$$system("pkg-config --cflags-only-I wayland-client 2>/dev/null | sed -e 's,^-I,,g' -e 's, -I, ,g'") - QMAKE_LIBDIR_WAYLAND=$$system("pkg-config --libs-only-L wayland-client 2>/dev/null | sed -e 's,^-L,,g' -e 's, -L, ,g'") - QMAKE_DEFINES_WAYLAND="" -} - -QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_WAYLAND -QMAKE_CFLAGS += $$QMAKE_CFLAGS_WAYLAND -DEFINES += $$QMAKE_DEFINES_WAYLAND -LIBS += $$QMAKE_LIBS_WAYLAND_CLIENT -LIBS += $$QMAKE_LIBS_WAYLAND_SERVER -!isEmpty(QMAKE_LIBDIR_WAYLAND) { - LIBS += -L$$QMAKE_LIBDIR_WAYLAND -} - -!isEmpty(QMAKE_LFLAGS_RPATH) { - !isEmpty(QMAKE_LIBDIR_WAYLAND) { - QMAKE_LFLAGS += $${QMAKE_LFLAGS_RPATH}$${QMAKE_LIBS_WAYLAND} - } + PKGCONFIG += wayland-client wayland-server +} else { + LIBS += -lwayland-client -lwayland-server } SOURCES += tst_client.cpp \ From 36de23840d923965467852539a36a831c96ff178 Mon Sep 17 00:00:00 2001 From: Jorgen Lind Date: Mon, 13 Aug 2012 08:32:30 +0200 Subject: [PATCH 0027/1507] Compile fixes Change-Id: Ie532b5cd87dbcb9546b23c2ce7d013137933fbb8 Reviewed-by: Laszlo Agocs --- tests/auto/wayland/tst_client.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/auto/wayland/tst_client.cpp b/tests/auto/wayland/tst_client.cpp index 5b594198e75..3348847fc84 100644 --- a/tests/auto/wayland/tst_client.cpp +++ b/tests/auto/wayland/tst_client.cpp @@ -43,6 +43,7 @@ #include #include +#include #include From 86d6f4a4fde6f64367f657a268f5e49816085903 Mon Sep 17 00:00:00 2001 From: Jorgen Lind Date: Fri, 17 Aug 2012 12:04:29 +0200 Subject: [PATCH 0028/1507] Update Wayland SHA Change-Id: I3a0adb4b935282b9bb421a87dc8241d6ea8271f0 Reviewed-by: Laszlo Agocs --- tests/auto/wayland/mockoutput.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/wayland/mockoutput.cpp b/tests/auto/wayland/mockoutput.cpp index 8066c217248..6211e1535c4 100644 --- a/tests/auto/wayland/mockoutput.cpp +++ b/tests/auto/wayland/mockoutput.cpp @@ -59,7 +59,7 @@ void Compositor::bindOutput(wl_client *client, void *compositorData, uint32_t ve void Compositor::sendOutputGeometry(wl_resource *resource) { const QRect &r = m_outputGeometry; - wl_output_send_geometry(resource, r.x(), r.y(), r.width(), r.height(), 0, "", ""); + wl_output_send_geometry(resource, r.x(), r.y(), r.width(), r.height(), 0, "", "",0); } void Compositor::sendOutputMode(wl_resource *resource) From 2d85b884ec79660a622f5fcc2425453a2b1f2268 Mon Sep 17 00:00:00 2001 From: Iikka Eklund Date: Mon, 24 Sep 2012 09:58:43 +0300 Subject: [PATCH 0029/1507] Change copyrights from Nokia to Digia MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change copyrights and license headers from Nokia to Digia Change-Id: Ie65cbe0c622780d2f0672bce19d267d1167620ff Reviewed-by: Sergio Ahumada Reviewed-by: Jørgen Lind --- .../wayland/shared/qwaylandmimehelper.cpp | 50 +++++++++---------- .../wayland/shared/qwaylandmimehelper.h | 50 +++++++++---------- tests/auto/wayland/mockcompositor.cpp | 50 +++++++++---------- tests/auto/wayland/mockcompositor.h | 50 +++++++++---------- tests/auto/wayland/mockinput.cpp | 50 +++++++++---------- tests/auto/wayland/mockoutput.cpp | 50 +++++++++---------- tests/auto/wayland/mockshell.cpp | 50 +++++++++---------- tests/auto/wayland/mocksurface.cpp | 50 +++++++++---------- tests/auto/wayland/mocksurface.h | 50 +++++++++---------- tests/auto/wayland/tst_client.cpp | 50 +++++++++---------- 10 files changed, 250 insertions(+), 250 deletions(-) diff --git a/src/plugins/platforms/wayland/shared/qwaylandmimehelper.cpp b/src/plugins/platforms/wayland/shared/qwaylandmimehelper.cpp index e0b4c33609b..ccc48ef2c21 100644 --- a/src/plugins/platforms/wayland/shared/qwaylandmimehelper.cpp +++ b/src/plugins/platforms/wayland/shared/qwaylandmimehelper.cpp @@ -1,38 +1,38 @@ /**************************************************************************** ** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal ** ** This file is part of the plugins of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. ** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. ** ** ** $QT_END_LICENSE$ diff --git a/src/plugins/platforms/wayland/shared/qwaylandmimehelper.h b/src/plugins/platforms/wayland/shared/qwaylandmimehelper.h index 877271a42d3..f31685cd6f5 100644 --- a/src/plugins/platforms/wayland/shared/qwaylandmimehelper.h +++ b/src/plugins/platforms/wayland/shared/qwaylandmimehelper.h @@ -1,38 +1,38 @@ /**************************************************************************** ** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal ** ** This file is part of the plugins of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. ** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. ** ** ** $QT_END_LICENSE$ diff --git a/tests/auto/wayland/mockcompositor.cpp b/tests/auto/wayland/mockcompositor.cpp index 4e5537e2698..d25f90565a3 100644 --- a/tests/auto/wayland/mockcompositor.cpp +++ b/tests/auto/wayland/mockcompositor.cpp @@ -1,38 +1,38 @@ /**************************************************************************** ** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal ** ** This file is part of the test suite of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. ** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. ** ** ** $QT_END_LICENSE$ diff --git a/tests/auto/wayland/mockcompositor.h b/tests/auto/wayland/mockcompositor.h index 8805d7bf2ca..6bfd5d6bdf1 100644 --- a/tests/auto/wayland/mockcompositor.h +++ b/tests/auto/wayland/mockcompositor.h @@ -1,38 +1,38 @@ /**************************************************************************** ** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal ** ** This file is part of the test suite of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. ** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. ** ** ** $QT_END_LICENSE$ diff --git a/tests/auto/wayland/mockinput.cpp b/tests/auto/wayland/mockinput.cpp index 8e67fc0eaad..50c8b764c61 100644 --- a/tests/auto/wayland/mockinput.cpp +++ b/tests/auto/wayland/mockinput.cpp @@ -1,38 +1,38 @@ /**************************************************************************** ** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal ** ** This file is part of the test suite of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. ** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. ** ** ** $QT_END_LICENSE$ diff --git a/tests/auto/wayland/mockoutput.cpp b/tests/auto/wayland/mockoutput.cpp index 6211e1535c4..9b948ad4d3e 100644 --- a/tests/auto/wayland/mockoutput.cpp +++ b/tests/auto/wayland/mockoutput.cpp @@ -1,38 +1,38 @@ /**************************************************************************** ** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal ** ** This file is part of the test suite of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. ** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. ** ** ** $QT_END_LICENSE$ diff --git a/tests/auto/wayland/mockshell.cpp b/tests/auto/wayland/mockshell.cpp index cfc439063b2..0d841f64c24 100644 --- a/tests/auto/wayland/mockshell.cpp +++ b/tests/auto/wayland/mockshell.cpp @@ -1,38 +1,38 @@ /**************************************************************************** ** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal ** ** This file is part of the test suite of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. ** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. ** ** ** $QT_END_LICENSE$ diff --git a/tests/auto/wayland/mocksurface.cpp b/tests/auto/wayland/mocksurface.cpp index 43d63af6d3e..49b672f9d9e 100644 --- a/tests/auto/wayland/mocksurface.cpp +++ b/tests/auto/wayland/mocksurface.cpp @@ -1,38 +1,38 @@ /**************************************************************************** ** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal ** ** This file is part of the test suite of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. ** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. ** ** ** $QT_END_LICENSE$ diff --git a/tests/auto/wayland/mocksurface.h b/tests/auto/wayland/mocksurface.h index da77b3638ff..74014fcd30a 100644 --- a/tests/auto/wayland/mocksurface.h +++ b/tests/auto/wayland/mocksurface.h @@ -1,38 +1,38 @@ /**************************************************************************** ** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal ** ** This file is part of the test suite of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. ** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. ** ** ** $QT_END_LICENSE$ diff --git a/tests/auto/wayland/tst_client.cpp b/tests/auto/wayland/tst_client.cpp index 3348847fc84..b43f531161e 100644 --- a/tests/auto/wayland/tst_client.cpp +++ b/tests/auto/wayland/tst_client.cpp @@ -1,38 +1,38 @@ /**************************************************************************** ** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal ** ** This file is part of the test suite of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. ** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. ** ** ** $QT_END_LICENSE$ From 59c86ce6bf4cd9d03b4d890cdb08fa65e357d5ee Mon Sep 17 00:00:00 2001 From: Andy Nichols Date: Fri, 30 Nov 2012 13:52:00 +0100 Subject: [PATCH 0030/1507] Cleanup QtWayland module MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Now that both xkbcommon 0.2.0 and libWayland 1.0.0 have been released, we should no longer be building against sha1's and should be preparing for an eventual release so these build hints have been removed. A test has been added for libWayland 1.0.0 which is required to build QtWayland. README has been updated to reflect the current situation src/3rdparty has been removed as it has not been used in some time. patches folder and contents have been removed as they are no longer needed. extensions folder has been moved to the src folder Change-Id: Iab79b5c164758a4bd0253c90f60b2a2d044e2785 Reviewed-by: Paul Olav Tvete Reviewed-by: Samuel Rødal --- src/3rdparty/ffi-arm/LICENSE | 21 - src/3rdparty/ffi-arm/ffi.c | 309 -------------- src/3rdparty/ffi-arm/ffi.h | 399 ------------------ src/3rdparty/ffi-arm/ffi.pro | 13 - src/3rdparty/ffi-arm/ffi_common.h | 122 ------ src/3rdparty/ffi-arm/fficonfig.h | 182 -------- src/3rdparty/ffi-arm/ffitarget.h | 49 --- src/3rdparty/ffi-arm/prep_cif.c | 174 -------- src/3rdparty/ffi-arm/sysv.S | 306 -------------- src/3rdparty/ffi-arm/types.c | 77 ---- src/3rdparty/wayland/extensions/brcm.xml | 54 +++ .../wayland/extensions/output-extension.xml | 64 +++ .../wayland/extensions/qtkey-extension.xml | 62 +++ .../extensions/sub-surface-extension.xml | 69 +++ .../wayland/extensions/surface-extension.xml | 89 ++++ .../wayland/extensions/touch-extension.xml | 71 ++++ .../wayland/extensions/windowmanager.xml | 64 +++ .../wayland/extensions/xcomposite.xml | 61 +++ .../wayland/wayland-drm-client-protocol.h | 135 ------ src/3rdparty/wayland/wayland-drm-protocol.c | 43 -- .../wayland/wayland-drm-server-protocol.h | 62 --- 21 files changed, 534 insertions(+), 1892 deletions(-) delete mode 100644 src/3rdparty/ffi-arm/LICENSE delete mode 100644 src/3rdparty/ffi-arm/ffi.c delete mode 100644 src/3rdparty/ffi-arm/ffi.h delete mode 100644 src/3rdparty/ffi-arm/ffi.pro delete mode 100644 src/3rdparty/ffi-arm/ffi_common.h delete mode 100644 src/3rdparty/ffi-arm/fficonfig.h delete mode 100644 src/3rdparty/ffi-arm/ffitarget.h delete mode 100644 src/3rdparty/ffi-arm/prep_cif.c delete mode 100644 src/3rdparty/ffi-arm/sysv.S delete mode 100644 src/3rdparty/ffi-arm/types.c create mode 100644 src/3rdparty/wayland/extensions/brcm.xml create mode 100644 src/3rdparty/wayland/extensions/output-extension.xml create mode 100644 src/3rdparty/wayland/extensions/qtkey-extension.xml create mode 100644 src/3rdparty/wayland/extensions/sub-surface-extension.xml create mode 100644 src/3rdparty/wayland/extensions/surface-extension.xml create mode 100644 src/3rdparty/wayland/extensions/touch-extension.xml create mode 100644 src/3rdparty/wayland/extensions/windowmanager.xml create mode 100644 src/3rdparty/wayland/extensions/xcomposite.xml delete mode 100644 src/3rdparty/wayland/wayland-drm-client-protocol.h delete mode 100644 src/3rdparty/wayland/wayland-drm-protocol.c delete mode 100644 src/3rdparty/wayland/wayland-drm-server-protocol.h diff --git a/src/3rdparty/ffi-arm/LICENSE b/src/3rdparty/ffi-arm/LICENSE deleted file mode 100644 index ec2fd694878..00000000000 --- a/src/3rdparty/ffi-arm/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -libffi - Copyright (c) 1996-2009 Anthony Green, Red Hat, Inc and others. -See source files for details. - -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 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. diff --git a/src/3rdparty/ffi-arm/ffi.c b/src/3rdparty/ffi-arm/ffi.c deleted file mode 100644 index f6a64758f73..00000000000 --- a/src/3rdparty/ffi-arm/ffi.c +++ /dev/null @@ -1,309 +0,0 @@ -/* ----------------------------------------------------------------------- - ffi.c - Copyright (c) 1998, 2008 Red Hat, Inc. - - ARM Foreign Function Interface - - 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 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 -#include - -#include - -/* ffi_prep_args is called by the assembly routine once stack space - has been allocated for the function's arguments */ - -void ffi_prep_args(char *stack, extended_cif *ecif) -{ - register unsigned int i; - register void **p_argv; - register char *argp; - register ffi_type **p_arg; - - argp = stack; - - if ( ecif->cif->flags == FFI_TYPE_STRUCT ) { - *(void **) argp = ecif->rvalue; - argp += 4; - } - - p_argv = ecif->avalue; - - for (i = ecif->cif->nargs, p_arg = ecif->cif->arg_types; - (i != 0); - i--, p_arg++) - { - size_t z; - - /* Align if necessary */ - if (((*p_arg)->alignment - 1) & (unsigned) argp) { - argp = (char *) ALIGN(argp, (*p_arg)->alignment); - } - - if ((*p_arg)->type == FFI_TYPE_STRUCT) - argp = (char *) ALIGN(argp, 4); - - z = (*p_arg)->size; - if (z < sizeof(int)) - { - z = sizeof(int); - switch ((*p_arg)->type) - { - case FFI_TYPE_SINT8: - *(signed int *) argp = (signed int)*(SINT8 *)(* p_argv); - break; - - case FFI_TYPE_UINT8: - *(unsigned int *) argp = (unsigned int)*(UINT8 *)(* p_argv); - break; - - case FFI_TYPE_SINT16: - *(signed int *) argp = (signed int)*(SINT16 *)(* p_argv); - break; - - case FFI_TYPE_UINT16: - *(unsigned int *) argp = (unsigned int)*(UINT16 *)(* p_argv); - break; - - case FFI_TYPE_STRUCT: - memcpy(argp, *p_argv, (*p_arg)->size); - break; - - default: - FFI_ASSERT(0); - } - } - else if (z == sizeof(int)) - { - *(unsigned int *) argp = (unsigned int)*(UINT32 *)(* p_argv); - } - else - { - memcpy(argp, *p_argv, z); - } - p_argv++; - argp += z; - } - - return; -} - -/* Perform machine dependent cif processing */ -ffi_status ffi_prep_cif_machdep(ffi_cif *cif) -{ - /* Round the stack up to a multiple of 8 bytes. This isn't needed - everywhere, but it is on some platforms, and it doesn't harm anything - when it isn't needed. */ - cif->bytes = (cif->bytes + 7) & ~7; - - /* Set the return type flag */ - switch (cif->rtype->type) - { - case FFI_TYPE_VOID: - case FFI_TYPE_FLOAT: - case FFI_TYPE_DOUBLE: - cif->flags = (unsigned) cif->rtype->type; - break; - - case FFI_TYPE_SINT64: - case FFI_TYPE_UINT64: - cif->flags = (unsigned) FFI_TYPE_SINT64; - break; - - case FFI_TYPE_STRUCT: - if (cif->rtype->size <= 4) - /* A Composite Type not larger than 4 bytes is returned in r0. */ - cif->flags = (unsigned)FFI_TYPE_INT; - else - /* A Composite Type larger than 4 bytes, or whose size cannot - be determined statically ... is stored in memory at an - address passed [in r0]. */ - cif->flags = (unsigned)FFI_TYPE_STRUCT; - break; - - default: - cif->flags = FFI_TYPE_INT; - break; - } - - return FFI_OK; -} - -extern void ffi_call_SYSV(void (*)(char *, extended_cif *), extended_cif *, - unsigned, unsigned, unsigned *, void (*fn)(void)); - -void ffi_call(ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue) -{ - extended_cif ecif; - - int small_struct = (cif->flags == FFI_TYPE_INT - && cif->rtype->type == FFI_TYPE_STRUCT); - - ecif.cif = cif; - ecif.avalue = avalue; - - unsigned int temp; - - /* If the return value is a struct and we don't have a return */ - /* value address then we need to make one */ - - if ((rvalue == NULL) && - (cif->flags == FFI_TYPE_STRUCT)) - { - ecif.rvalue = alloca(cif->rtype->size); - } - else if (small_struct) - ecif.rvalue = &temp; - else - ecif.rvalue = rvalue; - - switch (cif->abi) - { - case FFI_SYSV: - ffi_call_SYSV(ffi_prep_args, &ecif, cif->bytes, cif->flags, ecif.rvalue, - fn); - - break; - default: - FFI_ASSERT(0); - break; - } - if (small_struct) - memcpy (rvalue, &temp, cif->rtype->size); -} - -/** private members **/ - -static void ffi_prep_incoming_args_SYSV (char *stack, void **ret, - void** args, ffi_cif* cif); - -void ffi_closure_SYSV (ffi_closure *); - -/* This function is jumped to by the trampoline */ - -unsigned int -ffi_closure_SYSV_inner (closure, respp, args) - ffi_closure *closure; - void **respp; - void *args; -{ - // our various things... - ffi_cif *cif; - void **arg_area; - - cif = closure->cif; - arg_area = (void**) alloca (cif->nargs * sizeof (void*)); - - /* this call will initialize ARG_AREA, such that each - * element in that array points to the corresponding - * value on the stack; and if the function returns - * a structure, it will re-set RESP to point to the - * structure return address. */ - - ffi_prep_incoming_args_SYSV(args, respp, arg_area, cif); - - (closure->fun) (cif, *respp, arg_area, closure->user_data); - - return cif->flags; -} - -/*@-exportheader@*/ -static void -ffi_prep_incoming_args_SYSV(char *stack, void **rvalue, - void **avalue, ffi_cif *cif) -/*@=exportheader@*/ -{ - register unsigned int i; - register void **p_argv; - register char *argp; - register ffi_type **p_arg; - - argp = stack; - - if ( cif->flags == FFI_TYPE_STRUCT ) { - *rvalue = *(void **) argp; - argp += 4; - } - - p_argv = avalue; - - for (i = cif->nargs, p_arg = cif->arg_types; (i != 0); i--, p_arg++) - { - size_t z; - - size_t alignment = (*p_arg)->alignment; - if (alignment < 4) - alignment = 4; - /* Align if necessary */ - if ((alignment - 1) & (unsigned) argp) { - argp = (char *) ALIGN(argp, alignment); - } - - z = (*p_arg)->size; - - /* because we're little endian, this is what it turns into. */ - - *p_argv = (void*) argp; - - p_argv++; - argp += z; - } - - return; -} - -/* How to make a trampoline. */ - -#define FFI_INIT_TRAMPOLINE(TRAMP,FUN,CTX) \ -({ unsigned char *__tramp = (unsigned char*)(TRAMP); \ - unsigned int __fun = (unsigned int)(FUN); \ - unsigned int __ctx = (unsigned int)(CTX); \ - *(unsigned int*) &__tramp[0] = 0xe92d000f; /* stmfd sp!, {r0-r3} */ \ - *(unsigned int*) &__tramp[4] = 0xe59f0000; /* ldr r0, [pc] */ \ - *(unsigned int*) &__tramp[8] = 0xe59ff000; /* ldr pc, [pc] */ \ - *(unsigned int*) &__tramp[12] = __ctx; \ - *(unsigned int*) &__tramp[16] = __fun; \ - __clear_cache((&__tramp[0]), (&__tramp[19])); \ - }) - - -/* the cif must already be prep'ed */ - -ffi_status -ffi_prep_closure_loc (ffi_closure* closure, - ffi_cif* cif, - void (*fun)(ffi_cif*,void*,void**,void*), - void *user_data, - void *codeloc) -{ - FFI_ASSERT (cif->abi == FFI_SYSV); - - FFI_INIT_TRAMPOLINE (&closure->tramp[0], \ - &ffi_closure_SYSV, \ - codeloc); - - closure->cif = cif; - closure->user_data = user_data; - closure->fun = fun; - - return FFI_OK; -} diff --git a/src/3rdparty/ffi-arm/ffi.h b/src/3rdparty/ffi-arm/ffi.h deleted file mode 100644 index 1f578d9a6fc..00000000000 --- a/src/3rdparty/ffi-arm/ffi.h +++ /dev/null @@ -1,399 +0,0 @@ -/* -----------------------------------------------------------------*-C-*- - libffi 3.0.9 - Copyright (c) 1996-2003, 2007, 2008 Red Hat, Inc. - - 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 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. - - ----------------------------------------------------------------------- */ - -/* ------------------------------------------------------------------- - The basic API is described in the README file. - - The raw API is designed to bypass some of the argument packing - and unpacking on architectures for which it can be avoided. - - The closure API allows interpreted functions to be packaged up - inside a C function pointer, so that they can be called as C functions, - with no understanding on the client side that they are interpreted. - It can also be used in other cases in which it is necessary to package - up a user specified parameter and a function pointer as a single - function pointer. - - The closure API must be implemented in order to get its functionality, - e.g. for use by gij. Routines are provided to emulate the raw API - if the underlying platform doesn't allow faster implementation. - - More details on the raw and cloure API can be found in: - - http://gcc.gnu.org/ml/java/1999-q3/msg00138.html - - and - - http://gcc.gnu.org/ml/java/1999-q3/msg00174.html - -------------------------------------------------------------------- */ - -#ifndef LIBFFI_H -#define LIBFFI_H - -#ifdef __cplusplus -extern "C" { -#endif - -/* Specify which architecture libffi is configured for. */ -#define ARM - -/* ---- System configuration information --------------------------------- */ - -#include - -#ifndef LIBFFI_ASM - -#ifdef _MSC_VER -#define __attribute__(X) -#endif - -#include -#include - -/* LONG_LONG_MAX is not always defined (not if STRICT_ANSI, for example). - But we can find it either under the correct ANSI name, or under GNU - C's internal name. */ -#ifdef LONG_LONG_MAX -# define FFI_LONG_LONG_MAX LONG_LONG_MAX -#else -# ifdef LLONG_MAX -# define FFI_LONG_LONG_MAX LLONG_MAX -# else -# ifdef __GNUC__ -# define FFI_LONG_LONG_MAX __LONG_LONG_MAX__ -# endif -# endif -#endif - -/* The closure code assumes that this works on pointers, i.e. a size_t */ -/* can hold a pointer. */ - -typedef struct _ffi_type -{ - size_t size; - unsigned short alignment; - unsigned short type; - struct _ffi_type **elements; -} ffi_type; - -#ifndef LIBFFI_HIDE_BASIC_TYPES -#if SCHAR_MAX == 127 -# define ffi_type_uchar ffi_type_uint8 -# define ffi_type_schar ffi_type_sint8 -#else - #error "char size not supported" -#endif - -#if SHRT_MAX == 32767 -# define ffi_type_ushort ffi_type_uint16 -# define ffi_type_sshort ffi_type_sint16 -#elif SHRT_MAX == 2147483647 -# define ffi_type_ushort ffi_type_uint32 -# define ffi_type_sshort ffi_type_sint32 -#else - #error "short size not supported" -#endif - -#if INT_MAX == 32767 -# define ffi_type_uint ffi_type_uint16 -# define ffi_type_sint ffi_type_sint16 -#elif INT_MAX == 2147483647 -# define ffi_type_uint ffi_type_uint32 -# define ffi_type_sint ffi_type_sint32 -#elif INT_MAX == 9223372036854775807 -# define ffi_type_uint ffi_type_uint64 -# define ffi_type_sint ffi_type_sint64 -#else - #error "int size not supported" -#endif - -#if LONG_MAX == 2147483647 -# if FFI_LONG_LONG_MAX != 9223372036854775807 - #error "no 64-bit data type supported" -# endif -#elif LONG_MAX != 9223372036854775807 - #error "long size not supported" -#endif - -#if LONG_MAX == 2147483647 -# define ffi_type_ulong ffi_type_uint32 -# define ffi_type_slong ffi_type_sint32 -#elif LONG_MAX == 9223372036854775807 -# define ffi_type_ulong ffi_type_uint64 -# define ffi_type_slong ffi_type_sint64 -#else - #error "long size not supported" -#endif - -/* These are defined in types.c */ -extern ffi_type ffi_type_void; -extern ffi_type ffi_type_uint8; -extern ffi_type ffi_type_sint8; -extern ffi_type ffi_type_uint16; -extern ffi_type ffi_type_sint16; -extern ffi_type ffi_type_uint32; -extern ffi_type ffi_type_sint32; -extern ffi_type ffi_type_uint64; -extern ffi_type ffi_type_sint64; -extern ffi_type ffi_type_float; -extern ffi_type ffi_type_double; -extern ffi_type ffi_type_pointer; - -#if 1 -extern ffi_type ffi_type_longdouble; -#else -#define ffi_type_longdouble ffi_type_double -#endif -#endif /* LIBFFI_HIDE_BASIC_TYPES */ - -typedef enum { - FFI_OK = 0, - FFI_BAD_TYPEDEF, - FFI_BAD_ABI -} ffi_status; - -typedef unsigned FFI_TYPE; - -typedef struct { - ffi_abi abi; - unsigned nargs; - ffi_type **arg_types; - ffi_type *rtype; - unsigned bytes; - unsigned flags; -#ifdef FFI_EXTRA_CIF_FIELDS - FFI_EXTRA_CIF_FIELDS; -#endif -} ffi_cif; - -/* ---- Definitions for the raw API -------------------------------------- */ - -#ifndef FFI_SIZEOF_ARG -# if LONG_MAX == 2147483647 -# define FFI_SIZEOF_ARG 4 -# elif LONG_MAX == 9223372036854775807 -# define FFI_SIZEOF_ARG 8 -# endif -#endif - -#ifndef FFI_SIZEOF_JAVA_RAW -# define FFI_SIZEOF_JAVA_RAW FFI_SIZEOF_ARG -#endif - -typedef union { - ffi_sarg sint; - ffi_arg uint; - float flt; - char data[FFI_SIZEOF_ARG]; - void* ptr; -} ffi_raw; - -#if FFI_SIZEOF_JAVA_RAW == 4 && FFI_SIZEOF_ARG == 8 -/* This is a special case for mips64/n32 ABI (and perhaps others) where - sizeof(void *) is 4 and FFI_SIZEOF_ARG is 8. */ -typedef union { - signed int sint; - unsigned int uint; - float flt; - char data[FFI_SIZEOF_JAVA_RAW]; - void* ptr; -} ffi_java_raw; -#else -typedef ffi_raw ffi_java_raw; -#endif - - -void ffi_raw_call (ffi_cif *cif, - void (*fn)(void), - void *rvalue, - ffi_raw *avalue); - -void ffi_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_raw *raw); -void ffi_raw_to_ptrarray (ffi_cif *cif, ffi_raw *raw, void **args); -size_t ffi_raw_size (ffi_cif *cif); - -/* This is analogous to the raw API, except it uses Java parameter */ -/* packing, even on 64-bit machines. I.e. on 64-bit machines */ -/* longs and doubles are followed by an empty 64-bit word. */ - -void ffi_java_raw_call (ffi_cif *cif, - void (*fn)(void), - void *rvalue, - ffi_java_raw *avalue); - -void ffi_java_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_java_raw *raw); -void ffi_java_raw_to_ptrarray (ffi_cif *cif, ffi_java_raw *raw, void **args); -size_t ffi_java_raw_size (ffi_cif *cif); - -/* ---- Definitions for closures ----------------------------------------- */ - -#if FFI_CLOSURES - -typedef struct { - char tramp[FFI_TRAMPOLINE_SIZE]; - ffi_cif *cif; - void (*fun)(ffi_cif*,void*,void**,void*); - void *user_data; -#ifdef __GNUC__ -} ffi_closure __attribute__((aligned (8))); -#else -} ffi_closure; -#endif - -void *ffi_closure_alloc (size_t size, void **code); -void ffi_closure_free (void *); - -ffi_status -ffi_prep_closure (ffi_closure*, - ffi_cif *, - void (*fun)(ffi_cif*,void*,void**,void*), - void *user_data); - -ffi_status -ffi_prep_closure_loc (ffi_closure*, - ffi_cif *, - void (*fun)(ffi_cif*,void*,void**,void*), - void *user_data, - void*codeloc); - -typedef struct { - char tramp[FFI_TRAMPOLINE_SIZE]; - - ffi_cif *cif; - -#if !FFI_NATIVE_RAW_API - - /* if this is enabled, then a raw closure has the same layout - as a regular closure. We use this to install an intermediate - handler to do the transaltion, void** -> ffi_raw*. */ - - void (*translate_args)(ffi_cif*,void*,void**,void*); - void *this_closure; - -#endif - - void (*fun)(ffi_cif*,void*,ffi_raw*,void*); - void *user_data; - -} ffi_raw_closure; - -typedef struct { - char tramp[FFI_TRAMPOLINE_SIZE]; - - ffi_cif *cif; - -#if !FFI_NATIVE_RAW_API - - /* if this is enabled, then a raw closure has the same layout - as a regular closure. We use this to install an intermediate - handler to do the transaltion, void** -> ffi_raw*. */ - - void (*translate_args)(ffi_cif*,void*,void**,void*); - void *this_closure; - -#endif - - void (*fun)(ffi_cif*,void*,ffi_java_raw*,void*); - void *user_data; - -} ffi_java_raw_closure; - -ffi_status -ffi_prep_raw_closure (ffi_raw_closure*, - ffi_cif *cif, - void (*fun)(ffi_cif*,void*,ffi_raw*,void*), - void *user_data); - -ffi_status -ffi_prep_raw_closure_loc (ffi_raw_closure*, - ffi_cif *cif, - void (*fun)(ffi_cif*,void*,ffi_raw*,void*), - void *user_data, - void *codeloc); - -ffi_status -ffi_prep_java_raw_closure (ffi_java_raw_closure*, - ffi_cif *cif, - void (*fun)(ffi_cif*,void*,ffi_java_raw*,void*), - void *user_data); - -ffi_status -ffi_prep_java_raw_closure_loc (ffi_java_raw_closure*, - ffi_cif *cif, - void (*fun)(ffi_cif*,void*,ffi_java_raw*,void*), - void *user_data, - void *codeloc); - -#endif /* FFI_CLOSURES */ - -/* ---- Public interface definition -------------------------------------- */ - -ffi_status ffi_prep_cif(ffi_cif *cif, - ffi_abi abi, - unsigned int nargs, - ffi_type *rtype, - ffi_type **atypes); - -void ffi_call(ffi_cif *cif, - void (*fn)(void), - void *rvalue, - void **avalue); - -/* Useful for eliminating compiler warnings */ -#define FFI_FN(f) ((void (*)(void))f) - -/* ---- Definitions shared with assembly code ---------------------------- */ - -#endif - -/* If these change, update src/mips/ffitarget.h. */ -#define FFI_TYPE_VOID 0 -#define FFI_TYPE_INT 1 -#define FFI_TYPE_FLOAT 2 -#define FFI_TYPE_DOUBLE 3 -#if 1 -#define FFI_TYPE_LONGDOUBLE 4 -#else -#define FFI_TYPE_LONGDOUBLE FFI_TYPE_DOUBLE -#endif -#define FFI_TYPE_UINT8 5 -#define FFI_TYPE_SINT8 6 -#define FFI_TYPE_UINT16 7 -#define FFI_TYPE_SINT16 8 -#define FFI_TYPE_UINT32 9 -#define FFI_TYPE_SINT32 10 -#define FFI_TYPE_UINT64 11 -#define FFI_TYPE_SINT64 12 -#define FFI_TYPE_STRUCT 13 -#define FFI_TYPE_POINTER 14 - -/* This should always refer to the last type code (for sanity checks) */ -#define FFI_TYPE_LAST FFI_TYPE_POINTER - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/src/3rdparty/ffi-arm/ffi.pro b/src/3rdparty/ffi-arm/ffi.pro deleted file mode 100644 index 1e9106292fd..00000000000 --- a/src/3rdparty/ffi-arm/ffi.pro +++ /dev/null @@ -1,13 +0,0 @@ -TEMPLATE = lib -TARGET = ffi -DESTDIR=$$PWD/../../../lib/ - -CONFIG -= qt -CONFIG += shared - -SOURCES = ffi.c \ - prep_cif.c \ - types.c \ - sysv.S - -OBJECTS_DIR = .obj diff --git a/src/3rdparty/ffi-arm/ffi_common.h b/src/3rdparty/ffi-arm/ffi_common.h deleted file mode 100644 index 42cace91502..00000000000 --- a/src/3rdparty/ffi-arm/ffi_common.h +++ /dev/null @@ -1,122 +0,0 @@ -/* ----------------------------------------------------------------------- - ffi_common.h - Copyright (c) 1996 Red Hat, Inc. - Copyright (C) 2007 Free Software Foundation, Inc - - Common internal definitions and macros. Only necessary for building - libffi. - ----------------------------------------------------------------------- */ - -#ifndef FFI_COMMON_H -#define FFI_COMMON_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -/* Do not move this. Some versions of AIX are very picky about where - this is positioned. */ -#ifdef __GNUC__ -/* mingw64 defines this already in malloc.h. */ -#ifndef alloca -# define alloca __builtin_alloca -#endif -# define MAYBE_UNUSED __attribute__((__unused__)) -#else -# define MAYBE_UNUSED -# if HAVE_ALLOCA_H -# include -# else -# ifdef _AIX - #pragma alloca -# else -# ifndef alloca /* predefined by HP cc +Olibcalls */ -# ifdef _MSC_VER -# define alloca _alloca -# else -char *alloca (); -# endif -# endif -# endif -# endif -#endif - -/* Check for the existence of memcpy. */ -#if STDC_HEADERS -# include -#else -# ifndef HAVE_MEMCPY -# define memcpy(d, s, n) bcopy ((s), (d), (n)) -# endif -#endif - -#if defined(FFI_DEBUG) -#include -#endif - -#ifdef FFI_DEBUG -void ffi_assert(char *expr, char *file, int line); -void ffi_stop_here(void); -void ffi_type_test(ffi_type *a, char *file, int line); - -#define FFI_ASSERT(x) ((x) ? (void)0 : ffi_assert(#x, __FILE__,__LINE__)) -#define FFI_ASSERT_AT(x, f, l) ((x) ? 0 : ffi_assert(#x, (f), (l))) -#define FFI_ASSERT_VALID_TYPE(x) ffi_type_test (x, __FILE__, __LINE__) -#else -#define FFI_ASSERT(x) -#define FFI_ASSERT_AT(x, f, l) -#define FFI_ASSERT_VALID_TYPE(x) -#endif - -#define ALIGN(v, a) (((((size_t) (v))-1) | ((a)-1))+1) -#define ALIGN_DOWN(v, a) (((size_t) (v)) & -a) - -/* Perform machine dependent cif processing */ -ffi_status ffi_prep_cif_machdep(ffi_cif *cif); - -/* Extended cif, used in callback from assembly routine */ -typedef struct -{ - ffi_cif *cif; - void *rvalue; - void **avalue; -} extended_cif; - -/* Terse sized type definitions. */ -#if defined(_MSC_VER) || defined(__sgi) -typedef unsigned char UINT8; -typedef signed char SINT8; -typedef unsigned short UINT16; -typedef signed short SINT16; -typedef unsigned int UINT32; -typedef signed int SINT32; -# ifdef _MSC_VER -typedef unsigned __int64 UINT64; -typedef signed __int64 SINT64; -# else -# include -typedef uint64_t UINT64; -typedef int64_t SINT64; -# endif -#else -typedef unsigned int UINT8 __attribute__((__mode__(__QI__))); -typedef signed int SINT8 __attribute__((__mode__(__QI__))); -typedef unsigned int UINT16 __attribute__((__mode__(__HI__))); -typedef signed int SINT16 __attribute__((__mode__(__HI__))); -typedef unsigned int UINT32 __attribute__((__mode__(__SI__))); -typedef signed int SINT32 __attribute__((__mode__(__SI__))); -typedef unsigned int UINT64 __attribute__((__mode__(__DI__))); -typedef signed int SINT64 __attribute__((__mode__(__DI__))); -#endif - -typedef float FLOAT32; - - -#ifdef __cplusplus -} -#endif - -#endif - - diff --git a/src/3rdparty/ffi-arm/fficonfig.h b/src/3rdparty/ffi-arm/fficonfig.h deleted file mode 100644 index 61b3a1db6e9..00000000000 --- a/src/3rdparty/ffi-arm/fficonfig.h +++ /dev/null @@ -1,182 +0,0 @@ -/* fficonfig.h. Generated from fficonfig.h.in by configure. */ -/* fficonfig.h.in. Generated from configure.ac by autoheader. */ - -/* Define if building universal (internal helper macro) */ -/* #undef AC_APPLE_UNIVERSAL_BUILD */ - -/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP - systems. This function is required for `alloca.c' support on those systems. - */ -/* #undef CRAY_STACKSEG_END */ - -/* Define to 1 if using `alloca.c'. */ -/* #undef C_ALLOCA */ - -/* Define to the flags needed for the .section .eh_frame directive. */ -#define EH_FRAME_FLAGS "a" - -/* Define this if you want extra debugging. */ -/* #undef FFI_DEBUG */ - -/* Cannot use malloc on this target, so, we revert to alternative means */ -/* #undef FFI_MMAP_EXEC_WRIT */ - -/* Define this is you do not want support for the raw API. */ -/* #undef FFI_NO_RAW_API */ - -/* Define this is you do not want support for aggregate types. */ -/* #undef FFI_NO_STRUCTS */ - -/* Define to 1 if you have `alloca', as a function or macro. */ -#define HAVE_ALLOCA 1 - -/* Define to 1 if you have and it should be used (not on Ultrix). - */ -#define HAVE_ALLOCA_H 1 - -/* Define if your assembler supports .cfi_* directives. */ -#define HAVE_AS_CFI_PSEUDO_OP 1 - -/* Define if your assembler supports .register. */ -/* #undef HAVE_AS_REGISTER_PSEUDO_OP */ - -/* Define if your assembler and linker support unaligned PC relative relocs. - */ -/* #undef HAVE_AS_SPARC_UA_PCREL */ - -/* Define if your assembler supports PC relative relocs. */ -/* #undef HAVE_AS_X86_PCREL */ - -/* Define to 1 if you have the header file. */ -#define HAVE_DLFCN_H 1 - -/* Define if __attribute__((visibility("hidden"))) is supported. */ -#define HAVE_HIDDEN_VISIBILITY_ATTRIBUTE 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_INTTYPES_H 1 - -/* Define if you have the long double type and it is bigger than a double */ -#define HAVE_LONG_DOUBLE 1 - -/* Define to 1 if you have the `memcpy' function. */ -#define HAVE_MEMCPY 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_MEMORY_H 1 - -/* Define to 1 if you have the `mmap' function. */ -#define HAVE_MMAP 1 - -/* Define if mmap with MAP_ANON(YMOUS) works. */ -#define HAVE_MMAP_ANON 1 - -/* Define if mmap of /dev/zero works. */ -#define HAVE_MMAP_DEV_ZERO 1 - -/* Define if read-only mmap of a plain file works. */ -#define HAVE_MMAP_FILE 1 - -/* Define if .eh_frame sections should be read-only. */ -#define HAVE_RO_EH_FRAME 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STDINT_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STDLIB_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STRINGS_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STRING_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_MMAN_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_STAT_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_TYPES_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_UNISTD_H 1 - -/* Define to the sub-directory in which libtool stores uninstalled libraries. - */ -#define LT_OBJDIR ".libs/" - -/* Define to 1 if your C compiler doesn't accept -c and -o together. */ -/* #undef NO_MINUS_C_MINUS_O */ - -/* Name of package */ -#define PACKAGE "libffi" - -/* Define to the address where bug reports for this package should be sent. */ -#define PACKAGE_BUGREPORT "http://gcc.gnu.org/bugs.html" - -/* Define to the full name of this package. */ -#define PACKAGE_NAME "libffi" - -/* Define to the full name and version of this package. */ -#define PACKAGE_STRING "libffi 3.0.9" - -/* Define to the one symbol short name of this package. */ -#define PACKAGE_TARNAME "libffi" - -/* Define to the version of this package. */ -#define PACKAGE_VERSION "3.0.9" - -/* The size of `double', as computed by sizeof. */ -#define SIZEOF_DOUBLE 8 - -/* The size of `long double', as computed by sizeof. */ -#define SIZEOF_LONG_DOUBLE 12 - -/* If using the C implementation of alloca, define if you know the - direction of stack growth for your system; otherwise it will be - automatically deduced at runtime. - STACK_DIRECTION > 0 => grows toward higher addresses - STACK_DIRECTION < 0 => grows toward lower addresses - STACK_DIRECTION = 0 => direction of growth unknown */ -/* #undef STACK_DIRECTION */ - -/* Define to 1 if you have the ANSI C header files. */ -#define STDC_HEADERS 1 - -/* Define this if you are using Purify and want to suppress spurious messages. - */ -/* #undef USING_PURIFY */ - -/* Version number of package */ -#define VERSION "3.0.9" - -/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most - significant byte first (like Motorola and SPARC, unlike Intel). */ -#if defined AC_APPLE_UNIVERSAL_BUILD -# if defined __BIG_ENDIAN__ -# define WORDS_BIGENDIAN 1 -# endif -#else -# ifndef WORDS_BIGENDIAN -/* # undef WORDS_BIGENDIAN */ -# endif -#endif - - -#ifdef HAVE_HIDDEN_VISIBILITY_ATTRIBUTE -#ifdef LIBFFI_ASM -#define FFI_HIDDEN(name) .hidden name -#else -#define FFI_HIDDEN __attribute__ ((visibility ("hidden"))) -#endif -#else -#ifdef LIBFFI_ASM -#define FFI_HIDDEN(name) -#else -#define FFI_HIDDEN -#endif -#endif - diff --git a/src/3rdparty/ffi-arm/ffitarget.h b/src/3rdparty/ffi-arm/ffitarget.h deleted file mode 100644 index a9574266954..00000000000 --- a/src/3rdparty/ffi-arm/ffitarget.h +++ /dev/null @@ -1,49 +0,0 @@ -/* -----------------------------------------------------------------*-C-*- - ffitarget.h - Copyright (c) 1996-2003 Red Hat, Inc. - Target configuration macros for ARM. - - 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 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. - - ----------------------------------------------------------------------- */ - -#ifndef LIBFFI_TARGET_H -#define LIBFFI_TARGET_H - -#ifndef LIBFFI_ASM -typedef unsigned long ffi_arg; -typedef signed long ffi_sarg; - -typedef enum ffi_abi { - FFI_FIRST_ABI = 0, - FFI_SYSV, - FFI_DEFAULT_ABI = FFI_SYSV, - FFI_LAST_ABI = FFI_DEFAULT_ABI + 1 -} ffi_abi; -#endif - -/* ---- Definitions for closures ----------------------------------------- */ - -#define FFI_CLOSURES 1 -#define FFI_TRAMPOLINE_SIZE 20 -#define FFI_NATIVE_RAW_API 0 - -#endif - diff --git a/src/3rdparty/ffi-arm/prep_cif.c b/src/3rdparty/ffi-arm/prep_cif.c deleted file mode 100644 index eb78f9a2ed1..00000000000 --- a/src/3rdparty/ffi-arm/prep_cif.c +++ /dev/null @@ -1,174 +0,0 @@ -/* ----------------------------------------------------------------------- - prep_cif.c - Copyright (c) 1996, 1998, 2007 Red Hat, Inc. - - 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 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 -#include -#include - -/* Round up to FFI_SIZEOF_ARG. */ - -#define STACK_ARG_SIZE(x) ALIGN(x, FFI_SIZEOF_ARG) - -/* Perform machine independent initialization of aggregate type - specifications. */ - -static ffi_status initialize_aggregate(ffi_type *arg) -{ - ffi_type **ptr; - - FFI_ASSERT(arg != NULL); - - FFI_ASSERT(arg->elements != NULL); - FFI_ASSERT(arg->size == 0); - FFI_ASSERT(arg->alignment == 0); - - ptr = &(arg->elements[0]); - - while ((*ptr) != NULL) - { - if (((*ptr)->size == 0) && (initialize_aggregate((*ptr)) != FFI_OK)) - return FFI_BAD_TYPEDEF; - - /* Perform a sanity check on the argument type */ - FFI_ASSERT_VALID_TYPE(*ptr); - - arg->size = ALIGN(arg->size, (*ptr)->alignment); - arg->size += (*ptr)->size; - - arg->alignment = (arg->alignment > (*ptr)->alignment) ? - arg->alignment : (*ptr)->alignment; - - ptr++; - } - - /* Structure size includes tail padding. This is important for - structures that fit in one register on ABIs like the PowerPC64 - Linux ABI that right justify small structs in a register. - It's also needed for nested structure layout, for example - struct A { long a; char b; }; struct B { struct A x; char y; }; - should find y at an offset of 2*sizeof(long) and result in a - total size of 3*sizeof(long). */ - arg->size = ALIGN (arg->size, arg->alignment); - - if (arg->size == 0) - return FFI_BAD_TYPEDEF; - else - return FFI_OK; -} - -#ifndef __CRIS__ -/* The CRIS ABI specifies structure elements to have byte - alignment only, so it completely overrides this functions, - which assumes "natural" alignment and padding. */ - -/* Perform machine independent ffi_cif preparation, then call - machine dependent routine. */ - -ffi_status ffi_prep_cif(ffi_cif *cif, ffi_abi abi, unsigned int nargs, - ffi_type *rtype, ffi_type **atypes) -{ - unsigned bytes = 0; - unsigned int i; - ffi_type **ptr; - - FFI_ASSERT(cif != NULL); - FFI_ASSERT((abi > FFI_FIRST_ABI) && (abi <= FFI_DEFAULT_ABI)); - - cif->abi = abi; - cif->arg_types = atypes; - cif->nargs = nargs; - cif->rtype = rtype; - - cif->flags = 0; - - /* Initialize the return type if necessary */ - if ((cif->rtype->size == 0) && (initialize_aggregate(cif->rtype) != FFI_OK)) - return FFI_BAD_TYPEDEF; - - /* Perform a sanity check on the return type */ - FFI_ASSERT_VALID_TYPE(cif->rtype); - - /* x86-64 and s390 stack space allocation is handled in prep_machdep. */ -#if !defined M68K && !defined __x86_64__ && !defined S390 && !defined PA - /* Make space for the return structure pointer */ - if (cif->rtype->type == FFI_TYPE_STRUCT -#ifdef SPARC - && (cif->abi != FFI_V9 || cif->rtype->size > 32) -#endif -#ifdef X86_DARWIN - && (cif->rtype->size > 8) -#endif - ) - bytes = STACK_ARG_SIZE(sizeof(void*)); -#endif - - for (ptr = cif->arg_types, i = cif->nargs; i > 0; i--, ptr++) - { - - /* Initialize any uninitialized aggregate type definitions */ - if (((*ptr)->size == 0) && (initialize_aggregate((*ptr)) != FFI_OK)) - return FFI_BAD_TYPEDEF; - - /* Perform a sanity check on the argument type, do this - check after the initialization. */ - FFI_ASSERT_VALID_TYPE(*ptr); - -#if !defined __x86_64__ && !defined S390 && !defined PA -#ifdef SPARC - if (((*ptr)->type == FFI_TYPE_STRUCT - && ((*ptr)->size > 16 || cif->abi != FFI_V9)) - || ((*ptr)->type == FFI_TYPE_LONGDOUBLE - && cif->abi != FFI_V9)) - bytes += sizeof(void*); - else -#endif - { - /* Add any padding if necessary */ - if (((*ptr)->alignment - 1) & bytes) - bytes = ALIGN(bytes, (*ptr)->alignment); - - bytes += STACK_ARG_SIZE((*ptr)->size); - } -#endif - } - - cif->bytes = bytes; - - /* Perform machine dependent cif processing */ - return ffi_prep_cif_machdep(cif); -} -#endif /* not __CRIS__ */ - -#if FFI_CLOSURES - -ffi_status -ffi_prep_closure (ffi_closure* closure, - ffi_cif* cif, - void (*fun)(ffi_cif*,void*,void**,void*), - void *user_data) -{ - return ffi_prep_closure_loc (closure, cif, fun, user_data, closure); -} - -#endif diff --git a/src/3rdparty/ffi-arm/sysv.S b/src/3rdparty/ffi-arm/sysv.S deleted file mode 100644 index 4c289c697c7..00000000000 --- a/src/3rdparty/ffi-arm/sysv.S +++ /dev/null @@ -1,306 +0,0 @@ -/* ----------------------------------------------------------------------- - sysv.S - Copyright (c) 1998, 2008 Red Hat, Inc. - - ARM Foreign Function Interface - - 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 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. - ----------------------------------------------------------------------- */ - -#define LIBFFI_ASM -#include -#include -#ifdef HAVE_MACHINE_ASM_H -#include -#else -#ifdef __USER_LABEL_PREFIX__ -#define CONCAT1(a, b) CONCAT2(a, b) -#define CONCAT2(a, b) a ## b - -/* Use the right prefix for global labels. */ -#define CNAME(x) CONCAT1 (__USER_LABEL_PREFIX__, x) -#else -#define CNAME(x) x -#endif -#define ENTRY(x) .globl CNAME(x); .type CNAME(x),%function; CNAME(x): -#endif - -#ifdef __ELF__ -#define LSYM(x) .x -#else -#define LSYM(x) x -#endif - -/* We need a better way of testing for this, but for now, this is all - we can do. */ -@ This selects the minimum architecture level required. -#define __ARM_ARCH__ 3 - -#if defined(__ARM_ARCH_4__) || defined(__ARM_ARCH_4T__) -# undef __ARM_ARCH__ -# define __ARM_ARCH__ 4 -#endif - -#if defined(__ARM_ARCH_5__) || defined(__ARM_ARCH_5T__) \ - || defined(__ARM_ARCH_5E__) || defined(__ARM_ARCH_5TE__) \ - || defined(__ARM_ARCH_5TEJ__) -# undef __ARM_ARCH__ -# define __ARM_ARCH__ 5 -#endif - -#if defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) \ - || defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6Z__) \ - || defined(__ARM_ARCH_6ZK__) || defined(__ARM_ARCH_6T2__) \ - || defined(__ARM_ARCH_6M__) -# undef __ARM_ARCH__ -# define __ARM_ARCH__ 6 -#endif - -#if defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) \ - || defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7M__) -# undef __ARM_ARCH__ -# define __ARM_ARCH__ 7 -#endif - -#if __ARM_ARCH__ >= 5 -# define call_reg(x) blx x -#elif defined (__ARM_ARCH_4T__) -# define call_reg(x) mov lr, pc ; bx x -# if defined(__thumb__) || defined(__THUMB_INTERWORK__) -# define __INTERWORKING__ -# endif -#else -# define call_reg(x) mov lr, pc ; mov pc, x -#endif - -/* Conditionally compile unwinder directives. */ -#ifdef __ARM_EABI__ -#define UNWIND -#else -#define UNWIND @ -#endif - - -#if defined(__thumb__) && !defined(__THUMB_INTERWORK__) -.macro ARM_FUNC_START name - .text - .align 0 - .thumb - .thumb_func - ENTRY(\name) - bx pc - nop - .arm - UNWIND .fnstart -/* A hook to tell gdb that we've switched to ARM mode. Also used to call - directly from other local arm routines. */ -_L__\name: -.endm -#else -.macro ARM_FUNC_START name - .text - .align 0 - .arm - ENTRY(\name) - UNWIND .fnstart -.endm -#endif - -.macro RETLDM regs=, cond=, dirn=ia -#if defined (__INTERWORKING__) - .ifc "\regs","" - ldr\cond lr, [sp], #4 - .else - ldm\cond\dirn sp!, {\regs, lr} - .endif - bx\cond lr -#else - .ifc "\regs","" - ldr\cond pc, [sp], #4 - .else - ldm\cond\dirn sp!, {\regs, pc} - .endif -#endif -.endm - - - @ r0: ffi_prep_args - @ r1: &ecif - @ r2: cif->bytes - @ r3: fig->flags - @ sp+0: ecif.rvalue - @ sp+4: fn - - @ This assumes we are using gas. -ARM_FUNC_START ffi_call_SYSV - @ Save registers - stmfd sp!, {r0-r3, fp, lr} - UNWIND .save {r0-r3, fp, lr} - mov fp, sp - - UNWIND .setfp fp, sp - - @ Make room for all of the new args. - sub sp, fp, r2 - - @ Place all of the ffi_prep_args in position - mov ip, r0 - mov r0, sp - @ r1 already set - - @ Call ffi_prep_args(stack, &ecif) - call_reg(ip) - - @ move first 4 parameters in registers - ldmia sp, {r0-r3} - - @ and adjust stack - ldr ip, [fp, #8] - cmp ip, #16 - movhs ip, #16 - add sp, sp, ip - - @ call (fn) (...) - ldr ip, [fp, #28] - call_reg(ip) - - @ Remove the space we pushed for the args - mov sp, fp - - @ Load r2 with the pointer to storage for the return value - ldr r2, [sp, #24] - - @ Load r3 with the return type code - ldr r3, [sp, #12] - - @ If the return value pointer is NULL, assume no return value. - cmp r2, #0 - beq LSYM(Lepilogue) - -@ return INT - cmp r3, #FFI_TYPE_INT -#if defined(__SOFTFP__) || defined(__ARM_EABI__) - cmpne r3, #FFI_TYPE_FLOAT -#endif - streq r0, [r2] - beq LSYM(Lepilogue) - - @ return INT64 - cmp r3, #FFI_TYPE_SINT64 -#if defined(__SOFTFP__) || defined(__ARM_EABI__) - cmpne r3, #FFI_TYPE_DOUBLE -#endif - stmeqia r2, {r0, r1} - -#if !defined(__SOFTFP__) && !defined(__ARM_EABI__) - beq LSYM(Lepilogue) - -@ return FLOAT - cmp r3, #FFI_TYPE_FLOAT - stfeqs f0, [r2] - beq LSYM(Lepilogue) - -@ return DOUBLE or LONGDOUBLE - cmp r3, #FFI_TYPE_DOUBLE - stfeqd f0, [r2] -#endif - -LSYM(Lepilogue): - RETLDM "r0-r3,fp" - -.ffi_call_SYSV_end: - UNWIND .fnend - .size CNAME(ffi_call_SYSV),.ffi_call_SYSV_end-CNAME(ffi_call_SYSV) - -/* - unsigned int FFI_HIDDEN - ffi_closure_SYSV_inner (closure, respp, args) - ffi_closure *closure; - void **respp; - void *args; -*/ - -ARM_FUNC_START ffi_closure_SYSV - UNWIND .pad #16 - add ip, sp, #16 - stmfd sp!, {ip, lr} - UNWIND .save {r0, lr} - add r2, sp, #8 - .pad #16 - sub sp, sp, #16 - str sp, [sp, #8] - add r1, sp, #8 - bl ffi_closure_SYSV_inner - cmp r0, #FFI_TYPE_INT - beq .Lretint - - cmp r0, #FFI_TYPE_FLOAT -#if defined(__SOFTFP__) || defined(__ARM_EABI__) - beq .Lretint -#else - beq .Lretfloat -#endif - - cmp r0, #FFI_TYPE_DOUBLE -#if defined(__SOFTFP__) || defined(__ARM_EABI__) - beq .Lretlonglong -#else - beq .Lretdouble -#endif - - cmp r0, #FFI_TYPE_LONGDOUBLE -#if defined(__SOFTFP__) || defined(__ARM_EABI__) - beq .Lretlonglong -#else - beq .Lretlongdouble -#endif - - cmp r0, #FFI_TYPE_SINT64 - beq .Lretlonglong -.Lclosure_epilogue: - add sp, sp, #16 - ldmfd sp, {sp, pc} -.Lretint: - ldr r0, [sp] - b .Lclosure_epilogue -.Lretlonglong: - ldr r0, [sp] - ldr r1, [sp, #4] - b .Lclosure_epilogue - -#if !defined(__SOFTFP__) && !defined(__ARM_EABI__) -.Lretfloat: - ldfs f0, [sp] - b .Lclosure_epilogue -.Lretdouble: - ldfd f0, [sp] - b .Lclosure_epilogue -.Lretlongdouble: - ldfd f0, [sp] - b .Lclosure_epilogue -#endif - -.ffi_closure_SYSV_end: - UNWIND .fnend - .size CNAME(ffi_closure_SYSV),.ffi_closure_SYSV_end-CNAME(ffi_closure_SYSV) - -#if defined __ELF__ && defined __linux__ - .section .note.GNU-stack,"",%progbits -#endif diff --git a/src/3rdparty/ffi-arm/types.c b/src/3rdparty/ffi-arm/types.c deleted file mode 100644 index 0a11eb0fb4b..00000000000 --- a/src/3rdparty/ffi-arm/types.c +++ /dev/null @@ -1,77 +0,0 @@ -/* ----------------------------------------------------------------------- - types.c - Copyright (c) 1996, 1998 Red Hat, Inc. - - Predefined ffi_types needed by libffi. - - 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 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. - ----------------------------------------------------------------------- */ - -/* Hide the basic type definitions from the header file, so that we - can redefine them here as "const". */ -#define LIBFFI_HIDE_BASIC_TYPES - -#include -#include - -/* Type definitions */ - -#define FFI_TYPEDEF(name, type, id) \ -struct struct_align_##name { \ - char c; \ - type x; \ -}; \ -const ffi_type ffi_type_##name = { \ - sizeof(type), \ - offsetof(struct struct_align_##name, x), \ - id, NULL \ -} - -/* Size and alignment are fake here. They must not be 0. */ -const ffi_type ffi_type_void = { - 1, 1, FFI_TYPE_VOID, NULL -}; - -FFI_TYPEDEF(uint8, UINT8, FFI_TYPE_UINT8); -FFI_TYPEDEF(sint8, SINT8, FFI_TYPE_SINT8); -FFI_TYPEDEF(uint16, UINT16, FFI_TYPE_UINT16); -FFI_TYPEDEF(sint16, SINT16, FFI_TYPE_SINT16); -FFI_TYPEDEF(uint32, UINT32, FFI_TYPE_UINT32); -FFI_TYPEDEF(sint32, SINT32, FFI_TYPE_SINT32); -FFI_TYPEDEF(uint64, UINT64, FFI_TYPE_UINT64); -FFI_TYPEDEF(sint64, SINT64, FFI_TYPE_SINT64); - -FFI_TYPEDEF(pointer, void*, FFI_TYPE_POINTER); - -FFI_TYPEDEF(float, float, FFI_TYPE_FLOAT); -FFI_TYPEDEF(double, double, FFI_TYPE_DOUBLE); - -#ifdef __alpha__ -/* Even if we're not configured to default to 128-bit long double, - maintain binary compatibility, as -mlong-double-128 can be used - at any time. */ -/* Validate the hard-coded number below. */ -# if defined(__LONG_DOUBLE_128__) && FFI_TYPE_LONGDOUBLE != 4 -# error FFI_TYPE_LONGDOUBLE out of date -# endif -const ffi_type ffi_type_longdouble = { 16, 16, 4, NULL }; -#elif FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE -FFI_TYPEDEF(longdouble, long double, FFI_TYPE_LONGDOUBLE); -#endif diff --git a/src/3rdparty/wayland/extensions/brcm.xml b/src/3rdparty/wayland/extensions/brcm.xml new file mode 100644 index 00000000000..862026d0dc5 --- /dev/null +++ b/src/3rdparty/wayland/extensions/brcm.xml @@ -0,0 +1,54 @@ + + + + + Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). + Contact: http://www.qt-project.org/legal + + This file is part of the plugins of the Qt Toolkit. + + $QT_BEGIN_LICENSE:BSD$ + You may use this file under the terms of the BSD license as follows: + + "Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names + of its contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." + + $QT_END_LICENSE$ + + + + + + + + + + + + + + diff --git a/src/3rdparty/wayland/extensions/output-extension.xml b/src/3rdparty/wayland/extensions/output-extension.xml new file mode 100644 index 00000000000..0ca8214e6e3 --- /dev/null +++ b/src/3rdparty/wayland/extensions/output-extension.xml @@ -0,0 +1,64 @@ + + + + Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). + Contact: http://www.qt-project.org/legal + + This file is part of the plugins of the Qt Toolkit. + + $QT_BEGIN_LICENSE:BSD$ + You may use this file under the terms of the BSD license as follows: + + "Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names + of its contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." + + $QT_END_LICENSE$ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/3rdparty/wayland/extensions/qtkey-extension.xml b/src/3rdparty/wayland/extensions/qtkey-extension.xml new file mode 100644 index 00000000000..fc4d14dac8c --- /dev/null +++ b/src/3rdparty/wayland/extensions/qtkey-extension.xml @@ -0,0 +1,62 @@ + + + + Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). + Contact: http://www.qt-project.org/legal + + This file is part of the plugins of the Qt Toolkit. + + $QT_BEGIN_LICENSE:BSD$ + You may use this file under the terms of the BSD license as follows: + + "Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names + of its contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." + + $QT_END_LICENSE$ + + + + + + Serialized QKeyEvent + + + + + + + + + + + + + + + + + + diff --git a/src/3rdparty/wayland/extensions/sub-surface-extension.xml b/src/3rdparty/wayland/extensions/sub-surface-extension.xml new file mode 100644 index 00000000000..41f1816e460 --- /dev/null +++ b/src/3rdparty/wayland/extensions/sub-surface-extension.xml @@ -0,0 +1,69 @@ + + + + Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). + Contact: http://www.qt-project.org/legal + + This file is part of the plugins of the Qt Toolkit. + + $QT_BEGIN_LICENSE:BSD$ + You may use this file under the terms of the BSD license as follows: + + "Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names + of its contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." + + $QT_END_LICENSE$ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/3rdparty/wayland/extensions/surface-extension.xml b/src/3rdparty/wayland/extensions/surface-extension.xml new file mode 100644 index 00000000000..4c55767267b --- /dev/null +++ b/src/3rdparty/wayland/extensions/surface-extension.xml @@ -0,0 +1,89 @@ + + + + Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). + Contact: http://www.qt-project.org/legal + + This file is part of the plugins of the Qt Toolkit. + + $QT_BEGIN_LICENSE:BSD$ + You may use this file under the terms of the BSD license as follows: + + "Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names + of its contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." + + $QT_END_LICENSE$ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/3rdparty/wayland/extensions/touch-extension.xml b/src/3rdparty/wayland/extensions/touch-extension.xml new file mode 100644 index 00000000000..1efb8930deb --- /dev/null +++ b/src/3rdparty/wayland/extensions/touch-extension.xml @@ -0,0 +1,71 @@ + + + + Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). + Contact: http://www.qt-project.org/legal + + This file is part of the plugins of the Qt Toolkit. + + $QT_BEGIN_LICENSE:BSD$ + You may use this file under the terms of the BSD license as follows: + + "Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names + of its contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." + + $QT_END_LICENSE$ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/3rdparty/wayland/extensions/windowmanager.xml b/src/3rdparty/wayland/extensions/windowmanager.xml new file mode 100644 index 00000000000..71fb2723952 --- /dev/null +++ b/src/3rdparty/wayland/extensions/windowmanager.xml @@ -0,0 +1,64 @@ + + + + Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). + Contact: http://www.qt-project.org/legal + + This file is part of the plugins of the Qt Toolkit. + + $QT_BEGIN_LICENSE:BSD$ + You may use this file under the terms of the BSD license as follows: + + "Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names + of its contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." + + $QT_END_LICENSE$ + + + + + + + + + + + + If remaining is not 0 this is a multipart request, and + the server must concatenate subsequent requst urls to and + including a request where remaining is set to 0, before + it can handle the url. + + + + + + + + + + + diff --git a/src/3rdparty/wayland/extensions/xcomposite.xml b/src/3rdparty/wayland/extensions/xcomposite.xml new file mode 100644 index 00000000000..47a91087071 --- /dev/null +++ b/src/3rdparty/wayland/extensions/xcomposite.xml @@ -0,0 +1,61 @@ + + + + + Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). + Contact: http://www.qt-project.org/legal + + This file is part of the plugins of the Qt Toolkit. + + $QT_BEGIN_LICENSE:BSD$ + You may use this file under the terms of the BSD license as follows: + + "Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names + of its contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." + + $QT_END_LICENSE$ + + + + + + + + + + + + + + + + + + + + diff --git a/src/3rdparty/wayland/wayland-drm-client-protocol.h b/src/3rdparty/wayland/wayland-drm-client-protocol.h deleted file mode 100644 index 66ab7bad10b..00000000000 --- a/src/3rdparty/wayland/wayland-drm-client-protocol.h +++ /dev/null @@ -1,135 +0,0 @@ -/* - * Copyright © 2010 Kristian Høgsberg - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting documentation, and - * that the name of the copyright holders not be used in advertising or - * publicity pertaining to distribution of the software without specific, - * written prior permission. The copyright holders make no representations - * about the suitability of this software for any purpose. It is provided "as - * is" without express or implied warranty. - * - * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - - -#ifndef DRM_CLIENT_PROTOCOL_H -#define DRM_CLIENT_PROTOCOL_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include -#include "wayland-util.h" - -struct wl_client; - -struct wl_drm; - -struct wl_proxy; - -extern void -wl_proxy_marshal(struct wl_proxy *p, uint32_t opcode, ...); -extern struct wl_proxy * -wl_proxy_create(struct wl_proxy *factory, - const struct wl_interface *interface); -extern struct wl_proxy * -wl_proxy_create_for_id(struct wl_display *display, - const struct wl_interface *interface, uint32_t id); -extern void -wl_proxy_destroy(struct wl_proxy *proxy); - -extern int -wl_proxy_add_listener(struct wl_proxy *proxy, - void (**implementation)(void), void *data); - -extern void -wl_proxy_set_user_data(struct wl_proxy *proxy, void *user_data); - -extern void * -wl_proxy_get_user_data(struct wl_proxy *proxy); - -extern const struct wl_interface wl_drm_interface; - -struct wl_drm_listener { - void (*device)(void *data, - struct wl_drm *drm, - const char *name); - void (*authenticated)(void *data, - struct wl_drm *drm); -}; - -static inline int -wl_drm_add_listener(struct wl_drm *drm, - const struct wl_drm_listener *listener, void *data) -{ - return wl_proxy_add_listener((struct wl_proxy *) drm, - (void (**)(void)) listener, data); -} - -#define WL_DRM_AUTHENTICATE 0 -#define WL_DRM_CREATE_BUFFER 1 - -static inline struct wl_drm * -wl_drm_create(struct wl_display *display, uint32_t id) -{ - return (struct wl_drm *) - wl_proxy_create_for_id(display, &wl_drm_interface, id); -} - -static inline void -wl_drm_set_user_data(struct wl_drm *drm, void *user_data) -{ - wl_proxy_set_user_data((struct wl_proxy *) drm, user_data); -} - -static inline void * -wl_drm_get_user_data(struct wl_drm *drm) -{ - return wl_proxy_get_user_data((struct wl_proxy *) drm); -} - -static inline void -wl_drm_destroy(struct wl_drm *drm) -{ - wl_proxy_destroy((struct wl_proxy *) drm); -} - -static inline void -wl_drm_authenticate(struct wl_drm *drm, uint32_t id) -{ - wl_proxy_marshal((struct wl_proxy *) drm, - WL_DRM_AUTHENTICATE, id); -} - -static inline struct wl_buffer * -wl_drm_create_buffer(struct wl_drm *drm, uint32_t name, int width, int height, uint32_t stride, struct wl_visual *visual) -{ - struct wl_proxy *id; - - id = wl_proxy_create((struct wl_proxy *) drm, - &wl_buffer_interface); - if (!id) - return NULL; - - wl_proxy_marshal((struct wl_proxy *) drm, - WL_DRM_CREATE_BUFFER, id, name, width, height, stride, visual); - - return (struct wl_buffer *) id; -} - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/src/3rdparty/wayland/wayland-drm-protocol.c b/src/3rdparty/wayland/wayland-drm-protocol.c deleted file mode 100644 index f69318ec35d..00000000000 --- a/src/3rdparty/wayland/wayland-drm-protocol.c +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright © 2010 Kristian Høgsberg - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting documentation, and - * that the name of the copyright holders not be used in advertising or - * publicity pertaining to distribution of the software without specific, - * written prior permission. The copyright holders make no representations - * about the suitability of this software for any purpose. It is provided "as - * is" without express or implied warranty. - * - * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - - -#include -#include -#include "wayland-util.h" - -static const struct wl_message drm_requests[] = { - { "authenticate", "u" }, - { "create_buffer", "nuiiuo" }, -}; - -static const struct wl_message drm_events[] = { - { "device", "s" }, - { "authenticated", "" }, -}; - -WL_EXPORT const struct wl_interface wl_drm_interface = { - "drm", 1, - ARRAY_LENGTH(drm_requests), drm_requests, - ARRAY_LENGTH(drm_events), drm_events, -}; - diff --git a/src/3rdparty/wayland/wayland-drm-server-protocol.h b/src/3rdparty/wayland/wayland-drm-server-protocol.h deleted file mode 100644 index 1b9f11738ed..00000000000 --- a/src/3rdparty/wayland/wayland-drm-server-protocol.h +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright © 2010 Kristian Høgsberg - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting documentation, and - * that the name of the copyright holders not be used in advertising or - * publicity pertaining to distribution of the software without specific, - * written prior permission. The copyright holders make no representations - * about the suitability of this software for any purpose. It is provided "as - * is" without express or implied warranty. - * - * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - - -#ifndef DRM_SERVER_PROTOCOL_H -#define DRM_SERVER_PROTOCOL_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include -#include "wayland-util.h" - -struct wl_client; - -struct wl_drm; - -extern const struct wl_interface wl_drm_interface; - -struct wl_drm_interface { - void (*authenticate)(struct wl_client *client, - struct wl_drm *drm, - uint32_t id); - void (*create_buffer)(struct wl_client *client, - struct wl_drm *drm, - uint32_t id, - uint32_t name, - int width, - int height, - uint32_t stride, - struct wl_visual *visual); -}; - -#define WL_DRM_DEVICE 0 -#define WL_DRM_AUTHENTICATED 1 - -#ifdef __cplusplus -} -#endif - -#endif From 223130c2c163cbce1bf7a3455831b6e5c13902a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Wed, 5 Dec 2012 20:39:34 +0100 Subject: [PATCH 0031/1507] Cleaned out usages of removed or to be removed APIs. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Iabbada23d010ac0fdf99f88af3f109f94814b5ea Reviewed-by: Jørgen Lind --- src/3rdparty/wayland/extensions/surface-extension.xml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/3rdparty/wayland/extensions/surface-extension.xml b/src/3rdparty/wayland/extensions/surface-extension.xml index 4c55767267b..c99f63b6c89 100644 --- a/src/3rdparty/wayland/extensions/surface-extension.xml +++ b/src/3rdparty/wayland/extensions/surface-extension.xml @@ -68,10 +68,6 @@ - - - - From e4726ae8ac65e3b24914116edf62d14b28e034a3 Mon Sep 17 00:00:00 2001 From: Andy Nichols Date: Tue, 5 Feb 2013 12:22:17 +0100 Subject: [PATCH 0032/1507] Qt-ify the QtCompositor module Currently the QtCompositor library and API do not follow the Qt API naming conventions. This commit intends to fix these inconsistencies. filenames start with q headers containing private API's end in _p public API classes begin with Q use the qt namespace macros where necessary Wayland namespace is now QtWayland wayland_wrapper classes are now private API's It's important to make these changes not just for stylistic reasons, but also because when qmake builds the module in checks for these conventions to determine how to deploy the include files. Change-Id: I8bfadeceda92a0f52cb73c704551da75540e7587 Reviewed-by: Paul Olav Tvete --- src/plugins/platforms/wayland/shared/qwaylandmimehelper.cpp | 2 ++ src/plugins/platforms/wayland/shared/qwaylandmimehelper.h | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/src/plugins/platforms/wayland/shared/qwaylandmimehelper.cpp b/src/plugins/platforms/wayland/shared/qwaylandmimehelper.cpp index ccc48ef2c21..d7e51144026 100644 --- a/src/plugins/platforms/wayland/shared/qwaylandmimehelper.cpp +++ b/src/plugins/platforms/wayland/shared/qwaylandmimehelper.cpp @@ -46,6 +46,8 @@ #include #include +QT_USE_NAMESPACE + QByteArray QWaylandMimeHelper::getByteArray(QMimeData *mimeData, const QString &mimeType) { QByteArray content; diff --git a/src/plugins/platforms/wayland/shared/qwaylandmimehelper.h b/src/plugins/platforms/wayland/shared/qwaylandmimehelper.h index f31685cd6f5..539fc3adc80 100644 --- a/src/plugins/platforms/wayland/shared/qwaylandmimehelper.h +++ b/src/plugins/platforms/wayland/shared/qwaylandmimehelper.h @@ -46,10 +46,14 @@ #include #include +QT_BEGIN_NAMESPACE + class QWaylandMimeHelper { public: static QByteArray getByteArray(QMimeData *mimeData, const QString &mimeType); }; +QT_END_NAMESPACE + #endif From 2ba715bbfd161f98a8132f461563a20fb10cc3ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Tue, 9 Apr 2013 16:52:59 +0200 Subject: [PATCH 0033/1507] Introduced qtwaylandscanner. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Generates C++ headers with Qt types based on the Wayland XML protocol files, to reduce a lot of code duplication in all the places that interface between Qt and the wayland protocol headers. Change-Id: I34a4417d3d3d0238de2f2f74986855d097b50ec9 Reviewed-by: Oswald Buddenhagen Reviewed-by: Jørgen Lind --- .../qtwaylandscanner/qtwaylandscanner.cpp | 1033 +++++++++++++++++ .../qtwaylandscanner/qtwaylandscanner.pro | 8 + 2 files changed, 1041 insertions(+) create mode 100644 src/tools/qtwaylandscanner/qtwaylandscanner.cpp create mode 100644 src/tools/qtwaylandscanner/qtwaylandscanner.pro diff --git a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp new file mode 100644 index 00000000000..86fc4937cb4 --- /dev/null +++ b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp @@ -0,0 +1,1033 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the tools applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include +#include + +enum Option { + ClientHeader, + ServerHeader, + ClientCode, + ServerCode +} option; + +bool isServerSide() +{ + return option == ServerHeader || option == ServerCode; +} + +QByteArray protocolName; + +bool parseOption(const char *str, Option *option) +{ + if (str == QLatin1String("client-header")) + *option = ClientHeader; + else if (str == QLatin1String("server-header")) + *option = ServerHeader; + else if (str == QLatin1String("client-code")) + *option = ClientCode; + else if (str == QLatin1String("server-code")) + *option = ServerCode; + else + return false; + + return true; +} + +struct WaylandEnumEntry { + QByteArray name; + int value; + QByteArray summary; +}; + +struct WaylandEnum { + QByteArray name; + + QList entries; +}; + +struct WaylandArgument { + QByteArray name; + QByteArray type; + QByteArray interface; + QByteArray summary; + bool allowNull; +}; + +struct WaylandEvent { + bool request; + QByteArray name; + QList arguments; +}; + +struct WaylandInterface { + QByteArray name; + int version; + + QList enums; + QList events; + QList requests; +}; + +QByteArray byteArrayValue(const QXmlStreamReader &xml, const char *name) +{ + if (xml.attributes().hasAttribute(name)) + return xml.attributes().value(name).toUtf8(); + return QByteArray(); +} + +int intValue(const QXmlStreamReader &xml, const char *name, int defaultValue = 0) +{ + bool ok; + int result = byteArrayValue(xml, name).toInt(&ok); + return ok ? result : defaultValue; +} + +bool boolValue(const QXmlStreamReader &xml, const char *name) +{ + return byteArrayValue(xml, name) == "true"; +} + +WaylandEvent readEvent(QXmlStreamReader &xml, bool request) +{ + WaylandEvent event; + event.request = request; + event.name = byteArrayValue(xml, "name"); + while (xml.readNextStartElement()) { + if (xml.name() == "arg") { + WaylandArgument argument; + argument.name = byteArrayValue(xml, "name"); + argument.type = byteArrayValue(xml, "type"); + argument.interface = byteArrayValue(xml, "interface"); + argument.summary = byteArrayValue(xml, "summary"); + argument.allowNull = boolValue(xml, "allowNull"); + event.arguments << argument; + } + + xml.skipCurrentElement(); + } + return event; +} + +WaylandEnum readEnum(QXmlStreamReader &xml) +{ + WaylandEnum result; + result.name = byteArrayValue(xml, "name"); + + while (xml.readNextStartElement()) { + if (xml.name() == "entry") { + WaylandEnumEntry entry; + entry.name = byteArrayValue(xml, "name"); + entry.value = intValue(xml, "value"); + entry.summary = byteArrayValue(xml, "summary"); + result.entries << entry; + } + + xml.skipCurrentElement(); + } + + return result; +} + +WaylandInterface readInterface(QXmlStreamReader &xml) +{ + WaylandInterface interface; + interface.name = byteArrayValue(xml, "name"); + interface.version = intValue(xml, "name", 1); + + while (xml.readNextStartElement()) { + if (xml.name() == "event") + interface.events << readEvent(xml, false); + else if (xml.name() == "request") + interface.requests << readEvent(xml, true); + else if (xml.name() == "enum") + interface.enums << readEnum(xml); + else + xml.skipCurrentElement(); + } + + return interface; +} + +QByteArray waylandToCType(const QByteArray &waylandType, const QByteArray &interface) +{ + if (waylandType == "string") + return "const char *"; + else if (waylandType == "int") + return "int32_t"; + else if (waylandType == "uint") + return "uint32_t"; + else if (waylandType == "fixed") + return "wl_fixed_t"; + else if (waylandType == "fd") + return "int32_t"; + else if (waylandType == "array") + return "wl_array *"; + else if (waylandType == "object" || waylandType == "new_id") + return isServerSide() ? "struct ::wl_resource *" : interface.isEmpty() ? "struct ::wl_object *" : "struct ::" + interface + " *"; + return waylandType; +} + +QByteArray waylandToQtType(const QByteArray &waylandType, const QByteArray &interface, bool cStyleArray) +{ + if (waylandType == "string") + return "const QString &"; + else if (waylandType == "array") + return cStyleArray ? "wl_array *" : "const QByteArray &"; + else + return waylandToCType(waylandType, interface); +} + +const WaylandArgument *newIdArgument(const QList &arguments) +{ + for (int i = 0; i < arguments.size(); ++i) { + if (arguments.at(i).type == "new_id") + return &arguments.at(i); + } + return 0; +} + +void printEvent(const WaylandEvent &e, const char *interfaceName, bool omitNames = false, bool withResource = false) +{ + printf("%s(", e.name.constData()); + bool needsComma = false; + if (isServerSide()) { + if (e.request) { + printf("Resource *%s", omitNames ? "" : "resource"); + needsComma = true; + } else if (withResource) { + printf("struct ::wl_resource *%s", omitNames ? "" : "resource"); + needsComma = true; + } + } + for (int i = 0; i < e.arguments.size(); ++i) { + const WaylandArgument &a = e.arguments.at(i); + bool isNewId = a.type == "new_id"; + if (isNewId && !isServerSide() && (a.interface.isEmpty() != e.request)) + continue; + if (needsComma) + printf(", "); + needsComma = true; + if (isNewId) { + if (isServerSide()) { + if (e.request) { + printf("uint32_t"); + if (!omitNames) + printf(" %s", a.name.constData()); + continue; + } + } else { + if (e.request) { + printf("const struct ::wl_interface *%s, uint32_t%s", omitNames ? "" : "interface", omitNames ? "" : " version"); + continue; + } + + printf("struct ::%s *%s, ", interfaceName, omitNames ? "" : "object"); + } + } + + QByteArray qtType = waylandToQtType(a.type, a.interface, e.request == isServerSide()); + printf("%s%s%s", qtType.constData(), qtType.endsWith("&") || qtType.endsWith("*") ? "" : " ", omitNames ? "" : a.name.constData()); + } + printf(")"); +} + +void printEventHandlerSignature(const WaylandEvent &e, const char *interfaceName, bool deepIndent = true) +{ + const char *indent = deepIndent ? " " : ""; + printf("handle_%s(\n", e.name.constData()); + if (isServerSide()) { + printf(" %s::wl_client *client,\n", indent); + printf(" %sstruct wl_resource *resource", indent); + } else { + printf(" %svoid *data,\n", indent); + printf(" %sstruct ::%s *object", indent, interfaceName); + } + for (int i = 0; i < e.arguments.size(); ++i) { + printf(",\n"); + const WaylandArgument &a = e.arguments.at(i); + bool isNewId = a.type == "new_id"; + if (isServerSide() && isNewId) { + printf(" %suint32_t %s", indent, a.name.constData()); + } else { + QByteArray cType = waylandToCType(a.type, a.interface); + printf(" %s%s%s%s", indent, cType.constData(), cType.endsWith("*") ? "" : " ", a.name.constData()); + } + } + printf(")"); +} + +void printEnums(const QList &enums) +{ + for (int i = 0; i < enums.size(); ++i) { + printf("\n"); + const WaylandEnum &e = enums.at(i); + printf(" enum %s {\n", e.name.constData()); + for (int i = 0; i < e.entries.size(); ++i) { + const WaylandEnumEntry &entry = e.entries.at(i); + printf(" %s_%s = %d", e.name.constData(), entry.name.constData(), entry.value); + if (i < e.entries.size() - 1) + printf(","); + if (!entry.summary.isNull()) + printf(" // %s", entry.summary.constData()); + printf("\n"); + } + printf(" };\n"); + } +} + +QByteArray stripInterfaceName(const QByteArray &name) +{ + if (name.startsWith("qt_") || name.startsWith("wl_")) + return name.mid(3); + + return name; +} + +bool ignoreInterface(const QByteArray &name) +{ + return name == "wl_display" + || (isServerSide() && name == "wl_registry"); +} + +void process(QXmlStreamReader &xml) +{ + if (!xml.readNextStartElement()) + return; + + if (xml.name() != "protocol") { + xml.raiseError(QStringLiteral("The file is not a wayland protocol file.")); + return; + } + + protocolName = byteArrayValue(xml, "name"); + + if (protocolName.isEmpty()) { + xml.raiseError(QStringLiteral("Missing protocol name.")); + return; + } + + QList interfaces; + + while (xml.readNextStartElement()) { + if (xml.name() == "interface") + interfaces << readInterface(xml); + else + xml.skipCurrentElement(); + } + + if (xml.hasError()) + return; + + if (option == ServerHeader) { + QByteArray inclusionGuard = "QT_WAYLAND_SERVER_" + protocolName.toUpper(); + printf("#ifndef %s\n", inclusionGuard.constData()); + printf("#define %s\n", inclusionGuard.constData()); + printf("\n"); + printf("#include \"wayland-server.h\"\n"); + printf("#include \"wayland-server-protocol.h\"\n"); + printf("#include \"wayland-%s-server-protocol.h\"\n", QByteArray(protocolName).replace('_', '-').constData()); + printf("#include \n"); + printf("#include \n"); + printf("\n"); + printf("QT_BEGIN_NAMESPACE\n"); + printf("\n"); + printf("namespace QtWaylandServer {\n"); + + for (int j = 0; j < interfaces.size(); ++j) { + const WaylandInterface &interface = interfaces.at(j); + + if (ignoreInterface(interface.name)) + continue; + + const char *interfaceName = interface.name.constData(); + + QByteArray stripped = stripInterfaceName(interface.name); + const char *interfaceNameStripped = stripped.constData(); + + printf(" class %s\n {\n", interfaceName); + printf(" public:\n"); + printf(" %s(struct ::wl_client *client, int id);\n", interfaceName); + printf(" %s(struct ::wl_display *display);\n", interfaceName); + printf(" %s();\n", interfaceName); + printf("\n"); + printf(" virtual ~%s();\n", interfaceName); + printf("\n"); + printf(" class Resource\n"); + printf(" {\n"); + printf(" public:\n"); + printf(" Resource() : %s(0), handle(0) {}\n", interfaceNameStripped); + printf(" virtual ~Resource() {}\n"); + printf("\n"); + printf(" %s *%s;\n", interfaceName, interfaceNameStripped); + printf(" struct ::wl_resource *handle;\n"); + printf("\n"); + printf(" struct ::wl_client *client() const { return handle->client; }\n"); + printf("\n"); + printf(" static Resource *fromResource(struct ::wl_resource *resource) { return static_cast(resource->data); }\n"); + printf(" };\n"); + printf("\n"); + printf(" void init(struct ::wl_client *client, int id);\n"); + printf(" void init(struct ::wl_display *display);\n"); + printf("\n"); + printf(" Resource *add(struct ::wl_client *client, int id);\n"); + printf(" Resource *add(struct wl_list *resource_list, struct ::wl_client *client, int id);\n"); + printf("\n"); + printf(" Resource *resource() { return m_resource; }\n"); + printf(" const Resource *resource() const { return m_resource; }\n"); + printf("\n"); + printf(" struct ::wl_list *resourceList() { return &m_resource_list; }\n"); + printf(" const struct ::wl_list *resourceList() const { return &m_resource_list; }\n"); + printf("\n"); + printf(" bool isGlobal() const { return m_global != 0; }\n"); + printf(" bool isResource() const { return m_resource != 0; }\n"); + + printEnums(interface.enums); + + bool hasEvents = !interface.events.isEmpty(); + + if (hasEvents) { + printf("\n"); + foreach (const WaylandEvent &e, interface.events) { + printf(" void send_"); + printEvent(e, interfaceName); + printf(";\n"); + printf(" void send_"); + printEvent(e, interfaceName, false, true); + printf(";\n"); + } + } + + printf("\n"); + printf(" protected:\n"); + printf(" virtual Resource *%s_allocate();\n", interfaceNameStripped); + printf("\n"); + printf(" virtual void %s_bind_resource(Resource *resource);\n", interfaceNameStripped); + printf(" virtual void %s_destroy_resource(Resource *resource);\n", interfaceNameStripped); + + bool hasRequests = !interface.requests.isEmpty(); + + if (hasRequests) { + printf("\n"); + foreach (const WaylandEvent &e, interface.requests) { + printf(" virtual void %s_", interfaceNameStripped); + printEvent(e, interfaceName); + printf(";\n"); + } + } + + printf("\n"); + printf(" private:\n"); + printf(" static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id);\n"); + printf(" static void destroy_func(struct ::wl_resource *client_resource);\n"); + printf("\n"); + printf(" Resource *bind(struct ::wl_client *client, uint32_t id);\n"); + + if (hasRequests) { + printf("\n"); + printf(" static const struct ::%s_interface m_%s_interface;\n", interfaceName, interfaceName); + + printf("\n"); + for (int i = 0; i < interface.requests.size(); ++i) { + const WaylandEvent &e = interface.requests.at(i); + printf(" static void "); + + printEventHandlerSignature(e, interfaceName); + printf(";\n"); + } + } + + printf("\n"); + printf(" Resource *m_resource;\n"); + printf(" struct ::wl_list m_resource_list;\n"); + printf(" struct ::wl_global *m_global;\n"); + printf(" };\n"); + + if (j < interfaces.size() - 1) + printf("\n"); + } + + printf("}\n"); + printf("\n"); + printf("QT_END_NAMESPACE\n"); + printf("\n"); + printf("#endif\n"); + } + + if (option == ServerCode) { + printf("#include \"qwayland-server-%s.h\"\n", QByteArray(protocolName).replace('_', '-').constData()); + printf("\n"); + printf("QT_BEGIN_NAMESPACE\n"); + printf("\n"); + printf("namespace QtWaylandServer {\n"); + + bool needsNewLine = false; + for (int j = 0; j < interfaces.size(); ++j) { + const WaylandInterface &interface = interfaces.at(j); + + if (ignoreInterface(interface.name)) + continue; + + if (needsNewLine) + printf("\n"); + + needsNewLine = true; + + const char *interfaceName = interface.name.constData(); + + QByteArray stripped = stripInterfaceName(interface.name); + const char *interfaceNameStripped = stripped.constData(); + + printf(" %s::%s(struct ::wl_client *client, int id)\n", interfaceName, interfaceName); + printf(" : m_resource(0)\n"); + printf(" , m_global(0)\n"); + printf(" {\n"); + printf(" wl_list_init(&m_resource_list);\n"); + printf(" init(client, id);\n"); + printf(" }\n"); + printf("\n"); + + printf(" %s::%s(struct ::wl_display *display)\n", interfaceName, interfaceName); + printf(" : m_resource(0)\n"); + printf(" , m_global(0)\n"); + printf(" {\n"); + printf(" wl_list_init(&m_resource_list);\n"); + printf(" init(display);\n"); + printf(" }\n"); + printf("\n"); + + printf(" %s::%s()\n", interfaceName, interfaceName); + printf(" : m_resource(0)\n"); + printf(" , m_global(0)\n"); + printf(" {\n"); + printf(" wl_list_init(&m_resource_list);\n"); + printf(" }\n"); + printf("\n"); + + printf(" %s::~%s()\n", interfaceName, interfaceName); + printf(" {\n"); + printf(" }\n"); + printf("\n"); + + printf(" void %s::init(struct ::wl_client *client, int id)\n", interfaceName); + printf(" {\n"); + printf(" m_resource = bind(client, id);\n"); + printf(" }\n"); + printf("\n"); + + printf(" %s::Resource *%s::add(struct ::wl_client *client, int id)\n", interfaceName, interfaceName); + printf(" {\n"); + printf(" return add(&m_resource_list, client, id);\n"); + printf(" }\n"); + printf("\n"); + + printf(" %s::Resource *%s::add(struct wl_list *resource_list, struct ::wl_client *client, int id)\n", interfaceName, interfaceName); + printf(" {\n"); + printf(" Resource *resource = bind(client, id);\n"); + printf(" wl_list_insert(resource_list, &resource->handle->link);\n"); + printf(" return resource;\n"); + printf(" }\n"); + printf("\n"); + + printf(" void %s::init(struct ::wl_display *display)\n", interfaceName); + printf(" {\n"); + printf(" m_global = wl_display_add_global(display, &::%s_interface, this, bind_func);\n", interfaceName); + printf(" }\n"); + printf("\n"); + + printf(" %s::Resource *%s::%s_allocate()\n", interfaceName, interfaceName, interfaceNameStripped); + printf(" {\n"); + printf(" return new Resource;\n"); + printf(" }\n"); + printf("\n"); + + printf(" void %s::%s_bind_resource(Resource *)\n", interfaceName, interfaceNameStripped); + printf(" {\n"); + printf(" }\n"); + printf("\n"); + + printf(" void %s::%s_destroy_resource(Resource *)\n", interfaceName, interfaceNameStripped); + printf(" {\n"); + printf(" }\n"); + printf("\n"); + + printf(" void %s::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id)\n", interfaceName); + printf(" {\n"); + printf(" Q_UNUSED(version);\n"); + printf(" %s *that = static_cast<%s *>(data);\n", interfaceName, interfaceName); + printf(" Resource *resource = that->bind(client, id);\n"); + printf(" resource->handle->destroy = destroy_func;\n"); + printf(" that->%s_bind_resource(resource);\n", interfaceNameStripped); + printf(" }\n"); + printf("\n"); + + printf(" void %s::destroy_func(struct ::wl_resource *client_resource)\n", interfaceName); + printf(" {\n"); + printf(" Resource *resource = Resource::fromResource(client_resource);\n"); + printf(" %s *that = resource->%s;\n", interfaceName, interfaceNameStripped); + printf(" that->%s_destroy_resource(resource);\n", interfaceNameStripped); + printf(" if (client_resource->link.next)\n"); + printf(" wl_list_remove(&client_resource->link);\n"); + printf(" delete resource;\n"); + printf(" free(client_resource);\n"); + printf(" }\n"); + printf("\n"); + + bool hasRequests = !interface.requests.isEmpty(); + + printf(" %s::Resource *%s::bind(struct ::wl_client *client, uint32_t id)\n", interfaceName, interfaceName); + printf(" {\n"); + printf(" Resource *resource = %s_allocate();\n", interfaceNameStripped); + printf(" resource->%s = this;\n", interfaceNameStripped); + if (hasRequests) + printf(" resource->handle = wl_client_add_object(client, &::%s_interface, &m_%s_interface, id, resource);\n", interfaceName, interfaceName); + else + printf(" resource->handle = wl_client_add_object(client, &::%s_interface, 0, id, resource);\n", interfaceName); + printf(" wl_list_init(&resource->handle->link);\n"); + printf(" return resource;\n"); + printf(" }\n"); + + if (hasRequests) { + printf("\n"); + printf(" const struct ::%s_interface %s::m_%s_interface = {", interfaceName, interfaceName, interfaceName); + for (int i = 0; i < interface.requests.size(); ++i) { + if (i > 0) + printf(","); + printf("\n"); + const WaylandEvent &e = interface.requests.at(i); + printf(" %s::handle_%s", interfaceName, e.name.constData()); + } + printf("\n"); + printf(" };\n"); + + foreach (const WaylandEvent &e, interface.requests) { + printf("\n"); + printf(" void %s::%s_", interfaceName, interfaceNameStripped); + printEvent(e, interfaceName, true); + printf("\n"); + printf(" {\n"); + printf(" }\n"); + } + printf("\n"); + + for (int i = 0; i < interface.requests.size(); ++i) { + printf("\n"); + printf(" void %s::", interfaceName); + + const WaylandEvent &e = interface.requests.at(i); + printEventHandlerSignature(e, interfaceName, false); + + printf("\n"); + printf(" {\n"); + printf(" Q_UNUSED(client);\n"); + printf(" Resource *r = Resource::fromResource(resource);\n"); + printf(" static_cast<%s *>(r->%s)->%s_%s(\n", interfaceName, interfaceNameStripped, interfaceNameStripped, e.name.constData()); + printf(" r"); + for (int i = 0; i < e.arguments.size(); ++i) { + printf(",\n"); + const WaylandArgument &a = e.arguments.at(i); + QByteArray cType = waylandToCType(a.type, a.interface); + QByteArray qtType = waylandToQtType(a.type, a.interface, e.request); + const char *argumentName = a.name.constData(); + if (cType == qtType) + printf(" %s", argumentName); + else if (a.type == "string") + printf(" QString::fromUtf8(%s)", argumentName); + } + printf(");\n"); + printf(" }\n"); + } + } + + for (int i = 0; i < interface.events.size(); ++i) { + printf("\n"); + const WaylandEvent &e = interface.events.at(i); + printf(" void %s::send_", interfaceName); + printEvent(e, interfaceName); + printf("\n"); + printf(" {\n"); + printf(" send_%s(\n", e.name.constData()); + printf(" m_resource->handle"); + for (int i = 0; i < e.arguments.size(); ++i) { + const WaylandArgument &a = e.arguments.at(i); + printf(",\n"); + printf(" %s", a.name.constData()); + } + printf(");\n"); + printf(" }\n"); + printf("\n"); + + printf(" void %s::send_", interfaceName); + printEvent(e, interfaceName, false, true); + printf("\n"); + printf(" {\n"); + + for (int i = 0; i < e.arguments.size(); ++i) { + const WaylandArgument &a = e.arguments.at(i); + if (a.type != "array") + continue; + QByteArray array = a.name + "_data"; + const char *arrayName = array.constData(); + const char *variableName = a.name.constData(); + printf(" struct wl_array %s;\n", arrayName); + printf(" %s.size = %s.size();\n", arrayName, variableName); + printf(" %s.data = static_cast(const_cast(%s.constData()));\n", arrayName, variableName); + printf(" %s.alloc = 0;\n", arrayName); + printf("\n"); + } + + printf(" %s_send_%s(\n", interfaceName, e.name.constData()); + printf(" resource"); + + for (int i = 0; i < e.arguments.size(); ++i) { + const WaylandArgument &a = e.arguments.at(i); + printf(",\n"); + QByteArray cType = waylandToCType(a.type, a.interface); + QByteArray qtType = waylandToQtType(a.type, a.interface, e.request); + if (a.type == "string") + printf(" %s.toUtf8().constData()", a.name.constData()); + else if (a.type == "array") + printf(" &%s_data", a.name.constData()); + else if (cType == qtType) + printf(" %s", a.name.constData()); + } + + printf(");\n"); + printf(" }\n"); + printf("\n"); + } + } + printf("}\n"); + printf("\n"); + printf("QT_END_NAMESPACE\n"); + } + + if (option == ClientHeader) { + QByteArray inclusionGuard = "QT_WAYLAND_" + protocolName.toUpper(); + printf("#ifndef %s\n", inclusionGuard.constData()); + printf("#define %s\n", inclusionGuard.constData()); + printf("\n"); + printf("#include \"wayland-%s-client-protocol.h\"\n", QByteArray(protocolName).replace('_', '-').constData()); + printf("#include \n"); + printf("#include \n"); + printf("\n"); + printf("QT_BEGIN_NAMESPACE\n"); + printf("\n"); + printf("namespace QtWayland {\n"); + for (int j = 0; j < interfaces.size(); ++j) { + const WaylandInterface &interface = interfaces.at(j); + + if (ignoreInterface(interface.name)) + continue; + + const char *interfaceName = interface.name.constData(); + + QByteArray stripped = stripInterfaceName(interface.name); + const char *interfaceNameStripped = stripped.constData(); + + printf(" class %s\n {\n", interfaceName); + printf(" public:\n"); + printf(" %s(struct ::wl_registry *registry, int id);\n", interfaceName); + printf(" %s(struct ::%s *object);\n", interfaceName, interfaceName); + printf(" %s();\n", interfaceName); + printf("\n"); + printf(" virtual ~%s();\n", interfaceName); + printf("\n"); + printf(" void init(struct ::wl_registry *registry, int id);\n"); + printf(" void init(struct ::%s *object);\n", interfaceName); + printf("\n"); + printf(" struct ::%s *object() { return m_%s; }\n", interfaceName, interfaceName); + printf(" const struct ::%s *object() const { return m_%s; }\n", interfaceName, interfaceName); + printf("\n"); + printf(" bool isInitialized() const;\n"); + + printEnums(interface.enums); + + if (!interface.requests.isEmpty()) { + printf("\n"); + foreach (const WaylandEvent &e, interface.requests) { + const WaylandArgument *new_id = newIdArgument(e.arguments); + printf(" %s", new_id ? (new_id->interface.isEmpty() ? "void *" : "struct ::" + new_id->interface + " *").constData() : "void "); + printEvent(e, interfaceName); + printf(";\n"); + } + } + + bool hasEvents = !interface.events.isEmpty(); + + if (hasEvents) { + printf("\n"); + printf(" protected:\n"); + foreach (const WaylandEvent &e, interface.events) { + printf(" virtual void %s_", interfaceNameStripped); + printEvent(e, interfaceName); + printf(";\n"); + } + } + + printf("\n"); + printf(" private:\n"); + if (hasEvents) { + printf(" void init_listener();\n"); + printf(" static const struct %s_listener m_%s_listener;\n", interfaceName, interfaceName); + for (int i = 0; i < interface.events.size(); ++i) { + const WaylandEvent &e = interface.events.at(i); + printf(" static void "); + + printEventHandlerSignature(e, interfaceName); + printf(";\n"); + } + } + printf(" struct ::%s *m_%s;\n", interfaceName, interfaceName); + printf(" };\n"); + + if (j < interfaces.size() - 1) + printf("\n"); + } + printf("}\n"); + printf("\n"); + printf("QT_END_NAMESPACE\n"); + printf("\n"); + printf("#endif\n"); + } + + if (option == ClientCode) { + printf("#include \"qwayland-%s.h\"\n", QByteArray(protocolName).replace('_', '-').constData()); + printf("\n"); + printf("QT_BEGIN_NAMESPACE\n"); + printf("\n"); + printf("namespace QtWayland {\n"); + for (int j = 0; j < interfaces.size(); ++j) { + const WaylandInterface &interface = interfaces.at(j); + + if (ignoreInterface(interface.name)) + continue; + + const char *interfaceName = interface.name.constData(); + + QByteArray stripped = stripInterfaceName(interface.name); + const char *interfaceNameStripped = stripped.constData(); + + bool hasEvents = !interface.events.isEmpty(); + + printf(" %s::%s(struct ::wl_registry *registry, int id)\n", interfaceName, interfaceName); + printf(" {\n"); + printf(" init(registry, id);\n"); + printf(" }\n"); + printf("\n"); + + printf(" %s::%s(struct ::%s *obj)\n", interfaceName, interfaceName, interfaceName); + printf(" : m_%s(obj)\n", interfaceName); + printf(" {\n"); + if (hasEvents) + printf(" init_listener();\n"); + printf(" }\n"); + printf("\n"); + + printf(" %s::%s()\n", interfaceName, interfaceName); + printf(" : m_%s(0)\n", interfaceName); + printf(" {\n"); + printf(" }\n"); + printf("\n"); + + printf(" %s::~%s()\n", interfaceName, interfaceName); + printf(" {\n"); + printf(" }\n"); + printf("\n"); + + printf(" void %s::init(struct ::wl_registry *registry, int id)\n", interfaceName); + printf(" {\n"); + printf(" m_%s = static_cast(wl_registry_bind(registry, id, &%s_interface, %d));\n", interfaceName, interfaceName, interfaceName, interface.version); + if (hasEvents) + printf(" init_listener();\n"); + printf(" }\n"); + printf("\n"); + + printf(" void %s::init(struct ::%s *obj)\n", interfaceName, interfaceName); + printf(" {\n"); + printf(" m_%s = obj;\n", interfaceName); + if (hasEvents) + printf(" init_listener();\n"); + printf(" }\n"); + printf("\n"); + + printf(" bool %s::isInitialized() const\n", interfaceName); + printf(" {\n"); + printf(" return m_%s != 0;\n", interfaceName); + printf(" }\n"); + + for (int i = 0; i < interface.requests.size(); ++i) { + printf("\n"); + const WaylandEvent &e = interface.requests.at(i); + const WaylandArgument *new_id = newIdArgument(e.arguments); + printf(" %s%s::", new_id ? (new_id->interface.isEmpty() ? "void *" : "struct ::" + new_id->interface + " *").constData() : "void ", interfaceName); + printEvent(e, interfaceName); + printf("\n"); + printf(" {\n"); + for (int i = 0; i < e.arguments.size(); ++i) { + const WaylandArgument &a = e.arguments.at(i); + if (a.type != "array") + continue; + QByteArray array = a.name + "_data"; + const char *arrayName = array.constData(); + const char *variableName = a.name.constData(); + printf(" struct wl_array %s;\n", arrayName); + printf(" %s.size = %s.size();\n", arrayName, variableName); + printf(" %s.data = static_cast(const_cast(%s.constData()));\n", arrayName, variableName); + printf(" %s.alloc = 0;\n", arrayName); + printf("\n"); + } + int actualArgumentCount = new_id ? e.arguments.size() - 1 : e.arguments.size(); + printf(" %s%s_%s(\n", new_id ? "return " : "", interfaceName, e.name.constData()); + printf(" m_%s%s", interfaceName, actualArgumentCount > 0 ? "," : ""); + bool needsComma = false; + for (int i = 0; i < e.arguments.size(); ++i) { + const WaylandArgument &a = e.arguments.at(i); + bool isNewId = a.type == "new_id"; + if (isNewId && !a.interface.isEmpty()) + continue; + if (needsComma) + printf(","); + needsComma = true; + printf("\n"); + if (isNewId) { + printf(" interface,\n"); + printf(" version"); + } else { + QByteArray cType = waylandToCType(a.type, a.interface); + QByteArray qtType = waylandToQtType(a.type, a.interface, e.request); + if (a.type == "string") + printf(" %s.toUtf8().constData()", a.name.constData()); + else if (a.type == "array") + printf(" &%s_data", a.name.constData()); + else if (cType == qtType) + printf(" %s", a.name.constData()); + } + } + printf(");\n"); + printf(" }\n"); + } + + if (hasEvents) { + printf("\n"); + for (int i = 0; i < interface.events.size(); ++i) { + const WaylandEvent &e = interface.events.at(i); + printf(" void %s::%s_", interfaceName, interfaceNameStripped); + printEvent(e, interfaceName, true); + printf("\n"); + printf(" {\n"); + printf(" }\n"); + printf("\n"); + printf(" void %s::", interfaceName); + printEventHandlerSignature(e, interfaceName, false); + printf("\n"); + printf(" {\n"); + if (!newIdArgument(e.arguments)) + printf(" Q_UNUSED(object);\n"); + printf(" static_cast<%s *>(data)->%s_%s(", interfaceName, interfaceNameStripped, e.name.constData()); + for (int i = 0; i < e.arguments.size(); ++i) { + printf("\n"); + const WaylandArgument &a = e.arguments.at(i); + QByteArray cType = waylandToCType(a.type, a.interface); + QByteArray qtType = waylandToQtType(a.type, a.interface, e.request); + const char *argumentName = a.name.constData(); + if (a.type == "new_id") + printf(" object,\n"); + if (a.type == "string") + printf(" QString::fromUtf8(%s)", argumentName); + else + printf(" %s", argumentName); + + if (i < e.arguments.size() - 1) + printf(","); + } + printf(");\n"); + + printf(" }\n"); + printf("\n"); + } + printf(" const struct %s_listener %s::m_%s_listener = {\n", interfaceName, interfaceName, interfaceName); + for (int i = 0; i < interface.events.size(); ++i) { + const WaylandEvent &e = interface.events.at(i); + printf(" %s::handle_%s%s\n", interfaceName, e.name.constData(), i < interface.events.size() - 1 ? "," : ""); + } + printf(" };\n"); + printf("\n"); + + printf(" void %s::init_listener()\n", interfaceName); + printf(" {\n"); + printf(" %s_add_listener(m_%s, &m_%s_listener, this);\n", interfaceName, interfaceName, interfaceName); + printf(" }\n"); + } + + if (j < interfaces.size() - 1) + printf("\n"); + } + printf("}\n"); + printf("\n"); + printf("QT_END_NAMESPACE\n"); + } +} + +int main(int argc, char **argv) +{ + if (argc <= 2 || !parseOption(argv[1], &option)) { + fprintf(stderr, "Usage: %s [client-header|server-header|client-code|server-code] specfile\n", argv[0]); + return 1; + } + + QCoreApplication app(argc, argv); + + QFile file(argv[2]); + if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { + fprintf(stderr, "Unable to open file %s\n", argv[2]); + return 1; + } + + QXmlStreamReader xml(&file); + process(xml); + + if (xml.hasError()) { + fprintf(stderr, "XML error: %s\nLine %lld, column %lld\n", xml.errorString().toLocal8Bit().constData(), xml.lineNumber(), xml.columnNumber()); + return 1; + } +} diff --git a/src/tools/qtwaylandscanner/qtwaylandscanner.pro b/src/tools/qtwaylandscanner/qtwaylandscanner.pro new file mode 100644 index 00000000000..34d25b92297 --- /dev/null +++ b/src/tools/qtwaylandscanner/qtwaylandscanner.pro @@ -0,0 +1,8 @@ +option(host_build) + +HEADERS += qtwaylandscanner.h + +SOURCES += qtwaylandscanner.cpp + +load(qt_tool) + From f16ae84d4cd185383f79ce4c93bf4a8e6f299b6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Tue, 9 Apr 2013 16:52:59 +0200 Subject: [PATCH 0034/1507] Adapted code to use qtwaylandscanner. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We include the wayland.xml since we need to generate bindings for the core protocol as well. Also, WAYLANDSOURCES has been split into WAYLANDSERVERSOURCES and WAYLANDCLIENTSOURCES since we need to produce different output in the server and client cases. Change-Id: I0bd493d41ca6b26dfd2d9b1463d4b762786537f9 Reviewed-by: Jørgen Lind --- .../wayland/extensions/qtkey-extension.xml | 2 +- .../wayland/extensions/windowmanager.xml | 2 +- src/3rdparty/wayland/protocols/README | 1 + src/3rdparty/wayland/protocols/wayland.xml | 1332 +++++++++++++++++ .../qtwaylandscanner/qtwaylandscanner.cpp | 7 +- 5 files changed, 1338 insertions(+), 6 deletions(-) create mode 100644 src/3rdparty/wayland/protocols/README create mode 100644 src/3rdparty/wayland/protocols/wayland.xml diff --git a/src/3rdparty/wayland/extensions/qtkey-extension.xml b/src/3rdparty/wayland/extensions/qtkey-extension.xml index fc4d14dac8c..e90c331902a 100644 --- a/src/3rdparty/wayland/extensions/qtkey-extension.xml +++ b/src/3rdparty/wayland/extensions/qtkey-extension.xml @@ -1,4 +1,4 @@ - + Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). diff --git a/src/3rdparty/wayland/extensions/windowmanager.xml b/src/3rdparty/wayland/extensions/windowmanager.xml index 71fb2723952..4d789e51a46 100644 --- a/src/3rdparty/wayland/extensions/windowmanager.xml +++ b/src/3rdparty/wayland/extensions/windowmanager.xml @@ -1,4 +1,4 @@ - + Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). diff --git a/src/3rdparty/wayland/protocols/README b/src/3rdparty/wayland/protocols/README new file mode 100644 index 00000000000..d37bad09f63 --- /dev/null +++ b/src/3rdparty/wayland/protocols/README @@ -0,0 +1 @@ +wayland.xml from wayland version defined in qtwayland/README diff --git a/src/3rdparty/wayland/protocols/wayland.xml b/src/3rdparty/wayland/protocols/wayland.xml new file mode 100644 index 00000000000..cc8fb063fb6 --- /dev/null +++ b/src/3rdparty/wayland/protocols/wayland.xml @@ -0,0 +1,1332 @@ + + + + + Copyright © 2008-2011 Kristian Høgsberg + Copyright © 2010-2011 Intel Corporation + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that copyright notice and this permission + notice appear in supporting documentation, and that the name of + the copyright holders not be used in advertising or publicity + pertaining to distribution of the software without specific, + written prior permission. The copyright holders make no + representations about the suitability of this software for any + purpose. It is provided "as is" without express or implied + warranty. + + THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS + SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND + FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY + SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN + AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF + THIS SOFTWARE. + + + + + The core global object. This is a special singleton object. It + is used for internal Wayland protocol features. + + + + + The sync request asks the server to emit the 'done' event + on the provided wl_callback object. Since requests are + handled in-order, this can be used as a barrier to ensure all + previous requests have been handled. + + + + + + + This request creates a registry object that allows the client + to list and bind the global objects available from the + compositor. + + + + + + + The error event is sent out when a fatal (non-recoverable) + error has occurred. The @object_id argument is the object + where the error occurred, most often in response to a request + to that object. The @code identifies the error and is defined + by the object interface. As such, each interface defines its + own set of error codes. The @message is an brief description + of the error, for (debugging) convenience. + + + + + + + + + These errors are global and can be emitted in response to any + server request. + + + + + + + + + This event is used internally by the object ID management + logic. When a client deletes an object, the server will send + this event to acknowledge that it has seen the delete request. + When the client receive this event, it will know that it can + safely reuse the object ID + + + + + + + + The global registry object. The server has a number of global + objects that are available to all clients. These objects + typically represent an actual object in the server (for example, + an input device) or they are singleton objects that provides + extension functionality. + + When a client creates a registry object, the registry object + will emit a global event for each global currently in the + registry. Globals come and go as a result of device hotplugs, + reconfiguration or other events, and the registry will send out + @global and @global_remove events to keep the client up to date + with the changes. To mark the end of the initial burst of + events, the client can use the wl_display.sync request + immediately after calling wl_display.get_registry. + + A client can 'bind' to a global object by using the bind + request. This creates a client side handle that lets the object + emit events to the client and lets the client invoke requests on + the object. + + + + + Binds a new, client-created object to the server using @name as + the identifier. + + + + + + + + Notify the client of global objects. + + + + + + + + + Notify the client of removed global objects. This event + notifies the client that the global identifies by @name is no + longer available. If the client bound to the global using the + 'bind' request, the client should now destroy that object. + The object remains valid and requests to the object will be + ignored until the client destroys it, to avoid races between + the global going away and a client sending a request to it. + + + + + + + + + + + + + + A compositor. This object is a singleton global. The + compositor is in charge of combining the contents of multiple + surfaces into one displayable output. + + + + + Ask the compositor to create a new surface. + + + + + + + Ask the compositor to create a new region. + + + + + + + + The wl_shm_pool object encapsulates a piece of memory shared + between the compositor and client. Through the wl_shm_pool + object, the client can allocate shared memory wl_buffer objects. + The objects will share the same underlying mapped memory. + Reusing the mapped memory avoids the setup/teardown overhead and + is useful when interactively resizing a surface or for many + small buffers. + + + + + Create a wl_buffer from the pool. The buffer is created a + offset bytes into the pool and has width and height as + specified. The stride arguments specifies the number of bytes + from beginning of one row to the beginning of the next. The + format is the pixel format of the buffer and must be one of + those advertised through the wl_shm.format event. + + A buffer will keep a reference to the pool it was created from + so it is valid to destroy the pool immediately after creating + a buffer from it. + + + + + + + + + + + + + Destroy the pool. + + + + + + This request will cause the server to remap the backing memory + for the pool from the fd passed when the pool was creating but + using the new size. + + + + + + + + + Support for shared memory buffers. + + + + + + + + + + + + + + + + This creates wl_shm_pool object, which can be used to create + shared memory based wl_buffer objects. The server will mmap + size bytes of the passed fd, to use as backing memory for then + pool. + + + + + + + + + + + + + + + A buffer provides the content for a wl_surface. Buffers are + created through factory interfaces such as wl_drm, wl_shm or + similar. It has a width and a height and can be attached to a + wl_surface, but the mechanism by which a client provides and + updates the contents is defined by the buffer factory interface. + + + + + Destroy a buffer. If and how you need to release the backing + storage is defined by the buffer factory interface. + + For possible side-effects to a surface, see wl_surface.attach. + + + + + + Sent when this wl_buffer is no longer used by the compositor. + The client is now free to re-use or destroy this buffer and its + backing storage. + + If a client receives a release event before the frame callback + requested in the same wl_surface.commit that attaches this + wl_buffer to a surface, then the client is immediately free to + re-use the buffer and its backing storage, and does not need a + second buffer for the next surface content update. Typically + this is possible, when the compositor maintains a copy of the + wl_surface contents, e.g. as a GL texture. This is an important + optimization for GL(ES) compositors with wl_shm clients. + + + + + + + + A wl_data_offer represents a piece of data offered for transfer + by another client (the source client). It is used by the + copy-and-paste and drag-and-drop mechanisms. The offer + describes the different mime types that the data can be + converted to and provides the mechanism for transferring the + data directly from the source client. + + + + + Indicate that the client can accept the given mime-type, or + NULL for not accepted. Use for feedback during drag and drop. + + + + + + + + + To transfer the offered data, the client issues this request + and indicates the mime-type it wants to receive. The transfer + happens through the passed fd (typically a pipe(7) file + descriptor). The source client writes the data in the + mime-type representation requested and then closes the fd. + The receiving client reads from the read end of the pipe until + EOF and the closes its end, at which point the transfer is + complete. + + + + + + + + + + Sent immediately after creating the wl_data_offer object. One + event per offered mime type. + + + + + + + + + The wl_data_source object is the source side of a wl_data_offer. + It is created by the source client in a data transfer and + provides a way to describe the offered data and a way to respond + to requests to transfer the data. + + + + + This request adds a mime-type to the set of mime-types + advertised to targets. Can be called several times to offer + multiple types. + + + + + + + Destroy the data source. + + + + + + Sent when a target accepts pointer_focus or motion events. If + a target does not accept any of the offered types, type is NULL. + + + + + + + + Request for data from another client. Send the data as the + specified mime-type over the passed fd, then close the fd. + + + + + + + + + This data source has been replaced by another data source. + The client should clean up and destroy this data source. + + + + + + + + + This request asks the compositor to start a drag and drop + operation on behalf of the client. + + The source argument is the data source that provides the data + for the eventual data transfer. If source is NULL, enter, leave + and motion events are sent only to the client that initiated the + drag and the client is expected to handle the data passing + internally. + + The origin surface is the surface where the drag originates and + the client must have an active implicit grab that matches the + serial. + + The icon surface is an optional (can be nil) surface that + provides an icon to be moved around with the cursor. Initially, + the top-left corner of the icon surface is placed at the cursor + hotspot, but subsequent wl_surface.attach request can move the + relative position. Attach requests must be confirmed with + wl_surface.commit as usual. + + The current and pending input regions of the icon wl_surface are + cleared, and wl_surface.set_input_region is ignored until the + wl_surface is no longer used as the icon surface. When the use + as an icon ends, the the current and pending input regions + become undefined, and the wl_surface is unmapped. + + + + + + + + + + + + + + + The data_offer event introduces a new wl_data_offer object, + which will subsequently be used in either the + data_device.enter event (for drag and drop) or the + data_device.selection event (for selections). Immediately + following the data_device_data_offer event, the new data_offer + object will send out data_offer.offer events to describe the + mime-types it offers. + + + + + + + + This event is sent when an active drag-and-drop pointer enters + a surface owned by the client. The position of the pointer at + enter time is provided by the @x an @y arguments, in surface + local coordinates. + + + + + + + + + + + + This event is sent when the drag-and-drop pointer leaves the + surface and the session ends. The client must destroy the + wl_data_offer introduced at enter time at this point. + + + + + + This event is sent when the drag-and-drop pointer moves within + the currently focused surface. The new position of the pointer + is provided by the @x an @y arguments, in surface local + coordinates. + + + + + + + + + + + The selection event is sent out to notify the client of a new + wl_data_offer for the selection for this device. The + data_device.data_offer and the data_offer.offer events are + sent out immediately before this event to introduce the data + offer object. The selection event is sent to a client + immediately before receiving keyboard focus and when a new + selection is set while the client has keyboard focus. The + data_offer is valid until a new data_offer or NULL is received + or until the client loses keyboard focus. + + + + + + + + The wl_data_device_manager is a a singleton global object that + provides access to inter-client data transfer mechanisms such as + copy and paste and drag and drop. These mechanisms are tied to + a wl_seat and this interface lets a client get a wl_data_device + corresponding to a wl_seat. + + + + + + + + + + + + + + + + + + + + + + + An interface implemented by a wl_surface. On server side the + object is automatically destroyed when the related wl_surface is + destroyed. On client side, wl_shell_surface_destroy() must be + called before destroying the wl_surface object. + + + + + A client must respond to a ping event with a pong request or + the client may be deemed unresponsive. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Make the surface a toplevel window. + + + + + + + + + + Map the surface relative to an existing surface. The x and y + arguments specify the locations of the upper left corner of + the surface relative to the upper left corner of the parent + surface. The flags argument controls overflow/clipping + behaviour when the surface would intersect a screen edge, + panel or such. And possibly whether the offset only + determines the initial position or if the surface is locked to + that relative position during moves. + + + + + + + + + + + Map the surface as a fullscreen surface. If an output parameter is + given then the surface will be made fullscreen on that output. If the + client does not specify the output then the compositor will apply its + policy - usually choosing the output on which the surface has the + biggest surface area. + + The client may specify a method to resolve a size conflict between the + output size and the surface size - this is provided through the + fullscreen_method parameter. + + The framerate parameter is used only when the fullscreen_method is set + to "driver", to indicate the preferred framerate. framerate=0 indicates + that the app does not care about framerate. The framerate is + specified in mHz, that is framerate of 60000 is 60Hz. + + The compositor must reply to this request with a configure event with + the dimensions for the output on which the surface will be made fullscreen. + + + + + + + + + Hints to indicate compositor how to deal with a conflict between the + dimensions for the surface and the dimensions of the output. As a hint + the compositor is free to ignore this parameter. + + "default" The client has no preference on fullscreen behavior, + policies are determined by compositor. + + "scale" The client prefers scaling by the compositor. Scaling would + always preserve surface's aspect ratio with surface centered on the + output + + "driver" The client wants to switch video mode to the smallest mode + that can fit the client buffer. If the sizes do not match the + compositor must add black borders. + + "fill" The surface is centered on the output on the screen with no + scaling. If the surface is of insufficient size the compositor must + add black borders. + + + + + + + + + + Popup surfaces. Will switch an implicit grab into + owner-events mode, and grab will continue after the implicit + grab ends (button released). Once the implicit grab is over, + the popup grab continues until the window is destroyed or a + mouse button is pressed in any other clients window. A click + in any of the clients surfaces is reported as normal, however, + clicks in other clients surfaces will be discarded and trigger + the callback. + + TODO: Grab keyboard too, maybe just terminate on any click + inside or outside the surface? + + + + + + + + + + + + + A request from the client to notify the compositor the maximized + operation. The compositor will reply with a configure event telling + the expected new surface size. The operation is completed on the + next buffer attach to this surface. + A maximized client will fill the fullscreen of the output it is bound + to, except the panel area. This is the main difference between + a maximized shell surface and a fullscreen shell surface. + + + + + + + + + + + + + The surface class identifies the general class of applications + to which the surface belongs. The class is the file name of + the applications .desktop file (absolute path if non-standard + location). + + + + + + + Ping a client to check if it is receiving events and sending + requests. A client is expected to reply with a pong request. + + + + + + + The configure event asks the client to resize its surface. + The size is a hint, in the sense that the client is free to + ignore it if it doesn't resize, pick a smaller size (to + satisfy aspect ratio or resize in steps of NxM pixels). The + client is free to dismiss all but the last configure event it + received. + + + + + + + + + + The popup_done event is sent out when a popup grab is broken, + that is, when the users clicks a surface that doesn't belong + to the client owning the popup surface. + + + + + + + A surface. This is an image that is displayed on the screen. + It has a location, size and pixel contents. + + + + + Deletes the surface and invalidates its object id. + + + + + + Set the contents of a buffer into this surface. The x and y + arguments specify the location of the new pending buffer's upper + left corner, relative to the current buffer's upper left corner. In + other words, the x and y, and the width and height of the wl_buffer + together define in which directions the surface's size changes. + + Surface contents are double-buffered state, see wl_surface.commit. + + The initial surface contents are void; there is no content. + wl_surface.attach assigns the given wl_buffer as the pending wl_buffer. + wl_surface.commit applies the pending wl_buffer as the new + surface contents, and the size of the surface becomes the size of + the wl_buffer. The wl_buffer is also kept as pending, until + changed by wl_surface.attach or the wl_buffer is destroyed. + + Committing a pending wl_buffer allows the compositor to read the + pixels in the wl_buffer. The compositor may access the pixels at any + time after the wl_surface.commit request. When the compositor will + not access the pixels anymore, it will send the wl_buffer.release + event. Only after receiving wl_buffer.release, the client may re-use + the wl_buffer. A wl_buffer, that has been attached and then replaced + by another attach instead of committed, will not receive a release + event, and is not used by the compositor. + + Destroying the wl_buffer after wl_buffer.release does not change the + surface contents, even if the wl_buffer is still pending for the + next commit. In such case, the next commit does not change the + surface contents. However, if the client destroys the wl_buffer + before receiving wl_buffer.release, the surface contents become + undefined immediately. + + Only if wl_surface.attach is sent with a nil wl_buffer, the + following wl_surface.commit will remove the surface content. + + + + + + + + + + This request is used to describe the regions where the pending + buffer (or if pending buffer is none, the current buffer as updated + in-place) on the next wl_surface.commit will be different from the + current buffer, and needs to be repainted. The pending buffer can be + set by wl_surface.attach. The compositor ignores the parts of the + damage that fall outside of the surface. + + Damage is double-buffered state, see wl_surface.commit. + + The initial value for pending damage is empty: no damage. + wl_surface.damage adds pending damage: the new pending damage is the + union of old pending damage and the given rectangle. + wl_surface.commit assigns pending damage as the current damage, and + clears pending damage. The server will clear the current damage as + it repaints the surface. + + + + + + + + + + + Request notification when the next frame is displayed. Useful + for throttling redrawing operations, and driving animations. + The frame request will take effect on the next wl_surface.commit. + The notification will only be posted for one frame unless + requested again. + + A server should avoid signalling the frame callbacks if the + surface is not visible in any way, e.g. the surface is off-screen, + or completely obscured by other opaque surfaces. + + A client can request a frame callback even without an attach, + damage, or any other state changes. wl_surface.commit triggers a + display update, so the callback event will arrive after the next + output refresh where the surface is visible. + + + + + + + + This request sets the region of the surface that contains + opaque content. The opaque region is an optimization hint for + the compositor that lets it optimize out redrawing of content + behind opaque regions. Setting an opaque region is not + required for correct behaviour, but marking transparent + content as opaque will result in repaint artifacts. + The compositor ignores the parts of the opaque region that fall + outside of the surface. + + Opaque region is double-buffered state, see wl_surface.commit. + + wl_surface.set_opaque_region changes the pending opaque region. + wl_surface.commit copies the pending region to the current region. + Otherwise the pending and current regions are never changed. + + The initial value for opaque region is empty. Setting the pending + opaque region has copy semantics, and the wl_region object can be + destroyed immediately. A nil wl_region causes the pending opaque + region to be set to empty. + + + + + + + + This request sets the region of the surface that can receive + pointer and touch events. Input events happening outside of + this region will try the next surface in the server surface + stack. The compositor ignores the parts of the input region that + fall outside of the surface. + + Input region is double-buffered state, see wl_surface.commit. + + wl_surface.set_input_region changes the pending input region. + wl_surface.commit copies the pending region to the current region. + Otherwise the pending and current regions are never changed, + except cursor and icon surfaces are special cases, see + wl_pointer.set_cursor and wl_data_device.start_drag. + + The initial value for input region is infinite. That means the whole + surface will accept input. Setting the pending input region has copy + semantics, and the wl_region object can be destroyed immediately. A + nil wl_region causes the input region to be set to infinite. + + + + + + + + Surface state (input, opaque, and damage regions, attached buffers, + etc.) is double-buffered. Protocol requests modify the pending + state, as opposed to current state in use by the compositor. Commit + request atomically applies all pending state, replacing the current + state. After commit, the new pending state is as documented for each + related request. + + On commit, a pending wl_buffer is applied first, all other state + second. This means that all coordinates in double-buffered state are + relative to the new wl_buffer coming into use, except for + wl_surface.attach itself. If the pending wl_buffer is none, the + coordinates are relative to the current surface contents. + + All requests that need a commit to become effective are documented + to affect double-buffered state. + + Other interfaces may add further double-buffered surface state. + + + + + + This is emitted whenever a surface's creation, movement, or resizing + results in some part of it being within the scanout region of an + output. + + + + + + + This is emitted whenever a surface's creation, movement, or resizing + results in it no longer having any part of it within the scanout region + of an output. + + + + + + + + A group of keyboards, pointer (mice, for example) and touch + devices . This object is published as a global during start up, + or when such a device is hot plugged. A seat typically has a + pointer and maintains a keyboard_focus and a pointer_focus. + + + + + This is a bitmask of capabilities this seat has; if a member is + set, then it is present on the seat. + + + + + + + + + + This is emitted whenever a seat gains or loses the pointer, + keyboard or touch capabilities. The argument is a wl_seat_caps_mask + enum containing the complete set of capabilities this seat has. + + + + + + + The ID provided will be initialized to the wl_pointer interface + for this seat. + + + + + + + The ID provided will be initialized to the wl_keyboard interface + for this seat. + + + + + + + The ID provided will be initialized to the wl_touch interface + for this seat. + + + + + + + + + Set the pointer surface, i.e., the surface that contains the + pointer image (cursor). This request only takes effect if the pointer + focus for this device is one of the requesting client's surfaces + or the surface parameter is the current pointer surface. If + there was a previous surface set with this request it is + replaced. If surface is NULL, the pointer image is hidden. + + The parameters hotspot_x and hotspot_y define the position of + the pointer surface relative to the pointer location. Its + top-left corner is always at (x, y) - (hotspot_x, hotspot_y), + where (x, y) are the coordinates of the pointer location. + + On surface.attach requests to the pointer surface, hotspot_x + and hotspot_y are decremented by the x and y parameters + passed to the request. Attach must be confirmed by + wl_surface.commit as usual. + + The hotspot can also be updated by passing the currently set + pointer surface to this request with new values for hotspot_x + and hotspot_y. + + The current and pending input regions of the wl_surface are + cleared, and wl_surface.set_input_region is ignored until the + wl_surface is no longer used as the cursor. When the use as a + cursor ends, the current and pending input regions become + undefined, and the wl_surface is unmapped. + + + + + + + + + + + Notification that this seat's pointer is focused on a certain + surface. When an seat's focus enters a surface, the pointer image + is undefined and a client should respond to this event by setting + an appropriate pointer image. + + + + + + + + + + + + + + + + + + Notification of pointer location change. The arguments surface_[xy] + are the location relative to the focused surface. + + + + + + + + + + Describes the physical state of a button which provoked the button + event. + + + + + + + + Mouse button click and release notifications. The location + of the click is given by the last motion or pointer_focus event. + + + + + + + + + + + + + + + + + Scroll and other axis notifications. + + For scroll events (vertical and horizontal scroll axes), the + value parameter is the length of a vector along the specified + axis in a coordinate space identical to those of motion events, + representing a relative movement along the specified axis. + + For devices that support movements non-parallel to axes multiple + axis events will be emitted. + + When applicable, for example for touch pads, the server can + choose to emit scroll events where the motion vector is + equivalent to a motion event vector. + + When applicable, clients can transform its view relative to the + scroll distance. + + + + + + + + + + + + + + + This enum specifies the format of the keymap provided to the client + with the wl_keyboard::keymap event. + + + + + + + This event provides a file descriptor to the client which can be + memory-mapped to provide a keyboard mapping description. + + + + + + + + + + + + + + + + + + + + Describes the physical state of a key which provoked the key event. + + + + + + + + A key was pressed or released. + + + + + + + + + + + Notifies clients that the modifier and/or group state has + changed, and it should update its local state. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Indicates the end of a contact point list. + + + + + + Sent if the compositor decides the touch stream is a global + gesture. No further events are sent to the clients from that + particular gesture. + + + + + + + + An output describes part of the compositor geometry. The + compositor work in the 'compositor coordinate system' and an + output corresponds to rectangular area in that space that is + actually visible. This typically corresponds to a monitor that + displays part of the compositor space. This object is published + as global during start up, or when a screen is hot plugged. + + + + + + + + + + + + + + This describes the transform that a compositor will apply to a + surface to compensate for the rotation or mirroring of an + output device. + + The flipped values correspond to an initial flip around a + vertical axis followed by rotation. + + The purpose is mainly to allow clients render accordingly and + tell the compositor, so that for fullscreen surfaces, the + compositor will still be able to scan out directly from client + surfaces. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The mode event describes an available mode for the output. + The event is sent when binding to the output object and there + will always be one mode, the current mode. The event is sent + again if an output changes mode, for the mode that is now + current. In other words, the current mode is always the last + mode that was received with the current flag set. + + + + + + + + + + + Region. + + + + + Destroy the region. This will invalidate the object id. + + + + + + Add the specified rectangle to the region + + + + + + + + + + + Subtract the specified rectangle from the region + + + + + + + + + + + diff --git a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp index 86fc4937cb4..fe91b796b11 100644 --- a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp +++ b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp @@ -593,10 +593,7 @@ void process(QXmlStreamReader &xml) printf(" void %s::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id)\n", interfaceName); printf(" {\n"); printf(" Q_UNUSED(version);\n"); - printf(" %s *that = static_cast<%s *>(data);\n", interfaceName, interfaceName); - printf(" Resource *resource = that->bind(client, id);\n"); - printf(" resource->handle->destroy = destroy_func;\n"); - printf(" that->%s_bind_resource(resource);\n", interfaceNameStripped); + printf(" static_cast<%s *>(data)->bind(client, id);\n", interfaceName); printf(" }\n"); printf("\n"); @@ -622,6 +619,8 @@ void process(QXmlStreamReader &xml) printf(" resource->handle = wl_client_add_object(client, &::%s_interface, &m_%s_interface, id, resource);\n", interfaceName, interfaceName); else printf(" resource->handle = wl_client_add_object(client, &::%s_interface, 0, id, resource);\n", interfaceName); + printf(" resource->handle->destroy = destroy_func;\n"); + printf(" %s_bind_resource(resource);\n", interfaceNameStripped); printf(" wl_list_init(&resource->handle->link);\n"); printf(" return resource;\n"); printf(" }\n"); From fdaf8642fc3cc9cf6aa1a8f7956384d1226ba6b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Thu, 18 Apr 2013 16:37:19 +0200 Subject: [PATCH 0035/1507] Adapted Surface and Region to use the qtwaylandscanner. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This requires some slight additions to the qtwaylandscanner to handle the pattern of the wl_resource not being owned by the generated class. Change-Id: Ia49c8129cee3a203ca9a727e83fafd3dfc653e75 Reviewed-by: Jørgen Lind --- .../qtwaylandscanner/qtwaylandscanner.cpp | 55 +++++++++++++++---- .../qtwaylandscanner/qtwaylandscanner.pro | 2 - 2 files changed, 44 insertions(+), 13 deletions(-) diff --git a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp index fe91b796b11..6f1516f4bfa 100644 --- a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp +++ b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp @@ -386,6 +386,7 @@ void process(QXmlStreamReader &xml) printf(" class %s\n {\n", interfaceName); printf(" public:\n"); + printf(" %s(struct ::wl_client *client, struct ::wl_resource *resource, int id);\n", interfaceName); printf(" %s(struct ::wl_client *client, int id);\n", interfaceName); printf(" %s(struct ::wl_display *display);\n", interfaceName); printf(" %s();\n", interfaceName); @@ -406,6 +407,7 @@ void process(QXmlStreamReader &xml) printf(" static Resource *fromResource(struct ::wl_resource *resource) { return static_cast(resource->data); }\n"); printf(" };\n"); printf("\n"); + printf(" void init(struct ::wl_client *client, struct ::wl_resource *resource, int id);\n"); printf(" void init(struct ::wl_client *client, int id);\n"); printf(" void init(struct ::wl_display *display);\n"); printf("\n"); @@ -460,7 +462,7 @@ void process(QXmlStreamReader &xml) printf(" static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id);\n"); printf(" static void destroy_func(struct ::wl_resource *client_resource);\n"); printf("\n"); - printf(" Resource *bind(struct ::wl_client *client, uint32_t id);\n"); + printf(" Resource *bind(struct ::wl_client *client, struct ::wl_resource *resource, uint32_t id);\n"); if (hasRequests) { printf("\n"); @@ -478,6 +480,7 @@ void process(QXmlStreamReader &xml) printf("\n"); printf(" Resource *m_resource;\n"); + printf(" bool m_ownResource;\n"); printf(" struct ::wl_list m_resource_list;\n"); printf(" struct ::wl_global *m_global;\n"); printf(" };\n"); @@ -517,8 +520,19 @@ void process(QXmlStreamReader &xml) QByteArray stripped = stripInterfaceName(interface.name); const char *interfaceNameStripped = stripped.constData(); + printf(" %s::%s(struct ::wl_client *client, struct ::wl_resource *resource, int id)\n", interfaceName, interfaceName); + printf(" : m_resource(0)\n"); + printf(" , m_ownResource(false)\n"); + printf(" , m_global(0)\n"); + printf(" {\n"); + printf(" wl_list_init(&m_resource_list);\n"); + printf(" init(client, resource, id);\n"); + printf(" }\n"); + printf("\n"); + printf(" %s::%s(struct ::wl_client *client, int id)\n", interfaceName, interfaceName); printf(" : m_resource(0)\n"); + printf(" , m_ownResource(true)\n"); printf(" , m_global(0)\n"); printf(" {\n"); printf(" wl_list_init(&m_resource_list);\n"); @@ -528,6 +542,7 @@ void process(QXmlStreamReader &xml) printf(" %s::%s(struct ::wl_display *display)\n", interfaceName, interfaceName); printf(" : m_resource(0)\n"); + printf(" , m_ownResource(true)\n"); printf(" , m_global(0)\n"); printf(" {\n"); printf(" wl_list_init(&m_resource_list);\n"); @@ -548,9 +563,15 @@ void process(QXmlStreamReader &xml) printf(" }\n"); printf("\n"); + printf(" void %s::init(struct ::wl_client *client, struct ::wl_resource *resource, int id)\n", interfaceName); + printf(" {\n"); + printf(" m_resource = bind(client, resource, id);\n"); + printf(" }\n"); + printf("\n"); + printf(" void %s::init(struct ::wl_client *client, int id)\n", interfaceName); printf(" {\n"); - printf(" m_resource = bind(client, id);\n"); + printf(" m_resource = bind(client, 0, id);\n"); printf(" }\n"); printf("\n"); @@ -562,7 +583,7 @@ void process(QXmlStreamReader &xml) printf(" %s::Resource *%s::add(struct wl_list *resource_list, struct ::wl_client *client, int id)\n", interfaceName, interfaceName); printf(" {\n"); - printf(" Resource *resource = bind(client, id);\n"); + printf(" Resource *resource = bind(client, 0, id);\n"); printf(" wl_list_insert(resource_list, &resource->handle->link);\n"); printf(" return resource;\n"); printf(" }\n"); @@ -593,7 +614,7 @@ void process(QXmlStreamReader &xml) printf(" void %s::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id)\n", interfaceName); printf(" {\n"); printf(" Q_UNUSED(version);\n"); - printf(" static_cast<%s *>(data)->bind(client, id);\n", interfaceName); + printf(" static_cast<%s *>(data)->bind(client, 0, id);\n", interfaceName); printf(" }\n"); printf("\n"); @@ -601,25 +622,37 @@ void process(QXmlStreamReader &xml) printf(" {\n"); printf(" Resource *resource = Resource::fromResource(client_resource);\n"); printf(" %s *that = resource->%s;\n", interfaceName, interfaceNameStripped); + printf(" bool ownResource = that->m_ownResource;\n"); printf(" that->%s_destroy_resource(resource);\n", interfaceNameStripped); printf(" if (client_resource->link.next)\n"); printf(" wl_list_remove(&client_resource->link);\n"); printf(" delete resource;\n"); - printf(" free(client_resource);\n"); + printf(" if (ownResource)\n"); + printf(" free(client_resource);\n"); printf(" }\n"); printf("\n"); bool hasRequests = !interface.requests.isEmpty(); - printf(" %s::Resource *%s::bind(struct ::wl_client *client, uint32_t id)\n", interfaceName, interfaceName); + QByteArray interfaceMember = hasRequests ? "&m_" + interface.name + "_interface" : QByteArray("0"); + + printf(" %s::Resource *%s::bind(struct ::wl_client *client, struct ::wl_resource *handle, uint32_t id)\n", interfaceName, interfaceName); printf(" {\n"); printf(" Resource *resource = %s_allocate();\n", interfaceNameStripped); printf(" resource->%s = this;\n", interfaceNameStripped); - if (hasRequests) - printf(" resource->handle = wl_client_add_object(client, &::%s_interface, &m_%s_interface, id, resource);\n", interfaceName, interfaceName); - else - printf(" resource->handle = wl_client_add_object(client, &::%s_interface, 0, id, resource);\n", interfaceName); - printf(" resource->handle->destroy = destroy_func;\n"); + printf("\n"); + printf(" if (handle) {\n"); + printf(" handle->object.id = id;\n"); + printf(" handle->object.interface = &::%s_interface;\n", interfaceName); + printf(" handle->object.implementation = (void (**)(void))%s;\n", interfaceMember.constData()); + printf(" handle->data = resource;\n"); + printf(" wl_client_add_resource(client, handle);\n"); + printf(" } else {\n"); + printf(" handle = wl_client_add_object(client, &::%s_interface, %s, id, resource);\n", interfaceName, interfaceMember.constData()); + printf(" }\n"); + printf("\n"); + printf(" handle->destroy = destroy_func;\n"); + printf(" resource->handle = handle;\n"); printf(" %s_bind_resource(resource);\n", interfaceNameStripped); printf(" wl_list_init(&resource->handle->link);\n"); printf(" return resource;\n"); diff --git a/src/tools/qtwaylandscanner/qtwaylandscanner.pro b/src/tools/qtwaylandscanner/qtwaylandscanner.pro index 34d25b92297..ac2d07b7657 100644 --- a/src/tools/qtwaylandscanner/qtwaylandscanner.pro +++ b/src/tools/qtwaylandscanner/qtwaylandscanner.pro @@ -1,7 +1,5 @@ option(host_build) -HEADERS += qtwaylandscanner.h - SOURCES += qtwaylandscanner.cpp load(qt_tool) From 7e4adbb7a5cf7ff15c624963f0bd142bdae84b2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Thu, 16 May 2013 13:40:19 +0200 Subject: [PATCH 0036/1507] Update to 1.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Iab806693d2ee940c29b5d0dcc08a7b1e88bcd97f Reviewed-by: Samuel Rødal --- src/3rdparty/wayland/protocols/wayland.xml | 854 ++++++++++++++------- 1 file changed, 565 insertions(+), 289 deletions(-) diff --git a/src/3rdparty/wayland/protocols/wayland.xml b/src/3rdparty/wayland/protocols/wayland.xml index cc8fb063fb6..3bce022c3e8 100644 --- a/src/3rdparty/wayland/protocols/wayland.xml +++ b/src/3rdparty/wayland/protocols/wayland.xml @@ -36,9 +36,14 @@ The sync request asks the server to emit the 'done' event - on the provided wl_callback object. Since requests are - handled in-order, this can be used as a barrier to ensure all - previous requests have been handled. + on the returned wl_callback object. Since requests are + handled in-order and events are delivered in-order, this can + used as a barrier to ensure all previous requests and the + resulting events have been handled. + + The object returned by this request will be destroyed by the + compositor after the callback is fired and as such the client must not + attempt to use it after that point. @@ -55,11 +60,11 @@ The error event is sent out when a fatal (non-recoverable) - error has occurred. The @object_id argument is the object + error has occurred. The object_id argument is the object where the error occurred, most often in response to a request - to that object. The @code identifies the error and is defined + to that object. The code identifies the error and is defined by the object interface. As such, each interface defines its - own set of error codes. The @message is an brief description + own set of error codes. The message is an brief description of the error, for (debugging) convenience. @@ -81,12 +86,12 @@ - + This event is used internally by the object ID management logic. When a client deletes an object, the server will send this event to acknowledge that it has seen the delete request. When the client receive this event, it will know that it can - safely reuse the object ID + safely reuse the object ID. @@ -97,36 +102,41 @@ The global registry object. The server has a number of global objects that are available to all clients. These objects typically represent an actual object in the server (for example, - an input device) or they are singleton objects that provides + an input device) or they are singleton objects that provide extension functionality. When a client creates a registry object, the registry object will emit a global event for each global currently in the - registry. Globals come and go as a result of device hotplugs, - reconfiguration or other events, and the registry will send out - @global and @global_remove events to keep the client up to date - with the changes. To mark the end of the initial burst of - events, the client can use the wl_display.sync request - immediately after calling wl_display.get_registry. + registry. Globals come and go as a result of device or + monitor hotplugs, reconfiguration or other events, and the + registry will send out global and global_remove events to + keep the client up to date with the changes. To mark the end + of the initial burst of events, the client can use the + wl_display.sync request immediately after calling + wl_display.get_registry. - A client can 'bind' to a global object by using the bind - request. This creates a client side handle that lets the object + A client can bind to a global object by using the bind + request. This creates a client-side handle that lets the object emit events to the client and lets the client invoke requests on the object. - Binds a new, client-created object to the server using @name as - the identifier. + Binds a new, client-created object to the server using the + specified name as the identifier. - + - Notify the client of global objects. + Notify the client of global objects. + + The event notifies the client that a global object with + the given name is now available, and it implements the + given version of the given interface. @@ -135,10 +145,13 @@ - Notify the client of removed global objects. This event - notifies the client that the global identifies by @name is no - longer available. If the client bound to the global using the - 'bind' request, the client should now destroy that object. + Notify the client of removed global objects. + + This event notifies the client that the global identified + by name is no longer available. If the client bound to + the global using the bind request, the client should now + destroy that object. + The object remains valid and requests to the object will be ignored until the client destroys it, to avoid races between the global going away and a client sending a request to it. @@ -148,12 +161,19 @@ + + Clients can handle the 'done' event to get notified when + the related request is done. + - + + Notify the client when the related request is done. + + - + A compositor. This object is a singleton global. The compositor is in charge of combining the contents of multiple @@ -180,20 +200,21 @@ The wl_shm_pool object encapsulates a piece of memory shared between the compositor and client. Through the wl_shm_pool object, the client can allocate shared memory wl_buffer objects. - The objects will share the same underlying mapped memory. - Reusing the mapped memory avoids the setup/teardown overhead and - is useful when interactively resizing a surface or for many - small buffers. + All objects created through the same pool share the same + underlying mapped memory. Reusing the mapped memory avoids the + setup/teardown overhead and is useful when interactively resizing + a surface or for many small buffers. - - Create a wl_buffer from the pool. The buffer is created a - offset bytes into the pool and has width and height as - specified. The stride arguments specifies the number of bytes - from beginning of one row to the beginning of the next. The - format is the pixel format of the buffer and must be one of - those advertised through the wl_shm.format event. + + Create a wl_buffer object from the pool. + + The buffer is created offset bytes into the pool and has + width and height as specified. The stride arguments specifies + the number of bytes from beginning of one row to the beginning + of the next. The format is the pixel format of the buffer and + must be one of those advertised through the wl_shm.format event. A buffer will keep a reference to the pool it was created from so it is valid to destroy the pool immediately after creating @@ -210,15 +231,19 @@ - Destroy the pool. + Destroy the shared memory pool. + + The mmapped memory will be released when all + buffers that have been created from this pool + are gone. This request will cause the server to remap the backing memory - for the pool from the fd passed when the pool was creating but - using the new size. + for the pool from the file descriptor passed when the pool was + created, but using the new size. @@ -227,26 +252,41 @@ - Support for shared memory buffers. + A global singleton object that provides support for shared + memory. + + Clients can create wl_shm_pool objects using the create_pool + request. + + At connection setup time, the wl_shm object emits one or more + format events to inform clients about the valid pixel formats + that can be used for buffers. - - - + + These errors can be emitted in response to wl_shm requests. + + + + - - + + This describes the memory layout of an individual pixel. + + + - This creates wl_shm_pool object, which can be used to create - shared memory based wl_buffer objects. The server will mmap - size bytes of the passed fd, to use as backing memory for then - pool. + Create a new wl_shm_pool object. + + The pool can be used to create shared memory based buffer + objects. The server will mmap size bytes of the passed file + descriptor, to use as backing memory for the pool. @@ -255,6 +295,11 @@ + + Informs the client about a valid pixel format that + can be used for buffers. Known formats include + argb8888 and xrgb8888. + @@ -307,22 +352,26 @@ - - Indicate that the client can accept the given mime-type, or - NULL for not accepted. Use for feedback during drag and drop. + + Indicate that the client can accept the given mime type, or + NULL for not accepted. + + Used for feedback during drag-and-drop. - + To transfer the offered data, the client issues this request - and indicates the mime-type it wants to receive. The transfer - happens through the passed fd (typically a pipe(7) file - descriptor). The source client writes the data in the - mime-type representation requested and then closes the fd. + and indicates the mime type it wants to receive. The transfer + happens through the passed file descriptor (typically created + with the pipe system call). The source client writes the data + in the mime type representation requested and then closes the + file descriptor. + The receiving client reads from the read end of the pipe until EOF and the closes its end, at which point the transfer is complete. @@ -331,15 +380,19 @@ - + + + Destroy the data offer. + + - + Sent immediately after creating the wl_data_offer object. One event per offered mime type. - + @@ -353,11 +406,11 @@ - This request adds a mime-type to the set of mime-types + This request adds a mime type to the set of mime types advertised to targets. Can be called several times to offer multiple types. - + @@ -367,9 +420,11 @@ - + Sent when a target accepts pointer_focus or motion events. If a target does not accept any of the offered types, type is NULL. + + Used for feedback during drag-and-drop. @@ -377,8 +432,9 @@ - Request for data from another client. Send the data as the - specified mime-type over the passed fd, then close the fd. + Request for data from the client. Send the data as the + specified mime type over the passed file descriptor, then + close it. @@ -395,9 +451,16 @@ + + There is one wl_data_device per seat which can be obtained + from the global wl_data_device_manager singleton. + + A wl_data_device provides access to inter-client data transfer + mechanisms such as copy-and-paste and drag-and-drop. + - - This request asks the compositor to start a drag and drop + + This request asks the compositor to start a drag-and-drop operation on behalf of the client. The source argument is the data source that provides the data @@ -410,7 +473,7 @@ the client must have an active implicit grab that matches the serial. - The icon surface is an optional (can be nil) surface that + The icon surface is an optional (can be NULL) surface that provides an icon to be moved around with the cursor. Initially, the top-left corner of the icon surface is placed at the cursor hotspot, but subsequent wl_surface.attach request can move the @@ -426,33 +489,39 @@ - + + + This request asks the compositor to set the selection + to the data from the source on behalf of the client. + + To unset the selection, set the source to NULL. + - + The data_offer event introduces a new wl_data_offer object, which will subsequently be used in either the - data_device.enter event (for drag and drop) or the + data_device.enter event (for drag-and-drop) or the data_device.selection event (for selections). Immediately following the data_device_data_offer event, the new data_offer object will send out data_offer.offer events to describe the - mime-types it offers. + mime types it offers. - + This event is sent when an active drag-and-drop pointer enters a surface owned by the client. The position of the pointer at - enter time is provided by the @x an @y arguments, in surface + enter time is provided by the x an y arguments, in surface local coordinates. @@ -464,7 +533,7 @@ - + This event is sent when the drag-and-drop pointer leaves the surface and the session ends. The client must destroy the wl_data_offer introduced at enter time at this point. @@ -472,18 +541,23 @@ - + This event is sent when the drag-and-drop pointer moves within the currently focused surface. The new position of the pointer - is provided by the @x an @y arguments, in surface local + is provided by the x an y arguments, in surface local coordinates. - + - + + + The event is sent when a drag-and-drop operation is ended + because the implicit grab is removed. + + @@ -505,23 +579,42 @@ The wl_data_device_manager is a a singleton global object that provides access to inter-client data transfer mechanisms such as - copy and paste and drag and drop. These mechanisms are tied to + copy-and-paste and drag-and-drop. These mechanisms are tied to a wl_seat and this interface lets a client get a wl_data_device corresponding to a wl_seat. + + Create a new data source. + + + Create a new data device for a given seat. + + + This interface is implemented by servers that provide + desktop-style user interfaces. + + It allows clients to associate a wl_shell_surface with + a basic surface. + + + + Create a shell surface for an existing surface. + + Only one shell surface can be associated with a given surface. + @@ -529,11 +622,18 @@ - - An interface implemented by a wl_surface. On server side the - object is automatically destroyed when the related wl_surface is - destroyed. On client side, wl_shell_surface_destroy() must be - called before destroying the wl_surface object. + + An interface that may be implemented by a wl_surface, for + implementations that provide a desktop-style user interface. + + It provides requests to treat surfaces like toplevel, fullscreen + or popup windows, move, resize or maximize them, associate + metadata like title and class, etc. + + On the server side the object is automatically destroyed when + the related wl_surface is destroyed. On client side, + wl_shell_surface_destroy() must be called before destroying + the wl_surface object. @@ -541,15 +641,28 @@ A client must respond to a ping event with a pong request or the client may be deemed unresponsive. - + - - + + Start a pointer-driven move of the surface. + + This request must be used in response to a button press event. + The server may ignore move requests depending on the state of + the surface (e.g. fullscreen or maximized). + + + + + These values are used to indicate which edge of a surface + is being dragged in a resize operation. The server may + use this information to adapt its behavior, e.g. choose + an appropriate cursor image. + @@ -562,31 +675,43 @@ - - - + + Start a pointer-driven resizing of the surface. + + This request must be used in response to a button press event. + The server may ignore resize requests depending on the state of + the surface (e.g. fullscreen or maximized). + + + + - - Make the surface a toplevel window. + + Map the surface as a toplevel surface. + + A toplevel surface is not fullscreen, maximized or transient. + + These flags specify details of the expected behaviour + of transient surfaces. Used in the set_transient request. + - Map the surface relative to an existing surface. The x and y - arguments specify the locations of the upper left corner of - the surface relative to the upper left corner of the parent - surface. The flags argument controls overflow/clipping - behaviour when the surface would intersect a screen edge, - panel or such. And possibly whether the offset only - determines the initial position or if the surface is locked to - that relative position during moves. + Map the surface relative to an existing surface. + + The x and y arguments specify the locations of the upper left + corner of the surface relative to the upper left corner of the + parent surface. + + The flags argument controls details of the transient behaviour. @@ -595,75 +720,67 @@ + + + Hints to indicate to the compositor how to deal with a conflict + between the dimensions of the surface and the dimensions of the + output. The compositor is free to ignore this parameter. + + + + + + + - Map the surface as a fullscreen surface. If an output parameter is - given then the surface will be made fullscreen on that output. If the - client does not specify the output then the compositor will apply its - policy - usually choosing the output on which the surface has the - biggest surface area. + Map the surface as a fullscreen surface. - The client may specify a method to resolve a size conflict between the - output size and the surface size - this is provided through the - fullscreen_method parameter. + If an output parameter is given then the surface will be made + fullscreen on that output. If the client does not specify the + output then the compositor will apply its policy - usually + choosing the output on which the surface has the biggest surface + area. - The framerate parameter is used only when the fullscreen_method is set - to "driver", to indicate the preferred framerate. framerate=0 indicates - that the app does not care about framerate. The framerate is - specified in mHz, that is framerate of 60000 is 60Hz. + The client may specify a method to resolve a size conflict + between the output size and the surface size - this is provided + through the method parameter. - The compositor must reply to this request with a configure event with - the dimensions for the output on which the surface will be made fullscreen. + The framerate parameter is used only when the method is set + to "driver", to indicate the preferred framerate. A value of 0 + indicates that the app does not care about framerate. The + framerate is specified in mHz, that is framerate of 60000 is 60Hz. + + The compositor must reply to this request with a configure event + with the dimensions for the output on which the surface will + be made fullscreen. - - - Hints to indicate compositor how to deal with a conflict between the - dimensions for the surface and the dimensions of the output. As a hint - the compositor is free to ignore this parameter. - - "default" The client has no preference on fullscreen behavior, - policies are determined by compositor. - - "scale" The client prefers scaling by the compositor. Scaling would - always preserve surface's aspect ratio with surface centered on the - output - - "driver" The client wants to switch video mode to the smallest mode - that can fit the client buffer. If the sizes do not match the - compositor must add black borders. - - "fill" The surface is centered on the output on the screen with no - scaling. If the surface is of insufficient size the compositor must - add black borders. - - - - - - - - Popup surfaces. Will switch an implicit grab into - owner-events mode, and grab will continue after the implicit - grab ends (button released). Once the implicit grab is over, - the popup grab continues until the window is destroyed or a - mouse button is pressed in any other clients window. A click + Map the surface as a popup. + + A popup surface is a transient surface with an added pointer + grab. + + An existing implicit grab will be changed to owner-events mode, + and the popup grab will continue after the implicit grab ends + (i.e. releasing the mouse button does not cause the popup to + be unmapped). + + The popup grab continues until the window is destroyed or a + mouse button is pressed in any other clients window. A click in any of the clients surfaces is reported as normal, however, clicks in other clients surfaces will be discarded and trigger the callback. - - TODO: Grab keyboard too, maybe just terminate on any click - inside or outside the surface? - - + + @@ -672,29 +789,49 @@ - A request from the client to notify the compositor the maximized - operation. The compositor will reply with a configure event telling - the expected new surface size. The operation is completed on the - next buffer attach to this surface. - A maximized client will fill the fullscreen of the output it is bound - to, except the panel area. This is the main difference between - a maximized shell surface and a fullscreen shell surface. + Map the surface as a maximized surface. + + If an output parameter is given then the surface will be + maximized on that output. If the client does not specify the + output then the compositor will apply its policy - usually + choosing the output on which the surface has the biggest surface + area. + + The compositor will reply with a configure event telling + the expected new surface size. The operation is completed + on the next buffer attach to this surface. + + A maximized surface typically fills the entire output it is + bound to, except for desktop element such as panels. This is + the main difference between a maximized shell surface and a + fullscreen shell surface. + + The details depend on the compositor implementation. + Set a short title for the surface. + + This string may be used to identify the surface in a task bar, + window list, or other user interface elements provided by the + compositor. + + The string must be encoded in UTF-8. + Set a class for the surface. + The surface class identifies the general class of applications - to which the surface belongs. The class is the file name of - the applications .desktop file (absolute path if non-standard - location). + to which the surface belongs. A common convention is to use + the file name (full path if non-standard location) of the + applications .desktop file as the class. @@ -710,11 +847,19 @@ The configure event asks the client to resize its surface. + The size is a hint, in the sense that the client is free to ignore it if it doesn't resize, pick a smaller size (to - satisfy aspect ratio or resize in steps of NxM pixels). The - client is free to dismiss all but the last configure event it - received. + satisfy aspect ratio or resize in steps of NxM pixels). + + The edges parameter provides a hint about how the surface + was resized. The client may use this information to decide + how to adjust its content to the new size (e.g. a scrolling + area might adjust its content position to leave the viewable + content unmoved). + + The client is free to dismiss all but the last configure + event it received. @@ -731,52 +876,56 @@ - + - A surface. This is an image that is displayed on the screen. + A surface is a rectangular area that is displayed on the screen. It has a location, size and pixel contents. + + Surfaces are also used for some special purposes, e.g. as + cursor images for pointers, drag icons, etc. - Deletes the surface and invalidates its object id. + Deletes the surface and invalidates its object ID. - Set the contents of a buffer into this surface. The x and y - arguments specify the location of the new pending buffer's upper - left corner, relative to the current buffer's upper left corner. In - other words, the x and y, and the width and height of the wl_buffer - together define in which directions the surface's size changes. + Set a buffer as the content of this surface. + + The x and y arguments specify the location of the new pending + buffer's upper left corner, relative to the current buffer's + upper left corner. In other words, the x and y, and the width + and height of the wl_buffer together define in which directions + the surface's size changes. Surface contents are double-buffered state, see wl_surface.commit. The initial surface contents are void; there is no content. - wl_surface.attach assigns the given wl_buffer as the pending wl_buffer. - wl_surface.commit applies the pending wl_buffer as the new + wl_surface.attach assigns the given wl_buffer as the pending + wl_buffer. wl_surface.commit makes the pending wl_buffer the new surface contents, and the size of the surface becomes the size of - the wl_buffer. The wl_buffer is also kept as pending, until - changed by wl_surface.attach or the wl_buffer is destroyed. + the wl_buffer, as described above. After commit, there is no + pending buffer until the next attach. Committing a pending wl_buffer allows the compositor to read the - pixels in the wl_buffer. The compositor may access the pixels at any - time after the wl_surface.commit request. When the compositor will - not access the pixels anymore, it will send the wl_buffer.release - event. Only after receiving wl_buffer.release, the client may re-use - the wl_buffer. A wl_buffer, that has been attached and then replaced - by another attach instead of committed, will not receive a release - event, and is not used by the compositor. + pixels in the wl_buffer. The compositor may access the pixels at + any time after the wl_surface.commit request. When the compositor + will not access the pixels anymore, it will send the + wl_buffer.release event. Only after receiving wl_buffer.release, + the client may re-use the wl_buffer. A wl_buffer that has been + attached and then replaced by another attach instead of committed + will not receive a release event, and is not used by the + compositor. - Destroying the wl_buffer after wl_buffer.release does not change the - surface contents, even if the wl_buffer is still pending for the - next commit. In such case, the next commit does not change the - surface contents. However, if the client destroys the wl_buffer - before receiving wl_buffer.release, the surface contents become - undefined immediately. + Destroying the wl_buffer after wl_buffer.release does not change + the surface contents. However, if the client destroys the + wl_buffer before receiving wl_buffer.release, the surface + contents become undefined immediately. - Only if wl_surface.attach is sent with a nil wl_buffer, the + Only if wl_surface.attach is sent with a NULL wl_buffer, the following wl_surface.commit will remove the surface content. @@ -788,20 +937,21 @@ This request is used to describe the regions where the pending - buffer (or if pending buffer is none, the current buffer as updated - in-place) on the next wl_surface.commit will be different from the - current buffer, and needs to be repainted. The pending buffer can be - set by wl_surface.attach. The compositor ignores the parts of the - damage that fall outside of the surface. + buffer is different from the current surface contents, and where + the surface therefore needs to be repainted. The pending buffer + must be set by wl_surface.attach before sending damage. The + compositor ignores the parts of the damage that fall outside of + the surface. Damage is double-buffered state, see wl_surface.commit. The initial value for pending damage is empty: no damage. - wl_surface.damage adds pending damage: the new pending damage is the - union of old pending damage and the given rectangle. - wl_surface.commit assigns pending damage as the current damage, and - clears pending damage. The server will clear the current damage as - it repaints the surface. + wl_surface.damage adds pending damage: the new pending damage + is the union of old pending damage and the given rectangle. + + wl_surface.commit assigns pending damage as the current damage, + and clears pending damage. The server will clear the current + damage as it repaints the surface. @@ -826,6 +976,10 @@ damage, or any other state changes. wl_surface.commit triggers a display update, so the callback event will arrive after the next output refresh where the surface is visible. + + The object returned by this request will be destroyed by the + compositor after the callback is fired and as such the client must not + attempt to use it after that point. @@ -834,11 +988,14 @@ This request sets the region of the surface that contains - opaque content. The opaque region is an optimization hint for - the compositor that lets it optimize out redrawing of content - behind opaque regions. Setting an opaque region is not - required for correct behaviour, but marking transparent - content as opaque will result in repaint artifacts. + opaque content. + + The opaque region is an optimization hint for the compositor + that lets it optimize out redrawing of content behind opaque + regions. Setting an opaque region is not required for correct + behaviour, but marking transparent content as opaque will result + in repaint artifacts. + The compositor ignores the parts of the opaque region that fall outside of the surface. @@ -846,11 +1003,11 @@ wl_surface.set_opaque_region changes the pending opaque region. wl_surface.commit copies the pending region to the current region. - Otherwise the pending and current regions are never changed. + Otherwise, the pending and current regions are never changed. The initial value for opaque region is empty. Setting the pending opaque region has copy semantics, and the wl_region object can be - destroyed immediately. A nil wl_region causes the pending opaque + destroyed immediately. A NULL wl_region causes the pending opaque region to be set to empty. @@ -860,10 +1017,11 @@ This request sets the region of the surface that can receive - pointer and touch events. Input events happening outside of - this region will try the next surface in the server surface - stack. The compositor ignores the parts of the input region that - fall outside of the surface. + pointer and touch events. + + Input events happening outside of this region will try the next + surface in the server surface stack. The compositor ignores the + parts of the input region that fall outside of the surface. Input region is double-buffered state, see wl_surface.commit. @@ -873,10 +1031,11 @@ except cursor and icon surfaces are special cases, see wl_pointer.set_cursor and wl_data_device.start_drag. - The initial value for input region is infinite. That means the whole - surface will accept input. Setting the pending input region has copy - semantics, and the wl_region object can be destroyed immediately. A - nil wl_region causes the input region to be set to infinite. + The initial value for input region is infinite. That means the + whole surface will accept input. Setting the pending input region + has copy semantics, and the wl_region object can be destroyed + immediately. A NULL wl_region causes the input region to be set + to infinite. @@ -894,7 +1053,7 @@ On commit, a pending wl_buffer is applied first, all other state second. This means that all coordinates in double-buffered state are relative to the new wl_buffer coming into use, except for - wl_surface.attach itself. If the pending wl_buffer is none, the + wl_surface.attach itself. If there is no pending wl_buffer, the coordinates are relative to the current surface contents. All requests that need a commit to become effective are documented @@ -906,46 +1065,75 @@ - This is emitted whenever a surface's creation, movement, or resizing - results in some part of it being within the scanout region of an - output. + This is emitted whenever a surface's creation, movement, or resizing + results in some part of it being within the scanout region of an + output. + + Note that a surface may be overlapping with zero or more outputs. - This is emitted whenever a surface's creation, movement, or resizing - results in it no longer having any part of it within the scanout region - of an output. + This is emitted whenever a surface's creation, movement, or resizing + results in it no longer having any part of it within the scanout region + of an output. - + + + + + + This request sets an optional transformation on how the compositor + interprets the contents of the buffer attached to the surface. The + accepted values for the transform parameter are the values for + wl_output.transform. + + Buffer transform is double-buffered state, see wl_surface.commit. + + A newly created surface has its buffer transformation set to normal. + + The purpose of this request is to allow clients to render content + according to the output transform, thus permiting the compositor to + use certain optimizations even if the display is rotated. Using + hardware overlays and scanning out a client buffer for fullscreen + surfaces are examples of such optmizations. Those optimizations are + highly dependent on the compositor implementation, so the use of this + request should be considered on a case-by-case basis. + + Note that if the transform value includes 90 or 270 degree rotation, + the width of the buffer will become the surface height and the height + of the buffer will become the surface width. + + + + - - A group of keyboards, pointer (mice, for example) and touch - devices . This object is published as a global during start up, - or when such a device is hot plugged. A seat typically has a - pointer and maintains a keyboard_focus and a pointer_focus. + + A seat is a group of keyboards, pointer and touch devices. This + object is published as a global during start up, or when such a + device is hot plugged. A seat typically has a pointer and + maintains a keyboard focus and a pointer focus. This is a bitmask of capabilities this seat has; if a member is - set, then it is present on the seat. + set, then it is present on the seat. - - - + + + - This is emitted whenever a seat gains or loses the pointer, - keyboard or touch capabilities. The argument is a wl_seat_caps_mask + keyboard or touch capabilities. The argument is a capability enum containing the complete set of capabilities this seat has. @@ -955,28 +1143,48 @@ The ID provided will be initialized to the wl_pointer interface for this seat. + + This request only takes effect if the seat has the pointer + capability. - + The ID provided will be initialized to the wl_keyboard interface for this seat. + + This request only takes effect if the seat has the keyboard + capability. - + The ID provided will be initialized to the wl_touch interface for this seat. + + This request only takes effect if the seat has the touch + capability. + + The wl_pointer interface represents one or more input devices, + such as mice, which control the pointer location and pointer_focus + of a seat. + + The wl_pointer interface generates motion, enter and leave + events for the surfaces that the pointer is located over, + and button and axis events for button presses, button releases + and scrolling. + + Set the pointer surface, i.e., the surface that contains the @@ -1007,28 +1215,35 @@ undefined, and the wl_surface is unmapped. - + - - + + Notification that this seat's pointer is focused on a certain - surface. When an seat's focus enters a surface, the pointer image + surface. + + When an seat's focus enters a surface, the pointer image is undefined and a client should respond to this event by setting - an appropriate pointer image. + an appropriate pointer image with the set_cursor request. - - + + + Notification that this seat's pointer is no longer focused on + a certain surface. + + The leave notification is sent before the enter notification + for the new focus. @@ -1036,13 +1251,14 @@ - Notification of pointer location change. The arguments surface_[xy] - are the location relative to the focused surface. + Notification of pointer location change. The arguments + surface_x and surface_y are the location relative to the + focused surface. - - - + + + @@ -1050,24 +1266,30 @@ Describes the physical state of a button which provoked the button event. - - + + - Mouse button click and release notifications. The location - of the click is given by the last motion or pointer_focus event. + Mouse button click and release notifications. + + The location of the click is given by the last motion or + enter event. + The time argument is a timestamp with millisecond + granularity, with an undefined base. - + - + + Describes the axis types of scroll events. + @@ -1092,7 +1314,7 @@ scroll distance. - + @@ -1100,19 +1322,21 @@ + The wl_keyboard interface represents one or more keyboards + associated with a seat. - This enum specifies the format of the keymap provided to the client - with the wl_keyboard::keymap event. + This specifies the format of the keymap provided to the + client with the wl_keyboard.keymap event. - + - This event provides a file descriptor to the client which can be + This event provides a file descriptor to the client which can be memory-mapped to provide a keyboard mapping description. @@ -1121,19 +1345,30 @@ + + Notification that this seat's keyboard focus is on a certain + surface. + - + + + Notification that this seat's keyboard focus is no longer on + a certain surface. + + The leave notification is sent before the enter notification + for the new focus. + - Describes the physical state of a key which provoked the key event. + Describes the physical state of a key which provoked the key event. @@ -1142,17 +1377,19 @@ A key was pressed or released. + The time argument is a timestamp with millisecond + granularity, with an undefined base. - + - Notifies clients that the modifier and/or group state has + Notifies clients that the modifier and/or group state has changed, and it should update its local state. @@ -1165,29 +1402,51 @@ - + + The wl_touch interface represents a touchscreen + associated with a seat. + + Touch interactions can consist of one or more contacts. + For each contact, a series of events is generated, starting + with a down event, followed by zero or more motion events, + and ending with an up event. Events relating to the same + contact point can be identified by the ID of the sequence. + + A new touch point has appeared on the surface. This touch point is + assigned a unique @id. Future events from this touchpoint reference + this ID. The ID ceases to be valid after a touch up event and may be + re-used in the future. + - + - - - + + + + + The touch point has disappeared. No further events will be sent for + this touchpoint and the touch point's ID is released and may be + re-used in a future touch down event. + - - + + - - - - + + A touchpoint has changed coordinates. + + + + + @@ -1200,23 +1459,29 @@ Sent if the compositor decides the touch stream is a global gesture. No further events are sent to the clients from that - particular gesture. + particular gesture. Touch cancellation applies to all touch points + currently active on this client's surface. The client is + responsible for finalizing the touch points, future touch points on + this surface may re-use the touch point ID. - An output describes part of the compositor geometry. The - compositor work in the 'compositor coordinate system' and an + compositor works in the 'compositor coordinate system' and an output corresponds to rectangular area in that space that is actually visible. This typically corresponds to a monitor that displays part of the compositor space. This object is published - as global during start up, or when a screen is hot plugged. + as global during start up, or when a monitor is hotplugged. + + This enumeration describes how the physical + pixels on an output are layed out. + @@ -1251,7 +1516,11 @@ - + + The geometry event describes geometric properties of the output. + The event is sent when binding to the output object and whenever + any of the properties change. + - + + These flags describe properties of an output mode. + They are used in the flags bitfield of the mode event. + - + The mode event describes an available mode for the output. + The event is sent when binding to the output object and there will always be one mode, the current mode. The event is sent again if an output changes mode, for the mode that is now current. In other words, the current mode is always the last mode that was received with the current flag set. - + @@ -1296,18 +1569,21 @@ - Region. + A region object describes an area. + + Region objects are used to describe the opaque and input + regions of a surface. - Destroy the region. This will invalidate the object id. + Destroy the region. This will invalidate the object ID. - Add the specified rectangle to the region + Add the specified rectangle to the region. @@ -1318,7 +1594,7 @@ - Subtract the specified rectangle from the region + Subtract the specified rectangle from the region. From 56688a228dfa4260f77829cd8c125da2edbec2dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Wed, 22 May 2013 12:42:08 +0200 Subject: [PATCH 0037/1507] Namespace Qt extensions qt_ instead of wl_ MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I6882f1747fa42b11e795252cba169f65e2fe08e5 Reviewed-by: Samuel Rødal --- src/3rdparty/wayland/extensions/brcm.xml | 2 +- .../wayland/extensions/output-extension.xml | 6 +++--- .../wayland/extensions/qtkey-extension.xml | 2 +- .../wayland/extensions/sub-surface-extension.xml | 14 +++++++------- .../wayland/extensions/surface-extension.xml | 6 +++--- .../wayland/extensions/touch-extension.xml | 2 +- src/3rdparty/wayland/extensions/windowmanager.xml | 2 +- src/3rdparty/wayland/extensions/xcomposite.xml | 2 +- 8 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/3rdparty/wayland/extensions/brcm.xml b/src/3rdparty/wayland/extensions/brcm.xml index 862026d0dc5..4c8e188dad9 100644 --- a/src/3rdparty/wayland/extensions/brcm.xml +++ b/src/3rdparty/wayland/extensions/brcm.xml @@ -39,7 +39,7 @@ $QT_END_LICENSE$ - + diff --git a/src/3rdparty/wayland/extensions/output-extension.xml b/src/3rdparty/wayland/extensions/output-extension.xml index 0ca8214e6e3..07aa1102cd5 100644 --- a/src/3rdparty/wayland/extensions/output-extension.xml +++ b/src/3rdparty/wayland/extensions/output-extension.xml @@ -38,14 +38,14 @@ $QT_END_LICENSE$ - + - + - + diff --git a/src/3rdparty/wayland/extensions/qtkey-extension.xml b/src/3rdparty/wayland/extensions/qtkey-extension.xml index e90c331902a..1d0db59dfaf 100644 --- a/src/3rdparty/wayland/extensions/qtkey-extension.xml +++ b/src/3rdparty/wayland/extensions/qtkey-extension.xml @@ -38,7 +38,7 @@ $QT_END_LICENSE$ - + Serialized QKeyEvent diff --git a/src/3rdparty/wayland/extensions/sub-surface-extension.xml b/src/3rdparty/wayland/extensions/sub-surface-extension.xml index 41f1816e460..0a6dcfbc74b 100644 --- a/src/3rdparty/wayland/extensions/sub-surface-extension.xml +++ b/src/3rdparty/wayland/extensions/sub-surface-extension.xml @@ -38,32 +38,32 @@ $QT_END_LICENSE$ - + - + - + - + - + - + - + diff --git a/src/3rdparty/wayland/extensions/surface-extension.xml b/src/3rdparty/wayland/extensions/surface-extension.xml index c99f63b6c89..269b4390d7f 100644 --- a/src/3rdparty/wayland/extensions/surface-extension.xml +++ b/src/3rdparty/wayland/extensions/surface-extension.xml @@ -38,14 +38,14 @@ $QT_END_LICENSE$ - + - + - + diff --git a/src/3rdparty/wayland/extensions/touch-extension.xml b/src/3rdparty/wayland/extensions/touch-extension.xml index 1efb8930deb..92aefc670e8 100644 --- a/src/3rdparty/wayland/extensions/touch-extension.xml +++ b/src/3rdparty/wayland/extensions/touch-extension.xml @@ -38,7 +38,7 @@ $QT_END_LICENSE$ - + diff --git a/src/3rdparty/wayland/extensions/windowmanager.xml b/src/3rdparty/wayland/extensions/windowmanager.xml index 4d789e51a46..dbec4f1d6bc 100644 --- a/src/3rdparty/wayland/extensions/windowmanager.xml +++ b/src/3rdparty/wayland/extensions/windowmanager.xml @@ -38,7 +38,7 @@ $QT_END_LICENSE$ - + diff --git a/src/3rdparty/wayland/extensions/xcomposite.xml b/src/3rdparty/wayland/extensions/xcomposite.xml index 47a91087071..e7eb2b85afb 100644 --- a/src/3rdparty/wayland/extensions/xcomposite.xml +++ b/src/3rdparty/wayland/extensions/xcomposite.xml @@ -39,7 +39,7 @@ $QT_END_LICENSE$ - + From 11d5c5fda49071dd583e80d8f4ca2e1a69b2c0ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Wed, 22 May 2013 14:23:54 +0200 Subject: [PATCH 0038/1507] Remove the unsecure security protocol extensions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I99a5f964520f801070744ca73df394e1107f3dbf Reviewed-by: Samuel Rødal --- src/3rdparty/wayland/extensions/windowmanager.xml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/3rdparty/wayland/extensions/windowmanager.xml b/src/3rdparty/wayland/extensions/windowmanager.xml index dbec4f1d6bc..e03bc3ad3c1 100644 --- a/src/3rdparty/wayland/extensions/windowmanager.xml +++ b/src/3rdparty/wayland/extensions/windowmanager.xml @@ -39,12 +39,6 @@ - - - - - - If remaining is not 0 this is a multipart request, and From 3d91a472fc97368826d74834a735052523fbef5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Wed, 5 Jun 2013 16:21:07 +0200 Subject: [PATCH 0039/1507] Add close event to the surface extension Change-Id: Iacbd83d5551b3a5c2152ff80bb0085ce3f853306 Reviewed-by: Andy Nichols --- src/3rdparty/wayland/extensions/surface-extension.xml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/3rdparty/wayland/extensions/surface-extension.xml b/src/3rdparty/wayland/extensions/surface-extension.xml index 269b4390d7f..ccc65795bce 100644 --- a/src/3rdparty/wayland/extensions/surface-extension.xml +++ b/src/3rdparty/wayland/extensions/surface-extension.xml @@ -55,6 +55,9 @@ + + + From 7d94b055bf230510f7b8dde724a53d3fd96dfba8 Mon Sep 17 00:00:00 2001 From: Andrew Knight Date: Mon, 17 Jun 2013 10:58:12 +0300 Subject: [PATCH 0040/1507] Wayland compositor: only include Qt's generated protocol headers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The system may come with conflicting headers generated by wayland-scanner. Change-Id: I1aef7e32683ab02d0712ee65970f010a86854e43 Reviewed-by: Jørgen Lind --- src/tools/qtwaylandscanner/qtwaylandscanner.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp index 6f1516f4bfa..c51916343d3 100644 --- a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp +++ b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp @@ -364,7 +364,6 @@ void process(QXmlStreamReader &xml) printf("#define %s\n", inclusionGuard.constData()); printf("\n"); printf("#include \"wayland-server.h\"\n"); - printf("#include \"wayland-server-protocol.h\"\n"); printf("#include \"wayland-%s-server-protocol.h\"\n", QByteArray(protocolName).replace('_', '-').constData()); printf("#include \n"); printf("#include \n"); From 9c4036ce6aea48ecefd6c9b5269f0c178dc8453e Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 18 Jul 2013 14:03:54 +0200 Subject: [PATCH 0041/1507] fix namespaced build rule 1: QT_USE_NAMESPACE in qt code itself is a bad idea rule 2: don't forget to forward-declare your non-qt types Change-Id: Ifba69328f3451e708c26624f349485e7c61d31f5 Reviewed-by: Jan Arne Petersen Reviewed-by: Oswald Buddenhagen --- src/plugins/platforms/wayland/shared/qwaylandmimehelper.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/shared/qwaylandmimehelper.cpp b/src/plugins/platforms/wayland/shared/qwaylandmimehelper.cpp index d7e51144026..94a107c8125 100644 --- a/src/plugins/platforms/wayland/shared/qwaylandmimehelper.cpp +++ b/src/plugins/platforms/wayland/shared/qwaylandmimehelper.cpp @@ -46,7 +46,7 @@ #include #include -QT_USE_NAMESPACE +QT_BEGIN_NAMESPACE QByteArray QWaylandMimeHelper::getByteArray(QMimeData *mimeData, const QString &mimeType) { @@ -83,3 +83,5 @@ QByteArray QWaylandMimeHelper::getByteArray(QMimeData *mimeData, const QString & } return content; } + +QT_END_NAMESPACE From ed089d9b7af48feeaa88836a6bd272ccaeab63a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Fri, 28 Jun 2013 15:51:59 +0200 Subject: [PATCH 0042/1507] Update tests so that it does not deadlock still failes though Change-Id: I7978c752b02f32a2e2c587c0ad674c51c5e0ad22 Reviewed-by: Andy Nichols --- tests/auto/wayland/client.pro | 3 + tests/auto/wayland/mockcompositor.cpp | 11 +- tests/auto/wayland/mockinput.cpp | 2 +- tests/auto/wayland/mocksurface.cpp | 169 ++++++++++---------------- tests/auto/wayland/mocksurface.h | 27 ++-- 5 files changed, 96 insertions(+), 116 deletions(-) diff --git a/tests/auto/wayland/client.pro b/tests/auto/wayland/client.pro index a92aa88b7e2..895b5c8aa60 100644 --- a/tests/auto/wayland/client.pro +++ b/tests/auto/wayland/client.pro @@ -10,6 +10,9 @@ QT += core-private gui-private LIBS += -lwayland-client -lwayland-server } +WAYLANDSERVERSOURCES += \ + ../../../src/3rdparty/protocol/wayland.xml + SOURCES += tst_client.cpp \ mockcompositor.cpp \ mockinput.cpp \ diff --git a/tests/auto/wayland/mockcompositor.cpp b/tests/auto/wayland/mockcompositor.cpp index d25f90565a3..be44eba7a5f 100644 --- a/tests/auto/wayland/mockcompositor.cpp +++ b/tests/auto/wayland/mockcompositor.cpp @@ -42,6 +42,7 @@ #include "mockcompositor.h" #include "mocksurface.h" +#include MockCompositor::MockCompositor() : m_alive(true) , m_ready(false) @@ -195,7 +196,10 @@ Compositor::Compositor() { wl_list_init(&m_outputResources); - wl_display_add_socket(m_display, 0); + if (wl_display_add_socket(m_display, 0)) { + fprintf(stderr, "Fatal: Failed to open server socket\n"); + exit(EXIT_FAILURE); + } wl_seat_init(&m_seat); wl_pointer_init(&m_pointer); @@ -204,11 +208,13 @@ Compositor::Compositor() wl_seat_set_keyboard(&m_seat, &m_keyboard); wl_display_add_global(m_display, &wl_compositor_interface, this, bindCompositor); + + wl_display_init_shm(m_display); + wl_display_add_global(m_display, &wl_seat_interface, this, bindSeat); wl_display_add_global(m_display, &wl_output_interface, this, bindOutput); wl_display_add_global(m_display, &wl_shell_interface, this, bindShell); - wl_display_init_shm(m_display); m_loop = wl_display_get_event_loop(m_display); m_fd = wl_event_loop_get_fd(m_loop); @@ -223,6 +229,7 @@ Compositor::~Compositor() void Compositor::dispatchEvents(int timeout) { + wl_display_flush_clients(m_display); wl_event_loop_dispatch(m_loop, timeout); } diff --git a/tests/auto/wayland/mockinput.cpp b/tests/auto/wayland/mockinput.cpp index 50c8b764c61..a5b46bf6ef4 100644 --- a/tests/auto/wayland/mockinput.cpp +++ b/tests/auto/wayland/mockinput.cpp @@ -142,7 +142,7 @@ static wl_surface *resolveSurface(const QVariant &v) { QSharedPointer mockSurface = v.value >(); Surface *surface = mockSurface ? mockSurface->handle() : 0; - return surface ? surface->handle() : 0; + return surface ? surface->base() : 0; } void Compositor::setKeyboardFocus(void *data, const QList ¶meters) diff --git a/tests/auto/wayland/mocksurface.cpp b/tests/auto/wayland/mocksurface.cpp index 49b672f9d9e..24ac30dd72d 100644 --- a/tests/auto/wayland/mocksurface.cpp +++ b/tests/auto/wayland/mocksurface.cpp @@ -44,113 +44,11 @@ namespace Impl { -void destroy_surface(wl_resource *resource) -{ - Surface *surface = static_cast(resource->data); - surface->compositor()->removeSurface(surface); - delete surface; -} - -static void surface_destroy(wl_client *, wl_resource *surfaceResource) -{ - wl_resource_destroy(surfaceResource); -} - -void surface_attach(wl_client *client, wl_resource *surfaceResource, - wl_resource *buffer, int x, int y) -{ - Q_UNUSED(client); - Q_UNUSED(x); - Q_UNUSED(y); - - Surface *surface = static_cast(surfaceResource->data); - surface->m_buffer = buffer ? static_cast(buffer->data) : 0; - - if (!buffer) - surface->m_mockSurface->image = QImage(); -} - -void surface_damage(wl_client *client, wl_resource *surfaceResource, - int32_t x, int32_t y, int32_t width, int32_t height) -{ - Q_UNUSED(client); - Q_UNUSED(x); - Q_UNUSED(y); - Q_UNUSED(width); - Q_UNUSED(height); - - Surface *surface = static_cast(surfaceResource->data); - wl_buffer *buffer = surface->m_buffer; - - if (!buffer) - return; - - if (wl_buffer_is_shm(buffer)) { - int stride = wl_shm_buffer_get_stride(buffer); - uint format = wl_shm_buffer_get_format(buffer); - (void) format; - void *data = wl_shm_buffer_get_data(buffer); - const uchar *char_data = static_cast(data); - QImage img(char_data, buffer->width, buffer->height, stride, QImage::Format_ARGB32_Premultiplied); - surface->m_mockSurface->image = img; - } - - wl_resource *frameCallback; - wl_list_for_each(frameCallback, &surface->m_frameCallbackList, link) { - wl_callback_send_done(frameCallback, surface->m_compositor->time()); - wl_resource_destroy(frameCallback); - } - - wl_list_init(&surface->m_frameCallbackList); -} - -void surface_frame(wl_client *client, - wl_resource *surfaceResource, - uint32_t callback) -{ - Surface *surface = static_cast(surfaceResource->data); - wl_resource *frameCallback = wl_client_add_object(client, &wl_callback_interface, 0, callback, surface); - wl_list_insert(&surface->m_frameCallbackList, &frameCallback->link); -} - -void surface_set_opaque_region(wl_client *client, wl_resource *surfaceResource, - wl_resource *region) -{ - Q_UNUSED(client); - Q_UNUSED(surfaceResource); - Q_UNUSED(region); -} - -void surface_set_input_region(wl_client *client, wl_resource *surfaceResource, - wl_resource *region) -{ - Q_UNUSED(client); - Q_UNUSED(surfaceResource); - Q_UNUSED(region); -} - Surface::Surface(wl_client *client, uint32_t id, Compositor *compositor) - : m_surface(wl_surface()) + : QtWaylandServer::wl_surface(client, &base()->resource, id) , m_compositor(compositor) , m_mockSurface(new MockSurface(this)) { - static const struct wl_surface_interface surfaceInterface = { - surface_destroy, - surface_attach, - surface_damage, - surface_frame, - surface_set_opaque_region, - surface_set_input_region - }; - - m_surface.resource.object.id = id; - m_surface.resource.object.interface = &wl_surface_interface; - m_surface.resource.object.implementation = (Implementation)&surfaceInterface; - m_surface.resource.data = this; - m_surface.resource.destroy = destroy_surface; - - wl_client_add_resource(client, &m_surface.resource); - wl_list_init(&m_frameCallbackList); } @@ -159,8 +57,73 @@ Surface::~Surface() m_mockSurface->m_surface = 0; } +void Surface::surface_destroy_resource(Resource *) +{ + compositor()->removeSurface(this); + delete this; } +void Surface::surface_destroy(Resource *resource) +{ + wl_resource_destroy(resource->handle); +} + +void Surface::surface_attach(Resource *resource, + struct wl_resource *buffer, int x, int y) +{ + Q_UNUSED(resource); + Q_UNUSED(x); + Q_UNUSED(y); + m_buffer = buffer ? static_cast(buffer->data) : 0; + + if (!buffer) + m_mockSurface->image = QImage(); +} + +void Surface::surface_damage(Resource *resource, + int32_t x, int32_t y, int32_t width, int32_t height) +{ + Q_UNUSED(resource); + Q_UNUSED(x); + Q_UNUSED(y); + Q_UNUSED(width); + Q_UNUSED(height); + + if (!m_buffer) + return; + + if (wl_buffer_is_shm(m_buffer)) { + int stride = wl_shm_buffer_get_stride(m_buffer); + uint format = wl_shm_buffer_get_format(m_buffer); + Q_UNUSED(format); + void *data = wl_shm_buffer_get_data(m_buffer); + const uchar *char_data = static_cast(data); + QImage img(char_data, m_buffer->width, m_buffer->height, stride, QImage::Format_ARGB32_Premultiplied); + m_mockSurface->image = img; + } + + wl_resource *frameCallback; + wl_list_for_each(frameCallback, &m_frameCallbackList, link) { + wl_callback_send_done(frameCallback, m_compositor->time()); + wl_resource_destroy(frameCallback); + } + + wl_list_init(&m_frameCallbackList); +} + +void Surface::surface_frame(Resource *resource, + uint32_t callback) +{ + wl_resource *frameCallback = wl_client_add_object(resource->client(), &wl_callback_interface, 0, callback, this); + wl_list_insert(&m_frameCallbackList, &frameCallback->link); +} + +void Surface::surface_commit(Resource *resource) +{ + Q_UNUSED(resource); +} + +} MockSurface::MockSurface(Impl::Surface *surface) : m_surface(surface) { diff --git a/tests/auto/wayland/mocksurface.h b/tests/auto/wayland/mocksurface.h index 74014fcd30a..09df344b61b 100644 --- a/tests/auto/wayland/mocksurface.h +++ b/tests/auto/wayland/mocksurface.h @@ -40,37 +40,44 @@ ****************************************************************************/ #include -#include + +#include + +#include "qwayland-server-wayland.h" #include "mockcompositor.h" namespace Impl { -class Surface +class Surface : public QtWayland::Object, public QtWaylandServer::wl_surface { public: Surface(wl_client *client, uint32_t id, Compositor *compositor); ~Surface(); Compositor *compositor() const { return m_compositor; } - wl_surface *handle() { return &m_surface; } QSharedPointer mockSurface() const { return m_mockSurface; } +protected: + + void surface_destroy_resource(Resource *resource) Q_DECL_OVERRIDE; + + void surface_destroy(Resource *resource) Q_DECL_OVERRIDE; + void surface_attach(Resource *resource, + struct wl_resource *buffer, int x, int y) Q_DECL_OVERRIDE; + void surface_damage(Resource *resource, + int32_t x, int32_t y, int32_t width, int32_t height) Q_DECL_OVERRIDE; + void surface_frame(Resource *resource, + uint32_t callback) Q_DECL_OVERRIDE; + void surface_commit(Resource *resource) Q_DECL_OVERRIDE; private: - wl_surface m_surface; wl_buffer *m_buffer; Compositor *m_compositor; QSharedPointer m_mockSurface; wl_list m_frameCallbackList; - - friend void surface_attach(wl_client *client, wl_resource *surface, - wl_resource *buffer, int x, int y); - friend void surface_damage(wl_client *client, wl_resource *surface, - int32_t x, int32_t y, int32_t width, int32_t height); - friend void surface_frame(wl_client *client, wl_resource *surface, uint32_t callback); }; } From 4e68516aa55833db0449e69fc644d09e7b0a22f3 Mon Sep 17 00:00:00 2001 From: Robin Burchell Date: Tue, 6 Aug 2013 02:11:59 +0200 Subject: [PATCH 0043/1507] Implement QPlatformWindow::raise() in QWaylandWindow and relay it to the compositor Change-Id: I744f9799730810e4afc73f86487a34aa0fd8405b Done-with: Vesa Halttunen Reviewed-by: Jan Arne Petersen Reviewed-by: Andrew Knight Reviewed-by: Andy Nichols --- src/3rdparty/wayland/extensions/surface-extension.xml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/3rdparty/wayland/extensions/surface-extension.xml b/src/3rdparty/wayland/extensions/surface-extension.xml index ccc65795bce..a2c9688c0e5 100644 --- a/src/3rdparty/wayland/extensions/surface-extension.xml +++ b/src/3rdparty/wayland/extensions/surface-extension.xml @@ -84,5 +84,11 @@ + + + + + + From cf1775b464a9577a80ce7610e50aaed7b2a6891c Mon Sep 17 00:00:00 2001 From: Jan Arne Petersen Date: Tue, 6 Aug 2013 13:09:57 +0200 Subject: [PATCH 0044/1507] Fix double frees in Wayland 1.2 Remove double frees in destroy_func generated by qwaylandscanner. The wl_resource struct is already freed by wl_resource_destroy() in wayland-server in Wayland 1.2. Change-Id: Ibd42e42a23238ba9c665a7c918f9b547968f7146 Reviewed-by: Andy Nichols --- src/tools/qtwaylandscanner/qtwaylandscanner.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp index c51916343d3..4c7990e88d5 100644 --- a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp +++ b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp @@ -367,6 +367,15 @@ void process(QXmlStreamReader &xml) printf("#include \"wayland-%s-server-protocol.h\"\n", QByteArray(protocolName).replace('_', '-').constData()); printf("#include \n"); printf("#include \n"); + + printf("\n"); + printf("#ifndef WAYLAND_VERSION_CHECK\n"); + printf("#define WAYLAND_VERSION_CHECK(major, minor, micro) \\\n"); + printf(" (WAYLAND_VERSION_MAJOR > (major)) || \\\n"); + printf(" (WAYLAND_VERSION_MAJOR == (major) && WAYLAND_VERSION_MINOR > (minor)) || \\\n"); + printf(" (WAYLAND_VERSION_MAJOR == (major) && WAYLAND_VERSION_MINOR == (minor) && WAYLAND_VERSION_MICRO >= (micro))\n"); + printf("#endif\n"); + printf("\n"); printf("QT_BEGIN_NAMESPACE\n"); printf("\n"); @@ -531,7 +540,11 @@ void process(QXmlStreamReader &xml) printf(" %s::%s(struct ::wl_client *client, int id)\n", interfaceName, interfaceName); printf(" : m_resource(0)\n"); + printf("#if WAYLAND_VERSION_CHECK(1, 2, 0)\n"); + printf(" , m_ownResource(false)\n"); + printf("#else\n"); printf(" , m_ownResource(true)\n"); + printf("#endif\n"); printf(" , m_global(0)\n"); printf(" {\n"); printf(" wl_list_init(&m_resource_list);\n"); @@ -541,7 +554,11 @@ void process(QXmlStreamReader &xml) printf(" %s::%s(struct ::wl_display *display)\n", interfaceName, interfaceName); printf(" : m_resource(0)\n"); + printf("#if WAYLAND_VERSION_CHECK(1, 2, 0)\n"); + printf(" , m_ownResource(false)\n"); + printf("#else\n"); printf(" , m_ownResource(true)\n"); + printf("#endif\n"); printf(" , m_global(0)\n"); printf(" {\n"); printf(" wl_list_init(&m_resource_list);\n"); From 8e4d666a6b287757b74882b2cb14e8177fa6e9c2 Mon Sep 17 00:00:00 2001 From: Jan Arne Petersen Date: Thu, 8 Aug 2013 08:29:22 +0200 Subject: [PATCH 0045/1507] Fix uninitialized value in generated code Change-Id: Ied932604de63072cc3b5614c84c8ec34fd94c891 Reviewed-by: Andy Nichols --- src/tools/qtwaylandscanner/qtwaylandscanner.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp index 4c7990e88d5..ce3e316a20f 100644 --- a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp +++ b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp @@ -568,6 +568,11 @@ void process(QXmlStreamReader &xml) printf(" %s::%s()\n", interfaceName, interfaceName); printf(" : m_resource(0)\n"); + printf("#if WAYLAND_VERSION_CHECK(1, 2, 0)\n"); + printf(" , m_ownResource(false)\n"); + printf("#else\n"); + printf(" , m_ownResource(true)\n"); + printf("#endif\n"); printf(" , m_global(0)\n"); printf(" {\n"); printf(" wl_list_init(&m_resource_list);\n"); From 02305555cad054c0afba23364a16fbecc2f02232 Mon Sep 17 00:00:00 2001 From: Morten Johan Sorvig Date: Thu, 22 Aug 2013 09:17:08 +0200 Subject: [PATCH 0046/1507] Make qtwaylandscanner generate correct interface versions. Change-Id: I3e74b00c10a11fb60261e883cbcf25aa6d4589c2 Reviewed-by: Andy Nichols --- src/tools/qtwaylandscanner/qtwaylandscanner.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp index ce3e316a20f..a3553bbd76c 100644 --- a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp +++ b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp @@ -172,7 +172,7 @@ WaylandInterface readInterface(QXmlStreamReader &xml) { WaylandInterface interface; interface.name = byteArrayValue(xml, "name"); - interface.version = intValue(xml, "name", 1); + interface.version = intValue(xml, "version", 1); while (xml.readNextStartElement()) { if (xml.name() == "event") From 13ab2c15d472c15eadcf975e38e20078e07da252 Mon Sep 17 00:00:00 2001 From: Jan Arne Petersen Date: Wed, 21 Aug 2013 09:34:12 +0200 Subject: [PATCH 0047/1507] Make test compile with Wayland 1.2 Tests still fail when running like before. Change-Id: I9c0a5e8068fa7af7abc0018e6e9c4f08aa39533b Reviewed-by: Andy Nichols --- tests/auto/wayland/client.pro | 3 +- tests/auto/wayland/mockcompositor.cpp | 19 +- tests/auto/wayland/mockcompositor.h | 16 +- tests/auto/wayland/mockinput.cpp | 256 ++++++++++++++------------ tests/auto/wayland/mockinput.h | 119 ++++++++++++ tests/auto/wayland/mocksurface.cpp | 22 ++- tests/auto/wayland/mocksurface.h | 6 +- 7 files changed, 295 insertions(+), 146 deletions(-) create mode 100644 tests/auto/wayland/mockinput.h diff --git a/tests/auto/wayland/client.pro b/tests/auto/wayland/client.pro index 895b5c8aa60..448f7d5161c 100644 --- a/tests/auto/wayland/client.pro +++ b/tests/auto/wayland/client.pro @@ -20,4 +20,5 @@ SOURCES += tst_client.cpp \ mocksurface.cpp \ mockoutput.cpp HEADERS += mockcompositor.h \ - mocksurface.h + mockinput.h \ + mocksurface.h \ diff --git a/tests/auto/wayland/mockcompositor.cpp b/tests/auto/wayland/mockcompositor.cpp index be44eba7a5f..e51f3ed577a 100644 --- a/tests/auto/wayland/mockcompositor.cpp +++ b/tests/auto/wayland/mockcompositor.cpp @@ -40,6 +40,7 @@ ****************************************************************************/ #include "mockcompositor.h" +#include "mockinput.h" #include "mocksurface.h" #include @@ -201,29 +202,23 @@ Compositor::Compositor() exit(EXIT_FAILURE); } - wl_seat_init(&m_seat); - wl_pointer_init(&m_pointer); - wl_seat_set_pointer(&m_seat, &m_pointer); - wl_keyboard_init(&m_keyboard); - wl_seat_set_keyboard(&m_seat, &m_keyboard); - wl_display_add_global(m_display, &wl_compositor_interface, this, bindCompositor); wl_display_init_shm(m_display); - wl_display_add_global(m_display, &wl_seat_interface, this, bindSeat); + m_seat.reset(new Seat(this, m_display)); + m_pointer = m_seat->pointer(); + m_keyboard = m_seat->keyboard(); + wl_display_add_global(m_display, &wl_output_interface, this, bindOutput); wl_display_add_global(m_display, &wl_shell_interface, this, bindShell); - m_loop = wl_display_get_event_loop(m_display); m_fd = wl_event_loop_get_fd(m_loop); } Compositor::~Compositor() { - wl_pointer_release(&m_pointer); - wl_keyboard_release(&m_keyboard); wl_display_destroy(m_display); } @@ -292,6 +287,10 @@ void Compositor::addSurface(Surface *surface) void Compositor::removeSurface(Surface *surface) { m_surfaces.remove(m_surfaces.indexOf(surface)); + if (m_keyboard->focus() == surface) + m_keyboard->setFocus(0); + if (m_pointer->focus() == surface) + m_pointer->setFocus(0, QPoint()); } } diff --git a/tests/auto/wayland/mockcompositor.h b/tests/auto/wayland/mockcompositor.h index 6bfd5d6bdf1..7f3e2268312 100644 --- a/tests/auto/wayland/mockcompositor.h +++ b/tests/auto/wayland/mockcompositor.h @@ -58,6 +58,9 @@ namespace Impl { typedef void (**Implementation)(void); +class Keyboard; +class Pointer; +class Seat; class Surface; class Compositor @@ -87,16 +90,9 @@ public: private: static void bindCompositor(wl_client *client, void *data, uint32_t version, uint32_t id); - static void bindSeat(wl_client *client, void *data, uint32_t version, uint32_t id); static void bindOutput(wl_client *client, void *data, uint32_t version, uint32_t id); static void bindShell(wl_client *client, void *data, uint32_t version, uint32_t id); - static void get_pointer(wl_client *client, wl_resource *resource, uint32_t id); - static void get_keyboard(wl_client *client, wl_resource *resource, uint32_t id); - static void get_touch(wl_client *client, wl_resource *resource, uint32_t id); - - static void destroyInputResource(wl_resource *resource); - void initShm(); void sendOutputGeometry(wl_resource *resource); @@ -112,9 +108,9 @@ private: wl_list m_outputResources; uint32_t m_time; - wl_seat m_seat; - wl_pointer m_pointer; - wl_keyboard m_keyboard; + QScopedPointer m_seat; + Pointer *m_pointer; + Keyboard *m_keyboard; QVector m_surfaces; }; diff --git a/tests/auto/wayland/mockinput.cpp b/tests/auto/wayland/mockinput.cpp index a5b46bf6ef4..ac2b666b43f 100644 --- a/tests/auto/wayland/mockinput.cpp +++ b/tests/auto/wayland/mockinput.cpp @@ -40,164 +40,192 @@ ****************************************************************************/ #include "mockcompositor.h" +#include "mockinput.h" #include "mocksurface.h" namespace Impl { -void Compositor::destroyInputResource(wl_resource *resource) -{ - Compositor *compositor = static_cast(resource->data); - wl_keyboard *keyboard = &compositor->m_keyboard; - wl_pointer *pointer = &compositor->m_pointer; - - if (keyboard->focus_resource == resource) - keyboard->focus_resource = 0; - if (pointer->focus_resource == resource) - pointer->focus_resource = 0; - - wl_list_remove(&resource->link); - - free(resource); -} - -static void destroyInputDevice(wl_resource *resource) -{ - wl_list_remove(&resource->link); - free(resource); -} - -void pointer_attach(wl_client *client, - wl_resource *device_resource, - uint32_t time, - wl_resource *buffer_resource, int32_t x, int32_t y) -{ - Q_UNUSED(client); - Q_UNUSED(device_resource); - Q_UNUSED(time); - Q_UNUSED(buffer_resource); - Q_UNUSED(QPoint(x, y)); -} - -void Compositor::get_pointer(wl_client *client, - wl_resource *resource, - uint32_t id) -{ - static const struct wl_pointer_interface pointer_interface = { - pointer_attach - }; - Compositor *compositor = static_cast(resource->data); - wl_pointer *pointer = &compositor->m_pointer; - wl_resource *clientResource = wl_client_add_object(client, - &wl_pointer_interface, - &pointer_interface, - id, - pointer); - wl_list_insert(&pointer->resource_list, &clientResource->link); - clientResource->destroy = destroyInputDevice; -} - -void Compositor::get_keyboard(wl_client *client, - wl_resource *resource, - uint32_t id) -{ - Compositor *compositor = static_cast(resource->data); - wl_keyboard *keyboard = &compositor->m_keyboard; - wl_resource *clientResource = wl_client_add_object(client, - &wl_keyboard_interface, - 0, - id, - keyboard); - wl_list_insert(&keyboard->resource_list, &clientResource->link); - clientResource->destroy = destroyInputDevice; -} - -void Compositor::get_touch(wl_client *client, - wl_resource *resource, - uint32_t id) -{ - Q_UNUSED(client); - Q_UNUSED(resource); - Q_UNUSED(id); -} - -void Compositor::bindSeat(wl_client *client, void *compositorData, uint32_t version, uint32_t id) -{ - static const struct wl_seat_interface seatInterface = { - get_pointer, - get_keyboard, - get_touch - }; - - Q_UNUSED(version); - wl_resource *resource = wl_client_add_object(client, &wl_seat_interface, &seatInterface, id, compositorData); - resource->destroy = destroyInputResource; - - Compositor *compositor = static_cast(compositorData); - wl_list_insert(&compositor->m_seat.base_resource_list, &resource->link); - - wl_seat_send_capabilities(resource, WL_SEAT_CAPABILITY_POINTER | WL_SEAT_CAPABILITY_KEYBOARD); -} - -static wl_surface *resolveSurface(const QVariant &v) +static Surface *resolveSurface(const QVariant &v) { QSharedPointer mockSurface = v.value >(); - Surface *surface = mockSurface ? mockSurface->handle() : 0; - return surface ? surface->base() : 0; + return mockSurface ? mockSurface->handle() : 0; } void Compositor::setKeyboardFocus(void *data, const QList ¶meters) { Compositor *compositor = static_cast(data); - wl_keyboard_set_focus(&compositor->m_keyboard, resolveSurface(parameters.first())); + compositor->m_keyboard->setFocus(resolveSurface(parameters.first())); } void Compositor::sendMousePress(void *data, const QList ¶meters) { Compositor *compositor = static_cast(data); - wl_surface *surface = resolveSurface(parameters.first()); + Surface *surface = resolveSurface(parameters.first()); if (!surface) return; QPoint pos = parameters.last().toPoint(); - wl_pointer_set_focus(&compositor->m_pointer, surface, - wl_fixed_from_int(pos.x()), wl_fixed_from_int(pos.y())); - wl_pointer_send_motion(compositor->m_pointer.focus_resource, compositor->time(), - wl_fixed_from_double(pos.x()), wl_fixed_from_double(pos.y())); - wl_pointer_send_button(compositor->m_pointer.focus_resource, - compositor->nextSerial(), compositor->time(), 0x110, 1); + compositor->m_pointer->setFocus(surface, pos); + compositor->m_pointer->sendMotion(pos); + compositor->m_pointer->sendButton(0x110, 1); } void Compositor::sendMouseRelease(void *data, const QList ¶meters) { Compositor *compositor = static_cast(data); - wl_surface *surface = resolveSurface(parameters.first()); + Surface *surface = resolveSurface(parameters.first()); if (!surface) return; - wl_pointer_send_button(compositor->m_pointer.focus_resource, - compositor->nextSerial(), compositor->time(), 0x110, 0); + compositor->m_pointer->sendButton(0x110, 0); } void Compositor::sendKeyPress(void *data, const QList ¶meters) { Compositor *compositor = static_cast(data); - wl_surface *surface = resolveSurface(parameters.first()); + Surface *surface = resolveSurface(parameters.first()); if (!surface) return; - wl_keyboard_send_key(compositor->m_keyboard.focus_resource, - compositor->nextSerial(), compositor->time(), parameters.last().toUInt() - 8, 1); + compositor->m_keyboard->sendKey(parameters.last().toUInt() - 8, 1); } void Compositor::sendKeyRelease(void *data, const QList ¶meters) { Compositor *compositor = static_cast(data); - wl_surface *surface = resolveSurface(parameters.first()); + Surface *surface = resolveSurface(parameters.first()); if (!surface) return; - wl_keyboard_send_key(compositor->m_keyboard.focus_resource, - compositor->nextSerial(), compositor->time(), parameters.last().toUInt() - 8, 0); + compositor->m_keyboard->sendKey(parameters.last().toUInt() - 8, 0); +} + +Seat::Seat(Compositor *compositor, struct ::wl_display *display) + : wl_seat(display) + , m_compositor(compositor) + , m_keyboard(new Keyboard(compositor)) + , m_pointer(new Pointer(compositor)) +{ +} + +Seat::~Seat() +{ +} + +void Seat::seat_bind_resource(Resource *resource) +{ + send_capabilities(resource->handle, capability_keyboard | capability_pointer); +} + +void Seat::seat_get_keyboard(Resource *resource, uint32_t id) +{ + m_keyboard->add(resource->client(), id); +} + +void Seat::seat_get_pointer(Resource *resource, uint32_t id) +{ + m_pointer->add(resource->client(), id); +} + +Keyboard::Keyboard(Compositor *compositor) + : wl_keyboard() + , m_compositor(compositor) +{ +} + +Keyboard::~Keyboard() +{ +} + +static wl_resource *resourceForSurface(wl_list *resourceList, Surface *surface) +{ + if (!surface) + return 0; + + wl_resource *r; + wl_client *surfaceClient = surface->resource()->client(); + + wl_list_for_each(r, resourceList, link) { + if (r->client == surfaceClient) + return r; + } + + return 0; +} + +void Keyboard::setFocus(Surface *surface) +{ + if (m_focusResource && m_focus != surface) { + uint32_t serial = m_compositor->nextSerial(); + send_leave(m_focusResource->handle, serial, m_focus->resource()->handle); + } + + struct ::wl_resource *r = resourceForSurface(resourceList(), surface); + Resource *resource = r ? Resource::fromResource(r) : 0; + + if (resource && (m_focus != surface || m_focusResource != resource)) { + uint32_t serial = m_compositor->nextSerial(); + send_modifiers(resource->handle, serial, 0, 0, 0, 0); + send_enter(resource->handle, serial, surface->resource()->handle, QByteArray()); + } + + m_focusResource = resource; + m_focus = surface; +} + +void Keyboard::sendKey(uint32_t key, uint32_t state) +{ + if (m_focusResource) { + uint32_t serial = m_compositor->nextSerial(); + send_key(m_focusResource->handle, serial, m_compositor->time(), key, state); + } +} + +Pointer::Pointer(Compositor *compositor) + : wl_pointer() + , m_compositor(compositor) +{ +} + +Pointer::~Pointer() +{ + +} + +void Pointer::setFocus(Surface *surface, const QPoint &pos) +{ + if (m_focusResource && m_focus != surface) { + uint32_t serial = m_compositor->nextSerial(); + send_leave(m_focusResource->handle, serial, m_focus->resource()->handle); + } + + struct ::wl_resource *r = resourceForSurface(resourceList(), surface); + Resource *resource = r ? Resource::fromResource(r) : 0; + + if (resource && (m_focus != surface || resource != m_focusResource)) { + uint32_t serial = m_compositor->nextSerial(); + send_enter(resource->handle, serial, surface->resource()->handle, + wl_fixed_from_int(pos.x()), wl_fixed_from_int(pos.y())); + } + + m_focusResource = resource; + m_focus = surface; +} + +void Pointer::sendMotion(const QPoint &pos) +{ + if (m_focusResource) + send_motion(m_focusResource->handle, m_compositor->time(), + wl_fixed_from_int(pos.x()), wl_fixed_from_int(pos.y())); +} + +void Pointer::sendButton(uint32_t button, uint32_t state) +{ + if (m_focusResource) { + uint32_t serial = m_compositor->nextSerial(); + send_button(m_focusResource->handle, serial, m_compositor->time(), + button, state); + } } } diff --git a/tests/auto/wayland/mockinput.h b/tests/auto/wayland/mockinput.h new file mode 100644 index 00000000000..669bfaed608 --- /dev/null +++ b/tests/auto/wayland/mockinput.h @@ -0,0 +1,119 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2013 Klarälvdalens Datakonsult AB (KDAB). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef MOCKINPUT_H +#define MOCKINPUT_H + +#include + +#include "qwayland-server-wayland.h" + +#include "mockcompositor.h" + +namespace Impl { + +class Keyboard; +class Pointer; + +class Seat : public QtWaylandServer::wl_seat +{ +public: + Seat(Compositor *compositor, struct ::wl_display *display); + ~Seat(); + + Compositor *compositor() const { return m_compositor; } + + Keyboard *keyboard() const { return m_keyboard.data(); } + Pointer *pointer() const { return m_pointer.data(); } + +protected: + void seat_bind_resource(Resource *resource) Q_DECL_OVERRIDE; + void seat_get_keyboard(Resource *resource, uint32_t id) Q_DECL_OVERRIDE; + void seat_get_pointer(Resource *resource, uint32_t id) Q_DECL_OVERRIDE; + +private: + Compositor *m_compositor; + + QScopedPointer m_keyboard; + QScopedPointer m_pointer; +}; + +class Keyboard : public QtWaylandServer::wl_keyboard +{ +public: + Keyboard(Compositor *compositor); + ~Keyboard(); + + Surface *focus() const { return m_focus; } + void setFocus(Surface *surface); + + void sendKey(uint32_t key, uint32_t state); + +private: + Compositor *m_compositor; + + Resource *m_focusResource; + Surface *m_focus; +}; + +class Pointer : public QtWaylandServer::wl_pointer +{ +public: + Pointer(Compositor *compositor); + ~Pointer(); + + Surface *focus() const { return m_focus; } + + void setFocus(Surface *surface, const QPoint &pos); + void sendMotion(const QPoint &pos); + void sendButton(uint32_t button, uint32_t state); + +private: + Compositor *m_compositor; + + Resource *m_focusResource; + Surface *m_focus; +}; + +} + +#endif // MOCKINPUT_H diff --git a/tests/auto/wayland/mocksurface.cpp b/tests/auto/wayland/mocksurface.cpp index 24ac30dd72d..d5e0367a080 100644 --- a/tests/auto/wayland/mocksurface.cpp +++ b/tests/auto/wayland/mocksurface.cpp @@ -45,7 +45,7 @@ namespace Impl { Surface::Surface(wl_client *client, uint32_t id, Compositor *compositor) - : QtWaylandServer::wl_surface(client, &base()->resource, id) + : QtWaylandServer::wl_surface(client, id) , m_compositor(compositor) , m_mockSurface(new MockSurface(this)) { @@ -74,7 +74,7 @@ void Surface::surface_attach(Resource *resource, Q_UNUSED(resource); Q_UNUSED(x); Q_UNUSED(y); - m_buffer = buffer ? static_cast(buffer->data) : 0; + m_buffer = buffer; if (!buffer) m_mockSurface->image = QImage(); @@ -92,13 +92,21 @@ void Surface::surface_damage(Resource *resource, if (!m_buffer) return; - if (wl_buffer_is_shm(m_buffer)) { - int stride = wl_shm_buffer_get_stride(m_buffer); - uint format = wl_shm_buffer_get_format(m_buffer); +#if WAYLAND_VERSION_CHECK(1, 2, 0) + struct ::wl_shm_buffer *shm_buffer = wl_shm_buffer_get(m_buffer); +#else + struct ::wl_buffer *shm_buffer = 0; + if (wl_buffer_is_shm(static_cast(m_buffer->data))) + shm_buffer = static_cast(m_buffer->data); +#endif + + if (shm_buffer) { + int stride = wl_shm_buffer_get_stride(shm_buffer); + uint format = wl_shm_buffer_get_format(shm_buffer); Q_UNUSED(format); - void *data = wl_shm_buffer_get_data(m_buffer); + void *data = wl_shm_buffer_get_data(shm_buffer); const uchar *char_data = static_cast(data); - QImage img(char_data, m_buffer->width, m_buffer->height, stride, QImage::Format_ARGB32_Premultiplied); + QImage img(char_data, wl_shm_buffer_get_width(shm_buffer), wl_shm_buffer_get_height(shm_buffer), stride, QImage::Format_ARGB32_Premultiplied); m_mockSurface->image = img; } diff --git a/tests/auto/wayland/mocksurface.h b/tests/auto/wayland/mocksurface.h index 09df344b61b..49260f51b38 100644 --- a/tests/auto/wayland/mocksurface.h +++ b/tests/auto/wayland/mocksurface.h @@ -41,15 +41,13 @@ #include -#include - #include "qwayland-server-wayland.h" #include "mockcompositor.h" namespace Impl { -class Surface : public QtWayland::Object, public QtWaylandServer::wl_surface +class Surface : public QtWaylandServer::wl_surface { public: Surface(wl_client *client, uint32_t id, Compositor *compositor); @@ -72,7 +70,7 @@ protected: uint32_t callback) Q_DECL_OVERRIDE; void surface_commit(Resource *resource) Q_DECL_OVERRIDE; private: - wl_buffer *m_buffer; + wl_resource *m_buffer; Compositor *m_compositor; QSharedPointer m_mockSurface; From 7aba6b21cd65bce90912840c46c7d16246ec0998 Mon Sep 17 00:00:00 2001 From: Jan Arne Petersen Date: Wed, 21 Aug 2013 11:40:47 +0200 Subject: [PATCH 0048/1507] Do not create unused code with qtwaylandscanner We do not use foreign wl_resource handles in the server code anymore. Remove support for it from the generated code in qtwaylandscanner. Change-Id: Id45235ceb4282db02858749c0bef04278be7322d Reviewed-by: Andy Nichols --- .../qtwaylandscanner/qtwaylandscanner.cpp | 64 ++++--------------- 1 file changed, 11 insertions(+), 53 deletions(-) diff --git a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp index a3553bbd76c..9bb4e36e7f7 100644 --- a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp +++ b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp @@ -371,9 +371,9 @@ void process(QXmlStreamReader &xml) printf("\n"); printf("#ifndef WAYLAND_VERSION_CHECK\n"); printf("#define WAYLAND_VERSION_CHECK(major, minor, micro) \\\n"); - printf(" (WAYLAND_VERSION_MAJOR > (major)) || \\\n"); + printf(" ((WAYLAND_VERSION_MAJOR > (major)) || \\\n"); printf(" (WAYLAND_VERSION_MAJOR == (major) && WAYLAND_VERSION_MINOR > (minor)) || \\\n"); - printf(" (WAYLAND_VERSION_MAJOR == (major) && WAYLAND_VERSION_MINOR == (minor) && WAYLAND_VERSION_MICRO >= (micro))\n"); + printf(" (WAYLAND_VERSION_MAJOR == (major) && WAYLAND_VERSION_MINOR == (minor) && WAYLAND_VERSION_MICRO >= (micro)))\n"); printf("#endif\n"); printf("\n"); @@ -394,7 +394,6 @@ void process(QXmlStreamReader &xml) printf(" class %s\n {\n", interfaceName); printf(" public:\n"); - printf(" %s(struct ::wl_client *client, struct ::wl_resource *resource, int id);\n", interfaceName); printf(" %s(struct ::wl_client *client, int id);\n", interfaceName); printf(" %s(struct ::wl_display *display);\n", interfaceName); printf(" %s();\n", interfaceName); @@ -415,7 +414,6 @@ void process(QXmlStreamReader &xml) printf(" static Resource *fromResource(struct ::wl_resource *resource) { return static_cast(resource->data); }\n"); printf(" };\n"); printf("\n"); - printf(" void init(struct ::wl_client *client, struct ::wl_resource *resource, int id);\n"); printf(" void init(struct ::wl_client *client, int id);\n"); printf(" void init(struct ::wl_display *display);\n"); printf("\n"); @@ -470,7 +468,7 @@ void process(QXmlStreamReader &xml) printf(" static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id);\n"); printf(" static void destroy_func(struct ::wl_resource *client_resource);\n"); printf("\n"); - printf(" Resource *bind(struct ::wl_client *client, struct ::wl_resource *resource, uint32_t id);\n"); + printf(" Resource *bind(struct ::wl_client *client, uint32_t id);\n"); if (hasRequests) { printf("\n"); @@ -488,7 +486,6 @@ void process(QXmlStreamReader &xml) printf("\n"); printf(" Resource *m_resource;\n"); - printf(" bool m_ownResource;\n"); printf(" struct ::wl_list m_resource_list;\n"); printf(" struct ::wl_global *m_global;\n"); printf(" };\n"); @@ -528,23 +525,8 @@ void process(QXmlStreamReader &xml) QByteArray stripped = stripInterfaceName(interface.name); const char *interfaceNameStripped = stripped.constData(); - printf(" %s::%s(struct ::wl_client *client, struct ::wl_resource *resource, int id)\n", interfaceName, interfaceName); - printf(" : m_resource(0)\n"); - printf(" , m_ownResource(false)\n"); - printf(" , m_global(0)\n"); - printf(" {\n"); - printf(" wl_list_init(&m_resource_list);\n"); - printf(" init(client, resource, id);\n"); - printf(" }\n"); - printf("\n"); - printf(" %s::%s(struct ::wl_client *client, int id)\n", interfaceName, interfaceName); printf(" : m_resource(0)\n"); - printf("#if WAYLAND_VERSION_CHECK(1, 2, 0)\n"); - printf(" , m_ownResource(false)\n"); - printf("#else\n"); - printf(" , m_ownResource(true)\n"); - printf("#endif\n"); printf(" , m_global(0)\n"); printf(" {\n"); printf(" wl_list_init(&m_resource_list);\n"); @@ -554,11 +536,6 @@ void process(QXmlStreamReader &xml) printf(" %s::%s(struct ::wl_display *display)\n", interfaceName, interfaceName); printf(" : m_resource(0)\n"); - printf("#if WAYLAND_VERSION_CHECK(1, 2, 0)\n"); - printf(" , m_ownResource(false)\n"); - printf("#else\n"); - printf(" , m_ownResource(true)\n"); - printf("#endif\n"); printf(" , m_global(0)\n"); printf(" {\n"); printf(" wl_list_init(&m_resource_list);\n"); @@ -568,11 +545,6 @@ void process(QXmlStreamReader &xml) printf(" %s::%s()\n", interfaceName, interfaceName); printf(" : m_resource(0)\n"); - printf("#if WAYLAND_VERSION_CHECK(1, 2, 0)\n"); - printf(" , m_ownResource(false)\n"); - printf("#else\n"); - printf(" , m_ownResource(true)\n"); - printf("#endif\n"); printf(" , m_global(0)\n"); printf(" {\n"); printf(" wl_list_init(&m_resource_list);\n"); @@ -584,15 +556,9 @@ void process(QXmlStreamReader &xml) printf(" }\n"); printf("\n"); - printf(" void %s::init(struct ::wl_client *client, struct ::wl_resource *resource, int id)\n", interfaceName); - printf(" {\n"); - printf(" m_resource = bind(client, resource, id);\n"); - printf(" }\n"); - printf("\n"); - printf(" void %s::init(struct ::wl_client *client, int id)\n", interfaceName); printf(" {\n"); - printf(" m_resource = bind(client, 0, id);\n"); + printf(" m_resource = bind(client, id);\n"); printf(" }\n"); printf("\n"); @@ -604,7 +570,7 @@ void process(QXmlStreamReader &xml) printf(" %s::Resource *%s::add(struct wl_list *resource_list, struct ::wl_client *client, int id)\n", interfaceName, interfaceName); printf(" {\n"); - printf(" Resource *resource = bind(client, 0, id);\n"); + printf(" Resource *resource = bind(client, id);\n"); printf(" wl_list_insert(resource_list, &resource->handle->link);\n"); printf(" return resource;\n"); printf(" }\n"); @@ -635,7 +601,7 @@ void process(QXmlStreamReader &xml) printf(" void %s::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id)\n", interfaceName); printf(" {\n"); printf(" Q_UNUSED(version);\n"); - printf(" static_cast<%s *>(data)->bind(client, 0, id);\n", interfaceName); + printf(" static_cast<%s *>(data)->bind(client, id);\n", interfaceName); printf(" }\n"); printf("\n"); @@ -643,13 +609,13 @@ void process(QXmlStreamReader &xml) printf(" {\n"); printf(" Resource *resource = Resource::fromResource(client_resource);\n"); printf(" %s *that = resource->%s;\n", interfaceName, interfaceNameStripped); - printf(" bool ownResource = that->m_ownResource;\n"); printf(" that->%s_destroy_resource(resource);\n", interfaceNameStripped); printf(" if (client_resource->link.next)\n"); printf(" wl_list_remove(&client_resource->link);\n"); printf(" delete resource;\n"); - printf(" if (ownResource)\n"); - printf(" free(client_resource);\n"); + printf("#if !WAYLAND_VERSION_CHECK(1, 2, 0)\n"); + printf(" free(client_resource);\n"); + printf("#endif\n"); printf(" }\n"); printf("\n"); @@ -657,20 +623,12 @@ void process(QXmlStreamReader &xml) QByteArray interfaceMember = hasRequests ? "&m_" + interface.name + "_interface" : QByteArray("0"); - printf(" %s::Resource *%s::bind(struct ::wl_client *client, struct ::wl_resource *handle, uint32_t id)\n", interfaceName, interfaceName); + printf(" %s::Resource *%s::bind(struct ::wl_client *client, uint32_t id)\n", interfaceName, interfaceName); printf(" {\n"); printf(" Resource *resource = %s_allocate();\n", interfaceNameStripped); printf(" resource->%s = this;\n", interfaceNameStripped); printf("\n"); - printf(" if (handle) {\n"); - printf(" handle->object.id = id;\n"); - printf(" handle->object.interface = &::%s_interface;\n", interfaceName); - printf(" handle->object.implementation = (void (**)(void))%s;\n", interfaceMember.constData()); - printf(" handle->data = resource;\n"); - printf(" wl_client_add_resource(client, handle);\n"); - printf(" } else {\n"); - printf(" handle = wl_client_add_object(client, &::%s_interface, %s, id, resource);\n", interfaceName, interfaceMember.constData()); - printf(" }\n"); + printf(" struct ::wl_resource *handle = wl_client_add_object(client, &::%s_interface, %s, id, resource);\n", interfaceName, interfaceMember.constData()); printf("\n"); printf(" handle->destroy = destroy_func;\n"); printf(" resource->handle = handle;\n"); From 570df4082dfdba5aa96b5d5667ea25cd452da09d Mon Sep 17 00:00:00 2001 From: Andrew Knight Date: Thu, 22 Aug 2013 16:19:45 +0300 Subject: [PATCH 0049/1507] qtwaylandscanner: fix binding delegate to track resources Global extension objects created with qtwaylandscanner may need to track their child resource list. This ensures bound objects are added to that list. Change-Id: I2875d84d2108ddad664c52ed1a11173312ff1b04 Reviewed-by: Jan Arne Petersen Reviewed-by: Andy Nichols --- src/tools/qtwaylandscanner/qtwaylandscanner.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp index 9bb4e36e7f7..0df2d0c37fd 100644 --- a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp +++ b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp @@ -601,7 +601,7 @@ void process(QXmlStreamReader &xml) printf(" void %s::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id)\n", interfaceName); printf(" {\n"); printf(" Q_UNUSED(version);\n"); - printf(" static_cast<%s *>(data)->bind(client, id);\n", interfaceName); + printf(" static_cast<%s *>(data)->add(client, id);\n", interfaceName); printf(" }\n"); printf("\n"); From 988785c857b7cf4f468561df7a9d4c52f6716340 Mon Sep 17 00:00:00 2001 From: Jan Arne Petersen Date: Thu, 22 Aug 2013 23:22:24 +0200 Subject: [PATCH 0050/1507] Use QMultiMap instead of wl_list for resources Change generated code in qtwaylandscanner to generate resourceMap() methods returning a QMultiMap. Adapt code using resource lists to use the map instead. Remove Compositor::resourceForSurface(). Change-Id: Id41a1712f9c2477c1a1af843bba2795dd90391e5 Reviewed-by: Andy Nichols Reviewed-by: Andrew Knight --- .../qtwaylandscanner/qtwaylandscanner.cpp | 31 +++++++------------ tests/auto/wayland/mockinput.cpp | 22 ++----------- 2 files changed, 14 insertions(+), 39 deletions(-) diff --git a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp index 0df2d0c37fd..5de7cb11d1d 100644 --- a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp +++ b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp @@ -366,6 +366,7 @@ void process(QXmlStreamReader &xml) printf("#include \"wayland-server.h\"\n"); printf("#include \"wayland-%s-server-protocol.h\"\n", QByteArray(protocolName).replace('_', '-').constData()); printf("#include \n"); + printf("#include \n"); printf("#include \n"); printf("\n"); @@ -423,8 +424,8 @@ void process(QXmlStreamReader &xml) printf(" Resource *resource() { return m_resource; }\n"); printf(" const Resource *resource() const { return m_resource; }\n"); printf("\n"); - printf(" struct ::wl_list *resourceList() { return &m_resource_list; }\n"); - printf(" const struct ::wl_list *resourceList() const { return &m_resource_list; }\n"); + printf(" QMultiMap resourceMap() { return m_resource_map; }\n"); + printf(" const QMultiMap resourceMap() const { return m_resource_map; }\n"); printf("\n"); printf(" bool isGlobal() const { return m_global != 0; }\n"); printf(" bool isResource() const { return m_resource != 0; }\n"); @@ -485,8 +486,8 @@ void process(QXmlStreamReader &xml) } printf("\n"); + printf(" QMultiMap m_resource_map;\n"); printf(" Resource *m_resource;\n"); - printf(" struct ::wl_list m_resource_list;\n"); printf(" struct ::wl_global *m_global;\n"); printf(" };\n"); @@ -526,28 +527,28 @@ void process(QXmlStreamReader &xml) const char *interfaceNameStripped = stripped.constData(); printf(" %s::%s(struct ::wl_client *client, int id)\n", interfaceName, interfaceName); - printf(" : m_resource(0)\n"); + printf(" : m_resource_map()\n"); + printf(" , m_resource(0)\n"); printf(" , m_global(0)\n"); printf(" {\n"); - printf(" wl_list_init(&m_resource_list);\n"); printf(" init(client, id);\n"); printf(" }\n"); printf("\n"); printf(" %s::%s(struct ::wl_display *display)\n", interfaceName, interfaceName); - printf(" : m_resource(0)\n"); + printf(" : m_resource_map()\n"); + printf(" , m_resource(0)\n"); printf(" , m_global(0)\n"); printf(" {\n"); - printf(" wl_list_init(&m_resource_list);\n"); printf(" init(display);\n"); printf(" }\n"); printf("\n"); printf(" %s::%s()\n", interfaceName, interfaceName); - printf(" : m_resource(0)\n"); + printf(" : m_resource_map()\n"); + printf(" , m_resource(0)\n"); printf(" , m_global(0)\n"); printf(" {\n"); - printf(" wl_list_init(&m_resource_list);\n"); printf(" }\n"); printf("\n"); @@ -564,14 +565,8 @@ void process(QXmlStreamReader &xml) printf(" %s::Resource *%s::add(struct ::wl_client *client, int id)\n", interfaceName, interfaceName); printf(" {\n"); - printf(" return add(&m_resource_list, client, id);\n"); - printf(" }\n"); - printf("\n"); - - printf(" %s::Resource *%s::add(struct wl_list *resource_list, struct ::wl_client *client, int id)\n", interfaceName, interfaceName); - printf(" {\n"); printf(" Resource *resource = bind(client, id);\n"); - printf(" wl_list_insert(resource_list, &resource->handle->link);\n"); + printf(" m_resource_map.insert(client, resource);\n"); printf(" return resource;\n"); printf(" }\n"); printf("\n"); @@ -609,9 +604,8 @@ void process(QXmlStreamReader &xml) printf(" {\n"); printf(" Resource *resource = Resource::fromResource(client_resource);\n"); printf(" %s *that = resource->%s;\n", interfaceName, interfaceNameStripped); + printf(" that->m_resource_map.remove(resource->client(), resource);\n"); printf(" that->%s_destroy_resource(resource);\n", interfaceNameStripped); - printf(" if (client_resource->link.next)\n"); - printf(" wl_list_remove(&client_resource->link);\n"); printf(" delete resource;\n"); printf("#if !WAYLAND_VERSION_CHECK(1, 2, 0)\n"); printf(" free(client_resource);\n"); @@ -633,7 +627,6 @@ void process(QXmlStreamReader &xml) printf(" handle->destroy = destroy_func;\n"); printf(" resource->handle = handle;\n"); printf(" %s_bind_resource(resource);\n", interfaceNameStripped); - printf(" wl_list_init(&resource->handle->link);\n"); printf(" return resource;\n"); printf(" }\n"); diff --git a/tests/auto/wayland/mockinput.cpp b/tests/auto/wayland/mockinput.cpp index ac2b666b43f..40b01317f9a 100644 --- a/tests/auto/wayland/mockinput.cpp +++ b/tests/auto/wayland/mockinput.cpp @@ -137,22 +137,6 @@ Keyboard::~Keyboard() { } -static wl_resource *resourceForSurface(wl_list *resourceList, Surface *surface) -{ - if (!surface) - return 0; - - wl_resource *r; - wl_client *surfaceClient = surface->resource()->client(); - - wl_list_for_each(r, resourceList, link) { - if (r->client == surfaceClient) - return r; - } - - return 0; -} - void Keyboard::setFocus(Surface *surface) { if (m_focusResource && m_focus != surface) { @@ -160,8 +144,7 @@ void Keyboard::setFocus(Surface *surface) send_leave(m_focusResource->handle, serial, m_focus->resource()->handle); } - struct ::wl_resource *r = resourceForSurface(resourceList(), surface); - Resource *resource = r ? Resource::fromResource(r) : 0; + Resource *resource = surface ? resourceMap().value(surface->resource()->client()) : 0; if (resource && (m_focus != surface || m_focusResource != resource)) { uint32_t serial = m_compositor->nextSerial(); @@ -199,8 +182,7 @@ void Pointer::setFocus(Surface *surface, const QPoint &pos) send_leave(m_focusResource->handle, serial, m_focus->resource()->handle); } - struct ::wl_resource *r = resourceForSurface(resourceList(), surface); - Resource *resource = r ? Resource::fromResource(r) : 0; + Resource *resource = surface ? resourceMap().value(surface->resource()->client()) : 0; if (resource && (m_focus != surface || resource != m_focusResource)) { uint32_t serial = m_compositor->nextSerial(); From 795974e724805046c0f7b5ad0ba0b9a54879e55d Mon Sep 17 00:00:00 2001 From: Jan Arne Petersen Date: Mon, 26 Aug 2013 20:56:44 +0200 Subject: [PATCH 0051/1507] Fix scanner to support also hex values in enums Read the value of an enum entry as a QByteArray. There is not any need to convert it into an int in between. Change-Id: Ie75d30dc22f7e81ddcff64990e3c6f030f31ef79 Reviewed-by: Andrew Knight Reviewed-by: Andy Nichols --- src/tools/qtwaylandscanner/qtwaylandscanner.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp index 5de7cb11d1d..7264950ec24 100644 --- a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp +++ b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp @@ -75,7 +75,7 @@ bool parseOption(const char *str, Option *option) struct WaylandEnumEntry { QByteArray name; - int value; + QByteArray value; QByteArray summary; }; @@ -157,7 +157,7 @@ WaylandEnum readEnum(QXmlStreamReader &xml) if (xml.name() == "entry") { WaylandEnumEntry entry; entry.name = byteArrayValue(xml, "name"); - entry.value = intValue(xml, "value"); + entry.value = byteArrayValue(xml, "value"); entry.summary = byteArrayValue(xml, "summary"); result.entries << entry; } @@ -304,7 +304,7 @@ void printEnums(const QList &enums) printf(" enum %s {\n", e.name.constData()); for (int i = 0; i < e.entries.size(); ++i) { const WaylandEnumEntry &entry = e.entries.at(i); - printf(" %s_%s = %d", e.name.constData(), entry.name.constData(), entry.value); + printf(" %s_%s = %s", e.name.constData(), entry.name.constData(), entry.value.constData()); if (i < e.entries.size() - 1) printf(","); if (!entry.summary.isNull()) From a29f1c0547297800355d8aab5a7b7fd6ba3b054a Mon Sep 17 00:00:00 2001 From: Andrew Knight Date: Thu, 19 Sep 2013 16:26:59 +0300 Subject: [PATCH 0052/1507] Compositor: add BypassWindowManager hint to WindowFlags BypassWindowManagerHint is already being used on the client-side, and it would be beneficial for some compositors to see this server-side as well. Change-Id: I4801a0c2f14f86fcd48cc49c3f2324af4216fb6f Reviewed-by: Laszlo Agocs Reviewed-by: Andy Nichols --- src/3rdparty/wayland/extensions/surface-extension.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/src/3rdparty/wayland/extensions/surface-extension.xml b/src/3rdparty/wayland/extensions/surface-extension.xml index a2c9688c0e5..31f2862007e 100644 --- a/src/3rdparty/wayland/extensions/surface-extension.xml +++ b/src/3rdparty/wayland/extensions/surface-extension.xml @@ -78,6 +78,7 @@ + From 4ebe966c03c691b27d85e76388c418fc6b7135bc Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 18 Oct 2013 14:35:55 +0200 Subject: [PATCH 0053/1507] explicitly request wayland-scanner feature MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit having qtbase include it for everyone is wasteful, so do it here explicitly. Change-Id: I9bf39a48fe3323aaa5471a638760ac61a61de683 Reviewed-by: Joerg Bornemann Reviewed-by: Jørgen Lind --- tests/auto/wayland/client.pro | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/auto/wayland/client.pro b/tests/auto/wayland/client.pro index 448f7d5161c..eaf6c6e9586 100644 --- a/tests/auto/wayland/client.pro +++ b/tests/auto/wayland/client.pro @@ -10,6 +10,7 @@ QT += core-private gui-private LIBS += -lwayland-client -lwayland-server } +CONFIG += wayland-scanner WAYLANDSERVERSOURCES += \ ../../../src/3rdparty/protocol/wayland.xml From 7debd1b3690609fb103717ac4221f511733925a6 Mon Sep 17 00:00:00 2001 From: Jan Arne Petersen Date: Wed, 4 Sep 2013 12:51:04 +0200 Subject: [PATCH 0054/1507] Bind to version 1 of an interface MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Just require version 1 instead of the latest available version of an interface for now. Explicit support for requesting a higher version should be added still. Change-Id: Ib1b8303191e000227e27e07b1adf837993ac3497 Reviewed-by: Jørgen Lind --- src/tools/qtwaylandscanner/qtwaylandscanner.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp index 7264950ec24..268747bb586 100644 --- a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp +++ b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp @@ -880,7 +880,7 @@ void process(QXmlStreamReader &xml) printf(" void %s::init(struct ::wl_registry *registry, int id)\n", interfaceName); printf(" {\n"); - printf(" m_%s = static_cast(wl_registry_bind(registry, id, &%s_interface, %d));\n", interfaceName, interfaceName, interfaceName, interface.version); + printf(" m_%s = static_cast(wl_registry_bind(registry, id, &%s_interface, %d));\n", interfaceName, interfaceName, interfaceName, 1); if (hasEvents) printf(" init_listener();\n"); printf(" }\n"); From 3683b4c42003feba4c4181f6681993dc5c8881e4 Mon Sep 17 00:00:00 2001 From: Jan Arne Petersen Date: Wed, 25 Sep 2013 13:26:28 +0200 Subject: [PATCH 0055/1507] Fix creating new objects (with id == 0) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I2a6740d5e1a4367d2980e3fb17617c2f1cb95041 Reviewed-by: Andrew Knight Reviewed-by: Jørgen Lind --- src/tools/qtwaylandscanner/qtwaylandscanner.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp index 268747bb586..fcd8ec8294e 100644 --- a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp +++ b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp @@ -622,7 +622,7 @@ void process(QXmlStreamReader &xml) printf(" Resource *resource = %s_allocate();\n", interfaceNameStripped); printf(" resource->%s = this;\n", interfaceNameStripped); printf("\n"); - printf(" struct ::wl_resource *handle = wl_client_add_object(client, &::%s_interface, %s, id, resource);\n", interfaceName, interfaceMember.constData()); + printf(" struct ::wl_resource *handle = id != 0 ? wl_client_add_object(client, &::%s_interface, %s, id, resource) : wl_client_new_object(client, &::%s_interface, %s, resource);\n", interfaceName, interfaceMember.constData(), interfaceName, interfaceMember.constData()); printf("\n"); printf(" handle->destroy = destroy_func;\n"); printf(" resource->handle = handle;\n"); From 4a014e13e02861e4db6a29e8c75fcac69951b72e Mon Sep 17 00:00:00 2001 From: Jan Arne Petersen Date: Thu, 31 Oct 2013 12:55:08 +0100 Subject: [PATCH 0056/1507] Add support for text protocol to compositor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Iff22ba8b10f4ae986acba416d6fbbd4cf4f722e5 Reviewed-by: Jørgen Lind --- .../wayland/protocols/input-method.xml | 273 ++++++++++++++ src/3rdparty/wayland/protocols/text.xml | 346 ++++++++++++++++++ 2 files changed, 619 insertions(+) create mode 100644 src/3rdparty/wayland/protocols/input-method.xml create mode 100644 src/3rdparty/wayland/protocols/text.xml diff --git a/src/3rdparty/wayland/protocols/input-method.xml b/src/3rdparty/wayland/protocols/input-method.xml new file mode 100644 index 00000000000..70afdcb1dd4 --- /dev/null +++ b/src/3rdparty/wayland/protocols/input-method.xml @@ -0,0 +1,273 @@ + + + + Copyright © 2012, 2013 Intel Corporation + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that copyright notice and this permission + notice appear in supporting documentation, and that the name of + the copyright holders not be used in advertising or publicity + pertaining to distribution of the software without specific, + written prior permission. The copyright holders make no + representations about the suitability of this software for any + purpose. It is provided "as is" without express or implied + warranty. + + THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS + SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND + FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY + SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN + AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF + THIS SOFTWARE. + + + + + + Corresponds to a text model on input method side. An input method context + is created on text mode activation on the input method side. It allows to + receive information about the text model from the application via events. + Input method contexts do not keep state after deactivation and should be + destroyed after deactivation is handled. + + Text is generally UTF-8 encoded, indices and lengths are in bytes. + + Serials are used to synchronize the state between the text input and + an input method. New serials are sent by the text input in the + commit_state request and are used by the input method to indicate + the known text input state in events like preedit_string, commit_string, + and keysym. The text input can then ignore events from the input method + which are based on an outdated state (for example after a reset). + + + + + Send the commit string text for insertion to the application. + + The text to commit could be either just a single character after a key + press or the result of some composing (pre-edit). It could be also an + empty text when some text should be removed (see + delete_surrounding_text) or when the input cursor should be moved (see + cursor_position). + + Any previously set composing text will be removed. + + + + + + + Send the pre-edit string text to the application text input. + + The commit text can be used to replace the preedit text on reset (for + example on unfocus). + + Also previously sent preedit_style and preedit_cursor requests are + processed bt the text_input also. + + + + + + + + Sets styling information on composing text. The style is applied for + length in bytes from index relative to the beginning of + the composing text (as byte offset). Multiple styles can + be applied to a composing text. + + This request should be sent before sending preedit_string request. + + + + + + + + Sets the cursor position inside the composing text (as byte offset) + relative to the start of the composing text. + + When index is negative no cursor should be displayed. + + This request should be sent before sending preedit_string request. + + + + + + + + This request will be handled on text_input side as part of a directly + following commit_string request. + + + + + + + Sets the cursor and anchor to a new position. Index is the new cursor + position in bytess (when >= 0 relative to the end of inserted text + else relative to beginning of inserted text). Anchor is the new anchor + position in bytes (when >= 0 relative to the end of inserted text, else + relative to beginning of inserted text). When there should be no + selected text anchor should be the same as index. + + This request will be handled on text_input side as part of a directly + following commit_string request. + + + + + + + + + + Notify when a key event was sent. Key events should not be used for + normal text input operations, which should be done with commit_string, + delete_surrounfing_text, etc. The key event follows the wl_keyboard key + event convention. Sym is a XKB keysym, state a wl_keyboard key_state. + + + + + + + + + + Allows an input method to receive hardware keyboard input and process + key events to generate text events (with pre-edit) over the wire. This + allows input methods which compose multiple key events for inputting + text like it is done for CJK languages. + + + + + + Should be used when filtering key events with grab_keyboard. + + When the wl_keyboard::key event is not processed by the input + method itself and should be sent to the client instead, forward it + with this request. The arguments should be the ones from the + wl_keyboard::key event. + + For generating custom key events use the keysym request instead. + + + + + + + + + Should be used when filtering key events with grab_keyboard. + + When the wl_keyboard::modifiers event should be also send to the + client, forward it with this request. The arguments should be the ones + from the wl_keyboard::modifiers event. + + + + + + + + + + + + + + + + + + The plain surrounding text around the input position. Cursor is the + position in bytes within the surrounding text relative to the beginning + of the text. Anchor is the position in bytes of the selection anchor + within the surrounding text relative to the beginning of the text. If + there is no selected text anchor is the same as cursor. + + + + + + + + + + + + + + + + + + + + + + + + + + An input method object is responsible to compose text in response to + input from hardware or virtual keyboards. There is one input method + object per seat. On activate there is a new input method context object + created which allows the input method to communicate with the text model. + + + + A text model was activated. Creates an input method context object + which allows communication with the text model. + + + + + + The text model corresponding to the context argument was deactivated. + The input method context should be destroyed after deactivation is + handled. + + + + + + + + Only one client can bind this interface at a time. + + + + + + + + + + + + + + + + A keybaord surface is only shown, when a text model is active + + + + + + + + An overlay panel is shown near the input cursor above the application + window when a text model is active. + + + + diff --git a/src/3rdparty/wayland/protocols/text.xml b/src/3rdparty/wayland/protocols/text.xml new file mode 100644 index 00000000000..1b5284dc307 --- /dev/null +++ b/src/3rdparty/wayland/protocols/text.xml @@ -0,0 +1,346 @@ + + + + + Copyright © 2012, 2013 Intel Corporation + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that copyright notice and this permission + notice appear in supporting documentation, and that the name of + the copyright holders not be used in advertising or publicity + pertaining to distribution of the software without specific, + written prior permission. The copyright holders make no + representations about the suitability of this software for any + purpose. It is provided "as is" without express or implied + warranty. + + THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS + SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND + FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY + SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN + AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF + THIS SOFTWARE. + + + + + An object used for text input. Adds support for text input and input + methods to applications. A text-input object is created from a + wl_text_input_manager and corresponds typically to a text entry in an + application. + Requests are used to activate/deactivate the text-input object and set + state information like surrounding and selected text or the content type. + The information about entered text is sent to the text-input object via + the pre-edit and commit events. Using this interface removes the need + for applications to directly process hardware key events and compose text + out of them. + + Text is generally UTF-8 encoded, indices and lengths are in bytes. + + Serials are used to synchronize the state between the text input and + an input method. New serials are sent by the text input in the + commit_state request and are used by the input method to indicate + the known text input state in events like preedit_string, commit_string, + and keysym. The text input can then ignore events from the input method + which are based on an outdated state (for example after a reset). + + + + Requests the text-input object to be activated (typically when the + text entry gets focus). + The seat argument is a wl_seat which maintains the focus for this + activation. The surface argument is a wl_surface assigned to the + text-input object and tracked for focus lost. The enter event + is emitted on successful activation. + + + + + + + Requests the text-input object to be deactivated (typically when the + text entry lost focus). The seat argument is a wl_seat which was used + for activation. + + + + + + Requests input panels (virtual keyboard) to show. + + + + + Requests input panels (virtual keyboard) to hide. + + + + + Should be called by an editor widget when the input state should be + reset, for example after the text was changed outside of the normal + input method flow. + + + + + Sets the plain surrounding text around the input position. Text is + UTF-8 encoded. Cursor is the byte offset within the + surrounding text. Anchor is the byte offset of the + selection anchor within the surrounding text. If there is no selected + text anchor is the same as cursor. + + + + + + + + Content hint is a bitmask to allow to modify the behavior of the text + input. + + + + + + + + + + + + + + + + + + The content purpose allows to specify the primary purpose of a text + input. + + This allows an input method to show special purpose input panels with + extra characters or to disallow some characters. + + + + + + + + + + + + + + + + + + Sets the content purpose and content hint. While the purpose is the + basic purpose of an input field, the hint flags allow to modify some + of the behavior. + + When no content type is explicitly set, a normal content purpose with + default hints (auto completion, auto correction, auto capitalization) + should be assumed. + + + + + + + + + + + + + Sets a specific language. This allows for example a virtual keyboard to + show a language specific layout. The "language" argument is a RFC-3066 + format language tag. + + It could be used for example in a word processor to indicate language of + currently edited document or in an instant message application which tracks + languages of contacts. + + + + + + + + + + + + + Notify the text-input object when it received focus. Typically in + response to an activate request. + + + + + + Notify the text-input object when it lost focus. Either in response + to a deactivate request or when the assigned surface lost focus or was + destroyed. + + + + + Transfer an array of 0-terminated modifiers names. The position in + the array is the index of the modifier as used in the modifiers + bitmask in the keysym event. + + + + + + Notify when the visibility state of the input panel changed. + + + + + + Notify when a new composing text (pre-edit) should be set around the + current cursor position. Any previously set composing text should + be removed. + + The commit text can be used to replace the preedit text on reset + (for example on unfocus). + + The text input should also handle all preedit_style and preedit_cursor + events occuring directly before preedit_string. + + + + + + + + + + + + + + + + + + Sets styling information on composing text. The style is applied for + length bytes from index relative to the beginning of the composing + text (as byte offset). Multiple styles can + be applied to a composing text by sending multiple preedit_styling + events. + + This event is handled as part of a following preedit_string event. + + + + + + + + Sets the cursor position inside the composing text (as byte + offset) relative to the start of the composing text. When index is a + negative number no cursor is shown. + + This event is handled as part of a following preedit_string event. + + + + + + Notify when text should be inserted into the editor widget. The text to + commit could be either just a single character after a key press or the + result of some composing (pre-edit). It could be also an empty text + when some text should be removed (see delete_surrounding_text) or when + the input cursor should be moved (see cursor_position). + + Any previously set composing text should be removed. + + + + + + + Notify when the cursor or anchor position should be modified. + + This event should be handled as part of a following commit_string + event. + + + + + + + Notify when the text around the current cursor position should be + deleted. + + Index is relative to the current cursor (in bytes). + Length is the length of deleted text (in bytes). + + This event should be handled as part of a following commit_string + event. + + + + + + + Notify when a key event was sent. Key events should not be used + for normal text input operations, which should be done with + commit_string, delete_surrounding_text, etc. The key event follows + the wl_keyboard key event convention. Sym is a XKB keysym, state a + wl_keyboard key_state. Modifiers are a mask for effective modifiers + (where the modifier indices are set by the modifiers_map event) + + + + + + + + + + Sets the language of the input text. The "language" argument is a RFC-3066 + format language tag. + + + + + + + + + + + + Sets the text direction of input text. + + It is mainly needed for showing input cursor on correct side of the + editor when there is no input yet done and making sure neutral + direction text is laid out properly. + + + + + + + + + A factory for text-input objects. This object is a global singleton. + + + + Creates a new text-input object. + + + + + From 003894ecc2bd0813092905e6d39f4c18b76308dc Mon Sep 17 00:00:00 2001 From: Jan Arne Petersen Date: Fri, 1 Nov 2013 11:17:18 +0100 Subject: [PATCH 0057/1507] Generate more useful methods for new_id requests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I3206bf7e0ffc99e9ec10d949f51ad043aca2548c Reviewed-by: Jørgen Lind --- src/tools/qtwaylandscanner/qtwaylandscanner.cpp | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp index fcd8ec8294e..5b5b76e53a5 100644 --- a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp +++ b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp @@ -260,8 +260,6 @@ void printEvent(const WaylandEvent &e, const char *interfaceName, bool omitNames printf("const struct ::wl_interface *%s, uint32_t%s", omitNames ? "" : "interface", omitNames ? "" : " version"); continue; } - - printf("struct ::%s *%s, ", interfaceName, omitNames ? "" : "object"); } } @@ -965,8 +963,7 @@ void process(QXmlStreamReader &xml) printEventHandlerSignature(e, interfaceName, false); printf("\n"); printf(" {\n"); - if (!newIdArgument(e.arguments)) - printf(" Q_UNUSED(object);\n"); + printf(" Q_UNUSED(object);\n"); printf(" static_cast<%s *>(data)->%s_%s(", interfaceName, interfaceNameStripped, e.name.constData()); for (int i = 0; i < e.arguments.size(); ++i) { printf("\n"); @@ -974,8 +971,6 @@ void process(QXmlStreamReader &xml) QByteArray cType = waylandToCType(a.type, a.interface); QByteArray qtType = waylandToQtType(a.type, a.interface, e.request); const char *argumentName = a.name.constData(); - if (a.type == "new_id") - printf(" object,\n"); if (a.type == "string") printf(" QString::fromUtf8(%s)", argumentName); else From 3908c0aa0d32364d9f4c3f0fddfa8c4d0521114e Mon Sep 17 00:00:00 2001 From: Andrew den Exter Date: Tue, 10 Dec 2013 13:41:32 +0200 Subject: [PATCH 0058/1507] QtCompositor: Allow key events to be delivered to unfocused windows Adds an overload to QWaylandInput::sendFullKeyEvent which allows specifying the surface to deliver the event to. This also extends the Qt keyboard extension to allow sending keys to specific windows. Change-Id: I1b7abdc4d8a30392ef2e7ee5e9af5b3036b23577 Reviewed-by: Laszlo Agocs --- src/3rdparty/wayland/extensions/qtkey-extension.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/3rdparty/wayland/extensions/qtkey-extension.xml b/src/3rdparty/wayland/extensions/qtkey-extension.xml index 1d0db59dfaf..711a2c28414 100644 --- a/src/3rdparty/wayland/extensions/qtkey-extension.xml +++ b/src/3rdparty/wayland/extensions/qtkey-extension.xml @@ -38,12 +38,13 @@ $QT_END_LICENSE$ - + Serialized QKeyEvent + From de783b953acd5ee7004cf236ed855d3dccb63916 Mon Sep 17 00:00:00 2001 From: Andrew den Exter Date: Tue, 10 Dec 2013 13:41:32 +0200 Subject: [PATCH 0059/1507] QtCompositor: Allow key events to be delivered to unfocused windows Adds an overload to QWaylandInput::sendFullKeyEvent which allows specifying the surface to deliver the event to. This also extends the Qt keyboard extension to allow sending keys to specific windows. Change-Id: I1b7abdc4d8a30392ef2e7ee5e9af5b3036b23577 Reviewed-by: Laszlo Agocs From abd018c8b2a5f23d0d82dd467d0495b97d3746ef Mon Sep 17 00:00:00 2001 From: Andrew Knight Date: Tue, 3 Dec 2013 18:30:56 +0200 Subject: [PATCH 0060/1507] QtCompositor: Make ExtensionFlags a QFlags This simplifies the creation and use of ExtensionFlags. Change-Id: Ia72bbc3f712759b231d8543a4f13ef2fdf6260f3 Reviewed-by: Jan Arne Petersen Reviewed-by: Laszlo Agocs From b89c7f238f147e1956b5d39c84a74908b20cf4be Mon Sep 17 00:00:00 2001 From: Jorgen Lind Date: Thu, 21 Nov 2013 08:16:08 +0100 Subject: [PATCH 0061/1507] Make it possible to install the generated headers Adding a header_path parameter. This will cause the scanner to generate header includes that look for corresponding files in that path. Also when we'r installing files, then c++ classes needs to be exported Change-Id: Ic539c0861143d7200b9cae85ca902a17ea0d0a8d Reviewed-by: Andy Nichols --- .../qtwaylandscanner/qtwaylandscanner.cpp | 61 ++++++++++++++++--- 1 file changed, 52 insertions(+), 9 deletions(-) diff --git a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp index 5b5b76e53a5..be4e6515033 100644 --- a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp +++ b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp @@ -327,7 +327,7 @@ bool ignoreInterface(const QByteArray &name) || (isServerSide() && name == "wl_registry"); } -void process(QXmlStreamReader &xml) +void process(QXmlStreamReader &xml, const QByteArray &headerPath) { if (!xml.readNextStartElement()) return; @@ -362,7 +362,10 @@ void process(QXmlStreamReader &xml) printf("#define %s\n", inclusionGuard.constData()); printf("\n"); printf("#include \"wayland-server.h\"\n"); - printf("#include \"wayland-%s-server-protocol.h\"\n", QByteArray(protocolName).replace('_', '-').constData()); + if (headerPath.isEmpty()) + printf("#include \"wayland-%s-server-protocol.h\"\n", QByteArray(protocolName).replace('_', '-').constData()); + else + printf("#include <%s/wayland-%s-server-protocol.h>\n", headerPath.constData(), QByteArray(protocolName).replace('_', '-').constData()); printf("#include \n"); printf("#include \n"); printf("#include \n"); @@ -377,6 +380,17 @@ void process(QXmlStreamReader &xml) printf("\n"); printf("QT_BEGIN_NAMESPACE\n"); + + if (headerPath.size()) { + printf("\n"); + printf("#if !defined(Q_WAYLAND_SERVER_%s_EXPORT)\n", protocolName.toUpper().constData()); + printf("# if defined(QT_SHARED)\n"); + printf("# define Q_WAYLAND_SERVER_%s_EXPORT Q_DECL_EXPORT\n", protocolName.toUpper().constData()); + printf("# else\n"); + printf("# define Q_WAYLAND_SERVER_%s_EXPORT\n", protocolName.toUpper().constData()); + printf("# endif\n"); + printf("#endif\n"); + } printf("\n"); printf("namespace QtWaylandServer {\n"); @@ -391,7 +405,10 @@ void process(QXmlStreamReader &xml) QByteArray stripped = stripInterfaceName(interface.name); const char *interfaceNameStripped = stripped.constData(); - printf(" class %s\n {\n", interfaceName); + if (headerPath.isEmpty()) + printf(" class %s\n {\n", interfaceName); + else + printf(" class Q_WAYLAND_SERVER_%s_EXPORT %s\n {\n",protocolName.toUpper().constData(), interfaceName); printf(" public:\n"); printf(" %s(struct ::wl_client *client, int id);\n", interfaceName); printf(" %s(struct ::wl_display *display);\n", interfaceName); @@ -501,7 +518,10 @@ void process(QXmlStreamReader &xml) } if (option == ServerCode) { - printf("#include \"qwayland-server-%s.h\"\n", QByteArray(protocolName).replace('_', '-').constData()); + if (headerPath.isEmpty()) + printf("#include \"qwayland-server-%s.h\"\n", QByteArray(protocolName).replace('_', '-').constData()); + else + printf("#include <%s/qwayland-server-%s.h>\n", headerPath.constData(), QByteArray(protocolName).replace('_', '-').constData()); printf("\n"); printf("QT_BEGIN_NAMESPACE\n"); printf("\n"); @@ -748,11 +768,25 @@ void process(QXmlStreamReader &xml) printf("#ifndef %s\n", inclusionGuard.constData()); printf("#define %s\n", inclusionGuard.constData()); printf("\n"); - printf("#include \"wayland-%s-client-protocol.h\"\n", QByteArray(protocolName).replace('_', '-').constData()); + if (headerPath.isEmpty()) + printf("#include \"wayland-%s-client-protocol.h\"\n", QByteArray(protocolName).replace('_', '-').constData()); + else + printf("#include <%s/wayland-%s-client-protocol.h>\n", headerPath.constData(), QByteArray(protocolName).replace('_', '-').constData()); printf("#include \n"); printf("#include \n"); printf("\n"); printf("QT_BEGIN_NAMESPACE\n"); + + if (headerPath.size()) { + printf("\n"); + printf("#if !defined(Q_WAYLAND_CLIENT_%s_EXPORT)\n", protocolName.toUpper().constData()); + printf("# if defined(QT_SHARED)\n"); + printf("# define Q_WAYLAND_CLIENT_%s_EXPORT Q_DECL_EXPORT\n", protocolName.toUpper().constData()); + printf("# else\n"); + printf("# define Q_WAYLAND_CLIENT_%s_EXPORT\n", protocolName.toUpper().constData()); + printf("# endif\n"); + printf("#endif\n"); + } printf("\n"); printf("namespace QtWayland {\n"); for (int j = 0; j < interfaces.size(); ++j) { @@ -766,7 +800,10 @@ void process(QXmlStreamReader &xml) QByteArray stripped = stripInterfaceName(interface.name); const char *interfaceNameStripped = stripped.constData(); - printf(" class %s\n {\n", interfaceName); + if (headerPath.isEmpty()) + printf(" class %s\n {\n", interfaceName); + else + printf(" class Q_WAYLAND_CLIENT_%s_EXPORT %s\n {\n",protocolName.toUpper().constData(), interfaceName); printf(" public:\n"); printf(" %s(struct ::wl_registry *registry, int id);\n", interfaceName); printf(" %s(struct ::%s *object);\n", interfaceName, interfaceName); @@ -833,7 +870,10 @@ void process(QXmlStreamReader &xml) } if (option == ClientCode) { - printf("#include \"qwayland-%s.h\"\n", QByteArray(protocolName).replace('_', '-').constData()); + if (headerPath.isEmpty()) + printf("#include \"qwayland-%s.h\"\n", QByteArray(protocolName).replace('_', '-').constData()); + else + printf("#include <%s/qwayland-%s.h>\n", headerPath.constData(), QByteArray(protocolName).replace('_', '-').constData()); printf("\n"); printf("QT_BEGIN_NAMESPACE\n"); printf("\n"); @@ -1010,12 +1050,15 @@ void process(QXmlStreamReader &xml) int main(int argc, char **argv) { if (argc <= 2 || !parseOption(argv[1], &option)) { - fprintf(stderr, "Usage: %s [client-header|server-header|client-code|server-code] specfile\n", argv[0]); + fprintf(stderr, "Usage: %s [client-header|server-header|client-code|server-code] specfile [header-path]\n", argv[0]); return 1; } QCoreApplication app(argc, argv); + QByteArray headerPath; + if (argc == 4) + headerPath = QByteArray(argv[3]); QFile file(argv[2]); if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { fprintf(stderr, "Unable to open file %s\n", argv[2]); @@ -1023,7 +1066,7 @@ int main(int argc, char **argv) } QXmlStreamReader xml(&file); - process(xml); + process(xml, headerPath); if (xml.hasError()) { fprintf(stderr, "XML error: %s\nLine %lld, column %lld\n", xml.errorString().toLocal8Bit().constData(), xml.lineNumber(), xml.columnNumber()); From 0984830c33deb5021c74e161ad994bd6e117dfa3 Mon Sep 17 00:00:00 2001 From: Jorgen Lind Date: Thu, 14 Nov 2013 13:22:13 +0100 Subject: [PATCH 0062/1507] Move wayland into a client directory not under the plugins src folder And make wayland common files into a library, exporting all classes. Now there is no need to do bulild hacks to make your own version of the wayland plugin. Change-Id: Ib4872863dfb5ab3f2bc0f4a94ae16fc1e7b63b88 Reviewed-by: Andy Nichols --- src/plugins/platforms/wayland/client.pro | 103 +++ .../platforms/wayland/qwaylandbuffer.h | 68 ++ .../platforms/wayland/qwaylandclientexport.h | 60 ++ .../platforms/wayland/qwaylandclipboard.cpp | 111 +++ .../platforms/wayland/qwaylandclipboard.h | 72 ++ .../platforms/wayland/qwaylandcursor.cpp | 302 +++++++ .../platforms/wayland/qwaylandcursor.h | 116 +++ .../platforms/wayland/qwaylanddatadevice.cpp | 242 ++++++ .../platforms/wayland/qwaylanddatadevice.h | 97 +++ .../wayland/qwaylanddatadevicemanager.cpp | 80 ++ .../wayland/qwaylanddatadevicemanager.h | 69 ++ .../platforms/wayland/qwaylanddataoffer.cpp | 139 +++ .../platforms/wayland/qwaylanddataoffer.h | 92 ++ .../platforms/wayland/qwaylanddatasource.cpp | 96 +++ .../platforms/wayland/qwaylanddatasource.h | 77 ++ .../platforms/wayland/qwaylanddecoration.cpp | 459 ++++++++++ .../platforms/wayland/qwaylanddecoration.h | 155 ++++ .../platforms/wayland/qwaylanddisplay.cpp | 272 ++++++ .../platforms/wayland/qwaylanddisplay.h | 193 +++++ src/plugins/platforms/wayland/qwaylanddnd.cpp | 136 +++ src/plugins/platforms/wayland/qwaylanddnd.h | 80 ++ .../platforms/wayland/qwaylandeventthread.cpp | 63 ++ .../platforms/wayland/qwaylandeventthread.h | 46 + .../wayland/qwaylandextendedoutput.cpp | 100 +++ .../wayland/qwaylandextendedoutput.h | 69 ++ .../wayland/qwaylandextendedsurface.cpp | 152 ++++ .../wayland/qwaylandextendedsurface.h | 85 ++ .../wayland/qwaylandglintegration.cpp | 56 ++ .../platforms/wayland/qwaylandglintegration.h | 76 ++ .../wayland/qwaylandinputcontext.cpp | 260 ++++++ .../platforms/wayland/qwaylandinputcontext.h | 103 +++ .../platforms/wayland/qwaylandinputdevice.cpp | 798 ++++++++++++++++++ .../platforms/wayland/qwaylandinputdevice.h | 204 +++++ .../platforms/wayland/qwaylandintegration.cpp | 252 ++++++ .../platforms/wayland/qwaylandintegration.h | 101 +++ .../wayland/qwaylandnativeinterface.cpp | 134 +++ .../wayland/qwaylandnativeinterface.h | 79 ++ .../platforms/wayland/qwaylandqtkey.cpp | 85 ++ src/plugins/platforms/wayland/qwaylandqtkey.h | 76 ++ .../platforms/wayland/qwaylandscreen.cpp | 184 ++++ .../platforms/wayland/qwaylandscreen.h | 110 +++ .../wayland/qwaylandshellsurface.cpp | 176 ++++ .../platforms/wayland/qwaylandshellsurface.h | 96 +++ .../wayland/qwaylandshmbackingstore.cpp | 322 +++++++ .../wayland/qwaylandshmbackingstore.h | 134 +++ .../platforms/wayland/qwaylandshmwindow.cpp | 73 ++ .../platforms/wayland/qwaylandshmwindow.h | 75 ++ .../platforms/wayland/qwaylandsubsurface.cpp | 91 ++ .../platforms/wayland/qwaylandsubsurface.h | 73 ++ .../platforms/wayland/qwaylandtouch.cpp | 209 +++++ src/plugins/platforms/wayland/qwaylandtouch.h | 97 +++ .../platforms/wayland/qwaylandwindow.cpp | 608 +++++++++++++ .../platforms/wayland/qwaylandwindow.h | 233 +++++ .../qwaylandwindowmanagerintegration.cpp | 159 ++++ .../qwaylandwindowmanagerintegration.h | 88 ++ 55 files changed, 8486 insertions(+) create mode 100644 src/plugins/platforms/wayland/client.pro create mode 100644 src/plugins/platforms/wayland/qwaylandbuffer.h create mode 100644 src/plugins/platforms/wayland/qwaylandclientexport.h create mode 100644 src/plugins/platforms/wayland/qwaylandclipboard.cpp create mode 100644 src/plugins/platforms/wayland/qwaylandclipboard.h create mode 100644 src/plugins/platforms/wayland/qwaylandcursor.cpp create mode 100644 src/plugins/platforms/wayland/qwaylandcursor.h create mode 100644 src/plugins/platforms/wayland/qwaylanddatadevice.cpp create mode 100644 src/plugins/platforms/wayland/qwaylanddatadevice.h create mode 100644 src/plugins/platforms/wayland/qwaylanddatadevicemanager.cpp create mode 100644 src/plugins/platforms/wayland/qwaylanddatadevicemanager.h create mode 100644 src/plugins/platforms/wayland/qwaylanddataoffer.cpp create mode 100644 src/plugins/platforms/wayland/qwaylanddataoffer.h create mode 100644 src/plugins/platforms/wayland/qwaylanddatasource.cpp create mode 100644 src/plugins/platforms/wayland/qwaylanddatasource.h create mode 100644 src/plugins/platforms/wayland/qwaylanddecoration.cpp create mode 100644 src/plugins/platforms/wayland/qwaylanddecoration.h create mode 100644 src/plugins/platforms/wayland/qwaylanddisplay.cpp create mode 100644 src/plugins/platforms/wayland/qwaylanddisplay.h create mode 100644 src/plugins/platforms/wayland/qwaylanddnd.cpp create mode 100644 src/plugins/platforms/wayland/qwaylanddnd.h create mode 100644 src/plugins/platforms/wayland/qwaylandeventthread.cpp create mode 100644 src/plugins/platforms/wayland/qwaylandeventthread.h create mode 100644 src/plugins/platforms/wayland/qwaylandextendedoutput.cpp create mode 100644 src/plugins/platforms/wayland/qwaylandextendedoutput.h create mode 100644 src/plugins/platforms/wayland/qwaylandextendedsurface.cpp create mode 100644 src/plugins/platforms/wayland/qwaylandextendedsurface.h create mode 100644 src/plugins/platforms/wayland/qwaylandglintegration.cpp create mode 100644 src/plugins/platforms/wayland/qwaylandglintegration.h create mode 100644 src/plugins/platforms/wayland/qwaylandinputcontext.cpp create mode 100644 src/plugins/platforms/wayland/qwaylandinputcontext.h create mode 100644 src/plugins/platforms/wayland/qwaylandinputdevice.cpp create mode 100644 src/plugins/platforms/wayland/qwaylandinputdevice.h create mode 100644 src/plugins/platforms/wayland/qwaylandintegration.cpp create mode 100644 src/plugins/platforms/wayland/qwaylandintegration.h create mode 100644 src/plugins/platforms/wayland/qwaylandnativeinterface.cpp create mode 100644 src/plugins/platforms/wayland/qwaylandnativeinterface.h create mode 100644 src/plugins/platforms/wayland/qwaylandqtkey.cpp create mode 100644 src/plugins/platforms/wayland/qwaylandqtkey.h create mode 100644 src/plugins/platforms/wayland/qwaylandscreen.cpp create mode 100644 src/plugins/platforms/wayland/qwaylandscreen.h create mode 100644 src/plugins/platforms/wayland/qwaylandshellsurface.cpp create mode 100644 src/plugins/platforms/wayland/qwaylandshellsurface.h create mode 100644 src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp create mode 100644 src/plugins/platforms/wayland/qwaylandshmbackingstore.h create mode 100644 src/plugins/platforms/wayland/qwaylandshmwindow.cpp create mode 100644 src/plugins/platforms/wayland/qwaylandshmwindow.h create mode 100644 src/plugins/platforms/wayland/qwaylandsubsurface.cpp create mode 100644 src/plugins/platforms/wayland/qwaylandsubsurface.h create mode 100644 src/plugins/platforms/wayland/qwaylandtouch.cpp create mode 100644 src/plugins/platforms/wayland/qwaylandtouch.h create mode 100644 src/plugins/platforms/wayland/qwaylandwindow.cpp create mode 100644 src/plugins/platforms/wayland/qwaylandwindow.h create mode 100644 src/plugins/platforms/wayland/qwaylandwindowmanagerintegration.cpp create mode 100644 src/plugins/platforms/wayland/qwaylandwindowmanagerintegration.h diff --git a/src/plugins/platforms/wayland/client.pro b/src/plugins/platforms/wayland/client.pro new file mode 100644 index 00000000000..66dc1a4754c --- /dev/null +++ b/src/plugins/platforms/wayland/client.pro @@ -0,0 +1,103 @@ +TARGET = QtWaylandClient +QT += core-private gui-private +QT_FOR_PRIVATE += platformsupport-private + +MODULE=waylandclient +load(qt_module) + +CONFIG += link_pkgconfig qpa/genericunixfontdatabase wayland-scanner + +!equals(QT_WAYLAND_GL_CONFIG, nogl) { + DEFINES += QT_WAYLAND_GL_SUPPORT +} + +config_xkbcommon { + !contains(QT_CONFIG, no-pkg-config) { + PKGCONFIG += xkbcommon + } else { + LIBS += -lxkbcommon + } +} else { + DEFINES += QT_NO_WAYLAND_XKB +} + +!contains(QT_CONFIG, no-pkg-config) { + PKGCONFIG += wayland-client wayland-cursor + contains(QT_CONFIG, glib): PKGCONFIG_PRIVATE += glib-2.0 +} else { + LIBS += -lwayland-client -lwayland-cursor $$QT_LIBS_GLIB +} + +INCLUDEPATH += $$PWD/../shared + +WAYLANDCLIENTSOURCES += \ + ../3rdparty/protocol/wayland.xml \ + ../extensions/surface-extension.xml \ + ../extensions/sub-surface-extension.xml \ + ../extensions/output-extension.xml \ + ../extensions/touch-extension.xml \ + ../extensions/qtkey-extension.xml \ + ../extensions/windowmanager.xml \ + ../3rdparty/protocol/text.xml \ + + +SOURCES += qwaylandintegration.cpp \ + qwaylandnativeinterface.cpp \ + qwaylandshmbackingstore.cpp \ + qwaylandinputdevice.cpp \ + qwaylandcursor.cpp \ + qwaylanddisplay.cpp \ + qwaylandwindow.cpp \ + qwaylandscreen.cpp \ + qwaylandshmwindow.cpp \ + qwaylandclipboard.cpp \ + qwaylanddnd.cpp \ + qwaylanddataoffer.cpp \ + qwaylanddatadevicemanager.cpp \ + qwaylanddatasource.cpp \ + qwaylandshellsurface.cpp \ + qwaylandextendedoutput.cpp \ + qwaylandextendedsurface.cpp \ + qwaylandsubsurface.cpp \ + qwaylandtouch.cpp \ + qwaylandqtkey.cpp \ + ../shared/qwaylandmimehelper.cpp \ + qwaylanddecoration.cpp \ + qwaylandeventthread.cpp\ + qwaylandwindowmanagerintegration.cpp \ + qwaylandinputcontext.cpp \ + qwaylanddatadevice.cpp \ + +HEADERS += qwaylandintegration.h \ + qwaylandnativeinterface.h \ + qwaylandcursor.h \ + qwaylanddisplay.h \ + qwaylandwindow.h \ + qwaylandscreen.h \ + qwaylandshmbackingstore.h \ + qwaylandinputdevice.h \ + qwaylandbuffer.h \ + qwaylandshmwindow.h \ + qwaylandclipboard.h \ + qwaylanddnd.h \ + qwaylanddataoffer.h \ + qwaylanddatadevicemanager.h \ + qwaylanddatasource.h \ + qwaylandshellsurface.h \ + qwaylandextendedoutput.h \ + qwaylandextendedsurface.h \ + qwaylandsubsurface.h \ + qwaylandtouch.h \ + qwaylandqtkey.h \ + ../shared/qwaylandmimehelper.h \ + qwaylanddecoration.h \ + qwaylandeventthread.h \ + qwaylandwindowmanagerintegration.h \ + qwaylandinputcontext.h \ + qwaylanddatadevice.h \ + +contains(DEFINES, QT_WAYLAND_GL_SUPPORT) { + SOURCES += qwaylandglintegration.cpp + HEADERS += qwaylandglintegration.h +} + diff --git a/src/plugins/platforms/wayland/qwaylandbuffer.h b/src/plugins/platforms/wayland/qwaylandbuffer.h new file mode 100644 index 00000000000..8d9ceaa8abc --- /dev/null +++ b/src/plugins/platforms/wayland/qwaylandbuffer.h @@ -0,0 +1,68 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWAYLANDBUFFER_H +#define QWAYLANDBUFFER_H + +#include "qwaylandclientexport.h" + +#include +#include + +#include +#include + +QT_BEGIN_NAMESPACE + +class Q_WAYLAND_CLIENT_EXPORT QWaylandBuffer { +public: + QWaylandBuffer() { } + virtual ~QWaylandBuffer() { } + wl_buffer *buffer() {return mBuffer;} + virtual QSize size() const = 0; + +protected: + struct wl_buffer *mBuffer; +}; + +QT_END_NAMESPACE + +#endif // QWAYLANDBUFFER_H diff --git a/src/plugins/platforms/wayland/qwaylandclientexport.h b/src/plugins/platforms/wayland/qwaylandclientexport.h new file mode 100644 index 00000000000..d9d6d7f7cd9 --- /dev/null +++ b/src/plugins/platforms/wayland/qwaylandclientexport.h @@ -0,0 +1,60 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWAYLANDCLIENTEXPORT_H +#define QWAYLANDCLIENTEXPORT_H + +#include + +QT_BEGIN_NAMESPACE + +#if !defined(Q_WAYLAND_CLIENT_EXPORT) +# if defined(QT_SHARED) +# define Q_WAYLAND_CLIENT_EXPORT Q_DECL_EXPORT +# else +# define Q_WAYLAND_CLIENT_EXPORT +# endif +#endif + +QT_END_NAMESPACE + +#endif //QWAYLANDCLIENTEXPORT_H + diff --git a/src/plugins/platforms/wayland/qwaylandclipboard.cpp b/src/plugins/platforms/wayland/qwaylandclipboard.cpp new file mode 100644 index 00000000000..838f6d23195 --- /dev/null +++ b/src/plugins/platforms/wayland/qwaylandclipboard.cpp @@ -0,0 +1,111 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qwaylandclipboard.h" +#include "qwaylanddisplay.h" +#include "qwaylandinputdevice.h" +#include "qwaylanddataoffer.h" +#include "qwaylanddatasource.h" +#include "qwaylanddatadevice.h" + +QT_BEGIN_NAMESPACE + +QWaylandClipboard::QWaylandClipboard(QWaylandDisplay *display) + : mDisplay(display) +{ +} + +QWaylandClipboard::~QWaylandClipboard() +{ +} + +QMimeData *QWaylandClipboard::mimeData(QClipboard::Mode mode) +{ + if (mode != QClipboard::Clipboard) + return 0; + + QWaylandInputDevice *inputDevice = mDisplay->currentInputDevice(); + if (!inputDevice || !inputDevice->dataDevice()) + return 0; + + QWaylandDataSource *source = inputDevice->dataDevice()->selectionSource(); + if (source) { + return source->mimeData(); + } + + if (inputDevice->dataDevice()->selectionOffer()) + return inputDevice->dataDevice()->selectionOffer()->mimeData(); + + return 0; +} + +void QWaylandClipboard::setMimeData(QMimeData *data, QClipboard::Mode mode) +{ + if (mode != QClipboard::Clipboard) + return; + + QWaylandInputDevice *inputDevice = mDisplay->currentInputDevice(); + if (!inputDevice || !inputDevice->dataDevice()) + return; + + inputDevice->dataDevice()->setSelectionSource(data ? new QWaylandDataSource(mDisplay->dndSelectionHandler(), data) : 0); + + emitChanged(mode); +} + +bool QWaylandClipboard::supportsMode(QClipboard::Mode mode) const +{ + return mode == QClipboard::Clipboard; +} + +bool QWaylandClipboard::ownsMode(QClipboard::Mode mode) const +{ + if (mode != QClipboard::Clipboard) + return false; + + QWaylandInputDevice *inputDevice = mDisplay->currentInputDevice(); + if (!inputDevice || !inputDevice->dataDevice()) + return false; + + return inputDevice->dataDevice()->selectionSource() != 0; +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandclipboard.h b/src/plugins/platforms/wayland/qwaylandclipboard.h new file mode 100644 index 00000000000..692a31255b2 --- /dev/null +++ b/src/plugins/platforms/wayland/qwaylandclipboard.h @@ -0,0 +1,72 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWAYLANDCLIPBOARD_H +#define QWAYLANDCLIPBOARD_H + +#include +#include + +#include + +QT_BEGIN_NAMESPACE + +class QWaylandDisplay; + +class Q_WAYLAND_CLIENT_EXPORT QWaylandClipboard : public QPlatformClipboard +{ +public: + QWaylandClipboard(QWaylandDisplay *display); + + ~QWaylandClipboard(); + + QMimeData *mimeData(QClipboard::Mode mode = QClipboard::Clipboard) Q_DECL_OVERRIDE; + void setMimeData(QMimeData *data, QClipboard::Mode mode = QClipboard::Clipboard) Q_DECL_OVERRIDE; + bool supportsMode(QClipboard::Mode mode) const Q_DECL_OVERRIDE; + bool ownsMode(QClipboard::Mode mode) const Q_DECL_OVERRIDE; + +private: + QWaylandDisplay *mDisplay; +}; + +QT_END_NAMESPACE + +#endif // QWAYLANDCLIPBOARD_H diff --git a/src/plugins/platforms/wayland/qwaylandcursor.cpp b/src/plugins/platforms/wayland/qwaylandcursor.cpp new file mode 100644 index 00000000000..05ab6d496a8 --- /dev/null +++ b/src/plugins/platforms/wayland/qwaylandcursor.cpp @@ -0,0 +1,302 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qwaylandcursor.h" + +#include "qwaylanddisplay.h" +#include "qwaylandinputdevice.h" +#include "qwaylandscreen.h" +#include "qwaylandshmbackingstore.h" + +#include +#include + +#include + +QT_BEGIN_NAMESPACE + +QWaylandCursor::QWaylandCursor(QWaylandScreen *screen) + : mDisplay(screen->display()) +{ + //TODO: Make wl_cursor_theme_load arguments configurable here + QByteArray cursorTheme = qgetenv("XCURSOR_THEME"); + if (cursorTheme.isEmpty()) + cursorTheme = QByteArray("default"); + QByteArray cursorSizeFromEnv = qgetenv("XCURSOR_SIZE"); + bool hasCursorSize = false; + int cursorSize = cursorSizeFromEnv.toInt(&hasCursorSize); + if (!hasCursorSize || cursorSize <= 0) + cursorSize = 32; + mCursorTheme = wl_cursor_theme_load(cursorTheme, cursorSize, mDisplay->shm()); + initCursorMap(); +} + +QWaylandCursor::~QWaylandCursor() +{ + wl_cursor_theme_destroy(mCursorTheme); +} + +struct wl_cursor_image *QWaylandCursor::cursorImage(Qt::CursorShape newShape) +{ + struct wl_cursor *waylandCursor = 0; + + /* Hide cursor */ + if (newShape == Qt::BlankCursor) + { + mDisplay->setCursor(NULL, NULL); + return NULL; + } + + if (newShape < Qt::BitmapCursor) { + waylandCursor = requestCursor((WaylandCursor)newShape); + } else if (newShape == Qt::BitmapCursor) { + //TODO: Bitmap cursor logic + } else { + //TODO: Custom cursor logic (for resize arrows) + } + + if (!waylandCursor) { + qDebug("Could not find cursor for shape %d", newShape); + return NULL; + } + + struct wl_cursor_image *image = waylandCursor->images[0]; + struct wl_buffer *buffer = wl_cursor_image_get_buffer(image); + if (!buffer) { + qDebug("Could not find buffer for cursor"); + return NULL; + } + + return image; +} + +void QWaylandCursor::changeCursor(QCursor *cursor, QWindow *window) +{ + Q_UNUSED(window) + + const Qt::CursorShape newShape = cursor ? cursor->shape() : Qt::ArrowCursor; + + struct wl_cursor_image *image = cursorImage(newShape); + if (!image) { + return; + } + + struct wl_buffer *buffer = wl_cursor_image_get_buffer(image); + mDisplay->setCursor(buffer, image); +} + +void QWaylandDisplay::setCursor(struct wl_buffer *buffer, struct wl_cursor_image *image) +{ + /* Qt doesn't tell us which input device we should set the cursor + * for, so set it for all devices. */ + for (int i = 0; i < mInputDevices.count(); i++) { + QWaylandInputDevice *inputDevice = mInputDevices.at(i); + inputDevice->setCursor(buffer, image); + } +} + +QWaylandInputDevice *QWaylandDisplay::defaultInputDevice() const +{ + return mInputDevices.isEmpty() ? 0 : mInputDevices.first(); +} + +void QWaylandCursor::pointerEvent(const QMouseEvent &event) +{ + mLastPos = event.globalPos(); +} + +QPoint QWaylandCursor::pos() const +{ + return mLastPos; +} + +void QWaylandCursor::setPos(const QPoint &pos) +{ + Q_UNUSED(pos); + qWarning() << "QWaylandCursor::setPos: not implemented"; +} + +wl_cursor *QWaylandCursor::requestCursor(WaylandCursor shape) +{ + struct wl_cursor *cursor = mCursors.value(shape, 0); + + //If the cursor has not been loaded already, load it + if (!cursor) { + QList cursorNames = mCursorNamesMap.values(shape); + foreach (QByteArray name, cursorNames) { + cursor = wl_cursor_theme_get_cursor(mCursorTheme, name.constData()); + if (cursor) { + mCursors.insert(shape, cursor); + break; + } + } + } + + //If there still no cursor for a shape, use the default cursor + if (!cursor && shape != ArrowCursor) { + cursor = requestCursor(ArrowCursor); + } + + return cursor; +} + + +void QWaylandCursor::initCursorMap() +{ + //Fill the cursor name map will the table of xcursor names + mCursorNamesMap.insert(ArrowCursor, "left_ptr"); + mCursorNamesMap.insert(ArrowCursor, "default"); + mCursorNamesMap.insert(ArrowCursor, "top_left_arrow"); + mCursorNamesMap.insert(ArrowCursor, "left_arrow"); + + mCursorNamesMap.insert(UpArrowCursor, "up_arrow"); + + mCursorNamesMap.insert(CrossCursor, "cross"); + + mCursorNamesMap.insert(WaitCursor, "wait"); + mCursorNamesMap.insert(WaitCursor, "watch"); + mCursorNamesMap.insert(WaitCursor, "0426c94ea35c87780ff01dc239897213"); + + mCursorNamesMap.insert(IBeamCursor, "ibeam"); + mCursorNamesMap.insert(IBeamCursor, "text"); + mCursorNamesMap.insert(IBeamCursor, "xterm"); + + mCursorNamesMap.insert(SizeVerCursor, "size_ver"); + mCursorNamesMap.insert(SizeVerCursor, "ns-resize"); + mCursorNamesMap.insert(SizeVerCursor, "v_double_arrow"); + mCursorNamesMap.insert(SizeVerCursor, "00008160000006810000408080010102"); + + mCursorNamesMap.insert(SizeHorCursor, "size_hor"); + mCursorNamesMap.insert(SizeHorCursor, "ew-resize"); + mCursorNamesMap.insert(SizeHorCursor, "h_double_arrow"); + mCursorNamesMap.insert(SizeHorCursor, "028006030e0e7ebffc7f7070c0600140"); + + mCursorNamesMap.insert(SizeBDiagCursor, "size_bdiag"); + mCursorNamesMap.insert(SizeBDiagCursor, "nesw-resize"); + mCursorNamesMap.insert(SizeBDiagCursor, "50585d75b494802d0151028115016902"); + mCursorNamesMap.insert(SizeBDiagCursor, "fcf1c3c7cd4491d801f1e1c78f100000"); + + mCursorNamesMap.insert(SizeFDiagCursor, "size_fdiag"); + mCursorNamesMap.insert(SizeFDiagCursor, "nwse-resize"); + mCursorNamesMap.insert(SizeFDiagCursor, "38c5dff7c7b8962045400281044508d2"); + mCursorNamesMap.insert(SizeFDiagCursor, "c7088f0f3e6c8088236ef8e1e3e70000"); + + mCursorNamesMap.insert(SizeAllCursor, "size_all"); + + mCursorNamesMap.insert(SplitVCursor, "split_v"); + mCursorNamesMap.insert(SplitVCursor, "row-resize"); + mCursorNamesMap.insert(SplitVCursor, "sb_v_double_arrow"); + mCursorNamesMap.insert(SplitVCursor, "2870a09082c103050810ffdffffe0204"); + mCursorNamesMap.insert(SplitVCursor, "c07385c7190e701020ff7ffffd08103c"); + + mCursorNamesMap.insert(SplitHCursor, "split_h"); + mCursorNamesMap.insert(SplitHCursor, "col-resize"); + mCursorNamesMap.insert(SplitHCursor, "sb_h_double_arrow"); + mCursorNamesMap.insert(SplitHCursor, "043a9f68147c53184671403ffa811cc5"); + mCursorNamesMap.insert(SplitHCursor, "14fef782d02440884392942c11205230"); + + mCursorNamesMap.insert(PointingHandCursor, "pointing_hand"); + mCursorNamesMap.insert(PointingHandCursor, "pointer"); + mCursorNamesMap.insert(PointingHandCursor, "hand1"); + mCursorNamesMap.insert(PointingHandCursor, "e29285e634086352946a0e7090d73106"); + + mCursorNamesMap.insert(ForbiddenCursor, "forbidden"); + mCursorNamesMap.insert(ForbiddenCursor, "not-allowed"); + mCursorNamesMap.insert(ForbiddenCursor, "crossed_circle"); + mCursorNamesMap.insert(ForbiddenCursor, "circle"); + mCursorNamesMap.insert(ForbiddenCursor, "03b6e0fcb3499374a867c041f52298f0"); + + mCursorNamesMap.insert(WhatsThisCursor, "whats_this"); + mCursorNamesMap.insert(WhatsThisCursor, "help"); + mCursorNamesMap.insert(WhatsThisCursor, "question_arrow"); + mCursorNamesMap.insert(WhatsThisCursor, "5c6cd98b3f3ebcb1f9c7f1c204630408"); + mCursorNamesMap.insert(WhatsThisCursor, "d9ce0ab605698f320427677b458ad60b"); + + mCursorNamesMap.insert(BusyCursor, "left_ptr_watch"); + mCursorNamesMap.insert(BusyCursor, "half-busy"); + mCursorNamesMap.insert(BusyCursor, "progress"); + mCursorNamesMap.insert(BusyCursor, "00000000000000020006000e7e9ffc3f"); + mCursorNamesMap.insert(BusyCursor, "08e8e1c95fe2fc01f976f1e063a24ccd"); + + mCursorNamesMap.insert(OpenHandCursor, "openhand"); + mCursorNamesMap.insert(OpenHandCursor, "fleur"); + mCursorNamesMap.insert(OpenHandCursor, "5aca4d189052212118709018842178c0"); + mCursorNamesMap.insert(OpenHandCursor, "9d800788f1b08800ae810202380a0822"); + + mCursorNamesMap.insert(ClosedHandCursor, "closedhand"); + mCursorNamesMap.insert(ClosedHandCursor, "grabbing"); + mCursorNamesMap.insert(ClosedHandCursor, "208530c400c041818281048008011002"); + + mCursorNamesMap.insert(DragCopyCursor, "dnd-copy"); + mCursorNamesMap.insert(DragCopyCursor, "copy"); + + mCursorNamesMap.insert(DragMoveCursor, "dnd-move"); + mCursorNamesMap.insert(DragMoveCursor, "move"); + + mCursorNamesMap.insert(DragLinkCursor, "dnd-link"); + mCursorNamesMap.insert(DragLinkCursor, "link"); + + mCursorNamesMap.insert(ResizeNorthCursor, "n-resize"); + mCursorNamesMap.insert(ResizeNorthCursor, "top_side"); + + mCursorNamesMap.insert(ResizeSouthCursor, "s-resize"); + mCursorNamesMap.insert(ResizeSouthCursor, "bottom_side"); + + mCursorNamesMap.insert(ResizeEastCursor, "e-resize"); + mCursorNamesMap.insert(ResizeEastCursor, "right_side"); + + mCursorNamesMap.insert(ResizeWestCursor, "w-resize"); + mCursorNamesMap.insert(ResizeWestCursor, "left_side"); + + mCursorNamesMap.insert(ResizeNorthWestCursor, "nw-resize"); + mCursorNamesMap.insert(ResizeNorthWestCursor, "top_left_corner"); + + mCursorNamesMap.insert(ResizeSouthEastCursor, "se-resize"); + mCursorNamesMap.insert(ResizeSouthEastCursor, "bottom_right_corner"); + + mCursorNamesMap.insert(ResizeNorthEastCursor, "ne-resize"); + mCursorNamesMap.insert(ResizeNorthEastCursor, "top_right_corner"); + + mCursorNamesMap.insert(ResizeSouthWestCursor, "sw-resize"); + mCursorNamesMap.insert(ResizeSouthWestCursor, "bottom_left_corner"); +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandcursor.h b/src/plugins/platforms/wayland/qwaylandcursor.h new file mode 100644 index 00000000000..894d322a616 --- /dev/null +++ b/src/plugins/platforms/wayland/qwaylandcursor.h @@ -0,0 +1,116 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWAYLANDCURSOR_H +#define QWAYLANDCURSOR_H + +#include +#include +#include + +struct wl_cursor; +struct wl_cursor_image; +struct wl_cursor_theme; + +QT_BEGIN_NAMESPACE + +class QWaylandDisplay; +class QWaylandScreen; + +class Q_WAYLAND_CLIENT_EXPORT QWaylandCursor : public QPlatformCursor +{ +public: + QWaylandCursor(QWaylandScreen *screen); + ~QWaylandCursor(); + + void changeCursor(QCursor *cursor, QWindow *window); + void pointerEvent(const QMouseEvent &event); + QPoint pos() const; + void setPos(const QPoint &pos); + + struct wl_cursor_image *cursorImage(Qt::CursorShape shape); + +private: + enum WaylandCursor { + ArrowCursor = Qt::ArrowCursor, + UpArrowCursor, + CrossCursor, + WaitCursor, + IBeamCursor, + SizeVerCursor, + SizeHorCursor, + SizeBDiagCursor, + SizeFDiagCursor, + SizeAllCursor, + BlankCursor, + SplitVCursor, + SplitHCursor, + PointingHandCursor, + ForbiddenCursor, + WhatsThisCursor, + BusyCursor, + OpenHandCursor, + ClosedHandCursor, + DragCopyCursor, + DragMoveCursor, + DragLinkCursor, + ResizeNorthCursor = Qt::CustomCursor + 1, + ResizeSouthCursor, + ResizeEastCursor, + ResizeWestCursor, + ResizeNorthWestCursor, + ResizeSouthEastCursor, + ResizeNorthEastCursor, + ResizeSouthWestCursor + }; + + struct wl_cursor* requestCursor(WaylandCursor shape); + void initCursorMap(); + QWaylandDisplay *mDisplay; + struct wl_cursor_theme *mCursorTheme; + QPoint mLastPos; + QMap mCursors; + QMultiMap mCursorNamesMap; +}; + +QT_END_NAMESPACE + +#endif // QWAYLANDCURSOR_H diff --git a/src/plugins/platforms/wayland/qwaylanddatadevice.cpp b/src/plugins/platforms/wayland/qwaylanddatadevice.cpp new file mode 100644 index 00000000000..2a70a338c81 --- /dev/null +++ b/src/plugins/platforms/wayland/qwaylanddatadevice.cpp @@ -0,0 +1,242 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Klarälvdalens Datakonsult AB (KDAB). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Compositor. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qwaylanddatadevice.h" + +#include "qwaylanddatadevicemanager.h" +#include "qwaylanddataoffer.h" +#include "qwaylanddatasource.h" +#include "qwaylanddnd.h" +#include "qwaylandinputdevice.h" + +#include +#include +#include + +#include +#include +#include + +#include + +QWaylandDataDevice::QWaylandDataDevice(QWaylandDataDeviceManager *manager, QWaylandInputDevice *inputDevice) + : QtWayland::wl_data_device(manager->get_data_device(inputDevice->wl_seat())) + , m_display(manager->display()) + , m_enterSerial(0) + , m_dragWindow(0) + , m_dragPoint() + , m_dragOffer() + , m_selectionOffer() +{ +} + +QWaylandDataDevice::~QWaylandDataDevice() +{ +} + +QWaylandDataOffer *QWaylandDataDevice::selectionOffer() const +{ + return m_selectionOffer.data(); +} + +QWaylandDataSource *QWaylandDataDevice::selectionSource() const +{ + return m_selectionSource.data(); +} + +void QWaylandDataDevice::setSelectionSource(QWaylandDataSource *source) +{ + m_selectionSource.reset(source); + set_selection(source ? source->object() : 0, 0 /* TODO m_display->serial() */); +} + +QWaylandDataOffer *QWaylandDataDevice::dragOffer() const +{ + return m_dragOffer.data(); +} + +void QWaylandDataDevice::startDrag(QMimeData *mimeData, QWaylandWindow *icon) +{ + m_dragSource.reset(new QWaylandDataSource(m_display->dndSelectionHandler(), mimeData)); + + QWaylandWindow *origin = m_display->currentInputDevice()->pointerFocus(); + + start_drag(m_dragSource->object(), origin->object(), icon->object(), m_display->currentInputDevice()->serial()); +} + +void QWaylandDataDevice::cancelDrag() +{ + m_dragSource.reset(); +} + +void QWaylandDataDevice::data_device_data_offer(struct ::wl_data_offer *id) +{ + QWaylandDataOffer *offer = new QWaylandDataOffer(m_display, id); +} + +void QWaylandDataDevice::data_device_drop() +{ + QDrag *drag = static_cast(QGuiApplicationPrivate::platformIntegration()->drag())->currentDrag(); + + qDebug() << Q_FUNC_INFO << drag << m_dragOffer.data(); + + QMimeData *dragData; + Qt::DropActions supportedActions; + if (drag) { + dragData = drag->mimeData(); + supportedActions = drag->supportedActions(); + } else if (m_dragOffer) { + dragData = m_dragOffer->mimeData(); + supportedActions = Qt::CopyAction | Qt::MoveAction | Qt::LinkAction; + } else { + return; + } + + QPlatformDropQtResponse response = QWindowSystemInterface::handleDrop(m_dragWindow, dragData, m_dragPoint, supportedActions); + + if (drag) { + static_cast(QGuiApplicationPrivate::platformIntegration()->drag())->finishDrag(response); + } +} + +void QWaylandDataDevice::data_device_enter(uint32_t serial, wl_surface *surface, wl_fixed_t x, wl_fixed_t y, wl_data_offer *id) +{ + m_enterSerial = serial; + m_dragWindow = QWaylandWindow::fromWlSurface(surface)->window(); + m_dragPoint = QPoint(wl_fixed_to_int(x), wl_fixed_to_int(y)); + + QDrag *drag = static_cast(QGuiApplicationPrivate::platformIntegration()->drag())->currentDrag(); + + QMimeData *dragData; + Qt::DropActions supportedActions; + if (drag) { + dragData = drag->mimeData(); + supportedActions = drag->supportedActions(); + } else { + m_dragOffer.reset(static_cast(wl_data_offer_get_user_data(id))); + if (m_dragOffer) { + dragData = m_dragOffer->mimeData(); + supportedActions = Qt::CopyAction | Qt::MoveAction | Qt::LinkAction; + } + } + + const QPlatformDragQtResponse &response = QWindowSystemInterface::handleDrag(m_dragWindow, dragData, m_dragPoint, supportedActions); + + if (drag) { + static_cast(QGuiApplicationPrivate::platformIntegration()->drag())->setResponse(response); + } else { + if (response.isAccepted()) { + wl_data_offer_accept(m_dragOffer->object(), m_enterSerial, m_dragOffer->firstFormat().toUtf8().constData()); + } else { + wl_data_offer_accept(m_dragOffer->object(), m_enterSerial, 0); + } + } +} + +void QWaylandDataDevice::data_device_leave() +{ + QWindowSystemInterface::handleDrag(m_dragWindow, 0, QPoint(), Qt::IgnoreAction); + + QDrag *drag = static_cast(QGuiApplicationPrivate::platformIntegration()->drag())->currentDrag(); + if (!drag) { + m_dragOffer.reset(); + } +} + +void QWaylandDataDevice::data_device_motion(uint32_t time, wl_fixed_t x, wl_fixed_t y) +{ + Q_UNUSED(time); + + QDrag *drag = static_cast(QGuiApplicationPrivate::platformIntegration()->drag())->currentDrag(); + + if (!drag && !m_dragOffer) + return; + + m_dragPoint = QPoint(wl_fixed_to_int(x), wl_fixed_to_int(y)); + + QMimeData *dragData; + Qt::DropActions supportedActions; + if (drag) { + dragData = drag->mimeData(); + supportedActions = drag->supportedActions(); + } else { + dragData = m_dragOffer->mimeData(); + supportedActions = Qt::CopyAction | Qt::MoveAction | Qt::LinkAction; + } + + QPlatformDragQtResponse response = QWindowSystemInterface::handleDrag(m_dragWindow, dragData, m_dragPoint, supportedActions); + + if (drag) { + static_cast(QGuiApplicationPrivate::platformIntegration()->drag())->setResponse(response); + } else { + if (response.isAccepted()) { + wl_data_offer_accept(m_dragOffer->object(), m_enterSerial, m_dragOffer->firstFormat().toUtf8().constData()); + } else { + wl_data_offer_accept(m_dragOffer->object(), m_enterSerial, 0); + } + } +} + +void QWaylandDataDevice::data_device_selection(wl_data_offer *id) +{ + if (id) + m_selectionOffer.reset(static_cast(wl_data_offer_get_user_data(id))); + else + m_selectionOffer.reset(); + + QGuiApplicationPrivate::platformIntegration()->clipboard()->emitChanged(QClipboard::Clipboard); +} + +void QWaylandDataDevice::selectionSourceCancelled() +{ + m_selectionSource.reset(); + QGuiApplicationPrivate::platformIntegration()->clipboard()->emitChanged(QClipboard::Clipboard); +} + +void QWaylandDataDevice::dragSourceCancelled() +{ + m_dragSource.reset(); + +} + +void QWaylandDataDevice::dragSourceTargetChanged(const QString &mimeType) +{ + static_cast(QGuiApplicationPrivate::platformIntegration()->drag())->updateTarget(mimeType); +} diff --git a/src/plugins/platforms/wayland/qwaylanddatadevice.h b/src/plugins/platforms/wayland/qwaylanddatadevice.h new file mode 100644 index 00000000000..e258d87766e --- /dev/null +++ b/src/plugins/platforms/wayland/qwaylanddatadevice.h @@ -0,0 +1,97 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Klarälvdalens Datakonsult AB (KDAB). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Compositor. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWAYLANDDATADEVICE_H +#define QWAYLANDDATADEVICE_H + +#include "qwaylanddisplay.h" + +QT_BEGIN_NAMESPACE + +class QMimeData; +class QWaylandDataDeviceManager; +class QWaylandDataOffer; +class QWaylandDataSource; +class QWindow; + +class QWaylandDataDevice : public QObject, public QtWayland::wl_data_device +{ + Q_OBJECT +public: + QWaylandDataDevice(QWaylandDataDeviceManager *manager, QWaylandInputDevice *inputDevice); + ~QWaylandDataDevice(); + + QWaylandDataOffer *selectionOffer() const; + QWaylandDataSource *selectionSource() const; + void setSelectionSource(QWaylandDataSource *source); + + QWaylandDataOffer *dragOffer() const; + void startDrag(QMimeData *mimeData, QWaylandWindow *icon); + void cancelDrag(); + +protected: + void data_device_data_offer(struct ::wl_data_offer *id) Q_DECL_OVERRIDE; + void data_device_drop() Q_DECL_OVERRIDE; + void data_device_enter(uint32_t serial, struct ::wl_surface *surface, wl_fixed_t x, wl_fixed_t y, struct ::wl_data_offer *id) Q_DECL_OVERRIDE; + void data_device_leave() Q_DECL_OVERRIDE; + void data_device_motion(uint32_t time, wl_fixed_t x, wl_fixed_t y) Q_DECL_OVERRIDE; + void data_device_selection(struct ::wl_data_offer *id) Q_DECL_OVERRIDE; + +private Q_SLOTS: + void selectionSourceCancelled(); + void dragSourceCancelled(); + void dragSourceTargetChanged(const QString &mimeType); + +private: + QWaylandDisplay *m_display; + + uint32_t m_enterSerial; + QWindow *m_dragWindow; + QPoint m_dragPoint; + QScopedPointer m_dragOffer; + QScopedPointer m_selectionOffer; + QScopedPointer m_selectionSource; + + QScopedPointer m_dragSource; +}; + +QT_END_NAMESPACE + +#endif // QWAYLANDDATADEVICE_H diff --git a/src/plugins/platforms/wayland/qwaylanddatadevicemanager.cpp b/src/plugins/platforms/wayland/qwaylanddatadevicemanager.cpp new file mode 100644 index 00000000000..4a96dbce3da --- /dev/null +++ b/src/plugins/platforms/wayland/qwaylanddatadevicemanager.cpp @@ -0,0 +1,80 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qwaylanddatadevicemanager.h" + +#include "qwaylandinputdevice.h" +#include "qwaylanddatadevice.h" +#include "qwaylanddataoffer.h" + +#include + +QT_BEGIN_NAMESPACE + +QWaylandDataDeviceManager::QWaylandDataDeviceManager(QWaylandDisplay *display, uint32_t id) + : wl_data_device_manager(display->wl_registry(), id) + , m_display(display) +{ + // Create transfer devices for all input devices. + // ### This only works if we get the global before all devices and is surely wrong when hotplugging. + QList inputDevices = m_display->inputDevices(); + for (int i = 0; i < inputDevices.size();i++) { + inputDevices.at(i)->setDataDevice(getDataDevice(inputDevices.at(i))); + } +} + +QWaylandDataDeviceManager::~QWaylandDataDeviceManager() +{ + wl_data_device_manager_destroy(object()); +} + +QWaylandDataDevice *QWaylandDataDeviceManager::getDataDevice(QWaylandInputDevice *inputDevice) +{ + return new QWaylandDataDevice(this, inputDevice); +} + +QWaylandDisplay *QWaylandDataDeviceManager::display() const +{ + return m_display; +} + + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylanddatadevicemanager.h b/src/plugins/platforms/wayland/qwaylanddatadevicemanager.h new file mode 100644 index 00000000000..6b3ad177cce --- /dev/null +++ b/src/plugins/platforms/wayland/qwaylanddatadevicemanager.h @@ -0,0 +1,69 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWAYLANDDATADEVICEMANAGER_H +#define QWAYLANDDATADEVICEMANAGER_H + +#include "qwaylanddisplay.h" + +QT_BEGIN_NAMESPACE + +class QWaylandDataDevice; +class QWaylandDataSource; + +class Q_WAYLAND_CLIENT_EXPORT QWaylandDataDeviceManager : public QtWayland::wl_data_device_manager +{ +public: + QWaylandDataDeviceManager(QWaylandDisplay *display, uint32_t id); + ~QWaylandDataDeviceManager(); + + QWaylandDataDevice *getDataDevice(QWaylandInputDevice *inputDevice); + + QWaylandDisplay *display() const; + +private: + struct wl_data_device_manager *m_data_device_manager; + QWaylandDisplay *m_display; +}; + +QT_END_NAMESPACE + +#endif // QWAYLANDDATADEVICEMANAGER_H diff --git a/src/plugins/platforms/wayland/qwaylanddataoffer.cpp b/src/plugins/platforms/wayland/qwaylanddataoffer.cpp new file mode 100644 index 00000000000..e237d0b9a98 --- /dev/null +++ b/src/plugins/platforms/wayland/qwaylanddataoffer.cpp @@ -0,0 +1,139 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qwaylanddataoffer.h" +#include "qwaylanddatadevicemanager.h" + +#include +#include +#include + +#include + +QT_BEGIN_NAMESPACE + +QWaylandDataOffer::QWaylandDataOffer(QWaylandDisplay *display, struct ::wl_data_offer *offer) + : QtWayland::wl_data_offer(offer) + , m_mimeData(new QWaylandMimeData(this, display)) +{ +} + +QWaylandDataOffer::~QWaylandDataOffer() +{ + destroy(); +} + + +QString QWaylandDataOffer::firstFormat() const +{ + if (m_mimeData->formats().isEmpty()) + return QString(); + + return m_mimeData->formats().first(); +} + +QMimeData *QWaylandDataOffer::mimeData() +{ + return m_mimeData.data(); +} + +void QWaylandDataOffer::data_offer_offer(const QString &mime_type) +{ + m_mimeData->appendFormat(mime_type); +} + +QWaylandMimeData::QWaylandMimeData(QWaylandDataOffer *dataOffer, QWaylandDisplay *display) + : QInternalMimeData() + , m_dataOffer(dataOffer) + , m_display(display) + , m_offered_mime_types() +{ +} + +QWaylandMimeData::~QWaylandMimeData() +{ +} + +void QWaylandMimeData::appendFormat(const QString &mimeType) +{ + m_offered_mime_types.append(mimeType); +} + +bool QWaylandMimeData::hasFormat_sys(const QString &mimeType) const +{ + return m_offered_mime_types.contains(mimeType); +} + +QStringList QWaylandMimeData::formats_sys() const +{ + return m_offered_mime_types; +} + +QVariant QWaylandMimeData::retrieveData_sys(const QString &mimeType, QVariant::Type type) const +{ + Q_UNUSED(type); + + if (m_offered_mime_types.isEmpty()) + return QVariant(); + + int pipefd[2]; + if (qt_safe_pipe(pipefd, O_CLOEXEC) == -1) { + qWarning("QWaylandMimeData: pipe() failed"); + return QVariant(); + } + + m_dataOffer->receive(mimeType, pipefd[1]); + close(pipefd[1]); + +// m_display->forceRoundTrip(); + + QByteArray content; + char buf[4096]; + int n; + while ((n = QT_READ(pipefd[0], &buf, sizeof buf)) > 0) { + content.append(buf, n); + } + close(pipefd[0]); + + return content; +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylanddataoffer.h b/src/plugins/platforms/wayland/qwaylanddataoffer.h new file mode 100644 index 00000000000..7dc3baa38af --- /dev/null +++ b/src/plugins/platforms/wayland/qwaylanddataoffer.h @@ -0,0 +1,92 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWAYLANDDATAOFFER_H +#define QWAYLANDDATAOFFER_H + +#include "qwaylanddisplay.h" + +#include + +QT_BEGIN_NAMESPACE + +class QWaylandDisplay; +class QWaylandMimeData; + +class Q_WAYLAND_CLIENT_EXPORT QWaylandDataOffer : public QtWayland::wl_data_offer +{ +public: + explicit QWaylandDataOffer(QWaylandDisplay *display, struct ::wl_data_offer *offer); + ~QWaylandDataOffer(); + + QString firstFormat() const; + + QMimeData *mimeData(); + +protected: + void data_offer_offer(const QString &mime_type) Q_DECL_OVERRIDE; + +private: + QScopedPointer m_mimeData; +}; + + +class QWaylandMimeData : public QInternalMimeData { +public: + explicit QWaylandMimeData(QWaylandDataOffer *dataOffer, QWaylandDisplay *display); + ~QWaylandMimeData(); + + void appendFormat(const QString &mimeType); + +protected: + bool hasFormat_sys(const QString &mimeType) const Q_DECL_OVERRIDE; + QStringList formats_sys() const Q_DECL_OVERRIDE; + QVariant retrieveData_sys(const QString &mimeType, QVariant::Type type) const Q_DECL_OVERRIDE; + +private: + mutable QWaylandDataOffer *m_dataOffer; + QWaylandDisplay *m_display; + QStringList m_offered_mime_types; +}; + +QT_END_NAMESPACE + +#endif diff --git a/src/plugins/platforms/wayland/qwaylanddatasource.cpp b/src/plugins/platforms/wayland/qwaylanddatasource.cpp new file mode 100644 index 00000000000..ba4b68110ed --- /dev/null +++ b/src/plugins/platforms/wayland/qwaylanddatasource.cpp @@ -0,0 +1,96 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qwaylanddatasource.h" +#include "qwaylanddataoffer.h" +#include "qwaylanddatadevicemanager.h" +#include "qwaylandinputdevice.h" +#include "qwaylandmimehelper.h" + +#include + +#include + +#include + +QT_BEGIN_NAMESPACE + +QWaylandDataSource::QWaylandDataSource(QWaylandDataDeviceManager *dataDeviceManager, QMimeData *mimeData) + : QtWayland::wl_data_source(dataDeviceManager->create_data_source()) + , m_mime_data(mimeData) +{ + if (!mimeData) + return; + Q_FOREACH (const QString &format, mimeData->formats()) { + offer(format); + } +} + +QWaylandDataSource::~QWaylandDataSource() +{ + destroy(); +} + +QMimeData * QWaylandDataSource::mimeData() const +{ + return m_mime_data; +} + +void QWaylandDataSource::data_source_cancelled() +{ + Q_EMIT cancelled(); +} + +void QWaylandDataSource::data_source_send(const QString &mime_type, int32_t fd) +{ + QByteArray content = QWaylandMimeHelper::getByteArray(m_mime_data, mime_type); + if (!content.isEmpty()) { + write(fd, content.constData(), content.size()); + } + close(fd); +} + +void QWaylandDataSource::data_source_target(const QString &mime_type) +{ + Q_EMIT targetChanged(mime_type); +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylanddatasource.h b/src/plugins/platforms/wayland/qwaylanddatasource.h new file mode 100644 index 00000000000..670a8872ff6 --- /dev/null +++ b/src/plugins/platforms/wayland/qwaylanddatasource.h @@ -0,0 +1,77 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWAYLANDDATASOURCE_H +#define QWAYLANDDATASOURCE_H + +#include "qwaylanddisplay.h" + +QT_BEGIN_NAMESPACE + +class QMimeData; +class QWaylandDataDeviceManager; + +class Q_WAYLAND_CLIENT_EXPORT QWaylandDataSource : public QObject, public QtWayland::wl_data_source +{ + Q_OBJECT +public: + QWaylandDataSource(QWaylandDataDeviceManager *dataDeviceManager, QMimeData *mimeData); + ~QWaylandDataSource(); + + QMimeData *mimeData() const; + +Q_SIGNALS: + void targetChanged(const QString &mime_type); + void cancelled(); + +protected: + void data_source_cancelled() Q_DECL_OVERRIDE; + void data_source_send(const QString &mime_type, int32_t fd) Q_DECL_OVERRIDE; + void data_source_target(const QString &mime_type) Q_DECL_OVERRIDE; + +private: + QWaylandDisplay *m_display; + QMimeData *m_mime_data; +}; + +QT_END_NAMESPACE + +#endif // QWAYLANDDATASOURCE_H diff --git a/src/plugins/platforms/wayland/qwaylanddecoration.cpp b/src/plugins/platforms/wayland/qwaylanddecoration.cpp new file mode 100644 index 00000000000..74c01f93a83 --- /dev/null +++ b/src/plugins/platforms/wayland/qwaylanddecoration.cpp @@ -0,0 +1,459 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qwaylanddecoration.h" + +#include "qwaylandwindow.h" +#include "qwaylandshellsurface.h" +#include "qwaylandinputdevice.h" +#include "qwaylandscreen.h" + +#include +#include +#include +#include +#include +#include + +QT_BEGIN_NAMESPACE + +#define BUTTON_SPACING 5 + +#ifndef QT_NO_IMAGEFORMAT_XPM +# define BUTTON_WIDTH 10 + +static const char * const qt_close_xpm[] = { +"10 10 2 1", +"# c #000000", +". c None", +"..........", +".##....##.", +"..##..##..", +"...####...", +"....##....", +"...####...", +"..##..##..", +".##....##.", +"..........", +".........."}; + +static const char * const qt_maximize_xpm[]={ +"10 10 2 1", +"# c #000000", +". c None", +"#########.", +"#########.", +"#.......#.", +"#.......#.", +"#.......#.", +"#.......#.", +"#.......#.", +"#.......#.", +"#########.", +".........."}; + +static const char * const qt_minimize_xpm[] = { +"10 10 2 1", +"# c #000000", +". c None", +"..........", +"..........", +"..........", +"..........", +"..........", +"..........", +"..........", +".#######..", +".#######..", +".........."}; + +static const char * const qt_normalizeup_xpm[] = { +"10 10 2 1", +"# c #000000", +". c None", +"...######.", +"...######.", +"...#....#.", +".######.#.", +".######.#.", +".#....###.", +".#....#...", +".#....#...", +".######...", +".........."}; +#else +# define BUTTON_WIDTH 22 +#endif + +QWaylandDecoration::QWaylandDecoration(QWaylandWindow *window) + : m_window(window->window()) + , m_wayland_window(window) + , m_isDirty(true) + , m_decorationContentImage(0) + , m_margins(3,30,3,3) + , m_mouseButtons(Qt::NoButton) +{ + m_wayland_window->setDecoration(this); + + QPalette palette; + m_foregroundColor = palette.color(QPalette::Active, QPalette::HighlightedText); + m_backgroundColor = palette.color(QPalette::Active, QPalette::Highlight); + + QTextOption option(Qt::AlignHCenter | Qt::AlignVCenter); + option.setWrapMode(QTextOption::NoWrap); + m_windowTitle.setTextOption(option); +} + +QWaylandDecoration::~QWaylandDecoration() +{ + m_wayland_window->setDecoration(0); +} + +const QImage &QWaylandDecoration::contentImage() +{ + if (m_isDirty) { + //Update the decoration backingstore + + m_decorationContentImage = QImage(window()->frameGeometry().size(), QImage::Format_ARGB32_Premultiplied); + m_decorationContentImage.fill(Qt::transparent); + this->paint(&m_decorationContentImage); + + m_isDirty = false; + } + + return m_decorationContentImage; +} + +void QWaylandDecoration::update() +{ + m_isDirty = true; +} + +void QWaylandDecoration::paint(QPaintDevice *device) +{ + QRect surfaceRect(QPoint(), window()->frameGeometry().size()); + QRect clips[] = + { + QRect(0, 0, surfaceRect.width(), margins().top()), + QRect(0, surfaceRect.height() - margins().bottom(), surfaceRect.width(), margins().bottom()), + QRect(0, margins().top(), margins().left(), surfaceRect.height() - margins().top() - margins().bottom()), + QRect(surfaceRect.width() - margins().right(), margins().top(), margins().left(), surfaceRect.height() - margins().top() - margins().bottom()) + }; + + QRect top = clips[0]; + + QPainter p(device); + p.setRenderHint(QPainter::Antialiasing); + + // Title bar + QPoint gradCenter(top.center()+ QPoint(30, 60)); + QLinearGradient grad(top.topLeft(), top.bottomLeft()); + QColor base(backgroundColor()); + grad.setColorAt(0, base.lighter(100)); + grad.setColorAt(1, base.darker(180)); + QPainterPath roundedRect; + roundedRect.addRoundedRect(surfaceRect, 6, 6); + for (int i = 0; i < 4; ++i) { + p.save(); + p.setClipRect(clips[i]); + p.fillPath(roundedRect, grad); + p.restore(); + } + + // Window icon + QIcon icon = m_wayland_window->windowIcon(); + if (!icon.isNull()) { + QPixmap pixmap = icon.pixmap(QSize(128, 128)); + QPixmap scaled = pixmap.scaled(22, 22, Qt::IgnoreAspectRatio, Qt::SmoothTransformation); + + QRectF iconRect(0, 0, 22, 22); + p.drawPixmap(iconRect.adjusted(margins().left() + BUTTON_SPACING, 4, + margins().left() + BUTTON_SPACING, 4), + scaled, iconRect); + } + + // Window title + QString windowTitleText = window()->title(); + if (!windowTitleText.isEmpty()) { + if (m_windowTitle.text() != windowTitleText) { + m_windowTitle.setText(windowTitleText); + m_windowTitle.prepare(); + } + + QRect titleBar = top; + titleBar.setLeft(m_margins.left() + BUTTON_SPACING + + (icon.isNull() ? 0 : 22 + BUTTON_SPACING)); + titleBar.setRight(minimizeButtonRect().left() - BUTTON_SPACING); + + p.save(); + p.setClipRect(titleBar); + p.setPen(m_foregroundColor); + QSizeF size = m_windowTitle.size(); + int dx = (top.width() - size.width()) /2; + int dy = (top.height()- size.height()) /2; + QFont font = p.font(); + font.setBold(true); + p.setFont(font); + QPoint windowTitlePoint(top.topLeft().x() + dx, + top.topLeft().y() + dy); + p.drawStaticText(windowTitlePoint,m_windowTitle); + p.restore(); + } + +#ifndef QT_NO_IMAGEFORMAT_XPM + p.save(); + + // Close button + QPixmap closePixmap(qt_close_xpm); + p.drawPixmap(closeButtonRect(), closePixmap, closePixmap.rect()); + + // Maximize button + QPixmap maximizePixmap(m_wayland_window->isMaximized() + ? qt_normalizeup_xpm : qt_maximize_xpm); + p.drawPixmap(maximizeButtonRect(), maximizePixmap, maximizePixmap.rect()); + + // Minimize button + QPixmap minimizePixmap(qt_minimize_xpm); + p.drawPixmap(minimizeButtonRect(), minimizePixmap, minimizePixmap.rect()); + + p.restore(); +#else + // We don't need antialiasing from now on + p.setRenderHint(QPainter::Antialiasing, false); + + QRectF rect; + + // Default pen + QPen pen(m_foregroundColor); + p.setPen(pen); + + // Close button + p.save(); + rect = closeButtonRect(); + p.drawRect(rect); + qreal crossSize = rect.height() / 2; + QPointF crossCenter(rect.center()); + QRectF crossRect(crossCenter.x() - crossSize / 2, crossCenter.y() - crossSize / 2, crossSize, crossSize); + pen.setWidth(2); + p.setPen(pen); + p.drawLine(crossRect.topLeft(), crossRect.bottomRight()); + p.drawLine(crossRect.bottomLeft(), crossRect.topRight()); + p.restore(); + + // Maximize button + p.save(); + p.drawRect(maximizeButtonRect()); + rect = maximizeButtonRect().adjusted(5, 5, -5, -5); + if (m_wayland_window->isMaximized()) { + QRectF rect1 = rect.adjusted(rect.width() / 3, 0, 0, -rect.height() / 3); + QRectF rect2 = rect.adjusted(0, rect.height() / 4, -rect.width() / 4, 0); + p.drawRect(rect1); + p.drawRect(rect2); + } else { + p.setPen(m_foregroundColor); + p.drawRect(rect); + p.drawLine(rect.left(), rect.top() + 1, rect.right(), rect.top() + 1); + } + p.restore(); + + // Minimize button + p.save(); + p.drawRect(minimizeButtonRect()); + rect = minimizeButtonRect().adjusted(5, 5, -5, -5); + pen.setWidth(2); + p.setPen(pen); + p.drawLine(rect.bottomLeft(), rect.bottomRight()); + p.restore(); +#endif +} + +bool QWaylandDecoration::handleMouse(QWaylandInputDevice *inputDevice, const QPointF &local, const QPointF &global, Qt::MouseButtons b, Qt::KeyboardModifiers mods) + +{ + Q_UNUSED(global); + + // Figure out what area mouse is in + if (closeButtonRect().contains(local) && isLeftClicked(b)) { + QWindowSystemInterface::handleCloseEvent(m_window); + } else if (maximizeButtonRect().contains(local) && isLeftClicked(b)) { + m_window->setWindowState(m_wayland_window->isMaximized() ? Qt::WindowNoState : Qt::WindowMaximized); + } else if (minimizeButtonRect().contains(local) && isLeftClicked(b)) { + m_window->setWindowState(Qt::WindowMinimized); + } else if (local.y() <= m_margins.top()) { + processMouseTop(inputDevice,local,b,mods); + } else if (local.y() > m_window->height() - m_margins.bottom() + m_margins.top()) { + processMouseBottom(inputDevice,local,b,mods); + } else if (local.x() <= m_margins.left()) { + processMouseLeft(inputDevice,local,b,mods); + } else if (local.x() > m_window->width() - m_margins.right() + m_margins.left()) { + processMouseRight(inputDevice,local,b,mods); + } else { + m_wayland_window->restoreMouseCursor(inputDevice); + m_mouseButtons = b; + return false; + } + + m_mouseButtons = b; + return true; +} + +bool QWaylandDecoration::inMouseButtonPressedState() const +{ + return m_mouseButtons & Qt::NoButton; +} + +void QWaylandDecoration::startResize(QWaylandInputDevice *inputDevice, enum wl_shell_surface_resize resize, Qt::MouseButtons buttons) +{ + if (isLeftClicked(buttons)) { + m_wayland_window->shellSurface()->resize(inputDevice, resize); + inputDevice->removeMouseButtonFromState(Qt::LeftButton); + } +} + +void QWaylandDecoration::startMove(QWaylandInputDevice *inputDevice, Qt::MouseButtons buttons) +{ + if (isLeftClicked(buttons)) { + m_wayland_window->shellSurface()->move(inputDevice); + inputDevice->removeMouseButtonFromState(Qt::LeftButton); + } +} + +void QWaylandDecoration::processMouseTop(QWaylandInputDevice *inputDevice, const QPointF &local, Qt::MouseButtons b, Qt::KeyboardModifiers mods) +{ + Q_UNUSED(mods); + if (local.y() <= m_margins.bottom()) { + if (local.x() <= margins().left()) { + //top left bit + m_wayland_window->setMouseCursor(inputDevice, Qt::SizeFDiagCursor); + startResize(inputDevice,WL_SHELL_SURFACE_RESIZE_TOP_LEFT,b); + } else if (local.x() > m_window->width() - margins().right()) { + //top right bit + m_wayland_window->setMouseCursor(inputDevice, Qt::SizeBDiagCursor); + startResize(inputDevice,WL_SHELL_SURFACE_RESIZE_TOP_RIGHT,b); + } else { + //top reszie bit + m_wayland_window->setMouseCursor(inputDevice, Qt::SplitVCursor); + startResize(inputDevice,WL_SHELL_SURFACE_RESIZE_TOP,b); + } + } else { + m_wayland_window->restoreMouseCursor(inputDevice); + startMove(inputDevice,b); + } + +} + +void QWaylandDecoration::processMouseBottom(QWaylandInputDevice *inputDevice, const QPointF &local, Qt::MouseButtons b, Qt::KeyboardModifiers mods) +{ + Q_UNUSED(mods); + if (local.x() <= margins().left()) { + //bottom left bit + m_wayland_window->setMouseCursor(inputDevice, Qt::SizeBDiagCursor); + startResize(inputDevice, WL_SHELL_SURFACE_RESIZE_BOTTOM_LEFT,b); + } else if (local.x() > m_window->width() - margins().right()) { + //bottom right bit + m_wayland_window->setMouseCursor(inputDevice, Qt::SizeFDiagCursor); + startResize(inputDevice, WL_SHELL_SURFACE_RESIZE_BOTTOM_RIGHT,b); + } else { + //bottom bit + m_wayland_window->setMouseCursor(inputDevice, Qt::SplitVCursor); + startResize(inputDevice,WL_SHELL_SURFACE_RESIZE_BOTTOM,b); + } +} + +void QWaylandDecoration::processMouseLeft(QWaylandInputDevice *inputDevice, const QPointF &local, Qt::MouseButtons b, Qt::KeyboardModifiers mods) +{ + Q_UNUSED(local); + Q_UNUSED(mods); + m_wayland_window->setMouseCursor(inputDevice, Qt::SplitHCursor); + startResize(inputDevice,WL_SHELL_SURFACE_RESIZE_LEFT,b); +} + +void QWaylandDecoration::processMouseRight(QWaylandInputDevice *inputDevice, const QPointF &local, Qt::MouseButtons b, Qt::KeyboardModifiers mods) +{ + Q_UNUSED(local); + Q_UNUSED(mods); + m_wayland_window->setMouseCursor(inputDevice, Qt::SplitHCursor); + startResize(inputDevice, WL_SHELL_SURFACE_RESIZE_RIGHT,b); +} + +bool QWaylandDecoration::isLeftClicked(Qt::MouseButtons newMouseButtonState) +{ + if ((!m_mouseButtons & Qt::LeftButton) && (newMouseButtonState & Qt::LeftButton)) + return true; + return false; +} + +bool QWaylandDecoration::isLeftReleased(Qt::MouseButtons newMouseButtonState) +{ + if ((m_mouseButtons & Qt::LeftButton) && !(newMouseButtonState & Qt::LeftButton)) + return true; + return false; +} + +QRectF QWaylandDecoration::closeButtonRect() const +{ + return QRectF(window()->frameGeometry().width() - BUTTON_WIDTH - BUTTON_SPACING * 2, + (m_margins.top() - BUTTON_WIDTH) / 2, BUTTON_WIDTH, BUTTON_WIDTH); +} + +QRectF QWaylandDecoration::maximizeButtonRect() const +{ + return QRectF(window()->frameGeometry().width() - BUTTON_WIDTH * 2 - BUTTON_SPACING * 3, + (m_margins.top() - BUTTON_WIDTH) / 2, BUTTON_WIDTH, BUTTON_WIDTH); +} + +QRectF QWaylandDecoration::minimizeButtonRect() const +{ + return QRectF(window()->frameGeometry().width() - BUTTON_WIDTH * 3 - BUTTON_SPACING * 4, + (m_margins.top() - BUTTON_WIDTH) / 2, BUTTON_WIDTH, BUTTON_WIDTH); +} + +void QWaylandDecoration::setForegroundColor(const QColor &c) +{ + m_foregroundColor = c; +} + +void QWaylandDecoration::setBackgroundColor(const QColor &c) +{ + m_backgroundColor = c; +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylanddecoration.h b/src/plugins/platforms/wayland/qwaylanddecoration.h new file mode 100644 index 00000000000..f99723588f0 --- /dev/null +++ b/src/plugins/platforms/wayland/qwaylanddecoration.h @@ -0,0 +1,155 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWAYLANDDECORATION_H +#define QWAYLANDDECORATION_H + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include + +QT_BEGIN_NAMESPACE + +class QWindow; +class QPaintDevice; +class QPainter; +class QEvent; +class QWaylandScreen; +class QWaylandWindow; +class QWaylandInputDevice; + +class Q_WAYLAND_CLIENT_EXPORT QWaylandDecoration +{ +public: + QWaylandDecoration(QWaylandWindow *window); + virtual ~QWaylandDecoration(); + + void update(); + bool isDirty() const; + + bool handleMouse(QWaylandInputDevice *inputDevice, const QPointF &local, const QPointF &global,Qt::MouseButtons b,Qt::KeyboardModifiers mods); + bool inMouseButtonPressedState() const; + + void startResize(QWaylandInputDevice *inputDevice,enum wl_shell_surface_resize resize, Qt::MouseButtons buttons); + void startMove(QWaylandInputDevice *inputDevice, Qt::MouseButtons buttons); + QMargins margins() const; + QWindow *window() const; + QWaylandWindow *waylandWindow() const; + const QImage &contentImage(); + + void setForegroundColor(const QColor &c); + inline QColor foregroundColor() const; + + void setBackgroundColor(const QColor &c); + inline QColor backgroundColor() const; + +protected: + void paint(QPaintDevice *device); + +private: + void processMouseTop(QWaylandInputDevice *inputDevice, const QPointF &local, Qt::MouseButtons b,Qt::KeyboardModifiers mods); + void processMouseBottom(QWaylandInputDevice *inputDevice, const QPointF &local, Qt::MouseButtons b,Qt::KeyboardModifiers mods); + void processMouseLeft(QWaylandInputDevice *inputDevice, const QPointF &local, Qt::MouseButtons b,Qt::KeyboardModifiers mods); + void processMouseRight(QWaylandInputDevice *inputDevice, const QPointF &local, Qt::MouseButtons b,Qt::KeyboardModifiers mods); + + bool isLeftClicked(Qt::MouseButtons newMouseButtonState); + bool isLeftReleased(Qt::MouseButtons newMouseButtonState); + + QRectF closeButtonRect() const; + QRectF maximizeButtonRect() const; + QRectF minimizeButtonRect() const; + + QWindow *m_window; + QWaylandWindow *m_wayland_window; + + bool m_isDirty; + QImage m_decorationContentImage; + + QMargins m_margins; + Qt::MouseButtons m_mouseButtons; + + QColor m_foregroundColor; + QColor m_backgroundColor; + QStaticText m_windowTitle; +}; + +inline bool QWaylandDecoration::isDirty() const +{ + return m_isDirty; +} + +inline QMargins QWaylandDecoration::margins() const +{ + return m_margins; +} + +inline QWindow *QWaylandDecoration::window() const +{ + return m_window; +} + +inline QWaylandWindow *QWaylandDecoration::waylandWindow() const +{ + return m_wayland_window; +} + +inline QColor QWaylandDecoration::foregroundColor() const +{ + return m_foregroundColor; +} + +inline QColor QWaylandDecoration::backgroundColor() const +{ + return m_backgroundColor; +} + +QT_END_NAMESPACE + +#endif // QWAYLANDDECORATION_H diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp new file mode 100644 index 00000000000..d9a8b4528a6 --- /dev/null +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -0,0 +1,272 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qwaylanddisplay.h" + +#include "qwaylandeventthread.h" +#include "qwaylandwindow.h" +#include "qwaylandscreen.h" +#include "qwaylandcursor.h" +#include "qwaylandinputdevice.h" +#include "qwaylandclipboard.h" +#include "qwaylanddatadevicemanager.h" + +#ifdef QT_WAYLAND_GL_SUPPORT +#include "qwaylandglintegration.h" +#endif + +#include "qwaylandwindowmanagerintegration.h" + +#include "qwaylandextendedoutput.h" +#include "qwaylandextendedsurface.h" +#include "qwaylandsubsurface.h" +#include "qwaylandtouch.h" +#include "qwaylandqtkey.h" + +#include + +#include +#include + +#include + +#include + +QT_BEGIN_NAMESPACE + +struct wl_surface *QWaylandDisplay::createSurface(void *handle) +{ + struct wl_surface *surface = mCompositor.create_surface(); + wl_surface_set_user_data(surface, handle); + return surface; +} + +#ifdef QT_WAYLAND_GL_SUPPORT +QWaylandGLIntegration * QWaylandDisplay::eglIntegration() +{ + return mEglIntegration; +} +#endif + +QWaylandWindowManagerIntegration *QWaylandDisplay::windowManagerIntegration() +{ + return mWindowManagerIntegration; +} + +QWaylandInputDevice *QWaylandDisplay::lastKeyboardFocusInputDevice() const +{ + return mLastKeyboardFocusInputDevice; +} + +void QWaylandDisplay::setLastKeyboardFocusInputDevice(QWaylandInputDevice *device) +{ + mLastKeyboardFocusInputDevice = device; +} + +static QWaylandDisplay *display = 0; + +QWaylandDisplay::QWaylandDisplay() + : mLastKeyboardFocusInputDevice(0) + , mDndSelectionHandler(0) + , mWindowExtension(0) + , mSubSurfaceExtension(0) + , mOutputExtension(0) + , mTouchExtension(0) + , mQtKeyExtension(0) + , mTextInputManager(0) +{ + display = this; + qRegisterMetaType("uint32_t"); + + mEventThreadObject = new QWaylandEventThread(0); + mEventThread = new QThread(this); + mEventThreadObject->moveToThread(mEventThread); + mEventThread->start(); + + mEventThreadObject->displayConnect(); + mDisplay = mEventThreadObject->display(); //blocks until display is available + + //Create a new even queue for the QtGui thread + mEventQueue = wl_display_create_queue(mDisplay); + + struct ::wl_registry *registry = wl_display_get_registry(mDisplay); + wl_proxy_set_queue((struct wl_proxy *)registry, mEventQueue); + + init(registry); + + connect(mEventThreadObject, SIGNAL(newEventsRead()), this, SLOT(flushRequests())); + +#ifdef QT_WAYLAND_GL_SUPPORT + //mEglIntegration = QWaylandGLIntegration::createGLIntegration(this); +#endif + + mWindowManagerIntegration = new QWaylandWindowManagerIntegration(this); + + blockingReadEvents(); + +#ifdef QT_WAYLAND_GL_SUPPORT + mEglIntegration->initialize(); + + flushRequests(); + while (mEglIntegration->waitingForEvents()) + blockingReadEvents(); +#endif + + waitForScreens(); +} + +QWaylandDisplay::~QWaylandDisplay(void) +{ +#ifdef QT_WAYLAND_GL_SUPPORT + delete mEglIntegration; +#endif + mEventThread->quit(); + mEventThread->wait(); + delete mEventThreadObject; +} + +void QWaylandDisplay::flushRequests() +{ + if (wl_display_dispatch_queue_pending(mDisplay, mEventQueue) == -1 && errno == EPIPE) { + qWarning("The Wayland connection broke. Did the Wayland compositor die?"); + ::exit(1); + } + wl_display_flush(mDisplay); +} + +void QWaylandDisplay::blockingReadEvents() +{ + if (wl_display_dispatch_queue(mDisplay, mEventQueue) == -1 && errno == EPIPE) { + qWarning("The Wayland connection broke. Did the Wayland compositor die?"); + ::exit(1); + } +} + +QWaylandScreen *QWaylandDisplay::screenForOutput(struct wl_output *output) const +{ + for (int i = 0; i < mScreens.size(); ++i) { + QWaylandScreen *screen = static_cast(mScreens.at(i)); + if (screen->output() == output) + return screen; + } + return 0; +} + +void QWaylandDisplay::addRegistryListener(RegistryListener listener, void *data) +{ + Listener l = { listener, data }; + mRegistryListeners.append(l); +} + +void QWaylandDisplay::waitForScreens() +{ + flushRequests(); + + while (true) { + bool screensReady = !mScreens.isEmpty(); + + for (int ii = 0; screensReady && ii < mScreens.count(); ++ii) { + if (mScreens.at(ii)->geometry() == QRect(0, 0, 0, 0)) + screensReady = false; + } + + if (!screensReady) + blockingReadEvents(); + else + return; + } +} + +void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uint32_t version) +{ + Q_UNUSED(version); + + struct ::wl_registry *registry = object(); + + if (interface == "wl_output") { + mScreens.append(new QWaylandScreen(this, id)); + } else if (interface == "wl_compositor") { + mCompositor.init(registry, id); + } else if (interface == "wl_shm") { + mShm = static_cast(wl_registry_bind(registry, id, &wl_shm_interface,1)); + } else if (interface == "wl_shell"){ + mShell = new QtWayland::wl_shell(registry, id); + } else if (interface == "wl_seat") { + QWaylandInputDevice *inputDevice = new QWaylandInputDevice(this, id); + mInputDevices.append(inputDevice); + } else if (interface == "wl_data_device_manager") { + mDndSelectionHandler = new QWaylandDataDeviceManager(this, id); + } else if (interface == "qt_output_extension") { + mOutputExtension = new QtWayland::qt_output_extension(registry, id); + foreach (QPlatformScreen *screen, screens()) + static_cast(screen)->createExtendedOutput(); + } else if (interface == "qt_surface_extension") { + mWindowExtension = new QtWayland::qt_surface_extension(registry, id); + } else if (interface == "qt_sub_surface_extension") { + mSubSurfaceExtension = new QtWayland::qt_sub_surface_extension(registry, id); + } else if (interface == "qt_touch_extension") { + mTouchExtension = new QWaylandTouchExtension(this, id); + } else if (interface == "qt_key_extension") { + mQtKeyExtension = new QWaylandQtKeyExtension(this, id); + } else if (interface == "wl_text_input_manager") { + mTextInputManager = new QtWayland::wl_text_input_manager(registry, id); + } + + foreach (Listener l, mRegistryListeners) + (*l.listener)(l.data, registry, id, interface, version); +} + +uint32_t QWaylandDisplay::currentTimeMillisec() +{ + //### we throw away the time information + struct timeval tv; + int ret = gettimeofday(&tv, 0); + if (ret == 0) + return tv.tv_sec*1000 + tv.tv_usec/1000; + return 0; +} + +void QWaylandDisplay::forceRoundTrip() +{ + wl_display_roundtrip(mDisplay); +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.h b/src/plugins/platforms/wayland/qwaylanddisplay.h new file mode 100644 index 00000000000..45104350738 --- /dev/null +++ b/src/plugins/platforms/wayland/qwaylanddisplay.h @@ -0,0 +1,193 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWAYLANDDISPLAY_H +#define QWAYLANDDISPLAY_H + +#include +#include + +#include + +#include +#include + +#include + +struct wl_cursor_image; + +QT_BEGIN_NAMESPACE + +class QAbstractEventDispatcher; +class QWaylandInputDevice; +class QSocketNotifier; +class QWaylandBuffer; +class QPlatformScreen; +class QWaylandScreen; +class QWaylandGLIntegration; +class QWaylandWindowManagerIntegration; +class QWaylandDataDeviceManager; +class QWaylandTouchExtension; +class QWaylandQtKeyExtension; +class QWaylandWindow; +class QWaylandEventThread; + +namespace QtWayland { + class qt_output_extension; + class qt_shell; + class qt_sub_surface_extension; + class qt_surface_extension; + class wl_text_input_manager; +} + +typedef void (*RegistryListener)(void *data, + struct wl_registry *registry, + uint32_t id, + const QString &interface, + uint32_t version); + +class Q_WAYLAND_CLIENT_EXPORT QWaylandDisplay : public QObject, public QtWayland::wl_registry { + Q_OBJECT + +public: + QWaylandDisplay(void); + ~QWaylandDisplay(void); + + QList screens() const { return mScreens; } + + QWaylandScreen *screenForOutput(struct wl_output *output) const; + + struct wl_surface *createSurface(void *handle); + +#ifdef QT_WAYLAND_GL_SUPPORT + QWaylandGLIntegration *eglIntegration(); +#endif + + QWaylandWindowManagerIntegration *windowManagerIntegration(); + + void setCursor(struct wl_buffer *buffer, struct wl_cursor_image *image); + + struct wl_display *wl_display() const { return mDisplay; } + struct wl_event_queue *wl_event_queue() const { return mEventQueue; } + struct ::wl_registry *wl_registry() { return object(); } + + const struct wl_compositor *wl_compositor() const { return mCompositor.object(); } + QtWayland::wl_compositor *compositor() { return &mCompositor; } + + QtWayland::wl_shell *shell() { return mShell; } + + QList inputDevices() const { return mInputDevices; } + QWaylandInputDevice *defaultInputDevice() const; + QWaylandInputDevice *currentInputDevice() const { return defaultInputDevice(); } + + QWaylandInputDevice *lastKeyboardFocusInputDevice() const; + void setLastKeyboardFocusInputDevice(QWaylandInputDevice *device); + + QWaylandDataDeviceManager *dndSelectionHandler() const { return mDndSelectionHandler; } + + QtWayland::qt_surface_extension *windowExtension() const { return mWindowExtension; } + QtWayland::qt_sub_surface_extension *subSurfaceExtension() const { return mSubSurfaceExtension; } + QtWayland::qt_output_extension *outputExtension() const { return mOutputExtension; } + QWaylandTouchExtension *touchExtension() const { return mTouchExtension; } + QtWayland::wl_text_input_manager *textInputManager() const { return mTextInputManager; } + + /* wl_registry_add_listener does not add but rather sets a listener, so this function is used + * to enable many listeners at once. */ + void addRegistryListener(RegistryListener listener, void *data); + + struct wl_shm *shm() const { return mShm; } + + static uint32_t currentTimeMillisec(); + + void forceRoundTrip(); + +public slots: + void blockingReadEvents(); + void flushRequests(); + +private: + void waitForScreens(); + + struct Listener { + RegistryListener listener; + void *data; + }; + + struct wl_display *mDisplay; + struct wl_event_queue *mEventQueue; + QtWayland::wl_compositor mCompositor; + struct wl_shm *mShm; + QThread *mEventThread; + QWaylandEventThread *mEventThreadObject; + QtWayland::wl_shell *mShell; + QList mScreens; + QList mInputDevices; + QList mRegistryListeners; + QWaylandInputDevice *mLastKeyboardFocusInputDevice; + QWaylandDataDeviceManager *mDndSelectionHandler; + QtWayland::qt_surface_extension *mWindowExtension; + QtWayland::qt_sub_surface_extension *mSubSurfaceExtension; + QtWayland::qt_output_extension *mOutputExtension; + QWaylandTouchExtension *mTouchExtension; + QWaylandQtKeyExtension *mQtKeyExtension; + QWaylandWindowManagerIntegration *mWindowManagerIntegration; + QtWayland::wl_text_input_manager *mTextInputManager; + + QSocketNotifier *mReadNotifier; + int mFd; + int mWritableNotificationFd; + bool mScreensInitialized; + + void registry_global(uint32_t id, const QString &interface, uint32_t version) Q_DECL_OVERRIDE; + +#ifdef QT_WAYLAND_GL_SUPPORT + QWaylandGLIntegration *mEglIntegration; +#endif + + static void shellHandleConfigure(void *data, struct wl_shell *shell, + uint32_t time, uint32_t edges, + struct wl_surface *surface, + int32_t width, int32_t height); +}; + +QT_END_NAMESPACE + +#endif // QWAYLANDDISPLAY_H diff --git a/src/plugins/platforms/wayland/qwaylanddnd.cpp b/src/plugins/platforms/wayland/qwaylanddnd.cpp new file mode 100644 index 00000000000..635fd9678c6 --- /dev/null +++ b/src/plugins/platforms/wayland/qwaylanddnd.cpp @@ -0,0 +1,136 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qwaylanddnd.h" + +#include "qwaylanddatadevice.h" +#include "qwaylanddatadevicemanager.h" +#include "qwaylanddataoffer.h" +#include "qwaylandinputdevice.h" + +#include + +#include + +QT_BEGIN_NAMESPACE + +QWaylandDrag::QWaylandDrag(QWaylandDisplay *display) + : m_display(display) +{ +} + +QWaylandDrag::~QWaylandDrag() +{ +} + +QMimeData * QWaylandDrag::platformDropData() +{ + if (drag()) + return drag()->mimeData(); + return 0; +} + +void QWaylandDrag::startDrag() +{ + if (!shapedPixmapWindow()) { + QBasicDrag::startDrag(); + QBasicDrag::cancel(); + } + + QWaylandWindow *icon = static_cast(shapedPixmapWindow()->handle()); + m_display->currentInputDevice()->dataDevice()->startDrag(drag()->mimeData(), icon); + QBasicDrag::startDrag(); +} + +void QWaylandDrag::cancel() +{ + QBasicDrag::cancel(); + + m_display->currentInputDevice()->dataDevice()->cancelDrag(); +} + +void QWaylandDrag::move(const QMouseEvent *me) +{ + Q_UNUSED(me); + // Do nothing +} + +void QWaylandDrag::drop(const QMouseEvent *me) +{ + Q_UNUSED(me); + // Do nothing +} + +void QWaylandDrag::endDrag() +{ + // Do nothing +} + +void QWaylandDrag::updateTarget(const QString &mimeType) +{ + setCanDrop(!mimeType.isEmpty()); + + if (canDrop()) { + updateCursor(defaultAction(drag()->supportedActions(), m_display->currentInputDevice()->modifiers())); + } else { + updateCursor(Qt::IgnoreAction); + } +} + +void QWaylandDrag::setResponse(const QPlatformDragQtResponse &response) +{ + setCanDrop(response.isAccepted()); + + if (canDrop()) { + updateCursor(defaultAction(drag()->supportedActions(), m_display->currentInputDevice()->modifiers())); + } else { + updateCursor(Qt::IgnoreAction); + } +} + +void QWaylandDrag::finishDrag(const QPlatformDropQtResponse &response) +{ + setExecutedDropAction(response.acceptedAction()); + QKeyEvent event(QEvent::KeyPress, Qt::Key_Escape, Qt::NoModifier); + eventFilter(shapedPixmapWindow(), &event); +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylanddnd.h b/src/plugins/platforms/wayland/qwaylanddnd.h new file mode 100644 index 00000000000..f125dd2b2f6 --- /dev/null +++ b/src/plugins/platforms/wayland/qwaylanddnd.h @@ -0,0 +1,80 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWAYLANDDND_H +#define QWAYLANDDND_H + +#include +#include + +#include +#include +#include "qwaylanddisplay.h" + +QT_BEGIN_NAMESPACE + +class Q_WAYLAND_CLIENT_EXPORT QWaylandDrag : public QBasicDrag +{ +public: + QWaylandDrag(QWaylandDisplay *display); + ~QWaylandDrag(); + + QMimeData *platformDropData() Q_DECL_OVERRIDE; + + void updateTarget(const QString &mimeType); + void setResponse(const QPlatformDragQtResponse &response); + void finishDrag(const QPlatformDropQtResponse &response); + +protected: + void startDrag() Q_DECL_OVERRIDE; + void cancel() Q_DECL_OVERRIDE; + void move(const QMouseEvent *me) Q_DECL_OVERRIDE; + void drop(const QMouseEvent *me) Q_DECL_OVERRIDE; + void endDrag() Q_DECL_OVERRIDE; + + +private: + QWaylandDisplay *m_display; +}; + +QT_END_NAMESPACE + +#endif // QWAYLANDDND_H diff --git a/src/plugins/platforms/wayland/qwaylandeventthread.cpp b/src/plugins/platforms/wayland/qwaylandeventthread.cpp new file mode 100644 index 00000000000..3392d36c667 --- /dev/null +++ b/src/plugins/platforms/wayland/qwaylandeventthread.cpp @@ -0,0 +1,63 @@ +#include "qwaylandeventthread.h" +#include +#include + +#include +#include +#include +#include + +QT_BEGIN_NAMESPACE + +QWaylandEventThread::QWaylandEventThread(QObject *parent) + : QObject(parent) + , m_display(0) + , m_fileDescriptor(-1) + , m_readNotifier(0) + , m_displayLock(new QMutex) +{ +} + +QWaylandEventThread::~QWaylandEventThread() +{ + delete m_displayLock; + wl_display_disconnect(m_display); +} + +void QWaylandEventThread::displayConnect() +{ + m_displayLock->lock(); + QMetaObject::invokeMethod(this, "waylandDisplayConnect", Qt::QueuedConnection); +} + +void QWaylandEventThread::readWaylandEvents() +{ + if (wl_display_dispatch(m_display) == -1 && errno == EPIPE) { + qWarning("The Wayland connection broke. Did the Wayland compositor die?"); + ::exit(1); + } + emit newEventsRead(); +} + +void QWaylandEventThread::waylandDisplayConnect() +{ + m_display = wl_display_connect(NULL); + if (m_display == NULL) { + qErrnoWarning(errno, "Failed to create display"); + ::exit(1); + } + m_displayLock->unlock(); + + m_fileDescriptor = wl_display_get_fd(m_display); + + m_readNotifier = new QSocketNotifier(m_fileDescriptor, QSocketNotifier::Read, this); + connect(m_readNotifier, SIGNAL(activated(int)), this, SLOT(readWaylandEvents())); +} + +wl_display *QWaylandEventThread::display() const +{ + QMutexLocker displayLock(m_displayLock); + return m_display; +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandeventthread.h b/src/plugins/platforms/wayland/qwaylandeventthread.h new file mode 100644 index 00000000000..ba7e33e0998 --- /dev/null +++ b/src/plugins/platforms/wayland/qwaylandeventthread.h @@ -0,0 +1,46 @@ +#ifndef QWAYLANDEVENTTHREAD_H +#define QWAYLANDEVENTTHREAD_H + +#include +#include +#include + +#include + +QT_BEGIN_NAMESPACE + +class QSocketNotifier; + +class Q_WAYLAND_CLIENT_EXPORT QWaylandEventThread : public QObject +{ + Q_OBJECT +public: + explicit QWaylandEventThread(QObject *parent = 0); + ~QWaylandEventThread(); + + void displayConnect(); + + wl_display *display() const; + +private slots: + void readWaylandEvents(); + + void waylandDisplayConnect(); + +signals: + void newEventsRead(); + +private: + + struct wl_display *m_display; + int m_fileDescriptor; + + QSocketNotifier *m_readNotifier; + + QMutex *m_displayLock; + +}; + +QT_END_NAMESPACE + +#endif // QWAYLANDEVENTTHREAD_H diff --git a/src/plugins/platforms/wayland/qwaylandextendedoutput.cpp b/src/plugins/platforms/wayland/qwaylandextendedoutput.cpp new file mode 100644 index 00000000000..d7c684be958 --- /dev/null +++ b/src/plugins/platforms/wayland/qwaylandextendedoutput.cpp @@ -0,0 +1,100 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qwaylandextendedoutput.h" + +#include "qwaylandscreen.h" + +#include + +#include + +QT_BEGIN_NAMESPACE + +QWaylandExtendedOutput::QWaylandExtendedOutput(QWaylandScreen *screen, ::qt_extended_output *extended_output) + : QtWayland::qt_extended_output(extended_output) + , m_screen(screen) + , m_orientation(m_screen->orientation()) +{ +} + +Qt::ScreenOrientation QWaylandExtendedOutput::currentOrientation() const +{ + return m_orientation; +} + +void QWaylandExtendedOutput::setOrientationUpdateMask(Qt::ScreenOrientations orientations) +{ + int mask = 0; + if (orientations & Qt::PortraitOrientation) + mask |= QT_EXTENDED_OUTPUT_ROTATION_PORTRAITORIENTATION; + if (orientations & Qt::LandscapeOrientation) + mask |= QT_EXTENDED_OUTPUT_ROTATION_LANDSCAPEORIENTATION; + if (orientations & Qt::InvertedPortraitOrientation) + mask |= QT_EXTENDED_OUTPUT_ROTATION_INVERTEDPORTRAITORIENTATION; + if (orientations & Qt::InvertedLandscapeOrientation) + mask |= QT_EXTENDED_OUTPUT_ROTATION_INVERTEDLANDSCAPEORIENTATION; + set_orientation_update_mask(mask); +} + +void QWaylandExtendedOutput::extended_output_set_screen_rotation(int32_t rotation) +{ + switch (rotation) { + case QT_EXTENDED_OUTPUT_ROTATION_PORTRAITORIENTATION: + m_orientation = Qt::PortraitOrientation; + break; + case QT_EXTENDED_OUTPUT_ROTATION_LANDSCAPEORIENTATION: + m_orientation = Qt::LandscapeOrientation; + break; + case QT_EXTENDED_OUTPUT_ROTATION_INVERTEDPORTRAITORIENTATION: + m_orientation = Qt::InvertedPortraitOrientation; + break; + case QT_EXTENDED_OUTPUT_ROTATION_INVERTEDLANDSCAPEORIENTATION: + m_orientation = Qt::InvertedLandscapeOrientation; + break; + default: + m_orientation = Qt::PortraitOrientation; + break; + } + QWindowSystemInterface::handleScreenOrientationChange(m_screen->screen(), m_orientation); +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandextendedoutput.h b/src/plugins/platforms/wayland/qwaylandextendedoutput.h new file mode 100644 index 00000000000..e311a9b4f63 --- /dev/null +++ b/src/plugins/platforms/wayland/qwaylandextendedoutput.h @@ -0,0 +1,69 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWAYLANDEXTENDEDOUTPUT_H +#define QWAYLANDEXTENDEDOUTPUT_H + +#include "qwaylanddisplay.h" +#include + +QT_BEGIN_NAMESPACE + +class QWaylandExtendedOutput; + +class Q_WAYLAND_CLIENT_EXPORT QWaylandExtendedOutput : public QtWayland::qt_extended_output +{ +public: + QWaylandExtendedOutput(QWaylandScreen *screen, struct ::qt_extended_output *extended_output); + + Qt::ScreenOrientation currentOrientation() const; + void setOrientationUpdateMask(Qt::ScreenOrientations mask); + +private: + void extended_output_set_screen_rotation(int32_t rotation) Q_DECL_OVERRIDE; + + QWaylandScreen *m_screen; + Qt::ScreenOrientation m_orientation; +}; + +QT_END_NAMESPACE + +#endif // QWAYLANDEXTENDEDOUTPUT_H diff --git a/src/plugins/platforms/wayland/qwaylandextendedsurface.cpp b/src/plugins/platforms/wayland/qwaylandextendedsurface.cpp new file mode 100644 index 00000000000..bfd2a1d0b8d --- /dev/null +++ b/src/plugins/platforms/wayland/qwaylandextendedsurface.cpp @@ -0,0 +1,152 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qwaylandextendedsurface.h" + +#include "qwaylandwindow.h" + +#include "wayland-client.h" + +#include "qwaylanddisplay.h" + +#include "qwaylandnativeinterface.h" + +#include +#include +#include + +QT_BEGIN_NAMESPACE + +QWaylandExtendedSurface::QWaylandExtendedSurface(QWaylandWindow *window, struct ::qt_extended_surface *extended_surface) + : QtWayland::qt_extended_surface(extended_surface) + , m_window(window) +{ +} + +QWaylandExtendedSurface::~QWaylandExtendedSurface() +{ + qt_extended_surface_destroy(object()); +} + +void QWaylandExtendedSurface::updateGenericProperty(const QString &name, const QVariant &value) +{ + QByteArray byteValue; + QDataStream ds(&byteValue, QIODevice::WriteOnly); + ds << value; + + update_generic_property(name, byteValue); + + m_properties.insert(name, value); + QWaylandNativeInterface *nativeInterface = static_cast( + QGuiApplication::platformNativeInterface()); + nativeInterface->emitWindowPropertyChanged(m_window, name); +} + +static int32_t waylandRotationFromScreenOrientation(Qt::ScreenOrientation orientation) +{ + switch (orientation) { + case Qt::PortraitOrientation: return QT_EXTENDED_SURFACE_ORIENTATION_PORTRAITORIENTATION; + case Qt::InvertedPortraitOrientation: return QT_EXTENDED_SURFACE_ORIENTATION_INVERTEDPORTRAITORIENTATION; + case Qt::LandscapeOrientation: return QT_EXTENDED_SURFACE_ORIENTATION_LANDSCAPEORIENTATION; + case Qt::InvertedLandscapeOrientation: return QT_EXTENDED_SURFACE_ORIENTATION_INVERTEDLANDSCAPEORIENTATION; + default: return QT_EXTENDED_SURFACE_ORIENTATION_PRIMARYORIENTATION; + } +} + +void QWaylandExtendedSurface::setContentOrientation(Qt::ScreenOrientation orientation) +{ + set_content_orientation(waylandRotationFromScreenOrientation(orientation)); +} + +QVariantMap QWaylandExtendedSurface::properties() const +{ + return m_properties; +} + +QVariant QWaylandExtendedSurface::property(const QString &name) +{ + return m_properties.value(name); +} + +QVariant QWaylandExtendedSurface::property(const QString &name, const QVariant &defaultValue) +{ + return m_properties.value(name,defaultValue); +} + +void QWaylandExtendedSurface::extended_surface_onscreen_visibility(int32_t visibility) +{ + m_window->window()->setVisibility(static_cast(visibility)); +} + +void QWaylandExtendedSurface::extended_surface_set_generic_property(const QString &name, wl_array *value) +{ + QByteArray data = QByteArray::fromRawData(static_cast(value->data), value->size); + + QVariant variantValue; + QDataStream ds(data); + ds >> variantValue; + + m_properties.insert(name, variantValue); + + QWaylandNativeInterface *nativeInterface = static_cast( + QGuiApplication::platformNativeInterface()); + nativeInterface->emitWindowPropertyChanged(m_window, name); +} + +void QWaylandExtendedSurface::extended_surface_close() +{ + QWindowSystemInterface::handleCloseEvent(m_window->window()); +} + +Qt::WindowFlags QWaylandExtendedSurface::setWindowFlags(Qt::WindowFlags flags) +{ + uint wlFlags = 0; + + if (flags & Qt::WindowStaysOnTopHint) wlFlags |= QT_EXTENDED_SURFACE_WINDOWFLAG_STAYSONTOP; + if (flags & Qt::WindowOverridesSystemGestures) wlFlags |= QT_EXTENDED_SURFACE_WINDOWFLAG_OVERRIDESSYSTEMGESTURES; + if (flags & Qt::BypassWindowManagerHint) wlFlags |= QT_EXTENDED_SURFACE_WINDOWFLAG_BYPASSWINDOWMANAGER; + + set_window_flags(wlFlags); + + return flags & (Qt::WindowStaysOnTopHint | Qt::WindowOverridesSystemGestures | Qt::BypassWindowManagerHint); +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandextendedsurface.h b/src/plugins/platforms/wayland/qwaylandextendedsurface.h new file mode 100644 index 00000000000..8c0546473a8 --- /dev/null +++ b/src/plugins/platforms/wayland/qwaylandextendedsurface.h @@ -0,0 +1,85 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWAYLANDEXTENDEDSURFACE_H +#define QWAYLANDEXTENDEDSURFACE_H + +#include +#include + +#include + +#include +#include + +QT_BEGIN_NAMESPACE + +class QWaylandDisplay; +class QWaylandWindow; + +class Q_WAYLAND_CLIENT_EXPORT QWaylandExtendedSurface : public QtWayland::qt_extended_surface +{ +public: + QWaylandExtendedSurface(QWaylandWindow *window, struct ::qt_extended_surface *extended_surface); + ~QWaylandExtendedSurface(); + + void setContentOrientation(Qt::ScreenOrientation orientation); + + void updateGenericProperty(const QString &name, const QVariant &value); + + QVariantMap properties() const; + QVariant property(const QString &name); + QVariant property(const QString &name, const QVariant &defaultValue); + + Qt::WindowFlags setWindowFlags(Qt::WindowFlags flags); + +private: + void extended_surface_onscreen_visibility(int32_t visibility) Q_DECL_OVERRIDE; + void extended_surface_set_generic_property(const QString &name, wl_array *value) Q_DECL_OVERRIDE; + void extended_surface_close() Q_DECL_OVERRIDE; + + QWaylandWindow *m_window; + QVariantMap m_properties; +}; + +QT_END_NAMESPACE + +#endif // QWAYLANDEXTENDEDSURFACE_H diff --git a/src/plugins/platforms/wayland/qwaylandglintegration.cpp b/src/plugins/platforms/wayland/qwaylandglintegration.cpp new file mode 100644 index 00000000000..bafb99443ba --- /dev/null +++ b/src/plugins/platforms/wayland/qwaylandglintegration.cpp @@ -0,0 +1,56 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qwaylandglintegration.h" + +QT_BEGIN_NAMESPACE + +QWaylandGLIntegration::QWaylandGLIntegration() +{ + +} + +QWaylandGLIntegration::~QWaylandGLIntegration() +{ + +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandglintegration.h b/src/plugins/platforms/wayland/qwaylandglintegration.h new file mode 100644 index 00000000000..7697d31034b --- /dev/null +++ b/src/plugins/platforms/wayland/qwaylandglintegration.h @@ -0,0 +1,76 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWAYLANDGLINTEGRATION_H +#define QWAYLANDGLINTEGRATION_H + +#include +#include + +QT_BEGIN_NAMESPACE + +class QWaylandWindow; +class QWaylandDisplay; +class QWindow; + +class QPlatformOpenGLContext; +class QSurfaceFormat; + +class Q_WAYLAND_CLIENT_EXPORT QWaylandGLIntegration +{ +public: + QWaylandGLIntegration(); + virtual ~QWaylandGLIntegration(); + + virtual void initialize() = 0; + virtual bool waitingForEvents() { return false; } + + virtual bool supportsThreadedOpenGL() const { return false; } + + virtual QWaylandWindow *createEglWindow(QWindow *window) = 0; + virtual QPlatformOpenGLContext *createPlatformOpenGLContext(const QSurfaceFormat &glFormat, QPlatformOpenGLContext *share) const = 0; + + static QWaylandGLIntegration *createGLIntegration(QWaylandDisplay *waylandDisplay); +}; + +QT_END_NAMESPACE + +#endif // QWAYLANDGLINTEGRATION_H diff --git a/src/plugins/platforms/wayland/qwaylandinputcontext.cpp b/src/plugins/platforms/wayland/qwaylandinputcontext.cpp new file mode 100644 index 00000000000..f50581b3ad6 --- /dev/null +++ b/src/plugins/platforms/wayland/qwaylandinputcontext.cpp @@ -0,0 +1,260 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Klarälvdalens Datakonsult AB (KDAB). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Compositor. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qwaylandinputcontext.h" + +#include +#include +#ifndef QT_NO_WAYLAND_XKB +#include +#endif + +#include "qwaylanddisplay.h" +#include "qwaylandinputdevice.h" +#include "qwaylandwindow.h" + +QT_BEGIN_NAMESPACE + +static Qt::Key toQtKey(uint32_t sym) +{ +#ifndef QT_NO_WAYLAND_XKB + switch (static_cast(sym)) { + case XKB_KEY_BackSpace: + return Qt::Key_Backspace; + case XKB_KEY_Return: + return Qt::Key_Return; + case XKB_KEY_Left: + return Qt::Key_Left; + case XKB_KEY_Up: + return Qt::Key_Up; + case XKB_KEY_Right: + return Qt::Key_Right; + case XKB_KEY_Down: + return Qt::Key_Down; + default: + return Qt::Key_unknown; + } +#else + return Qt::Key_unknown; +#endif +} + +static QEvent::Type toQEventType(uint32_t state) +{ + switch (static_cast(state)) { + default: + case WL_KEYBOARD_KEY_STATE_PRESSED: + return QEvent::KeyPress; + case WL_KEYBOARD_KEY_STATE_RELEASED: + return QEvent::KeyRelease; + } +} + +QWaylandTextInput::QWaylandTextInput(struct ::wl_text_input *text_input) + : QtWayland::wl_text_input(text_input) + , m_commit() + , m_serial(0) + , m_resetSerial(0) +{ +} + +QString QWaylandTextInput::commitString() const +{ + return m_commit; +} + +void QWaylandTextInput::reset() +{ + wl_text_input::reset(); + updateState(); + m_resetSerial = m_serial; +} + +void QWaylandTextInput::updateState() +{ + if (!QGuiApplication::focusObject()) + return; + + QInputMethodQueryEvent event(Qt::ImQueryAll); + QCoreApplication::sendEvent(QGuiApplication::focusObject(), &event); + + const QString &text = event.value(Qt::ImSurroundingText).toString(); + const int cursor = event.value(Qt::ImCursorPosition).toInt(); + const int anchor = event.value(Qt::ImAnchorPosition).toInt(); + + set_surrounding_text(text, text.leftRef(cursor).toUtf8().size(), text.leftRef(anchor).toUtf8().size()); + + commit_state(++m_serial); +} + +void QWaylandTextInput::text_input_commit_string(uint32_t serial, const QString &text) +{ + if (!QGuiApplication::focusObject()) + return; + + QInputMethodEvent event; + event.setCommitString(text); + QCoreApplication::sendEvent(QGuiApplication::focusObject(), &event); +} + +void QWaylandTextInput::text_input_enter(wl_surface *) +{ + updateState(); + m_resetSerial = m_serial; +} + +void QWaylandTextInput::text_input_leave() +{ +} + +void QWaylandTextInput::text_input_keysym(uint32_t serial, uint32_t time, uint32_t sym, uint32_t state, uint32_t modifiers) +{ + if (!QGuiApplication::focusObject()) + return; + + // TODO: Convert modifiers to Qt::KeyboardModifiers. + QKeyEvent event(toQEventType(state), toQtKey(sym), Qt::NoModifier); + QCoreApplication::sendEvent(qGuiApp->focusWindow(), &event); +} + +QWaylandInputContext::QWaylandInputContext(QWaylandDisplay *display) + : QPlatformInputContext() + , mDisplay(display) + , mTextInput() +{ +} + +bool QWaylandInputContext::isValid() const +{ + return mDisplay->textInputManager() != 0; +} + +void QWaylandInputContext::reset() +{ + if (!ensureTextInput()) + return; + + mTextInput->reset(); +} + +void QWaylandInputContext::commit() +{ + if (!ensureTextInput()) + return; + + if (!QGuiApplication::focusObject()) + return; + + QInputMethodEvent event; + event.setCommitString(mTextInput->commitString()); + QCoreApplication::sendEvent(QGuiApplication::focusObject(), &event); + + mTextInput->reset(); +} + +void QWaylandInputContext::update(Qt::InputMethodQueries queries) +{ + if (!ensureTextInput()) + return; + + mTextInput->updateState(); +} + +void QWaylandInputContext::invokeAction(QInputMethod::Action, int cursorPosition) +{ + if (!ensureTextInput()) + return; + + mTextInput->invoke_action(0, cursorPosition); // FIXME button, to UTF8 cursor position +} + +void QWaylandInputContext::showInputPanel() +{ + if (!ensureTextInput()) + return; + + mTextInput->show_input_panel(); +} + +void QWaylandInputContext::hideInputPanel() +{ + if (!ensureTextInput()) + return; + + mTextInput->hide_input_panel(); +} + +bool QWaylandInputContext::isInputPanelVisible() const +{ + return false; +} + +void QWaylandInputContext::setFocusObject(QObject *object) +{ + if (!ensureTextInput()) + return; + + if (!object) { + mTextInput->deactivate(mDisplay->defaultInputDevice()->wl_seat()); + return; + } + + QWindow *window = QGuiApplication::focusWindow(); + if (!window || !window->handle()) + return; + + struct ::wl_surface *surface = static_cast(window->handle())->object(); + mTextInput->activate(mDisplay->defaultInputDevice()->wl_seat(), surface); +} + +bool QWaylandInputContext::ensureTextInput() +{ + if (mTextInput) + return true; + + if (!isValid()) + return false; + + mTextInput.reset(new QWaylandTextInput(mDisplay->textInputManager()->create_text_input())); + return true; +} + +QT_END_NAMESPACE + diff --git a/src/plugins/platforms/wayland/qwaylandinputcontext.h b/src/plugins/platforms/wayland/qwaylandinputcontext.h new file mode 100644 index 00000000000..1f7e4e3616f --- /dev/null +++ b/src/plugins/platforms/wayland/qwaylandinputcontext.h @@ -0,0 +1,103 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Klarälvdalens Datakonsult AB (KDAB). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Compositor. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWAYLANDINPUTCONTEXT_H +#define QWAYLANDINPUTCONTEXT_H + +#include + +#include + +QT_BEGIN_NAMESPACE + +class QWaylandDisplay; + +class QWaylandTextInput : public QtWayland::wl_text_input +{ +public: + QWaylandTextInput(struct ::wl_text_input *text_input); + + QString commitString() const; + + void reset(); + void updateState(); + +protected: + void text_input_commit_string(uint32_t serial, const QString &text) Q_DECL_OVERRIDE; + void text_input_enter(wl_surface *surface) Q_DECL_OVERRIDE; + void text_input_leave() Q_DECL_OVERRIDE; + void text_input_keysym(uint32_t serial, uint32_t time, uint32_t sym, uint32_t state, uint32_t modifiers); + +private: + QString m_commit; + + uint32_t m_serial; + uint32_t m_resetSerial; +}; + +class QWaylandInputContext : public QPlatformInputContext +{ + Q_OBJECT +public: + explicit QWaylandInputContext(QWaylandDisplay *display); + + bool isValid() const Q_DECL_OVERRIDE; + + void reset() Q_DECL_OVERRIDE; + void commit() Q_DECL_OVERRIDE; + void update(Qt::InputMethodQueries) Q_DECL_OVERRIDE; + void invokeAction(QInputMethod::Action, int cursorPosition) Q_DECL_OVERRIDE; + + void showInputPanel() Q_DECL_OVERRIDE; + void hideInputPanel() Q_DECL_OVERRIDE; + bool isInputPanelVisible() const Q_DECL_OVERRIDE; + + void setFocusObject(QObject *object) Q_DECL_OVERRIDE; + +private: + bool ensureTextInput(); + + QWaylandDisplay *mDisplay; + QScopedPointer mTextInput; +}; + +QT_END_NAMESPACE + +#endif // QWAYLANDINPUTCONTEXT_H diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp new file mode 100644 index 00000000000..b9338b4c371 --- /dev/null +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -0,0 +1,798 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qwaylandinputdevice.h" + +#include "qwaylandintegration.h" +#include "qwaylandwindow.h" +#include "qwaylandbuffer.h" +#include "qwaylanddatadevice.h" +#include "qwaylanddatadevicemanager.h" +#include "qwaylandtouch.h" +#include "qwaylandscreen.h" +#include "qwaylandcursor.h" + +#include +#include +#include + +#include +#include +#include + +#include + +#include + +#ifndef QT_NO_WAYLAND_XKB +#include +#include +#endif + +QT_BEGIN_NAMESPACE + +QWaylandInputDevice::QWaylandInputDevice(QWaylandDisplay *display, uint32_t id) + : QObject() + , QtWayland::wl_seat(display->wl_registry(), id) + , mQDisplay(display) + , mDisplay(display->wl_display()) + , mFocusCallback(0) + , mCaps(0) + , mDataDevice(0) + , mPointerFocus(0) + , mKeyboardFocus(0) + , mTouchFocus(0) + , mButtons(0) + , mTime(0) + , mSerial(0) + , mEnterSerial(0) + , mCursorSerial(0) + , mTouchDevice(0) + #ifndef QT_NO_WAYLAND_XKB + , mXkbContext(0) + , mXkbMap(0) + , mXkbState(0) + #endif +{ +#ifndef QT_NO_WAYLAND_XKB + xkb_rule_names names; + names.rules = strdup("evdev"); + names.model = strdup("pc105"); + names.layout = strdup("us"); + names.variant = strdup(""); + names.options = strdup(""); + + mXkbContext = xkb_context_new(xkb_context_flags(0)); + if (mXkbContext) { + mXkbMap = xkb_map_new_from_names(mXkbContext, &names, xkb_map_compile_flags(0)); + if (mXkbMap) { + mXkbState = xkb_state_new(mXkbMap); + } + } + + if (!mXkbContext || !mXkbMap || !mXkbState) + qWarning() << "xkb_map_new_from_names failed, no key input"; +#endif + + if (mQDisplay->dndSelectionHandler()) { + mDataDevice = mQDisplay->dndSelectionHandler()->getDataDevice(this); + } + + connect(&mRepeatTimer, SIGNAL(timeout()), this, SLOT(repeatKey())); +} + +QWaylandInputDevice::~QWaylandInputDevice() +{ +#ifndef QT_NO_WAYLAND_XKB + if (mXkbState) + xkb_state_unref(mXkbState); + if (mXkbMap) + xkb_map_unref(mXkbMap); + if (mXkbContext) + xkb_context_unref(mXkbContext); +#endif +} + +void QWaylandInputDevice::seat_capabilities(uint32_t caps) +{ + mCaps = caps; + + if (caps & WL_SEAT_CAPABILITY_KEYBOARD) + QtWayland::wl_keyboard::init(get_keyboard()); + + if (caps & WL_SEAT_CAPABILITY_POINTER) { + QtWayland::wl_pointer::init(get_pointer()); + pointerSurface = mQDisplay->createSurface(this); + } + + if (caps & WL_SEAT_CAPABILITY_TOUCH) { + QtWayland::wl_touch::init(get_touch()); + + if (!mTouchDevice) { + mTouchDevice = new QTouchDevice; + mTouchDevice->setType(QTouchDevice::TouchScreen); + mTouchDevice->setCapabilities(QTouchDevice::Position); + QWindowSystemInterface::registerTouchDevice(mTouchDevice); + } + } +} + +void QWaylandInputDevice::handleWindowDestroyed(QWaylandWindow *window) +{ + if (window == mPointerFocus) + mPointerFocus = 0; + if (window == mKeyboardFocus) { + mKeyboardFocus = 0; + mRepeatTimer.stop(); + } +} + +void QWaylandInputDevice::setDataDevice(QWaylandDataDevice *device) +{ + mDataDevice = device; +} + +QWaylandDataDevice *QWaylandInputDevice::dataDevice() const +{ + Q_ASSERT(mDataDevice); + return mDataDevice; +} + +void QWaylandInputDevice::removeMouseButtonFromState(Qt::MouseButton button) +{ + mButtons = mButtons & !button; +} + +QWaylandWindow *QWaylandInputDevice::pointerFocus() const +{ + return mPointerFocus; +} + +Qt::KeyboardModifiers QWaylandInputDevice::modifiers() const +{ + Qt::KeyboardModifiers ret = Qt::NoModifier; + +#ifndef QT_NO_WAYLAND_XKB + xkb_state_component cstate = static_cast(XKB_STATE_DEPRESSED | XKB_STATE_LATCHED); + + if (xkb_state_mod_name_is_active(mXkbState, "Shift", cstate)) + ret |= Qt::ShiftModifier; + if (xkb_state_mod_name_is_active(mXkbState, "Control", cstate)) + ret |= Qt::ControlModifier; + if (xkb_state_mod_name_is_active(mXkbState, "Alt", cstate)) + ret |= Qt::AltModifier; + if (xkb_state_mod_name_is_active(mXkbState, "Mod1", cstate)) + ret |= Qt::AltModifier; + if (xkb_state_mod_name_is_active(mXkbState, "Mod4", cstate)) + ret |= Qt::MetaModifier; +#endif + + return ret; +} + +void QWaylandInputDevice::setCursor(Qt::CursorShape newShape, QWaylandScreen *screen) +{ + struct wl_cursor_image *image = screen->waylandCursor()->cursorImage(newShape); + if (!image) { + return; + } + + struct wl_buffer *buffer = wl_cursor_image_get_buffer(image); + setCursor(buffer, image); +} + +void QWaylandInputDevice::setCursor(struct wl_buffer *buffer, struct wl_cursor_image *image) +{ + if (mCaps & WL_SEAT_CAPABILITY_POINTER) { + mCursorSerial = mEnterSerial; + /* Hide cursor */ + if (!buffer) + { + set_cursor(mEnterSerial, NULL, 0, 0); + return; + } + + set_cursor(mEnterSerial, pointerSurface, + image->hotspot_x, image->hotspot_y); + wl_surface_attach(pointerSurface, buffer, 0, 0); + wl_surface_damage(pointerSurface, 0, 0, image->width, image->height); + wl_surface_commit(pointerSurface); + } +} + +void QWaylandInputDevice::pointer_enter(uint32_t serial, struct wl_surface *surface, + wl_fixed_t sx, wl_fixed_t sy) +{ + Q_UNUSED(sx); + Q_UNUSED(sy); + + if (!surface) + return; + + QWaylandWindow *window = QWaylandWindow::fromWlSurface(surface); + window->window()->setCursor(window->window()->cursor()); + + mPointerFocus = window; + + mTime = QWaylandDisplay::currentTimeMillisec(); + mSerial = serial; + mEnterSerial = serial; + + QWaylandWindow *grab = QWaylandWindow::mouseGrab(); + if (!grab) { + window->handleMouseEnter(this); + window->handleMouse(this, mTime, mSurfacePos, mGlobalPos, mButtons, Qt::NoModifier); + } +} + +void QWaylandInputDevice::pointer_leave(uint32_t time, struct wl_surface *surface) +{ + // The event may arrive after destroying the window, indicated by + // a null surface. + if (!surface) + return; + + if (!QWaylandWindow::mouseGrab()) { + QWaylandWindow *window = QWaylandWindow::fromWlSurface(surface); + window->handleMouseLeave(this); + } + mPointerFocus = 0; + mButtons = Qt::NoButton; + + mTime = time; +} + +void QWaylandInputDevice::pointer_motion(uint32_t time, wl_fixed_t surface_x, wl_fixed_t surface_y) +{ + Q_UNUSED(surface_x); + Q_UNUSED(surface_y); + + QWaylandWindow *window = mPointerFocus; + + if (window == NULL) { + // We destroyed the pointer focus surface, but the server + // didn't get the message yet. + return; + } + + QPointF pos(wl_fixed_to_double(surface_x), wl_fixed_to_double(surface_y)); + QPointF delta = pos - pos.toPoint(); + QPointF global = window->window()->mapToGlobal(pos.toPoint()); + global += delta; + + mSurfacePos = pos; + mGlobalPos = global; + mTime = time; + + QWaylandWindow *grab = QWaylandWindow::mouseGrab(); + if (grab && grab != window) { + // We can't know the true position since we're getting events for another surface, + // so we just set it outside of the window boundaries. + pos = QPointF(-1, -1); + global = grab->window()->mapToGlobal(pos.toPoint()); + grab->handleMouse(this, time, pos, global, mButtons, Qt::NoModifier); + } else + window->handleMouse(this, time, mSurfacePos, mGlobalPos, mButtons, Qt::NoModifier); +} + +void QWaylandInputDevice::pointer_button(uint32_t serial, uint32_t time, + uint32_t button, uint32_t state) +{ + Q_UNUSED(serial); + QWaylandWindow *window = mPointerFocus; + Qt::MouseButton qt_button; + + // translate from kernel (input.h) 'button' to corresponding Qt:MouseButton. + // The range of mouse values is 0x110 <= mouse_button < 0x120, the first Joystick button. + switch (button) { + case 0x110: qt_button = Qt::LeftButton; break; // kernel BTN_LEFT + case 0x111: qt_button = Qt::RightButton; break; + case 0x112: qt_button = Qt::MiddleButton; break; + case 0x113: qt_button = Qt::ExtraButton1; break; // AKA Qt::BackButton + case 0x114: qt_button = Qt::ExtraButton2; break; // AKA Qt::ForwardButton + case 0x115: qt_button = Qt::ExtraButton3; break; // AKA Qt::TaskButton + case 0x116: qt_button = Qt::ExtraButton4; break; + case 0x117: qt_button = Qt::ExtraButton5; break; + case 0x118: qt_button = Qt::ExtraButton6; break; + case 0x119: qt_button = Qt::ExtraButton7; break; + case 0x11a: qt_button = Qt::ExtraButton8; break; + case 0x11b: qt_button = Qt::ExtraButton9; break; + case 0x11c: qt_button = Qt::ExtraButton10; break; + case 0x11d: qt_button = Qt::ExtraButton11; break; + case 0x11e: qt_button = Qt::ExtraButton12; break; + case 0x11f: qt_button = Qt::ExtraButton13; break; + default: return; // invalid button number (as far as Qt is concerned) + } + + if (state) + mButtons |= qt_button; + else + mButtons &= ~qt_button; + + mTime = time; + mSerial = serial; + + QWaylandWindow *grab = QWaylandWindow::mouseGrab(); + if (grab && grab != mPointerFocus) { + QPointF pos = QPointF(-1, -1); + QPointF global = grab->window()->mapToGlobal(pos.toPoint()); + grab->handleMouse(this, time, pos, global, mButtons, Qt::NoModifier); + } else if (window) + window->handleMouse(this, time, mSurfacePos, mGlobalPos, mButtons, Qt::NoModifier); +} + +void QWaylandInputDevice::pointer_axis(uint32_t time, uint32_t axis, int32_t value) +{ + QWaylandWindow *window = mPointerFocus; + QPoint pixelDelta; + QPoint angleDelta; + + //normalize value and inverse axis + int valueDelta = wl_fixed_to_int(value) * -12; + + if (axis == WL_POINTER_AXIS_HORIZONTAL_SCROLL) { + pixelDelta = QPoint(); + angleDelta.setX(valueDelta); + } else { + pixelDelta = QPoint(); + angleDelta.setY(valueDelta); + } + + QWindowSystemInterface::handleWheelEvent(window->window(), + time, mSurfacePos, + mGlobalPos, pixelDelta, + angleDelta); +} + +#ifndef QT_NO_WAYLAND_XKB + +static const uint32_t KeyTbl[] = { + XK_Escape, Qt::Key_Escape, + XK_Tab, Qt::Key_Tab, + XK_ISO_Left_Tab, Qt::Key_Backtab, + XK_BackSpace, Qt::Key_Backspace, + XK_Return, Qt::Key_Return, + XK_Insert, Qt::Key_Insert, + XK_Delete, Qt::Key_Delete, + XK_Clear, Qt::Key_Delete, + XK_Pause, Qt::Key_Pause, + XK_Print, Qt::Key_Print, + + XK_Home, Qt::Key_Home, + XK_End, Qt::Key_End, + XK_Left, Qt::Key_Left, + XK_Up, Qt::Key_Up, + XK_Right, Qt::Key_Right, + XK_Down, Qt::Key_Down, + XK_Prior, Qt::Key_PageUp, + XK_Next, Qt::Key_PageDown, + + XK_Shift_L, Qt::Key_Shift, + XK_Shift_R, Qt::Key_Shift, + XK_Shift_Lock, Qt::Key_Shift, + XK_Control_L, Qt::Key_Control, + XK_Control_R, Qt::Key_Control, + XK_Meta_L, Qt::Key_Meta, + XK_Meta_R, Qt::Key_Meta, + XK_Alt_L, Qt::Key_Alt, + XK_Alt_R, Qt::Key_Alt, + XK_Caps_Lock, Qt::Key_CapsLock, + XK_Num_Lock, Qt::Key_NumLock, + XK_Scroll_Lock, Qt::Key_ScrollLock, + XK_Super_L, Qt::Key_Super_L, + XK_Super_R, Qt::Key_Super_R, + XK_Menu, Qt::Key_Menu, + XK_Hyper_L, Qt::Key_Hyper_L, + XK_Hyper_R, Qt::Key_Hyper_R, + XK_Help, Qt::Key_Help, + + XK_KP_Space, Qt::Key_Space, + XK_KP_Tab, Qt::Key_Tab, + XK_KP_Enter, Qt::Key_Enter, + XK_KP_Home, Qt::Key_Home, + XK_KP_Left, Qt::Key_Left, + XK_KP_Up, Qt::Key_Up, + XK_KP_Right, Qt::Key_Right, + XK_KP_Down, Qt::Key_Down, + XK_KP_Prior, Qt::Key_PageUp, + XK_KP_Next, Qt::Key_PageDown, + XK_KP_End, Qt::Key_End, + XK_KP_Begin, Qt::Key_Clear, + XK_KP_Insert, Qt::Key_Insert, + XK_KP_Delete, Qt::Key_Delete, + XK_KP_Equal, Qt::Key_Equal, + XK_KP_Multiply, Qt::Key_Asterisk, + XK_KP_Add, Qt::Key_Plus, + XK_KP_Separator, Qt::Key_Comma, + XK_KP_Subtract, Qt::Key_Minus, + XK_KP_Decimal, Qt::Key_Period, + XK_KP_Divide, Qt::Key_Slash, + + XK_ISO_Level3_Shift, Qt::Key_AltGr, + XK_Multi_key, Qt::Key_Multi_key, + XK_Codeinput, Qt::Key_Codeinput, + XK_SingleCandidate, Qt::Key_SingleCandidate, + XK_MultipleCandidate, Qt::Key_MultipleCandidate, + XK_PreviousCandidate, Qt::Key_PreviousCandidate, + + XK_Mode_switch, Qt::Key_Mode_switch, + XK_script_switch, Qt::Key_Mode_switch, + + 0, 0 +}; + +static int keysymToQtKey(xkb_keysym_t key) +{ + int code = 0; + int i = 0; + while (KeyTbl[i]) { + if (key == KeyTbl[i]) { + code = (int)KeyTbl[i+1]; + break; + } + i += 2; + } + + return code; +} + +static int keysymToQtKey(xkb_keysym_t keysym, Qt::KeyboardModifiers &modifiers, const QString &text) +{ + int code = 0; + + if (keysym >= XKB_KEY_F1 && keysym <= XKB_KEY_F35) { + code = Qt::Key_F1 + (int(keysym) - XKB_KEY_F1); + } else if (keysym >= XKB_KEY_KP_Space && keysym <= XKB_KEY_KP_9) { + if (keysym >= XKB_KEY_KP_0) { + // numeric keypad keys + code = Qt::Key_0 + ((int)keysym - XKB_KEY_KP_0); + } else { + code = keysymToQtKey(keysym); + } + modifiers |= Qt::KeypadModifier; + } else if (text.length() == 1 && text.unicode()->unicode() > 0x1f + && text.unicode()->unicode() != 0x7f + && !(keysym >= XKB_KEY_dead_grave && keysym <= XKB_KEY_dead_currency)) { + code = text.unicode()->toUpper().unicode(); + } else { + // any other keys + code = keysymToQtKey(keysym); + } + + return code; +} + +#endif // QT_NO_WAYLAND_XKB + +void QWaylandInputDevice::keyboard_keymap(uint32_t format, int32_t fd, uint32_t size) +{ +#ifndef QT_NO_WAYLAND_XKB + if (format != WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1) { + close(fd); + return; + } + + char *map_str = (char *)mmap(NULL, size, PROT_READ, MAP_SHARED, fd, 0); + if (map_str == MAP_FAILED) { + close(fd); + return; + } + + mXkbMap = xkb_map_new_from_string(mXkbContext, map_str, XKB_KEYMAP_FORMAT_TEXT_V1, (xkb_keymap_compile_flags)0); + munmap(map_str, size); + close(fd); + + mXkbState = xkb_state_new(mXkbMap); +#else + Q_UNUSED(format); + Q_UNUSED(fd); + Q_UNUSED(size); +#endif +} + +void QWaylandInputDevice::keyboard_enter(uint32_t time, struct wl_surface *surface, struct wl_array *keys) +{ + Q_UNUSED(time); + Q_UNUSED(keys); + + if (!surface) + return; + + + QWaylandWindow *window = QWaylandWindow::fromWlSurface(surface); + mKeyboardFocus = window; + + if (!mFocusCallback) { + mFocusCallback = wl_display_sync(mDisplay); + wl_callback_add_listener(mFocusCallback, &QWaylandInputDevice::callback, this); + } +} + +void QWaylandInputDevice::keyboard_leave(uint32_t time, struct wl_surface *surface) +{ + Q_UNUSED(time); + Q_UNUSED(surface); + + mKeyboardFocus = NULL; + + // Use a callback to set the focus because we may get a leave/enter pair, and + // the latter one would be lost in the QWindowSystemInterface queue, if + // we issue the handleWindowActivated() calls immediately. + if (!mFocusCallback) { + mFocusCallback = wl_display_sync(mDisplay); + wl_callback_add_listener(mFocusCallback, &QWaylandInputDevice::callback, this); + } + mRepeatTimer.stop(); +} + +const wl_callback_listener QWaylandInputDevice::callback = { + QWaylandInputDevice::focusCallback +}; + +void QWaylandInputDevice::focusCallback(void *data, struct wl_callback *callback, uint32_t time) +{ + Q_UNUSED(time); + Q_UNUSED(callback); + QWaylandInputDevice *self = static_cast(data); + if (self->mFocusCallback) { + wl_callback_destroy(self->mFocusCallback); + self->mFocusCallback = 0; + } + + self->mQDisplay->setLastKeyboardFocusInputDevice(self->mKeyboardFocus ? self : 0); + QWindowSystemInterface::handleWindowActivated(self->mKeyboardFocus ? self->mKeyboardFocus->window() : 0); +} + +void QWaylandInputDevice::keyboard_key(uint32_t serial, uint32_t time, uint32_t key, uint32_t state) +{ + Q_UNUSED(serial); + QWaylandWindow *window = mKeyboardFocus; +#ifndef QT_NO_WAYLAND_XKB + if (!mXkbMap) + return; + + uint32_t code = key + 8; + bool isDown = state != 0; + const xkb_keysym_t *syms; + uint32_t numSyms = xkb_key_get_syms(mXkbState, code, &syms); + xkb_state_update_key(mXkbState, code, + isDown ? XKB_KEY_DOWN : XKB_KEY_UP); + QEvent::Type type = isDown ? QEvent::KeyPress : QEvent::KeyRelease; + + if (!window) { + // We destroyed the keyboard focus surface, but the server + // didn't get the message yet. + return; + } + + int qtkey = key + 8; // qt-compositor substracts 8 for some reason + QString text; + + if (numSyms == 1) { + xkb_keysym_t sym = syms[0]; + Qt::KeyboardModifiers modifiers = this->modifiers(); + + uint utf32 = xkb_keysym_to_utf32(sym); + text = QString::fromUcs4(&utf32, 1); + + qtkey = keysymToQtKey(sym, modifiers, text); + + QWindowSystemInterface::handleExtendedKeyEvent(window->window(), + time, type, qtkey, + modifiers, + code, 0, 0, text); + } +#else + // Generic fallback for single hard keys: Assume 'key' is a Qt key code. + if (window) { + QWindowSystemInterface::handleExtendedKeyEvent(window->window(), + time, type, + qtkey, + Qt::NoModifier, + code, 0, 0); + } +#endif + + if (state == WL_KEYBOARD_KEY_STATE_PRESSED) { + mRepeatKey = qtkey; + mRepeatCode = code; + mRepeatTime = time; + mRepeatText = text; + mRepeatTimer.setInterval(400); + mRepeatTimer.start(); + } else { + mRepeatTimer.stop(); + } +} + +void QWaylandInputDevice::repeatKey() +{ + mRepeatTimer.setInterval(25); + QWindowSystemInterface::handleExtendedKeyEvent(mKeyboardFocus->window(), + mRepeatTime, QEvent::KeyPress, mRepeatKey, + Qt::NoModifier, + mRepeatCode, 0, 0, mRepeatText); +} + +void QWaylandInputDevice::keyboard_modifiers(uint32_t serial, + uint32_t mods_depressed, + uint32_t mods_latched, + uint32_t mods_locked, + uint32_t group) +{ + Q_UNUSED(serial); +#ifndef QT_NO_WAYLAND_XKB + if (mXkbState) + xkb_state_update_mask(mXkbState, + mods_depressed, mods_latched, mods_locked, + 0, 0, group); +#else + Q_UNUSED(serial); + Q_UNUSED(mods_depressed); + Q_UNUSED(mods_latched); + Q_UNUSED(mods_locked); + Q_UNUSED(group); +#endif +} + +void QWaylandInputDevice::touch_down(uint32_t serial, + uint32_t time, + struct wl_surface *surface, + int32_t id, + wl_fixed_t x, + wl_fixed_t y) +{ + Q_UNUSED(serial); + Q_UNUSED(time); + mTouchFocus = QWaylandWindow::fromWlSurface(surface); + handleTouchPoint(id, wl_fixed_to_double(x), wl_fixed_to_double(y), Qt::TouchPointPressed); +} + +void QWaylandInputDevice::touch_up(uint32_t serial, uint32_t time, int32_t id) +{ + Q_UNUSED(serial); + Q_UNUSED(time); + mTouchFocus = 0; + handleTouchPoint(id, 0, 0, Qt::TouchPointReleased); +} + +void QWaylandInputDevice::touch_motion(uint32_t time, int32_t id, wl_fixed_t x, wl_fixed_t y) +{ + Q_UNUSED(time); + handleTouchPoint(id, wl_fixed_to_double(x), wl_fixed_to_double(y), Qt::TouchPointMoved); +} + +void QWaylandInputDevice::touch_cancel() +{ + mPrevTouchPoints.clear(); + mTouchPoints.clear(); + + QWaylandTouchExtension *touchExt = mQDisplay->touchExtension(); + if (touchExt) + touchExt->touchCanceled(); + + QWindowSystemInterface::handleTouchCancelEvent(0, mTouchDevice); +} + +void QWaylandInputDevice::handleTouchPoint(int id, double x, double y, Qt::TouchPointState state) +{ + QWindowSystemInterface::TouchPoint tp; + + // Find out the coordinates for Released events. + bool coordsOk = false; + if (state == Qt::TouchPointReleased) + for (int i = 0; i < mPrevTouchPoints.count(); ++i) + if (mPrevTouchPoints.at(i).id == id) { + tp.area = mPrevTouchPoints.at(i).area; + coordsOk = true; + break; + } + + if (!coordsOk) { + // x and y are surface relative. + // We need a global (screen) position. + QWaylandWindow *win = mTouchFocus; + + //is it possible that mTouchFocus is null; + if (!win) + win = mPointerFocus; + if (!win) + win = mKeyboardFocus; + if (!win || !win->window()) + return; + + tp.area = QRectF(0, 0, 8, 8); + QMargins margins = win->frameMargins(); + tp.area.moveCenter(win->window()->mapToGlobal(QPoint(x+margins.left(), y+margins.top()))); + } + + tp.state = state; + tp.id = id; + tp.pressure = tp.state == Qt::TouchPointReleased ? 0 : 1; + mTouchPoints.append(tp); +} + +void QWaylandInputDevice::touch_frame() +{ + // Copy all points, that are in the previous but not in the current list, as stationary. + for (int i = 0; i < mPrevTouchPoints.count(); ++i) { + const QWindowSystemInterface::TouchPoint &prevPoint(mPrevTouchPoints.at(i)); + if (prevPoint.state == Qt::TouchPointReleased) + continue; + bool found = false; + for (int j = 0; j < mTouchPoints.count(); ++j) + if (mTouchPoints.at(j).id == prevPoint.id) { + found = true; + break; + } + if (!found) { + QWindowSystemInterface::TouchPoint p = prevPoint; + p.state = Qt::TouchPointStationary; + mTouchPoints.append(p); + } + } + + if (mTouchPoints.isEmpty()) { + mPrevTouchPoints.clear(); + return; + } + + QWindow *window = mTouchFocus ? mTouchFocus->window() : 0; + + QWindowSystemInterface::handleTouchEvent(window, mTouchDevice, mTouchPoints); + + bool allReleased = true; + for (int i = 0; i < mTouchPoints.count(); ++i) + if (mTouchPoints.at(i).state != Qt::TouchPointReleased) { + allReleased = false; + break; + } + + mPrevTouchPoints = mTouchPoints; + mTouchPoints.clear(); + + if (allReleased) { + QWindowSystemInterface::handleTouchEvent(window, mTouchDevice, mTouchPoints); + mPrevTouchPoints.clear(); + } +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.h b/src/plugins/platforms/wayland/qwaylandinputdevice.h new file mode 100644 index 00000000000..625d773d14d --- /dev/null +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.h @@ -0,0 +1,204 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWAYLANDINPUTDEVICE_H +#define QWAYLANDINPUTDEVICE_H + +#include "qwaylandwindow.h" + +#include +#include +#include +#include +#include +#include + +#include + +#include + +#ifndef QT_NO_WAYLAND_XKB +struct xkb_context; +struct xkb_keymap; +struct xkb_state; +#endif + +QT_BEGIN_NAMESPACE + +class QWaylandWindow; +class QWaylandDisplay; +class QWaylandDataDevice; + +class Q_WAYLAND_CLIENT_EXPORT QWaylandInputDevice + : public QObject + , public QtWayland::wl_pointer + , public QtWayland::wl_keyboard + , public QtWayland::wl_touch + , public QtWayland::wl_seat +{ + Q_OBJECT +public: + QWaylandInputDevice(QWaylandDisplay *display, uint32_t id); + ~QWaylandInputDevice(); + + uint32_t capabilities() const { return mCaps; } + + struct ::wl_seat *wl_seat() { return QtWayland::wl_seat::object(); } + + void setCursor(Qt::CursorShape cursor, QWaylandScreen *screen); + void setCursor(struct wl_buffer *buffer, struct wl_cursor_image *image); + void handleWindowDestroyed(QWaylandWindow *window); + + void setDataDevice(QWaylandDataDevice *device); + QWaylandDataDevice *dataDevice() const; + + void removeMouseButtonFromState(Qt::MouseButton button); + + QWaylandWindow *pointerFocus() const; + + Qt::KeyboardModifiers modifiers() const; + + uint32_t serial() const; + uint32_t cursorSerial() const { return mCursorSerial; } + +private slots: + void repeatKey(); + +private: + QWaylandDisplay *mQDisplay; + struct wl_display *mDisplay; + struct wl_callback *mFocusCallback; + + uint32_t mCaps; + + struct wl_surface *pointerSurface; + + QWaylandDataDevice *mDataDevice; + QWaylandWindow *mPointerFocus; + QWaylandWindow *mKeyboardFocus; + QWaylandWindow *mTouchFocus; + + Qt::MouseButtons mButtons; + QPointF mSurfacePos; + QPointF mGlobalPos; + uint32_t mTime; + uint32_t mSerial; + uint32_t mEnterSerial; + uint32_t mCursorSerial; + + void seat_capabilities(uint32_t caps) Q_DECL_OVERRIDE; + + void pointer_enter(uint32_t serial, struct wl_surface *surface, + wl_fixed_t sx, wl_fixed_t sy) Q_DECL_OVERRIDE; + void pointer_leave(uint32_t time, struct wl_surface *surface); + void pointer_motion(uint32_t time, + wl_fixed_t sx, wl_fixed_t sy) Q_DECL_OVERRIDE; + void pointer_button(uint32_t serial, uint32_t time, + uint32_t button, uint32_t state) Q_DECL_OVERRIDE; + void pointer_axis(uint32_t time, + uint32_t axis, + wl_fixed_t value) Q_DECL_OVERRIDE; + + void keyboard_keymap(uint32_t format, + int32_t fd, + uint32_t size) Q_DECL_OVERRIDE; + void keyboard_enter(uint32_t time, + struct wl_surface *surface, + struct wl_array *keys) Q_DECL_OVERRIDE; + void keyboard_leave(uint32_t time, + struct wl_surface *surface) Q_DECL_OVERRIDE; + void keyboard_key(uint32_t serial, uint32_t time, + uint32_t key, uint32_t state) Q_DECL_OVERRIDE; + void keyboard_modifiers(uint32_t serial, + uint32_t mods_depressed, + uint32_t mods_latched, + uint32_t mods_locked, + uint32_t group) Q_DECL_OVERRIDE; + + void touch_down(uint32_t serial, + uint32_t time, + struct wl_surface *surface, + int32_t id, + wl_fixed_t x, + wl_fixed_t y) Q_DECL_OVERRIDE; + void touch_up(uint32_t serial, + uint32_t time, + int32_t id) Q_DECL_OVERRIDE; + void touch_motion(uint32_t time, + int32_t id, + wl_fixed_t x, + wl_fixed_t y) Q_DECL_OVERRIDE; + void touch_frame() Q_DECL_OVERRIDE; + void touch_cancel() Q_DECL_OVERRIDE; + + void handleTouchPoint(int id, double x, double y, Qt::TouchPointState state); + + static const wl_callback_listener callback; + static void focusCallback(void *data, struct wl_callback *callback, uint32_t time); + + QList mTouchPoints; + QList mPrevTouchPoints; + QTouchDevice *mTouchDevice; + +#ifndef QT_NO_WAYLAND_XKB + xkb_context *mXkbContext; + xkb_keymap *mXkbMap; + xkb_state *mXkbState; +#endif + + int mRepeatKey; + uint32_t mRepeatCode; + uint32_t mRepeatTime; + QString mRepeatText; + QTimer mRepeatTimer; + + friend class QWaylandTouchExtension; + friend class QWaylandQtKeyExtension; +}; + +inline uint32_t QWaylandInputDevice::serial() const +{ + return mSerial; +} + +QT_END_NAMESPACE + +#endif diff --git a/src/plugins/platforms/wayland/qwaylandintegration.cpp b/src/plugins/platforms/wayland/qwaylandintegration.cpp new file mode 100644 index 00000000000..9c02419b8e9 --- /dev/null +++ b/src/plugins/platforms/wayland/qwaylandintegration.cpp @@ -0,0 +1,252 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the config.tests of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qwaylandintegration.h" + +#include "qwaylanddisplay.h" +#include "qwaylandinputcontext.h" +#include "qwaylandshmbackingstore.h" +#include "qwaylandshmwindow.h" +#include "qwaylandnativeinterface.h" +#include "qwaylandclipboard.h" +#include "qwaylanddnd.h" +#include "qwaylandwindowmanagerintegration.h" + +#include "QtPlatformSupport/private/qgenericunixfontdatabase_p.h" +#include +#include + +#include + +#include +#include +#include +#include + +#include +#include +#include + +#ifdef QT_WAYLAND_GL_SUPPORT +#include "qwaylandglintegration.h" +#endif + + +QT_BEGIN_NAMESPACE + +class GenericWaylandTheme: public QGenericUnixTheme +{ +public: + static QStringList themeNames() + { + QStringList result; + + if (QGuiApplication::desktopSettingsAware()) { + const QByteArray desktopEnvironment = QGuiApplicationPrivate::platformIntegration()->services()->desktopEnvironment(); + + // Ignore X11 desktop environments + if (!desktopEnvironment.isEmpty() && + desktopEnvironment != QByteArrayLiteral("UNKNOWN") && + desktopEnvironment != QByteArrayLiteral("KDE") && + desktopEnvironment != QByteArrayLiteral("GNOME") && + desktopEnvironment != QByteArrayLiteral("UNITY") && + desktopEnvironment != QByteArrayLiteral("MATE") && + desktopEnvironment != QByteArrayLiteral("XFCE") && + desktopEnvironment != QByteArrayLiteral("LXDE")) + result.push_back(desktopEnvironment.toLower()); + } + + if (result.isEmpty()) + result.push_back(QLatin1String(QGenericUnixTheme::name)); + + return result; + } +}; + +QWaylandIntegration::QWaylandIntegration() + : mFontDb(new QGenericUnixFontDatabase()) + , mNativeInterface(new QWaylandNativeInterface(this)) +#ifndef QT_NO_ACCESSIBILITY + , mAccessibility(new QPlatformAccessibility()) +#else + , mAccessibility(0) +#endif +{ + mDisplay = new QWaylandDisplay(); + mClipboard = new QWaylandClipboard(mDisplay); + mDrag = new QWaylandDrag(mDisplay); + + foreach (QPlatformScreen *screen, mDisplay->screens()) + screenAdded(screen); + + mInputContext.reset(new QWaylandInputContext(mDisplay)); +} + +QWaylandIntegration::~QWaylandIntegration() +{ + delete mDrag; + delete mClipboard; +#ifndef QT_NO_ACCESSIBILITY + delete mAccessibility; +#endif + delete mNativeInterface; + delete mDisplay; +} + +QPlatformNativeInterface * QWaylandIntegration::nativeInterface() const +{ + return mNativeInterface; +} + +bool QWaylandIntegration::hasCapability(QPlatformIntegration::Capability cap) const +{ + switch (cap) { + case ThreadedPixmaps: return true; + case OpenGL: +#ifdef QT_WAYLAND_GL_SUPPORT + return true; +#else + return false; +#endif + case ThreadedOpenGL: +#ifdef QT_WAYLAND_GL_SUPPORT + return mDisplay->eglIntegration()->supportsThreadedOpenGL(); +#else + return false; +#endif + case BufferQueueingOpenGL: + return true; + case MultipleWindows: + case NonFullScreenWindows: + return true; + default: return QPlatformIntegration::hasCapability(cap); + } +} + +QPlatformWindow *QWaylandIntegration::createPlatformWindow(QWindow *window) const +{ +#ifdef QT_WAYLAND_GL_SUPPORT + if (window->surfaceType() == QWindow::OpenGLSurface) + return mDisplay->eglIntegration()->createEglWindow(window); +#endif + return new QWaylandShmWindow(window); +} + +QPlatformOpenGLContext *QWaylandIntegration::createPlatformOpenGLContext(QOpenGLContext *context) const +{ +#ifdef QT_WAYLAND_GL_SUPPORT + return mDisplay->eglIntegration()->createPlatformOpenGLContext(context->format(), context->shareHandle()); +#else + Q_UNUSED(context); + return 0; +#endif +} + +QPlatformBackingStore *QWaylandIntegration::createPlatformBackingStore(QWindow *window) const +{ + return new QWaylandShmBackingStore(window); +} + +QAbstractEventDispatcher *QWaylandIntegration::createEventDispatcher() const +{ + return createUnixEventDispatcher(); +} + +void QWaylandIntegration::initialize() +{ + QAbstractEventDispatcher *dispatcher = QGuiApplicationPrivate::eventDispatcher; + QObject::connect(dispatcher, SIGNAL(aboutToBlock()), mDisplay, SLOT(flushRequests())); +} + +QPlatformFontDatabase *QWaylandIntegration::fontDatabase() const +{ + return mFontDb; +} + +QPlatformClipboard *QWaylandIntegration::clipboard() const +{ + return mClipboard; +} + +QPlatformDrag *QWaylandIntegration::drag() const +{ + return mDrag; +} + +QPlatformInputContext *QWaylandIntegration::inputContext() const +{ + return mInputContext.data(); +} + +QVariant QWaylandIntegration::styleHint(StyleHint hint) const +{ + if (hint == ShowIsFullScreen && mDisplay->windowManagerIntegration()) + return mDisplay->windowManagerIntegration()->showIsFullScreen(); + + return QPlatformIntegration::styleHint(hint); +} + +QPlatformAccessibility *QWaylandIntegration::accessibility() const +{ + return mAccessibility; +} + +QPlatformServices *QWaylandIntegration::services() const +{ + return mDisplay->windowManagerIntegration(); +} + +QWaylandDisplay *QWaylandIntegration::display() const +{ + return mDisplay; +} + +QStringList QWaylandIntegration::themeNames() const +{ + return GenericWaylandTheme::themeNames(); +} + +QPlatformTheme *QWaylandIntegration::createPlatformTheme(const QString &name) const +{ + return GenericWaylandTheme::createUnixTheme(name); +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandintegration.h b/src/plugins/platforms/wayland/qwaylandintegration.h new file mode 100644 index 00000000000..8886c28da5f --- /dev/null +++ b/src/plugins/platforms/wayland/qwaylandintegration.h @@ -0,0 +1,101 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QPLATFORMINTEGRATION_WAYLAND_H +#define QPLATFORMINTEGRATION_WAYLAND_H + +#include + +#include +QT_BEGIN_NAMESPACE + +class QWaylandBuffer; +class QWaylandDisplay; + +class Q_WAYLAND_CLIENT_EXPORT QWaylandIntegration : public QPlatformIntegration +{ +public: + QWaylandIntegration(); + ~QWaylandIntegration(); + + bool hasCapability(QPlatformIntegration::Capability cap) const; + QPlatformWindow *createPlatformWindow(QWindow *window) const; + QPlatformOpenGLContext *createPlatformOpenGLContext(QOpenGLContext *context) const; + QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const; + + QAbstractEventDispatcher *createEventDispatcher() const; + void initialize(); + + QPlatformFontDatabase *fontDatabase() const; + + QPlatformNativeInterface *nativeInterface() const; + + QPlatformClipboard *clipboard() const; + + QPlatformDrag *drag() const; + + QPlatformInputContext *inputContext() const; + + QVariant styleHint(StyleHint hint) const; + + QPlatformAccessibility *accessibility() const; + + QPlatformServices *services() const; + + QWaylandDisplay *display() const; + + QStringList themeNames() const; + + QPlatformTheme *createPlatformTheme(const QString &name) const; + +private: + QPlatformFontDatabase *mFontDb; + QPlatformClipboard *mClipboard; + QPlatformDrag *mDrag; + QWaylandDisplay *mDisplay; + QPlatformNativeInterface *mNativeInterface; + QScopedPointer mInputContext; + QPlatformAccessibility *mAccessibility; +}; + +QT_END_NAMESPACE + +#endif diff --git a/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp b/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp new file mode 100644 index 00000000000..354e8dbaa66 --- /dev/null +++ b/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp @@ -0,0 +1,134 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qwaylandnativeinterface.h" +#include "qwaylanddisplay.h" +#include "qwaylandwindow.h" +#include "qwaylandextendedsurface.h" +#include "qwaylandintegration.h" +#include "qwaylanddisplay.h" +#include "qwaylandwindowmanagerintegration.h" +#include +#include + +QT_BEGIN_NAMESPACE + +QWaylandNativeInterface::QWaylandNativeInterface(QWaylandIntegration *integration) + : m_integration(integration) +{ +} + +void *QWaylandNativeInterface::nativeResourceForIntegration(const QByteArray &resourceString) +{ + QByteArray lowerCaseResource = resourceString.toLower(); + + if (lowerCaseResource == "display") + return m_integration->display()->wl_display(); + if (lowerCaseResource == "compositor") + return const_cast(m_integration->display()->wl_compositor()); + + return 0; +} + +void *QWaylandNativeInterface::nativeResourceForWindow(const QByteArray &resourceString, QWindow *window) +{ + QByteArray lowerCaseResource = resourceString.toLower(); + + if (lowerCaseResource == "display") + return m_integration->display()->wl_display(); + if (lowerCaseResource == "compositor") + return const_cast(m_integration->display()->wl_compositor()); + if (lowerCaseResource == "surface") { + return ((QWaylandWindow *) window->handle())->object(); + } + + return NULL; +} + +void *QWaylandNativeInterface::nativeResourceForScreen(const QByteArray &resourceString, QScreen *screen) +{ + QByteArray lowerCaseResource = resourceString.toLower(); + + if (lowerCaseResource == "output") + return ((QWaylandScreen *) screen->handle())->output(); + + return NULL; +} + +QVariantMap QWaylandNativeInterface::windowProperties(QPlatformWindow *window) const +{ + QWaylandWindow *waylandWindow = static_cast(window); + if (QWaylandExtendedSurface *extendedWindow = waylandWindow->extendedWindow()) + return extendedWindow->properties(); + return QVariantMap(); +} + + +QVariant QWaylandNativeInterface::windowProperty(QPlatformWindow *window, const QString &name) const +{ + QWaylandWindow *waylandWindow = static_cast(window); + if (QWaylandExtendedSurface *extendedWindow = waylandWindow->extendedWindow()) + return extendedWindow->property(name); + return QVariant(); +} + +QVariant QWaylandNativeInterface::windowProperty(QPlatformWindow *window, const QString &name, const QVariant &defaultValue) const +{ + QWaylandWindow *waylandWindow = static_cast(window); + if (QWaylandExtendedSurface *extendedWindow = waylandWindow->extendedWindow()) { + return extendedWindow->property(name,defaultValue); + } + return defaultValue; +} + +void QWaylandNativeInterface::setWindowProperty(QPlatformWindow *window, const QString &name, const QVariant &value) +{ + QWaylandWindow *wlWindow = static_cast(window); + if (QWaylandExtendedSurface *extendedWindow = wlWindow->extendedWindow()) + extendedWindow->updateGenericProperty(name,value); +} + +void QWaylandNativeInterface::emitWindowPropertyChanged(QPlatformWindow *window, const QString &name) +{ + emit windowPropertyChanged(window,name); +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandnativeinterface.h b/src/plugins/platforms/wayland/qwaylandnativeinterface.h new file mode 100644 index 00000000000..c5f0fda73c9 --- /dev/null +++ b/src/plugins/platforms/wayland/qwaylandnativeinterface.h @@ -0,0 +1,79 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWAYLANDNATIVEINTERFACE_H +#define QWAYLANDNATIVEINTERFACE_H + +#include "qwaylandscreen.h" +#include +#include + +QT_BEGIN_NAMESPACE + +class QWaylandIntegration; + +class Q_WAYLAND_CLIENT_EXPORT QWaylandNativeInterface : public QPlatformNativeInterface +{ +public: + QWaylandNativeInterface(QWaylandIntegration *integration); + void *nativeResourceForIntegration(const QByteArray &resource); + void *nativeResourceForWindow(const QByteArray &resourceString, + QWindow *window); + void *nativeResourceForScreen(const QByteArray &resourceString, + QScreen *screen); + + QVariantMap windowProperties(QPlatformWindow *window) const; + QVariant windowProperty(QPlatformWindow *window, const QString &name) const; + QVariant windowProperty(QPlatformWindow *window, const QString &name, const QVariant &defaultValue) const; + void setWindowProperty(QPlatformWindow *window, const QString &name, const QVariant &value); + + void emitWindowPropertyChanged(QPlatformWindow *window, const QString &name); +private: + static QWaylandScreen *qPlatformScreenForWindow(QWindow *window); + +private: + QWaylandIntegration *m_integration; + QHash m_windowProperties; +}; + +QT_END_NAMESPACE + +#endif // QWAYLANDNATIVEINTERFACE_H diff --git a/src/plugins/platforms/wayland/qwaylandqtkey.cpp b/src/plugins/platforms/wayland/qwaylandqtkey.cpp new file mode 100644 index 00000000000..6cc4597d9ee --- /dev/null +++ b/src/plugins/platforms/wayland/qwaylandqtkey.cpp @@ -0,0 +1,85 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qwaylandqtkey.h" +#include "qwaylandinputdevice.h" + +QT_BEGIN_NAMESPACE + +QWaylandQtKeyExtension::QWaylandQtKeyExtension(QWaylandDisplay *display, uint32_t id) + : QtWayland::qt_key_extension(display->wl_registry(), id) + , m_display(display) +{ +} + +void QWaylandQtKeyExtension::key_extension_qtkey(struct wl_surface *surface, + uint32_t time, + uint32_t type, + uint32_t key, + uint32_t modifiers, + uint32_t nativeScanCode, + uint32_t nativeVirtualKey, + uint32_t nativeModifiers, + const QString &text, + uint32_t autorep, + uint32_t count) +{ + QList inputDevices = m_display->inputDevices(); + if (!surface && inputDevices.isEmpty()) { + qWarning("qt_key_extension: handle_qtkey: No input device"); + return; + } + + QWaylandInputDevice *dev = inputDevices.first(); + QWaylandWindow *win = surface ? QWaylandWindow::fromWlSurface(surface) : dev->mKeyboardFocus; + + if (!win || !win->window()) { + qWarning("qt_key_extension: handle_qtkey: No keyboard focus"); + return; + } + + QWindow *window = win->window(); + QWindowSystemInterface::handleExtendedKeyEvent(window, time, QEvent::Type(type), key, Qt::KeyboardModifiers(modifiers), + nativeScanCode, nativeVirtualKey, nativeModifiers, text, + autorep, count); +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandqtkey.h b/src/plugins/platforms/wayland/qwaylandqtkey.h new file mode 100644 index 00000000000..0acc9e8ad7f --- /dev/null +++ b/src/plugins/platforms/wayland/qwaylandqtkey.h @@ -0,0 +1,76 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWAYLANDQTKEY_H +#define QWAYLANDQTKEY_H + +#include "qwaylanddisplay.h" +#include + +#include + +QT_BEGIN_NAMESPACE + +class Q_WAYLAND_CLIENT_EXPORT QWaylandQtKeyExtension : public QtWayland::qt_key_extension +{ +public: + QWaylandQtKeyExtension(QWaylandDisplay *display, uint32_t id); + +private: + QWaylandDisplay *m_display; + + void key_extension_qtkey(struct wl_surface *surface, + uint32_t time, + uint32_t type, + uint32_t key, + uint32_t modifiers, + uint32_t nativeScanCode, + uint32_t nativeVirtualKey, + uint32_t nativeModifiers, + const QString &text, + uint32_t autorep, + uint32_t count) Q_DECL_OVERRIDE; + +}; + +QT_END_NAMESPACE + +#endif // QWAYLANDQTKEY_H diff --git a/src/plugins/platforms/wayland/qwaylandscreen.cpp b/src/plugins/platforms/wayland/qwaylandscreen.cpp new file mode 100644 index 00000000000..cda94a7e162 --- /dev/null +++ b/src/plugins/platforms/wayland/qwaylandscreen.cpp @@ -0,0 +1,184 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qwaylandscreen.h" + +#include "qwaylanddisplay.h" +#include "qwaylandcursor.h" +#include "qwaylandextendedoutput.h" + +#include + +QT_BEGIN_NAMESPACE + +QWaylandScreen::QWaylandScreen(QWaylandDisplay *waylandDisplay, uint32_t id) + : QtWayland::wl_output(waylandDisplay->wl_registry(), id) + , mWaylandDisplay(waylandDisplay) + , mExtendedOutput(0) + , mDepth(32) + , mRefreshRate(60000) + , mFormat(QImage::Format_ARGB32_Premultiplied) + , mOutputName(QStringLiteral("Screen%1").arg(id)) + , mWaylandCursor(new QWaylandCursor(this)) +{ + // handle case of output extension global being sent after outputs + createExtendedOutput(); +} + +QWaylandScreen::~QWaylandScreen() +{ + delete mWaylandCursor; +} + +QWaylandDisplay * QWaylandScreen::display() const +{ + return mWaylandDisplay; +} + +QRect QWaylandScreen::geometry() const +{ + return mGeometry; +} + +int QWaylandScreen::depth() const +{ + return mDepth; +} + +QImage::Format QWaylandScreen::format() const +{ + return mFormat; +} + +QDpi QWaylandScreen::logicalDpi() const +{ + static int force_dpi = !qgetenv("QT_WAYLAND_FORCE_DPI").isEmpty() ? qgetenv("QT_WAYLAND_FORCE_DPI").toInt() : -1; + if (force_dpi > 0) + return QDpi(force_dpi, force_dpi); + + return QPlatformScreen::logicalDpi(); +} + +void QWaylandScreen::setOrientationUpdateMask(Qt::ScreenOrientations mask) +{ + if (mExtendedOutput) + mExtendedOutput->setOrientationUpdateMask(mask); +} + +Qt::ScreenOrientation QWaylandScreen::orientation() const +{ + if (mExtendedOutput) + return mExtendedOutput->currentOrientation(); + return QPlatformScreen::orientation(); +} + +qreal QWaylandScreen::refreshRate() const +{ + return mRefreshRate / 1000.f; +} + +QPlatformCursor *QWaylandScreen::cursor() const +{ + return mWaylandCursor; +} + +QWaylandExtendedOutput *QWaylandScreen::extendedOutput() const +{ + return mExtendedOutput; +} + +void QWaylandScreen::createExtendedOutput() +{ + QtWayland::qt_output_extension *extension = mWaylandDisplay->outputExtension(); + if (!mExtendedOutput && extension) + mExtendedOutput = new QWaylandExtendedOutput(this, extension->get_extended_output(output())); +} + +QWaylandScreen * QWaylandScreen::waylandScreenFromWindow(QWindow *window) +{ + QPlatformScreen *platformScreen = QPlatformScreen::platformScreenForWindow(window); + return static_cast(platformScreen); +} + +void QWaylandScreen::output_mode(uint32_t flags, int width, int height, int refresh) +{ + if (!(flags & WL_OUTPUT_MODE_CURRENT)) + return; + + QSize size(width, height); + + if (size != mGeometry.size()) { + mGeometry.setSize(size); + QWindowSystemInterface::handleScreenGeometryChange(screen(), mGeometry); + QWindowSystemInterface::handleScreenAvailableGeometryChange(screen(), mGeometry); + } + + if (refresh != mRefreshRate) { + mRefreshRate = refresh; + QWindowSystemInterface::handleScreenRefreshRateChange(screen(), refreshRate()); + } +} + +void QWaylandScreen::output_geometry(int32_t x, int32_t y, + int32_t width, int32_t height, + int subpixel, + const QString &make, + const QString &model, + int32_t transform) +{ + Q_UNUSED(subpixel); + Q_UNUSED(make); + Q_UNUSED(transform); + + if (!model.isEmpty()) + mOutputName = model; + + QRect geom(x, y, width, height); + + if (mGeometry == geom) + return; + + mGeometry = geom; + QWindowSystemInterface::handleScreenGeometryChange(screen(), mGeometry); + QWindowSystemInterface::handleScreenAvailableGeometryChange(screen(), mGeometry); +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandscreen.h b/src/plugins/platforms/wayland/qwaylandscreen.h new file mode 100644 index 00000000000..15ae5189a02 --- /dev/null +++ b/src/plugins/platforms/wayland/qwaylandscreen.h @@ -0,0 +1,110 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWAYLANDSCREEN_H +#define QWAYLANDSCREEN_H + +#include +#include + +#include + +QT_BEGIN_NAMESPACE + +class QWaylandDisplay; +class QWaylandCursor; +class QWaylandExtendedOutput; + +class Q_WAYLAND_CLIENT_EXPORT QWaylandScreen : public QPlatformScreen, QtWayland::wl_output +{ +public: + QWaylandScreen(QWaylandDisplay *waylandDisplay, uint32_t id); + ~QWaylandScreen(); + + QWaylandDisplay *display() const; + + QRect geometry() const; + int depth() const; + QImage::Format format() const; + + QDpi logicalDpi() const Q_DECL_OVERRIDE; + + void setOrientationUpdateMask(Qt::ScreenOrientations mask); + + Qt::ScreenOrientation orientation() const; + qreal refreshRate() const; + + QString name() const { return mOutputName; } + + QPlatformCursor *cursor() const; + QWaylandCursor *waylandCursor() const { return mWaylandCursor; }; + + ::wl_output *output() { return object(); } + + QWaylandExtendedOutput *extendedOutput() const; + void createExtendedOutput(); + + static QWaylandScreen *waylandScreenFromWindow(QWindow *window); + +private: + void output_mode(uint32_t flags, int width, int height, int refresh) Q_DECL_OVERRIDE; + void output_geometry(int32_t x, int32_t y, + int32_t width, int32_t height, + int subpixel, + const QString &make, + const QString &model, + int32_t transform) Q_DECL_OVERRIDE; + + QWaylandDisplay *mWaylandDisplay; + QWaylandExtendedOutput *mExtendedOutput; + QRect mGeometry; + int mDepth; + int mRefreshRate; + QImage::Format mFormat; + QSize mPhysicalSize; + QString mOutputName; + + QWaylandCursor *mWaylandCursor; +}; + +QT_END_NAMESPACE + +#endif // QWAYLANDSCREEN_H diff --git a/src/plugins/platforms/wayland/qwaylandshellsurface.cpp b/src/plugins/platforms/wayland/qwaylandshellsurface.cpp new file mode 100644 index 00000000000..4c8ff1bc411 --- /dev/null +++ b/src/plugins/platforms/wayland/qwaylandshellsurface.cpp @@ -0,0 +1,176 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the config.tests of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qwaylandshellsurface.h" + +#include "qwaylanddisplay.h" +#include "qwaylandwindow.h" +#include "qwaylandinputdevice.h" +#include "qwaylanddecoration.h" +#include "qwaylandscreen.h" + +#include + +QT_BEGIN_NAMESPACE + +QWaylandShellSurface::QWaylandShellSurface(struct ::wl_shell_surface *shell_surface, QWaylandWindow *window) + : QtWayland::wl_shell_surface(shell_surface) + , m_window(window) + , m_maximized(false) + , m_fullscreen(false) +{ +} + +QWaylandShellSurface::~QWaylandShellSurface() +{ + wl_shell_surface_destroy(object()); +} + +void QWaylandShellSurface::resize(QWaylandInputDevice *inputDevice, enum wl_shell_surface_resize edges) +{ + resize(inputDevice->wl_seat(), + inputDevice->serial(), + edges); +} + +void QWaylandShellSurface::move(QWaylandInputDevice *inputDevice) +{ + move(inputDevice->wl_seat(), + inputDevice->serial()); +} + +void QWaylandShellSurface::setMaximized() +{ + m_maximized = true; + m_size = m_window->window()->geometry().size(); + set_maximized(0); +} + +void QWaylandShellSurface::setFullscreen() +{ + m_fullscreen = true; + m_size = m_window->window()->geometry().size(); + set_fullscreen(WL_SHELL_SURFACE_FULLSCREEN_METHOD_DEFAULT, 0, 0); +} + +void QWaylandShellSurface::setNormal() +{ + if (m_fullscreen || m_maximized) { + m_fullscreen = m_maximized = false; + setTopLevel(); + QMargins m = m_window->frameMargins(); + m_window->configure(0, m_size.width() + m.left() + m.right(), m_size.height() + m.top() + m.bottom()); + } +} + +void QWaylandShellSurface::setMinimized() +{ + // TODO: There's no wl_shell_surface API for this +} + +void QWaylandShellSurface::setTopLevel() +{ + set_toplevel(); +} + +void QWaylandShellSurface::updateTransientParent(QWindow *parent) +{ + QWaylandWindow *parent_wayland_window = static_cast(parent->handle()); + if (!parent_wayland_window) + return; + + // set_transient expects a position relative to the parent + QPoint transientPos = m_window->geometry().topLeft(); // this is absolute + QWindow *parentWin = m_window->window()->transientParent(); + transientPos -= parentWin->geometry().topLeft(); + if (parent_wayland_window->decoration()) { + transientPos.setX(transientPos.x() + parent_wayland_window->decoration()->margins().left()); + transientPos.setY(transientPos.y() + parent_wayland_window->decoration()->margins().top()); + } + + uint32_t flags = 0; + Qt::WindowFlags wf = m_window->window()->flags(); + if (wf.testFlag(Qt::ToolTip) + || wf.testFlag(Qt::WindowTransparentForInput)) + flags |= WL_SHELL_SURFACE_TRANSIENT_INACTIVE; + + set_transient(parent_wayland_window->object(), + transientPos.x(), + transientPos.y(), + flags); +} + +void QWaylandShellSurface::setPopup(QWaylandWindow *parent, QWaylandInputDevice *device, int serial) +{ + QWaylandWindow *parent_wayland_window = parent; + if (!parent_wayland_window) + return; + + // set_popup expects a position relative to the parent + QPoint transientPos = m_window->geometry().topLeft(); // this is absolute + transientPos -= parent_wayland_window->geometry().topLeft(); + if (parent_wayland_window->decoration()) { + transientPos.setX(transientPos.x() + parent_wayland_window->decoration()->margins().left()); + transientPos.setY(transientPos.y() + parent_wayland_window->decoration()->margins().top()); + } + + set_popup(device->wl_seat(), serial, parent_wayland_window->object(), + transientPos.x(), transientPos.y(), 0); +} + +void QWaylandShellSurface::shell_surface_ping(uint32_t serial) +{ + pong(serial); +} + +void QWaylandShellSurface::shell_surface_configure(uint32_t edges, + int32_t width, + int32_t height) +{ + m_window->configure(edges, width, height); +} + +void QWaylandShellSurface::shell_surface_popup_done() +{ + QCoreApplication::postEvent(m_window->window(), new QCloseEvent()); +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandshellsurface.h b/src/plugins/platforms/wayland/qwaylandshellsurface.h new file mode 100644 index 00000000000..25f70333434 --- /dev/null +++ b/src/plugins/platforms/wayland/qwaylandshellsurface.h @@ -0,0 +1,96 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the config.tests of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWAYLANDSHELLSURFACE_H +#define QWAYLANDSHELLSURFACE_H + +#include + +#include + +#include +#include + +QT_BEGIN_NAMESPACE + +class QWaylandWindow; +class QWaylandInputDevice; +class QWindow; + +class Q_WAYLAND_CLIENT_EXPORT QWaylandShellSurface : public QtWayland::wl_shell_surface +{ +public: + QWaylandShellSurface(struct ::wl_shell_surface *shell_surface, QWaylandWindow *window); + ~QWaylandShellSurface(); + + using QtWayland::wl_shell_surface::resize; + void resize(QWaylandInputDevice *inputDevice, enum wl_shell_surface_resize edges); + + using QtWayland::wl_shell_surface::move; + void move(QWaylandInputDevice *inputDevice); + +private: + void setMaximized(); + void setFullscreen(); + void setNormal(); + void setMinimized(); + + void setTopLevel(); + void updateTransientParent(QWindow *parent); + void setPopup(QWaylandWindow *parent, QWaylandInputDevice *device, int serial); + + QWaylandWindow *m_window; + bool m_maximized; + bool m_fullscreen; + QSize m_size; + + void shell_surface_ping(uint32_t serial) Q_DECL_OVERRIDE; + void shell_surface_configure(uint32_t edges, + int32_t width, + int32_t height) Q_DECL_OVERRIDE; + void shell_surface_popup_done() Q_DECL_OVERRIDE; + + friend class QWaylandWindow; +}; + +QT_END_NAMESPACE + +#endif // QWAYLANDSHELLSURFACE_H diff --git a/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp b/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp new file mode 100644 index 00000000000..00a4b13a239 --- /dev/null +++ b/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp @@ -0,0 +1,322 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#include "qwaylandshmbackingstore.h" + +#include + +#include "qwaylanddisplay.h" +#include "qwaylandshmwindow.h" +#include "qwaylandscreen.h" +#include "qwaylanddecoration.h" + +#include + +#include +#include +#include +#include +#include + +QT_BEGIN_NAMESPACE + +QWaylandShmBuffer::QWaylandShmBuffer(QWaylandDisplay *display, + const QSize &size, QImage::Format format) + : mMarginsImage(0) +{ + int stride = size.width() * 4; + int alloc = stride * size.height(); + char filename[] = "/tmp/wayland-shm-XXXXXX"; + int fd = mkstemp(filename); + if (fd < 0) { + qWarning("mkstemp %s failed: %s", filename, strerror(errno)); + return; + } + int flags = fcntl(fd, F_GETFD); + if (flags != -1) + fcntl(fd, F_SETFD, flags | FD_CLOEXEC); + + if (ftruncate(fd, alloc) < 0) { + qWarning("ftruncate failed: %s", strerror(errno)); + close(fd); + return; + } + uchar *data = (uchar *) + mmap(NULL, alloc, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); + unlink(filename); + + if (data == (uchar *) MAP_FAILED) { + qWarning("mmap /dev/zero failed: %s", strerror(errno)); + close(fd); + return; + } + + mImage = QImage(data, size.width(), size.height(), stride, format); + mShmPool = wl_shm_create_pool(display->shm(), fd, alloc); + mBuffer = wl_shm_pool_create_buffer(mShmPool,0, size.width(), size.height(), + stride, WL_SHM_FORMAT_ARGB8888); + close(fd); +} + +QWaylandShmBuffer::~QWaylandShmBuffer(void) +{ + delete mMarginsImage; + munmap((void *) mImage.constBits(), mImage.byteCount()); + wl_buffer_destroy(mBuffer); + wl_shm_pool_destroy(mShmPool); +} + +QImage *QWaylandShmBuffer::imageInsideMargins(const QMargins &margins) +{ + if (!margins.isNull() && margins != mMargins) { + if (mMarginsImage) { + delete mMarginsImage; + } + uchar *bits = const_cast(mImage.constBits()); + uchar *b_s_data = bits + margins.top() * mImage.bytesPerLine() + margins.left() * 4; + int b_s_width = mImage.size().width() - margins.left() - margins.right(); + int b_s_height = mImage.size().height() - margins.top() - margins.bottom(); + mMarginsImage = new QImage(b_s_data, b_s_width,b_s_height,mImage.bytesPerLine(),mImage.format()); + } + if (margins.isNull()) { + delete mMarginsImage; + mMarginsImage = 0; + } + + mMargins = margins; + if (!mMarginsImage) + return &mImage; + + return mMarginsImage; + +} + +QWaylandShmBackingStore::QWaylandShmBackingStore(QWindow *window) + : QPlatformBackingStore(window) + , mDisplay(QWaylandScreen::waylandScreenFromWindow(window)->display()) + , mFrontBuffer(0) + , mBackBuffer(0) + , mFrontBufferIsDirty(false) + , mPainting(false) + , mFrameCallback(0) +{ + +} + +QWaylandShmBackingStore::~QWaylandShmBackingStore() +{ + if (mFrameCallback) + wl_callback_destroy(mFrameCallback); + +// if (mFrontBuffer == waylandWindow()->attached()) +// waylandWindow()->attach(0); + + if (mFrontBuffer != mBackBuffer) + delete mFrontBuffer; + + delete mBackBuffer; +} + +QPaintDevice *QWaylandShmBackingStore::paintDevice() +{ + if (!windowDecoration()) + return mBackBuffer->image(); + return mBackBuffer->imageInsideMargins(windowDecorationMargins()); +} + +void QWaylandShmBackingStore::beginPaint(const QRegion &) +{ + mPainting = true; + ensureSize(); + + if (waylandWindow()->attached() && mBackBuffer == waylandWindow()->attached() && mFrameCallback) { + QWaylandShmWindow *waylandWindow = static_cast(window()->handle()); + Q_ASSERT(waylandWindow->windowType() == QWaylandWindow::Shm); + waylandWindow->waitForFrameSync(); + } + + waylandWindow()->setCanResize(false); +} + +void QWaylandShmBackingStore::endPaint() +{ + mPainting = false; + waylandWindow()->setCanResize(true); +} + +void QWaylandShmBackingStore::ensureSize() +{ + waylandWindow()->setBackingStore(this); + waylandWindow()->createDecoration(); + resize(mRequestedSize); +} + +void QWaylandShmBackingStore::flush(QWindow *window, const QRegion ®ion, const QPoint &offset) +{ + Q_UNUSED(window); + Q_UNUSED(offset); + Q_ASSERT(waylandWindow()->windowType() == QWaylandWindow::Shm); + + if (windowDecoration() && windowDecoration()->isDirty()) + updateDecorations(); + + mFrontBuffer = mBackBuffer; + + if (mFrameCallback) { + mFrontBufferIsDirty = true; + return; + } + + mFrameCallback = waylandWindow()->frame(); + wl_callback_add_listener(mFrameCallback,&frameCallbackListener,this); + QMargins margins = windowDecorationMargins(); + + bool damageAll = false; + if (waylandWindow()->attached() != mFrontBuffer) { + delete waylandWindow()->attached(); + damageAll = true; + } + waylandWindow()->attachOffset(mFrontBuffer); + + if (damageAll) { + //need to damage it all, otherwise the attach offset may screw up + waylandWindow()->damage(QRect(QPoint(0,0),mFrontBuffer->size())); + } else { + QVector rects = region.rects(); + for (int i = 0; i < rects.size(); i++) { + QRect rect = rects.at(i); + rect.translate(margins.left(),margins.top()); + waylandWindow()->damage(rect); + } + } + waylandWindow()->commit(); + mFrontBufferIsDirty = false; +} + +void QWaylandShmBackingStore::resize(const QSize &size, const QRegion &) +{ + mRequestedSize = size; +} + +void QWaylandShmBackingStore::resize(const QSize &size) +{ + QMargins margins = windowDecorationMargins(); + QSize sizeWithMargins = size + QSize(margins.left()+margins.right(),margins.top()+margins.bottom()); + + QImage::Format format = QPlatformScreen::platformScreenForWindow(window())->format(); + + if (mBackBuffer != NULL && mBackBuffer->size() == sizeWithMargins) + return; + + if (mBackBuffer != mFrontBuffer) { + delete mBackBuffer; //we delete the attached buffer when we flush + } + + mBackBuffer = new QWaylandShmBuffer(mDisplay, sizeWithMargins, format); + + if (windowDecoration() && window()->isVisible()) + windowDecoration()->update(); +} + +QImage *QWaylandShmBackingStore::entireSurface() const +{ + return mBackBuffer->image(); +} + +void QWaylandShmBackingStore::updateDecorations() +{ + QPainter decorationPainter(entireSurface()); + decorationPainter.setCompositionMode(QPainter::CompositionMode_Source); + QImage sourceImage = windowDecoration()->contentImage(); + QRect target; + //Top + target.setX(0); + target.setY(0); + target.setWidth(sourceImage.width()); + target.setHeight(windowDecorationMargins().top()); + decorationPainter.drawImage(target, sourceImage, target); + + //Left + target.setWidth(windowDecorationMargins().left()); + target.setHeight(sourceImage.height()); + decorationPainter.drawImage(target, sourceImage, target); + + //Right + target.setX(sourceImage.width() - windowDecorationMargins().right()); + decorationPainter.drawImage(target, sourceImage, target); + + //Bottom + target.setX(0); + target.setY(sourceImage.height() - windowDecorationMargins().bottom()); + target.setWidth(sourceImage.width()); + target.setHeight(windowDecorationMargins().bottom()); + decorationPainter.drawImage(target, sourceImage, target); +} + +void QWaylandShmBackingStore::done(void *data, wl_callback *callback, uint32_t time) +{ + Q_UNUSED(time); + QWaylandShmBackingStore *self = + static_cast(data); + if (callback != self->mFrameCallback) // others, like QWaylandWindow, may trigger callbacks too + return; + QWaylandShmWindow *window = self->waylandWindow(); + wl_callback_destroy(self->mFrameCallback); + self->mFrameCallback = 0; + + + if (self->mFrontBufferIsDirty && !self->mPainting) { + self->mFrontBufferIsDirty = false; + self->mFrameCallback = wl_surface_frame(window->object()); + wl_callback_add_listener(self->mFrameCallback,&self->frameCallbackListener,self); + if (self->mFrontBuffer != window->attached()) { + delete window->attached(); + } + window->attachOffset(self->mFrontBuffer); + window->damage(QRect(QPoint(0,0),self->mFrontBuffer->size())); + window->commit(); + } +} + +const struct wl_callback_listener QWaylandShmBackingStore::frameCallbackListener = { + QWaylandShmBackingStore::done +}; + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandshmbackingstore.h b/src/plugins/platforms/wayland/qwaylandshmbackingstore.h new file mode 100644 index 00000000000..c7875f52c17 --- /dev/null +++ b/src/plugins/platforms/wayland/qwaylandshmbackingstore.h @@ -0,0 +1,134 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWAYLANDSHMBACKINGSTORE_H +#define QWAYLANDSHMBACKINGSTORE_H + +#include "qwaylandbuffer.h" + +#include "qwaylanddecoration.h" +#include "qwaylandshmwindow.h" + +#include +#include +#include + +QT_BEGIN_NAMESPACE + +class QWaylandDisplay; + +class Q_WAYLAND_CLIENT_EXPORT QWaylandShmBuffer : public QWaylandBuffer { +public: + QWaylandShmBuffer(QWaylandDisplay *display, + const QSize &size, QImage::Format format); + ~QWaylandShmBuffer(); + QSize size() const { return mImage.size(); } + QImage *image() { return &mImage; } + + QImage *imageInsideMargins(const QMargins &margins); +private: + QImage mImage; + struct wl_shm_pool *mShmPool; + QMargins mMargins; + QImage *mMarginsImage; +}; + +class Q_WAYLAND_CLIENT_EXPORT QWaylandShmBackingStore : public QPlatformBackingStore +{ +public: + QWaylandShmBackingStore(QWindow *window); + ~QWaylandShmBackingStore(); + + QPaintDevice *paintDevice(); + void flush(QWindow *window, const QRegion ®ion, const QPoint &offset); + void resize(const QSize &size, const QRegion &staticContents); + void resize(const QSize &size); + void beginPaint(const QRegion &); + void endPaint(); + + QWaylandDecoration *windowDecoration() const; + + QMargins windowDecorationMargins() const; + QImage *entireSurface() const; + void ensureSize(); + + QWaylandShmWindow *waylandWindow() const; + void iterateBuffer(); + +private: + void updateDecorations(); + + QWaylandDisplay *mDisplay; + QWaylandShmBuffer *mFrontBuffer; + QWaylandShmBuffer *mBackBuffer; + bool mFrontBufferIsDirty; + bool mPainting; + + QSize mRequestedSize; + Qt::WindowFlags mCurrentWindowFlags; + + static const struct wl_callback_listener frameCallbackListener; + static void done(void *data, + struct wl_callback *callback, + uint32_t time); + struct wl_callback *mFrameCallback; +}; + +inline QWaylandDecoration *QWaylandShmBackingStore::windowDecoration() const +{ + return waylandWindow()->decoration(); +} + +inline QMargins QWaylandShmBackingStore::windowDecorationMargins() const +{ + if (windowDecoration()) + return windowDecoration()->margins(); + return QMargins(); +} + +inline QWaylandShmWindow *QWaylandShmBackingStore::waylandWindow() const +{ + return static_cast(window()->handle()); +} + +QT_END_NAMESPACE + +#endif diff --git a/src/plugins/platforms/wayland/qwaylandshmwindow.cpp b/src/plugins/platforms/wayland/qwaylandshmwindow.cpp new file mode 100644 index 00000000000..48a1bfd533e --- /dev/null +++ b/src/plugins/platforms/wayland/qwaylandshmwindow.cpp @@ -0,0 +1,73 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the config.tests of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qwaylandshmwindow.h" + +#include "qwaylandbuffer.h" + +#include + +#include + +QT_BEGIN_NAMESPACE + +QWaylandShmWindow::QWaylandShmWindow(QWindow *window) + : QWaylandWindow(window) + , mBackingStore(0) +{ +} + +QWaylandShmWindow::~QWaylandShmWindow() +{ + +} + +QWaylandWindow::WindowType QWaylandShmWindow::windowType() const +{ + return QWaylandWindow::Shm; +} + +void QWaylandShmWindow::setBackingStore(QWaylandShmBackingStore *backingStore) +{ + mBackingStore = backingStore; +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandshmwindow.h b/src/plugins/platforms/wayland/qwaylandshmwindow.h new file mode 100644 index 00000000000..e443bb18743 --- /dev/null +++ b/src/plugins/platforms/wayland/qwaylandshmwindow.h @@ -0,0 +1,75 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the config.tests of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWAYLANDSHMWINDOW_H +#define QWAYLANDSHMWINDOW_H + +#include "qwaylandwindow.h" +#include + +QT_BEGIN_NAMESPACE + +class QWaylandShmBackingStore; + +class Q_WAYLAND_CLIENT_EXPORT QWaylandShmWindow : public QWaylandWindow +{ +public: + QWaylandShmWindow(QWindow *window); + ~QWaylandShmWindow(); + + WindowType windowType() const; + QSurfaceFormat format() const { return QSurfaceFormat(); } + + void setBackingStore(QWaylandShmBackingStore *backingStore); + QWaylandShmBackingStore *backingStore() const; + +private: + QWaylandShmBackingStore *mBackingStore; +}; + +inline QWaylandShmBackingStore *QWaylandShmWindow::backingStore() const +{ + return mBackingStore; +} + +QT_END_NAMESPACE + +#endif // QWAYLANDSHMWINDOW_H diff --git a/src/plugins/platforms/wayland/qwaylandsubsurface.cpp b/src/plugins/platforms/wayland/qwaylandsubsurface.cpp new file mode 100644 index 00000000000..0e9d575a9d5 --- /dev/null +++ b/src/plugins/platforms/wayland/qwaylandsubsurface.cpp @@ -0,0 +1,91 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qwaylandsubsurface.h" + +#include "qwaylandwindow.h" + +#include + +QT_BEGIN_NAMESPACE + +QWaylandSubSurface::QWaylandSubSurface(QWaylandWindow *window, struct ::qt_sub_surface *sub_surface) + : QtWayland::qt_sub_surface(sub_surface) + , m_window(window) +{ +} + +void QWaylandSubSurface::setParent(const QWaylandWindow *parent) +{ + QWaylandSubSurface *parentSurface = parent ? parent->subSurfaceWindow() : 0; + if (parentSurface) { + int x = m_window->geometry().x() + parent->frameMargins().left(); + int y = m_window->geometry().y() + parent->frameMargins().top(); + parentSurface->attach_sub_surface(object(), x, y); + } +} + +static void setPositionToParent(QWaylandWindow *parentWaylandWindow) +{ + QObjectList children = parentWaylandWindow->window()->children(); + for (int i = 0; i < children.size(); i++) { + QWindow *childWindow = qobject_cast(children.at(i)); + if (!childWindow) + continue; + + if (childWindow->handle()) { + QWaylandWindow *waylandWindow = static_cast(childWindow->handle()); + waylandWindow->subSurfaceWindow()->setParent(parentWaylandWindow); + setPositionToParent(waylandWindow); + } + } +} + +void QWaylandSubSurface::adjustPositionOfChildren() +{ + QWindow *window = m_window->window(); + if (window->parent()) { + qDebug() << "QWaylandSubSurface::adjustPositionOfChildren not called for toplevel window"; + } + setPositionToParent(m_window); +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandsubsurface.h b/src/plugins/platforms/wayland/qwaylandsubsurface.h new file mode 100644 index 00000000000..97158b6aa37 --- /dev/null +++ b/src/plugins/platforms/wayland/qwaylandsubsurface.h @@ -0,0 +1,73 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWAYLANDSUBSURFACE_H +#define QWAYLANDSUBSURFACE_H + +#include + +#include + +#include + +#include + +QT_BEGIN_NAMESPACE + +class QWaylandDisplay; +class QWaylandWindow; +class QWaylandSubSurface; + +class Q_WAYLAND_CLIENT_EXPORT QWaylandSubSurface : public QtWayland::qt_sub_surface +{ +public: + QWaylandSubSurface(QWaylandWindow *window, struct ::qt_sub_surface *sub_surface); + + void setParent(const QWaylandWindow *parent); + void adjustPositionOfChildren(); + +private: + QWaylandWindow *m_window; +}; + +QT_END_NAMESPACE + +#endif // QWAYLANDSUBSURFACE_H diff --git a/src/plugins/platforms/wayland/qwaylandtouch.cpp b/src/plugins/platforms/wayland/qwaylandtouch.cpp new file mode 100644 index 00000000000..5835d9d3cdc --- /dev/null +++ b/src/plugins/platforms/wayland/qwaylandtouch.cpp @@ -0,0 +1,209 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qwaylandtouch.h" +#include "qwaylandinputdevice.h" + +QT_BEGIN_NAMESPACE + +QWaylandTouchExtension::QWaylandTouchExtension(QWaylandDisplay *display, uint32_t id) + : QtWayland::qt_touch_extension(display->wl_registry(), id), + mDisplay(display), + mTouchDevice(0), + mPointsLeft(0), + mFlags(0), + mMouseSourceId(-1), + mInputDevice(0) +{ +} + +void QWaylandTouchExtension::registerDevice(int caps) +{ + mTouchDevice = new QTouchDevice; + mTouchDevice->setType(QTouchDevice::TouchScreen); + mTouchDevice->setCapabilities(QTouchDevice::Capabilities(caps)); + QWindowSystemInterface::registerTouchDevice(mTouchDevice); +} + +static inline qreal fromFixed(int f) +{ + return f / qreal(10000); +} + +void QWaylandTouchExtension::touch_extension_touch(uint32_t time, + uint32_t id, uint32_t state, int32_t x, int32_t y, + int32_t normalized_x, int32_t normalized_y, + int32_t width, int32_t height, uint32_t pressure, + int32_t velocity_x, int32_t velocity_y, + uint32_t flags, wl_array *rawdata) +{ + if (!mInputDevice) { + QList inputDevices = mDisplay->inputDevices(); + if (inputDevices.isEmpty()) { + qWarning("qt_touch_extension: handle_touch: No input devices"); + return; + } + mInputDevice = inputDevices.first(); + } + QWaylandWindow *win = mInputDevice->mTouchFocus; + if (!win) + win = mInputDevice->mPointerFocus; + if (!win) + win = mInputDevice->mKeyboardFocus; + if (!win || !win->window()) { + qWarning("qt_touch_extension: handle_touch: No pointer focus"); + return; + } + mTargetWindow = win->window(); + + QWindowSystemInterface::TouchPoint tp; + tp.id = id; + tp.state = Qt::TouchPointState(int(state & 0xFFFF)); + int sentPointCount = state >> 16; + if (!mPointsLeft) { + Q_ASSERT(sentPointCount > 0); + mPointsLeft = sentPointCount; + } + tp.flags = QTouchEvent::TouchPoint::InfoFlags(int(flags & 0xFFFF)); + + if (!mTouchDevice) + registerDevice(flags >> 16); + + tp.area = QRectF(0, 0, fromFixed(width), fromFixed(height)); + // Got surface-relative coords but need a (virtual) screen position. + QPointF relPos = QPointF(fromFixed(x), fromFixed(y)); + QPointF delta = relPos - relPos.toPoint(); + tp.area.moveCenter(mTargetWindow->mapToGlobal(relPos.toPoint()) + delta); + + tp.normalPosition.setX(fromFixed(normalized_x)); + tp.normalPosition.setY(fromFixed(normalized_y)); + tp.pressure = pressure / 255.0; + tp.velocity.setX(fromFixed(velocity_x)); + tp.velocity.setY(fromFixed(velocity_y)); + + if (rawdata) { + const int rawPosCount = rawdata->size / sizeof(float) / 2; + float *p = static_cast(rawdata->data); + for (int i = 0; i < rawPosCount; ++i) { + float x = *p++; + float y = *p++; + tp.rawPositions.append(QPointF(x, y)); + } + } + + mTouchPoints.append(tp); + mTimestamp = time; + + if (!--mPointsLeft) + sendTouchEvent(); +} + +void QWaylandTouchExtension::sendTouchEvent() +{ + // Copy all points, that are in the previous but not in the current list, as stationary. + for (int i = 0; i < mPrevTouchPoints.count(); ++i) { + const QWindowSystemInterface::TouchPoint &prevPoint(mPrevTouchPoints.at(i)); + if (prevPoint.state == Qt::TouchPointReleased) + continue; + bool found = false; + for (int j = 0; j < mTouchPoints.count(); ++j) + if (mTouchPoints.at(j).id == prevPoint.id) { + found = true; + break; + } + if (!found) { + QWindowSystemInterface::TouchPoint p = prevPoint; + p.state = Qt::TouchPointStationary; + mTouchPoints.append(p); + } + } + + if (mTouchPoints.isEmpty()) { + mPrevTouchPoints.clear(); + return; + } + + QWindowSystemInterface::handleTouchEvent(mTargetWindow, mTimestamp, mTouchDevice, mTouchPoints); + + Qt::TouchPointStates states = 0; + for (int i = 0; i < mTouchPoints.count(); ++i) + states |= mTouchPoints.at(i).state; + + if (mFlags & QT_TOUCH_EXTENSION_FLAGS_MOUSE_FROM_TOUCH) { + if (states == Qt::TouchPointPressed) + mMouseSourceId = mTouchPoints.first().id; + for (int i = 0; i < mTouchPoints.count(); ++i) { + const QWindowSystemInterface::TouchPoint &tp(mTouchPoints.at(i)); + if (tp.id == mMouseSourceId) { + Qt::MouseButtons buttons = tp.state == Qt::TouchPointReleased ? Qt::NoButton : Qt::LeftButton; + mLastMouseGlobal = tp.area.center(); + QPoint globalPoint = mLastMouseGlobal.toPoint(); + QPointF delta = mLastMouseGlobal - globalPoint; + mLastMouseLocal = mTargetWindow->mapFromGlobal(globalPoint) + delta; + QWindowSystemInterface::handleMouseEvent(mTargetWindow, mTimestamp, mLastMouseLocal, mLastMouseGlobal, buttons); + if (buttons == Qt::NoButton) + mMouseSourceId = -1; + break; + } + } + } + + mPrevTouchPoints = mTouchPoints; + mTouchPoints.clear(); + + if (states == Qt::TouchPointReleased) + mPrevTouchPoints.clear(); +} + +void QWaylandTouchExtension::touchCanceled() +{ + mTouchPoints.clear(); + mPrevTouchPoints.clear(); + if (mMouseSourceId != -1) + QWindowSystemInterface::handleMouseEvent(mTargetWindow, mTimestamp, mLastMouseLocal, mLastMouseGlobal, Qt::NoButton); +} + +void QWaylandTouchExtension::touch_extension_configure(uint32_t flags) +{ + mFlags = flags; +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandtouch.h b/src/plugins/platforms/wayland/qwaylandtouch.h new file mode 100644 index 00000000000..0d14330e710 --- /dev/null +++ b/src/plugins/platforms/wayland/qwaylandtouch.h @@ -0,0 +1,97 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWAYLANDTOUCh_H +#define QWAYLANDTOUCH_H + +#include "qwaylanddisplay.h" +#include + +#include + +QT_BEGIN_NAMESPACE + +class Q_WAYLAND_CLIENT_EXPORT QWaylandTouchExtension : public QtWayland::qt_touch_extension +{ +public: + QWaylandTouchExtension(QWaylandDisplay *display, uint32_t id); + + void touchCanceled(); + +private: + void registerDevice(int caps); + + QWaylandDisplay *mDisplay; + + void touch_extension_touch(uint32_t time, + uint32_t id, + uint32_t state, + int32_t x, + int32_t y, + int32_t normalized_x, + int32_t normalized_y, + int32_t width, + int32_t height, + uint32_t pressure, + int32_t velocity_x, + int32_t velocity_y, + uint32_t flags, + struct wl_array *rawdata) Q_DECL_OVERRIDE; + void touch_extension_configure(uint32_t flags) Q_DECL_OVERRIDE; + + void sendTouchEvent(); + + QList mTouchPoints; + QList mPrevTouchPoints; + QTouchDevice *mTouchDevice; + uint32_t mTimestamp; + int mPointsLeft; + uint32_t mFlags; + int mMouseSourceId; + QPointF mLastMouseLocal; + QPointF mLastMouseGlobal; + QWindow *mTargetWindow; + QWaylandInputDevice *mInputDevice; +}; + +QT_END_NAMESPACE + +#endif // QWAYLANDTOUCH_H diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp new file mode 100644 index 00000000000..b64d3e6abeb --- /dev/null +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -0,0 +1,608 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the config.tests of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qwaylandwindow.h" + +#include "qwaylandbuffer.h" +#include "qwaylanddisplay.h" +#include "qwaylandinputdevice.h" +#include "qwaylandscreen.h" +#include "qwaylandshellsurface.h" +#include "qwaylandextendedsurface.h" +#include "qwaylandsubsurface.h" +#include "qwaylanddecoration.h" +#include "qwaylandwindowmanagerintegration.h" + +#include +#include + +#include +#include + +#include + +QT_BEGIN_NAMESPACE + +QWaylandWindow *QWaylandWindow::mMouseGrab = 0; + +QWaylandWindow::QWaylandWindow(QWindow *window) + : QObject() + , QPlatformWindow(window) + , mScreen(QWaylandScreen::waylandScreenFromWindow(window)) + , mDisplay(mScreen->display()) + , mShellSurface(0) + , mExtendedWindow(0) + , mSubSurfaceWindow(0) + , mWindowDecoration(0) + , mMouseEventsInContentArea(false) + , mMousePressedInContentArea(Qt::NoButton) + , m_cursorShape(Qt::ArrowCursor) + , mBuffer(0) + , mWaitingForFrameSync(false) + , mFrameCallback(0) + , mRequestResizeSent(false) + , mCanResize(true) + , mSentInitialResize(false) + , mMouseDevice(0) + , mMouseSerial(0) + , mState(Qt::WindowNoState) +{ + init(mDisplay->createSurface(static_cast(this))); + + static WId id = 1; + mWindowId = id++; + + if (mDisplay->shell() && window->type() & Qt::Window && !(window->flags() & Qt::BypassWindowManagerHint)) + mShellSurface = new QWaylandShellSurface(mDisplay->shell()->get_shell_surface(object()), this); + if (mDisplay->windowExtension()) + mExtendedWindow = new QWaylandExtendedSurface(this, mDisplay->windowExtension()->get_extended_surface(object())); + if (mDisplay->subSurfaceExtension()) + mSubSurfaceWindow = new QWaylandSubSurface(this, mDisplay->subSurfaceExtension()->get_sub_surface_aware_surface(object())); + + if (mShellSurface) { + // Set initial surface title + mShellSurface->set_title(window->title()); + + // Set surface class to the .desktop file name (obtained from executable name) + QFileInfo exeFileInfo(qApp->applicationFilePath()); + QString className = exeFileInfo.baseName() + QLatin1String(".desktop"); + mShellSurface->set_class(className); + } + + if (QPlatformWindow::parent() && mSubSurfaceWindow) { + mSubSurfaceWindow->setParent(static_cast(QPlatformWindow::parent())); + } else if (window->transientParent() && mShellSurface) { + if (window->type() != Qt::Popup) { + mShellSurface->updateTransientParent(window->transientParent()); + } + } else if (mShellSurface) { + mShellSurface->setTopLevel(); + } + + setWindowFlags(window->flags()); + setGeometry(window->geometry()); + setWindowState(window->windowState()); +} + +QWaylandWindow::~QWaylandWindow() +{ + if (isInitialized()) { + delete mShellSurface; + delete mExtendedWindow; + destroy(); + } + if (mFrameCallback) + wl_callback_destroy(mFrameCallback); + + QList inputDevices = mDisplay->inputDevices(); + for (int i = 0; i < inputDevices.size(); ++i) + inputDevices.at(i)->handleWindowDestroyed(this); + + const QWindow *parent = window(); + foreach (QWindow *w, QGuiApplication::topLevelWindows()) { + if (w->transientParent() == parent) + QWindowSystemInterface::handleCloseEvent(w); + } + + if (mMouseGrab == this) { + mMouseGrab = 0; + } +} + +QWaylandWindow *QWaylandWindow::fromWlSurface(::wl_surface *surface) +{ + return static_cast(static_cast(wl_surface_get_user_data(surface))); +} + +WId QWaylandWindow::winId() const +{ + return mWindowId; +} + +void QWaylandWindow::setParent(const QPlatformWindow *parent) +{ + const QWaylandWindow *parentWaylandWindow = static_cast(parent); + if (subSurfaceWindow()) { + subSurfaceWindow()->setParent(parentWaylandWindow); + } +} + +void QWaylandWindow::setWindowTitle(const QString &title) +{ + if (mShellSurface) { + mShellSurface->set_title(title); + } + + if (mWindowDecoration && window()->isVisible()) + mWindowDecoration->update(); +} + +void QWaylandWindow::setWindowIcon(const QIcon &icon) +{ + mWindowIcon = icon; + + if (mWindowDecoration && window()->isVisible()) + mWindowDecoration->update(); +} + +void QWaylandWindow::setGeometry(const QRect &rect) +{ + QPlatformWindow::setGeometry(QRect(rect.x(), rect.y(), + qBound(window()->minimumWidth(), rect.width(), window()->maximumWidth()), + qBound(window()->minimumHeight(), rect.height(), window()->maximumHeight()))); + + if (shellSurface() && window()->transientParent() && window()->type() != Qt::Popup) + shellSurface()->updateTransientParent(window()->transientParent()); + + if (mWindowDecoration && window()->isVisible()) + mWindowDecoration->update(); + + if (mConfigure.isEmpty()) { + QWindowSystemInterface::handleGeometryChange(window(), geometry()); + QWindowSystemInterface::handleExposeEvent(window(), QRegion(geometry())); + } +} + +void QWaylandWindow::setVisible(bool visible) +{ + if (visible) { + if (mBuffer) + attach(mBuffer->buffer(), 0, 0); + + if (window()->type() == Qt::Popup && transientParent()) { + QWaylandWindow *parent = transientParent(); + mMouseDevice = parent->mMouseDevice; + mMouseSerial = parent->mMouseSerial; + + if (mMouseDevice) + mShellSurface->setPopup(transientParent(), mMouseDevice, mMouseSerial); + } + + if (!mSentInitialResize) { + QWindowSystemInterface::handleGeometryChange(window(), geometry()); + mSentInitialResize = true; + } + + QWindowSystemInterface::handleExposeEvent(window(), QRect(QPoint(), geometry().size())); + // Don't flush the events here, or else the newly visible window may start drawing, but since + // there was no frame before it will be stuck at the waitForFrameSync() in + // QWaylandShmBackingStore::beginPaint(). + } else { + QWindowSystemInterface::handleExposeEvent(window(), QRegion()); + attach(static_cast(0), 0, 0); + } + damage(QRect(QPoint(0,0),geometry().size())); + commit(); +} + + +void QWaylandWindow::raise() +{ + if (mExtendedWindow) + mExtendedWindow->raise(); +} + + +void QWaylandWindow::lower() +{ + if (mExtendedWindow) + mExtendedWindow->lower(); +} + +void QWaylandWindow::configure(uint32_t edges, int32_t width, int32_t height) +{ + QMutexLocker resizeLocker(&mResizeLock); + mConfigure.edges |= edges; + mConfigure.width = width; + mConfigure.height = height; + + if (!mRequestResizeSent && !mConfigure.isEmpty()) { + mRequestResizeSent= true; + QMetaObject::invokeMethod(this, "requestResize", Qt::QueuedConnection); + } +} + +void QWaylandWindow::doResize() +{ + if (mConfigure.isEmpty()) { + return; + } + + int widthWithoutMargins = qMax(mConfigure.width-(frameMargins().left() +frameMargins().right()),1); + int heightWithoutMargins = qMax(mConfigure.height-(frameMargins().top()+frameMargins().bottom()),1); + + widthWithoutMargins = qMax(widthWithoutMargins, window()->minimumSize().width()); + heightWithoutMargins = qMax(heightWithoutMargins, window()->minimumSize().height()); + QRect geometry = QRect(0,0, widthWithoutMargins, heightWithoutMargins); + + int x = 0; + int y = 0; + QSize size = this->geometry().size(); + if (mConfigure.edges & WL_SHELL_SURFACE_RESIZE_LEFT) { + x = size.width() - geometry.width(); + } + if (mConfigure.edges & WL_SHELL_SURFACE_RESIZE_TOP) { + y = size.height() - geometry.height(); + } + mOffset += QPoint(x, y); + + setGeometry(geometry); + + mConfigure.clear(); + QWindowSystemInterface::handleGeometryChange(window(), geometry); +} + +void QWaylandWindow::setCanResize(bool canResize) +{ + QMutexLocker lock(&mResizeLock); + mCanResize = canResize; + + if (canResize && !mConfigure.isEmpty()) { + doResize(); + QWindowSystemInterface::handleExposeEvent(window(), geometry()); + } +} + +void QWaylandWindow::requestResize() +{ + QMutexLocker lock(&mResizeLock); + + if (mCanResize) { + doResize(); + } + + mRequestResizeSent = false; + lock.unlock(); + QWindowSystemInterface::handleExposeEvent(window(), geometry()); + QWindowSystemInterface::flushWindowSystemEvents(); +} + +void QWaylandWindow::attach(QWaylandBuffer *buffer, int x, int y) +{ + mBuffer = buffer; + + if (mBuffer) + attach(mBuffer->buffer(), x, y); + else + QtWayland::wl_surface::attach(0, 0, 0); +} + +void QWaylandWindow::attachOffset(QWaylandBuffer *buffer) +{ + attach(buffer, mOffset.x(), mOffset.y()); + mOffset = QPoint(); +} + +QWaylandBuffer *QWaylandWindow::attached() const +{ + return mBuffer; +} + +void QWaylandWindow::damage(const QRect &rect) +{ + //We have to do sync stuff before calling damage, or we might + //get a frame callback before we get the timestamp + if (!mWaitingForFrameSync) { + mFrameCallback = frame(); + wl_callback_add_listener(mFrameCallback,&QWaylandWindow::callbackListener,this); + mWaitingForFrameSync = true; + } + if (mBuffer) { + damage(rect.x(), rect.y(), rect.width(), rect.height()); + } +} + +const wl_callback_listener QWaylandWindow::callbackListener = { + QWaylandWindow::frameCallback +}; + +void QWaylandWindow::frameCallback(void *data, struct wl_callback *callback, uint32_t time) +{ + Q_UNUSED(time); + QWaylandWindow *self = static_cast(data); + if (callback != self->mFrameCallback) // might be a callback caused by the shm backingstore + return; + self->mWaitingForFrameSync = false; + if (self->mFrameCallback) { + wl_callback_destroy(self->mFrameCallback); + self->mFrameCallback = 0; + } +} + +QMutex QWaylandWindow::mFrameSyncMutex; + +void QWaylandWindow::waitForFrameSync() +{ + QMutexLocker locker(&mFrameSyncMutex); + if (!mWaitingForFrameSync) + return; + mDisplay->flushRequests(); + while (mWaitingForFrameSync) + mDisplay->blockingReadEvents(); +} + +QMargins QWaylandWindow::frameMargins() const +{ + if (mWindowDecoration) + return mWindowDecoration->margins(); + return QPlatformWindow::frameMargins(); +} + +QWaylandShellSurface *QWaylandWindow::shellSurface() const +{ + return mShellSurface; +} + +QWaylandExtendedSurface *QWaylandWindow::extendedWindow() const +{ + return mExtendedWindow; +} + +QWaylandSubSurface *QWaylandWindow::subSurfaceWindow() const +{ + return mSubSurfaceWindow; +} + +void QWaylandWindow::handleContentOrientationChange(Qt::ScreenOrientation orientation) +{ + if (mExtendedWindow) + mExtendedWindow->setContentOrientation(orientation); +} + +void QWaylandWindow::setWindowState(Qt::WindowState state) +{ + if (mState == state) { + return; + } + + // As of february 2013 QWindow::setWindowState sets the new state value after + // QPlatformWindow::setWindowState returns, so we cannot rely on QWindow::windowState + // here. We use then this mState variable. + mState = state; + createDecoration(); + switch (state) { + case Qt::WindowFullScreen: + mShellSurface->setFullscreen(); + break; + case Qt::WindowMaximized: + mShellSurface->setMaximized(); + break; + case Qt::WindowMinimized: + mShellSurface->setMinimized(); + break; + default: + mShellSurface->setNormal(); + } + + QWindowSystemInterface::handleWindowStateChanged(window(), mState); + QWindowSystemInterface::flushWindowSystemEvents(); // Required for oldState to work on WindowStateChanged +} + +void QWaylandWindow::setWindowFlags(Qt::WindowFlags flags) +{ + if (mExtendedWindow) + mExtendedWindow->setWindowFlags(flags); +} + +bool QWaylandWindow::createDecoration() +{ + static bool disableWaylandDecorations = !qgetenv("QT_WAYLAND_DISABLE_WINDOWDECORATION").isEmpty(); + if (disableWaylandDecorations) + return false; + + bool decoration = false; + switch (window()->type()) { + case Qt::Window: + case Qt::Widget: + case Qt::Dialog: + case Qt::Tool: + case Qt::Drawer: + decoration = true; + break; + default: + break; + } + if (window()->flags() & Qt::FramelessWindowHint || isFullscreen()) + decoration = false; + if (window()->flags() & Qt::BypassWindowManagerHint) + decoration = false; + + if (decoration) { + if (!mWindowDecoration) + mWindowDecoration = new QWaylandDecoration(this); + } else { + delete mWindowDecoration; + mWindowDecoration = 0; + } + + return mWindowDecoration; +} + +QWaylandDecoration *QWaylandWindow::decoration() const +{ + return mWindowDecoration; +} + +void QWaylandWindow::setDecoration(QWaylandDecoration *decoration) +{ + mWindowDecoration = decoration; + if (subSurfaceWindow()) { + subSurfaceWindow()->adjustPositionOfChildren(); + } +} + +static QWindow *topLevelWindow(QWindow *window) +{ + while (QWindow *parent = window->parent()) + window = parent; + return window; +} + +QWaylandWindow *QWaylandWindow::transientParent() const +{ + if (window()->transientParent()) { + // Take the top level window here, since the transient parent may be a QWidgetWindow + // or some other window without a shell surface, which is then not able to get mouse + // events, nor set mMouseSerial and mMouseDevice. + return static_cast(topLevelWindow(window()->transientParent())->handle()); + } + return 0; +} + +void QWaylandWindow::handleMouse(QWaylandInputDevice *inputDevice, ulong timestamp, const QPointF &local, const QPointF &global, Qt::MouseButtons b, Qt::KeyboardModifiers mods) +{ + if (b != Qt::NoButton) { + mMouseSerial = inputDevice->serial(); + mMouseDevice = inputDevice; + } + + if (mWindowDecoration) { + handleMouseEventWithDecoration(inputDevice, timestamp,local,global,b,mods); + return; + } + + QWindowSystemInterface::handleMouseEvent(window(),timestamp,local,global,b,mods); +} + +void QWaylandWindow::handleMouseEnter(QWaylandInputDevice *inputDevice) +{ + if (!mWindowDecoration) { + QWindowSystemInterface::handleEnterEvent(window()); + } + restoreMouseCursor(inputDevice); +} + +void QWaylandWindow::handleMouseLeave(QWaylandInputDevice *inputDevice) +{ + if (mWindowDecoration) { + if (mMouseEventsInContentArea) { + QWindowSystemInterface::handleLeaveEvent(window()); + } + } else { + QWindowSystemInterface::handleLeaveEvent(window()); + } + restoreMouseCursor(inputDevice); +} + +void QWaylandWindow::handleMouseEventWithDecoration(QWaylandInputDevice *inputDevice, ulong timestamp, const QPointF &local, const QPointF &global, Qt::MouseButtons b, Qt::KeyboardModifiers mods) +{ + if (mWindowDecoration->handleMouse(inputDevice,local,global,b,mods)) + return; + + QMargins marg = frameMargins(); + QRect windowRect(0 + marg.left(), + 0 + marg.top(), + geometry().size().width() - marg.right(), + geometry().size().height() - marg.bottom()); + if (windowRect.contains(local.toPoint()) || mMousePressedInContentArea != Qt::NoButton) { + QPointF localTranslated = local; + QPointF globalTranslated = global; + localTranslated.setX(localTranslated.x() - marg.left()); + localTranslated.setY(localTranslated.y() - marg.top()); + globalTranslated.setX(globalTranslated.x() - marg.left()); + globalTranslated.setY(globalTranslated.y() - marg.top()); + if (!mMouseEventsInContentArea) { + restoreMouseCursor(inputDevice); + QWindowSystemInterface::handleEnterEvent(window()); + } + QWindowSystemInterface::handleMouseEvent(window(), timestamp, localTranslated, globalTranslated, b, mods); + mMouseEventsInContentArea = true; + mMousePressedInContentArea = b; + } else { + if (mMouseEventsInContentArea) { + QWindowSystemInterface::handleLeaveEvent(window()); + mMouseEventsInContentArea = false; + } + mWindowDecoration->handleMouse(inputDevice,local,global,b,mods); + } +} + +void QWaylandWindow::setMouseCursor(QWaylandInputDevice *device, Qt::CursorShape shape) +{ + if (m_cursorShape != shape || device->serial() > device->cursorSerial()) { + device->setCursor(shape, mScreen); + m_cursorShape = shape; + } +} + +void QWaylandWindow::restoreMouseCursor(QWaylandInputDevice *device) +{ + setMouseCursor(device, window()->cursor().shape()); +} + +void QWaylandWindow::requestActivateWindow() +{ + // no-op. Wayland does not have activation protocol, + // we rely on compositor setting keyboard focus based on window stacking. +} + +bool QWaylandWindow::setMouseGrabEnabled(bool grab) +{ + if (window()->type() != Qt::Popup) { + qWarning("This plugin supports grabbing the mouse only for popup windows"); + return false; + } + + mMouseGrab = grab ? this : 0; + return true; +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandwindow.h b/src/plugins/platforms/wayland/qwaylandwindow.h new file mode 100644 index 00000000000..c4d39180719 --- /dev/null +++ b/src/plugins/platforms/wayland/qwaylandwindow.h @@ -0,0 +1,233 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the config.tests of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWAYLANDWINDOW_H +#define QWAYLANDWINDOW_H + +#include +#include +#include + +#include + +#include "qwaylanddisplay.h" + +#include + +struct wl_egl_window; + +QT_BEGIN_NAMESPACE + +class QWaylandDisplay; +class QWaylandBuffer; +class QWaylandShellSurface; +class QWaylandExtendedSurface; +class QWaylandSubSurface; +class QWaylandDecoration; + +class Q_WAYLAND_CLIENT_EXPORT QWaylandWindowConfigure +{ +public: + QWaylandWindowConfigure() + : width(0) + , height(0) + , edges(0) + { } + + void clear() + { width = height = edges = 0; } + + bool isEmpty() const + { return !height || !width; } + + int width; + int height; + uint32_t edges; +}; + +class Q_WAYLAND_CLIENT_EXPORT QWaylandWindow : public QObject, public QPlatformWindow, public QtWayland::wl_surface +{ + Q_OBJECT +public: + enum WindowType { + Shm, + Egl + }; + + QWaylandWindow(QWindow *window); + ~QWaylandWindow(); + + virtual WindowType windowType() const = 0; + WId winId() const; + void setVisible(bool visible); + void setParent(const QPlatformWindow *parent); + + void setWindowTitle(const QString &title); + + inline QIcon windowIcon() const; + void setWindowIcon(const QIcon &icon); + + void setGeometry(const QRect &rect); + + void configure(uint32_t edges, int32_t width, int32_t height); + + using QtWayland::wl_surface::attach; + void attach(QWaylandBuffer *buffer, int x, int y); + void attachOffset(QWaylandBuffer *buffer); + QWaylandBuffer *attached() const; + QPoint attachOffset() const; + + using QtWayland::wl_surface::damage; + void damage(const QRect &rect); + + void waitForFrameSync(); + + QMargins frameMargins() const; + + static QWaylandWindow *fromWlSurface(::wl_surface *surface); + + QWaylandShellSurface *shellSurface() const; + QWaylandExtendedSurface *extendedWindow() const; + QWaylandSubSurface *subSurfaceWindow() const; + + void handleContentOrientationChange(Qt::ScreenOrientation orientation); + + void setWindowState(Qt::WindowState state); + void setWindowFlags(Qt::WindowFlags flags); + + void raise() Q_DECL_OVERRIDE; + void lower() Q_DECL_OVERRIDE; + + void requestActivateWindow() Q_DECL_OVERRIDE; + + QWaylandDecoration *decoration() const; + void setDecoration(QWaylandDecoration *decoration); + + + void handleMouse(QWaylandInputDevice *inputDevice, + ulong timestamp, + const QPointF & local, + const QPointF & global, + Qt::MouseButtons b, + Qt::KeyboardModifiers mods); + void handleMouseEnter(QWaylandInputDevice *inputDevice); + void handleMouseLeave(QWaylandInputDevice *inputDevice); + + bool createDecoration(); + + inline bool isMaximized() const { return mState == Qt::WindowMaximized; } + inline bool isFullscreen() const { return mState == Qt::WindowFullScreen; } + + void setMouseCursor(QWaylandInputDevice *device, Qt::CursorShape shape); + void restoreMouseCursor(QWaylandInputDevice *device); + + QWaylandWindow *transientParent() const; + + QMutex *resizeMutex() { return &mResizeLock; } + void doResize(); + void setCanResize(bool canResize); + + bool setMouseGrabEnabled(bool grab); + static QWaylandWindow *mouseGrab() { return mMouseGrab; } + +public slots: + void requestResize(); + +protected: + QWaylandScreen *mScreen; + QWaylandDisplay *mDisplay; + QWaylandShellSurface *mShellSurface; + QWaylandExtendedSurface *mExtendedWindow; + QWaylandSubSurface *mSubSurfaceWindow; + + QWaylandDecoration *mWindowDecoration; + bool mMouseEventsInContentArea; + Qt::MouseButtons mMousePressedInContentArea; + Qt::CursorShape m_cursorShape; + + QWaylandBuffer *mBuffer; + WId mWindowId; + bool mWaitingForFrameSync; + struct wl_callback *mFrameCallback; + QWaitCondition mFrameSyncWait; + + QMutex mResizeLock; + QWaylandWindowConfigure mConfigure; + bool mRequestResizeSent; + bool mCanResize; + + bool mSentInitialResize; + QPoint mOffset; + + QIcon mWindowIcon; + QWaylandInputDevice *mMouseDevice; + int mMouseSerial; + + Qt::WindowState mState; + +private: + void handleMouseEventWithDecoration(QWaylandInputDevice *inputDevice, + ulong timestamp, + const QPointF & local, + const QPointF & global, + Qt::MouseButtons b, + Qt::KeyboardModifiers mods); + + static const wl_callback_listener callbackListener; + static void frameCallback(void *data, struct wl_callback *wl_callback, uint32_t time); + + static QMutex mFrameSyncMutex; + static QWaylandWindow *mMouseGrab; +}; + +inline QIcon QWaylandWindow::windowIcon() const +{ + return mWindowIcon; +} + +inline QPoint QWaylandWindow::attachOffset() const +{ + return mOffset; +} + +QT_END_NAMESPACE + +#endif // QWAYLANDWINDOW_H diff --git a/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration.cpp b/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration.cpp new file mode 100644 index 00000000000..7543ba13c2e --- /dev/null +++ b/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration.cpp @@ -0,0 +1,159 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qwaylandwindowmanagerintegration.h" +#include "qwaylandscreen.h" +#include "qwaylandwindow.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +QT_BEGIN_NAMESPACE + +class QWaylandWindowManagerIntegrationPrivate { +public: + QWaylandWindowManagerIntegrationPrivate(QWaylandDisplay *waylandDisplay); + bool m_blockPropertyUpdates; + QWaylandDisplay *m_waylandDisplay; + QHash m_queuedProperties; + bool m_showIsFullScreen; +}; + +QWaylandWindowManagerIntegrationPrivate::QWaylandWindowManagerIntegrationPrivate(QWaylandDisplay *waylandDisplay) + : m_blockPropertyUpdates(false) + , m_waylandDisplay(waylandDisplay) + , m_showIsFullScreen(false) +{ + +} + +QWaylandWindowManagerIntegration::QWaylandWindowManagerIntegration(QWaylandDisplay *waylandDisplay) + : d_ptr(new QWaylandWindowManagerIntegrationPrivate(waylandDisplay)) +{ + waylandDisplay->addRegistryListener(&wlHandleListenerGlobal, this); +} + +QWaylandWindowManagerIntegration::~QWaylandWindowManagerIntegration() +{ + +} + +bool QWaylandWindowManagerIntegration::showIsFullScreen() const +{ + Q_D(const QWaylandWindowManagerIntegration); + return d->m_showIsFullScreen; +} + +void QWaylandWindowManagerIntegration::wlHandleListenerGlobal(void *data, wl_registry *registry, uint32_t id, const QString &interface, uint32_t version) +{ + Q_UNUSED(version); + if (interface == "qt_windowmanager") + static_cast(data)->init(registry, id); +} + +void QWaylandWindowManagerIntegration::windowmanager_hints(int32_t showIsFullScreen) +{ + Q_D(QWaylandWindowManagerIntegration); + d->m_showIsFullScreen = showIsFullScreen; +} + +void QWaylandWindowManagerIntegration::windowmanager_quit() +{ + QGuiApplication::quit(); +} + +QByteArray QWaylandWindowManagerIntegration::desktopEnvironment() const +{ + const QByteArray xdgCurrentDesktop = qgetenv("XDG_CURRENT_DESKTOP"); + if (!xdgCurrentDesktop.isEmpty()) + return xdgCurrentDesktop.toUpper(); // KDE, GNOME, UNITY, LXDE, MATE, XFCE... + + // Classic fallbacks + if (!qEnvironmentVariableIsEmpty("KDE_FULL_SESSION")) + return QByteArrayLiteral("KDE"); + if (!qEnvironmentVariableIsEmpty("GNOME_DESKTOP_SESSION_ID")) + return QByteArrayLiteral("GNOME"); + + // Fallback to checking $DESKTOP_SESSION (unreliable) + const QByteArray desktopSession = qgetenv("DESKTOP_SESSION"); + if (desktopSession == "gnome") + return QByteArrayLiteral("GNOME"); + if (desktopSession == "xfce") + return QByteArrayLiteral("XFCE"); + + return QByteArrayLiteral("UNKNOWN"); +} + +void QWaylandWindowManagerIntegration::openUrl_helper(const QUrl &url) +{ + if (isInitialized()) { + QByteArray data = url.toString().toUtf8(); + + static const int chunkSize = 128; + while (!data.isEmpty()) { + QByteArray chunk = data.left(chunkSize); + data = data.mid(chunkSize); + open_url(!data.isEmpty(), QString::fromUtf8(chunk)); + } + } +} + +bool QWaylandWindowManagerIntegration::openUrl(const QUrl &url) +{ + openUrl_helper(url); + return true; +} + +bool QWaylandWindowManagerIntegration::openDocument(const QUrl &url) +{ + openUrl_helper(url); + return true; +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration.h b/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration.h new file mode 100644 index 00000000000..4506f06a1fa --- /dev/null +++ b/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration.h @@ -0,0 +1,88 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWAYLANDWINDOWMANAGERINTEGRATION_H +#define QWAYLANDWINDOWMANAGERINTEGRATION_H + +#include +#include + +#include "wayland-client.h" +#include "qwaylanddisplay.h" +#include + +#include "QtWaylandClient/private/qwayland-windowmanager.h" + +QT_BEGIN_NAMESPACE + +class QWaylandWindow; +class QWaylandWindowManagerIntegrationPrivate; + +class Q_WAYLAND_CLIENT_EXPORT QWaylandWindowManagerIntegration : public QObject, public QPlatformServices, public QtWayland::qt_windowmanager +{ + Q_OBJECT + Q_DECLARE_PRIVATE(QWaylandWindowManagerIntegration) +public: + explicit QWaylandWindowManagerIntegration(QWaylandDisplay *waylandDisplay); + virtual ~QWaylandWindowManagerIntegration(); + + QByteArray desktopEnvironment() const; + + bool openUrl(const QUrl &url); + bool openDocument(const QUrl &url); + + bool showIsFullScreen() const; + +private: + static void wlHandleListenerGlobal(void *data, wl_registry *registry, uint32_t id, + const QString &interface, uint32_t version); + + QScopedPointer d_ptr; + + void windowmanager_hints(int32_t showIsFullScreen) Q_DECL_OVERRIDE; + void windowmanager_quit() Q_DECL_OVERRIDE; + + void openUrl_helper(const QUrl &url); +}; + +QT_END_NAMESPACE + +#endif // QWAYLANDWINDOWMANAGERINTEGRATION_H From e9613ce5b71d12e81c10f2844bbcb630d607a465 Mon Sep 17 00:00:00 2001 From: Jorgen Lind Date: Mon, 18 Nov 2013 12:24:07 +0100 Subject: [PATCH 0063/1507] Use the instealled headers in the public headers for client and use the install generated headers feature for wayland-scanner Change-Id: I6cba9f02f8739ef5fbeeb171582e6d766d9c0fdb Reviewed-by: Andy Nichols --- src/plugins/platforms/wayland/client.pro | 2 -- src/plugins/platforms/wayland/qwaylandbuffer.h | 2 +- src/plugins/platforms/wayland/qwaylanddatadevicemanager.h | 2 +- src/plugins/platforms/wayland/qwaylanddatasource.h | 4 +++- src/plugins/platforms/wayland/qwaylanddisplay.h | 2 +- src/plugins/platforms/wayland/qwaylanddnd.h | 2 +- src/plugins/platforms/wayland/qwaylandextendedoutput.h | 2 +- src/plugins/platforms/wayland/qwaylandinputdevice.h | 2 +- src/plugins/platforms/wayland/qwaylandnativeinterface.h | 2 +- src/plugins/platforms/wayland/qwaylandqtkey.h | 2 +- src/plugins/platforms/wayland/qwaylandshmbackingstore.h | 6 +++--- src/plugins/platforms/wayland/qwaylandshmwindow.h | 2 +- src/plugins/platforms/wayland/qwaylandtouch.h | 2 +- src/plugins/platforms/wayland/qwaylandwindow.h | 2 +- .../platforms/wayland/qwaylandwindowmanagerintegration.h | 4 ++-- 15 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/plugins/platforms/wayland/client.pro b/src/plugins/platforms/wayland/client.pro index 66dc1a4754c..7aac1d1b64a 100644 --- a/src/plugins/platforms/wayland/client.pro +++ b/src/plugins/platforms/wayland/client.pro @@ -40,7 +40,6 @@ WAYLANDCLIENTSOURCES += \ ../extensions/windowmanager.xml \ ../3rdparty/protocol/text.xml \ - SOURCES += qwaylandintegration.cpp \ qwaylandnativeinterface.cpp \ qwaylandshmbackingstore.cpp \ @@ -100,4 +99,3 @@ contains(DEFINES, QT_WAYLAND_GL_SUPPORT) { SOURCES += qwaylandglintegration.cpp HEADERS += qwaylandglintegration.h } - diff --git a/src/plugins/platforms/wayland/qwaylandbuffer.h b/src/plugins/platforms/wayland/qwaylandbuffer.h index 8d9ceaa8abc..9548eadf873 100644 --- a/src/plugins/platforms/wayland/qwaylandbuffer.h +++ b/src/plugins/platforms/wayland/qwaylandbuffer.h @@ -42,7 +42,7 @@ #ifndef QWAYLANDBUFFER_H #define QWAYLANDBUFFER_H -#include "qwaylandclientexport.h" +#include #include #include diff --git a/src/plugins/platforms/wayland/qwaylanddatadevicemanager.h b/src/plugins/platforms/wayland/qwaylanddatadevicemanager.h index 6b3ad177cce..c51e12e7823 100644 --- a/src/plugins/platforms/wayland/qwaylanddatadevicemanager.h +++ b/src/plugins/platforms/wayland/qwaylanddatadevicemanager.h @@ -42,7 +42,7 @@ #ifndef QWAYLANDDATADEVICEMANAGER_H #define QWAYLANDDATADEVICEMANAGER_H -#include "qwaylanddisplay.h" +#include QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylanddatasource.h b/src/plugins/platforms/wayland/qwaylanddatasource.h index 670a8872ff6..63a2150f802 100644 --- a/src/plugins/platforms/wayland/qwaylanddatasource.h +++ b/src/plugins/platforms/wayland/qwaylanddatasource.h @@ -42,7 +42,9 @@ #ifndef QWAYLANDDATASOURCE_H #define QWAYLANDDATASOURCE_H -#include "qwaylanddisplay.h" +#include + +#include QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.h b/src/plugins/platforms/wayland/qwaylanddisplay.h index 45104350738..b841a21ca65 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay.h @@ -48,8 +48,8 @@ #include #include -#include +#include #include struct wl_cursor_image; diff --git a/src/plugins/platforms/wayland/qwaylanddnd.h b/src/plugins/platforms/wayland/qwaylanddnd.h index f125dd2b2f6..8879a1d4ea9 100644 --- a/src/plugins/platforms/wayland/qwaylanddnd.h +++ b/src/plugins/platforms/wayland/qwaylanddnd.h @@ -47,7 +47,7 @@ #include #include -#include "qwaylanddisplay.h" +#include QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandextendedoutput.h b/src/plugins/platforms/wayland/qwaylandextendedoutput.h index e311a9b4f63..d1ef3397f85 100644 --- a/src/plugins/platforms/wayland/qwaylandextendedoutput.h +++ b/src/plugins/platforms/wayland/qwaylandextendedoutput.h @@ -42,7 +42,7 @@ #ifndef QWAYLANDEXTENDEDOUTPUT_H #define QWAYLANDEXTENDEDOUTPUT_H -#include "qwaylanddisplay.h" +#include #include QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.h b/src/plugins/platforms/wayland/qwaylandinputdevice.h index 625d773d14d..641c8b84026 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.h +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.h @@ -42,7 +42,7 @@ #ifndef QWAYLANDINPUTDEVICE_H #define QWAYLANDINPUTDEVICE_H -#include "qwaylandwindow.h" +#include #include #include diff --git a/src/plugins/platforms/wayland/qwaylandnativeinterface.h b/src/plugins/platforms/wayland/qwaylandnativeinterface.h index c5f0fda73c9..bc080769397 100644 --- a/src/plugins/platforms/wayland/qwaylandnativeinterface.h +++ b/src/plugins/platforms/wayland/qwaylandnativeinterface.h @@ -42,7 +42,7 @@ #ifndef QWAYLANDNATIVEINTERFACE_H #define QWAYLANDNATIVEINTERFACE_H -#include "qwaylandscreen.h" +#include #include #include diff --git a/src/plugins/platforms/wayland/qwaylandqtkey.h b/src/plugins/platforms/wayland/qwaylandqtkey.h index 0acc9e8ad7f..49563b78e01 100644 --- a/src/plugins/platforms/wayland/qwaylandqtkey.h +++ b/src/plugins/platforms/wayland/qwaylandqtkey.h @@ -42,7 +42,7 @@ #ifndef QWAYLANDQTKEY_H #define QWAYLANDQTKEY_H -#include "qwaylanddisplay.h" +#include #include #include diff --git a/src/plugins/platforms/wayland/qwaylandshmbackingstore.h b/src/plugins/platforms/wayland/qwaylandshmbackingstore.h index c7875f52c17..b5ee3a38cb3 100644 --- a/src/plugins/platforms/wayland/qwaylandshmbackingstore.h +++ b/src/plugins/platforms/wayland/qwaylandshmbackingstore.h @@ -42,10 +42,10 @@ #ifndef QWAYLANDSHMBACKINGSTORE_H #define QWAYLANDSHMBACKINGSTORE_H -#include "qwaylandbuffer.h" +#include -#include "qwaylanddecoration.h" -#include "qwaylandshmwindow.h" +#include +#include #include #include diff --git a/src/plugins/platforms/wayland/qwaylandshmwindow.h b/src/plugins/platforms/wayland/qwaylandshmwindow.h index e443bb18743..f915c545f0e 100644 --- a/src/plugins/platforms/wayland/qwaylandshmwindow.h +++ b/src/plugins/platforms/wayland/qwaylandshmwindow.h @@ -42,7 +42,7 @@ #ifndef QWAYLANDSHMWINDOW_H #define QWAYLANDSHMWINDOW_H -#include "qwaylandwindow.h" +#include #include QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandtouch.h b/src/plugins/platforms/wayland/qwaylandtouch.h index 0d14330e710..e6f57ab575c 100644 --- a/src/plugins/platforms/wayland/qwaylandtouch.h +++ b/src/plugins/platforms/wayland/qwaylandtouch.h @@ -42,7 +42,7 @@ #ifndef QWAYLANDTOUCh_H #define QWAYLANDTOUCH_H -#include "qwaylanddisplay.h" +#include #include #include diff --git a/src/plugins/platforms/wayland/qwaylandwindow.h b/src/plugins/platforms/wayland/qwaylandwindow.h index c4d39180719..1f7344dc267 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.h +++ b/src/plugins/platforms/wayland/qwaylandwindow.h @@ -48,7 +48,7 @@ #include -#include "qwaylanddisplay.h" +#include #include diff --git a/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration.h b/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration.h index 4506f06a1fa..2164f4c8da4 100644 --- a/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration.h +++ b/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration.h @@ -46,10 +46,10 @@ #include #include "wayland-client.h" -#include "qwaylanddisplay.h" +#include #include -#include "QtWaylandClient/private/qwayland-windowmanager.h" +#include QT_BEGIN_NAMESPACE From 6000c4af021b5394d8530b360545a8b9bcf4198e Mon Sep 17 00:00:00 2001 From: Jorgen Lind Date: Wed, 20 Nov 2013 16:19:46 +0100 Subject: [PATCH 0064/1507] Move to new hardware structure for the platform plugins Change-Id: I0d383e4cdd59c4e4eae5506c814f0c80ecbf58ae Reviewed-by: Andy Nichols --- .../platforms/wayland/qwaylanddisplay.cpp | 32 +++++-------------- .../platforms/wayland/qwaylanddisplay.h | 14 +++----- .../platforms/wayland/qwaylandintegration.cpp | 32 +++++++------------ .../platforms/wayland/qwaylandintegration.h | 2 ++ 4 files changed, 27 insertions(+), 53 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index d9a8b4528a6..4bcf2f68960 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -42,6 +42,7 @@ #include "qwaylanddisplay.h" #include "qwaylandeventthread.h" +#include "qwaylandintegration.h" #include "qwaylandwindow.h" #include "qwaylandscreen.h" #include "qwaylandcursor.h" @@ -49,9 +50,7 @@ #include "qwaylandclipboard.h" #include "qwaylanddatadevicemanager.h" -#ifdef QT_WAYLAND_GL_SUPPORT #include "qwaylandglintegration.h" -#endif #include "qwaylandwindowmanagerintegration.h" @@ -79,14 +78,12 @@ struct wl_surface *QWaylandDisplay::createSurface(void *handle) return surface; } -#ifdef QT_WAYLAND_GL_SUPPORT -QWaylandGLIntegration * QWaylandDisplay::eglIntegration() +QWaylandGLIntegration * QWaylandDisplay::glIntegration() const { - return mEglIntegration; + return mWaylandIntegration->glIntegration(); } -#endif -QWaylandWindowManagerIntegration *QWaylandDisplay::windowManagerIntegration() +QWaylandWindowManagerIntegration *QWaylandDisplay::windowManagerIntegration() const { return mWindowManagerIntegration; } @@ -103,8 +100,9 @@ void QWaylandDisplay::setLastKeyboardFocusInputDevice(QWaylandInputDevice *devic static QWaylandDisplay *display = 0; -QWaylandDisplay::QWaylandDisplay() - : mLastKeyboardFocusInputDevice(0) +QWaylandDisplay::QWaylandDisplay(QWaylandIntegration *waylandIntegration) + : mWaylandIntegration(waylandIntegration) + , mLastKeyboardFocusInputDevice(0) , mDndSelectionHandler(0) , mWindowExtension(0) , mSubSurfaceExtension(0) @@ -134,30 +132,15 @@ QWaylandDisplay::QWaylandDisplay() connect(mEventThreadObject, SIGNAL(newEventsRead()), this, SLOT(flushRequests())); -#ifdef QT_WAYLAND_GL_SUPPORT - //mEglIntegration = QWaylandGLIntegration::createGLIntegration(this); -#endif - mWindowManagerIntegration = new QWaylandWindowManagerIntegration(this); blockingReadEvents(); -#ifdef QT_WAYLAND_GL_SUPPORT - mEglIntegration->initialize(); - - flushRequests(); - while (mEglIntegration->waitingForEvents()) - blockingReadEvents(); -#endif - waitForScreens(); } QWaylandDisplay::~QWaylandDisplay(void) { -#ifdef QT_WAYLAND_GL_SUPPORT - delete mEglIntegration; -#endif mEventThread->quit(); mEventThread->wait(); delete mEventThreadObject; @@ -172,6 +155,7 @@ void QWaylandDisplay::flushRequests() wl_display_flush(mDisplay); } + void QWaylandDisplay::blockingReadEvents() { if (wl_display_dispatch_queue(mDisplay, mEventQueue) == -1 && errno == EPIPE) { diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.h b/src/plugins/platforms/wayland/qwaylanddisplay.h index b841a21ca65..c58a45f5d82 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay.h @@ -69,6 +69,7 @@ class QWaylandTouchExtension; class QWaylandQtKeyExtension; class QWaylandWindow; class QWaylandEventThread; +class QWaylandIntegration; namespace QtWayland { class qt_output_extension; @@ -88,7 +89,7 @@ class Q_WAYLAND_CLIENT_EXPORT QWaylandDisplay : public QObject, public QtWayland Q_OBJECT public: - QWaylandDisplay(void); + QWaylandDisplay(QWaylandIntegration *waylandIntegration); ~QWaylandDisplay(void); QList screens() const { return mScreens; } @@ -97,11 +98,9 @@ public: struct wl_surface *createSurface(void *handle); -#ifdef QT_WAYLAND_GL_SUPPORT - QWaylandGLIntegration *eglIntegration(); -#endif + QWaylandGLIntegration *glIntegration() const; - QWaylandWindowManagerIntegration *windowManagerIntegration(); + QWaylandWindowManagerIntegration *windowManagerIntegration() const; void setCursor(struct wl_buffer *buffer, struct wl_cursor_image *image); @@ -161,6 +160,7 @@ private: QList mScreens; QList mInputDevices; QList mRegistryListeners; + QWaylandIntegration *mWaylandIntegration; QWaylandInputDevice *mLastKeyboardFocusInputDevice; QWaylandDataDeviceManager *mDndSelectionHandler; QtWayland::qt_surface_extension *mWindowExtension; @@ -178,10 +178,6 @@ private: void registry_global(uint32_t id, const QString &interface, uint32_t version) Q_DECL_OVERRIDE; -#ifdef QT_WAYLAND_GL_SUPPORT - QWaylandGLIntegration *mEglIntegration; -#endif - static void shellHandleConfigure(void *data, struct wl_shell *shell, uint32_t time, uint32_t edges, struct wl_surface *surface, diff --git a/src/plugins/platforms/wayland/qwaylandintegration.cpp b/src/plugins/platforms/wayland/qwaylandintegration.cpp index 9c02419b8e9..af4c4f7d4e2 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandintegration.cpp @@ -110,7 +110,7 @@ QWaylandIntegration::QWaylandIntegration() , mAccessibility(0) #endif { - mDisplay = new QWaylandDisplay(); + mDisplay = new QWaylandDisplay(this); mClipboard = new QWaylandClipboard(mDisplay); mDrag = new QWaylandDrag(mDisplay); @@ -141,17 +141,9 @@ bool QWaylandIntegration::hasCapability(QPlatformIntegration::Capability cap) co switch (cap) { case ThreadedPixmaps: return true; case OpenGL: -#ifdef QT_WAYLAND_GL_SUPPORT - return true; -#else - return false; -#endif + return mDisplay->glIntegration(); case ThreadedOpenGL: -#ifdef QT_WAYLAND_GL_SUPPORT - return mDisplay->eglIntegration()->supportsThreadedOpenGL(); -#else - return false; -#endif + return mDisplay->glIntegration() && mDisplay->glIntegration()->supportsThreadedOpenGL(); case BufferQueueingOpenGL: return true; case MultipleWindows: @@ -163,21 +155,16 @@ bool QWaylandIntegration::hasCapability(QPlatformIntegration::Capability cap) co QPlatformWindow *QWaylandIntegration::createPlatformWindow(QWindow *window) const { -#ifdef QT_WAYLAND_GL_SUPPORT - if (window->surfaceType() == QWindow::OpenGLSurface) - return mDisplay->eglIntegration()->createEglWindow(window); -#endif + if (window->surfaceType() == QWindow::OpenGLSurface && mDisplay->glIntegration()) + return mDisplay->glIntegration()->createEglWindow(window); return new QWaylandShmWindow(window); } QPlatformOpenGLContext *QWaylandIntegration::createPlatformOpenGLContext(QOpenGLContext *context) const { -#ifdef QT_WAYLAND_GL_SUPPORT - return mDisplay->eglIntegration()->createPlatformOpenGLContext(context->format(), context->shareHandle()); -#else - Q_UNUSED(context); + if (mDisplay->glIntegration()) + return mDisplay->glIntegration()->createPlatformOpenGLContext(context->format(), context->shareHandle()); return 0; -#endif } QPlatformBackingStore *QWaylandIntegration::createPlatformBackingStore(QWindow *window) const @@ -249,4 +236,9 @@ QPlatformTheme *QWaylandIntegration::createPlatformTheme(const QString &name) co return GenericWaylandTheme::createUnixTheme(name); } +QWaylandGLIntegration *QWaylandIntegration::glIntegration() const +{ + return 0; +} + QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandintegration.h b/src/plugins/platforms/wayland/qwaylandintegration.h index 8886c28da5f..ebda9b2845e 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.h +++ b/src/plugins/platforms/wayland/qwaylandintegration.h @@ -49,6 +49,7 @@ QT_BEGIN_NAMESPACE class QWaylandBuffer; class QWaylandDisplay; +class QWaylandGLIntegration; class Q_WAYLAND_CLIENT_EXPORT QWaylandIntegration : public QPlatformIntegration { @@ -86,6 +87,7 @@ public: QPlatformTheme *createPlatformTheme(const QString &name) const; + virtual QWaylandGLIntegration *glIntegration() const; private: QPlatformFontDatabase *mFontDb; QPlatformClipboard *mClipboard; From 310045c9303198933e41e09ca60cbbc1f386780f Mon Sep 17 00:00:00 2001 From: Jorgen Lind Date: Thu, 21 Nov 2013 08:14:03 +0100 Subject: [PATCH 0065/1507] make compositor build with new directory layout Change-Id: I3ede73420af9cb95820a9bec4fe7305f1107e22d Reviewed-by: Andy Nichols --- .../plugins/hardwareintegration/client.pro | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 src/plugins/platforms/wayland/plugins/hardwareintegration/client.pro diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/client.pro b/src/plugins/platforms/wayland/plugins/hardwareintegration/client.pro new file mode 100644 index 00000000000..1b8f0764095 --- /dev/null +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/client.pro @@ -0,0 +1,16 @@ +TEMPLATE=subdirs + +#config_wayland_egl { +# SUBDIRS += qwayland-egl +#} +#config_brcm_egl { +# SUBDIRS += qwayland-brcm-egl +#} +#config_xcomposite { +# config_egl { +# SUBDIRS += qwayland-xcomposite-egl +# } +# config_glx { +# SUBDIRS += qwayland-xcomposite-glx +# } +#} From 778b009d5373607c5b67ecc2b17bf7ce6e5527fd Mon Sep 17 00:00:00 2001 From: Jorgen Lind Date: Wed, 13 Nov 2013 16:30:22 +0100 Subject: [PATCH 0066/1507] Add server buffer extension Change-Id: I69b8f59eecf807179e5962e111f7096a6dfbd797 Reviewed-by: Andy Nichols --- .../extensions/server-buffer-extension.xml | 56 +++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 src/3rdparty/wayland/extensions/server-buffer-extension.xml diff --git a/src/3rdparty/wayland/extensions/server-buffer-extension.xml b/src/3rdparty/wayland/extensions/server-buffer-extension.xml new file mode 100644 index 00000000000..28271c67ada --- /dev/null +++ b/src/3rdparty/wayland/extensions/server-buffer-extension.xml @@ -0,0 +1,56 @@ + + + + Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). + Contact: http://www.qt-project.org/legal + + This file is part of the plugins of the Qt Toolkit. + + $QT_BEGIN_LICENSE:BSD$ + You may use this file under the terms of the BSD license as follows: + + "Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names + of its contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." + + $QT_END_LICENSE$ + + + + + Server buffer is an extension which makes it possible to share a + buffer created by the compositor to share it with arbitrary + clients. These types of buffers are intended to be read only + buffers for clients, but this is an implementation detail. + + Server buffers main purpose is to help implement caches + + + + + + + + From 4875f1d1bb993a65903dbef43f252d7e4ed29341 Mon Sep 17 00:00:00 2001 From: Jorgen Lind Date: Thu, 21 Nov 2013 13:43:23 +0100 Subject: [PATCH 0067/1507] Rename QWaylandGLIntegration to QWaylandClientBufferIntegration also add a factory to load QWaylandClientBufferIntegrationPlugins Change-Id: Ia6a03627659b0452439ae664fceef21eaf0f6de0 Reviewed-by: Andy Nichols --- src/plugins/platforms/wayland/client.pro | 5 +- .../hardwareintegration.pri | 10 ++ .../qwaylandclientbufferintegration.cpp} | 6 +- .../qwaylandclientbufferintegration.h} | 14 +-- ...qwaylandclientbufferintegrationfactory.cpp | 96 +++++++++++++++++++ .../qwaylandclientbufferintegrationfactory.h | 61 ++++++++++++ .../qwaylandclientbufferintegrationplugin.cpp | 55 +++++++++++ .../qwaylandclientbufferintegrationplugin.h | 69 +++++++++++++ .../platforms/wayland/qwaylanddisplay.cpp | 6 +- .../platforms/wayland/qwaylanddisplay.h | 4 +- .../platforms/wayland/qwaylandintegration.cpp | 43 ++++++--- .../platforms/wayland/qwaylandintegration.h | 8 +- 12 files changed, 344 insertions(+), 33 deletions(-) create mode 100644 src/plugins/platforms/wayland/hardwareintegration/hardwareintegration.pri rename src/plugins/platforms/wayland/{qwaylandglintegration.cpp => hardwareintegration/qwaylandclientbufferintegration.cpp} (91%) rename src/plugins/platforms/wayland/{qwaylandglintegration.h => hardwareintegration/qwaylandclientbufferintegration.h} (87%) create mode 100644 src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationfactory.cpp create mode 100644 src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationfactory.h create mode 100644 src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationplugin.cpp create mode 100644 src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationplugin.h diff --git a/src/plugins/platforms/wayland/client.pro b/src/plugins/platforms/wayland/client.pro index 7aac1d1b64a..152370c0bec 100644 --- a/src/plugins/platforms/wayland/client.pro +++ b/src/plugins/platforms/wayland/client.pro @@ -95,7 +95,4 @@ HEADERS += qwaylandintegration.h \ qwaylandinputcontext.h \ qwaylanddatadevice.h \ -contains(DEFINES, QT_WAYLAND_GL_SUPPORT) { - SOURCES += qwaylandglintegration.cpp - HEADERS += qwaylandglintegration.h -} +include(hardwareintegration/hardwareintegration.pri) diff --git a/src/plugins/platforms/wayland/hardwareintegration/hardwareintegration.pri b/src/plugins/platforms/wayland/hardwareintegration/hardwareintegration.pri new file mode 100644 index 00000000000..2ed95368fca --- /dev/null +++ b/src/plugins/platforms/wayland/hardwareintegration/hardwareintegration.pri @@ -0,0 +1,10 @@ +SOURCES += \ + $$PWD/qwaylandclientbufferintegration.cpp \ + $$PWD/qwaylandclientbufferintegrationplugin.cpp \ + $$PWD/qwaylandclientbufferintegrationfactory.cpp + +HEADERS += \ + $$PWD/qwaylandclientbufferintegration.h \ + $$PWD/qwaylandclientbufferintegrationplugin.h \ + $$PWD/qwaylandclientbufferintegrationfactory.h + diff --git a/src/plugins/platforms/wayland/qwaylandglintegration.cpp b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegration.cpp similarity index 91% rename from src/plugins/platforms/wayland/qwaylandglintegration.cpp rename to src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegration.cpp index bafb99443ba..c04ee177204 100644 --- a/src/plugins/platforms/wayland/qwaylandglintegration.cpp +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegration.cpp @@ -39,16 +39,16 @@ ** ****************************************************************************/ -#include "qwaylandglintegration.h" +#include "qwaylandclientbufferintegration.h" QT_BEGIN_NAMESPACE -QWaylandGLIntegration::QWaylandGLIntegration() +QWaylandClientBufferIntegration::QWaylandClientBufferIntegration() { } -QWaylandGLIntegration::~QWaylandGLIntegration() +QWaylandClientBufferIntegration::~QWaylandClientBufferIntegration() { } diff --git a/src/plugins/platforms/wayland/qwaylandglintegration.h b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegration.h similarity index 87% rename from src/plugins/platforms/wayland/qwaylandglintegration.h rename to src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegration.h index 7697d31034b..12468537e40 100644 --- a/src/plugins/platforms/wayland/qwaylandglintegration.h +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegration.h @@ -39,8 +39,8 @@ ** ****************************************************************************/ -#ifndef QWAYLANDGLINTEGRATION_H -#define QWAYLANDGLINTEGRATION_H +#ifndef QWAYLANDCLIENTBUFFERINTEGRATION_H +#define QWAYLANDCLIENTBUFFERINTEGRATION_H #include #include @@ -54,11 +54,11 @@ class QWindow; class QPlatformOpenGLContext; class QSurfaceFormat; -class Q_WAYLAND_CLIENT_EXPORT QWaylandGLIntegration +class Q_WAYLAND_CLIENT_EXPORT QWaylandClientBufferIntegration { public: - QWaylandGLIntegration(); - virtual ~QWaylandGLIntegration(); + QWaylandClientBufferIntegration(); + virtual ~QWaylandClientBufferIntegration(); virtual void initialize() = 0; virtual bool waitingForEvents() { return false; } @@ -68,9 +68,9 @@ public: virtual QWaylandWindow *createEglWindow(QWindow *window) = 0; virtual QPlatformOpenGLContext *createPlatformOpenGLContext(const QSurfaceFormat &glFormat, QPlatformOpenGLContext *share) const = 0; - static QWaylandGLIntegration *createGLIntegration(QWaylandDisplay *waylandDisplay); + static QWaylandClientBufferIntegration *createGLIntegration(QWaylandDisplay *waylandDisplay); }; QT_END_NAMESPACE -#endif // QWAYLANDGLINTEGRATION_H +#endif // QWAYLANDCLIENTBUFFERINTEGRATION_H diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationfactory.cpp b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationfactory.cpp new file mode 100644 index 00000000000..c87c016f5df --- /dev/null +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationfactory.cpp @@ -0,0 +1,96 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qwaylandclientbufferintegrationfactory.h" +#include "qwaylandclientbufferintegrationplugin.h" +#include "qwaylandclientbufferintegration.h" +#include +#include +#include + +QT_BEGIN_NAMESPACE + +#ifndef QT_NO_LIBRARY +Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader, + (QWaylandClientBufferIntegrationFactoryInterface_iid, QLatin1String("/wayland-graphics-integration/client"), Qt::CaseInsensitive)) +Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, directLoader, + (QWaylandClientBufferIntegrationFactoryInterface_iid, QLatin1String(""), Qt::CaseInsensitive)) +#endif + +QStringList QWaylandClientBufferIntegrationFactory::keys(const QString &pluginPath) +{ +#ifndef QT_NO_LIBRARY + QStringList list; + if (!pluginPath.isEmpty()) { + QCoreApplication::addLibraryPath(pluginPath); + list = directLoader()->keyMap().values(); + if (!list.isEmpty()) { + const QString postFix = QStringLiteral(" (from ") + + QDir::toNativeSeparators(pluginPath) + + QLatin1Char(')'); + const QStringList::iterator end = list.end(); + for (QStringList::iterator it = list.begin(); it != end; ++it) + (*it).append(postFix); + } + } + list.append(loader()->keyMap().values()); + return list; +#else + return QStringList(); +#endif +} + +QWaylandClientBufferIntegration *QWaylandClientBufferIntegrationFactory::create(const QString &name, const QStringList &args, const QString &pluginPath) +{ +#ifndef QT_NO_LIBRARY + // Try loading the plugin from platformPluginPath first: + if (!pluginPath.isEmpty()) { + QCoreApplication::addLibraryPath(pluginPath); + if (QWaylandClientBufferIntegration *ret = qLoadPlugin1(directLoader(), name, args)) + return ret; + } + if (QWaylandClientBufferIntegration *ret = qLoadPlugin1(loader(), name, args)) + return ret; +#endif + return 0; +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationfactory.h b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationfactory.h new file mode 100644 index 00000000000..12b2e8dbbda --- /dev/null +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationfactory.h @@ -0,0 +1,61 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWAYLANDCLIENTBUFFERINTEGRATIONFACTORY_H +#define QWAYLANDCLIENTBUFFERINTEGRATIONFACTORY_H + +#include +#include + +QT_BEGIN_NAMESPACE + +class QWaylandClientBufferIntegration; + +class Q_WAYLAND_CLIENT_EXPORT QWaylandClientBufferIntegrationFactory +{ +public: + static QStringList keys(const QString &pluginPath = QString()); + static QWaylandClientBufferIntegration *create(const QString &name, const QStringList &args, const QString &pluginPath = QString()); +}; + +QT_END_NAMESPACE + +#endif // QWAYLANDCLIENTBUFFERINTEGRATIONFACTORY_H diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationplugin.cpp b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationplugin.cpp new file mode 100644 index 00000000000..58bb26d192f --- /dev/null +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationplugin.cpp @@ -0,0 +1,55 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qwaylandclientbufferintegrationplugin.h" + +QT_BEGIN_NAMESPACE + +QWaylandClientBufferIntegrationPlugin::QWaylandClientBufferIntegrationPlugin(QObject *parent) : + QObject(parent) +{ +} + +QWaylandClientBufferIntegrationPlugin::~QWaylandClientBufferIntegrationPlugin() +{ +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationplugin.h b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationplugin.h new file mode 100644 index 00000000000..6858440613f --- /dev/null +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationplugin.h @@ -0,0 +1,69 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWAYLANDCLIENTBUFFERINTEGRATIONPLUGIN_H +#define QWAYLANDCLIENTBUFFERINTEGRATIONPLUGIN_H + +#include + +#include +#include +#include + +QT_BEGIN_NAMESPACE + +class QWaylandClientBufferIntegration; + +#define QWaylandClientBufferIntegrationFactoryInterface_iid "org.qt-project.Qt.WaylandClient.QWaylandClientBufferIntegrationFactoryInterface.5.1" + +class Q_WAYLAND_CLIENT_EXPORT QWaylandClientBufferIntegrationPlugin : public QObject +{ + Q_OBJECT +public: + explicit QWaylandClientBufferIntegrationPlugin(QObject *parent = 0); + ~QWaylandClientBufferIntegrationPlugin(); + + virtual QWaylandClientBufferIntegration *create(const QString &key, const QStringList ¶mList) = 0; +}; + +QT_END_NAMESPACE + +#endif // QWAYLANDCLIENTBUFFERINTEGRATIONPLUGIN_H diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index 4bcf2f68960..880c76df88b 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -50,7 +50,7 @@ #include "qwaylandclipboard.h" #include "qwaylanddatadevicemanager.h" -#include "qwaylandglintegration.h" +#include "qwaylandclientbufferintegration.h" #include "qwaylandwindowmanagerintegration.h" @@ -78,9 +78,9 @@ struct wl_surface *QWaylandDisplay::createSurface(void *handle) return surface; } -QWaylandGLIntegration * QWaylandDisplay::glIntegration() const +QWaylandClientBufferIntegration * QWaylandDisplay::clientBufferIntegration() const { - return mWaylandIntegration->glIntegration(); + return mWaylandIntegration->clientBufferIntegration(); } QWaylandWindowManagerIntegration *QWaylandDisplay::windowManagerIntegration() const diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.h b/src/plugins/platforms/wayland/qwaylanddisplay.h index c58a45f5d82..4e76de256cb 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay.h @@ -62,7 +62,7 @@ class QSocketNotifier; class QWaylandBuffer; class QPlatformScreen; class QWaylandScreen; -class QWaylandGLIntegration; +class QWaylandClientBufferIntegration; class QWaylandWindowManagerIntegration; class QWaylandDataDeviceManager; class QWaylandTouchExtension; @@ -98,7 +98,7 @@ public: struct wl_surface *createSurface(void *handle); - QWaylandGLIntegration *glIntegration() const; + QWaylandClientBufferIntegration *clientBufferIntegration() const; QWaylandWindowManagerIntegration *windowManagerIntegration() const; diff --git a/src/plugins/platforms/wayland/qwaylandintegration.cpp b/src/plugins/platforms/wayland/qwaylandintegration.cpp index af4c4f7d4e2..3c0c12e4f10 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandintegration.cpp @@ -65,9 +65,8 @@ #include #include -#ifdef QT_WAYLAND_GL_SUPPORT -#include "qwaylandglintegration.h" -#endif +#include "qwaylandclientbufferintegration.h" +#include "qwaylandclientbufferintegrationfactory.h" QT_BEGIN_NAMESPACE @@ -102,13 +101,15 @@ public: }; QWaylandIntegration::QWaylandIntegration() - : mFontDb(new QGenericUnixFontDatabase()) + : mClientBufferIntegration(0) + , mFontDb(new QGenericUnixFontDatabase()) , mNativeInterface(new QWaylandNativeInterface(this)) #ifndef QT_NO_ACCESSIBILITY , mAccessibility(new QPlatformAccessibility()) #else , mAccessibility(0) #endif + , mClientBufferIntegrationInitialized(false) { mDisplay = new QWaylandDisplay(this); mClipboard = new QWaylandClipboard(mDisplay); @@ -141,9 +142,9 @@ bool QWaylandIntegration::hasCapability(QPlatformIntegration::Capability cap) co switch (cap) { case ThreadedPixmaps: return true; case OpenGL: - return mDisplay->glIntegration(); + return mDisplay->clientBufferIntegration(); case ThreadedOpenGL: - return mDisplay->glIntegration() && mDisplay->glIntegration()->supportsThreadedOpenGL(); + return mDisplay->clientBufferIntegration() && mDisplay->clientBufferIntegration()->supportsThreadedOpenGL(); case BufferQueueingOpenGL: return true; case MultipleWindows: @@ -155,15 +156,15 @@ bool QWaylandIntegration::hasCapability(QPlatformIntegration::Capability cap) co QPlatformWindow *QWaylandIntegration::createPlatformWindow(QWindow *window) const { - if (window->surfaceType() == QWindow::OpenGLSurface && mDisplay->glIntegration()) - return mDisplay->glIntegration()->createEglWindow(window); + if (window->surfaceType() == QWindow::OpenGLSurface && mDisplay->clientBufferIntegration()) + return mDisplay->clientBufferIntegration()->createEglWindow(window); return new QWaylandShmWindow(window); } QPlatformOpenGLContext *QWaylandIntegration::createPlatformOpenGLContext(QOpenGLContext *context) const { - if (mDisplay->glIntegration()) - return mDisplay->glIntegration()->createPlatformOpenGLContext(context->format(), context->shareHandle()); + if (mDisplay->clientBufferIntegration()) + return mDisplay->clientBufferIntegration()->createPlatformOpenGLContext(context->format(), context->shareHandle()); return 0; } @@ -236,9 +237,27 @@ QPlatformTheme *QWaylandIntegration::createPlatformTheme(const QString &name) co return GenericWaylandTheme::createUnixTheme(name); } -QWaylandGLIntegration *QWaylandIntegration::glIntegration() const +QWaylandClientBufferIntegration *QWaylandIntegration::clientBufferIntegration() const { - return 0; + if (!mClientBufferIntegrationInitialized) + const_cast(this)->initializeBufferIntegration(); + + return mClientBufferIntegration; +} + +void QWaylandIntegration::initializeBufferIntegration() +{ + mClientBufferIntegrationInitialized = true; + + QByteArray clientBufferIntegrationName = qgetenv("QT_WAYLAND_CLIENT_BUFFER_INTEGRATION"); + if (clientBufferIntegrationName.isEmpty()) + clientBufferIntegrationName = QByteArrayLiteral("wayland-egl"); + + QStringList keys = QWaylandClientBufferIntegrationFactory::keys(); + QString targetKey = QString::fromLocal8Bit(clientBufferIntegrationName); + if (keys.contains(targetKey)) { + mClientBufferIntegration = QWaylandClientBufferIntegrationFactory::create(targetKey, QStringList()); + } } QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandintegration.h b/src/plugins/platforms/wayland/qwaylandintegration.h index ebda9b2845e..bbc3c928a1c 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.h +++ b/src/plugins/platforms/wayland/qwaylandintegration.h @@ -49,7 +49,7 @@ QT_BEGIN_NAMESPACE class QWaylandBuffer; class QWaylandDisplay; -class QWaylandGLIntegration; +class QWaylandClientBufferIntegration; class Q_WAYLAND_CLIENT_EXPORT QWaylandIntegration : public QPlatformIntegration { @@ -87,8 +87,11 @@ public: QPlatformTheme *createPlatformTheme(const QString &name) const; - virtual QWaylandGLIntegration *glIntegration() const; + virtual QWaylandClientBufferIntegration *clientBufferIntegration() const; +protected: + QWaylandClientBufferIntegration *mClientBufferIntegration; private: + void initializeBufferIntegration(); QPlatformFontDatabase *mFontDb; QPlatformClipboard *mClipboard; QPlatformDrag *mDrag; @@ -96,6 +99,7 @@ private: QPlatformNativeInterface *mNativeInterface; QScopedPointer mInputContext; QPlatformAccessibility *mAccessibility; + bool mClientBufferIntegrationInitialized; }; QT_END_NAMESPACE From 49eb590a92c95100f5e3ac6f5b2861d0c1213cd9 Mon Sep 17 00:00:00 2001 From: Jorgen Lind Date: Thu, 21 Nov 2013 14:46:38 +0100 Subject: [PATCH 0068/1507] Change constructor of QWaylandClientBufferIntegration For QWaylandClientBufferIntegrations to be loadable from plugins the constructor shold not take any arguments, but give the display in the initialize function Change-Id: Ie38555120d7f29c6ba7eef0f095837235782684d Reviewed-by: Andy Nichols --- .../hardwareintegration/qwaylandclientbufferintegration.h | 2 +- src/plugins/platforms/wayland/qwaylandintegration.cpp | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegration.h b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegration.h index 12468537e40..7f4fde9b3b6 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegration.h +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegration.h @@ -60,7 +60,7 @@ public: QWaylandClientBufferIntegration(); virtual ~QWaylandClientBufferIntegration(); - virtual void initialize() = 0; + virtual void initialize(QWaylandDisplay *display) = 0; virtual bool waitingForEvents() { return false; } virtual bool supportsThreadedOpenGL() const { return false; } diff --git a/src/plugins/platforms/wayland/qwaylandintegration.cpp b/src/plugins/platforms/wayland/qwaylandintegration.cpp index 3c0c12e4f10..4c10061943d 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandintegration.cpp @@ -258,6 +258,8 @@ void QWaylandIntegration::initializeBufferIntegration() if (keys.contains(targetKey)) { mClientBufferIntegration = QWaylandClientBufferIntegrationFactory::create(targetKey, QStringList()); } + if (mClientBufferIntegration) + mClientBufferIntegration->initialize(mDisplay); } QT_END_NAMESPACE From 6a33e75b8d5e648d8eb1ccf19c507e98fdbe5d43 Mon Sep 17 00:00:00 2001 From: Jorgen Lind Date: Thu, 21 Nov 2013 15:35:06 +0100 Subject: [PATCH 0069/1507] introduce HW integrations client plugins Change-Id: I07bdcf8db16741291b88084f045ae7b93a89b63f Reviewed-by: Andy Nichols --- .../brcm-egl/brcm-egl.json | 3 + .../hardwareintegration/brcm-egl/brcm-egl.pro | 14 ++++ .../hardwareintegration/brcm-egl/main.cpp | 74 +++++++++++++++++++ .../plugins/hardwareintegration/client.pro | 27 ++++--- .../hardwareintegration/wayland-egl/main.cpp | 74 +++++++++++++++++++ .../wayland-egl/wayland-egl.json | 3 + .../wayland-egl/wayland-egl.pro | 12 +++ .../xcomposite-egl/main.cpp | 74 +++++++++++++++++++ .../xcomposite-egl/xcomposite-egl.json | 3 + .../xcomposite-egl/xcomposite-egl.pro | 12 +++ .../xcomposite-glx/main.cpp | 74 +++++++++++++++++++ .../xcomposite-glx/xcomposite-glx.json | 3 + .../xcomposite-glx/xcomposite-glx.pro | 12 +++ 13 files changed, 371 insertions(+), 14 deletions(-) create mode 100644 src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/brcm-egl.json create mode 100644 src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/brcm-egl.pro create mode 100644 src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/main.cpp create mode 100644 src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/main.cpp create mode 100644 src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/wayland-egl.json create mode 100644 src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/wayland-egl.pro create mode 100644 src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-egl/main.cpp create mode 100644 src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-egl/xcomposite-egl.json create mode 100644 src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-egl/xcomposite-egl.pro create mode 100644 src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-glx/main.cpp create mode 100644 src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-glx/xcomposite-glx.json create mode 100644 src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-glx/xcomposite-glx.pro diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/brcm-egl.json b/src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/brcm-egl.json new file mode 100644 index 00000000000..48611c6ab3b --- /dev/null +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/brcm-egl.json @@ -0,0 +1,3 @@ +{ + "Keys": [ "wayland-brcm" ] +} diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/brcm-egl.pro b/src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/brcm-egl.pro new file mode 100644 index 00000000000..d98b7941b35 --- /dev/null +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/brcm-egl.pro @@ -0,0 +1,14 @@ +PLUGIN_TYPE = wayland-graphics-integration/client +load(qt_plugin) + +QT += waylandclient-private + +include(../../../../hardwareintegration/client/brcm-egl/brcm-egl.pri) + +LIBS += -lEGL + +OTHER_FILES += \ + brcm-egl.json + +SOURCES += main.cpp + diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/main.cpp b/src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/main.cpp new file mode 100644 index 00000000000..b7f376555cf --- /dev/null +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/main.cpp @@ -0,0 +1,74 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include "qwaylandbrcmeglclientbufferintegration.h" + +QT_BEGIN_NAMESPACE + +class QWaylandBrcmEglClientBufferPlugin : public QWaylandClientBufferIntegrationPlugin +{ + Q_OBJECT + Q_PLUGIN_METADATA(IID "org.qt-project.Qt.WaylandClient.QWaylandClientBufferIntegrationFactoryInterface.5.1" FILE "brcm-egl.json") +public: + QStringList keys() const; + QWaylandClientBufferIntegration *create(const QString&, const QStringList&); +}; + +QStringList QWaylandBrcmEglClientBufferPlugin::keys() const +{ + QStringList list; + list << "brcm"; + return list; +} + +QWaylandEglClientBufferIntegration *QWaylandBrcmEglClientBufferPlugin::create(const QString& system, const QStringList& paramList) +{ + Q_UNUSED(paramList); + if (system.toLower() == "brcm") + return new QWaylandBrcmEglClientBufferIntegration(); + + return 0; +} + +QT_END_NAMESPACE + +#include "main.moc" diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/client.pro b/src/plugins/platforms/wayland/plugins/hardwareintegration/client.pro index 1b8f0764095..8c8f74bf6fc 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/client.pro +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/client.pro @@ -1,16 +1,15 @@ TEMPLATE=subdirs -#config_wayland_egl { -# SUBDIRS += qwayland-egl -#} -#config_brcm_egl { -# SUBDIRS += qwayland-brcm-egl -#} -#config_xcomposite { -# config_egl { -# SUBDIRS += qwayland-xcomposite-egl -# } -# config_glx { -# SUBDIRS += qwayland-xcomposite-glx -# } -#} +config_wayland_egl: \ + SUBDIRS += wayland-egl + +config_brcm_egl: \ + SUBDIRS += brcm-egl + +config_xcomposite { + config_egl: \ + SUBDIRS += xcomposite-egl + + !contains(QT_CONFIG, opengles2):config_glx: \ + SUBDIRS += xcomposite-glx +} diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/main.cpp b/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/main.cpp new file mode 100644 index 00000000000..a6b7bbb6917 --- /dev/null +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/main.cpp @@ -0,0 +1,74 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include "qwaylandeglclientbufferintegration.h" + +QT_BEGIN_NAMESPACE + +class QWaylandEglClientBufferPlugin : public QWaylandClientBufferIntegrationPlugin +{ + Q_OBJECT + Q_PLUGIN_METADATA(IID "org.qt-project.Qt.WaylandClient.QWaylandClientBufferIntegrationFactoryInterface.5.1" FILE "wayland-egl.json") +public: + QStringList keys() const; + QWaylandClientBufferIntegration *create(const QString&, const QStringList&); +}; + +QStringList QWaylandEglClientBufferPlugin::keys() const +{ + QStringList list; + list << "wayland-egl"; + return list; +} + +QWaylandClientBufferIntegration *QWaylandEglClientBufferPlugin::create(const QString& system, const QStringList& paramList) +{ + Q_UNUSED(paramList); + if (system.toLower() == "wayland-egl") + return new QWaylandEglClientBufferIntegration(); + + return 0; +} + +QT_END_NAMESPACE + +#include "main.moc" diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/wayland-egl.json b/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/wayland-egl.json new file mode 100644 index 00000000000..4ea5bab903f --- /dev/null +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/wayland-egl.json @@ -0,0 +1,3 @@ +{ + "Keys": [ "wayland-egl" ] +} diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/wayland-egl.pro b/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/wayland-egl.pro new file mode 100644 index 00000000000..0eca1d411c1 --- /dev/null +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/wayland-egl.pro @@ -0,0 +1,12 @@ +PLUGIN_TYPE = wayland-graphics-integration/client +load(qt_plugin) + +QT += waylandclient-private + +include(../../../../hardwareintegration/client/wayland-egl/wayland-egl.pri) + +OTHER_FILES += \ + wayland-egl.json + +SOURCES += main.cpp + diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-egl/main.cpp b/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-egl/main.cpp new file mode 100644 index 00000000000..161657c8fe2 --- /dev/null +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-egl/main.cpp @@ -0,0 +1,74 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include "qwaylandxcompositeeglclientbufferintegration.h" + +QT_BEGIN_NAMESPACE + +class QWaylandXCompositeEglClientBufferIntegrationPlugin : public QWaylandClientBufferIntegrationPlugin +{ + Q_OBJECT + Q_PLUGIN_METADATA(IID "org.qt-project.Qt.WaylandClient.QWaylandClientBufferIntegrationFactoryInterface.5.1" FILE "xcomposite-egl.json") +public: + QStringList keys() const; + QWaylandClientBufferIntegration *create(const QString&, const QStringList&); +}; + +QStringList QWaylandXCompositeEglClientBufferIntegrationPlugin::keys() const +{ + QStringList list; + list << "xcomposite" << "xcomposite-egl"; + return list; +} + +QWaylandClientBufferIntegration *QWaylandXCompositeEglClientBufferIntegrationPlugin::create(const QString& system, const QStringList& paramList) +{ + Q_UNUSED(paramList); + if (system.toLower() == "xcomposite" || system.toLower() == "xcomposite-egl") + return new QWaylandXCompositeEGLClientBufferIntegration(); + + return 0; +} + +QT_END_NAMESPACE + +#include "main.moc" diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-egl/xcomposite-egl.json b/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-egl/xcomposite-egl.json new file mode 100644 index 00000000000..8ccd5b46b89 --- /dev/null +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-egl/xcomposite-egl.json @@ -0,0 +1,3 @@ +{ + "Keys": [ "wayland-xcomposite" ] +} diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-egl/xcomposite-egl.pro b/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-egl/xcomposite-egl.pro new file mode 100644 index 00000000000..3129f844b08 --- /dev/null +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-egl/xcomposite-egl.pro @@ -0,0 +1,12 @@ +PLUGIN_TYPE = wayland-graphics-integration/client +load(qt_plugin) + +QT += waylandclient-private + +include(../../../../hardwareintegration/client/xcomposite-egl/xcomposite-egl.pri) + +OTHER_FILES += xcomposite-egl.json + +SOURCES += \ + main.cpp + diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-glx/main.cpp b/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-glx/main.cpp new file mode 100644 index 00000000000..4beb7e6e3cb --- /dev/null +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-glx/main.cpp @@ -0,0 +1,74 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include "qwaylandxcompositeglxclientbufferintegration.h" + +QT_BEGIN_NAMESPACE + +class QWaylandXCompositeGlxClientBufferIntegrationPlugin : public QWaylandClientBufferIntegrationPlugin +{ + Q_OBJECT + Q_PLUGIN_METADATA(IID "org.qt-project.Qt.WaylandClient.QWaylandClientBufferIntegrationFactoryInterface.5.1" FILE "xcomposite-glx.json") +public: + QStringList keys() const; + QWaylandClientBufferIntegration *create(const QString&, const QStringList&); +}; + +QStringList QWaylandXCompositeGlxClientBufferIntegrationPlugin::keys() const +{ + QStringList list; + list << "xcomposite-glx"; + return list; +} + +QWaylandClientBufferIntegration *QWaylandXCompositeGlxClientBufferIntegrationPlugin::create(const QString& system, const QStringList& paramList) +{ + Q_UNUSED(paramList); + if (system.toLower() == "xcomposite-glx") + return new QWaylandXCompositeGLXClientBufferIntegration(); + + return 0; +} + +QT_END_NAMESPACE + +#include "main.moc" diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-glx/xcomposite-glx.json b/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-glx/xcomposite-glx.json new file mode 100644 index 00000000000..0f4a3bf699d --- /dev/null +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-glx/xcomposite-glx.json @@ -0,0 +1,3 @@ +{ + "Keys": [ "wayland-xcomposite-glx" ] +} diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-glx/xcomposite-glx.pro b/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-glx/xcomposite-glx.pro new file mode 100644 index 00000000000..3146b3696ce --- /dev/null +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-glx/xcomposite-glx.pro @@ -0,0 +1,12 @@ +PLUGIN_TYPE = wayland-graphics-integration/client +load(qt_plugin) + +QT += waylandclient-private + +include(../../../../hardwareintegration/client/xcomposite-glx/xcomposite-glx.pri) + +OTHER_FILES += xcomposite-glx.json + +SOURCES += \ + main.cpp + From ba54fc0bb14e3b484df952b06a7043c1e0c7a30d Mon Sep 17 00:00:00 2001 From: Jorgen Lind Date: Fri, 22 Nov 2013 09:08:06 +0100 Subject: [PATCH 0070/1507] Remove compiler warnings in client. Change-Id: Iedd2e53aa8d6c8d09272175e402e64bdb40acb36 Reviewed-by: Andy Nichols --- .../platforms/wayland/qwaylanddisplay.cpp | 22 +++++++++---------- .../platforms/wayland/qwaylandintegration.cpp | 2 +- .../qwaylandwindowmanagerintegration.cpp | 2 +- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index 880c76df88b..436f58bb9cb 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -205,30 +205,30 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin struct ::wl_registry *registry = object(); - if (interface == "wl_output") { + if (interface == QStringLiteral("wl_output")) { mScreens.append(new QWaylandScreen(this, id)); - } else if (interface == "wl_compositor") { + } else if (interface == QStringLiteral("wl_compositor")) { mCompositor.init(registry, id); - } else if (interface == "wl_shm") { + } else if (interface == QStringLiteral("wl_shm")) { mShm = static_cast(wl_registry_bind(registry, id, &wl_shm_interface,1)); - } else if (interface == "wl_shell"){ + } else if (interface == QStringLiteral("wl_shell")){ mShell = new QtWayland::wl_shell(registry, id); - } else if (interface == "wl_seat") { + } else if (interface == QStringLiteral("wl_seat")) { QWaylandInputDevice *inputDevice = new QWaylandInputDevice(this, id); mInputDevices.append(inputDevice); - } else if (interface == "wl_data_device_manager") { + } else if (interface == QStringLiteral("wl_data_device_manager")) { mDndSelectionHandler = new QWaylandDataDeviceManager(this, id); - } else if (interface == "qt_output_extension") { + } else if (interface == QStringLiteral("qt_output_extension")) { mOutputExtension = new QtWayland::qt_output_extension(registry, id); foreach (QPlatformScreen *screen, screens()) static_cast(screen)->createExtendedOutput(); - } else if (interface == "qt_surface_extension") { + } else if (interface == QStringLiteral("qt_surface_extension")) { mWindowExtension = new QtWayland::qt_surface_extension(registry, id); - } else if (interface == "qt_sub_surface_extension") { + } else if (interface == QStringLiteral("qt_sub_surface_extension")) { mSubSurfaceExtension = new QtWayland::qt_sub_surface_extension(registry, id); - } else if (interface == "qt_touch_extension") { + } else if (interface == QStringLiteral("qt_touch_extension")) { mTouchExtension = new QWaylandTouchExtension(this, id); - } else if (interface == "qt_key_extension") { + } else if (interface == QStringLiteral("qt_key_extension")) { mQtKeyExtension = new QWaylandQtKeyExtension(this, id); } else if (interface == "wl_text_input_manager") { mTextInputManager = new QtWayland::wl_text_input_manager(registry, id); diff --git a/src/plugins/platforms/wayland/qwaylandintegration.cpp b/src/plugins/platforms/wayland/qwaylandintegration.cpp index 4c10061943d..32045bc86b6 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandintegration.cpp @@ -90,7 +90,7 @@ public: desktopEnvironment != QByteArrayLiteral("MATE") && desktopEnvironment != QByteArrayLiteral("XFCE") && desktopEnvironment != QByteArrayLiteral("LXDE")) - result.push_back(desktopEnvironment.toLower()); + result.push_back(QString::fromLocal8Bit(desktopEnvironment.toLower())); } if (result.isEmpty()) diff --git a/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration.cpp b/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration.cpp index 7543ba13c2e..d396f14526b 100644 --- a/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration.cpp @@ -93,7 +93,7 @@ bool QWaylandWindowManagerIntegration::showIsFullScreen() const void QWaylandWindowManagerIntegration::wlHandleListenerGlobal(void *data, wl_registry *registry, uint32_t id, const QString &interface, uint32_t version) { Q_UNUSED(version); - if (interface == "qt_windowmanager") + if (interface == QStringLiteral("qt_windowmanager")) static_cast(data)->init(registry, id); } From 11b385740b5d1e4136158c8cdff0ffb97df3e9ac Mon Sep 17 00:00:00 2001 From: Jorgen Lind Date: Fri, 22 Nov 2013 14:12:58 +0100 Subject: [PATCH 0071/1507] Add serverbufferintegration to the qpa plugin Change-Id: I3802ec2c2b69fa56d6a64962590ebaa7314b3eea Reviewed-by: Andy Nichols --- .../extensions/server-buffer-extension.xml | 5 +- .../hardwareintegration.pri | 13 ++- .../qwaylandserverbufferintegration.cpp | 9 ++ .../qwaylandserverbufferintegration.h | 73 ++++++++++++++ ...qwaylandserverbufferintegrationfactory.cpp | 96 +++++++++++++++++++ .../qwaylandserverbufferintegrationfactory.h | 61 ++++++++++++ .../qwaylandserverbufferintegrationplugin.cpp | 54 +++++++++++ .../qwaylandserverbufferintegrationplugin.h | 69 +++++++++++++ .../platforms/wayland/qwaylandintegration.cpp | 32 ++++++- .../platforms/wayland/qwaylandintegration.h | 7 +- 10 files changed, 410 insertions(+), 9 deletions(-) create mode 100644 src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegration.cpp create mode 100644 src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegration.h create mode 100644 src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationfactory.cpp create mode 100644 src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationfactory.h create mode 100644 src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationplugin.cpp create mode 100644 src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationplugin.h diff --git a/src/3rdparty/wayland/extensions/server-buffer-extension.xml b/src/3rdparty/wayland/extensions/server-buffer-extension.xml index 28271c67ada..370a8013751 100644 --- a/src/3rdparty/wayland/extensions/server-buffer-extension.xml +++ b/src/3rdparty/wayland/extensions/server-buffer-extension.xml @@ -38,7 +38,7 @@ $QT_END_LICENSE$ - + Server buffer is an extension which makes it possible to share a buffer created by the compositor to share it with arbitrary @@ -47,9 +47,6 @@ Server buffers main purpose is to help implement caches - - - diff --git a/src/plugins/platforms/wayland/hardwareintegration/hardwareintegration.pri b/src/plugins/platforms/wayland/hardwareintegration/hardwareintegration.pri index 2ed95368fca..0ace4777e6a 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/hardwareintegration.pri +++ b/src/plugins/platforms/wayland/hardwareintegration/hardwareintegration.pri @@ -1,10 +1,19 @@ +WAYLANDCLIENTSOURCES += \ + $$PWD/../../extensions/server-buffer-extension.xml + SOURCES += \ $$PWD/qwaylandclientbufferintegration.cpp \ $$PWD/qwaylandclientbufferintegrationplugin.cpp \ - $$PWD/qwaylandclientbufferintegrationfactory.cpp + $$PWD/qwaylandclientbufferintegrationfactory.cpp \ + $$PWD/qwaylandserverbufferintegration.cpp \ + $$PWD/qwaylandserverbufferintegrationplugin.cpp \ + $$PWD/qwaylandserverbufferintegrationfactory.cpp HEADERS += \ $$PWD/qwaylandclientbufferintegration.h \ $$PWD/qwaylandclientbufferintegrationplugin.h \ - $$PWD/qwaylandclientbufferintegrationfactory.h + $$PWD/qwaylandclientbufferintegrationfactory.h \ + $$PWD/qwaylandserverbufferintegration.h \ + $$PWD/qwaylandserverbufferintegrationplugin.h \ + $$PWD/qwaylandserverbufferintegrationfactory.h diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegration.cpp b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegration.cpp new file mode 100644 index 00000000000..66fec00ea2b --- /dev/null +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegration.cpp @@ -0,0 +1,9 @@ +#include "qwaylandserverbufferintegration.h" + +QWaylandServerBufferIntegration::QWaylandServerBufferIntegration() +{ +} +QWaylandServerBufferIntegration::~QWaylandServerBufferIntegration() +{ +} + diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegration.h b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegration.h new file mode 100644 index 00000000000..0bb8a6ebcc4 --- /dev/null +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegration.h @@ -0,0 +1,73 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWAYLANDSERVERBUFFERINTEGRATION_H +#define QWAYLANDSERVERBUFFERINTEGRATION_H + +#include + +#include +#include + +QT_BEGIN_NAMESPACE + +class QWaylandDisplay; + +class Q_WAYLAND_CLIENT_EXPORT QWaylandServerBufferIntegration +{ +public: + QWaylandServerBufferIntegration(); + virtual ~QWaylandServerBufferIntegration(); + + virtual void initialize(QWaylandDisplay *display) = 0; + + //creates new texture for buffer + virtual GLuint createTextureFor(struct qt_server_buffer *buffer) = 0; + + //does not clean up textures. Just lets server know that it does + //not intend to use the buffer anymore. Textures should have been + //deleted prior to calling this function + virtual void release(struct qt_server_buffer *buffer) = 0; +}; + +QT_END_NAMESPACE + +#endif diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationfactory.cpp b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationfactory.cpp new file mode 100644 index 00000000000..e36de7e729b --- /dev/null +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationfactory.cpp @@ -0,0 +1,96 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qwaylandserverbufferintegrationfactory.h" +#include "qwaylandserverbufferintegrationplugin.h" + +#include +#include +#include + +QT_BEGIN_NAMESPACE + +#ifndef QT_NO_LIBRARY +Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader, + (QWaylandServerBufferIntegrationFactoryInterface_iid, QLatin1String("/wayland-graphics-integration/client"), Qt::CaseInsensitive)) +Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, directLoader, + (QWaylandServerBufferIntegrationFactoryInterface_iid, QLatin1String(""), Qt::CaseInsensitive)) +#endif + +QStringList QWaylandServerBufferIntegrationFactory::keys(const QString &pluginPath) +{ +#ifndef QT_NO_LIBRARY + QStringList list; + if (!pluginPath.isEmpty()) { + QCoreApplication::addLibraryPath(pluginPath); + list = directLoader()->keyMap().values(); + if (!list.isEmpty()) { + const QString postFix = QStringLiteral(" (from ") + + QDir::toNativeSeparators(pluginPath) + + QLatin1Char(')'); + const QStringList::iterator end = list.end(); + for (QStringList::iterator it = list.begin(); it != end; ++it) + (*it).append(postFix); + } + } + list.append(loader()->keyMap().values()); + return list; +#else + return QStringList(); +#endif +} + +QWaylandServerBufferIntegration *QWaylandServerBufferIntegrationFactory::create(const QString &name, const QStringList &args, const QString &pluginPath) +{ +#ifndef QT_NO_LIBRARY + // Try loading the plugin from platformPluginPath first: + if (!pluginPath.isEmpty()) { + QCoreApplication::addLibraryPath(pluginPath); + if (QWaylandServerBufferIntegration *ret = qLoadPlugin1(directLoader(), name, args)) + return ret; + } + if (QWaylandServerBufferIntegration *ret = qLoadPlugin1(loader(), name, args)) + return ret; +#endif + return 0; +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationfactory.h b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationfactory.h new file mode 100644 index 00000000000..5e48e7b51f5 --- /dev/null +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationfactory.h @@ -0,0 +1,61 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWAYLANDSERVERBUFFERINTEGRATIONFACTORY_H +#define QWAYLANDSERVERBUFFERINTEGRATIONFACTORY_H + +#include +#include + +QT_BEGIN_NAMESPACE + +class QWaylandServerBufferIntegration; + +class Q_WAYLAND_CLIENT_EXPORT QWaylandServerBufferIntegrationFactory +{ +public: + static QStringList keys(const QString &pluginPath = QString()); + static QWaylandServerBufferIntegration *create(const QString &name, const QStringList &args, const QString &pluginPath = QString()); +}; + +QT_END_NAMESPACE + +#endif // QWAYLANDSERVERBUFFERINTEGRATIONFACTORY_H diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationplugin.cpp b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationplugin.cpp new file mode 100644 index 00000000000..2bb3eb2164f --- /dev/null +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationplugin.cpp @@ -0,0 +1,54 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qwaylandserverbufferintegrationplugin.h" + +QT_BEGIN_NAMESPACE + +QWaylandServerBufferIntegrationPlugin::QWaylandServerBufferIntegrationPlugin(QObject *parent) + : QObject(parent) +{ +} +QWaylandServerBufferIntegrationPlugin::~QWaylandServerBufferIntegrationPlugin() +{ +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationplugin.h b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationplugin.h new file mode 100644 index 00000000000..c3605dc7022 --- /dev/null +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationplugin.h @@ -0,0 +1,69 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWAYLANDSERVERBUFFERINTEGRATIONPLUGIN_H +#define QWAYLANDSERVERBUFFERINTEGRATIONPLUGIN_H + +#include + +#include +#include +#include + +QT_BEGIN_NAMESPACE + +class QWaylandServerBufferIntegration; + +#define QWaylandServerBufferIntegrationFactoryInterface_iid "org.qt-project.Qt.WaylandClient.QWaylandServerBufferIntegrationFactoryInterface.5.1" + +class Q_WAYLAND_CLIENT_EXPORT QWaylandServerBufferIntegrationPlugin : public QObject +{ + Q_OBJECT +public: + explicit QWaylandServerBufferIntegrationPlugin(QObject *parent = 0); + ~QWaylandServerBufferIntegrationPlugin(); + + virtual QWaylandServerBufferIntegration *create(const QString &key, const QStringList ¶mList) = 0; +}; + +QT_END_NAMESPACE + +#endif // QWAYLANDSERVERBUFFERINTEGRATIONPLUGIN_H diff --git a/src/plugins/platforms/wayland/qwaylandintegration.cpp b/src/plugins/platforms/wayland/qwaylandintegration.cpp index 32045bc86b6..70a09b2ed60 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandintegration.cpp @@ -68,6 +68,8 @@ #include "qwaylandclientbufferintegration.h" #include "qwaylandclientbufferintegrationfactory.h" +#include "qwaylandserverbufferintegration.h" +#include "qwaylandserverbufferintegrationfactory.h" QT_BEGIN_NAMESPACE @@ -110,6 +112,7 @@ QWaylandIntegration::QWaylandIntegration() , mAccessibility(0) #endif , mClientBufferIntegrationInitialized(false) + , mServerBufferIntegrationInitialized(false) { mDisplay = new QWaylandDisplay(this); mClipboard = new QWaylandClipboard(mDisplay); @@ -240,12 +243,20 @@ QPlatformTheme *QWaylandIntegration::createPlatformTheme(const QString &name) co QWaylandClientBufferIntegration *QWaylandIntegration::clientBufferIntegration() const { if (!mClientBufferIntegrationInitialized) - const_cast(this)->initializeBufferIntegration(); + const_cast(this)->initializeClientBufferIntegration(); return mClientBufferIntegration; } -void QWaylandIntegration::initializeBufferIntegration() +QWaylandServerBufferIntegration *QWaylandIntegration::serverBufferIntegration() const +{ + if (!mServerBufferIntegrationInitialized) + const_cast(this)->initializeServerBufferIntegration(); + + return mServerBufferIntegration; +} + +void QWaylandIntegration::initializeClientBufferIntegration() { mClientBufferIntegrationInitialized = true; @@ -262,4 +273,21 @@ void QWaylandIntegration::initializeBufferIntegration() mClientBufferIntegration->initialize(mDisplay); } +void QWaylandIntegration::initializeServerBufferIntegration() +{ + mServerBufferIntegrationInitialized = true; + + QByteArray serverBufferIntegrationName = qgetenv("QT_WAYLAND_SERVER_BUFFER_INTEGRATION"); + if (serverBufferIntegrationName.isEmpty()) + serverBufferIntegrationName = QByteArrayLiteral("wayland-egl"); + + QStringList keys = QWaylandServerBufferIntegrationFactory::keys(); + QString targetKey = QString::fromLocal8Bit(serverBufferIntegrationName); + if (keys.contains(targetKey)) { + mServerBufferIntegration = QWaylandServerBufferIntegrationFactory::create(targetKey, QStringList()); + } + if (mServerBufferIntegration) + mServerBufferIntegration->initialize(mDisplay); +} + QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandintegration.h b/src/plugins/platforms/wayland/qwaylandintegration.h index bbc3c928a1c..bc51c23bb50 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.h +++ b/src/plugins/platforms/wayland/qwaylandintegration.h @@ -50,6 +50,7 @@ QT_BEGIN_NAMESPACE class QWaylandBuffer; class QWaylandDisplay; class QWaylandClientBufferIntegration; +class QWaylandServerBufferIntegration; class Q_WAYLAND_CLIENT_EXPORT QWaylandIntegration : public QPlatformIntegration { @@ -88,10 +89,13 @@ public: QPlatformTheme *createPlatformTheme(const QString &name) const; virtual QWaylandClientBufferIntegration *clientBufferIntegration() const; + virtual QWaylandServerBufferIntegration *serverBufferIntegration() const; protected: QWaylandClientBufferIntegration *mClientBufferIntegration; + QWaylandServerBufferIntegration *mServerBufferIntegration; private: - void initializeBufferIntegration(); + void initializeClientBufferIntegration(); + void initializeServerBufferIntegration(); QPlatformFontDatabase *mFontDb; QPlatformClipboard *mClipboard; QPlatformDrag *mDrag; @@ -100,6 +104,7 @@ private: QScopedPointer mInputContext; QPlatformAccessibility *mAccessibility; bool mClientBufferIntegrationInitialized; + bool mServerBufferIntegrationInitialized; }; QT_END_NAMESPACE From 61b25e0055449e6b113aa89403b4957a66bd6468 Mon Sep 17 00:00:00 2001 From: Jorgen Lind Date: Fri, 22 Nov 2013 14:30:50 +0100 Subject: [PATCH 0072/1507] Remove stale createGLIntegration functions They are not used anymore since QtWaylandClient supports subclassing QWaylandIntegration Change-Id: I847a412725c4ce06377886b44236f9793b609399 Reviewed-by: Andy Nichols --- .../hardwareintegration/qwaylandclientbufferintegration.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegration.h b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegration.h index 7f4fde9b3b6..608a8cb226c 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegration.h +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegration.h @@ -67,8 +67,6 @@ public: virtual QWaylandWindow *createEglWindow(QWindow *window) = 0; virtual QPlatformOpenGLContext *createPlatformOpenGLContext(const QSurfaceFormat &glFormat, QPlatformOpenGLContext *share) const = 0; - - static QWaylandClientBufferIntegration *createGLIntegration(QWaylandDisplay *waylandDisplay); }; QT_END_NAMESPACE From e6f5c22e4e13b4e07c83fd12c9c75274e462a50f Mon Sep 17 00:00:00 2001 From: Jorgen Lind Date: Fri, 22 Nov 2013 16:39:19 +0100 Subject: [PATCH 0073/1507] Remove compiler warning qtwaylandscanner We don't need the interface name anymore Change-Id: I8b1d334a549adb388da083dd8f4261755a54ff20 Reviewed-by: Andy Nichols --- .../qtwaylandscanner/qtwaylandscanner.cpp | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp index be4e6515033..85cca90b955 100644 --- a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp +++ b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp @@ -226,7 +226,7 @@ const WaylandArgument *newIdArgument(const QList &arguments) return 0; } -void printEvent(const WaylandEvent &e, const char *interfaceName, bool omitNames = false, bool withResource = false) +void printEvent(const WaylandEvent &e, bool omitNames = false, bool withResource = false) { printf("%s(", e.name.constData()); bool needsComma = false; @@ -453,10 +453,10 @@ void process(QXmlStreamReader &xml, const QByteArray &headerPath) printf("\n"); foreach (const WaylandEvent &e, interface.events) { printf(" void send_"); - printEvent(e, interfaceName); + printEvent(e); printf(";\n"); printf(" void send_"); - printEvent(e, interfaceName, false, true); + printEvent(e, false, true); printf(";\n"); } } @@ -474,7 +474,7 @@ void process(QXmlStreamReader &xml, const QByteArray &headerPath) printf("\n"); foreach (const WaylandEvent &e, interface.requests) { printf(" virtual void %s_", interfaceNameStripped); - printEvent(e, interfaceName); + printEvent(e); printf(";\n"); } } @@ -664,7 +664,7 @@ void process(QXmlStreamReader &xml, const QByteArray &headerPath) foreach (const WaylandEvent &e, interface.requests) { printf("\n"); printf(" void %s::%s_", interfaceName, interfaceNameStripped); - printEvent(e, interfaceName, true); + printEvent(e, true); printf("\n"); printf(" {\n"); printf(" }\n"); @@ -704,7 +704,7 @@ void process(QXmlStreamReader &xml, const QByteArray &headerPath) printf("\n"); const WaylandEvent &e = interface.events.at(i); printf(" void %s::send_", interfaceName); - printEvent(e, interfaceName); + printEvent(e); printf("\n"); printf(" {\n"); printf(" send_%s(\n", e.name.constData()); @@ -719,7 +719,7 @@ void process(QXmlStreamReader &xml, const QByteArray &headerPath) printf("\n"); printf(" void %s::send_", interfaceName); - printEvent(e, interfaceName, false, true); + printEvent(e, false, true); printf("\n"); printf(" {\n"); @@ -826,7 +826,7 @@ void process(QXmlStreamReader &xml, const QByteArray &headerPath) foreach (const WaylandEvent &e, interface.requests) { const WaylandArgument *new_id = newIdArgument(e.arguments); printf(" %s", new_id ? (new_id->interface.isEmpty() ? "void *" : "struct ::" + new_id->interface + " *").constData() : "void "); - printEvent(e, interfaceName); + printEvent(e); printf(";\n"); } } @@ -838,7 +838,7 @@ void process(QXmlStreamReader &xml, const QByteArray &headerPath) printf(" protected:\n"); foreach (const WaylandEvent &e, interface.events) { printf(" virtual void %s_", interfaceNameStripped); - printEvent(e, interfaceName); + printEvent(e); printf(";\n"); } } @@ -942,7 +942,7 @@ void process(QXmlStreamReader &xml, const QByteArray &headerPath) const WaylandEvent &e = interface.requests.at(i); const WaylandArgument *new_id = newIdArgument(e.arguments); printf(" %s%s::", new_id ? (new_id->interface.isEmpty() ? "void *" : "struct ::" + new_id->interface + " *").constData() : "void ", interfaceName); - printEvent(e, interfaceName); + printEvent(e); printf("\n"); printf(" {\n"); for (int i = 0; i < e.arguments.size(); ++i) { @@ -994,7 +994,7 @@ void process(QXmlStreamReader &xml, const QByteArray &headerPath) for (int i = 0; i < interface.events.size(); ++i) { const WaylandEvent &e = interface.events.at(i); printf(" void %s::%s_", interfaceName, interfaceNameStripped); - printEvent(e, interfaceName, true); + printEvent(e, true); printf("\n"); printf(" {\n"); printf(" }\n"); From e36edb655f8585ccc6f2c7603ebb8714150dd3fe Mon Sep 17 00:00:00 2001 From: Jorgen Lind Date: Fri, 22 Nov 2013 16:54:54 +0100 Subject: [PATCH 0074/1507] Fix compiler warnings Change-Id: I499c50c901bff1c496b05b628f8155376b5af267 Reviewed-by: Andy Nichols --- src/plugins/platforms/wayland/qwaylanddatadevice.cpp | 2 +- src/plugins/platforms/wayland/qwaylanddisplay.cpp | 2 +- src/plugins/platforms/wayland/qwaylandinputcontext.cpp | 5 +++++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylanddatadevice.cpp b/src/plugins/platforms/wayland/qwaylanddatadevice.cpp index 2a70a338c81..faa04c3db7a 100644 --- a/src/plugins/platforms/wayland/qwaylanddatadevice.cpp +++ b/src/plugins/platforms/wayland/qwaylanddatadevice.cpp @@ -108,7 +108,7 @@ void QWaylandDataDevice::cancelDrag() void QWaylandDataDevice::data_device_data_offer(struct ::wl_data_offer *id) { - QWaylandDataOffer *offer = new QWaylandDataOffer(m_display, id); + new QWaylandDataOffer(m_display, id); } void QWaylandDataDevice::data_device_drop() diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index 436f58bb9cb..e6981ed5222 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -230,7 +230,7 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin mTouchExtension = new QWaylandTouchExtension(this, id); } else if (interface == QStringLiteral("qt_key_extension")) { mQtKeyExtension = new QWaylandQtKeyExtension(this, id); - } else if (interface == "wl_text_input_manager") { + } else if (interface == QStringLiteral("wl_text_input_manager")) { mTextInputManager = new QtWayland::wl_text_input_manager(registry, id); } diff --git a/src/plugins/platforms/wayland/qwaylandinputcontext.cpp b/src/plugins/platforms/wayland/qwaylandinputcontext.cpp index f50581b3ad6..e9fb87179cd 100644 --- a/src/plugins/platforms/wayland/qwaylandinputcontext.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputcontext.cpp @@ -126,6 +126,7 @@ void QWaylandTextInput::updateState() void QWaylandTextInput::text_input_commit_string(uint32_t serial, const QString &text) { + Q_UNUSED(serial); if (!QGuiApplication::focusObject()) return; @@ -146,6 +147,9 @@ void QWaylandTextInput::text_input_leave() void QWaylandTextInput::text_input_keysym(uint32_t serial, uint32_t time, uint32_t sym, uint32_t state, uint32_t modifiers) { + Q_UNUSED(serial); + Q_UNUSED(time); + Q_UNUSED(modifiers); if (!QGuiApplication::focusObject()) return; @@ -191,6 +195,7 @@ void QWaylandInputContext::commit() void QWaylandInputContext::update(Qt::InputMethodQueries queries) { + Q_UNUSED(queries); if (!ensureTextInput()) return; From 34720a996f0462090b2f6b618586d74554675c0b Mon Sep 17 00:00:00 2001 From: Jorgen Lind Date: Mon, 25 Nov 2013 10:44:29 +0100 Subject: [PATCH 0075/1507] Add a preprocessor protocol name variable We should convert - to _ in the preprocessor protocol name since - will lead to a new token, but we don't since it is better to fail early here and the official wayland-scanner doesn't do this either. The generated c++ header will give a compiler error when being used which gives the user a chance to change the protocol name. Change-Id: I049bdecacc8ed9a70c0879494d4d358ce53f3320 Reviewed-by: Andy Nichols --- .../qtwaylandscanner/qtwaylandscanner.cpp | 36 ++++++++++--------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp index 85cca90b955..bd8471e0a34 100644 --- a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp +++ b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp @@ -344,6 +344,11 @@ void process(QXmlStreamReader &xml, const QByteArray &headerPath) return; } + //We should convert - to _ so that the preprocessor wont generate code which will lead to unexpected behavior + //However, the wayland-scanner doesn't do so we will do the same for now + //QByteArray preProcessorProtocolName = QByteArray(protocolName).replace('-', '_').toUpper(); + QByteArray preProcessorProtocolName = QByteArray(protocolName).toUpper(); + QList interfaces; while (xml.readNextStartElement()) { @@ -357,7 +362,7 @@ void process(QXmlStreamReader &xml, const QByteArray &headerPath) return; if (option == ServerHeader) { - QByteArray inclusionGuard = "QT_WAYLAND_SERVER_" + protocolName.toUpper(); + QByteArray inclusionGuard = QByteArray("QT_WAYLAND_SERVER_") + preProcessorProtocolName.constData(); printf("#ifndef %s\n", inclusionGuard.constData()); printf("#define %s\n", inclusionGuard.constData()); printf("\n"); @@ -381,13 +386,15 @@ void process(QXmlStreamReader &xml, const QByteArray &headerPath) printf("\n"); printf("QT_BEGIN_NAMESPACE\n"); + QByteArray serverExport; if (headerPath.size()) { + serverExport = QByteArray("Q_WAYLAND_SERVER_") + preProcessorProtocolName + "_EXPORT"; printf("\n"); - printf("#if !defined(Q_WAYLAND_SERVER_%s_EXPORT)\n", protocolName.toUpper().constData()); + printf("#if !defined(%s)\n", serverExport.constData()); printf("# if defined(QT_SHARED)\n"); - printf("# define Q_WAYLAND_SERVER_%s_EXPORT Q_DECL_EXPORT\n", protocolName.toUpper().constData()); + printf("# define %s Q_DECL_EXPORT\n", serverExport.constData()); printf("# else\n"); - printf("# define Q_WAYLAND_SERVER_%s_EXPORT\n", protocolName.toUpper().constData()); + printf("# define %s\n", serverExport.constData()); printf("# endif\n"); printf("#endif\n"); } @@ -405,10 +412,7 @@ void process(QXmlStreamReader &xml, const QByteArray &headerPath) QByteArray stripped = stripInterfaceName(interface.name); const char *interfaceNameStripped = stripped.constData(); - if (headerPath.isEmpty()) - printf(" class %s\n {\n", interfaceName); - else - printf(" class Q_WAYLAND_SERVER_%s_EXPORT %s\n {\n",protocolName.toUpper().constData(), interfaceName); + printf(" class %s %s\n {\n", serverExport.constData(), interfaceName); printf(" public:\n"); printf(" %s(struct ::wl_client *client, int id);\n", interfaceName); printf(" %s(struct ::wl_display *display);\n", interfaceName); @@ -764,7 +768,7 @@ void process(QXmlStreamReader &xml, const QByteArray &headerPath) } if (option == ClientHeader) { - QByteArray inclusionGuard = "QT_WAYLAND_" + protocolName.toUpper(); + QByteArray inclusionGuard = QByteArray("QT_WAYLAND_") + preProcessorProtocolName.constData(); printf("#ifndef %s\n", inclusionGuard.constData()); printf("#define %s\n", inclusionGuard.constData()); printf("\n"); @@ -777,13 +781,16 @@ void process(QXmlStreamReader &xml, const QByteArray &headerPath) printf("\n"); printf("QT_BEGIN_NAMESPACE\n"); + QByteArray clientExport; + if (headerPath.size()) { + clientExport = QByteArray("Q_WAYLAND_CLIENT_") + preProcessorProtocolName + "_EXPORT"; printf("\n"); - printf("#if !defined(Q_WAYLAND_CLIENT_%s_EXPORT)\n", protocolName.toUpper().constData()); + printf("#if !defined(%s)\n", clientExport.constData()); printf("# if defined(QT_SHARED)\n"); - printf("# define Q_WAYLAND_CLIENT_%s_EXPORT Q_DECL_EXPORT\n", protocolName.toUpper().constData()); + printf("# define %s Q_DECL_EXPORT\n", clientExport.constData()); printf("# else\n"); - printf("# define Q_WAYLAND_CLIENT_%s_EXPORT\n", protocolName.toUpper().constData()); + printf("# define %s\n", clientExport.constData()); printf("# endif\n"); printf("#endif\n"); } @@ -800,10 +807,7 @@ void process(QXmlStreamReader &xml, const QByteArray &headerPath) QByteArray stripped = stripInterfaceName(interface.name); const char *interfaceNameStripped = stripped.constData(); - if (headerPath.isEmpty()) - printf(" class %s\n {\n", interfaceName); - else - printf(" class Q_WAYLAND_CLIENT_%s_EXPORT %s\n {\n",protocolName.toUpper().constData(), interfaceName); + printf(" class %s %s\n {\n", clientExport.constData(), interfaceName); printf(" public:\n"); printf(" %s(struct ::wl_registry *registry, int id);\n", interfaceName); printf(" %s(struct ::%s *object);\n", interfaceName, interfaceName); From d44fe6a530b9c4605d9604b2df92227818a3e91b Mon Sep 17 00:00:00 2001 From: Jorgen Lind Date: Mon, 25 Nov 2013 10:49:02 +0100 Subject: [PATCH 0076/1507] Add hardware integration protocol This sends to clients what HW integration is being used in the compositor. This is useful when the wayland clients are loading their buffer integrations with plugins since they then can pick the correct plugin automatically. Change-Id: Ib4eac3b855c6772ac1581b7f06aa929aeb1a1db0 Reviewed-by: Andy Nichols --- .../extensions/hardware-integration.xml | 54 ++++++++++++++ .../hardwareintegration.pri | 9 ++- .../qwaylandhardwareintegration.cpp | 72 +++++++++++++++++++ .../qwaylandhardwareintegration.h | 71 ++++++++++++++++++ .../platforms/wayland/qwaylanddisplay.cpp | 5 +- .../platforms/wayland/qwaylanddisplay.h | 3 + .../platforms/wayland/qwaylandintegration.cpp | 44 +++++++++--- 7 files changed, 246 insertions(+), 12 deletions(-) create mode 100644 src/3rdparty/wayland/extensions/hardware-integration.xml create mode 100644 src/plugins/platforms/wayland/hardwareintegration/qwaylandhardwareintegration.cpp create mode 100644 src/plugins/platforms/wayland/hardwareintegration/qwaylandhardwareintegration.h diff --git a/src/3rdparty/wayland/extensions/hardware-integration.xml b/src/3rdparty/wayland/extensions/hardware-integration.xml new file mode 100644 index 00000000000..ad505c9d789 --- /dev/null +++ b/src/3rdparty/wayland/extensions/hardware-integration.xml @@ -0,0 +1,54 @@ + + + + Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). + Contact: http://www.qt-project.org/legal + + This file is part of the plugins of the Qt Toolkit. + + $QT_BEGIN_LICENSE:BSD$ + You may use this file under the terms of the BSD license as follows: + + "Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names + of its contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." + + $QT_END_LICENSE$ + + + + + Using this protocol the compositor can signal to clients which buffer sharing extensions + the client should use + + + + + + + + + + diff --git a/src/plugins/platforms/wayland/hardwareintegration/hardwareintegration.pri b/src/plugins/platforms/wayland/hardwareintegration/hardwareintegration.pri index 0ace4777e6a..1588ca9775b 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/hardwareintegration.pri +++ b/src/plugins/platforms/wayland/hardwareintegration/hardwareintegration.pri @@ -1,5 +1,6 @@ WAYLANDCLIENTSOURCES += \ - $$PWD/../../extensions/server-buffer-extension.xml + $$PWD/../../extensions/server-buffer-extension.xml \ + $$PWD/../../extensions/hardware-integration.xml SOURCES += \ $$PWD/qwaylandclientbufferintegration.cpp \ @@ -7,7 +8,8 @@ SOURCES += \ $$PWD/qwaylandclientbufferintegrationfactory.cpp \ $$PWD/qwaylandserverbufferintegration.cpp \ $$PWD/qwaylandserverbufferintegrationplugin.cpp \ - $$PWD/qwaylandserverbufferintegrationfactory.cpp + $$PWD/qwaylandserverbufferintegrationfactory.cpp \ + $$PWD/qwaylandhardwareintegration.cpp HEADERS += \ $$PWD/qwaylandclientbufferintegration.h \ @@ -15,5 +17,6 @@ HEADERS += \ $$PWD/qwaylandclientbufferintegrationfactory.h \ $$PWD/qwaylandserverbufferintegration.h \ $$PWD/qwaylandserverbufferintegrationplugin.h \ - $$PWD/qwaylandserverbufferintegrationfactory.h + $$PWD/qwaylandserverbufferintegrationfactory.h \ + $$PWD/qwaylandhardwareintegration.h diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandhardwareintegration.cpp b/src/plugins/platforms/wayland/hardwareintegration/qwaylandhardwareintegration.cpp new file mode 100644 index 00000000000..67c951eac62 --- /dev/null +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandhardwareintegration.cpp @@ -0,0 +1,72 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qwaylandhardwareintegration.h" + +#include "qwaylanddisplay.h" +QT_BEGIN_NAMESPACE + +QWaylandHardwareIntegration::QWaylandHardwareIntegration(struct ::wl_registry *registry, int id) + : qt_hardware_integration(registry, id) +{ +} + +QString QWaylandHardwareIntegration::clientBufferIntegration() +{ + return m_client_buffer; +} + +QString QWaylandHardwareIntegration::serverBufferIntegration() +{ + return m_server_buffer; +} + +void QWaylandHardwareIntegration::hardware_integration_client_backend(const QString &name) +{ + m_client_buffer = name; +} + +void QWaylandHardwareIntegration::hardware_integration_server_backend(const QString &name) +{ + m_server_buffer = name; +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandhardwareintegration.h b/src/plugins/platforms/wayland/hardwareintegration/qwaylandhardwareintegration.h new file mode 100644 index 00000000000..faa57856724 --- /dev/null +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandhardwareintegration.h @@ -0,0 +1,71 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWAYLANDHARDWAREINTEGRATION_H +#define QWAYLANDHARDWAREINTEGRATION_H + +#include +#include + +QT_BEGIN_NAMESPACE + +class QWaylandDisplay; + +class Q_WAYLAND_CLIENT_EXPORT QWaylandHardwareIntegration : public QtWayland::qt_hardware_integration +{ +public: + QWaylandHardwareIntegration(struct ::wl_registry *registry, int id); + + QString clientBufferIntegration(); + QString serverBufferIntegration(); + +protected: + void hardware_integration_client_backend(const QString &name); + void hardware_integration_server_backend(const QString &name); + +private: + QString m_client_buffer; + QString m_server_buffer; +}; + +QT_END_NAMESPACE + +#endif diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index e6981ed5222..3f771f1df21 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -49,8 +49,8 @@ #include "qwaylandinputdevice.h" #include "qwaylandclipboard.h" #include "qwaylanddatadevicemanager.h" +#include "qwaylandhardwareintegration.h" -#include "qwaylandclientbufferintegration.h" #include "qwaylandwindowmanagerintegration.h" @@ -110,6 +110,7 @@ QWaylandDisplay::QWaylandDisplay(QWaylandIntegration *waylandIntegration) , mTouchExtension(0) , mQtKeyExtension(0) , mTextInputManager(0) + , mHardwareIntegration(0) { display = this; qRegisterMetaType("uint32_t"); @@ -232,6 +233,8 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin mQtKeyExtension = new QWaylandQtKeyExtension(this, id); } else if (interface == QStringLiteral("wl_text_input_manager")) { mTextInputManager = new QtWayland::wl_text_input_manager(registry, id); + } else if (interface == QStringLiteral("qt_hardware_integration")) { + mHardwareIntegration = new QWaylandHardwareIntegration(registry, id); } foreach (Listener l, mRegistryListeners) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.h b/src/plugins/platforms/wayland/qwaylanddisplay.h index 4e76de256cb..dd62aa16bee 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay.h @@ -70,6 +70,7 @@ class QWaylandQtKeyExtension; class QWaylandWindow; class QWaylandEventThread; class QWaylandIntegration; +class QWaylandHardwareIntegration; namespace QtWayland { class qt_output_extension; @@ -127,6 +128,7 @@ public: QtWayland::qt_output_extension *outputExtension() const { return mOutputExtension; } QWaylandTouchExtension *touchExtension() const { return mTouchExtension; } QtWayland::wl_text_input_manager *textInputManager() const { return mTextInputManager; } + QWaylandHardwareIntegration *hardwareIntegration() const { return mHardwareIntegration; } /* wl_registry_add_listener does not add but rather sets a listener, so this function is used * to enable many listeners at once. */ @@ -170,6 +172,7 @@ private: QWaylandQtKeyExtension *mQtKeyExtension; QWaylandWindowManagerIntegration *mWindowManagerIntegration; QtWayland::wl_text_input_manager *mTextInputManager; + QWaylandHardwareIntegration *mHardwareIntegration; QSocketNotifier *mReadNotifier; int mFd; diff --git a/src/plugins/platforms/wayland/qwaylandintegration.cpp b/src/plugins/platforms/wayland/qwaylandintegration.cpp index 70a09b2ed60..9acda2107f1 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandintegration.cpp @@ -65,6 +65,7 @@ #include #include +#include "qwaylandhardwareintegration.h" #include "qwaylandclientbufferintegration.h" #include "qwaylandclientbufferintegrationfactory.h" @@ -260,34 +261,61 @@ void QWaylandIntegration::initializeClientBufferIntegration() { mClientBufferIntegrationInitialized = true; - QByteArray clientBufferIntegrationName = qgetenv("QT_WAYLAND_CLIENT_BUFFER_INTEGRATION"); - if (clientBufferIntegrationName.isEmpty()) - clientBufferIntegrationName = QByteArrayLiteral("wayland-egl"); + QString targetKey; + bool disableHardwareIntegration = qEnvironmentVariableIsSet("QT_WAYLAND_DISABLE_HW_INTEGRATION"); + disableHardwareIntegration = disableHardwareIntegration || !mDisplay->hardwareIntegration(); + if (disableHardwareIntegration) { + QByteArray clientBufferIntegrationName = qgetenv("QT_WAYLAND_CLIENT_BUFFER_INTEGRATION"); + if (clientBufferIntegrationName.isEmpty()) + clientBufferIntegrationName = QByteArrayLiteral("wayland-egl"); + targetKey = QString::fromLocal8Bit(clientBufferIntegrationName); + } else { + targetKey = mDisplay->hardwareIntegration()->clientBufferIntegration(); + } + + if (targetKey.isEmpty()) { + qWarning("Failed to determin what client buffer integration to use"); + return; + } QStringList keys = QWaylandClientBufferIntegrationFactory::keys(); - QString targetKey = QString::fromLocal8Bit(clientBufferIntegrationName); if (keys.contains(targetKey)) { mClientBufferIntegration = QWaylandClientBufferIntegrationFactory::create(targetKey, QStringList()); } if (mClientBufferIntegration) mClientBufferIntegration->initialize(mDisplay); + else + qWarning("Failed to load client buffer intgration: %s\n", qPrintable(targetKey)); } void QWaylandIntegration::initializeServerBufferIntegration() { mServerBufferIntegrationInitialized = true; - QByteArray serverBufferIntegrationName = qgetenv("QT_WAYLAND_SERVER_BUFFER_INTEGRATION"); - if (serverBufferIntegrationName.isEmpty()) - serverBufferIntegrationName = QByteArrayLiteral("wayland-egl"); + QString targetKey; + + bool disableHardwareIntegration = qEnvironmentVariableIsSet("QT_WAYLAND_DISABLE_HW_INTEGRATION"); + disableHardwareIntegration = disableHardwareIntegration || !mDisplay->hardwareIntegration(); + if (disableHardwareIntegration) { + QByteArray serverBufferIntegrationName = qgetenv("QT_WAYLAND_SERVER_BUFFER_INTEGRATION"); + QString targetKey = QString::fromLocal8Bit(serverBufferIntegrationName); + } else { + targetKey = mDisplay->hardwareIntegration()->serverBufferIntegration(); + } + + if (targetKey.isEmpty()) { + qWarning("Failed to determin what server buffer integration to use"); + return; + } QStringList keys = QWaylandServerBufferIntegrationFactory::keys(); - QString targetKey = QString::fromLocal8Bit(serverBufferIntegrationName); if (keys.contains(targetKey)) { mServerBufferIntegration = QWaylandServerBufferIntegrationFactory::create(targetKey, QStringList()); } if (mServerBufferIntegration) mServerBufferIntegration->initialize(mDisplay); + else + qWarning("Failed to load server buffer integration %s\n", qPrintable(targetKey)); } QT_END_NAMESPACE From a719dbfe80a3fdbf4d5bebfd2637bd375b633fa1 Mon Sep 17 00:00:00 2001 From: Jorgen Lind Date: Tue, 26 Nov 2013 09:29:21 +0100 Subject: [PATCH 0077/1507] Use QScopedPointer in QWaylandDisplay for extensions Change-Id: I783639fcefd36967f42f18417b0e07ec34b49dbb Reviewed-by: Andy Nichols --- .../platforms/wayland/qwaylanddisplay.cpp | 22 ++++++------ .../platforms/wayland/qwaylanddisplay.h | 36 +++++++++---------- 2 files changed, 29 insertions(+), 29 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index 3f771f1df21..922c4bcb809 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -85,7 +85,7 @@ QWaylandClientBufferIntegration * QWaylandDisplay::clientBufferIntegration() con QWaylandWindowManagerIntegration *QWaylandDisplay::windowManagerIntegration() const { - return mWindowManagerIntegration; + return mWindowManagerIntegration.data(); } QWaylandInputDevice *QWaylandDisplay::lastKeyboardFocusInputDevice() const @@ -133,7 +133,7 @@ QWaylandDisplay::QWaylandDisplay(QWaylandIntegration *waylandIntegration) connect(mEventThreadObject, SIGNAL(newEventsRead()), this, SLOT(flushRequests())); - mWindowManagerIntegration = new QWaylandWindowManagerIntegration(this); + mWindowManagerIntegration.reset(new QWaylandWindowManagerIntegration(this)); blockingReadEvents(); @@ -213,28 +213,28 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin } else if (interface == QStringLiteral("wl_shm")) { mShm = static_cast(wl_registry_bind(registry, id, &wl_shm_interface,1)); } else if (interface == QStringLiteral("wl_shell")){ - mShell = new QtWayland::wl_shell(registry, id); + mShell.reset(new QtWayland::wl_shell(registry, id)); } else if (interface == QStringLiteral("wl_seat")) { QWaylandInputDevice *inputDevice = new QWaylandInputDevice(this, id); mInputDevices.append(inputDevice); } else if (interface == QStringLiteral("wl_data_device_manager")) { - mDndSelectionHandler = new QWaylandDataDeviceManager(this, id); + mDndSelectionHandler.reset(new QWaylandDataDeviceManager(this, id)); } else if (interface == QStringLiteral("qt_output_extension")) { - mOutputExtension = new QtWayland::qt_output_extension(registry, id); + mOutputExtension.reset(new QtWayland::qt_output_extension(registry, id)); foreach (QPlatformScreen *screen, screens()) static_cast(screen)->createExtendedOutput(); } else if (interface == QStringLiteral("qt_surface_extension")) { - mWindowExtension = new QtWayland::qt_surface_extension(registry, id); + mWindowExtension.reset(new QtWayland::qt_surface_extension(registry, id)); } else if (interface == QStringLiteral("qt_sub_surface_extension")) { - mSubSurfaceExtension = new QtWayland::qt_sub_surface_extension(registry, id); + mSubSurfaceExtension.reset(new QtWayland::qt_sub_surface_extension(registry, id)); } else if (interface == QStringLiteral("qt_touch_extension")) { - mTouchExtension = new QWaylandTouchExtension(this, id); + mTouchExtension.reset(new QWaylandTouchExtension(this, id)); } else if (interface == QStringLiteral("qt_key_extension")) { - mQtKeyExtension = new QWaylandQtKeyExtension(this, id); + mQtKeyExtension.reset(new QWaylandQtKeyExtension(this, id)); } else if (interface == QStringLiteral("wl_text_input_manager")) { - mTextInputManager = new QtWayland::wl_text_input_manager(registry, id); + mTextInputManager.reset(new QtWayland::wl_text_input_manager(registry, id)); } else if (interface == QStringLiteral("qt_hardware_integration")) { - mHardwareIntegration = new QWaylandHardwareIntegration(registry, id); + mHardwareIntegration.reset(new QWaylandHardwareIntegration(registry, id)); } foreach (Listener l, mRegistryListeners) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.h b/src/plugins/platforms/wayland/qwaylanddisplay.h index dd62aa16bee..4f9dacf42ba 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay.h @@ -112,7 +112,7 @@ public: const struct wl_compositor *wl_compositor() const { return mCompositor.object(); } QtWayland::wl_compositor *compositor() { return &mCompositor; } - QtWayland::wl_shell *shell() { return mShell; } + QtWayland::wl_shell *shell() { return mShell.data(); } QList inputDevices() const { return mInputDevices; } QWaylandInputDevice *defaultInputDevice() const; @@ -121,14 +121,14 @@ public: QWaylandInputDevice *lastKeyboardFocusInputDevice() const; void setLastKeyboardFocusInputDevice(QWaylandInputDevice *device); - QWaylandDataDeviceManager *dndSelectionHandler() const { return mDndSelectionHandler; } + QWaylandDataDeviceManager *dndSelectionHandler() const { return mDndSelectionHandler.data(); } - QtWayland::qt_surface_extension *windowExtension() const { return mWindowExtension; } - QtWayland::qt_sub_surface_extension *subSurfaceExtension() const { return mSubSurfaceExtension; } - QtWayland::qt_output_extension *outputExtension() const { return mOutputExtension; } - QWaylandTouchExtension *touchExtension() const { return mTouchExtension; } - QtWayland::wl_text_input_manager *textInputManager() const { return mTextInputManager; } - QWaylandHardwareIntegration *hardwareIntegration() const { return mHardwareIntegration; } + QtWayland::qt_surface_extension *windowExtension() const { return mWindowExtension.data(); } + QtWayland::qt_sub_surface_extension *subSurfaceExtension() const { return mSubSurfaceExtension.data(); } + QtWayland::qt_output_extension *outputExtension() const { return mOutputExtension.data(); } + QWaylandTouchExtension *touchExtension() const { return mTouchExtension.data(); } + QtWayland::wl_text_input_manager *textInputManager() const { return mTextInputManager.data(); } + QWaylandHardwareIntegration *hardwareIntegration() const { return mHardwareIntegration.data(); } /* wl_registry_add_listener does not add but rather sets a listener, so this function is used * to enable many listeners at once. */ @@ -158,21 +158,21 @@ private: struct wl_shm *mShm; QThread *mEventThread; QWaylandEventThread *mEventThreadObject; - QtWayland::wl_shell *mShell; + QScopedPointer mShell; QList mScreens; QList mInputDevices; QList mRegistryListeners; QWaylandIntegration *mWaylandIntegration; QWaylandInputDevice *mLastKeyboardFocusInputDevice; - QWaylandDataDeviceManager *mDndSelectionHandler; - QtWayland::qt_surface_extension *mWindowExtension; - QtWayland::qt_sub_surface_extension *mSubSurfaceExtension; - QtWayland::qt_output_extension *mOutputExtension; - QWaylandTouchExtension *mTouchExtension; - QWaylandQtKeyExtension *mQtKeyExtension; - QWaylandWindowManagerIntegration *mWindowManagerIntegration; - QtWayland::wl_text_input_manager *mTextInputManager; - QWaylandHardwareIntegration *mHardwareIntegration; + QScopedPointer mDndSelectionHandler; + QScopedPointer mWindowExtension; + QScopedPointer mSubSurfaceExtension; + QScopedPointer mOutputExtension; + QScopedPointer mTouchExtension; + QScopedPointer mQtKeyExtension; + QScopedPointer mWindowManagerIntegration; + QScopedPointer mTextInputManager; + QScopedPointer mHardwareIntegration; QSocketNotifier *mReadNotifier; int mFd; From 36ef74965d7b4fd9a17174d7ff8062e8ab6177c4 Mon Sep 17 00:00:00 2001 From: Jorgen Lind Date: Tue, 17 Dec 2013 15:26:34 +0100 Subject: [PATCH 0078/1507] QtWaylandScanner: add server api for specifically creating new objects Its no that obvious I think that setting the id == 0 when ading a resource is the right thing to do This commit can potentially break a CI build since it will not force a regeneration of the generated headers, but the "local" cpp files will use the updated header interface. To fix this clean the QtCompositor and the QtWaylandClient include directories in QtBase Change-Id: I32db799dfe338f38c3941eeeb22dd91ed0c7e77d Reviewed-by: Andy Nichols --- src/tools/qtwaylandscanner/qtwaylandscanner.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp index bd8471e0a34..4378322297d 100644 --- a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp +++ b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp @@ -437,6 +437,7 @@ void process(QXmlStreamReader &xml, const QByteArray &headerPath) printf(" void init(struct ::wl_client *client, int id);\n"); printf(" void init(struct ::wl_display *display);\n"); printf("\n"); + printf(" Resource *add(struct ::wl_client *client);\n"); printf(" Resource *add(struct ::wl_client *client, int id);\n"); printf(" Resource *add(struct wl_list *resource_list, struct ::wl_client *client, int id);\n"); printf("\n"); @@ -585,6 +586,14 @@ void process(QXmlStreamReader &xml, const QByteArray &headerPath) printf(" }\n"); printf("\n"); + printf(" %s::Resource *%s::add(struct ::wl_client *client)\n", interfaceName, interfaceName); + printf(" {\n"); + printf(" Resource *resource = bind(client, 0);\n"); + printf(" m_resource_map.insert(client, resource);\n"); + printf(" return resource;\n"); + printf(" }\n"); + printf("\n"); + printf(" %s::Resource *%s::add(struct ::wl_client *client, int id)\n", interfaceName, interfaceName); printf(" {\n"); printf(" Resource *resource = bind(client, id);\n"); @@ -639,6 +648,8 @@ void process(QXmlStreamReader &xml, const QByteArray &headerPath) QByteArray interfaceMember = hasRequests ? "&m_" + interface.name + "_interface" : QByteArray("0"); + //We should consider changing bind so that it doesn't special case id == 0 + //and use function overloading instead. Jan do you have a lot of code dependent on this behavior? printf(" %s::Resource *%s::bind(struct ::wl_client *client, uint32_t id)\n", interfaceName, interfaceName); printf(" {\n"); printf(" Resource *resource = %s_allocate();\n", interfaceNameStripped); From 151d530b443f14d94e8059fa1a75ddd173e20298 Mon Sep 17 00:00:00 2001 From: Jorgen Lind Date: Tue, 17 Dec 2013 15:27:59 +0100 Subject: [PATCH 0079/1507] update server buffer interfaces Change-Id: Ifc10b17deedc800167f3d03b2e4437e6b702ffa5 Reviewed-by: Andy Nichols --- .../qwaylandserverbufferintegration.cpp | 27 +++++++++++++++ .../qwaylandserverbufferintegration.h | 34 +++++++++++++++---- 2 files changed, 54 insertions(+), 7 deletions(-) diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegration.cpp b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegration.cpp index 66fec00ea2b..9b4174d3191 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegration.cpp +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegration.cpp @@ -1,5 +1,31 @@ #include "qwaylandserverbufferintegration.h" +QT_BEGIN_NAMESPACE + +QWaylandServerBuffer::QWaylandServerBuffer() + : m_user_data(0) +{ +} + +QWaylandServerBuffer::~QWaylandServerBuffer() +{ +} + +void QWaylandServerBuffer::setUserData(void *userData) +{ + m_user_data = userData; +} + +void *QWaylandServerBuffer::userData() const +{ + return m_user_data; +} + +QWaylandServerBuffer::Format QWaylandServerBuffer::format() const +{ + return m_format; +} + QWaylandServerBufferIntegration::QWaylandServerBufferIntegration() { } @@ -7,3 +33,4 @@ QWaylandServerBufferIntegration::~QWaylandServerBufferIntegration() { } +QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegration.h b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegration.h index 0bb8a6ebcc4..fcb92aecde4 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegration.h +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegration.h @@ -51,6 +51,32 @@ QT_BEGIN_NAMESPACE class QWaylandDisplay; +class Q_WAYLAND_CLIENT_EXPORT QWaylandServerBuffer +{ +public: + enum Format { + RGBA32, + A8 + }; + + QWaylandServerBuffer(); + virtual ~QWaylandServerBuffer(); + + //creates new texture for buffer + virtual GLuint createTexture() = 0; + + void setUserData(void *userData); + void *userData() const; + + Format format() const; + +protected: + Format m_format; + +private: + void *m_user_data; +}; + class Q_WAYLAND_CLIENT_EXPORT QWaylandServerBufferIntegration { public: @@ -59,13 +85,7 @@ public: virtual void initialize(QWaylandDisplay *display) = 0; - //creates new texture for buffer - virtual GLuint createTextureFor(struct qt_server_buffer *buffer) = 0; - - //does not clean up textures. Just lets server know that it does - //not intend to use the buffer anymore. Textures should have been - //deleted prior to calling this function - virtual void release(struct qt_server_buffer *buffer) = 0; + virtual QWaylandServerBuffer *serverBuffer(struct qt_server_buffer *buffer) = 0; }; QT_END_NAMESPACE From 5ea6ff734b85cadad42f86e9b6e2912d96fdc487 Mon Sep 17 00:00:00 2001 From: Jorgen Lind Date: Tue, 17 Dec 2013 15:32:02 +0100 Subject: [PATCH 0080/1507] Add wl_display and server_buffer_integration to the native interface This is because the platform plugin name might not be wayland but we need a way to figure out that the platform plugin has at least the wl_display Change-Id: I0c88f153fd71d77dc703b4e69199b1b3d19ba013 Reviewed-by: Andy Nichols --- src/plugins/platforms/wayland/qwaylandnativeinterface.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp b/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp index 354e8dbaa66..291f1711fb4 100644 --- a/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp +++ b/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp @@ -60,10 +60,12 @@ void *QWaylandNativeInterface::nativeResourceForIntegration(const QByteArray &re { QByteArray lowerCaseResource = resourceString.toLower(); - if (lowerCaseResource == "display") + if (lowerCaseResource == "display" || lowerCaseResource == "wl_display") return m_integration->display()->wl_display(); if (lowerCaseResource == "compositor") return const_cast(m_integration->display()->wl_compositor()); + if (lowerCaseResource == "server_buffer_integration") + return m_integration->serverBufferIntegration(); return 0; } From a1cfcb8ce853e515f3deccfbc71011b0225d9a9d Mon Sep 17 00:00:00 2001 From: Jorgen Lind Date: Tue, 17 Dec 2013 16:26:39 +0100 Subject: [PATCH 0081/1507] Add drm-egl server buffer integration Change-Id: Ib72cb43e78c068ebafa8c4e8ef1576746c7015e8 Reviewed-by: Andy Nichols --- .../extensions/drm-egl-server-buffer.xml | 56 ++++++++++++++ .../plugins/hardwareintegration/client.pro | 4 + .../drm-egl-server/drm-egl-server.json | 3 + .../drm-egl-server/drm-egl-server.pro | 14 ++++ .../drm-egl-server/main.cpp | 74 +++++++++++++++++++ 5 files changed, 151 insertions(+) create mode 100644 src/3rdparty/wayland/extensions/drm-egl-server-buffer.xml create mode 100644 src/plugins/platforms/wayland/plugins/hardwareintegration/drm-egl-server/drm-egl-server.json create mode 100644 src/plugins/platforms/wayland/plugins/hardwareintegration/drm-egl-server/drm-egl-server.pro create mode 100644 src/plugins/platforms/wayland/plugins/hardwareintegration/drm-egl-server/main.cpp diff --git a/src/3rdparty/wayland/extensions/drm-egl-server-buffer.xml b/src/3rdparty/wayland/extensions/drm-egl-server-buffer.xml new file mode 100644 index 00000000000..597552ee4fb --- /dev/null +++ b/src/3rdparty/wayland/extensions/drm-egl-server-buffer.xml @@ -0,0 +1,56 @@ + + + + Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). + Contact: http://www.qt-project.org/legal + + This file is part of the plugins of the Qt Toolkit. + + $QT_BEGIN_LICENSE:BSD$ + You may use this file under the terms of the BSD license as follows: + + "Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names + of its contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." + + $QT_END_LICENSE$ + + + + + + + + + + + + + + + + + + diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/client.pro b/src/plugins/platforms/wayland/plugins/hardwareintegration/client.pro index 8c8f74bf6fc..0b1191919a9 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/client.pro +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/client.pro @@ -13,3 +13,7 @@ config_xcomposite { !contains(QT_CONFIG, opengles2):config_glx: \ SUBDIRS += xcomposite-glx } + +# we should try and resolve all symbols +# and they should be type deffed if not present +SUBDIRS += drm-egl-server diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/drm-egl-server/drm-egl-server.json b/src/plugins/platforms/wayland/plugins/hardwareintegration/drm-egl-server/drm-egl-server.json new file mode 100644 index 00000000000..e2266ec602d --- /dev/null +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/drm-egl-server/drm-egl-server.json @@ -0,0 +1,3 @@ +{ + "Keys": [ "drm-egl-server" ] +} diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/drm-egl-server/drm-egl-server.pro b/src/plugins/platforms/wayland/plugins/hardwareintegration/drm-egl-server/drm-egl-server.pro new file mode 100644 index 00000000000..d282afc816c --- /dev/null +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/drm-egl-server/drm-egl-server.pro @@ -0,0 +1,14 @@ +PLUGIN_TYPE = wayland-graphics-integration/client +load(qt_plugin) + +QT += waylandclient-private + +include(../../../../hardwareintegration/client/drm-egl-server/drm-egl-server.pri) + +LIBS += -lEGL + +OTHER_FILES += \ + drm-egl-server.json + +SOURCES += main.cpp + diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/drm-egl-server/main.cpp b/src/plugins/platforms/wayland/plugins/hardwareintegration/drm-egl-server/main.cpp new file mode 100644 index 00000000000..33f48428776 --- /dev/null +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/drm-egl-server/main.cpp @@ -0,0 +1,74 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include "drmeglserverbufferintegration.h" + +QT_BEGIN_NAMESPACE + +class DrmEglServerBufferPlugin : public QWaylandServerBufferIntegrationPlugin +{ + Q_OBJECT + Q_PLUGIN_METADATA(IID "org.qt-project.Qt.WaylandClient.QWaylandServerBufferIntegrationFactoryInterface.5.1" FILE "drm-egl-server.json") +public: + QStringList keys() const; + QWaylandServerBufferIntegration *create(const QString&, const QStringList&); +}; + +QStringList DrmEglServerBufferPlugin::keys() const +{ + QStringList list; + list << "drm-egl-server"; + return list; +} + +QWaylandServerBufferIntegration *DrmEglServerBufferPlugin::create(const QString& system, const QStringList& paramList) +{ + Q_UNUSED(paramList); + if (system.toLower() == "drm-egl-server") + return new DrmEglServerBufferIntegration(); + + return 0; +} + +QT_END_NAMESPACE + +#include "main.moc" From 4edf4eec322475f2ae1e639d8561cb27b34e15be Mon Sep 17 00:00:00 2001 From: Jorgen Lind Date: Wed, 18 Dec 2013 07:59:53 +0100 Subject: [PATCH 0082/1507] Make classes in client private Change-Id: Ibf400b32f78a6a0fcf0991914d2d9ad684483979 Reviewed-by: Andy Nichols --- src/plugins/platforms/wayland/client.pro | 52 +++++++++---------- .../hardwareintegration.pri | 16 +++--- .../qwaylandclientbufferintegration.cpp | 2 +- ....h => qwaylandclientbufferintegration_p.h} | 2 +- ...qwaylandclientbufferintegrationfactory.cpp | 6 +-- ...waylandclientbufferintegrationfactory_p.h} | 2 +- .../qwaylandclientbufferintegrationplugin.cpp | 2 +- ...qwaylandclientbufferintegrationplugin_p.h} | 2 +- .../qwaylandhardwareintegration.cpp | 4 +- ...tion.h => qwaylandhardwareintegration_p.h} | 2 +- .../qwaylandserverbufferintegration.cpp | 2 +- ....h => qwaylandserverbufferintegration_p.h} | 2 +- ...qwaylandserverbufferintegrationfactory.cpp | 4 +- ...waylandserverbufferintegrationfactory_p.h} | 2 +- .../qwaylandserverbufferintegrationplugin.cpp | 2 +- ...qwaylandserverbufferintegrationplugin_p.h} | 2 +- .../drm-egl-server/main.cpp | 2 +- .../hardwareintegration/wayland-egl/main.cpp | 2 +- .../xcomposite-egl/main.cpp | 2 +- .../{qwaylandbuffer.h => qwaylandbuffer_p.h} | 2 +- ...lientexport.h => qwaylandclientexport_p.h} | 0 .../platforms/wayland/qwaylandclipboard.cpp | 12 ++--- ...ylandclipboard.h => qwaylandclipboard_p.h} | 2 +- .../platforms/wayland/qwaylandcursor.cpp | 10 ++-- .../{qwaylandcursor.h => qwaylandcursor_p.h} | 2 +- .../platforms/wayland/qwaylanddatadevice.cpp | 12 ++--- ...anddatadevice.h => qwaylanddatadevice_p.h} | 2 +- .../wayland/qwaylanddatadevicemanager.cpp | 8 +-- ...anager.h => qwaylanddatadevicemanager_p.h} | 2 +- .../platforms/wayland/qwaylanddataoffer.cpp | 4 +- ...ylanddataoffer.h => qwaylanddataoffer_p.h} | 2 +- .../platforms/wayland/qwaylanddatasource.cpp | 8 +-- ...anddatasource.h => qwaylanddatasource_p.h} | 2 +- .../platforms/wayland/qwaylanddecoration.cpp | 10 ++-- ...anddecoration.h => qwaylanddecoration_p.h} | 2 +- .../platforms/wayland/qwaylanddisplay.cpp | 32 ++++++------ ...{qwaylanddisplay.h => qwaylanddisplay_p.h} | 2 +- src/plugins/platforms/wayland/qwaylanddnd.cpp | 10 ++-- .../{qwaylanddnd.h => qwaylanddnd_p.h} | 2 +- .../platforms/wayland/qwaylandeventthread.cpp | 2 +- ...deventthread.h => qwaylandeventthread_p.h} | 2 +- .../wayland/qwaylandextendedoutput.cpp | 4 +- ...dedoutput.h => qwaylandextendedoutput_p.h} | 2 +- .../wayland/qwaylandextendedsurface.cpp | 8 +-- ...dsurface.h => qwaylandextendedsurface_p.h} | 2 +- .../wayland/qwaylandinputcontext.cpp | 8 +-- ...nputcontext.h => qwaylandinputcontext_p.h} | 0 .../platforms/wayland/qwaylandinputdevice.cpp | 18 +++---- ...dinputdevice.h => qwaylandinputdevice_p.h} | 2 +- .../platforms/wayland/qwaylandintegration.cpp | 28 +++++----- ...dintegration.h => qwaylandintegration_p.h} | 2 +- .../wayland/qwaylandnativeinterface.cpp | 14 ++--- ...nterface.h => qwaylandnativeinterface_p.h} | 2 +- .../platforms/wayland/qwaylandqtkey.cpp | 4 +- .../{qwaylandqtkey.h => qwaylandqtkey_p.h} | 2 +- .../platforms/wayland/qwaylandscreen.cpp | 8 +-- .../{qwaylandscreen.h => qwaylandscreen_p.h} | 2 +- .../wayland/qwaylandshellsurface.cpp | 12 ++--- ...hellsurface.h => qwaylandshellsurface_p.h} | 2 +- .../wayland/qwaylandshmbackingstore.cpp | 10 ++-- ...ingstore.h => qwaylandshmbackingstore_p.h} | 6 +-- .../platforms/wayland/qwaylandshmwindow.cpp | 4 +- ...ylandshmwindow.h => qwaylandshmwindow_p.h} | 2 +- .../platforms/wayland/qwaylandsubsurface.cpp | 4 +- ...andsubsurface.h => qwaylandsubsurface_p.h} | 2 +- .../platforms/wayland/qwaylandtouch.cpp | 4 +- .../{qwaylandtouch.h => qwaylandtouch_p.h} | 2 +- .../platforms/wayland/qwaylandwindow.cpp | 20 +++---- .../{qwaylandwindow.h => qwaylandwindow_p.h} | 2 +- .../qwaylandwindowmanagerintegration.cpp | 6 +-- ...h => qwaylandwindowmanagerintegration_p.h} | 2 +- 71 files changed, 213 insertions(+), 211 deletions(-) rename src/plugins/platforms/wayland/hardwareintegration/{qwaylandclientbufferintegration.h => qwaylandclientbufferintegration_p.h} (97%) rename src/plugins/platforms/wayland/hardwareintegration/{qwaylandclientbufferintegrationfactory.h => qwaylandclientbufferintegrationfactory_p.h} (97%) rename src/plugins/platforms/wayland/hardwareintegration/{qwaylandclientbufferintegrationplugin.h => qwaylandclientbufferintegrationplugin_p.h} (97%) rename src/plugins/platforms/wayland/hardwareintegration/{qwaylandhardwareintegration.h => qwaylandhardwareintegration_p.h} (97%) rename src/plugins/platforms/wayland/hardwareintegration/{qwaylandserverbufferintegration.h => qwaylandserverbufferintegration_p.h} (98%) rename src/plugins/platforms/wayland/hardwareintegration/{qwaylandserverbufferintegrationfactory.h => qwaylandserverbufferintegrationfactory_p.h} (97%) rename src/plugins/platforms/wayland/hardwareintegration/{qwaylandserverbufferintegrationplugin.h => qwaylandserverbufferintegrationplugin_p.h} (97%) rename src/plugins/platforms/wayland/{qwaylandbuffer.h => qwaylandbuffer_p.h} (97%) rename src/plugins/platforms/wayland/{qwaylandclientexport.h => qwaylandclientexport_p.h} (100%) rename src/plugins/platforms/wayland/{qwaylandclipboard.h => qwaylandclipboard_p.h} (97%) rename src/plugins/platforms/wayland/{qwaylandcursor.h => qwaylandcursor_p.h} (98%) rename src/plugins/platforms/wayland/{qwaylanddatadevice.h => qwaylanddatadevice_p.h} (99%) rename src/plugins/platforms/wayland/{qwaylanddatadevicemanager.h => qwaylanddatadevicemanager_p.h} (97%) rename src/plugins/platforms/wayland/{qwaylanddataoffer.h => qwaylanddataoffer_p.h} (99%) rename src/plugins/platforms/wayland/{qwaylanddatasource.h => qwaylanddatasource_p.h} (97%) rename src/plugins/platforms/wayland/{qwaylanddecoration.h => qwaylanddecoration_p.h} (98%) rename src/plugins/platforms/wayland/{qwaylanddisplay.h => qwaylanddisplay_p.h} (99%) rename src/plugins/platforms/wayland/{qwaylanddnd.h => qwaylanddnd_p.h} (98%) rename src/plugins/platforms/wayland/{qwaylandeventthread.h => qwaylandeventthread_p.h} (92%) rename src/plugins/platforms/wayland/{qwaylandextendedoutput.h => qwaylandextendedoutput_p.h} (97%) rename src/plugins/platforms/wayland/{qwaylandextendedsurface.h => qwaylandextendedsurface_p.h} (98%) rename src/plugins/platforms/wayland/{qwaylandinputcontext.h => qwaylandinputcontext_p.h} (100%) rename src/plugins/platforms/wayland/{qwaylandinputdevice.h => qwaylandinputdevice_p.h} (99%) rename src/plugins/platforms/wayland/{qwaylandintegration.h => qwaylandintegration_p.h} (98%) rename src/plugins/platforms/wayland/{qwaylandnativeinterface.h => qwaylandnativeinterface_p.h} (98%) rename src/plugins/platforms/wayland/{qwaylandqtkey.h => qwaylandqtkey_p.h} (98%) rename src/plugins/platforms/wayland/{qwaylandscreen.h => qwaylandscreen_p.h} (98%) rename src/plugins/platforms/wayland/{qwaylandshellsurface.h => qwaylandshellsurface_p.h} (98%) rename src/plugins/platforms/wayland/{qwaylandshmbackingstore.h => qwaylandshmbackingstore_p.h} (96%) rename src/plugins/platforms/wayland/{qwaylandshmwindow.h => qwaylandshmwindow_p.h} (98%) rename src/plugins/platforms/wayland/{qwaylandsubsurface.h => qwaylandsubsurface_p.h} (97%) rename src/plugins/platforms/wayland/{qwaylandtouch.h => qwaylandtouch_p.h} (98%) rename src/plugins/platforms/wayland/{qwaylandwindow.h => qwaylandwindow_p.h} (99%) rename src/plugins/platforms/wayland/{qwaylandwindowmanagerintegration.h => qwaylandwindowmanagerintegration_p.h} (98%) diff --git a/src/plugins/platforms/wayland/client.pro b/src/plugins/platforms/wayland/client.pro index 152370c0bec..01d704a9463 100644 --- a/src/plugins/platforms/wayland/client.pro +++ b/src/plugins/platforms/wayland/client.pro @@ -67,32 +67,32 @@ SOURCES += qwaylandintegration.cpp \ qwaylandinputcontext.cpp \ qwaylanddatadevice.cpp \ -HEADERS += qwaylandintegration.h \ - qwaylandnativeinterface.h \ - qwaylandcursor.h \ - qwaylanddisplay.h \ - qwaylandwindow.h \ - qwaylandscreen.h \ - qwaylandshmbackingstore.h \ - qwaylandinputdevice.h \ - qwaylandbuffer.h \ - qwaylandshmwindow.h \ - qwaylandclipboard.h \ - qwaylanddnd.h \ - qwaylanddataoffer.h \ - qwaylanddatadevicemanager.h \ - qwaylanddatasource.h \ - qwaylandshellsurface.h \ - qwaylandextendedoutput.h \ - qwaylandextendedsurface.h \ - qwaylandsubsurface.h \ - qwaylandtouch.h \ - qwaylandqtkey.h \ +HEADERS += qwaylandintegration_p.h \ + qwaylandnativeinterface_p.h \ + qwaylandcursor_p.h \ + qwaylanddisplay_p.h \ + qwaylandwindow_p.h \ + qwaylandscreen_p.h \ + qwaylandshmbackingstore_p.h \ + qwaylandinputdevice_p.h \ + qwaylandbuffer_p.h \ + qwaylandshmwindow_p.h \ + qwaylandclipboard_p.h \ + qwaylanddnd_p.h \ + qwaylanddataoffer_p.h \ + qwaylanddatadevicemanager_p.h \ + qwaylanddatasource_p.h \ + qwaylandshellsurface_p.h \ + qwaylandextendedoutput_p.h \ + qwaylandextendedsurface_p.h \ + qwaylandsubsurface_p.h \ + qwaylandtouch_p.h \ + qwaylandqtkey_p.h \ ../shared/qwaylandmimehelper.h \ - qwaylanddecoration.h \ - qwaylandeventthread.h \ - qwaylandwindowmanagerintegration.h \ - qwaylandinputcontext.h \ - qwaylanddatadevice.h \ + qwaylanddecoration_p.h \ + qwaylandeventthread_p.h \ + qwaylandwindowmanagerintegration_p.h \ + qwaylandinputcontext_p.h \ + qwaylanddatadevice_p.h \ include(hardwareintegration/hardwareintegration.pri) diff --git a/src/plugins/platforms/wayland/hardwareintegration/hardwareintegration.pri b/src/plugins/platforms/wayland/hardwareintegration/hardwareintegration.pri index 1588ca9775b..bb4fe76d6b0 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/hardwareintegration.pri +++ b/src/plugins/platforms/wayland/hardwareintegration/hardwareintegration.pri @@ -2,6 +2,8 @@ WAYLANDCLIENTSOURCES += \ $$PWD/../../extensions/server-buffer-extension.xml \ $$PWD/../../extensions/hardware-integration.xml +INCLUDEPATH += $$PWD + SOURCES += \ $$PWD/qwaylandclientbufferintegration.cpp \ $$PWD/qwaylandclientbufferintegrationplugin.cpp \ @@ -12,11 +14,11 @@ SOURCES += \ $$PWD/qwaylandhardwareintegration.cpp HEADERS += \ - $$PWD/qwaylandclientbufferintegration.h \ - $$PWD/qwaylandclientbufferintegrationplugin.h \ - $$PWD/qwaylandclientbufferintegrationfactory.h \ - $$PWD/qwaylandserverbufferintegration.h \ - $$PWD/qwaylandserverbufferintegrationplugin.h \ - $$PWD/qwaylandserverbufferintegrationfactory.h \ - $$PWD/qwaylandhardwareintegration.h + $$PWD/qwaylandclientbufferintegration_p.h \ + $$PWD/qwaylandclientbufferintegrationplugin_p.h \ + $$PWD/qwaylandclientbufferintegrationfactory_p.h \ + $$PWD/qwaylandserverbufferintegration_p.h \ + $$PWD/qwaylandserverbufferintegrationplugin_p.h \ + $$PWD/qwaylandserverbufferintegrationfactory_p.h \ + $$PWD/qwaylandhardwareintegration_p.h diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegration.cpp b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegration.cpp index c04ee177204..2c4d8ff1bf6 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegration.cpp +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegration.cpp @@ -39,7 +39,7 @@ ** ****************************************************************************/ -#include "qwaylandclientbufferintegration.h" +#include "qwaylandclientbufferintegration_p.h" QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegration.h b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegration_p.h similarity index 97% rename from src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegration.h rename to src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegration_p.h index 608a8cb226c..153b3f591c2 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegration.h +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegration_p.h @@ -43,7 +43,7 @@ #define QWAYLANDCLIENTBUFFERINTEGRATION_H #include -#include +#include QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationfactory.cpp b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationfactory.cpp index c87c016f5df..e168f612f97 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationfactory.cpp +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationfactory.cpp @@ -39,9 +39,9 @@ ** ****************************************************************************/ -#include "qwaylandclientbufferintegrationfactory.h" -#include "qwaylandclientbufferintegrationplugin.h" -#include "qwaylandclientbufferintegration.h" +#include "qwaylandclientbufferintegrationfactory_p.h" +#include "qwaylandclientbufferintegrationplugin_p.h" +#include "qwaylandclientbufferintegration_p.h" #include #include #include diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationfactory.h b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationfactory_p.h similarity index 97% rename from src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationfactory.h rename to src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationfactory_p.h index 12b2e8dbbda..4a1c4128694 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationfactory.h +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationfactory_p.h @@ -42,7 +42,7 @@ #ifndef QWAYLANDCLIENTBUFFERINTEGRATIONFACTORY_H #define QWAYLANDCLIENTBUFFERINTEGRATIONFACTORY_H -#include +#include #include QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationplugin.cpp b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationplugin.cpp index 58bb26d192f..afc1051067d 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationplugin.cpp +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationplugin.cpp @@ -39,7 +39,7 @@ ** ****************************************************************************/ -#include "qwaylandclientbufferintegrationplugin.h" +#include "qwaylandclientbufferintegrationplugin_p.h" QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationplugin.h b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationplugin_p.h similarity index 97% rename from src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationplugin.h rename to src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationplugin_p.h index 6858440613f..476e31a781a 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationplugin.h +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationplugin_p.h @@ -42,7 +42,7 @@ #ifndef QWAYLANDCLIENTBUFFERINTEGRATIONPLUGIN_H #define QWAYLANDCLIENTBUFFERINTEGRATIONPLUGIN_H -#include +#include #include #include diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandhardwareintegration.cpp b/src/plugins/platforms/wayland/hardwareintegration/qwaylandhardwareintegration.cpp index 67c951eac62..a7269ce9e54 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandhardwareintegration.cpp +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandhardwareintegration.cpp @@ -39,9 +39,9 @@ ** ****************************************************************************/ -#include "qwaylandhardwareintegration.h" +#include "qwaylandhardwareintegration_p.h" -#include "qwaylanddisplay.h" +#include "qwaylanddisplay_p.h" QT_BEGIN_NAMESPACE QWaylandHardwareIntegration::QWaylandHardwareIntegration(struct ::wl_registry *registry, int id) diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandhardwareintegration.h b/src/plugins/platforms/wayland/hardwareintegration/qwaylandhardwareintegration_p.h similarity index 97% rename from src/plugins/platforms/wayland/hardwareintegration/qwaylandhardwareintegration.h rename to src/plugins/platforms/wayland/hardwareintegration/qwaylandhardwareintegration_p.h index faa57856724..84aa18ace70 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandhardwareintegration.h +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandhardwareintegration_p.h @@ -43,7 +43,7 @@ #define QWAYLANDHARDWAREINTEGRATION_H #include -#include +#include QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegration.cpp b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegration.cpp index 9b4174d3191..ee64624ada7 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegration.cpp +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegration.cpp @@ -1,4 +1,4 @@ -#include "qwaylandserverbufferintegration.h" +#include "qwaylandserverbufferintegration_p.h" QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegration.h b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegration_p.h similarity index 98% rename from src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegration.h rename to src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegration_p.h index fcb92aecde4..7241aec1f91 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegration.h +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegration_p.h @@ -45,7 +45,7 @@ #include #include -#include +#include QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationfactory.cpp b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationfactory.cpp index e36de7e729b..bd7661c2fee 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationfactory.cpp +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationfactory.cpp @@ -39,8 +39,8 @@ ** ****************************************************************************/ -#include "qwaylandserverbufferintegrationfactory.h" -#include "qwaylandserverbufferintegrationplugin.h" +#include "qwaylandserverbufferintegrationfactory_p.h" +#include "qwaylandserverbufferintegrationplugin_p.h" #include #include diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationfactory.h b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationfactory_p.h similarity index 97% rename from src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationfactory.h rename to src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationfactory_p.h index 5e48e7b51f5..48e5e13d9ba 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationfactory.h +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationfactory_p.h @@ -42,7 +42,7 @@ #ifndef QWAYLANDSERVERBUFFERINTEGRATIONFACTORY_H #define QWAYLANDSERVERBUFFERINTEGRATIONFACTORY_H -#include +#include #include QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationplugin.cpp b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationplugin.cpp index 2bb3eb2164f..8fc31a883d6 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationplugin.cpp +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationplugin.cpp @@ -39,7 +39,7 @@ ** ****************************************************************************/ -#include "qwaylandserverbufferintegrationplugin.h" +#include "qwaylandserverbufferintegrationplugin_p.h" QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationplugin.h b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationplugin_p.h similarity index 97% rename from src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationplugin.h rename to src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationplugin_p.h index c3605dc7022..39d9a8ba6f4 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationplugin.h +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationplugin_p.h @@ -42,7 +42,7 @@ #ifndef QWAYLANDSERVERBUFFERINTEGRATIONPLUGIN_H #define QWAYLANDSERVERBUFFERINTEGRATIONPLUGIN_H -#include +#include #include #include diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/drm-egl-server/main.cpp b/src/plugins/platforms/wayland/plugins/hardwareintegration/drm-egl-server/main.cpp index 33f48428776..460ccb7a10a 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/drm-egl-server/main.cpp +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/drm-egl-server/main.cpp @@ -39,7 +39,7 @@ ** ****************************************************************************/ -#include +#include #include "drmeglserverbufferintegration.h" QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/main.cpp b/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/main.cpp index a6b7bbb6917..44ce6019d86 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/main.cpp +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/main.cpp @@ -39,7 +39,7 @@ ** ****************************************************************************/ -#include +#include #include "qwaylandeglclientbufferintegration.h" QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-egl/main.cpp b/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-egl/main.cpp index 161657c8fe2..7c6135ccc58 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-egl/main.cpp +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-egl/main.cpp @@ -39,7 +39,7 @@ ** ****************************************************************************/ -#include +#include #include "qwaylandxcompositeeglclientbufferintegration.h" QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandbuffer.h b/src/plugins/platforms/wayland/qwaylandbuffer_p.h similarity index 97% rename from src/plugins/platforms/wayland/qwaylandbuffer.h rename to src/plugins/platforms/wayland/qwaylandbuffer_p.h index 9548eadf873..2bb9990f3dd 100644 --- a/src/plugins/platforms/wayland/qwaylandbuffer.h +++ b/src/plugins/platforms/wayland/qwaylandbuffer_p.h @@ -42,7 +42,7 @@ #ifndef QWAYLANDBUFFER_H #define QWAYLANDBUFFER_H -#include +#include #include #include diff --git a/src/plugins/platforms/wayland/qwaylandclientexport.h b/src/plugins/platforms/wayland/qwaylandclientexport_p.h similarity index 100% rename from src/plugins/platforms/wayland/qwaylandclientexport.h rename to src/plugins/platforms/wayland/qwaylandclientexport_p.h diff --git a/src/plugins/platforms/wayland/qwaylandclipboard.cpp b/src/plugins/platforms/wayland/qwaylandclipboard.cpp index 838f6d23195..c40f023b55a 100644 --- a/src/plugins/platforms/wayland/qwaylandclipboard.cpp +++ b/src/plugins/platforms/wayland/qwaylandclipboard.cpp @@ -39,12 +39,12 @@ ** ****************************************************************************/ -#include "qwaylandclipboard.h" -#include "qwaylanddisplay.h" -#include "qwaylandinputdevice.h" -#include "qwaylanddataoffer.h" -#include "qwaylanddatasource.h" -#include "qwaylanddatadevice.h" +#include "qwaylandclipboard_p.h" +#include "qwaylanddisplay_p.h" +#include "qwaylandinputdevice_p.h" +#include "qwaylanddataoffer_p.h" +#include "qwaylanddatasource_p.h" +#include "qwaylanddatadevice_p.h" QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandclipboard.h b/src/plugins/platforms/wayland/qwaylandclipboard_p.h similarity index 97% rename from src/plugins/platforms/wayland/qwaylandclipboard.h rename to src/plugins/platforms/wayland/qwaylandclipboard_p.h index 692a31255b2..0dea3371ae9 100644 --- a/src/plugins/platforms/wayland/qwaylandclipboard.h +++ b/src/plugins/platforms/wayland/qwaylandclipboard_p.h @@ -45,7 +45,7 @@ #include #include -#include +#include QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandcursor.cpp b/src/plugins/platforms/wayland/qwaylandcursor.cpp index 05ab6d496a8..90789b0dfc7 100644 --- a/src/plugins/platforms/wayland/qwaylandcursor.cpp +++ b/src/plugins/platforms/wayland/qwaylandcursor.cpp @@ -39,12 +39,12 @@ ** ****************************************************************************/ -#include "qwaylandcursor.h" +#include "qwaylandcursor_p.h" -#include "qwaylanddisplay.h" -#include "qwaylandinputdevice.h" -#include "qwaylandscreen.h" -#include "qwaylandshmbackingstore.h" +#include "qwaylanddisplay_p.h" +#include "qwaylandinputdevice_p.h" +#include "qwaylandscreen_p.h" +#include "qwaylandshmbackingstore_p.h" #include #include diff --git a/src/plugins/platforms/wayland/qwaylandcursor.h b/src/plugins/platforms/wayland/qwaylandcursor_p.h similarity index 98% rename from src/plugins/platforms/wayland/qwaylandcursor.h rename to src/plugins/platforms/wayland/qwaylandcursor_p.h index 894d322a616..282ac685f5c 100644 --- a/src/plugins/platforms/wayland/qwaylandcursor.h +++ b/src/plugins/platforms/wayland/qwaylandcursor_p.h @@ -44,7 +44,7 @@ #include #include -#include +#include struct wl_cursor; struct wl_cursor_image; diff --git a/src/plugins/platforms/wayland/qwaylanddatadevice.cpp b/src/plugins/platforms/wayland/qwaylanddatadevice.cpp index faa04c3db7a..2d6a6f4b6cf 100644 --- a/src/plugins/platforms/wayland/qwaylanddatadevice.cpp +++ b/src/plugins/platforms/wayland/qwaylanddatadevice.cpp @@ -38,13 +38,13 @@ ** ****************************************************************************/ -#include "qwaylanddatadevice.h" +#include "qwaylanddatadevice_p.h" -#include "qwaylanddatadevicemanager.h" -#include "qwaylanddataoffer.h" -#include "qwaylanddatasource.h" -#include "qwaylanddnd.h" -#include "qwaylandinputdevice.h" +#include "qwaylanddatadevicemanager_p.h" +#include "qwaylanddataoffer_p.h" +#include "qwaylanddatasource_p.h" +#include "qwaylanddnd_p.h" +#include "qwaylandinputdevice_p.h" #include #include diff --git a/src/plugins/platforms/wayland/qwaylanddatadevice.h b/src/plugins/platforms/wayland/qwaylanddatadevice_p.h similarity index 99% rename from src/plugins/platforms/wayland/qwaylanddatadevice.h rename to src/plugins/platforms/wayland/qwaylanddatadevice_p.h index e258d87766e..4e98424e501 100644 --- a/src/plugins/platforms/wayland/qwaylanddatadevice.h +++ b/src/plugins/platforms/wayland/qwaylanddatadevice_p.h @@ -41,7 +41,7 @@ #ifndef QWAYLANDDATADEVICE_H #define QWAYLANDDATADEVICE_H -#include "qwaylanddisplay.h" +#include "qwaylanddisplay_p.h" QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylanddatadevicemanager.cpp b/src/plugins/platforms/wayland/qwaylanddatadevicemanager.cpp index 4a96dbce3da..5de28c00158 100644 --- a/src/plugins/platforms/wayland/qwaylanddatadevicemanager.cpp +++ b/src/plugins/platforms/wayland/qwaylanddatadevicemanager.cpp @@ -39,11 +39,11 @@ ** ****************************************************************************/ -#include "qwaylanddatadevicemanager.h" +#include "qwaylanddatadevicemanager_p.h" -#include "qwaylandinputdevice.h" -#include "qwaylanddatadevice.h" -#include "qwaylanddataoffer.h" +#include "qwaylandinputdevice_p.h" +#include "qwaylanddatadevice_p.h" +#include "qwaylanddataoffer_p.h" #include diff --git a/src/plugins/platforms/wayland/qwaylanddatadevicemanager.h b/src/plugins/platforms/wayland/qwaylanddatadevicemanager_p.h similarity index 97% rename from src/plugins/platforms/wayland/qwaylanddatadevicemanager.h rename to src/plugins/platforms/wayland/qwaylanddatadevicemanager_p.h index c51e12e7823..6e2beafbe3e 100644 --- a/src/plugins/platforms/wayland/qwaylanddatadevicemanager.h +++ b/src/plugins/platforms/wayland/qwaylanddatadevicemanager_p.h @@ -42,7 +42,7 @@ #ifndef QWAYLANDDATADEVICEMANAGER_H #define QWAYLANDDATADEVICEMANAGER_H -#include +#include QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylanddataoffer.cpp b/src/plugins/platforms/wayland/qwaylanddataoffer.cpp index e237d0b9a98..adaeb521465 100644 --- a/src/plugins/platforms/wayland/qwaylanddataoffer.cpp +++ b/src/plugins/platforms/wayland/qwaylanddataoffer.cpp @@ -39,8 +39,8 @@ ** ****************************************************************************/ -#include "qwaylanddataoffer.h" -#include "qwaylanddatadevicemanager.h" +#include "qwaylanddataoffer_p.h" +#include "qwaylanddatadevicemanager_p.h" #include #include diff --git a/src/plugins/platforms/wayland/qwaylanddataoffer.h b/src/plugins/platforms/wayland/qwaylanddataoffer_p.h similarity index 99% rename from src/plugins/platforms/wayland/qwaylanddataoffer.h rename to src/plugins/platforms/wayland/qwaylanddataoffer_p.h index 7dc3baa38af..ab34e177f1a 100644 --- a/src/plugins/platforms/wayland/qwaylanddataoffer.h +++ b/src/plugins/platforms/wayland/qwaylanddataoffer_p.h @@ -42,7 +42,7 @@ #ifndef QWAYLANDDATAOFFER_H #define QWAYLANDDATAOFFER_H -#include "qwaylanddisplay.h" +#include "qwaylanddisplay_p.h" #include diff --git a/src/plugins/platforms/wayland/qwaylanddatasource.cpp b/src/plugins/platforms/wayland/qwaylanddatasource.cpp index ba4b68110ed..3376db56748 100644 --- a/src/plugins/platforms/wayland/qwaylanddatasource.cpp +++ b/src/plugins/platforms/wayland/qwaylanddatasource.cpp @@ -39,10 +39,10 @@ ** ****************************************************************************/ -#include "qwaylanddatasource.h" -#include "qwaylanddataoffer.h" -#include "qwaylanddatadevicemanager.h" -#include "qwaylandinputdevice.h" +#include "qwaylanddatasource_p.h" +#include "qwaylanddataoffer_p.h" +#include "qwaylanddatadevicemanager_p.h" +#include "qwaylandinputdevice_p.h" #include "qwaylandmimehelper.h" #include diff --git a/src/plugins/platforms/wayland/qwaylanddatasource.h b/src/plugins/platforms/wayland/qwaylanddatasource_p.h similarity index 97% rename from src/plugins/platforms/wayland/qwaylanddatasource.h rename to src/plugins/platforms/wayland/qwaylanddatasource_p.h index 63a2150f802..9568f507c47 100644 --- a/src/plugins/platforms/wayland/qwaylanddatasource.h +++ b/src/plugins/platforms/wayland/qwaylanddatasource_p.h @@ -42,7 +42,7 @@ #ifndef QWAYLANDDATASOURCE_H #define QWAYLANDDATASOURCE_H -#include +#include #include diff --git a/src/plugins/platforms/wayland/qwaylanddecoration.cpp b/src/plugins/platforms/wayland/qwaylanddecoration.cpp index 74c01f93a83..8e7d03143a1 100644 --- a/src/plugins/platforms/wayland/qwaylanddecoration.cpp +++ b/src/plugins/platforms/wayland/qwaylanddecoration.cpp @@ -39,12 +39,12 @@ ** ****************************************************************************/ -#include "qwaylanddecoration.h" +#include "qwaylanddecoration_p.h" -#include "qwaylandwindow.h" -#include "qwaylandshellsurface.h" -#include "qwaylandinputdevice.h" -#include "qwaylandscreen.h" +#include "qwaylandwindow_p.h" +#include "qwaylandshellsurface_p.h" +#include "qwaylandinputdevice_p.h" +#include "qwaylandscreen_p.h" #include #include diff --git a/src/plugins/platforms/wayland/qwaylanddecoration.h b/src/plugins/platforms/wayland/qwaylanddecoration_p.h similarity index 98% rename from src/plugins/platforms/wayland/qwaylanddecoration.h rename to src/plugins/platforms/wayland/qwaylanddecoration_p.h index f99723588f0..3f53721f75d 100644 --- a/src/plugins/platforms/wayland/qwaylanddecoration.h +++ b/src/plugins/platforms/wayland/qwaylanddecoration_p.h @@ -49,7 +49,7 @@ #include #include #include -#include +#include #include diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index 922c4bcb809..ec439b5d2cf 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -39,26 +39,26 @@ ** ****************************************************************************/ -#include "qwaylanddisplay.h" +#include "qwaylanddisplay_p.h" -#include "qwaylandeventthread.h" -#include "qwaylandintegration.h" -#include "qwaylandwindow.h" -#include "qwaylandscreen.h" -#include "qwaylandcursor.h" -#include "qwaylandinputdevice.h" -#include "qwaylandclipboard.h" -#include "qwaylanddatadevicemanager.h" -#include "qwaylandhardwareintegration.h" +#include "qwaylandeventthread_p.h" +#include "qwaylandintegration_p.h" +#include "qwaylandwindow_p.h" +#include "qwaylandscreen_p.h" +#include "qwaylandcursor_p.h" +#include "qwaylandinputdevice_p.h" +#include "qwaylandclipboard_p.h" +#include "qwaylanddatadevicemanager_p.h" +#include "qwaylandhardwareintegration_p.h" -#include "qwaylandwindowmanagerintegration.h" +#include "qwaylandwindowmanagerintegration_p.h" -#include "qwaylandextendedoutput.h" -#include "qwaylandextendedsurface.h" -#include "qwaylandsubsurface.h" -#include "qwaylandtouch.h" -#include "qwaylandqtkey.h" +#include "qwaylandextendedoutput_p.h" +#include "qwaylandextendedsurface_p.h" +#include "qwaylandsubsurface_p.h" +#include "qwaylandtouch_p.h" +#include "qwaylandqtkey_p.h" #include diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.h b/src/plugins/platforms/wayland/qwaylanddisplay_p.h similarity index 99% rename from src/plugins/platforms/wayland/qwaylanddisplay.h rename to src/plugins/platforms/wayland/qwaylanddisplay_p.h index 4f9dacf42ba..5ba4f51beab 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay_p.h @@ -50,7 +50,7 @@ #include #include -#include +#include struct wl_cursor_image; diff --git a/src/plugins/platforms/wayland/qwaylanddnd.cpp b/src/plugins/platforms/wayland/qwaylanddnd.cpp index 635fd9678c6..0d5eddf5bbf 100644 --- a/src/plugins/platforms/wayland/qwaylanddnd.cpp +++ b/src/plugins/platforms/wayland/qwaylanddnd.cpp @@ -39,12 +39,12 @@ ** ****************************************************************************/ -#include "qwaylanddnd.h" +#include "qwaylanddnd_p.h" -#include "qwaylanddatadevice.h" -#include "qwaylanddatadevicemanager.h" -#include "qwaylanddataoffer.h" -#include "qwaylandinputdevice.h" +#include "qwaylanddatadevice_p.h" +#include "qwaylanddatadevicemanager_p.h" +#include "qwaylanddataoffer_p.h" +#include "qwaylandinputdevice_p.h" #include diff --git a/src/plugins/platforms/wayland/qwaylanddnd.h b/src/plugins/platforms/wayland/qwaylanddnd_p.h similarity index 98% rename from src/plugins/platforms/wayland/qwaylanddnd.h rename to src/plugins/platforms/wayland/qwaylanddnd_p.h index 8879a1d4ea9..22b004712b8 100644 --- a/src/plugins/platforms/wayland/qwaylanddnd.h +++ b/src/plugins/platforms/wayland/qwaylanddnd_p.h @@ -47,7 +47,7 @@ #include #include -#include +#include QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandeventthread.cpp b/src/plugins/platforms/wayland/qwaylandeventthread.cpp index 3392d36c667..b94110c25ef 100644 --- a/src/plugins/platforms/wayland/qwaylandeventthread.cpp +++ b/src/plugins/platforms/wayland/qwaylandeventthread.cpp @@ -1,4 +1,4 @@ -#include "qwaylandeventthread.h" +#include "qwaylandeventthread_p.h" #include #include diff --git a/src/plugins/platforms/wayland/qwaylandeventthread.h b/src/plugins/platforms/wayland/qwaylandeventthread_p.h similarity index 92% rename from src/plugins/platforms/wayland/qwaylandeventthread.h rename to src/plugins/platforms/wayland/qwaylandeventthread_p.h index ba7e33e0998..4174c96cfab 100644 --- a/src/plugins/platforms/wayland/qwaylandeventthread.h +++ b/src/plugins/platforms/wayland/qwaylandeventthread_p.h @@ -5,7 +5,7 @@ #include #include -#include +#include QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandextendedoutput.cpp b/src/plugins/platforms/wayland/qwaylandextendedoutput.cpp index d7c684be958..c79685af43b 100644 --- a/src/plugins/platforms/wayland/qwaylandextendedoutput.cpp +++ b/src/plugins/platforms/wayland/qwaylandextendedoutput.cpp @@ -39,9 +39,9 @@ ** ****************************************************************************/ -#include "qwaylandextendedoutput.h" +#include "qwaylandextendedoutput_p.h" -#include "qwaylandscreen.h" +#include "qwaylandscreen_p.h" #include diff --git a/src/plugins/platforms/wayland/qwaylandextendedoutput.h b/src/plugins/platforms/wayland/qwaylandextendedoutput_p.h similarity index 97% rename from src/plugins/platforms/wayland/qwaylandextendedoutput.h rename to src/plugins/platforms/wayland/qwaylandextendedoutput_p.h index d1ef3397f85..f18fb8e57bf 100644 --- a/src/plugins/platforms/wayland/qwaylandextendedoutput.h +++ b/src/plugins/platforms/wayland/qwaylandextendedoutput_p.h @@ -42,7 +42,7 @@ #ifndef QWAYLANDEXTENDEDOUTPUT_H #define QWAYLANDEXTENDEDOUTPUT_H -#include +#include #include QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandextendedsurface.cpp b/src/plugins/platforms/wayland/qwaylandextendedsurface.cpp index bfd2a1d0b8d..9d5a497087c 100644 --- a/src/plugins/platforms/wayland/qwaylandextendedsurface.cpp +++ b/src/plugins/platforms/wayland/qwaylandextendedsurface.cpp @@ -39,15 +39,15 @@ ** ****************************************************************************/ -#include "qwaylandextendedsurface.h" +#include "qwaylandextendedsurface_p.h" -#include "qwaylandwindow.h" +#include "qwaylandwindow_p.h" #include "wayland-client.h" -#include "qwaylanddisplay.h" +#include "qwaylanddisplay_p.h" -#include "qwaylandnativeinterface.h" +#include "qwaylandnativeinterface_p.h" #include #include diff --git a/src/plugins/platforms/wayland/qwaylandextendedsurface.h b/src/plugins/platforms/wayland/qwaylandextendedsurface_p.h similarity index 98% rename from src/plugins/platforms/wayland/qwaylandextendedsurface.h rename to src/plugins/platforms/wayland/qwaylandextendedsurface_p.h index 8c0546473a8..00b961d3816 100644 --- a/src/plugins/platforms/wayland/qwaylandextendedsurface.h +++ b/src/plugins/platforms/wayland/qwaylandextendedsurface_p.h @@ -45,7 +45,7 @@ #include #include -#include +#include #include #include diff --git a/src/plugins/platforms/wayland/qwaylandinputcontext.cpp b/src/plugins/platforms/wayland/qwaylandinputcontext.cpp index e9fb87179cd..8a711955e49 100644 --- a/src/plugins/platforms/wayland/qwaylandinputcontext.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputcontext.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include "qwaylandinputcontext.h" +#include "qwaylandinputcontext_p.h" #include #include @@ -46,9 +46,9 @@ #include #endif -#include "qwaylanddisplay.h" -#include "qwaylandinputdevice.h" -#include "qwaylandwindow.h" +#include "qwaylanddisplay_p.h" +#include "qwaylandinputdevice_p.h" +#include "qwaylandwindow_p.h" QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandinputcontext.h b/src/plugins/platforms/wayland/qwaylandinputcontext_p.h similarity index 100% rename from src/plugins/platforms/wayland/qwaylandinputcontext.h rename to src/plugins/platforms/wayland/qwaylandinputcontext_p.h diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index b9338b4c371..81bb0703ae8 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -39,16 +39,16 @@ ** ****************************************************************************/ -#include "qwaylandinputdevice.h" +#include "qwaylandinputdevice_p.h" -#include "qwaylandintegration.h" -#include "qwaylandwindow.h" -#include "qwaylandbuffer.h" -#include "qwaylanddatadevice.h" -#include "qwaylanddatadevicemanager.h" -#include "qwaylandtouch.h" -#include "qwaylandscreen.h" -#include "qwaylandcursor.h" +#include "qwaylandintegration_p.h" +#include "qwaylandwindow_p.h" +#include "qwaylandbuffer_p.h" +#include "qwaylanddatadevice_p.h" +#include "qwaylanddatadevicemanager_p.h" +#include "qwaylandtouch_p.h" +#include "qwaylandscreen_p.h" +#include "qwaylandcursor_p.h" #include #include diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.h b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h similarity index 99% rename from src/plugins/platforms/wayland/qwaylandinputdevice.h rename to src/plugins/platforms/wayland/qwaylandinputdevice_p.h index 641c8b84026..9e955f5d2b1 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.h +++ b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h @@ -42,7 +42,7 @@ #ifndef QWAYLANDINPUTDEVICE_H #define QWAYLANDINPUTDEVICE_H -#include +#include #include #include diff --git a/src/plugins/platforms/wayland/qwaylandintegration.cpp b/src/plugins/platforms/wayland/qwaylandintegration.cpp index 9acda2107f1..2e36a16da79 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandintegration.cpp @@ -39,16 +39,16 @@ ** ****************************************************************************/ -#include "qwaylandintegration.h" +#include "qwaylandintegration_p.h" -#include "qwaylanddisplay.h" -#include "qwaylandinputcontext.h" -#include "qwaylandshmbackingstore.h" -#include "qwaylandshmwindow.h" -#include "qwaylandnativeinterface.h" -#include "qwaylandclipboard.h" -#include "qwaylanddnd.h" -#include "qwaylandwindowmanagerintegration.h" +#include "qwaylanddisplay_p.h" +#include "qwaylandinputcontext_p.h" +#include "qwaylandshmbackingstore_p.h" +#include "qwaylandshmwindow_p.h" +#include "qwaylandnativeinterface_p.h" +#include "qwaylandclipboard_p.h" +#include "qwaylanddnd_p.h" +#include "qwaylandwindowmanagerintegration_p.h" #include "QtPlatformSupport/private/qgenericunixfontdatabase_p.h" #include @@ -65,12 +65,12 @@ #include #include -#include "qwaylandhardwareintegration.h" -#include "qwaylandclientbufferintegration.h" -#include "qwaylandclientbufferintegrationfactory.h" +#include "qwaylandhardwareintegration_p.h" +#include "qwaylandclientbufferintegration_p.h" +#include "qwaylandclientbufferintegrationfactory_p.h" -#include "qwaylandserverbufferintegration.h" -#include "qwaylandserverbufferintegrationfactory.h" +#include "qwaylandserverbufferintegration_p.h" +#include "qwaylandserverbufferintegrationfactory_p.h" QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandintegration.h b/src/plugins/platforms/wayland/qwaylandintegration_p.h similarity index 98% rename from src/plugins/platforms/wayland/qwaylandintegration.h rename to src/plugins/platforms/wayland/qwaylandintegration_p.h index bc51c23bb50..7c062c0eedf 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.h +++ b/src/plugins/platforms/wayland/qwaylandintegration_p.h @@ -44,7 +44,7 @@ #include -#include +#include QT_BEGIN_NAMESPACE class QWaylandBuffer; diff --git a/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp b/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp index 291f1711fb4..f8d95bb2550 100644 --- a/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp +++ b/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp @@ -39,13 +39,13 @@ ** ****************************************************************************/ -#include "qwaylandnativeinterface.h" -#include "qwaylanddisplay.h" -#include "qwaylandwindow.h" -#include "qwaylandextendedsurface.h" -#include "qwaylandintegration.h" -#include "qwaylanddisplay.h" -#include "qwaylandwindowmanagerintegration.h" +#include "qwaylandnativeinterface_p.h" +#include "qwaylanddisplay_p.h" +#include "qwaylandwindow_p.h" +#include "qwaylandextendedsurface_p.h" +#include "qwaylandintegration_p.h" +#include "qwaylanddisplay_p.h" +#include "qwaylandwindowmanagerintegration_p.h" #include #include diff --git a/src/plugins/platforms/wayland/qwaylandnativeinterface.h b/src/plugins/platforms/wayland/qwaylandnativeinterface_p.h similarity index 98% rename from src/plugins/platforms/wayland/qwaylandnativeinterface.h rename to src/plugins/platforms/wayland/qwaylandnativeinterface_p.h index bc080769397..b9ee2d0e87b 100644 --- a/src/plugins/platforms/wayland/qwaylandnativeinterface.h +++ b/src/plugins/platforms/wayland/qwaylandnativeinterface_p.h @@ -42,7 +42,7 @@ #ifndef QWAYLANDNATIVEINTERFACE_H #define QWAYLANDNATIVEINTERFACE_H -#include +#include #include #include diff --git a/src/plugins/platforms/wayland/qwaylandqtkey.cpp b/src/plugins/platforms/wayland/qwaylandqtkey.cpp index 6cc4597d9ee..a6b99cb42cb 100644 --- a/src/plugins/platforms/wayland/qwaylandqtkey.cpp +++ b/src/plugins/platforms/wayland/qwaylandqtkey.cpp @@ -39,8 +39,8 @@ ** ****************************************************************************/ -#include "qwaylandqtkey.h" -#include "qwaylandinputdevice.h" +#include "qwaylandqtkey_p.h" +#include "qwaylandinputdevice_p.h" QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandqtkey.h b/src/plugins/platforms/wayland/qwaylandqtkey_p.h similarity index 98% rename from src/plugins/platforms/wayland/qwaylandqtkey.h rename to src/plugins/platforms/wayland/qwaylandqtkey_p.h index 49563b78e01..a9c4e99fa75 100644 --- a/src/plugins/platforms/wayland/qwaylandqtkey.h +++ b/src/plugins/platforms/wayland/qwaylandqtkey_p.h @@ -42,7 +42,7 @@ #ifndef QWAYLANDQTKEY_H #define QWAYLANDQTKEY_H -#include +#include #include #include diff --git a/src/plugins/platforms/wayland/qwaylandscreen.cpp b/src/plugins/platforms/wayland/qwaylandscreen.cpp index cda94a7e162..416b320aa6a 100644 --- a/src/plugins/platforms/wayland/qwaylandscreen.cpp +++ b/src/plugins/platforms/wayland/qwaylandscreen.cpp @@ -39,11 +39,11 @@ ** ****************************************************************************/ -#include "qwaylandscreen.h" +#include "qwaylandscreen_p.h" -#include "qwaylanddisplay.h" -#include "qwaylandcursor.h" -#include "qwaylandextendedoutput.h" +#include "qwaylanddisplay_p.h" +#include "qwaylandcursor_p.h" +#include "qwaylandextendedoutput_p.h" #include diff --git a/src/plugins/platforms/wayland/qwaylandscreen.h b/src/plugins/platforms/wayland/qwaylandscreen_p.h similarity index 98% rename from src/plugins/platforms/wayland/qwaylandscreen.h rename to src/plugins/platforms/wayland/qwaylandscreen_p.h index 15ae5189a02..42408acf468 100644 --- a/src/plugins/platforms/wayland/qwaylandscreen.h +++ b/src/plugins/platforms/wayland/qwaylandscreen_p.h @@ -43,7 +43,7 @@ #define QWAYLANDSCREEN_H #include -#include +#include #include diff --git a/src/plugins/platforms/wayland/qwaylandshellsurface.cpp b/src/plugins/platforms/wayland/qwaylandshellsurface.cpp index 4c8ff1bc411..b7a819fd303 100644 --- a/src/plugins/platforms/wayland/qwaylandshellsurface.cpp +++ b/src/plugins/platforms/wayland/qwaylandshellsurface.cpp @@ -39,13 +39,13 @@ ** ****************************************************************************/ -#include "qwaylandshellsurface.h" +#include "qwaylandshellsurface_p.h" -#include "qwaylanddisplay.h" -#include "qwaylandwindow.h" -#include "qwaylandinputdevice.h" -#include "qwaylanddecoration.h" -#include "qwaylandscreen.h" +#include "qwaylanddisplay_p.h" +#include "qwaylandwindow_p.h" +#include "qwaylandinputdevice_p.h" +#include "qwaylanddecoration_p.h" +#include "qwaylandscreen_p.h" #include diff --git a/src/plugins/platforms/wayland/qwaylandshellsurface.h b/src/plugins/platforms/wayland/qwaylandshellsurface_p.h similarity index 98% rename from src/plugins/platforms/wayland/qwaylandshellsurface.h rename to src/plugins/platforms/wayland/qwaylandshellsurface_p.h index 25f70333434..2477c3f0889 100644 --- a/src/plugins/platforms/wayland/qwaylandshellsurface.h +++ b/src/plugins/platforms/wayland/qwaylandshellsurface_p.h @@ -47,7 +47,7 @@ #include #include -#include +#include QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp b/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp index 00a4b13a239..41f7da20093 100644 --- a/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp +++ b/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp @@ -38,14 +38,14 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -#include "qwaylandshmbackingstore.h" +#include "qwaylandshmbackingstore_p.h" #include -#include "qwaylanddisplay.h" -#include "qwaylandshmwindow.h" -#include "qwaylandscreen.h" -#include "qwaylanddecoration.h" +#include "qwaylanddisplay_p.h" +#include "qwaylandshmwindow_p.h" +#include "qwaylandscreen_p.h" +#include "qwaylanddecoration_p.h" #include diff --git a/src/plugins/platforms/wayland/qwaylandshmbackingstore.h b/src/plugins/platforms/wayland/qwaylandshmbackingstore_p.h similarity index 96% rename from src/plugins/platforms/wayland/qwaylandshmbackingstore.h rename to src/plugins/platforms/wayland/qwaylandshmbackingstore_p.h index b5ee3a38cb3..1affafabc2e 100644 --- a/src/plugins/platforms/wayland/qwaylandshmbackingstore.h +++ b/src/plugins/platforms/wayland/qwaylandshmbackingstore_p.h @@ -42,10 +42,10 @@ #ifndef QWAYLANDSHMBACKINGSTORE_H #define QWAYLANDSHMBACKINGSTORE_H -#include +#include -#include -#include +#include +#include #include #include diff --git a/src/plugins/platforms/wayland/qwaylandshmwindow.cpp b/src/plugins/platforms/wayland/qwaylandshmwindow.cpp index 48a1bfd533e..de87682ce70 100644 --- a/src/plugins/platforms/wayland/qwaylandshmwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandshmwindow.cpp @@ -39,9 +39,9 @@ ** ****************************************************************************/ -#include "qwaylandshmwindow.h" +#include "qwaylandshmwindow_p.h" -#include "qwaylandbuffer.h" +#include "qwaylandbuffer_p.h" #include diff --git a/src/plugins/platforms/wayland/qwaylandshmwindow.h b/src/plugins/platforms/wayland/qwaylandshmwindow_p.h similarity index 98% rename from src/plugins/platforms/wayland/qwaylandshmwindow.h rename to src/plugins/platforms/wayland/qwaylandshmwindow_p.h index f915c545f0e..83479f31303 100644 --- a/src/plugins/platforms/wayland/qwaylandshmwindow.h +++ b/src/plugins/platforms/wayland/qwaylandshmwindow_p.h @@ -42,7 +42,7 @@ #ifndef QWAYLANDSHMWINDOW_H #define QWAYLANDSHMWINDOW_H -#include +#include #include QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandsubsurface.cpp b/src/plugins/platforms/wayland/qwaylandsubsurface.cpp index 0e9d575a9d5..6db59fa206c 100644 --- a/src/plugins/platforms/wayland/qwaylandsubsurface.cpp +++ b/src/plugins/platforms/wayland/qwaylandsubsurface.cpp @@ -39,9 +39,9 @@ ** ****************************************************************************/ -#include "qwaylandsubsurface.h" +#include "qwaylandsubsurface_p.h" -#include "qwaylandwindow.h" +#include "qwaylandwindow_p.h" #include diff --git a/src/plugins/platforms/wayland/qwaylandsubsurface.h b/src/plugins/platforms/wayland/qwaylandsubsurface_p.h similarity index 97% rename from src/plugins/platforms/wayland/qwaylandsubsurface.h rename to src/plugins/platforms/wayland/qwaylandsubsurface_p.h index 97158b6aa37..bd0da96d214 100644 --- a/src/plugins/platforms/wayland/qwaylandsubsurface.h +++ b/src/plugins/platforms/wayland/qwaylandsubsurface_p.h @@ -46,7 +46,7 @@ #include -#include +#include #include diff --git a/src/plugins/platforms/wayland/qwaylandtouch.cpp b/src/plugins/platforms/wayland/qwaylandtouch.cpp index 5835d9d3cdc..db6d4b92d15 100644 --- a/src/plugins/platforms/wayland/qwaylandtouch.cpp +++ b/src/plugins/platforms/wayland/qwaylandtouch.cpp @@ -39,8 +39,8 @@ ** ****************************************************************************/ -#include "qwaylandtouch.h" -#include "qwaylandinputdevice.h" +#include "qwaylandtouch_p.h" +#include "qwaylandinputdevice_p.h" QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandtouch.h b/src/plugins/platforms/wayland/qwaylandtouch_p.h similarity index 98% rename from src/plugins/platforms/wayland/qwaylandtouch.h rename to src/plugins/platforms/wayland/qwaylandtouch_p.h index e6f57ab575c..c00c7c0d362 100644 --- a/src/plugins/platforms/wayland/qwaylandtouch.h +++ b/src/plugins/platforms/wayland/qwaylandtouch_p.h @@ -42,7 +42,7 @@ #ifndef QWAYLANDTOUCh_H #define QWAYLANDTOUCH_H -#include +#include #include #include diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index b64d3e6abeb..810239a7b7a 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -39,17 +39,17 @@ ** ****************************************************************************/ -#include "qwaylandwindow.h" +#include "qwaylandwindow_p.h" -#include "qwaylandbuffer.h" -#include "qwaylanddisplay.h" -#include "qwaylandinputdevice.h" -#include "qwaylandscreen.h" -#include "qwaylandshellsurface.h" -#include "qwaylandextendedsurface.h" -#include "qwaylandsubsurface.h" -#include "qwaylanddecoration.h" -#include "qwaylandwindowmanagerintegration.h" +#include "qwaylandbuffer_p.h" +#include "qwaylanddisplay_p.h" +#include "qwaylandinputdevice_p.h" +#include "qwaylandscreen_p.h" +#include "qwaylandshellsurface_p.h" +#include "qwaylandextendedsurface_p.h" +#include "qwaylandsubsurface_p.h" +#include "qwaylanddecoration_p.h" +#include "qwaylandwindowmanagerintegration_p.h" #include #include diff --git a/src/plugins/platforms/wayland/qwaylandwindow.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h similarity index 99% rename from src/plugins/platforms/wayland/qwaylandwindow.h rename to src/plugins/platforms/wayland/qwaylandwindow_p.h index 1f7344dc267..6078dab7f6e 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -48,7 +48,7 @@ #include -#include +#include #include diff --git a/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration.cpp b/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration.cpp index d396f14526b..9e8ce88c642 100644 --- a/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration.cpp @@ -39,9 +39,9 @@ ** ****************************************************************************/ -#include "qwaylandwindowmanagerintegration.h" -#include "qwaylandscreen.h" -#include "qwaylandwindow.h" +#include "qwaylandwindowmanagerintegration_p.h" +#include "qwaylandscreen_p.h" +#include "qwaylandwindow_p.h" #include #include diff --git a/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration.h b/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration_p.h similarity index 98% rename from src/plugins/platforms/wayland/qwaylandwindowmanagerintegration.h rename to src/plugins/platforms/wayland/qwaylandwindowmanagerintegration_p.h index 2164f4c8da4..8c8f3c32a0f 100644 --- a/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration.h +++ b/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration_p.h @@ -46,7 +46,7 @@ #include #include "wayland-client.h" -#include +#include #include #include From 6e0f6db11127faf269af3e1a21adb45972827e5a Mon Sep 17 00:00:00 2001 From: Giulio Camuffo Date: Thu, 26 Dec 2013 16:27:49 +0100 Subject: [PATCH 0083/1507] Improve key auto repeat behavior. Keep the repeat timer running when a key release is received if it is relative to another key. Make the repeat send the modifiers too. Change-Id: I7438502bf50cbe60d56b14bab17aa394367406cf Reviewed-by: Andy Nichols --- src/plugins/platforms/wayland/qwaylandinputdevice.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index 81bb0703ae8..0f0a6587eac 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -638,7 +638,7 @@ void QWaylandInputDevice::keyboard_key(uint32_t serial, uint32_t time, uint32_t mRepeatText = text; mRepeatTimer.setInterval(400); mRepeatTimer.start(); - } else { + } else if (mRepeatCode == code) { mRepeatTimer.stop(); } } @@ -648,7 +648,7 @@ void QWaylandInputDevice::repeatKey() mRepeatTimer.setInterval(25); QWindowSystemInterface::handleExtendedKeyEvent(mKeyboardFocus->window(), mRepeatTime, QEvent::KeyPress, mRepeatKey, - Qt::NoModifier, + modifiers(), mRepeatCode, 0, 0, mRepeatText); } From d156eae3c530c5012ff0125b06b434d42edd3b33 Mon Sep 17 00:00:00 2001 From: Jorgen Lind Date: Fri, 3 Jan 2014 17:10:21 +0100 Subject: [PATCH 0084/1507] Add a size to the QWaylandServerBuffer on the client side Change-Id: I48b7d514c1231eb4bd4a30f1329a89515b497269 Reviewed-by: Laszlo Agocs --- .../qwaylandserverbufferintegration.cpp | 15 ++++++++++----- .../qwaylandserverbufferintegration_p.h | 7 +++++-- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegration.cpp b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegration.cpp index ee64624ada7..6e3abe913f4 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegration.cpp +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegration.cpp @@ -11,6 +11,16 @@ QWaylandServerBuffer::~QWaylandServerBuffer() { } +QWaylandServerBuffer::Format QWaylandServerBuffer::format() const +{ + return m_format; +} + +QSize QWaylandServerBuffer::size() const +{ + return m_size; +} + void QWaylandServerBuffer::setUserData(void *userData) { m_user_data = userData; @@ -21,11 +31,6 @@ void *QWaylandServerBuffer::userData() const return m_user_data; } -QWaylandServerBuffer::Format QWaylandServerBuffer::format() const -{ - return m_format; -} - QWaylandServerBufferIntegration::QWaylandServerBufferIntegration() { } diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegration_p.h b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegration_p.h index 7241aec1f91..79e7cdf2a50 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegration_p.h +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegration_p.h @@ -42,6 +42,7 @@ #ifndef QWAYLANDSERVERBUFFERINTEGRATION_H #define QWAYLANDSERVERBUFFERINTEGRATION_H +#include #include #include @@ -65,13 +66,15 @@ public: //creates new texture for buffer virtual GLuint createTexture() = 0; + Format format() const; + QSize size() const; + void setUserData(void *userData); void *userData() const; - Format format() const; - protected: Format m_format; + QSize m_size; private: void *m_user_data; From 2d3a63fb52bf0a5cb22a7be1ff1f4c77f135d6e9 Mon Sep 17 00:00:00 2001 From: Jorgen Lind Date: Fri, 20 Dec 2013 14:34:16 +0100 Subject: [PATCH 0085/1507] update DrmEglServerIntegration to handle experimental 8 bit support Change-Id: I8fa4ecf8b0848ca681f944a5fa56a4f6bb0a76be Reviewed-by: Laszlo Agocs --- ...-Add-a-EGL_DRM_BUFFER_FORMAT_A8_MESA.patch | 112 ++++++++++++++++++ 1 file changed, 112 insertions(+) create mode 100644 src/3rdparty/wayland/patches/0001-Add-a-EGL_DRM_BUFFER_FORMAT_A8_MESA.patch diff --git a/src/3rdparty/wayland/patches/0001-Add-a-EGL_DRM_BUFFER_FORMAT_A8_MESA.patch b/src/3rdparty/wayland/patches/0001-Add-a-EGL_DRM_BUFFER_FORMAT_A8_MESA.patch new file mode 100644 index 00000000000..46fac714496 --- /dev/null +++ b/src/3rdparty/wayland/patches/0001-Add-a-EGL_DRM_BUFFER_FORMAT_A8_MESA.patch @@ -0,0 +1,112 @@ +From 52dbed7516b79459d1c8f2ed3ea4a5e71734c969 Mon Sep 17 00:00:00 2001 +From: Jorgen Lind +Date: Thu, 2 Jan 2014 12:28:54 +0100 +Subject: [PATCH] Add a EGL_DRM_BUFFER_FORMAT_A8_MESA + +This is to allow us to share A8 DRM buffers between processes +--- + include/EGL/eglext.h | 1 + + include/GL/internal/dri_interface.h | 1 + + src/egl/drivers/dri2/egl_dri2.c | 7 +++++++ + src/mesa/drivers/dri/i915/intel_screen.c | 5 +++++ + src/mesa/drivers/dri/i965/intel_screen.c | 5 +++++ + 5 files changed, 19 insertions(+) + +diff --git a/include/EGL/eglext.h b/include/EGL/eglext.h +index 1d68178..6c4fb7e 100644 +--- a/include/EGL/eglext.h ++++ b/include/EGL/eglext.h +@@ -271,6 +271,7 @@ typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATEPIXMAPSURFACEHIPROC) (EGLDisplay dp + #define EGL_DRM_BUFFER_FORMAT_MESA 0x31D0 /* CreateDRMImageMESA attribute */ + #define EGL_DRM_BUFFER_USE_MESA 0x31D1 /* CreateDRMImageMESA attribute */ + #define EGL_DRM_BUFFER_FORMAT_ARGB32_MESA 0x31D2 /* EGL_IMAGE_FORMAT_MESA attribute value */ ++#define EGL_DRM_BUFFER_FORMAT_A8_MESA 0x31D5 /* EGL_IMAGE_FORMAT_MESA attribute value */ + #define EGL_DRM_BUFFER_MESA 0x31D3 /* eglCreateImageKHR target */ + #define EGL_DRM_BUFFER_STRIDE_MESA 0x31D4 + #define EGL_DRM_BUFFER_USE_SCANOUT_MESA 0x00000001 /* EGL_DRM_BUFFER_USE_MESA bits */ +diff --git a/include/GL/internal/dri_interface.h b/include/GL/internal/dri_interface.h +index 5c99d55..565f1fb 100644 +--- a/include/GL/internal/dri_interface.h ++++ b/include/GL/internal/dri_interface.h +@@ -964,6 +964,7 @@ struct __DRIdri2ExtensionRec { + #define __DRI_IMAGE_FORMAT_R8 0x1006 /* Since version 5 */ + #define __DRI_IMAGE_FORMAT_GR88 0x1007 + #define __DRI_IMAGE_FORMAT_NONE 0x1008 ++#define __DRI_IMAGE_FORMAT_A8 0x1009 /* Patch */ + + #define __DRI_IMAGE_USE_SHARE 0x0001 + #define __DRI_IMAGE_USE_SCANOUT 0x0002 +diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c +index a8584b7..1cb6967 100644 +--- a/src/egl/drivers/dri2/egl_dri2.c ++++ b/src/egl/drivers/dri2/egl_dri2.c +@@ -1152,6 +1152,10 @@ dri2_create_image_mesa_drm_buffer(_EGLDisplay *disp, _EGLContext *ctx, + format = __DRI_IMAGE_FORMAT_ARGB8888; + pitch = attrs.DRMBufferStrideMESA; + break; ++ case EGL_DRM_BUFFER_FORMAT_A8_MESA: ++ format = __DRI_IMAGE_FORMAT_A8; ++ pitch = attrs.DRMBufferStrideMESA; ++ break; + default: + _eglError(EGL_BAD_PARAMETER, + "dri2_create_image_khr: unsupported pixmap depth"); +@@ -1427,6 +1431,9 @@ dri2_create_drm_image_mesa(_EGLDriver *drv, _EGLDisplay *disp, + case EGL_DRM_BUFFER_FORMAT_ARGB32_MESA: + format = __DRI_IMAGE_FORMAT_ARGB8888; + break; ++ case EGL_DRM_BUFFER_FORMAT_A8_MESA: ++ format = __DRI_IMAGE_FORMAT_A8; ++ break; + default: + _eglLog(_EGL_WARNING, "bad image format value 0x%04x", + attrs.DRMBufferFormatMESA); +diff --git a/src/mesa/drivers/dri/i915/intel_screen.c b/src/mesa/drivers/dri/i915/intel_screen.c +index 30a867e..3e1909b 100644 +--- a/src/mesa/drivers/dri/i915/intel_screen.c ++++ b/src/mesa/drivers/dri/i915/intel_screen.c +@@ -261,6 +261,9 @@ intel_allocate_image(int dri_format, void *loaderPrivate) + case __DRI_IMAGE_FORMAT_R8: + image->format = MESA_FORMAT_R8; + break; ++ case __DRI_IMAGE_FORMAT_A8: ++ image->format = MESA_FORMAT_A8; ++ break; + case __DRI_IMAGE_FORMAT_GR88: + image->format = MESA_FORMAT_GR88; + break; +@@ -330,6 +333,8 @@ intel_dri_format(GLuint format) + return __DRI_IMAGE_FORMAT_ABGR8888; + case MESA_FORMAT_R8: + return __DRI_IMAGE_FORMAT_R8; ++ case MESA_FORMAT_A8: ++ return __DRI_IMAGE_FORMAT_A8; + case MESA_FORMAT_RG88: + return __DRI_IMAGE_FORMAT_GR88; + } +diff --git a/src/mesa/drivers/dri/i965/intel_screen.c b/src/mesa/drivers/dri/i965/intel_screen.c +index f913c42..68ee33b 100644 +--- a/src/mesa/drivers/dri/i965/intel_screen.c ++++ b/src/mesa/drivers/dri/i965/intel_screen.c +@@ -262,6 +262,9 @@ intel_allocate_image(int dri_format, void *loaderPrivate) + case __DRI_IMAGE_FORMAT_R8: + image->format = MESA_FORMAT_R8; + break; ++ case __DRI_IMAGE_FORMAT_A8: ++ image->format = MESA_FORMAT_A8; ++ break; + case __DRI_IMAGE_FORMAT_GR88: + image->format = MESA_FORMAT_GR88; + break; +@@ -334,6 +337,8 @@ intel_dri_format(GLuint format) + return __DRI_IMAGE_FORMAT_ABGR8888; + case MESA_FORMAT_R8: + return __DRI_IMAGE_FORMAT_R8; ++ case MESA_FORMAT_A8: ++ return __DRI_IMAGE_FORMAT_A8; + case MESA_FORMAT_RG88: + return __DRI_IMAGE_FORMAT_GR88; + } +-- +1.8.5.1 + From 40aff4d33c05f348aa55d64c73d78b856a13c345 Mon Sep 17 00:00:00 2001 From: Jorgen Lind Date: Mon, 6 Jan 2014 10:10:00 +0100 Subject: [PATCH 0086/1507] Config test for drm_egl_server Change-Id: Ib0ae4683374c2fd0c7386863ffb3c207605dc1e2 Reviewed-by: Jan Arne Petersen Reviewed-by: Laszlo Agocs --- .../wayland/plugins/hardwareintegration/client.pro | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/client.pro b/src/plugins/platforms/wayland/plugins/hardwareintegration/client.pro index 0b1191919a9..1d79b2634d0 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/client.pro +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/client.pro @@ -14,6 +14,6 @@ config_xcomposite { SUBDIRS += xcomposite-glx } -# we should try and resolve all symbols -# and they should be type deffed if not present -SUBDIRS += drm-egl-server +config_drm_egl_server: \ + SUBDIRS += drm-egl-server + From 1f8631a1b1f7a74ecb97647127f0a9c2944c5800 Mon Sep 17 00:00:00 2001 From: Giulio Camuffo Date: Sun, 29 Dec 2013 12:06:58 +0100 Subject: [PATCH 0087/1507] Move the code for seat's keyboard, pointer and touch in different classes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This allows to remove the keyboard, pointer or touch objects when the wl_seat advertizes it is gone. Also fixes multiple keyboard, pointer and touch binding for the same object. Change-Id: I878f494caf7f4ac277b6a4d24037dcecf9ff84e4 Reviewed-by: Jørgen Lind Reviewed-by: Laszlo Agocs --- .../platforms/wayland/qwaylandinputdevice.cpp | 428 ++++++++++++------ .../platforms/wayland/qwaylandinputdevice_p.h | 86 +--- .../platforms/wayland/qwaylandqtkey.cpp | 2 +- .../platforms/wayland/qwaylandtouch.cpp | 6 +- 4 files changed, 304 insertions(+), 218 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index 0f0a6587eac..34eedb21ea8 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -69,49 +69,167 @@ QT_BEGIN_NAMESPACE +class QWaylandInputDevice::Keyboard : public QtWayland::wl_keyboard +{ +public: + Keyboard(QWaylandInputDevice *p) + : mParent(p) + , mFocus(0) +#ifndef QT_NO_WAYLAND_XKB + , mXkbContext(0) + , mXkbMap(0) + , mXkbState(0) +#endif + , mFocusCallback(0) + { +#ifndef QT_NO_WAYLAND_XKB + xkb_rule_names names; + names.rules = strdup("evdev"); + names.model = strdup("pc105"); + names.layout = strdup("us"); + names.variant = strdup(""); + names.options = strdup(""); + + mXkbContext = xkb_context_new(xkb_context_flags(0)); + if (mXkbContext) { + mXkbMap = xkb_map_new_from_names(mXkbContext, &names, xkb_map_compile_flags(0)); + if (mXkbMap) { + mXkbState = xkb_state_new(mXkbMap); + } + } + + if (!mXkbContext || !mXkbMap || !mXkbState) + qWarning() << "xkb_map_new_from_names failed, no key input"; +#endif + } + ~Keyboard() + { +#ifndef QT_NO_WAYLAND_XKB + if (mXkbState) + xkb_state_unref(mXkbState); + if (mXkbMap) + xkb_map_unref(mXkbMap); + if (mXkbContext) + xkb_context_unref(mXkbContext); +#endif + } + + void keyboard_keymap(uint32_t format, + int32_t fd, + uint32_t size) Q_DECL_OVERRIDE; + void keyboard_enter(uint32_t time, + struct wl_surface *surface, + struct wl_array *keys) Q_DECL_OVERRIDE; + void keyboard_leave(uint32_t time, + struct wl_surface *surface) Q_DECL_OVERRIDE; + void keyboard_key(uint32_t serial, uint32_t time, + uint32_t key, uint32_t state) Q_DECL_OVERRIDE; + void keyboard_modifiers(uint32_t serial, + uint32_t mods_depressed, + uint32_t mods_latched, + uint32_t mods_locked, + uint32_t group) Q_DECL_OVERRIDE; + + QWaylandInputDevice *mParent; + QWaylandWindow *mFocus; +#ifndef QT_NO_WAYLAND_XKB + xkb_context *mXkbContext; + xkb_keymap *mXkbMap; + xkb_state *mXkbState; +#endif + struct wl_callback *mFocusCallback; + + int mRepeatKey; + uint32_t mRepeatCode; + uint32_t mRepeatTime; + QString mRepeatText; + + static const wl_callback_listener callback; + static void focusCallback(void *data, struct wl_callback *callback, uint32_t time); +}; + +class QWaylandInputDevice::Pointer : public QtWayland::wl_pointer +{ +public: + Pointer(QWaylandInputDevice *p) + : mParent(p) + , mFocus(0) + , mEnterSerial(0) + , mCursorSerial(0) + , mButtons(0) + { + } + ~Pointer() + { + } + + void pointer_enter(uint32_t serial, struct wl_surface *surface, + wl_fixed_t sx, wl_fixed_t sy) Q_DECL_OVERRIDE; + void pointer_leave(uint32_t time, struct wl_surface *surface); + void pointer_motion(uint32_t time, + wl_fixed_t sx, wl_fixed_t sy) Q_DECL_OVERRIDE; + void pointer_button(uint32_t serial, uint32_t time, + uint32_t button, uint32_t state) Q_DECL_OVERRIDE; + void pointer_axis(uint32_t time, + uint32_t axis, + wl_fixed_t value) Q_DECL_OVERRIDE; + + QWaylandInputDevice *mParent; + QWaylandWindow *mFocus; + uint32_t mEnterSerial; + uint32_t mCursorSerial; + QPointF mSurfacePos; + QPointF mGlobalPos; + Qt::MouseButtons mButtons; +}; + +class QWaylandInputDevice::Touch : public QtWayland::wl_touch +{ +public: + Touch(QWaylandInputDevice *p) + : mParent(p) + , mFocus(0) + { + } + ~Touch() + { + } + + void touch_down(uint32_t serial, + uint32_t time, + struct wl_surface *surface, + int32_t id, + wl_fixed_t x, + wl_fixed_t y) Q_DECL_OVERRIDE; + void touch_up(uint32_t serial, + uint32_t time, + int32_t id) Q_DECL_OVERRIDE; + void touch_motion(uint32_t time, + int32_t id, + wl_fixed_t x, + wl_fixed_t y) Q_DECL_OVERRIDE; + void touch_frame() Q_DECL_OVERRIDE; + void touch_cancel() Q_DECL_OVERRIDE; + + QWaylandInputDevice *mParent; + QWaylandWindow *mFocus; + QList mTouchPoints; + QList mPrevTouchPoints; +}; + QWaylandInputDevice::QWaylandInputDevice(QWaylandDisplay *display, uint32_t id) : QObject() , QtWayland::wl_seat(display->wl_registry(), id) , mQDisplay(display) , mDisplay(display->wl_display()) - , mFocusCallback(0) , mCaps(0) , mDataDevice(0) - , mPointerFocus(0) - , mKeyboardFocus(0) - , mTouchFocus(0) - , mButtons(0) + , mKeyboard(0) + , mPointer(0) + , mTouch(0) , mTime(0) , mSerial(0) - , mEnterSerial(0) - , mCursorSerial(0) - , mTouchDevice(0) - #ifndef QT_NO_WAYLAND_XKB - , mXkbContext(0) - , mXkbMap(0) - , mXkbState(0) - #endif { -#ifndef QT_NO_WAYLAND_XKB - xkb_rule_names names; - names.rules = strdup("evdev"); - names.model = strdup("pc105"); - names.layout = strdup("us"); - names.variant = strdup(""); - names.options = strdup(""); - - mXkbContext = xkb_context_new(xkb_context_flags(0)); - if (mXkbContext) { - mXkbMap = xkb_map_new_from_names(mXkbContext, &names, xkb_map_compile_flags(0)); - if (mXkbMap) { - mXkbState = xkb_state_new(mXkbMap); - } - } - - if (!mXkbContext || !mXkbMap || !mXkbState) - qWarning() << "xkb_map_new_from_names failed, no key input"; -#endif - if (mQDisplay->dndSelectionHandler()) { mDataDevice = mQDisplay->dndSelectionHandler()->getDataDevice(this); } @@ -121,30 +239,36 @@ QWaylandInputDevice::QWaylandInputDevice(QWaylandDisplay *display, uint32_t id) QWaylandInputDevice::~QWaylandInputDevice() { -#ifndef QT_NO_WAYLAND_XKB - if (mXkbState) - xkb_state_unref(mXkbState); - if (mXkbMap) - xkb_map_unref(mXkbMap); - if (mXkbContext) - xkb_context_unref(mXkbContext); -#endif + delete mPointer; + delete mKeyboard; + delete mTouch; } void QWaylandInputDevice::seat_capabilities(uint32_t caps) { mCaps = caps; - if (caps & WL_SEAT_CAPABILITY_KEYBOARD) - QtWayland::wl_keyboard::init(get_keyboard()); - - if (caps & WL_SEAT_CAPABILITY_POINTER) { - QtWayland::wl_pointer::init(get_pointer()); - pointerSurface = mQDisplay->createSurface(this); + if (caps & WL_SEAT_CAPABILITY_KEYBOARD && !mKeyboard) { + mKeyboard = new Keyboard(this); + mKeyboard->init(get_keyboard()); + } else if (!(caps & WL_SEAT_CAPABILITY_KEYBOARD) && mKeyboard) { + delete mKeyboard; + mKeyboard = 0; + mRepeatTimer.stop(); } - if (caps & WL_SEAT_CAPABILITY_TOUCH) { - QtWayland::wl_touch::init(get_touch()); + if (caps & WL_SEAT_CAPABILITY_POINTER && !mPointer) { + mPointer = new Pointer(this); + mPointer->init(get_pointer()); + pointerSurface = mQDisplay->createSurface(this); + } else if (!(caps & WL_SEAT_CAPABILITY_POINTER) && mPointer) { + delete mPointer; + mPointer = 0; + } + + if (caps & WL_SEAT_CAPABILITY_TOUCH && !mTouch) { + mTouch = new Touch(this); + mTouch->init(get_touch()); if (!mTouchDevice) { mTouchDevice = new QTouchDevice; @@ -152,15 +276,18 @@ void QWaylandInputDevice::seat_capabilities(uint32_t caps) mTouchDevice->setCapabilities(QTouchDevice::Position); QWindowSystemInterface::registerTouchDevice(mTouchDevice); } + } else if (!(caps & WL_SEAT_CAPABILITY_TOUCH) && mTouch) { + delete mTouch; + mTouch = 0; } } void QWaylandInputDevice::handleWindowDestroyed(QWaylandWindow *window) { - if (window == mPointerFocus) - mPointerFocus = 0; - if (window == mKeyboardFocus) { - mKeyboardFocus = 0; + if (mPointer && window == mPointer->mFocus) + mPointer->mFocus = 0; + if (mKeyboard && window == mKeyboard->mFocus) { + mKeyboard->mFocus = 0; mRepeatTimer.stop(); } } @@ -178,36 +305,57 @@ QWaylandDataDevice *QWaylandInputDevice::dataDevice() const void QWaylandInputDevice::removeMouseButtonFromState(Qt::MouseButton button) { - mButtons = mButtons & !button; + if (mPointer) + mPointer->mButtons = mPointer->mButtons & !button; } QWaylandWindow *QWaylandInputDevice::pointerFocus() const { - return mPointerFocus; + return mPointer ? mPointer->mFocus : 0; +} + +QWaylandWindow *QWaylandInputDevice::keyboardFocus() const +{ + return mKeyboard ? mKeyboard->mFocus : 0; +} + +QWaylandWindow *QWaylandInputDevice::touchFocus() const +{ + return mTouch ? mTouch->mFocus : 0; } Qt::KeyboardModifiers QWaylandInputDevice::modifiers() const { + if (!mKeyboard) + return Qt::NoModifier; + Qt::KeyboardModifiers ret = Qt::NoModifier; #ifndef QT_NO_WAYLAND_XKB xkb_state_component cstate = static_cast(XKB_STATE_DEPRESSED | XKB_STATE_LATCHED); - if (xkb_state_mod_name_is_active(mXkbState, "Shift", cstate)) + if (xkb_state_mod_name_is_active(mKeyboard->mXkbState, "Shift", cstate)) ret |= Qt::ShiftModifier; - if (xkb_state_mod_name_is_active(mXkbState, "Control", cstate)) + if (xkb_state_mod_name_is_active(mKeyboard->mXkbState, "Control", cstate)) ret |= Qt::ControlModifier; - if (xkb_state_mod_name_is_active(mXkbState, "Alt", cstate)) + if (xkb_state_mod_name_is_active(mKeyboard->mXkbState, "Alt", cstate)) ret |= Qt::AltModifier; - if (xkb_state_mod_name_is_active(mXkbState, "Mod1", cstate)) + if (xkb_state_mod_name_is_active(mKeyboard->mXkbState, "Mod1", cstate)) ret |= Qt::AltModifier; - if (xkb_state_mod_name_is_active(mXkbState, "Mod4", cstate)) + if (xkb_state_mod_name_is_active(mKeyboard->mXkbState, "Mod4", cstate)) ret |= Qt::MetaModifier; #endif return ret; } +uint32_t QWaylandInputDevice::cursorSerial() const +{ + if (mPointer) + return mPointer->mCursorSerial; + return 0; +} + void QWaylandInputDevice::setCursor(Qt::CursorShape newShape, QWaylandScreen *screen) { struct wl_cursor_image *image = screen->waylandCursor()->cursorImage(newShape); @@ -222,24 +370,24 @@ void QWaylandInputDevice::setCursor(Qt::CursorShape newShape, QWaylandScreen *sc void QWaylandInputDevice::setCursor(struct wl_buffer *buffer, struct wl_cursor_image *image) { if (mCaps & WL_SEAT_CAPABILITY_POINTER) { - mCursorSerial = mEnterSerial; + mPointer->mCursorSerial = mPointer->mEnterSerial; /* Hide cursor */ if (!buffer) { - set_cursor(mEnterSerial, NULL, 0, 0); + mPointer->set_cursor(mPointer->mEnterSerial, NULL, 0, 0); return; } - set_cursor(mEnterSerial, pointerSurface, - image->hotspot_x, image->hotspot_y); + mPointer->set_cursor(mPointer->mEnterSerial, pointerSurface, + image->hotspot_x, image->hotspot_y); wl_surface_attach(pointerSurface, buffer, 0, 0); wl_surface_damage(pointerSurface, 0, 0, image->width, image->height); wl_surface_commit(pointerSurface); } } -void QWaylandInputDevice::pointer_enter(uint32_t serial, struct wl_surface *surface, - wl_fixed_t sx, wl_fixed_t sy) +void QWaylandInputDevice::Pointer::pointer_enter(uint32_t serial, struct wl_surface *surface, + wl_fixed_t sx, wl_fixed_t sy) { Q_UNUSED(sx); Q_UNUSED(sy); @@ -250,20 +398,20 @@ void QWaylandInputDevice::pointer_enter(uint32_t serial, struct wl_surface *surf QWaylandWindow *window = QWaylandWindow::fromWlSurface(surface); window->window()->setCursor(window->window()->cursor()); - mPointerFocus = window; + mFocus = window; - mTime = QWaylandDisplay::currentTimeMillisec(); - mSerial = serial; + mParent->mTime = QWaylandDisplay::currentTimeMillisec(); + mParent->mSerial = serial; mEnterSerial = serial; QWaylandWindow *grab = QWaylandWindow::mouseGrab(); if (!grab) { - window->handleMouseEnter(this); - window->handleMouse(this, mTime, mSurfacePos, mGlobalPos, mButtons, Qt::NoModifier); + window->handleMouseEnter(mParent); + window->handleMouse(mParent, mParent->mTime, mSurfacePos, mGlobalPos, mButtons, Qt::NoModifier); } } -void QWaylandInputDevice::pointer_leave(uint32_t time, struct wl_surface *surface) +void QWaylandInputDevice::Pointer::pointer_leave(uint32_t time, struct wl_surface *surface) { // The event may arrive after destroying the window, indicated by // a null surface. @@ -272,20 +420,20 @@ void QWaylandInputDevice::pointer_leave(uint32_t time, struct wl_surface *surfac if (!QWaylandWindow::mouseGrab()) { QWaylandWindow *window = QWaylandWindow::fromWlSurface(surface); - window->handleMouseLeave(this); + window->handleMouseLeave(mParent); } - mPointerFocus = 0; + mFocus = 0; mButtons = Qt::NoButton; - mTime = time; + mParent->mTime = time; } -void QWaylandInputDevice::pointer_motion(uint32_t time, wl_fixed_t surface_x, wl_fixed_t surface_y) +void QWaylandInputDevice::Pointer::pointer_motion(uint32_t time, wl_fixed_t surface_x, wl_fixed_t surface_y) { Q_UNUSED(surface_x); Q_UNUSED(surface_y); - QWaylandWindow *window = mPointerFocus; + QWaylandWindow *window = mFocus; if (window == NULL) { // We destroyed the pointer focus surface, but the server @@ -300,7 +448,7 @@ void QWaylandInputDevice::pointer_motion(uint32_t time, wl_fixed_t surface_x, wl mSurfacePos = pos; mGlobalPos = global; - mTime = time; + mParent->mTime = time; QWaylandWindow *grab = QWaylandWindow::mouseGrab(); if (grab && grab != window) { @@ -308,16 +456,16 @@ void QWaylandInputDevice::pointer_motion(uint32_t time, wl_fixed_t surface_x, wl // so we just set it outside of the window boundaries. pos = QPointF(-1, -1); global = grab->window()->mapToGlobal(pos.toPoint()); - grab->handleMouse(this, time, pos, global, mButtons, Qt::NoModifier); + grab->handleMouse(mParent, time, pos, global, mButtons, Qt::NoModifier); } else - window->handleMouse(this, time, mSurfacePos, mGlobalPos, mButtons, Qt::NoModifier); + window->handleMouse(mParent, time, mSurfacePos, mGlobalPos, mButtons, Qt::NoModifier); } -void QWaylandInputDevice::pointer_button(uint32_t serial, uint32_t time, - uint32_t button, uint32_t state) +void QWaylandInputDevice::Pointer::pointer_button(uint32_t serial, uint32_t time, + uint32_t button, uint32_t state) { Q_UNUSED(serial); - QWaylandWindow *window = mPointerFocus; + QWaylandWindow *window = mFocus; Qt::MouseButton qt_button; // translate from kernel (input.h) 'button' to corresponding Qt:MouseButton. @@ -347,21 +495,21 @@ void QWaylandInputDevice::pointer_button(uint32_t serial, uint32_t time, else mButtons &= ~qt_button; - mTime = time; - mSerial = serial; + mParent->mTime = time; + mParent->mSerial = serial; QWaylandWindow *grab = QWaylandWindow::mouseGrab(); - if (grab && grab != mPointerFocus) { + if (grab && grab != mFocus) { QPointF pos = QPointF(-1, -1); QPointF global = grab->window()->mapToGlobal(pos.toPoint()); - grab->handleMouse(this, time, pos, global, mButtons, Qt::NoModifier); + grab->handleMouse(mParent, time, pos, global, mButtons, Qt::NoModifier); } else if (window) - window->handleMouse(this, time, mSurfacePos, mGlobalPos, mButtons, Qt::NoModifier); + window->handleMouse(mParent, time, mSurfacePos, mGlobalPos, mButtons, Qt::NoModifier); } -void QWaylandInputDevice::pointer_axis(uint32_t time, uint32_t axis, int32_t value) +void QWaylandInputDevice::Pointer::pointer_axis(uint32_t time, uint32_t axis, int32_t value) { - QWaylandWindow *window = mPointerFocus; + QWaylandWindow *window = mFocus; QPoint pixelDelta; QPoint angleDelta; @@ -502,7 +650,7 @@ static int keysymToQtKey(xkb_keysym_t keysym, Qt::KeyboardModifiers &modifiers, #endif // QT_NO_WAYLAND_XKB -void QWaylandInputDevice::keyboard_keymap(uint32_t format, int32_t fd, uint32_t size) +void QWaylandInputDevice::Keyboard::keyboard_keymap(uint32_t format, int32_t fd, uint32_t size) { #ifndef QT_NO_WAYLAND_XKB if (format != WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1) { @@ -528,7 +676,7 @@ void QWaylandInputDevice::keyboard_keymap(uint32_t format, int32_t fd, uint32_t #endif } -void QWaylandInputDevice::keyboard_enter(uint32_t time, struct wl_surface *surface, struct wl_array *keys) +void QWaylandInputDevice::Keyboard::keyboard_enter(uint32_t time, struct wl_surface *surface, struct wl_array *keys) { Q_UNUSED(time); Q_UNUSED(keys); @@ -538,53 +686,53 @@ void QWaylandInputDevice::keyboard_enter(uint32_t time, struct wl_surface *surfa QWaylandWindow *window = QWaylandWindow::fromWlSurface(surface); - mKeyboardFocus = window; + mFocus = window; if (!mFocusCallback) { - mFocusCallback = wl_display_sync(mDisplay); - wl_callback_add_listener(mFocusCallback, &QWaylandInputDevice::callback, this); + mFocusCallback = wl_display_sync(mParent->mDisplay); + wl_callback_add_listener(mFocusCallback, &QWaylandInputDevice::Keyboard::callback, this); } } -void QWaylandInputDevice::keyboard_leave(uint32_t time, struct wl_surface *surface) +void QWaylandInputDevice::Keyboard::keyboard_leave(uint32_t time, struct wl_surface *surface) { Q_UNUSED(time); Q_UNUSED(surface); - mKeyboardFocus = NULL; + mFocus = NULL; // Use a callback to set the focus because we may get a leave/enter pair, and // the latter one would be lost in the QWindowSystemInterface queue, if // we issue the handleWindowActivated() calls immediately. if (!mFocusCallback) { - mFocusCallback = wl_display_sync(mDisplay); - wl_callback_add_listener(mFocusCallback, &QWaylandInputDevice::callback, this); + mFocusCallback = wl_display_sync(mParent->mDisplay); + wl_callback_add_listener(mFocusCallback, &QWaylandInputDevice::Keyboard::callback, this); } - mRepeatTimer.stop(); + mParent->mRepeatTimer.stop(); } -const wl_callback_listener QWaylandInputDevice::callback = { - QWaylandInputDevice::focusCallback +const wl_callback_listener QWaylandInputDevice::Keyboard::callback = { + QWaylandInputDevice::Keyboard::focusCallback }; -void QWaylandInputDevice::focusCallback(void *data, struct wl_callback *callback, uint32_t time) +void QWaylandInputDevice::Keyboard::focusCallback(void *data, struct wl_callback *callback, uint32_t time) { Q_UNUSED(time); Q_UNUSED(callback); - QWaylandInputDevice *self = static_cast(data); + QWaylandInputDevice::Keyboard *self = static_cast(data); if (self->mFocusCallback) { wl_callback_destroy(self->mFocusCallback); self->mFocusCallback = 0; } - self->mQDisplay->setLastKeyboardFocusInputDevice(self->mKeyboardFocus ? self : 0); - QWindowSystemInterface::handleWindowActivated(self->mKeyboardFocus ? self->mKeyboardFocus->window() : 0); + self->mParent->mQDisplay->setLastKeyboardFocusInputDevice(self->mFocus ? self->mParent : 0); + QWindowSystemInterface::handleWindowActivated(self->mFocus ? self->mFocus->window() : 0); } -void QWaylandInputDevice::keyboard_key(uint32_t serial, uint32_t time, uint32_t key, uint32_t state) +void QWaylandInputDevice::Keyboard::keyboard_key(uint32_t serial, uint32_t time, uint32_t key, uint32_t state) { Q_UNUSED(serial); - QWaylandWindow *window = mKeyboardFocus; + QWaylandWindow *window = mFocus; #ifndef QT_NO_WAYLAND_XKB if (!mXkbMap) return; @@ -608,7 +756,7 @@ void QWaylandInputDevice::keyboard_key(uint32_t serial, uint32_t time, uint32_t if (numSyms == 1) { xkb_keysym_t sym = syms[0]; - Qt::KeyboardModifiers modifiers = this->modifiers(); + Qt::KeyboardModifiers modifiers = mParent->modifiers(); uint utf32 = xkb_keysym_to_utf32(sym); text = QString::fromUcs4(&utf32, 1); @@ -636,23 +784,23 @@ void QWaylandInputDevice::keyboard_key(uint32_t serial, uint32_t time, uint32_t mRepeatCode = code; mRepeatTime = time; mRepeatText = text; - mRepeatTimer.setInterval(400); - mRepeatTimer.start(); + mParent->mRepeatTimer.setInterval(400); + mParent->mRepeatTimer.start(); } else if (mRepeatCode == code) { - mRepeatTimer.stop(); + mParent->mRepeatTimer.stop(); } } void QWaylandInputDevice::repeatKey() { mRepeatTimer.setInterval(25); - QWindowSystemInterface::handleExtendedKeyEvent(mKeyboardFocus->window(), - mRepeatTime, QEvent::KeyPress, mRepeatKey, + QWindowSystemInterface::handleExtendedKeyEvent(mKeyboard->mFocus->window(), + mKeyboard->mRepeatTime, QEvent::KeyPress, mKeyboard->mRepeatKey, modifiers(), - mRepeatCode, 0, 0, mRepeatText); + mKeyboard->mRepeatCode, 0, 0, mKeyboard->mRepeatText); } -void QWaylandInputDevice::keyboard_modifiers(uint32_t serial, +void QWaylandInputDevice::Keyboard::keyboard_modifiers(uint32_t serial, uint32_t mods_depressed, uint32_t mods_latched, uint32_t mods_locked, @@ -673,7 +821,7 @@ void QWaylandInputDevice::keyboard_modifiers(uint32_t serial, #endif } -void QWaylandInputDevice::touch_down(uint32_t serial, +void QWaylandInputDevice::Touch::touch_down(uint32_t serial, uint32_t time, struct wl_surface *surface, int32_t id, @@ -682,34 +830,34 @@ void QWaylandInputDevice::touch_down(uint32_t serial, { Q_UNUSED(serial); Q_UNUSED(time); - mTouchFocus = QWaylandWindow::fromWlSurface(surface); - handleTouchPoint(id, wl_fixed_to_double(x), wl_fixed_to_double(y), Qt::TouchPointPressed); + mFocus = QWaylandWindow::fromWlSurface(surface); + mParent->handleTouchPoint(id, wl_fixed_to_double(x), wl_fixed_to_double(y), Qt::TouchPointPressed); } -void QWaylandInputDevice::touch_up(uint32_t serial, uint32_t time, int32_t id) +void QWaylandInputDevice::Touch::touch_up(uint32_t serial, uint32_t time, int32_t id) { Q_UNUSED(serial); Q_UNUSED(time); - mTouchFocus = 0; - handleTouchPoint(id, 0, 0, Qt::TouchPointReleased); + mFocus = 0; + mParent->handleTouchPoint(id, 0, 0, Qt::TouchPointReleased); } -void QWaylandInputDevice::touch_motion(uint32_t time, int32_t id, wl_fixed_t x, wl_fixed_t y) +void QWaylandInputDevice::Touch::touch_motion(uint32_t time, int32_t id, wl_fixed_t x, wl_fixed_t y) { Q_UNUSED(time); - handleTouchPoint(id, wl_fixed_to_double(x), wl_fixed_to_double(y), Qt::TouchPointMoved); + mParent->handleTouchPoint(id, wl_fixed_to_double(x), wl_fixed_to_double(y), Qt::TouchPointMoved); } -void QWaylandInputDevice::touch_cancel() +void QWaylandInputDevice::Touch::touch_cancel() { mPrevTouchPoints.clear(); mTouchPoints.clear(); - QWaylandTouchExtension *touchExt = mQDisplay->touchExtension(); + QWaylandTouchExtension *touchExt = mParent->mQDisplay->touchExtension(); if (touchExt) touchExt->touchCanceled(); - QWindowSystemInterface::handleTouchCancelEvent(0, mTouchDevice); + QWindowSystemInterface::handleTouchCancelEvent(0, mParent->mTouchDevice); } void QWaylandInputDevice::handleTouchPoint(int id, double x, double y, Qt::TouchPointState state) @@ -719,9 +867,9 @@ void QWaylandInputDevice::handleTouchPoint(int id, double x, double y, Qt::Touch // Find out the coordinates for Released events. bool coordsOk = false; if (state == Qt::TouchPointReleased) - for (int i = 0; i < mPrevTouchPoints.count(); ++i) - if (mPrevTouchPoints.at(i).id == id) { - tp.area = mPrevTouchPoints.at(i).area; + for (int i = 0; i < mTouch->mPrevTouchPoints.count(); ++i) + if (mTouch->mPrevTouchPoints.at(i).id == id) { + tp.area = mTouch->mPrevTouchPoints.at(i).area; coordsOk = true; break; } @@ -729,13 +877,13 @@ void QWaylandInputDevice::handleTouchPoint(int id, double x, double y, Qt::Touch if (!coordsOk) { // x and y are surface relative. // We need a global (screen) position. - QWaylandWindow *win = mTouchFocus; + QWaylandWindow *win = mTouch->mFocus; //is it possible that mTouchFocus is null; - if (!win) - win = mPointerFocus; - if (!win) - win = mKeyboardFocus; + if (!win && mPointer) + win = mPointer->mFocus; + if (!win && mKeyboard) + win = mKeyboard->mFocus; if (!win || !win->window()) return; @@ -747,10 +895,10 @@ void QWaylandInputDevice::handleTouchPoint(int id, double x, double y, Qt::Touch tp.state = state; tp.id = id; tp.pressure = tp.state == Qt::TouchPointReleased ? 0 : 1; - mTouchPoints.append(tp); + mTouch->mTouchPoints.append(tp); } -void QWaylandInputDevice::touch_frame() +void QWaylandInputDevice::Touch::touch_frame() { // Copy all points, that are in the previous but not in the current list, as stationary. for (int i = 0; i < mPrevTouchPoints.count(); ++i) { @@ -775,9 +923,9 @@ void QWaylandInputDevice::touch_frame() return; } - QWindow *window = mTouchFocus ? mTouchFocus->window() : 0; + QWindow *window = mFocus ? mFocus->window() : 0; - QWindowSystemInterface::handleTouchEvent(window, mTouchDevice, mTouchPoints); + QWindowSystemInterface::handleTouchEvent(window, mParent->mTouchDevice, mTouchPoints); bool allReleased = true; for (int i = 0; i < mTouchPoints.count(); ++i) @@ -790,7 +938,7 @@ void QWaylandInputDevice::touch_frame() mTouchPoints.clear(); if (allReleased) { - QWindowSystemInterface::handleTouchEvent(window, mTouchDevice, mTouchPoints); + QWindowSystemInterface::handleTouchEvent(window, mParent->mTouchDevice, mTouchPoints); mPrevTouchPoints.clear(); } } diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h index 9e955f5d2b1..867258ade3b 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h +++ b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h @@ -69,9 +69,6 @@ class QWaylandDataDevice; class Q_WAYLAND_CLIENT_EXPORT QWaylandInputDevice : public QObject - , public QtWayland::wl_pointer - , public QtWayland::wl_keyboard - , public QtWayland::wl_touch , public QtWayland::wl_seat { Q_OBJECT @@ -93,103 +90,44 @@ public: void removeMouseButtonFromState(Qt::MouseButton button); QWaylandWindow *pointerFocus() const; + QWaylandWindow *keyboardFocus() const; + QWaylandWindow *touchFocus() const; Qt::KeyboardModifiers modifiers() const; uint32_t serial() const; - uint32_t cursorSerial() const { return mCursorSerial; } + uint32_t cursorSerial() const; private slots: void repeatKey(); private: + class Keyboard; + class Pointer; + class Touch; + QWaylandDisplay *mQDisplay; struct wl_display *mDisplay; - struct wl_callback *mFocusCallback; uint32_t mCaps; struct wl_surface *pointerSurface; QWaylandDataDevice *mDataDevice; - QWaylandWindow *mPointerFocus; - QWaylandWindow *mKeyboardFocus; - QWaylandWindow *mTouchFocus; - Qt::MouseButtons mButtons; - QPointF mSurfacePos; - QPointF mGlobalPos; + Keyboard *mKeyboard; + Pointer *mPointer; + Touch *mTouch; + uint32_t mTime; uint32_t mSerial; - uint32_t mEnterSerial; - uint32_t mCursorSerial; + QTimer mRepeatTimer; void seat_capabilities(uint32_t caps) Q_DECL_OVERRIDE; - - void pointer_enter(uint32_t serial, struct wl_surface *surface, - wl_fixed_t sx, wl_fixed_t sy) Q_DECL_OVERRIDE; - void pointer_leave(uint32_t time, struct wl_surface *surface); - void pointer_motion(uint32_t time, - wl_fixed_t sx, wl_fixed_t sy) Q_DECL_OVERRIDE; - void pointer_button(uint32_t serial, uint32_t time, - uint32_t button, uint32_t state) Q_DECL_OVERRIDE; - void pointer_axis(uint32_t time, - uint32_t axis, - wl_fixed_t value) Q_DECL_OVERRIDE; - - void keyboard_keymap(uint32_t format, - int32_t fd, - uint32_t size) Q_DECL_OVERRIDE; - void keyboard_enter(uint32_t time, - struct wl_surface *surface, - struct wl_array *keys) Q_DECL_OVERRIDE; - void keyboard_leave(uint32_t time, - struct wl_surface *surface) Q_DECL_OVERRIDE; - void keyboard_key(uint32_t serial, uint32_t time, - uint32_t key, uint32_t state) Q_DECL_OVERRIDE; - void keyboard_modifiers(uint32_t serial, - uint32_t mods_depressed, - uint32_t mods_latched, - uint32_t mods_locked, - uint32_t group) Q_DECL_OVERRIDE; - - void touch_down(uint32_t serial, - uint32_t time, - struct wl_surface *surface, - int32_t id, - wl_fixed_t x, - wl_fixed_t y) Q_DECL_OVERRIDE; - void touch_up(uint32_t serial, - uint32_t time, - int32_t id) Q_DECL_OVERRIDE; - void touch_motion(uint32_t time, - int32_t id, - wl_fixed_t x, - wl_fixed_t y) Q_DECL_OVERRIDE; - void touch_frame() Q_DECL_OVERRIDE; - void touch_cancel() Q_DECL_OVERRIDE; - void handleTouchPoint(int id, double x, double y, Qt::TouchPointState state); - static const wl_callback_listener callback; - static void focusCallback(void *data, struct wl_callback *callback, uint32_t time); - - QList mTouchPoints; - QList mPrevTouchPoints; QTouchDevice *mTouchDevice; -#ifndef QT_NO_WAYLAND_XKB - xkb_context *mXkbContext; - xkb_keymap *mXkbMap; - xkb_state *mXkbState; -#endif - - int mRepeatKey; - uint32_t mRepeatCode; - uint32_t mRepeatTime; - QString mRepeatText; - QTimer mRepeatTimer; - friend class QWaylandTouchExtension; friend class QWaylandQtKeyExtension; }; diff --git a/src/plugins/platforms/wayland/qwaylandqtkey.cpp b/src/plugins/platforms/wayland/qwaylandqtkey.cpp index a6b99cb42cb..263390a1f2c 100644 --- a/src/plugins/platforms/wayland/qwaylandqtkey.cpp +++ b/src/plugins/platforms/wayland/qwaylandqtkey.cpp @@ -69,7 +69,7 @@ void QWaylandQtKeyExtension::key_extension_qtkey(struct wl_surface *surface, } QWaylandInputDevice *dev = inputDevices.first(); - QWaylandWindow *win = surface ? QWaylandWindow::fromWlSurface(surface) : dev->mKeyboardFocus; + QWaylandWindow *win = surface ? QWaylandWindow::fromWlSurface(surface) : dev->keyboardFocus(); if (!win || !win->window()) { qWarning("qt_key_extension: handle_qtkey: No keyboard focus"); diff --git a/src/plugins/platforms/wayland/qwaylandtouch.cpp b/src/plugins/platforms/wayland/qwaylandtouch.cpp index db6d4b92d15..01a19926007 100644 --- a/src/plugins/platforms/wayland/qwaylandtouch.cpp +++ b/src/plugins/platforms/wayland/qwaylandtouch.cpp @@ -83,11 +83,11 @@ void QWaylandTouchExtension::touch_extension_touch(uint32_t time, } mInputDevice = inputDevices.first(); } - QWaylandWindow *win = mInputDevice->mTouchFocus; + QWaylandWindow *win = mInputDevice->touchFocus(); if (!win) - win = mInputDevice->mPointerFocus; + win = mInputDevice->pointerFocus(); if (!win) - win = mInputDevice->mKeyboardFocus; + win = mInputDevice->keyboardFocus(); if (!win || !win->window()) { qWarning("qt_touch_extension: handle_touch: No pointer focus"); return; From eef4e25962a9f58094b3b72a7f51ed6bafdcf69d Mon Sep 17 00:00:00 2001 From: Robin Burchell Date: Tue, 7 Jan 2014 14:46:04 +0100 Subject: [PATCH 0088/1507] Use xkb, not X11 for symbol defines. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I6a6acbf83bd13d0a746dc65f560ace3e485ebb38 Reviewed-by: Jørgen Lind --- .../platforms/wayland/qwaylandinputdevice.cpp | 132 +++++++++--------- 1 file changed, 66 insertions(+), 66 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index 34eedb21ea8..c03647e5463 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -64,7 +64,7 @@ #ifndef QT_NO_WAYLAND_XKB #include -#include +#include #endif QT_BEGIN_NAMESPACE @@ -533,76 +533,76 @@ void QWaylandInputDevice::Pointer::pointer_axis(uint32_t time, uint32_t axis, in #ifndef QT_NO_WAYLAND_XKB static const uint32_t KeyTbl[] = { - XK_Escape, Qt::Key_Escape, - XK_Tab, Qt::Key_Tab, - XK_ISO_Left_Tab, Qt::Key_Backtab, - XK_BackSpace, Qt::Key_Backspace, - XK_Return, Qt::Key_Return, - XK_Insert, Qt::Key_Insert, - XK_Delete, Qt::Key_Delete, - XK_Clear, Qt::Key_Delete, - XK_Pause, Qt::Key_Pause, - XK_Print, Qt::Key_Print, + XKB_KEY_Escape, Qt::Key_Escape, + XKB_KEY_Tab, Qt::Key_Tab, + XKB_KEY_ISO_Left_Tab, Qt::Key_Backtab, + XKB_KEY_BackSpace, Qt::Key_Backspace, + XKB_KEY_Return, Qt::Key_Return, + XKB_KEY_Insert, Qt::Key_Insert, + XKB_KEY_Delete, Qt::Key_Delete, + XKB_KEY_Clear, Qt::Key_Delete, + XKB_KEY_Pause, Qt::Key_Pause, + XKB_KEY_Print, Qt::Key_Print, - XK_Home, Qt::Key_Home, - XK_End, Qt::Key_End, - XK_Left, Qt::Key_Left, - XK_Up, Qt::Key_Up, - XK_Right, Qt::Key_Right, - XK_Down, Qt::Key_Down, - XK_Prior, Qt::Key_PageUp, - XK_Next, Qt::Key_PageDown, + XKB_KEY_Home, Qt::Key_Home, + XKB_KEY_End, Qt::Key_End, + XKB_KEY_Left, Qt::Key_Left, + XKB_KEY_Up, Qt::Key_Up, + XKB_KEY_Right, Qt::Key_Right, + XKB_KEY_Down, Qt::Key_Down, + XKB_KEY_Prior, Qt::Key_PageUp, + XKB_KEY_Next, Qt::Key_PageDown, - XK_Shift_L, Qt::Key_Shift, - XK_Shift_R, Qt::Key_Shift, - XK_Shift_Lock, Qt::Key_Shift, - XK_Control_L, Qt::Key_Control, - XK_Control_R, Qt::Key_Control, - XK_Meta_L, Qt::Key_Meta, - XK_Meta_R, Qt::Key_Meta, - XK_Alt_L, Qt::Key_Alt, - XK_Alt_R, Qt::Key_Alt, - XK_Caps_Lock, Qt::Key_CapsLock, - XK_Num_Lock, Qt::Key_NumLock, - XK_Scroll_Lock, Qt::Key_ScrollLock, - XK_Super_L, Qt::Key_Super_L, - XK_Super_R, Qt::Key_Super_R, - XK_Menu, Qt::Key_Menu, - XK_Hyper_L, Qt::Key_Hyper_L, - XK_Hyper_R, Qt::Key_Hyper_R, - XK_Help, Qt::Key_Help, + XKB_KEY_Shift_L, Qt::Key_Shift, + XKB_KEY_Shift_R, Qt::Key_Shift, + XKB_KEY_Shift_Lock, Qt::Key_Shift, + XKB_KEY_Control_L, Qt::Key_Control, + XKB_KEY_Control_R, Qt::Key_Control, + XKB_KEY_Meta_L, Qt::Key_Meta, + XKB_KEY_Meta_R, Qt::Key_Meta, + XKB_KEY_Alt_L, Qt::Key_Alt, + XKB_KEY_Alt_R, Qt::Key_Alt, + XKB_KEY_Caps_Lock, Qt::Key_CapsLock, + XKB_KEY_Num_Lock, Qt::Key_NumLock, + XKB_KEY_Scroll_Lock, Qt::Key_ScrollLock, + XKB_KEY_Super_L, Qt::Key_Super_L, + XKB_KEY_Super_R, Qt::Key_Super_R, + XKB_KEY_Menu, Qt::Key_Menu, + XKB_KEY_Hyper_L, Qt::Key_Hyper_L, + XKB_KEY_Hyper_R, Qt::Key_Hyper_R, + XKB_KEY_Help, Qt::Key_Help, - XK_KP_Space, Qt::Key_Space, - XK_KP_Tab, Qt::Key_Tab, - XK_KP_Enter, Qt::Key_Enter, - XK_KP_Home, Qt::Key_Home, - XK_KP_Left, Qt::Key_Left, - XK_KP_Up, Qt::Key_Up, - XK_KP_Right, Qt::Key_Right, - XK_KP_Down, Qt::Key_Down, - XK_KP_Prior, Qt::Key_PageUp, - XK_KP_Next, Qt::Key_PageDown, - XK_KP_End, Qt::Key_End, - XK_KP_Begin, Qt::Key_Clear, - XK_KP_Insert, Qt::Key_Insert, - XK_KP_Delete, Qt::Key_Delete, - XK_KP_Equal, Qt::Key_Equal, - XK_KP_Multiply, Qt::Key_Asterisk, - XK_KP_Add, Qt::Key_Plus, - XK_KP_Separator, Qt::Key_Comma, - XK_KP_Subtract, Qt::Key_Minus, - XK_KP_Decimal, Qt::Key_Period, - XK_KP_Divide, Qt::Key_Slash, + XKB_KEY_KP_Space, Qt::Key_Space, + XKB_KEY_KP_Tab, Qt::Key_Tab, + XKB_KEY_KP_Enter, Qt::Key_Enter, + XKB_KEY_KP_Home, Qt::Key_Home, + XKB_KEY_KP_Left, Qt::Key_Left, + XKB_KEY_KP_Up, Qt::Key_Up, + XKB_KEY_KP_Right, Qt::Key_Right, + XKB_KEY_KP_Down, Qt::Key_Down, + XKB_KEY_KP_Prior, Qt::Key_PageUp, + XKB_KEY_KP_Next, Qt::Key_PageDown, + XKB_KEY_KP_End, Qt::Key_End, + XKB_KEY_KP_Begin, Qt::Key_Clear, + XKB_KEY_KP_Insert, Qt::Key_Insert, + XKB_KEY_KP_Delete, Qt::Key_Delete, + XKB_KEY_KP_Equal, Qt::Key_Equal, + XKB_KEY_KP_Multiply, Qt::Key_Asterisk, + XKB_KEY_KP_Add, Qt::Key_Plus, + XKB_KEY_KP_Separator, Qt::Key_Comma, + XKB_KEY_KP_Subtract, Qt::Key_Minus, + XKB_KEY_KP_Decimal, Qt::Key_Period, + XKB_KEY_KP_Divide, Qt::Key_Slash, - XK_ISO_Level3_Shift, Qt::Key_AltGr, - XK_Multi_key, Qt::Key_Multi_key, - XK_Codeinput, Qt::Key_Codeinput, - XK_SingleCandidate, Qt::Key_SingleCandidate, - XK_MultipleCandidate, Qt::Key_MultipleCandidate, - XK_PreviousCandidate, Qt::Key_PreviousCandidate, + XKB_KEY_ISO_Level3_Shift, Qt::Key_AltGr, + XKB_KEY_Multi_key, Qt::Key_Multi_key, + XKB_KEY_Codeinput, Qt::Key_Codeinput, + XKB_KEY_SingleCandidate, Qt::Key_SingleCandidate, + XKB_KEY_MultipleCandidate, Qt::Key_MultipleCandidate, + XKB_KEY_PreviousCandidate, Qt::Key_PreviousCandidate, - XK_Mode_switch, Qt::Key_Mode_switch, - XK_script_switch, Qt::Key_Mode_switch, + XKB_KEY_Mode_switch, Qt::Key_Mode_switch, + XKB_KEY_script_switch, Qt::Key_Mode_switch, 0, 0 }; From 78e1b8d06d51dc1787f82d9b75b07b435db3f1e4 Mon Sep 17 00:00:00 2001 From: Jorgen Lind Date: Tue, 7 Jan 2014 09:20:15 +0100 Subject: [PATCH 0089/1507] Adjust the serverbufferintegrations to use bind texture api It mapps closer to the underlying OpenGL architecture Change-Id: I4e0dca4d54670846488c86df2a0fa0c58d49734d Reviewed-by: Jan Arne Petersen Reviewed-by: Laszlo Agocs --- .../hardwareintegration/qwaylandserverbufferintegration_p.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegration_p.h b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegration_p.h index 79e7cdf2a50..18090a79831 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegration_p.h +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegration_p.h @@ -63,8 +63,7 @@ public: QWaylandServerBuffer(); virtual ~QWaylandServerBuffer(); - //creates new texture for buffer - virtual GLuint createTexture() = 0; + virtual void bindTextureToBuffer() = 0; Format format() const; QSize size() const; From fec78c702d647e5cdc87e53a8faacc32a57b2a17 Mon Sep 17 00:00:00 2001 From: Jorgen Lind Date: Thu, 9 Jan 2014 12:24:24 +0100 Subject: [PATCH 0090/1507] Include wayland-client with < and not " Change-Id: Ida61437bb76c81ee2af57856d9be9694e2fdb4a4 Reviewed-by: Andrew Knight --- src/plugins/platforms/wayland/qwaylandextendedsurface.cpp | 2 -- .../platforms/wayland/qwaylandwindowmanagerintegration_p.h | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandextendedsurface.cpp b/src/plugins/platforms/wayland/qwaylandextendedsurface.cpp index 9d5a497087c..fe280416232 100644 --- a/src/plugins/platforms/wayland/qwaylandextendedsurface.cpp +++ b/src/plugins/platforms/wayland/qwaylandextendedsurface.cpp @@ -43,8 +43,6 @@ #include "qwaylandwindow_p.h" -#include "wayland-client.h" - #include "qwaylanddisplay_p.h" #include "qwaylandnativeinterface_p.h" diff --git a/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration_p.h b/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration_p.h index 8c8f3c32a0f..844b122a056 100644 --- a/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration_p.h @@ -45,7 +45,7 @@ #include #include -#include "wayland-client.h" +#include #include #include From 1c72063150ce9a805f13970b7a87694809d7165a Mon Sep 17 00:00:00 2001 From: Giulio Camuffo Date: Thu, 9 Jan 2014 22:09:59 +0100 Subject: [PATCH 0091/1507] Destroy the input wayland objects They are not automatically destroyed by the compositor when the seat loses them. Change-Id: I72d45d664948afb4b39f137c91870f21d26dcb4a Reviewed-by: Laszlo Agocs --- src/plugins/platforms/wayland/qwaylandinputdevice.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index c03647e5463..a979baff3f5 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -112,6 +112,7 @@ public: if (mXkbContext) xkb_context_unref(mXkbContext); #endif + wl_keyboard_destroy(object()); } void keyboard_keymap(uint32_t format, @@ -161,6 +162,7 @@ public: } ~Pointer() { + wl_pointer_destroy(object()); } void pointer_enter(uint32_t serial, struct wl_surface *surface, @@ -193,6 +195,7 @@ public: } ~Touch() { + wl_touch_destroy(object()); } void touch_down(uint32_t serial, From 61fda8f967f284d89b571b0f5f30cc4ea3cb923b Mon Sep 17 00:00:00 2001 From: Jorgen Lind Date: Thu, 9 Jan 2014 15:59:12 +0100 Subject: [PATCH 0092/1507] Fixup plugin interface versioning Change-Id: Ia4ab692fde0dee9224c9c0e3204cfee56144b50f Reviewed-by: Laszlo Agocs --- .../qwaylandclientbufferintegrationplugin_p.h | 2 +- .../qwaylandserverbufferintegrationplugin_p.h | 2 +- .../wayland/plugins/hardwareintegration/brcm-egl/main.cpp | 2 +- .../wayland/plugins/hardwareintegration/drm-egl-server/main.cpp | 2 +- .../wayland/plugins/hardwareintegration/wayland-egl/main.cpp | 2 +- .../wayland/plugins/hardwareintegration/xcomposite-egl/main.cpp | 2 +- .../wayland/plugins/hardwareintegration/xcomposite-glx/main.cpp | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationplugin_p.h b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationplugin_p.h index 476e31a781a..7f96ebc6a0b 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationplugin_p.h +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationplugin_p.h @@ -52,7 +52,7 @@ QT_BEGIN_NAMESPACE class QWaylandClientBufferIntegration; -#define QWaylandClientBufferIntegrationFactoryInterface_iid "org.qt-project.Qt.WaylandClient.QWaylandClientBufferIntegrationFactoryInterface.5.1" +#define QWaylandClientBufferIntegrationFactoryInterface_iid "org.qt-project.Qt.WaylandClient.QWaylandClientBufferIntegrationFactoryInterface.5.3" class Q_WAYLAND_CLIENT_EXPORT QWaylandClientBufferIntegrationPlugin : public QObject { diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationplugin_p.h b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationplugin_p.h index 39d9a8ba6f4..d5d1d78f530 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationplugin_p.h +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationplugin_p.h @@ -52,7 +52,7 @@ QT_BEGIN_NAMESPACE class QWaylandServerBufferIntegration; -#define QWaylandServerBufferIntegrationFactoryInterface_iid "org.qt-project.Qt.WaylandClient.QWaylandServerBufferIntegrationFactoryInterface.5.1" +#define QWaylandServerBufferIntegrationFactoryInterface_iid "org.qt-project.Qt.WaylandClient.QWaylandServerBufferIntegrationFactoryInterface.5.3" class Q_WAYLAND_CLIENT_EXPORT QWaylandServerBufferIntegrationPlugin : public QObject { diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/main.cpp b/src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/main.cpp index b7f376555cf..2c33eb4983a 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/main.cpp +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/main.cpp @@ -47,7 +47,7 @@ QT_BEGIN_NAMESPACE class QWaylandBrcmEglClientBufferPlugin : public QWaylandClientBufferIntegrationPlugin { Q_OBJECT - Q_PLUGIN_METADATA(IID "org.qt-project.Qt.WaylandClient.QWaylandClientBufferIntegrationFactoryInterface.5.1" FILE "brcm-egl.json") + Q_PLUGIN_METADATA(IID "org.qt-project.Qt.WaylandClient.QWaylandClientBufferIntegrationFactoryInterface.5.3" FILE "brcm-egl.json") public: QStringList keys() const; QWaylandClientBufferIntegration *create(const QString&, const QStringList&); diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/drm-egl-server/main.cpp b/src/plugins/platforms/wayland/plugins/hardwareintegration/drm-egl-server/main.cpp index 460ccb7a10a..33b8b4b2980 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/drm-egl-server/main.cpp +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/drm-egl-server/main.cpp @@ -47,7 +47,7 @@ QT_BEGIN_NAMESPACE class DrmEglServerBufferPlugin : public QWaylandServerBufferIntegrationPlugin { Q_OBJECT - Q_PLUGIN_METADATA(IID "org.qt-project.Qt.WaylandClient.QWaylandServerBufferIntegrationFactoryInterface.5.1" FILE "drm-egl-server.json") + Q_PLUGIN_METADATA(IID "org.qt-project.Qt.WaylandClient.QWaylandServerBufferIntegrationFactoryInterface.5.3" FILE "drm-egl-server.json") public: QStringList keys() const; QWaylandServerBufferIntegration *create(const QString&, const QStringList&); diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/main.cpp b/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/main.cpp index 44ce6019d86..50e956644c1 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/main.cpp +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/main.cpp @@ -47,7 +47,7 @@ QT_BEGIN_NAMESPACE class QWaylandEglClientBufferPlugin : public QWaylandClientBufferIntegrationPlugin { Q_OBJECT - Q_PLUGIN_METADATA(IID "org.qt-project.Qt.WaylandClient.QWaylandClientBufferIntegrationFactoryInterface.5.1" FILE "wayland-egl.json") + Q_PLUGIN_METADATA(IID "org.qt-project.Qt.WaylandClient.QWaylandClientBufferIntegrationFactoryInterface.5.3" FILE "wayland-egl.json") public: QStringList keys() const; QWaylandClientBufferIntegration *create(const QString&, const QStringList&); diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-egl/main.cpp b/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-egl/main.cpp index 7c6135ccc58..46e3eda4e29 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-egl/main.cpp +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-egl/main.cpp @@ -47,7 +47,7 @@ QT_BEGIN_NAMESPACE class QWaylandXCompositeEglClientBufferIntegrationPlugin : public QWaylandClientBufferIntegrationPlugin { Q_OBJECT - Q_PLUGIN_METADATA(IID "org.qt-project.Qt.WaylandClient.QWaylandClientBufferIntegrationFactoryInterface.5.1" FILE "xcomposite-egl.json") + Q_PLUGIN_METADATA(IID "org.qt-project.Qt.WaylandClient.QWaylandClientBufferIntegrationFactoryInterface.5.3" FILE "xcomposite-egl.json") public: QStringList keys() const; QWaylandClientBufferIntegration *create(const QString&, const QStringList&); diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-glx/main.cpp b/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-glx/main.cpp index 4beb7e6e3cb..d6225a888c4 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-glx/main.cpp +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-glx/main.cpp @@ -47,7 +47,7 @@ QT_BEGIN_NAMESPACE class QWaylandXCompositeGlxClientBufferIntegrationPlugin : public QWaylandClientBufferIntegrationPlugin { Q_OBJECT - Q_PLUGIN_METADATA(IID "org.qt-project.Qt.WaylandClient.QWaylandClientBufferIntegrationFactoryInterface.5.1" FILE "xcomposite-glx.json") + Q_PLUGIN_METADATA(IID "org.qt-project.Qt.WaylandClient.QWaylandClientBufferIntegrationFactoryInterface.5.3" FILE "xcomposite-glx.json") public: QStringList keys() const; QWaylandClientBufferIntegration *create(const QString&, const QStringList&); From 003db66339b91ab998ed910c0c95ac25d260e2d6 Mon Sep 17 00:00:00 2001 From: Jorgen Lind Date: Fri, 10 Jan 2014 11:34:20 +0200 Subject: [PATCH 0093/1507] Make the glx backend compile again Still needs some renaming and verification, but this makes it compile at least Change-Id: Ifb7fc68e8705f235bf0edf2ae9bb38274b693d3c Reviewed-by: Laszlo Agocs --- .../plugins/hardwareintegration/xcomposite-glx/main.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-glx/main.cpp b/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-glx/main.cpp index 4beb7e6e3cb..751ff3189ab 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-glx/main.cpp +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-glx/main.cpp @@ -39,8 +39,8 @@ ** ****************************************************************************/ -#include -#include "qwaylandxcompositeglxclientbufferintegration.h" +#include +#include "qwaylandxcompositeglxintegration.h" QT_BEGIN_NAMESPACE @@ -64,7 +64,7 @@ QWaylandClientBufferIntegration *QWaylandXCompositeGlxClientBufferIntegrationPlu { Q_UNUSED(paramList); if (system.toLower() == "xcomposite-glx") - return new QWaylandXCompositeGLXClientBufferIntegration(); + return new QWaylandXCompositeGLXIntegration(); return 0; } From 67f9cef815e7945e6bbbbfbae0e9348f5a908ad0 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Wed, 15 Jan 2014 11:51:05 +0100 Subject: [PATCH 0094/1507] Fix build without xkbcommon MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: If6f0c5e14cea659a42dc0ba10c05356a5703ba14 Reviewed-by: Jørgen Lind --- .../platforms/wayland/qwaylandinputdevice.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index a979baff3f5..46054128d5a 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -736,17 +736,20 @@ void QWaylandInputDevice::Keyboard::keyboard_key(uint32_t serial, uint32_t time, { Q_UNUSED(serial); QWaylandWindow *window = mFocus; + uint32_t code = key + 8; + bool isDown = state != 0; + QEvent::Type type = isDown ? QEvent::KeyPress : QEvent::KeyRelease; + QString text; + int qtkey = key + 8; // qt-compositor substracts 8 for some reason + #ifndef QT_NO_WAYLAND_XKB if (!mXkbMap) return; - uint32_t code = key + 8; - bool isDown = state != 0; const xkb_keysym_t *syms; uint32_t numSyms = xkb_key_get_syms(mXkbState, code, &syms); xkb_state_update_key(mXkbState, code, isDown ? XKB_KEY_DOWN : XKB_KEY_UP); - QEvent::Type type = isDown ? QEvent::KeyPress : QEvent::KeyRelease; if (!window) { // We destroyed the keyboard focus surface, but the server @@ -754,9 +757,6 @@ void QWaylandInputDevice::Keyboard::keyboard_key(uint32_t serial, uint32_t time, return; } - int qtkey = key + 8; // qt-compositor substracts 8 for some reason - QString text; - if (numSyms == 1) { xkb_keysym_t sym = syms[0]; Qt::KeyboardModifiers modifiers = mParent->modifiers(); From 60fd8b1612d9261898c13dada04d38bb11c10136 Mon Sep 17 00:00:00 2001 From: Jorgen Lind Date: Tue, 14 Jan 2014 12:26:42 +0100 Subject: [PATCH 0095/1507] Fixup the brcm-egl hardware integrations Change-Id: I2a25c7d0b5019c30f31cba1f608a8731be6b1f10 Reviewed-by: Laszlo Agocs --- .../wayland/plugins/hardwareintegration/brcm-egl/main.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/main.cpp b/src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/main.cpp index b7f376555cf..d1bef5e8caf 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/main.cpp +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/main.cpp @@ -39,8 +39,8 @@ ** ****************************************************************************/ -#include -#include "qwaylandbrcmeglclientbufferintegration.h" +#include +#include "qwaylandbrcmeglintegration.h" QT_BEGIN_NAMESPACE @@ -60,11 +60,11 @@ QStringList QWaylandBrcmEglClientBufferPlugin::keys() const return list; } -QWaylandEglClientBufferIntegration *QWaylandBrcmEglClientBufferPlugin::create(const QString& system, const QStringList& paramList) +QWaylandClientBufferIntegration *QWaylandBrcmEglClientBufferPlugin::create(const QString& system, const QStringList& paramList) { Q_UNUSED(paramList); if (system.toLower() == "brcm") - return new QWaylandBrcmEglClientBufferIntegration(); + return new QWaylandBrcmEglIntegration(); return 0; } From 3a2ece17c3ddcfba584cfdf90482a260d7e9c3ee Mon Sep 17 00:00:00 2001 From: Tomasz Olszak Date: Tue, 14 Jan 2014 21:29:08 +0100 Subject: [PATCH 0096/1507] Don't flushWindowSystemEvents in QWaylandWindow ctor. tests/auto/gui/kernel/qbackingstore test crashed because the flush in QWaylandWindow::setWindowState invoked backing store expose event handling which in turn tried to use related (not yet created) QWaylandWindow. Change-Id: Ic9f29cc3433e6e671deb756aebe26530ebc72042 Reviewed-by: Laszlo Agocs --- .../platforms/wayland/qwaylandwindow.cpp | 58 ++++++++++--------- .../platforms/wayland/qwaylandwindow_p.h | 2 + 2 files changed, 34 insertions(+), 26 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 810239a7b7a..3c7b2eac165 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -119,7 +119,7 @@ QWaylandWindow::QWaylandWindow(QWindow *window) setWindowFlags(window->flags()); setGeometry(window->geometry()); - setWindowState(window->windowState()); + setWindowStateInternal(window->windowState()); } QWaylandWindow::~QWaylandWindow() @@ -409,31 +409,8 @@ void QWaylandWindow::handleContentOrientationChange(Qt::ScreenOrientation orient void QWaylandWindow::setWindowState(Qt::WindowState state) { - if (mState == state) { - return; - } - - // As of february 2013 QWindow::setWindowState sets the new state value after - // QPlatformWindow::setWindowState returns, so we cannot rely on QWindow::windowState - // here. We use then this mState variable. - mState = state; - createDecoration(); - switch (state) { - case Qt::WindowFullScreen: - mShellSurface->setFullscreen(); - break; - case Qt::WindowMaximized: - mShellSurface->setMaximized(); - break; - case Qt::WindowMinimized: - mShellSurface->setMinimized(); - break; - default: - mShellSurface->setNormal(); - } - - QWindowSystemInterface::handleWindowStateChanged(window(), mState); - QWindowSystemInterface::flushWindowSystemEvents(); // Required for oldState to work on WindowStateChanged + if (setWindowStateInternal(state)) + QWindowSystemInterface::flushWindowSystemEvents(); // Required for oldState to work on WindowStateChanged } void QWaylandWindow::setWindowFlags(Qt::WindowFlags flags) @@ -605,4 +582,33 @@ bool QWaylandWindow::setMouseGrabEnabled(bool grab) return true; } +bool QWaylandWindow::setWindowStateInternal(Qt::WindowState state) +{ + if (mState == state) { + return false; + } + + // As of february 2013 QWindow::setWindowState sets the new state value after + // QPlatformWindow::setWindowState returns, so we cannot rely on QWindow::windowState + // here. We use then this mState variable. + mState = state; + createDecoration(); + switch (state) { + case Qt::WindowFullScreen: + mShellSurface->setFullscreen(); + break; + case Qt::WindowMaximized: + mShellSurface->setMaximized(); + break; + case Qt::WindowMinimized: + mShellSurface->setMinimized(); + break; + default: + mShellSurface->setNormal(); + } + + QWindowSystemInterface::handleWindowStateChanged(window(), mState); + return true; +} + QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index 6078dab7f6e..e99e31bdf63 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -204,6 +204,8 @@ protected: Qt::WindowState mState; private: + bool setWindowStateInternal(Qt::WindowState flags); + void handleMouseEventWithDecoration(QWaylandInputDevice *inputDevice, ulong timestamp, const QPointF & local, From cb09f9a7faddbc70dad0dbcd168c6f771d238cf8 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Wed, 15 Jan 2014 14:18:50 +0100 Subject: [PATCH 0097/1507] Send the globals to new listeners MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I8d2a74cdc305fb086f3b5c63d0abe4c46c40bbde Reviewed-by: Jørgen Lind --- .../platforms/wayland/qwaylanddisplay.cpp | 28 ++++++++++++++----- .../platforms/wayland/qwaylanddisplay_p.h | 12 +++++++- 2 files changed, 32 insertions(+), 8 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index ec439b5d2cf..0b715c0ae2c 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -175,12 +175,6 @@ QWaylandScreen *QWaylandDisplay::screenForOutput(struct wl_output *output) const return 0; } -void QWaylandDisplay::addRegistryListener(RegistryListener listener, void *data) -{ - Listener l = { listener, data }; - mRegistryListeners.append(l); -} - void QWaylandDisplay::waitForScreens() { flushRequests(); @@ -234,13 +228,33 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin } else if (interface == QStringLiteral("wl_text_input_manager")) { mTextInputManager.reset(new QtWayland::wl_text_input_manager(registry, id)); } else if (interface == QStringLiteral("qt_hardware_integration")) { - mHardwareIntegration.reset(new QWaylandHardwareIntegration(registry, id)); + mHardwareIntegration.reset(new QWaylandHardwareIntegration(registry, id)); } + mGlobals.append(RegistryGlobal(id, interface, version, registry)); + foreach (Listener l, mRegistryListeners) (*l.listener)(l.data, registry, id, interface, version); } +void QWaylandDisplay::registry_global_remove(uint32_t id) +{ + for (int i = 0, ie = mGlobals.count(); i != ie; ++i) { + if (mGlobals[i].id == id) { + mGlobals.removeAt(i); + break; + } + } +} + +void QWaylandDisplay::addRegistryListener(RegistryListener listener, void *data) +{ + Listener l = { listener, data }; + mRegistryListeners.append(l); + for (int i = 0, ie = mGlobals.count(); i != ie; ++i) + (*l.listener)(l.data, mGlobals[i].registry, mGlobals[i].id, mGlobals[i].interface, mGlobals[i].version); +} + uint32_t QWaylandDisplay::currentTimeMillisec() { //### we throw away the time information diff --git a/src/plugins/platforms/wayland/qwaylanddisplay_p.h b/src/plugins/platforms/wayland/qwaylanddisplay_p.h index 5ba4f51beab..40cb2b2c5f9 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay_p.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay_p.h @@ -130,6 +130,15 @@ public: QtWayland::wl_text_input_manager *textInputManager() const { return mTextInputManager.data(); } QWaylandHardwareIntegration *hardwareIntegration() const { return mHardwareIntegration.data(); } + struct RegistryGlobal { + uint32_t id; + QString interface; + uint32_t version; + struct ::wl_registry *registry; + RegistryGlobal(uint32_t id_, const QString &interface_, uint32_t version_, struct ::wl_registry *registry_) + : id(id_), interface(interface_), version(version_), registry(registry_) { } + }; + /* wl_registry_add_listener does not add but rather sets a listener, so this function is used * to enable many listeners at once. */ void addRegistryListener(RegistryListener listener, void *data); @@ -173,13 +182,14 @@ private: QScopedPointer mWindowManagerIntegration; QScopedPointer mTextInputManager; QScopedPointer mHardwareIntegration; - QSocketNotifier *mReadNotifier; int mFd; int mWritableNotificationFd; bool mScreensInitialized; + QList mGlobals; void registry_global(uint32_t id, const QString &interface, uint32_t version) Q_DECL_OVERRIDE; + void registry_global_remove(uint32_t id) Q_DECL_OVERRIDE; static void shellHandleConfigure(void *data, struct wl_shell *shell, uint32_t time, uint32_t edges, From 30cd553ea616ab097217d6c499e754f5d126d6f8 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Wed, 15 Jan 2014 14:40:37 +0100 Subject: [PATCH 0098/1507] Fix brcm keys MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Did not match the key used in the plugin metadata. Change-Id: I58cf08c684b33d8d7166a074dbafb4187b010498 Reviewed-by: Jørgen Lind --- .../wayland/plugins/hardwareintegration/brcm-egl/main.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/main.cpp b/src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/main.cpp index d1bef5e8caf..2cf144e71cc 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/main.cpp +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/main.cpp @@ -56,14 +56,14 @@ public: QStringList QWaylandBrcmEglClientBufferPlugin::keys() const { QStringList list; - list << "brcm"; + list << "wayland-brcm"; return list; } QWaylandClientBufferIntegration *QWaylandBrcmEglClientBufferPlugin::create(const QString& system, const QStringList& paramList) { Q_UNUSED(paramList); - if (system.toLower() == "brcm") + if (system.toLower() == "wayland-brcm") return new QWaylandBrcmEglIntegration(); return 0; From 8738267dbcda8fa924d0672415d995b2aa1e3b84 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Wed, 15 Jan 2014 13:31:26 +0100 Subject: [PATCH 0099/1507] Fix some typos MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I5c734561c0c13192acd9ffd590eb2e8eeb3ca4e1 Reviewed-by: Jørgen Lind --- src/plugins/platforms/wayland/qwaylandintegration.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandintegration.cpp b/src/plugins/platforms/wayland/qwaylandintegration.cpp index 2e36a16da79..b354ac0706e 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandintegration.cpp @@ -285,7 +285,7 @@ void QWaylandIntegration::initializeClientBufferIntegration() if (mClientBufferIntegration) mClientBufferIntegration->initialize(mDisplay); else - qWarning("Failed to load client buffer intgration: %s\n", qPrintable(targetKey)); + qWarning("Failed to load client buffer integration: %s\n", qPrintable(targetKey)); } void QWaylandIntegration::initializeServerBufferIntegration() @@ -304,7 +304,7 @@ void QWaylandIntegration::initializeServerBufferIntegration() } if (targetKey.isEmpty()) { - qWarning("Failed to determin what server buffer integration to use"); + qWarning("Failed to determine what server buffer integration to use"); return; } From 9a6a2fbe214743eef1f59e8ae43e1040e30e37f1 Mon Sep 17 00:00:00 2001 From: Jorgen Lind Date: Thu, 9 Jan 2014 16:16:50 +0100 Subject: [PATCH 0100/1507] Update the required wayland version to 1.3 Change-Id: Id1c9d14061d513f6c37a59ed8161732366ab3526 Reviewed-by: Laszlo Agocs --- src/3rdparty/wayland/protocols/wayland.xml | 252 ++++++++++++++++++--- 1 file changed, 221 insertions(+), 31 deletions(-) diff --git a/src/3rdparty/wayland/protocols/wayland.xml b/src/3rdparty/wayland/protocols/wayland.xml index 3bce022c3e8..a1df007d0d6 100644 --- a/src/3rdparty/wayland/protocols/wayland.xml +++ b/src/3rdparty/wayland/protocols/wayland.xml @@ -38,7 +38,7 @@ The sync request asks the server to emit the 'done' event on the returned wl_callback object. Since requests are handled in-order and events are delivered in-order, this can - used as a barrier to ensure all previous requests and the + be used as a barrier to ensure all previous requests and the resulting events have been handled. The object returned by this request will be destroyed by the @@ -173,7 +173,7 @@ - + A compositor. This object is a singleton global. The compositor is in charge of combining the contents of multiple @@ -274,10 +274,73 @@ - This describes the memory layout of an individual pixel. + This describes the memory layout of an individual pixel. + + All renderers should support argb8888 and xrgb8888 but any other + formats are optional and may not be supported by the particular + renderer in use. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -521,7 +584,7 @@ This event is sent when an active drag-and-drop pointer enters a surface owned by the client. The position of the pointer at - enter time is provided by the x an y arguments, in surface + enter time is provided by the x and y arguments, in surface local coordinates. @@ -544,7 +607,7 @@ This event is sent when the drag-and-drop pointer moves within the currently focused surface. The new position of the pointer - is provided by the x an y arguments, in surface local + is provided by the x and y arguments, in surface local coordinates. @@ -577,7 +640,7 @@ - The wl_data_device_manager is a a singleton global object that + The wl_data_device_manager is a singleton global object that provides access to inter-client data transfer mechanisms such as copy-and-paste and drag-and-drop. These mechanisms are tied to a wl_seat and this interface lets a client get a wl_data_device @@ -709,7 +772,7 @@ The x and y arguments specify the locations of the upper left corner of the surface relative to the upper left corner of the - parent surface. + parent surface, in surface local coordinates. The flags argument controls details of the transient behaviour. @@ -729,7 +792,7 @@ - + @@ -751,6 +814,19 @@ indicates that the app does not care about framerate. The framerate is specified in mHz, that is framerate of 60000 is 60Hz. + A method of "scale" or "driver" implies a scaling operation of + the surface, either via a direct scaling operation or a change of + the output mode. This will override any kind of output scaling, so + that mapping a surface with a buffer size equal to the mode can + fill the screen independent of buffer_scale. + + A method of "fill" means we don't scale up the buffer, however + any output scale is applied. This means that you may run into + an edge case where the application maps a buffer with the same + size of the output mode but buffer_scale 1 (thus making a + surface larger than the output). In this case it is allowed to + downscale the results to fit the screen. + The compositor must reply to this request with a configure event with the dimensions for the output on which the surface will be made fullscreen. @@ -777,6 +853,10 @@ in any of the clients surfaces is reported as normal, however, clicks in other clients surfaces will be discarded and trigger the callback. + + The x and y arguments specify the locations of the upper left + corner of the surface relative to the upper left corner of the + parent surface, in surface local coordinates. @@ -829,9 +909,9 @@ Set a class for the surface. The surface class identifies the general class of applications - to which the surface belongs. A common convention is to use - the file name (full path if non-standard location) of the - applications .desktop file as the class. + to which the surface belongs. A common convention is to use the + file name (or the full path if it is a non-standard location) of + the application's .desktop file as the class. @@ -860,6 +940,9 @@ The client is free to dismiss all but the last configure event it received. + + The width and height arguments specify the size of the window + in surface local coordinates. @@ -870,17 +953,22 @@ The popup_done event is sent out when a popup grab is broken, - that is, when the users clicks a surface that doesn't belong + that is, when the user clicks a surface that doesn't belong to the client owning the popup surface. - + A surface is a rectangular area that is displayed on the screen. It has a location, size and pixel contents. + The size of a surface (and relative positions on it) is described + in surface local coordinates, which may differ from the buffer + local coordinates of the pixel content, in case a buffer_transform + or a buffer_scale is used. + Surfaces are also used for some special purposes, e.g. as cursor images for pointers, drag icons, etc. @@ -895,20 +983,25 @@ Set a buffer as the content of this surface. + The new size of the surface is calculated based on the buffer + size transformed by the inverse buffer_transform and the + inverse buffer_scale. This means that the supplied buffer + must be an integer multiple of the buffer_scale. + The x and y arguments specify the location of the new pending - buffer's upper left corner, relative to the current buffer's - upper left corner. In other words, the x and y, and the width - and height of the wl_buffer together define in which directions - the surface's size changes. + buffer's upper left corner, relative to the current buffer's upper + left corner, in surface local coordinates. In other words, the + x and y, combined with the new surface size define in which + directions the surface's size changes. Surface contents are double-buffered state, see wl_surface.commit. The initial surface contents are void; there is no content. wl_surface.attach assigns the given wl_buffer as the pending wl_buffer. wl_surface.commit makes the pending wl_buffer the new - surface contents, and the size of the surface becomes the size of - the wl_buffer, as described above. After commit, there is no - pending buffer until the next attach. + surface contents, and the size of the surface becomes the size + calculated from the wl_buffer, as described above. After commit, + there is no pending buffer until the next attach. Committing a pending wl_buffer allows the compositor to read the pixels in the wl_buffer. The compositor may access the pixels at @@ -922,10 +1015,10 @@ Destroying the wl_buffer after wl_buffer.release does not change the surface contents. However, if the client destroys the - wl_buffer before receiving wl_buffer.release, the surface + wl_buffer before receiving the wl_buffer.release event, the surface contents become undefined immediately. - Only if wl_surface.attach is sent with a NULL wl_buffer, the + If wl_surface.attach is sent with a NULL wl_buffer, the following wl_surface.commit will remove the surface content. @@ -945,6 +1038,8 @@ Damage is double-buffered state, see wl_surface.commit. + The damage rectangle is specified in surface local coordinates. + The initial value for pending damage is empty: no damage. wl_surface.damage adds pending damage: the new pending damage is the union of old pending damage and the given rectangle. @@ -996,6 +1091,8 @@ behaviour, but marking transparent content as opaque will result in repaint artifacts. + The opaque region is specified in surface local coordinates. + The compositor ignores the parts of the opaque region that fall outside of the surface. @@ -1023,6 +1120,8 @@ surface in the server surface stack. The compositor ignores the parts of the input region that fall outside of the surface. + The input region is specified in surface local coordinates. + Input region is double-buffered state, see wl_surface.commit. wl_surface.set_input_region changes the pending input region. @@ -1100,7 +1199,7 @@ according to the output transform, thus permiting the compositor to use certain optimizations even if the display is rotated. Using hardware overlays and scanning out a client buffer for fullscreen - surfaces are examples of such optmizations. Those optimizations are + surfaces are examples of such optimizations. Those optimizations are highly dependent on the compositor implementation, so the use of this request should be considered on a case-by-case basis. @@ -1110,9 +1209,33 @@ + + + + + + This request sets an optional scaling factor on how the compositor + interprets the contents of the buffer attached to the window. + + Buffer scale is double-buffered state, see wl_surface.commit. + + A newly created surface has its buffer scale set to 1. + + The purpose of this request is to allow clients to supply higher + resolution buffer data for use on high resolution outputs. Its + intended that you pick the same buffer scale as the scale of the + output that the surface is displayed on.This means the compositor + can avoid scaling when rendering the surface on that output. + + Note that if the scale is larger than 1, then you have to attach + a buffer that is larger (by a factor of scale in each dimension) + than the desired surface size. + + + - + A seat is a group of keyboards, pointer and touch devices. This object is published as a global during start up, or when such a @@ -1171,9 +1294,21 @@ + + + + + + In a multiseat configuration this can be used by the client to help + identify which physical devices the seat represents. Based on + the seat configuration used by the compositor. + + + + - + The wl_pointer interface represents one or more input devices, such as mice, which control the pointer location and pointer_focus @@ -1197,7 +1332,8 @@ The parameters hotspot_x and hotspot_y define the position of the pointer surface relative to the pointer location. Its top-left corner is always at (x, y) - (hotspot_x, hotspot_y), - where (x, y) are the coordinates of the pointer location. + where (x, y) are the coordinates of the pointer location, in surface + local coordinates. On surface.attach requests to the pointer surface, hotspot_x and hotspot_y are decremented by the x and y parameters @@ -1221,6 +1357,10 @@ + + + + Notification that this seat's pointer is focused on a certain @@ -1320,17 +1460,23 @@ - + The wl_keyboard interface represents one or more keyboards associated with a seat. + + + + This specifies the format of the keymap provided to the client with the wl_keyboard.keymap event. + @@ -1401,7 +1547,7 @@ - + The wl_touch interface represents a touchscreen associated with a seat. @@ -1413,6 +1559,10 @@ contact point can be identified by the ID of the sequence. + + + + A new touch point has appeared on the surface. This touch point is @@ -1467,7 +1617,7 @@ - + An output describes part of the compositor geometry. The compositor works in the 'compositor coordinate system' and an @@ -1559,12 +1709,52 @@ again if an output changes mode, for the mode that is now current. In other words, the current mode is always the last mode that was received with the current flag set. + + The size of a mode is given in physical hardware units of + the output device. This is not necessarily the same as + the output size in the global compositor space. For instance, + the output may be scaled, as described in wl_output.scale, + or transformed , as described in wl_output.transform. - - + + + + + + This event is sent after all other properties has been + sent after binding to the output object and after any + other property changes done after that. This allows + changes to the output properties to be seen as + atomic, even if they happen via multiple events. + + + + + + This event contains scaling geometry information + that is not in the geometry event. It may be sent after + binding the output object or if the output scale changes + later. If it is not sent, the client should assume a + scale of 1. + + A scale larger than 1 means that the compositor will + automatically scale surface buffers by this amount + when rendering. This is used for very high resolution + displays where applications rendering at the native + resolution would be too small to be legible. + + It is intended that scaling aware clients track the + current output of a surface, and if it is on a scaled + output it should use wl_surface.set_buffer_scale with + the scale of the output. That way the compositor can + avoid scaling the surface, and the client can supply + a higher detail image. + + + From 47d8cb089e435bbd516a3cc7572f52feb5f5efc6 Mon Sep 17 00:00:00 2001 From: Jorgen Lind Date: Thu, 16 Jan 2014 15:33:21 +0100 Subject: [PATCH 0101/1507] Fix compiler warnings because of deprecated apis Change-Id: I60faee3fb4b9a74a13c8489a5dd1df7a2a5a4ae4 Reviewed-by: Laszlo Agocs --- src/tools/qtwaylandscanner/qtwaylandscanner.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp index 4378322297d..df751a8cb18 100644 --- a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp +++ b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp @@ -604,7 +604,7 @@ void process(QXmlStreamReader &xml, const QByteArray &headerPath) printf(" void %s::init(struct ::wl_display *display)\n", interfaceName); printf(" {\n"); - printf(" m_global = wl_display_add_global(display, &::%s_interface, this, bind_func);\n", interfaceName); + printf(" m_global = wl_global_create(display, &::%s_interface, ::%s_interface.version, this, bind_func);\n", interfaceName, interfaceName); printf(" }\n"); printf("\n"); @@ -655,9 +655,9 @@ void process(QXmlStreamReader &xml, const QByteArray &headerPath) printf(" Resource *resource = %s_allocate();\n", interfaceNameStripped); printf(" resource->%s = this;\n", interfaceNameStripped); printf("\n"); - printf(" struct ::wl_resource *handle = id != 0 ? wl_client_add_object(client, &::%s_interface, %s, id, resource) : wl_client_new_object(client, &::%s_interface, %s, resource);\n", interfaceName, interfaceMember.constData(), interfaceName, interfaceMember.constData()); + printf(" struct ::wl_resource *handle = wl_resource_create(client, &::%s_interface, ::%s_interface.version, id);\n", interfaceName, interfaceName); + printf(" wl_resource_set_implementation(handle, %s, resource, destroy_func);", interfaceMember.constData()); printf("\n"); - printf(" handle->destroy = destroy_func;\n"); printf(" resource->handle = handle;\n"); printf(" %s_bind_resource(resource);\n", interfaceNameStripped); printf(" return resource;\n"); From e8df7316cde91c2916509bd71012aca18a1ae72e Mon Sep 17 00:00:00 2001 From: Jorgen Lind Date: Thu, 9 Jan 2014 16:22:33 +0100 Subject: [PATCH 0102/1507] Fixup the iid versions for the plugins Change-Id: Iac1b8b070d3bf87b29d0be9a2a76fd56e7046f0f Reviewed-by: Laszlo Agocs --- .../qwaylandclientbufferintegrationplugin_p.h | 2 +- .../qwaylandserverbufferintegrationplugin_p.h | 2 +- .../wayland/plugins/hardwareintegration/brcm-egl/main.cpp | 2 +- .../wayland/plugins/hardwareintegration/drm-egl-server/main.cpp | 2 +- .../wayland/plugins/hardwareintegration/wayland-egl/main.cpp | 2 +- .../wayland/plugins/hardwareintegration/xcomposite-egl/main.cpp | 2 +- .../wayland/plugins/hardwareintegration/xcomposite-glx/main.cpp | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationplugin_p.h b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationplugin_p.h index 476e31a781a..18cc7beb67d 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationplugin_p.h +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationplugin_p.h @@ -52,7 +52,7 @@ QT_BEGIN_NAMESPACE class QWaylandClientBufferIntegration; -#define QWaylandClientBufferIntegrationFactoryInterface_iid "org.qt-project.Qt.WaylandClient.QWaylandClientBufferIntegrationFactoryInterface.5.1" +#define QWaylandClientBufferIntegrationFactoryInterface_iid "org.qt-project.Qt.WaylandClient.QWaylandClientBufferIntegrationFactoryInterface.5.2" class Q_WAYLAND_CLIENT_EXPORT QWaylandClientBufferIntegrationPlugin : public QObject { diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationplugin_p.h b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationplugin_p.h index 39d9a8ba6f4..d893da2abdd 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationplugin_p.h +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationplugin_p.h @@ -52,7 +52,7 @@ QT_BEGIN_NAMESPACE class QWaylandServerBufferIntegration; -#define QWaylandServerBufferIntegrationFactoryInterface_iid "org.qt-project.Qt.WaylandClient.QWaylandServerBufferIntegrationFactoryInterface.5.1" +#define QWaylandServerBufferIntegrationFactoryInterface_iid "org.qt-project.Qt.WaylandClient.QWaylandServerBufferIntegrationFactoryInterface.5.2" class Q_WAYLAND_CLIENT_EXPORT QWaylandServerBufferIntegrationPlugin : public QObject { diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/main.cpp b/src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/main.cpp index 2cf144e71cc..4c8846d9c25 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/main.cpp +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/main.cpp @@ -47,7 +47,7 @@ QT_BEGIN_NAMESPACE class QWaylandBrcmEglClientBufferPlugin : public QWaylandClientBufferIntegrationPlugin { Q_OBJECT - Q_PLUGIN_METADATA(IID "org.qt-project.Qt.WaylandClient.QWaylandClientBufferIntegrationFactoryInterface.5.1" FILE "brcm-egl.json") + Q_PLUGIN_METADATA(IID "org.qt-project.Qt.WaylandClient.QWaylandClientBufferIntegrationFactoryInterface.5.2" FILE "brcm-egl.json") public: QStringList keys() const; QWaylandClientBufferIntegration *create(const QString&, const QStringList&); diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/drm-egl-server/main.cpp b/src/plugins/platforms/wayland/plugins/hardwareintegration/drm-egl-server/main.cpp index 460ccb7a10a..bc530a4c980 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/drm-egl-server/main.cpp +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/drm-egl-server/main.cpp @@ -47,7 +47,7 @@ QT_BEGIN_NAMESPACE class DrmEglServerBufferPlugin : public QWaylandServerBufferIntegrationPlugin { Q_OBJECT - Q_PLUGIN_METADATA(IID "org.qt-project.Qt.WaylandClient.QWaylandServerBufferIntegrationFactoryInterface.5.1" FILE "drm-egl-server.json") + Q_PLUGIN_METADATA(IID "org.qt-project.Qt.WaylandClient.QWaylandServerBufferIntegrationFactoryInterface.5.2" FILE "drm-egl-server.json") public: QStringList keys() const; QWaylandServerBufferIntegration *create(const QString&, const QStringList&); diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/main.cpp b/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/main.cpp index 44ce6019d86..72cb555f874 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/main.cpp +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/main.cpp @@ -47,7 +47,7 @@ QT_BEGIN_NAMESPACE class QWaylandEglClientBufferPlugin : public QWaylandClientBufferIntegrationPlugin { Q_OBJECT - Q_PLUGIN_METADATA(IID "org.qt-project.Qt.WaylandClient.QWaylandClientBufferIntegrationFactoryInterface.5.1" FILE "wayland-egl.json") + Q_PLUGIN_METADATA(IID "org.qt-project.Qt.WaylandClient.QWaylandClientBufferIntegrationFactoryInterface.5.2" FILE "wayland-egl.json") public: QStringList keys() const; QWaylandClientBufferIntegration *create(const QString&, const QStringList&); diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-egl/main.cpp b/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-egl/main.cpp index 7c6135ccc58..f6995319e45 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-egl/main.cpp +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-egl/main.cpp @@ -47,7 +47,7 @@ QT_BEGIN_NAMESPACE class QWaylandXCompositeEglClientBufferIntegrationPlugin : public QWaylandClientBufferIntegrationPlugin { Q_OBJECT - Q_PLUGIN_METADATA(IID "org.qt-project.Qt.WaylandClient.QWaylandClientBufferIntegrationFactoryInterface.5.1" FILE "xcomposite-egl.json") + Q_PLUGIN_METADATA(IID "org.qt-project.Qt.WaylandClient.QWaylandClientBufferIntegrationFactoryInterface.5.2" FILE "xcomposite-egl.json") public: QStringList keys() const; QWaylandClientBufferIntegration *create(const QString&, const QStringList&); diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-glx/main.cpp b/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-glx/main.cpp index 751ff3189ab..4269a9c263c 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-glx/main.cpp +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-glx/main.cpp @@ -47,7 +47,7 @@ QT_BEGIN_NAMESPACE class QWaylandXCompositeGlxClientBufferIntegrationPlugin : public QWaylandClientBufferIntegrationPlugin { Q_OBJECT - Q_PLUGIN_METADATA(IID "org.qt-project.Qt.WaylandClient.QWaylandClientBufferIntegrationFactoryInterface.5.1" FILE "xcomposite-glx.json") + Q_PLUGIN_METADATA(IID "org.qt-project.Qt.WaylandClient.QWaylandClientBufferIntegrationFactoryInterface.5.2" FILE "xcomposite-glx.json") public: QStringList keys() const; QWaylandClientBufferIntegration *create(const QString&, const QStringList&); From 5f52b6b5082e4845b54ea530aaa3505b25ccad60 Mon Sep 17 00:00:00 2001 From: Giulio Camuffo Date: Tue, 21 Jan 2014 17:07:32 +0200 Subject: [PATCH 0103/1507] Allow resizing the Qt window after the buffers swap Some EGL implementations resize the EGL buffers after eglSwapBuffers, so we need to send the geometry change event after the swap, or else the Qt window size and the physical buffer size will be different to each other. Do not force this behavior though, but use it only when the QT_WAYLAND_RESIZE_AFTER_SWAP environment variable is set. Change-Id: I79e39442b3010c563a81d7c94e747a982e158fc1 Reviewed-by: Gunnar Sletta --- .../platforms/wayland/qwaylandwindow.cpp | 24 +++++++++++++------ .../platforms/wayland/qwaylandwindow_p.h | 2 ++ 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 3c7b2eac165..67f122fb4a6 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -80,6 +80,8 @@ QWaylandWindow::QWaylandWindow(QWindow *window) , mFrameCallback(0) , mRequestResizeSent(false) , mCanResize(true) + , mResizeDirty(false) + , mResizeAfterSwap(!qEnvironmentVariableIsSet("QT_WAYLAND_RESIZE_AFTER_SWAP")) , mSentInitialResize(false) , mMouseDevice(0) , mMouseSerial(0) @@ -195,10 +197,11 @@ void QWaylandWindow::setGeometry(const QRect &rect) if (mWindowDecoration && window()->isVisible()) mWindowDecoration->update(); - if (mConfigure.isEmpty()) { + if (mResizeAfterSwap) + mResizeDirty = true; + else QWindowSystemInterface::handleGeometryChange(window(), geometry()); - QWindowSystemInterface::handleExposeEvent(window(), QRegion(geometry())); - } + QWindowSystemInterface::handleExposeEvent(window(), QRegion(geometry())); } void QWaylandWindow::setVisible(bool visible) @@ -287,7 +290,6 @@ void QWaylandWindow::doResize() setGeometry(geometry); mConfigure.clear(); - QWindowSystemInterface::handleGeometryChange(window(), geometry); } void QWaylandWindow::setCanResize(bool canResize) @@ -295,9 +297,17 @@ void QWaylandWindow::setCanResize(bool canResize) QMutexLocker lock(&mResizeLock); mCanResize = canResize; - if (canResize && !mConfigure.isEmpty()) { - doResize(); - QWindowSystemInterface::handleExposeEvent(window(), geometry()); + if (canResize) { + if (mResizeDirty) { + QWindowSystemInterface::handleGeometryChange(window(), geometry()); + } + if (!mConfigure.isEmpty()) { + doResize(); + QWindowSystemInterface::handleExposeEvent(window(), geometry()); + } else if (mResizeDirty) { + QWindowSystemInterface::handleExposeEvent(window(), geometry()); + mResizeDirty = false; + } } } diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index e99e31bdf63..fe6f319087b 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -193,6 +193,8 @@ protected: QWaylandWindowConfigure mConfigure; bool mRequestResizeSent; bool mCanResize; + bool mResizeDirty; + bool mResizeAfterSwap; bool mSentInitialResize; QPoint mOffset; From 43aaab280862bf73ef05ad419b260511798c47f5 Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Mon, 3 Feb 2014 14:31:14 +0100 Subject: [PATCH 0104/1507] init mTouchDevice to null Since QWaylandInputDevice::seat_capabilities checks the pointer before creating this object, it must be initially null so that the device will be registered. Change-Id: Ia15b407b1636eab41c04f30bb631306095e5aefb Reviewed-by: Laszlo Agocs --- src/plugins/platforms/wayland/qwaylandinputdevice.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index 46054128d5a..08e2945741b 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -232,6 +232,7 @@ QWaylandInputDevice::QWaylandInputDevice(QWaylandDisplay *display, uint32_t id) , mTouch(0) , mTime(0) , mSerial(0) + , mTouchDevice(0) { if (mQDisplay->dndSelectionHandler()) { mDataDevice = mQDisplay->dndSelectionHandler()->getDataDevice(this); From df0f2ea1103a8aa6d0f82a48b272ce49df0132f7 Mon Sep 17 00:00:00 2001 From: Jorgen Lind Date: Fri, 24 Jan 2014 09:41:36 +0100 Subject: [PATCH 0105/1507] Add the A8 MESA for mat patch for the Mesa v.10 branch Change-Id: I771e0478e274ef7cfabb417c9712d4dbb4d62f5b Reviewed-by: Laszlo Agocs --- ...d-a-EGL_DRM_BUFFER_FORMAT_A8_MESA-10.patch | 87 +++++++++++++++++++ ...a-EGL_DRM_BUFFER_FORMAT_A8_MESA-9.2.patch} | 0 2 files changed, 87 insertions(+) create mode 100644 src/3rdparty/wayland/patches/0001-Add-a-EGL_DRM_BUFFER_FORMAT_A8_MESA-10.patch rename src/3rdparty/wayland/patches/{0001-Add-a-EGL_DRM_BUFFER_FORMAT_A8_MESA.patch => 0001-Add-a-EGL_DRM_BUFFER_FORMAT_A8_MESA-9.2.patch} (100%) diff --git a/src/3rdparty/wayland/patches/0001-Add-a-EGL_DRM_BUFFER_FORMAT_A8_MESA-10.patch b/src/3rdparty/wayland/patches/0001-Add-a-EGL_DRM_BUFFER_FORMAT_A8_MESA-10.patch new file mode 100644 index 00000000000..035822961a1 --- /dev/null +++ b/src/3rdparty/wayland/patches/0001-Add-a-EGL_DRM_BUFFER_FORMAT_A8_MESA-10.patch @@ -0,0 +1,87 @@ +From be72a2ae7d14e57c423ce0885b153abf56eefca4 Mon Sep 17 00:00:00 2001 +From: Jorgen Lind +Date: Thu, 2 Jan 2014 12:28:54 +0100 +Subject: [PATCH] Add a EGL_DRM_BUFFER_FORMAT_A8_MESA + +This is to allow us to share A8 DRM buffers between processes +--- + include/EGL/eglext.h | 1 + + include/GL/internal/dri_interface.h | 1 + + src/egl/drivers/dri2/egl_dri2.c | 7 +++++++ + src/mesa/drivers/dri/common/dri_util.c | 4 ++++ + 4 files changed, 13 insertions(+) + +diff --git a/include/EGL/eglext.h b/include/EGL/eglext.h +index 1d68178..6c4fb7e 100644 +--- a/include/EGL/eglext.h ++++ b/include/EGL/eglext.h +@@ -271,6 +271,7 @@ typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATEPIXMAPSURFACEHIPROC) (EGLDisplay dp + #define EGL_DRM_BUFFER_FORMAT_MESA 0x31D0 /* CreateDRMImageMESA attribute */ + #define EGL_DRM_BUFFER_USE_MESA 0x31D1 /* CreateDRMImageMESA attribute */ + #define EGL_DRM_BUFFER_FORMAT_ARGB32_MESA 0x31D2 /* EGL_IMAGE_FORMAT_MESA attribute value */ ++#define EGL_DRM_BUFFER_FORMAT_A8_MESA 0x31D5 /* EGL_IMAGE_FORMAT_MESA attribute value */ + #define EGL_DRM_BUFFER_MESA 0x31D3 /* eglCreateImageKHR target */ + #define EGL_DRM_BUFFER_STRIDE_MESA 0x31D4 + #define EGL_DRM_BUFFER_USE_SCANOUT_MESA 0x00000001 /* EGL_DRM_BUFFER_USE_MESA bits */ +diff --git a/include/GL/internal/dri_interface.h b/include/GL/internal/dri_interface.h +index b012570..c0ba605 100644 +--- a/include/GL/internal/dri_interface.h ++++ b/include/GL/internal/dri_interface.h +@@ -1015,6 +1015,7 @@ struct __DRIdri2ExtensionRec { + #define __DRI_IMAGE_FORMAT_XRGB2101010 0x1009 + #define __DRI_IMAGE_FORMAT_ARGB2101010 0x100a + #define __DRI_IMAGE_FORMAT_SARGB8 0x100b ++#define __DRI_IMAGE_FORMAT_A8 0x100c + + #define __DRI_IMAGE_USE_SHARE 0x0001 + #define __DRI_IMAGE_USE_SCANOUT 0x0002 +diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c +index a64f4e8..a8253e1 100644 +--- a/src/egl/drivers/dri2/egl_dri2.c ++++ b/src/egl/drivers/dri2/egl_dri2.c +@@ -1185,6 +1185,10 @@ dri2_create_image_mesa_drm_buffer(_EGLDisplay *disp, _EGLContext *ctx, + format = __DRI_IMAGE_FORMAT_ARGB8888; + pitch = attrs.DRMBufferStrideMESA; + break; ++ case EGL_DRM_BUFFER_FORMAT_A8_MESA: ++ format = __DRI_IMAGE_FORMAT_A8; ++ pitch = attrs.DRMBufferStrideMESA; ++ break; + default: + _eglError(EGL_BAD_PARAMETER, + "dri2_create_image_khr: unsupported pixmap depth"); +@@ -1719,6 +1723,9 @@ dri2_create_drm_image_mesa(_EGLDriver *drv, _EGLDisplay *disp, + case EGL_DRM_BUFFER_FORMAT_ARGB32_MESA: + format = __DRI_IMAGE_FORMAT_ARGB8888; + break; ++ case EGL_DRM_BUFFER_FORMAT_A8_MESA: ++ format = __DRI_IMAGE_FORMAT_A8; ++ break; + default: + _eglLog(_EGL_WARNING, "bad image format value 0x%04x", + attrs.DRMBufferFormatMESA); +diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c +index 9134a94..5fb55a2 100644 +--- a/src/mesa/drivers/dri/common/dri_util.c ++++ b/src/mesa/drivers/dri/common/dri_util.c +@@ -831,6 +831,8 @@ driGLFormatToImageFormat(gl_format format) + return __DRI_IMAGE_FORMAT_NONE; + case MESA_FORMAT_SARGB8: + return __DRI_IMAGE_FORMAT_SARGB8; ++ case MESA_FORMAT_A8: ++ return __DRI_IMAGE_FORMAT_A8; + default: + return 0; + } +@@ -860,6 +862,8 @@ driImageFormatToGLFormat(uint32_t image_format) + return MESA_FORMAT_GR88; + case __DRI_IMAGE_FORMAT_SARGB8: + return MESA_FORMAT_SARGB8; ++ case __DRI_IMAGE_FORMAT_A8: ++ return MESA_FORMAT_A8; + case __DRI_IMAGE_FORMAT_NONE: + return MESA_FORMAT_NONE; + default: +-- +1.8.5.2 + diff --git a/src/3rdparty/wayland/patches/0001-Add-a-EGL_DRM_BUFFER_FORMAT_A8_MESA.patch b/src/3rdparty/wayland/patches/0001-Add-a-EGL_DRM_BUFFER_FORMAT_A8_MESA-9.2.patch similarity index 100% rename from src/3rdparty/wayland/patches/0001-Add-a-EGL_DRM_BUFFER_FORMAT_A8_MESA.patch rename to src/3rdparty/wayland/patches/0001-Add-a-EGL_DRM_BUFFER_FORMAT_A8_MESA-9.2.patch From 70c578cb5ec2964a75069ed6ca1353627e8cbe55 Mon Sep 17 00:00:00 2001 From: Giulio Camuffo Date: Tue, 4 Feb 2014 11:28:31 +0200 Subject: [PATCH 0106/1507] Fix the client behavior when showing or hiding a surface MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reduce the chances of seeing a bad frame. Change-Id: Idac3450d92210fc5fc33cb68862b089964c9a8ce Reviewed-by: Jørgen Lind --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 67f122fb4a6..920c97780e7 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -207,9 +207,6 @@ void QWaylandWindow::setGeometry(const QRect &rect) void QWaylandWindow::setVisible(bool visible) { if (visible) { - if (mBuffer) - attach(mBuffer->buffer(), 0, 0); - if (window()->type() == Qt::Popup && transientParent()) { QWaylandWindow *parent = transientParent(); mMouseDevice = parent->mMouseDevice; @@ -230,10 +227,10 @@ void QWaylandWindow::setVisible(bool visible) // QWaylandShmBackingStore::beginPaint(). } else { QWindowSystemInterface::handleExposeEvent(window(), QRegion()); + QWindowSystemInterface::flushWindowSystemEvents(); attach(static_cast(0), 0, 0); + commit(); } - damage(QRect(QPoint(0,0),geometry().size())); - commit(); } From 82669149b0d69034d2307dd0dacce51253f243ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Thu, 6 Feb 2014 13:40:50 +0100 Subject: [PATCH 0107/1507] Provide "kde" in the themeNames MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit KDE would like to get its integration plugin on Wayland. The name won't change for Wayland, so filtering it out because it is the name of the X11 desktop environment is wrong. The patch follows the approach of the QGenericUnixTheme. Change-Id: Ia9c253ae6b5d609bd3bc630ce5c36b89811b079a Reviewed-by: Laszlo Agocs Reviewed-by: Jørgen Lind --- src/plugins/platforms/wayland/qwaylandintegration.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandintegration.cpp b/src/plugins/platforms/wayland/qwaylandintegration.cpp index b354ac0706e..02b7e56c667 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandintegration.cpp @@ -84,15 +84,18 @@ public: if (QGuiApplication::desktopSettingsAware()) { const QByteArray desktopEnvironment = QGuiApplicationPrivate::platformIntegration()->services()->desktopEnvironment(); - // Ignore X11 desktop environments - if (!desktopEnvironment.isEmpty() && + if (desktopEnvironment == QByteArrayLiteral("KDE")) { +#ifndef QT_NO_SETTINGS + result.push_back(QStringLiteral("kde")); +#endif + } else if (!desktopEnvironment.isEmpty() && desktopEnvironment != QByteArrayLiteral("UNKNOWN") && - desktopEnvironment != QByteArrayLiteral("KDE") && desktopEnvironment != QByteArrayLiteral("GNOME") && desktopEnvironment != QByteArrayLiteral("UNITY") && desktopEnvironment != QByteArrayLiteral("MATE") && desktopEnvironment != QByteArrayLiteral("XFCE") && desktopEnvironment != QByteArrayLiteral("LXDE")) + // Ignore X11 desktop environments result.push_back(QString::fromLocal8Bit(desktopEnvironment.toLower())); } From a0bc006361cc72b1ef2b44e7c9215c8a3b169685 Mon Sep 17 00:00:00 2001 From: Pier Luigi Fiorini Date: Sat, 8 Feb 2014 10:48:18 +0100 Subject: [PATCH 0108/1507] Strip custom prefix from interface name MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Interface names for some protocols might not start with wl_ or qt_, with this change users can specify a prefix of their liking. Change-Id: I70d40985165c49114b525bdec2a872aa5b0dad6d Reviewed-by: Jørgen Lind --- .../qtwaylandscanner/qtwaylandscanner.cpp | 23 +++++++++++-------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp index 4378322297d..48a71a56009 100644 --- a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp +++ b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp @@ -313,8 +313,10 @@ void printEnums(const QList &enums) } } -QByteArray stripInterfaceName(const QByteArray &name) +QByteArray stripInterfaceName(const QByteArray &name, const QByteArray &prefix) { + if (!prefix.isEmpty() && name.startsWith(prefix)) + return name.mid(prefix.size()); if (name.startsWith("qt_") || name.startsWith("wl_")) return name.mid(3); @@ -327,7 +329,7 @@ bool ignoreInterface(const QByteArray &name) || (isServerSide() && name == "wl_registry"); } -void process(QXmlStreamReader &xml, const QByteArray &headerPath) +void process(QXmlStreamReader &xml, const QByteArray &headerPath, const QByteArray &prefix) { if (!xml.readNextStartElement()) return; @@ -409,7 +411,7 @@ void process(QXmlStreamReader &xml, const QByteArray &headerPath) const char *interfaceName = interface.name.constData(); - QByteArray stripped = stripInterfaceName(interface.name); + QByteArray stripped = stripInterfaceName(interface.name, prefix); const char *interfaceNameStripped = stripped.constData(); printf(" class %s %s\n {\n", serverExport.constData(), interfaceName); @@ -546,7 +548,7 @@ void process(QXmlStreamReader &xml, const QByteArray &headerPath) const char *interfaceName = interface.name.constData(); - QByteArray stripped = stripInterfaceName(interface.name); + QByteArray stripped = stripInterfaceName(interface.name, prefix); const char *interfaceNameStripped = stripped.constData(); printf(" %s::%s(struct ::wl_client *client, int id)\n", interfaceName, interfaceName); @@ -815,7 +817,7 @@ void process(QXmlStreamReader &xml, const QByteArray &headerPath) const char *interfaceName = interface.name.constData(); - QByteArray stripped = stripInterfaceName(interface.name); + QByteArray stripped = stripInterfaceName(interface.name, prefix); const char *interfaceNameStripped = stripped.constData(); printf(" class %s %s\n {\n", clientExport.constData(), interfaceName); @@ -901,7 +903,7 @@ void process(QXmlStreamReader &xml, const QByteArray &headerPath) const char *interfaceName = interface.name.constData(); - QByteArray stripped = stripInterfaceName(interface.name); + QByteArray stripped = stripInterfaceName(interface.name, prefix); const char *interfaceNameStripped = stripped.constData(); bool hasEvents = !interface.events.isEmpty(); @@ -1065,15 +1067,18 @@ void process(QXmlStreamReader &xml, const QByteArray &headerPath) int main(int argc, char **argv) { if (argc <= 2 || !parseOption(argv[1], &option)) { - fprintf(stderr, "Usage: %s [client-header|server-header|client-code|server-code] specfile [header-path]\n", argv[0]); + fprintf(stderr, "Usage: %s [client-header|server-header|client-code|server-code] specfile [header-path] [prefix]\n", argv[0]); return 1; } QCoreApplication app(argc, argv); QByteArray headerPath; - if (argc == 4) + if (argc >= 4) headerPath = QByteArray(argv[3]); + QByteArray prefix; + if (argc == 5) + prefix = QByteArray(argv[4]); QFile file(argv[2]); if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { fprintf(stderr, "Unable to open file %s\n", argv[2]); @@ -1081,7 +1086,7 @@ int main(int argc, char **argv) } QXmlStreamReader xml(&file); - process(xml, headerPath); + process(xml, headerPath, prefix); if (xml.hasError()) { fprintf(stderr, "XML error: %s\nLine %lld, column %lld\n", xml.errorString().toLocal8Bit().constData(), xml.lineNumber(), xml.columnNumber()); From 8e8f8630b79b7fcda01ed0c8d0ccf0d10e20c3e2 Mon Sep 17 00:00:00 2001 From: Giulio Camuffo Date: Thu, 27 Feb 2014 12:51:41 +0200 Subject: [PATCH 0109/1507] Change the minimum required Wayland version back to 1.2 As discussed, Wayland 1.3 is not common in distributions yet, and that is a problem for the C.I. machines. Change-Id: Iec5c6d8ae1d1a50199f66d45ca9269694db78efe Reviewed-by: Andrew Knight Reviewed-by: Robin Burchell --- src/3rdparty/wayland/protocols/wayland.xml | 105 +++------------------ 1 file changed, 15 insertions(+), 90 deletions(-) diff --git a/src/3rdparty/wayland/protocols/wayland.xml b/src/3rdparty/wayland/protocols/wayland.xml index a1df007d0d6..1442b6a03f4 100644 --- a/src/3rdparty/wayland/protocols/wayland.xml +++ b/src/3rdparty/wayland/protocols/wayland.xml @@ -38,7 +38,7 @@ The sync request asks the server to emit the 'done' event on the returned wl_callback object. Since requests are handled in-order and events are delivered in-order, this can - be used as a barrier to ensure all previous requests and the + used as a barrier to ensure all previous requests and the resulting events have been handled. The object returned by this request will be destroyed by the @@ -274,73 +274,10 @@ - This describes the memory layout of an individual pixel. - - All renderers should support argb8888 and xrgb8888 but any other - formats are optional and may not be supported by the particular - renderer in use. + This describes the memory layout of an individual pixel. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -584,7 +521,7 @@ This event is sent when an active drag-and-drop pointer enters a surface owned by the client. The position of the pointer at - enter time is provided by the x and y arguments, in surface + enter time is provided by the x an y arguments, in surface local coordinates. @@ -607,7 +544,7 @@ This event is sent when the drag-and-drop pointer moves within the currently focused surface. The new position of the pointer - is provided by the x and y arguments, in surface local + is provided by the x an y arguments, in surface local coordinates. @@ -640,7 +577,7 @@ - The wl_data_device_manager is a singleton global object that + The wl_data_device_manager is a a singleton global object that provides access to inter-client data transfer mechanisms such as copy-and-paste and drag-and-drop. These mechanisms are tied to a wl_seat and this interface lets a client get a wl_data_device @@ -909,9 +846,9 @@ Set a class for the surface. The surface class identifies the general class of applications - to which the surface belongs. A common convention is to use the - file name (or the full path if it is a non-standard location) of - the application's .desktop file as the class. + to which the surface belongs. A common convention is to use + the file name (full path if non-standard location) of the + applications .desktop file as the class. @@ -953,7 +890,7 @@ The popup_done event is sent out when a popup grab is broken, - that is, when the user clicks a surface that doesn't belong + that is, when the users clicks a surface that doesn't belong to the client owning the popup surface. @@ -1015,10 +952,10 @@ Destroying the wl_buffer after wl_buffer.release does not change the surface contents. However, if the client destroys the - wl_buffer before receiving the wl_buffer.release event, the surface + wl_buffer before receiving wl_buffer.release, the surface contents become undefined immediately. - If wl_surface.attach is sent with a NULL wl_buffer, the + Only if wl_surface.attach is sent with a NULL wl_buffer, the following wl_surface.commit will remove the surface content. @@ -1235,7 +1172,7 @@ - + A seat is a group of keyboards, pointer and touch devices. This object is published as a global during start up, or when such a @@ -1308,7 +1245,7 @@ - + The wl_pointer interface represents one or more input devices, such as mice, which control the pointer location and pointer_focus @@ -1357,10 +1294,6 @@ - - - - Notification that this seat's pointer is focused on a certain @@ -1460,16 +1393,12 @@ - + The wl_keyboard interface represents one or more keyboards associated with a seat. - - - - This specifies the format of the keymap provided to the @@ -1547,7 +1476,7 @@ - + The wl_touch interface represents a touchscreen associated with a seat. @@ -1559,10 +1488,6 @@ contact point can be identified by the ID of the sequence. - - - - A new touch point has appeared on the surface. This touch point is From 982cef34809f1dbe68869db332e66718562cd9b9 Mon Sep 17 00:00:00 2001 From: Jorgen Lind Date: Mon, 10 Mar 2014 09:25:04 +0100 Subject: [PATCH 0110/1507] Fixup for GLX integration Change-Id: I2de94481f7d3e109fdce7ca961f8969299cf5d9e Reviewed-by: Laszlo Agocs --- .../hardwareintegration/qwaylandclientbufferintegration_p.h | 1 - .../plugins/hardwareintegration/xcomposite-glx/main.cpp | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegration_p.h b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegration_p.h index 153b3f591c2..7d79f326330 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegration_p.h +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegration_p.h @@ -61,7 +61,6 @@ public: virtual ~QWaylandClientBufferIntegration(); virtual void initialize(QWaylandDisplay *display) = 0; - virtual bool waitingForEvents() { return false; } virtual bool supportsThreadedOpenGL() const { return false; } diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-glx/main.cpp b/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-glx/main.cpp index f53caf03a14..2d402194e97 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-glx/main.cpp +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-glx/main.cpp @@ -56,14 +56,14 @@ public: QStringList QWaylandXCompositeGlxClientBufferIntegrationPlugin::keys() const { QStringList list; - list << "xcomposite-glx"; + list << "wayland-xcomposite-glx"; return list; } QWaylandClientBufferIntegration *QWaylandXCompositeGlxClientBufferIntegrationPlugin::create(const QString& system, const QStringList& paramList) { Q_UNUSED(paramList); - if (system.toLower() == "xcomposite-glx") + if (system.toLower() == "wayland-xcomposite-glx") return new QWaylandXCompositeGLXIntegration(); return 0; From 1706b461944f8a86169190a922c1e84fe87b08cd Mon Sep 17 00:00:00 2001 From: Jorgen Lind Date: Mon, 10 Mar 2014 14:31:55 +0100 Subject: [PATCH 0111/1507] Take advantage of the Qt 5 plugin json structure Also change naming scheme of plugins: buffer integrations doesn't start with "wayland-" but the platform plugins have to start with "wayland-". Also update the README Change-Id: I6dd2103ab287ed569ab06cfb6eb469e3db058831 Reviewed-by: Laszlo Agocs --- .../hardwareintegration/brcm-egl/brcm-egl.json | 2 +- .../hardwareintegration/brcm-egl/main.cpp | 18 ++++-------------- .../drm-egl-server/main.cpp | 18 ++++-------------- .../hardwareintegration/wayland-egl/main.cpp | 18 ++++-------------- .../xcomposite-egl/main.cpp | 18 ++++-------------- .../xcomposite-egl/xcomposite-egl.json | 2 +- .../xcomposite-glx/main.cpp | 18 ++++-------------- .../xcomposite-glx/xcomposite-glx.json | 2 +- 8 files changed, 23 insertions(+), 73 deletions(-) diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/brcm-egl.json b/src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/brcm-egl.json index 48611c6ab3b..3a659a87b97 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/brcm-egl.json +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/brcm-egl.json @@ -1,3 +1,3 @@ { - "Keys": [ "wayland-brcm" ] + "Keys": [ "brcm" ] } diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/main.cpp b/src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/main.cpp index f77b41ef064..c023332ebd7 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/main.cpp +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/main.cpp @@ -47,26 +47,16 @@ QT_BEGIN_NAMESPACE class QWaylandBrcmEglClientBufferPlugin : public QWaylandClientBufferIntegrationPlugin { Q_OBJECT - Q_PLUGIN_METADATA(IID "org.qt-project.Qt.WaylandClient.QWaylandClientBufferIntegrationFactoryInterface.5.3" FILE "brcm-egl.json") + Q_PLUGIN_METADATA(IID QWaylandClientBufferIntegrationFactoryInterface_iid FILE "brcm-egl.json") public: - QStringList keys() const; - QWaylandClientBufferIntegration *create(const QString&, const QStringList&); + QWaylandClientBufferIntegration *create(const QString&, const QStringList&) Q_DECL_OVERRIDE; }; -QStringList QWaylandBrcmEglClientBufferPlugin::keys() const -{ - QStringList list; - list << "wayland-brcm"; - return list; -} - QWaylandClientBufferIntegration *QWaylandBrcmEglClientBufferPlugin::create(const QString& system, const QStringList& paramList) { Q_UNUSED(paramList); - if (system.toLower() == "wayland-brcm") - return new QWaylandBrcmEglIntegration(); - - return 0; + Q_UNUSED(system); + return new QWaylandBrcmEglIntegration(); } QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/drm-egl-server/main.cpp b/src/plugins/platforms/wayland/plugins/hardwareintegration/drm-egl-server/main.cpp index 33b8b4b2980..6a3df4431fd 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/drm-egl-server/main.cpp +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/drm-egl-server/main.cpp @@ -47,26 +47,16 @@ QT_BEGIN_NAMESPACE class DrmEglServerBufferPlugin : public QWaylandServerBufferIntegrationPlugin { Q_OBJECT - Q_PLUGIN_METADATA(IID "org.qt-project.Qt.WaylandClient.QWaylandServerBufferIntegrationFactoryInterface.5.3" FILE "drm-egl-server.json") + Q_PLUGIN_METADATA(IID QWaylandServerBufferIntegrationFactoryInterface_iid FILE "drm-egl-server.json") public: - QStringList keys() const; - QWaylandServerBufferIntegration *create(const QString&, const QStringList&); + QWaylandServerBufferIntegration *create(const QString&, const QStringList&) Q_DECL_OVERRIDE; }; -QStringList DrmEglServerBufferPlugin::keys() const -{ - QStringList list; - list << "drm-egl-server"; - return list; -} - QWaylandServerBufferIntegration *DrmEglServerBufferPlugin::create(const QString& system, const QStringList& paramList) { Q_UNUSED(paramList); - if (system.toLower() == "drm-egl-server") - return new DrmEglServerBufferIntegration(); - - return 0; + Q_UNUSED(system); + return new DrmEglServerBufferIntegration(); } QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/main.cpp b/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/main.cpp index 50e956644c1..e4cd8c1f08c 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/main.cpp +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/main.cpp @@ -47,26 +47,16 @@ QT_BEGIN_NAMESPACE class QWaylandEglClientBufferPlugin : public QWaylandClientBufferIntegrationPlugin { Q_OBJECT - Q_PLUGIN_METADATA(IID "org.qt-project.Qt.WaylandClient.QWaylandClientBufferIntegrationFactoryInterface.5.3" FILE "wayland-egl.json") + Q_PLUGIN_METADATA(IID QWaylandClientBufferIntegrationFactoryInterface_iid FILE "wayland-egl.json") public: - QStringList keys() const; - QWaylandClientBufferIntegration *create(const QString&, const QStringList&); + QWaylandClientBufferIntegration *create(const QString&, const QStringList&) Q_DECL_OVERRIDE; }; -QStringList QWaylandEglClientBufferPlugin::keys() const -{ - QStringList list; - list << "wayland-egl"; - return list; -} - QWaylandClientBufferIntegration *QWaylandEglClientBufferPlugin::create(const QString& system, const QStringList& paramList) { Q_UNUSED(paramList); - if (system.toLower() == "wayland-egl") - return new QWaylandEglClientBufferIntegration(); - - return 0; + Q_UNUSED(system); + return new QWaylandEglClientBufferIntegration(); } QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-egl/main.cpp b/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-egl/main.cpp index 46e3eda4e29..4b9835f1d53 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-egl/main.cpp +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-egl/main.cpp @@ -47,26 +47,16 @@ QT_BEGIN_NAMESPACE class QWaylandXCompositeEglClientBufferIntegrationPlugin : public QWaylandClientBufferIntegrationPlugin { Q_OBJECT - Q_PLUGIN_METADATA(IID "org.qt-project.Qt.WaylandClient.QWaylandClientBufferIntegrationFactoryInterface.5.3" FILE "xcomposite-egl.json") + Q_PLUGIN_METADATA(IID QWaylandClientBufferIntegrationFactoryInterface_iid FILE "xcomposite-egl.json") public: - QStringList keys() const; - QWaylandClientBufferIntegration *create(const QString&, const QStringList&); + QWaylandClientBufferIntegration *create(const QString&, const QStringList&) Q_DECL_OVERRIDE; }; -QStringList QWaylandXCompositeEglClientBufferIntegrationPlugin::keys() const -{ - QStringList list; - list << "xcomposite" << "xcomposite-egl"; - return list; -} - QWaylandClientBufferIntegration *QWaylandXCompositeEglClientBufferIntegrationPlugin::create(const QString& system, const QStringList& paramList) { Q_UNUSED(paramList); - if (system.toLower() == "xcomposite" || system.toLower() == "xcomposite-egl") - return new QWaylandXCompositeEGLClientBufferIntegration(); - - return 0; + Q_UNUSED(system); + return new QWaylandXCompositeEGLClientBufferIntegration(); } QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-egl/xcomposite-egl.json b/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-egl/xcomposite-egl.json index 8ccd5b46b89..0d119ff852a 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-egl/xcomposite-egl.json +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-egl/xcomposite-egl.json @@ -1,3 +1,3 @@ { - "Keys": [ "wayland-xcomposite" ] + "Keys": [ "xcomposite-egl" ] } diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-glx/main.cpp b/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-glx/main.cpp index 2d402194e97..2c6f0fde898 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-glx/main.cpp +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-glx/main.cpp @@ -47,26 +47,16 @@ QT_BEGIN_NAMESPACE class QWaylandXCompositeGlxClientBufferIntegrationPlugin : public QWaylandClientBufferIntegrationPlugin { Q_OBJECT - Q_PLUGIN_METADATA(IID "org.qt-project.Qt.WaylandClient.QWaylandClientBufferIntegrationFactoryInterface.5.3" FILE "xcomposite-glx.json") + Q_PLUGIN_METADATA(IID QWaylandClientBufferIntegrationFactoryInterface_iid FILE "xcomposite-glx.json") public: - QStringList keys() const; - QWaylandClientBufferIntegration *create(const QString&, const QStringList&); + QWaylandClientBufferIntegration *create(const QString&, const QStringList&) Q_DECL_OVERRIDE; }; -QStringList QWaylandXCompositeGlxClientBufferIntegrationPlugin::keys() const -{ - QStringList list; - list << "wayland-xcomposite-glx"; - return list; -} - QWaylandClientBufferIntegration *QWaylandXCompositeGlxClientBufferIntegrationPlugin::create(const QString& system, const QStringList& paramList) { Q_UNUSED(paramList); - if (system.toLower() == "wayland-xcomposite-glx") - return new QWaylandXCompositeGLXIntegration(); - - return 0; + Q_UNUSED(system); + return new QWaylandXCompositeGLXIntegration(); } QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-glx/xcomposite-glx.json b/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-glx/xcomposite-glx.json index 0f4a3bf699d..e2c4cecd6af 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-glx/xcomposite-glx.json +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-glx/xcomposite-glx.json @@ -1,3 +1,3 @@ { - "Keys": [ "wayland-xcomposite-glx" ] + "Keys": [ "xcomposite-glx" ] } From 0431544ee3ff4b7206ea32e2e09049463bbb7aaf Mon Sep 17 00:00:00 2001 From: Giulio Camuffo Date: Wed, 29 Jan 2014 14:30:21 +0200 Subject: [PATCH 0112/1507] Add a libhybris hardwareintegrations to share EGL server buffers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add a hardwareintegration plugin to make Qt server side EGL buffers shareable from the compositor to the client, such as what the server-buffer example does. Change-Id: I24558324d51202ca449b47b0ee395c8e81c10698 Reviewed-by: Jørgen Lind --- .../libhybris-egl-server-buffer.xml | 65 +++++++++++++++++++ .../plugins/hardwareintegration/client.pro | 2 + .../libhybris-egl-server.json | 3 + .../libhybris-egl-server.pro | 14 ++++ .../libhybris-egl-server/main.cpp | 64 ++++++++++++++++++ 5 files changed, 148 insertions(+) create mode 100644 src/3rdparty/wayland/extensions/libhybris-egl-server-buffer.xml create mode 100644 src/plugins/platforms/wayland/plugins/hardwareintegration/libhybris-egl-server/libhybris-egl-server.json create mode 100644 src/plugins/platforms/wayland/plugins/hardwareintegration/libhybris-egl-server/libhybris-egl-server.pro create mode 100644 src/plugins/platforms/wayland/plugins/hardwareintegration/libhybris-egl-server/main.cpp diff --git a/src/3rdparty/wayland/extensions/libhybris-egl-server-buffer.xml b/src/3rdparty/wayland/extensions/libhybris-egl-server-buffer.xml new file mode 100644 index 00000000000..597ca0d7805 --- /dev/null +++ b/src/3rdparty/wayland/extensions/libhybris-egl-server-buffer.xml @@ -0,0 +1,65 @@ + + + + Copyright (C) 2014 Jolla Ltd + Contact: http://www.qt-project.org/legal + + This file is part of the plugins of the Qt Toolkit. + + $QT_BEGIN_LICENSE:BSD$ + You may use this file under the terms of the BSD license as follows: + + "Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names + of its contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." + + $QT_END_LICENSE$ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/client.pro b/src/plugins/platforms/wayland/plugins/hardwareintegration/client.pro index 1d79b2634d0..b7a9b46ee1d 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/client.pro +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/client.pro @@ -17,3 +17,5 @@ config_xcomposite { config_drm_egl_server: \ SUBDIRS += drm-egl-server +config_libhybris_egl_server: \ + SUBDIRS += libhybris-egl-server diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/libhybris-egl-server/libhybris-egl-server.json b/src/plugins/platforms/wayland/plugins/hardwareintegration/libhybris-egl-server/libhybris-egl-server.json new file mode 100644 index 00000000000..3a1f4c08a6a --- /dev/null +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/libhybris-egl-server/libhybris-egl-server.json @@ -0,0 +1,3 @@ +{ + "Keys": [ "libhybris-egl-server" ] +} diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/libhybris-egl-server/libhybris-egl-server.pro b/src/plugins/platforms/wayland/plugins/hardwareintegration/libhybris-egl-server/libhybris-egl-server.pro new file mode 100644 index 00000000000..4d790970108 --- /dev/null +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/libhybris-egl-server/libhybris-egl-server.pro @@ -0,0 +1,14 @@ +PLUGIN_TYPE = wayland-graphics-integration/client +load(qt_plugin) + +QT += waylandclient-private + +include(../../../../hardwareintegration/client/libhybris-egl-server/libhybris-egl-server.pri) + +LIBS += -lEGL + +OTHER_FILES += \ + libhybris-egl-server.json + +SOURCES += main.cpp + diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/libhybris-egl-server/main.cpp b/src/plugins/platforms/wayland/plugins/hardwareintegration/libhybris-egl-server/main.cpp new file mode 100644 index 00000000000..9aee157903e --- /dev/null +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/libhybris-egl-server/main.cpp @@ -0,0 +1,64 @@ +/**************************************************************************** +** +** Copyright (C) 2014 Jolla Ltd, author: +** Contact: http://www.qt-project.org/legal +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include "libhybriseglserverbufferintegration.h" + +QT_BEGIN_NAMESPACE + +class LibHybrisEglServerBufferPlugin : public QWaylandServerBufferIntegrationPlugin +{ + Q_OBJECT + Q_PLUGIN_METADATA(IID QWaylandServerBufferIntegrationFactoryInterface_iid FILE "libhybris-egl-server.json") +public: + QWaylandServerBufferIntegration *create(const QString&, const QStringList&); +}; + +QWaylandServerBufferIntegration *LibHybrisEglServerBufferPlugin::create(const QString& system, const QStringList& paramList) +{ + Q_UNUSED(paramList); + Q_UNUSED(system); + return new LibHybrisEglServerBufferIntegration(); +} + +QT_END_NAMESPACE + +#include "main.moc" From 5d9ed010d56b1f672a4a97045b7dd0bdc3f65670 Mon Sep 17 00:00:00 2001 From: Giulio Camuffo Date: Mon, 31 Mar 2014 16:02:48 +0300 Subject: [PATCH 0113/1507] Always bail out when the compositor is closed errno can both be EPIPE and ECONNRESET when reading from the connection after the server is closed. Change-Id: I03b64a382db3de66819277e9955aeca3e2d7f9a1 Reviewed-by: Robin Burchell --- src/plugins/platforms/wayland/qwaylanddisplay.cpp | 4 ++-- src/plugins/platforms/wayland/qwaylandeventthread.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index 0b715c0ae2c..3576c0bd2aa 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -149,7 +149,7 @@ QWaylandDisplay::~QWaylandDisplay(void) void QWaylandDisplay::flushRequests() { - if (wl_display_dispatch_queue_pending(mDisplay, mEventQueue) == -1 && errno == EPIPE) { + if (wl_display_dispatch_queue_pending(mDisplay, mEventQueue) == -1 && (errno == EPIPE || errno == ECONNRESET)) { qWarning("The Wayland connection broke. Did the Wayland compositor die?"); ::exit(1); } @@ -159,7 +159,7 @@ void QWaylandDisplay::flushRequests() void QWaylandDisplay::blockingReadEvents() { - if (wl_display_dispatch_queue(mDisplay, mEventQueue) == -1 && errno == EPIPE) { + if (wl_display_dispatch_queue(mDisplay, mEventQueue) == -1 && (errno == EPIPE || errno == ECONNRESET)) { qWarning("The Wayland connection broke. Did the Wayland compositor die?"); ::exit(1); } diff --git a/src/plugins/platforms/wayland/qwaylandeventthread.cpp b/src/plugins/platforms/wayland/qwaylandeventthread.cpp index b94110c25ef..d309f7bb234 100644 --- a/src/plugins/platforms/wayland/qwaylandeventthread.cpp +++ b/src/plugins/platforms/wayland/qwaylandeventthread.cpp @@ -32,7 +32,7 @@ void QWaylandEventThread::displayConnect() void QWaylandEventThread::readWaylandEvents() { - if (wl_display_dispatch(m_display) == -1 && errno == EPIPE) { + if (wl_display_dispatch(m_display) == -1 && (errno == EPIPE || errno == ECONNRESET)) { qWarning("The Wayland connection broke. Did the Wayland compositor die?"); ::exit(1); } From 2b0e4c78bce9308127e79052b2ffa83db81f1f32 Mon Sep 17 00:00:00 2001 From: Giulio Camuffo Date: Mon, 31 Mar 2014 16:06:46 +0300 Subject: [PATCH 0114/1507] Fix broken include guard Change-Id: I6f68e04c55397b702727a76ff50ea213c193cdf6 Reviewed-by: Robin Burchell --- src/plugins/platforms/wayland/qwaylandtouch_p.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandtouch_p.h b/src/plugins/platforms/wayland/qwaylandtouch_p.h index c00c7c0d362..bd299a1afd7 100644 --- a/src/plugins/platforms/wayland/qwaylandtouch_p.h +++ b/src/plugins/platforms/wayland/qwaylandtouch_p.h @@ -39,7 +39,7 @@ ** ****************************************************************************/ -#ifndef QWAYLANDTOUCh_H +#ifndef QWAYLANDTOUCH_H #define QWAYLANDTOUCH_H #include From 5559bb6c1e8eebc32e4949e60d65b733a645814c Mon Sep 17 00:00:00 2001 From: Vesa Halttunen Date: Mon, 10 Mar 2014 16:21:28 +0100 Subject: [PATCH 0115/1507] Set the right content orientation of the extended window on QWaylandWindow ctor Change-Id: I5cf5afc7b920ff754fb21fc748af61a596e20c7b Reviewed-by: Robin Burchell --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 920c97780e7..265d651c8af 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -122,6 +122,7 @@ QWaylandWindow::QWaylandWindow(QWindow *window) setWindowFlags(window->flags()); setGeometry(window->geometry()); setWindowStateInternal(window->windowState()); + handleContentOrientationChange(window->contentOrientation()); } QWaylandWindow::~QWaylandWindow() From 86146d9f86a4cb65e27706881077b917fd821862 Mon Sep 17 00:00:00 2001 From: Elvis Lee Date: Tue, 1 Apr 2014 11:00:13 +0900 Subject: [PATCH 0116/1507] Null check for window on pointer_axis The window is already destroyed and server doesn't get a message yet. Change-Id: Ia9dd0ce891a712d1aa913fcb3313a5fe300788ab Reviewed-by: Giulio Camuffo Reviewed-by: Robin Burchell --- src/plugins/platforms/wayland/qwaylandinputdevice.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index 08e2945741b..29e993646ad 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -517,6 +517,12 @@ void QWaylandInputDevice::Pointer::pointer_axis(uint32_t time, uint32_t axis, in QPoint pixelDelta; QPoint angleDelta; + if (window == NULL) { + // We destroyed the pointer focus surface, but the server + // didn't get the message yet. + return; + } + //normalize value and inverse axis int valueDelta = wl_fixed_to_int(value) * -12; From 88d888b126773fd3d580960079a723f04dee360d Mon Sep 17 00:00:00 2001 From: Tomasz Olszak Date: Tue, 15 Apr 2014 10:16:36 +0200 Subject: [PATCH 0117/1507] build fix for MODULE_PLUGINS_TYPE MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I8d44f50480440060eba84354e88fb2535e1d8e4a Reviewed-by: Jørgen Lind --- src/plugins/platforms/wayland/client.pro | 2 ++ .../qwaylandclientbufferintegrationfactory.cpp | 2 +- .../qwaylandserverbufferintegrationfactory.cpp | 2 +- .../wayland/plugins/hardwareintegration/brcm-egl/brcm-egl.pro | 2 +- .../hardwareintegration/drm-egl-server/drm-egl-server.pro | 2 +- .../plugins/hardwareintegration/wayland-egl/wayland-egl.pro | 2 +- .../hardwareintegration/xcomposite-egl/xcomposite-egl.pro | 2 +- .../hardwareintegration/xcomposite-glx/xcomposite-glx.pro | 2 +- 8 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/plugins/platforms/wayland/client.pro b/src/plugins/platforms/wayland/client.pro index 01d704a9463..10cbd31a8e1 100644 --- a/src/plugins/platforms/wayland/client.pro +++ b/src/plugins/platforms/wayland/client.pro @@ -3,6 +3,8 @@ QT += core-private gui-private QT_FOR_PRIVATE += platformsupport-private MODULE=waylandclient +MODULE_PLUGIN_TYPES = wayland-graphics-integration-client + load(qt_module) CONFIG += link_pkgconfig qpa/genericunixfontdatabase wayland-scanner diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationfactory.cpp b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationfactory.cpp index e168f612f97..7f2648bcf99 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationfactory.cpp +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationfactory.cpp @@ -50,7 +50,7 @@ QT_BEGIN_NAMESPACE #ifndef QT_NO_LIBRARY Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader, - (QWaylandClientBufferIntegrationFactoryInterface_iid, QLatin1String("/wayland-graphics-integration/client"), Qt::CaseInsensitive)) + (QWaylandClientBufferIntegrationFactoryInterface_iid, QLatin1String("/wayland-graphics-integration-client"), Qt::CaseInsensitive)) Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, directLoader, (QWaylandClientBufferIntegrationFactoryInterface_iid, QLatin1String(""), Qt::CaseInsensitive)) #endif diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationfactory.cpp b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationfactory.cpp index bd7661c2fee..2b61dbdc888 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationfactory.cpp +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationfactory.cpp @@ -50,7 +50,7 @@ QT_BEGIN_NAMESPACE #ifndef QT_NO_LIBRARY Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader, - (QWaylandServerBufferIntegrationFactoryInterface_iid, QLatin1String("/wayland-graphics-integration/client"), Qt::CaseInsensitive)) + (QWaylandServerBufferIntegrationFactoryInterface_iid, QLatin1String("/wayland-graphics-integration-client"), Qt::CaseInsensitive)) Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, directLoader, (QWaylandServerBufferIntegrationFactoryInterface_iid, QLatin1String(""), Qt::CaseInsensitive)) #endif diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/brcm-egl.pro b/src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/brcm-egl.pro index d98b7941b35..39dcf570dec 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/brcm-egl.pro +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/brcm-egl.pro @@ -1,4 +1,4 @@ -PLUGIN_TYPE = wayland-graphics-integration/client +PLUGIN_TYPE = wayland-graphics-integration-client load(qt_plugin) QT += waylandclient-private diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/drm-egl-server/drm-egl-server.pro b/src/plugins/platforms/wayland/plugins/hardwareintegration/drm-egl-server/drm-egl-server.pro index d282afc816c..3a57958683d 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/drm-egl-server/drm-egl-server.pro +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/drm-egl-server/drm-egl-server.pro @@ -1,4 +1,4 @@ -PLUGIN_TYPE = wayland-graphics-integration/client +PLUGIN_TYPE = wayland-graphics-integration-client load(qt_plugin) QT += waylandclient-private diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/wayland-egl.pro b/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/wayland-egl.pro index 0eca1d411c1..38989628886 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/wayland-egl.pro +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/wayland-egl.pro @@ -1,4 +1,4 @@ -PLUGIN_TYPE = wayland-graphics-integration/client +PLUGIN_TYPE = wayland-graphics-integration-client load(qt_plugin) QT += waylandclient-private diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-egl/xcomposite-egl.pro b/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-egl/xcomposite-egl.pro index 3129f844b08..97e642fbb66 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-egl/xcomposite-egl.pro +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-egl/xcomposite-egl.pro @@ -1,4 +1,4 @@ -PLUGIN_TYPE = wayland-graphics-integration/client +PLUGIN_TYPE = wayland-graphics-integration-client load(qt_plugin) QT += waylandclient-private diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-glx/xcomposite-glx.pro b/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-glx/xcomposite-glx.pro index 3146b3696ce..0080150ccd1 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-glx/xcomposite-glx.pro +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-glx/xcomposite-glx.pro @@ -1,4 +1,4 @@ -PLUGIN_TYPE = wayland-graphics-integration/client +PLUGIN_TYPE = wayland-graphics-integration-client load(qt_plugin) QT += waylandclient-private From def782f1a4a5246721fb315f40779d5c535e39e0 Mon Sep 17 00:00:00 2001 From: Andrew Knight Date: Mon, 21 Oct 2013 17:45:11 +0300 Subject: [PATCH 0118/1507] Clipboard: perform non-blocking reads from compositor Since the compositor recycles file descriptors when offering data to clients, it is possible that a client (or multiple clients) can attempt to read from the same FD simultaneously, creating a situation where one read can wait indefinitely for data. By making the pipe non-blocking, the client can gracefully time-out if data doesn't arrive in a timely manner. This commit also ensures that only one FD is open per client per offered mime type. Change-Id: If052e5bf8198df1cdc8fc4df360f83a77950b2f9 Reviewed-by: Robin Burchell --- .../platforms/wayland/qwaylanddataoffer.cpp | 68 +++++++++++++------ .../platforms/wayland/qwaylanddataoffer_p.h | 5 +- 2 files changed, 51 insertions(+), 22 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylanddataoffer.cpp b/src/plugins/platforms/wayland/qwaylanddataoffer.cpp index adaeb521465..f7233092851 100644 --- a/src/plugins/platforms/wayland/qwaylanddataoffer.cpp +++ b/src/plugins/platforms/wayland/qwaylanddataoffer.cpp @@ -84,7 +84,6 @@ QWaylandMimeData::QWaylandMimeData(QWaylandDataOffer *dataOffer, QWaylandDisplay : QInternalMimeData() , m_dataOffer(dataOffer) , m_display(display) - , m_offered_mime_types() { } @@ -94,46 +93,73 @@ QWaylandMimeData::~QWaylandMimeData() void QWaylandMimeData::appendFormat(const QString &mimeType) { - m_offered_mime_types.append(mimeType); + if (m_types.contains(mimeType)) + close(m_types.take(mimeType)); // Unconsumed data + m_data.remove(mimeType); // Clear previous contents + + int pipefd[2]; + if (::pipe2(pipefd, O_CLOEXEC|O_NONBLOCK) == -1) { + qWarning("QWaylandMimeData: pipe2() failed"); + return; + } + + m_dataOffer->receive(mimeType, pipefd[1]); + m_display->forceRoundTrip(); + close(pipefd[1]); + m_types.insert(mimeType, pipefd[0]); } bool QWaylandMimeData::hasFormat_sys(const QString &mimeType) const { - return m_offered_mime_types.contains(mimeType); + return m_types.contains(mimeType) || m_data.contains(mimeType); } QStringList QWaylandMimeData::formats_sys() const { - return m_offered_mime_types; + return m_types.keys() << m_data.keys(); } QVariant QWaylandMimeData::retrieveData_sys(const QString &mimeType, QVariant::Type type) const { Q_UNUSED(type); - if (m_offered_mime_types.isEmpty()) + if (m_data.contains(mimeType)) + return m_data.value(mimeType); + + if (!m_types.contains(mimeType)) return QVariant(); - int pipefd[2]; - if (qt_safe_pipe(pipefd, O_CLOEXEC) == -1) { - qWarning("QWaylandMimeData: pipe() failed"); - return QVariant(); - } - - m_dataOffer->receive(mimeType, pipefd[1]); - close(pipefd[1]); - -// m_display->forceRoundTrip(); - QByteArray content; - char buf[4096]; - int n; - while ((n = QT_READ(pipefd[0], &buf, sizeof buf)) > 0) { - content.append(buf, n); + int fd = m_types.take(mimeType); + if (readData(fd, content) != 0) { + qWarning("QWaylandDataOffer: error reading data for mimeType %s", qPrintable(mimeType)); + content = QByteArray(); } - close(pipefd[0]); + close(fd); + m_data.insert(mimeType, content); return content; } +int QWaylandMimeData::readData(int fd, QByteArray &data) const +{ + char buf[4096]; + int retryCount = 0; + int n; + while (true) { + n = QT_READ(fd, buf, sizeof buf); + if (n == -1 && (errno == EAGAIN || errno == EWOULDBLOCK) && ++retryCount < 1000) + usleep(1000); + else + break; + } + if (retryCount >= 1000) + qWarning("QWaylandDataOffer: timeout reading from pipe"); + if (n > 0) { + data.append(buf, n); + n = readData(fd, data); + } + return n; +} + QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylanddataoffer_p.h b/src/plugins/platforms/wayland/qwaylanddataoffer_p.h index ab34e177f1a..9f5b6cf1e30 100644 --- a/src/plugins/platforms/wayland/qwaylanddataoffer_p.h +++ b/src/plugins/platforms/wayland/qwaylanddataoffer_p.h @@ -82,9 +82,12 @@ protected: QVariant retrieveData_sys(const QString &mimeType, QVariant::Type type) const Q_DECL_OVERRIDE; private: + int readData(int fd, QByteArray &data) const; + mutable QWaylandDataOffer *m_dataOffer; QWaylandDisplay *m_display; - QStringList m_offered_mime_types; + mutable QHash m_types; + mutable QHash m_data; }; QT_END_NAMESPACE From 7fb846e5f2fff72fbb16d27e8e6904ed67b311dc Mon Sep 17 00:00:00 2001 From: Giulio Camuffo Date: Thu, 24 Apr 2014 13:59:39 +0300 Subject: [PATCH 0119/1507] Discard the selection and drag source when not active anymore If another client sets a selection or starts a drag the active wl_data_source, if any, gets a 'cancelled' event. We must listen to this and discard the wl_data_source, else e.g. checking the clipboard content will still return the data of the source instead of the current wl_data_offer. Change-Id: I80b202baf95fbc8abe19496a991cb30bc0b78bb0 Reviewed-by: Gunnar Sletta Reviewed-by: Robin Burchell --- src/plugins/platforms/wayland/qwaylanddatadevice.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylanddatadevice.cpp b/src/plugins/platforms/wayland/qwaylanddatadevice.cpp index 2d6a6f4b6cf..f5056f6d05f 100644 --- a/src/plugins/platforms/wayland/qwaylanddatadevice.cpp +++ b/src/plugins/platforms/wayland/qwaylanddatadevice.cpp @@ -84,6 +84,8 @@ QWaylandDataSource *QWaylandDataDevice::selectionSource() const void QWaylandDataDevice::setSelectionSource(QWaylandDataSource *source) { m_selectionSource.reset(source); + if (source) + connect(source, &QWaylandDataSource::cancelled, this, &QWaylandDataDevice::selectionSourceCancelled); set_selection(source ? source->object() : 0, 0 /* TODO m_display->serial() */); } @@ -95,7 +97,7 @@ QWaylandDataOffer *QWaylandDataDevice::dragOffer() const void QWaylandDataDevice::startDrag(QMimeData *mimeData, QWaylandWindow *icon) { m_dragSource.reset(new QWaylandDataSource(m_display->dndSelectionHandler(), mimeData)); - + connect(m_dragSource.data(), &QWaylandDataSource::cancelled, this, &QWaylandDataDevice::dragSourceCancelled); QWaylandWindow *origin = m_display->currentInputDevice()->pointerFocus(); start_drag(m_dragSource->object(), origin->object(), icon->object(), m_display->currentInputDevice()->serial()); From e295df8b1dde4cb7fed6b03f8ef87557d0e79f5b Mon Sep 17 00:00:00 2001 From: Giulio Camuffo Date: Fri, 11 Apr 2014 15:09:45 +0300 Subject: [PATCH 0120/1507] Send the native codes of the key events Change-Id: I58343ebf931d946a9d1dfc1f0949ba296d97ec52 Reviewed-by: Gunnar Sletta Reviewed-by: Robin Burchell --- .../platforms/wayland/qwaylandinputdevice.cpp | 64 +++++++++++-------- 1 file changed, 36 insertions(+), 28 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index 29e993646ad..cce2d979015 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -81,6 +81,7 @@ public: , mXkbState(0) #endif , mFocusCallback(0) + , mNativeModifiers(0) { #ifndef QT_NO_WAYLAND_XKB xkb_rule_names names; @@ -139,11 +140,15 @@ public: xkb_state *mXkbState; #endif struct wl_callback *mFocusCallback; + uint32_t mNativeModifiers; int mRepeatKey; uint32_t mRepeatCode; uint32_t mRepeatTime; QString mRepeatText; +#ifndef QT_NO_WAYLAND_XKB + xkb_keysym_t mRepeatSym; +#endif static const wl_callback_listener callback; static void focusCallback(void *data, struct wl_callback *callback, uint32_t time); @@ -749,44 +754,37 @@ void QWaylandInputDevice::Keyboard::keyboard_key(uint32_t serial, uint32_t time, QString text; int qtkey = key + 8; // qt-compositor substracts 8 for some reason -#ifndef QT_NO_WAYLAND_XKB - if (!mXkbMap) - return; - - const xkb_keysym_t *syms; - uint32_t numSyms = xkb_key_get_syms(mXkbState, code, &syms); - xkb_state_update_key(mXkbState, code, - isDown ? XKB_KEY_DOWN : XKB_KEY_UP); - if (!window) { // We destroyed the keyboard focus surface, but the server // didn't get the message yet. return; } - if (numSyms == 1) { - xkb_keysym_t sym = syms[0]; - Qt::KeyboardModifiers modifiers = mParent->modifiers(); +#ifndef QT_NO_WAYLAND_XKB + if (!mXkbMap) + return; - uint utf32 = xkb_keysym_to_utf32(sym); - text = QString::fromUcs4(&utf32, 1); + const xkb_keysym_t sym = xkb_state_key_get_one_sym(mXkbState, code); + xkb_state_update_key(mXkbState, code, isDown ? XKB_KEY_DOWN : XKB_KEY_UP); - qtkey = keysymToQtKey(sym, modifiers, text); + Qt::KeyboardModifiers modifiers = mParent->modifiers(); - QWindowSystemInterface::handleExtendedKeyEvent(window->window(), - time, type, qtkey, - modifiers, - code, 0, 0, text); - } + uint utf32 = xkb_keysym_to_utf32(sym); + text = QString::fromUcs4(&utf32, 1); + + qtkey = keysymToQtKey(sym, modifiers, text); + + QWindowSystemInterface::handleExtendedKeyEvent(window->window(), + time, type, qtkey, + modifiers, + code, sym, mNativeModifiers, text); #else // Generic fallback for single hard keys: Assume 'key' is a Qt key code. - if (window) { - QWindowSystemInterface::handleExtendedKeyEvent(window->window(), - time, type, - qtkey, - Qt::NoModifier, - code, 0, 0); - } + QWindowSystemInterface::handleExtendedKeyEvent(window->window(), + time, type, + qtkey, + Qt::NoModifier, + code, 0, 0); #endif if (state == WL_KEYBOARD_KEY_STATE_PRESSED) { @@ -794,6 +792,9 @@ void QWaylandInputDevice::Keyboard::keyboard_key(uint32_t serial, uint32_t time, mRepeatCode = code; mRepeatTime = time; mRepeatText = text; +#ifndef QT_NO_WAYLAND_XKB + mRepeatSym = sym; +#endif mParent->mRepeatTimer.setInterval(400); mParent->mRepeatTimer.start(); } else if (mRepeatCode == code) { @@ -807,7 +808,13 @@ void QWaylandInputDevice::repeatKey() QWindowSystemInterface::handleExtendedKeyEvent(mKeyboard->mFocus->window(), mKeyboard->mRepeatTime, QEvent::KeyPress, mKeyboard->mRepeatKey, modifiers(), - mKeyboard->mRepeatCode, 0, 0, mKeyboard->mRepeatText); + mKeyboard->mRepeatCode, +#ifndef QT_NO_WAYLAND_XKB + mKeyboard->mRepeatSym, mKeyboard->mNativeModifiers, +#else + 0, 0, +#endif + mKeyboard->mRepeatText, true); } void QWaylandInputDevice::Keyboard::keyboard_modifiers(uint32_t serial, @@ -822,6 +829,7 @@ void QWaylandInputDevice::Keyboard::keyboard_modifiers(uint32_t serial, xkb_state_update_mask(mXkbState, mods_depressed, mods_latched, mods_locked, 0, 0, group); + mNativeModifiers = mods_depressed | mods_latched | mods_locked; #else Q_UNUSED(serial); Q_UNUSED(mods_depressed); From bff6e88d73c4b3f60d4aa324e22ff4e6c9be7b89 Mon Sep 17 00:00:00 2001 From: Giulio Camuffo Date: Sun, 11 May 2014 18:25:31 +0300 Subject: [PATCH 0121/1507] Fix resizing of shm apps Change-Id: Iad94691317bde38603d9143f951b1b69326ab12e Reviewed-by: Laszlo Agocs --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 265d651c8af..f51100a54b1 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -81,7 +81,7 @@ QWaylandWindow::QWaylandWindow(QWindow *window) , mRequestResizeSent(false) , mCanResize(true) , mResizeDirty(false) - , mResizeAfterSwap(!qEnvironmentVariableIsSet("QT_WAYLAND_RESIZE_AFTER_SWAP")) + , mResizeAfterSwap(qEnvironmentVariableIsSet("QT_WAYLAND_RESIZE_AFTER_SWAP")) , mSentInitialResize(false) , mMouseDevice(0) , mMouseSerial(0) @@ -198,7 +198,7 @@ void QWaylandWindow::setGeometry(const QRect &rect) if (mWindowDecoration && window()->isVisible()) mWindowDecoration->update(); - if (mResizeAfterSwap) + if (mResizeAfterSwap && windowType() == Egl) mResizeDirty = true; else QWindowSystemInterface::handleGeometryChange(window(), geometry()); From 75a2fc72aad6482bd8147afccfcd9b48fc9f6d89 Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Thu, 22 May 2014 11:40:08 +0200 Subject: [PATCH 0122/1507] Avoid virtual calls in constructors. QWaylandWindow::setGeometry() is a virtual call and internally it would call windowType() which is pure virtual, so calling it from the constructor won't work. Instead, set geometry explicitly from the constructor and call setGeometry() on setVisible(true). This also merges it so we send one expose event (with correct x/y offset) on geometry change + show. Change-Id: I1d21664c982005c60c8d73740e43b3a463bac4a8 Reviewed-by: Giulio Camuffo --- .../platforms/wayland/qwaylandwindow.cpp | 35 +++++++++++-------- .../platforms/wayland/qwaylandwindow_p.h | 1 + 2 files changed, 21 insertions(+), 15 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index f51100a54b1..216c2551df6 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -120,7 +120,7 @@ QWaylandWindow::QWaylandWindow(QWindow *window) } setWindowFlags(window->flags()); - setGeometry(window->geometry()); + setGeometry_helper(window->geometry()); setWindowStateInternal(window->windowState()); handleContentOrientationChange(window->contentOrientation()); } @@ -186,7 +186,7 @@ void QWaylandWindow::setWindowIcon(const QIcon &icon) mWindowDecoration->update(); } -void QWaylandWindow::setGeometry(const QRect &rect) +void QWaylandWindow::setGeometry_helper(const QRect &rect) { QPlatformWindow::setGeometry(QRect(rect.x(), rect.y(), qBound(window()->minimumWidth(), rect.width(), window()->maximumWidth()), @@ -194,15 +194,25 @@ void QWaylandWindow::setGeometry(const QRect &rect) if (shellSurface() && window()->transientParent() && window()->type() != Qt::Popup) shellSurface()->updateTransientParent(window()->transientParent()); +} - if (mWindowDecoration && window()->isVisible()) - mWindowDecoration->update(); +void QWaylandWindow::setGeometry(const QRect &rect) +{ + setGeometry_helper(rect); - if (mResizeAfterSwap && windowType() == Egl) - mResizeDirty = true; - else - QWindowSystemInterface::handleGeometryChange(window(), geometry()); - QWindowSystemInterface::handleExposeEvent(window(), QRegion(geometry())); + if (window()->isVisible()) { + if (mWindowDecoration) + mWindowDecoration->update(); + + if (mResizeAfterSwap && windowType() == Egl && mSentInitialResize) + mResizeDirty = true; + else + QWindowSystemInterface::handleGeometryChange(window(), geometry()); + + QWindowSystemInterface::handleExposeEvent(window(), QRect(QPoint(), geometry().size())); + + mSentInitialResize = true; + } } void QWaylandWindow::setVisible(bool visible) @@ -217,12 +227,7 @@ void QWaylandWindow::setVisible(bool visible) mShellSurface->setPopup(transientParent(), mMouseDevice, mMouseSerial); } - if (!mSentInitialResize) { - QWindowSystemInterface::handleGeometryChange(window(), geometry()); - mSentInitialResize = true; - } - - QWindowSystemInterface::handleExposeEvent(window(), QRect(QPoint(), geometry().size())); + setGeometry(window()->geometry()); // Don't flush the events here, or else the newly visible window may start drawing, but since // there was no frame before it will be stuck at the waitForFrameSync() in // QWaylandShmBackingStore::beginPaint(). diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index fe6f319087b..ce89e3d6b98 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -207,6 +207,7 @@ protected: private: bool setWindowStateInternal(Qt::WindowState flags); + void setGeometry_helper(const QRect &rect); void handleMouseEventWithDecoration(QWaylandInputDevice *inputDevice, ulong timestamp, From 8d6b106a8c842c825644d5d0b564d18b71e468ab Mon Sep 17 00:00:00 2001 From: Giulio Camuffo Date: Wed, 4 Jun 2014 10:21:06 +0200 Subject: [PATCH 0123/1507] Disable headers precompilation qtbase's cb09e1e enables precompiled headers by default. Unfortunately qmake tries to precompile them as C headers as a dependency of the .c protocol files we have, failing the build. Quick and easy solution: disable them alltogether. Change-Id: I96a4f4fd1fe0d3a83bb990408f1f3994650d96c5 Reviewed-by: Shawn Rutledge Reviewed-by: Thiago Macieira --- src/plugins/platforms/wayland/client.pro | 1 + 1 file changed, 1 insertion(+) diff --git a/src/plugins/platforms/wayland/client.pro b/src/plugins/platforms/wayland/client.pro index 10cbd31a8e1..f70c5497306 100644 --- a/src/plugins/platforms/wayland/client.pro +++ b/src/plugins/platforms/wayland/client.pro @@ -7,6 +7,7 @@ MODULE_PLUGIN_TYPES = wayland-graphics-integration-client load(qt_module) +CONFIG -= precompile_header CONFIG += link_pkgconfig qpa/genericunixfontdatabase wayland-scanner !equals(QT_WAYLAND_GL_CONFIG, nogl) { From 806773681ef4364122efa0604728736445d0432c Mon Sep 17 00:00:00 2001 From: Philippe Coval Date: Fri, 25 Apr 2014 10:31:42 +0200 Subject: [PATCH 0124/1507] Add xdg-shell protocol file version 1.4.0 Source: http://cgit.freedesktop.org/wayland/weston/plain/protocol/xdg-shell.xml?id=1.4.0 This file will need to be refreshed on protocol update until xdg-shell land in wayland's public headers Task-number: QTBUG-38633/part/1of2 Change-Id: I397d863dcfc2223ac6eb234c37dbcd7449eced58 Reviewed-by: Giulio Camuffo --- src/3rdparty/wayland/protocols/xdg-shell.xml | 438 +++++++++++++++++++ 1 file changed, 438 insertions(+) create mode 100644 src/3rdparty/wayland/protocols/xdg-shell.xml diff --git a/src/3rdparty/wayland/protocols/xdg-shell.xml b/src/3rdparty/wayland/protocols/xdg-shell.xml new file mode 100644 index 00000000000..4e5cff8df96 --- /dev/null +++ b/src/3rdparty/wayland/protocols/xdg-shell.xml @@ -0,0 +1,438 @@ + + + + + Copyright © 2008-2013 Kristian Høgsberg + Copyright © 2013 Rafael Antognolli + Copyright © 2013 Jasper St. Pierre + Copyright © 2010-2013 Intel Corporation + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that copyright notice and this permission + notice appear in supporting documentation, and that the name of + the copyright holders not be used in advertising or publicity + pertaining to distribution of the software without specific, + written prior permission. The copyright holders make no + representations about the suitability of this software for any + purpose. It is provided "as is" without express or implied + warranty. + + THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS + SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND + FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY + SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN + AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF + THIS SOFTWARE. + + + + + This interface is implemented by servers that provide + desktop-style user interfaces. + + It allows clients to associate a xdg_surface with + a basic surface. + + + + + Use this enum to check the protocol version, and it will be updated + automatically. + + + + + + + + Use this request in order to enable use of this interface. + + Understand and agree that one is using an unstable interface, + that will likely change in the future, breaking the API. + + + + + + + Create a shell surface for an existing surface. + + Only one shell or popup surface can be associated with a given + surface. + + + + + + + + Create a popup surface for an existing surface. + + Only one shell or popup surface can be associated with a given + surface. + + + + + + + + + + + + + + + + An interface that may be implemented by a wl_surface, for + implementations that provide a desktop-style user interface. + + It provides requests to treat surfaces like windows, allowing to set + properties like maximized, fullscreen, minimized, and to move and resize + them, and associate metadata like title and app id. + + On the server side the object is automatically destroyed when + the related wl_surface is destroyed. On client side, + xdg_surface.destroy() must be called before destroying + the wl_surface object. + + + + + The xdg_surface interface is removed from the wl_surface object + that was turned into a xdg_surface with + xdg_shell.get_xdg_surface request. The xdg_surface properties, + like maximized and fullscreen, are lost. The wl_surface loses + its role as a xdg_surface. The wl_surface is unmapped. + + + + + + Setting a surface as transient of another means that it is child + of another surface. + + Child surfaces are stacked above their parents, and will be + unmapped if the parent is unmapped too. They should not appear + on task bars and alt+tab. + + + + + + + Set a short title for the surface. + + This string may be used to identify the surface in a task bar, + window list, or other user interface elements provided by the + compositor. + + The string must be encoded in UTF-8. + + + + + + + Set an id for the surface. + + The app id identifies the general class of applications to which + the surface belongs. + + It should be the ID that appears in the new desktop entry + specification, the interface name. + + + + + + + A client must respond to a ping event with a pong request or + the client may be deemed unresponsive. + + + + + + + Ping a client to check if it is receiving events and sending + requests. A client is expected to reply with a pong request. + + + + + + + Start a pointer-driven move of the surface. + + This request must be used in response to a button press event. + The server may ignore move requests depending on the state of + the surface (e.g. fullscreen or maximized). + + + + + + + + These values are used to indicate which edge of a surface + is being dragged in a resize operation. The server may + use this information to adapt its behavior, e.g. choose + an appropriate cursor image. + + + + + + + + + + + + + + + Start a pointer-driven resizing of the surface. + + This request must be used in response to a button press event. + The server may ignore resize requests depending on the state of + the surface (e.g. fullscreen or maximized). + + + + + + + + + The configure event asks the client to resize its surface. + + The size is a hint, in the sense that the client is free to + ignore it if it doesn't resize, pick a smaller size (to + satisfy aspect ratio or resize in steps of NxM pixels). + + The edges parameter provides a hint about how the surface + was resized. The client may use this information to decide + how to adjust its content to the new size (e.g. a scrolling + area might adjust its content position to leave the viewable + content unmoved). Valid edge values are from resize_edge enum. + + The client is free to dismiss all but the last configure + event it received. + + The width and height arguments specify the size of the window + in surface local coordinates. + + + + + + + + + + Set the default output used by this surface when it is first mapped. + + If this value is NULL (default), it's up to the compositor to choose + which display will be used to map this surface. + + When fullscreen or maximized state are set on this surface, and it + wasn't mapped yet, the output set with this method will be used. + Otherwise, the output where the surface is currently mapped will be + used. + + + + + + + Event sent from the compositor to the client requesting that the client + goes to a fullscreen state. It's the client job to call set_fullscreen + and really trigger the fullscreen state. + + + + + + Event sent from the compositor to the client requesting that the client + leaves the fullscreen state. It's the client job to call + unset_fullscreen and really leave the fullscreen state. + + + + + + Set the surface as fullscreen. + + After this request, the compositor should send a configure event + informing the output size. + + This request informs the compositor that the next attached buffer + committed will be in a fullscreen state. The buffer size should be the + same size as the size informed in the configure event, if the client + doesn't want to leave any empty area. + + In other words: the next attached buffer after set_maximized is the new + maximized buffer. And the surface will be positioned at the maximized + position on commit. + + A simple way to synchronize and wait for the correct configure event is + to use a wl_display.sync request right after the set_fullscreen + request. When the sync callback returns, the last configure event + received just before it will be the correct one, and should contain the + right size for the surface to maximize. + + Setting one state won't unset another state. Use + xdg_surface.unset_fullscreen for unsetting it. + + + + + + Unset the surface fullscreen state. + + Same negotiation as set_fullscreen must be used. + + + + + + Event sent from the compositor to the client requesting that the client + goes to a maximized state. It's the client job to call set_maximized + and really trigger the maximized state. + + + + + + Event sent from the compositor to the client requesting that the client + leaves the maximized state. It's the client job to call unset_maximized + and really leave the maximized state. + + + + + + Set the surface as maximized. + + After this request, the compositor will send a configure event + informing the output size minus panel and other MW decorations. + + This request informs the compositor that the next attached buffer + committed will be in a maximized state. The buffer size should be the + same size as the size informed in the configure event, if the client + doesn't want to leave any empty area. + + In other words: the next attached buffer after set_maximized is the new + maximized buffer. And the surface will be positioned at the maximized + position on commit. + + A simple way to synchronize and wait for the correct configure event is + to use a wl_display.sync request right after the set_maximized request. + When the sync callback returns, the last configure event received just + before it will be the correct one, and should contain the right size + for the surface to maximize. + + Setting one state won't unset another state. Use + xdg_surface.unset_maximized for unsetting it. + + + + + + Unset the surface maximized state. + + Same negotiation as set_maximized must be used. + + + + + + Set the surface minimized state. + + Setting one state won't unset another state. + + + + + + The focused_set event is sent when this surface has been + activated. Window decorations should be updated accordingly. + + + + + + The focused_unset event is sent when this surface has been + deactivated, because another surface has been activated. Window + decorations should be updated accordingly. + + + + + + + An interface that may be implemented by a wl_surface, for + implementations that provide a desktop-style popups/menus. A popup + surface is a transient surface with an added pointer grab. + + An existing implicit grab will be changed to owner-events mode, + and the popup grab will continue after the implicit grab ends + (i.e. releasing the mouse button does not cause the popup to be + unmapped). + + The popup grab continues until the window is destroyed or a mouse + button is pressed in any other clients window. A click in any of + the clients surfaces is reported as normal, however, clicks in + other clients surfaces will be discarded and trigger the callback. + + The x and y arguments specify the locations of the upper left + corner of the surface relative to the upper left corner of the + parent surface, in surface local coordinates. + + xdg_popup surfaces are always transient for another surface. + + + + + The xdg_surface interface is removed from the wl_surface object + that was turned into a xdg_surface with + xdg_shell.get_xdg_surface request. The xdg_surface properties, + like maximized and fullscreen, are lost. The wl_surface loses + its role as a xdg_surface. The wl_surface is unmapped. + + + + + + A client must respond to a ping event with a pong request or + the client may be deemed unresponsive. + + + + + + + Ping a client to check if it is receiving events and sending + requests. A client is expected to reply with a pong request. + + + + + + + The popup_done event is sent out when a popup grab is broken, + that is, when the users clicks a surface that doesn't belong + to the client owning the popup surface. + + + + + + From 1fc185140d552ab6a3cd9b60880cbbf1c486e5f5 Mon Sep 17 00:00:00 2001 From: Philippe Coval Date: Wed, 26 Mar 2014 10:16:01 +0100 Subject: [PATCH 0125/1507] Add minimize feature to QWindow using wayland's xdg-shell The feature is disabled by default, and can be enabled at runtime by exporting QT_WAYLAND_USE_XDG_SHELL env variable. This patch relies on presence of protocol file which has been imported from weston-1.4.0 sources, until the xdg-shell is merge into wayland itself. Because xdg-shell is experimental, code fallback to WaylandShell if no XdgShell but keep in mind those shells are exclusive. Since xdg-shell and wayland-shell share most of the API, some factorization is done by an (empty) abstraction class to keep the code more readable. Despite xdg-shell introduces new popups concept, they're not used on this change for maitainance purpose. Notes: * This change depends on presence of xdg-shell protocol file. * You can check a demo video (qt-tizen-cinematic-experience-20140430-rzr) of the test case at : https://www.youtube.com/watch?v=pY_XXvKc_0E# * Use Super+Tab to show window again if hidden Task-number: QTBUG-38633/part/2of2 Change-Id: I2d7ed85bea1847d82439fdfc893a3dbb2581c14a Reviewed-by: Giulio Camuffo --- src/plugins/platforms/wayland/client.pro | 5 + .../platforms/wayland/qwaylanddisplay.cpp | 5 + .../platforms/wayland/qwaylanddisplay_p.h | 4 + .../wayland/qwaylandshellsurface.cpp | 134 ------------- .../wayland/qwaylandshellsurface_p.h | 40 ++-- .../platforms/wayland/qwaylandwindow.cpp | 40 +++- .../wayland/qwaylandwlshellsurface.cpp | 186 ++++++++++++++++++ .../wayland/qwaylandwlshellsurface_p.h | 101 ++++++++++ .../platforms/wayland/qwaylandxdgsurface.cpp | 173 ++++++++++++++++ .../platforms/wayland/qwaylandxdgsurface_p.h | 105 ++++++++++ 10 files changed, 625 insertions(+), 168 deletions(-) create mode 100644 src/plugins/platforms/wayland/qwaylandwlshellsurface.cpp create mode 100644 src/plugins/platforms/wayland/qwaylandwlshellsurface_p.h create mode 100644 src/plugins/platforms/wayland/qwaylandxdgsurface.cpp create mode 100644 src/plugins/platforms/wayland/qwaylandxdgsurface_p.h diff --git a/src/plugins/platforms/wayland/client.pro b/src/plugins/platforms/wayland/client.pro index f70c5497306..d1ab27c6bd0 100644 --- a/src/plugins/platforms/wayland/client.pro +++ b/src/plugins/platforms/wayland/client.pro @@ -42,6 +42,7 @@ WAYLANDCLIENTSOURCES += \ ../extensions/qtkey-extension.xml \ ../extensions/windowmanager.xml \ ../3rdparty/protocol/text.xml \ + ../3rdparty/protocol/xdg-shell.xml \ SOURCES += qwaylandintegration.cpp \ qwaylandnativeinterface.cpp \ @@ -58,6 +59,8 @@ SOURCES += qwaylandintegration.cpp \ qwaylanddatadevicemanager.cpp \ qwaylanddatasource.cpp \ qwaylandshellsurface.cpp \ + qwaylandwlshellsurface.cpp \ + qwaylandxdgsurface.cpp \ qwaylandextendedoutput.cpp \ qwaylandextendedsurface.cpp \ qwaylandsubsurface.cpp \ @@ -86,6 +89,8 @@ HEADERS += qwaylandintegration_p.h \ qwaylanddatadevicemanager_p.h \ qwaylanddatasource_p.h \ qwaylandshellsurface_p.h \ + qwaylandwlshellsurface_p.h \ + qwaylandxdgsurface_p.h \ qwaylandextendedoutput_p.h \ qwaylandextendedsurface_p.h \ qwaylandsubsurface_p.h \ diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index 3576c0bd2aa..88b4e38893a 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -61,6 +61,7 @@ #include "qwaylandqtkey_p.h" #include +#include #include #include @@ -206,6 +207,10 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin mCompositor.init(registry, id); } else if (interface == QStringLiteral("wl_shm")) { mShm = static_cast(wl_registry_bind(registry, id, &wl_shm_interface,1)); + } else if (interface == QStringLiteral("xdg_shell") + && qEnvironmentVariableIsSet("QT_WAYLAND_USE_XDG_SHELL")) { + mShellXdg.reset(new QtWayland::xdg_shell(registry, id)); + mShellXdg->use_unstable_version(QtWayland::xdg_shell::version_current); } else if (interface == QStringLiteral("wl_shell")){ mShell.reset(new QtWayland::wl_shell(registry, id)); } else if (interface == QStringLiteral("wl_seat")) { diff --git a/src/plugins/platforms/wayland/qwaylanddisplay_p.h b/src/plugins/platforms/wayland/qwaylanddisplay_p.h index 40cb2b2c5f9..cf5dfc21d22 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay_p.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay_p.h @@ -51,6 +51,7 @@ #include #include +#include struct wl_cursor_image; @@ -78,6 +79,7 @@ namespace QtWayland { class qt_sub_surface_extension; class qt_surface_extension; class wl_text_input_manager; + class xdg_shell; } typedef void (*RegistryListener)(void *data, @@ -113,6 +115,7 @@ public: QtWayland::wl_compositor *compositor() { return &mCompositor; } QtWayland::wl_shell *shell() { return mShell.data(); } + QtWayland::xdg_shell *shellXdg() { return mShellXdg.data(); } QList inputDevices() const { return mInputDevices; } QWaylandInputDevice *defaultInputDevice() const; @@ -168,6 +171,7 @@ private: QThread *mEventThread; QWaylandEventThread *mEventThreadObject; QScopedPointer mShell; + QScopedPointer mShellXdg; QList mScreens; QList mInputDevices; QList mRegistryListeners; diff --git a/src/plugins/platforms/wayland/qwaylandshellsurface.cpp b/src/plugins/platforms/wayland/qwaylandshellsurface.cpp index b7a819fd303..80e509b15e3 100644 --- a/src/plugins/platforms/wayland/qwaylandshellsurface.cpp +++ b/src/plugins/platforms/wayland/qwaylandshellsurface.cpp @@ -40,137 +40,3 @@ ****************************************************************************/ #include "qwaylandshellsurface_p.h" - -#include "qwaylanddisplay_p.h" -#include "qwaylandwindow_p.h" -#include "qwaylandinputdevice_p.h" -#include "qwaylanddecoration_p.h" -#include "qwaylandscreen_p.h" - -#include - -QT_BEGIN_NAMESPACE - -QWaylandShellSurface::QWaylandShellSurface(struct ::wl_shell_surface *shell_surface, QWaylandWindow *window) - : QtWayland::wl_shell_surface(shell_surface) - , m_window(window) - , m_maximized(false) - , m_fullscreen(false) -{ -} - -QWaylandShellSurface::~QWaylandShellSurface() -{ - wl_shell_surface_destroy(object()); -} - -void QWaylandShellSurface::resize(QWaylandInputDevice *inputDevice, enum wl_shell_surface_resize edges) -{ - resize(inputDevice->wl_seat(), - inputDevice->serial(), - edges); -} - -void QWaylandShellSurface::move(QWaylandInputDevice *inputDevice) -{ - move(inputDevice->wl_seat(), - inputDevice->serial()); -} - -void QWaylandShellSurface::setMaximized() -{ - m_maximized = true; - m_size = m_window->window()->geometry().size(); - set_maximized(0); -} - -void QWaylandShellSurface::setFullscreen() -{ - m_fullscreen = true; - m_size = m_window->window()->geometry().size(); - set_fullscreen(WL_SHELL_SURFACE_FULLSCREEN_METHOD_DEFAULT, 0, 0); -} - -void QWaylandShellSurface::setNormal() -{ - if (m_fullscreen || m_maximized) { - m_fullscreen = m_maximized = false; - setTopLevel(); - QMargins m = m_window->frameMargins(); - m_window->configure(0, m_size.width() + m.left() + m.right(), m_size.height() + m.top() + m.bottom()); - } -} - -void QWaylandShellSurface::setMinimized() -{ - // TODO: There's no wl_shell_surface API for this -} - -void QWaylandShellSurface::setTopLevel() -{ - set_toplevel(); -} - -void QWaylandShellSurface::updateTransientParent(QWindow *parent) -{ - QWaylandWindow *parent_wayland_window = static_cast(parent->handle()); - if (!parent_wayland_window) - return; - - // set_transient expects a position relative to the parent - QPoint transientPos = m_window->geometry().topLeft(); // this is absolute - QWindow *parentWin = m_window->window()->transientParent(); - transientPos -= parentWin->geometry().topLeft(); - if (parent_wayland_window->decoration()) { - transientPos.setX(transientPos.x() + parent_wayland_window->decoration()->margins().left()); - transientPos.setY(transientPos.y() + parent_wayland_window->decoration()->margins().top()); - } - - uint32_t flags = 0; - Qt::WindowFlags wf = m_window->window()->flags(); - if (wf.testFlag(Qt::ToolTip) - || wf.testFlag(Qt::WindowTransparentForInput)) - flags |= WL_SHELL_SURFACE_TRANSIENT_INACTIVE; - - set_transient(parent_wayland_window->object(), - transientPos.x(), - transientPos.y(), - flags); -} - -void QWaylandShellSurface::setPopup(QWaylandWindow *parent, QWaylandInputDevice *device, int serial) -{ - QWaylandWindow *parent_wayland_window = parent; - if (!parent_wayland_window) - return; - - // set_popup expects a position relative to the parent - QPoint transientPos = m_window->geometry().topLeft(); // this is absolute - transientPos -= parent_wayland_window->geometry().topLeft(); - if (parent_wayland_window->decoration()) { - transientPos.setX(transientPos.x() + parent_wayland_window->decoration()->margins().left()); - transientPos.setY(transientPos.y() + parent_wayland_window->decoration()->margins().top()); - } - - set_popup(device->wl_seat(), serial, parent_wayland_window->object(), - transientPos.x(), transientPos.y(), 0); -} - -void QWaylandShellSurface::shell_surface_ping(uint32_t serial) -{ - pong(serial); -} - -void QWaylandShellSurface::shell_surface_configure(uint32_t edges, - int32_t width, - int32_t height) -{ - m_window->configure(edges, width, height); -} - -void QWaylandShellSurface::shell_surface_popup_done() -{ - QCoreApplication::postEvent(m_window->window(), new QCloseEvent()); -} - -QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandshellsurface_p.h b/src/plugins/platforms/wayland/qwaylandshellsurface_p.h index 2477c3f0889..2f59f60c19b 100644 --- a/src/plugins/platforms/wayland/qwaylandshellsurface_p.h +++ b/src/plugins/platforms/wayland/qwaylandshellsurface_p.h @@ -55,39 +55,25 @@ class QWaylandWindow; class QWaylandInputDevice; class QWindow; -class Q_WAYLAND_CLIENT_EXPORT QWaylandShellSurface : public QtWayland::wl_shell_surface +class Q_WAYLAND_CLIENT_EXPORT QWaylandShellSurface { public: - QWaylandShellSurface(struct ::wl_shell_surface *shell_surface, QWaylandWindow *window); - ~QWaylandShellSurface(); + virtual ~QWaylandShellSurface() {} + virtual void resize(QWaylandInputDevice * /*inputDevice*/, enum wl_shell_surface_resize /*edges*/) + {} - using QtWayland::wl_shell_surface::resize; - void resize(QWaylandInputDevice *inputDevice, enum wl_shell_surface_resize edges); - - using QtWayland::wl_shell_surface::move; - void move(QWaylandInputDevice *inputDevice); + virtual void move(QWaylandInputDevice * /*inputDevice*/) {} + virtual void setTitle(const QString & /*title*/) {} + virtual void setAppId(const QString & /*appId*/) {} private: - void setMaximized(); - void setFullscreen(); - void setNormal(); - void setMinimized(); - - void setTopLevel(); - void updateTransientParent(QWindow *parent); - void setPopup(QWaylandWindow *parent, QWaylandInputDevice *device, int serial); - - QWaylandWindow *m_window; - bool m_maximized; - bool m_fullscreen; - QSize m_size; - - void shell_surface_ping(uint32_t serial) Q_DECL_OVERRIDE; - void shell_surface_configure(uint32_t edges, - int32_t width, - int32_t height) Q_DECL_OVERRIDE; - void shell_surface_popup_done() Q_DECL_OVERRIDE; + virtual void setMaximized() {} + virtual void setFullscreen() {} + virtual void setNormal() {} + virtual void setMinimized() {} + virtual void setTopLevel() {} + virtual void updateTransientParent(QWindow * /*parent*/) {} friend class QWaylandWindow; }; diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 216c2551df6..9a7b7f09eb0 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -46,6 +46,8 @@ #include "qwaylandinputdevice_p.h" #include "qwaylandscreen_p.h" #include "qwaylandshellsurface_p.h" +#include "qwaylandwlshellsurface_p.h" +#include "qwaylandxdgsurface_p.h" #include "qwaylandextendedsurface_p.h" #include "qwaylandsubsurface_p.h" #include "qwaylanddecoration_p.h" @@ -92,8 +94,16 @@ QWaylandWindow::QWaylandWindow(QWindow *window) static WId id = 1; mWindowId = id++; - if (mDisplay->shell() && window->type() & Qt::Window && !(window->flags() & Qt::BypassWindowManagerHint)) - mShellSurface = new QWaylandShellSurface(mDisplay->shell()->get_shell_surface(object()), this); + if (!(window->flags() & Qt::BypassWindowManagerHint)) { + if (mDisplay->shellXdg()) { + if (window->type() & Qt::Window) { + mShellSurface = new QWaylandXdgSurface(mDisplay->shellXdg()->get_xdg_surface(object()), this); + } + } else if (mDisplay->shell() && window->type() & Qt::Window) { + mShellSurface = new QWaylandWlShellSurface(mDisplay->shell()->get_shell_surface(object()), this); + } + } + if (mDisplay->windowExtension()) mExtendedWindow = new QWaylandExtendedSurface(this, mDisplay->windowExtension()->get_extended_surface(object())); if (mDisplay->subSurfaceExtension()) @@ -101,12 +111,12 @@ QWaylandWindow::QWaylandWindow(QWindow *window) if (mShellSurface) { // Set initial surface title - mShellSurface->set_title(window->title()); + mShellSurface->setTitle(window->title()); // Set surface class to the .desktop file name (obtained from executable name) QFileInfo exeFileInfo(qApp->applicationFilePath()); QString className = exeFileInfo.baseName() + QLatin1String(".desktop"); - mShellSurface->set_class(className); + mShellSurface->setAppId(className); } if (QPlatformWindow::parent() && mSubSurfaceWindow) { @@ -171,7 +181,7 @@ void QWaylandWindow::setParent(const QPlatformWindow *parent) void QWaylandWindow::setWindowTitle(const QString &title) { if (mShellSurface) { - mShellSurface->set_title(title); + mShellSurface->setTitle(title); } if (mWindowDecoration && window()->isVisible()) @@ -223,8 +233,10 @@ void QWaylandWindow::setVisible(bool visible) mMouseDevice = parent->mMouseDevice; mMouseSerial = parent->mMouseSerial; - if (mMouseDevice) - mShellSurface->setPopup(transientParent(), mMouseDevice, mMouseSerial); + QWaylandWlShellSurface *wlshellSurface = dynamic_cast(mShellSurface); + if (mMouseDevice && wlshellSurface) { + wlshellSurface->setPopup(transientParent(), mMouseDevice, mMouseSerial); + } } setGeometry(window()->geometry()); @@ -434,6 +446,20 @@ void QWaylandWindow::setWindowFlags(Qt::WindowFlags flags) bool QWaylandWindow::createDecoration() { + // so far only xdg-shell support this "unminimize" trick, may be moved elsewhere + if (mState == Qt::WindowMinimized) { + QWaylandXdgSurface *xdgSurface = dynamic_cast(mShellSurface); + if ( xdgSurface ) { + if (xdgSurface->isFullscreen()) { + setWindowStateInternal(Qt::WindowFullScreen); + } else if (xdgSurface->isMaximized()) { + setWindowStateInternal(Qt::WindowMaximized); + } else { + setWindowStateInternal(Qt::WindowNoState); + } + } + } + static bool disableWaylandDecorations = !qgetenv("QT_WAYLAND_DISABLE_WINDOWDECORATION").isEmpty(); if (disableWaylandDecorations) return false; diff --git a/src/plugins/platforms/wayland/qwaylandwlshellsurface.cpp b/src/plugins/platforms/wayland/qwaylandwlshellsurface.cpp new file mode 100644 index 00000000000..4b73ec23236 --- /dev/null +++ b/src/plugins/platforms/wayland/qwaylandwlshellsurface.cpp @@ -0,0 +1,186 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the config.tests of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qwaylandwlshellsurface_p.h" + +#include "qwaylanddisplay_p.h" +#include "qwaylandwindow_p.h" +#include "qwaylandinputdevice_p.h" +#include "qwaylanddecoration_p.h" +#include "qwaylandscreen_p.h" + +#include + +QT_BEGIN_NAMESPACE + +QWaylandWlShellSurface::QWaylandWlShellSurface(struct ::wl_shell_surface *shell_surface, QWaylandWindow *window) + : QtWayland::wl_shell_surface(shell_surface) + , m_window(window) + , m_maximized(false) + , m_fullscreen(false) +{ +} + +QWaylandWlShellSurface::~QWaylandWlShellSurface() +{ + wl_shell_surface_destroy(object()); +} + +void QWaylandWlShellSurface::resize(QWaylandInputDevice *inputDevice, enum wl_shell_surface_resize edges) +{ + resize(inputDevice->wl_seat(), + inputDevice->serial(), + edges); +} + +void QWaylandWlShellSurface::move(QWaylandInputDevice *inputDevice) +{ + move(inputDevice->wl_seat(), + inputDevice->serial()); +} + +void QWaylandWlShellSurface::setTitle(const QString & title) +{ + return QtWayland::wl_shell_surface::set_title(title); +} + +void QWaylandWlShellSurface::setAppId(const QString & appId) +{ + return QtWayland::wl_shell_surface::set_class(appId); +} + +void QWaylandWlShellSurface::setMaximized() +{ + m_maximized = true; + m_size = m_window->window()->geometry().size(); + set_maximized(0); +} + +void QWaylandWlShellSurface::setFullscreen() +{ + m_fullscreen = true; + m_size = m_window->window()->geometry().size(); + set_fullscreen(WL_SHELL_SURFACE_FULLSCREEN_METHOD_DEFAULT, 0, 0); +} + +void QWaylandWlShellSurface::setNormal() +{ + if (m_fullscreen || m_maximized) { + m_fullscreen = m_maximized = false; + setTopLevel(); + QMargins m = m_window->frameMargins(); + m_window->configure(0, m_size.width() + m.left() + m.right(), m_size.height() + m.top() + m.bottom()); + } +} + +void QWaylandWlShellSurface::setMinimized() +{ + // TODO: There's no wl_shell_surface API for this +} + +void QWaylandWlShellSurface::setTopLevel() +{ + set_toplevel(); +} + +void QWaylandWlShellSurface::updateTransientParent(QWindow *parent) +{ + QWaylandWindow *parent_wayland_window = static_cast(parent->handle()); + if (!parent_wayland_window) + return; + + // set_transient expects a position relative to the parent + QPoint transientPos = m_window->geometry().topLeft(); // this is absolute + QWindow *parentWin = m_window->window()->transientParent(); + transientPos -= parentWin->geometry().topLeft(); + if (parent_wayland_window->decoration()) { + transientPos.setX(transientPos.x() + parent_wayland_window->decoration()->margins().left()); + transientPos.setY(transientPos.y() + parent_wayland_window->decoration()->margins().top()); + } + + uint32_t flags = 0; + Qt::WindowFlags wf = m_window->window()->flags(); + if (wf.testFlag(Qt::ToolTip) + || wf.testFlag(Qt::WindowTransparentForInput)) + flags |= WL_SHELL_SURFACE_TRANSIENT_INACTIVE; + + set_transient(parent_wayland_window->object(), + transientPos.x(), + transientPos.y(), + flags); +} + +void QWaylandWlShellSurface::setPopup(QWaylandWindow *parent, QWaylandInputDevice *device, int serial) +{ + QWaylandWindow *parent_wayland_window = parent; + if (!parent_wayland_window) + return; + + // set_popup expects a position relative to the parent + QPoint transientPos = m_window->geometry().topLeft(); // this is absolute + transientPos -= parent_wayland_window->geometry().topLeft(); + if (parent_wayland_window->decoration()) { + transientPos.setX(transientPos.x() + parent_wayland_window->decoration()->margins().left()); + transientPos.setY(transientPos.y() + parent_wayland_window->decoration()->margins().top()); + } + + set_popup(device->wl_seat(), serial, parent_wayland_window->object(), + transientPos.x(), transientPos.y(), 0); +} + +void QWaylandWlShellSurface::shell_surface_ping(uint32_t serial) +{ + pong(serial); +} + +void QWaylandWlShellSurface::shell_surface_configure(uint32_t edges, + int32_t width, + int32_t height) +{ + m_window->configure(edges, width, height); +} + +void QWaylandWlShellSurface::shell_surface_popup_done() +{ + QCoreApplication::postEvent(m_window->window(), new QCloseEvent()); +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandwlshellsurface_p.h b/src/plugins/platforms/wayland/qwaylandwlshellsurface_p.h new file mode 100644 index 00000000000..d02bb7bfed0 --- /dev/null +++ b/src/plugins/platforms/wayland/qwaylandwlshellsurface_p.h @@ -0,0 +1,101 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the config.tests of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWAYLANDWLSHELLSURFACE_H +#define QWAYLANDWLSHELLSURFACE_H + +#include + +#include + +#include +#include +#include "qwaylandshellsurface_p.h" + +QT_BEGIN_NAMESPACE + +class QWaylandWindow; +class QWaylandInputDevice; +class QWindow; + +class Q_WAYLAND_CLIENT_EXPORT QWaylandWlShellSurface : public QtWayland::wl_shell_surface + , public QWaylandShellSurface +{ +public: + QWaylandWlShellSurface(struct ::wl_shell_surface *shell_surface, QWaylandWindow *window); + virtual ~QWaylandWlShellSurface(); + + using QtWayland::wl_shell_surface::resize; + void resize(QWaylandInputDevice *inputDevice, enum wl_shell_surface_resize edges) Q_DECL_OVERRIDE; + + using QtWayland::wl_shell_surface::move; + void move(QWaylandInputDevice *inputDevice) Q_DECL_OVERRIDE; + + void setTitle(const QString & title) Q_DECL_OVERRIDE; + void setAppId(const QString &appId) Q_DECL_OVERRIDE; + +private: + void setMaximized() Q_DECL_OVERRIDE; + void setFullscreen() Q_DECL_OVERRIDE; + void setNormal() Q_DECL_OVERRIDE; + void setMinimized() Q_DECL_OVERRIDE; + + void setTopLevel() Q_DECL_OVERRIDE; + void updateTransientParent(QWindow *parent) Q_DECL_OVERRIDE; + void setPopup(QWaylandWindow *parent, QWaylandInputDevice *device, int serial); + + QWaylandWindow *m_window; + bool m_maximized; + bool m_fullscreen; + QSize m_size; + + void shell_surface_ping(uint32_t serial) Q_DECL_OVERRIDE; + void shell_surface_configure(uint32_t edges, + int32_t width, + int32_t height) Q_DECL_OVERRIDE; + void shell_surface_popup_done() Q_DECL_OVERRIDE; + + friend class QWaylandWindow; +}; + +QT_END_NAMESPACE + +#endif // QWAYLANDSHELLSURFACE_H diff --git a/src/plugins/platforms/wayland/qwaylandxdgsurface.cpp b/src/plugins/platforms/wayland/qwaylandxdgsurface.cpp new file mode 100644 index 00000000000..1b8affacfa1 --- /dev/null +++ b/src/plugins/platforms/wayland/qwaylandxdgsurface.cpp @@ -0,0 +1,173 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the config.tests of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qwaylandxdgsurface_p.h" + +#include "qwaylanddisplay_p.h" +#include "qwaylandwindow_p.h" +#include "qwaylandinputdevice_p.h" +#include "qwaylanddecoration_p.h" +#include "qwaylandscreen_p.h" + +#include + +QT_BEGIN_NAMESPACE + +QWaylandXdgSurface::QWaylandXdgSurface(struct ::xdg_surface *xdg_surface, QWaylandWindow *window) + : QtWayland::xdg_surface(xdg_surface) + , m_window(window) + , m_maximized(false) + , m_minimized(false) + , m_fullscreen(false) +{ +} + +QWaylandXdgSurface::~QWaylandXdgSurface() +{ + xdg_surface_destroy(object()); +} + +void QWaylandXdgSurface::resize(QWaylandInputDevice *inputDevice, enum wl_shell_surface_resize edges) +{ + // May need some conversion if types get incompatibles, ATM they're identical + enum resize_edge const * const arg = reinterpret_cast(&edges); + resize(inputDevice, *arg); +} + +void QWaylandXdgSurface::resize(QWaylandInputDevice *inputDevice, enum resize_edge edges) +{ + resize(inputDevice->wl_seat(), + inputDevice->serial(), + edges); +} + +void QWaylandXdgSurface::move(QWaylandInputDevice *inputDevice) +{ + move(inputDevice->wl_seat(), + inputDevice->serial()); +} + +void QWaylandXdgSurface::setMaximized() +{ + m_maximized = true; + m_size = m_window->window()->geometry().size(); + set_maximized(); +} + +void QWaylandXdgSurface::setFullscreen() +{ + m_fullscreen = true; + m_size = m_window->window()->geometry().size(); + set_fullscreen(); +} + +void QWaylandXdgSurface::setNormal() +{ + if (m_fullscreen || m_maximized || m_minimized) { + if (m_maximized) { unset_maximized(); } + if (m_fullscreen) { unset_fullscreen(); } + + m_fullscreen = m_maximized = m_minimized = false; + setTopLevel(); + QMargins m = m_window->frameMargins(); + m_window->configure(0, m_size.width() + m.left() + m.right(), m_size.height() + m.top() + m.bottom()); + } +} + +void QWaylandXdgSurface::setMinimized() +{ + m_minimized = true; + m_size = m_window->window()->geometry().size(); + set_minimized(); +} + +void QWaylandXdgSurface::setTopLevel() +{ + // There's no xdg_shell_surface API for this, ignoring +} + +void QWaylandXdgSurface::updateTransientParent(QWindow *parent) +{ + QWaylandWindow *parent_wayland_window = static_cast(parent->handle()); + if (!parent_wayland_window) + return; + + // set_transient expects a position relative to the parent + QPoint transientPos = m_window->geometry().topLeft(); // this is absolute + QWindow *parentWin = m_window->window()->transientParent(); + transientPos -= parentWin->geometry().topLeft(); + if (parent_wayland_window->decoration()) { + transientPos.setX(transientPos.x() + parent_wayland_window->decoration()->margins().left()); + transientPos.setY(transientPos.y() + parent_wayland_window->decoration()->margins().top()); + } + + uint32_t flags = 0; + Qt::WindowFlags wf = m_window->window()->flags(); + if (wf.testFlag(Qt::ToolTip) + || wf.testFlag(Qt::WindowTransparentForInput)) + flags |= XDG_SURFACE_SET_TRANSIENT_FOR; + + set_transient_for(parent_wayland_window->object()); +} + +void QWaylandXdgSurface::setTitle(const QString & title) +{ + return QtWayland::xdg_surface::set_title(title); +} + +void QWaylandXdgSurface::setAppId(const QString & appId) +{ + return QtWayland::xdg_surface::set_app_id(appId); +} + +void QWaylandXdgSurface::xdg_surface_ping(uint32_t serial) +{ + pong(serial); +} + +void QWaylandXdgSurface::xdg_surface_configure(uint32_t edges, int32_t width, + int32_t height) +{ + m_window->configure(edges, width, height); +} + + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandxdgsurface_p.h b/src/plugins/platforms/wayland/qwaylandxdgsurface_p.h new file mode 100644 index 00000000000..744d3f377f2 --- /dev/null +++ b/src/plugins/platforms/wayland/qwaylandxdgsurface_p.h @@ -0,0 +1,105 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the config.tests of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWAYLANDXDGSURFACE_H +#define QWAYLANDXDGSURFACE_H + +#include + +#include + +#include +#include +#include "qwaylandshellsurface_p.h" + +QT_BEGIN_NAMESPACE + +class QWaylandWindow; +class QWaylandInputDevice; +class QWindow; + +class Q_WAYLAND_CLIENT_EXPORT QWaylandXdgSurface : public QtWayland::xdg_surface + , public QWaylandShellSurface +{ +public: + QWaylandXdgSurface(struct ::xdg_surface *shell_surface, QWaylandWindow *window); + virtual ~QWaylandXdgSurface(); + + using QtWayland::xdg_surface::resize; + void resize(QWaylandInputDevice *inputDevice, enum resize_edge edges); + + void resize(QWaylandInputDevice *inputDevice, enum wl_shell_surface_resize edges) Q_DECL_OVERRIDE; + + using QtWayland::xdg_surface::move; + void move(QWaylandInputDevice *inputDevice) Q_DECL_OVERRIDE; + + void setTitle(const QString &title) Q_DECL_OVERRIDE; + void setAppId(const QString &appId) Q_DECL_OVERRIDE; + + bool isFullscreen() const { return m_fullscreen; } + bool isMaximized() const { return m_maximized; } + +private: + void setMaximized() Q_DECL_OVERRIDE; + void setFullscreen() Q_DECL_OVERRIDE; + void setNormal() Q_DECL_OVERRIDE; + void setMinimized() Q_DECL_OVERRIDE; + + void setTopLevel() Q_DECL_OVERRIDE; + void updateTransientParent(QWindow *parent) Q_DECL_OVERRIDE; + +private: + QWaylandWindow *m_window; + bool m_maximized; + bool m_minimized; + bool m_fullscreen; + QSize m_size; + + void xdg_surface_ping(uint32_t serial) Q_DECL_OVERRIDE; + void xdg_surface_configure(uint32_t edges, + int32_t width, + int32_t height) Q_DECL_OVERRIDE; + friend class QWaylandWindow; +}; + +QT_END_NAMESPACE + +#endif // QWAYLANDXDGSURFACE_H From 2de0e4fe4e56fa2305ad5fcfe97990ea62384af2 Mon Sep 17 00:00:00 2001 From: Giulio Camuffo Date: Wed, 11 Jun 2014 13:43:58 +0300 Subject: [PATCH 0126/1507] Fix generated code for interface names not starting with qt_ or wl_ The generated code for an interface without a qt_ or wl_ prefix was broken, and could not compile. This commit needs a 'make clean' to let qtwaylandscanner run again. Change-Id: Id9c7e3f87385f83eeffd1e8718c854a405f411f0 Reviewed-by: Gunnar Sletta --- src/tools/qtwaylandscanner/qtwaylandscanner.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp index 097813f3cde..5ffb52f4ef6 100644 --- a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp +++ b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp @@ -425,10 +425,10 @@ void process(QXmlStreamReader &xml, const QByteArray &headerPath, const QByteArr printf(" class Resource\n"); printf(" {\n"); printf(" public:\n"); - printf(" Resource() : %s(0), handle(0) {}\n", interfaceNameStripped); + printf(" Resource() : %s_object(0), handle(0) {}\n", interfaceNameStripped); printf(" virtual ~Resource() {}\n"); printf("\n"); - printf(" %s *%s;\n", interfaceName, interfaceNameStripped); + printf(" %s *%s_object;\n", interfaceName, interfaceNameStripped); printf(" struct ::wl_resource *handle;\n"); printf("\n"); printf(" struct ::wl_client *client() const { return handle->client; }\n"); @@ -636,7 +636,7 @@ void process(QXmlStreamReader &xml, const QByteArray &headerPath, const QByteArr printf(" void %s::destroy_func(struct ::wl_resource *client_resource)\n", interfaceName); printf(" {\n"); printf(" Resource *resource = Resource::fromResource(client_resource);\n"); - printf(" %s *that = resource->%s;\n", interfaceName, interfaceNameStripped); + printf(" %s *that = resource->%s_object;\n", interfaceName, interfaceNameStripped); printf(" that->m_resource_map.remove(resource->client(), resource);\n"); printf(" that->%s_destroy_resource(resource);\n", interfaceNameStripped); printf(" delete resource;\n"); @@ -655,7 +655,7 @@ void process(QXmlStreamReader &xml, const QByteArray &headerPath, const QByteArr printf(" %s::Resource *%s::bind(struct ::wl_client *client, uint32_t id)\n", interfaceName, interfaceName); printf(" {\n"); printf(" Resource *resource = %s_allocate();\n", interfaceNameStripped); - printf(" resource->%s = this;\n", interfaceNameStripped); + printf(" resource->%s_object = this;\n", interfaceNameStripped); printf("\n"); printf(" struct ::wl_resource *handle = wl_resource_create(client, &::%s_interface, ::%s_interface.version, id);\n", interfaceName, interfaceName); printf(" wl_resource_set_implementation(handle, %s, resource, destroy_func);", interfaceMember.constData()); @@ -699,7 +699,7 @@ void process(QXmlStreamReader &xml, const QByteArray &headerPath, const QByteArr printf(" {\n"); printf(" Q_UNUSED(client);\n"); printf(" Resource *r = Resource::fromResource(resource);\n"); - printf(" static_cast<%s *>(r->%s)->%s_%s(\n", interfaceName, interfaceNameStripped, interfaceNameStripped, e.name.constData()); + printf(" static_cast<%s *>(r->%s_object)->%s_%s(\n", interfaceName, interfaceNameStripped, interfaceNameStripped, e.name.constData()); printf(" r"); for (int i = 0; i < e.arguments.size(); ++i) { printf(",\n"); From 43cd8c4fe7fbd9e0ee820fd3513f765545b0f3d5 Mon Sep 17 00:00:00 2001 From: Giulio Camuffo Date: Mon, 16 Jun 2014 10:37:37 +0300 Subject: [PATCH 0127/1507] Reduce headers inter-dependency in the QPA plugin Change-Id: I8b810e54531453b6a80250555c21bb0b1e6e76cc Reviewed-by: Robin Burchell --- .../platforms/wayland/qwaylanddatadevice.cpp | 1 + .../platforms/wayland/qwaylanddatadevice_p.h | 8 ++++++- .../wayland/qwaylanddatadevicemanager.cpp | 1 + .../wayland/qwaylanddatadevicemanager_p.h | 5 ++++- .../platforms/wayland/qwaylanddataoffer.cpp | 1 + .../platforms/wayland/qwaylanddataoffer_p.h | 5 +++-- .../platforms/wayland/qwaylanddatasource_p.h | 6 +++-- src/plugins/platforms/wayland/qwaylanddnd.cpp | 1 + src/plugins/platforms/wayland/qwaylanddnd_p.h | 5 ++++- .../wayland/qwaylandextendedoutput_p.h | 4 +++- .../platforms/wayland/qwaylandinputdevice.cpp | 1 + .../wayland/qwaylandnativeinterface.cpp | 1 + .../wayland/qwaylandnativeinterface_p.h | 4 +++- .../platforms/wayland/qwaylandqtkey.cpp | 1 + .../platforms/wayland/qwaylandqtkey_p.h | 4 +++- .../wayland/qwaylandshmbackingstore.cpp | 18 +++++++++++++++ .../wayland/qwaylandshmbackingstore_p.h | 22 ++----------------- .../platforms/wayland/qwaylandtouch.cpp | 1 + .../platforms/wayland/qwaylandtouch_p.h | 5 ++++- .../platforms/wayland/qwaylandwindow_p.h | 5 +++-- .../qwaylandwindowmanagerintegration.cpp | 1 + .../qwaylandwindowmanagerintegration_p.h | 4 +++- 22 files changed, 70 insertions(+), 34 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylanddatadevice.cpp b/src/plugins/platforms/wayland/qwaylanddatadevice.cpp index f5056f6d05f..8f690aae0fc 100644 --- a/src/plugins/platforms/wayland/qwaylanddatadevice.cpp +++ b/src/plugins/platforms/wayland/qwaylanddatadevice.cpp @@ -45,6 +45,7 @@ #include "qwaylanddatasource_p.h" #include "qwaylanddnd_p.h" #include "qwaylandinputdevice_p.h" +#include "qwaylanddisplay_p.h" #include #include diff --git a/src/plugins/platforms/wayland/qwaylanddatadevice_p.h b/src/plugins/platforms/wayland/qwaylanddatadevice_p.h index 4e98424e501..f5fad17723f 100644 --- a/src/plugins/platforms/wayland/qwaylanddatadevice_p.h +++ b/src/plugins/platforms/wayland/qwaylanddatadevice_p.h @@ -41,15 +41,21 @@ #ifndef QWAYLANDDATADEVICE_H #define QWAYLANDDATADEVICE_H -#include "qwaylanddisplay_p.h" +#include +#include + +#include QT_BEGIN_NAMESPACE +class QWaylandDisplay; class QMimeData; class QWaylandDataDeviceManager; class QWaylandDataOffer; class QWaylandDataSource; class QWindow; +class QWaylandInputDevice; +class QWaylandWindow; class QWaylandDataDevice : public QObject, public QtWayland::wl_data_device { diff --git a/src/plugins/platforms/wayland/qwaylanddatadevicemanager.cpp b/src/plugins/platforms/wayland/qwaylanddatadevicemanager.cpp index 5de28c00158..1aef773490f 100644 --- a/src/plugins/platforms/wayland/qwaylanddatadevicemanager.cpp +++ b/src/plugins/platforms/wayland/qwaylanddatadevicemanager.cpp @@ -44,6 +44,7 @@ #include "qwaylandinputdevice_p.h" #include "qwaylanddatadevice_p.h" #include "qwaylanddataoffer_p.h" +#include "qwaylanddisplay_p.h" #include diff --git a/src/plugins/platforms/wayland/qwaylanddatadevicemanager_p.h b/src/plugins/platforms/wayland/qwaylanddatadevicemanager_p.h index 6e2beafbe3e..55583c61b4c 100644 --- a/src/plugins/platforms/wayland/qwaylanddatadevicemanager_p.h +++ b/src/plugins/platforms/wayland/qwaylanddatadevicemanager_p.h @@ -42,12 +42,15 @@ #ifndef QWAYLANDDATADEVICEMANAGER_H #define QWAYLANDDATADEVICEMANAGER_H -#include +#include +#include QT_BEGIN_NAMESPACE +class QWaylandDisplay; class QWaylandDataDevice; class QWaylandDataSource; +class QWaylandInputDevice; class Q_WAYLAND_CLIENT_EXPORT QWaylandDataDeviceManager : public QtWayland::wl_data_device_manager { diff --git a/src/plugins/platforms/wayland/qwaylanddataoffer.cpp b/src/plugins/platforms/wayland/qwaylanddataoffer.cpp index f7233092851..d1c85c7a40e 100644 --- a/src/plugins/platforms/wayland/qwaylanddataoffer.cpp +++ b/src/plugins/platforms/wayland/qwaylanddataoffer.cpp @@ -41,6 +41,7 @@ #include "qwaylanddataoffer_p.h" #include "qwaylanddatadevicemanager_p.h" +#include "qwaylanddisplay_p.h" #include #include diff --git a/src/plugins/platforms/wayland/qwaylanddataoffer_p.h b/src/plugins/platforms/wayland/qwaylanddataoffer_p.h index 9f5b6cf1e30..a21e18bdc8d 100644 --- a/src/plugins/platforms/wayland/qwaylanddataoffer_p.h +++ b/src/plugins/platforms/wayland/qwaylanddataoffer_p.h @@ -42,10 +42,11 @@ #ifndef QWAYLANDDATAOFFER_H #define QWAYLANDDATAOFFER_H -#include "qwaylanddisplay_p.h" - #include +#include +#include + QT_BEGIN_NAMESPACE class QWaylandDisplay; diff --git a/src/plugins/platforms/wayland/qwaylanddatasource_p.h b/src/plugins/platforms/wayland/qwaylanddatasource_p.h index 9568f507c47..a721336f7d8 100644 --- a/src/plugins/platforms/wayland/qwaylanddatasource_p.h +++ b/src/plugins/platforms/wayland/qwaylanddatasource_p.h @@ -42,14 +42,16 @@ #ifndef QWAYLANDDATASOURCE_H #define QWAYLANDDATASOURCE_H -#include +#include -#include +#include +#include QT_BEGIN_NAMESPACE class QMimeData; class QWaylandDataDeviceManager; +class QWaylandDisplay; class Q_WAYLAND_CLIENT_EXPORT QWaylandDataSource : public QObject, public QtWayland::wl_data_source { diff --git a/src/plugins/platforms/wayland/qwaylanddnd.cpp b/src/plugins/platforms/wayland/qwaylanddnd.cpp index 0d5eddf5bbf..996e647ccdc 100644 --- a/src/plugins/platforms/wayland/qwaylanddnd.cpp +++ b/src/plugins/platforms/wayland/qwaylanddnd.cpp @@ -45,6 +45,7 @@ #include "qwaylanddatadevicemanager_p.h" #include "qwaylanddataoffer_p.h" #include "qwaylandinputdevice_p.h" +#include "qwaylanddisplay_p.h" #include diff --git a/src/plugins/platforms/wayland/qwaylanddnd_p.h b/src/plugins/platforms/wayland/qwaylanddnd_p.h index 22b004712b8..1d236fad565 100644 --- a/src/plugins/platforms/wayland/qwaylanddnd_p.h +++ b/src/plugins/platforms/wayland/qwaylanddnd_p.h @@ -47,10 +47,13 @@ #include #include -#include + +#include QT_BEGIN_NAMESPACE +class QWaylandDisplay; + class Q_WAYLAND_CLIENT_EXPORT QWaylandDrag : public QBasicDrag { public: diff --git a/src/plugins/platforms/wayland/qwaylandextendedoutput_p.h b/src/plugins/platforms/wayland/qwaylandextendedoutput_p.h index f18fb8e57bf..4295412ec19 100644 --- a/src/plugins/platforms/wayland/qwaylandextendedoutput_p.h +++ b/src/plugins/platforms/wayland/qwaylandextendedoutput_p.h @@ -42,11 +42,13 @@ #ifndef QWAYLANDEXTENDEDOUTPUT_H #define QWAYLANDEXTENDEDOUTPUT_H -#include #include +#include QT_BEGIN_NAMESPACE +class QWaylandDisplay; +class QWaylandScreen; class QWaylandExtendedOutput; class Q_WAYLAND_CLIENT_EXPORT QWaylandExtendedOutput : public QtWayland::qt_extended_output diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index cce2d979015..9c570c7c8b1 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -49,6 +49,7 @@ #include "qwaylandtouch_p.h" #include "qwaylandscreen_p.h" #include "qwaylandcursor_p.h" +#include "qwaylanddisplay_p.h" #include #include diff --git a/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp b/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp index f8d95bb2550..e3d6fef4a0a 100644 --- a/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp +++ b/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp @@ -46,6 +46,7 @@ #include "qwaylandintegration_p.h" #include "qwaylanddisplay_p.h" #include "qwaylandwindowmanagerintegration_p.h" +#include "qwaylandscreen_p.h" #include #include diff --git a/src/plugins/platforms/wayland/qwaylandnativeinterface_p.h b/src/plugins/platforms/wayland/qwaylandnativeinterface_p.h index b9ee2d0e87b..536cbe8dd53 100644 --- a/src/plugins/platforms/wayland/qwaylandnativeinterface_p.h +++ b/src/plugins/platforms/wayland/qwaylandnativeinterface_p.h @@ -42,13 +42,15 @@ #ifndef QWAYLANDNATIVEINTERFACE_H #define QWAYLANDNATIVEINTERFACE_H -#include #include #include +#include + QT_BEGIN_NAMESPACE class QWaylandIntegration; +class QWaylandScreen; class Q_WAYLAND_CLIENT_EXPORT QWaylandNativeInterface : public QPlatformNativeInterface { diff --git a/src/plugins/platforms/wayland/qwaylandqtkey.cpp b/src/plugins/platforms/wayland/qwaylandqtkey.cpp index 263390a1f2c..197914b0b9c 100644 --- a/src/plugins/platforms/wayland/qwaylandqtkey.cpp +++ b/src/plugins/platforms/wayland/qwaylandqtkey.cpp @@ -41,6 +41,7 @@ #include "qwaylandqtkey_p.h" #include "qwaylandinputdevice_p.h" +#include "qwaylanddisplay_p.h" QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandqtkey_p.h b/src/plugins/platforms/wayland/qwaylandqtkey_p.h index a9c4e99fa75..d00a90ee032 100644 --- a/src/plugins/platforms/wayland/qwaylandqtkey_p.h +++ b/src/plugins/platforms/wayland/qwaylandqtkey_p.h @@ -42,13 +42,15 @@ #ifndef QWAYLANDQTKEY_H #define QWAYLANDQTKEY_H -#include #include +#include #include QT_BEGIN_NAMESPACE +class QWaylandDisplay; + class Q_WAYLAND_CLIENT_EXPORT QWaylandQtKeyExtension : public QtWayland::qt_key_extension { public: diff --git a/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp b/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp index 41f7da20093..0677ed0d398 100644 --- a/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp +++ b/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp @@ -290,6 +290,24 @@ void QWaylandShmBackingStore::updateDecorations() decorationPainter.drawImage(target, sourceImage, target); } +QWaylandDecoration *QWaylandShmBackingStore::windowDecoration() const +{ + return waylandWindow()->decoration(); +} + +QMargins QWaylandShmBackingStore::windowDecorationMargins() const +{ + if (windowDecoration()) + return windowDecoration()->margins(); + return QMargins(); +} + +QWaylandShmWindow *QWaylandShmBackingStore::waylandWindow() const +{ + return static_cast(window()->handle()); +} + + void QWaylandShmBackingStore::done(void *data, wl_callback *callback, uint32_t time) { Q_UNUSED(time); diff --git a/src/plugins/platforms/wayland/qwaylandshmbackingstore_p.h b/src/plugins/platforms/wayland/qwaylandshmbackingstore_p.h index 1affafabc2e..6097b5282c8 100644 --- a/src/plugins/platforms/wayland/qwaylandshmbackingstore_p.h +++ b/src/plugins/platforms/wayland/qwaylandshmbackingstore_p.h @@ -44,9 +44,6 @@ #include -#include -#include - #include #include #include @@ -54,6 +51,8 @@ QT_BEGIN_NAMESPACE class QWaylandDisplay; +class QWaylandDecoration; +class QWaylandShmWindow; class Q_WAYLAND_CLIENT_EXPORT QWaylandShmBuffer : public QWaylandBuffer { public: @@ -112,23 +111,6 @@ private: struct wl_callback *mFrameCallback; }; -inline QWaylandDecoration *QWaylandShmBackingStore::windowDecoration() const -{ - return waylandWindow()->decoration(); -} - -inline QMargins QWaylandShmBackingStore::windowDecorationMargins() const -{ - if (windowDecoration()) - return windowDecoration()->margins(); - return QMargins(); -} - -inline QWaylandShmWindow *QWaylandShmBackingStore::waylandWindow() const -{ - return static_cast(window()->handle()); -} - QT_END_NAMESPACE #endif diff --git a/src/plugins/platforms/wayland/qwaylandtouch.cpp b/src/plugins/platforms/wayland/qwaylandtouch.cpp index 01a19926007..71cc1c3cc98 100644 --- a/src/plugins/platforms/wayland/qwaylandtouch.cpp +++ b/src/plugins/platforms/wayland/qwaylandtouch.cpp @@ -41,6 +41,7 @@ #include "qwaylandtouch_p.h" #include "qwaylandinputdevice_p.h" +#include "qwaylanddisplay_p.h" QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandtouch_p.h b/src/plugins/platforms/wayland/qwaylandtouch_p.h index bd299a1afd7..20827fa8f94 100644 --- a/src/plugins/platforms/wayland/qwaylandtouch_p.h +++ b/src/plugins/platforms/wayland/qwaylandtouch_p.h @@ -42,13 +42,16 @@ #ifndef QWAYLANDTOUCH_H #define QWAYLANDTOUCH_H -#include #include #include +#include QT_BEGIN_NAMESPACE +class QWaylandDisplay; +class QWaylandInputDevice; + class Q_WAYLAND_CLIENT_EXPORT QWaylandTouchExtension : public QtWayland::qt_touch_extension { public: diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index ce89e3d6b98..dbf76d11f32 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -48,9 +48,8 @@ #include -#include - #include +#include struct wl_egl_window; @@ -62,6 +61,8 @@ class QWaylandShellSurface; class QWaylandExtendedSurface; class QWaylandSubSurface; class QWaylandDecoration; +class QWaylandInputDevice; +class QWaylandScreen; class Q_WAYLAND_CLIENT_EXPORT QWaylandWindowConfigure { diff --git a/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration.cpp b/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration.cpp index 9e8ce88c642..c2e0153a55a 100644 --- a/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration.cpp @@ -42,6 +42,7 @@ #include "qwaylandwindowmanagerintegration_p.h" #include "qwaylandscreen_p.h" #include "qwaylandwindow_p.h" +#include "qwaylanddisplay_p.h" #include #include diff --git a/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration_p.h b/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration_p.h index 844b122a056..0ad2e38dfb3 100644 --- a/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration_p.h @@ -46,14 +46,16 @@ #include #include -#include #include #include +#include QT_BEGIN_NAMESPACE class QWaylandWindow; +class QWaylandDisplay; + class QWaylandWindowManagerIntegrationPrivate; class Q_WAYLAND_CLIENT_EXPORT QWaylandWindowManagerIntegration : public QObject, public QPlatformServices, public QtWayland::qt_windowmanager From b4e47c370dde85a77dae99a480e726ea2c037c43 Mon Sep 17 00:00:00 2001 From: Philippe Coval Date: Tue, 10 Jun 2014 16:22:17 +0200 Subject: [PATCH 0128/1507] xdg-shell: upgrade to support current version (weston-1.5.0) The protocol file is a raw copy of Source: http://cgit.freedesktop.org/wayland/weston/plain/protocol/xdg-shell.xml?id=1.5.0 Task-number: QTBUG-38633/related Change-Id: I41ca2f89c09a8b6348ce2fbf6d59f44b4c8134df Reviewed-by: Giulio Camuffo Reviewed-by: Philippe Coval --- src/3rdparty/wayland/protocols/xdg-shell.xml | 304 +++++++++--------- src/plugins/platforms/wayland/client.pro | 2 + .../platforms/wayland/qwaylanddisplay.cpp | 10 +- .../platforms/wayland/qwaylanddisplay_p.h | 5 +- .../platforms/wayland/qwaylandxdgshell.cpp | 77 +++++ .../platforms/wayland/qwaylandxdgshell_p.h | 73 +++++ .../platforms/wayland/qwaylandxdgsurface.cpp | 60 +++- .../platforms/wayland/qwaylandxdgsurface_p.h | 11 +- 8 files changed, 372 insertions(+), 170 deletions(-) create mode 100644 src/plugins/platforms/wayland/qwaylandxdgshell.cpp create mode 100644 src/plugins/platforms/wayland/qwaylandxdgshell_p.h diff --git a/src/3rdparty/wayland/protocols/xdg-shell.xml b/src/3rdparty/wayland/protocols/xdg-shell.xml index 4e5cff8df96..79a283173ff 100644 --- a/src/3rdparty/wayland/protocols/xdg-shell.xml +++ b/src/3rdparty/wayland/protocols/xdg-shell.xml @@ -40,19 +40,22 @@ - Use this enum to check the protocol version, and it will be updated - automatically. + The 'current' member of this enum gives the version of the + protocol. Implementations can compare this to the version + they implement using static_assert to ensure the protocol and + implementation versions match. - + - Use this request in order to enable use of this interface. - - Understand and agree that one is using an unstable interface, - that will likely change in the future, breaking the API. + Negotiate the unstable version of the interface. This + mechanism is in place to ensure client and server agree on the + unstable versions of the protocol that they speak or exit + cleanly if they don't agree. This request will go away once + the xdg-shell protocol is stable. @@ -84,6 +87,28 @@ + + + + The ping event asks the client if it's still alive. Pass the + serial specified in the event back to the compositor by sending + a "pong" request back with the specified serial. + + Compositors can use this to determine if the client is still + alive. It's unspecified what will happen if the client doesn't + respond to the ping request, or in what timeframe. Clients should + try to respond in a reasonable amount of time. + + + + + + + A client must respond to a ping event with a pong request or + the client may be deemed unresponsive. + + + @@ -124,6 +149,32 @@ + + + This tells the compositor what the visible size of the window + should be, so it can use it to determine what borders to use for + constrainment and alignment. + + CSD often has invisible areas for decoration purposes, like drop + shadows. These "shadow" drawings need to be subtracted out of the + normal boundaries of the window when computing where to place + windows (e.g. to set this window so it's centered on top of another, + or to put it to the left or right of the screen.) + + This value should change as little as possible at runtime, to + prevent flicker. + + This value is also ignored when the window is maximized or + fullscreen, and assumed to be 0. + + If never called, this value is assumed to be 0. + + + + + + + Set a short title for the surface. @@ -150,22 +201,6 @@ - - - A client must respond to a ping event with a pong request or - the client may be deemed unresponsive. - - - - - - - Ping a client to check if it is receiving events and sending - requests. A client is expected to reply with a pong request. - - - - Start a pointer-driven move of the surface. @@ -217,12 +252,6 @@ ignore it if it doesn't resize, pick a smaller size (to satisfy aspect ratio or resize in steps of NxM pixels). - The edges parameter provides a hint about how the surface - was resized. The client may use this information to decide - how to adjust its content to the new size (e.g. a scrolling - area might adjust its content position to leave the viewable - content unmoved). Valid edge values are from resize_edge enum. - The client is free to dismiss all but the last configure event it received. @@ -230,7 +259,6 @@ in surface local coordinates. - @@ -250,128 +278,122 @@ - - - Event sent from the compositor to the client requesting that the client - goes to a fullscreen state. It's the client job to call set_fullscreen - and really trigger the fullscreen state. + + + The different state values used on the surface. This is designed for + state values like maximized, fullscreen. It is paired with the + request_change_state event to ensure that both the client and the + compositor setting the state can be synchronized. + + States set in this way are double-buffered. They will get applied on + the next commit. + + Desktop environments may extend this enum by taking up a range of + values and documenting the range they chose in this description. + They are not required to document the values for the range that they + chose. Ideally, any good extensions from a desktop environment should + make its way into standardization into this enum. + + The current reserved ranges are: + + 0x0000 - 0x0FFF: xdg-shell core values, documented below. + 0x1000 - 0x1FFF: GNOME - + + A non-zero value indicates the surface is maximized. Otherwise, + the surface is unmaximized. + + + A non-zero value indicates the surface is fullscreen. Otherwise, + the surface is not fullscreen. + + - - - Event sent from the compositor to the client requesting that the client - leaves the fullscreen state. It's the client job to call - unset_fullscreen and really leave the fullscreen state. - - - - - - Set the surface as fullscreen. - - After this request, the compositor should send a configure event - informing the output size. - - This request informs the compositor that the next attached buffer - committed will be in a fullscreen state. The buffer size should be the - same size as the size informed in the configure event, if the client - doesn't want to leave any empty area. - - In other words: the next attached buffer after set_maximized is the new - maximized buffer. And the surface will be positioned at the maximized - position on commit. - - A simple way to synchronize and wait for the correct configure event is - to use a wl_display.sync request right after the set_fullscreen - request. When the sync callback returns, the last configure event - received just before it will be the correct one, and should contain the - right size for the surface to maximize. - - Setting one state won't unset another state. Use - xdg_surface.unset_fullscreen for unsetting it. + + + This asks the compositor to change the state. If the compositor wants + to change the state, it will send a change_state event with the same + state_type, value, and serial, and the event flow continues as if it + it was initiated by the compositor. + + If the compositor does not want to change the state, it will send a + change_state to the client with the old value of the state. + + + + This serial is so the client can know which change_state event corresponds + to which request_change_state request it sent out. + - - - Unset the surface fullscreen state. - - Same negotiation as set_fullscreen must be used. + + + This event tells the client to change a surface's state. The client + should respond with an ack_change_state request to the compositor to + guarantee that the compositor knows that the client has seen it. - - - - Event sent from the compositor to the client requesting that the client - goes to a maximized state. It's the client job to call set_maximized - and really trigger the maximized state. - + + + - - - Event sent from the compositor to the client requesting that the client - leaves the maximized state. It's the client job to call unset_maximized - and really leave the maximized state. - - - - - - Set the surface as maximized. - - After this request, the compositor will send a configure event - informing the output size minus panel and other MW decorations. - - This request informs the compositor that the next attached buffer - committed will be in a maximized state. The buffer size should be the - same size as the size informed in the configure event, if the client - doesn't want to leave any empty area. - - In other words: the next attached buffer after set_maximized is the new - maximized buffer. And the surface will be positioned at the maximized - position on commit. - - A simple way to synchronize and wait for the correct configure event is - to use a wl_display.sync request right after the set_maximized request. - When the sync callback returns, the last configure event received just - before it will be the correct one, and should contain the right size - for the surface to maximize. - - Setting one state won't unset another state. Use - xdg_surface.unset_maximized for unsetting it. - - - - - - Unset the surface maximized state. - - Same negotiation as set_maximized must be used. + + + When a change_state event is received, a client should then ack it + using the ack_change_state request to ensure that the compositor + knows the client has seen the event. + + By this point, the state is confirmed, and the next attach should + contain the buffer drawn for the new state value. + + The values here need to be the same as the values in the cooresponding + change_state event. + + + - - Set the surface minimized state. - - Setting one state won't unset another state. + + Minimize the surface. - - - The focused_set event is sent when this surface has been - activated. Window decorations should be updated accordingly. + + + The activated_set event is sent when this surface has been + activated, which means that the surface has user attention. + Window decorations should be updated accordingly. You should + not use this event for anything but the style of decorations + you display, use wl_keyboard.enter and wl_keyboard.leave for + determining keyboard focus. - - - The focused_unset event is sent when this surface has been - deactivated, because another surface has been activated. Window - decorations should be updated accordingly. + + + The deactivate event is sent when this surface has been + deactivated, which means that the surface lost user attention. + Window decorations should be updated accordingly. You should + not use this event for anything but the style of decorations + you display, use wl_keyboard.enter and wl_keyboard.leave for + determining keyboard focus. + + + + + + The close event is sent by the compositor when the user + wants the surface to be closed. This should be equivalent to + the user clicking the close button in client-side decorations, + if your application has any... + + This is only a request that the user intends to close your + window. The client may choose to ignore this request, or show + a dialog to ask the user to save their data... @@ -409,22 +431,6 @@ - - - A client must respond to a ping event with a pong request or - the client may be deemed unresponsive. - - - - - - - Ping a client to check if it is receiving events and sending - requests. A client is expected to reply with a pong request. - - - - The popup_done event is sent out when a popup grab is broken, diff --git a/src/plugins/platforms/wayland/client.pro b/src/plugins/platforms/wayland/client.pro index d1ab27c6bd0..28c78ab0a60 100644 --- a/src/plugins/platforms/wayland/client.pro +++ b/src/plugins/platforms/wayland/client.pro @@ -60,6 +60,7 @@ SOURCES += qwaylandintegration.cpp \ qwaylanddatasource.cpp \ qwaylandshellsurface.cpp \ qwaylandwlshellsurface.cpp \ + qwaylandxdgshell.cpp \ qwaylandxdgsurface.cpp \ qwaylandextendedoutput.cpp \ qwaylandextendedsurface.cpp \ @@ -90,6 +91,7 @@ HEADERS += qwaylandintegration_p.h \ qwaylanddatasource_p.h \ qwaylandshellsurface_p.h \ qwaylandwlshellsurface_p.h \ + qwaylandxdgshell_p.h \ qwaylandxdgsurface_p.h \ qwaylandextendedoutput_p.h \ qwaylandextendedsurface_p.h \ diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index 88b4e38893a..2c1a26e245c 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -50,7 +50,7 @@ #include "qwaylandclipboard_p.h" #include "qwaylanddatadevicemanager_p.h" #include "qwaylandhardwareintegration_p.h" - +#include "qwaylandxdgshell_p.h" #include "qwaylandwindowmanagerintegration_p.h" @@ -209,8 +209,7 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin mShm = static_cast(wl_registry_bind(registry, id, &wl_shm_interface,1)); } else if (interface == QStringLiteral("xdg_shell") && qEnvironmentVariableIsSet("QT_WAYLAND_USE_XDG_SHELL")) { - mShellXdg.reset(new QtWayland::xdg_shell(registry, id)); - mShellXdg->use_unstable_version(QtWayland::xdg_shell::version_current); + mShellXdg.reset(new QWaylandXdgShell(registry,id)); } else if (interface == QStringLiteral("wl_shell")){ mShell.reset(new QtWayland::wl_shell(registry, id)); } else if (interface == QStringLiteral("wl_seat")) { @@ -275,4 +274,9 @@ void QWaylandDisplay::forceRoundTrip() wl_display_roundtrip(mDisplay); } +QtWayland::xdg_shell *QWaylandDisplay::shellXdg() +{ + return mShellXdg.data(); +} + QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylanddisplay_p.h b/src/plugins/platforms/wayland/qwaylanddisplay_p.h index cf5dfc21d22..f1b35a7121f 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay_p.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay_p.h @@ -72,6 +72,7 @@ class QWaylandWindow; class QWaylandEventThread; class QWaylandIntegration; class QWaylandHardwareIntegration; +class QWaylandXdgShell; namespace QtWayland { class qt_output_extension; @@ -115,7 +116,7 @@ public: QtWayland::wl_compositor *compositor() { return &mCompositor; } QtWayland::wl_shell *shell() { return mShell.data(); } - QtWayland::xdg_shell *shellXdg() { return mShellXdg.data(); } + QtWayland::xdg_shell *shellXdg(); QList inputDevices() const { return mInputDevices; } QWaylandInputDevice *defaultInputDevice() const; @@ -171,7 +172,7 @@ private: QThread *mEventThread; QWaylandEventThread *mEventThreadObject; QScopedPointer mShell; - QScopedPointer mShellXdg; + QScopedPointer mShellXdg; QList mScreens; QList mInputDevices; QList mRegistryListeners; diff --git a/src/plugins/platforms/wayland/qwaylandxdgshell.cpp b/src/plugins/platforms/wayland/qwaylandxdgshell.cpp new file mode 100644 index 00000000000..eb9f91c435f --- /dev/null +++ b/src/plugins/platforms/wayland/qwaylandxdgshell.cpp @@ -0,0 +1,77 @@ +/**************************************************************************** +** +** Copyright (C) 2014 Eurogiciel, author: +** Contact: http://www.qt-project.org/legal +** +** This file is part of the config.tests of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qwaylandxdgshell_p.h" + +#include "qwaylanddisplay_p.h" +#include "qwaylandwindow_p.h" +#include "qwaylandinputdevice_p.h" +#include "qwaylanddecoration_p.h" +#include "qwaylandscreen_p.h" + +#include + +QT_BEGIN_NAMESPACE + +QWaylandXdgShell::QWaylandXdgShell(struct ::xdg_shell *shell) + : QtWayland::xdg_shell(shell) +{ +} + +QWaylandXdgShell::QWaylandXdgShell(struct ::wl_registry *registry, uint32_t id) + : QtWayland::xdg_shell(registry, id) +{ + use_unstable_version(QtWayland::xdg_shell::version_current); +} + +QWaylandXdgShell::~QWaylandXdgShell() +{ + xdg_shell_destroy(object()); +} + + +void QWaylandXdgShell::xdg_shell_ping(uint32_t serial) +{ + pong(serial); +} + + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandxdgshell_p.h b/src/plugins/platforms/wayland/qwaylandxdgshell_p.h new file mode 100644 index 00000000000..6a396bd1178 --- /dev/null +++ b/src/plugins/platforms/wayland/qwaylandxdgshell_p.h @@ -0,0 +1,73 @@ +/**************************************************************************** +** +** Copyright (C) 2014 Eurogiciel, author: +** Contact: http://www.qt-project.org/legal +** +** This file is part of the config.tests of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWAYLANDXDGSHELL_H +#define QWAYLANDXDGSHELL_H + +#include + +#include + +#include +#include +#include "qwaylandshellsurface_p.h" + +QT_BEGIN_NAMESPACE + +class QWaylandWindow; +class QWaylandInputDevice; +class QWindow; + +class Q_WAYLAND_CLIENT_EXPORT QWaylandXdgShell : public QtWayland::xdg_shell +{ +public: + QWaylandXdgShell(struct ::xdg_shell *shell); + QWaylandXdgShell(struct ::wl_registry *registry, uint32_t id); + + virtual ~QWaylandXdgShell(); + +private: + void xdg_shell_ping(uint32_t serial) Q_DECL_OVERRIDE; +}; + +QT_END_NAMESPACE + +#endif // QWAYLANDXDGSHELL_H diff --git a/src/plugins/platforms/wayland/qwaylandxdgsurface.cpp b/src/plugins/platforms/wayland/qwaylandxdgsurface.cpp index 1b8affacfa1..5fb74d25b71 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgsurface.cpp +++ b/src/plugins/platforms/wayland/qwaylandxdgsurface.cpp @@ -87,23 +87,25 @@ void QWaylandXdgSurface::move(QWaylandInputDevice *inputDevice) void QWaylandXdgSurface::setMaximized() { - m_maximized = true; - m_size = m_window->window()->geometry().size(); - set_maximized(); + if (!m_maximized) + request_change_state(XDG_SURFACE_STATE_MAXIMIZED, true, 0); } void QWaylandXdgSurface::setFullscreen() { - m_fullscreen = true; - m_size = m_window->window()->geometry().size(); - set_fullscreen(); + if (!m_fullscreen) + request_change_state(XDG_SURFACE_STATE_FULLSCREEN, true, 0); } void QWaylandXdgSurface::setNormal() { if (m_fullscreen || m_maximized || m_minimized) { - if (m_maximized) { unset_maximized(); } - if (m_fullscreen) { unset_fullscreen(); } + if (m_maximized) { + request_change_state(XDG_SURFACE_STATE_MAXIMIZED, false, 0); + } + if (m_fullscreen) { + request_change_state(XDG_SURFACE_STATE_FULLSCREEN, false, 0); + } m_fullscreen = m_maximized = m_minimized = false; setTopLevel(); @@ -158,16 +160,48 @@ void QWaylandXdgSurface::setAppId(const QString & appId) return QtWayland::xdg_surface::set_app_id(appId); } -void QWaylandXdgSurface::xdg_surface_ping(uint32_t serial) +void QWaylandXdgSurface::xdg_surface_configure(int32_t width, int32_t height) { - pong(serial); + m_window->configure(0 , width, height); } -void QWaylandXdgSurface::xdg_surface_configure(uint32_t edges, int32_t width, - int32_t height) +void QWaylandXdgSurface::xdg_surface_change_state(uint32_t state, + uint32_t value, + uint32_t serial) { - m_window->configure(edges, width, height); + + if (state == XDG_SURFACE_STATE_MAXIMIZED + || state == XDG_SURFACE_STATE_FULLSCREEN) { + if (value) { + m_size = m_window->window()->geometry().size(); + } else { + QMargins m = m_window->frameMargins(); + m_window->configure(0, m_size.width() + m.left() + m.right(), m_size.height() + m.top() + m.bottom()); + } + } + + switch (state) { + case XDG_SURFACE_STATE_MAXIMIZED: + m_maximized = value; + break; + case XDG_SURFACE_STATE_FULLSCREEN: + m_fullscreen = value; + break; + } + + xdg_surface_ack_change_state(object(), state, value, serial); } +void QWaylandXdgSurface::xdg_surface_activated() +{ +} + +void QWaylandXdgSurface::xdg_surface_deactivated() +{ +} + +void QWaylandXdgSurface::xdg_surface_close() +{ +} QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandxdgsurface_p.h b/src/plugins/platforms/wayland/qwaylandxdgsurface_p.h index 744d3f377f2..d2a154ef0de 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgsurface_p.h +++ b/src/plugins/platforms/wayland/qwaylandxdgsurface_p.h @@ -93,10 +93,15 @@ private: bool m_fullscreen; QSize m_size; - void xdg_surface_ping(uint32_t serial) Q_DECL_OVERRIDE; - void xdg_surface_configure(uint32_t edges, - int32_t width, + void xdg_surface_configure(int32_t width, int32_t height) Q_DECL_OVERRIDE; + void xdg_surface_change_state(uint32_t state, + uint32_t value, + uint32_t serial) Q_DECL_OVERRIDE; + void xdg_surface_activated() Q_DECL_OVERRIDE; + void xdg_surface_deactivated() Q_DECL_OVERRIDE; + void xdg_surface_close() Q_DECL_OVERRIDE; + friend class QWaylandWindow; }; From 0bfe40dc8db31224a62d459394335777a635e4a8 Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Fri, 27 Jun 2014 14:56:12 +0200 Subject: [PATCH 0129/1507] Delete data device manager while display is still alive. Change-Id: I7691e06d75866034c93020ebdfb45421275fcf9d Reviewed-by: Giulio Camuffo --- src/plugins/platforms/wayland/qwaylanddisplay.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index 2c1a26e245c..69019dfec30 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -143,6 +143,7 @@ QWaylandDisplay::QWaylandDisplay(QWaylandIntegration *waylandIntegration) QWaylandDisplay::~QWaylandDisplay(void) { + delete mDndSelectionHandler.take(); mEventThread->quit(); mEventThread->wait(); delete mEventThreadObject; From c0847e91444e701ac176e088a81a01f61f885835 Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Mon, 30 Jun 2014 11:14:52 +0200 Subject: [PATCH 0130/1507] Avoid crashing race condition. Change-Id: I940bcbc509a689804a02f71af45f5efc19bccf9f Reviewed-by: Giulio Camuffo --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 9a7b7f09eb0..d04e76b503d 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -54,6 +54,7 @@ #include "qwaylandwindowmanagerintegration_p.h" #include +#include #include #include @@ -245,9 +246,14 @@ void QWaylandWindow::setVisible(bool visible) // QWaylandShmBackingStore::beginPaint(). } else { QWindowSystemInterface::handleExposeEvent(window(), QRegion()); + // when flushing the event queue, it could contain a close event, in which + // case 'this' will be deleted. When that happens, we must abort right away. + QPointer deleteGuard(this); QWindowSystemInterface::flushWindowSystemEvents(); - attach(static_cast(0), 0, 0); - commit(); + if (!deleteGuard.isNull()) { + attach(static_cast(0), 0, 0); + commit(); + } } } From b03877cadfb5cb2b4f61fe9205a93caf77d8c770 Mon Sep 17 00:00:00 2001 From: Giulio Camuffo Date: Mon, 7 Jul 2014 17:54:04 +0300 Subject: [PATCH 0131/1507] Add cmake test for QtCompositor and disable cmake files for QtWaylandClient Change-Id: Id6e2d46b55e521218a3c0f44cf9a4a2be5f0df7f Reviewed-by: Robin Burchell --- src/plugins/platforms/wayland/client.pro | 1 + 1 file changed, 1 insertion(+) diff --git a/src/plugins/platforms/wayland/client.pro b/src/plugins/platforms/wayland/client.pro index 28c78ab0a60..1d89619c02f 100644 --- a/src/plugins/platforms/wayland/client.pro +++ b/src/plugins/platforms/wayland/client.pro @@ -8,6 +8,7 @@ MODULE_PLUGIN_TYPES = wayland-graphics-integration-client load(qt_module) CONFIG -= precompile_header +CONFIG -= create_cmake CONFIG += link_pkgconfig qpa/genericunixfontdatabase wayland-scanner !equals(QT_WAYLAND_GL_CONFIG, nogl) { From db497bbba7486ab30715cba50a84cf3e78eeec63 Mon Sep 17 00:00:00 2001 From: Giulio Camuffo Date: Mon, 7 Jul 2014 15:48:06 +0300 Subject: [PATCH 0132/1507] Give a name to the event handling thread Change-Id: I5c6073bc1908e54bc5ae50d4b6b6044974f1ad60 Reviewed-by: Robin Burchell --- src/plugins/platforms/wayland/qwaylanddisplay.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index 69019dfec30..2da3fa871f0 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -118,6 +118,7 @@ QWaylandDisplay::QWaylandDisplay(QWaylandIntegration *waylandIntegration) mEventThreadObject = new QWaylandEventThread(0); mEventThread = new QThread(this); + mEventThread->setObjectName("QtWayland"); mEventThreadObject->moveToThread(mEventThread); mEventThread->start(); From 40ce144ae3d47a3b676aa105e78ce051c6e0fc95 Mon Sep 17 00:00:00 2001 From: Giulio Camuffo Date: Tue, 22 Jul 2014 15:24:57 +0300 Subject: [PATCH 0133/1507] Auto repeat only the keys which should be repeated Change-Id: I283bf6cc2f6c338fc769d77dd84ae7acb08eb7be Reviewed-by: Laszlo Agocs --- src/plugins/platforms/wayland/qwaylandinputdevice.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index 9c570c7c8b1..145ef608d28 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -788,7 +788,11 @@ void QWaylandInputDevice::Keyboard::keyboard_key(uint32_t serial, uint32_t time, code, 0, 0); #endif - if (state == WL_KEYBOARD_KEY_STATE_PRESSED) { + if (state == WL_KEYBOARD_KEY_STATE_PRESSED +#ifndef QT_NO_WAYLAND_XKB + && xkb_keymap_key_repeats(mXkbMap, code) +#endif + ) { mRepeatKey = qtkey; mRepeatCode = code; mRepeatTime = time; From 755eefab6a283e8bd00119749a387575464822e1 Mon Sep 17 00:00:00 2001 From: Giulio Camuffo Date: Mon, 3 Mar 2014 17:24:26 +0200 Subject: [PATCH 0134/1507] Use wayland core interfaces to signal output rotation The wl_output interface has an event for signaling the rotation of the display, so use that instead of our own thing. Change-Id: I8a017d575ee456a7a81649e19a015085fb784805 Reviewed-by: Gunnar Sletta --- .../wayland/extensions/output-extension.xml | 13 ------ .../wayland/extensions/surface-extension.xml | 3 ++ .../wayland/qwaylandextendedoutput.cpp | 42 ------------------- .../wayland/qwaylandextendedoutput_p.h | 5 --- .../wayland/qwaylandextendedsurface.cpp | 16 +++++++ .../wayland/qwaylandextendedsurface_p.h | 1 + .../platforms/wayland/qwaylandscreen.cpp | 41 +++++++++++++++--- .../platforms/wayland/qwaylandscreen_p.h | 1 + .../platforms/wayland/qwaylandwindow.cpp | 7 ++++ .../platforms/wayland/qwaylandwindow_p.h | 2 + 10 files changed, 65 insertions(+), 66 deletions(-) diff --git a/src/3rdparty/wayland/extensions/output-extension.xml b/src/3rdparty/wayland/extensions/output-extension.xml index 07aa1102cd5..0a7f11a90b6 100644 --- a/src/3rdparty/wayland/extensions/output-extension.xml +++ b/src/3rdparty/wayland/extensions/output-extension.xml @@ -46,19 +46,6 @@ - - - - - - - - - - - - - diff --git a/src/3rdparty/wayland/extensions/surface-extension.xml b/src/3rdparty/wayland/extensions/surface-extension.xml index 31f2862007e..d43b8d8b2ef 100644 --- a/src/3rdparty/wayland/extensions/surface-extension.xml +++ b/src/3rdparty/wayland/extensions/surface-extension.xml @@ -74,6 +74,9 @@ + + + diff --git a/src/plugins/platforms/wayland/qwaylandextendedoutput.cpp b/src/plugins/platforms/wayland/qwaylandextendedoutput.cpp index c79685af43b..c34f5d317e0 100644 --- a/src/plugins/platforms/wayland/qwaylandextendedoutput.cpp +++ b/src/plugins/platforms/wayland/qwaylandextendedoutput.cpp @@ -52,49 +52,7 @@ QT_BEGIN_NAMESPACE QWaylandExtendedOutput::QWaylandExtendedOutput(QWaylandScreen *screen, ::qt_extended_output *extended_output) : QtWayland::qt_extended_output(extended_output) , m_screen(screen) - , m_orientation(m_screen->orientation()) { } -Qt::ScreenOrientation QWaylandExtendedOutput::currentOrientation() const -{ - return m_orientation; -} - -void QWaylandExtendedOutput::setOrientationUpdateMask(Qt::ScreenOrientations orientations) -{ - int mask = 0; - if (orientations & Qt::PortraitOrientation) - mask |= QT_EXTENDED_OUTPUT_ROTATION_PORTRAITORIENTATION; - if (orientations & Qt::LandscapeOrientation) - mask |= QT_EXTENDED_OUTPUT_ROTATION_LANDSCAPEORIENTATION; - if (orientations & Qt::InvertedPortraitOrientation) - mask |= QT_EXTENDED_OUTPUT_ROTATION_INVERTEDPORTRAITORIENTATION; - if (orientations & Qt::InvertedLandscapeOrientation) - mask |= QT_EXTENDED_OUTPUT_ROTATION_INVERTEDLANDSCAPEORIENTATION; - set_orientation_update_mask(mask); -} - -void QWaylandExtendedOutput::extended_output_set_screen_rotation(int32_t rotation) -{ - switch (rotation) { - case QT_EXTENDED_OUTPUT_ROTATION_PORTRAITORIENTATION: - m_orientation = Qt::PortraitOrientation; - break; - case QT_EXTENDED_OUTPUT_ROTATION_LANDSCAPEORIENTATION: - m_orientation = Qt::LandscapeOrientation; - break; - case QT_EXTENDED_OUTPUT_ROTATION_INVERTEDPORTRAITORIENTATION: - m_orientation = Qt::InvertedPortraitOrientation; - break; - case QT_EXTENDED_OUTPUT_ROTATION_INVERTEDLANDSCAPEORIENTATION: - m_orientation = Qt::InvertedLandscapeOrientation; - break; - default: - m_orientation = Qt::PortraitOrientation; - break; - } - QWindowSystemInterface::handleScreenOrientationChange(m_screen->screen(), m_orientation); -} - QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandextendedoutput_p.h b/src/plugins/platforms/wayland/qwaylandextendedoutput_p.h index 4295412ec19..71bd3fce295 100644 --- a/src/plugins/platforms/wayland/qwaylandextendedoutput_p.h +++ b/src/plugins/platforms/wayland/qwaylandextendedoutput_p.h @@ -56,14 +56,9 @@ class Q_WAYLAND_CLIENT_EXPORT QWaylandExtendedOutput : public QtWayland::qt_exte public: QWaylandExtendedOutput(QWaylandScreen *screen, struct ::qt_extended_output *extended_output); - Qt::ScreenOrientation currentOrientation() const; - void setOrientationUpdateMask(Qt::ScreenOrientations mask); - private: - void extended_output_set_screen_rotation(int32_t rotation) Q_DECL_OVERRIDE; QWaylandScreen *m_screen; - Qt::ScreenOrientation m_orientation; }; QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandextendedsurface.cpp b/src/plugins/platforms/wayland/qwaylandextendedsurface.cpp index fe280416232..3155ca6b0d7 100644 --- a/src/plugins/platforms/wayland/qwaylandextendedsurface.cpp +++ b/src/plugins/platforms/wayland/qwaylandextendedsurface.cpp @@ -94,6 +94,22 @@ void QWaylandExtendedSurface::setContentOrientation(Qt::ScreenOrientation orient set_content_orientation(waylandRotationFromScreenOrientation(orientation)); } +void QWaylandExtendedSurface::setContentOrientationMask(Qt::ScreenOrientations mask) +{ + int32_t wlmask = 0; + if (mask & Qt::PrimaryOrientation) + wlmask |= QT_EXTENDED_SURFACE_ORIENTATION_PRIMARYORIENTATION; + if (mask & Qt::PortraitOrientation) + wlmask |= QT_EXTENDED_SURFACE_ORIENTATION_PORTRAITORIENTATION; + if (mask & Qt::LandscapeOrientation) + wlmask |= QT_EXTENDED_SURFACE_ORIENTATION_LANDSCAPEORIENTATION; + if (mask & Qt::InvertedPortraitOrientation) + wlmask |= QT_EXTENDED_SURFACE_ORIENTATION_INVERTEDPORTRAITORIENTATION; + if (mask & Qt::InvertedLandscapeOrientation) + wlmask |= QT_EXTENDED_SURFACE_ORIENTATION_INVERTEDLANDSCAPEORIENTATION; + set_content_orientation_mask(wlmask); +} + QVariantMap QWaylandExtendedSurface::properties() const { return m_properties; diff --git a/src/plugins/platforms/wayland/qwaylandextendedsurface_p.h b/src/plugins/platforms/wayland/qwaylandextendedsurface_p.h index 00b961d3816..030786472ef 100644 --- a/src/plugins/platforms/wayland/qwaylandextendedsurface_p.h +++ b/src/plugins/platforms/wayland/qwaylandextendedsurface_p.h @@ -62,6 +62,7 @@ public: ~QWaylandExtendedSurface(); void setContentOrientation(Qt::ScreenOrientation orientation); + void setContentOrientationMask(Qt::ScreenOrientations mask); void updateGenericProperty(const QString &name, const QVariant &value); diff --git a/src/plugins/platforms/wayland/qwaylandscreen.cpp b/src/plugins/platforms/wayland/qwaylandscreen.cpp index 416b320aa6a..cd709f8a835 100644 --- a/src/plugins/platforms/wayland/qwaylandscreen.cpp +++ b/src/plugins/platforms/wayland/qwaylandscreen.cpp @@ -44,8 +44,12 @@ #include "qwaylanddisplay_p.h" #include "qwaylandcursor_p.h" #include "qwaylandextendedoutput_p.h" +#include "qwaylandwindow_p.h" + +#include #include +#include QT_BEGIN_NAMESPACE @@ -57,6 +61,7 @@ QWaylandScreen::QWaylandScreen(QWaylandDisplay *waylandDisplay, uint32_t id) , mRefreshRate(60000) , mFormat(QImage::Format_ARGB32_Premultiplied) , mOutputName(QStringLiteral("Screen%1").arg(id)) + , m_orientation(Qt::PrimaryOrientation) , mWaylandCursor(new QWaylandCursor(this)) { // handle case of output extension global being sent after outputs @@ -99,15 +104,16 @@ QDpi QWaylandScreen::logicalDpi() const void QWaylandScreen::setOrientationUpdateMask(Qt::ScreenOrientations mask) { - if (mExtendedOutput) - mExtendedOutput->setOrientationUpdateMask(mask); + foreach (QWindow *window, QGuiApplication::allWindows()) { + QWaylandWindow *w = static_cast(window->handle()); + if (w && w->screen() == this) + w->setOrientationMask(mask); + } } Qt::ScreenOrientation QWaylandScreen::orientation() const { - if (mExtendedOutput) - return mExtendedOutput->currentOrientation(); - return QPlatformScreen::orientation(); + return m_orientation; } qreal QWaylandScreen::refreshRate() const @@ -166,7 +172,30 @@ void QWaylandScreen::output_geometry(int32_t x, int32_t y, { Q_UNUSED(subpixel); Q_UNUSED(make); - Q_UNUSED(transform); + + bool isPortrait = screen() && screen()->primaryOrientation() == Qt::PortraitOrientation; + switch (transform) { + case WL_OUTPUT_TRANSFORM_NORMAL: + m_orientation = isPortrait ? Qt::PortraitOrientation : Qt::LandscapeOrientation; + break; + case WL_OUTPUT_TRANSFORM_90: + m_orientation = isPortrait ? Qt::InvertedLandscapeOrientation : Qt::PortraitOrientation; + break; + case WL_OUTPUT_TRANSFORM_180: + m_orientation = isPortrait ? Qt::InvertedPortraitOrientation : Qt::InvertedLandscapeOrientation; + break; + case WL_OUTPUT_TRANSFORM_270: + m_orientation = isPortrait ? Qt::LandscapeOrientation : Qt::InvertedPortraitOrientation; + break; + // Ignore these ones, at least for now + case WL_OUTPUT_TRANSFORM_FLIPPED: + case WL_OUTPUT_TRANSFORM_FLIPPED_90: + case WL_OUTPUT_TRANSFORM_FLIPPED_180: + case WL_OUTPUT_TRANSFORM_FLIPPED_270: + break; + } + + QWindowSystemInterface::handleScreenOrientationChange(screen(), m_orientation); if (!model.isEmpty()) mOutputName = model; diff --git a/src/plugins/platforms/wayland/qwaylandscreen_p.h b/src/plugins/platforms/wayland/qwaylandscreen_p.h index 42408acf468..5d06227a5d3 100644 --- a/src/plugins/platforms/wayland/qwaylandscreen_p.h +++ b/src/plugins/platforms/wayland/qwaylandscreen_p.h @@ -101,6 +101,7 @@ private: QImage::Format mFormat; QSize mPhysicalSize; QString mOutputName; + Qt::ScreenOrientation m_orientation; QWaylandCursor *mWaylandCursor; }; diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index d04e76b503d..e7ff8f30049 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -130,6 +130,7 @@ QWaylandWindow::QWaylandWindow(QWindow *window) mShellSurface->setTopLevel(); } + setOrientationMask(window->screen()->orientationUpdateMask()); setWindowFlags(window->flags()); setGeometry_helper(window->geometry()); setWindowStateInternal(window->windowState()); @@ -438,6 +439,12 @@ void QWaylandWindow::handleContentOrientationChange(Qt::ScreenOrientation orient mExtendedWindow->setContentOrientation(orientation); } +void QWaylandWindow::setOrientationMask(Qt::ScreenOrientations mask) +{ + if (mExtendedWindow) + mExtendedWindow->setContentOrientationMask(mask); +} + void QWaylandWindow::setWindowState(Qt::WindowState state) { if (setWindowStateInternal(state)) diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index dbf76d11f32..2ca47d59070 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -128,8 +128,10 @@ public: QWaylandShellSurface *shellSurface() const; QWaylandExtendedSurface *extendedWindow() const; QWaylandSubSurface *subSurfaceWindow() const; + QWaylandScreen *screen() const { return mScreen; } void handleContentOrientationChange(Qt::ScreenOrientation orientation); + void setOrientationMask(Qt::ScreenOrientations mask); void setWindowState(Qt::WindowState state); void setWindowFlags(Qt::WindowFlags flags); From 1cb65e556c9a31b6669202a6d382e9ab60e7422e Mon Sep 17 00:00:00 2001 From: Giulio Camuffo Date: Mon, 9 Jun 2014 22:52:29 +0300 Subject: [PATCH 0135/1507] Use wl_surface.set_buffer_transform to signal surface rotation Drop the custom request in the surface extension, and use the wayland core mechanism. Change-Id: I580f56c90bcd3b2c5a6da08d1a033b10790ac330 Reviewed-by: Gunnar Sletta --- .../wayland/extensions/surface-extension.xml | 3 --- .../wayland/qwaylandextendedsurface.cpp | 16 ------------- .../wayland/qwaylandextendedsurface_p.h | 1 - .../platforms/wayland/qwaylandwindow.cpp | 24 +++++++++++++++++-- 4 files changed, 22 insertions(+), 22 deletions(-) diff --git a/src/3rdparty/wayland/extensions/surface-extension.xml b/src/3rdparty/wayland/extensions/surface-extension.xml index d43b8d8b2ef..680a6accab6 100644 --- a/src/3rdparty/wayland/extensions/surface-extension.xml +++ b/src/3rdparty/wayland/extensions/surface-extension.xml @@ -71,9 +71,6 @@ - - - diff --git a/src/plugins/platforms/wayland/qwaylandextendedsurface.cpp b/src/plugins/platforms/wayland/qwaylandextendedsurface.cpp index 3155ca6b0d7..b2b22688c19 100644 --- a/src/plugins/platforms/wayland/qwaylandextendedsurface.cpp +++ b/src/plugins/platforms/wayland/qwaylandextendedsurface.cpp @@ -78,22 +78,6 @@ void QWaylandExtendedSurface::updateGenericProperty(const QString &name, const Q nativeInterface->emitWindowPropertyChanged(m_window, name); } -static int32_t waylandRotationFromScreenOrientation(Qt::ScreenOrientation orientation) -{ - switch (orientation) { - case Qt::PortraitOrientation: return QT_EXTENDED_SURFACE_ORIENTATION_PORTRAITORIENTATION; - case Qt::InvertedPortraitOrientation: return QT_EXTENDED_SURFACE_ORIENTATION_INVERTEDPORTRAITORIENTATION; - case Qt::LandscapeOrientation: return QT_EXTENDED_SURFACE_ORIENTATION_LANDSCAPEORIENTATION; - case Qt::InvertedLandscapeOrientation: return QT_EXTENDED_SURFACE_ORIENTATION_INVERTEDLANDSCAPEORIENTATION; - default: return QT_EXTENDED_SURFACE_ORIENTATION_PRIMARYORIENTATION; - } -} - -void QWaylandExtendedSurface::setContentOrientation(Qt::ScreenOrientation orientation) -{ - set_content_orientation(waylandRotationFromScreenOrientation(orientation)); -} - void QWaylandExtendedSurface::setContentOrientationMask(Qt::ScreenOrientations mask) { int32_t wlmask = 0; diff --git a/src/plugins/platforms/wayland/qwaylandextendedsurface_p.h b/src/plugins/platforms/wayland/qwaylandextendedsurface_p.h index 030786472ef..2b559a93be2 100644 --- a/src/plugins/platforms/wayland/qwaylandextendedsurface_p.h +++ b/src/plugins/platforms/wayland/qwaylandextendedsurface_p.h @@ -61,7 +61,6 @@ public: QWaylandExtendedSurface(QWaylandWindow *window, struct ::qt_extended_surface *extended_surface); ~QWaylandExtendedSurface(); - void setContentOrientation(Qt::ScreenOrientation orientation); void setContentOrientationMask(Qt::ScreenOrientations mask); void updateGenericProperty(const QString &name, const QVariant &value); diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index e7ff8f30049..c6157452964 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -435,8 +435,28 @@ QWaylandSubSurface *QWaylandWindow::subSurfaceWindow() const void QWaylandWindow::handleContentOrientationChange(Qt::ScreenOrientation orientation) { - if (mExtendedWindow) - mExtendedWindow->setContentOrientation(orientation); + wl_output_transform transform; + bool isPortrait = window()->screen() && window()->screen()->primaryOrientation() == Qt::PortraitOrientation; + switch (orientation) { + case Qt::PrimaryOrientation: + transform = WL_OUTPUT_TRANSFORM_NORMAL; + break; + case Qt::LandscapeOrientation: + transform = isPortrait ? WL_OUTPUT_TRANSFORM_270 : WL_OUTPUT_TRANSFORM_NORMAL; + break; + case Qt::PortraitOrientation: + transform = isPortrait ? WL_OUTPUT_TRANSFORM_NORMAL : WL_OUTPUT_TRANSFORM_90; + break; + case Qt::InvertedLandscapeOrientation: + transform = isPortrait ? WL_OUTPUT_TRANSFORM_90 : WL_OUTPUT_TRANSFORM_180; + break; + case Qt::InvertedPortraitOrientation: + transform = isPortrait ? WL_OUTPUT_TRANSFORM_180 : WL_OUTPUT_TRANSFORM_270; + break; + } + set_buffer_transform(transform); + // set_buffer_transform is double buffered, we need to commit. + commit(); } void QWaylandWindow::setOrientationMask(Qt::ScreenOrientations mask) From b4b6dd3a7537a761ebd128942a5c892c89a3eda9 Mon Sep 17 00:00:00 2001 From: Giulio Camuffo Date: Fri, 1 Aug 2014 14:55:49 +0300 Subject: [PATCH 0136/1507] Fix checking initial screen aspect ratio The first time QWaylandScreen gets an output_geometry() event its screen() may not have been initialized yet, so manually check if the output is portrait or landscape. Change-Id: I1d58daee7a3f168a881a1e2d21956c52c09818fc Reviewed-by: Laszlo Agocs --- src/plugins/platforms/wayland/qwaylandscreen.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandscreen.cpp b/src/plugins/platforms/wayland/qwaylandscreen.cpp index cd709f8a835..3432f247595 100644 --- a/src/plugins/platforms/wayland/qwaylandscreen.cpp +++ b/src/plugins/platforms/wayland/qwaylandscreen.cpp @@ -173,7 +173,7 @@ void QWaylandScreen::output_geometry(int32_t x, int32_t y, Q_UNUSED(subpixel); Q_UNUSED(make); - bool isPortrait = screen() && screen()->primaryOrientation() == Qt::PortraitOrientation; + bool isPortrait = height > width; switch (transform) { case WL_OUTPUT_TRANSFORM_NORMAL: m_orientation = isPortrait ? Qt::PortraitOrientation : Qt::LandscapeOrientation; From 979b1db750155d40e8c786435b46e521f3d4ce62 Mon Sep 17 00:00:00 2001 From: Pier Luigi Fiorini Date: Fri, 1 Aug 2014 08:28:20 +0200 Subject: [PATCH 0137/1507] Resolve build warning on client code QString::QString(const char*) is deprecated, wrap thread name with QStringLiteral. Change-Id: Ic914d05e7bee6e3f1c6aa0bede44a6b6b85be565 Reviewed-by: Giulio Camuffo --- src/plugins/platforms/wayland/qwaylanddisplay.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index 2da3fa871f0..4fc452948d7 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -118,7 +118,7 @@ QWaylandDisplay::QWaylandDisplay(QWaylandIntegration *waylandIntegration) mEventThreadObject = new QWaylandEventThread(0); mEventThread = new QThread(this); - mEventThread->setObjectName("QtWayland"); + mEventThread->setObjectName(QStringLiteral("QtWayland")); mEventThreadObject->moveToThread(mEventThread); mEventThread->start(); From 0897a2be72bd7a401558a9064c35f8171f5243da Mon Sep 17 00:00:00 2001 From: Giulio Camuffo Date: Mon, 14 Jul 2014 15:15:16 +0300 Subject: [PATCH 0138/1507] Make sure to have a hardware integration when creating windows We need to do a full roundtrip and wait for the qt_hardware_integration global before returning from QWaylandDisplay constructor. Waiting for the screen is not enough, since there is no guarantee it will come after the hardware integration global. Change-Id: I34cb50b830632db7e5d5c7a502eeef778599b267 Reviewed-by: Gunnar Sletta --- .../platforms/wayland/qwaylanddisplay.cpp | 35 ++++++++++++++++--- 1 file changed, 31 insertions(+), 4 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index 4fc452948d7..17ac467c5b4 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -137,9 +137,7 @@ QWaylandDisplay::QWaylandDisplay(QWaylandIntegration *waylandIntegration) mWindowManagerIntegration.reset(new QWaylandWindowManagerIntegration(this)); - blockingReadEvents(); - - waitForScreens(); + forceRoundTrip(); } QWaylandDisplay::~QWaylandDisplay(void) @@ -235,6 +233,9 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin mTextInputManager.reset(new QtWayland::wl_text_input_manager(registry, id)); } else if (interface == QStringLiteral("qt_hardware_integration")) { mHardwareIntegration.reset(new QWaylandHardwareIntegration(registry, id)); + // make a roundtrip here since we need to receive the events sent by + // qt_hardware_integration before creating windows + forceRoundTrip(); } mGlobals.append(RegistryGlobal(id, interface, version, registry)); @@ -271,9 +272,35 @@ uint32_t QWaylandDisplay::currentTimeMillisec() return 0; } +static void +sync_callback(void *data, struct wl_callback *callback, uint32_t serial) +{ + Q_UNUSED(serial) + bool *done = static_cast(data); + + *done = true; + wl_callback_destroy(callback); +} + +static const struct wl_callback_listener sync_listener = { + sync_callback +}; + void QWaylandDisplay::forceRoundTrip() { - wl_display_roundtrip(mDisplay); + // wl_display_roundtrip() works on the main queue only, + // but we use a separate one, so basically reimplement it here + int ret = 0; + bool done = false; + wl_callback *callback = wl_display_sync(mDisplay); + wl_proxy_set_queue((struct wl_proxy *)callback, mEventQueue); + wl_callback_add_listener(callback, &sync_listener, &done); + flushRequests(); + while (!done && ret >= 0) + ret = wl_display_dispatch_queue(mDisplay, mEventQueue); + + if (ret == -1 && !done) + wl_callback_destroy(callback); } QtWayland::xdg_shell *QWaylandDisplay::shellXdg() From fb46141b75fd7019ec7428c08219621fb94e7825 Mon Sep 17 00:00:00 2001 From: Giulio Camuffo Date: Tue, 5 Aug 2014 11:30:29 +0300 Subject: [PATCH 0139/1507] Bind the globals with the highest version available Change-Id: I639b124f15416905c17665755b3288c905880f39 Reviewed-by: Gunnar Sletta --- src/tools/qtwaylandscanner/qtwaylandscanner.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp index 5ffb52f4ef6..475b9fec2c4 100644 --- a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp +++ b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp @@ -935,7 +935,7 @@ void process(QXmlStreamReader &xml, const QByteArray &headerPath, const QByteArr printf(" void %s::init(struct ::wl_registry *registry, int id)\n", interfaceName); printf(" {\n"); - printf(" m_%s = static_cast(wl_registry_bind(registry, id, &%s_interface, %d));\n", interfaceName, interfaceName, interfaceName, 1); + printf(" m_%s = static_cast(wl_registry_bind(registry, id, &%s_interface, %s_interface.version));\n", interfaceName, interfaceName, interfaceName, interfaceName); if (hasEvents) printf(" init_listener();\n"); printf(" }\n"); From ded0d67c227d0b7c742313395d418e6ac88c25a3 Mon Sep 17 00:00:00 2001 From: Giulio Camuffo Date: Tue, 5 Aug 2014 11:29:27 +0300 Subject: [PATCH 0140/1507] Wait to get wl_output's events before creating surfaces Change-Id: I2eb4b40a4b8b1de7990d06b57b0d7a7b04ee9657 Reviewed-by: Gunnar Sletta --- src/plugins/platforms/wayland/qwaylanddisplay.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index 17ac467c5b4..459c7f461ee 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -203,6 +203,8 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin if (interface == QStringLiteral("wl_output")) { mScreens.append(new QWaylandScreen(this, id)); + // We need to get the output events before creating surfaces + forceRoundTrip(); } else if (interface == QStringLiteral("wl_compositor")) { mCompositor.init(registry, id); } else if (interface == QStringLiteral("wl_shm")) { From 9c1eef7e22536e8bbc22da9b2a409d8f09acd56a Mon Sep 17 00:00:00 2001 From: Giulio Camuffo Date: Tue, 1 Jul 2014 15:56:11 +0300 Subject: [PATCH 0141/1507] Add a way to have out of source shell integrations Some platforms (especially non-desktop ones) may use a custom Wayland shell extension, more tailored to the form factor than the generic and desktoppy wl_shell or xdg_shell. Instead of stuffing N protocol implementations in the QPA plugin use a plugin architecture to allow them to live out of tree. When creating a shell surface the QT_WAYLAND_SHELL_INTEGRATION env variable will be checked, and if it points to a valid plugin that will be used to create the shell surface, falling back to wl_shell or xdg_shell if no plugin is specified. Change-Id: I05019174bb915199dd726f5fdcc0385ef846e8de Reviewed-by: Pier Luigi Fiorini Reviewed-by: Philippe Coval Reviewed-by: Jan Arne Petersen Reviewed-by: Gunnar Sletta --- src/plugins/platforms/wayland/client.pro | 1 + .../platforms/wayland/qwaylanddisplay.cpp | 17 ++++ .../platforms/wayland/qwaylanddisplay_p.h | 3 + .../wayland/qwaylandextendedsurface.cpp | 30 +----- .../wayland/qwaylandextendedsurface_p.h | 6 +- .../platforms/wayland/qwaylandintegration.cpp | 37 +++++++ .../platforms/wayland/qwaylandintegration_p.h | 5 + .../wayland/qwaylandnativeinterface.cpp | 17 +--- .../wayland/qwaylandshellsurface.cpp | 17 ++++ .../wayland/qwaylandshellsurface_p.h | 19 +++- .../platforms/wayland/qwaylandwindow.cpp | 85 ++++++++++------ .../platforms/wayland/qwaylandwindow_p.h | 14 ++- .../wayland/qwaylandwlshellsurface.cpp | 36 +++++++ .../wayland/qwaylandwlshellsurface_p.h | 8 ++ .../platforms/wayland/qwaylandxdgsurface.cpp | 36 +++++++ .../platforms/wayland/qwaylandxdgsurface_p.h | 8 ++ .../qwaylandshellintegration_p.h | 66 +++++++++++++ .../qwaylandshellintegrationfactory.cpp | 96 +++++++++++++++++++ .../qwaylandshellintegrationfactory_p.h | 61 ++++++++++++ .../qwaylandshellintegrationplugin.cpp | 55 +++++++++++ .../qwaylandshellintegrationplugin_p.h | 69 +++++++++++++ .../shellintegration/shellintegration.pri | 11 +++ 22 files changed, 618 insertions(+), 79 deletions(-) create mode 100644 src/plugins/platforms/wayland/shellintegration/qwaylandshellintegration_p.h create mode 100644 src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationfactory.cpp create mode 100644 src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationfactory_p.h create mode 100644 src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationplugin.cpp create mode 100644 src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationplugin_p.h create mode 100644 src/plugins/platforms/wayland/shellintegration/shellintegration.pri diff --git a/src/plugins/platforms/wayland/client.pro b/src/plugins/platforms/wayland/client.pro index 1d89619c02f..6aaa2541980 100644 --- a/src/plugins/platforms/wayland/client.pro +++ b/src/plugins/platforms/wayland/client.pro @@ -107,3 +107,4 @@ HEADERS += qwaylandintegration_p.h \ qwaylanddatadevice_p.h \ include(hardwareintegration/hardwareintegration.pri) +include(shellintegration/shellintegration.pri) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index 459c7f461ee..5764d3110fd 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -51,8 +51,11 @@ #include "qwaylanddatadevicemanager_p.h" #include "qwaylandhardwareintegration_p.h" #include "qwaylandxdgshell_p.h" +#include "qwaylandxdgsurface_p.h" +#include "qwaylandwlshellsurface_p.h" #include "qwaylandwindowmanagerintegration_p.h" +#include "qwaylandshellintegration_p.h" #include "qwaylandextendedoutput_p.h" #include "qwaylandextendedsurface_p.h" @@ -79,6 +82,20 @@ struct wl_surface *QWaylandDisplay::createSurface(void *handle) return surface; } +QWaylandShellSurface *QWaylandDisplay::createShellSurface(QWaylandWindow *window) +{ + if (mWaylandIntegration->shellIntegration()) + return mWaylandIntegration->shellIntegration()->createShellSurface(window); + + if (shellXdg()) { + return new QWaylandXdgSurface(shellXdg()->get_xdg_surface(window->object()), window); + } else if (shell()) { + return new QWaylandWlShellSurface(shell()->get_shell_surface(window->object()), window); + } + + return Q_NULLPTR; +} + QWaylandClientBufferIntegration * QWaylandDisplay::clientBufferIntegration() const { return mWaylandIntegration->clientBufferIntegration(); diff --git a/src/plugins/platforms/wayland/qwaylanddisplay_p.h b/src/plugins/platforms/wayland/qwaylanddisplay_p.h index f1b35a7121f..6ed30d195a4 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay_p.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay_p.h @@ -73,6 +73,7 @@ class QWaylandEventThread; class QWaylandIntegration; class QWaylandHardwareIntegration; class QWaylandXdgShell; +class QWaylandShellSurface; namespace QtWayland { class qt_output_extension; @@ -101,6 +102,7 @@ public: QWaylandScreen *screenForOutput(struct wl_output *output) const; struct wl_surface *createSurface(void *handle); + QWaylandShellSurface *createShellSurface(QWaylandWindow *window); QWaylandClientBufferIntegration *clientBufferIntegration() const; @@ -142,6 +144,7 @@ public: RegistryGlobal(uint32_t id_, const QString &interface_, uint32_t version_, struct ::wl_registry *registry_) : id(id_), interface(interface_), version(version_), registry(registry_) { } }; + QList globals() const { return mGlobals; } /* wl_registry_add_listener does not add but rather sets a listener, so this function is used * to enable many listeners at once. */ diff --git a/src/plugins/platforms/wayland/qwaylandextendedsurface.cpp b/src/plugins/platforms/wayland/qwaylandextendedsurface.cpp index b2b22688c19..e589698ef6f 100644 --- a/src/plugins/platforms/wayland/qwaylandextendedsurface.cpp +++ b/src/plugins/platforms/wayland/qwaylandextendedsurface.cpp @@ -53,8 +53,8 @@ QT_BEGIN_NAMESPACE -QWaylandExtendedSurface::QWaylandExtendedSurface(QWaylandWindow *window, struct ::qt_extended_surface *extended_surface) - : QtWayland::qt_extended_surface(extended_surface) +QWaylandExtendedSurface::QWaylandExtendedSurface(QWaylandWindow *window) + : QtWayland::qt_extended_surface(window->display()->windowExtension()->get_extended_surface(window->object())) , m_window(window) { } @@ -71,11 +71,6 @@ void QWaylandExtendedSurface::updateGenericProperty(const QString &name, const Q ds << value; update_generic_property(name, byteValue); - - m_properties.insert(name, value); - QWaylandNativeInterface *nativeInterface = static_cast( - QGuiApplication::platformNativeInterface()); - nativeInterface->emitWindowPropertyChanged(m_window, name); } void QWaylandExtendedSurface::setContentOrientationMask(Qt::ScreenOrientations mask) @@ -94,21 +89,6 @@ void QWaylandExtendedSurface::setContentOrientationMask(Qt::ScreenOrientations m set_content_orientation_mask(wlmask); } -QVariantMap QWaylandExtendedSurface::properties() const -{ - return m_properties; -} - -QVariant QWaylandExtendedSurface::property(const QString &name) -{ - return m_properties.value(name); -} - -QVariant QWaylandExtendedSurface::property(const QString &name, const QVariant &defaultValue) -{ - return m_properties.value(name,defaultValue); -} - void QWaylandExtendedSurface::extended_surface_onscreen_visibility(int32_t visibility) { m_window->window()->setVisibility(static_cast(visibility)); @@ -122,11 +102,7 @@ void QWaylandExtendedSurface::extended_surface_set_generic_property(const QStrin QDataStream ds(data); ds >> variantValue; - m_properties.insert(name, variantValue); - - QWaylandNativeInterface *nativeInterface = static_cast( - QGuiApplication::platformNativeInterface()); - nativeInterface->emitWindowPropertyChanged(m_window, name); + m_window->setProperty(name, variantValue); } void QWaylandExtendedSurface::extended_surface_close() diff --git a/src/plugins/platforms/wayland/qwaylandextendedsurface_p.h b/src/plugins/platforms/wayland/qwaylandextendedsurface_p.h index 2b559a93be2..1d966292c58 100644 --- a/src/plugins/platforms/wayland/qwaylandextendedsurface_p.h +++ b/src/plugins/platforms/wayland/qwaylandextendedsurface_p.h @@ -58,17 +58,13 @@ class QWaylandWindow; class Q_WAYLAND_CLIENT_EXPORT QWaylandExtendedSurface : public QtWayland::qt_extended_surface { public: - QWaylandExtendedSurface(QWaylandWindow *window, struct ::qt_extended_surface *extended_surface); + QWaylandExtendedSurface(QWaylandWindow *window); ~QWaylandExtendedSurface(); void setContentOrientationMask(Qt::ScreenOrientations mask); void updateGenericProperty(const QString &name, const QVariant &value); - QVariantMap properties() const; - QVariant property(const QString &name); - QVariant property(const QString &name, const QVariant &defaultValue); - Qt::WindowFlags setWindowFlags(Qt::WindowFlags flags); private: diff --git a/src/plugins/platforms/wayland/qwaylandintegration.cpp b/src/plugins/platforms/wayland/qwaylandintegration.cpp index 02b7e56c667..85300a13062 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandintegration.cpp @@ -72,6 +72,9 @@ #include "qwaylandserverbufferintegration_p.h" #include "qwaylandserverbufferintegrationfactory_p.h" +#include "qwaylandshellintegration_p.h" +#include "qwaylandshellintegrationfactory_p.h" + QT_BEGIN_NAMESPACE class GenericWaylandTheme: public QGenericUnixTheme @@ -108,6 +111,7 @@ public: QWaylandIntegration::QWaylandIntegration() : mClientBufferIntegration(0) + , mShellIntegration(Q_NULLPTR) , mFontDb(new QGenericUnixFontDatabase()) , mNativeInterface(new QWaylandNativeInterface(this)) #ifndef QT_NO_ACCESSIBILITY @@ -117,6 +121,7 @@ QWaylandIntegration::QWaylandIntegration() #endif , mClientBufferIntegrationInitialized(false) , mServerBufferIntegrationInitialized(false) + , mShellIntegrationInitialized(false) { mDisplay = new QWaylandDisplay(this); mClipboard = new QWaylandClipboard(mDisplay); @@ -260,6 +265,14 @@ QWaylandServerBufferIntegration *QWaylandIntegration::serverBufferIntegration() return mServerBufferIntegration; } +QWaylandShellIntegration *QWaylandIntegration::shellIntegration() const +{ + if (!mShellIntegrationInitialized) + const_cast(this)->initializeShellIntegration(); + + return mShellIntegration; +} + void QWaylandIntegration::initializeClientBufferIntegration() { mClientBufferIntegrationInitialized = true; @@ -321,4 +334,28 @@ void QWaylandIntegration::initializeServerBufferIntegration() qWarning("Failed to load server buffer integration %s\n", qPrintable(targetKey)); } +void QWaylandIntegration::initializeShellIntegration() +{ + mShellIntegrationInitialized = true; + + QByteArray integrationName = qgetenv("QT_WAYLAND_SHELL_INTEGRATION"); + QString targetKey = QString::fromLocal8Bit(integrationName); + + if (targetKey.isEmpty()) { + return; + } + + QStringList keys = QWaylandShellIntegrationFactory::keys(); + if (keys.contains(targetKey)) { + mShellIntegration = QWaylandShellIntegrationFactory::create(targetKey, QStringList()); + } + if (mShellIntegration && mShellIntegration->initialize(mDisplay)) { + qDebug("Using the '%s' shell integration", qPrintable(targetKey)); + } else { + delete mShellIntegration; + mShellIntegration = Q_NULLPTR; + qWarning("Failed to load shell integration %s", qPrintable(targetKey)); + } +} + QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandintegration_p.h b/src/plugins/platforms/wayland/qwaylandintegration_p.h index 7c062c0eedf..025e0b4df61 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration_p.h +++ b/src/plugins/platforms/wayland/qwaylandintegration_p.h @@ -51,6 +51,7 @@ class QWaylandBuffer; class QWaylandDisplay; class QWaylandClientBufferIntegration; class QWaylandServerBufferIntegration; +class QWaylandShellIntegration; class Q_WAYLAND_CLIENT_EXPORT QWaylandIntegration : public QPlatformIntegration { @@ -90,12 +91,15 @@ public: virtual QWaylandClientBufferIntegration *clientBufferIntegration() const; virtual QWaylandServerBufferIntegration *serverBufferIntegration() const; + virtual QWaylandShellIntegration *shellIntegration() const; protected: QWaylandClientBufferIntegration *mClientBufferIntegration; QWaylandServerBufferIntegration *mServerBufferIntegration; + QWaylandShellIntegration *mShellIntegration; private: void initializeClientBufferIntegration(); void initializeServerBufferIntegration(); + void initializeShellIntegration(); QPlatformFontDatabase *mFontDb; QPlatformClipboard *mClipboard; QPlatformDrag *mDrag; @@ -105,6 +109,7 @@ private: QPlatformAccessibility *mAccessibility; bool mClientBufferIntegrationInitialized; bool mServerBufferIntegrationInitialized; + bool mShellIntegrationInitialized; }; QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp b/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp index e3d6fef4a0a..3d714c2fb00 100644 --- a/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp +++ b/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp @@ -99,34 +99,25 @@ void *QWaylandNativeInterface::nativeResourceForScreen(const QByteArray &resourc QVariantMap QWaylandNativeInterface::windowProperties(QPlatformWindow *window) const { QWaylandWindow *waylandWindow = static_cast(window); - if (QWaylandExtendedSurface *extendedWindow = waylandWindow->extendedWindow()) - return extendedWindow->properties(); - return QVariantMap(); + return waylandWindow->properties(); } - QVariant QWaylandNativeInterface::windowProperty(QPlatformWindow *window, const QString &name) const { QWaylandWindow *waylandWindow = static_cast(window); - if (QWaylandExtendedSurface *extendedWindow = waylandWindow->extendedWindow()) - return extendedWindow->property(name); - return QVariant(); + return waylandWindow->property(name); } QVariant QWaylandNativeInterface::windowProperty(QPlatformWindow *window, const QString &name, const QVariant &defaultValue) const { QWaylandWindow *waylandWindow = static_cast(window); - if (QWaylandExtendedSurface *extendedWindow = waylandWindow->extendedWindow()) { - return extendedWindow->property(name,defaultValue); - } - return defaultValue; + return waylandWindow->property(name, defaultValue); } void QWaylandNativeInterface::setWindowProperty(QPlatformWindow *window, const QString &name, const QVariant &value) { QWaylandWindow *wlWindow = static_cast(window); - if (QWaylandExtendedSurface *extendedWindow = wlWindow->extendedWindow()) - extendedWindow->updateGenericProperty(name,value); + wlWindow->sendProperty(name, value); } void QWaylandNativeInterface::emitWindowPropertyChanged(QPlatformWindow *window, const QString &name) diff --git a/src/plugins/platforms/wayland/qwaylandshellsurface.cpp b/src/plugins/platforms/wayland/qwaylandshellsurface.cpp index 80e509b15e3..d68ae1b5d16 100644 --- a/src/plugins/platforms/wayland/qwaylandshellsurface.cpp +++ b/src/plugins/platforms/wayland/qwaylandshellsurface.cpp @@ -40,3 +40,20 @@ ****************************************************************************/ #include "qwaylandshellsurface_p.h" +#include "qwaylandwindow_p.h" +#include "qwaylandextendedsurface_p.h" + +QWaylandShellSurface::QWaylandShellSurface(QWaylandWindow *window) + : m_window(window) +{ +} + +void QWaylandShellSurface::setWindowFlags(Qt::WindowFlags flags) +{ +} + +void QWaylandShellSurface::sendProperty(const QString &name, const QVariant &value) +{ + Q_UNUSED(name) + Q_UNUSED(value) +} diff --git a/src/plugins/platforms/wayland/qwaylandshellsurface_p.h b/src/plugins/platforms/wayland/qwaylandshellsurface_p.h index 2f59f60c19b..6f2336162c2 100644 --- a/src/plugins/platforms/wayland/qwaylandshellsurface_p.h +++ b/src/plugins/platforms/wayland/qwaylandshellsurface_p.h @@ -51,6 +51,7 @@ QT_BEGIN_NAMESPACE +class QVariant; class QWaylandWindow; class QWaylandInputDevice; class QWindow; @@ -58,6 +59,7 @@ class QWindow; class Q_WAYLAND_CLIENT_EXPORT QWaylandShellSurface { public: + explicit QWaylandShellSurface(QWaylandWindow *window); virtual ~QWaylandShellSurface() {} virtual void resize(QWaylandInputDevice * /*inputDevice*/, enum wl_shell_surface_resize /*edges*/) {} @@ -66,7 +68,19 @@ public: virtual void setTitle(const QString & /*title*/) {} virtual void setAppId(const QString & /*appId*/) {} -private: + virtual void setWindowFlags(Qt::WindowFlags flags); + + virtual bool isExposed() const { return true; } + + virtual void raise() {} + virtual void lower() {} + virtual void setContentOrientationMask(Qt::ScreenOrientations orientation) { Q_UNUSED(orientation) } + + virtual void sendProperty(const QString &name, const QVariant &value); + + inline QWaylandWindow *window() { return m_window; } + +protected: virtual void setMaximized() {} virtual void setFullscreen() {} virtual void setNormal() {} @@ -74,6 +88,9 @@ private: virtual void setTopLevel() {} virtual void updateTransientParent(QWindow * /*parent*/) {} + +private: + QWaylandWindow *m_window; friend class QWaylandWindow; }; diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index c6157452964..a6190c0d171 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -48,10 +48,10 @@ #include "qwaylandshellsurface_p.h" #include "qwaylandwlshellsurface_p.h" #include "qwaylandxdgsurface_p.h" -#include "qwaylandextendedsurface_p.h" #include "qwaylandsubsurface_p.h" #include "qwaylanddecoration_p.h" #include "qwaylandwindowmanagerintegration_p.h" +#include "qwaylandnativeinterface_p.h" #include #include @@ -72,7 +72,6 @@ QWaylandWindow::QWaylandWindow(QWindow *window) , mScreen(QWaylandScreen::waylandScreenFromWindow(window)) , mDisplay(mScreen->display()) , mShellSurface(0) - , mExtendedWindow(0) , mSubSurfaceWindow(0) , mWindowDecoration(0) , mMouseEventsInContentArea(false) @@ -95,21 +94,13 @@ QWaylandWindow::QWaylandWindow(QWindow *window) static WId id = 1; mWindowId = id++; - if (!(window->flags() & Qt::BypassWindowManagerHint)) { - if (mDisplay->shellXdg()) { - if (window->type() & Qt::Window) { - mShellSurface = new QWaylandXdgSurface(mDisplay->shellXdg()->get_xdg_surface(object()), this); - } - } else if (mDisplay->shell() && window->type() & Qt::Window) { - mShellSurface = new QWaylandWlShellSurface(mDisplay->shell()->get_shell_surface(object()), this); - } - } - - if (mDisplay->windowExtension()) - mExtendedWindow = new QWaylandExtendedSurface(this, mDisplay->windowExtension()->get_extended_surface(object())); if (mDisplay->subSurfaceExtension()) mSubSurfaceWindow = new QWaylandSubSurface(this, mDisplay->subSurfaceExtension()->get_sub_surface_aware_surface(object())); + if (!(window->flags() & Qt::BypassWindowManagerHint)) { + mShellSurface = mDisplay->createShellSurface(this); + } + if (mShellSurface) { // Set initial surface title mShellSurface->setTitle(window->title()); @@ -141,7 +132,6 @@ QWaylandWindow::~QWaylandWindow() { if (isInitialized()) { delete mShellSurface; - delete mExtendedWindow; destroy(); } if (mFrameCallback) @@ -221,10 +211,10 @@ void QWaylandWindow::setGeometry(const QRect &rect) else QWindowSystemInterface::handleGeometryChange(window(), geometry()); - QWindowSystemInterface::handleExposeEvent(window(), QRect(QPoint(), geometry().size())); - mSentInitialResize = true; } + + QWindowSystemInterface::handleExposeEvent(window(), QRect(QPoint(), geometry().size())); } void QWaylandWindow::setVisible(bool visible) @@ -261,15 +251,15 @@ void QWaylandWindow::setVisible(bool visible) void QWaylandWindow::raise() { - if (mExtendedWindow) - mExtendedWindow->raise(); + if (mShellSurface) + mShellSurface->raise(); } void QWaylandWindow::lower() { - if (mExtendedWindow) - mExtendedWindow->lower(); + if (mShellSurface) + mShellSurface->lower(); } void QWaylandWindow::configure(uint32_t edges, int32_t width, int32_t height) @@ -423,11 +413,6 @@ QWaylandShellSurface *QWaylandWindow::shellSurface() const return mShellSurface; } -QWaylandExtendedSurface *QWaylandWindow::extendedWindow() const -{ - return mExtendedWindow; -} - QWaylandSubSurface *QWaylandWindow::subSurfaceWindow() const { return mSubSurfaceWindow; @@ -461,8 +446,8 @@ void QWaylandWindow::handleContentOrientationChange(Qt::ScreenOrientation orient void QWaylandWindow::setOrientationMask(Qt::ScreenOrientations mask) { - if (mExtendedWindow) - mExtendedWindow->setContentOrientationMask(mask); + if (mShellSurface) + mShellSurface->setContentOrientationMask(mask); } void QWaylandWindow::setWindowState(Qt::WindowState state) @@ -473,8 +458,8 @@ void QWaylandWindow::setWindowState(Qt::WindowState state) void QWaylandWindow::setWindowFlags(Qt::WindowFlags flags) { - if (mExtendedWindow) - mExtendedWindow->setWindowFlags(flags); + if (mShellSurface) + mShellSurface->setWindowFlags(flags); } bool QWaylandWindow::createDecoration() @@ -643,6 +628,13 @@ void QWaylandWindow::requestActivateWindow() // we rely on compositor setting keyboard focus based on window stacking. } +bool QWaylandWindow::isExposed() const +{ + if (mShellSurface) + return window()->isVisible() && mShellSurface->isExposed(); + return QPlatformWindow::isExposed(); +} + bool QWaylandWindow::setMouseGrabEnabled(bool grab) { if (window()->type() != Qt::Popup) { @@ -683,4 +675,37 @@ bool QWaylandWindow::setWindowStateInternal(Qt::WindowState state) return true; } +void QWaylandWindow::sendProperty(const QString &name, const QVariant &value) +{ + m_properties.insert(name, value); + QWaylandNativeInterface *nativeInterface = static_cast( + QGuiApplication::platformNativeInterface()); + nativeInterface->emitWindowPropertyChanged(this, name); + if (mShellSurface) + mShellSurface->sendProperty(name, value); +} + +void QWaylandWindow::setProperty(const QString &name, const QVariant &value) +{ + m_properties.insert(name, value); + QWaylandNativeInterface *nativeInterface = static_cast( + QGuiApplication::platformNativeInterface()); + nativeInterface->emitWindowPropertyChanged(this, name); +} + +QVariantMap QWaylandWindow::properties() const +{ + return m_properties; +} + +QVariant QWaylandWindow::property(const QString &name) +{ + return m_properties.value(name); +} + +QVariant QWaylandWindow::property(const QString &name, const QVariant &defaultValue) +{ + return m_properties.value(name, defaultValue); +} + QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index 2ca47d59070..9c0be84c6a5 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -45,6 +45,7 @@ #include #include #include +#include #include @@ -58,7 +59,6 @@ QT_BEGIN_NAMESPACE class QWaylandDisplay; class QWaylandBuffer; class QWaylandShellSurface; -class QWaylandExtendedSurface; class QWaylandSubSurface; class QWaylandDecoration; class QWaylandInputDevice; @@ -125,8 +125,8 @@ public: static QWaylandWindow *fromWlSurface(::wl_surface *surface); + QWaylandDisplay *display() const { return mDisplay; } QWaylandShellSurface *shellSurface() const; - QWaylandExtendedSurface *extendedWindow() const; QWaylandSubSurface *subSurfaceWindow() const; QWaylandScreen *screen() const { return mScreen; } @@ -140,6 +140,7 @@ public: void lower() Q_DECL_OVERRIDE; void requestActivateWindow() Q_DECL_OVERRIDE; + bool isExposed() const Q_DECL_OVERRIDE; QWaylandDecoration *decoration() const; void setDecoration(QWaylandDecoration *decoration); @@ -171,6 +172,13 @@ public: bool setMouseGrabEnabled(bool grab); static QWaylandWindow *mouseGrab() { return mMouseGrab; } + void sendProperty(const QString &name, const QVariant &value); + void setProperty(const QString &name, const QVariant &value); + + QVariantMap properties() const; + QVariant property(const QString &name); + QVariant property(const QString &name, const QVariant &defaultValue); + public slots: void requestResize(); @@ -178,7 +186,6 @@ protected: QWaylandScreen *mScreen; QWaylandDisplay *mDisplay; QWaylandShellSurface *mShellSurface; - QWaylandExtendedSurface *mExtendedWindow; QWaylandSubSurface *mSubSurfaceWindow; QWaylandDecoration *mWindowDecoration; @@ -198,6 +205,7 @@ protected: bool mCanResize; bool mResizeDirty; bool mResizeAfterSwap; + QVariantMap m_properties; bool mSentInitialResize; QPoint mOffset; diff --git a/src/plugins/platforms/wayland/qwaylandwlshellsurface.cpp b/src/plugins/platforms/wayland/qwaylandwlshellsurface.cpp index 4b73ec23236..a8e89ec98c2 100644 --- a/src/plugins/platforms/wayland/qwaylandwlshellsurface.cpp +++ b/src/plugins/platforms/wayland/qwaylandwlshellsurface.cpp @@ -46,6 +46,7 @@ #include "qwaylandinputdevice_p.h" #include "qwaylanddecoration_p.h" #include "qwaylandscreen_p.h" +#include "qwaylandextendedsurface_p.h" #include @@ -53,15 +54,20 @@ QT_BEGIN_NAMESPACE QWaylandWlShellSurface::QWaylandWlShellSurface(struct ::wl_shell_surface *shell_surface, QWaylandWindow *window) : QtWayland::wl_shell_surface(shell_surface) + , QWaylandShellSurface(window) , m_window(window) , m_maximized(false) , m_fullscreen(false) + , m_extendedWindow(Q_NULLPTR) { + if (window->display()->windowExtension()) + m_extendedWindow = new QWaylandExtendedSurface(window); } QWaylandWlShellSurface::~QWaylandWlShellSurface() { wl_shell_surface_destroy(object()); + delete m_extendedWindow; } void QWaylandWlShellSurface::resize(QWaylandInputDevice *inputDevice, enum wl_shell_surface_resize edges) @@ -87,6 +93,36 @@ void QWaylandWlShellSurface::setAppId(const QString & appId) return QtWayland::wl_shell_surface::set_class(appId); } +void QWaylandWlShellSurface::raise() +{ + if (m_extendedWindow) + m_extendedWindow->raise(); +} + +void QWaylandWlShellSurface::lower() +{ + if (m_extendedWindow) + m_extendedWindow->lower(); +} + +void QWaylandWlShellSurface::setContentOrientationMask(Qt::ScreenOrientations orientation) +{ + if (m_extendedWindow) + m_extendedWindow->setContentOrientationMask(orientation); +} + +void QWaylandWlShellSurface::setWindowFlags(Qt::WindowFlags flags) +{ + if (m_extendedWindow) + m_extendedWindow->setWindowFlags(flags); +} + +void QWaylandWlShellSurface::sendProperty(const QString &name, const QVariant &value) +{ + if (m_extendedWindow) + m_extendedWindow->updateGenericProperty(name, value); +} + void QWaylandWlShellSurface::setMaximized() { m_maximized = true; diff --git a/src/plugins/platforms/wayland/qwaylandwlshellsurface_p.h b/src/plugins/platforms/wayland/qwaylandwlshellsurface_p.h index d02bb7bfed0..8d6e298b9da 100644 --- a/src/plugins/platforms/wayland/qwaylandwlshellsurface_p.h +++ b/src/plugins/platforms/wayland/qwaylandwlshellsurface_p.h @@ -55,6 +55,7 @@ QT_BEGIN_NAMESPACE class QWaylandWindow; class QWaylandInputDevice; class QWindow; +class QWaylandExtendedSurface; class Q_WAYLAND_CLIENT_EXPORT QWaylandWlShellSurface : public QtWayland::wl_shell_surface , public QWaylandShellSurface @@ -72,6 +73,12 @@ public: void setTitle(const QString & title) Q_DECL_OVERRIDE; void setAppId(const QString &appId) Q_DECL_OVERRIDE; + void raise() Q_DECL_OVERRIDE; + void lower() Q_DECL_OVERRIDE; + void setContentOrientationMask(Qt::ScreenOrientations orientation) Q_DECL_OVERRIDE; + void setWindowFlags(Qt::WindowFlags flags) Q_DECL_OVERRIDE; + void sendProperty(const QString &name, const QVariant &value) Q_DECL_OVERRIDE; + private: void setMaximized() Q_DECL_OVERRIDE; void setFullscreen() Q_DECL_OVERRIDE; @@ -86,6 +93,7 @@ private: bool m_maximized; bool m_fullscreen; QSize m_size; + QWaylandExtendedSurface *m_extendedWindow; void shell_surface_ping(uint32_t serial) Q_DECL_OVERRIDE; void shell_surface_configure(uint32_t edges, diff --git a/src/plugins/platforms/wayland/qwaylandxdgsurface.cpp b/src/plugins/platforms/wayland/qwaylandxdgsurface.cpp index 5fb74d25b71..126c9db72b3 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgsurface.cpp +++ b/src/plugins/platforms/wayland/qwaylandxdgsurface.cpp @@ -46,6 +46,7 @@ #include "qwaylandinputdevice_p.h" #include "qwaylanddecoration_p.h" #include "qwaylandscreen_p.h" +#include "qwaylandextendedsurface_p.h" #include @@ -53,16 +54,21 @@ QT_BEGIN_NAMESPACE QWaylandXdgSurface::QWaylandXdgSurface(struct ::xdg_surface *xdg_surface, QWaylandWindow *window) : QtWayland::xdg_surface(xdg_surface) + , QWaylandShellSurface(window) , m_window(window) , m_maximized(false) , m_minimized(false) , m_fullscreen(false) + , m_extendedWindow(Q_NULLPTR) { + if (window->display()->windowExtension()) + m_extendedWindow = new QWaylandExtendedSurface(window); } QWaylandXdgSurface::~QWaylandXdgSurface() { xdg_surface_destroy(object()); + delete m_extendedWindow; } void QWaylandXdgSurface::resize(QWaylandInputDevice *inputDevice, enum wl_shell_surface_resize edges) @@ -160,6 +166,36 @@ void QWaylandXdgSurface::setAppId(const QString & appId) return QtWayland::xdg_surface::set_app_id(appId); } +void QWaylandXdgSurface::raise() +{ + if (m_extendedWindow) + m_extendedWindow->raise(); +} + +void QWaylandXdgSurface::lower() +{ + if (m_extendedWindow) + m_extendedWindow->lower(); +} + +void QWaylandXdgSurface::setContentOrientationMask(Qt::ScreenOrientations orientation) +{ + if (m_extendedWindow) + m_extendedWindow->setContentOrientationMask(orientation); +} + +void QWaylandXdgSurface::setWindowFlags(Qt::WindowFlags flags) +{ + if (m_extendedWindow) + m_extendedWindow->setWindowFlags(flags); +} + +void QWaylandXdgSurface::sendProperty(const QString &name, const QVariant &value) +{ + if (m_extendedWindow) + m_extendedWindow->updateGenericProperty(name, value); +} + void QWaylandXdgSurface::xdg_surface_configure(int32_t width, int32_t height) { m_window->configure(0 , width, height); diff --git a/src/plugins/platforms/wayland/qwaylandxdgsurface_p.h b/src/plugins/platforms/wayland/qwaylandxdgsurface_p.h index d2a154ef0de..635c9496a7e 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgsurface_p.h +++ b/src/plugins/platforms/wayland/qwaylandxdgsurface_p.h @@ -55,6 +55,7 @@ QT_BEGIN_NAMESPACE class QWaylandWindow; class QWaylandInputDevice; class QWindow; +class QWaylandExtendedSurface; class Q_WAYLAND_CLIENT_EXPORT QWaylandXdgSurface : public QtWayland::xdg_surface , public QWaylandShellSurface @@ -74,6 +75,12 @@ public: void setTitle(const QString &title) Q_DECL_OVERRIDE; void setAppId(const QString &appId) Q_DECL_OVERRIDE; + void raise() Q_DECL_OVERRIDE; + void lower() Q_DECL_OVERRIDE; + void setContentOrientationMask(Qt::ScreenOrientations orientation) Q_DECL_OVERRIDE; + void setWindowFlags(Qt::WindowFlags flags) Q_DECL_OVERRIDE; + void sendProperty(const QString &name, const QVariant &value) Q_DECL_OVERRIDE; + bool isFullscreen() const { return m_fullscreen; } bool isMaximized() const { return m_maximized; } @@ -92,6 +99,7 @@ private: bool m_minimized; bool m_fullscreen; QSize m_size; + QWaylandExtendedSurface *m_extendedWindow; void xdg_surface_configure(int32_t width, int32_t height) Q_DECL_OVERRIDE; diff --git a/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegration_p.h b/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegration_p.h new file mode 100644 index 00000000000..45a78199cb4 --- /dev/null +++ b/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegration_p.h @@ -0,0 +1,66 @@ +/**************************************************************************** +** +** Copyright (C) 2014 Jolla Ltd +** Contact: http://www.qt-project.org/legal +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWAYLANDSHELLINTEGRATION_H +#define QWAYLANDSHELLINTEGRATION_H + +#include +#include + +QT_BEGIN_NAMESPACE + +class QWaylandWindow; +class QWaylandDisplay; +class QWaylandShellSurface; + +class Q_WAYLAND_CLIENT_EXPORT QWaylandShellIntegration +{ +public: + QWaylandShellIntegration() {} + virtual ~QWaylandShellIntegration() {} + + virtual bool initialize(QWaylandDisplay *display) = 0; + virtual QWaylandShellSurface *createShellSurface(QWaylandWindow *window) = 0; +}; + +QT_END_NAMESPACE + +#endif // QWAYLANDSHELLINTEGRATION_H diff --git a/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationfactory.cpp b/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationfactory.cpp new file mode 100644 index 00000000000..f780409e1fa --- /dev/null +++ b/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationfactory.cpp @@ -0,0 +1,96 @@ +/**************************************************************************** +** +** Copyright (C) 2014 Jolla Ltd +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qwaylandshellintegrationfactory_p.h" +#include "qwaylandshellintegrationplugin_p.h" +#include "qwaylandshellintegration_p.h" +#include +#include +#include + +QT_BEGIN_NAMESPACE + +#ifndef QT_NO_LIBRARY +Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader, + (QWaylandShellIntegrationFactoryInterface_iid, QLatin1String("/wayland-shell-integration"), Qt::CaseInsensitive)) +Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, directLoader, + (QWaylandShellIntegrationFactoryInterface_iid, QLatin1String(""), Qt::CaseInsensitive)) +#endif + +QStringList QWaylandShellIntegrationFactory::keys(const QString &pluginPath) +{ +#ifndef QT_NO_LIBRARY + QStringList list; + if (!pluginPath.isEmpty()) { + QCoreApplication::addLibraryPath(pluginPath); + list = directLoader()->keyMap().values(); + if (!list.isEmpty()) { + const QString postFix = QStringLiteral(" (from ") + + QDir::toNativeSeparators(pluginPath) + + QLatin1Char(')'); + const QStringList::iterator end = list.end(); + for (QStringList::iterator it = list.begin(); it != end; ++it) + (*it).append(postFix); + } + } + list.append(loader()->keyMap().values()); + return list; +#else + return QStringList(); +#endif +} + +QWaylandShellIntegration *QWaylandShellIntegrationFactory::create(const QString &name, const QStringList &args, const QString &pluginPath) +{ +#ifndef QT_NO_LIBRARY + // Try loading the plugin from platformPluginPath first: + if (!pluginPath.isEmpty()) { + QCoreApplication::addLibraryPath(pluginPath); + if (QWaylandShellIntegration *ret = qLoadPlugin1(directLoader(), name, args)) + return ret; + } + if (QWaylandShellIntegration *ret = qLoadPlugin1(loader(), name, args)) + return ret; +#endif + return Q_NULLPTR; +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationfactory_p.h b/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationfactory_p.h new file mode 100644 index 00000000000..415067ef8c1 --- /dev/null +++ b/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationfactory_p.h @@ -0,0 +1,61 @@ +/**************************************************************************** +** +** Copyright (C) 2014 Jolla Ltd +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWAYLANDSHELLINTEGRATIONFACTORY_H +#define QWAYLANDSHELLINTEGRATIONFACTORY_H + +#include +#include + +QT_BEGIN_NAMESPACE + +class QWaylandShellIntegration; + +class Q_WAYLAND_CLIENT_EXPORT QWaylandShellIntegrationFactory +{ +public: + static QStringList keys(const QString &pluginPath = QString()); + static QWaylandShellIntegration *create(const QString &name, const QStringList &args, const QString &pluginPath = QString()); +}; + +QT_END_NAMESPACE + +#endif // QWAYLANDSHELLINTEGRATIONFACTORY_H diff --git a/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationplugin.cpp b/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationplugin.cpp new file mode 100644 index 00000000000..05b5e91ad59 --- /dev/null +++ b/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationplugin.cpp @@ -0,0 +1,55 @@ +/**************************************************************************** +** +** Copyright (C) 2014 Jolla Ltd +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qwaylandshellintegrationplugin_p.h" + +QT_BEGIN_NAMESPACE + +QWaylandShellIntegrationPlugin::QWaylandShellIntegrationPlugin(QObject *parent) + : QObject(parent) +{ +} + +QWaylandShellIntegrationPlugin::~QWaylandShellIntegrationPlugin() +{ +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationplugin_p.h b/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationplugin_p.h new file mode 100644 index 00000000000..7d01fb4e598 --- /dev/null +++ b/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationplugin_p.h @@ -0,0 +1,69 @@ +/**************************************************************************** +** +** Copyright (C) 2014 Jolla Ltd +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWAYLANDSHELLINTEGRATIONPLUGIN_H +#define QWAYLANDSHELLINTEGRATIONPLUGIN_H + +#include + +#include +#include +#include + +QT_BEGIN_NAMESPACE + +class QWaylandShellIntegration; + +#define QWaylandShellIntegrationFactoryInterface_iid "org.qt-project.Qt.WaylandClient.QWaylandShellIntegrationFactoryInterface.5.3" + +class Q_WAYLAND_CLIENT_EXPORT QWaylandShellIntegrationPlugin : public QObject +{ + Q_OBJECT +public: + explicit QWaylandShellIntegrationPlugin(QObject *parent = 0); + ~QWaylandShellIntegrationPlugin(); + + virtual QWaylandShellIntegration *create(const QString &key, const QStringList ¶mList) = 0; +}; + +QT_END_NAMESPACE + +#endif // QWAYLANDSHELLINTEGRATIONPLUGIN_H diff --git a/src/plugins/platforms/wayland/shellintegration/shellintegration.pri b/src/plugins/platforms/wayland/shellintegration/shellintegration.pri new file mode 100644 index 00000000000..de889a47af2 --- /dev/null +++ b/src/plugins/platforms/wayland/shellintegration/shellintegration.pri @@ -0,0 +1,11 @@ +INCLUDEPATH += $$PWD + +SOURCES += \ + $$PWD/qwaylandshellintegrationplugin.cpp \ + $$PWD/qwaylandshellintegrationfactory.cpp + +HEADERS += \ + $$PWD/qwaylandshellintegration_p.h \ + $$PWD/qwaylandshellintegrationplugin_p.h \ + $$PWD/qwaylandshellintegrationfactory_p.h + From 5d30b5086de8570cc68dcb0277a263565769dada Mon Sep 17 00:00:00 2001 From: Giulio Camuffo Date: Thu, 7 Aug 2014 17:24:11 +0300 Subject: [PATCH 0142/1507] Fix namespaced build Change-Id: Id73f8ddffe00359f38c634fc88b1f81ac5638653 Reviewed-by: Oswald Buddenhagen --- src/plugins/platforms/wayland/qwaylandinputdevice_p.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h index 867258ade3b..23e1fc74099 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h +++ b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h @@ -61,6 +61,8 @@ struct xkb_keymap; struct xkb_state; #endif +struct wl_cursor_image; + QT_BEGIN_NAMESPACE class QWaylandWindow; @@ -81,7 +83,7 @@ public: struct ::wl_seat *wl_seat() { return QtWayland::wl_seat::object(); } void setCursor(Qt::CursorShape cursor, QWaylandScreen *screen); - void setCursor(struct wl_buffer *buffer, struct wl_cursor_image *image); + void setCursor(struct wl_buffer *buffer, struct ::wl_cursor_image *image); void handleWindowDestroyed(QWaylandWindow *window); void setDataDevice(QWaylandDataDevice *device); From 76ba822e04e66f0cc49cd05af3b2b2db6b0ad9f5 Mon Sep 17 00:00:00 2001 From: Giulio Camuffo Date: Wed, 13 Aug 2014 10:30:39 +0300 Subject: [PATCH 0143/1507] Make the expose region local Change-Id: I570bbe77185637ebe621e6c915eef2f4442fdd84 Reviewed-by: Laszlo Agocs --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index a6190c0d171..6ebe610abef 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -315,9 +315,9 @@ void QWaylandWindow::setCanResize(bool canResize) } if (!mConfigure.isEmpty()) { doResize(); - QWindowSystemInterface::handleExposeEvent(window(), geometry()); + QWindowSystemInterface::handleExposeEvent(window(), QRect(QPoint(), geometry().size())); } else if (mResizeDirty) { - QWindowSystemInterface::handleExposeEvent(window(), geometry()); + QWindowSystemInterface::handleExposeEvent(window(), QRect(QPoint(), geometry().size())); mResizeDirty = false; } } @@ -333,7 +333,7 @@ void QWaylandWindow::requestResize() mRequestResizeSent = false; lock.unlock(); - QWindowSystemInterface::handleExposeEvent(window(), geometry()); + QWindowSystemInterface::handleExposeEvent(window(), QRect(QPoint(), geometry().size())); QWindowSystemInterface::flushWindowSystemEvents(); } From 208fec2757059fe5a72d00a9c6ddb221baf87c5d Mon Sep 17 00:00:00 2001 From: Robin Burchell Date: Wed, 13 Aug 2014 11:29:37 +0200 Subject: [PATCH 0144/1507] Fix license test. Add missing copyright headers and fix existing (bad) ones. Change-Id: Ibbc6f3e996105305c8a2ed7d81ccee79795ee531 Reviewed-by: Andrew Knight --- .../qwaylandserverbufferintegration.cpp | 41 +++++++++++++++++++ .../platforms/wayland/qwaylandeventthread.cpp | 41 +++++++++++++++++++ .../platforms/wayland/qwaylandeventthread_p.h | 41 +++++++++++++++++++ 3 files changed, 123 insertions(+) diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegration.cpp b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegration.cpp index 6e3abe913f4..5bac689293a 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegration.cpp +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegration.cpp @@ -1,3 +1,44 @@ +/**************************************************************************** +** +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + #include "qwaylandserverbufferintegration_p.h" QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandeventthread.cpp b/src/plugins/platforms/wayland/qwaylandeventthread.cpp index d309f7bb234..c6ac42bba8f 100644 --- a/src/plugins/platforms/wayland/qwaylandeventthread.cpp +++ b/src/plugins/platforms/wayland/qwaylandeventthread.cpp @@ -1,3 +1,44 @@ +/**************************************************************************** +** +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + #include "qwaylandeventthread_p.h" #include #include diff --git a/src/plugins/platforms/wayland/qwaylandeventthread_p.h b/src/plugins/platforms/wayland/qwaylandeventthread_p.h index 4174c96cfab..0d2758c4c67 100644 --- a/src/plugins/platforms/wayland/qwaylandeventthread_p.h +++ b/src/plugins/platforms/wayland/qwaylandeventthread_p.h @@ -1,3 +1,44 @@ +/**************************************************************************** +** +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + #ifndef QWAYLANDEVENTTHREAD_H #define QWAYLANDEVENTTHREAD_H From 68e5d64a830909b722a9277e50cd61c4fc2f83e2 Mon Sep 17 00:00:00 2001 From: Giulio Camuffo Date: Wed, 13 Aug 2014 13:20:44 +0300 Subject: [PATCH 0145/1507] Reset the wl_keyboard/wl_pointer resource pointers if destroyed Change-Id: I8693f845817d2dd4b0e0b54352c374f6a0e643d3 Reviewed-by: Robin Burchell --- tests/auto/wayland/mockinput.cpp | 13 +++++++++++++ tests/auto/wayland/mockinput.h | 6 ++++++ 2 files changed, 19 insertions(+) diff --git a/tests/auto/wayland/mockinput.cpp b/tests/auto/wayland/mockinput.cpp index 40b01317f9a..7dbb735ed22 100644 --- a/tests/auto/wayland/mockinput.cpp +++ b/tests/auto/wayland/mockinput.cpp @@ -164,6 +164,13 @@ void Keyboard::sendKey(uint32_t key, uint32_t state) } } + +void Keyboard::keyboard_destroy_resource(wl_keyboard::Resource *resource) +{ + if (m_focusResource == resource) + m_focusResource = 0; +} + Pointer::Pointer(Compositor *compositor) : wl_pointer() , m_compositor(compositor) @@ -210,4 +217,10 @@ void Pointer::sendButton(uint32_t button, uint32_t state) } } +void Pointer::pointer_destroy_resource(wl_pointer::Resource *resource) +{ + if (m_focusResource == resource) + m_focusResource = 0; +} + } diff --git a/tests/auto/wayland/mockinput.h b/tests/auto/wayland/mockinput.h index 669bfaed608..128758cad93 100644 --- a/tests/auto/wayland/mockinput.h +++ b/tests/auto/wayland/mockinput.h @@ -88,6 +88,9 @@ public: void sendKey(uint32_t key, uint32_t state); +protected: + void keyboard_destroy_resource(wl_keyboard::Resource *resource) Q_DECL_OVERRIDE; + private: Compositor *m_compositor; @@ -107,6 +110,9 @@ public: void sendMotion(const QPoint &pos); void sendButton(uint32_t button, uint32_t state); +protected: + void pointer_destroy_resource(wl_pointer::Resource *resource) Q_DECL_OVERRIDE; + private: Compositor *m_compositor; From e1514abaeae8cf2b71f04f2bbc7f57292c78a1df Mon Sep 17 00:00:00 2001 From: Jan Arne Petersen Date: Sun, 10 Aug 2014 06:54:55 +0200 Subject: [PATCH 0146/1507] Add support for setMask to set input region Also fix input region handling in compositor. Change-Id: If88ad6a03443526eddee045d7af54daf5057373a Done-with: Pier Luigi Fiorini Reviewed-by: Giulio Camuffo --- .../platforms/wayland/qwaylanddisplay.cpp | 10 ++++++++++ .../platforms/wayland/qwaylanddisplay_p.h | 1 + .../platforms/wayland/qwaylandwindow.cpp | 20 +++++++++++++++++++ .../platforms/wayland/qwaylandwindow_p.h | 3 +++ 4 files changed, 34 insertions(+) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index 5764d3110fd..4475356b0af 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -96,6 +96,16 @@ QWaylandShellSurface *QWaylandDisplay::createShellSurface(QWaylandWindow *window return Q_NULLPTR; } +struct ::wl_region *QWaylandDisplay::createRegion(const QRegion &qregion) +{ + struct ::wl_region *region = mCompositor.create_region(); + + Q_FOREACH (const QRect &rect, qregion.rects()) + wl_region_add(region, rect.x(), rect.y(), rect.width(), rect.height()); + + return region; +} + QWaylandClientBufferIntegration * QWaylandDisplay::clientBufferIntegration() const { return mWaylandIntegration->clientBufferIntegration(); diff --git a/src/plugins/platforms/wayland/qwaylanddisplay_p.h b/src/plugins/platforms/wayland/qwaylanddisplay_p.h index 6ed30d195a4..ade8475e7d9 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay_p.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay_p.h @@ -103,6 +103,7 @@ public: struct wl_surface *createSurface(void *handle); QWaylandShellSurface *createShellSurface(QWaylandWindow *window); + struct ::wl_region *createRegion(const QRegion &qregion); QWaylandClientBufferIntegration *clientBufferIntegration() const; diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index a6190c0d171..a3e9b53cf28 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -88,6 +88,7 @@ QWaylandWindow::QWaylandWindow(QWindow *window) , mMouseDevice(0) , mMouseSerial(0) , mState(Qt::WindowNoState) + , mMask() { init(mDisplay->createSurface(static_cast(this))); @@ -124,6 +125,7 @@ QWaylandWindow::QWaylandWindow(QWindow *window) setOrientationMask(window->screen()->orientationUpdateMask()); setWindowFlags(window->flags()); setGeometry_helper(window->geometry()); + setMask(window->mask()); setWindowStateInternal(window->windowState()); handleContentOrientationChange(window->contentOrientation()); } @@ -262,6 +264,24 @@ void QWaylandWindow::lower() mShellSurface->lower(); } +void QWaylandWindow::setMask(const QRegion &mask) +{ + if (mMask == mask) + return; + + mMask = mask; + + if (mMask.isEmpty()) { + set_input_region(0); + } else { + struct ::wl_region *region = mDisplay->createRegion(mMask); + set_input_region(region); + wl_region_destroy(region); + } + + commit(); +} + void QWaylandWindow::configure(uint32_t edges, int32_t width, int32_t height) { QMutexLocker resizeLocker(&mResizeLock); diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index 9c0be84c6a5..85e9f429ee1 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -139,6 +139,8 @@ public: void raise() Q_DECL_OVERRIDE; void lower() Q_DECL_OVERRIDE; + void setMask(const QRegion ®ion) Q_DECL_OVERRIDE; + void requestActivateWindow() Q_DECL_OVERRIDE; bool isExposed() const Q_DECL_OVERRIDE; @@ -215,6 +217,7 @@ protected: int mMouseSerial; Qt::WindowState mState; + QRegion mMask; private: bool setWindowStateInternal(Qt::WindowState flags); From 5ef1d81af0401c2c1db396749d11b3ad8e7752a7 Mon Sep 17 00:00:00 2001 From: Giulio Camuffo Date: Thu, 14 Aug 2014 16:50:57 +0300 Subject: [PATCH 0147/1507] Flush the wayland events on the dispatcher's awake signal This is not normally needed, but it is when an app, like our client test, needs to have the requests flushed out by a QCoreApplication::processEvents call. Change-Id: Id821eaf5b612dc44281141181a09718f409e7eb6 Reviewed-by: Robin Burchell --- src/plugins/platforms/wayland/qwaylandintegration.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/plugins/platforms/wayland/qwaylandintegration.cpp b/src/plugins/platforms/wayland/qwaylandintegration.cpp index 85300a13062..88eeed842ad 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandintegration.cpp @@ -194,6 +194,7 @@ void QWaylandIntegration::initialize() { QAbstractEventDispatcher *dispatcher = QGuiApplicationPrivate::eventDispatcher; QObject::connect(dispatcher, SIGNAL(aboutToBlock()), mDisplay, SLOT(flushRequests())); + QObject::connect(dispatcher, SIGNAL(awake()), mDisplay, SLOT(flushRequests())); } QPlatformFontDatabase *QWaylandIntegration::fontDatabase() const From 6c9cd444fcf0d1e7598cd4a670836184b1c074bb Mon Sep 17 00:00:00 2001 From: Giulio Camuffo Date: Thu, 14 Aug 2014 16:57:47 +0300 Subject: [PATCH 0148/1507] Fix client tests Change-Id: I6511dfb826c522db3d8bd01c5670c06f187abff2 Reviewed-by: Robin Burchell --- tests/auto/wayland/mockcompositor.cpp | 10 ++++++++++ tests/auto/wayland/mockcompositor.h | 2 ++ tests/auto/wayland/tst_client.cpp | 7 +++++++ 3 files changed, 19 insertions(+) diff --git a/tests/auto/wayland/mockcompositor.cpp b/tests/auto/wayland/mockcompositor.cpp index e51f3ed577a..cfaa3478800 100644 --- a/tests/auto/wayland/mockcompositor.cpp +++ b/tests/auto/wayland/mockcompositor.cpp @@ -189,6 +189,11 @@ void *MockCompositor::run(void *data) return 0; } +void MockCompositor::discardSurfaces() +{ + m_compositor->discardSurfaces(); +} + namespace Impl { Compositor::Compositor() @@ -293,5 +298,10 @@ void Compositor::removeSurface(Surface *surface) m_pointer->setFocus(0, QPoint()); } +void Compositor::discardSurfaces() +{ + m_surfaces.clear(); +} + } diff --git a/tests/auto/wayland/mockcompositor.h b/tests/auto/wayland/mockcompositor.h index 7f3e2268312..68e55d3562c 100644 --- a/tests/auto/wayland/mockcompositor.h +++ b/tests/auto/wayland/mockcompositor.h @@ -81,6 +81,7 @@ public: void addSurface(Surface *surface); void removeSurface(Surface *surface); + void discardSurfaces(); static void setKeyboardFocus(void *data, const QList ¶meters); static void sendMousePress(void *data, const QList ¶meters); @@ -154,6 +155,7 @@ public: void sendKeyRelease(const QSharedPointer &surface, uint code); QSharedPointer surface(); + void discardSurfaces(); void lock(); void unlock(); diff --git a/tests/auto/wayland/tst_client.cpp b/tests/auto/wayland/tst_client.cpp index b43f531161e..9c3138bcb09 100644 --- a/tests/auto/wayland/tst_client.cpp +++ b/tests/auto/wayland/tst_client.cpp @@ -119,6 +119,9 @@ public: { QSocketNotifier *notifier = new QSocketNotifier(compositor->waylandFileDescriptor(), QSocketNotifier::Read, this); connect(notifier, SIGNAL(activated(int)), this, SLOT(processWaylandEvents())); + // connect to the event dispatcher to make sure to flush out the outgoing message queue + connect(QCoreApplication::eventDispatcher(), &QAbstractEventDispatcher::awake, this, &tst_WaylandClient::processWaylandEvents); + connect(QCoreApplication::eventDispatcher(), &QAbstractEventDispatcher::aboutToBlock, this, &tst_WaylandClient::processWaylandEvents); } public slots: @@ -146,7 +149,11 @@ private: void tst_WaylandClient::screen() { + QCoreApplication::processEvents(QEventLoop::AllEvents); + QTRY_COMPARE(QGuiApplication::primaryScreen()->size(), screenSize); + // discard the cursor surface created by the QWaylandInputDevice + compositor->discardSurfaces(); } void tst_WaylandClient::createDestroyWindow() From d9ba141df923049b3cf7e5cc91b2bf4898ddf16b Mon Sep 17 00:00:00 2001 From: Giulio Camuffo Date: Fri, 15 Aug 2014 19:38:13 +0300 Subject: [PATCH 0149/1507] Fix possible crash of the test client The cursor surface is not in the surfaces list when destroyed Change-Id: Ie29224679776d0abec7862d2976be892c63521a7 Reviewed-by: Robin Burchell --- tests/auto/wayland/mockcompositor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/wayland/mockcompositor.cpp b/tests/auto/wayland/mockcompositor.cpp index cfaa3478800..bb4f10fd942 100644 --- a/tests/auto/wayland/mockcompositor.cpp +++ b/tests/auto/wayland/mockcompositor.cpp @@ -291,7 +291,7 @@ void Compositor::addSurface(Surface *surface) void Compositor::removeSurface(Surface *surface) { - m_surfaces.remove(m_surfaces.indexOf(surface)); + m_surfaces.removeOne(surface); if (m_keyboard->focus() == surface) m_keyboard->setFocus(0); if (m_pointer->focus() == surface) From 223fc10cdee20ecb97337f0a3e6e3b9cc10fff75 Mon Sep 17 00:00:00 2001 From: Robin Burchell Date: Sun, 17 Aug 2014 13:58:02 +0200 Subject: [PATCH 0150/1507] QWaylandWindow: Add a missing shell surface null check. Caught by tst_QWidget::mapFromAndTo. Change-Id: I36e08ebfa3bae1ac8667ee828b1762867d71c66d Reviewed-by: Giulio Camuffo --- .../platforms/wayland/qwaylandwindow.cpp | 27 ++++++++++--------- 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 6ebe610abef..1e40998a60f 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -657,18 +657,21 @@ bool QWaylandWindow::setWindowStateInternal(Qt::WindowState state) // here. We use then this mState variable. mState = state; createDecoration(); - switch (state) { - case Qt::WindowFullScreen: - mShellSurface->setFullscreen(); - break; - case Qt::WindowMaximized: - mShellSurface->setMaximized(); - break; - case Qt::WindowMinimized: - mShellSurface->setMinimized(); - break; - default: - mShellSurface->setNormal(); + + if (mShellSurface) { + switch (state) { + case Qt::WindowFullScreen: + mShellSurface->setFullscreen(); + break; + case Qt::WindowMaximized: + mShellSurface->setMaximized(); + break; + case Qt::WindowMinimized: + mShellSurface->setMinimized(); + break; + default: + mShellSurface->setNormal(); + } } QWindowSystemInterface::handleWindowStateChanged(window(), mState); From e03a21353c965e79ff9295454bffffc4351b96d9 Mon Sep 17 00:00:00 2001 From: Robin Burchell Date: Sun, 17 Aug 2014 15:39:27 +0200 Subject: [PATCH 0151/1507] Remove qPlatformScreenForWindow from header. Use of this was removed in 02e50ef592f28ec05654acf3f6c9b84d31736269. Change-Id: I729282bfa9536380fc0d5b2702448cc54a90e37d Reviewed-by: Giulio Camuffo --- src/plugins/platforms/wayland/qwaylandnativeinterface_p.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandnativeinterface_p.h b/src/plugins/platforms/wayland/qwaylandnativeinterface_p.h index 536cbe8dd53..6c0be2d3c8d 100644 --- a/src/plugins/platforms/wayland/qwaylandnativeinterface_p.h +++ b/src/plugins/platforms/wayland/qwaylandnativeinterface_p.h @@ -68,8 +68,6 @@ public: void setWindowProperty(QPlatformWindow *window, const QString &name, const QVariant &value); void emitWindowPropertyChanged(QPlatformWindow *window, const QString &name); -private: - static QWaylandScreen *qPlatformScreenForWindow(QWindow *window); private: QWaylandIntegration *m_integration; From 131ccbd4cd44a401603a537421f4f803217e7a3d Mon Sep 17 00:00:00 2001 From: Robin Burchell Date: Sun, 17 Aug 2014 16:07:21 +0200 Subject: [PATCH 0152/1507] QWaylandDisplay: Remove unused static. Change-Id: I868168dee716103962217b5ceb38185090f82e09 Reviewed-by: Giulio Camuffo --- src/plugins/platforms/wayland/qwaylanddisplay.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index 5764d3110fd..88e4e4a5ba4 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -116,8 +116,6 @@ void QWaylandDisplay::setLastKeyboardFocusInputDevice(QWaylandInputDevice *devic mLastKeyboardFocusInputDevice = device; } -static QWaylandDisplay *display = 0; - QWaylandDisplay::QWaylandDisplay(QWaylandIntegration *waylandIntegration) : mWaylandIntegration(waylandIntegration) , mLastKeyboardFocusInputDevice(0) @@ -130,7 +128,6 @@ QWaylandDisplay::QWaylandDisplay(QWaylandIntegration *waylandIntegration) , mTextInputManager(0) , mHardwareIntegration(0) { - display = this; qRegisterMetaType("uint32_t"); mEventThreadObject = new QWaylandEventThread(0); From 132cbe541433d6b4d0bb00c64095519d0779d13a Mon Sep 17 00:00:00 2001 From: Robin Burchell Date: Sun, 17 Aug 2014 16:07:47 +0200 Subject: [PATCH 0153/1507] QWaylandDisplay: Destroy screens when destroying the display. Fixes a crash in tst_QApplication. Change-Id: Ibfc7aded10609cff9c7a20b7193f44d1c73bc893 Reviewed-by: Gunnar Sletta --- src/plugins/platforms/wayland/qwaylanddisplay.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index 88e4e4a5ba4..242a13a155a 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -156,6 +156,8 @@ QWaylandDisplay::QWaylandDisplay(QWaylandIntegration *waylandIntegration) QWaylandDisplay::~QWaylandDisplay(void) { + qDeleteAll(mScreens); + mScreens.clear(); delete mDndSelectionHandler.take(); mEventThread->quit(); mEventThread->wait(); From 34d69d9b4de50857ce645e8f414743c339ff61b6 Mon Sep 17 00:00:00 2001 From: Robin Burchell Date: Sun, 17 Aug 2014 16:08:45 +0200 Subject: [PATCH 0154/1507] QWaylandScreen: Also call QPlatformScreen constructor. Change-Id: Iae63ea5b15f2422ea28f2f9c8d7abeb30d23c86f Reviewed-by: Giulio Camuffo --- src/plugins/platforms/wayland/qwaylandscreen.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandscreen.cpp b/src/plugins/platforms/wayland/qwaylandscreen.cpp index 3432f247595..fde5751dc0f 100644 --- a/src/plugins/platforms/wayland/qwaylandscreen.cpp +++ b/src/plugins/platforms/wayland/qwaylandscreen.cpp @@ -54,7 +54,8 @@ QT_BEGIN_NAMESPACE QWaylandScreen::QWaylandScreen(QWaylandDisplay *waylandDisplay, uint32_t id) - : QtWayland::wl_output(waylandDisplay->wl_registry(), id) + : QPlatformScreen() + , QtWayland::wl_output(waylandDisplay->wl_registry(), id) , mWaylandDisplay(waylandDisplay) , mExtendedOutput(0) , mDepth(32) From 2efc3bcf4da08acd36df45ec4afce0d17187956e Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Sat, 16 Aug 2014 12:48:38 -0700 Subject: [PATCH 0155/1507] Fix warning about use of uninitialized variable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit qwaylandwindow.cpp:443:25: warning: ‘transform’ may be used uninitialized in this function [-Wmaybe-uninitialized] Change-Id: Ic0a96cfda35d331c9957a527eea7f8b987191b5f Reviewed-by: Robin Burchell --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 1e40998a60f..b7f3c4c7ef7 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -438,6 +438,8 @@ void QWaylandWindow::handleContentOrientationChange(Qt::ScreenOrientation orient case Qt::InvertedPortraitOrientation: transform = isPortrait ? WL_OUTPUT_TRANSFORM_180 : WL_OUTPUT_TRANSFORM_270; break; + default: + Q_UNREACHABLE(); } set_buffer_transform(transform); // set_buffer_transform is double buffered, we need to commit. From 76f5ad1784718abee46b5659baa45ef5331b4236 Mon Sep 17 00:00:00 2001 From: Giulio Camuffo Date: Tue, 19 Aug 2014 16:19:12 +0300 Subject: [PATCH 0156/1507] Make the test client more robust and make valgrind happy Change-Id: I39ce667123391b946711cc2d16d12799e8b7dd2d Reviewed-by: Robin Burchell --- tests/auto/wayland/mockcompositor.cpp | 19 +++---- tests/auto/wayland/mockcompositor.h | 2 - tests/auto/wayland/mockinput.cpp | 4 ++ tests/auto/wayland/mockshell.cpp | 3 ++ tests/auto/wayland/mocksurface.cpp | 75 ++++++++++++++++----------- tests/auto/wayland/mocksurface.h | 7 ++- tests/auto/wayland/tst_client.cpp | 4 -- 7 files changed, 63 insertions(+), 51 deletions(-) diff --git a/tests/auto/wayland/mockcompositor.cpp b/tests/auto/wayland/mockcompositor.cpp index bb4f10fd942..70fa5f23265 100644 --- a/tests/auto/wayland/mockcompositor.cpp +++ b/tests/auto/wayland/mockcompositor.cpp @@ -135,8 +135,13 @@ QSharedPointer MockCompositor::surface() QSharedPointer result; lock(); QVector surfaces = m_compositor->surfaces(); - if (!surfaces.isEmpty()) - result = surfaces.first()->mockSurface(); + foreach (Impl::Surface *surface, surfaces) { + // we don't want to mistake the cursor surface for a window surface + if (surface->isMapped()) { + result = surface->mockSurface(); + break; + } + } unlock(); return result; } @@ -189,11 +194,6 @@ void *MockCompositor::run(void *data) return 0; } -void MockCompositor::discardSurfaces() -{ - m_compositor->discardSurfaces(); -} - namespace Impl { Compositor::Compositor() @@ -298,10 +298,5 @@ void Compositor::removeSurface(Surface *surface) m_pointer->setFocus(0, QPoint()); } -void Compositor::discardSurfaces() -{ - m_surfaces.clear(); -} - } diff --git a/tests/auto/wayland/mockcompositor.h b/tests/auto/wayland/mockcompositor.h index 68e55d3562c..7f3e2268312 100644 --- a/tests/auto/wayland/mockcompositor.h +++ b/tests/auto/wayland/mockcompositor.h @@ -81,7 +81,6 @@ public: void addSurface(Surface *surface); void removeSurface(Surface *surface); - void discardSurfaces(); static void setKeyboardFocus(void *data, const QList ¶meters); static void sendMousePress(void *data, const QList ¶meters); @@ -155,7 +154,6 @@ public: void sendKeyRelease(const QSharedPointer &surface, uint code); QSharedPointer surface(); - void discardSurfaces(); void lock(); void unlock(); diff --git a/tests/auto/wayland/mockinput.cpp b/tests/auto/wayland/mockinput.cpp index 7dbb735ed22..bd85ad6c897 100644 --- a/tests/auto/wayland/mockinput.cpp +++ b/tests/auto/wayland/mockinput.cpp @@ -130,6 +130,8 @@ void Seat::seat_get_pointer(Resource *resource, uint32_t id) Keyboard::Keyboard(Compositor *compositor) : wl_keyboard() , m_compositor(compositor) + , m_focusResource(Q_NULLPTR) + , m_focus(Q_NULLPTR) { } @@ -174,6 +176,8 @@ void Keyboard::keyboard_destroy_resource(wl_keyboard::Resource *resource) Pointer::Pointer(Compositor *compositor) : wl_pointer() , m_compositor(compositor) + , m_focusResource(Q_NULLPTR) + , m_focus(Q_NULLPTR) { } diff --git a/tests/auto/wayland/mockshell.cpp b/tests/auto/wayland/mockshell.cpp index 0d841f64c24..2a5969f70de 100644 --- a/tests/auto/wayland/mockshell.cpp +++ b/tests/auto/wayland/mockshell.cpp @@ -40,6 +40,7 @@ ****************************************************************************/ #include "mockcompositor.h" +#include "mocksurface.h" namespace Impl { @@ -173,6 +174,8 @@ static void get_shell_surface(wl_client *client, wl_resource *compositorResource Q_UNUSED(compositorResource); wl_client_add_object(client, &wl_shell_surface_interface, &shellSurfaceInterface, id, surfaceResource->data); + Surface *surf = Surface::fromResource(surfaceResource); + surf->map(); } void Compositor::bindShell(wl_client *client, void *compositorData, uint32_t version, uint32_t id) diff --git a/tests/auto/wayland/mocksurface.cpp b/tests/auto/wayland/mocksurface.cpp index d5e0367a080..2e4c2bc73a4 100644 --- a/tests/auto/wayland/mocksurface.cpp +++ b/tests/auto/wayland/mocksurface.cpp @@ -46,10 +46,11 @@ namespace Impl { Surface::Surface(wl_client *client, uint32_t id, Compositor *compositor) : QtWaylandServer::wl_surface(client, id) + , m_buffer(Q_NULLPTR) , m_compositor(compositor) , m_mockSurface(new MockSurface(this)) + , m_mapped(false) { - wl_list_init(&m_frameCallbackList); } Surface::~Surface() @@ -57,6 +58,21 @@ Surface::~Surface() m_mockSurface->m_surface = 0; } +void Surface::map() +{ + m_mapped = true; +} + +bool Surface::isMapped() const +{ + return m_mapped; +} + +Surface *Surface::fromResource(struct ::wl_resource *resource) +{ + return static_cast(Resource::fromResource(resource)->surface_object); +} + void Surface::surface_destroy_resource(Resource *) { compositor()->removeSurface(this); @@ -88,47 +104,44 @@ void Surface::surface_damage(Resource *resource, Q_UNUSED(y); Q_UNUSED(width); Q_UNUSED(height); - - if (!m_buffer) - return; - -#if WAYLAND_VERSION_CHECK(1, 2, 0) - struct ::wl_shm_buffer *shm_buffer = wl_shm_buffer_get(m_buffer); -#else - struct ::wl_buffer *shm_buffer = 0; - if (wl_buffer_is_shm(static_cast(m_buffer->data))) - shm_buffer = static_cast(m_buffer->data); -#endif - - if (shm_buffer) { - int stride = wl_shm_buffer_get_stride(shm_buffer); - uint format = wl_shm_buffer_get_format(shm_buffer); - Q_UNUSED(format); - void *data = wl_shm_buffer_get_data(shm_buffer); - const uchar *char_data = static_cast(data); - QImage img(char_data, wl_shm_buffer_get_width(shm_buffer), wl_shm_buffer_get_height(shm_buffer), stride, QImage::Format_ARGB32_Premultiplied); - m_mockSurface->image = img; - } - - wl_resource *frameCallback; - wl_list_for_each(frameCallback, &m_frameCallbackList, link) { - wl_callback_send_done(frameCallback, m_compositor->time()); - wl_resource_destroy(frameCallback); - } - - wl_list_init(&m_frameCallbackList); } void Surface::surface_frame(Resource *resource, uint32_t callback) { wl_resource *frameCallback = wl_client_add_object(resource->client(), &wl_callback_interface, 0, callback, this); - wl_list_insert(&m_frameCallbackList, &frameCallback->link); + m_frameCallbackList << frameCallback; } void Surface::surface_commit(Resource *resource) { Q_UNUSED(resource); + + if (m_buffer) { +#if WAYLAND_VERSION_CHECK(1, 2, 0) + struct ::wl_shm_buffer *shm_buffer = wl_shm_buffer_get(m_buffer); +#else + struct ::wl_buffer *shm_buffer = 0; + if (wl_buffer_is_shm(static_cast(m_buffer->data))) + shm_buffer = static_cast(m_buffer->data); +#endif + + if (shm_buffer) { + int stride = wl_shm_buffer_get_stride(shm_buffer); + uint format = wl_shm_buffer_get_format(shm_buffer); + Q_UNUSED(format); + void *data = wl_shm_buffer_get_data(shm_buffer); + const uchar *char_data = static_cast(data); + QImage img(char_data, wl_shm_buffer_get_width(shm_buffer), wl_shm_buffer_get_height(shm_buffer), stride, QImage::Format_ARGB32_Premultiplied); + m_mockSurface->image = img; + } + } + + foreach (wl_resource *frameCallback, m_frameCallbackList) { + wl_callback_send_done(frameCallback, m_compositor->time()); + wl_resource_destroy(frameCallback); + } + m_frameCallbackList.clear(); } } diff --git a/tests/auto/wayland/mocksurface.h b/tests/auto/wayland/mocksurface.h index 49260f51b38..f2a2f4eb355 100644 --- a/tests/auto/wayland/mocksurface.h +++ b/tests/auto/wayland/mocksurface.h @@ -54,6 +54,9 @@ public: ~Surface(); Compositor *compositor() const { return m_compositor; } + static Surface *fromResource(struct ::wl_resource *resource); + void map(); + bool isMapped() const; QSharedPointer mockSurface() const { return m_mockSurface; } @@ -74,8 +77,8 @@ private: Compositor *m_compositor; QSharedPointer m_mockSurface; - - wl_list m_frameCallbackList; + QList m_frameCallbackList; + bool m_mapped; }; } diff --git a/tests/auto/wayland/tst_client.cpp b/tests/auto/wayland/tst_client.cpp index 9c3138bcb09..e13d738dc34 100644 --- a/tests/auto/wayland/tst_client.cpp +++ b/tests/auto/wayland/tst_client.cpp @@ -149,11 +149,7 @@ private: void tst_WaylandClient::screen() { - QCoreApplication::processEvents(QEventLoop::AllEvents); - QTRY_COMPARE(QGuiApplication::primaryScreen()->size(), screenSize); - // discard the cursor surface created by the QWaylandInputDevice - compositor->discardSurfaces(); } void tst_WaylandClient::createDestroyWindow() From c6766fe4f4c6b7145131ea6210fbb601571e961d Mon Sep 17 00:00:00 2001 From: Robin Burchell Date: Tue, 19 Aug 2014 18:24:56 +0200 Subject: [PATCH 0157/1507] QWaylandDisplay: Correctly intercept all errors when dispatching. A connection reset isn't the only form of error we may run into, so make sure we check for other exceptional circumstances through wl_display_get_error. This fixes my case of e.g. wl_drm throwing an error but QtWayland never quitting the client. Change-Id: I8c76dd7913640e58d03bd2fe52eb054a4daa0235 Reviewed-by: Giulio Camuffo --- .../platforms/wayland/qwaylanddisplay.cpp | 21 +++++++++++++++---- .../platforms/wayland/qwaylandeventthread.cpp | 10 +++++++-- 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index 242a13a155a..74efbfda4c2 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -166,18 +166,31 @@ QWaylandDisplay::~QWaylandDisplay(void) void QWaylandDisplay::flushRequests() { - if (wl_display_dispatch_queue_pending(mDisplay, mEventQueue) == -1 && (errno == EPIPE || errno == ECONNRESET)) { - qWarning("The Wayland connection broke. Did the Wayland compositor die?"); + if (wl_display_dispatch_queue_pending(mDisplay, mEventQueue) < 0) { + int ecode = wl_display_get_error(mDisplay); + if ((ecode == EPIPE || ecode == ECONNRESET)) { + // special case this to provide a nicer error + qWarning("The Wayland connection broke. Did the Wayland compositor die?"); + } else { + qErrnoWarning(ecode, "The Wayland connection experienced a fatal error"); + } ::exit(1); } + wl_display_flush(mDisplay); } void QWaylandDisplay::blockingReadEvents() { - if (wl_display_dispatch_queue(mDisplay, mEventQueue) == -1 && (errno == EPIPE || errno == ECONNRESET)) { - qWarning("The Wayland connection broke. Did the Wayland compositor die?"); + if (wl_display_dispatch_queue(mDisplay, mEventQueue) < 0) { + int ecode = wl_display_get_error(mDisplay); + if ((ecode == EPIPE || ecode == ECONNRESET)) { + // special case this to provide a nicer error + qWarning("The Wayland connection broke. Did the Wayland compositor die?"); + } else { + qErrnoWarning(ecode, "The Wayland connection experienced a fatal error"); + } ::exit(1); } } diff --git a/src/plugins/platforms/wayland/qwaylandeventthread.cpp b/src/plugins/platforms/wayland/qwaylandeventthread.cpp index c6ac42bba8f..979aa6e0ebf 100644 --- a/src/plugins/platforms/wayland/qwaylandeventthread.cpp +++ b/src/plugins/platforms/wayland/qwaylandeventthread.cpp @@ -73,8 +73,14 @@ void QWaylandEventThread::displayConnect() void QWaylandEventThread::readWaylandEvents() { - if (wl_display_dispatch(m_display) == -1 && (errno == EPIPE || errno == ECONNRESET)) { - qWarning("The Wayland connection broke. Did the Wayland compositor die?"); + if (wl_display_dispatch(m_display) < 0) { + int ecode = wl_display_get_error(m_display); + if ((ecode == EPIPE || ecode == ECONNRESET)) { + // special case this to provide a nicer error + qWarning("The Wayland connection broke. Did the Wayland compositor die?"); + } else { + qErrnoWarning(ecode, "The Wayland connection experienced a fatal error"); + } ::exit(1); } emit newEventsRead(); From bb360fce60e6632661d210edef6ade136e6064b9 Mon Sep 17 00:00:00 2001 From: Robin Burchell Date: Tue, 19 Aug 2014 18:40:19 +0200 Subject: [PATCH 0158/1507] QWaylandDisplay: Centralize error handling in one place. Change-Id: Ifba23e349a4006cea501480a7230408f0fafd1b7 Reviewed-by: Giulio Camuffo --- .../platforms/wayland/qwaylanddisplay.cpp | 24 +++-------------- .../platforms/wayland/qwaylandeventthread.cpp | 27 ++++++++++++------- .../platforms/wayland/qwaylandeventthread_p.h | 2 ++ 3 files changed, 23 insertions(+), 30 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index 74efbfda4c2..94bfa88bc1b 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -166,16 +166,8 @@ QWaylandDisplay::~QWaylandDisplay(void) void QWaylandDisplay::flushRequests() { - if (wl_display_dispatch_queue_pending(mDisplay, mEventQueue) < 0) { - int ecode = wl_display_get_error(mDisplay); - if ((ecode == EPIPE || ecode == ECONNRESET)) { - // special case this to provide a nicer error - qWarning("The Wayland connection broke. Did the Wayland compositor die?"); - } else { - qErrnoWarning(ecode, "The Wayland connection experienced a fatal error"); - } - ::exit(1); - } + if (wl_display_dispatch_queue_pending(mDisplay, mEventQueue) < 0) + mEventThreadObject->checkErrorAndExit(); wl_display_flush(mDisplay); } @@ -183,16 +175,8 @@ void QWaylandDisplay::flushRequests() void QWaylandDisplay::blockingReadEvents() { - if (wl_display_dispatch_queue(mDisplay, mEventQueue) < 0) { - int ecode = wl_display_get_error(mDisplay); - if ((ecode == EPIPE || ecode == ECONNRESET)) { - // special case this to provide a nicer error - qWarning("The Wayland connection broke. Did the Wayland compositor die?"); - } else { - qErrnoWarning(ecode, "The Wayland connection experienced a fatal error"); - } - ::exit(1); - } + if (wl_display_dispatch_queue(mDisplay, mEventQueue) < 0) + mEventThreadObject->checkErrorAndExit(); } QWaylandScreen *QWaylandDisplay::screenForOutput(struct wl_output *output) const diff --git a/src/plugins/platforms/wayland/qwaylandeventthread.cpp b/src/plugins/platforms/wayland/qwaylandeventthread.cpp index 979aa6e0ebf..b7266765e61 100644 --- a/src/plugins/platforms/wayland/qwaylandeventthread.cpp +++ b/src/plugins/platforms/wayland/qwaylandeventthread.cpp @@ -71,18 +71,25 @@ void QWaylandEventThread::displayConnect() QMetaObject::invokeMethod(this, "waylandDisplayConnect", Qt::QueuedConnection); } +// ### be careful what you do, this function may also be called from other +// threads to clean up & exit. +void QWaylandEventThread::checkErrorAndExit() +{ + int ecode = wl_display_get_error(m_display); + if ((ecode == EPIPE || ecode == ECONNRESET)) { + // special case this to provide a nicer error + qWarning("The Wayland connection broke. Did the Wayland compositor die?"); + } else { + qErrnoWarning(ecode, "The Wayland connection experienced a fatal error"); + } + ::exit(1); +} + void QWaylandEventThread::readWaylandEvents() { - if (wl_display_dispatch(m_display) < 0) { - int ecode = wl_display_get_error(m_display); - if ((ecode == EPIPE || ecode == ECONNRESET)) { - // special case this to provide a nicer error - qWarning("The Wayland connection broke. Did the Wayland compositor die?"); - } else { - qErrnoWarning(ecode, "The Wayland connection experienced a fatal error"); - } - ::exit(1); - } + if (wl_display_dispatch(m_display) < 0) + checkErrorAndExit(); + emit newEventsRead(); } diff --git a/src/plugins/platforms/wayland/qwaylandeventthread_p.h b/src/plugins/platforms/wayland/qwaylandeventthread_p.h index 0d2758c4c67..d51d627b962 100644 --- a/src/plugins/platforms/wayland/qwaylandeventthread_p.h +++ b/src/plugins/platforms/wayland/qwaylandeventthread_p.h @@ -63,6 +63,8 @@ public: wl_display *display() const; + void checkErrorAndExit(); + private slots: void readWaylandEvents(); From 8975683c37fb721371f72cd0c1542059f9e0e1de Mon Sep 17 00:00:00 2001 From: Robin Burchell Date: Wed, 20 Aug 2014 15:51:04 +0200 Subject: [PATCH 0159/1507] QWaylandDecoration: Remove some unused members Change-Id: Ia98190adbd3f710de6734c10062792ce3f4547d9 Reviewed-by: Giulio Camuffo --- .../platforms/wayland/qwaylanddecoration.cpp | 12 +----------- .../platforms/wayland/qwaylanddecoration_p.h | 16 ---------------- 2 files changed, 1 insertion(+), 27 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylanddecoration.cpp b/src/plugins/platforms/wayland/qwaylanddecoration.cpp index 8e7d03143a1..b288debe9eb 100644 --- a/src/plugins/platforms/wayland/qwaylanddecoration.cpp +++ b/src/plugins/platforms/wayland/qwaylanddecoration.cpp @@ -186,7 +186,7 @@ void QWaylandDecoration::paint(QPaintDevice *device) // Title bar QPoint gradCenter(top.center()+ QPoint(30, 60)); QLinearGradient grad(top.topLeft(), top.bottomLeft()); - QColor base(backgroundColor()); + QColor base(m_backgroundColor); grad.setColorAt(0, base.lighter(100)); grad.setColorAt(1, base.darker(180)); QPainterPath roundedRect; @@ -446,14 +446,4 @@ QRectF QWaylandDecoration::minimizeButtonRect() const (m_margins.top() - BUTTON_WIDTH) / 2, BUTTON_WIDTH, BUTTON_WIDTH); } -void QWaylandDecoration::setForegroundColor(const QColor &c) -{ - m_foregroundColor = c; -} - -void QWaylandDecoration::setBackgroundColor(const QColor &c) -{ - m_backgroundColor = c; -} - QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylanddecoration_p.h b/src/plugins/platforms/wayland/qwaylanddecoration_p.h index 3f53721f75d..14bf4a92d68 100644 --- a/src/plugins/platforms/wayland/qwaylanddecoration_p.h +++ b/src/plugins/platforms/wayland/qwaylanddecoration_p.h @@ -84,12 +84,6 @@ public: QWaylandWindow *waylandWindow() const; const QImage &contentImage(); - void setForegroundColor(const QColor &c); - inline QColor foregroundColor() const; - - void setBackgroundColor(const QColor &c); - inline QColor backgroundColor() const; - protected: void paint(QPaintDevice *device); @@ -140,16 +134,6 @@ inline QWaylandWindow *QWaylandDecoration::waylandWindow() const return m_wayland_window; } -inline QColor QWaylandDecoration::foregroundColor() const -{ - return m_foregroundColor; -} - -inline QColor QWaylandDecoration::backgroundColor() const -{ - return m_backgroundColor; -} - QT_END_NAMESPACE #endif // QWAYLANDDECORATION_H From 9ac0da7c31647e05913eb856feea54328469a255 Mon Sep 17 00:00:00 2001 From: Robin Burchell Date: Wed, 20 Aug 2014 21:33:55 +0200 Subject: [PATCH 0160/1507] Fix window decorations being leaked. Change-Id: If0483f5e81a033b275ddc14eb1e44ff82fa1ce65 Reviewed-by: Giulio Camuffo --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index b7f3c4c7ef7..8679463ec6b 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -130,6 +130,8 @@ QWaylandWindow::QWaylandWindow(QWindow *window) QWaylandWindow::~QWaylandWindow() { + delete mWindowDecoration; + if (isInitialized()) { delete mShellSurface; destroy(); From f4e576fbe93c155db448787315f126e8d3b3d5b5 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Fri, 22 Aug 2014 17:04:04 +0200 Subject: [PATCH 0161/1507] Fix typo Change-Id: Idd4351b2650e8869d0e6038d11be5da37f4bdbb1 Reviewed-by: Giulio Camuffo --- src/plugins/platforms/wayland/qwaylandintegration.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandintegration.cpp b/src/plugins/platforms/wayland/qwaylandintegration.cpp index 88eeed842ad..0c90626964c 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandintegration.cpp @@ -291,7 +291,7 @@ void QWaylandIntegration::initializeClientBufferIntegration() } if (targetKey.isEmpty()) { - qWarning("Failed to determin what client buffer integration to use"); + qWarning("Failed to determine what client buffer integration to use"); return; } From 611716293c80bcf5b6fcbc57b869ce2cf853add1 Mon Sep 17 00:00:00 2001 From: Giulio Camuffo Date: Sat, 23 Aug 2014 20:00:03 +0300 Subject: [PATCH 0162/1507] Explicitly define the interface versions Currently a global is bound with the version the interface has in the xml file. This is a problem for apps that explicitly link to libwayland-client because they may link to a newer libwayland, so the version of some interface may be higher than the one that it is actually implemented. Change-Id: Id0dbe6c0f1e05fe91954b9d8d9472d42d2053cdc Reviewed-by: Laszlo Agocs --- .../qwaylandhardwareintegration.cpp | 2 +- .../platforms/wayland/qwaylanddatadevicemanager.cpp | 2 +- src/plugins/platforms/wayland/qwaylanddisplay.cpp | 12 ++++++------ .../platforms/wayland/qwaylandinputdevice.cpp | 2 +- src/plugins/platforms/wayland/qwaylandqtkey.cpp | 2 +- src/plugins/platforms/wayland/qwaylandscreen.cpp | 2 +- src/plugins/platforms/wayland/qwaylandtouch.cpp | 2 +- .../wayland/qwaylandwindowmanagerintegration.cpp | 2 +- src/plugins/platforms/wayland/qwaylandxdgshell.cpp | 2 +- src/tools/qtwaylandscanner/qtwaylandscanner.cpp | 12 ++++++------ 10 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandhardwareintegration.cpp b/src/plugins/platforms/wayland/hardwareintegration/qwaylandhardwareintegration.cpp index a7269ce9e54..469f80360f3 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandhardwareintegration.cpp +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandhardwareintegration.cpp @@ -45,7 +45,7 @@ QT_BEGIN_NAMESPACE QWaylandHardwareIntegration::QWaylandHardwareIntegration(struct ::wl_registry *registry, int id) - : qt_hardware_integration(registry, id) + : qt_hardware_integration(registry, id, 1) { } diff --git a/src/plugins/platforms/wayland/qwaylanddatadevicemanager.cpp b/src/plugins/platforms/wayland/qwaylanddatadevicemanager.cpp index 1aef773490f..ea578ff7b1d 100644 --- a/src/plugins/platforms/wayland/qwaylanddatadevicemanager.cpp +++ b/src/plugins/platforms/wayland/qwaylanddatadevicemanager.cpp @@ -51,7 +51,7 @@ QT_BEGIN_NAMESPACE QWaylandDataDeviceManager::QWaylandDataDeviceManager(QWaylandDisplay *display, uint32_t id) - : wl_data_device_manager(display->wl_registry(), id) + : wl_data_device_manager(display->wl_registry(), id, 1) , m_display(display) { // Create transfer devices for all input devices. diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index 94bfa88bc1b..595d2ce77ee 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -219,33 +219,33 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin // We need to get the output events before creating surfaces forceRoundTrip(); } else if (interface == QStringLiteral("wl_compositor")) { - mCompositor.init(registry, id); + mCompositor.init(registry, id, 3); } else if (interface == QStringLiteral("wl_shm")) { mShm = static_cast(wl_registry_bind(registry, id, &wl_shm_interface,1)); } else if (interface == QStringLiteral("xdg_shell") && qEnvironmentVariableIsSet("QT_WAYLAND_USE_XDG_SHELL")) { mShellXdg.reset(new QWaylandXdgShell(registry,id)); } else if (interface == QStringLiteral("wl_shell")){ - mShell.reset(new QtWayland::wl_shell(registry, id)); + mShell.reset(new QtWayland::wl_shell(registry, id, 1)); } else if (interface == QStringLiteral("wl_seat")) { QWaylandInputDevice *inputDevice = new QWaylandInputDevice(this, id); mInputDevices.append(inputDevice); } else if (interface == QStringLiteral("wl_data_device_manager")) { mDndSelectionHandler.reset(new QWaylandDataDeviceManager(this, id)); } else if (interface == QStringLiteral("qt_output_extension")) { - mOutputExtension.reset(new QtWayland::qt_output_extension(registry, id)); + mOutputExtension.reset(new QtWayland::qt_output_extension(registry, id, 1)); foreach (QPlatformScreen *screen, screens()) static_cast(screen)->createExtendedOutput(); } else if (interface == QStringLiteral("qt_surface_extension")) { - mWindowExtension.reset(new QtWayland::qt_surface_extension(registry, id)); + mWindowExtension.reset(new QtWayland::qt_surface_extension(registry, id, 1)); } else if (interface == QStringLiteral("qt_sub_surface_extension")) { - mSubSurfaceExtension.reset(new QtWayland::qt_sub_surface_extension(registry, id)); + mSubSurfaceExtension.reset(new QtWayland::qt_sub_surface_extension(registry, id, 1)); } else if (interface == QStringLiteral("qt_touch_extension")) { mTouchExtension.reset(new QWaylandTouchExtension(this, id)); } else if (interface == QStringLiteral("qt_key_extension")) { mQtKeyExtension.reset(new QWaylandQtKeyExtension(this, id)); } else if (interface == QStringLiteral("wl_text_input_manager")) { - mTextInputManager.reset(new QtWayland::wl_text_input_manager(registry, id)); + mTextInputManager.reset(new QtWayland::wl_text_input_manager(registry, id, 1)); } else if (interface == QStringLiteral("qt_hardware_integration")) { mHardwareIntegration.reset(new QWaylandHardwareIntegration(registry, id)); // make a roundtrip here since we need to receive the events sent by diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index 145ef608d28..6c132010268 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -228,7 +228,7 @@ public: QWaylandInputDevice::QWaylandInputDevice(QWaylandDisplay *display, uint32_t id) : QObject() - , QtWayland::wl_seat(display->wl_registry(), id) + , QtWayland::wl_seat(display->wl_registry(), id, 2) , mQDisplay(display) , mDisplay(display->wl_display()) , mCaps(0) diff --git a/src/plugins/platforms/wayland/qwaylandqtkey.cpp b/src/plugins/platforms/wayland/qwaylandqtkey.cpp index 197914b0b9c..16562357f00 100644 --- a/src/plugins/platforms/wayland/qwaylandqtkey.cpp +++ b/src/plugins/platforms/wayland/qwaylandqtkey.cpp @@ -46,7 +46,7 @@ QT_BEGIN_NAMESPACE QWaylandQtKeyExtension::QWaylandQtKeyExtension(QWaylandDisplay *display, uint32_t id) - : QtWayland::qt_key_extension(display->wl_registry(), id) + : QtWayland::qt_key_extension(display->wl_registry(), id, 2) , m_display(display) { } diff --git a/src/plugins/platforms/wayland/qwaylandscreen.cpp b/src/plugins/platforms/wayland/qwaylandscreen.cpp index fde5751dc0f..19c3e5d46e5 100644 --- a/src/plugins/platforms/wayland/qwaylandscreen.cpp +++ b/src/plugins/platforms/wayland/qwaylandscreen.cpp @@ -55,7 +55,7 @@ QT_BEGIN_NAMESPACE QWaylandScreen::QWaylandScreen(QWaylandDisplay *waylandDisplay, uint32_t id) : QPlatformScreen() - , QtWayland::wl_output(waylandDisplay->wl_registry(), id) + , QtWayland::wl_output(waylandDisplay->wl_registry(), id, 2) , mWaylandDisplay(waylandDisplay) , mExtendedOutput(0) , mDepth(32) diff --git a/src/plugins/platforms/wayland/qwaylandtouch.cpp b/src/plugins/platforms/wayland/qwaylandtouch.cpp index 71cc1c3cc98..3dabd1ea504 100644 --- a/src/plugins/platforms/wayland/qwaylandtouch.cpp +++ b/src/plugins/platforms/wayland/qwaylandtouch.cpp @@ -46,7 +46,7 @@ QT_BEGIN_NAMESPACE QWaylandTouchExtension::QWaylandTouchExtension(QWaylandDisplay *display, uint32_t id) - : QtWayland::qt_touch_extension(display->wl_registry(), id), + : QtWayland::qt_touch_extension(display->wl_registry(), id, 1), mDisplay(display), mTouchDevice(0), mPointsLeft(0), diff --git a/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration.cpp b/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration.cpp index c2e0153a55a..174ef93a548 100644 --- a/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration.cpp @@ -95,7 +95,7 @@ void QWaylandWindowManagerIntegration::wlHandleListenerGlobal(void *data, wl_reg { Q_UNUSED(version); if (interface == QStringLiteral("qt_windowmanager")) - static_cast(data)->init(registry, id); + static_cast(data)->init(registry, id, 1); } void QWaylandWindowManagerIntegration::windowmanager_hints(int32_t showIsFullScreen) diff --git a/src/plugins/platforms/wayland/qwaylandxdgshell.cpp b/src/plugins/platforms/wayland/qwaylandxdgshell.cpp index eb9f91c435f..8a96a0304b7 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgshell.cpp +++ b/src/plugins/platforms/wayland/qwaylandxdgshell.cpp @@ -57,7 +57,7 @@ QWaylandXdgShell::QWaylandXdgShell(struct ::xdg_shell *shell) } QWaylandXdgShell::QWaylandXdgShell(struct ::wl_registry *registry, uint32_t id) - : QtWayland::xdg_shell(registry, id) + : QtWayland::xdg_shell(registry, id, 1) { use_unstable_version(QtWayland::xdg_shell::version_current); } diff --git a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp index 475b9fec2c4..c99bf2b4815 100644 --- a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp +++ b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp @@ -822,13 +822,13 @@ void process(QXmlStreamReader &xml, const QByteArray &headerPath, const QByteArr printf(" class %s %s\n {\n", clientExport.constData(), interfaceName); printf(" public:\n"); - printf(" %s(struct ::wl_registry *registry, int id);\n", interfaceName); + printf(" %s(struct ::wl_registry *registry, int id, int version);\n", interfaceName); printf(" %s(struct ::%s *object);\n", interfaceName, interfaceName); printf(" %s();\n", interfaceName); printf("\n"); printf(" virtual ~%s();\n", interfaceName); printf("\n"); - printf(" void init(struct ::wl_registry *registry, int id);\n"); + printf(" void init(struct ::wl_registry *registry, int id, int version);\n"); printf(" void init(struct ::%s *object);\n", interfaceName); printf("\n"); printf(" struct ::%s *object() { return m_%s; }\n", interfaceName, interfaceName); @@ -908,9 +908,9 @@ void process(QXmlStreamReader &xml, const QByteArray &headerPath, const QByteArr bool hasEvents = !interface.events.isEmpty(); - printf(" %s::%s(struct ::wl_registry *registry, int id)\n", interfaceName, interfaceName); + printf(" %s::%s(struct ::wl_registry *registry, int id, int version)\n", interfaceName, interfaceName); printf(" {\n"); - printf(" init(registry, id);\n"); + printf(" init(registry, id, version);\n"); printf(" }\n"); printf("\n"); @@ -933,9 +933,9 @@ void process(QXmlStreamReader &xml, const QByteArray &headerPath, const QByteArr printf(" }\n"); printf("\n"); - printf(" void %s::init(struct ::wl_registry *registry, int id)\n", interfaceName); + printf(" void %s::init(struct ::wl_registry *registry, int id, int version)\n", interfaceName); printf(" {\n"); - printf(" m_%s = static_cast(wl_registry_bind(registry, id, &%s_interface, %s_interface.version));\n", interfaceName, interfaceName, interfaceName, interfaceName); + printf(" m_%s = static_cast(wl_registry_bind(registry, id, &%s_interface, version));\n", interfaceName, interfaceName, interfaceName); if (hasEvents) printf(" init_listener();\n"); printf(" }\n"); From 5d49d5a224f8bee7edabd73bcac43f7bdb9f0bed Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Fri, 22 Aug 2014 12:41:42 +0200 Subject: [PATCH 0163/1507] Support RasterGLSurface windows In an attempt to make QOpenGLWidget and QQuickWidget working on Wayland. Since Qt 5.3 all widget windows are of type RasterGLSurface (given that the plugin reports this capability which wayland will, with this patch). Such a window can behave either like a raster or an OpenGL window. This concept maps badly to platform plugins that have a rigid separation between raster and OpenGL platform window implementations. From now on, the OpenGL window implementation, that is used pretty much always, except for raw RasterSurface windows, must be prepared to behave like a raster window too, which involves having a backingstore. Change-Id: I0226704b8d5893843fcae68059c5fe9ad2f5e761 Reviewed-by: Robin Burchell --- .../qwaylandclientbufferintegration_p.h | 2 + .../platforms/wayland/qwaylandintegration.cpp | 10 ++-- .../wayland/qwaylandshmbackingstore.cpp | 47 ++++++++++++------- .../wayland/qwaylandshmbackingstore_p.h | 7 ++- .../platforms/wayland/qwaylandshmwindow.cpp | 7 --- .../platforms/wayland/qwaylandshmwindow_p.h | 13 ----- .../platforms/wayland/qwaylandwindow_p.h | 6 +++ 7 files changed, 50 insertions(+), 42 deletions(-) diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegration_p.h b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegration_p.h index 7d79f326330..be594984b56 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegration_p.h +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegration_p.h @@ -62,6 +62,8 @@ public: virtual void initialize(QWaylandDisplay *display) = 0; + virtual bool isValid() const { return true; } + virtual bool supportsThreadedOpenGL() const { return false; } virtual QWaylandWindow *createEglWindow(QWindow *window) = 0; diff --git a/src/plugins/platforms/wayland/qwaylandintegration.cpp b/src/plugins/platforms/wayland/qwaylandintegration.cpp index 0c90626964c..3b6d4acf944 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandintegration.cpp @@ -42,9 +42,9 @@ #include "qwaylandintegration_p.h" #include "qwaylanddisplay_p.h" +#include "qwaylandshmwindow_p.h" #include "qwaylandinputcontext_p.h" #include "qwaylandshmbackingstore_p.h" -#include "qwaylandshmwindow_p.h" #include "qwaylandnativeinterface_p.h" #include "qwaylandclipboard_p.h" #include "qwaylanddnd_p.h" @@ -162,14 +162,18 @@ bool QWaylandIntegration::hasCapability(QPlatformIntegration::Capability cap) co case MultipleWindows: case NonFullScreenWindows: return true; + case RasterGLSurface: + return true; default: return QPlatformIntegration::hasCapability(cap); } } QPlatformWindow *QWaylandIntegration::createPlatformWindow(QWindow *window) const { - if (window->surfaceType() == QWindow::OpenGLSurface && mDisplay->clientBufferIntegration()) + if ((window->surfaceType() == QWindow::OpenGLSurface || window->surfaceType() == QWindow::RasterGLSurface) + && mDisplay->clientBufferIntegration()) return mDisplay->clientBufferIntegration()->createEglWindow(window); + return new QWaylandShmWindow(window); } @@ -255,7 +259,7 @@ QWaylandClientBufferIntegration *QWaylandIntegration::clientBufferIntegration() if (!mClientBufferIntegrationInitialized) const_cast(this)->initializeClientBufferIntegration(); - return mClientBufferIntegration; + return mClientBufferIntegration && mClientBufferIntegration->isValid() ? mClientBufferIntegration : 0; } QWaylandServerBufferIntegration *QWaylandIntegration::serverBufferIntegration() const diff --git a/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp b/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp index 0677ed0d398..14e1285d37b 100644 --- a/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp +++ b/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp @@ -39,14 +39,12 @@ ** ****************************************************************************/ #include "qwaylandshmbackingstore_p.h" - -#include - +#include "qwaylandwindow_p.h" #include "qwaylanddisplay_p.h" -#include "qwaylandshmwindow_p.h" #include "qwaylandscreen_p.h" #include "qwaylanddecoration_p.h" +#include #include #include @@ -156,9 +154,7 @@ QWaylandShmBackingStore::~QWaylandShmBackingStore() QPaintDevice *QWaylandShmBackingStore::paintDevice() { - if (!windowDecoration()) - return mBackBuffer->image(); - return mBackBuffer->imageInsideMargins(windowDecorationMargins()); + return contentSurface(); } void QWaylandShmBackingStore::beginPaint(const QRegion &) @@ -166,13 +162,11 @@ void QWaylandShmBackingStore::beginPaint(const QRegion &) mPainting = true; ensureSize(); - if (waylandWindow()->attached() && mBackBuffer == waylandWindow()->attached() && mFrameCallback) { - QWaylandShmWindow *waylandWindow = static_cast(window()->handle()); - Q_ASSERT(waylandWindow->windowType() == QWaylandWindow::Shm); - waylandWindow->waitForFrameSync(); - } + QWaylandWindow *window = waylandWindow(); + if (window->attached() && mBackBuffer == window->attached() && mFrameCallback) + window->waitForFrameSync(); - waylandWindow()->setCanResize(false); + window->setCanResize(false); } void QWaylandShmBackingStore::endPaint() @@ -190,9 +184,15 @@ void QWaylandShmBackingStore::ensureSize() void QWaylandShmBackingStore::flush(QWindow *window, const QRegion ®ion, const QPoint &offset) { + // Invoked when the window is of type RasterSurface or when the window is + // RasterGLSurface and there are no child widgets requiring OpenGL composition. + + // For the case of RasterGLSurface + having to compose, the composeAndFlush() is + // called instead. The default implementation from QPlatformBackingStore is sufficient + // however so no need to reimplement that. + Q_UNUSED(window); Q_UNUSED(offset); - Q_ASSERT(waylandWindow()->windowType() == QWaylandWindow::Shm); if (windowDecoration() && windowDecoration()->isDirty()) updateDecorations(); @@ -260,6 +260,11 @@ QImage *QWaylandShmBackingStore::entireSurface() const return mBackBuffer->image(); } +QImage *QWaylandShmBackingStore::contentSurface() const +{ + return windowDecoration() ? mBackBuffer->imageInsideMargins(windowDecorationMargins()) : mBackBuffer->image(); +} + void QWaylandShmBackingStore::updateDecorations() { QPainter decorationPainter(entireSurface()); @@ -302,11 +307,19 @@ QMargins QWaylandShmBackingStore::windowDecorationMargins() const return QMargins(); } -QWaylandShmWindow *QWaylandShmBackingStore::waylandWindow() const +QWaylandWindow *QWaylandShmBackingStore::waylandWindow() const { - return static_cast(window()->handle()); + return static_cast(window()->handle()); } +QImage QWaylandShmBackingStore::toImage() const +{ + // Invoked from QPlatformBackingStore::composeAndFlush() that is called + // instead of flush() for widgets that have renderToTexture children + // (QOpenGLWidget, QQuickWidget). + + return *contentSurface(); +} void QWaylandShmBackingStore::done(void *data, wl_callback *callback, uint32_t time) { @@ -315,7 +328,7 @@ void QWaylandShmBackingStore::done(void *data, wl_callback *callback, uint32_t t static_cast(data); if (callback != self->mFrameCallback) // others, like QWaylandWindow, may trigger callbacks too return; - QWaylandShmWindow *window = self->waylandWindow(); + QWaylandWindow *window = self->waylandWindow(); wl_callback_destroy(self->mFrameCallback); self->mFrameCallback = 0; diff --git a/src/plugins/platforms/wayland/qwaylandshmbackingstore_p.h b/src/plugins/platforms/wayland/qwaylandshmbackingstore_p.h index 6097b5282c8..33f363f6873 100644 --- a/src/plugins/platforms/wayland/qwaylandshmbackingstore_p.h +++ b/src/plugins/platforms/wayland/qwaylandshmbackingstore_p.h @@ -52,7 +52,7 @@ QT_BEGIN_NAMESPACE class QWaylandDisplay; class QWaylandDecoration; -class QWaylandShmWindow; +class QWaylandWindow; class Q_WAYLAND_CLIENT_EXPORT QWaylandShmBuffer : public QWaylandBuffer { public: @@ -87,11 +87,14 @@ public: QMargins windowDecorationMargins() const; QImage *entireSurface() const; + QImage *contentSurface() const; void ensureSize(); - QWaylandShmWindow *waylandWindow() const; + QWaylandWindow *waylandWindow() const; void iterateBuffer(); + QImage toImage() const Q_DECL_OVERRIDE; + private: void updateDecorations(); diff --git a/src/plugins/platforms/wayland/qwaylandshmwindow.cpp b/src/plugins/platforms/wayland/qwaylandshmwindow.cpp index de87682ce70..431ed2fdb97 100644 --- a/src/plugins/platforms/wayland/qwaylandshmwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandshmwindow.cpp @@ -51,13 +51,11 @@ QT_BEGIN_NAMESPACE QWaylandShmWindow::QWaylandShmWindow(QWindow *window) : QWaylandWindow(window) - , mBackingStore(0) { } QWaylandShmWindow::~QWaylandShmWindow() { - } QWaylandWindow::WindowType QWaylandShmWindow::windowType() const @@ -65,9 +63,4 @@ QWaylandWindow::WindowType QWaylandShmWindow::windowType() const return QWaylandWindow::Shm; } -void QWaylandShmWindow::setBackingStore(QWaylandShmBackingStore *backingStore) -{ - mBackingStore = backingStore; -} - QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandshmwindow_p.h b/src/plugins/platforms/wayland/qwaylandshmwindow_p.h index 83479f31303..47ee742699d 100644 --- a/src/plugins/platforms/wayland/qwaylandshmwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandshmwindow_p.h @@ -47,8 +47,6 @@ QT_BEGIN_NAMESPACE -class QWaylandShmBackingStore; - class Q_WAYLAND_CLIENT_EXPORT QWaylandShmWindow : public QWaylandWindow { public: @@ -57,19 +55,8 @@ public: WindowType windowType() const; QSurfaceFormat format() const { return QSurfaceFormat(); } - - void setBackingStore(QWaylandShmBackingStore *backingStore); - QWaylandShmBackingStore *backingStore() const; - -private: - QWaylandShmBackingStore *mBackingStore; }; -inline QWaylandShmBackingStore *QWaylandShmWindow::backingStore() const -{ - return mBackingStore; -} - QT_END_NAMESPACE #endif // QWAYLANDSHMWINDOW_H diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index 9c0be84c6a5..0d0833e54eb 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -63,6 +63,7 @@ class QWaylandSubSurface; class QWaylandDecoration; class QWaylandInputDevice; class QWaylandScreen; +class QWaylandShmBackingStore; class Q_WAYLAND_CLIENT_EXPORT QWaylandWindowConfigure { @@ -179,6 +180,9 @@ public: QVariant property(const QString &name); QVariant property(const QString &name, const QVariant &defaultValue); + void setBackingStore(QWaylandShmBackingStore *backingStore) { mBackingStore = backingStore; } + QWaylandShmBackingStore *backingStore() const { return mBackingStore; } + public slots: void requestResize(); @@ -216,6 +220,8 @@ protected: Qt::WindowState mState; + QWaylandShmBackingStore *mBackingStore; + private: bool setWindowStateInternal(Qt::WindowState flags); void setGeometry_helper(const QRect &rect); From 2f329b4696ba06b5ac3dd1445cc5f0973ab2ccb2 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Sat, 23 Aug 2014 15:12:24 +0200 Subject: [PATCH 0164/1507] Indicate from the client buffer integration if decorations are supported Custom client buffer integrations may not care about window decorations. Setting QT_WAYLAND_DISABLE_WINDOWDECORATION is tedious and error-prone. And it cannot be omitted since things like input events will be off if the common client code thinks decorations are in use but the client buffer integration does not render them at all. Therefore add a supportsWindowDecoration() virtual in addition to the environment variable. Change-Id: If8f621182d5c230f4d8d679c050f5d27aed6c2fb Reviewed-by: Giulio Camuffo --- .../hardwareintegration/qwaylandclientbufferintegration_p.h | 1 + src/plugins/platforms/wayland/qwaylandwindow.cpp | 5 ++++- tests/auto/wayland/tst_client.cpp | 5 +++++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegration_p.h b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegration_p.h index be594984b56..bbe42eb261f 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegration_p.h +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegration_p.h @@ -65,6 +65,7 @@ public: virtual bool isValid() const { return true; } virtual bool supportsThreadedOpenGL() const { return false; } + virtual bool supportsWindowDecoration() const { return false; } virtual QWaylandWindow *createEglWindow(QWindow *window) = 0; virtual QPlatformOpenGLContext *createPlatformOpenGLContext(const QSurfaceFormat &glFormat, QPlatformOpenGLContext *share) const = 0; diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 8679463ec6b..fb3095d4b51 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -52,6 +52,7 @@ #include "qwaylanddecoration_p.h" #include "qwaylandwindowmanagerintegration_p.h" #include "qwaylandnativeinterface_p.h" +#include "qwaylandclientbufferintegration_p.h" #include #include @@ -482,7 +483,9 @@ bool QWaylandWindow::createDecoration() } } - static bool disableWaylandDecorations = !qgetenv("QT_WAYLAND_DISABLE_WINDOWDECORATION").isEmpty(); + static bool disableWaylandDecorations = !qgetenv("QT_WAYLAND_DISABLE_WINDOWDECORATION").isEmpty() + || (mDisplay->clientBufferIntegration() && !mDisplay->clientBufferIntegration()->supportsWindowDecoration()); + if (disableWaylandDecorations) return false; diff --git a/tests/auto/wayland/tst_client.cpp b/tests/auto/wayland/tst_client.cpp index e13d738dc34..113f9d9a850 100644 --- a/tests/auto/wayland/tst_client.cpp +++ b/tests/auto/wayland/tst_client.cpp @@ -248,6 +248,11 @@ int main(int argc, char **argv) setenv("XDG_RUNTIME_DIR", ".", 1); setenv("QT_QPA_PLATFORM", "wayland", 1); // force QGuiApplication to use wayland plugin + // wayland-egl hangs in the test setup when we try to initialize. Until it gets + // figured out, avoid clientBufferIntegration() from being called in + // QWaylandWindow::createDecorations(). + setenv("QT_WAYLAND_DISABLE_WINDOWDECORATION", "1", 1); + MockCompositor compositor; compositor.setOutputGeometry(QRect(QPoint(), screenSize)); From 6a0d904dda41ac6e78e6ec7dc2093669c1897da4 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Fri, 29 Aug 2014 20:43:20 +0200 Subject: [PATCH 0165/1507] Fix touch with Weston Work around the missing touch_frame after the last touch_up. Task-number: QTBUG-36602 Change-Id: Iccb03bdc8b430c7cefc097c3c84e50be676c7fe7 Reviewed-by: Robin Burchell Reviewed-by: Shawn Rutledge --- .../platforms/wayland/qwaylandinputdevice.cpp | 26 ++++++++++++++----- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index 6c132010268..4a100f79a43 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -220,6 +220,8 @@ public: void touch_frame() Q_DECL_OVERRIDE; void touch_cancel() Q_DECL_OVERRIDE; + bool allTouchPointsReleased(); + QWaylandInputDevice *mParent; QWaylandWindow *mFocus; QList mTouchPoints; @@ -863,6 +865,13 @@ void QWaylandInputDevice::Touch::touch_up(uint32_t serial, uint32_t time, int32_ Q_UNUSED(time); mFocus = 0; mParent->handleTouchPoint(id, 0, 0, Qt::TouchPointReleased); + + // As of Weston 1.5.90 there is no touch_frame after the last touch_up + // (i.e. when the last finger is released). To accommodate for this, issue a + // touch_frame. This cannot hurt since it is safe to call the touch_frame + // handler multiple times when there are no points left. + if (allTouchPointsReleased()) + touch_frame(); } void QWaylandInputDevice::Touch::touch_motion(uint32_t time, int32_t id, wl_fixed_t x, wl_fixed_t y) @@ -921,6 +930,15 @@ void QWaylandInputDevice::handleTouchPoint(int id, double x, double y, Qt::Touch mTouch->mTouchPoints.append(tp); } +bool QWaylandInputDevice::Touch::allTouchPointsReleased() +{ + for (int i = 0; i < mTouchPoints.count(); ++i) + if (mTouchPoints.at(i).state != Qt::TouchPointReleased) + return false; + + return true; +} + void QWaylandInputDevice::Touch::touch_frame() { // Copy all points, that are in the previous but not in the current list, as stationary. @@ -950,13 +968,7 @@ void QWaylandInputDevice::Touch::touch_frame() QWindowSystemInterface::handleTouchEvent(window, mParent->mTouchDevice, mTouchPoints); - bool allReleased = true; - for (int i = 0; i < mTouchPoints.count(); ++i) - if (mTouchPoints.at(i).state != Qt::TouchPointReleased) { - allReleased = false; - break; - } - + const bool allReleased = allTouchPointsReleased(); mPrevTouchPoints = mTouchPoints; mTouchPoints.clear(); From c15ee9f0e3549448a19eeb54d5b6c6ae1a9127fa Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Mon, 1 Sep 2014 15:30:42 +0200 Subject: [PATCH 0166/1507] Wayland: correct touch location The window margins were offsetting the touch point in the wrong direction. Task-number: QTBUG-36602 Change-Id: Id8b31d2de4051f36d3ff4e088bbc9bd7cc84ca13 Reviewed-by: Laszlo Agocs --- src/plugins/platforms/wayland/qwaylandinputdevice.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index 4a100f79a43..014303f76fa 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -921,7 +921,7 @@ void QWaylandInputDevice::handleTouchPoint(int id, double x, double y, Qt::Touch tp.area = QRectF(0, 0, 8, 8); QMargins margins = win->frameMargins(); - tp.area.moveCenter(win->window()->mapToGlobal(QPoint(x+margins.left(), y+margins.top()))); + tp.area.moveCenter(win->window()->mapToGlobal(QPoint(x - margins.left(), y - margins.top()))); } tp.state = state; From 76c98e7671856bc2e919b4dadf358c2ec2192321 Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Mon, 1 Sep 2014 17:04:09 +0200 Subject: [PATCH 0167/1507] Wayland: can drag a window by its titlebar using the touchscreen It was already possible to drag it via the mouse but not via touch. Task-number: QTBUG-41085 Change-Id: Ia52c7124fb2f1aa0331897bd072fcf09fb78aa1a Reviewed-by: Laszlo Agocs --- .../platforms/wayland/qwaylanddecoration.cpp | 13 +++++++++++++ .../platforms/wayland/qwaylanddecoration_p.h | 1 + .../platforms/wayland/qwaylandinputdevice.cpp | 10 ++++++++-- src/plugins/platforms/wayland/qwaylandwindow.cpp | 7 +++++++ src/plugins/platforms/wayland/qwaylandwindow_p.h | 3 +++ 5 files changed, 32 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylanddecoration.cpp b/src/plugins/platforms/wayland/qwaylanddecoration.cpp index b288debe9eb..c9ab23c001b 100644 --- a/src/plugins/platforms/wayland/qwaylanddecoration.cpp +++ b/src/plugins/platforms/wayland/qwaylanddecoration.cpp @@ -335,6 +335,19 @@ bool QWaylandDecoration::handleMouse(QWaylandInputDevice *inputDevice, const QPo return true; } +bool QWaylandDecoration::handleTouch(QWaylandInputDevice *inputDevice, const QPointF &local, const QPointF &global, Qt::TouchPointState state, Qt::KeyboardModifiers mods) +{ + Q_UNUSED(inputDevice); + Q_UNUSED(global); + Q_UNUSED(mods); + + if (state == Qt::TouchPointPressed && local.y() <= m_margins.top()) { + m_wayland_window->shellSurface()->move(inputDevice); + return true; + } + return false; +} + bool QWaylandDecoration::inMouseButtonPressedState() const { return m_mouseButtons & Qt::NoButton; diff --git a/src/plugins/platforms/wayland/qwaylanddecoration_p.h b/src/plugins/platforms/wayland/qwaylanddecoration_p.h index 14bf4a92d68..c240b9c9d45 100644 --- a/src/plugins/platforms/wayland/qwaylanddecoration_p.h +++ b/src/plugins/platforms/wayland/qwaylanddecoration_p.h @@ -75,6 +75,7 @@ public: bool isDirty() const; bool handleMouse(QWaylandInputDevice *inputDevice, const QPointF &local, const QPointF &global,Qt::MouseButtons b,Qt::KeyboardModifiers mods); + bool handleTouch(QWaylandInputDevice *inputDevice, const QPointF &local, const QPointF &global, Qt::TouchPointState state, Qt::KeyboardModifiers mods); bool inMouseButtonPressedState() const; void startResize(QWaylandInputDevice *inputDevice,enum wl_shell_surface_resize resize, Qt::MouseButtons buttons); diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index 014303f76fa..5be76d90e19 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -853,8 +853,8 @@ void QWaylandInputDevice::Touch::touch_down(uint32_t serial, wl_fixed_t x, wl_fixed_t y) { - Q_UNUSED(serial); - Q_UNUSED(time); + mParent->mTime = time; + mParent->mSerial = serial; mFocus = QWaylandWindow::fromWlSurface(surface); mParent->handleTouchPoint(id, wl_fixed_to_double(x), wl_fixed_to_double(y), Qt::TouchPointPressed); } @@ -966,6 +966,12 @@ void QWaylandInputDevice::Touch::touch_frame() QWindow *window = mFocus ? mFocus->window() : 0; + if (mFocus) { + const QWindowSystemInterface::TouchPoint &tp = mTouchPoints.last(); + QPointF localPos(window->mapFromGlobal(tp.area.center().toPoint())); + if (mFocus->touchDragDecoration(mParent, localPos, tp.area.center(), tp.state, mParent->modifiers())) + return; + } QWindowSystemInterface::handleTouchEvent(window, mParent->mTouchDevice, mTouchPoints); const bool allReleased = allTouchPointsReleased(); diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index fb3095d4b51..278825e83c7 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -583,6 +583,13 @@ void QWaylandWindow::handleMouseLeave(QWaylandInputDevice *inputDevice) restoreMouseCursor(inputDevice); } +bool QWaylandWindow::touchDragDecoration(QWaylandInputDevice *inputDevice, const QPointF &local, const QPointF &global, Qt::TouchPointState state, Qt::KeyboardModifiers mods) +{ + if (!mWindowDecoration) + return false; + return mWindowDecoration->handleTouch(inputDevice, local, global, state, mods); +} + void QWaylandWindow::handleMouseEventWithDecoration(QWaylandInputDevice *inputDevice, ulong timestamp, const QPointF &local, const QPointF &global, Qt::MouseButtons b, Qt::KeyboardModifiers mods) { if (mWindowDecoration->handleMouse(inputDevice,local,global,b,mods)) diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index 0d0833e54eb..db0b59458bf 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -156,6 +156,9 @@ public: void handleMouseEnter(QWaylandInputDevice *inputDevice); void handleMouseLeave(QWaylandInputDevice *inputDevice); + bool touchDragDecoration(QWaylandInputDevice *inputDevice, const QPointF &local, const QPointF &global, + Qt::TouchPointState state, Qt::KeyboardModifiers mods); + bool createDecoration(); inline bool isMaximized() const { return mState == Qt::WindowMaximized; } From 45fdcd48184733e39703e72a25a9f4ff6ca211c0 Mon Sep 17 00:00:00 2001 From: Li Qiu Date: Tue, 2 Sep 2014 17:25:39 +0300 Subject: [PATCH 0168/1507] Fix crash of test client No wl_data_device_manager created in Mock compositor Change-Id: If80f71165c28678f296bc18f0fea572dcb1a2f77 Reviewed-by: Giulio Camuffo --- tests/auto/wayland/mockcompositor.cpp | 2 ++ tests/auto/wayland/mockcompositor.h | 2 ++ tests/auto/wayland/mockinput.cpp | 31 +++++++++++++++++++++++++++ tests/auto/wayland/mockinput.h | 25 +++++++++++++++++++++ 4 files changed, 60 insertions(+) diff --git a/tests/auto/wayland/mockcompositor.cpp b/tests/auto/wayland/mockcompositor.cpp index 70fa5f23265..cb0e6576e90 100644 --- a/tests/auto/wayland/mockcompositor.cpp +++ b/tests/auto/wayland/mockcompositor.cpp @@ -209,6 +209,8 @@ Compositor::Compositor() wl_display_add_global(m_display, &wl_compositor_interface, this, bindCompositor); + m_data_device_manager.reset(new DataDeviceManager(this, m_display)); + wl_display_init_shm(m_display); m_seat.reset(new Seat(this, m_display)); diff --git a/tests/auto/wayland/mockcompositor.h b/tests/auto/wayland/mockcompositor.h index 7f3e2268312..03d3a96a354 100644 --- a/tests/auto/wayland/mockcompositor.h +++ b/tests/auto/wayland/mockcompositor.h @@ -61,6 +61,7 @@ typedef void (**Implementation)(void); class Keyboard; class Pointer; class Seat; +class DataDeviceManager; class Surface; class Compositor @@ -111,6 +112,7 @@ private: QScopedPointer m_seat; Pointer *m_pointer; Keyboard *m_keyboard; + QScopedPointer m_data_device_manager; QVector m_surfaces; }; diff --git a/tests/auto/wayland/mockinput.cpp b/tests/auto/wayland/mockinput.cpp index bd85ad6c897..fbe44de41cd 100644 --- a/tests/auto/wayland/mockinput.cpp +++ b/tests/auto/wayland/mockinput.cpp @@ -227,4 +227,35 @@ void Pointer::pointer_destroy_resource(wl_pointer::Resource *resource) m_focusResource = 0; } +DataDevice::DataDevice(Compositor *compositor) + : wl_data_device() + , m_compositor(compositor) +{ + +} + +DataDevice::~DataDevice() +{ + +} + +DataDeviceManager::DataDeviceManager(Compositor *compositor, wl_display *display) + : wl_data_device_manager(display) + , m_compositor(compositor) +{ + +} + +DataDeviceManager::~DataDeviceManager() +{ + +} + +void DataDeviceManager::data_device_manager_get_data_device(Resource *resource, uint32_t id, struct ::wl_resource *seat) +{ + if (!m_data_device) + m_data_device.reset(new DataDevice(m_compositor)); + m_data_device->add(resource->client(), id); +} + } diff --git a/tests/auto/wayland/mockinput.h b/tests/auto/wayland/mockinput.h index 128758cad93..16b19b4fb2a 100644 --- a/tests/auto/wayland/mockinput.h +++ b/tests/auto/wayland/mockinput.h @@ -120,6 +120,31 @@ private: Surface *m_focus; }; +class DataDevice : public QtWaylandServer::wl_data_device +{ +public: + DataDevice(Compositor *compositor); + ~DataDevice(); + +private: + Compositor *m_compositor; +}; + +class DataDeviceManager : public QtWaylandServer::wl_data_device_manager +{ +public: + DataDeviceManager(Compositor *compositor, struct ::wl_display *display); + ~DataDeviceManager(); + +protected: + void data_device_manager_get_data_device(Resource *resource, uint32_t id, struct ::wl_resource *seat) Q_DECL_OVERRIDE; + +private: + Compositor *m_compositor; + + QScopedPointer m_data_device; +}; + } #endif // MOCKINPUT_H From 421b3bb9e12155dde993aa424f04b0d12a8db005 Mon Sep 17 00:00:00 2001 From: Giulio Camuffo Date: Wed, 3 Sep 2014 23:16:27 +0300 Subject: [PATCH 0169/1507] Destroy the QScreen when its wl_output is removed Change-Id: I4532d05cca44c88fe38c14eacbe90c190f272b2c Reviewed-by: Robin Burchell Reviewed-by: Laszlo Agocs --- src/plugins/platforms/wayland/qwaylanddisplay.cpp | 12 +++++++++++- src/plugins/platforms/wayland/qwaylanddisplay_p.h | 4 ++-- .../platforms/wayland/qwaylandintegration.cpp | 3 ++- src/plugins/platforms/wayland/qwaylandscreen.cpp | 1 + src/plugins/platforms/wayland/qwaylandscreen_p.h | 2 ++ 5 files changed, 18 insertions(+), 4 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index 595d2ce77ee..a037bb9627b 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -262,7 +262,17 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin void QWaylandDisplay::registry_global_remove(uint32_t id) { for (int i = 0, ie = mGlobals.count(); i != ie; ++i) { - if (mGlobals[i].id == id) { + RegistryGlobal &global = mGlobals[i]; + if (global.id == id) { + if (global.interface == QStringLiteral("wl_output")) { + foreach (QWaylandScreen *screen, mScreens) { + if (screen->outputId() == id) { + delete screen; + mScreens.removeOne(screen); + break; + } + } + } mGlobals.removeAt(i); break; } diff --git a/src/plugins/platforms/wayland/qwaylanddisplay_p.h b/src/plugins/platforms/wayland/qwaylanddisplay_p.h index 6ed30d195a4..64c020546b7 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay_p.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay_p.h @@ -97,7 +97,7 @@ public: QWaylandDisplay(QWaylandIntegration *waylandIntegration); ~QWaylandDisplay(void); - QList screens() const { return mScreens; } + QList screens() const { return mScreens; } QWaylandScreen *screenForOutput(struct wl_output *output) const; @@ -176,7 +176,7 @@ private: QWaylandEventThread *mEventThreadObject; QScopedPointer mShell; QScopedPointer mShellXdg; - QList mScreens; + QList mScreens; QList mInputDevices; QList mRegistryListeners; QWaylandIntegration *mWaylandIntegration; diff --git a/src/plugins/platforms/wayland/qwaylandintegration.cpp b/src/plugins/platforms/wayland/qwaylandintegration.cpp index 3b6d4acf944..224466cc44c 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandintegration.cpp @@ -49,6 +49,7 @@ #include "qwaylandclipboard_p.h" #include "qwaylanddnd_p.h" #include "qwaylandwindowmanagerintegration_p.h" +#include "qwaylandscreen_p.h" #include "QtPlatformSupport/private/qgenericunixfontdatabase_p.h" #include @@ -127,7 +128,7 @@ QWaylandIntegration::QWaylandIntegration() mClipboard = new QWaylandClipboard(mDisplay); mDrag = new QWaylandDrag(mDisplay); - foreach (QPlatformScreen *screen, mDisplay->screens()) + foreach (QWaylandScreen *screen, mDisplay->screens()) screenAdded(screen); mInputContext.reset(new QWaylandInputContext(mDisplay)); diff --git a/src/plugins/platforms/wayland/qwaylandscreen.cpp b/src/plugins/platforms/wayland/qwaylandscreen.cpp index 19c3e5d46e5..2cc719776ea 100644 --- a/src/plugins/platforms/wayland/qwaylandscreen.cpp +++ b/src/plugins/platforms/wayland/qwaylandscreen.cpp @@ -56,6 +56,7 @@ QT_BEGIN_NAMESPACE QWaylandScreen::QWaylandScreen(QWaylandDisplay *waylandDisplay, uint32_t id) : QPlatformScreen() , QtWayland::wl_output(waylandDisplay->wl_registry(), id, 2) + , m_outputId(id) , mWaylandDisplay(waylandDisplay) , mExtendedOutput(0) , mDepth(32) diff --git a/src/plugins/platforms/wayland/qwaylandscreen_p.h b/src/plugins/platforms/wayland/qwaylandscreen_p.h index 5d06227a5d3..90b8fc903ee 100644 --- a/src/plugins/platforms/wayland/qwaylandscreen_p.h +++ b/src/plugins/platforms/wayland/qwaylandscreen_p.h @@ -77,6 +77,7 @@ public: QPlatformCursor *cursor() const; QWaylandCursor *waylandCursor() const { return mWaylandCursor; }; + uint32_t outputId() const { return m_outputId; } ::wl_output *output() { return object(); } QWaylandExtendedOutput *extendedOutput() const; @@ -93,6 +94,7 @@ private: const QString &model, int32_t transform) Q_DECL_OVERRIDE; + int m_outputId; QWaylandDisplay *mWaylandDisplay; QWaylandExtendedOutput *mExtendedOutput; QRect mGeometry; From 03e95c8b8c6594f0d37f8a00324504e5eda07e7b Mon Sep 17 00:00:00 2001 From: Li Qiu Date: Wed, 27 Aug 2014 18:24:52 +0300 Subject: [PATCH 0170/1507] DataOffer not invalidated when client loses keyboard focus The data_offer object should be invalidated when client loses keyboard focus. Otherwise in following scenario, it will become zombie object: start app1 -> copy text -> start app2 -> paste text -> close app1 -> paste again in app2 -> seg fault in qtwayland. The root cause is that when app2 takes focus the first time, data_device.data_offer event was sent to it from DataDevice::setFocus. When app1 is closed, the data source reference in data offer becomes invalid. so when trying to paste again in app2, segmentation faults Change-Id: I16a584e80fddaadd269b00cdf39eb405dd95b622 Task-number: QTBUG-41005 Reviewed-by: Giulio Camuffo --- src/plugins/platforms/wayland/qwaylanddatadevice.cpp | 5 +++++ src/plugins/platforms/wayland/qwaylanddatadevice_p.h | 1 + src/plugins/platforms/wayland/qwaylandinputdevice.cpp | 5 +++++ src/plugins/platforms/wayland/qwaylandwindow.cpp | 9 +++++++++ src/plugins/platforms/wayland/qwaylandwindow_p.h | 1 + 5 files changed, 21 insertions(+) diff --git a/src/plugins/platforms/wayland/qwaylanddatadevice.cpp b/src/plugins/platforms/wayland/qwaylanddatadevice.cpp index 8f690aae0fc..74f879f972d 100644 --- a/src/plugins/platforms/wayland/qwaylanddatadevice.cpp +++ b/src/plugins/platforms/wayland/qwaylanddatadevice.cpp @@ -77,6 +77,11 @@ QWaylandDataOffer *QWaylandDataDevice::selectionOffer() const return m_selectionOffer.data(); } +void QWaylandDataDevice::invalidateSelectionOffer() +{ + m_selectionOffer.reset(); +} + QWaylandDataSource *QWaylandDataDevice::selectionSource() const { return m_selectionSource.data(); diff --git a/src/plugins/platforms/wayland/qwaylanddatadevice_p.h b/src/plugins/platforms/wayland/qwaylanddatadevice_p.h index f5fad17723f..dae91290ebf 100644 --- a/src/plugins/platforms/wayland/qwaylanddatadevice_p.h +++ b/src/plugins/platforms/wayland/qwaylanddatadevice_p.h @@ -65,6 +65,7 @@ public: ~QWaylandDataDevice(); QWaylandDataOffer *selectionOffer() const; + void invalidateSelectionOffer(); QWaylandDataSource *selectionSource() const; void setSelectionSource(QWaylandDataSource *source); diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index 5be76d90e19..c04067688d9 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -717,6 +717,11 @@ void QWaylandInputDevice::Keyboard::keyboard_leave(uint32_t time, struct wl_surf Q_UNUSED(time); Q_UNUSED(surface); + if (surface) { + QWaylandWindow *window = QWaylandWindow::fromWlSurface(surface); + window->unfocus(); + } + mFocus = NULL; // Use a callback to set the focus because we may get a leave/enter pair, and diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 278825e83c7..0905cb3a224 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -42,6 +42,7 @@ #include "qwaylandwindow_p.h" #include "qwaylandbuffer_p.h" +#include "qwaylanddatadevice_p.h" #include "qwaylanddisplay_p.h" #include "qwaylandinputdevice_p.h" #include "qwaylandscreen_p.h" @@ -642,6 +643,14 @@ void QWaylandWindow::requestActivateWindow() // we rely on compositor setting keyboard focus based on window stacking. } +void QWaylandWindow::unfocus() +{ + QWaylandInputDevice *inputDevice = mDisplay->currentInputDevice(); + if (inputDevice && inputDevice->dataDevice()) { + inputDevice->dataDevice()->invalidateSelectionOffer(); + } +} + bool QWaylandWindow::isExposed() const { if (mShellSurface) diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index db0b59458bf..a69af9c0e40 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -142,6 +142,7 @@ public: void requestActivateWindow() Q_DECL_OVERRIDE; bool isExposed() const Q_DECL_OVERRIDE; + void unfocus(); QWaylandDecoration *decoration() const; void setDecoration(QWaylandDecoration *decoration); From 4ca2fc4d1b7b6dd7be7b6c46fe36d7b9efc2b49b Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Fri, 5 Sep 2014 17:01:56 +0200 Subject: [PATCH 0171/1507] Avoid unused parameter Change-Id: Icfc7e4e2d6cd030fc0509ad4724b577f88c4e850 Reviewed-by: Robin Burchell --- src/plugins/platforms/wayland/qwaylandshellsurface.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/plugins/platforms/wayland/qwaylandshellsurface.cpp b/src/plugins/platforms/wayland/qwaylandshellsurface.cpp index d68ae1b5d16..a3855dac0d6 100644 --- a/src/plugins/platforms/wayland/qwaylandshellsurface.cpp +++ b/src/plugins/platforms/wayland/qwaylandshellsurface.cpp @@ -50,6 +50,7 @@ QWaylandShellSurface::QWaylandShellSurface(QWaylandWindow *window) void QWaylandShellSurface::setWindowFlags(Qt::WindowFlags flags) { + Q_UNUSED(flags); } void QWaylandShellSurface::sendProperty(const QString &name, const QVariant &value) From 1bb22c40a341253fdd9c3468aa20a9496fbc9589 Mon Sep 17 00:00:00 2001 From: Giulio Camuffo Date: Sat, 6 Sep 2014 17:15:00 +0300 Subject: [PATCH 0172/1507] Advertise new screens created after startup Change-Id: I995f49e52ec888830b478f1e1f9cc82132776725 Reviewed-by: Laszlo Agocs --- src/plugins/platforms/wayland/qwaylanddisplay.cpp | 4 +++- src/plugins/platforms/wayland/qwaylandintegration.cpp | 3 --- src/plugins/platforms/wayland/qwaylandintegration_p.h | 2 ++ 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index a037bb9627b..264528f6caf 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -215,9 +215,11 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin struct ::wl_registry *registry = object(); if (interface == QStringLiteral("wl_output")) { - mScreens.append(new QWaylandScreen(this, id)); + QWaylandScreen *screen = new QWaylandScreen(this, id); + mScreens.append(screen); // We need to get the output events before creating surfaces forceRoundTrip(); + mWaylandIntegration->screenAdded(screen); } else if (interface == QStringLiteral("wl_compositor")) { mCompositor.init(registry, id, 3); } else if (interface == QStringLiteral("wl_shm")) { diff --git a/src/plugins/platforms/wayland/qwaylandintegration.cpp b/src/plugins/platforms/wayland/qwaylandintegration.cpp index 224466cc44c..d9bf82e4f98 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandintegration.cpp @@ -128,9 +128,6 @@ QWaylandIntegration::QWaylandIntegration() mClipboard = new QWaylandClipboard(mDisplay); mDrag = new QWaylandDrag(mDisplay); - foreach (QWaylandScreen *screen, mDisplay->screens()) - screenAdded(screen); - mInputContext.reset(new QWaylandInputContext(mDisplay)); } diff --git a/src/plugins/platforms/wayland/qwaylandintegration_p.h b/src/plugins/platforms/wayland/qwaylandintegration_p.h index 025e0b4df61..bbe98285389 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration_p.h +++ b/src/plugins/platforms/wayland/qwaylandintegration_p.h @@ -110,6 +110,8 @@ private: bool mClientBufferIntegrationInitialized; bool mServerBufferIntegrationInitialized; bool mShellIntegrationInitialized; + + friend class QWaylandDisplay; }; QT_END_NAMESPACE From c1ed1596535c4c1592ecafd9adfe1acae67d83a9 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Fri, 5 Sep 2014 13:46:56 +0200 Subject: [PATCH 0173/1507] Fix window decorations for GL apps You cannot have rounded corners with an alpha-less config. To make OpenGL applications appearing with the correct decoration, alpha must be enabled. With this fix the OpenGL apps' decoration will now look identical to the SHM apps'. Change-Id: I24431ddab63146f7f697c85277f00f41e5c55e85 Reviewed-by: Shawn Rutledge Reviewed-by: Robin Burchell --- src/plugins/platforms/wayland/qwaylanddisplay.cpp | 13 +++++++++++++ src/plugins/platforms/wayland/qwaylanddisplay_p.h | 2 ++ src/plugins/platforms/wayland/qwaylandwindow.cpp | 6 +----- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index 264528f6caf..3eac985f6ed 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -56,6 +56,7 @@ #include "qwaylandwindowmanagerintegration_p.h" #include "qwaylandshellintegration_p.h" +#include "qwaylandclientbufferintegration_p.h" #include "qwaylandextendedoutput_p.h" #include "qwaylandextendedsurface_p.h" @@ -335,4 +336,16 @@ QtWayland::xdg_shell *QWaylandDisplay::shellXdg() return mShellXdg.data(); } +bool QWaylandDisplay::supportsWindowDecoration() const +{ + static bool disabled = qgetenv("QT_WAYLAND_DISABLE_WINDOWDECORATION").toInt(); + // Stop early when disabled via the environment. Do not try to load the integration in + // order to play nice with SHM-only, buffer integration-less systems. + if (disabled) + return false; + + static bool integrationSupport = clientBufferIntegration() && clientBufferIntegration()->supportsWindowDecoration(); + return integrationSupport; +} + QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylanddisplay_p.h b/src/plugins/platforms/wayland/qwaylanddisplay_p.h index 64c020546b7..b0142004e8b 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay_p.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay_p.h @@ -156,6 +156,8 @@ public: void forceRoundTrip(); + bool supportsWindowDecoration() const; + public slots: void blockingReadEvents(); void flushRequests(); diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 0905cb3a224..aaef58d997a 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -53,7 +53,6 @@ #include "qwaylanddecoration_p.h" #include "qwaylandwindowmanagerintegration_p.h" #include "qwaylandnativeinterface_p.h" -#include "qwaylandclientbufferintegration_p.h" #include #include @@ -484,10 +483,7 @@ bool QWaylandWindow::createDecoration() } } - static bool disableWaylandDecorations = !qgetenv("QT_WAYLAND_DISABLE_WINDOWDECORATION").isEmpty() - || (mDisplay->clientBufferIntegration() && !mDisplay->clientBufferIntegration()->supportsWindowDecoration()); - - if (disableWaylandDecorations) + if (!mDisplay->supportsWindowDecoration()) return false; bool decoration = false; From 0fdbe40ad4b38b313c1f1587ee63c5b7669f096e Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Sat, 6 Sep 2014 21:44:18 +0200 Subject: [PATCH 0174/1507] Allow activating decoration buttons with touch Task-number: QTBUG-41142 Change-Id: Ifad600d375d3b5ba197c384ece54a93db9aa0d2d Reviewed-by: Giulio Camuffo --- .../platforms/wayland/qwaylanddecoration.cpp | 19 ++++++++++++++----- .../platforms/wayland/qwaylandinputdevice.cpp | 6 +++++- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylanddecoration.cpp b/src/plugins/platforms/wayland/qwaylanddecoration.cpp index c9ab23c001b..ed4978725a4 100644 --- a/src/plugins/platforms/wayland/qwaylanddecoration.cpp +++ b/src/plugins/platforms/wayland/qwaylanddecoration.cpp @@ -340,12 +340,21 @@ bool QWaylandDecoration::handleTouch(QWaylandInputDevice *inputDevice, const QPo Q_UNUSED(inputDevice); Q_UNUSED(global); Q_UNUSED(mods); - - if (state == Qt::TouchPointPressed && local.y() <= m_margins.top()) { - m_wayland_window->shellSurface()->move(inputDevice); - return true; + bool handled = state == Qt::TouchPointPressed; + if (handled) { + if (closeButtonRect().contains(local)) + QWindowSystemInterface::handleCloseEvent(m_window); + else if (maximizeButtonRect().contains(local)) + m_window->setWindowState(m_wayland_window->isMaximized() ? Qt::WindowNoState : Qt::WindowMaximized); + else if (minimizeButtonRect().contains(local)) + m_window->setWindowState(Qt::WindowMinimized); + else if (local.y() <= m_margins.top()) + m_wayland_window->shellSurface()->move(inputDevice); + else + handled = false; } - return false; + + return handled; } bool QWaylandDecoration::inMouseButtonPressedState() const diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index c04067688d9..9e3fbabb12f 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -973,7 +973,11 @@ void QWaylandInputDevice::Touch::touch_frame() if (mFocus) { const QWindowSystemInterface::TouchPoint &tp = mTouchPoints.last(); - QPointF localPos(window->mapFromGlobal(tp.area.center().toPoint())); + // When the touch event is received, the global pos is calculated with the margins + // in mind. Now we need to adjust again to get the correct local pos back. + QMargins margins = window->frameMargins(); + QPoint p = tp.area.center().toPoint(); + QPointF localPos(window->mapFromGlobal(QPoint(p.x() + margins.left(), p.y() + margins.top()))); if (mFocus->touchDragDecoration(mParent, localPos, tp.area.center(), tp.state, mParent->modifiers())) return; } From 767cc05e57e4e2ed5a89319a6f605449c4725479 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Sat, 6 Sep 2014 21:28:01 +0200 Subject: [PATCH 0175/1507] Avoid useless handleTouchEvent call The call when allReleased is true is a historical artifact: Originally the call was necessary to generate a TouchEnd. Later the determination of the event type got moved to QWindowSystemInterface. As a result the call is completely superfluous since it will bail out immediately. Task-number: QTBUG-36473 Change-Id: If1a270445a620e6f795912873c60fb1a05384964 Reviewed-by: Shawn Rutledge --- .../platforms/wayland/qwaylandinputdevice.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index 9e3fbabb12f..5198a9e31ea 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -983,14 +983,12 @@ void QWaylandInputDevice::Touch::touch_frame() } QWindowSystemInterface::handleTouchEvent(window, mParent->mTouchDevice, mTouchPoints); - const bool allReleased = allTouchPointsReleased(); - mPrevTouchPoints = mTouchPoints; - mTouchPoints.clear(); - - if (allReleased) { - QWindowSystemInterface::handleTouchEvent(window, mParent->mTouchDevice, mTouchPoints); + if (allTouchPointsReleased()) mPrevTouchPoints.clear(); - } + else + mPrevTouchPoints = mTouchPoints; + + mTouchPoints.clear(); } QT_END_NAMESPACE From f58e56ccf900674f6f6b7945c70a6506ecc80b14 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Sat, 6 Sep 2014 21:51:46 +0200 Subject: [PATCH 0176/1507] Silence warnings about keyboard grab and size hint propagation These two unimplemented functions often result in showing warnings from the default implementations. This is not quite ideal since the warning is useless for users and pollutes the standard output (which f.ex. Creator captures as-is) Change-Id: Ic05ff1590ed351738f0390a94ed5203a05664d4a Reviewed-by: Shawn Rutledge --- src/plugins/platforms/wayland/qwaylandwindow_p.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index a69af9c0e40..dbb0af2e0aa 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -187,6 +187,9 @@ public: void setBackingStore(QWaylandShmBackingStore *backingStore) { mBackingStore = backingStore; } QWaylandShmBackingStore *backingStore() const { return mBackingStore; } + bool setKeyboardGrabEnabled(bool) Q_DECL_OVERRIDE { return false; } + void propagateSizeHints() Q_DECL_OVERRIDE { } + public slots: void requestResize(); From c9dbc3d97dd6e36c1b71a1516bde57927b9c30a0 Mon Sep 17 00:00:00 2001 From: Giulio Camuffo Date: Sat, 6 Sep 2014 00:26:20 +0300 Subject: [PATCH 0177/1507] Fix QWaylandScreen geometry and physical size The wl_output.geometry event carries the physical size of the output, not the logical one. This happened to work only because the geometry event was sent before the mode event, which carries the logical size. Moreover, use the done event to send only one geometry change event instead of one per advertized mode. Change-Id: I5b09d56654aac149d90692bb5a3e050cc0d60cb6 Reviewed-by: Laszlo Agocs --- .../platforms/wayland/qwaylandscreen.cpp | 28 +++++++++++-------- .../platforms/wayland/qwaylandscreen_p.h | 3 ++ 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandscreen.cpp b/src/plugins/platforms/wayland/qwaylandscreen.cpp index 2cc719776ea..6213da87f4e 100644 --- a/src/plugins/platforms/wayland/qwaylandscreen.cpp +++ b/src/plugins/platforms/wayland/qwaylandscreen.cpp @@ -95,6 +95,11 @@ QImage::Format QWaylandScreen::format() const return mFormat; } +QSizeF QWaylandScreen::physicalSize() const +{ + return mPhysicalSize; +} + QDpi QWaylandScreen::logicalDpi() const { static int force_dpi = !qgetenv("QT_WAYLAND_FORCE_DPI").isEmpty() ? qgetenv("QT_WAYLAND_FORCE_DPI").toInt() : -1; @@ -153,16 +158,11 @@ void QWaylandScreen::output_mode(uint32_t flags, int width, int height, int refr QSize size(width, height); - if (size != mGeometry.size()) { + if (size != mGeometry.size()) mGeometry.setSize(size); - QWindowSystemInterface::handleScreenGeometryChange(screen(), mGeometry); - QWindowSystemInterface::handleScreenAvailableGeometryChange(screen(), mGeometry); - } - if (refresh != mRefreshRate) { + if (refresh != mRefreshRate) mRefreshRate = refresh; - QWindowSystemInterface::handleScreenRefreshRateChange(screen(), refreshRate()); - } } void QWaylandScreen::output_geometry(int32_t x, int32_t y, @@ -202,14 +202,18 @@ void QWaylandScreen::output_geometry(int32_t x, int32_t y, if (!model.isEmpty()) mOutputName = model; - QRect geom(x, y, width, height); + mPhysicalSize = QSize(width, height); + mGeometry.moveTopLeft(QPoint(x, y)); +} - if (mGeometry == geom) - return; - - mGeometry = geom; +void QWaylandScreen::output_done() +{ + // the done event is sent after all the geometry and the mode events are sent, + // and the last mode event to be sent is the active one, so we can trust the + // values of mGeometry and mRefreshRate here QWindowSystemInterface::handleScreenGeometryChange(screen(), mGeometry); QWindowSystemInterface::handleScreenAvailableGeometryChange(screen(), mGeometry); + QWindowSystemInterface::handleScreenRefreshRateChange(screen(), refreshRate()); } QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandscreen_p.h b/src/plugins/platforms/wayland/qwaylandscreen_p.h index 90b8fc903ee..866ac26ea2c 100644 --- a/src/plugins/platforms/wayland/qwaylandscreen_p.h +++ b/src/plugins/platforms/wayland/qwaylandscreen_p.h @@ -65,6 +65,8 @@ public: int depth() const; QImage::Format format() const; + QSizeF physicalSize() const Q_DECL_OVERRIDE; + QDpi logicalDpi() const Q_DECL_OVERRIDE; void setOrientationUpdateMask(Qt::ScreenOrientations mask); @@ -93,6 +95,7 @@ private: const QString &make, const QString &model, int32_t transform) Q_DECL_OVERRIDE; + void output_done() Q_DECL_OVERRIDE; int m_outputId; QWaylandDisplay *mWaylandDisplay; From 3d6c98cc58b2db499388351b003d508626ae6e92 Mon Sep 17 00:00:00 2001 From: Giulio Camuffo Date: Mon, 15 Sep 2014 10:36:14 +0300 Subject: [PATCH 0178/1507] The QWindowSystemInterface API changed, make it build again Change-Id: Ic00a820ebac7727a8d71d62ce191fe29de52aac0 Reviewed-by: Robin Burchell --- src/plugins/platforms/wayland/qwaylandscreen.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandscreen.cpp b/src/plugins/platforms/wayland/qwaylandscreen.cpp index 6213da87f4e..9c34baeed50 100644 --- a/src/plugins/platforms/wayland/qwaylandscreen.cpp +++ b/src/plugins/platforms/wayland/qwaylandscreen.cpp @@ -211,8 +211,7 @@ void QWaylandScreen::output_done() // the done event is sent after all the geometry and the mode events are sent, // and the last mode event to be sent is the active one, so we can trust the // values of mGeometry and mRefreshRate here - QWindowSystemInterface::handleScreenGeometryChange(screen(), mGeometry); - QWindowSystemInterface::handleScreenAvailableGeometryChange(screen(), mGeometry); + QWindowSystemInterface::handleScreenGeometryChange(screen(), mGeometry, mGeometry); QWindowSystemInterface::handleScreenRefreshRateChange(screen(), refreshRate()); } From b9f7e26a49885fc8d9907273978ce6792e12abfd Mon Sep 17 00:00:00 2001 From: Giulio Camuffo Date: Fri, 12 Sep 2014 22:19:45 +0300 Subject: [PATCH 0179/1507] Don't give bogus values for a screen physical size If we don't have a valid physical size for a screen, i.e. (0x0), return the default value from the base class. Change-Id: Ia7b6f90ee73e07014ab752ceb165426812c49415 Reviewed-by: Laszlo Agocs --- src/plugins/platforms/wayland/qwaylandscreen.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandscreen.cpp b/src/plugins/platforms/wayland/qwaylandscreen.cpp index 9c34baeed50..943e29a05c1 100644 --- a/src/plugins/platforms/wayland/qwaylandscreen.cpp +++ b/src/plugins/platforms/wayland/qwaylandscreen.cpp @@ -97,7 +97,10 @@ QImage::Format QWaylandScreen::format() const QSizeF QWaylandScreen::physicalSize() const { - return mPhysicalSize; + if (mPhysicalSize.isNull()) + return QPlatformScreen::physicalSize(); + else + return mPhysicalSize; } QDpi QWaylandScreen::logicalDpi() const From 1aeeab6e336e07118c87c497130aba9a0bb47d8c Mon Sep 17 00:00:00 2001 From: Giulio Camuffo Date: Fri, 12 Sep 2014 13:44:42 +0300 Subject: [PATCH 0180/1507] Fix retrieving the selection/dnd data Installing a roudtrip on the custom event queue in the wl_data_offer.offer handler is broken because that triggers a wl_data_device.selection event, which emits the QClipboard changed signal, so code listening to it may end up trying to retrieve the clipboard data before the roundtrip ends. Additionally, we're calling wl_data_offer.receive for each mime type, even if then we never read from the fd, making the source client do work for no reason. Instead, call wl_data_offer.receive retrieveData_sys, that is when actually retreiving the data. We don't need to install a roundtrip after that, just flushing out the requests is enough, because we wait up to one second for the source client to write into the fd. Change-Id: I180779e375ebd5a22af7084458505a41107fab19 Reviewed-by: Robin Burchell --- .../platforms/wayland/qwaylanddataoffer.cpp | 34 +++++++++---------- .../platforms/wayland/qwaylanddataoffer_p.h | 2 +- 2 files changed, 17 insertions(+), 19 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylanddataoffer.cpp b/src/plugins/platforms/wayland/qwaylanddataoffer.cpp index d1c85c7a40e..4ad73dc7e77 100644 --- a/src/plugins/platforms/wayland/qwaylanddataoffer.cpp +++ b/src/plugins/platforms/wayland/qwaylanddataoffer.cpp @@ -94,30 +94,18 @@ QWaylandMimeData::~QWaylandMimeData() void QWaylandMimeData::appendFormat(const QString &mimeType) { - if (m_types.contains(mimeType)) - close(m_types.take(mimeType)); // Unconsumed data + m_types << mimeType; m_data.remove(mimeType); // Clear previous contents - - int pipefd[2]; - if (::pipe2(pipefd, O_CLOEXEC|O_NONBLOCK) == -1) { - qWarning("QWaylandMimeData: pipe2() failed"); - return; - } - - m_dataOffer->receive(mimeType, pipefd[1]); - m_display->forceRoundTrip(); - close(pipefd[1]); - m_types.insert(mimeType, pipefd[0]); } bool QWaylandMimeData::hasFormat_sys(const QString &mimeType) const { - return m_types.contains(mimeType) || m_data.contains(mimeType); + return m_types.contains(mimeType); } QStringList QWaylandMimeData::formats_sys() const { - return m_types.keys() << m_data.keys(); + return m_types; } QVariant QWaylandMimeData::retrieveData_sys(const QString &mimeType, QVariant::Type type) const @@ -130,14 +118,24 @@ QVariant QWaylandMimeData::retrieveData_sys(const QString &mimeType, QVariant::T if (!m_types.contains(mimeType)) return QVariant(); + int pipefd[2]; + if (::pipe2(pipefd, O_CLOEXEC|O_NONBLOCK) == -1) { + qWarning("QWaylandMimeData: pipe2() failed"); + return QVariant(); + } + + m_dataOffer->receive(mimeType, pipefd[1]); + m_display->flushRequests(); + + close(pipefd[1]); + QByteArray content; - int fd = m_types.take(mimeType); - if (readData(fd, content) != 0) { + if (readData(pipefd[0], content) != 0) { qWarning("QWaylandDataOffer: error reading data for mimeType %s", qPrintable(mimeType)); content = QByteArray(); } - close(fd); + close(pipefd[0]); m_data.insert(mimeType, content); return content; } diff --git a/src/plugins/platforms/wayland/qwaylanddataoffer_p.h b/src/plugins/platforms/wayland/qwaylanddataoffer_p.h index a21e18bdc8d..12fc0a22f60 100644 --- a/src/plugins/platforms/wayland/qwaylanddataoffer_p.h +++ b/src/plugins/platforms/wayland/qwaylanddataoffer_p.h @@ -87,7 +87,7 @@ private: mutable QWaylandDataOffer *m_dataOffer; QWaylandDisplay *m_display; - mutable QHash m_types; + mutable QStringList m_types; mutable QHash m_data; }; From a3fa898878a8324f88d73204b682ea72ea759cc5 Mon Sep 17 00:00:00 2001 From: Giulio Camuffo Date: Wed, 17 Sep 2014 14:27:15 +0300 Subject: [PATCH 0181/1507] Ignore negative screen physical size Weston can send in some cases a negative physical size in the wl_output.geometry event. While it is not clear whether that is legal go the extra mile and catch it. Change-Id: Ie2fbab84e653ad77732a72b6ca61509eb7849895 Reviewed-by: Laszlo Agocs --- src/plugins/platforms/wayland/qwaylandscreen.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandscreen.cpp b/src/plugins/platforms/wayland/qwaylandscreen.cpp index 943e29a05c1..88667ae0d4f 100644 --- a/src/plugins/platforms/wayland/qwaylandscreen.cpp +++ b/src/plugins/platforms/wayland/qwaylandscreen.cpp @@ -97,7 +97,7 @@ QImage::Format QWaylandScreen::format() const QSizeF QWaylandScreen::physicalSize() const { - if (mPhysicalSize.isNull()) + if (mPhysicalSize.isEmpty()) return QPlatformScreen::physicalSize(); else return mPhysicalSize; From abd71e1305f3811c04bf3b3f7075c53d44c7f4fe Mon Sep 17 00:00:00 2001 From: Robin Burchell Date: Wed, 20 Aug 2014 16:04:23 +0200 Subject: [PATCH 0182/1507] Rename QWaylandDecoration => QWaylandAbstractDecoration This is in preparation for decoration plugins. Change-Id: Idb322a7a5cbc2eb5bf2cce019073f9f4fb46297f Reviewed-by: Robin Burchell --- src/plugins/platforms/wayland/client.pro | 4 +- ...ion.cpp => qwaylandabstractdecoration.cpp} | 40 +++++++++---------- ...ion_p.h => qwaylandabstractdecoration_p.h} | 20 +++++----- .../wayland/qwaylandshmbackingstore.cpp | 4 +- .../wayland/qwaylandshmbackingstore_p.h | 4 +- .../platforms/wayland/qwaylandwindow.cpp | 8 ++-- .../platforms/wayland/qwaylandwindow_p.h | 8 ++-- .../wayland/qwaylandwlshellsurface.cpp | 2 +- .../platforms/wayland/qwaylandxdgshell.cpp | 1 - .../platforms/wayland/qwaylandxdgsurface.cpp | 2 +- 10 files changed, 46 insertions(+), 47 deletions(-) rename src/plugins/platforms/wayland/{qwaylanddecoration.cpp => qwaylandabstractdecoration.cpp} (87%) rename src/plugins/platforms/wayland/{qwaylanddecoration_p.h => qwaylandabstractdecoration_p.h} (89%) diff --git a/src/plugins/platforms/wayland/client.pro b/src/plugins/platforms/wayland/client.pro index 6aaa2541980..ed14a460e0d 100644 --- a/src/plugins/platforms/wayland/client.pro +++ b/src/plugins/platforms/wayland/client.pro @@ -69,7 +69,7 @@ SOURCES += qwaylandintegration.cpp \ qwaylandtouch.cpp \ qwaylandqtkey.cpp \ ../shared/qwaylandmimehelper.cpp \ - qwaylanddecoration.cpp \ + qwaylandabstractdecoration.cpp \ qwaylandeventthread.cpp\ qwaylandwindowmanagerintegration.cpp \ qwaylandinputcontext.cpp \ @@ -100,7 +100,7 @@ HEADERS += qwaylandintegration_p.h \ qwaylandtouch_p.h \ qwaylandqtkey_p.h \ ../shared/qwaylandmimehelper.h \ - qwaylanddecoration_p.h \ + qwaylandabstractdecoration_p.h \ qwaylandeventthread_p.h \ qwaylandwindowmanagerintegration_p.h \ qwaylandinputcontext_p.h \ diff --git a/src/plugins/platforms/wayland/qwaylanddecoration.cpp b/src/plugins/platforms/wayland/qwaylandabstractdecoration.cpp similarity index 87% rename from src/plugins/platforms/wayland/qwaylanddecoration.cpp rename to src/plugins/platforms/wayland/qwaylandabstractdecoration.cpp index ed4978725a4..2781b42616c 100644 --- a/src/plugins/platforms/wayland/qwaylanddecoration.cpp +++ b/src/plugins/platforms/wayland/qwaylandabstractdecoration.cpp @@ -39,7 +39,7 @@ ** ****************************************************************************/ -#include "qwaylanddecoration_p.h" +#include "qwaylandabstractdecoration_p.h" #include "qwaylandwindow_p.h" #include "qwaylandshellsurface_p.h" @@ -123,7 +123,7 @@ static const char * const qt_normalizeup_xpm[] = { # define BUTTON_WIDTH 22 #endif -QWaylandDecoration::QWaylandDecoration(QWaylandWindow *window) +QWaylandAbstractDecoration::QWaylandAbstractDecoration(QWaylandWindow *window) : m_window(window->window()) , m_wayland_window(window) , m_isDirty(true) @@ -142,12 +142,12 @@ QWaylandDecoration::QWaylandDecoration(QWaylandWindow *window) m_windowTitle.setTextOption(option); } -QWaylandDecoration::~QWaylandDecoration() +QWaylandAbstractDecoration::~QWaylandAbstractDecoration() { m_wayland_window->setDecoration(0); } -const QImage &QWaylandDecoration::contentImage() +const QImage &QWaylandAbstractDecoration::contentImage() { if (m_isDirty) { //Update the decoration backingstore @@ -162,12 +162,12 @@ const QImage &QWaylandDecoration::contentImage() return m_decorationContentImage; } -void QWaylandDecoration::update() +void QWaylandAbstractDecoration::update() { m_isDirty = true; } -void QWaylandDecoration::paint(QPaintDevice *device) +void QWaylandAbstractDecoration::paint(QPaintDevice *device) { QRect surfaceRect(QPoint(), window()->frameGeometry().size()); QRect clips[] = @@ -305,7 +305,7 @@ void QWaylandDecoration::paint(QPaintDevice *device) #endif } -bool QWaylandDecoration::handleMouse(QWaylandInputDevice *inputDevice, const QPointF &local, const QPointF &global, Qt::MouseButtons b, Qt::KeyboardModifiers mods) +bool QWaylandAbstractDecoration::handleMouse(QWaylandInputDevice *inputDevice, const QPointF &local, const QPointF &global, Qt::MouseButtons b, Qt::KeyboardModifiers mods) { Q_UNUSED(global); @@ -335,7 +335,7 @@ bool QWaylandDecoration::handleMouse(QWaylandInputDevice *inputDevice, const QPo return true; } -bool QWaylandDecoration::handleTouch(QWaylandInputDevice *inputDevice, const QPointF &local, const QPointF &global, Qt::TouchPointState state, Qt::KeyboardModifiers mods) +bool QWaylandAbstractDecoration::handleTouch(QWaylandInputDevice *inputDevice, const QPointF &local, const QPointF &global, Qt::TouchPointState state, Qt::KeyboardModifiers mods) { Q_UNUSED(inputDevice); Q_UNUSED(global); @@ -357,12 +357,12 @@ bool QWaylandDecoration::handleTouch(QWaylandInputDevice *inputDevice, const QPo return handled; } -bool QWaylandDecoration::inMouseButtonPressedState() const +bool QWaylandAbstractDecoration::inMouseButtonPressedState() const { return m_mouseButtons & Qt::NoButton; } -void QWaylandDecoration::startResize(QWaylandInputDevice *inputDevice, enum wl_shell_surface_resize resize, Qt::MouseButtons buttons) +void QWaylandAbstractDecoration::startResize(QWaylandInputDevice *inputDevice, enum wl_shell_surface_resize resize, Qt::MouseButtons buttons) { if (isLeftClicked(buttons)) { m_wayland_window->shellSurface()->resize(inputDevice, resize); @@ -370,7 +370,7 @@ void QWaylandDecoration::startResize(QWaylandInputDevice *inputDevice, enum wl_s } } -void QWaylandDecoration::startMove(QWaylandInputDevice *inputDevice, Qt::MouseButtons buttons) +void QWaylandAbstractDecoration::startMove(QWaylandInputDevice *inputDevice, Qt::MouseButtons buttons) { if (isLeftClicked(buttons)) { m_wayland_window->shellSurface()->move(inputDevice); @@ -378,7 +378,7 @@ void QWaylandDecoration::startMove(QWaylandInputDevice *inputDevice, Qt::MouseBu } } -void QWaylandDecoration::processMouseTop(QWaylandInputDevice *inputDevice, const QPointF &local, Qt::MouseButtons b, Qt::KeyboardModifiers mods) +void QWaylandAbstractDecoration::processMouseTop(QWaylandInputDevice *inputDevice, const QPointF &local, Qt::MouseButtons b, Qt::KeyboardModifiers mods) { Q_UNUSED(mods); if (local.y() <= m_margins.bottom()) { @@ -402,7 +402,7 @@ void QWaylandDecoration::processMouseTop(QWaylandInputDevice *inputDevice, const } -void QWaylandDecoration::processMouseBottom(QWaylandInputDevice *inputDevice, const QPointF &local, Qt::MouseButtons b, Qt::KeyboardModifiers mods) +void QWaylandAbstractDecoration::processMouseBottom(QWaylandInputDevice *inputDevice, const QPointF &local, Qt::MouseButtons b, Qt::KeyboardModifiers mods) { Q_UNUSED(mods); if (local.x() <= margins().left()) { @@ -420,7 +420,7 @@ void QWaylandDecoration::processMouseBottom(QWaylandInputDevice *inputDevice, co } } -void QWaylandDecoration::processMouseLeft(QWaylandInputDevice *inputDevice, const QPointF &local, Qt::MouseButtons b, Qt::KeyboardModifiers mods) +void QWaylandAbstractDecoration::processMouseLeft(QWaylandInputDevice *inputDevice, const QPointF &local, Qt::MouseButtons b, Qt::KeyboardModifiers mods) { Q_UNUSED(local); Q_UNUSED(mods); @@ -428,7 +428,7 @@ void QWaylandDecoration::processMouseLeft(QWaylandInputDevice *inputDevice, cons startResize(inputDevice,WL_SHELL_SURFACE_RESIZE_LEFT,b); } -void QWaylandDecoration::processMouseRight(QWaylandInputDevice *inputDevice, const QPointF &local, Qt::MouseButtons b, Qt::KeyboardModifiers mods) +void QWaylandAbstractDecoration::processMouseRight(QWaylandInputDevice *inputDevice, const QPointF &local, Qt::MouseButtons b, Qt::KeyboardModifiers mods) { Q_UNUSED(local); Q_UNUSED(mods); @@ -436,33 +436,33 @@ void QWaylandDecoration::processMouseRight(QWaylandInputDevice *inputDevice, con startResize(inputDevice, WL_SHELL_SURFACE_RESIZE_RIGHT,b); } -bool QWaylandDecoration::isLeftClicked(Qt::MouseButtons newMouseButtonState) +bool QWaylandAbstractDecoration::isLeftClicked(Qt::MouseButtons newMouseButtonState) { if ((!m_mouseButtons & Qt::LeftButton) && (newMouseButtonState & Qt::LeftButton)) return true; return false; } -bool QWaylandDecoration::isLeftReleased(Qt::MouseButtons newMouseButtonState) +bool QWaylandAbstractDecoration::isLeftReleased(Qt::MouseButtons newMouseButtonState) { if ((m_mouseButtons & Qt::LeftButton) && !(newMouseButtonState & Qt::LeftButton)) return true; return false; } -QRectF QWaylandDecoration::closeButtonRect() const +QRectF QWaylandAbstractDecoration::closeButtonRect() const { return QRectF(window()->frameGeometry().width() - BUTTON_WIDTH - BUTTON_SPACING * 2, (m_margins.top() - BUTTON_WIDTH) / 2, BUTTON_WIDTH, BUTTON_WIDTH); } -QRectF QWaylandDecoration::maximizeButtonRect() const +QRectF QWaylandAbstractDecoration::maximizeButtonRect() const { return QRectF(window()->frameGeometry().width() - BUTTON_WIDTH * 2 - BUTTON_SPACING * 3, (m_margins.top() - BUTTON_WIDTH) / 2, BUTTON_WIDTH, BUTTON_WIDTH); } -QRectF QWaylandDecoration::minimizeButtonRect() const +QRectF QWaylandAbstractDecoration::minimizeButtonRect() const { return QRectF(window()->frameGeometry().width() - BUTTON_WIDTH * 3 - BUTTON_SPACING * 4, (m_margins.top() - BUTTON_WIDTH) / 2, BUTTON_WIDTH, BUTTON_WIDTH); diff --git a/src/plugins/platforms/wayland/qwaylanddecoration_p.h b/src/plugins/platforms/wayland/qwaylandabstractdecoration_p.h similarity index 89% rename from src/plugins/platforms/wayland/qwaylanddecoration_p.h rename to src/plugins/platforms/wayland/qwaylandabstractdecoration_p.h index c240b9c9d45..c94c9951acd 100644 --- a/src/plugins/platforms/wayland/qwaylanddecoration_p.h +++ b/src/plugins/platforms/wayland/qwaylandabstractdecoration_p.h @@ -39,8 +39,8 @@ ** ****************************************************************************/ -#ifndef QWAYLANDDECORATION_H -#define QWAYLANDDECORATION_H +#ifndef QWAYLANDABSTRACTDECORATION_H +#define QWAYLANDABSTRACTDECORATION_H #include #include @@ -65,11 +65,11 @@ class QWaylandScreen; class QWaylandWindow; class QWaylandInputDevice; -class Q_WAYLAND_CLIENT_EXPORT QWaylandDecoration +class Q_WAYLAND_CLIENT_EXPORT QWaylandAbstractDecoration { public: - QWaylandDecoration(QWaylandWindow *window); - virtual ~QWaylandDecoration(); + QWaylandAbstractDecoration(QWaylandWindow *window); + virtual ~QWaylandAbstractDecoration(); void update(); bool isDirty() const; @@ -115,26 +115,26 @@ private: QStaticText m_windowTitle; }; -inline bool QWaylandDecoration::isDirty() const +inline bool QWaylandAbstractDecoration::isDirty() const { return m_isDirty; } -inline QMargins QWaylandDecoration::margins() const +inline QMargins QWaylandAbstractDecoration::margins() const { return m_margins; } -inline QWindow *QWaylandDecoration::window() const +inline QWindow *QWaylandAbstractDecoration::window() const { return m_window; } -inline QWaylandWindow *QWaylandDecoration::waylandWindow() const +inline QWaylandWindow *QWaylandAbstractDecoration::waylandWindow() const { return m_wayland_window; } QT_END_NAMESPACE -#endif // QWAYLANDDECORATION_H +#endif // QWAYLANDABSTRACTDECORATION_H diff --git a/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp b/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp index 14e1285d37b..421fae91c6b 100644 --- a/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp +++ b/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp @@ -42,7 +42,7 @@ #include "qwaylandwindow_p.h" #include "qwaylanddisplay_p.h" #include "qwaylandscreen_p.h" -#include "qwaylanddecoration_p.h" +#include "qwaylandabstractdecoration_p.h" #include #include @@ -295,7 +295,7 @@ void QWaylandShmBackingStore::updateDecorations() decorationPainter.drawImage(target, sourceImage, target); } -QWaylandDecoration *QWaylandShmBackingStore::windowDecoration() const +QWaylandAbstractDecoration *QWaylandShmBackingStore::windowDecoration() const { return waylandWindow()->decoration(); } diff --git a/src/plugins/platforms/wayland/qwaylandshmbackingstore_p.h b/src/plugins/platforms/wayland/qwaylandshmbackingstore_p.h index 33f363f6873..5c3dbb5bc27 100644 --- a/src/plugins/platforms/wayland/qwaylandshmbackingstore_p.h +++ b/src/plugins/platforms/wayland/qwaylandshmbackingstore_p.h @@ -51,7 +51,7 @@ QT_BEGIN_NAMESPACE class QWaylandDisplay; -class QWaylandDecoration; +class QWaylandAbstractDecoration; class QWaylandWindow; class Q_WAYLAND_CLIENT_EXPORT QWaylandShmBuffer : public QWaylandBuffer { @@ -83,7 +83,7 @@ public: void beginPaint(const QRegion &); void endPaint(); - QWaylandDecoration *windowDecoration() const; + QWaylandAbstractDecoration *windowDecoration() const; QMargins windowDecorationMargins() const; QImage *entireSurface() const; diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index aaef58d997a..c900b98db6c 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -50,7 +50,7 @@ #include "qwaylandwlshellsurface_p.h" #include "qwaylandxdgsurface_p.h" #include "qwaylandsubsurface_p.h" -#include "qwaylanddecoration_p.h" +#include "qwaylandabstractdecoration_p.h" #include "qwaylandwindowmanagerintegration_p.h" #include "qwaylandnativeinterface_p.h" @@ -505,7 +505,7 @@ bool QWaylandWindow::createDecoration() if (decoration) { if (!mWindowDecoration) - mWindowDecoration = new QWaylandDecoration(this); + mWindowDecoration = new QWaylandAbstractDecoration(this); } else { delete mWindowDecoration; mWindowDecoration = 0; @@ -514,12 +514,12 @@ bool QWaylandWindow::createDecoration() return mWindowDecoration; } -QWaylandDecoration *QWaylandWindow::decoration() const +QWaylandAbstractDecoration *QWaylandWindow::decoration() const { return mWindowDecoration; } -void QWaylandWindow::setDecoration(QWaylandDecoration *decoration) +void QWaylandWindow::setDecoration(QWaylandAbstractDecoration *decoration) { mWindowDecoration = decoration; if (subSurfaceWindow()) { diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index dbb0af2e0aa..c2df0937cd1 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -60,7 +60,7 @@ class QWaylandDisplay; class QWaylandBuffer; class QWaylandShellSurface; class QWaylandSubSurface; -class QWaylandDecoration; +class QWaylandAbstractDecoration; class QWaylandInputDevice; class QWaylandScreen; class QWaylandShmBackingStore; @@ -144,8 +144,8 @@ public: bool isExposed() const Q_DECL_OVERRIDE; void unfocus(); - QWaylandDecoration *decoration() const; - void setDecoration(QWaylandDecoration *decoration); + QWaylandAbstractDecoration *decoration() const; + void setDecoration(QWaylandAbstractDecoration *decoration); void handleMouse(QWaylandInputDevice *inputDevice, @@ -199,7 +199,7 @@ protected: QWaylandShellSurface *mShellSurface; QWaylandSubSurface *mSubSurfaceWindow; - QWaylandDecoration *mWindowDecoration; + QWaylandAbstractDecoration *mWindowDecoration; bool mMouseEventsInContentArea; Qt::MouseButtons mMousePressedInContentArea; Qt::CursorShape m_cursorShape; diff --git a/src/plugins/platforms/wayland/qwaylandwlshellsurface.cpp b/src/plugins/platforms/wayland/qwaylandwlshellsurface.cpp index a8e89ec98c2..86115fa38b2 100644 --- a/src/plugins/platforms/wayland/qwaylandwlshellsurface.cpp +++ b/src/plugins/platforms/wayland/qwaylandwlshellsurface.cpp @@ -44,7 +44,7 @@ #include "qwaylanddisplay_p.h" #include "qwaylandwindow_p.h" #include "qwaylandinputdevice_p.h" -#include "qwaylanddecoration_p.h" +#include "qwaylandabstractdecoration_p.h" #include "qwaylandscreen_p.h" #include "qwaylandextendedsurface_p.h" diff --git a/src/plugins/platforms/wayland/qwaylandxdgshell.cpp b/src/plugins/platforms/wayland/qwaylandxdgshell.cpp index 8a96a0304b7..f31d63f4266 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgshell.cpp +++ b/src/plugins/platforms/wayland/qwaylandxdgshell.cpp @@ -44,7 +44,6 @@ #include "qwaylanddisplay_p.h" #include "qwaylandwindow_p.h" #include "qwaylandinputdevice_p.h" -#include "qwaylanddecoration_p.h" #include "qwaylandscreen_p.h" #include diff --git a/src/plugins/platforms/wayland/qwaylandxdgsurface.cpp b/src/plugins/platforms/wayland/qwaylandxdgsurface.cpp index 126c9db72b3..318ff86d944 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgsurface.cpp +++ b/src/plugins/platforms/wayland/qwaylandxdgsurface.cpp @@ -44,7 +44,7 @@ #include "qwaylanddisplay_p.h" #include "qwaylandwindow_p.h" #include "qwaylandinputdevice_p.h" -#include "qwaylanddecoration_p.h" +#include "qwaylandabstractdecoration_p.h" #include "qwaylandscreen_p.h" #include "qwaylandextendedsurface_p.h" From 9dca9722f0d677b4bd4c88ce6526c4c71f7d228f Mon Sep 17 00:00:00 2001 From: Robin Burchell Date: Wed, 20 Aug 2014 16:31:05 +0200 Subject: [PATCH 0183/1507] QtWaylandClient: Pluginize window decorations. Convert to a D-pointer, split between abstract base class and an implementation. Also move implementation of the current built-in decoration to the "bradient" plugin, named in glorious memory of the programmer-designed blue gradient that will forever sear our eyeballs. The decoration plugin may be specified using the environment variable QT_WAYLAND_DECORATION. Change-Id: Idc99ab06ae138ad299bad2b62b9595379bd007ab Reviewed-by: Robin Burchell --- src/plugins/platforms/wayland/client.pro | 6 +- .../decorations/bradient/bradient.json | 3 + .../plugins/decorations/bradient/bradient.pro | 17 + .../plugins/decorations/bradient/main.cpp | 452 ++++++++++++++++++ .../plugins/decorations/decorations.pro | 3 + .../wayland/qwaylandabstractdecoration.cpp | 422 +++------------- .../wayland/qwaylandabstractdecoration_p.h | 75 +-- .../wayland/qwaylanddecorationfactory.cpp | 97 ++++ .../wayland/qwaylanddecorationfactory_p.h | 61 +++ .../wayland/qwaylanddecorationplugin.cpp | 54 +++ .../wayland/qwaylanddecorationplugin_p.h | 69 +++ .../platforms/wayland/qwaylandwindow.cpp | 37 +- 12 files changed, 885 insertions(+), 411 deletions(-) create mode 100644 src/plugins/platforms/wayland/plugins/decorations/bradient/bradient.json create mode 100644 src/plugins/platforms/wayland/plugins/decorations/bradient/bradient.pro create mode 100644 src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp create mode 100644 src/plugins/platforms/wayland/plugins/decorations/decorations.pro create mode 100644 src/plugins/platforms/wayland/qwaylanddecorationfactory.cpp create mode 100644 src/plugins/platforms/wayland/qwaylanddecorationfactory_p.h create mode 100644 src/plugins/platforms/wayland/qwaylanddecorationplugin.cpp create mode 100644 src/plugins/platforms/wayland/qwaylanddecorationplugin_p.h diff --git a/src/plugins/platforms/wayland/client.pro b/src/plugins/platforms/wayland/client.pro index ed14a460e0d..a8a1136eaa6 100644 --- a/src/plugins/platforms/wayland/client.pro +++ b/src/plugins/platforms/wayland/client.pro @@ -3,7 +3,7 @@ QT += core-private gui-private QT_FOR_PRIVATE += platformsupport-private MODULE=waylandclient -MODULE_PLUGIN_TYPES = wayland-graphics-integration-client +MODULE_PLUGIN_TYPES = wayland-graphics-integration-client wayland-decoration-client load(qt_module) @@ -70,6 +70,8 @@ SOURCES += qwaylandintegration.cpp \ qwaylandqtkey.cpp \ ../shared/qwaylandmimehelper.cpp \ qwaylandabstractdecoration.cpp \ + qwaylanddecorationfactory.cpp \ + qwaylanddecorationplugin.cpp \ qwaylandeventthread.cpp\ qwaylandwindowmanagerintegration.cpp \ qwaylandinputcontext.cpp \ @@ -101,6 +103,8 @@ HEADERS += qwaylandintegration_p.h \ qwaylandqtkey_p.h \ ../shared/qwaylandmimehelper.h \ qwaylandabstractdecoration_p.h \ + qwaylanddecorationfactory_p.h \ + qwaylanddecorationplugin_p.h \ qwaylandeventthread_p.h \ qwaylandwindowmanagerintegration_p.h \ qwaylandinputcontext_p.h \ diff --git a/src/plugins/platforms/wayland/plugins/decorations/bradient/bradient.json b/src/plugins/platforms/wayland/plugins/decorations/bradient/bradient.json new file mode 100644 index 00000000000..e1a5ef24fe8 --- /dev/null +++ b/src/plugins/platforms/wayland/plugins/decorations/bradient/bradient.json @@ -0,0 +1,3 @@ +{ + "Keys": [ "bradient" ] +} diff --git a/src/plugins/platforms/wayland/plugins/decorations/bradient/bradient.pro b/src/plugins/platforms/wayland/plugins/decorations/bradient/bradient.pro new file mode 100644 index 00000000000..fd376f4a985 --- /dev/null +++ b/src/plugins/platforms/wayland/plugins/decorations/bradient/bradient.pro @@ -0,0 +1,17 @@ +PLUGIN_TYPE = wayland-decoration-client +load(qt_plugin) + +QT += waylandclient-private + +OTHER_FILES += \ + bradient.json + +SOURCES += main.cpp + +contains(QT_CONFIG, no-pkg-config) { + LIBS += -lwayland-client +} else { + CONFIG += link_pkgconfig + PKGCONFIG += wayland-client +} + diff --git a/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp b/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp new file mode 100644 index 00000000000..c249248c320 --- /dev/null +++ b/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp @@ -0,0 +1,452 @@ +/**************************************************************************** +** +** Copyright (C) 2014 Robin Burchell +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include +#include +#include + +#include + +#include +#include +#include +#include + +QT_BEGIN_NAMESPACE + +#define BUTTON_SPACING 5 + +#ifndef QT_NO_IMAGEFORMAT_XPM +# define BUTTON_WIDTH 10 + +static const char * const qt_close_xpm[] = { +"10 10 2 1", +"# c #000000", +". c None", +"..........", +".##....##.", +"..##..##..", +"...####...", +"....##....", +"...####...", +"..##..##..", +".##....##.", +"..........", +".........."}; + +static const char * const qt_maximize_xpm[]={ +"10 10 2 1", +"# c #000000", +". c None", +"#########.", +"#########.", +"#.......#.", +"#.......#.", +"#.......#.", +"#.......#.", +"#.......#.", +"#.......#.", +"#########.", +".........."}; + +static const char * const qt_minimize_xpm[] = { +"10 10 2 1", +"# c #000000", +". c None", +"..........", +"..........", +"..........", +"..........", +"..........", +"..........", +"..........", +".#######..", +".#######..", +".........."}; + +static const char * const qt_normalizeup_xpm[] = { +"10 10 2 1", +"# c #000000", +". c None", +"...######.", +"...######.", +"...#....#.", +".######.#.", +".######.#.", +".#....###.", +".#....#...", +".#....#...", +".######...", +".........."}; +#else +# define BUTTON_WIDTH 22 +#endif + +class Q_WAYLAND_CLIENT_EXPORT QWaylandBradientDecoration : public QWaylandAbstractDecoration +{ +public: + QWaylandBradientDecoration(); +protected: + QMargins margins() const Q_DECL_OVERRIDE; + void paint(QPaintDevice *device) Q_DECL_OVERRIDE; + bool handleMouse(QWaylandInputDevice *inputDevice, const QPointF &local, const QPointF &global,Qt::MouseButtons b,Qt::KeyboardModifiers mods) Q_DECL_OVERRIDE; + bool handleTouch(QWaylandInputDevice *inputDevice, const QPointF &local, const QPointF &global, Qt::TouchPointState state, Qt::KeyboardModifiers mods) Q_DECL_OVERRIDE; +private: + void processMouseTop(QWaylandInputDevice *inputDevice, const QPointF &local, Qt::MouseButtons b,Qt::KeyboardModifiers mods); + void processMouseBottom(QWaylandInputDevice *inputDevice, const QPointF &local, Qt::MouseButtons b,Qt::KeyboardModifiers mods); + void processMouseLeft(QWaylandInputDevice *inputDevice, const QPointF &local, Qt::MouseButtons b,Qt::KeyboardModifiers mods); + void processMouseRight(QWaylandInputDevice *inputDevice, const QPointF &local, Qt::MouseButtons b,Qt::KeyboardModifiers mods); + + QRectF closeButtonRect() const; + QRectF maximizeButtonRect() const; + QRectF minimizeButtonRect() const; + + QColor m_foregroundColor; + QColor m_backgroundColor; + QStaticText m_windowTitle; +}; + + + +QWaylandBradientDecoration::QWaylandBradientDecoration() + : QWaylandAbstractDecoration() +{ + QPalette palette; + m_foregroundColor = palette.color(QPalette::Active, QPalette::HighlightedText); + m_backgroundColor = palette.color(QPalette::Active, QPalette::Highlight); + + QTextOption option(Qt::AlignHCenter | Qt::AlignVCenter); + option.setWrapMode(QTextOption::NoWrap); + m_windowTitle.setTextOption(option); +} + +QRectF QWaylandBradientDecoration::closeButtonRect() const +{ + return QRectF(window()->frameGeometry().width() - BUTTON_WIDTH - BUTTON_SPACING * 2, + (margins().top() - BUTTON_WIDTH) / 2, BUTTON_WIDTH, BUTTON_WIDTH); +} + +QRectF QWaylandBradientDecoration::maximizeButtonRect() const +{ + return QRectF(window()->frameGeometry().width() - BUTTON_WIDTH * 2 - BUTTON_SPACING * 3, + (margins().top() - BUTTON_WIDTH) / 2, BUTTON_WIDTH, BUTTON_WIDTH); +} + +QRectF QWaylandBradientDecoration::minimizeButtonRect() const +{ + return QRectF(window()->frameGeometry().width() - BUTTON_WIDTH * 3 - BUTTON_SPACING * 4, + (margins().top() - BUTTON_WIDTH) / 2, BUTTON_WIDTH, BUTTON_WIDTH); +} + +QMargins QWaylandBradientDecoration::margins() const +{ + return QMargins(3, 30, 3, 3); +} + +void QWaylandBradientDecoration::paint(QPaintDevice *device) +{ + QRect surfaceRect(QPoint(), window()->frameGeometry().size()); + QRect clips[] = + { + QRect(0, 0, surfaceRect.width(), margins().top()), + QRect(0, surfaceRect.height() - margins().bottom(), surfaceRect.width(), margins().bottom()), + QRect(0, margins().top(), margins().left(), surfaceRect.height() - margins().top() - margins().bottom()), + QRect(surfaceRect.width() - margins().right(), margins().top(), margins().left(), surfaceRect.height() - margins().top() - margins().bottom()) + }; + + QRect top = clips[0]; + + QPainter p(device); + p.setRenderHint(QPainter::Antialiasing); + + // Title bar + QPoint gradCenter(top.center()+ QPoint(30, 60)); + QLinearGradient grad(top.topLeft(), top.bottomLeft()); + QColor base(m_backgroundColor); + grad.setColorAt(0, base.lighter(100)); + grad.setColorAt(1, base.darker(180)); + QPainterPath roundedRect; + roundedRect.addRoundedRect(surfaceRect, 6, 6); + for (int i = 0; i < 4; ++i) { + p.save(); + p.setClipRect(clips[i]); + p.fillPath(roundedRect, grad); + p.restore(); + } + + // Window icon + QIcon icon = waylandWindow()->windowIcon(); + if (!icon.isNull()) { + QPixmap pixmap = icon.pixmap(QSize(128, 128)); + QPixmap scaled = pixmap.scaled(22, 22, Qt::IgnoreAspectRatio, Qt::SmoothTransformation); + + QRectF iconRect(0, 0, 22, 22); + p.drawPixmap(iconRect.adjusted(margins().left() + BUTTON_SPACING, 4, + margins().left() + BUTTON_SPACING, 4), + scaled, iconRect); + } + + // Window title + QString windowTitleText = window()->title(); + if (!windowTitleText.isEmpty()) { + if (m_windowTitle.text() != windowTitleText) { + m_windowTitle.setText(windowTitleText); + m_windowTitle.prepare(); + } + + QRect titleBar = top; + titleBar.setLeft(margins().left() + BUTTON_SPACING + + (icon.isNull() ? 0 : 22 + BUTTON_SPACING)); + titleBar.setRight(minimizeButtonRect().left() - BUTTON_SPACING); + + p.save(); + p.setClipRect(titleBar); + p.setPen(m_foregroundColor); + QSizeF size = m_windowTitle.size(); + int dx = (top.width() - size.width()) /2; + int dy = (top.height()- size.height()) /2; + QFont font = p.font(); + font.setBold(true); + p.setFont(font); + QPoint windowTitlePoint(top.topLeft().x() + dx, + top.topLeft().y() + dy); + p.drawStaticText(windowTitlePoint, m_windowTitle); + p.restore(); + } + +#ifndef QT_NO_IMAGEFORMAT_XPM + p.save(); + + // Close button + QPixmap closePixmap(qt_close_xpm); + p.drawPixmap(closeButtonRect(), closePixmap, closePixmap.rect()); + + // Maximize button + QPixmap maximizePixmap(waylandWindow()->isMaximized() + ? qt_normalizeup_xpm : qt_maximize_xpm); + p.drawPixmap(maximizeButtonRect(), maximizePixmap, maximizePixmap.rect()); + + // Minimize button + QPixmap minimizePixmap(qt_minimize_xpm); + p.drawPixmap(minimizeButtonRect(), minimizePixmap, minimizePixmap.rect()); + + p.restore(); +#else + // We don't need antialiasing from now on + p.setRenderHint(QPainter::Antialiasing, false); + + QRectF rect; + + // Default pen + QPen pen(m_foregroundColor); + p.setPen(pen); + + // Close button + p.save(); + rect = closeButtonRect(); + p.drawRect(rect); + qreal crossSize = rect.height() / 2; + QPointF crossCenter(rect.center()); + QRectF crossRect(crossCenter.x() - crossSize / 2, crossCenter.y() - crossSize / 2, crossSize, crossSize); + pen.setWidth(2); + p.setPen(pen); + p.drawLine(crossRect.topLeft(), crossRect.bottomRight()); + p.drawLine(crossRect.bottomLeft(), crossRect.topRight()); + p.restore(); + + // Maximize button + p.save(); + p.drawRect(maximizeButtonRect()); + rect = maximizeButtonRect().adjusted(5, 5, -5, -5); + if (waylandWindow()->isMaximized()) { + QRectF rect1 = rect.adjusted(rect.width() / 3, 0, 0, -rect.height() / 3); + QRectF rect2 = rect.adjusted(0, rect.height() / 4, -rect.width() / 4, 0); + p.drawRect(rect1); + p.drawRect(rect2); + } else { + p.setPen(m_foregroundColor); + p.drawRect(rect); + p.drawLine(rect.left(), rect.top() + 1, rect.right(), rect.top() + 1); + } + p.restore(); + + // Minimize button + p.save(); + p.drawRect(minimizeButtonRect()); + rect = minimizeButtonRect().adjusted(5, 5, -5, -5); + pen.setWidth(2); + p.setPen(pen); + p.drawLine(rect.bottomLeft(), rect.bottomRight()); + p.restore(); +#endif +} + +bool QWaylandBradientDecoration::handleMouse(QWaylandInputDevice *inputDevice, const QPointF &local, const QPointF &global, Qt::MouseButtons b, Qt::KeyboardModifiers mods) + +{ + Q_UNUSED(global); + + // Figure out what area mouse is in + if (closeButtonRect().contains(local) && isLeftClicked(b)) { + QWindowSystemInterface::handleCloseEvent(window()); + } else if (maximizeButtonRect().contains(local) && isLeftClicked(b)) { + window()->setWindowState(waylandWindow()->isMaximized() ? Qt::WindowNoState : Qt::WindowMaximized); + } else if (minimizeButtonRect().contains(local) && isLeftClicked(b)) { + window()->setWindowState(Qt::WindowMinimized); + } else if (local.y() <= margins().top()) { + processMouseTop(inputDevice,local,b,mods); + } else if (local.y() > window()->height() - margins().bottom() + margins().top()) { + processMouseBottom(inputDevice,local,b,mods); + } else if (local.x() <= margins().left()) { + processMouseLeft(inputDevice,local,b,mods); + } else if (local.x() > window()->width() - margins().right() + margins().left()) { + processMouseRight(inputDevice,local,b,mods); + } else { + waylandWindow()->restoreMouseCursor(inputDevice); + setMouseButtons(b); + return false; + } + + setMouseButtons(b); + return true; +} + +bool QWaylandBradientDecoration::handleTouch(QWaylandInputDevice *inputDevice, const QPointF &local, const QPointF &global, Qt::TouchPointState state, Qt::KeyboardModifiers mods) +{ + Q_UNUSED(inputDevice); + Q_UNUSED(global); + Q_UNUSED(mods); + bool handled = state == Qt::TouchPointPressed; + if (handled) { + if (closeButtonRect().contains(local)) + QWindowSystemInterface::handleCloseEvent(window()); + else if (maximizeButtonRect().contains(local)) + window()->setWindowState(waylandWindow()->isMaximized() ? Qt::WindowNoState : Qt::WindowMaximized); + else if (minimizeButtonRect().contains(local)) + window()->setWindowState(Qt::WindowMinimized); + else if (local.y() <= margins().top()) + waylandWindow()->shellSurface()->move(inputDevice); + else + handled = false; + } + + return handled; +} + +void QWaylandBradientDecoration::processMouseTop(QWaylandInputDevice *inputDevice, const QPointF &local, Qt::MouseButtons b, Qt::KeyboardModifiers mods) +{ + Q_UNUSED(mods); + if (local.y() <= margins().bottom()) { + if (local.x() <= margins().left()) { + //top left bit + waylandWindow()->setMouseCursor(inputDevice, Qt::SizeFDiagCursor); + startResize(inputDevice,WL_SHELL_SURFACE_RESIZE_TOP_LEFT,b); + } else if (local.x() > window()->width() - margins().right()) { + //top right bit + waylandWindow()->setMouseCursor(inputDevice, Qt::SizeBDiagCursor); + startResize(inputDevice,WL_SHELL_SURFACE_RESIZE_TOP_RIGHT,b); + } else { + //top reszie bit + waylandWindow()->setMouseCursor(inputDevice, Qt::SplitVCursor); + startResize(inputDevice,WL_SHELL_SURFACE_RESIZE_TOP,b); + } + } else { + waylandWindow()->restoreMouseCursor(inputDevice); + startMove(inputDevice,b); + } + +} + +void QWaylandBradientDecoration::processMouseBottom(QWaylandInputDevice *inputDevice, const QPointF &local, Qt::MouseButtons b, Qt::KeyboardModifiers mods) +{ + Q_UNUSED(mods); + if (local.x() <= margins().left()) { + //bottom left bit + waylandWindow()->setMouseCursor(inputDevice, Qt::SizeBDiagCursor); + startResize(inputDevice, WL_SHELL_SURFACE_RESIZE_BOTTOM_LEFT,b); + } else if (local.x() > window()->width() - margins().right()) { + //bottom right bit + waylandWindow()->setMouseCursor(inputDevice, Qt::SizeFDiagCursor); + startResize(inputDevice, WL_SHELL_SURFACE_RESIZE_BOTTOM_RIGHT,b); + } else { + //bottom bit + waylandWindow()->setMouseCursor(inputDevice, Qt::SplitVCursor); + startResize(inputDevice,WL_SHELL_SURFACE_RESIZE_BOTTOM,b); + } +} + +void QWaylandBradientDecoration::processMouseLeft(QWaylandInputDevice *inputDevice, const QPointF &local, Qt::MouseButtons b, Qt::KeyboardModifiers mods) +{ + Q_UNUSED(local); + Q_UNUSED(mods); + waylandWindow()->setMouseCursor(inputDevice, Qt::SplitHCursor); + startResize(inputDevice,WL_SHELL_SURFACE_RESIZE_LEFT,b); +} + +void QWaylandBradientDecoration::processMouseRight(QWaylandInputDevice *inputDevice, const QPointF &local, Qt::MouseButtons b, Qt::KeyboardModifiers mods) +{ + Q_UNUSED(local); + Q_UNUSED(mods); + waylandWindow()->setMouseCursor(inputDevice, Qt::SplitHCursor); + startResize(inputDevice, WL_SHELL_SURFACE_RESIZE_RIGHT,b); +} + +class QWaylandBradientDecorationPlugin : public QWaylandDecorationPlugin +{ + Q_OBJECT + Q_PLUGIN_METADATA(IID QWaylandDecorationFactoryInterface_iid FILE "bradient.json") +public: + QWaylandAbstractDecoration *create(const QString&, const QStringList&) Q_DECL_OVERRIDE; +}; + +QWaylandAbstractDecoration *QWaylandBradientDecorationPlugin::create(const QString& system, const QStringList& paramList) +{ + Q_UNUSED(paramList); + Q_UNUSED(system); + return new QWaylandBradientDecoration(); +} + + +QT_END_NAMESPACE + +#include "main.moc" diff --git a/src/plugins/platforms/wayland/plugins/decorations/decorations.pro b/src/plugins/platforms/wayland/plugins/decorations/decorations.pro new file mode 100644 index 00000000000..6d51a450fb2 --- /dev/null +++ b/src/plugins/platforms/wayland/plugins/decorations/decorations.pro @@ -0,0 +1,3 @@ +TEMPLATE = subdirs +SUBDIRS += \ + bradient diff --git a/src/plugins/platforms/wayland/qwaylandabstractdecoration.cpp b/src/plugins/platforms/wayland/qwaylandabstractdecoration.cpp index 2781b42616c..e247dbbad4f 100644 --- a/src/plugins/platforms/wayland/qwaylandabstractdecoration.cpp +++ b/src/plugins/platforms/wayland/qwaylandabstractdecoration.cpp @@ -1,5 +1,6 @@ /**************************************************************************** ** +** Copyright (C) 2014 Robin Burchell ** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** @@ -41,431 +42,148 @@ #include "qwaylandabstractdecoration_p.h" +#include #include "qwaylandwindow_p.h" #include "qwaylandshellsurface_p.h" #include "qwaylandinputdevice_p.h" #include "qwaylandscreen_p.h" -#include #include -#include -#include -#include -#include QT_BEGIN_NAMESPACE -#define BUTTON_SPACING 5 +class QWaylandAbstractDecorationPrivate : public QObjectPrivate +{ + Q_DECLARE_PUBLIC(QWaylandAbstractDecoration) -#ifndef QT_NO_IMAGEFORMAT_XPM -# define BUTTON_WIDTH 10 +public: + QWaylandAbstractDecorationPrivate(); + ~QWaylandAbstractDecorationPrivate(); -static const char * const qt_close_xpm[] = { -"10 10 2 1", -"# c #000000", -". c None", -"..........", -".##....##.", -"..##..##..", -"...####...", -"....##....", -"...####...", -"..##..##..", -".##....##.", -"..........", -".........."}; + QWindow *m_window; + QWaylandWindow *m_wayland_window; -static const char * const qt_maximize_xpm[]={ -"10 10 2 1", -"# c #000000", -". c None", -"#########.", -"#########.", -"#.......#.", -"#.......#.", -"#.......#.", -"#.......#.", -"#.......#.", -"#.......#.", -"#########.", -".........."}; + bool m_isDirty; + QImage m_decorationContentImage; -static const char * const qt_minimize_xpm[] = { -"10 10 2 1", -"# c #000000", -". c None", -"..........", -"..........", -"..........", -"..........", -"..........", -"..........", -"..........", -".#######..", -".#######..", -".........."}; + Qt::MouseButtons m_mouseButtons; +}; -static const char * const qt_normalizeup_xpm[] = { -"10 10 2 1", -"# c #000000", -". c None", -"...######.", -"...######.", -"...#....#.", -".######.#.", -".######.#.", -".#....###.", -".#....#...", -".#....#...", -".######...", -".........."}; -#else -# define BUTTON_WIDTH 22 -#endif - -QWaylandAbstractDecoration::QWaylandAbstractDecoration(QWaylandWindow *window) - : m_window(window->window()) - , m_wayland_window(window) +QWaylandAbstractDecorationPrivate::QWaylandAbstractDecorationPrivate() + : m_window(0) + , m_wayland_window(0) , m_isDirty(true) , m_decorationContentImage(0) - , m_margins(3,30,3,3) , m_mouseButtons(Qt::NoButton) { - m_wayland_window->setDecoration(this); - - QPalette palette; - m_foregroundColor = palette.color(QPalette::Active, QPalette::HighlightedText); - m_backgroundColor = palette.color(QPalette::Active, QPalette::Highlight); - - QTextOption option(Qt::AlignHCenter | Qt::AlignVCenter); - option.setWrapMode(QTextOption::NoWrap); - m_windowTitle.setTextOption(option); } -QWaylandAbstractDecoration::~QWaylandAbstractDecoration() +QWaylandAbstractDecorationPrivate::~QWaylandAbstractDecorationPrivate() { m_wayland_window->setDecoration(0); } +QWaylandAbstractDecoration::QWaylandAbstractDecoration() + : QObject(*new QWaylandAbstractDecorationPrivate) +{ +} + +QWaylandAbstractDecoration::~QWaylandAbstractDecoration() +{ +} + +// we do this as a setter to get around plugin factory creates not really +// being a great way to pass arguments +void QWaylandAbstractDecoration::setWaylandWindow(QWaylandWindow *window) +{ + Q_D(QWaylandAbstractDecoration); + + // double initialization is probably not great + Q_ASSERT(!d->m_window && !d->m_wayland_window); + + d->m_window = window->window(); + d->m_wayland_window = window; + d->m_wayland_window->setDecoration(this); +} + const QImage &QWaylandAbstractDecoration::contentImage() { - if (m_isDirty) { + Q_D(QWaylandAbstractDecoration); + if (d->m_isDirty) { //Update the decoration backingstore - m_decorationContentImage = QImage(window()->frameGeometry().size(), QImage::Format_ARGB32_Premultiplied); - m_decorationContentImage.fill(Qt::transparent); - this->paint(&m_decorationContentImage); + d->m_decorationContentImage = QImage(window()->frameGeometry().size(), QImage::Format_ARGB32_Premultiplied); + d->m_decorationContentImage.fill(Qt::transparent); + this->paint(&d->m_decorationContentImage); - m_isDirty = false; + d->m_isDirty = false; } - return m_decorationContentImage; + return d->m_decorationContentImage; } void QWaylandAbstractDecoration::update() { - m_isDirty = true; + Q_D(QWaylandAbstractDecoration); + d->m_isDirty = true; } -void QWaylandAbstractDecoration::paint(QPaintDevice *device) +void QWaylandAbstractDecoration::setMouseButtons(Qt::MouseButtons mb) { - QRect surfaceRect(QPoint(), window()->frameGeometry().size()); - QRect clips[] = - { - QRect(0, 0, surfaceRect.width(), margins().top()), - QRect(0, surfaceRect.height() - margins().bottom(), surfaceRect.width(), margins().bottom()), - QRect(0, margins().top(), margins().left(), surfaceRect.height() - margins().top() - margins().bottom()), - QRect(surfaceRect.width() - margins().right(), margins().top(), margins().left(), surfaceRect.height() - margins().top() - margins().bottom()) - }; - - QRect top = clips[0]; - - QPainter p(device); - p.setRenderHint(QPainter::Antialiasing); - - // Title bar - QPoint gradCenter(top.center()+ QPoint(30, 60)); - QLinearGradient grad(top.topLeft(), top.bottomLeft()); - QColor base(m_backgroundColor); - grad.setColorAt(0, base.lighter(100)); - grad.setColorAt(1, base.darker(180)); - QPainterPath roundedRect; - roundedRect.addRoundedRect(surfaceRect, 6, 6); - for (int i = 0; i < 4; ++i) { - p.save(); - p.setClipRect(clips[i]); - p.fillPath(roundedRect, grad); - p.restore(); - } - - // Window icon - QIcon icon = m_wayland_window->windowIcon(); - if (!icon.isNull()) { - QPixmap pixmap = icon.pixmap(QSize(128, 128)); - QPixmap scaled = pixmap.scaled(22, 22, Qt::IgnoreAspectRatio, Qt::SmoothTransformation); - - QRectF iconRect(0, 0, 22, 22); - p.drawPixmap(iconRect.adjusted(margins().left() + BUTTON_SPACING, 4, - margins().left() + BUTTON_SPACING, 4), - scaled, iconRect); - } - - // Window title - QString windowTitleText = window()->title(); - if (!windowTitleText.isEmpty()) { - if (m_windowTitle.text() != windowTitleText) { - m_windowTitle.setText(windowTitleText); - m_windowTitle.prepare(); - } - - QRect titleBar = top; - titleBar.setLeft(m_margins.left() + BUTTON_SPACING + - (icon.isNull() ? 0 : 22 + BUTTON_SPACING)); - titleBar.setRight(minimizeButtonRect().left() - BUTTON_SPACING); - - p.save(); - p.setClipRect(titleBar); - p.setPen(m_foregroundColor); - QSizeF size = m_windowTitle.size(); - int dx = (top.width() - size.width()) /2; - int dy = (top.height()- size.height()) /2; - QFont font = p.font(); - font.setBold(true); - p.setFont(font); - QPoint windowTitlePoint(top.topLeft().x() + dx, - top.topLeft().y() + dy); - p.drawStaticText(windowTitlePoint,m_windowTitle); - p.restore(); - } - -#ifndef QT_NO_IMAGEFORMAT_XPM - p.save(); - - // Close button - QPixmap closePixmap(qt_close_xpm); - p.drawPixmap(closeButtonRect(), closePixmap, closePixmap.rect()); - - // Maximize button - QPixmap maximizePixmap(m_wayland_window->isMaximized() - ? qt_normalizeup_xpm : qt_maximize_xpm); - p.drawPixmap(maximizeButtonRect(), maximizePixmap, maximizePixmap.rect()); - - // Minimize button - QPixmap minimizePixmap(qt_minimize_xpm); - p.drawPixmap(minimizeButtonRect(), minimizePixmap, minimizePixmap.rect()); - - p.restore(); -#else - // We don't need antialiasing from now on - p.setRenderHint(QPainter::Antialiasing, false); - - QRectF rect; - - // Default pen - QPen pen(m_foregroundColor); - p.setPen(pen); - - // Close button - p.save(); - rect = closeButtonRect(); - p.drawRect(rect); - qreal crossSize = rect.height() / 2; - QPointF crossCenter(rect.center()); - QRectF crossRect(crossCenter.x() - crossSize / 2, crossCenter.y() - crossSize / 2, crossSize, crossSize); - pen.setWidth(2); - p.setPen(pen); - p.drawLine(crossRect.topLeft(), crossRect.bottomRight()); - p.drawLine(crossRect.bottomLeft(), crossRect.topRight()); - p.restore(); - - // Maximize button - p.save(); - p.drawRect(maximizeButtonRect()); - rect = maximizeButtonRect().adjusted(5, 5, -5, -5); - if (m_wayland_window->isMaximized()) { - QRectF rect1 = rect.adjusted(rect.width() / 3, 0, 0, -rect.height() / 3); - QRectF rect2 = rect.adjusted(0, rect.height() / 4, -rect.width() / 4, 0); - p.drawRect(rect1); - p.drawRect(rect2); - } else { - p.setPen(m_foregroundColor); - p.drawRect(rect); - p.drawLine(rect.left(), rect.top() + 1, rect.right(), rect.top() + 1); - } - p.restore(); - - // Minimize button - p.save(); - p.drawRect(minimizeButtonRect()); - rect = minimizeButtonRect().adjusted(5, 5, -5, -5); - pen.setWidth(2); - p.setPen(pen); - p.drawLine(rect.bottomLeft(), rect.bottomRight()); - p.restore(); -#endif -} - -bool QWaylandAbstractDecoration::handleMouse(QWaylandInputDevice *inputDevice, const QPointF &local, const QPointF &global, Qt::MouseButtons b, Qt::KeyboardModifiers mods) - -{ - Q_UNUSED(global); - - // Figure out what area mouse is in - if (closeButtonRect().contains(local) && isLeftClicked(b)) { - QWindowSystemInterface::handleCloseEvent(m_window); - } else if (maximizeButtonRect().contains(local) && isLeftClicked(b)) { - m_window->setWindowState(m_wayland_window->isMaximized() ? Qt::WindowNoState : Qt::WindowMaximized); - } else if (minimizeButtonRect().contains(local) && isLeftClicked(b)) { - m_window->setWindowState(Qt::WindowMinimized); - } else if (local.y() <= m_margins.top()) { - processMouseTop(inputDevice,local,b,mods); - } else if (local.y() > m_window->height() - m_margins.bottom() + m_margins.top()) { - processMouseBottom(inputDevice,local,b,mods); - } else if (local.x() <= m_margins.left()) { - processMouseLeft(inputDevice,local,b,mods); - } else if (local.x() > m_window->width() - m_margins.right() + m_margins.left()) { - processMouseRight(inputDevice,local,b,mods); - } else { - m_wayland_window->restoreMouseCursor(inputDevice); - m_mouseButtons = b; - return false; - } - - m_mouseButtons = b; - return true; -} - -bool QWaylandAbstractDecoration::handleTouch(QWaylandInputDevice *inputDevice, const QPointF &local, const QPointF &global, Qt::TouchPointState state, Qt::KeyboardModifiers mods) -{ - Q_UNUSED(inputDevice); - Q_UNUSED(global); - Q_UNUSED(mods); - bool handled = state == Qt::TouchPointPressed; - if (handled) { - if (closeButtonRect().contains(local)) - QWindowSystemInterface::handleCloseEvent(m_window); - else if (maximizeButtonRect().contains(local)) - m_window->setWindowState(m_wayland_window->isMaximized() ? Qt::WindowNoState : Qt::WindowMaximized); - else if (minimizeButtonRect().contains(local)) - m_window->setWindowState(Qt::WindowMinimized); - else if (local.y() <= m_margins.top()) - m_wayland_window->shellSurface()->move(inputDevice); - else - handled = false; - } - - return handled; -} - -bool QWaylandAbstractDecoration::inMouseButtonPressedState() const -{ - return m_mouseButtons & Qt::NoButton; + Q_D(QWaylandAbstractDecoration); + d->m_mouseButtons = mb; } void QWaylandAbstractDecoration::startResize(QWaylandInputDevice *inputDevice, enum wl_shell_surface_resize resize, Qt::MouseButtons buttons) { + Q_D(QWaylandAbstractDecoration); if (isLeftClicked(buttons)) { - m_wayland_window->shellSurface()->resize(inputDevice, resize); + d->m_wayland_window->shellSurface()->resize(inputDevice, resize); inputDevice->removeMouseButtonFromState(Qt::LeftButton); } } void QWaylandAbstractDecoration::startMove(QWaylandInputDevice *inputDevice, Qt::MouseButtons buttons) { + Q_D(QWaylandAbstractDecoration); if (isLeftClicked(buttons)) { - m_wayland_window->shellSurface()->move(inputDevice); + d->m_wayland_window->shellSurface()->move(inputDevice); inputDevice->removeMouseButtonFromState(Qt::LeftButton); } } -void QWaylandAbstractDecoration::processMouseTop(QWaylandInputDevice *inputDevice, const QPointF &local, Qt::MouseButtons b, Qt::KeyboardModifiers mods) -{ - Q_UNUSED(mods); - if (local.y() <= m_margins.bottom()) { - if (local.x() <= margins().left()) { - //top left bit - m_wayland_window->setMouseCursor(inputDevice, Qt::SizeFDiagCursor); - startResize(inputDevice,WL_SHELL_SURFACE_RESIZE_TOP_LEFT,b); - } else if (local.x() > m_window->width() - margins().right()) { - //top right bit - m_wayland_window->setMouseCursor(inputDevice, Qt::SizeBDiagCursor); - startResize(inputDevice,WL_SHELL_SURFACE_RESIZE_TOP_RIGHT,b); - } else { - //top reszie bit - m_wayland_window->setMouseCursor(inputDevice, Qt::SplitVCursor); - startResize(inputDevice,WL_SHELL_SURFACE_RESIZE_TOP,b); - } - } else { - m_wayland_window->restoreMouseCursor(inputDevice); - startMove(inputDevice,b); - } - -} - -void QWaylandAbstractDecoration::processMouseBottom(QWaylandInputDevice *inputDevice, const QPointF &local, Qt::MouseButtons b, Qt::KeyboardModifiers mods) -{ - Q_UNUSED(mods); - if (local.x() <= margins().left()) { - //bottom left bit - m_wayland_window->setMouseCursor(inputDevice, Qt::SizeBDiagCursor); - startResize(inputDevice, WL_SHELL_SURFACE_RESIZE_BOTTOM_LEFT,b); - } else if (local.x() > m_window->width() - margins().right()) { - //bottom right bit - m_wayland_window->setMouseCursor(inputDevice, Qt::SizeFDiagCursor); - startResize(inputDevice, WL_SHELL_SURFACE_RESIZE_BOTTOM_RIGHT,b); - } else { - //bottom bit - m_wayland_window->setMouseCursor(inputDevice, Qt::SplitVCursor); - startResize(inputDevice,WL_SHELL_SURFACE_RESIZE_BOTTOM,b); - } -} - -void QWaylandAbstractDecoration::processMouseLeft(QWaylandInputDevice *inputDevice, const QPointF &local, Qt::MouseButtons b, Qt::KeyboardModifiers mods) -{ - Q_UNUSED(local); - Q_UNUSED(mods); - m_wayland_window->setMouseCursor(inputDevice, Qt::SplitHCursor); - startResize(inputDevice,WL_SHELL_SURFACE_RESIZE_LEFT,b); -} - -void QWaylandAbstractDecoration::processMouseRight(QWaylandInputDevice *inputDevice, const QPointF &local, Qt::MouseButtons b, Qt::KeyboardModifiers mods) -{ - Q_UNUSED(local); - Q_UNUSED(mods); - m_wayland_window->setMouseCursor(inputDevice, Qt::SplitHCursor); - startResize(inputDevice, WL_SHELL_SURFACE_RESIZE_RIGHT,b); -} - bool QWaylandAbstractDecoration::isLeftClicked(Qt::MouseButtons newMouseButtonState) { - if ((!m_mouseButtons & Qt::LeftButton) && (newMouseButtonState & Qt::LeftButton)) + Q_D(QWaylandAbstractDecoration); + if ((!d->m_mouseButtons & Qt::LeftButton) && (newMouseButtonState & Qt::LeftButton)) return true; return false; } bool QWaylandAbstractDecoration::isLeftReleased(Qt::MouseButtons newMouseButtonState) { - if ((m_mouseButtons & Qt::LeftButton) && !(newMouseButtonState & Qt::LeftButton)) + Q_D(QWaylandAbstractDecoration); + if ((d->m_mouseButtons & Qt::LeftButton) && !(newMouseButtonState & Qt::LeftButton)) return true; return false; } -QRectF QWaylandAbstractDecoration::closeButtonRect() const +bool QWaylandAbstractDecoration::isDirty() const { - return QRectF(window()->frameGeometry().width() - BUTTON_WIDTH - BUTTON_SPACING * 2, - (m_margins.top() - BUTTON_WIDTH) / 2, BUTTON_WIDTH, BUTTON_WIDTH); + Q_D(const QWaylandAbstractDecoration); + return d->m_isDirty; } -QRectF QWaylandAbstractDecoration::maximizeButtonRect() const +QWindow *QWaylandAbstractDecoration::window() const { - return QRectF(window()->frameGeometry().width() - BUTTON_WIDTH * 2 - BUTTON_SPACING * 3, - (m_margins.top() - BUTTON_WIDTH) / 2, BUTTON_WIDTH, BUTTON_WIDTH); + Q_D(const QWaylandAbstractDecoration); + return d->m_window; } -QRectF QWaylandAbstractDecoration::minimizeButtonRect() const +QWaylandWindow *QWaylandAbstractDecoration::waylandWindow() const { - return QRectF(window()->frameGeometry().width() - BUTTON_WIDTH * 3 - BUTTON_SPACING * 4, - (m_margins.top() - BUTTON_WIDTH) / 2, BUTTON_WIDTH, BUTTON_WIDTH); + Q_D(const QWaylandAbstractDecoration); + return d->m_wayland_window; } QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandabstractdecoration_p.h b/src/plugins/platforms/wayland/qwaylandabstractdecoration_p.h index c94c9951acd..6171cab14cb 100644 --- a/src/plugins/platforms/wayland/qwaylandabstractdecoration_p.h +++ b/src/plugins/platforms/wayland/qwaylandabstractdecoration_p.h @@ -1,5 +1,6 @@ /**************************************************************************** ** +** Copyright (C) 2014 Robin Burchell ** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** @@ -64,77 +65,41 @@ class QEvent; class QWaylandScreen; class QWaylandWindow; class QWaylandInputDevice; +class QWaylandAbstractDecorationPrivate; -class Q_WAYLAND_CLIENT_EXPORT QWaylandAbstractDecoration +class Q_WAYLAND_CLIENT_EXPORT QWaylandAbstractDecoration : public QObject { + Q_OBJECT + Q_DECLARE_PRIVATE(QWaylandAbstractDecoration) public: - QWaylandAbstractDecoration(QWaylandWindow *window); + QWaylandAbstractDecoration(); virtual ~QWaylandAbstractDecoration(); + void setWaylandWindow(QWaylandWindow *window); + QWaylandWindow *waylandWindow() const; + void update(); bool isDirty() const; - bool handleMouse(QWaylandInputDevice *inputDevice, const QPointF &local, const QPointF &global,Qt::MouseButtons b,Qt::KeyboardModifiers mods); - bool handleTouch(QWaylandInputDevice *inputDevice, const QPointF &local, const QPointF &global, Qt::TouchPointState state, Qt::KeyboardModifiers mods); - bool inMouseButtonPressedState() const; + virtual QMargins margins() const = 0; + QWindow *window() const; + const QImage &contentImage(); + + virtual bool handleMouse(QWaylandInputDevice *inputDevice, const QPointF &local, const QPointF &global,Qt::MouseButtons b,Qt::KeyboardModifiers mods) = 0; + virtual bool handleTouch(QWaylandInputDevice *inputDevice, const QPointF &local, const QPointF &global, Qt::TouchPointState state, Qt::KeyboardModifiers mods) = 0; + +protected: + virtual void paint(QPaintDevice *device) = 0; + + void setMouseButtons(Qt::MouseButtons mb); void startResize(QWaylandInputDevice *inputDevice,enum wl_shell_surface_resize resize, Qt::MouseButtons buttons); void startMove(QWaylandInputDevice *inputDevice, Qt::MouseButtons buttons); - QMargins margins() const; - QWindow *window() const; - QWaylandWindow *waylandWindow() const; - const QImage &contentImage(); - -protected: - void paint(QPaintDevice *device); - -private: - void processMouseTop(QWaylandInputDevice *inputDevice, const QPointF &local, Qt::MouseButtons b,Qt::KeyboardModifiers mods); - void processMouseBottom(QWaylandInputDevice *inputDevice, const QPointF &local, Qt::MouseButtons b,Qt::KeyboardModifiers mods); - void processMouseLeft(QWaylandInputDevice *inputDevice, const QPointF &local, Qt::MouseButtons b,Qt::KeyboardModifiers mods); - void processMouseRight(QWaylandInputDevice *inputDevice, const QPointF &local, Qt::MouseButtons b,Qt::KeyboardModifiers mods); bool isLeftClicked(Qt::MouseButtons newMouseButtonState); bool isLeftReleased(Qt::MouseButtons newMouseButtonState); - - QRectF closeButtonRect() const; - QRectF maximizeButtonRect() const; - QRectF minimizeButtonRect() const; - - QWindow *m_window; - QWaylandWindow *m_wayland_window; - - bool m_isDirty; - QImage m_decorationContentImage; - - QMargins m_margins; - Qt::MouseButtons m_mouseButtons; - - QColor m_foregroundColor; - QColor m_backgroundColor; - QStaticText m_windowTitle; }; -inline bool QWaylandAbstractDecoration::isDirty() const -{ - return m_isDirty; -} - -inline QMargins QWaylandAbstractDecoration::margins() const -{ - return m_margins; -} - -inline QWindow *QWaylandAbstractDecoration::window() const -{ - return m_window; -} - -inline QWaylandWindow *QWaylandAbstractDecoration::waylandWindow() const -{ - return m_wayland_window; -} - QT_END_NAMESPACE #endif // QWAYLANDABSTRACTDECORATION_H diff --git a/src/plugins/platforms/wayland/qwaylanddecorationfactory.cpp b/src/plugins/platforms/wayland/qwaylanddecorationfactory.cpp new file mode 100644 index 00000000000..6f1f74693fe --- /dev/null +++ b/src/plugins/platforms/wayland/qwaylanddecorationfactory.cpp @@ -0,0 +1,97 @@ +/**************************************************************************** +** +** Copyright (C) 2014 Robin Burchell +** Contact: http://www.qt-project.org/legal +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qwaylanddecorationfactory_p.h" +#include "qwaylanddecorationplugin_p.h" + +#include +#include +#include + +QT_BEGIN_NAMESPACE + +#ifndef QT_NO_LIBRARY +Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader, + (QWaylandDecorationFactoryInterface_iid, QLatin1String("/wayland-decoration-client"), Qt::CaseInsensitive)) +Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, directLoader, + (QWaylandDecorationFactoryInterface_iid, QLatin1String(""), Qt::CaseInsensitive)) +#endif + +QStringList QWaylandDecorationFactory::keys(const QString &pluginPath) +{ +#ifndef QT_NO_LIBRARY + QStringList list; + if (!pluginPath.isEmpty()) { + QCoreApplication::addLibraryPath(pluginPath); + list = directLoader()->keyMap().values(); + if (!list.isEmpty()) { + const QString postFix = QStringLiteral(" (from ") + + QDir::toNativeSeparators(pluginPath) + + QLatin1Char(')'); + const QStringList::iterator end = list.end(); + for (QStringList::iterator it = list.begin(); it != end; ++it) + (*it).append(postFix); + } + } + list.append(loader()->keyMap().values()); + return list; +#else + return QStringList(); +#endif +} + +QWaylandAbstractDecoration *QWaylandDecorationFactory::create(const QString &name, const QStringList &args, const QString &pluginPath) +{ +#ifndef QT_NO_LIBRARY + // Try loading the plugin from platformPluginPath first: + if (!pluginPath.isEmpty()) { + QCoreApplication::addLibraryPath(pluginPath); + if (QWaylandAbstractDecoration *ret = qLoadPlugin1(directLoader(), name, args)) + return ret; + } + if (QWaylandAbstractDecoration *ret = qLoadPlugin1(loader(), name, args)) + return ret; +#endif + + return 0; +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylanddecorationfactory_p.h b/src/plugins/platforms/wayland/qwaylanddecorationfactory_p.h new file mode 100644 index 00000000000..a7729bcafda --- /dev/null +++ b/src/plugins/platforms/wayland/qwaylanddecorationfactory_p.h @@ -0,0 +1,61 @@ +/**************************************************************************** +** +** Copyright (C) 2014 Robin Burchell +** Contact: http://www.qt-project.org/legal +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWAYLANDDECORATIONFACTORY_H +#define QWAYLANDDECORATIONFACTORY_H + +#include +#include + +QT_BEGIN_NAMESPACE + +class QWaylandAbstractDecoration; + +class Q_WAYLAND_CLIENT_EXPORT QWaylandDecorationFactory +{ +public: + static QStringList keys(const QString &pluginPath = QString()); + static QWaylandAbstractDecoration *create(const QString &name, const QStringList &args, const QString &pluginPath = QString()); +}; + +QT_END_NAMESPACE + +#endif // QWAYLANDDECORATIONFACTORY_H diff --git a/src/plugins/platforms/wayland/qwaylanddecorationplugin.cpp b/src/plugins/platforms/wayland/qwaylanddecorationplugin.cpp new file mode 100644 index 00000000000..edad5f5f0af --- /dev/null +++ b/src/plugins/platforms/wayland/qwaylanddecorationplugin.cpp @@ -0,0 +1,54 @@ +/**************************************************************************** +** +** Copyright (C) 2014 Robin Burchell +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qwaylanddecorationplugin_p.h" + +QT_BEGIN_NAMESPACE + +QWaylandDecorationPlugin::QWaylandDecorationPlugin(QObject *parent) + : QObject(parent) +{ +} +QWaylandDecorationPlugin::~QWaylandDecorationPlugin() +{ +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylanddecorationplugin_p.h b/src/plugins/platforms/wayland/qwaylanddecorationplugin_p.h new file mode 100644 index 00000000000..6ed8935db2a --- /dev/null +++ b/src/plugins/platforms/wayland/qwaylanddecorationplugin_p.h @@ -0,0 +1,69 @@ +/**************************************************************************** +** +** Copyright (C) 2014 Robin Burchell +** Contact: http://www.qt-project.org/legal +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWAYLANDDECORATIONPLUGIN_H +#define QWAYLANDDECORATIONPLUGIN_H + +#include + +#include +#include +#include + +QT_BEGIN_NAMESPACE + +class QWaylandAbstractDecoration; + +#define QWaylandDecorationFactoryInterface_iid "org.qt-project.Qt.WaylandClient.QWaylandDecorationFactoryInterface.5.4" + +class Q_WAYLAND_CLIENT_EXPORT QWaylandDecorationPlugin : public QObject +{ + Q_OBJECT +public: + explicit QWaylandDecorationPlugin(QObject *parent = 0); + ~QWaylandDecorationPlugin(); + + virtual QWaylandAbstractDecoration *create(const QString &key, const QStringList ¶mList) = 0; +}; + +QT_END_NAMESPACE + +#endif // QWAYLANDDECORATIONPLUGIN_H diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index c900b98db6c..2fc904aadd1 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -53,6 +53,7 @@ #include "qwaylandabstractdecoration_p.h" #include "qwaylandwindowmanagerintegration_p.h" #include "qwaylandnativeinterface_p.h" +#include "qwaylanddecorationfactory_p.h" #include #include @@ -486,6 +487,7 @@ bool QWaylandWindow::createDecoration() if (!mDisplay->supportsWindowDecoration()) return false; + static bool decorationPluginFailed = false; bool decoration = false; switch (window()->type()) { case Qt::Window: @@ -503,9 +505,37 @@ bool QWaylandWindow::createDecoration() if (window()->flags() & Qt::BypassWindowManagerHint) decoration = false; - if (decoration) { - if (!mWindowDecoration) - mWindowDecoration = new QWaylandAbstractDecoration(this); + if (decoration && !decorationPluginFailed) { + if (!mWindowDecoration) { + QStringList decorations = QWaylandDecorationFactory::keys(); + if (decorations.empty()) { + qWarning() << "No decoration plugins available. Running with no decorations."; + decorationPluginFailed = true; + return false; + } + + QString targetKey; + QByteArray decorationPluginName = qgetenv("QT_WAYLAND_DECORATION"); + if (!decorationPluginName.isEmpty()) { + targetKey = QString::fromLocal8Bit(decorationPluginName); + if (!decorations.contains(targetKey)) { + qWarning() << "Requested decoration " << targetKey << " not found, falling back to default"; + targetKey = QString(); // fallthrough + } + } + + if (targetKey.isEmpty()) + targetKey = decorations.first(); // first come, first served. + + + mWindowDecoration = QWaylandDecorationFactory::create(targetKey, QStringList()); + if (!mWindowDecoration) { + qWarning() << "Could not create decoration from factory! Running with no decorations."; + decorationPluginFailed = true; + return false; + } + mWindowDecoration->setWaylandWindow(this); + } } else { delete mWindowDecoration; mWindowDecoration = 0; @@ -519,6 +549,7 @@ QWaylandAbstractDecoration *QWaylandWindow::decoration() const return mWindowDecoration; } +// ### can't this go away? we directly set up our decorations, after all void QWaylandWindow::setDecoration(QWaylandAbstractDecoration *decoration) { mWindowDecoration = decoration; From 21571bb4fb1e65fcb6fa41a8c197765aa885a445 Mon Sep 17 00:00:00 2001 From: Robin Burchell Date: Wed, 20 Aug 2014 21:34:30 +0200 Subject: [PATCH 0184/1507] decorations: Remove strange set dance between QWaylandWindow & QWaylandAbstractDecoration. This makes absolutely no sense. Just do things inline. Change-Id: Ic6d4e62bc9b3c0a4533f63740f2608a0be201047 Reviewed-by: Robin Burchell --- .../platforms/wayland/qwaylandabstractdecoration.cpp | 2 -- src/plugins/platforms/wayland/qwaylandwindow.cpp | 12 +++--------- src/plugins/platforms/wayland/qwaylandwindow_p.h | 2 -- 3 files changed, 3 insertions(+), 13 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandabstractdecoration.cpp b/src/plugins/platforms/wayland/qwaylandabstractdecoration.cpp index e247dbbad4f..e4b81bb8363 100644 --- a/src/plugins/platforms/wayland/qwaylandabstractdecoration.cpp +++ b/src/plugins/platforms/wayland/qwaylandabstractdecoration.cpp @@ -80,7 +80,6 @@ QWaylandAbstractDecorationPrivate::QWaylandAbstractDecorationPrivate() QWaylandAbstractDecorationPrivate::~QWaylandAbstractDecorationPrivate() { - m_wayland_window->setDecoration(0); } QWaylandAbstractDecoration::QWaylandAbstractDecoration() @@ -103,7 +102,6 @@ void QWaylandAbstractDecoration::setWaylandWindow(QWaylandWindow *window) d->m_window = window->window(); d->m_wayland_window = window; - d->m_wayland_window->setDecoration(this); } const QImage &QWaylandAbstractDecoration::contentImage() diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 2fc904aadd1..3b1de7f60c3 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -535,6 +535,9 @@ bool QWaylandWindow::createDecoration() return false; } mWindowDecoration->setWaylandWindow(this); + if (subSurfaceWindow()) { + subSurfaceWindow()->adjustPositionOfChildren(); + } } } else { delete mWindowDecoration; @@ -549,15 +552,6 @@ QWaylandAbstractDecoration *QWaylandWindow::decoration() const return mWindowDecoration; } -// ### can't this go away? we directly set up our decorations, after all -void QWaylandWindow::setDecoration(QWaylandAbstractDecoration *decoration) -{ - mWindowDecoration = decoration; - if (subSurfaceWindow()) { - subSurfaceWindow()->adjustPositionOfChildren(); - } -} - static QWindow *topLevelWindow(QWindow *window) { while (QWindow *parent = window->parent()) diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index c2df0937cd1..6c32bc3ef2f 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -145,8 +145,6 @@ public: void unfocus(); QWaylandAbstractDecoration *decoration() const; - void setDecoration(QWaylandAbstractDecoration *decoration); - void handleMouse(QWaylandInputDevice *inputDevice, ulong timestamp, From 222ed6ba7b9aa67f8f1f9d233be68d69e7b7b254 Mon Sep 17 00:00:00 2001 From: Giulio Camuffo Date: Mon, 22 Sep 2014 16:36:26 +0300 Subject: [PATCH 0185/1507] Use the screen resolution to determine whether a screen is portrait We were using the screen physical size to determine if a screen is portrait or landscape, but we may not always get a valid size. Instead use the screen resolution. The orientation is then calculated in the wl_output.done handler, since we don't know the resolution yet when receiving the first wl_output.geometry event. Change-Id: I3554f916e54db829f49fa3d1ea24f7ce1ff24e7c Reviewed-by: Gunnar Sletta --- .../platforms/wayland/qwaylandscreen.cpp | 52 +++++++++++-------- .../platforms/wayland/qwaylandscreen_p.h | 1 + 2 files changed, 30 insertions(+), 23 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandscreen.cpp b/src/plugins/platforms/wayland/qwaylandscreen.cpp index 88667ae0d4f..5c625ed4231 100644 --- a/src/plugins/platforms/wayland/qwaylandscreen.cpp +++ b/src/plugins/platforms/wayland/qwaylandscreen.cpp @@ -61,6 +61,7 @@ QWaylandScreen::QWaylandScreen(QWaylandDisplay *waylandDisplay, uint32_t id) , mExtendedOutput(0) , mDepth(32) , mRefreshRate(60000) + , mTransform(-1) , mFormat(QImage::Format_ARGB32_Premultiplied) , mOutputName(QStringLiteral("Screen%1").arg(id)) , m_orientation(Qt::PrimaryOrientation) @@ -178,29 +179,7 @@ void QWaylandScreen::output_geometry(int32_t x, int32_t y, Q_UNUSED(subpixel); Q_UNUSED(make); - bool isPortrait = height > width; - switch (transform) { - case WL_OUTPUT_TRANSFORM_NORMAL: - m_orientation = isPortrait ? Qt::PortraitOrientation : Qt::LandscapeOrientation; - break; - case WL_OUTPUT_TRANSFORM_90: - m_orientation = isPortrait ? Qt::InvertedLandscapeOrientation : Qt::PortraitOrientation; - break; - case WL_OUTPUT_TRANSFORM_180: - m_orientation = isPortrait ? Qt::InvertedPortraitOrientation : Qt::InvertedLandscapeOrientation; - break; - case WL_OUTPUT_TRANSFORM_270: - m_orientation = isPortrait ? Qt::LandscapeOrientation : Qt::InvertedPortraitOrientation; - break; - // Ignore these ones, at least for now - case WL_OUTPUT_TRANSFORM_FLIPPED: - case WL_OUTPUT_TRANSFORM_FLIPPED_90: - case WL_OUTPUT_TRANSFORM_FLIPPED_180: - case WL_OUTPUT_TRANSFORM_FLIPPED_270: - break; - } - - QWindowSystemInterface::handleScreenOrientationChange(screen(), m_orientation); + mTransform = transform; if (!model.isEmpty()) mOutputName = model; @@ -214,6 +193,33 @@ void QWaylandScreen::output_done() // the done event is sent after all the geometry and the mode events are sent, // and the last mode event to be sent is the active one, so we can trust the // values of mGeometry and mRefreshRate here + + if (mTransform >= 0) { + bool isPortrait = mGeometry.height() > mGeometry.width(); + switch (mTransform) { + case WL_OUTPUT_TRANSFORM_NORMAL: + m_orientation = isPortrait ? Qt::PortraitOrientation : Qt::LandscapeOrientation; + break; + case WL_OUTPUT_TRANSFORM_90: + m_orientation = isPortrait ? Qt::InvertedLandscapeOrientation : Qt::PortraitOrientation; + break; + case WL_OUTPUT_TRANSFORM_180: + m_orientation = isPortrait ? Qt::InvertedPortraitOrientation : Qt::InvertedLandscapeOrientation; + break; + case WL_OUTPUT_TRANSFORM_270: + m_orientation = isPortrait ? Qt::LandscapeOrientation : Qt::InvertedPortraitOrientation; + break; + // Ignore these ones, at least for now + case WL_OUTPUT_TRANSFORM_FLIPPED: + case WL_OUTPUT_TRANSFORM_FLIPPED_90: + case WL_OUTPUT_TRANSFORM_FLIPPED_180: + case WL_OUTPUT_TRANSFORM_FLIPPED_270: + break; + } + + QWindowSystemInterface::handleScreenOrientationChange(screen(), m_orientation); + mTransform = -1; + } QWindowSystemInterface::handleScreenGeometryChange(screen(), mGeometry, mGeometry); QWindowSystemInterface::handleScreenRefreshRateChange(screen(), refreshRate()); } diff --git a/src/plugins/platforms/wayland/qwaylandscreen_p.h b/src/plugins/platforms/wayland/qwaylandscreen_p.h index 866ac26ea2c..49eeea67142 100644 --- a/src/plugins/platforms/wayland/qwaylandscreen_p.h +++ b/src/plugins/platforms/wayland/qwaylandscreen_p.h @@ -103,6 +103,7 @@ private: QRect mGeometry; int mDepth; int mRefreshRate; + int mTransform; QImage::Format mFormat; QSize mPhysicalSize; QString mOutputName; From 12cc3e6f55ea953b59162a1fa6f65fbcc4b3cd63 Mon Sep 17 00:00:00 2001 From: Giulio Camuffo Date: Sat, 27 Sep 2014 22:00:14 +0300 Subject: [PATCH 0186/1507] Send also repeat key release events We were sending only key press events for the key autorepeat, going out of sync with the release events. Xorg sends both relase and press auto repeat events, do so here too. Change-Id: I41a9bfaff50afea779a7572220f6a01b507e95ac Reviewed-by: Laszlo Agocs --- .../platforms/wayland/qwaylandinputdevice.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index 5198a9e31ea..6ec7b5df411 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -817,6 +817,18 @@ void QWaylandInputDevice::Keyboard::keyboard_key(uint32_t serial, uint32_t time, void QWaylandInputDevice::repeatKey() { mRepeatTimer.setInterval(25); + + QWindowSystemInterface::handleExtendedKeyEvent(mKeyboard->mFocus->window(), + mKeyboard->mRepeatTime, QEvent::KeyRelease, mKeyboard->mRepeatKey, + modifiers(), + mKeyboard->mRepeatCode, +#ifndef QT_NO_WAYLAND_XKB + mKeyboard->mRepeatSym, mKeyboard->mNativeModifiers, +#else + 0, 0, +#endif + mKeyboard->mRepeatText, true); + QWindowSystemInterface::handleExtendedKeyEvent(mKeyboard->mFocus->window(), mKeyboard->mRepeatTime, QEvent::KeyPress, mKeyboard->mRepeatKey, modifiers(), From 1a3d78d81f4a0681ec42bab1706652c14df58bc1 Mon Sep 17 00:00:00 2001 From: Giulio Camuffo Date: Sat, 27 Sep 2014 19:31:58 +0300 Subject: [PATCH 0187/1507] Support the creation of >= 3.x OpenGL contexts Use the EGL_KHR_create_context extension if available to create modern gl contexts. We disable window decorations on core profiles because that mandates a VAO to be used. Change-Id: Id6044e64f6736244ae9d593af4d68c4000a31de6 Reviewed-by: Laszlo Agocs --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 3b1de7f60c3..5786c1fb8ff 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -700,7 +700,6 @@ bool QWaylandWindow::setWindowStateInternal(Qt::WindowState state) // QPlatformWindow::setWindowState returns, so we cannot rely on QWindow::windowState // here. We use then this mState variable. mState = state; - createDecoration(); if (mShellSurface) { switch (state) { From 5984e1e5c1fc9c6e85801888ca318a7194020742 Mon Sep 17 00:00:00 2001 From: Giulio Camuffo Date: Thu, 2 Oct 2014 10:48:09 +0300 Subject: [PATCH 0188/1507] Call ::exit() from the gui thread only ::exit() is not thread safe, so make sure to not call it more than one time, once from the gui thread and once from the wayland event thread. Change-Id: I80905c6d996cb827a5101ae6d6c9bc12a267ba71 Reviewed-by: Robin Burchell --- .../platforms/wayland/qwaylanddisplay.cpp | 18 ++++++++++++++---- .../platforms/wayland/qwaylanddisplay_p.h | 1 + .../platforms/wayland/qwaylandeventthread.cpp | 11 +++++++---- .../platforms/wayland/qwaylandeventthread_p.h | 3 ++- 4 files changed, 24 insertions(+), 9 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index 3eac985f6ed..8649a497c7d 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -149,6 +149,7 @@ QWaylandDisplay::QWaylandDisplay(QWaylandIntegration *waylandIntegration) init(registry); connect(mEventThreadObject, SIGNAL(newEventsRead()), this, SLOT(flushRequests())); + connect(mEventThreadObject, &QWaylandEventThread::fatalError, this, &QWaylandDisplay::exitWithError); mWindowManagerIntegration.reset(new QWaylandWindowManagerIntegration(this)); @@ -167,8 +168,10 @@ QWaylandDisplay::~QWaylandDisplay(void) void QWaylandDisplay::flushRequests() { - if (wl_display_dispatch_queue_pending(mDisplay, mEventQueue) < 0) - mEventThreadObject->checkErrorAndExit(); + if (wl_display_dispatch_queue_pending(mDisplay, mEventQueue) < 0) { + mEventThreadObject->checkError(); + exitWithError(); + } wl_display_flush(mDisplay); } @@ -176,8 +179,15 @@ void QWaylandDisplay::flushRequests() void QWaylandDisplay::blockingReadEvents() { - if (wl_display_dispatch_queue(mDisplay, mEventQueue) < 0) - mEventThreadObject->checkErrorAndExit(); + if (wl_display_dispatch_queue(mDisplay, mEventQueue) < 0) { + mEventThreadObject->checkError(); + exitWithError(); + } +} + +void QWaylandDisplay::exitWithError() +{ + ::exit(1); } QWaylandScreen *QWaylandDisplay::screenForOutput(struct wl_output *output) const diff --git a/src/plugins/platforms/wayland/qwaylanddisplay_p.h b/src/plugins/platforms/wayland/qwaylanddisplay_p.h index b0142004e8b..796c54756e0 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay_p.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay_p.h @@ -164,6 +164,7 @@ public slots: private: void waitForScreens(); + void exitWithError(); struct Listener { RegistryListener listener; diff --git a/src/plugins/platforms/wayland/qwaylandeventthread.cpp b/src/plugins/platforms/wayland/qwaylandeventthread.cpp index b7266765e61..22efd6a2a72 100644 --- a/src/plugins/platforms/wayland/qwaylandeventthread.cpp +++ b/src/plugins/platforms/wayland/qwaylandeventthread.cpp @@ -73,7 +73,7 @@ void QWaylandEventThread::displayConnect() // ### be careful what you do, this function may also be called from other // threads to clean up & exit. -void QWaylandEventThread::checkErrorAndExit() +void QWaylandEventThread::checkError() const { int ecode = wl_display_get_error(m_display); if ((ecode == EPIPE || ecode == ECONNRESET)) { @@ -82,13 +82,16 @@ void QWaylandEventThread::checkErrorAndExit() } else { qErrnoWarning(ecode, "The Wayland connection experienced a fatal error"); } - ::exit(1); } void QWaylandEventThread::readWaylandEvents() { - if (wl_display_dispatch(m_display) < 0) - checkErrorAndExit(); + if (wl_display_dispatch(m_display) < 0) { + checkError(); + m_readNotifier->setEnabled(false); + emit fatalError(); + return; + } emit newEventsRead(); } diff --git a/src/plugins/platforms/wayland/qwaylandeventthread_p.h b/src/plugins/platforms/wayland/qwaylandeventthread_p.h index d51d627b962..2df4b05c2e5 100644 --- a/src/plugins/platforms/wayland/qwaylandeventthread_p.h +++ b/src/plugins/platforms/wayland/qwaylandeventthread_p.h @@ -63,7 +63,7 @@ public: wl_display *display() const; - void checkErrorAndExit(); + void checkError() const; private slots: void readWaylandEvents(); @@ -72,6 +72,7 @@ private slots: signals: void newEventsRead(); + void fatalError(); private: From 5ec3eacefe389403795572200ac6abb18fd20fa6 Mon Sep 17 00:00:00 2001 From: Mikko Levonmaa Date: Thu, 18 Sep 2014 12:32:57 +0300 Subject: [PATCH 0189/1507] Allow client side input device customization Introduces QWaylandInputDeviceIntegration plugins to allow customization of input device related behavior. The plugin can be activated via the environment variable QT_WAYLAND_INPUTDEVICE_INTEGRATION Change-Id: If5629737752afacb29161f51c1b7c6e171fb2758 Reviewed-by: Mikko Levonmaa Reviewed-by: Laszlo Agocs Reviewed-by: Giulio Camuffo --- src/plugins/platforms/wayland/client.pro | 5 +- .../inputdeviceintegration.pri | 11 + .../qwaylandinputdeviceintegration_p.h | 64 ++++ .../qwaylandinputdeviceintegrationfactory.cpp | 96 ++++++ .../qwaylandinputdeviceintegrationfactory_p.h | 61 ++++ .../qwaylandinputdeviceintegrationplugin.cpp | 55 ++++ .../qwaylandinputdeviceintegrationplugin_p.h | 69 ++++ .../platforms/wayland/qwaylanddisplay.cpp | 2 +- .../platforms/wayland/qwaylandinputdevice.cpp | 295 ++++++++---------- .../platforms/wayland/qwaylandinputdevice_p.h | 143 ++++++++- .../platforms/wayland/qwaylandintegration.cpp | 32 ++ .../platforms/wayland/qwaylandintegration_p.h | 9 + 12 files changed, 659 insertions(+), 183 deletions(-) create mode 100644 src/plugins/platforms/wayland/inputdeviceintegration/inputdeviceintegration.pri create mode 100644 src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegration_p.h create mode 100644 src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationfactory.cpp create mode 100644 src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationfactory_p.h create mode 100644 src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationplugin.cpp create mode 100644 src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationplugin_p.h diff --git a/src/plugins/platforms/wayland/client.pro b/src/plugins/platforms/wayland/client.pro index 6aaa2541980..22271ee4512 100644 --- a/src/plugins/platforms/wayland/client.pro +++ b/src/plugins/platforms/wayland/client.pro @@ -3,7 +3,9 @@ QT += core-private gui-private QT_FOR_PRIVATE += platformsupport-private MODULE=waylandclient -MODULE_PLUGIN_TYPES = wayland-graphics-integration-client +MODULE_PLUGIN_TYPES = \ + wayland-graphics-integration-client \ + wayland-inputdevice-integration load(qt_module) @@ -108,3 +110,4 @@ HEADERS += qwaylandintegration_p.h \ include(hardwareintegration/hardwareintegration.pri) include(shellintegration/shellintegration.pri) +include(inputdeviceintegration/inputdeviceintegration.pri) diff --git a/src/plugins/platforms/wayland/inputdeviceintegration/inputdeviceintegration.pri b/src/plugins/platforms/wayland/inputdeviceintegration/inputdeviceintegration.pri new file mode 100644 index 00000000000..f16dfc3c953 --- /dev/null +++ b/src/plugins/platforms/wayland/inputdeviceintegration/inputdeviceintegration.pri @@ -0,0 +1,11 @@ +INCLUDEPATH += $$PWD + +SOURCES += \ + $$PWD/qwaylandinputdeviceintegrationplugin.cpp \ + $$PWD/qwaylandinputdeviceintegrationfactory.cpp + +HEADERS += \ + $$PWD/qwaylandinputdeviceintegration_p.h \ + $$PWD/qwaylandinputdeviceintegrationplugin_p.h \ + $$PWD/qwaylandinputdeviceintegrationfactory_p.h + diff --git a/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegration_p.h b/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegration_p.h new file mode 100644 index 00000000000..255a6685415 --- /dev/null +++ b/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegration_p.h @@ -0,0 +1,64 @@ +/**************************************************************************** +** +** Copyright (C) 2014 LG Electronics Ltd +** Contact: http://www.qt-project.org/legal +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWAYLANDINPUTDEVICEINTEGRATION_H +#define QWAYLANDINPUTDEVICEINTEGRATION_H + +#include +#include + +QT_BEGIN_NAMESPACE + +class QWaylandDisplay; +class QWaylandInputDevice; + +class Q_WAYLAND_CLIENT_EXPORT QWaylandInputDeviceIntegration +{ +public: + QWaylandInputDeviceIntegration() {} + virtual ~QWaylandInputDeviceIntegration() {} + + virtual QWaylandInputDevice *createInputDevice(QWaylandDisplay *d, uint32_t id) = 0; +}; + +QT_END_NAMESPACE + +#endif // QWAYLANDINPUTDEVICEINTEGRATION_H diff --git a/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationfactory.cpp b/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationfactory.cpp new file mode 100644 index 00000000000..58a82fb2c3a --- /dev/null +++ b/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationfactory.cpp @@ -0,0 +1,96 @@ +/**************************************************************************** +** +** Copyright (C) 2014 LG Electronics Ltd +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qwaylandinputdeviceintegrationfactory_p.h" +#include "qwaylandinputdeviceintegrationplugin_p.h" +#include "qwaylandinputdeviceintegration_p.h" +#include +#include +#include + +QT_BEGIN_NAMESPACE + +#ifndef QT_NO_LIBRARY +Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader, + (QWaylandInputDeviceIntegrationFactoryInterface_iid, QLatin1String("/wayland-inputdevice-integration"), Qt::CaseInsensitive)) +Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, directLoader, + (QWaylandInputDeviceIntegrationFactoryInterface_iid, QLatin1String(""), Qt::CaseInsensitive)) +#endif + +QStringList QWaylandInputDeviceIntegrationFactory::keys(const QString &pluginPath) +{ +#ifndef QT_NO_LIBRARY + QStringList list; + if (!pluginPath.isEmpty()) { + QCoreApplication::addLibraryPath(pluginPath); + list = directLoader()->keyMap().values(); + if (!list.isEmpty()) { + const QString postFix = QStringLiteral(" (from ") + + QDir::toNativeSeparators(pluginPath) + + QLatin1Char(')'); + const QStringList::iterator end = list.end(); + for (QStringList::iterator it = list.begin(); it != end; ++it) + (*it).append(postFix); + } + } + list.append(loader()->keyMap().values()); + return list; +#else + return QStringList(); +#endif +} + +QWaylandInputDeviceIntegration *QWaylandInputDeviceIntegrationFactory::create(const QString &name, const QStringList &args, const QString &pluginPath) +{ +#ifndef QT_NO_LIBRARY + // Try loading the plugin from platformPluginPath first: + if (!pluginPath.isEmpty()) { + QCoreApplication::addLibraryPath(pluginPath); + if (QWaylandInputDeviceIntegration *ret = qLoadPlugin1(directLoader(), name, args)) + return ret; + } + if (QWaylandInputDeviceIntegration *ret = qLoadPlugin1(loader(), name, args)) + return ret; +#endif + return Q_NULLPTR; +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationfactory_p.h b/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationfactory_p.h new file mode 100644 index 00000000000..13cddc24f04 --- /dev/null +++ b/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationfactory_p.h @@ -0,0 +1,61 @@ +/**************************************************************************** +** +** Copyright (C) 2014 LG Electronics Ltd +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWAYLANDINPUTDEVICEINTEGRATIONFACTORY_H +#define QWAYLANDINPUTDEVICEINTEGRATIONFACTORY_H + +#include +#include + +QT_BEGIN_NAMESPACE + +class QWaylandInputDeviceIntegration; + +class Q_WAYLAND_CLIENT_EXPORT QWaylandInputDeviceIntegrationFactory +{ +public: + static QStringList keys(const QString &pluginPath = QString()); + static QWaylandInputDeviceIntegration *create(const QString &name, const QStringList &args, const QString &pluginPath = QString()); +}; + +QT_END_NAMESPACE + +#endif // QWAYLANDINPUTDEVICENTEGRATIONFACTORY_H diff --git a/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationplugin.cpp b/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationplugin.cpp new file mode 100644 index 00000000000..71a9332540d --- /dev/null +++ b/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationplugin.cpp @@ -0,0 +1,55 @@ +/**************************************************************************** +** +** Copyright (C) 2014 LG Electronics Ltd +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qwaylandinputdeviceintegrationplugin_p.h" + +QT_BEGIN_NAMESPACE + +QWaylandInputDeviceIntegrationPlugin::QWaylandInputDeviceIntegrationPlugin(QObject *parent) + : QObject(parent) +{ +} + +QWaylandInputDeviceIntegrationPlugin::~QWaylandInputDeviceIntegrationPlugin() +{ +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationplugin_p.h b/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationplugin_p.h new file mode 100644 index 00000000000..a0a062f4c3e --- /dev/null +++ b/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationplugin_p.h @@ -0,0 +1,69 @@ +/**************************************************************************** +** +** Copyright (C) 2014 LG Electronics Ltd +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWAYLANDINPUTDEVICEINTEGRATIONPLUGIN_H +#define QWAYLANDINPUTDEVICEINTEGRATIONPLUGIN_H + +#include + +#include +#include +#include + +QT_BEGIN_NAMESPACE + +class QWaylandInputDeviceIntegration; + +#define QWaylandInputDeviceIntegrationFactoryInterface_iid "org.qt-project.Qt.WaylandClient.QWaylandInputDeviceIntegrationFactoryInterface.5.3" + +class Q_WAYLAND_CLIENT_EXPORT QWaylandInputDeviceIntegrationPlugin : public QObject +{ + Q_OBJECT +public: + explicit QWaylandInputDeviceIntegrationPlugin(QObject *parent = 0); + ~QWaylandInputDeviceIntegrationPlugin(); + + virtual QWaylandInputDeviceIntegration *create(const QString &key, const QStringList ¶mList) = 0; +}; + +QT_END_NAMESPACE + +#endif // QWAYLANDINPUTDEVICEINTEGRATIONPLUGIN_H diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index edaac8fed79..c4a702d74a8 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -241,7 +241,7 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin } else if (interface == QStringLiteral("wl_shell")){ mShell.reset(new QtWayland::wl_shell(registry, id, 1)); } else if (interface == QStringLiteral("wl_seat")) { - QWaylandInputDevice *inputDevice = new QWaylandInputDevice(this, id); + QWaylandInputDevice *inputDevice = mWaylandIntegration->createInputDevice(this, id); mInputDevices.append(inputDevice); } else if (interface == QStringLiteral("wl_data_device_manager")) { mDndSelectionHandler.reset(new QWaylandDataDeviceManager(this, id)); diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index 5198a9e31ea..4f72d6146e8 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -63,170 +63,99 @@ #include -#ifndef QT_NO_WAYLAND_XKB -#include -#include -#endif - QT_BEGIN_NAMESPACE -class QWaylandInputDevice::Keyboard : public QtWayland::wl_keyboard -{ -public: - Keyboard(QWaylandInputDevice *p) - : mParent(p) - , mFocus(0) +QWaylandInputDevice::Keyboard::Keyboard(QWaylandInputDevice *p) + : mParent(p) + , mFocus(0) #ifndef QT_NO_WAYLAND_XKB - , mXkbContext(0) - , mXkbMap(0) - , mXkbState(0) + , mXkbContext(0) + , mXkbMap(0) + , mXkbState(0) #endif - , mFocusCallback(0) - , mNativeModifiers(0) - { -#ifndef QT_NO_WAYLAND_XKB - xkb_rule_names names; - names.rules = strdup("evdev"); - names.model = strdup("pc105"); - names.layout = strdup("us"); - names.variant = strdup(""); - names.options = strdup(""); + , mFocusCallback(0) + , mNativeModifiers(0) +{ + connect(&mRepeatTimer, SIGNAL(timeout()), this, SLOT(repeatKey())); +} - mXkbContext = xkb_context_new(xkb_context_flags(0)); - if (mXkbContext) { - mXkbMap = xkb_map_new_from_names(mXkbContext, &names, xkb_map_compile_flags(0)); - if (mXkbMap) { - mXkbState = xkb_state_new(mXkbMap); - } +#ifndef QT_NO_WAYLAND_XKB +bool QWaylandInputDevice::Keyboard::createDefaultKeyMap() +{ + if (mXkbContext && mXkbMap && mXkbState) { + return true; + } + + xkb_rule_names names; + names.rules = strdup("evdev"); + names.model = strdup("pc105"); + names.layout = strdup("us"); + names.variant = strdup(""); + names.options = strdup(""); + + mXkbContext = xkb_context_new(xkb_context_flags(0)); + if (mXkbContext) { + mXkbMap = xkb_map_new_from_names(mXkbContext, &names, xkb_map_compile_flags(0)); + if (mXkbMap) { + mXkbState = xkb_state_new(mXkbMap); } - - if (!mXkbContext || !mXkbMap || !mXkbState) - qWarning() << "xkb_map_new_from_names failed, no key input"; -#endif - } - ~Keyboard() - { -#ifndef QT_NO_WAYLAND_XKB - if (mXkbState) - xkb_state_unref(mXkbState); - if (mXkbMap) - xkb_map_unref(mXkbMap); - if (mXkbContext) - xkb_context_unref(mXkbContext); -#endif - wl_keyboard_destroy(object()); } - void keyboard_keymap(uint32_t format, - int32_t fd, - uint32_t size) Q_DECL_OVERRIDE; - void keyboard_enter(uint32_t time, - struct wl_surface *surface, - struct wl_array *keys) Q_DECL_OVERRIDE; - void keyboard_leave(uint32_t time, - struct wl_surface *surface) Q_DECL_OVERRIDE; - void keyboard_key(uint32_t serial, uint32_t time, - uint32_t key, uint32_t state) Q_DECL_OVERRIDE; - void keyboard_modifiers(uint32_t serial, - uint32_t mods_depressed, - uint32_t mods_latched, - uint32_t mods_locked, - uint32_t group) Q_DECL_OVERRIDE; + if (!mXkbContext || !mXkbMap || !mXkbState) { + qWarning() << "xkb_map_new_from_names failed, no key input"; + return false; + } + return true; +} - QWaylandInputDevice *mParent; - QWaylandWindow *mFocus; -#ifndef QT_NO_WAYLAND_XKB - xkb_context *mXkbContext; - xkb_keymap *mXkbMap; - xkb_state *mXkbState; -#endif - struct wl_callback *mFocusCallback; - uint32_t mNativeModifiers; - - int mRepeatKey; - uint32_t mRepeatCode; - uint32_t mRepeatTime; - QString mRepeatText; -#ifndef QT_NO_WAYLAND_XKB - xkb_keysym_t mRepeatSym; -#endif - - static const wl_callback_listener callback; - static void focusCallback(void *data, struct wl_callback *callback, uint32_t time); -}; - -class QWaylandInputDevice::Pointer : public QtWayland::wl_pointer +void QWaylandInputDevice::Keyboard::releaseKeyMap() { -public: - Pointer(QWaylandInputDevice *p) - : mParent(p) - , mFocus(0) - , mEnterSerial(0) - , mCursorSerial(0) - , mButtons(0) - { - } - ~Pointer() - { - wl_pointer_destroy(object()); - } + if (mXkbState) + xkb_state_unref(mXkbState); + if (mXkbMap) + xkb_map_unref(mXkbMap); + if (mXkbContext) + xkb_context_unref(mXkbContext); +} +#endif - void pointer_enter(uint32_t serial, struct wl_surface *surface, - wl_fixed_t sx, wl_fixed_t sy) Q_DECL_OVERRIDE; - void pointer_leave(uint32_t time, struct wl_surface *surface); - void pointer_motion(uint32_t time, - wl_fixed_t sx, wl_fixed_t sy) Q_DECL_OVERRIDE; - void pointer_button(uint32_t serial, uint32_t time, - uint32_t button, uint32_t state) Q_DECL_OVERRIDE; - void pointer_axis(uint32_t time, - uint32_t axis, - wl_fixed_t value) Q_DECL_OVERRIDE; - - QWaylandInputDevice *mParent; - QWaylandWindow *mFocus; - uint32_t mEnterSerial; - uint32_t mCursorSerial; - QPointF mSurfacePos; - QPointF mGlobalPos; - Qt::MouseButtons mButtons; -}; - -class QWaylandInputDevice::Touch : public QtWayland::wl_touch +QWaylandInputDevice::Keyboard::~Keyboard() { -public: - Touch(QWaylandInputDevice *p) - : mParent(p) - , mFocus(0) - { - } - ~Touch() - { - wl_touch_destroy(object()); - } +#ifndef QT_NO_WAYLAND_XKB + releaseKeyMap(); +#endif + wl_keyboard_destroy(object()); +} - void touch_down(uint32_t serial, - uint32_t time, - struct wl_surface *surface, - int32_t id, - wl_fixed_t x, - wl_fixed_t y) Q_DECL_OVERRIDE; - void touch_up(uint32_t serial, - uint32_t time, - int32_t id) Q_DECL_OVERRIDE; - void touch_motion(uint32_t time, - int32_t id, - wl_fixed_t x, - wl_fixed_t y) Q_DECL_OVERRIDE; - void touch_frame() Q_DECL_OVERRIDE; - void touch_cancel() Q_DECL_OVERRIDE; +void QWaylandInputDevice::Keyboard::stopRepeat() +{ + mRepeatTimer.stop(); +} - bool allTouchPointsReleased(); +QWaylandInputDevice::Pointer::Pointer(QWaylandInputDevice *p) + : mParent(p) + , mFocus(0) + , mEnterSerial(0) + , mCursorSerial(0) + , mButtons(0) +{ +} - QWaylandInputDevice *mParent; - QWaylandWindow *mFocus; - QList mTouchPoints; - QList mPrevTouchPoints; -}; +QWaylandInputDevice::Pointer::~Pointer() +{ + wl_pointer_destroy(object()); +} + +QWaylandInputDevice::Touch::Touch(QWaylandInputDevice *p) + : mParent(p) + , mFocus(0) +{ +} + +QWaylandInputDevice::Touch::~Touch() +{ + wl_touch_destroy(object()); +} QWaylandInputDevice::QWaylandInputDevice(QWaylandDisplay *display, uint32_t id) : QObject() @@ -246,7 +175,6 @@ QWaylandInputDevice::QWaylandInputDevice(QWaylandDisplay *display, uint32_t id) mDataDevice = mQDisplay->dndSelectionHandler()->getDataDevice(this); } - connect(&mRepeatTimer, SIGNAL(timeout()), this, SLOT(repeatKey())); } QWaylandInputDevice::~QWaylandInputDevice() @@ -261,16 +189,15 @@ void QWaylandInputDevice::seat_capabilities(uint32_t caps) mCaps = caps; if (caps & WL_SEAT_CAPABILITY_KEYBOARD && !mKeyboard) { - mKeyboard = new Keyboard(this); + mKeyboard = createKeyboard(this); mKeyboard->init(get_keyboard()); } else if (!(caps & WL_SEAT_CAPABILITY_KEYBOARD) && mKeyboard) { delete mKeyboard; mKeyboard = 0; - mRepeatTimer.stop(); } if (caps & WL_SEAT_CAPABILITY_POINTER && !mPointer) { - mPointer = new Pointer(this); + mPointer = createPointer(this); mPointer->init(get_pointer()); pointerSurface = mQDisplay->createSurface(this); } else if (!(caps & WL_SEAT_CAPABILITY_POINTER) && mPointer) { @@ -279,7 +206,7 @@ void QWaylandInputDevice::seat_capabilities(uint32_t caps) } if (caps & WL_SEAT_CAPABILITY_TOUCH && !mTouch) { - mTouch = new Touch(this); + mTouch = createTouch(this); mTouch->init(get_touch()); if (!mTouchDevice) { @@ -294,13 +221,28 @@ void QWaylandInputDevice::seat_capabilities(uint32_t caps) } } +QWaylandInputDevice::Keyboard *QWaylandInputDevice::createKeyboard(QWaylandInputDevice *device) +{ + return new Keyboard(device); +} + +QWaylandInputDevice::Pointer *QWaylandInputDevice::createPointer(QWaylandInputDevice *device) +{ + return new Pointer(device); +} + +QWaylandInputDevice::Touch *QWaylandInputDevice::createTouch(QWaylandInputDevice *device) +{ + return new Touch(device); +} + void QWaylandInputDevice::handleWindowDestroyed(QWaylandWindow *window) { if (mPointer && window == mPointer->mFocus) mPointer->mFocus = 0; if (mKeyboard && window == mKeyboard->mFocus) { mKeyboard->mFocus = 0; - mRepeatTimer.stop(); + mKeyboard->stopRepeat(); } } @@ -341,20 +283,25 @@ Qt::KeyboardModifiers QWaylandInputDevice::modifiers() const if (!mKeyboard) return Qt::NoModifier; + return mKeyboard->modifiers(); +} + +Qt::KeyboardModifiers QWaylandInputDevice::Keyboard::modifiers() const +{ Qt::KeyboardModifiers ret = Qt::NoModifier; #ifndef QT_NO_WAYLAND_XKB xkb_state_component cstate = static_cast(XKB_STATE_DEPRESSED | XKB_STATE_LATCHED); - if (xkb_state_mod_name_is_active(mKeyboard->mXkbState, "Shift", cstate)) + if (xkb_state_mod_name_is_active(mXkbState, "Shift", cstate)) ret |= Qt::ShiftModifier; - if (xkb_state_mod_name_is_active(mKeyboard->mXkbState, "Control", cstate)) + if (xkb_state_mod_name_is_active(mXkbState, "Control", cstate)) ret |= Qt::ControlModifier; - if (xkb_state_mod_name_is_active(mKeyboard->mXkbState, "Alt", cstate)) + if (xkb_state_mod_name_is_active(mXkbState, "Alt", cstate)) ret |= Qt::AltModifier; - if (xkb_state_mod_name_is_active(mKeyboard->mXkbState, "Mod1", cstate)) + if (xkb_state_mod_name_is_active(mXkbState, "Mod1", cstate)) ret |= Qt::AltModifier; - if (xkb_state_mod_name_is_active(mKeyboard->mXkbState, "Mod4", cstate)) + if (xkb_state_mod_name_is_active(mXkbState, "Mod4", cstate)) ret |= Qt::MetaModifier; #endif @@ -682,6 +629,11 @@ void QWaylandInputDevice::Keyboard::keyboard_keymap(uint32_t format, int32_t fd, return; } + // Release the old keymap resources in the case they were already created in + // the key event or when the compositor issues a new map + releaseKeyMap(); + + mXkbContext = xkb_context_new(xkb_context_flags(0)); mXkbMap = xkb_map_new_from_string(mXkbContext, map_str, XKB_KEYMAP_FORMAT_TEXT_V1, (xkb_keymap_compile_flags)0); munmap(map_str, size); close(fd); @@ -731,7 +683,7 @@ void QWaylandInputDevice::Keyboard::keyboard_leave(uint32_t time, struct wl_surf mFocusCallback = wl_display_sync(mParent->mDisplay); wl_callback_add_listener(mFocusCallback, &QWaylandInputDevice::Keyboard::callback, this); } - mParent->mRepeatTimer.stop(); + mRepeatTimer.stop(); } const wl_callback_listener QWaylandInputDevice::Keyboard::callback = { @@ -769,8 +721,9 @@ void QWaylandInputDevice::Keyboard::keyboard_key(uint32_t serial, uint32_t time, } #ifndef QT_NO_WAYLAND_XKB - if (!mXkbMap) + if (!createDefaultKeyMap()) { return; + } const xkb_keysym_t sym = xkb_state_key_get_one_sym(mXkbState, code); xkb_state_update_key(mXkbState, code, isDown ? XKB_KEY_DOWN : XKB_KEY_UP); @@ -807,26 +760,26 @@ void QWaylandInputDevice::Keyboard::keyboard_key(uint32_t serial, uint32_t time, #ifndef QT_NO_WAYLAND_XKB mRepeatSym = sym; #endif - mParent->mRepeatTimer.setInterval(400); - mParent->mRepeatTimer.start(); + mRepeatTimer.setInterval(400); + mRepeatTimer.start(); } else if (mRepeatCode == code) { - mParent->mRepeatTimer.stop(); + mRepeatTimer.stop(); } } -void QWaylandInputDevice::repeatKey() +void QWaylandInputDevice::Keyboard::repeatKey() { mRepeatTimer.setInterval(25); - QWindowSystemInterface::handleExtendedKeyEvent(mKeyboard->mFocus->window(), - mKeyboard->mRepeatTime, QEvent::KeyPress, mKeyboard->mRepeatKey, + QWindowSystemInterface::handleExtendedKeyEvent(mFocus->window(), + mRepeatTime, QEvent::KeyPress, mRepeatKey, modifiers(), - mKeyboard->mRepeatCode, + mRepeatCode, #ifndef QT_NO_WAYLAND_XKB - mKeyboard->mRepeatSym, mKeyboard->mNativeModifiers, + mRepeatSym, mNativeModifiers, #else 0, 0, #endif - mKeyboard->mRepeatText, true); + mRepeatText, true); } void QWaylandInputDevice::Keyboard::keyboard_modifiers(uint32_t serial, diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h index 23e1fc74099..0c6ecfb640d 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h +++ b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h @@ -56,15 +56,17 @@ #include #ifndef QT_NO_WAYLAND_XKB -struct xkb_context; -struct xkb_keymap; -struct xkb_state; +#include +#include #endif +#include + struct wl_cursor_image; QT_BEGIN_NAMESPACE + class QWaylandWindow; class QWaylandDisplay; class QWaylandDataDevice; @@ -75,6 +77,10 @@ class Q_WAYLAND_CLIENT_EXPORT QWaylandInputDevice { Q_OBJECT public: + class Keyboard; + class Pointer; + class Touch; + QWaylandInputDevice(QWaylandDisplay *display, uint32_t id); ~QWaylandInputDevice(); @@ -100,14 +106,11 @@ public: uint32_t serial() const; uint32_t cursorSerial() const; -private slots: - void repeatKey(); + virtual Keyboard *createKeyboard(QWaylandInputDevice *device); + virtual Pointer *createPointer(QWaylandInputDevice *device); + virtual Touch *createTouch(QWaylandInputDevice *device); private: - class Keyboard; - class Pointer; - class Touch; - QWaylandDisplay *mQDisplay; struct wl_display *mDisplay; @@ -123,7 +126,6 @@ private: uint32_t mTime; uint32_t mSerial; - QTimer mRepeatTimer; void seat_capabilities(uint32_t caps) Q_DECL_OVERRIDE; void handleTouchPoint(int id, double x, double y, Qt::TouchPointState state); @@ -139,6 +141,127 @@ inline uint32_t QWaylandInputDevice::serial() const return mSerial; } + +class Q_WAYLAND_CLIENT_EXPORT QWaylandInputDevice::Keyboard : public QObject, public QtWayland::wl_keyboard +{ + Q_OBJECT + +public: + Keyboard(QWaylandInputDevice *p); + virtual ~Keyboard(); + + void stopRepeat(); + + void keyboard_keymap(uint32_t format, + int32_t fd, + uint32_t size) Q_DECL_OVERRIDE; + void keyboard_enter(uint32_t time, + struct wl_surface *surface, + struct wl_array *keys) Q_DECL_OVERRIDE; + void keyboard_leave(uint32_t time, + struct wl_surface *surface) Q_DECL_OVERRIDE; + void keyboard_key(uint32_t serial, uint32_t time, + uint32_t key, uint32_t state) Q_DECL_OVERRIDE; + void keyboard_modifiers(uint32_t serial, + uint32_t mods_depressed, + uint32_t mods_latched, + uint32_t mods_locked, + uint32_t group) Q_DECL_OVERRIDE; + + QWaylandInputDevice *mParent; + QWaylandWindow *mFocus; +#ifndef QT_NO_WAYLAND_XKB + xkb_context *mXkbContext; + xkb_keymap *mXkbMap; + xkb_state *mXkbState; +#endif + struct wl_callback *mFocusCallback; + uint32_t mNativeModifiers; + + int mRepeatKey; + uint32_t mRepeatCode; + uint32_t mRepeatTime; + QString mRepeatText; +#ifndef QT_NO_WAYLAND_XKB + xkb_keysym_t mRepeatSym; +#endif + QTimer mRepeatTimer; + + static const wl_callback_listener callback; + static void focusCallback(void *data, struct wl_callback *callback, uint32_t time); + + Qt::KeyboardModifiers modifiers() const; + +private slots: + void repeatKey(); + +private: +#ifndef QT_NO_WAYLAND_XKB + bool createDefaultKeyMap(); + void releaseKeyMap(); +#endif + +}; + +class Q_WAYLAND_CLIENT_EXPORT QWaylandInputDevice::Pointer : public QtWayland::wl_pointer +{ + +public: + Pointer(QWaylandInputDevice *p); + virtual ~Pointer(); + + void pointer_enter(uint32_t serial, struct wl_surface *surface, + wl_fixed_t sx, wl_fixed_t sy) Q_DECL_OVERRIDE; + void pointer_leave(uint32_t time, struct wl_surface *surface); + void pointer_motion(uint32_t time, + wl_fixed_t sx, wl_fixed_t sy) Q_DECL_OVERRIDE; + void pointer_button(uint32_t serial, uint32_t time, + uint32_t button, uint32_t state) Q_DECL_OVERRIDE; + void pointer_axis(uint32_t time, + uint32_t axis, + wl_fixed_t value) Q_DECL_OVERRIDE; + + QWaylandInputDevice *mParent; + QWaylandWindow *mFocus; + uint32_t mEnterSerial; + uint32_t mCursorSerial; + QPointF mSurfacePos; + QPointF mGlobalPos; + Qt::MouseButtons mButtons; +}; + +class Q_WAYLAND_CLIENT_EXPORT QWaylandInputDevice::Touch : public QtWayland::wl_touch +{ +public: + Touch(QWaylandInputDevice *p); + virtual ~Touch(); + + void touch_down(uint32_t serial, + uint32_t time, + struct wl_surface *surface, + int32_t id, + wl_fixed_t x, + wl_fixed_t y) Q_DECL_OVERRIDE; + void touch_up(uint32_t serial, + uint32_t time, + int32_t id) Q_DECL_OVERRIDE; + void touch_motion(uint32_t time, + int32_t id, + wl_fixed_t x, + wl_fixed_t y) Q_DECL_OVERRIDE; + void touch_frame() Q_DECL_OVERRIDE; + void touch_cancel() Q_DECL_OVERRIDE; + + bool allTouchPointsReleased(); + + QWaylandInputDevice *mParent; + QWaylandWindow *mFocus; + QList mTouchPoints; + QList mPrevTouchPoints; +}; + + + QT_END_NAMESPACE #endif diff --git a/src/plugins/platforms/wayland/qwaylandintegration.cpp b/src/plugins/platforms/wayland/qwaylandintegration.cpp index d9bf82e4f98..ad99c67b9f3 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandintegration.cpp @@ -43,6 +43,7 @@ #include "qwaylanddisplay_p.h" #include "qwaylandshmwindow_p.h" +#include "qwaylandinputdevice_p.h" #include "qwaylandinputcontext_p.h" #include "qwaylandshmbackingstore_p.h" #include "qwaylandnativeinterface_p.h" @@ -76,6 +77,9 @@ #include "qwaylandshellintegration_p.h" #include "qwaylandshellintegrationfactory_p.h" +#include "qwaylandinputdeviceintegration_p.h" +#include "qwaylandinputdeviceintegrationfactory_p.h" + QT_BEGIN_NAMESPACE class GenericWaylandTheme: public QGenericUnixTheme @@ -113,6 +117,7 @@ public: QWaylandIntegration::QWaylandIntegration() : mClientBufferIntegration(0) , mShellIntegration(Q_NULLPTR) + , mInputDeviceIntegration(Q_NULLPTR) , mFontDb(new QGenericUnixFontDatabase()) , mNativeInterface(new QWaylandNativeInterface(this)) #ifndef QT_NO_ACCESSIBILITY @@ -124,6 +129,7 @@ QWaylandIntegration::QWaylandIntegration() , mServerBufferIntegrationInitialized(false) , mShellIntegrationInitialized(false) { + initializeInputDeviceIntegration(); mDisplay = new QWaylandDisplay(this); mClipboard = new QWaylandClipboard(mDisplay); mDrag = new QWaylandDrag(mDisplay); @@ -361,4 +367,30 @@ void QWaylandIntegration::initializeShellIntegration() } } +QWaylandInputDevice *QWaylandIntegration::createInputDevice(QWaylandDisplay *display, uint32_t id) +{ + if (mInputDeviceIntegration) { + return mInputDeviceIntegration->createInputDevice(display, id); + } + return new QWaylandInputDevice(display, id); +} + +void QWaylandIntegration::initializeInputDeviceIntegration() +{ + QByteArray integrationName = qgetenv("QT_WAYLAND_INPUTDEVICE_INTEGRATION"); + QString targetKey = QString::fromLocal8Bit(integrationName); + + if (targetKey.isEmpty()) { + return; + } + + QStringList keys = QWaylandInputDeviceIntegrationFactory::keys(); + if (keys.contains(targetKey)) { + mInputDeviceIntegration = QWaylandInputDeviceIntegrationFactory::create(targetKey, QStringList()); + qDebug("Using the '%s' input device integration", qPrintable(targetKey)); + } else { + qWarning("Wayland inputdevice integration '%s' not found, using default", qPrintable(targetKey)); + } +} + QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandintegration_p.h b/src/plugins/platforms/wayland/qwaylandintegration_p.h index bbe98285389..9741b1a786d 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration_p.h +++ b/src/plugins/platforms/wayland/qwaylandintegration_p.h @@ -52,6 +52,8 @@ class QWaylandDisplay; class QWaylandClientBufferIntegration; class QWaylandServerBufferIntegration; class QWaylandShellIntegration; +class QWaylandInputDeviceIntegration; +class QWaylandInputDevice; class Q_WAYLAND_CLIENT_EXPORT QWaylandIntegration : public QPlatformIntegration { @@ -89,17 +91,24 @@ public: QPlatformTheme *createPlatformTheme(const QString &name) const; + QWaylandInputDevice *createInputDevice(QWaylandDisplay *display, uint32_t id); + virtual QWaylandClientBufferIntegration *clientBufferIntegration() const; virtual QWaylandServerBufferIntegration *serverBufferIntegration() const; virtual QWaylandShellIntegration *shellIntegration() const; + protected: QWaylandClientBufferIntegration *mClientBufferIntegration; QWaylandServerBufferIntegration *mServerBufferIntegration; QWaylandShellIntegration *mShellIntegration; + QWaylandInputDeviceIntegration *mInputDeviceIntegration; + private: void initializeClientBufferIntegration(); void initializeServerBufferIntegration(); void initializeShellIntegration(); + void initializeInputDeviceIntegration(); + QPlatformFontDatabase *mFontDb; QPlatformClipboard *mClipboard; QPlatformDrag *mDrag; From 1ed546004cc082d211cfcdd5e2c2179623af4a53 Mon Sep 17 00:00:00 2001 From: Giulio Camuffo Date: Mon, 6 Oct 2014 11:05:23 +0300 Subject: [PATCH 0190/1507] Fix shm windows sometimes not showing after being hidden MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit QWaylandShmBackingStore installs a frame callback on flush, and subsequent flushes will not attach a new buffer until the callback is fired. If the window is hidden while we're waiting for the callback, we attach a NULL buffer, so the compositor will not redraw the surface and will not fire the frame callback. When showing the window again the backing store's flush() will wait indefinitely for the frame callback to attach its buffer. To fix it destroy the frame callback when the window is hidden. This was easily noticeable when fast switching between popup menus. Change-Id: Ic0c71ed79e2fab9faf452f63b05bc4576ea9a3ba Reviewed-by: Jørgen Lind --- .../platforms/wayland/qwaylandshmbackingstore.cpp | 11 +++++++++++ .../platforms/wayland/qwaylandshmbackingstore_p.h | 1 + src/plugins/platforms/wayland/qwaylandwindow.cpp | 5 +++++ 3 files changed, 17 insertions(+) diff --git a/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp b/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp index 421fae91c6b..332ea9265d5 100644 --- a/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp +++ b/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp @@ -140,6 +140,9 @@ QWaylandShmBackingStore::QWaylandShmBackingStore(QWindow *window) QWaylandShmBackingStore::~QWaylandShmBackingStore() { + if (QWaylandWindow *w = waylandWindow()) + w->setBackingStore(Q_NULLPTR); + if (mFrameCallback) wl_callback_destroy(mFrameCallback); @@ -175,6 +178,14 @@ void QWaylandShmBackingStore::endPaint() waylandWindow()->setCanResize(true); } +void QWaylandShmBackingStore::hidden() +{ + if (mFrameCallback) { + wl_callback_destroy(mFrameCallback); + mFrameCallback = Q_NULLPTR; + } +} + void QWaylandShmBackingStore::ensureSize() { waylandWindow()->setBackingStore(this); diff --git a/src/plugins/platforms/wayland/qwaylandshmbackingstore_p.h b/src/plugins/platforms/wayland/qwaylandshmbackingstore_p.h index 5c3dbb5bc27..319acd9a982 100644 --- a/src/plugins/platforms/wayland/qwaylandshmbackingstore_p.h +++ b/src/plugins/platforms/wayland/qwaylandshmbackingstore_p.h @@ -82,6 +82,7 @@ public: void resize(const QSize &size); void beginPaint(const QRegion &); void endPaint(); + void hidden(); QWaylandAbstractDecoration *windowDecoration() const; diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 5786c1fb8ff..d1ea6c1f979 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -54,6 +54,7 @@ #include "qwaylandwindowmanagerintegration_p.h" #include "qwaylandnativeinterface_p.h" #include "qwaylanddecorationfactory_p.h" +#include "qwaylandshmbackingstore_p.h" #include #include @@ -90,6 +91,7 @@ QWaylandWindow::QWaylandWindow(QWindow *window) , mMouseDevice(0) , mMouseSerial(0) , mState(Qt::WindowNoState) + , mBackingStore(Q_NULLPTR) { init(mDisplay->createSurface(static_cast(this))); @@ -248,6 +250,9 @@ void QWaylandWindow::setVisible(bool visible) if (!deleteGuard.isNull()) { attach(static_cast(0), 0, 0); commit(); + if (mBackingStore) { + mBackingStore->hidden(); + } } } } From 838501541adb9b6fdd7e2e8ba678c91e073f7892 Mon Sep 17 00:00:00 2001 From: Giulio Camuffo Date: Tue, 30 Sep 2014 17:09:49 +0300 Subject: [PATCH 0191/1507] Fix the compositor's wayland versioning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We cannot just assume all clients implement the same version of the various interfaces as the compositor does. Keep track of them, and react accordingly when creating a resource or sending an event. Change-Id: I9792433a14d49c5c4df0c892fc1349ce0dfb0d43 Reviewed-by: Jørgen Lind --- .../qtwaylandscanner/qtwaylandscanner.cpp | 51 ++++++++++--------- tests/auto/wayland/mockcompositor.cpp | 2 +- tests/auto/wayland/mockinput.cpp | 10 ++-- tests/auto/wayland/mocksurface.cpp | 4 +- tests/auto/wayland/mocksurface.h | 2 +- 5 files changed, 36 insertions(+), 33 deletions(-) diff --git a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp index c99bf2b4815..ae5ec40db2e 100644 --- a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp +++ b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp @@ -416,8 +416,8 @@ void process(QXmlStreamReader &xml, const QByteArray &headerPath, const QByteArr printf(" class %s %s\n {\n", serverExport.constData(), interfaceName); printf(" public:\n"); - printf(" %s(struct ::wl_client *client, int id);\n", interfaceName); - printf(" %s(struct ::wl_display *display);\n", interfaceName); + printf(" %s(struct ::wl_client *client, int id, int version);\n", interfaceName); + printf(" %s(struct ::wl_display *display, int version);\n", interfaceName); printf(" %s();\n", interfaceName); printf("\n"); printf(" virtual ~%s();\n", interfaceName); @@ -432,16 +432,17 @@ void process(QXmlStreamReader &xml, const QByteArray &headerPath, const QByteArr printf(" struct ::wl_resource *handle;\n"); printf("\n"); printf(" struct ::wl_client *client() const { return handle->client; }\n"); + printf(" int version() const { return wl_resource_get_version(handle); }\n"); printf("\n"); printf(" static Resource *fromResource(struct ::wl_resource *resource) { return static_cast(resource->data); }\n"); printf(" };\n"); printf("\n"); - printf(" void init(struct ::wl_client *client, int id);\n"); - printf(" void init(struct ::wl_display *display);\n"); + printf(" void init(struct ::wl_client *client, int id, int version);\n"); + printf(" void init(struct ::wl_display *display, int version);\n"); printf("\n"); - printf(" Resource *add(struct ::wl_client *client);\n"); - printf(" Resource *add(struct ::wl_client *client, int id);\n"); - printf(" Resource *add(struct wl_list *resource_list, struct ::wl_client *client, int id);\n"); + printf(" Resource *add(struct ::wl_client *client, int version);\n"); + printf(" Resource *add(struct ::wl_client *client, int id, int version);\n"); + printf(" Resource *add(struct wl_list *resource_list, struct ::wl_client *client, int id, int version);\n"); printf("\n"); printf(" Resource *resource() { return m_resource; }\n"); printf(" const Resource *resource() const { return m_resource; }\n"); @@ -491,7 +492,7 @@ void process(QXmlStreamReader &xml, const QByteArray &headerPath, const QByteArr printf(" static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id);\n"); printf(" static void destroy_func(struct ::wl_resource *client_resource);\n"); printf("\n"); - printf(" Resource *bind(struct ::wl_client *client, uint32_t id);\n"); + printf(" Resource *bind(struct ::wl_client *client, uint32_t id, int version);\n"); if (hasRequests) { printf("\n"); @@ -511,6 +512,7 @@ void process(QXmlStreamReader &xml, const QByteArray &headerPath, const QByteArr printf(" QMultiMap m_resource_map;\n"); printf(" Resource *m_resource;\n"); printf(" struct ::wl_global *m_global;\n"); + printf(" uint32_t m_globalVersion;\n"); printf(" };\n"); if (j < interfaces.size() - 1) @@ -551,21 +553,21 @@ void process(QXmlStreamReader &xml, const QByteArray &headerPath, const QByteArr QByteArray stripped = stripInterfaceName(interface.name, prefix); const char *interfaceNameStripped = stripped.constData(); - printf(" %s::%s(struct ::wl_client *client, int id)\n", interfaceName, interfaceName); + printf(" %s::%s(struct ::wl_client *client, int id, int version)\n", interfaceName, interfaceName); printf(" : m_resource_map()\n"); printf(" , m_resource(0)\n"); printf(" , m_global(0)\n"); printf(" {\n"); - printf(" init(client, id);\n"); + printf(" init(client, id, version);\n"); printf(" }\n"); printf("\n"); - printf(" %s::%s(struct ::wl_display *display)\n", interfaceName, interfaceName); + printf(" %s::%s(struct ::wl_display *display, int version)\n", interfaceName, interfaceName); printf(" : m_resource_map()\n"); printf(" , m_resource(0)\n"); printf(" , m_global(0)\n"); printf(" {\n"); - printf(" init(display);\n"); + printf(" init(display, version);\n"); printf(" }\n"); printf("\n"); @@ -582,31 +584,32 @@ void process(QXmlStreamReader &xml, const QByteArray &headerPath, const QByteArr printf(" }\n"); printf("\n"); - printf(" void %s::init(struct ::wl_client *client, int id)\n", interfaceName); + printf(" void %s::init(struct ::wl_client *client, int id, int version)\n", interfaceName); printf(" {\n"); - printf(" m_resource = bind(client, id);\n"); + printf(" m_resource = bind(client, id, version);\n"); printf(" }\n"); printf("\n"); - printf(" %s::Resource *%s::add(struct ::wl_client *client)\n", interfaceName, interfaceName); + printf(" %s::Resource *%s::add(struct ::wl_client *client, int version)\n", interfaceName, interfaceName); printf(" {\n"); - printf(" Resource *resource = bind(client, 0);\n"); + printf(" Resource *resource = bind(client, 0, version);\n"); printf(" m_resource_map.insert(client, resource);\n"); printf(" return resource;\n"); printf(" }\n"); printf("\n"); - printf(" %s::Resource *%s::add(struct ::wl_client *client, int id)\n", interfaceName, interfaceName); + printf(" %s::Resource *%s::add(struct ::wl_client *client, int id, int version)\n", interfaceName, interfaceName); printf(" {\n"); - printf(" Resource *resource = bind(client, id);\n"); + printf(" Resource *resource = bind(client, id, version);\n"); printf(" m_resource_map.insert(client, resource);\n"); printf(" return resource;\n"); printf(" }\n"); printf("\n"); - printf(" void %s::init(struct ::wl_display *display)\n", interfaceName); + printf(" void %s::init(struct ::wl_display *display, int version)\n", interfaceName); printf(" {\n"); - printf(" m_global = wl_global_create(display, &::%s_interface, ::%s_interface.version, this, bind_func);\n", interfaceName, interfaceName); + printf(" m_global = wl_global_create(display, &::%s_interface, version, this, bind_func);\n", interfaceName); + printf(" m_globalVersion = version;\n"); printf(" }\n"); printf("\n"); @@ -628,8 +631,8 @@ void process(QXmlStreamReader &xml, const QByteArray &headerPath, const QByteArr printf(" void %s::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id)\n", interfaceName); printf(" {\n"); - printf(" Q_UNUSED(version);\n"); - printf(" static_cast<%s *>(data)->add(client, id);\n", interfaceName); + printf(" %s *that = static_cast<%s *>(data);\n", interfaceName, interfaceName); + printf(" that->add(client, id, qMin(that->m_globalVersion, version));\n"); printf(" }\n"); printf("\n"); @@ -652,12 +655,12 @@ void process(QXmlStreamReader &xml, const QByteArray &headerPath, const QByteArr //We should consider changing bind so that it doesn't special case id == 0 //and use function overloading instead. Jan do you have a lot of code dependent on this behavior? - printf(" %s::Resource *%s::bind(struct ::wl_client *client, uint32_t id)\n", interfaceName, interfaceName); + printf(" %s::Resource *%s::bind(struct ::wl_client *client, uint32_t id, int version)\n", interfaceName, interfaceName); printf(" {\n"); printf(" Resource *resource = %s_allocate();\n", interfaceNameStripped); printf(" resource->%s_object = this;\n", interfaceNameStripped); printf("\n"); - printf(" struct ::wl_resource *handle = wl_resource_create(client, &::%s_interface, ::%s_interface.version, id);\n", interfaceName, interfaceName); + printf(" struct ::wl_resource *handle = wl_resource_create(client, &::%s_interface, version, id);\n", interfaceName); printf(" wl_resource_set_implementation(handle, %s, resource, destroy_func);", interfaceMember.constData()); printf("\n"); printf(" resource->handle = handle;\n"); diff --git a/tests/auto/wayland/mockcompositor.cpp b/tests/auto/wayland/mockcompositor.cpp index cb0e6576e90..665b7dd738d 100644 --- a/tests/auto/wayland/mockcompositor.cpp +++ b/tests/auto/wayland/mockcompositor.cpp @@ -238,7 +238,7 @@ void Compositor::dispatchEvents(int timeout) static void compositor_create_surface(wl_client *client, wl_resource *compositorResource, uint32_t id) { Compositor *compositor = static_cast(compositorResource->data); - compositor->addSurface(new Surface(client, id, compositor)); + compositor->addSurface(new Surface(client, id, wl_resource_get_version(compositorResource), compositor)); } static void compositor_create_region(wl_client *client, wl_resource *compositorResource, uint32_t id) diff --git a/tests/auto/wayland/mockinput.cpp b/tests/auto/wayland/mockinput.cpp index fbe44de41cd..754aa45904a 100644 --- a/tests/auto/wayland/mockinput.cpp +++ b/tests/auto/wayland/mockinput.cpp @@ -101,7 +101,7 @@ void Compositor::sendKeyRelease(void *data, const QList ¶meters) } Seat::Seat(Compositor *compositor, struct ::wl_display *display) - : wl_seat(display) + : wl_seat(display, 2) , m_compositor(compositor) , m_keyboard(new Keyboard(compositor)) , m_pointer(new Pointer(compositor)) @@ -119,12 +119,12 @@ void Seat::seat_bind_resource(Resource *resource) void Seat::seat_get_keyboard(Resource *resource, uint32_t id) { - m_keyboard->add(resource->client(), id); + m_keyboard->add(resource->client(), id, resource->version()); } void Seat::seat_get_pointer(Resource *resource, uint32_t id) { - m_pointer->add(resource->client(), id); + m_pointer->add(resource->client(), id, resource->version()); } Keyboard::Keyboard(Compositor *compositor) @@ -240,7 +240,7 @@ DataDevice::~DataDevice() } DataDeviceManager::DataDeviceManager(Compositor *compositor, wl_display *display) - : wl_data_device_manager(display) + : wl_data_device_manager(display, 1) , m_compositor(compositor) { @@ -255,7 +255,7 @@ void DataDeviceManager::data_device_manager_get_data_device(Resource *resource, { if (!m_data_device) m_data_device.reset(new DataDevice(m_compositor)); - m_data_device->add(resource->client(), id); + m_data_device->add(resource->client(), id, 1); } } diff --git a/tests/auto/wayland/mocksurface.cpp b/tests/auto/wayland/mocksurface.cpp index 2e4c2bc73a4..330213bdea9 100644 --- a/tests/auto/wayland/mocksurface.cpp +++ b/tests/auto/wayland/mocksurface.cpp @@ -44,8 +44,8 @@ namespace Impl { -Surface::Surface(wl_client *client, uint32_t id, Compositor *compositor) - : QtWaylandServer::wl_surface(client, id) +Surface::Surface(wl_client *client, uint32_t id, int v, Compositor *compositor) + : QtWaylandServer::wl_surface(client, id, v) , m_buffer(Q_NULLPTR) , m_compositor(compositor) , m_mockSurface(new MockSurface(this)) diff --git a/tests/auto/wayland/mocksurface.h b/tests/auto/wayland/mocksurface.h index f2a2f4eb355..33ced43854c 100644 --- a/tests/auto/wayland/mocksurface.h +++ b/tests/auto/wayland/mocksurface.h @@ -50,7 +50,7 @@ namespace Impl { class Surface : public QtWaylandServer::wl_surface { public: - Surface(wl_client *client, uint32_t id, Compositor *compositor); + Surface(wl_client *client, uint32_t id, int v, Compositor *compositor); ~Surface(); Compositor *compositor() const { return m_compositor; } From eac16a7b2883aeb2741ca1093c29963c7268a7fb Mon Sep 17 00:00:00 2001 From: Giulio Camuffo Date: Sun, 5 Oct 2014 20:45:34 +0300 Subject: [PATCH 0192/1507] Pass the relevant serial when setting the selection This fixes copying in Weston. Change-Id: Icbdb81078e8df4575bbe440321773131ba27ebbf Reviewed-by: Laszlo Agocs --- src/plugins/platforms/wayland/qwaylanddatadevice.cpp | 3 ++- src/plugins/platforms/wayland/qwaylanddatadevice_p.h | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylanddatadevice.cpp b/src/plugins/platforms/wayland/qwaylanddatadevice.cpp index 74f879f972d..83e74ce6ca9 100644 --- a/src/plugins/platforms/wayland/qwaylanddatadevice.cpp +++ b/src/plugins/platforms/wayland/qwaylanddatadevice.cpp @@ -60,6 +60,7 @@ QWaylandDataDevice::QWaylandDataDevice(QWaylandDataDeviceManager *manager, QWaylandInputDevice *inputDevice) : QtWayland::wl_data_device(manager->get_data_device(inputDevice->wl_seat())) , m_display(manager->display()) + , m_inputDevice(inputDevice) , m_enterSerial(0) , m_dragWindow(0) , m_dragPoint() @@ -92,7 +93,7 @@ void QWaylandDataDevice::setSelectionSource(QWaylandDataSource *source) m_selectionSource.reset(source); if (source) connect(source, &QWaylandDataSource::cancelled, this, &QWaylandDataDevice::selectionSourceCancelled); - set_selection(source ? source->object() : 0, 0 /* TODO m_display->serial() */); + set_selection(source ? source->object() : Q_NULLPTR, m_inputDevice->serial()); } QWaylandDataOffer *QWaylandDataDevice::dragOffer() const diff --git a/src/plugins/platforms/wayland/qwaylanddatadevice_p.h b/src/plugins/platforms/wayland/qwaylanddatadevice_p.h index dae91290ebf..ef82d84ddb3 100644 --- a/src/plugins/platforms/wayland/qwaylanddatadevice_p.h +++ b/src/plugins/platforms/wayland/qwaylanddatadevice_p.h @@ -88,7 +88,7 @@ private Q_SLOTS: private: QWaylandDisplay *m_display; - + QWaylandInputDevice *m_inputDevice; uint32_t m_enterSerial; QWindow *m_dragWindow; QPoint m_dragPoint; From 77fd8f63c31d415ebd5f0ecf31815df670fc2e2e Mon Sep 17 00:00:00 2001 From: Giulio Camuffo Date: Fri, 10 Oct 2014 22:17:41 +0300 Subject: [PATCH 0193/1507] Be compatible with older compositors MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When binding globals take care of the version the compositor provides and don't call requests that the compositor doesn't implement. Change-Id: Iea0c534fb9e005720857e2778e380b6a9c22a6f3 Reviewed-by: Jørgen Lind --- src/plugins/platforms/wayland/qwaylanddisplay.cpp | 7 ++++--- src/plugins/platforms/wayland/qwaylanddisplay_p.h | 2 ++ src/plugins/platforms/wayland/qwaylandinputdevice.cpp | 4 ++-- src/plugins/platforms/wayland/qwaylandinputdevice_p.h | 2 +- src/plugins/platforms/wayland/qwaylandscreen.cpp | 4 ++-- src/plugins/platforms/wayland/qwaylandscreen_p.h | 2 +- src/plugins/platforms/wayland/qwaylandwindow.cpp | 3 +++ 7 files changed, 15 insertions(+), 9 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index 8649a497c7d..fda2c204e66 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -226,13 +226,14 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin struct ::wl_registry *registry = object(); if (interface == QStringLiteral("wl_output")) { - QWaylandScreen *screen = new QWaylandScreen(this, id); + QWaylandScreen *screen = new QWaylandScreen(this, version, id); mScreens.append(screen); // We need to get the output events before creating surfaces forceRoundTrip(); mWaylandIntegration->screenAdded(screen); } else if (interface == QStringLiteral("wl_compositor")) { - mCompositor.init(registry, id, 3); + mCompositorVersion = qMin((int)version, 3); + mCompositor.init(registry, id, mCompositorVersion); } else if (interface == QStringLiteral("wl_shm")) { mShm = static_cast(wl_registry_bind(registry, id, &wl_shm_interface,1)); } else if (interface == QStringLiteral("xdg_shell") @@ -241,7 +242,7 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin } else if (interface == QStringLiteral("wl_shell")){ mShell.reset(new QtWayland::wl_shell(registry, id, 1)); } else if (interface == QStringLiteral("wl_seat")) { - QWaylandInputDevice *inputDevice = new QWaylandInputDevice(this, id); + QWaylandInputDevice *inputDevice = new QWaylandInputDevice(this, version, id); mInputDevices.append(inputDevice); } else if (interface == QStringLiteral("wl_data_device_manager")) { mDndSelectionHandler.reset(new QWaylandDataDeviceManager(this, id)); diff --git a/src/plugins/platforms/wayland/qwaylanddisplay_p.h b/src/plugins/platforms/wayland/qwaylanddisplay_p.h index 796c54756e0..8d1d26bba24 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay_p.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay_p.h @@ -116,6 +116,7 @@ public: const struct wl_compositor *wl_compositor() const { return mCompositor.object(); } QtWayland::wl_compositor *compositor() { return &mCompositor; } + int compositorVersion() const { return mCompositorVersion; } QtWayland::wl_shell *shell() { return mShell.data(); } QtWayland::xdg_shell *shellXdg(); @@ -198,6 +199,7 @@ private: int mWritableNotificationFd; bool mScreensInitialized; QList mGlobals; + int mCompositorVersion; void registry_global(uint32_t id, const QString &interface, uint32_t version) Q_DECL_OVERRIDE; void registry_global_remove(uint32_t id) Q_DECL_OVERRIDE; diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index 6ec7b5df411..39d1705c0c7 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -228,9 +228,9 @@ public: QList mPrevTouchPoints; }; -QWaylandInputDevice::QWaylandInputDevice(QWaylandDisplay *display, uint32_t id) +QWaylandInputDevice::QWaylandInputDevice(QWaylandDisplay *display, int version, uint32_t id) : QObject() - , QtWayland::wl_seat(display->wl_registry(), id, 2) + , QtWayland::wl_seat(display->wl_registry(), id, qMin(version, 2)) , mQDisplay(display) , mDisplay(display->wl_display()) , mCaps(0) diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h index 23e1fc74099..630640f87f2 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h +++ b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h @@ -75,7 +75,7 @@ class Q_WAYLAND_CLIENT_EXPORT QWaylandInputDevice { Q_OBJECT public: - QWaylandInputDevice(QWaylandDisplay *display, uint32_t id); + QWaylandInputDevice(QWaylandDisplay *display, int version, uint32_t id); ~QWaylandInputDevice(); uint32_t capabilities() const { return mCaps; } diff --git a/src/plugins/platforms/wayland/qwaylandscreen.cpp b/src/plugins/platforms/wayland/qwaylandscreen.cpp index 5c625ed4231..6e48c442e43 100644 --- a/src/plugins/platforms/wayland/qwaylandscreen.cpp +++ b/src/plugins/platforms/wayland/qwaylandscreen.cpp @@ -53,9 +53,9 @@ QT_BEGIN_NAMESPACE -QWaylandScreen::QWaylandScreen(QWaylandDisplay *waylandDisplay, uint32_t id) +QWaylandScreen::QWaylandScreen(QWaylandDisplay *waylandDisplay, int version, uint32_t id) : QPlatformScreen() - , QtWayland::wl_output(waylandDisplay->wl_registry(), id, 2) + , QtWayland::wl_output(waylandDisplay->wl_registry(), id, qMin(version, 2)) , m_outputId(id) , mWaylandDisplay(waylandDisplay) , mExtendedOutput(0) diff --git a/src/plugins/platforms/wayland/qwaylandscreen_p.h b/src/plugins/platforms/wayland/qwaylandscreen_p.h index 49eeea67142..d3173e0c9a1 100644 --- a/src/plugins/platforms/wayland/qwaylandscreen_p.h +++ b/src/plugins/platforms/wayland/qwaylandscreen_p.h @@ -56,7 +56,7 @@ class QWaylandExtendedOutput; class Q_WAYLAND_CLIENT_EXPORT QWaylandScreen : public QPlatformScreen, QtWayland::wl_output { public: - QWaylandScreen(QWaylandDisplay *waylandDisplay, uint32_t id); + QWaylandScreen(QWaylandDisplay *waylandDisplay, int version, uint32_t id); ~QWaylandScreen(); QWaylandDisplay *display() const; diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index d1ea6c1f979..6c4a339f1e0 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -429,6 +429,9 @@ QWaylandSubSurface *QWaylandWindow::subSurfaceWindow() const void QWaylandWindow::handleContentOrientationChange(Qt::ScreenOrientation orientation) { + if (mDisplay->compositorVersion() < 2) + return; + wl_output_transform transform; bool isPortrait = window()->screen() && window()->screen()->primaryOrientation() == Qt::PortraitOrientation; switch (orientation) { From 351e3672d6414c6501c26ea137efdd92b80d5031 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Tue, 14 Oct 2014 10:48:10 +0200 Subject: [PATCH 0194/1507] Fix -no-opengl builds Task-number: QTBUG-41677 Change-Id: I039ec581e960eb70eb04aed6e65add70c563ba77 Reviewed-by: Robin Burchell --- src/plugins/platforms/wayland/qwaylandintegration.cpp | 2 ++ src/plugins/platforms/wayland/qwaylandintegration_p.h | 2 ++ src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp | 2 ++ src/plugins/platforms/wayland/qwaylandshmbackingstore_p.h | 2 ++ 4 files changed, 8 insertions(+) diff --git a/src/plugins/platforms/wayland/qwaylandintegration.cpp b/src/plugins/platforms/wayland/qwaylandintegration.cpp index d9bf82e4f98..aa5a1cea8b2 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandintegration.cpp @@ -175,12 +175,14 @@ QPlatformWindow *QWaylandIntegration::createPlatformWindow(QWindow *window) cons return new QWaylandShmWindow(window); } +#ifndef QT_NO_OPENGL QPlatformOpenGLContext *QWaylandIntegration::createPlatformOpenGLContext(QOpenGLContext *context) const { if (mDisplay->clientBufferIntegration()) return mDisplay->clientBufferIntegration()->createPlatformOpenGLContext(context->format(), context->shareHandle()); return 0; } +#endif // QT_NO_OPENGL QPlatformBackingStore *QWaylandIntegration::createPlatformBackingStore(QWindow *window) const { diff --git a/src/plugins/platforms/wayland/qwaylandintegration_p.h b/src/plugins/platforms/wayland/qwaylandintegration_p.h index bbe98285389..699702482db 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration_p.h +++ b/src/plugins/platforms/wayland/qwaylandintegration_p.h @@ -61,7 +61,9 @@ public: bool hasCapability(QPlatformIntegration::Capability cap) const; QPlatformWindow *createPlatformWindow(QWindow *window) const; +#ifndef QT_NO_OPENGL QPlatformOpenGLContext *createPlatformOpenGLContext(QOpenGLContext *context) const; +#endif QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const; QAbstractEventDispatcher *createEventDispatcher() const; diff --git a/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp b/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp index 332ea9265d5..d407335d3f7 100644 --- a/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp +++ b/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp @@ -323,6 +323,7 @@ QWaylandWindow *QWaylandShmBackingStore::waylandWindow() const return static_cast(window()->handle()); } +#ifndef QT_NO_OPENGL QImage QWaylandShmBackingStore::toImage() const { // Invoked from QPlatformBackingStore::composeAndFlush() that is called @@ -331,6 +332,7 @@ QImage QWaylandShmBackingStore::toImage() const return *contentSurface(); } +#endif // QT_NO_OPENGL void QWaylandShmBackingStore::done(void *data, wl_callback *callback, uint32_t time) { diff --git a/src/plugins/platforms/wayland/qwaylandshmbackingstore_p.h b/src/plugins/platforms/wayland/qwaylandshmbackingstore_p.h index 319acd9a982..1212e52fe33 100644 --- a/src/plugins/platforms/wayland/qwaylandshmbackingstore_p.h +++ b/src/plugins/platforms/wayland/qwaylandshmbackingstore_p.h @@ -94,7 +94,9 @@ public: QWaylandWindow *waylandWindow() const; void iterateBuffer(); +#ifndef QT_NO_OPENGL QImage toImage() const Q_DECL_OVERRIDE; +#endif private: void updateDecorations(); From a92c4a48bcaa643df56cda22b70b2ce1f6a96ba0 Mon Sep 17 00:00:00 2001 From: Olivier Blin Date: Tue, 9 Sep 2014 19:42:10 +0200 Subject: [PATCH 0195/1507] Fix crash when cursor theme can not be loaded Also add a debug message about theme loading failure. This is not necessarily fatal, some embedded applications could still function properly without a cursor. Change-Id: Ib3e2ee43b00630ee77997c7472a95ac5a22c2cc2 Reviewed-by: Giulio Camuffo Reviewed-by: Robin Burchell --- src/plugins/platforms/wayland/qwaylandcursor.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandcursor.cpp b/src/plugins/platforms/wayland/qwaylandcursor.cpp index 90789b0dfc7..2a1339a79f4 100644 --- a/src/plugins/platforms/wayland/qwaylandcursor.cpp +++ b/src/plugins/platforms/wayland/qwaylandcursor.cpp @@ -66,12 +66,15 @@ QWaylandCursor::QWaylandCursor(QWaylandScreen *screen) if (!hasCursorSize || cursorSize <= 0) cursorSize = 32; mCursorTheme = wl_cursor_theme_load(cursorTheme, cursorSize, mDisplay->shm()); + if (!mCursorTheme) + qDebug() << "Could not load theme" << cursorTheme; initCursorMap(); } QWaylandCursor::~QWaylandCursor() { - wl_cursor_theme_destroy(mCursorTheme); + if (mCursorTheme) + wl_cursor_theme_destroy(mCursorTheme); } struct wl_cursor_image *QWaylandCursor::cursorImage(Qt::CursorShape newShape) @@ -160,6 +163,9 @@ wl_cursor *QWaylandCursor::requestCursor(WaylandCursor shape) //If the cursor has not been loaded already, load it if (!cursor) { + if (!mCursorTheme) + return NULL; + QList cursorNames = mCursorNamesMap.values(shape); foreach (QByteArray name, cursorNames) { cursor = wl_cursor_theme_get_cursor(mCursorTheme, name.constData()); From c9909b7ce9f307583b209e3d6fdecd2d211dff1b Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Wed, 3 Dec 2014 16:36:13 +0100 Subject: [PATCH 0196/1507] Silence uninited variable compiler warnings The code is correct but some compilers may still warn about dragData not getting initialized. Silence them. Change-Id: Ib52321667fc5094e22ebbef538b72b5477e6f10b Reviewed-by: Giulio Camuffo --- src/plugins/platforms/wayland/qwaylanddatadevice.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylanddatadevice.cpp b/src/plugins/platforms/wayland/qwaylanddatadevice.cpp index 83e74ce6ca9..edf73a56a3e 100644 --- a/src/plugins/platforms/wayland/qwaylanddatadevice.cpp +++ b/src/plugins/platforms/wayland/qwaylanddatadevice.cpp @@ -126,7 +126,7 @@ void QWaylandDataDevice::data_device_drop() qDebug() << Q_FUNC_INFO << drag << m_dragOffer.data(); - QMimeData *dragData; + QMimeData *dragData = 0; Qt::DropActions supportedActions; if (drag) { dragData = drag->mimeData(); From a40ad12ef2a9e20b91effddf467ed373199c1616 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Wed, 3 Dec 2014 16:56:17 +0100 Subject: [PATCH 0197/1507] Enable Qt WebEngine on Wayland The native resource getters that are supported by eglfs will have to be supported by the wayland platform plugin too. (on wayland-egl at least) Change-Id: Ibbab649c04785dbde177342c45b9bc6f1edd954d Reviewed-by: Andy Nichols Reviewed-by: Andras Becsi --- .../qwaylandclientbufferintegration_p.h | 8 +++++++ .../wayland/qwaylandnativeinterface.cpp | 22 ++++++++++++++++++- .../wayland/qwaylandnativeinterface_p.h | 1 + 3 files changed, 30 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegration_p.h b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegration_p.h index bbe42eb261f..898ab225157 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegration_p.h +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegration_p.h @@ -69,6 +69,14 @@ public: virtual QWaylandWindow *createEglWindow(QWindow *window) = 0; virtual QPlatformOpenGLContext *createPlatformOpenGLContext(const QSurfaceFormat &glFormat, QPlatformOpenGLContext *share) const = 0; + + enum NativeResource { + EglDisplay, + EglConfig, + EglContext + }; + virtual void *nativeResource(NativeResource /*resource*/) { return Q_NULLPTR; } + virtual void *nativeResourceForContext(NativeResource /*resource*/, QPlatformOpenGLContext */*context*/) { return Q_NULLPTR; } }; QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp b/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp index 3d714c2fb00..fca176ac715 100644 --- a/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp +++ b/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp @@ -49,6 +49,7 @@ #include "qwaylandscreen_p.h" #include #include +#include QT_BEGIN_NAMESPACE @@ -61,13 +62,16 @@ void *QWaylandNativeInterface::nativeResourceForIntegration(const QByteArray &re { QByteArray lowerCaseResource = resourceString.toLower(); - if (lowerCaseResource == "display" || lowerCaseResource == "wl_display") + if (lowerCaseResource == "display" || lowerCaseResource == "wl_display" || lowerCaseResource == "nativedisplay") return m_integration->display()->wl_display(); if (lowerCaseResource == "compositor") return const_cast(m_integration->display()->wl_compositor()); if (lowerCaseResource == "server_buffer_integration") return m_integration->serverBufferIntegration(); + if (lowerCaseResource == "egldisplay" && m_integration->clientBufferIntegration()) + return m_integration->clientBufferIntegration()->nativeResource(QWaylandClientBufferIntegration::EglDisplay); + return 0; } @@ -96,6 +100,22 @@ void *QWaylandNativeInterface::nativeResourceForScreen(const QByteArray &resourc return NULL; } +void *QWaylandNativeInterface::nativeResourceForContext(const QByteArray &resource, QOpenGLContext *context) +{ + QByteArray lowerCaseResource = resource.toLower(); + + if (lowerCaseResource == "eglconfig" && m_integration->clientBufferIntegration()) + return m_integration->clientBufferIntegration()->nativeResourceForContext(QWaylandClientBufferIntegration::EglConfig, context->handle()); + + if (lowerCaseResource == "eglcontext" && m_integration->clientBufferIntegration()) + return m_integration->clientBufferIntegration()->nativeResourceForContext(QWaylandClientBufferIntegration::EglContext, context->handle()); + + if (lowerCaseResource == "egldisplay" && m_integration->clientBufferIntegration()) + return m_integration->clientBufferIntegration()->nativeResourceForContext(QWaylandClientBufferIntegration::EglDisplay, context->handle()); + + return 0; +} + QVariantMap QWaylandNativeInterface::windowProperties(QPlatformWindow *window) const { QWaylandWindow *waylandWindow = static_cast(window); diff --git a/src/plugins/platforms/wayland/qwaylandnativeinterface_p.h b/src/plugins/platforms/wayland/qwaylandnativeinterface_p.h index 6c0be2d3c8d..9d0aafdd595 100644 --- a/src/plugins/platforms/wayland/qwaylandnativeinterface_p.h +++ b/src/plugins/platforms/wayland/qwaylandnativeinterface_p.h @@ -61,6 +61,7 @@ public: QWindow *window); void *nativeResourceForScreen(const QByteArray &resourceString, QScreen *screen); + void *nativeResourceForContext(const QByteArray &resource, QOpenGLContext *context); QVariantMap windowProperties(QPlatformWindow *window) const; QVariant windowProperty(QPlatformWindow *window, const QString &name) const; From d2e278e4e2a155a74ca6f3e072bc53eb05bda5f7 Mon Sep 17 00:00:00 2001 From: Giulio Camuffo Date: Sat, 6 Dec 2014 19:57:39 +0200 Subject: [PATCH 0198/1507] Fix possible double free when hiding a window There was a race condition between the gui and the wayland event thread which could lead to double freeing the QWaylandShmBackingStore's frame callback. Protect the wl_callback_destroy calls using a mutex. Change-Id: Ia70ebac208a6d4450328ba5254a850be26d84d6d Reviewed-by: Laszlo Agocs --- src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp | 3 +++ src/plugins/platforms/wayland/qwaylandshmbackingstore_p.h | 2 ++ 2 files changed, 5 insertions(+) diff --git a/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp b/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp index d407335d3f7..6ca65f053aa 100644 --- a/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp +++ b/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp @@ -46,6 +46,7 @@ #include #include +#include #include #include @@ -180,6 +181,7 @@ void QWaylandShmBackingStore::endPaint() void QWaylandShmBackingStore::hidden() { + QMutexLocker lock(&mMutex); if (mFrameCallback) { wl_callback_destroy(mFrameCallback); mFrameCallback = Q_NULLPTR; @@ -341,6 +343,7 @@ void QWaylandShmBackingStore::done(void *data, wl_callback *callback, uint32_t t static_cast(data); if (callback != self->mFrameCallback) // others, like QWaylandWindow, may trigger callbacks too return; + QMutexLocker lock(&self->mMutex); QWaylandWindow *window = self->waylandWindow(); wl_callback_destroy(self->mFrameCallback); self->mFrameCallback = 0; diff --git a/src/plugins/platforms/wayland/qwaylandshmbackingstore_p.h b/src/plugins/platforms/wayland/qwaylandshmbackingstore_p.h index 1212e52fe33..c0d730deead 100644 --- a/src/plugins/platforms/wayland/qwaylandshmbackingstore_p.h +++ b/src/plugins/platforms/wayland/qwaylandshmbackingstore_p.h @@ -47,6 +47,7 @@ #include #include #include +#include QT_BEGIN_NAMESPACE @@ -106,6 +107,7 @@ private: QWaylandShmBuffer *mBackBuffer; bool mFrontBufferIsDirty; bool mPainting; + QMutex mMutex; QSize mRequestedSize; Qt::WindowFlags mCurrentWindowFlags; From 7b722dcd0711f32a5f08acf76bfb58f62c67a279 Mon Sep 17 00:00:00 2001 From: Morten Johan Sorvig Date: Fri, 23 Aug 2013 09:21:26 +0200 Subject: [PATCH 0199/1507] Implement high-dpi support Wayland 1.2 added support for display scaling, where wl_output has a "scale" event informing the the client that the compositor will scale the output surfaces by the given factor. The client then has the option of providing large surfaces to match the target pixel densety and bypass the compositor's scaling. This is done by calling wl_surface::set_buffer_scale. Re-use the current high-dpi support in Qt by implementing devicePixelRatio() for QWaylandScreen and QWaylandWindow. Provide high resolution buffers both for raster and OpenGL graphics. Introduce a new coordinate system: buffer coordinates, which is related to the window coordinate system via an "int scale" scale factor. This scale factor corresponds to Qts qreal devicePixelRatio, but we keep the name and the type in the QtWayland implementation. Change-Id: Ie10d7e5b4833480a9a25d96a26ad02150eb6e83f Reviewed-by: Giulio Camuffo --- .../platforms/wayland/qwaylandbuffer_p.h | 1 + .../platforms/wayland/qwaylandscreen.cpp | 20 ++++++++++++++++++- .../platforms/wayland/qwaylandscreen_p.h | 4 ++++ .../wayland/qwaylandshmbackingstore.cpp | 18 +++++++++++------ .../wayland/qwaylandshmbackingstore_p.h | 3 ++- .../platforms/wayland/qwaylandwindow.cpp | 17 +++++++++++++++- .../platforms/wayland/qwaylandwindow_p.h | 3 +++ 7 files changed, 57 insertions(+), 9 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandbuffer_p.h b/src/plugins/platforms/wayland/qwaylandbuffer_p.h index 2bb9990f3dd..0c9903f5a04 100644 --- a/src/plugins/platforms/wayland/qwaylandbuffer_p.h +++ b/src/plugins/platforms/wayland/qwaylandbuffer_p.h @@ -58,6 +58,7 @@ public: virtual ~QWaylandBuffer() { } wl_buffer *buffer() {return mBuffer;} virtual QSize size() const = 0; + virtual int scale() const { return 1; } protected: struct wl_buffer *mBuffer; diff --git a/src/plugins/platforms/wayland/qwaylandscreen.cpp b/src/plugins/platforms/wayland/qwaylandscreen.cpp index 6e48c442e43..675c8404236 100644 --- a/src/plugins/platforms/wayland/qwaylandscreen.cpp +++ b/src/plugins/platforms/wayland/qwaylandscreen.cpp @@ -59,6 +59,7 @@ QWaylandScreen::QWaylandScreen(QWaylandDisplay *waylandDisplay, int version, uin , m_outputId(id) , mWaylandDisplay(waylandDisplay) , mExtendedOutput(0) + , mScale(1) , mDepth(32) , mRefreshRate(60000) , mTransform(-1) @@ -83,7 +84,9 @@ QWaylandDisplay * QWaylandScreen::display() const QRect QWaylandScreen::geometry() const { - return mGeometry; + // Scale geometry for QScreen. This makes window and screen + // geometry be in the same coordinate system. + return QRect(mGeometry.topLeft(), mGeometry.size() / mScale); } int QWaylandScreen::depth() const @@ -127,6 +130,16 @@ Qt::ScreenOrientation QWaylandScreen::orientation() const return m_orientation; } +int QWaylandScreen::scale() const +{ + return mScale; +} + +qreal QWaylandScreen::devicePixelRatio() const +{ + return qreal(mScale); +} + qreal QWaylandScreen::refreshRate() const { return mRefreshRate / 1000.f; @@ -188,6 +201,11 @@ void QWaylandScreen::output_geometry(int32_t x, int32_t y, mGeometry.moveTopLeft(QPoint(x, y)); } +void QWaylandScreen::output_scale(int32_t factor) +{ + mScale = factor; +} + void QWaylandScreen::output_done() { // the done event is sent after all the geometry and the mode events are sent, diff --git a/src/plugins/platforms/wayland/qwaylandscreen_p.h b/src/plugins/platforms/wayland/qwaylandscreen_p.h index d3173e0c9a1..d0c5d710fe4 100644 --- a/src/plugins/platforms/wayland/qwaylandscreen_p.h +++ b/src/plugins/platforms/wayland/qwaylandscreen_p.h @@ -72,6 +72,8 @@ public: void setOrientationUpdateMask(Qt::ScreenOrientations mask); Qt::ScreenOrientation orientation() const; + int scale() const; + qreal devicePixelRatio() const Q_DECL_OVERRIDE; qreal refreshRate() const; QString name() const { return mOutputName; } @@ -95,12 +97,14 @@ private: const QString &make, const QString &model, int32_t transform) Q_DECL_OVERRIDE; + void output_scale(int32_t factor) Q_DECL_OVERRIDE; void output_done() Q_DECL_OVERRIDE; int m_outputId; QWaylandDisplay *mWaylandDisplay; QWaylandExtendedOutput *mExtendedOutput; QRect mGeometry; + int mScale; int mDepth; int mRefreshRate; int mTransform; diff --git a/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp b/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp index d407335d3f7..9ec800138e9 100644 --- a/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp +++ b/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp @@ -56,7 +56,7 @@ QT_BEGIN_NAMESPACE QWaylandShmBuffer::QWaylandShmBuffer(QWaylandDisplay *display, - const QSize &size, QImage::Format format) + const QSize &size, QImage::Format format, int scale) : mMarginsImage(0) { int stride = size.width() * 4; @@ -87,6 +87,8 @@ QWaylandShmBuffer::QWaylandShmBuffer(QWaylandDisplay *display, } mImage = QImage(data, size.width(), size.height(), stride, format); + mImage.setDevicePixelRatio(qreal(scale)); + mShmPool = wl_shm_create_pool(display->shm(), fd, alloc); mBuffer = wl_shm_pool_create_buffer(mShmPool,0, size.width(), size.height(), stride, WL_SHM_FORMAT_ARGB8888); @@ -101,8 +103,10 @@ QWaylandShmBuffer::~QWaylandShmBuffer(void) wl_shm_pool_destroy(mShmPool); } -QImage *QWaylandShmBuffer::imageInsideMargins(const QMargins &margins) +QImage *QWaylandShmBuffer::imageInsideMargins(const QMargins &marginsIn) { + QMargins margins = marginsIn * int(mImage.devicePixelRatio()); + if (!margins.isNull() && margins != mMargins) { if (mMarginsImage) { delete mMarginsImage; @@ -112,6 +116,7 @@ QImage *QWaylandShmBuffer::imageInsideMargins(const QMargins &margins) int b_s_width = mImage.size().width() - margins.left() - margins.right(); int b_s_height = mImage.size().height() - margins.top() - margins.bottom(); mMarginsImage = new QImage(b_s_data, b_s_width,b_s_height,mImage.bytesPerLine(),mImage.format()); + mMarginsImage->setDevicePixelRatio(mImage.devicePixelRatio()); } if (margins.isNull()) { delete mMarginsImage; @@ -228,7 +233,7 @@ void QWaylandShmBackingStore::flush(QWindow *window, const QRegion ®ion, cons if (damageAll) { //need to damage it all, otherwise the attach offset may screw up - waylandWindow()->damage(QRect(QPoint(0,0),mFrontBuffer->size())); + waylandWindow()->damage(QRect(QPoint(0,0), window->size())); } else { QVector rects = region.rects(); for (int i = 0; i < rects.size(); i++) { @@ -249,7 +254,8 @@ void QWaylandShmBackingStore::resize(const QSize &size, const QRegion &) void QWaylandShmBackingStore::resize(const QSize &size) { QMargins margins = windowDecorationMargins(); - QSize sizeWithMargins = size + QSize(margins.left()+margins.right(),margins.top()+margins.bottom()); + int scale = waylandWindow()->scale(); + QSize sizeWithMargins = (size + QSize(margins.left()+margins.right(),margins.top()+margins.bottom())) * scale; QImage::Format format = QPlatformScreen::platformScreenForWindow(window())->format(); @@ -260,7 +266,7 @@ void QWaylandShmBackingStore::resize(const QSize &size) delete mBackBuffer; //we delete the attached buffer when we flush } - mBackBuffer = new QWaylandShmBuffer(mDisplay, sizeWithMargins, format); + mBackBuffer = new QWaylandShmBuffer(mDisplay, sizeWithMargins, format, scale); if (windowDecoration() && window()->isVisible()) windowDecoration()->update(); @@ -354,7 +360,7 @@ void QWaylandShmBackingStore::done(void *data, wl_callback *callback, uint32_t t delete window->attached(); } window->attachOffset(self->mFrontBuffer); - window->damage(QRect(QPoint(0,0),self->mFrontBuffer->size())); + window->damage(QRect(QPoint(0,0),window->geometry().size())); window->commit(); } } diff --git a/src/plugins/platforms/wayland/qwaylandshmbackingstore_p.h b/src/plugins/platforms/wayland/qwaylandshmbackingstore_p.h index 1212e52fe33..b1e326c37af 100644 --- a/src/plugins/platforms/wayland/qwaylandshmbackingstore_p.h +++ b/src/plugins/platforms/wayland/qwaylandshmbackingstore_p.h @@ -57,9 +57,10 @@ class QWaylandWindow; class Q_WAYLAND_CLIENT_EXPORT QWaylandShmBuffer : public QWaylandBuffer { public: QWaylandShmBuffer(QWaylandDisplay *display, - const QSize &size, QImage::Format format); + const QSize &size, QImage::Format format, int scale = 1); ~QWaylandShmBuffer(); QSize size() const { return mImage.size(); } + int scale() const Q_DECL_OVERRIDE { return int(mImage.devicePixelRatio()); } QImage *image() { return &mImage; } QImage *imageInsideMargins(const QMargins &margins); diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 9f7bdda1fa9..fd06972ff89 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -126,6 +126,12 @@ QWaylandWindow::QWaylandWindow(QWindow *window) mShellSurface->setTopLevel(); } + // Enable high-dpi rendering. Scale() returns the screen scale factor and will + // typically be integer 1 (normal-dpi) or 2 (high-dpi). Call set_buffer_scale() + // to inform the compositor that high-resolution buffers will be provided. + if (mDisplay->compositorVersion() >= 3) + set_buffer_scale(scale()); + setOrientationMask(window->screen()->orientationUpdateMask()); setWindowFlags(window->flags()); setGeometry_helper(window->geometry()); @@ -369,7 +375,6 @@ void QWaylandWindow::requestResize() void QWaylandWindow::attach(QWaylandBuffer *buffer, int x, int y) { mBuffer = buffer; - if (mBuffer) attach(mBuffer->buffer(), x, y); else @@ -707,6 +712,16 @@ bool QWaylandWindow::isExposed() const return QPlatformWindow::isExposed(); } +int QWaylandWindow::scale() const +{ + return screen()->scale(); +} + +qreal QWaylandWindow::devicePixelRatio() const +{ + return screen()->devicePixelRatio(); +} + bool QWaylandWindow::setMouseGrabEnabled(bool grab) { if (window()->type() != Qt::Popup) { diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index 0c55cd88d50..0d982d43e18 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -142,6 +142,9 @@ public: void setMask(const QRegion ®ion) Q_DECL_OVERRIDE; + int scale() const; + qreal devicePixelRatio() const Q_DECL_OVERRIDE; + void requestActivateWindow() Q_DECL_OVERRIDE; bool isExposed() const Q_DECL_OVERRIDE; void unfocus(); From 934b4bb9a5d25f42d160b410b60de68d3ad8045b Mon Sep 17 00:00:00 2001 From: Philippe Coval Date: Wed, 5 Nov 2014 16:13:17 +0100 Subject: [PATCH 0200/1507] xdg-shell: upgrade to support current version (weston-1.6.0) Many inprovements on windows's decorations, Also handle compositor events (test: Super+Shift+F , Super+Shift+M) The protocol file is a raw copy of Source: http://cgit.freedesktop.org/wayland/weston/plain/protocol/xdg-shell.xml?id=1.6.0 Task-number: QTBUG-38633/related Change-Id: I667ec52c8a7e34d74b60174a671c89671f841d6b Reviewed-by: Giulio Camuffo --- src/3rdparty/wayland/protocols/xdg-shell.xml | 225 ++++++++---------- .../platforms/wayland/qwaylandxdgsurface.cpp | 106 ++++----- .../platforms/wayland/qwaylandxdgsurface_p.h | 11 +- 3 files changed, 155 insertions(+), 187 deletions(-) diff --git a/src/3rdparty/wayland/protocols/xdg-shell.xml b/src/3rdparty/wayland/protocols/xdg-shell.xml index 79a283173ff..275837f3dc0 100644 --- a/src/3rdparty/wayland/protocols/xdg-shell.xml +++ b/src/3rdparty/wayland/protocols/xdg-shell.xml @@ -45,7 +45,7 @@ they implement using static_assert to ensure the protocol and implementation versions match. - + @@ -137,11 +137,8 @@ - + - Setting a surface as transient of another means that it is child - of another surface. - Child surfaces are stacked above their parents, and will be unmapped if the parent is unmapped too. They should not appear on task bars and alt+tab. @@ -149,32 +146,6 @@ - - - This tells the compositor what the visible size of the window - should be, so it can use it to determine what borders to use for - constrainment and alignment. - - CSD often has invisible areas for decoration purposes, like drop - shadows. These "shadow" drawings need to be subtracted out of the - normal boundaries of the window when computing where to place - windows (e.g. to set this window so it's centered on top of another, - or to put it to the left or right of the screen.) - - This value should change as little as possible at runtime, to - prevent flicker. - - This value is also ignored when the window is maximized or - fullscreen, and assumed to be 0. - - If never called, this value is assumed to be 0. - - - - - - - Set a short title for the surface. @@ -201,6 +172,26 @@ + + + Clients implementing client-side decorations might want to show + a context menu when right-clicking on the decorations, giving the + user a menu that they can use to maximize or minimize the window. + + This request asks the compositor to pop up such a window menu at + the given position, relative to the parent surface. There are + no guarantees as to what the window menu contains. + + Your surface must have focus on the seat passed in to pop up the + window menu. + + + + + + + + Start a pointer-driven move of the surface. @@ -244,46 +235,12 @@ - - - The configure event asks the client to resize its surface. - - The size is a hint, in the sense that the client is free to - ignore it if it doesn't resize, pick a smaller size (to - satisfy aspect ratio or resize in steps of NxM pixels). - - The client is free to dismiss all but the last configure - event it received. - - The width and height arguments specify the size of the window - in surface local coordinates. - - - - - - - - - Set the default output used by this surface when it is first mapped. - - If this value is NULL (default), it's up to the compositor to choose - which display will be used to map this surface. - - When fullscreen or maximized state are set on this surface, and it - wasn't mapped yet, the output set with this method will be used. - Otherwise, the output where the surface is currently mapped will be - used. - - - - The different state values used on the surface. This is designed for state values like maximized, fullscreen. It is paired with the - request_change_state event to ensure that both the client and the - compositor setting the state can be synchronized. + configure event to ensure that both the client and the compositor + setting the state can be synchronized. States set in this way are double-buffered. They will get applied on the next commit. @@ -300,89 +257,101 @@ 0x1000 - 0x1FFF: GNOME - A non-zero value indicates the surface is maximized. Otherwise, - the surface is unmaximized. + The surface is maximized. The window geometry specified in the configure + event must be obeyed by the client. - A non-zero value indicates the surface is fullscreen. Otherwise, - the surface is not fullscreen. + The surface is fullscreen. The window geometry specified in the configure + event must be obeyed by the client. + + + The surface is being resized. The window geometry specified in the + configure event is a maximum; the client cannot resize beyond it. + Clients that have aspect ratio or cell sizing configuration can use + a smaller size, however. + + + Client window decorations should be painted as if the window is + active. Do not assume this means that the window actually has + keyboard or pointer focus. - - - This asks the compositor to change the state. If the compositor wants - to change the state, it will send a change_state event with the same - state_type, value, and serial, and the event flow continues as if it - it was initiated by the compositor. + + + The configure event asks the client to resize its surface. - If the compositor does not want to change the state, it will send a - change_state to the client with the old value of the state. - - - - - This serial is so the client can know which change_state event corresponds - to which request_change_state request it sent out. - - + The width and height arguments specify a hint to the window + about how its surface should be resized in window geometry + coordinates. The states listed in the event specify how the + width/height arguments should be interpreted. - - - This event tells the client to change a surface's state. The client - should respond with an ack_change_state request to the compositor to - guarantee that the compositor knows that the client has seen it. + A client should arrange a new surface, and then send a + ack_configure request with the serial sent in this configure + event before attaching a new surface. + + If the client receives multiple configure events before it + can respond to one, it is free to discard all but the last + event it received. - - - + + + + - - - When a change_state event is received, a client should then ack it - using the ack_change_state request to ensure that the compositor + + + When a configure event is received, a client should then ack it + using the ack_configure request to ensure that the compositor knows the client has seen the event. By this point, the state is confirmed, and the next attach should - contain the buffer drawn for the new state value. - - The values here need to be the same as the values in the cooresponding - change_state event. + contain the buffer drawn for the configure event you are acking. - - - + - - - Minimize the surface. + + + The window geometry of a window is its "visible bounds" from the + user's perspective. Client-side decorations often have invisible + portions like drop-shadows which should be ignored for the + purposes of aligning, placing and constraining windows. + + The default value is the full bounds of the surface, including any + subsurfaces. Once the window geometry of the surface is set once, + it is not possible to unset it, and it will remain the same until + set_window_geometry is called again, even if a new subsurface or + buffer is attached. + + If responding to a configure event, the window geometry in here + must respect the sizing negotiations specified by the states in + the configure event. + + + + - - - The activated_set event is sent when this surface has been - activated, which means that the surface has user attention. - Window decorations should be updated accordingly. You should - not use this event for anything but the style of decorations - you display, use wl_keyboard.enter and wl_keyboard.leave for - determining keyboard focus. - - + + - - - The deactivate event is sent when this surface has been - deactivated, which means that the surface lost user attention. - Window decorations should be updated accordingly. You should - not use this event for anything but the style of decorations - you display, use wl_keyboard.enter and wl_keyboard.leave for - determining keyboard focus. + + + Make the surface fullscreen. + + You can specify an output that you would prefer to be fullscreen. + If this value is NULL, it's up to the compositor to choose which + display will be used to map this surface. - + + + + + diff --git a/src/plugins/platforms/wayland/qwaylandxdgsurface.cpp b/src/plugins/platforms/wayland/qwaylandxdgsurface.cpp index 318ff86d944..7f0c7f418f6 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgsurface.cpp +++ b/src/plugins/platforms/wayland/qwaylandxdgsurface.cpp @@ -48,7 +48,6 @@ #include "qwaylandscreen_p.h" #include "qwaylandextendedsurface_p.h" -#include QT_BEGIN_NAMESPACE @@ -94,36 +93,32 @@ void QWaylandXdgSurface::move(QWaylandInputDevice *inputDevice) void QWaylandXdgSurface::setMaximized() { if (!m_maximized) - request_change_state(XDG_SURFACE_STATE_MAXIMIZED, true, 0); + set_maximized(); } void QWaylandXdgSurface::setFullscreen() { if (!m_fullscreen) - request_change_state(XDG_SURFACE_STATE_FULLSCREEN, true, 0); + set_fullscreen(Q_NULLPTR); } void QWaylandXdgSurface::setNormal() { if (m_fullscreen || m_maximized || m_minimized) { if (m_maximized) { - request_change_state(XDG_SURFACE_STATE_MAXIMIZED, false, 0); + unset_maximized(); } if (m_fullscreen) { - request_change_state(XDG_SURFACE_STATE_FULLSCREEN, false, 0); + unset_fullscreen(); } m_fullscreen = m_maximized = m_minimized = false; - setTopLevel(); - QMargins m = m_window->frameMargins(); - m_window->configure(0, m_size.width() + m.left() + m.right(), m_size.height() + m.top() + m.bottom()); } } void QWaylandXdgSurface::setMinimized() { m_minimized = true; - m_size = m_window->window()->geometry().size(); set_minimized(); } @@ -138,22 +133,7 @@ void QWaylandXdgSurface::updateTransientParent(QWindow *parent) if (!parent_wayland_window) return; - // set_transient expects a position relative to the parent - QPoint transientPos = m_window->geometry().topLeft(); // this is absolute - QWindow *parentWin = m_window->window()->transientParent(); - transientPos -= parentWin->geometry().topLeft(); - if (parent_wayland_window->decoration()) { - transientPos.setX(transientPos.x() + parent_wayland_window->decoration()->margins().left()); - transientPos.setY(transientPos.y() + parent_wayland_window->decoration()->margins().top()); - } - - uint32_t flags = 0; - Qt::WindowFlags wf = m_window->window()->flags(); - if (wf.testFlag(Qt::ToolTip) - || wf.testFlag(Qt::WindowTransparentForInput)) - flags |= XDG_SURFACE_SET_TRANSIENT_FOR; - - set_transient_for(parent_wayland_window->object()); + set_parent(parent_wayland_window->object()); } void QWaylandXdgSurface::setTitle(const QString & title) @@ -196,44 +176,64 @@ void QWaylandXdgSurface::sendProperty(const QString &name, const QVariant &value m_extendedWindow->updateGenericProperty(name, value); } -void QWaylandXdgSurface::xdg_surface_configure(int32_t width, int32_t height) +void QWaylandXdgSurface::xdg_surface_configure(int32_t width, int32_t height, struct wl_array *states,uint32_t serial) { - m_window->configure(0 , width, height); -} + uint32_t *state = 0; + bool aboutToMaximize = false; + bool aboutToFullScreen = false; -void QWaylandXdgSurface::xdg_surface_change_state(uint32_t state, - uint32_t value, - uint32_t serial) -{ + state = (uint32_t*) states->data; - if (state == XDG_SURFACE_STATE_MAXIMIZED - || state == XDG_SURFACE_STATE_FULLSCREEN) { - if (value) { - m_size = m_window->window()->geometry().size(); - } else { - QMargins m = m_window->frameMargins(); - m_window->configure(0, m_size.width() + m.left() + m.right(), m_size.height() + m.top() + m.bottom()); + for (uint32_t i=0; i < states->size; i++) + { + switch (*(state+i)) { + case XDG_SURFACE_STATE_MAXIMIZED: + aboutToMaximize = true; + break; + case XDG_SURFACE_STATE_FULLSCREEN: + aboutToFullScreen = true; + break; + case XDG_SURFACE_STATE_RESIZING: + m_margins = m_window->frameMargins(); + width -= m_margins.left() + m_margins.right(); + height -= m_margins.top() + m_margins.bottom(); + m_size = QSize(width,height); + break; + case XDG_SURFACE_STATE_ACTIVATED: + // TODO: here about the missing window activation + break; + default: + break; } } - switch (state) { - case XDG_SURFACE_STATE_MAXIMIZED: - m_maximized = value; - break; - case XDG_SURFACE_STATE_FULLSCREEN: - m_fullscreen = value; - break; + if (!m_fullscreen && aboutToFullScreen) { + m_fullscreen = true; + m_size = m_window->window()->geometry().size(); + m_window->window()->showFullScreen(); + } else if (m_fullscreen && !aboutToFullScreen) { + m_fullscreen = false; + m_window->window()->showNormal(); + } else if (!m_maximized && aboutToMaximize) { + m_maximized = true; + m_size = m_window->window()->geometry().size(); + m_window->window()->showMaximized(); + } else if (m_maximized && !aboutToMaximize) { + m_maximized = false; + m_window->window()->showNormal(); } - xdg_surface_ack_change_state(object(), state, value, serial); -} + if (width == 0 && height == 0) { + width = m_size.width(); + height = m_size.height(); + } -void QWaylandXdgSurface::xdg_surface_activated() -{ -} + if (width > 0 && height > 0) { + m_margins = m_window->frameMargins(); + m_window->configure(0, width + m_margins.left() + m_margins.right(), height + m_margins.top() + m_margins.bottom()); + } -void QWaylandXdgSurface::xdg_surface_deactivated() -{ + xdg_surface_ack_configure(object(), serial); } void QWaylandXdgSurface::xdg_surface_close() diff --git a/src/plugins/platforms/wayland/qwaylandxdgsurface_p.h b/src/plugins/platforms/wayland/qwaylandxdgsurface_p.h index 635c9496a7e..c5ae9c792c5 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgsurface_p.h +++ b/src/plugins/platforms/wayland/qwaylandxdgsurface_p.h @@ -43,6 +43,7 @@ #define QWAYLANDXDGSURFACE_H #include +#include #include @@ -99,15 +100,13 @@ private: bool m_minimized; bool m_fullscreen; QSize m_size; + QMargins m_margins; QWaylandExtendedSurface *m_extendedWindow; void xdg_surface_configure(int32_t width, - int32_t height) Q_DECL_OVERRIDE; - void xdg_surface_change_state(uint32_t state, - uint32_t value, - uint32_t serial) Q_DECL_OVERRIDE; - void xdg_surface_activated() Q_DECL_OVERRIDE; - void xdg_surface_deactivated() Q_DECL_OVERRIDE; + int32_t height, + struct wl_array *states, + uint32_t serial) Q_DECL_OVERRIDE; void xdg_surface_close() Q_DECL_OVERRIDE; friend class QWaylandWindow; From 846324db5a6f3ff3ddf28d6122ebc7d2b19d71e7 Mon Sep 17 00:00:00 2001 From: Giulio Camuffo Date: Mon, 6 Oct 2014 14:26:46 +0300 Subject: [PATCH 0201/1507] Make use of the new QPlatformIntegration::destroyScreen MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Task-number: QTBUG-41141 Change-Id: I0bd789cc1090f7e0e7615b47c33a4e4179677398 Reviewed-by: Jørgen Lind --- src/plugins/platforms/wayland/qwaylanddisplay.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index 023050326e7..a4d13db7178 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -168,7 +168,9 @@ QWaylandDisplay::QWaylandDisplay(QWaylandIntegration *waylandIntegration) QWaylandDisplay::~QWaylandDisplay(void) { - qDeleteAll(mScreens); + foreach (QWaylandScreen *screen, mScreens) { + mWaylandIntegration->destroyScreen(screen); + } mScreens.clear(); delete mDndSelectionHandler.take(); mEventThread->quit(); @@ -291,8 +293,8 @@ void QWaylandDisplay::registry_global_remove(uint32_t id) if (global.interface == QStringLiteral("wl_output")) { foreach (QWaylandScreen *screen, mScreens) { if (screen->outputId() == id) { - delete screen; mScreens.removeOne(screen); + mWaylandIntegration->destroyScreen(screen); break; } } From 68a6cf54a06597edf428ab1c6adb0f3729f3da10 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Sun, 23 Nov 2014 07:15:35 -0800 Subject: [PATCH 0202/1507] Remove unused members Clang found two problems with this from QWaylandDataDeviceManager. First, it's a class, not a struct. Second, nothing is using this private member. qwaylanddatadevicemanager_p.h:66:5: warning: struct 'wl_data_device_manager' was previously declared as a class [-Wmismatched-tags] qwaylanddatadevicemanager_p.h:66:36: warning: private field 'm_data_device_manager' is not used [-Wunused-private-field] And also this one: qwaylandextendedoutput_p.h:61:21: warning: private field 'm_screen' is not used [-Wunused-private-field] Change-Id: Ifc8f28f92190547dcb0a5319aa6fc14277894f15 Reviewed-by: Giulio Camuffo --- src/plugins/platforms/wayland/qwaylanddatadevicemanager_p.h | 1 - src/plugins/platforms/wayland/qwaylandextendedoutput.cpp | 2 +- src/plugins/platforms/wayland/qwaylandextendedoutput_p.h | 4 ---- 3 files changed, 1 insertion(+), 6 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylanddatadevicemanager_p.h b/src/plugins/platforms/wayland/qwaylanddatadevicemanager_p.h index 55583c61b4c..3ed21d26a1f 100644 --- a/src/plugins/platforms/wayland/qwaylanddatadevicemanager_p.h +++ b/src/plugins/platforms/wayland/qwaylanddatadevicemanager_p.h @@ -63,7 +63,6 @@ public: QWaylandDisplay *display() const; private: - struct wl_data_device_manager *m_data_device_manager; QWaylandDisplay *m_display; }; diff --git a/src/plugins/platforms/wayland/qwaylandextendedoutput.cpp b/src/plugins/platforms/wayland/qwaylandextendedoutput.cpp index c34f5d317e0..bb6a4779e90 100644 --- a/src/plugins/platforms/wayland/qwaylandextendedoutput.cpp +++ b/src/plugins/platforms/wayland/qwaylandextendedoutput.cpp @@ -51,8 +51,8 @@ QT_BEGIN_NAMESPACE QWaylandExtendedOutput::QWaylandExtendedOutput(QWaylandScreen *screen, ::qt_extended_output *extended_output) : QtWayland::qt_extended_output(extended_output) - , m_screen(screen) { + Q_UNUSED(screen); } QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandextendedoutput_p.h b/src/plugins/platforms/wayland/qwaylandextendedoutput_p.h index 71bd3fce295..35ac194a427 100644 --- a/src/plugins/platforms/wayland/qwaylandextendedoutput_p.h +++ b/src/plugins/platforms/wayland/qwaylandextendedoutput_p.h @@ -55,10 +55,6 @@ class Q_WAYLAND_CLIENT_EXPORT QWaylandExtendedOutput : public QtWayland::qt_exte { public: QWaylandExtendedOutput(QWaylandScreen *screen, struct ::qt_extended_output *extended_output); - -private: - - QWaylandScreen *m_screen; }; QT_END_NAMESPACE From 7fd1af437b4f53d7201d42b592e35176995c2bc0 Mon Sep 17 00:00:00 2001 From: Giulio Camuffo Date: Mon, 5 Jan 2015 13:38:53 +0200 Subject: [PATCH 0203/1507] Allow retrieving the egl display for a QWindow on wayland This allows a compositor running with the wayland qpa inside another compositor to provide EGL to its clients. Change-Id: I308fb909c8168955148be152bf314a53c0e5ca43 Reviewed-by: Laszlo Agocs --- src/plugins/platforms/wayland/qwaylandnativeinterface.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp b/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp index fca176ac715..b4bb0604dba 100644 --- a/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp +++ b/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp @@ -86,6 +86,8 @@ void *QWaylandNativeInterface::nativeResourceForWindow(const QByteArray &resourc if (lowerCaseResource == "surface") { return ((QWaylandWindow *) window->handle())->object(); } + if (lowerCaseResource == "egldisplay" && m_integration->clientBufferIntegration()) + return m_integration->clientBufferIntegration()->nativeResource(QWaylandClientBufferIntegration::EglDisplay); return NULL; } From 92eac38d68165554113386e2fa989bf89f937e5c Mon Sep 17 00:00:00 2001 From: Giulio Camuffo Date: Sun, 4 Jan 2015 18:27:51 +0200 Subject: [PATCH 0204/1507] Send proper mouse enter events MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The wl_pointer.event carries the surface local position of the pointer. Notify Qt of it, without pretending it to be a motion event. Change-Id: Ibbe1d125a93b478f9c350a50bfea25b01f628178 Reviewed-by: Jørgen Lind --- .../platforms/wayland/qwaylandinputdevice.cpp | 48 +++++++++++------ .../platforms/wayland/qwaylandinputdevice_p.h | 22 ++++++++ .../platforms/wayland/qwaylandwindow.cpp | 54 +++++++++++-------- .../platforms/wayland/qwaylandwindow_p.h | 16 ++---- 4 files changed, 91 insertions(+), 49 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index 43c5807d419..ada2cf2b5a4 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -345,12 +345,17 @@ void QWaylandInputDevice::setCursor(struct wl_buffer *buffer, struct wl_cursor_i } } +class EnterEvent : public QWaylandPointerEvent +{ +public: + EnterEvent(const QPointF &l, const QPointF &g) + : QWaylandPointerEvent(QWaylandPointerEvent::Enter, 0, l, g, 0, Qt::NoModifier) + {} +}; + void QWaylandInputDevice::Pointer::pointer_enter(uint32_t serial, struct wl_surface *surface, wl_fixed_t sx, wl_fixed_t sy) { - Q_UNUSED(sx); - Q_UNUSED(sy); - if (!surface) return; @@ -358,15 +363,16 @@ void QWaylandInputDevice::Pointer::pointer_enter(uint32_t serial, struct wl_surf window->window()->setCursor(window->window()->cursor()); mFocus = window; + mSurfacePos = QPointF(wl_fixed_to_double(sx), wl_fixed_to_double(sy)); + mGlobalPos = window->window()->mapToGlobal(mSurfacePos.toPoint()); - mParent->mTime = QWaylandDisplay::currentTimeMillisec(); mParent->mSerial = serial; mEnterSerial = serial; QWaylandWindow *grab = QWaylandWindow::mouseGrab(); if (!grab) { - window->handleMouseEnter(mParent); - window->handleMouse(mParent, mParent->mTime, mSurfacePos, mGlobalPos, mButtons, Qt::NoModifier); + EnterEvent evt(mSurfacePos, mGlobalPos); + window->handleMouse(mParent, evt); } } @@ -387,11 +393,17 @@ void QWaylandInputDevice::Pointer::pointer_leave(uint32_t time, struct wl_surfac mParent->mTime = time; } +class MotionEvent : public QWaylandPointerEvent +{ +public: + MotionEvent(ulong t, const QPointF &l, const QPointF &g, Qt::MouseButtons b, Qt::KeyboardModifiers m) + : QWaylandPointerEvent(QWaylandPointerEvent::Motion, t, l, g, b, m) + { + } +}; + void QWaylandInputDevice::Pointer::pointer_motion(uint32_t time, wl_fixed_t surface_x, wl_fixed_t surface_y) { - Q_UNUSED(surface_x); - Q_UNUSED(surface_y); - QWaylandWindow *window = mFocus; if (window == NULL) { @@ -415,9 +427,12 @@ void QWaylandInputDevice::Pointer::pointer_motion(uint32_t time, wl_fixed_t surf // so we just set it outside of the window boundaries. pos = QPointF(-1, -1); global = grab->window()->mapToGlobal(pos.toPoint()); - grab->handleMouse(mParent, time, pos, global, mButtons, Qt::NoModifier); - } else - window->handleMouse(mParent, time, mSurfacePos, mGlobalPos, mButtons, Qt::NoModifier); + MotionEvent e(time, pos, global, mButtons, Qt::NoModifier); + grab->handleMouse(mParent, e); + } else { + MotionEvent e(time, mSurfacePos, mGlobalPos, mButtons, Qt::NoModifier); + window->handleMouse(mParent, e); + } } void QWaylandInputDevice::Pointer::pointer_button(uint32_t serial, uint32_t time, @@ -461,9 +476,12 @@ void QWaylandInputDevice::Pointer::pointer_button(uint32_t serial, uint32_t time if (grab && grab != mFocus) { QPointF pos = QPointF(-1, -1); QPointF global = grab->window()->mapToGlobal(pos.toPoint()); - grab->handleMouse(mParent, time, pos, global, mButtons, Qt::NoModifier); - } else if (window) - window->handleMouse(mParent, time, mSurfacePos, mGlobalPos, mButtons, Qt::NoModifier); + MotionEvent e(time, pos, global, mButtons, Qt::NoModifier); + grab->handleMouse(mParent, e); + } else if (window) { + MotionEvent e(time, mSurfacePos, mGlobalPos, mButtons, Qt::NoModifier); + window->handleMouse(mParent, e); + } } void QWaylandInputDevice::Pointer::pointer_axis(uint32_t time, uint32_t axis, int32_t value) diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h index f1c2645456a..a5da8bd0fee 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h +++ b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h @@ -260,7 +260,29 @@ public: QList mPrevTouchPoints; }; +class QWaylandPointerEvent +{ +public: + enum Type { + Enter, + Motion + }; + inline QWaylandPointerEvent(Type t, ulong ts, const QPointF &l, const QPointF &g, Qt::MouseButtons b, Qt::KeyboardModifiers m) + : type(t) + , timestamp(ts) + , local(l) + , global(g) + , buttons(b) + , modifiers(m) + {} + Type type; + ulong timestamp; + QPointF local; + QPointF global; + Qt::MouseButtons buttons; + Qt::KeyboardModifiers modifiers; +}; QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index fd06972ff89..08a123b61ce 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -603,27 +603,28 @@ QWaylandWindow *QWaylandWindow::transientParent() const return 0; } -void QWaylandWindow::handleMouse(QWaylandInputDevice *inputDevice, ulong timestamp, const QPointF &local, const QPointF &global, Qt::MouseButtons b, Qt::KeyboardModifiers mods) +void QWaylandWindow::handleMouse(QWaylandInputDevice *inputDevice, const QWaylandPointerEvent &e) { - if (b != Qt::NoButton) { + if (e.buttons != Qt::NoButton) { mMouseSerial = inputDevice->serial(); mMouseDevice = inputDevice; } if (mWindowDecoration) { - handleMouseEventWithDecoration(inputDevice, timestamp,local,global,b,mods); - return; + handleMouseEventWithDecoration(inputDevice, e); + } else { + switch (e.type) { + case QWaylandPointerEvent::Enter: + QWindowSystemInterface::handleEnterEvent(window(), e.local, e.global); + break; + case QWaylandPointerEvent::Motion: + QWindowSystemInterface::handleMouseEvent(window(), e.timestamp, e.local, e.global, e.buttons, e.modifiers); + break; + } } - QWindowSystemInterface::handleMouseEvent(window(),timestamp,local,global,b,mods); -} - -void QWaylandWindow::handleMouseEnter(QWaylandInputDevice *inputDevice) -{ - if (!mWindowDecoration) { - QWindowSystemInterface::handleEnterEvent(window()); - } - restoreMouseCursor(inputDevice); + if (e.type == QWaylandPointerEvent::Enter) + restoreMouseCursor(inputDevice); } void QWaylandWindow::handleMouseLeave(QWaylandInputDevice *inputDevice) @@ -645,19 +646,22 @@ bool QWaylandWindow::touchDragDecoration(QWaylandInputDevice *inputDevice, const return mWindowDecoration->handleTouch(inputDevice, local, global, state, mods); } -void QWaylandWindow::handleMouseEventWithDecoration(QWaylandInputDevice *inputDevice, ulong timestamp, const QPointF &local, const QPointF &global, Qt::MouseButtons b, Qt::KeyboardModifiers mods) +void QWaylandWindow::handleMouseEventWithDecoration(QWaylandInputDevice *inputDevice, const QWaylandPointerEvent &e) { - if (mWindowDecoration->handleMouse(inputDevice,local,global,b,mods)) + if (mWindowDecoration->handleMouse(inputDevice, e.local, e.global, e.buttons, e.modifiers)) { + if (mMouseEventsInContentArea) + QWindowSystemInterface::handleLeaveEvent(window()); return; + } QMargins marg = frameMargins(); QRect windowRect(0 + marg.left(), 0 + marg.top(), geometry().size().width() - marg.right(), geometry().size().height() - marg.bottom()); - if (windowRect.contains(local.toPoint()) || mMousePressedInContentArea != Qt::NoButton) { - QPointF localTranslated = local; - QPointF globalTranslated = global; + if (windowRect.contains(e.local.toPoint()) || mMousePressedInContentArea != Qt::NoButton) { + QPointF localTranslated = e.local; + QPointF globalTranslated = e.global; localTranslated.setX(localTranslated.x() - marg.left()); localTranslated.setY(localTranslated.y() - marg.top()); globalTranslated.setX(globalTranslated.x() - marg.left()); @@ -666,15 +670,23 @@ void QWaylandWindow::handleMouseEventWithDecoration(QWaylandInputDevice *inputDe restoreMouseCursor(inputDevice); QWindowSystemInterface::handleEnterEvent(window()); } - QWindowSystemInterface::handleMouseEvent(window(), timestamp, localTranslated, globalTranslated, b, mods); + + switch (e.type) { + case QWaylandPointerEvent::Enter: + QWindowSystemInterface::handleEnterEvent(window(), localTranslated, globalTranslated); + break; + case QWaylandPointerEvent::Motion: + QWindowSystemInterface::handleMouseEvent(window(), e.timestamp, localTranslated, globalTranslated, e.buttons, e.modifiers); + break; + } + mMouseEventsInContentArea = true; - mMousePressedInContentArea = b; + mMousePressedInContentArea = e.buttons; } else { if (mMouseEventsInContentArea) { QWindowSystemInterface::handleLeaveEvent(window()); mMouseEventsInContentArea = false; } - mWindowDecoration->handleMouse(inputDevice,local,global,b,mods); } } diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index 0d982d43e18..2650f46d17c 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -64,6 +64,7 @@ class QWaylandAbstractDecoration; class QWaylandInputDevice; class QWaylandScreen; class QWaylandShmBackingStore; +class QWaylandPointerEvent; class Q_WAYLAND_CLIENT_EXPORT QWaylandWindowConfigure { @@ -151,13 +152,7 @@ public: QWaylandAbstractDecoration *decoration() const; - void handleMouse(QWaylandInputDevice *inputDevice, - ulong timestamp, - const QPointF & local, - const QPointF & global, - Qt::MouseButtons b, - Qt::KeyboardModifiers mods); - void handleMouseEnter(QWaylandInputDevice *inputDevice); + void handleMouse(QWaylandInputDevice *inputDevice, const QWaylandPointerEvent &e); void handleMouseLeave(QWaylandInputDevice *inputDevice); bool touchDragDecoration(QWaylandInputDevice *inputDevice, const QPointF &local, const QPointF &global, @@ -237,12 +232,7 @@ private: bool setWindowStateInternal(Qt::WindowState flags); void setGeometry_helper(const QRect &rect); - void handleMouseEventWithDecoration(QWaylandInputDevice *inputDevice, - ulong timestamp, - const QPointF & local, - const QPointF & global, - Qt::MouseButtons b, - Qt::KeyboardModifiers mods); + void handleMouseEventWithDecoration(QWaylandInputDevice *inputDevice, const QWaylandPointerEvent &e); static const wl_callback_listener callbackListener; static void frameCallback(void *data, struct wl_callback *wl_callback, uint32_t time); From 6723e2148d05e0abd2731a81213600fe2f50a3f3 Mon Sep 17 00:00:00 2001 From: Giulio Camuffo Date: Wed, 7 Jan 2015 22:31:43 +0200 Subject: [PATCH 0205/1507] Set the composing string of the wayland input method MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Task-number: QTBUG-43346 Change-Id: I9bc6d804ddca59a7a0173b8f0d3ec2f268fe9a59 Reviewed-by: Jørgen Lind --- .../platforms/wayland/qwaylandinputcontext.cpp | 16 ++++++++++++++++ .../platforms/wayland/qwaylandinputcontext_p.h | 1 + 2 files changed, 17 insertions(+) diff --git a/src/plugins/platforms/wayland/qwaylandinputcontext.cpp b/src/plugins/platforms/wayland/qwaylandinputcontext.cpp index 8a711955e49..e189b945134 100644 --- a/src/plugins/platforms/wayland/qwaylandinputcontext.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputcontext.cpp @@ -124,6 +124,18 @@ void QWaylandTextInput::updateState() commit_state(++m_serial); } +void QWaylandTextInput::text_input_preedit_string(uint32_t serial, const QString &text, const QString &commit) +{ + Q_UNUSED(serial) + if (!QGuiApplication::focusObject()) + return; + + m_commit = commit; + QList attributes; + QInputMethodEvent event(text, attributes); + QCoreApplication::sendEvent(QGuiApplication::focusObject(), &event); +} + void QWaylandTextInput::text_input_commit_string(uint32_t serial, const QString &text) { Q_UNUSED(serial); @@ -133,6 +145,8 @@ void QWaylandTextInput::text_input_commit_string(uint32_t serial, const QString QInputMethodEvent event; event.setCommitString(text); QCoreApplication::sendEvent(QGuiApplication::focusObject(), &event); + + m_commit = QString(); } void QWaylandTextInput::text_input_enter(wl_surface *) @@ -143,6 +157,8 @@ void QWaylandTextInput::text_input_enter(wl_surface *) void QWaylandTextInput::text_input_leave() { + if (!m_commit.isEmpty()) + text_input_commit_string(0, m_commit); } void QWaylandTextInput::text_input_keysym(uint32_t serial, uint32_t time, uint32_t sym, uint32_t state, uint32_t modifiers) diff --git a/src/plugins/platforms/wayland/qwaylandinputcontext_p.h b/src/plugins/platforms/wayland/qwaylandinputcontext_p.h index 1f7e4e3616f..fbb26b9bf9d 100644 --- a/src/plugins/platforms/wayland/qwaylandinputcontext_p.h +++ b/src/plugins/platforms/wayland/qwaylandinputcontext_p.h @@ -60,6 +60,7 @@ public: void updateState(); protected: + void text_input_preedit_string(uint32_t serial, const QString &text, const QString &commit) Q_DECL_OVERRIDE; void text_input_commit_string(uint32_t serial, const QString &text) Q_DECL_OVERRIDE; void text_input_enter(wl_surface *surface) Q_DECL_OVERRIDE; void text_input_leave() Q_DECL_OVERRIDE; From 322bc6a377f9b015492b824773d54df0ae098d6c Mon Sep 17 00:00:00 2001 From: Giulio Camuffo Date: Sun, 18 Jan 2015 15:04:29 +0200 Subject: [PATCH 0206/1507] Make sure we send a valid initial resize Change-Id: Ib9a0152f83af433354d32ef4a8a233e5551ded8c Reviewed-by: Laszlo Agocs --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 6c4a339f1e0..965511528c1 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -208,7 +208,7 @@ void QWaylandWindow::setGeometry(const QRect &rect) { setGeometry_helper(rect); - if (window()->isVisible()) { + if (window()->isVisible() && rect.isValid()) { if (mWindowDecoration) mWindowDecoration->update(); @@ -336,7 +336,7 @@ void QWaylandWindow::requestResize() { QMutexLocker lock(&mResizeLock); - if (mCanResize) { + if (mCanResize || !mSentInitialResize) { doResize(); } From 0dc189a432779d5840a8e1847a24b898daf6f3c5 Mon Sep 17 00:00:00 2001 From: Giulio Camuffo Date: Thu, 29 Jan 2015 14:35:44 +0200 Subject: [PATCH 0207/1507] Namespace the platform plugins MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There currently is a QWaylandInputDevice class both in the wayland QPA plugin and in the QtCompositor API. This causes the qwindow-compositor example to crash when running nested in a wayland session due to a mismatch between the two classes. By namespacing all the plugin code we make sure that name clashes will not happen anymore. Change-Id: I17497cff697599200bea68bf01dfde474526390f Reviewed-by: Jørgen Lind --- .../qwaylandclientbufferintegration.cpp | 4 +++ .../qwaylandclientbufferintegration_p.h | 10 ++++--- ...qwaylandclientbufferintegrationfactory.cpp | 4 +++ ...qwaylandclientbufferintegrationfactory_p.h | 4 +++ .../qwaylandclientbufferintegrationplugin.cpp | 4 +++ .../qwaylandclientbufferintegrationplugin_p.h | 4 +++ .../qwaylandhardwareintegration.cpp | 4 +++ .../qwaylandhardwareintegration_p.h | 4 +++ .../qwaylandserverbufferintegration.cpp | 4 +++ .../qwaylandserverbufferintegration_p.h | 4 +++ ...qwaylandserverbufferintegrationfactory.cpp | 4 +++ ...qwaylandserverbufferintegrationfactory_p.h | 4 +++ .../qwaylandserverbufferintegrationplugin.cpp | 4 +++ .../qwaylandserverbufferintegrationplugin_p.h | 4 +++ .../qwaylandinputdeviceintegration_p.h | 4 +++ .../qwaylandinputdeviceintegrationfactory.cpp | 4 +++ .../qwaylandinputdeviceintegrationfactory_p.h | 4 +++ .../qwaylandinputdeviceintegrationplugin.cpp | 4 +++ .../qwaylandinputdeviceintegrationplugin_p.h | 4 +++ .../plugins/decorations/bradient/main.cpp | 3 +++ .../hardwareintegration/brcm-egl/main.cpp | 4 +++ .../drm-egl-server/main.cpp | 4 +++ .../libhybris-egl-server/main.cpp | 4 +++ .../hardwareintegration/wayland-egl/main.cpp | 4 +++ .../xcomposite-egl/main.cpp | 4 +++ .../xcomposite-glx/main.cpp | 4 +++ .../wayland/qwaylandabstractdecoration.cpp | 4 +++ .../wayland/qwaylandabstractdecoration_p.h | 5 ++++ .../platforms/wayland/qwaylandbuffer_p.h | 4 +++ .../platforms/wayland/qwaylandclipboard.cpp | 4 +++ .../platforms/wayland/qwaylandclipboard_p.h | 4 +++ .../platforms/wayland/qwaylandcursor.cpp | 4 +++ .../platforms/wayland/qwaylandcursor_p.h | 4 +++ .../platforms/wayland/qwaylanddatadevice.cpp | 8 ++++++ .../platforms/wayland/qwaylanddatadevice_p.h | 9 +++++-- .../wayland/qwaylanddatadevicemanager.cpp | 3 +++ .../wayland/qwaylanddatadevicemanager_p.h | 4 +++ .../platforms/wayland/qwaylanddataoffer.cpp | 4 +++ .../platforms/wayland/qwaylanddataoffer_p.h | 4 +++ .../platforms/wayland/qwaylanddatasource.cpp | 4 +++ .../platforms/wayland/qwaylanddatasource_p.h | 5 ++++ .../wayland/qwaylanddecorationfactory.cpp | 4 +++ .../wayland/qwaylanddecorationfactory_p.h | 4 +++ .../wayland/qwaylanddecorationplugin.cpp | 4 +++ .../wayland/qwaylanddecorationplugin_p.h | 4 +++ .../platforms/wayland/qwaylanddisplay.cpp | 4 +++ .../platforms/wayland/qwaylanddisplay_p.h | 27 +++++++++++-------- src/plugins/platforms/wayland/qwaylanddnd.cpp | 4 +++ src/plugins/platforms/wayland/qwaylanddnd_p.h | 4 +++ .../platforms/wayland/qwaylandeventthread.cpp | 4 +++ .../platforms/wayland/qwaylandeventthread_p.h | 4 +++ .../wayland/qwaylandextendedoutput.cpp | 3 +++ .../wayland/qwaylandextendedoutput_p.h | 4 +++ .../wayland/qwaylandextendedsurface.cpp | 4 +++ .../wayland/qwaylandextendedsurface_p.h | 4 +++ .../wayland/qwaylandinputcontext.cpp | 4 +++ .../wayland/qwaylandinputcontext_p.h | 4 +++ .../platforms/wayland/qwaylandinputdevice.cpp | 4 +++ .../platforms/wayland/qwaylandinputdevice_p.h | 3 +++ .../platforms/wayland/qwaylandintegration.cpp | 4 +++ .../platforms/wayland/qwaylandintegration_p.h | 4 +++ .../wayland/qwaylandnativeinterface.cpp | 4 +++ .../wayland/qwaylandnativeinterface_p.h | 4 +++ .../platforms/wayland/qwaylandqtkey.cpp | 4 +++ .../platforms/wayland/qwaylandqtkey_p.h | 4 +++ .../platforms/wayland/qwaylandscreen.cpp | 4 +++ .../platforms/wayland/qwaylandscreen_p.h | 4 +++ .../wayland/qwaylandshellsurface.cpp | 8 ++++++ .../wayland/qwaylandshellsurface_p.h | 7 ++++- .../wayland/qwaylandshmbackingstore.cpp | 4 +++ .../wayland/qwaylandshmbackingstore_p.h | 4 +++ .../platforms/wayland/qwaylandshmwindow.cpp | 4 +++ .../platforms/wayland/qwaylandshmwindow_p.h | 4 +++ .../platforms/wayland/qwaylandsubsurface.cpp | 4 +++ .../platforms/wayland/qwaylandsubsurface_p.h | 4 +++ .../platforms/wayland/qwaylandtouch.cpp | 4 +++ .../platforms/wayland/qwaylandtouch_p.h | 4 +++ .../platforms/wayland/qwaylandwindow.cpp | 4 +++ .../platforms/wayland/qwaylandwindow_p.h | 4 +++ .../qwaylandwindowmanagerintegration.cpp | 4 +++ .../qwaylandwindowmanagerintegration_p.h | 4 +++ .../wayland/qwaylandwlshellsurface.cpp | 4 +++ .../wayland/qwaylandwlshellsurface_p.h | 7 ++++- .../platforms/wayland/qwaylandxdgshell.cpp | 3 +++ .../platforms/wayland/qwaylandxdgshell_p.h | 7 ++++- .../platforms/wayland/qwaylandxdgsurface.cpp | 4 +++ .../platforms/wayland/qwaylandxdgsurface_p.h | 7 ++++- .../qwaylandshellintegration_p.h | 4 +++ .../qwaylandshellintegrationfactory.cpp | 4 +++ .../qwaylandshellintegrationfactory_p.h | 4 +++ .../qwaylandshellintegrationplugin.cpp | 4 +++ .../qwaylandshellintegrationplugin_p.h | 4 +++ 92 files changed, 399 insertions(+), 20 deletions(-) diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegration.cpp b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegration.cpp index 2c4d8ff1bf6..f6099309782 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegration.cpp +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegration.cpp @@ -43,6 +43,8 @@ QT_BEGIN_NAMESPACE +namespace QtWaylandClient { + QWaylandClientBufferIntegration::QWaylandClientBufferIntegration() { @@ -53,4 +55,6 @@ QWaylandClientBufferIntegration::~QWaylandClientBufferIntegration() } +} + QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegration_p.h b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegration_p.h index 898ab225157..8c787175dba 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegration_p.h +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegration_p.h @@ -47,13 +47,15 @@ QT_BEGIN_NAMESPACE -class QWaylandWindow; -class QWaylandDisplay; class QWindow; - class QPlatformOpenGLContext; class QSurfaceFormat; +namespace QtWaylandClient { + +class QWaylandWindow; +class QWaylandDisplay; + class Q_WAYLAND_CLIENT_EXPORT QWaylandClientBufferIntegration { public: @@ -79,6 +81,8 @@ public: virtual void *nativeResourceForContext(NativeResource /*resource*/, QPlatformOpenGLContext */*context*/) { return Q_NULLPTR; } }; +} + QT_END_NAMESPACE #endif // QWAYLANDCLIENTBUFFERINTEGRATION_H diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationfactory.cpp b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationfactory.cpp index 7f2648bcf99..d0603ef2288 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationfactory.cpp +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationfactory.cpp @@ -48,6 +48,8 @@ QT_BEGIN_NAMESPACE +namespace QtWaylandClient { + #ifndef QT_NO_LIBRARY Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader, (QWaylandClientBufferIntegrationFactoryInterface_iid, QLatin1String("/wayland-graphics-integration-client"), Qt::CaseInsensitive)) @@ -93,4 +95,6 @@ QWaylandClientBufferIntegration *QWaylandClientBufferIntegrationFactory::create( return 0; } +} + QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationfactory_p.h b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationfactory_p.h index 4a1c4128694..25ea5805e7b 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationfactory_p.h +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationfactory_p.h @@ -47,6 +47,8 @@ QT_BEGIN_NAMESPACE +namespace QtWaylandClient { + class QWaylandClientBufferIntegration; class Q_WAYLAND_CLIENT_EXPORT QWaylandClientBufferIntegrationFactory @@ -56,6 +58,8 @@ public: static QWaylandClientBufferIntegration *create(const QString &name, const QStringList &args, const QString &pluginPath = QString()); }; +} + QT_END_NAMESPACE #endif // QWAYLANDCLIENTBUFFERINTEGRATIONFACTORY_H diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationplugin.cpp b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationplugin.cpp index afc1051067d..1b362b29436 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationplugin.cpp +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationplugin.cpp @@ -43,6 +43,8 @@ QT_BEGIN_NAMESPACE +namespace QtWaylandClient { + QWaylandClientBufferIntegrationPlugin::QWaylandClientBufferIntegrationPlugin(QObject *parent) : QObject(parent) { @@ -52,4 +54,6 @@ QWaylandClientBufferIntegrationPlugin::~QWaylandClientBufferIntegrationPlugin() { } +} + QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationplugin_p.h b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationplugin_p.h index 7f96ebc6a0b..a14c17810d5 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationplugin_p.h +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationplugin_p.h @@ -50,6 +50,8 @@ QT_BEGIN_NAMESPACE +namespace QtWaylandClient { + class QWaylandClientBufferIntegration; #define QWaylandClientBufferIntegrationFactoryInterface_iid "org.qt-project.Qt.WaylandClient.QWaylandClientBufferIntegrationFactoryInterface.5.3" @@ -64,6 +66,8 @@ public: virtual QWaylandClientBufferIntegration *create(const QString &key, const QStringList ¶mList) = 0; }; +} + QT_END_NAMESPACE #endif // QWAYLANDCLIENTBUFFERINTEGRATIONPLUGIN_H diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandhardwareintegration.cpp b/src/plugins/platforms/wayland/hardwareintegration/qwaylandhardwareintegration.cpp index 469f80360f3..c02eebf3a2a 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandhardwareintegration.cpp +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandhardwareintegration.cpp @@ -44,6 +44,8 @@ #include "qwaylanddisplay_p.h" QT_BEGIN_NAMESPACE +namespace QtWaylandClient { + QWaylandHardwareIntegration::QWaylandHardwareIntegration(struct ::wl_registry *registry, int id) : qt_hardware_integration(registry, id, 1) { @@ -69,4 +71,6 @@ void QWaylandHardwareIntegration::hardware_integration_server_backend(const QStr m_server_buffer = name; } +} + QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandhardwareintegration_p.h b/src/plugins/platforms/wayland/hardwareintegration/qwaylandhardwareintegration_p.h index 84aa18ace70..503e69b033f 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandhardwareintegration_p.h +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandhardwareintegration_p.h @@ -47,6 +47,8 @@ QT_BEGIN_NAMESPACE +namespace QtWaylandClient { + class QWaylandDisplay; class Q_WAYLAND_CLIENT_EXPORT QWaylandHardwareIntegration : public QtWayland::qt_hardware_integration @@ -66,6 +68,8 @@ private: QString m_server_buffer; }; +} + QT_END_NAMESPACE #endif diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegration.cpp b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegration.cpp index 5bac689293a..07780f52ebb 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegration.cpp +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegration.cpp @@ -43,6 +43,8 @@ QT_BEGIN_NAMESPACE +namespace QtWaylandClient { + QWaylandServerBuffer::QWaylandServerBuffer() : m_user_data(0) { @@ -79,4 +81,6 @@ QWaylandServerBufferIntegration::~QWaylandServerBufferIntegration() { } +} + QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegration_p.h b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegration_p.h index 18090a79831..7732cea2744 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegration_p.h +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegration_p.h @@ -50,6 +50,8 @@ QT_BEGIN_NAMESPACE +namespace QtWaylandClient { + class QWaylandDisplay; class Q_WAYLAND_CLIENT_EXPORT QWaylandServerBuffer @@ -90,6 +92,8 @@ public: virtual QWaylandServerBuffer *serverBuffer(struct qt_server_buffer *buffer) = 0; }; +} + QT_END_NAMESPACE #endif diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationfactory.cpp b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationfactory.cpp index 2b61dbdc888..3df77a003bd 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationfactory.cpp +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationfactory.cpp @@ -48,6 +48,8 @@ QT_BEGIN_NAMESPACE +namespace QtWaylandClient { + #ifndef QT_NO_LIBRARY Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader, (QWaylandServerBufferIntegrationFactoryInterface_iid, QLatin1String("/wayland-graphics-integration-client"), Qt::CaseInsensitive)) @@ -93,4 +95,6 @@ QWaylandServerBufferIntegration *QWaylandServerBufferIntegrationFactory::create( return 0; } +} + QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationfactory_p.h b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationfactory_p.h index 48e5e13d9ba..5fcce2ba6ab 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationfactory_p.h +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationfactory_p.h @@ -47,6 +47,8 @@ QT_BEGIN_NAMESPACE +namespace QtWaylandClient { + class QWaylandServerBufferIntegration; class Q_WAYLAND_CLIENT_EXPORT QWaylandServerBufferIntegrationFactory @@ -56,6 +58,8 @@ public: static QWaylandServerBufferIntegration *create(const QString &name, const QStringList &args, const QString &pluginPath = QString()); }; +} + QT_END_NAMESPACE #endif // QWAYLANDSERVERBUFFERINTEGRATIONFACTORY_H diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationplugin.cpp b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationplugin.cpp index 8fc31a883d6..e77bec0e762 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationplugin.cpp +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationplugin.cpp @@ -43,6 +43,8 @@ QT_BEGIN_NAMESPACE +namespace QtWaylandClient { + QWaylandServerBufferIntegrationPlugin::QWaylandServerBufferIntegrationPlugin(QObject *parent) : QObject(parent) { @@ -51,4 +53,6 @@ QWaylandServerBufferIntegrationPlugin::~QWaylandServerBufferIntegrationPlugin() { } +} + QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationplugin_p.h b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationplugin_p.h index d5d1d78f530..f74ee1ad131 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationplugin_p.h +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationplugin_p.h @@ -50,6 +50,8 @@ QT_BEGIN_NAMESPACE +namespace QtWaylandClient { + class QWaylandServerBufferIntegration; #define QWaylandServerBufferIntegrationFactoryInterface_iid "org.qt-project.Qt.WaylandClient.QWaylandServerBufferIntegrationFactoryInterface.5.3" @@ -64,6 +66,8 @@ public: virtual QWaylandServerBufferIntegration *create(const QString &key, const QStringList ¶mList) = 0; }; +} + QT_END_NAMESPACE #endif // QWAYLANDSERVERBUFFERINTEGRATIONPLUGIN_H diff --git a/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegration_p.h b/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegration_p.h index 5fa187e6997..54ead23c454 100644 --- a/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegration_p.h +++ b/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegration_p.h @@ -47,6 +47,8 @@ QT_BEGIN_NAMESPACE +namespace QtWaylandClient { + class QWaylandDisplay; class QWaylandInputDevice; @@ -59,6 +61,8 @@ public: virtual QWaylandInputDevice *createInputDevice(QWaylandDisplay *d, int version, uint32_t id) = 0; }; +} + QT_END_NAMESPACE #endif // QWAYLANDINPUTDEVICEINTEGRATION_H diff --git a/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationfactory.cpp b/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationfactory.cpp index 58a82fb2c3a..f9e459ed9cc 100644 --- a/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationfactory.cpp +++ b/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationfactory.cpp @@ -48,6 +48,8 @@ QT_BEGIN_NAMESPACE +namespace QtWaylandClient { + #ifndef QT_NO_LIBRARY Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader, (QWaylandInputDeviceIntegrationFactoryInterface_iid, QLatin1String("/wayland-inputdevice-integration"), Qt::CaseInsensitive)) @@ -93,4 +95,6 @@ QWaylandInputDeviceIntegration *QWaylandInputDeviceIntegrationFactory::create(co return Q_NULLPTR; } +} + QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationfactory_p.h b/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationfactory_p.h index 13cddc24f04..74cfba8c878 100644 --- a/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationfactory_p.h +++ b/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationfactory_p.h @@ -47,6 +47,8 @@ QT_BEGIN_NAMESPACE +namespace QtWaylandClient { + class QWaylandInputDeviceIntegration; class Q_WAYLAND_CLIENT_EXPORT QWaylandInputDeviceIntegrationFactory @@ -56,6 +58,8 @@ public: static QWaylandInputDeviceIntegration *create(const QString &name, const QStringList &args, const QString &pluginPath = QString()); }; +} + QT_END_NAMESPACE #endif // QWAYLANDINPUTDEVICENTEGRATIONFACTORY_H diff --git a/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationplugin.cpp b/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationplugin.cpp index 71a9332540d..c78a095966b 100644 --- a/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationplugin.cpp +++ b/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationplugin.cpp @@ -43,6 +43,8 @@ QT_BEGIN_NAMESPACE +namespace QtWaylandClient { + QWaylandInputDeviceIntegrationPlugin::QWaylandInputDeviceIntegrationPlugin(QObject *parent) : QObject(parent) { @@ -52,4 +54,6 @@ QWaylandInputDeviceIntegrationPlugin::~QWaylandInputDeviceIntegrationPlugin() { } +} + QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationplugin_p.h b/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationplugin_p.h index a0a062f4c3e..9723191d80b 100644 --- a/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationplugin_p.h +++ b/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationplugin_p.h @@ -50,6 +50,8 @@ QT_BEGIN_NAMESPACE +namespace QtWaylandClient { + class QWaylandInputDeviceIntegration; #define QWaylandInputDeviceIntegrationFactoryInterface_iid "org.qt-project.Qt.WaylandClient.QWaylandInputDeviceIntegrationFactoryInterface.5.3" @@ -64,6 +66,8 @@ public: virtual QWaylandInputDeviceIntegration *create(const QString &key, const QStringList ¶mList) = 0; }; +} + QT_END_NAMESPACE #endif // QWAYLANDINPUTDEVICEINTEGRATIONPLUGIN_H diff --git a/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp b/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp index c249248c320..eb4245627e3 100644 --- a/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp +++ b/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp @@ -54,6 +54,8 @@ QT_BEGIN_NAMESPACE +namespace QtWaylandClient { + #define BUTTON_SPACING 5 #ifndef QT_NO_IMAGEFORMAT_XPM @@ -446,6 +448,7 @@ QWaylandAbstractDecoration *QWaylandBradientDecorationPlugin::create(const QStri return new QWaylandBradientDecoration(); } +} QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/main.cpp b/src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/main.cpp index c023332ebd7..eb0d99c4c60 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/main.cpp +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/main.cpp @@ -44,6 +44,8 @@ QT_BEGIN_NAMESPACE +namespace QtWaylandClient { + class QWaylandBrcmEglClientBufferPlugin : public QWaylandClientBufferIntegrationPlugin { Q_OBJECT @@ -59,6 +61,8 @@ QWaylandClientBufferIntegration *QWaylandBrcmEglClientBufferPlugin::create(const return new QWaylandBrcmEglIntegration(); } +} + QT_END_NAMESPACE #include "main.moc" diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/drm-egl-server/main.cpp b/src/plugins/platforms/wayland/plugins/hardwareintegration/drm-egl-server/main.cpp index 6a3df4431fd..3a74a8f8e2d 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/drm-egl-server/main.cpp +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/drm-egl-server/main.cpp @@ -44,6 +44,8 @@ QT_BEGIN_NAMESPACE +namespace QtWaylandClient { + class DrmEglServerBufferPlugin : public QWaylandServerBufferIntegrationPlugin { Q_OBJECT @@ -59,6 +61,8 @@ QWaylandServerBufferIntegration *DrmEglServerBufferPlugin::create(const QString& return new DrmEglServerBufferIntegration(); } +} + QT_END_NAMESPACE #include "main.moc" diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/libhybris-egl-server/main.cpp b/src/plugins/platforms/wayland/plugins/hardwareintegration/libhybris-egl-server/main.cpp index 9aee157903e..18d002e2c3e 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/libhybris-egl-server/main.cpp +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/libhybris-egl-server/main.cpp @@ -44,6 +44,8 @@ QT_BEGIN_NAMESPACE +namespace QtWaylandClient { + class LibHybrisEglServerBufferPlugin : public QWaylandServerBufferIntegrationPlugin { Q_OBJECT @@ -59,6 +61,8 @@ QWaylandServerBufferIntegration *LibHybrisEglServerBufferPlugin::create(const QS return new LibHybrisEglServerBufferIntegration(); } +} + QT_END_NAMESPACE #include "main.moc" diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/main.cpp b/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/main.cpp index e4cd8c1f08c..020a41e02e2 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/main.cpp +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/main.cpp @@ -44,6 +44,8 @@ QT_BEGIN_NAMESPACE +namespace QtWaylandClient { + class QWaylandEglClientBufferPlugin : public QWaylandClientBufferIntegrationPlugin { Q_OBJECT @@ -59,6 +61,8 @@ QWaylandClientBufferIntegration *QWaylandEglClientBufferPlugin::create(const QSt return new QWaylandEglClientBufferIntegration(); } +} + QT_END_NAMESPACE #include "main.moc" diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-egl/main.cpp b/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-egl/main.cpp index 4b9835f1d53..eddb5cbdcbe 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-egl/main.cpp +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-egl/main.cpp @@ -44,6 +44,8 @@ QT_BEGIN_NAMESPACE +namespace QtWaylandClient { + class QWaylandXCompositeEglClientBufferIntegrationPlugin : public QWaylandClientBufferIntegrationPlugin { Q_OBJECT @@ -59,6 +61,8 @@ QWaylandClientBufferIntegration *QWaylandXCompositeEglClientBufferIntegrationPlu return new QWaylandXCompositeEGLClientBufferIntegration(); } +} + QT_END_NAMESPACE #include "main.moc" diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-glx/main.cpp b/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-glx/main.cpp index 2c6f0fde898..0b3c313346a 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-glx/main.cpp +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-glx/main.cpp @@ -44,6 +44,8 @@ QT_BEGIN_NAMESPACE +namespace QtWaylandClient { + class QWaylandXCompositeGlxClientBufferIntegrationPlugin : public QWaylandClientBufferIntegrationPlugin { Q_OBJECT @@ -59,6 +61,8 @@ QWaylandClientBufferIntegration *QWaylandXCompositeGlxClientBufferIntegrationPlu return new QWaylandXCompositeGLXIntegration(); } +} + QT_END_NAMESPACE #include "main.moc" diff --git a/src/plugins/platforms/wayland/qwaylandabstractdecoration.cpp b/src/plugins/platforms/wayland/qwaylandabstractdecoration.cpp index e4b81bb8363..6ad78aaa348 100644 --- a/src/plugins/platforms/wayland/qwaylandabstractdecoration.cpp +++ b/src/plugins/platforms/wayland/qwaylandabstractdecoration.cpp @@ -52,6 +52,8 @@ QT_BEGIN_NAMESPACE +namespace QtWaylandClient { + class QWaylandAbstractDecorationPrivate : public QObjectPrivate { Q_DECLARE_PUBLIC(QWaylandAbstractDecoration) @@ -184,4 +186,6 @@ QWaylandWindow *QWaylandAbstractDecoration::waylandWindow() const return d->m_wayland_window; } +} + QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandabstractdecoration_p.h b/src/plugins/platforms/wayland/qwaylandabstractdecoration_p.h index 6171cab14cb..891e67a8fbc 100644 --- a/src/plugins/platforms/wayland/qwaylandabstractdecoration_p.h +++ b/src/plugins/platforms/wayland/qwaylandabstractdecoration_p.h @@ -62,6 +62,9 @@ class QWindow; class QPaintDevice; class QPainter; class QEvent; + +namespace QtWaylandClient { + class QWaylandScreen; class QWaylandWindow; class QWaylandInputDevice; @@ -100,6 +103,8 @@ protected: bool isLeftReleased(Qt::MouseButtons newMouseButtonState); }; +} + QT_END_NAMESPACE #endif // QWAYLANDABSTRACTDECORATION_H diff --git a/src/plugins/platforms/wayland/qwaylandbuffer_p.h b/src/plugins/platforms/wayland/qwaylandbuffer_p.h index 0c9903f5a04..db6bbd9bb7f 100644 --- a/src/plugins/platforms/wayland/qwaylandbuffer_p.h +++ b/src/plugins/platforms/wayland/qwaylandbuffer_p.h @@ -52,6 +52,8 @@ QT_BEGIN_NAMESPACE +namespace QtWaylandClient { + class Q_WAYLAND_CLIENT_EXPORT QWaylandBuffer { public: QWaylandBuffer() { } @@ -64,6 +66,8 @@ protected: struct wl_buffer *mBuffer; }; +} + QT_END_NAMESPACE #endif // QWAYLANDBUFFER_H diff --git a/src/plugins/platforms/wayland/qwaylandclipboard.cpp b/src/plugins/platforms/wayland/qwaylandclipboard.cpp index c40f023b55a..226a374abfa 100644 --- a/src/plugins/platforms/wayland/qwaylandclipboard.cpp +++ b/src/plugins/platforms/wayland/qwaylandclipboard.cpp @@ -48,6 +48,8 @@ QT_BEGIN_NAMESPACE +namespace QtWaylandClient { + QWaylandClipboard::QWaylandClipboard(QWaylandDisplay *display) : mDisplay(display) { @@ -108,4 +110,6 @@ bool QWaylandClipboard::ownsMode(QClipboard::Mode mode) const return inputDevice->dataDevice()->selectionSource() != 0; } +} + QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandclipboard_p.h b/src/plugins/platforms/wayland/qwaylandclipboard_p.h index 0dea3371ae9..6c181de1bfb 100644 --- a/src/plugins/platforms/wayland/qwaylandclipboard_p.h +++ b/src/plugins/platforms/wayland/qwaylandclipboard_p.h @@ -49,6 +49,8 @@ QT_BEGIN_NAMESPACE +namespace QtWaylandClient { + class QWaylandDisplay; class Q_WAYLAND_CLIENT_EXPORT QWaylandClipboard : public QPlatformClipboard @@ -67,6 +69,8 @@ private: QWaylandDisplay *mDisplay; }; +} + QT_END_NAMESPACE #endif // QWAYLANDCLIPBOARD_H diff --git a/src/plugins/platforms/wayland/qwaylandcursor.cpp b/src/plugins/platforms/wayland/qwaylandcursor.cpp index 2a1339a79f4..8dd4bce1ac6 100644 --- a/src/plugins/platforms/wayland/qwaylandcursor.cpp +++ b/src/plugins/platforms/wayland/qwaylandcursor.cpp @@ -53,6 +53,8 @@ QT_BEGIN_NAMESPACE +namespace QtWaylandClient { + QWaylandCursor::QWaylandCursor(QWaylandScreen *screen) : mDisplay(screen->display()) { @@ -305,4 +307,6 @@ void QWaylandCursor::initCursorMap() mCursorNamesMap.insert(ResizeSouthWestCursor, "bottom_left_corner"); } +} + QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandcursor_p.h b/src/plugins/platforms/wayland/qwaylandcursor_p.h index 282ac685f5c..d832922d854 100644 --- a/src/plugins/platforms/wayland/qwaylandcursor_p.h +++ b/src/plugins/platforms/wayland/qwaylandcursor_p.h @@ -52,6 +52,8 @@ struct wl_cursor_theme; QT_BEGIN_NAMESPACE +namespace QtWaylandClient { + class QWaylandDisplay; class QWaylandScreen; @@ -111,6 +113,8 @@ private: QMultiMap mCursorNamesMap; }; +} + QT_END_NAMESPACE #endif // QWAYLANDCURSOR_H diff --git a/src/plugins/platforms/wayland/qwaylanddatadevice.cpp b/src/plugins/platforms/wayland/qwaylanddatadevice.cpp index edf73a56a3e..0d6ea711235 100644 --- a/src/plugins/platforms/wayland/qwaylanddatadevice.cpp +++ b/src/plugins/platforms/wayland/qwaylanddatadevice.cpp @@ -57,6 +57,10 @@ #include +QT_BEGIN_NAMESPACE + +namespace QtWaylandClient { + QWaylandDataDevice::QWaylandDataDevice(QWaylandDataDeviceManager *manager, QWaylandInputDevice *inputDevice) : QtWayland::wl_data_device(manager->get_data_device(inputDevice->wl_seat())) , m_display(manager->display()) @@ -249,3 +253,7 @@ void QWaylandDataDevice::dragSourceTargetChanged(const QString &mimeType) { static_cast(QGuiApplicationPrivate::platformIntegration()->drag())->updateTarget(mimeType); } + +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylanddatadevice_p.h b/src/plugins/platforms/wayland/qwaylanddatadevice_p.h index ef82d84ddb3..a80312c9423 100644 --- a/src/plugins/platforms/wayland/qwaylanddatadevice_p.h +++ b/src/plugins/platforms/wayland/qwaylanddatadevice_p.h @@ -48,12 +48,15 @@ QT_BEGIN_NAMESPACE -class QWaylandDisplay; class QMimeData; +class QWindow; + +namespace QtWaylandClient { + +class QWaylandDisplay; class QWaylandDataDeviceManager; class QWaylandDataOffer; class QWaylandDataSource; -class QWindow; class QWaylandInputDevice; class QWaylandWindow; @@ -99,6 +102,8 @@ private: QScopedPointer m_dragSource; }; +} + QT_END_NAMESPACE #endif // QWAYLANDDATADEVICE_H diff --git a/src/plugins/platforms/wayland/qwaylanddatadevicemanager.cpp b/src/plugins/platforms/wayland/qwaylanddatadevicemanager.cpp index ea578ff7b1d..c86d1ba8ab7 100644 --- a/src/plugins/platforms/wayland/qwaylanddatadevicemanager.cpp +++ b/src/plugins/platforms/wayland/qwaylanddatadevicemanager.cpp @@ -50,6 +50,8 @@ QT_BEGIN_NAMESPACE +namespace QtWaylandClient { + QWaylandDataDeviceManager::QWaylandDataDeviceManager(QWaylandDisplay *display, uint32_t id) : wl_data_device_manager(display->wl_registry(), id, 1) , m_display(display) @@ -77,5 +79,6 @@ QWaylandDisplay *QWaylandDataDeviceManager::display() const return m_display; } +} QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylanddatadevicemanager_p.h b/src/plugins/platforms/wayland/qwaylanddatadevicemanager_p.h index 3ed21d26a1f..e622f6150cf 100644 --- a/src/plugins/platforms/wayland/qwaylanddatadevicemanager_p.h +++ b/src/plugins/platforms/wayland/qwaylanddatadevicemanager_p.h @@ -47,6 +47,8 @@ QT_BEGIN_NAMESPACE +namespace QtWaylandClient { + class QWaylandDisplay; class QWaylandDataDevice; class QWaylandDataSource; @@ -66,6 +68,8 @@ private: QWaylandDisplay *m_display; }; +} + QT_END_NAMESPACE #endif // QWAYLANDDATADEVICEMANAGER_H diff --git a/src/plugins/platforms/wayland/qwaylanddataoffer.cpp b/src/plugins/platforms/wayland/qwaylanddataoffer.cpp index 4ad73dc7e77..10bf2f1e1ba 100644 --- a/src/plugins/platforms/wayland/qwaylanddataoffer.cpp +++ b/src/plugins/platforms/wayland/qwaylanddataoffer.cpp @@ -51,6 +51,8 @@ QT_BEGIN_NAMESPACE +namespace QtWaylandClient { + QWaylandDataOffer::QWaylandDataOffer(QWaylandDisplay *display, struct ::wl_data_offer *offer) : QtWayland::wl_data_offer(offer) , m_mimeData(new QWaylandMimeData(this, display)) @@ -161,4 +163,6 @@ int QWaylandMimeData::readData(int fd, QByteArray &data) const return n; } +} + QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylanddataoffer_p.h b/src/plugins/platforms/wayland/qwaylanddataoffer_p.h index 12fc0a22f60..cdaf8a7bafc 100644 --- a/src/plugins/platforms/wayland/qwaylanddataoffer_p.h +++ b/src/plugins/platforms/wayland/qwaylanddataoffer_p.h @@ -49,6 +49,8 @@ QT_BEGIN_NAMESPACE +namespace QtWaylandClient { + class QWaylandDisplay; class QWaylandMimeData; @@ -91,6 +93,8 @@ private: mutable QHash m_data; }; +} + QT_END_NAMESPACE #endif diff --git a/src/plugins/platforms/wayland/qwaylanddatasource.cpp b/src/plugins/platforms/wayland/qwaylanddatasource.cpp index 3376db56748..cf92a361fb0 100644 --- a/src/plugins/platforms/wayland/qwaylanddatasource.cpp +++ b/src/plugins/platforms/wayland/qwaylanddatasource.cpp @@ -53,6 +53,8 @@ QT_BEGIN_NAMESPACE +namespace QtWaylandClient { + QWaylandDataSource::QWaylandDataSource(QWaylandDataDeviceManager *dataDeviceManager, QMimeData *mimeData) : QtWayland::wl_data_source(dataDeviceManager->create_data_source()) , m_mime_data(mimeData) @@ -93,4 +95,6 @@ void QWaylandDataSource::data_source_target(const QString &mime_type) Q_EMIT targetChanged(mime_type); } +} + QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylanddatasource_p.h b/src/plugins/platforms/wayland/qwaylanddatasource_p.h index a721336f7d8..09348f3354d 100644 --- a/src/plugins/platforms/wayland/qwaylanddatasource_p.h +++ b/src/plugins/platforms/wayland/qwaylanddatasource_p.h @@ -50,6 +50,9 @@ QT_BEGIN_NAMESPACE class QMimeData; + +namespace QtWaylandClient { + class QWaylandDataDeviceManager; class QWaylandDisplay; @@ -76,6 +79,8 @@ private: QMimeData *m_mime_data; }; +} + QT_END_NAMESPACE #endif // QWAYLANDDATASOURCE_H diff --git a/src/plugins/platforms/wayland/qwaylanddecorationfactory.cpp b/src/plugins/platforms/wayland/qwaylanddecorationfactory.cpp index 6f1f74693fe..4d36f7966ae 100644 --- a/src/plugins/platforms/wayland/qwaylanddecorationfactory.cpp +++ b/src/plugins/platforms/wayland/qwaylanddecorationfactory.cpp @@ -48,6 +48,8 @@ QT_BEGIN_NAMESPACE +namespace QtWaylandClient { + #ifndef QT_NO_LIBRARY Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader, (QWaylandDecorationFactoryInterface_iid, QLatin1String("/wayland-decoration-client"), Qt::CaseInsensitive)) @@ -94,4 +96,6 @@ QWaylandAbstractDecoration *QWaylandDecorationFactory::create(const QString &nam return 0; } +} + QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylanddecorationfactory_p.h b/src/plugins/platforms/wayland/qwaylanddecorationfactory_p.h index a7729bcafda..144ae101be9 100644 --- a/src/plugins/platforms/wayland/qwaylanddecorationfactory_p.h +++ b/src/plugins/platforms/wayland/qwaylanddecorationfactory_p.h @@ -47,6 +47,8 @@ QT_BEGIN_NAMESPACE +namespace QtWaylandClient { + class QWaylandAbstractDecoration; class Q_WAYLAND_CLIENT_EXPORT QWaylandDecorationFactory @@ -56,6 +58,8 @@ public: static QWaylandAbstractDecoration *create(const QString &name, const QStringList &args, const QString &pluginPath = QString()); }; +} + QT_END_NAMESPACE #endif // QWAYLANDDECORATIONFACTORY_H diff --git a/src/plugins/platforms/wayland/qwaylanddecorationplugin.cpp b/src/plugins/platforms/wayland/qwaylanddecorationplugin.cpp index edad5f5f0af..3c6463a1f5e 100644 --- a/src/plugins/platforms/wayland/qwaylanddecorationplugin.cpp +++ b/src/plugins/platforms/wayland/qwaylanddecorationplugin.cpp @@ -43,6 +43,8 @@ QT_BEGIN_NAMESPACE +namespace QtWaylandClient { + QWaylandDecorationPlugin::QWaylandDecorationPlugin(QObject *parent) : QObject(parent) { @@ -51,4 +53,6 @@ QWaylandDecorationPlugin::~QWaylandDecorationPlugin() { } +} + QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylanddecorationplugin_p.h b/src/plugins/platforms/wayland/qwaylanddecorationplugin_p.h index 6ed8935db2a..9425bd348e9 100644 --- a/src/plugins/platforms/wayland/qwaylanddecorationplugin_p.h +++ b/src/plugins/platforms/wayland/qwaylanddecorationplugin_p.h @@ -50,6 +50,8 @@ QT_BEGIN_NAMESPACE +namespace QtWaylandClient { + class QWaylandAbstractDecoration; #define QWaylandDecorationFactoryInterface_iid "org.qt-project.Qt.WaylandClient.QWaylandDecorationFactoryInterface.5.4" @@ -64,6 +66,8 @@ public: virtual QWaylandAbstractDecoration *create(const QString &key, const QStringList ¶mList) = 0; }; +} + QT_END_NAMESPACE #endif // QWAYLANDDECORATIONPLUGIN_H diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index a4d13db7178..ea7fe1a6a8b 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -76,6 +76,8 @@ QT_BEGIN_NAMESPACE +namespace QtWaylandClient { + struct wl_surface *QWaylandDisplay::createSurface(void *handle) { struct wl_surface *surface = mCompositor.create_surface(); @@ -371,4 +373,6 @@ bool QWaylandDisplay::supportsWindowDecoration() const return integrationSupport; } +} + QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylanddisplay_p.h b/src/plugins/platforms/wayland/qwaylanddisplay_p.h index 2f12ee7f9b3..9d4413f6fe6 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay_p.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay_p.h @@ -58,10 +58,22 @@ struct wl_cursor_image; QT_BEGIN_NAMESPACE class QAbstractEventDispatcher; -class QWaylandInputDevice; class QSocketNotifier; -class QWaylandBuffer; class QPlatformScreen; + +namespace QtWayland { + class qt_output_extension; + class qt_shell; + class qt_sub_surface_extension; + class qt_surface_extension; + class wl_text_input_manager; + class xdg_shell; +} + +namespace QtWaylandClient { + +class QWaylandInputDevice; +class QWaylandBuffer; class QWaylandScreen; class QWaylandClientBufferIntegration; class QWaylandWindowManagerIntegration; @@ -75,15 +87,6 @@ class QWaylandHardwareIntegration; class QWaylandXdgShell; class QWaylandShellSurface; -namespace QtWayland { - class qt_output_extension; - class qt_shell; - class qt_sub_surface_extension; - class qt_surface_extension; - class wl_text_input_manager; - class xdg_shell; -} - typedef void (*RegistryListener)(void *data, struct wl_registry *registry, uint32_t id, @@ -211,6 +214,8 @@ private: int32_t width, int32_t height); }; +} + QT_END_NAMESPACE #endif // QWAYLANDDISPLAY_H diff --git a/src/plugins/platforms/wayland/qwaylanddnd.cpp b/src/plugins/platforms/wayland/qwaylanddnd.cpp index 996e647ccdc..514383d300a 100644 --- a/src/plugins/platforms/wayland/qwaylanddnd.cpp +++ b/src/plugins/platforms/wayland/qwaylanddnd.cpp @@ -53,6 +53,8 @@ QT_BEGIN_NAMESPACE +namespace QtWaylandClient { + QWaylandDrag::QWaylandDrag(QWaylandDisplay *display) : m_display(display) { @@ -134,4 +136,6 @@ void QWaylandDrag::finishDrag(const QPlatformDropQtResponse &response) eventFilter(shapedPixmapWindow(), &event); } +} + QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylanddnd_p.h b/src/plugins/platforms/wayland/qwaylanddnd_p.h index 1d236fad565..0154f122ffd 100644 --- a/src/plugins/platforms/wayland/qwaylanddnd_p.h +++ b/src/plugins/platforms/wayland/qwaylanddnd_p.h @@ -52,6 +52,8 @@ QT_BEGIN_NAMESPACE +namespace QtWaylandClient { + class QWaylandDisplay; class Q_WAYLAND_CLIENT_EXPORT QWaylandDrag : public QBasicDrag @@ -78,6 +80,8 @@ private: QWaylandDisplay *m_display; }; +} + QT_END_NAMESPACE #endif // QWAYLANDDND_H diff --git a/src/plugins/platforms/wayland/qwaylandeventthread.cpp b/src/plugins/platforms/wayland/qwaylandeventthread.cpp index 22efd6a2a72..6cce6c19d69 100644 --- a/src/plugins/platforms/wayland/qwaylandeventthread.cpp +++ b/src/plugins/platforms/wayland/qwaylandeventthread.cpp @@ -50,6 +50,8 @@ QT_BEGIN_NAMESPACE +namespace QtWaylandClient { + QWaylandEventThread::QWaylandEventThread(QObject *parent) : QObject(parent) , m_display(0) @@ -117,4 +119,6 @@ wl_display *QWaylandEventThread::display() const return m_display; } +} + QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandeventthread_p.h b/src/plugins/platforms/wayland/qwaylandeventthread_p.h index 2df4b05c2e5..b96c97c2a99 100644 --- a/src/plugins/platforms/wayland/qwaylandeventthread_p.h +++ b/src/plugins/platforms/wayland/qwaylandeventthread_p.h @@ -52,6 +52,8 @@ QT_BEGIN_NAMESPACE class QSocketNotifier; +namespace QtWaylandClient { + class Q_WAYLAND_CLIENT_EXPORT QWaylandEventThread : public QObject { Q_OBJECT @@ -85,6 +87,8 @@ private: }; +} + QT_END_NAMESPACE #endif // QWAYLANDEVENTTHREAD_H diff --git a/src/plugins/platforms/wayland/qwaylandextendedoutput.cpp b/src/plugins/platforms/wayland/qwaylandextendedoutput.cpp index bb6a4779e90..26fba99e461 100644 --- a/src/plugins/platforms/wayland/qwaylandextendedoutput.cpp +++ b/src/plugins/platforms/wayland/qwaylandextendedoutput.cpp @@ -49,10 +49,13 @@ QT_BEGIN_NAMESPACE +namespace QtWaylandClient { + QWaylandExtendedOutput::QWaylandExtendedOutput(QWaylandScreen *screen, ::qt_extended_output *extended_output) : QtWayland::qt_extended_output(extended_output) { Q_UNUSED(screen); } +} QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandextendedoutput_p.h b/src/plugins/platforms/wayland/qwaylandextendedoutput_p.h index 35ac194a427..0ac24d606bd 100644 --- a/src/plugins/platforms/wayland/qwaylandextendedoutput_p.h +++ b/src/plugins/platforms/wayland/qwaylandextendedoutput_p.h @@ -47,6 +47,8 @@ QT_BEGIN_NAMESPACE +namespace QtWaylandClient { + class QWaylandDisplay; class QWaylandScreen; class QWaylandExtendedOutput; @@ -57,6 +59,8 @@ public: QWaylandExtendedOutput(QWaylandScreen *screen, struct ::qt_extended_output *extended_output); }; +} + QT_END_NAMESPACE #endif // QWAYLANDEXTENDEDOUTPUT_H diff --git a/src/plugins/platforms/wayland/qwaylandextendedsurface.cpp b/src/plugins/platforms/wayland/qwaylandextendedsurface.cpp index e589698ef6f..5cb5ec04997 100644 --- a/src/plugins/platforms/wayland/qwaylandextendedsurface.cpp +++ b/src/plugins/platforms/wayland/qwaylandextendedsurface.cpp @@ -53,6 +53,8 @@ QT_BEGIN_NAMESPACE +namespace QtWaylandClient { + QWaylandExtendedSurface::QWaylandExtendedSurface(QWaylandWindow *window) : QtWayland::qt_extended_surface(window->display()->windowExtension()->get_extended_surface(window->object())) , m_window(window) @@ -123,4 +125,6 @@ Qt::WindowFlags QWaylandExtendedSurface::setWindowFlags(Qt::WindowFlags flags) return flags & (Qt::WindowStaysOnTopHint | Qt::WindowOverridesSystemGestures | Qt::BypassWindowManagerHint); } +} + QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandextendedsurface_p.h b/src/plugins/platforms/wayland/qwaylandextendedsurface_p.h index 1d966292c58..fe0ea593844 100644 --- a/src/plugins/platforms/wayland/qwaylandextendedsurface_p.h +++ b/src/plugins/platforms/wayland/qwaylandextendedsurface_p.h @@ -52,6 +52,8 @@ QT_BEGIN_NAMESPACE +namespace QtWaylandClient { + class QWaylandDisplay; class QWaylandWindow; @@ -76,6 +78,8 @@ private: QVariantMap m_properties; }; +} + QT_END_NAMESPACE #endif // QWAYLANDEXTENDEDSURFACE_H diff --git a/src/plugins/platforms/wayland/qwaylandinputcontext.cpp b/src/plugins/platforms/wayland/qwaylandinputcontext.cpp index e189b945134..e2b346223ac 100644 --- a/src/plugins/platforms/wayland/qwaylandinputcontext.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputcontext.cpp @@ -52,6 +52,8 @@ QT_BEGIN_NAMESPACE +namespace QtWaylandClient { + static Qt::Key toQtKey(uint32_t sym) { #ifndef QT_NO_WAYLAND_XKB @@ -277,5 +279,7 @@ bool QWaylandInputContext::ensureTextInput() return true; } +} + QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandinputcontext_p.h b/src/plugins/platforms/wayland/qwaylandinputcontext_p.h index fbb26b9bf9d..02dd512a289 100644 --- a/src/plugins/platforms/wayland/qwaylandinputcontext_p.h +++ b/src/plugins/platforms/wayland/qwaylandinputcontext_p.h @@ -47,6 +47,8 @@ QT_BEGIN_NAMESPACE +namespace QtWaylandClient { + class QWaylandDisplay; class QWaylandTextInput : public QtWayland::wl_text_input @@ -99,6 +101,8 @@ private: QScopedPointer mTextInput; }; +} + QT_END_NAMESPACE #endif // QWAYLANDINPUTCONTEXT_H diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index ada2cf2b5a4..6b6abfe5f18 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -65,6 +65,8 @@ QT_BEGIN_NAMESPACE +namespace QtWaylandClient { + QWaylandInputDevice::Keyboard::Keyboard(QWaylandInputDevice *p) : mParent(p) , mFocus(0) @@ -973,4 +975,6 @@ void QWaylandInputDevice::Touch::touch_frame() mTouchPoints.clear(); } +} + QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h index a5da8bd0fee..238e5964ab3 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h +++ b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h @@ -66,6 +66,7 @@ struct wl_cursor_image; QT_BEGIN_NAMESPACE +namespace QtWaylandClient { class QWaylandWindow; class QWaylandDisplay; @@ -284,6 +285,8 @@ public: Qt::KeyboardModifiers modifiers; }; +} + QT_END_NAMESPACE #endif diff --git a/src/plugins/platforms/wayland/qwaylandintegration.cpp b/src/plugins/platforms/wayland/qwaylandintegration.cpp index 27613eef714..60dc1b49254 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandintegration.cpp @@ -82,6 +82,8 @@ QT_BEGIN_NAMESPACE +namespace QtWaylandClient { + class GenericWaylandTheme: public QGenericUnixTheme { public: @@ -395,4 +397,6 @@ void QWaylandIntegration::initializeInputDeviceIntegration() } } +} + QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandintegration_p.h b/src/plugins/platforms/wayland/qwaylandintegration_p.h index c0909418e76..745b88a6f88 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration_p.h +++ b/src/plugins/platforms/wayland/qwaylandintegration_p.h @@ -47,6 +47,8 @@ #include QT_BEGIN_NAMESPACE +namespace QtWaylandClient { + class QWaylandBuffer; class QWaylandDisplay; class QWaylandClientBufferIntegration; @@ -125,6 +127,8 @@ private: friend class QWaylandDisplay; }; +} + QT_END_NAMESPACE #endif diff --git a/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp b/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp index b4bb0604dba..c4878e54064 100644 --- a/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp +++ b/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp @@ -53,6 +53,8 @@ QT_BEGIN_NAMESPACE +namespace QtWaylandClient { + QWaylandNativeInterface::QWaylandNativeInterface(QWaylandIntegration *integration) : m_integration(integration) { @@ -147,4 +149,6 @@ void QWaylandNativeInterface::emitWindowPropertyChanged(QPlatformWindow *window, emit windowPropertyChanged(window,name); } +} + QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandnativeinterface_p.h b/src/plugins/platforms/wayland/qwaylandnativeinterface_p.h index 9d0aafdd595..6f6a62b76b8 100644 --- a/src/plugins/platforms/wayland/qwaylandnativeinterface_p.h +++ b/src/plugins/platforms/wayland/qwaylandnativeinterface_p.h @@ -49,6 +49,8 @@ QT_BEGIN_NAMESPACE +namespace QtWaylandClient { + class QWaylandIntegration; class QWaylandScreen; @@ -75,6 +77,8 @@ private: QHash m_windowProperties; }; +} + QT_END_NAMESPACE #endif // QWAYLANDNATIVEINTERFACE_H diff --git a/src/plugins/platforms/wayland/qwaylandqtkey.cpp b/src/plugins/platforms/wayland/qwaylandqtkey.cpp index 16562357f00..1eda126cfe0 100644 --- a/src/plugins/platforms/wayland/qwaylandqtkey.cpp +++ b/src/plugins/platforms/wayland/qwaylandqtkey.cpp @@ -45,6 +45,8 @@ QT_BEGIN_NAMESPACE +namespace QtWaylandClient { + QWaylandQtKeyExtension::QWaylandQtKeyExtension(QWaylandDisplay *display, uint32_t id) : QtWayland::qt_key_extension(display->wl_registry(), id, 2) , m_display(display) @@ -83,4 +85,6 @@ void QWaylandQtKeyExtension::key_extension_qtkey(struct wl_surface *surface, autorep, count); } +} + QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandqtkey_p.h b/src/plugins/platforms/wayland/qwaylandqtkey_p.h index d00a90ee032..f705775c4ad 100644 --- a/src/plugins/platforms/wayland/qwaylandqtkey_p.h +++ b/src/plugins/platforms/wayland/qwaylandqtkey_p.h @@ -49,6 +49,8 @@ QT_BEGIN_NAMESPACE +namespace QtWaylandClient { + class QWaylandDisplay; class Q_WAYLAND_CLIENT_EXPORT QWaylandQtKeyExtension : public QtWayland::qt_key_extension @@ -73,6 +75,8 @@ private: }; +} + QT_END_NAMESPACE #endif // QWAYLANDQTKEY_H diff --git a/src/plugins/platforms/wayland/qwaylandscreen.cpp b/src/plugins/platforms/wayland/qwaylandscreen.cpp index 675c8404236..a1aff8d1cf5 100644 --- a/src/plugins/platforms/wayland/qwaylandscreen.cpp +++ b/src/plugins/platforms/wayland/qwaylandscreen.cpp @@ -53,6 +53,8 @@ QT_BEGIN_NAMESPACE +namespace QtWaylandClient { + QWaylandScreen::QWaylandScreen(QWaylandDisplay *waylandDisplay, int version, uint32_t id) : QPlatformScreen() , QtWayland::wl_output(waylandDisplay->wl_registry(), id, qMin(version, 2)) @@ -242,4 +244,6 @@ void QWaylandScreen::output_done() QWindowSystemInterface::handleScreenRefreshRateChange(screen(), refreshRate()); } +} + QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandscreen_p.h b/src/plugins/platforms/wayland/qwaylandscreen_p.h index d0c5d710fe4..c337d9be3c1 100644 --- a/src/plugins/platforms/wayland/qwaylandscreen_p.h +++ b/src/plugins/platforms/wayland/qwaylandscreen_p.h @@ -49,6 +49,8 @@ QT_BEGIN_NAMESPACE +namespace QtWaylandClient { + class QWaylandDisplay; class QWaylandCursor; class QWaylandExtendedOutput; @@ -116,6 +118,8 @@ private: QWaylandCursor *mWaylandCursor; }; +} + QT_END_NAMESPACE #endif // QWAYLANDSCREEN_H diff --git a/src/plugins/platforms/wayland/qwaylandshellsurface.cpp b/src/plugins/platforms/wayland/qwaylandshellsurface.cpp index a3855dac0d6..997d4ac5bac 100644 --- a/src/plugins/platforms/wayland/qwaylandshellsurface.cpp +++ b/src/plugins/platforms/wayland/qwaylandshellsurface.cpp @@ -43,6 +43,10 @@ #include "qwaylandwindow_p.h" #include "qwaylandextendedsurface_p.h" +QT_BEGIN_NAMESPACE + +namespace QtWaylandClient { + QWaylandShellSurface::QWaylandShellSurface(QWaylandWindow *window) : m_window(window) { @@ -58,3 +62,7 @@ void QWaylandShellSurface::sendProperty(const QString &name, const QVariant &val Q_UNUSED(name) Q_UNUSED(value) } + +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandshellsurface_p.h b/src/plugins/platforms/wayland/qwaylandshellsurface_p.h index 6f2336162c2..28e55be3541 100644 --- a/src/plugins/platforms/wayland/qwaylandshellsurface_p.h +++ b/src/plugins/platforms/wayland/qwaylandshellsurface_p.h @@ -52,9 +52,12 @@ QT_BEGIN_NAMESPACE class QVariant; +class QWindow; + +namespace QtWaylandClient { + class QWaylandWindow; class QWaylandInputDevice; -class QWindow; class Q_WAYLAND_CLIENT_EXPORT QWaylandShellSurface { @@ -94,6 +97,8 @@ private: friend class QWaylandWindow; }; +} + QT_END_NAMESPACE #endif // QWAYLANDSHELLSURFACE_H diff --git a/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp b/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp index 9bb36fdc76f..64e93d94713 100644 --- a/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp +++ b/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp @@ -56,6 +56,8 @@ QT_BEGIN_NAMESPACE +namespace QtWaylandClient { + QWaylandShmBuffer::QWaylandShmBuffer(QWaylandDisplay *display, const QSize &size, QImage::Format format, int scale) : mMarginsImage(0) @@ -372,4 +374,6 @@ const struct wl_callback_listener QWaylandShmBackingStore::frameCallbackListener QWaylandShmBackingStore::done }; +} + QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandshmbackingstore_p.h b/src/plugins/platforms/wayland/qwaylandshmbackingstore_p.h index 397d6bdbf16..a6db31c9817 100644 --- a/src/plugins/platforms/wayland/qwaylandshmbackingstore_p.h +++ b/src/plugins/platforms/wayland/qwaylandshmbackingstore_p.h @@ -51,6 +51,8 @@ QT_BEGIN_NAMESPACE +namespace QtWaylandClient { + class QWaylandDisplay; class QWaylandAbstractDecoration; class QWaylandWindow; @@ -120,6 +122,8 @@ private: struct wl_callback *mFrameCallback; }; +} + QT_END_NAMESPACE #endif diff --git a/src/plugins/platforms/wayland/qwaylandshmwindow.cpp b/src/plugins/platforms/wayland/qwaylandshmwindow.cpp index 431ed2fdb97..d2599370a78 100644 --- a/src/plugins/platforms/wayland/qwaylandshmwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandshmwindow.cpp @@ -49,6 +49,8 @@ QT_BEGIN_NAMESPACE +namespace QtWaylandClient { + QWaylandShmWindow::QWaylandShmWindow(QWindow *window) : QWaylandWindow(window) { @@ -63,4 +65,6 @@ QWaylandWindow::WindowType QWaylandShmWindow::windowType() const return QWaylandWindow::Shm; } +} + QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandshmwindow_p.h b/src/plugins/platforms/wayland/qwaylandshmwindow_p.h index 47ee742699d..1c0c5c15efc 100644 --- a/src/plugins/platforms/wayland/qwaylandshmwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandshmwindow_p.h @@ -47,6 +47,8 @@ QT_BEGIN_NAMESPACE +namespace QtWaylandClient { + class Q_WAYLAND_CLIENT_EXPORT QWaylandShmWindow : public QWaylandWindow { public: @@ -57,6 +59,8 @@ public: QSurfaceFormat format() const { return QSurfaceFormat(); } }; +} + QT_END_NAMESPACE #endif // QWAYLANDSHMWINDOW_H diff --git a/src/plugins/platforms/wayland/qwaylandsubsurface.cpp b/src/plugins/platforms/wayland/qwaylandsubsurface.cpp index 6db59fa206c..19ba3248db3 100644 --- a/src/plugins/platforms/wayland/qwaylandsubsurface.cpp +++ b/src/plugins/platforms/wayland/qwaylandsubsurface.cpp @@ -47,6 +47,8 @@ QT_BEGIN_NAMESPACE +namespace QtWaylandClient { + QWaylandSubSurface::QWaylandSubSurface(QWaylandWindow *window, struct ::qt_sub_surface *sub_surface) : QtWayland::qt_sub_surface(sub_surface) , m_window(window) @@ -88,4 +90,6 @@ void QWaylandSubSurface::adjustPositionOfChildren() setPositionToParent(m_window); } +} + QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandsubsurface_p.h b/src/plugins/platforms/wayland/qwaylandsubsurface_p.h index bd0da96d214..93b767352b7 100644 --- a/src/plugins/platforms/wayland/qwaylandsubsurface_p.h +++ b/src/plugins/platforms/wayland/qwaylandsubsurface_p.h @@ -52,6 +52,8 @@ QT_BEGIN_NAMESPACE +namespace QtWaylandClient { + class QWaylandDisplay; class QWaylandWindow; class QWaylandSubSurface; @@ -70,4 +72,6 @@ private: QT_END_NAMESPACE +} + #endif // QWAYLANDSUBSURFACE_H diff --git a/src/plugins/platforms/wayland/qwaylandtouch.cpp b/src/plugins/platforms/wayland/qwaylandtouch.cpp index 3dabd1ea504..f2b85c225cd 100644 --- a/src/plugins/platforms/wayland/qwaylandtouch.cpp +++ b/src/plugins/platforms/wayland/qwaylandtouch.cpp @@ -45,6 +45,8 @@ QT_BEGIN_NAMESPACE +namespace QtWaylandClient { + QWaylandTouchExtension::QWaylandTouchExtension(QWaylandDisplay *display, uint32_t id) : QtWayland::qt_touch_extension(display->wl_registry(), id, 1), mDisplay(display), @@ -207,4 +209,6 @@ void QWaylandTouchExtension::touch_extension_configure(uint32_t flags) mFlags = flags; } +} + QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandtouch_p.h b/src/plugins/platforms/wayland/qwaylandtouch_p.h index 20827fa8f94..bbe15992999 100644 --- a/src/plugins/platforms/wayland/qwaylandtouch_p.h +++ b/src/plugins/platforms/wayland/qwaylandtouch_p.h @@ -49,6 +49,8 @@ QT_BEGIN_NAMESPACE +namespace QtWaylandClient { + class QWaylandDisplay; class QWaylandInputDevice; @@ -95,6 +97,8 @@ private: QWaylandInputDevice *mInputDevice; }; +} + QT_END_NAMESPACE #endif // QWAYLANDTOUCH_H diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 08a123b61ce..cf4e0e67218 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -67,6 +67,8 @@ QT_BEGIN_NAMESPACE +namespace QtWaylandClient { + QWaylandWindow *QWaylandWindow::mMouseGrab = 0; QWaylandWindow::QWaylandWindow(QWindow *window) @@ -809,4 +811,6 @@ QVariant QWaylandWindow::property(const QString &name, const QVariant &defaultVa return m_properties.value(name, defaultValue); } +} + QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index 2650f46d17c..de59e4e20b6 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -56,6 +56,8 @@ struct wl_egl_window; QT_BEGIN_NAMESPACE +namespace QtWaylandClient { + class QWaylandDisplay; class QWaylandBuffer; class QWaylandShellSurface; @@ -253,4 +255,6 @@ inline QPoint QWaylandWindow::attachOffset() const QT_END_NAMESPACE +} + #endif // QWAYLANDWINDOW_H diff --git a/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration.cpp b/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration.cpp index 174ef93a548..44f93815e71 100644 --- a/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration.cpp @@ -57,6 +57,8 @@ QT_BEGIN_NAMESPACE +namespace QtWaylandClient { + class QWaylandWindowManagerIntegrationPrivate { public: QWaylandWindowManagerIntegrationPrivate(QWaylandDisplay *waylandDisplay); @@ -157,4 +159,6 @@ bool QWaylandWindowManagerIntegration::openDocument(const QUrl &url) return true; } +} + QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration_p.h b/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration_p.h index 0ad2e38dfb3..4ecad94e023 100644 --- a/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration_p.h @@ -53,6 +53,8 @@ QT_BEGIN_NAMESPACE +namespace QtWaylandClient { + class QWaylandWindow; class QWaylandDisplay; @@ -87,4 +89,6 @@ private: QT_END_NAMESPACE +} + #endif // QWAYLANDWINDOWMANAGERINTEGRATION_H diff --git a/src/plugins/platforms/wayland/qwaylandwlshellsurface.cpp b/src/plugins/platforms/wayland/qwaylandwlshellsurface.cpp index 86115fa38b2..550e6caebb1 100644 --- a/src/plugins/platforms/wayland/qwaylandwlshellsurface.cpp +++ b/src/plugins/platforms/wayland/qwaylandwlshellsurface.cpp @@ -52,6 +52,8 @@ QT_BEGIN_NAMESPACE +namespace QtWaylandClient { + QWaylandWlShellSurface::QWaylandWlShellSurface(struct ::wl_shell_surface *shell_surface, QWaylandWindow *window) : QtWayland::wl_shell_surface(shell_surface) , QWaylandShellSurface(window) @@ -219,4 +221,6 @@ void QWaylandWlShellSurface::shell_surface_popup_done() QCoreApplication::postEvent(m_window->window(), new QCloseEvent()); } +} + QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandwlshellsurface_p.h b/src/plugins/platforms/wayland/qwaylandwlshellsurface_p.h index 8d6e298b9da..54917b56052 100644 --- a/src/plugins/platforms/wayland/qwaylandwlshellsurface_p.h +++ b/src/plugins/platforms/wayland/qwaylandwlshellsurface_p.h @@ -52,9 +52,12 @@ QT_BEGIN_NAMESPACE +class QWindow; + +namespace QtWaylandClient { + class QWaylandWindow; class QWaylandInputDevice; -class QWindow; class QWaylandExtendedSurface; class Q_WAYLAND_CLIENT_EXPORT QWaylandWlShellSurface : public QtWayland::wl_shell_surface @@ -106,4 +109,6 @@ private: QT_END_NAMESPACE +} + #endif // QWAYLANDSHELLSURFACE_H diff --git a/src/plugins/platforms/wayland/qwaylandxdgshell.cpp b/src/plugins/platforms/wayland/qwaylandxdgshell.cpp index f31d63f4266..20a6da5e596 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgshell.cpp +++ b/src/plugins/platforms/wayland/qwaylandxdgshell.cpp @@ -50,6 +50,8 @@ QT_BEGIN_NAMESPACE +namespace QtWaylandClient { + QWaylandXdgShell::QWaylandXdgShell(struct ::xdg_shell *shell) : QtWayland::xdg_shell(shell) { @@ -72,5 +74,6 @@ void QWaylandXdgShell::xdg_shell_ping(uint32_t serial) pong(serial); } +} QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandxdgshell_p.h b/src/plugins/platforms/wayland/qwaylandxdgshell_p.h index 6a396bd1178..f2e2e7bb409 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgshell_p.h +++ b/src/plugins/platforms/wayland/qwaylandxdgshell_p.h @@ -52,9 +52,12 @@ QT_BEGIN_NAMESPACE +class QWindow; + +namespace QtWaylandClient { + class QWaylandWindow; class QWaylandInputDevice; -class QWindow; class Q_WAYLAND_CLIENT_EXPORT QWaylandXdgShell : public QtWayland::xdg_shell { @@ -70,4 +73,6 @@ private: QT_END_NAMESPACE +} + #endif // QWAYLANDXDGSHELL_H diff --git a/src/plugins/platforms/wayland/qwaylandxdgsurface.cpp b/src/plugins/platforms/wayland/qwaylandxdgsurface.cpp index 7f0c7f418f6..611a01bb69b 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgsurface.cpp +++ b/src/plugins/platforms/wayland/qwaylandxdgsurface.cpp @@ -51,6 +51,8 @@ QT_BEGIN_NAMESPACE +namespace QtWaylandClient { + QWaylandXdgSurface::QWaylandXdgSurface(struct ::xdg_surface *xdg_surface, QWaylandWindow *window) : QtWayland::xdg_surface(xdg_surface) , QWaylandShellSurface(window) @@ -240,4 +242,6 @@ void QWaylandXdgSurface::xdg_surface_close() { } +} + QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandxdgsurface_p.h b/src/plugins/platforms/wayland/qwaylandxdgsurface_p.h index c5ae9c792c5..862e177a1f2 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgsurface_p.h +++ b/src/plugins/platforms/wayland/qwaylandxdgsurface_p.h @@ -53,9 +53,12 @@ QT_BEGIN_NAMESPACE +class QWindow; + +namespace QtWaylandClient { + class QWaylandWindow; class QWaylandInputDevice; -class QWindow; class QWaylandExtendedSurface; class Q_WAYLAND_CLIENT_EXPORT QWaylandXdgSurface : public QtWayland::xdg_surface @@ -114,4 +117,6 @@ private: QT_END_NAMESPACE +} + #endif // QWAYLANDXDGSURFACE_H diff --git a/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegration_p.h b/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegration_p.h index 45a78199cb4..31fa98edb1e 100644 --- a/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegration_p.h +++ b/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegration_p.h @@ -47,6 +47,8 @@ QT_BEGIN_NAMESPACE +namespace QtWaylandClient { + class QWaylandWindow; class QWaylandDisplay; class QWaylandShellSurface; @@ -61,6 +63,8 @@ public: virtual QWaylandShellSurface *createShellSurface(QWaylandWindow *window) = 0; }; +} + QT_END_NAMESPACE #endif // QWAYLANDSHELLINTEGRATION_H diff --git a/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationfactory.cpp b/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationfactory.cpp index f780409e1fa..4af65d4c074 100644 --- a/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationfactory.cpp +++ b/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationfactory.cpp @@ -48,6 +48,8 @@ QT_BEGIN_NAMESPACE +namespace QtWaylandClient { + #ifndef QT_NO_LIBRARY Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader, (QWaylandShellIntegrationFactoryInterface_iid, QLatin1String("/wayland-shell-integration"), Qt::CaseInsensitive)) @@ -93,4 +95,6 @@ QWaylandShellIntegration *QWaylandShellIntegrationFactory::create(const QString return Q_NULLPTR; } +} + QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationfactory_p.h b/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationfactory_p.h index 415067ef8c1..3b7fa357dc3 100644 --- a/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationfactory_p.h +++ b/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationfactory_p.h @@ -47,6 +47,8 @@ QT_BEGIN_NAMESPACE +namespace QtWaylandClient { + class QWaylandShellIntegration; class Q_WAYLAND_CLIENT_EXPORT QWaylandShellIntegrationFactory @@ -56,6 +58,8 @@ public: static QWaylandShellIntegration *create(const QString &name, const QStringList &args, const QString &pluginPath = QString()); }; +} + QT_END_NAMESPACE #endif // QWAYLANDSHELLINTEGRATIONFACTORY_H diff --git a/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationplugin.cpp b/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationplugin.cpp index 05b5e91ad59..bbca1558d35 100644 --- a/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationplugin.cpp +++ b/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationplugin.cpp @@ -43,6 +43,8 @@ QT_BEGIN_NAMESPACE +namespace QtWaylandClient { + QWaylandShellIntegrationPlugin::QWaylandShellIntegrationPlugin(QObject *parent) : QObject(parent) { @@ -52,4 +54,6 @@ QWaylandShellIntegrationPlugin::~QWaylandShellIntegrationPlugin() { } +} + QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationplugin_p.h b/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationplugin_p.h index 7d01fb4e598..07438e7a6f6 100644 --- a/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationplugin_p.h +++ b/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationplugin_p.h @@ -50,6 +50,8 @@ QT_BEGIN_NAMESPACE +namespace QtWaylandClient { + class QWaylandShellIntegration; #define QWaylandShellIntegrationFactoryInterface_iid "org.qt-project.Qt.WaylandClient.QWaylandShellIntegrationFactoryInterface.5.3" @@ -64,6 +66,8 @@ public: virtual QWaylandShellIntegration *create(const QString &key, const QStringList ¶mList) = 0; }; +} + QT_END_NAMESPACE #endif // QWAYLANDSHELLINTEGRATIONPLUGIN_H From 5d36ed33c706a52464ebf100480b07b01a54c5a8 Mon Sep 17 00:00:00 2001 From: Giulio Camuffo Date: Tue, 27 Jan 2015 19:44:52 +0200 Subject: [PATCH 0208/1507] Fix pasting from sources advertising the utf8 charset Some clients use "text/plain;charset=utf8" as the mimetype for the clipboard instead of just "text/plain". Since we support Utf8 accept it as a valid type. Change-Id: Icd540f0ff507ed9917b374f3b40fbdc259ce9ee2 Reviewed-by: Robin Burchell --- .../platforms/wayland/qwaylanddataoffer.cpp | 25 ++++++++++++++++--- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylanddataoffer.cpp b/src/plugins/platforms/wayland/qwaylanddataoffer.cpp index 4ad73dc7e77..ab3642bf47c 100644 --- a/src/plugins/platforms/wayland/qwaylanddataoffer.cpp +++ b/src/plugins/platforms/wayland/qwaylanddataoffer.cpp @@ -51,6 +51,11 @@ QT_BEGIN_NAMESPACE +static QString utf8Text() +{ + return QStringLiteral("text/plain;charset=utf-8"); +} + QWaylandDataOffer::QWaylandDataOffer(QWaylandDisplay *display, struct ::wl_data_offer *offer) : QtWayland::wl_data_offer(offer) , m_mimeData(new QWaylandMimeData(this, display)) @@ -100,7 +105,13 @@ void QWaylandMimeData::appendFormat(const QString &mimeType) bool QWaylandMimeData::hasFormat_sys(const QString &mimeType) const { - return m_types.contains(mimeType); + if (m_types.contains(mimeType)) + return true; + + if (mimeType == QStringLiteral("text/plain") && m_types.contains(utf8Text())) + return true; + + return false; } QStringList QWaylandMimeData::formats_sys() const @@ -115,8 +126,14 @@ QVariant QWaylandMimeData::retrieveData_sys(const QString &mimeType, QVariant::T if (m_data.contains(mimeType)) return m_data.value(mimeType); - if (!m_types.contains(mimeType)) - return QVariant(); + QString mime = mimeType; + + if (!m_types.contains(mimeType)) { + if (mimeType == QStringLiteral("text/plain") && m_types.contains(utf8Text())) + mime = utf8Text(); + else + return QVariant(); + } int pipefd[2]; if (::pipe2(pipefd, O_CLOEXEC|O_NONBLOCK) == -1) { @@ -124,7 +141,7 @@ QVariant QWaylandMimeData::retrieveData_sys(const QString &mimeType, QVariant::T return QVariant(); } - m_dataOffer->receive(mimeType, pipefd[1]); + m_dataOffer->receive(mime, pipefd[1]); m_display->flushRequests(); close(pipefd[1]); From f58cc97806d7adb85849fec8b1a56bb48756022f Mon Sep 17 00:00:00 2001 From: Giulio Camuffo Date: Thu, 29 Jan 2015 21:10:25 +0200 Subject: [PATCH 0209/1507] Send mouse events with the correct modifiers Change-Id: I33da2681bc2315b3dc7de16fa80c45e26a478caa Reviewed-by: Robin Burchell --- src/plugins/platforms/wayland/qwaylandinputdevice.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index 39d1705c0c7..30bc6029ba9 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -419,7 +419,7 @@ void QWaylandInputDevice::Pointer::pointer_enter(uint32_t serial, struct wl_surf QWaylandWindow *grab = QWaylandWindow::mouseGrab(); if (!grab) { window->handleMouseEnter(mParent); - window->handleMouse(mParent, mParent->mTime, mSurfacePos, mGlobalPos, mButtons, Qt::NoModifier); + window->handleMouse(mParent, mParent->mTime, mSurfacePos, mGlobalPos, mButtons, mParent->modifiers()); } } @@ -468,9 +468,9 @@ void QWaylandInputDevice::Pointer::pointer_motion(uint32_t time, wl_fixed_t surf // so we just set it outside of the window boundaries. pos = QPointF(-1, -1); global = grab->window()->mapToGlobal(pos.toPoint()); - grab->handleMouse(mParent, time, pos, global, mButtons, Qt::NoModifier); + grab->handleMouse(mParent, time, pos, global, mButtons, mParent->modifiers()); } else - window->handleMouse(mParent, time, mSurfacePos, mGlobalPos, mButtons, Qt::NoModifier); + window->handleMouse(mParent, time, mSurfacePos, mGlobalPos, mButtons, mParent->modifiers()); } void QWaylandInputDevice::Pointer::pointer_button(uint32_t serial, uint32_t time, @@ -514,9 +514,9 @@ void QWaylandInputDevice::Pointer::pointer_button(uint32_t serial, uint32_t time if (grab && grab != mFocus) { QPointF pos = QPointF(-1, -1); QPointF global = grab->window()->mapToGlobal(pos.toPoint()); - grab->handleMouse(mParent, time, pos, global, mButtons, Qt::NoModifier); + grab->handleMouse(mParent, time, pos, global, mButtons, mParent->modifiers()); } else if (window) - window->handleMouse(mParent, time, mSurfacePos, mGlobalPos, mButtons, Qt::NoModifier); + window->handleMouse(mParent, time, mSurfacePos, mGlobalPos, mButtons, mParent->modifiers()); } void QWaylandInputDevice::Pointer::pointer_axis(uint32_t time, uint32_t axis, int32_t value) From d62f2bc4e7596a7ec74aa405f1282e9ade7fe817 Mon Sep 17 00:00:00 2001 From: Giulio Camuffo Date: Fri, 30 Jan 2015 19:31:00 +0200 Subject: [PATCH 0210/1507] Make all the screens virtual siblings Wayland outputs fit the definition of virtual sibling screens so make the platform screen subclass so. Change-Id: Id3f2592653f6309406185589f70127f2b74065ac Reviewed-by: Laszlo Agocs --- src/plugins/platforms/wayland/qwaylandscreen.cpp | 8 ++++++++ src/plugins/platforms/wayland/qwaylandscreen_p.h | 1 + 2 files changed, 9 insertions(+) diff --git a/src/plugins/platforms/wayland/qwaylandscreen.cpp b/src/plugins/platforms/wayland/qwaylandscreen.cpp index 6e48c442e43..ad10b7a0264 100644 --- a/src/plugins/platforms/wayland/qwaylandscreen.cpp +++ b/src/plugins/platforms/wayland/qwaylandscreen.cpp @@ -113,6 +113,14 @@ QDpi QWaylandScreen::logicalDpi() const return QPlatformScreen::logicalDpi(); } +QList QWaylandScreen::virtualSiblings() const +{ + QList list; + foreach (QWaylandScreen *screen, mWaylandDisplay->screens()) + list << screen; + return list; +} + void QWaylandScreen::setOrientationUpdateMask(Qt::ScreenOrientations mask) { foreach (QWindow *window, QGuiApplication::allWindows()) { diff --git a/src/plugins/platforms/wayland/qwaylandscreen_p.h b/src/plugins/platforms/wayland/qwaylandscreen_p.h index d3173e0c9a1..9338c2717c1 100644 --- a/src/plugins/platforms/wayland/qwaylandscreen_p.h +++ b/src/plugins/platforms/wayland/qwaylandscreen_p.h @@ -68,6 +68,7 @@ public: QSizeF physicalSize() const Q_DECL_OVERRIDE; QDpi logicalDpi() const Q_DECL_OVERRIDE; + QList virtualSiblings() const Q_DECL_OVERRIDE; void setOrientationUpdateMask(Qt::ScreenOrientations mask); From ce491e5dd02ca9bd83412bdba23984d4c65df28b Mon Sep 17 00:00:00 2001 From: Giulio Camuffo Date: Tue, 3 Feb 2015 14:37:25 +0200 Subject: [PATCH 0211/1507] Update the protocol to 1.4 and raise the required libwayland version Wayland 1.4 introduces wl_subsurface which is quite an important addition. Change-Id: I48375f60adce556c9989872319f4d073e4a7b13b Reviewed-by: Robin Burchell --- src/3rdparty/wayland/protocols/wayland.xml | 336 +++++++++++++++++- .../platforms/wayland/qwaylandinputdevice.cpp | 18 +- .../platforms/wayland/qwaylandinputdevice_p.h | 1 + 3 files changed, 334 insertions(+), 21 deletions(-) diff --git a/src/3rdparty/wayland/protocols/wayland.xml b/src/3rdparty/wayland/protocols/wayland.xml index 1442b6a03f4..bf6acd1d0ef 100644 --- a/src/3rdparty/wayland/protocols/wayland.xml +++ b/src/3rdparty/wayland/protocols/wayland.xml @@ -4,6 +4,7 @@ Copyright © 2008-2011 Kristian Høgsberg Copyright © 2010-2011 Intel Corporation + Copyright © 2012-2013 Collabora, Ltd. Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted @@ -38,12 +39,14 @@ The sync request asks the server to emit the 'done' event on the returned wl_callback object. Since requests are handled in-order and events are delivered in-order, this can - used as a barrier to ensure all previous requests and the + be used as a barrier to ensure all previous requests and the resulting events have been handled. The object returned by this request will be destroyed by the compositor after the callback is fired and as such the client must not attempt to use it after that point. + + The callback_data passed in the callback is the event serial. @@ -54,7 +57,7 @@ to list and bind the global objects available from the compositor. - + @@ -169,7 +172,7 @@ Notify the client when the related request is done. - + @@ -274,10 +277,73 @@ - This describes the memory layout of an individual pixel. + This describes the memory layout of an individual pixel. + + All renderers should support argb8888 and xrgb8888 but any other + formats are optional and may not be supported by the particular + renderer in use. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -521,7 +587,7 @@ This event is sent when an active drag-and-drop pointer enters a surface owned by the client. The position of the pointer at - enter time is provided by the x an y arguments, in surface + enter time is provided by the x and y arguments, in surface local coordinates. @@ -544,7 +610,7 @@ This event is sent when the drag-and-drop pointer moves within the currently focused surface. The new position of the pointer - is provided by the x an y arguments, in surface local + is provided by the x and y arguments, in surface local coordinates. @@ -577,7 +643,7 @@ - The wl_data_device_manager is a a singleton global object that + The wl_data_device_manager is a singleton global object that provides access to inter-client data transfer mechanisms such as copy-and-paste and drag-and-drop. These mechanisms are tied to a wl_seat and this interface lets a client get a wl_data_device @@ -846,9 +912,9 @@ Set a class for the surface. The surface class identifies the general class of applications - to which the surface belongs. A common convention is to use - the file name (full path if non-standard location) of the - applications .desktop file as the class. + to which the surface belongs. A common convention is to use the + file name (or the full path if it is a non-standard location) of + the application's .desktop file as the class. @@ -890,7 +956,7 @@ The popup_done event is sent out when a popup grab is broken, - that is, when the users clicks a surface that doesn't belong + that is, when the user clicks a surface that doesn't belong to the client owning the popup surface. @@ -952,10 +1018,10 @@ Destroying the wl_buffer after wl_buffer.release does not change the surface contents. However, if the client destroys the - wl_buffer before receiving wl_buffer.release, the surface + wl_buffer before receiving the wl_buffer.release event, the surface contents become undefined immediately. - Only if wl_surface.attach is sent with a NULL wl_buffer, the + If wl_surface.attach is sent with a NULL wl_buffer, the following wl_surface.commit will remove the surface content. @@ -1012,6 +1078,9 @@ The object returned by this request will be destroyed by the compositor after the callback is fired and as such the client must not attempt to use it after that point. + + The callback_data passed in the callback is the current time, in + milliseconds. @@ -1172,7 +1241,7 @@ - + A seat is a group of keyboards, pointer and touch devices. This object is published as a global during start up, or when such a @@ -1245,7 +1314,7 @@ - + The wl_pointer interface represents one or more input devices, such as mice, which control the pointer location and pointer_focus @@ -1294,6 +1363,10 @@ + + + + Notification that this seat's pointer is focused on a certain @@ -1393,12 +1466,16 @@ - + The wl_keyboard interface represents one or more keyboards associated with a seat. + + + + This specifies the format of the keymap provided to the @@ -1476,7 +1553,7 @@ - + The wl_touch interface represents a touchscreen associated with a seat. @@ -1488,6 +1565,10 @@ contact point can be identified by the ID of the sequence. + + + + A new touch point has appeared on the surface. This touch point is @@ -1720,4 +1801,225 @@ + + + The global interface exposing sub-surface compositing capabilities. + A wl_surface, that has sub-surfaces associated, is called the + parent surface. Sub-surfaces can be arbitrarily nested and create + a tree of sub-surfaces. + + The root surface in a tree of sub-surfaces is the main + surface. The main surface cannot be a sub-surface, because + sub-surfaces must always have a parent. + + A main surface with its sub-surfaces forms a (compound) window. + For window management purposes, this set of wl_surface objects is + to be considered as a single window, and it should also behave as + such. + + The aim of sub-surfaces is to offload some of the compositing work + within a window from clients to the compositor. A prime example is + a video player with decorations and video in separate wl_surface + objects. This should allow the compositor to pass YUV video buffer + processing to dedicated overlay hardware when possible. + + + + + Informs the server that the client will not be using this + protocol object anymore. This does not affect any other + objects, wl_subsurface objects included. + + + + + + + + + + Create a sub-surface interface for the given surface, and + associate it with the given parent surface. This turns a + plain wl_surface into a sub-surface. + + The to-be sub-surface must not already have a dedicated + purpose, like any shell surface type, cursor image, drag icon, + or sub-surface. Otherwise a protocol error is raised. + + + + + + + + + + + An additional interface to a wl_surface object, which has been + made a sub-surface. A sub-surface has one parent surface. A + sub-surface's size and position are not limited to that of the parent. + Particularly, a sub-surface is not automatically clipped to its + parent's area. + + A sub-surface becomes mapped, when a non-NULL wl_buffer is applied + and the parent surface is mapped. The order of which one happens + first is irrelevant. A sub-surface is hidden if the parent becomes + hidden, or if a NULL wl_buffer is applied. These rules apply + recursively through the tree of surfaces. + + The behaviour of wl_surface.commit request on a sub-surface + depends on the sub-surface's mode. The possible modes are + synchronized and desynchronized, see methods + wl_subsurface.set_sync and wl_subsurface.set_desync. Synchronized + mode caches the wl_surface state to be applied when the parent's + state gets applied, and desynchronized mode applies the pending + wl_surface state directly. A sub-surface is initially in the + synchronized mode. + + Sub-surfaces have also other kind of state, which is managed by + wl_subsurface requests, as opposed to wl_surface requests. This + state includes the sub-surface position relative to the parent + surface (wl_subsurface.set_position), and the stacking order of + the parent and its sub-surfaces (wl_subsurface.place_above and + .place_below). This state is applied when the parent surface's + wl_surface state is applied, regardless of the sub-surface's mode. + As the exception, set_sync and set_desync are effective immediately. + + The main surface can be thought to be always in desynchronized mode, + since it does not have a parent in the sub-surfaces sense. + + Even if a sub-surface is in desynchronized mode, it will behave as + in synchronized mode, if its parent surface behaves as in + synchronized mode. This rule is applied recursively throughout the + tree of surfaces. This means, that one can set a sub-surface into + synchronized mode, and then assume that all its child and grand-child + sub-surfaces are synchronized, too, without explicitly setting them. + + If the wl_surface associated with the wl_subsurface is destroyed, the + wl_subsurface object becomes inert. Note, that destroying either object + takes effect immediately. If you need to synchronize the removal + of a sub-surface to the parent surface update, unmap the sub-surface + first by attaching a NULL wl_buffer, update parent, and then destroy + the sub-surface. + + If the parent wl_surface object is destroyed, the sub-surface is + unmapped. + + + + + The sub-surface interface is removed from the wl_surface object + that was turned into a sub-surface with + wl_subcompositor.get_subsurface request. The wl_surface's association + to the parent is deleted, and the wl_surface loses its role as + a sub-surface. The wl_surface is unmapped. + + + + + + + + + + This schedules a sub-surface position change. + The sub-surface will be moved so, that its origin (top-left + corner pixel) will be at the location x, y of the parent surface + coordinate system. The coordinates are not restricted to the parent + surface area. Negative values are allowed. + + The next wl_surface.commit on the parent surface will reset + the sub-surface's position to the scheduled coordinates. + + If more than one set_position request is invoked by the client before + the commit of the parent surface, the position of a new request always + replaces the scheduled position from any previous request. + + The initial position is 0, 0. + + + + + + + + + This sub-surface is taken from the stack, and put back just + above the reference surface, changing the z-order of the sub-surfaces. + The reference surface must be one of the sibling surfaces, or the + parent surface. Using any other surface, including this sub-surface, + will cause a protocol error. + + The z-order is double-buffered. Requests are handled in order and + applied immediately to a pending state, then committed to the active + state on the next commit of the parent surface. + See wl_surface.commit and wl_subcompositor.get_subsurface. + + A new sub-surface is initially added as the top-most in the stack + of its siblings and parent. + + + + + + + + The sub-surface is placed just below of the reference surface. + See wl_subsurface.place_above. + + + + + + + + Change the commit behaviour of the sub-surface to synchronized + mode, also described as the parent dependant mode. + + In synchronized mode, wl_surface.commit on a sub-surface will + accumulate the committed state in a cache, but the state will + not be applied and hence will not change the compositor output. + The cached state is applied to the sub-surface immediately after + the parent surface's state is applied. This ensures atomic + updates of the parent and all its synchronized sub-surfaces. + Applying the cached state will invalidate the cache, so further + parent surface commits do not (re-)apply old state. + + See wl_subsurface for the recursive effect of this mode. + + + + + + Change the commit behaviour of the sub-surface to desynchronized + mode, also described as independent or freely running mode. + + In desynchronized mode, wl_surface.commit on a sub-surface will + apply the pending state directly, without caching, as happens + normally with a wl_surface. Calling wl_surface.commit on the + parent surface has no effect on the sub-surface's wl_surface + state. This mode allows a sub-surface to be updated on its own. + + If cached state exists when wl_surface.commit is called in + desynchronized mode, the pending state is added to the cached + state, and applied as whole. This invalidates the cache. + + Note: even if a sub-surface is set to desynchronized, a parent + sub-surface may override it to behave as synchronized. For details, + see wl_subsurface. + + If a surface's parent surface behaves as desynchronized, then + the cached state is applied on set_desync. + + + + + diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index 6b6abfe5f18..db43e525b2b 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -126,7 +126,10 @@ QWaylandInputDevice::Keyboard::~Keyboard() #ifndef QT_NO_WAYLAND_XKB releaseKeyMap(); #endif - wl_keyboard_destroy(object()); + if (mParent->mVersion >= 3) + wl_keyboard_release(object()); + else + wl_keyboard_destroy(object()); } void QWaylandInputDevice::Keyboard::stopRepeat() @@ -145,7 +148,10 @@ QWaylandInputDevice::Pointer::Pointer(QWaylandInputDevice *p) QWaylandInputDevice::Pointer::~Pointer() { - wl_pointer_destroy(object()); + if (mParent->mVersion >= 3) + wl_pointer_release(object()); + else + wl_pointer_destroy(object()); } QWaylandInputDevice::Touch::Touch(QWaylandInputDevice *p) @@ -156,14 +162,18 @@ QWaylandInputDevice::Touch::Touch(QWaylandInputDevice *p) QWaylandInputDevice::Touch::~Touch() { - wl_touch_destroy(object()); + if (mParent->mVersion >= 3) + wl_touch_release(object()); + else + wl_touch_destroy(object()); } QWaylandInputDevice::QWaylandInputDevice(QWaylandDisplay *display, int version, uint32_t id) : QObject() - , QtWayland::wl_seat(display->wl_registry(), id, qMin(version, 2)) + , QtWayland::wl_seat(display->wl_registry(), id, qMin(version, 3)) , mQDisplay(display) , mDisplay(display->wl_display()) + , mVersion(qMin(version, 3)) , mCaps(0) , mDataDevice(0) , mKeyboard(0) diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h index 238e5964ab3..65e21ed58a2 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h +++ b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h @@ -115,6 +115,7 @@ private: QWaylandDisplay *mQDisplay; struct wl_display *mDisplay; + int mVersion; uint32_t mCaps; struct wl_surface *pointerSurface; From 1b6d20e46329b5db99dcc00e6a4e46511dc6c736 Mon Sep 17 00:00:00 2001 From: Jorgen Lind Date: Thu, 25 Dec 2014 20:42:56 +0100 Subject: [PATCH 0212/1507] Add a SHM format converter class This class helps keeing one lookuptable for server and client It relies on that wayland-(client|server)-protocol.h being included before the qwaylandshmformathelper.h Change-Id: I12158126a80c8fef5c52427d35792f33716020f1 Reviewed-by: Giulio Camuffo --- .../wayland/qwaylandshmbackingstore.cpp | 6 +- .../wayland/shared/qwaylandshmformathelper.h | 138 ++++++++++++++++++ 2 files changed, 143 insertions(+), 1 deletion(-) create mode 100644 src/plugins/platforms/wayland/shared/qwaylandshmformathelper.h diff --git a/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp b/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp index 64e93d94713..8eab510bf7e 100644 --- a/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp +++ b/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp @@ -49,6 +49,9 @@ #include #include +#include +#include "qwaylandshmformathelper.h" + #include #include #include @@ -89,12 +92,13 @@ QWaylandShmBuffer::QWaylandShmBuffer(QWaylandDisplay *display, return; } + wl_shm_format wl_format = QWaylandShmFormatHelper::fromQImageFormat(format); mImage = QImage(data, size.width(), size.height(), stride, format); mImage.setDevicePixelRatio(qreal(scale)); mShmPool = wl_shm_create_pool(display->shm(), fd, alloc); mBuffer = wl_shm_pool_create_buffer(mShmPool,0, size.width(), size.height(), - stride, WL_SHM_FORMAT_ARGB8888); + stride, wl_format); close(fd); } diff --git a/src/plugins/platforms/wayland/shared/qwaylandshmformathelper.h b/src/plugins/platforms/wayland/shared/qwaylandshmformathelper.h new file mode 100644 index 00000000000..131ad780d7d --- /dev/null +++ b/src/plugins/platforms/wayland/shared/qwaylandshmformathelper.h @@ -0,0 +1,138 @@ +/**************************************************************************** +** +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWAYLANDSHMFORMATHELPER_H +#define QWAYLANDSHMFORMATHELPER_H + +#include + +//the correct protocol header for the wayland server or wayland client has to be +//included before this file is included + +QT_BEGIN_NAMESPACE + +class QWaylandShmFormatHelper +{ +public: + static inline wl_shm_format fromQImageFormat(QImage::Format format); + static inline QImage::Format fromWaylandShmFormat(wl_shm_format format); + static inline QVector supportedWaylandFormats(); + +private: +//IMPLEMENTATION (which has to be inline in the header because of the include trick) + struct Array + { + Array(const size_t size, const wl_shm_format *data) + : size(size) + , data(data) + { } + const size_t size; + const wl_shm_format *data; + }; + + static const Array getData() + { + static wl_shm_format formats_array[] = { + wl_shm_format(INT_MIN), //Format_Invalid, + wl_shm_format(INT_MIN), //Format_Mono, + wl_shm_format(INT_MIN), //Format_MonoLSB, + wl_shm_format(INT_MIN), //Format_Indexed8, + WL_SHM_FORMAT_XRGB8888, //Format_RGB32, + WL_SHM_FORMAT_ARGB8888, //Format_ARGB32, + WL_SHM_FORMAT_ARGB8888, //Format_ARGB32_Premultiplied, + WL_SHM_FORMAT_RGB565, //Format_RGB16, + wl_shm_format(INT_MIN), //Format_ARGB8565_Premultiplied, + wl_shm_format(INT_MIN), //Format_RGB666, + wl_shm_format(INT_MIN), //Format_ARGB6666_Premultiplied, + WL_SHM_FORMAT_XRGB1555, //Format_RGB555, + wl_shm_format(INT_MIN), //Format_ARGB8555_Premultiplied, + WL_SHM_FORMAT_RGB888, //Format_RGB888, + WL_SHM_FORMAT_XRGB4444, //Format_RGB444, + WL_SHM_FORMAT_ARGB4444, //Format_ARGB4444_Premultiplied, + WL_SHM_FORMAT_XBGR8888, //Format_RGBX8888, + WL_SHM_FORMAT_ABGR8888, //Format_RGBA8888, + WL_SHM_FORMAT_ABGR8888, //Format_RGBA8888_Premultiplied, + WL_SHM_FORMAT_XBGR2101010, //Format_BGR30, + WL_SHM_FORMAT_ARGB2101010, //Format_A2BGR30_Premultiplied, + WL_SHM_FORMAT_XRGB2101010, //Format_RGB30, + WL_SHM_FORMAT_ARGB2101010, //Format_A2RGB30_Premultiplied, + WL_SHM_FORMAT_C8, //Format_Alpha8, + WL_SHM_FORMAT_C8 //Format_Grayscale8, + }; + const size_t size = sizeof(formats_array) / sizeof(*formats_array); + return Array(size, formats_array); + } +}; + +wl_shm_format QWaylandShmFormatHelper::fromQImageFormat(QImage::Format format) +{ + Array array = getData(); + if (array.size <= size_t(format)) + return wl_shm_format(INT_MIN); + return array.data[format]; +} + +QImage::Format QWaylandShmFormatHelper::fromWaylandShmFormat(wl_shm_format format) +{ + Array array = getData(); + for (size_t i = 0; i < array.size; i++) { + if (array.data[i] == format) + return QImage::Format(i); + } + return QImage::Format_Invalid; +} + +QVector QWaylandShmFormatHelper::supportedWaylandFormats() +{ + QVector retFormats; + Array array = getData(); + for (size_t i = 0; i < array.size; i++) { + if (int(array.data[i]) != INT_MIN + && !retFormats.contains(array.data[i])) { + retFormats.append(array.data[i]); + } + } + return retFormats; +} + +QT_END_NAMESPACE + +#endif //QWAYLANDSHMFORMATHELPER_H From ef259af2db0d7c58a534cc877eebef3e20d4ebda Mon Sep 17 00:00:00 2001 From: Giulio Camuffo Date: Wed, 4 Feb 2015 20:02:59 +0200 Subject: [PATCH 0213/1507] Fix deadlock when starting a drag MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Ie2fdc56bffb97ce04ffad11ea7a7686dc09a06cc Reviewed-by: Robin Burchell Reviewed-by: Jørgen Lind --- src/plugins/platforms/wayland/qwaylanddnd.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylanddnd.cpp b/src/plugins/platforms/wayland/qwaylanddnd.cpp index 996e647ccdc..e38e23da92f 100644 --- a/src/plugins/platforms/wayland/qwaylanddnd.cpp +++ b/src/plugins/platforms/wayland/qwaylanddnd.cpp @@ -71,13 +71,20 @@ QMimeData * QWaylandDrag::platformDropData() void QWaylandDrag::startDrag() { + bool cancel = false; if (!shapedPixmapWindow()) { QBasicDrag::startDrag(); - QBasicDrag::cancel(); + // Don't call cancel() here, since that will hide 'shapedPixmapWindow()', and + // QWaylandWindow::setVisible(false) will flush the window system queue, + // ending up trying to render the window, which doesn't have a role yet, + // and so blocking waiting for a frame callback. + cancel = true; } QWaylandWindow *icon = static_cast(shapedPixmapWindow()->handle()); m_display->currentInputDevice()->dataDevice()->startDrag(drag()->mimeData(), icon); + if (cancel) + QBasicDrag::cancel(); QBasicDrag::startDrag(); } From ccc23106b9a415910b622609934a8e7d16682556 Mon Sep 17 00:00:00 2001 From: Giulio Camuffo Date: Wed, 4 Feb 2015 22:00:35 +0200 Subject: [PATCH 0214/1507] Do not send invisible key characters MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit xkb_keysym_to_utf32() will return 0 if the keysym does not have a unicode representation. Task-number: QTBUG-44012 Change-Id: I85a13b58c7f0b9765c7d67db6568a90629bcfbfa Reviewed-by: Jørgen Lind --- src/plugins/platforms/wayland/qwaylandinputdevice.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index 30bc6029ba9..b2dfd757db2 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -778,7 +778,8 @@ void QWaylandInputDevice::Keyboard::keyboard_key(uint32_t serial, uint32_t time, Qt::KeyboardModifiers modifiers = mParent->modifiers(); uint utf32 = xkb_keysym_to_utf32(sym); - text = QString::fromUcs4(&utf32, 1); + if (utf32) + text = QString::fromUcs4(&utf32, 1); qtkey = keysymToQtKey(sym, modifiers, text); From b52533db8338714e2639860963dd76514ff22d8d Mon Sep 17 00:00:00 2001 From: Giulio Camuffo Date: Sat, 7 Feb 2015 19:29:19 +0200 Subject: [PATCH 0215/1507] Fix copying text to non-qt clients Like we do for pasting, set the mime type of text to "text/plain;charset=utf-8" too besides "text/plain". This allows copying text to clients such as weston example clients or Xwayland. Change-Id: I8a24f32d93e438f16db662e7c09b09ddd7578768 Reviewed-by: Laszlo Agocs --- src/plugins/platforms/wayland/qwaylandclipboard.cpp | 4 ++++ src/plugins/platforms/wayland/qwaylandinputdevice.cpp | 1 + 2 files changed, 5 insertions(+) diff --git a/src/plugins/platforms/wayland/qwaylandclipboard.cpp b/src/plugins/platforms/wayland/qwaylandclipboard.cpp index c40f023b55a..355a7163a80 100644 --- a/src/plugins/platforms/wayland/qwaylandclipboard.cpp +++ b/src/plugins/platforms/wayland/qwaylandclipboard.cpp @@ -86,6 +86,10 @@ void QWaylandClipboard::setMimeData(QMimeData *data, QClipboard::Mode mode) if (!inputDevice || !inputDevice->dataDevice()) return; + static const QString plain = QStringLiteral("text/plain"); + static const QString utf8 = QStringLiteral("text/plain;charset=utf-8"); + if (data && data->hasFormat(plain) && !data->hasFormat(utf8)) + data->setData(utf8, data->data(plain)); inputDevice->dataDevice()->setSelectionSource(data ? new QWaylandDataSource(mDisplay->dndSelectionHandler(), data) : 0); emitChanged(mode); diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index b2dfd757db2..ad369bb324f 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -761,6 +761,7 @@ void QWaylandInputDevice::Keyboard::keyboard_key(uint32_t serial, uint32_t time, QEvent::Type type = isDown ? QEvent::KeyPress : QEvent::KeyRelease; QString text; int qtkey = key + 8; // qt-compositor substracts 8 for some reason + mParent->mSerial = serial; if (!window) { // We destroyed the keyboard focus surface, but the server From 817633a83136e0442557a0bf3b2955e602289385 Mon Sep 17 00:00:00 2001 From: Giulio Camuffo Date: Sun, 18 Jan 2015 15:53:46 +0200 Subject: [PATCH 0216/1507] Fix popup menus with no parent windows The QMenu API doesn't play well with Wayland. You can do: QMenu menu; menu.popup(someGlobalPos); which is completely broken on wayland. If some popup window doesn't have a transient parent use the current focus window for that. Fixes right-click popups in qdbusviewer and other apps. Change-Id: I3227f4ec27431ca8ec156971cbfdbf1e848a0527 Reviewed-by: Laszlo Agocs --- .../platforms/wayland/qwaylandwindow.cpp | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 965511528c1..13408b25924 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -226,14 +226,21 @@ void QWaylandWindow::setGeometry(const QRect &rect) void QWaylandWindow::setVisible(bool visible) { if (visible) { - if (window()->type() == Qt::Popup && transientParent()) { + if (window()->type() == Qt::Popup) { QWaylandWindow *parent = transientParent(); - mMouseDevice = parent->mMouseDevice; - mMouseSerial = parent->mMouseSerial; + if (!parent) { + // Try with the current focus window. It may be the wrong one but we need to have + // some parent to have popups act as popups. + parent = mDisplay->currentInputDevice()->pointerFocus(); + } + if (parent) { + mMouseDevice = parent->mMouseDevice; + mMouseSerial = parent->mMouseSerial; - QWaylandWlShellSurface *wlshellSurface = dynamic_cast(mShellSurface); - if (mMouseDevice && wlshellSurface) { - wlshellSurface->setPopup(transientParent(), mMouseDevice, mMouseSerial); + QWaylandWlShellSurface *wlshellSurface = dynamic_cast(mShellSurface); + if (mMouseDevice && wlshellSurface) { + wlshellSurface->setPopup(parent, mMouseDevice, mMouseSerial); + } } } From 520cb3e95e4679f32789987dde35ddecb9162657 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Sat, 6 Sep 2014 22:55:07 +0200 Subject: [PATCH 0217/1507] Sanitize popup behavior. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Popups are pretty important for widget apps. Menus, combobox dropdows and such are all popups. Currently they are completely borked when activated via keyboard or touch. This is because of the bizarre set_popup request in the protocol, and Weston's current implementation, that ignore the fact that a popup can be opened as a result of a keyboard event too or may not originate from an input event at all. Pass the last input device and serial we have seen, regardless of the type, by tracking it globally in the QWaylandDisplay. With this patch menus and such will not freeze the application anymore when activated with keyboard or touch without sending a mouse event to the window first. The behavior is still broken in some ways, especially with keyboard due to immediately getting a popup_done, but at least applications remain usable. Task-number: QTBUG-41142 Task-number: QTBUG-41147 Change-Id: I18de501004ae8a62ff8667e72225d08c2d3ba491 Reviewed-by: Laszlo Agocs Reviewed-by: Jørgen Lind --- .../platforms/wayland/qwaylanddisplay.cpp | 10 +++++++++ .../platforms/wayland/qwaylanddisplay_p.h | 8 +++++++ .../platforms/wayland/qwaylandinputdevice.cpp | 8 +++++-- .../platforms/wayland/qwaylandwindow.cpp | 22 +++++-------------- .../platforms/wayland/qwaylandwindow_p.h | 2 -- .../wayland/qwaylandwlshellsurface.cpp | 8 ++++++- 6 files changed, 37 insertions(+), 21 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index fda2c204e66..9dedabda344 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -128,6 +128,9 @@ QWaylandDisplay::QWaylandDisplay(QWaylandIntegration *waylandIntegration) , mQtKeyExtension(0) , mTextInputManager(0) , mHardwareIntegration(0) + , mLastInputSerial(0) + , mLastInputDevice(0) + , mLastInputWindow(0) { qRegisterMetaType("uint32_t"); @@ -359,4 +362,11 @@ bool QWaylandDisplay::supportsWindowDecoration() const return integrationSupport; } +void QWaylandDisplay::setLastInputDevice(QWaylandInputDevice *device, uint32_t serial, QWaylandWindow *win) +{ + mLastInputDevice = device; + mLastInputSerial = serial; + mLastInputWindow = win; +} + QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylanddisplay_p.h b/src/plugins/platforms/wayland/qwaylanddisplay_p.h index 8d1d26bba24..d9619e6f1f5 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay_p.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay_p.h @@ -159,6 +159,11 @@ public: bool supportsWindowDecoration() const; + uint32_t lastInputSerial() const { return mLastInputSerial; } + QWaylandInputDevice *lastInputDevice() const { return mLastInputDevice; } + QWaylandWindow *lastInputWindow() const { return mLastInputWindow; } + void setLastInputDevice(QWaylandInputDevice *device, uint32_t serial, QWaylandWindow *window); + public slots: void blockingReadEvents(); void flushRequests(); @@ -200,6 +205,9 @@ private: bool mScreensInitialized; QList mGlobals; int mCompositorVersion; + uint32_t mLastInputSerial; + QWaylandInputDevice *mLastInputDevice; + QWaylandWindow *mLastInputWindow; void registry_global(uint32_t id, const QString &interface, uint32_t version) Q_DECL_OVERRIDE; void registry_global_remove(uint32_t id) Q_DECL_OVERRIDE; diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index ad369bb324f..14575146da8 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -476,7 +476,6 @@ void QWaylandInputDevice::Pointer::pointer_motion(uint32_t time, wl_fixed_t surf void QWaylandInputDevice::Pointer::pointer_button(uint32_t serial, uint32_t time, uint32_t button, uint32_t state) { - Q_UNUSED(serial); QWaylandWindow *window = mFocus; Qt::MouseButton qt_button; @@ -509,6 +508,8 @@ void QWaylandInputDevice::Pointer::pointer_button(uint32_t serial, uint32_t time mParent->mTime = time; mParent->mSerial = serial; + if (state) + mParent->mQDisplay->setLastInputDevice(mParent, serial, window); QWaylandWindow *grab = QWaylandWindow::mouseGrab(); if (grab && grab != mFocus) { @@ -754,7 +755,6 @@ void QWaylandInputDevice::Keyboard::focusCallback(void *data, struct wl_callback void QWaylandInputDevice::Keyboard::keyboard_key(uint32_t serial, uint32_t time, uint32_t key, uint32_t state) { - Q_UNUSED(serial); QWaylandWindow *window = mFocus; uint32_t code = key + 8; bool isDown = state != 0; @@ -769,6 +769,9 @@ void QWaylandInputDevice::Keyboard::keyboard_key(uint32_t serial, uint32_t time, return; } + if (isDown) + mParent->mQDisplay->setLastInputDevice(mParent, serial, window); + #ifndef QT_NO_WAYLAND_XKB if (!mXkbMap) return; @@ -875,6 +878,7 @@ void QWaylandInputDevice::Touch::touch_down(uint32_t serial, mParent->mTime = time; mParent->mSerial = serial; mFocus = QWaylandWindow::fromWlSurface(surface); + mParent->mQDisplay->setLastInputDevice(mParent, serial, mFocus); mParent->handleTouchPoint(id, wl_fixed_to_double(x), wl_fixed_to_double(y), Qt::TouchPointPressed); } diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 13408b25924..976ebba15c3 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -88,8 +88,6 @@ QWaylandWindow::QWaylandWindow(QWindow *window) , mResizeDirty(false) , mResizeAfterSwap(qEnvironmentVariableIsSet("QT_WAYLAND_RESIZE_AFTER_SWAP")) , mSentInitialResize(false) - , mMouseDevice(0) - , mMouseSerial(0) , mState(Qt::WindowNoState) , mBackingStore(Q_NULLPTR) { @@ -229,18 +227,14 @@ void QWaylandWindow::setVisible(bool visible) if (window()->type() == Qt::Popup) { QWaylandWindow *parent = transientParent(); if (!parent) { - // Try with the current focus window. It may be the wrong one but we need to have - // some parent to have popups act as popups. - parent = mDisplay->currentInputDevice()->pointerFocus(); + // Try with the current focus window. It should be the right one and anyway + // better than having no parent at all. + parent = mDisplay->lastInputWindow(); } if (parent) { - mMouseDevice = parent->mMouseDevice; - mMouseSerial = parent->mMouseSerial; - QWaylandWlShellSurface *wlshellSurface = dynamic_cast(mShellSurface); - if (mMouseDevice && wlshellSurface) { - wlshellSurface->setPopup(parent, mMouseDevice, mMouseSerial); - } + if (wlshellSurface) + wlshellSurface->setPopup(parent, mDisplay->lastInputDevice(), mDisplay->lastInputSerial()); } } @@ -579,7 +573,7 @@ QWaylandWindow *QWaylandWindow::transientParent() const if (window()->transientParent()) { // Take the top level window here, since the transient parent may be a QWidgetWindow // or some other window without a shell surface, which is then not able to get mouse - // events, nor set mMouseSerial and mMouseDevice. + // events. return static_cast(topLevelWindow(window()->transientParent())->handle()); } return 0; @@ -587,10 +581,6 @@ QWaylandWindow *QWaylandWindow::transientParent() const void QWaylandWindow::handleMouse(QWaylandInputDevice *inputDevice, ulong timestamp, const QPointF &local, const QPointF &global, Qt::MouseButtons b, Qt::KeyboardModifiers mods) { - if (b != Qt::NoButton) { - mMouseSerial = inputDevice->serial(); - mMouseDevice = inputDevice; - } if (mWindowDecoration) { handleMouseEventWithDecoration(inputDevice, timestamp,local,global,b,mods); diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index 6c32bc3ef2f..9ad6fe2f81a 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -220,8 +220,6 @@ protected: QPoint mOffset; QIcon mWindowIcon; - QWaylandInputDevice *mMouseDevice; - int mMouseSerial; Qt::WindowState mState; diff --git a/src/plugins/platforms/wayland/qwaylandwlshellsurface.cpp b/src/plugins/platforms/wayland/qwaylandwlshellsurface.cpp index 86115fa38b2..39505e1d8fb 100644 --- a/src/plugins/platforms/wayland/qwaylandwlshellsurface.cpp +++ b/src/plugins/platforms/wayland/qwaylandwlshellsurface.cpp @@ -187,8 +187,14 @@ void QWaylandWlShellSurface::updateTransientParent(QWindow *parent) void QWaylandWlShellSurface::setPopup(QWaylandWindow *parent, QWaylandInputDevice *device, int serial) { QWaylandWindow *parent_wayland_window = parent; - if (!parent_wayland_window) + if (!parent_wayland_window) { + qWarning("setPopup called without parent window"); return; + } + if (!device) { + qWarning("setPopup called without input device"); + return; + } // set_popup expects a position relative to the parent QPoint transientPos = m_window->geometry().topLeft(); // this is absolute From 7e82e306bcbf12b530e15ab8d5de1bdd7ae6d847 Mon Sep 17 00:00:00 2001 From: Giulio Camuffo Date: Mon, 16 Feb 2015 16:54:37 +0200 Subject: [PATCH 0218/1507] Add a integration hook to get the wayland queue used by the QPA plugin This comes handy for clients directly using raw wayland objects. Change-Id: Ie526ac7b25a6c6a34ce61699103e612616bffbb8 Reviewed-by: Laszlo Agocs --- src/plugins/platforms/wayland/qwaylandnativeinterface.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp b/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp index c4878e54064..89217734506 100644 --- a/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp +++ b/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp @@ -66,6 +66,8 @@ void *QWaylandNativeInterface::nativeResourceForIntegration(const QByteArray &re if (lowerCaseResource == "display" || lowerCaseResource == "wl_display" || lowerCaseResource == "nativedisplay") return m_integration->display()->wl_display(); + if (lowerCaseResource == "wl_event_queue") + return m_integration->display()->wl_event_queue(); if (lowerCaseResource == "compositor") return const_cast(m_integration->display()->wl_compositor()); if (lowerCaseResource == "server_buffer_integration") From 4ad52325f72282a19245f3e9a88be1bca71f3d81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Mon, 16 Feb 2015 15:50:11 +0100 Subject: [PATCH 0219/1507] Run eventDispatcher in QWaylandDisplay::forceRoundTrip If the application uses QCoreApplication::setEventDispatcher before the QGuiApplication is created the blocking roundtrip might block the application indefinitely. This can happen if the application starts a Wayland server in the same process before the QGuiApplication is created. And the QtWayland plugin connects to this server. In this case a roundtrip blocks as the Wayland server cannot process the events the QWaylandDisplay is waiting for. By running the event dispatcher manually and using the pending variant for dispatching the Wayland event queue, the application can be kept alive. Change-Id: I9c36fccbae8921e1ae9a0a8b7f460520b1b65d5c Reviewed-by: Giulio Camuffo --- src/plugins/platforms/wayland/qwaylanddisplay.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index 9dedabda344..11904ae07ee 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -338,8 +338,15 @@ void QWaylandDisplay::forceRoundTrip() wl_proxy_set_queue((struct wl_proxy *)callback, mEventQueue); wl_callback_add_listener(callback, &sync_listener, &done); flushRequests(); - while (!done && ret >= 0) - ret = wl_display_dispatch_queue(mDisplay, mEventQueue); + if (QThread::currentThread()->eventDispatcher()) { + while (!done && ret >= 0) { + QThread::currentThread()->eventDispatcher()->processEvents(QEventLoop::WaitForMoreEvents); + ret = wl_display_dispatch_queue_pending(mDisplay, mEventQueue); + } + } else { + while (!done && ret >= 0) + ret = wl_display_dispatch_queue(mDisplay, mEventQueue); + } if (ret == -1 && !done) wl_callback_destroy(callback); From 62f0062e20bc42d5f97937be9e1725c9948f5d03 Mon Sep 17 00:00:00 2001 From: Giulio Camuffo Date: Tue, 17 Feb 2015 11:14:20 +0200 Subject: [PATCH 0220/1507] Fix build Change-Id: I790e9bfbcffc7458e2a46f2da32dcbde0c6bffe8 Reviewed-by: Robin Burchell --- src/plugins/platforms/wayland/qwaylanddisplay.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index 1284d39a168..c380b78ee12 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -383,4 +383,6 @@ void QWaylandDisplay::setLastInputDevice(QWaylandInputDevice *device, uint32_t s mLastInputWindow = win; } +} + QT_END_NAMESPACE From b366677a7ab166161ecf48fb752309ca96f130e1 Mon Sep 17 00:00:00 2001 From: Jani Heikkinen Date: Thu, 12 Feb 2015 08:41:42 +0200 Subject: [PATCH 0221/1507] Update copyright headers Qt copyrights are now in The Qt Company, so we could update the source code headers accordingly. In the same go we should also fix the links to point to qt.io. Change-Id: I5a74d32515c3f1fe7aa1916f4241c92832510f8c Reviewed-by: Antti Kokko --- src/3rdparty/wayland/extensions/brcm.xml | 8 ++--- .../extensions/drm-egl-server-buffer.xml | 8 ++--- .../extensions/hardware-integration.xml | 8 ++--- .../libhybris-egl-server-buffer.xml | 6 ++-- .../wayland/extensions/output-extension.xml | 8 ++--- .../wayland/extensions/qtkey-extension.xml | 8 ++--- .../extensions/server-buffer-extension.xml | 8 ++--- .../extensions/sub-surface-extension.xml | 8 ++--- .../wayland/extensions/surface-extension.xml | 8 ++--- .../wayland/extensions/touch-extension.xml | 8 ++--- .../wayland/extensions/windowmanager.xml | 8 ++--- .../wayland/extensions/xcomposite.xml | 8 ++--- .../qwaylandclientbufferintegration.cpp | 36 ++++++++----------- .../qwaylandclientbufferintegration_p.h | 36 ++++++++----------- ...qwaylandclientbufferintegrationfactory.cpp | 36 ++++++++----------- ...qwaylandclientbufferintegrationfactory_p.h | 36 ++++++++----------- .../qwaylandclientbufferintegrationplugin.cpp | 36 ++++++++----------- .../qwaylandclientbufferintegrationplugin_p.h | 36 ++++++++----------- .../qwaylandhardwareintegration.cpp | 36 ++++++++----------- .../qwaylandhardwareintegration_p.h | 36 ++++++++----------- .../qwaylandserverbufferintegration.cpp | 36 ++++++++----------- .../qwaylandserverbufferintegration_p.h | 36 ++++++++----------- ...qwaylandserverbufferintegrationfactory.cpp | 36 ++++++++----------- ...qwaylandserverbufferintegrationfactory_p.h | 36 ++++++++----------- .../qwaylandserverbufferintegrationplugin.cpp | 36 ++++++++----------- .../qwaylandserverbufferintegrationplugin_p.h | 36 ++++++++----------- .../qwaylandinputdeviceintegration_p.h | 34 +++++++----------- .../qwaylandinputdeviceintegrationfactory.cpp | 34 +++++++----------- .../qwaylandinputdeviceintegrationfactory_p.h | 34 +++++++----------- .../qwaylandinputdeviceintegrationplugin.cpp | 34 +++++++----------- .../qwaylandinputdeviceintegrationplugin_p.h | 34 +++++++----------- .../plugins/decorations/bradient/main.cpp | 36 ++++++++----------- .../hardwareintegration/brcm-egl/main.cpp | 36 ++++++++----------- .../drm-egl-server/main.cpp | 36 ++++++++----------- .../libhybris-egl-server/main.cpp | 34 +++++++----------- .../hardwareintegration/wayland-egl/main.cpp | 36 ++++++++----------- .../xcomposite-egl/main.cpp | 36 ++++++++----------- .../xcomposite-glx/main.cpp | 36 ++++++++----------- .../wayland/qwaylandabstractdecoration.cpp | 36 ++++++++----------- .../wayland/qwaylandabstractdecoration_p.h | 36 ++++++++----------- .../platforms/wayland/qwaylandbuffer_p.h | 36 ++++++++----------- .../wayland/qwaylandclientexport_p.h | 36 ++++++++----------- .../platforms/wayland/qwaylandclipboard.cpp | 36 ++++++++----------- .../platforms/wayland/qwaylandclipboard_p.h | 36 ++++++++----------- .../platforms/wayland/qwaylandcursor.cpp | 36 ++++++++----------- .../platforms/wayland/qwaylandcursor_p.h | 36 ++++++++----------- .../platforms/wayland/qwaylanddatadevice.cpp | 6 ++-- .../platforms/wayland/qwaylanddatadevice_p.h | 6 ++-- .../wayland/qwaylanddatadevicemanager.cpp | 36 ++++++++----------- .../wayland/qwaylanddatadevicemanager_p.h | 36 ++++++++----------- .../platforms/wayland/qwaylanddataoffer.cpp | 36 ++++++++----------- .../platforms/wayland/qwaylanddataoffer_p.h | 36 ++++++++----------- .../platforms/wayland/qwaylanddatasource.cpp | 36 ++++++++----------- .../platforms/wayland/qwaylanddatasource_p.h | 36 ++++++++----------- .../wayland/qwaylanddecorationfactory.cpp | 34 +++++++----------- .../wayland/qwaylanddecorationfactory_p.h | 34 +++++++----------- .../wayland/qwaylanddecorationplugin.cpp | 34 +++++++----------- .../wayland/qwaylanddecorationplugin_p.h | 34 +++++++----------- .../platforms/wayland/qwaylanddisplay.cpp | 36 ++++++++----------- .../platforms/wayland/qwaylanddisplay_p.h | 36 ++++++++----------- src/plugins/platforms/wayland/qwaylanddnd.cpp | 36 ++++++++----------- src/plugins/platforms/wayland/qwaylanddnd_p.h | 36 ++++++++----------- .../platforms/wayland/qwaylandeventthread.cpp | 36 ++++++++----------- .../platforms/wayland/qwaylandeventthread_p.h | 36 ++++++++----------- .../wayland/qwaylandextendedoutput.cpp | 36 ++++++++----------- .../wayland/qwaylandextendedoutput_p.h | 36 ++++++++----------- .../wayland/qwaylandextendedsurface.cpp | 36 ++++++++----------- .../wayland/qwaylandextendedsurface_p.h | 36 ++++++++----------- .../wayland/qwaylandinputcontext.cpp | 6 ++-- .../wayland/qwaylandinputcontext_p.h | 6 ++-- .../platforms/wayland/qwaylandinputdevice.cpp | 36 ++++++++----------- .../platforms/wayland/qwaylandinputdevice_p.h | 36 ++++++++----------- .../platforms/wayland/qwaylandintegration.cpp | 36 ++++++++----------- .../platforms/wayland/qwaylandintegration_p.h | 36 ++++++++----------- .../wayland/qwaylandnativeinterface.cpp | 36 ++++++++----------- .../wayland/qwaylandnativeinterface_p.h | 36 ++++++++----------- .../platforms/wayland/qwaylandqtkey.cpp | 36 ++++++++----------- .../platforms/wayland/qwaylandqtkey_p.h | 36 ++++++++----------- .../platforms/wayland/qwaylandscreen.cpp | 36 ++++++++----------- .../platforms/wayland/qwaylandscreen_p.h | 36 ++++++++----------- .../wayland/qwaylandshellsurface.cpp | 36 ++++++++----------- .../wayland/qwaylandshellsurface_p.h | 36 ++++++++----------- .../wayland/qwaylandshmbackingstore.cpp | 36 ++++++++----------- .../wayland/qwaylandshmbackingstore_p.h | 36 ++++++++----------- .../platforms/wayland/qwaylandshmwindow.cpp | 36 ++++++++----------- .../platforms/wayland/qwaylandshmwindow_p.h | 36 ++++++++----------- .../platforms/wayland/qwaylandsubsurface.cpp | 36 ++++++++----------- .../platforms/wayland/qwaylandsubsurface_p.h | 36 ++++++++----------- .../platforms/wayland/qwaylandtouch.cpp | 36 ++++++++----------- .../platforms/wayland/qwaylandtouch_p.h | 36 ++++++++----------- .../platforms/wayland/qwaylandwindow.cpp | 36 ++++++++----------- .../platforms/wayland/qwaylandwindow_p.h | 36 ++++++++----------- .../qwaylandwindowmanagerintegration.cpp | 36 ++++++++----------- .../qwaylandwindowmanagerintegration_p.h | 36 ++++++++----------- .../wayland/qwaylandwlshellsurface.cpp | 36 ++++++++----------- .../wayland/qwaylandwlshellsurface_p.h | 36 ++++++++----------- .../platforms/wayland/qwaylandxdgshell.cpp | 34 +++++++----------- .../platforms/wayland/qwaylandxdgshell_p.h | 34 +++++++----------- .../platforms/wayland/qwaylandxdgsurface.cpp | 36 ++++++++----------- .../platforms/wayland/qwaylandxdgsurface_p.h | 36 ++++++++----------- .../wayland/shared/qwaylandmimehelper.cpp | 36 ++++++++----------- .../wayland/shared/qwaylandmimehelper.h | 36 ++++++++----------- .../wayland/shared/qwaylandshmformathelper.h | 36 ++++++++----------- .../qwaylandshellintegration_p.h | 34 +++++++----------- .../qwaylandshellintegrationfactory.cpp | 34 +++++++----------- .../qwaylandshellintegrationfactory_p.h | 34 +++++++----------- .../qwaylandshellintegrationplugin.cpp | 34 +++++++----------- .../qwaylandshellintegrationplugin_p.h | 34 +++++++----------- .../qtwaylandscanner/qtwaylandscanner.cpp | 36 ++++++++----------- tests/auto/wayland/mockcompositor.cpp | 36 ++++++++----------- tests/auto/wayland/mockcompositor.h | 36 ++++++++----------- tests/auto/wayland/mockinput.cpp | 36 ++++++++----------- tests/auto/wayland/mockinput.h | 36 ++++++++----------- tests/auto/wayland/mockoutput.cpp | 36 ++++++++----------- tests/auto/wayland/mockshell.cpp | 36 ++++++++----------- tests/auto/wayland/mocksurface.cpp | 36 ++++++++----------- tests/auto/wayland/mocksurface.h | 36 ++++++++----------- tests/auto/wayland/tst_client.cpp | 36 ++++++++----------- 118 files changed, 1470 insertions(+), 2286 deletions(-) diff --git a/src/3rdparty/wayland/extensions/brcm.xml b/src/3rdparty/wayland/extensions/brcm.xml index 4c8e188dad9..9ac678f972c 100644 --- a/src/3rdparty/wayland/extensions/brcm.xml +++ b/src/3rdparty/wayland/extensions/brcm.xml @@ -3,8 +3,8 @@ - Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). - Contact: http://www.qt-project.org/legal + Copyright (C) 2015 The Qt Company Ltd. + Contact: http://www.qt.io/licensing/ This file is part of the plugins of the Qt Toolkit. @@ -20,8 +20,8 @@ notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names - of its contributors may be used to endorse or promote products derived + * Neither the name of The Qt Company Ltd nor the names of its + contributors may be used to endorse or promote products derived from this software without specific prior written permission. diff --git a/src/3rdparty/wayland/extensions/drm-egl-server-buffer.xml b/src/3rdparty/wayland/extensions/drm-egl-server-buffer.xml index 597552ee4fb..375b0044acc 100644 --- a/src/3rdparty/wayland/extensions/drm-egl-server-buffer.xml +++ b/src/3rdparty/wayland/extensions/drm-egl-server-buffer.xml @@ -1,8 +1,8 @@ - Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). - Contact: http://www.qt-project.org/legal + Copyright (C) 2015 The Qt Company Ltd. + Contact: http://www.qt.io/licensing/ This file is part of the plugins of the Qt Toolkit. @@ -18,8 +18,8 @@ notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names - of its contributors may be used to endorse or promote products derived + * Neither the name of The Qt Company Ltd nor the names of its + contributors may be used to endorse or promote products derived from this software without specific prior written permission. diff --git a/src/3rdparty/wayland/extensions/hardware-integration.xml b/src/3rdparty/wayland/extensions/hardware-integration.xml index ad505c9d789..d2040b3bf0b 100644 --- a/src/3rdparty/wayland/extensions/hardware-integration.xml +++ b/src/3rdparty/wayland/extensions/hardware-integration.xml @@ -1,8 +1,8 @@ - Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). - Contact: http://www.qt-project.org/legal + Copyright (C) 2015 The Qt Company Ltd. + Contact: http://www.qt.io/licensing/ This file is part of the plugins of the Qt Toolkit. @@ -18,8 +18,8 @@ notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names - of its contributors may be used to endorse or promote products derived + * Neither the name of The Qt Company Ltd nor the names of its + contributors may be used to endorse or promote products derived from this software without specific prior written permission. diff --git a/src/3rdparty/wayland/extensions/libhybris-egl-server-buffer.xml b/src/3rdparty/wayland/extensions/libhybris-egl-server-buffer.xml index 597ca0d7805..0d3a4cee78a 100644 --- a/src/3rdparty/wayland/extensions/libhybris-egl-server-buffer.xml +++ b/src/3rdparty/wayland/extensions/libhybris-egl-server-buffer.xml @@ -2,7 +2,7 @@ Copyright (C) 2014 Jolla Ltd - Contact: http://www.qt-project.org/legal + Contact: http://www.qt.io/licensing/ This file is part of the plugins of the Qt Toolkit. @@ -18,8 +18,8 @@ notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names - of its contributors may be used to endorse or promote products derived + * Neither the name of The Qt Company Ltd nor the names of its + contributors may be used to endorse or promote products derived from this software without specific prior written permission. diff --git a/src/3rdparty/wayland/extensions/output-extension.xml b/src/3rdparty/wayland/extensions/output-extension.xml index 0a7f11a90b6..b1a2f4db7b1 100644 --- a/src/3rdparty/wayland/extensions/output-extension.xml +++ b/src/3rdparty/wayland/extensions/output-extension.xml @@ -1,8 +1,8 @@ - Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). - Contact: http://www.qt-project.org/legal + Copyright (C) 2015 The Qt Company Ltd. + Contact: http://www.qt.io/licensing/ This file is part of the plugins of the Qt Toolkit. @@ -18,8 +18,8 @@ notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names - of its contributors may be used to endorse or promote products derived + * Neither the name of The Qt Company Ltd nor the names of its + contributors may be used to endorse or promote products derived from this software without specific prior written permission. diff --git a/src/3rdparty/wayland/extensions/qtkey-extension.xml b/src/3rdparty/wayland/extensions/qtkey-extension.xml index 711a2c28414..34cf24797de 100644 --- a/src/3rdparty/wayland/extensions/qtkey-extension.xml +++ b/src/3rdparty/wayland/extensions/qtkey-extension.xml @@ -1,8 +1,8 @@ - Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). - Contact: http://www.qt-project.org/legal + Copyright (C) 2015 The Qt Company Ltd. + Contact: http://www.qt.io/licensing/ This file is part of the plugins of the Qt Toolkit. @@ -18,8 +18,8 @@ notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names - of its contributors may be used to endorse or promote products derived + * Neither the name of The Qt Company Ltd nor the names of its + contributors may be used to endorse or promote products derived from this software without specific prior written permission. diff --git a/src/3rdparty/wayland/extensions/server-buffer-extension.xml b/src/3rdparty/wayland/extensions/server-buffer-extension.xml index 370a8013751..732e7b7e7a0 100644 --- a/src/3rdparty/wayland/extensions/server-buffer-extension.xml +++ b/src/3rdparty/wayland/extensions/server-buffer-extension.xml @@ -1,8 +1,8 @@ - Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). - Contact: http://www.qt-project.org/legal + Copyright (C) 2015 The Qt Company Ltd. + Contact: http://www.qt.io/licensing/ This file is part of the plugins of the Qt Toolkit. @@ -18,8 +18,8 @@ notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names - of its contributors may be used to endorse or promote products derived + * Neither the name of The Qt Company Ltd nor the names of its + contributors may be used to endorse or promote products derived from this software without specific prior written permission. diff --git a/src/3rdparty/wayland/extensions/sub-surface-extension.xml b/src/3rdparty/wayland/extensions/sub-surface-extension.xml index 0a6dcfbc74b..4ea87e20319 100644 --- a/src/3rdparty/wayland/extensions/sub-surface-extension.xml +++ b/src/3rdparty/wayland/extensions/sub-surface-extension.xml @@ -1,8 +1,8 @@ - Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). - Contact: http://www.qt-project.org/legal + Copyright (C) 2015 The Qt Company Ltd. + Contact: http://www.qt.io/licensing/ This file is part of the plugins of the Qt Toolkit. @@ -18,8 +18,8 @@ notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names - of its contributors may be used to endorse or promote products derived + * Neither the name of The Qt Company Ltd nor the names of its + contributors may be used to endorse or promote products derived from this software without specific prior written permission. diff --git a/src/3rdparty/wayland/extensions/surface-extension.xml b/src/3rdparty/wayland/extensions/surface-extension.xml index 680a6accab6..1abba7d43a0 100644 --- a/src/3rdparty/wayland/extensions/surface-extension.xml +++ b/src/3rdparty/wayland/extensions/surface-extension.xml @@ -1,8 +1,8 @@ - Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). - Contact: http://www.qt-project.org/legal + Copyright (C) 2015 The Qt Company Ltd. + Contact: http://www.qt.io/licensing/ This file is part of the plugins of the Qt Toolkit. @@ -18,8 +18,8 @@ notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names - of its contributors may be used to endorse or promote products derived + * Neither the name of The Qt Company Ltd nor the names of its + contributors may be used to endorse or promote products derived from this software without specific prior written permission. diff --git a/src/3rdparty/wayland/extensions/touch-extension.xml b/src/3rdparty/wayland/extensions/touch-extension.xml index 92aefc670e8..300caf26d28 100644 --- a/src/3rdparty/wayland/extensions/touch-extension.xml +++ b/src/3rdparty/wayland/extensions/touch-extension.xml @@ -1,8 +1,8 @@ - Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). - Contact: http://www.qt-project.org/legal + Copyright (C) 2015 The Qt Company Ltd. + Contact: http://www.qt.io/licensing/ This file is part of the plugins of the Qt Toolkit. @@ -18,8 +18,8 @@ notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names - of its contributors may be used to endorse or promote products derived + * Neither the name of The Qt Company Ltd nor the names of its + contributors may be used to endorse or promote products derived from this software without specific prior written permission. diff --git a/src/3rdparty/wayland/extensions/windowmanager.xml b/src/3rdparty/wayland/extensions/windowmanager.xml index e03bc3ad3c1..3d3bbd7fe71 100644 --- a/src/3rdparty/wayland/extensions/windowmanager.xml +++ b/src/3rdparty/wayland/extensions/windowmanager.xml @@ -1,8 +1,8 @@ - Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). - Contact: http://www.qt-project.org/legal + Copyright (C) 2015 The Qt Company Ltd. + Contact: http://www.qt.io/licensing/ This file is part of the plugins of the Qt Toolkit. @@ -18,8 +18,8 @@ notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names - of its contributors may be used to endorse or promote products derived + * Neither the name of The Qt Company Ltd nor the names of its + contributors may be used to endorse or promote products derived from this software without specific prior written permission. diff --git a/src/3rdparty/wayland/extensions/xcomposite.xml b/src/3rdparty/wayland/extensions/xcomposite.xml index e7eb2b85afb..44ecdd27c8c 100644 --- a/src/3rdparty/wayland/extensions/xcomposite.xml +++ b/src/3rdparty/wayland/extensions/xcomposite.xml @@ -3,8 +3,8 @@ - Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). - Contact: http://www.qt-project.org/legal + Copyright (C) 2015 The Qt Company Ltd. + Contact: http://www.qt.io/licensing/ This file is part of the plugins of the Qt Toolkit. @@ -20,8 +20,8 @@ notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names - of its contributors may be used to endorse or promote products derived + * Neither the name of The Qt Company Ltd nor the names of its + contributors may be used to endorse or promote products derived from this software without specific prior written permission. diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegration.cpp b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegration.cpp index f6099309782..e6ac1b1f3ed 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegration.cpp +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegration.cpp @@ -1,40 +1,32 @@ /**************************************************************************** ** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $QT_BEGIN_LICENSE:LGPL21$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegration_p.h b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegration_p.h index 8c787175dba..9a38b6d2fae 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegration_p.h +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegration_p.h @@ -1,40 +1,32 @@ /**************************************************************************** ** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $QT_BEGIN_LICENSE:LGPL21$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationfactory.cpp b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationfactory.cpp index d0603ef2288..a8d2902be3e 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationfactory.cpp +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationfactory.cpp @@ -1,40 +1,32 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $QT_BEGIN_LICENSE:LGPL21$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationfactory_p.h b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationfactory_p.h index 25ea5805e7b..24063c2b997 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationfactory_p.h +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationfactory_p.h @@ -1,40 +1,32 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $QT_BEGIN_LICENSE:LGPL21$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationplugin.cpp b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationplugin.cpp index 1b362b29436..2f6357a31f4 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationplugin.cpp +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationplugin.cpp @@ -1,40 +1,32 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $QT_BEGIN_LICENSE:LGPL21$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationplugin_p.h b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationplugin_p.h index a14c17810d5..f2c0bc08de5 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationplugin_p.h +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationplugin_p.h @@ -1,40 +1,32 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $QT_BEGIN_LICENSE:LGPL21$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandhardwareintegration.cpp b/src/plugins/platforms/wayland/hardwareintegration/qwaylandhardwareintegration.cpp index c02eebf3a2a..a946027b65c 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandhardwareintegration.cpp +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandhardwareintegration.cpp @@ -1,40 +1,32 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $QT_BEGIN_LICENSE:LGPL21$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandhardwareintegration_p.h b/src/plugins/platforms/wayland/hardwareintegration/qwaylandhardwareintegration_p.h index 503e69b033f..c672b2b2777 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandhardwareintegration_p.h +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandhardwareintegration_p.h @@ -1,40 +1,32 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $QT_BEGIN_LICENSE:LGPL21$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegration.cpp b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegration.cpp index 07780f52ebb..347de3d2155 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegration.cpp +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegration.cpp @@ -1,40 +1,32 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $QT_BEGIN_LICENSE:LGPL21$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegration_p.h b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegration_p.h index 7732cea2744..286860c3671 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegration_p.h +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegration_p.h @@ -1,40 +1,32 @@ /**************************************************************************** ** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $QT_BEGIN_LICENSE:LGPL21$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationfactory.cpp b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationfactory.cpp index 3df77a003bd..1f5a97d8a5f 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationfactory.cpp +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationfactory.cpp @@ -1,40 +1,32 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $QT_BEGIN_LICENSE:LGPL21$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationfactory_p.h b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationfactory_p.h index 5fcce2ba6ab..6daa2e074ce 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationfactory_p.h +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationfactory_p.h @@ -1,40 +1,32 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $QT_BEGIN_LICENSE:LGPL21$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationplugin.cpp b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationplugin.cpp index e77bec0e762..641e63ac12e 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationplugin.cpp +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationplugin.cpp @@ -1,40 +1,32 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $QT_BEGIN_LICENSE:LGPL21$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationplugin_p.h b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationplugin_p.h index f74ee1ad131..51d64512ab2 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationplugin_p.h +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationplugin_p.h @@ -1,40 +1,32 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $QT_BEGIN_LICENSE:LGPL21$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegration_p.h b/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegration_p.h index 54ead23c454..3feb8868432 100644 --- a/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegration_p.h +++ b/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegration_p.h @@ -1,40 +1,32 @@ /**************************************************************************** ** ** Copyright (C) 2014 LG Electronics Ltd -** Contact: http://www.qt-project.org/legal +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $QT_BEGIN_LICENSE:LGPL21$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationfactory.cpp b/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationfactory.cpp index f9e459ed9cc..143facfcabe 100644 --- a/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationfactory.cpp +++ b/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationfactory.cpp @@ -1,40 +1,32 @@ /**************************************************************************** ** ** Copyright (C) 2014 LG Electronics Ltd -** Contact: http://www.qt-project.org/legal +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $QT_BEGIN_LICENSE:LGPL21$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationfactory_p.h b/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationfactory_p.h index 74cfba8c878..1eddca862f8 100644 --- a/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationfactory_p.h +++ b/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationfactory_p.h @@ -1,40 +1,32 @@ /**************************************************************************** ** ** Copyright (C) 2014 LG Electronics Ltd -** Contact: http://www.qt-project.org/legal +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $QT_BEGIN_LICENSE:LGPL21$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationplugin.cpp b/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationplugin.cpp index c78a095966b..9fc9b8045a0 100644 --- a/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationplugin.cpp +++ b/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationplugin.cpp @@ -1,40 +1,32 @@ /**************************************************************************** ** ** Copyright (C) 2014 LG Electronics Ltd -** Contact: http://www.qt-project.org/legal +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $QT_BEGIN_LICENSE:LGPL21$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationplugin_p.h b/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationplugin_p.h index 9723191d80b..ab646417dfb 100644 --- a/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationplugin_p.h +++ b/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationplugin_p.h @@ -1,40 +1,32 @@ /**************************************************************************** ** ** Copyright (C) 2014 LG Electronics Ltd -** Contact: http://www.qt-project.org/legal +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $QT_BEGIN_LICENSE:LGPL21$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp b/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp index eb4245627e3..00a91e242a7 100644 --- a/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp +++ b/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp @@ -1,41 +1,33 @@ /**************************************************************************** ** ** Copyright (C) 2014 Robin Burchell -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $QT_BEGIN_LICENSE:LGPL21$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/main.cpp b/src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/main.cpp index eb0d99c4c60..68befb44bce 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/main.cpp +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/main.cpp @@ -1,40 +1,32 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $QT_BEGIN_LICENSE:LGPL21$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/drm-egl-server/main.cpp b/src/plugins/platforms/wayland/plugins/hardwareintegration/drm-egl-server/main.cpp index 3a74a8f8e2d..ef9126633bb 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/drm-egl-server/main.cpp +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/drm-egl-server/main.cpp @@ -1,40 +1,32 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $QT_BEGIN_LICENSE:LGPL21$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/libhybris-egl-server/main.cpp b/src/plugins/platforms/wayland/plugins/hardwareintegration/libhybris-egl-server/main.cpp index 18d002e2c3e..e51c4bfb5cd 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/libhybris-egl-server/main.cpp +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/libhybris-egl-server/main.cpp @@ -1,40 +1,32 @@ /**************************************************************************** ** ** Copyright (C) 2014 Jolla Ltd, author: -** Contact: http://www.qt-project.org/legal +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $QT_BEGIN_LICENSE:LGPL21$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/main.cpp b/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/main.cpp index 020a41e02e2..3830e705bc5 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/main.cpp +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/main.cpp @@ -1,40 +1,32 @@ /**************************************************************************** ** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $QT_BEGIN_LICENSE:LGPL21$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-egl/main.cpp b/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-egl/main.cpp index eddb5cbdcbe..4290fe28a14 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-egl/main.cpp +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-egl/main.cpp @@ -1,40 +1,32 @@ /**************************************************************************** ** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $QT_BEGIN_LICENSE:LGPL21$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-glx/main.cpp b/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-glx/main.cpp index 0b3c313346a..792894232d0 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-glx/main.cpp +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-glx/main.cpp @@ -1,40 +1,32 @@ /**************************************************************************** ** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $QT_BEGIN_LICENSE:LGPL21$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/plugins/platforms/wayland/qwaylandabstractdecoration.cpp b/src/plugins/platforms/wayland/qwaylandabstractdecoration.cpp index 6ad78aaa348..7698ff75082 100644 --- a/src/plugins/platforms/wayland/qwaylandabstractdecoration.cpp +++ b/src/plugins/platforms/wayland/qwaylandabstractdecoration.cpp @@ -1,41 +1,33 @@ /**************************************************************************** ** ** Copyright (C) 2014 Robin Burchell -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $QT_BEGIN_LICENSE:LGPL21$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/plugins/platforms/wayland/qwaylandabstractdecoration_p.h b/src/plugins/platforms/wayland/qwaylandabstractdecoration_p.h index 891e67a8fbc..e489c09a039 100644 --- a/src/plugins/platforms/wayland/qwaylandabstractdecoration_p.h +++ b/src/plugins/platforms/wayland/qwaylandabstractdecoration_p.h @@ -1,41 +1,33 @@ /**************************************************************************** ** ** Copyright (C) 2014 Robin Burchell -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $QT_BEGIN_LICENSE:LGPL21$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/plugins/platforms/wayland/qwaylandbuffer_p.h b/src/plugins/platforms/wayland/qwaylandbuffer_p.h index db6bbd9bb7f..6fff45014a7 100644 --- a/src/plugins/platforms/wayland/qwaylandbuffer_p.h +++ b/src/plugins/platforms/wayland/qwaylandbuffer_p.h @@ -1,40 +1,32 @@ /**************************************************************************** ** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $QT_BEGIN_LICENSE:LGPL21$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/plugins/platforms/wayland/qwaylandclientexport_p.h b/src/plugins/platforms/wayland/qwaylandclientexport_p.h index d9d6d7f7cd9..993c900be5d 100644 --- a/src/plugins/platforms/wayland/qwaylandclientexport_p.h +++ b/src/plugins/platforms/wayland/qwaylandclientexport_p.h @@ -1,40 +1,32 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $QT_BEGIN_LICENSE:LGPL21$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/plugins/platforms/wayland/qwaylandclipboard.cpp b/src/plugins/platforms/wayland/qwaylandclipboard.cpp index 3e25875f04d..a2b7a6697de 100644 --- a/src/plugins/platforms/wayland/qwaylandclipboard.cpp +++ b/src/plugins/platforms/wayland/qwaylandclipboard.cpp @@ -1,40 +1,32 @@ /**************************************************************************** ** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $QT_BEGIN_LICENSE:LGPL21$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/plugins/platforms/wayland/qwaylandclipboard_p.h b/src/plugins/platforms/wayland/qwaylandclipboard_p.h index 6c181de1bfb..26cbbaeec74 100644 --- a/src/plugins/platforms/wayland/qwaylandclipboard_p.h +++ b/src/plugins/platforms/wayland/qwaylandclipboard_p.h @@ -1,40 +1,32 @@ /**************************************************************************** ** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $QT_BEGIN_LICENSE:LGPL21$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/plugins/platforms/wayland/qwaylandcursor.cpp b/src/plugins/platforms/wayland/qwaylandcursor.cpp index 8dd4bce1ac6..8e8293a09a4 100644 --- a/src/plugins/platforms/wayland/qwaylandcursor.cpp +++ b/src/plugins/platforms/wayland/qwaylandcursor.cpp @@ -1,40 +1,32 @@ /**************************************************************************** ** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $QT_BEGIN_LICENSE:LGPL21$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/plugins/platforms/wayland/qwaylandcursor_p.h b/src/plugins/platforms/wayland/qwaylandcursor_p.h index d832922d854..02023dd5517 100644 --- a/src/plugins/platforms/wayland/qwaylandcursor_p.h +++ b/src/plugins/platforms/wayland/qwaylandcursor_p.h @@ -1,40 +1,32 @@ /**************************************************************************** ** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $QT_BEGIN_LICENSE:LGPL21$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/plugins/platforms/wayland/qwaylanddatadevice.cpp b/src/plugins/platforms/wayland/qwaylanddatadevice.cpp index 0d6ea711235..03a8c4b83ec 100644 --- a/src/plugins/platforms/wayland/qwaylanddatadevice.cpp +++ b/src/plugins/platforms/wayland/qwaylanddatadevice.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2013 Klarälvdalens Datakonsult AB (KDAB). -** Contact: http://www.qt-project.org/legal +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the Qt Compositor. ** @@ -17,8 +17,8 @@ ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived +** * Neither the name of The Qt Company Ltd nor the names of its +** contributors may be used to endorse or promote products derived ** from this software without specific prior written permission. ** ** diff --git a/src/plugins/platforms/wayland/qwaylanddatadevice_p.h b/src/plugins/platforms/wayland/qwaylanddatadevice_p.h index a80312c9423..d6d38d68189 100644 --- a/src/plugins/platforms/wayland/qwaylanddatadevice_p.h +++ b/src/plugins/platforms/wayland/qwaylanddatadevice_p.h @@ -1,7 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2013 Klarälvdalens Datakonsult AB (KDAB). -** Contact: http://www.qt-project.org/legal +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the Qt Compositor. ** @@ -17,8 +17,8 @@ ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived +** * Neither the name of The Qt Company Ltd nor the names of its +** contributors may be used to endorse or promote products derived ** from this software without specific prior written permission. ** ** diff --git a/src/plugins/platforms/wayland/qwaylanddatadevicemanager.cpp b/src/plugins/platforms/wayland/qwaylanddatadevicemanager.cpp index c86d1ba8ab7..b5a98b090e7 100644 --- a/src/plugins/platforms/wayland/qwaylanddatadevicemanager.cpp +++ b/src/plugins/platforms/wayland/qwaylanddatadevicemanager.cpp @@ -1,40 +1,32 @@ /**************************************************************************** ** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $QT_BEGIN_LICENSE:LGPL21$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/plugins/platforms/wayland/qwaylanddatadevicemanager_p.h b/src/plugins/platforms/wayland/qwaylanddatadevicemanager_p.h index e622f6150cf..151197e3b90 100644 --- a/src/plugins/platforms/wayland/qwaylanddatadevicemanager_p.h +++ b/src/plugins/platforms/wayland/qwaylanddatadevicemanager_p.h @@ -1,40 +1,32 @@ /**************************************************************************** ** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $QT_BEGIN_LICENSE:LGPL21$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/plugins/platforms/wayland/qwaylanddataoffer.cpp b/src/plugins/platforms/wayland/qwaylanddataoffer.cpp index 7b69ce6ce90..dd28f787041 100644 --- a/src/plugins/platforms/wayland/qwaylanddataoffer.cpp +++ b/src/plugins/platforms/wayland/qwaylanddataoffer.cpp @@ -1,40 +1,32 @@ /**************************************************************************** ** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $QT_BEGIN_LICENSE:LGPL21$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/plugins/platforms/wayland/qwaylanddataoffer_p.h b/src/plugins/platforms/wayland/qwaylanddataoffer_p.h index cdaf8a7bafc..391ceb173a6 100644 --- a/src/plugins/platforms/wayland/qwaylanddataoffer_p.h +++ b/src/plugins/platforms/wayland/qwaylanddataoffer_p.h @@ -1,40 +1,32 @@ /**************************************************************************** ** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $QT_BEGIN_LICENSE:LGPL21$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/plugins/platforms/wayland/qwaylanddatasource.cpp b/src/plugins/platforms/wayland/qwaylanddatasource.cpp index cf92a361fb0..ad43b0698b7 100644 --- a/src/plugins/platforms/wayland/qwaylanddatasource.cpp +++ b/src/plugins/platforms/wayland/qwaylanddatasource.cpp @@ -1,40 +1,32 @@ /**************************************************************************** ** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $QT_BEGIN_LICENSE:LGPL21$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/plugins/platforms/wayland/qwaylanddatasource_p.h b/src/plugins/platforms/wayland/qwaylanddatasource_p.h index 09348f3354d..93f1f468170 100644 --- a/src/plugins/platforms/wayland/qwaylanddatasource_p.h +++ b/src/plugins/platforms/wayland/qwaylanddatasource_p.h @@ -1,40 +1,32 @@ /**************************************************************************** ** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $QT_BEGIN_LICENSE:LGPL21$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/plugins/platforms/wayland/qwaylanddecorationfactory.cpp b/src/plugins/platforms/wayland/qwaylanddecorationfactory.cpp index 4d36f7966ae..7e77b231861 100644 --- a/src/plugins/platforms/wayland/qwaylanddecorationfactory.cpp +++ b/src/plugins/platforms/wayland/qwaylanddecorationfactory.cpp @@ -1,40 +1,32 @@ /**************************************************************************** ** ** Copyright (C) 2014 Robin Burchell -** Contact: http://www.qt-project.org/legal +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $QT_BEGIN_LICENSE:LGPL21$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/plugins/platforms/wayland/qwaylanddecorationfactory_p.h b/src/plugins/platforms/wayland/qwaylanddecorationfactory_p.h index 144ae101be9..de830aaf0af 100644 --- a/src/plugins/platforms/wayland/qwaylanddecorationfactory_p.h +++ b/src/plugins/platforms/wayland/qwaylanddecorationfactory_p.h @@ -1,40 +1,32 @@ /**************************************************************************** ** ** Copyright (C) 2014 Robin Burchell -** Contact: http://www.qt-project.org/legal +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $QT_BEGIN_LICENSE:LGPL21$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/plugins/platforms/wayland/qwaylanddecorationplugin.cpp b/src/plugins/platforms/wayland/qwaylanddecorationplugin.cpp index 3c6463a1f5e..bf7eca816b3 100644 --- a/src/plugins/platforms/wayland/qwaylanddecorationplugin.cpp +++ b/src/plugins/platforms/wayland/qwaylanddecorationplugin.cpp @@ -1,40 +1,32 @@ /**************************************************************************** ** ** Copyright (C) 2014 Robin Burchell -** Contact: http://www.qt-project.org/legal +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $QT_BEGIN_LICENSE:LGPL21$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/plugins/platforms/wayland/qwaylanddecorationplugin_p.h b/src/plugins/platforms/wayland/qwaylanddecorationplugin_p.h index 9425bd348e9..9f19b29480e 100644 --- a/src/plugins/platforms/wayland/qwaylanddecorationplugin_p.h +++ b/src/plugins/platforms/wayland/qwaylanddecorationplugin_p.h @@ -1,40 +1,32 @@ /**************************************************************************** ** ** Copyright (C) 2014 Robin Burchell -** Contact: http://www.qt-project.org/legal +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $QT_BEGIN_LICENSE:LGPL21$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index c380b78ee12..23645c8ccce 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -1,40 +1,32 @@ /**************************************************************************** ** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $QT_BEGIN_LICENSE:LGPL21$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/plugins/platforms/wayland/qwaylanddisplay_p.h b/src/plugins/platforms/wayland/qwaylanddisplay_p.h index 394fd427017..e89cde997fe 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay_p.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay_p.h @@ -1,40 +1,32 @@ /**************************************************************************** ** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $QT_BEGIN_LICENSE:LGPL21$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/plugins/platforms/wayland/qwaylanddnd.cpp b/src/plugins/platforms/wayland/qwaylanddnd.cpp index 85deaf27f0f..302864d4ba6 100644 --- a/src/plugins/platforms/wayland/qwaylanddnd.cpp +++ b/src/plugins/platforms/wayland/qwaylanddnd.cpp @@ -1,40 +1,32 @@ /**************************************************************************** ** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $QT_BEGIN_LICENSE:LGPL21$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/plugins/platforms/wayland/qwaylanddnd_p.h b/src/plugins/platforms/wayland/qwaylanddnd_p.h index 0154f122ffd..994c65c4504 100644 --- a/src/plugins/platforms/wayland/qwaylanddnd_p.h +++ b/src/plugins/platforms/wayland/qwaylanddnd_p.h @@ -1,40 +1,32 @@ /**************************************************************************** ** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $QT_BEGIN_LICENSE:LGPL21$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/plugins/platforms/wayland/qwaylandeventthread.cpp b/src/plugins/platforms/wayland/qwaylandeventthread.cpp index 6cce6c19d69..e2e21c9e76d 100644 --- a/src/plugins/platforms/wayland/qwaylandeventthread.cpp +++ b/src/plugins/platforms/wayland/qwaylandeventthread.cpp @@ -1,40 +1,32 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $QT_BEGIN_LICENSE:LGPL21$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/plugins/platforms/wayland/qwaylandeventthread_p.h b/src/plugins/platforms/wayland/qwaylandeventthread_p.h index b96c97c2a99..cd64b7046d6 100644 --- a/src/plugins/platforms/wayland/qwaylandeventthread_p.h +++ b/src/plugins/platforms/wayland/qwaylandeventthread_p.h @@ -1,40 +1,32 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $QT_BEGIN_LICENSE:LGPL21$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/plugins/platforms/wayland/qwaylandextendedoutput.cpp b/src/plugins/platforms/wayland/qwaylandextendedoutput.cpp index 26fba99e461..d1e8ffe2f9e 100644 --- a/src/plugins/platforms/wayland/qwaylandextendedoutput.cpp +++ b/src/plugins/platforms/wayland/qwaylandextendedoutput.cpp @@ -1,40 +1,32 @@ /**************************************************************************** ** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $QT_BEGIN_LICENSE:LGPL21$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/plugins/platforms/wayland/qwaylandextendedoutput_p.h b/src/plugins/platforms/wayland/qwaylandextendedoutput_p.h index 0ac24d606bd..b3e4c469e50 100644 --- a/src/plugins/platforms/wayland/qwaylandextendedoutput_p.h +++ b/src/plugins/platforms/wayland/qwaylandextendedoutput_p.h @@ -1,40 +1,32 @@ /**************************************************************************** ** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $QT_BEGIN_LICENSE:LGPL21$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/plugins/platforms/wayland/qwaylandextendedsurface.cpp b/src/plugins/platforms/wayland/qwaylandextendedsurface.cpp index 5cb5ec04997..d446b7845e4 100644 --- a/src/plugins/platforms/wayland/qwaylandextendedsurface.cpp +++ b/src/plugins/platforms/wayland/qwaylandextendedsurface.cpp @@ -1,40 +1,32 @@ /**************************************************************************** ** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $QT_BEGIN_LICENSE:LGPL21$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/plugins/platforms/wayland/qwaylandextendedsurface_p.h b/src/plugins/platforms/wayland/qwaylandextendedsurface_p.h index fe0ea593844..efd7a0b2b62 100644 --- a/src/plugins/platforms/wayland/qwaylandextendedsurface_p.h +++ b/src/plugins/platforms/wayland/qwaylandextendedsurface_p.h @@ -1,40 +1,32 @@ /**************************************************************************** ** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $QT_BEGIN_LICENSE:LGPL21$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/plugins/platforms/wayland/qwaylandinputcontext.cpp b/src/plugins/platforms/wayland/qwaylandinputcontext.cpp index e2b346223ac..119a1528787 100644 --- a/src/plugins/platforms/wayland/qwaylandinputcontext.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputcontext.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2013 Klarälvdalens Datakonsult AB (KDAB). -** Contact: http://www.qt-project.org/legal +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the Qt Compositor. ** @@ -17,8 +17,8 @@ ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived +** * Neither the name of The Qt Company Ltd nor the names of its +** contributors may be used to endorse or promote products derived ** from this software without specific prior written permission. ** ** diff --git a/src/plugins/platforms/wayland/qwaylandinputcontext_p.h b/src/plugins/platforms/wayland/qwaylandinputcontext_p.h index 02dd512a289..522e95fff7b 100644 --- a/src/plugins/platforms/wayland/qwaylandinputcontext_p.h +++ b/src/plugins/platforms/wayland/qwaylandinputcontext_p.h @@ -1,7 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2013 Klarälvdalens Datakonsult AB (KDAB). -** Contact: http://www.qt-project.org/legal +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the Qt Compositor. ** @@ -17,8 +17,8 @@ ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived +** * Neither the name of The Qt Company Ltd nor the names of its +** contributors may be used to endorse or promote products derived ** from this software without specific prior written permission. ** ** diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index 63bbeb14acb..2e032cafdf2 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -1,40 +1,32 @@ /**************************************************************************** ** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $QT_BEGIN_LICENSE:LGPL21$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h index 65e21ed58a2..23172ad3c93 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h +++ b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h @@ -1,40 +1,32 @@ /**************************************************************************** ** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $QT_BEGIN_LICENSE:LGPL21$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/plugins/platforms/wayland/qwaylandintegration.cpp b/src/plugins/platforms/wayland/qwaylandintegration.cpp index 60dc1b49254..050feba736b 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandintegration.cpp @@ -1,40 +1,32 @@ /**************************************************************************** ** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the config.tests of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $QT_BEGIN_LICENSE:LGPL21$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/plugins/platforms/wayland/qwaylandintegration_p.h b/src/plugins/platforms/wayland/qwaylandintegration_p.h index 745b88a6f88..ef180cdaf0e 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration_p.h +++ b/src/plugins/platforms/wayland/qwaylandintegration_p.h @@ -1,40 +1,32 @@ /**************************************************************************** ** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $QT_BEGIN_LICENSE:LGPL21$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp b/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp index 89217734506..8170c39f1b3 100644 --- a/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp +++ b/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp @@ -1,40 +1,32 @@ /**************************************************************************** ** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $QT_BEGIN_LICENSE:LGPL21$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/plugins/platforms/wayland/qwaylandnativeinterface_p.h b/src/plugins/platforms/wayland/qwaylandnativeinterface_p.h index 6f6a62b76b8..04a46075d4e 100644 --- a/src/plugins/platforms/wayland/qwaylandnativeinterface_p.h +++ b/src/plugins/platforms/wayland/qwaylandnativeinterface_p.h @@ -1,40 +1,32 @@ /**************************************************************************** ** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $QT_BEGIN_LICENSE:LGPL21$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/plugins/platforms/wayland/qwaylandqtkey.cpp b/src/plugins/platforms/wayland/qwaylandqtkey.cpp index 1eda126cfe0..51534e60566 100644 --- a/src/plugins/platforms/wayland/qwaylandqtkey.cpp +++ b/src/plugins/platforms/wayland/qwaylandqtkey.cpp @@ -1,40 +1,32 @@ /**************************************************************************** ** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $QT_BEGIN_LICENSE:LGPL21$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/plugins/platforms/wayland/qwaylandqtkey_p.h b/src/plugins/platforms/wayland/qwaylandqtkey_p.h index f705775c4ad..322549d5bda 100644 --- a/src/plugins/platforms/wayland/qwaylandqtkey_p.h +++ b/src/plugins/platforms/wayland/qwaylandqtkey_p.h @@ -1,40 +1,32 @@ /**************************************************************************** ** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $QT_BEGIN_LICENSE:LGPL21$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/plugins/platforms/wayland/qwaylandscreen.cpp b/src/plugins/platforms/wayland/qwaylandscreen.cpp index 56885531cef..acd125c6275 100644 --- a/src/plugins/platforms/wayland/qwaylandscreen.cpp +++ b/src/plugins/platforms/wayland/qwaylandscreen.cpp @@ -1,40 +1,32 @@ /**************************************************************************** ** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $QT_BEGIN_LICENSE:LGPL21$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/plugins/platforms/wayland/qwaylandscreen_p.h b/src/plugins/platforms/wayland/qwaylandscreen_p.h index b1b4a73f7b3..35adee34a5b 100644 --- a/src/plugins/platforms/wayland/qwaylandscreen_p.h +++ b/src/plugins/platforms/wayland/qwaylandscreen_p.h @@ -1,40 +1,32 @@ /**************************************************************************** ** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $QT_BEGIN_LICENSE:LGPL21$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/plugins/platforms/wayland/qwaylandshellsurface.cpp b/src/plugins/platforms/wayland/qwaylandshellsurface.cpp index 997d4ac5bac..f90ed0597c2 100644 --- a/src/plugins/platforms/wayland/qwaylandshellsurface.cpp +++ b/src/plugins/platforms/wayland/qwaylandshellsurface.cpp @@ -1,40 +1,32 @@ /**************************************************************************** ** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the config.tests of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $QT_BEGIN_LICENSE:LGPL21$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/plugins/platforms/wayland/qwaylandshellsurface_p.h b/src/plugins/platforms/wayland/qwaylandshellsurface_p.h index 28e55be3541..af5b6f22434 100644 --- a/src/plugins/platforms/wayland/qwaylandshellsurface_p.h +++ b/src/plugins/platforms/wayland/qwaylandshellsurface_p.h @@ -1,40 +1,32 @@ /**************************************************************************** ** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the config.tests of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $QT_BEGIN_LICENSE:LGPL21$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp b/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp index 8eab510bf7e..c0004d0ea8d 100644 --- a/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp +++ b/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp @@ -1,40 +1,32 @@ /**************************************************************************** ** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $QT_BEGIN_LICENSE:LGPL21$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/plugins/platforms/wayland/qwaylandshmbackingstore_p.h b/src/plugins/platforms/wayland/qwaylandshmbackingstore_p.h index a6db31c9817..17e84f3cd12 100644 --- a/src/plugins/platforms/wayland/qwaylandshmbackingstore_p.h +++ b/src/plugins/platforms/wayland/qwaylandshmbackingstore_p.h @@ -1,40 +1,32 @@ /**************************************************************************** ** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $QT_BEGIN_LICENSE:LGPL21$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/plugins/platforms/wayland/qwaylandshmwindow.cpp b/src/plugins/platforms/wayland/qwaylandshmwindow.cpp index d2599370a78..2d34d6e6147 100644 --- a/src/plugins/platforms/wayland/qwaylandshmwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandshmwindow.cpp @@ -1,40 +1,32 @@ /**************************************************************************** ** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the config.tests of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $QT_BEGIN_LICENSE:LGPL21$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/plugins/platforms/wayland/qwaylandshmwindow_p.h b/src/plugins/platforms/wayland/qwaylandshmwindow_p.h index 1c0c5c15efc..b046c5d8490 100644 --- a/src/plugins/platforms/wayland/qwaylandshmwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandshmwindow_p.h @@ -1,40 +1,32 @@ /**************************************************************************** ** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the config.tests of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $QT_BEGIN_LICENSE:LGPL21$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/plugins/platforms/wayland/qwaylandsubsurface.cpp b/src/plugins/platforms/wayland/qwaylandsubsurface.cpp index 19ba3248db3..81cfef254bf 100644 --- a/src/plugins/platforms/wayland/qwaylandsubsurface.cpp +++ b/src/plugins/platforms/wayland/qwaylandsubsurface.cpp @@ -1,40 +1,32 @@ /**************************************************************************** ** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $QT_BEGIN_LICENSE:LGPL21$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/plugins/platforms/wayland/qwaylandsubsurface_p.h b/src/plugins/platforms/wayland/qwaylandsubsurface_p.h index 93b767352b7..232330855b8 100644 --- a/src/plugins/platforms/wayland/qwaylandsubsurface_p.h +++ b/src/plugins/platforms/wayland/qwaylandsubsurface_p.h @@ -1,40 +1,32 @@ /**************************************************************************** ** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $QT_BEGIN_LICENSE:LGPL21$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/plugins/platforms/wayland/qwaylandtouch.cpp b/src/plugins/platforms/wayland/qwaylandtouch.cpp index f2b85c225cd..987f18cd1e0 100644 --- a/src/plugins/platforms/wayland/qwaylandtouch.cpp +++ b/src/plugins/platforms/wayland/qwaylandtouch.cpp @@ -1,40 +1,32 @@ /**************************************************************************** ** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $QT_BEGIN_LICENSE:LGPL21$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/plugins/platforms/wayland/qwaylandtouch_p.h b/src/plugins/platforms/wayland/qwaylandtouch_p.h index bbe15992999..2dda6243a4b 100644 --- a/src/plugins/platforms/wayland/qwaylandtouch_p.h +++ b/src/plugins/platforms/wayland/qwaylandtouch_p.h @@ -1,40 +1,32 @@ /**************************************************************************** ** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $QT_BEGIN_LICENSE:LGPL21$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index b01e1f10872..d6e2b86c556 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -1,40 +1,32 @@ /**************************************************************************** ** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the config.tests of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $QT_BEGIN_LICENSE:LGPL21$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index 21d4886ccf1..1898c4953db 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -1,40 +1,32 @@ /**************************************************************************** ** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the config.tests of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $QT_BEGIN_LICENSE:LGPL21$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration.cpp b/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration.cpp index 44f93815e71..56fe7c5a3d5 100644 --- a/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration.cpp @@ -1,40 +1,32 @@ /**************************************************************************** ** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $QT_BEGIN_LICENSE:LGPL21$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration_p.h b/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration_p.h index 4ecad94e023..612cda43ef8 100644 --- a/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration_p.h @@ -1,40 +1,32 @@ /**************************************************************************** ** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $QT_BEGIN_LICENSE:LGPL21$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/plugins/platforms/wayland/qwaylandwlshellsurface.cpp b/src/plugins/platforms/wayland/qwaylandwlshellsurface.cpp index 0f249e36e88..8888dbf4d32 100644 --- a/src/plugins/platforms/wayland/qwaylandwlshellsurface.cpp +++ b/src/plugins/platforms/wayland/qwaylandwlshellsurface.cpp @@ -1,40 +1,32 @@ /**************************************************************************** ** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the config.tests of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $QT_BEGIN_LICENSE:LGPL21$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/plugins/platforms/wayland/qwaylandwlshellsurface_p.h b/src/plugins/platforms/wayland/qwaylandwlshellsurface_p.h index 54917b56052..88037d9ccb2 100644 --- a/src/plugins/platforms/wayland/qwaylandwlshellsurface_p.h +++ b/src/plugins/platforms/wayland/qwaylandwlshellsurface_p.h @@ -1,40 +1,32 @@ /**************************************************************************** ** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the config.tests of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $QT_BEGIN_LICENSE:LGPL21$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/plugins/platforms/wayland/qwaylandxdgshell.cpp b/src/plugins/platforms/wayland/qwaylandxdgshell.cpp index 20a6da5e596..65fafcead77 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgshell.cpp +++ b/src/plugins/platforms/wayland/qwaylandxdgshell.cpp @@ -1,40 +1,32 @@ /**************************************************************************** ** ** Copyright (C) 2014 Eurogiciel, author: -** Contact: http://www.qt-project.org/legal +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the config.tests of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $QT_BEGIN_LICENSE:LGPL21$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/plugins/platforms/wayland/qwaylandxdgshell_p.h b/src/plugins/platforms/wayland/qwaylandxdgshell_p.h index f2e2e7bb409..954dc5707a9 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgshell_p.h +++ b/src/plugins/platforms/wayland/qwaylandxdgshell_p.h @@ -1,40 +1,32 @@ /**************************************************************************** ** ** Copyright (C) 2014 Eurogiciel, author: -** Contact: http://www.qt-project.org/legal +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the config.tests of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $QT_BEGIN_LICENSE:LGPL21$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/plugins/platforms/wayland/qwaylandxdgsurface.cpp b/src/plugins/platforms/wayland/qwaylandxdgsurface.cpp index 611a01bb69b..f06d7e35391 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgsurface.cpp +++ b/src/plugins/platforms/wayland/qwaylandxdgsurface.cpp @@ -1,40 +1,32 @@ /**************************************************************************** ** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the config.tests of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $QT_BEGIN_LICENSE:LGPL21$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/plugins/platforms/wayland/qwaylandxdgsurface_p.h b/src/plugins/platforms/wayland/qwaylandxdgsurface_p.h index 862e177a1f2..ffbe41a4458 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgsurface_p.h +++ b/src/plugins/platforms/wayland/qwaylandxdgsurface_p.h @@ -1,40 +1,32 @@ /**************************************************************************** ** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the config.tests of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $QT_BEGIN_LICENSE:LGPL21$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/plugins/platforms/wayland/shared/qwaylandmimehelper.cpp b/src/plugins/platforms/wayland/shared/qwaylandmimehelper.cpp index 94a107c8125..ce193812d7f 100644 --- a/src/plugins/platforms/wayland/shared/qwaylandmimehelper.cpp +++ b/src/plugins/platforms/wayland/shared/qwaylandmimehelper.cpp @@ -1,40 +1,32 @@ /**************************************************************************** ** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $QT_BEGIN_LICENSE:LGPL21$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/plugins/platforms/wayland/shared/qwaylandmimehelper.h b/src/plugins/platforms/wayland/shared/qwaylandmimehelper.h index 539fc3adc80..5db0484a257 100644 --- a/src/plugins/platforms/wayland/shared/qwaylandmimehelper.h +++ b/src/plugins/platforms/wayland/shared/qwaylandmimehelper.h @@ -1,40 +1,32 @@ /**************************************************************************** ** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $QT_BEGIN_LICENSE:LGPL21$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/plugins/platforms/wayland/shared/qwaylandshmformathelper.h b/src/plugins/platforms/wayland/shared/qwaylandshmformathelper.h index 131ad780d7d..2923e0106e5 100644 --- a/src/plugins/platforms/wayland/shared/qwaylandshmformathelper.h +++ b/src/plugins/platforms/wayland/shared/qwaylandshmformathelper.h @@ -1,40 +1,32 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $QT_BEGIN_LICENSE:LGPL21$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegration_p.h b/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegration_p.h index 31fa98edb1e..a4b40b08857 100644 --- a/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegration_p.h +++ b/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegration_p.h @@ -1,40 +1,32 @@ /**************************************************************************** ** ** Copyright (C) 2014 Jolla Ltd -** Contact: http://www.qt-project.org/legal +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $QT_BEGIN_LICENSE:LGPL21$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationfactory.cpp b/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationfactory.cpp index 4af65d4c074..1d901962caa 100644 --- a/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationfactory.cpp +++ b/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationfactory.cpp @@ -1,40 +1,32 @@ /**************************************************************************** ** ** Copyright (C) 2014 Jolla Ltd -** Contact: http://www.qt-project.org/legal +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $QT_BEGIN_LICENSE:LGPL21$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationfactory_p.h b/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationfactory_p.h index 3b7fa357dc3..873e57aec57 100644 --- a/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationfactory_p.h +++ b/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationfactory_p.h @@ -1,40 +1,32 @@ /**************************************************************************** ** ** Copyright (C) 2014 Jolla Ltd -** Contact: http://www.qt-project.org/legal +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $QT_BEGIN_LICENSE:LGPL21$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationplugin.cpp b/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationplugin.cpp index bbca1558d35..330605672a1 100644 --- a/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationplugin.cpp +++ b/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationplugin.cpp @@ -1,40 +1,32 @@ /**************************************************************************** ** ** Copyright (C) 2014 Jolla Ltd -** Contact: http://www.qt-project.org/legal +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $QT_BEGIN_LICENSE:LGPL21$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationplugin_p.h b/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationplugin_p.h index 07438e7a6f6..9bae57cc981 100644 --- a/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationplugin_p.h +++ b/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationplugin_p.h @@ -1,40 +1,32 @@ /**************************************************************************** ** ** Copyright (C) 2014 Jolla Ltd -** Contact: http://www.qt-project.org/legal +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $QT_BEGIN_LICENSE:LGPL21$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp index ae5ec40db2e..a0b4afcfaf2 100644 --- a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp +++ b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp @@ -1,40 +1,32 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the tools applications of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $QT_BEGIN_LICENSE:LGPL21$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/tests/auto/wayland/mockcompositor.cpp b/tests/auto/wayland/mockcompositor.cpp index 665b7dd738d..2f73734f181 100644 --- a/tests/auto/wayland/mockcompositor.cpp +++ b/tests/auto/wayland/mockcompositor.cpp @@ -1,40 +1,32 @@ /**************************************************************************** ** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the test suite of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $QT_BEGIN_LICENSE:LGPL21$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/tests/auto/wayland/mockcompositor.h b/tests/auto/wayland/mockcompositor.h index 03d3a96a354..cf3b270a28c 100644 --- a/tests/auto/wayland/mockcompositor.h +++ b/tests/auto/wayland/mockcompositor.h @@ -1,40 +1,32 @@ /**************************************************************************** ** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the test suite of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $QT_BEGIN_LICENSE:LGPL21$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/tests/auto/wayland/mockinput.cpp b/tests/auto/wayland/mockinput.cpp index 754aa45904a..5b1d4f4fda4 100644 --- a/tests/auto/wayland/mockinput.cpp +++ b/tests/auto/wayland/mockinput.cpp @@ -1,40 +1,32 @@ /**************************************************************************** ** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the test suite of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $QT_BEGIN_LICENSE:LGPL21$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/tests/auto/wayland/mockinput.h b/tests/auto/wayland/mockinput.h index 16b19b4fb2a..7d36a532594 100644 --- a/tests/auto/wayland/mockinput.h +++ b/tests/auto/wayland/mockinput.h @@ -1,41 +1,33 @@ /**************************************************************************** ** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2015 The Qt Company Ltd. ** Copyright (C) 2013 Klarälvdalens Datakonsult AB (KDAB). -** Contact: http://www.qt-project.org/legal +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the test suite of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $QT_BEGIN_LICENSE:LGPL21$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/tests/auto/wayland/mockoutput.cpp b/tests/auto/wayland/mockoutput.cpp index 9b948ad4d3e..573de90b9cd 100644 --- a/tests/auto/wayland/mockoutput.cpp +++ b/tests/auto/wayland/mockoutput.cpp @@ -1,40 +1,32 @@ /**************************************************************************** ** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the test suite of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $QT_BEGIN_LICENSE:LGPL21$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/tests/auto/wayland/mockshell.cpp b/tests/auto/wayland/mockshell.cpp index 2a5969f70de..dfc39e5e4d6 100644 --- a/tests/auto/wayland/mockshell.cpp +++ b/tests/auto/wayland/mockshell.cpp @@ -1,40 +1,32 @@ /**************************************************************************** ** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the test suite of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $QT_BEGIN_LICENSE:LGPL21$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/tests/auto/wayland/mocksurface.cpp b/tests/auto/wayland/mocksurface.cpp index 330213bdea9..b6d338b29b6 100644 --- a/tests/auto/wayland/mocksurface.cpp +++ b/tests/auto/wayland/mocksurface.cpp @@ -1,40 +1,32 @@ /**************************************************************************** ** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the test suite of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $QT_BEGIN_LICENSE:LGPL21$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/tests/auto/wayland/mocksurface.h b/tests/auto/wayland/mocksurface.h index 33ced43854c..821d49f5447 100644 --- a/tests/auto/wayland/mocksurface.h +++ b/tests/auto/wayland/mocksurface.h @@ -1,40 +1,32 @@ /**************************************************************************** ** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the test suite of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $QT_BEGIN_LICENSE:LGPL21$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/tests/auto/wayland/tst_client.cpp b/tests/auto/wayland/tst_client.cpp index 113f9d9a850..dd35b681cfb 100644 --- a/tests/auto/wayland/tst_client.cpp +++ b/tests/auto/wayland/tst_client.cpp @@ -1,40 +1,32 @@ /**************************************************************************** ** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the test suite of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $QT_BEGIN_LICENSE:LGPL21$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** ** $QT_END_LICENSE$ ** ****************************************************************************/ From 62b155bedf50bbe04ec9c4b645ac0c64bb51e6c6 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Sat, 7 Mar 2015 17:59:48 -0800 Subject: [PATCH 0222/1507] Disable -Wcast-qual in qtwayland We have a lot of generated C source code that needs to do casting and C doesn't have const_cast, so the -Wcast-qual option produces a lot of noise. Let's make sure it isn't enabled in qmake.conf or qt_common.prf. Change-Id: Iee8cbc07c4434ce9b560ffff13c9635861a8eca9 Reviewed-by: Giulio Camuffo --- src/plugins/platforms/wayland/client.pro | 3 +++ .../hardwareintegration/drm-egl-server/drm-egl-server.pro | 3 +++ .../hardwareintegration/xcomposite-egl/xcomposite-egl.pro | 3 +++ 3 files changed, 9 insertions(+) diff --git a/src/plugins/platforms/wayland/client.pro b/src/plugins/platforms/wayland/client.pro index ef3cff054fc..00e9cd04a97 100644 --- a/src/plugins/platforms/wayland/client.pro +++ b/src/plugins/platforms/wayland/client.pro @@ -10,6 +10,9 @@ MODULE_PLUGIN_TYPES = \ load(qt_module) +# We have a bunch of C code with casts, so we can't have this option +QMAKE_CXXFLAGS_WARN_ON -= -Wcast-qual + CONFIG -= precompile_header CONFIG -= create_cmake CONFIG += link_pkgconfig qpa/genericunixfontdatabase wayland-scanner diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/drm-egl-server/drm-egl-server.pro b/src/plugins/platforms/wayland/plugins/hardwareintegration/drm-egl-server/drm-egl-server.pro index 3a57958683d..3c069b7dd94 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/drm-egl-server/drm-egl-server.pro +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/drm-egl-server/drm-egl-server.pro @@ -1,6 +1,9 @@ PLUGIN_TYPE = wayland-graphics-integration-client load(qt_plugin) +# We have a bunch of C code with casts, so we can't have this option +QMAKE_CXXFLAGS_WARN_ON -= -Wcast-qual + QT += waylandclient-private include(../../../../hardwareintegration/client/drm-egl-server/drm-egl-server.pri) diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-egl/xcomposite-egl.pro b/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-egl/xcomposite-egl.pro index 97e642fbb66..1af1786695f 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-egl/xcomposite-egl.pro +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-egl/xcomposite-egl.pro @@ -1,6 +1,9 @@ PLUGIN_TYPE = wayland-graphics-integration-client load(qt_plugin) +# We have a bunch of C code with casts, so we can't have this option +QMAKE_CXXFLAGS_WARN_ON -= -Wcast-qual + QT += waylandclient-private include(../../../../hardwareintegration/client/xcomposite-egl/xcomposite-egl.pri) From 936eaaf0abce769348d1417e0f4318b0f58bd35a Mon Sep 17 00:00:00 2001 From: Olivier Blin Date: Tue, 25 Nov 2014 15:20:33 +0100 Subject: [PATCH 0223/1507] Make QWaylandShellSurface a QObject to allow build without RTTI dynamic_cast can not be used when RTTI is disabled, so make QWaylandShellSurface a QObject. QWaylandWlShellSurface and QWaylandXdgSurface must also inherit from QWaylandShellSurface first, to properly inherit from QObject. Change-Id: I2addb8105a0fe61615d4bc905414f7ee7277029f Reviewed-by: Giulio Camuffo --- src/plugins/platforms/wayland/qwaylandshellsurface_p.h | 4 +++- src/plugins/platforms/wayland/qwaylandwindow.cpp | 4 ++-- src/plugins/platforms/wayland/qwaylandwlshellsurface_p.h | 5 +++-- src/plugins/platforms/wayland/qwaylandxdgsurface_p.h | 5 +++-- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandshellsurface_p.h b/src/plugins/platforms/wayland/qwaylandshellsurface_p.h index 6f2336162c2..1f2346a9b59 100644 --- a/src/plugins/platforms/wayland/qwaylandshellsurface_p.h +++ b/src/plugins/platforms/wayland/qwaylandshellsurface_p.h @@ -43,6 +43,7 @@ #define QWAYLANDSHELLSURFACE_H #include +#include #include @@ -56,8 +57,9 @@ class QWaylandWindow; class QWaylandInputDevice; class QWindow; -class Q_WAYLAND_CLIENT_EXPORT QWaylandShellSurface +class Q_WAYLAND_CLIENT_EXPORT QWaylandShellSurface : public QObject { + Q_OBJECT public: explicit QWaylandShellSurface(QWaylandWindow *window); virtual ~QWaylandShellSurface() {} diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 976ebba15c3..1b939726f03 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -232,7 +232,7 @@ void QWaylandWindow::setVisible(bool visible) parent = mDisplay->lastInputWindow(); } if (parent) { - QWaylandWlShellSurface *wlshellSurface = dynamic_cast(mShellSurface); + QWaylandWlShellSurface *wlshellSurface = qobject_cast(mShellSurface); if (wlshellSurface) wlshellSurface->setPopup(parent, mDisplay->lastInputDevice(), mDisplay->lastInputSerial()); } @@ -481,7 +481,7 @@ bool QWaylandWindow::createDecoration() { // so far only xdg-shell support this "unminimize" trick, may be moved elsewhere if (mState == Qt::WindowMinimized) { - QWaylandXdgSurface *xdgSurface = dynamic_cast(mShellSurface); + QWaylandXdgSurface *xdgSurface = qobject_cast(mShellSurface); if ( xdgSurface ) { if (xdgSurface->isFullscreen()) { setWindowStateInternal(Qt::WindowFullScreen); diff --git a/src/plugins/platforms/wayland/qwaylandwlshellsurface_p.h b/src/plugins/platforms/wayland/qwaylandwlshellsurface_p.h index 8d6e298b9da..c9b8ac942b3 100644 --- a/src/plugins/platforms/wayland/qwaylandwlshellsurface_p.h +++ b/src/plugins/platforms/wayland/qwaylandwlshellsurface_p.h @@ -57,9 +57,10 @@ class QWaylandInputDevice; class QWindow; class QWaylandExtendedSurface; -class Q_WAYLAND_CLIENT_EXPORT QWaylandWlShellSurface : public QtWayland::wl_shell_surface - , public QWaylandShellSurface +class Q_WAYLAND_CLIENT_EXPORT QWaylandWlShellSurface : public QWaylandShellSurface + , public QtWayland::wl_shell_surface { + Q_OBJECT public: QWaylandWlShellSurface(struct ::wl_shell_surface *shell_surface, QWaylandWindow *window); virtual ~QWaylandWlShellSurface(); diff --git a/src/plugins/platforms/wayland/qwaylandxdgsurface_p.h b/src/plugins/platforms/wayland/qwaylandxdgsurface_p.h index 635c9496a7e..f287157070d 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgsurface_p.h +++ b/src/plugins/platforms/wayland/qwaylandxdgsurface_p.h @@ -57,9 +57,10 @@ class QWaylandInputDevice; class QWindow; class QWaylandExtendedSurface; -class Q_WAYLAND_CLIENT_EXPORT QWaylandXdgSurface : public QtWayland::xdg_surface - , public QWaylandShellSurface +class Q_WAYLAND_CLIENT_EXPORT QWaylandXdgSurface : public QWaylandShellSurface + , public QtWayland::xdg_surface { + Q_OBJECT public: QWaylandXdgSurface(struct ::xdg_surface *shell_surface, QWaylandWindow *window); virtual ~QWaylandXdgSurface(); From babb58933fc1f279c9746749d11d537711526d7b Mon Sep 17 00:00:00 2001 From: Olivier Blin Date: Wed, 10 Dec 2014 14:22:48 +0100 Subject: [PATCH 0224/1507] Remove useless EGL linking in plugins EGL libs are already linked from the hardwareintegration pri file, and the plugins do not make direct use of any EGL symbol. Change-Id: If6ecfee16e8c9d8fee67f03419941ced92d1eff8 Reviewed-by: Giulio Camuffo --- .../wayland/plugins/hardwareintegration/brcm-egl/brcm-egl.pro | 2 -- .../hardwareintegration/drm-egl-server/drm-egl-server.pro | 2 -- .../libhybris-egl-server/libhybris-egl-server.pro | 2 -- 3 files changed, 6 deletions(-) diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/brcm-egl.pro b/src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/brcm-egl.pro index 39dcf570dec..6dbe53732ed 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/brcm-egl.pro +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/brcm-egl.pro @@ -5,8 +5,6 @@ QT += waylandclient-private include(../../../../hardwareintegration/client/brcm-egl/brcm-egl.pri) -LIBS += -lEGL - OTHER_FILES += \ brcm-egl.json diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/drm-egl-server/drm-egl-server.pro b/src/plugins/platforms/wayland/plugins/hardwareintegration/drm-egl-server/drm-egl-server.pro index 3a57958683d..0aba49dddf9 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/drm-egl-server/drm-egl-server.pro +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/drm-egl-server/drm-egl-server.pro @@ -5,8 +5,6 @@ QT += waylandclient-private include(../../../../hardwareintegration/client/drm-egl-server/drm-egl-server.pri) -LIBS += -lEGL - OTHER_FILES += \ drm-egl-server.json diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/libhybris-egl-server/libhybris-egl-server.pro b/src/plugins/platforms/wayland/plugins/hardwareintegration/libhybris-egl-server/libhybris-egl-server.pro index 6af6d5c10da..55f98415d58 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/libhybris-egl-server/libhybris-egl-server.pro +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/libhybris-egl-server/libhybris-egl-server.pro @@ -5,8 +5,6 @@ QT += waylandclient-private include(../../../../hardwareintegration/client/libhybris-egl-server/libhybris-egl-server.pri) -LIBS += -lEGL - OTHER_FILES += \ libhybris-egl-server.json From 43c14e514d8c7275b51e48925b6c3a48e90b38b0 Mon Sep 17 00:00:00 2001 From: Olivier Blin Date: Fri, 5 Dec 2014 14:27:06 +0100 Subject: [PATCH 0225/1507] Fix shm buffers init and destruction on failure Some pointers need to be initialized in QWaylandBuffer and QWaylandShmBuffer, and checked at destruction. This avoids crashes when shm surface creation fails. Change-Id: I6f6afa3cc6c67533b5130700cbc27b271764109e Reviewed-by: Giulio Camuffo --- src/plugins/platforms/wayland/qwaylandbuffer_p.h | 5 ++++- .../platforms/wayland/qwaylandshmbackingstore.cpp | 12 ++++++++---- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandbuffer_p.h b/src/plugins/platforms/wayland/qwaylandbuffer_p.h index 2bb9990f3dd..6d2bb66b392 100644 --- a/src/plugins/platforms/wayland/qwaylandbuffer_p.h +++ b/src/plugins/platforms/wayland/qwaylandbuffer_p.h @@ -54,7 +54,10 @@ QT_BEGIN_NAMESPACE class Q_WAYLAND_CLIENT_EXPORT QWaylandBuffer { public: - QWaylandBuffer() { } + QWaylandBuffer() + : mBuffer(0) + { + } virtual ~QWaylandBuffer() { } wl_buffer *buffer() {return mBuffer;} virtual QSize size() const = 0; diff --git a/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp b/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp index 6ca65f053aa..598e9f16079 100644 --- a/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp +++ b/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp @@ -58,7 +58,8 @@ QT_BEGIN_NAMESPACE QWaylandShmBuffer::QWaylandShmBuffer(QWaylandDisplay *display, const QSize &size, QImage::Format format) - : mMarginsImage(0) + : mShmPool(0) + , mMarginsImage(0) { int stride = size.width() * 4; int alloc = stride * size.height(); @@ -97,9 +98,12 @@ QWaylandShmBuffer::QWaylandShmBuffer(QWaylandDisplay *display, QWaylandShmBuffer::~QWaylandShmBuffer(void) { delete mMarginsImage; - munmap((void *) mImage.constBits(), mImage.byteCount()); - wl_buffer_destroy(mBuffer); - wl_shm_pool_destroy(mShmPool); + if (mImage.constBits()) + munmap((void *) mImage.constBits(), mImage.byteCount()); + if (mBuffer) + wl_buffer_destroy(mBuffer); + if (mShmPool) + wl_shm_pool_destroy(mShmPool); } QImage *QWaylandShmBuffer::imageInsideMargins(const QMargins &margins) From 5c897fb1ab364f6623d96c80d05c15c06fcec6ce Mon Sep 17 00:00:00 2001 From: Olivier Blin Date: Tue, 9 Dec 2014 13:24:49 +0100 Subject: [PATCH 0226/1507] Drop unused mScreensInitialized variable in QWaylandDisplay Unused since commit 78a701272e68d4f0ab95df4062374b8d34ef2919: Made wayland plugin single-threaded, yay :) Change-Id: I1fae78d77179feaac79f5dba6dcad8084e3e97fa Reviewed-by: Pier Luigi Fiorini Reviewed-by: Giulio Camuffo --- src/plugins/platforms/wayland/qwaylanddisplay_p.h | 1 - 1 file changed, 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay_p.h b/src/plugins/platforms/wayland/qwaylanddisplay_p.h index d9619e6f1f5..5a32413e4c8 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay_p.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay_p.h @@ -202,7 +202,6 @@ private: QSocketNotifier *mReadNotifier; int mFd; int mWritableNotificationFd; - bool mScreensInitialized; QList mGlobals; int mCompositorVersion; uint32_t mLastInputSerial; From f9ad726e65a7aea6de2863b7907cb52bcc026fca Mon Sep 17 00:00:00 2001 From: Giulio Camuffo Date: Sun, 29 Mar 2015 11:33:34 +0300 Subject: [PATCH 0227/1507] Don't handle mouse events in decos if buttons were pressed in the content area MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This fixes the decorations stealing the mouse events when going outside the content area. Change-Id: I8f3592fbda6b9c1da6498d74820a73be11c6999d Reviewed-by: Jørgen Lind --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 1b939726f03..ca0fa513972 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -619,7 +619,8 @@ bool QWaylandWindow::touchDragDecoration(QWaylandInputDevice *inputDevice, const void QWaylandWindow::handleMouseEventWithDecoration(QWaylandInputDevice *inputDevice, ulong timestamp, const QPointF &local, const QPointF &global, Qt::MouseButtons b, Qt::KeyboardModifiers mods) { - if (mWindowDecoration->handleMouse(inputDevice,local,global,b,mods)) + if (mMousePressedInContentArea == Qt::NoButton && + mWindowDecoration->handleMouse(inputDevice,local,global,b,mods)) return; QMargins marg = frameMargins(); From be73094e6e6df055e183f71dffb12bd9dd4189bd Mon Sep 17 00:00:00 2001 From: Pier Luigi Fiorini Date: Thu, 22 Jan 2015 08:13:08 +0100 Subject: [PATCH 0228/1507] Remove .desktop suffix to appId The appId is the desktop entry identifier. According to the desktop entry specifications [1], for applications the part of the name should follow the reverse DNS convention (see [2]). To do this we use the application domain if available, otherwise for lack of information we fall back to the executable base name like other toolkits such as Gtk+ do. [1] http://standards.freedesktop.org/desktop-entry-spec/latest/ [2] http://standards.freedesktop.org/desktop-entry-spec/latest/ar01s02.html Change-Id: I181ad23a9736844e07e8060d78e756a943c27f67 Reviewed-by: Giulio Camuffo --- .../platforms/wayland/qwaylandwindow.cpp | 22 +++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index ca0fa513972..83c44c25dbb 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -107,10 +107,24 @@ QWaylandWindow::QWaylandWindow(QWindow *window) // Set initial surface title mShellSurface->setTitle(window->title()); - // Set surface class to the .desktop file name (obtained from executable name) - QFileInfo exeFileInfo(qApp->applicationFilePath()); - QString className = exeFileInfo.baseName() + QLatin1String(".desktop"); - mShellSurface->setAppId(className); + // The appId is the desktop entry identifier that should follow the + // reverse DNS convention (see http://standards.freedesktop.org/desktop-entry-spec/latest/ar01s02.html), + // use the application domain if available, otherwise the executable base name. + // According to xdg-shell the appId is only the name, without the .desktop suffix. + QFileInfo fi = QCoreApplication::instance()->applicationFilePath(); + QStringList domainName = + QCoreApplication::instance()->organizationDomain().split(QLatin1Char('.'), + QString::SkipEmptyParts); + + if (domainName.isEmpty()) { + mShellSurface->setAppId(fi.baseName()); + } else { + QString appId; + for (int i = 0; i < domainName.count(); ++i) + appId.prepend(QLatin1Char('.')).prepend(domainName.at(i)); + appId.append(fi.baseName()); + mShellSurface->setAppId(appId); + } } if (QPlatformWindow::parent() && mSubSurfaceWindow) { From 81395b87a300f5d224b5f633261b1b547855d856 Mon Sep 17 00:00:00 2001 From: Giulio Camuffo Date: Thu, 16 Apr 2015 17:56:41 +0300 Subject: [PATCH 0229/1507] Add client side support for media keys Unfortunately we don't have a keysym in libxkbcommon for PlayPause, we only have Play. We're going to pretend XKB_KEY_XF86AudioPlay is really PlayPause since that is what is most common. Change-Id: I1a75d8b5b0ea360e0f62eb7a93004ba3fababfa8 Reviewed-by: Laszlo Agocs Reviewed-by: Pier Luigi Fiorini --- src/plugins/platforms/wayland/qwaylandinputdevice.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index 2e032cafdf2..3b5e83481fb 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -592,6 +592,13 @@ static const uint32_t KeyTbl[] = { XKB_KEY_Mode_switch, Qt::Key_Mode_switch, XKB_KEY_script_switch, Qt::Key_Mode_switch, + XKB_KEY_XF86AudioPlay, Qt::Key_MediaTogglePlayPause, //there isn't a PlayPause keysym, however just play keys are not common + XKB_KEY_XF86AudioPause, Qt::Key_MediaPause, + XKB_KEY_XF86AudioStop, Qt::Key_MediaStop, + XKB_KEY_XF86AudioPrev, Qt::Key_MediaPrevious, + XKB_KEY_XF86AudioNext, Qt::Key_MediaNext, + XKB_KEY_XF86AudioRecord, Qt::Key_MediaRecord, + 0, 0 }; From 1cee02688f71db37ca4ed9ab392c0f690aa0a31c Mon Sep 17 00:00:00 2001 From: Giulio Camuffo Date: Tue, 21 Apr 2015 13:16:53 +0300 Subject: [PATCH 0230/1507] Do not manually update the xkb state xkb_state_update_key() is not supposed to be used in apps with a master process, such as wayland clients, which use xkb_state_update_mask() with the state serialized by the master. Change-Id: Ie51a39ca0c567c54072b221d1ab8cf7b8ea15c55 Reviewed-by: Laszlo Agocs --- src/plugins/platforms/wayland/qwaylandinputdevice.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index 3b5e83481fb..ca17d0be570 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -759,7 +759,6 @@ void QWaylandInputDevice::Keyboard::keyboard_key(uint32_t serial, uint32_t time, } const xkb_keysym_t sym = xkb_state_key_get_one_sym(mXkbState, code); - xkb_state_update_key(mXkbState, code, isDown ? XKB_KEY_DOWN : XKB_KEY_UP); Qt::KeyboardModifiers modifiers = mParent->modifiers(); From 7efc7c3d4db066f871f0193f5ce9d51dfbd91447 Mon Sep 17 00:00:00 2001 From: Giulio Camuffo Date: Tue, 21 Apr 2015 16:56:49 +0300 Subject: [PATCH 0231/1507] Use defines instead of hardcoded strings Change-Id: Id382a1e39f2c052fbfeb96caa9b01becb31e81c9 Reviewed-by: Pier Luigi Fiorini Reviewed-by: Laszlo Agocs --- src/plugins/platforms/wayland/qwaylandinputdevice.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index ca17d0be570..8c896528024 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -297,15 +297,13 @@ Qt::KeyboardModifiers QWaylandInputDevice::Keyboard::modifiers() const #ifndef QT_NO_WAYLAND_XKB xkb_state_component cstate = static_cast(XKB_STATE_DEPRESSED | XKB_STATE_LATCHED); - if (xkb_state_mod_name_is_active(mXkbState, "Shift", cstate)) + if (xkb_state_mod_name_is_active(mXkbState, XKB_MOD_NAME_SHIFT, cstate)) ret |= Qt::ShiftModifier; - if (xkb_state_mod_name_is_active(mXkbState, "Control", cstate)) + if (xkb_state_mod_name_is_active(mXkbState, XKB_MOD_NAME_CTRL, cstate)) ret |= Qt::ControlModifier; - if (xkb_state_mod_name_is_active(mXkbState, "Alt", cstate)) + if (xkb_state_mod_name_is_active(mXkbState, XKB_MOD_NAME_ALT, cstate)) ret |= Qt::AltModifier; - if (xkb_state_mod_name_is_active(mXkbState, "Mod1", cstate)) - ret |= Qt::AltModifier; - if (xkb_state_mod_name_is_active(mXkbState, "Mod4", cstate)) + if (xkb_state_mod_name_is_active(mXkbState, XKB_MOD_NAME_LOGO, cstate)) ret |= Qt::MetaModifier; #endif From b8be7b93a12aaf4347d1355fdffc6c7728668704 Mon Sep 17 00:00:00 2001 From: Giulio Camuffo Date: Tue, 21 Apr 2015 21:09:50 +0300 Subject: [PATCH 0232/1507] Use a FontSmoothingGamma value of 1.0 This is what the xcb plugin does, be consistent with it. Change-Id: I5befa2de3ff514ca0c9196eb7137682586cec126 Reviewed-by: Laszlo Agocs --- src/plugins/platforms/wayland/qwaylandintegration.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/plugins/platforms/wayland/qwaylandintegration.cpp b/src/plugins/platforms/wayland/qwaylandintegration.cpp index 050feba736b..9526aec4c4e 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandintegration.cpp @@ -226,6 +226,13 @@ QVariant QWaylandIntegration::styleHint(StyleHint hint) const if (hint == ShowIsFullScreen && mDisplay->windowManagerIntegration()) return mDisplay->windowManagerIntegration()->showIsFullScreen(); + switch (hint) { + case QPlatformIntegration::FontSmoothingGamma: + return qreal(1.0); + default: + break; + } + return QPlatformIntegration::styleHint(hint); } From d0740edb9c77bba7fb156dcda18459e2a23a6d04 Mon Sep 17 00:00:00 2001 From: Giulio Camuffo Date: Fri, 1 May 2015 17:41:17 +0300 Subject: [PATCH 0233/1507] Fix crash on keyboard remove If the compositor sent a wl_keyboard.leave and a new wl_seat.capabilities without the keyboard bit we would end up deleting the Keyboard object with a roundtrip in flight, ending up using freed memory later. Destroy the callback when destroying the keyboard, and notify the window system the active window is active no more. Change-Id: Ie415ca62b46e0b8ef0fe4d09c8e7a8130928df90 Reviewed-by: Laszlo Agocs --- src/plugins/platforms/wayland/qwaylandinputdevice.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index 8c896528024..b2268ae7888 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -118,6 +118,10 @@ QWaylandInputDevice::Keyboard::~Keyboard() #ifndef QT_NO_WAYLAND_XKB releaseKeyMap(); #endif + if (mFocus) + QWindowSystemInterface::handleWindowActivated(0); + if (mFocusCallback) + wl_callback_destroy(mFocusCallback); if (mParent->mVersion >= 3) wl_keyboard_release(object()); else From 4a0f32aa4bf4c4f3a70fe0514302294ea30ab6fa Mon Sep 17 00:00:00 2001 From: Pier Luigi Fiorini Date: Sat, 3 Jan 2015 17:03:13 +0100 Subject: [PATCH 0234/1507] Remove output extension This protocol is empty now and is no longer used. Change-Id: I45e79fb86a67b4cebdc307170218fa039b2aa27f Reviewed-by: Giulio Camuffo --- .../wayland/extensions/output-extension.xml | 51 ---------------- src/plugins/platforms/wayland/client.pro | 3 - .../platforms/wayland/qwaylanddisplay.cpp | 6 -- .../platforms/wayland/qwaylanddisplay_p.h | 2 - .../wayland/qwaylandextendedoutput.cpp | 53 ----------------- .../wayland/qwaylandextendedoutput_p.h | 58 ------------------- .../platforms/wayland/qwaylandscreen.cpp | 16 ----- .../platforms/wayland/qwaylandscreen_p.h | 5 -- 8 files changed, 194 deletions(-) delete mode 100644 src/3rdparty/wayland/extensions/output-extension.xml delete mode 100644 src/plugins/platforms/wayland/qwaylandextendedoutput.cpp delete mode 100644 src/plugins/platforms/wayland/qwaylandextendedoutput_p.h diff --git a/src/3rdparty/wayland/extensions/output-extension.xml b/src/3rdparty/wayland/extensions/output-extension.xml deleted file mode 100644 index b1a2f4db7b1..00000000000 --- a/src/3rdparty/wayland/extensions/output-extension.xml +++ /dev/null @@ -1,51 +0,0 @@ - - - - Copyright (C) 2015 The Qt Company Ltd. - Contact: http://www.qt.io/licensing/ - - This file is part of the plugins of the Qt Toolkit. - - $QT_BEGIN_LICENSE:BSD$ - You may use this file under the terms of the BSD license as follows: - - "Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are - met: - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in - the documentation and/or other materials provided with the - distribution. - * Neither the name of The Qt Company Ltd nor the names of its - contributors may be used to endorse or promote products derived - from this software without specific prior written permission. - - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." - - $QT_END_LICENSE$ - - - - - - - - - - - - - diff --git a/src/plugins/platforms/wayland/client.pro b/src/plugins/platforms/wayland/client.pro index 00e9cd04a97..08c184a5e59 100644 --- a/src/plugins/platforms/wayland/client.pro +++ b/src/plugins/platforms/wayland/client.pro @@ -44,7 +44,6 @@ WAYLANDCLIENTSOURCES += \ ../3rdparty/protocol/wayland.xml \ ../extensions/surface-extension.xml \ ../extensions/sub-surface-extension.xml \ - ../extensions/output-extension.xml \ ../extensions/touch-extension.xml \ ../extensions/qtkey-extension.xml \ ../extensions/windowmanager.xml \ @@ -69,7 +68,6 @@ SOURCES += qwaylandintegration.cpp \ qwaylandwlshellsurface.cpp \ qwaylandxdgshell.cpp \ qwaylandxdgsurface.cpp \ - qwaylandextendedoutput.cpp \ qwaylandextendedsurface.cpp \ qwaylandsubsurface.cpp \ qwaylandtouch.cpp \ @@ -102,7 +100,6 @@ HEADERS += qwaylandintegration_p.h \ qwaylandwlshellsurface_p.h \ qwaylandxdgshell_p.h \ qwaylandxdgsurface_p.h \ - qwaylandextendedoutput_p.h \ qwaylandextendedsurface_p.h \ qwaylandsubsurface_p.h \ qwaylandtouch_p.h \ diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index b985f10e5b6..6bad56ae3f0 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -50,7 +50,6 @@ #include "qwaylandshellintegration_p.h" #include "qwaylandclientbufferintegration_p.h" -#include "qwaylandextendedoutput_p.h" #include "qwaylandextendedsurface_p.h" #include "qwaylandsubsurface_p.h" #include "qwaylandtouch_p.h" @@ -127,7 +126,6 @@ QWaylandDisplay::QWaylandDisplay(QWaylandIntegration *waylandIntegration) , mDndSelectionHandler(0) , mWindowExtension(0) , mSubSurfaceExtension(0) - , mOutputExtension(0) , mTouchExtension(0) , mQtKeyExtension(0) , mTextInputManager(0) @@ -255,10 +253,6 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin mInputDevices.append(inputDevice); } else if (interface == QStringLiteral("wl_data_device_manager")) { mDndSelectionHandler.reset(new QWaylandDataDeviceManager(this, id)); - } else if (interface == QStringLiteral("qt_output_extension")) { - mOutputExtension.reset(new QtWayland::qt_output_extension(registry, id, 1)); - foreach (QPlatformScreen *screen, screens()) - static_cast(screen)->createExtendedOutput(); } else if (interface == QStringLiteral("qt_surface_extension")) { mWindowExtension.reset(new QtWayland::qt_surface_extension(registry, id, 1)); } else if (interface == QStringLiteral("qt_sub_surface_extension")) { diff --git a/src/plugins/platforms/wayland/qwaylanddisplay_p.h b/src/plugins/platforms/wayland/qwaylanddisplay_p.h index 4549d52e6a6..bbd0e871dda 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay_p.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay_p.h @@ -128,7 +128,6 @@ public: QtWayland::qt_surface_extension *windowExtension() const { return mWindowExtension.data(); } QtWayland::qt_sub_surface_extension *subSurfaceExtension() const { return mSubSurfaceExtension.data(); } - QtWayland::qt_output_extension *outputExtension() const { return mOutputExtension.data(); } QWaylandTouchExtension *touchExtension() const { return mTouchExtension.data(); } QtWayland::wl_text_input_manager *textInputManager() const { return mTextInputManager.data(); } QWaylandHardwareIntegration *hardwareIntegration() const { return mHardwareIntegration.data(); } @@ -189,7 +188,6 @@ private: QScopedPointer mDndSelectionHandler; QScopedPointer mWindowExtension; QScopedPointer mSubSurfaceExtension; - QScopedPointer mOutputExtension; QScopedPointer mTouchExtension; QScopedPointer mQtKeyExtension; QScopedPointer mWindowManagerIntegration; diff --git a/src/plugins/platforms/wayland/qwaylandextendedoutput.cpp b/src/plugins/platforms/wayland/qwaylandextendedoutput.cpp deleted file mode 100644 index d1e8ffe2f9e..00000000000 --- a/src/plugins/platforms/wayland/qwaylandextendedoutput.cpp +++ /dev/null @@ -1,53 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL21$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qwaylandextendedoutput_p.h" - -#include "qwaylandscreen_p.h" - -#include - -#include - -QT_BEGIN_NAMESPACE - -namespace QtWaylandClient { - -QWaylandExtendedOutput::QWaylandExtendedOutput(QWaylandScreen *screen, ::qt_extended_output *extended_output) - : QtWayland::qt_extended_output(extended_output) -{ - Q_UNUSED(screen); -} - -} -QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandextendedoutput_p.h b/src/plugins/platforms/wayland/qwaylandextendedoutput_p.h deleted file mode 100644 index b3e4c469e50..00000000000 --- a/src/plugins/platforms/wayland/qwaylandextendedoutput_p.h +++ /dev/null @@ -1,58 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL21$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QWAYLANDEXTENDEDOUTPUT_H -#define QWAYLANDEXTENDEDOUTPUT_H - -#include -#include - -QT_BEGIN_NAMESPACE - -namespace QtWaylandClient { - -class QWaylandDisplay; -class QWaylandScreen; -class QWaylandExtendedOutput; - -class Q_WAYLAND_CLIENT_EXPORT QWaylandExtendedOutput : public QtWayland::qt_extended_output -{ -public: - QWaylandExtendedOutput(QWaylandScreen *screen, struct ::qt_extended_output *extended_output); -}; - -} - -QT_END_NAMESPACE - -#endif // QWAYLANDEXTENDEDOUTPUT_H diff --git a/src/plugins/platforms/wayland/qwaylandscreen.cpp b/src/plugins/platforms/wayland/qwaylandscreen.cpp index acd125c6275..057515af02b 100644 --- a/src/plugins/platforms/wayland/qwaylandscreen.cpp +++ b/src/plugins/platforms/wayland/qwaylandscreen.cpp @@ -35,7 +35,6 @@ #include "qwaylanddisplay_p.h" #include "qwaylandcursor_p.h" -#include "qwaylandextendedoutput_p.h" #include "qwaylandwindow_p.h" #include @@ -52,7 +51,6 @@ QWaylandScreen::QWaylandScreen(QWaylandDisplay *waylandDisplay, int version, uin , QtWayland::wl_output(waylandDisplay->wl_registry(), id, qMin(version, 2)) , m_outputId(id) , mWaylandDisplay(waylandDisplay) - , mExtendedOutput(0) , mScale(1) , mDepth(32) , mRefreshRate(60000) @@ -62,8 +60,6 @@ QWaylandScreen::QWaylandScreen(QWaylandDisplay *waylandDisplay, int version, uin , m_orientation(Qt::PrimaryOrientation) , mWaylandCursor(new QWaylandCursor(this)) { - // handle case of output extension global being sent after outputs - createExtendedOutput(); } QWaylandScreen::~QWaylandScreen() @@ -152,18 +148,6 @@ QPlatformCursor *QWaylandScreen::cursor() const return mWaylandCursor; } -QWaylandExtendedOutput *QWaylandScreen::extendedOutput() const -{ - return mExtendedOutput; -} - -void QWaylandScreen::createExtendedOutput() -{ - QtWayland::qt_output_extension *extension = mWaylandDisplay->outputExtension(); - if (!mExtendedOutput && extension) - mExtendedOutput = new QWaylandExtendedOutput(this, extension->get_extended_output(output())); -} - QWaylandScreen * QWaylandScreen::waylandScreenFromWindow(QWindow *window) { QPlatformScreen *platformScreen = QPlatformScreen::platformScreenForWindow(window); diff --git a/src/plugins/platforms/wayland/qwaylandscreen_p.h b/src/plugins/platforms/wayland/qwaylandscreen_p.h index 35adee34a5b..e2acac4b3a3 100644 --- a/src/plugins/platforms/wayland/qwaylandscreen_p.h +++ b/src/plugins/platforms/wayland/qwaylandscreen_p.h @@ -45,7 +45,6 @@ namespace QtWaylandClient { class QWaylandDisplay; class QWaylandCursor; -class QWaylandExtendedOutput; class Q_WAYLAND_CLIENT_EXPORT QWaylandScreen : public QPlatformScreen, QtWayland::wl_output { @@ -79,9 +78,6 @@ public: uint32_t outputId() const { return m_outputId; } ::wl_output *output() { return object(); } - QWaylandExtendedOutput *extendedOutput() const; - void createExtendedOutput(); - static QWaylandScreen *waylandScreenFromWindow(QWindow *window); private: @@ -97,7 +93,6 @@ private: int m_outputId; QWaylandDisplay *mWaylandDisplay; - QWaylandExtendedOutput *mExtendedOutput; QRect mGeometry; int mScale; int mDepth; From 9b5376cce1a1a2af01d7697fc4a25e8f508091fc Mon Sep 17 00:00:00 2001 From: Arnaud Vrac Date: Wed, 27 Nov 2013 23:19:06 +0100 Subject: [PATCH 0235/1507] Map more XKB key codes Change-Id: I0a2b56043235666bc57b46ae4ac78ca5e24e736d Reviewed-by: Giulio Camuffo --- .../platforms/wayland/qwaylandinputdevice.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index b2268ae7888..3ea9e927f24 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -594,13 +594,30 @@ static const uint32_t KeyTbl[] = { XKB_KEY_Mode_switch, Qt::Key_Mode_switch, XKB_KEY_script_switch, Qt::Key_Mode_switch, + XKB_KEY_XF86Back, Qt::Key_Back, + XKB_KEY_XF86Forward, Qt::Key_Forward, + XKB_KEY_XF86AudioPlay, Qt::Key_MediaTogglePlayPause, //there isn't a PlayPause keysym, however just play keys are not common XKB_KEY_XF86AudioPause, Qt::Key_MediaPause, XKB_KEY_XF86AudioStop, Qt::Key_MediaStop, XKB_KEY_XF86AudioPrev, Qt::Key_MediaPrevious, XKB_KEY_XF86AudioNext, Qt::Key_MediaNext, + XKB_KEY_XF86AudioRewind, Qt::Key_MediaPrevious, + XKB_KEY_XF86AudioForward, Qt::Key_MediaNext, XKB_KEY_XF86AudioRecord, Qt::Key_MediaRecord, + XKB_KEY_XF86AudioMute, Qt::Key_VolumeMute, + XKB_KEY_XF86AudioLowerVolume, Qt::Key_VolumeDown, + XKB_KEY_XF86AudioRaiseVolume, Qt::Key_VolumeUp, + + XKB_KEY_XF86AudioRandomPlay, Qt::Key_AudioRandomPlay, + XKB_KEY_XF86AudioRepeat, Qt::Key_AudioRepeat, + + XKB_KEY_XF86ZoomIn, Qt::Key_ZoomIn, + XKB_KEY_XF86ZoomOut, Qt::Key_ZoomOut, + + XKB_KEY_XF86Eject, Qt::Key_Eject, + 0, 0 }; From 679e14272c662a3eb9a9c79df0fea29d0ecbddff Mon Sep 17 00:00:00 2001 From: Arnaud Vrac Date: Fri, 13 Mar 2015 15:46:44 +0100 Subject: [PATCH 0236/1507] Track last input window with a QPointer in case it is destroyed Change-Id: I61d7aa4b6a37922eb3beefd983154ee267cae0ef Reviewed-by: Giulio Camuffo --- src/plugins/platforms/wayland/qwaylanddisplay.cpp | 5 +++++ src/plugins/platforms/wayland/qwaylanddisplay_p.h | 5 +++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index b985f10e5b6..e0155fc95b6 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -375,6 +375,11 @@ bool QWaylandDisplay::supportsWindowDecoration() const return integrationSupport; } +QWaylandWindow *QWaylandDisplay::lastInputWindow() const +{ + return mLastInputWindow.data(); +} + void QWaylandDisplay::setLastInputDevice(QWaylandInputDevice *device, uint32_t serial, QWaylandWindow *win) { mLastInputDevice = device; diff --git a/src/plugins/platforms/wayland/qwaylanddisplay_p.h b/src/plugins/platforms/wayland/qwaylanddisplay_p.h index 4549d52e6a6..7ba431d7c99 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay_p.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay_p.h @@ -36,6 +36,7 @@ #include #include +#include #include @@ -157,7 +158,7 @@ public: uint32_t lastInputSerial() const { return mLastInputSerial; } QWaylandInputDevice *lastInputDevice() const { return mLastInputDevice; } - QWaylandWindow *lastInputWindow() const { return mLastInputWindow; } + QWaylandWindow *lastInputWindow() const; void setLastInputDevice(QWaylandInputDevice *device, uint32_t serial, QWaylandWindow *window); public slots: @@ -202,7 +203,7 @@ private: int mCompositorVersion; uint32_t mLastInputSerial; QWaylandInputDevice *mLastInputDevice; - QWaylandWindow *mLastInputWindow; + QPointer mLastInputWindow; void registry_global(uint32_t id, const QString &interface, uint32_t version) Q_DECL_OVERRIDE; void registry_global_remove(uint32_t id) Q_DECL_OVERRIDE; From 3822bac2b7617c6593c2d21ed6203d23aede0613 Mon Sep 17 00:00:00 2001 From: Arnaud Vrac Date: Tue, 16 Sep 2014 17:36:18 +0200 Subject: [PATCH 0237/1507] Reset wayland object pointer after destroy This allows calling init() on the wayland object again after destroy() Change-Id: I7856cc8ec676eee7575e15a5d1f81cf1b89537c8 Reviewed-by: Giulio Camuffo --- src/tools/qtwaylandscanner/qtwaylandscanner.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp index a0b4afcfaf2..784687d2649 100644 --- a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp +++ b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp @@ -88,6 +88,7 @@ struct WaylandArgument { struct WaylandEvent { bool request; QByteArray name; + QByteArray type; QList arguments; }; @@ -124,6 +125,7 @@ WaylandEvent readEvent(QXmlStreamReader &xml, bool request) WaylandEvent event; event.request = request; event.name = byteArrayValue(xml, "name"); + event.type = byteArrayValue(xml, "type"); while (xml.readNextStartElement()) { if (xml.name() == "arg") { WaylandArgument argument; @@ -998,6 +1000,8 @@ void process(QXmlStreamReader &xml, const QByteArray &headerPath, const QByteArr } } printf(");\n"); + if (e.type == "destructor") + printf(" m_%s = 0;\n", interfaceName); printf(" }\n"); } From 022f452ed96f0b94dba3f07797fc5f8158815622 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Fri, 15 May 2015 09:49:58 +0200 Subject: [PATCH 0238/1507] Add safety check in QWaylandInputDevice::Keyboard::modifiers() ::modifiers() might be invoked before being initialised. E.g. when a pointer button event is emitted before the keymap is sent. Change-Id: Ib95f9866d808b2a32ddfaa0862cdb3226fab1938 Reviewed-by: Giulio Camuffo --- src/plugins/platforms/wayland/qwaylandinputdevice.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index 3ea9e927f24..76ae258696b 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -299,6 +299,9 @@ Qt::KeyboardModifiers QWaylandInputDevice::Keyboard::modifiers() const Qt::KeyboardModifiers ret = Qt::NoModifier; #ifndef QT_NO_WAYLAND_XKB + if (!mXkbState) + return ret; + xkb_state_component cstate = static_cast(XKB_STATE_DEPRESSED | XKB_STATE_LATCHED); if (xkb_state_mod_name_is_active(mXkbState, XKB_MOD_NAME_SHIFT, cstate)) From f0a58486ef7e660ab73a92ae08f949c057796b40 Mon Sep 17 00:00:00 2001 From: Giulio Camuffo Date: Thu, 23 Apr 2015 19:32:28 +0300 Subject: [PATCH 0239/1507] Fix crash when the wl_shm global comes after a wl_output one MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Task-number: QTBUG-44503 Change-Id: I6932df57bb4560b6dceb72a5cb7c536cd090e92a Reviewed-by: Martin Gräßlin Reviewed-by: Laszlo Agocs --- src/plugins/platforms/wayland/qwaylanddisplay.cpp | 1 + src/plugins/platforms/wayland/qwaylandscreen.cpp | 7 ++++++- src/plugins/platforms/wayland/qwaylandscreen_p.h | 1 + 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index e0155fc95b6..c3925f5c446 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -239,6 +239,7 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin mScreens.append(screen); // We need to get the output events before creating surfaces forceRoundTrip(); + screen->init(); mWaylandIntegration->screenAdded(screen); } else if (interface == QStringLiteral("wl_compositor")) { mCompositorVersion = qMin((int)version, 3); diff --git a/src/plugins/platforms/wayland/qwaylandscreen.cpp b/src/plugins/platforms/wayland/qwaylandscreen.cpp index acd125c6275..8a01e366e78 100644 --- a/src/plugins/platforms/wayland/qwaylandscreen.cpp +++ b/src/plugins/platforms/wayland/qwaylandscreen.cpp @@ -60,7 +60,7 @@ QWaylandScreen::QWaylandScreen(QWaylandDisplay *waylandDisplay, int version, uin , mFormat(QImage::Format_ARGB32_Premultiplied) , mOutputName(QStringLiteral("Screen%1").arg(id)) , m_orientation(Qt::PrimaryOrientation) - , mWaylandCursor(new QWaylandCursor(this)) + , mWaylandCursor(0) { // handle case of output extension global being sent after outputs createExtendedOutput(); @@ -71,6 +71,11 @@ QWaylandScreen::~QWaylandScreen() delete mWaylandCursor; } +void QWaylandScreen::init() +{ + mWaylandCursor = new QWaylandCursor(this); +} + QWaylandDisplay * QWaylandScreen::display() const { return mWaylandDisplay; diff --git a/src/plugins/platforms/wayland/qwaylandscreen_p.h b/src/plugins/platforms/wayland/qwaylandscreen_p.h index 35adee34a5b..06389f7e440 100644 --- a/src/plugins/platforms/wayland/qwaylandscreen_p.h +++ b/src/plugins/platforms/wayland/qwaylandscreen_p.h @@ -53,6 +53,7 @@ public: QWaylandScreen(QWaylandDisplay *waylandDisplay, int version, uint32_t id); ~QWaylandScreen(); + void init(); QWaylandDisplay *display() const; QRect geometry() const; From f57dbc0358f523eabf6ce265e53f08f32edb3306 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Wed, 20 May 2015 14:20:32 +0200 Subject: [PATCH 0240/1507] Fix that we pick up the generated headers in source packages Change-Id: If5ae8749ccbddfc878ae4e0adaa40f072527d425 Reviewed-by: Oswald Buddenhagen --- src/plugins/platforms/wayland/client.pro | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/plugins/platforms/wayland/client.pro b/src/plugins/platforms/wayland/client.pro index 00e9cd04a97..0c13a4a9b68 100644 --- a/src/plugins/platforms/wayland/client.pro +++ b/src/plugins/platforms/wayland/client.pro @@ -8,6 +8,8 @@ MODULE_PLUGIN_TYPES = \ wayland-inputdevice-integration \ wayland-decoration-client +CONFIG += generated_privates + load(qt_module) # We have a bunch of C code with casts, so we can't have this option From f1d265fcdf4d49e9ed2a0fb2c159c7b20283271a Mon Sep 17 00:00:00 2001 From: Sergio Martins Date: Mon, 8 Jun 2015 08:34:19 +0100 Subject: [PATCH 0241/1507] Add 3 QList::reserve() calls Change-Id: Ic89d25a4497ffaffb3f6b688f4c5ecc5128e9642 Reviewed-by: Giulio Camuffo --- src/plugins/platforms/wayland/qwaylandscreen.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandscreen.cpp b/src/plugins/platforms/wayland/qwaylandscreen.cpp index dc634f88bc9..1be90e8e769 100644 --- a/src/plugins/platforms/wayland/qwaylandscreen.cpp +++ b/src/plugins/platforms/wayland/qwaylandscreen.cpp @@ -114,7 +114,9 @@ QDpi QWaylandScreen::logicalDpi() const QList QWaylandScreen::virtualSiblings() const { QList list; - foreach (QWaylandScreen *screen, mWaylandDisplay->screens()) + const QList screens = mWaylandDisplay->screens(); + list.reserve(screens.count()); + foreach (QWaylandScreen *screen, screens) list << screen; return list; } From 202573e946bcf3e1a6b855853705adeea44bf0b9 Mon Sep 17 00:00:00 2001 From: Giulio Camuffo Date: Thu, 30 Apr 2015 22:07:49 +0300 Subject: [PATCH 0242/1507] Don't generate spurious selection events By calling destroy() on the active wl_data_source before replacing it with a new one and calling set_selection() we trigger a spurious selection(null) event before the one with the offer for the source we are going to set. Change-Id: I6c2f2fd029fa523312b9892c6a5050805dfa83b0 Reviewed-by: Pier Luigi Fiorini Reviewed-by: Laszlo Agocs --- src/plugins/platforms/wayland/qwaylanddatadevice.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylanddatadevice.cpp b/src/plugins/platforms/wayland/qwaylanddatadevice.cpp index 03a8c4b83ec..a3e084a0c10 100644 --- a/src/plugins/platforms/wayland/qwaylanddatadevice.cpp +++ b/src/plugins/platforms/wayland/qwaylanddatadevice.cpp @@ -94,10 +94,10 @@ QWaylandDataSource *QWaylandDataDevice::selectionSource() const void QWaylandDataDevice::setSelectionSource(QWaylandDataSource *source) { - m_selectionSource.reset(source); if (source) connect(source, &QWaylandDataSource::cancelled, this, &QWaylandDataDevice::selectionSourceCancelled); set_selection(source ? source->object() : Q_NULLPTR, m_inputDevice->serial()); + m_selectionSource.reset(source); } QWaylandDataOffer *QWaylandDataDevice::dragOffer() const From 9369a931d0b1ddc6b0ea2d17a2ec57ff8122e013 Mon Sep 17 00:00:00 2001 From: Giulio Camuffo Date: Thu, 30 Apr 2015 19:44:58 +0300 Subject: [PATCH 0243/1507] Fix a corner case freed memory use/crash QWaylandDisplay::flushRequests() does not only flush them, but also dispatches the pending events. If we have two wl_data_device.selection events in the queue we must not dispatch the second one while we are dealing with the first one because that will replace the data offer and delete us while we're in QWaylandMimeData::retrieveData_sys(). Change-Id: Ib58ca571867faa2633daa9ec94fe7094df02e9fd Reviewed-by: Laszlo Agocs --- src/plugins/platforms/wayland/qwaylanddataoffer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylanddataoffer.cpp b/src/plugins/platforms/wayland/qwaylanddataoffer.cpp index dd28f787041..167b647d6aa 100644 --- a/src/plugins/platforms/wayland/qwaylanddataoffer.cpp +++ b/src/plugins/platforms/wayland/qwaylanddataoffer.cpp @@ -136,7 +136,7 @@ QVariant QWaylandMimeData::retrieveData_sys(const QString &mimeType, QVariant::T } m_dataOffer->receive(mime, pipefd[1]); - m_display->flushRequests(); + wl_display_flush(m_display->wl_display()); close(pipefd[1]); From 58f3c602f01cc647dd97304f4c395174f7ceece1 Mon Sep 17 00:00:00 2001 From: Giulio Camuffo Date: Fri, 24 Apr 2015 20:51:14 +0300 Subject: [PATCH 0244/1507] bradient: Activate the decoration's buttons on mouse release, not press Change-Id: I5a161119b20301a405bdde9bbea6bfbdcc4b9fa0 Reviewed-by: Pier Luigi Fiorini Reviewed-by: Laszlo Agocs --- .../plugins/decorations/bradient/main.cpp | 42 ++++++++++++++++--- 1 file changed, 36 insertions(+), 6 deletions(-) diff --git a/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp b/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp index 00a91e242a7..ea298699385 100644 --- a/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp +++ b/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp @@ -116,6 +116,14 @@ static const char * const qt_normalizeup_xpm[] = { # define BUTTON_WIDTH 22 #endif +enum Button +{ + None, + Close, + Maximize, + Minimize +}; + class Q_WAYLAND_CLIENT_EXPORT QWaylandBradientDecoration : public QWaylandAbstractDecoration { public: @@ -130,6 +138,7 @@ private: void processMouseBottom(QWaylandInputDevice *inputDevice, const QPointF &local, Qt::MouseButtons b,Qt::KeyboardModifiers mods); void processMouseLeft(QWaylandInputDevice *inputDevice, const QPointF &local, Qt::MouseButtons b,Qt::KeyboardModifiers mods); void processMouseRight(QWaylandInputDevice *inputDevice, const QPointF &local, Qt::MouseButtons b,Qt::KeyboardModifiers mods); + bool clickButton(Qt::MouseButtons b, Button btn); QRectF closeButtonRect() const; QRectF maximizeButtonRect() const; @@ -138,12 +147,14 @@ private: QColor m_foregroundColor; QColor m_backgroundColor; QStaticText m_windowTitle; + Button m_clicking; }; QWaylandBradientDecoration::QWaylandBradientDecoration() : QWaylandAbstractDecoration() + , m_clicking(None) { QPalette palette; m_foregroundColor = palette.color(QPalette::Active, QPalette::HighlightedText); @@ -315,18 +326,37 @@ void QWaylandBradientDecoration::paint(QPaintDevice *device) #endif } +bool QWaylandBradientDecoration::clickButton(Qt::MouseButtons b, Button btn) +{ + if (isLeftClicked(b)) { + m_clicking = btn; + return false; + } else if (isLeftReleased(b)) { + if (m_clicking == btn) { + m_clicking = None; + return true; + } else { + m_clicking = None; + } + } + return false; +} + bool QWaylandBradientDecoration::handleMouse(QWaylandInputDevice *inputDevice, const QPointF &local, const QPointF &global, Qt::MouseButtons b, Qt::KeyboardModifiers mods) { Q_UNUSED(global); // Figure out what area mouse is in - if (closeButtonRect().contains(local) && isLeftClicked(b)) { - QWindowSystemInterface::handleCloseEvent(window()); - } else if (maximizeButtonRect().contains(local) && isLeftClicked(b)) { - window()->setWindowState(waylandWindow()->isMaximized() ? Qt::WindowNoState : Qt::WindowMaximized); - } else if (minimizeButtonRect().contains(local) && isLeftClicked(b)) { - window()->setWindowState(Qt::WindowMinimized); + if (closeButtonRect().contains(local)) { + if (clickButton(b, Close)) + QWindowSystemInterface::handleCloseEvent(window()); + } else if (maximizeButtonRect().contains(local)) { + if (clickButton(b, Maximize)) + window()->setWindowState(waylandWindow()->isMaximized() ? Qt::WindowNoState : Qt::WindowMaximized); + } else if (minimizeButtonRect().contains(local)) { + if (clickButton(b, Minimize)) + window()->setWindowState(Qt::WindowMinimized); } else if (local.y() <= margins().top()) { processMouseTop(inputDevice,local,b,mods); } else if (local.y() > window()->height() - margins().bottom() + margins().top()) { From 7d54e5527e630474a891b27ea6247eabfbd4e9ea Mon Sep 17 00:00:00 2001 From: Giulio Camuffo Date: Sat, 9 May 2015 10:29:15 +0300 Subject: [PATCH 0245/1507] Fix wheel events when the decorations are enabled We must offset the wheel events' position, as we do with the other types of mouse events. Change-Id: If85e93ffe95304c7dee4c2a3ff195a73243a8182 Reviewed-by: Pier Luigi Fiorini Reviewed-by: Laszlo Agocs --- .../platforms/wayland/qwaylandinputdevice.cpp | 15 +++++++++++---- .../platforms/wayland/qwaylandinputdevice_p.h | 13 ++++++++++++- src/plugins/platforms/wayland/qwaylandwindow.cpp | 6 ++++++ 3 files changed, 29 insertions(+), 5 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index 76ae258696b..009ef670e7d 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -494,6 +494,15 @@ void QWaylandInputDevice::Pointer::pointer_button(uint32_t serial, uint32_t time } } +class WheelEvent : public QWaylandPointerEvent +{ +public: + WheelEvent(ulong t, const QPointF &l, const QPointF &g, const QPoint &pd, const QPoint &ad) + : QWaylandPointerEvent(QWaylandPointerEvent::Wheel, t, l, g, pd, ad) + { + } +}; + void QWaylandInputDevice::Pointer::pointer_axis(uint32_t time, uint32_t axis, int32_t value) { QWaylandWindow *window = mFocus; @@ -517,10 +526,8 @@ void QWaylandInputDevice::Pointer::pointer_axis(uint32_t time, uint32_t axis, in angleDelta.setY(valueDelta); } - QWindowSystemInterface::handleWheelEvent(window->window(), - time, mSurfacePos, - mGlobalPos, pixelDelta, - angleDelta); + WheelEvent e(time, mSurfacePos, mGlobalPos, pixelDelta, angleDelta); + window->handleMouse(mParent, e); } #ifndef QT_NO_WAYLAND_XKB diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h index 23172ad3c93..6f3b25c06b1 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h +++ b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h @@ -259,7 +259,8 @@ class QWaylandPointerEvent public: enum Type { Enter, - Motion + Motion, + Wheel }; inline QWaylandPointerEvent(Type t, ulong ts, const QPointF &l, const QPointF &g, Qt::MouseButtons b, Qt::KeyboardModifiers m) : type(t) @@ -269,6 +270,14 @@ public: , buttons(b) , modifiers(m) {} + inline QWaylandPointerEvent(Type t, ulong ts, const QPointF &l, const QPointF &g, const QPoint &pd, const QPoint &ad) + : type(t) + , timestamp(ts) + , local(l) + , global(g) + , pixelDelta(pd) + , angleDelta(ad) + {} Type type; ulong timestamp; @@ -276,6 +285,8 @@ public: QPointF global; Qt::MouseButtons buttons; Qt::KeyboardModifiers modifiers; + QPoint pixelDelta; + QPoint angleDelta; }; } diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index a775080a37b..922b1ee00e5 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -625,6 +625,9 @@ void QWaylandWindow::handleMouse(QWaylandInputDevice *inputDevice, const QWaylan case QWaylandPointerEvent::Motion: QWindowSystemInterface::handleMouseEvent(window(), e.timestamp, e.local, e.global, e.buttons, e.modifiers); break; + case QWaylandPointerEvent::Wheel: + QWindowSystemInterface::handleWheelEvent(window(), e.timestamp, e.local, e.global, e.pixelDelta, e.angleDelta); + break; } } @@ -684,6 +687,9 @@ void QWaylandWindow::handleMouseEventWithDecoration(QWaylandInputDevice *inputDe case QWaylandPointerEvent::Motion: QWindowSystemInterface::handleMouseEvent(window(), e.timestamp, localTranslated, globalTranslated, e.buttons, e.modifiers); break; + case QWaylandPointerEvent::Wheel: + QWindowSystemInterface::handleWheelEvent(window(), e.timestamp, localTranslated, globalTranslated, e.pixelDelta, e.angleDelta); + break; } mMouseEventsInContentArea = true; From 36d1c47e6646a06fb8b36471648ad1752f4906de Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Fri, 5 Jun 2015 11:55:46 +0200 Subject: [PATCH 0246/1507] Fix typo that leads to mis-evaluation of an expression. Change-Id: I5d6eedeb3dfb80ca9df7ca27e29ad6604dbfe683 Reviewed-by: Laszlo Agocs --- src/plugins/platforms/wayland/qwaylandabstractdecoration.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandabstractdecoration.cpp b/src/plugins/platforms/wayland/qwaylandabstractdecoration.cpp index 7698ff75082..54a990b2d71 100644 --- a/src/plugins/platforms/wayland/qwaylandabstractdecoration.cpp +++ b/src/plugins/platforms/wayland/qwaylandabstractdecoration.cpp @@ -147,7 +147,7 @@ void QWaylandAbstractDecoration::startMove(QWaylandInputDevice *inputDevice, Qt: bool QWaylandAbstractDecoration::isLeftClicked(Qt::MouseButtons newMouseButtonState) { Q_D(QWaylandAbstractDecoration); - if ((!d->m_mouseButtons & Qt::LeftButton) && (newMouseButtonState & Qt::LeftButton)) + if (!(d->m_mouseButtons & Qt::LeftButton) && (newMouseButtonState & Qt::LeftButton)) return true; return false; } From bc63ed702ffc8c0cd42df98b2b8c57017df238d7 Mon Sep 17 00:00:00 2001 From: Olivier Blin Date: Sun, 7 Jun 2015 14:56:45 +0200 Subject: [PATCH 0247/1507] Fix input devices leak in client Change-Id: I28200698706168308e450b2cd3cfa99df517f9b7 Reviewed-by: Laszlo Agocs --- src/plugins/platforms/wayland/qwaylanddisplay.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index c3925f5c446..eb431cf0d21 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -165,6 +165,9 @@ QWaylandDisplay::QWaylandDisplay(QWaylandIntegration *waylandIntegration) QWaylandDisplay::~QWaylandDisplay(void) { + qDeleteAll(mInputDevices); + mInputDevices.clear(); + foreach (QWaylandScreen *screen, mScreens) { mWaylandIntegration->destroyScreen(screen); } From 837c740cd61a70eafc63c172fbe4bd3dd6058fe2 Mon Sep 17 00:00:00 2001 From: Giulio Camuffo Date: Thu, 23 Apr 2015 21:00:59 +0300 Subject: [PATCH 0248/1507] Fix tooltips without a transient parent QToolTip has the same problems as QMenu, that is you can create one without a parent and with a global position. Use the same trick and use the window that last received an input event as the parent. Change-Id: I093c8da0d54110903f35670b01dea6fa96abecf4 Reviewed-by: Robin Burchell --- .../platforms/wayland/qwaylandwindow.cpp | 29 ++++++++++--------- .../wayland/qwaylandwlshellsurface.cpp | 3 +- 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 922b1ee00e5..b98dd9dae0a 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -128,7 +128,7 @@ QWaylandWindow::QWaylandWindow(QWindow *window) if (window->type() != Qt::Popup) { mShellSurface->updateTransientParent(window->transientParent()); } - } else if (mShellSurface) { + } else if (mShellSurface && window->type() != Qt::ToolTip) { mShellSurface->setTopLevel(); } @@ -240,17 +240,18 @@ void QWaylandWindow::setGeometry(const QRect &rect) void QWaylandWindow::setVisible(bool visible) { if (visible) { - if (window()->type() == Qt::Popup) { - QWaylandWindow *parent = transientParent(); - if (!parent) { - // Try with the current focus window. It should be the right one and anyway - // better than having no parent at all. - parent = mDisplay->lastInputWindow(); - } - if (parent) { - QWaylandWlShellSurface *wlshellSurface = qobject_cast(mShellSurface); - if (wlshellSurface) - wlshellSurface->setPopup(parent, mDisplay->lastInputDevice(), mDisplay->lastInputSerial()); + if (mShellSurface) { + if (window()->type() == Qt::Popup) { + QWaylandWindow *parent = transientParent(); + if (parent) { + QWaylandWlShellSurface *wlshellSurface = qobject_cast(mShellSurface); + if (wlshellSurface) + wlshellSurface->setPopup(parent, mDisplay->lastInputDevice(), mDisplay->lastInputSerial()); + } + } else if (window()->type() == Qt::ToolTip) { + if (QWaylandWindow *parent = transientParent()) { + mShellSurface->updateTransientParent(parent->window()); + } } } @@ -609,7 +610,9 @@ QWaylandWindow *QWaylandWindow::transientParent() const // events. return static_cast(topLevelWindow(window()->transientParent())->handle()); } - return 0; + // Try with the current focus window. It should be the right one and anyway + // better than having no parent at all. + return mDisplay->lastInputWindow(); } void QWaylandWindow::handleMouse(QWaylandInputDevice *inputDevice, const QWaylandPointerEvent &e) diff --git a/src/plugins/platforms/wayland/qwaylandwlshellsurface.cpp b/src/plugins/platforms/wayland/qwaylandwlshellsurface.cpp index 8888dbf4d32..f7bdc2c99fc 100644 --- a/src/plugins/platforms/wayland/qwaylandwlshellsurface.cpp +++ b/src/plugins/platforms/wayland/qwaylandwlshellsurface.cpp @@ -159,8 +159,7 @@ void QWaylandWlShellSurface::updateTransientParent(QWindow *parent) // set_transient expects a position relative to the parent QPoint transientPos = m_window->geometry().topLeft(); // this is absolute - QWindow *parentWin = m_window->window()->transientParent(); - transientPos -= parentWin->geometry().topLeft(); + transientPos -= parent->geometry().topLeft(); if (parent_wayland_window->decoration()) { transientPos.setX(transientPos.x() + parent_wayland_window->decoration()->margins().left()); transientPos.setY(transientPos.y() + parent_wayland_window->decoration()->margins().top()); From 4d312f1ec700f5af33e06dd7119020cae9b0d0a9 Mon Sep 17 00:00:00 2001 From: Sergio Martins Date: Sat, 4 Jul 2015 10:50:17 +0100 Subject: [PATCH 0249/1507] Use by-ref in foreach where T is non-trivial Change-Id: Iac40929aebc1e0f507b729b0c01a2ccb18516c37 Reviewed-by: Giulio Camuffo --- src/plugins/platforms/wayland/qwaylandcursor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandcursor.cpp b/src/plugins/platforms/wayland/qwaylandcursor.cpp index 8e8293a09a4..8dfc95c3604 100644 --- a/src/plugins/platforms/wayland/qwaylandcursor.cpp +++ b/src/plugins/platforms/wayland/qwaylandcursor.cpp @@ -161,7 +161,7 @@ wl_cursor *QWaylandCursor::requestCursor(WaylandCursor shape) return NULL; QList cursorNames = mCursorNamesMap.values(shape); - foreach (QByteArray name, cursorNames) { + foreach (const QByteArray &name, cursorNames) { cursor = wl_cursor_theme_get_cursor(mCursorTheme, name.constData()); if (cursor) { mCursors.insert(shape, cursor); From 0b71d61d376124d264945e1098dff5ac30ea5009 Mon Sep 17 00:00:00 2001 From: Giulio Camuffo Date: Wed, 17 Jun 2015 14:48:44 +0300 Subject: [PATCH 0250/1507] Fix possible race condition leading to a dead lock It is a bit dangerous to call wl_display_dispatch() in the event thread, since it may race with the dispatch called e.g. in QWaylandDisplay's blockingReadEvents() and lead to a dead lock. Instead, use wl_display_prepare_read() and wl_display_read_events() in the event thread, which doesn't block, and only dispatch in QWaylandDisplay. As a result we don't need the additional wayland queue anymore, so remove it. Change-Id: I9fbbe5d2f38d06773beb7847df1a0212cca92c37 Reviewed-by: Robin Burchell --- src/plugins/platforms/wayland/qwaylanddisplay.cpp | 14 ++++---------- src/plugins/platforms/wayland/qwaylanddisplay_p.h | 2 -- .../platforms/wayland/qwaylandeventthread.cpp | 8 ++------ .../platforms/wayland/qwaylandnativeinterface.cpp | 2 -- 4 files changed, 6 insertions(+), 20 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index eb431cf0d21..f197b378803 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -147,12 +147,7 @@ QWaylandDisplay::QWaylandDisplay(QWaylandIntegration *waylandIntegration) mEventThreadObject->displayConnect(); mDisplay = mEventThreadObject->display(); //blocks until display is available - //Create a new even queue for the QtGui thread - mEventQueue = wl_display_create_queue(mDisplay); - struct ::wl_registry *registry = wl_display_get_registry(mDisplay); - wl_proxy_set_queue((struct wl_proxy *)registry, mEventQueue); - init(registry); connect(mEventThreadObject, SIGNAL(newEventsRead()), this, SLOT(flushRequests())); @@ -180,7 +175,7 @@ QWaylandDisplay::~QWaylandDisplay(void) void QWaylandDisplay::flushRequests() { - if (wl_display_dispatch_queue_pending(mDisplay, mEventQueue) < 0) { + if (wl_display_dispatch_pending(mDisplay) < 0) { mEventThreadObject->checkError(); exitWithError(); } @@ -191,7 +186,7 @@ void QWaylandDisplay::flushRequests() void QWaylandDisplay::blockingReadEvents() { - if (wl_display_dispatch_queue(mDisplay, mEventQueue) < 0) { + if (wl_display_dispatch(mDisplay) < 0) { mEventThreadObject->checkError(); exitWithError(); } @@ -345,17 +340,16 @@ void QWaylandDisplay::forceRoundTrip() int ret = 0; bool done = false; wl_callback *callback = wl_display_sync(mDisplay); - wl_proxy_set_queue((struct wl_proxy *)callback, mEventQueue); wl_callback_add_listener(callback, &sync_listener, &done); flushRequests(); if (QThread::currentThread()->eventDispatcher()) { while (!done && ret >= 0) { QThread::currentThread()->eventDispatcher()->processEvents(QEventLoop::WaitForMoreEvents); - ret = wl_display_dispatch_queue_pending(mDisplay, mEventQueue); + ret = wl_display_dispatch_pending(mDisplay); } } else { while (!done && ret >= 0) - ret = wl_display_dispatch_queue(mDisplay, mEventQueue); + ret = wl_display_dispatch(mDisplay); } if (ret == -1 && !done) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay_p.h b/src/plugins/platforms/wayland/qwaylanddisplay_p.h index 7ba431d7c99..ee129a50e44 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay_p.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay_p.h @@ -108,7 +108,6 @@ public: void setCursor(struct wl_buffer *buffer, struct wl_cursor_image *image); struct wl_display *wl_display() const { return mDisplay; } - struct wl_event_queue *wl_event_queue() const { return mEventQueue; } struct ::wl_registry *wl_registry() { return object(); } const struct wl_compositor *wl_compositor() const { return mCompositor.object(); } @@ -175,7 +174,6 @@ private: }; struct wl_display *mDisplay; - struct wl_event_queue *mEventQueue; QtWayland::wl_compositor mCompositor; struct wl_shm *mShm; QThread *mEventThread; diff --git a/src/plugins/platforms/wayland/qwaylandeventthread.cpp b/src/plugins/platforms/wayland/qwaylandeventthread.cpp index e2e21c9e76d..e0a3edcb81f 100644 --- a/src/plugins/platforms/wayland/qwaylandeventthread.cpp +++ b/src/plugins/platforms/wayland/qwaylandeventthread.cpp @@ -80,13 +80,9 @@ void QWaylandEventThread::checkError() const void QWaylandEventThread::readWaylandEvents() { - if (wl_display_dispatch(m_display) < 0) { - checkError(); - m_readNotifier->setEnabled(false); - emit fatalError(); - return; + if (wl_display_prepare_read(m_display) == 0) { + wl_display_read_events(m_display); } - emit newEventsRead(); } diff --git a/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp b/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp index 8170c39f1b3..0d20075f05d 100644 --- a/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp +++ b/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp @@ -58,8 +58,6 @@ void *QWaylandNativeInterface::nativeResourceForIntegration(const QByteArray &re if (lowerCaseResource == "display" || lowerCaseResource == "wl_display" || lowerCaseResource == "nativedisplay") return m_integration->display()->wl_display(); - if (lowerCaseResource == "wl_event_queue") - return m_integration->display()->wl_event_queue(); if (lowerCaseResource == "compositor") return const_cast(m_integration->display()->wl_compositor()); if (lowerCaseResource == "server_buffer_integration") From 61b80576b0d04346768df6cdc0411dd51b5d7a59 Mon Sep 17 00:00:00 2001 From: Giulio Camuffo Date: Sun, 5 Jul 2015 17:58:23 +0300 Subject: [PATCH 0251/1507] Use standard wl_subsurface interface to set a window as a child of another one Change-Id: I52628f87dbea5383db06468f9748a9bacdec3179 Reviewed-by: Robin Burchell --- .../platforms/wayland/qwaylanddisplay.cpp | 15 ++- .../platforms/wayland/qwaylanddisplay_p.h | 4 +- .../platforms/wayland/qwaylandsubsurface.cpp | 41 +----- .../platforms/wayland/qwaylandsubsurface_p.h | 14 +- .../platforms/wayland/qwaylandwindow.cpp | 126 +++++++++++------- .../platforms/wayland/qwaylandwindow_p.h | 5 + 6 files changed, 113 insertions(+), 92 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index 5b6f2cbf668..ab69bca3278 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -100,6 +100,15 @@ struct ::wl_region *QWaylandDisplay::createRegion(const QRegion &qregion) return region; } +::wl_subsurface *QWaylandDisplay::createSubSurface(QWaylandWindow *window, QWaylandWindow *parent) +{ + if (!mSubCompositor) { + return NULL; + } + + return mSubCompositor->get_subsurface(window->object(), parent->object()); +} + QWaylandClientBufferIntegration * QWaylandDisplay::clientBufferIntegration() const { return mWaylandIntegration->clientBufferIntegration(); @@ -125,7 +134,7 @@ QWaylandDisplay::QWaylandDisplay(QWaylandIntegration *waylandIntegration) , mLastKeyboardFocusInputDevice(0) , mDndSelectionHandler(0) , mWindowExtension(0) - , mSubSurfaceExtension(0) + , mSubCompositor(0) , mTouchExtension(0) , mQtKeyExtension(0) , mTextInputManager(0) @@ -259,8 +268,8 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin mDndSelectionHandler.reset(new QWaylandDataDeviceManager(this, id)); } else if (interface == QStringLiteral("qt_surface_extension")) { mWindowExtension.reset(new QtWayland::qt_surface_extension(registry, id, 1)); - } else if (interface == QStringLiteral("qt_sub_surface_extension")) { - mSubSurfaceExtension.reset(new QtWayland::qt_sub_surface_extension(registry, id, 1)); + } else if (interface == QStringLiteral("wl_subcompositor")) { + mSubCompositor.reset(new QtWayland::wl_subcompositor(registry, id, 1)); } else if (interface == QStringLiteral("qt_touch_extension")) { mTouchExtension.reset(new QWaylandTouchExtension(this, id)); } else if (interface == QStringLiteral("qt_key_extension")) { diff --git a/src/plugins/platforms/wayland/qwaylanddisplay_p.h b/src/plugins/platforms/wayland/qwaylanddisplay_p.h index 9a7ad39ce82..96d79ddbd5a 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay_p.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay_p.h @@ -100,6 +100,7 @@ public: struct wl_surface *createSurface(void *handle); QWaylandShellSurface *createShellSurface(QWaylandWindow *window); struct ::wl_region *createRegion(const QRegion &qregion); + struct ::wl_subsurface *createSubSurface(QWaylandWindow *window, QWaylandWindow *parent); QWaylandClientBufferIntegration *clientBufferIntegration() const; @@ -128,7 +129,6 @@ public: QWaylandDataDeviceManager *dndSelectionHandler() const { return mDndSelectionHandler.data(); } QtWayland::qt_surface_extension *windowExtension() const { return mWindowExtension.data(); } - QtWayland::qt_sub_surface_extension *subSurfaceExtension() const { return mSubSurfaceExtension.data(); } QWaylandTouchExtension *touchExtension() const { return mTouchExtension.data(); } QtWayland::wl_text_input_manager *textInputManager() const { return mTextInputManager.data(); } QWaylandHardwareIntegration *hardwareIntegration() const { return mHardwareIntegration.data(); } @@ -188,7 +188,7 @@ private: QWaylandInputDevice *mLastKeyboardFocusInputDevice; QScopedPointer mDndSelectionHandler; QScopedPointer mWindowExtension; - QScopedPointer mSubSurfaceExtension; + QScopedPointer mSubCompositor; QScopedPointer mTouchExtension; QScopedPointer mQtKeyExtension; QScopedPointer mWindowManagerIntegration; diff --git a/src/plugins/platforms/wayland/qwaylandsubsurface.cpp b/src/plugins/platforms/wayland/qwaylandsubsurface.cpp index 81cfef254bf..ec813609fd2 100644 --- a/src/plugins/platforms/wayland/qwaylandsubsurface.cpp +++ b/src/plugins/platforms/wayland/qwaylandsubsurface.cpp @@ -41,45 +41,18 @@ QT_BEGIN_NAMESPACE namespace QtWaylandClient { -QWaylandSubSurface::QWaylandSubSurface(QWaylandWindow *window, struct ::qt_sub_surface *sub_surface) - : QtWayland::qt_sub_surface(sub_surface) +QWaylandSubSurface::QWaylandSubSurface(QWaylandWindow *window, QWaylandWindow *parent, ::wl_subsurface *sub_surface) + : QtWayland::wl_subsurface(sub_surface) , m_window(window) + , m_parent(parent) { + m_parent->mChildren << this; + set_desync(); } -void QWaylandSubSurface::setParent(const QWaylandWindow *parent) +QWaylandSubSurface::~QWaylandSubSurface() { - QWaylandSubSurface *parentSurface = parent ? parent->subSurfaceWindow() : 0; - if (parentSurface) { - int x = m_window->geometry().x() + parent->frameMargins().left(); - int y = m_window->geometry().y() + parent->frameMargins().top(); - parentSurface->attach_sub_surface(object(), x, y); - } -} - -static void setPositionToParent(QWaylandWindow *parentWaylandWindow) -{ - QObjectList children = parentWaylandWindow->window()->children(); - for (int i = 0; i < children.size(); i++) { - QWindow *childWindow = qobject_cast(children.at(i)); - if (!childWindow) - continue; - - if (childWindow->handle()) { - QWaylandWindow *waylandWindow = static_cast(childWindow->handle()); - waylandWindow->subSurfaceWindow()->setParent(parentWaylandWindow); - setPositionToParent(waylandWindow); - } - } -} - -void QWaylandSubSurface::adjustPositionOfChildren() -{ - QWindow *window = m_window->window(); - if (window->parent()) { - qDebug() << "QWaylandSubSurface::adjustPositionOfChildren not called for toplevel window"; - } - setPositionToParent(m_window); + m_parent->mChildren.removeOne(this); } } diff --git a/src/plugins/platforms/wayland/qwaylandsubsurface_p.h b/src/plugins/platforms/wayland/qwaylandsubsurface_p.h index 232330855b8..75d8cf6a071 100644 --- a/src/plugins/platforms/wayland/qwaylandsubsurface_p.h +++ b/src/plugins/platforms/wayland/qwaylandsubsurface_p.h @@ -39,8 +39,7 @@ #include #include - -#include +#include QT_BEGIN_NAMESPACE @@ -48,18 +47,19 @@ namespace QtWaylandClient { class QWaylandDisplay; class QWaylandWindow; -class QWaylandSubSurface; -class Q_WAYLAND_CLIENT_EXPORT QWaylandSubSurface : public QtWayland::qt_sub_surface +class Q_WAYLAND_CLIENT_EXPORT QWaylandSubSurface : public QtWayland::wl_subsurface { public: - QWaylandSubSurface(QWaylandWindow *window, struct ::qt_sub_surface *sub_surface); + QWaylandSubSurface(QWaylandWindow *window, QWaylandWindow *parent, ::wl_subsurface *subsurface); + ~QWaylandSubSurface(); - void setParent(const QWaylandWindow *parent); - void adjustPositionOfChildren(); + QWaylandWindow *window() const { return m_window; } + QWaylandWindow *parent() const { return m_parent; } private: QWaylandWindow *m_window; + QWaylandWindow *m_parent; }; QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 922b1ee00e5..a54979a2f85 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -86,21 +86,49 @@ QWaylandWindow::QWaylandWindow(QWindow *window) , mMask() , mBackingStore(Q_NULLPTR) { - init(mDisplay->createSurface(static_cast(this))); - static WId id = 1; mWindowId = id++; - if (mDisplay->subSurfaceExtension()) - mSubSurfaceWindow = new QWaylandSubSurface(this, mDisplay->subSurfaceExtension()->get_sub_surface_aware_surface(object())); + initWindow(); +} - if (!(window->flags() & Qt::BypassWindowManagerHint)) { +QWaylandWindow::~QWaylandWindow() +{ + delete mWindowDecoration; + + if (isInitialized()) + reset(); + + QList inputDevices = mDisplay->inputDevices(); + for (int i = 0; i < inputDevices.size(); ++i) + inputDevices.at(i)->handleWindowDestroyed(this); + + const QWindow *parent = window(); + foreach (QWindow *w, QGuiApplication::topLevelWindows()) { + if (w->transientParent() == parent) + QWindowSystemInterface::handleCloseEvent(w); + } + + if (mMouseGrab == this) { + mMouseGrab = 0; + } +} + +void QWaylandWindow::initWindow() +{ + init(mDisplay->createSurface(static_cast(this))); + if (QPlatformWindow::parent()) { + QWaylandWindow *p = static_cast(QPlatformWindow::parent()); + if (::wl_subsurface *ss = mDisplay->createSubSurface(this, p)) { + mSubSurfaceWindow = new QWaylandSubSurface(this, p, ss); + } + } else if (!(window()->flags() & Qt::BypassWindowManagerHint)) { mShellSurface = mDisplay->createShellSurface(this); } if (mShellSurface) { // Set initial surface title - mShellSurface->setTitle(window->title()); + mShellSurface->setTitle(window()->title()); // The appId is the desktop entry identifier that should follow the // reverse DNS convention (see http://standards.freedesktop.org/desktop-entry-spec/latest/ar01s02.html), @@ -122,14 +150,14 @@ QWaylandWindow::QWaylandWindow(QWindow *window) } } - if (QPlatformWindow::parent() && mSubSurfaceWindow) { - mSubSurfaceWindow->setParent(static_cast(QPlatformWindow::parent())); - } else if (window->transientParent() && mShellSurface) { - if (window->type() != Qt::Popup) { - mShellSurface->updateTransientParent(window->transientParent()); + if (mShellSurface) { + if (window()->transientParent()) { + if (window()->type() != Qt::Popup) { + mShellSurface->updateTransientParent(window()->transientParent()); + } + } else { + mShellSurface->setTopLevel(); } - } else if (mShellSurface) { - mShellSurface->setTopLevel(); } // Enable high-dpi rendering. Scale() returns the screen scale factor and will @@ -138,38 +166,25 @@ QWaylandWindow::QWaylandWindow(QWindow *window) if (mDisplay->compositorVersion() >= 3) set_buffer_scale(scale()); - setOrientationMask(window->screen()->orientationUpdateMask()); - setWindowFlags(window->flags()); - setGeometry_helper(window->geometry()); - setMask(window->mask()); - setWindowStateInternal(window->windowState()); - handleContentOrientationChange(window->contentOrientation()); + if (QScreen *s = window()->screen()) + setOrientationMask(s->orientationUpdateMask()); + setWindowFlags(window()->flags()); + setGeometry_helper(window()->geometry()); + setMask(window()->mask()); + setWindowStateInternal(window()->windowState()); + handleContentOrientationChange(window()->contentOrientation()); } -QWaylandWindow::~QWaylandWindow() +void QWaylandWindow::reset() { - delete mWindowDecoration; + delete mShellSurface; + mShellSurface = 0; + delete mSubSurfaceWindow; + mSubSurfaceWindow = 0; + destroy(); - if (isInitialized()) { - delete mShellSurface; - destroy(); - } if (mFrameCallback) wl_callback_destroy(mFrameCallback); - - QList inputDevices = mDisplay->inputDevices(); - for (int i = 0; i < inputDevices.size(); ++i) - inputDevices.at(i)->handleWindowDestroyed(this); - - const QWindow *parent = window(); - foreach (QWindow *w, QGuiApplication::topLevelWindows()) { - if (w->transientParent() == parent) - QWindowSystemInterface::handleCloseEvent(w); - } - - if (mMouseGrab == this) { - mMouseGrab = 0; - } } QWaylandWindow *QWaylandWindow::fromWlSurface(::wl_surface *surface) @@ -184,9 +199,17 @@ WId QWaylandWindow::winId() const void QWaylandWindow::setParent(const QPlatformWindow *parent) { - const QWaylandWindow *parentWaylandWindow = static_cast(parent); - if (subSurfaceWindow()) { - subSurfaceWindow()->setParent(parentWaylandWindow); + QWaylandWindow *oldparent = mSubSurfaceWindow ? mSubSurfaceWindow->parent() : 0; + if (oldparent == parent) + return; + + if (mSubSurfaceWindow && parent) { // new parent, but we were a subsurface already + delete mSubSurfaceWindow; + QWaylandWindow *p = const_cast(static_cast(parent)); + mSubSurfaceWindow = new QWaylandSubSurface(this, p, mDisplay->createSubSurface(this, p)); + } else { // we're changing role, need to make a new wl_surface + reset(); + initWindow(); } } @@ -214,7 +237,10 @@ void QWaylandWindow::setGeometry_helper(const QRect &rect) qBound(window()->minimumWidth(), rect.width(), window()->maximumWidth()), qBound(window()->minimumHeight(), rect.height(), window()->maximumHeight()))); - if (shellSurface() && window()->transientParent() && window()->type() != Qt::Popup) + if (mSubSurfaceWindow) { + QMargins m = QPlatformWindow::parent()->frameMargins(); + mSubSurfaceWindow->set_position(rect.x() + m.left(), rect.y() + m.top()); + } else if (shellSurface() && window()->transientParent() && window()->type() != Qt::Popup) shellSurface()->updateTransientParent(window()->transientParent()); } @@ -546,7 +572,10 @@ bool QWaylandWindow::createDecoration() decoration = false; if (window()->flags() & Qt::BypassWindowManagerHint) decoration = false; + if (mSubSurfaceWindow) + decoration = false; + bool hadDecoration = mWindowDecoration; if (decoration && !decorationPluginFailed) { if (!mWindowDecoration) { QStringList decorations = QWaylandDecorationFactory::keys(); @@ -577,15 +606,20 @@ bool QWaylandWindow::createDecoration() return false; } mWindowDecoration->setWaylandWindow(this); - if (subSurfaceWindow()) { - subSurfaceWindow()->adjustPositionOfChildren(); - } } } else { delete mWindowDecoration; mWindowDecoration = 0; } + if (hadDecoration != (bool)mWindowDecoration) { + foreach (QWaylandSubSurface *subsurf, mChildren) { + QPoint pos = subsurf->window()->geometry().topLeft(); + QMargins m = frameMargins(); + subsurf->set_position(pos.x() + m.left(), pos.y() + m.top()); + } + } + return mWindowDecoration; } diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index 1898c4953db..6b9af10319f 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -190,6 +190,7 @@ protected: QWaylandDisplay *mDisplay; QWaylandShellSurface *mShellSurface; QWaylandSubSurface *mSubSurfaceWindow; + QVector mChildren; QWaylandAbstractDecoration *mWindowDecoration; bool mMouseEventsInContentArea; @@ -223,6 +224,8 @@ protected: private: bool setWindowStateInternal(Qt::WindowState flags); void setGeometry_helper(const QRect &rect); + void initWindow(); + void reset(); void handleMouseEventWithDecoration(QWaylandInputDevice *inputDevice, const QWaylandPointerEvent &e); @@ -231,6 +234,8 @@ private: static QMutex mFrameSyncMutex; static QWaylandWindow *mMouseGrab; + + friend class QWaylandSubSurface; }; inline QIcon QWaylandWindow::windowIcon() const From bd4a0928ab3c147eda942ae172f66585a9325cc7 Mon Sep 17 00:00:00 2001 From: Giulio Camuffo Date: Wed, 22 Apr 2015 13:45:28 +0300 Subject: [PATCH 0252/1507] Use xkbcommon for internal key events too To manage the keyboard state and send key events to clients we use the xkbcommon library (unless disabled). That means that we currently have a separation between key events outgoing to clients and key events being used internally in the compositor, resulting in different keysyms being produced in the two cases for the same hardware key. Filter the key events coming from the underlying platform and modify them according to the xkb state instead. Change-Id: I4c6678be68e5b214b2b9cd0222dc9f425c580085 Reviewed-by: Pier Luigi Fiorini Reviewed-by: Robin Burchell --- src/plugins/platforms/wayland/client.pro | 2 + .../platforms/wayland/qwaylandinputdevice.cpp | 158 +------------- .../platforms/wayland/shared/qwaylandxkb.cpp | 202 ++++++++++++++++++ .../platforms/wayland/shared/qwaylandxkb.h | 56 +++++ 4 files changed, 263 insertions(+), 155 deletions(-) create mode 100644 src/plugins/platforms/wayland/shared/qwaylandxkb.cpp create mode 100644 src/plugins/platforms/wayland/shared/qwaylandxkb.h diff --git a/src/plugins/platforms/wayland/client.pro b/src/plugins/platforms/wayland/client.pro index 29016c9c8ec..ba17b21c57c 100644 --- a/src/plugins/platforms/wayland/client.pro +++ b/src/plugins/platforms/wayland/client.pro @@ -75,6 +75,7 @@ SOURCES += qwaylandintegration.cpp \ qwaylandtouch.cpp \ qwaylandqtkey.cpp \ ../shared/qwaylandmimehelper.cpp \ + ../shared/qwaylandxkb.cpp \ qwaylandabstractdecoration.cpp \ qwaylanddecorationfactory.cpp \ qwaylanddecorationplugin.cpp \ @@ -107,6 +108,7 @@ HEADERS += qwaylandintegration_p.h \ qwaylandtouch_p.h \ qwaylandqtkey_p.h \ ../shared/qwaylandmimehelper.h \ + ../shared/qwaylandxkb.h \ qwaylandabstractdecoration_p.h \ qwaylanddecorationfactory_p.h \ qwaylanddecorationplugin_p.h \ diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index 009ef670e7d..9ac678c93b5 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -42,6 +42,7 @@ #include "qwaylandscreen_p.h" #include "qwaylandcursor_p.h" #include "qwaylanddisplay_p.h" +#include "../shared/qwaylandxkb.h" #include #include @@ -302,16 +303,7 @@ Qt::KeyboardModifiers QWaylandInputDevice::Keyboard::modifiers() const if (!mXkbState) return ret; - xkb_state_component cstate = static_cast(XKB_STATE_DEPRESSED | XKB_STATE_LATCHED); - - if (xkb_state_mod_name_is_active(mXkbState, XKB_MOD_NAME_SHIFT, cstate)) - ret |= Qt::ShiftModifier; - if (xkb_state_mod_name_is_active(mXkbState, XKB_MOD_NAME_CTRL, cstate)) - ret |= Qt::ControlModifier; - if (xkb_state_mod_name_is_active(mXkbState, XKB_MOD_NAME_ALT, cstate)) - ret |= Qt::AltModifier; - if (xkb_state_mod_name_is_active(mXkbState, XKB_MOD_NAME_LOGO, cstate)) - ret |= Qt::MetaModifier; + ret = QWaylandXkb::modifiers(mXkbState); #endif return ret; @@ -530,150 +522,6 @@ void QWaylandInputDevice::Pointer::pointer_axis(uint32_t time, uint32_t axis, in window->handleMouse(mParent, e); } -#ifndef QT_NO_WAYLAND_XKB - -static const uint32_t KeyTbl[] = { - XKB_KEY_Escape, Qt::Key_Escape, - XKB_KEY_Tab, Qt::Key_Tab, - XKB_KEY_ISO_Left_Tab, Qt::Key_Backtab, - XKB_KEY_BackSpace, Qt::Key_Backspace, - XKB_KEY_Return, Qt::Key_Return, - XKB_KEY_Insert, Qt::Key_Insert, - XKB_KEY_Delete, Qt::Key_Delete, - XKB_KEY_Clear, Qt::Key_Delete, - XKB_KEY_Pause, Qt::Key_Pause, - XKB_KEY_Print, Qt::Key_Print, - - XKB_KEY_Home, Qt::Key_Home, - XKB_KEY_End, Qt::Key_End, - XKB_KEY_Left, Qt::Key_Left, - XKB_KEY_Up, Qt::Key_Up, - XKB_KEY_Right, Qt::Key_Right, - XKB_KEY_Down, Qt::Key_Down, - XKB_KEY_Prior, Qt::Key_PageUp, - XKB_KEY_Next, Qt::Key_PageDown, - - XKB_KEY_Shift_L, Qt::Key_Shift, - XKB_KEY_Shift_R, Qt::Key_Shift, - XKB_KEY_Shift_Lock, Qt::Key_Shift, - XKB_KEY_Control_L, Qt::Key_Control, - XKB_KEY_Control_R, Qt::Key_Control, - XKB_KEY_Meta_L, Qt::Key_Meta, - XKB_KEY_Meta_R, Qt::Key_Meta, - XKB_KEY_Alt_L, Qt::Key_Alt, - XKB_KEY_Alt_R, Qt::Key_Alt, - XKB_KEY_Caps_Lock, Qt::Key_CapsLock, - XKB_KEY_Num_Lock, Qt::Key_NumLock, - XKB_KEY_Scroll_Lock, Qt::Key_ScrollLock, - XKB_KEY_Super_L, Qt::Key_Super_L, - XKB_KEY_Super_R, Qt::Key_Super_R, - XKB_KEY_Menu, Qt::Key_Menu, - XKB_KEY_Hyper_L, Qt::Key_Hyper_L, - XKB_KEY_Hyper_R, Qt::Key_Hyper_R, - XKB_KEY_Help, Qt::Key_Help, - - XKB_KEY_KP_Space, Qt::Key_Space, - XKB_KEY_KP_Tab, Qt::Key_Tab, - XKB_KEY_KP_Enter, Qt::Key_Enter, - XKB_KEY_KP_Home, Qt::Key_Home, - XKB_KEY_KP_Left, Qt::Key_Left, - XKB_KEY_KP_Up, Qt::Key_Up, - XKB_KEY_KP_Right, Qt::Key_Right, - XKB_KEY_KP_Down, Qt::Key_Down, - XKB_KEY_KP_Prior, Qt::Key_PageUp, - XKB_KEY_KP_Next, Qt::Key_PageDown, - XKB_KEY_KP_End, Qt::Key_End, - XKB_KEY_KP_Begin, Qt::Key_Clear, - XKB_KEY_KP_Insert, Qt::Key_Insert, - XKB_KEY_KP_Delete, Qt::Key_Delete, - XKB_KEY_KP_Equal, Qt::Key_Equal, - XKB_KEY_KP_Multiply, Qt::Key_Asterisk, - XKB_KEY_KP_Add, Qt::Key_Plus, - XKB_KEY_KP_Separator, Qt::Key_Comma, - XKB_KEY_KP_Subtract, Qt::Key_Minus, - XKB_KEY_KP_Decimal, Qt::Key_Period, - XKB_KEY_KP_Divide, Qt::Key_Slash, - - XKB_KEY_ISO_Level3_Shift, Qt::Key_AltGr, - XKB_KEY_Multi_key, Qt::Key_Multi_key, - XKB_KEY_Codeinput, Qt::Key_Codeinput, - XKB_KEY_SingleCandidate, Qt::Key_SingleCandidate, - XKB_KEY_MultipleCandidate, Qt::Key_MultipleCandidate, - XKB_KEY_PreviousCandidate, Qt::Key_PreviousCandidate, - - XKB_KEY_Mode_switch, Qt::Key_Mode_switch, - XKB_KEY_script_switch, Qt::Key_Mode_switch, - - XKB_KEY_XF86Back, Qt::Key_Back, - XKB_KEY_XF86Forward, Qt::Key_Forward, - - XKB_KEY_XF86AudioPlay, Qt::Key_MediaTogglePlayPause, //there isn't a PlayPause keysym, however just play keys are not common - XKB_KEY_XF86AudioPause, Qt::Key_MediaPause, - XKB_KEY_XF86AudioStop, Qt::Key_MediaStop, - XKB_KEY_XF86AudioPrev, Qt::Key_MediaPrevious, - XKB_KEY_XF86AudioNext, Qt::Key_MediaNext, - XKB_KEY_XF86AudioRewind, Qt::Key_MediaPrevious, - XKB_KEY_XF86AudioForward, Qt::Key_MediaNext, - XKB_KEY_XF86AudioRecord, Qt::Key_MediaRecord, - - XKB_KEY_XF86AudioMute, Qt::Key_VolumeMute, - XKB_KEY_XF86AudioLowerVolume, Qt::Key_VolumeDown, - XKB_KEY_XF86AudioRaiseVolume, Qt::Key_VolumeUp, - - XKB_KEY_XF86AudioRandomPlay, Qt::Key_AudioRandomPlay, - XKB_KEY_XF86AudioRepeat, Qt::Key_AudioRepeat, - - XKB_KEY_XF86ZoomIn, Qt::Key_ZoomIn, - XKB_KEY_XF86ZoomOut, Qt::Key_ZoomOut, - - XKB_KEY_XF86Eject, Qt::Key_Eject, - - 0, 0 -}; - -static int keysymToQtKey(xkb_keysym_t key) -{ - int code = 0; - int i = 0; - while (KeyTbl[i]) { - if (key == KeyTbl[i]) { - code = (int)KeyTbl[i+1]; - break; - } - i += 2; - } - - return code; -} - -static int keysymToQtKey(xkb_keysym_t keysym, Qt::KeyboardModifiers &modifiers, const QString &text) -{ - int code = 0; - - if (keysym >= XKB_KEY_F1 && keysym <= XKB_KEY_F35) { - code = Qt::Key_F1 + (int(keysym) - XKB_KEY_F1); - } else if (keysym >= XKB_KEY_KP_Space && keysym <= XKB_KEY_KP_9) { - if (keysym >= XKB_KEY_KP_0) { - // numeric keypad keys - code = Qt::Key_0 + ((int)keysym - XKB_KEY_KP_0); - } else { - code = keysymToQtKey(keysym); - } - modifiers |= Qt::KeypadModifier; - } else if (text.length() == 1 && text.unicode()->unicode() > 0x1f - && text.unicode()->unicode() != 0x7f - && !(keysym >= XKB_KEY_dead_grave && keysym <= XKB_KEY_dead_currency)) { - code = text.unicode()->toUpper().unicode(); - } else { - // any other keys - code = keysymToQtKey(keysym); - } - - return code; -} - -#endif // QT_NO_WAYLAND_XKB - void QWaylandInputDevice::Keyboard::keyboard_keymap(uint32_t format, int32_t fd, uint32_t size) { #ifndef QT_NO_WAYLAND_XKB @@ -795,7 +643,7 @@ void QWaylandInputDevice::Keyboard::keyboard_key(uint32_t serial, uint32_t time, if (utf32) text = QString::fromUcs4(&utf32, 1); - qtkey = keysymToQtKey(sym, modifiers, text); + qtkey = QWaylandXkb::keysymToQtKey(sym, modifiers, text); QWindowSystemInterface::handleExtendedKeyEvent(window->window(), time, type, qtkey, diff --git a/src/plugins/platforms/wayland/shared/qwaylandxkb.cpp b/src/plugins/platforms/wayland/shared/qwaylandxkb.cpp new file mode 100644 index 00000000000..c947902bdef --- /dev/null +++ b/src/plugins/platforms/wayland/shared/qwaylandxkb.cpp @@ -0,0 +1,202 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Copyright (C) 2015 Jolla Ltd +** Contact: http://www.qt-project.org/legal +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL21$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qwaylandxkb.h" + +#include + +#ifndef QT_NO_WAYLAND_XKB + +#include + +QT_BEGIN_NAMESPACE + +static const uint32_t KeyTbl[] = { + XKB_KEY_Escape, Qt::Key_Escape, + XKB_KEY_Tab, Qt::Key_Tab, + XKB_KEY_ISO_Left_Tab, Qt::Key_Backtab, + XKB_KEY_BackSpace, Qt::Key_Backspace, + XKB_KEY_Return, Qt::Key_Return, + XKB_KEY_Insert, Qt::Key_Insert, + XKB_KEY_Delete, Qt::Key_Delete, + XKB_KEY_Clear, Qt::Key_Delete, + XKB_KEY_Pause, Qt::Key_Pause, + XKB_KEY_Print, Qt::Key_Print, + + XKB_KEY_Home, Qt::Key_Home, + XKB_KEY_End, Qt::Key_End, + XKB_KEY_Left, Qt::Key_Left, + XKB_KEY_Up, Qt::Key_Up, + XKB_KEY_Right, Qt::Key_Right, + XKB_KEY_Down, Qt::Key_Down, + XKB_KEY_Prior, Qt::Key_PageUp, + XKB_KEY_Next, Qt::Key_PageDown, + + XKB_KEY_Shift_L, Qt::Key_Shift, + XKB_KEY_Shift_R, Qt::Key_Shift, + XKB_KEY_Shift_Lock, Qt::Key_Shift, + XKB_KEY_Control_L, Qt::Key_Control, + XKB_KEY_Control_R, Qt::Key_Control, + XKB_KEY_Meta_L, Qt::Key_Meta, + XKB_KEY_Meta_R, Qt::Key_Meta, + XKB_KEY_Alt_L, Qt::Key_Alt, + XKB_KEY_Alt_R, Qt::Key_Alt, + XKB_KEY_Caps_Lock, Qt::Key_CapsLock, + XKB_KEY_Num_Lock, Qt::Key_NumLock, + XKB_KEY_Scroll_Lock, Qt::Key_ScrollLock, + XKB_KEY_Super_L, Qt::Key_Super_L, + XKB_KEY_Super_R, Qt::Key_Super_R, + XKB_KEY_Menu, Qt::Key_Menu, + XKB_KEY_Hyper_L, Qt::Key_Hyper_L, + XKB_KEY_Hyper_R, Qt::Key_Hyper_R, + XKB_KEY_Help, Qt::Key_Help, + + XKB_KEY_KP_Space, Qt::Key_Space, + XKB_KEY_KP_Tab, Qt::Key_Tab, + XKB_KEY_KP_Enter, Qt::Key_Enter, + XKB_KEY_KP_Home, Qt::Key_Home, + XKB_KEY_KP_Left, Qt::Key_Left, + XKB_KEY_KP_Up, Qt::Key_Up, + XKB_KEY_KP_Right, Qt::Key_Right, + XKB_KEY_KP_Down, Qt::Key_Down, + XKB_KEY_KP_Prior, Qt::Key_PageUp, + XKB_KEY_KP_Next, Qt::Key_PageDown, + XKB_KEY_KP_End, Qt::Key_End, + XKB_KEY_KP_Begin, Qt::Key_Clear, + XKB_KEY_KP_Insert, Qt::Key_Insert, + XKB_KEY_KP_Delete, Qt::Key_Delete, + XKB_KEY_KP_Equal, Qt::Key_Equal, + XKB_KEY_KP_Multiply, Qt::Key_Asterisk, + XKB_KEY_KP_Add, Qt::Key_Plus, + XKB_KEY_KP_Separator, Qt::Key_Comma, + XKB_KEY_KP_Subtract, Qt::Key_Minus, + XKB_KEY_KP_Decimal, Qt::Key_Period, + XKB_KEY_KP_Divide, Qt::Key_Slash, + + XKB_KEY_ISO_Level3_Shift, Qt::Key_AltGr, + XKB_KEY_Multi_key, Qt::Key_Multi_key, + XKB_KEY_Codeinput, Qt::Key_Codeinput, + XKB_KEY_SingleCandidate, Qt::Key_SingleCandidate, + XKB_KEY_MultipleCandidate, Qt::Key_MultipleCandidate, + XKB_KEY_PreviousCandidate, Qt::Key_PreviousCandidate, + + XKB_KEY_Mode_switch, Qt::Key_Mode_switch, + XKB_KEY_script_switch, Qt::Key_Mode_switch, + + XKB_KEY_XF86AudioPlay, Qt::Key_MediaTogglePlayPause, //there isn't a PlayPause keysym, however just play keys are not common + XKB_KEY_XF86AudioPause, Qt::Key_MediaPause, + XKB_KEY_XF86AudioStop, Qt::Key_MediaStop, + XKB_KEY_XF86AudioPrev, Qt::Key_MediaPrevious, + XKB_KEY_XF86AudioNext, Qt::Key_MediaNext, + XKB_KEY_XF86AudioRewind, Qt::Key_MediaPrevious, + XKB_KEY_XF86AudioForward, Qt::Key_MediaNext, + XKB_KEY_XF86AudioRecord, Qt::Key_MediaRecord, + + XKB_KEY_XF86AudioMute, Qt::Key_VolumeMute, + XKB_KEY_XF86AudioLowerVolume, Qt::Key_VolumeDown, + XKB_KEY_XF86AudioRaiseVolume, Qt::Key_VolumeUp, + + XKB_KEY_XF86AudioRandomPlay, Qt::Key_AudioRandomPlay, + XKB_KEY_XF86AudioRepeat, Qt::Key_AudioRepeat, + + XKB_KEY_XF86ZoomIn, Qt::Key_ZoomIn, + XKB_KEY_XF86ZoomOut, Qt::Key_ZoomOut, + + XKB_KEY_XF86Eject, Qt::Key_Eject, + + 0, 0 +}; + +static int lookupKeysym(xkb_keysym_t key) +{ + int code = 0; + int i = 0; + while (KeyTbl[i]) { + if (key == KeyTbl[i]) { + code = (int)KeyTbl[i+1]; + break; + } + i += 2; + } + + return code; +} + +int QWaylandXkb::keysymToQtKey(xkb_keysym_t keysym, Qt::KeyboardModifiers &modifiers, const QString &text) +{ + int code = 0; + + if (keysym >= XKB_KEY_F1 && keysym <= XKB_KEY_F35) { + code = Qt::Key_F1 + (int(keysym) - XKB_KEY_F1); + } else if (keysym >= XKB_KEY_KP_Space && keysym <= XKB_KEY_KP_9) { + if (keysym >= XKB_KEY_KP_0) { + // numeric keypad keys + code = Qt::Key_0 + ((int)keysym - XKB_KEY_KP_0); + } else { + code = lookupKeysym(keysym); + } + modifiers |= Qt::KeypadModifier; + } else if (text.length() == 1 && text.unicode()->unicode() > 0x1f + && text.unicode()->unicode() != 0x7f + && !(keysym >= XKB_KEY_dead_grave && keysym <= XKB_KEY_dead_currency)) { + code = text.unicode()->toUpper().unicode(); + } else { + // any other keys + code = lookupKeysym(keysym); + } + + return code; +} + +Qt::KeyboardModifiers QWaylandXkb::modifiers(struct xkb_state *state) +{ + Qt::KeyboardModifiers modifiers = Qt::NoModifier; + + xkb_state_component cstate = static_cast(XKB_STATE_DEPRESSED | XKB_STATE_LATCHED | XKB_STATE_LOCKED); + + if (xkb_state_mod_name_is_active(state, XKB_MOD_NAME_SHIFT, cstate)) + modifiers |= Qt::ShiftModifier; + if (xkb_state_mod_name_is_active(state, XKB_MOD_NAME_CTRL, cstate)) + modifiers |= Qt::ControlModifier; + if (xkb_state_mod_name_is_active(state, XKB_MOD_NAME_ALT, cstate)) + modifiers |= Qt::AltModifier; + if (xkb_state_mod_name_is_active(state, XKB_MOD_NAME_LOGO, cstate)) + modifiers |= Qt::MetaModifier; + + return modifiers; +} + +QT_END_NAMESPACE + +#endif // QT_NO_WAYLAND_XKB diff --git a/src/plugins/platforms/wayland/shared/qwaylandxkb.h b/src/plugins/platforms/wayland/shared/qwaylandxkb.h new file mode 100644 index 00000000000..91e69ab0378 --- /dev/null +++ b/src/plugins/platforms/wayland/shared/qwaylandxkb.h @@ -0,0 +1,56 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Copyright (C) 2015 Jolla Ltd +** Contact: http://www.qt-project.org/legal +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL21$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWAYLANDXKB_H +#define QWAYLANDXKB_H + +#ifndef QT_NO_WAYLAND_XKB + +#include +#include + +QT_BEGIN_NAMESPACE + +class QWaylandXkb +{ +public: + static int keysymToQtKey(xkb_keysym_t keysym, Qt::KeyboardModifiers &modifiers, const QString &text); + static Qt::KeyboardModifiers modifiers(struct xkb_state *state); +}; + +QT_END_NAMESPACE + +#endif // QT_NO_WAYLAND_XKB + +#endif From 5328e070e3f60592178481c3950c9d65e30f50b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Fri, 24 Jul 2015 15:22:41 +0200 Subject: [PATCH 0253/1507] Fix some wrong licenses in QtWaylandClient Change-Id: I8d5e88e9b296276c6d9d570b3e5e704f32298d83 --- .../platforms/wayland/qwaylanddatadevice.cpp | 48 ++++++++----------- .../platforms/wayland/qwaylanddatadevice_p.h | 48 ++++++++----------- .../wayland/qwaylandinputcontext.cpp | 48 ++++++++----------- .../wayland/qwaylandinputcontext_p.h | 48 ++++++++----------- 4 files changed, 84 insertions(+), 108 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylanddatadevice.cpp b/src/plugins/platforms/wayland/qwaylanddatadevice.cpp index a3e084a0c10..779fd9cc26c 100644 --- a/src/plugins/platforms/wayland/qwaylanddatadevice.cpp +++ b/src/plugins/platforms/wayland/qwaylanddatadevice.cpp @@ -3,41 +3,35 @@ ** Copyright (C) 2013 Klarälvdalens Datakonsult AB (KDAB). ** Contact: http://www.qt.io/licensing/ ** -** This file is part of the Qt Compositor. +** This file is part of the QtWaylandClient module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: +** $QT_BEGIN_LICENSE:LGPL21$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ ** ****************************************************************************/ + #include "qwaylanddatadevice_p.h" #include "qwaylanddatadevicemanager_p.h" diff --git a/src/plugins/platforms/wayland/qwaylanddatadevice_p.h b/src/plugins/platforms/wayland/qwaylanddatadevice_p.h index d6d38d68189..5008b455258 100644 --- a/src/plugins/platforms/wayland/qwaylanddatadevice_p.h +++ b/src/plugins/platforms/wayland/qwaylanddatadevice_p.h @@ -3,41 +3,35 @@ ** Copyright (C) 2013 Klarälvdalens Datakonsult AB (KDAB). ** Contact: http://www.qt.io/licensing/ ** -** This file is part of the Qt Compositor. +** This file is part of the QtWaylandClient module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: +** $QT_BEGIN_LICENSE:LGPL21$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ ** ****************************************************************************/ + #ifndef QWAYLANDDATADEVICE_H #define QWAYLANDDATADEVICE_H diff --git a/src/plugins/platforms/wayland/qwaylandinputcontext.cpp b/src/plugins/platforms/wayland/qwaylandinputcontext.cpp index 119a1528787..d1ac14982f2 100644 --- a/src/plugins/platforms/wayland/qwaylandinputcontext.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputcontext.cpp @@ -3,41 +3,35 @@ ** Copyright (C) 2013 Klarälvdalens Datakonsult AB (KDAB). ** Contact: http://www.qt.io/licensing/ ** -** This file is part of the Qt Compositor. +** This file is part of the QtWaylandClient module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: +** $QT_BEGIN_LICENSE:LGPL21$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ ** ****************************************************************************/ + #include "qwaylandinputcontext_p.h" #include diff --git a/src/plugins/platforms/wayland/qwaylandinputcontext_p.h b/src/plugins/platforms/wayland/qwaylandinputcontext_p.h index 522e95fff7b..8dd13b19f72 100644 --- a/src/plugins/platforms/wayland/qwaylandinputcontext_p.h +++ b/src/plugins/platforms/wayland/qwaylandinputcontext_p.h @@ -3,41 +3,35 @@ ** Copyright (C) 2013 Klarälvdalens Datakonsult AB (KDAB). ** Contact: http://www.qt.io/licensing/ ** -** This file is part of the Qt Compositor. +** This file is part of the QtWaylandClient module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: +** $QT_BEGIN_LICENSE:LGPL21$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ ** ****************************************************************************/ + #ifndef QWAYLANDINPUTCONTEXT_H #define QWAYLANDINPUTCONTEXT_H From df9b95be2af739394efe76a113cf6a4322559a1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Fri, 10 Jul 2015 10:58:21 +0200 Subject: [PATCH 0254/1507] Compile after QPA API changes. QMouseEvent -> QPoint in QSimpleDrag::move and drop Task-number: QTBUG-46615 Change-Id: I9cda0f039ee8f5a70219b320abbb65f8649747e1 Reviewed-by: Giulio Camuffo --- src/plugins/platforms/wayland/qwaylanddnd.cpp | 8 ++++---- src/plugins/platforms/wayland/qwaylanddnd_p.h | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylanddnd.cpp b/src/plugins/platforms/wayland/qwaylanddnd.cpp index 302864d4ba6..59f91411f03 100644 --- a/src/plugins/platforms/wayland/qwaylanddnd.cpp +++ b/src/plugins/platforms/wayland/qwaylanddnd.cpp @@ -89,15 +89,15 @@ void QWaylandDrag::cancel() m_display->currentInputDevice()->dataDevice()->cancelDrag(); } -void QWaylandDrag::move(const QMouseEvent *me) +void QWaylandDrag::move(const QPoint &globalPos) { - Q_UNUSED(me); + Q_UNUSED(globalPos); // Do nothing } -void QWaylandDrag::drop(const QMouseEvent *me) +void QWaylandDrag::drop(const QPoint &globalPos) { - Q_UNUSED(me); + Q_UNUSED(globalPos); // Do nothing } diff --git a/src/plugins/platforms/wayland/qwaylanddnd_p.h b/src/plugins/platforms/wayland/qwaylanddnd_p.h index 994c65c4504..19b1f92ed3a 100644 --- a/src/plugins/platforms/wayland/qwaylanddnd_p.h +++ b/src/plugins/platforms/wayland/qwaylanddnd_p.h @@ -63,8 +63,8 @@ public: protected: void startDrag() Q_DECL_OVERRIDE; void cancel() Q_DECL_OVERRIDE; - void move(const QMouseEvent *me) Q_DECL_OVERRIDE; - void drop(const QMouseEvent *me) Q_DECL_OVERRIDE; + void move(const QPoint &globalPos) Q_DECL_OVERRIDE; + void drop(const QPoint &globalpos) Q_DECL_OVERRIDE; void endDrag() Q_DECL_OVERRIDE; From f984cff1d8db9b7915bc05253d4ea9999f6c2553 Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Fri, 12 Jun 2015 08:18:24 -0700 Subject: [PATCH 0255/1507] Fallback to normal input method plugins wl_text_input is still a weston-specific extension. other compositors just expect the normal input context plugins to be instantiated when the wayland client connects. now try to use the one based upon wl_text_input, if fails fallback to the QPlatformInputContextFactory::create() route Change-Id: I034acf9ed19c766250f81fc5648d0318ae45f1bf Reviewed-by: Giulio Camuffo --- src/plugins/platforms/wayland/qwaylandintegration.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandintegration.cpp b/src/plugins/platforms/wayland/qwaylandintegration.cpp index 9526aec4c4e..c8d12176688 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandintegration.cpp @@ -128,7 +128,15 @@ QWaylandIntegration::QWaylandIntegration() mClipboard = new QWaylandClipboard(mDisplay); mDrag = new QWaylandDrag(mDisplay); - mInputContext.reset(new QWaylandInputContext(mDisplay)); + //try to use the input context using the wl_text_input interface + QPlatformInputContext *ctx = new QWaylandInputContext(mDisplay); + mInputContext.reset(ctx); + + //use the traditional way for on screen keyboards for now + if (!mInputContext.data()->isValid()) { + ctx = QPlatformInputContextFactory::create(); + mInputContext.reset(ctx); + } } QWaylandIntegration::~QWaylandIntegration() From e1a2dacb75a498c86a490f40e112ac3928f79a85 Mon Sep 17 00:00:00 2001 From: Bernd Weimer Date: Thu, 20 Aug 2015 10:30:44 +0200 Subject: [PATCH 0256/1507] Enable input context selection It was not possible to use a different input context than the platform context. This has been unified across major platforms, depending on the environment variable "QT_IM_MODULE", the following context is selected: - null: default platform context (Wayland in this case) - empty: no context - set: set one, if it exists and is valid (otherwise no context) Change-Id: I07c6fb339c434f99fc6e092a2e18f00600daa3bc Reviewed-by: Nedim Hadzic Reviewed-by: Jan Arne Petersen Reviewed-by: Giulio Camuffo --- src/plugins/platforms/wayland/qwaylandintegration.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandintegration.cpp b/src/plugins/platforms/wayland/qwaylandintegration.cpp index 9526aec4c4e..82df8a30a41 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandintegration.cpp @@ -128,7 +128,9 @@ QWaylandIntegration::QWaylandIntegration() mClipboard = new QWaylandClipboard(mDisplay); mDrag = new QWaylandDrag(mDisplay); - mInputContext.reset(new QWaylandInputContext(mDisplay)); + QString icStr = QPlatformInputContextFactory::requested(); + icStr.isNull() ? mInputContext.reset(new QWaylandInputContext(mDisplay)) + : mInputContext.reset(QPlatformInputContextFactory::create(icStr)); } QWaylandIntegration::~QWaylandIntegration() From eb1fe81b7d316d80d223265ef2983a70b61434e9 Mon Sep 17 00:00:00 2001 From: Giulio Camuffo Date: Thu, 20 Aug 2015 14:47:36 +0200 Subject: [PATCH 0257/1507] Fix QDesktopServices::openUrl when there is no windowmanager integration Change-Id: I51da06261acfb193a59db34bc2dd25e3452fce8d Reviewed-by: Laszlo Agocs --- .../qwaylandwindowmanagerintegration.cpp | 29 +++++++++++-------- .../qwaylandwindowmanagerintegration_p.h | 4 +-- 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration.cpp b/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration.cpp index 56fe7c5a3d5..5e8a628bf85 100644 --- a/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration.cpp @@ -127,28 +127,33 @@ QByteArray QWaylandWindowManagerIntegration::desktopEnvironment() const void QWaylandWindowManagerIntegration::openUrl_helper(const QUrl &url) { - if (isInitialized()) { - QByteArray data = url.toString().toUtf8(); + Q_ASSERT(isInitialized()); + QByteArray data = url.toString().toUtf8(); - static const int chunkSize = 128; - while (!data.isEmpty()) { - QByteArray chunk = data.left(chunkSize); - data = data.mid(chunkSize); - open_url(!data.isEmpty(), QString::fromUtf8(chunk)); - } + static const int chunkSize = 128; + while (!data.isEmpty()) { + QByteArray chunk = data.left(chunkSize); + data = data.mid(chunkSize); + open_url(!data.isEmpty(), QString::fromUtf8(chunk)); } } bool QWaylandWindowManagerIntegration::openUrl(const QUrl &url) { - openUrl_helper(url); - return true; + if (isInitialized()) { + openUrl_helper(url); + return true; + } + return QGenericUnixServices::openUrl(url); } bool QWaylandWindowManagerIntegration::openDocument(const QUrl &url) { - openUrl_helper(url); - return true; + if (isInitialized()) { + openUrl_helper(url); + return true; + } + return QGenericUnixServices::openDocument(url); } } diff --git a/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration_p.h b/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration_p.h index 612cda43ef8..c5ceb6d5b47 100644 --- a/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration_p.h @@ -38,7 +38,7 @@ #include #include -#include +#include #include #include @@ -52,7 +52,7 @@ class QWaylandDisplay; class QWaylandWindowManagerIntegrationPrivate; -class Q_WAYLAND_CLIENT_EXPORT QWaylandWindowManagerIntegration : public QObject, public QPlatformServices, public QtWayland::qt_windowmanager +class Q_WAYLAND_CLIENT_EXPORT QWaylandWindowManagerIntegration : public QObject, public QGenericUnixServices, public QtWayland::qt_windowmanager { Q_OBJECT Q_DECLARE_PRIVATE(QWaylandWindowManagerIntegration) From 3636606b72d45f3c3a55e541b19df899f27fba84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Thu, 30 Jul 2015 14:53:35 +0200 Subject: [PATCH 0258/1507] Rework how we manage extensions Change-Id: If2cbf096e7419bc1bda007d5167ce39d1a5d50ae --- .../extensions/sub-surface-extension.xml | 2 +- .../platforms/wayland/qwaylanddisplay_p.h | 1 - src/tools/qtwaylandscanner/qtwaylandscanner.cpp | 17 ++++++++++++++++- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/src/3rdparty/wayland/extensions/sub-surface-extension.xml b/src/3rdparty/wayland/extensions/sub-surface-extension.xml index 4ea87e20319..54f5a589dab 100644 --- a/src/3rdparty/wayland/extensions/sub-surface-extension.xml +++ b/src/3rdparty/wayland/extensions/sub-surface-extension.xml @@ -47,7 +47,7 @@ - + diff --git a/src/plugins/platforms/wayland/qwaylanddisplay_p.h b/src/plugins/platforms/wayland/qwaylanddisplay_p.h index 96d79ddbd5a..62074bb75ac 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay_p.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay_p.h @@ -55,7 +55,6 @@ class QSocketNotifier; class QPlatformScreen; namespace QtWayland { - class qt_output_extension; class qt_shell; class qt_sub_surface_extension; class qt_surface_extension; diff --git a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp index 784687d2649..1945f64c8b2 100644 --- a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp +++ b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp @@ -370,6 +370,7 @@ void process(QXmlStreamReader &xml, const QByteArray &headerPath, const QByteArr printf("#include \n"); printf("#include \n"); printf("#include \n"); + printf("\n"); printf("\n"); printf("#ifndef WAYLAND_VERSION_CHECK\n"); @@ -381,7 +382,9 @@ void process(QXmlStreamReader &xml, const QByteArray &headerPath, const QByteArr printf("\n"); printf("QT_BEGIN_NAMESPACE\n"); - + printf("\n"); + printf("class QWaylandExtensionContainer;\n"); + printf("\n"); QByteArray serverExport; if (headerPath.size()) { serverExport = QByteArray("Q_WAYLAND_SERVER_") + preProcessorProtocolName + "_EXPORT"; @@ -446,6 +449,11 @@ void process(QXmlStreamReader &xml, const QByteArray &headerPath, const QByteArr printf("\n"); printf(" bool isGlobal() const { return m_global != 0; }\n"); printf(" bool isResource() const { return m_resource != 0; }\n"); + printf("\n"); + printf(" static const struct ::wl_interface *interface();\n"); + printf(" static QByteArray name() { return interface()->name; }\n"); + printf(" static int interfaceVersion() { return interface()->version; }\n"); + printf("\n"); printEnums(interface.enums); @@ -525,6 +533,7 @@ void process(QXmlStreamReader &xml, const QByteArray &headerPath, const QByteArr printf("#include \"qwayland-server-%s.h\"\n", QByteArray(protocolName).replace('_', '-').constData()); else printf("#include <%s/qwayland-server-%s.h>\n", headerPath.constData(), QByteArray(protocolName).replace('_', '-').constData()); + printf("#include \n"); printf("\n"); printf("QT_BEGIN_NAMESPACE\n"); printf("\n"); @@ -607,6 +616,12 @@ void process(QXmlStreamReader &xml, const QByteArray &headerPath, const QByteArr printf(" }\n"); printf("\n"); + printf(" const struct wl_interface *%s::interface()\n", interfaceName); + printf(" {\n"); + printf(" return &::%s_interface;\n", interfaceName); + printf(" }\n"); + printf("\n"); + printf(" %s::Resource *%s::%s_allocate()\n", interfaceName, interfaceName, interfaceNameStripped); printf(" {\n"); printf(" return new Resource;\n"); From 02f0ea8fc2c3e59ecdee30b940cd86af1d60002e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Fri, 8 May 2015 14:55:14 +0200 Subject: [PATCH 0259/1507] Improve QWaylandExtension By using curiously recurring template pattern we can generate a getter which is very convenient, and all QWaylandExtensions should have this casting operation Change-Id: Idb5a786655f2e106cf5388b11ed71e8b6ddddec0 --- src/tools/qtwaylandscanner/qtwaylandscanner.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp index 1945f64c8b2..78873c714fc 100644 --- a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp +++ b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp @@ -451,7 +451,7 @@ void process(QXmlStreamReader &xml, const QByteArray &headerPath, const QByteArr printf(" bool isResource() const { return m_resource != 0; }\n"); printf("\n"); printf(" static const struct ::wl_interface *interface();\n"); - printf(" static QByteArray name() { return interface()->name; }\n"); + printf(" static QByteArray interfaceName() { return interface()->name; }\n"); printf(" static int interfaceVersion() { return interface()->version; }\n"); printf("\n"); From bc14c870c8b137e96bebbecb34cdceba20da32da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Wed, 13 May 2015 09:37:04 +0200 Subject: [PATCH 0260/1507] Check if we have a shellSurface in the decoration Change-Id: I984163753791a640a99e182b55746f486c0a01cb --- src/plugins/platforms/wayland/qwaylandabstractdecoration.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandabstractdecoration.cpp b/src/plugins/platforms/wayland/qwaylandabstractdecoration.cpp index 54a990b2d71..3f9852b2071 100644 --- a/src/plugins/platforms/wayland/qwaylandabstractdecoration.cpp +++ b/src/plugins/platforms/wayland/qwaylandabstractdecoration.cpp @@ -129,7 +129,7 @@ void QWaylandAbstractDecoration::setMouseButtons(Qt::MouseButtons mb) void QWaylandAbstractDecoration::startResize(QWaylandInputDevice *inputDevice, enum wl_shell_surface_resize resize, Qt::MouseButtons buttons) { Q_D(QWaylandAbstractDecoration); - if (isLeftClicked(buttons)) { + if (isLeftClicked(buttons) && d->m_wayland_window->shellSurface()) { d->m_wayland_window->shellSurface()->resize(inputDevice, resize); inputDevice->removeMouseButtonFromState(Qt::LeftButton); } @@ -138,7 +138,7 @@ void QWaylandAbstractDecoration::startResize(QWaylandInputDevice *inputDevice, e void QWaylandAbstractDecoration::startMove(QWaylandInputDevice *inputDevice, Qt::MouseButtons buttons) { Q_D(QWaylandAbstractDecoration); - if (isLeftClicked(buttons)) { + if (isLeftClicked(buttons) && d->m_wayland_window->shellSurface()) { d->m_wayland_window->shellSurface()->move(inputDevice); inputDevice->removeMouseButtonFromState(Qt::LeftButton); } From 3aa93bb379f7b7793881b517ab39bdc398f53fef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Wed, 19 Aug 2015 10:24:14 +0200 Subject: [PATCH 0261/1507] Remove the qt_sub_surface extension Change-Id: I380590722f2c95ff68972f5b3c94a7cc4cfe016f --- .../extensions/sub-surface-extension.xml | 69 ------------------- src/plugins/platforms/wayland/client.pro | 1 - 2 files changed, 70 deletions(-) delete mode 100644 src/3rdparty/wayland/extensions/sub-surface-extension.xml diff --git a/src/3rdparty/wayland/extensions/sub-surface-extension.xml b/src/3rdparty/wayland/extensions/sub-surface-extension.xml deleted file mode 100644 index 54f5a589dab..00000000000 --- a/src/3rdparty/wayland/extensions/sub-surface-extension.xml +++ /dev/null @@ -1,69 +0,0 @@ - - - - Copyright (C) 2015 The Qt Company Ltd. - Contact: http://www.qt.io/licensing/ - - This file is part of the plugins of the Qt Toolkit. - - $QT_BEGIN_LICENSE:BSD$ - You may use this file under the terms of the BSD license as follows: - - "Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are - met: - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in - the documentation and/or other materials provided with the - distribution. - * Neither the name of The Qt Company Ltd nor the names of its - contributors may be used to endorse or promote products derived - from this software without specific prior written permission. - - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." - - $QT_END_LICENSE$ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/plugins/platforms/wayland/client.pro b/src/plugins/platforms/wayland/client.pro index ba17b21c57c..9ebd0352e21 100644 --- a/src/plugins/platforms/wayland/client.pro +++ b/src/plugins/platforms/wayland/client.pro @@ -45,7 +45,6 @@ INCLUDEPATH += $$PWD/../shared WAYLANDCLIENTSOURCES += \ ../3rdparty/protocol/wayland.xml \ ../extensions/surface-extension.xml \ - ../extensions/sub-surface-extension.xml \ ../extensions/touch-extension.xml \ ../extensions/qtkey-extension.xml \ ../extensions/windowmanager.xml \ From db75602d8022535af65f967e83cbac9e0d06cb47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Wed, 26 Aug 2015 17:08:59 +0200 Subject: [PATCH 0262/1507] Compilefix from Pauls high DPI changes Change-Id: I871cf93c690be2709d4fb6a1377f102c8d32e243 --- src/plugins/platforms/wayland/qwaylanddnd.cpp | 8 ++++---- src/plugins/platforms/wayland/qwaylanddnd_p.h | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylanddnd.cpp b/src/plugins/platforms/wayland/qwaylanddnd.cpp index 302864d4ba6..59f91411f03 100644 --- a/src/plugins/platforms/wayland/qwaylanddnd.cpp +++ b/src/plugins/platforms/wayland/qwaylanddnd.cpp @@ -89,15 +89,15 @@ void QWaylandDrag::cancel() m_display->currentInputDevice()->dataDevice()->cancelDrag(); } -void QWaylandDrag::move(const QMouseEvent *me) +void QWaylandDrag::move(const QPoint &globalPos) { - Q_UNUSED(me); + Q_UNUSED(globalPos); // Do nothing } -void QWaylandDrag::drop(const QMouseEvent *me) +void QWaylandDrag::drop(const QPoint &globalPos) { - Q_UNUSED(me); + Q_UNUSED(globalPos); // Do nothing } diff --git a/src/plugins/platforms/wayland/qwaylanddnd_p.h b/src/plugins/platforms/wayland/qwaylanddnd_p.h index 994c65c4504..263cdf3b36b 100644 --- a/src/plugins/platforms/wayland/qwaylanddnd_p.h +++ b/src/plugins/platforms/wayland/qwaylanddnd_p.h @@ -63,8 +63,8 @@ public: protected: void startDrag() Q_DECL_OVERRIDE; void cancel() Q_DECL_OVERRIDE; - void move(const QMouseEvent *me) Q_DECL_OVERRIDE; - void drop(const QMouseEvent *me) Q_DECL_OVERRIDE; + void move(const QPoint &globalPos) Q_DECL_OVERRIDE; + void drop(const QPoint &globalPos) Q_DECL_OVERRIDE; void endDrag() Q_DECL_OVERRIDE; From 23dbf7126530d6c6bf1da7b79ea76b35bd60281d Mon Sep 17 00:00:00 2001 From: Philippe Coval Date: Fri, 26 Jun 2015 11:16:56 +0200 Subject: [PATCH 0263/1507] xdg-shell: upgrade to support current version (weston-1.8.0) Handle transition from Normal to Maximize then Fullscreen and back to Maximized. Avoid to maximize if no requested size The protocol file is a raw copy of Source: http://cgit.freedesktop.org/wayland/weston/plain/protocol/xdg-shell.xml?id=1.8.0 Minor Nitpick fixes (arrays of bytes, conditionnal or test, c++ function call) Task-number: QTBUG-47327 Change-Id: Ib508e2166cc1337fd93454f30814136839cffa29 Reviewed-by: Giulio Camuffo --- src/3rdparty/wayland/protocols/xdg-shell.xml | 365 +++++++++++++----- .../platforms/wayland/qwaylandxdgsurface.cpp | 23 +- 2 files changed, 279 insertions(+), 109 deletions(-) diff --git a/src/3rdparty/wayland/protocols/xdg-shell.xml b/src/3rdparty/wayland/protocols/xdg-shell.xml index 275837f3dc0..44a3a12cb5d 100644 --- a/src/3rdparty/wayland/protocols/xdg-shell.xml +++ b/src/3rdparty/wayland/protocols/xdg-shell.xml @@ -31,11 +31,10 @@ - This interface is implemented by servers that provide - desktop-style user interfaces. - - It allows clients to associate a xdg_surface with - a basic surface. + xdg_shell allows clients to turn a wl_surface into a "real window" + which can be dragged, resized, stacked, and moved around by the + user. Everything about this interface is suited towards traditional + desktop environments. @@ -45,9 +44,25 @@ they implement using static_assert to ensure the protocol and implementation versions match. - + + + + + + + + + + + Destroy this xdg_shell object. + + Destroying a bound xdg_shell object while there are surfaces + still alive created by this xdg_shell object instance is illegal + and will result in a protocol error. + + @@ -62,30 +77,40 @@ - Create a shell surface for an existing surface. + This creates an xdg_surface for the given surface and gives it the + xdg_surface role. A wl_surface can only be given an xdg_surface role + once. If get_xdg_surface is called with a wl_surface that already has + an active xdg_surface associated with it, or if it had any other role, + an error is raised. - Only one shell or popup surface can be associated with a given - surface. + See the documentation of xdg_surface for more details about what an + xdg_surface is and how it is used. - - Create a popup surface for an existing surface. + + This creates an xdg_popup for the given surface and gives it the + xdg_popup role. A wl_surface can only be given an xdg_popup role + once. If get_xdg_popup is called with a wl_surface that already has + an active xdg_popup associated with it, or if it had any other role, + an error is raised. - Only one shell or popup surface can be associated with a given - surface. + This request must be used in response to some sort of user action + like a button press, key press, or touch down event. + + See the documentation of xdg_popup for more details about what an + xdg_popup is and how it is used. - - + + - @@ -98,8 +123,11 @@ alive. It's unspecified what will happen if the client doesn't respond to the ping request, or in what timeframe. Clients should try to respond in a reasonable amount of time. + + A compositor is free to ping in any way it wants, but a client must + always respond to any xdg_shell object it created. - + @@ -112,8 +140,7 @@ - - + An interface that may be implemented by a wl_surface, for implementations that provide a desktop-style user interface. @@ -121,29 +148,39 @@ properties like maximized, fullscreen, minimized, and to move and resize them, and associate metadata like title and app id. - On the server side the object is automatically destroyed when - the related wl_surface is destroyed. On client side, - xdg_surface.destroy() must be called before destroying - the wl_surface object. + The client must call wl_surface.commit on the corresponding wl_surface + for the xdg_surface state to take effect. Prior to committing the new + state, it can set up initial configuration, such as maximizing or setting + a window geometry. + + Even without attaching a buffer the compositor must respond to initial + committed configuration, for instance sending a configure event with + expected window geometry if the client maximized its surface during + initialization. + + For a surface to be mapped by the compositor the client must have + committed both an xdg_surface state and a buffer. - - The xdg_surface interface is removed from the wl_surface object - that was turned into a xdg_surface with - xdg_shell.get_xdg_surface request. The xdg_surface properties, - like maximized and fullscreen, are lost. The wl_surface loses - its role as a xdg_surface. The wl_surface is unmapped. + + Unmap and destroy the window. The window will be effectively + hidden from the user's point of view, and all state like + maximization, fullscreen, and so on, will be lost. - - Child surfaces are stacked above their parents, and will be - unmapped if the parent is unmapped too. They should not appear - on task bars and alt+tab. + + Set the "parent" of this surface. This window should be stacked + above a parent. The parent surface must be mapped as long as this + surface is mapped. + + Parent windows should be set on dialogs, toolboxes, or other + "auxiliary" surfaces, so that the parent is raised when the dialog + is raised. - + @@ -160,14 +197,27 @@ - - Set an id for the surface. + + Set an application identifier for the surface. - The app id identifies the general class of applications to which - the surface belongs. + The app ID identifies the general class of applications to which + the surface belongs. The compositor can use this to group multiple + surfaces together, or to determine how to launch a new application. - It should be the ID that appears in the new desktop entry - specification, the interface name. + For D-Bus activatable applications, the app ID is used as the D-Bus + service name. + + The compositor shell will try to group application surfaces together + by their app ID. As a best practice, it is suggested to select app + ID's that match the basename of the application's .desktop file. + For example, "org.freedesktop.FooViewer" where the .desktop file is + "org.freedesktop.FooViewer.desktop". + + See the desktop-entry specification [0] for more details on + application identifiers and how they relate to well-known D-Bus + names and .desktop files. + + [0] http://standards.freedesktop.org/desktop-entry-spec/ @@ -179,29 +229,32 @@ user a menu that they can use to maximize or minimize the window. This request asks the compositor to pop up such a window menu at - the given position, relative to the parent surface. There are - no guarantees as to what the window menu contains. + the given position, relative to the local surface coordinates of + the parent surface. There are no guarantees as to what menu items + the window menu contains. - Your surface must have focus on the seat passed in to pop up the - window menu. + This request must be used in response to some sort of user action + like a button press, key press, or touch down event. - - + + - Start a pointer-driven move of the surface. + Start an interactive, user-driven move of the surface. + + This request must be used in response to some sort of user action + like a button press, key press, or touch down event. - This request must be used in response to a button press event. The server may ignore move requests depending on the state of the surface (e.g. fullscreen or maximized). - - + + @@ -224,14 +277,16 @@ - Start a pointer-driven resizing of the surface. + Start a user-driven, interactive resize of the surface. + + This request must be used in response to some sort of user action + like a button press, key press, or touch down event. - This request must be used in response to a button press event. The server may ignore resize requests depending on the state of the surface (e.g. fullscreen or maximized). - - + + @@ -279,16 +334,26 @@ - The configure event asks the client to resize its surface. + The configure event asks the client to resize its surface or to + change its state. The width and height arguments specify a hint to the window - about how its surface should be resized in window geometry - coordinates. The states listed in the event specify how the - width/height arguments should be interpreted. + about how its surface should be resized in window geometry + coordinates. See set_window_geometry. - A client should arrange a new surface, and then send a - ack_configure request with the serial sent in this configure - event before attaching a new surface. + If the width or height arguments are zero, it means the client + should decide its own window dimension. This may happen when the + compositor need to configure the state of the surface but doesn't + have any information about any previous or expected dimension. + + The states listed in the event specify how the width/height + arguments should be interpreted, and possibly how it should be + drawn. + + Clients should arrange their surface for the new size and + states, and then send a ack_configure request with the serial + sent in this configure event at some point before committing + the new surface. If the client receives multiple configure events before it can respond to one, it is free to discard all but the last @@ -303,14 +368,19 @@ - When a configure event is received, a client should then ack it - using the ack_configure request to ensure that the compositor - knows the client has seen the event. + When a configure event is received, if a client commits the + surface in response to the configure event, then the client + must make a ack_configure request before the commit request, + passing along the serial of the configure event. - By this point, the state is confirmed, and the next attach should - contain the buffer drawn for the configure event you are acking. + For instance, the compositor might use this information to move + a surface to the top left only when the client has drawn itself + for the maximized or fullscreen state. + + If the client receives multiple configure events before it + can respond to one, it only has to ack the last configure event. - + @@ -320,15 +390,26 @@ portions like drop-shadows which should be ignored for the purposes of aligning, placing and constraining windows. - The default value is the full bounds of the surface, including any - subsurfaces. Once the window geometry of the surface is set once, - it is not possible to unset it, and it will remain the same until + The window geometry is double buffered, and will be applied at the + time wl_surface.commit of the corresponding wl_surface is called. + + Once the window geometry of the surface is set once, it is not + possible to unset it, and it will remain the same until set_window_geometry is called again, even if a new subsurface or buffer is attached. + If never set, the value is the full bounds of the surface, + including any subsurfaces. This updates dynamically on every + commit. This unset mode is meant for extremely simple clients. + If responding to a configure event, the window geometry in here must respect the sizing negotiations specified by the states in the configure event. + + The arguments are given in the surface local coordinate space of + the wl_surface associated with this xdg_surface. + + The width and height must be greater than zero. @@ -336,8 +417,48 @@ - - + + + Maximize the surface. + + After requesting that the surface should be maximized, the compositor + will respond by emitting a configure event with the "maximized" state + and the required window geometry. The client should then update its + content, drawing it in a maximized state, i.e. without shadow or other + decoration outside of the window geometry. The client must also + acknowledge the configure when committing the new content (see + ack_configure). + + It is up to the compositor to decide how and where to maximize the + surface, for example which output and what region of the screen should + be used. + + If the surface was already maximized, the compositor will still emit + a configure event with the "maximized" state. + + + + + + Unmaximize the surface. + + After requesting that the surface should be unmaximized, the compositor + will respond by emitting a configure event without the "maximized" + state. If available, the compositor will include the window geometry + dimensions the window had prior to being maximized in the configure + request. The client must then update its content, drawing it in a + regular state, i.e. potentially with shadow, etc. The client must also + acknowledge the configure when committing the new content (see + ack_configure). + + It is up to the compositor to position the surface after it was + unmaximized; usually the position the surface had before maximizing, if + applicable. + + If the surface was already not maximized, the compositor will still + emit a configure event without the "maximized" state. + + @@ -346,12 +467,27 @@ You can specify an output that you would prefer to be fullscreen. If this value is NULL, it's up to the compositor to choose which display will be used to map this surface. + + If the surface doesn't cover the whole output, the compositor will + position the surface in the center of the output and compensate with + black borders filling the rest of the output. - + + + Request that the compositor minimize your surface. There is no + way to know if the surface is currently minimized, nor is there + any way to unset minimization on this surface. + + If you are looking to throttle redrawing when minimized, please + instead use the wl_surface.frame event for this, as this will + also work with live previews on windows in Alt-Tab, Expose or + similar compositor features. + + @@ -368,45 +504,76 @@ - - An interface that may be implemented by a wl_surface, for - implementations that provide a desktop-style popups/menus. A popup - surface is a transient surface with an added pointer grab. + + A popup surface is a short-lived, temporary surface that can be + used to implement menus. It takes an explicit grab on the surface + that will be dismissed when the user dismisses the popup. This can + be done by the user clicking outside the surface, using the keyboard, + or even locking the screen through closing the lid or a timeout. - An existing implicit grab will be changed to owner-events mode, - and the popup grab will continue after the implicit grab ends - (i.e. releasing the mouse button does not cause the popup to be - unmapped). + When the popup is dismissed, a popup_done event will be sent out, + and at the same time the surface will be unmapped. The xdg_popup + object is now inert and cannot be reactivated, so clients should + destroy it. Explicitly destroying the xdg_popup object will also + dismiss the popup and unmap the surface. - The popup grab continues until the window is destroyed or a mouse - button is pressed in any other clients window. A click in any of - the clients surfaces is reported as normal, however, clicks in - other clients surfaces will be discarded and trigger the callback. + Clients will receive events for all their surfaces during this + grab (which is an "owner-events" grab in X11 parlance). This is + done so that users can navigate through submenus and other + "nested" popup windows without having to dismiss the topmost + popup. - The x and y arguments specify the locations of the upper left - corner of the surface relative to the upper left corner of the - parent surface, in surface local coordinates. + Clients that want to dismiss the popup when another surface of + their own is clicked should dismiss the popup using the destroy + request. - xdg_popup surfaces are always transient for another surface. + The parent surface must have either an xdg_surface or xdg_popup + role. + + Specifying an xdg_popup for the parent means that the popups are + nested, with this popup now being the topmost popup. Nested + popups must be destroyed in the reverse order they were created + in, e.g. the only popup you are allowed to destroy at all times + is the topmost one. + + If there is an existing popup when creating a new popup, the + parent must be the current topmost popup. + + A parent surface must be mapped before the new popup is mapped. + + When compositors choose to dismiss a popup, they will likely + dismiss every nested popup as well. When a compositor dismisses + popups, it will follow the same dismissing order as required + from the client. + + The x and y arguments passed when creating the popup object specify + where the top left of the popup should be placed, relative to the + local surface coordinates of the parent surface. See + xdg_shell.get_xdg_popup. + + The client must call wl_surface.commit on the corresponding wl_surface + for the xdg_popup state to take effect. + + For a surface to be mapped by the compositor the client must have + committed both the xdg_popup state and a buffer. - - The xdg_surface interface is removed from the wl_surface object - that was turned into a xdg_surface with - xdg_shell.get_xdg_surface request. The xdg_surface properties, - like maximized and fullscreen, are lost. The wl_surface loses - its role as a xdg_surface. The wl_surface is unmapped. + + This destroys the popup. Explicitly destroying the xdg_popup + object will also dismiss the popup, and unmap the surface. + + If this xdg_popup is not the "topmost" popup, a protocol error + will be sent. - The popup_done event is sent out when a popup grab is broken, - that is, when the users clicks a surface that doesn't belong - to the client owning the popup surface. + The popup_done event is sent out when a popup is dismissed by the + compositor. The client should destroy the xdg_popup object at this + point. - diff --git a/src/plugins/platforms/wayland/qwaylandxdgsurface.cpp b/src/plugins/platforms/wayland/qwaylandxdgsurface.cpp index f06d7e35391..fd8368951fc 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgsurface.cpp +++ b/src/plugins/platforms/wayland/qwaylandxdgsurface.cpp @@ -56,6 +56,7 @@ QWaylandXdgSurface::QWaylandXdgSurface(struct ::xdg_surface *xdg_surface, QWayla { if (window->display()->windowExtension()) m_extendedWindow = new QWaylandExtendedSurface(window); + m_size = m_window->window()->geometry().size(); } QWaylandXdgSurface::~QWaylandXdgSurface() @@ -126,8 +127,8 @@ void QWaylandXdgSurface::updateTransientParent(QWindow *parent) QWaylandWindow *parent_wayland_window = static_cast(parent->handle()); if (!parent_wayland_window) return; - - set_parent(parent_wayland_window->object()); + QtWayland::xdg_shell *shell = parent_wayland_window->display()->shellXdg(); + set_parent(shell->get_xdg_surface(parent_wayland_window->object())); } void QWaylandXdgSurface::setTitle(const QString & title) @@ -178,11 +179,11 @@ void QWaylandXdgSurface::xdg_surface_configure(int32_t width, int32_t height, st state = (uint32_t*) states->data; - for (uint32_t i=0; i < states->size; i++) + for (uint32_t i = 0; i < states->size / sizeof(state) ; i++) { switch (*(state+i)) { case XDG_SURFACE_STATE_MAXIMIZED: - aboutToMaximize = true; + aboutToMaximize = ((width > 0) && (height > 0)); break; case XDG_SURFACE_STATE_FULLSCREEN: aboutToFullScreen = true; @@ -191,7 +192,7 @@ void QWaylandXdgSurface::xdg_surface_configure(int32_t width, int32_t height, st m_margins = m_window->frameMargins(); width -= m_margins.left() + m_margins.right(); height -= m_margins.top() + m_margins.bottom(); - m_size = QSize(width,height); + m_size = m_window->window()->geometry().size(); break; case XDG_SURFACE_STATE_ACTIVATED: // TODO: here about the missing window activation @@ -203,21 +204,23 @@ void QWaylandXdgSurface::xdg_surface_configure(int32_t width, int32_t height, st if (!m_fullscreen && aboutToFullScreen) { m_fullscreen = true; - m_size = m_window->window()->geometry().size(); m_window->window()->showFullScreen(); } else if (m_fullscreen && !aboutToFullScreen) { m_fullscreen = false; - m_window->window()->showNormal(); + if ( m_maximized ) { + m_window->window()->showMaximized(); + } else { + m_window->window()->showNormal(); + } } else if (!m_maximized && aboutToMaximize) { m_maximized = true; - m_size = m_window->window()->geometry().size(); m_window->window()->showMaximized(); } else if (m_maximized && !aboutToMaximize) { m_maximized = false; m_window->window()->showNormal(); } - if (width == 0 && height == 0) { + if (width == 0 || height == 0) { width = m_size.width(); height = m_size.height(); } @@ -227,7 +230,7 @@ void QWaylandXdgSurface::xdg_surface_configure(int32_t width, int32_t height, st m_window->configure(0, width + m_margins.left() + m_margins.right(), height + m_margins.top() + m_margins.bottom()); } - xdg_surface_ack_configure(object(), serial); + ack_configure(serial); } void QWaylandXdgSurface::xdg_surface_close() From 6f3dc689d7ee17adf74341392c06b9876fc454a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Thu, 3 Sep 2015 16:47:51 +0200 Subject: [PATCH 0264/1507] Set default size if a QWindow has no geometry also extract two lines out of conditional branches Change-Id: I2d4a5f6dd357d84df43acc0082f9621fb6609768 --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index a54979a2f85..33d13d775fc 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -169,7 +169,10 @@ void QWaylandWindow::initWindow() if (QScreen *s = window()->screen()) setOrientationMask(s->orientationUpdateMask()); setWindowFlags(window()->flags()); - setGeometry_helper(window()->geometry()); + if (window()->geometry().isEmpty()) + setGeometry_helper(QRect(QPoint(), QSize(500,500))); + else + setGeometry_helper(window()->geometry()); setMask(window()->mask()); setWindowStateInternal(window()->windowState()); handleContentOrientationChange(window()->contentOrientation()); @@ -385,11 +388,10 @@ void QWaylandWindow::setCanResize(bool canResize) } if (!mConfigure.isEmpty()) { doResize(); - QWindowSystemInterface::handleExposeEvent(window(), QRect(QPoint(), geometry().size())); } else if (mResizeDirty) { - QWindowSystemInterface::handleExposeEvent(window(), QRect(QPoint(), geometry().size())); mResizeDirty = false; } + QWindowSystemInterface::handleExposeEvent(window(), QRect(QPoint(), geometry().size())); } } From 7c93b46a03ef0629aa1589bf816478bd2b25c2fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Fri, 4 Sep 2015 12:25:56 +0200 Subject: [PATCH 0265/1507] Add an assert in QtWaylandScanner for duplicate binds Since Q_SIGNALS are a one -> many distribution we can end up signalling creation requests to many slots. Its then important that we verify that only one of these actually binds an object for the object id. Its a programming error to have this situation, hence its an assert, and not a runtime check that gives a warning. The bind will overwrite the object and the last bind will continue to work as normal in release mode. Change-Id: I1f469066cf5287789249763843e6cbaa545ee619 --- src/tools/qtwaylandscanner/qtwaylandscanner.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp index 78873c714fc..6d602ad08df 100644 --- a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp +++ b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp @@ -666,6 +666,7 @@ void process(QXmlStreamReader &xml, const QByteArray &headerPath, const QByteArr //and use function overloading instead. Jan do you have a lot of code dependent on this behavior? printf(" %s::Resource *%s::bind(struct ::wl_client *client, uint32_t id, int version)\n", interfaceName, interfaceName); printf(" {\n"); + printf(" Q_ASSERT_X(!wl_client_get_object(client, id), \"QWaylandObject bind\", QStringLiteral(\"binding to object %1 more than once\").arg(id).toLocal8Bit().constData());\n"); printf(" Resource *resource = %s_allocate();\n", interfaceNameStripped); printf(" resource->%s_object = this;\n", interfaceNameStripped); printf("\n"); From 69d1793472b070abeb1edcc3d2bc72b2acfb0201 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Mon, 7 Sep 2015 14:04:17 +0200 Subject: [PATCH 0266/1507] Rename QtCompositor to QtWaylandCompositor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit enable building QtWaylandCompositor by default Change-Id: I7cf34052b304ca9fef55b7e30ef6a6367b5d75f1 Reviewed-by: Jørgen Lind --- src/tools/qtwaylandscanner/qtwaylandscanner.cpp | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp index 6d602ad08df..131c5ca7de0 100644 --- a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp +++ b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp @@ -370,7 +370,6 @@ void process(QXmlStreamReader &xml, const QByteArray &headerPath, const QByteArr printf("#include \n"); printf("#include \n"); printf("#include \n"); - printf("\n"); printf("\n"); printf("#ifndef WAYLAND_VERSION_CHECK\n"); @@ -382,9 +381,6 @@ void process(QXmlStreamReader &xml, const QByteArray &headerPath, const QByteArr printf("\n"); printf("QT_BEGIN_NAMESPACE\n"); - printf("\n"); - printf("class QWaylandExtensionContainer;\n"); - printf("\n"); QByteArray serverExport; if (headerPath.size()) { serverExport = QByteArray("Q_WAYLAND_SERVER_") + preProcessorProtocolName + "_EXPORT"; @@ -533,7 +529,6 @@ void process(QXmlStreamReader &xml, const QByteArray &headerPath, const QByteArr printf("#include \"qwayland-server-%s.h\"\n", QByteArray(protocolName).replace('_', '-').constData()); else printf("#include <%s/qwayland-server-%s.h>\n", headerPath.constData(), QByteArray(protocolName).replace('_', '-').constData()); - printf("#include \n"); printf("\n"); printf("QT_BEGIN_NAMESPACE\n"); printf("\n"); From 9fa8f84f0baad883643e5f9da154381775e49011 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Mon, 7 Sep 2015 15:41:48 +0200 Subject: [PATCH 0267/1507] Fix % warning when using generated files MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Ib7857743140d9f2dfa5bf1ff2187af8f3e2478da Reviewed-by: Jørgen Lind --- src/tools/qtwaylandscanner/qtwaylandscanner.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp index 131c5ca7de0..0c8f91b6206 100644 --- a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp +++ b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp @@ -661,7 +661,7 @@ void process(QXmlStreamReader &xml, const QByteArray &headerPath, const QByteArr //and use function overloading instead. Jan do you have a lot of code dependent on this behavior? printf(" %s::Resource *%s::bind(struct ::wl_client *client, uint32_t id, int version)\n", interfaceName, interfaceName); printf(" {\n"); - printf(" Q_ASSERT_X(!wl_client_get_object(client, id), \"QWaylandObject bind\", QStringLiteral(\"binding to object %1 more than once\").arg(id).toLocal8Bit().constData());\n"); + printf(" Q_ASSERT_X(!wl_client_get_object(client, id), \"QWaylandObject bind\", QStringLiteral(\"binding to object %%1 more than once\").arg(id).toLocal8Bit().constData());\n"); printf(" Resource *resource = %s_allocate();\n", interfaceNameStripped); printf(" resource->%s_object = this;\n", interfaceNameStripped); printf("\n"); From 65847be1becc89bce04c28c3ae57f9f9f05c1396 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Wed, 9 Sep 2015 10:00:53 +0200 Subject: [PATCH 0268/1507] Fix sending exposeevents on all swapbuffers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In Change-Id: I2d4a5f6dd357d84df43acc0082f9621fb6609768 I extracted a call to handleExposeEvent from a if statement. I failed to see that the else condition also had an if statement. Change-Id: Ie51c5f918a4e4ddaec9e75c9c3afffa962d2bd06 Reviewed-by: Jørgen Lind --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 33d13d775fc..762ef501a98 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -388,10 +388,11 @@ void QWaylandWindow::setCanResize(bool canResize) } if (!mConfigure.isEmpty()) { doResize(); + QWindowSystemInterface::handleExposeEvent(window(), QRect(QPoint(), geometry().size())); } else if (mResizeDirty) { mResizeDirty = false; + QWindowSystemInterface::handleExposeEvent(window(), QRect(QPoint(), geometry().size())); } - QWindowSystemInterface::handleExposeEvent(window(), QRect(QPoint(), geometry().size())); } } From 38e4f03cf84f6c993b1a813360e4fab03843ed3f Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 15 Sep 2015 13:23:12 +0200 Subject: [PATCH 0269/1507] QWaylandXdgSurface/QWaylandWlShellSurface: Fix warnings about CT initialization order. qwaylandxdgsurface.cpp: In constructor 'QtWaylandClient::QWaylandXdgSurface::QWaylandXdgSurface(xdg_surface*, QtWaylandClient::QWaylandWindow*)': qwaylandxdgsurface.cpp:55:31: warning: base 'QtWayland::xdg_surface' will be initialized after [-Wreorder] qwaylandxdgsurface.cpp:55:31: warning: base 'QtWaylandClient::QWaylandShellSurface' [-Wreorder] qwaylandxdgsurface.cpp:48:1: warning: when initialized here [-Wreorder] qwaylandwlshellsurface.cpp: In constructor 'QtWaylandClient::QWaylandWlShellSurface::QWaylandWlShellSurface(wl_shell_surface*, QtWaylandClient::QWaylandWindow*)': qwaylandwlshellsurface.cpp:55:31: warning: base 'QtWayland::wl_shell_surface' will be initialized after [-Wreorder] qwaylandwlshellsurface.cpp:55:31: warning: base 'QtWaylandClient::QWaylandShellSurface' [-Wreorder] qwaylandwlshellsurface.cpp:49:1: warning: when initialized here [-Wreorder] Change-Id: If7ed49fa6f788db7407b5ee82aa252e19e2d4747 Reviewed-by: Giulio Camuffo --- src/plugins/platforms/wayland/qwaylandwlshellsurface.cpp | 4 ++-- src/plugins/platforms/wayland/qwaylandxdgsurface.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandwlshellsurface.cpp b/src/plugins/platforms/wayland/qwaylandwlshellsurface.cpp index f7bdc2c99fc..7235931d3bc 100644 --- a/src/plugins/platforms/wayland/qwaylandwlshellsurface.cpp +++ b/src/plugins/platforms/wayland/qwaylandwlshellsurface.cpp @@ -47,8 +47,8 @@ QT_BEGIN_NAMESPACE namespace QtWaylandClient { QWaylandWlShellSurface::QWaylandWlShellSurface(struct ::wl_shell_surface *shell_surface, QWaylandWindow *window) - : QtWayland::wl_shell_surface(shell_surface) - , QWaylandShellSurface(window) + : QWaylandShellSurface(window) + , QtWayland::wl_shell_surface(shell_surface) , m_window(window) , m_maximized(false) , m_fullscreen(false) diff --git a/src/plugins/platforms/wayland/qwaylandxdgsurface.cpp b/src/plugins/platforms/wayland/qwaylandxdgsurface.cpp index f06d7e35391..396fa332e41 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgsurface.cpp +++ b/src/plugins/platforms/wayland/qwaylandxdgsurface.cpp @@ -46,8 +46,8 @@ QT_BEGIN_NAMESPACE namespace QtWaylandClient { QWaylandXdgSurface::QWaylandXdgSurface(struct ::xdg_surface *xdg_surface, QWaylandWindow *window) - : QtWayland::xdg_surface(xdg_surface) - , QWaylandShellSurface(window) + : QWaylandShellSurface(window) + , QtWayland::xdg_surface(xdg_surface) , m_window(window) , m_maximized(false) , m_minimized(false) From b975ab4b854bd9f8af3fffef7f102fd95f02417c Mon Sep 17 00:00:00 2001 From: Philippe Coval Date: Fri, 26 Jun 2015 11:16:56 +0200 Subject: [PATCH 0270/1507] xdg-shell: upgrade to support current version (weston-1.8.0) Handle transition from Normal to Maximize then Fullscreen and back to Maximized. Avoid to maximize if no requested size The protocol file is a raw copy of Source: http://cgit.freedesktop.org/wayland/weston/plain/protocol/xdg-shell.xml?id=1.8.0 Minor Nitpick fixes (arrays of bytes, conditionnal or test, c++ function call) Task-number: QTBUG-47327 Change-Id: Ib508e2166cc1337fd93454f30814136839cffa29 (cherry picked from commit 6906a6445c0cbf9d11f8d5d32b181f558a2292c9) Reviewed-by: Giulio Camuffo --- src/3rdparty/wayland/protocols/xdg-shell.xml | 365 +++++++++++++----- .../platforms/wayland/qwaylandxdgsurface.cpp | 23 +- 2 files changed, 279 insertions(+), 109 deletions(-) diff --git a/src/3rdparty/wayland/protocols/xdg-shell.xml b/src/3rdparty/wayland/protocols/xdg-shell.xml index 275837f3dc0..44a3a12cb5d 100644 --- a/src/3rdparty/wayland/protocols/xdg-shell.xml +++ b/src/3rdparty/wayland/protocols/xdg-shell.xml @@ -31,11 +31,10 @@ - This interface is implemented by servers that provide - desktop-style user interfaces. - - It allows clients to associate a xdg_surface with - a basic surface. + xdg_shell allows clients to turn a wl_surface into a "real window" + which can be dragged, resized, stacked, and moved around by the + user. Everything about this interface is suited towards traditional + desktop environments. @@ -45,9 +44,25 @@ they implement using static_assert to ensure the protocol and implementation versions match. - + + + + + + + + + + + Destroy this xdg_shell object. + + Destroying a bound xdg_shell object while there are surfaces + still alive created by this xdg_shell object instance is illegal + and will result in a protocol error. + + @@ -62,30 +77,40 @@ - Create a shell surface for an existing surface. + This creates an xdg_surface for the given surface and gives it the + xdg_surface role. A wl_surface can only be given an xdg_surface role + once. If get_xdg_surface is called with a wl_surface that already has + an active xdg_surface associated with it, or if it had any other role, + an error is raised. - Only one shell or popup surface can be associated with a given - surface. + See the documentation of xdg_surface for more details about what an + xdg_surface is and how it is used. - - Create a popup surface for an existing surface. + + This creates an xdg_popup for the given surface and gives it the + xdg_popup role. A wl_surface can only be given an xdg_popup role + once. If get_xdg_popup is called with a wl_surface that already has + an active xdg_popup associated with it, or if it had any other role, + an error is raised. - Only one shell or popup surface can be associated with a given - surface. + This request must be used in response to some sort of user action + like a button press, key press, or touch down event. + + See the documentation of xdg_popup for more details about what an + xdg_popup is and how it is used. - - + + - @@ -98,8 +123,11 @@ alive. It's unspecified what will happen if the client doesn't respond to the ping request, or in what timeframe. Clients should try to respond in a reasonable amount of time. + + A compositor is free to ping in any way it wants, but a client must + always respond to any xdg_shell object it created. - + @@ -112,8 +140,7 @@ - - + An interface that may be implemented by a wl_surface, for implementations that provide a desktop-style user interface. @@ -121,29 +148,39 @@ properties like maximized, fullscreen, minimized, and to move and resize them, and associate metadata like title and app id. - On the server side the object is automatically destroyed when - the related wl_surface is destroyed. On client side, - xdg_surface.destroy() must be called before destroying - the wl_surface object. + The client must call wl_surface.commit on the corresponding wl_surface + for the xdg_surface state to take effect. Prior to committing the new + state, it can set up initial configuration, such as maximizing or setting + a window geometry. + + Even without attaching a buffer the compositor must respond to initial + committed configuration, for instance sending a configure event with + expected window geometry if the client maximized its surface during + initialization. + + For a surface to be mapped by the compositor the client must have + committed both an xdg_surface state and a buffer. - - The xdg_surface interface is removed from the wl_surface object - that was turned into a xdg_surface with - xdg_shell.get_xdg_surface request. The xdg_surface properties, - like maximized and fullscreen, are lost. The wl_surface loses - its role as a xdg_surface. The wl_surface is unmapped. + + Unmap and destroy the window. The window will be effectively + hidden from the user's point of view, and all state like + maximization, fullscreen, and so on, will be lost. - - Child surfaces are stacked above their parents, and will be - unmapped if the parent is unmapped too. They should not appear - on task bars and alt+tab. + + Set the "parent" of this surface. This window should be stacked + above a parent. The parent surface must be mapped as long as this + surface is mapped. + + Parent windows should be set on dialogs, toolboxes, or other + "auxiliary" surfaces, so that the parent is raised when the dialog + is raised. - + @@ -160,14 +197,27 @@ - - Set an id for the surface. + + Set an application identifier for the surface. - The app id identifies the general class of applications to which - the surface belongs. + The app ID identifies the general class of applications to which + the surface belongs. The compositor can use this to group multiple + surfaces together, or to determine how to launch a new application. - It should be the ID that appears in the new desktop entry - specification, the interface name. + For D-Bus activatable applications, the app ID is used as the D-Bus + service name. + + The compositor shell will try to group application surfaces together + by their app ID. As a best practice, it is suggested to select app + ID's that match the basename of the application's .desktop file. + For example, "org.freedesktop.FooViewer" where the .desktop file is + "org.freedesktop.FooViewer.desktop". + + See the desktop-entry specification [0] for more details on + application identifiers and how they relate to well-known D-Bus + names and .desktop files. + + [0] http://standards.freedesktop.org/desktop-entry-spec/ @@ -179,29 +229,32 @@ user a menu that they can use to maximize or minimize the window. This request asks the compositor to pop up such a window menu at - the given position, relative to the parent surface. There are - no guarantees as to what the window menu contains. + the given position, relative to the local surface coordinates of + the parent surface. There are no guarantees as to what menu items + the window menu contains. - Your surface must have focus on the seat passed in to pop up the - window menu. + This request must be used in response to some sort of user action + like a button press, key press, or touch down event. - - + + - Start a pointer-driven move of the surface. + Start an interactive, user-driven move of the surface. + + This request must be used in response to some sort of user action + like a button press, key press, or touch down event. - This request must be used in response to a button press event. The server may ignore move requests depending on the state of the surface (e.g. fullscreen or maximized). - - + + @@ -224,14 +277,16 @@ - Start a pointer-driven resizing of the surface. + Start a user-driven, interactive resize of the surface. + + This request must be used in response to some sort of user action + like a button press, key press, or touch down event. - This request must be used in response to a button press event. The server may ignore resize requests depending on the state of the surface (e.g. fullscreen or maximized). - - + + @@ -279,16 +334,26 @@ - The configure event asks the client to resize its surface. + The configure event asks the client to resize its surface or to + change its state. The width and height arguments specify a hint to the window - about how its surface should be resized in window geometry - coordinates. The states listed in the event specify how the - width/height arguments should be interpreted. + about how its surface should be resized in window geometry + coordinates. See set_window_geometry. - A client should arrange a new surface, and then send a - ack_configure request with the serial sent in this configure - event before attaching a new surface. + If the width or height arguments are zero, it means the client + should decide its own window dimension. This may happen when the + compositor need to configure the state of the surface but doesn't + have any information about any previous or expected dimension. + + The states listed in the event specify how the width/height + arguments should be interpreted, and possibly how it should be + drawn. + + Clients should arrange their surface for the new size and + states, and then send a ack_configure request with the serial + sent in this configure event at some point before committing + the new surface. If the client receives multiple configure events before it can respond to one, it is free to discard all but the last @@ -303,14 +368,19 @@ - When a configure event is received, a client should then ack it - using the ack_configure request to ensure that the compositor - knows the client has seen the event. + When a configure event is received, if a client commits the + surface in response to the configure event, then the client + must make a ack_configure request before the commit request, + passing along the serial of the configure event. - By this point, the state is confirmed, and the next attach should - contain the buffer drawn for the configure event you are acking. + For instance, the compositor might use this information to move + a surface to the top left only when the client has drawn itself + for the maximized or fullscreen state. + + If the client receives multiple configure events before it + can respond to one, it only has to ack the last configure event. - + @@ -320,15 +390,26 @@ portions like drop-shadows which should be ignored for the purposes of aligning, placing and constraining windows. - The default value is the full bounds of the surface, including any - subsurfaces. Once the window geometry of the surface is set once, - it is not possible to unset it, and it will remain the same until + The window geometry is double buffered, and will be applied at the + time wl_surface.commit of the corresponding wl_surface is called. + + Once the window geometry of the surface is set once, it is not + possible to unset it, and it will remain the same until set_window_geometry is called again, even if a new subsurface or buffer is attached. + If never set, the value is the full bounds of the surface, + including any subsurfaces. This updates dynamically on every + commit. This unset mode is meant for extremely simple clients. + If responding to a configure event, the window geometry in here must respect the sizing negotiations specified by the states in the configure event. + + The arguments are given in the surface local coordinate space of + the wl_surface associated with this xdg_surface. + + The width and height must be greater than zero. @@ -336,8 +417,48 @@ - - + + + Maximize the surface. + + After requesting that the surface should be maximized, the compositor + will respond by emitting a configure event with the "maximized" state + and the required window geometry. The client should then update its + content, drawing it in a maximized state, i.e. without shadow or other + decoration outside of the window geometry. The client must also + acknowledge the configure when committing the new content (see + ack_configure). + + It is up to the compositor to decide how and where to maximize the + surface, for example which output and what region of the screen should + be used. + + If the surface was already maximized, the compositor will still emit + a configure event with the "maximized" state. + + + + + + Unmaximize the surface. + + After requesting that the surface should be unmaximized, the compositor + will respond by emitting a configure event without the "maximized" + state. If available, the compositor will include the window geometry + dimensions the window had prior to being maximized in the configure + request. The client must then update its content, drawing it in a + regular state, i.e. potentially with shadow, etc. The client must also + acknowledge the configure when committing the new content (see + ack_configure). + + It is up to the compositor to position the surface after it was + unmaximized; usually the position the surface had before maximizing, if + applicable. + + If the surface was already not maximized, the compositor will still + emit a configure event without the "maximized" state. + + @@ -346,12 +467,27 @@ You can specify an output that you would prefer to be fullscreen. If this value is NULL, it's up to the compositor to choose which display will be used to map this surface. + + If the surface doesn't cover the whole output, the compositor will + position the surface in the center of the output and compensate with + black borders filling the rest of the output. - + + + Request that the compositor minimize your surface. There is no + way to know if the surface is currently minimized, nor is there + any way to unset minimization on this surface. + + If you are looking to throttle redrawing when minimized, please + instead use the wl_surface.frame event for this, as this will + also work with live previews on windows in Alt-Tab, Expose or + similar compositor features. + + @@ -368,45 +504,76 @@ - - An interface that may be implemented by a wl_surface, for - implementations that provide a desktop-style popups/menus. A popup - surface is a transient surface with an added pointer grab. + + A popup surface is a short-lived, temporary surface that can be + used to implement menus. It takes an explicit grab on the surface + that will be dismissed when the user dismisses the popup. This can + be done by the user clicking outside the surface, using the keyboard, + or even locking the screen through closing the lid or a timeout. - An existing implicit grab will be changed to owner-events mode, - and the popup grab will continue after the implicit grab ends - (i.e. releasing the mouse button does not cause the popup to be - unmapped). + When the popup is dismissed, a popup_done event will be sent out, + and at the same time the surface will be unmapped. The xdg_popup + object is now inert and cannot be reactivated, so clients should + destroy it. Explicitly destroying the xdg_popup object will also + dismiss the popup and unmap the surface. - The popup grab continues until the window is destroyed or a mouse - button is pressed in any other clients window. A click in any of - the clients surfaces is reported as normal, however, clicks in - other clients surfaces will be discarded and trigger the callback. + Clients will receive events for all their surfaces during this + grab (which is an "owner-events" grab in X11 parlance). This is + done so that users can navigate through submenus and other + "nested" popup windows without having to dismiss the topmost + popup. - The x and y arguments specify the locations of the upper left - corner of the surface relative to the upper left corner of the - parent surface, in surface local coordinates. + Clients that want to dismiss the popup when another surface of + their own is clicked should dismiss the popup using the destroy + request. - xdg_popup surfaces are always transient for another surface. + The parent surface must have either an xdg_surface or xdg_popup + role. + + Specifying an xdg_popup for the parent means that the popups are + nested, with this popup now being the topmost popup. Nested + popups must be destroyed in the reverse order they were created + in, e.g. the only popup you are allowed to destroy at all times + is the topmost one. + + If there is an existing popup when creating a new popup, the + parent must be the current topmost popup. + + A parent surface must be mapped before the new popup is mapped. + + When compositors choose to dismiss a popup, they will likely + dismiss every nested popup as well. When a compositor dismisses + popups, it will follow the same dismissing order as required + from the client. + + The x and y arguments passed when creating the popup object specify + where the top left of the popup should be placed, relative to the + local surface coordinates of the parent surface. See + xdg_shell.get_xdg_popup. + + The client must call wl_surface.commit on the corresponding wl_surface + for the xdg_popup state to take effect. + + For a surface to be mapped by the compositor the client must have + committed both the xdg_popup state and a buffer. - - The xdg_surface interface is removed from the wl_surface object - that was turned into a xdg_surface with - xdg_shell.get_xdg_surface request. The xdg_surface properties, - like maximized and fullscreen, are lost. The wl_surface loses - its role as a xdg_surface. The wl_surface is unmapped. + + This destroys the popup. Explicitly destroying the xdg_popup + object will also dismiss the popup, and unmap the surface. + + If this xdg_popup is not the "topmost" popup, a protocol error + will be sent. - The popup_done event is sent out when a popup grab is broken, - that is, when the users clicks a surface that doesn't belong - to the client owning the popup surface. + The popup_done event is sent out when a popup is dismissed by the + compositor. The client should destroy the xdg_popup object at this + point. - diff --git a/src/plugins/platforms/wayland/qwaylandxdgsurface.cpp b/src/plugins/platforms/wayland/qwaylandxdgsurface.cpp index 396fa332e41..c89e230db66 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgsurface.cpp +++ b/src/plugins/platforms/wayland/qwaylandxdgsurface.cpp @@ -56,6 +56,7 @@ QWaylandXdgSurface::QWaylandXdgSurface(struct ::xdg_surface *xdg_surface, QWayla { if (window->display()->windowExtension()) m_extendedWindow = new QWaylandExtendedSurface(window); + m_size = m_window->window()->geometry().size(); } QWaylandXdgSurface::~QWaylandXdgSurface() @@ -126,8 +127,8 @@ void QWaylandXdgSurface::updateTransientParent(QWindow *parent) QWaylandWindow *parent_wayland_window = static_cast(parent->handle()); if (!parent_wayland_window) return; - - set_parent(parent_wayland_window->object()); + QtWayland::xdg_shell *shell = parent_wayland_window->display()->shellXdg(); + set_parent(shell->get_xdg_surface(parent_wayland_window->object())); } void QWaylandXdgSurface::setTitle(const QString & title) @@ -178,11 +179,11 @@ void QWaylandXdgSurface::xdg_surface_configure(int32_t width, int32_t height, st state = (uint32_t*) states->data; - for (uint32_t i=0; i < states->size; i++) + for (uint32_t i = 0; i < states->size / sizeof(state) ; i++) { switch (*(state+i)) { case XDG_SURFACE_STATE_MAXIMIZED: - aboutToMaximize = true; + aboutToMaximize = ((width > 0) && (height > 0)); break; case XDG_SURFACE_STATE_FULLSCREEN: aboutToFullScreen = true; @@ -191,7 +192,7 @@ void QWaylandXdgSurface::xdg_surface_configure(int32_t width, int32_t height, st m_margins = m_window->frameMargins(); width -= m_margins.left() + m_margins.right(); height -= m_margins.top() + m_margins.bottom(); - m_size = QSize(width,height); + m_size = m_window->window()->geometry().size(); break; case XDG_SURFACE_STATE_ACTIVATED: // TODO: here about the missing window activation @@ -203,21 +204,23 @@ void QWaylandXdgSurface::xdg_surface_configure(int32_t width, int32_t height, st if (!m_fullscreen && aboutToFullScreen) { m_fullscreen = true; - m_size = m_window->window()->geometry().size(); m_window->window()->showFullScreen(); } else if (m_fullscreen && !aboutToFullScreen) { m_fullscreen = false; - m_window->window()->showNormal(); + if ( m_maximized ) { + m_window->window()->showMaximized(); + } else { + m_window->window()->showNormal(); + } } else if (!m_maximized && aboutToMaximize) { m_maximized = true; - m_size = m_window->window()->geometry().size(); m_window->window()->showMaximized(); } else if (m_maximized && !aboutToMaximize) { m_maximized = false; m_window->window()->showNormal(); } - if (width == 0 && height == 0) { + if (width == 0 || height == 0) { width = m_size.width(); height = m_size.height(); } @@ -227,7 +230,7 @@ void QWaylandXdgSurface::xdg_surface_configure(int32_t width, int32_t height, st m_window->configure(0, width + m_margins.left() + m_margins.right(), height + m_margins.top() + m_margins.bottom()); } - xdg_surface_ack_configure(object(), serial); + ack_configure(serial); } void QWaylandXdgSurface::xdg_surface_close() From a7ed723edb23e8b384b7c4538e4b4b4c6701ac67 Mon Sep 17 00:00:00 2001 From: Giulio Camuffo Date: Fri, 25 Sep 2015 10:07:34 +0300 Subject: [PATCH 0271/1507] Fix a segfault when the wayland connection is broken When calling ::exit() the socket notifier in the events thread may still fire before the process actually exits, using objects that are being destroyed and resulting in a segfault. Stop the events thread before calling ::exit(). Change-Id: I187762da2a7efa83db1e62b0e28dfab89f478c7d Reviewed-by: Pier Luigi Fiorini --- src/plugins/platforms/wayland/qwaylanddisplay.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index f197b378803..0bea9af659a 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -194,6 +194,8 @@ void QWaylandDisplay::blockingReadEvents() void QWaylandDisplay::exitWithError() { + mEventThread->quit(); + mEventThread->wait(); ::exit(1); } From b69db39d486ff38c95bd5238530a4d721e517f07 Mon Sep 17 00:00:00 2001 From: Mikko Levonmaa Date: Wed, 23 Sep 2015 14:42:58 +0300 Subject: [PATCH 0272/1507] Add QWayland::shm object to client Allows more flexibility for the client to determine additional shm formats supported by the compositor in addition to the standard types. For example YUV formats. Change-Id: Ib4a47c1d5bbeed9314d5ad5f5f8e1551c1dd71e4 Reviewed-by: Giulio Camuffo Reviewed-by: Mikko Levonmaa --- src/plugins/platforms/wayland/client.pro | 2 + .../platforms/wayland/qwaylandcursor.cpp | 2 +- .../platforms/wayland/qwaylanddisplay.cpp | 2 +- .../platforms/wayland/qwaylanddisplay_p.h | 5 +- src/plugins/platforms/wayland/qwaylandshm.cpp | 80 +++++++++++++++++++ src/plugins/platforms/wayland/qwaylandshm_p.h | 76 ++++++++++++++++++ .../wayland/qwaylandshmbackingstore.cpp | 6 +- 7 files changed, 166 insertions(+), 7 deletions(-) create mode 100644 src/plugins/platforms/wayland/qwaylandshm.cpp create mode 100644 src/plugins/platforms/wayland/qwaylandshm_p.h diff --git a/src/plugins/platforms/wayland/client.pro b/src/plugins/platforms/wayland/client.pro index ba17b21c57c..212ce0d5965 100644 --- a/src/plugins/platforms/wayland/client.pro +++ b/src/plugins/platforms/wayland/client.pro @@ -83,6 +83,7 @@ SOURCES += qwaylandintegration.cpp \ qwaylandwindowmanagerintegration.cpp \ qwaylandinputcontext.cpp \ qwaylanddatadevice.cpp \ + qwaylandshm.cpp \ HEADERS += qwaylandintegration_p.h \ qwaylandnativeinterface_p.h \ @@ -116,6 +117,7 @@ HEADERS += qwaylandintegration_p.h \ qwaylandwindowmanagerintegration_p.h \ qwaylandinputcontext_p.h \ qwaylanddatadevice_p.h \ + qwaylandshm_p.h \ include(hardwareintegration/hardwareintegration.pri) include(shellintegration/shellintegration.pri) diff --git a/src/plugins/platforms/wayland/qwaylandcursor.cpp b/src/plugins/platforms/wayland/qwaylandcursor.cpp index 8dfc95c3604..a76e05a9ab3 100644 --- a/src/plugins/platforms/wayland/qwaylandcursor.cpp +++ b/src/plugins/platforms/wayland/qwaylandcursor.cpp @@ -59,7 +59,7 @@ QWaylandCursor::QWaylandCursor(QWaylandScreen *screen) int cursorSize = cursorSizeFromEnv.toInt(&hasCursorSize); if (!hasCursorSize || cursorSize <= 0) cursorSize = 32; - mCursorTheme = wl_cursor_theme_load(cursorTheme, cursorSize, mDisplay->shm()); + mCursorTheme = wl_cursor_theme_load(cursorTheme, cursorSize, mDisplay->shm()->object()); if (!mCursorTheme) qDebug() << "Could not load theme" << cursorTheme; initCursorMap(); diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index ab69bca3278..0dd7bdfa62e 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -255,7 +255,7 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin mCompositorVersion = qMin((int)version, 3); mCompositor.init(registry, id, mCompositorVersion); } else if (interface == QStringLiteral("wl_shm")) { - mShm = static_cast(wl_registry_bind(registry, id, &wl_shm_interface,1)); + mShm.reset(new QWaylandShm(this, version, id)); } else if (interface == QStringLiteral("xdg_shell") && qEnvironmentVariableIsSet("QT_WAYLAND_USE_XDG_SHELL")) { mShellXdg.reset(new QWaylandXdgShell(registry,id)); diff --git a/src/plugins/platforms/wayland/qwaylanddisplay_p.h b/src/plugins/platforms/wayland/qwaylanddisplay_p.h index 96d79ddbd5a..84e94a61dbb 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay_p.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay_p.h @@ -45,6 +45,7 @@ #include #include #include +#include struct wl_cursor_image; @@ -147,7 +148,7 @@ public: * to enable many listeners at once. */ void addRegistryListener(RegistryListener listener, void *data); - struct wl_shm *shm() const { return mShm; } + QWaylandShm *shm() const { return mShm.data(); } static uint32_t currentTimeMillisec(); @@ -176,7 +177,7 @@ private: struct wl_display *mDisplay; struct wl_event_queue *mEventQueue; QtWayland::wl_compositor mCompositor; - struct wl_shm *mShm; + QScopedPointer mShm; QThread *mEventThread; QWaylandEventThread *mEventThreadObject; QScopedPointer mShell; diff --git a/src/plugins/platforms/wayland/qwaylandshm.cpp b/src/plugins/platforms/wayland/qwaylandshm.cpp new file mode 100644 index 00000000000..1d7981477ad --- /dev/null +++ b/src/plugins/platforms/wayland/qwaylandshm.cpp @@ -0,0 +1,80 @@ +/**************************************************************************** +** +** Copyright (C) 2015 LG Electronics Inc, author: +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL21$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#include +#include + +#include "qwaylandshmformathelper.h" + +QT_BEGIN_NAMESPACE + +namespace QtWaylandClient { + +QWaylandShm::QWaylandShm(QWaylandDisplay *display, int version, uint32_t id) + : QtWayland::wl_shm(display->wl_registry(), id, qMin(version, 1)) +{ +} + +QWaylandShm::~QWaylandShm() +{ + +} + +void QWaylandShm::shm_format(uint32_t format) +{ + m_formats << format; +} + +bool QWaylandShm::formatSupported(wl_shm_format format) const +{ + return m_formats.contains(format); +} + +bool QWaylandShm::formatSupported(QImage::Format format) const +{ + wl_shm_format fmt = formatFrom(format); + return formatSupported(fmt); +} + +wl_shm_format QWaylandShm::formatFrom(QImage::Format format) +{ + return QWaylandShmFormatHelper::fromQImageFormat(format); +} + +QImage::Format QWaylandShm::formatFrom(wl_shm_format format) +{ + return QWaylandShmFormatHelper::fromWaylandShmFormat(format); +} + +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandshm_p.h b/src/plugins/platforms/wayland/qwaylandshm_p.h new file mode 100644 index 00000000000..10feae6a770 --- /dev/null +++ b/src/plugins/platforms/wayland/qwaylandshm_p.h @@ -0,0 +1,76 @@ +/**************************************************************************** +** +** Copyright (C) 2015 LG Electronics Inc, author: +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL21$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWAYLANDSHM_H +#define QWAYLANDSHM_H + +#include +#include + +#include +#include + +QT_BEGIN_NAMESPACE + +namespace QtWaylandClient { + +class QWaylandDisplay; + +class Q_WAYLAND_CLIENT_EXPORT QWaylandShm : public QtWayland::wl_shm +{ + +public: + + QWaylandShm(QWaylandDisplay *display, int version, uint32_t id); + ~QWaylandShm(); + + bool formatSupported(wl_shm_format format) const; + bool formatSupported(QImage::Format format) const; + + static wl_shm_format formatFrom(QImage::Format format); + static QImage::Format formatFrom(wl_shm_format format); + +protected: + virtual void shm_format(uint32_t format); + +private: + QVector m_formats; + +}; + +} + +QT_END_NAMESPACE + +#endif + diff --git a/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp b/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp index f009e08116b..2912ee3b9e1 100644 --- a/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp +++ b/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp @@ -42,7 +42,6 @@ #include #include -#include "qwaylandshmformathelper.h" #include #include @@ -85,11 +84,12 @@ QWaylandShmBuffer::QWaylandShmBuffer(QWaylandDisplay *display, return; } - wl_shm_format wl_format = QWaylandShmFormatHelper::fromQImageFormat(format); + QWaylandShm* shm = display->shm(); + wl_shm_format wl_format = shm->formatFrom(format); mImage = QImage(data, size.width(), size.height(), stride, format); mImage.setDevicePixelRatio(qreal(scale)); - mShmPool = wl_shm_create_pool(display->shm(), fd, alloc); + mShmPool = wl_shm_create_pool(shm->object(), fd, alloc); mBuffer = wl_shm_pool_create_buffer(mShmPool,0, size.width(), size.height(), stride, wl_format); close(fd); From 3130cc4d86a5059a6cd7f44b72f1fc1338548c50 Mon Sep 17 00:00:00 2001 From: Giulio Camuffo Date: Tue, 17 Feb 2015 16:33:43 +0200 Subject: [PATCH 0273/1507] Implement the wl_subcompositor interface server-side This change removes the qt_sub_surface extension and replaces it with the standard wl_subsurface. Only the bare minimum functionality is implemented, the wl_subsurface requests are left as dummy handlers currently. Change-Id: I025304072cf157f732e90c4b5649a07b295fdea5 Reviewed-by: Pier Luigi Fiorini Reviewed-by: Mikko Levonmaa --- .../extensions/sub-surface-extension.xml | 69 ------------------- src/plugins/platforms/wayland/client.pro | 1 - 2 files changed, 70 deletions(-) delete mode 100644 src/3rdparty/wayland/extensions/sub-surface-extension.xml diff --git a/src/3rdparty/wayland/extensions/sub-surface-extension.xml b/src/3rdparty/wayland/extensions/sub-surface-extension.xml deleted file mode 100644 index 4ea87e20319..00000000000 --- a/src/3rdparty/wayland/extensions/sub-surface-extension.xml +++ /dev/null @@ -1,69 +0,0 @@ - - - - Copyright (C) 2015 The Qt Company Ltd. - Contact: http://www.qt.io/licensing/ - - This file is part of the plugins of the Qt Toolkit. - - $QT_BEGIN_LICENSE:BSD$ - You may use this file under the terms of the BSD license as follows: - - "Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are - met: - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in - the documentation and/or other materials provided with the - distribution. - * Neither the name of The Qt Company Ltd nor the names of its - contributors may be used to endorse or promote products derived - from this software without specific prior written permission. - - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." - - $QT_END_LICENSE$ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/plugins/platforms/wayland/client.pro b/src/plugins/platforms/wayland/client.pro index 212ce0d5965..ca0e0a7d0ba 100644 --- a/src/plugins/platforms/wayland/client.pro +++ b/src/plugins/platforms/wayland/client.pro @@ -45,7 +45,6 @@ INCLUDEPATH += $$PWD/../shared WAYLANDCLIENTSOURCES += \ ../3rdparty/protocol/wayland.xml \ ../extensions/surface-extension.xml \ - ../extensions/sub-surface-extension.xml \ ../extensions/touch-extension.xml \ ../extensions/qtkey-extension.xml \ ../extensions/windowmanager.xml \ From dcc7143a1806bddcb2e806ffad450f0d11522a3c Mon Sep 17 00:00:00 2001 From: Andres Gomez Date: Thu, 1 Oct 2015 19:42:27 +0300 Subject: [PATCH 0274/1507] xkb: Provide support for the XF86Phone symbol Change-Id: I19fd0bc7a56b4baa5b6d40836d5f0401a3b11c49 Reviewed-by: Laszlo Agocs --- src/plugins/platforms/wayland/shared/qwaylandxkb.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/plugins/platforms/wayland/shared/qwaylandxkb.cpp b/src/plugins/platforms/wayland/shared/qwaylandxkb.cpp index c947902bdef..16d713c0587 100644 --- a/src/plugins/platforms/wayland/shared/qwaylandxkb.cpp +++ b/src/plugins/platforms/wayland/shared/qwaylandxkb.cpp @@ -135,6 +135,8 @@ static const uint32_t KeyTbl[] = { XKB_KEY_XF86Eject, Qt::Key_Eject, + XKB_KEY_XF86Phone, Qt::Key_ToggleCallHangup, + 0, 0 }; From 2eac89028ba511959d78f2243e92568cf68ee7e5 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 5 Oct 2015 11:15:15 +0200 Subject: [PATCH 0275/1507] Add missing "We mean it" comments to private headers. Change-Id: I70c01453b3939d1d645d626ae84c21ab4c9d267a Reviewed-by: Giulio Camuffo --- .../qwaylandclientbufferintegration_p.h | 11 +++++++++++ .../qwaylandclientbufferintegrationfactory_p.h | 11 +++++++++++ .../qwaylandclientbufferintegrationplugin_p.h | 11 +++++++++++ .../qwaylandhardwareintegration_p.h | 11 +++++++++++ .../qwaylandserverbufferintegration_p.h | 11 +++++++++++ .../qwaylandserverbufferintegrationfactory_p.h | 11 +++++++++++ .../qwaylandserverbufferintegrationplugin_p.h | 11 +++++++++++ .../qwaylandinputdeviceintegration_p.h | 11 +++++++++++ .../qwaylandinputdeviceintegrationfactory_p.h | 11 +++++++++++ .../qwaylandinputdeviceintegrationplugin_p.h | 11 +++++++++++ .../platforms/wayland/qwaylandabstractdecoration_p.h | 11 +++++++++++ src/plugins/platforms/wayland/qwaylandbuffer_p.h | 11 +++++++++++ .../platforms/wayland/qwaylandclientexport_p.h | 11 +++++++++++ src/plugins/platforms/wayland/qwaylandclipboard_p.h | 11 +++++++++++ src/plugins/platforms/wayland/qwaylandcursor_p.h | 11 +++++++++++ src/plugins/platforms/wayland/qwaylanddatadevice_p.h | 11 +++++++++++ .../platforms/wayland/qwaylanddatadevicemanager_p.h | 11 +++++++++++ src/plugins/platforms/wayland/qwaylanddataoffer_p.h | 11 +++++++++++ src/plugins/platforms/wayland/qwaylanddatasource_p.h | 11 +++++++++++ .../platforms/wayland/qwaylanddecorationfactory_p.h | 11 +++++++++++ .../platforms/wayland/qwaylanddecorationplugin_p.h | 11 +++++++++++ src/plugins/platforms/wayland/qwaylanddisplay_p.h | 11 +++++++++++ src/plugins/platforms/wayland/qwaylanddnd_p.h | 11 +++++++++++ src/plugins/platforms/wayland/qwaylandeventthread_p.h | 11 +++++++++++ .../platforms/wayland/qwaylandextendedsurface_p.h | 11 +++++++++++ .../platforms/wayland/qwaylandinputcontext_p.h | 11 +++++++++++ src/plugins/platforms/wayland/qwaylandinputdevice_p.h | 11 +++++++++++ src/plugins/platforms/wayland/qwaylandintegration_p.h | 11 +++++++++++ .../platforms/wayland/qwaylandnativeinterface_p.h | 11 +++++++++++ src/plugins/platforms/wayland/qwaylandqtkey_p.h | 11 +++++++++++ src/plugins/platforms/wayland/qwaylandscreen_p.h | 11 +++++++++++ .../platforms/wayland/qwaylandshellsurface_p.h | 11 +++++++++++ .../platforms/wayland/qwaylandshmbackingstore_p.h | 11 +++++++++++ src/plugins/platforms/wayland/qwaylandshmwindow_p.h | 11 +++++++++++ src/plugins/platforms/wayland/qwaylandsubsurface_p.h | 11 +++++++++++ src/plugins/platforms/wayland/qwaylandtouch_p.h | 11 +++++++++++ src/plugins/platforms/wayland/qwaylandwindow_p.h | 11 +++++++++++ .../wayland/qwaylandwindowmanagerintegration_p.h | 11 +++++++++++ .../platforms/wayland/qwaylandwlshellsurface_p.h | 11 +++++++++++ src/plugins/platforms/wayland/qwaylandxdgshell_p.h | 11 +++++++++++ src/plugins/platforms/wayland/qwaylandxdgsurface_p.h | 11 +++++++++++ .../shellintegration/qwaylandshellintegration_p.h | 11 +++++++++++ .../qwaylandshellintegrationfactory_p.h | 11 +++++++++++ .../qwaylandshellintegrationplugin_p.h | 11 +++++++++++ 44 files changed, 484 insertions(+) diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegration_p.h b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegration_p.h index 9a38b6d2fae..9534934fa27 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegration_p.h +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegration_p.h @@ -34,6 +34,17 @@ #ifndef QWAYLANDCLIENTBUFFERINTEGRATION_H #define QWAYLANDCLIENTBUFFERINTEGRATION_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include #include diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationfactory_p.h b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationfactory_p.h index 24063c2b997..54590a29adb 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationfactory_p.h +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationfactory_p.h @@ -34,6 +34,17 @@ #ifndef QWAYLANDCLIENTBUFFERINTEGRATIONFACTORY_H #define QWAYLANDCLIENTBUFFERINTEGRATIONFACTORY_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include #include diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationplugin_p.h b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationplugin_p.h index f2c0bc08de5..dae7aa00908 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationplugin_p.h +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationplugin_p.h @@ -34,6 +34,17 @@ #ifndef QWAYLANDCLIENTBUFFERINTEGRATIONPLUGIN_H #define QWAYLANDCLIENTBUFFERINTEGRATIONPLUGIN_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include #include diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandhardwareintegration_p.h b/src/plugins/platforms/wayland/hardwareintegration/qwaylandhardwareintegration_p.h index c672b2b2777..466f0b20bbb 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandhardwareintegration_p.h +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandhardwareintegration_p.h @@ -34,6 +34,17 @@ #ifndef QWAYLANDHARDWAREINTEGRATION_H #define QWAYLANDHARDWAREINTEGRATION_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include #include diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegration_p.h b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegration_p.h index 286860c3671..ad28355992a 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegration_p.h +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegration_p.h @@ -34,6 +34,17 @@ #ifndef QWAYLANDSERVERBUFFERINTEGRATION_H #define QWAYLANDSERVERBUFFERINTEGRATION_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include #include diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationfactory_p.h b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationfactory_p.h index 6daa2e074ce..4eeb371697d 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationfactory_p.h +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationfactory_p.h @@ -34,6 +34,17 @@ #ifndef QWAYLANDSERVERBUFFERINTEGRATIONFACTORY_H #define QWAYLANDSERVERBUFFERINTEGRATIONFACTORY_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include #include diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationplugin_p.h b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationplugin_p.h index 51d64512ab2..5d0d5d2fdb4 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationplugin_p.h +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationplugin_p.h @@ -34,6 +34,17 @@ #ifndef QWAYLANDSERVERBUFFERINTEGRATIONPLUGIN_H #define QWAYLANDSERVERBUFFERINTEGRATIONPLUGIN_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include #include diff --git a/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegration_p.h b/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegration_p.h index 3feb8868432..f3c59c898a3 100644 --- a/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegration_p.h +++ b/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegration_p.h @@ -34,6 +34,17 @@ #ifndef QWAYLANDINPUTDEVICEINTEGRATION_H #define QWAYLANDINPUTDEVICEINTEGRATION_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include #include diff --git a/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationfactory_p.h b/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationfactory_p.h index 1eddca862f8..69ab61cf8d8 100644 --- a/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationfactory_p.h +++ b/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationfactory_p.h @@ -34,6 +34,17 @@ #ifndef QWAYLANDINPUTDEVICEINTEGRATIONFACTORY_H #define QWAYLANDINPUTDEVICEINTEGRATIONFACTORY_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include #include diff --git a/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationplugin_p.h b/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationplugin_p.h index ab646417dfb..0cb89ebac2c 100644 --- a/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationplugin_p.h +++ b/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationplugin_p.h @@ -34,6 +34,17 @@ #ifndef QWAYLANDINPUTDEVICEINTEGRATIONPLUGIN_H #define QWAYLANDINPUTDEVICEINTEGRATIONPLUGIN_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include #include diff --git a/src/plugins/platforms/wayland/qwaylandabstractdecoration_p.h b/src/plugins/platforms/wayland/qwaylandabstractdecoration_p.h index e489c09a039..ff4ea45a8ca 100644 --- a/src/plugins/platforms/wayland/qwaylandabstractdecoration_p.h +++ b/src/plugins/platforms/wayland/qwaylandabstractdecoration_p.h @@ -35,6 +35,17 @@ #ifndef QWAYLANDABSTRACTDECORATION_H #define QWAYLANDABSTRACTDECORATION_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include #include #include diff --git a/src/plugins/platforms/wayland/qwaylandbuffer_p.h b/src/plugins/platforms/wayland/qwaylandbuffer_p.h index e1a891d12ae..6f8f7b269a9 100644 --- a/src/plugins/platforms/wayland/qwaylandbuffer_p.h +++ b/src/plugins/platforms/wayland/qwaylandbuffer_p.h @@ -34,6 +34,17 @@ #ifndef QWAYLANDBUFFER_H #define QWAYLANDBUFFER_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include #include diff --git a/src/plugins/platforms/wayland/qwaylandclientexport_p.h b/src/plugins/platforms/wayland/qwaylandclientexport_p.h index 993c900be5d..2938025f0b5 100644 --- a/src/plugins/platforms/wayland/qwaylandclientexport_p.h +++ b/src/plugins/platforms/wayland/qwaylandclientexport_p.h @@ -34,6 +34,17 @@ #ifndef QWAYLANDCLIENTEXPORT_H #define QWAYLANDCLIENTEXPORT_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandclipboard_p.h b/src/plugins/platforms/wayland/qwaylandclipboard_p.h index 26cbbaeec74..02223076e1f 100644 --- a/src/plugins/platforms/wayland/qwaylandclipboard_p.h +++ b/src/plugins/platforms/wayland/qwaylandclipboard_p.h @@ -34,6 +34,17 @@ #ifndef QWAYLANDCLIPBOARD_H #define QWAYLANDCLIPBOARD_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include #include diff --git a/src/plugins/platforms/wayland/qwaylandcursor_p.h b/src/plugins/platforms/wayland/qwaylandcursor_p.h index 02023dd5517..0cc1173f8f9 100644 --- a/src/plugins/platforms/wayland/qwaylandcursor_p.h +++ b/src/plugins/platforms/wayland/qwaylandcursor_p.h @@ -34,6 +34,17 @@ #ifndef QWAYLANDCURSOR_H #define QWAYLANDCURSOR_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include #include #include diff --git a/src/plugins/platforms/wayland/qwaylanddatadevice_p.h b/src/plugins/platforms/wayland/qwaylanddatadevice_p.h index d6d38d68189..b87529e9b7b 100644 --- a/src/plugins/platforms/wayland/qwaylanddatadevice_p.h +++ b/src/plugins/platforms/wayland/qwaylanddatadevice_p.h @@ -41,6 +41,17 @@ #ifndef QWAYLANDDATADEVICE_H #define QWAYLANDDATADEVICE_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include #include diff --git a/src/plugins/platforms/wayland/qwaylanddatadevicemanager_p.h b/src/plugins/platforms/wayland/qwaylanddatadevicemanager_p.h index 151197e3b90..85b4b3f7444 100644 --- a/src/plugins/platforms/wayland/qwaylanddatadevicemanager_p.h +++ b/src/plugins/platforms/wayland/qwaylanddatadevicemanager_p.h @@ -34,6 +34,17 @@ #ifndef QWAYLANDDATADEVICEMANAGER_H #define QWAYLANDDATADEVICEMANAGER_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include #include diff --git a/src/plugins/platforms/wayland/qwaylanddataoffer_p.h b/src/plugins/platforms/wayland/qwaylanddataoffer_p.h index 391ceb173a6..b22681f7adb 100644 --- a/src/plugins/platforms/wayland/qwaylanddataoffer_p.h +++ b/src/plugins/platforms/wayland/qwaylanddataoffer_p.h @@ -34,6 +34,17 @@ #ifndef QWAYLANDDATAOFFER_H #define QWAYLANDDATAOFFER_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include #include diff --git a/src/plugins/platforms/wayland/qwaylanddatasource_p.h b/src/plugins/platforms/wayland/qwaylanddatasource_p.h index 93f1f468170..c753c4f6e32 100644 --- a/src/plugins/platforms/wayland/qwaylanddatasource_p.h +++ b/src/plugins/platforms/wayland/qwaylanddatasource_p.h @@ -34,6 +34,17 @@ #ifndef QWAYLANDDATASOURCE_H #define QWAYLANDDATASOURCE_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include #include diff --git a/src/plugins/platforms/wayland/qwaylanddecorationfactory_p.h b/src/plugins/platforms/wayland/qwaylanddecorationfactory_p.h index de830aaf0af..0a0e09d6486 100644 --- a/src/plugins/platforms/wayland/qwaylanddecorationfactory_p.h +++ b/src/plugins/platforms/wayland/qwaylanddecorationfactory_p.h @@ -34,6 +34,17 @@ #ifndef QWAYLANDDECORATIONFACTORY_H #define QWAYLANDDECORATIONFACTORY_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include #include diff --git a/src/plugins/platforms/wayland/qwaylanddecorationplugin_p.h b/src/plugins/platforms/wayland/qwaylanddecorationplugin_p.h index 9f19b29480e..762274e3275 100644 --- a/src/plugins/platforms/wayland/qwaylanddecorationplugin_p.h +++ b/src/plugins/platforms/wayland/qwaylanddecorationplugin_p.h @@ -34,6 +34,17 @@ #ifndef QWAYLANDDECORATIONPLUGIN_H #define QWAYLANDDECORATIONPLUGIN_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include #include diff --git a/src/plugins/platforms/wayland/qwaylanddisplay_p.h b/src/plugins/platforms/wayland/qwaylanddisplay_p.h index 84c79d70d97..bf48c212304 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay_p.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay_p.h @@ -34,6 +34,17 @@ #ifndef QWAYLANDDISPLAY_H #define QWAYLANDDISPLAY_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include #include #include diff --git a/src/plugins/platforms/wayland/qwaylanddnd_p.h b/src/plugins/platforms/wayland/qwaylanddnd_p.h index 19b1f92ed3a..42848a1d8c3 100644 --- a/src/plugins/platforms/wayland/qwaylanddnd_p.h +++ b/src/plugins/platforms/wayland/qwaylanddnd_p.h @@ -34,6 +34,17 @@ #ifndef QWAYLANDDND_H #define QWAYLANDDND_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include #include diff --git a/src/plugins/platforms/wayland/qwaylandeventthread_p.h b/src/plugins/platforms/wayland/qwaylandeventthread_p.h index cd64b7046d6..0920d403e42 100644 --- a/src/plugins/platforms/wayland/qwaylandeventthread_p.h +++ b/src/plugins/platforms/wayland/qwaylandeventthread_p.h @@ -34,6 +34,17 @@ #ifndef QWAYLANDEVENTTHREAD_H #define QWAYLANDEVENTTHREAD_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include #include #include diff --git a/src/plugins/platforms/wayland/qwaylandextendedsurface_p.h b/src/plugins/platforms/wayland/qwaylandextendedsurface_p.h index efd7a0b2b62..2ed3a227616 100644 --- a/src/plugins/platforms/wayland/qwaylandextendedsurface_p.h +++ b/src/plugins/platforms/wayland/qwaylandextendedsurface_p.h @@ -34,6 +34,17 @@ #ifndef QWAYLANDEXTENDEDSURFACE_H #define QWAYLANDEXTENDEDSURFACE_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include #include diff --git a/src/plugins/platforms/wayland/qwaylandinputcontext_p.h b/src/plugins/platforms/wayland/qwaylandinputcontext_p.h index 522e95fff7b..679baa497c7 100644 --- a/src/plugins/platforms/wayland/qwaylandinputcontext_p.h +++ b/src/plugins/platforms/wayland/qwaylandinputcontext_p.h @@ -41,6 +41,17 @@ #ifndef QWAYLANDINPUTCONTEXT_H #define QWAYLANDINPUTCONTEXT_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include #include diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h index 6f3b25c06b1..8bfb45cd403 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h +++ b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h @@ -34,6 +34,17 @@ #ifndef QWAYLANDINPUTDEVICE_H #define QWAYLANDINPUTDEVICE_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include #include diff --git a/src/plugins/platforms/wayland/qwaylandintegration_p.h b/src/plugins/platforms/wayland/qwaylandintegration_p.h index ef180cdaf0e..42bc287b5ad 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration_p.h +++ b/src/plugins/platforms/wayland/qwaylandintegration_p.h @@ -34,6 +34,17 @@ #ifndef QPLATFORMINTEGRATION_WAYLAND_H #define QPLATFORMINTEGRATION_WAYLAND_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include #include diff --git a/src/plugins/platforms/wayland/qwaylandnativeinterface_p.h b/src/plugins/platforms/wayland/qwaylandnativeinterface_p.h index 04a46075d4e..7050f975885 100644 --- a/src/plugins/platforms/wayland/qwaylandnativeinterface_p.h +++ b/src/plugins/platforms/wayland/qwaylandnativeinterface_p.h @@ -34,6 +34,17 @@ #ifndef QWAYLANDNATIVEINTERFACE_H #define QWAYLANDNATIVEINTERFACE_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include #include diff --git a/src/plugins/platforms/wayland/qwaylandqtkey_p.h b/src/plugins/platforms/wayland/qwaylandqtkey_p.h index 322549d5bda..2e9c7a255c6 100644 --- a/src/plugins/platforms/wayland/qwaylandqtkey_p.h +++ b/src/plugins/platforms/wayland/qwaylandqtkey_p.h @@ -34,6 +34,17 @@ #ifndef QWAYLANDQTKEY_H #define QWAYLANDQTKEY_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include #include diff --git a/src/plugins/platforms/wayland/qwaylandscreen_p.h b/src/plugins/platforms/wayland/qwaylandscreen_p.h index 3d38e30a8da..e3e1515d4fa 100644 --- a/src/plugins/platforms/wayland/qwaylandscreen_p.h +++ b/src/plugins/platforms/wayland/qwaylandscreen_p.h @@ -34,6 +34,17 @@ #ifndef QWAYLANDSCREEN_H #define QWAYLANDSCREEN_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include #include diff --git a/src/plugins/platforms/wayland/qwaylandshellsurface_p.h b/src/plugins/platforms/wayland/qwaylandshellsurface_p.h index 2fb7ff9af1d..726d103f9dd 100644 --- a/src/plugins/platforms/wayland/qwaylandshellsurface_p.h +++ b/src/plugins/platforms/wayland/qwaylandshellsurface_p.h @@ -34,6 +34,17 @@ #ifndef QWAYLANDSHELLSURFACE_H #define QWAYLANDSHELLSURFACE_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include #include diff --git a/src/plugins/platforms/wayland/qwaylandshmbackingstore_p.h b/src/plugins/platforms/wayland/qwaylandshmbackingstore_p.h index 17e84f3cd12..a1a6e19c3ce 100644 --- a/src/plugins/platforms/wayland/qwaylandshmbackingstore_p.h +++ b/src/plugins/platforms/wayland/qwaylandshmbackingstore_p.h @@ -34,6 +34,17 @@ #ifndef QWAYLANDSHMBACKINGSTORE_H #define QWAYLANDSHMBACKINGSTORE_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include #include diff --git a/src/plugins/platforms/wayland/qwaylandshmwindow_p.h b/src/plugins/platforms/wayland/qwaylandshmwindow_p.h index b046c5d8490..a0a5edffd4a 100644 --- a/src/plugins/platforms/wayland/qwaylandshmwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandshmwindow_p.h @@ -34,6 +34,17 @@ #ifndef QWAYLANDSHMWINDOW_H #define QWAYLANDSHMWINDOW_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include #include diff --git a/src/plugins/platforms/wayland/qwaylandsubsurface_p.h b/src/plugins/platforms/wayland/qwaylandsubsurface_p.h index 75d8cf6a071..4cbb99251ba 100644 --- a/src/plugins/platforms/wayland/qwaylandsubsurface_p.h +++ b/src/plugins/platforms/wayland/qwaylandsubsurface_p.h @@ -34,6 +34,17 @@ #ifndef QWAYLANDSUBSURFACE_H #define QWAYLANDSUBSURFACE_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include #include diff --git a/src/plugins/platforms/wayland/qwaylandtouch_p.h b/src/plugins/platforms/wayland/qwaylandtouch_p.h index 2dda6243a4b..394ae6d3652 100644 --- a/src/plugins/platforms/wayland/qwaylandtouch_p.h +++ b/src/plugins/platforms/wayland/qwaylandtouch_p.h @@ -34,6 +34,17 @@ #ifndef QWAYLANDTOUCH_H #define QWAYLANDTOUCH_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include #include diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index 6b9af10319f..be8f53088dd 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -34,6 +34,17 @@ #ifndef QWAYLANDWINDOW_H #define QWAYLANDWINDOW_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include #include #include diff --git a/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration_p.h b/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration_p.h index c5ceb6d5b47..73c1b29e8a6 100644 --- a/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration_p.h @@ -34,6 +34,17 @@ #ifndef QWAYLANDWINDOWMANAGERINTEGRATION_H #define QWAYLANDWINDOWMANAGERINTEGRATION_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include #include diff --git a/src/plugins/platforms/wayland/qwaylandwlshellsurface_p.h b/src/plugins/platforms/wayland/qwaylandwlshellsurface_p.h index 47d4467cef9..78216a4c32a 100644 --- a/src/plugins/platforms/wayland/qwaylandwlshellsurface_p.h +++ b/src/plugins/platforms/wayland/qwaylandwlshellsurface_p.h @@ -34,6 +34,17 @@ #ifndef QWAYLANDWLSHELLSURFACE_H #define QWAYLANDWLSHELLSURFACE_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include #include diff --git a/src/plugins/platforms/wayland/qwaylandxdgshell_p.h b/src/plugins/platforms/wayland/qwaylandxdgshell_p.h index 954dc5707a9..3fd248fc462 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgshell_p.h +++ b/src/plugins/platforms/wayland/qwaylandxdgshell_p.h @@ -34,6 +34,17 @@ #ifndef QWAYLANDXDGSHELL_H #define QWAYLANDXDGSHELL_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include #include diff --git a/src/plugins/platforms/wayland/qwaylandxdgsurface_p.h b/src/plugins/platforms/wayland/qwaylandxdgsurface_p.h index 1a53a772d13..8deafef7756 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgsurface_p.h +++ b/src/plugins/platforms/wayland/qwaylandxdgsurface_p.h @@ -34,6 +34,17 @@ #ifndef QWAYLANDXDGSURFACE_H #define QWAYLANDXDGSURFACE_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include #include diff --git a/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegration_p.h b/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegration_p.h index a4b40b08857..f8e7415200c 100644 --- a/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegration_p.h +++ b/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegration_p.h @@ -34,6 +34,17 @@ #ifndef QWAYLANDSHELLINTEGRATION_H #define QWAYLANDSHELLINTEGRATION_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include #include diff --git a/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationfactory_p.h b/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationfactory_p.h index 873e57aec57..7ec49521ce3 100644 --- a/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationfactory_p.h +++ b/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationfactory_p.h @@ -34,6 +34,17 @@ #ifndef QWAYLANDSHELLINTEGRATIONFACTORY_H #define QWAYLANDSHELLINTEGRATIONFACTORY_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include #include diff --git a/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationplugin_p.h b/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationplugin_p.h index 9bae57cc981..9193fb071e8 100644 --- a/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationplugin_p.h +++ b/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationplugin_p.h @@ -34,6 +34,17 @@ #ifndef QWAYLANDSHELLINTEGRATIONPLUGIN_H #define QWAYLANDSHELLINTEGRATIONPLUGIN_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include #include From fc78f8239e118df798606fe5690f3bea41fd54de Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Fri, 16 Oct 2015 17:07:55 +0200 Subject: [PATCH 0276/1507] Fix for QStringBuilder Change-Id: I2a7b82bd2705919a91492edfccac02f4d8fc2c9b Reviewed-by: Louai Al-Khanji --- .../qtwaylandscanner/qtwaylandscanner.cpp | 27 ++++++++++++++++--- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp index 784687d2649..a9c1715430d 100644 --- a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp +++ b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp @@ -196,8 +196,13 @@ QByteArray waylandToCType(const QByteArray &waylandType, const QByteArray &inter return "int32_t"; else if (waylandType == "array") return "wl_array *"; - else if (waylandType == "object" || waylandType == "new_id") - return isServerSide() ? "struct ::wl_resource *" : interface.isEmpty() ? "struct ::wl_object *" : "struct ::" + interface + " *"; + else if (waylandType == "object" || waylandType == "new_id") { + if (isServerSide()) + return "struct ::wl_resource *"; + if (interface.isEmpty()) + return "struct ::wl_object *"; + return "struct ::" + interface + " *"; + } return waylandType; } @@ -839,7 +844,14 @@ void process(QXmlStreamReader &xml, const QByteArray &headerPath, const QByteArr printf("\n"); foreach (const WaylandEvent &e, interface.requests) { const WaylandArgument *new_id = newIdArgument(e.arguments); - printf(" %s", new_id ? (new_id->interface.isEmpty() ? "void *" : "struct ::" + new_id->interface + " *").constData() : "void "); + QByteArray new_id_str = "void "; + if (new_id) { + if (new_id->interface.isEmpty()) + new_id_str = "void *"; + else + new_id_str = "struct ::" + new_id->interface + " *"; + } + printf(" %s", new_id_str.constData()); printEvent(e); printf(";\n"); } @@ -955,7 +967,14 @@ void process(QXmlStreamReader &xml, const QByteArray &headerPath, const QByteArr printf("\n"); const WaylandEvent &e = interface.requests.at(i); const WaylandArgument *new_id = newIdArgument(e.arguments); - printf(" %s%s::", new_id ? (new_id->interface.isEmpty() ? "void *" : "struct ::" + new_id->interface + " *").constData() : "void ", interfaceName); + QByteArray new_id_str = "void "; + if (new_id) { + if (new_id->interface.isEmpty()) + new_id_str = "void *"; + else + new_id_str = "struct ::" + new_id->interface + " *"; + } + printf(" %s%s::", new_id_str.constData(), interfaceName); printEvent(e); printf("\n"); printf(" {\n"); From face687a6204a8f41b0bbe26de1e42c9dc7cb7e0 Mon Sep 17 00:00:00 2001 From: Giulio Camuffo Date: Thu, 29 Oct 2015 16:35:27 +0200 Subject: [PATCH 0277/1507] Fix deadlock when starting a drag With commit c55a36cb9015cf1eebd49eaa5b1b4f4ec9b28451 in qtbase the QSimpleDrag code changed in a way that caused a deadlock due to drawing a window without a role. However, thanks to that we can now remove that start/cancel hack and simplify the code. Change-Id: Icba6e7c9c4927855e48fb21632db1a10332c4ffb Reviewed-by: Laszlo Agocs --- src/plugins/platforms/wayland/qwaylanddnd.cpp | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylanddnd.cpp b/src/plugins/platforms/wayland/qwaylanddnd.cpp index 59f91411f03..e195d193a41 100644 --- a/src/plugins/platforms/wayland/qwaylanddnd.cpp +++ b/src/plugins/platforms/wayland/qwaylanddnd.cpp @@ -65,21 +65,9 @@ QMimeData * QWaylandDrag::platformDropData() void QWaylandDrag::startDrag() { - bool cancel = false; - if (!shapedPixmapWindow()) { - QBasicDrag::startDrag(); - // Don't call cancel() here, since that will hide 'shapedPixmapWindow()', and - // QWaylandWindow::setVisible(false) will flush the window system queue, - // ending up trying to render the window, which doesn't have a role yet, - // and so blocking waiting for a frame callback. - cancel = true; - } - + QBasicDrag::startDrag(); QWaylandWindow *icon = static_cast(shapedPixmapWindow()->handle()); m_display->currentInputDevice()->dataDevice()->startDrag(drag()->mimeData(), icon); - if (cancel) - QBasicDrag::cancel(); - QBasicDrag::startDrag(); } void QWaylandDrag::cancel() From eace7fb3ad7417fb285cc8c6672856b419f6e46a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Wed, 28 Oct 2015 13:14:35 +0100 Subject: [PATCH 0278/1507] Add wl_shell_surface as nativeResourceForWindow Allows to get the wl_shell_surface for a QWindow, if it exists. Change-Id: I16b1c578a1c605e58c96e94ae55a3331ecfa353d Reviewed-by: Giulio Camuffo --- .../platforms/wayland/qwaylandnativeinterface.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp b/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp index 0d20075f05d..98e1a73668b 100644 --- a/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp +++ b/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp @@ -39,6 +39,7 @@ #include "qwaylanddisplay_p.h" #include "qwaylandwindowmanagerintegration_p.h" #include "qwaylandscreen_p.h" +#include "qwaylandwlshellsurface_p.h" #include #include #include @@ -80,6 +81,15 @@ void *QWaylandNativeInterface::nativeResourceForWindow(const QByteArray &resourc if (lowerCaseResource == "surface") { return ((QWaylandWindow *) window->handle())->object(); } + if (lowerCaseResource == "wl_shell_surface") { + QWaylandWindow *w = (QWaylandWindow *) window->handle(); + if (!w) + return NULL; + QWaylandWlShellSurface *s = qobject_cast(w->shellSurface()); + if (!s) + return NULL; + return s->object(); + } if (lowerCaseResource == "egldisplay" && m_integration->clientBufferIntegration()) return m_integration->clientBufferIntegration()->nativeResource(QWaylandClientBufferIntegration::EglDisplay); From 0520481077abde68f5b02a53f88982d7abb8482f Mon Sep 17 00:00:00 2001 From: Kevin Funk Date: Mon, 2 Nov 2015 10:43:06 +0100 Subject: [PATCH 0279/1507] CMake: Create CMake files for WaylandClient Also add unit tests Change-Id: I66de887607f73b318884e4a35f18510b90cf0315 Task-number: QTBUG-47357 Reviewed-by: Jan Arne Petersen Reviewed-by: Giulio Camuffo --- src/plugins/platforms/wayland/client.pro | 1 - tests/auto/cmake/test_waylandclient/CMakeLists.txt | 12 ++++++++++++ tests/auto/cmake/test_waylandclient/main.cpp | 7 +++++++ 3 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 tests/auto/cmake/test_waylandclient/CMakeLists.txt create mode 100644 tests/auto/cmake/test_waylandclient/main.cpp diff --git a/src/plugins/platforms/wayland/client.pro b/src/plugins/platforms/wayland/client.pro index ba17b21c57c..7182f3203d8 100644 --- a/src/plugins/platforms/wayland/client.pro +++ b/src/plugins/platforms/wayland/client.pro @@ -16,7 +16,6 @@ load(qt_module) QMAKE_CXXFLAGS_WARN_ON -= -Wcast-qual CONFIG -= precompile_header -CONFIG -= create_cmake CONFIG += link_pkgconfig qpa/genericunixfontdatabase wayland-scanner !equals(QT_WAYLAND_GL_CONFIG, nogl) { diff --git a/tests/auto/cmake/test_waylandclient/CMakeLists.txt b/tests/auto/cmake/test_waylandclient/CMakeLists.txt new file mode 100644 index 00000000000..3788a4927bd --- /dev/null +++ b/tests/auto/cmake/test_waylandclient/CMakeLists.txt @@ -0,0 +1,12 @@ +project(test_plugins) + +cmake_minimum_required(VERSION 2.8) +cmake_policy(SET CMP0056 NEW) + +find_package(Qt5WaylandClient REQUIRED) + +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Core_EXECUTABLE_COMPILE_FLAGS}") + +include_directories(${Qt5WaylandClient_PRIVATE_INCLUDE_DIRS}) +add_executable(test_waylandclient_exe main.cpp) +target_link_libraries(test_waylandclient_exe Qt5::WaylandClient) diff --git a/tests/auto/cmake/test_waylandclient/main.cpp b/tests/auto/cmake/test_waylandclient/main.cpp new file mode 100644 index 00000000000..f0ccdef4b76 --- /dev/null +++ b/tests/auto/cmake/test_waylandclient/main.cpp @@ -0,0 +1,7 @@ +#include + +int main() +{ + // use symbol + QtWaylandClient::QWaylandCursor cursor(Q_NULLPTR); +} From d49cd790d8525071f6613066caf5e8dd2f5ca980 Mon Sep 17 00:00:00 2001 From: Giulio Camuffo Date: Fri, 23 Oct 2015 13:29:41 +0300 Subject: [PATCH 0280/1507] client: Remove the event thread If the compositor sends events to us while the main thread is blocked the socket notifier in the events thread would keep sending out the activated() signal, but no events would actually be read until the main thread starts to run again. That causes the event thread to keep queueing new events, and so allocating memory, potentially forever. This patch fixes the issue in maybe a bit radical way, that is by removing the event thread. The socket notifier now runs in the main thread so it will block if the events are not being read. Nowadays there is no real reason to keep the event thread around, as every thread that needs to receive wayland events can dispatch them on its own, we don't need a central dispatcher thread anymore. Change-Id: Ib7885e4b038b82719d78d193f465618a72cbe6af Reviewed-by: Pier Luigi Fiorini --- src/plugins/platforms/wayland/client.pro | 2 - .../platforms/wayland/qwaylanddisplay.cpp | 42 ++++--- .../platforms/wayland/qwaylanddisplay_p.h | 3 +- .../platforms/wayland/qwaylandeventthread.cpp | 112 ------------------ .../platforms/wayland/qwaylandeventthread_p.h | 97 --------------- .../platforms/wayland/qwaylandintegration.cpp | 5 + 6 files changed, 29 insertions(+), 232 deletions(-) delete mode 100644 src/plugins/platforms/wayland/qwaylandeventthread.cpp delete mode 100644 src/plugins/platforms/wayland/qwaylandeventthread_p.h diff --git a/src/plugins/platforms/wayland/client.pro b/src/plugins/platforms/wayland/client.pro index 7182f3203d8..8bd9e1dc83a 100644 --- a/src/plugins/platforms/wayland/client.pro +++ b/src/plugins/platforms/wayland/client.pro @@ -78,7 +78,6 @@ SOURCES += qwaylandintegration.cpp \ qwaylandabstractdecoration.cpp \ qwaylanddecorationfactory.cpp \ qwaylanddecorationplugin.cpp \ - qwaylandeventthread.cpp\ qwaylandwindowmanagerintegration.cpp \ qwaylandinputcontext.cpp \ qwaylanddatadevice.cpp \ @@ -111,7 +110,6 @@ HEADERS += qwaylandintegration_p.h \ qwaylandabstractdecoration_p.h \ qwaylanddecorationfactory_p.h \ qwaylanddecorationplugin_p.h \ - qwaylandeventthread_p.h \ qwaylandwindowmanagerintegration_p.h \ qwaylandinputcontext_p.h \ qwaylanddatadevice_p.h \ diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index dbb8e12dd07..a6f52bc2432 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -33,7 +33,6 @@ #include "qwaylanddisplay_p.h" -#include "qwaylandeventthread_p.h" #include "qwaylandintegration_p.h" #include "qwaylandwindow_p.h" #include "qwaylandscreen_p.h" @@ -145,21 +144,15 @@ QWaylandDisplay::QWaylandDisplay(QWaylandIntegration *waylandIntegration) { qRegisterMetaType("uint32_t"); - mEventThreadObject = new QWaylandEventThread(0); - mEventThread = new QThread(this); - mEventThread->setObjectName(QStringLiteral("QtWayland")); - mEventThreadObject->moveToThread(mEventThread); - mEventThread->start(); - - mEventThreadObject->displayConnect(); - mDisplay = mEventThreadObject->display(); //blocks until display is available + mDisplay = wl_display_connect(NULL); + if (mDisplay == NULL) { + qErrnoWarning(errno, "Failed to create display"); + ::exit(1); + } struct ::wl_registry *registry = wl_display_get_registry(mDisplay); init(registry); - connect(mEventThreadObject, SIGNAL(newEventsRead()), this, SLOT(flushRequests())); - connect(mEventThreadObject, &QWaylandEventThread::fatalError, this, &QWaylandDisplay::exitWithError); - mWindowManagerIntegration.reset(new QWaylandWindowManagerIntegration(this)); forceRoundTrip(); @@ -175,15 +168,28 @@ QWaylandDisplay::~QWaylandDisplay(void) } mScreens.clear(); delete mDndSelectionHandler.take(); - mEventThread->quit(); - mEventThread->wait(); - delete mEventThreadObject; + wl_display_disconnect(mDisplay); +} + +void QWaylandDisplay::checkError() const +{ + int ecode = wl_display_get_error(mDisplay); + if ((ecode == EPIPE || ecode == ECONNRESET)) { + // special case this to provide a nicer error + qWarning("The Wayland connection broke. Did the Wayland compositor die?"); + } else { + qErrnoWarning(ecode, "The Wayland connection experienced a fatal error"); + } } void QWaylandDisplay::flushRequests() { + if (wl_display_prepare_read(mDisplay) == 0) { + wl_display_read_events(mDisplay); + } + if (wl_display_dispatch_pending(mDisplay) < 0) { - mEventThreadObject->checkError(); + checkError(); exitWithError(); } @@ -194,15 +200,13 @@ void QWaylandDisplay::flushRequests() void QWaylandDisplay::blockingReadEvents() { if (wl_display_dispatch(mDisplay) < 0) { - mEventThreadObject->checkError(); + checkError(); exitWithError(); } } void QWaylandDisplay::exitWithError() { - mEventThread->quit(); - mEventThread->wait(); ::exit(1); } diff --git a/src/plugins/platforms/wayland/qwaylanddisplay_p.h b/src/plugins/platforms/wayland/qwaylanddisplay_p.h index bf48c212304..8262e72be46 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay_p.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay_p.h @@ -177,6 +177,7 @@ public slots: private: void waitForScreens(); void exitWithError(); + void checkError() const; struct Listener { RegistryListener listener; @@ -186,8 +187,6 @@ private: struct wl_display *mDisplay; QtWayland::wl_compositor mCompositor; struct wl_shm *mShm; - QThread *mEventThread; - QWaylandEventThread *mEventThreadObject; QScopedPointer mShell; QScopedPointer mShellXdg; QList mScreens; diff --git a/src/plugins/platforms/wayland/qwaylandeventthread.cpp b/src/plugins/platforms/wayland/qwaylandeventthread.cpp deleted file mode 100644 index e0a3edcb81f..00000000000 --- a/src/plugins/platforms/wayland/qwaylandeventthread.cpp +++ /dev/null @@ -1,112 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL21$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qwaylandeventthread_p.h" -#include -#include - -#include -#include -#include -#include - -QT_BEGIN_NAMESPACE - -namespace QtWaylandClient { - -QWaylandEventThread::QWaylandEventThread(QObject *parent) - : QObject(parent) - , m_display(0) - , m_fileDescriptor(-1) - , m_readNotifier(0) - , m_displayLock(new QMutex) -{ -} - -QWaylandEventThread::~QWaylandEventThread() -{ - delete m_displayLock; - wl_display_disconnect(m_display); -} - -void QWaylandEventThread::displayConnect() -{ - m_displayLock->lock(); - QMetaObject::invokeMethod(this, "waylandDisplayConnect", Qt::QueuedConnection); -} - -// ### be careful what you do, this function may also be called from other -// threads to clean up & exit. -void QWaylandEventThread::checkError() const -{ - int ecode = wl_display_get_error(m_display); - if ((ecode == EPIPE || ecode == ECONNRESET)) { - // special case this to provide a nicer error - qWarning("The Wayland connection broke. Did the Wayland compositor die?"); - } else { - qErrnoWarning(ecode, "The Wayland connection experienced a fatal error"); - } -} - -void QWaylandEventThread::readWaylandEvents() -{ - if (wl_display_prepare_read(m_display) == 0) { - wl_display_read_events(m_display); - } - emit newEventsRead(); -} - -void QWaylandEventThread::waylandDisplayConnect() -{ - m_display = wl_display_connect(NULL); - if (m_display == NULL) { - qErrnoWarning(errno, "Failed to create display"); - ::exit(1); - } - m_displayLock->unlock(); - - m_fileDescriptor = wl_display_get_fd(m_display); - - m_readNotifier = new QSocketNotifier(m_fileDescriptor, QSocketNotifier::Read, this); - connect(m_readNotifier, SIGNAL(activated(int)), this, SLOT(readWaylandEvents())); -} - -wl_display *QWaylandEventThread::display() const -{ - QMutexLocker displayLock(m_displayLock); - return m_display; -} - -} - -QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandeventthread_p.h b/src/plugins/platforms/wayland/qwaylandeventthread_p.h deleted file mode 100644 index 0920d403e42..00000000000 --- a/src/plugins/platforms/wayland/qwaylandeventthread_p.h +++ /dev/null @@ -1,97 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL21$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QWAYLANDEVENTTHREAD_H -#define QWAYLANDEVENTTHREAD_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include -#include -#include - -#include - -QT_BEGIN_NAMESPACE - -class QSocketNotifier; - -namespace QtWaylandClient { - -class Q_WAYLAND_CLIENT_EXPORT QWaylandEventThread : public QObject -{ - Q_OBJECT -public: - explicit QWaylandEventThread(QObject *parent = 0); - ~QWaylandEventThread(); - - void displayConnect(); - - wl_display *display() const; - - void checkError() const; - -private slots: - void readWaylandEvents(); - - void waylandDisplayConnect(); - -signals: - void newEventsRead(); - void fatalError(); - -private: - - struct wl_display *m_display; - int m_fileDescriptor; - - QSocketNotifier *m_readNotifier; - - QMutex *m_displayLock; - -}; - -} - -QT_END_NAMESPACE - -#endif // QWAYLANDEVENTTHREAD_H diff --git a/src/plugins/platforms/wayland/qwaylandintegration.cpp b/src/plugins/platforms/wayland/qwaylandintegration.cpp index 82df8a30a41..39fff533d32 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandintegration.cpp @@ -54,6 +54,7 @@ #include #include #include +#include #include #include @@ -201,6 +202,10 @@ void QWaylandIntegration::initialize() QAbstractEventDispatcher *dispatcher = QGuiApplicationPrivate::eventDispatcher; QObject::connect(dispatcher, SIGNAL(aboutToBlock()), mDisplay, SLOT(flushRequests())); QObject::connect(dispatcher, SIGNAL(awake()), mDisplay, SLOT(flushRequests())); + + int fd = wl_display_get_fd(mDisplay->wl_display()); + QSocketNotifier *sn = new QSocketNotifier(fd, QSocketNotifier::Read, mDisplay); + QObject::connect(sn, SIGNAL(activated(int)), mDisplay, SLOT(flushRequests())); } QPlatformFontDatabase *QWaylandIntegration::fontDatabase() const From 8c457f7183d56c41cfb3789b88dcc9b2673045d7 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 5 Nov 2015 13:51:25 +0100 Subject: [PATCH 0281/1507] Fix compiler warnings. qwaylandinputcontext.cpp:57:16: warning: unused parameter 'sym' [-Wunused-parameter] qwaylanddatadevice.cpp:173:135: warning: 'dragData' may be used uninitialized in this function [-Wmaybe-uninitialized] Change-Id: Id654360fd9b7fdb572565ad39b664af3355b5e79 Reviewed-by: Giulio Camuffo --- src/plugins/platforms/wayland/qwaylanddatadevice.cpp | 2 +- src/plugins/platforms/wayland/qwaylandinputcontext.cpp | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylanddatadevice.cpp b/src/plugins/platforms/wayland/qwaylanddatadevice.cpp index a3e084a0c10..3276348e9be 100644 --- a/src/plugins/platforms/wayland/qwaylanddatadevice.cpp +++ b/src/plugins/platforms/wayland/qwaylanddatadevice.cpp @@ -157,7 +157,7 @@ void QWaylandDataDevice::data_device_enter(uint32_t serial, wl_surface *surface, QDrag *drag = static_cast(QGuiApplicationPrivate::platformIntegration()->drag())->currentDrag(); - QMimeData *dragData; + QMimeData *dragData = Q_NULLPTR; Qt::DropActions supportedActions; if (drag) { dragData = drag->mimeData(); diff --git a/src/plugins/platforms/wayland/qwaylandinputcontext.cpp b/src/plugins/platforms/wayland/qwaylandinputcontext.cpp index 119a1528787..6a729509525 100644 --- a/src/plugins/platforms/wayland/qwaylandinputcontext.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputcontext.cpp @@ -74,6 +74,7 @@ static Qt::Key toQtKey(uint32_t sym) return Qt::Key_unknown; } #else + Q_UNUSED(sym) return Qt::Key_unknown; #endif } From cf514c46a949ce99450f6d1f4470800f1183a225 Mon Sep 17 00:00:00 2001 From: Mikko Levonmaa Date: Fri, 30 Oct 2015 12:20:24 +0200 Subject: [PATCH 0282/1507] Add QWaylandWindowFunctions Allow the control of the subsurface sync mode Change-Id: I19f35261313282873f57228487a63a8f6a780b0c Reviewed-by: Giulio Camuffo --- .../wayland/qwaylandnativeinterface.cpp | 41 +++++++++++++++++++ .../wayland/qwaylandnativeinterface_p.h | 6 +++ .../platforms/wayland/qwaylandsubsurface.cpp | 25 ++++++++++- .../platforms/wayland/qwaylandsubsurface_p.h | 11 +++++ 4 files changed, 82 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp b/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp index 0d20075f05d..050099f8b64 100644 --- a/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp +++ b/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp @@ -34,6 +34,7 @@ #include "qwaylandnativeinterface_p.h" #include "qwaylanddisplay_p.h" #include "qwaylandwindow_p.h" +#include "qwaylandsubsurface_p.h" #include "qwaylandextendedsurface_p.h" #include "qwaylandintegration_p.h" #include "qwaylanddisplay_p.h" @@ -43,6 +44,8 @@ #include #include +#include + QT_BEGIN_NAMESPACE namespace QtWaylandClient { @@ -141,6 +144,44 @@ void QWaylandNativeInterface::emitWindowPropertyChanged(QPlatformWindow *window, emit windowPropertyChanged(window,name); } +QFunctionPointer QWaylandNativeInterface::platformFunction(const QByteArray &resource) const +{ + if (resource == QWaylandWindowFunctions::setSyncIdentifier()) { + return QFunctionPointer(setSync); + } else if (resource == QWaylandWindowFunctions::setDeSyncIdentifier()) { + return QFunctionPointer(setDeSync); + } else if (resource == QWaylandWindowFunctions::isSyncIdentifier()) { + return QFunctionPointer(isSync); + } + return 0; +} + + +void QWaylandNativeInterface::setSync(QWindow *window) +{ + QWaylandWindow *ww = static_cast(window->handle()); + if (ww->subSurfaceWindow()) { + ww->subSurfaceWindow()->setSync(); + } +} + +void QWaylandNativeInterface::setDeSync(QWindow *window) +{ + QWaylandWindow *ww = static_cast(window->handle()); + if (ww->subSurfaceWindow()) { + ww->subSurfaceWindow()->setDeSync(); + } +} + +bool QWaylandNativeInterface::isSync(QWindow *window) +{ + QWaylandWindow *ww = static_cast(window->handle()); + if (ww->subSurfaceWindow()) { + return ww->subSurfaceWindow()->isSync(); + } + return false; +} + } QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandnativeinterface_p.h b/src/plugins/platforms/wayland/qwaylandnativeinterface_p.h index 7050f975885..9ea62a90cbf 100644 --- a/src/plugins/platforms/wayland/qwaylandnativeinterface_p.h +++ b/src/plugins/platforms/wayland/qwaylandnativeinterface_p.h @@ -75,9 +75,15 @@ public: void emitWindowPropertyChanged(QPlatformWindow *window, const QString &name); + QFunctionPointer platformFunction(const QByteArray &resource) const Q_DECL_OVERRIDE; + private: QWaylandIntegration *m_integration; QHash m_windowProperties; + + static void setSync(QWindow *window); + static void setDeSync(QWindow *window); + static bool isSync(QWindow *window); }; } diff --git a/src/plugins/platforms/wayland/qwaylandsubsurface.cpp b/src/plugins/platforms/wayland/qwaylandsubsurface.cpp index ec813609fd2..72b80c18f0e 100644 --- a/src/plugins/platforms/wayland/qwaylandsubsurface.cpp +++ b/src/plugins/platforms/wayland/qwaylandsubsurface.cpp @@ -45,9 +45,10 @@ QWaylandSubSurface::QWaylandSubSurface(QWaylandWindow *window, QWaylandWindow *p : QtWayland::wl_subsurface(sub_surface) , m_window(window) , m_parent(parent) + , m_synchronized(false) { m_parent->mChildren << this; - set_desync(); + setDeSync(); } QWaylandSubSurface::~QWaylandSubSurface() @@ -55,6 +56,28 @@ QWaylandSubSurface::~QWaylandSubSurface() m_parent->mChildren.removeOne(this); } +void QWaylandSubSurface::setSync() +{ + QWaylandSubSurface::set_sync(); +} + +void QWaylandSubSurface::setDeSync() +{ + QWaylandSubSurface::set_desync(); +} + +void QWaylandSubSurface::set_sync() +{ + m_synchronized = true; + QtWayland::wl_subsurface::set_sync(); +} + +void QWaylandSubSurface::set_desync() +{ + m_synchronized = false; + QtWayland::wl_subsurface::set_desync(); +} + } QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandsubsurface_p.h b/src/plugins/platforms/wayland/qwaylandsubsurface_p.h index 4cbb99251ba..5255df5c920 100644 --- a/src/plugins/platforms/wayland/qwaylandsubsurface_p.h +++ b/src/plugins/platforms/wayland/qwaylandsubsurface_p.h @@ -68,9 +68,20 @@ public: QWaylandWindow *window() const { return m_window; } QWaylandWindow *parent() const { return m_parent; } + void setSync(); + void setDeSync(); + bool isSync() const { return m_synchronized; } + private: + + // Intentionally hide public methods from ::wl_subsurface + // to keep track of the sync state + void set_sync(); + void set_desync(); QWaylandWindow *m_window; QWaylandWindow *m_parent; + bool m_synchronized; + }; QT_END_NAMESPACE From 5a4487e16b398ca805d7f8ad5e45e40aa86f6b1a Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Sun, 8 Nov 2015 00:18:21 +0100 Subject: [PATCH 0283/1507] Get rid of the egl config test and use what qtbase provides contains(QT_CONFIG, egl) and CONFIG += egl is the only sane way to test for and pull in EGL headers and libs. This is particularly important when trying to be robust and guard against half-broken sysroots on embedded where a naive PKGCONFIG += egl breaks. Also add an EGL_WAYLAND_BUFFER_WL define to keep wayland-egl compiling. We are not testing for that in any config tests may cause a failure in sysroots that have parts of Mesa thrown in but pick ip an older EGL header from the vendor's driver. Change-Id: I7b7e6a7a91e78dbda5b6954ad08761298c538efc Reviewed-by: Giulio Camuffo --- .../platforms/wayland/plugins/hardwareintegration/client.pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/client.pro b/src/plugins/platforms/wayland/plugins/hardwareintegration/client.pro index b7a9b46ee1d..37a90ab0d44 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/client.pro +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/client.pro @@ -7,7 +7,7 @@ config_brcm_egl: \ SUBDIRS += brcm-egl config_xcomposite { - config_egl: \ + contains(QT_CONFIG, egl): \ SUBDIRS += xcomposite-egl !contains(QT_CONFIG, opengles2):config_glx: \ From 6c3297a6f12828935e19c65516d9cd3fe042f507 Mon Sep 17 00:00:00 2001 From: Mikko Levonmaa Date: Tue, 10 Nov 2015 14:46:26 +0200 Subject: [PATCH 0284/1507] Make swap buffer call non-blocking for subsurfaces Allows clients that use subsurfaces in synchronized mode to continue processing the event loop even in cases where a frame callback is not delivered from the compositor pending a parent surface commit Change-Id: I7df38afc4080546b60184dacecde321ba8062fac Reviewed-by: Giulio Camuffo --- src/plugins/platforms/wayland/qwaylandsubsurface.cpp | 2 ++ src/plugins/platforms/wayland/qwaylandsubsurface_p.h | 3 +++ 2 files changed, 5 insertions(+) diff --git a/src/plugins/platforms/wayland/qwaylandsubsurface.cpp b/src/plugins/platforms/wayland/qwaylandsubsurface.cpp index 72b80c18f0e..eac847c7586 100644 --- a/src/plugins/platforms/wayland/qwaylandsubsurface.cpp +++ b/src/plugins/platforms/wayland/qwaylandsubsurface.cpp @@ -58,11 +58,13 @@ QWaylandSubSurface::~QWaylandSubSurface() void QWaylandSubSurface::setSync() { + QMutexLocker l(&m_syncLock); QWaylandSubSurface::set_sync(); } void QWaylandSubSurface::setDeSync() { + QMutexLocker l(&m_syncLock); QWaylandSubSurface::set_desync(); } diff --git a/src/plugins/platforms/wayland/qwaylandsubsurface_p.h b/src/plugins/platforms/wayland/qwaylandsubsurface_p.h index 5255df5c920..b8ea6aaf3f1 100644 --- a/src/plugins/platforms/wayland/qwaylandsubsurface_p.h +++ b/src/plugins/platforms/wayland/qwaylandsubsurface_p.h @@ -48,6 +48,7 @@ #include #include +#include #include #include @@ -71,6 +72,7 @@ public: void setSync(); void setDeSync(); bool isSync() const { return m_synchronized; } + QMutex *syncMutex() { return &m_syncLock; } private: @@ -81,6 +83,7 @@ private: QWaylandWindow *m_window; QWaylandWindow *m_parent; bool m_synchronized; + QMutex m_syncLock; }; From e259816fd021f61303817982487f7fa96f37d929 Mon Sep 17 00:00:00 2001 From: Mikko Levonmaa Date: Wed, 11 Nov 2015 12:31:42 +0200 Subject: [PATCH 0285/1507] Support non-blocking flush for shm subsurfaces Change-Id: I6cc8d5214c905d6b2e9f0c2eebb07d1cb897f74a Reviewed-by: Giulio Camuffo Reviewed-by: Mikko Levonmaa --- .../wayland/qwaylandshmbackingstore.cpp | 43 +++++++++++++------ 1 file changed, 31 insertions(+), 12 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp b/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp index 2912ee3b9e1..87205d4cd62 100644 --- a/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp +++ b/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp @@ -32,6 +32,7 @@ ****************************************************************************/ #include "qwaylandshmbackingstore_p.h" #include "qwaylandwindow_p.h" +#include "qwaylandsubsurface_p.h" #include "qwaylanddisplay_p.h" #include "qwaylandscreen_p.h" #include "qwaylandabstractdecoration_p.h" @@ -174,8 +175,13 @@ void QWaylandShmBackingStore::beginPaint(const QRegion &) ensureSize(); QWaylandWindow *window = waylandWindow(); - if (window->attached() && mBackBuffer == window->attached() && mFrameCallback) + QWaylandSubSurface *sub = window->subSurfaceWindow(); + + bool waiting = window->attached() && mBackBuffer == window->attached() && mFrameCallback; + bool syncSubSurface = sub && sub->isSync(); + if (waiting && !syncSubSurface) { window->waitForFrameSync(); + } window->setCanResize(false); } @@ -219,34 +225,47 @@ void QWaylandShmBackingStore::flush(QWindow *window, const QRegion ®ion, cons mFrontBuffer = mBackBuffer; + QWaylandWindow *w = waylandWindow(); + bool synchModeSubSurface = w->subSurfaceWindow() && w->subSurfaceWindow()->isSync(); + if (mFrameCallback) { - mFrontBufferIsDirty = true; - return; + if (synchModeSubSurface) { + wl_callback_destroy(mFrameCallback); + mFrameCallback = Q_NULLPTR; + } else { + mFrontBufferIsDirty = true; + return; + } } - mFrameCallback = waylandWindow()->frame(); - wl_callback_add_listener(mFrameCallback,&frameCallbackListener,this); - QMargins margins = windowDecorationMargins(); + // Dont acquire the frame callback as that will cause beginPaint + // to block in waiting for frame sync since the damage will trigger + // its own sync request + if (!synchModeSubSurface) { + mFrameCallback = w->frame(); + wl_callback_add_listener(mFrameCallback, &frameCallbackListener, this); + } + QMargins margins = windowDecorationMargins(); bool damageAll = false; - if (waylandWindow()->attached() != mFrontBuffer) { - delete waylandWindow()->attached(); + if (w->attached() != mFrontBuffer) { + delete w->attached(); damageAll = true; } - waylandWindow()->attachOffset(mFrontBuffer); + w->attachOffset(mFrontBuffer); if (damageAll) { //need to damage it all, otherwise the attach offset may screw up - waylandWindow()->damage(QRect(QPoint(0,0), window->size())); + w->damage(QRect(QPoint(0,0), window->size())); } else { QVector rects = region.rects(); for (int i = 0; i < rects.size(); i++) { QRect rect = rects.at(i); rect.translate(margins.left(),margins.top()); - waylandWindow()->damage(rect); + w->damage(rect); } } - waylandWindow()->commit(); + w->commit(); mFrontBufferIsDirty = false; } From 53326bfa3fabb0f90109093a0f127f2422fdc888 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Mon, 11 Jan 2016 15:13:07 +0100 Subject: [PATCH 0286/1507] Fix the control key Let Ctrl+A cause a key event with text Ctrl+A (0x01), like we do on the other platforms. Previously we would use 'A', which would confuse some applications. Task-number: QTBUG-50398 Change-Id: Ie3def4bd9c96e538b2572b88fae029d347e08814 Reviewed-by: Pier Luigi Fiorini --- src/plugins/platforms/wayland/qwaylandinputdevice.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index 9ac678c93b5..567620ba50d 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -645,6 +645,13 @@ void QWaylandInputDevice::Keyboard::keyboard_key(uint32_t serial, uint32_t time, qtkey = QWaylandXkb::keysymToQtKey(sym, modifiers, text); + + // Map control + letter to proper text + if (utf32 >= 'A' && utf32 <= '~' && (modifiers & Qt::ControlModifier)) { + utf32 &= ~0x60; + text = QString::fromUcs4(&utf32, 1); + } + QWindowSystemInterface::handleExtendedKeyEvent(window->window(), time, type, qtkey, modifiers, From 4c0a1bc3b0bb64f131cdeda265c1d038cd5b9ecf Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Mon, 11 Jan 2016 14:28:24 +0100 Subject: [PATCH 0287/1507] Don't create wl_surface for desktop widgets Change-Id: I3ebcb49a4acf230b9515c0317aab2307dcb9270b Reviewed-by: Pier Luigi Fiorini --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index ed7b656d903..fe0d6bb9516 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -88,8 +88,8 @@ QWaylandWindow::QWaylandWindow(QWindow *window) { static WId id = 1; mWindowId = id++; - - initWindow(); + if (window->type() != Qt::Desktop) + initWindow(); } QWaylandWindow::~QWaylandWindow() From ab9b67b140f94e0d8bc7320bbbb35c8dbd8296d2 Mon Sep 17 00:00:00 2001 From: Pier Luigi Fiorini Date: Sat, 29 Aug 2015 18:17:00 +0200 Subject: [PATCH 0288/1507] Set appId according to QGuiApplication::desktopFileName() Since qtbase 61ad604ad41607be97efea5a18cd4d9fb7ddca73, QGuiApplication has got a new property: desktopFileName. Applications can now specify the desktop file name. In that case we have a reliable information: use it for the appId removing the ".desktop" suffix. Otherwise, just use the logic we previously established. Change-Id: I03c89009620b33bc68ee97ed414cfee1c1794632 Reviewed-by: Paul Olav Tvete --- .../platforms/wayland/qwaylandwindow.cpp | 41 ++++++++++++------- 1 file changed, 26 insertions(+), 15 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 5c06f66dbd2..097320c5bed 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -50,6 +50,7 @@ #include #include +#include #include #include @@ -131,22 +132,32 @@ void QWaylandWindow::initWindow() mShellSurface->setTitle(window()->title()); // The appId is the desktop entry identifier that should follow the - // reverse DNS convention (see http://standards.freedesktop.org/desktop-entry-spec/latest/ar01s02.html), - // use the application domain if available, otherwise the executable base name. - // According to xdg-shell the appId is only the name, without the .desktop suffix. - QFileInfo fi = QCoreApplication::instance()->applicationFilePath(); - QStringList domainName = - QCoreApplication::instance()->organizationDomain().split(QLatin1Char('.'), - QString::SkipEmptyParts); - - if (domainName.isEmpty()) { - mShellSurface->setAppId(fi.baseName()); + // reverse DNS convention (see http://standards.freedesktop.org/desktop-entry-spec/latest/ar01s02.html). + // According to xdg-shell the appId is only the name, without + // the .desktop suffix. + // + // If the application specifies the desktop file name use that + // removing the ".desktop" suffix, otherwise fall back to the + // executable name and prepend the reversed organization domain + // when available. + if (!QGuiApplication::desktopFileName().isEmpty()) { + QString name = QGuiApplication::desktopFileName(); + mShellSurface->setAppId(name.replace(QRegularExpression(QLatin1String("\\.desktop$")), QString())); } else { - QString appId; - for (int i = 0; i < domainName.count(); ++i) - appId.prepend(QLatin1Char('.')).prepend(domainName.at(i)); - appId.append(fi.baseName()); - mShellSurface->setAppId(appId); + QFileInfo fi = QCoreApplication::instance()->applicationFilePath(); + QStringList domainName = + QCoreApplication::instance()->organizationDomain().split(QLatin1Char('.'), + QString::SkipEmptyParts); + + if (domainName.isEmpty()) { + mShellSurface->setAppId(fi.baseName()); + } else { + QString appId; + for (int i = 0; i < domainName.count(); ++i) + appId.prepend(QLatin1Char('.')).prepend(domainName.at(i)); + appId.append(fi.baseName()); + mShellSurface->setAppId(appId); + } } } From 08a9a13b4a0c8e52530270d54bf51738011c34f6 Mon Sep 17 00:00:00 2001 From: Antti Kokko Date: Wed, 20 Jan 2016 09:03:21 +0200 Subject: [PATCH 0289/1507] Updated license headers From Qt 5.7 -> LGPL v2.1 isn't an option anymore, see http://blog.qt.io/blog/2016/01/13/new-agreement-with-the-kde-free-qt-foundation/ Updated license headers to use new LGPL header instead of LGPL21 one (in those files which will be under LGPL v3) Change-Id: I76ae5d3e64f096eb3163d6163a38d68c7c1ca756 Reviewed-by: Lars Knoll --- .../qwaylandclientbufferintegration.cpp | 34 ++++++++++-------- .../qwaylandclientbufferintegration_p.h | 34 ++++++++++-------- ...qwaylandclientbufferintegrationfactory.cpp | 34 ++++++++++-------- ...qwaylandclientbufferintegrationfactory_p.h | 34 ++++++++++-------- .../qwaylandclientbufferintegrationplugin.cpp | 34 ++++++++++-------- .../qwaylandclientbufferintegrationplugin_p.h | 34 ++++++++++-------- .../qwaylandhardwareintegration.cpp | 34 ++++++++++-------- .../qwaylandhardwareintegration_p.h | 34 ++++++++++-------- .../qwaylandserverbufferintegration.cpp | 34 ++++++++++-------- .../qwaylandserverbufferintegration_p.h | 34 ++++++++++-------- ...qwaylandserverbufferintegrationfactory.cpp | 34 ++++++++++-------- ...qwaylandserverbufferintegrationfactory_p.h | 34 ++++++++++-------- .../qwaylandserverbufferintegrationplugin.cpp | 34 ++++++++++-------- .../qwaylandserverbufferintegrationplugin_p.h | 34 ++++++++++-------- .../qwaylandinputdeviceintegration_p.h | 34 ++++++++++-------- .../qwaylandinputdeviceintegrationfactory.cpp | 34 ++++++++++-------- .../qwaylandinputdeviceintegrationfactory_p.h | 34 ++++++++++-------- .../qwaylandinputdeviceintegrationplugin.cpp | 34 ++++++++++-------- .../qwaylandinputdeviceintegrationplugin_p.h | 34 ++++++++++-------- .../plugins/decorations/bradient/main.cpp | 36 +++++++++++-------- .../hardwareintegration/brcm-egl/main.cpp | 34 ++++++++++-------- .../drm-egl-server/main.cpp | 34 ++++++++++-------- .../libhybris-egl-server/main.cpp | 34 ++++++++++-------- .../hardwareintegration/wayland-egl/main.cpp | 34 ++++++++++-------- .../xcomposite-egl/main.cpp | 34 ++++++++++-------- .../xcomposite-glx/main.cpp | 34 ++++++++++-------- .../wayland/qwaylandabstractdecoration.cpp | 36 +++++++++++-------- .../wayland/qwaylandabstractdecoration_p.h | 36 +++++++++++-------- .../platforms/wayland/qwaylandbuffer_p.h | 34 ++++++++++-------- .../wayland/qwaylandclientexport_p.h | 34 ++++++++++-------- .../platforms/wayland/qwaylandclipboard.cpp | 34 ++++++++++-------- .../platforms/wayland/qwaylandclipboard_p.h | 34 ++++++++++-------- .../platforms/wayland/qwaylandcursor.cpp | 34 ++++++++++-------- .../platforms/wayland/qwaylandcursor_p.h | 34 ++++++++++-------- .../platforms/wayland/qwaylanddatadevice.cpp | 34 ++++++++++-------- .../platforms/wayland/qwaylanddatadevice_p.h | 34 ++++++++++-------- .../wayland/qwaylanddatadevicemanager.cpp | 34 ++++++++++-------- .../wayland/qwaylanddatadevicemanager_p.h | 34 ++++++++++-------- .../platforms/wayland/qwaylanddataoffer.cpp | 34 ++++++++++-------- .../platforms/wayland/qwaylanddataoffer_p.h | 34 ++++++++++-------- .../platforms/wayland/qwaylanddatasource.cpp | 34 ++++++++++-------- .../platforms/wayland/qwaylanddatasource_p.h | 34 ++++++++++-------- .../wayland/qwaylanddecorationfactory.cpp | 34 ++++++++++-------- .../wayland/qwaylanddecorationfactory_p.h | 34 ++++++++++-------- .../wayland/qwaylanddecorationplugin.cpp | 34 ++++++++++-------- .../wayland/qwaylanddecorationplugin_p.h | 34 ++++++++++-------- .../platforms/wayland/qwaylanddisplay.cpp | 34 ++++++++++-------- .../platforms/wayland/qwaylanddisplay_p.h | 34 ++++++++++-------- src/plugins/platforms/wayland/qwaylanddnd.cpp | 34 ++++++++++-------- src/plugins/platforms/wayland/qwaylanddnd_p.h | 34 ++++++++++-------- .../wayland/qwaylandextendedsurface.cpp | 34 ++++++++++-------- .../wayland/qwaylandextendedsurface_p.h | 34 ++++++++++-------- .../wayland/qwaylandinputcontext.cpp | 34 ++++++++++-------- .../wayland/qwaylandinputcontext_p.h | 34 ++++++++++-------- .../platforms/wayland/qwaylandinputdevice.cpp | 34 ++++++++++-------- .../platforms/wayland/qwaylandinputdevice_p.h | 34 ++++++++++-------- .../platforms/wayland/qwaylandintegration.cpp | 34 ++++++++++-------- .../platforms/wayland/qwaylandintegration_p.h | 34 ++++++++++-------- .../wayland/qwaylandnativeinterface.cpp | 34 ++++++++++-------- .../wayland/qwaylandnativeinterface_p.h | 34 ++++++++++-------- .../platforms/wayland/qwaylandqtkey.cpp | 34 ++++++++++-------- .../platforms/wayland/qwaylandqtkey_p.h | 34 ++++++++++-------- .../platforms/wayland/qwaylandscreen.cpp | 34 ++++++++++-------- .../platforms/wayland/qwaylandscreen_p.h | 34 ++++++++++-------- .../wayland/qwaylandshellsurface.cpp | 34 ++++++++++-------- .../wayland/qwaylandshellsurface_p.h | 34 ++++++++++-------- src/plugins/platforms/wayland/qwaylandshm.cpp | 34 ++++++++++-------- src/plugins/platforms/wayland/qwaylandshm_p.h | 34 ++++++++++-------- .../wayland/qwaylandshmbackingstore.cpp | 34 ++++++++++-------- .../wayland/qwaylandshmbackingstore_p.h | 34 ++++++++++-------- .../platforms/wayland/qwaylandshmwindow.cpp | 34 ++++++++++-------- .../platforms/wayland/qwaylandshmwindow_p.h | 34 ++++++++++-------- .../platforms/wayland/qwaylandsubsurface.cpp | 34 ++++++++++-------- .../platforms/wayland/qwaylandsubsurface_p.h | 34 ++++++++++-------- .../platforms/wayland/qwaylandtouch.cpp | 34 ++++++++++-------- .../platforms/wayland/qwaylandtouch_p.h | 34 ++++++++++-------- .../platforms/wayland/qwaylandwindow.cpp | 34 ++++++++++-------- .../platforms/wayland/qwaylandwindow_p.h | 34 ++++++++++-------- .../qwaylandwindowmanagerintegration.cpp | 34 ++++++++++-------- .../qwaylandwindowmanagerintegration_p.h | 34 ++++++++++-------- .../wayland/qwaylandwlshellsurface.cpp | 34 ++++++++++-------- .../wayland/qwaylandwlshellsurface_p.h | 34 ++++++++++-------- .../platforms/wayland/qwaylandxdgshell.cpp | 34 ++++++++++-------- .../platforms/wayland/qwaylandxdgshell_p.h | 34 ++++++++++-------- .../platforms/wayland/qwaylandxdgsurface.cpp | 34 ++++++++++-------- .../platforms/wayland/qwaylandxdgsurface_p.h | 34 ++++++++++-------- .../wayland/shared/qwaylandmimehelper.cpp | 34 ++++++++++-------- .../wayland/shared/qwaylandmimehelper.h | 34 ++++++++++-------- .../wayland/shared/qwaylandshmformathelper.h | 34 ++++++++++-------- .../platforms/wayland/shared/qwaylandxkb.cpp | 34 ++++++++++-------- .../platforms/wayland/shared/qwaylandxkb.h | 34 ++++++++++-------- .../qwaylandshellintegration_p.h | 34 ++++++++++-------- .../qwaylandshellintegrationfactory.cpp | 34 ++++++++++-------- .../qwaylandshellintegrationfactory_p.h | 34 ++++++++++-------- .../qwaylandshellintegrationplugin.cpp | 34 ++++++++++-------- .../qwaylandshellintegrationplugin_p.h | 34 ++++++++++-------- .../qtwaylandscanner/qtwaylandscanner.cpp | 34 ++++++++++-------- 97 files changed, 1943 insertions(+), 1361 deletions(-) diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegration.cpp b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegration.cpp index e6ac1b1f3ed..61a2c1cdbea 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegration.cpp +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegration.cpp @@ -1,31 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegration_p.h b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegration_p.h index 9534934fa27..342742c3e65 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegration_p.h +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegration_p.h @@ -1,31 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationfactory.cpp b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationfactory.cpp index a8d2902be3e..aa197e3d104 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationfactory.cpp +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationfactory.cpp @@ -1,31 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationfactory_p.h b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationfactory_p.h index 54590a29adb..0a5d3561632 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationfactory_p.h +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationfactory_p.h @@ -1,31 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationplugin.cpp b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationplugin.cpp index 2f6357a31f4..7aae1d0c418 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationplugin.cpp +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationplugin.cpp @@ -1,31 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationplugin_p.h b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationplugin_p.h index dae7aa00908..39a0379674d 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationplugin_p.h +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationplugin_p.h @@ -1,31 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandhardwareintegration.cpp b/src/plugins/platforms/wayland/hardwareintegration/qwaylandhardwareintegration.cpp index a946027b65c..04340da140d 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandhardwareintegration.cpp +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandhardwareintegration.cpp @@ -1,31 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandhardwareintegration_p.h b/src/plugins/platforms/wayland/hardwareintegration/qwaylandhardwareintegration_p.h index 466f0b20bbb..3b8028eac8c 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandhardwareintegration_p.h +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandhardwareintegration_p.h @@ -1,31 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegration.cpp b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegration.cpp index 347de3d2155..1d64e0f51bf 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegration.cpp +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegration.cpp @@ -1,31 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegration_p.h b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegration_p.h index ad28355992a..11ea36bc9b2 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegration_p.h +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegration_p.h @@ -1,31 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationfactory.cpp b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationfactory.cpp index 1f5a97d8a5f..dfa0b465485 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationfactory.cpp +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationfactory.cpp @@ -1,31 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationfactory_p.h b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationfactory_p.h index 4eeb371697d..91871fad2c7 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationfactory_p.h +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationfactory_p.h @@ -1,31 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationplugin.cpp b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationplugin.cpp index 641e63ac12e..cff72e7a349 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationplugin.cpp +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationplugin.cpp @@ -1,31 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationplugin_p.h b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationplugin_p.h index 5d0d5d2fdb4..8a074fb21b1 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationplugin_p.h +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationplugin_p.h @@ -1,31 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegration_p.h b/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegration_p.h index f3c59c898a3..c2cc0f212bb 100644 --- a/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegration_p.h +++ b/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegration_p.h @@ -1,31 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2014 LG Electronics Ltd -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 LG Electronics Ltd +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationfactory.cpp b/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationfactory.cpp index 143facfcabe..de303d009c2 100644 --- a/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationfactory.cpp +++ b/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationfactory.cpp @@ -1,31 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2014 LG Electronics Ltd -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 LG Electronics Ltd +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationfactory_p.h b/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationfactory_p.h index 69ab61cf8d8..4431529ff8e 100644 --- a/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationfactory_p.h +++ b/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationfactory_p.h @@ -1,31 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2014 LG Electronics Ltd -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 LG Electronics Ltd +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationplugin.cpp b/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationplugin.cpp index 9fc9b8045a0..57909576721 100644 --- a/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationplugin.cpp +++ b/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationplugin.cpp @@ -1,31 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2014 LG Electronics Ltd -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 LG Electronics Ltd +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationplugin_p.h b/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationplugin_p.h index 0cb89ebac2c..cea178c49cc 100644 --- a/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationplugin_p.h +++ b/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationplugin_p.h @@ -1,31 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2014 LG Electronics Ltd -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 LG Electronics Ltd +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp b/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp index ea298699385..b7381aeac7e 100644 --- a/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp +++ b/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp @@ -1,32 +1,38 @@ /**************************************************************************** ** -** Copyright (C) 2014 Robin Burchell -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 Robin Burchell +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/main.cpp b/src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/main.cpp index 68befb44bce..ea66995d45f 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/main.cpp +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/main.cpp @@ -1,31 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/drm-egl-server/main.cpp b/src/plugins/platforms/wayland/plugins/hardwareintegration/drm-egl-server/main.cpp index ef9126633bb..9149d588caa 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/drm-egl-server/main.cpp +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/drm-egl-server/main.cpp @@ -1,31 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/libhybris-egl-server/main.cpp b/src/plugins/platforms/wayland/plugins/hardwareintegration/libhybris-egl-server/main.cpp index e51c4bfb5cd..deef13e8328 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/libhybris-egl-server/main.cpp +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/libhybris-egl-server/main.cpp @@ -1,31 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2014 Jolla Ltd, author: -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 Jolla Ltd, author: +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/main.cpp b/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/main.cpp index 3830e705bc5..364e18affcd 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/main.cpp +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/main.cpp @@ -1,31 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-egl/main.cpp b/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-egl/main.cpp index 4290fe28a14..ea4f397053b 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-egl/main.cpp +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-egl/main.cpp @@ -1,31 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-glx/main.cpp b/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-glx/main.cpp index 792894232d0..0a04f716c27 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-glx/main.cpp +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-glx/main.cpp @@ -1,31 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/src/plugins/platforms/wayland/qwaylandabstractdecoration.cpp b/src/plugins/platforms/wayland/qwaylandabstractdecoration.cpp index 3f9852b2071..8ac2cabfa3d 100644 --- a/src/plugins/platforms/wayland/qwaylandabstractdecoration.cpp +++ b/src/plugins/platforms/wayland/qwaylandabstractdecoration.cpp @@ -1,32 +1,38 @@ /**************************************************************************** ** -** Copyright (C) 2014 Robin Burchell -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 Robin Burchell +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/src/plugins/platforms/wayland/qwaylandabstractdecoration_p.h b/src/plugins/platforms/wayland/qwaylandabstractdecoration_p.h index ff4ea45a8ca..6e4113efff8 100644 --- a/src/plugins/platforms/wayland/qwaylandabstractdecoration_p.h +++ b/src/plugins/platforms/wayland/qwaylandabstractdecoration_p.h @@ -1,32 +1,38 @@ /**************************************************************************** ** -** Copyright (C) 2014 Robin Burchell -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 Robin Burchell +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/src/plugins/platforms/wayland/qwaylandbuffer_p.h b/src/plugins/platforms/wayland/qwaylandbuffer_p.h index 6f8f7b269a9..631439f736e 100644 --- a/src/plugins/platforms/wayland/qwaylandbuffer_p.h +++ b/src/plugins/platforms/wayland/qwaylandbuffer_p.h @@ -1,31 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/src/plugins/platforms/wayland/qwaylandclientexport_p.h b/src/plugins/platforms/wayland/qwaylandclientexport_p.h index 2938025f0b5..f49f1aee9a4 100644 --- a/src/plugins/platforms/wayland/qwaylandclientexport_p.h +++ b/src/plugins/platforms/wayland/qwaylandclientexport_p.h @@ -1,31 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/src/plugins/platforms/wayland/qwaylandclipboard.cpp b/src/plugins/platforms/wayland/qwaylandclipboard.cpp index a2b7a6697de..2e3c204c406 100644 --- a/src/plugins/platforms/wayland/qwaylandclipboard.cpp +++ b/src/plugins/platforms/wayland/qwaylandclipboard.cpp @@ -1,31 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/src/plugins/platforms/wayland/qwaylandclipboard_p.h b/src/plugins/platforms/wayland/qwaylandclipboard_p.h index 02223076e1f..08d4baabdc6 100644 --- a/src/plugins/platforms/wayland/qwaylandclipboard_p.h +++ b/src/plugins/platforms/wayland/qwaylandclipboard_p.h @@ -1,31 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/src/plugins/platforms/wayland/qwaylandcursor.cpp b/src/plugins/platforms/wayland/qwaylandcursor.cpp index a76e05a9ab3..f96b5c1e148 100644 --- a/src/plugins/platforms/wayland/qwaylandcursor.cpp +++ b/src/plugins/platforms/wayland/qwaylandcursor.cpp @@ -1,31 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/src/plugins/platforms/wayland/qwaylandcursor_p.h b/src/plugins/platforms/wayland/qwaylandcursor_p.h index 0cc1173f8f9..52924f11e57 100644 --- a/src/plugins/platforms/wayland/qwaylandcursor_p.h +++ b/src/plugins/platforms/wayland/qwaylandcursor_p.h @@ -1,31 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/src/plugins/platforms/wayland/qwaylanddatadevice.cpp b/src/plugins/platforms/wayland/qwaylanddatadevice.cpp index 42ab2293a3e..2ab8d8728aa 100644 --- a/src/plugins/platforms/wayland/qwaylanddatadevice.cpp +++ b/src/plugins/platforms/wayland/qwaylanddatadevice.cpp @@ -1,31 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2013 Klarälvdalens Datakonsult AB (KDAB). -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 Klarälvdalens Datakonsult AB (KDAB). +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the QtWaylandClient module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/src/plugins/platforms/wayland/qwaylanddatadevice_p.h b/src/plugins/platforms/wayland/qwaylanddatadevice_p.h index 37fe00d4e29..4d229ad25ed 100644 --- a/src/plugins/platforms/wayland/qwaylanddatadevice_p.h +++ b/src/plugins/platforms/wayland/qwaylanddatadevice_p.h @@ -1,31 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2013 Klarälvdalens Datakonsult AB (KDAB). -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 Klarälvdalens Datakonsult AB (KDAB). +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the QtWaylandClient module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/src/plugins/platforms/wayland/qwaylanddatadevicemanager.cpp b/src/plugins/platforms/wayland/qwaylanddatadevicemanager.cpp index b5a98b090e7..35d67307fc3 100644 --- a/src/plugins/platforms/wayland/qwaylanddatadevicemanager.cpp +++ b/src/plugins/platforms/wayland/qwaylanddatadevicemanager.cpp @@ -1,31 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/src/plugins/platforms/wayland/qwaylanddatadevicemanager_p.h b/src/plugins/platforms/wayland/qwaylanddatadevicemanager_p.h index 85b4b3f7444..36060529300 100644 --- a/src/plugins/platforms/wayland/qwaylanddatadevicemanager_p.h +++ b/src/plugins/platforms/wayland/qwaylanddatadevicemanager_p.h @@ -1,31 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/src/plugins/platforms/wayland/qwaylanddataoffer.cpp b/src/plugins/platforms/wayland/qwaylanddataoffer.cpp index 167b647d6aa..2491c658b12 100644 --- a/src/plugins/platforms/wayland/qwaylanddataoffer.cpp +++ b/src/plugins/platforms/wayland/qwaylanddataoffer.cpp @@ -1,31 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/src/plugins/platforms/wayland/qwaylanddataoffer_p.h b/src/plugins/platforms/wayland/qwaylanddataoffer_p.h index b22681f7adb..534d79d7faa 100644 --- a/src/plugins/platforms/wayland/qwaylanddataoffer_p.h +++ b/src/plugins/platforms/wayland/qwaylanddataoffer_p.h @@ -1,31 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/src/plugins/platforms/wayland/qwaylanddatasource.cpp b/src/plugins/platforms/wayland/qwaylanddatasource.cpp index ad43b0698b7..32aab082390 100644 --- a/src/plugins/platforms/wayland/qwaylanddatasource.cpp +++ b/src/plugins/platforms/wayland/qwaylanddatasource.cpp @@ -1,31 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/src/plugins/platforms/wayland/qwaylanddatasource_p.h b/src/plugins/platforms/wayland/qwaylanddatasource_p.h index c753c4f6e32..ec3f0aacc63 100644 --- a/src/plugins/platforms/wayland/qwaylanddatasource_p.h +++ b/src/plugins/platforms/wayland/qwaylanddatasource_p.h @@ -1,31 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/src/plugins/platforms/wayland/qwaylanddecorationfactory.cpp b/src/plugins/platforms/wayland/qwaylanddecorationfactory.cpp index 7e77b231861..43c712fc092 100644 --- a/src/plugins/platforms/wayland/qwaylanddecorationfactory.cpp +++ b/src/plugins/platforms/wayland/qwaylanddecorationfactory.cpp @@ -1,31 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2014 Robin Burchell -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 Robin Burchell +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/src/plugins/platforms/wayland/qwaylanddecorationfactory_p.h b/src/plugins/platforms/wayland/qwaylanddecorationfactory_p.h index 0a0e09d6486..4797f2336f5 100644 --- a/src/plugins/platforms/wayland/qwaylanddecorationfactory_p.h +++ b/src/plugins/platforms/wayland/qwaylanddecorationfactory_p.h @@ -1,31 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2014 Robin Burchell -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 Robin Burchell +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/src/plugins/platforms/wayland/qwaylanddecorationplugin.cpp b/src/plugins/platforms/wayland/qwaylanddecorationplugin.cpp index bf7eca816b3..15d907de940 100644 --- a/src/plugins/platforms/wayland/qwaylanddecorationplugin.cpp +++ b/src/plugins/platforms/wayland/qwaylanddecorationplugin.cpp @@ -1,31 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2014 Robin Burchell -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 Robin Burchell +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/src/plugins/platforms/wayland/qwaylanddecorationplugin_p.h b/src/plugins/platforms/wayland/qwaylanddecorationplugin_p.h index 762274e3275..c5baa83f755 100644 --- a/src/plugins/platforms/wayland/qwaylanddecorationplugin_p.h +++ b/src/plugins/platforms/wayland/qwaylanddecorationplugin_p.h @@ -1,31 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2014 Robin Burchell -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 Robin Burchell +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index 82c1f201e72..7244363cd08 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -1,31 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/src/plugins/platforms/wayland/qwaylanddisplay_p.h b/src/plugins/platforms/wayland/qwaylanddisplay_p.h index 65e91439566..a1e71acc332 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay_p.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay_p.h @@ -1,31 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/src/plugins/platforms/wayland/qwaylanddnd.cpp b/src/plugins/platforms/wayland/qwaylanddnd.cpp index e195d193a41..a84b749e6aa 100644 --- a/src/plugins/platforms/wayland/qwaylanddnd.cpp +++ b/src/plugins/platforms/wayland/qwaylanddnd.cpp @@ -1,31 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/src/plugins/platforms/wayland/qwaylanddnd_p.h b/src/plugins/platforms/wayland/qwaylanddnd_p.h index e978563a760..29424375316 100644 --- a/src/plugins/platforms/wayland/qwaylanddnd_p.h +++ b/src/plugins/platforms/wayland/qwaylanddnd_p.h @@ -1,31 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/src/plugins/platforms/wayland/qwaylandextendedsurface.cpp b/src/plugins/platforms/wayland/qwaylandextendedsurface.cpp index d446b7845e4..c5db6d7baf2 100644 --- a/src/plugins/platforms/wayland/qwaylandextendedsurface.cpp +++ b/src/plugins/platforms/wayland/qwaylandextendedsurface.cpp @@ -1,31 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/src/plugins/platforms/wayland/qwaylandextendedsurface_p.h b/src/plugins/platforms/wayland/qwaylandextendedsurface_p.h index 2ed3a227616..c004a9f7b47 100644 --- a/src/plugins/platforms/wayland/qwaylandextendedsurface_p.h +++ b/src/plugins/platforms/wayland/qwaylandextendedsurface_p.h @@ -1,31 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/src/plugins/platforms/wayland/qwaylandinputcontext.cpp b/src/plugins/platforms/wayland/qwaylandinputcontext.cpp index b02e9f66807..00f6a43038f 100644 --- a/src/plugins/platforms/wayland/qwaylandinputcontext.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputcontext.cpp @@ -1,31 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2013 Klarälvdalens Datakonsult AB (KDAB). -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 Klarälvdalens Datakonsult AB (KDAB). +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the QtWaylandClient module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/src/plugins/platforms/wayland/qwaylandinputcontext_p.h b/src/plugins/platforms/wayland/qwaylandinputcontext_p.h index b106c100fdb..cdabfcca492 100644 --- a/src/plugins/platforms/wayland/qwaylandinputcontext_p.h +++ b/src/plugins/platforms/wayland/qwaylandinputcontext_p.h @@ -1,31 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2013 Klarälvdalens Datakonsult AB (KDAB). -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 Klarälvdalens Datakonsult AB (KDAB). +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the QtWaylandClient module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index 9ac678c93b5..e6237970a97 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -1,31 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h index 8bfb45cd403..f3db0df7871 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h +++ b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h @@ -1,31 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/src/plugins/platforms/wayland/qwaylandintegration.cpp b/src/plugins/platforms/wayland/qwaylandintegration.cpp index c04ddb61097..749b8d403b4 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandintegration.cpp @@ -1,31 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the config.tests of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/src/plugins/platforms/wayland/qwaylandintegration_p.h b/src/plugins/platforms/wayland/qwaylandintegration_p.h index 42bc287b5ad..630ac090bf6 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration_p.h +++ b/src/plugins/platforms/wayland/qwaylandintegration_p.h @@ -1,31 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp b/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp index 7df31bbc56b..bad64204b29 100644 --- a/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp +++ b/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp @@ -1,31 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/src/plugins/platforms/wayland/qwaylandnativeinterface_p.h b/src/plugins/platforms/wayland/qwaylandnativeinterface_p.h index 9ea62a90cbf..71194da33de 100644 --- a/src/plugins/platforms/wayland/qwaylandnativeinterface_p.h +++ b/src/plugins/platforms/wayland/qwaylandnativeinterface_p.h @@ -1,31 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/src/plugins/platforms/wayland/qwaylandqtkey.cpp b/src/plugins/platforms/wayland/qwaylandqtkey.cpp index 51534e60566..ce0d2124e77 100644 --- a/src/plugins/platforms/wayland/qwaylandqtkey.cpp +++ b/src/plugins/platforms/wayland/qwaylandqtkey.cpp @@ -1,31 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/src/plugins/platforms/wayland/qwaylandqtkey_p.h b/src/plugins/platforms/wayland/qwaylandqtkey_p.h index 2e9c7a255c6..c746dc92592 100644 --- a/src/plugins/platforms/wayland/qwaylandqtkey_p.h +++ b/src/plugins/platforms/wayland/qwaylandqtkey_p.h @@ -1,31 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/src/plugins/platforms/wayland/qwaylandscreen.cpp b/src/plugins/platforms/wayland/qwaylandscreen.cpp index 1be90e8e769..5dbfe5e9d98 100644 --- a/src/plugins/platforms/wayland/qwaylandscreen.cpp +++ b/src/plugins/platforms/wayland/qwaylandscreen.cpp @@ -1,31 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/src/plugins/platforms/wayland/qwaylandscreen_p.h b/src/plugins/platforms/wayland/qwaylandscreen_p.h index e3e1515d4fa..b4fa12e4717 100644 --- a/src/plugins/platforms/wayland/qwaylandscreen_p.h +++ b/src/plugins/platforms/wayland/qwaylandscreen_p.h @@ -1,31 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/src/plugins/platforms/wayland/qwaylandshellsurface.cpp b/src/plugins/platforms/wayland/qwaylandshellsurface.cpp index f90ed0597c2..91cc2c2c039 100644 --- a/src/plugins/platforms/wayland/qwaylandshellsurface.cpp +++ b/src/plugins/platforms/wayland/qwaylandshellsurface.cpp @@ -1,31 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the config.tests of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/src/plugins/platforms/wayland/qwaylandshellsurface_p.h b/src/plugins/platforms/wayland/qwaylandshellsurface_p.h index 726d103f9dd..053be3b5f9a 100644 --- a/src/plugins/platforms/wayland/qwaylandshellsurface_p.h +++ b/src/plugins/platforms/wayland/qwaylandshellsurface_p.h @@ -1,31 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the config.tests of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/src/plugins/platforms/wayland/qwaylandshm.cpp b/src/plugins/platforms/wayland/qwaylandshm.cpp index 1d7981477ad..137789679b0 100644 --- a/src/plugins/platforms/wayland/qwaylandshm.cpp +++ b/src/plugins/platforms/wayland/qwaylandshm.cpp @@ -1,31 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2015 LG Electronics Inc, author: -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 LG Electronics Inc, author: +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/src/plugins/platforms/wayland/qwaylandshm_p.h b/src/plugins/platforms/wayland/qwaylandshm_p.h index 10feae6a770..2f06b8b9d47 100644 --- a/src/plugins/platforms/wayland/qwaylandshm_p.h +++ b/src/plugins/platforms/wayland/qwaylandshm_p.h @@ -1,31 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2015 LG Electronics Inc, author: -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 LG Electronics Inc, author: +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp b/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp index 87205d4cd62..758faab6a82 100644 --- a/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp +++ b/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp @@ -1,31 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/src/plugins/platforms/wayland/qwaylandshmbackingstore_p.h b/src/plugins/platforms/wayland/qwaylandshmbackingstore_p.h index a1a6e19c3ce..44047909a39 100644 --- a/src/plugins/platforms/wayland/qwaylandshmbackingstore_p.h +++ b/src/plugins/platforms/wayland/qwaylandshmbackingstore_p.h @@ -1,31 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/src/plugins/platforms/wayland/qwaylandshmwindow.cpp b/src/plugins/platforms/wayland/qwaylandshmwindow.cpp index 2d34d6e6147..52833803db1 100644 --- a/src/plugins/platforms/wayland/qwaylandshmwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandshmwindow.cpp @@ -1,31 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the config.tests of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/src/plugins/platforms/wayland/qwaylandshmwindow_p.h b/src/plugins/platforms/wayland/qwaylandshmwindow_p.h index a0a5edffd4a..2e5e0bcb59d 100644 --- a/src/plugins/platforms/wayland/qwaylandshmwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandshmwindow_p.h @@ -1,31 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the config.tests of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/src/plugins/platforms/wayland/qwaylandsubsurface.cpp b/src/plugins/platforms/wayland/qwaylandsubsurface.cpp index eac847c7586..4093805323f 100644 --- a/src/plugins/platforms/wayland/qwaylandsubsurface.cpp +++ b/src/plugins/platforms/wayland/qwaylandsubsurface.cpp @@ -1,31 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/src/plugins/platforms/wayland/qwaylandsubsurface_p.h b/src/plugins/platforms/wayland/qwaylandsubsurface_p.h index b8ea6aaf3f1..b5f869bf2e2 100644 --- a/src/plugins/platforms/wayland/qwaylandsubsurface_p.h +++ b/src/plugins/platforms/wayland/qwaylandsubsurface_p.h @@ -1,31 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/src/plugins/platforms/wayland/qwaylandtouch.cpp b/src/plugins/platforms/wayland/qwaylandtouch.cpp index 987f18cd1e0..f5521a31c72 100644 --- a/src/plugins/platforms/wayland/qwaylandtouch.cpp +++ b/src/plugins/platforms/wayland/qwaylandtouch.cpp @@ -1,31 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/src/plugins/platforms/wayland/qwaylandtouch_p.h b/src/plugins/platforms/wayland/qwaylandtouch_p.h index 394ae6d3652..8aa06d3ec4a 100644 --- a/src/plugins/platforms/wayland/qwaylandtouch_p.h +++ b/src/plugins/platforms/wayland/qwaylandtouch_p.h @@ -1,31 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 097320c5bed..5d5e6687a7b 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -1,31 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the config.tests of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index be8f53088dd..30d158d30b0 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -1,31 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the config.tests of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration.cpp b/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration.cpp index 5e8a628bf85..60825aec29b 100644 --- a/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration.cpp @@ -1,31 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration_p.h b/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration_p.h index 73c1b29e8a6..344960d5799 100644 --- a/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration_p.h @@ -1,31 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/src/plugins/platforms/wayland/qwaylandwlshellsurface.cpp b/src/plugins/platforms/wayland/qwaylandwlshellsurface.cpp index 7235931d3bc..5aae260cecb 100644 --- a/src/plugins/platforms/wayland/qwaylandwlshellsurface.cpp +++ b/src/plugins/platforms/wayland/qwaylandwlshellsurface.cpp @@ -1,31 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the config.tests of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/src/plugins/platforms/wayland/qwaylandwlshellsurface_p.h b/src/plugins/platforms/wayland/qwaylandwlshellsurface_p.h index 78216a4c32a..1da64e9d7ef 100644 --- a/src/plugins/platforms/wayland/qwaylandwlshellsurface_p.h +++ b/src/plugins/platforms/wayland/qwaylandwlshellsurface_p.h @@ -1,31 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the config.tests of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/src/plugins/platforms/wayland/qwaylandxdgshell.cpp b/src/plugins/platforms/wayland/qwaylandxdgshell.cpp index 65fafcead77..3831298635b 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgshell.cpp +++ b/src/plugins/platforms/wayland/qwaylandxdgshell.cpp @@ -1,31 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2014 Eurogiciel, author: -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 Eurogiciel, author: +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the config.tests of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/src/plugins/platforms/wayland/qwaylandxdgshell_p.h b/src/plugins/platforms/wayland/qwaylandxdgshell_p.h index 3fd248fc462..2b5a8eb8b6d 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgshell_p.h +++ b/src/plugins/platforms/wayland/qwaylandxdgshell_p.h @@ -1,31 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2014 Eurogiciel, author: -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 Eurogiciel, author: +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the config.tests of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/src/plugins/platforms/wayland/qwaylandxdgsurface.cpp b/src/plugins/platforms/wayland/qwaylandxdgsurface.cpp index c89e230db66..51630af96f0 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgsurface.cpp +++ b/src/plugins/platforms/wayland/qwaylandxdgsurface.cpp @@ -1,31 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the config.tests of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/src/plugins/platforms/wayland/qwaylandxdgsurface_p.h b/src/plugins/platforms/wayland/qwaylandxdgsurface_p.h index 8deafef7756..9d6c8c410d2 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgsurface_p.h +++ b/src/plugins/platforms/wayland/qwaylandxdgsurface_p.h @@ -1,31 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the config.tests of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/src/plugins/platforms/wayland/shared/qwaylandmimehelper.cpp b/src/plugins/platforms/wayland/shared/qwaylandmimehelper.cpp index ce193812d7f..c223efbe5b4 100644 --- a/src/plugins/platforms/wayland/shared/qwaylandmimehelper.cpp +++ b/src/plugins/platforms/wayland/shared/qwaylandmimehelper.cpp @@ -1,31 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/src/plugins/platforms/wayland/shared/qwaylandmimehelper.h b/src/plugins/platforms/wayland/shared/qwaylandmimehelper.h index 5db0484a257..8048770502b 100644 --- a/src/plugins/platforms/wayland/shared/qwaylandmimehelper.h +++ b/src/plugins/platforms/wayland/shared/qwaylandmimehelper.h @@ -1,31 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/src/plugins/platforms/wayland/shared/qwaylandshmformathelper.h b/src/plugins/platforms/wayland/shared/qwaylandshmformathelper.h index 2923e0106e5..58db42e26f2 100644 --- a/src/plugins/platforms/wayland/shared/qwaylandshmformathelper.h +++ b/src/plugins/platforms/wayland/shared/qwaylandshmformathelper.h @@ -1,31 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/src/plugins/platforms/wayland/shared/qwaylandxkb.cpp b/src/plugins/platforms/wayland/shared/qwaylandxkb.cpp index 16d713c0587..90d2c5027ed 100644 --- a/src/plugins/platforms/wayland/shared/qwaylandxkb.cpp +++ b/src/plugins/platforms/wayland/shared/qwaylandxkb.cpp @@ -1,32 +1,38 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Copyright (C) 2015 Jolla Ltd +** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2016 Jolla Ltd ** Contact: http://www.qt-project.org/legal ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/src/plugins/platforms/wayland/shared/qwaylandxkb.h b/src/plugins/platforms/wayland/shared/qwaylandxkb.h index 91e69ab0378..bfb38515f5f 100644 --- a/src/plugins/platforms/wayland/shared/qwaylandxkb.h +++ b/src/plugins/platforms/wayland/shared/qwaylandxkb.h @@ -1,32 +1,38 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Copyright (C) 2015 Jolla Ltd +** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2016 Jolla Ltd ** Contact: http://www.qt-project.org/legal ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegration_p.h b/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegration_p.h index f8e7415200c..8395c868ec5 100644 --- a/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegration_p.h +++ b/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegration_p.h @@ -1,31 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2014 Jolla Ltd -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 Jolla Ltd +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationfactory.cpp b/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationfactory.cpp index 1d901962caa..da622d13fba 100644 --- a/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationfactory.cpp +++ b/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationfactory.cpp @@ -1,31 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2014 Jolla Ltd -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 Jolla Ltd +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationfactory_p.h b/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationfactory_p.h index 7ec49521ce3..6e595b06dc7 100644 --- a/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationfactory_p.h +++ b/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationfactory_p.h @@ -1,31 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2014 Jolla Ltd -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 Jolla Ltd +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationplugin.cpp b/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationplugin.cpp index 330605672a1..d89e61fb1d4 100644 --- a/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationplugin.cpp +++ b/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationplugin.cpp @@ -1,31 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2014 Jolla Ltd -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 Jolla Ltd +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationplugin_p.h b/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationplugin_p.h index 9193fb071e8..5566843b109 100644 --- a/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationplugin_p.h +++ b/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationplugin_p.h @@ -1,31 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2014 Jolla Ltd -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 Jolla Ltd +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp index 11a713c8b3b..f748136595e 100644 --- a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp +++ b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp @@ -1,31 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the tools applications of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** From a38a6a7d9dc7cddfb2c46bdf9185f699903a141e Mon Sep 17 00:00:00 2001 From: Antti Kokko Date: Wed, 20 Jan 2016 09:13:51 +0200 Subject: [PATCH 0290/1507] Updated license headers From Qt 5.7 -> tools & applications are lisenced under GPL v3 with some exceptions, see http://blog.qt.io/blog/2016/01/13/new-agreement-with-the-kde-free-qt-foundation/ Updated license headers to use new GPL-EXCEPT header instead of LGPL21 one (in those files which will be under GPL 3 with exceptions) Change-Id: Ifa334d2d3487e413e90ba9f2bf377026076b2df1 Reviewed-by: Lars Knoll --- tests/auto/wayland/mockcompositor.cpp | 29 +++++++++++-------------- tests/auto/wayland/mockcompositor.h | 29 +++++++++++-------------- tests/auto/wayland/mockinput.cpp | 29 +++++++++++-------------- tests/auto/wayland/mockinput.h | 31 +++++++++++---------------- tests/auto/wayland/mockoutput.cpp | 29 +++++++++++-------------- tests/auto/wayland/mockshell.cpp | 29 +++++++++++-------------- tests/auto/wayland/mocksurface.cpp | 29 +++++++++++-------------- tests/auto/wayland/mocksurface.h | 29 +++++++++++-------------- tests/auto/wayland/tst_client.cpp | 29 +++++++++++-------------- 9 files changed, 109 insertions(+), 154 deletions(-) diff --git a/tests/auto/wayland/mockcompositor.cpp b/tests/auto/wayland/mockcompositor.cpp index 2f73734f181..9fe02629dc9 100644 --- a/tests/auto/wayland/mockcompositor.cpp +++ b/tests/auto/wayland/mockcompositor.cpp @@ -1,31 +1,26 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the test suite of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/tests/auto/wayland/mockcompositor.h b/tests/auto/wayland/mockcompositor.h index cf3b270a28c..48b41069816 100644 --- a/tests/auto/wayland/mockcompositor.h +++ b/tests/auto/wayland/mockcompositor.h @@ -1,31 +1,26 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the test suite of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/tests/auto/wayland/mockinput.cpp b/tests/auto/wayland/mockinput.cpp index 5b1d4f4fda4..a4d42c103d3 100644 --- a/tests/auto/wayland/mockinput.cpp +++ b/tests/auto/wayland/mockinput.cpp @@ -1,31 +1,26 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the test suite of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/tests/auto/wayland/mockinput.h b/tests/auto/wayland/mockinput.h index 7d36a532594..eb9beb56413 100644 --- a/tests/auto/wayland/mockinput.h +++ b/tests/auto/wayland/mockinput.h @@ -1,32 +1,27 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Copyright (C) 2013 Klarälvdalens Datakonsult AB (KDAB). -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2016 Klarälvdalens Datakonsult AB (KDAB). +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the test suite of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/tests/auto/wayland/mockoutput.cpp b/tests/auto/wayland/mockoutput.cpp index 573de90b9cd..05738716047 100644 --- a/tests/auto/wayland/mockoutput.cpp +++ b/tests/auto/wayland/mockoutput.cpp @@ -1,31 +1,26 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the test suite of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/tests/auto/wayland/mockshell.cpp b/tests/auto/wayland/mockshell.cpp index dfc39e5e4d6..2ce5965a309 100644 --- a/tests/auto/wayland/mockshell.cpp +++ b/tests/auto/wayland/mockshell.cpp @@ -1,31 +1,26 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the test suite of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/tests/auto/wayland/mocksurface.cpp b/tests/auto/wayland/mocksurface.cpp index b6d338b29b6..749a1470dd1 100644 --- a/tests/auto/wayland/mocksurface.cpp +++ b/tests/auto/wayland/mocksurface.cpp @@ -1,31 +1,26 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the test suite of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/tests/auto/wayland/mocksurface.h b/tests/auto/wayland/mocksurface.h index 821d49f5447..d04386ac8b4 100644 --- a/tests/auto/wayland/mocksurface.h +++ b/tests/auto/wayland/mocksurface.h @@ -1,31 +1,26 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the test suite of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/tests/auto/wayland/tst_client.cpp b/tests/auto/wayland/tst_client.cpp index dd35b681cfb..9635c215f4e 100644 --- a/tests/auto/wayland/tst_client.cpp +++ b/tests/auto/wayland/tst_client.cpp @@ -1,31 +1,26 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the test suite of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** From 8a706c0a7e87798ae3263bd86ddd39d850f1d58c Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Fri, 29 Jan 2016 12:56:25 +0100 Subject: [PATCH 0291/1507] Add missing we mean it header Change-Id: I170089d87a56e56e12360a60bf76a142343b47f4 Reviewed-by: Pier Luigi Fiorini --- src/plugins/platforms/wayland/qwaylandshm_p.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/plugins/platforms/wayland/qwaylandshm_p.h b/src/plugins/platforms/wayland/qwaylandshm_p.h index 2f06b8b9d47..80d2b94923c 100644 --- a/src/plugins/platforms/wayland/qwaylandshm_p.h +++ b/src/plugins/platforms/wayland/qwaylandshm_p.h @@ -40,6 +40,17 @@ #ifndef QWAYLANDSHM_H #define QWAYLANDSHM_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include #include From fbbdcc1224281d45ec822741c1a0fade49a194cf Mon Sep 17 00:00:00 2001 From: Giulio Camuffo Date: Mon, 8 Feb 2016 18:26:00 +0200 Subject: [PATCH 0292/1507] Allow initializing the server protocol classes with a wl_resource Change-Id: I3efd23284392e0ff587f86c7c163c0e4ffadb1f1 Reviewed-by: Pier Luigi Fiorini --- .../qtwaylandscanner/qtwaylandscanner.cpp | 26 ++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp index f748136595e..afe3b80ecb7 100644 --- a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp +++ b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp @@ -422,6 +422,7 @@ void process(QXmlStreamReader &xml, const QByteArray &headerPath, const QByteArr printf(" public:\n"); printf(" %s(struct ::wl_client *client, int id, int version);\n", interfaceName); printf(" %s(struct ::wl_display *display, int version);\n", interfaceName); + printf(" %s(struct ::wl_resource *resource);\n", interfaceName); printf(" %s();\n", interfaceName); printf("\n"); printf(" virtual ~%s();\n", interfaceName); @@ -443,6 +444,7 @@ void process(QXmlStreamReader &xml, const QByteArray &headerPath, const QByteArr printf("\n"); printf(" void init(struct ::wl_client *client, int id, int version);\n"); printf(" void init(struct ::wl_display *display, int version);\n"); + printf(" void init(struct ::wl_resource *resource);\n"); printf("\n"); printf(" Resource *add(struct ::wl_client *client, int version);\n"); printf(" Resource *add(struct ::wl_client *client, int id, int version);\n"); @@ -502,6 +504,7 @@ void process(QXmlStreamReader &xml, const QByteArray &headerPath, const QByteArr printf(" static void destroy_func(struct ::wl_resource *client_resource);\n"); printf("\n"); printf(" Resource *bind(struct ::wl_client *client, uint32_t id, int version);\n"); + printf(" Resource *bind(struct ::wl_resource *handle);\n"); if (hasRequests) { printf("\n"); @@ -580,6 +583,15 @@ void process(QXmlStreamReader &xml, const QByteArray &headerPath, const QByteArr printf(" }\n"); printf("\n"); + printf(" %s::%s(struct ::wl_resource *resource)\n", interfaceName, interfaceName); + printf(" : m_resource_map()\n"); + printf(" , m_resource(0)\n"); + printf(" , m_global(0)\n"); + printf(" {\n"); + printf(" init(resource);\n"); + printf(" }\n"); + printf("\n"); + printf(" %s::%s()\n", interfaceName, interfaceName); printf(" : m_resource_map()\n"); printf(" , m_resource(0)\n"); @@ -599,6 +611,12 @@ void process(QXmlStreamReader &xml, const QByteArray &headerPath, const QByteArr printf(" }\n"); printf("\n"); + printf(" void %s::init(struct ::wl_resource *resource)\n", interfaceName); + printf(" {\n"); + printf(" m_resource = bind(resource);\n"); + printf(" }\n"); + printf("\n"); + printf(" %s::Resource *%s::add(struct ::wl_client *client, int version)\n", interfaceName, interfaceName); printf(" {\n"); printf(" Resource *resource = bind(client, 0, version);\n"); @@ -673,10 +691,16 @@ void process(QXmlStreamReader &xml, const QByteArray &headerPath, const QByteArr printf(" %s::Resource *%s::bind(struct ::wl_client *client, uint32_t id, int version)\n", interfaceName, interfaceName); printf(" {\n"); printf(" Q_ASSERT_X(!wl_client_get_object(client, id), \"QWaylandObject bind\", QStringLiteral(\"binding to object %%1 more than once\").arg(id).toLocal8Bit().constData());\n"); + printf(" struct ::wl_resource *handle = wl_resource_create(client, &::%s_interface, version, id);\n", interfaceName); + printf(" return bind(handle);\n"); + printf(" }\n"); + printf("\n"); + + printf(" %s::Resource *%s::bind(struct ::wl_resource *handle)\n", interfaceName, interfaceName); + printf(" {\n"); printf(" Resource *resource = %s_allocate();\n", interfaceNameStripped); printf(" resource->%s_object = this;\n", interfaceNameStripped); printf("\n"); - printf(" struct ::wl_resource *handle = wl_resource_create(client, &::%s_interface, version, id);\n", interfaceName); printf(" wl_resource_set_implementation(handle, %s, resource, destroy_func);", interfaceMember.constData()); printf("\n"); printf(" resource->handle = handle;\n"); From c70987cd65ba3ba0927593e2c87a2ea631a25d24 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Wed, 10 Feb 2016 12:51:26 +0100 Subject: [PATCH 0293/1507] Fix freeze when using BypassWindowManagerHint Shell surfaces are now created for windows with BypassWindowManager set, unless the environment variable QT_WAYLAND_USE_BYPASSWINDOWMANAGERHINT is also set. This means that in case you need a window to not create a wayland shell_surface (perhaps because you do not want to use wl_shell or xdg_shell), you can set the environment variable and get the same behavior as before. Meaning the surfaces of windows with the flag set will not be assigned a role. Task-number: QTBUG-49272 Change-Id: Idf969540497d6b4e54395b97472d99d2e068be93 Reviewed-by: Giulio Camuffo Reviewed-by: Pier Luigi Fiorini --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index fe0d6bb9516..fa4e20f948b 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -122,7 +122,8 @@ void QWaylandWindow::initWindow() if (::wl_subsurface *ss = mDisplay->createSubSurface(this, p)) { mSubSurfaceWindow = new QWaylandSubSurface(this, p, ss); } - } else if (!(window()->flags() & Qt::BypassWindowManagerHint)) { + } else if (!(qEnvironmentVariableIsSet("QT_WAYLAND_USE_BYPASSWINDOWMANAGERHINT") && + window()->flags() & Qt::BypassWindowManagerHint)) { mShellSurface = mDisplay->createShellSurface(this); } From e7e8dbbd7a46a414c29eb92d07f3046218931589 Mon Sep 17 00:00:00 2001 From: Yusuke Binsaki Date: Wed, 10 Feb 2016 18:52:59 +0900 Subject: [PATCH 0294/1507] Implement initial IVI-shell support with shell integration. IVI-shell provides a shell interface for Weston, which maps the GENIVI API (http://www.genivi.org) for In-Vehicle Infotainment as Wayland-Ivi-Extension (http://wiki.projects.genivi.org/index.php/Wayland_IVI_Extension_Design). This patch is included in two protocol. The first is ivi-application protocol which provided by weston. Next is ivi-controller protocol which provided by Genivi's wayland-ivi-extension. In IVI use case, the client create and destroy surface with the unique ID by using ivi-application protocol. On the other hand, the controller such as HMI Controller control some properties, which are visibility, position, size, etc, with created the unique ID by using ivi-controller protocol. It means the unique ID is necessary to create and control the ivi-surface and the the ivi-layer. However Qt has no API to set the some surface or layer ID. In this ivi-shell plugin, the unique ID can be set via the environment parameter so that we can control the ivi-surface and ivi-layer. The name of environment parameter is QT_IVI_SURFACE_ID. QT_IVI_SURFACE_ID will be used as ivi-surface and ivi-layer. If application needs more than two surfaces, ivi-surface IDs will be incremented. When QT_IVI_SURFACE_ID isn't set, ivi-surface and ivi-layer ID will be generated internally. The ID consists of the process ID and the surface ID which is incremented in ivi-shell plugin. The process ID is used as lower 22 bit per 32bit. 23 to 32 bit is used as the surface IDs in a process. e.g. When the process ID is 0x765 and create two surfaces, ivi-layer ID is 0x765 and ivi-surface IDs are 0x765 and 0x00400765. +------------+---------------------------+ |31 23|22 0| +------------+---------------------------+ |0000 0000 00|00 0000 0000 0000 0000 0000| |<- ID ->|<- process ID ->| +------------+---------------------------+ We can set QT_WAYLAND_SHELL_INTEGRATION of the environment parameter to "ivi-shell" to use IVI-shell. Change-Id: Iddcfb3de89dc022530c0285524cf6bbf640147b6 Reviewed-by: Giulio Camuffo --- .../wayland/protocols/ivi-application.xml | 99 +++ .../wayland/protocols/ivi-controller.xml | 603 ++++++++++++++++++ src/plugins/platforms/wayland/client.pro | 3 +- .../shellintegration/shellintegration.pro | 3 + 4 files changed, 707 insertions(+), 1 deletion(-) create mode 100644 src/3rdparty/wayland/protocols/ivi-application.xml create mode 100644 src/3rdparty/wayland/protocols/ivi-controller.xml create mode 100644 src/plugins/platforms/wayland/plugins/shellintegration/shellintegration.pro diff --git a/src/3rdparty/wayland/protocols/ivi-application.xml b/src/3rdparty/wayland/protocols/ivi-application.xml new file mode 100644 index 00000000000..61ec7d2735c --- /dev/null +++ b/src/3rdparty/wayland/protocols/ivi-application.xml @@ -0,0 +1,99 @@ + + + + + Copyright (C) 2013 DENSO CORPORATION + Copyright (c) 2013 BMW Car IT GmbH + + Permission to use, copy, modify, distribute, and sell this software and + its documentation for any purpose is hereby granted without fee, provided + that the above copyright notice appear in all copies and that both that + copyright notice and this permission notice appear in supporting + documentation, and that the name of the copyright holders not be used in + advertising or publicity pertaining to distribution of the software + without specific, written prior permission. The copyright holders make + no representations about the suitability of this software for any + purpose. It is provided "as is" without express or implied warranty. + + THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS + SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND + FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY + SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER + RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF + CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + + + + + + + + This removes link from ivi_id to wl_surface and destroys ivi_surface. + The ID, ivi_id, is free and can be used for surface_create again. + + + + + + The configure event asks the client to resize its surface. + + The size is a hint, in the sense that the client is free to + ignore it if it doesn't resize, pick a smaller size (to + satisfy aspect ratio or resize in steps of NxM pixels). + + The client is free to dismiss all but the last configure + event it received. + + The width and height arguments specify the size of the window + in surface local coordinates. + + + + + + + + + This interface is exposed as a global singleton. + This interface is implemented by servers that provide IVI-style user interfaces. + It allows clients to associate a ivi_surface with wl_surface. + + + + + + + + + + This request gives the wl_surface the role of an IVI Surface. Creating more than + one ivi_surface for a wl_surface is not allowed. Note, that this still allows the + following example: + + 1. create a wl_surface + 2. create ivi_surface for the wl_surface + 3. destroy the ivi_surface + 4. create ivi_surface for the wl_surface (with the same or another ivi_id as before) + + surface_create will create a interface:ivi_surface with numeric ID; ivi_id in + ivi compositor. These ivi_ids are defined as unique in the system to identify + it inside of ivi compositor. The ivi compositor implements business logic how to + set properties of the surface with ivi_id according to status of the system. + E.g. a unique ID for Car Navigation application is used for implementing special + logic of the application about where it shall be located. + The server regards following cases as protocol errors and disconnects the client. + - wl_surface already has an nother role. + - ivi_id is already assigned to an another wl_surface. + + If client destroys ivi_surface or wl_surface which is assigne to the ivi_surface, + ivi_id which is assigned to the ivi_surface is free for reuse. + + + + + + + + + diff --git a/src/3rdparty/wayland/protocols/ivi-controller.xml b/src/3rdparty/wayland/protocols/ivi-controller.xml new file mode 100644 index 00000000000..521d62525a8 --- /dev/null +++ b/src/3rdparty/wayland/protocols/ivi-controller.xml @@ -0,0 +1,603 @@ + + + + + Copyright (C) 2013 DENSO CORPORATION + Copyright (c) 2013 BMW Car IT 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 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. + + + + + + + + If visibility argument is 0, the surface in the ivi compositor is set to invisible. + If visibility argument is not 0, the surface in the ivi compositor is set to visible. + + + + + + + The valid range for opacity is 0.0 (fully transparent) to 1.0 (fully opaque). + + + + + + + The source rectangle defines the part of the surface content, that is used for + compositing the surface. It can be used, if valid content of the surface is smaller + than the surface. Effectively it can be used to zoom the content of the surface. + x: horizontal start position of scanout area within the surface + y: vertical start position of scanout area within the surface + width: width of scanout area within the surface + height: height of scanout area within the surface + + + + + + + + + + The destination rectangle defines the position and size of a surface on a layer. + The surface will be scaled to this rectangle for rendering. + x: horizontal start position of surface within the layer + y: vertical start position of surface within the layer + width : width of surface within the layer + height: height of surface within the layer + + + + + + + + + + Request the client providing content for this surface, to resize of the buffers + provided as surface content. + + + + + + + + The orientation of a surface in ivi compositor can be rotated in 90 degree steps, + as defined in orientation enum. + + + + + + + Store a screenshot of the surface content in the file provided by argument filename. + + + + + + + The new visibility state is provided in argument visibility. + If visibility is 0, the surface has become invisible. + If visibility is not 0, the surface has become visible. + + + + + + + The new opacity state is provided in argument opacity. + The valid range for opactiy is 0.0 (fully transparent) to 1.0 (fully opaque). + + + + + + + The scanout region of the surface content has changed. + The new values for source rectangle are provided by + x: new horizontal start position of scanout area within the surface + y: new vertical start position of scanout area within the surface + width: new width of scanout area within the surface + height: new height of scanout area within the surface + + + + + + + + + + The new values for source rectangle are provided by + x: new horizontal start position of surface within the layer + y: new vertical start position of surface within the layer + width : new width of surface within the layer + height: new height of surface within the layer + + + + + + + + + + The client providing content for this surface was requested to resize the buffer + provided as surface content. The requested buffer size is provided by arguments + width and height. + + + + + + + + The surfaces in ivi controller can be rotated in 90 degrees steps. + This enum defines all valid orientations for surfaces. + + + + + + + + + + The new orientation status is provided by argument orientation. + + + + + + + Applications can provide buffers as surface content with differernt buffer + properties. This enum defines all supported buffer configurations. + + + + + + + + + + + + + + When client attach buffers as surface content, these buffers have a pixelformat + configuration. If the pixelformat of a newly attached buffer is different from + the previous buffer configuration, this event is raised. + This is also done, when the first buffer is provided by application. + + + + + + + This surface was added to the render order of the layer defined by argument layer. + This is essential for a surface to become visible on screen, since ivi compositors + will only render layers (or more precise all surfaces in the render order of a layer). + + + + + + + These stats contain information required for monitoring, debugging, logging + and tracing. + + + + + + The information contained in this event is essential for monitoring, debugging, + logging and tracing support in IVI systems. + + + + + + + + + + + Request to destroy the ivi_controller_surface. If argument + destroy_scene_object id not 0, the surface will be destroyed in + ivi compositor. If argument is 0, only the proxy object is destroyed. + + + + + + + + + + + This enum defines all possible content states of a surface. This is + required, since surfaces in ivi compositor can exist without applications + providing content for them. + + + + + + + + Surfaces in ivi compositor can exist without any application or controller + referencing it. All surfaces initially have no content. This event indicates + when content state has changed. All possible content states are defined + in enum content_state. + + + + + + + + + + + + If visibility argument is 0, the layer in the ivi compositor is set to invisible. + If visibility argument is not 0, the layer in the ivi compositor is set to visible. + + + + + + + The valid range for opacity is 0.0 (fully transparent) to 1.0 (fully opaque). + + + + + + + The source rectangle defines the part of the layer content, that is used for + compositing the screen. It can be used, if valid content of the layer is smaller + than the layer. Effectively it can be used to zoom the content of the layer. + x: horizontal start position of scanout area within the layer + y: vertical start position of scanout area within the layer + width: width of scanout area within the layer + height: height of scanout area within the layer + + + + + + + + + + The destination rectangle defines the position and size of a layer on a screen. + The layer will be scaled to this rectangle for rendering. + x: horizontal start position of layer within the screen + y: vertical start position of layer within the screen + width : width of surface within the screen + height: height of surface within the screen + + + + + + + + + + Layers are created with an initial size, but they can be resized at runtime. + This request changes the widht and height of a layer. + + + + + + + + The orientation of a layer in ivi compositor can be rotated in 90 degree steps, + as defined in orientation enum. + + + + + + + Store a screenshot of the layer content in the file provided by argument filename. + + + + + + + A layer has no content assigned to itself, it is a container for surfaces. + This request removes all surfaces from the layer render order. + Note: the surfaces are not destroyed, they are just no longer contained by + the layer. + + + + + + A layer has no content assigned to itself, it is a container for surfaces. + This request adds a surface to the topmost position of the layer render order. + The added surface will cover all other surfaces of the layer. + + + + + + + A layer has no content assigned to itself, it is a container for surfaces. + This request removes one surfaces from the layer render order. + Note: the surface is not destroyed, it is just no longer contained by + the layer. + + + + + + + A layer has no content assigned to itself, it is a container for surfaces. + This request removes all surfaces from the layer render order and set a + completely new render order. + + + + + + + The new visibility state is provided in argument visibility. + If visibility is 0, the layer has become invisible. + If visibility is not 0, the layer has become visible. + + + + + + + The new opacity state is provided in argument opacity. + The valid range for opactiy is 0.0 (fully transparent) to 1.0 (fully opaque). + + + + + + + The scanout region of the layer content has changed. + The new values for source rectangle are provided by + x: new horizontal start position of scanout area within the layer + y: new vertical start position of scanout area within the layer + width: new width of scanout area within the layer + height: new height of scanout area within the layer + + + + + + + + + + The new values for source rectangle are provided by + x: new horizontal start position of layer within the screen + y: new vertical start position of layer within the screen + width : new width of layer within the screen + height: new height of layer within the screen + + + + + + + + + + The layer was resized. The new layer size is provided by arguments + width and height. + + + + + + + + The new orientation status is provided by argument orientation. + + + + + + + This layer was added to the render order of the screen defined by argument screen. + This is essential for a layer to become visible on screen, since ivi compositors + will only render screens (or more precise all layers in the render order of a screen). + + + + + + + Request to destroy the ivi_controller_layer. If argument + destroy_scene_object id not 0, the layer will be destroyed in + ivi compositor. If argument is 0, only the proxy object is destroyed. + + + + + + + + + + + + + + + + + + + + A screen has no content assigned to itself, it is a container for layers. + This request removes all layers from the screen render order. + Note: the layers are not destroyed, they are just no longer contained by + the screen. + + + + + + A screen has no content assigned to itself, it is a container for layers. + This request adds a layers to the topmost position of the screen render order. + The added layer will cover all other layers of the screen. + + + + + + + Store a screenshot of the screen content in the file provided by argument filename. + + + + + + + A screen has no content assigned to itself, it is a container for layers. + This request removes all layers from the screen render order and set a + completely new render order. + + + + + + + + + + + + All requests are not applied directly to scene object, so a controller + can set different properties and apply the changes all at once. + Note: there's an exception to this. Creation and destruction of + scene objects is executed immediately. + + + + + + A new screen is announced to the controller. This is typically + the case in two cases: + 1. controller was just started, ivi compositor announces existing screen + 2. a new screen was added to the system at runtime + + + + + + + + layer_create will create a new layer with id_layer in ivi compositor, + if it does not yet exists. If the layer with id_layer already exists in + ivi compositor, a handle to the existing layer is returned and width and + height properties are ignored. + + + + + + + + + + A new layer is announced to the controller. + + + + + + + surface_create will create a new surface with id_surface in ivi compositor, + if it does not yet exists. If the surface with id_surface already exists in + ivi compositor, a handle to the existing surface is returned. + + + + + + + + A new surface is announced to the controller. + + + + + + + This enum defines all scene object available in ivi compositor. + + + + + + + + + These error codes define all possible error codes returned by ivi compositor + on server-side errors. + + + + + + + + The ivi compositor encountered error while processing a request by this + controller. The error is defined by argument error_code and optional + error_text. Additionally the object type and id is contained in the error + event to provide some detailes to handle the error. + If the controller requires to associate this error event to a request, + it can + 1. send request + 2. force display roundtrip + 3. check, if error event was received + but this restricts the controller to have only one open request at a time. + + + + + + + + + + + diff --git a/src/plugins/platforms/wayland/client.pro b/src/plugins/platforms/wayland/client.pro index 6802cd47b8a..4ad32c12452 100644 --- a/src/plugins/platforms/wayland/client.pro +++ b/src/plugins/platforms/wayland/client.pro @@ -6,7 +6,8 @@ MODULE=waylandclient MODULE_PLUGIN_TYPES = \ wayland-graphics-integration-client \ wayland-inputdevice-integration \ - wayland-decoration-client + wayland-decoration-client \ + wayland-shell-integration CONFIG += generated_privates diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/shellintegration.pro b/src/plugins/platforms/wayland/plugins/shellintegration/shellintegration.pro new file mode 100644 index 00000000000..9867d2b4035 --- /dev/null +++ b/src/plugins/platforms/wayland/plugins/shellintegration/shellintegration.pro @@ -0,0 +1,3 @@ +TEMPLATE = subdirs + +SUBDIRS += ivi-shell From f52b53996c5bb98e25316e3716e49afb3f64b494 Mon Sep 17 00:00:00 2001 From: Elvis Lee Date: Fri, 29 Jan 2016 11:31:06 +0900 Subject: [PATCH 0295/1507] Fix crash for destroyed surface on touch event Change-Id: Ia3dd8627c1b96a88d308dc7fa85d936f809c7856 Reviewed-by: Elvis Lee Reviewed-by: Paul Olav Tvete --- src/plugins/platforms/wayland/qwaylandinputdevice.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index 567620ba50d..e0a5ce9441a 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -253,6 +253,8 @@ void QWaylandInputDevice::handleWindowDestroyed(QWaylandWindow *window) mKeyboard->mFocus = 0; mKeyboard->stopRepeat(); } + if (mTouch && window == mTouch->mFocus) + mTouch->mFocus = 0; } void QWaylandInputDevice::setDataDevice(QWaylandDataDevice *device) @@ -739,6 +741,9 @@ void QWaylandInputDevice::Touch::touch_down(uint32_t serial, wl_fixed_t x, wl_fixed_t y) { + if (!surface) + return; + mParent->mTime = time; mParent->mSerial = serial; mFocus = QWaylandWindow::fromWlSurface(surface); From 9d119e5c963e467fd2e2dc425b03d7f46901712f Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 12 Feb 2016 16:50:44 +0100 Subject: [PATCH 0296/1507] consistently put {qt,qml}_{module,plugin} at the end of project files this fixes static builds by ensuring that all dependencies are exported. Task-number: QTBUG-51071 Change-Id: Ie9e89fa47696244e8ee478ed1a019765c835533e Reviewed-by: Paul Olav Tvete --- src/plugins/platforms/wayland/client.pro | 19 +++++++++---------- .../plugins/decorations/bradient/bradient.pro | 5 ++--- .../hardwareintegration/brcm-egl/brcm-egl.pro | 5 ++--- .../drm-egl-server/drm-egl-server.pro | 5 ++--- .../libhybris-egl-server.pro | 5 ++--- .../wayland-egl/wayland-egl.pro | 5 ++--- .../xcomposite-egl/xcomposite-egl.pro | 5 ++--- .../xcomposite-glx/xcomposite-glx.pro | 5 ++--- 8 files changed, 23 insertions(+), 31 deletions(-) diff --git a/src/plugins/platforms/wayland/client.pro b/src/plugins/platforms/wayland/client.pro index 8bd9e1dc83a..1a0779834fc 100644 --- a/src/plugins/platforms/wayland/client.pro +++ b/src/plugins/platforms/wayland/client.pro @@ -1,17 +1,9 @@ TARGET = QtWaylandClient +MODULE = waylandclient + QT += core-private gui-private QT_FOR_PRIVATE += platformsupport-private -MODULE=waylandclient -MODULE_PLUGIN_TYPES = \ - wayland-graphics-integration-client \ - wayland-inputdevice-integration \ - wayland-decoration-client - -CONFIG += generated_privates - -load(qt_module) - # We have a bunch of C code with casts, so we can't have this option QMAKE_CXXFLAGS_WARN_ON -= -Wcast-qual @@ -117,3 +109,10 @@ HEADERS += qwaylandintegration_p.h \ include(hardwareintegration/hardwareintegration.pri) include(shellintegration/shellintegration.pri) include(inputdeviceintegration/inputdeviceintegration.pri) + +CONFIG += generated_privates +MODULE_PLUGIN_TYPES = \ + wayland-graphics-integration-client \ + wayland-inputdevice-integration \ + wayland-decoration-client +load(qt_module) diff --git a/src/plugins/platforms/wayland/plugins/decorations/bradient/bradient.pro b/src/plugins/platforms/wayland/plugins/decorations/bradient/bradient.pro index fd376f4a985..0f62db9cc9d 100644 --- a/src/plugins/platforms/wayland/plugins/decorations/bradient/bradient.pro +++ b/src/plugins/platforms/wayland/plugins/decorations/bradient/bradient.pro @@ -1,6 +1,3 @@ -PLUGIN_TYPE = wayland-decoration-client -load(qt_plugin) - QT += waylandclient-private OTHER_FILES += \ @@ -15,3 +12,5 @@ contains(QT_CONFIG, no-pkg-config) { PKGCONFIG += wayland-client } +PLUGIN_TYPE = wayland-decoration-client +load(qt_plugin) diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/brcm-egl.pro b/src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/brcm-egl.pro index 6dbe53732ed..550343cfe99 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/brcm-egl.pro +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/brcm-egl.pro @@ -1,6 +1,3 @@ -PLUGIN_TYPE = wayland-graphics-integration-client -load(qt_plugin) - QT += waylandclient-private include(../../../../hardwareintegration/client/brcm-egl/brcm-egl.pri) @@ -10,3 +7,5 @@ OTHER_FILES += \ SOURCES += main.cpp +PLUGIN_TYPE = wayland-graphics-integration-client +load(qt_plugin) diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/drm-egl-server/drm-egl-server.pro b/src/plugins/platforms/wayland/plugins/hardwareintegration/drm-egl-server/drm-egl-server.pro index 827228d2bdd..29a48c9e6e7 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/drm-egl-server/drm-egl-server.pro +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/drm-egl-server/drm-egl-server.pro @@ -1,6 +1,3 @@ -PLUGIN_TYPE = wayland-graphics-integration-client -load(qt_plugin) - # We have a bunch of C code with casts, so we can't have this option QMAKE_CXXFLAGS_WARN_ON -= -Wcast-qual @@ -13,3 +10,5 @@ OTHER_FILES += \ SOURCES += main.cpp +PLUGIN_TYPE = wayland-graphics-integration-client +load(qt_plugin) diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/libhybris-egl-server/libhybris-egl-server.pro b/src/plugins/platforms/wayland/plugins/hardwareintegration/libhybris-egl-server/libhybris-egl-server.pro index 55f98415d58..d7bf03705ce 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/libhybris-egl-server/libhybris-egl-server.pro +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/libhybris-egl-server/libhybris-egl-server.pro @@ -1,6 +1,3 @@ -PLUGIN_TYPE = wayland-graphics-integration-client -load(qt_plugin) - QT += waylandclient-private include(../../../../hardwareintegration/client/libhybris-egl-server/libhybris-egl-server.pri) @@ -10,3 +7,5 @@ OTHER_FILES += \ SOURCES += main.cpp +PLUGIN_TYPE = wayland-graphics-integration-client +load(qt_plugin) diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/wayland-egl.pro b/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/wayland-egl.pro index 38989628886..076b6af2c34 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/wayland-egl.pro +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/wayland-egl.pro @@ -1,6 +1,3 @@ -PLUGIN_TYPE = wayland-graphics-integration-client -load(qt_plugin) - QT += waylandclient-private include(../../../../hardwareintegration/client/wayland-egl/wayland-egl.pri) @@ -10,3 +7,5 @@ OTHER_FILES += \ SOURCES += main.cpp +PLUGIN_TYPE = wayland-graphics-integration-client +load(qt_plugin) diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-egl/xcomposite-egl.pro b/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-egl/xcomposite-egl.pro index 1af1786695f..031d2812ad9 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-egl/xcomposite-egl.pro +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-egl/xcomposite-egl.pro @@ -1,6 +1,3 @@ -PLUGIN_TYPE = wayland-graphics-integration-client -load(qt_plugin) - # We have a bunch of C code with casts, so we can't have this option QMAKE_CXXFLAGS_WARN_ON -= -Wcast-qual @@ -13,3 +10,5 @@ OTHER_FILES += xcomposite-egl.json SOURCES += \ main.cpp +PLUGIN_TYPE = wayland-graphics-integration-client +load(qt_plugin) diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-glx/xcomposite-glx.pro b/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-glx/xcomposite-glx.pro index 0080150ccd1..eb8e03c7f33 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-glx/xcomposite-glx.pro +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-glx/xcomposite-glx.pro @@ -1,6 +1,3 @@ -PLUGIN_TYPE = wayland-graphics-integration-client -load(qt_plugin) - QT += waylandclient-private include(../../../../hardwareintegration/client/xcomposite-glx/xcomposite-glx.pri) @@ -10,3 +7,5 @@ OTHER_FILES += xcomposite-glx.json SOURCES += \ main.cpp +PLUGIN_TYPE = wayland-graphics-integration-client +load(qt_plugin) From d9e3842afda97b4ac31c7d562c7923c65cb98b33 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 12 Feb 2016 16:51:28 +0100 Subject: [PATCH 0297/1507] don't over-expose private dependencies Change-Id: If46406b4129b464e8ccfa0b4cf6ff2989402ca74 Reviewed-by: Paul Olav Tvete --- src/plugins/platforms/wayland/client.pro | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/plugins/platforms/wayland/client.pro b/src/plugins/platforms/wayland/client.pro index 1a0779834fc..2895e19d759 100644 --- a/src/plugins/platforms/wayland/client.pro +++ b/src/plugins/platforms/wayland/client.pro @@ -16,19 +16,19 @@ CONFIG += link_pkgconfig qpa/genericunixfontdatabase wayland-scanner config_xkbcommon { !contains(QT_CONFIG, no-pkg-config) { - PKGCONFIG += xkbcommon + PKGCONFIG_PRIVATE += xkbcommon } else { - LIBS += -lxkbcommon + LIBS_PRIVATE += -lxkbcommon } } else { DEFINES += QT_NO_WAYLAND_XKB } !contains(QT_CONFIG, no-pkg-config) { - PKGCONFIG += wayland-client wayland-cursor + PKGCONFIG_PRIVATE += wayland-client wayland-cursor contains(QT_CONFIG, glib): PKGCONFIG_PRIVATE += glib-2.0 } else { - LIBS += -lwayland-client -lwayland-cursor $$QT_LIBS_GLIB + LIBS_PRIVATE += -lwayland-client -lwayland-cursor $$QT_LIBS_GLIB } INCLUDEPATH += $$PWD/../shared From db14c19d17ef739237897d11a9d0afdf99ebb207 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 2 Mar 2016 23:10:16 -0800 Subject: [PATCH 0298/1507] Fix failure to build from sources: missing #include MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit qwaylandinputdeviceintegration_p.h:64:85: error: ‘uint32_t’ has not been declared Change-Id: Ic747cc2ab45e4dc6bb70ffff143843d1ed4a341b Reviewed-by: Lars Knoll --- .../inputdeviceintegration/qwaylandinputdeviceintegration_p.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegration_p.h b/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegration_p.h index f3c59c898a3..721cb27a1ad 100644 --- a/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegration_p.h +++ b/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegration_p.h @@ -48,6 +48,8 @@ #include #include +#include + QT_BEGIN_NAMESPACE namespace QtWaylandClient { From 330e3a78695bbe7f439676831b2336f3e5e26521 Mon Sep 17 00:00:00 2001 From: Giulio Camuffo Date: Fri, 11 Dec 2015 22:27:49 +0200 Subject: [PATCH 0299/1507] Fix SHM drawing logic The old logic didn't care to listen for wl_buffer.release events so it always drew in the same buffer, potentially resulting in tearing if the compositor was scanning out the buffer at the same time. Instead properly cycle between a few buffers and don't reuse the same one until the release event was received. The old code also used to throttle the redraws, unless the buffer was changing, that is unless the window was getting resized. This is now lost, and no throttling is ever done. Doing it properly, by waiting for the frame callback before committing the new buffer shows very noticeable lags with many applications when resizing, because they paint many times per resize event, so they fall behind the cursor. A proper fix will be to implement the support for requestUpdate(), and using it in the applications. Change-Id: I02732c34769a5c75a6ad68c095bae916e4b274d3 Reviewed-by: Robin Burchell --- src/plugins/platforms/wayland/client.pro | 1 + .../platforms/wayland/qwaylandbuffer.cpp | 72 +++++++++ .../platforms/wayland/qwaylandbuffer_p.h | 18 ++- .../wayland/qwaylandshmbackingstore.cpp | 150 ++++++++---------- .../wayland/qwaylandshmbackingstore_p.h | 10 +- .../platforms/wayland/qwaylandwindow.cpp | 15 +- .../platforms/wayland/qwaylandwindow_p.h | 1 - 7 files changed, 157 insertions(+), 110 deletions(-) create mode 100644 src/plugins/platforms/wayland/qwaylandbuffer.cpp diff --git a/src/plugins/platforms/wayland/client.pro b/src/plugins/platforms/wayland/client.pro index 2895e19d759..59234b14e74 100644 --- a/src/plugins/platforms/wayland/client.pro +++ b/src/plugins/platforms/wayland/client.pro @@ -73,6 +73,7 @@ SOURCES += qwaylandintegration.cpp \ qwaylandwindowmanagerintegration.cpp \ qwaylandinputcontext.cpp \ qwaylanddatadevice.cpp \ + qwaylandbuffer.cpp \ HEADERS += qwaylandintegration_p.h \ qwaylandnativeinterface_p.h \ diff --git a/src/plugins/platforms/wayland/qwaylandbuffer.cpp b/src/plugins/platforms/wayland/qwaylandbuffer.cpp new file mode 100644 index 00000000000..c6aace2c7ce --- /dev/null +++ b/src/plugins/platforms/wayland/qwaylandbuffer.cpp @@ -0,0 +1,72 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Copyright (C) 2015 Giulio Camuffo. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL21$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qwaylandbuffer_p.h" + +#include + +QT_BEGIN_NAMESPACE + +namespace QtWaylandClient { + +QWaylandBuffer::QWaylandBuffer() + : mBuffer(0) + , mBusy(false) +{ +} + +QWaylandBuffer::~QWaylandBuffer() +{ + if (mBuffer) + wl_buffer_destroy(mBuffer); +} + +void QWaylandBuffer::init(wl_buffer *buf) +{ + mBuffer = buf; + wl_buffer_add_listener(buf, &listener, this); +} + +void QWaylandBuffer::release(void *data, wl_buffer *) +{ + static_cast(data)->mBusy = false; +} + +const wl_buffer_listener QWaylandBuffer::listener = { + QWaylandBuffer::release +}; + +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandbuffer_p.h b/src/plugins/platforms/wayland/qwaylandbuffer_p.h index 6f8f7b269a9..7db6cfefec9 100644 --- a/src/plugins/platforms/wayland/qwaylandbuffer_p.h +++ b/src/plugins/platforms/wayland/qwaylandbuffer_p.h @@ -59,17 +59,25 @@ namespace QtWaylandClient { class Q_WAYLAND_CLIENT_EXPORT QWaylandBuffer { public: - QWaylandBuffer() - : mBuffer(0) - { - } - virtual ~QWaylandBuffer() { } + QWaylandBuffer(); + virtual ~QWaylandBuffer(); + void init(wl_buffer *buf); + wl_buffer *buffer() {return mBuffer;} virtual QSize size() const = 0; virtual int scale() const { return 1; } + void setBusy() { mBusy = true; } + bool busy() const { return mBusy; } + protected: struct wl_buffer *mBuffer; + +private: + bool mBusy; + + static void release(void *data, wl_buffer *); + static const wl_buffer_listener listener; }; } diff --git a/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp b/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp index f009e08116b..3bbe24c318c 100644 --- a/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp +++ b/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp @@ -39,6 +39,7 @@ #include #include #include +#include #include #include @@ -53,9 +54,14 @@ QT_BEGIN_NAMESPACE namespace QtWaylandClient { +Q_DECLARE_LOGGING_CATEGORY(logCategory) + +Q_LOGGING_CATEGORY(logCategory, "qt.qpa.wayland.backingstore") + QWaylandShmBuffer::QWaylandShmBuffer(QWaylandDisplay *display, const QSize &size, QImage::Format format, int scale) - : mShmPool(0) + : QWaylandBuffer() + , mShmPool(0) , mMarginsImage(0) { int stride = size.width() * 4; @@ -90,8 +96,8 @@ QWaylandShmBuffer::QWaylandShmBuffer(QWaylandDisplay *display, mImage.setDevicePixelRatio(qreal(scale)); mShmPool = wl_shm_create_pool(display->shm(), fd, alloc); - mBuffer = wl_shm_pool_create_buffer(mShmPool,0, size.width(), size.height(), - stride, wl_format); + init(wl_shm_pool_create_buffer(mShmPool,0, size.width(), size.height(), + stride, wl_format)); close(fd); } @@ -100,8 +106,6 @@ QWaylandShmBuffer::~QWaylandShmBuffer(void) delete mMarginsImage; if (mImage.constBits()) munmap((void *) mImage.constBits(), mImage.byteCount()); - if (mBuffer) - wl_buffer_destroy(mBuffer); if (mShmPool) wl_shm_pool_destroy(mShmPool); } @@ -139,9 +143,7 @@ QWaylandShmBackingStore::QWaylandShmBackingStore(QWindow *window) , mDisplay(QWaylandScreen::waylandScreenFromWindow(window)->display()) , mFrontBuffer(0) , mBackBuffer(0) - , mFrontBufferIsDirty(false) , mPainting(false) - , mFrameCallback(0) { } @@ -151,16 +153,10 @@ QWaylandShmBackingStore::~QWaylandShmBackingStore() if (QWaylandWindow *w = waylandWindow()) w->setBackingStore(Q_NULLPTR); - if (mFrameCallback) - wl_callback_destroy(mFrameCallback); - // if (mFrontBuffer == waylandWindow()->attached()) // waylandWindow()->attach(0); - if (mFrontBuffer != mBackBuffer) - delete mFrontBuffer; - - delete mBackBuffer; + qDeleteAll(mBuffers); } QPaintDevice *QWaylandShmBackingStore::paintDevice() @@ -173,11 +169,7 @@ void QWaylandShmBackingStore::beginPaint(const QRegion &) mPainting = true; ensureSize(); - QWaylandWindow *window = waylandWindow(); - if (window->attached() && mBackBuffer == window->attached() && mFrameCallback) - window->waitForFrameSync(); - - window->setCanResize(false); + waylandWindow()->setCanResize(false); } void QWaylandShmBackingStore::endPaint() @@ -188,11 +180,6 @@ void QWaylandShmBackingStore::endPaint() void QWaylandShmBackingStore::hidden() { - QMutexLocker lock(&mMutex); - if (mFrameCallback) { - wl_callback_destroy(mFrameCallback); - mFrameCallback = Q_NULLPTR; - } } void QWaylandShmBackingStore::ensureSize() @@ -219,35 +206,15 @@ void QWaylandShmBackingStore::flush(QWindow *window, const QRegion ®ion, cons mFrontBuffer = mBackBuffer; - if (mFrameCallback) { - mFrontBufferIsDirty = true; - return; - } - - mFrameCallback = waylandWindow()->frame(); - wl_callback_add_listener(mFrameCallback,&frameCallbackListener,this); QMargins margins = windowDecorationMargins(); - bool damageAll = false; - if (waylandWindow()->attached() != mFrontBuffer) { - delete waylandWindow()->attached(); - damageAll = true; - } waylandWindow()->attachOffset(mFrontBuffer); + mFrontBuffer->setBusy(); - if (damageAll) { - //need to damage it all, otherwise the attach offset may screw up - waylandWindow()->damage(QRect(QPoint(0,0), window->size())); - } else { - QVector rects = region.rects(); - for (int i = 0; i < rects.size(); i++) { - QRect rect = rects.at(i); - rect.translate(margins.left(),margins.top()); - waylandWindow()->damage(rect); - } - } + QVector rects = region.rects(); + foreach (const QRect &rect, rects) + waylandWindow()->damage(rect.translated(margins.left(), margins.top())); waylandWindow()->commit(); - mFrontBufferIsDirty = false; } void QWaylandShmBackingStore::resize(const QSize &size, const QRegion &) @@ -255,22 +222,65 @@ void QWaylandShmBackingStore::resize(const QSize &size, const QRegion &) mRequestedSize = size; } +QWaylandShmBuffer *QWaylandShmBackingStore::getBuffer(const QSize &size) +{ + foreach (QWaylandShmBuffer *b, mBuffers) { + if (!b->busy()) { + if (b->size() == size) { + return b; + } else { + mBuffers.removeOne(b); + if (mBackBuffer == b) + mBackBuffer = 0; + delete b; + } + } + } + + static const int MAX_BUFFERS = 5; + if (mBuffers.count() < MAX_BUFFERS) { + QImage::Format format = QPlatformScreen::platformScreenForWindow(window())->format(); + QWaylandShmBuffer *b = new QWaylandShmBuffer(mDisplay, size, format, waylandWindow()->scale()); + mBuffers.prepend(b); + return b; + } + return 0; +} + void QWaylandShmBackingStore::resize(const QSize &size) { QMargins margins = windowDecorationMargins(); int scale = waylandWindow()->scale(); QSize sizeWithMargins = (size + QSize(margins.left()+margins.right(),margins.top()+margins.bottom())) * scale; - QImage::Format format = QPlatformScreen::platformScreenForWindow(window())->format(); + // We look for a free buffer to draw into. If the buffer is not the last buffer we used, + // that is mBackBuffer, and the size is the same we memcpy the old content into the new + // buffer so that QPainter is happy to find the stuff it had drawn before. If the new + // buffer has a different size it needs to be redrawn completely anyway, and if the buffer + // is the same the stuff is there already. + // You can exercise the different codepaths with weston, switching between the gl and the + // pixman renderer. With the gl renderer release events are sent early so we can effectively + // run single buffered, while with the pixman renderer we have to use two. + QWaylandShmBuffer *buffer = getBuffer(sizeWithMargins); + while (!buffer) { + qCDebug(logCategory, "QWaylandShmBackingStore: stalling waiting for a buffer to be released from the compositor..."); - if (mBackBuffer != NULL && mBackBuffer->size() == sizeWithMargins) - return; - - if (mBackBuffer != mFrontBuffer) { - delete mBackBuffer; //we delete the attached buffer when we flush + mDisplay->blockingReadEvents(); + buffer = getBuffer(sizeWithMargins); } - mBackBuffer = new QWaylandShmBuffer(mDisplay, sizeWithMargins, format, scale); + int oldSize = mBackBuffer ? mBackBuffer->image()->byteCount() : 0; + // mBackBuffer may have been deleted here but if so it means its size was different so we wouldn't copy it anyway + if (mBackBuffer != buffer && oldSize == buffer->image()->byteCount()) { + memcpy(buffer->image()->bits(), mBackBuffer->image()->constBits(), buffer->image()->byteCount()); + } + mBackBuffer = buffer; + // ensure the new buffer is at the beginning of the list so next time getBuffer() will pick + // it if possible + if (mBuffers.first() != buffer) { + mBuffers.removeOne(buffer); + mBuffers.prepend(buffer); + } if (windowDecoration() && window()->isVisible()) windowDecoration()->update(); @@ -344,36 +354,6 @@ QImage QWaylandShmBackingStore::toImage() const } #endif // QT_NO_OPENGL -void QWaylandShmBackingStore::done(void *data, wl_callback *callback, uint32_t time) -{ - Q_UNUSED(time); - QWaylandShmBackingStore *self = - static_cast(data); - if (callback != self->mFrameCallback) // others, like QWaylandWindow, may trigger callbacks too - return; - QMutexLocker lock(&self->mMutex); - QWaylandWindow *window = self->waylandWindow(); - wl_callback_destroy(self->mFrameCallback); - self->mFrameCallback = 0; - - - if (self->mFrontBufferIsDirty && !self->mPainting) { - self->mFrontBufferIsDirty = false; - self->mFrameCallback = wl_surface_frame(window->object()); - wl_callback_add_listener(self->mFrameCallback,&self->frameCallbackListener,self); - if (self->mFrontBuffer != window->attached()) { - delete window->attached(); - } - window->attachOffset(self->mFrontBuffer); - window->damage(QRect(QPoint(0,0),window->geometry().size())); - window->commit(); - } -} - -const struct wl_callback_listener QWaylandShmBackingStore::frameCallbackListener = { - QWaylandShmBackingStore::done -}; - } QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandshmbackingstore_p.h b/src/plugins/platforms/wayland/qwaylandshmbackingstore_p.h index a1a6e19c3ce..8b58c0b5eda 100644 --- a/src/plugins/platforms/wayland/qwaylandshmbackingstore_p.h +++ b/src/plugins/platforms/wayland/qwaylandshmbackingstore_p.h @@ -51,6 +51,7 @@ #include #include #include +#include QT_BEGIN_NAMESPACE @@ -107,22 +108,17 @@ public: private: void updateDecorations(); + QWaylandShmBuffer *getBuffer(const QSize &size); QWaylandDisplay *mDisplay; + QLinkedList mBuffers; QWaylandShmBuffer *mFrontBuffer; QWaylandShmBuffer *mBackBuffer; - bool mFrontBufferIsDirty; bool mPainting; QMutex mMutex; QSize mRequestedSize; Qt::WindowFlags mCurrentWindowFlags; - - static const struct wl_callback_listener frameCallbackListener; - static void done(void *data, - struct wl_callback *callback, - uint32_t time); - struct wl_callback *mFrameCallback; }; } diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index fa4e20f948b..caf24c0aab9 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -74,7 +74,6 @@ QWaylandWindow::QWaylandWindow(QWindow *window) , mMouseEventsInContentArea(false) , mMousePressedInContentArea(Qt::NoButton) , m_cursorShape(Qt::ArrowCursor) - , mBuffer(0) , mWaitingForFrameSync(false) , mFrameCallback(0) , mRequestResizeSent(false) @@ -412,9 +411,8 @@ void QWaylandWindow::requestResize() void QWaylandWindow::attach(QWaylandBuffer *buffer, int x, int y) { - mBuffer = buffer; - if (mBuffer) - attach(mBuffer->buffer(), x, y); + if (buffer) + attach(buffer->buffer(), x, y); else QtWayland::wl_surface::attach(0, 0, 0); } @@ -425,11 +423,6 @@ void QWaylandWindow::attachOffset(QWaylandBuffer *buffer) mOffset = QPoint(); } -QWaylandBuffer *QWaylandWindow::attached() const -{ - return mBuffer; -} - void QWaylandWindow::damage(const QRect &rect) { //We have to do sync stuff before calling damage, or we might @@ -439,9 +432,7 @@ void QWaylandWindow::damage(const QRect &rect) wl_callback_add_listener(mFrameCallback,&QWaylandWindow::callbackListener,this); mWaitingForFrameSync = true; } - if (mBuffer) { - damage(rect.x(), rect.y(), rect.width(), rect.height()); - } + damage(rect.x(), rect.y(), rect.width(), rect.height()); } const wl_callback_listener QWaylandWindow::callbackListener = { diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index be8f53088dd..701a9cdf6d0 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -208,7 +208,6 @@ protected: Qt::MouseButtons mMousePressedInContentArea; Qt::CursorShape m_cursorShape; - QWaylandBuffer *mBuffer; WId mWindowId; bool mWaitingForFrameSync; struct wl_callback *mFrameCallback; From 2414bb75bb692b46c779b170f04519b0a36d99ff Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Fri, 11 Mar 2016 11:59:19 +0100 Subject: [PATCH 0300/1507] Fix client xdg_surface not handling all states from configure event The code used sizeof(state) when it should have been sizeof(*state). Change-Id: Id1714a5e90e6c58850023424726de26719a69046 Reviewed-by: Paul Olav Tvete --- src/plugins/platforms/wayland/qwaylandxdgsurface.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandxdgsurface.cpp b/src/plugins/platforms/wayland/qwaylandxdgsurface.cpp index c89e230db66..202ac50bb67 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgsurface.cpp +++ b/src/plugins/platforms/wayland/qwaylandxdgsurface.cpp @@ -173,15 +173,13 @@ void QWaylandXdgSurface::sendProperty(const QString &name, const QVariant &value void QWaylandXdgSurface::xdg_surface_configure(int32_t width, int32_t height, struct wl_array *states,uint32_t serial) { - uint32_t *state = 0; + uint32_t *state = reinterpret_cast(states->data); + size_t numStates = states->size / sizeof(uint32_t); bool aboutToMaximize = false; bool aboutToFullScreen = false; - state = (uint32_t*) states->data; - - for (uint32_t i = 0; i < states->size / sizeof(state) ; i++) - { - switch (*(state+i)) { + for (size_t i = 0; i < numStates; i++) { + switch (state[i]) { case XDG_SURFACE_STATE_MAXIMIZED: aboutToMaximize = ((width > 0) && (height > 0)); break; From 64740996845c43c7363874a4c4ed876fa6680549 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Wed, 2 Mar 2016 11:04:10 +0100 Subject: [PATCH 0301/1507] Add support for bitmap cursors So far QtWayland did not support custom bitmap/pixmap QCursors. This change adds support for them by creating a QWaylandShmBuffer and copying the pixmap data into that buffer. The internal API to set cursors images is changed to not only rely on wl_cursor_image, but also allow to just set the buffer with a specific size and a hot spot. The created WaylandShmBuffer is passed around as a shared pointer, so that it can be automatically cleaned up once the cursor image is no longer used on any seat. Task-number: QTBUG-51604 Change-Id: I1f1ee87f03186c3d564468d3e8ea2a3141d7e2fb Reviewed-by: Giulio Camuffo Reviewed-by: Johan Helsing --- .../platforms/wayland/qwaylandcursor.cpp | 29 ++++++++++++++++++- .../platforms/wayland/qwaylandcursor_p.h | 2 ++ .../platforms/wayland/qwaylanddisplay_p.h | 1 + .../platforms/wayland/qwaylandinputdevice.cpp | 28 ++++++++++++++++-- .../platforms/wayland/qwaylandinputdevice_p.h | 5 ++++ .../platforms/wayland/qwaylandwindow.cpp | 12 ++++---- .../platforms/wayland/qwaylandwindow_p.h | 4 +-- 7 files changed, 70 insertions(+), 11 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandcursor.cpp b/src/plugins/platforms/wayland/qwaylandcursor.cpp index 8dfc95c3604..8d91e3896db 100644 --- a/src/plugins/platforms/wayland/qwaylandcursor.cpp +++ b/src/plugins/platforms/wayland/qwaylandcursor.cpp @@ -85,7 +85,8 @@ struct wl_cursor_image *QWaylandCursor::cursorImage(Qt::CursorShape newShape) if (newShape < Qt::BitmapCursor) { waylandCursor = requestCursor((WaylandCursor)newShape); } else if (newShape == Qt::BitmapCursor) { - //TODO: Bitmap cursor logic + // cannot create a wl_cursor_image for a CursorShape + return Q_NULLPTR; } else { //TODO: Custom cursor logic (for resize arrows) } @@ -105,12 +106,28 @@ struct wl_cursor_image *QWaylandCursor::cursorImage(Qt::CursorShape newShape) return image; } +QSharedPointer QWaylandCursor::cursorBitmapImage(const QCursor *cursor) +{ + if (cursor->shape() != Qt::BitmapCursor) + return QSharedPointer(); + + const QImage &img = cursor->pixmap().toImage(); + QSharedPointer buffer(new QWaylandShmBuffer(mDisplay, img.size(), img.format())); + memcpy(buffer->image()->bits(), img.bits(), img.byteCount()); + return buffer; +} + void QWaylandCursor::changeCursor(QCursor *cursor, QWindow *window) { Q_UNUSED(window) const Qt::CursorShape newShape = cursor ? cursor->shape() : Qt::ArrowCursor; + if (newShape == Qt::BitmapCursor) { + mDisplay->setCursor(cursorBitmapImage(cursor), cursor->hotSpot()); + return; + } + struct wl_cursor_image *image = cursorImage(newShape); if (!image) { return; @@ -130,6 +147,16 @@ void QWaylandDisplay::setCursor(struct wl_buffer *buffer, struct wl_cursor_image } } +void QWaylandDisplay::setCursor(const QSharedPointer &buffer, const QPoint &hotSpot) +{ + /* Qt doesn't tell us which input device we should set the cursor + * for, so set it for all devices. */ + for (int i = 0; i < mInputDevices.count(); i++) { + QWaylandInputDevice *inputDevice = mInputDevices.at(i); + inputDevice->setCursor(buffer, hotSpot); + } +} + QWaylandInputDevice *QWaylandDisplay::defaultInputDevice() const { return mInputDevices.isEmpty() ? 0 : mInputDevices.first(); diff --git a/src/plugins/platforms/wayland/qwaylandcursor_p.h b/src/plugins/platforms/wayland/qwaylandcursor_p.h index 0cc1173f8f9..9e06cf6265b 100644 --- a/src/plugins/platforms/wayland/qwaylandcursor_p.h +++ b/src/plugins/platforms/wayland/qwaylandcursor_p.h @@ -57,6 +57,7 @@ QT_BEGIN_NAMESPACE namespace QtWaylandClient { +class QWaylandBuffer; class QWaylandDisplay; class QWaylandScreen; @@ -72,6 +73,7 @@ public: void setPos(const QPoint &pos); struct wl_cursor_image *cursorImage(Qt::CursorShape shape); + QSharedPointer cursorBitmapImage(const QCursor *cursor); private: enum WaylandCursor { diff --git a/src/plugins/platforms/wayland/qwaylanddisplay_p.h b/src/plugins/platforms/wayland/qwaylanddisplay_p.h index 8262e72be46..b53e0577a3b 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay_p.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay_p.h @@ -118,6 +118,7 @@ public: QWaylandWindowManagerIntegration *windowManagerIntegration() const; void setCursor(struct wl_buffer *buffer, struct wl_cursor_image *image); + void setCursor(const QSharedPointer &buffer, const QPoint &hotSpot); struct wl_display *wl_display() const { return mDisplay; } struct ::wl_registry *wl_registry() { return object(); } diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index e0a5ce9441a..9eda317b307 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -42,6 +42,7 @@ #include "qwaylandscreen_p.h" #include "qwaylandcursor_p.h" #include "qwaylanddisplay_p.h" +#include "qwaylandshmbackingstore_p.h" #include "../shared/qwaylandxkb.h" #include @@ -329,9 +330,26 @@ void QWaylandInputDevice::setCursor(Qt::CursorShape newShape, QWaylandScreen *sc setCursor(buffer, image); } +void QWaylandInputDevice::setCursor(const QCursor &cursor, QWaylandScreen *screen) +{ + if (cursor.shape() == Qt::BitmapCursor) { + setCursor(screen->waylandCursor()->cursorBitmapImage(&cursor), cursor.hotSpot()); + return; + } + setCursor(cursor.shape(), screen); +} + void QWaylandInputDevice::setCursor(struct wl_buffer *buffer, struct wl_cursor_image *image) +{ + setCursor(buffer, + image ? QPoint(image->hotspot_x, image->hotspot_y) : QPoint(), + image ? QSize(image->width, image->height) : QSize()); +} + +void QWaylandInputDevice::setCursor(struct wl_buffer *buffer, const QPoint &hotSpot, const QSize &size) { if (mCaps & WL_SEAT_CAPABILITY_POINTER) { + mPixmapCursor.clear(); mPointer->mCursorSerial = mPointer->mEnterSerial; /* Hide cursor */ if (!buffer) @@ -341,13 +359,19 @@ void QWaylandInputDevice::setCursor(struct wl_buffer *buffer, struct wl_cursor_i } mPointer->set_cursor(mPointer->mEnterSerial, pointerSurface, - image->hotspot_x, image->hotspot_y); + hotSpot.x(), hotSpot.y()); wl_surface_attach(pointerSurface, buffer, 0, 0); - wl_surface_damage(pointerSurface, 0, 0, image->width, image->height); + wl_surface_damage(pointerSurface, 0, 0, size.width(), size.height()); wl_surface_commit(pointerSurface); } } +void QWaylandInputDevice::setCursor(const QSharedPointer &buffer, const QPoint &hotSpot) +{ + setCursor(buffer->buffer(), hotSpot, buffer->size()); + mPixmapCursor = buffer; +} + class EnterEvent : public QWaylandPointerEvent { public: diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h index 8bfb45cd403..508b67078d9 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h +++ b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h @@ -93,7 +93,10 @@ public: struct ::wl_seat *wl_seat() { return QtWayland::wl_seat::object(); } void setCursor(Qt::CursorShape cursor, QWaylandScreen *screen); + void setCursor(const QCursor &cursor, QWaylandScreen *screen); void setCursor(struct wl_buffer *buffer, struct ::wl_cursor_image *image); + void setCursor(struct wl_buffer *buffer, const QPoint &hotSpot, const QSize &size); + void setCursor(const QSharedPointer &buffer, const QPoint &hotSpot); void handleWindowDestroyed(QWaylandWindow *window); void setDataDevice(QWaylandDataDevice *device); @@ -137,6 +140,8 @@ private: QTouchDevice *mTouchDevice; + QSharedPointer mPixmapCursor; + friend class QWaylandTouchExtension; friend class QWaylandQtKeyExtension; }; diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index caf24c0aab9..68fea2fac88 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -73,7 +73,7 @@ QWaylandWindow::QWaylandWindow(QWindow *window) , mWindowDecoration(0) , mMouseEventsInContentArea(false) , mMousePressedInContentArea(Qt::NoButton) - , m_cursorShape(Qt::ArrowCursor) + , m_cursor(Qt::ArrowCursor) , mWaitingForFrameSync(false) , mFrameCallback(0) , mRequestResizeSent(false) @@ -732,17 +732,17 @@ void QWaylandWindow::handleMouseEventWithDecoration(QWaylandInputDevice *inputDe } } -void QWaylandWindow::setMouseCursor(QWaylandInputDevice *device, Qt::CursorShape shape) +void QWaylandWindow::setMouseCursor(QWaylandInputDevice *device, const QCursor &cursor) { - if (m_cursorShape != shape || device->serial() > device->cursorSerial()) { - device->setCursor(shape, mScreen); - m_cursorShape = shape; + if (device->serial() >= device->cursorSerial()) { + device->setCursor(cursor, mScreen); + m_cursor = cursor; } } void QWaylandWindow::restoreMouseCursor(QWaylandInputDevice *device) { - setMouseCursor(device, window()->cursor().shape()); + setMouseCursor(device, window()->cursor()); } void QWaylandWindow::requestActivateWindow() diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index 701a9cdf6d0..3f35a1eba3f 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -168,7 +168,7 @@ public: inline bool isMaximized() const { return mState == Qt::WindowMaximized; } inline bool isFullscreen() const { return mState == Qt::WindowFullScreen; } - void setMouseCursor(QWaylandInputDevice *device, Qt::CursorShape shape); + void setMouseCursor(QWaylandInputDevice *device, const QCursor &cursor); void restoreMouseCursor(QWaylandInputDevice *device); QWaylandWindow *transientParent() const; @@ -206,7 +206,7 @@ protected: QWaylandAbstractDecoration *mWindowDecoration; bool mMouseEventsInContentArea; Qt::MouseButtons mMousePressedInContentArea; - Qt::CursorShape m_cursorShape; + QCursor m_cursor; WId mWindowId; bool mWaitingForFrameSync; From e862c2d2224b51deb42c95b440519b271463ec2a Mon Sep 17 00:00:00 2001 From: Erik Larsson Date: Sun, 3 Jan 2016 15:51:27 +0100 Subject: [PATCH 0302/1507] Simplify client-side API for Wayland extensions This simplifies the client-side API for Wayland extensions by introducing QWaylandClientExtension/QWaylandClientExtensionTemplate classes. These classes takes care of the initialization of the extension if it matches the interface name. Change-Id: I7c4fb34563563af4be072cdebda54954b79cddbe Reviewed-by: Johan Helsing Reviewed-by: Giulio Camuffo --- src/plugins/platforms/wayland/client.pro | 1 + .../platforms/wayland/global/global.pri | 9 ++ .../global/qwaylandclientextension.cpp | 95 ++++++++++++++++ .../wayland/global/qwaylandclientextension.h | 105 ++++++++++++++++++ .../global/qwaylandclientextension_p.h | 85 ++++++++++++++ .../qtwaylandscanner/qtwaylandscanner.cpp | 8 ++ 6 files changed, 303 insertions(+) create mode 100644 src/plugins/platforms/wayland/global/global.pri create mode 100644 src/plugins/platforms/wayland/global/qwaylandclientextension.cpp create mode 100644 src/plugins/platforms/wayland/global/qwaylandclientextension.h create mode 100644 src/plugins/platforms/wayland/global/qwaylandclientextension_p.h diff --git a/src/plugins/platforms/wayland/client.pro b/src/plugins/platforms/wayland/client.pro index edaff771abd..1219ee3451d 100644 --- a/src/plugins/platforms/wayland/client.pro +++ b/src/plugins/platforms/wayland/client.pro @@ -111,6 +111,7 @@ HEADERS += qwaylandintegration_p.h \ include(hardwareintegration/hardwareintegration.pri) include(shellintegration/shellintegration.pri) include(inputdeviceintegration/inputdeviceintegration.pri) +include(global/global.pri) CONFIG += generated_privates MODULE_PLUGIN_TYPES = \ diff --git a/src/plugins/platforms/wayland/global/global.pri b/src/plugins/platforms/wayland/global/global.pri new file mode 100644 index 00000000000..53c76cbc9db --- /dev/null +++ b/src/plugins/platforms/wayland/global/global.pri @@ -0,0 +1,9 @@ +INCLUDEPATH += $$PWD + +HEADERS += \ + $$PWD/qwaylandclientextension.h \ + $$PWD/qwaylandclientextension_p.h + +SOURCES += \ + $$PWD/qwaylandclientextension.cpp + diff --git a/src/plugins/platforms/wayland/global/qwaylandclientextension.cpp b/src/plugins/platforms/wayland/global/qwaylandclientextension.cpp new file mode 100644 index 00000000000..501f266f534 --- /dev/null +++ b/src/plugins/platforms/wayland/global/qwaylandclientextension.cpp @@ -0,0 +1,95 @@ +/**************************************************************************** +** +** Copyright (C) 2016 Erik Larsson. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the QtWaylandCompositor module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL3$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or later as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qwaylandclientextension.h" +#include "qwaylandclientextension_p.h" +#include +#include + +QT_BEGIN_NAMESPACE + +namespace QtWaylandClient { + +QWaylandClientExtensionPrivate::QWaylandClientExtensionPrivate() + : QObjectPrivate() + , waylandIntegration(new QWaylandIntegration()) + , version(-1) +{ + QtWaylandClient::QWaylandDisplay *waylandDisplay = waylandIntegration->display(); + struct ::wl_registry *registry = wl_display_get_registry(waylandDisplay->wl_display()); + QtWayland::wl_registry::init(registry); +} + +void QWaylandClientExtensionPrivate::registry_global(uint32_t id, const QString &interfaceName, uint32_t ver) +{ + Q_Q(QWaylandClientExtension); + if (interfaceName == QLatin1String(q->extensionInterface()->name)) { + struct ::wl_registry *registry = static_cast(QtWayland::wl_registry::object()); + q->bind(registry, id, ver); + } +} + +QWaylandClientExtension::QWaylandClientExtension(const int ver) + : QObject(*new QWaylandClientExtensionPrivate()) +{ + Q_D(QWaylandClientExtension); + d->version = ver; +} + +QWaylandIntegration *QWaylandClientExtension::integration() const +{ + Q_D(const QWaylandClientExtension); + return d->waylandIntegration; +} + +int QWaylandClientExtension::version() const +{ + Q_D(const QWaylandClientExtension); + return d->version; +} + +void QWaylandClientExtension::setVersion(const int ver) +{ + Q_D(QWaylandClientExtension); + if (d->version != ver) { + d->version = ver; + emit versionChanged(); + } +} + +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/global/qwaylandclientextension.h b/src/plugins/platforms/wayland/global/qwaylandclientextension.h new file mode 100644 index 00000000000..efdfa46fb65 --- /dev/null +++ b/src/plugins/platforms/wayland/global/qwaylandclientextension.h @@ -0,0 +1,105 @@ +/**************************************************************************** +** +** Copyright (C) 2016 Erik Larsson. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the QtWaylandCompositor module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL3$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or later as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWAYLANDCLIENTEXTENSION_H +#define QWAYLANDCLIENTEXTENSION_H + +#include +#include +#include +#include +QT_BEGIN_NAMESPACE + +namespace QtWaylandClient { + +class QWaylandIntegration; +class QWaylandClientExtensionPrivate; +class QWaylandClientExtensionTemplatePrivate; + +class Q_WAYLAND_CLIENT_EXPORT QWaylandClientExtension : public QObject +{ + Q_OBJECT + Q_DECLARE_PRIVATE(QWaylandClientExtension) + Q_PROPERTY(int protocolVersion READ version NOTIFY versionChanged) +public: + QWaylandClientExtension(const int version); + + QWaylandIntegration *integration() const; + int version() const; + + virtual const struct wl_interface *extensionInterface() const = 0; + virtual void bind(struct ::wl_registry *registry, int id, int version) = 0; +protected: + void setVersion(const int version); +Q_SIGNALS: + void versionChanged(); +}; + +template +class Q_WAYLAND_CLIENT_EXPORT QWaylandClientExtensionTemplate : public QWaylandClientExtension +{ + Q_DECLARE_PRIVATE(QWaylandClientExtensionTemplate) +public: + QWaylandClientExtensionTemplate(const int ver) : + QWaylandClientExtension(ver) + { + } + + const struct wl_interface *extensionInterface() const Q_DECL_OVERRIDE + { + return T::interface(); + } + + void bind(struct ::wl_registry *registry, int id, int ver) + { + T* instance = static_cast(this); + // Make sure lowest version is used of the supplied version from the + // developer and the version specified in the protocol and also the + // compositor version. + if (this->version() > T::interface()->version) { + qWarning("Supplied protocol version to QWaylandClientExtensionTemplate is higher than the version of the protocol, using protocol version instead."); + } + int minVersion = qMin(ver, qMin(T::interface()->version, this->version())); + setVersion(minVersion); + instance->init(registry, id, minVersion); + } +}; + +} + +QT_END_NAMESPACE + +#endif // QWAYLANDCLIENTEXTENSION_H diff --git a/src/plugins/platforms/wayland/global/qwaylandclientextension_p.h b/src/plugins/platforms/wayland/global/qwaylandclientextension_p.h new file mode 100644 index 00000000000..2676f0ee632 --- /dev/null +++ b/src/plugins/platforms/wayland/global/qwaylandclientextension_p.h @@ -0,0 +1,85 @@ +/**************************************************************************** +** +** Copyright (C) 2016 Erik Larsson. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the QtWaylandCompositor module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL3$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or later as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWAYLANDCLIENTEXTENSION_P_H +#define QWAYLANDCLIENTEXTENSION_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include "qwaylandclientextension.h" +#include +#include +#include + +QT_BEGIN_NAMESPACE + +namespace QtWaylandClient { + +class Q_WAYLAND_CLIENT_EXPORT QWaylandClientExtensionPrivate : public QObjectPrivate, public QtWayland::wl_registry +{ + Q_DECLARE_PUBLIC(QWaylandClientExtension) +public: + QWaylandClientExtensionPrivate(); + + QWaylandIntegration *waylandIntegration; + int version; + +protected: + void registry_global(uint32_t id, const QString &interfaceName, uint32_t version) Q_DECL_OVERRIDE; +}; + +class Q_WAYLAND_CLIENT_EXPORT QWaylandClientExtensionTemplatePrivate : public QWaylandClientExtensionPrivate +{ +public: + QWaylandClientExtensionTemplatePrivate() + : QWaylandClientExtensionPrivate() + { } +}; + +} + +QT_END_NAMESPACE + +#endif /*QWAYLANDCLIENTEXTENSION_P_H*/ diff --git a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp index afe3b80ecb7..b609523b6a0 100644 --- a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp +++ b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp @@ -878,6 +878,8 @@ void process(QXmlStreamReader &xml, const QByteArray &headerPath, const QByteArr printf(" const struct ::%s *object() const { return m_%s; }\n", interfaceName, interfaceName); printf("\n"); printf(" bool isInitialized() const;\n"); + printf("\n"); + printf(" static const struct ::wl_interface *interface();\n"); printEnums(interface.enums); @@ -1003,6 +1005,12 @@ void process(QXmlStreamReader &xml, const QByteArray &headerPath, const QByteArr printf(" {\n"); printf(" return m_%s != 0;\n", interfaceName); printf(" }\n"); + printf("\n"); + + printf(" const struct wl_interface *%s::interface()\n", interfaceName); + printf(" {\n"); + printf(" return &::%s_interface;\n", interfaceName); + printf(" }\n"); for (int i = 0; i < interface.requests.size(); ++i) { printf("\n"); From 0537b40bfe328ac734a6589c1ef8f401761688ae Mon Sep 17 00:00:00 2001 From: Pier Luigi Fiorini Date: Sun, 11 Jan 2015 11:14:58 +0100 Subject: [PATCH 0303/1507] Update wayland.xml to 1.6 Change-Id: I89b1dd4f6b6f03f54a9126dd5f67b0cdc9a006ad Reviewed-by: Johan Helsing Reviewed-by: Giulio Camuffo --- src/3rdparty/wayland/protocols/wayland.xml | 124 ++++++++++++++++----- 1 file changed, 96 insertions(+), 28 deletions(-) diff --git a/src/3rdparty/wayland/protocols/wayland.xml b/src/3rdparty/wayland/protocols/wayland.xml index bf6acd1d0ef..bb457bcf74f 100644 --- a/src/3rdparty/wayland/protocols/wayland.xml +++ b/src/3rdparty/wayland/protocols/wayland.xml @@ -246,7 +246,8 @@ This request will cause the server to remap the backing memory for the pool from the file descriptor passed when the pool was - created, but using the new size. + created, but using the new size. This request can only be + used to make the pool bigger. @@ -549,8 +550,8 @@ The current and pending input regions of the icon wl_surface are cleared, and wl_surface.set_input_region is ignored until the wl_surface is no longer used as the icon surface. When the use - as an icon ends, the the current and pending input regions - become undefined, and the wl_surface is unmapped. + as an icon ends, the current and pending input regions become + undefined, and the wl_surface is unmapped. @@ -976,6 +977,14 @@ cursor images for pointers, drag icons, etc. + + + These errors can be emitted in response to wl_surface requests. + + + + + Deletes the surface and invalidates its object ID. @@ -1059,28 +1068,39 @@ - - Request notification when the next frame is displayed. Useful - for throttling redrawing operations, and driving animations. + + Request a notification when it is a good time start drawing a new + frame, by creating a frame callback. This is useful for throttling + redrawing operations, and driving animations. + + When a client is animating on a wl_surface, it can use the 'frame' + request to get notified when it is a good time to draw and commit the + next frame of animation. If the client commits an update earlier than + that, it is likely that some updates will not make it to the display, + and the client is wasting resources by drawing too often. + The frame request will take effect on the next wl_surface.commit. The notification will only be posted for one frame unless - requested again. + requested again. For a wl_surface, the notifications are posted in + the order the frame requests were committed. + + The server must send the notifications so that a client + will not send excessive updates, while still allowing + the highest possible update rate for clients that wait for the reply + before drawing again. The server should give some time for the client + to draw and commit after sending the frame callback events to let them + hit the next output refresh. A server should avoid signalling the frame callbacks if the surface is not visible in any way, e.g. the surface is off-screen, or completely obscured by other opaque surfaces. - A client can request a frame callback even without an attach, - damage, or any other state changes. wl_surface.commit triggers a - display update, so the callback event will arrive after the next - output refresh where the surface is visible. - The object returned by this request will be destroyed by the compositor after the callback is fired and as such the client must not attempt to use it after that point. The callback_data passed in the callback is the current time, in - milliseconds. + milliseconds, with an undefined base. @@ -1201,6 +1221,11 @@ A newly created surface has its buffer transformation set to normal. + wl_surface.set_buffer_transform changes the pending buffer + transformation. wl_surface.commit copies the pending buffer + transformation to the current one. Otherwise, the pending and current + values are never changed. + The purpose of this request is to allow clients to render content according to the output transform, thus permiting the compositor to use certain optimizations even if the display is rotated. Using @@ -1212,6 +1237,10 @@ Note that if the transform value includes 90 or 270 degree rotation, the width of the buffer will become the surface height and the height of the buffer will become the surface width. + + If transform is not one of the values from the + wl_output.transform enum the invalid_transform protocol error + is raised. @@ -1227,6 +1256,10 @@ A newly created surface has its buffer scale set to 1. + wl_surface.set_buffer_scale changes the pending buffer scale. + wl_surface.commit copies the pending buffer scale to the current one. + Otherwise, the pending and current values are never changed. + The purpose of this request is to allow clients to supply higher resolution buffer data for use on high resolution outputs. Its intended that you pick the same buffer scale as the scale of the @@ -1236,12 +1269,15 @@ Note that if the scale is larger than 1, then you have to attach a buffer that is larger (by a factor of scale in each dimension) than the desired surface size. + + If scale is not positive the invalid_scale protocol error is + raised. - + A seat is a group of keyboards, pointer and touch devices. This object is published as a global during start up, or when such a @@ -1363,10 +1399,6 @@ - - - - Notification that this seat's pointer is focused on a certain @@ -1464,18 +1496,21 @@ + + + + + + + - + The wl_keyboard interface represents one or more keyboards associated with a seat. - - - - This specifies the format of the keymap provided to the @@ -1483,7 +1518,8 @@ - + @@ -1551,6 +1587,36 @@ + + + + + + + + + + + + Informs the client about the keyboard's repeat rate and delay. + + This event is sent as soon as the wl_keyboard object has been created, + and is guaranteed to be received by the client before any key press + event. + + Negative values for either rate or delay are illegal. A rate of zero + will disable any repeating (regardless of the value of delay). + + This event can be sent later on as well with a new value if necessary, + so clients should continue listening for the event past the creation + of wl_keyboard. + + + + + @@ -1565,10 +1631,6 @@ contact point can be identified by the ID of the sequence. - - - - A new touch point has appeared on the surface. This touch point is @@ -1621,6 +1683,12 @@ this surface may re-use the touch point ID. + + + + + + From 5324f6af4dbe06b64f2c8c256f9174ac10bb0148 Mon Sep 17 00:00:00 2001 From: Arnaud Vrac Date: Fri, 24 Jul 2015 19:51:22 +0200 Subject: [PATCH 0304/1507] inputdevice: map more X11 keys This is a copy of the key mapping in the XCB plugin. The only difference is the Launch* keys, which will be changed in Qt6 in the XCB plugin. Here we don't need to wait for that since the mapping is new. This also change the mapping of the following keys, which was incorrect: XKB_KEY_XF86AudioRewind: Qt::Key_MediaPrevious -> Qt::Key_AudioRewind XKB_KEY_XF86AudioForward: Qt::Key_MediaNext -> Qt::Key_AudioForward XKB_KEY_XF86Phone: Qt::Key_ToggleCallHangup -> Qt::Key_Phone Change-Id: I30308da8529dba5b139fc599314c9465573b848e Reviewed-by: Giulio Camuffo --- .../platforms/wayland/shared/qwaylandxkb.cpp | 153 ++++++++++++++++-- 1 file changed, 137 insertions(+), 16 deletions(-) diff --git a/src/plugins/platforms/wayland/shared/qwaylandxkb.cpp b/src/plugins/platforms/wayland/shared/qwaylandxkb.cpp index 90d2c5027ed..f5d0527de39 100644 --- a/src/plugins/platforms/wayland/shared/qwaylandxkb.cpp +++ b/src/plugins/platforms/wayland/shared/qwaylandxkb.cpp @@ -120,28 +120,149 @@ static const uint32_t KeyTbl[] = { XKB_KEY_Mode_switch, Qt::Key_Mode_switch, XKB_KEY_script_switch, Qt::Key_Mode_switch, - XKB_KEY_XF86AudioPlay, Qt::Key_MediaTogglePlayPause, //there isn't a PlayPause keysym, however just play keys are not common - XKB_KEY_XF86AudioPause, Qt::Key_MediaPause, + XKB_KEY_XF86Back, Qt::Key_Back, + XKB_KEY_XF86Forward, Qt::Key_Forward, + XKB_KEY_XF86Stop, Qt::Key_Stop, + XKB_KEY_XF86Refresh, Qt::Key_Refresh, + XKB_KEY_XF86Favorites, Qt::Key_Favorites, + XKB_KEY_XF86AudioMedia, Qt::Key_LaunchMedia, + XKB_KEY_XF86OpenURL, Qt::Key_OpenUrl, + XKB_KEY_XF86HomePage, Qt::Key_HomePage, + XKB_KEY_XF86Search, Qt::Key_Search, + XKB_KEY_XF86AudioLowerVolume, Qt::Key_VolumeDown, + XKB_KEY_XF86AudioMute, Qt::Key_VolumeMute, + XKB_KEY_XF86AudioRaiseVolume, Qt::Key_VolumeUp, + XKB_KEY_XF86AudioPlay, Qt::Key_MediaTogglePlayPause, XKB_KEY_XF86AudioStop, Qt::Key_MediaStop, XKB_KEY_XF86AudioPrev, Qt::Key_MediaPrevious, XKB_KEY_XF86AudioNext, Qt::Key_MediaNext, - XKB_KEY_XF86AudioRewind, Qt::Key_MediaPrevious, - XKB_KEY_XF86AudioForward, Qt::Key_MediaNext, XKB_KEY_XF86AudioRecord, Qt::Key_MediaRecord, - - XKB_KEY_XF86AudioMute, Qt::Key_VolumeMute, - XKB_KEY_XF86AudioLowerVolume, Qt::Key_VolumeDown, - XKB_KEY_XF86AudioRaiseVolume, Qt::Key_VolumeUp, - - XKB_KEY_XF86AudioRandomPlay, Qt::Key_AudioRandomPlay, - XKB_KEY_XF86AudioRepeat, Qt::Key_AudioRepeat, - + XKB_KEY_XF86AudioPause, Qt::Key_MediaPause, + XKB_KEY_XF86Mail, Qt::Key_LaunchMail, + XKB_KEY_XF86Calculator, Qt::Key_Calculator, + XKB_KEY_XF86Memo, Qt::Key_Memo, + XKB_KEY_XF86ToDoList, Qt::Key_ToDoList, + XKB_KEY_XF86Calendar, Qt::Key_Calendar, + XKB_KEY_XF86PowerDown, Qt::Key_PowerDown, + XKB_KEY_XF86ContrastAdjust, Qt::Key_ContrastAdjust, + XKB_KEY_XF86Standby, Qt::Key_Standby, + XKB_KEY_XF86MonBrightnessUp, Qt::Key_MonBrightnessUp, + XKB_KEY_XF86MonBrightnessDown, Qt::Key_MonBrightnessDown, + XKB_KEY_XF86KbdLightOnOff, Qt::Key_KeyboardLightOnOff, + XKB_KEY_XF86KbdBrightnessUp, Qt::Key_KeyboardBrightnessUp, + XKB_KEY_XF86KbdBrightnessDown, Qt::Key_KeyboardBrightnessDown, + XKB_KEY_XF86PowerOff, Qt::Key_PowerOff, + XKB_KEY_XF86WakeUp, Qt::Key_WakeUp, + XKB_KEY_XF86Eject, Qt::Key_Eject, + XKB_KEY_XF86ScreenSaver, Qt::Key_ScreenSaver, + XKB_KEY_XF86WWW, Qt::Key_WWW, + XKB_KEY_XF86Sleep, Qt::Key_Sleep, + XKB_KEY_XF86LightBulb, Qt::Key_LightBulb, + XKB_KEY_XF86Shop, Qt::Key_Shop, + XKB_KEY_XF86History, Qt::Key_History, + XKB_KEY_XF86AddFavorite, Qt::Key_AddFavorite, + XKB_KEY_XF86HotLinks, Qt::Key_HotLinks, + XKB_KEY_XF86BrightnessAdjust, Qt::Key_BrightnessAdjust, + XKB_KEY_XF86Finance, Qt::Key_Finance, + XKB_KEY_XF86Community, Qt::Key_Community, + XKB_KEY_XF86AudioRewind, Qt::Key_AudioRewind, + XKB_KEY_XF86BackForward, Qt::Key_BackForward, + XKB_KEY_XF86ApplicationLeft, Qt::Key_ApplicationLeft, + XKB_KEY_XF86ApplicationRight, Qt::Key_ApplicationRight, + XKB_KEY_XF86Book, Qt::Key_Book, + XKB_KEY_XF86CD, Qt::Key_CD, + XKB_KEY_XF86Calculater, Qt::Key_Calculator, + XKB_KEY_XF86Clear, Qt::Key_Clear, + XKB_KEY_XF86ClearGrab, Qt::Key_ClearGrab, + XKB_KEY_XF86Close, Qt::Key_Close, + XKB_KEY_XF86Copy, Qt::Key_Copy, + XKB_KEY_XF86Cut, Qt::Key_Cut, + XKB_KEY_XF86Display, Qt::Key_Display, + XKB_KEY_XF86DOS, Qt::Key_DOS, + XKB_KEY_XF86Documents, Qt::Key_Documents, + XKB_KEY_XF86Excel, Qt::Key_Excel, + XKB_KEY_XF86Explorer, Qt::Key_Explorer, + XKB_KEY_XF86Game, Qt::Key_Game, + XKB_KEY_XF86Go, Qt::Key_Go, + XKB_KEY_XF86iTouch, Qt::Key_iTouch, + XKB_KEY_XF86LogOff, Qt::Key_LogOff, + XKB_KEY_XF86Market, Qt::Key_Market, + XKB_KEY_XF86Meeting, Qt::Key_Meeting, + XKB_KEY_XF86MenuKB, Qt::Key_MenuKB, + XKB_KEY_XF86MenuPB, Qt::Key_MenuPB, + XKB_KEY_XF86MySites, Qt::Key_MySites, + XKB_KEY_XF86New, Qt::Key_New, + XKB_KEY_XF86News, Qt::Key_News, + XKB_KEY_XF86OfficeHome, Qt::Key_OfficeHome, + XKB_KEY_XF86Open, Qt::Key_Open, + XKB_KEY_XF86Option, Qt::Key_Option, + XKB_KEY_XF86Paste, Qt::Key_Paste, + XKB_KEY_XF86Phone, Qt::Key_Phone, + XKB_KEY_XF86Reply, Qt::Key_Reply, + XKB_KEY_XF86Reload, Qt::Key_Reload, + XKB_KEY_XF86RotateWindows, Qt::Key_RotateWindows, + XKB_KEY_XF86RotationPB, Qt::Key_RotationPB, + XKB_KEY_XF86RotationKB, Qt::Key_RotationKB, + XKB_KEY_XF86Save, Qt::Key_Save, + XKB_KEY_XF86Send, Qt::Key_Send, + XKB_KEY_XF86Spell, Qt::Key_Spell, + XKB_KEY_XF86SplitScreen, Qt::Key_SplitScreen, + XKB_KEY_XF86Support, Qt::Key_Support, + XKB_KEY_XF86TaskPane, Qt::Key_TaskPane, + XKB_KEY_XF86Terminal, Qt::Key_Terminal, + XKB_KEY_XF86Tools, Qt::Key_Tools, + XKB_KEY_XF86Travel, Qt::Key_Travel, + XKB_KEY_XF86Video, Qt::Key_Video, + XKB_KEY_XF86Word, Qt::Key_Word, + XKB_KEY_XF86Xfer, Qt::Key_Xfer, XKB_KEY_XF86ZoomIn, Qt::Key_ZoomIn, XKB_KEY_XF86ZoomOut, Qt::Key_ZoomOut, - - XKB_KEY_XF86Eject, Qt::Key_Eject, - - XKB_KEY_XF86Phone, Qt::Key_ToggleCallHangup, + XKB_KEY_XF86Away, Qt::Key_Away, + XKB_KEY_XF86Messenger, Qt::Key_Messenger, + XKB_KEY_XF86WebCam, Qt::Key_WebCam, + XKB_KEY_XF86MailForward, Qt::Key_MailForward, + XKB_KEY_XF86Pictures, Qt::Key_Pictures, + XKB_KEY_XF86Music, Qt::Key_Music, + XKB_KEY_XF86Battery, Qt::Key_Battery, + XKB_KEY_XF86Bluetooth, Qt::Key_Bluetooth, + XKB_KEY_XF86WLAN, Qt::Key_WLAN, + XKB_KEY_XF86UWB, Qt::Key_UWB, + XKB_KEY_XF86AudioForward, Qt::Key_AudioForward, + XKB_KEY_XF86AudioRepeat, Qt::Key_AudioRepeat, + XKB_KEY_XF86AudioRandomPlay, Qt::Key_AudioRandomPlay, + XKB_KEY_XF86Subtitle, Qt::Key_Subtitle, + XKB_KEY_XF86AudioCycleTrack, Qt::Key_AudioCycleTrack, + XKB_KEY_XF86Time, Qt::Key_Time, + XKB_KEY_XF86Select, Qt::Key_Select, + XKB_KEY_XF86View, Qt::Key_View, + XKB_KEY_XF86TopMenu, Qt::Key_TopMenu, + XKB_KEY_XF86Red, Qt::Key_Red, + XKB_KEY_XF86Green, Qt::Key_Green, + XKB_KEY_XF86Yellow, Qt::Key_Yellow, + XKB_KEY_XF86Blue, Qt::Key_Blue, + XKB_KEY_XF86Bluetooth, Qt::Key_Bluetooth, + XKB_KEY_XF86Suspend, Qt::Key_Suspend, + XKB_KEY_XF86Hibernate, Qt::Key_Hibernate, + XKB_KEY_XF86TouchpadToggle, Qt::Key_TouchpadToggle, + XKB_KEY_XF86TouchpadOn, Qt::Key_TouchpadOn, + XKB_KEY_XF86TouchpadOff, Qt::Key_TouchpadOff, + XKB_KEY_XF86AudioMicMute, Qt::Key_MicMute, + XKB_KEY_XF86Launch0, Qt::Key_Launch0, + XKB_KEY_XF86Launch1, Qt::Key_Launch1, + XKB_KEY_XF86Launch2, Qt::Key_Launch2, + XKB_KEY_XF86Launch3, Qt::Key_Launch3, + XKB_KEY_XF86Launch4, Qt::Key_Launch4, + XKB_KEY_XF86Launch5, Qt::Key_Launch5, + XKB_KEY_XF86Launch6, Qt::Key_Launch6, + XKB_KEY_XF86Launch7, Qt::Key_Launch7, + XKB_KEY_XF86Launch8, Qt::Key_Launch8, + XKB_KEY_XF86Launch9, Qt::Key_Launch9, + XKB_KEY_XF86LaunchA, Qt::Key_LaunchA, + XKB_KEY_XF86LaunchB, Qt::Key_LaunchB, + XKB_KEY_XF86LaunchC, Qt::Key_LaunchC, + XKB_KEY_XF86LaunchD, Qt::Key_LaunchD, + XKB_KEY_XF86LaunchE, Qt::Key_LaunchE, + XKB_KEY_XF86LaunchF, Qt::Key_LaunchF, 0, 0 }; From 93ee329289c77b37f66cc5876f4931fd7ea6e41c Mon Sep 17 00:00:00 2001 From: Pier Luigi Fiorini Date: Tue, 12 May 2015 08:29:41 +0200 Subject: [PATCH 0305/1507] Send keyboard repeat information Complete the API for keyboard rate and delay that was previously implemented sending the information to clients. Back then this wasn't possible for lack of Wayland >= 1.6 on the CI system. Change-Id: I95bab22bf4eea6549d2f8a762341c6485a24665c Reviewed-by: Johan Helsing Reviewed-by: Giulio Camuffo --- src/plugins/platforms/wayland/qwaylandinputdevice.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index 8f0e32f6dfb..e6d1423969d 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -173,10 +173,10 @@ QWaylandInputDevice::Touch::~Touch() QWaylandInputDevice::QWaylandInputDevice(QWaylandDisplay *display, int version, uint32_t id) : QObject() - , QtWayland::wl_seat(display->wl_registry(), id, qMin(version, 3)) + , QtWayland::wl_seat(display->wl_registry(), id, qMin(version, 4)) , mQDisplay(display) , mDisplay(display->wl_display()) - , mVersion(qMin(version, 3)) + , mVersion(qMin(version, 4)) , mCaps(0) , mDataDevice(0) , mKeyboard(0) From e418dbc40387b3d8a02ee2136e471f2b540150ed Mon Sep 17 00:00:00 2001 From: Arnaud Vrac Date: Mon, 19 Jan 2015 18:14:22 +0100 Subject: [PATCH 0306/1507] Filter key events through the input method context This allows the input method to capture keys, for example to implement the Compose key or to navigate in a virtual keyboard. Change-Id: Ic0ab318e84401ac339881eadd5eb992a2d57f9e3 Reviewed-by: Giulio Camuffo --- .../platforms/wayland/qwaylandinputdevice.cpp | 55 +++++++++++-------- 1 file changed, 32 insertions(+), 23 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index e6d1423969d..99c54238a8f 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -51,7 +51,9 @@ #include "../shared/qwaylandxkb.h" #include +#include #include +#include #include #include @@ -619,6 +621,26 @@ void QWaylandInputDevice::Keyboard::focusCallback(void *data, struct wl_callback QWindowSystemInterface::handleWindowActivated(self->mFocus ? self->mFocus->window() : 0); } +static void sendKey(QWindow *tlw, ulong timestamp, QEvent::Type type, int key, Qt::KeyboardModifiers modifiers, + quint32 nativeScanCode, quint32 nativeVirtualKey, quint32 nativeModifiers, + const QString& text = QString(), bool autorep = false, ushort count = 1) +{ + QPlatformInputContext *inputContext = QGuiApplicationPrivate::platformIntegration()->inputContext(); + bool filtered = false; + + if (inputContext) { + QKeyEvent event(type, key, modifiers, nativeScanCode, nativeVirtualKey, nativeModifiers, + text, autorep, count); + event.setTimestamp(timestamp); + filtered = inputContext->filterEvent(&event); + } + + if (!filtered) { + QWindowSystemInterface::handleExtendedKeyEvent(tlw, timestamp, type, key, modifiers, + nativeScanCode, nativeVirtualKey, nativeModifiers, text, autorep, count); + } +} + void QWaylandInputDevice::Keyboard::keyboard_key(uint32_t serial, uint32_t time, uint32_t key, uint32_t state) { QWaylandWindow *window = mFocus; @@ -660,17 +682,10 @@ void QWaylandInputDevice::Keyboard::keyboard_key(uint32_t serial, uint32_t time, text = QString::fromUcs4(&utf32, 1); } - QWindowSystemInterface::handleExtendedKeyEvent(window->window(), - time, type, qtkey, - modifiers, - code, sym, mNativeModifiers, text); + sendKey(window->window(), time, type, qtkey, modifiers, code, sym, mNativeModifiers, text); #else // Generic fallback for single hard keys: Assume 'key' is a Qt key code. - QWindowSystemInterface::handleExtendedKeyEvent(window->window(), - time, type, - qtkey, - Qt::NoModifier, - code, 0, 0); + sendKey(window->window(), time, type, qtkey, Qt::NoModifier, code, 0, 0); #endif if (state == WL_KEYBOARD_KEY_STATE_PRESSED @@ -695,27 +710,21 @@ void QWaylandInputDevice::Keyboard::keyboard_key(uint32_t serial, uint32_t time, void QWaylandInputDevice::Keyboard::repeatKey() { mRepeatTimer.setInterval(25); - QWindowSystemInterface::handleExtendedKeyEvent(mFocus->window(), - mRepeatTime, QEvent::KeyRelease, mRepeatKey, - modifiers(), - mRepeatCode, + sendKey(mFocus->window(), mRepeatTime, QEvent::KeyRelease, mRepeatKey, modifiers(), mRepeatCode, #ifndef QT_NO_WAYLAND_XKB - mRepeatSym, mNativeModifiers, + mRepeatSym, mNativeModifiers, #else - 0, 0, + 0, 0, #endif - mRepeatText, true); + mRepeatText, true); - QWindowSystemInterface::handleExtendedKeyEvent(mFocus->window(), - mRepeatTime, QEvent::KeyPress, mRepeatKey, - modifiers(), - mRepeatCode, + sendKey(mFocus->window(), mRepeatTime, QEvent::KeyPress, mRepeatKey, modifiers(), mRepeatCode, #ifndef QT_NO_WAYLAND_XKB - mRepeatSym, mNativeModifiers, + mRepeatSym, mNativeModifiers, #else - 0, 0, + 0, 0, #endif - mRepeatText, true); + mRepeatText, true); } void QWaylandInputDevice::Keyboard::keyboard_modifiers(uint32_t serial, From e7ba33c0ec00b2534f15f9908e6016108da4a6dd Mon Sep 17 00:00:00 2001 From: Erik Larsson Date: Sun, 27 Mar 2016 12:10:19 +0200 Subject: [PATCH 0307/1507] Remove attached() definition from header. The implementation of attached() method was removed in commit 'Fix SHM drawing logic' (330e3a78695bbe7f439676831b2336f3e5e26521) but the definition in the header file was not. Change-Id: Ib850bc7101a661882078be95011d75660f621622 Reviewed-by: Giulio Camuffo --- src/plugins/platforms/wayland/qwaylandwindow_p.h | 1 - 1 file changed, 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index 3f35a1eba3f..a905641f3d6 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -120,7 +120,6 @@ public: using QtWayland::wl_surface::attach; void attach(QWaylandBuffer *buffer, int x, int y); void attachOffset(QWaylandBuffer *buffer); - QWaylandBuffer *attached() const; QPoint attachOffset() const; using QtWayland::wl_surface::damage; From 3e0ad8f7c93768773127144fd915233a0e5ae0c9 Mon Sep 17 00:00:00 2001 From: Giulio Camuffo Date: Thu, 24 Mar 2016 12:53:07 +0200 Subject: [PATCH 0308/1507] Add QWaylandShellSurface::fromResource() Also make sure that the generated *::Resource::fromResource() code returns null if it doesn't own the resource or if the interface is wrong. Change-Id: I904e0dd49dd6e535ef8cab6687c6869e1000048d Reviewed-by: Johan Helsing Reviewed-by: Pier Luigi Fiorini --- src/tools/qtwaylandscanner/qtwaylandscanner.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp index b609523b6a0..5b9707a5a99 100644 --- a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp +++ b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp @@ -439,7 +439,7 @@ void process(QXmlStreamReader &xml, const QByteArray &headerPath, const QByteArr printf(" struct ::wl_client *client() const { return handle->client; }\n"); printf(" int version() const { return wl_resource_get_version(handle); }\n"); printf("\n"); - printf(" static Resource *fromResource(struct ::wl_resource *resource) { return static_cast(resource->data); }\n"); + printf(" static Resource *fromResource(struct ::wl_resource *resource);\n"); printf(" };\n"); printf("\n"); printf(" void init(struct ::wl_client *client, int id, int version);\n"); @@ -708,6 +708,13 @@ void process(QXmlStreamReader &xml, const QByteArray &headerPath, const QByteArr printf(" return resource;\n"); printf(" }\n"); + printf(" %s::Resource *%s::Resource::fromResource(struct ::wl_resource *resource)\n", interfaceName, interfaceName); + printf(" {\n"); + printf(" if (wl_resource_instance_of(resource, &::%s_interface, %s))\n", interfaceName, interfaceMember.constData()); + printf(" return static_cast(resource->data);\n"); + printf(" return 0;\n"); + printf(" }\n"); + if (hasRequests) { printf("\n"); printf(" const struct ::%s_interface %s::m_%s_interface = {", interfaceName, interfaceName, interfaceName); From d77d93487409cbfda35a29590adedfd91811dace Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Wed, 30 Mar 2016 15:13:44 +0200 Subject: [PATCH 0309/1507] Client: Don't create shell surfaces for QShapedPixmapWindow QShapedPixmapWindow is used as a drag-and-drop icon. This caused two roles (wl_data_device-icon and wl_shell_surface) to be assigned to the same surface, resulting in a protocol error. This bug hasn't been encountered before because QShapedPixmapWindow sets X11BypassWindowManagerHint, which was previously used to determine whether to create a shell surface or not. Task-number: QTBUG-52052 Change-Id: I1d79f3ec8ad08e0be1551c39df6232876dc2ac2e Reviewed-by: Giulio Camuffo Reviewed-by: Erik Larsson --- .../platforms/wayland/qwaylandwindow.cpp | 25 ++++++++++++++++--- .../platforms/wayland/qwaylandwindow_p.h | 2 ++ 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 68fea2fac88..2dd58e89cc5 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -116,13 +116,13 @@ QWaylandWindow::~QWaylandWindow() void QWaylandWindow::initWindow() { init(mDisplay->createSurface(static_cast(this))); - if (QPlatformWindow::parent()) { + + if (shouldCreateSubSurface()) { QWaylandWindow *p = static_cast(QPlatformWindow::parent()); if (::wl_subsurface *ss = mDisplay->createSubSurface(this, p)) { mSubSurfaceWindow = new QWaylandSubSurface(this, p, ss); } - } else if (!(qEnvironmentVariableIsSet("QT_WAYLAND_USE_BYPASSWINDOWMANAGERHINT") && - window()->flags() & Qt::BypassWindowManagerHint)) { + } else if (shouldCreateShellSurface()) { mShellSurface = mDisplay->createShellSurface(this); } @@ -176,6 +176,25 @@ void QWaylandWindow::initWindow() handleContentOrientationChange(window()->contentOrientation()); } +bool QWaylandWindow::shouldCreateShellSurface() const +{ + if (shouldCreateSubSurface()) + return false; + + if (window()->inherits("QShapedPixmapWindow")) + return false; + + if (qEnvironmentVariableIsSet("QT_WAYLAND_USE_BYPASSWINDOWMANAGERHINT")) + return window()->flags() & Qt::BypassWindowManagerHint; + + return true; +} + +bool QWaylandWindow::shouldCreateSubSurface() const +{ + return QPlatformWindow::parent() != Q_NULLPTR; +} + void QWaylandWindow::reset() { delete mShellSurface; diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index a905641f3d6..6e271cc1066 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -234,6 +234,8 @@ private: bool setWindowStateInternal(Qt::WindowState flags); void setGeometry_helper(const QRect &rect); void initWindow(); + bool shouldCreateShellSurface() const; + bool shouldCreateSubSurface() const; void reset(); void handleMouseEventWithDecoration(QWaylandInputDevice *inputDevice, const QWaylandPointerEvent &e); From 4a7a357aa846bf66fd308e9d4a9ca9d289d4f55f Mon Sep 17 00:00:00 2001 From: Giulio Camuffo Date: Fri, 11 Dec 2015 23:19:55 +0200 Subject: [PATCH 0310/1507] Implement the QPlatformWindow::requestUpdate() virtual method. The implementation will wait for the frame callback before firing the update event. Change-Id: Ieea748fda7c2aeb62cc40f35dbd122864c09f7cd Reviewed-by: Johan Helsing Reviewed-by: Pier Luigi Fiorini --- .../platforms/wayland/qwaylandwindow.cpp | 43 +++++++++++++------ .../platforms/wayland/qwaylandwindow_p.h | 4 ++ 2 files changed, 33 insertions(+), 14 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 80783060ae5..a3016646b8b 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -61,6 +61,7 @@ #include #include +#include #include @@ -91,6 +92,7 @@ QWaylandWindow::QWaylandWindow(QWindow *window) , mState(Qt::WindowNoState) , mMask() , mBackingStore(Q_NULLPTR) + , mUpdateRequested(false) { static WId id = 1; mWindowId = id++; @@ -431,10 +433,20 @@ void QWaylandWindow::requestResize() void QWaylandWindow::attach(QWaylandBuffer *buffer, int x, int y) { - if (buffer) + if (mFrameCallback) { + wl_callback_destroy(mFrameCallback); + mFrameCallback = 0; + } + + if (buffer) { + mFrameCallback = frame(); + wl_callback_add_listener(mFrameCallback, &QWaylandWindow::callbackListener, this); + mWaitingForFrameSync = true; + attach(buffer->buffer(), x, y); - else + } else { QtWayland::wl_surface::attach(0, 0, 0); + } } void QWaylandWindow::attachOffset(QWaylandBuffer *buffer) @@ -445,13 +457,6 @@ void QWaylandWindow::attachOffset(QWaylandBuffer *buffer) void QWaylandWindow::damage(const QRect &rect) { - //We have to do sync stuff before calling damage, or we might - //get a frame callback before we get the timestamp - if (!mWaitingForFrameSync) { - mFrameCallback = frame(); - wl_callback_add_listener(mFrameCallback,&QWaylandWindow::callbackListener,this); - mWaitingForFrameSync = true; - } damage(rect.x(), rect.y(), rect.width(), rect.height()); } @@ -463,12 +468,14 @@ void QWaylandWindow::frameCallback(void *data, struct wl_callback *callback, uin { Q_UNUSED(time); QWaylandWindow *self = static_cast(data); - if (callback != self->mFrameCallback) // might be a callback caused by the shm backingstore - return; + self->mWaitingForFrameSync = false; - if (self->mFrameCallback) { - wl_callback_destroy(self->mFrameCallback); - self->mFrameCallback = 0; + wl_callback_destroy(callback); + self->mFrameCallback = 0; + if (self->mUpdateRequested) { + QWindowPrivate *w = QWindowPrivate::get(self->window()); + w->deliverUpdateRequest(); + self->mUpdateRequested = false; } } @@ -871,6 +878,14 @@ QVariant QWaylandWindow::property(const QString &name, const QVariant &defaultVa return m_properties.value(name, defaultValue); } +void QWaylandWindow::requestUpdate() +{ + if (!mFrameCallback) + QPlatformWindow::requestUpdate(); + else + mUpdateRequested = true; +} + } QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index 02671a933f3..678fc3ae9d0 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -199,6 +199,8 @@ public: bool setKeyboardGrabEnabled(bool) Q_DECL_OVERRIDE { return false; } void propagateSizeHints() Q_DECL_OVERRIDE { } + void requestUpdate() Q_DECL_OVERRIDE; + public slots: void requestResize(); @@ -245,6 +247,8 @@ private: void handleMouseEventWithDecoration(QWaylandInputDevice *inputDevice, const QWaylandPointerEvent &e); + bool mUpdateRequested; + static const wl_callback_listener callbackListener; static void frameCallback(void *data, struct wl_callback *wl_callback, uint32_t time); From 853f8f6b67e4f3993e2548fbb49320bd20fb2df1 Mon Sep 17 00:00:00 2001 From: Jan Arne Petersen Date: Wed, 30 Dec 2015 00:08:17 +0100 Subject: [PATCH 0311/1507] Fix text-input support for new API Update text input support to upstream text-input protocol v2 from wayland-protocols. Remove support for input-method protocol for now. Map text-input protocol on compositor side to the Qt input method API, this allows to use any qt platform input method on compositor side (especially qtvirtualkeyboard). Add support for qtvirtualkeyboard to pure-qml example. Implement all missing functions of the text-input protocol. Change-Id: I597451ff65454a63dff86026b6a8d1ffbe07ce02 Done-with: Zeno Endemann Reviewed-by: Giulio Camuffo --- .../wayland/protocols/input-method.xml | 273 ---------- .../protocols/text-input-unstable-v2.xml | 478 ++++++++++++++++ src/3rdparty/wayland/protocols/text.xml | 346 ------------ src/plugins/platforms/wayland/client.pro | 4 +- .../platforms/wayland/qwaylanddisplay.cpp | 10 +- .../platforms/wayland/qwaylanddisplay_p.h | 6 +- .../wayland/qwaylandinputcontext.cpp | 512 +++++++++++++----- .../wayland/qwaylandinputcontext_p.h | 77 ++- .../platforms/wayland/qwaylandinputdevice.cpp | 27 +- .../platforms/wayland/qwaylandinputdevice_p.h | 6 + .../qwaylandinputmethodeventbuilder.cpp | 286 ++++++++++ .../shared/qwaylandinputmethodeventbuilder.h | 87 +++ .../platforms/wayland/shared/qwaylandxkb.cpp | 55 ++ .../platforms/wayland/shared/qwaylandxkb.h | 7 + 14 files changed, 1392 insertions(+), 782 deletions(-) delete mode 100644 src/3rdparty/wayland/protocols/input-method.xml create mode 100644 src/3rdparty/wayland/protocols/text-input-unstable-v2.xml delete mode 100644 src/3rdparty/wayland/protocols/text.xml create mode 100644 src/plugins/platforms/wayland/shared/qwaylandinputmethodeventbuilder.cpp create mode 100644 src/plugins/platforms/wayland/shared/qwaylandinputmethodeventbuilder.h diff --git a/src/3rdparty/wayland/protocols/input-method.xml b/src/3rdparty/wayland/protocols/input-method.xml deleted file mode 100644 index 70afdcb1dd4..00000000000 --- a/src/3rdparty/wayland/protocols/input-method.xml +++ /dev/null @@ -1,273 +0,0 @@ - - - - Copyright © 2012, 2013 Intel Corporation - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that copyright notice and this permission - notice appear in supporting documentation, and that the name of - the copyright holders not be used in advertising or publicity - pertaining to distribution of the software without specific, - written prior permission. The copyright holders make no - representations about the suitability of this software for any - purpose. It is provided "as is" without express or implied - warranty. - - THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS - SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND - FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY - SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN - AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, - ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF - THIS SOFTWARE. - - - - - - Corresponds to a text model on input method side. An input method context - is created on text mode activation on the input method side. It allows to - receive information about the text model from the application via events. - Input method contexts do not keep state after deactivation and should be - destroyed after deactivation is handled. - - Text is generally UTF-8 encoded, indices and lengths are in bytes. - - Serials are used to synchronize the state between the text input and - an input method. New serials are sent by the text input in the - commit_state request and are used by the input method to indicate - the known text input state in events like preedit_string, commit_string, - and keysym. The text input can then ignore events from the input method - which are based on an outdated state (for example after a reset). - - - - - Send the commit string text for insertion to the application. - - The text to commit could be either just a single character after a key - press or the result of some composing (pre-edit). It could be also an - empty text when some text should be removed (see - delete_surrounding_text) or when the input cursor should be moved (see - cursor_position). - - Any previously set composing text will be removed. - - - - - - - Send the pre-edit string text to the application text input. - - The commit text can be used to replace the preedit text on reset (for - example on unfocus). - - Also previously sent preedit_style and preedit_cursor requests are - processed bt the text_input also. - - - - - - - - Sets styling information on composing text. The style is applied for - length in bytes from index relative to the beginning of - the composing text (as byte offset). Multiple styles can - be applied to a composing text. - - This request should be sent before sending preedit_string request. - - - - - - - - Sets the cursor position inside the composing text (as byte offset) - relative to the start of the composing text. - - When index is negative no cursor should be displayed. - - This request should be sent before sending preedit_string request. - - - - - - - - This request will be handled on text_input side as part of a directly - following commit_string request. - - - - - - - Sets the cursor and anchor to a new position. Index is the new cursor - position in bytess (when >= 0 relative to the end of inserted text - else relative to beginning of inserted text). Anchor is the new anchor - position in bytes (when >= 0 relative to the end of inserted text, else - relative to beginning of inserted text). When there should be no - selected text anchor should be the same as index. - - This request will be handled on text_input side as part of a directly - following commit_string request. - - - - - - - - - - Notify when a key event was sent. Key events should not be used for - normal text input operations, which should be done with commit_string, - delete_surrounfing_text, etc. The key event follows the wl_keyboard key - event convention. Sym is a XKB keysym, state a wl_keyboard key_state. - - - - - - - - - - Allows an input method to receive hardware keyboard input and process - key events to generate text events (with pre-edit) over the wire. This - allows input methods which compose multiple key events for inputting - text like it is done for CJK languages. - - - - - - Should be used when filtering key events with grab_keyboard. - - When the wl_keyboard::key event is not processed by the input - method itself and should be sent to the client instead, forward it - with this request. The arguments should be the ones from the - wl_keyboard::key event. - - For generating custom key events use the keysym request instead. - - - - - - - - - Should be used when filtering key events with grab_keyboard. - - When the wl_keyboard::modifiers event should be also send to the - client, forward it with this request. The arguments should be the ones - from the wl_keyboard::modifiers event. - - - - - - - - - - - - - - - - - - The plain surrounding text around the input position. Cursor is the - position in bytes within the surrounding text relative to the beginning - of the text. Anchor is the position in bytes of the selection anchor - within the surrounding text relative to the beginning of the text. If - there is no selected text anchor is the same as cursor. - - - - - - - - - - - - - - - - - - - - - - - - - - An input method object is responsible to compose text in response to - input from hardware or virtual keyboards. There is one input method - object per seat. On activate there is a new input method context object - created which allows the input method to communicate with the text model. - - - - A text model was activated. Creates an input method context object - which allows communication with the text model. - - - - - - The text model corresponding to the context argument was deactivated. - The input method context should be destroyed after deactivation is - handled. - - - - - - - - Only one client can bind this interface at a time. - - - - - - - - - - - - - - - - A keybaord surface is only shown, when a text model is active - - - - - - - - An overlay panel is shown near the input cursor above the application - window when a text model is active. - - - - diff --git a/src/3rdparty/wayland/protocols/text-input-unstable-v2.xml b/src/3rdparty/wayland/protocols/text-input-unstable-v2.xml new file mode 100644 index 00000000000..bb366c9215c --- /dev/null +++ b/src/3rdparty/wayland/protocols/text-input-unstable-v2.xml @@ -0,0 +1,478 @@ + + + + + Copyright © 2012, 2013 Intel Corporation + Copyright © 2015, 2016 Jan Arne Petersen + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that copyright notice and this permission + notice appear in supporting documentation, and that the name of + the copyright holders not be used in advertising or publicity + pertaining to distribution of the software without specific, + written prior permission. The copyright holders make no + representations about the suitability of this software for any + purpose. It is provided "as is" without express or implied + warranty. + + THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS + SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND + FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY + SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN + AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF + THIS SOFTWARE. + + + + + The zwp_text_input_v2 interface represents text input and input methods + associated with a seat. It provides enter/leave events to follow the + text input focus for a seat. + + Requests are used to enable/disable the text-input object and set + state information like surrounding and selected text or the content type. + The information about the entered text is sent to the text-input object + via the pre-edit and commit events. Using this interface removes the need + for applications to directly process hardware key events and compose text + out of them. + + Text is valid UTF-8 encoded, indices and lengths are in bytes. Indices + have to always point to the first byte of an UTF-8 encoded code point. + Lengths are not allowed to contain just a part of an UTF-8 encoded code + point. + + State is sent by the state requests (set_surrounding_text, + set_content_type, set_cursor_rectangle and set_preferred_language) and + an update_state request. After an enter or an input_method_change event + all state information is invalidated and needs to be resent from the + client. A reset or entering a new widget on client side also + invalidates all current state information. + + + + + Destroy the wp_text_input object. Also disables all surfaces enabled + through this wp_text_input object + + + + + + Enable text input in a surface (usually when a text entry inside of it + has focus). + + This can be called before or after a surface gets text (or keyboard) + focus via the enter event. Text input to a surface is only active + when it has the current text (or keyboard) focus and is enabled. + + + + + + + Disable text input in a surface (typically when there is no focus on any + text entry inside the surface). + + + + + + + Requests input panels (virtual keyboard) to show. + + This should be used for example to show a virtual keyboard again + (with a tap) after it was closed by pressing on a close button on the + keyboard. + + + + + + Requests input panels (virtual keyboard) to hide. + + + + + + Sets the plain surrounding text around the input position. Text is + UTF-8 encoded. Cursor is the byte offset within the surrounding text. + Anchor is the byte offset of the selection anchor within the + surrounding text. If there is no selected text, anchor is the same as + cursor. + + Make sure to always send some text before and after the cursor + except when the cursor is at the beginning or end of text. + + When there was a configure_surrounding_text event take the + before_cursor and after_cursor arguments into account for picking how + much surrounding text to send. + + There is a maximum length of wayland messages so text can not be + longer than 4000 bytes. + + + + + + + + + Content hint is a bitmask to allow to modify the behavior of the text + input. + + + + + + + + + + + + + + + + + The content purpose allows to specify the primary purpose of a text + input. + + This allows an input method to show special purpose input panels with + extra characters or to disallow some characters. + + + + + + + + + + + + + + + + + + + Sets the content purpose and content hint. While the purpose is the + basic purpose of an input field, the hint flags allow to modify some + of the behavior. + + When no content type is explicitly set, a normal content purpose with + none hint should be assumed. + + + + + + + + Sets the cursor outline as a x, y, width, height rectangle in surface + local coordinates. + + Allows the compositor to put a window with word suggestions near the + cursor. + + + + + + + + + + Sets a specific language. This allows for example a virtual keyboard to + show a language specific layout. The "language" argument is a RFC-3066 + format language tag. + + It could be used for example in a word processor to indicate language of + currently edited document or in an instant message application which + tracks languages of contacts. + + + + + + + Defines the reason for sending an updated state. + + + + + + + + + + Allows to atomically send state updates from client. + + This request should follow after a batch of state updating requests + like set_surrounding_text, set_content_type, set_cursor_rectangle and + set_preferred_language. + + The flags field indicates why an updated state is sent to the input + method. + + Reset should be used by an editor widget after the text was changed + outside of the normal input method flow. + + For "change" it is enough to send the changed state, else the full + state should be send. + + Serial should be set to the serial from the last enter or + input_method_changed event. + + To make sure to not receive outdated input method events after a + reset or switching to a new widget wl_display_sync() should be used + after update_state in these cases. + + + + + + + + Notification that this seat's text-input focus is on a certain surface. + + When the seat has the keyboard capability the text-input focus follows + the keyboard focus. + + + + + + + + Notification that this seat's text-input focus is no longer on + a certain surface. + + The leave notification is sent before the enter notification + for the new focus. + + When the seat has the keyboard capabillity the text-input focus follows + the keyboard focus. + + + + + + + + + + + + + Notification that the visibility of the input panel (virtual keyboard) + changed. + + The rectangle x, y, width, height defines the area overlapped by the + input panel (virtual keyboard) on the surface having the text + focus in surface local coordinates. + + That can be used to make sure widgets are visible and not covered by + a virtual keyboard. + + + + + + + + + + + Notify when a new composing text (pre-edit) should be set around the + current cursor position. Any previously set composing text should + be removed. + + The commit text can be used to replace the composing text in some cases + (for example when losing focus). + + The text input should also handle all preedit_style and preedit_cursor + events occurring directly before preedit_string. + + + + + + + + + + + + + + + + + + + Sets styling information on composing text. The style is applied for + length bytes from index relative to the beginning of the composing + text (as byte offset). Multiple styles can be applied to a composing + text by sending multiple preedit_styling events. + + This event is handled as part of a following preedit_string event. + + + + + + + + + Sets the cursor position inside the composing text (as byte + offset) relative to the start of the composing text. When index is a + negative number no cursor is shown. + + When no preedit_cursor event is sent the cursor will be at the end of + the composing text by default. + + This event is handled as part of a following preedit_string event. + + + + + + + Notify when text should be inserted into the editor widget. The text to + commit could be either just a single character after a key press or the + result of some composing (pre-edit). It could be also an empty text + when some text should be removed (see delete_surrounding_text) or when + the input cursor should be moved (see cursor_position). + + Any previously set composing text should be removed. + + + + + + + Notify when the cursor or anchor position should be modified. + + This event should be handled as part of a following commit_string + event. + + The text between anchor and index should be selected. + + + + + + + + Notify when the text around the current cursor position should be + deleted. BeforeLength and afterLength is the length (in bytes) of text + before and after the current cursor position (excluding the selection) + to delete. + + This event should be handled as part of a following commit_string + or preedit_string event. + + + + + + + + Transfer an array of 0-terminated modifiers names. The position in + the array is the index of the modifier as used in the modifiers + bitmask in the keysym event. + + + + + + + Notify when a key event was sent. Key events should not be used + for normal text input operations, which should be done with + commit_string, delete_surrounding_text, etc. The key event follows + the wl_keyboard key event convention. Sym is a XKB keysym, state a + wl_keyboard key_state. Modifiers are a mask for effective modifiers + (where the modifier indices are set by the modifiers_map event) + + + + + + + + + + Sets the language of the input text. The "language" argument is a RFC-3066 + format language tag. + + + + + + + + + + + + + Sets the text direction of input text. + + It is mainly needed for showing input cursor on correct side of the + editor when there is no input yet done and making sure neutral + direction text is laid out properly. + + + + + + + Configure what amount of surrounding text is expected by the + input method. The surrounding text will be sent in the + set_surrounding_text request on the following state information updates. + + + + + + + + The input method changed on compositor side, which invalidates all + current state information. New state information should be sent from + the client via state requests (set_surrounding_text, + set_content_hint, ...) and update_state. + + + + + + + + + A factory for text-input objects. This object is a global singleton. + + + + + Destroy the wp_text_input_manager object. + + + + + + Creates a new text-input object for a given seat. + + + + + + diff --git a/src/3rdparty/wayland/protocols/text.xml b/src/3rdparty/wayland/protocols/text.xml deleted file mode 100644 index 1b5284dc307..00000000000 --- a/src/3rdparty/wayland/protocols/text.xml +++ /dev/null @@ -1,346 +0,0 @@ - - - - - Copyright © 2012, 2013 Intel Corporation - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that copyright notice and this permission - notice appear in supporting documentation, and that the name of - the copyright holders not be used in advertising or publicity - pertaining to distribution of the software without specific, - written prior permission. The copyright holders make no - representations about the suitability of this software for any - purpose. It is provided "as is" without express or implied - warranty. - - THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS - SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND - FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY - SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN - AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, - ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF - THIS SOFTWARE. - - - - - An object used for text input. Adds support for text input and input - methods to applications. A text-input object is created from a - wl_text_input_manager and corresponds typically to a text entry in an - application. - Requests are used to activate/deactivate the text-input object and set - state information like surrounding and selected text or the content type. - The information about entered text is sent to the text-input object via - the pre-edit and commit events. Using this interface removes the need - for applications to directly process hardware key events and compose text - out of them. - - Text is generally UTF-8 encoded, indices and lengths are in bytes. - - Serials are used to synchronize the state between the text input and - an input method. New serials are sent by the text input in the - commit_state request and are used by the input method to indicate - the known text input state in events like preedit_string, commit_string, - and keysym. The text input can then ignore events from the input method - which are based on an outdated state (for example after a reset). - - - - Requests the text-input object to be activated (typically when the - text entry gets focus). - The seat argument is a wl_seat which maintains the focus for this - activation. The surface argument is a wl_surface assigned to the - text-input object and tracked for focus lost. The enter event - is emitted on successful activation. - - - - - - - Requests the text-input object to be deactivated (typically when the - text entry lost focus). The seat argument is a wl_seat which was used - for activation. - - - - - - Requests input panels (virtual keyboard) to show. - - - - - Requests input panels (virtual keyboard) to hide. - - - - - Should be called by an editor widget when the input state should be - reset, for example after the text was changed outside of the normal - input method flow. - - - - - Sets the plain surrounding text around the input position. Text is - UTF-8 encoded. Cursor is the byte offset within the - surrounding text. Anchor is the byte offset of the - selection anchor within the surrounding text. If there is no selected - text anchor is the same as cursor. - - - - - - - - Content hint is a bitmask to allow to modify the behavior of the text - input. - - - - - - - - - - - - - - - - - - The content purpose allows to specify the primary purpose of a text - input. - - This allows an input method to show special purpose input panels with - extra characters or to disallow some characters. - - - - - - - - - - - - - - - - - - Sets the content purpose and content hint. While the purpose is the - basic purpose of an input field, the hint flags allow to modify some - of the behavior. - - When no content type is explicitly set, a normal content purpose with - default hints (auto completion, auto correction, auto capitalization) - should be assumed. - - - - - - - - - - - - - Sets a specific language. This allows for example a virtual keyboard to - show a language specific layout. The "language" argument is a RFC-3066 - format language tag. - - It could be used for example in a word processor to indicate language of - currently edited document or in an instant message application which tracks - languages of contacts. - - - - - - - - - - - - - Notify the text-input object when it received focus. Typically in - response to an activate request. - - - - - - Notify the text-input object when it lost focus. Either in response - to a deactivate request or when the assigned surface lost focus or was - destroyed. - - - - - Transfer an array of 0-terminated modifiers names. The position in - the array is the index of the modifier as used in the modifiers - bitmask in the keysym event. - - - - - - Notify when the visibility state of the input panel changed. - - - - - - Notify when a new composing text (pre-edit) should be set around the - current cursor position. Any previously set composing text should - be removed. - - The commit text can be used to replace the preedit text on reset - (for example on unfocus). - - The text input should also handle all preedit_style and preedit_cursor - events occuring directly before preedit_string. - - - - - - - - - - - - - - - - - - Sets styling information on composing text. The style is applied for - length bytes from index relative to the beginning of the composing - text (as byte offset). Multiple styles can - be applied to a composing text by sending multiple preedit_styling - events. - - This event is handled as part of a following preedit_string event. - - - - - - - - Sets the cursor position inside the composing text (as byte - offset) relative to the start of the composing text. When index is a - negative number no cursor is shown. - - This event is handled as part of a following preedit_string event. - - - - - - Notify when text should be inserted into the editor widget. The text to - commit could be either just a single character after a key press or the - result of some composing (pre-edit). It could be also an empty text - when some text should be removed (see delete_surrounding_text) or when - the input cursor should be moved (see cursor_position). - - Any previously set composing text should be removed. - - - - - - - Notify when the cursor or anchor position should be modified. - - This event should be handled as part of a following commit_string - event. - - - - - - - Notify when the text around the current cursor position should be - deleted. - - Index is relative to the current cursor (in bytes). - Length is the length of deleted text (in bytes). - - This event should be handled as part of a following commit_string - event. - - - - - - - Notify when a key event was sent. Key events should not be used - for normal text input operations, which should be done with - commit_string, delete_surrounding_text, etc. The key event follows - the wl_keyboard key event convention. Sym is a XKB keysym, state a - wl_keyboard key_state. Modifiers are a mask for effective modifiers - (where the modifier indices are set by the modifiers_map event) - - - - - - - - - - Sets the language of the input text. The "language" argument is a RFC-3066 - format language tag. - - - - - - - - - - - - Sets the text direction of input text. - - It is mainly needed for showing input cursor on correct side of the - editor when there is no input yet done and making sure neutral - direction text is laid out properly. - - - - - - - - - A factory for text-input objects. This object is a global singleton. - - - - Creates a new text-input object. - - - - - diff --git a/src/plugins/platforms/wayland/client.pro b/src/plugins/platforms/wayland/client.pro index 1219ee3451d..61404eeb98c 100644 --- a/src/plugins/platforms/wayland/client.pro +++ b/src/plugins/platforms/wayland/client.pro @@ -39,7 +39,7 @@ WAYLANDCLIENTSOURCES += \ ../extensions/touch-extension.xml \ ../extensions/qtkey-extension.xml \ ../extensions/windowmanager.xml \ - ../3rdparty/protocol/text.xml \ + ../3rdparty/protocol/text-input-unstable-v2.xml \ ../3rdparty/protocol/xdg-shell.xml \ SOURCES += qwaylandintegration.cpp \ @@ -66,6 +66,7 @@ SOURCES += qwaylandintegration.cpp \ qwaylandqtkey.cpp \ ../shared/qwaylandmimehelper.cpp \ ../shared/qwaylandxkb.cpp \ + ../shared/qwaylandinputmethodeventbuilder.cpp \ qwaylandabstractdecoration.cpp \ qwaylanddecorationfactory.cpp \ qwaylanddecorationplugin.cpp \ @@ -100,6 +101,7 @@ HEADERS += qwaylandintegration_p.h \ qwaylandqtkey_p.h \ ../shared/qwaylandmimehelper.h \ ../shared/qwaylandxkb.h \ + ../shared/qwaylandinputmethodeventbuilder.h \ qwaylandabstractdecoration_p.h \ qwaylanddecorationfactory_p.h \ qwaylanddecorationplugin_p.h \ diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index 7244363cd08..a18b9853faf 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -50,6 +50,7 @@ #include "qwaylandxdgshell_p.h" #include "qwaylandxdgsurface_p.h" #include "qwaylandwlshellsurface_p.h" +#include "qwaylandinputcontext_p.h" #include "qwaylandwindowmanagerintegration_p.h" #include "qwaylandshellintegration_p.h" @@ -60,7 +61,7 @@ #include "qwaylandtouch_p.h" #include "qwaylandqtkey_p.h" -#include +#include #include #include @@ -281,8 +282,11 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin mTouchExtension.reset(new QWaylandTouchExtension(this, id)); } else if (interface == QStringLiteral("qt_key_extension")) { mQtKeyExtension.reset(new QWaylandQtKeyExtension(this, id)); - } else if (interface == QStringLiteral("wl_text_input_manager")) { - mTextInputManager.reset(new QtWayland::wl_text_input_manager(registry, id, 1)); + } else if (interface == QStringLiteral("zwp_text_input_manager_v2")) { + mTextInputManager.reset(new QtWayland::zwp_text_input_manager_v2(registry, id, 1)); + foreach (QWaylandInputDevice *inputDevice, mInputDevices) { + inputDevice->setTextInput(new QWaylandTextInput(this, mTextInputManager->get_text_input(inputDevice->wl_seat()))); + } } else if (interface == QStringLiteral("qt_hardware_integration")) { mHardwareIntegration.reset(new QWaylandHardwareIntegration(registry, id)); // make a roundtrip here since we need to receive the events sent by diff --git a/src/plugins/platforms/wayland/qwaylanddisplay_p.h b/src/plugins/platforms/wayland/qwaylanddisplay_p.h index 82d87cb928f..618e57c59a8 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay_p.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay_p.h @@ -76,7 +76,7 @@ namespace QtWayland { class qt_shell; class qt_sub_surface_extension; class qt_surface_extension; - class wl_text_input_manager; + class zwp_text_input_manager_v2; class xdg_shell; } @@ -147,7 +147,7 @@ public: QtWayland::qt_surface_extension *windowExtension() const { return mWindowExtension.data(); } QWaylandTouchExtension *touchExtension() const { return mTouchExtension.data(); } - QtWayland::wl_text_input_manager *textInputManager() const { return mTextInputManager.data(); } + QtWayland::zwp_text_input_manager_v2 *textInputManager() const { return mTextInputManager.data(); } QWaylandHardwareIntegration *hardwareIntegration() const { return mHardwareIntegration.data(); } struct RegistryGlobal { @@ -207,7 +207,7 @@ private: QScopedPointer mTouchExtension; QScopedPointer mQtKeyExtension; QScopedPointer mWindowManagerIntegration; - QScopedPointer mTextInputManager; + QScopedPointer mTextInputManager; QScopedPointer mHardwareIntegration; QSocketNotifier *mReadNotifier; int mFd; diff --git a/src/plugins/platforms/wayland/qwaylandinputcontext.cpp b/src/plugins/platforms/wayland/qwaylandinputcontext.cpp index 00f6a43038f..aeaf415d2cd 100644 --- a/src/plugins/platforms/wayland/qwaylandinputcontext.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputcontext.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 Klarälvdalens Datakonsult AB (KDAB). +** Copyright (C) 2016 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the QtWaylandClient module of the Qt Toolkit. @@ -40,147 +40,358 @@ #include "qwaylandinputcontext_p.h" -#include -#include -#ifndef QT_NO_WAYLAND_XKB -#include -#endif +#include +#include +#include +#include +#include #include "qwaylanddisplay_p.h" #include "qwaylandinputdevice_p.h" +#include "qwaylandinputmethodeventbuilder.h" #include "qwaylandwindow_p.h" +#include "qwaylandxkb.h" QT_BEGIN_NAMESPACE +Q_LOGGING_CATEGORY(qLcQpaInputMethods, "qt.qpa.input.methods") + namespace QtWaylandClient { -static Qt::Key toQtKey(uint32_t sym) -{ -#ifndef QT_NO_WAYLAND_XKB - switch (static_cast(sym)) { - case XKB_KEY_BackSpace: - return Qt::Key_Backspace; - case XKB_KEY_Return: - return Qt::Key_Return; - case XKB_KEY_Left: - return Qt::Key_Left; - case XKB_KEY_Up: - return Qt::Key_Up; - case XKB_KEY_Right: - return Qt::Key_Right; - case XKB_KEY_Down: - return Qt::Key_Down; - default: - return Qt::Key_unknown; - } -#else - Q_UNUSED(sym) - return Qt::Key_unknown; -#endif +namespace { +const Qt::InputMethodQueries supportedQueries = Qt::ImEnabled | + Qt::ImSurroundingText | + Qt::ImCursorPosition | + Qt::ImAnchorPosition | + Qt::ImHints | + Qt::ImCursorRectangle | + Qt::ImPreferredLanguage; } -static QEvent::Type toQEventType(uint32_t state) -{ - switch (static_cast(state)) { - default: - case WL_KEYBOARD_KEY_STATE_PRESSED: - return QEvent::KeyPress; - case WL_KEYBOARD_KEY_STATE_RELEASED: - return QEvent::KeyRelease; - } -} - -QWaylandTextInput::QWaylandTextInput(struct ::wl_text_input *text_input) - : QtWayland::wl_text_input(text_input) - , m_commit() +QWaylandTextInput::QWaylandTextInput(QWaylandDisplay *display, struct ::zwp_text_input_v2 *text_input) + : QtWayland::zwp_text_input_v2(text_input) + , m_display(display) + , m_builder() , m_serial(0) - , m_resetSerial(0) + , m_surface(nullptr) + , m_preeditCommit() + , m_inputPanelVisible(false) + , m_keyboardRectangle() + , m_locale() + , m_inputDirection(Qt::LayoutDirectionAuto) + , m_resetCallback(nullptr) { } -QString QWaylandTextInput::commitString() const +QWaylandTextInput::~QWaylandTextInput() { - return m_commit; + if (m_resetCallback) + wl_callback_destroy(m_resetCallback); } void QWaylandTextInput::reset() { - wl_text_input::reset(); - updateState(); - m_resetSerial = m_serial; + m_builder.reset(); + m_preeditCommit = QString(); + updateState(Qt::ImQueryAll, update_state_reset); } -void QWaylandTextInput::updateState() +void QWaylandTextInput::commit() +{ + if (QObject *o = QGuiApplication::focusObject()) { + QInputMethodEvent event; + event.setCommitString(m_preeditCommit); + QCoreApplication::sendEvent(o, &event); + } + + reset(); +} + +const wl_callback_listener QWaylandTextInput::callbackListener = { + QWaylandTextInput::resetCallback +}; + +void QWaylandTextInput::resetCallback(void *data, wl_callback *, uint32_t) +{ + QWaylandTextInput *self = static_cast(data); + + if (self->m_resetCallback) { + wl_callback_destroy(self->m_resetCallback); + self->m_resetCallback = nullptr; + } +} + +void QWaylandTextInput::updateState(Qt::InputMethodQueries queries, uint32_t flags) { if (!QGuiApplication::focusObject()) return; - QInputMethodQueryEvent event(Qt::ImQueryAll); + if (!QGuiApplication::focusWindow() || !QGuiApplication::focusWindow()->handle()) + return; + + struct ::wl_surface *surface = static_cast(QGuiApplication::focusWindow()->handle())->object(); + if (!surface || (surface != m_surface)) + return; + + queries &= supportedQueries; + + // Surrounding text, cursor and anchor positions are transferred together + if ((queries & Qt::ImSurroundingText) || (queries & Qt::ImCursorPosition) || (queries & Qt::ImAnchorPosition)) + queries |= Qt::ImSurroundingText | Qt::ImCursorPosition | Qt::ImAnchorPosition; + + QInputMethodQueryEvent event(queries); QCoreApplication::sendEvent(QGuiApplication::focusObject(), &event); - const QString &text = event.value(Qt::ImSurroundingText).toString(); - const int cursor = event.value(Qt::ImCursorPosition).toInt(); - const int anchor = event.value(Qt::ImAnchorPosition).toInt(); + if ((queries & Qt::ImSurroundingText) || (queries & Qt::ImCursorPosition) || (queries & Qt::ImAnchorPosition)) { + QString text = event.value(Qt::ImSurroundingText).toString(); + int cursor = event.value(Qt::ImCursorPosition).toInt(); + int anchor = event.value(Qt::ImAnchorPosition).toInt(); - set_surrounding_text(text, text.leftRef(cursor).toUtf8().size(), text.leftRef(anchor).toUtf8().size()); + // Make sure text is not too big + if (text.toUtf8().size() > 2048) { + int c = qAbs(cursor - anchor) <= 512 ? qMin(cursor, anchor) + qAbs(cursor - anchor) / 2: cursor; - commit_state(++m_serial); + const int offset = c - qBound(0, c, 512 - qMin(text.size() - c, 256)); + text = text.mid(offset + c - 256, 512); + cursor -= offset; + anchor -= offset; + } + + set_surrounding_text(text, text.leftRef(cursor).toUtf8().size(), text.leftRef(anchor).toUtf8().size()); + } + + if (queries & Qt::ImHints) { + QWaylandInputMethodContentType contentType = QWaylandInputMethodContentType::convert(static_cast(event.value(Qt::ImHints).toInt())); + set_content_type(contentType.hint, contentType.purpose); + } + + if (queries & Qt::ImCursorRectangle) { + const QRect &cRect = event.value(Qt::ImCursorRectangle).toRect(); + const QRect &tRect = QGuiApplication::inputMethod()->inputItemTransform().mapRect(cRect); + set_cursor_rectangle(tRect.x(), tRect.y(), tRect.width(), tRect.height()); + } + + if (queries & Qt::ImPreferredLanguage) { + const QString &language = event.value(Qt::ImPreferredLanguage).toString(); + set_preferred_language(language); + } + + update_state(m_serial, flags); + if (flags != update_state_change) { + if (m_resetCallback) + wl_callback_destroy(m_resetCallback); + m_resetCallback = wl_display_sync(m_display->wl_display()); + wl_callback_add_listener(m_resetCallback, &QWaylandTextInput::callbackListener, this); + } } -void QWaylandTextInput::text_input_preedit_string(uint32_t serial, const QString &text, const QString &commit) +bool QWaylandTextInput::isInputPanelVisible() const { - Q_UNUSED(serial) + return m_inputPanelVisible; +} + +QRectF QWaylandTextInput::keyboardRect() const +{ + return m_keyboardRectangle; +} + +QLocale QWaylandTextInput::locale() const +{ + return m_locale; +} + +Qt::LayoutDirection QWaylandTextInput::inputDirection() const +{ + return m_inputDirection; +} + +void QWaylandTextInput::zwp_text_input_v2_enter(uint32_t serial, ::wl_surface *surface) +{ + m_serial = serial; + m_surface = surface; + + updateState(Qt::ImQueryAll, update_state_enter); +} + +void QWaylandTextInput::zwp_text_input_v2_leave(uint32_t serial, ::wl_surface *surface) +{ + m_serial = serial; + + if (m_surface != surface) { + qCDebug(qLcQpaInputMethods()) << Q_FUNC_INFO << "Got leave event for surface" << surface << "focused surface" << m_surface; + } + + m_surface = nullptr; +} + +void QWaylandTextInput::zwp_text_input_v2_modifiers_map(wl_array *map) +{ + QList modifiersMap = QByteArray::fromRawData(static_cast(map->data), map->size).split('\0'); + + m_modifiersMap.clear(); + + Q_FOREACH (const QByteArray &modifier, modifiersMap) { + if (modifier == "Shift") + m_modifiersMap.append(Qt::ShiftModifier); + else if (modifier == "Control") + m_modifiersMap.append(Qt::ControlModifier); + else if (modifier == "Alt") + m_modifiersMap.append(Qt::AltModifier); + else if (modifier == "Mod1") + m_modifiersMap.append(Qt::AltModifier); + else if (modifier == "Mod4") + m_modifiersMap.append(Qt::MetaModifier); + else + m_modifiersMap.append(Qt::NoModifier); + } +} + +void QWaylandTextInput::zwp_text_input_v2_input_panel_state(uint32_t visible, int32_t x, int32_t y, int32_t width, int32_t height) +{ + const bool inputPanelVisible = (visible == input_panel_visibility_visible); + if (m_inputPanelVisible != inputPanelVisible) { + m_inputPanelVisible = inputPanelVisible; + QGuiApplicationPrivate::platformIntegration()->inputContext()->emitInputPanelVisibleChanged(); + } + const QRectF keyboardRectangle(x, y, width, height); + if (m_keyboardRectangle != keyboardRectangle) { + m_keyboardRectangle = keyboardRectangle; + QGuiApplicationPrivate::platformIntegration()->inputContext()->emitKeyboardRectChanged(); + } +} + +void QWaylandTextInput::zwp_text_input_v2_preedit_string(const QString &text, const QString &commit) +{ + if (m_resetCallback) { + qCDebug(qLcQpaInputMethods()) << "discard preedit_string: reset not confirmed"; + m_builder.reset(); + return; + } + if (!QGuiApplication::focusObject()) return; - m_commit = commit; - QList attributes; - QInputMethodEvent event(text, attributes); + QInputMethodEvent event = m_builder.buildPreedit(text); + + m_builder.reset(); + m_preeditCommit = commit; + QCoreApplication::sendEvent(QGuiApplication::focusObject(), &event); } -void QWaylandTextInput::text_input_commit_string(uint32_t serial, const QString &text) +void QWaylandTextInput::zwp_text_input_v2_preedit_styling(uint32_t index, uint32_t length, uint32_t style) { - Q_UNUSED(serial); + m_builder.addPreeditStyling(index, length, style); +} + +void QWaylandTextInput::zwp_text_input_v2_preedit_cursor(int32_t index) +{ + m_builder.setPreeditCursor(index); +} + +void QWaylandTextInput::zwp_text_input_v2_commit_string(const QString &text) +{ + if (m_resetCallback) { + qCDebug(qLcQpaInputMethods()) << "discard commit_string: reset not confirmed"; + m_builder.reset(); + return; + } + if (!QGuiApplication::focusObject()) return; - QInputMethodEvent event; - event.setCommitString(text); + QInputMethodEvent event = m_builder.buildCommit(text); + + m_builder.reset(); + QCoreApplication::sendEvent(QGuiApplication::focusObject(), &event); - - m_commit = QString(); } -void QWaylandTextInput::text_input_enter(wl_surface *) +void QWaylandTextInput::zwp_text_input_v2_cursor_position(int32_t index, int32_t anchor) { - updateState(); - m_resetSerial = m_serial; + m_builder.setCursorPosition(index, anchor); } -void QWaylandTextInput::text_input_leave() +void QWaylandTextInput::zwp_text_input_v2_delete_surrounding_text(uint32_t before_length, uint32_t after_length) { - if (!m_commit.isEmpty()) - text_input_commit_string(0, m_commit); + m_builder.setDeleteSurroundingText(before_length, after_length); } -void QWaylandTextInput::text_input_keysym(uint32_t serial, uint32_t time, uint32_t sym, uint32_t state, uint32_t modifiers) +void QWaylandTextInput::zwp_text_input_v2_keysym(uint32_t time, uint32_t sym, uint32_t state, uint32_t modifiers) { - Q_UNUSED(serial); - Q_UNUSED(time); - Q_UNUSED(modifiers); - if (!QGuiApplication::focusObject()) + if (m_resetCallback) { + qCDebug(qLcQpaInputMethods()) << "discard keysym: reset not confirmed"; + return; + } + + if (!QGuiApplication::focusWindow()) return; - // TODO: Convert modifiers to Qt::KeyboardModifiers. - QKeyEvent event(toQEventType(state), toQtKey(sym), Qt::NoModifier); - QCoreApplication::sendEvent(qGuiApp->focusWindow(), &event); + Qt::KeyboardModifiers qtModifiers = modifiersToQtModifiers(modifiers); + + QEvent::Type type = QWaylandXkb::toQtEventType(state); + const QString &text = QWaylandXkb::textFromKeysym(sym, qtModifiers); + int qtkey = QWaylandXkb::keysymToQtKey(sym, qtModifiers, text); + + QWindowSystemInterface::handleKeyEvent(QGuiApplication::focusWindow(), + time, type, qtkey, qtModifiers, text); +} + +void QWaylandTextInput::zwp_text_input_v2_language(const QString &language) +{ + if (m_resetCallback) { + qCDebug(qLcQpaInputMethods()) << "discard language: reset not confirmed"; + return; + } + + const QLocale locale(language); + if (m_locale != locale) { + m_locale = locale; + QGuiApplicationPrivate::platformIntegration()->inputContext()->emitLocaleChanged(); + } +} + +void QWaylandTextInput::zwp_text_input_v2_text_direction(uint32_t direction) +{ + if (m_resetCallback) { + qCDebug(qLcQpaInputMethods()) << "discard text_direction: reset not confirmed"; + return; + } + + const Qt::LayoutDirection inputDirection = (direction == text_direction_auto) ? Qt::LayoutDirectionAuto : + (direction == text_direction_ltr) ? Qt::LeftToRight : + (direction == text_direction_rtl) ? Qt::RightToLeft : Qt::LayoutDirectionAuto; + if (m_inputDirection != inputDirection) { + m_inputDirection = inputDirection; + QGuiApplicationPrivate::platformIntegration()->inputContext()->emitInputDirectionChanged(m_inputDirection); + } +} + +void QWaylandTextInput::zwp_text_input_v2_input_method_changed(uint32_t serial, uint32_t flags) +{ + Q_UNUSED(flags); + + m_serial = serial; + updateState(Qt::ImQueryAll, update_state_full); +} + +Qt::KeyboardModifiers QWaylandTextInput::modifiersToQtModifiers(uint32_t modifiers) +{ + Qt::KeyboardModifiers ret = Qt::NoModifier; + for (int i = 0; modifiers >>= 1; ++i) { + ret |= m_modifiersMap[i]; + } + return ret; } QWaylandInputContext::QWaylandInputContext(QWaylandDisplay *display) : QPlatformInputContext() , mDisplay(display) - , mTextInput() + , mCurrentWindow() +{ +} + +QWaylandInputContext::~QWaylandInputContext() { } @@ -191,96 +402,141 @@ bool QWaylandInputContext::isValid() const void QWaylandInputContext::reset() { - if (!ensureTextInput()) + qCDebug(qLcQpaInputMethods) << Q_FUNC_INFO; + + QPlatformInputContext::reset(); + + if (!textInput()) return; - mTextInput->reset(); + textInput()->reset(); } void QWaylandInputContext::commit() { - if (!ensureTextInput()) + qCDebug(qLcQpaInputMethods) << Q_FUNC_INFO; + + if (!textInput()) return; - if (!QGuiApplication::focusObject()) - return; - - QInputMethodEvent event; - event.setCommitString(mTextInput->commitString()); - QCoreApplication::sendEvent(QGuiApplication::focusObject(), &event); - - mTextInput->reset(); + textInput()->commit(); } void QWaylandInputContext::update(Qt::InputMethodQueries queries) { - Q_UNUSED(queries); - if (!ensureTextInput()) + qCDebug(qLcQpaInputMethods) << Q_FUNC_INFO << queries; + + if (!QGuiApplication::focusObject() || !textInput()) return; - mTextInput->updateState(); -} + if (mCurrentWindow && mCurrentWindow->handle() && !inputMethodAccepted()) { + struct ::wl_surface *surface = static_cast(mCurrentWindow->handle())->object(); + textInput()->disable(surface); + mCurrentWindow.clear(); + } else if (!mCurrentWindow && inputMethodAccepted()) { + QWindow *window = QGuiApplication::focusWindow(); + if (window && window->handle()) { + struct ::wl_surface *surface = static_cast(window->handle())->object(); + textInput()->enable(surface); + mCurrentWindow = window; + } + } -void QWaylandInputContext::invokeAction(QInputMethod::Action, int cursorPosition) -{ - if (!ensureTextInput()) - return; - - mTextInput->invoke_action(0, cursorPosition); // FIXME button, to UTF8 cursor position + textInput()->updateState(queries, QtWayland::zwp_text_input_v2::update_state_change); } void QWaylandInputContext::showInputPanel() { - if (!ensureTextInput()) + qCDebug(qLcQpaInputMethods) << Q_FUNC_INFO; + + if (!textInput()) return; - mTextInput->show_input_panel(); + textInput()->show_input_panel(); } void QWaylandInputContext::hideInputPanel() { - if (!ensureTextInput()) + qCDebug(qLcQpaInputMethods) << Q_FUNC_INFO; + + if (!textInput()) return; - mTextInput->hide_input_panel(); + textInput()->hide_input_panel(); } bool QWaylandInputContext::isInputPanelVisible() const { - return false; + qCDebug(qLcQpaInputMethods) << Q_FUNC_INFO; + + if (!textInput()) + return QPlatformInputContext::isInputPanelVisible(); + + return textInput()->isInputPanelVisible(); } -void QWaylandInputContext::setFocusObject(QObject *object) +QRectF QWaylandInputContext::keyboardRect() const { - if (!ensureTextInput()) - return; + qCDebug(qLcQpaInputMethods) << Q_FUNC_INFO; - if (!object) { - mTextInput->deactivate(mDisplay->defaultInputDevice()->wl_seat()); + if (!textInput()) + return QPlatformInputContext::keyboardRect(); + + return textInput()->keyboardRect(); +} + +QLocale QWaylandInputContext::locale() const +{ + qCDebug(qLcQpaInputMethods) << Q_FUNC_INFO; + + if (!textInput()) + return QPlatformInputContext::locale(); + + return textInput()->locale(); +} + +Qt::LayoutDirection QWaylandInputContext::inputDirection() const +{ + qCDebug(qLcQpaInputMethods) << Q_FUNC_INFO; + + if (!textInput()) + return QPlatformInputContext::inputDirection(); + + return textInput()->inputDirection(); +} + +void QWaylandInputContext::setFocusObject(QObject *) +{ + qCDebug(qLcQpaInputMethods) << Q_FUNC_INFO; + + if (!textInput()) return; - } QWindow *window = QGuiApplication::focusWindow(); - if (!window || !window->handle()) - return; - struct ::wl_surface *surface = static_cast(window->handle())->object(); - mTextInput->activate(mDisplay->defaultInputDevice()->wl_seat(), surface); + if (mCurrentWindow && mCurrentWindow->handle()) { + if (mCurrentWindow.data() != window || !inputMethodAccepted()) { + struct ::wl_surface *surface = static_cast(mCurrentWindow->handle())->object(); + textInput()->disable(surface); + mCurrentWindow.clear(); + } + } + + if (window && window->handle() && inputMethodAccepted()) { + if (mCurrentWindow.data() != window) { + struct ::wl_surface *surface = static_cast(window->handle())->object(); + textInput()->enable(surface); + mCurrentWindow = window; + } + textInput()->updateState(Qt::ImQueryAll, QtWayland::zwp_text_input_v2::update_state_enter); + } } -bool QWaylandInputContext::ensureTextInput() +QWaylandTextInput *QWaylandInputContext::textInput() const { - if (mTextInput) - return true; - - if (!isValid()) - return false; - - mTextInput.reset(new QWaylandTextInput(mDisplay->textInputManager()->create_text_input())); - return true; + return mDisplay->defaultInputDevice()->textInput(); } } QT_END_NAMESPACE - diff --git a/src/plugins/platforms/wayland/qwaylandinputcontext_p.h b/src/plugins/platforms/wayland/qwaylandinputcontext_p.h index cdabfcca492..0429dd14e19 100644 --- a/src/plugins/platforms/wayland/qwaylandinputcontext_p.h +++ b/src/plugins/platforms/wayland/qwaylandinputcontext_p.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 Klarälvdalens Datakonsult AB (KDAB). +** Copyright (C) 2016 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the QtWaylandClient module of the Qt Toolkit. @@ -54,36 +54,75 @@ #include -#include +#include +#include +#include +#include + +#include +#include QT_BEGIN_NAMESPACE +Q_DECLARE_LOGGING_CATEGORY(qLcQpaInputMethods) + namespace QtWaylandClient { class QWaylandDisplay; -class QWaylandTextInput : public QtWayland::wl_text_input +class QWaylandTextInput : public QtWayland::zwp_text_input_v2 { public: - QWaylandTextInput(struct ::wl_text_input *text_input); - - QString commitString() const; + QWaylandTextInput(QWaylandDisplay *display, struct ::zwp_text_input_v2 *text_input); + ~QWaylandTextInput(); void reset(); - void updateState(); + void commit(); + void updateState(Qt::InputMethodQueries queries, uint32_t flags); + + bool isInputPanelVisible() const; + QRectF keyboardRect() const; + + QLocale locale() const; + Qt::LayoutDirection inputDirection() const; protected: - void text_input_preedit_string(uint32_t serial, const QString &text, const QString &commit) Q_DECL_OVERRIDE; - void text_input_commit_string(uint32_t serial, const QString &text) Q_DECL_OVERRIDE; - void text_input_enter(wl_surface *surface) Q_DECL_OVERRIDE; - void text_input_leave() Q_DECL_OVERRIDE; - void text_input_keysym(uint32_t serial, uint32_t time, uint32_t sym, uint32_t state, uint32_t modifiers); + void zwp_text_input_v2_enter(uint32_t serial, struct ::wl_surface *surface) Q_DECL_OVERRIDE; + void zwp_text_input_v2_leave(uint32_t serial, struct ::wl_surface *surface) Q_DECL_OVERRIDE; + void zwp_text_input_v2_modifiers_map(wl_array *map) Q_DECL_OVERRIDE; + void zwp_text_input_v2_input_panel_state(uint32_t state, int32_t x, int32_t y, int32_t width, int32_t height) Q_DECL_OVERRIDE; + void zwp_text_input_v2_preedit_string(const QString &text, const QString &commit) Q_DECL_OVERRIDE; + void zwp_text_input_v2_preedit_styling(uint32_t index, uint32_t length, uint32_t style) Q_DECL_OVERRIDE; + void zwp_text_input_v2_preedit_cursor(int32_t index) Q_DECL_OVERRIDE; + void zwp_text_input_v2_commit_string(const QString &text) Q_DECL_OVERRIDE; + void zwp_text_input_v2_cursor_position(int32_t index, int32_t anchor) Q_DECL_OVERRIDE; + void zwp_text_input_v2_delete_surrounding_text(uint32_t before_length, uint32_t after_length) Q_DECL_OVERRIDE; + void zwp_text_input_v2_keysym(uint32_t time, uint32_t sym, uint32_t state, uint32_t modifiers) Q_DECL_OVERRIDE; + void zwp_text_input_v2_language(const QString &language) Q_DECL_OVERRIDE; + void zwp_text_input_v2_text_direction(uint32_t direction) Q_DECL_OVERRIDE; + void zwp_text_input_v2_input_method_changed(uint32_t serial, uint32_t flags) Q_DECL_OVERRIDE; private: - QString m_commit; + Qt::KeyboardModifiers modifiersToQtModifiers(uint32_t modifiers); + + QWaylandDisplay *m_display; + QWaylandInputMethodEventBuilder m_builder; + + QVector m_modifiersMap; uint32_t m_serial; - uint32_t m_resetSerial; + struct ::wl_surface *m_surface; + + QString m_preeditCommit; + + bool m_inputPanelVisible; + QRectF m_keyboardRectangle; + QLocale m_locale; + Qt::LayoutDirection m_inputDirection; + + struct ::wl_callback *m_resetCallback; + static const wl_callback_listener callbackListener; + static void resetCallback(void *data, struct wl_callback *wl_callback, uint32_t time); }; class QWaylandInputContext : public QPlatformInputContext @@ -91,25 +130,29 @@ class QWaylandInputContext : public QPlatformInputContext Q_OBJECT public: explicit QWaylandInputContext(QWaylandDisplay *display); + ~QWaylandInputContext(); bool isValid() const Q_DECL_OVERRIDE; void reset() Q_DECL_OVERRIDE; void commit() Q_DECL_OVERRIDE; void update(Qt::InputMethodQueries) Q_DECL_OVERRIDE; - void invokeAction(QInputMethod::Action, int cursorPosition) Q_DECL_OVERRIDE; void showInputPanel() Q_DECL_OVERRIDE; void hideInputPanel() Q_DECL_OVERRIDE; bool isInputPanelVisible() const Q_DECL_OVERRIDE; + QRectF keyboardRect() const Q_DECL_OVERRIDE; + + QLocale locale() const Q_DECL_OVERRIDE; + Qt::LayoutDirection inputDirection() const Q_DECL_OVERRIDE; void setFocusObject(QObject *object) Q_DECL_OVERRIDE; private: - bool ensureTextInput(); + QWaylandTextInput *textInput() const; QWaylandDisplay *mDisplay; - QScopedPointer mTextInput; + QPointer mCurrentWindow; }; } diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index 46c473e7075..cf1c7ac448e 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -50,6 +50,7 @@ #include "qwaylanddisplay_p.h" #include "qwaylandshmbackingstore_p.h" #include "../shared/qwaylandxkb.h" +#include "qwaylandinputcontext_p.h" #include #include @@ -185,6 +186,7 @@ QWaylandInputDevice::QWaylandInputDevice(QWaylandDisplay *display, int version, , mKeyboard(0) , mPointer(0) , mTouch(0) + , mTextInput(0) , mTime(0) , mSerial(0) , mTouchDevice(0) @@ -193,6 +195,9 @@ QWaylandInputDevice::QWaylandInputDevice(QWaylandDisplay *display, int version, mDataDevice = mQDisplay->dndSelectionHandler()->getDataDevice(this); } + if (mQDisplay->textInputManager()) { + mTextInput = new QWaylandTextInput(mQDisplay, mQDisplay->textInputManager()->get_text_input(wl_seat())); + } } QWaylandInputDevice::~QWaylandInputDevice() @@ -277,6 +282,16 @@ QWaylandDataDevice *QWaylandInputDevice::dataDevice() const return mDataDevice; } +void QWaylandInputDevice::setTextInput(QWaylandTextInput *textInput) +{ + mTextInput = textInput; +} + +QWaylandTextInput *QWaylandInputDevice::textInput() const +{ + return mTextInput; +} + void QWaylandInputDevice::removeMouseButtonFromState(Qt::MouseButton button) { if (mPointer) @@ -693,19 +708,9 @@ void QWaylandInputDevice::Keyboard::keyboard_key(uint32_t serial, uint32_t time, Qt::KeyboardModifiers modifiers = mParent->modifiers(); - uint utf32 = xkb_keysym_to_utf32(sym); - if (utf32) - text = QString::fromUcs4(&utf32, 1); - + text = QWaylandXkb::textFromKeysym(sym, modifiers); qtkey = QWaylandXkb::keysymToQtKey(sym, modifiers, text); - - // Map control + letter to proper text - if (utf32 >= 'A' && utf32 <= '~' && (modifiers & Qt::ControlModifier)) { - utf32 &= ~0x60; - text = QString::fromUcs4(&utf32, 1); - } - sendKey(window->window(), time, type, qtkey, modifiers, code, sym, mNativeModifiers, text); #else // Generic fallback for single hard keys: Assume 'key' is a Qt key code. diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h index 0da45c38473..82b9d90c346 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h +++ b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h @@ -80,6 +80,7 @@ namespace QtWaylandClient { class QWaylandWindow; class QWaylandDisplay; class QWaylandDataDevice; +class QWaylandTextInput; class Q_WAYLAND_CLIENT_EXPORT QWaylandInputDevice : public QObject @@ -108,6 +109,9 @@ public: void setDataDevice(QWaylandDataDevice *device); QWaylandDataDevice *dataDevice() const; + void setTextInput(QWaylandTextInput *textInput); + QWaylandTextInput *textInput() const; + void removeMouseButtonFromState(Qt::MouseButton button); QWaylandWindow *pointerFocus() const; @@ -138,6 +142,8 @@ private: Pointer *mPointer; Touch *mTouch; + QWaylandTextInput *mTextInput; + uint32_t mTime; uint32_t mSerial; diff --git a/src/plugins/platforms/wayland/shared/qwaylandinputmethodeventbuilder.cpp b/src/plugins/platforms/wayland/shared/qwaylandinputmethodeventbuilder.cpp new file mode 100644 index 00000000000..eb527c15a0a --- /dev/null +++ b/src/plugins/platforms/wayland/shared/qwaylandinputmethodeventbuilder.cpp @@ -0,0 +1,286 @@ +/**************************************************************************** +** +** Copyright (C) 2016 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com +** Contact: http://www.qt-project.org/legal +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qwaylandinputmethodeventbuilder.h" + +#include +#include + +#ifdef QT_BUILD_WAYLANDCOMPOSITOR_LIB +#include +#else +#include +#endif + +QT_BEGIN_NAMESPACE + +QWaylandInputMethodEventBuilder::QWaylandInputMethodEventBuilder() + : m_anchor(0) + , m_cursor(0) + , m_deleteBefore(0) + , m_deleteAfter(0) + , m_preeditCursor(0) + , m_preeditStyles() +{ +} + +QWaylandInputMethodEventBuilder::~QWaylandInputMethodEventBuilder() +{ +} + +void QWaylandInputMethodEventBuilder::reset() +{ + m_anchor = 0; + m_cursor = 0; + m_deleteBefore = 0; + m_deleteAfter = 0; + m_preeditCursor = 0; + m_preeditStyles.clear(); +} + +void QWaylandInputMethodEventBuilder::setCursorPosition(int32_t index, int32_t anchor) +{ + m_cursor = index; + m_anchor = anchor; +} + +void QWaylandInputMethodEventBuilder::setDeleteSurroundingText(uint32_t beforeLength, uint32_t afterLength) +{ + m_deleteBefore = beforeLength; + m_deleteAfter = afterLength; +} + +void QWaylandInputMethodEventBuilder::addPreeditStyling(uint32_t index, uint32_t length, uint32_t style) +{ + QTextCharFormat format; + + switch (style) { + case 0: + case 1: + format.setFontUnderline(true); + format.setUnderlineStyle(QTextCharFormat::SingleUnderline); + m_preeditStyles.append(QInputMethodEvent::Attribute(QInputMethodEvent::TextFormat, index, length, format)); + break; + case 2: + case 3: + format.setFontWeight(QFont::Bold); + format.setFontUnderline(true); + format.setUnderlineStyle(QTextCharFormat::SingleUnderline); + m_preeditStyles.append(QInputMethodEvent::Attribute(QInputMethodEvent::TextFormat, index, length, format)); + break; + case 4: + format.setFontUnderline(true); + format.setUnderlineStyle(QTextCharFormat::SingleUnderline); + m_preeditStyles.append(QInputMethodEvent::Attribute(QInputMethodEvent::TextFormat, index, length, format)); + case 5: + format.setFontUnderline(true); + format.setUnderlineStyle(QTextCharFormat::WaveUnderline); + format.setUnderlineColor(QColor(Qt::red)); + m_preeditStyles.append(QInputMethodEvent::Attribute(QInputMethodEvent::TextFormat, index, length, format)); + break; +// case QtWayland::wl_text_input::preedit_style_selection: +// case QtWayland::wl_text_input::preedit_style_none: + default: + break; + } +} + +void QWaylandInputMethodEventBuilder::setPreeditCursor(int32_t index) +{ + m_preeditCursor = index; +} + +QInputMethodEvent QWaylandInputMethodEventBuilder::buildCommit(const QString &text) +{ + QList attributes; + + const QPair replacement = replacementForDeleteSurrounding(); + + if (m_cursor != 0 || m_anchor != 0) { + QString surrounding = QInputMethod::queryFocusObject(Qt::ImSurroundingText, QVariant()).toString(); + const int cursor = QInputMethod::queryFocusObject(Qt::ImCursorPosition, QVariant()).toInt(); + const int anchor = QInputMethod::queryFocusObject(Qt::ImAnchorPosition, QVariant()).toInt(); + const int absoluteCursor = QInputMethod::queryFocusObject(Qt::ImAbsolutePosition, QVariant()).toInt(); + + const int absoluteOffset = absoluteCursor - cursor; + + const int cursorAfterCommit = qMin(anchor, cursor) + replacement.first + text.length(); + surrounding.replace(qMin(anchor, cursor) + replacement.first, + qAbs(anchor - cursor) + replacement.second, text); + + attributes.push_back(QInputMethodEvent::Attribute(QInputMethodEvent::Selection, + indexFromWayland(surrounding, m_cursor, cursorAfterCommit) + absoluteOffset, + indexFromWayland(surrounding, m_anchor, cursorAfterCommit) + absoluteOffset, + QVariant())); + } + + QInputMethodEvent event(QString(), attributes); + event.setCommitString(text, replacement.first, replacement.second); + + return event; +} + +QInputMethodEvent QWaylandInputMethodEventBuilder::buildPreedit(const QString &text) +{ + QList attributes; + + if (m_preeditCursor < 0) { + attributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::Cursor, 0, 0, QVariant())); + } else if (m_preeditCursor > 0) { + attributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::Cursor, indexFromWayland(text, m_preeditCursor), 1, QVariant())); + } + + Q_FOREACH (const QInputMethodEvent::Attribute &attr, m_preeditStyles) { + int start = indexFromWayland(text, attr.start); + int length = indexFromWayland(text, attr.start + attr.length) - start; + attributes.append(QInputMethodEvent::Attribute(attr.type, start, length, attr.value)); + } + + QInputMethodEvent event(text, attributes); + + const QPair replacement = replacementForDeleteSurrounding(); + event.setCommitString(QString(), replacement.first, replacement.second); + + return event; +} + +QPair QWaylandInputMethodEventBuilder::replacementForDeleteSurrounding() +{ + if (m_deleteBefore == 0 && m_deleteAfter == 0) + return QPair(0, 0); + + const QString &surrounding = QInputMethod::queryFocusObject(Qt::ImSurroundingText, QVariant()).toString(); + const int cursor = QInputMethod::queryFocusObject(Qt::ImCursorPosition, QVariant()).toInt(); + const int anchor = QInputMethod::queryFocusObject(Qt::ImAnchorPosition, QVariant()).toInt(); + + const int selectionStart = qMin(cursor, anchor); + const int selectionEnd = qMax(cursor, anchor); + + const int deleteBefore = selectionStart - indexFromWayland(surrounding, -m_deleteBefore, selectionStart); + const int deleteAfter = indexFromWayland(surrounding, m_deleteAfter, selectionEnd) - selectionEnd; + + return QPair(-deleteBefore, deleteBefore + deleteAfter); +} + +QWaylandInputMethodContentType QWaylandInputMethodContentType::convert(Qt::InputMethodHints hints) +{ + uint32_t hint = ZWP_TEXT_INPUT_V2_CONTENT_HINT_NONE; + uint32_t purpose = ZWP_TEXT_INPUT_V2_CONTENT_PURPOSE_NORMAL; + + if (hints & Qt::ImhHiddenText) { + hint |= ZWP_TEXT_INPUT_V2_CONTENT_HINT_HIDDEN_TEXT; + } + if (hints & Qt::ImhSensitiveData) { + hint |= ZWP_TEXT_INPUT_V2_CONTENT_HINT_SENSITIVE_DATA; + } + if ((hints & Qt::ImhNoAutoUppercase) == 0) { + hint |= ZWP_TEXT_INPUT_V2_CONTENT_HINT_AUTO_CAPITALIZATION; + } + if (hints & Qt::ImhPreferNumbers) { + // Nothing yet + } + if (hints & Qt::ImhPreferUppercase) { + hint |= ZWP_TEXT_INPUT_V2_CONTENT_HINT_UPPERCASE; + } + if (hints & Qt::ImhPreferLowercase) { + hint |= ZWP_TEXT_INPUT_V2_CONTENT_HINT_LOWERCASE; + } + if ((hints & Qt::ImhNoPredictiveText) == 0) { + hint |= ZWP_TEXT_INPUT_V2_CONTENT_HINT_AUTO_COMPLETION | ZWP_TEXT_INPUT_V2_CONTENT_HINT_AUTO_CORRECTION; + } + + if ((hints & Qt::ImhDate) && (hints & Qt::ImhTime) == 0) { + purpose = ZWP_TEXT_INPUT_V2_CONTENT_PURPOSE_DATE; + } else if ((hints & Qt::ImhDate) && (hints & Qt::ImhTime)) { + purpose = ZWP_TEXT_INPUT_V2_CONTENT_PURPOSE_DATETIME; + } else if ((hints & Qt::ImhDate) == 0 && (hints & Qt::ImhTime)) { + purpose = ZWP_TEXT_INPUT_V2_CONTENT_PURPOSE_TIME; + } + + if (hints & Qt::ImhPreferLatin) { + hint |= ZWP_TEXT_INPUT_V2_CONTENT_HINT_LATIN; + } + + if (hints & Qt::ImhMultiLine) { + hint |= ZWP_TEXT_INPUT_V2_CONTENT_HINT_MULTILINE; + } + + if (hints & Qt::ImhDigitsOnly) { + purpose = ZWP_TEXT_INPUT_V2_CONTENT_PURPOSE_DIGITS; + } + if (hints & Qt::ImhFormattedNumbersOnly) { + purpose = ZWP_TEXT_INPUT_V2_CONTENT_PURPOSE_NUMBER; + } + if (hints & Qt::ImhUppercaseOnly) { + hint |= ZWP_TEXT_INPUT_V2_CONTENT_HINT_UPPERCASE; + } + if (hints & Qt::ImhLowercaseOnly) { + hint |= ZWP_TEXT_INPUT_V2_CONTENT_HINT_LOWERCASE; + } + if (hints & Qt::ImhDialableCharactersOnly) { + purpose = ZWP_TEXT_INPUT_V2_CONTENT_PURPOSE_PHONE; + } + if (hints & Qt::ImhEmailCharactersOnly) { + purpose = ZWP_TEXT_INPUT_V2_CONTENT_PURPOSE_EMAIL; + } + if (hints & Qt::ImhUrlCharactersOnly) { + purpose = ZWP_TEXT_INPUT_V2_CONTENT_PURPOSE_URL; + } + if (hints & Qt::ImhLatinOnly) { + hint |= ZWP_TEXT_INPUT_V2_CONTENT_HINT_LATIN; + } + return QWaylandInputMethodContentType{hint, purpose}; +} + +int QWaylandInputMethodEventBuilder::indexFromWayland(const QString &str, int utf8Index, int baseIndex) +{ + if (utf8Index == 0) + return baseIndex; + + if (utf8Index < 0) { + const QByteArray &utf8 = str.leftRef(baseIndex).toUtf8(); + return QString::fromUtf8(utf8.left(qMax(utf8.length() + utf8Index, 0))).length(); + } else { + const QByteArray &utf8 = str.midRef(baseIndex).toUtf8(); + return QString::fromUtf8(utf8.left(utf8Index)).length() + baseIndex; + } +} + +QT_END_NAMESPACE + diff --git a/src/plugins/platforms/wayland/shared/qwaylandinputmethodeventbuilder.h b/src/plugins/platforms/wayland/shared/qwaylandinputmethodeventbuilder.h new file mode 100644 index 00000000000..188a6a94b30 --- /dev/null +++ b/src/plugins/platforms/wayland/shared/qwaylandinputmethodeventbuilder.h @@ -0,0 +1,87 @@ +/**************************************************************************** +** +** Copyright (C) 2016 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com +** Contact: http://www.qt-project.org/legal +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWAYLANDINPUTMETHODEVENTBUILDER_H +#define QWAYLANDINPUTMETHODEVENTBUILDER_H + +#include + +QT_BEGIN_NAMESPACE + +class QWaylandInputMethodEventBuilder +{ +public: + QWaylandInputMethodEventBuilder(); + ~QWaylandInputMethodEventBuilder(); + + void reset(); + + void setCursorPosition(int32_t index, int32_t anchor); + void setDeleteSurroundingText(uint32_t beforeLength, uint32_t afterLength); + + void addPreeditStyling(uint32_t index, uint32_t length, uint32_t style); + void setPreeditCursor(int32_t index); + + QInputMethodEvent buildCommit(const QString &text); + QInputMethodEvent buildPreedit(const QString &text); + + static int indexFromWayland(const QString &str, int utf8Index, int baseIndex = 0); +private: + QPair replacementForDeleteSurrounding(); + + int32_t m_anchor; + int32_t m_cursor; + uint32_t m_deleteBefore; + uint32_t m_deleteAfter; + + int32_t m_preeditCursor; + QList m_preeditStyles; +}; + +struct QWaylandInputMethodContentType { + uint32_t hint; + uint32_t purpose; + + static QWaylandInputMethodContentType convert(Qt::InputMethodHints hints); +}; + + +QT_END_NAMESPACE + +#endif // QWAYLANDINPUTMETHODEVENTBUILDER_H diff --git a/src/plugins/platforms/wayland/shared/qwaylandxkb.cpp b/src/plugins/platforms/wayland/shared/qwaylandxkb.cpp index f5d0527de39..32d24bd62d1 100644 --- a/src/plugins/platforms/wayland/shared/qwaylandxkb.cpp +++ b/src/plugins/platforms/wayland/shared/qwaylandxkb.cpp @@ -40,6 +40,7 @@ #include "qwaylandxkb.h" +#include #include #ifndef QT_NO_WAYLAND_XKB @@ -282,6 +283,16 @@ static int lookupKeysym(xkb_keysym_t key) return code; } +static xkb_keysym_t toKeysymFromTable(uint32_t key) +{ + for (int i = 0; KeyTbl[i]; i += 2) { + if (key == KeyTbl[i + 1]) + return KeyTbl[i]; + } + + return 0; +} + int QWaylandXkb::keysymToQtKey(xkb_keysym_t keysym, Qt::KeyboardModifiers &modifiers, const QString &text) { int code = 0; @@ -326,6 +337,50 @@ Qt::KeyboardModifiers QWaylandXkb::modifiers(struct xkb_state *state) return modifiers; } +QEvent::Type QWaylandXkb::toQtEventType(uint32_t state) +{ + return state != 0 ? QEvent::KeyPress : QEvent::KeyRelease; +} + +QString QWaylandXkb::textFromKeysym(uint32_t keysym, Qt::KeyboardModifiers modifiers) +{ + uint utf32 = xkb_keysym_to_utf32(keysym); + + // Map control + letter to proper text + if (utf32 >= 'A' && utf32 <= '~' && (modifiers & Qt::ControlModifier)) { + utf32 &= ~0x60; + return QString::fromUcs4(&utf32, 1); + } + + if (utf32) + return QString::fromUcs4(&utf32, 1); + + return QString(); +} + +QVector QWaylandXkb::toKeysym(QKeyEvent *event) +{ + QVector keysyms; + if (event->key() >= Qt::Key_F1 && event->key() <= Qt::Key_F35) { + keysyms.append(XKB_KEY_F1 + (event->key() - Qt::Key_F1)); + } else if (event->modifiers() & Qt::KeypadModifier) { + if (event->key() >= Qt::Key_0 && event->key() <= Qt::Key_9) + keysyms.append(XKB_KEY_KP_0 + (event->key() - Qt::Key_0)); + else + keysyms.append(toKeysymFromTable(event->key())); + } else if (!event->text().isEmpty()) { + // From libxkbcommon keysym-utf.c: + // "We allow to represent any UCS character in the range U-00000000 to + // U-00FFFFFF by a keysym value in the range 0x01000000 to 0x01ffffff." + foreach (uint utf32, event->text().toUcs4()) { + keysyms.append(utf32 | 0x01000000); + } + } else { + keysyms.append(toKeysymFromTable(event->key())); + } + return keysyms; +} + QT_END_NAMESPACE #endif // QT_NO_WAYLAND_XKB diff --git a/src/plugins/platforms/wayland/shared/qwaylandxkb.h b/src/plugins/platforms/wayland/shared/qwaylandxkb.h index bfb38515f5f..9b5c935a5b5 100644 --- a/src/plugins/platforms/wayland/shared/qwaylandxkb.h +++ b/src/plugins/platforms/wayland/shared/qwaylandxkb.h @@ -44,15 +44,22 @@ #ifndef QT_NO_WAYLAND_XKB #include +#include #include QT_BEGIN_NAMESPACE +class QKeyEvent; + class QWaylandXkb { public: static int keysymToQtKey(xkb_keysym_t keysym, Qt::KeyboardModifiers &modifiers, const QString &text); static Qt::KeyboardModifiers modifiers(struct xkb_state *state); + + static QEvent::Type toQtEventType(uint32_t state); + static QString textFromKeysym(uint32_t keysym, Qt::KeyboardModifiers modifiers); + static QVector toKeysym(QKeyEvent *event); }; QT_END_NAMESPACE From 0654dbd90c26dbd00bb4d96c0072daeb690362ae Mon Sep 17 00:00:00 2001 From: Jan Arne Petersen Date: Wed, 6 Apr 2016 20:44:08 +0200 Subject: [PATCH 0312/1507] Fix clicking on preedit text Ignore clicks inside of preedit text for now instead of resulting in an unexpected reset. Change-Id: I9962f3a2a868a9a1afa7b0082fba97ec6cc6c500 Reviewed-by: Giulio Camuffo --- .../platforms/wayland/qwaylandinputcontext.cpp | 14 ++++++++++++++ .../platforms/wayland/qwaylandinputcontext_p.h | 4 ++++ 2 files changed, 18 insertions(+) diff --git a/src/plugins/platforms/wayland/qwaylandinputcontext.cpp b/src/plugins/platforms/wayland/qwaylandinputcontext.cpp index aeaf415d2cd..f211780fd97 100644 --- a/src/plugins/platforms/wayland/qwaylandinputcontext.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputcontext.cpp @@ -185,6 +185,11 @@ void QWaylandTextInput::updateState(Qt::InputMethodQueries queries, uint32_t fla } } +void QWaylandTextInput::setCursorInsidePreedit(int) +{ + // Not supported yet +} + bool QWaylandTextInput::isInputPanelVisible() const { return m_inputPanelVisible; @@ -445,6 +450,15 @@ void QWaylandInputContext::update(Qt::InputMethodQueries queries) textInput()->updateState(queries, QtWayland::zwp_text_input_v2::update_state_change); } +void QWaylandInputContext::invokeAction(QInputMethod::Action action, int cursorPostion) +{ + if (!textInput()) + return; + + if (action == QInputMethod::Click) + textInput()->setCursorInsidePreedit(cursorPostion); +} + void QWaylandInputContext::showInputPanel() { qCDebug(qLcQpaInputMethods) << Q_FUNC_INFO; diff --git a/src/plugins/platforms/wayland/qwaylandinputcontext_p.h b/src/plugins/platforms/wayland/qwaylandinputcontext_p.h index 0429dd14e19..8b789e3420a 100644 --- a/src/plugins/platforms/wayland/qwaylandinputcontext_p.h +++ b/src/plugins/platforms/wayland/qwaylandinputcontext_p.h @@ -80,6 +80,8 @@ public: void commit(); void updateState(Qt::InputMethodQueries queries, uint32_t flags); + void setCursorInsidePreedit(int cursor); + bool isInputPanelVisible() const; QRectF keyboardRect() const; @@ -138,6 +140,8 @@ public: void commit() Q_DECL_OVERRIDE; void update(Qt::InputMethodQueries) Q_DECL_OVERRIDE; + void invokeAction(QInputMethod::Action, int cursorPosition) Q_DECL_OVERRIDE; + void showInputPanel() Q_DECL_OVERRIDE; void hideInputPanel() Q_DECL_OVERRIDE; bool isInputPanelVisible() const Q_DECL_OVERRIDE; From e347632447911f6a74fecbb890531d132d69c3c3 Mon Sep 17 00:00:00 2001 From: Erik Larsson Date: Sun, 17 Apr 2016 20:24:01 +0200 Subject: [PATCH 0313/1507] Compensate for window decoration size in data_device_enter/motion. Change-Id: I71a549e597ec0821c778edca9f8cb20eefdcc75e Reviewed-by: Pier Luigi Fiorini Reviewed-by: Giulio Camuffo --- .../platforms/wayland/qwaylanddatadevice.cpp | 19 ++++++++++++++++--- .../platforms/wayland/qwaylanddatadevice_p.h | 2 ++ 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylanddatadevice.cpp b/src/plugins/platforms/wayland/qwaylanddatadevice.cpp index 2ab8d8728aa..9cc4217ff99 100644 --- a/src/plugins/platforms/wayland/qwaylanddatadevice.cpp +++ b/src/plugins/platforms/wayland/qwaylanddatadevice.cpp @@ -46,6 +46,7 @@ #include "qwaylanddnd_p.h" #include "qwaylandinputdevice_p.h" #include "qwaylanddisplay_p.h" +#include "qwaylandabstractdecoration_p.h" #include #include @@ -153,7 +154,7 @@ void QWaylandDataDevice::data_device_enter(uint32_t serial, wl_surface *surface, { m_enterSerial = serial; m_dragWindow = QWaylandWindow::fromWlSurface(surface)->window(); - m_dragPoint = QPoint(wl_fixed_to_int(x), wl_fixed_to_int(y)); + m_dragPoint = calculateDragPosition(x, y, m_dragWindow); QDrag *drag = static_cast(QGuiApplicationPrivate::platformIntegration()->drag())->currentDrag(); @@ -202,7 +203,7 @@ void QWaylandDataDevice::data_device_motion(uint32_t time, wl_fixed_t x, wl_fixe if (!drag && !m_dragOffer) return; - m_dragPoint = QPoint(wl_fixed_to_int(x), wl_fixed_to_int(y)); + m_dragPoint = calculateDragPosition(x, y, m_dragWindow); QMimeData *dragData; Qt::DropActions supportedActions; @@ -246,7 +247,6 @@ void QWaylandDataDevice::selectionSourceCancelled() void QWaylandDataDevice::dragSourceCancelled() { m_dragSource.reset(); - } void QWaylandDataDevice::dragSourceTargetChanged(const QString &mimeType) @@ -254,6 +254,19 @@ void QWaylandDataDevice::dragSourceTargetChanged(const QString &mimeType) static_cast(QGuiApplicationPrivate::platformIntegration()->drag())->updateTarget(mimeType); } +QPoint QWaylandDataDevice::calculateDragPosition(int x, int y, QWindow *wnd) const +{ + QPoint pnt(wl_fixed_to_int(x), wl_fixed_to_int(y)); + if (wnd) { + QWaylandWindow *wwnd = static_cast(m_dragWindow->handle()); + if (wwnd && wwnd->decoration()) { + pnt -= QPoint(wwnd->decoration()->margins().left(), + wwnd->decoration()->margins().top()); + } + } + return pnt; +} + } QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylanddatadevice_p.h b/src/plugins/platforms/wayland/qwaylanddatadevice_p.h index 4d229ad25ed..579cb3c7c7c 100644 --- a/src/plugins/platforms/wayland/qwaylanddatadevice_p.h +++ b/src/plugins/platforms/wayland/qwaylanddatadevice_p.h @@ -101,6 +101,8 @@ private Q_SLOTS: void dragSourceTargetChanged(const QString &mimeType); private: + QPoint calculateDragPosition(int x, int y, QWindow *wnd) const; + QWaylandDisplay *m_display; QWaylandInputDevice *m_inputDevice; uint32_t m_enterSerial; From 980f5fdfdc45184daa2a87d5f34ac79d106b20af Mon Sep 17 00:00:00 2001 From: Giulio Camuffo Date: Tue, 19 Apr 2016 10:05:49 +0300 Subject: [PATCH 0314/1507] Destroy the subsurface protocol objects This fixes a protocol error the compositor would send when a window changes its parent, because we were creating a new subsurface without destroying the old one. Change-Id: I0855d0582153e0aff37be508d9fb43d22c9ad0b5 Reviewed-by: Pier Luigi Fiorini --- src/plugins/platforms/wayland/qwaylandsubsurface.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/plugins/platforms/wayland/qwaylandsubsurface.cpp b/src/plugins/platforms/wayland/qwaylandsubsurface.cpp index ec813609fd2..254c0766b41 100644 --- a/src/plugins/platforms/wayland/qwaylandsubsurface.cpp +++ b/src/plugins/platforms/wayland/qwaylandsubsurface.cpp @@ -53,6 +53,7 @@ QWaylandSubSurface::QWaylandSubSurface(QWaylandWindow *window, QWaylandWindow *p QWaylandSubSurface::~QWaylandSubSurface() { m_parent->mChildren.removeOne(this); + destroy(); } } From f1bf4fc2c6e6db631edeb46d5d669af05e21d1ff Mon Sep 17 00:00:00 2001 From: Jan Arne Petersen Date: Mon, 18 Apr 2016 21:44:57 +0200 Subject: [PATCH 0315/1507] Use function to convert indices for text protocol Use a proper function instead of left/midRef(index).toUtf8().size(). Makes it more clear what is happening and makes it easier when wayland text protocol switches from byte-based to unicode character-based indices. Also rename parameters of existing indexFromWayland() function to be the same as in the new function. Change-Id: Ie90abdcb264b74a024e96e041d5daf651920e9e4 Reviewed-by: Giulio Camuffo --- .../wayland/qwaylandinputcontext.cpp | 2 +- .../qwaylandinputmethodeventbuilder.cpp | 21 ++++++++++++------- .../shared/qwaylandinputmethodeventbuilder.h | 3 ++- 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandinputcontext.cpp b/src/plugins/platforms/wayland/qwaylandinputcontext.cpp index f211780fd97..af8e6f81838 100644 --- a/src/plugins/platforms/wayland/qwaylandinputcontext.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputcontext.cpp @@ -157,7 +157,7 @@ void QWaylandTextInput::updateState(Qt::InputMethodQueries queries, uint32_t fla anchor -= offset; } - set_surrounding_text(text, text.leftRef(cursor).toUtf8().size(), text.leftRef(anchor).toUtf8().size()); + set_surrounding_text(text, QWaylandInputMethodEventBuilder::indexToWayland(text, cursor), QWaylandInputMethodEventBuilder::indexToWayland(text, anchor)); } if (queries & Qt::ImHints) { diff --git a/src/plugins/platforms/wayland/shared/qwaylandinputmethodeventbuilder.cpp b/src/plugins/platforms/wayland/shared/qwaylandinputmethodeventbuilder.cpp index eb527c15a0a..fe93f51463f 100644 --- a/src/plugins/platforms/wayland/shared/qwaylandinputmethodeventbuilder.cpp +++ b/src/plugins/platforms/wayland/shared/qwaylandinputmethodeventbuilder.cpp @@ -268,19 +268,24 @@ QWaylandInputMethodContentType QWaylandInputMethodContentType::convert(Qt::Input return QWaylandInputMethodContentType{hint, purpose}; } -int QWaylandInputMethodEventBuilder::indexFromWayland(const QString &str, int utf8Index, int baseIndex) +int QWaylandInputMethodEventBuilder::indexFromWayland(const QString &text, int length, int base) { - if (utf8Index == 0) - return baseIndex; + if (length == 0) + return base; - if (utf8Index < 0) { - const QByteArray &utf8 = str.leftRef(baseIndex).toUtf8(); - return QString::fromUtf8(utf8.left(qMax(utf8.length() + utf8Index, 0))).length(); + if (length < 0) { + const QByteArray &utf8 = text.leftRef(base).toUtf8(); + return QString::fromUtf8(utf8.left(qMax(utf8.length() + length, 0))).length(); } else { - const QByteArray &utf8 = str.midRef(baseIndex).toUtf8(); - return QString::fromUtf8(utf8.left(utf8Index)).length() + baseIndex; + const QByteArray &utf8 = text.midRef(base).toUtf8(); + return QString::fromUtf8(utf8.left(length)).length() + base; } } +int QWaylandInputMethodEventBuilder::indexToWayland(const QString &text, int length, int base) +{ + return text.midRef(base, length).toUtf8().size(); +} + QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/shared/qwaylandinputmethodeventbuilder.h b/src/plugins/platforms/wayland/shared/qwaylandinputmethodeventbuilder.h index 188a6a94b30..3912afc0424 100644 --- a/src/plugins/platforms/wayland/shared/qwaylandinputmethodeventbuilder.h +++ b/src/plugins/platforms/wayland/shared/qwaylandinputmethodeventbuilder.h @@ -61,7 +61,8 @@ public: QInputMethodEvent buildCommit(const QString &text); QInputMethodEvent buildPreedit(const QString &text); - static int indexFromWayland(const QString &str, int utf8Index, int baseIndex = 0); + static int indexFromWayland(const QString &text, int length, int base = 0); + static int indexToWayland(const QString &text, int length, int base = 0); private: QPair replacementForDeleteSurrounding(); From c477d954aeeb88877613a54fd9ed3bbae92bdab6 Mon Sep 17 00:00:00 2001 From: Erik Larsson Date: Sun, 17 Apr 2016 20:34:21 +0200 Subject: [PATCH 0316/1507] Move drag icon relative the cursor hotspot position Instead of placing the drag icons top-left corner at the cursors hotspot the drag icon is moved so it will be placed correct relative the cursor hotspot. This will makes the drag feeling more realistic. Change-Id: I8d60ae1b7788accb9034575983417abae4c58c1a Reviewed-by: Giulio Camuffo Reviewed-by: Johan Helsing --- src/plugins/platforms/wayland/qwaylanddnd.cpp | 1 + src/plugins/platforms/wayland/qwaylandwindow.cpp | 5 +++++ src/plugins/platforms/wayland/qwaylandwindow_p.h | 1 + 3 files changed, 7 insertions(+) diff --git a/src/plugins/platforms/wayland/qwaylanddnd.cpp b/src/plugins/platforms/wayland/qwaylanddnd.cpp index a84b749e6aa..b59ac6d704c 100644 --- a/src/plugins/platforms/wayland/qwaylanddnd.cpp +++ b/src/plugins/platforms/wayland/qwaylanddnd.cpp @@ -74,6 +74,7 @@ void QWaylandDrag::startDrag() QBasicDrag::startDrag(); QWaylandWindow *icon = static_cast(shapedPixmapWindow()->handle()); m_display->currentInputDevice()->dataDevice()->startDrag(drag()->mimeData(), icon); + icon->addAttachOffset(-drag()->hotSpot()); } void QWaylandDrag::cancel() diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 3146f70b3a8..da067dc9231 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -905,6 +905,11 @@ void QWaylandWindow::requestUpdate() mUpdateRequested = true; } +void QWaylandWindow::addAttachOffset(const QPoint point) +{ + mOffset += point; +} + } QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index 57f4657bb16..f36f0833ba9 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -197,6 +197,7 @@ public: bool setKeyboardGrabEnabled(bool) Q_DECL_OVERRIDE { return false; } void propagateSizeHints() Q_DECL_OVERRIDE { } + void addAttachOffset(const QPoint point); void requestUpdate() Q_DECL_OVERRIDE; From 4e697de346025f86adb36422072766b6056d1dde Mon Sep 17 00:00:00 2001 From: Erik Larsson Date: Sat, 27 Feb 2016 23:00:02 +0100 Subject: [PATCH 0317/1507] Add QML api for client side extension. This makes it simple to use client-side extensions in QML. The only thing that the user needs to do is register the extension class using qmlRegisterType() and the use the extension in QML. Also adds simple QML example which uses client-side extension. Change-Id: I2db99861d97c7bca5cfdbf86ba3a8ccc50fb24b0 Reviewed-by: Giulio Camuffo --- .../global/qwaylandclientextension.cpp | 27 ++++++++++++++++--- .../wayland/global/qwaylandclientextension.h | 3 +++ .../global/qwaylandclientextension_p.h | 1 + 3 files changed, 28 insertions(+), 3 deletions(-) diff --git a/src/plugins/platforms/wayland/global/qwaylandclientextension.cpp b/src/plugins/platforms/wayland/global/qwaylandclientextension.cpp index 501f266f534..b71c41d11e9 100644 --- a/src/plugins/platforms/wayland/global/qwaylandclientextension.cpp +++ b/src/plugins/platforms/wayland/global/qwaylandclientextension.cpp @@ -38,6 +38,8 @@ #include "qwaylandclientextension_p.h" #include #include +#include +#include QT_BEGIN_NAMESPACE @@ -45,11 +47,22 @@ namespace QtWaylandClient { QWaylandClientExtensionPrivate::QWaylandClientExtensionPrivate() : QObjectPrivate() - , waylandIntegration(new QWaylandIntegration()) + , waylandIntegration(NULL) , version(-1) + , active(false) { - QtWaylandClient::QWaylandDisplay *waylandDisplay = waylandIntegration->display(); - struct ::wl_registry *registry = wl_display_get_registry(waylandDisplay->wl_display()); + // Keep the possibility to use a custom waylandIntegration as a plugin, + // but also add the possibility to run it as a QML component. + struct ::wl_display *waylandDisplay = NULL; + if (QGuiApplication::platformNativeInterface()) { + waylandDisplay = static_cast(QGuiApplication::platformNativeInterface()->nativeResourceForIntegration("wl_display")); + } else { + waylandIntegration = new QWaylandIntegration(); + waylandDisplay = waylandIntegration->display()->wl_display(); + } + + Q_ASSERT(waylandDisplay); + struct ::wl_registry *registry = wl_display_get_registry(waylandDisplay); QtWayland::wl_registry::init(registry); } @@ -59,6 +72,8 @@ void QWaylandClientExtensionPrivate::registry_global(uint32_t id, const QString if (interfaceName == QLatin1String(q->extensionInterface()->name)) { struct ::wl_registry *registry = static_cast(QtWayland::wl_registry::object()); q->bind(registry, id, ver); + active = true; + emit q->activeChanged(); } } @@ -90,6 +105,12 @@ void QWaylandClientExtension::setVersion(const int ver) } } +bool QWaylandClientExtension::active() const +{ + Q_D(const QWaylandClientExtension); + return d->active; +} + } QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/global/qwaylandclientextension.h b/src/plugins/platforms/wayland/global/qwaylandclientextension.h index efdfa46fb65..aee03eb2911 100644 --- a/src/plugins/platforms/wayland/global/qwaylandclientextension.h +++ b/src/plugins/platforms/wayland/global/qwaylandclientextension.h @@ -54,11 +54,13 @@ class Q_WAYLAND_CLIENT_EXPORT QWaylandClientExtension : public QObject Q_OBJECT Q_DECLARE_PRIVATE(QWaylandClientExtension) Q_PROPERTY(int protocolVersion READ version NOTIFY versionChanged) + Q_PROPERTY(bool active READ active NOTIFY activeChanged) public: QWaylandClientExtension(const int version); QWaylandIntegration *integration() const; int version() const; + bool active() const; virtual const struct wl_interface *extensionInterface() const = 0; virtual void bind(struct ::wl_registry *registry, int id, int version) = 0; @@ -66,6 +68,7 @@ protected: void setVersion(const int version); Q_SIGNALS: void versionChanged(); + void activeChanged(); }; template diff --git a/src/plugins/platforms/wayland/global/qwaylandclientextension_p.h b/src/plugins/platforms/wayland/global/qwaylandclientextension_p.h index 2676f0ee632..9287ee95a50 100644 --- a/src/plugins/platforms/wayland/global/qwaylandclientextension_p.h +++ b/src/plugins/platforms/wayland/global/qwaylandclientextension_p.h @@ -65,6 +65,7 @@ public: QWaylandIntegration *waylandIntegration; int version; + bool active; protected: void registry_global(uint32_t id, const QString &interfaceName, uint32_t version) Q_DECL_OVERRIDE; From c9ea9bb0fcb693c0c8e8f0ea0e78633a8e400ebd Mon Sep 17 00:00:00 2001 From: Giulio Camuffo Date: Wed, 20 Apr 2016 08:56:00 +0300 Subject: [PATCH 0318/1507] Fix checking the Qt::BypassWindowManagerHint flag Change-Id: I24ca4854aa6756f4cea4f4f5a471ffd9bf33c620 Reviewed-by: Johan Helsing Reviewed-by: Erik Larsson Reviewed-by: Laszlo Agocs --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 2dd58e89cc5..aba676533bb 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -185,7 +185,7 @@ bool QWaylandWindow::shouldCreateShellSurface() const return false; if (qEnvironmentVariableIsSet("QT_WAYLAND_USE_BYPASSWINDOWMANAGERHINT")) - return window()->flags() & Qt::BypassWindowManagerHint; + return !(window()->flags() & Qt::BypassWindowManagerHint); return true; } From b4b446915ac5fe420e8268a33dd19d24b2dc793d Mon Sep 17 00:00:00 2001 From: Giulio Camuffo Date: Thu, 12 May 2016 18:12:36 +0300 Subject: [PATCH 0319/1507] Rename QWaylandClientExtension's active() to isActive() Change-Id: Idaf14be727af20d308c21f2cf33db6d417765744 Reviewed-by: Pier Luigi Fiorini --- .../platforms/wayland/global/qwaylandclientextension.cpp | 2 +- .../platforms/wayland/global/qwaylandclientextension.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/plugins/platforms/wayland/global/qwaylandclientextension.cpp b/src/plugins/platforms/wayland/global/qwaylandclientextension.cpp index b71c41d11e9..95616f7e8f1 100644 --- a/src/plugins/platforms/wayland/global/qwaylandclientextension.cpp +++ b/src/plugins/platforms/wayland/global/qwaylandclientextension.cpp @@ -105,7 +105,7 @@ void QWaylandClientExtension::setVersion(const int ver) } } -bool QWaylandClientExtension::active() const +bool QWaylandClientExtension::isActive() const { Q_D(const QWaylandClientExtension); return d->active; diff --git a/src/plugins/platforms/wayland/global/qwaylandclientextension.h b/src/plugins/platforms/wayland/global/qwaylandclientextension.h index aee03eb2911..b9a3017d9e4 100644 --- a/src/plugins/platforms/wayland/global/qwaylandclientextension.h +++ b/src/plugins/platforms/wayland/global/qwaylandclientextension.h @@ -54,13 +54,13 @@ class Q_WAYLAND_CLIENT_EXPORT QWaylandClientExtension : public QObject Q_OBJECT Q_DECLARE_PRIVATE(QWaylandClientExtension) Q_PROPERTY(int protocolVersion READ version NOTIFY versionChanged) - Q_PROPERTY(bool active READ active NOTIFY activeChanged) + Q_PROPERTY(bool active READ isActive NOTIFY activeChanged) public: QWaylandClientExtension(const int version); QWaylandIntegration *integration() const; int version() const; - bool active() const; + bool isActive() const; virtual const struct wl_interface *extensionInterface() const = 0; virtual void bind(struct ::wl_registry *registry, int id, int version) = 0; From 7efc23b8fbd3890991108609d3f1190272a03012 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Fri, 13 May 2016 09:15:00 +0200 Subject: [PATCH 0320/1507] Rename private headers to _p.h Change-Id: I0f0d1bd8efabc39325eec7dba4166ae0bccbf6ff Reviewed-by: Johan Helsing Reviewed-by: Giulio Camuffo --- src/plugins/platforms/wayland/client.pro | 7 ++++--- src/plugins/platforms/wayland/qwaylanddatasource.cpp | 2 +- src/plugins/platforms/wayland/qwaylandinputcontext.cpp | 4 ++-- src/plugins/platforms/wayland/qwaylandinputcontext_p.h | 2 +- src/plugins/platforms/wayland/qwaylandinputdevice.cpp | 2 +- src/plugins/platforms/wayland/qwaylandshm.cpp | 2 +- .../wayland/shared/qwaylandinputmethodeventbuilder.cpp | 2 +- ...deventbuilder.h => qwaylandinputmethodeventbuilder_p.h} | 0 .../platforms/wayland/shared/qwaylandmimehelper.cpp | 2 +- .../{qwaylandmimehelper.h => qwaylandmimehelper_p.h} | 0 ...aylandshmformathelper.h => qwaylandshmformathelper_p.h} | 0 src/plugins/platforms/wayland/shared/qwaylandxkb.cpp | 2 +- .../wayland/shared/{qwaylandxkb.h => qwaylandxkb_p.h} | 0 13 files changed, 13 insertions(+), 12 deletions(-) rename src/plugins/platforms/wayland/shared/{qwaylandinputmethodeventbuilder.h => qwaylandinputmethodeventbuilder_p.h} (100%) rename src/plugins/platforms/wayland/shared/{qwaylandmimehelper.h => qwaylandmimehelper_p.h} (100%) rename src/plugins/platforms/wayland/shared/{qwaylandshmformathelper.h => qwaylandshmformathelper_p.h} (100%) rename src/plugins/platforms/wayland/shared/{qwaylandxkb.h => qwaylandxkb_p.h} (100%) diff --git a/src/plugins/platforms/wayland/client.pro b/src/plugins/platforms/wayland/client.pro index 61404eeb98c..500a757f92e 100644 --- a/src/plugins/platforms/wayland/client.pro +++ b/src/plugins/platforms/wayland/client.pro @@ -99,9 +99,6 @@ HEADERS += qwaylandintegration_p.h \ qwaylandsubsurface_p.h \ qwaylandtouch_p.h \ qwaylandqtkey_p.h \ - ../shared/qwaylandmimehelper.h \ - ../shared/qwaylandxkb.h \ - ../shared/qwaylandinputmethodeventbuilder.h \ qwaylandabstractdecoration_p.h \ qwaylanddecorationfactory_p.h \ qwaylanddecorationplugin_p.h \ @@ -109,6 +106,10 @@ HEADERS += qwaylandintegration_p.h \ qwaylandinputcontext_p.h \ qwaylanddatadevice_p.h \ qwaylandshm_p.h \ + ../shared/qwaylandinputmethodeventbuilder_p.h \ + ../shared/qwaylandmimehelper_p.h \ + ../shared/qwaylandxkb_p.h \ + ../shared/qwaylandshmformathelper_p.h include(hardwareintegration/hardwareintegration.pri) include(shellintegration/shellintegration.pri) diff --git a/src/plugins/platforms/wayland/qwaylanddatasource.cpp b/src/plugins/platforms/wayland/qwaylanddatasource.cpp index 32aab082390..40beea317cd 100644 --- a/src/plugins/platforms/wayland/qwaylanddatasource.cpp +++ b/src/plugins/platforms/wayland/qwaylanddatasource.cpp @@ -41,7 +41,7 @@ #include "qwaylanddataoffer_p.h" #include "qwaylanddatadevicemanager_p.h" #include "qwaylandinputdevice_p.h" -#include "qwaylandmimehelper.h" +#include "qwaylandmimehelper_p.h" #include diff --git a/src/plugins/platforms/wayland/qwaylandinputcontext.cpp b/src/plugins/platforms/wayland/qwaylandinputcontext.cpp index af8e6f81838..509965d2f1a 100644 --- a/src/plugins/platforms/wayland/qwaylandinputcontext.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputcontext.cpp @@ -48,9 +48,9 @@ #include "qwaylanddisplay_p.h" #include "qwaylandinputdevice_p.h" -#include "qwaylandinputmethodeventbuilder.h" +#include "qwaylandinputmethodeventbuilder_p.h" #include "qwaylandwindow_p.h" -#include "qwaylandxkb.h" +#include "qwaylandxkb_p.h" QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandinputcontext_p.h b/src/plugins/platforms/wayland/qwaylandinputcontext_p.h index 8b789e3420a..53eab994f5b 100644 --- a/src/plugins/platforms/wayland/qwaylandinputcontext_p.h +++ b/src/plugins/platforms/wayland/qwaylandinputcontext_p.h @@ -60,7 +60,7 @@ #include #include -#include +#include QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index cf1c7ac448e..e85a8d98403 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -49,7 +49,7 @@ #include "qwaylandcursor_p.h" #include "qwaylanddisplay_p.h" #include "qwaylandshmbackingstore_p.h" -#include "../shared/qwaylandxkb.h" +#include "../shared/qwaylandxkb_p.h" #include "qwaylandinputcontext_p.h" #include diff --git a/src/plugins/platforms/wayland/qwaylandshm.cpp b/src/plugins/platforms/wayland/qwaylandshm.cpp index 137789679b0..790a0e1b99f 100644 --- a/src/plugins/platforms/wayland/qwaylandshm.cpp +++ b/src/plugins/platforms/wayland/qwaylandshm.cpp @@ -39,7 +39,7 @@ #include #include -#include "qwaylandshmformathelper.h" +#include "qwaylandshmformathelper_p.h" QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/wayland/shared/qwaylandinputmethodeventbuilder.cpp b/src/plugins/platforms/wayland/shared/qwaylandinputmethodeventbuilder.cpp index fe93f51463f..0e2d1a406b3 100644 --- a/src/plugins/platforms/wayland/shared/qwaylandinputmethodeventbuilder.cpp +++ b/src/plugins/platforms/wayland/shared/qwaylandinputmethodeventbuilder.cpp @@ -37,7 +37,7 @@ ** ****************************************************************************/ -#include "qwaylandinputmethodeventbuilder.h" +#include "qwaylandinputmethodeventbuilder_p.h" #include #include diff --git a/src/plugins/platforms/wayland/shared/qwaylandinputmethodeventbuilder.h b/src/plugins/platforms/wayland/shared/qwaylandinputmethodeventbuilder_p.h similarity index 100% rename from src/plugins/platforms/wayland/shared/qwaylandinputmethodeventbuilder.h rename to src/plugins/platforms/wayland/shared/qwaylandinputmethodeventbuilder_p.h diff --git a/src/plugins/platforms/wayland/shared/qwaylandmimehelper.cpp b/src/plugins/platforms/wayland/shared/qwaylandmimehelper.cpp index c223efbe5b4..a5fdd34dec4 100644 --- a/src/plugins/platforms/wayland/shared/qwaylandmimehelper.cpp +++ b/src/plugins/platforms/wayland/shared/qwaylandmimehelper.cpp @@ -37,7 +37,7 @@ ** ****************************************************************************/ -#include "qwaylandmimehelper.h" +#include "qwaylandmimehelper_p.h" #include #include #include diff --git a/src/plugins/platforms/wayland/shared/qwaylandmimehelper.h b/src/plugins/platforms/wayland/shared/qwaylandmimehelper_p.h similarity index 100% rename from src/plugins/platforms/wayland/shared/qwaylandmimehelper.h rename to src/plugins/platforms/wayland/shared/qwaylandmimehelper_p.h diff --git a/src/plugins/platforms/wayland/shared/qwaylandshmformathelper.h b/src/plugins/platforms/wayland/shared/qwaylandshmformathelper_p.h similarity index 100% rename from src/plugins/platforms/wayland/shared/qwaylandshmformathelper.h rename to src/plugins/platforms/wayland/shared/qwaylandshmformathelper_p.h diff --git a/src/plugins/platforms/wayland/shared/qwaylandxkb.cpp b/src/plugins/platforms/wayland/shared/qwaylandxkb.cpp index 32d24bd62d1..499257009cf 100644 --- a/src/plugins/platforms/wayland/shared/qwaylandxkb.cpp +++ b/src/plugins/platforms/wayland/shared/qwaylandxkb.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include "qwaylandxkb.h" +#include "qwaylandxkb_p.h" #include #include diff --git a/src/plugins/platforms/wayland/shared/qwaylandxkb.h b/src/plugins/platforms/wayland/shared/qwaylandxkb_p.h similarity index 100% rename from src/plugins/platforms/wayland/shared/qwaylandxkb.h rename to src/plugins/platforms/wayland/shared/qwaylandxkb_p.h From 7f97e7116d87acfbdc7fda5469c3fd262ce2a594 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Thu, 19 May 2016 11:34:06 +0200 Subject: [PATCH 0321/1507] Make qwaylandclientexport public ...since it's being used by a public header. Change-Id: I38049c27c8bd4dc793416bf836d79c4226172d38 Reviewed-by: Giulio Camuffo --- src/plugins/platforms/wayland/client.pro | 1 + src/plugins/platforms/wayland/global/qwaylandclientextension.h | 2 +- .../hardwareintegration/qwaylandclientbufferintegration_p.h | 2 +- .../qwaylandclientbufferintegrationfactory_p.h | 2 +- .../qwaylandclientbufferintegrationplugin_p.h | 2 +- .../wayland/hardwareintegration/qwaylandhardwareintegration_p.h | 2 +- .../hardwareintegration/qwaylandserverbufferintegration_p.h | 2 +- .../qwaylandserverbufferintegrationfactory_p.h | 2 +- .../qwaylandserverbufferintegrationplugin_p.h | 2 +- .../inputdeviceintegration/qwaylandinputdeviceintegration_p.h | 2 +- .../qwaylandinputdeviceintegrationfactory_p.h | 2 +- .../qwaylandinputdeviceintegrationplugin_p.h | 2 +- src/plugins/platforms/wayland/qwaylandabstractdecoration_p.h | 2 +- src/plugins/platforms/wayland/qwaylandbuffer_p.h | 2 +- .../{qwaylandclientexport_p.h => qwaylandclientexport.h} | 0 src/plugins/platforms/wayland/qwaylandclipboard_p.h | 2 +- src/plugins/platforms/wayland/qwaylandcursor_p.h | 2 +- src/plugins/platforms/wayland/qwaylanddatadevicemanager_p.h | 2 +- src/plugins/platforms/wayland/qwaylanddataoffer_p.h | 2 +- src/plugins/platforms/wayland/qwaylanddatasource_p.h | 2 +- src/plugins/platforms/wayland/qwaylanddecorationfactory_p.h | 2 +- src/plugins/platforms/wayland/qwaylanddecorationplugin_p.h | 2 +- src/plugins/platforms/wayland/qwaylanddisplay_p.h | 2 +- src/plugins/platforms/wayland/qwaylanddnd_p.h | 2 +- src/plugins/platforms/wayland/qwaylandextendedsurface_p.h | 2 +- src/plugins/platforms/wayland/qwaylandintegration_p.h | 2 +- src/plugins/platforms/wayland/qwaylandnativeinterface_p.h | 2 +- src/plugins/platforms/wayland/qwaylandqtkey_p.h | 2 +- src/plugins/platforms/wayland/qwaylandscreen_p.h | 2 +- src/plugins/platforms/wayland/qwaylandshellsurface_p.h | 2 +- src/plugins/platforms/wayland/qwaylandshm_p.h | 2 +- src/plugins/platforms/wayland/qwaylandsubsurface_p.h | 2 +- src/plugins/platforms/wayland/qwaylandtouch_p.h | 2 +- src/plugins/platforms/wayland/qwaylandwindow_p.h | 2 +- .../platforms/wayland/qwaylandwindowmanagerintegration_p.h | 2 +- src/plugins/platforms/wayland/qwaylandwlshellsurface_p.h | 2 +- src/plugins/platforms/wayland/qwaylandxdgshell_p.h | 2 +- src/plugins/platforms/wayland/qwaylandxdgsurface_p.h | 2 +- .../wayland/shellintegration/qwaylandshellintegration_p.h | 2 +- .../shellintegration/qwaylandshellintegrationfactory_p.h | 2 +- .../wayland/shellintegration/qwaylandshellintegrationplugin_p.h | 2 +- 41 files changed, 40 insertions(+), 39 deletions(-) rename src/plugins/platforms/wayland/{qwaylandclientexport_p.h => qwaylandclientexport.h} (100%) diff --git a/src/plugins/platforms/wayland/client.pro b/src/plugins/platforms/wayland/client.pro index 500a757f92e..994cf544300 100644 --- a/src/plugins/platforms/wayland/client.pro +++ b/src/plugins/platforms/wayland/client.pro @@ -106,6 +106,7 @@ HEADERS += qwaylandintegration_p.h \ qwaylandinputcontext_p.h \ qwaylanddatadevice_p.h \ qwaylandshm_p.h \ + qwaylandclientexport.h \ ../shared/qwaylandinputmethodeventbuilder_p.h \ ../shared/qwaylandmimehelper_p.h \ ../shared/qwaylandxkb_p.h \ diff --git a/src/plugins/platforms/wayland/global/qwaylandclientextension.h b/src/plugins/platforms/wayland/global/qwaylandclientextension.h index b9a3017d9e4..7fd1132cc88 100644 --- a/src/plugins/platforms/wayland/global/qwaylandclientextension.h +++ b/src/plugins/platforms/wayland/global/qwaylandclientextension.h @@ -39,7 +39,7 @@ #include #include -#include +#include #include QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegration_p.h b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegration_p.h index 342742c3e65..adaf2902a24 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegration_p.h +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegration_p.h @@ -52,7 +52,7 @@ // #include -#include +#include QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationfactory_p.h b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationfactory_p.h index 0a5d3561632..c70a2bd56a5 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationfactory_p.h +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationfactory_p.h @@ -51,7 +51,7 @@ // We mean it. // -#include +#include #include QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationplugin_p.h b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationplugin_p.h index 39a0379674d..2830f95fa9a 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationplugin_p.h +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationplugin_p.h @@ -51,7 +51,7 @@ // We mean it. // -#include +#include #include #include diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandhardwareintegration_p.h b/src/plugins/platforms/wayland/hardwareintegration/qwaylandhardwareintegration_p.h index 3b8028eac8c..92748c9f083 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandhardwareintegration_p.h +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandhardwareintegration_p.h @@ -52,7 +52,7 @@ // #include -#include +#include QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegration_p.h b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegration_p.h index 11ea36bc9b2..e3943da805f 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegration_p.h +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegration_p.h @@ -55,7 +55,7 @@ #include #include -#include +#include QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationfactory_p.h b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationfactory_p.h index 91871fad2c7..f17856208b2 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationfactory_p.h +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationfactory_p.h @@ -51,7 +51,7 @@ // We mean it. // -#include +#include #include QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationplugin_p.h b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationplugin_p.h index 8a074fb21b1..7eaaa1700cc 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationplugin_p.h +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationplugin_p.h @@ -51,7 +51,7 @@ // We mean it. // -#include +#include #include #include diff --git a/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegration_p.h b/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegration_p.h index 21d0c8bd8b9..ada63b713cb 100644 --- a/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegration_p.h +++ b/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegration_p.h @@ -52,7 +52,7 @@ // #include -#include +#include #include diff --git a/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationfactory_p.h b/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationfactory_p.h index 4431529ff8e..d6d0e843c6b 100644 --- a/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationfactory_p.h +++ b/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationfactory_p.h @@ -51,7 +51,7 @@ // We mean it. // -#include +#include #include QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationplugin_p.h b/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationplugin_p.h index cea178c49cc..c4a578d2e21 100644 --- a/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationplugin_p.h +++ b/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationplugin_p.h @@ -51,7 +51,7 @@ // We mean it. // -#include +#include #include #include diff --git a/src/plugins/platforms/wayland/qwaylandabstractdecoration_p.h b/src/plugins/platforms/wayland/qwaylandabstractdecoration_p.h index 6e4113efff8..3220dab9ccc 100644 --- a/src/plugins/platforms/wayland/qwaylandabstractdecoration_p.h +++ b/src/plugins/platforms/wayland/qwaylandabstractdecoration_p.h @@ -59,7 +59,7 @@ #include #include #include -#include +#include #include diff --git a/src/plugins/platforms/wayland/qwaylandbuffer_p.h b/src/plugins/platforms/wayland/qwaylandbuffer_p.h index 7dd920acc2c..8d651f82369 100644 --- a/src/plugins/platforms/wayland/qwaylandbuffer_p.h +++ b/src/plugins/platforms/wayland/qwaylandbuffer_p.h @@ -51,7 +51,7 @@ // We mean it. // -#include +#include #include #include diff --git a/src/plugins/platforms/wayland/qwaylandclientexport_p.h b/src/plugins/platforms/wayland/qwaylandclientexport.h similarity index 100% rename from src/plugins/platforms/wayland/qwaylandclientexport_p.h rename to src/plugins/platforms/wayland/qwaylandclientexport.h diff --git a/src/plugins/platforms/wayland/qwaylandclipboard_p.h b/src/plugins/platforms/wayland/qwaylandclipboard_p.h index 08d4baabdc6..aa008eef939 100644 --- a/src/plugins/platforms/wayland/qwaylandclipboard_p.h +++ b/src/plugins/platforms/wayland/qwaylandclipboard_p.h @@ -54,7 +54,7 @@ #include #include -#include +#include QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandcursor_p.h b/src/plugins/platforms/wayland/qwaylandcursor_p.h index a54841a28fd..4154ee191ee 100644 --- a/src/plugins/platforms/wayland/qwaylandcursor_p.h +++ b/src/plugins/platforms/wayland/qwaylandcursor_p.h @@ -53,7 +53,7 @@ #include #include -#include +#include struct wl_cursor; struct wl_cursor_image; diff --git a/src/plugins/platforms/wayland/qwaylanddatadevicemanager_p.h b/src/plugins/platforms/wayland/qwaylanddatadevicemanager_p.h index 36060529300..0c1d95d8223 100644 --- a/src/plugins/platforms/wayland/qwaylanddatadevicemanager_p.h +++ b/src/plugins/platforms/wayland/qwaylanddatadevicemanager_p.h @@ -51,7 +51,7 @@ // We mean it. // -#include +#include #include QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylanddataoffer_p.h b/src/plugins/platforms/wayland/qwaylanddataoffer_p.h index 534d79d7faa..5e635c1a0db 100644 --- a/src/plugins/platforms/wayland/qwaylanddataoffer_p.h +++ b/src/plugins/platforms/wayland/qwaylanddataoffer_p.h @@ -53,7 +53,7 @@ #include -#include +#include #include QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylanddatasource_p.h b/src/plugins/platforms/wayland/qwaylanddatasource_p.h index ec3f0aacc63..c099ff62a49 100644 --- a/src/plugins/platforms/wayland/qwaylanddatasource_p.h +++ b/src/plugins/platforms/wayland/qwaylanddatasource_p.h @@ -54,7 +54,7 @@ #include #include -#include +#include QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylanddecorationfactory_p.h b/src/plugins/platforms/wayland/qwaylanddecorationfactory_p.h index 4797f2336f5..9d4e7a9fb0d 100644 --- a/src/plugins/platforms/wayland/qwaylanddecorationfactory_p.h +++ b/src/plugins/platforms/wayland/qwaylanddecorationfactory_p.h @@ -51,7 +51,7 @@ // We mean it. // -#include +#include #include QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylanddecorationplugin_p.h b/src/plugins/platforms/wayland/qwaylanddecorationplugin_p.h index c5baa83f755..dd33f3416da 100644 --- a/src/plugins/platforms/wayland/qwaylanddecorationplugin_p.h +++ b/src/plugins/platforms/wayland/qwaylanddecorationplugin_p.h @@ -51,7 +51,7 @@ // We mean it. // -#include +#include #include #include diff --git a/src/plugins/platforms/wayland/qwaylanddisplay_p.h b/src/plugins/platforms/wayland/qwaylanddisplay_p.h index 618e57c59a8..59b005743c8 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay_p.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay_p.h @@ -60,7 +60,7 @@ #include #include -#include +#include #include #include diff --git a/src/plugins/platforms/wayland/qwaylanddnd_p.h b/src/plugins/platforms/wayland/qwaylanddnd_p.h index 29424375316..2ff00b9ffcf 100644 --- a/src/plugins/platforms/wayland/qwaylanddnd_p.h +++ b/src/plugins/platforms/wayland/qwaylanddnd_p.h @@ -57,7 +57,7 @@ #include #include -#include +#include QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandextendedsurface_p.h b/src/plugins/platforms/wayland/qwaylandextendedsurface_p.h index c004a9f7b47..39b85438a16 100644 --- a/src/plugins/platforms/wayland/qwaylandextendedsurface_p.h +++ b/src/plugins/platforms/wayland/qwaylandextendedsurface_p.h @@ -54,7 +54,7 @@ #include #include -#include +#include #include #include diff --git a/src/plugins/platforms/wayland/qwaylandintegration_p.h b/src/plugins/platforms/wayland/qwaylandintegration_p.h index 630ac090bf6..4ee6fac8e4e 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration_p.h +++ b/src/plugins/platforms/wayland/qwaylandintegration_p.h @@ -53,7 +53,7 @@ #include -#include +#include QT_BEGIN_NAMESPACE namespace QtWaylandClient { diff --git a/src/plugins/platforms/wayland/qwaylandnativeinterface_p.h b/src/plugins/platforms/wayland/qwaylandnativeinterface_p.h index 71194da33de..61c5e59d5b7 100644 --- a/src/plugins/platforms/wayland/qwaylandnativeinterface_p.h +++ b/src/plugins/platforms/wayland/qwaylandnativeinterface_p.h @@ -54,7 +54,7 @@ #include #include -#include +#include QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandqtkey_p.h b/src/plugins/platforms/wayland/qwaylandqtkey_p.h index c746dc92592..b749bd5f9e8 100644 --- a/src/plugins/platforms/wayland/qwaylandqtkey_p.h +++ b/src/plugins/platforms/wayland/qwaylandqtkey_p.h @@ -53,7 +53,7 @@ #include -#include +#include #include QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandscreen_p.h b/src/plugins/platforms/wayland/qwaylandscreen_p.h index b4fa12e4717..12b68064017 100644 --- a/src/plugins/platforms/wayland/qwaylandscreen_p.h +++ b/src/plugins/platforms/wayland/qwaylandscreen_p.h @@ -52,7 +52,7 @@ // #include -#include +#include #include diff --git a/src/plugins/platforms/wayland/qwaylandshellsurface_p.h b/src/plugins/platforms/wayland/qwaylandshellsurface_p.h index 053be3b5f9a..63b77ab33c5 100644 --- a/src/plugins/platforms/wayland/qwaylandshellsurface_p.h +++ b/src/plugins/platforms/wayland/qwaylandshellsurface_p.h @@ -57,7 +57,7 @@ #include #include -#include +#include QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandshm_p.h b/src/plugins/platforms/wayland/qwaylandshm_p.h index 80d2b94923c..aafe4463291 100644 --- a/src/plugins/platforms/wayland/qwaylandshm_p.h +++ b/src/plugins/platforms/wayland/qwaylandshm_p.h @@ -54,7 +54,7 @@ #include #include -#include +#include #include QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandsubsurface_p.h b/src/plugins/platforms/wayland/qwaylandsubsurface_p.h index b5f869bf2e2..0abd168bc18 100644 --- a/src/plugins/platforms/wayland/qwaylandsubsurface_p.h +++ b/src/plugins/platforms/wayland/qwaylandsubsurface_p.h @@ -56,7 +56,7 @@ #include #include -#include +#include #include QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandtouch_p.h b/src/plugins/platforms/wayland/qwaylandtouch_p.h index 8aa06d3ec4a..dc32b84a063 100644 --- a/src/plugins/platforms/wayland/qwaylandtouch_p.h +++ b/src/plugins/platforms/wayland/qwaylandtouch_p.h @@ -54,7 +54,7 @@ #include #include -#include +#include QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index f36f0833ba9..100c068facc 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -59,7 +59,7 @@ #include #include -#include +#include struct wl_egl_window; diff --git a/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration_p.h b/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration_p.h index 344960d5799..80513af3aaa 100644 --- a/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration_p.h @@ -58,7 +58,7 @@ #include #include -#include +#include QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandwlshellsurface_p.h b/src/plugins/platforms/wayland/qwaylandwlshellsurface_p.h index 1da64e9d7ef..c319cd98393 100644 --- a/src/plugins/platforms/wayland/qwaylandwlshellsurface_p.h +++ b/src/plugins/platforms/wayland/qwaylandwlshellsurface_p.h @@ -56,7 +56,7 @@ #include #include -#include +#include #include "qwaylandshellsurface_p.h" QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandxdgshell_p.h b/src/plugins/platforms/wayland/qwaylandxdgshell_p.h index 2b5a8eb8b6d..bce8345d005 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgshell_p.h +++ b/src/plugins/platforms/wayland/qwaylandxdgshell_p.h @@ -56,7 +56,7 @@ #include #include -#include +#include #include "qwaylandshellsurface_p.h" QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandxdgsurface_p.h b/src/plugins/platforms/wayland/qwaylandxdgsurface_p.h index 9d6c8c410d2..342dff75d39 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgsurface_p.h +++ b/src/plugins/platforms/wayland/qwaylandxdgsurface_p.h @@ -57,7 +57,7 @@ #include #include -#include +#include #include "qwaylandshellsurface_p.h" QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegration_p.h b/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegration_p.h index 8395c868ec5..e8e46ecaa12 100644 --- a/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegration_p.h +++ b/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegration_p.h @@ -52,7 +52,7 @@ // #include -#include +#include QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationfactory_p.h b/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationfactory_p.h index 6e595b06dc7..0783465a82a 100644 --- a/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationfactory_p.h +++ b/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationfactory_p.h @@ -51,7 +51,7 @@ // We mean it. // -#include +#include #include QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationplugin_p.h b/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationplugin_p.h index 5566843b109..be511bfc338 100644 --- a/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationplugin_p.h +++ b/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationplugin_p.h @@ -51,7 +51,7 @@ // We mean it. // -#include +#include #include #include From 90b66d4c46bdd49387a72fed0475fdcbd86fcbf7 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Thu, 19 May 2016 11:45:28 +0200 Subject: [PATCH 0322/1507] Move QWaylandClientExtension out of namespace The class name already has a QWaylandClient prefix. We don't need QtWaylandClient:: in addition. Change-Id: I42f16d43fe414e3388dfdb924e96d9fc2b0b4ba9 Reviewed-by: Giulio Camuffo --- .../platforms/wayland/global/qwaylandclientextension.cpp | 8 ++------ .../platforms/wayland/global/qwaylandclientextension.h | 7 +++---- .../platforms/wayland/global/qwaylandclientextension_p.h | 6 +----- 3 files changed, 6 insertions(+), 15 deletions(-) diff --git a/src/plugins/platforms/wayland/global/qwaylandclientextension.cpp b/src/plugins/platforms/wayland/global/qwaylandclientextension.cpp index 95616f7e8f1..04aca8c2e12 100644 --- a/src/plugins/platforms/wayland/global/qwaylandclientextension.cpp +++ b/src/plugins/platforms/wayland/global/qwaylandclientextension.cpp @@ -43,8 +43,6 @@ QT_BEGIN_NAMESPACE -namespace QtWaylandClient { - QWaylandClientExtensionPrivate::QWaylandClientExtensionPrivate() : QObjectPrivate() , waylandIntegration(NULL) @@ -57,7 +55,7 @@ QWaylandClientExtensionPrivate::QWaylandClientExtensionPrivate() if (QGuiApplication::platformNativeInterface()) { waylandDisplay = static_cast(QGuiApplication::platformNativeInterface()->nativeResourceForIntegration("wl_display")); } else { - waylandIntegration = new QWaylandIntegration(); + waylandIntegration = new QtWaylandClient::QWaylandIntegration(); waylandDisplay = waylandIntegration->display()->wl_display(); } @@ -84,7 +82,7 @@ QWaylandClientExtension::QWaylandClientExtension(const int ver) d->version = ver; } -QWaylandIntegration *QWaylandClientExtension::integration() const +QtWaylandClient::QWaylandIntegration *QWaylandClientExtension::integration() const { Q_D(const QWaylandClientExtension); return d->waylandIntegration; @@ -111,6 +109,4 @@ bool QWaylandClientExtension::isActive() const return d->active; } -} - QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/global/qwaylandclientextension.h b/src/plugins/platforms/wayland/global/qwaylandclientextension.h index 7fd1132cc88..a3de0aa4b8c 100644 --- a/src/plugins/platforms/wayland/global/qwaylandclientextension.h +++ b/src/plugins/platforms/wayland/global/qwaylandclientextension.h @@ -44,8 +44,9 @@ QT_BEGIN_NAMESPACE namespace QtWaylandClient { - class QWaylandIntegration; +} + class QWaylandClientExtensionPrivate; class QWaylandClientExtensionTemplatePrivate; @@ -58,7 +59,7 @@ class Q_WAYLAND_CLIENT_EXPORT QWaylandClientExtension : public QObject public: QWaylandClientExtension(const int version); - QWaylandIntegration *integration() const; + QtWaylandClient::QWaylandIntegration *integration() const; int version() const; bool isActive() const; @@ -101,8 +102,6 @@ public: } }; -} - QT_END_NAMESPACE #endif // QWAYLANDCLIENTEXTENSION_H diff --git a/src/plugins/platforms/wayland/global/qwaylandclientextension_p.h b/src/plugins/platforms/wayland/global/qwaylandclientextension_p.h index 9287ee95a50..70cf36c3da9 100644 --- a/src/plugins/platforms/wayland/global/qwaylandclientextension_p.h +++ b/src/plugins/platforms/wayland/global/qwaylandclientextension_p.h @@ -55,15 +55,13 @@ QT_BEGIN_NAMESPACE -namespace QtWaylandClient { - class Q_WAYLAND_CLIENT_EXPORT QWaylandClientExtensionPrivate : public QObjectPrivate, public QtWayland::wl_registry { Q_DECLARE_PUBLIC(QWaylandClientExtension) public: QWaylandClientExtensionPrivate(); - QWaylandIntegration *waylandIntegration; + QtWaylandClient::QWaylandIntegration *waylandIntegration; int version; bool active; @@ -79,8 +77,6 @@ public: { } }; -} - QT_END_NAMESPACE #endif /*QWAYLANDCLIENTEXTENSION_P_H*/ From c1efd6fa2ab426150cc4de594ae91aa280b5368b Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Wed, 25 May 2016 13:52:07 +0200 Subject: [PATCH 0323/1507] Compile with -Wzero-as-null-pointer-constant Task-number: QTBUG-53619 Change-Id: Idf073287f215113431cad64f85628e010176ab74 Reviewed-by: Johan Helsing Reviewed-by: Giulio Camuffo Reviewed-by: Oswald Buddenhagen --- src/plugins/platforms/wayland/global/qwaylandclientextension.h | 1 - 1 file changed, 1 deletion(-) diff --git a/src/plugins/platforms/wayland/global/qwaylandclientextension.h b/src/plugins/platforms/wayland/global/qwaylandclientextension.h index a3de0aa4b8c..9ff45ea00d0 100644 --- a/src/plugins/platforms/wayland/global/qwaylandclientextension.h +++ b/src/plugins/platforms/wayland/global/qwaylandclientextension.h @@ -38,7 +38,6 @@ #define QWAYLANDCLIENTEXTENSION_H #include -#include #include #include QT_BEGIN_NAMESPACE From f3df72594e1442797cc5a2539adc1d8b53ac7991 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Fri, 13 May 2016 12:52:09 +0200 Subject: [PATCH 0324/1507] Don't use deprecated wl_client_add_object and wl_display_add_global Use wl_global_create, wl_resource_create and wl_resource_set_implementation instead. Change-Id: I8b1812df3daa2f4fe2ef8e850aa93ab125dadcf8 Reviewed-by: Pier Luigi Fiorini --- tests/auto/wayland/mockcompositor.cpp | 10 +++++----- tests/auto/wayland/mockoutput.cpp | 4 +--- tests/auto/wayland/mockshell.cpp | 9 +++++---- tests/auto/wayland/mocksurface.cpp | 2 +- 4 files changed, 12 insertions(+), 13 deletions(-) diff --git a/tests/auto/wayland/mockcompositor.cpp b/tests/auto/wayland/mockcompositor.cpp index 9fe02629dc9..4cea75ea270 100644 --- a/tests/auto/wayland/mockcompositor.cpp +++ b/tests/auto/wayland/mockcompositor.cpp @@ -194,7 +194,7 @@ Compositor::Compositor() exit(EXIT_FAILURE); } - wl_display_add_global(m_display, &wl_compositor_interface, this, bindCompositor); + wl_global_create(m_display, &wl_compositor_interface, 1, this, bindCompositor); m_data_device_manager.reset(new DataDeviceManager(this, m_display)); @@ -204,8 +204,8 @@ Compositor::Compositor() m_pointer = m_seat->pointer(); m_keyboard = m_seat->keyboard(); - wl_display_add_global(m_display, &wl_output_interface, this, bindOutput); - wl_display_add_global(m_display, &wl_shell_interface, this, bindShell); + wl_global_create(m_display, &wl_output_interface, 1, this, bindOutput); + wl_global_create(m_display, &wl_shell_interface, 1, this, bindShell); m_loop = wl_display_get_event_loop(m_display); m_fd = wl_event_loop_get_fd(m_loop); @@ -242,8 +242,8 @@ void Compositor::bindCompositor(wl_client *client, void *compositorData, uint32_ compositor_create_region }; - Q_UNUSED(version); - wl_client_add_object(client, &wl_compositor_interface, &compositorInterface, id, compositorData); + wl_resource *resource = wl_resource_create(client, &wl_compositor_interface, static_cast(version), id); + wl_resource_set_implementation(resource, &compositorInterface, compositorData, nullptr); } static void unregisterResourceCallback(wl_listener *listener, void *data) diff --git a/tests/auto/wayland/mockoutput.cpp b/tests/auto/wayland/mockoutput.cpp index 05738716047..86561976f0b 100644 --- a/tests/auto/wayland/mockoutput.cpp +++ b/tests/auto/wayland/mockoutput.cpp @@ -32,9 +32,7 @@ namespace Impl { void Compositor::bindOutput(wl_client *client, void *compositorData, uint32_t version, uint32_t id) { - Q_UNUSED(version); - - wl_resource *resource = wl_client_add_object(client, &wl_output_interface, 0, id, compositorData); + wl_resource *resource = wl_resource_create(client, &wl_output_interface, static_cast(version), id); Compositor *compositor = static_cast(compositorData); registerResource(&compositor->m_outputResources, resource); diff --git a/tests/auto/wayland/mockshell.cpp b/tests/auto/wayland/mockshell.cpp index 2ce5965a309..d5eede22e4d 100644 --- a/tests/auto/wayland/mockshell.cpp +++ b/tests/auto/wayland/mockshell.cpp @@ -159,8 +159,9 @@ static void get_shell_surface(wl_client *client, wl_resource *compositorResource shell_surface_set_class }; - Q_UNUSED(compositorResource); - wl_client_add_object(client, &wl_shell_surface_interface, &shellSurfaceInterface, id, surfaceResource->data); + int version = wl_resource_get_version(compositorResource); + wl_resource *shellSurface = wl_resource_create(client, &wl_shell_surface_interface, version, id); + wl_resource_set_implementation(shellSurface, &shellSurfaceInterface, surfaceResource->data, nullptr); Surface *surf = Surface::fromResource(surfaceResource); surf->map(); } @@ -171,8 +172,8 @@ void Compositor::bindShell(wl_client *client, void *compositorData, uint32_t ver get_shell_surface }; - Q_UNUSED(version); - wl_client_add_object(client, &wl_shell_interface, &shellInterface, id, compositorData); + wl_resource *resource = wl_resource_create(client, &wl_shell_interface, static_cast(version), id); + wl_resource_set_implementation(resource, &shellInterface, compositorData, nullptr); } } diff --git a/tests/auto/wayland/mocksurface.cpp b/tests/auto/wayland/mocksurface.cpp index 749a1470dd1..55712af1194 100644 --- a/tests/auto/wayland/mocksurface.cpp +++ b/tests/auto/wayland/mocksurface.cpp @@ -96,7 +96,7 @@ void Surface::surface_damage(Resource *resource, void Surface::surface_frame(Resource *resource, uint32_t callback) { - wl_resource *frameCallback = wl_client_add_object(resource->client(), &wl_callback_interface, 0, callback, this); + wl_resource *frameCallback = wl_resource_create(resource->client(), &wl_callback_interface, 1, callback); m_frameCallbackList << frameCallback; } From e79aa19f67b0dd0a5d2cd88ea4818664fbfb5932 Mon Sep 17 00:00:00 2001 From: Pier Luigi Fiorini Date: Fri, 8 Apr 2016 08:30:36 +0200 Subject: [PATCH 0325/1507] Rename QWaylandWindowManagerExtension to QWaylandQtWindowManager * QWaylandWindowManagerExtension become QWaylandQtWindowManager * WindowManager become QtWindowManager Follow naming convention already established for other extensions like QWaylandWlShell and avoid confusion that might arise with a name as generic as WindowManager. Use QWaylandClient rather than wl_client. Also the Wayland protocol definition has been renamed to qt-windowmanager.xml Change-Id: I941621ce229327c21eff9e80c7e92205cc60e8eb Reviewed-by: Giulio Camuffo Reviewed-by: Johan Helsing --- .../extensions/{windowmanager.xml => qt-windowmanager.xml} | 2 +- src/plugins/platforms/wayland/client.pro | 2 +- .../platforms/wayland/qwaylandwindowmanagerintegration_p.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) rename src/3rdparty/wayland/extensions/{windowmanager.xml => qt-windowmanager.xml} (98%) diff --git a/src/3rdparty/wayland/extensions/windowmanager.xml b/src/3rdparty/wayland/extensions/qt-windowmanager.xml similarity index 98% rename from src/3rdparty/wayland/extensions/windowmanager.xml rename to src/3rdparty/wayland/extensions/qt-windowmanager.xml index 3d3bbd7fe71..86ddff72ec5 100644 --- a/src/3rdparty/wayland/extensions/windowmanager.xml +++ b/src/3rdparty/wayland/extensions/qt-windowmanager.xml @@ -1,4 +1,4 @@ - + Copyright (C) 2015 The Qt Company Ltd. diff --git a/src/plugins/platforms/wayland/client.pro b/src/plugins/platforms/wayland/client.pro index 994cf544300..f0142c9a5b3 100644 --- a/src/plugins/platforms/wayland/client.pro +++ b/src/plugins/platforms/wayland/client.pro @@ -38,7 +38,7 @@ WAYLANDCLIENTSOURCES += \ ../extensions/surface-extension.xml \ ../extensions/touch-extension.xml \ ../extensions/qtkey-extension.xml \ - ../extensions/windowmanager.xml \ + ../extensions/qt-windowmanager.xml \ ../3rdparty/protocol/text-input-unstable-v2.xml \ ../3rdparty/protocol/xdg-shell.xml \ diff --git a/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration_p.h b/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration_p.h index 80513af3aaa..f2c0ac6be7a 100644 --- a/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration_p.h @@ -57,7 +57,7 @@ #include #include -#include +#include #include QT_BEGIN_NAMESPACE From 477e7e844c10899f350e72b43c8a90621ba0f073 Mon Sep 17 00:00:00 2001 From: Giulio Camuffo Date: Mon, 30 May 2016 15:31:30 +0300 Subject: [PATCH 0326/1507] client: Always accept the DnD data offer Weston stopped sending the wl_data_device.drop event if the data offer was not accepted, which was the case when it was coming from the same client that was receiving the offer. So now always accept the offer even if we will bypass the offer when retrieving the data. Change-Id: If825f4dbc962a7812e379f36a42ceabe3eb3096f Reviewed-by: Johan Helsing Reviewed-by: Paul Olav Tvete --- .../platforms/wayland/qwaylanddatadevice.cpp | 34 +++++++++---------- 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylanddatadevice.cpp b/src/plugins/platforms/wayland/qwaylanddatadevice.cpp index 3276348e9be..d1c755e37e6 100644 --- a/src/plugins/platforms/wayland/qwaylanddatadevice.cpp +++ b/src/plugins/platforms/wayland/qwaylanddatadevice.cpp @@ -155,31 +155,29 @@ void QWaylandDataDevice::data_device_enter(uint32_t serial, wl_surface *surface, m_dragWindow = QWaylandWindow::fromWlSurface(surface)->window(); m_dragPoint = QPoint(wl_fixed_to_int(x), wl_fixed_to_int(y)); - QDrag *drag = static_cast(QGuiApplicationPrivate::platformIntegration()->drag())->currentDrag(); - QMimeData *dragData = Q_NULLPTR; Qt::DropActions supportedActions; + + m_dragOffer.reset(static_cast(wl_data_offer_get_user_data(id))); + QDrag *drag = static_cast(QGuiApplicationPrivate::platformIntegration()->drag())->currentDrag(); if (drag) { dragData = drag->mimeData(); supportedActions = drag->supportedActions(); - } else { - m_dragOffer.reset(static_cast(wl_data_offer_get_user_data(id))); - if (m_dragOffer) { - dragData = m_dragOffer->mimeData(); - supportedActions = Qt::CopyAction | Qt::MoveAction | Qt::LinkAction; - } + } else if (m_dragOffer) { + dragData = m_dragOffer->mimeData(); + supportedActions = Qt::CopyAction | Qt::MoveAction | Qt::LinkAction; } const QPlatformDragQtResponse &response = QWindowSystemInterface::handleDrag(m_dragWindow, dragData, m_dragPoint, supportedActions); if (drag) { static_cast(QGuiApplicationPrivate::platformIntegration()->drag())->setResponse(response); + } + + if (response.isAccepted()) { + wl_data_offer_accept(m_dragOffer->object(), m_enterSerial, m_dragOffer->firstFormat().toUtf8().constData()); } else { - if (response.isAccepted()) { - wl_data_offer_accept(m_dragOffer->object(), m_enterSerial, m_dragOffer->firstFormat().toUtf8().constData()); - } else { - wl_data_offer_accept(m_dragOffer->object(), m_enterSerial, 0); - } + wl_data_offer_accept(m_dragOffer->object(), m_enterSerial, 0); } } @@ -218,12 +216,12 @@ void QWaylandDataDevice::data_device_motion(uint32_t time, wl_fixed_t x, wl_fixe if (drag) { static_cast(QGuiApplicationPrivate::platformIntegration()->drag())->setResponse(response); + } + + if (response.isAccepted()) { + wl_data_offer_accept(m_dragOffer->object(), m_enterSerial, m_dragOffer->firstFormat().toUtf8().constData()); } else { - if (response.isAccepted()) { - wl_data_offer_accept(m_dragOffer->object(), m_enterSerial, m_dragOffer->firstFormat().toUtf8().constData()); - } else { - wl_data_offer_accept(m_dragOffer->object(), m_enterSerial, 0); - } + wl_data_offer_accept(m_dragOffer->object(), m_enterSerial, 0); } } From fe52b009f3ea03ef62c447fddcd8597bec1fc9a2 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Wed, 8 Jun 2016 13:19:14 +0200 Subject: [PATCH 0327/1507] Set device pixel ratio for window decorations on scaled windows Change-Id: I40d96362131124effd9405cdad4e3dea79e6ebe3 Reviewed-by: Pier Luigi Fiorini --- src/plugins/platforms/wayland/qwaylandabstractdecoration.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandabstractdecoration.cpp b/src/plugins/platforms/wayland/qwaylandabstractdecoration.cpp index 54a990b2d71..98e944365df 100644 --- a/src/plugins/platforms/wayland/qwaylandabstractdecoration.cpp +++ b/src/plugins/platforms/wayland/qwaylandabstractdecoration.cpp @@ -104,7 +104,10 @@ const QImage &QWaylandAbstractDecoration::contentImage() if (d->m_isDirty) { //Update the decoration backingstore - d->m_decorationContentImage = QImage(window()->frameGeometry().size(), QImage::Format_ARGB32_Premultiplied); + const int scale = waylandWindow()->scale(); + const QSize imageSize = window()->frameGeometry().size() * scale; + d->m_decorationContentImage = QImage(imageSize, QImage::Format_ARGB32_Premultiplied); + d->m_decorationContentImage.setDevicePixelRatio(scale); d->m_decorationContentImage.fill(Qt::transparent); this->paint(&d->m_decorationContentImage); From ad7245b942279c69c683aaeabf83f29c8b344962 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Wed, 8 Jun 2016 17:40:25 +0200 Subject: [PATCH 0328/1507] Client: Fix incorrect size when maximizing using xdg_shell When maximizing xdg_shell clients, the clients would call QPlatformWindow::setGeometry() with frame margins included, resulting in a window that was bigger than what was requested by the compositor. The reason for this, was that QWaylandXdgSurface would subtract the frame margins from the width and height only when the resizing state was set, not when the maximized state was set. Later, margins were added again before QWaylandWindow::configure was called. This resulted in margins being subtracted and then added back for the resizing state, while for the maximized state margins were only added and never subtracted. This behavior has now been simplified so only size including window frame is tracked. This is what we receive in the XdgSurface::configure event anyway, and also what QWaylandWindow::configure expects. Change-Id: I0629e7e79a5367fa872743c6d025bfab8a4f2866 Reviewed-by: Giulio Camuffo --- .../platforms/wayland/qwaylandxdgsurface.cpp | 23 ++++++++----------- .../platforms/wayland/qwaylandxdgsurface_p.h | 2 +- 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandxdgsurface.cpp b/src/plugins/platforms/wayland/qwaylandxdgsurface.cpp index 202ac50bb67..8852d2dfb81 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgsurface.cpp +++ b/src/plugins/platforms/wayland/qwaylandxdgsurface.cpp @@ -56,7 +56,6 @@ QWaylandXdgSurface::QWaylandXdgSurface(struct ::xdg_surface *xdg_surface, QWayla { if (window->display()->windowExtension()) m_extendedWindow = new QWaylandExtendedSurface(window); - m_size = m_window->window()->geometry().size(); } QWaylandXdgSurface::~QWaylandXdgSurface() @@ -187,10 +186,7 @@ void QWaylandXdgSurface::xdg_surface_configure(int32_t width, int32_t height, st aboutToFullScreen = true; break; case XDG_SURFACE_STATE_RESIZING: - m_margins = m_window->frameMargins(); - width -= m_margins.left() + m_margins.right(); - height -= m_margins.top() + m_margins.bottom(); - m_size = m_window->window()->geometry().size(); + m_normalSize = QSize(width, height); break; case XDG_SURFACE_STATE_ACTIVATED: // TODO: here about the missing window activation @@ -201,6 +197,8 @@ void QWaylandXdgSurface::xdg_surface_configure(int32_t width, int32_t height, st } if (!m_fullscreen && aboutToFullScreen) { + if (!m_maximized) + m_normalSize = m_window->window()->frameGeometry().size(); m_fullscreen = true; m_window->window()->showFullScreen(); } else if (m_fullscreen && !aboutToFullScreen) { @@ -211,6 +209,8 @@ void QWaylandXdgSurface::xdg_surface_configure(int32_t width, int32_t height, st m_window->window()->showNormal(); } } else if (!m_maximized && aboutToMaximize) { + if (!m_fullscreen) + m_normalSize = m_window->window()->frameGeometry().size(); m_maximized = true; m_window->window()->showMaximized(); } else if (m_maximized && !aboutToMaximize) { @@ -218,14 +218,11 @@ void QWaylandXdgSurface::xdg_surface_configure(int32_t width, int32_t height, st m_window->window()->showNormal(); } - if (width == 0 || height == 0) { - width = m_size.width(); - height = m_size.height(); - } - - if (width > 0 && height > 0) { - m_margins = m_window->frameMargins(); - m_window->configure(0, width + m_margins.left() + m_margins.right(), height + m_margins.top() + m_margins.bottom()); + if (width <= 0 || height <= 0) { + if (!m_normalSize.isEmpty()) + m_window->configure(0, m_normalSize.width(), m_normalSize.height()); + } else { + m_window->configure(0, width, height); } ack_configure(serial); diff --git a/src/plugins/platforms/wayland/qwaylandxdgsurface_p.h b/src/plugins/platforms/wayland/qwaylandxdgsurface_p.h index 8deafef7756..d4380d25fbb 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgsurface_p.h +++ b/src/plugins/platforms/wayland/qwaylandxdgsurface_p.h @@ -106,7 +106,7 @@ private: bool m_maximized; bool m_minimized; bool m_fullscreen; - QSize m_size; + QSize m_normalSize; QMargins m_margins; QWaylandExtendedSurface *m_extendedWindow; From 065557fa2bedfcedac49cf8876c8db658b07e953 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Tue, 14 Jun 2016 13:23:59 +0200 Subject: [PATCH 0329/1507] Use QWaylandDisplay::addRegistryListener in QWaylandClientExtension Gets rid of an unnecessary get_registry request Change-Id: Ic8c6a61271658e07fbd67c83df0ae9e3d955d938 Reviewed-by: Giulio Camuffo --- .../global/qwaylandclientextension.cpp | 38 ++++++++++--------- .../wayland/global/qwaylandclientextension.h | 3 ++ .../global/qwaylandclientextension_p.h | 8 ++-- 3 files changed, 26 insertions(+), 23 deletions(-) diff --git a/src/plugins/platforms/wayland/global/qwaylandclientextension.cpp b/src/plugins/platforms/wayland/global/qwaylandclientextension.cpp index 04aca8c2e12..4202b333b47 100644 --- a/src/plugins/platforms/wayland/global/qwaylandclientextension.cpp +++ b/src/plugins/platforms/wayland/global/qwaylandclientextension.cpp @@ -39,7 +39,7 @@ #include #include #include -#include +#include QT_BEGIN_NAMESPACE @@ -51,35 +51,37 @@ QWaylandClientExtensionPrivate::QWaylandClientExtensionPrivate() { // Keep the possibility to use a custom waylandIntegration as a plugin, // but also add the possibility to run it as a QML component. - struct ::wl_display *waylandDisplay = NULL; - if (QGuiApplication::platformNativeInterface()) { - waylandDisplay = static_cast(QGuiApplication::platformNativeInterface()->nativeResourceForIntegration("wl_display")); - } else { + waylandIntegration = static_cast(QGuiApplicationPrivate::platformIntegration()); + if (!waylandIntegration) waylandIntegration = new QtWaylandClient::QWaylandIntegration(); - waylandDisplay = waylandIntegration->display()->wl_display(); - } - - Q_ASSERT(waylandDisplay); - struct ::wl_registry *registry = wl_display_get_registry(waylandDisplay); - QtWayland::wl_registry::init(registry); } -void QWaylandClientExtensionPrivate::registry_global(uint32_t id, const QString &interfaceName, uint32_t ver) +void QWaylandClientExtensionPrivate::handleRegistryGlobal(void *data, ::wl_registry *registry, uint32_t id, + const QString &interface, uint32_t version) { - Q_Q(QWaylandClientExtension); - if (interfaceName == QLatin1String(q->extensionInterface()->name)) { - struct ::wl_registry *registry = static_cast(QtWayland::wl_registry::object()); - q->bind(registry, id, ver); - active = true; - emit q->activeChanged(); + QWaylandClientExtension *extension = static_cast(data); + if (interface == QLatin1String(extension->extensionInterface()->name)) { + extension->bind(registry, id, version); + extension->d_func()->active = true; + emit extension->activeChanged(); } } +void QWaylandClientExtension::addRegistryListener() +{ + Q_D(QWaylandClientExtension); + d->waylandIntegration->display()->addRegistryListener(&QWaylandClientExtensionPrivate::handleRegistryGlobal, this); +} + QWaylandClientExtension::QWaylandClientExtension(const int ver) : QObject(*new QWaylandClientExtensionPrivate()) { Q_D(QWaylandClientExtension); d->version = ver; + + // The registry listener uses virtual functions and we don't want it to be called from + // the constructor. + QMetaObject::invokeMethod(this, "addRegistryListener", Qt::QueuedConnection); } QtWaylandClient::QWaylandIntegration *QWaylandClientExtension::integration() const diff --git a/src/plugins/platforms/wayland/global/qwaylandclientextension.h b/src/plugins/platforms/wayland/global/qwaylandclientextension.h index 9ff45ea00d0..a39f32b7f29 100644 --- a/src/plugins/platforms/wayland/global/qwaylandclientextension.h +++ b/src/plugins/platforms/wayland/global/qwaylandclientextension.h @@ -69,6 +69,9 @@ protected: Q_SIGNALS: void versionChanged(); void activeChanged(); + +private Q_SLOTS: + void addRegistryListener(); }; template diff --git a/src/plugins/platforms/wayland/global/qwaylandclientextension_p.h b/src/plugins/platforms/wayland/global/qwaylandclientextension_p.h index 70cf36c3da9..88cc7a88718 100644 --- a/src/plugins/platforms/wayland/global/qwaylandclientextension_p.h +++ b/src/plugins/platforms/wayland/global/qwaylandclientextension_p.h @@ -51,22 +51,20 @@ #include "qwaylandclientextension.h" #include #include -#include QT_BEGIN_NAMESPACE -class Q_WAYLAND_CLIENT_EXPORT QWaylandClientExtensionPrivate : public QObjectPrivate, public QtWayland::wl_registry +class Q_WAYLAND_CLIENT_EXPORT QWaylandClientExtensionPrivate : public QObjectPrivate { Q_DECLARE_PUBLIC(QWaylandClientExtension) public: QWaylandClientExtensionPrivate(); + static void handleRegistryGlobal(void *data, ::wl_registry *registry, uint32_t id, + const QString &interface, uint32_t version); QtWaylandClient::QWaylandIntegration *waylandIntegration; int version; bool active; - -protected: - void registry_global(uint32_t id, const QString &interfaceName, uint32_t version) Q_DECL_OVERRIDE; }; class Q_WAYLAND_CLIENT_EXPORT QWaylandClientExtensionTemplatePrivate : public QWaylandClientExtensionPrivate From e8d77c010107c3a5c378f703b17691c77d29e2d6 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Thu, 9 Jun 2016 11:59:06 +0200 Subject: [PATCH 0330/1507] Only resize when the cursor is actually on the window frame The previous code seems to have been written under the impression that QWindow::width() included frame margins, causing the resizing areas of the window decoration to be too large. Change-Id: Ia13f12afd88a4017d01853798226455b84290d01 Reviewed-by: Giulio Camuffo --- .../wayland/plugins/decorations/bradient/main.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp b/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp index ea298699385..3dd5c8b699a 100644 --- a/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp +++ b/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp @@ -359,11 +359,11 @@ bool QWaylandBradientDecoration::handleMouse(QWaylandInputDevice *inputDevice, c window()->setWindowState(Qt::WindowMinimized); } else if (local.y() <= margins().top()) { processMouseTop(inputDevice,local,b,mods); - } else if (local.y() > window()->height() - margins().bottom() + margins().top()) { + } else if (local.y() > window()->height() + margins().top()) { processMouseBottom(inputDevice,local,b,mods); } else if (local.x() <= margins().left()) { processMouseLeft(inputDevice,local,b,mods); - } else if (local.x() > window()->width() - margins().right() + margins().left()) { + } else if (local.x() > window()->width() + margins().left()) { processMouseRight(inputDevice,local,b,mods); } else { waylandWindow()->restoreMouseCursor(inputDevice); @@ -405,7 +405,7 @@ void QWaylandBradientDecoration::processMouseTop(QWaylandInputDevice *inputDevic //top left bit waylandWindow()->setMouseCursor(inputDevice, Qt::SizeFDiagCursor); startResize(inputDevice,WL_SHELL_SURFACE_RESIZE_TOP_LEFT,b); - } else if (local.x() > window()->width() - margins().right()) { + } else if (local.x() > window()->width() + margins().left()) { //top right bit waylandWindow()->setMouseCursor(inputDevice, Qt::SizeBDiagCursor); startResize(inputDevice,WL_SHELL_SURFACE_RESIZE_TOP_RIGHT,b); @@ -428,7 +428,7 @@ void QWaylandBradientDecoration::processMouseBottom(QWaylandInputDevice *inputDe //bottom left bit waylandWindow()->setMouseCursor(inputDevice, Qt::SizeBDiagCursor); startResize(inputDevice, WL_SHELL_SURFACE_RESIZE_BOTTOM_LEFT,b); - } else if (local.x() > window()->width() - margins().right()) { + } else if (local.x() > window()->width() + margins().left()) { //bottom right bit waylandWindow()->setMouseCursor(inputDevice, Qt::SizeFDiagCursor); startResize(inputDevice, WL_SHELL_SURFACE_RESIZE_BOTTOM_RIGHT,b); From 795378e64c006121a772f3c8597d7c3d02bcc965 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Thu, 23 Jun 2016 09:54:18 +0200 Subject: [PATCH 0331/1507] Add missing Q_DECL_OVERRIDEs to client classes. Change-Id: I10e550a25ce498bbeedc242ac73059cc6fdcef30 Reviewed-by: Pier Luigi Fiorini Reviewed-by: Giulio Camuffo --- .../qwaylandhardwareintegration_p.h | 4 +-- .../libhybris-egl-server/main.cpp | 2 +- .../platforms/wayland/qwaylandcursor_p.h | 8 ++--- .../wayland/qwaylandinputcontext_p.h | 2 +- .../platforms/wayland/qwaylandinputdevice_p.h | 2 +- .../platforms/wayland/qwaylandintegration_p.h | 32 +++++++++---------- .../wayland/qwaylandnativeinterface_p.h | 16 +++++----- .../platforms/wayland/qwaylandscreen_p.h | 16 +++++----- .../wayland/qwaylandshmbackingstore_p.h | 10 +++--- .../platforms/wayland/qwaylandshmwindow_p.h | 4 +-- .../platforms/wayland/qwaylandwindow_p.h | 22 ++++++------- .../qwaylandwindowmanagerintegration_p.h | 6 ++-- 12 files changed, 62 insertions(+), 62 deletions(-) diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandhardwareintegration_p.h b/src/plugins/platforms/wayland/hardwareintegration/qwaylandhardwareintegration_p.h index 466f0b20bbb..7ec7479790b 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandhardwareintegration_p.h +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandhardwareintegration_p.h @@ -63,8 +63,8 @@ public: QString serverBufferIntegration(); protected: - void hardware_integration_client_backend(const QString &name); - void hardware_integration_server_backend(const QString &name); + void hardware_integration_client_backend(const QString &name) Q_DECL_OVERRIDE; + void hardware_integration_server_backend(const QString &name) Q_DECL_OVERRIDE; private: QString m_client_buffer; diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/libhybris-egl-server/main.cpp b/src/plugins/platforms/wayland/plugins/hardwareintegration/libhybris-egl-server/main.cpp index e51c4bfb5cd..ad7eac7a68c 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/libhybris-egl-server/main.cpp +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/libhybris-egl-server/main.cpp @@ -43,7 +43,7 @@ class LibHybrisEglServerBufferPlugin : public QWaylandServerBufferIntegrationPlu Q_OBJECT Q_PLUGIN_METADATA(IID QWaylandServerBufferIntegrationFactoryInterface_iid FILE "libhybris-egl-server.json") public: - QWaylandServerBufferIntegration *create(const QString&, const QStringList&); + QWaylandServerBufferIntegration *create(const QString&, const QStringList&) Q_DECL_OVERRIDE; }; QWaylandServerBufferIntegration *LibHybrisEglServerBufferPlugin::create(const QString& system, const QStringList& paramList) diff --git a/src/plugins/platforms/wayland/qwaylandcursor_p.h b/src/plugins/platforms/wayland/qwaylandcursor_p.h index 9e06cf6265b..a3461441ca7 100644 --- a/src/plugins/platforms/wayland/qwaylandcursor_p.h +++ b/src/plugins/platforms/wayland/qwaylandcursor_p.h @@ -67,10 +67,10 @@ public: QWaylandCursor(QWaylandScreen *screen); ~QWaylandCursor(); - void changeCursor(QCursor *cursor, QWindow *window); - void pointerEvent(const QMouseEvent &event); - QPoint pos() const; - void setPos(const QPoint &pos); + void changeCursor(QCursor *cursor, QWindow *window) Q_DECL_OVERRIDE; + void pointerEvent(const QMouseEvent &event) Q_DECL_OVERRIDE; + QPoint pos() const Q_DECL_OVERRIDE; + void setPos(const QPoint &pos) Q_DECL_OVERRIDE; struct wl_cursor_image *cursorImage(Qt::CursorShape shape); QSharedPointer cursorBitmapImage(const QCursor *cursor); diff --git a/src/plugins/platforms/wayland/qwaylandinputcontext_p.h b/src/plugins/platforms/wayland/qwaylandinputcontext_p.h index 679baa497c7..f6ade8db7f1 100644 --- a/src/plugins/platforms/wayland/qwaylandinputcontext_p.h +++ b/src/plugins/platforms/wayland/qwaylandinputcontext_p.h @@ -77,7 +77,7 @@ protected: void text_input_commit_string(uint32_t serial, const QString &text) Q_DECL_OVERRIDE; void text_input_enter(wl_surface *surface) Q_DECL_OVERRIDE; void text_input_leave() Q_DECL_OVERRIDE; - void text_input_keysym(uint32_t serial, uint32_t time, uint32_t sym, uint32_t state, uint32_t modifiers); + void text_input_keysym(uint32_t serial, uint32_t time, uint32_t sym, uint32_t state, uint32_t modifiers) Q_DECL_OVERRIDE; private: QString m_commit; diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h index 508b67078d9..1df90292b50 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h +++ b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h @@ -222,7 +222,7 @@ public: void pointer_enter(uint32_t serial, struct wl_surface *surface, wl_fixed_t sx, wl_fixed_t sy) Q_DECL_OVERRIDE; - void pointer_leave(uint32_t time, struct wl_surface *surface); + void pointer_leave(uint32_t time, struct wl_surface *surface) Q_DECL_OVERRIDE; void pointer_motion(uint32_t time, wl_fixed_t sx, wl_fixed_t sy) Q_DECL_OVERRIDE; void pointer_button(uint32_t serial, uint32_t time, diff --git a/src/plugins/platforms/wayland/qwaylandintegration_p.h b/src/plugins/platforms/wayland/qwaylandintegration_p.h index 42bc287b5ad..987d80599f8 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration_p.h +++ b/src/plugins/platforms/wayland/qwaylandintegration_p.h @@ -66,37 +66,37 @@ public: QWaylandIntegration(); ~QWaylandIntegration(); - bool hasCapability(QPlatformIntegration::Capability cap) const; - QPlatformWindow *createPlatformWindow(QWindow *window) const; + bool hasCapability(QPlatformIntegration::Capability cap) const Q_DECL_OVERRIDE; + QPlatformWindow *createPlatformWindow(QWindow *window) const Q_DECL_OVERRIDE; #ifndef QT_NO_OPENGL - QPlatformOpenGLContext *createPlatformOpenGLContext(QOpenGLContext *context) const; + QPlatformOpenGLContext *createPlatformOpenGLContext(QOpenGLContext *context) const Q_DECL_OVERRIDE; #endif - QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const; + QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const Q_DECL_OVERRIDE; - QAbstractEventDispatcher *createEventDispatcher() const; - void initialize(); + QAbstractEventDispatcher *createEventDispatcher() const Q_DECL_OVERRIDE; + void initialize() Q_DECL_OVERRIDE; - QPlatformFontDatabase *fontDatabase() const; + QPlatformFontDatabase *fontDatabase() const Q_DECL_OVERRIDE; - QPlatformNativeInterface *nativeInterface() const; + QPlatformNativeInterface *nativeInterface() const Q_DECL_OVERRIDE; - QPlatformClipboard *clipboard() const; + QPlatformClipboard *clipboard() const Q_DECL_OVERRIDE; - QPlatformDrag *drag() const; + QPlatformDrag *drag() const Q_DECL_OVERRIDE; - QPlatformInputContext *inputContext() const; + QPlatformInputContext *inputContext() const Q_DECL_OVERRIDE; - QVariant styleHint(StyleHint hint) const; + QVariant styleHint(StyleHint hint) const Q_DECL_OVERRIDE; - QPlatformAccessibility *accessibility() const; + QPlatformAccessibility *accessibility() const Q_DECL_OVERRIDE; - QPlatformServices *services() const; + QPlatformServices *services() const Q_DECL_OVERRIDE; QWaylandDisplay *display() const; - QStringList themeNames() const; + QStringList themeNames() const Q_DECL_OVERRIDE; - QPlatformTheme *createPlatformTheme(const QString &name) const; + QPlatformTheme *createPlatformTheme(const QString &name) const Q_DECL_OVERRIDE; QWaylandInputDevice *createInputDevice(QWaylandDisplay *display, int version, uint32_t id); diff --git a/src/plugins/platforms/wayland/qwaylandnativeinterface_p.h b/src/plugins/platforms/wayland/qwaylandnativeinterface_p.h index 7050f975885..b4cb8fcb4e1 100644 --- a/src/plugins/platforms/wayland/qwaylandnativeinterface_p.h +++ b/src/plugins/platforms/wayland/qwaylandnativeinterface_p.h @@ -61,17 +61,17 @@ class Q_WAYLAND_CLIENT_EXPORT QWaylandNativeInterface : public QPlatformNativeIn { public: QWaylandNativeInterface(QWaylandIntegration *integration); - void *nativeResourceForIntegration(const QByteArray &resource); + void *nativeResourceForIntegration(const QByteArray &resource) Q_DECL_OVERRIDE; void *nativeResourceForWindow(const QByteArray &resourceString, - QWindow *window); + QWindow *window) Q_DECL_OVERRIDE; void *nativeResourceForScreen(const QByteArray &resourceString, - QScreen *screen); - void *nativeResourceForContext(const QByteArray &resource, QOpenGLContext *context); + QScreen *screen) Q_DECL_OVERRIDE; + void *nativeResourceForContext(const QByteArray &resource, QOpenGLContext *context) Q_DECL_OVERRIDE; - QVariantMap windowProperties(QPlatformWindow *window) const; - QVariant windowProperty(QPlatformWindow *window, const QString &name) const; - QVariant windowProperty(QPlatformWindow *window, const QString &name, const QVariant &defaultValue) const; - void setWindowProperty(QPlatformWindow *window, const QString &name, const QVariant &value); + QVariantMap windowProperties(QPlatformWindow *window) const Q_DECL_OVERRIDE; + QVariant windowProperty(QPlatformWindow *window, const QString &name) const Q_DECL_OVERRIDE; + QVariant windowProperty(QPlatformWindow *window, const QString &name, const QVariant &defaultValue) const Q_DECL_OVERRIDE; + void setWindowProperty(QPlatformWindow *window, const QString &name, const QVariant &value) Q_DECL_OVERRIDE; void emitWindowPropertyChanged(QPlatformWindow *window, const QString &name); diff --git a/src/plugins/platforms/wayland/qwaylandscreen_p.h b/src/plugins/platforms/wayland/qwaylandscreen_p.h index e3e1515d4fa..5cc11e8c5b5 100644 --- a/src/plugins/platforms/wayland/qwaylandscreen_p.h +++ b/src/plugins/platforms/wayland/qwaylandscreen_p.h @@ -66,25 +66,25 @@ public: void init(); QWaylandDisplay *display() const; - QRect geometry() const; - int depth() const; - QImage::Format format() const; + QRect geometry() const Q_DECL_OVERRIDE; + int depth() const Q_DECL_OVERRIDE; + QImage::Format format() const Q_DECL_OVERRIDE; QSizeF physicalSize() const Q_DECL_OVERRIDE; QDpi logicalDpi() const Q_DECL_OVERRIDE; QList virtualSiblings() const Q_DECL_OVERRIDE; - void setOrientationUpdateMask(Qt::ScreenOrientations mask); + void setOrientationUpdateMask(Qt::ScreenOrientations mask) Q_DECL_OVERRIDE; - Qt::ScreenOrientation orientation() const; + Qt::ScreenOrientation orientation() const Q_DECL_OVERRIDE; int scale() const; qreal devicePixelRatio() const Q_DECL_OVERRIDE; - qreal refreshRate() const; + qreal refreshRate() const Q_DECL_OVERRIDE; - QString name() const { return mOutputName; } + QString name() const Q_DECL_OVERRIDE { return mOutputName; } - QPlatformCursor *cursor() const; + QPlatformCursor *cursor() const Q_DECL_OVERRIDE; QWaylandCursor *waylandCursor() const { return mWaylandCursor; }; uint32_t outputId() const { return m_outputId; } diff --git a/src/plugins/platforms/wayland/qwaylandshmbackingstore_p.h b/src/plugins/platforms/wayland/qwaylandshmbackingstore_p.h index 8b58c0b5eda..8ad559187b9 100644 --- a/src/plugins/platforms/wayland/qwaylandshmbackingstore_p.h +++ b/src/plugins/platforms/wayland/qwaylandshmbackingstore_p.h @@ -66,7 +66,7 @@ public: QWaylandShmBuffer(QWaylandDisplay *display, const QSize &size, QImage::Format format, int scale = 1); ~QWaylandShmBuffer(); - QSize size() const { return mImage.size(); } + QSize size() const Q_DECL_OVERRIDE { return mImage.size(); } int scale() const Q_DECL_OVERRIDE { return int(mImage.devicePixelRatio()); } QImage *image() { return &mImage; } @@ -85,11 +85,11 @@ public: ~QWaylandShmBackingStore(); QPaintDevice *paintDevice(); - void flush(QWindow *window, const QRegion ®ion, const QPoint &offset); - void resize(const QSize &size, const QRegion &staticContents); + void flush(QWindow *window, const QRegion ®ion, const QPoint &offset) Q_DECL_OVERRIDE; + void resize(const QSize &size, const QRegion &staticContents) Q_DECL_OVERRIDE; void resize(const QSize &size); - void beginPaint(const QRegion &); - void endPaint(); + void beginPaint(const QRegion &) Q_DECL_OVERRIDE; + void endPaint() Q_DECL_OVERRIDE; void hidden(); QWaylandAbstractDecoration *windowDecoration() const; diff --git a/src/plugins/platforms/wayland/qwaylandshmwindow_p.h b/src/plugins/platforms/wayland/qwaylandshmwindow_p.h index a0a5edffd4a..ea903980d20 100644 --- a/src/plugins/platforms/wayland/qwaylandshmwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandshmwindow_p.h @@ -58,8 +58,8 @@ public: QWaylandShmWindow(QWindow *window); ~QWaylandShmWindow(); - WindowType windowType() const; - QSurfaceFormat format() const { return QSurfaceFormat(); } + WindowType windowType() const Q_DECL_OVERRIDE; + QSurfaceFormat format() const Q_DECL_OVERRIDE { return QSurfaceFormat(); } }; } diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index 6e271cc1066..c60891d49f0 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -104,16 +104,16 @@ public: ~QWaylandWindow(); virtual WindowType windowType() const = 0; - WId winId() const; - void setVisible(bool visible); - void setParent(const QPlatformWindow *parent); + WId winId() const Q_DECL_OVERRIDE; + void setVisible(bool visible) Q_DECL_OVERRIDE; + void setParent(const QPlatformWindow *parent) Q_DECL_OVERRIDE; - void setWindowTitle(const QString &title); + void setWindowTitle(const QString &title) Q_DECL_OVERRIDE; inline QIcon windowIcon() const; - void setWindowIcon(const QIcon &icon); + void setWindowIcon(const QIcon &icon) Q_DECL_OVERRIDE; - void setGeometry(const QRect &rect); + void setGeometry(const QRect &rect) Q_DECL_OVERRIDE; void configure(uint32_t edges, int32_t width, int32_t height); @@ -127,7 +127,7 @@ public: void waitForFrameSync(); - QMargins frameMargins() const; + QMargins frameMargins() const Q_DECL_OVERRIDE; static QWaylandWindow *fromWlSurface(::wl_surface *surface); @@ -136,11 +136,11 @@ public: QWaylandSubSurface *subSurfaceWindow() const; QWaylandScreen *screen() const { return mScreen; } - void handleContentOrientationChange(Qt::ScreenOrientation orientation); + void handleContentOrientationChange(Qt::ScreenOrientation orientation) Q_DECL_OVERRIDE; void setOrientationMask(Qt::ScreenOrientations mask); - void setWindowState(Qt::WindowState state); - void setWindowFlags(Qt::WindowFlags flags); + void setWindowState(Qt::WindowState state) Q_DECL_OVERRIDE; + void setWindowFlags(Qt::WindowFlags flags) Q_DECL_OVERRIDE; void raise() Q_DECL_OVERRIDE; void lower() Q_DECL_OVERRIDE; @@ -176,7 +176,7 @@ public: void doResize(); void setCanResize(bool canResize); - bool setMouseGrabEnabled(bool grab); + bool setMouseGrabEnabled(bool grab) Q_DECL_OVERRIDE; static QWaylandWindow *mouseGrab() { return mMouseGrab; } void sendProperty(const QString &name, const QVariant &value); diff --git a/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration_p.h b/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration_p.h index 73c1b29e8a6..7abad64db17 100644 --- a/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration_p.h @@ -71,10 +71,10 @@ public: explicit QWaylandWindowManagerIntegration(QWaylandDisplay *waylandDisplay); virtual ~QWaylandWindowManagerIntegration(); - QByteArray desktopEnvironment() const; + QByteArray desktopEnvironment() const Q_DECL_OVERRIDE; - bool openUrl(const QUrl &url); - bool openDocument(const QUrl &url); + bool openUrl(const QUrl &url) Q_DECL_OVERRIDE; + bool openDocument(const QUrl &url) Q_DECL_OVERRIDE; bool showIsFullScreen() const; From 261f31eacb4e475e80163e3c9d85bdbdc2ec99a1 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Mon, 20 Jun 2016 13:33:13 +0200 Subject: [PATCH 0332/1507] Remove unused method QWaylandDisplay::lastKeyboardFocusInputDevice Change-Id: Iee19b36ae2032112e0097dc6eb2e4592697c2a1c Reviewed-by: Pier Luigi Fiorini --- src/plugins/platforms/wayland/qwaylanddisplay.cpp | 11 ----------- src/plugins/platforms/wayland/qwaylanddisplay_p.h | 4 ---- src/plugins/platforms/wayland/qwaylandinputdevice.cpp | 1 - 3 files changed, 16 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index a6f52bc2432..4358bf69f6c 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -118,19 +118,8 @@ QWaylandWindowManagerIntegration *QWaylandDisplay::windowManagerIntegration() co return mWindowManagerIntegration.data(); } -QWaylandInputDevice *QWaylandDisplay::lastKeyboardFocusInputDevice() const -{ - return mLastKeyboardFocusInputDevice; -} - -void QWaylandDisplay::setLastKeyboardFocusInputDevice(QWaylandInputDevice *device) -{ - mLastKeyboardFocusInputDevice = device; -} - QWaylandDisplay::QWaylandDisplay(QWaylandIntegration *waylandIntegration) : mWaylandIntegration(waylandIntegration) - , mLastKeyboardFocusInputDevice(0) , mDndSelectionHandler(0) , mWindowExtension(0) , mSubCompositor(0) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay_p.h b/src/plugins/platforms/wayland/qwaylanddisplay_p.h index b53e0577a3b..adc012b53d8 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay_p.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay_p.h @@ -134,9 +134,6 @@ public: QWaylandInputDevice *defaultInputDevice() const; QWaylandInputDevice *currentInputDevice() const { return defaultInputDevice(); } - QWaylandInputDevice *lastKeyboardFocusInputDevice() const; - void setLastKeyboardFocusInputDevice(QWaylandInputDevice *device); - QWaylandDataDeviceManager *dndSelectionHandler() const { return mDndSelectionHandler.data(); } QtWayland::qt_surface_extension *windowExtension() const { return mWindowExtension.data(); } @@ -194,7 +191,6 @@ private: QList mInputDevices; QList mRegistryListeners; QWaylandIntegration *mWaylandIntegration; - QWaylandInputDevice *mLastKeyboardFocusInputDevice; QScopedPointer mDndSelectionHandler; QScopedPointer mWindowExtension; QScopedPointer mSubCompositor; diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index 9eda317b307..e2412eaa4a9 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -633,7 +633,6 @@ void QWaylandInputDevice::Keyboard::focusCallback(void *data, struct wl_callback self->mFocusCallback = 0; } - self->mParent->mQDisplay->setLastKeyboardFocusInputDevice(self->mFocus ? self->mParent : 0); QWindowSystemInterface::handleWindowActivated(self->mFocus ? self->mFocus->window() : 0); } From f213a7d54e3e9e67f8ad4dd5b3775e0c4469e81a Mon Sep 17 00:00:00 2001 From: Giulio Camuffo Date: Mon, 27 Jun 2016 11:17:57 +0200 Subject: [PATCH 0333/1507] Fix the key code of key events when control is pressed Change-Id: I51a57a32d8263e663a48dac15881d685359bc91d Reviewed-by: Jan Arne Petersen Reviewed-by: Pier Luigi Fiorini --- .../wayland/qwaylandinputcontext.cpp | 5 +-- .../platforms/wayland/qwaylandinputdevice.cpp | 3 +- .../platforms/wayland/shared/qwaylandxkb.cpp | 31 ++++++++----------- .../platforms/wayland/shared/qwaylandxkb_p.h | 5 +-- 4 files changed, 20 insertions(+), 24 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandinputcontext.cpp b/src/plugins/platforms/wayland/qwaylandinputcontext.cpp index 509965d2f1a..5a58d6d7509 100644 --- a/src/plugins/platforms/wayland/qwaylandinputcontext.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputcontext.cpp @@ -335,8 +335,9 @@ void QWaylandTextInput::zwp_text_input_v2_keysym(uint32_t time, uint32_t sym, ui Qt::KeyboardModifiers qtModifiers = modifiersToQtModifiers(modifiers); QEvent::Type type = QWaylandXkb::toQtEventType(state); - const QString &text = QWaylandXkb::textFromKeysym(sym, qtModifiers); - int qtkey = QWaylandXkb::keysymToQtKey(sym, qtModifiers, text); + QString text; + int qtkey; + std::tie(qtkey, text) = QWaylandXkb::keysymToQtKey(sym, qtModifiers); QWindowSystemInterface::handleKeyEvent(QGuiApplication::focusWindow(), time, type, qtkey, qtModifiers, text); diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index 613d517a3f0..13ab5efe6bf 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -707,8 +707,7 @@ void QWaylandInputDevice::Keyboard::keyboard_key(uint32_t serial, uint32_t time, Qt::KeyboardModifiers modifiers = mParent->modifiers(); - text = QWaylandXkb::textFromKeysym(sym, modifiers); - qtkey = QWaylandXkb::keysymToQtKey(sym, modifiers, text); + std::tie(qtkey, text) = QWaylandXkb::keysymToQtKey(sym, modifiers); sendKey(window->window(), time, type, qtkey, modifiers, code, sym, mNativeModifiers, text); #else diff --git a/src/plugins/platforms/wayland/shared/qwaylandxkb.cpp b/src/plugins/platforms/wayland/shared/qwaylandxkb.cpp index 499257009cf..2afdcce8a05 100644 --- a/src/plugins/platforms/wayland/shared/qwaylandxkb.cpp +++ b/src/plugins/platforms/wayland/shared/qwaylandxkb.cpp @@ -293,8 +293,13 @@ static xkb_keysym_t toKeysymFromTable(uint32_t key) return 0; } -int QWaylandXkb::keysymToQtKey(xkb_keysym_t keysym, Qt::KeyboardModifiers &modifiers, const QString &text) +std::pair QWaylandXkb::keysymToQtKey(xkb_keysym_t keysym, Qt::KeyboardModifiers &modifiers) { + QString text; + uint utf32 = xkb_keysym_to_utf32(keysym); + if (utf32) + text = QString::fromUcs4(&utf32, 1); + int code = 0; if (keysym >= XKB_KEY_F1 && keysym <= XKB_KEY_F35) { @@ -316,7 +321,13 @@ int QWaylandXkb::keysymToQtKey(xkb_keysym_t keysym, Qt::KeyboardModifiers &modif code = lookupKeysym(keysym); } - return code; + // Map control + letter to proper text + if (utf32 >= 'A' && utf32 <= '~' && (modifiers & Qt::ControlModifier)) { + utf32 &= ~0x60; + text = QString::fromUcs4(&utf32, 1); + } + + return { code, text }; } Qt::KeyboardModifiers QWaylandXkb::modifiers(struct xkb_state *state) @@ -342,22 +353,6 @@ QEvent::Type QWaylandXkb::toQtEventType(uint32_t state) return state != 0 ? QEvent::KeyPress : QEvent::KeyRelease; } -QString QWaylandXkb::textFromKeysym(uint32_t keysym, Qt::KeyboardModifiers modifiers) -{ - uint utf32 = xkb_keysym_to_utf32(keysym); - - // Map control + letter to proper text - if (utf32 >= 'A' && utf32 <= '~' && (modifiers & Qt::ControlModifier)) { - utf32 &= ~0x60; - return QString::fromUcs4(&utf32, 1); - } - - if (utf32) - return QString::fromUcs4(&utf32, 1); - - return QString(); -} - QVector QWaylandXkb::toKeysym(QKeyEvent *event) { QVector keysyms; diff --git a/src/plugins/platforms/wayland/shared/qwaylandxkb_p.h b/src/plugins/platforms/wayland/shared/qwaylandxkb_p.h index 9b5c935a5b5..cdebf1b08b0 100644 --- a/src/plugins/platforms/wayland/shared/qwaylandxkb_p.h +++ b/src/plugins/platforms/wayland/shared/qwaylandxkb_p.h @@ -47,6 +47,8 @@ #include #include +#include + QT_BEGIN_NAMESPACE class QKeyEvent; @@ -54,11 +56,10 @@ class QKeyEvent; class QWaylandXkb { public: - static int keysymToQtKey(xkb_keysym_t keysym, Qt::KeyboardModifiers &modifiers, const QString &text); + static std::pair keysymToQtKey(xkb_keysym_t keysym, Qt::KeyboardModifiers &modifiers); static Qt::KeyboardModifiers modifiers(struct xkb_state *state); static QEvent::Type toQtEventType(uint32_t state); - static QString textFromKeysym(uint32_t keysym, Qt::KeyboardModifiers modifiers); static QVector toKeysym(QKeyEvent *event); }; From d4d47f2a043f3e7548ba10c69fb54637511ba563 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Wed, 1 Jun 2016 16:23:23 +0200 Subject: [PATCH 0334/1507] Use xdg_shell configure events to determine active window According to the xdg_shell protocol, the compositor is allowed to set multiple active windows. Qt's model, however, allows only a single active window. In order to map between the models, a list of the compositor's active windows is kept in QWaylandDisplay in the order they were activated. Hence, the front of this list will always be the most recently activated window, and it will be mapped as Qt's active window. Previously keyboard focus was used to determine the active window, this method has been disabled for xdg_shell. Functionality for delaying the call to QWindowSystemInterface::handleWindowActivated has been moved from QWaylandInputDevice::Keyboard to QWaylandDisplay so the implementations can share the workaround. Task-number: QTBUG-53702 Change-Id: I878151f9c52ed09a8d6571c6208920436c3ca8fc Reviewed-by: Giulio Camuffo --- .../platforms/wayland/qwaylanddisplay.cpp | 69 +++++++++++++++++++ .../platforms/wayland/qwaylanddisplay_p.h | 13 ++++ .../platforms/wayland/qwaylandinputdevice.cpp | 34 +-------- .../platforms/wayland/qwaylandinputdevice_p.h | 4 -- .../platforms/wayland/qwaylandxdgsurface.cpp | 15 +++- .../platforms/wayland/qwaylandxdgsurface_p.h | 1 + 6 files changed, 100 insertions(+), 36 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index 4358bf69f6c..f6d86bb39ed 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -130,6 +130,8 @@ QWaylandDisplay::QWaylandDisplay(QWaylandIntegration *waylandIntegration) , mLastInputSerial(0) , mLastInputDevice(0) , mLastInputWindow(0) + , mLastKeyboardFocus(Q_NULLPTR) + , mSyncCallback(Q_NULLPTR) { qRegisterMetaType("uint32_t"); @@ -383,6 +385,73 @@ void QWaylandDisplay::setLastInputDevice(QWaylandInputDevice *device, uint32_t s mLastInputWindow = win; } +bool QWaylandDisplay::shellManagesActiveState() const +{ + //TODO: This should be part of a shell interface used by the shell protocol implementations + return mShellXdg; +} + +void QWaylandDisplay::handleWindowActivated(QWaylandWindow *window) +{ + if (mActiveWindows.contains(window)) + return; + + mActiveWindows.append(window); + requestWaylandSync(); +} + +void QWaylandDisplay::handleWindowDeactivated(QWaylandWindow *window) +{ + Q_ASSERT(!mActiveWindows.empty()); + + if (mActiveWindows.last() == window) + requestWaylandSync(); + + mActiveWindows.removeOne(window); +} + +void QWaylandDisplay::handleKeyboardFocusChanged(QWaylandInputDevice *inputDevice) +{ + QWaylandWindow *keyboardFocus = inputDevice->keyboardFocus(); + + if (!shellManagesActiveState() && mLastKeyboardFocus != keyboardFocus) { + if (keyboardFocus) + handleWindowActivated(keyboardFocus); + if (mLastKeyboardFocus) + handleWindowDeactivated(mLastKeyboardFocus); + } + mLastKeyboardFocus = inputDevice->keyboardFocus(); +} + +void QWaylandDisplay::handleWaylandSync() +{ + // This callback is used to set the window activation because we may get an activate/deactivate + // pair, and the latter one would be lost in the QWindowSystemInterface queue, if we issue the + // handleWindowActivated() calls immediately. + QWindow *activeWindow = mActiveWindows.empty() ? Q_NULLPTR : mActiveWindows.last()->window(); + if (activeWindow != QGuiApplication::focusWindow()) + QWindowSystemInterface::handleWindowActivated(activeWindow); +} + +const wl_callback_listener QWaylandDisplay::syncCallbackListener = { + [](void *data, struct wl_callback *callback, uint32_t time){ + Q_UNUSED(time); + wl_callback_destroy(callback); + QWaylandDisplay *display = static_cast(data); + display->mSyncCallback = Q_NULLPTR; + display->handleWaylandSync(); + } +}; + +void QWaylandDisplay::requestWaylandSync() +{ + if (mSyncCallback) + return; + + mSyncCallback = wl_display_sync(mDisplay); + wl_callback_add_listener(mSyncCallback, &syncCallbackListener, this); +} + } QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylanddisplay_p.h b/src/plugins/platforms/wayland/qwaylanddisplay_p.h index adc012b53d8..237be5b783f 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay_p.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay_p.h @@ -48,6 +48,7 @@ #include #include #include +#include #include @@ -168,6 +169,11 @@ public: QWaylandWindow *lastInputWindow() const; void setLastInputDevice(QWaylandInputDevice *device, uint32_t serial, QWaylandWindow *window); + bool shellManagesActiveState() const; + void handleWindowActivated(QWaylandWindow *window); + void handleWindowDeactivated(QWaylandWindow *window); + void handleKeyboardFocusChanged(QWaylandInputDevice *inputDevice); + public slots: void blockingReadEvents(); void flushRequests(); @@ -177,6 +183,9 @@ private: void exitWithError(); void checkError() const; + void handleWaylandSync(); + void requestWaylandSync(); + struct Listener { RegistryListener listener; void *data; @@ -207,6 +216,10 @@ private: uint32_t mLastInputSerial; QWaylandInputDevice *mLastInputDevice; QPointer mLastInputWindow; + QWaylandWindow *mLastKeyboardFocus; + QVector mActiveWindows; + struct wl_callback *mSyncCallback; + static const wl_callback_listener syncCallbackListener; void registry_global(uint32_t id, const QString &interface, uint32_t version) Q_DECL_OVERRIDE; void registry_global_remove(uint32_t id) Q_DECL_OVERRIDE; diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index e2412eaa4a9..5eaed9ea151 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -69,7 +69,6 @@ QWaylandInputDevice::Keyboard::Keyboard(QWaylandInputDevice *p) , mXkbMap(0) , mXkbState(0) #endif - , mFocusCallback(0) , mNativeModifiers(0) { connect(&mRepeatTimer, SIGNAL(timeout()), this, SLOT(repeatKey())); @@ -122,8 +121,6 @@ QWaylandInputDevice::Keyboard::~Keyboard() #endif if (mFocus) QWindowSystemInterface::handleWindowActivated(0); - if (mFocusCallback) - wl_callback_destroy(mFocusCallback); if (mParent->mVersion >= 3) wl_keyboard_release(object()); else @@ -591,10 +588,7 @@ void QWaylandInputDevice::Keyboard::keyboard_enter(uint32_t time, struct wl_surf QWaylandWindow *window = QWaylandWindow::fromWlSurface(surface); mFocus = window; - if (!mFocusCallback) { - mFocusCallback = wl_display_sync(mParent->mDisplay); - wl_callback_add_listener(mFocusCallback, &QWaylandInputDevice::Keyboard::callback, this); - } + mParent->mQDisplay->handleKeyboardFocusChanged(mParent); } void QWaylandInputDevice::Keyboard::keyboard_leave(uint32_t time, struct wl_surface *surface) @@ -609,33 +603,11 @@ void QWaylandInputDevice::Keyboard::keyboard_leave(uint32_t time, struct wl_surf mFocus = NULL; - // Use a callback to set the focus because we may get a leave/enter pair, and - // the latter one would be lost in the QWindowSystemInterface queue, if - // we issue the handleWindowActivated() calls immediately. - if (!mFocusCallback) { - mFocusCallback = wl_display_sync(mParent->mDisplay); - wl_callback_add_listener(mFocusCallback, &QWaylandInputDevice::Keyboard::callback, this); - } + mParent->mQDisplay->handleKeyboardFocusChanged(mParent); + mRepeatTimer.stop(); } -const wl_callback_listener QWaylandInputDevice::Keyboard::callback = { - QWaylandInputDevice::Keyboard::focusCallback -}; - -void QWaylandInputDevice::Keyboard::focusCallback(void *data, struct wl_callback *callback, uint32_t time) -{ - Q_UNUSED(time); - Q_UNUSED(callback); - QWaylandInputDevice::Keyboard *self = static_cast(data); - if (self->mFocusCallback) { - wl_callback_destroy(self->mFocusCallback); - self->mFocusCallback = 0; - } - - QWindowSystemInterface::handleWindowActivated(self->mFocus ? self->mFocus->window() : 0); -} - void QWaylandInputDevice::Keyboard::keyboard_key(uint32_t serial, uint32_t time, uint32_t key, uint32_t state) { QWaylandWindow *window = mFocus; diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h index 1df90292b50..e38ad2f8415 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h +++ b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h @@ -185,7 +185,6 @@ public: xkb_keymap *mXkbMap; xkb_state *mXkbState; #endif - struct wl_callback *mFocusCallback; uint32_t mNativeModifiers; int mRepeatKey; @@ -197,9 +196,6 @@ public: #endif QTimer mRepeatTimer; - static const wl_callback_listener callback; - static void focusCallback(void *data, struct wl_callback *callback, uint32_t time); - Qt::KeyboardModifiers modifiers() const; private slots: diff --git a/src/plugins/platforms/wayland/qwaylandxdgsurface.cpp b/src/plugins/platforms/wayland/qwaylandxdgsurface.cpp index 8852d2dfb81..bbda03dc3cc 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgsurface.cpp +++ b/src/plugins/platforms/wayland/qwaylandxdgsurface.cpp @@ -52,6 +52,7 @@ QWaylandXdgSurface::QWaylandXdgSurface(struct ::xdg_surface *xdg_surface, QWayla , m_maximized(false) , m_minimized(false) , m_fullscreen(false) + , m_active(false) , m_extendedWindow(Q_NULLPTR) { if (window->display()->windowExtension()) @@ -60,6 +61,9 @@ QWaylandXdgSurface::QWaylandXdgSurface(struct ::xdg_surface *xdg_surface, QWayla QWaylandXdgSurface::~QWaylandXdgSurface() { + if (m_active) + window()->display()->handleWindowDeactivated(m_window); + xdg_surface_destroy(object()); delete m_extendedWindow; } @@ -176,6 +180,7 @@ void QWaylandXdgSurface::xdg_surface_configure(int32_t width, int32_t height, st size_t numStates = states->size / sizeof(uint32_t); bool aboutToMaximize = false; bool aboutToFullScreen = false; + bool aboutToActivate = false; for (size_t i = 0; i < numStates; i++) { switch (state[i]) { @@ -189,13 +194,21 @@ void QWaylandXdgSurface::xdg_surface_configure(int32_t width, int32_t height, st m_normalSize = QSize(width, height); break; case XDG_SURFACE_STATE_ACTIVATED: - // TODO: here about the missing window activation + aboutToActivate = true; break; default: break; } } + if (!m_active && aboutToActivate) { + m_active = true; + window()->display()->handleWindowActivated(m_window); + } else if (m_active && !aboutToActivate) { + m_active = false; + window()->display()->handleWindowDeactivated(m_window); + } + if (!m_fullscreen && aboutToFullScreen) { if (!m_maximized) m_normalSize = m_window->window()->frameGeometry().size(); diff --git a/src/plugins/platforms/wayland/qwaylandxdgsurface_p.h b/src/plugins/platforms/wayland/qwaylandxdgsurface_p.h index d4380d25fbb..e367980b7fc 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgsurface_p.h +++ b/src/plugins/platforms/wayland/qwaylandxdgsurface_p.h @@ -106,6 +106,7 @@ private: bool m_maximized; bool m_minimized; bool m_fullscreen; + bool m_active; QSize m_normalSize; QMargins m_margins; QWaylandExtendedSurface *m_extendedWindow; From f4c3ad57b7a23086e4db17ad823d83fc5be791c2 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Fri, 8 Jul 2016 14:46:34 +0200 Subject: [PATCH 0335/1507] Fix high-DPI scaling of window decorations for shared memory buffers Change-Id: I6833ab86ffdb4e37dad5108baddb7a54cfb5e9fa Reviewed-by: Giulio Camuffo --- .../wayland/qwaylandshmbackingstore.cpp | 28 ++++++++++++------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp b/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp index 3bbe24c318c..5c93d2ba3d2 100644 --- a/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp +++ b/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp @@ -301,29 +301,37 @@ void QWaylandShmBackingStore::updateDecorations() QPainter decorationPainter(entireSurface()); decorationPainter.setCompositionMode(QPainter::CompositionMode_Source); QImage sourceImage = windowDecoration()->contentImage(); - QRect target; + + qreal dp = sourceImage.devicePixelRatio(); + int dpWidth = int(sourceImage.width() / dp); + int dpHeight = int(sourceImage.height() / dp); + QMatrix sourceMatrix; + sourceMatrix.scale(dp, dp); + QRect target; // needs to be in device independent pixels + //Top target.setX(0); target.setY(0); - target.setWidth(sourceImage.width()); + target.setWidth(dpWidth); target.setHeight(windowDecorationMargins().top()); - decorationPainter.drawImage(target, sourceImage, target); + decorationPainter.drawImage(target, sourceImage, sourceMatrix.mapRect(target)); //Left target.setWidth(windowDecorationMargins().left()); - target.setHeight(sourceImage.height()); - decorationPainter.drawImage(target, sourceImage, target); + target.setHeight(dpHeight); + decorationPainter.drawImage(target, sourceImage, sourceMatrix.mapRect(target)); //Right - target.setX(sourceImage.width() - windowDecorationMargins().right()); - decorationPainter.drawImage(target, sourceImage, target); + target.setX(dpWidth - windowDecorationMargins().right()); + target.setWidth(windowDecorationMargins().right()); + decorationPainter.drawImage(target, sourceImage, sourceMatrix.mapRect(target)); //Bottom target.setX(0); - target.setY(sourceImage.height() - windowDecorationMargins().bottom()); - target.setWidth(sourceImage.width()); + target.setY(dpHeight - windowDecorationMargins().bottom()); + target.setWidth(dpWidth); target.setHeight(windowDecorationMargins().bottom()); - decorationPainter.drawImage(target, sourceImage, target); + decorationPainter.drawImage(target, sourceImage, sourceMatrix.mapRect(target)); } QWaylandAbstractDecoration *QWaylandShmBackingStore::windowDecoration() const From cf1bf1b68471db4163d459e1930545f2bcbc4b66 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Fri, 1 Jul 2016 09:44:46 +0200 Subject: [PATCH 0336/1507] Compositor: Rename shm to sharedMemory sharedMemory is much clearer and will increase the readability of the code and API. Change-Id: Ibb6d7424fa8d44a94a0f4ddf476a564eb235323f Reviewed-by: Pier Luigi Fiorini --- src/plugins/platforms/wayland/qwaylandshm.cpp | 6 +++--- ...er_p.h => qwaylandsharedmemoryformathelper_p.h} | 14 +++++++------- 2 files changed, 10 insertions(+), 10 deletions(-) rename src/plugins/platforms/wayland/shared/{qwaylandshmformathelper_p.h => qwaylandsharedmemoryformathelper_p.h} (92%) diff --git a/src/plugins/platforms/wayland/qwaylandshm.cpp b/src/plugins/platforms/wayland/qwaylandshm.cpp index 790a0e1b99f..e94357bb586 100644 --- a/src/plugins/platforms/wayland/qwaylandshm.cpp +++ b/src/plugins/platforms/wayland/qwaylandshm.cpp @@ -39,7 +39,7 @@ #include #include -#include "qwaylandshmformathelper_p.h" +#include "qwaylandsharedmemoryformathelper_p.h" QT_BEGIN_NAMESPACE @@ -73,12 +73,12 @@ bool QWaylandShm::formatSupported(QImage::Format format) const wl_shm_format QWaylandShm::formatFrom(QImage::Format format) { - return QWaylandShmFormatHelper::fromQImageFormat(format); + return QWaylandSharedMemoryFormatHelper::fromQImageFormat(format); } QImage::Format QWaylandShm::formatFrom(wl_shm_format format) { - return QWaylandShmFormatHelper::fromWaylandShmFormat(format); + return QWaylandSharedMemoryFormatHelper::fromWaylandShmFormat(format); } } diff --git a/src/plugins/platforms/wayland/shared/qwaylandshmformathelper_p.h b/src/plugins/platforms/wayland/shared/qwaylandsharedmemoryformathelper_p.h similarity index 92% rename from src/plugins/platforms/wayland/shared/qwaylandshmformathelper_p.h rename to src/plugins/platforms/wayland/shared/qwaylandsharedmemoryformathelper_p.h index 58db42e26f2..7f2f77cc3c8 100644 --- a/src/plugins/platforms/wayland/shared/qwaylandshmformathelper_p.h +++ b/src/plugins/platforms/wayland/shared/qwaylandsharedmemoryformathelper_p.h @@ -37,8 +37,8 @@ ** ****************************************************************************/ -#ifndef QWAYLANDSHMFORMATHELPER_H -#define QWAYLANDSHMFORMATHELPER_H +#ifndef QWAYLANDSHAREDMEMORYFORMATHELPER_H +#define QWAYLANDSHAREDMEMORYFORMATHELPER_H #include @@ -47,7 +47,7 @@ QT_BEGIN_NAMESPACE -class QWaylandShmFormatHelper +class QWaylandSharedMemoryFormatHelper { public: static inline wl_shm_format fromQImageFormat(QImage::Format format); @@ -100,7 +100,7 @@ private: } }; -wl_shm_format QWaylandShmFormatHelper::fromQImageFormat(QImage::Format format) +wl_shm_format QWaylandSharedMemoryFormatHelper::fromQImageFormat(QImage::Format format) { Array array = getData(); if (array.size <= size_t(format)) @@ -108,7 +108,7 @@ wl_shm_format QWaylandShmFormatHelper::fromQImageFormat(QImage::Format format) return array.data[format]; } -QImage::Format QWaylandShmFormatHelper::fromWaylandShmFormat(wl_shm_format format) +QImage::Format QWaylandSharedMemoryFormatHelper::fromWaylandShmFormat(wl_shm_format format) { Array array = getData(); for (size_t i = 0; i < array.size; i++) { @@ -118,7 +118,7 @@ QImage::Format QWaylandShmFormatHelper::fromWaylandShmFormat(wl_shm_format forma return QImage::Format_Invalid; } -QVector QWaylandShmFormatHelper::supportedWaylandFormats() +QVector QWaylandSharedMemoryFormatHelper::supportedWaylandFormats() { QVector retFormats; Array array = getData(); @@ -133,4 +133,4 @@ QVector QWaylandShmFormatHelper::supportedWaylandFormats() QT_END_NAMESPACE -#endif //QWAYLANDSHMFORMATHELPER_H +#endif //QWAYLANDSHAREDMEMORYFORMATHELPER_H From 84aec97c835752d0243266e97e2093ce84d0a685 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Mon, 11 Jul 2016 11:38:50 +0200 Subject: [PATCH 0337/1507] Fix clang compilation errors Adds missing overrides and removes a private header generated by wayland-scanner from the public API. Change-Id: I53fc3f8bacca41821f0531aae02ca2a5da758e13 Reviewed-by: Giulio Camuffo --- .../platforms/wayland/global/qwaylandclientextension.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/global/qwaylandclientextension.h b/src/plugins/platforms/wayland/global/qwaylandclientextension.h index 9ff45ea00d0..afb3f868fba 100644 --- a/src/plugins/platforms/wayland/global/qwaylandclientextension.h +++ b/src/plugins/platforms/wayland/global/qwaylandclientextension.h @@ -39,7 +39,9 @@ #include #include -#include + +struct wl_registry; + QT_BEGIN_NAMESPACE namespace QtWaylandClient { From 63d716543cd95fcfbb1111c3f34b259664b23b37 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Wed, 13 Jul 2016 11:00:54 +0200 Subject: [PATCH 0338/1507] Fix wrong path to qwaylandsharedmemoryformathelper_p.h Change-Id: I711536ea8c7ec167e531afe61e716e0081d2aab6 Reviewed-by: Giulio Camuffo --- src/plugins/platforms/wayland/client.pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/client.pro b/src/plugins/platforms/wayland/client.pro index f0142c9a5b3..c8a8471b44d 100644 --- a/src/plugins/platforms/wayland/client.pro +++ b/src/plugins/platforms/wayland/client.pro @@ -110,7 +110,7 @@ HEADERS += qwaylandintegration_p.h \ ../shared/qwaylandinputmethodeventbuilder_p.h \ ../shared/qwaylandmimehelper_p.h \ ../shared/qwaylandxkb_p.h \ - ../shared/qwaylandshmformathelper_p.h + ../shared/qwaylandsharedmemoryformathelper_p.h include(hardwareintegration/hardwareintegration.pri) include(shellintegration/shellintegration.pri) From 2e6e785ca4d39cfd5b15453c2bf83a602776505f Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Fri, 24 Jun 2016 12:45:48 +0200 Subject: [PATCH 0339/1507] Compile with -no-opengl QtWayland has not compiled without OpenGL for a while. This patch fixes the compilation issues and removes the old config variable, "QT_WAYLAND_GL_CONFIG" and instead checks for the presence of "opengl" in "QT_CONFIG". A new define is also introduced, QT_WAYLAND_COMPOSITOR_QUICK, because it may eventually be possible to use create a QtQuick compositor without OpenGL. Task-number: QTBUG-54322 Change-Id: Ica7b3b320212d4ae1f8b1053725b73c83739c73c Reviewed-by: Giulio Camuffo --- src/plugins/platforms/wayland/client.pro | 2 +- src/plugins/platforms/wayland/qwaylandnativeinterface.cpp | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/client.pro b/src/plugins/platforms/wayland/client.pro index c8a8471b44d..63012c127d3 100644 --- a/src/plugins/platforms/wayland/client.pro +++ b/src/plugins/platforms/wayland/client.pro @@ -10,7 +10,7 @@ QMAKE_CXXFLAGS_WARN_ON -= -Wcast-qual CONFIG -= precompile_header CONFIG += link_pkgconfig qpa/genericunixfontdatabase wayland-scanner -!equals(QT_WAYLAND_GL_CONFIG, nogl) { +contains(QT_CONFIG, opengl) { DEFINES += QT_WAYLAND_GL_SUPPORT } diff --git a/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp b/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp index bad64204b29..be639ce1595 100644 --- a/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp +++ b/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp @@ -117,6 +117,7 @@ void *QWaylandNativeInterface::nativeResourceForScreen(const QByteArray &resourc void *QWaylandNativeInterface::nativeResourceForContext(const QByteArray &resource, QOpenGLContext *context) { +#ifdef QT_WAYLAND_GL_SUPPORT QByteArray lowerCaseResource = resource.toLower(); if (lowerCaseResource == "eglconfig" && m_integration->clientBufferIntegration()) @@ -127,6 +128,7 @@ void *QWaylandNativeInterface::nativeResourceForContext(const QByteArray &resour if (lowerCaseResource == "egldisplay" && m_integration->clientBufferIntegration()) return m_integration->clientBufferIntegration()->nativeResourceForContext(QWaylandClientBufferIntegration::EglDisplay, context->handle()); +#endif return 0; } From 5bfd57f7d5a1715a5ec87616a22e5cc003426509 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Fri, 29 Jul 2016 15:54:08 +0200 Subject: [PATCH 0340/1507] Also test touch in client events test Following the same pattern as for mouse and keyboard, also test touch events. Change-Id: Ie84aa0ffe0b0f4f66e9f40207c63d94e32f6dbaf Reviewed-by: Paul Olav Tvete --- tests/auto/wayland/mockcompositor.cpp | 29 ++++++++ tests/auto/wayland/mockcompositor.h | 10 +++ tests/auto/wayland/mockinput.cpp | 95 ++++++++++++++++++++++++++- tests/auto/wayland/mockinput.h | 15 +++++ tests/auto/wayland/tst_client.cpp | 16 +++++ 5 files changed, 164 insertions(+), 1 deletion(-) diff --git a/tests/auto/wayland/mockcompositor.cpp b/tests/auto/wayland/mockcompositor.cpp index 2f73734f181..68245226286 100644 --- a/tests/auto/wayland/mockcompositor.cpp +++ b/tests/auto/wayland/mockcompositor.cpp @@ -122,6 +122,34 @@ void MockCompositor::sendKeyRelease(const QSharedPointer &surface, processCommand(command); } +void MockCompositor::sendTouchDown(const QSharedPointer &surface, const QPoint &position, int id) +{ + Command command = makeCommand(Impl::Compositor::sendTouchDown, m_compositor); + command.parameters << QVariant::fromValue(surface) << position << id; + processCommand(command); +} + +void MockCompositor::sendTouchMotion(const QSharedPointer &surface, const QPoint &position, int id) +{ + Command command = makeCommand(Impl::Compositor::sendTouchMotion, m_compositor); + command.parameters << QVariant::fromValue(surface) << position << id; + processCommand(command); +} + +void MockCompositor::sendTouchUp(const QSharedPointer &surface, int id) +{ + Command command = makeCommand(Impl::Compositor::sendTouchUp, m_compositor); + command.parameters << QVariant::fromValue(surface) << id; + processCommand(command); +} + +void MockCompositor::sendTouchFrame(const QSharedPointer &surface) +{ + Command command = makeCommand(Impl::Compositor::sendTouchFrame, m_compositor); + command.parameters << QVariant::fromValue(surface); + processCommand(command); +} + QSharedPointer MockCompositor::surface() { QSharedPointer result; @@ -208,6 +236,7 @@ Compositor::Compositor() m_seat.reset(new Seat(this, m_display)); m_pointer = m_seat->pointer(); m_keyboard = m_seat->keyboard(); + m_touch = m_seat->touch(); wl_display_add_global(m_display, &wl_output_interface, this, bindOutput); wl_display_add_global(m_display, &wl_shell_interface, this, bindShell); diff --git a/tests/auto/wayland/mockcompositor.h b/tests/auto/wayland/mockcompositor.h index cf3b270a28c..8731949c0d3 100644 --- a/tests/auto/wayland/mockcompositor.h +++ b/tests/auto/wayland/mockcompositor.h @@ -52,6 +52,7 @@ typedef void (**Implementation)(void); class Keyboard; class Pointer; +class Touch; class Seat; class DataDeviceManager; class Surface; @@ -80,6 +81,10 @@ public: static void sendMouseRelease(void *data, const QList ¶meters); static void sendKeyPress(void *data, const QList ¶meters); static void sendKeyRelease(void *data, const QList ¶meters); + static void sendTouchDown(void *data, const QList ¶meters); + static void sendTouchUp(void *data, const QList ¶meters); + static void sendTouchMotion(void *data, const QList ¶meters); + static void sendTouchFrame(void *data, const QList ¶meters); private: static void bindCompositor(wl_client *client, void *data, uint32_t version, uint32_t id); @@ -104,6 +109,7 @@ private: QScopedPointer m_seat; Pointer *m_pointer; Keyboard *m_keyboard; + Touch *m_touch; QScopedPointer m_data_device_manager; QVector m_surfaces; }; @@ -146,6 +152,10 @@ public: void sendMouseRelease(const QSharedPointer &surface); void sendKeyPress(const QSharedPointer &surface, uint code); void sendKeyRelease(const QSharedPointer &surface, uint code); + void sendTouchDown(const QSharedPointer &surface, const QPoint &position, int id); + void sendTouchMotion(const QSharedPointer &surface, const QPoint &position, int id); + void sendTouchUp(const QSharedPointer &surface, int id); + void sendTouchFrame(const QSharedPointer &surface); QSharedPointer surface(); diff --git a/tests/auto/wayland/mockinput.cpp b/tests/auto/wayland/mockinput.cpp index 5b1d4f4fda4..dd0512e76e6 100644 --- a/tests/auto/wayland/mockinput.cpp +++ b/tests/auto/wayland/mockinput.cpp @@ -92,11 +92,64 @@ void Compositor::sendKeyRelease(void *data, const QList ¶meters) compositor->m_keyboard->sendKey(parameters.last().toUInt() - 8, 0); } +void Compositor::sendTouchDown(void *data, const QList ¶meters) +{ + Compositor *compositor = static_cast(data); + Surface *surface = resolveSurface(parameters.first()); + + Q_ASSERT(compositor); + Q_ASSERT(surface); + + QPoint position = parameters.at(1).toPoint(); + int id = parameters.at(2).toInt(); + + compositor->m_touch->sendDown(surface, position, id); +} + +void Compositor::sendTouchUp(void *data, const QList ¶meters) +{ + Compositor *compositor = static_cast(data); + Surface *surface = resolveSurface(parameters.first()); + + Q_ASSERT(compositor); + Q_ASSERT(surface); + + int id = parameters.at(1).toInt(); + + compositor->m_touch->sendUp(surface, id); +} + +void Compositor::sendTouchMotion(void *data, const QList ¶meters) +{ + Compositor *compositor = static_cast(data); + Surface *surface = resolveSurface(parameters.first()); + + Q_ASSERT(compositor); + Q_ASSERT(surface); + + QPoint position = parameters.at(1).toPoint(); + int id = parameters.at(2).toInt(); + + compositor->m_touch->sendMotion(surface, position, id); +} + +void Compositor::sendTouchFrame(void *data, const QList ¶meters) +{ + Compositor *compositor = static_cast(data); + Surface *surface = resolveSurface(parameters.first()); + + Q_ASSERT(compositor); + Q_ASSERT(surface); + + compositor->m_touch->sendFrame(surface); +} + Seat::Seat(Compositor *compositor, struct ::wl_display *display) : wl_seat(display, 2) , m_compositor(compositor) , m_keyboard(new Keyboard(compositor)) , m_pointer(new Pointer(compositor)) + , m_touch(new Touch(compositor)) { } @@ -106,7 +159,7 @@ Seat::~Seat() void Seat::seat_bind_resource(Resource *resource) { - send_capabilities(resource->handle, capability_keyboard | capability_pointer); + send_capabilities(resource->handle, capability_keyboard | capability_pointer | capability_touch); } void Seat::seat_get_keyboard(Resource *resource, uint32_t id) @@ -119,6 +172,11 @@ void Seat::seat_get_pointer(Resource *resource, uint32_t id) m_pointer->add(resource->client(), id, resource->version()); } +void Seat::seat_get_touch(Resource *resource, uint32_t id) +{ + m_touch->add(resource->client(), id, resource->version()); +} + Keyboard::Keyboard(Compositor *compositor) : wl_keyboard() , m_compositor(compositor) @@ -219,6 +277,41 @@ void Pointer::pointer_destroy_resource(wl_pointer::Resource *resource) m_focusResource = 0; } +Touch::Touch(Compositor *compositor) + : wl_touch() + , m_compositor(compositor) +{ +} + +void Touch::sendDown(Surface *surface, const QPoint &position, int id) +{ + uint32_t serial = m_compositor->nextSerial(); + uint32_t time = m_compositor->time(); + Q_ASSERT(surface); + Resource *resource = resourceMap().value(surface->resource()->client()); + Q_ASSERT(resource); + wl_touch_send_down(resource->handle, serial, time, surface->resource()->handle, id, position.x(), position.y()); +} + +void Touch::sendUp(Surface *surface, int id) +{ + Resource *resource = resourceMap().value(surface->resource()->client()); + wl_touch_send_up(resource->handle, m_compositor->nextSerial(), m_compositor->time(), id); +} + +void Touch::sendMotion(Surface *surface, const QPoint &position, int id) +{ + Resource *resource = resourceMap().value(surface->resource()->client()); + uint32_t time = m_compositor->time(); + wl_touch_send_motion(resource->handle, time, id, position.x(), position.y()); +} + +void Touch::sendFrame(Surface *surface) +{ + Resource *resource = resourceMap().value(surface->resource()->client()); + wl_touch_send_frame(resource->handle); +} + DataDevice::DataDevice(Compositor *compositor) : wl_data_device() , m_compositor(compositor) diff --git a/tests/auto/wayland/mockinput.h b/tests/auto/wayland/mockinput.h index 7d36a532594..61c507077fe 100644 --- a/tests/auto/wayland/mockinput.h +++ b/tests/auto/wayland/mockinput.h @@ -56,17 +56,20 @@ public: Keyboard *keyboard() const { return m_keyboard.data(); } Pointer *pointer() const { return m_pointer.data(); } + Touch *touch() const { return m_touch.data(); } protected: void seat_bind_resource(Resource *resource) Q_DECL_OVERRIDE; void seat_get_keyboard(Resource *resource, uint32_t id) Q_DECL_OVERRIDE; void seat_get_pointer(Resource *resource, uint32_t id) Q_DECL_OVERRIDE; + void seat_get_touch(Resource *resource, uint32_t id) Q_DECL_OVERRIDE; private: Compositor *m_compositor; QScopedPointer m_keyboard; QScopedPointer m_pointer; + QScopedPointer m_touch; }; class Keyboard : public QtWaylandServer::wl_keyboard @@ -112,6 +115,18 @@ private: Surface *m_focus; }; +class Touch : public QtWaylandServer::wl_touch +{ +public: + Touch(Compositor *compositor); + void sendDown(Surface *surface, const QPoint &position, int id); + void sendUp(Surface *surface, int id); + void sendMotion(Surface *surface, const QPoint &position, int id); + void sendFrame(Surface *surface); +private: + Compositor *m_compositor; +}; + class DataDevice : public QtWaylandServer::wl_data_device { public: diff --git a/tests/auto/wayland/tst_client.cpp b/tests/auto/wayland/tst_client.cpp index dd35b681cfb..3fde258d193 100644 --- a/tests/auto/wayland/tst_client.cpp +++ b/tests/auto/wayland/tst_client.cpp @@ -51,6 +51,7 @@ public: , keyReleaseEventCount(0) , mousePressEventCount(0) , mouseReleaseEventCount(0) + , touchEventCount(0) , keyCode(0) { setSurfaceType(QSurface::RasterSurface); @@ -91,12 +92,18 @@ public: ++mouseReleaseEventCount; } + void touchEvent(QTouchEvent *event) Q_DECL_OVERRIDE + { + ++touchEventCount; + } + int focusInEventCount; int focusOutEventCount; int keyPressEventCount; int keyReleaseEventCount; int mousePressEventCount; int mouseReleaseEventCount; + int touchEventCount; uint keyCode; QPoint mousePressPos; @@ -197,6 +204,15 @@ void tst_WaylandClient::events() QCOMPARE(window.mouseReleaseEventCount, 0); compositor->sendMouseRelease(surface); QTRY_COMPARE(window.mouseReleaseEventCount, 1); + + const int touchId = 0; + compositor->sendTouchDown(surface, QPoint(10, 10), touchId); + compositor->sendTouchFrame(surface); + QTRY_COMPARE(window.touchEventCount, 1); + + compositor->sendTouchUp(surface, touchId); + compositor->sendTouchFrame(surface); + QTRY_COMPARE(window.touchEventCount, 2); } void tst_WaylandClient::backingStore() From 17b2417157c1b53698a7514846fd9c6d53907c8b Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Fri, 29 Jul 2016 15:46:52 +0200 Subject: [PATCH 0341/1507] Remove logging of drag-and-drop data Change-Id: Ic66faf02f7d4eb82aa898a2858a0271a007460a0 Reviewed-by: Pier Luigi Fiorini --- src/plugins/platforms/wayland/qwaylanddatadevice.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylanddatadevice.cpp b/src/plugins/platforms/wayland/qwaylanddatadevice.cpp index d1c755e37e6..8130578b540 100644 --- a/src/plugins/platforms/wayland/qwaylanddatadevice.cpp +++ b/src/plugins/platforms/wayland/qwaylanddatadevice.cpp @@ -55,8 +55,6 @@ #include #include -#include - QT_BEGIN_NAMESPACE namespace QtWaylandClient { @@ -128,8 +126,6 @@ void QWaylandDataDevice::data_device_drop() { QDrag *drag = static_cast(QGuiApplicationPrivate::platformIntegration()->drag())->currentDrag(); - qDebug() << Q_FUNC_INFO << drag << m_dragOffer.data(); - QMimeData *dragData = 0; Qt::DropActions supportedActions; if (drag) { From 8184ff6bfb57284eac733bc4f4cefa8a998b61de Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Fri, 29 Jul 2016 15:46:25 +0200 Subject: [PATCH 0342/1507] Client tests: Unlock mutex while processing compositor commands Only lock the client autotest compositor mutex when necessary. This allows compositor commands to be queued while a command is being processed. Change-Id: Ib2ca6b4942f57f56f56a055cbe6ce6d876695529 Reviewed-by: Paul Olav Tvete --- tests/auto/wayland/mockcompositor.cpp | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/tests/auto/wayland/mockcompositor.cpp b/tests/auto/wayland/mockcompositor.cpp index 68245226286..7eb683191ec 100644 --- a/tests/auto/wayland/mockcompositor.cpp +++ b/tests/auto/wayland/mockcompositor.cpp @@ -185,9 +185,16 @@ void MockCompositor::processCommand(const Command &command) void MockCompositor::dispatchCommands() { - foreach (const Command &command, m_commandQueue) + lock(); + int count = m_commandQueue.length(); + unlock(); + + for (int i = 0; i < count; ++i) { + lock(); + const Command command = m_commandQueue.takeFirst(); + unlock(); command.callback(command.target, command.parameters); - m_commandQueue.clear(); + } } void *MockCompositor::run(void *data) @@ -205,8 +212,11 @@ void *MockCompositor::run(void *data) } while (controller->m_alive) { - QMutexLocker locker(&controller->m_mutex); - controller->m_waitCondition.wait(&controller->m_mutex); + { + QMutexLocker locker(&controller->m_mutex); + if (controller->m_commandQueue.isEmpty()) + controller->m_waitCondition.wait(&controller->m_mutex); + } controller->dispatchCommands(); compositor.dispatchEvents(20); } From 1e36cce9fec8c452ec98ea950f5ea69494f13872 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Mon, 1 Aug 2016 09:43:59 +0200 Subject: [PATCH 0343/1507] Fix crash when dragging with touch without first having pointer focus Also add drag-and-drop tests for both touch and mouse. Task-number: QTBUG-54756 Change-Id: Ibfff48b1f2377022a8624e28e9f638076187ddca Reviewed-by: Paul Olav Tvete --- .../platforms/wayland/qwaylanddatadevice.cpp | 3 + tests/auto/wayland/mockcompositor.cpp | 42 ++++++ tests/auto/wayland/mockcompositor.h | 15 +++ tests/auto/wayland/mockinput.cpp | 121 ++++++++++++++++++ tests/auto/wayland/mockinput.h | 18 +++ tests/auto/wayland/tst_client.cpp | 86 +++++++++++++ 6 files changed, 285 insertions(+) diff --git a/src/plugins/platforms/wayland/qwaylanddatadevice.cpp b/src/plugins/platforms/wayland/qwaylanddatadevice.cpp index 8130578b540..255b13f4c69 100644 --- a/src/plugins/platforms/wayland/qwaylanddatadevice.cpp +++ b/src/plugins/platforms/wayland/qwaylanddatadevice.cpp @@ -107,7 +107,10 @@ void QWaylandDataDevice::startDrag(QMimeData *mimeData, QWaylandWindow *icon) { m_dragSource.reset(new QWaylandDataSource(m_display->dndSelectionHandler(), mimeData)); connect(m_dragSource.data(), &QWaylandDataSource::cancelled, this, &QWaylandDataDevice::dragSourceCancelled); + QWaylandWindow *origin = m_display->currentInputDevice()->pointerFocus(); + if (!origin) + origin = m_display->currentInputDevice()->touchFocus(); start_drag(m_dragSource->object(), origin->object(), icon->object(), m_display->currentInputDevice()->serial()); } diff --git a/tests/auto/wayland/mockcompositor.cpp b/tests/auto/wayland/mockcompositor.cpp index 7eb683191ec..83dd52ba224 100644 --- a/tests/auto/wayland/mockcompositor.cpp +++ b/tests/auto/wayland/mockcompositor.cpp @@ -150,6 +150,47 @@ void MockCompositor::sendTouchFrame(const QSharedPointer &surface) processCommand(command); } +void MockCompositor::sendDataDeviceDataOffer(const QSharedPointer &surface) +{ + Command command = makeCommand(Impl::Compositor::sendDataDeviceDataOffer, m_compositor); + command.parameters << QVariant::fromValue(surface); + processCommand(command); +} + +void MockCompositor::sendDataDeviceEnter(const QSharedPointer &surface, const QPoint& position) +{ + Command command = makeCommand(Impl::Compositor::sendDataDeviceEnter, m_compositor); + command.parameters << QVariant::fromValue(surface) << QVariant::fromValue(position); + processCommand(command); +} + +void MockCompositor::sendDataDeviceMotion(const QPoint &position) +{ + Command command = makeCommand(Impl::Compositor::sendDataDeviceMotion, m_compositor); + command.parameters << QVariant::fromValue(position); + processCommand(command); +} + +void MockCompositor::sendDataDeviceDrop(const QSharedPointer &surface) +{ + Command command = makeCommand(Impl::Compositor::sendDataDeviceDrop, m_compositor); + command.parameters << QVariant::fromValue(surface); + processCommand(command); +} + +void MockCompositor::sendDataDeviceLeave(const QSharedPointer &surface) +{ + Command command = makeCommand(Impl::Compositor::sendDataDeviceLeave, m_compositor); + command.parameters << QVariant::fromValue(surface); + processCommand(command); +} + +void MockCompositor::waitForStartDrag() +{ + Command command = makeCommand(Impl::Compositor::waitForStartDrag, m_compositor); + processCommand(command); +} + QSharedPointer MockCompositor::surface() { QSharedPointer result; @@ -228,6 +269,7 @@ namespace Impl { Compositor::Compositor() : m_display(wl_display_create()) + , m_startDragSeen(false) , m_time(0) { wl_list_init(&m_outputResources); diff --git a/tests/auto/wayland/mockcompositor.h b/tests/auto/wayland/mockcompositor.h index 8731949c0d3..2f0df4a0fb1 100644 --- a/tests/auto/wayland/mockcompositor.h +++ b/tests/auto/wayland/mockcompositor.h @@ -85,6 +85,15 @@ public: static void sendTouchUp(void *data, const QList ¶meters); static void sendTouchMotion(void *data, const QList ¶meters); static void sendTouchFrame(void *data, const QList ¶meters); + static void sendDataDeviceDataOffer(void *data, const QList ¶meters); + static void sendDataDeviceEnter(void *data, const QList ¶meters); + static void sendDataDeviceMotion(void *data, const QList ¶meters); + static void sendDataDeviceDrop(void *data, const QList ¶meters); + static void sendDataDeviceLeave(void *data, const QList ¶meters); + static void waitForStartDrag(void *data, const QList ¶meters); + +public: + bool m_startDragSeen; private: static void bindCompositor(wl_client *client, void *data, uint32_t version, uint32_t id); @@ -156,6 +165,12 @@ public: void sendTouchMotion(const QSharedPointer &surface, const QPoint &position, int id); void sendTouchUp(const QSharedPointer &surface, int id); void sendTouchFrame(const QSharedPointer &surface); + void sendDataDeviceDataOffer(const QSharedPointer &surface); + void sendDataDeviceEnter(const QSharedPointer &surface, const QPoint &position); + void sendDataDeviceMotion(const QPoint &position); + void sendDataDeviceDrop(const QSharedPointer &surface); + void sendDataDeviceLeave(const QSharedPointer &surface); + void waitForStartDrag(); QSharedPointer surface(); diff --git a/tests/auto/wayland/mockinput.cpp b/tests/auto/wayland/mockinput.cpp index dd0512e76e6..05df8604b80 100644 --- a/tests/auto/wayland/mockinput.cpp +++ b/tests/auto/wayland/mockinput.cpp @@ -144,6 +144,70 @@ void Compositor::sendTouchFrame(void *data, const QList ¶meters) compositor->m_touch->sendFrame(surface); } +void Compositor::sendDataDeviceDataOffer(void *data, const QList ¶meters) +{ + Compositor *compositor = static_cast(data); + Surface *surface = resolveSurface(parameters.first()); + + Q_ASSERT(compositor); + Q_ASSERT(surface); + + compositor->m_data_device_manager->dataDevice()->sendDataOffer(surface->resource()->client()); +} + +void Compositor::sendDataDeviceEnter(void *data, const QList ¶meters) +{ + Compositor *compositor = static_cast(data); + Surface *surface = resolveSurface(parameters.first()); + QPoint position = parameters.at(1).toPoint(); + + Q_ASSERT(compositor); + Q_ASSERT(surface); + + compositor->m_data_device_manager->dataDevice()->sendEnter(surface, position); +} + +void Compositor::sendDataDeviceMotion(void *data, const QList ¶meters) +{ + Compositor *compositor = static_cast(data); + Q_ASSERT(compositor); + QPoint position = parameters.first().toPoint(); + compositor->m_data_device_manager->dataDevice()->sendMotion(position); +} + +void Compositor::sendDataDeviceDrop(void *data, const QList ¶meters) +{ + Compositor *compositor = static_cast(data); + Surface *surface = resolveSurface(parameters.first()); + + Q_ASSERT(compositor); + Q_ASSERT(surface); + + compositor->m_data_device_manager->dataDevice()->sendDrop(surface); +} + +void Compositor::sendDataDeviceLeave(void *data, const QList ¶meters) +{ + Compositor *compositor = static_cast(data); + Surface *surface = resolveSurface(parameters.first()); + + Q_ASSERT(compositor); + Q_ASSERT(surface); + + compositor->m_data_device_manager->dataDevice()->sendLeave(surface); +} + +void Compositor::waitForStartDrag(void *data, const QList ¶meters) +{ + Compositor *compositor = static_cast(data); + Q_ASSERT(compositor); + while (!compositor->m_startDragSeen) { + wl_display_flush_clients(compositor->m_display); + wl_event_loop_dispatch(compositor->m_loop, 100); + } + compositor->m_startDragSeen = false; +} + Seat::Seat(Compositor *compositor, struct ::wl_display *display) : wl_seat(display, 2) , m_compositor(compositor) @@ -312,18 +376,65 @@ void Touch::sendFrame(Surface *surface) wl_touch_send_frame(resource->handle); } +DataOffer::DataOffer() + : wl_data_offer() +{ + +} + DataDevice::DataDevice(Compositor *compositor) : wl_data_device() , m_compositor(compositor) + , m_dataOffer(nullptr) + , m_focus(nullptr) { } +void DataDevice::sendDataOffer(wl_client *client) +{ + m_dataOffer = new QtWaylandServer::wl_data_offer(client, 0, 1); + Resource *resource = resourceMap().value(client); + send_data_offer(resource->handle, m_dataOffer->resource()->handle); +} + +void DataDevice::sendEnter(Surface *surface, const QPoint& position) +{ + uint serial = m_compositor->nextSerial(); + m_focus = surface; + Resource *resource = resourceMap().value(surface->resource()->client()); + send_enter(resource->handle, serial, surface->resource()->handle, position.x(), position.y(), m_dataOffer->resource()->handle); +} + +void DataDevice::sendMotion(const QPoint &position) +{ + uint32_t time = m_compositor->time(); + Resource *resource = resourceMap().value(m_focus->resource()->client()); + send_motion(resource->handle, time, position.x(), position.y()); +} + +void DataDevice::sendDrop(Surface *surface) +{ + Resource *resource = resourceMap().value(surface->resource()->client()); + send_drop(resource->handle); +} + +void DataDevice::sendLeave(Surface *surface) +{ + Resource *resource = resourceMap().value(surface->resource()->client()); + send_leave(resource->handle); +} + DataDevice::~DataDevice() { } +void DataDevice::data_device_start_drag(QtWaylandServer::wl_data_device::Resource *resource, wl_resource *source, wl_resource *origin, wl_resource *icon, uint32_t serial) +{ + m_compositor->m_startDragSeen = true; +} + DataDeviceManager::DataDeviceManager(Compositor *compositor, wl_display *display) : wl_data_device_manager(display, 1) , m_compositor(compositor) @@ -336,6 +447,11 @@ DataDeviceManager::~DataDeviceManager() } +DataDevice *DataDeviceManager::dataDevice() const +{ + return m_data_device.data(); +} + void DataDeviceManager::data_device_manager_get_data_device(Resource *resource, uint32_t id, struct ::wl_resource *seat) { if (!m_data_device) @@ -343,4 +459,9 @@ void DataDeviceManager::data_device_manager_get_data_device(Resource *resource, m_data_device->add(resource->client(), id, 1); } +void DataDeviceManager::data_device_manager_create_data_source(QtWaylandServer::wl_data_device_manager::Resource *resource, uint32_t id) +{ + new QtWaylandServer::wl_data_source(resource->client(), id, 1); +} + } diff --git a/tests/auto/wayland/mockinput.h b/tests/auto/wayland/mockinput.h index 61c507077fe..d98328a66c6 100644 --- a/tests/auto/wayland/mockinput.h +++ b/tests/auto/wayland/mockinput.h @@ -127,14 +127,30 @@ private: Compositor *m_compositor; }; +class DataOffer : public QtWaylandServer::wl_data_offer +{ +public: + DataOffer(); +}; + class DataDevice : public QtWaylandServer::wl_data_device { public: DataDevice(Compositor *compositor); + void sendDataOffer(wl_client *client); + void sendEnter(Surface *surface, const QPoint &position); + void sendMotion(const QPoint &position); + void sendDrop(Surface *surface); + void sendLeave(Surface *surface); ~DataDevice(); +protected: + void data_device_start_drag(Resource *resource, struct ::wl_resource *source, struct ::wl_resource *origin, struct ::wl_resource *icon, uint32_t serial) override; + private: Compositor *m_compositor; + QtWaylandServer::wl_data_offer *m_dataOffer; + Surface* m_focus; }; class DataDeviceManager : public QtWaylandServer::wl_data_device_manager @@ -142,9 +158,11 @@ class DataDeviceManager : public QtWaylandServer::wl_data_device_manager public: DataDeviceManager(Compositor *compositor, struct ::wl_display *display); ~DataDeviceManager(); + DataDevice *dataDevice() const; protected: void data_device_manager_get_data_device(Resource *resource, uint32_t id, struct ::wl_resource *seat) Q_DECL_OVERRIDE; + void data_device_manager_create_data_source(Resource *resource, uint32_t id) override; private: Compositor *m_compositor; diff --git a/tests/auto/wayland/tst_client.cpp b/tests/auto/wayland/tst_client.cpp index 3fde258d193..5a1143220a5 100644 --- a/tests/auto/wayland/tst_client.cpp +++ b/tests/auto/wayland/tst_client.cpp @@ -36,6 +36,10 @@ #include #include #include +#include +#include +#include +#include #include @@ -141,6 +145,8 @@ private slots: void createDestroyWindow(); void events(); void backingStore(); + void touchDrag(); + void mouseDrag(); private: MockCompositor *compositor; @@ -251,6 +257,86 @@ void tst_WaylandClient::backingStore() QTRY_VERIFY(surface->image.isNull()); } +class DndWindow : public QWindow +{ + Q_OBJECT + +public: + DndWindow(QWindow *parent = 0) + : QWindow(parent) + , dragStarted(false) + { + QImage cursorImage(64,64,QImage::Format_ARGB32); + cursorImage.fill(Qt::blue); + m_dragIcon = QPixmap::fromImage(cursorImage); + } + ~DndWindow(){} + bool dragStarted; + +protected: + void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE + { + if (dragStarted) + return; + dragStarted = true; + + QByteArray dataBytes; + QMimeData *mimeData = new QMimeData; + mimeData->setData("application/x-dnditemdata", dataBytes); + QDrag *drag = new QDrag(this); + drag->setMimeData(mimeData); + drag->setPixmap(m_dragIcon); + drag->exec(Qt::CopyAction | Qt::MoveAction, Qt::CopyAction); + } +private: + QPixmap m_dragIcon; +}; + +void tst_WaylandClient::touchDrag() +{ + DndWindow window; + window.show(); + + QSharedPointer surface; + QTRY_VERIFY(surface = compositor->surface()); + + compositor->setKeyboardFocus(surface); + QTRY_COMPARE(QGuiApplication::focusWindow(), &window); + + const int id = 0; + compositor->sendTouchDown(surface, QPoint(10, 10), id); + compositor->sendTouchMotion(surface, QPoint(20, 20), id); + compositor->sendTouchFrame(surface); + compositor->waitForStartDrag(); + compositor->sendDataDeviceDataOffer(surface); + compositor->sendDataDeviceEnter(surface, QPoint(20, 20)); + compositor->sendDataDeviceMotion( QPoint(21, 21)); + compositor->sendDataDeviceDrop(surface); + compositor->sendDataDeviceLeave(surface); + QTRY_VERIFY(window.dragStarted); +} + +void tst_WaylandClient::mouseDrag() +{ + DndWindow window; + window.show(); + + QSharedPointer surface; + QTRY_VERIFY(surface = compositor->surface()); + + compositor->setKeyboardFocus(surface); + QTRY_COMPARE(QGuiApplication::focusWindow(), &window); + + compositor->sendMousePress(surface, QPoint(10, 10)); + compositor->sendDataDeviceDataOffer(surface); + compositor->sendDataDeviceEnter(surface, QPoint(20, 20)); + compositor->sendDataDeviceMotion( QPoint(21, 21)); + compositor->waitForStartDrag(); + compositor->sendDataDeviceDrop(surface); + compositor->sendDataDeviceLeave(surface); + QTRY_VERIFY(window.dragStarted); +} + int main(int argc, char **argv) { setenv("XDG_RUNTIME_DIR", ".", 1); From f70756c94d531ca220d9d71d3d3ab6787640742f Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Fri, 5 Aug 2016 10:59:51 +0200 Subject: [PATCH 0344/1507] Client: Refactor window active state Let shell surface implementations decide if they manage activated state. Moves the logic out of QWaylandDisplay. Change-Id: I75c86df68a1a93f9b1d2bf378b6603215d0b0128 Reviewed-by: Paul Olav Tvete --- src/plugins/platforms/wayland/qwaylanddisplay.cpp | 8 +------- src/plugins/platforms/wayland/qwaylanddisplay_p.h | 1 - src/plugins/platforms/wayland/qwaylandshellsurface_p.h | 1 + src/plugins/platforms/wayland/qwaylandxdgsurface_p.h | 2 ++ 4 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index f6d86bb39ed..682172bf8bf 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -385,12 +385,6 @@ void QWaylandDisplay::setLastInputDevice(QWaylandInputDevice *device, uint32_t s mLastInputWindow = win; } -bool QWaylandDisplay::shellManagesActiveState() const -{ - //TODO: This should be part of a shell interface used by the shell protocol implementations - return mShellXdg; -} - void QWaylandDisplay::handleWindowActivated(QWaylandWindow *window) { if (mActiveWindows.contains(window)) @@ -414,7 +408,7 @@ void QWaylandDisplay::handleKeyboardFocusChanged(QWaylandInputDevice *inputDevic { QWaylandWindow *keyboardFocus = inputDevice->keyboardFocus(); - if (!shellManagesActiveState() && mLastKeyboardFocus != keyboardFocus) { + if (!keyboardFocus->shellSurface()->shellManagesActiveState() && mLastKeyboardFocus != keyboardFocus) { if (keyboardFocus) handleWindowActivated(keyboardFocus); if (mLastKeyboardFocus) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay_p.h b/src/plugins/platforms/wayland/qwaylanddisplay_p.h index 237be5b783f..3f5538ec22e 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay_p.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay_p.h @@ -169,7 +169,6 @@ public: QWaylandWindow *lastInputWindow() const; void setLastInputDevice(QWaylandInputDevice *device, uint32_t serial, QWaylandWindow *window); - bool shellManagesActiveState() const; void handleWindowActivated(QWaylandWindow *window); void handleWindowDeactivated(QWaylandWindow *window); void handleKeyboardFocusChanged(QWaylandInputDevice *inputDevice); diff --git a/src/plugins/platforms/wayland/qwaylandshellsurface_p.h b/src/plugins/platforms/wayland/qwaylandshellsurface_p.h index 726d103f9dd..c99e586d58a 100644 --- a/src/plugins/platforms/wayland/qwaylandshellsurface_p.h +++ b/src/plugins/platforms/wayland/qwaylandshellsurface_p.h @@ -85,6 +85,7 @@ public: virtual void setContentOrientationMask(Qt::ScreenOrientations orientation) { Q_UNUSED(orientation) } virtual void sendProperty(const QString &name, const QVariant &value); + virtual bool shellManagesActiveState() const { return false; } inline QWaylandWindow *window() { return m_window; } diff --git a/src/plugins/platforms/wayland/qwaylandxdgsurface_p.h b/src/plugins/platforms/wayland/qwaylandxdgsurface_p.h index e367980b7fc..bc72820a144 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgsurface_p.h +++ b/src/plugins/platforms/wayland/qwaylandxdgsurface_p.h @@ -89,6 +89,8 @@ public: void setWindowFlags(Qt::WindowFlags flags) Q_DECL_OVERRIDE; void sendProperty(const QString &name, const QVariant &value) Q_DECL_OVERRIDE; + bool shellManagesActiveState() const Q_DECL_OVERRIDE { return true; } + bool isFullscreen() const { return m_fullscreen; } bool isMaximized() const { return m_maximized; } From 1514e2dc8a8b5e4983a00b58316f559cf6e7780c Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Fri, 5 Aug 2016 10:10:58 +0200 Subject: [PATCH 0345/1507] Make wl_shell and xdg_shell use the QWaylandShellIntegration interface This simplifies the code in QWaylandDisplay and hopefully makes it easier to implement a prioritized shell selection mechanism later. Change-Id: I2bb3a13f8acedb60a6606cb3a8b5b228095eadf9 Reviewed-by: Giulio Camuffo --- src/plugins/platforms/wayland/client.pro | 4 + .../platforms/wayland/qwaylanddisplay.cpp | 31 +++----- .../platforms/wayland/qwaylanddisplay_p.h | 6 +- .../platforms/wayland/qwaylandintegration.cpp | 43 ++++++++--- .../platforms/wayland/qwaylandintegration_p.h | 1 + .../wayland/qwaylandwlshellintegration.cpp | 62 ++++++++++++++++ .../wayland/qwaylandwlshellintegration_p.h | 72 ++++++++++++++++++ .../platforms/wayland/qwaylandxdgshell.cpp | 5 ++ .../platforms/wayland/qwaylandxdgshell_p.h | 4 +- .../wayland/qwaylandxdgshellintegration.cpp | 63 ++++++++++++++++ .../wayland/qwaylandxdgshellintegration_p.h | 73 +++++++++++++++++++ .../platforms/wayland/qwaylandxdgsurface.cpp | 9 ++- .../platforms/wayland/qwaylandxdgsurface_p.h | 4 +- 13 files changed, 337 insertions(+), 40 deletions(-) create mode 100644 src/plugins/platforms/wayland/qwaylandwlshellintegration.cpp create mode 100644 src/plugins/platforms/wayland/qwaylandwlshellintegration_p.h create mode 100644 src/plugins/platforms/wayland/qwaylandxdgshellintegration.cpp create mode 100644 src/plugins/platforms/wayland/qwaylandxdgshellintegration_p.h diff --git a/src/plugins/platforms/wayland/client.pro b/src/plugins/platforms/wayland/client.pro index 59234b14e74..d2d12d9fd0e 100644 --- a/src/plugins/platforms/wayland/client.pro +++ b/src/plugins/platforms/wayland/client.pro @@ -59,8 +59,10 @@ SOURCES += qwaylandintegration.cpp \ qwaylanddatasource.cpp \ qwaylandshellsurface.cpp \ qwaylandwlshellsurface.cpp \ + qwaylandwlshellintegration.cpp \ qwaylandxdgshell.cpp \ qwaylandxdgsurface.cpp \ + qwaylandxdgshellintegration.cpp \ qwaylandextendedsurface.cpp \ qwaylandsubsurface.cpp \ qwaylandtouch.cpp \ @@ -92,8 +94,10 @@ HEADERS += qwaylandintegration_p.h \ qwaylanddatasource_p.h \ qwaylandshellsurface_p.h \ qwaylandwlshellsurface_p.h \ + qwaylandwlshellintegration_p.h \ qwaylandxdgshell_p.h \ qwaylandxdgsurface_p.h \ + qwaylandxdgshellintegration_p.h \ qwaylandextendedsurface_p.h \ qwaylandsubsurface_p.h \ qwaylandtouch_p.h \ diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index 682172bf8bf..7225d24af9d 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -77,16 +77,8 @@ struct wl_surface *QWaylandDisplay::createSurface(void *handle) QWaylandShellSurface *QWaylandDisplay::createShellSurface(QWaylandWindow *window) { - if (mWaylandIntegration->shellIntegration()) - return mWaylandIntegration->shellIntegration()->createShellSurface(window); - - if (shellXdg()) { - return new QWaylandXdgSurface(shellXdg()->get_xdg_surface(window->object()), window); - } else if (shell()) { - return new QWaylandWlShellSurface(shell()->get_shell_surface(window->object()), window); - } - - return Q_NULLPTR; + Q_ASSERT(mWaylandIntegration->shellIntegration()); + return mWaylandIntegration->shellIntegration()->createShellSurface(window); } struct ::wl_region *QWaylandDisplay::createRegion(const QRegion &qregion) @@ -248,11 +240,6 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin mCompositor.init(registry, id, mCompositorVersion); } else if (interface == QStringLiteral("wl_shm")) { mShm = static_cast(wl_registry_bind(registry, id, &wl_shm_interface,1)); - } else if (interface == QStringLiteral("xdg_shell") - && qEnvironmentVariableIsSet("QT_WAYLAND_USE_XDG_SHELL")) { - mShellXdg.reset(new QWaylandXdgShell(registry,id)); - } else if (interface == QStringLiteral("wl_shell")){ - mShell.reset(new QtWayland::wl_shell(registry, id, 1)); } else if (interface == QStringLiteral("wl_seat")) { QWaylandInputDevice *inputDevice = mWaylandIntegration->createInputDevice(this, version, id); mInputDevices.append(inputDevice); @@ -301,6 +288,15 @@ void QWaylandDisplay::registry_global_remove(uint32_t id) } } +bool QWaylandDisplay::hasRegistryGlobal(const QString &interfaceName) +{ + Q_FOREACH (const RegistryGlobal &global, mGlobals) + if (global.interface == interfaceName) + return true; + + return false; +} + void QWaylandDisplay::addRegistryListener(RegistryListener listener, void *data) { Listener l = { listener, data }; @@ -356,11 +352,6 @@ void QWaylandDisplay::forceRoundTrip() wl_callback_destroy(callback); } -QtWayland::xdg_shell *QWaylandDisplay::shellXdg() -{ - return mShellXdg.data(); -} - bool QWaylandDisplay::supportsWindowDecoration() const { static bool disabled = qgetenv("QT_WAYLAND_DISABLE_WINDOWDECORATION").toInt(); diff --git a/src/plugins/platforms/wayland/qwaylanddisplay_p.h b/src/plugins/platforms/wayland/qwaylanddisplay_p.h index 3f5538ec22e..ea127d2f4f0 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay_p.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay_p.h @@ -128,9 +128,6 @@ public: QtWayland::wl_compositor *compositor() { return &mCompositor; } int compositorVersion() const { return mCompositorVersion; } - QtWayland::wl_shell *shell() { return mShell.data(); } - QtWayland::xdg_shell *shellXdg(); - QList inputDevices() const { return mInputDevices; } QWaylandInputDevice *defaultInputDevice() const; QWaylandInputDevice *currentInputDevice() const { return defaultInputDevice(); } @@ -151,6 +148,7 @@ public: : id(id_), interface(interface_), version(version_), registry(registry_) { } }; QList globals() const { return mGlobals; } + bool hasRegistryGlobal(const QString &interfaceName); /* wl_registry_add_listener does not add but rather sets a listener, so this function is used * to enable many listeners at once. */ @@ -193,8 +191,6 @@ private: struct wl_display *mDisplay; QtWayland::wl_compositor mCompositor; struct wl_shm *mShm; - QScopedPointer mShell; - QScopedPointer mShellXdg; QList mScreens; QList mInputDevices; QList mRegistryListeners; diff --git a/src/plugins/platforms/wayland/qwaylandintegration.cpp b/src/plugins/platforms/wayland/qwaylandintegration.cpp index 39fff533d32..e62ef87f198 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandintegration.cpp @@ -69,6 +69,8 @@ #include "qwaylandshellintegration_p.h" #include "qwaylandshellintegrationfactory_p.h" +#include "qwaylandxdgshellintegration_p.h" +#include "qwaylandwlshellintegration_p.h" #include "qwaylandinputdeviceintegration_p.h" #include "qwaylandinputdeviceintegrationfactory_p.h" @@ -360,17 +362,29 @@ void QWaylandIntegration::initializeShellIntegration() QByteArray integrationName = qgetenv("QT_WAYLAND_SHELL_INTEGRATION"); QString targetKey = QString::fromLocal8Bit(integrationName); - if (targetKey.isEmpty()) { - return; + if (!targetKey.isEmpty()) { + QStringList keys = QWaylandShellIntegrationFactory::keys(); + if (keys.contains(targetKey)) { + qDebug("Using the '%s' shell integration", qPrintable(targetKey)); + mShellIntegration = QWaylandShellIntegrationFactory::create(targetKey, QStringList()); + } + } else { + QStringList preferredShells; + if (qEnvironmentVariableIsSet("QT_WAYLAND_USE_XDG_SHELL")) + preferredShells << QLatin1String("xdg_shell"); + preferredShells << QLatin1String("wl_shell"); + + Q_FOREACH (QString preferredShell, preferredShells) { + if (mDisplay->hasRegistryGlobal(preferredShell)) { + mShellIntegration = createShellIntegration(preferredShell); + break; + } + } } - QStringList keys = QWaylandShellIntegrationFactory::keys(); - if (keys.contains(targetKey)) { - mShellIntegration = QWaylandShellIntegrationFactory::create(targetKey, QStringList()); - } - if (mShellIntegration && mShellIntegration->initialize(mDisplay)) { - qDebug("Using the '%s' shell integration", qPrintable(targetKey)); - } else { + Q_ASSERT(mShellIntegration); + + if (!mShellIntegration->initialize(mDisplay)) { delete mShellIntegration; mShellIntegration = Q_NULLPTR; qWarning("Failed to load shell integration %s", qPrintable(targetKey)); @@ -403,6 +417,17 @@ void QWaylandIntegration::initializeInputDeviceIntegration() } } +QWaylandShellIntegration *QWaylandIntegration::createShellIntegration(const QString &interfaceName) +{ + if (interfaceName == QLatin1Literal("wl_shell")) { + return new QWaylandWlShellIntegration(mDisplay); + } else if (interfaceName == QLatin1Literal("xdg_shell")) { + return new QWaylandXdgShellIntegration(mDisplay); + } else { + return Q_NULLPTR; + } +} + } QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandintegration_p.h b/src/plugins/platforms/wayland/qwaylandintegration_p.h index 987d80599f8..671f7de2884 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration_p.h +++ b/src/plugins/platforms/wayland/qwaylandintegration_p.h @@ -115,6 +115,7 @@ private: void initializeServerBufferIntegration(); void initializeShellIntegration(); void initializeInputDeviceIntegration(); + QWaylandShellIntegration *createShellIntegration(const QString& interfaceName); QPlatformFontDatabase *mFontDb; QPlatformClipboard *mClipboard; diff --git a/src/plugins/platforms/wayland/qwaylandwlshellintegration.cpp b/src/plugins/platforms/wayland/qwaylandwlshellintegration.cpp new file mode 100644 index 00000000000..6a9220d2648 --- /dev/null +++ b/src/plugins/platforms/wayland/qwaylandwlshellintegration.cpp @@ -0,0 +1,62 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL21$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qwaylandwlshellintegration_p.h" + +#include +#include +#include + +QT_BEGIN_NAMESPACE + +namespace QtWaylandClient { + +QWaylandWlShellIntegration::QWaylandWlShellIntegration(QWaylandDisplay *display) + : m_wlShell(Q_NULLPTR) +{ + Q_FOREACH (QWaylandDisplay::RegistryGlobal global, display->globals()) { + if (global.interface == QLatin1String("wl_shell")) { + m_wlShell = new QtWayland::wl_shell(display->wl_registry(), global.id, 1); + break; + } + } +} + +QWaylandShellSurface *QWaylandWlShellIntegration::createShellSurface(QWaylandWindow *window) +{ + return new QWaylandWlShellSurface(m_wlShell->get_shell_surface(window->object()), window); +} + +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandwlshellintegration_p.h b/src/plugins/platforms/wayland/qwaylandwlshellintegration_p.h new file mode 100644 index 00000000000..8531eb3aad1 --- /dev/null +++ b/src/plugins/platforms/wayland/qwaylandwlshellintegration_p.h @@ -0,0 +1,72 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL21$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWAYLANDWLSHELLINTEGRATION_P_H +#define QWAYLANDWLSHELLINTEGRATION_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include +#include + +#include + +QT_BEGIN_NAMESPACE + +namespace QtWaylandClient { + +class Q_WAYLAND_CLIENT_EXPORT QWaylandWlShellIntegration : public QWaylandShellIntegration +{ +public: + QWaylandWlShellIntegration(QWaylandDisplay* display); + bool initialize(QWaylandDisplay *) Q_DECL_OVERRIDE { return m_wlShell != Q_NULLPTR; } + QWaylandShellSurface *createShellSurface(QWaylandWindow *window) Q_DECL_OVERRIDE; + +private: + QtWayland::wl_shell *m_wlShell; +}; + +} + +QT_END_NAMESPACE + +#endif // QWAYLANDWLSHELLINTEGRATION_P_H diff --git a/src/plugins/platforms/wayland/qwaylandxdgshell.cpp b/src/plugins/platforms/wayland/qwaylandxdgshell.cpp index 65fafcead77..9b351da6a6b 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgshell.cpp +++ b/src/plugins/platforms/wayland/qwaylandxdgshell.cpp @@ -37,6 +37,7 @@ #include "qwaylandwindow_p.h" #include "qwaylandinputdevice_p.h" #include "qwaylandscreen_p.h" +#include "qwaylandxdgsurface_p.h" #include @@ -60,6 +61,10 @@ QWaylandXdgShell::~QWaylandXdgShell() xdg_shell_destroy(object()); } +QWaylandXdgSurface *QWaylandXdgShell::createXdgSurface(QWaylandWindow *window) +{ + return new QWaylandXdgSurface(this, window); +} void QWaylandXdgShell::xdg_shell_ping(uint32_t serial) { diff --git a/src/plugins/platforms/wayland/qwaylandxdgshell_p.h b/src/plugins/platforms/wayland/qwaylandxdgshell_p.h index 3fd248fc462..cd16564150e 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgshell_p.h +++ b/src/plugins/platforms/wayland/qwaylandxdgshell_p.h @@ -61,15 +61,17 @@ namespace QtWaylandClient { class QWaylandWindow; class QWaylandInputDevice; +class QWaylandXdgSurface; class Q_WAYLAND_CLIENT_EXPORT QWaylandXdgShell : public QtWayland::xdg_shell { public: QWaylandXdgShell(struct ::xdg_shell *shell); QWaylandXdgShell(struct ::wl_registry *registry, uint32_t id); - virtual ~QWaylandXdgShell(); + QWaylandXdgSurface *createXdgSurface(QWaylandWindow *window); + private: void xdg_shell_ping(uint32_t serial) Q_DECL_OVERRIDE; }; diff --git a/src/plugins/platforms/wayland/qwaylandxdgshellintegration.cpp b/src/plugins/platforms/wayland/qwaylandxdgshellintegration.cpp new file mode 100644 index 00000000000..5a569129fea --- /dev/null +++ b/src/plugins/platforms/wayland/qwaylandxdgshellintegration.cpp @@ -0,0 +1,63 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL21$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qwaylandxdgshellintegration_p.h" + +#include +#include +#include +#include + +QT_BEGIN_NAMESPACE + +namespace QtWaylandClient { + +QWaylandXdgShellIntegration::QWaylandXdgShellIntegration(QWaylandDisplay *display) + : m_xdgShell(Q_NULLPTR) +{ + Q_FOREACH (QWaylandDisplay::RegistryGlobal global, display->globals()) { + if (global.interface == QLatin1String("xdg_shell")) { + m_xdgShell = new QWaylandXdgShell(display->wl_registry(), global.id); + break; + } + } +} + +QWaylandShellSurface *QWaylandXdgShellIntegration::createShellSurface(QWaylandWindow *window) +{ + return m_xdgShell->createXdgSurface(window); +} + +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandxdgshellintegration_p.h b/src/plugins/platforms/wayland/qwaylandxdgshellintegration_p.h new file mode 100644 index 00000000000..29374ff1d6d --- /dev/null +++ b/src/plugins/platforms/wayland/qwaylandxdgshellintegration_p.h @@ -0,0 +1,73 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL21$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWAYLANDXDGSHELLINTEGRATION_P_H +#define QWAYLANDXDGSHELLINTEGRATION_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include + +#include + +QT_BEGIN_NAMESPACE + +namespace QtWaylandClient { + +class QWaylandXdgShell; + +class Q_WAYLAND_CLIENT_EXPORT QWaylandXdgShellIntegration : public QWaylandShellIntegration +{ +public: + QWaylandXdgShellIntegration(QWaylandDisplay *display); + bool initialize(QWaylandDisplay *) Q_DECL_OVERRIDE { return m_xdgShell != Q_NULLPTR; } + QWaylandShellSurface *createShellSurface(QWaylandWindow *window) Q_DECL_OVERRIDE; + +private: + QWaylandXdgShell *m_xdgShell; +}; + +} + +QT_END_NAMESPACE + +#endif // QWAYLANDXDGSHELLINTEGRATION_P_H diff --git a/src/plugins/platforms/wayland/qwaylandxdgsurface.cpp b/src/plugins/platforms/wayland/qwaylandxdgsurface.cpp index bbda03dc3cc..f44e2d9feca 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgsurface.cpp +++ b/src/plugins/platforms/wayland/qwaylandxdgsurface.cpp @@ -39,16 +39,18 @@ #include "qwaylandabstractdecoration_p.h" #include "qwaylandscreen_p.h" #include "qwaylandextendedsurface_p.h" +#include "qwaylandxdgshell_p.h" QT_BEGIN_NAMESPACE namespace QtWaylandClient { -QWaylandXdgSurface::QWaylandXdgSurface(struct ::xdg_surface *xdg_surface, QWaylandWindow *window) +QWaylandXdgSurface::QWaylandXdgSurface(QWaylandXdgShell *shell, QWaylandWindow *window) : QWaylandShellSurface(window) - , QtWayland::xdg_surface(xdg_surface) + , QtWayland::xdg_surface(shell->get_xdg_surface(window->object())) , m_window(window) + , m_shell(shell) , m_maximized(false) , m_minimized(false) , m_fullscreen(false) @@ -130,8 +132,7 @@ void QWaylandXdgSurface::updateTransientParent(QWindow *parent) QWaylandWindow *parent_wayland_window = static_cast(parent->handle()); if (!parent_wayland_window) return; - QtWayland::xdg_shell *shell = parent_wayland_window->display()->shellXdg(); - set_parent(shell->get_xdg_surface(parent_wayland_window->object())); + set_parent(m_shell->get_xdg_surface(parent_wayland_window->object())); } void QWaylandXdgSurface::setTitle(const QString & title) diff --git a/src/plugins/platforms/wayland/qwaylandxdgsurface_p.h b/src/plugins/platforms/wayland/qwaylandxdgsurface_p.h index bc72820a144..51c658ea43f 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgsurface_p.h +++ b/src/plugins/platforms/wayland/qwaylandxdgsurface_p.h @@ -63,13 +63,14 @@ namespace QtWaylandClient { class QWaylandWindow; class QWaylandInputDevice; class QWaylandExtendedSurface; +class QWaylandXdgShell; class Q_WAYLAND_CLIENT_EXPORT QWaylandXdgSurface : public QWaylandShellSurface , public QtWayland::xdg_surface { Q_OBJECT public: - QWaylandXdgSurface(struct ::xdg_surface *shell_surface, QWaylandWindow *window); + QWaylandXdgSurface(QWaylandXdgShell *shell, QWaylandWindow *window); virtual ~QWaylandXdgSurface(); using QtWayland::xdg_surface::resize; @@ -105,6 +106,7 @@ private: private: QWaylandWindow *m_window; + QWaylandXdgShell* m_shell; bool m_maximized; bool m_minimized; bool m_fullscreen; From 2631c35ad7873aea4fee748ecc6b1523a4465e8f Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Fri, 5 Aug 2016 10:27:06 +0200 Subject: [PATCH 0346/1507] Client: Fix popup position for xdg shell Popups used xdg_surface instead of xdg_popup. It's not possible to set a position for an xdg_surface, because it's supposed to be a top level window (in xdg shell v5). Consequently, popups were treated as top level windows and positioned randomly on Weston. Using xdg_popup instead solves the problem. Task-number: QTBUG-55063 Change-Id: I223348677ef8a1ef1eee6a4c389276a6c802bcb5 Reviewed-by: Giulio Camuffo --- src/plugins/platforms/wayland/client.pro | 2 + .../platforms/wayland/qwaylandxdgpopup_p.cpp | 61 ++++++++++++++ .../platforms/wayland/qwaylandxdgpopup_p.h | 79 +++++++++++++++++++ .../platforms/wayland/qwaylandxdgshell.cpp | 14 ++++ .../platforms/wayland/qwaylandxdgshell_p.h | 2 + .../wayland/qwaylandxdgshellintegration.cpp | 6 +- 6 files changed, 163 insertions(+), 1 deletion(-) create mode 100644 src/plugins/platforms/wayland/qwaylandxdgpopup_p.cpp create mode 100644 src/plugins/platforms/wayland/qwaylandxdgpopup_p.h diff --git a/src/plugins/platforms/wayland/client.pro b/src/plugins/platforms/wayland/client.pro index d2d12d9fd0e..88b9ea12414 100644 --- a/src/plugins/platforms/wayland/client.pro +++ b/src/plugins/platforms/wayland/client.pro @@ -62,6 +62,7 @@ SOURCES += qwaylandintegration.cpp \ qwaylandwlshellintegration.cpp \ qwaylandxdgshell.cpp \ qwaylandxdgsurface.cpp \ + qwaylandxdgpopup_p.cpp \ qwaylandxdgshellintegration.cpp \ qwaylandextendedsurface.cpp \ qwaylandsubsurface.cpp \ @@ -97,6 +98,7 @@ HEADERS += qwaylandintegration_p.h \ qwaylandwlshellintegration_p.h \ qwaylandxdgshell_p.h \ qwaylandxdgsurface_p.h \ + qwaylandxdgpopup_p.h \ qwaylandxdgshellintegration_p.h \ qwaylandextendedsurface_p.h \ qwaylandsubsurface_p.h \ diff --git a/src/plugins/platforms/wayland/qwaylandxdgpopup_p.cpp b/src/plugins/platforms/wayland/qwaylandxdgpopup_p.cpp new file mode 100644 index 00000000000..abc25278b1e --- /dev/null +++ b/src/plugins/platforms/wayland/qwaylandxdgpopup_p.cpp @@ -0,0 +1,61 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL21$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qwaylandxdgpopup_p.h" + +#include "qwaylandwindow_p.h" +#include "qwaylanddisplay_p.h" +#include "qwaylandextendedsurface_p.h" + +QT_BEGIN_NAMESPACE + +namespace QtWaylandClient { + +QWaylandXdgPopup::QWaylandXdgPopup(struct ::xdg_popup *popup, QWaylandWindow *window) + : QWaylandShellSurface(window) + , QtWayland::xdg_popup(popup) + , m_extendedWindow(nullptr) +{ + if (window->display()->windowExtension()) + m_extendedWindow = new QWaylandExtendedSurface(window); +} + +QWaylandXdgPopup::~QWaylandXdgPopup() +{ + xdg_popup_destroy(object()); + delete m_extendedWindow; +} + +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandxdgpopup_p.h b/src/plugins/platforms/wayland/qwaylandxdgpopup_p.h new file mode 100644 index 00000000000..b7574dd116d --- /dev/null +++ b/src/plugins/platforms/wayland/qwaylandxdgpopup_p.h @@ -0,0 +1,79 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the config.tests of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL21$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWAYLANDXDGPOPUP_P_H +#define QWAYLANDXDGPOPUP_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include + +#include +#include +#include "qwaylandshellsurface_p.h" + +QT_BEGIN_NAMESPACE + +class QWindow; + +namespace QtWaylandClient { + +class QWaylandWindow; +class QWaylandExtendedSurface; + +class Q_WAYLAND_CLIENT_EXPORT QWaylandXdgPopup : public QWaylandShellSurface + , public QtWayland::xdg_popup +{ + Q_OBJECT +public: + QWaylandXdgPopup(struct ::xdg_popup *popup, QWaylandWindow *window); + virtual ~QWaylandXdgPopup(); + +private: + QWaylandExtendedSurface *m_extendedWindow; +}; + +QT_END_NAMESPACE + +} + +#endif // QWAYLANDXDGPOPUP_P_H diff --git a/src/plugins/platforms/wayland/qwaylandxdgshell.cpp b/src/plugins/platforms/wayland/qwaylandxdgshell.cpp index 9b351da6a6b..56bb3fae92a 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgshell.cpp +++ b/src/plugins/platforms/wayland/qwaylandxdgshell.cpp @@ -37,6 +37,7 @@ #include "qwaylandwindow_p.h" #include "qwaylandinputdevice_p.h" #include "qwaylandscreen_p.h" +#include "qwaylandxdgpopup_p.h" #include "qwaylandxdgsurface_p.h" #include @@ -66,6 +67,19 @@ QWaylandXdgSurface *QWaylandXdgShell::createXdgSurface(QWaylandWindow *window) return new QWaylandXdgSurface(this, window); } +QWaylandXdgPopup *QWaylandXdgShell::createXdgPopup(QWaylandWindow *window) +{ + QWaylandWindow *parentWindow = window->transientParent(); + ::wl_surface *parentSurface = parentWindow->object(); + QWaylandInputDevice *inputDevice = window->display()->lastInputDevice(); + ::wl_seat *seat = inputDevice->wl_seat(); + uint serial = inputDevice->serial(); + QPoint position = window->geometry().topLeft(); + int x = position.x() + parentWindow->frameMargins().left(); + int y = position.y() + parentWindow->frameMargins().top(); + return new QWaylandXdgPopup(get_xdg_popup(window->object(), parentSurface, seat, serial, x, y), window); +} + void QWaylandXdgShell::xdg_shell_ping(uint32_t serial) { pong(serial); diff --git a/src/plugins/platforms/wayland/qwaylandxdgshell_p.h b/src/plugins/platforms/wayland/qwaylandxdgshell_p.h index cd16564150e..fc5adb486b4 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgshell_p.h +++ b/src/plugins/platforms/wayland/qwaylandxdgshell_p.h @@ -62,6 +62,7 @@ namespace QtWaylandClient { class QWaylandWindow; class QWaylandInputDevice; class QWaylandXdgSurface; +class QWaylandXdgPopup; class Q_WAYLAND_CLIENT_EXPORT QWaylandXdgShell : public QtWayland::xdg_shell { @@ -71,6 +72,7 @@ public: virtual ~QWaylandXdgShell(); QWaylandXdgSurface *createXdgSurface(QWaylandWindow *window); + QWaylandXdgPopup *createXdgPopup(QWaylandWindow *window); private: void xdg_shell_ping(uint32_t serial) Q_DECL_OVERRIDE; diff --git a/src/plugins/platforms/wayland/qwaylandxdgshellintegration.cpp b/src/plugins/platforms/wayland/qwaylandxdgshellintegration.cpp index 5a569129fea..b6b1d9d35a3 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgshellintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandxdgshellintegration.cpp @@ -36,6 +36,7 @@ #include #include #include +#include #include QT_BEGIN_NAMESPACE @@ -55,7 +56,10 @@ QWaylandXdgShellIntegration::QWaylandXdgShellIntegration(QWaylandDisplay *displa QWaylandShellSurface *QWaylandXdgShellIntegration::createShellSurface(QWaylandWindow *window) { - return m_xdgShell->createXdgSurface(window); + if (window->window()->type() == Qt::WindowType::Popup) + return m_xdgShell->createXdgPopup(window); + else + return m_xdgShell->createXdgSurface(window); } } From 895b46e39407d9e371ece82bc063442082dd4222 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Fri, 5 Aug 2016 11:53:43 +0200 Subject: [PATCH 0347/1507] Fix autotest directory structure The client and server parts are separate modules, so they need separate top-level directories under tests/auto. This also makes it easier to add new tests later. Change-Id: I393341b6f4e8fc3afa480653f3482192e002e425 Reviewed-by: Giulio Camuffo --- tests/auto/wayland/client.pro | 26 ++--------------- tests/auto/wayland/client/client.pro | 28 +++++++++++++++++++ .../wayland/{ => client}/mockcompositor.cpp | 0 .../wayland/{ => client}/mockcompositor.h | 0 tests/auto/wayland/{ => client}/mockinput.cpp | 0 tests/auto/wayland/{ => client}/mockinput.h | 0 .../auto/wayland/{ => client}/mockoutput.cpp | 0 tests/auto/wayland/{ => client}/mockshell.cpp | 0 .../auto/wayland/{ => client}/mocksurface.cpp | 0 tests/auto/wayland/{ => client}/mocksurface.h | 0 .../auto/wayland/{ => client}/tst_client.cpp | 0 11 files changed, 30 insertions(+), 24 deletions(-) create mode 100644 tests/auto/wayland/client/client.pro rename tests/auto/wayland/{ => client}/mockcompositor.cpp (100%) rename tests/auto/wayland/{ => client}/mockcompositor.h (100%) rename tests/auto/wayland/{ => client}/mockinput.cpp (100%) rename tests/auto/wayland/{ => client}/mockinput.h (100%) rename tests/auto/wayland/{ => client}/mockoutput.cpp (100%) rename tests/auto/wayland/{ => client}/mockshell.cpp (100%) rename tests/auto/wayland/{ => client}/mocksurface.cpp (100%) rename tests/auto/wayland/{ => client}/mocksurface.h (100%) rename tests/auto/wayland/{ => client}/tst_client.cpp (100%) diff --git a/tests/auto/wayland/client.pro b/tests/auto/wayland/client.pro index eaf6c6e9586..916b3abe445 100644 --- a/tests/auto/wayland/client.pro +++ b/tests/auto/wayland/client.pro @@ -1,25 +1,3 @@ -CONFIG += testcase link_pkgconfig -TARGET = tst_client +TEMPLATE=subdirs -QT += testlib -QT += core-private gui-private - -!contains(QT_CONFIG, no-pkg-config) { - PKGCONFIG += wayland-client wayland-server -} else { - LIBS += -lwayland-client -lwayland-server -} - -CONFIG += wayland-scanner -WAYLANDSERVERSOURCES += \ - ../../../src/3rdparty/protocol/wayland.xml - -SOURCES += tst_client.cpp \ - mockcompositor.cpp \ - mockinput.cpp \ - mockshell.cpp \ - mocksurface.cpp \ - mockoutput.cpp -HEADERS += mockcompositor.h \ - mockinput.h \ - mocksurface.h \ +SUBDIRS += client diff --git a/tests/auto/wayland/client/client.pro b/tests/auto/wayland/client/client.pro new file mode 100644 index 00000000000..006d130a039 --- /dev/null +++ b/tests/auto/wayland/client/client.pro @@ -0,0 +1,28 @@ +CONFIG += testcase link_pkgconfig +TARGET = tst_client + +QT += testlib +QT += core-private gui-private + +!contains(QT_CONFIG, no-pkg-config) { + PKGCONFIG += wayland-client wayland-server +} else { + LIBS += -lwayland-client -lwayland-server +} + +CONFIG += wayland-scanner +WAYLANDSERVERSOURCES += \ + ../../../../src/3rdparty/protocol/wayland.xml + +SOURCES += \ + tst_client.cpp \ + mockcompositor.cpp \ + mockinput.cpp \ + mockshell.cpp \ + mocksurface.cpp \ + mockoutput.cpp + +HEADERS += \ + mockcompositor.h \ + mockinput.h \ + mocksurface.h diff --git a/tests/auto/wayland/mockcompositor.cpp b/tests/auto/wayland/client/mockcompositor.cpp similarity index 100% rename from tests/auto/wayland/mockcompositor.cpp rename to tests/auto/wayland/client/mockcompositor.cpp diff --git a/tests/auto/wayland/mockcompositor.h b/tests/auto/wayland/client/mockcompositor.h similarity index 100% rename from tests/auto/wayland/mockcompositor.h rename to tests/auto/wayland/client/mockcompositor.h diff --git a/tests/auto/wayland/mockinput.cpp b/tests/auto/wayland/client/mockinput.cpp similarity index 100% rename from tests/auto/wayland/mockinput.cpp rename to tests/auto/wayland/client/mockinput.cpp diff --git a/tests/auto/wayland/mockinput.h b/tests/auto/wayland/client/mockinput.h similarity index 100% rename from tests/auto/wayland/mockinput.h rename to tests/auto/wayland/client/mockinput.h diff --git a/tests/auto/wayland/mockoutput.cpp b/tests/auto/wayland/client/mockoutput.cpp similarity index 100% rename from tests/auto/wayland/mockoutput.cpp rename to tests/auto/wayland/client/mockoutput.cpp diff --git a/tests/auto/wayland/mockshell.cpp b/tests/auto/wayland/client/mockshell.cpp similarity index 100% rename from tests/auto/wayland/mockshell.cpp rename to tests/auto/wayland/client/mockshell.cpp diff --git a/tests/auto/wayland/mocksurface.cpp b/tests/auto/wayland/client/mocksurface.cpp similarity index 100% rename from tests/auto/wayland/mocksurface.cpp rename to tests/auto/wayland/client/mocksurface.cpp diff --git a/tests/auto/wayland/mocksurface.h b/tests/auto/wayland/client/mocksurface.h similarity index 100% rename from tests/auto/wayland/mocksurface.h rename to tests/auto/wayland/client/mocksurface.h diff --git a/tests/auto/wayland/tst_client.cpp b/tests/auto/wayland/client/tst_client.cpp similarity index 100% rename from tests/auto/wayland/tst_client.cpp rename to tests/auto/wayland/client/tst_client.cpp From 01234b85f8ae4d0919a192b4182a90b0bbed3f45 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Wed, 24 Aug 2016 16:08:56 +0200 Subject: [PATCH 0348/1507] Client: Fix keyboard focus logic and crash The previous solution did not check for nullptr before dereferencing, which caused a crash. Furthermore, it checked the new ShellSurface's shellManagesActiveState before deciding whether to unfocus the old one. Task-number: QTBUG-55526 Change-Id: I410b6200a5b7b86806f70970730045a4a25f21db Reviewed-by: Paul Olav Tvete --- .../platforms/wayland/qwaylanddisplay.cpp | 17 ++++++++++------- .../platforms/wayland/qwaylandwindow.cpp | 5 +++++ .../platforms/wayland/qwaylandwindow_p.h | 2 ++ 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index 7225d24af9d..ae28eb77970 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -399,13 +399,16 @@ void QWaylandDisplay::handleKeyboardFocusChanged(QWaylandInputDevice *inputDevic { QWaylandWindow *keyboardFocus = inputDevice->keyboardFocus(); - if (!keyboardFocus->shellSurface()->shellManagesActiveState() && mLastKeyboardFocus != keyboardFocus) { - if (keyboardFocus) - handleWindowActivated(keyboardFocus); - if (mLastKeyboardFocus) - handleWindowDeactivated(mLastKeyboardFocus); - } - mLastKeyboardFocus = inputDevice->keyboardFocus(); + if (mLastKeyboardFocus == keyboardFocus) + return; + + if (keyboardFocus && !keyboardFocus->shellManagesActiveState()) + handleWindowActivated(keyboardFocus); + + if (mLastKeyboardFocus && !mLastKeyboardFocus->shellManagesActiveState()) + handleWindowDeactivated(mLastKeyboardFocus); + + mLastKeyboardFocus = keyboardFocus; } void QWaylandDisplay::handleWaylandSync() diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index aba676533bb..8885c0e5d1c 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -500,6 +500,11 @@ QWaylandSubSurface *QWaylandWindow::subSurfaceWindow() const return mSubSurfaceWindow; } +bool QWaylandWindow::shellManagesActiveState() const +{ + return mShellSurface && mShellSurface->shellManagesActiveState(); +} + void QWaylandWindow::handleContentOrientationChange(Qt::ScreenOrientation orientation) { if (mDisplay->compositorVersion() < 2) diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index c60891d49f0..d7e79515945 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -136,6 +136,8 @@ public: QWaylandSubSurface *subSurfaceWindow() const; QWaylandScreen *screen() const { return mScreen; } + bool shellManagesActiveState() const; + void handleContentOrientationChange(Qt::ScreenOrientation orientation) Q_DECL_OVERRIDE; void setOrientationMask(Qt::ScreenOrientations mask); From f6417bd74448bba6d0488d93782a229fd5c5a741 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Mon, 22 Aug 2016 08:18:53 +0200 Subject: [PATCH 0349/1507] Pass TRANSIENT_INACTIVE flag for windows with WA_ShowWithoutActivating When setting a transient window also evaluate the state of the window attribute WA_ShowWithoutActivating. If that flag is set the transient should get the inactive flag as well. Task-number: QTBUG-55403 Change-Id: I757e5527e78f730a440e26abb52e84c9b2bb2f3a Reviewed-by: Johan Helsing Reviewed-by: Giulio Camuffo --- .../platforms/wayland/qwaylandwlshellsurface.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandwlshellsurface.cpp b/src/plugins/platforms/wayland/qwaylandwlshellsurface.cpp index 7235931d3bc..553d458d310 100644 --- a/src/plugins/platforms/wayland/qwaylandwlshellsurface.cpp +++ b/src/plugins/platforms/wayland/qwaylandwlshellsurface.cpp @@ -151,6 +151,13 @@ void QWaylandWlShellSurface::setTopLevel() set_toplevel(); } +static inline bool testShowWithoutActivating(const QWindow *window) +{ + // QWidget-attribute Qt::WA_ShowWithoutActivating. + const QVariant showWithoutActivating = window->property("_q_showWithoutActivating"); + return showWithoutActivating.isValid() && showWithoutActivating.toBool(); +} + void QWaylandWlShellSurface::updateTransientParent(QWindow *parent) { QWaylandWindow *parent_wayland_window = static_cast(parent->handle()); @@ -168,7 +175,8 @@ void QWaylandWlShellSurface::updateTransientParent(QWindow *parent) uint32_t flags = 0; Qt::WindowFlags wf = m_window->window()->flags(); if (wf.testFlag(Qt::ToolTip) - || wf.testFlag(Qt::WindowTransparentForInput)) + || wf.testFlag(Qt::WindowTransparentForInput) + || testShowWithoutActivating(m_window->window())) flags |= WL_SHELL_SURFACE_TRANSIENT_INACTIVE; set_transient(parent_wayland_window->object(), From 6cb80c8a53d75638ca3ed16aacc2af987529c4e4 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Sun, 4 Sep 2016 08:42:04 +0200 Subject: [PATCH 0350/1507] Don't assume we always have a shell The mininimal-cpp compositor example does not have any shell extensions. Change-Id: Ifec2822ef4f5944eed02c19ddfc47419051364a4 Reviewed-by: Johan Helsing --- src/plugins/platforms/wayland/qwaylanddisplay.cpp | 3 ++- src/plugins/platforms/wayland/qwaylandintegration.cpp | 4 +--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index a5e61e28a73..d94afcab5c9 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -84,7 +84,8 @@ struct wl_surface *QWaylandDisplay::createSurface(void *handle) QWaylandShellSurface *QWaylandDisplay::createShellSurface(QWaylandWindow *window) { - Q_ASSERT(mWaylandIntegration->shellIntegration()); + if (!mWaylandIntegration->shellIntegration()) + return 0; return mWaylandIntegration->shellIntegration()->createShellSurface(window); } diff --git a/src/plugins/platforms/wayland/qwaylandintegration.cpp b/src/plugins/platforms/wayland/qwaylandintegration.cpp index bd59e42704d..a7668b1f0ec 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandintegration.cpp @@ -399,9 +399,7 @@ void QWaylandIntegration::initializeShellIntegration() } } - Q_ASSERT(mShellIntegration); - - if (!mShellIntegration->initialize(mDisplay)) { + if (!mShellIntegration || !mShellIntegration->initialize(mDisplay)) { delete mShellIntegration; mShellIntegration = Q_NULLPTR; qWarning("Failed to load shell integration %s", qPrintable(targetKey)); From 5f533e9cccf41b8fa269539c6b0c6ca41480b048 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Mon, 22 Aug 2016 17:17:54 +0200 Subject: [PATCH 0351/1507] Remove or add window decorations when toggling fullscreen Task-number: QTBUG-55343 Change-Id: I38e94a70585ba93d40de22698fda80530cf2156d Reviewed-by: Paul Olav Tvete --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 8885c0e5d1c..a1daa07f016 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -823,6 +823,7 @@ bool QWaylandWindow::setWindowStateInternal(Qt::WindowState state) mState = state; if (mShellSurface) { + createDecoration(); switch (state) { case Qt::WindowFullScreen: mShellSurface->setFullscreen(); From 75bd5ca2b38fcb5a7e653e4170a29dce5bf845f9 Mon Sep 17 00:00:00 2001 From: Samuli Piippo Date: Tue, 13 Sep 2016 15:20:01 +0300 Subject: [PATCH 0352/1507] Fix build with QT_NO_ACCESSIBILITY The accessibility() function is ifdef'd in the base class, which makes build fail when Q_DECL_OVERRIDE is used here. Change-Id: Ic3d800ccf32b39f5bc8d3f94d222bc0d34457057 Reviewed-by: Paul Olav Tvete --- src/plugins/platforms/wayland/qwaylandintegration.cpp | 4 ++-- src/plugins/platforms/wayland/qwaylandintegration_p.h | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandintegration.cpp b/src/plugins/platforms/wayland/qwaylandintegration.cpp index e62ef87f198..17b3f681b94 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandintegration.cpp @@ -119,8 +119,6 @@ QWaylandIntegration::QWaylandIntegration() , mNativeInterface(new QWaylandNativeInterface(this)) #ifndef QT_NO_ACCESSIBILITY , mAccessibility(new QPlatformAccessibility()) -#else - , mAccessibility(0) #endif , mClientBufferIntegrationInitialized(false) , mServerBufferIntegrationInitialized(false) @@ -245,10 +243,12 @@ QVariant QWaylandIntegration::styleHint(StyleHint hint) const return QPlatformIntegration::styleHint(hint); } +#ifndef QT_NO_ACCESSIBILITY QPlatformAccessibility *QWaylandIntegration::accessibility() const { return mAccessibility; } +#endif QPlatformServices *QWaylandIntegration::services() const { diff --git a/src/plugins/platforms/wayland/qwaylandintegration_p.h b/src/plugins/platforms/wayland/qwaylandintegration_p.h index 671f7de2884..b6a715353d3 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration_p.h +++ b/src/plugins/platforms/wayland/qwaylandintegration_p.h @@ -88,7 +88,9 @@ public: QVariant styleHint(StyleHint hint) const Q_DECL_OVERRIDE; +#ifndef QT_NO_ACCESSIBILITY QPlatformAccessibility *accessibility() const Q_DECL_OVERRIDE; +#endif QPlatformServices *services() const Q_DECL_OVERRIDE; @@ -123,7 +125,9 @@ private: QWaylandDisplay *mDisplay; QPlatformNativeInterface *mNativeInterface; QScopedPointer mInputContext; +#ifndef QT_NO_ACCESSIBILITY QPlatformAccessibility *mAccessibility; +#endif bool mClientBufferIntegrationInitialized; bool mServerBufferIntegrationInitialized; bool mShellIntegrationInitialized; From df32477ff0dae0e6e3426b74d90c5edf569e9b6f Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Wed, 14 Sep 2016 16:30:22 +0200 Subject: [PATCH 0353/1507] Fix FramelessWindowHint setFlags() works just like setWindowState(): we have to use the supplied parameter because the window's state hasn't been updated yet. Change-Id: I223e01ef192f30911697e449669e745f0ad59d99 Reviewed-by: Johan Helsing Reviewed-by: Pier Luigi Fiorini --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 9 +++++++-- src/plugins/platforms/wayland/qwaylandwindow_p.h | 1 + 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 9cbc6e2319e..473fe0912d8 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -196,6 +196,7 @@ void QWaylandWindow::initWindow() setMask(window()->mask()); setWindowStateInternal(window()->windowState()); handleContentOrientationChange(window()->contentOrientation()); + mFlags = window()->flags(); } bool QWaylandWindow::shouldCreateShellSurface() const @@ -579,6 +580,9 @@ void QWaylandWindow::setWindowFlags(Qt::WindowFlags flags) { if (mShellSurface) mShellSurface->setWindowFlags(flags); + + mFlags = flags; + createDecoration(); } bool QWaylandWindow::createDecoration() @@ -613,9 +617,9 @@ bool QWaylandWindow::createDecoration() default: break; } - if (window()->flags() & Qt::FramelessWindowHint || isFullscreen()) + if (mFlags & Qt::FramelessWindowHint || isFullscreen()) decoration = false; - if (window()->flags() & Qt::BypassWindowManagerHint) + if (mFlags & Qt::BypassWindowManagerHint) decoration = false; if (mSubSurfaceWindow) decoration = false; @@ -663,6 +667,7 @@ bool QWaylandWindow::createDecoration() QMargins m = frameMargins(); subsurf->set_position(pos.x() + m.left(), pos.y() + m.top()); } + QWindowSystemInterface::handleExposeEvent(window(), QRect(QPoint(), geometry().size())); } return mWindowDecoration; diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index 82898152c1f..03c4a1e484f 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -237,6 +237,7 @@ protected: QIcon mWindowIcon; Qt::WindowState mState; + Qt::WindowFlags mFlags; QRegion mMask; QWaylandShmBackingStore *mBackingStore; From be090d4d41c8b95dc798202a596bc391b23e529d Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Thu, 15 Sep 2016 12:31:45 +0200 Subject: [PATCH 0354/1507] Cleanup and null ptr check Don't crash if we ask for the surface before the window is created. Also clean up NULL/0/nullptr and a c-style cast. Change-Id: I2a5a66ee76a3a12c8ca32847dbe30cc640e924c2 Reviewed-by: Pier Luigi Fiorini Reviewed-by: Johan Helsing --- .../wayland/qwaylandnativeinterface.cpp | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp b/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp index be639ce1595..4a79fb5ab55 100644 --- a/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp +++ b/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp @@ -76,7 +76,7 @@ void *QWaylandNativeInterface::nativeResourceForIntegration(const QByteArray &re if (lowerCaseResource == "egldisplay" && m_integration->clientBufferIntegration()) return m_integration->clientBufferIntegration()->nativeResource(QWaylandClientBufferIntegration::EglDisplay); - return 0; + return nullptr; } void *QWaylandNativeInterface::nativeResourceForWindow(const QByteArray &resourceString, QWindow *window) @@ -88,21 +88,22 @@ void *QWaylandNativeInterface::nativeResourceForWindow(const QByteArray &resourc if (lowerCaseResource == "compositor") return const_cast(m_integration->display()->wl_compositor()); if (lowerCaseResource == "surface") { - return ((QWaylandWindow *) window->handle())->object(); + QWaylandWindow *w = static_cast(window->handle()); + return w ? w->object() : nullptr; } if (lowerCaseResource == "wl_shell_surface") { - QWaylandWindow *w = (QWaylandWindow *) window->handle(); + QWaylandWindow *w = static_cast(window->handle()); if (!w) - return NULL; + return nullptr; QWaylandWlShellSurface *s = qobject_cast(w->shellSurface()); if (!s) - return NULL; + return nullptr; return s->object(); } if (lowerCaseResource == "egldisplay" && m_integration->clientBufferIntegration()) return m_integration->clientBufferIntegration()->nativeResource(QWaylandClientBufferIntegration::EglDisplay); - return NULL; + return nullptr; } void *QWaylandNativeInterface::nativeResourceForScreen(const QByteArray &resourceString, QScreen *screen) @@ -112,7 +113,7 @@ void *QWaylandNativeInterface::nativeResourceForScreen(const QByteArray &resourc if (lowerCaseResource == "output") return ((QWaylandScreen *) screen->handle())->output(); - return NULL; + return nullptr; } void *QWaylandNativeInterface::nativeResourceForContext(const QByteArray &resource, QOpenGLContext *context) @@ -130,7 +131,7 @@ void *QWaylandNativeInterface::nativeResourceForContext(const QByteArray &resour return m_integration->clientBufferIntegration()->nativeResourceForContext(QWaylandClientBufferIntegration::EglDisplay, context->handle()); #endif - return 0; + return nullptr; } QVariantMap QWaylandNativeInterface::windowProperties(QPlatformWindow *window) const @@ -171,7 +172,7 @@ QFunctionPointer QWaylandNativeInterface::platformFunction(const QByteArray &res } else if (resource == QWaylandWindowFunctions::isSyncIdentifier()) { return QFunctionPointer(isSync); } - return 0; + return nullptr; } From 00a0d843d2ea02740acd6c14fb805ba4c8a4c30b Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Tue, 13 Sep 2016 20:23:05 +0200 Subject: [PATCH 0355/1507] Only bind the extension once Change-Id: I014269a19ca569298df91c2c329193e5ee5ff9c5 Reviewed-by: Pier Luigi Fiorini Reviewed-by: Johan Helsing --- .../platforms/wayland/global/qwaylandclientextension.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/global/qwaylandclientextension.cpp b/src/plugins/platforms/wayland/global/qwaylandclientextension.cpp index 4202b333b47..8992e132f03 100644 --- a/src/plugins/platforms/wayland/global/qwaylandclientextension.cpp +++ b/src/plugins/platforms/wayland/global/qwaylandclientextension.cpp @@ -60,7 +60,7 @@ void QWaylandClientExtensionPrivate::handleRegistryGlobal(void *data, ::wl_regis const QString &interface, uint32_t version) { QWaylandClientExtension *extension = static_cast(data); - if (interface == QLatin1String(extension->extensionInterface()->name)) { + if (interface == QLatin1String(extension->extensionInterface()->name) && !extension->d_func()->active) { extension->bind(registry, id, version); extension->d_func()->active = true; emit extension->activeChanged(); From 56ea738c6d5a0447e88a77512ae574a1dd652cab Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Wed, 7 Sep 2016 16:43:00 +0200 Subject: [PATCH 0356/1507] Warn if using QWaylandClientExtension without a Wayland plugin Change-Id: Ibbf6acab4af45a6b17089bd3809c33a199dc89f6 Reviewed-by: Paul Olav Tvete Reviewed-by: Pier Luigi Fiorini --- .../platforms/wayland/global/qwaylandclientextension.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/plugins/platforms/wayland/global/qwaylandclientextension.cpp b/src/plugins/platforms/wayland/global/qwaylandclientextension.cpp index 8992e132f03..8e46197f18d 100644 --- a/src/plugins/platforms/wayland/global/qwaylandclientextension.cpp +++ b/src/plugins/platforms/wayland/global/qwaylandclientextension.cpp @@ -39,7 +39,9 @@ #include #include #include +#include #include +#include QT_BEGIN_NAMESPACE @@ -54,6 +56,9 @@ QWaylandClientExtensionPrivate::QWaylandClientExtensionPrivate() waylandIntegration = static_cast(QGuiApplicationPrivate::platformIntegration()); if (!waylandIntegration) waylandIntegration = new QtWaylandClient::QWaylandIntegration(); + + if (!waylandIntegration->nativeInterface()->nativeResourceForIntegration("wl_display")) + qWarning() << "This application requires a Wayland platform plugin"; } void QWaylandClientExtensionPrivate::handleRegistryGlobal(void *data, ::wl_registry *registry, uint32_t id, From 52ac4ffe4d2da7845f423ab63d634fa03cccce04 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Fri, 23 Sep 2016 14:59:48 +0200 Subject: [PATCH 0357/1507] Update ivi-application protocol to version 1.9.1 This updates the license to MIT, which all of Wayland moves to. Change-Id: I91080d787f2930620941b421bf44164e02fcf637 Reviewed-by: Johan Helsing --- .../wayland/protocols/ivi-application.xml | 33 ++++++++++--------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/src/3rdparty/wayland/protocols/ivi-application.xml b/src/3rdparty/wayland/protocols/ivi-application.xml index 61ec7d2735c..8f242268849 100644 --- a/src/3rdparty/wayland/protocols/ivi-application.xml +++ b/src/3rdparty/wayland/protocols/ivi-application.xml @@ -5,23 +5,24 @@ Copyright (C) 2013 DENSO CORPORATION Copyright (c) 2013 BMW Car IT GmbH - Permission to use, copy, modify, distribute, and sell this software and - its documentation for any purpose is hereby granted without fee, provided - that the above copyright notice appear in all copies and that both that - copyright notice and this permission notice appear in supporting - documentation, and that the name of the copyright holders not be used in - advertising or publicity pertaining to distribution of the software - without specific, written prior permission. The copyright holders make - no representations about the suitability of this software for any - purpose. It is provided "as is" without express or implied warranty. + 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 COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS - SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND - FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY - SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER - RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF - CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + 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. From 7a02e6b2a56f12c3858daf090576a69de4cb3d36 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Fri, 23 Sep 2016 15:01:52 +0200 Subject: [PATCH 0358/1507] Update xdg-shell protocol file Update xdb-shell.xml file to one from tag v1.9.0 in qtwebengine-protocols.git. This includes switch to MIT license, and also some doc updates. Change-Id: Ia4a565d73f2b25f8a2c41d0cde4c48ac5a793279 Reviewed-by: Johan Helsing --- src/3rdparty/wayland/protocols/xdg-shell.xml | 78 +++++++++++++------- 1 file changed, 53 insertions(+), 25 deletions(-) diff --git a/src/3rdparty/wayland/protocols/xdg-shell.xml b/src/3rdparty/wayland/protocols/xdg-shell.xml index 44a3a12cb5d..f98e760d482 100644 --- a/src/3rdparty/wayland/protocols/xdg-shell.xml +++ b/src/3rdparty/wayland/protocols/xdg-shell.xml @@ -7,26 +7,24 @@ Copyright © 2013 Jasper St. Pierre Copyright © 2010-2013 Intel Corporation - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that copyright notice and this permission - notice appear in supporting documentation, and that the name of - the copyright holders not be used in advertising or publicity - pertaining to distribution of the software without specific, - written prior permission. The copyright holders make no - representations about the suitability of this software for any - purpose. It is provided "as is" without express or implied - warranty. + 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 COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS - SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND - FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY - SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN - AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, - ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF - THIS SOFTWARE. + 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. @@ -248,10 +246,19 @@ Start an interactive, user-driven move of the surface. This request must be used in response to some sort of user action - like a button press, key press, or touch down event. + like a button press, key press, or touch down event. The passed + serial is used to determine the type of interactive move (touch, + pointer, etc). The server may ignore move requests depending on the state of - the surface (e.g. fullscreen or maximized). + the surface (e.g. fullscreen or maximized), or if the passed serial + is no longer valid. + + If triggered, the surface will lose the focus of the device + (wl_pointer, wl_touch, etc) used for the move. It is up to the + compositor to visually indicate that the move is taking place, such as + updating a pointer cursor, during the move. There is no guarantee + that the device focus will return when the move is completed. @@ -260,9 +267,7 @@ These values are used to indicate which edge of a surface - is being dragged in a resize operation. The server may - use this information to adapt its behavior, e.g. choose - an appropriate cursor image. + is being dragged in a resize operation. @@ -280,10 +285,33 @@ Start a user-driven, interactive resize of the surface. This request must be used in response to some sort of user action - like a button press, key press, or touch down event. + like a button press, key press, or touch down event. The passed + serial is used to determine the type of interactive resize (touch, + pointer, etc). The server may ignore resize requests depending on the state of the surface (e.g. fullscreen or maximized). + + If triggered, the client will receive configure events with the + "resize" state enum value and the expected sizes. See the "resize" + enum value for more details about what is required. The client + must also acknowledge configure events using "ack_configure". After + the resize is completed, the client will receive another "configure" + event without the resize state. + + If triggered, the surface also will lose the focus of the device + (wl_pointer, wl_touch, etc) used for the resize. It is up to the + compositor to visually indicate that the resize is taking place, + such as updating a pointer cursor, during the resize. There is no + guarantee that the device focus will return when the resize is + completed. + + The edges parameter specifies how the surface should be resized, + and is one of the values of the resize_edge enum. The compositor + may use this information to update the surface position for + example when dragging the top left corner. The compositor may also + use this information to adapt its behavior, e.g. choose an + appropriate cursor image. From b80fe76ae25411ac7309f3f236f572a64fd0b1f4 Mon Sep 17 00:00:00 2001 From: Pier Luigi Fiorini Date: Sat, 1 Oct 2016 09:08:01 +0200 Subject: [PATCH 0359/1507] Include headers with full path Fix build of programs using the private API outside QtWayland. Change-Id: Ib43ed1be8df8be3cc7b67588003cd7f0a6ff6eb1 Reviewed-by: Johan Helsing --- .../platforms/wayland/global/qwaylandclientextension_p.h | 2 +- src/plugins/platforms/wayland/qwaylandwlshellsurface_p.h | 4 ++-- src/plugins/platforms/wayland/qwaylandxdgpopup_p.h | 4 ++-- src/plugins/platforms/wayland/qwaylandxdgshell_p.h | 2 +- src/plugins/platforms/wayland/qwaylandxdgsurface_p.h | 4 ++-- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/plugins/platforms/wayland/global/qwaylandclientextension_p.h b/src/plugins/platforms/wayland/global/qwaylandclientextension_p.h index 88cc7a88718..7c88161fa51 100644 --- a/src/plugins/platforms/wayland/global/qwaylandclientextension_p.h +++ b/src/plugins/platforms/wayland/global/qwaylandclientextension_p.h @@ -48,8 +48,8 @@ // We mean it. // -#include "qwaylandclientextension.h" #include +#include #include QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandwlshellsurface_p.h b/src/plugins/platforms/wayland/qwaylandwlshellsurface_p.h index c319cd98393..ef732ef85df 100644 --- a/src/plugins/platforms/wayland/qwaylandwlshellsurface_p.h +++ b/src/plugins/platforms/wayland/qwaylandwlshellsurface_p.h @@ -55,9 +55,9 @@ #include -#include #include -#include "qwaylandshellsurface_p.h" +#include +#include QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandxdgpopup_p.h b/src/plugins/platforms/wayland/qwaylandxdgpopup_p.h index 1f211012d34..ff58041134d 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgpopup_p.h +++ b/src/plugins/platforms/wayland/qwaylandxdgpopup_p.h @@ -47,9 +47,9 @@ #include -#include #include -#include "qwaylandshellsurface_p.h" +#include +#include QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandxdgshell_p.h b/src/plugins/platforms/wayland/qwaylandxdgshell_p.h index 77b05b46224..c04a9ce6673 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgshell_p.h +++ b/src/plugins/platforms/wayland/qwaylandxdgshell_p.h @@ -57,7 +57,7 @@ #include #include -#include "qwaylandshellsurface_p.h" +#include QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandxdgsurface_p.h b/src/plugins/platforms/wayland/qwaylandxdgsurface_p.h index 1ce029af88c..27decabb4e6 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgsurface_p.h +++ b/src/plugins/platforms/wayland/qwaylandxdgsurface_p.h @@ -56,9 +56,9 @@ #include -#include #include -#include "qwaylandshellsurface_p.h" +#include +#include QT_BEGIN_NAMESPACE From f4dad859c6adf04040472e86fd345350d23b4f01 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Fri, 23 Sep 2016 15:02:39 +0200 Subject: [PATCH 0360/1507] Document 3rd party code in Qt Wayland MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Unfortunately the QPA plugin for Qt Wayland does not have a dedicated help, which is why everything is right now crammed into the compositor documentaton. Change-Id: Iddc4d67a817f2cc3bb334b2f040fa55230b5da4f Reviewed-by: Topi Reiniö --- .../wayland/protocols/HPND_LICENSE.txt | 20 ++++++ .../wayland/protocols/MIT_LICENSE.txt | 18 +++++ .../wayland/protocols/qt_attribution.json | 70 +++++++++++++++++++ 3 files changed, 108 insertions(+) create mode 100644 src/3rdparty/wayland/protocols/HPND_LICENSE.txt create mode 100644 src/3rdparty/wayland/protocols/MIT_LICENSE.txt create mode 100644 src/3rdparty/wayland/protocols/qt_attribution.json diff --git a/src/3rdparty/wayland/protocols/HPND_LICENSE.txt b/src/3rdparty/wayland/protocols/HPND_LICENSE.txt new file mode 100644 index 00000000000..e7a4915da0a --- /dev/null +++ b/src/3rdparty/wayland/protocols/HPND_LICENSE.txt @@ -0,0 +1,20 @@ +Permission to use, copy, modify, distribute, and sell this +software and its documentation for any purpose is hereby granted +without fee, provided that the above copyright notice appear in +all copies and that both that copyright notice and this permission +notice appear in supporting documentation, and that the name of +the copyright holders not be used in advertising or publicity +pertaining to distribution of the software without specific, +written prior permission. The copyright holders make no +representations about the suitability of this software for any +purpose. It is provided "as is" without express or implied +warranty. + +THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS +SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY +SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN +AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF +THIS SOFTWARE. diff --git a/src/3rdparty/wayland/protocols/MIT_LICENSE.txt b/src/3rdparty/wayland/protocols/MIT_LICENSE.txt new file mode 100644 index 00000000000..edc2e5fb5e0 --- /dev/null +++ b/src/3rdparty/wayland/protocols/MIT_LICENSE.txt @@ -0,0 +1,18 @@ +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. diff --git a/src/3rdparty/wayland/protocols/qt_attribution.json b/src/3rdparty/wayland/protocols/qt_attribution.json new file mode 100644 index 00000000000..327c408b961 --- /dev/null +++ b/src/3rdparty/wayland/protocols/qt_attribution.json @@ -0,0 +1,70 @@ +[ + { + "Id": "wayland-protocol", + "Name": "Wayland Protocol", + "QDocModule": "qtwaylandcompositor", + "QtUsage": "Used in the Qt Wayland Compositor, and the Qt Wayland platform plugin.", + + "Description": "Wayland is a protocol for a compositor to talk to its clients.", + "Homepage": "https://wayland.freedesktop.org", + "Version": "1.6.1", + "DownloadLocation": "https://cgit.freedesktop.org/wayland/wayland/tag/?id=1.6.1", + "LicenseId": "HPND", + "License": "HPND License", + "LicenseFile": "HPND_LICENSE.txt", + "Copyright": "Copyright © 2008-2011 Kristian Høgsberg + Copyright © 2010-2011 Intel Corporation + Copyright © 2012-2013 Collabora, Ltd." + }, + + { + "Id": "wayland-ivi-extension-protocol", + "Name": "Wayland IVI Extension Protocol", + "QDocModule": "qtwaylandcompositor", + "QtUsage": "Used in the Qt Wayland Compositor, and the Qt Wayland platform plugin.", + + "Description": "\"Wayland IVI Extension\" is forked from IVI Layer Management to define a common set of APIs by wayland style protocol and provide reference implementation which can be loaded on Weston.", + "Homepage": "http://projects.genivi.org/wayland-ivi-extension", + "Version": "1.9.1", + "DownloadLocation": "http://git.projects.genivi.org/?p=wayland-ivi-extension.git;a=commit;h=44598504503eea5ac7f94c88477a5a78bda01f30", + "LicenseId": "MIT", + "License": "MIT License", + "LicenseFile": "MIT_LICENSE.txt", + "Copyright": "Copyright (C) 2013 DENSO CORPORATION +Copyright (c) 2013 BMW Car IT GmbH" + }, + + { + "Id": "wayland-xdg-shell-protocol", + "Name": "Wayland XDG Shell Protocol", + "QDocModule": "qtwaylandcompositor", + "QtUsage": "Used in the Qt Wayland Compositor, and the Qt Wayland platform plugin.", + + "Description": "The XDG-Shell protocol is an extended way to manage surfaces under Wayland compositors.", + "Homepage": "https://wayland.freedesktop.org", + "Version": "1.9.0", + "DownloadLocation": "https://cgit.freedesktop.org/wayland/weston/tag/?id=1.9.0", + "LicenseId": "MIT", + "License": "MIT License", + "LicenseFile": "MIT_LICENSE.txt", + "Copyright": "Copyright © 2008-2013 Kristian Høgsberg +Copyright © 2013 Rafael Antognolli +Copyright © 2013 Jasper St. Pierre +Copyright © 2010-2013 Intel Corporation" + }, + + { + "Id": "wayland-txt-input-unstable", + "Name": "Wayland Text Input Protocol", + "QDocModule": "qtwaylandcompositor", + "QtUsage": "Used in the Qt Wayland Compositor, and the Qt Wayland platform plugin.", + + "Description": "Adds support for text input and input methods to applications.", + "Homepage": "https://wayland.freedesktop.org", + "LicenseId": "HPND", + "License": "HPND License", + "LicenseFile": "HPND_LICENSE.txt", + "Copyright": "Copyright © 2012, 2013 Intel Corporation +Copyright © 2015, 2016 Jan Arne Petersen" + } +] From 16502a3dbca457adf864e93c15e5a21d1c93d5d4 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Tue, 4 Oct 2016 14:38:04 +0200 Subject: [PATCH 0361/1507] Make sure we send frameSwapped signals QWaylandWindow::deliverUpdateRequest() may trigger a new requestUpdate, so we must clear the mUpdateRequested flag first, so we don't accidentally clear the flag that belongs to the next update. Fixes missing updates on brcm-egl. Change-Id: Ib0decd5e8eb58505ccb94e93de494163ce0fd2ec Reviewed-by: Paul Olav Tvete --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 9c42ac49c91..e8f3ceb4fa0 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -494,8 +494,8 @@ void QWaylandWindow::frameCallback(void *data, struct wl_callback *callback, uin self->mFrameCallback = 0; if (self->mUpdateRequested) { QWindowPrivate *w = QWindowPrivate::get(self->window()); - w->deliverUpdateRequest(); self->mUpdateRequested = false; + w->deliverUpdateRequest(); } } From 50c2ed1b9d9e9176acb6225ebd82a3373fe22817 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Tue, 4 Oct 2016 16:45:15 +0200 Subject: [PATCH 0362/1507] Fix race condition on mFrameCallback Don't try to destroy the callback from two different threads. This caused a crash with brcm-egl. Change-Id: Idcb18fca9ed7f84902b88212c0cebd67932a59d3 Reviewed-by: Johan Helsing --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 14 ++++++-------- src/plugins/platforms/wayland/qwaylandwindow_p.h | 3 ++- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index e8f3ceb4fa0..59c446bb300 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -83,7 +83,7 @@ QWaylandWindow::QWaylandWindow(QWindow *window) , mMousePressedInContentArea(Qt::NoButton) , m_cursor(Qt::ArrowCursor) , mWaitingForFrameSync(false) - , mFrameCallback(0) + , mFrameCallback(nullptr) , mRequestResizeSent(false) , mCanResize(true) , mResizeDirty(false) @@ -453,14 +453,12 @@ void QWaylandWindow::requestResize() void QWaylandWindow::attach(QWaylandBuffer *buffer, int x, int y) { - if (mFrameCallback) { - wl_callback_destroy(mFrameCallback); - mFrameCallback = 0; - } + mFrameCallback = nullptr; if (buffer) { - mFrameCallback = frame(); - wl_callback_add_listener(mFrameCallback, &QWaylandWindow::callbackListener, this); + auto callback = frame(); + wl_callback_add_listener(callback, &QWaylandWindow::callbackListener, this); + mFrameCallback = callback; mWaitingForFrameSync = true; attach(buffer->buffer(), x, y); @@ -491,7 +489,7 @@ void QWaylandWindow::frameCallback(void *data, struct wl_callback *callback, uin self->mWaitingForFrameSync = false; wl_callback_destroy(callback); - self->mFrameCallback = 0; + self->mFrameCallback.testAndSetRelaxed(callback, nullptr); if (self->mUpdateRequested) { QWindowPrivate *w = QWindowPrivate::get(self->window()); self->mUpdateRequested = false; diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index 03c4a1e484f..e0c42ace53d 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -53,6 +53,7 @@ #include #include +#include #include #include @@ -220,7 +221,7 @@ protected: WId mWindowId; bool mWaitingForFrameSync; - struct wl_callback *mFrameCallback; + QAtomicPointer mFrameCallback; QWaitCondition mFrameSyncWait; QMutex mResizeLock; From 2f496838f6dd7191f383c52801e211c4f016abc5 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Mon, 10 Oct 2016 13:10:33 +0200 Subject: [PATCH 0363/1507] Fix failing test for touch drag Don't send both touch down and touch move in the same frame. This confuses mouse synthesis. Task-number: QTBUG-56433 Change-Id: I7f0b88d6a27c87464c26ce1c194dc7f07a0eb382 Reviewed-by: Paul Olav Tvete --- tests/auto/wayland/client/tst_client.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/auto/wayland/client/tst_client.cpp b/tests/auto/wayland/client/tst_client.cpp index 74363ef5fa0..0749239f8ed 100644 --- a/tests/auto/wayland/client/tst_client.cpp +++ b/tests/auto/wayland/client/tst_client.cpp @@ -300,6 +300,7 @@ void tst_WaylandClient::touchDrag() const int id = 0; compositor->sendTouchDown(surface, QPoint(10, 10), id); + compositor->sendTouchFrame(surface); compositor->sendTouchMotion(surface, QPoint(20, 20), id); compositor->sendTouchFrame(surface); compositor->waitForStartDrag(); From 174b7a9a30dfb3e14c3fc671654ca2cea7ed501c Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Mon, 10 Oct 2016 18:01:43 +0200 Subject: [PATCH 0364/1507] Clients tests: Don't send leave events for destroyed surfaces Change-Id: Ia7dd13f629439b116f494ff8b7432020a65ea1df Reviewed-by: Paul Olav Tvete --- tests/auto/wayland/client/mockcompositor.cpp | 6 ++---- tests/auto/wayland/client/mockinput.cpp | 16 ++++++++++++++++ tests/auto/wayland/client/mockinput.h | 2 ++ 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/tests/auto/wayland/client/mockcompositor.cpp b/tests/auto/wayland/client/mockcompositor.cpp index 45a35ea7d96..2c5f2541fde 100644 --- a/tests/auto/wayland/client/mockcompositor.cpp +++ b/tests/auto/wayland/client/mockcompositor.cpp @@ -362,10 +362,8 @@ void Compositor::addSurface(Surface *surface) void Compositor::removeSurface(Surface *surface) { m_surfaces.removeOne(surface); - if (m_keyboard->focus() == surface) - m_keyboard->setFocus(0); - if (m_pointer->focus() == surface) - m_pointer->setFocus(0, QPoint()); + m_keyboard->handleSurfaceDestroyed(surface); + m_pointer->handleSurfaceDestroyed(surface); } } diff --git a/tests/auto/wayland/client/mockinput.cpp b/tests/auto/wayland/client/mockinput.cpp index fe06bf79bae..99acdd43a75 100644 --- a/tests/auto/wayland/client/mockinput.cpp +++ b/tests/auto/wayland/client/mockinput.cpp @@ -267,6 +267,14 @@ void Keyboard::setFocus(Surface *surface) m_focus = surface; } +void Keyboard::handleSurfaceDestroyed(Surface *surface) +{ + if (surface == m_focus) { + m_focusResource = nullptr; + m_focus = nullptr; + } +} + void Keyboard::sendKey(uint32_t key, uint32_t state) { if (m_focusResource) { @@ -314,6 +322,14 @@ void Pointer::setFocus(Surface *surface, const QPoint &pos) m_focus = surface; } +void Pointer::handleSurfaceDestroyed(Surface *surface) +{ + if (m_focus == surface) { + m_focus = nullptr; + m_focusResource = nullptr; + } +} + void Pointer::sendMotion(const QPoint &pos) { if (m_focusResource) diff --git a/tests/auto/wayland/client/mockinput.h b/tests/auto/wayland/client/mockinput.h index 031be2a4ad0..7e88ffb0fac 100644 --- a/tests/auto/wayland/client/mockinput.h +++ b/tests/auto/wayland/client/mockinput.h @@ -75,6 +75,7 @@ public: Surface *focus() const { return m_focus; } void setFocus(Surface *surface); + void handleSurfaceDestroyed(Surface *surface); void sendKey(uint32_t key, uint32_t state); @@ -97,6 +98,7 @@ public: Surface *focus() const { return m_focus; } void setFocus(Surface *surface, const QPoint &pos); + void handleSurfaceDestroyed(Surface *surface); void sendMotion(const QPoint &pos); void sendButton(uint32_t button, uint32_t state); From a33cc547055eb12c5efa82a6612cbf8793988b72 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Mon, 10 Oct 2016 17:52:15 +0200 Subject: [PATCH 0365/1507] Client: Remove windows from keyboard focus list when destroyed This fixes the undefined behavior in tst_WaylandClient::touchDrag and mouseDrag Note: The test still fails if run twice in a row, but it appears to be deterministic. Task-number: QTBUG-56187 Change-Id: Ib45d82224f004d1324f2ce4d6b7df05ee36c04f5 Reviewed-by: Paul Olav Tvete --- src/plugins/platforms/wayland/qwaylanddisplay.cpp | 6 ++++++ src/plugins/platforms/wayland/qwaylanddisplay_p.h | 3 ++- src/plugins/platforms/wayland/qwaylandwindow.cpp | 2 ++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index d94afcab5c9..3fd2aa56515 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -422,6 +422,12 @@ void QWaylandDisplay::handleKeyboardFocusChanged(QWaylandInputDevice *inputDevic mLastKeyboardFocus = keyboardFocus; } +void QWaylandDisplay::handleWindowDestroyed(QWaylandWindow *window) +{ + if (mActiveWindows.contains(window)) + handleWindowDeactivated(window); +} + void QWaylandDisplay::handleWaylandSync() { // This callback is used to set the window activation because we may get an activate/deactivate diff --git a/src/plugins/platforms/wayland/qwaylanddisplay_p.h b/src/plugins/platforms/wayland/qwaylanddisplay_p.h index f4fb3fa56a8..2864b357d80 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay_p.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay_p.h @@ -176,6 +176,7 @@ public: void handleWindowActivated(QWaylandWindow *window); void handleWindowDeactivated(QWaylandWindow *window); void handleKeyboardFocusChanged(QWaylandInputDevice *inputDevice); + void handleWindowDestroyed(QWaylandWindow *window); public slots: void blockingReadEvents(); @@ -217,7 +218,7 @@ private: uint32_t mLastInputSerial; QWaylandInputDevice *mLastInputDevice; QPointer mLastInputWindow; - QWaylandWindow *mLastKeyboardFocus; + QPointer mLastKeyboardFocus; QVector mActiveWindows; struct wl_callback *mSyncCallback; static const wl_callback_listener syncCallbackListener; diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 59c446bb300..2b7d81f8897 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -102,6 +102,8 @@ QWaylandWindow::QWaylandWindow(QWindow *window) QWaylandWindow::~QWaylandWindow() { + mDisplay->handleWindowDestroyed(this); + delete mWindowDecoration; if (isInitialized()) From 38503100519ca8d9716376f1d0fd9379ce26c27b Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Tue, 11 Oct 2016 11:35:14 +0200 Subject: [PATCH 0366/1507] Don't try to deliver event to destroyed window Change-Id: If1c57250e2dc9e0d55767bbdfb15c3e3f5d9b333 Reviewed-by: Johan Helsing --- src/plugins/platforms/wayland/qwaylanddatadevice.cpp | 3 ++- src/plugins/platforms/wayland/qwaylanddatadevice_p.h | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylanddatadevice.cpp b/src/plugins/platforms/wayland/qwaylanddatadevice.cpp index 0ff1f19794a..d04c20bf4d6 100644 --- a/src/plugins/platforms/wayland/qwaylanddatadevice.cpp +++ b/src/plugins/platforms/wayland/qwaylanddatadevice.cpp @@ -183,7 +183,8 @@ void QWaylandDataDevice::data_device_enter(uint32_t serial, wl_surface *surface, void QWaylandDataDevice::data_device_leave() { - QWindowSystemInterface::handleDrag(m_dragWindow, 0, QPoint(), Qt::IgnoreAction); + if (m_dragWindow) + QWindowSystemInterface::handleDrag(m_dragWindow, 0, QPoint(), Qt::IgnoreAction); QDrag *drag = static_cast(QGuiApplicationPrivate::platformIntegration()->drag())->currentDrag(); if (!drag) { diff --git a/src/plugins/platforms/wayland/qwaylanddatadevice_p.h b/src/plugins/platforms/wayland/qwaylanddatadevice_p.h index 579cb3c7c7c..7daa9f0d3c8 100644 --- a/src/plugins/platforms/wayland/qwaylanddatadevice_p.h +++ b/src/plugins/platforms/wayland/qwaylanddatadevice_p.h @@ -53,6 +53,7 @@ // #include +#include #include #include @@ -106,7 +107,7 @@ private: QWaylandDisplay *m_display; QWaylandInputDevice *m_inputDevice; uint32_t m_enterSerial; - QWindow *m_dragWindow; + QPointer m_dragWindow; QPoint m_dragPoint; QScopedPointer m_dragOffer; QScopedPointer m_selectionOffer; From 039f8acf6a155349a810db6d8ceec7259fff2ed2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Tue, 11 Oct 2016 13:06:51 +0200 Subject: [PATCH 0367/1507] Call formatWindowTitle on the window title According to QWidget::setWindowTitle documentation the QPA plugin is responsible for adding the application name to the window title. As it's supposed to be done for Unix platform the Wayland QPA also needs to perform this task. Task-number: QTBUG-56475 Change-Id: Ib261c68d08ca06d1ec4734c8c215a4ceb059fae3 Reviewed-by: Johan Helsing Reviewed-by: Pier Luigi Fiorini --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index eb9c1409415..aa7b57817ab 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -137,7 +137,7 @@ void QWaylandWindow::initWindow() if (mShellSurface) { // Set initial surface title - mShellSurface->setTitle(window()->title()); + setWindowTitle(window()->title()); // The appId is the desktop entry identifier that should follow the // reverse DNS convention (see http://standards.freedesktop.org/desktop-entry-spec/latest/ar01s02.html). @@ -258,7 +258,8 @@ void QWaylandWindow::setParent(const QPlatformWindow *parent) void QWaylandWindow::setWindowTitle(const QString &title) { if (mShellSurface) { - mShellSurface->setTitle(title); + const QString separator = QString::fromUtf8(" \xe2\x80\x94 "); // unicode character U+2014, EM DASH + mShellSurface->setTitle(formatWindowTitle(title, separator)); } if (mWindowDecoration && window()->isVisible()) From 0f8195c08eef970d0886cfc0fcc03fd5d168494c Mon Sep 17 00:00:00 2001 From: Giulio Camuffo Date: Sat, 15 Oct 2016 09:29:54 +0200 Subject: [PATCH 0368/1507] Don't return a null QMimeData from the clipboard The documentation for QClipboard::mimeData() doesn't say that the returned value can be null, and some clients just dereference that without checking. So instead return an empty QMimeData. Change-Id: Ieec3140af4e7f33cde98ed96fd96b2674d0d0f9f Reviewed-by: Pier Luigi Fiorini Reviewed-by: Johan Helsing --- src/plugins/platforms/wayland/qwaylandclipboard.cpp | 6 +++--- src/plugins/platforms/wayland/qwaylandclipboard_p.h | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandclipboard.cpp b/src/plugins/platforms/wayland/qwaylandclipboard.cpp index a2b7a6697de..5399e79d118 100644 --- a/src/plugins/platforms/wayland/qwaylandclipboard.cpp +++ b/src/plugins/platforms/wayland/qwaylandclipboard.cpp @@ -54,11 +54,11 @@ QWaylandClipboard::~QWaylandClipboard() QMimeData *QWaylandClipboard::mimeData(QClipboard::Mode mode) { if (mode != QClipboard::Clipboard) - return 0; + return &m_emptyData; QWaylandInputDevice *inputDevice = mDisplay->currentInputDevice(); if (!inputDevice || !inputDevice->dataDevice()) - return 0; + return &m_emptyData; QWaylandDataSource *source = inputDevice->dataDevice()->selectionSource(); if (source) { @@ -68,7 +68,7 @@ QMimeData *QWaylandClipboard::mimeData(QClipboard::Mode mode) if (inputDevice->dataDevice()->selectionOffer()) return inputDevice->dataDevice()->selectionOffer()->mimeData(); - return 0; + return &m_emptyData; } void QWaylandClipboard::setMimeData(QMimeData *data, QClipboard::Mode mode) diff --git a/src/plugins/platforms/wayland/qwaylandclipboard_p.h b/src/plugins/platforms/wayland/qwaylandclipboard_p.h index 02223076e1f..e9344c5f37c 100644 --- a/src/plugins/platforms/wayland/qwaylandclipboard_p.h +++ b/src/plugins/platforms/wayland/qwaylandclipboard_p.h @@ -47,6 +47,7 @@ #include #include +#include #include @@ -70,6 +71,7 @@ public: private: QWaylandDisplay *mDisplay; + QMimeData m_emptyData; }; } From e723b954a469767c29d6ff5b6fa8681ad1ae463d Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 14 Oct 2016 14:02:44 +0200 Subject: [PATCH 0369/1507] fix namespaced build. *again* MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I3cbc3efdac61a9f329d0796c64885e6565bd0b77 Reviewed-by: Giulio Camuffo Reviewed-by: Jędrzej Nowacki --- src/plugins/platforms/wayland/global/qwaylandclientextension.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/plugins/platforms/wayland/global/qwaylandclientextension.h b/src/plugins/platforms/wayland/global/qwaylandclientextension.h index afb3f868fba..3d80baaa1ac 100644 --- a/src/plugins/platforms/wayland/global/qwaylandclientextension.h +++ b/src/plugins/platforms/wayland/global/qwaylandclientextension.h @@ -40,6 +40,7 @@ #include #include +struct wl_interface; struct wl_registry; QT_BEGIN_NAMESPACE From ac24d8341edc672b29623436a45232d8e4bd904e Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 29 Sep 2016 15:59:36 +0200 Subject: [PATCH 0370/1507] use modularized platformsupport modules Change-Id: I7883470e22deb089240d86df7dc2d625a107a53e Reviewed-by: Lars Knoll --- src/plugins/platforms/wayland/client.pro | 9 +++++++-- src/plugins/platforms/wayland/qwaylandintegration.cpp | 6 +++--- .../wayland/qwaylandwindowmanagerintegration_p.h | 2 +- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/plugins/platforms/wayland/client.pro b/src/plugins/platforms/wayland/client.pro index fa20367451c..34955dfbbe2 100644 --- a/src/plugins/platforms/wayland/client.pro +++ b/src/plugins/platforms/wayland/client.pro @@ -2,13 +2,18 @@ TARGET = QtWaylandClient MODULE = waylandclient QT += core-private gui-private -QT_FOR_PRIVATE += platformsupport-private +QT_FOR_PRIVATE += service_support-private +QT_PRIVATE += fontdatabase_support-private eventdispatcher_support-private theme_support-private # We have a bunch of C code with casts, so we can't have this option QMAKE_CXXFLAGS_WARN_ON -= -Wcast-qual +# Prevent gold linker from crashing. +# This started happening when QtPlatformSupport was modularized. +use_gold_linker: CONFIG += no_linker_version_script + CONFIG -= precompile_header -CONFIG += link_pkgconfig qpa/genericunixfontdatabase wayland-scanner +CONFIG += link_pkgconfig wayland-scanner contains(QT_CONFIG, opengl) { DEFINES += QT_WAYLAND_GL_SUPPORT diff --git a/src/plugins/platforms/wayland/qwaylandintegration.cpp b/src/plugins/platforms/wayland/qwaylandintegration.cpp index 0e9eb44d65a..48517fce191 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandintegration.cpp @@ -50,9 +50,9 @@ #include "qwaylandwindowmanagerintegration_p.h" #include "qwaylandscreen_p.h" -#include "QtPlatformSupport/private/qgenericunixfontdatabase_p.h" -#include -#include +#include +#include +#include #include diff --git a/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration_p.h b/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration_p.h index 0e5f67ac10e..09a79d48dc8 100644 --- a/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration_p.h @@ -55,7 +55,7 @@ #include #include -#include +#include #include #include From e8a4ffff205e8f1976f2787030bb36d3e58c49f6 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Mon, 10 Oct 2016 17:52:15 +0200 Subject: [PATCH 0371/1507] Client: Remove windows from keyboard focus list when destroyed This fixes the undefined behavior in tst_WaylandClient::touchDrag and mouseDrag Note: The test still fails if run twice in a row, but it appears to be deterministic. Task-number: QTBUG-56187 Change-Id: Ib45d82224f004d1324f2ce4d6b7df05ee36c04f5 Reviewed-by: Paul Olav Tvete (cherry picked from commit a33cc547055eb12c5efa82a6612cbf8793988b72) Reviewed-by: Johan Helsing --- src/plugins/platforms/wayland/qwaylanddisplay.cpp | 6 ++++++ src/plugins/platforms/wayland/qwaylanddisplay_p.h | 3 ++- src/plugins/platforms/wayland/qwaylandwindow.cpp | 2 ++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index ae28eb77970..f9a556f4db8 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -411,6 +411,12 @@ void QWaylandDisplay::handleKeyboardFocusChanged(QWaylandInputDevice *inputDevic mLastKeyboardFocus = keyboardFocus; } +void QWaylandDisplay::handleWindowDestroyed(QWaylandWindow *window) +{ + if (mActiveWindows.contains(window)) + handleWindowDeactivated(window); +} + void QWaylandDisplay::handleWaylandSync() { // This callback is used to set the window activation because we may get an activate/deactivate diff --git a/src/plugins/platforms/wayland/qwaylanddisplay_p.h b/src/plugins/platforms/wayland/qwaylanddisplay_p.h index ea127d2f4f0..a6591648106 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay_p.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay_p.h @@ -170,6 +170,7 @@ public: void handleWindowActivated(QWaylandWindow *window); void handleWindowDeactivated(QWaylandWindow *window); void handleKeyboardFocusChanged(QWaylandInputDevice *inputDevice); + void handleWindowDestroyed(QWaylandWindow *window); public slots: void blockingReadEvents(); @@ -211,7 +212,7 @@ private: uint32_t mLastInputSerial; QWaylandInputDevice *mLastInputDevice; QPointer mLastInputWindow; - QWaylandWindow *mLastKeyboardFocus; + QPointer mLastKeyboardFocus; QVector mActiveWindows; struct wl_callback *mSyncCallback; static const wl_callback_listener syncCallbackListener; diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index a1daa07f016..e504de37725 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -93,6 +93,8 @@ QWaylandWindow::QWaylandWindow(QWindow *window) QWaylandWindow::~QWaylandWindow() { + mDisplay->handleWindowDestroyed(this); + delete mWindowDecoration; if (isInitialized()) From cd36be21314471200f021474b1d00848541dd11e Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Mon, 10 Oct 2016 17:52:15 +0200 Subject: [PATCH 0372/1507] Client: Remove windows from keyboard focus list when destroyed This fixes the undefined behavior in tst_WaylandClient::touchDrag and mouseDrag Note: The test still fails if run twice in a row, but it appears to be deterministic. Task-number: QTBUG-56187 Change-Id: Ib45d82224f004d1324f2ce4d6b7df05ee36c04f5 Reviewed-by: Paul Olav Tvete (cherry picked from commit a33cc547055eb12c5efa82a6612cbf8793988b72) Reviewed-by: Johan Helsing --- src/plugins/platforms/wayland/qwaylanddisplay.cpp | 6 ++++++ src/plugins/platforms/wayland/qwaylanddisplay_p.h | 3 ++- src/plugins/platforms/wayland/qwaylandwindow.cpp | 2 ++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index a5e61e28a73..6e167f3030f 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -421,6 +421,12 @@ void QWaylandDisplay::handleKeyboardFocusChanged(QWaylandInputDevice *inputDevic mLastKeyboardFocus = keyboardFocus; } +void QWaylandDisplay::handleWindowDestroyed(QWaylandWindow *window) +{ + if (mActiveWindows.contains(window)) + handleWindowDeactivated(window); +} + void QWaylandDisplay::handleWaylandSync() { // This callback is used to set the window activation because we may get an activate/deactivate diff --git a/src/plugins/platforms/wayland/qwaylanddisplay_p.h b/src/plugins/platforms/wayland/qwaylanddisplay_p.h index f4fb3fa56a8..2864b357d80 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay_p.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay_p.h @@ -176,6 +176,7 @@ public: void handleWindowActivated(QWaylandWindow *window); void handleWindowDeactivated(QWaylandWindow *window); void handleKeyboardFocusChanged(QWaylandInputDevice *inputDevice); + void handleWindowDestroyed(QWaylandWindow *window); public slots: void blockingReadEvents(); @@ -217,7 +218,7 @@ private: uint32_t mLastInputSerial; QWaylandInputDevice *mLastInputDevice; QPointer mLastInputWindow; - QWaylandWindow *mLastKeyboardFocus; + QPointer mLastKeyboardFocus; QVector mActiveWindows; struct wl_callback *mSyncCallback; static const wl_callback_listener syncCallbackListener; diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index eb9c1409415..7256451911f 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -102,6 +102,8 @@ QWaylandWindow::QWaylandWindow(QWindow *window) QWaylandWindow::~QWaylandWindow() { + mDisplay->handleWindowDestroyed(this); + delete mWindowDecoration; if (isInitialized()) From bac96606a67920593b250adac65210b1696a3e43 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Thu, 23 Jun 2016 11:53:52 +0200 Subject: [PATCH 0373/1507] Client: Call parent requestUpdate after changing subsurface position Calling setPosition on a child window would not send the appropriate commit request after the wl_subsurface.set_position request. Task-number: QTBUG-52118 Change-Id: I792016ce7e0a5a2efd3a32a98727b43ee0275b0e Reviewed-by: Paul Olav Tvete Reviewed-by: Giulio Camuffo --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index e504de37725..4c00110bc05 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -262,6 +262,7 @@ void QWaylandWindow::setGeometry_helper(const QRect &rect) if (mSubSurfaceWindow) { QMargins m = QPlatformWindow::parent()->frameMargins(); mSubSurfaceWindow->set_position(rect.x() + m.left(), rect.y() + m.top()); + mSubSurfaceWindow->parent()->window()->requestUpdate(); } else if (shellSurface() && window()->transientParent() && window()->type() != Qt::Popup) shellSurface()->updateTransientParent(window()->transientParent()); } @@ -638,6 +639,8 @@ bool QWaylandWindow::createDecoration() QMargins m = frameMargins(); subsurf->set_position(pos.x() + m.left(), pos.y() + m.top()); } + if (!mChildren.isEmpty()) + window()->requestUpdate(); } return mWindowDecoration; From fec8cd87e0555e763b8ef405a34afbcfaa9dd9f2 Mon Sep 17 00:00:00 2001 From: Giulio Camuffo Date: Mon, 10 Oct 2016 16:26:24 +0200 Subject: [PATCH 0374/1507] Fix memory leaks Several fields in QWaylandIntegration were never deleted, so use QScopedPointer to handle that. Also use QScopedPointer for all the heap allocated fields of the class. Change-Id: I4c33be4157a6e17abfa1610f84ef9a88afe5f38a Reviewed-by: Pier Luigi Fiorini Reviewed-by: Johan Helsing --- .../platforms/wayland/qwaylandintegration.cpp | 65 ++++++++----------- .../platforms/wayland/qwaylandintegration_p.h | 22 ++++--- 2 files changed, 40 insertions(+), 47 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandintegration.cpp b/src/plugins/platforms/wayland/qwaylandintegration.cpp index 48517fce191..3e263061019 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandintegration.cpp @@ -119,7 +119,6 @@ public: QWaylandIntegration::QWaylandIntegration() : mClientBufferIntegration(0) - , mShellIntegration(Q_NULLPTR) , mInputDeviceIntegration(Q_NULLPTR) , mFontDb(new QGenericUnixFontDatabase()) , mNativeInterface(new QWaylandNativeInterface(this)) @@ -131,16 +130,16 @@ QWaylandIntegration::QWaylandIntegration() , mShellIntegrationInitialized(false) { initializeInputDeviceIntegration(); - mDisplay = new QWaylandDisplay(this); - mClipboard = new QWaylandClipboard(mDisplay); - mDrag = new QWaylandDrag(mDisplay); + mDisplay.reset(new QWaylandDisplay(this)); + mClipboard.reset(new QWaylandClipboard(mDisplay.data())); + mDrag.reset(new QWaylandDrag(mDisplay.data())); QString icStr = QPlatformInputContextFactory::requested(); if (!icStr.isNull()) { mInputContext.reset(QPlatformInputContextFactory::create(icStr)); } else { //try to use the input context using the wl_text_input interface - QPlatformInputContext *ctx = new QWaylandInputContext(mDisplay); + QPlatformInputContext *ctx = new QWaylandInputContext(mDisplay.data()); mInputContext.reset(ctx); //use the traditional way for on screen keyboards for now @@ -153,18 +152,11 @@ QWaylandIntegration::QWaylandIntegration() QWaylandIntegration::~QWaylandIntegration() { - delete mDrag; - delete mClipboard; -#ifndef QT_NO_ACCESSIBILITY - delete mAccessibility; -#endif - delete mNativeInterface; - delete mDisplay; } QPlatformNativeInterface * QWaylandIntegration::nativeInterface() const { - return mNativeInterface; + return mNativeInterface.data(); } bool QWaylandIntegration::hasCapability(QPlatformIntegration::Capability cap) const @@ -217,27 +209,27 @@ QAbstractEventDispatcher *QWaylandIntegration::createEventDispatcher() const void QWaylandIntegration::initialize() { QAbstractEventDispatcher *dispatcher = QGuiApplicationPrivate::eventDispatcher; - QObject::connect(dispatcher, SIGNAL(aboutToBlock()), mDisplay, SLOT(flushRequests())); - QObject::connect(dispatcher, SIGNAL(awake()), mDisplay, SLOT(flushRequests())); + QObject::connect(dispatcher, SIGNAL(aboutToBlock()), mDisplay.data(), SLOT(flushRequests())); + QObject::connect(dispatcher, SIGNAL(awake()), mDisplay.data(), SLOT(flushRequests())); int fd = wl_display_get_fd(mDisplay->wl_display()); - QSocketNotifier *sn = new QSocketNotifier(fd, QSocketNotifier::Read, mDisplay); - QObject::connect(sn, SIGNAL(activated(int)), mDisplay, SLOT(flushRequests())); + QSocketNotifier *sn = new QSocketNotifier(fd, QSocketNotifier::Read, mDisplay.data()); + QObject::connect(sn, SIGNAL(activated(int)), mDisplay.data(), SLOT(flushRequests())); } QPlatformFontDatabase *QWaylandIntegration::fontDatabase() const { - return mFontDb; + return mFontDb.data(); } QPlatformClipboard *QWaylandIntegration::clipboard() const { - return mClipboard; + return mClipboard.data(); } QPlatformDrag *QWaylandIntegration::drag() const { - return mDrag; + return mDrag.data(); } QPlatformInputContext *QWaylandIntegration::inputContext() const @@ -263,7 +255,7 @@ QVariant QWaylandIntegration::styleHint(StyleHint hint) const #ifndef QT_NO_ACCESSIBILITY QPlatformAccessibility *QWaylandIntegration::accessibility() const { - return mAccessibility; + return mAccessibility.data(); } #endif @@ -274,7 +266,7 @@ QPlatformServices *QWaylandIntegration::services() const QWaylandDisplay *QWaylandIntegration::display() const { - return mDisplay; + return mDisplay.data(); } QStringList QWaylandIntegration::themeNames() const @@ -292,7 +284,7 @@ QWaylandClientBufferIntegration *QWaylandIntegration::clientBufferIntegration() if (!mClientBufferIntegrationInitialized) const_cast(this)->initializeClientBufferIntegration(); - return mClientBufferIntegration && mClientBufferIntegration->isValid() ? mClientBufferIntegration : 0; + return mClientBufferIntegration && mClientBufferIntegration->isValid() ? mClientBufferIntegration.data() : nullptr; } QWaylandServerBufferIntegration *QWaylandIntegration::serverBufferIntegration() const @@ -300,7 +292,7 @@ QWaylandServerBufferIntegration *QWaylandIntegration::serverBufferIntegration() if (!mServerBufferIntegrationInitialized) const_cast(this)->initializeServerBufferIntegration(); - return mServerBufferIntegration; + return mServerBufferIntegration.data(); } QWaylandShellIntegration *QWaylandIntegration::shellIntegration() const @@ -308,7 +300,7 @@ QWaylandShellIntegration *QWaylandIntegration::shellIntegration() const if (!mShellIntegrationInitialized) const_cast(this)->initializeShellIntegration(); - return mShellIntegration; + return mShellIntegration.data(); } void QWaylandIntegration::initializeClientBufferIntegration() @@ -334,10 +326,10 @@ void QWaylandIntegration::initializeClientBufferIntegration() QStringList keys = QWaylandClientBufferIntegrationFactory::keys(); if (keys.contains(targetKey)) { - mClientBufferIntegration = QWaylandClientBufferIntegrationFactory::create(targetKey, QStringList()); + mClientBufferIntegration.reset(QWaylandClientBufferIntegrationFactory::create(targetKey, QStringList())); } if (mClientBufferIntegration) - mClientBufferIntegration->initialize(mDisplay); + mClientBufferIntegration->initialize(mDisplay.data()); else qWarning("Failed to load client buffer integration: %s\n", qPrintable(targetKey)); } @@ -364,10 +356,10 @@ void QWaylandIntegration::initializeServerBufferIntegration() QStringList keys = QWaylandServerBufferIntegrationFactory::keys(); if (keys.contains(targetKey)) { - mServerBufferIntegration = QWaylandServerBufferIntegrationFactory::create(targetKey, QStringList()); + mServerBufferIntegration.reset(QWaylandServerBufferIntegrationFactory::create(targetKey, QStringList())); } if (mServerBufferIntegration) - mServerBufferIntegration->initialize(mDisplay); + mServerBufferIntegration->initialize(mDisplay.data()); else qWarning("Failed to load server buffer integration %s\n", qPrintable(targetKey)); } @@ -383,7 +375,7 @@ void QWaylandIntegration::initializeShellIntegration() QStringList keys = QWaylandShellIntegrationFactory::keys(); if (keys.contains(targetKey)) { qDebug("Using the '%s' shell integration", qPrintable(targetKey)); - mShellIntegration = QWaylandShellIntegrationFactory::create(targetKey, QStringList()); + mShellIntegration.reset(QWaylandShellIntegrationFactory::create(targetKey, QStringList())); } } else { QStringList preferredShells; @@ -393,15 +385,14 @@ void QWaylandIntegration::initializeShellIntegration() Q_FOREACH (QString preferredShell, preferredShells) { if (mDisplay->hasRegistryGlobal(preferredShell)) { - mShellIntegration = createShellIntegration(preferredShell); + mShellIntegration.reset(createShellIntegration(preferredShell)); break; } } } - if (!mShellIntegration || !mShellIntegration->initialize(mDisplay)) { - delete mShellIntegration; - mShellIntegration = Q_NULLPTR; + if (!mShellIntegration || !mShellIntegration->initialize(mDisplay.data())) { + mShellIntegration.reset(); qWarning("Failed to load shell integration %s", qPrintable(targetKey)); } } @@ -425,7 +416,7 @@ void QWaylandIntegration::initializeInputDeviceIntegration() QStringList keys = QWaylandInputDeviceIntegrationFactory::keys(); if (keys.contains(targetKey)) { - mInputDeviceIntegration = QWaylandInputDeviceIntegrationFactory::create(targetKey, QStringList()); + mInputDeviceIntegration.reset(QWaylandInputDeviceIntegrationFactory::create(targetKey, QStringList())); qDebug("Using the '%s' input device integration", qPrintable(targetKey)); } else { qWarning("Wayland inputdevice integration '%s' not found, using default", qPrintable(targetKey)); @@ -435,9 +426,9 @@ void QWaylandIntegration::initializeInputDeviceIntegration() QWaylandShellIntegration *QWaylandIntegration::createShellIntegration(const QString &interfaceName) { if (interfaceName == QLatin1Literal("wl_shell")) { - return new QWaylandWlShellIntegration(mDisplay); + return new QWaylandWlShellIntegration(mDisplay.data()); } else if (interfaceName == QLatin1Literal("xdg_shell")) { - return new QWaylandXdgShellIntegration(mDisplay); + return new QWaylandXdgShellIntegration(mDisplay.data()); } else { return Q_NULLPTR; } diff --git a/src/plugins/platforms/wayland/qwaylandintegration_p.h b/src/plugins/platforms/wayland/qwaylandintegration_p.h index 9a499022981..bd66f55a775 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration_p.h +++ b/src/plugins/platforms/wayland/qwaylandintegration_p.h @@ -54,6 +54,8 @@ #include #include +#include + QT_BEGIN_NAMESPACE namespace QtWaylandClient { @@ -113,10 +115,10 @@ public: virtual QWaylandShellIntegration *shellIntegration() const; protected: - QWaylandClientBufferIntegration *mClientBufferIntegration; - QWaylandServerBufferIntegration *mServerBufferIntegration; - QWaylandShellIntegration *mShellIntegration; - QWaylandInputDeviceIntegration *mInputDeviceIntegration; + QScopedPointer mClientBufferIntegration; + QScopedPointer mServerBufferIntegration; + QScopedPointer mShellIntegration; + QScopedPointer mInputDeviceIntegration; private: void initializeClientBufferIntegration(); @@ -125,14 +127,14 @@ private: void initializeInputDeviceIntegration(); QWaylandShellIntegration *createShellIntegration(const QString& interfaceName); - QPlatformFontDatabase *mFontDb; - QPlatformClipboard *mClipboard; - QPlatformDrag *mDrag; - QWaylandDisplay *mDisplay; - QPlatformNativeInterface *mNativeInterface; + QScopedPointer mFontDb; + QScopedPointer mClipboard; + QScopedPointer mDrag; + QScopedPointer mDisplay; + QScopedPointer mNativeInterface; QScopedPointer mInputContext; #ifndef QT_NO_ACCESSIBILITY - QPlatformAccessibility *mAccessibility; + QScopedPointer mAccessibility; #endif bool mClientBufferIntegrationInitialized; bool mServerBufferIntegrationInitialized; From c1444d272ee326bfa386d500e941b24a695818ca Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Wed, 2 Nov 2016 14:24:52 +0100 Subject: [PATCH 0375/1507] Fix build when some features are disabled Make QtWaylandClient compile when Qt is configured with: -no-opengl -no-accessibility -D QT_NO_CLIPBOARD -D QT_NO_DRAGANDDROP -D QT_NO_SESSIONMANAGER Task-number: QTBUG-56192 Change-Id: Idc6aae6b36a35515109a27bed31a22e3e909ef27 Reviewed-by: Giulio Camuffo --- src/plugins/platforms/wayland/qwaylandclipboard.cpp | 4 ++++ src/plugins/platforms/wayland/qwaylandclipboard_p.h | 3 +++ src/plugins/platforms/wayland/qwaylanddatadevice.cpp | 4 ++++ src/plugins/platforms/wayland/qwaylanddatadevice_p.h | 4 ++++ .../platforms/wayland/qwaylanddatadevicemanager.cpp | 4 ++++ .../platforms/wayland/qwaylanddatadevicemanager_p.h | 4 ++++ src/plugins/platforms/wayland/qwaylanddataoffer.cpp | 4 ++++ src/plugins/platforms/wayland/qwaylanddataoffer_p.h | 3 ++- src/plugins/platforms/wayland/qwaylanddatasource.cpp | 4 ++++ src/plugins/platforms/wayland/qwaylanddatasource_p.h | 4 ++++ src/plugins/platforms/wayland/qwaylanddisplay.cpp | 6 ++++++ src/plugins/platforms/wayland/qwaylanddisplay_p.h | 6 ++++-- src/plugins/platforms/wayland/qwaylanddnd.cpp | 4 ++-- src/plugins/platforms/wayland/qwaylanddnd_p.h | 4 ++-- src/plugins/platforms/wayland/qwaylandinputdevice.cpp | 3 ++- src/plugins/platforms/wayland/qwaylandintegration.cpp | 7 ++++++- src/plugins/platforms/wayland/qwaylandintegration_p.h | 7 ++++--- src/plugins/platforms/wayland/qwaylandnativeinterface.cpp | 2 ++ src/plugins/platforms/wayland/qwaylandnativeinterface_p.h | 3 ++- src/plugins/platforms/wayland/qwaylandwindow.cpp | 2 ++ 20 files changed, 69 insertions(+), 13 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandclipboard.cpp b/src/plugins/platforms/wayland/qwaylandclipboard.cpp index 5399e79d118..c661c1b65e5 100644 --- a/src/plugins/platforms/wayland/qwaylandclipboard.cpp +++ b/src/plugins/platforms/wayland/qwaylandclipboard.cpp @@ -38,6 +38,8 @@ #include "qwaylanddatasource_p.h" #include "qwaylanddatadevice_p.h" +#ifndef QT_NO_DRAGANDDROP + QT_BEGIN_NAMESPACE namespace QtWaylandClient { @@ -109,3 +111,5 @@ bool QWaylandClipboard::ownsMode(QClipboard::Mode mode) const } QT_END_NAMESPACE + +#endif // QT_NO_DRAGANDDROP diff --git a/src/plugins/platforms/wayland/qwaylandclipboard_p.h b/src/plugins/platforms/wayland/qwaylandclipboard_p.h index e9344c5f37c..d3553574106 100644 --- a/src/plugins/platforms/wayland/qwaylandclipboard_p.h +++ b/src/plugins/platforms/wayland/qwaylandclipboard_p.h @@ -51,6 +51,7 @@ #include +#ifndef QT_NO_DRAGANDDROP QT_BEGIN_NAMESPACE namespace QtWaylandClient { @@ -78,4 +79,6 @@ private: QT_END_NAMESPACE +#endif // QT_NO_DRAGANDDROP + #endif // QWAYLANDCLIPBOARD_H diff --git a/src/plugins/platforms/wayland/qwaylanddatadevice.cpp b/src/plugins/platforms/wayland/qwaylanddatadevice.cpp index 255b13f4c69..100331269e9 100644 --- a/src/plugins/platforms/wayland/qwaylanddatadevice.cpp +++ b/src/plugins/platforms/wayland/qwaylanddatadevice.cpp @@ -55,6 +55,8 @@ #include #include +#ifndef QT_NO_DRAGANDDROP + QT_BEGIN_NAMESPACE namespace QtWaylandClient { @@ -254,3 +256,5 @@ void QWaylandDataDevice::dragSourceTargetChanged(const QString &mimeType) } QT_END_NAMESPACE + +#endif // QT_NO_DRAGANDDROP diff --git a/src/plugins/platforms/wayland/qwaylanddatadevice_p.h b/src/plugins/platforms/wayland/qwaylanddatadevice_p.h index b87529e9b7b..04ff7b38fca 100644 --- a/src/plugins/platforms/wayland/qwaylanddatadevice_p.h +++ b/src/plugins/platforms/wayland/qwaylanddatadevice_p.h @@ -57,6 +57,8 @@ #include +#ifndef QT_NO_DRAGANDDROP + QT_BEGIN_NAMESPACE class QMimeData; @@ -117,4 +119,6 @@ private: QT_END_NAMESPACE +#endif // QT_NO_DRAGANDDROP + #endif // QWAYLANDDATADEVICE_H diff --git a/src/plugins/platforms/wayland/qwaylanddatadevicemanager.cpp b/src/plugins/platforms/wayland/qwaylanddatadevicemanager.cpp index b5a98b090e7..b3053d3c908 100644 --- a/src/plugins/platforms/wayland/qwaylanddatadevicemanager.cpp +++ b/src/plugins/platforms/wayland/qwaylanddatadevicemanager.cpp @@ -40,6 +40,8 @@ #include +#ifndef QT_NO_DRAGANDDROP + QT_BEGIN_NAMESPACE namespace QtWaylandClient { @@ -74,3 +76,5 @@ QWaylandDisplay *QWaylandDataDeviceManager::display() const } QT_END_NAMESPACE + +#endif // QT_NO_DRAGANDDROP diff --git a/src/plugins/platforms/wayland/qwaylanddatadevicemanager_p.h b/src/plugins/platforms/wayland/qwaylanddatadevicemanager_p.h index 85b4b3f7444..63451d82cf3 100644 --- a/src/plugins/platforms/wayland/qwaylanddatadevicemanager_p.h +++ b/src/plugins/platforms/wayland/qwaylanddatadevicemanager_p.h @@ -48,6 +48,8 @@ #include #include +#ifndef QT_NO_DRAGANDDROP + QT_BEGIN_NAMESPACE namespace QtWaylandClient { @@ -75,4 +77,6 @@ private: QT_END_NAMESPACE +#endif // QT_NO_DRAGANDDROP + #endif // QWAYLANDDATADEVICEMANAGER_H diff --git a/src/plugins/platforms/wayland/qwaylanddataoffer.cpp b/src/plugins/platforms/wayland/qwaylanddataoffer.cpp index 167b647d6aa..4c4ac3d80ab 100644 --- a/src/plugins/platforms/wayland/qwaylanddataoffer.cpp +++ b/src/plugins/platforms/wayland/qwaylanddataoffer.cpp @@ -41,6 +41,8 @@ #include +#ifndef QT_NO_DRAGANDDROP + QT_BEGIN_NAMESPACE namespace QtWaylandClient { @@ -175,3 +177,5 @@ int QWaylandMimeData::readData(int fd, QByteArray &data) const } QT_END_NAMESPACE + +#endif // QT_NO_DRAGANDDROP diff --git a/src/plugins/platforms/wayland/qwaylanddataoffer_p.h b/src/plugins/platforms/wayland/qwaylanddataoffer_p.h index b22681f7adb..d30a5fbaa61 100644 --- a/src/plugins/platforms/wayland/qwaylanddataoffer_p.h +++ b/src/plugins/platforms/wayland/qwaylanddataoffer_p.h @@ -50,6 +50,7 @@ #include #include +#ifndef QT_NO_DRAGANDDROP QT_BEGIN_NAMESPACE namespace QtWaylandClient { @@ -99,5 +100,5 @@ private: } QT_END_NAMESPACE - +#endif // QT_NO_DRAGANDDROP #endif diff --git a/src/plugins/platforms/wayland/qwaylanddatasource.cpp b/src/plugins/platforms/wayland/qwaylanddatasource.cpp index ad43b0698b7..30b7e620b92 100644 --- a/src/plugins/platforms/wayland/qwaylanddatasource.cpp +++ b/src/plugins/platforms/wayland/qwaylanddatasource.cpp @@ -43,6 +43,8 @@ #include +#ifndef QT_NO_DRAGANDDROP + QT_BEGIN_NAMESPACE namespace QtWaylandClient { @@ -90,3 +92,5 @@ void QWaylandDataSource::data_source_target(const QString &mime_type) } QT_END_NAMESPACE + +#endif // QT_NO_DRAGANDDROP diff --git a/src/plugins/platforms/wayland/qwaylanddatasource_p.h b/src/plugins/platforms/wayland/qwaylanddatasource_p.h index c753c4f6e32..72530d0b069 100644 --- a/src/plugins/platforms/wayland/qwaylanddatasource_p.h +++ b/src/plugins/platforms/wayland/qwaylanddatasource_p.h @@ -50,6 +50,8 @@ #include #include +#ifndef QT_NO_DRAGANDDROP + QT_BEGIN_NAMESPACE class QMimeData; @@ -86,4 +88,6 @@ private: QT_END_NAMESPACE +#endif // QT_NO_DRAGANDDROP + #endif // QWAYLANDDATASOURCE_H diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index f9a556f4db8..534ae49411c 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -112,7 +112,9 @@ QWaylandWindowManagerIntegration *QWaylandDisplay::windowManagerIntegration() co QWaylandDisplay::QWaylandDisplay(QWaylandIntegration *waylandIntegration) : mWaylandIntegration(waylandIntegration) +#ifndef QT_NO_DRAGANDDROP , mDndSelectionHandler(0) +#endif , mWindowExtension(0) , mSubCompositor(0) , mTouchExtension(0) @@ -150,7 +152,9 @@ QWaylandDisplay::~QWaylandDisplay(void) mWaylandIntegration->destroyScreen(screen); } mScreens.clear(); +#ifndef QT_NO_DRAGANDDROP delete mDndSelectionHandler.take(); +#endif wl_display_disconnect(mDisplay); } @@ -243,8 +247,10 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin } else if (interface == QStringLiteral("wl_seat")) { QWaylandInputDevice *inputDevice = mWaylandIntegration->createInputDevice(this, version, id); mInputDevices.append(inputDevice); +#ifndef QT_NO_DRAGANDDROP } else if (interface == QStringLiteral("wl_data_device_manager")) { mDndSelectionHandler.reset(new QWaylandDataDeviceManager(this, id)); +#endif } else if (interface == QStringLiteral("qt_surface_extension")) { mWindowExtension.reset(new QtWayland::qt_surface_extension(registry, id, 1)); } else if (interface == QStringLiteral("wl_subcompositor")) { diff --git a/src/plugins/platforms/wayland/qwaylanddisplay_p.h b/src/plugins/platforms/wayland/qwaylanddisplay_p.h index a6591648106..cc1308ba996 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay_p.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay_p.h @@ -131,9 +131,9 @@ public: QList inputDevices() const { return mInputDevices; } QWaylandInputDevice *defaultInputDevice() const; QWaylandInputDevice *currentInputDevice() const { return defaultInputDevice(); } - +#ifndef QT_NO_DRAGANDDROP QWaylandDataDeviceManager *dndSelectionHandler() const { return mDndSelectionHandler.data(); } - +#endif QtWayland::qt_surface_extension *windowExtension() const { return mWindowExtension.data(); } QWaylandTouchExtension *touchExtension() const { return mTouchExtension.data(); } QtWayland::wl_text_input_manager *textInputManager() const { return mTextInputManager.data(); } @@ -196,7 +196,9 @@ private: QList mInputDevices; QList mRegistryListeners; QWaylandIntegration *mWaylandIntegration; +#ifndef QT_NO_DRAGANDDROP QScopedPointer mDndSelectionHandler; +#endif QScopedPointer mWindowExtension; QScopedPointer mSubCompositor; QScopedPointer mTouchExtension; diff --git a/src/plugins/platforms/wayland/qwaylanddnd.cpp b/src/plugins/platforms/wayland/qwaylanddnd.cpp index e195d193a41..31b1c4911a4 100644 --- a/src/plugins/platforms/wayland/qwaylanddnd.cpp +++ b/src/plugins/platforms/wayland/qwaylanddnd.cpp @@ -44,7 +44,7 @@ #include QT_BEGIN_NAMESPACE - +#ifndef QT_NO_DRAGANDDROP namespace QtWaylandClient { QWaylandDrag::QWaylandDrag(QWaylandDisplay *display) @@ -124,5 +124,5 @@ void QWaylandDrag::finishDrag(const QPlatformDropQtResponse &response) } } - +#endif // QT_NO_DRAGANDDROP QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylanddnd_p.h b/src/plugins/platforms/wayland/qwaylanddnd_p.h index 42848a1d8c3..a4fd91e9bc9 100644 --- a/src/plugins/platforms/wayland/qwaylanddnd_p.h +++ b/src/plugins/platforms/wayland/qwaylanddnd_p.h @@ -58,7 +58,7 @@ QT_BEGIN_NAMESPACE namespace QtWaylandClient { class QWaylandDisplay; - +#ifndef QT_NO_DRAGANDDROP class Q_WAYLAND_CLIENT_EXPORT QWaylandDrag : public QBasicDrag { public: @@ -82,7 +82,7 @@ protected: private: QWaylandDisplay *m_display; }; - +#endif } QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index 5eaed9ea151..6c72c59d7be 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -178,10 +178,11 @@ QWaylandInputDevice::QWaylandInputDevice(QWaylandDisplay *display, int version, , mSerial(0) , mTouchDevice(0) { +#ifndef QT_NO_DRAGANDDROP if (mQDisplay->dndSelectionHandler()) { mDataDevice = mQDisplay->dndSelectionHandler()->getDataDevice(this); } - +#endif } QWaylandInputDevice::~QWaylandInputDevice() diff --git a/src/plugins/platforms/wayland/qwaylandintegration.cpp b/src/plugins/platforms/wayland/qwaylandintegration.cpp index 17b3f681b94..106e54c686f 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandintegration.cpp @@ -126,9 +126,10 @@ QWaylandIntegration::QWaylandIntegration() { initializeInputDeviceIntegration(); mDisplay = new QWaylandDisplay(this); +#ifndef QT_NO_DRAGANDDROP mClipboard = new QWaylandClipboard(mDisplay); mDrag = new QWaylandDrag(mDisplay); - +#endif QString icStr = QPlatformInputContextFactory::requested(); icStr.isNull() ? mInputContext.reset(new QWaylandInputContext(mDisplay)) : mInputContext.reset(QPlatformInputContextFactory::create(icStr)); @@ -136,8 +137,10 @@ QWaylandIntegration::QWaylandIntegration() QWaylandIntegration::~QWaylandIntegration() { +#ifndef QT_NO_DRAGANDDROP delete mDrag; delete mClipboard; +#endif #ifndef QT_NO_ACCESSIBILITY delete mAccessibility; #endif @@ -213,6 +216,7 @@ QPlatformFontDatabase *QWaylandIntegration::fontDatabase() const return mFontDb; } +#ifndef QT_NO_DRAGANDDROP QPlatformClipboard *QWaylandIntegration::clipboard() const { return mClipboard; @@ -222,6 +226,7 @@ QPlatformDrag *QWaylandIntegration::drag() const { return mDrag; } +#endif // QT_NO_DRAGANDDROP QPlatformInputContext *QWaylandIntegration::inputContext() const { diff --git a/src/plugins/platforms/wayland/qwaylandintegration_p.h b/src/plugins/platforms/wayland/qwaylandintegration_p.h index b6a715353d3..8d975924cc2 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration_p.h +++ b/src/plugins/platforms/wayland/qwaylandintegration_p.h @@ -79,11 +79,10 @@ public: QPlatformFontDatabase *fontDatabase() const Q_DECL_OVERRIDE; QPlatformNativeInterface *nativeInterface() const Q_DECL_OVERRIDE; - +#ifndef QT_NO_DRAGANDDROP QPlatformClipboard *clipboard() const Q_DECL_OVERRIDE; - QPlatformDrag *drag() const Q_DECL_OVERRIDE; - +#endif QPlatformInputContext *inputContext() const Q_DECL_OVERRIDE; QVariant styleHint(StyleHint hint) const Q_DECL_OVERRIDE; @@ -120,8 +119,10 @@ private: QWaylandShellIntegration *createShellIntegration(const QString& interfaceName); QPlatformFontDatabase *mFontDb; +#ifndef QT_NO_DRAGANDDROP QPlatformClipboard *mClipboard; QPlatformDrag *mDrag; +#endif QWaylandDisplay *mDisplay; QPlatformNativeInterface *mNativeInterface; QScopedPointer mInputContext; diff --git a/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp b/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp index 98e1a73668b..aad69de35cd 100644 --- a/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp +++ b/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp @@ -106,6 +106,7 @@ void *QWaylandNativeInterface::nativeResourceForScreen(const QByteArray &resourc return NULL; } +#ifndef QT_NO_OPENGL void *QWaylandNativeInterface::nativeResourceForContext(const QByteArray &resource, QOpenGLContext *context) { QByteArray lowerCaseResource = resource.toLower(); @@ -121,6 +122,7 @@ void *QWaylandNativeInterface::nativeResourceForContext(const QByteArray &resour return 0; } +#endif // QT_NO_OPENGL QVariantMap QWaylandNativeInterface::windowProperties(QPlatformWindow *window) const { diff --git a/src/plugins/platforms/wayland/qwaylandnativeinterface_p.h b/src/plugins/platforms/wayland/qwaylandnativeinterface_p.h index b4cb8fcb4e1..cace9c3353c 100644 --- a/src/plugins/platforms/wayland/qwaylandnativeinterface_p.h +++ b/src/plugins/platforms/wayland/qwaylandnativeinterface_p.h @@ -66,8 +66,9 @@ public: QWindow *window) Q_DECL_OVERRIDE; void *nativeResourceForScreen(const QByteArray &resourceString, QScreen *screen) Q_DECL_OVERRIDE; +#ifndef QT_NO_OPENGL void *nativeResourceForContext(const QByteArray &resource, QOpenGLContext *context) Q_DECL_OVERRIDE; - +#endif QVariantMap windowProperties(QPlatformWindow *window) const Q_DECL_OVERRIDE; QVariant windowProperty(QPlatformWindow *window, const QString &name) const Q_DECL_OVERRIDE; QVariant windowProperty(QPlatformWindow *window, const QString &name, const QVariant &defaultValue) const Q_DECL_OVERRIDE; diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 4c00110bc05..354e97f24ea 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -782,10 +782,12 @@ void QWaylandWindow::requestActivateWindow() void QWaylandWindow::unfocus() { +#ifndef QT_NO_DRAGANDDROP QWaylandInputDevice *inputDevice = mDisplay->currentInputDevice(); if (inputDevice && inputDevice->dataDevice()) { inputDevice->dataDevice()->invalidateSelectionOffer(); } +#endif } bool QWaylandWindow::isExposed() const From 7afb887521f1bcff3f109fa132b71eaa067e00f0 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Mon, 7 Nov 2016 13:26:04 +0100 Subject: [PATCH 0376/1507] Don't create new xdg surfaces in updateTransientParent Change-Id: I1644a75269fec40644f02eeb275d9e6b98995c0e Reviewed-by: Paul Olav Tvete --- src/plugins/platforms/wayland/qwaylandxdgsurface.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandxdgsurface.cpp b/src/plugins/platforms/wayland/qwaylandxdgsurface.cpp index f44e2d9feca..76456495325 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgsurface.cpp +++ b/src/plugins/platforms/wayland/qwaylandxdgsurface.cpp @@ -132,7 +132,9 @@ void QWaylandXdgSurface::updateTransientParent(QWindow *parent) QWaylandWindow *parent_wayland_window = static_cast(parent->handle()); if (!parent_wayland_window) return; - set_parent(m_shell->get_xdg_surface(parent_wayland_window->object())); + auto parentXdgSurface = qobject_cast(parent_wayland_window->shellSurface()); + Q_ASSERT(parentXdgSurface); + set_parent(parentXdgSurface->object()); } void QWaylandXdgSurface::setTitle(const QString & title) From c8e2e7d1026376637815a9d526c0115a43fa44fb Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Wed, 12 Oct 2016 14:29:01 +0200 Subject: [PATCH 0377/1507] Client: Fix touch getting stuck after drag-and-drop wl_touch.up is not sent by compositors when dragging, so release all touch points when the drag ends. Task-number: QTBUG-56187 Change-Id: I1c3d03c72e75a551355c50bb5d82433f5e2e35f0 Reviewed-by: Paul Olav Tvete --- src/plugins/platforms/wayland/qwaylanddnd.cpp | 2 +- .../platforms/wayland/qwaylandinputdevice.cpp | 16 ++++++++++++++++ .../platforms/wayland/qwaylandinputdevice_p.h | 2 ++ 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylanddnd.cpp b/src/plugins/platforms/wayland/qwaylanddnd.cpp index 31b1c4911a4..7c2cc8ee0dd 100644 --- a/src/plugins/platforms/wayland/qwaylanddnd.cpp +++ b/src/plugins/platforms/wayland/qwaylanddnd.cpp @@ -91,7 +91,7 @@ void QWaylandDrag::drop(const QPoint &globalPos) void QWaylandDrag::endDrag() { - // Do nothing + m_display->currentInputDevice()->handleEndDrag(); } void QWaylandDrag::updateTarget(const QString &mimeType) diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index 6c72c59d7be..669deac2a26 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -256,6 +256,12 @@ void QWaylandInputDevice::handleWindowDestroyed(QWaylandWindow *window) mTouch->mFocus = 0; } +void QWaylandInputDevice::handleEndDrag() +{ + if (mTouch) + mTouch->releasePoints(); +} + void QWaylandInputDevice::setDataDevice(QWaylandDataDevice *device) { mDataDevice = device; @@ -827,6 +833,16 @@ bool QWaylandInputDevice::Touch::allTouchPointsReleased() return true; } +void QWaylandInputDevice::Touch::releasePoints() +{ + Q_FOREACH (const QWindowSystemInterface::TouchPoint &previousPoint, mPrevTouchPoints) { + QWindowSystemInterface::TouchPoint tp = previousPoint; + tp.state = Qt::TouchPointReleased; + mTouchPoints.append(tp); + } + touch_frame(); +} + void QWaylandInputDevice::Touch::touch_frame() { // Copy all points, that are in the previous but not in the current list, as stationary. diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h index e38ad2f8415..f1a82d45b11 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h +++ b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h @@ -98,6 +98,7 @@ public: void setCursor(struct wl_buffer *buffer, const QPoint &hotSpot, const QSize &size); void setCursor(const QSharedPointer &buffer, const QPoint &hotSpot); void handleWindowDestroyed(QWaylandWindow *window); + void handleEndDrag(); void setDataDevice(QWaylandDataDevice *device); QWaylandDataDevice *dataDevice() const; @@ -259,6 +260,7 @@ public: void touch_cancel() Q_DECL_OVERRIDE; bool allTouchPointsReleased(); + void releasePoints(); QWaylandInputDevice *mParent; QWaylandWindow *mFocus; From 8d291193ab93acfd23d2e82fe0a3d827d17d7bae Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Wed, 12 Oct 2016 15:29:30 +0200 Subject: [PATCH 0378/1507] Client: Cleanup mouse state after drag Fixes an issue where dragging with the mouse would cause the next touch event to not generate a synthesized mouse press event. The touchDrag test can now be run directly after the mouseDrag test without failing. Task-number: QTBUG-56187 Change-Id: I53cc5f90fc8d8672936b23f54a017687d41c31fc Reviewed-by: Paul Olav Tvete --- src/plugins/platforms/wayland/qwaylandinputdevice.cpp | 10 ++++++++++ src/plugins/platforms/wayland/qwaylandinputdevice_p.h | 2 ++ 2 files changed, 12 insertions(+) diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index 669deac2a26..c3b6cf4532f 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -260,6 +260,8 @@ void QWaylandInputDevice::handleEndDrag() { if (mTouch) mTouch->releasePoints(); + if (mPointer) + mPointer->releaseButtons(); } void QWaylandInputDevice::setDataDevice(QWaylandDataDevice *device) @@ -516,6 +518,14 @@ void QWaylandInputDevice::Pointer::pointer_button(uint32_t serial, uint32_t time } } +void QWaylandInputDevice::Pointer::releaseButtons() +{ + mButtons = Qt::NoButton; + MotionEvent e(mParent->mTime, mSurfacePos, mGlobalPos, mButtons, mParent->modifiers()); + if (mFocus) + mFocus->handleMouse(mParent, e); +} + class WheelEvent : public QWaylandPointerEvent { public: diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h index f1a82d45b11..a615e266337 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h +++ b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h @@ -228,6 +228,8 @@ public: uint32_t axis, wl_fixed_t value) Q_DECL_OVERRIDE; + void releaseButtons(); + QWaylandInputDevice *mParent; QWaylandWindow *mFocus; uint32_t mEnterSerial; From ff3c3ad9f6f111199ebbeb27c51205e53468138a Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Thu, 3 Nov 2016 16:32:20 +0100 Subject: [PATCH 0379/1507] Follow the protocol for nested xdg_popups The previous implementation sent the wrong parent for nested popups and used a new serial for each popup instead of reusing the one for the current grab. Change-Id: I22b1cbe997a64562d47275821c9146157c51bc42 Reviewed-by: Paul Olav Tvete --- .../platforms/wayland/qwaylandxdgshell.cpp | 21 +++++++++++++++---- .../platforms/wayland/qwaylandxdgshell_p.h | 4 ++++ 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandxdgshell.cpp b/src/plugins/platforms/wayland/qwaylandxdgshell.cpp index 6a378b8dbe6..6a99306081a 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgshell.cpp +++ b/src/plugins/platforms/wayland/qwaylandxdgshell.cpp @@ -54,11 +54,13 @@ namespace QtWaylandClient { QWaylandXdgShell::QWaylandXdgShell(struct ::xdg_shell *shell) : QtWayland::xdg_shell(shell) + , m_popupSerial(0) { } QWaylandXdgShell::QWaylandXdgShell(struct ::wl_registry *registry, uint32_t id) : QtWayland::xdg_shell(registry, id, 1) + , m_popupSerial(0) { use_unstable_version(QtWayland::xdg_shell::version_current); } @@ -75,15 +77,26 @@ QWaylandXdgSurface *QWaylandXdgShell::createXdgSurface(QWaylandWindow *window) QWaylandXdgPopup *QWaylandXdgShell::createXdgPopup(QWaylandWindow *window) { - QWaylandWindow *parentWindow = window->transientParent(); + QWaylandWindow *parentWindow = m_popups.empty() ? window->transientParent() : m_popups.last(); ::wl_surface *parentSurface = parentWindow->object(); + QWaylandInputDevice *inputDevice = window->display()->lastInputDevice(); + if (m_popupSerial == 0) + m_popupSerial = inputDevice->serial(); ::wl_seat *seat = inputDevice->wl_seat(); - uint serial = inputDevice->serial(); - QPoint position = window->geometry().topLeft(); + + QPoint position = window->geometry().topLeft() - parentWindow->geometry().topLeft(); int x = position.x() + parentWindow->frameMargins().left(); int y = position.y() + parentWindow->frameMargins().top(); - return new QWaylandXdgPopup(get_xdg_popup(window->object(), parentSurface, seat, serial, x, y), window); + + auto popup = new QWaylandXdgPopup(get_xdg_popup(window->object(), parentSurface, seat, m_popupSerial, x, y), window); + m_popups.append(window); + QObject::connect(popup, &QWaylandXdgPopup::destroyed, [this, window](){ + m_popups.removeOne(window); + if (m_popups.empty()) + m_popupSerial = 0; + }); + return popup; } void QWaylandXdgShell::xdg_shell_ping(uint32_t serial) diff --git a/src/plugins/platforms/wayland/qwaylandxdgshell_p.h b/src/plugins/platforms/wayland/qwaylandxdgshell_p.h index c04a9ce6673..8b35e36abdf 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgshell_p.h +++ b/src/plugins/platforms/wayland/qwaylandxdgshell_p.h @@ -52,6 +52,7 @@ // #include +#include #include @@ -82,6 +83,9 @@ public: private: void xdg_shell_ping(uint32_t serial) Q_DECL_OVERRIDE; + + QVector m_popups; + uint m_popupSerial; }; QT_END_NAMESPACE From dfb256be3621043c1041356250e539c71d2b5a31 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Fri, 4 Nov 2016 10:32:01 +0100 Subject: [PATCH 0380/1507] Remove QWaylandWindow::shellManagesActiveState If m_shellSurface was deleted, there was no way for QWaylandDisplay to know whether the shell handled window deactivation or not. The shell integration now always handles the window active state. The default implementation of QWaylandShellIntegration will make a window active on keyboard focus. Change-Id: I80cfce9976b1d3c57094fdd8980c9110b873f239 Reviewed-by: Paul Olav Tvete --- src/plugins/platforms/wayland/qwaylanddisplay.cpp | 6 +----- .../platforms/wayland/qwaylandshellsurface_p.h | 1 - src/plugins/platforms/wayland/qwaylandwindow.cpp | 5 ----- src/plugins/platforms/wayland/qwaylandwindow_p.h | 2 -- .../wayland/qwaylandwlshellintegration.cpp | 6 ++++++ .../wayland/qwaylandwlshellintegration_p.h | 2 +- .../wayland/qwaylandxdgshellintegration.cpp | 13 +++++++++++++ .../wayland/qwaylandxdgshellintegration_p.h | 3 ++- .../platforms/wayland/qwaylandxdgsurface_p.h | 2 -- .../shellintegration/qwaylandshellintegration_p.h | 15 ++++++++++++++- 10 files changed, 37 insertions(+), 18 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index 5f2c4e2ea02..de38e3f2584 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -419,11 +419,7 @@ void QWaylandDisplay::handleKeyboardFocusChanged(QWaylandInputDevice *inputDevic if (mLastKeyboardFocus == keyboardFocus) return; - if (keyboardFocus && !keyboardFocus->shellManagesActiveState()) - handleWindowActivated(keyboardFocus); - - if (mLastKeyboardFocus && !mLastKeyboardFocus->shellManagesActiveState()) - handleWindowDeactivated(mLastKeyboardFocus); + mWaylandIntegration->mShellIntegration->handleKeyboardFocusChanged(keyboardFocus, mLastKeyboardFocus); mLastKeyboardFocus = keyboardFocus; } diff --git a/src/plugins/platforms/wayland/qwaylandshellsurface_p.h b/src/plugins/platforms/wayland/qwaylandshellsurface_p.h index 79f65b1544a..63b77ab33c5 100644 --- a/src/plugins/platforms/wayland/qwaylandshellsurface_p.h +++ b/src/plugins/platforms/wayland/qwaylandshellsurface_p.h @@ -91,7 +91,6 @@ public: virtual void setContentOrientationMask(Qt::ScreenOrientations orientation) { Q_UNUSED(orientation) } virtual void sendProperty(const QString &name, const QVariant &value); - virtual bool shellManagesActiveState() const { return false; } inline QWaylandWindow *window() { return m_window; } diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 6b9dde7c79e..e72ed7704f4 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -530,11 +530,6 @@ QWaylandSubSurface *QWaylandWindow::subSurfaceWindow() const return mSubSurfaceWindow; } -bool QWaylandWindow::shellManagesActiveState() const -{ - return mShellSurface && mShellSurface->shellManagesActiveState(); -} - void QWaylandWindow::handleContentOrientationChange(Qt::ScreenOrientation orientation) { if (mDisplay->compositorVersion() < 2) diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index e0c42ace53d..442fe9ad9f7 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -143,8 +143,6 @@ public: QWaylandSubSurface *subSurfaceWindow() const; QWaylandScreen *screen() const { return mScreen; } - bool shellManagesActiveState() const; - void handleContentOrientationChange(Qt::ScreenOrientation orientation) Q_DECL_OVERRIDE; void setOrientationMask(Qt::ScreenOrientations mask); diff --git a/src/plugins/platforms/wayland/qwaylandwlshellintegration.cpp b/src/plugins/platforms/wayland/qwaylandwlshellintegration.cpp index 6a9220d2648..ce7c7834617 100644 --- a/src/plugins/platforms/wayland/qwaylandwlshellintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandwlshellintegration.cpp @@ -52,6 +52,12 @@ QWaylandWlShellIntegration::QWaylandWlShellIntegration(QWaylandDisplay *display) } } +bool QWaylandWlShellIntegration::initialize(QWaylandDisplay *display) +{ + QWaylandShellIntegration::initialize(display); + return m_wlShell != nullptr; +}; + QWaylandShellSurface *QWaylandWlShellIntegration::createShellSurface(QWaylandWindow *window) { return new QWaylandWlShellSurface(m_wlShell->get_shell_surface(window->object()), window); diff --git a/src/plugins/platforms/wayland/qwaylandwlshellintegration_p.h b/src/plugins/platforms/wayland/qwaylandwlshellintegration_p.h index 8531eb3aad1..9082c7628d1 100644 --- a/src/plugins/platforms/wayland/qwaylandwlshellintegration_p.h +++ b/src/plugins/platforms/wayland/qwaylandwlshellintegration_p.h @@ -58,7 +58,7 @@ class Q_WAYLAND_CLIENT_EXPORT QWaylandWlShellIntegration : public QWaylandShellI { public: QWaylandWlShellIntegration(QWaylandDisplay* display); - bool initialize(QWaylandDisplay *) Q_DECL_OVERRIDE { return m_wlShell != Q_NULLPTR; } + bool initialize(QWaylandDisplay *) Q_DECL_OVERRIDE; QWaylandShellSurface *createShellSurface(QWaylandWindow *window) Q_DECL_OVERRIDE; private: diff --git a/src/plugins/platforms/wayland/qwaylandxdgshellintegration.cpp b/src/plugins/platforms/wayland/qwaylandxdgshellintegration.cpp index b6b1d9d35a3..a48157dfac9 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgshellintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandxdgshellintegration.cpp @@ -54,6 +54,12 @@ QWaylandXdgShellIntegration::QWaylandXdgShellIntegration(QWaylandDisplay *displa } } +bool QWaylandXdgShellIntegration::initialize(QWaylandDisplay *display) +{ + QWaylandShellIntegration::initialize(display); + return m_xdgShell != nullptr; +} + QWaylandShellSurface *QWaylandXdgShellIntegration::createShellSurface(QWaylandWindow *window) { if (window->window()->type() == Qt::WindowType::Popup) @@ -62,6 +68,13 @@ QWaylandShellSurface *QWaylandXdgShellIntegration::createShellSurface(QWaylandWi return m_xdgShell->createXdgSurface(window); } +void QWaylandXdgShellIntegration::handleKeyboardFocusChanged(QWaylandWindow *newFocus, QWaylandWindow *oldFocus) { + if (newFocus && qobject_cast(newFocus->shellSurface())) + m_display->handleWindowActivated(newFocus); + if (oldFocus && qobject_cast(oldFocus->shellSurface())) + m_display->handleWindowDeactivated(oldFocus); +} + } QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandxdgshellintegration_p.h b/src/plugins/platforms/wayland/qwaylandxdgshellintegration_p.h index 29374ff1d6d..e0e6bda0dc5 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgshellintegration_p.h +++ b/src/plugins/platforms/wayland/qwaylandxdgshellintegration_p.h @@ -59,8 +59,9 @@ class Q_WAYLAND_CLIENT_EXPORT QWaylandXdgShellIntegration : public QWaylandShell { public: QWaylandXdgShellIntegration(QWaylandDisplay *display); - bool initialize(QWaylandDisplay *) Q_DECL_OVERRIDE { return m_xdgShell != Q_NULLPTR; } + bool initialize(QWaylandDisplay *display) Q_DECL_OVERRIDE; QWaylandShellSurface *createShellSurface(QWaylandWindow *window) Q_DECL_OVERRIDE; + void handleKeyboardFocusChanged(QWaylandWindow *newFocus, QWaylandWindow *oldFocus) Q_DECL_OVERRIDE; private: QWaylandXdgShell *m_xdgShell; diff --git a/src/plugins/platforms/wayland/qwaylandxdgsurface_p.h b/src/plugins/platforms/wayland/qwaylandxdgsurface_p.h index 27decabb4e6..1a5eeed7fc0 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgsurface_p.h +++ b/src/plugins/platforms/wayland/qwaylandxdgsurface_p.h @@ -96,8 +96,6 @@ public: void setWindowFlags(Qt::WindowFlags flags) Q_DECL_OVERRIDE; void sendProperty(const QString &name, const QVariant &value) Q_DECL_OVERRIDE; - bool shellManagesActiveState() const Q_DECL_OVERRIDE { return true; } - bool isFullscreen() const { return m_fullscreen; } bool isMaximized() const { return m_maximized; } diff --git a/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegration_p.h b/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegration_p.h index e8e46ecaa12..144e58352a0 100644 --- a/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegration_p.h +++ b/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegration_p.h @@ -53,6 +53,7 @@ #include #include +#include QT_BEGIN_NAMESPACE @@ -68,8 +69,20 @@ public: QWaylandShellIntegration() {} virtual ~QWaylandShellIntegration() {} - virtual bool initialize(QWaylandDisplay *display) = 0; + virtual bool initialize(QWaylandDisplay *display) { + m_display = display; + return true; + } virtual QWaylandShellSurface *createShellSurface(QWaylandWindow *window) = 0; + virtual void handleKeyboardFocusChanged(QWaylandWindow *newFocus, QWaylandWindow *oldFocus) { + if (newFocus) + m_display->handleWindowActivated(newFocus); + if (oldFocus) + m_display->handleWindowDeactivated(oldFocus); + } + +protected: + QWaylandDisplay *m_display; }; } From 68b44084005e59fcb6f41c0683c18aa8d2f12455 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Fri, 11 Nov 2016 08:59:39 +0100 Subject: [PATCH 0381/1507] Remove useless method QWaylandShmBackingStore::hidden Change-Id: I8e28d3c1dc2c2bbff4517ffe3b2f63c2ac86b95f Reviewed-by: Jan Arne Petersen Reviewed-by: Paul Olav Tvete --- src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp | 4 ---- src/plugins/platforms/wayland/qwaylandshmbackingstore_p.h | 1 - src/plugins/platforms/wayland/qwaylandwindow.cpp | 3 --- 3 files changed, 8 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp b/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp index 13f823edf81..5f8336c14db 100644 --- a/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp +++ b/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp @@ -185,10 +185,6 @@ void QWaylandShmBackingStore::endPaint() waylandWindow()->setCanResize(true); } -void QWaylandShmBackingStore::hidden() -{ -} - void QWaylandShmBackingStore::ensureSize() { waylandWindow()->setBackingStore(this); diff --git a/src/plugins/platforms/wayland/qwaylandshmbackingstore_p.h b/src/plugins/platforms/wayland/qwaylandshmbackingstore_p.h index c3e7635029e..5068519d8ed 100644 --- a/src/plugins/platforms/wayland/qwaylandshmbackingstore_p.h +++ b/src/plugins/platforms/wayland/qwaylandshmbackingstore_p.h @@ -96,7 +96,6 @@ public: void resize(const QSize &size); void beginPaint(const QRegion &) Q_DECL_OVERRIDE; void endPaint() Q_DECL_OVERRIDE; - void hidden(); QWaylandAbstractDecoration *windowDecoration() const; diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index e72ed7704f4..6c3647d8168 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -341,9 +341,6 @@ void QWaylandWindow::setVisible(bool visible) if (!deleteGuard.isNull()) { attach(static_cast(0), 0, 0); commit(); - if (mBackingStore) { - mBackingStore->hidden(); - } } } } From fb1ac98280c058f8c799678c7cc0f8df3ce88097 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Wed, 16 Nov 2016 13:56:23 +0100 Subject: [PATCH 0382/1507] Rename qwaylandxdgpopup_p.cpp to qwaylandxdgpopup.cpp Change-Id: I4bffaafdae07db96d4fcca7d2a0751941a2e635f Reviewed-by: Pier Luigi Fiorini --- src/plugins/platforms/wayland/client.pro | 2 +- .../wayland/{qwaylandxdgpopup_p.cpp => qwaylandxdgpopup.cpp} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename src/plugins/platforms/wayland/{qwaylandxdgpopup_p.cpp => qwaylandxdgpopup.cpp} (100%) diff --git a/src/plugins/platforms/wayland/client.pro b/src/plugins/platforms/wayland/client.pro index 34955dfbbe2..5ae01c04462 100644 --- a/src/plugins/platforms/wayland/client.pro +++ b/src/plugins/platforms/wayland/client.pro @@ -66,7 +66,7 @@ SOURCES += qwaylandintegration.cpp \ qwaylandwlshellintegration.cpp \ qwaylandxdgshell.cpp \ qwaylandxdgsurface.cpp \ - qwaylandxdgpopup_p.cpp \ + qwaylandxdgpopup.cpp \ qwaylandxdgshellintegration.cpp \ qwaylandextendedsurface.cpp \ qwaylandsubsurface.cpp \ diff --git a/src/plugins/platforms/wayland/qwaylandxdgpopup_p.cpp b/src/plugins/platforms/wayland/qwaylandxdgpopup.cpp similarity index 100% rename from src/plugins/platforms/wayland/qwaylandxdgpopup_p.cpp rename to src/plugins/platforms/wayland/qwaylandxdgpopup.cpp From 9fc25b4a60c0565a863f7fc92cf93bfa300cb26e Mon Sep 17 00:00:00 2001 From: Giulio Camuffo Date: Sat, 2 Jul 2016 10:46:58 +0200 Subject: [PATCH 0383/1507] Create and destroy the shell surface when showing and hiding This changes the shell surface handling for windows, and instead of creating the shell surface at initialization time, and then attaching a null buffer to hide it, it creates the shell surface on setVisible(true), and destroys it on setVisible(false). This fixes hiding when using xdg_shell, as that interface defines that attaching a null buffer to an xdg_surface is an error. Also this should help with bugged EGL drivers which attach a buffer after eglSwapBuffers() returns, which used to cause a newly hidden window to get a new valid buffer after we attached a null one, showing it again. Task-number: QTBUG-47902 Change-Id: I8e0a0442319a98cc1361803ea7be1d079b36fc8c Reviewed-by: Johan Helsing Reviewed-by: Paul Olav Tvete --- .../wayland/qwaylandshellsurface_p.h | 5 +- .../wayland/qwaylandshmbackingstore.cpp | 8 +- .../platforms/wayland/qwaylandwindow.cpp | 92 +++++++++---------- .../platforms/wayland/qwaylandwindow_p.h | 2 + .../wayland/qwaylandwlshellsurface.cpp | 10 ++ .../wayland/qwaylandwlshellsurface_p.h | 6 +- .../platforms/wayland/qwaylandxdgpopup.cpp | 6 ++ .../platforms/wayland/qwaylandxdgpopup_p.h | 2 + .../platforms/wayland/qwaylandxdgsurface.cpp | 19 ++-- .../platforms/wayland/qwaylandxdgsurface_p.h | 5 +- tests/auto/wayland/client/tst_client.cpp | 4 +- 11 files changed, 86 insertions(+), 73 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandshellsurface_p.h b/src/plugins/platforms/wayland/qwaylandshellsurface_p.h index 63b77ab33c5..b51c252fd2a 100644 --- a/src/plugins/platforms/wayland/qwaylandshellsurface_p.h +++ b/src/plugins/platforms/wayland/qwaylandshellsurface_p.h @@ -94,15 +94,14 @@ public: inline QWaylandWindow *window() { return m_window; } + virtual void setType(Qt::WindowType type, QWaylandWindow *transientParent) = 0; + protected: virtual void setMaximized() {} virtual void setFullscreen() {} virtual void setNormal() {} virtual void setMinimized() {} - virtual void setTopLevel() {} - virtual void updateTransientParent(QWindow * /*parent*/) {} - private: QWaylandWindow *m_window; friend class QWaylandWindow; diff --git a/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp b/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp index 5f8336c14db..d0d6cfd30ab 100644 --- a/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp +++ b/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp @@ -211,13 +211,7 @@ void QWaylandShmBackingStore::flush(QWindow *window, const QRegion ®ion, cons QMargins margins = windowDecorationMargins(); - waylandWindow()->attachOffset(mFrontBuffer); - mFrontBuffer->setBusy(); - - QVector rects = region.rects(); - foreach (const QRect &rect, rects) - waylandWindow()->damage(rect.translated(margins.left(), margins.top())); - waylandWindow()->commit(); + waylandWindow()->commit(mFrontBuffer, region.translated(margins.left(), margins.top())); } void QWaylandShmBackingStore::resize(const QSize &size, const QRegion &) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 6c3647d8168..1ff6686f672 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -96,8 +96,6 @@ QWaylandWindow::QWaylandWindow(QWindow *window) { static WId id = 1; mWindowId = id++; - if (window->type() != Qt::Desktop) - initWindow(); } QWaylandWindow::~QWaylandWindow() @@ -126,18 +124,28 @@ QWaylandWindow::~QWaylandWindow() void QWaylandWindow::initWindow() { - init(mDisplay->createSurface(static_cast(this))); + if (window()->type() == Qt::Desktop) + return; + + if (!isInitialized()) + init(mDisplay->createSurface(static_cast(this))); if (shouldCreateSubSurface()) { + Q_ASSERT(!mSubSurfaceWindow); + QWaylandWindow *p = static_cast(QPlatformWindow::parent()); if (::wl_subsurface *ss = mDisplay->createSubSurface(this, p)) { mSubSurfaceWindow = new QWaylandSubSurface(this, p, ss); } } else if (shouldCreateShellSurface()) { - mShellSurface = mDisplay->createShellSurface(this); - } + Q_ASSERT(!mShellSurface); + + mShellSurface = mDisplay->createShellSurface(this); + if (!mShellSurface) + qFatal("Could not create a shell surface object."); + + mShellSurface->setType(window()->type(), transientParent()); - if (mShellSurface) { // Set initial surface title setWindowTitle(window()->title()); @@ -171,17 +179,6 @@ void QWaylandWindow::initWindow() } } - if (mShellSurface) { - if (window()->transientParent()) { - if (window()->type() != Qt::Popup) { - mShellSurface->updateTransientParent(window()->transientParent()); - } - } else { - if (window()->type() != Qt::ToolTip) - mShellSurface->setTopLevel(); - } - } - // Enable high-dpi rendering. Scale() returns the screen scale factor and will // typically be integer 1 (normal-dpi) or 2 (high-dpi). Call set_buffer_scale() // to inform the compositor that high-resolution buffers will be provided. @@ -244,6 +241,9 @@ WId QWaylandWindow::winId() const void QWaylandWindow::setParent(const QPlatformWindow *parent) { + if (!window()->isVisible()) + return; + QWaylandWindow *oldparent = mSubSurfaceWindow ? mSubSurfaceWindow->parent() : 0; if (oldparent == parent) return; @@ -287,8 +287,7 @@ void QWaylandWindow::setGeometry_helper(const QRect &rect) QMargins m = QPlatformWindow::parent()->frameMargins(); mSubSurfaceWindow->set_position(rect.x() + m.left(), rect.y() + m.top()); mSubSurfaceWindow->parent()->window()->requestUpdate(); - } else if (shellSurface() && window()->transientParent() && window()->type() != Qt::Popup) - shellSurface()->updateTransientParent(window()->transientParent()); + } } void QWaylandWindow::setGeometry(const QRect &rect) @@ -313,20 +312,8 @@ void QWaylandWindow::setGeometry(const QRect &rect) void QWaylandWindow::setVisible(bool visible) { if (visible) { - if (mShellSurface) { - if (window()->type() == Qt::Popup) { - QWaylandWindow *parent = transientParent(); - if (parent) { - QWaylandWlShellSurface *wlshellSurface = qobject_cast(mShellSurface); - if (wlshellSurface) - wlshellSurface->setPopup(parent, mDisplay->lastInputDevice(), mDisplay->lastInputSerial()); - } - } else if (window()->type() == Qt::ToolTip) { - if (QWaylandWindow *parent = transientParent()) { - mShellSurface->updateTransientParent(parent->window()); - } - } - } + initWindow(); + mDisplay->flushRequests(); setGeometry(window()->geometry()); // Don't flush the events here, or else the newly visible window may start drawing, but since @@ -338,10 +325,8 @@ void QWaylandWindow::setVisible(bool visible) // case 'this' will be deleted. When that happens, we must abort right away. QPointer deleteGuard(this); QWindowSystemInterface::flushWindowSystemEvents(); - if (!deleteGuard.isNull()) { - attach(static_cast(0), 0, 0); - commit(); - } + if (!deleteGuard.isNull()) + reset(); } } @@ -374,7 +359,7 @@ void QWaylandWindow::setMask(const QRegion &mask) wl_region_destroy(region); } - commit(); + wl_surface::commit(); } void QWaylandWindow::configure(uint32_t edges, int32_t width, int32_t height) @@ -461,6 +446,7 @@ void QWaylandWindow::attach(QWaylandBuffer *buffer, int x, int y) wl_callback_add_listener(callback, &QWaylandWindow::callbackListener, this); mFrameCallback = callback; mWaitingForFrameSync = true; + buffer->setBusy(); attach(buffer->buffer(), x, y); } else { @@ -479,6 +465,18 @@ void QWaylandWindow::damage(const QRect &rect) damage(rect.x(), rect.y(), rect.width(), rect.height()); } +void QWaylandWindow::commit(QWaylandBuffer *buffer, const QRegion &damage) +{ + if (!isInitialized()) + return; + + attachOffset(buffer); + const QVector rects = damage.rects(); + for (const QRect &rect: rects) + wl_surface::damage(rect.x(), rect.y(), rect.width(), rect.height()); + wl_surface::commit(); +} + const wl_callback_listener QWaylandWindow::callbackListener = { QWaylandWindow::frameCallback }; @@ -555,7 +553,7 @@ void QWaylandWindow::handleContentOrientationChange(Qt::ScreenOrientation orient } set_buffer_transform(transform); // set_buffer_transform is double buffered, we need to commit. - commit(); + wl_surface::commit(); } void QWaylandWindow::setOrientationMask(Qt::ScreenOrientations mask) @@ -681,15 +679,13 @@ static QWindow *topLevelWindow(QWindow *window) QWaylandWindow *QWaylandWindow::transientParent() const { - if (window()->transientParent()) { - // Take the top level window here, since the transient parent may be a QWidgetWindow - // or some other window without a shell surface, which is then not able to get mouse - // events. - return static_cast(topLevelWindow(window()->transientParent())->handle()); - } - // Try with the current focus window. It should be the right one and anyway - // better than having no parent at all. - return mDisplay->lastInputWindow(); + // Take the top level window here, since the transient parent may be a QWidgetWindow + // or some other window without a shell surface, which is then not able to get mouse + // events. + if (auto transientParent = window()->transientParent()) + return static_cast(topLevelWindow(transientParent)->handle()); + + return nullptr; } void QWaylandWindow::handleMouse(QWaylandInputDevice *inputDevice, const QWaylandPointerEvent &e) diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index 442fe9ad9f7..7e7078fcfd1 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -132,6 +132,8 @@ public: using QtWayland::wl_surface::damage; void damage(const QRect &rect); + void commit(QWaylandBuffer *buffer, const QRegion &damage); + void waitForFrameSync(); QMargins frameMargins() const Q_DECL_OVERRIDE; diff --git a/src/plugins/platforms/wayland/qwaylandwlshellsurface.cpp b/src/plugins/platforms/wayland/qwaylandwlshellsurface.cpp index 3527015c715..77434e98b6c 100644 --- a/src/plugins/platforms/wayland/qwaylandwlshellsurface.cpp +++ b/src/plugins/platforms/wayland/qwaylandwlshellsurface.cpp @@ -215,6 +215,16 @@ void QWaylandWlShellSurface::setPopup(QWaylandWindow *parent, QWaylandInputDevic transientPos.x(), transientPos.y(), 0); } +void QWaylandWlShellSurface::setType(Qt::WindowType type, QWaylandWindow *transientParent) +{ + if (type == Qt::Popup && transientParent) + setPopup(transientParent, m_window->display()->lastInputDevice(), m_window->display()->lastInputSerial()); + else if (transientParent) + updateTransientParent(transientParent->window()); + else + setTopLevel(); +} + void QWaylandWlShellSurface::shell_surface_ping(uint32_t serial) { pong(serial); diff --git a/src/plugins/platforms/wayland/qwaylandwlshellsurface_p.h b/src/plugins/platforms/wayland/qwaylandwlshellsurface_p.h index ef732ef85df..af86276bbd0 100644 --- a/src/plugins/platforms/wayland/qwaylandwlshellsurface_p.h +++ b/src/plugins/platforms/wayland/qwaylandwlshellsurface_p.h @@ -92,14 +92,16 @@ public: void setWindowFlags(Qt::WindowFlags flags) Q_DECL_OVERRIDE; void sendProperty(const QString &name, const QVariant &value) Q_DECL_OVERRIDE; + void setType(Qt::WindowType type, QWaylandWindow *transientParent) override; + private: void setMaximized() Q_DECL_OVERRIDE; void setFullscreen() Q_DECL_OVERRIDE; void setNormal() Q_DECL_OVERRIDE; void setMinimized() Q_DECL_OVERRIDE; - void setTopLevel() Q_DECL_OVERRIDE; - void updateTransientParent(QWindow *parent) Q_DECL_OVERRIDE; + void setTopLevel(); + void updateTransientParent(QWindow *parent); void setPopup(QWaylandWindow *parent, QWaylandInputDevice *device, int serial); QWaylandWindow *m_window; diff --git a/src/plugins/platforms/wayland/qwaylandxdgpopup.cpp b/src/plugins/platforms/wayland/qwaylandxdgpopup.cpp index abc25278b1e..57800f17f2e 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgpopup.cpp +++ b/src/plugins/platforms/wayland/qwaylandxdgpopup.cpp @@ -56,6 +56,12 @@ QWaylandXdgPopup::~QWaylandXdgPopup() delete m_extendedWindow; } +void QWaylandXdgPopup::setType(Qt::WindowType type, QWaylandWindow *transientParent) +{ + Q_UNUSED(type); + Q_UNUSED(transientParent); +} + } QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandxdgpopup_p.h b/src/plugins/platforms/wayland/qwaylandxdgpopup_p.h index ff58041134d..64bb4d96543 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgpopup_p.h +++ b/src/plugins/platforms/wayland/qwaylandxdgpopup_p.h @@ -68,6 +68,8 @@ public: QWaylandXdgPopup(struct ::xdg_popup *popup, QWaylandWindow *window); virtual ~QWaylandXdgPopup(); + void setType(Qt::WindowType type, QWaylandWindow *transientParent) override; + private: QWaylandExtendedSurface *m_extendedWindow; }; diff --git a/src/plugins/platforms/wayland/qwaylandxdgsurface.cpp b/src/plugins/platforms/wayland/qwaylandxdgsurface.cpp index a3bbb064880..fe8761e5b6d 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgsurface.cpp +++ b/src/plugins/platforms/wayland/qwaylandxdgsurface.cpp @@ -128,17 +128,11 @@ void QWaylandXdgSurface::setMinimized() set_minimized(); } -void QWaylandXdgSurface::setTopLevel() +void QWaylandXdgSurface::updateTransientParent(QWaylandWindow *parent) { - // There's no xdg_shell_surface API for this, ignoring -} - -void QWaylandXdgSurface::updateTransientParent(QWindow *parent) -{ - QWaylandWindow *parent_wayland_window = static_cast(parent->handle()); - if (!parent_wayland_window) + if (!parent) return; - auto parentXdgSurface = qobject_cast(parent_wayland_window->shellSurface()); + auto parentXdgSurface = qobject_cast(parent->shellSurface()); Q_ASSERT(parentXdgSurface); set_parent(parentXdgSurface->object()); } @@ -183,6 +177,13 @@ void QWaylandXdgSurface::sendProperty(const QString &name, const QVariant &value m_extendedWindow->updateGenericProperty(name, value); } +void QWaylandXdgSurface::setType(Qt::WindowType type, QWaylandWindow *transientParent) +{ + Q_UNUSED(type) + if (transientParent) + updateTransientParent(transientParent); +} + void QWaylandXdgSurface::xdg_surface_configure(int32_t width, int32_t height, struct wl_array *states,uint32_t serial) { uint32_t *state = reinterpret_cast(states->data); diff --git a/src/plugins/platforms/wayland/qwaylandxdgsurface_p.h b/src/plugins/platforms/wayland/qwaylandxdgsurface_p.h index 1a5eeed7fc0..265d3ba8035 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgsurface_p.h +++ b/src/plugins/platforms/wayland/qwaylandxdgsurface_p.h @@ -99,14 +99,15 @@ public: bool isFullscreen() const { return m_fullscreen; } bool isMaximized() const { return m_maximized; } + void setType(Qt::WindowType type, QWaylandWindow *transientParent) override; + private: void setMaximized() Q_DECL_OVERRIDE; void setFullscreen() Q_DECL_OVERRIDE; void setNormal() Q_DECL_OVERRIDE; void setMinimized() Q_DECL_OVERRIDE; - void setTopLevel() Q_DECL_OVERRIDE; - void updateTransientParent(QWindow *parent) Q_DECL_OVERRIDE; + void updateTransientParent(QWaylandWindow *parent); private: QWaylandWindow *m_window; diff --git a/tests/auto/wayland/client/tst_client.cpp b/tests/auto/wayland/client/tst_client.cpp index 74363ef5fa0..6aad25bb40c 100644 --- a/tests/auto/wayland/client/tst_client.cpp +++ b/tests/auto/wayland/client/tst_client.cpp @@ -248,8 +248,8 @@ void tst_WaylandClient::backingStore() window.hide(); - // hiding the window should detach the buffer - QTRY_VERIFY(surface->image.isNull()); + // hiding the window should destroy the surface + QTRY_VERIFY(!compositor->surface()); } class DndWindow : public QWindow From 882f20bbf4ca4f28320cbee4b7a097fa65dcacd0 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Wed, 16 Nov 2016 14:43:20 +0100 Subject: [PATCH 0384/1507] Client: Close popups on xdg_popup::popup_done Change-Id: I6d3b1ec5c22e6d07ed87948074d886cc9aa126ef Reviewed-by: Paul Olav Tvete --- src/plugins/platforms/wayland/qwaylandxdgpopup.cpp | 6 ++++++ src/plugins/platforms/wayland/qwaylandxdgpopup_p.h | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/src/plugins/platforms/wayland/qwaylandxdgpopup.cpp b/src/plugins/platforms/wayland/qwaylandxdgpopup.cpp index 57800f17f2e..318f78ac738 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgpopup.cpp +++ b/src/plugins/platforms/wayland/qwaylandxdgpopup.cpp @@ -45,6 +45,7 @@ QWaylandXdgPopup::QWaylandXdgPopup(struct ::xdg_popup *popup, QWaylandWindow *wi : QWaylandShellSurface(window) , QtWayland::xdg_popup(popup) , m_extendedWindow(nullptr) + , m_window(window) { if (window->display()->windowExtension()) m_extendedWindow = new QWaylandExtendedSurface(window); @@ -62,6 +63,11 @@ void QWaylandXdgPopup::setType(Qt::WindowType type, QWaylandWindow *transientPar Q_UNUSED(transientParent); } +void QWaylandXdgPopup::xdg_popup_popup_done() +{ + m_window->window()->close(); +} + } QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandxdgpopup_p.h b/src/plugins/platforms/wayland/qwaylandxdgpopup_p.h index 64bb4d96543..04416dbb6f3 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgpopup_p.h +++ b/src/plugins/platforms/wayland/qwaylandxdgpopup_p.h @@ -70,8 +70,12 @@ public: void setType(Qt::WindowType type, QWaylandWindow *transientParent) override; +protected: + void xdg_popup_popup_done() override; + private: QWaylandExtendedSurface *m_extendedWindow; + QWaylandWindow *m_window; }; QT_END_NAMESPACE From 999fe98f66ca6e591141859860ff623f81ed8e98 Mon Sep 17 00:00:00 2001 From: Giulio Camuffo Date: Sat, 19 Nov 2016 08:58:17 +0100 Subject: [PATCH 0385/1507] Don't reset the cursor at every mouse move Change-Id: I67f9a0d171da403ebb124ab584c2510891da80fc Reviewed-by: Paul Olav Tvete --- .../platforms/wayland/qwaylandinputdevice.cpp | 14 ++++++++++++++ .../platforms/wayland/qwaylandinputdevice_p.h | 5 ++++- src/plugins/platforms/wayland/qwaylandwindow.cpp | 6 +----- src/plugins/platforms/wayland/qwaylandwindow_p.h | 1 - 4 files changed, 19 insertions(+), 7 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index 94316bafccc..de0520890b8 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -147,6 +147,8 @@ QWaylandInputDevice::Pointer::Pointer(QWaylandInputDevice *p) , mEnterSerial(0) , mCursorSerial(0) , mButtons(0) + , mCursorBuffer(nullptr) + , mCursorShape(Qt::BitmapCursor) { } @@ -362,6 +364,10 @@ void QWaylandInputDevice::setCursor(Qt::CursorShape newShape, QWaylandScreen *sc void QWaylandInputDevice::setCursor(const QCursor &cursor, QWaylandScreen *screen) { + if (cursor.shape() != Qt::BitmapCursor && cursor.shape() == mPointer->mCursorShape) + return; + + mPointer->mCursorShape = cursor.shape(); if (cursor.shape() == Qt::BitmapCursor) { setCursor(screen->waylandCursor()->cursorBitmapImage(&cursor), cursor.hotSpot()); return; @@ -379,8 +385,16 @@ void QWaylandInputDevice::setCursor(struct wl_buffer *buffer, struct wl_cursor_i void QWaylandInputDevice::setCursor(struct wl_buffer *buffer, const QPoint &hotSpot, const QSize &size) { if (mCaps & WL_SEAT_CAPABILITY_POINTER) { + bool force = mPointer->mEnterSerial > mPointer->mCursorSerial; + + if (!force && mPointer->mCursorBuffer == buffer) + return; + mPixmapCursor.clear(); mPointer->mCursorSerial = mPointer->mEnterSerial; + + mPointer->mCursorBuffer = buffer; + /* Hide cursor */ if (!buffer) { diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h index 2f39bc54721..d41bde5644d 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h +++ b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h @@ -99,7 +99,6 @@ public: struct ::wl_seat *wl_seat() { return QtWayland::wl_seat::object(); } - void setCursor(Qt::CursorShape cursor, QWaylandScreen *screen); void setCursor(const QCursor &cursor, QWaylandScreen *screen); void setCursor(struct wl_buffer *buffer, struct ::wl_cursor_image *image); void setCursor(struct wl_buffer *buffer, const QPoint &hotSpot, const QSize &size); @@ -129,6 +128,8 @@ public: virtual Touch *createTouch(QWaylandInputDevice *device); private: + void setCursor(Qt::CursorShape cursor, QWaylandScreen *screen); + QWaylandDisplay *mQDisplay; struct wl_display *mDisplay; @@ -249,6 +250,8 @@ public: QPointF mSurfacePos; QPointF mGlobalPos; Qt::MouseButtons mButtons; + wl_buffer *mCursorBuffer; + Qt::CursorShape mCursorShape; }; class Q_WAYLAND_CLIENT_EXPORT QWaylandInputDevice::Touch : public QtWayland::wl_touch diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 1ff6686f672..8e40f3b37ff 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -81,7 +81,6 @@ QWaylandWindow::QWaylandWindow(QWindow *window) , mWindowDecoration(0) , mMouseEventsInContentArea(false) , mMousePressedInContentArea(Qt::NoButton) - , m_cursor(Qt::ArrowCursor) , mWaitingForFrameSync(false) , mFrameCallback(nullptr) , mRequestResizeSent(false) @@ -780,10 +779,7 @@ void QWaylandWindow::handleMouseEventWithDecoration(QWaylandInputDevice *inputDe void QWaylandWindow::setMouseCursor(QWaylandInputDevice *device, const QCursor &cursor) { - if (device->serial() >= device->cursorSerial()) { - device->setCursor(cursor, mScreen); - m_cursor = cursor; - } + device->setCursor(cursor, mScreen); } void QWaylandWindow::restoreMouseCursor(QWaylandInputDevice *device) diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index 7e7078fcfd1..f5988fbd15a 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -217,7 +217,6 @@ protected: QWaylandAbstractDecoration *mWindowDecoration; bool mMouseEventsInContentArea; Qt::MouseButtons mMousePressedInContentArea; - QCursor m_cursor; WId mWindowId; bool mWaitingForFrameSync; From 629663aa2e65d466001b4f887f85def350f46adc Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Thu, 3 Nov 2016 15:14:47 +0100 Subject: [PATCH 0386/1507] Move qtwayland over to use the new configuration system Re-use configuration results from qtbase where possible and move all pkg-config handling over to be done at configuration time. Since waylandclient and waylandcompositor are two independent libs, this required some duplication of features and libraries used by both in the configure.json files. Change-Id: I1f3ec56c85cb780324cc7634a3ad7951125853a0 Reviewed-by: Oswald Buddenhagen Reviewed-by: Paul Olav Tvete --- src/plugins/platforms/wayland/client.pro | 17 +-- src/plugins/platforms/wayland/configure.json | 134 ++++++++++++++++++ .../plugins/decorations/bradient/bradient.pro | 7 +- .../plugins/hardwareintegration/client.pro | 24 ++-- tests/auto/wayland/client/client.pro | 6 +- 5 files changed, 149 insertions(+), 39 deletions(-) create mode 100644 src/plugins/platforms/wayland/configure.json diff --git a/src/plugins/platforms/wayland/client.pro b/src/plugins/platforms/wayland/client.pro index 5ae01c04462..749e3b6a366 100644 --- a/src/plugins/platforms/wayland/client.pro +++ b/src/plugins/platforms/wayland/client.pro @@ -15,26 +15,17 @@ use_gold_linker: CONFIG += no_linker_version_script CONFIG -= precompile_header CONFIG += link_pkgconfig wayland-scanner -contains(QT_CONFIG, opengl) { +qtConfig(opengl) { DEFINES += QT_WAYLAND_GL_SUPPORT } -config_xkbcommon { - !contains(QT_CONFIG, no-pkg-config) { - PKGCONFIG_PRIVATE += xkbcommon - } else { - LIBS_PRIVATE += -lxkbcommon - } +qtConfig(xkbcommon-evdev) { + QMAKE_USE_PRIVATE += xkbcommon_evdev } else { DEFINES += QT_NO_WAYLAND_XKB } -!contains(QT_CONFIG, no-pkg-config) { - PKGCONFIG_PRIVATE += wayland-client wayland-cursor - contains(QT_CONFIG, glib): PKGCONFIG_PRIVATE += glib-2.0 -} else { - LIBS_PRIVATE += -lwayland-client -lwayland-cursor $$QT_LIBS_GLIB -} +QMAKE_USE += wayland-client wayland-cursor INCLUDEPATH += $$PWD/../shared diff --git a/src/plugins/platforms/wayland/configure.json b/src/plugins/platforms/wayland/configure.json new file mode 100644 index 00000000000..b2a8fbc0b3e --- /dev/null +++ b/src/plugins/platforms/wayland/configure.json @@ -0,0 +1,134 @@ +{ + "module": "waylandclient", + "depends": [ + "gui-private" + ], + "testDir": "../../config.tests", + + "libraries": { + "wayland-client": { + "label": "Wayland client library", + "test": "wayland", + "sources": [ + { "type": "pkgConfig", "args": "wayland-client" }, + "-lwayland-client" + ] + }, + "wayland-cursor": { + "label": "Wayland cursor library", + "test": "wayland_cursor", + "use": "wayland-client", + "sources": [ + { "type": "pkgConfig", "args": "wayland-cursor" }, + "-lwayland-cursor" + ] + }, + "wayland-egl": { + "label": "Wayland EGL library", + "test": "wayland_egl", + "sources": [ + { "type": "pkgConfig", "args": "wayland-egl" }, + "-lwayland-egl" + ] + }, + "xcomposite": { + "label": "XComposite", + "test": "xcomposite", + "sources": [ + { "type": "pkgConfig", "args": "xcomposite" }, + "-lxcomposite" + ] + }, + "glx": { + "label": "GLX", + "test": "glx", + "sources": [ + { "type": "pkgConfig", "args": "x11 gl" }, + "-lX11 -lGl" + ] + } + }, + + "tests": { + "wayland-scanner": { + "label": "wayland-scanner", + "type": "compile", + "test": "wayland_scanner", + "use": "wayland-client" + }, + "drm-egl-server": { + "label": "DRM EGL Server", + "type": "compile", + "test": "drm_egl_server", + "use": "egl" + }, + "libhybris-egl-server": { + "label": "libhybris EGL Server", + "type": "compile", + "test": "libhybris_egl_server", + "use": "egl" + } + }, + + "features": { + "wayland-client": { + "label": "Qt Wayland Client", + "condition": "!config.win32 && libs.wayland-client && libs.wayland-cursor && tests.wayland-scanner", + "output": [ "privateFeature" ] + }, + "wayland-egl": { + "label": "EGL", + "condition": "features.wayland-client && features.opengl && features.egl && libs.wayland-egl", + "output": [ "privateFeature" ] + }, + "wayland-brcm": { + "label": "Rasberry Pi", + "condition": "features.wayland-client && features.eglfs_brcm", + "output": [ "privateFeature" ] + }, + "xcomposite-egl": { + "label": "XComposite EGL", + "condition": "features.wayland-client && features.opengl && features.egl && libs.xcomposite", + "output": [ "privateFeature" ] + }, + "xcomposite-glx": { + "label": "XComposite GLX", + "condition": "features.wayland-client && features.opengl && !features.opengles2 && libs.xcomposite && libs.glx", + "output": [ "privateFeature" ] + }, + "drm-egl-server": { + "label": "DRM EGL", + "condition": "features.wayland-client && features.opengl && features.egl && tests.drm-egl-server", + "output": [ "privateFeature" ] + }, + "libhybris-egl-server": { + "label": "libhybris EGL", + "condition": "features.wayland-client && features.opengl && features.egl && tests.libhybris-egl-server", + "output": [ "privateFeature" ] + } + }, + + "report": [ + { + "type": "note", + "condition": "!libs.wayland-egl", + "message": "No wayland-egl support detected. Cross-toolkit compatibility disabled." + } + ], + + "summary": [ + { + "section": "Qt Wayland Drivers", + "condition": "features.wayland-client", + "entries": [ + "wayland-egl", + "wayland-brcm", + "xcomposite-egl", + "xcomposite-glx", + "drm-egl-server", + "libhybris-egl-server" + ] + }, + "wayland-client" + ] +} diff --git a/src/plugins/platforms/wayland/plugins/decorations/bradient/bradient.pro b/src/plugins/platforms/wayland/plugins/decorations/bradient/bradient.pro index 0f62db9cc9d..843149e0836 100644 --- a/src/plugins/platforms/wayland/plugins/decorations/bradient/bradient.pro +++ b/src/plugins/platforms/wayland/plugins/decorations/bradient/bradient.pro @@ -5,12 +5,7 @@ OTHER_FILES += \ SOURCES += main.cpp -contains(QT_CONFIG, no-pkg-config) { - LIBS += -lwayland-client -} else { - CONFIG += link_pkgconfig - PKGCONFIG += wayland-client -} +QMAKE_USE += wayland-client PLUGIN_TYPE = wayland-decoration-client load(qt_plugin) diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/client.pro b/src/plugins/platforms/wayland/plugins/hardwareintegration/client.pro index 37a90ab0d44..a5967c710dd 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/client.pro +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/client.pro @@ -1,21 +1,15 @@ TEMPLATE=subdirs +QT_FOR_CONFIG += waylandclient-private -config_wayland_egl: \ +qtConfig(wayland-egl): \ SUBDIRS += wayland-egl - -config_brcm_egl: \ +qtConfig(wayland-brcm): \ SUBDIRS += brcm-egl - -config_xcomposite { - contains(QT_CONFIG, egl): \ - SUBDIRS += xcomposite-egl - - !contains(QT_CONFIG, opengles2):config_glx: \ - SUBDIRS += xcomposite-glx -} - -config_drm_egl_server: \ +qtConfig(xcomposite-egl): \ + SUBDIRS += xcomposite-egl +qtConfig(xcomposite-glx): \ + SUBDIRS += xcomposite-glx +qtConfig(drm-egl-server): \ SUBDIRS += drm-egl-server - -config_libhybris_egl_server: \ +qtConfig(libhybris-egl-server): \ SUBDIRS += libhybris-egl-server diff --git a/tests/auto/wayland/client/client.pro b/tests/auto/wayland/client/client.pro index 006d130a039..34fc67474db 100644 --- a/tests/auto/wayland/client/client.pro +++ b/tests/auto/wayland/client/client.pro @@ -4,11 +4,7 @@ TARGET = tst_client QT += testlib QT += core-private gui-private -!contains(QT_CONFIG, no-pkg-config) { - PKGCONFIG += wayland-client wayland-server -} else { - LIBS += -lwayland-client -lwayland-server -} +QMAKE_USE += wayland-client wayland-server CONFIG += wayland-scanner WAYLANDSERVERSOURCES += \ From 1d51cabc54653541c043e58df37ae56a06791d9b Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Tue, 15 Nov 2016 15:59:13 +0100 Subject: [PATCH 0387/1507] Use the feature system internally Get rid of almost all DEFINES += ... in the pro files, instead use the proper QT_CONFIG() macro to determine whether a feature is available. Change-Id: I867769be2085c6ba93b6815e223e2b89edcb245d Reviewed-by: Paul Olav Tvete --- src/plugins/platforms/wayland/client.pro | 12 +--- .../wayland/global/qwaylandclientextension.h | 2 +- .../qwaylandclientbufferintegration_p.h | 2 +- ...qwaylandclientbufferintegrationfactory_p.h | 2 +- .../qwaylandclientbufferintegrationplugin_p.h | 2 +- .../qwaylandhardwareintegration_p.h | 2 +- .../qwaylandserverbufferintegration_p.h | 2 +- ...qwaylandserverbufferintegrationfactory_p.h | 2 +- .../qwaylandserverbufferintegrationplugin_p.h | 2 +- .../qwaylandinputdeviceintegration_p.h | 2 +- .../qwaylandinputdeviceintegrationfactory_p.h | 2 +- .../qwaylandinputdeviceintegrationplugin_p.h | 2 +- ...clientexport.h => qtwaylandclientglobal.h} | 9 +-- .../wayland/qtwaylandclientglobal_p.h | 59 +++++++++++++++++++ .../wayland/qwaylandabstractdecoration_p.h | 2 +- .../platforms/wayland/qwaylandbuffer_p.h | 2 +- .../platforms/wayland/qwaylandclipboard_p.h | 2 +- .../platforms/wayland/qwaylandcursor_p.h | 2 +- .../wayland/qwaylanddatadevicemanager_p.h | 2 +- .../platforms/wayland/qwaylanddataoffer_p.h | 2 +- .../platforms/wayland/qwaylanddatasource_p.h | 2 +- .../wayland/qwaylanddecorationfactory_p.h | 2 +- .../wayland/qwaylanddecorationplugin_p.h | 2 +- .../platforms/wayland/qwaylanddisplay_p.h | 2 +- src/plugins/platforms/wayland/qwaylanddnd_p.h | 2 +- .../wayland/qwaylandextendedsurface_p.h | 2 +- .../platforms/wayland/qwaylandinputdevice.cpp | 22 +++---- .../platforms/wayland/qwaylandinputdevice_p.h | 9 +-- .../platforms/wayland/qwaylandintegration_p.h | 3 +- .../wayland/qwaylandnativeinterface.cpp | 2 +- .../wayland/qwaylandnativeinterface_p.h | 2 +- .../platforms/wayland/qwaylandqtkey_p.h | 2 +- .../platforms/wayland/qwaylandscreen_p.h | 2 +- .../wayland/qwaylandshellsurface_p.h | 2 +- src/plugins/platforms/wayland/qwaylandshm_p.h | 2 +- .../platforms/wayland/qwaylandsubsurface_p.h | 2 +- .../platforms/wayland/qwaylandtouch_p.h | 2 +- .../platforms/wayland/qwaylandwindow_p.h | 2 +- .../qwaylandwindowmanagerintegration_p.h | 2 +- .../wayland/qwaylandwlshellsurface_p.h | 2 +- .../platforms/wayland/qwaylandxdgpopup_p.h | 2 +- .../platforms/wayland/qwaylandxdgshell_p.h | 2 +- .../platforms/wayland/qwaylandxdgsurface_p.h | 2 +- .../platforms/wayland/shared/qwaylandxkb.cpp | 4 -- .../platforms/wayland/shared/qwaylandxkb_p.h | 4 -- .../qwaylandshellintegration_p.h | 3 +- .../qwaylandshellintegrationfactory_p.h | 2 +- .../qwaylandshellintegrationplugin_p.h | 2 +- 48 files changed, 124 insertions(+), 79 deletions(-) rename src/plugins/platforms/wayland/{qwaylandclientexport.h => qtwaylandclientglobal.h} (93%) create mode 100644 src/plugins/platforms/wayland/qtwaylandclientglobal_p.h diff --git a/src/plugins/platforms/wayland/client.pro b/src/plugins/platforms/wayland/client.pro index 749e3b6a366..7482cfd6bbd 100644 --- a/src/plugins/platforms/wayland/client.pro +++ b/src/plugins/platforms/wayland/client.pro @@ -15,15 +15,8 @@ use_gold_linker: CONFIG += no_linker_version_script CONFIG -= precompile_header CONFIG += link_pkgconfig wayland-scanner -qtConfig(opengl) { - DEFINES += QT_WAYLAND_GL_SUPPORT -} - -qtConfig(xkbcommon-evdev) { +qtConfig(xkbcommon-evdev): \ QMAKE_USE_PRIVATE += xkbcommon_evdev -} else { - DEFINES += QT_NO_WAYLAND_XKB -} QMAKE_USE += wayland-client wayland-cursor @@ -108,7 +101,8 @@ HEADERS += qwaylandintegration_p.h \ qwaylandinputcontext_p.h \ qwaylanddatadevice_p.h \ qwaylandshm_p.h \ - qwaylandclientexport.h \ + qtwaylandclientglobal.h \ + qtwaylandclientglobal_p.h \ ../shared/qwaylandinputmethodeventbuilder_p.h \ ../shared/qwaylandmimehelper_p.h \ ../shared/qwaylandxkb_p.h \ diff --git a/src/plugins/platforms/wayland/global/qwaylandclientextension.h b/src/plugins/platforms/wayland/global/qwaylandclientextension.h index d1610c271e3..37345202cc8 100644 --- a/src/plugins/platforms/wayland/global/qwaylandclientextension.h +++ b/src/plugins/platforms/wayland/global/qwaylandclientextension.h @@ -38,7 +38,7 @@ #define QWAYLANDCLIENTEXTENSION_H #include -#include +#include struct wl_registry; diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegration_p.h b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegration_p.h index adaf2902a24..f1f0cf93282 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegration_p.h +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegration_p.h @@ -52,7 +52,7 @@ // #include -#include +#include QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationfactory_p.h b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationfactory_p.h index c70a2bd56a5..7eaeed16cc1 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationfactory_p.h +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationfactory_p.h @@ -51,7 +51,7 @@ // We mean it. // -#include +#include #include QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationplugin_p.h b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationplugin_p.h index 2830f95fa9a..6496b33ed3c 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationplugin_p.h +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationplugin_p.h @@ -51,7 +51,7 @@ // We mean it. // -#include +#include #include #include diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandhardwareintegration_p.h b/src/plugins/platforms/wayland/hardwareintegration/qwaylandhardwareintegration_p.h index db9e19ac9de..8b4a7162927 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandhardwareintegration_p.h +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandhardwareintegration_p.h @@ -52,7 +52,7 @@ // #include -#include +#include QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegration_p.h b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegration_p.h index e3943da805f..67f857db890 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegration_p.h +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegration_p.h @@ -55,7 +55,7 @@ #include #include -#include +#include QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationfactory_p.h b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationfactory_p.h index f17856208b2..600c24c9bc3 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationfactory_p.h +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationfactory_p.h @@ -51,7 +51,7 @@ // We mean it. // -#include +#include #include QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationplugin_p.h b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationplugin_p.h index 7eaaa1700cc..b3ed3ccc5bf 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationplugin_p.h +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationplugin_p.h @@ -51,7 +51,7 @@ // We mean it. // -#include +#include #include #include diff --git a/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegration_p.h b/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegration_p.h index ada63b713cb..1fa0fd6de72 100644 --- a/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegration_p.h +++ b/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegration_p.h @@ -52,7 +52,7 @@ // #include -#include +#include #include diff --git a/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationfactory_p.h b/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationfactory_p.h index d6d0e843c6b..80096e7900f 100644 --- a/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationfactory_p.h +++ b/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationfactory_p.h @@ -51,7 +51,7 @@ // We mean it. // -#include +#include #include QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationplugin_p.h b/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationplugin_p.h index c4a578d2e21..2d9961dba65 100644 --- a/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationplugin_p.h +++ b/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationplugin_p.h @@ -51,7 +51,7 @@ // We mean it. // -#include +#include #include #include diff --git a/src/plugins/platforms/wayland/qwaylandclientexport.h b/src/plugins/platforms/wayland/qtwaylandclientglobal.h similarity index 93% rename from src/plugins/platforms/wayland/qwaylandclientexport.h rename to src/plugins/platforms/wayland/qtwaylandclientglobal.h index f49f1aee9a4..5f474f378b9 100644 --- a/src/plugins/platforms/wayland/qwaylandclientexport.h +++ b/src/plugins/platforms/wayland/qtwaylandclientglobal.h @@ -37,8 +37,8 @@ ** ****************************************************************************/ -#ifndef QWAYLANDCLIENTEXPORT_H -#define QWAYLANDCLIENTEXPORT_H +#ifndef QWAYLANDCLIENTGLOBAL_H +#define QWAYLANDCLIENTGLOBAL_H // // W A R N I N G @@ -51,7 +51,8 @@ // We mean it. // -#include +#include +#include QT_BEGIN_NAMESPACE @@ -65,5 +66,5 @@ QT_BEGIN_NAMESPACE QT_END_NAMESPACE -#endif //QWAYLANDCLIENTEXPORT_H +#endif //QWAYLANDCLIENTGLOBAL_H diff --git a/src/plugins/platforms/wayland/qtwaylandclientglobal_p.h b/src/plugins/platforms/wayland/qtwaylandclientglobal_p.h new file mode 100644 index 00000000000..f2106d0b875 --- /dev/null +++ b/src/plugins/platforms/wayland/qtwaylandclientglobal_p.h @@ -0,0 +1,59 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWAYLANDCLIENTGLOBAL_P_H +#define QWAYLANDCLIENTGLOBAL_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include +#include +#include + +#endif //QWAYLANDCLIENTGLOBAL_P_H + diff --git a/src/plugins/platforms/wayland/qwaylandabstractdecoration_p.h b/src/plugins/platforms/wayland/qwaylandabstractdecoration_p.h index 3220dab9ccc..42c65be64cc 100644 --- a/src/plugins/platforms/wayland/qwaylandabstractdecoration_p.h +++ b/src/plugins/platforms/wayland/qwaylandabstractdecoration_p.h @@ -59,7 +59,7 @@ #include #include #include -#include +#include #include diff --git a/src/plugins/platforms/wayland/qwaylandbuffer_p.h b/src/plugins/platforms/wayland/qwaylandbuffer_p.h index 8d651f82369..9e8cba2e490 100644 --- a/src/plugins/platforms/wayland/qwaylandbuffer_p.h +++ b/src/plugins/platforms/wayland/qwaylandbuffer_p.h @@ -51,7 +51,7 @@ // We mean it. // -#include +#include #include #include diff --git a/src/plugins/platforms/wayland/qwaylandclipboard_p.h b/src/plugins/platforms/wayland/qwaylandclipboard_p.h index 6468613423e..d662e512e24 100644 --- a/src/plugins/platforms/wayland/qwaylandclipboard_p.h +++ b/src/plugins/platforms/wayland/qwaylandclipboard_p.h @@ -55,7 +55,7 @@ #include #include -#include +#include #ifndef QT_NO_DRAGANDDROP QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandcursor_p.h b/src/plugins/platforms/wayland/qwaylandcursor_p.h index 11333d34ddf..a7d188f5669 100644 --- a/src/plugins/platforms/wayland/qwaylandcursor_p.h +++ b/src/plugins/platforms/wayland/qwaylandcursor_p.h @@ -53,7 +53,7 @@ #include #include -#include +#include struct wl_cursor; struct wl_cursor_image; diff --git a/src/plugins/platforms/wayland/qwaylanddatadevicemanager_p.h b/src/plugins/platforms/wayland/qwaylanddatadevicemanager_p.h index 90ca301b3ac..df8a67abaf0 100644 --- a/src/plugins/platforms/wayland/qwaylanddatadevicemanager_p.h +++ b/src/plugins/platforms/wayland/qwaylanddatadevicemanager_p.h @@ -51,7 +51,7 @@ // We mean it. // -#include +#include #include #ifndef QT_NO_DRAGANDDROP diff --git a/src/plugins/platforms/wayland/qwaylanddataoffer_p.h b/src/plugins/platforms/wayland/qwaylanddataoffer_p.h index 6368bff9b7d..07adf342a35 100644 --- a/src/plugins/platforms/wayland/qwaylanddataoffer_p.h +++ b/src/plugins/platforms/wayland/qwaylanddataoffer_p.h @@ -53,7 +53,7 @@ #include -#include +#include #include #ifndef QT_NO_DRAGANDDROP diff --git a/src/plugins/platforms/wayland/qwaylanddatasource_p.h b/src/plugins/platforms/wayland/qwaylanddatasource_p.h index 9e29ae8b8c2..fd8601325ae 100644 --- a/src/plugins/platforms/wayland/qwaylanddatasource_p.h +++ b/src/plugins/platforms/wayland/qwaylanddatasource_p.h @@ -54,7 +54,7 @@ #include #include -#include +#include #ifndef QT_NO_DRAGANDDROP diff --git a/src/plugins/platforms/wayland/qwaylanddecorationfactory_p.h b/src/plugins/platforms/wayland/qwaylanddecorationfactory_p.h index 9d4e7a9fb0d..606d9b89c2f 100644 --- a/src/plugins/platforms/wayland/qwaylanddecorationfactory_p.h +++ b/src/plugins/platforms/wayland/qwaylanddecorationfactory_p.h @@ -51,7 +51,7 @@ // We mean it. // -#include +#include #include QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylanddecorationplugin_p.h b/src/plugins/platforms/wayland/qwaylanddecorationplugin_p.h index dd33f3416da..c549b24bee9 100644 --- a/src/plugins/platforms/wayland/qwaylanddecorationplugin_p.h +++ b/src/plugins/platforms/wayland/qwaylanddecorationplugin_p.h @@ -51,7 +51,7 @@ // We mean it. // -#include +#include #include #include diff --git a/src/plugins/platforms/wayland/qwaylanddisplay_p.h b/src/plugins/platforms/wayland/qwaylanddisplay_p.h index fae17d535eb..afbe676514c 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay_p.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay_p.h @@ -61,7 +61,7 @@ #include #include -#include +#include #include #include diff --git a/src/plugins/platforms/wayland/qwaylanddnd_p.h b/src/plugins/platforms/wayland/qwaylanddnd_p.h index 464b9837bea..bcae8ace9ab 100644 --- a/src/plugins/platforms/wayland/qwaylanddnd_p.h +++ b/src/plugins/platforms/wayland/qwaylanddnd_p.h @@ -57,7 +57,7 @@ #include #include -#include +#include QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandextendedsurface_p.h b/src/plugins/platforms/wayland/qwaylandextendedsurface_p.h index 39b85438a16..39dc4fcf05f 100644 --- a/src/plugins/platforms/wayland/qwaylandextendedsurface_p.h +++ b/src/plugins/platforms/wayland/qwaylandextendedsurface_p.h @@ -54,7 +54,7 @@ #include #include -#include +#include #include #include diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index de0520890b8..71be6bdf873 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -73,7 +73,7 @@ namespace QtWaylandClient { QWaylandInputDevice::Keyboard::Keyboard(QWaylandInputDevice *p) : mParent(p) , mFocus(0) -#ifndef QT_NO_WAYLAND_XKB +#if QT_CONFIG(xkbcommon_evdev) , mXkbContext(0) , mXkbMap(0) , mXkbState(0) @@ -83,7 +83,7 @@ QWaylandInputDevice::Keyboard::Keyboard(QWaylandInputDevice *p) connect(&mRepeatTimer, SIGNAL(timeout()), this, SLOT(repeatKey())); } -#ifndef QT_NO_WAYLAND_XKB +#if QT_CONFIG(xkbcommon_evdev) bool QWaylandInputDevice::Keyboard::createDefaultKeyMap() { if (mXkbContext && mXkbMap && mXkbState) { @@ -125,7 +125,7 @@ void QWaylandInputDevice::Keyboard::releaseKeyMap() QWaylandInputDevice::Keyboard::~Keyboard() { -#ifndef QT_NO_WAYLAND_XKB +#if QT_CONFIG(xkbcommon_evdev) releaseKeyMap(); #endif if (mFocus) @@ -334,7 +334,7 @@ Qt::KeyboardModifiers QWaylandInputDevice::Keyboard::modifiers() const { Qt::KeyboardModifiers ret = Qt::NoModifier; -#ifndef QT_NO_WAYLAND_XKB +#if QT_CONFIG(xkbcommon_evdev) if (!mXkbState) return ret; @@ -602,7 +602,7 @@ void QWaylandInputDevice::Pointer::pointer_axis(uint32_t time, uint32_t axis, in void QWaylandInputDevice::Keyboard::keyboard_keymap(uint32_t format, int32_t fd, uint32_t size) { -#ifndef QT_NO_WAYLAND_XKB +#if QT_CONFIG(xkbcommon_evdev) if (format != WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1) { close(fd); return; @@ -702,7 +702,7 @@ void QWaylandInputDevice::Keyboard::keyboard_key(uint32_t serial, uint32_t time, if (isDown) mParent->mQDisplay->setLastInputDevice(mParent, serial, window); -#ifndef QT_NO_WAYLAND_XKB +#if QT_CONFIG(xkbcommon_evdev) if (!createDefaultKeyMap()) { return; } @@ -720,7 +720,7 @@ void QWaylandInputDevice::Keyboard::keyboard_key(uint32_t serial, uint32_t time, #endif if (state == WL_KEYBOARD_KEY_STATE_PRESSED -#ifndef QT_NO_WAYLAND_XKB +#if QT_CONFIG(xkbcommon_evdev) && xkb_keymap_key_repeats(mXkbMap, code) #endif ) { @@ -728,7 +728,7 @@ void QWaylandInputDevice::Keyboard::keyboard_key(uint32_t serial, uint32_t time, mRepeatCode = code; mRepeatTime = time; mRepeatText = text; -#ifndef QT_NO_WAYLAND_XKB +#if QT_CONFIG(xkbcommon_evdev) mRepeatSym = sym; #endif mRepeatTimer.setInterval(400); @@ -742,7 +742,7 @@ void QWaylandInputDevice::Keyboard::repeatKey() { mRepeatTimer.setInterval(25); sendKey(mFocus->window(), mRepeatTime, QEvent::KeyRelease, mRepeatKey, modifiers(), mRepeatCode, -#ifndef QT_NO_WAYLAND_XKB +#if QT_CONFIG(xkbcommon_evdev) mRepeatSym, mNativeModifiers, #else 0, 0, @@ -750,7 +750,7 @@ void QWaylandInputDevice::Keyboard::repeatKey() mRepeatText, true); sendKey(mFocus->window(), mRepeatTime, QEvent::KeyPress, mRepeatKey, modifiers(), mRepeatCode, -#ifndef QT_NO_WAYLAND_XKB +#if QT_CONFIG(xkbcommon_evdev) mRepeatSym, mNativeModifiers, #else 0, 0, @@ -765,7 +765,7 @@ void QWaylandInputDevice::Keyboard::keyboard_modifiers(uint32_t serial, uint32_t group) { Q_UNUSED(serial); -#ifndef QT_NO_WAYLAND_XKB +#if QT_CONFIG(xkbcommon_evdev) if (mXkbState) xkb_state_update_mask(mXkbState, mods_depressed, mods_latched, mods_locked, diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h index d41bde5644d..6d458e35ddd 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h +++ b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h @@ -51,6 +51,7 @@ // We mean it. // +#include #include #include @@ -64,7 +65,7 @@ #include -#ifndef QT_NO_WAYLAND_XKB +#if QT_CONFIG(xkbcommon_evdev) #include #include #endif @@ -194,7 +195,7 @@ public: QWaylandInputDevice *mParent; QWaylandWindow *mFocus; -#ifndef QT_NO_WAYLAND_XKB +#if QT_CONFIG(xkbcommon_evdev) xkb_context *mXkbContext; xkb_keymap *mXkbMap; xkb_state *mXkbState; @@ -205,7 +206,7 @@ public: uint32_t mRepeatCode; uint32_t mRepeatTime; QString mRepeatText; -#ifndef QT_NO_WAYLAND_XKB +#if QT_CONFIG(xkbcommon_evdev) xkb_keysym_t mRepeatSym; #endif QTimer mRepeatTimer; @@ -216,7 +217,7 @@ private slots: void repeatKey(); private: -#ifndef QT_NO_WAYLAND_XKB +#if QT_CONFIG(xkbcommon_evdev) bool createDefaultKeyMap(); void releaseKeyMap(); #endif diff --git a/src/plugins/platforms/wayland/qwaylandintegration_p.h b/src/plugins/platforms/wayland/qwaylandintegration_p.h index 3b91313b5a0..e30a10ea0c4 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration_p.h +++ b/src/plugins/platforms/wayland/qwaylandintegration_p.h @@ -51,9 +51,8 @@ // We mean it. // +#include #include - -#include #include QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp b/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp index 52c61eec13e..c0b675f782d 100644 --- a/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp +++ b/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp @@ -119,7 +119,7 @@ void *QWaylandNativeInterface::nativeResourceForScreen(const QByteArray &resourc #ifndef QT_NO_OPENGL void *QWaylandNativeInterface::nativeResourceForContext(const QByteArray &resource, QOpenGLContext *context) { -#ifdef QT_WAYLAND_GL_SUPPORT +#if QT_CONFIG(opengl) QByteArray lowerCaseResource = resource.toLower(); if (lowerCaseResource == "eglconfig" && m_integration->clientBufferIntegration()) diff --git a/src/plugins/platforms/wayland/qwaylandnativeinterface_p.h b/src/plugins/platforms/wayland/qwaylandnativeinterface_p.h index 49e52cdcb57..63a543ee7b0 100644 --- a/src/plugins/platforms/wayland/qwaylandnativeinterface_p.h +++ b/src/plugins/platforms/wayland/qwaylandnativeinterface_p.h @@ -54,7 +54,7 @@ #include #include -#include +#include QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandqtkey_p.h b/src/plugins/platforms/wayland/qwaylandqtkey_p.h index b749bd5f9e8..155b625400d 100644 --- a/src/plugins/platforms/wayland/qwaylandqtkey_p.h +++ b/src/plugins/platforms/wayland/qwaylandqtkey_p.h @@ -53,7 +53,7 @@ #include -#include +#include #include QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandscreen_p.h b/src/plugins/platforms/wayland/qwaylandscreen_p.h index 64980280a03..9c1f4673869 100644 --- a/src/plugins/platforms/wayland/qwaylandscreen_p.h +++ b/src/plugins/platforms/wayland/qwaylandscreen_p.h @@ -52,7 +52,7 @@ // #include -#include +#include #include diff --git a/src/plugins/platforms/wayland/qwaylandshellsurface_p.h b/src/plugins/platforms/wayland/qwaylandshellsurface_p.h index b51c252fd2a..e700d5a183b 100644 --- a/src/plugins/platforms/wayland/qwaylandshellsurface_p.h +++ b/src/plugins/platforms/wayland/qwaylandshellsurface_p.h @@ -57,7 +57,7 @@ #include #include -#include +#include QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandshm_p.h b/src/plugins/platforms/wayland/qwaylandshm_p.h index aafe4463291..519482d09eb 100644 --- a/src/plugins/platforms/wayland/qwaylandshm_p.h +++ b/src/plugins/platforms/wayland/qwaylandshm_p.h @@ -54,7 +54,7 @@ #include #include -#include +#include #include QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandsubsurface_p.h b/src/plugins/platforms/wayland/qwaylandsubsurface_p.h index 0abd168bc18..00fb8d8edab 100644 --- a/src/plugins/platforms/wayland/qwaylandsubsurface_p.h +++ b/src/plugins/platforms/wayland/qwaylandsubsurface_p.h @@ -56,7 +56,7 @@ #include #include -#include +#include #include QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandtouch_p.h b/src/plugins/platforms/wayland/qwaylandtouch_p.h index dc32b84a063..b17bce6abe7 100644 --- a/src/plugins/platforms/wayland/qwaylandtouch_p.h +++ b/src/plugins/platforms/wayland/qwaylandtouch_p.h @@ -54,7 +54,7 @@ #include #include -#include +#include QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index f5988fbd15a..ce295a0de3b 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -60,7 +60,7 @@ #include #include -#include +#include struct wl_egl_window; diff --git a/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration_p.h b/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration_p.h index 09a79d48dc8..463b67ef6a8 100644 --- a/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration_p.h @@ -58,7 +58,7 @@ #include #include -#include +#include QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandwlshellsurface_p.h b/src/plugins/platforms/wayland/qwaylandwlshellsurface_p.h index af86276bbd0..89bce55852d 100644 --- a/src/plugins/platforms/wayland/qwaylandwlshellsurface_p.h +++ b/src/plugins/platforms/wayland/qwaylandwlshellsurface_p.h @@ -55,7 +55,7 @@ #include -#include +#include #include #include diff --git a/src/plugins/platforms/wayland/qwaylandxdgpopup_p.h b/src/plugins/platforms/wayland/qwaylandxdgpopup_p.h index 04416dbb6f3..e10e5e62b98 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgpopup_p.h +++ b/src/plugins/platforms/wayland/qwaylandxdgpopup_p.h @@ -47,7 +47,7 @@ #include -#include +#include #include #include diff --git a/src/plugins/platforms/wayland/qwaylandxdgshell_p.h b/src/plugins/platforms/wayland/qwaylandxdgshell_p.h index 8b35e36abdf..97a15e46aee 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgshell_p.h +++ b/src/plugins/platforms/wayland/qwaylandxdgshell_p.h @@ -57,7 +57,7 @@ #include #include -#include +#include #include QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandxdgsurface_p.h b/src/plugins/platforms/wayland/qwaylandxdgsurface_p.h index 265d3ba8035..184ef13eb1f 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgsurface_p.h +++ b/src/plugins/platforms/wayland/qwaylandxdgsurface_p.h @@ -56,7 +56,7 @@ #include -#include +#include #include #include diff --git a/src/plugins/platforms/wayland/shared/qwaylandxkb.cpp b/src/plugins/platforms/wayland/shared/qwaylandxkb.cpp index 2afdcce8a05..3e04467deb3 100644 --- a/src/plugins/platforms/wayland/shared/qwaylandxkb.cpp +++ b/src/plugins/platforms/wayland/shared/qwaylandxkb.cpp @@ -43,8 +43,6 @@ #include #include -#ifndef QT_NO_WAYLAND_XKB - #include QT_BEGIN_NAMESPACE @@ -377,5 +375,3 @@ QVector QWaylandXkb::toKeysym(QKeyEvent *event) } QT_END_NAMESPACE - -#endif // QT_NO_WAYLAND_XKB diff --git a/src/plugins/platforms/wayland/shared/qwaylandxkb_p.h b/src/plugins/platforms/wayland/shared/qwaylandxkb_p.h index cdebf1b08b0..230159fbb77 100644 --- a/src/plugins/platforms/wayland/shared/qwaylandxkb_p.h +++ b/src/plugins/platforms/wayland/shared/qwaylandxkb_p.h @@ -41,8 +41,6 @@ #ifndef QWAYLANDXKB_H #define QWAYLANDXKB_H -#ifndef QT_NO_WAYLAND_XKB - #include #include #include @@ -65,6 +63,4 @@ public: QT_END_NAMESPACE -#endif // QT_NO_WAYLAND_XKB - #endif diff --git a/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegration_p.h b/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegration_p.h index 144e58352a0..ab9b736bbca 100644 --- a/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegration_p.h +++ b/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegration_p.h @@ -51,8 +51,7 @@ // We mean it. // -#include -#include +#include #include QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationfactory_p.h b/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationfactory_p.h index 0783465a82a..3edb0a89dbb 100644 --- a/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationfactory_p.h +++ b/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationfactory_p.h @@ -51,7 +51,7 @@ // We mean it. // -#include +#include #include QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationplugin_p.h b/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationplugin_p.h index be511bfc338..266e6980cc0 100644 --- a/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationplugin_p.h +++ b/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationplugin_p.h @@ -51,7 +51,7 @@ // We mean it. // -#include +#include #include #include From f6912982ebd67d8aaa0c9d6b689bee63bc2360b7 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Wed, 16 Nov 2016 11:10:14 +0100 Subject: [PATCH 0388/1507] Use new feature system, part 2 Convert all uses of QT_NO_FOO to proper QT_CONFIG(foo) checks. Change-Id: Id0f0b3325c246567a43d6b2d71b0d69e5535e648 Reviewed-by: Jan Arne Petersen Reviewed-by: Paul Olav Tvete Reviewed-by: Oswald Buddenhagen --- .../qwaylandclientbufferintegrationfactory.cpp | 6 +++--- .../qwaylandserverbufferintegrationfactory.cpp | 6 +++--- .../qwaylandinputdeviceintegrationfactory.cpp | 6 +++--- .../plugins/decorations/bradient/main.cpp | 4 ++-- .../platforms/wayland/qwaylandclipboard.cpp | 4 ++-- .../platforms/wayland/qwaylandclipboard_p.h | 4 ++-- .../platforms/wayland/qwaylanddatadevice.cpp | 4 ++-- .../platforms/wayland/qwaylanddatadevice_p.h | 5 +++-- .../wayland/qwaylanddatadevicemanager.cpp | 4 ++-- .../wayland/qwaylanddatadevicemanager_p.h | 4 ++-- .../platforms/wayland/qwaylanddataoffer.cpp | 4 ++-- .../platforms/wayland/qwaylanddataoffer_p.h | 4 ++-- .../platforms/wayland/qwaylanddatasource.cpp | 4 ++-- .../platforms/wayland/qwaylanddatasource_p.h | 4 ++-- .../wayland/qwaylanddecorationfactory.cpp | 6 +++--- .../platforms/wayland/qwaylanddisplay.cpp | 6 +++--- .../platforms/wayland/qwaylanddisplay_p.h | 4 ++-- src/plugins/platforms/wayland/qwaylanddnd.cpp | 4 ++-- src/plugins/platforms/wayland/qwaylanddnd_p.h | 2 +- .../platforms/wayland/qwaylandinputdevice.cpp | 2 +- .../platforms/wayland/qwaylandintegration.cpp | 16 ++++++++-------- .../platforms/wayland/qwaylandintegration_p.h | 10 +++++----- .../wayland/qwaylandnativeinterface.cpp | 4 ++-- .../wayland/qwaylandnativeinterface_p.h | 2 +- .../wayland/qwaylandshmbackingstore.cpp | 4 ++-- .../wayland/qwaylandshmbackingstore_p.h | 2 +- src/plugins/platforms/wayland/qwaylandwindow.cpp | 2 +- .../qwaylandshellintegrationfactory.cpp | 6 +++--- 28 files changed, 67 insertions(+), 66 deletions(-) diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationfactory.cpp b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationfactory.cpp index aa197e3d104..4e7e7ee5cac 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationfactory.cpp +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationfactory.cpp @@ -48,7 +48,7 @@ QT_BEGIN_NAMESPACE namespace QtWaylandClient { -#ifndef QT_NO_LIBRARY +#if QT_CONFIG(library) Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader, (QWaylandClientBufferIntegrationFactoryInterface_iid, QLatin1String("/wayland-graphics-integration-client"), Qt::CaseInsensitive)) Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, directLoader, @@ -57,7 +57,7 @@ Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, directLoader, QStringList QWaylandClientBufferIntegrationFactory::keys(const QString &pluginPath) { -#ifndef QT_NO_LIBRARY +#if QT_CONFIG(library) QStringList list; if (!pluginPath.isEmpty()) { QCoreApplication::addLibraryPath(pluginPath); @@ -80,7 +80,7 @@ QStringList QWaylandClientBufferIntegrationFactory::keys(const QString &pluginPa QWaylandClientBufferIntegration *QWaylandClientBufferIntegrationFactory::create(const QString &name, const QStringList &args, const QString &pluginPath) { -#ifndef QT_NO_LIBRARY +#if QT_CONFIG(library) // Try loading the plugin from platformPluginPath first: if (!pluginPath.isEmpty()) { QCoreApplication::addLibraryPath(pluginPath); diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationfactory.cpp b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationfactory.cpp index dfa0b465485..527dc571a2e 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationfactory.cpp +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationfactory.cpp @@ -48,7 +48,7 @@ QT_BEGIN_NAMESPACE namespace QtWaylandClient { -#ifndef QT_NO_LIBRARY +#if QT_CONFIG(library) Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader, (QWaylandServerBufferIntegrationFactoryInterface_iid, QLatin1String("/wayland-graphics-integration-client"), Qt::CaseInsensitive)) Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, directLoader, @@ -57,7 +57,7 @@ Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, directLoader, QStringList QWaylandServerBufferIntegrationFactory::keys(const QString &pluginPath) { -#ifndef QT_NO_LIBRARY +#if QT_CONFIG(library) QStringList list; if (!pluginPath.isEmpty()) { QCoreApplication::addLibraryPath(pluginPath); @@ -80,7 +80,7 @@ QStringList QWaylandServerBufferIntegrationFactory::keys(const QString &pluginPa QWaylandServerBufferIntegration *QWaylandServerBufferIntegrationFactory::create(const QString &name, const QStringList &args, const QString &pluginPath) { -#ifndef QT_NO_LIBRARY +#if QT_CONFIG(library) // Try loading the plugin from platformPluginPath first: if (!pluginPath.isEmpty()) { QCoreApplication::addLibraryPath(pluginPath); diff --git a/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationfactory.cpp b/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationfactory.cpp index de303d009c2..c069a3645a4 100644 --- a/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationfactory.cpp +++ b/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationfactory.cpp @@ -48,7 +48,7 @@ QT_BEGIN_NAMESPACE namespace QtWaylandClient { -#ifndef QT_NO_LIBRARY +#if QT_CONFIG(library) Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader, (QWaylandInputDeviceIntegrationFactoryInterface_iid, QLatin1String("/wayland-inputdevice-integration"), Qt::CaseInsensitive)) Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, directLoader, @@ -57,7 +57,7 @@ Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, directLoader, QStringList QWaylandInputDeviceIntegrationFactory::keys(const QString &pluginPath) { -#ifndef QT_NO_LIBRARY +#if QT_CONFIG(library) QStringList list; if (!pluginPath.isEmpty()) { QCoreApplication::addLibraryPath(pluginPath); @@ -80,7 +80,7 @@ QStringList QWaylandInputDeviceIntegrationFactory::keys(const QString &pluginPat QWaylandInputDeviceIntegration *QWaylandInputDeviceIntegrationFactory::create(const QString &name, const QStringList &args, const QString &pluginPath) { -#ifndef QT_NO_LIBRARY +#if QT_CONFIG(library) // Try loading the plugin from platformPluginPath first: if (!pluginPath.isEmpty()) { QCoreApplication::addLibraryPath(pluginPath); diff --git a/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp b/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp index f7ce0fca6f0..f57b816e845 100644 --- a/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp +++ b/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp @@ -56,7 +56,7 @@ namespace QtWaylandClient { #define BUTTON_SPACING 5 -#ifndef QT_NO_IMAGEFORMAT_XPM +#if QT_CONFIG(imageformat_xpm) # define BUTTON_WIDTH 10 static const char * const qt_close_xpm[] = { @@ -265,7 +265,7 @@ void QWaylandBradientDecoration::paint(QPaintDevice *device) p.restore(); } -#ifndef QT_NO_IMAGEFORMAT_XPM +#if QT_CONFIG(imageformat_xpm) p.save(); // Close button diff --git a/src/plugins/platforms/wayland/qwaylandclipboard.cpp b/src/plugins/platforms/wayland/qwaylandclipboard.cpp index 409abaa5684..68fb737ccb0 100644 --- a/src/plugins/platforms/wayland/qwaylandclipboard.cpp +++ b/src/plugins/platforms/wayland/qwaylandclipboard.cpp @@ -44,7 +44,7 @@ #include "qwaylanddatasource_p.h" #include "qwaylanddatadevice_p.h" -#ifndef QT_NO_DRAGANDDROP +#if QT_CONFIG(draganddrop) QT_BEGIN_NAMESPACE @@ -118,4 +118,4 @@ bool QWaylandClipboard::ownsMode(QClipboard::Mode mode) const QT_END_NAMESPACE -#endif // QT_NO_DRAGANDDROP +#endif // draganddrop diff --git a/src/plugins/platforms/wayland/qwaylandclipboard_p.h b/src/plugins/platforms/wayland/qwaylandclipboard_p.h index d662e512e24..584322e07db 100644 --- a/src/plugins/platforms/wayland/qwaylandclipboard_p.h +++ b/src/plugins/platforms/wayland/qwaylandclipboard_p.h @@ -57,7 +57,7 @@ #include -#ifndef QT_NO_DRAGANDDROP +#if QT_CONFIG(draganddrop) QT_BEGIN_NAMESPACE namespace QtWaylandClient { @@ -85,6 +85,6 @@ private: QT_END_NAMESPACE -#endif // QT_NO_DRAGANDDROP +#endif // draganddrop #endif // QWAYLANDCLIPBOARD_H diff --git a/src/plugins/platforms/wayland/qwaylanddatadevice.cpp b/src/plugins/platforms/wayland/qwaylanddatadevice.cpp index f1a1ba6f023..b76647ea2d0 100644 --- a/src/plugins/platforms/wayland/qwaylanddatadevice.cpp +++ b/src/plugins/platforms/wayland/qwaylanddatadevice.cpp @@ -56,7 +56,7 @@ #include #include -#ifndef QT_NO_DRAGANDDROP +#if QT_CONFIG(draganddrop) QT_BEGIN_NAMESPACE @@ -271,4 +271,4 @@ QPoint QWaylandDataDevice::calculateDragPosition(int x, int y, QWindow *wnd) con QT_END_NAMESPACE -#endif // QT_NO_DRAGANDDROP +#endif // draganddrop diff --git a/src/plugins/platforms/wayland/qwaylanddatadevice_p.h b/src/plugins/platforms/wayland/qwaylanddatadevice_p.h index 318636de791..0b16f97d2c0 100644 --- a/src/plugins/platforms/wayland/qwaylanddatadevice_p.h +++ b/src/plugins/platforms/wayland/qwaylanddatadevice_p.h @@ -52,13 +52,14 @@ // We mean it. // +#include #include #include #include #include -#ifndef QT_NO_DRAGANDDROP +#if QT_CONFIG(draganddrop) QT_BEGIN_NAMESPACE @@ -122,6 +123,6 @@ private: QT_END_NAMESPACE -#endif // QT_NO_DRAGANDDROP +#endif // draganddrop #endif // QWAYLANDDATADEVICE_H diff --git a/src/plugins/platforms/wayland/qwaylanddatadevicemanager.cpp b/src/plugins/platforms/wayland/qwaylanddatadevicemanager.cpp index 5c6f7415755..c398b86fd5f 100644 --- a/src/plugins/platforms/wayland/qwaylanddatadevicemanager.cpp +++ b/src/plugins/platforms/wayland/qwaylanddatadevicemanager.cpp @@ -46,7 +46,7 @@ #include -#ifndef QT_NO_DRAGANDDROP +#if QT_CONFIG(draganddrop) QT_BEGIN_NAMESPACE @@ -83,4 +83,4 @@ QWaylandDisplay *QWaylandDataDeviceManager::display() const QT_END_NAMESPACE -#endif // QT_NO_DRAGANDDROP +#endif // draganddrop diff --git a/src/plugins/platforms/wayland/qwaylanddatadevicemanager_p.h b/src/plugins/platforms/wayland/qwaylanddatadevicemanager_p.h index df8a67abaf0..e7fc2113a35 100644 --- a/src/plugins/platforms/wayland/qwaylanddatadevicemanager_p.h +++ b/src/plugins/platforms/wayland/qwaylanddatadevicemanager_p.h @@ -54,7 +54,7 @@ #include #include -#ifndef QT_NO_DRAGANDDROP +#if QT_CONFIG(draganddrop) QT_BEGIN_NAMESPACE @@ -83,6 +83,6 @@ private: QT_END_NAMESPACE -#endif // QT_NO_DRAGANDDROP +#endif // draganddrop #endif // QWAYLANDDATADEVICEMANAGER_H diff --git a/src/plugins/platforms/wayland/qwaylanddataoffer.cpp b/src/plugins/platforms/wayland/qwaylanddataoffer.cpp index b33a98e0f00..56a18f007d3 100644 --- a/src/plugins/platforms/wayland/qwaylanddataoffer.cpp +++ b/src/plugins/platforms/wayland/qwaylanddataoffer.cpp @@ -47,7 +47,7 @@ #include -#ifndef QT_NO_DRAGANDDROP +#if QT_CONFIG(draganddrop) QT_BEGIN_NAMESPACE @@ -184,4 +184,4 @@ int QWaylandMimeData::readData(int fd, QByteArray &data) const QT_END_NAMESPACE -#endif // QT_NO_DRAGANDDROP +#endif // draganddrop diff --git a/src/plugins/platforms/wayland/qwaylanddataoffer_p.h b/src/plugins/platforms/wayland/qwaylanddataoffer_p.h index 07adf342a35..96799c861e8 100644 --- a/src/plugins/platforms/wayland/qwaylanddataoffer_p.h +++ b/src/plugins/platforms/wayland/qwaylanddataoffer_p.h @@ -56,7 +56,7 @@ #include #include -#ifndef QT_NO_DRAGANDDROP +#if QT_CONFIG(draganddrop) QT_BEGIN_NAMESPACE namespace QtWaylandClient { @@ -106,5 +106,5 @@ private: } QT_END_NAMESPACE -#endif // QT_NO_DRAGANDDROP +#endif // draganddrop #endif diff --git a/src/plugins/platforms/wayland/qwaylanddatasource.cpp b/src/plugins/platforms/wayland/qwaylanddatasource.cpp index bada694ca55..036bd0d8651 100644 --- a/src/plugins/platforms/wayland/qwaylanddatasource.cpp +++ b/src/plugins/platforms/wayland/qwaylanddatasource.cpp @@ -49,7 +49,7 @@ #include -#ifndef QT_NO_DRAGANDDROP +#if QT_CONFIG(draganddrop) QT_BEGIN_NAMESPACE @@ -99,4 +99,4 @@ void QWaylandDataSource::data_source_target(const QString &mime_type) QT_END_NAMESPACE -#endif // QT_NO_DRAGANDDROP +#endif // draganddrop diff --git a/src/plugins/platforms/wayland/qwaylanddatasource_p.h b/src/plugins/platforms/wayland/qwaylanddatasource_p.h index fd8601325ae..540e6ad7a1d 100644 --- a/src/plugins/platforms/wayland/qwaylanddatasource_p.h +++ b/src/plugins/platforms/wayland/qwaylanddatasource_p.h @@ -56,7 +56,7 @@ #include #include -#ifndef QT_NO_DRAGANDDROP +#if QT_CONFIG(draganddrop) QT_BEGIN_NAMESPACE @@ -94,6 +94,6 @@ private: QT_END_NAMESPACE -#endif // QT_NO_DRAGANDDROP +#endif // draganddrop #endif // QWAYLANDDATASOURCE_H diff --git a/src/plugins/platforms/wayland/qwaylanddecorationfactory.cpp b/src/plugins/platforms/wayland/qwaylanddecorationfactory.cpp index 43c712fc092..1279e3039f6 100644 --- a/src/plugins/platforms/wayland/qwaylanddecorationfactory.cpp +++ b/src/plugins/platforms/wayland/qwaylanddecorationfactory.cpp @@ -48,7 +48,7 @@ QT_BEGIN_NAMESPACE namespace QtWaylandClient { -#ifndef QT_NO_LIBRARY +#if QT_CONFIG(library) Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader, (QWaylandDecorationFactoryInterface_iid, QLatin1String("/wayland-decoration-client"), Qt::CaseInsensitive)) Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, directLoader, @@ -57,7 +57,7 @@ Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, directLoader, QStringList QWaylandDecorationFactory::keys(const QString &pluginPath) { -#ifndef QT_NO_LIBRARY +#if QT_CONFIG(library) QStringList list; if (!pluginPath.isEmpty()) { QCoreApplication::addLibraryPath(pluginPath); @@ -80,7 +80,7 @@ QStringList QWaylandDecorationFactory::keys(const QString &pluginPath) QWaylandAbstractDecoration *QWaylandDecorationFactory::create(const QString &name, const QStringList &args, const QString &pluginPath) { -#ifndef QT_NO_LIBRARY +#if QT_CONFIG(library) // Try loading the plugin from platformPluginPath first: if (!pluginPath.isEmpty()) { QCoreApplication::addLibraryPath(pluginPath); diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index de38e3f2584..534373b1606 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -120,7 +120,7 @@ QWaylandWindowManagerIntegration *QWaylandDisplay::windowManagerIntegration() co QWaylandDisplay::QWaylandDisplay(QWaylandIntegration *waylandIntegration) : mWaylandIntegration(waylandIntegration) -#ifndef QT_NO_DRAGANDDROP +#if QT_CONFIG(draganddrop) , mDndSelectionHandler(0) #endif , mWindowExtension(0) @@ -160,7 +160,7 @@ QWaylandDisplay::~QWaylandDisplay(void) mWaylandIntegration->destroyScreen(screen); } mScreens.clear(); -#ifndef QT_NO_DRAGANDDROP +#if QT_CONFIG(draganddrop) delete mDndSelectionHandler.take(); #endif wl_display_disconnect(mDisplay); @@ -255,7 +255,7 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin } else if (interface == QStringLiteral("wl_seat")) { QWaylandInputDevice *inputDevice = mWaylandIntegration->createInputDevice(this, version, id); mInputDevices.append(inputDevice); -#ifndef QT_NO_DRAGANDDROP +#if QT_CONFIG(draganddrop) } else if (interface == QStringLiteral("wl_data_device_manager")) { mDndSelectionHandler.reset(new QWaylandDataDeviceManager(this, id)); #endif diff --git a/src/plugins/platforms/wayland/qwaylanddisplay_p.h b/src/plugins/platforms/wayland/qwaylanddisplay_p.h index afbe676514c..a4631b95f84 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay_p.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay_p.h @@ -137,7 +137,7 @@ public: QList inputDevices() const { return mInputDevices; } QWaylandInputDevice *defaultInputDevice() const; QWaylandInputDevice *currentInputDevice() const { return defaultInputDevice(); } -#ifndef QT_NO_DRAGANDDROP +#if QT_CONFIG(draganddrop) QWaylandDataDeviceManager *dndSelectionHandler() const { return mDndSelectionHandler.data(); } #endif QtWayland::qt_surface_extension *windowExtension() const { return mWindowExtension.data(); } @@ -202,7 +202,7 @@ private: QList mInputDevices; QList mRegistryListeners; QWaylandIntegration *mWaylandIntegration; -#ifndef QT_NO_DRAGANDDROP +#if QT_CONFIG(draganddrop) QScopedPointer mDndSelectionHandler; #endif QScopedPointer mWindowExtension; diff --git a/src/plugins/platforms/wayland/qwaylanddnd.cpp b/src/plugins/platforms/wayland/qwaylanddnd.cpp index e29267fc901..54c075c4a3b 100644 --- a/src/plugins/platforms/wayland/qwaylanddnd.cpp +++ b/src/plugins/platforms/wayland/qwaylanddnd.cpp @@ -50,7 +50,7 @@ #include QT_BEGIN_NAMESPACE -#ifndef QT_NO_DRAGANDDROP +#if QT_CONFIG(draganddrop) namespace QtWaylandClient { QWaylandDrag::QWaylandDrag(QWaylandDisplay *display) @@ -131,5 +131,5 @@ void QWaylandDrag::finishDrag(const QPlatformDropQtResponse &response) } } -#endif // QT_NO_DRAGANDDROP +#endif // draganddrop QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylanddnd_p.h b/src/plugins/platforms/wayland/qwaylanddnd_p.h index bcae8ace9ab..215a8b74d07 100644 --- a/src/plugins/platforms/wayland/qwaylanddnd_p.h +++ b/src/plugins/platforms/wayland/qwaylanddnd_p.h @@ -64,7 +64,7 @@ QT_BEGIN_NAMESPACE namespace QtWaylandClient { class QWaylandDisplay; -#ifndef QT_NO_DRAGANDDROP +#if QT_CONFIG(draganddrop) class Q_WAYLAND_CLIENT_EXPORT QWaylandDrag : public QBasicDrag { public: diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index 71be6bdf873..4e8ef7b6787 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -190,7 +190,7 @@ QWaylandInputDevice::QWaylandInputDevice(QWaylandDisplay *display, int version, , mSerial(0) , mTouchDevice(0) { -#ifndef QT_NO_DRAGANDDROP +#if QT_CONFIG(draganddrop) if (mQDisplay->dndSelectionHandler()) { mDataDevice = mQDisplay->dndSelectionHandler()->getDataDevice(this); } diff --git a/src/plugins/platforms/wayland/qwaylandintegration.cpp b/src/plugins/platforms/wayland/qwaylandintegration.cpp index 32b4b895315..748f4f29c8d 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandintegration.cpp @@ -96,7 +96,7 @@ public: const QByteArray desktopEnvironment = QGuiApplicationPrivate::platformIntegration()->services()->desktopEnvironment(); if (desktopEnvironment == QByteArrayLiteral("KDE")) { -#ifndef QT_NO_SETTINGS +#if QT_CONFIG(settings) result.push_back(QStringLiteral("kde")); #endif } else if (!desktopEnvironment.isEmpty() && @@ -122,7 +122,7 @@ QWaylandIntegration::QWaylandIntegration() , mInputDeviceIntegration(Q_NULLPTR) , mFontDb(new QGenericUnixFontDatabase()) , mNativeInterface(new QWaylandNativeInterface(this)) -#ifndef QT_NO_ACCESSIBILITY +#if QT_CONFIG(accessibility) , mAccessibility(new QPlatformAccessibility()) #endif , mClientBufferIntegrationInitialized(false) @@ -131,7 +131,7 @@ QWaylandIntegration::QWaylandIntegration() { initializeInputDeviceIntegration(); mDisplay.reset(new QWaylandDisplay(this)); -#ifndef QT_NO_DRAGANDDROP +#if QT_CONFIG(draganddrop) mClipboard.reset(new QWaylandClipboard(mDisplay.data())); mDrag.reset(new QWaylandDrag(mDisplay.data())); #endif @@ -188,14 +188,14 @@ QPlatformWindow *QWaylandIntegration::createPlatformWindow(QWindow *window) cons return new QWaylandShmWindow(window); } -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) QPlatformOpenGLContext *QWaylandIntegration::createPlatformOpenGLContext(QOpenGLContext *context) const { if (mDisplay->clientBufferIntegration()) return mDisplay->clientBufferIntegration()->createPlatformOpenGLContext(context->format(), context->shareHandle()); return 0; } -#endif // QT_NO_OPENGL +#endif // opengl QPlatformBackingStore *QWaylandIntegration::createPlatformBackingStore(QWindow *window) const { @@ -223,7 +223,7 @@ QPlatformFontDatabase *QWaylandIntegration::fontDatabase() const return mFontDb.data(); } -#ifndef QT_NO_DRAGANDDROP +#if QT_CONFIG(draganddrop) QPlatformClipboard *QWaylandIntegration::clipboard() const { return mClipboard.data(); @@ -233,7 +233,7 @@ QPlatformDrag *QWaylandIntegration::drag() const { return mDrag.data(); } -#endif // QT_NO_DRAGANDDROP +#endif // draganddrop QPlatformInputContext *QWaylandIntegration::inputContext() const { @@ -255,7 +255,7 @@ QVariant QWaylandIntegration::styleHint(StyleHint hint) const return QPlatformIntegration::styleHint(hint); } -#ifndef QT_NO_ACCESSIBILITY +#if QT_CONFIG(accessibility) QPlatformAccessibility *QWaylandIntegration::accessibility() const { return mAccessibility.data(); diff --git a/src/plugins/platforms/wayland/qwaylandintegration_p.h b/src/plugins/platforms/wayland/qwaylandintegration_p.h index e30a10ea0c4..39bd812d96b 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration_p.h +++ b/src/plugins/platforms/wayland/qwaylandintegration_p.h @@ -75,7 +75,7 @@ public: bool hasCapability(QPlatformIntegration::Capability cap) const Q_DECL_OVERRIDE; QPlatformWindow *createPlatformWindow(QWindow *window) const Q_DECL_OVERRIDE; -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) QPlatformOpenGLContext *createPlatformOpenGLContext(QOpenGLContext *context) const Q_DECL_OVERRIDE; #endif QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const Q_DECL_OVERRIDE; @@ -86,7 +86,7 @@ public: QPlatformFontDatabase *fontDatabase() const Q_DECL_OVERRIDE; QPlatformNativeInterface *nativeInterface() const Q_DECL_OVERRIDE; -#ifndef QT_NO_DRAGANDDROP +#if QT_CONFIG(draganddrop) QPlatformClipboard *clipboard() const Q_DECL_OVERRIDE; QPlatformDrag *drag() const Q_DECL_OVERRIDE; #endif @@ -94,7 +94,7 @@ public: QVariant styleHint(StyleHint hint) const Q_DECL_OVERRIDE; -#ifndef QT_NO_ACCESSIBILITY +#if QT_CONFIG(accessibility) QPlatformAccessibility *accessibility() const Q_DECL_OVERRIDE; #endif @@ -126,14 +126,14 @@ private: QWaylandShellIntegration *createShellIntegration(const QString& interfaceName); QScopedPointer mFontDb; -#ifndef QT_NO_DRAGANDDROP +#if QT_CONFIG(draganddrop) QScopedPointer mClipboard; QScopedPointer mDrag; #endif QScopedPointer mDisplay; QScopedPointer mNativeInterface; QScopedPointer mInputContext; -#ifndef QT_NO_ACCESSIBILITY +#if QT_CONFIG(accessibility) QScopedPointer mAccessibility; #endif bool mClientBufferIntegrationInitialized; diff --git a/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp b/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp index c0b675f782d..9946c323567 100644 --- a/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp +++ b/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp @@ -116,7 +116,7 @@ void *QWaylandNativeInterface::nativeResourceForScreen(const QByteArray &resourc return nullptr; } -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) void *QWaylandNativeInterface::nativeResourceForContext(const QByteArray &resource, QOpenGLContext *context) { #if QT_CONFIG(opengl) @@ -134,7 +134,7 @@ void *QWaylandNativeInterface::nativeResourceForContext(const QByteArray &resour return nullptr; } -#endif // QT_NO_OPENGL +#endif // opengl QVariantMap QWaylandNativeInterface::windowProperties(QPlatformWindow *window) const { diff --git a/src/plugins/platforms/wayland/qwaylandnativeinterface_p.h b/src/plugins/platforms/wayland/qwaylandnativeinterface_p.h index 63a543ee7b0..7b8b2834255 100644 --- a/src/plugins/platforms/wayland/qwaylandnativeinterface_p.h +++ b/src/plugins/platforms/wayland/qwaylandnativeinterface_p.h @@ -72,7 +72,7 @@ public: QWindow *window) Q_DECL_OVERRIDE; void *nativeResourceForScreen(const QByteArray &resourceString, QScreen *screen) Q_DECL_OVERRIDE; -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) void *nativeResourceForContext(const QByteArray &resource, QOpenGLContext *context) Q_DECL_OVERRIDE; #endif QVariantMap windowProperties(QPlatformWindow *window) const Q_DECL_OVERRIDE; diff --git a/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp b/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp index d0d6cfd30ab..0afdda4c0c3 100644 --- a/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp +++ b/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp @@ -348,7 +348,7 @@ QWaylandWindow *QWaylandShmBackingStore::waylandWindow() const return static_cast(window()->handle()); } -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) QImage QWaylandShmBackingStore::toImage() const { // Invoked from QPlatformBackingStore::composeAndFlush() that is called @@ -357,7 +357,7 @@ QImage QWaylandShmBackingStore::toImage() const return *contentSurface(); } -#endif // QT_NO_OPENGL +#endif // opengl } diff --git a/src/plugins/platforms/wayland/qwaylandshmbackingstore_p.h b/src/plugins/platforms/wayland/qwaylandshmbackingstore_p.h index 5068519d8ed..a5b809c769f 100644 --- a/src/plugins/platforms/wayland/qwaylandshmbackingstore_p.h +++ b/src/plugins/platforms/wayland/qwaylandshmbackingstore_p.h @@ -107,7 +107,7 @@ public: QWaylandWindow *waylandWindow() const; void iterateBuffer(); -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) QImage toImage() const Q_DECL_OVERRIDE; #endif diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 8e40f3b37ff..d16746bac2c 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -795,7 +795,7 @@ void QWaylandWindow::requestActivateWindow() void QWaylandWindow::unfocus() { -#ifndef QT_NO_DRAGANDDROP +#if QT_CONFIG(draganddrop) QWaylandInputDevice *inputDevice = mDisplay->currentInputDevice(); if (inputDevice && inputDevice->dataDevice()) { inputDevice->dataDevice()->invalidateSelectionOffer(); diff --git a/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationfactory.cpp b/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationfactory.cpp index da622d13fba..8bee45c748f 100644 --- a/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationfactory.cpp +++ b/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationfactory.cpp @@ -48,7 +48,7 @@ QT_BEGIN_NAMESPACE namespace QtWaylandClient { -#ifndef QT_NO_LIBRARY +#if QT_CONFIG(library) Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader, (QWaylandShellIntegrationFactoryInterface_iid, QLatin1String("/wayland-shell-integration"), Qt::CaseInsensitive)) Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, directLoader, @@ -57,7 +57,7 @@ Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, directLoader, QStringList QWaylandShellIntegrationFactory::keys(const QString &pluginPath) { -#ifndef QT_NO_LIBRARY +#if QT_CONFIG(library) QStringList list; if (!pluginPath.isEmpty()) { QCoreApplication::addLibraryPath(pluginPath); @@ -80,7 +80,7 @@ QStringList QWaylandShellIntegrationFactory::keys(const QString &pluginPath) QWaylandShellIntegration *QWaylandShellIntegrationFactory::create(const QString &name, const QStringList &args, const QString &pluginPath) { -#ifndef QT_NO_LIBRARY +#if QT_CONFIG(library) // Try loading the plugin from platformPluginPath first: if (!pluginPath.isEmpty()) { QCoreApplication::addLibraryPath(pluginPath); From e56040ec7da414e033b1021c42257e065fbc34cb Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Tue, 22 Nov 2016 15:45:28 +0100 Subject: [PATCH 0389/1507] Fix crash on exit Make sure that QWaylandDrag and QWaylandClientBufferIntegration are destructed before the QWaylandDisplay. Change-Id: I606154c9861a51d7cf3e5afb16d4f805ab9368b8 Reviewed-by: Jan Arne Petersen Reviewed-by: Johan Helsing --- src/plugins/platforms/wayland/qwaylandintegration_p.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandintegration_p.h b/src/plugins/platforms/wayland/qwaylandintegration_p.h index 39bd812d96b..1689581a2f6 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration_p.h +++ b/src/plugins/platforms/wayland/qwaylandintegration_p.h @@ -112,6 +112,11 @@ public: virtual QWaylandServerBufferIntegration *serverBufferIntegration() const; virtual QWaylandShellIntegration *shellIntegration() const; +private: + // NOTE: mDisplay *must* be destructed after mDrag and mClientBufferIntegration. + // Do not move this definition into the private section at the bottom. + QScopedPointer mDisplay; + protected: QScopedPointer mClientBufferIntegration; QScopedPointer mServerBufferIntegration; @@ -130,7 +135,6 @@ private: QScopedPointer mClipboard; QScopedPointer mDrag; #endif - QScopedPointer mDisplay; QScopedPointer mNativeInterface; QScopedPointer mInputContext; #if QT_CONFIG(accessibility) From d14378ec1cc0f4a3e91850acf62621eca1ff6273 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Wed, 23 Nov 2016 14:01:41 +0100 Subject: [PATCH 0390/1507] Fix crash when destroying focus window Make sure we don't try to disable input for a window that has already been destroyed. Change-Id: I1224599b3c43e2315b3571f01c5896a001614dc4 Reviewed-by: Johan Helsing Reviewed-by: Jan Arne Petersen --- src/plugins/platforms/wayland/qwaylandinputcontext.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandinputcontext.cpp b/src/plugins/platforms/wayland/qwaylandinputcontext.cpp index 5a58d6d7509..dcc4ad5c7a0 100644 --- a/src/plugins/platforms/wayland/qwaylandinputcontext.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputcontext.cpp @@ -532,7 +532,8 @@ void QWaylandInputContext::setFocusObject(QObject *) if (mCurrentWindow && mCurrentWindow->handle()) { if (mCurrentWindow.data() != window || !inputMethodAccepted()) { struct ::wl_surface *surface = static_cast(mCurrentWindow->handle())->object(); - textInput()->disable(surface); + if (surface) + textInput()->disable(surface); mCurrentWindow.clear(); } } From 7a116ac3f02dc91ea2424d03facaa6a9f06310ae Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Thu, 24 Nov 2016 13:50:19 +0100 Subject: [PATCH 0391/1507] Don't crash when trying to run on a compositor without outputs Change-Id: I164ad71f42dff1ad92576729040608016497a56a Reviewed-by: Jan Arne Petersen Reviewed-by: Giulio Camuffo --- src/plugins/platforms/wayland/qwaylandintegration.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/plugins/platforms/wayland/qwaylandintegration.cpp b/src/plugins/platforms/wayland/qwaylandintegration.cpp index 748f4f29c8d..78d4284bd9a 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandintegration.cpp @@ -216,6 +216,11 @@ void QWaylandIntegration::initialize() int fd = wl_display_get_fd(mDisplay->wl_display()); QSocketNotifier *sn = new QSocketNotifier(fd, QSocketNotifier::Read, mDisplay.data()); QObject::connect(sn, SIGNAL(activated(int)), mDisplay.data(), SLOT(flushRequests())); + + if (mDisplay->screens().isEmpty()) { + qWarning() << "Running on a compositor with no screens is not supported"; + ::exit(EXIT_FAILURE); + } } QPlatformFontDatabase *QWaylandIntegration::fontDatabase() const From 4f2c0f1a4e4cba79f310123325859ab0f2e5a648 Mon Sep 17 00:00:00 2001 From: Giulio Camuffo Date: Sat, 2 Jul 2016 10:57:16 +0200 Subject: [PATCH 0392/1507] Add xdg_shell_v6 support for Qt clients Task-number: QTBUG-56174 Change-Id: I6610905d0c9f29be29e812bcac193ea2a7e4f107 Reviewed-by: Paul Olav Tvete Reviewed-by: Johan Helsing --- .../protocols/xdg-shell-unstable-v6.xml | 1041 +++++++++++++++++ src/plugins/platforms/wayland/client.pro | 5 + .../wayland/qwaylandinputcontext.cpp | 3 +- .../platforms/wayland/qwaylandintegration.cpp | 5 + .../wayland/qwaylandshellsurface_p.h | 1 + .../platforms/wayland/qwaylandwindow.cpp | 19 +- .../platforms/wayland/qwaylandwindow_p.h | 1 + .../platforms/wayland/qwaylandxdgshellv6.cpp | 246 ++++ .../platforms/wayland/qwaylandxdgshellv6_p.h | 145 +++ .../wayland/qwaylandxdgshellv6integration.cpp | 71 ++ .../wayland/qwaylandxdgshellv6integration_p.h | 73 ++ 11 files changed, 1603 insertions(+), 7 deletions(-) create mode 100644 src/3rdparty/wayland/protocols/xdg-shell-unstable-v6.xml create mode 100644 src/plugins/platforms/wayland/qwaylandxdgshellv6.cpp create mode 100644 src/plugins/platforms/wayland/qwaylandxdgshellv6_p.h create mode 100644 src/plugins/platforms/wayland/qwaylandxdgshellv6integration.cpp create mode 100644 src/plugins/platforms/wayland/qwaylandxdgshellv6integration_p.h diff --git a/src/3rdparty/wayland/protocols/xdg-shell-unstable-v6.xml b/src/3rdparty/wayland/protocols/xdg-shell-unstable-v6.xml new file mode 100644 index 00000000000..e49d74fccd8 --- /dev/null +++ b/src/3rdparty/wayland/protocols/xdg-shell-unstable-v6.xml @@ -0,0 +1,1041 @@ + + + + + Copyright © 2008-2013 Kristian Høgsberg + Copyright © 2013 Rafael Antognolli + Copyright © 2013 Jasper St. Pierre + Copyright © 2010-2013 Intel Corporation + + 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. + + + + + xdg_shell allows clients to turn a wl_surface into a "real window" + which can be dragged, resized, stacked, and moved around by the + user. Everything about this interface is suited towards traditional + desktop environments. + + + + + + + + + + + + + + Destroy this xdg_shell object. + + Destroying a bound xdg_shell object while there are surfaces + still alive created by this xdg_shell object instance is illegal + and will result in a protocol error. + + + + + + Create a positioner object. A positioner object is used to position + surfaces relative to some parent surface. See the interface description + and xdg_surface.get_popup for details. + + + + + + + This creates an xdg_surface for the given surface. While xdg_surface + itself is not a role, the corresponding surface may only be assigned + a role extending xdg_surface, such as xdg_toplevel or xdg_popup. + + This creates an xdg_surface for the given surface. An xdg_surface is + used as basis to define a role to a given surface, such as xdg_toplevel + or xdg_popup. It also manages functionality shared between xdg_surface + based surface roles. + + See the documentation of xdg_surface for more details about what an + xdg_surface is and how it is used. + + + + + + + + A client must respond to a ping event with a pong request or + the client may be deemed unresponsive. See xdg_shell.ping. + + + + + + + The ping event asks the client if it's still alive. Pass the + serial specified in the event back to the compositor by sending + a "pong" request back with the specified serial. See xdg_shell.ping. + + Compositors can use this to determine if the client is still + alive. It's unspecified what will happen if the client doesn't + respond to the ping request, or in what timeframe. Clients should + try to respond in a reasonable amount of time. + + A compositor is free to ping in any way it wants, but a client must + always respond to any xdg_shell object it created. + + + + + + + + The xdg_positioner provides a collection of rules for the placement of a + child surface relative to a parent surface. Rules can be defined to ensure + the child surface remains within the visible area's borders, and to + specify how the child surface changes its position, such as sliding along + an axis, or flipping around a rectangle. + + See the various requests for details about possible rules. + + At the time of the request, the compositor makes a copy of the rules + specified by the xdg_positioner. Thus, after the request is complete the + xdg_positioner object can be destroyed or reused; further changes to the + object will have no effect on previous usages. + + For an xdg_positioner object to be considered complete, it must have a + non-zero size set by set_size, and a non-zero anchor rectangle set by + set_anchor_rect. Passing an incomplete xdg_positioner object when + positioning a surface raises an error. + + + + + + + + + Notify the compositor that the xdg_positioner will no longer be used. + + + + + + Set the size of the surface that is to be positioned with the positioner + object. The size is in surface-local coordinates and corresponds to the + window geometry. See xdg_surface.set_window_geometry. + + If a zero or negative size is set the invalid_input error is raised. + + + + + + + + Specify the anchor rectangle within the parent surface that the child + surface will be placed relative to. The rectangle is relative to the + window geometry as defined by xdg_surface.set_window_geometry of the + parent surface. The rectangle must be at least 1x1 large. + + When the xdg_positioner object is used to position a child surface, the + anchor rectangle may not extend outside the window geometry of the + positioned child's parent surface. + + If a zero or negative size is set the invalid_input error is raised. + + + + + + + + + + + + + + + + + + Defines a set of edges for the anchor rectangle. These are used to + derive an anchor point that the child surface will be positioned + relative to. If two orthogonal edges are specified (e.g. 'top' and + 'left'), then the anchor point will be the intersection of the edges + (e.g. the top left position of the rectangle); otherwise, the derived + anchor point will be centered on the specified edge, or in the center of + the anchor rectangle if no edge is specified. + + If two parallel anchor edges are specified (e.g. 'left' and 'right'), + the invalid_input error is raised. + + + + + + + + + + + + + + + Defines in what direction a surface should be positioned, relative to + the anchor point of the parent surface. If two orthogonal gravities are + specified (e.g. 'bottom' and 'right'), then the child surface will be + placed in the specified direction; otherwise, the child surface will be + centered over the anchor point on any axis that had no gravity + specified. + + If two parallel gravities are specified (e.g. 'left' and 'right'), the + invalid_input error is raised. + + + + + + + The constraint adjustment value define ways the compositor will adjust + the position of the surface, if the unadjusted position would result + in the surface being partly constrained. + + Whether a surface is considered 'constrained' is left to the compositor + to determine. For example, the surface may be partly outside the + compositor's defined 'work area', thus necessitating the child surface's + position be adjusted until it is entirely inside the work area. + + The adjustments can be combined, according to a defined precedence: 1) + Flip, 2) Slide, 3) Resize. + + + + Don't alter the surface position even if it is constrained on some + axis, for example partially outside the edge of a monitor. + + + + + Slide the surface along the x axis until it is no longer constrained. + + First try to slide towards the direction of the gravity on the x axis + until either the edge in the opposite direction of the gravity is + unconstrained or the edge in the direction of the gravity is + constrained. + + Then try to slide towards the opposite direction of the gravity on the + x axis until either the edge in the direction of the gravity is + unconstrained or the edge in the opposite direction of the gravity is + constrained. + + + + + Slide the surface along the y axis until it is no longer constrained. + + First try to slide towards the direction of the gravity on the y axis + until either the edge in the opposite direction of the gravity is + unconstrained or the edge in the direction of the gravity is + constrained. + + Then try to slide towards the opposite direction of the gravity on the + y axis until either the edge in the direction of the gravity is + unconstrained or the edge in the opposite direction of the gravity is + constrained. + + + + + Invert the anchor and gravity on the x axis if the surface is + constrained on the x axis. For example, if the left edge of the + surface is constrained, the gravity is 'left' and the anchor is + 'left', change the gravity to 'right' and the anchor to 'right'. + + If the adjusted position also ends up being constrained, the resulting + position of the flip_x adjustment will be the one before the + adjustment. + + + + + Invert the anchor and gravity on the y axis if the surface is + constrained on the y axis. For example, if the bottom edge of the + surface is constrained, the gravity is 'bottom' and the anchor is + 'bottom', change the gravity to 'top' and the anchor to 'top'. + + If the adjusted position also ends up being constrained, the resulting + position of the flip_y adjustment will be the one before the + adjustment. + + + + + Resize the surface horizontally so that it is completely + unconstrained. + + + + + Resize the surface vertically so that it is completely unconstrained. + + + + + + + Specify how the window should be positioned if the originally intended + position caused the surface to be constrained, meaning at least + partially outside positioning boundaries set by the compositor. The + adjustment is set by constructing a bitmask describing the adjustment to + be made when the surface is constrained on that axis. + + If no bit for one axis is set, the compositor will assume that the child + surface should not change its position on that axis when constrained. + + If more than one bit for one axis is set, the order of how adjustments + are applied is specified in the corresponding adjustment descriptions. + + The default adjustment is none. + + + + + + + Specify the surface position offset relative to the position of the + anchor on the anchor rectangle and the anchor on the surface. For + example if the anchor of the anchor rectangle is at (x, y), the surface + has the gravity bottom|right, and the offset is (ox, oy), the calculated + surface position will be (x + ox, y + oy). The offset position of the + surface is the one used for constraint testing. See + set_constraint_adjustment. + + An example use case is placing a popup menu on top of a user interface + element, while aligning the user interface element of the parent surface + with some user interface element placed somewhere in the popup surface. + + + + + + + + + An interface that may be implemented by a wl_surface, for + implementations that provide a desktop-style user interface. + + It provides a base set of functionality required to construct user + interface elements requiring management by the compositor, such as + toplevel windows, menus, etc. The types of functionality are split into + xdg_surface roles. + + Creating an xdg_surface does not set the role for a wl_surface. In order + to map an xdg_surface, the client must create a role-specific object + using, e.g., get_toplevel, get_popup. The wl_surface for any given + xdg_surface can have at most one role, and may not be assigned any role + not based on xdg_surface. + + A role must be assigned before any other requests are made to the + xdg_surface object. + + The client must call wl_surface.commit on the corresponding wl_surface + for the xdg_surface state to take effect. + + Creating an xdg_surface from a wl_surface which has a buffer attached or + committed is a client error, and any attempts by a client to attach or + manipulate a buffer prior to the first xdg_surface.configure call must + also be treated as errors. + + For a surface to be mapped by the compositor, the following conditions + must be met: (1) the client has assigned a xdg_surface based role to the + surface, (2) the client has set and committed the xdg_surface state and + the role dependent state to the surface and (3) the client has committed a + buffer to the surface. + + + + + + + + + + + Destroy the xdg_surface object. An xdg_surface must only be destroyed + after its role object has been destroyed. + + + + + + This creates an xdg_toplevel object for the given xdg_surface and gives + the associated wl_surface the xdg_toplevel role. + + See the documentation of xdg_toplevel for more details about what an + xdg_toplevel is and how it is used. + + + + + + + This creates an xdg_popup object for the given xdg_surface and gives the + associated wl_surface the xdg_popup role. + + See the documentation of xdg_popup for more details about what an + xdg_popup is and how it is used. + + + + + + + + + The window geometry of a surface is its "visible bounds" from the + user's perspective. Client-side decorations often have invisible + portions like drop-shadows which should be ignored for the + purposes of aligning, placing and constraining windows. + + The window geometry is double buffered, and will be applied at the + time wl_surface.commit of the corresponding wl_surface is called. + + Once the window geometry of the surface is set, it is not possible to + unset it, and it will remain the same until set_window_geometry is + called again, even if a new subsurface or buffer is attached. + + If never set, the value is the full bounds of the surface, + including any subsurfaces. This updates dynamically on every + commit. This unset is meant for extremely simple clients. + + The arguments are given in the surface-local coordinate space of + the wl_surface associated with this xdg_surface. + + The width and height must be greater than zero. Setting an invalid size + will raise an error. When applied, the effective window geometry will be + the set window geometry clamped to the bounding rectangle of the + combined geometry of the surface of the xdg_surface and the associated + subsurfaces. + + + + + + + + + + When a configure event is received, if a client commits the + surface in response to the configure event, then the client + must make an ack_configure request sometime before the commit + request, passing along the serial of the configure event. + + For instance, for toplevel surfaces the compositor might use this + information to move a surface to the top left only when the client has + drawn itself for the maximized or fullscreen state. + + If the client receives multiple configure events before it + can respond to one, it only has to ack the last configure event. + + A client is not required to commit immediately after sending + an ack_configure request - it may even ack_configure several times + before its next surface commit. + + A client may send multiple ack_configure requests before committing, but + only the last request sent before a commit indicates which configure + event the client really is responding to. + + + + + + + The configure event marks the end of a configure sequence. A configure + sequence is a set of one or more events configuring the state of the + xdg_surface, including the final xdg_surface.configure event. + + Where applicable, xdg_surface surface roles will during a configure + sequence extend this event as a latched state sent as events before the + xdg_surface.configure event. Such events should be considered to make up + a set of atomically applied configuration states, where the + xdg_surface.configure commits the accumulated state. + + Clients should arrange their surface for the new states, and then send + an ack_configure request with the serial sent in this configure event at + some point before committing the new surface. + + If the client receives multiple configure events before it can respond + to one, it is free to discard all but the last event it received. + + + + + + + + This interface defines an xdg_surface role which allows a surface to, + among other things, set window-like properties such as maximize, + fullscreen, and minimize, set application-specific metadata like title and + id, and well as trigger user interactive operations such as interactive + resize and move. + + + + + Unmap and destroy the window. The window will be effectively + hidden from the user's point of view, and all state like + maximization, fullscreen, and so on, will be lost. + + + + + + Set the "parent" of this surface. This window should be stacked + above a parent. The parent surface must be mapped as long as this + surface is mapped. + + Parent windows should be set on dialogs, toolboxes, or other + "auxiliary" surfaces, so that the parent is raised when the dialog + is raised. + + + + + + + Set a short title for the surface. + + This string may be used to identify the surface in a task bar, + window list, or other user interface elements provided by the + compositor. + + The string must be encoded in UTF-8. + + + + + + + Set an application identifier for the surface. + + The app ID identifies the general class of applications to which + the surface belongs. The compositor can use this to group multiple + surfaces together, or to determine how to launch a new application. + + For D-Bus activatable applications, the app ID is used as the D-Bus + service name. + + The compositor shell will try to group application surfaces together + by their app ID. As a best practice, it is suggested to select app + ID's that match the basename of the application's .desktop file. + For example, "org.freedesktop.FooViewer" where the .desktop file is + "org.freedesktop.FooViewer.desktop". + + See the desktop-entry specification [0] for more details on + application identifiers and how they relate to well-known D-Bus + names and .desktop files. + + [0] http://standards.freedesktop.org/desktop-entry-spec/ + + + + + + + Clients implementing client-side decorations might want to show + a context menu when right-clicking on the decorations, giving the + user a menu that they can use to maximize or minimize the window. + + This request asks the compositor to pop up such a window menu at + the given position, relative to the local surface coordinates of + the parent surface. There are no guarantees as to what menu items + the window menu contains. + + This request must be used in response to some sort of user action + like a button press, key press, or touch down event. + + + + + + + + + + Start an interactive, user-driven move of the surface. + + This request must be used in response to some sort of user action + like a button press, key press, or touch down event. The passed + serial is used to determine the type of interactive move (touch, + pointer, etc). + + The server may ignore move requests depending on the state of + the surface (e.g. fullscreen or maximized), or if the passed serial + is no longer valid. + + If triggered, the surface will lose the focus of the device + (wl_pointer, wl_touch, etc) used for the move. It is up to the + compositor to visually indicate that the move is taking place, such as + updating a pointer cursor, during the move. There is no guarantee + that the device focus will return when the move is completed. + + + + + + + + These values are used to indicate which edge of a surface + is being dragged in a resize operation. + + + + + + + + + + + + + + + Start a user-driven, interactive resize of the surface. + + This request must be used in response to some sort of user action + like a button press, key press, or touch down event. The passed + serial is used to determine the type of interactive resize (touch, + pointer, etc). + + The server may ignore resize requests depending on the state of + the surface (e.g. fullscreen or maximized). + + If triggered, the client will receive configure events with the + "resize" state enum value and the expected sizes. See the "resize" + enum value for more details about what is required. The client + must also acknowledge configure events using "ack_configure". After + the resize is completed, the client will receive another "configure" + event without the resize state. + + If triggered, the surface also will lose the focus of the device + (wl_pointer, wl_touch, etc) used for the resize. It is up to the + compositor to visually indicate that the resize is taking place, + such as updating a pointer cursor, during the resize. There is no + guarantee that the device focus will return when the resize is + completed. + + The edges parameter specifies how the surface should be resized, + and is one of the values of the resize_edge enum. The compositor + may use this information to update the surface position for + example when dragging the top left corner. The compositor may also + use this information to adapt its behavior, e.g. choose an + appropriate cursor image. + + + + + + + + + The different state values used on the surface. This is designed for + state values like maximized, fullscreen. It is paired with the + configure event to ensure that both the client and the compositor + setting the state can be synchronized. + + States set in this way are double-buffered. They will get applied on + the next commit. + + + + The surface is maximized. The window geometry specified in the configure + event must be obeyed by the client. + + + + + The surface is fullscreen. The window geometry specified in the configure + event must be obeyed by the client. + + + + + The surface is being resized. The window geometry specified in the + configure event is a maximum; the client cannot resize beyond it. + Clients that have aspect ratio or cell sizing configuration can use + a smaller size, however. + + + + + Client window decorations should be painted as if the window is + active. Do not assume this means that the window actually has + keyboard or pointer focus. + + + + + + + Set a maximum size for the window. + + The client can specify a maximum size so that the compositor does + not try to configure the window beyond this size. + + The width and height arguments are in window geometry coordinates. + See xdg_surface.set_window_geometry. + + Values set in this way are double-buffered. They will get applied + on the next commit. + + The compositor can use this information to allow or disallow + different states like maximize or fullscreen and draw accurate + animations. + + Similarly, a tiling window manager may use this information to + place and resize client windows in a more effective way. + + The client should not rely on the compositor to obey the maximum + size. The compositor may decide to ignore the values set by the + client and request a larger size. + + If never set, or a value of zero in the request, means that the + client has no expected maximum size in the given dimension. + As a result, a client wishing to reset the maximum size + to an unspecified state can use zero for width and height in the + request. + + Requesting a maximum size to be smaller than the minimum size of + a surface is illegal and will result in a protocol error. + + The width and height must be greater than or equal to zero. Using + strictly negative values for width and height will result in a + protocol error. + + + + + + + + Set a minimum size for the window. + + The client can specify a minimum size so that the compositor does + not try to configure the window below this size. + + The width and height arguments are in window geometry coordinates. + See xdg_surface.set_window_geometry. + + Values set in this way are double-buffered. They will get applied + on the next commit. + + The compositor can use this information to allow or disallow + different states like maximize or fullscreen and draw accurate + animations. + + Similarly, a tiling window manager may use this information to + place and resize client windows in a more effective way. + + The client should not rely on the compositor to obey the minimum + size. The compositor may decide to ignore the values set by the + client and request a smaller size. + + If never set, or a value of zero in the request, means that the + client has no expected minimum size in the given dimension. + As a result, a client wishing to reset the minimum size + to an unspecified state can use zero for width and height in the + request. + + Requesting a minimum size to be larger than the maximum size of + a surface is illegal and will result in a protocol error. + + The width and height must be greater than or equal to zero. Using + strictly negative values for width and height will result in a + protocol error. + + + + + + + + Maximize the surface. + + After requesting that the surface should be maximized, the compositor + will respond by emitting a configure event with the "maximized" state + and the required window geometry. The client should then update its + content, drawing it in a maximized state, i.e. without shadow or other + decoration outside of the window geometry. The client must also + acknowledge the configure when committing the new content (see + ack_configure). + + It is up to the compositor to decide how and where to maximize the + surface, for example which output and what region of the screen should + be used. + + If the surface was already maximized, the compositor will still emit + a configure event with the "maximized" state. + + + + + + Unmaximize the surface. + + After requesting that the surface should be unmaximized, the compositor + will respond by emitting a configure event without the "maximized" + state. If available, the compositor will include the window geometry + dimensions the window had prior to being maximized in the configure + request. The client must then update its content, drawing it in a + regular state, i.e. potentially with shadow, etc. The client must also + acknowledge the configure when committing the new content (see + ack_configure). + + It is up to the compositor to position the surface after it was + unmaximized; usually the position the surface had before maximizing, if + applicable. + + If the surface was already not maximized, the compositor will still + emit a configure event without the "maximized" state. + + + + + + Make the surface fullscreen. + + You can specify an output that you would prefer to be fullscreen. + If this value is NULL, it's up to the compositor to choose which + display will be used to map this surface. + + If the surface doesn't cover the whole output, the compositor will + position the surface in the center of the output and compensate with + black borders filling the rest of the output. + + + + + + + + Request that the compositor minimize your surface. There is no + way to know if the surface is currently minimized, nor is there + any way to unset minimization on this surface. + + If you are looking to throttle redrawing when minimized, please + instead use the wl_surface.frame event for this, as this will + also work with live previews on windows in Alt-Tab, Expose or + similar compositor features. + + + + + + This configure event asks the client to resize its toplevel surface or + to change its state. The configured state should not be applied + immediately. See xdg_surface.configure for details. + + The width and height arguments specify a hint to the window + about how its surface should be resized in window geometry + coordinates. See set_window_geometry. + + If the width or height arguments are zero, it means the client + should decide its own window dimension. This may happen when the + compositor needs to configure the state of the surface but doesn't + have any information about any previous or expected dimension. + + The states listed in the event specify how the width/height + arguments should be interpreted, and possibly how it should be + drawn. + + Clients must send an ack_configure in response to this event. See + xdg_surface.configure and xdg_surface.ack_configure for details. + + + + + + + + + The close event is sent by the compositor when the user + wants the surface to be closed. This should be equivalent to + the user clicking the close button in client-side decorations, + if your application has any. + + This is only a request that the user intends to close the + window. The client may choose to ignore this request, or show + a dialog to ask the user to save their data, etc. + + + + + + + A popup surface is a short-lived, temporary surface. It can be used to + implement for example menus, popovers, tooltips and other similar user + interface concepts. + + A popup can be made to take an explicit grab. See xdg_popup.grab for + details. + + When the popup is dismissed, a popup_done event will be sent out, and at + the same time the surface will be unmapped. See the xdg_popup.popup_done + event for details. + + Explicitly destroying the xdg_popup object will also dismiss the popup and + unmap the surface. Clients that want to dismiss the popup when another + surface of their own is clicked should dismiss the popup using the destroy + request. + + The parent surface must have either the xdg_toplevel or xdg_popup surface + role. + + A newly created xdg_popup will be stacked on top of all previously created + xdg_popup surfaces associated with the same xdg_toplevel. + + The parent of an xdg_popup must be mapped (see the xdg_surface + description) before the xdg_popup itself. + + The x and y arguments passed when creating the popup object specify + where the top left of the popup should be placed, relative to the + local surface coordinates of the parent surface. See + xdg_surface.get_popup. + + The client must call wl_surface.commit on the corresponding wl_surface + for the xdg_popup state to take effect. + + + + + + + + + This destroys the popup. Explicitly destroying the xdg_popup + object will also dismiss the popup, and unmap the surface. + + If this xdg_popup is not the "topmost" popup, a protocol error + will be sent. + + + + + + This request makes the created popup take an explicit grab. An explicit + grab will be dismissed when the user dismisses the popup, or when the + client destroys the xdg_popup. This can be done by the user clicking + outside the surface, using the keyboard, or even locking the screen + through closing the lid or a timeout. + + If the compositor denies the grab, the popup will be immediately + dismissed. + + This request must be used in response to some sort of user action like a + button press, key press, or touch down event. The serial number of the + event should be passed as 'serial'. + + The parent of a grabbing popup must either be an xdg_toplevel surface or + another xdg_popup with an explicit grab. If the parent is another + xdg_popup it means that the popups are nested, with this popup now being + the topmost popup. + + Nested popups must be destroyed in the reverse order they were created + in, e.g. the only popup you are allowed to destroy at all times is the + topmost one. + + When compositors choose to dismiss a popup, they may dismiss every + nested grabbing popup as well. When a compositor dismisses popups, it + will follow the same dismissing order as required from the client. + + The parent of a grabbing popup must either be another xdg_popup with an + active explicit grab, or an xdg_popup or xdg_toplevel, if there are no + explicit grabs already taken. + + If the topmost grabbing popup is destroyed, the grab will be returned to + the parent of the popup, if that parent previously had an explicit grab. + + If the parent is a grabbing popup which has already been dismissed, this + popup will be immediately dismissed. If the parent is a popup that did + not take an explicit grab, an error will be raised. + + During a popup grab, the client owning the grab will receive pointer + and touch events for all their surfaces as normal (similar to an + "owner-events" grab in X11 parlance), while the top most grabbing popup + will always have keyboard focus. + + + + + + + + This event asks the popup surface to configure itself given the + configuration. The configured state should not be applied immediately. + See xdg_surface.configure for details. + + The x and y arguments represent the position the popup was placed at + given the xdg_positioner rule, relative to the upper left corner of the + window geometry of the parent surface. + + + + + + + + + + The popup_done event is sent out when a popup is dismissed by the + compositor. The client should destroy the xdg_popup object at this + point. + + + + + diff --git a/src/plugins/platforms/wayland/client.pro b/src/plugins/platforms/wayland/client.pro index 7482cfd6bbd..04f055e6a3e 100644 --- a/src/plugins/platforms/wayland/client.pro +++ b/src/plugins/platforms/wayland/client.pro @@ -30,6 +30,7 @@ WAYLANDCLIENTSOURCES += \ ../extensions/qt-windowmanager.xml \ ../3rdparty/protocol/text-input-unstable-v2.xml \ ../3rdparty/protocol/xdg-shell.xml \ + ../3rdparty/protocol/xdg-shell-unstable-v6.xml \ SOURCES += qwaylandintegration.cpp \ qwaylandnativeinterface.cpp \ @@ -52,6 +53,7 @@ SOURCES += qwaylandintegration.cpp \ qwaylandxdgsurface.cpp \ qwaylandxdgpopup.cpp \ qwaylandxdgshellintegration.cpp \ + qwaylandxdgshellv6integration.cpp \ qwaylandextendedsurface.cpp \ qwaylandsubsurface.cpp \ qwaylandtouch.cpp \ @@ -67,6 +69,7 @@ SOURCES += qwaylandintegration.cpp \ qwaylanddatadevice.cpp \ qwaylandshm.cpp \ qwaylandbuffer.cpp \ + qwaylandxdgshellv6.cpp \ HEADERS += qwaylandintegration_p.h \ qwaylandnativeinterface_p.h \ @@ -90,6 +93,7 @@ HEADERS += qwaylandintegration_p.h \ qwaylandxdgsurface_p.h \ qwaylandxdgpopup_p.h \ qwaylandxdgshellintegration_p.h \ + qwaylandxdgshellv6integration_p.h \ qwaylandextendedsurface_p.h \ qwaylandsubsurface_p.h \ qwaylandtouch_p.h \ @@ -107,6 +111,7 @@ HEADERS += qwaylandintegration_p.h \ ../shared/qwaylandmimehelper_p.h \ ../shared/qwaylandxkb_p.h \ ../shared/qwaylandsharedmemoryformathelper_p.h + qwaylandxdgshellv6_p.h \ include(hardwareintegration/hardwareintegration.pri) include(shellintegration/shellintegration.pri) diff --git a/src/plugins/platforms/wayland/qwaylandinputcontext.cpp b/src/plugins/platforms/wayland/qwaylandinputcontext.cpp index 5a58d6d7509..dcc4ad5c7a0 100644 --- a/src/plugins/platforms/wayland/qwaylandinputcontext.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputcontext.cpp @@ -532,7 +532,8 @@ void QWaylandInputContext::setFocusObject(QObject *) if (mCurrentWindow && mCurrentWindow->handle()) { if (mCurrentWindow.data() != window || !inputMethodAccepted()) { struct ::wl_surface *surface = static_cast(mCurrentWindow->handle())->object(); - textInput()->disable(surface); + if (surface) + textInput()->disable(surface); mCurrentWindow.clear(); } } diff --git a/src/plugins/platforms/wayland/qwaylandintegration.cpp b/src/plugins/platforms/wayland/qwaylandintegration.cpp index 748f4f29c8d..0dcd6b68f0c 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandintegration.cpp @@ -77,6 +77,7 @@ #include "qwaylandshellintegrationfactory_p.h" #include "qwaylandxdgshellintegration_p.h" #include "qwaylandwlshellintegration_p.h" +#include "qwaylandxdgshellv6integration_p.h" #include "qwaylandinputdeviceintegration_p.h" #include "qwaylandinputdeviceintegrationfactory_p.h" @@ -382,8 +383,10 @@ void QWaylandIntegration::initializeShellIntegration() } } else { QStringList preferredShells; + preferredShells << QLatin1String("zxdg_shell_v6"); if (qEnvironmentVariableIsSet("QT_WAYLAND_USE_XDG_SHELL")) preferredShells << QLatin1String("xdg_shell"); + preferredShells << QLatin1String("wl_shell"); Q_FOREACH (QString preferredShell, preferredShells) { @@ -432,6 +435,8 @@ QWaylandShellIntegration *QWaylandIntegration::createShellIntegration(const QStr return new QWaylandWlShellIntegration(mDisplay.data()); } else if (interfaceName == QLatin1Literal("xdg_shell")) { return new QWaylandXdgShellIntegration(mDisplay.data()); + } else if (interfaceName == QLatin1Literal("zxdg_shell_v6")) { + return new QWaylandXdgShellV6Integration(mDisplay.data()); } else { return Q_NULLPTR; } diff --git a/src/plugins/platforms/wayland/qwaylandshellsurface_p.h b/src/plugins/platforms/wayland/qwaylandshellsurface_p.h index e700d5a183b..06d92ba086a 100644 --- a/src/plugins/platforms/wayland/qwaylandshellsurface_p.h +++ b/src/plugins/platforms/wayland/qwaylandshellsurface_p.h @@ -85,6 +85,7 @@ public: virtual void setWindowFlags(Qt::WindowFlags flags); virtual bool isExposed() const { return true; } + virtual bool handleExpose(const QRegion &) { return false; } virtual void raise() {} virtual void lower() {} diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index d16746bac2c..13a78d25d47 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -304,8 +304,15 @@ void QWaylandWindow::setGeometry(const QRect &rect) mSentInitialResize = true; } + sendExposeEvent(QRect(QPoint(), geometry().size())); +} - QWindowSystemInterface::handleExposeEvent(window(), QRect(QPoint(), geometry().size())); + + +void QWaylandWindow::sendExposeEvent(const QRect &rect) +{ + if (mShellSurface && !mShellSurface->handleExpose(rect)) + QWindowSystemInterface::handleExposeEvent(window(), rect); } void QWaylandWindow::setVisible(bool visible) @@ -319,7 +326,7 @@ void QWaylandWindow::setVisible(bool visible) // there was no frame before it will be stuck at the waitForFrameSync() in // QWaylandShmBackingStore::beginPaint(). } else { - QWindowSystemInterface::handleExposeEvent(window(), QRegion()); + sendExposeEvent(QRect()); // when flushing the event queue, it could contain a close event, in which // case 'this' will be deleted. When that happens, we must abort right away. QPointer deleteGuard(this); @@ -414,10 +421,10 @@ void QWaylandWindow::setCanResize(bool canResize) } if (!mConfigure.isEmpty()) { doResize(); - QWindowSystemInterface::handleExposeEvent(window(), QRect(QPoint(), geometry().size())); + sendExposeEvent(QRect(QPoint(), geometry().size())); } else if (mResizeDirty) { mResizeDirty = false; - QWindowSystemInterface::handleExposeEvent(window(), QRect(QPoint(), geometry().size())); + sendExposeEvent(QRect(QPoint(), geometry().size())); } } } @@ -432,7 +439,7 @@ void QWaylandWindow::requestResize() mRequestResizeSent = false; lock.unlock(); - QWindowSystemInterface::handleExposeEvent(window(), QRect(QPoint(), geometry().size())); + sendExposeEvent(QRect(QPoint(), geometry().size())); QWindowSystemInterface::flushWindowSystemEvents(); } @@ -658,7 +665,7 @@ bool QWaylandWindow::createDecoration() QMargins m = frameMargins(); subsurf->set_position(pos.x() + m.left(), pos.y() + m.top()); } - QWindowSystemInterface::handleExposeEvent(window(), QRect(QPoint(), geometry().size())); + sendExposeEvent(QRect(QPoint(), geometry().size())); } return mWindowDecoration; diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index ce295a0de3b..3ca8f42cc43 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -249,6 +249,7 @@ private: bool shouldCreateShellSurface() const; bool shouldCreateSubSurface() const; void reset(); + void sendExposeEvent(const QRect &rect); void handleMouseEventWithDecoration(QWaylandInputDevice *inputDevice, const QWaylandPointerEvent &e); diff --git a/src/plugins/platforms/wayland/qwaylandxdgshellv6.cpp b/src/plugins/platforms/wayland/qwaylandxdgshellv6.cpp new file mode 100644 index 00000000000..b45498d8073 --- /dev/null +++ b/src/plugins/platforms/wayland/qwaylandxdgshellv6.cpp @@ -0,0 +1,246 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2014 Eurogiciel, author: +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the config.tests of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL21$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qwaylandxdgshellv6_p.h" + +#include "qwaylanddisplay_p.h" +#include "qwaylandwindow_p.h" +#include "qwaylandinputdevice_p.h" +#include "qwaylandscreen_p.h" +#include "qwaylandabstractdecoration_p.h" + +#include + +QT_BEGIN_NAMESPACE + +namespace QtWaylandClient { + +QWaylandXdgSurfaceV6::Toplevel::Toplevel(QWaylandXdgSurfaceV6 *xdgSurface) + : QtWayland::zxdg_toplevel_v6(xdgSurface->get_toplevel()) + , m_xdgSurface(xdgSurface) +{ +} + +QWaylandXdgSurfaceV6::Toplevel::~Toplevel() +{ + if (isInitialized()) + destroy(); +} + +void QWaylandXdgSurfaceV6::Toplevel::applyConfigure() +{ + //TODO: resize, activate etc + m_xdgSurface->m_window->configure(0, m_configureState.width, m_configureState.height); +} + +void QWaylandXdgSurfaceV6::Toplevel::zxdg_toplevel_v6_configure(int32_t width, int32_t height, wl_array *states) +{ + m_configureState.width = width; + m_configureState.height = height; + + uint32_t *state = reinterpret_cast(states->data); + size_t numStates = states->size / sizeof(uint32_t); + m_configureState.states.reserve(numStates); + m_configureState.states.clear(); + + for (size_t i = 0; i < numStates; i++) + m_configureState.states << state[i]; +} + +void QWaylandXdgSurfaceV6::Toplevel::zxdg_toplevel_v6_close() +{ +} + +QWaylandXdgSurfaceV6::Popup::Popup(QWaylandXdgSurfaceV6 *xdgSurface, QWaylandXdgSurfaceV6 *parent, + QtWayland::zxdg_positioner_v6 *positioner) + : zxdg_popup_v6(xdgSurface->get_popup(parent->object(), positioner->object())) + , m_xdgSurface(xdgSurface) +{ +} + +QWaylandXdgSurfaceV6::Popup::~Popup() +{ + if (isInitialized()) + destroy(); +} + +void QWaylandXdgSurfaceV6::Popup::applyConfigure() +{ + +} + +void QWaylandXdgSurfaceV6::Popup::zxdg_popup_v6_popup_done() +{ + m_xdgSurface->m_window->window()->close(); +} + +QWaylandXdgSurfaceV6::QWaylandXdgSurfaceV6(QWaylandXdgShellV6 *shell, ::zxdg_surface_v6 *surface, QWaylandWindow *window) + : QWaylandShellSurface(window) + , zxdg_surface_v6(surface) + , m_shell(shell) + , m_window(window) + , m_toplevel(nullptr) + , m_popup(nullptr) + , m_configured(false) +{ +} + +QWaylandXdgSurfaceV6::~QWaylandXdgSurfaceV6() +{ + if (m_popup) + zxdg_popup_v6_destroy(m_popup->object()); + destroy(); +} + +void QWaylandXdgSurfaceV6::resize(QWaylandInputDevice *inputDevice, zxdg_toplevel_v6_resize_edge edges) +{ + Q_ASSERT(m_toplevel && m_toplevel->isInitialized()); + m_toplevel->resize(inputDevice->wl_seat(), inputDevice->serial(), edges); +} + +void QWaylandXdgSurfaceV6::resize(QWaylandInputDevice *inputDevice, enum wl_shell_surface_resize edges) +{ + auto xdgEdges = reinterpret_cast(&edges); + resize(inputDevice, *xdgEdges); +} + + +void QWaylandXdgSurfaceV6::move(QWaylandInputDevice *inputDevice) +{ + Q_ASSERT(m_toplevel && m_toplevel->isInitialized()); + m_toplevel->move(inputDevice->wl_seat(), inputDevice->serial()); +} + +void QWaylandXdgSurfaceV6::setTitle(const QString &title) +{ + if (m_toplevel) + m_toplevel->set_title(title); +} + +void QWaylandXdgSurfaceV6::setAppId(const QString &appId) +{ + if (m_toplevel) + m_toplevel->set_app_id(appId); +} + +void QWaylandXdgSurfaceV6::setType(Qt::WindowType type, QWaylandWindow *transientParent) +{ + if (type == Qt::Popup && transientParent) { + setPopup(transientParent, m_window->display()->lastInputDevice(), m_window->display()->lastInputSerial()); + } else { + setToplevel(); + if (transientParent) { + auto parentXdgSurface = static_cast(transientParent->shellSurface()); + m_toplevel->set_parent(parentXdgSurface->m_toplevel->object()); + } + } +} + +bool QWaylandXdgSurfaceV6::handleExpose(const QRegion ®ion) +{ + if (!m_configured && !region.isEmpty()) { + m_exposeRegion = region; + return true; + } + return false; +} + +void QWaylandXdgSurfaceV6::setToplevel() +{ + Q_ASSERT(!m_toplevel && !m_popup); + m_toplevel = new Toplevel(this); +} + +void QWaylandXdgSurfaceV6::setPopup(QWaylandWindow *parent, QWaylandInputDevice *device, int serial) +{ + Q_ASSERT(!m_toplevel && !m_popup); + + auto parentXdgSurface = static_cast(parent->shellSurface()); + auto positioner = new QtWayland::zxdg_positioner_v6(m_shell->create_positioner()); + // set_popup expects a position relative to the parent + QPoint transientPos = m_window->geometry().topLeft(); // this is absolute + transientPos -= parent->geometry().topLeft(); + if (parent->decoration()) { + transientPos.setX(transientPos.x() + parent->decoration()->margins().left()); + transientPos.setY(transientPos.y() + parent->decoration()->margins().top()); + } + positioner->set_anchor_rect(transientPos.x(), transientPos.y(), 1, 1); + positioner->set_anchor(QtWayland::zxdg_positioner_v6::anchor_top | QtWayland::zxdg_positioner_v6::anchor_left); + positioner->set_gravity(QtWayland::zxdg_positioner_v6::gravity_bottom | QtWayland::zxdg_positioner_v6::gravity_right); + m_popup = new Popup(this, parentXdgSurface, positioner); + positioner->destroy(); + delete positioner; + m_popup->grab(device->wl_seat(), serial); +} + +void QWaylandXdgSurfaceV6::zxdg_surface_v6_configure(uint32_t serial) +{ + m_configured = true; + if (m_toplevel) + m_toplevel->applyConfigure(); + else if (m_popup) + m_popup->applyConfigure(); + + if (!m_exposeRegion.isEmpty()) { + QWindowSystemInterface::handleExposeEvent(m_window->window(), m_exposeRegion); + m_exposeRegion = QRegion(); + } + ack_configure(serial); +} + + + +QWaylandXdgShellV6::QWaylandXdgShellV6(struct ::wl_registry *registry, uint32_t id, uint32_t availableVersion) + : QtWayland::zxdg_shell_v6(registry, id, qMin(availableVersion, 1u)) +{ +} + +QWaylandXdgShellV6::~QWaylandXdgShellV6() +{ + destroy(); +} + +QWaylandXdgSurfaceV6 *QWaylandXdgShellV6::getXdgSurface(QWaylandWindow *window) +{ + return new QWaylandXdgSurfaceV6(this, get_xdg_surface(window->object()), window); +} + +void QWaylandXdgShellV6::zxdg_shell_v6_ping(uint32_t serial) +{ + pong(serial); +} + +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandxdgshellv6_p.h b/src/plugins/platforms/wayland/qwaylandxdgshellv6_p.h new file mode 100644 index 00000000000..81be89de274 --- /dev/null +++ b/src/plugins/platforms/wayland/qwaylandxdgshellv6_p.h @@ -0,0 +1,145 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2014 Eurogiciel, author: +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the config.tests of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL21$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWAYLANDXDGSHELLV6_H +#define QWAYLANDXDGSHELLV6_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include +#include + +#include + +#include +#include +#include "qwaylandshellsurface_p.h" + +QT_BEGIN_NAMESPACE + +class QWindow; + +namespace QtWaylandClient { + +class QWaylandWindow; +class QWaylandInputDevice; +class QWaylandXdgShellV6; + +class Q_WAYLAND_CLIENT_EXPORT QWaylandXdgSurfaceV6 : public QWaylandShellSurface, public QtWayland::zxdg_surface_v6 +{ +public: + QWaylandXdgSurfaceV6(QWaylandXdgShellV6 *shell, ::zxdg_surface_v6 *surface, QWaylandWindow *window); + ~QWaylandXdgSurfaceV6(); + + void resize(QWaylandInputDevice *inputDevice, enum zxdg_toplevel_v6_resize_edge edges); + void resize(QWaylandInputDevice *inputDevice, enum wl_shell_surface_resize edges) override; + void move(QWaylandInputDevice *inputDevice) override; + void setTitle(const QString &title) override; + void setAppId(const QString &appId) override; + + void setType(Qt::WindowType type, QWaylandWindow *transientParent) override; + bool handleExpose(const QRegion &) override; + +protected: + void zxdg_surface_v6_configure(uint32_t serial) override; + +private: + class Toplevel: public QtWayland::zxdg_toplevel_v6 + { + public: + Toplevel(QWaylandXdgSurfaceV6 *xdgSurface); + ~Toplevel(); + + void applyConfigure(); + + void zxdg_toplevel_v6_configure(int32_t width, int32_t height, wl_array *states) override; + void zxdg_toplevel_v6_close() override; + + struct { + int32_t width, height; + QVarLengthArray states; + } m_configureState; + + QWaylandXdgSurfaceV6 *m_xdgSurface; + }; + + class Popup : public QtWayland::zxdg_popup_v6 { + public: + Popup(QWaylandXdgSurfaceV6 *xdgSurface, QWaylandXdgSurfaceV6 *parent, QtWayland::zxdg_positioner_v6 *positioner); + ~Popup(); + + void applyConfigure(); + void zxdg_popup_v6_popup_done() override; + + QWaylandXdgSurfaceV6 *m_xdgSurface; + }; + + void setToplevel(); + void setPopup(QWaylandWindow *parent, QWaylandInputDevice *device, int serial); + + QWaylandXdgShellV6 *m_shell; + QWaylandWindow *m_window; + Toplevel *m_toplevel; + Popup *m_popup; + bool m_configured; + QRegion m_exposeRegion; +}; + +class Q_WAYLAND_CLIENT_EXPORT QWaylandXdgShellV6 : public QtWayland::zxdg_shell_v6 +{ +public: + QWaylandXdgShellV6(struct ::wl_registry *registry, uint32_t id, uint32_t availableVersion); + + QWaylandXdgSurfaceV6 *getXdgSurface(QWaylandWindow *window); + + virtual ~QWaylandXdgShellV6(); + +private: + void zxdg_shell_v6_ping(uint32_t serial) override; +}; + +QT_END_NAMESPACE + +} + +#endif // QWAYLANDXDGSHELLV6_H diff --git a/src/plugins/platforms/wayland/qwaylandxdgshellv6integration.cpp b/src/plugins/platforms/wayland/qwaylandxdgshellv6integration.cpp new file mode 100644 index 00000000000..93f31987590 --- /dev/null +++ b/src/plugins/platforms/wayland/qwaylandxdgshellv6integration.cpp @@ -0,0 +1,71 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL21$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qwaylandxdgshellv6integration_p.h" + +#include +#include +#include +#include +#include +#include + +QT_BEGIN_NAMESPACE + +namespace QtWaylandClient { + +QWaylandXdgShellV6Integration::QWaylandXdgShellV6Integration(QWaylandDisplay *display) + : m_xdgShell(nullptr) +{ + for (QWaylandDisplay::RegistryGlobal global : display->globals()) { + if (global.interface == QLatin1String("zxdg_shell_v6")) { + m_xdgShell = new QWaylandXdgShellV6(display->wl_registry(), global.id, global.version); + break; + } + } +} + +bool QWaylandXdgShellV6Integration::initialize(QWaylandDisplay *display) +{ + QWaylandShellIntegration::initialize(display); + return m_xdgShell != nullptr; +} + +QWaylandShellSurface *QWaylandXdgShellV6Integration::createShellSurface(QWaylandWindow *window) +{ + return m_xdgShell->getXdgSurface(window); +} + +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandxdgshellv6integration_p.h b/src/plugins/platforms/wayland/qwaylandxdgshellv6integration_p.h new file mode 100644 index 00000000000..2e9cdac4fb1 --- /dev/null +++ b/src/plugins/platforms/wayland/qwaylandxdgshellv6integration_p.h @@ -0,0 +1,73 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL21$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWAYLANDXDGSHELLV6INTEGRATION_P_H +#define QWAYLANDXDGSHELLV6INTEGRATION_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include + +#include + +QT_BEGIN_NAMESPACE + +namespace QtWaylandClient { + +class QWaylandXdgShellV6; + +class Q_WAYLAND_CLIENT_EXPORT QWaylandXdgShellV6Integration : public QWaylandShellIntegration +{ +public: + QWaylandXdgShellV6Integration(QWaylandDisplay *display); + bool initialize(QWaylandDisplay *display) override; + QWaylandShellSurface *createShellSurface(QWaylandWindow *window) override; + +private: + QWaylandXdgShellV6 *m_xdgShell; +}; + +} + +QT_END_NAMESPACE + +#endif // QWAYLANDXDGSHELLV6INTEGRATION_P_H From c6acb1256b5751484078f1112d684e200d4de7b1 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Fri, 2 Dec 2016 16:53:15 +0100 Subject: [PATCH 0393/1507] Doc: Mention files for different wayland protocols MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: If7de71930a8339ff8b36e74331810b186e1ebd32 Reviewed-by: Topi Reiniö --- src/3rdparty/wayland/protocols/qt_attribution.json | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/3rdparty/wayland/protocols/qt_attribution.json b/src/3rdparty/wayland/protocols/qt_attribution.json index 327c408b961..76fd33d37f9 100644 --- a/src/3rdparty/wayland/protocols/qt_attribution.json +++ b/src/3rdparty/wayland/protocols/qt_attribution.json @@ -4,6 +4,7 @@ "Name": "Wayland Protocol", "QDocModule": "qtwaylandcompositor", "QtUsage": "Used in the Qt Wayland Compositor, and the Qt Wayland platform plugin.", + "Files": "wayland.xml", "Description": "Wayland is a protocol for a compositor to talk to its clients.", "Homepage": "https://wayland.freedesktop.org", @@ -22,6 +23,7 @@ "Name": "Wayland IVI Extension Protocol", "QDocModule": "qtwaylandcompositor", "QtUsage": "Used in the Qt Wayland Compositor, and the Qt Wayland platform plugin.", + "Files": "ivi-controller.xml ivi-application.xml", "Description": "\"Wayland IVI Extension\" is forked from IVI Layer Management to define a common set of APIs by wayland style protocol and provide reference implementation which can be loaded on Weston.", "Homepage": "http://projects.genivi.org/wayland-ivi-extension", @@ -39,6 +41,7 @@ Copyright (c) 2013 BMW Car IT GmbH" "Name": "Wayland XDG Shell Protocol", "QDocModule": "qtwaylandcompositor", "QtUsage": "Used in the Qt Wayland Compositor, and the Qt Wayland platform plugin.", + "Files": "xdg-shell.xml", "Description": "The XDG-Shell protocol is an extended way to manage surfaces under Wayland compositors.", "Homepage": "https://wayland.freedesktop.org", @@ -58,6 +61,7 @@ Copyright © 2010-2013 Intel Corporation" "Name": "Wayland Text Input Protocol", "QDocModule": "qtwaylandcompositor", "QtUsage": "Used in the Qt Wayland Compositor, and the Qt Wayland platform plugin.", + "Files": "text-input-unstable-v2.xml", "Description": "Adds support for text input and input methods to applications.", "Homepage": "https://wayland.freedesktop.org", From 6caaf81f9b23600528e34f490651997360f03403 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Tue, 22 Nov 2016 13:37:10 +0100 Subject: [PATCH 0394/1507] Deprecate QT_WAYLAND_USE_XDG_SHELL In favor of QT_WAYLAND_SHELL_INTEGRATION, which can be set to: - ivi-shell - wl-shell - xdg-shell-v5 - xdg-shell-v6 Change-Id: Ie2ca1184f22dcac56beb441329ea8b5a9a81baf4 Reviewed-by: Paul Olav Tvete --- .../platforms/wayland/qwaylandintegration.cpp | 50 ++++++++++--------- .../wayland/qwaylandwlshellintegration.cpp | 7 +++ .../wayland/qwaylandwlshellintegration_p.h | 4 +- .../wayland/qwaylandxdgshellintegration.cpp | 7 +++ .../wayland/qwaylandxdgshellintegration_p.h | 4 +- .../wayland/qwaylandxdgshellv6integration.cpp | 7 +++ .../wayland/qwaylandxdgshellv6integration_p.h | 4 +- 7 files changed, 56 insertions(+), 27 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandintegration.cpp b/src/plugins/platforms/wayland/qwaylandintegration.cpp index 0dcd6b68f0c..f9ee611567d 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandintegration.cpp @@ -375,25 +375,25 @@ void QWaylandIntegration::initializeShellIntegration() QByteArray integrationName = qgetenv("QT_WAYLAND_SHELL_INTEGRATION"); QString targetKey = QString::fromLocal8Bit(integrationName); + QStringList preferredShells; if (!targetKey.isEmpty()) { - QStringList keys = QWaylandShellIntegrationFactory::keys(); - if (keys.contains(targetKey)) { - qDebug("Using the '%s' shell integration", qPrintable(targetKey)); - mShellIntegration.reset(QWaylandShellIntegrationFactory::create(targetKey, QStringList())); - } + preferredShells << targetKey; } else { - QStringList preferredShells; - preferredShells << QLatin1String("zxdg_shell_v6"); - if (qEnvironmentVariableIsSet("QT_WAYLAND_USE_XDG_SHELL")) - preferredShells << QLatin1String("xdg_shell"); + preferredShells << QLatin1String("xdg-shell-v6"); + QString useXdgShell = QString::fromLocal8Bit(qgetenv("QT_WAYLAND_USE_XDG_SHELL")); + if (!useXdgShell.isEmpty() && useXdgShell != QLatin1String("0")) { + qWarning() << "QT_WAYLAND_USE_XDG_SHELL is deprecated, " + "please specify the shell using QT_WAYLAND_SHELL_INTEGRATION instead"; + preferredShells << QLatin1String("xdg-shell-v5"); + } + preferredShells << QLatin1String("wl-shell"); + } - preferredShells << QLatin1String("wl_shell"); - - Q_FOREACH (QString preferredShell, preferredShells) { - if (mDisplay->hasRegistryGlobal(preferredShell)) { - mShellIntegration.reset(createShellIntegration(preferredShell)); - break; - } + Q_FOREACH (QString preferredShell, preferredShells) { + mShellIntegration.reset(createShellIntegration(preferredShell)); + if (mShellIntegration) { + qDebug("Using the '%s' shell integration", qPrintable(preferredShell)); + break; } } @@ -429,16 +429,18 @@ void QWaylandIntegration::initializeInputDeviceIntegration() } } -QWaylandShellIntegration *QWaylandIntegration::createShellIntegration(const QString &interfaceName) +QWaylandShellIntegration *QWaylandIntegration::createShellIntegration(const QString &integrationName) { - if (interfaceName == QLatin1Literal("wl_shell")) { - return new QWaylandWlShellIntegration(mDisplay.data()); - } else if (interfaceName == QLatin1Literal("xdg_shell")) { - return new QWaylandXdgShellIntegration(mDisplay.data()); - } else if (interfaceName == QLatin1Literal("zxdg_shell_v6")) { - return new QWaylandXdgShellV6Integration(mDisplay.data()); + if (integrationName == QLatin1Literal("wl-shell")) { + return QWaylandWlShellIntegration::create(mDisplay.data()); + } else if (integrationName == QLatin1Literal("xdg-shell-v5")) { + return QWaylandXdgShellIntegration::create(mDisplay.data()); + } else if (integrationName == QLatin1Literal("xdg-shell-v6")) { + return QWaylandXdgShellV6Integration::create(mDisplay.data()); + } else if (QWaylandShellIntegrationFactory::keys().contains(integrationName)) { + return QWaylandShellIntegrationFactory::create(integrationName, QStringList()); } else { - return Q_NULLPTR; + return nullptr; } } diff --git a/src/plugins/platforms/wayland/qwaylandwlshellintegration.cpp b/src/plugins/platforms/wayland/qwaylandwlshellintegration.cpp index ce7c7834617..8d61201bdd7 100644 --- a/src/plugins/platforms/wayland/qwaylandwlshellintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandwlshellintegration.cpp @@ -41,6 +41,13 @@ QT_BEGIN_NAMESPACE namespace QtWaylandClient { +QWaylandWlShellIntegration *QWaylandWlShellIntegration::create(QWaylandDisplay *display) +{ + if (display->hasRegistryGlobal(QLatin1String("wl_shell"))) + return new QWaylandWlShellIntegration(display); + return nullptr; +} + QWaylandWlShellIntegration::QWaylandWlShellIntegration(QWaylandDisplay *display) : m_wlShell(Q_NULLPTR) { diff --git a/src/plugins/platforms/wayland/qwaylandwlshellintegration_p.h b/src/plugins/platforms/wayland/qwaylandwlshellintegration_p.h index 9082c7628d1..393ccaf0ac2 100644 --- a/src/plugins/platforms/wayland/qwaylandwlshellintegration_p.h +++ b/src/plugins/platforms/wayland/qwaylandwlshellintegration_p.h @@ -57,11 +57,13 @@ namespace QtWaylandClient { class Q_WAYLAND_CLIENT_EXPORT QWaylandWlShellIntegration : public QWaylandShellIntegration { public: - QWaylandWlShellIntegration(QWaylandDisplay* display); + static QWaylandWlShellIntegration *create(QWaylandDisplay* display); bool initialize(QWaylandDisplay *) Q_DECL_OVERRIDE; QWaylandShellSurface *createShellSurface(QWaylandWindow *window) Q_DECL_OVERRIDE; private: + QWaylandWlShellIntegration(QWaylandDisplay* display); + QtWayland::wl_shell *m_wlShell; }; diff --git a/src/plugins/platforms/wayland/qwaylandxdgshellintegration.cpp b/src/plugins/platforms/wayland/qwaylandxdgshellintegration.cpp index a48157dfac9..439dd4b1539 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgshellintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandxdgshellintegration.cpp @@ -43,6 +43,13 @@ QT_BEGIN_NAMESPACE namespace QtWaylandClient { +QWaylandXdgShellIntegration *QWaylandXdgShellIntegration::create(QWaylandDisplay *display) +{ + if (display->hasRegistryGlobal(QLatin1String("xdg_shell"))) + return new QWaylandXdgShellIntegration(display); + return nullptr; +} + QWaylandXdgShellIntegration::QWaylandXdgShellIntegration(QWaylandDisplay *display) : m_xdgShell(Q_NULLPTR) { diff --git a/src/plugins/platforms/wayland/qwaylandxdgshellintegration_p.h b/src/plugins/platforms/wayland/qwaylandxdgshellintegration_p.h index e0e6bda0dc5..0658e52b755 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgshellintegration_p.h +++ b/src/plugins/platforms/wayland/qwaylandxdgshellintegration_p.h @@ -58,12 +58,14 @@ class QWaylandXdgShell; class Q_WAYLAND_CLIENT_EXPORT QWaylandXdgShellIntegration : public QWaylandShellIntegration { public: - QWaylandXdgShellIntegration(QWaylandDisplay *display); + static QWaylandXdgShellIntegration *create(QWaylandDisplay* display); bool initialize(QWaylandDisplay *display) Q_DECL_OVERRIDE; QWaylandShellSurface *createShellSurface(QWaylandWindow *window) Q_DECL_OVERRIDE; void handleKeyboardFocusChanged(QWaylandWindow *newFocus, QWaylandWindow *oldFocus) Q_DECL_OVERRIDE; private: + QWaylandXdgShellIntegration(QWaylandDisplay *display); + QWaylandXdgShell *m_xdgShell; }; diff --git a/src/plugins/platforms/wayland/qwaylandxdgshellv6integration.cpp b/src/plugins/platforms/wayland/qwaylandxdgshellv6integration.cpp index 93f31987590..26f50c376b6 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgshellv6integration.cpp +++ b/src/plugins/platforms/wayland/qwaylandxdgshellv6integration.cpp @@ -55,6 +55,13 @@ QWaylandXdgShellV6Integration::QWaylandXdgShellV6Integration(QWaylandDisplay *di } } +QWaylandXdgShellV6Integration *QWaylandXdgShellV6Integration::create(QWaylandDisplay *display) +{ + if (display->hasRegistryGlobal(QLatin1String("zxdg_shell_v6"))) + return new QWaylandXdgShellV6Integration(display); + return nullptr; +} + bool QWaylandXdgShellV6Integration::initialize(QWaylandDisplay *display) { QWaylandShellIntegration::initialize(display); diff --git a/src/plugins/platforms/wayland/qwaylandxdgshellv6integration_p.h b/src/plugins/platforms/wayland/qwaylandxdgshellv6integration_p.h index 2e9cdac4fb1..21868c4111d 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgshellv6integration_p.h +++ b/src/plugins/platforms/wayland/qwaylandxdgshellv6integration_p.h @@ -58,11 +58,13 @@ class QWaylandXdgShellV6; class Q_WAYLAND_CLIENT_EXPORT QWaylandXdgShellV6Integration : public QWaylandShellIntegration { public: - QWaylandXdgShellV6Integration(QWaylandDisplay *display); + static QWaylandXdgShellV6Integration *create(QWaylandDisplay* display); bool initialize(QWaylandDisplay *display) override; QWaylandShellSurface *createShellSurface(QWaylandWindow *window) override; private: + QWaylandXdgShellV6Integration(QWaylandDisplay *display); + QWaylandXdgShellV6 *m_xdgShell; }; From 6c6ccbfa8b067ee1dcc3d3aca43b0e018df7d0eb Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Thu, 8 Dec 2016 13:44:13 +0100 Subject: [PATCH 0395/1507] Fix broken HEADERS list in client.pro Change-Id: I67fa756f584577028a90706609bc6485ee98b126 Reviewed-by: Paul Olav Tvete --- src/plugins/platforms/wayland/client.pro | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/plugins/platforms/wayland/client.pro b/src/plugins/platforms/wayland/client.pro index 04f055e6a3e..7d602086b0e 100644 --- a/src/plugins/platforms/wayland/client.pro +++ b/src/plugins/platforms/wayland/client.pro @@ -53,6 +53,7 @@ SOURCES += qwaylandintegration.cpp \ qwaylandxdgsurface.cpp \ qwaylandxdgpopup.cpp \ qwaylandxdgshellintegration.cpp \ + qwaylandxdgshellv6.cpp \ qwaylandxdgshellv6integration.cpp \ qwaylandextendedsurface.cpp \ qwaylandsubsurface.cpp \ @@ -69,7 +70,6 @@ SOURCES += qwaylandintegration.cpp \ qwaylanddatadevice.cpp \ qwaylandshm.cpp \ qwaylandbuffer.cpp \ - qwaylandxdgshellv6.cpp \ HEADERS += qwaylandintegration_p.h \ qwaylandnativeinterface_p.h \ @@ -93,6 +93,7 @@ HEADERS += qwaylandintegration_p.h \ qwaylandxdgsurface_p.h \ qwaylandxdgpopup_p.h \ qwaylandxdgshellintegration_p.h \ + qwaylandxdgshellv6_p.h \ qwaylandxdgshellv6integration_p.h \ qwaylandextendedsurface_p.h \ qwaylandsubsurface_p.h \ @@ -110,8 +111,7 @@ HEADERS += qwaylandintegration_p.h \ ../shared/qwaylandinputmethodeventbuilder_p.h \ ../shared/qwaylandmimehelper_p.h \ ../shared/qwaylandxkb_p.h \ - ../shared/qwaylandsharedmemoryformathelper_p.h - qwaylandxdgshellv6_p.h \ + ../shared/qwaylandsharedmemoryformathelper_p.h \ include(hardwareintegration/hardwareintegration.pri) include(shellintegration/shellintegration.pri) From dfb9a78e6c71f188b30ce153b25693272187d363 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Mon, 12 Dec 2016 14:39:00 +0100 Subject: [PATCH 0396/1507] Handle the zxdg_toplevel_v6.close event Change-Id: I9f470930e8d3d88430f8a7b2017fa2d0159a015e Reviewed-by: Paul Olav Tvete --- src/plugins/platforms/wayland/qwaylandxdgshellv6.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/plugins/platforms/wayland/qwaylandxdgshellv6.cpp b/src/plugins/platforms/wayland/qwaylandxdgshellv6.cpp index b45498d8073..687973240eb 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgshellv6.cpp +++ b/src/plugins/platforms/wayland/qwaylandxdgshellv6.cpp @@ -80,6 +80,7 @@ void QWaylandXdgSurfaceV6::Toplevel::zxdg_toplevel_v6_configure(int32_t width, i void QWaylandXdgSurfaceV6::Toplevel::zxdg_toplevel_v6_close() { + m_xdgSurface->m_window->window()->close(); } QWaylandXdgSurfaceV6::Popup::Popup(QWaylandXdgSurfaceV6 *xdgSurface, QWaylandXdgSurfaceV6 *parent, From 97e8bd6f4a79b5813f00937803060ef0a50f00a4 Mon Sep 17 00:00:00 2001 From: Robert Griebl Date: Thu, 15 Dec 2016 17:43:00 +0100 Subject: [PATCH 0397/1507] Fix initial window property values being propagated This was broken since the the shell-surface refactoring. Change-Id: I130b7396e85c570a9d11d609af6b3016e3f706f0 Reviewed-by: Dominik Holland Reviewed-by: Paul Olav Tvete --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index d16746bac2c..ca99f3de18f 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -176,6 +176,9 @@ void QWaylandWindow::initWindow() mShellSurface->setAppId(appId); } } + // the user may have already set some window properties, so make sure to send them out + for (auto it = m_properties.cbegin(); it != m_properties.cend(); ++it) + mShellSurface->sendProperty(it.key(), it.value()); } // Enable high-dpi rendering. Scale() returns the screen scale factor and will From 81f80fa19fa143ea1bb6deb2b7309ed723e75904 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Thu, 15 Dec 2016 14:58:32 +0100 Subject: [PATCH 0398/1507] Set PLUGIN_CLASS_NAME in .pro files This fixes static linking and cmake config file generation. In some cases, the class was renamed for disambiguation or just uniformity. Task-number: QTBUG-51248 Change-Id: Ibdce2e1b6a52312f84301c426632e94deeb567bd Reviewed-by: Oswald Buddenhagen Reviewed-by: Samuli Piippo --- .../platforms/wayland/plugins/decorations/bradient/bradient.pro | 1 + .../wayland/plugins/hardwareintegration/brcm-egl/brcm-egl.pro | 1 + .../hardwareintegration/drm-egl-server/drm-egl-server.pro | 1 + .../libhybris-egl-server/libhybris-egl-server.pro | 1 + .../plugins/hardwareintegration/wayland-egl/wayland-egl.pro | 1 + .../hardwareintegration/xcomposite-egl/xcomposite-egl.pro | 1 + .../hardwareintegration/xcomposite-glx/xcomposite-glx.pro | 1 + 7 files changed, 7 insertions(+) diff --git a/src/plugins/platforms/wayland/plugins/decorations/bradient/bradient.pro b/src/plugins/platforms/wayland/plugins/decorations/bradient/bradient.pro index 843149e0836..e31576783b6 100644 --- a/src/plugins/platforms/wayland/plugins/decorations/bradient/bradient.pro +++ b/src/plugins/platforms/wayland/plugins/decorations/bradient/bradient.pro @@ -8,4 +8,5 @@ SOURCES += main.cpp QMAKE_USE += wayland-client PLUGIN_TYPE = wayland-decoration-client +PLUGIN_CLASS_NAME = QWaylandBradientDecorationPlugin load(qt_plugin) diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/brcm-egl.pro b/src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/brcm-egl.pro index 550343cfe99..c2e9ad4ffb9 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/brcm-egl.pro +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/brcm-egl.pro @@ -8,4 +8,5 @@ OTHER_FILES += \ SOURCES += main.cpp PLUGIN_TYPE = wayland-graphics-integration-client +PLUGIN_CLASS_NAME = QWaylandBrcmEglClientBufferPlugin load(qt_plugin) diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/drm-egl-server/drm-egl-server.pro b/src/plugins/platforms/wayland/plugins/hardwareintegration/drm-egl-server/drm-egl-server.pro index 29a48c9e6e7..2fba5bd1fdf 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/drm-egl-server/drm-egl-server.pro +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/drm-egl-server/drm-egl-server.pro @@ -11,4 +11,5 @@ OTHER_FILES += \ SOURCES += main.cpp PLUGIN_TYPE = wayland-graphics-integration-client +PLUGIN_CLASS_NAME = DrmEglServerBufferPlugin load(qt_plugin) diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/libhybris-egl-server/libhybris-egl-server.pro b/src/plugins/platforms/wayland/plugins/hardwareintegration/libhybris-egl-server/libhybris-egl-server.pro index d7bf03705ce..3193b8f6877 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/libhybris-egl-server/libhybris-egl-server.pro +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/libhybris-egl-server/libhybris-egl-server.pro @@ -8,4 +8,5 @@ OTHER_FILES += \ SOURCES += main.cpp PLUGIN_TYPE = wayland-graphics-integration-client +PLUGIN_CLASS_NAME = LibHybrisEglServerBufferPlugin load(qt_plugin) diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/wayland-egl.pro b/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/wayland-egl.pro index 076b6af2c34..d85c5efaaa1 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/wayland-egl.pro +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/wayland-egl.pro @@ -8,4 +8,5 @@ OTHER_FILES += \ SOURCES += main.cpp PLUGIN_TYPE = wayland-graphics-integration-client +PLUGIN_CLASS_NAME = QWaylandEglClientBufferPlugin load(qt_plugin) diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-egl/xcomposite-egl.pro b/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-egl/xcomposite-egl.pro index 031d2812ad9..c8734084b0c 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-egl/xcomposite-egl.pro +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-egl/xcomposite-egl.pro @@ -11,4 +11,5 @@ SOURCES += \ main.cpp PLUGIN_TYPE = wayland-graphics-integration-client +PLUGIN_CLASS_NAME = QWaylandXCompositeEglClientBufferIntegrationPlugin load(qt_plugin) diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-glx/xcomposite-glx.pro b/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-glx/xcomposite-glx.pro index eb8e03c7f33..fb5ad15f84a 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-glx/xcomposite-glx.pro +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-glx/xcomposite-glx.pro @@ -8,4 +8,5 @@ SOURCES += \ main.cpp PLUGIN_TYPE = wayland-graphics-integration-client +PLUGIN_CLASS_NAME = QWaylandXCompositeGlxClientBufferIntegrationPlugin load(qt_plugin) From 18d0f87b87c288ed4ab43f09932045b34c641604 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Mon, 2 Jan 2017 13:15:36 +0100 Subject: [PATCH 0399/1507] Fix crash when starting clients Don't send wl_surface::set_input_region requests before the wl_surface has been initialized. The shapedclock example used to crash in wl_proxy_marshal prior to this fix. Task-number: QTBUG-57757 Change-Id: I0a459d374bfb88fb22d048eda3722a41112d67a4 Reviewed-by: Paul Olav Tvete --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index d16746bac2c..0e3c0b285e4 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -350,8 +350,11 @@ void QWaylandWindow::setMask(const QRegion &mask) mMask = mask; + if (!isInitialized()) + return; + if (mMask.isEmpty()) { - set_input_region(0); + set_input_region(nullptr); } else { struct ::wl_region *region = mDisplay->createRegion(mMask); set_input_region(region); From a37ac71c33275b007dcb80531f900e3d930930f3 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Thu, 22 Dec 2016 14:30:57 +0100 Subject: [PATCH 0400/1507] Client: Don't crash when the receiver of a paste closes the pipe MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Ignore the SIGPIPE signal Task-number: QTBUG-57202 Change-Id: If22381f446675836aeb741a8e6da5473b0a27301 Reviewed-by: Martin Gräßlin Reviewed-by: Paul Olav Tvete --- src/plugins/platforms/wayland/qwaylanddatasource.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/plugins/platforms/wayland/qwaylanddatasource.cpp b/src/plugins/platforms/wayland/qwaylanddatasource.cpp index 036bd0d8651..c61de181ba6 100644 --- a/src/plugins/platforms/wayland/qwaylanddatasource.cpp +++ b/src/plugins/platforms/wayland/qwaylanddatasource.cpp @@ -48,6 +48,7 @@ #include #include +#include #if QT_CONFIG(draganddrop) @@ -85,7 +86,16 @@ void QWaylandDataSource::data_source_send(const QString &mime_type, int32_t fd) { QByteArray content = QWaylandMimeHelper::getByteArray(m_mime_data, mime_type); if (!content.isEmpty()) { + // Create a sigpipe handler that does nothing, or clients may be forced to terminate + // if the pipe is closed in the other end. + struct sigaction action, oldAction; + action.sa_handler = SIG_IGN; + sigemptyset (&action.sa_mask); + action.sa_flags = 0; + + sigaction(SIGPIPE, &action, &oldAction); write(fd, content.constData(), content.size()); + sigaction(SIGPIPE, &oldAction, nullptr); } close(fd); } From c2d22c4ab8f59360ba26053c66ba95d74b57267a Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Tue, 3 Jan 2017 12:10:52 +0100 Subject: [PATCH 0401/1507] Don't call wl_surface::destroy if the surface was never initialized Task-number: QTBUG-57757 Change-Id: I85b74a3445c8d9df1a89b16760ce57e45204d2c6 Reviewed-by: Pier Luigi Fiorini Reviewed-by: Paul Olav Tvete --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 0e3c0b285e4..c8be9c14956 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -222,7 +222,8 @@ void QWaylandWindow::reset() mShellSurface = 0; delete mSubSurfaceWindow; mSubSurfaceWindow = 0; - destroy(); + if (isInitialized()) + destroy(); if (mFrameCallback) wl_callback_destroy(mFrameCallback); From 12cc56487806ae306413f20688f5a12f9f325f2c Mon Sep 17 00:00:00 2001 From: Tasuku Suzuki Date: Fri, 13 Jan 2017 16:58:31 +0900 Subject: [PATCH 0402/1507] Fix build without feature.clipboard Change-Id: I195efecca9350cb519865f251cdee9c6e23d3592 Reviewed-by: Lars Knoll --- src/plugins/platforms/wayland/client.pro | 7 +++++-- src/plugins/platforms/wayland/qwaylanddatadevice.cpp | 6 ++++++ src/plugins/platforms/wayland/qwaylanddisplay.cpp | 2 ++ src/plugins/platforms/wayland/qwaylandintegration.cpp | 10 ++++++++-- src/plugins/platforms/wayland/qwaylandintegration_p.h | 8 ++++++-- 5 files changed, 27 insertions(+), 6 deletions(-) diff --git a/src/plugins/platforms/wayland/client.pro b/src/plugins/platforms/wayland/client.pro index 7482cfd6bbd..f1338cc9911 100644 --- a/src/plugins/platforms/wayland/client.pro +++ b/src/plugins/platforms/wayland/client.pro @@ -40,7 +40,6 @@ SOURCES += qwaylandintegration.cpp \ qwaylandwindow.cpp \ qwaylandscreen.cpp \ qwaylandshmwindow.cpp \ - qwaylandclipboard.cpp \ qwaylanddnd.cpp \ qwaylanddataoffer.cpp \ qwaylanddatadevicemanager.cpp \ @@ -78,7 +77,6 @@ HEADERS += qwaylandintegration_p.h \ qwaylandinputdevice_p.h \ qwaylandbuffer_p.h \ qwaylandshmwindow_p.h \ - qwaylandclipboard_p.h \ qwaylanddnd_p.h \ qwaylanddataoffer_p.h \ qwaylanddatadevicemanager_p.h \ @@ -108,6 +106,11 @@ HEADERS += qwaylandintegration_p.h \ ../shared/qwaylandxkb_p.h \ ../shared/qwaylandsharedmemoryformathelper_p.h +qtConfig(clipboard) { + HEADERS += qwaylandclipboard_p.h + SOURCES += qwaylandclipboard.cpp +} + include(hardwareintegration/hardwareintegration.pri) include(shellintegration/shellintegration.pri) include(inputdeviceintegration/inputdeviceintegration.pri) diff --git a/src/plugins/platforms/wayland/qwaylanddatadevice.cpp b/src/plugins/platforms/wayland/qwaylanddatadevice.cpp index b76647ea2d0..ebd3ce1bff1 100644 --- a/src/plugins/platforms/wayland/qwaylanddatadevice.cpp +++ b/src/plugins/platforms/wayland/qwaylanddatadevice.cpp @@ -52,7 +52,9 @@ #include #include +#if QT_CONFIG(clipboard) #include +#endif #include #include @@ -235,13 +237,17 @@ void QWaylandDataDevice::data_device_selection(wl_data_offer *id) else m_selectionOffer.reset(); +#if QT_CONFIG(clipboard) QGuiApplicationPrivate::platformIntegration()->clipboard()->emitChanged(QClipboard::Clipboard); +#endif } void QWaylandDataDevice::selectionSourceCancelled() { m_selectionSource.reset(); +#if QT_CONFIG(clipboard) QGuiApplicationPrivate::platformIntegration()->clipboard()->emitChanged(QClipboard::Clipboard); +#endif } void QWaylandDataDevice::dragSourceCancelled() diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index 534373b1606..851d715b77f 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -44,7 +44,9 @@ #include "qwaylandscreen_p.h" #include "qwaylandcursor_p.h" #include "qwaylandinputdevice_p.h" +#if QT_CONFIG(clipboard) #include "qwaylandclipboard_p.h" +#endif #include "qwaylanddatadevicemanager_p.h" #include "qwaylandhardwareintegration_p.h" #include "qwaylandxdgshell_p.h" diff --git a/src/plugins/platforms/wayland/qwaylandintegration.cpp b/src/plugins/platforms/wayland/qwaylandintegration.cpp index 78d4284bd9a..78a1182c64a 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandintegration.cpp @@ -45,7 +45,9 @@ #include "qwaylandinputcontext_p.h" #include "qwaylandshmbackingstore_p.h" #include "qwaylandnativeinterface_p.h" +#if QT_CONFIG(clipboard) #include "qwaylandclipboard_p.h" +#endif #include "qwaylanddnd_p.h" #include "qwaylandwindowmanagerintegration_p.h" #include "qwaylandscreen_p.h" @@ -131,8 +133,10 @@ QWaylandIntegration::QWaylandIntegration() { initializeInputDeviceIntegration(); mDisplay.reset(new QWaylandDisplay(this)); -#if QT_CONFIG(draganddrop) +#if QT_CONFIG(clipboard) mClipboard.reset(new QWaylandClipboard(mDisplay.data())); +#endif +#if QT_CONFIG(draganddrop) mDrag.reset(new QWaylandDrag(mDisplay.data())); #endif QString icStr = QPlatformInputContextFactory::requested(); @@ -228,12 +232,14 @@ QPlatformFontDatabase *QWaylandIntegration::fontDatabase() const return mFontDb.data(); } -#if QT_CONFIG(draganddrop) +#if QT_CONFIG(clipboard) QPlatformClipboard *QWaylandIntegration::clipboard() const { return mClipboard.data(); } +#endif +#if QT_CONFIG(draganddrop) QPlatformDrag *QWaylandIntegration::drag() const { return mDrag.data(); diff --git a/src/plugins/platforms/wayland/qwaylandintegration_p.h b/src/plugins/platforms/wayland/qwaylandintegration_p.h index 1689581a2f6..90fce4fcfa4 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration_p.h +++ b/src/plugins/platforms/wayland/qwaylandintegration_p.h @@ -86,8 +86,10 @@ public: QPlatformFontDatabase *fontDatabase() const Q_DECL_OVERRIDE; QPlatformNativeInterface *nativeInterface() const Q_DECL_OVERRIDE; -#if QT_CONFIG(draganddrop) +#if QT_CONFIG(clipboard) QPlatformClipboard *clipboard() const Q_DECL_OVERRIDE; +#endif +#if QT_CONFIG(draganddrop) QPlatformDrag *drag() const Q_DECL_OVERRIDE; #endif QPlatformInputContext *inputContext() const Q_DECL_OVERRIDE; @@ -131,8 +133,10 @@ private: QWaylandShellIntegration *createShellIntegration(const QString& interfaceName); QScopedPointer mFontDb; -#if QT_CONFIG(draganddrop) +#if QT_CONFIG(clipboard) QScopedPointer mClipboard; +#endif +#if QT_CONFIG(draganddrop) QScopedPointer mDrag; #endif QScopedPointer mNativeInterface; From cfcc462166fa7a0d916089faf42d3df0abb8986e Mon Sep 17 00:00:00 2001 From: Tasuku Suzuki Date: Fri, 13 Jan 2017 20:19:17 +0900 Subject: [PATCH 0403/1507] Fix build without feature.cursor Change-Id: If244e7ac58133ae6fbefacfa243d47fa210140be Reviewed-by: Lars Knoll --- src/plugins/platforms/wayland/client.pro | 13 +++++++++--- .../plugins/decorations/bradient/main.cpp | 20 +++++++++++++++++++ .../platforms/wayland/qwaylandcursor_p.h | 3 +++ .../platforms/wayland/qwaylandinputdevice.cpp | 10 ++++++++++ .../platforms/wayland/qwaylandinputdevice_p.h | 8 ++++++++ .../platforms/wayland/qwaylandscreen.cpp | 8 ++++++++ .../platforms/wayland/qwaylandscreen_p.h | 4 ++++ .../platforms/wayland/qwaylandwindow.cpp | 8 ++++++++ .../platforms/wayland/qwaylandwindow_p.h | 2 ++ 9 files changed, 73 insertions(+), 3 deletions(-) diff --git a/src/plugins/platforms/wayland/client.pro b/src/plugins/platforms/wayland/client.pro index f1338cc9911..6904e905c05 100644 --- a/src/plugins/platforms/wayland/client.pro +++ b/src/plugins/platforms/wayland/client.pro @@ -18,7 +18,7 @@ CONFIG += link_pkgconfig wayland-scanner qtConfig(xkbcommon-evdev): \ QMAKE_USE_PRIVATE += xkbcommon_evdev -QMAKE_USE += wayland-client wayland-cursor +QMAKE_USE += wayland-client INCLUDEPATH += $$PWD/../shared @@ -35,7 +35,6 @@ SOURCES += qwaylandintegration.cpp \ qwaylandnativeinterface.cpp \ qwaylandshmbackingstore.cpp \ qwaylandinputdevice.cpp \ - qwaylandcursor.cpp \ qwaylanddisplay.cpp \ qwaylandwindow.cpp \ qwaylandscreen.cpp \ @@ -69,7 +68,6 @@ SOURCES += qwaylandintegration.cpp \ HEADERS += qwaylandintegration_p.h \ qwaylandnativeinterface_p.h \ - qwaylandcursor_p.h \ qwaylanddisplay_p.h \ qwaylandwindow_p.h \ qwaylandscreen_p.h \ @@ -116,6 +114,15 @@ include(shellintegration/shellintegration.pri) include(inputdeviceintegration/inputdeviceintegration.pri) include(global/global.pri) +qtConfig(cursor) { + QMAKE_USE += wayland-cursor + + HEADERS += \ + qwaylandcursor_p.h + SOURCES += \ + qwaylandcursor.cpp +} + CONFIG += generated_privates MODULE_PLUGIN_TYPES = \ wayland-graphics-integration-client \ diff --git a/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp b/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp index f57b816e845..3928a9f1021 100644 --- a/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp +++ b/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp @@ -372,7 +372,9 @@ bool QWaylandBradientDecoration::handleMouse(QWaylandInputDevice *inputDevice, c } else if (local.x() > window()->width() + margins().left()) { processMouseRight(inputDevice,local,b,mods); } else { +#if QT_CONFIG(cursor) waylandWindow()->restoreMouseCursor(inputDevice); +#endif setMouseButtons(b); return false; } @@ -409,19 +411,27 @@ void QWaylandBradientDecoration::processMouseTop(QWaylandInputDevice *inputDevic if (local.y() <= margins().bottom()) { if (local.x() <= margins().left()) { //top left bit +#if QT_CONFIG(cursor) waylandWindow()->setMouseCursor(inputDevice, Qt::SizeFDiagCursor); +#endif startResize(inputDevice,WL_SHELL_SURFACE_RESIZE_TOP_LEFT,b); } else if (local.x() > window()->width() + margins().left()) { //top right bit +#if QT_CONFIG(cursor) waylandWindow()->setMouseCursor(inputDevice, Qt::SizeBDiagCursor); +#endif startResize(inputDevice,WL_SHELL_SURFACE_RESIZE_TOP_RIGHT,b); } else { //top reszie bit +#if QT_CONFIG(cursor) waylandWindow()->setMouseCursor(inputDevice, Qt::SplitVCursor); +#endif startResize(inputDevice,WL_SHELL_SURFACE_RESIZE_TOP,b); } } else { +#if QT_CONFIG(cursor) waylandWindow()->restoreMouseCursor(inputDevice); +#endif startMove(inputDevice,b); } @@ -432,15 +442,21 @@ void QWaylandBradientDecoration::processMouseBottom(QWaylandInputDevice *inputDe Q_UNUSED(mods); if (local.x() <= margins().left()) { //bottom left bit +#if QT_CONFIG(cursor) waylandWindow()->setMouseCursor(inputDevice, Qt::SizeBDiagCursor); +#endif startResize(inputDevice, WL_SHELL_SURFACE_RESIZE_BOTTOM_LEFT,b); } else if (local.x() > window()->width() + margins().left()) { //bottom right bit +#if QT_CONFIG(cursor) waylandWindow()->setMouseCursor(inputDevice, Qt::SizeFDiagCursor); +#endif startResize(inputDevice, WL_SHELL_SURFACE_RESIZE_BOTTOM_RIGHT,b); } else { //bottom bit +#if QT_CONFIG(cursor) waylandWindow()->setMouseCursor(inputDevice, Qt::SplitVCursor); +#endif startResize(inputDevice,WL_SHELL_SURFACE_RESIZE_BOTTOM,b); } } @@ -449,7 +465,9 @@ void QWaylandBradientDecoration::processMouseLeft(QWaylandInputDevice *inputDevi { Q_UNUSED(local); Q_UNUSED(mods); +#if QT_CONFIG(cursor) waylandWindow()->setMouseCursor(inputDevice, Qt::SplitHCursor); +#endif startResize(inputDevice,WL_SHELL_SURFACE_RESIZE_LEFT,b); } @@ -457,7 +475,9 @@ void QWaylandBradientDecoration::processMouseRight(QWaylandInputDevice *inputDev { Q_UNUSED(local); Q_UNUSED(mods); +#if QT_CONFIG(cursor) waylandWindow()->setMouseCursor(inputDevice, Qt::SplitHCursor); +#endif startResize(inputDevice, WL_SHELL_SURFACE_RESIZE_RIGHT,b); } diff --git a/src/plugins/platforms/wayland/qwaylandcursor_p.h b/src/plugins/platforms/wayland/qwaylandcursor_p.h index a7d188f5669..97921f9ccc0 100644 --- a/src/plugins/platforms/wayland/qwaylandcursor_p.h +++ b/src/plugins/platforms/wayland/qwaylandcursor_p.h @@ -55,6 +55,8 @@ #include #include +#if QT_CONFIG(cursor) + struct wl_cursor; struct wl_cursor_image; struct wl_cursor_theme; @@ -128,4 +130,5 @@ private: QT_END_NAMESPACE +#endif // cursor #endif // QWAYLANDCURSOR_H diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index 4e8ef7b6787..fb22c95e673 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -62,7 +62,9 @@ #include #include +#if QT_CONFIG(cursor) #include +#endif #include @@ -145,10 +147,14 @@ QWaylandInputDevice::Pointer::Pointer(QWaylandInputDevice *p) : mParent(p) , mFocus(0) , mEnterSerial(0) +#if QT_CONFIG(cursor) , mCursorSerial(0) +#endif , mButtons(0) +#if QT_CONFIG(cursor) , mCursorBuffer(nullptr) , mCursorShape(Qt::BitmapCursor) +#endif { } @@ -344,6 +350,7 @@ Qt::KeyboardModifiers QWaylandInputDevice::Keyboard::modifiers() const return ret; } +#if QT_CONFIG(cursor) uint32_t QWaylandInputDevice::cursorSerial() const { if (mPointer) @@ -415,6 +422,7 @@ void QWaylandInputDevice::setCursor(const QSharedPointer &buffer setCursor(buffer->buffer(), hotSpot, buffer->size()); mPixmapCursor = buffer; } +#endif class EnterEvent : public QWaylandPointerEvent { @@ -431,7 +439,9 @@ void QWaylandInputDevice::Pointer::pointer_enter(uint32_t serial, struct wl_surf return; QWaylandWindow *window = QWaylandWindow::fromWlSurface(surface); +#if QT_CONFIG(cursor) window->window()->setCursor(window->window()->cursor()); +#endif mFocus = window; mSurfacePos = QPointF(wl_fixed_to_double(sx), wl_fixed_to_double(sy)); diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h index 6d458e35ddd..f2bbd0dc002 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h +++ b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h @@ -72,7 +72,9 @@ #include +#if QT_CONFIG(cursor) struct wl_cursor_image; +#endif QT_BEGIN_NAMESPACE @@ -100,10 +102,12 @@ public: struct ::wl_seat *wl_seat() { return QtWayland::wl_seat::object(); } +#if QT_CONFIG(cursor) void setCursor(const QCursor &cursor, QWaylandScreen *screen); void setCursor(struct wl_buffer *buffer, struct ::wl_cursor_image *image); void setCursor(struct wl_buffer *buffer, const QPoint &hotSpot, const QSize &size); void setCursor(const QSharedPointer &buffer, const QPoint &hotSpot); +#endif void handleWindowDestroyed(QWaylandWindow *window); void handleEndDrag(); @@ -247,12 +251,16 @@ public: QWaylandInputDevice *mParent; QWaylandWindow *mFocus; uint32_t mEnterSerial; +#if QT_CONFIG(cursor) uint32_t mCursorSerial; +#endif QPointF mSurfacePos; QPointF mGlobalPos; Qt::MouseButtons mButtons; +#if QT_CONFIG(cursor) wl_buffer *mCursorBuffer; Qt::CursorShape mCursorShape; +#endif }; class Q_WAYLAND_CLIENT_EXPORT QWaylandInputDevice::Touch : public QtWayland::wl_touch diff --git a/src/plugins/platforms/wayland/qwaylandscreen.cpp b/src/plugins/platforms/wayland/qwaylandscreen.cpp index 5dbfe5e9d98..31d21a1c34e 100644 --- a/src/plugins/platforms/wayland/qwaylandscreen.cpp +++ b/src/plugins/platforms/wayland/qwaylandscreen.cpp @@ -64,18 +64,24 @@ QWaylandScreen::QWaylandScreen(QWaylandDisplay *waylandDisplay, int version, uin , mFormat(QImage::Format_ARGB32_Premultiplied) , mOutputName(QStringLiteral("Screen%1").arg(id)) , m_orientation(Qt::PrimaryOrientation) +#if QT_CONFIG(cursor) , mWaylandCursor(0) +#endif { } QWaylandScreen::~QWaylandScreen() { +#if QT_CONFIG(cursor) delete mWaylandCursor; +#endif } void QWaylandScreen::init() { +#if QT_CONFIG(cursor) mWaylandCursor = new QWaylandCursor(this); +#endif } QWaylandDisplay * QWaylandScreen::display() const @@ -156,10 +162,12 @@ qreal QWaylandScreen::refreshRate() const return mRefreshRate / 1000.f; } +#if QT_CONFIG(cursor) QPlatformCursor *QWaylandScreen::cursor() const { return mWaylandCursor; } +#endif QWaylandScreen * QWaylandScreen::waylandScreenFromWindow(QWindow *window) { diff --git a/src/plugins/platforms/wayland/qwaylandscreen_p.h b/src/plugins/platforms/wayland/qwaylandscreen_p.h index 9c1f4673869..f9f0776ffbe 100644 --- a/src/plugins/platforms/wayland/qwaylandscreen_p.h +++ b/src/plugins/platforms/wayland/qwaylandscreen_p.h @@ -90,8 +90,10 @@ public: QString name() const Q_DECL_OVERRIDE { return mOutputName; } +#if QT_CONFIG(cursor) QPlatformCursor *cursor() const Q_DECL_OVERRIDE; QWaylandCursor *waylandCursor() const { return mWaylandCursor; }; +#endif uint32_t outputId() const { return m_outputId; } ::wl_output *output() { return object(); } @@ -121,7 +123,9 @@ private: QString mOutputName; Qt::ScreenOrientation m_orientation; +#if QT_CONFIG(cursor) QWaylandCursor *mWaylandCursor; +#endif }; } diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index ca99f3de18f..8087921a6c7 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -709,8 +709,10 @@ void QWaylandWindow::handleMouse(QWaylandInputDevice *inputDevice, const QWaylan } } +#if QT_CONFIG(cursor) if (e.type == QWaylandPointerEvent::Enter) restoreMouseCursor(inputDevice); +#endif } void QWaylandWindow::handleMouseLeave(QWaylandInputDevice *inputDevice) @@ -722,7 +724,9 @@ void QWaylandWindow::handleMouseLeave(QWaylandInputDevice *inputDevice) } else { QWindowSystemInterface::handleLeaveEvent(window()); } +#if QT_CONFIG(cursor) restoreMouseCursor(inputDevice); +#endif } bool QWaylandWindow::touchDragDecoration(QWaylandInputDevice *inputDevice, const QPointF &local, const QPointF &global, Qt::TouchPointState state, Qt::KeyboardModifiers mods) @@ -754,7 +758,9 @@ void QWaylandWindow::handleMouseEventWithDecoration(QWaylandInputDevice *inputDe globalTranslated.setX(globalTranslated.x() - marg.left()); globalTranslated.setY(globalTranslated.y() - marg.top()); if (!mMouseEventsInContentArea) { +#if QT_CONFIG(cursor) restoreMouseCursor(inputDevice); +#endif QWindowSystemInterface::handleEnterEvent(window()); } @@ -780,6 +786,7 @@ void QWaylandWindow::handleMouseEventWithDecoration(QWaylandInputDevice *inputDe } } +#if QT_CONFIG(cursor) void QWaylandWindow::setMouseCursor(QWaylandInputDevice *device, const QCursor &cursor) { device->setCursor(cursor, mScreen); @@ -789,6 +796,7 @@ void QWaylandWindow::restoreMouseCursor(QWaylandInputDevice *device) { setMouseCursor(device, window()->cursor()); } +#endif void QWaylandWindow::requestActivateWindow() { diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index ce295a0de3b..7b48e890f05 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -176,8 +176,10 @@ public: inline bool isMaximized() const { return mState == Qt::WindowMaximized; } inline bool isFullscreen() const { return mState == Qt::WindowFullScreen; } +#if QT_CONFIG(cursor) void setMouseCursor(QWaylandInputDevice *device, const QCursor &cursor); void restoreMouseCursor(QWaylandInputDevice *device); +#endif QWaylandWindow *transientParent() const; From 0dadfc42335cb1cc4fb66bb7d6ecd56213a6cced Mon Sep 17 00:00:00 2001 From: Tasuku Suzuki Date: Fri, 13 Jan 2017 19:05:32 +0900 Subject: [PATCH 0404/1507] Fix build without feature.draganddrop Change-Id: I4fff1a8d48483298eebecdc751fe76e80444bd99 Reviewed-by: Lars Knoll --- src/plugins/platforms/wayland/client.pro | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/plugins/platforms/wayland/client.pro b/src/plugins/platforms/wayland/client.pro index 6904e905c05..92d4309ff66 100644 --- a/src/plugins/platforms/wayland/client.pro +++ b/src/plugins/platforms/wayland/client.pro @@ -39,7 +39,6 @@ SOURCES += qwaylandintegration.cpp \ qwaylandwindow.cpp \ qwaylandscreen.cpp \ qwaylandshmwindow.cpp \ - qwaylanddnd.cpp \ qwaylanddataoffer.cpp \ qwaylanddatadevicemanager.cpp \ qwaylanddatasource.cpp \ @@ -62,7 +61,6 @@ SOURCES += qwaylandintegration.cpp \ qwaylanddecorationplugin.cpp \ qwaylandwindowmanagerintegration.cpp \ qwaylandinputcontext.cpp \ - qwaylanddatadevice.cpp \ qwaylandshm.cpp \ qwaylandbuffer.cpp \ @@ -75,7 +73,6 @@ HEADERS += qwaylandintegration_p.h \ qwaylandinputdevice_p.h \ qwaylandbuffer_p.h \ qwaylandshmwindow_p.h \ - qwaylanddnd_p.h \ qwaylanddataoffer_p.h \ qwaylanddatadevicemanager_p.h \ qwaylanddatasource_p.h \ @@ -95,7 +92,6 @@ HEADERS += qwaylandintegration_p.h \ qwaylanddecorationplugin_p.h \ qwaylandwindowmanagerintegration_p.h \ qwaylandinputcontext_p.h \ - qwaylanddatadevice_p.h \ qwaylandshm_p.h \ qtwaylandclientglobal.h \ qtwaylandclientglobal_p.h \ @@ -122,6 +118,14 @@ qtConfig(cursor) { SOURCES += \ qwaylandcursor.cpp } +qtConfig(draganddrop) { + HEADERS += \ + qwaylanddnd_p.h \ + qwaylanddatadevice_p.h + SOURCES += \ + qwaylanddnd.cpp \ + qwaylanddatadevice.cpp +} CONFIG += generated_privates MODULE_PLUGIN_TYPES = \ From 2b7ad7f8a8192e6c410f4c8b29669655c767f01f Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Thu, 12 Jan 2017 13:25:48 +0100 Subject: [PATCH 0405/1507] Replace all occurrences of Q_DECL_OVERRIDE with override Change-Id: I16b7b23efe944b49d1fcc9e7588cdb0a991cebd1 Reviewed-by: Paul Olav Tvete --- .../wayland/global/qwaylandclientextension.h | 2 +- .../qwaylandhardwareintegration_p.h | 4 +- .../plugins/decorations/bradient/main.cpp | 10 ++-- .../hardwareintegration/brcm-egl/main.cpp | 2 +- .../drm-egl-server/main.cpp | 2 +- .../libhybris-egl-server/main.cpp | 2 +- .../hardwareintegration/wayland-egl/main.cpp | 2 +- .../xcomposite-egl/main.cpp | 2 +- .../xcomposite-glx/main.cpp | 2 +- .../platforms/wayland/qwaylandclipboard_p.h | 8 +-- .../platforms/wayland/qwaylandcursor_p.h | 8 +-- .../platforms/wayland/qwaylanddatadevice_p.h | 12 ++--- .../platforms/wayland/qwaylanddataoffer_p.h | 8 +-- .../platforms/wayland/qwaylanddatasource_p.h | 6 +-- .../platforms/wayland/qwaylanddisplay_p.h | 4 +- src/plugins/platforms/wayland/qwaylanddnd_p.h | 12 ++--- .../wayland/qwaylandextendedsurface_p.h | 6 +-- .../wayland/qwaylandinputcontext_p.h | 52 +++++++++---------- .../platforms/wayland/qwaylandinputdevice_p.h | 32 ++++++------ .../platforms/wayland/qwaylandintegration_p.h | 32 ++++++------ .../wayland/qwaylandnativeinterface_p.h | 18 +++---- .../platforms/wayland/qwaylandqtkey_p.h | 2 +- .../platforms/wayland/qwaylandscreen_p.h | 32 ++++++------ .../wayland/qwaylandshmbackingstore_p.h | 14 ++--- .../platforms/wayland/qwaylandshmwindow_p.h | 4 +- .../platforms/wayland/qwaylandtouch_p.h | 4 +- .../platforms/wayland/qwaylandwindow_p.h | 40 +++++++------- .../qwaylandwindowmanagerintegration_p.h | 10 ++-- .../wayland/qwaylandwlshellintegration_p.h | 4 +- .../wayland/qwaylandwlshellsurface_p.h | 32 ++++++------ .../platforms/wayland/qwaylandxdgshell_p.h | 2 +- .../wayland/qwaylandxdgshellintegration_p.h | 6 +-- .../platforms/wayland/qwaylandxdgsurface_p.h | 30 +++++------ tests/auto/wayland/client/mockinput.h | 14 ++--- tests/auto/wayland/client/mocksurface.h | 12 ++--- tests/auto/wayland/client/tst_client.cpp | 4 +- 36 files changed, 218 insertions(+), 218 deletions(-) diff --git a/src/plugins/platforms/wayland/global/qwaylandclientextension.h b/src/plugins/platforms/wayland/global/qwaylandclientextension.h index abf753249da..7e11bb47f72 100644 --- a/src/plugins/platforms/wayland/global/qwaylandclientextension.h +++ b/src/plugins/platforms/wayland/global/qwaylandclientextension.h @@ -87,7 +87,7 @@ public: { } - const struct wl_interface *extensionInterface() const Q_DECL_OVERRIDE + const struct wl_interface *extensionInterface() const override { return T::interface(); } diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandhardwareintegration_p.h b/src/plugins/platforms/wayland/hardwareintegration/qwaylandhardwareintegration_p.h index 8b4a7162927..31b4209dc0d 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandhardwareintegration_p.h +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandhardwareintegration_p.h @@ -69,8 +69,8 @@ public: QString serverBufferIntegration(); protected: - void hardware_integration_client_backend(const QString &name) Q_DECL_OVERRIDE; - void hardware_integration_server_backend(const QString &name) Q_DECL_OVERRIDE; + void hardware_integration_client_backend(const QString &name) override; + void hardware_integration_server_backend(const QString &name) override; private: QString m_client_buffer; diff --git a/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp b/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp index 3928a9f1021..074c74522d2 100644 --- a/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp +++ b/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp @@ -135,10 +135,10 @@ class Q_WAYLAND_CLIENT_EXPORT QWaylandBradientDecoration : public QWaylandAbstra public: QWaylandBradientDecoration(); protected: - QMargins margins() const Q_DECL_OVERRIDE; - void paint(QPaintDevice *device) Q_DECL_OVERRIDE; - bool handleMouse(QWaylandInputDevice *inputDevice, const QPointF &local, const QPointF &global,Qt::MouseButtons b,Qt::KeyboardModifiers mods) Q_DECL_OVERRIDE; - bool handleTouch(QWaylandInputDevice *inputDevice, const QPointF &local, const QPointF &global, Qt::TouchPointState state, Qt::KeyboardModifiers mods) Q_DECL_OVERRIDE; + QMargins margins() const override; + void paint(QPaintDevice *device) override; + bool handleMouse(QWaylandInputDevice *inputDevice, const QPointF &local, const QPointF &global,Qt::MouseButtons b,Qt::KeyboardModifiers mods) override; + bool handleTouch(QWaylandInputDevice *inputDevice, const QPointF &local, const QPointF &global, Qt::TouchPointState state, Qt::KeyboardModifiers mods) override; private: void processMouseTop(QWaylandInputDevice *inputDevice, const QPointF &local, Qt::MouseButtons b,Qt::KeyboardModifiers mods); void processMouseBottom(QWaylandInputDevice *inputDevice, const QPointF &local, Qt::MouseButtons b,Qt::KeyboardModifiers mods); @@ -486,7 +486,7 @@ class QWaylandBradientDecorationPlugin : public QWaylandDecorationPlugin Q_OBJECT Q_PLUGIN_METADATA(IID QWaylandDecorationFactoryInterface_iid FILE "bradient.json") public: - QWaylandAbstractDecoration *create(const QString&, const QStringList&) Q_DECL_OVERRIDE; + QWaylandAbstractDecoration *create(const QString&, const QStringList&) override; }; QWaylandAbstractDecoration *QWaylandBradientDecorationPlugin::create(const QString& system, const QStringList& paramList) diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/main.cpp b/src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/main.cpp index ea66995d45f..4f5a2ae3c39 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/main.cpp +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/main.cpp @@ -49,7 +49,7 @@ class QWaylandBrcmEglClientBufferPlugin : public QWaylandClientBufferIntegration Q_OBJECT Q_PLUGIN_METADATA(IID QWaylandClientBufferIntegrationFactoryInterface_iid FILE "brcm-egl.json") public: - QWaylandClientBufferIntegration *create(const QString&, const QStringList&) Q_DECL_OVERRIDE; + QWaylandClientBufferIntegration *create(const QString&, const QStringList&) override; }; QWaylandClientBufferIntegration *QWaylandBrcmEglClientBufferPlugin::create(const QString& system, const QStringList& paramList) diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/drm-egl-server/main.cpp b/src/plugins/platforms/wayland/plugins/hardwareintegration/drm-egl-server/main.cpp index 9149d588caa..70c9e300a44 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/drm-egl-server/main.cpp +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/drm-egl-server/main.cpp @@ -49,7 +49,7 @@ class DrmEglServerBufferPlugin : public QWaylandServerBufferIntegrationPlugin Q_OBJECT Q_PLUGIN_METADATA(IID QWaylandServerBufferIntegrationFactoryInterface_iid FILE "drm-egl-server.json") public: - QWaylandServerBufferIntegration *create(const QString&, const QStringList&) Q_DECL_OVERRIDE; + QWaylandServerBufferIntegration *create(const QString&, const QStringList&) override; }; QWaylandServerBufferIntegration *DrmEglServerBufferPlugin::create(const QString& system, const QStringList& paramList) diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/libhybris-egl-server/main.cpp b/src/plugins/platforms/wayland/plugins/hardwareintegration/libhybris-egl-server/main.cpp index f7ae0cdfa5b..417597c368d 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/libhybris-egl-server/main.cpp +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/libhybris-egl-server/main.cpp @@ -49,7 +49,7 @@ class LibHybrisEglServerBufferPlugin : public QWaylandServerBufferIntegrationPlu Q_OBJECT Q_PLUGIN_METADATA(IID QWaylandServerBufferIntegrationFactoryInterface_iid FILE "libhybris-egl-server.json") public: - QWaylandServerBufferIntegration *create(const QString&, const QStringList&) Q_DECL_OVERRIDE; + QWaylandServerBufferIntegration *create(const QString&, const QStringList&) override; }; QWaylandServerBufferIntegration *LibHybrisEglServerBufferPlugin::create(const QString& system, const QStringList& paramList) diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/main.cpp b/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/main.cpp index 364e18affcd..05053ff950d 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/main.cpp +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/main.cpp @@ -49,7 +49,7 @@ class QWaylandEglClientBufferPlugin : public QWaylandClientBufferIntegrationPlug Q_OBJECT Q_PLUGIN_METADATA(IID QWaylandClientBufferIntegrationFactoryInterface_iid FILE "wayland-egl.json") public: - QWaylandClientBufferIntegration *create(const QString&, const QStringList&) Q_DECL_OVERRIDE; + QWaylandClientBufferIntegration *create(const QString&, const QStringList&) override; }; QWaylandClientBufferIntegration *QWaylandEglClientBufferPlugin::create(const QString& system, const QStringList& paramList) diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-egl/main.cpp b/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-egl/main.cpp index ea4f397053b..07222f2374c 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-egl/main.cpp +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-egl/main.cpp @@ -49,7 +49,7 @@ class QWaylandXCompositeEglClientBufferIntegrationPlugin : public QWaylandClient Q_OBJECT Q_PLUGIN_METADATA(IID QWaylandClientBufferIntegrationFactoryInterface_iid FILE "xcomposite-egl.json") public: - QWaylandClientBufferIntegration *create(const QString&, const QStringList&) Q_DECL_OVERRIDE; + QWaylandClientBufferIntegration *create(const QString&, const QStringList&) override; }; QWaylandClientBufferIntegration *QWaylandXCompositeEglClientBufferIntegrationPlugin::create(const QString& system, const QStringList& paramList) diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-glx/main.cpp b/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-glx/main.cpp index 0a04f716c27..00fa255b52e 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-glx/main.cpp +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-glx/main.cpp @@ -49,7 +49,7 @@ class QWaylandXCompositeGlxClientBufferIntegrationPlugin : public QWaylandClient Q_OBJECT Q_PLUGIN_METADATA(IID QWaylandClientBufferIntegrationFactoryInterface_iid FILE "xcomposite-glx.json") public: - QWaylandClientBufferIntegration *create(const QString&, const QStringList&) Q_DECL_OVERRIDE; + QWaylandClientBufferIntegration *create(const QString&, const QStringList&) override; }; QWaylandClientBufferIntegration *QWaylandXCompositeGlxClientBufferIntegrationPlugin::create(const QString& system, const QStringList& paramList) diff --git a/src/plugins/platforms/wayland/qwaylandclipboard_p.h b/src/plugins/platforms/wayland/qwaylandclipboard_p.h index 584322e07db..211a969420b 100644 --- a/src/plugins/platforms/wayland/qwaylandclipboard_p.h +++ b/src/plugins/platforms/wayland/qwaylandclipboard_p.h @@ -71,10 +71,10 @@ public: ~QWaylandClipboard(); - QMimeData *mimeData(QClipboard::Mode mode = QClipboard::Clipboard) Q_DECL_OVERRIDE; - void setMimeData(QMimeData *data, QClipboard::Mode mode = QClipboard::Clipboard) Q_DECL_OVERRIDE; - bool supportsMode(QClipboard::Mode mode) const Q_DECL_OVERRIDE; - bool ownsMode(QClipboard::Mode mode) const Q_DECL_OVERRIDE; + QMimeData *mimeData(QClipboard::Mode mode = QClipboard::Clipboard) override; + void setMimeData(QMimeData *data, QClipboard::Mode mode = QClipboard::Clipboard) override; + bool supportsMode(QClipboard::Mode mode) const override; + bool ownsMode(QClipboard::Mode mode) const override; private: QWaylandDisplay *mDisplay; diff --git a/src/plugins/platforms/wayland/qwaylandcursor_p.h b/src/plugins/platforms/wayland/qwaylandcursor_p.h index 97921f9ccc0..916a464e455 100644 --- a/src/plugins/platforms/wayland/qwaylandcursor_p.h +++ b/src/plugins/platforms/wayland/qwaylandcursor_p.h @@ -75,10 +75,10 @@ public: QWaylandCursor(QWaylandScreen *screen); ~QWaylandCursor(); - void changeCursor(QCursor *cursor, QWindow *window) Q_DECL_OVERRIDE; - void pointerEvent(const QMouseEvent &event) Q_DECL_OVERRIDE; - QPoint pos() const Q_DECL_OVERRIDE; - void setPos(const QPoint &pos) Q_DECL_OVERRIDE; + void changeCursor(QCursor *cursor, QWindow *window) override; + void pointerEvent(const QMouseEvent &event) override; + QPoint pos() const override; + void setPos(const QPoint &pos) override; struct wl_cursor_image *cursorImage(Qt::CursorShape shape); QSharedPointer cursorBitmapImage(const QCursor *cursor); diff --git a/src/plugins/platforms/wayland/qwaylanddatadevice_p.h b/src/plugins/platforms/wayland/qwaylanddatadevice_p.h index 0b16f97d2c0..1ec8761b913 100644 --- a/src/plugins/platforms/wayland/qwaylanddatadevice_p.h +++ b/src/plugins/platforms/wayland/qwaylanddatadevice_p.h @@ -92,12 +92,12 @@ public: void cancelDrag(); protected: - void data_device_data_offer(struct ::wl_data_offer *id) Q_DECL_OVERRIDE; - void data_device_drop() Q_DECL_OVERRIDE; - void data_device_enter(uint32_t serial, struct ::wl_surface *surface, wl_fixed_t x, wl_fixed_t y, struct ::wl_data_offer *id) Q_DECL_OVERRIDE; - void data_device_leave() Q_DECL_OVERRIDE; - void data_device_motion(uint32_t time, wl_fixed_t x, wl_fixed_t y) Q_DECL_OVERRIDE; - void data_device_selection(struct ::wl_data_offer *id) Q_DECL_OVERRIDE; + void data_device_data_offer(struct ::wl_data_offer *id) override; + void data_device_drop() override; + void data_device_enter(uint32_t serial, struct ::wl_surface *surface, wl_fixed_t x, wl_fixed_t y, struct ::wl_data_offer *id) override; + void data_device_leave() override; + void data_device_motion(uint32_t time, wl_fixed_t x, wl_fixed_t y) override; + void data_device_selection(struct ::wl_data_offer *id) override; private Q_SLOTS: void selectionSourceCancelled(); diff --git a/src/plugins/platforms/wayland/qwaylanddataoffer_p.h b/src/plugins/platforms/wayland/qwaylanddataoffer_p.h index 96799c861e8..c7520f3e55c 100644 --- a/src/plugins/platforms/wayland/qwaylanddataoffer_p.h +++ b/src/plugins/platforms/wayland/qwaylanddataoffer_p.h @@ -75,7 +75,7 @@ public: QMimeData *mimeData(); protected: - void data_offer_offer(const QString &mime_type) Q_DECL_OVERRIDE; + void data_offer_offer(const QString &mime_type) override; private: QScopedPointer m_mimeData; @@ -90,9 +90,9 @@ public: void appendFormat(const QString &mimeType); protected: - bool hasFormat_sys(const QString &mimeType) const Q_DECL_OVERRIDE; - QStringList formats_sys() const Q_DECL_OVERRIDE; - QVariant retrieveData_sys(const QString &mimeType, QVariant::Type type) const Q_DECL_OVERRIDE; + bool hasFormat_sys(const QString &mimeType) const override; + QStringList formats_sys() const override; + QVariant retrieveData_sys(const QString &mimeType, QVariant::Type type) const override; private: int readData(int fd, QByteArray &data) const; diff --git a/src/plugins/platforms/wayland/qwaylanddatasource_p.h b/src/plugins/platforms/wayland/qwaylanddatasource_p.h index 540e6ad7a1d..0221304c80d 100644 --- a/src/plugins/platforms/wayland/qwaylanddatasource_p.h +++ b/src/plugins/platforms/wayland/qwaylanddatasource_p.h @@ -81,9 +81,9 @@ Q_SIGNALS: void cancelled(); protected: - void data_source_cancelled() Q_DECL_OVERRIDE; - void data_source_send(const QString &mime_type, int32_t fd) Q_DECL_OVERRIDE; - void data_source_target(const QString &mime_type) Q_DECL_OVERRIDE; + void data_source_cancelled() override; + void data_source_send(const QString &mime_type, int32_t fd) override; + void data_source_target(const QString &mime_type) override; private: QWaylandDisplay *m_display; diff --git a/src/plugins/platforms/wayland/qwaylanddisplay_p.h b/src/plugins/platforms/wayland/qwaylanddisplay_p.h index a4631b95f84..e96a89176ba 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay_p.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay_p.h @@ -225,8 +225,8 @@ private: struct wl_callback *mSyncCallback; static const wl_callback_listener syncCallbackListener; - void registry_global(uint32_t id, const QString &interface, uint32_t version) Q_DECL_OVERRIDE; - void registry_global_remove(uint32_t id) Q_DECL_OVERRIDE; + void registry_global(uint32_t id, const QString &interface, uint32_t version) override; + void registry_global_remove(uint32_t id) override; static void shellHandleConfigure(void *data, struct wl_shell *shell, uint32_t time, uint32_t edges, diff --git a/src/plugins/platforms/wayland/qwaylanddnd_p.h b/src/plugins/platforms/wayland/qwaylanddnd_p.h index 215a8b74d07..2a99432c59d 100644 --- a/src/plugins/platforms/wayland/qwaylanddnd_p.h +++ b/src/plugins/platforms/wayland/qwaylanddnd_p.h @@ -71,18 +71,18 @@ public: QWaylandDrag(QWaylandDisplay *display); ~QWaylandDrag(); - QMimeData *platformDropData() Q_DECL_OVERRIDE; + QMimeData *platformDropData() override; void updateTarget(const QString &mimeType); void setResponse(const QPlatformDragQtResponse &response); void finishDrag(const QPlatformDropQtResponse &response); protected: - void startDrag() Q_DECL_OVERRIDE; - void cancel() Q_DECL_OVERRIDE; - void move(const QPoint &globalPos) Q_DECL_OVERRIDE; - void drop(const QPoint &globalPos) Q_DECL_OVERRIDE; - void endDrag() Q_DECL_OVERRIDE; + void startDrag() override; + void cancel() override; + void move(const QPoint &globalPos) override; + void drop(const QPoint &globalPos) override; + void endDrag() override; private: diff --git a/src/plugins/platforms/wayland/qwaylandextendedsurface_p.h b/src/plugins/platforms/wayland/qwaylandextendedsurface_p.h index 39dc4fcf05f..02700b2901d 100644 --- a/src/plugins/platforms/wayland/qwaylandextendedsurface_p.h +++ b/src/plugins/platforms/wayland/qwaylandextendedsurface_p.h @@ -79,9 +79,9 @@ public: Qt::WindowFlags setWindowFlags(Qt::WindowFlags flags); private: - void extended_surface_onscreen_visibility(int32_t visibility) Q_DECL_OVERRIDE; - void extended_surface_set_generic_property(const QString &name, wl_array *value) Q_DECL_OVERRIDE; - void extended_surface_close() Q_DECL_OVERRIDE; + void extended_surface_onscreen_visibility(int32_t visibility) override; + void extended_surface_set_generic_property(const QString &name, wl_array *value) override; + void extended_surface_close() override; QWaylandWindow *m_window; QVariantMap m_properties; diff --git a/src/plugins/platforms/wayland/qwaylandinputcontext_p.h b/src/plugins/platforms/wayland/qwaylandinputcontext_p.h index 53eab994f5b..a131bc5bdf6 100644 --- a/src/plugins/platforms/wayland/qwaylandinputcontext_p.h +++ b/src/plugins/platforms/wayland/qwaylandinputcontext_p.h @@ -89,20 +89,20 @@ public: Qt::LayoutDirection inputDirection() const; protected: - void zwp_text_input_v2_enter(uint32_t serial, struct ::wl_surface *surface) Q_DECL_OVERRIDE; - void zwp_text_input_v2_leave(uint32_t serial, struct ::wl_surface *surface) Q_DECL_OVERRIDE; - void zwp_text_input_v2_modifiers_map(wl_array *map) Q_DECL_OVERRIDE; - void zwp_text_input_v2_input_panel_state(uint32_t state, int32_t x, int32_t y, int32_t width, int32_t height) Q_DECL_OVERRIDE; - void zwp_text_input_v2_preedit_string(const QString &text, const QString &commit) Q_DECL_OVERRIDE; - void zwp_text_input_v2_preedit_styling(uint32_t index, uint32_t length, uint32_t style) Q_DECL_OVERRIDE; - void zwp_text_input_v2_preedit_cursor(int32_t index) Q_DECL_OVERRIDE; - void zwp_text_input_v2_commit_string(const QString &text) Q_DECL_OVERRIDE; - void zwp_text_input_v2_cursor_position(int32_t index, int32_t anchor) Q_DECL_OVERRIDE; - void zwp_text_input_v2_delete_surrounding_text(uint32_t before_length, uint32_t after_length) Q_DECL_OVERRIDE; - void zwp_text_input_v2_keysym(uint32_t time, uint32_t sym, uint32_t state, uint32_t modifiers) Q_DECL_OVERRIDE; - void zwp_text_input_v2_language(const QString &language) Q_DECL_OVERRIDE; - void zwp_text_input_v2_text_direction(uint32_t direction) Q_DECL_OVERRIDE; - void zwp_text_input_v2_input_method_changed(uint32_t serial, uint32_t flags) Q_DECL_OVERRIDE; + void zwp_text_input_v2_enter(uint32_t serial, struct ::wl_surface *surface) override; + void zwp_text_input_v2_leave(uint32_t serial, struct ::wl_surface *surface) override; + void zwp_text_input_v2_modifiers_map(wl_array *map) override; + void zwp_text_input_v2_input_panel_state(uint32_t state, int32_t x, int32_t y, int32_t width, int32_t height) override; + void zwp_text_input_v2_preedit_string(const QString &text, const QString &commit) override; + void zwp_text_input_v2_preedit_styling(uint32_t index, uint32_t length, uint32_t style) override; + void zwp_text_input_v2_preedit_cursor(int32_t index) override; + void zwp_text_input_v2_commit_string(const QString &text) override; + void zwp_text_input_v2_cursor_position(int32_t index, int32_t anchor) override; + void zwp_text_input_v2_delete_surrounding_text(uint32_t before_length, uint32_t after_length) override; + void zwp_text_input_v2_keysym(uint32_t time, uint32_t sym, uint32_t state, uint32_t modifiers) override; + void zwp_text_input_v2_language(const QString &language) override; + void zwp_text_input_v2_text_direction(uint32_t direction) override; + void zwp_text_input_v2_input_method_changed(uint32_t serial, uint32_t flags) override; private: Qt::KeyboardModifiers modifiersToQtModifiers(uint32_t modifiers); @@ -134,23 +134,23 @@ public: explicit QWaylandInputContext(QWaylandDisplay *display); ~QWaylandInputContext(); - bool isValid() const Q_DECL_OVERRIDE; + bool isValid() const override; - void reset() Q_DECL_OVERRIDE; - void commit() Q_DECL_OVERRIDE; - void update(Qt::InputMethodQueries) Q_DECL_OVERRIDE; + void reset() override; + void commit() override; + void update(Qt::InputMethodQueries) override; - void invokeAction(QInputMethod::Action, int cursorPosition) Q_DECL_OVERRIDE; + void invokeAction(QInputMethod::Action, int cursorPosition) override; - void showInputPanel() Q_DECL_OVERRIDE; - void hideInputPanel() Q_DECL_OVERRIDE; - bool isInputPanelVisible() const Q_DECL_OVERRIDE; - QRectF keyboardRect() const Q_DECL_OVERRIDE; + void showInputPanel() override; + void hideInputPanel() override; + bool isInputPanelVisible() const override; + QRectF keyboardRect() const override; - QLocale locale() const Q_DECL_OVERRIDE; - Qt::LayoutDirection inputDirection() const Q_DECL_OVERRIDE; + QLocale locale() const override; + Qt::LayoutDirection inputDirection() const override; - void setFocusObject(QObject *object) Q_DECL_OVERRIDE; + void setFocusObject(QObject *object) override; private: QWaylandTextInput *textInput() const; diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h index f2bbd0dc002..d8bd0062f29 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h +++ b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h @@ -154,7 +154,7 @@ private: uint32_t mTime; uint32_t mSerial; - void seat_capabilities(uint32_t caps) Q_DECL_OVERRIDE; + void seat_capabilities(uint32_t caps) override; void handleTouchPoint(int id, double x, double y, Qt::TouchPointState state); QTouchDevice *mTouchDevice; @@ -183,19 +183,19 @@ public: void keyboard_keymap(uint32_t format, int32_t fd, - uint32_t size) Q_DECL_OVERRIDE; + uint32_t size) override; void keyboard_enter(uint32_t time, struct wl_surface *surface, - struct wl_array *keys) Q_DECL_OVERRIDE; + struct wl_array *keys) override; void keyboard_leave(uint32_t time, - struct wl_surface *surface) Q_DECL_OVERRIDE; + struct wl_surface *surface) override; void keyboard_key(uint32_t serial, uint32_t time, - uint32_t key, uint32_t state) Q_DECL_OVERRIDE; + uint32_t key, uint32_t state) override; void keyboard_modifiers(uint32_t serial, uint32_t mods_depressed, uint32_t mods_latched, uint32_t mods_locked, - uint32_t group) Q_DECL_OVERRIDE; + uint32_t group) override; QWaylandInputDevice *mParent; QWaylandWindow *mFocus; @@ -236,15 +236,15 @@ public: virtual ~Pointer(); void pointer_enter(uint32_t serial, struct wl_surface *surface, - wl_fixed_t sx, wl_fixed_t sy) Q_DECL_OVERRIDE; - void pointer_leave(uint32_t time, struct wl_surface *surface) Q_DECL_OVERRIDE; + wl_fixed_t sx, wl_fixed_t sy) override; + void pointer_leave(uint32_t time, struct wl_surface *surface) override; void pointer_motion(uint32_t time, - wl_fixed_t sx, wl_fixed_t sy) Q_DECL_OVERRIDE; + wl_fixed_t sx, wl_fixed_t sy) override; void pointer_button(uint32_t serial, uint32_t time, - uint32_t button, uint32_t state) Q_DECL_OVERRIDE; + uint32_t button, uint32_t state) override; void pointer_axis(uint32_t time, uint32_t axis, - wl_fixed_t value) Q_DECL_OVERRIDE; + wl_fixed_t value) override; void releaseButtons(); @@ -274,16 +274,16 @@ public: struct wl_surface *surface, int32_t id, wl_fixed_t x, - wl_fixed_t y) Q_DECL_OVERRIDE; + wl_fixed_t y) override; void touch_up(uint32_t serial, uint32_t time, - int32_t id) Q_DECL_OVERRIDE; + int32_t id) override; void touch_motion(uint32_t time, int32_t id, wl_fixed_t x, - wl_fixed_t y) Q_DECL_OVERRIDE; - void touch_frame() Q_DECL_OVERRIDE; - void touch_cancel() Q_DECL_OVERRIDE; + wl_fixed_t y) override; + void touch_frame() override; + void touch_cancel() override; bool allTouchPointsReleased(); void releasePoints(); diff --git a/src/plugins/platforms/wayland/qwaylandintegration_p.h b/src/plugins/platforms/wayland/qwaylandintegration_p.h index 90fce4fcfa4..174eca25315 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration_p.h +++ b/src/plugins/platforms/wayland/qwaylandintegration_p.h @@ -73,40 +73,40 @@ public: QWaylandIntegration(); ~QWaylandIntegration(); - bool hasCapability(QPlatformIntegration::Capability cap) const Q_DECL_OVERRIDE; - QPlatformWindow *createPlatformWindow(QWindow *window) const Q_DECL_OVERRIDE; + bool hasCapability(QPlatformIntegration::Capability cap) const override; + QPlatformWindow *createPlatformWindow(QWindow *window) const override; #if QT_CONFIG(opengl) - QPlatformOpenGLContext *createPlatformOpenGLContext(QOpenGLContext *context) const Q_DECL_OVERRIDE; + QPlatformOpenGLContext *createPlatformOpenGLContext(QOpenGLContext *context) const override; #endif - QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const Q_DECL_OVERRIDE; + QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const override; - QAbstractEventDispatcher *createEventDispatcher() const Q_DECL_OVERRIDE; - void initialize() Q_DECL_OVERRIDE; + QAbstractEventDispatcher *createEventDispatcher() const override; + void initialize() override; - QPlatformFontDatabase *fontDatabase() const Q_DECL_OVERRIDE; + QPlatformFontDatabase *fontDatabase() const override; - QPlatformNativeInterface *nativeInterface() const Q_DECL_OVERRIDE; + QPlatformNativeInterface *nativeInterface() const override; #if QT_CONFIG(clipboard) - QPlatformClipboard *clipboard() const Q_DECL_OVERRIDE; + QPlatformClipboard *clipboard() const override; #endif #if QT_CONFIG(draganddrop) - QPlatformDrag *drag() const Q_DECL_OVERRIDE; + QPlatformDrag *drag() const override; #endif - QPlatformInputContext *inputContext() const Q_DECL_OVERRIDE; + QPlatformInputContext *inputContext() const override; - QVariant styleHint(StyleHint hint) const Q_DECL_OVERRIDE; + QVariant styleHint(StyleHint hint) const override; #if QT_CONFIG(accessibility) - QPlatformAccessibility *accessibility() const Q_DECL_OVERRIDE; + QPlatformAccessibility *accessibility() const override; #endif - QPlatformServices *services() const Q_DECL_OVERRIDE; + QPlatformServices *services() const override; QWaylandDisplay *display() const; - QStringList themeNames() const Q_DECL_OVERRIDE; + QStringList themeNames() const override; - QPlatformTheme *createPlatformTheme(const QString &name) const Q_DECL_OVERRIDE; + QPlatformTheme *createPlatformTheme(const QString &name) const override; QWaylandInputDevice *createInputDevice(QWaylandDisplay *display, int version, uint32_t id); diff --git a/src/plugins/platforms/wayland/qwaylandnativeinterface_p.h b/src/plugins/platforms/wayland/qwaylandnativeinterface_p.h index 7b8b2834255..c83180c0995 100644 --- a/src/plugins/platforms/wayland/qwaylandnativeinterface_p.h +++ b/src/plugins/platforms/wayland/qwaylandnativeinterface_p.h @@ -67,22 +67,22 @@ class Q_WAYLAND_CLIENT_EXPORT QWaylandNativeInterface : public QPlatformNativeIn { public: QWaylandNativeInterface(QWaylandIntegration *integration); - void *nativeResourceForIntegration(const QByteArray &resource) Q_DECL_OVERRIDE; + void *nativeResourceForIntegration(const QByteArray &resource) override; void *nativeResourceForWindow(const QByteArray &resourceString, - QWindow *window) Q_DECL_OVERRIDE; + QWindow *window) override; void *nativeResourceForScreen(const QByteArray &resourceString, - QScreen *screen) Q_DECL_OVERRIDE; + QScreen *screen) override; #if QT_CONFIG(opengl) - void *nativeResourceForContext(const QByteArray &resource, QOpenGLContext *context) Q_DECL_OVERRIDE; + void *nativeResourceForContext(const QByteArray &resource, QOpenGLContext *context) override; #endif - QVariantMap windowProperties(QPlatformWindow *window) const Q_DECL_OVERRIDE; - QVariant windowProperty(QPlatformWindow *window, const QString &name) const Q_DECL_OVERRIDE; - QVariant windowProperty(QPlatformWindow *window, const QString &name, const QVariant &defaultValue) const Q_DECL_OVERRIDE; - void setWindowProperty(QPlatformWindow *window, const QString &name, const QVariant &value) Q_DECL_OVERRIDE; + QVariantMap windowProperties(QPlatformWindow *window) const override; + QVariant windowProperty(QPlatformWindow *window, const QString &name) const override; + QVariant windowProperty(QPlatformWindow *window, const QString &name, const QVariant &defaultValue) const override; + void setWindowProperty(QPlatformWindow *window, const QString &name, const QVariant &value) override; void emitWindowPropertyChanged(QPlatformWindow *window, const QString &name); - QFunctionPointer platformFunction(const QByteArray &resource) const Q_DECL_OVERRIDE; + QFunctionPointer platformFunction(const QByteArray &resource) const override; private: QWaylandIntegration *m_integration; diff --git a/src/plugins/platforms/wayland/qwaylandqtkey_p.h b/src/plugins/platforms/wayland/qwaylandqtkey_p.h index 155b625400d..3374b907a44 100644 --- a/src/plugins/platforms/wayland/qwaylandqtkey_p.h +++ b/src/plugins/platforms/wayland/qwaylandqtkey_p.h @@ -80,7 +80,7 @@ private: uint32_t nativeModifiers, const QString &text, uint32_t autorep, - uint32_t count) Q_DECL_OVERRIDE; + uint32_t count) override; }; diff --git a/src/plugins/platforms/wayland/qwaylandscreen_p.h b/src/plugins/platforms/wayland/qwaylandscreen_p.h index f9f0776ffbe..b2900a964f1 100644 --- a/src/plugins/platforms/wayland/qwaylandscreen_p.h +++ b/src/plugins/platforms/wayland/qwaylandscreen_p.h @@ -72,26 +72,26 @@ public: void init(); QWaylandDisplay *display() const; - QRect geometry() const Q_DECL_OVERRIDE; - int depth() const Q_DECL_OVERRIDE; - QImage::Format format() const Q_DECL_OVERRIDE; + QRect geometry() const override; + int depth() const override; + QImage::Format format() const override; - QSizeF physicalSize() const Q_DECL_OVERRIDE; + QSizeF physicalSize() const override; - QDpi logicalDpi() const Q_DECL_OVERRIDE; - QList virtualSiblings() const Q_DECL_OVERRIDE; + QDpi logicalDpi() const override; + QList virtualSiblings() const override; - void setOrientationUpdateMask(Qt::ScreenOrientations mask) Q_DECL_OVERRIDE; + void setOrientationUpdateMask(Qt::ScreenOrientations mask) override; - Qt::ScreenOrientation orientation() const Q_DECL_OVERRIDE; + Qt::ScreenOrientation orientation() const override; int scale() const; - qreal devicePixelRatio() const Q_DECL_OVERRIDE; - qreal refreshRate() const Q_DECL_OVERRIDE; + qreal devicePixelRatio() const override; + qreal refreshRate() const override; - QString name() const Q_DECL_OVERRIDE { return mOutputName; } + QString name() const override { return mOutputName; } #if QT_CONFIG(cursor) - QPlatformCursor *cursor() const Q_DECL_OVERRIDE; + QPlatformCursor *cursor() const override; QWaylandCursor *waylandCursor() const { return mWaylandCursor; }; #endif @@ -101,15 +101,15 @@ public: static QWaylandScreen *waylandScreenFromWindow(QWindow *window); private: - void output_mode(uint32_t flags, int width, int height, int refresh) Q_DECL_OVERRIDE; + void output_mode(uint32_t flags, int width, int height, int refresh) override; void output_geometry(int32_t x, int32_t y, int32_t width, int32_t height, int subpixel, const QString &make, const QString &model, - int32_t transform) Q_DECL_OVERRIDE; - void output_scale(int32_t factor) Q_DECL_OVERRIDE; - void output_done() Q_DECL_OVERRIDE; + int32_t transform) override; + void output_scale(int32_t factor) override; + void output_done() override; int m_outputId; QWaylandDisplay *mWaylandDisplay; diff --git a/src/plugins/platforms/wayland/qwaylandshmbackingstore_p.h b/src/plugins/platforms/wayland/qwaylandshmbackingstore_p.h index a5b809c769f..71f98e30cfe 100644 --- a/src/plugins/platforms/wayland/qwaylandshmbackingstore_p.h +++ b/src/plugins/platforms/wayland/qwaylandshmbackingstore_p.h @@ -72,8 +72,8 @@ public: QWaylandShmBuffer(QWaylandDisplay *display, const QSize &size, QImage::Format format, int scale = 1); ~QWaylandShmBuffer(); - QSize size() const Q_DECL_OVERRIDE { return mImage.size(); } - int scale() const Q_DECL_OVERRIDE { return int(mImage.devicePixelRatio()); } + QSize size() const override { return mImage.size(); } + int scale() const override { return int(mImage.devicePixelRatio()); } QImage *image() { return &mImage; } QImage *imageInsideMargins(const QMargins &margins); @@ -91,11 +91,11 @@ public: ~QWaylandShmBackingStore(); QPaintDevice *paintDevice(); - void flush(QWindow *window, const QRegion ®ion, const QPoint &offset) Q_DECL_OVERRIDE; - void resize(const QSize &size, const QRegion &staticContents) Q_DECL_OVERRIDE; + void flush(QWindow *window, const QRegion ®ion, const QPoint &offset) override; + void resize(const QSize &size, const QRegion &staticContents) override; void resize(const QSize &size); - void beginPaint(const QRegion &) Q_DECL_OVERRIDE; - void endPaint() Q_DECL_OVERRIDE; + void beginPaint(const QRegion &) override; + void endPaint() override; QWaylandAbstractDecoration *windowDecoration() const; @@ -108,7 +108,7 @@ public: void iterateBuffer(); #if QT_CONFIG(opengl) - QImage toImage() const Q_DECL_OVERRIDE; + QImage toImage() const override; #endif private: diff --git a/src/plugins/platforms/wayland/qwaylandshmwindow_p.h b/src/plugins/platforms/wayland/qwaylandshmwindow_p.h index d06b9b00951..af86ce3a342 100644 --- a/src/plugins/platforms/wayland/qwaylandshmwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandshmwindow_p.h @@ -64,8 +64,8 @@ public: QWaylandShmWindow(QWindow *window); ~QWaylandShmWindow(); - WindowType windowType() const Q_DECL_OVERRIDE; - QSurfaceFormat format() const Q_DECL_OVERRIDE { return QSurfaceFormat(); } + WindowType windowType() const override; + QSurfaceFormat format() const override { return QSurfaceFormat(); } }; } diff --git a/src/plugins/platforms/wayland/qwaylandtouch_p.h b/src/plugins/platforms/wayland/qwaylandtouch_p.h index b17bce6abe7..7d909769d8a 100644 --- a/src/plugins/platforms/wayland/qwaylandtouch_p.h +++ b/src/plugins/platforms/wayland/qwaylandtouch_p.h @@ -88,8 +88,8 @@ private: int32_t velocity_x, int32_t velocity_y, uint32_t flags, - struct wl_array *rawdata) Q_DECL_OVERRIDE; - void touch_extension_configure(uint32_t flags) Q_DECL_OVERRIDE; + struct wl_array *rawdata) override; + void touch_extension_configure(uint32_t flags) override; void sendTouchEvent(); diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index 7b48e890f05..d5d6e3a315f 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -111,16 +111,16 @@ public: ~QWaylandWindow(); virtual WindowType windowType() const = 0; - WId winId() const Q_DECL_OVERRIDE; - void setVisible(bool visible) Q_DECL_OVERRIDE; - void setParent(const QPlatformWindow *parent) Q_DECL_OVERRIDE; + WId winId() const override; + void setVisible(bool visible) override; + void setParent(const QPlatformWindow *parent) override; - void setWindowTitle(const QString &title) Q_DECL_OVERRIDE; + void setWindowTitle(const QString &title) override; inline QIcon windowIcon() const; - void setWindowIcon(const QIcon &icon) Q_DECL_OVERRIDE; + void setWindowIcon(const QIcon &icon) override; - void setGeometry(const QRect &rect) Q_DECL_OVERRIDE; + void setGeometry(const QRect &rect) override; void configure(uint32_t edges, int32_t width, int32_t height); @@ -136,7 +136,7 @@ public: void waitForFrameSync(); - QMargins frameMargins() const Q_DECL_OVERRIDE; + QMargins frameMargins() const override; static QWaylandWindow *fromWlSurface(::wl_surface *surface); @@ -145,22 +145,22 @@ public: QWaylandSubSurface *subSurfaceWindow() const; QWaylandScreen *screen() const { return mScreen; } - void handleContentOrientationChange(Qt::ScreenOrientation orientation) Q_DECL_OVERRIDE; + void handleContentOrientationChange(Qt::ScreenOrientation orientation) override; void setOrientationMask(Qt::ScreenOrientations mask); - void setWindowState(Qt::WindowState state) Q_DECL_OVERRIDE; - void setWindowFlags(Qt::WindowFlags flags) Q_DECL_OVERRIDE; + void setWindowState(Qt::WindowState state) override; + void setWindowFlags(Qt::WindowFlags flags) override; - void raise() Q_DECL_OVERRIDE; - void lower() Q_DECL_OVERRIDE; + void raise() override; + void lower() override; - void setMask(const QRegion ®ion) Q_DECL_OVERRIDE; + void setMask(const QRegion ®ion) override; int scale() const; - qreal devicePixelRatio() const Q_DECL_OVERRIDE; + qreal devicePixelRatio() const override; - void requestActivateWindow() Q_DECL_OVERRIDE; - bool isExposed() const Q_DECL_OVERRIDE; + void requestActivateWindow() override; + bool isExposed() const override; void unfocus(); QWaylandAbstractDecoration *decoration() const; @@ -187,7 +187,7 @@ public: void doResize(); void setCanResize(bool canResize); - bool setMouseGrabEnabled(bool grab) Q_DECL_OVERRIDE; + bool setMouseGrabEnabled(bool grab) override; static QWaylandWindow *mouseGrab() { return mMouseGrab; } void sendProperty(const QString &name, const QVariant &value); @@ -200,11 +200,11 @@ public: void setBackingStore(QWaylandShmBackingStore *backingStore) { mBackingStore = backingStore; } QWaylandShmBackingStore *backingStore() const { return mBackingStore; } - bool setKeyboardGrabEnabled(bool) Q_DECL_OVERRIDE { return false; } - void propagateSizeHints() Q_DECL_OVERRIDE { } + bool setKeyboardGrabEnabled(bool) override { return false; } + void propagateSizeHints() override { } void addAttachOffset(const QPoint point); - void requestUpdate() Q_DECL_OVERRIDE; + void requestUpdate() override; public slots: void requestResize(); diff --git a/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration_p.h b/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration_p.h index 463b67ef6a8..cf6ca660578 100644 --- a/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration_p.h @@ -77,10 +77,10 @@ public: explicit QWaylandWindowManagerIntegration(QWaylandDisplay *waylandDisplay); virtual ~QWaylandWindowManagerIntegration(); - QByteArray desktopEnvironment() const Q_DECL_OVERRIDE; + QByteArray desktopEnvironment() const override; - bool openUrl(const QUrl &url) Q_DECL_OVERRIDE; - bool openDocument(const QUrl &url) Q_DECL_OVERRIDE; + bool openUrl(const QUrl &url) override; + bool openDocument(const QUrl &url) override; bool showIsFullScreen() const; @@ -90,8 +90,8 @@ private: QScopedPointer d_ptr; - void windowmanager_hints(int32_t showIsFullScreen) Q_DECL_OVERRIDE; - void windowmanager_quit() Q_DECL_OVERRIDE; + void windowmanager_hints(int32_t showIsFullScreen) override; + void windowmanager_quit() override; void openUrl_helper(const QUrl &url); }; diff --git a/src/plugins/platforms/wayland/qwaylandwlshellintegration_p.h b/src/plugins/platforms/wayland/qwaylandwlshellintegration_p.h index 9082c7628d1..55b8f89cac9 100644 --- a/src/plugins/platforms/wayland/qwaylandwlshellintegration_p.h +++ b/src/plugins/platforms/wayland/qwaylandwlshellintegration_p.h @@ -58,8 +58,8 @@ class Q_WAYLAND_CLIENT_EXPORT QWaylandWlShellIntegration : public QWaylandShellI { public: QWaylandWlShellIntegration(QWaylandDisplay* display); - bool initialize(QWaylandDisplay *) Q_DECL_OVERRIDE; - QWaylandShellSurface *createShellSurface(QWaylandWindow *window) Q_DECL_OVERRIDE; + bool initialize(QWaylandDisplay *) override; + QWaylandShellSurface *createShellSurface(QWaylandWindow *window) override; private: QtWayland::wl_shell *m_wlShell; diff --git a/src/plugins/platforms/wayland/qwaylandwlshellsurface_p.h b/src/plugins/platforms/wayland/qwaylandwlshellsurface_p.h index 89bce55852d..94e3417a412 100644 --- a/src/plugins/platforms/wayland/qwaylandwlshellsurface_p.h +++ b/src/plugins/platforms/wayland/qwaylandwlshellsurface_p.h @@ -78,27 +78,27 @@ public: virtual ~QWaylandWlShellSurface(); using QtWayland::wl_shell_surface::resize; - void resize(QWaylandInputDevice *inputDevice, enum wl_shell_surface_resize edges) Q_DECL_OVERRIDE; + void resize(QWaylandInputDevice *inputDevice, enum wl_shell_surface_resize edges) override; using QtWayland::wl_shell_surface::move; - void move(QWaylandInputDevice *inputDevice) Q_DECL_OVERRIDE; + void move(QWaylandInputDevice *inputDevice) override; - void setTitle(const QString & title) Q_DECL_OVERRIDE; - void setAppId(const QString &appId) Q_DECL_OVERRIDE; + void setTitle(const QString & title) override; + void setAppId(const QString &appId) override; - void raise() Q_DECL_OVERRIDE; - void lower() Q_DECL_OVERRIDE; - void setContentOrientationMask(Qt::ScreenOrientations orientation) Q_DECL_OVERRIDE; - void setWindowFlags(Qt::WindowFlags flags) Q_DECL_OVERRIDE; - void sendProperty(const QString &name, const QVariant &value) Q_DECL_OVERRIDE; + void raise() override; + void lower() override; + void setContentOrientationMask(Qt::ScreenOrientations orientation) override; + void setWindowFlags(Qt::WindowFlags flags) override; + void sendProperty(const QString &name, const QVariant &value) override; void setType(Qt::WindowType type, QWaylandWindow *transientParent) override; private: - void setMaximized() Q_DECL_OVERRIDE; - void setFullscreen() Q_DECL_OVERRIDE; - void setNormal() Q_DECL_OVERRIDE; - void setMinimized() Q_DECL_OVERRIDE; + void setMaximized() override; + void setFullscreen() override; + void setNormal() override; + void setMinimized() override; void setTopLevel(); void updateTransientParent(QWindow *parent); @@ -110,11 +110,11 @@ private: QSize m_size; QWaylandExtendedSurface *m_extendedWindow; - void shell_surface_ping(uint32_t serial) Q_DECL_OVERRIDE; + void shell_surface_ping(uint32_t serial) override; void shell_surface_configure(uint32_t edges, int32_t width, - int32_t height) Q_DECL_OVERRIDE; - void shell_surface_popup_done() Q_DECL_OVERRIDE; + int32_t height) override; + void shell_surface_popup_done() override; friend class QWaylandWindow; }; diff --git a/src/plugins/platforms/wayland/qwaylandxdgshell_p.h b/src/plugins/platforms/wayland/qwaylandxdgshell_p.h index 97a15e46aee..f462f28281d 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgshell_p.h +++ b/src/plugins/platforms/wayland/qwaylandxdgshell_p.h @@ -82,7 +82,7 @@ public: QWaylandXdgPopup *createXdgPopup(QWaylandWindow *window); private: - void xdg_shell_ping(uint32_t serial) Q_DECL_OVERRIDE; + void xdg_shell_ping(uint32_t serial) override; QVector m_popups; uint m_popupSerial; diff --git a/src/plugins/platforms/wayland/qwaylandxdgshellintegration_p.h b/src/plugins/platforms/wayland/qwaylandxdgshellintegration_p.h index e0e6bda0dc5..e14bf5bd23d 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgshellintegration_p.h +++ b/src/plugins/platforms/wayland/qwaylandxdgshellintegration_p.h @@ -59,9 +59,9 @@ class Q_WAYLAND_CLIENT_EXPORT QWaylandXdgShellIntegration : public QWaylandShell { public: QWaylandXdgShellIntegration(QWaylandDisplay *display); - bool initialize(QWaylandDisplay *display) Q_DECL_OVERRIDE; - QWaylandShellSurface *createShellSurface(QWaylandWindow *window) Q_DECL_OVERRIDE; - void handleKeyboardFocusChanged(QWaylandWindow *newFocus, QWaylandWindow *oldFocus) Q_DECL_OVERRIDE; + bool initialize(QWaylandDisplay *display) override; + QWaylandShellSurface *createShellSurface(QWaylandWindow *window) override; + void handleKeyboardFocusChanged(QWaylandWindow *newFocus, QWaylandWindow *oldFocus) override; private: QWaylandXdgShell *m_xdgShell; diff --git a/src/plugins/platforms/wayland/qwaylandxdgsurface_p.h b/src/plugins/platforms/wayland/qwaylandxdgsurface_p.h index 184ef13eb1f..00154ade072 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgsurface_p.h +++ b/src/plugins/platforms/wayland/qwaylandxdgsurface_p.h @@ -82,19 +82,19 @@ public: using QtWayland::xdg_surface::resize; void resize(QWaylandInputDevice *inputDevice, enum resize_edge edges); - void resize(QWaylandInputDevice *inputDevice, enum wl_shell_surface_resize edges) Q_DECL_OVERRIDE; + void resize(QWaylandInputDevice *inputDevice, enum wl_shell_surface_resize edges) override; using QtWayland::xdg_surface::move; - void move(QWaylandInputDevice *inputDevice) Q_DECL_OVERRIDE; + void move(QWaylandInputDevice *inputDevice) override; - void setTitle(const QString &title) Q_DECL_OVERRIDE; - void setAppId(const QString &appId) Q_DECL_OVERRIDE; + void setTitle(const QString &title) override; + void setAppId(const QString &appId) override; - void raise() Q_DECL_OVERRIDE; - void lower() Q_DECL_OVERRIDE; - void setContentOrientationMask(Qt::ScreenOrientations orientation) Q_DECL_OVERRIDE; - void setWindowFlags(Qt::WindowFlags flags) Q_DECL_OVERRIDE; - void sendProperty(const QString &name, const QVariant &value) Q_DECL_OVERRIDE; + void raise() override; + void lower() override; + void setContentOrientationMask(Qt::ScreenOrientations orientation) override; + void setWindowFlags(Qt::WindowFlags flags) override; + void sendProperty(const QString &name, const QVariant &value) override; bool isFullscreen() const { return m_fullscreen; } bool isMaximized() const { return m_maximized; } @@ -102,10 +102,10 @@ public: void setType(Qt::WindowType type, QWaylandWindow *transientParent) override; private: - void setMaximized() Q_DECL_OVERRIDE; - void setFullscreen() Q_DECL_OVERRIDE; - void setNormal() Q_DECL_OVERRIDE; - void setMinimized() Q_DECL_OVERRIDE; + void setMaximized() override; + void setFullscreen() override; + void setNormal() override; + void setMinimized() override; void updateTransientParent(QWaylandWindow *parent); @@ -123,8 +123,8 @@ private: void xdg_surface_configure(int32_t width, int32_t height, struct wl_array *states, - uint32_t serial) Q_DECL_OVERRIDE; - void xdg_surface_close() Q_DECL_OVERRIDE; + uint32_t serial) override; + void xdg_surface_close() override; friend class QWaylandWindow; }; diff --git a/tests/auto/wayland/client/mockinput.h b/tests/auto/wayland/client/mockinput.h index 7e88ffb0fac..9c217b6acd2 100644 --- a/tests/auto/wayland/client/mockinput.h +++ b/tests/auto/wayland/client/mockinput.h @@ -54,10 +54,10 @@ public: Touch *touch() const { return m_touch.data(); } protected: - void seat_bind_resource(Resource *resource) Q_DECL_OVERRIDE; - void seat_get_keyboard(Resource *resource, uint32_t id) Q_DECL_OVERRIDE; - void seat_get_pointer(Resource *resource, uint32_t id) Q_DECL_OVERRIDE; - void seat_get_touch(Resource *resource, uint32_t id) Q_DECL_OVERRIDE; + void seat_bind_resource(Resource *resource) override; + void seat_get_keyboard(Resource *resource, uint32_t id) override; + void seat_get_pointer(Resource *resource, uint32_t id) override; + void seat_get_touch(Resource *resource, uint32_t id) override; private: Compositor *m_compositor; @@ -80,7 +80,7 @@ public: void sendKey(uint32_t key, uint32_t state); protected: - void keyboard_destroy_resource(wl_keyboard::Resource *resource) Q_DECL_OVERRIDE; + void keyboard_destroy_resource(wl_keyboard::Resource *resource) override; private: Compositor *m_compositor; @@ -103,7 +103,7 @@ public: void sendButton(uint32_t button, uint32_t state); protected: - void pointer_destroy_resource(wl_pointer::Resource *resource) Q_DECL_OVERRIDE; + void pointer_destroy_resource(wl_pointer::Resource *resource) override; private: Compositor *m_compositor; @@ -158,7 +158,7 @@ public: DataDevice *dataDevice() const; protected: - void data_device_manager_get_data_device(Resource *resource, uint32_t id, struct ::wl_resource *seat) Q_DECL_OVERRIDE; + void data_device_manager_get_data_device(Resource *resource, uint32_t id, struct ::wl_resource *seat) override; void data_device_manager_create_data_source(Resource *resource, uint32_t id) override; private: diff --git a/tests/auto/wayland/client/mocksurface.h b/tests/auto/wayland/client/mocksurface.h index d04386ac8b4..e34d6596ebf 100644 --- a/tests/auto/wayland/client/mocksurface.h +++ b/tests/auto/wayland/client/mocksurface.h @@ -49,16 +49,16 @@ public: protected: - void surface_destroy_resource(Resource *resource) Q_DECL_OVERRIDE; + void surface_destroy_resource(Resource *resource) override; - void surface_destroy(Resource *resource) Q_DECL_OVERRIDE; + void surface_destroy(Resource *resource) override; void surface_attach(Resource *resource, - struct wl_resource *buffer, int x, int y) Q_DECL_OVERRIDE; + struct wl_resource *buffer, int x, int y) override; void surface_damage(Resource *resource, - int32_t x, int32_t y, int32_t width, int32_t height) Q_DECL_OVERRIDE; + int32_t x, int32_t y, int32_t width, int32_t height) override; void surface_frame(Resource *resource, - uint32_t callback) Q_DECL_OVERRIDE; - void surface_commit(Resource *resource) Q_DECL_OVERRIDE; + uint32_t callback) override; + void surface_commit(Resource *resource) override; private: wl_resource *m_buffer; diff --git a/tests/auto/wayland/client/tst_client.cpp b/tests/auto/wayland/client/tst_client.cpp index 6aad25bb40c..5e0db1a14b7 100644 --- a/tests/auto/wayland/client/tst_client.cpp +++ b/tests/auto/wayland/client/tst_client.cpp @@ -91,7 +91,7 @@ public: ++mouseReleaseEventCount; } - void touchEvent(QTouchEvent *event) Q_DECL_OVERRIDE + void touchEvent(QTouchEvent *event) override { ++touchEventCount; } @@ -269,7 +269,7 @@ public: bool dragStarted; protected: - void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE + void mousePressEvent(QMouseEvent *event) override { if (dragStarted) return; From d2d84ab958758108305f96090952ccf992bd9f4e Mon Sep 17 00:00:00 2001 From: Pier Luigi Fiorini Date: Sat, 28 Jan 2017 17:03:22 +0100 Subject: [PATCH 0406/1507] Deduplicate xcomposite-egl and xcomposite-glx plugin class name In 81f80fa1 was set a wrong PLUGIN_CLASS_NAME for xcomposite-egl and xcomposite-glx client integration plugins that collides with the one for the compositor counterpart. Task-number: QTBUG-58491 Change-Id: I23d141adf988942ac8c4c55f421cf763c0e4faff Reviewed-by: Paul Olav Tvete --- .../plugins/hardwareintegration/xcomposite-egl/main.cpp | 4 ++-- .../hardwareintegration/xcomposite-egl/xcomposite-egl.pro | 2 +- .../plugins/hardwareintegration/xcomposite-glx/main.cpp | 4 ++-- .../hardwareintegration/xcomposite-glx/xcomposite-glx.pro | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-egl/main.cpp b/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-egl/main.cpp index 07222f2374c..585285fae05 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-egl/main.cpp +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-egl/main.cpp @@ -44,7 +44,7 @@ QT_BEGIN_NAMESPACE namespace QtWaylandClient { -class QWaylandXCompositeEglClientBufferIntegrationPlugin : public QWaylandClientBufferIntegrationPlugin +class QWaylandXCompositeEglClientBufferPlugin : public QWaylandClientBufferIntegrationPlugin { Q_OBJECT Q_PLUGIN_METADATA(IID QWaylandClientBufferIntegrationFactoryInterface_iid FILE "xcomposite-egl.json") @@ -52,7 +52,7 @@ public: QWaylandClientBufferIntegration *create(const QString&, const QStringList&) override; }; -QWaylandClientBufferIntegration *QWaylandXCompositeEglClientBufferIntegrationPlugin::create(const QString& system, const QStringList& paramList) +QWaylandClientBufferIntegration *QWaylandXCompositeEglClientBufferPlugin::create(const QString& system, const QStringList& paramList) { Q_UNUSED(paramList); Q_UNUSED(system); diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-egl/xcomposite-egl.pro b/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-egl/xcomposite-egl.pro index c8734084b0c..83bd4fe8d84 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-egl/xcomposite-egl.pro +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-egl/xcomposite-egl.pro @@ -11,5 +11,5 @@ SOURCES += \ main.cpp PLUGIN_TYPE = wayland-graphics-integration-client -PLUGIN_CLASS_NAME = QWaylandXCompositeEglClientBufferIntegrationPlugin +PLUGIN_CLASS_NAME = QWaylandXCompositeEglClientBufferPlugin load(qt_plugin) diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-glx/main.cpp b/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-glx/main.cpp index 00fa255b52e..f7b878d96c2 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-glx/main.cpp +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-glx/main.cpp @@ -44,7 +44,7 @@ QT_BEGIN_NAMESPACE namespace QtWaylandClient { -class QWaylandXCompositeGlxClientBufferIntegrationPlugin : public QWaylandClientBufferIntegrationPlugin +class QWaylandXCompositeGlxClientBufferPlugin : public QWaylandClientBufferIntegrationPlugin { Q_OBJECT Q_PLUGIN_METADATA(IID QWaylandClientBufferIntegrationFactoryInterface_iid FILE "xcomposite-glx.json") @@ -52,7 +52,7 @@ public: QWaylandClientBufferIntegration *create(const QString&, const QStringList&) override; }; -QWaylandClientBufferIntegration *QWaylandXCompositeGlxClientBufferIntegrationPlugin::create(const QString& system, const QStringList& paramList) +QWaylandClientBufferIntegration *QWaylandXCompositeGlxClientBufferPlugin::create(const QString& system, const QStringList& paramList) { Q_UNUSED(paramList); Q_UNUSED(system); diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-glx/xcomposite-glx.pro b/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-glx/xcomposite-glx.pro index fb5ad15f84a..804ca386197 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-glx/xcomposite-glx.pro +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-glx/xcomposite-glx.pro @@ -8,5 +8,5 @@ SOURCES += \ main.cpp PLUGIN_TYPE = wayland-graphics-integration-client -PLUGIN_CLASS_NAME = QWaylandXCompositeGlxClientBufferIntegrationPlugin +PLUGIN_CLASS_NAME = QWaylandXCompositeGlxClientBufferPlugin load(qt_plugin) From 83f3b32872ee2f1ae6e5071a34bb4e9af684c773 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 9 Feb 2017 19:33:33 +0100 Subject: [PATCH 0407/1507] fix typos in "Raspberry Pi" Change-Id: I92938ad834999ceabe0b360ab733a2c54335004c Reviewed-by: Laszlo Agocs --- src/plugins/platforms/wayland/configure.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/configure.json b/src/plugins/platforms/wayland/configure.json index b2a8fbc0b3e..ea0bbe22ccc 100644 --- a/src/plugins/platforms/wayland/configure.json +++ b/src/plugins/platforms/wayland/configure.json @@ -82,7 +82,7 @@ "output": [ "privateFeature" ] }, "wayland-brcm": { - "label": "Rasberry Pi", + "label": "Raspberry Pi", "condition": "features.wayland-client && features.eglfs_brcm", "output": [ "privateFeature" ] }, From efce1fa6e4fce96266dfd3d336ed21135f2ec53b Mon Sep 17 00:00:00 2001 From: Giulio Camuffo Date: Fri, 3 Feb 2017 17:04:03 +0100 Subject: [PATCH 0408/1507] Fix crash when running without shell integration Change-Id: Ia480913fd9986cbd306858d1fb497e1fb70551f0 Reviewed-by: Jan Arne Petersen Reviewed-by: Pier Luigi Fiorini --- src/plugins/platforms/wayland/qwaylanddisplay.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index 851d715b77f..8e4c8d67c83 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -421,7 +421,14 @@ void QWaylandDisplay::handleKeyboardFocusChanged(QWaylandInputDevice *inputDevic if (mLastKeyboardFocus == keyboardFocus) return; - mWaylandIntegration->mShellIntegration->handleKeyboardFocusChanged(keyboardFocus, mLastKeyboardFocus); + if (mWaylandIntegration->mShellIntegration) { + mWaylandIntegration->mShellIntegration->handleKeyboardFocusChanged(keyboardFocus, mLastKeyboardFocus); + } else { + if (keyboardFocus) + handleWindowActivated(keyboardFocus); + if (mLastKeyboardFocus) + handleWindowDeactivated(mLastKeyboardFocus); + } mLastKeyboardFocus = keyboardFocus; } From b109d2e848136673ced915627bbb62ee14da8a6c Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Wed, 1 Feb 2017 15:25:13 +0100 Subject: [PATCH 0409/1507] Initialize the first wl_surface in the constructor of QWaylandWindow This makes it possible to get a pointer to a wl_surface immediately after platform window creation. Task-number: QTBUG-58423 Change-Id: I2e62380af8b34d05ae31baacc071766493633022 Reviewed-by: Marco Martin Reviewed-by: Giulio Camuffo --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 8 +++++++- src/plugins/platforms/wayland/qwaylandwindow_p.h | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 58848096aab..83e5f7c7a66 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -95,6 +95,7 @@ QWaylandWindow::QWaylandWindow(QWindow *window) { static WId id = 1; mWindowId = id++; + initializeWlSurface(); } QWaylandWindow::~QWaylandWindow() @@ -127,7 +128,7 @@ void QWaylandWindow::initWindow() return; if (!isInitialized()) - init(mDisplay->createSurface(static_cast(this))); + initializeWlSurface(); if (shouldCreateSubSurface()) { Q_ASSERT(!mSubSurfaceWindow); @@ -200,6 +201,11 @@ void QWaylandWindow::initWindow() mFlags = window()->flags(); } +void QWaylandWindow::initializeWlSurface() +{ + init(mDisplay->createSurface(static_cast(this))); +} + bool QWaylandWindow::shouldCreateShellSurface() const { if (shouldCreateSubSurface()) diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index d5d6e3a315f..ce1a07604e0 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -248,6 +248,7 @@ private: bool setWindowStateInternal(Qt::WindowState flags); void setGeometry_helper(const QRect &rect); void initWindow(); + void initializeWlSurface(); bool shouldCreateShellSurface() const; bool shouldCreateSubSurface() const; void reset(); From d4b15affa18794705fd8e661d4f48b1328d4ec41 Mon Sep 17 00:00:00 2001 From: Pier Luigi Fiorini Date: Wed, 4 Jan 2017 20:04:43 +0100 Subject: [PATCH 0410/1507] client: Set screen product information Set QScreen manufacturer and model and set name to the output name rather than the model. Change-Id: I53dfb12d7d992d517885a2c6e9b95abcc57d5117 Reviewed-by: Jan Arne Petersen Reviewed-by: Giulio Camuffo --- .../platforms/wayland/qwaylandscreen.cpp | 17 +++++++++++++---- .../platforms/wayland/qwaylandscreen_p.h | 5 +++++ 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandscreen.cpp b/src/plugins/platforms/wayland/qwaylandscreen.cpp index 31d21a1c34e..e3d9e739498 100644 --- a/src/plugins/platforms/wayland/qwaylandscreen.cpp +++ b/src/plugins/platforms/wayland/qwaylandscreen.cpp @@ -89,6 +89,16 @@ QWaylandDisplay * QWaylandScreen::display() const return mWaylandDisplay; } +QString QWaylandScreen::manufacturer() const +{ + return mManufacturer; +} + +QString QWaylandScreen::model() const +{ + return mModel; +} + QRect QWaylandScreen::geometry() const { // Scale geometry for QScreen. This makes window and screen @@ -197,13 +207,12 @@ void QWaylandScreen::output_geometry(int32_t x, int32_t y, int32_t transform) { Q_UNUSED(subpixel); - Q_UNUSED(make); + + mManufacturer = make; + mModel = model; mTransform = transform; - if (!model.isEmpty()) - mOutputName = model; - mPhysicalSize = QSize(width, height); mGeometry.moveTopLeft(QPoint(x, y)); } diff --git a/src/plugins/platforms/wayland/qwaylandscreen_p.h b/src/plugins/platforms/wayland/qwaylandscreen_p.h index b2900a964f1..f5da2194c4a 100644 --- a/src/plugins/platforms/wayland/qwaylandscreen_p.h +++ b/src/plugins/platforms/wayland/qwaylandscreen_p.h @@ -72,6 +72,9 @@ public: void init(); QWaylandDisplay *display() const; + QString manufacturer() const override; + QString model() const override; + QRect geometry() const override; int depth() const override; QImage::Format format() const override; @@ -113,6 +116,8 @@ private: int m_outputId; QWaylandDisplay *mWaylandDisplay; + QString mManufacturer; + QString mModel; QRect mGeometry; int mScale; int mDepth; From 44577f8cfb4cebd0d2b205fc04cb2326d7a4e9d3 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Wed, 1 Mar 2017 14:20:37 +0100 Subject: [PATCH 0411/1507] Remove QRegularExpression dependency Fix build error with -no-feature-regularexpression. Change-Id: I6d3d0228548d832abea74b8e1145dc5b09f77b1b Reviewed-by: Jan Arne Petersen Reviewed-by: Giulio Camuffo Reviewed-by: Pier Luigi Fiorini --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index a42c4796deb..dec4d1157dc 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -160,7 +160,9 @@ void QWaylandWindow::initWindow() // when available. if (!QGuiApplication::desktopFileName().isEmpty()) { QString name = QGuiApplication::desktopFileName(); - mShellSurface->setAppId(name.replace(QRegularExpression(QLatin1String("\\.desktop$")), QString())); + if (name.endsWith(QLatin1String(".desktop"))) + name.chop(8); + mShellSurface->setAppId(name); } else { QFileInfo fi = QCoreApplication::instance()->applicationFilePath(); QStringList domainName = From 501aeedb54c312c9e3890a393138c55d400f4405 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Mon, 6 Mar 2017 13:19:15 +0100 Subject: [PATCH 0412/1507] Code cleanup (fixing -no-feature-cursor) Move QWaylandDisplay member functions into the correct .cpp file. Change-Id: Ie3915d2bd0d191900ad2fd306564bb732e40221a Reviewed-by: Johan Helsing Reviewed-by: Pier Luigi Fiorini --- .../platforms/wayland/qwaylandcursor.cpp | 25 ----------------- .../platforms/wayland/qwaylanddisplay.cpp | 27 +++++++++++++++++++ .../platforms/wayland/qwaylanddisplay_p.h | 4 +-- 3 files changed, 29 insertions(+), 27 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandcursor.cpp b/src/plugins/platforms/wayland/qwaylandcursor.cpp index e3e3469be3c..7caa247e52f 100644 --- a/src/plugins/platforms/wayland/qwaylandcursor.cpp +++ b/src/plugins/platforms/wayland/qwaylandcursor.cpp @@ -143,31 +143,6 @@ void QWaylandCursor::changeCursor(QCursor *cursor, QWindow *window) mDisplay->setCursor(buffer, image); } -void QWaylandDisplay::setCursor(struct wl_buffer *buffer, struct wl_cursor_image *image) -{ - /* Qt doesn't tell us which input device we should set the cursor - * for, so set it for all devices. */ - for (int i = 0; i < mInputDevices.count(); i++) { - QWaylandInputDevice *inputDevice = mInputDevices.at(i); - inputDevice->setCursor(buffer, image); - } -} - -void QWaylandDisplay::setCursor(const QSharedPointer &buffer, const QPoint &hotSpot) -{ - /* Qt doesn't tell us which input device we should set the cursor - * for, so set it for all devices. */ - for (int i = 0; i < mInputDevices.count(); i++) { - QWaylandInputDevice *inputDevice = mInputDevices.at(i); - inputDevice->setCursor(buffer, hotSpot); - } -} - -QWaylandInputDevice *QWaylandDisplay::defaultInputDevice() const -{ - return mInputDevices.isEmpty() ? 0 : mInputDevices.first(); -} - void QWaylandCursor::pointerEvent(const QMouseEvent &event) { mLastPos = event.globalPos(); diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index 8e4c8d67c83..83a69483f50 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -468,6 +468,33 @@ void QWaylandDisplay::requestWaylandSync() wl_callback_add_listener(mSyncCallback, &syncCallbackListener, this); } +QWaylandInputDevice *QWaylandDisplay::defaultInputDevice() const +{ + return mInputDevices.isEmpty() ? 0 : mInputDevices.first(); +} + +#if QT_CONFIG(cursor) +void QWaylandDisplay::setCursor(struct wl_buffer *buffer, struct wl_cursor_image *image) +{ + /* Qt doesn't tell us which input device we should set the cursor + * for, so set it for all devices. */ + for (int i = 0; i < mInputDevices.count(); i++) { + QWaylandInputDevice *inputDevice = mInputDevices.at(i); + inputDevice->setCursor(buffer, image); + } +} + +void QWaylandDisplay::setCursor(const QSharedPointer &buffer, const QPoint &hotSpot) +{ + /* Qt doesn't tell us which input device we should set the cursor + * for, so set it for all devices. */ + for (int i = 0; i < mInputDevices.count(); i++) { + QWaylandInputDevice *inputDevice = mInputDevices.at(i); + inputDevice->setCursor(buffer, hotSpot); + } +} +#endif // QT_CONFIG(cursor) + } QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylanddisplay_p.h b/src/plugins/platforms/wayland/qwaylanddisplay_p.h index e96a89176ba..9268d9f1e67 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay_p.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay_p.h @@ -123,10 +123,10 @@ public: QWaylandClientBufferIntegration *clientBufferIntegration() const; QWaylandWindowManagerIntegration *windowManagerIntegration() const; - +#if QT_CONFIG(cursor) void setCursor(struct wl_buffer *buffer, struct wl_cursor_image *image); void setCursor(const QSharedPointer &buffer, const QPoint &hotSpot); - +#endif struct wl_display *wl_display() const { return mDisplay; } struct ::wl_registry *wl_registry() { return object(); } From 4e319b514165882d95a5ce8ecb9dc639f0e274e3 Mon Sep 17 00:00:00 2001 From: Giulio Camuffo Date: Wed, 1 Mar 2017 12:12:55 +0100 Subject: [PATCH 0413/1507] Fix build when xkbcommon is disabled Change-Id: I0ec7a5aa8300e796b015c0d995e71ebf77727bbd Task-number: QTBUG-58839 Reviewed-by: Jan Arne Petersen Reviewed-by: Yong Bakos Reviewed-by: Paul Olav Tvete --- .../platforms/wayland/shared/qwaylandxkb.cpp | 18 ++++++++++++++++++ .../platforms/wayland/shared/qwaylandxkb_p.h | 7 +++++++ 2 files changed, 25 insertions(+) diff --git a/src/plugins/platforms/wayland/shared/qwaylandxkb.cpp b/src/plugins/platforms/wayland/shared/qwaylandxkb.cpp index 3e04467deb3..a0e388a1c9b 100644 --- a/src/plugins/platforms/wayland/shared/qwaylandxkb.cpp +++ b/src/plugins/platforms/wayland/shared/qwaylandxkb.cpp @@ -43,10 +43,13 @@ #include #include +#if QT_CONFIG(xkbcommon_evdev) #include +#endif QT_BEGIN_NAMESPACE +#if QT_CONFIG(xkbcommon_evdev) static const uint32_t KeyTbl[] = { XKB_KEY_Escape, Qt::Key_Escape, XKB_KEY_Tab, Qt::Key_Tab, @@ -290,9 +293,11 @@ static xkb_keysym_t toKeysymFromTable(uint32_t key) return 0; } +#endif std::pair QWaylandXkb::keysymToQtKey(xkb_keysym_t keysym, Qt::KeyboardModifiers &modifiers) { +#if QT_CONFIG(xkbcommon_evdev) QString text; uint utf32 = xkb_keysym_to_utf32(keysym); if (utf32) @@ -326,10 +331,15 @@ std::pair QWaylandXkb::keysymToQtKey(xkb_keysym_t keysym, Qt::Keyb } return { code, text }; +#else + Q_UNUSED(modifiers) + return { keysym, "" }; +#endif } Qt::KeyboardModifiers QWaylandXkb::modifiers(struct xkb_state *state) { +#if QT_CONFIG(xkbcommon_evdev) Qt::KeyboardModifiers modifiers = Qt::NoModifier; xkb_state_component cstate = static_cast(XKB_STATE_DEPRESSED | XKB_STATE_LATCHED | XKB_STATE_LOCKED); @@ -344,6 +354,10 @@ Qt::KeyboardModifiers QWaylandXkb::modifiers(struct xkb_state *state) modifiers |= Qt::MetaModifier; return modifiers; +#else + Q_UNUSED(state) + return Qt::NoModifier; +#endif } QEvent::Type QWaylandXkb::toQtEventType(uint32_t state) @@ -353,6 +367,7 @@ QEvent::Type QWaylandXkb::toQtEventType(uint32_t state) QVector QWaylandXkb::toKeysym(QKeyEvent *event) { +#if QT_CONFIG(xkbcommon_evdev) QVector keysyms; if (event->key() >= Qt::Key_F1 && event->key() <= Qt::Key_F35) { keysyms.append(XKB_KEY_F1 + (event->key() - Qt::Key_F1)); @@ -372,6 +387,9 @@ QVector QWaylandXkb::toKeysym(QKeyEvent *event) keysyms.append(toKeysymFromTable(event->key())); } return keysyms; +#else + return QVector() << event->nativeScanCode(); +#endif } QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/shared/qwaylandxkb_p.h b/src/plugins/platforms/wayland/shared/qwaylandxkb_p.h index 230159fbb77..6fa1ea45b8e 100644 --- a/src/plugins/platforms/wayland/shared/qwaylandxkb_p.h +++ b/src/plugins/platforms/wayland/shared/qwaylandxkb_p.h @@ -41,9 +41,16 @@ #ifndef QWAYLANDXKB_H #define QWAYLANDXKB_H +#include #include #include + +#if QT_CONFIG(xkbcommon_evdev) #include +#else +typedef quint32 xkb_keysym_t; +struct xkb_state; +#endif #include From 2c24b007332ad8304a0ada5aff2073fe95c83724 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Thu, 9 Mar 2017 10:35:39 +0100 Subject: [PATCH 0414/1507] Temporary change to prepare for qtbase change QPlatformDrag::platformDropData() will be removed in qtbase. By removing the 'override' specifier, we make sure that qtwayland will compile with both versions, so we can get the changes through the CI system. Change-Id: I8f5f3252ecc5125e5dab3f7a4da8760fe259b739 Reviewed-by: Albert Astals Cid Reviewed-by: Lars Knoll --- src/plugins/platforms/wayland/qwaylanddnd_p.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylanddnd_p.h b/src/plugins/platforms/wayland/qwaylanddnd_p.h index 2a99432c59d..6d87c75d78a 100644 --- a/src/plugins/platforms/wayland/qwaylanddnd_p.h +++ b/src/plugins/platforms/wayland/qwaylanddnd_p.h @@ -71,7 +71,7 @@ public: QWaylandDrag(QWaylandDisplay *display); ~QWaylandDrag(); - QMimeData *platformDropData() override; + QMimeData *platformDropData(); void updateTarget(const QString &mimeType); void setResponse(const QPlatformDragQtResponse &response); From 697e074e2c359e60d2fade0a7f53a9d792edbfff Mon Sep 17 00:00:00 2001 From: Albert Astals Cid Date: Wed, 1 Mar 2017 09:27:17 +0100 Subject: [PATCH 0415/1507] Remove platformDropData() that is removed from QPlatformDrag Change-Id: I12321852027279d8b34d2e231253dfd858167a15 Reviewed-by: Jan Arne Petersen Reviewed-by: Paul Olav Tvete --- src/plugins/platforms/wayland/qwaylanddnd.cpp | 7 ------- src/plugins/platforms/wayland/qwaylanddnd_p.h | 2 -- 2 files changed, 9 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylanddnd.cpp b/src/plugins/platforms/wayland/qwaylanddnd.cpp index 54c075c4a3b..fe620506d52 100644 --- a/src/plugins/platforms/wayland/qwaylanddnd.cpp +++ b/src/plugins/platforms/wayland/qwaylanddnd.cpp @@ -62,13 +62,6 @@ QWaylandDrag::~QWaylandDrag() { } -QMimeData * QWaylandDrag::platformDropData() -{ - if (drag()) - return drag()->mimeData(); - return 0; -} - void QWaylandDrag::startDrag() { QBasicDrag::startDrag(); diff --git a/src/plugins/platforms/wayland/qwaylanddnd_p.h b/src/plugins/platforms/wayland/qwaylanddnd_p.h index 6d87c75d78a..8a1d7f1f1ef 100644 --- a/src/plugins/platforms/wayland/qwaylanddnd_p.h +++ b/src/plugins/platforms/wayland/qwaylanddnd_p.h @@ -71,8 +71,6 @@ public: QWaylandDrag(QWaylandDisplay *display); ~QWaylandDrag(); - QMimeData *platformDropData(); - void updateTarget(const QString &mimeType); void setResponse(const QPlatformDragQtResponse &response); void finishDrag(const QPlatformDropQtResponse &response); From a74c82edb4b64e265eb1eb1e90de4473686c0510 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Mon, 20 Mar 2017 11:07:05 +0100 Subject: [PATCH 0416/1507] Prepare for qtbase change The signature of setWindowState is changing. Remove the 'override' so qtwayland compiles without error against both the new and the old version. Task-number: QTBUG-59588 Change-Id: I2adc6a5a1addc9b8855a3a1b3c1f0e3952181846 Reviewed-by: Liang Qi --- src/plugins/platforms/wayland/qwaylandwindow_p.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index e67cf0afe9d..b9ca5ee0e3a 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -148,7 +148,7 @@ public: void handleContentOrientationChange(Qt::ScreenOrientation orientation) override; void setOrientationMask(Qt::ScreenOrientations mask); - void setWindowState(Qt::WindowState state) override; + void setWindowState(Qt::WindowState state); // ### Change to WindowStates once qtbase change is in void setWindowFlags(Qt::WindowFlags flags) override; void raise() override; From 086b0a9a268d4cdd6bd0229cd00fc735cdee10af Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Thu, 16 Mar 2017 13:59:20 +0100 Subject: [PATCH 0417/1507] Clean up draganddrop and clipboard features Don't assume that no-draganddrop implies no-clipboard. Introduce a new private feature wayland-datadevice which contains the common functionality. This feature cannot be controlled independently, but is automatically disabled when both clipboard and draganddrop are disabled. Change-Id: I6aac09c7ee524e3b11f0a1caa4a6c62fc3f1d10f Reviewed-by: Oswald Buddenhagen Reviewed-by: Johan Helsing --- src/plugins/platforms/wayland/client.pro | 26 ++++++++++++------- src/plugins/platforms/wayland/configure.json | 4 +++ .../platforms/wayland/qwaylandclipboard.cpp | 4 --- .../platforms/wayland/qwaylandclipboard_p.h | 5 ++-- .../platforms/wayland/qwaylanddatadevice.cpp | 10 ++++--- .../platforms/wayland/qwaylanddatadevice_p.h | 16 +++++++++--- .../wayland/qwaylanddatadevicemanager.cpp | 4 --- .../wayland/qwaylanddatadevicemanager_p.h | 6 ++--- .../platforms/wayland/qwaylanddataoffer.cpp | 4 --- .../platforms/wayland/qwaylanddataoffer_p.h | 6 ++--- .../platforms/wayland/qwaylanddatasource.cpp | 4 --- .../platforms/wayland/qwaylanddatasource_p.h | 6 ++--- .../platforms/wayland/qwaylanddisplay.cpp | 8 +++--- .../platforms/wayland/qwaylanddisplay_p.h | 6 ++--- .../platforms/wayland/qwaylandinputdevice.cpp | 8 +++++- .../platforms/wayland/qwaylandinputdevice_p.h | 4 +++ .../platforms/wayland/qwaylandwindow.cpp | 8 ++++-- 17 files changed, 72 insertions(+), 57 deletions(-) diff --git a/src/plugins/platforms/wayland/client.pro b/src/plugins/platforms/wayland/client.pro index 824c715b05c..015bfcd4bcb 100644 --- a/src/plugins/platforms/wayland/client.pro +++ b/src/plugins/platforms/wayland/client.pro @@ -40,9 +40,6 @@ SOURCES += qwaylandintegration.cpp \ qwaylandwindow.cpp \ qwaylandscreen.cpp \ qwaylandshmwindow.cpp \ - qwaylanddataoffer.cpp \ - qwaylanddatadevicemanager.cpp \ - qwaylanddatasource.cpp \ qwaylandshellsurface.cpp \ qwaylandwlshellsurface.cpp \ qwaylandwlshellintegration.cpp \ @@ -76,9 +73,6 @@ HEADERS += qwaylandintegration_p.h \ qwaylandinputdevice_p.h \ qwaylandbuffer_p.h \ qwaylandshmwindow_p.h \ - qwaylanddataoffer_p.h \ - qwaylanddatadevicemanager_p.h \ - qwaylanddatasource_p.h \ qwaylandshellsurface_p.h \ qwaylandwlshellsurface_p.h \ qwaylandwlshellintegration_p.h \ @@ -123,13 +117,25 @@ qtConfig(cursor) { SOURCES += \ qwaylandcursor.cpp } + +qtConfig(wayland-datadevice) { + HEADERS += \ + qwaylanddatadevice_p.h \ + qwaylanddatadevicemanager_p.h \ + qwaylanddataoffer_p.h \ + qwaylanddatasource_p.h + SOURCES += \ + qwaylanddatadevice.cpp \ + qwaylanddatadevicemanager.cpp \ + qwaylanddataoffer.cpp \ + qwaylanddatasource.cpp +} + qtConfig(draganddrop) { HEADERS += \ - qwaylanddnd_p.h \ - qwaylanddatadevice_p.h + qwaylanddnd_p.h SOURCES += \ - qwaylanddnd.cpp \ - qwaylanddatadevice.cpp + qwaylanddnd.cpp } CONFIG += generated_privates diff --git a/src/plugins/platforms/wayland/configure.json b/src/plugins/platforms/wayland/configure.json index ea0bbe22ccc..c29a8b609d8 100644 --- a/src/plugins/platforms/wayland/configure.json +++ b/src/plugins/platforms/wayland/configure.json @@ -76,6 +76,10 @@ "condition": "!config.win32 && libs.wayland-client && libs.wayland-cursor && tests.wayland-scanner", "output": [ "privateFeature" ] }, + "wayland-datadevice": { + "condition": "features.draganddrop || features.clipboard", + "output": [ "privateFeature" ] + }, "wayland-egl": { "label": "EGL", "condition": "features.wayland-client && features.opengl && features.egl && libs.wayland-egl", diff --git a/src/plugins/platforms/wayland/qwaylandclipboard.cpp b/src/plugins/platforms/wayland/qwaylandclipboard.cpp index 68fb737ccb0..5da1202687e 100644 --- a/src/plugins/platforms/wayland/qwaylandclipboard.cpp +++ b/src/plugins/platforms/wayland/qwaylandclipboard.cpp @@ -44,8 +44,6 @@ #include "qwaylanddatasource_p.h" #include "qwaylanddatadevice_p.h" -#if QT_CONFIG(draganddrop) - QT_BEGIN_NAMESPACE namespace QtWaylandClient { @@ -117,5 +115,3 @@ bool QWaylandClipboard::ownsMode(QClipboard::Mode mode) const } QT_END_NAMESPACE - -#endif // draganddrop diff --git a/src/plugins/platforms/wayland/qwaylandclipboard_p.h b/src/plugins/platforms/wayland/qwaylandclipboard_p.h index 211a969420b..28336202241 100644 --- a/src/plugins/platforms/wayland/qwaylandclipboard_p.h +++ b/src/plugins/platforms/wayland/qwaylandclipboard_p.h @@ -57,7 +57,8 @@ #include -#if QT_CONFIG(draganddrop) +QT_REQUIRE_CONFIG(clipboard); + QT_BEGIN_NAMESPACE namespace QtWaylandClient { @@ -85,6 +86,4 @@ private: QT_END_NAMESPACE -#endif // draganddrop - #endif // QWAYLANDCLIPBOARD_H diff --git a/src/plugins/platforms/wayland/qwaylanddatadevice.cpp b/src/plugins/platforms/wayland/qwaylanddatadevice.cpp index ebd3ce1bff1..33068c5e97a 100644 --- a/src/plugins/platforms/wayland/qwaylanddatadevice.cpp +++ b/src/plugins/platforms/wayland/qwaylanddatadevice.cpp @@ -58,8 +58,6 @@ #include #include -#if QT_CONFIG(draganddrop) - QT_BEGIN_NAMESPACE namespace QtWaylandClient { @@ -103,6 +101,7 @@ void QWaylandDataDevice::setSelectionSource(QWaylandDataSource *source) m_selectionSource.reset(source); } +#if QT_CONFIG(draganddrop) QWaylandDataOffer *QWaylandDataDevice::dragOffer() const { return m_dragOffer.data(); @@ -124,12 +123,14 @@ void QWaylandDataDevice::cancelDrag() { m_dragSource.reset(); } +#endif void QWaylandDataDevice::data_device_data_offer(struct ::wl_data_offer *id) { new QWaylandDataOffer(m_display, id); } +#if QT_CONFIG(draganddrop) void QWaylandDataDevice::data_device_drop() { QDrag *drag = static_cast(QGuiApplicationPrivate::platformIntegration()->drag())->currentDrag(); @@ -229,6 +230,7 @@ void QWaylandDataDevice::data_device_motion(uint32_t time, wl_fixed_t x, wl_fixe wl_data_offer_accept(m_dragOffer->object(), m_enterSerial, 0); } } +#endif // QT_CONFIG(draganddrop) void QWaylandDataDevice::data_device_selection(wl_data_offer *id) { @@ -250,6 +252,7 @@ void QWaylandDataDevice::selectionSourceCancelled() #endif } +#if QT_CONFIG(draganddrop) void QWaylandDataDevice::dragSourceCancelled() { m_dragSource.reset(); @@ -272,9 +275,8 @@ QPoint QWaylandDataDevice::calculateDragPosition(int x, int y, QWindow *wnd) con } return pnt; } +#endif // QT_CONFIG(draganddrop) } QT_END_NAMESPACE - -#endif // draganddrop diff --git a/src/plugins/platforms/wayland/qwaylanddatadevice_p.h b/src/plugins/platforms/wayland/qwaylanddatadevice_p.h index 1ec8761b913..7fb0003b4dd 100644 --- a/src/plugins/platforms/wayland/qwaylanddatadevice_p.h +++ b/src/plugins/platforms/wayland/qwaylanddatadevice_p.h @@ -52,14 +52,14 @@ // We mean it. // -#include +#include #include #include #include #include -#if QT_CONFIG(draganddrop) +QT_REQUIRE_CONFIG(wayland_datadevice); QT_BEGIN_NAMESPACE @@ -87,25 +87,35 @@ public: QWaylandDataSource *selectionSource() const; void setSelectionSource(QWaylandDataSource *source); +#if QT_CONFIG(draganddrop) QWaylandDataOffer *dragOffer() const; void startDrag(QMimeData *mimeData, QWaylandWindow *icon); void cancelDrag(); +#endif protected: void data_device_data_offer(struct ::wl_data_offer *id) override; + +#if QT_CONFIG(draganddrop) void data_device_drop() override; void data_device_enter(uint32_t serial, struct ::wl_surface *surface, wl_fixed_t x, wl_fixed_t y, struct ::wl_data_offer *id) override; void data_device_leave() override; void data_device_motion(uint32_t time, wl_fixed_t x, wl_fixed_t y) override; +#endif void data_device_selection(struct ::wl_data_offer *id) override; private Q_SLOTS: void selectionSourceCancelled(); + +#if QT_CONFIG(draganddrop) void dragSourceCancelled(); void dragSourceTargetChanged(const QString &mimeType); +#endif private: +#if QT_CONFIG(draganddrop) QPoint calculateDragPosition(int x, int y, QWindow *wnd) const; +#endif QWaylandDisplay *m_display; QWaylandInputDevice *m_inputDevice; @@ -123,6 +133,4 @@ private: QT_END_NAMESPACE -#endif // draganddrop - #endif // QWAYLANDDATADEVICE_H diff --git a/src/plugins/platforms/wayland/qwaylanddatadevicemanager.cpp b/src/plugins/platforms/wayland/qwaylanddatadevicemanager.cpp index c398b86fd5f..35d67307fc3 100644 --- a/src/plugins/platforms/wayland/qwaylanddatadevicemanager.cpp +++ b/src/plugins/platforms/wayland/qwaylanddatadevicemanager.cpp @@ -46,8 +46,6 @@ #include -#if QT_CONFIG(draganddrop) - QT_BEGIN_NAMESPACE namespace QtWaylandClient { @@ -82,5 +80,3 @@ QWaylandDisplay *QWaylandDataDeviceManager::display() const } QT_END_NAMESPACE - -#endif // draganddrop diff --git a/src/plugins/platforms/wayland/qwaylanddatadevicemanager_p.h b/src/plugins/platforms/wayland/qwaylanddatadevicemanager_p.h index e7fc2113a35..3daf780aaa9 100644 --- a/src/plugins/platforms/wayland/qwaylanddatadevicemanager_p.h +++ b/src/plugins/platforms/wayland/qwaylanddatadevicemanager_p.h @@ -51,10 +51,10 @@ // We mean it. // -#include +#include #include -#if QT_CONFIG(draganddrop) +QT_REQUIRE_CONFIG(wayland_datadevice); QT_BEGIN_NAMESPACE @@ -83,6 +83,4 @@ private: QT_END_NAMESPACE -#endif // draganddrop - #endif // QWAYLANDDATADEVICEMANAGER_H diff --git a/src/plugins/platforms/wayland/qwaylanddataoffer.cpp b/src/plugins/platforms/wayland/qwaylanddataoffer.cpp index 56a18f007d3..2491c658b12 100644 --- a/src/plugins/platforms/wayland/qwaylanddataoffer.cpp +++ b/src/plugins/platforms/wayland/qwaylanddataoffer.cpp @@ -47,8 +47,6 @@ #include -#if QT_CONFIG(draganddrop) - QT_BEGIN_NAMESPACE namespace QtWaylandClient { @@ -183,5 +181,3 @@ int QWaylandMimeData::readData(int fd, QByteArray &data) const } QT_END_NAMESPACE - -#endif // draganddrop diff --git a/src/plugins/platforms/wayland/qwaylanddataoffer_p.h b/src/plugins/platforms/wayland/qwaylanddataoffer_p.h index c7520f3e55c..c9b9c21f17d 100644 --- a/src/plugins/platforms/wayland/qwaylanddataoffer_p.h +++ b/src/plugins/platforms/wayland/qwaylanddataoffer_p.h @@ -53,10 +53,11 @@ #include -#include +#include #include -#if QT_CONFIG(draganddrop) +QT_REQUIRE_CONFIG(wayland_datadevice); + QT_BEGIN_NAMESPACE namespace QtWaylandClient { @@ -106,5 +107,4 @@ private: } QT_END_NAMESPACE -#endif // draganddrop #endif diff --git a/src/plugins/platforms/wayland/qwaylanddatasource.cpp b/src/plugins/platforms/wayland/qwaylanddatasource.cpp index c61de181ba6..0c6ad50e4b7 100644 --- a/src/plugins/platforms/wayland/qwaylanddatasource.cpp +++ b/src/plugins/platforms/wayland/qwaylanddatasource.cpp @@ -50,8 +50,6 @@ #include #include -#if QT_CONFIG(draganddrop) - QT_BEGIN_NAMESPACE namespace QtWaylandClient { @@ -108,5 +106,3 @@ void QWaylandDataSource::data_source_target(const QString &mime_type) } QT_END_NAMESPACE - -#endif // draganddrop diff --git a/src/plugins/platforms/wayland/qwaylanddatasource_p.h b/src/plugins/platforms/wayland/qwaylanddatasource_p.h index 0221304c80d..bba003f561b 100644 --- a/src/plugins/platforms/wayland/qwaylanddatasource_p.h +++ b/src/plugins/platforms/wayland/qwaylanddatasource_p.h @@ -54,9 +54,9 @@ #include #include -#include +#include -#if QT_CONFIG(draganddrop) +QT_REQUIRE_CONFIG(wayland_datadevice); QT_BEGIN_NAMESPACE @@ -94,6 +94,4 @@ private: QT_END_NAMESPACE -#endif // draganddrop - #endif // QWAYLANDDATASOURCE_H diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index 83a69483f50..86cfe1a0d6c 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -47,7 +47,9 @@ #if QT_CONFIG(clipboard) #include "qwaylandclipboard_p.h" #endif +#if QT_CONFIG(wayland_datadevice) #include "qwaylanddatadevicemanager_p.h" +#endif #include "qwaylandhardwareintegration_p.h" #include "qwaylandxdgshell_p.h" #include "qwaylandxdgsurface_p.h" @@ -122,7 +124,7 @@ QWaylandWindowManagerIntegration *QWaylandDisplay::windowManagerIntegration() co QWaylandDisplay::QWaylandDisplay(QWaylandIntegration *waylandIntegration) : mWaylandIntegration(waylandIntegration) -#if QT_CONFIG(draganddrop) +#if QT_CONFIG(wayland_datadevice) , mDndSelectionHandler(0) #endif , mWindowExtension(0) @@ -162,7 +164,7 @@ QWaylandDisplay::~QWaylandDisplay(void) mWaylandIntegration->destroyScreen(screen); } mScreens.clear(); -#if QT_CONFIG(draganddrop) +#if QT_CONFIG(wayland_datadevice) delete mDndSelectionHandler.take(); #endif wl_display_disconnect(mDisplay); @@ -257,7 +259,7 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin } else if (interface == QStringLiteral("wl_seat")) { QWaylandInputDevice *inputDevice = mWaylandIntegration->createInputDevice(this, version, id); mInputDevices.append(inputDevice); -#if QT_CONFIG(draganddrop) +#if QT_CONFIG(wayland_datadevice) } else if (interface == QStringLiteral("wl_data_device_manager")) { mDndSelectionHandler.reset(new QWaylandDataDeviceManager(this, id)); #endif diff --git a/src/plugins/platforms/wayland/qwaylanddisplay_p.h b/src/plugins/platforms/wayland/qwaylanddisplay_p.h index 9268d9f1e67..35d861760e5 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay_p.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay_p.h @@ -61,7 +61,7 @@ #include #include -#include +#include #include #include @@ -137,7 +137,7 @@ public: QList inputDevices() const { return mInputDevices; } QWaylandInputDevice *defaultInputDevice() const; QWaylandInputDevice *currentInputDevice() const { return defaultInputDevice(); } -#if QT_CONFIG(draganddrop) +#if QT_CONFIG(wayland_datadevice) QWaylandDataDeviceManager *dndSelectionHandler() const { return mDndSelectionHandler.data(); } #endif QtWayland::qt_surface_extension *windowExtension() const { return mWindowExtension.data(); } @@ -202,7 +202,7 @@ private: QList mInputDevices; QList mRegistryListeners; QWaylandIntegration *mWaylandIntegration; -#if QT_CONFIG(draganddrop) +#if QT_CONFIG(wayland_datadevice) QScopedPointer mDndSelectionHandler; #endif QScopedPointer mWindowExtension; diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index fb22c95e673..b0c6394e2b0 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -42,8 +42,10 @@ #include "qwaylandintegration_p.h" #include "qwaylandwindow_p.h" #include "qwaylandbuffer_p.h" +#if QT_CONFIG(wayland_datadevice) #include "qwaylanddatadevice_p.h" #include "qwaylanddatadevicemanager_p.h" +#endif #include "qwaylandtouch_p.h" #include "qwaylandscreen_p.h" #include "qwaylandcursor_p.h" @@ -187,7 +189,9 @@ QWaylandInputDevice::QWaylandInputDevice(QWaylandDisplay *display, int version, , mDisplay(display->wl_display()) , mVersion(qMin(version, 4)) , mCaps(0) +#if QT_CONFIG(wayland_datadevice) , mDataDevice(0) +#endif , mKeyboard(0) , mPointer(0) , mTouch(0) @@ -196,7 +200,7 @@ QWaylandInputDevice::QWaylandInputDevice(QWaylandDisplay *display, int version, , mSerial(0) , mTouchDevice(0) { -#if QT_CONFIG(draganddrop) +#if QT_CONFIG(wayland_datadevice) if (mQDisplay->dndSelectionHandler()) { mDataDevice = mQDisplay->dndSelectionHandler()->getDataDevice(this); } @@ -286,6 +290,7 @@ void QWaylandInputDevice::handleEndDrag() mPointer->releaseButtons(); } +#if QT_CONFIG(wayland_datadevice) void QWaylandInputDevice::setDataDevice(QWaylandDataDevice *device) { mDataDevice = device; @@ -296,6 +301,7 @@ QWaylandDataDevice *QWaylandInputDevice::dataDevice() const Q_ASSERT(mDataDevice); return mDataDevice; } +#endif void QWaylandInputDevice::setTextInput(QWaylandTextInput *textInput) { diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h index d8bd0062f29..4d0a4759751 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h +++ b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h @@ -111,8 +111,10 @@ public: void handleWindowDestroyed(QWaylandWindow *window); void handleEndDrag(); +#if QT_CONFIG(wayland_datadevice) void setDataDevice(QWaylandDataDevice *device); QWaylandDataDevice *dataDevice() const; +#endif void setTextInput(QWaylandTextInput *textInput); QWaylandTextInput *textInput() const; @@ -143,7 +145,9 @@ private: struct wl_surface *pointerSurface; +#if QT_CONFIG(wayland_datadevice) QWaylandDataDevice *mDataDevice; +#endif Keyboard *mKeyboard; Pointer *mPointer; diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index dec4d1157dc..00fbb00de7f 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -40,7 +40,6 @@ #include "qwaylandwindow_p.h" #include "qwaylandbuffer_p.h" -#include "qwaylanddatadevice_p.h" #include "qwaylanddisplay_p.h" #include "qwaylandinputdevice_p.h" #include "qwaylandscreen_p.h" @@ -54,6 +53,11 @@ #include "qwaylanddecorationfactory_p.h" #include "qwaylandshmbackingstore_p.h" +#if QT_CONFIG(wayland_datadevice) +#include "qwaylanddatadevice_p.h" +#endif + + #include #include #include @@ -825,7 +829,7 @@ void QWaylandWindow::requestActivateWindow() void QWaylandWindow::unfocus() { -#if QT_CONFIG(draganddrop) +#if QT_CONFIG(clipboard) QWaylandInputDevice *inputDevice = mDisplay->currentInputDevice(); if (inputDevice && inputDevice->dataDevice()) { inputDevice->dataDevice()->invalidateSelectionOffer(); From dfb0a833d691e9cbd2935d4666e99dceb2913a5b Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Fri, 24 Mar 2017 09:49:15 +0100 Subject: [PATCH 0418/1507] Doc: Fix external links to wayland-ivi project Seems that the project moved to github. Task-number: QTBUG-59656 Change-Id: Ib6c9c62e987f11ffbcffe013cbeb4a4454e594b0 Reviewed-by: Venugopal Shivashankar --- src/3rdparty/wayland/protocols/qt_attribution.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/3rdparty/wayland/protocols/qt_attribution.json b/src/3rdparty/wayland/protocols/qt_attribution.json index 76fd33d37f9..f35dec4f348 100644 --- a/src/3rdparty/wayland/protocols/qt_attribution.json +++ b/src/3rdparty/wayland/protocols/qt_attribution.json @@ -26,9 +26,9 @@ "Files": "ivi-controller.xml ivi-application.xml", "Description": "\"Wayland IVI Extension\" is forked from IVI Layer Management to define a common set of APIs by wayland style protocol and provide reference implementation which can be loaded on Weston.", - "Homepage": "http://projects.genivi.org/wayland-ivi-extension", + "Homepage": "https://at.projects.genivi.org/wiki/display/WIE/Wayland+IVI+Extension+Home", "Version": "1.9.1", - "DownloadLocation": "http://git.projects.genivi.org/?p=wayland-ivi-extension.git;a=commit;h=44598504503eea5ac7f94c88477a5a78bda01f30", + "DownloadLocation": "https://github.com/GENIVI/wayland-ivi-extension/releases/tag/1.9.1", "LicenseId": "MIT", "License": "MIT License", "LicenseFile": "MIT_LICENSE.txt", From 0dc450ec222aab275b062eb0f9511ca489532769 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Tue, 7 Feb 2017 12:03:43 +0100 Subject: [PATCH 0419/1507] Don't redefine symbols from system libraries The system library versions may contain driver-specific functionality. Change-Id: Iaaa71bff7d2c305cb47798920a5977aaa2a3ac8a Task-number: QTBUG-58299 Reviewed-by: Johan Helsing --- src/plugins/platforms/wayland/client.pro | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/client.pro b/src/plugins/platforms/wayland/client.pro index 015bfcd4bcb..eae7ad52ea2 100644 --- a/src/plugins/platforms/wayland/client.pro +++ b/src/plugins/platforms/wayland/client.pro @@ -23,7 +23,6 @@ QMAKE_USE += wayland-client INCLUDEPATH += $$PWD/../shared WAYLANDCLIENTSOURCES += \ - ../3rdparty/protocol/wayland.xml \ ../extensions/surface-extension.xml \ ../extensions/touch-extension.xml \ ../extensions/qtkey-extension.xml \ @@ -32,6 +31,9 @@ WAYLANDCLIENTSOURCES += \ ../3rdparty/protocol/xdg-shell.xml \ ../3rdparty/protocol/xdg-shell-unstable-v6.xml \ +WAYLANDCLIENTSOURCES_SYSTEM += \ + ../3rdparty/protocol/wayland.xml \ + SOURCES += qwaylandintegration.cpp \ qwaylandnativeinterface.cpp \ qwaylandshmbackingstore.cpp \ From 15b3e52c180786faefb73df50f350854d759e031 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Thu, 9 Feb 2017 08:43:59 +0100 Subject: [PATCH 0420/1507] Adapt to the API change in QPlatformWindow::setWindowState Change-Id: Ic6655f239ea449baf862934608feda182799c42d Reviewed-by: Paul Olav Tvete --- .../platforms/wayland/qwaylandwindow.cpp | 43 ++++++++----------- .../platforms/wayland/qwaylandwindow_p.h | 10 ++--- 2 files changed, 24 insertions(+), 29 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 75c5b2f9dfb..540403bceba 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -195,7 +195,7 @@ void QWaylandWindow::initWindow() else setGeometry_helper(window()->geometry()); setMask(window()->mask()); - setWindowStateInternal(window()->windowState()); + setWindowStateInternal(window()->windowStates()); handleContentOrientationChange(window()->contentOrientation()); mFlags = window()->flags(); } @@ -571,7 +571,7 @@ void QWaylandWindow::setOrientationMask(Qt::ScreenOrientations mask) mShellSurface->setContentOrientationMask(mask); } -void QWaylandWindow::setWindowState(Qt::WindowState state) +void QWaylandWindow::setWindowState(Qt::WindowStates state) { if (setWindowStateInternal(state)) QWindowSystemInterface::flushWindowSystemEvents(); // Required for oldState to work on WindowStateChanged @@ -589,16 +589,16 @@ void QWaylandWindow::setWindowFlags(Qt::WindowFlags flags) bool QWaylandWindow::createDecoration() { // so far only xdg-shell support this "unminimize" trick, may be moved elsewhere - if (mState == Qt::WindowMinimized) { + if (mState & Qt::WindowMinimized) { QWaylandXdgSurface *xdgSurface = qobject_cast(mShellSurface); if ( xdgSurface ) { - if (xdgSurface->isFullscreen()) { - setWindowStateInternal(Qt::WindowFullScreen); - } else if (xdgSurface->isMaximized()) { - setWindowStateInternal(Qt::WindowMaximized); - } else { - setWindowStateInternal(Qt::WindowNoState); - } + Qt::WindowStates states; + if (xdgSurface->isFullscreen()) + states |= Qt::WindowFullScreen; + if (xdgSurface->isMaximized()) + states |= Qt::WindowMaximized; + + setWindowStateInternal(states); } } @@ -849,7 +849,7 @@ bool QWaylandWindow::setMouseGrabEnabled(bool grab) return true; } -bool QWaylandWindow::setWindowStateInternal(Qt::WindowState state) +bool QWaylandWindow::setWindowStateInternal(Qt::WindowStates state) { if (mState == state) { return false; @@ -862,19 +862,14 @@ bool QWaylandWindow::setWindowStateInternal(Qt::WindowState state) if (mShellSurface) { createDecoration(); - switch (state) { - case Qt::WindowFullScreen: - mShellSurface->setFullscreen(); - break; - case Qt::WindowMaximized: - mShellSurface->setMaximized(); - break; - case Qt::WindowMinimized: - mShellSurface->setMinimized(); - break; - default: - mShellSurface->setNormal(); - } + if (state & Qt::WindowMaximized) + mShellSurface->setMaximized(); + if (state & Qt::WindowFullScreen) + mShellSurface->setFullscreen(); + if (state & Qt::WindowMinimized) + mShellSurface->setMinimized(); + if (!state) + mShellSurface->setNormal(); } QWindowSystemInterface::handleWindowStateChanged(window(), mState); diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index b9ca5ee0e3a..7e8db74bc6e 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -148,7 +148,7 @@ public: void handleContentOrientationChange(Qt::ScreenOrientation orientation) override; void setOrientationMask(Qt::ScreenOrientations mask); - void setWindowState(Qt::WindowState state); // ### Change to WindowStates once qtbase change is in + void setWindowState(Qt::WindowStates state) override; void setWindowFlags(Qt::WindowFlags flags) override; void raise() override; @@ -173,8 +173,8 @@ public: bool createDecoration(); - inline bool isMaximized() const { return mState == Qt::WindowMaximized; } - inline bool isFullscreen() const { return mState == Qt::WindowFullScreen; } + inline bool isMaximized() const { return mState & Qt::WindowMaximized; } + inline bool isFullscreen() const { return mState & Qt::WindowFullScreen; } #if QT_CONFIG(cursor) void setMouseCursor(QWaylandInputDevice *device, const QCursor &cursor); @@ -238,14 +238,14 @@ protected: QIcon mWindowIcon; - Qt::WindowState mState; + Qt::WindowStates mState; Qt::WindowFlags mFlags; QRegion mMask; QWaylandShmBackingStore *mBackingStore; private: - bool setWindowStateInternal(Qt::WindowState flags); + bool setWindowStateInternal(Qt::WindowStates flags); void setGeometry_helper(const QRect &rect); void initWindow(); bool shouldCreateShellSurface() const; From e9b87c0b1c94101475ce1da4ed175e1d62110096 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Sat, 1 Apr 2017 21:19:24 -0700 Subject: [PATCH 0421/1507] Fix warning about unused variable QPoint has no side-effects so it's safe to remove. main.cpp:214:12: warning: unused variable 'gradCenter' [-Wunused-variable] Change-Id: I27b55fdf514247549455fffd14b179b3a6a08617 Reviewed-by: Johan Helsing --- .../platforms/wayland/plugins/decorations/bradient/main.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp b/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp index 074c74522d2..ceb07c8032d 100644 --- a/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp +++ b/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp @@ -211,7 +211,6 @@ void QWaylandBradientDecoration::paint(QPaintDevice *device) p.setRenderHint(QPainter::Antialiasing); // Title bar - QPoint gradCenter(top.center()+ QPoint(30, 60)); QLinearGradient grad(top.topLeft(), top.bottomLeft()); QColor base(m_backgroundColor); grad.setColorAt(0, base.lighter(100)); From 240fb37484f02902a140c9b27ec38d7148a7b10c Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Sat, 1 Apr 2017 21:08:38 -0700 Subject: [PATCH 0422/1507] Fix warning about inconsistent use of override keyword qwaylandshmbackingstore_p.h:93:19: warning: 'paintDevice' overrides a member function but is not marked 'override' [-Winconsistent-missing- override Change-Id: I27b55fdf514247549455fffd14b1791d4dd6b6b3 Reviewed-by: Johan Helsing --- src/plugins/platforms/wayland/qwaylandshmbackingstore_p.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandshmbackingstore_p.h b/src/plugins/platforms/wayland/qwaylandshmbackingstore_p.h index 71f98e30cfe..8564cc9d223 100644 --- a/src/plugins/platforms/wayland/qwaylandshmbackingstore_p.h +++ b/src/plugins/platforms/wayland/qwaylandshmbackingstore_p.h @@ -90,7 +90,7 @@ public: QWaylandShmBackingStore(QWindow *window); ~QWaylandShmBackingStore(); - QPaintDevice *paintDevice(); + QPaintDevice *paintDevice() override; void flush(QWindow *window, const QRegion ®ion, const QPoint &offset) override; void resize(const QSize &size, const QRegion &staticContents) override; void resize(const QSize &size); From b0f57f5e313caa28d238997c55f98bb64c78f792 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Wed, 12 Apr 2017 10:13:07 +0200 Subject: [PATCH 0423/1507] Don't try to create zxdg_popup_v6s with incomplete positioners A positioner without a size is considered incomplete, and creating a popup with an incomplete positioner is a protocol error. Change-Id: I5efdba0edfe6edc5f7b0a4908c1e43b93d35eea8 Reviewed-by: Pier Luigi Fiorini Reviewed-by: Jan Arne Petersen Reviewed-by: Paul Olav Tvete --- src/plugins/platforms/wayland/qwaylandxdgshellv6.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/plugins/platforms/wayland/qwaylandxdgshellv6.cpp b/src/plugins/platforms/wayland/qwaylandxdgshellv6.cpp index 687973240eb..b50b6b1cf0b 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgshellv6.cpp +++ b/src/plugins/platforms/wayland/qwaylandxdgshellv6.cpp @@ -199,6 +199,7 @@ void QWaylandXdgSurfaceV6::setPopup(QWaylandWindow *parent, QWaylandInputDevice positioner->set_anchor_rect(transientPos.x(), transientPos.y(), 1, 1); positioner->set_anchor(QtWayland::zxdg_positioner_v6::anchor_top | QtWayland::zxdg_positioner_v6::anchor_left); positioner->set_gravity(QtWayland::zxdg_positioner_v6::gravity_bottom | QtWayland::zxdg_positioner_v6::gravity_right); + positioner->set_size(m_window->geometry().width(), m_window->geometry().height()); m_popup = new Popup(this, parentXdgSurface, positioner); positioner->destroy(); delete positioner; From 13a861ede87f3628490ece49b6db2553cebe2dd6 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Tue, 25 Apr 2017 15:19:46 +0200 Subject: [PATCH 0424/1507] Don't depend on shell extension The mininimal-cpp compositor example does not have any shell extensions. Change-Id: I925450a75ab6f93245ca9897bbc6f092d93364b6 Reviewed-by: Johan Helsing --- .../platforms/wayland/qwaylandwindow.cpp | 75 ++++++++++--------- 1 file changed, 38 insertions(+), 37 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 00fbb00de7f..3a216e12718 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -145,47 +145,48 @@ void QWaylandWindow::initWindow() Q_ASSERT(!mShellSurface); mShellSurface = mDisplay->createShellSurface(this); - if (!mShellSurface) - qFatal("Could not create a shell surface object."); + if (mShellSurface) { + mShellSurface->setType(window()->type(), transientParent()); - mShellSurface->setType(window()->type(), transientParent()); + // Set initial surface title + setWindowTitle(window()->title()); - // Set initial surface title - setWindowTitle(window()->title()); - - // The appId is the desktop entry identifier that should follow the - // reverse DNS convention (see http://standards.freedesktop.org/desktop-entry-spec/latest/ar01s02.html). - // According to xdg-shell the appId is only the name, without - // the .desktop suffix. - // - // If the application specifies the desktop file name use that - // removing the ".desktop" suffix, otherwise fall back to the - // executable name and prepend the reversed organization domain - // when available. - if (!QGuiApplication::desktopFileName().isEmpty()) { - QString name = QGuiApplication::desktopFileName(); - if (name.endsWith(QLatin1String(".desktop"))) - name.chop(8); - mShellSurface->setAppId(name); - } else { - QFileInfo fi = QCoreApplication::instance()->applicationFilePath(); - QStringList domainName = - QCoreApplication::instance()->organizationDomain().split(QLatin1Char('.'), - QString::SkipEmptyParts); - - if (domainName.isEmpty()) { - mShellSurface->setAppId(fi.baseName()); + // The appId is the desktop entry identifier that should follow the + // reverse DNS convention (see http://standards.freedesktop.org/desktop-entry-spec/latest/ar01s02.html). + // According to xdg-shell the appId is only the name, without + // the .desktop suffix. + // + // If the application specifies the desktop file name use that + // removing the ".desktop" suffix, otherwise fall back to the + // executable name and prepend the reversed organization domain + // when available. + if (!QGuiApplication::desktopFileName().isEmpty()) { + QString name = QGuiApplication::desktopFileName(); + if (name.endsWith(QLatin1String(".desktop"))) + name.chop(8); + mShellSurface->setAppId(name); } else { - QString appId; - for (int i = 0; i < domainName.count(); ++i) - appId.prepend(QLatin1Char('.')).prepend(domainName.at(i)); - appId.append(fi.baseName()); - mShellSurface->setAppId(appId); + QFileInfo fi = QCoreApplication::instance()->applicationFilePath(); + QStringList domainName = + QCoreApplication::instance()->organizationDomain().split(QLatin1Char('.'), + QString::SkipEmptyParts); + + if (domainName.isEmpty()) { + mShellSurface->setAppId(fi.baseName()); + } else { + QString appId; + for (int i = 0; i < domainName.count(); ++i) + appId.prepend(QLatin1Char('.')).prepend(domainName.at(i)); + appId.append(fi.baseName()); + mShellSurface->setAppId(appId); + } } + // the user may have already set some window properties, so make sure to send them out + for (auto it = m_properties.cbegin(); it != m_properties.cend(); ++it) + mShellSurface->sendProperty(it.key(), it.value()); + } else { + qWarning("Could not create a shell surface object."); } - // the user may have already set some window properties, so make sure to send them out - for (auto it = m_properties.cbegin(); it != m_properties.cend(); ++it) - mShellSurface->sendProperty(it.key(), it.value()); } // Enable high-dpi rendering. Scale() returns the screen scale factor and will @@ -327,7 +328,7 @@ void QWaylandWindow::setGeometry(const QRect &rect) void QWaylandWindow::sendExposeEvent(const QRect &rect) { - if (mShellSurface && !mShellSurface->handleExpose(rect)) + if (!(mShellSurface && mShellSurface->handleExpose(rect))) QWindowSystemInterface::handleExposeEvent(window(), rect); } From 57551844fc9aff47044356d9b3b42dad9cd558fd Mon Sep 17 00:00:00 2001 From: Jani Heikkinen Date: Wed, 3 May 2017 15:00:10 +0300 Subject: [PATCH 0425/1507] Fix licensing Currently tests are licensed under GPL-EXCEPT, examples under BSD and src under LGPL so replase old license headers with new & proper ones. Also remove old & unused license files Task-number: QTBUG-57147 Change-Id: Ia6a738798736c275dc309ccfa5b627dc2178d241 Reviewed-by: Lars Knoll --- .../global/qwaylandclientextension.cpp | 27 +++++++------- .../wayland/global/qwaylandclientextension.h | 27 +++++++------- .../global/qwaylandclientextension_p.h | 27 +++++++------- .../platforms/wayland/qwaylandbuffer.cpp | 36 +++++++++++-------- .../wayland/qwaylandwlshellintegration.cpp | 34 ++++++++++-------- .../wayland/qwaylandwlshellintegration_p.h | 34 ++++++++++-------- .../platforms/wayland/qwaylandxdgpopup.cpp | 34 ++++++++++-------- .../platforms/wayland/qwaylandxdgpopup_p.h | 34 ++++++++++-------- .../wayland/qwaylandxdgshellintegration.cpp | 34 ++++++++++-------- .../wayland/qwaylandxdgshellintegration_p.h | 34 ++++++++++-------- .../platforms/wayland/qwaylandxdgshellv6.cpp | 36 +++++++++++-------- .../platforms/wayland/qwaylandxdgshellv6_p.h | 36 +++++++++++-------- .../wayland/qwaylandxdgshellv6integration.cpp | 34 ++++++++++-------- .../wayland/qwaylandxdgshellv6integration_p.h | 34 ++++++++++-------- 14 files changed, 268 insertions(+), 193 deletions(-) diff --git a/src/plugins/platforms/wayland/global/qwaylandclientextension.cpp b/src/plugins/platforms/wayland/global/qwaylandclientextension.cpp index 8e46197f18d..ad266a68392 100644 --- a/src/plugins/platforms/wayland/global/qwaylandclientextension.cpp +++ b/src/plugins/platforms/wayland/global/qwaylandclientextension.cpp @@ -1,34 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2016 Erik Larsson. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2017 Erik Larsson. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the QtWaylandCompositor module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL3$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** Foundation and appearing in the file LICENSE.LGPL3 included in the ** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/src/plugins/platforms/wayland/global/qwaylandclientextension.h b/src/plugins/platforms/wayland/global/qwaylandclientextension.h index 7e11bb47f72..37debc513eb 100644 --- a/src/plugins/platforms/wayland/global/qwaylandclientextension.h +++ b/src/plugins/platforms/wayland/global/qwaylandclientextension.h @@ -1,34 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2016 Erik Larsson. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2017 Erik Larsson. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the QtWaylandCompositor module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL3$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** Foundation and appearing in the file LICENSE.LGPL3 included in the ** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/src/plugins/platforms/wayland/global/qwaylandclientextension_p.h b/src/plugins/platforms/wayland/global/qwaylandclientextension_p.h index 7c88161fa51..0fd59b3f782 100644 --- a/src/plugins/platforms/wayland/global/qwaylandclientextension_p.h +++ b/src/plugins/platforms/wayland/global/qwaylandclientextension_p.h @@ -1,34 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2016 Erik Larsson. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2017 Erik Larsson. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the QtWaylandCompositor module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL3$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** Foundation and appearing in the file LICENSE.LGPL3 included in the ** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/src/plugins/platforms/wayland/qwaylandbuffer.cpp b/src/plugins/platforms/wayland/qwaylandbuffer.cpp index c6aace2c7ce..a0fcc532f5b 100644 --- a/src/plugins/platforms/wayland/qwaylandbuffer.cpp +++ b/src/plugins/platforms/wayland/qwaylandbuffer.cpp @@ -1,32 +1,38 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Copyright (C) 2015 Giulio Camuffo. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2017 The Qt Company Ltd. +** Copyright (C) 2017 Giulio Camuffo. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/src/plugins/platforms/wayland/qwaylandwlshellintegration.cpp b/src/plugins/platforms/wayland/qwaylandwlshellintegration.cpp index 8d61201bdd7..e945745e23c 100644 --- a/src/plugins/platforms/wayland/qwaylandwlshellintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandwlshellintegration.cpp @@ -1,31 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/src/plugins/platforms/wayland/qwaylandwlshellintegration_p.h b/src/plugins/platforms/wayland/qwaylandwlshellintegration_p.h index 8a33a177cdb..2e3ac3cc1cf 100644 --- a/src/plugins/platforms/wayland/qwaylandwlshellintegration_p.h +++ b/src/plugins/platforms/wayland/qwaylandwlshellintegration_p.h @@ -1,31 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/src/plugins/platforms/wayland/qwaylandxdgpopup.cpp b/src/plugins/platforms/wayland/qwaylandxdgpopup.cpp index 318f78ac738..d5fc4969362 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgpopup.cpp +++ b/src/plugins/platforms/wayland/qwaylandxdgpopup.cpp @@ -1,31 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/src/plugins/platforms/wayland/qwaylandxdgpopup_p.h b/src/plugins/platforms/wayland/qwaylandxdgpopup_p.h index e10e5e62b98..f45e717a953 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgpopup_p.h +++ b/src/plugins/platforms/wayland/qwaylandxdgpopup_p.h @@ -1,31 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the config.tests of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/src/plugins/platforms/wayland/qwaylandxdgshellintegration.cpp b/src/plugins/platforms/wayland/qwaylandxdgshellintegration.cpp index 439dd4b1539..04b8e804848 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgshellintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandxdgshellintegration.cpp @@ -1,31 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/src/plugins/platforms/wayland/qwaylandxdgshellintegration_p.h b/src/plugins/platforms/wayland/qwaylandxdgshellintegration_p.h index adf2bca285a..cc4493e3e1b 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgshellintegration_p.h +++ b/src/plugins/platforms/wayland/qwaylandxdgshellintegration_p.h @@ -1,31 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/src/plugins/platforms/wayland/qwaylandxdgshellv6.cpp b/src/plugins/platforms/wayland/qwaylandxdgshellv6.cpp index b50b6b1cf0b..9479402131d 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgshellv6.cpp +++ b/src/plugins/platforms/wayland/qwaylandxdgshellv6.cpp @@ -1,32 +1,38 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. -** Copyright (C) 2014 Eurogiciel, author: -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2017 The Qt Company Ltd. +** Copyright (C) 2017 Eurogiciel, author: +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the config.tests of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/src/plugins/platforms/wayland/qwaylandxdgshellv6_p.h b/src/plugins/platforms/wayland/qwaylandxdgshellv6_p.h index 81be89de274..12f7301d550 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgshellv6_p.h +++ b/src/plugins/platforms/wayland/qwaylandxdgshellv6_p.h @@ -1,32 +1,38 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. -** Copyright (C) 2014 Eurogiciel, author: -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2017 The Qt Company Ltd. +** Copyright (C) 2017 Eurogiciel, author: +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the config.tests of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/src/plugins/platforms/wayland/qwaylandxdgshellv6integration.cpp b/src/plugins/platforms/wayland/qwaylandxdgshellv6integration.cpp index 26f50c376b6..a3dca70bf56 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgshellv6integration.cpp +++ b/src/plugins/platforms/wayland/qwaylandxdgshellv6integration.cpp @@ -1,31 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/src/plugins/platforms/wayland/qwaylandxdgshellv6integration_p.h b/src/plugins/platforms/wayland/qwaylandxdgshellv6integration_p.h index 21868c4111d..f22b6a66adf 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgshellv6integration_p.h +++ b/src/plugins/platforms/wayland/qwaylandxdgshellv6integration_p.h @@ -1,31 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** From 32075e0e4b3632a4b6bd770920e4595732a88cc9 Mon Sep 17 00:00:00 2001 From: Tasuku Suzuki Date: Mon, 3 Apr 2017 13:48:38 +0900 Subject: [PATCH 0426/1507] Fix build without features.xlib Change-Id: Id0f57aa71a1ec66dc16c9cfa1f31a2e1bdf3b61d Reviewed-by: Oswald Buddenhagen Reviewed-by: Paul Olav Tvete --- src/plugins/platforms/wayland/configure.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/wayland/configure.json b/src/plugins/platforms/wayland/configure.json index c29a8b609d8..d216960e1db 100644 --- a/src/plugins/platforms/wayland/configure.json +++ b/src/plugins/platforms/wayland/configure.json @@ -92,12 +92,12 @@ }, "xcomposite-egl": { "label": "XComposite EGL", - "condition": "features.wayland-client && features.opengl && features.egl && libs.xcomposite", + "condition": "features.wayland-client && features.opengl && features.egl && features.xlib && libs.xcomposite", "output": [ "privateFeature" ] }, "xcomposite-glx": { "label": "XComposite GLX", - "condition": "features.wayland-client && features.opengl && !features.opengles2 && libs.xcomposite && libs.glx", + "condition": "features.wayland-client && features.opengl && !features.opengles2 && features.xlib && libs.xcomposite && libs.glx", "output": [ "privateFeature" ] }, "drm-egl-server": { From 07a8cb2d91da357ad66ffe6cba88b3c0653ae1ec Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Wed, 10 May 2017 11:55:59 +0200 Subject: [PATCH 0427/1507] send handleScreenGeometryChange with scaled geometry Change-Id: Ia9c3622369114e04318628262cc6ce2ea447cb4c Reviewed-by: Pier Luigi Fiorini Reviewed-by: Giulio Camuffo --- src/plugins/platforms/wayland/qwaylandscreen.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandscreen.cpp b/src/plugins/platforms/wayland/qwaylandscreen.cpp index 31d21a1c34e..ac595457793 100644 --- a/src/plugins/platforms/wayland/qwaylandscreen.cpp +++ b/src/plugins/platforms/wayland/qwaylandscreen.cpp @@ -245,7 +245,7 @@ void QWaylandScreen::output_done() QWindowSystemInterface::handleScreenOrientationChange(screen(), m_orientation); mTransform = -1; } - QWindowSystemInterface::handleScreenGeometryChange(screen(), mGeometry, mGeometry); + QWindowSystemInterface::handleScreenGeometryChange(screen(), geometry(), geometry()); QWindowSystemInterface::handleScreenRefreshRateChange(screen(), refreshRate()); } From 6698deaa46d9798aab6aabcb6667d440d90a14f6 Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Wed, 10 May 2017 21:57:10 +0200 Subject: [PATCH 0428/1507] Pass modifiers with wheel events Change-Id: I345cdeea1357a8f9201a74b2d5e80350b6c42f24 Reviewed-by: Giulio Camuffo --- src/plugins/platforms/wayland/qwaylandinputdevice.cpp | 6 +++--- src/plugins/platforms/wayland/qwaylandinputdevice_p.h | 3 ++- src/plugins/platforms/wayland/qwaylandwindow.cpp | 4 ++-- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index b0c6394e2b0..59dcb1d77e3 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -583,8 +583,8 @@ void QWaylandInputDevice::Pointer::releaseButtons() class WheelEvent : public QWaylandPointerEvent { public: - WheelEvent(ulong t, const QPointF &l, const QPointF &g, const QPoint &pd, const QPoint &ad) - : QWaylandPointerEvent(QWaylandPointerEvent::Wheel, t, l, g, pd, ad) + WheelEvent(ulong t, const QPointF &l, const QPointF &g, const QPoint &pd, const QPoint &ad, Qt::KeyboardModifiers m) + : QWaylandPointerEvent(QWaylandPointerEvent::Wheel, t, l, g, pd, ad, m) { } }; @@ -612,7 +612,7 @@ void QWaylandInputDevice::Pointer::pointer_axis(uint32_t time, uint32_t axis, in angleDelta.setY(valueDelta); } - WheelEvent e(time, mSurfacePos, mGlobalPos, pixelDelta, angleDelta); + WheelEvent e(time, mSurfacePos, mGlobalPos, pixelDelta, angleDelta, mParent->modifiers()); window->handleMouse(mParent, e); } diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h index 4d0a4759751..9e3d1d1f449 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h +++ b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h @@ -314,11 +314,12 @@ public: , buttons(b) , modifiers(m) {} - inline QWaylandPointerEvent(Type t, ulong ts, const QPointF &l, const QPointF &g, const QPoint &pd, const QPoint &ad) + inline QWaylandPointerEvent(Type t, ulong ts, const QPointF &l, const QPointF &g, const QPoint &pd, const QPoint &ad, Qt::KeyboardModifiers m) : type(t) , timestamp(ts) , local(l) , global(g) + , modifiers(m) , pixelDelta(pd) , angleDelta(ad) {} diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 3a216e12718..a70a4f54b27 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -728,7 +728,7 @@ void QWaylandWindow::handleMouse(QWaylandInputDevice *inputDevice, const QWaylan QWindowSystemInterface::handleMouseEvent(window(), e.timestamp, e.local, e.global, e.buttons, e.modifiers); break; case QWaylandPointerEvent::Wheel: - QWindowSystemInterface::handleWheelEvent(window(), e.timestamp, e.local, e.global, e.pixelDelta, e.angleDelta); + QWindowSystemInterface::handleWheelEvent(window(), e.timestamp, e.local, e.global, e.pixelDelta, e.angleDelta, e.modifiers); break; } } @@ -796,7 +796,7 @@ void QWaylandWindow::handleMouseEventWithDecoration(QWaylandInputDevice *inputDe QWindowSystemInterface::handleMouseEvent(window(), e.timestamp, localTranslated, globalTranslated, e.buttons, e.modifiers); break; case QWaylandPointerEvent::Wheel: - QWindowSystemInterface::handleWheelEvent(window(), e.timestamp, localTranslated, globalTranslated, e.pixelDelta, e.angleDelta); + QWindowSystemInterface::handleWheelEvent(window(), e.timestamp, localTranslated, globalTranslated, e.pixelDelta, e.angleDelta, e.modifiers); break; } From c9a156f29e15eaf300d2536cab9d230bd9f85636 Mon Sep 17 00:00:00 2001 From: Giulio Camuffo Date: Sat, 4 Feb 2017 11:33:56 +0100 Subject: [PATCH 0429/1507] Set the cursor when the pointer enters the window Change-Id: I1ff9928bc5d9d1d80ce07561243eeec89c406e36 Reviewed-by: Jan Arne Petersen Reviewed-by: Johan Helsing --- src/plugins/platforms/wayland/qwaylandinputdevice.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index 59dcb1d77e3..4def0de8f91 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -377,7 +377,7 @@ void QWaylandInputDevice::setCursor(Qt::CursorShape newShape, QWaylandScreen *sc void QWaylandInputDevice::setCursor(const QCursor &cursor, QWaylandScreen *screen) { - if (cursor.shape() != Qt::BitmapCursor && cursor.shape() == mPointer->mCursorShape) + if (mPointer->mCursorSerial >= mPointer->mEnterSerial && (cursor.shape() != Qt::BitmapCursor && cursor.shape() == mPointer->mCursorShape)) return; mPointer->mCursorShape = cursor.shape(); From 9b6a92702655d8bce754f747a40495294f04a6d4 Mon Sep 17 00:00:00 2001 From: Robert Griebl Date: Thu, 11 May 2017 13:06:07 +0200 Subject: [PATCH 0430/1507] Remove duplicate code This code started as a 1:1 copy from the base class in 5.8. Just call the base class implementation, since this was also improved in the meantime. Change-Id: Ib9c7c6efa3f043a83029b5387097533bf5da833e Reviewed-by: Giulio Camuffo --- .../qwaylandwindowmanagerintegration.cpp | 22 ------------------- .../qwaylandwindowmanagerintegration_p.h | 2 -- 2 files changed, 24 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration.cpp b/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration.cpp index 60825aec29b..c519126e5a5 100644 --- a/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration.cpp @@ -109,28 +109,6 @@ void QWaylandWindowManagerIntegration::windowmanager_quit() QGuiApplication::quit(); } -QByteArray QWaylandWindowManagerIntegration::desktopEnvironment() const -{ - const QByteArray xdgCurrentDesktop = qgetenv("XDG_CURRENT_DESKTOP"); - if (!xdgCurrentDesktop.isEmpty()) - return xdgCurrentDesktop.toUpper(); // KDE, GNOME, UNITY, LXDE, MATE, XFCE... - - // Classic fallbacks - if (!qEnvironmentVariableIsEmpty("KDE_FULL_SESSION")) - return QByteArrayLiteral("KDE"); - if (!qEnvironmentVariableIsEmpty("GNOME_DESKTOP_SESSION_ID")) - return QByteArrayLiteral("GNOME"); - - // Fallback to checking $DESKTOP_SESSION (unreliable) - const QByteArray desktopSession = qgetenv("DESKTOP_SESSION"); - if (desktopSession == "gnome") - return QByteArrayLiteral("GNOME"); - if (desktopSession == "xfce") - return QByteArrayLiteral("XFCE"); - - return QByteArrayLiteral("UNKNOWN"); -} - void QWaylandWindowManagerIntegration::openUrl_helper(const QUrl &url) { Q_ASSERT(isInitialized()); diff --git a/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration_p.h b/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration_p.h index cf6ca660578..e399d4f0b82 100644 --- a/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration_p.h @@ -77,8 +77,6 @@ public: explicit QWaylandWindowManagerIntegration(QWaylandDisplay *waylandDisplay); virtual ~QWaylandWindowManagerIntegration(); - QByteArray desktopEnvironment() const override; - bool openUrl(const QUrl &url) override; bool openDocument(const QUrl &url) override; From b5b693e8889d4d5c172d0a128e7999aaa3177559 Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Fri, 5 May 2017 17:29:13 +0200 Subject: [PATCH 0431/1507] Match WaylandWindow scale to what we set on the buffer, not the screen Currently if the screen scale changes we report a new devicePixelRatio to rendering but we don't send a new set_buffer_scale nor do we update the buffer sizes. This leaves us in a corrupt state. Change-Id: I5bb2bd5eec440cd1ce9080cd3a3dc65448f68298 Reviewed-by: Giulio Camuffo --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 8 ++++++-- src/plugins/platforms/wayland/qwaylandwindow_p.h | 1 + 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index a70a4f54b27..18470913b49 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -92,6 +92,7 @@ QWaylandWindow::QWaylandWindow(QWindow *window) , mResizeDirty(false) , mResizeAfterSwap(qEnvironmentVariableIsSet("QT_WAYLAND_RESIZE_AFTER_SWAP")) , mSentInitialResize(false) + , mScale(1) , mState(Qt::WindowNoState) , mMask() , mBackingStore(Q_NULLPTR) @@ -189,9 +190,12 @@ void QWaylandWindow::initWindow() } } + mScale = screen()->scale(); + // Enable high-dpi rendering. Scale() returns the screen scale factor and will // typically be integer 1 (normal-dpi) or 2 (high-dpi). Call set_buffer_scale() // to inform the compositor that high-resolution buffers will be provided. + //FIXME this needs to be changed when the screen changes along with a resized backing store if (mDisplay->compositorVersion() >= 3) set_buffer_scale(scale()); @@ -847,12 +851,12 @@ bool QWaylandWindow::isExposed() const int QWaylandWindow::scale() const { - return screen()->scale(); + return mScale; } qreal QWaylandWindow::devicePixelRatio() const { - return screen()->devicePixelRatio(); + return mScale; } bool QWaylandWindow::setMouseGrabEnabled(bool grab) diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index 8e72b1076b9..29eb6c59687 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -235,6 +235,7 @@ protected: bool mSentInitialResize; QPoint mOffset; + int mScale; QIcon mWindowIcon; From 8e181a61f4ecbf4622f8ba809e98fcd1a441b7d8 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Thu, 18 May 2017 14:57:32 +0200 Subject: [PATCH 0432/1507] Add missing header guard to mocksurface.h Change-Id: I353c8b67c0990ca6fc4d8168c09d2af8899ed081 Reviewed-by: Giulio Camuffo --- tests/auto/wayland/client/mocksurface.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/auto/wayland/client/mocksurface.h b/tests/auto/wayland/client/mocksurface.h index e34d6596ebf..5155599bbfa 100644 --- a/tests/auto/wayland/client/mocksurface.h +++ b/tests/auto/wayland/client/mocksurface.h @@ -26,6 +26,9 @@ ** ****************************************************************************/ +#ifndef MOCKSURFACE_H +#define MOCKSURFACE_H + #include #include "qwayland-server-wayland.h" @@ -69,3 +72,5 @@ private: }; } + +#endif // MOCKSURFACE_H From fa4d3dec37dc56fe5dcec24b9e48b37016e3e36c Mon Sep 17 00:00:00 2001 From: Giulio Camuffo Date: Tue, 28 Feb 2017 17:38:03 +0100 Subject: [PATCH 0433/1507] Fix setting the window state Change-Id: I236095aa9103a2a35ecd79e747b8d1ee843a98f1 Reviewed-by: Jan Arne Petersen Reviewed-by: Pier Luigi Fiorini --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 18470913b49..5585fd52aba 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -207,6 +207,10 @@ void QWaylandWindow::initWindow() else setGeometry_helper(window()->geometry()); setMask(window()->mask()); + // setWindowStateInternal is a no-op if the argument is equal to mState, + // but since we're creating the shellsurface only now we reset mState to + // make sure the state gets sent out to the compositor + mState = Qt::WindowNoState; setWindowStateInternal(window()->windowState()); handleContentOrientationChange(window()->contentOrientation()); mFlags = window()->flags(); From 57af7c4c22e465b0b4b3b5491503ed4a9b12dce8 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Mon, 29 May 2017 15:44:12 +0200 Subject: [PATCH 0434/1507] Send SurfaceCreated and SurfaceAboutToBeDestroyed events for wl_surface Previously, the events were matching the life cycle of QWaylandWindow. This commit changes it so the events are matching the life cycle of wl_surfaces instead (a QWaylandWindow can outlive several wl_surfaces). Some of these events were already sent in QWindowPrivate (the first and last). Now we handle the cases where the wl_surface is destroyed and recreated due to hiding/showing the window or when changing the role of the wl_surface. Task-number: QTBUG-58423 Change-Id: Ie4a4e7dd529e1a41a2cf42e02cebb3c8aca4a4cc Reviewed-by: Giulio Camuffo Reviewed-by: Marco Martin --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 13 ++++++++++--- src/plugins/platforms/wayland/qwaylandwindow_p.h | 2 +- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 9b994508c09..5bfa158ae25 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -110,7 +110,7 @@ QWaylandWindow::~QWaylandWindow() delete mWindowDecoration; if (isInitialized()) - reset(); + reset(false); QList inputDevices = mDisplay->inputDevices(); for (int i = 0; i < inputDevices.size(); ++i) @@ -132,8 +132,11 @@ void QWaylandWindow::initWindow() if (window()->type() == Qt::Desktop) return; - if (!isInitialized()) + if (!isInitialized()) { initializeWlSurface(); + QPlatformSurfaceEvent e(QPlatformSurfaceEvent::SurfaceCreated); + QGuiApplication::sendEvent(window(), &e); + } if (shouldCreateSubSurface()) { Q_ASSERT(!mSubSurfaceWindow); @@ -240,8 +243,12 @@ bool QWaylandWindow::shouldCreateSubSurface() const return QPlatformWindow::parent() != Q_NULLPTR; } -void QWaylandWindow::reset() +void QWaylandWindow::reset(bool sendDestroyEvent) { + if (isInitialized() && sendDestroyEvent) { + QPlatformSurfaceEvent e(QPlatformSurfaceEvent::SurfaceAboutToBeDestroyed); + QGuiApplication::sendEvent(window(), &e); + } delete mShellSurface; mShellSurface = 0; delete mSubSurfaceWindow; diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index cc11b3c11ed..9f6ff5b4eeb 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -252,7 +252,7 @@ private: void initializeWlSurface(); bool shouldCreateShellSurface() const; bool shouldCreateSubSurface() const; - void reset(); + void reset(bool sendDestroyEvent = true); void sendExposeEvent(const QRect &rect); void handleMouseEventWithDecoration(QWaylandInputDevice *inputDevice, const QWaylandPointerEvent &e); From a92a519e799939e9d76d5b32b7f77eb8e9c8d578 Mon Sep 17 00:00:00 2001 From: Tasuku Suzuki Date: Sat, 17 Jun 2017 15:28:49 +0900 Subject: [PATCH 0435/1507] Translucent background support Change-Id: I6e7b5869097f579020c7a4439441a63a0771e955 Task-number: QTBUG-55956 Reviewed-by: Laszlo Agocs --- .../platforms/wayland/qwaylandshmbackingstore.cpp | 10 +++++++++- .../platforms/wayland/qwaylandshmbackingstore_p.h | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp b/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp index 0afdda4c0c3..045748a16c2 100644 --- a/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp +++ b/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp @@ -171,12 +171,20 @@ QPaintDevice *QWaylandShmBackingStore::paintDevice() return contentSurface(); } -void QWaylandShmBackingStore::beginPaint(const QRegion &) +void QWaylandShmBackingStore::beginPaint(const QRegion ®ion) { mPainting = true; ensureSize(); waylandWindow()->setCanResize(false); + + if (mBackBuffer->image()->hasAlphaChannel()) { + QPainter p(paintDevice()); + p.setCompositionMode(QPainter::CompositionMode_Source); + const QColor blank = Qt::transparent; + for (const QRect &rect : region) + p.fillRect(rect, blank); + } } void QWaylandShmBackingStore::endPaint() diff --git a/src/plugins/platforms/wayland/qwaylandshmbackingstore_p.h b/src/plugins/platforms/wayland/qwaylandshmbackingstore_p.h index 8564cc9d223..251368efd47 100644 --- a/src/plugins/platforms/wayland/qwaylandshmbackingstore_p.h +++ b/src/plugins/platforms/wayland/qwaylandshmbackingstore_p.h @@ -94,7 +94,7 @@ public: void flush(QWindow *window, const QRegion ®ion, const QPoint &offset) override; void resize(const QSize &size, const QRegion &staticContents) override; void resize(const QSize &size); - void beginPaint(const QRegion &) override; + void beginPaint(const QRegion ®ion) override; void endPaint() override; QWaylandAbstractDecoration *windowDecoration() const; From d6e47a81c2afdb7c9ed5575415b486611f28cdf9 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 2 Jun 2017 21:22:42 -0700 Subject: [PATCH 0436/1507] Fix all the warnings about deprecated qLoadPlugin1 qLoadPlugin is variadic and can take one argument to the plugin loader, so just use that. Change-Id: Ia3e896da908f42939148fffd14c481e367fdb128 Reviewed-by: Jan Arne Petersen Reviewed-by: Johan Helsing --- .../qwaylandclientbufferintegrationfactory.cpp | 4 ++-- .../qwaylandserverbufferintegrationfactory.cpp | 4 ++-- .../qwaylandinputdeviceintegrationfactory.cpp | 4 ++-- src/plugins/platforms/wayland/qwaylanddecorationfactory.cpp | 4 ++-- .../shellintegration/qwaylandshellintegrationfactory.cpp | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationfactory.cpp b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationfactory.cpp index 4e7e7ee5cac..eebd69a8703 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationfactory.cpp +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationfactory.cpp @@ -84,10 +84,10 @@ QWaylandClientBufferIntegration *QWaylandClientBufferIntegrationFactory::create( // Try loading the plugin from platformPluginPath first: if (!pluginPath.isEmpty()) { QCoreApplication::addLibraryPath(pluginPath); - if (QWaylandClientBufferIntegration *ret = qLoadPlugin1(directLoader(), name, args)) + if (QWaylandClientBufferIntegration *ret = qLoadPlugin(directLoader(), name, args)) return ret; } - if (QWaylandClientBufferIntegration *ret = qLoadPlugin1(loader(), name, args)) + if (QWaylandClientBufferIntegration *ret = qLoadPlugin(loader(), name, args)) return ret; #endif return 0; diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationfactory.cpp b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationfactory.cpp index 527dc571a2e..aa2f54cb7d5 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationfactory.cpp +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationfactory.cpp @@ -84,10 +84,10 @@ QWaylandServerBufferIntegration *QWaylandServerBufferIntegrationFactory::create( // Try loading the plugin from platformPluginPath first: if (!pluginPath.isEmpty()) { QCoreApplication::addLibraryPath(pluginPath); - if (QWaylandServerBufferIntegration *ret = qLoadPlugin1(directLoader(), name, args)) + if (QWaylandServerBufferIntegration *ret = qLoadPlugin(directLoader(), name, args)) return ret; } - if (QWaylandServerBufferIntegration *ret = qLoadPlugin1(loader(), name, args)) + if (QWaylandServerBufferIntegration *ret = qLoadPlugin(loader(), name, args)) return ret; #endif return 0; diff --git a/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationfactory.cpp b/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationfactory.cpp index c069a3645a4..94eca326296 100644 --- a/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationfactory.cpp +++ b/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationfactory.cpp @@ -84,10 +84,10 @@ QWaylandInputDeviceIntegration *QWaylandInputDeviceIntegrationFactory::create(co // Try loading the plugin from platformPluginPath first: if (!pluginPath.isEmpty()) { QCoreApplication::addLibraryPath(pluginPath); - if (QWaylandInputDeviceIntegration *ret = qLoadPlugin1(directLoader(), name, args)) + if (QWaylandInputDeviceIntegration *ret = qLoadPlugin(directLoader(), name, args)) return ret; } - if (QWaylandInputDeviceIntegration *ret = qLoadPlugin1(loader(), name, args)) + if (QWaylandInputDeviceIntegration *ret = qLoadPlugin(loader(), name, args)) return ret; #endif return Q_NULLPTR; diff --git a/src/plugins/platforms/wayland/qwaylanddecorationfactory.cpp b/src/plugins/platforms/wayland/qwaylanddecorationfactory.cpp index 1279e3039f6..ccf2c806c3a 100644 --- a/src/plugins/platforms/wayland/qwaylanddecorationfactory.cpp +++ b/src/plugins/platforms/wayland/qwaylanddecorationfactory.cpp @@ -84,10 +84,10 @@ QWaylandAbstractDecoration *QWaylandDecorationFactory::create(const QString &nam // Try loading the plugin from platformPluginPath first: if (!pluginPath.isEmpty()) { QCoreApplication::addLibraryPath(pluginPath); - if (QWaylandAbstractDecoration *ret = qLoadPlugin1(directLoader(), name, args)) + if (QWaylandAbstractDecoration *ret = qLoadPlugin(directLoader(), name, args)) return ret; } - if (QWaylandAbstractDecoration *ret = qLoadPlugin1(loader(), name, args)) + if (QWaylandAbstractDecoration *ret = qLoadPlugin(loader(), name, args)) return ret; #endif diff --git a/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationfactory.cpp b/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationfactory.cpp index 8bee45c748f..09c62339b62 100644 --- a/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationfactory.cpp +++ b/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationfactory.cpp @@ -84,10 +84,10 @@ QWaylandShellIntegration *QWaylandShellIntegrationFactory::create(const QString // Try loading the plugin from platformPluginPath first: if (!pluginPath.isEmpty()) { QCoreApplication::addLibraryPath(pluginPath); - if (QWaylandShellIntegration *ret = qLoadPlugin1(directLoader(), name, args)) + if (QWaylandShellIntegration *ret = qLoadPlugin(directLoader(), name, args)) return ret; } - if (QWaylandShellIntegration *ret = qLoadPlugin1(loader(), name, args)) + if (QWaylandShellIntegration *ret = qLoadPlugin(loader(), name, args)) return ret; #endif return Q_NULLPTR; From 177c1ae57e16152b44b6481a4ec7fedb72007f47 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 2 Jun 2017 20:56:21 -0700 Subject: [PATCH 0437/1507] Disable the GCC warning about missing initializers New fields are appended to the structure, so we can't initialize them as we would lose compatibility with earlier versions of libwayland. So just disable the warning. Change-Id: Ia3e896da908f42939148fffd14c4806ce3468e56 Reviewed-by: Johan Helsing --- src/tools/qtwaylandscanner/qtwaylandscanner.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp index 5b9707a5a99..01dfa92157f 100644 --- a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp +++ b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp @@ -392,6 +392,8 @@ void process(QXmlStreamReader &xml, const QByteArray &headerPath, const QByteArr printf("\n"); printf("QT_BEGIN_NAMESPACE\n"); + printf("QT_WARNING_PUSH\n"); + printf("QT_WARNING_DISABLE_GCC(\"-Wmissing-field-initializers\")\n"); QByteArray serverExport; if (headerPath.size()) { serverExport = QByteArray("Q_WAYLAND_SERVER_") + preProcessorProtocolName + "_EXPORT"; @@ -533,6 +535,7 @@ void process(QXmlStreamReader &xml, const QByteArray &headerPath, const QByteArr printf("}\n"); printf("\n"); + printf("QT_WARNING_POP\n"); printf("QT_END_NAMESPACE\n"); printf("\n"); printf("#endif\n"); @@ -545,6 +548,8 @@ void process(QXmlStreamReader &xml, const QByteArray &headerPath, const QByteArr printf("#include <%s/qwayland-server-%s.h>\n", headerPath.constData(), QByteArray(protocolName).replace('_', '-').constData()); printf("\n"); printf("QT_BEGIN_NAMESPACE\n"); + printf("QT_WARNING_PUSH\n"); + printf("QT_WARNING_DISABLE_GCC(\"-Wmissing-field-initializers\")\n"); printf("\n"); printf("namespace QtWaylandServer {\n"); @@ -827,6 +832,7 @@ void process(QXmlStreamReader &xml, const QByteArray &headerPath, const QByteArr } printf("}\n"); printf("\n"); + printf("QT_WARNING_POP\n"); printf("QT_END_NAMESPACE\n"); } @@ -843,6 +849,8 @@ void process(QXmlStreamReader &xml, const QByteArray &headerPath, const QByteArr printf("#include \n"); printf("\n"); printf("QT_BEGIN_NAMESPACE\n"); + printf("QT_WARNING_PUSH\n"); + printf("QT_WARNING_DISABLE_GCC(\"-Wmissing-field-initializers\")\n"); QByteArray clientExport; @@ -940,6 +948,7 @@ void process(QXmlStreamReader &xml, const QByteArray &headerPath, const QByteArr } printf("}\n"); printf("\n"); + printf("QT_WARNING_POP\n"); printf("QT_END_NAMESPACE\n"); printf("\n"); printf("#endif\n"); @@ -952,6 +961,8 @@ void process(QXmlStreamReader &xml, const QByteArray &headerPath, const QByteArr printf("#include <%s/qwayland-%s.h>\n", headerPath.constData(), QByteArray(protocolName).replace('_', '-').constData()); printf("\n"); printf("QT_BEGIN_NAMESPACE\n"); + printf("QT_WARNING_PUSH\n"); + printf("QT_WARNING_DISABLE_GCC(\"-Wmissing-field-initializers\")\n"); printf("\n"); printf("namespace QtWayland {\n"); for (int j = 0; j < interfaces.size(); ++j) { @@ -1134,6 +1145,7 @@ void process(QXmlStreamReader &xml, const QByteArray &headerPath, const QByteArr } printf("}\n"); printf("\n"); + printf("QT_WARNING_POP\n"); printf("QT_END_NAMESPACE\n"); } } From 8618b4227f59726cd246996d0a837ccef1c400e3 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 2 Jun 2017 20:44:24 -0700 Subject: [PATCH 0438/1507] Add missing break Found by GCC 7 qwaylandinputmethodeventbuilder.cpp:110:51: warning: this statement may fall through [-Wimplicit-fallthrough=] Change-Id: Ia3e896da908f42939148fffd14c47fc6058b0933 Reviewed-by: Jan Arne Petersen Reviewed-by: Johan Helsing --- .../platforms/wayland/shared/qwaylandinputmethodeventbuilder.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/plugins/platforms/wayland/shared/qwaylandinputmethodeventbuilder.cpp b/src/plugins/platforms/wayland/shared/qwaylandinputmethodeventbuilder.cpp index 0e2d1a406b3..6acf312ed59 100644 --- a/src/plugins/platforms/wayland/shared/qwaylandinputmethodeventbuilder.cpp +++ b/src/plugins/platforms/wayland/shared/qwaylandinputmethodeventbuilder.cpp @@ -108,6 +108,7 @@ void QWaylandInputMethodEventBuilder::addPreeditStyling(uint32_t index, uint32_t format.setFontUnderline(true); format.setUnderlineStyle(QTextCharFormat::SingleUnderline); m_preeditStyles.append(QInputMethodEvent::Attribute(QInputMethodEvent::TextFormat, index, length, format)); + break; case 5: format.setFontUnderline(true); format.setUnderlineStyle(QTextCharFormat::WaveUnderline); From 7a41c0171c4ed2ecbafa81f2af2c4ba658775952 Mon Sep 17 00:00:00 2001 From: Giulio Camuffo Date: Mon, 3 Jul 2017 08:19:58 +0200 Subject: [PATCH 0439/1507] Use a non grabbing zxdg_popup_v6 for tooltips Change-Id: I9de16c48a1dee7728fb02faa590c112bd656aa09 Reviewed-by: David Edmundson Reviewed-by: Pier Luigi Fiorini --- src/plugins/platforms/wayland/qwaylandxdgshellv6.cpp | 10 ++++++---- src/plugins/platforms/wayland/qwaylandxdgshellv6_p.h | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandxdgshellv6.cpp b/src/plugins/platforms/wayland/qwaylandxdgshellv6.cpp index 9479402131d..cd81778c79c 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgshellv6.cpp +++ b/src/plugins/platforms/wayland/qwaylandxdgshellv6.cpp @@ -163,8 +163,8 @@ void QWaylandXdgSurfaceV6::setAppId(const QString &appId) void QWaylandXdgSurfaceV6::setType(Qt::WindowType type, QWaylandWindow *transientParent) { - if (type == Qt::Popup && transientParent) { - setPopup(transientParent, m_window->display()->lastInputDevice(), m_window->display()->lastInputSerial()); + if ((type == Qt::Popup || type == Qt::ToolTip) && transientParent) { + setPopup(transientParent, m_window->display()->lastInputDevice(), m_window->display()->lastInputSerial(), type == Qt::Popup); } else { setToplevel(); if (transientParent) { @@ -189,7 +189,7 @@ void QWaylandXdgSurfaceV6::setToplevel() m_toplevel = new Toplevel(this); } -void QWaylandXdgSurfaceV6::setPopup(QWaylandWindow *parent, QWaylandInputDevice *device, int serial) +void QWaylandXdgSurfaceV6::setPopup(QWaylandWindow *parent, QWaylandInputDevice *device, int serial, bool grab) { Q_ASSERT(!m_toplevel && !m_popup); @@ -209,7 +209,9 @@ void QWaylandXdgSurfaceV6::setPopup(QWaylandWindow *parent, QWaylandInputDevice m_popup = new Popup(this, parentXdgSurface, positioner); positioner->destroy(); delete positioner; - m_popup->grab(device->wl_seat(), serial); + if (grab) { + m_popup->grab(device->wl_seat(), serial); + } } void QWaylandXdgSurfaceV6::zxdg_surface_v6_configure(uint32_t serial) diff --git a/src/plugins/platforms/wayland/qwaylandxdgshellv6_p.h b/src/plugins/platforms/wayland/qwaylandxdgshellv6_p.h index 12f7301d550..769f19837b4 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgshellv6_p.h +++ b/src/plugins/platforms/wayland/qwaylandxdgshellv6_p.h @@ -121,7 +121,7 @@ private: }; void setToplevel(); - void setPopup(QWaylandWindow *parent, QWaylandInputDevice *device, int serial); + void setPopup(QWaylandWindow *parent, QWaylandInputDevice *device, int serial, bool grab); QWaylandXdgShellV6 *m_shell; QWaylandWindow *m_window; From 6a1f52c90d3bbe19b8be68494d16e8af25559b96 Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Wed, 19 Jul 2017 13:01:24 +0100 Subject: [PATCH 0440/1507] Reset mFrameCallback in destruction Otherwise we crash if we call reset twice. For example if we call setParent and setVisible together. Change-Id: I7f07825167bf8c3236a80e649a6d6805fd6c868b Reviewed-by: Johan Helsing --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 5585fd52aba..98d0603ccbd 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -249,8 +249,10 @@ void QWaylandWindow::reset() if (isInitialized()) destroy(); - if (mFrameCallback) + if (mFrameCallback) { wl_callback_destroy(mFrameCallback); + mFrameCallback = nullptr; + } } QWaylandWindow *QWaylandWindow::fromWlSurface(::wl_surface *surface) From 516c3b7fe9284dc9701556aff2499ada185f45a4 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Sun, 29 Jan 2012 12:58:59 +0100 Subject: [PATCH 0441/1507] QWaylandShmBuffer: use QTemporaryFile Instead of using mkstemp. Even current glibc versions do not open the file with O_CLOEXEC, so this code is not thread-safe. QTemporaryFile is. And since Qt 5.10, it will also use O_TMPFILE on Linux, so the file will not actually exists on disk. Take this opportunity to use the runtime directory instead of /tmp. There's no guarantee that the /tmp filesystem can support mmap'ing, while XDG_RUNTIME_DIR has that guarantee. It's also usually a tmpfs, so no data will be leaked to disk. Change-Id: I8d96dea9955d4c749b99fffd14cd5335d1114cef Reviewed-by: Giulio Camuffo --- .../wayland/qwaylandshmbackingstore.cpp | 32 +++++++------------ 1 file changed, 12 insertions(+), 20 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp b/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp index 045748a16c2..4c7c53b2f01 100644 --- a/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp +++ b/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp @@ -44,6 +44,8 @@ #include "qwaylandabstractdecoration_p.h" #include +#include +#include #include #include #include @@ -52,10 +54,7 @@ #include #include -#include -#include #include - QT_BEGIN_NAMESPACE namespace QtWaylandClient { @@ -72,28 +71,22 @@ QWaylandShmBuffer::QWaylandShmBuffer(QWaylandDisplay *display, { int stride = size.width() * 4; int alloc = stride * size.height(); - char filename[] = "/tmp/wayland-shm-XXXXXX"; - int fd = mkstemp(filename); - if (fd < 0) { - qWarning("mkstemp %s failed: %s", filename, strerror(errno)); - return; - } - int flags = fcntl(fd, F_GETFD); - if (flags != -1) - fcntl(fd, F_SETFD, flags | FD_CLOEXEC); + int fd; - if (ftruncate(fd, alloc) < 0) { - qWarning("ftruncate failed: %s", strerror(errno)); - close(fd); + QTemporaryFile tmp(QStandardPaths::writableLocation(QStandardPaths::RuntimeLocation) + + QLatin1String("/wayland-shm-XXXXXX")); + if (!tmp.open() || !tmp.resize(alloc)) { + qWarning("QWaylandShmBuffer: failed: %s", qUtf8Printable(tmp.errorString())); return; } + fd = tmp.handle(); + + // map ourselves: QFile::map() will unmap when the object is destroyed, + // but we want this mapping to persist (unmapping in destructor) uchar *data = (uchar *) mmap(NULL, alloc, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); - unlink(filename); - if (data == (uchar *) MAP_FAILED) { - qWarning("mmap /dev/zero failed: %s", strerror(errno)); - close(fd); + qErrnoWarning("QWaylandShmBuffer: mmap failed"); return; } @@ -105,7 +98,6 @@ QWaylandShmBuffer::QWaylandShmBuffer(QWaylandDisplay *display, mShmPool = wl_shm_create_pool(shm->object(), fd, alloc); init(wl_shm_pool_create_buffer(mShmPool,0, size.width(), size.height(), stride, wl_format)); - close(fd); } QWaylandShmBuffer::~QWaylandShmBuffer(void) From f41bd9c06eb8a5f78a661bdfa5a8ef4d378cdca9 Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Fri, 14 Jul 2017 14:04:48 +0100 Subject: [PATCH 0442/1507] Check surface exists when setting textinput focus QWaylandWindow resets the surface on various events. Handling focus comes in a posted event, so this can be after we've hidden a window and lost a surface. Task-number: QTBUG-61704 Change-Id: I535ff78c6bc2b86816696a08f8eebc47186d1225 Reviewed-by: Johan Helsing --- src/plugins/platforms/wayland/qwaylandinputcontext.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandinputcontext.cpp b/src/plugins/platforms/wayland/qwaylandinputcontext.cpp index dcc4ad5c7a0..fac5fb840ff 100644 --- a/src/plugins/platforms/wayland/qwaylandinputcontext.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputcontext.cpp @@ -541,8 +541,10 @@ void QWaylandInputContext::setFocusObject(QObject *) if (window && window->handle() && inputMethodAccepted()) { if (mCurrentWindow.data() != window) { struct ::wl_surface *surface = static_cast(window->handle())->object(); - textInput()->enable(surface); - mCurrentWindow = window; + if (surface) { + textInput()->enable(surface); + mCurrentWindow = window; + } } textInput()->updateState(Qt::ImQueryAll, QtWayland::zwp_text_input_v2::update_state_enter); } From 66af01b17f8ab8e39158fb9bb67a6d3ef3c17a15 Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Tue, 25 Jul 2017 14:40:41 +0200 Subject: [PATCH 0443/1507] Fallback to focusWindow as transient parent The wayland protocol requires Popup windows to have a transient parent set, in order to correctly position the window on the screen. In Qt, some popup menus don't have it, so they will appear misplaced in the screen. This adds an heuristic which makes transientParent() return the current application focus window, which is an approximation which won't be always correct, but seems to fix most applications Task-number: QTBUG-60932 Change-Id: Icec1e306d3f64f4f00ad735a8c2eedb99e85eabb Reviewed-by: Johan Helsing --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 98d0603ccbd..4a60a661684 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -720,6 +720,8 @@ QWaylandWindow *QWaylandWindow::transientParent() const // events. if (auto transientParent = window()->transientParent()) return static_cast(topLevelWindow(transientParent)->handle()); + else if (QGuiApplication::focusWindow() && (window()->type() == Qt::ToolTip || window()->type() == Qt::Popup)) + return static_cast(topLevelWindow(QGuiApplication::focusWindow())->handle()); return nullptr; } From afb68a09f2ad78760efac1b9595c0ea07ad044ef Mon Sep 17 00:00:00 2001 From: Frederik Gladhorn Date: Tue, 25 Jul 2017 12:11:06 +0200 Subject: [PATCH 0444/1507] Remove extra semicolon Change-Id: I3941d7e8caffb613f546e628c7e089e971d1e8b8 Reviewed-by: Johan Helsing --- src/plugins/platforms/wayland/qwaylandscreen_p.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandscreen_p.h b/src/plugins/platforms/wayland/qwaylandscreen_p.h index f5da2194c4a..526c94878f9 100644 --- a/src/plugins/platforms/wayland/qwaylandscreen_p.h +++ b/src/plugins/platforms/wayland/qwaylandscreen_p.h @@ -95,7 +95,7 @@ public: #if QT_CONFIG(cursor) QPlatformCursor *cursor() const override; - QWaylandCursor *waylandCursor() const { return mWaylandCursor; }; + QWaylandCursor *waylandCursor() const { return mWaylandCursor; } #endif uint32_t outputId() const { return m_outputId; } From 43d25e770cdcbcd16f15fc7915f66d0830d70ba5 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Mon, 26 Jun 2017 12:27:19 +0200 Subject: [PATCH 0445/1507] Update server buffer integration Fix crashes, and change the (private) API to be more usable. The libhybris code compiles without warnings, but is untested. Change-Id: I1433daf1ba76d7869d1dfe260642199ce5a1b849 Reviewed-by: Johan Helsing --- .../hardwareintegration/qwaylandserverbufferintegration_p.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegration_p.h b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegration_p.h index 67f857db890..3b8b3a6de2f 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegration_p.h +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegration_p.h @@ -59,6 +59,8 @@ QT_BEGIN_NAMESPACE +class QOpenGLTexture; + namespace QtWaylandClient { class QWaylandDisplay; @@ -74,7 +76,7 @@ public: QWaylandServerBuffer(); virtual ~QWaylandServerBuffer(); - virtual void bindTextureToBuffer() = 0; + virtual QOpenGLTexture *toOpenGlTexture() = 0; Format format() const; QSize size() const; From 9041247dc7264331ac5167c772a41f8cf66f56eb Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Fri, 21 Jul 2017 16:51:04 +0200 Subject: [PATCH 0446/1507] Try -lEGL when checking for wayland-egl This will detect wayland-egl on an imx6 without pkg-config Change-Id: I9c0fe6eef375fd0431a218c3b0407505c29eead9 Reviewed-by: Karim Pinter Reviewed-by: Paul Olav Tvete --- src/plugins/platforms/wayland/configure.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/configure.json b/src/plugins/platforms/wayland/configure.json index d216960e1db..b11416f688b 100644 --- a/src/plugins/platforms/wayland/configure.json +++ b/src/plugins/platforms/wayland/configure.json @@ -28,7 +28,8 @@ "test": "wayland_egl", "sources": [ { "type": "pkgConfig", "args": "wayland-egl" }, - "-lwayland-egl" + "-lwayland-egl", + "-lEGL" ] }, "xcomposite": { From 2a3676d8c47e655a4a8fa1c82cc408309e710435 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Tue, 15 Aug 2017 15:36:36 +0200 Subject: [PATCH 0447/1507] Use nullptr instead of 0 in qtwaylandscanner Change-Id: I5ffee26a4c0cd7726e007cc0692e403e15b5726e Reviewed-by: Pier Luigi Fiorini --- .../qtwaylandscanner/qtwaylandscanner.cpp | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp index 01dfa92157f..ed36a138698 100644 --- a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp +++ b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp @@ -432,7 +432,7 @@ void process(QXmlStreamReader &xml, const QByteArray &headerPath, const QByteArr printf(" class Resource\n"); printf(" {\n"); printf(" public:\n"); - printf(" Resource() : %s_object(0), handle(0) {}\n", interfaceNameStripped); + printf(" Resource() : %s_object(nullptr), handle(nullptr) {}\n", interfaceNameStripped); printf(" virtual ~Resource() {}\n"); printf("\n"); printf(" %s *%s_object;\n", interfaceName, interfaceNameStripped); @@ -458,8 +458,8 @@ void process(QXmlStreamReader &xml, const QByteArray &headerPath, const QByteArr printf(" QMultiMap resourceMap() { return m_resource_map; }\n"); printf(" const QMultiMap resourceMap() const { return m_resource_map; }\n"); printf("\n"); - printf(" bool isGlobal() const { return m_global != 0; }\n"); - printf(" bool isResource() const { return m_resource != 0; }\n"); + printf(" bool isGlobal() const { return m_global != nullptr; }\n"); + printf(" bool isResource() const { return m_resource != nullptr; }\n"); printf("\n"); printf(" static const struct ::wl_interface *interface();\n"); printf(" static QByteArray interfaceName() { return interface()->name; }\n"); @@ -572,8 +572,8 @@ void process(QXmlStreamReader &xml, const QByteArray &headerPath, const QByteArr printf(" %s::%s(struct ::wl_client *client, int id, int version)\n", interfaceName, interfaceName); printf(" : m_resource_map()\n"); - printf(" , m_resource(0)\n"); - printf(" , m_global(0)\n"); + printf(" , m_resource(nullptr)\n"); + printf(" , m_global(nullptr)\n"); printf(" {\n"); printf(" init(client, id, version);\n"); printf(" }\n"); @@ -581,8 +581,8 @@ void process(QXmlStreamReader &xml, const QByteArray &headerPath, const QByteArr printf(" %s::%s(struct ::wl_display *display, int version)\n", interfaceName, interfaceName); printf(" : m_resource_map()\n"); - printf(" , m_resource(0)\n"); - printf(" , m_global(0)\n"); + printf(" , m_resource(nullptr)\n"); + printf(" , m_global(nullptr)\n"); printf(" {\n"); printf(" init(display, version);\n"); printf(" }\n"); @@ -590,8 +590,8 @@ void process(QXmlStreamReader &xml, const QByteArray &headerPath, const QByteArr printf(" %s::%s(struct ::wl_resource *resource)\n", interfaceName, interfaceName); printf(" : m_resource_map()\n"); - printf(" , m_resource(0)\n"); - printf(" , m_global(0)\n"); + printf(" , m_resource(nullptr)\n"); + printf(" , m_global(nullptr)\n"); printf(" {\n"); printf(" init(resource);\n"); printf(" }\n"); @@ -599,8 +599,8 @@ void process(QXmlStreamReader &xml, const QByteArray &headerPath, const QByteArr printf(" %s::%s()\n", interfaceName, interfaceName); printf(" : m_resource_map()\n"); - printf(" , m_resource(0)\n"); - printf(" , m_global(0)\n"); + printf(" , m_resource(nullptr)\n"); + printf(" , m_global(nullptr)\n"); printf(" {\n"); printf(" }\n"); printf("\n"); @@ -689,7 +689,7 @@ void process(QXmlStreamReader &xml, const QByteArray &headerPath, const QByteArr bool hasRequests = !interface.requests.isEmpty(); - QByteArray interfaceMember = hasRequests ? "&m_" + interface.name + "_interface" : QByteArray("0"); + QByteArray interfaceMember = hasRequests ? "&m_" + interface.name + "_interface" : QByteArray("nullptr"); //We should consider changing bind so that it doesn't special case id == 0 //and use function overloading instead. Jan do you have a lot of code dependent on this behavior? @@ -717,7 +717,7 @@ void process(QXmlStreamReader &xml, const QByteArray &headerPath, const QByteArr printf(" {\n"); printf(" if (wl_resource_instance_of(resource, &::%s_interface, %s))\n", interfaceName, interfaceMember.constData()); printf(" return static_cast(resource->data);\n"); - printf(" return 0;\n"); + printf(" return nullptr;\n"); printf(" }\n"); if (hasRequests) { @@ -993,7 +993,7 @@ void process(QXmlStreamReader &xml, const QByteArray &headerPath, const QByteArr printf("\n"); printf(" %s::%s()\n", interfaceName, interfaceName); - printf(" : m_%s(0)\n", interfaceName); + printf(" : m_%s(nullptr)\n", interfaceName); printf(" {\n"); printf(" }\n"); printf("\n"); @@ -1021,7 +1021,7 @@ void process(QXmlStreamReader &xml, const QByteArray &headerPath, const QByteArr printf(" bool %s::isInitialized() const\n", interfaceName); printf(" {\n"); - printf(" return m_%s != 0;\n", interfaceName); + printf(" return m_%s != nullptr;\n", interfaceName); printf(" }\n"); printf("\n"); @@ -1087,7 +1087,7 @@ void process(QXmlStreamReader &xml, const QByteArray &headerPath, const QByteArr } printf(");\n"); if (e.type == "destructor") - printf(" m_%s = 0;\n", interfaceName); + printf(" m_%s = nullptr;\n", interfaceName); printf(" }\n"); } From 7f964c1bd0156079b53293b6bd1c10df630afb21 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Fri, 23 Jun 2017 12:43:31 +0200 Subject: [PATCH 0448/1507] shm-based server buffer for testing on desktop Change-Id: I2ea03f3366524d3133a65870abad9d9389dfec9c Reviewed-by: Johan Helsing --- .../shm-emulation-server-buffer.xml | 63 ++++++++++++++++++ .../plugins/hardwareintegration/client.pro | 3 + .../shm-emulation-server/main.cpp | 66 +++++++++++++++++++ .../shm-emulation-server.json | 3 + .../shm-emulation-server.pro | 15 +++++ 5 files changed, 150 insertions(+) create mode 100644 src/3rdparty/wayland/extensions/shm-emulation-server-buffer.xml create mode 100644 src/plugins/platforms/wayland/plugins/hardwareintegration/shm-emulation-server/main.cpp create mode 100644 src/plugins/platforms/wayland/plugins/hardwareintegration/shm-emulation-server/shm-emulation-server.json create mode 100644 src/plugins/platforms/wayland/plugins/hardwareintegration/shm-emulation-server/shm-emulation-server.pro diff --git a/src/3rdparty/wayland/extensions/shm-emulation-server-buffer.xml b/src/3rdparty/wayland/extensions/shm-emulation-server-buffer.xml new file mode 100644 index 00000000000..7fb7069f2e7 --- /dev/null +++ b/src/3rdparty/wayland/extensions/shm-emulation-server-buffer.xml @@ -0,0 +1,63 @@ + + + + Copyright (C) 2017 The Qt Company Ltd. + Contact: http://www.qt.io/licensing/ + + This file is part of the plugins of the Qt Toolkit. + + $QT_BEGIN_LICENSE:BSD$ + You may use this file under the terms of the BSD license as follows: + + "Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + * Neither the name of The Qt Company Ltd nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." + + $QT_END_LICENSE$ + + + + This is software-based implementation of the qt_server_buffer extension. + It is intended for testing and debugging purposes only. + + + + + + + + Informs the client about a newly created server buffer. + The "key" argument contains a QSharedMemory key. + + + + + + + + + + + diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/client.pro b/src/plugins/platforms/wayland/plugins/hardwareintegration/client.pro index a5967c710dd..f1c71f08455 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/client.pro +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/client.pro @@ -13,3 +13,6 @@ qtConfig(drm-egl-server): \ SUBDIRS += drm-egl-server qtConfig(libhybris-egl-server): \ SUBDIRS += libhybris-egl-server + +### TODO: make shm-emulation configurable +SUBDIRS += shm-emulation-server diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/shm-emulation-server/main.cpp b/src/plugins/platforms/wayland/plugins/hardwareintegration/shm-emulation-server/main.cpp new file mode 100644 index 00000000000..8c3ba842053 --- /dev/null +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/shm-emulation-server/main.cpp @@ -0,0 +1,66 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include "shmserverbufferintegration.h" + +QT_BEGIN_NAMESPACE + +namespace QtWaylandClient { + +class ShmServerBufferPlugin : public QWaylandServerBufferIntegrationPlugin +{ + Q_OBJECT + Q_PLUGIN_METADATA(IID QWaylandServerBufferIntegrationFactoryInterface_iid FILE "shm-emulation-server.json") +public: + QWaylandServerBufferIntegration *create(const QString&, const QStringList&) override; +}; + +QWaylandServerBufferIntegration *ShmServerBufferPlugin::create(const QString& system, const QStringList& paramList) +{ + Q_UNUSED(paramList); + Q_UNUSED(system); + return new ShmServerBufferIntegration(); +} + +} + +QT_END_NAMESPACE + +#include "main.moc" diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/shm-emulation-server/shm-emulation-server.json b/src/plugins/platforms/wayland/plugins/hardwareintegration/shm-emulation-server/shm-emulation-server.json new file mode 100644 index 00000000000..1bf8ded8754 --- /dev/null +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/shm-emulation-server/shm-emulation-server.json @@ -0,0 +1,3 @@ +{ + "Keys": [ "shm-emulation-server" ] +} diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/shm-emulation-server/shm-emulation-server.pro b/src/plugins/platforms/wayland/plugins/hardwareintegration/shm-emulation-server/shm-emulation-server.pro new file mode 100644 index 00000000000..8b1c6e5f2da --- /dev/null +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/shm-emulation-server/shm-emulation-server.pro @@ -0,0 +1,15 @@ +# We have a bunch of C code with casts, so we can't have this option +QMAKE_CXXFLAGS_WARN_ON -= -Wcast-qual + +QT += waylandclient-private + +include(../../../../hardwareintegration/client/shm-emulation-server/shm-emulation-server.pri) + +OTHER_FILES += \ + shm-emulation-server.json + +SOURCES += main.cpp + +PLUGIN_TYPE = wayland-graphics-integration-client +PLUGIN_CLASS_NAME = ShmServerBufferPlugin +load(qt_plugin) From 32daa1a5b9ac06ae89d3aab5b4638139e72814e2 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Sat, 1 Jul 2017 19:08:46 -0700 Subject: [PATCH 0449/1507] QWaylandShmBuffer: use a memfd if we can for a simple memory buffer which has a file descriptor we can also use to share with Change-Id: I8d96dea9955d4c749b99fffd14cd61628c616b30 Reviewed-by: Johan Helsing Reviewed-by: Thiago Macieira --- .../wayland/qwaylandshmbackingstore.cpp | 33 +++++++++++++++---- 1 file changed, 27 insertions(+), 6 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp b/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp index 4c7c53b2f01..2085bc5977c 100644 --- a/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp +++ b/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp @@ -55,6 +55,13 @@ #include #include + +#ifdef Q_OS_LINUX +# include +// from linux/memfd.h: +# define MFD_CLOEXEC 0x0001U +#endif + QT_BEGIN_NAMESPACE namespace QtWaylandClient { @@ -71,15 +78,29 @@ QWaylandShmBuffer::QWaylandShmBuffer(QWaylandDisplay *display, { int stride = size.width() * 4; int alloc = stride * size.height(); - int fd; + int fd = -1; - QTemporaryFile tmp(QStandardPaths::writableLocation(QStandardPaths::RuntimeLocation) + - QLatin1String("/wayland-shm-XXXXXX")); - if (!tmp.open() || !tmp.resize(alloc)) { - qWarning("QWaylandShmBuffer: failed: %s", qUtf8Printable(tmp.errorString())); +#ifdef SYS_memfd_create + fd = syscall(SYS_memfd_create, "wayland-shm", MFD_CLOEXEC); +#endif + + QScopedPointer filePointer; + + if (fd == -1) { + auto tmpFile = new QTemporaryFile (QStandardPaths::writableLocation(QStandardPaths::RuntimeLocation) + + QLatin1String("/wayland-shm-XXXXXX")); + tmpFile->open(); + filePointer.reset(tmpFile); + } else { + auto file = new QFile; + file->open(fd, QIODevice::ReadWrite | QIODevice::Unbuffered, QFile::AutoCloseHandle); + filePointer.reset(file); + } + if (!filePointer->isOpen() || !filePointer->resize(alloc)) { + qWarning("QWaylandShmBuffer: failed: %s", qUtf8Printable(filePointer->errorString())); return; } - fd = tmp.handle(); + fd = filePointer->handle(); // map ourselves: QFile::map() will unmap when the object is destroyed, // but we want this mapping to persist (unmapping in destructor) From 027a7131543b0194a7d9e98a6b53928e30bc080f Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Wed, 30 Aug 2017 14:00:51 +0200 Subject: [PATCH 0450/1507] Fix crash when window attach is called without waiting for frame callbacks If QWaylandWindow::attach was called before getting the frame callback, it would overwrite mFrameCallback. Hence, all but the last frame callback would still be alive after the QWaylandWindow destructor. When the dangling callbacks got invoked the data pointer was statically casted to the deleted QWaylandWindow, resulting in undefined behavior. In this change we only delete frame callbacks from the render thread, avoiding a race condition we fixed earlier. And we always destroy the frame callback when adding a new one, ensuring that the destructor will clean up the only remaining callback. There's a test confirming that the crash has been fixed. This fixes the flakiness of many of the qtbase auto tests. Change-Id: Iecb08ab48216eac61b1ebc5c0e0664d4aac900c0 Reviewed-by: Paul Olav Tvete --- .../platforms/wayland/qwaylandwindow.cpp | 13 +++++---- .../platforms/wayland/qwaylandwindow_p.h | 3 +-- tests/auto/wayland/client/tst_client.cpp | 27 +++++++++++++++++++ 3 files changed, 34 insertions(+), 9 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 4a60a661684..eeba6c85fb2 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -86,7 +86,6 @@ QWaylandWindow::QWaylandWindow(QWindow *window) , mMouseEventsInContentArea(false) , mMousePressedInContentArea(Qt::NoButton) , mWaitingForFrameSync(false) - , mFrameCallback(nullptr) , mRequestResizeSent(false) , mCanResize(true) , mResizeDirty(false) @@ -475,12 +474,14 @@ void QWaylandWindow::requestResize() void QWaylandWindow::attach(QWaylandBuffer *buffer, int x, int y) { - mFrameCallback = nullptr; + if (mFrameCallback) { + wl_callback_destroy(mFrameCallback); + mFrameCallback = nullptr; + } if (buffer) { - auto callback = frame(); - wl_callback_add_listener(callback, &QWaylandWindow::callbackListener, this); - mFrameCallback = callback; + mFrameCallback = frame(); + wl_callback_add_listener(mFrameCallback, &QWaylandWindow::callbackListener, this); mWaitingForFrameSync = true; buffer->setBusy(); @@ -523,8 +524,6 @@ void QWaylandWindow::frameCallback(void *data, struct wl_callback *callback, uin QWaylandWindow *self = static_cast(data); self->mWaitingForFrameSync = false; - wl_callback_destroy(callback); - self->mFrameCallback.testAndSetRelaxed(callback, nullptr); if (self->mUpdateRequested) { QWindowPrivate *w = QWindowPrivate::get(self->window()); self->mUpdateRequested = false; diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index 29eb6c59687..fa213d07ae8 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -53,7 +53,6 @@ #include #include -#include #include #include @@ -222,7 +221,7 @@ protected: WId mWindowId; bool mWaitingForFrameSync; - QAtomicPointer mFrameCallback; + struct ::wl_callback *mFrameCallback = nullptr; QWaitCondition mFrameSyncWait; QMutex mResizeLock; diff --git a/tests/auto/wayland/client/tst_client.cpp b/tests/auto/wayland/client/tst_client.cpp index 0c9c007a298..8acddfbe740 100644 --- a/tests/auto/wayland/client/tst_client.cpp +++ b/tests/auto/wayland/client/tst_client.cpp @@ -142,6 +142,7 @@ private slots: void backingStore(); void touchDrag(); void mouseDrag(); + void dontCrashOnMultipleCommits(); private: MockCompositor *compositor; @@ -333,6 +334,32 @@ void tst_WaylandClient::mouseDrag() QTRY_VERIFY(window.dragStarted); } +void tst_WaylandClient::dontCrashOnMultipleCommits() +{ + auto window = new TestWindow(); + window->show(); + + QRect rect(QPoint(), window->size()); + + QBackingStore backingStore(window); + backingStore.resize(rect.size()); + backingStore.beginPaint(rect); + QPainter p(backingStore.paintDevice()); + p.fillRect(rect, Qt::magenta); + p.end(); + backingStore.endPaint(); + + backingStore.flush(rect); + backingStore.flush(rect); + backingStore.flush(rect); + + compositor->processWaylandEvents(); + + delete window; + + QTRY_VERIFY(!compositor->surface()); +} + int main(int argc, char **argv) { setenv("XDG_RUNTIME_DIR", ".", 1); From 844002cb81960c2408b2dee44c56f1f7561bdcbb Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Fri, 21 Jul 2017 10:21:22 +0200 Subject: [PATCH 0451/1507] Close popups in the correct order According to the protocol, child popups have to be closed before parents, but QMenuBar/QMenu will sometimes close the parent first. Change-Id: Id027ac483b727a19388df619fe1503d794e12c12 Task-number: QTBUG-62048 Reviewed-by: Johan Helsing --- .../platforms/wayland/qwaylandwindow.cpp | 19 +++++++++++++++++++ .../platforms/wayland/qwaylandwindow_p.h | 1 + 2 files changed, 20 insertions(+) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index eeba6c85fb2..6649493b6c6 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -341,9 +341,26 @@ void QWaylandWindow::sendExposeEvent(const QRect &rect) QWindowSystemInterface::handleExposeEvent(window(), rect); } + +static QVector> activePopups; + +void QWaylandWindow::closePopups(QWaylandWindow *parent) +{ + while (!activePopups.isEmpty()) { + auto popup = activePopups.takeLast(); + if (popup.isNull()) + continue; + if (popup.data() == parent) + return; + popup->reset(); + } +} + void QWaylandWindow::setVisible(bool visible) { if (visible) { + if (window()->type() == Qt::Popup) + activePopups << this; initWindow(); mDisplay->flushRequests(); @@ -357,6 +374,8 @@ void QWaylandWindow::setVisible(bool visible) // case 'this' will be deleted. When that happens, we must abort right away. QPointer deleteGuard(this); QWindowSystemInterface::flushWindowSystemEvents(); + if (!deleteGuard.isNull() && window()->type() == Qt::Popup) + closePopups(this); if (!deleteGuard.isNull()) reset(); } diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index fa213d07ae8..e7b9e3d3852 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -253,6 +253,7 @@ private: bool shouldCreateSubSurface() const; void reset(); void sendExposeEvent(const QRect &rect); + static void closePopups(QWaylandWindow *parent); void handleMouseEventWithDecoration(QWaylandInputDevice *inputDevice, const QWaylandPointerEvent &e); From f35dc39ae9029f27ea1eed949139e4827995bc5a Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Thu, 17 Aug 2017 13:20:04 +0200 Subject: [PATCH 0452/1507] Set window screen from wl_surface.enter and leave events Removes the pointer mScreen, which would previously cause a crash if the screen was removed. Ensures that QWindow::screen() is correct, except in the cases where: - The compositor has not yet sent enter and leave events (in which case the primary output is returned). - The compositor is not sending enter and leave events (although this is mandatory, some compositors don't do this). - The application developer has tried to move the window with QWindow::setScreen(QScreen *). Since there is no way for a client to ask to be moved to a specific monitor in windowed mode, we return the requested screen until a new enter or leave event is received. This will also be useful when implementing/fixing features where the current screen matters. Examples are QT_AUTO_SCREEN_SCALE_FACTOR and the optional output parameter to wl_shell_surface.set_fullscreen. Task-number: QTBUG-62044 Change-Id: Iafde2e278fbc8876e8dafe5b2a4d2482fdc7961a Reviewed-by: Paul Olav Tvete --- .../platforms/wayland/qwaylandscreen.cpp | 6 ++ .../platforms/wayland/qwaylandscreen_p.h | 1 + .../platforms/wayland/qwaylandwindow.cpp | 65 ++++++++++++++++++- .../platforms/wayland/qwaylandwindow_p.h | 11 +++- 4 files changed, 78 insertions(+), 5 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandscreen.cpp b/src/plugins/platforms/wayland/qwaylandscreen.cpp index ac595457793..334e0ec4602 100644 --- a/src/plugins/platforms/wayland/qwaylandscreen.cpp +++ b/src/plugins/platforms/wayland/qwaylandscreen.cpp @@ -175,6 +175,12 @@ QWaylandScreen * QWaylandScreen::waylandScreenFromWindow(QWindow *window) return static_cast(platformScreen); } +QWaylandScreen *QWaylandScreen::fromWlOutput(::wl_output *output) +{ + auto wlOutput = static_cast(wl_output_get_user_data(output)); + return static_cast(wlOutput); +} + void QWaylandScreen::output_mode(uint32_t flags, int width, int height, int refresh) { if (!(flags & WL_OUTPUT_MODE_CURRENT)) diff --git a/src/plugins/platforms/wayland/qwaylandscreen_p.h b/src/plugins/platforms/wayland/qwaylandscreen_p.h index b2900a964f1..3d4df6e6619 100644 --- a/src/plugins/platforms/wayland/qwaylandscreen_p.h +++ b/src/plugins/platforms/wayland/qwaylandscreen_p.h @@ -99,6 +99,7 @@ public: ::wl_output *output() { return object(); } static QWaylandScreen *waylandScreenFromWindow(QWindow *window); + static QWaylandScreen *fromWlOutput(::wl_output *output); private: void output_mode(uint32_t flags, int width, int height, int refresh) override; diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 6649493b6c6..e5edd0e5e5c 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -69,6 +69,8 @@ #include +#include + QT_BEGIN_NAMESPACE namespace QtWaylandClient { @@ -78,8 +80,7 @@ QWaylandWindow *QWaylandWindow::mMouseGrab = 0; QWaylandWindow::QWaylandWindow(QWindow *window) : QObject() , QPlatformWindow(window) - , mScreen(QWaylandScreen::waylandScreenFromWindow(window)) - , mDisplay(mScreen->display()) + , mDisplay(screen()->display()) , mShellSurface(0) , mSubSurfaceWindow(0) , mWindowDecoration(0) @@ -99,6 +100,7 @@ QWaylandWindow::QWaylandWindow(QWindow *window) { static WId id = 1; mWindowId = id++; + connect(qApp, &QGuiApplication::screenRemoved, this, &QWaylandWindow::handleScreenRemoved); initializeWlSurface(); } @@ -356,6 +358,11 @@ void QWaylandWindow::closePopups(QWaylandWindow *parent) } } +QWaylandScreen *QWaylandWindow::calculateScreenFromSurfaceEvents() const +{ + return mScreens.isEmpty() ? screen() : mScreens.first(); +} + void QWaylandWindow::setVisible(bool visible) { if (visible) { @@ -491,6 +498,53 @@ void QWaylandWindow::requestResize() QWindowSystemInterface::flushWindowSystemEvents(); } +void QWaylandWindow::surface_enter(wl_output *output) +{ + QWaylandScreen *oldScreen = calculateScreenFromSurfaceEvents(); + auto addedScreen = QWaylandScreen::fromWlOutput(output); + + if (mScreens.contains(addedScreen)) { + qWarning() << "Unexpected wl_surface.enter received for output with id:" + << wl_proxy_get_id(reinterpret_cast(output)) + << "screen name:" << addedScreen->name() << "screen model:" << addedScreen->model(); + return; + } + + mScreens.append(addedScreen); + + QWaylandScreen *newScreen = calculateScreenFromSurfaceEvents(); + if (oldScreen != newScreen) //currently this will only happen if the first wl_surface.enter is for a non-primary screen + QWindowSystemInterface::handleWindowScreenChanged(window(), newScreen->QPlatformScreen::screen()); +} + +void QWaylandWindow::surface_leave(wl_output *output) +{ + QWaylandScreen *oldScreen = calculateScreenFromSurfaceEvents(); + auto *removedScreen = QWaylandScreen::fromWlOutput(output); + bool wasRemoved = mScreens.removeOne(removedScreen); + if (!wasRemoved) { + qWarning() << "Unexpected wl_surface.leave received for output with id:" + << wl_proxy_get_id(reinterpret_cast(output)) + << "screen name:" << removedScreen->name() << "screen model:" << removedScreen->model(); + return; + } + + QWaylandScreen *newScreen = calculateScreenFromSurfaceEvents(); + if (oldScreen != newScreen) + QWindowSystemInterface::handleWindowScreenChanged(window(), newScreen->QPlatformScreen::screen()); +} + +void QWaylandWindow::handleScreenRemoved(QScreen *qScreen) +{ + QWaylandScreen *oldScreen = calculateScreenFromSurfaceEvents(); + bool wasRemoved = mScreens.removeOne(static_cast(qScreen->handle())); + if (wasRemoved) { + QWaylandScreen *newScreen = calculateScreenFromSurfaceEvents(); + if (oldScreen != newScreen) + QWindowSystemInterface::handleWindowScreenChanged(window(), newScreen->QPlatformScreen::screen()); + } +} + void QWaylandWindow::attach(QWaylandBuffer *buffer, int x, int y) { if (mFrameCallback) { @@ -579,6 +633,11 @@ QWaylandSubSurface *QWaylandWindow::subSurfaceWindow() const return mSubSurfaceWindow; } +QWaylandScreen *QWaylandWindow::screen() const +{ + return static_cast(QPlatformWindow::screen()); +} + void QWaylandWindow::handleContentOrientationChange(Qt::ScreenOrientation orientation) { if (mDisplay->compositorVersion() < 2) @@ -843,7 +902,7 @@ void QWaylandWindow::handleMouseEventWithDecoration(QWaylandInputDevice *inputDe #if QT_CONFIG(cursor) void QWaylandWindow::setMouseCursor(QWaylandInputDevice *device, const QCursor &cursor) { - device->setCursor(cursor, mScreen); + device->setCursor(cursor, screen()); } void QWaylandWindow::restoreMouseCursor(QWaylandInputDevice *device) diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index e7b9e3d3852..bd4a359090f 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -142,7 +142,7 @@ public: QWaylandDisplay *display() const { return mDisplay; } QWaylandShellSurface *shellSurface() const; QWaylandSubSurface *subSurfaceWindow() const; - QWaylandScreen *screen() const { return mScreen; } + QWaylandScreen *screen() const; void handleContentOrientationChange(Qt::ScreenOrientation orientation) override; void setOrientationMask(Qt::ScreenOrientations mask); @@ -209,7 +209,10 @@ public slots: void requestResize(); protected: - QWaylandScreen *mScreen; + void surface_enter(struct ::wl_output *output) override; + void surface_leave(struct ::wl_output *output) override; + + QVector mScreens; //As seen by wl_surface.enter/leave events. Chronological order. QWaylandDisplay *mDisplay; QWaylandShellSurface *mShellSurface; QWaylandSubSurface *mSubSurfaceWindow; @@ -244,6 +247,9 @@ protected: QWaylandShmBackingStore *mBackingStore; +private slots: + void handleScreenRemoved(QScreen *qScreen); + private: bool setWindowStateInternal(Qt::WindowState flags); void setGeometry_helper(const QRect &rect); @@ -254,6 +260,7 @@ private: void reset(); void sendExposeEvent(const QRect &rect); static void closePopups(QWaylandWindow *parent); + QWaylandScreen *calculateScreenFromSurfaceEvents() const; void handleMouseEventWithDecoration(QWaylandInputDevice *inputDevice, const QWaylandPointerEvent &e); From 61510d62d1f8a8ca7d8fa625ec0b558a3a9a8db5 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Wed, 13 Sep 2017 13:40:05 +0200 Subject: [PATCH 0453/1507] Temporarily rename QWaylandWindow::screen to waylandScreen MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The function is being made virtual in qtbase. Rename it to avoid issues with CI (missing override). It can be renamed back and made to override later. Task-number: QTBUG-63177 Change-Id: I4e3029445b34c53bfdd3e99254a690a1fac6f06e Reviewed-by: Jędrzej Nowacki Reviewed-by: Jesus Fernandez --- src/plugins/platforms/wayland/qwaylandscreen.cpp | 2 +- src/plugins/platforms/wayland/qwaylandwindow.cpp | 2 +- src/plugins/platforms/wayland/qwaylandwindow_p.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandscreen.cpp b/src/plugins/platforms/wayland/qwaylandscreen.cpp index 7f12a4214f5..2f90be813cc 100644 --- a/src/plugins/platforms/wayland/qwaylandscreen.cpp +++ b/src/plugins/platforms/wayland/qwaylandscreen.cpp @@ -147,7 +147,7 @@ void QWaylandScreen::setOrientationUpdateMask(Qt::ScreenOrientations mask) { foreach (QWindow *window, QGuiApplication::allWindows()) { QWaylandWindow *w = static_cast(window->handle()); - if (w && w->screen() == this) + if (w && w->waylandScreen() == this) w->setOrientationMask(mask); } } diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 9cc673c0c4f..97596896fff 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -193,7 +193,7 @@ void QWaylandWindow::initWindow() } } - mScale = screen()->scale(); + mScale = waylandScreen()->scale(); // Enable high-dpi rendering. Scale() returns the screen scale factor and will // typically be integer 1 (normal-dpi) or 2 (high-dpi). Call set_buffer_scale() diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index 9f6ff5b4eeb..6e07ff1c7a3 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -143,7 +143,7 @@ public: QWaylandDisplay *display() const { return mDisplay; } QWaylandShellSurface *shellSurface() const; QWaylandSubSurface *subSurfaceWindow() const; - QWaylandScreen *screen() const { return mScreen; } + QWaylandScreen *waylandScreen() const { return mScreen; } void handleContentOrientationChange(Qt::ScreenOrientation orientation) override; void setOrientationMask(Qt::ScreenOrientations mask); From 1a0939a8de214108783aaa646ebf63e3bc2641f9 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Fri, 8 Sep 2017 11:33:20 +0200 Subject: [PATCH 0454/1507] Fix server buffer integration override logic Assign to the actual variable instead of a new one with the same name. Change-Id: I9e4c3525891ff53f0194198b9c11f223df4c14a9 Reviewed-by: David Edmundson Reviewed-by: Eirik Aavitsland --- src/plugins/platforms/wayland/qwaylandintegration.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandintegration.cpp b/src/plugins/platforms/wayland/qwaylandintegration.cpp index 400f3517c81..bffadf29a49 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandintegration.cpp @@ -359,7 +359,7 @@ void QWaylandIntegration::initializeServerBufferIntegration() disableHardwareIntegration = disableHardwareIntegration || !mDisplay->hardwareIntegration(); if (disableHardwareIntegration) { QByteArray serverBufferIntegrationName = qgetenv("QT_WAYLAND_SERVER_BUFFER_INTEGRATION"); - QString targetKey = QString::fromLocal8Bit(serverBufferIntegrationName); + targetKey = QString::fromLocal8Bit(serverBufferIntegrationName); } else { targetKey = mDisplay->hardwareIntegration()->serverBufferIntegration(); } From 458b1bc6c18e476952d5168a2c3346f4275c4c0d Mon Sep 17 00:00:00 2001 From: Kevin Funk Date: Sun, 24 Sep 2017 23:55:04 +0200 Subject: [PATCH 0455/1507] Replace Q_NULLPTR with nullptr Change-Id: I9699a957430b8d3574ce29acb91b7ada9ea6209b Reviewed-by: Jan Arne Petersen Reviewed-by: Johan Helsing Reviewed-by: Lars Knoll --- .../qwaylandclientbufferintegration_p.h | 4 ++-- .../qwaylandinputdeviceintegrationfactory.cpp | 2 +- src/plugins/platforms/wayland/qwaylandcursor.cpp | 2 +- src/plugins/platforms/wayland/qwaylanddatadevice.cpp | 4 ++-- src/plugins/platforms/wayland/qwaylanddisplay.cpp | 8 ++++---- src/plugins/platforms/wayland/qwaylandintegration.cpp | 2 +- src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp | 2 +- src/plugins/platforms/wayland/qwaylandwindow.cpp | 4 ++-- .../platforms/wayland/qwaylandwlshellintegration.cpp | 2 +- src/plugins/platforms/wayland/qwaylandwlshellsurface.cpp | 2 +- .../platforms/wayland/qwaylandxdgshellintegration.cpp | 2 +- src/plugins/platforms/wayland/qwaylandxdgsurface.cpp | 4 ++-- .../shellintegration/qwaylandshellintegrationfactory.cpp | 2 +- tests/auto/cmake/test_waylandclient/main.cpp | 2 +- tests/auto/wayland/client/mockinput.cpp | 8 ++++---- tests/auto/wayland/client/mocksurface.cpp | 2 +- 16 files changed, 26 insertions(+), 26 deletions(-) diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegration_p.h b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegration_p.h index f1f0cf93282..7776c61582f 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegration_p.h +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegration_p.h @@ -86,8 +86,8 @@ public: EglConfig, EglContext }; - virtual void *nativeResource(NativeResource /*resource*/) { return Q_NULLPTR; } - virtual void *nativeResourceForContext(NativeResource /*resource*/, QPlatformOpenGLContext */*context*/) { return Q_NULLPTR; } + virtual void *nativeResource(NativeResource /*resource*/) { return nullptr; } + virtual void *nativeResourceForContext(NativeResource /*resource*/, QPlatformOpenGLContext */*context*/) { return nullptr; } }; } diff --git a/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationfactory.cpp b/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationfactory.cpp index 94eca326296..8f573064ef1 100644 --- a/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationfactory.cpp +++ b/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationfactory.cpp @@ -90,7 +90,7 @@ QWaylandInputDeviceIntegration *QWaylandInputDeviceIntegrationFactory::create(co if (QWaylandInputDeviceIntegration *ret = qLoadPlugin(loader(), name, args)) return ret; #endif - return Q_NULLPTR; + return nullptr; } } diff --git a/src/plugins/platforms/wayland/qwaylandcursor.cpp b/src/plugins/platforms/wayland/qwaylandcursor.cpp index 7caa247e52f..6ce2b7bbca4 100644 --- a/src/plugins/platforms/wayland/qwaylandcursor.cpp +++ b/src/plugins/platforms/wayland/qwaylandcursor.cpp @@ -92,7 +92,7 @@ struct wl_cursor_image *QWaylandCursor::cursorImage(Qt::CursorShape newShape) waylandCursor = requestCursor((WaylandCursor)newShape); } else if (newShape == Qt::BitmapCursor) { // cannot create a wl_cursor_image for a CursorShape - return Q_NULLPTR; + return nullptr; } else { //TODO: Custom cursor logic (for resize arrows) } diff --git a/src/plugins/platforms/wayland/qwaylanddatadevice.cpp b/src/plugins/platforms/wayland/qwaylanddatadevice.cpp index 33068c5e97a..66f36f75be7 100644 --- a/src/plugins/platforms/wayland/qwaylanddatadevice.cpp +++ b/src/plugins/platforms/wayland/qwaylanddatadevice.cpp @@ -97,7 +97,7 @@ void QWaylandDataDevice::setSelectionSource(QWaylandDataSource *source) { if (source) connect(source, &QWaylandDataSource::cancelled, this, &QWaylandDataDevice::selectionSourceCancelled); - set_selection(source ? source->object() : Q_NULLPTR, m_inputDevice->serial()); + set_selection(source ? source->object() : nullptr, m_inputDevice->serial()); m_selectionSource.reset(source); } @@ -160,7 +160,7 @@ void QWaylandDataDevice::data_device_enter(uint32_t serial, wl_surface *surface, m_dragWindow = QWaylandWindow::fromWlSurface(surface)->window(); m_dragPoint = calculateDragPosition(x, y, m_dragWindow); - QMimeData *dragData = Q_NULLPTR; + QMimeData *dragData = nullptr; Qt::DropActions supportedActions; m_dragOffer.reset(static_cast(wl_data_offer_get_user_data(id))); diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index 86cfe1a0d6c..b2372f08898 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -136,8 +136,8 @@ QWaylandDisplay::QWaylandDisplay(QWaylandIntegration *waylandIntegration) , mLastInputSerial(0) , mLastInputDevice(0) , mLastInputWindow(0) - , mLastKeyboardFocus(Q_NULLPTR) - , mSyncCallback(Q_NULLPTR) + , mLastKeyboardFocus(nullptr) + , mSyncCallback(nullptr) { qRegisterMetaType("uint32_t"); @@ -446,7 +446,7 @@ void QWaylandDisplay::handleWaylandSync() // This callback is used to set the window activation because we may get an activate/deactivate // pair, and the latter one would be lost in the QWindowSystemInterface queue, if we issue the // handleWindowActivated() calls immediately. - QWindow *activeWindow = mActiveWindows.empty() ? Q_NULLPTR : mActiveWindows.last()->window(); + QWindow *activeWindow = mActiveWindows.empty() ? nullptr : mActiveWindows.last()->window(); if (activeWindow != QGuiApplication::focusWindow()) QWindowSystemInterface::handleWindowActivated(activeWindow); } @@ -456,7 +456,7 @@ const wl_callback_listener QWaylandDisplay::syncCallbackListener = { Q_UNUSED(time); wl_callback_destroy(callback); QWaylandDisplay *display = static_cast(data); - display->mSyncCallback = Q_NULLPTR; + display->mSyncCallback = nullptr; display->handleWaylandSync(); } }; diff --git a/src/plugins/platforms/wayland/qwaylandintegration.cpp b/src/plugins/platforms/wayland/qwaylandintegration.cpp index 400f3517c81..03aedd6b63a 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandintegration.cpp @@ -122,7 +122,7 @@ public: QWaylandIntegration::QWaylandIntegration() : mClientBufferIntegration(0) - , mInputDeviceIntegration(Q_NULLPTR) + , mInputDeviceIntegration(nullptr) , mFontDb(new QGenericUnixFontDatabase()) , mNativeInterface(new QWaylandNativeInterface(this)) #if QT_CONFIG(accessibility) diff --git a/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp b/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp index 2085bc5977c..a7bc241651a 100644 --- a/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp +++ b/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp @@ -171,7 +171,7 @@ QWaylandShmBackingStore::QWaylandShmBackingStore(QWindow *window) QWaylandShmBackingStore::~QWaylandShmBackingStore() { if (QWaylandWindow *w = waylandWindow()) - w->setBackingStore(Q_NULLPTR); + w->setBackingStore(nullptr); // if (mFrontBuffer == waylandWindow()->attached()) // waylandWindow()->attach(0); diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 97596896fff..cd846c0ba0e 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -95,7 +95,7 @@ QWaylandWindow::QWaylandWindow(QWindow *window) , mScale(1) , mState(Qt::WindowNoState) , mMask() - , mBackingStore(Q_NULLPTR) + , mBackingStore(nullptr) , mUpdateRequested(false) { static WId id = 1; @@ -240,7 +240,7 @@ bool QWaylandWindow::shouldCreateShellSurface() const bool QWaylandWindow::shouldCreateSubSurface() const { - return QPlatformWindow::parent() != Q_NULLPTR; + return QPlatformWindow::parent() != nullptr; } void QWaylandWindow::reset(bool sendDestroyEvent) diff --git a/src/plugins/platforms/wayland/qwaylandwlshellintegration.cpp b/src/plugins/platforms/wayland/qwaylandwlshellintegration.cpp index e945745e23c..e516371086e 100644 --- a/src/plugins/platforms/wayland/qwaylandwlshellintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandwlshellintegration.cpp @@ -55,7 +55,7 @@ QWaylandWlShellIntegration *QWaylandWlShellIntegration::create(QWaylandDisplay * } QWaylandWlShellIntegration::QWaylandWlShellIntegration(QWaylandDisplay *display) - : m_wlShell(Q_NULLPTR) + : m_wlShell(nullptr) { Q_FOREACH (QWaylandDisplay::RegistryGlobal global, display->globals()) { if (global.interface == QLatin1String("wl_shell")) { diff --git a/src/plugins/platforms/wayland/qwaylandwlshellsurface.cpp b/src/plugins/platforms/wayland/qwaylandwlshellsurface.cpp index 77434e98b6c..cc5163a220a 100644 --- a/src/plugins/platforms/wayland/qwaylandwlshellsurface.cpp +++ b/src/plugins/platforms/wayland/qwaylandwlshellsurface.cpp @@ -58,7 +58,7 @@ QWaylandWlShellSurface::QWaylandWlShellSurface(struct ::wl_shell_surface *shell_ , m_window(window) , m_maximized(false) , m_fullscreen(false) - , m_extendedWindow(Q_NULLPTR) + , m_extendedWindow(nullptr) { if (window->display()->windowExtension()) m_extendedWindow = new QWaylandExtendedSurface(window); diff --git a/src/plugins/platforms/wayland/qwaylandxdgshellintegration.cpp b/src/plugins/platforms/wayland/qwaylandxdgshellintegration.cpp index 04b8e804848..7c40d2dd7fb 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgshellintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandxdgshellintegration.cpp @@ -57,7 +57,7 @@ QWaylandXdgShellIntegration *QWaylandXdgShellIntegration::create(QWaylandDisplay } QWaylandXdgShellIntegration::QWaylandXdgShellIntegration(QWaylandDisplay *display) - : m_xdgShell(Q_NULLPTR) + : m_xdgShell(nullptr) { Q_FOREACH (QWaylandDisplay::RegistryGlobal global, display->globals()) { if (global.interface == QLatin1String("xdg_shell")) { diff --git a/src/plugins/platforms/wayland/qwaylandxdgsurface.cpp b/src/plugins/platforms/wayland/qwaylandxdgsurface.cpp index fe8761e5b6d..60266af689d 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgsurface.cpp +++ b/src/plugins/platforms/wayland/qwaylandxdgsurface.cpp @@ -61,7 +61,7 @@ QWaylandXdgSurface::QWaylandXdgSurface(QWaylandXdgShell *shell, QWaylandWindow * , m_minimized(false) , m_fullscreen(false) , m_active(false) - , m_extendedWindow(Q_NULLPTR) + , m_extendedWindow(nullptr) { if (window->display()->windowExtension()) m_extendedWindow = new QWaylandExtendedSurface(window); @@ -105,7 +105,7 @@ void QWaylandXdgSurface::setMaximized() void QWaylandXdgSurface::setFullscreen() { if (!m_fullscreen) - set_fullscreen(Q_NULLPTR); + set_fullscreen(nullptr); } void QWaylandXdgSurface::setNormal() diff --git a/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationfactory.cpp b/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationfactory.cpp index 09c62339b62..c5a505bbe0b 100644 --- a/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationfactory.cpp +++ b/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationfactory.cpp @@ -90,7 +90,7 @@ QWaylandShellIntegration *QWaylandShellIntegrationFactory::create(const QString if (QWaylandShellIntegration *ret = qLoadPlugin(loader(), name, args)) return ret; #endif - return Q_NULLPTR; + return nullptr; } } diff --git a/tests/auto/cmake/test_waylandclient/main.cpp b/tests/auto/cmake/test_waylandclient/main.cpp index f0ccdef4b76..33f4470bb5f 100644 --- a/tests/auto/cmake/test_waylandclient/main.cpp +++ b/tests/auto/cmake/test_waylandclient/main.cpp @@ -3,5 +3,5 @@ int main() { // use symbol - QtWaylandClient::QWaylandCursor cursor(Q_NULLPTR); + QtWaylandClient::QWaylandCursor cursor(nullptr); } diff --git a/tests/auto/wayland/client/mockinput.cpp b/tests/auto/wayland/client/mockinput.cpp index 99acdd43a75..6bc27f1095e 100644 --- a/tests/auto/wayland/client/mockinput.cpp +++ b/tests/auto/wayland/client/mockinput.cpp @@ -239,8 +239,8 @@ void Seat::seat_get_touch(Resource *resource, uint32_t id) Keyboard::Keyboard(Compositor *compositor) : wl_keyboard() , m_compositor(compositor) - , m_focusResource(Q_NULLPTR) - , m_focus(Q_NULLPTR) + , m_focusResource(nullptr) + , m_focus(nullptr) { } @@ -293,8 +293,8 @@ void Keyboard::keyboard_destroy_resource(wl_keyboard::Resource *resource) Pointer::Pointer(Compositor *compositor) : wl_pointer() , m_compositor(compositor) - , m_focusResource(Q_NULLPTR) - , m_focus(Q_NULLPTR) + , m_focusResource(nullptr) + , m_focus(nullptr) { } diff --git a/tests/auto/wayland/client/mocksurface.cpp b/tests/auto/wayland/client/mocksurface.cpp index 55712af1194..61c9ac1b724 100644 --- a/tests/auto/wayland/client/mocksurface.cpp +++ b/tests/auto/wayland/client/mocksurface.cpp @@ -33,7 +33,7 @@ namespace Impl { Surface::Surface(wl_client *client, uint32_t id, int v, Compositor *compositor) : QtWaylandServer::wl_surface(client, id, v) - , m_buffer(Q_NULLPTR) + , m_buffer(nullptr) , m_compositor(compositor) , m_mockSurface(new MockSurface(this)) , m_mapped(false) From 5ba3b471b19b9d7a611e289cfa685b77db2e91b3 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Tue, 3 Oct 2017 10:26:59 +0200 Subject: [PATCH 0456/1507] Add missing override for QWaylandClientExtensionTemplate::bind Change-Id: Id8dabf1e54cb2f6fda2d8ac41b4c63bb68f835f5 Reviewed-by: David Edmundson Reviewed-by: Erik Larsson Reviewed-by: Pier Luigi Fiorini --- src/plugins/platforms/wayland/global/qwaylandclientextension.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/global/qwaylandclientextension.h b/src/plugins/platforms/wayland/global/qwaylandclientextension.h index 37debc513eb..98272e5710e 100644 --- a/src/plugins/platforms/wayland/global/qwaylandclientextension.h +++ b/src/plugins/platforms/wayland/global/qwaylandclientextension.h @@ -95,7 +95,7 @@ public: return T::interface(); } - void bind(struct ::wl_registry *registry, int id, int ver) + void bind(struct ::wl_registry *registry, int id, int ver) override { T* instance = static_cast(this); // Make sure lowest version is used of the supplied version from the From 58b30a6820dcf761b30c20b5e408e800e754674e Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Wed, 4 Oct 2017 11:05:25 +0200 Subject: [PATCH 0457/1507] Fix -Wreorder warning by using default member initializers Change-Id: I50f2928f1329fe45b4315baa33909b3227be1faa Reviewed-by: Pier Luigi Fiorini --- tests/auto/wayland/client/mockcompositor.cpp | 2 -- tests/auto/wayland/client/mockcompositor.h | 18 +++++++++--------- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/tests/auto/wayland/client/mockcompositor.cpp b/tests/auto/wayland/client/mockcompositor.cpp index 2c5f2541fde..d8f3222f139 100644 --- a/tests/auto/wayland/client/mockcompositor.cpp +++ b/tests/auto/wayland/client/mockcompositor.cpp @@ -264,8 +264,6 @@ namespace Impl { Compositor::Compositor() : m_display(wl_display_create()) - , m_startDragSeen(false) - , m_time(0) { wl_list_init(&m_outputResources); diff --git a/tests/auto/wayland/client/mockcompositor.h b/tests/auto/wayland/client/mockcompositor.h index dd6450fc922..a9492921e0e 100644 --- a/tests/auto/wayland/client/mockcompositor.h +++ b/tests/auto/wayland/client/mockcompositor.h @@ -88,7 +88,7 @@ public: static void waitForStartDrag(void *data, const QList ¶meters); public: - bool m_startDragSeen; + bool m_startDragSeen = false; private: static void bindCompositor(wl_client *client, void *data, uint32_t version, uint32_t id); @@ -102,18 +102,18 @@ private: QRect m_outputGeometry; - wl_display *m_display; - wl_event_loop *m_loop; - wl_shm *m_shm; - int m_fd; + wl_display *m_display = nullptr; + wl_event_loop *m_loop = nullptr; + wl_shm *m_shm = nullptr; + int m_fd = -1; wl_list m_outputResources; - uint32_t m_time; + uint32_t m_time = 0; QScopedPointer m_seat; - Pointer *m_pointer; - Keyboard *m_keyboard; - Touch *m_touch; + Pointer *m_pointer = nullptr; + Keyboard *m_keyboard = nullptr; + Touch *m_touch = nullptr; QScopedPointer m_data_device_manager; QVector m_surfaces; }; From b3621cfe7c42873f4f8c4735250d90043f6b2d39 Mon Sep 17 00:00:00 2001 From: Christophe Chapuis Date: Mon, 21 Aug 2017 13:29:47 +0000 Subject: [PATCH 0458/1507] QWaylandWindow: reset window should reset mask When QWaylandWindow::reset() is called, the window's mask is not changed. It means that when the window will be initialized again, it will not re-send the mask description to the server side through Wayland. Task-number: QTBUG-62638 Change-Id: I07d561f466836bbd90ae58521c0768ed85554256 Reviewed-by: Johan Helsing Reviewed-by: Christophe Chapuis --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index e5edd0e5e5c..f7f296d0aaa 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -254,6 +254,8 @@ void QWaylandWindow::reset() wl_callback_destroy(mFrameCallback); mFrameCallback = nullptr; } + + mMask = QRegion(); } QWaylandWindow *QWaylandWindow::fromWlSurface(::wl_surface *surface) From 6c1c47611f507cd9347c726b8e0e1fcd948f59df Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Wed, 4 Oct 2017 10:49:24 +0200 Subject: [PATCH 0459/1507] Tests: Add missing Q_UNUSEDs Change-Id: Ifc7e5d000b7f5d75fb899d2294008f8dcabca777 Reviewed-by: Pier Luigi Fiorini --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 1 + tests/auto/wayland/client/mockinput.cpp | 7 +++++++ tests/auto/wayland/client/tst_client.cpp | 2 ++ 3 files changed, 10 insertions(+) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 6d50b0d72de..a39ff99181b 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -601,6 +601,7 @@ const wl_callback_listener QWaylandWindow::callbackListener = { void QWaylandWindow::frameCallback(void *data, struct wl_callback *callback, uint32_t time) { Q_UNUSED(time); + Q_UNUSED(callback); QWaylandWindow *self = static_cast(data); self->mWaitingForFrameSync = false; diff --git a/tests/auto/wayland/client/mockinput.cpp b/tests/auto/wayland/client/mockinput.cpp index 6bc27f1095e..9e568921044 100644 --- a/tests/auto/wayland/client/mockinput.cpp +++ b/tests/auto/wayland/client/mockinput.cpp @@ -194,6 +194,7 @@ void Compositor::sendDataDeviceLeave(void *data, const QList ¶mete void Compositor::waitForStartDrag(void *data, const QList ¶meters) { + Q_UNUSED(parameters); Compositor *compositor = static_cast(data); Q_ASSERT(compositor); while (!compositor->m_startDragSeen) { @@ -443,6 +444,11 @@ DataDevice::~DataDevice() void DataDevice::data_device_start_drag(QtWaylandServer::wl_data_device::Resource *resource, wl_resource *source, wl_resource *origin, wl_resource *icon, uint32_t serial) { + Q_UNUSED(resource); + Q_UNUSED(source); + Q_UNUSED(origin); + Q_UNUSED(icon); + Q_UNUSED(serial); m_compositor->m_startDragSeen = true; } @@ -465,6 +471,7 @@ DataDevice *DataDeviceManager::dataDevice() const void DataDeviceManager::data_device_manager_get_data_device(Resource *resource, uint32_t id, struct ::wl_resource *seat) { + Q_UNUSED(seat); if (!m_data_device) m_data_device.reset(new DataDevice(m_compositor)); m_data_device->add(resource->client(), id, 1); diff --git a/tests/auto/wayland/client/tst_client.cpp b/tests/auto/wayland/client/tst_client.cpp index 8acddfbe740..0a3c7bef755 100644 --- a/tests/auto/wayland/client/tst_client.cpp +++ b/tests/auto/wayland/client/tst_client.cpp @@ -93,6 +93,7 @@ public: void touchEvent(QTouchEvent *event) override { + Q_UNUSED(event); ++touchEventCount; } @@ -272,6 +273,7 @@ public: protected: void mousePressEvent(QMouseEvent *event) override { + Q_UNUSED(event); if (dragStarted) return; dragStarted = true; From 4e0e6db65446e60466ea0fc2be01b0825ccbd983 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Wed, 4 Oct 2017 10:39:36 +0200 Subject: [PATCH 0460/1507] Use QImage::sizeInBytes() instead of deprecated QImage::byteCount() Change-Id: If3f21fc43d0118c1819d354c8ef43f1b79617c7b Reviewed-by: Allan Sandfeld Jensen --- src/plugins/platforms/wayland/qwaylandcursor.cpp | 2 +- src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandcursor.cpp b/src/plugins/platforms/wayland/qwaylandcursor.cpp index 6ce2b7bbca4..bd820e28e84 100644 --- a/src/plugins/platforms/wayland/qwaylandcursor.cpp +++ b/src/plugins/platforms/wayland/qwaylandcursor.cpp @@ -119,7 +119,7 @@ QSharedPointer QWaylandCursor::cursorBitmapImage(const QCursor * const QImage &img = cursor->pixmap().toImage(); QSharedPointer buffer(new QWaylandShmBuffer(mDisplay, img.size(), img.format())); - memcpy(buffer->image()->bits(), img.bits(), img.byteCount()); + memcpy(buffer->image()->bits(), img.bits(), img.sizeInBytes()); return buffer; } diff --git a/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp b/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp index a7bc241651a..a9883c5c642 100644 --- a/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp +++ b/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp @@ -125,7 +125,7 @@ QWaylandShmBuffer::~QWaylandShmBuffer(void) { delete mMarginsImage; if (mImage.constBits()) - munmap((void *) mImage.constBits(), mImage.byteCount()); + munmap((void *) mImage.constBits(), mImage.sizeInBytes()); if (mShmPool) wl_shm_pool_destroy(mShmPool); } @@ -287,10 +287,10 @@ void QWaylandShmBackingStore::resize(const QSize &size) buffer = getBuffer(sizeWithMargins); } - int oldSize = mBackBuffer ? mBackBuffer->image()->byteCount() : 0; + qssize_t oldSize = mBackBuffer ? mBackBuffer->image()->sizeInBytes() : 0; // mBackBuffer may have been deleted here but if so it means its size was different so we wouldn't copy it anyway - if (mBackBuffer != buffer && oldSize == buffer->image()->byteCount()) { - memcpy(buffer->image()->bits(), mBackBuffer->image()->constBits(), buffer->image()->byteCount()); + if (mBackBuffer != buffer && oldSize == buffer->image()->sizeInBytes()) { + memcpy(buffer->image()->bits(), mBackBuffer->image()->constBits(), buffer->image()->sizeInBytes()); } mBackBuffer = buffer; // ensure the new buffer is at the beginning of the list so next time getBuffer() will pick From 6cf44bf690cf0a84325b78d871a96c009b2513ec Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Wed, 18 Oct 2017 11:05:48 +0200 Subject: [PATCH 0461/1507] Fix crash when wl-shell setType is called with a hidden parent Fall back to creating a toplevel instead Change-Id: If7db27d08b79e4f9f8c82fa8f9bf73abdb2585d9 Reviewed-by: David Edmundson Reviewed-by: Paul Olav Tvete --- .../wayland/qwaylandwlshellsurface.cpp | 6 ++- tests/auto/wayland/client/tst_client.cpp | 44 +++++++++++++++++++ 2 files changed, 48 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandwlshellsurface.cpp b/src/plugins/platforms/wayland/qwaylandwlshellsurface.cpp index 77434e98b6c..92223f45ee6 100644 --- a/src/plugins/platforms/wayland/qwaylandwlshellsurface.cpp +++ b/src/plugins/platforms/wayland/qwaylandwlshellsurface.cpp @@ -185,6 +185,7 @@ void QWaylandWlShellSurface::updateTransientParent(QWindow *parent) || testShowWithoutActivating(m_window->window())) flags |= WL_SHELL_SURFACE_TRANSIENT_INACTIVE; + Q_ASSERT(parent_wayland_window->object()); set_transient(parent_wayland_window->object(), transientPos.x(), transientPos.y(), @@ -211,15 +212,16 @@ void QWaylandWlShellSurface::setPopup(QWaylandWindow *parent, QWaylandInputDevic transientPos.setY(transientPos.y() + parent_wayland_window->decoration()->margins().top()); } + Q_ASSERT(parent_wayland_window->object()); set_popup(device->wl_seat(), serial, parent_wayland_window->object(), transientPos.x(), transientPos.y(), 0); } void QWaylandWlShellSurface::setType(Qt::WindowType type, QWaylandWindow *transientParent) { - if (type == Qt::Popup && transientParent) + if (type == Qt::Popup && transientParent && transientParent->object()) setPopup(transientParent, m_window->display()->lastInputDevice(), m_window->display()->lastInputSerial()); - else if (transientParent) + else if (transientParent && transientParent->object()) updateTransientParent(transientParent->window()); else setTopLevel(); diff --git a/tests/auto/wayland/client/tst_client.cpp b/tests/auto/wayland/client/tst_client.cpp index 8acddfbe740..1eee90f49db 100644 --- a/tests/auto/wayland/client/tst_client.cpp +++ b/tests/auto/wayland/client/tst_client.cpp @@ -143,6 +143,8 @@ private slots: void touchDrag(); void mouseDrag(); void dontCrashOnMultipleCommits(); + void hiddenTransientParent(); + void hiddenPopupParent(); private: MockCompositor *compositor; @@ -360,6 +362,48 @@ void tst_WaylandClient::dontCrashOnMultipleCommits() QTRY_VERIFY(!compositor->surface()); } +void tst_WaylandClient::hiddenTransientParent() +{ + QWindow parent; + QWindow transient; + + transient.setTransientParent(&parent); + + parent.show(); + QTRY_VERIFY(compositor->surface()); + + parent.hide(); + QTRY_VERIFY(!compositor->surface()); + + transient.show(); + QTRY_VERIFY(compositor->surface()); +} + +void tst_WaylandClient::hiddenPopupParent() +{ + TestWindow toplevel; + toplevel.show(); + + // wl_shell relies on a mouse event in order to send a serial and seat + // with the set_popup request. + QSharedPointer surface; + QTRY_VERIFY(surface = compositor->surface()); + QPoint mousePressPos(16, 16); + QCOMPARE(toplevel.mousePressEventCount, 0); + compositor->sendMousePress(surface, mousePressPos); + QTRY_COMPARE(toplevel.mousePressEventCount, 1); + + QWindow popup; + popup.setTransientParent(&toplevel); + popup.setFlag(Qt::Popup, true); + + toplevel.hide(); + QTRY_VERIFY(!compositor->surface()); + + popup.show(); + QTRY_VERIFY(compositor->surface()); +} + int main(int argc, char **argv) { setenv("XDG_RUNTIME_DIR", ".", 1); From b90c278ed8d6c346626ea4c90332a122625cc4f7 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Thu, 27 Apr 2017 11:21:25 +0200 Subject: [PATCH 0462/1507] Test client side xdg shell v6 Apart for some new mocking code for xdg shell v6, this is mostly a refactor of the existing test, to reuse the existing mocking code between the different shell integrations. Change-Id: I68f93ab12ac47e51a50fd69647286cab46a3c595 Reviewed-by: Paul Olav Tvete --- tests/auto/wayland/client.pro | 4 +- tests/auto/wayland/client/client.pro | 26 +--- .../{client => shared}/mockcompositor.cpp | 3 + .../{client => shared}/mockcompositor.h | 1 + .../wayland/{client => shared}/mockinput.cpp | 0 .../wayland/{client => shared}/mockinput.h | 0 .../wayland/{client => shared}/mockoutput.cpp | 0 .../wayland/{client => shared}/mockshell.cpp | 0 .../{client => shared}/mocksurface.cpp | 0 .../wayland/{client => shared}/mocksurface.h | 0 tests/auto/wayland/shared/mockxdgshellv6.cpp | 115 +++++++++++++++++ tests/auto/wayland/shared/shared.pri | 24 ++++ .../wayland/xdgshellv6/tst_xdgshellv6.cpp | 120 ++++++++++++++++++ tests/auto/wayland/xdgshellv6/xdgshellv6.pro | 5 + 14 files changed, 274 insertions(+), 24 deletions(-) rename tests/auto/wayland/{client => shared}/mockcompositor.cpp (98%) rename tests/auto/wayland/{client => shared}/mockcompositor.h (98%) rename tests/auto/wayland/{client => shared}/mockinput.cpp (100%) rename tests/auto/wayland/{client => shared}/mockinput.h (100%) rename tests/auto/wayland/{client => shared}/mockoutput.cpp (100%) rename tests/auto/wayland/{client => shared}/mockshell.cpp (100%) rename tests/auto/wayland/{client => shared}/mocksurface.cpp (100%) rename tests/auto/wayland/{client => shared}/mocksurface.h (100%) create mode 100644 tests/auto/wayland/shared/mockxdgshellv6.cpp create mode 100644 tests/auto/wayland/shared/shared.pri create mode 100644 tests/auto/wayland/xdgshellv6/tst_xdgshellv6.cpp create mode 100644 tests/auto/wayland/xdgshellv6/xdgshellv6.pro diff --git a/tests/auto/wayland/client.pro b/tests/auto/wayland/client.pro index 916b3abe445..d19326797b2 100644 --- a/tests/auto/wayland/client.pro +++ b/tests/auto/wayland/client.pro @@ -1,3 +1,5 @@ TEMPLATE=subdirs -SUBDIRS += client +SUBDIRS += \ + client \ + xdgshellv6 diff --git a/tests/auto/wayland/client/client.pro b/tests/auto/wayland/client/client.pro index 34fc67474db..edf80bb9b90 100644 --- a/tests/auto/wayland/client/client.pro +++ b/tests/auto/wayland/client/client.pro @@ -1,24 +1,4 @@ -CONFIG += testcase link_pkgconfig +include (../shared/shared.pri) + TARGET = tst_client - -QT += testlib -QT += core-private gui-private - -QMAKE_USE += wayland-client wayland-server - -CONFIG += wayland-scanner -WAYLANDSERVERSOURCES += \ - ../../../../src/3rdparty/protocol/wayland.xml - -SOURCES += \ - tst_client.cpp \ - mockcompositor.cpp \ - mockinput.cpp \ - mockshell.cpp \ - mocksurface.cpp \ - mockoutput.cpp - -HEADERS += \ - mockcompositor.h \ - mockinput.h \ - mocksurface.h +SOURCES += tst_client.cpp diff --git a/tests/auto/wayland/client/mockcompositor.cpp b/tests/auto/wayland/shared/mockcompositor.cpp similarity index 98% rename from tests/auto/wayland/client/mockcompositor.cpp rename to tests/auto/wayland/shared/mockcompositor.cpp index d8f3222f139..411a897577b 100644 --- a/tests/auto/wayland/client/mockcompositor.cpp +++ b/tests/auto/wayland/shared/mockcompositor.cpp @@ -30,6 +30,8 @@ #include "mockinput.h" #include "mocksurface.h" +#include + #include MockCompositor::MockCompositor() : m_alive(true) @@ -285,6 +287,7 @@ Compositor::Compositor() wl_global_create(m_display, &wl_output_interface, 1, this, bindOutput); wl_global_create(m_display, &wl_shell_interface, 1, this, bindShell); + wl_global_create(m_display, &zxdg_shell_v6_interface, 1, this, bindXdgShellV6); m_loop = wl_display_get_event_loop(m_display); m_fd = wl_event_loop_get_fd(m_loop); diff --git a/tests/auto/wayland/client/mockcompositor.h b/tests/auto/wayland/shared/mockcompositor.h similarity index 98% rename from tests/auto/wayland/client/mockcompositor.h rename to tests/auto/wayland/shared/mockcompositor.h index a9492921e0e..a304b3792e7 100644 --- a/tests/auto/wayland/client/mockcompositor.h +++ b/tests/auto/wayland/shared/mockcompositor.h @@ -94,6 +94,7 @@ private: static void bindCompositor(wl_client *client, void *data, uint32_t version, uint32_t id); static void bindOutput(wl_client *client, void *data, uint32_t version, uint32_t id); static void bindShell(wl_client *client, void *data, uint32_t version, uint32_t id); + static void bindXdgShellV6(wl_client *client, void *compositorData, uint32_t version, uint32_t id); void initShm(); diff --git a/tests/auto/wayland/client/mockinput.cpp b/tests/auto/wayland/shared/mockinput.cpp similarity index 100% rename from tests/auto/wayland/client/mockinput.cpp rename to tests/auto/wayland/shared/mockinput.cpp diff --git a/tests/auto/wayland/client/mockinput.h b/tests/auto/wayland/shared/mockinput.h similarity index 100% rename from tests/auto/wayland/client/mockinput.h rename to tests/auto/wayland/shared/mockinput.h diff --git a/tests/auto/wayland/client/mockoutput.cpp b/tests/auto/wayland/shared/mockoutput.cpp similarity index 100% rename from tests/auto/wayland/client/mockoutput.cpp rename to tests/auto/wayland/shared/mockoutput.cpp diff --git a/tests/auto/wayland/client/mockshell.cpp b/tests/auto/wayland/shared/mockshell.cpp similarity index 100% rename from tests/auto/wayland/client/mockshell.cpp rename to tests/auto/wayland/shared/mockshell.cpp diff --git a/tests/auto/wayland/client/mocksurface.cpp b/tests/auto/wayland/shared/mocksurface.cpp similarity index 100% rename from tests/auto/wayland/client/mocksurface.cpp rename to tests/auto/wayland/shared/mocksurface.cpp diff --git a/tests/auto/wayland/client/mocksurface.h b/tests/auto/wayland/shared/mocksurface.h similarity index 100% rename from tests/auto/wayland/client/mocksurface.h rename to tests/auto/wayland/shared/mocksurface.h diff --git a/tests/auto/wayland/shared/mockxdgshellv6.cpp b/tests/auto/wayland/shared/mockxdgshellv6.cpp new file mode 100644 index 00000000000..fe9d118570f --- /dev/null +++ b/tests/auto/wayland/shared/mockxdgshellv6.cpp @@ -0,0 +1,115 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "mockcompositor.h" +#include "mocksurface.h" + +#include + +namespace Impl { + +class XdgToplevelV6 : public QtWaylandServer::zxdg_toplevel_v6 +{ +public: + XdgToplevelV6(wl_client *client, uint32_t id, int version) + : QtWaylandServer::zxdg_toplevel_v6(client, id, version) + {} + void zxdg_toplevel_v6_destroy_resource(Resource *resource) override { delete this; } +}; + +class XdgSurfaceV6 : public QtWaylandServer::zxdg_surface_v6 +{ +public: + XdgSurfaceV6(wl_client *client, uint32_t id, int version, Surface *surface); + void zxdg_surface_v6_destroy_resource(Resource *resource) override { delete this; } + void zxdg_surface_v6_get_toplevel(Resource *resource, uint32_t id) override; + Surface *m_surface = nullptr; +}; + +XdgSurfaceV6::XdgSurfaceV6(wl_client *client, uint32_t id, int version, Surface *surface) + : QtWaylandServer::zxdg_surface_v6(client, id, version) + , m_surface(surface) +{ +} + +void XdgSurfaceV6::zxdg_surface_v6_get_toplevel(QtWaylandServer::zxdg_surface_v6::Resource *resource, uint32_t id) +{ + int version = wl_resource_get_version(resource->handle); + new XdgToplevelV6(resource->client(), id, version); + m_surface->map(); +} + + +void shell_destroy(struct wl_client *client, + struct wl_resource *resource) +{ + Q_UNUSED(client); + Q_UNUSED(resource); +} + +void create_positioner(struct wl_client *client, + struct wl_resource *resource, + uint32_t id) +{ + Q_UNUSED(client); + Q_UNUSED(resource); + Q_UNUSED(id); +} + +void get_xdg_surface(struct wl_client *client, + struct wl_resource *compositorResource, + uint32_t id, + struct wl_resource *surfaceResource) +{ + int version = wl_resource_get_version(compositorResource); + new XdgSurfaceV6(client, id, version, Surface::fromResource(surfaceResource)); +} + +void pong(struct wl_client *client, + struct wl_resource *resource, + uint32_t serial) +{ + Q_UNUSED(client); + Q_UNUSED(resource); + Q_UNUSED(serial); +} + +void Compositor::bindXdgShellV6(wl_client *client, void *compositorData, uint32_t version, uint32_t id) +{ + static const struct zxdg_shell_v6_interface shellInterface = { + shell_destroy, + create_positioner, + get_xdg_surface, + pong + }; + + wl_resource *resource = wl_resource_create(client, &zxdg_shell_v6_interface, static_cast(version), id); + wl_resource_set_implementation(resource, &shellInterface, compositorData, nullptr); +} + +} diff --git a/tests/auto/wayland/shared/shared.pri b/tests/auto/wayland/shared/shared.pri new file mode 100644 index 00000000000..5edfc09c03f --- /dev/null +++ b/tests/auto/wayland/shared/shared.pri @@ -0,0 +1,24 @@ +CONFIG += testcase link_pkgconfig +QT += testlib + +QMAKE_USE += wayland-client wayland-server + +CONFIG += wayland-scanner +WAYLANDSERVERSOURCES += \ + ../../../../src/3rdparty/protocol/wayland.xml \ + ../../../../src/3rdparty/protocol/xdg-shell-unstable-v6.xml + +INCLUDEPATH += ../shared + +SOURCES += \ + ../shared/mockcompositor.cpp \ + ../shared/mockinput.cpp \ + ../shared/mockshell.cpp \ + ../shared/mockxdgshellv6.cpp \ + ../shared/mocksurface.cpp \ + ../shared/mockoutput.cpp + +HEADERS += \ + ../shared/mockcompositor.h \ + ../shared/mockinput.h \ + ../shared/mocksurface.h diff --git a/tests/auto/wayland/xdgshellv6/tst_xdgshellv6.cpp b/tests/auto/wayland/xdgshellv6/tst_xdgshellv6.cpp new file mode 100644 index 00000000000..6d0f4a003d7 --- /dev/null +++ b/tests/auto/wayland/xdgshellv6/tst_xdgshellv6.cpp @@ -0,0 +1,120 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "mockcompositor.h" + +#include +#include +#include +#include +#include +#include +#include + +#include + +static const QSize screenSize(1600, 1200); + +class TestWindow : public QWindow +{ +public: + TestWindow() + { + setSurfaceType(QSurface::RasterSurface); + setGeometry(0, 0, 32, 32); + create(); + } +}; + +class tst_WaylandClientXdgShellV6 : public QObject +{ + Q_OBJECT +public: + tst_WaylandClientXdgShellV6(MockCompositor *c) + : m_compositor(c) + { + QSocketNotifier *notifier = new QSocketNotifier(m_compositor->waylandFileDescriptor(), QSocketNotifier::Read, this); + connect(notifier, &QSocketNotifier::activated, this, &tst_WaylandClientXdgShellV6::processWaylandEvents); + // connect to the event dispatcher to make sure to flush out the outgoing message queue + connect(QCoreApplication::eventDispatcher(), &QAbstractEventDispatcher::awake, this, &tst_WaylandClientXdgShellV6::processWaylandEvents); + connect(QCoreApplication::eventDispatcher(), &QAbstractEventDispatcher::aboutToBlock, this, &tst_WaylandClientXdgShellV6::processWaylandEvents); + } + +public slots: + void processWaylandEvents() + { + m_compositor->processWaylandEvents(); + } + + void cleanup() + { + // make sure the surfaces from the last test are properly cleaned up + // and don't show up as false positives in the next test + QTRY_VERIFY(!m_compositor->surface()); + } + +private slots: + void createDestroyWindow(); + +private: + MockCompositor *m_compositor; +}; + +void tst_WaylandClientXdgShellV6::createDestroyWindow() +{ + TestWindow window; + window.show(); + + QTRY_VERIFY(m_compositor->surface()); + + window.destroy(); + QTRY_VERIFY(!m_compositor->surface()); +} + +int main(int argc, char **argv) +{ + setenv("XDG_RUNTIME_DIR", ".", 1); + setenv("QT_QPA_PLATFORM", "wayland", 1); // force QGuiApplication to use wayland plugin + setenv("QT_WAYLAND_SHELL_INTEGRATION", "xdg-shell-v6", 1); + + // wayland-egl hangs in the test setup when we try to initialize. Until it gets + // figured out, avoid clientBufferIntegration() from being called in + // QWaylandWindow::createDecorations(). + setenv("QT_WAYLAND_DISABLE_WINDOWDECORATION", "1", 1); + + MockCompositor compositor; + compositor.setOutputGeometry(QRect(QPoint(), screenSize)); + + QGuiApplication app(argc, argv); + compositor.applicationInitialized(); + + tst_WaylandClientXdgShellV6 tc(&compositor); + return QTest::qExec(&tc, argc, argv); +} + +#include diff --git a/tests/auto/wayland/xdgshellv6/xdgshellv6.pro b/tests/auto/wayland/xdgshellv6/xdgshellv6.pro new file mode 100644 index 00000000000..4fec593df19 --- /dev/null +++ b/tests/auto/wayland/xdgshellv6/xdgshellv6.pro @@ -0,0 +1,5 @@ +include (../shared/shared.pri) + +TARGET = tst_client_xdgshellv6 +SOURCES += tst_xdgshellv6.cpp + From 1fbffb9dfb011c3b7c7aaa41b7be3a8167ce0c8a Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Wed, 18 Oct 2017 20:41:50 +0200 Subject: [PATCH 0463/1507] Ref count buffer usage The QPlatformBackingStore can get flushed multiple times between paints. Flush sets the front buffer, but it does not create a new backbuffer. We can't do so without doing an expensive pre-emptive copy. This means we send the same front buffer multiple times. This is somewhat questionable with regards to the Wayland specification, but seems to work. If we do send a buffer multiple times we can't consider it free until the last attached buffer is released; otherwise we end up painting into a buffer whilst the server is still using it, leading to flickering. Change-Id: I8235eed6a85f0d52b37544e7bcb623b16a9dd832 Reviewed-by: Marco Martin Reviewed-by: Johan Helsing --- src/plugins/platforms/wayland/qwaylandbuffer.cpp | 2 +- src/plugins/platforms/wayland/qwaylandbuffer_p.h | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandbuffer.cpp b/src/plugins/platforms/wayland/qwaylandbuffer.cpp index a0fcc532f5b..076a0d57d74 100644 --- a/src/plugins/platforms/wayland/qwaylandbuffer.cpp +++ b/src/plugins/platforms/wayland/qwaylandbuffer.cpp @@ -66,7 +66,7 @@ void QWaylandBuffer::init(wl_buffer *buf) void QWaylandBuffer::release(void *data, wl_buffer *) { - static_cast(data)->mBusy = false; + static_cast(data)->mBusy--; } const wl_buffer_listener QWaylandBuffer::listener = { diff --git a/src/plugins/platforms/wayland/qwaylandbuffer_p.h b/src/plugins/platforms/wayland/qwaylandbuffer_p.h index 9e8cba2e490..b3513d1515e 100644 --- a/src/plugins/platforms/wayland/qwaylandbuffer_p.h +++ b/src/plugins/platforms/wayland/qwaylandbuffer_p.h @@ -73,14 +73,14 @@ public: virtual QSize size() const = 0; virtual int scale() const { return 1; } - void setBusy() { mBusy = true; } - bool busy() const { return mBusy; } + void setBusy() { mBusy++; } + bool busy() const { return mBusy > 0; } protected: struct wl_buffer *mBuffer; private: - bool mBusy; + int mBusy; static void release(void *data, wl_buffer *); static const wl_buffer_listener listener; From 7f8d9b7f54f6d0764227cdf09e34f2b0231ae061 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Thu, 19 Oct 2017 12:13:01 +0200 Subject: [PATCH 0464/1507] Ensure QWaylandWindow::transientParent has a shell surface This may not be a perfect solution, but it's better than the current one, where the transient parent may not have a shell surface (because the window may be hidden or not yet initialized). Task-number: QTBUG-63840 Change-Id: Ia5f04376d4b6d12b41ceeab5ba13cdc1b63b4e3c Reviewed-by: Paul Olav Tvete --- .../platforms/wayland/qwaylandwindow.cpp | 27 +++++++++++-------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index f7f296d0aaa..6d7c0885c80 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -785,22 +785,27 @@ QWaylandAbstractDecoration *QWaylandWindow::decoration() const return mWindowDecoration; } -static QWindow *topLevelWindow(QWindow *window) +static QWaylandWindow *closestShellSurfaceWindow(QWindow *window) { - while (QWindow *parent = window->parent()) - window = parent; - return window; + while (window) { + auto w = static_cast(window->handle()); + if (w->shellSurface()) + return w; + window = window->transientParent() ? window->transientParent() : window->parent(); + } + return nullptr; } QWaylandWindow *QWaylandWindow::transientParent() const { - // Take the top level window here, since the transient parent may be a QWidgetWindow - // or some other window without a shell surface, which is then not able to get mouse - // events. - if (auto transientParent = window()->transientParent()) - return static_cast(topLevelWindow(transientParent)->handle()); - else if (QGuiApplication::focusWindow() && (window()->type() == Qt::ToolTip || window()->type() == Qt::Popup)) - return static_cast(topLevelWindow(QGuiApplication::focusWindow())->handle()); + // Take the closest window with a shell surface, since the transient parent may be a + // QWidgetWindow or some other window without a shell surface, which is then not able to + // get mouse events. + if (auto transientParent = closestShellSurfaceWindow(window()->transientParent())) + return transientParent; + + if (QGuiApplication::focusWindow() && (window()->type() == Qt::ToolTip || window()->type() == Qt::Popup)) + return closestShellSurfaceWindow(QGuiApplication::focusWindow()); return nullptr; } From 80f167fbc4309029927dc43a6eda5965528a44b5 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Mon, 28 Aug 2017 12:58:55 +0200 Subject: [PATCH 0465/1507] qtwaylandscanner: Remove globals when destroying wrappers When globals are destroyed on the compositor side, send the "global_remove" event and set the resource implementation to nullptr so all further requests are ignored. This also adds a compositor test to see if outputs are removed when they are deleted. Change-Id: Ib77a4c3d4c2c93283a14ac20f5964e2ce08a1d38 Reviewed-by: David Edmundson Reviewed-by: Paul Olav Tvete --- .../qtwaylandscanner/qtwaylandscanner.cpp | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp index ed36a138698..d6a83dbbceb 100644 --- a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp +++ b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp @@ -504,6 +504,7 @@ void process(QXmlStreamReader &xml, const QByteArray &headerPath, const QByteArr printf(" private:\n"); printf(" static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id);\n"); printf(" static void destroy_func(struct ::wl_resource *client_resource);\n"); + printf(" static void display_destroy_func(struct ::wl_listener *listener, void *data);\n"); printf("\n"); printf(" Resource *bind(struct ::wl_client *client, uint32_t id, int version);\n"); printf(" Resource *bind(struct ::wl_resource *handle);\n"); @@ -527,6 +528,10 @@ void process(QXmlStreamReader &xml, const QByteArray &headerPath, const QByteArr printf(" Resource *m_resource;\n"); printf(" struct ::wl_global *m_global;\n"); printf(" uint32_t m_globalVersion;\n"); + printf(" struct DisplayDestroyedListener : ::wl_listener {\n"); + printf(" %s *parent;\n", interfaceName); + printf(" };\n"); + printf(" DisplayDestroyedListener m_displayDestroyedListener;\n"); printf(" };\n"); if (j < interfaces.size() - 1) @@ -607,6 +612,13 @@ void process(QXmlStreamReader &xml, const QByteArray &headerPath, const QByteArr printf(" %s::~%s()\n", interfaceName, interfaceName); printf(" {\n"); + printf(" for (auto resource : qAsConst(m_resource_map))\n"); + printf(" wl_resource_set_implementation(resource->handle, nullptr, nullptr, nullptr);\n"); + printf("\n"); + printf(" if (m_global) {\n"); + printf(" wl_global_destroy(m_global);\n"); + printf(" wl_list_remove(&m_displayDestroyedListener.link);\n"); + printf(" }\n"); printf(" }\n"); printf("\n"); @@ -642,6 +654,9 @@ void process(QXmlStreamReader &xml, const QByteArray &headerPath, const QByteArr printf(" {\n"); printf(" m_global = wl_global_create(display, &::%s_interface, version, this, bind_func);\n", interfaceName); printf(" m_globalVersion = version;\n"); + printf(" m_displayDestroyedListener.notify = %s::display_destroy_func;\n", interfaceName); + printf(" m_displayDestroyedListener.parent = this;\n"); + printf(" wl_display_add_destroy_listener(display, &m_displayDestroyedListener);\n"); printf(" }\n"); printf("\n"); @@ -674,6 +689,14 @@ void process(QXmlStreamReader &xml, const QByteArray &headerPath, const QByteArr printf(" }\n"); printf("\n"); + printf(" void %s::display_destroy_func(struct ::wl_listener *listener, void *data)\n", interfaceName); + printf(" {\n"); + printf(" Q_UNUSED(data);\n"); + printf(" %s *that = static_cast<%s::DisplayDestroyedListener *>(listener)->parent;\n", interfaceName, interfaceName); + printf(" that->m_global = nullptr;\n"); + printf(" }\n"); + printf("\n"); + printf(" void %s::destroy_func(struct ::wl_resource *client_resource)\n", interfaceName); printf(" {\n"); printf(" Resource *resource = Resource::fromResource(client_resource);\n"); From 83cd3d383a2311430dd99818f69fa03bc41f695a Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Wed, 18 Oct 2017 13:36:22 +0200 Subject: [PATCH 0466/1507] Change serial parameter from int to uint In QWaylandWlShellSurface::setPopup Change-Id: I591b759bf8db9548776b28a485d75b53507761f4 Reviewed-by: David Edmundson Reviewed-by: Pier Luigi Fiorini --- src/plugins/platforms/wayland/qwaylandwlshellsurface.cpp | 2 +- src/plugins/platforms/wayland/qwaylandwlshellsurface_p.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandwlshellsurface.cpp b/src/plugins/platforms/wayland/qwaylandwlshellsurface.cpp index cd10958d94a..185cfc4a9c4 100644 --- a/src/plugins/platforms/wayland/qwaylandwlshellsurface.cpp +++ b/src/plugins/platforms/wayland/qwaylandwlshellsurface.cpp @@ -192,7 +192,7 @@ void QWaylandWlShellSurface::updateTransientParent(QWindow *parent) flags); } -void QWaylandWlShellSurface::setPopup(QWaylandWindow *parent, QWaylandInputDevice *device, int serial) +void QWaylandWlShellSurface::setPopup(QWaylandWindow *parent, QWaylandInputDevice *device, uint serial) { QWaylandWindow *parent_wayland_window = parent; if (!parent_wayland_window) { diff --git a/src/plugins/platforms/wayland/qwaylandwlshellsurface_p.h b/src/plugins/platforms/wayland/qwaylandwlshellsurface_p.h index 94e3417a412..62583949b68 100644 --- a/src/plugins/platforms/wayland/qwaylandwlshellsurface_p.h +++ b/src/plugins/platforms/wayland/qwaylandwlshellsurface_p.h @@ -102,7 +102,7 @@ private: void setTopLevel(); void updateTransientParent(QWindow *parent); - void setPopup(QWaylandWindow *parent, QWaylandInputDevice *device, int serial); + void setPopup(QWaylandWindow *parent, QWaylandInputDevice *device, uint serial); QWaylandWindow *m_window; bool m_maximized; From 7f8e7b4195d5b325eeb4ba272f542db0ec850125 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Fri, 18 Aug 2017 13:08:50 +0200 Subject: [PATCH 0467/1507] Automatically change scale when entering a new output Change-Id: I99198d47eac5b2091fe2bfd8fc24646be9c9890a Reviewed-by: Pier Luigi Fiorini Reviewed-by: David Edmundson --- .../platforms/wayland/qwaylandwindow.cpp | 27 ++++++++++++++++--- .../platforms/wayland/qwaylandwindow_p.h | 2 ++ 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 48f0d213a8f..2d7a0c3b50e 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -128,6 +128,12 @@ QWaylandWindow::~QWaylandWindow() } } +void QWaylandWindow::ensureSize() +{ + if (mBackingStore) + mBackingStore->ensureSize(); +} + void QWaylandWindow::initWindow() { if (window()->type() == Qt::Desktop) @@ -199,7 +205,6 @@ void QWaylandWindow::initWindow() // Enable high-dpi rendering. Scale() returns the screen scale factor and will // typically be integer 1 (normal-dpi) or 2 (high-dpi). Call set_buffer_scale() // to inform the compositor that high-resolution buffers will be provided. - //FIXME this needs to be changed when the screen changes along with a resized backing store if (mDisplay->compositorVersion() >= 3) set_buffer_scale(scale()); @@ -523,7 +528,7 @@ void QWaylandWindow::surface_enter(wl_output *output) QWaylandScreen *newScreen = calculateScreenFromSurfaceEvents(); if (oldScreen != newScreen) //currently this will only happen if the first wl_surface.enter is for a non-primary screen - QWindowSystemInterface::handleWindowScreenChanged(window(), newScreen->QPlatformScreen::screen()); + handleScreenChanged(); } void QWaylandWindow::surface_leave(wl_output *output) @@ -540,7 +545,7 @@ void QWaylandWindow::surface_leave(wl_output *output) QWaylandScreen *newScreen = calculateScreenFromSurfaceEvents(); if (oldScreen != newScreen) - QWindowSystemInterface::handleWindowScreenChanged(window(), newScreen->QPlatformScreen::screen()); + handleScreenChanged(); } void QWaylandWindow::handleScreenRemoved(QScreen *qScreen) @@ -550,7 +555,7 @@ void QWaylandWindow::handleScreenRemoved(QScreen *qScreen) if (wasRemoved) { QWaylandScreen *newScreen = calculateScreenFromSurfaceEvents(); if (oldScreen != newScreen) - QWindowSystemInterface::handleWindowScreenChanged(window(), newScreen->QPlatformScreen::screen()); + handleScreenChanged(); } } @@ -914,6 +919,20 @@ void QWaylandWindow::handleMouseEventWithDecoration(QWaylandInputDevice *inputDe } } +void QWaylandWindow::handleScreenChanged() +{ + QWaylandScreen *newScreen = calculateScreenFromSurfaceEvents(); + QWindowSystemInterface::handleWindowScreenChanged(window(), newScreen->QPlatformScreen::screen()); + + int scale = newScreen->scale(); + if (scale != mScale) { + mScale = scale; + if (isInitialized() && mDisplay->compositorVersion() >= 3) + set_buffer_scale(mScale); + ensureSize(); + } +} + #if QT_CONFIG(cursor) void QWaylandWindow::setMouseCursor(QWaylandInputDevice *device, const QCursor &cursor) { diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index 4cebcd7afd9..c9593441408 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -110,6 +110,7 @@ public: ~QWaylandWindow(); virtual WindowType windowType() const = 0; + virtual void ensureSize(); WId winId() const override; void setVisible(bool visible) override; void setParent(const QPlatformWindow *parent) override; @@ -263,6 +264,7 @@ private: QWaylandScreen *calculateScreenFromSurfaceEvents() const; void handleMouseEventWithDecoration(QWaylandInputDevice *inputDevice, const QWaylandPointerEvent &e); + void handleScreenChanged(); bool mUpdateRequested; From 679dc2e28190ae06b155606766a6160cbf718a59 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Fri, 18 Aug 2017 17:28:01 +0200 Subject: [PATCH 0468/1507] Client: Test that the current screen is updated by surface events Change-Id: If96691a2d844263a1e01a86df8b0d58f23848a4c Reviewed-by: Pier Luigi Fiorini --- tests/auto/wayland/client/tst_client.cpp | 45 ++++++++++- tests/auto/wayland/shared/mockcompositor.cpp | 59 ++++++++++++-- tests/auto/wayland/shared/mockcompositor.h | 32 ++++++-- tests/auto/wayland/shared/mockinput.cpp | 6 -- tests/auto/wayland/shared/mockoutput.cpp | 77 ++++++++++++++----- tests/auto/wayland/shared/mockoutput.h | 62 +++++++++++++++ tests/auto/wayland/shared/mocksurface.cpp | 29 +++++++ tests/auto/wayland/shared/shared.pri | 3 +- .../wayland/xdgshellv6/tst_xdgshellv6.cpp | 2 +- 9 files changed, 269 insertions(+), 46 deletions(-) create mode 100644 tests/auto/wayland/shared/mockoutput.h diff --git a/tests/auto/wayland/client/tst_client.cpp b/tests/auto/wayland/client/tst_client.cpp index f337e6b4a9c..b4dc75131a6 100644 --- a/tests/auto/wayland/client/tst_client.cpp +++ b/tests/auto/wayland/client/tst_client.cpp @@ -137,7 +137,8 @@ public slots: } private slots: - void screen(); + void primaryScreen(); + void windowScreens(); void createDestroyWindow(); void events(); void backingStore(); @@ -151,11 +152,49 @@ private: MockCompositor *compositor; }; -void tst_WaylandClient::screen() +void tst_WaylandClient::primaryScreen() { + compositor->setOutputMode(screenSize); QTRY_COMPARE(QGuiApplication::primaryScreen()->size(), screenSize); } +void tst_WaylandClient::windowScreens() +{ + QSharedPointer firstOutput; + QTRY_VERIFY(firstOutput = compositor->output()); + + TestWindow window; + window.show(); + + QSharedPointer surface; + QTRY_VERIFY(surface = compositor->surface()); + QTRY_COMPARE(QGuiApplication::screens().size(), 1); + QScreen *primaryScreen = QGuiApplication::screens().first(); + QCOMPARE(window.screen(), primaryScreen); + + compositor->sendAddOutput(); + + QTRY_COMPARE(QGuiApplication::screens().size(), 2); + QScreen *secondaryScreen = QGuiApplication::screens().at(1); + QVERIFY(secondaryScreen); + + window.setScreen(secondaryScreen); + QCOMPARE(window.screen(), secondaryScreen); + + QSharedPointer secondOutput; + QTRY_VERIFY(secondOutput = compositor->output(1)); + compositor->sendSurfaceEnter(surface, firstOutput); + + compositor->sendSurfaceEnter(surface, secondOutput); + QTRY_COMPARE(window.screen(), primaryScreen); + + compositor->sendSurfaceLeave(surface, firstOutput); + QTRY_COMPARE(window.screen(), secondaryScreen); + + window.destroy(); + QTRY_VERIFY(!compositor->surface()); +} + void tst_WaylandClient::createDestroyWindow() { TestWindow window; @@ -417,7 +456,7 @@ int main(int argc, char **argv) setenv("QT_WAYLAND_DISABLE_WINDOWDECORATION", "1", 1); MockCompositor compositor; - compositor.setOutputGeometry(QRect(QPoint(), screenSize)); + compositor.setOutputMode(screenSize); QGuiApplication app(argc, argv); compositor.applicationInitialized(); diff --git a/tests/auto/wayland/shared/mockcompositor.cpp b/tests/auto/wayland/shared/mockcompositor.cpp index 411a897577b..67c05b90adb 100644 --- a/tests/auto/wayland/shared/mockcompositor.cpp +++ b/tests/auto/wayland/shared/mockcompositor.cpp @@ -28,6 +28,7 @@ #include "mockcompositor.h" #include "mockinput.h" +#include "mockoutput.h" #include "mocksurface.h" #include @@ -77,10 +78,10 @@ void MockCompositor::processWaylandEvents() m_waitCondition.wakeOne(); } -void MockCompositor::setOutputGeometry(const QRect &rect) +void MockCompositor::setOutputMode(const QSize &size) { - Command command = makeCommand(Impl::Compositor::setOutputGeometry, m_compositor); - command.parameters << rect; + Command command = makeCommand(Impl::Compositor::setOutputMode, m_compositor); + command.parameters << size; processCommand(command); } @@ -182,6 +183,28 @@ void MockCompositor::sendDataDeviceLeave(const QSharedPointer &surf processCommand(command); } +void MockCompositor::sendAddOutput() +{ + Command command = makeCommand(Impl::Compositor::sendAddOutput, m_compositor); + processCommand(command); +} + +void MockCompositor::sendSurfaceEnter(const QSharedPointer &surface, QSharedPointer &output) +{ + Command command = makeCommand(Impl::Compositor::sendSurfaceEnter, m_compositor); + command.parameters << QVariant::fromValue(surface); + command.parameters << QVariant::fromValue(output); + processCommand(command); +} + +void MockCompositor::sendSurfaceLeave(const QSharedPointer &surface, QSharedPointer &output) +{ + Command command = makeCommand(Impl::Compositor::sendSurfaceLeave, m_compositor); + command.parameters << QVariant::fromValue(surface); + command.parameters << QVariant::fromValue(output); + processCommand(command); +} + void MockCompositor::waitForStartDrag() { Command command = makeCommand(Impl::Compositor::waitForStartDrag, m_compositor); @@ -204,6 +227,15 @@ QSharedPointer MockCompositor::surface() return result; } +QSharedPointer MockCompositor::output(int index) +{ + QSharedPointer result; + lock(); + result = m_compositor->outputs().at(index)->mockOutput(); + unlock(); + return result; +} + MockCompositor::Command MockCompositor::makeCommand(Command::Callback callback, void *target) { Command command; @@ -267,8 +299,6 @@ namespace Impl { Compositor::Compositor() : m_display(wl_display_create()) { - wl_list_init(&m_outputResources); - if (wl_display_add_socket(m_display, 0)) { fprintf(stderr, "Fatal: Failed to open server socket\n"); exit(EXIT_FAILURE); @@ -285,7 +315,7 @@ Compositor::Compositor() m_keyboard = m_seat->keyboard(); m_touch = m_seat->touch(); - wl_global_create(m_display, &wl_output_interface, 1, this, bindOutput); + m_outputs.append(new Output(m_display, QSize(1920, 1080), QPoint(0, 0))); wl_global_create(m_display, &wl_shell_interface, 1, this, bindShell); wl_global_create(m_display, &zxdg_shell_v6_interface, 1, this, bindXdgShellV6); @@ -350,6 +380,11 @@ QVector Compositor::surfaces() const return m_surfaces; } +QVector Compositor::outputs() const +{ + return m_outputs; +} + uint32_t Compositor::nextSerial() { return wl_display_next_serial(m_display); @@ -367,5 +402,17 @@ void Compositor::removeSurface(Surface *surface) m_pointer->handleSurfaceDestroyed(surface); } +Surface *Compositor::resolveSurface(const QVariant &v) +{ + QSharedPointer mockSurface = v.value >(); + return mockSurface ? mockSurface->handle() : nullptr; +} + +Output *Compositor::resolveOutput(const QVariant &v) +{ + QSharedPointer mockOutput = v.value >(); + return mockOutput ? mockOutput->handle() : nullptr; +} + } diff --git a/tests/auto/wayland/shared/mockcompositor.h b/tests/auto/wayland/shared/mockcompositor.h index a304b3792e7..54706bd8397 100644 --- a/tests/auto/wayland/shared/mockcompositor.h +++ b/tests/auto/wayland/shared/mockcompositor.h @@ -51,6 +51,7 @@ class Touch; class Seat; class DataDeviceManager; class Surface; +class Output; class Compositor { @@ -64,9 +65,8 @@ public: uint32_t nextSerial(); uint32_t time() { return ++m_time; } - static void setOutputGeometry(void *compositor, const QList ¶meters); - QVector surfaces() const; + QVector outputs() const; void addSurface(Surface *surface); void removeSurface(Surface *surface); @@ -86,21 +86,23 @@ public: static void sendDataDeviceDrop(void *data, const QList ¶meters); static void sendDataDeviceLeave(void *data, const QList ¶meters); static void waitForStartDrag(void *data, const QList ¶meters); + static void setOutputMode(void *compositor, const QList ¶meters); + static void sendAddOutput(void *data, const QList ¶meters); + static void sendSurfaceEnter(void *data, const QList ¶meters); + static void sendSurfaceLeave(void *data, const QList ¶meters); public: bool m_startDragSeen = false; private: static void bindCompositor(wl_client *client, void *data, uint32_t version, uint32_t id); - static void bindOutput(wl_client *client, void *data, uint32_t version, uint32_t id); static void bindShell(wl_client *client, void *data, uint32_t version, uint32_t id); static void bindXdgShellV6(wl_client *client, void *compositorData, uint32_t version, uint32_t id); + static Surface *resolveSurface(const QVariant &v); + static Output *resolveOutput(const QVariant &v); void initShm(); - void sendOutputGeometry(wl_resource *resource); - void sendOutputMode(wl_resource *resource); - QRect m_outputGeometry; wl_display *m_display = nullptr; @@ -108,7 +110,6 @@ private: wl_shm *m_shm = nullptr; int m_fd = -1; - wl_list m_outputResources; uint32_t m_time = 0; QScopedPointer m_seat; @@ -117,6 +118,7 @@ private: Touch *m_touch = nullptr; QScopedPointer m_data_device_manager; QVector m_surfaces; + QVector m_outputs; }; void registerResource(wl_list *list, wl_resource *resource); @@ -140,6 +142,16 @@ private: Q_DECLARE_METATYPE(QSharedPointer) +class MockOutput { +public: + Impl::Output *handle() const { return m_output; } + MockOutput(Impl::Output *output); +private: + Impl::Output *m_output; +}; + +Q_DECLARE_METATYPE(QSharedPointer) + class MockCompositor { public: @@ -151,7 +163,7 @@ public: int waylandFileDescriptor() const; void processWaylandEvents(); - void setOutputGeometry(const QRect &rect); + void setOutputMode(const QSize &size); void setKeyboardFocus(const QSharedPointer &surface); void sendMousePress(const QSharedPointer &surface, const QPoint &pos); void sendMouseRelease(const QSharedPointer &surface); @@ -166,9 +178,13 @@ public: void sendDataDeviceMotion(const QPoint &position); void sendDataDeviceDrop(const QSharedPointer &surface); void sendDataDeviceLeave(const QSharedPointer &surface); + void sendAddOutput(); + void sendSurfaceEnter(const QSharedPointer &surface, QSharedPointer &output); + void sendSurfaceLeave(const QSharedPointer &surface, QSharedPointer &output); void waitForStartDrag(); QSharedPointer surface(); + QSharedPointer output(int index = 0); void lock(); void unlock(); diff --git a/tests/auto/wayland/shared/mockinput.cpp b/tests/auto/wayland/shared/mockinput.cpp index 9e568921044..3e7b294b4af 100644 --- a/tests/auto/wayland/shared/mockinput.cpp +++ b/tests/auto/wayland/shared/mockinput.cpp @@ -32,12 +32,6 @@ namespace Impl { -static Surface *resolveSurface(const QVariant &v) -{ - QSharedPointer mockSurface = v.value >(); - return mockSurface ? mockSurface->handle() : 0; -} - void Compositor::setKeyboardFocus(void *data, const QList ¶meters) { Compositor *compositor = static_cast(data); diff --git a/tests/auto/wayland/shared/mockoutput.cpp b/tests/auto/wayland/shared/mockoutput.cpp index 86561976f0b..de8e019adbb 100644 --- a/tests/auto/wayland/shared/mockoutput.cpp +++ b/tests/auto/wayland/shared/mockoutput.cpp @@ -27,41 +27,76 @@ ****************************************************************************/ #include "mockcompositor.h" +#include "mockoutput.h" + +#include namespace Impl { -void Compositor::bindOutput(wl_client *client, void *compositorData, uint32_t version, uint32_t id) +void Compositor::sendAddOutput(void *data, const QList ¶meters) { + Q_UNUSED(parameters); + Compositor *compositor = static_cast(data); + auto output = new Output(compositor->m_display, QSize(1920, 1200), QPoint(0, 0)); + compositor->m_outputs.append(output); + + // Wait for the client to bind to the output + while (output->resourceMap().isEmpty()) + compositor->dispatchEvents(); +} + +void Compositor::setOutputMode(void *data, const QList ¶meters) { - wl_resource *resource = wl_resource_create(client, &wl_output_interface, static_cast(version), id); - - Compositor *compositor = static_cast(compositorData); - registerResource(&compositor->m_outputResources, resource); - - compositor->sendOutputGeometry(resource); - compositor->sendOutputMode(resource); + Compositor *compositor = static_cast(data); + QSize size = parameters.first().toSize(); + Output *output = compositor->m_outputs.first(); + Q_ASSERT(output); + output->setCurrentMode(size); } -void Compositor::sendOutputGeometry(wl_resource *resource) +Output::Output(wl_display *display, const QSize &resolution, const QPoint &position) + : wl_output(display, 2) + , m_size(resolution) + , m_position(position) + , m_physicalSize(520, 320) + , m_mockOutput(new MockOutput(this)) { - const QRect &r = m_outputGeometry; - wl_output_send_geometry(resource, r.x(), r.y(), r.width(), r.height(), 0, "", "",0); } -void Compositor::sendOutputMode(wl_resource *resource) +void Output::setCurrentMode(const QSize &size) { - const QRect &r = m_outputGeometry; - wl_output_send_mode(resource, WL_OUTPUT_MODE_CURRENT | WL_OUTPUT_MODE_PREFERRED, r.width(), r.height(), 60); + qDebug() << Q_FUNC_INFO << size; + m_size = size; + for (Resource *resource : resourceMap()) + sendCurrentMode(resource); } -void Compositor::setOutputGeometry(void *c, const QList ¶meters) +void Output::output_bind_resource(QtWaylandServer::wl_output::Resource *resource) { - Compositor *compositor = static_cast(c); - compositor->m_outputGeometry = parameters.first().toRect(); - - wl_resource *resource; - wl_list_for_each(resource, &compositor->m_outputResources, link) - compositor->sendOutputGeometry(resource); + sendGeometry(resource); + sendCurrentMode(resource); } +void Output::sendGeometry(Resource *resource) +{ + const int subPixel = 0; + const int transform = 0; + + send_geometry(resource->handle, + m_position.x(), m_position.y(), + m_physicalSize.width(), m_physicalSize.height(), + subPixel, "", "", transform ); } +void Output::sendCurrentMode(Resource *resource) +{ + send_mode(resource->handle, + WL_OUTPUT_MODE_CURRENT | WL_OUTPUT_MODE_PREFERRED, + m_size.width(), m_size.height(), 60000); +} + +} // Impl + +MockOutput::MockOutput(Impl::Output *output) + : m_output(output) +{ +} diff --git a/tests/auto/wayland/shared/mockoutput.h b/tests/auto/wayland/shared/mockoutput.h new file mode 100644 index 00000000000..d5a2bb56b6e --- /dev/null +++ b/tests/auto/wayland/shared/mockoutput.h @@ -0,0 +1,62 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef MOCKOUTPUT_H +#define MOCKOUTPUT_H + +#include + +#include "qwayland-server-wayland.h" + +#include "mockcompositor.h" + +namespace Impl { + +class Output : public QtWaylandServer::wl_output +{ +public: + Output(::wl_display *display, const QSize &resolution, const QPoint &position); + + QSharedPointer mockOutput() const { return m_mockOutput; } + void setCurrentMode(const QSize &size); + +protected: + void output_bind_resource(Resource *resource) override; + +private: + void sendGeometry(Resource *resource); + void sendCurrentMode(Resource *resource); + QSize m_size; + QPoint m_position; + const QSize m_physicalSize; + QSharedPointer m_mockOutput; +}; + +} + +#endif // MOCKOUTPUT_H diff --git a/tests/auto/wayland/shared/mocksurface.cpp b/tests/auto/wayland/shared/mocksurface.cpp index 61c9ac1b724..7aa2a00b2da 100644 --- a/tests/auto/wayland/shared/mocksurface.cpp +++ b/tests/auto/wayland/shared/mocksurface.cpp @@ -27,10 +27,39 @@ ****************************************************************************/ #include "mocksurface.h" +#include "mockoutput.h" #include "mockcompositor.h" namespace Impl { +void Compositor::sendSurfaceEnter(void *data, const QList ¶meters) +{ + Q_UNUSED(data); + Surface *surface = resolveSurface(parameters.at(0)); + Output *output = resolveOutput(parameters.at(1)); + Q_ASSERT(surface && surface->resource()); + Q_ASSERT(output); + auto outputResources = output->resourceMap().values(surface->resource()->client()); + Q_ASSERT(!outputResources.isEmpty()); + + for (auto outputResource : outputResources) + surface->send_enter(outputResource->handle); +} + +void Compositor::sendSurfaceLeave(void *data, const QList ¶meters) +{ + Q_UNUSED(data); + Surface *surface = resolveSurface(parameters.at(0)); + Output *output = resolveOutput(parameters.at(1)); + Q_ASSERT(surface && surface->resource()); + Q_ASSERT(output); + auto outputResources = output->resourceMap().values(surface->resource()->client()); + Q_ASSERT(!outputResources.isEmpty()); + + for (auto outputResource : outputResources) + surface->send_leave(outputResource->handle); +} + Surface::Surface(wl_client *client, uint32_t id, int v, Compositor *compositor) : QtWaylandServer::wl_surface(client, id, v) , m_buffer(nullptr) diff --git a/tests/auto/wayland/shared/shared.pri b/tests/auto/wayland/shared/shared.pri index 5edfc09c03f..7b0382efcf6 100644 --- a/tests/auto/wayland/shared/shared.pri +++ b/tests/auto/wayland/shared/shared.pri @@ -21,4 +21,5 @@ SOURCES += \ HEADERS += \ ../shared/mockcompositor.h \ ../shared/mockinput.h \ - ../shared/mocksurface.h + ../shared/mocksurface.h \ + ../shared/mockoutput.h diff --git a/tests/auto/wayland/xdgshellv6/tst_xdgshellv6.cpp b/tests/auto/wayland/xdgshellv6/tst_xdgshellv6.cpp index 6d0f4a003d7..5aac336f272 100644 --- a/tests/auto/wayland/xdgshellv6/tst_xdgshellv6.cpp +++ b/tests/auto/wayland/xdgshellv6/tst_xdgshellv6.cpp @@ -108,7 +108,7 @@ int main(int argc, char **argv) setenv("QT_WAYLAND_DISABLE_WINDOWDECORATION", "1", 1); MockCompositor compositor; - compositor.setOutputGeometry(QRect(QPoint(), screenSize)); + compositor.setOutputMode(screenSize); QGuiApplication app(argc, argv); compositor.applicationInitialized(); From 2b32defc38a6c061a5c17cb6482448e1e2d0efc3 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Mon, 28 Aug 2017 16:05:43 +0200 Subject: [PATCH 0469/1507] Verify that the client supports the compositor removing outputs Change-Id: I799d29fa43ad429b7973d7a210aca554d6b0ce26 Reviewed-by: Pier Luigi Fiorini --- tests/auto/wayland/client/tst_client.cpp | 16 ++++++++++++++++ tests/auto/wayland/shared/mockcompositor.cpp | 7 +++++++ tests/auto/wayland/shared/mockcompositor.h | 2 ++ tests/auto/wayland/shared/mockoutput.cpp | 10 ++++++++++ 4 files changed, 35 insertions(+) diff --git a/tests/auto/wayland/client/tst_client.cpp b/tests/auto/wayland/client/tst_client.cpp index b4dc75131a6..e02aa9f8f32 100644 --- a/tests/auto/wayland/client/tst_client.cpp +++ b/tests/auto/wayland/client/tst_client.cpp @@ -138,6 +138,7 @@ public slots: private slots: void primaryScreen(); + void screens(); void windowScreens(); void createDestroyWindow(); void events(); @@ -158,6 +159,17 @@ void tst_WaylandClient::primaryScreen() QTRY_COMPARE(QGuiApplication::primaryScreen()->size(), screenSize); } +void tst_WaylandClient::screens() +{ + QTRY_COMPARE(QGuiApplication::screens().size(), 1); + compositor->sendAddOutput(); + QTRY_COMPARE(QGuiApplication::screens().size(), 2); + QSharedPointer secondOutput; + QTRY_VERIFY(secondOutput = compositor->output(1)); + compositor->sendRemoveOutput(secondOutput); + QTRY_COMPARE(QGuiApplication::screens().size(), 1); +} + void tst_WaylandClient::windowScreens() { QSharedPointer firstOutput; @@ -191,6 +203,10 @@ void tst_WaylandClient::windowScreens() compositor->sendSurfaceLeave(surface, firstOutput); QTRY_COMPARE(window.screen(), secondaryScreen); + compositor->sendRemoveOutput(secondOutput); + QTRY_COMPARE(QGuiApplication::screens().size(), 1); + QCOMPARE(window.screen(), primaryScreen); + window.destroy(); QTRY_VERIFY(!compositor->surface()); } diff --git a/tests/auto/wayland/shared/mockcompositor.cpp b/tests/auto/wayland/shared/mockcompositor.cpp index 67c05b90adb..e7c6e90d285 100644 --- a/tests/auto/wayland/shared/mockcompositor.cpp +++ b/tests/auto/wayland/shared/mockcompositor.cpp @@ -189,6 +189,13 @@ void MockCompositor::sendAddOutput() processCommand(command); } +void MockCompositor::sendRemoveOutput(const QSharedPointer &output) +{ + Command command = makeCommand(Impl::Compositor::sendRemoveOutput, m_compositor); + command.parameters << QVariant::fromValue(output); + processCommand(command); +} + void MockCompositor::sendSurfaceEnter(const QSharedPointer &surface, QSharedPointer &output) { Command command = makeCommand(Impl::Compositor::sendSurfaceEnter, m_compositor); diff --git a/tests/auto/wayland/shared/mockcompositor.h b/tests/auto/wayland/shared/mockcompositor.h index 54706bd8397..9258b192623 100644 --- a/tests/auto/wayland/shared/mockcompositor.h +++ b/tests/auto/wayland/shared/mockcompositor.h @@ -88,6 +88,7 @@ public: static void waitForStartDrag(void *data, const QList ¶meters); static void setOutputMode(void *compositor, const QList ¶meters); static void sendAddOutput(void *data, const QList ¶meters); + static void sendRemoveOutput(void *data, const QList ¶meters); static void sendSurfaceEnter(void *data, const QList ¶meters); static void sendSurfaceLeave(void *data, const QList ¶meters); @@ -179,6 +180,7 @@ public: void sendDataDeviceDrop(const QSharedPointer &surface); void sendDataDeviceLeave(const QSharedPointer &surface); void sendAddOutput(); + void sendRemoveOutput(const QSharedPointer &output); void sendSurfaceEnter(const QSharedPointer &surface, QSharedPointer &output); void sendSurfaceLeave(const QSharedPointer &surface, QSharedPointer &output); void waitForStartDrag(); diff --git a/tests/auto/wayland/shared/mockoutput.cpp b/tests/auto/wayland/shared/mockoutput.cpp index de8e019adbb..7d7b7413a3e 100644 --- a/tests/auto/wayland/shared/mockoutput.cpp +++ b/tests/auto/wayland/shared/mockoutput.cpp @@ -44,6 +44,16 @@ void Compositor::sendAddOutput(void *data, const QList ¶meters) { compositor->dispatchEvents(); } +void Compositor::sendRemoveOutput(void *data, const QList ¶meters) { + Compositor *compositor = static_cast(data); + Q_ASSERT(compositor); + Output *output = resolveOutput(parameters.first()); + Q_ASSERT(output); + bool wasRemoved = compositor->m_outputs.removeOne(output); + Q_ASSERT(wasRemoved); + delete output; +} + void Compositor::setOutputMode(void *data, const QList ¶meters) { Compositor *compositor = static_cast(data); From a6257efe0cf722dcfdddf4415a8c55f361429671 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Wed, 12 Oct 2016 16:01:27 +0200 Subject: [PATCH 0470/1507] Client: Use QPointer for focus members of input device capabilities Change-Id: I2824269f89fddb7e276cf0e35df3f7c063b6d8b3 Reviewed-by: Pier Luigi Fiorini --- src/plugins/platforms/wayland/qwaylandinputdevice.cpp | 8 +------- src/plugins/platforms/wayland/qwaylandinputdevice_p.h | 7 ++++--- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index 4def0de8f91..f6287ba8fdb 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -272,14 +272,8 @@ QWaylandInputDevice::Touch *QWaylandInputDevice::createTouch(QWaylandInputDevice void QWaylandInputDevice::handleWindowDestroyed(QWaylandWindow *window) { - if (mPointer && window == mPointer->mFocus) - mPointer->mFocus = 0; - if (mKeyboard && window == mKeyboard->mFocus) { - mKeyboard->mFocus = 0; + if (mKeyboard && window == mKeyboard->mFocus) mKeyboard->stopRepeat(); - } - if (mTouch && window == mTouch->mFocus) - mTouch->mFocus = 0; } void QWaylandInputDevice::handleEndDrag() diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h index 9e3d1d1f449..adff3f1137e 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h +++ b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h @@ -71,6 +71,7 @@ #endif #include +#include #if QT_CONFIG(cursor) struct wl_cursor_image; @@ -202,7 +203,7 @@ public: uint32_t group) override; QWaylandInputDevice *mParent; - QWaylandWindow *mFocus; + QPointer mFocus; #if QT_CONFIG(xkbcommon_evdev) xkb_context *mXkbContext; xkb_keymap *mXkbMap; @@ -253,7 +254,7 @@ public: void releaseButtons(); QWaylandInputDevice *mParent; - QWaylandWindow *mFocus; + QPointer mFocus; uint32_t mEnterSerial; #if QT_CONFIG(cursor) uint32_t mCursorSerial; @@ -293,7 +294,7 @@ public: void releasePoints(); QWaylandInputDevice *mParent; - QWaylandWindow *mFocus; + QPointer mFocus; QList mTouchPoints; QList mPrevTouchPoints; }; From f1b07ea1ee9e839a5ca38c4c330511ab6cd0b56c Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Tue, 21 Nov 2017 10:13:43 +0100 Subject: [PATCH 0471/1507] Revert "Ref count buffer usage" When a buffer is committed multiple times, not all compositors (i.e. Weston) send a matching number of release events. This caused clients to freeze on some occasions on those compositors because they were waiting for a release event that never came. This reverts commit 1fbffb9dfb011c3b7c7aaa41b7be3a8167ce0c8a. Task-number: QTBUG-64631 Change-Id: I818d9bd71e5d9ce7a351a2010914b7219b1975bc Reviewed-by: David Edmundson Reviewed-by: Paul Olav Tvete --- src/plugins/platforms/wayland/qwaylandbuffer.cpp | 2 +- src/plugins/platforms/wayland/qwaylandbuffer_p.h | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandbuffer.cpp b/src/plugins/platforms/wayland/qwaylandbuffer.cpp index 076a0d57d74..a0fcc532f5b 100644 --- a/src/plugins/platforms/wayland/qwaylandbuffer.cpp +++ b/src/plugins/platforms/wayland/qwaylandbuffer.cpp @@ -66,7 +66,7 @@ void QWaylandBuffer::init(wl_buffer *buf) void QWaylandBuffer::release(void *data, wl_buffer *) { - static_cast(data)->mBusy--; + static_cast(data)->mBusy = false; } const wl_buffer_listener QWaylandBuffer::listener = { diff --git a/src/plugins/platforms/wayland/qwaylandbuffer_p.h b/src/plugins/platforms/wayland/qwaylandbuffer_p.h index b3513d1515e..9e8cba2e490 100644 --- a/src/plugins/platforms/wayland/qwaylandbuffer_p.h +++ b/src/plugins/platforms/wayland/qwaylandbuffer_p.h @@ -73,14 +73,14 @@ public: virtual QSize size() const = 0; virtual int scale() const { return 1; } - void setBusy() { mBusy++; } - bool busy() const { return mBusy > 0; } + void setBusy() { mBusy = true; } + bool busy() const { return mBusy; } protected: struct wl_buffer *mBuffer; private: - int mBusy; + bool mBusy; static void release(void *data, wl_buffer *); static const wl_buffer_listener listener; From f7e6a478b7d4ccb04bc41a2b93162224e73162be Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Wed, 22 Nov 2017 16:10:39 +0100 Subject: [PATCH 0472/1507] Fix tst_client::windowScreen and tst_client::screens sometimes freezing Sometimes the callback in forceRoundTrip would be handled in response to the QEventDispatcher::aboutToBlockSignal signal emitted at the start of processEvents, and would wait there for more events that may never come. Task-number: QTBUG-64696 Change-Id: I4e38a4dd4158afc606e779ff615b5eef98b955b0 Reviewed-by: Giulio Camuffo --- src/plugins/platforms/wayland/qwaylanddisplay.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index b2372f08898..178b26199d9 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -343,6 +343,15 @@ sync_callback(void *data, struct wl_callback *callback, uint32_t serial) bool *done = static_cast(data); *done = true; + + // If the wl_callback done event is received after the condition check in the while loop in + // forceRoundTrip(), but before the call to processEvents, the call to processEvents may block + // forever if no more events are posted (eventhough the callback is handled in response to the + // aboutToBlock signal). Hence, we wake up the event dispatcher so forceRoundTrip may return. + // (QTBUG-64696) + if (auto *dispatcher = QThread::currentThread()->eventDispatcher()) + dispatcher->wakeUp(); + wl_callback_destroy(callback); } From a5c79599c8d3f6306697743e2f6186fd600c142d Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Tue, 29 Aug 2017 14:40:05 +0200 Subject: [PATCH 0473/1507] Client: Add removePrimaryScreen test Test that removing the primary screen will not crash the application. Task-number: QTBUG-62044 Change-Id: I8ba870e1d608629318ef897f88a6cc0d6e6aa85e Reviewed-by: Pier Luigi Fiorini --- tests/auto/wayland/client/tst_client.cpp | 33 ++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/tests/auto/wayland/client/tst_client.cpp b/tests/auto/wayland/client/tst_client.cpp index e02aa9f8f32..3cf19546fd3 100644 --- a/tests/auto/wayland/client/tst_client.cpp +++ b/tests/auto/wayland/client/tst_client.cpp @@ -140,6 +140,7 @@ private slots: void primaryScreen(); void screens(); void windowScreens(); + void removePrimaryScreen(); void createDestroyWindow(); void events(); void backingStore(); @@ -211,6 +212,38 @@ void tst_WaylandClient::windowScreens() QTRY_VERIFY(!compositor->surface()); } +void tst_WaylandClient::removePrimaryScreen() +{ + QSharedPointer firstOutput; + QTRY_VERIFY(firstOutput = compositor->output()); + + TestWindow window; + window.show(); + + QSharedPointer surface; + QTRY_VERIFY(surface = compositor->surface()); + QTRY_COMPARE(QGuiApplication::screens().size(), 1); + QScreen *primaryScreen = QGuiApplication::screens().first(); + QCOMPARE(window.screen(), primaryScreen); + + compositor->sendAddOutput(); + + QTRY_COMPARE(QGuiApplication::screens().size(), 2); + QScreen *secondaryScreen = QGuiApplication::screens().at(1); + QVERIFY(secondaryScreen); + + compositor->sendRemoveOutput(firstOutput); + QTRY_COMPARE(QGuiApplication::screens().size(), 1); + + compositor->sendMousePress(surface, QPoint(10, 10)); + QTRY_COMPARE(window.mousePressEventCount, 1); + compositor->sendMouseRelease(surface); + QTRY_COMPARE(window.mouseReleaseEventCount, 1); + + window.destroy(); + QTRY_VERIFY(!compositor->surface()); +} + void tst_WaylandClient::createDestroyWindow() { TestWindow window; From e96d16d2b0c352996e0aefeaa8b40c7aed0e0ed8 Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Sat, 25 Nov 2017 10:15:32 +0100 Subject: [PATCH 0474/1507] ivi: Try the ivi-shell as shell integration as well When using the IviApplication in a compositor and launching a Qt Client it will fail to initialize a shell. This is because QtWaylandClient::QWaylandIntegration::initializeShellIntegration will only try some shells by default. Add the ivi-application to make it work out of the box. Add it last to have XDG and WL shell take preference and avoid loading the libivi-shell.so. Change-Id: I5c97c65d81434cba59cf9cb5bbe4b6fd8ccf4757 Reviewed-by: Johan Helsing Reviewed-by: Paul Olav Tvete --- src/plugins/platforms/wayland/qwaylandintegration.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandintegration.cpp b/src/plugins/platforms/wayland/qwaylandintegration.cpp index 34845c63922..f0182218fd3 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandintegration.cpp @@ -397,7 +397,7 @@ void QWaylandIntegration::initializeShellIntegration() "please specify the shell using QT_WAYLAND_SHELL_INTEGRATION instead"; preferredShells << QLatin1String("xdg-shell-v5"); } - preferredShells << QLatin1String("wl-shell"); + preferredShells << QLatin1String("wl-shell") << QLatin1String("ivi-shell"); } Q_FOREACH (QString preferredShell, preferredShells) { From a8a2dc0d8a0076e6b59efd1c7aaedc20c93b3605 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Fri, 1 Dec 2017 10:59:30 +0100 Subject: [PATCH 0475/1507] Port away from QRegion::rects() Use begin()/end() instead. Change-Id: I1a73b4518ee7408271ec913a219c034e330b0d5a Reviewed-by: Johan Helsing --- src/plugins/platforms/wayland/qwaylanddisplay.cpp | 2 +- src/plugins/platforms/wayland/qwaylandwindow.cpp | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index 178b26199d9..360da7a5ceb 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -97,7 +97,7 @@ struct ::wl_region *QWaylandDisplay::createRegion(const QRegion &qregion) { struct ::wl_region *region = mCompositor.create_region(); - Q_FOREACH (const QRect &rect, qregion.rects()) + for (const QRect &rect : qregion) wl_region_add(region, rect.x(), rect.y(), rect.width(), rect.height()); return region; diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 2d7a0c3b50e..28e57be5fca 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -595,8 +595,7 @@ void QWaylandWindow::commit(QWaylandBuffer *buffer, const QRegion &damage) return; attachOffset(buffer); - const QVector rects = damage.rects(); - for (const QRect &rect: rects) + for (const QRect &rect: damage) wl_surface::damage(rect.x(), rect.y(), rect.width(), rect.height()); wl_surface::commit(); } From dd13698a730594d9f40baa367dcfe05bc23f1016 Mon Sep 17 00:00:00 2001 From: Giulio Camuffo Date: Fri, 1 May 2015 17:12:22 +0300 Subject: [PATCH 0476/1507] Implement basic key composition support Use xkbcommon-compose to handle basic compose key support. We should expand on it in the future to handle things like resetting the compose state on text field switching. Task-number: QTBUG-54792 Task-number: QTBUG-64572 Change-Id: I9d1d5ca4c9991928e12979f69eaa477e0cb28ada Reviewed-by: Paul Olav Tvete --- .../platforms/wayland/qwaylandinputdevice.cpp | 65 ++++++++++++++++++- .../platforms/wayland/qwaylandinputdevice_p.h | 9 +++ 2 files changed, 73 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index f6287ba8fdb..115d6dbcf0a 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -70,6 +70,10 @@ #include +#if QT_CONFIG(xkbcommon_evdev) +#include +#endif + QT_BEGIN_NAMESPACE namespace QtWaylandClient { @@ -113,6 +117,7 @@ bool QWaylandInputDevice::Keyboard::createDefaultKeyMap() qWarning() << "xkb_map_new_from_names failed, no key input"; return false; } + createComposeState(); return true; } @@ -125,11 +130,41 @@ void QWaylandInputDevice::Keyboard::releaseKeyMap() if (mXkbContext) xkb_context_unref(mXkbContext); } + +void QWaylandInputDevice::Keyboard::createComposeState() +{ + static const char *locale = nullptr; + if (!locale) { + locale = getenv("LC_ALL"); + if (!locale) + locale = getenv("LC_CTYPE"); + if (!locale) + locale = getenv("LANG"); + if (!locale) + locale = "C"; + } + + mXkbComposeTable = xkb_compose_table_new_from_locale(mXkbContext, locale, XKB_COMPOSE_COMPILE_NO_FLAGS); + if (mXkbComposeTable) + mXkbComposeState = xkb_compose_state_new(mXkbComposeTable, XKB_COMPOSE_STATE_NO_FLAGS); +} + +void QWaylandInputDevice::Keyboard::releaseComposeState() +{ + if (mXkbComposeState) + xkb_compose_state_unref(mXkbComposeState); + if (mXkbComposeTable) + xkb_compose_table_unref(mXkbComposeTable); + mXkbComposeState = nullptr; + mXkbComposeTable = nullptr; +} + #endif QWaylandInputDevice::Keyboard::~Keyboard() { #if QT_CONFIG(xkbcommon_evdev) + releaseComposeState(); releaseKeyMap(); #endif if (mFocus) @@ -626,6 +661,7 @@ void QWaylandInputDevice::Keyboard::keyboard_keymap(uint32_t format, int32_t fd, // Release the old keymap resources in the case they were already created in // the key event or when the compositor issues a new map + releaseComposeState(); releaseKeyMap(); mXkbContext = xkb_context_new(xkb_context_flags(0)); @@ -634,6 +670,8 @@ void QWaylandInputDevice::Keyboard::keyboard_keymap(uint32_t format, int32_t fd, close(fd); mXkbState = xkb_state_new(mXkbMap); + createComposeState(); + #else Q_UNUSED(format); Q_UNUSED(fd); @@ -717,12 +755,37 @@ void QWaylandInputDevice::Keyboard::keyboard_key(uint32_t serial, uint32_t time, return; } - const xkb_keysym_t sym = xkb_state_key_get_one_sym(mXkbState, code); + QString composedText; + xkb_keysym_t sym = xkb_state_key_get_one_sym(mXkbState, code); + if (mXkbComposeState) { + if (isDown) + xkb_compose_state_feed(mXkbComposeState, sym); + xkb_compose_status status = xkb_compose_state_get_status(mXkbComposeState); + + switch (status) { + case XKB_COMPOSE_COMPOSED: { + int size = xkb_compose_state_get_utf8(mXkbComposeState, nullptr, 0); + QVarLengthArray buffer(size + 1); + xkb_compose_state_get_utf8(mXkbComposeState, buffer.data(), buffer.size()); + composedText = QString::fromUtf8(buffer.constData()); + sym = xkb_compose_state_get_one_sym(mXkbComposeState); + xkb_compose_state_reset(mXkbComposeState); + } break; + case XKB_COMPOSE_COMPOSING: + case XKB_COMPOSE_CANCELLED: + return; + case XKB_COMPOSE_NOTHING: + break; + } + } Qt::KeyboardModifiers modifiers = mParent->modifiers(); std::tie(qtkey, text) = QWaylandXkb::keysymToQtKey(sym, modifiers); + if (!composedText.isNull()) + text = composedText; + sendKey(window->window(), time, type, qtkey, modifiers, code, sym, mNativeModifiers, text); #else // Generic fallback for single hard keys: Assume 'key' is a Qt key code. diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h index adff3f1137e..07d261f35bf 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h +++ b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h @@ -77,6 +77,11 @@ struct wl_cursor_image; #endif +#if QT_CONFIG(xkbcommon_evdev) +struct xkb_compose_state; +struct xkb_compose_table; +#endif + QT_BEGIN_NAMESPACE namespace QtWaylandClient { @@ -208,6 +213,8 @@ public: xkb_context *mXkbContext; xkb_keymap *mXkbMap; xkb_state *mXkbState; + xkb_compose_table *mXkbComposeTable = nullptr; + xkb_compose_state *mXkbComposeState = nullptr; #endif uint32_t mNativeModifiers; @@ -229,6 +236,8 @@ private: #if QT_CONFIG(xkbcommon_evdev) bool createDefaultKeyMap(); void releaseKeyMap(); + void createComposeState(); + void releaseComposeState(); #endif }; From 7b40685ad25f746420088cc69c6742111d1e84f7 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Mon, 4 Dec 2017 16:26:50 +0100 Subject: [PATCH 0477/1507] Simplify and modernize QWaylandInputDevice Use enum values and nullptr instead of using magic ints directly. Also get rid of ifdefs in constructors by using in-class member initializers. Change-Id: I037bec7070296a4a8cb46ebe85104caf5a08fb77 Reviewed-by: Pier Luigi Fiorini --- .../platforms/wayland/qwaylandinputdevice.cpp | 69 ++++++------------- .../platforms/wayland/qwaylandinputdevice_p.h | 36 +++++----- 2 files changed, 38 insertions(+), 67 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index 115d6dbcf0a..b34504a1f4b 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -80,13 +80,6 @@ namespace QtWaylandClient { QWaylandInputDevice::Keyboard::Keyboard(QWaylandInputDevice *p) : mParent(p) - , mFocus(0) -#if QT_CONFIG(xkbcommon_evdev) - , mXkbContext(0) - , mXkbMap(0) - , mXkbState(0) -#endif - , mNativeModifiers(0) { connect(&mRepeatTimer, SIGNAL(timeout()), this, SLOT(repeatKey())); } @@ -168,7 +161,7 @@ QWaylandInputDevice::Keyboard::~Keyboard() releaseKeyMap(); #endif if (mFocus) - QWindowSystemInterface::handleWindowActivated(0); + QWindowSystemInterface::handleWindowActivated(nullptr); if (mParent->mVersion >= 3) wl_keyboard_release(object()); else @@ -182,16 +175,6 @@ void QWaylandInputDevice::Keyboard::stopRepeat() QWaylandInputDevice::Pointer::Pointer(QWaylandInputDevice *p) : mParent(p) - , mFocus(0) - , mEnterSerial(0) -#if QT_CONFIG(cursor) - , mCursorSerial(0) -#endif - , mButtons(0) -#if QT_CONFIG(cursor) - , mCursorBuffer(nullptr) - , mCursorShape(Qt::BitmapCursor) -#endif { } @@ -205,7 +188,6 @@ QWaylandInputDevice::Pointer::~Pointer() QWaylandInputDevice::Touch::Touch(QWaylandInputDevice *p) : mParent(p) - , mFocus(0) { } @@ -223,17 +205,6 @@ QWaylandInputDevice::QWaylandInputDevice(QWaylandDisplay *display, int version, , mQDisplay(display) , mDisplay(display->wl_display()) , mVersion(qMin(version, 4)) - , mCaps(0) -#if QT_CONFIG(wayland_datadevice) - , mDataDevice(0) -#endif - , mKeyboard(0) - , mPointer(0) - , mTouch(0) - , mTextInput(0) - , mTime(0) - , mSerial(0) - , mTouchDevice(0) { #if QT_CONFIG(wayland_datadevice) if (mQDisplay->dndSelectionHandler()) { @@ -262,7 +233,7 @@ void QWaylandInputDevice::seat_capabilities(uint32_t caps) mKeyboard->init(get_keyboard()); } else if (!(caps & WL_SEAT_CAPABILITY_KEYBOARD) && mKeyboard) { delete mKeyboard; - mKeyboard = 0; + mKeyboard = nullptr; } if (caps & WL_SEAT_CAPABILITY_POINTER && !mPointer) { @@ -271,7 +242,7 @@ void QWaylandInputDevice::seat_capabilities(uint32_t caps) pointerSurface = mQDisplay->createSurface(this); } else if (!(caps & WL_SEAT_CAPABILITY_POINTER) && mPointer) { delete mPointer; - mPointer = 0; + mPointer = nullptr; } if (caps & WL_SEAT_CAPABILITY_TOUCH && !mTouch) { @@ -286,7 +257,7 @@ void QWaylandInputDevice::seat_capabilities(uint32_t caps) } } else if (!(caps & WL_SEAT_CAPABILITY_TOUCH) && mTouch) { delete mTouch; - mTouch = 0; + mTouch = nullptr; } } @@ -350,17 +321,17 @@ void QWaylandInputDevice::removeMouseButtonFromState(Qt::MouseButton button) QWaylandWindow *QWaylandInputDevice::pointerFocus() const { - return mPointer ? mPointer->mFocus : 0; + return mPointer ? mPointer->mFocus : nullptr; } QWaylandWindow *QWaylandInputDevice::keyboardFocus() const { - return mKeyboard ? mKeyboard->mFocus : 0; + return mKeyboard ? mKeyboard->mFocus : nullptr; } QWaylandWindow *QWaylandInputDevice::touchFocus() const { - return mTouch ? mTouch->mFocus : 0; + return mTouch ? mTouch->mFocus : nullptr; } Qt::KeyboardModifiers QWaylandInputDevice::modifiers() const @@ -440,7 +411,7 @@ void QWaylandInputDevice::setCursor(struct wl_buffer *buffer, const QPoint &hotS /* Hide cursor */ if (!buffer) { - mPointer->set_cursor(mPointer->mEnterSerial, NULL, 0, 0); + mPointer->set_cursor(mPointer->mEnterSerial, nullptr, 0, 0); return; } @@ -463,7 +434,7 @@ class EnterEvent : public QWaylandPointerEvent { public: EnterEvent(const QPointF &l, const QPointF &g) - : QWaylandPointerEvent(QWaylandPointerEvent::Enter, 0, l, g, 0, Qt::NoModifier) + : QWaylandPointerEvent(QWaylandPointerEvent::Enter, 0, l, g, nullptr, Qt::NoModifier) {} }; @@ -503,7 +474,7 @@ void QWaylandInputDevice::Pointer::pointer_leave(uint32_t time, struct wl_surfac QWaylandWindow *window = QWaylandWindow::fromWlSurface(surface); window->handleMouseLeave(mParent); } - mFocus = 0; + mFocus = nullptr; mButtons = Qt::NoButton; mParent->mTime = time; @@ -522,7 +493,7 @@ void QWaylandInputDevice::Pointer::pointer_motion(uint32_t time, wl_fixed_t surf { QWaylandWindow *window = mFocus; - if (window == NULL) { + if (!window) { // We destroyed the pointer focus surface, but the server // didn't get the message yet. return; @@ -624,7 +595,7 @@ void QWaylandInputDevice::Pointer::pointer_axis(uint32_t time, uint32_t axis, in QPoint pixelDelta; QPoint angleDelta; - if (window == NULL) { + if (!window) { // We destroyed the pointer focus surface, but the server // didn't get the message yet. return; @@ -653,7 +624,7 @@ void QWaylandInputDevice::Keyboard::keyboard_keymap(uint32_t format, int32_t fd, return; } - char *map_str = (char *)mmap(NULL, size, PROT_READ, MAP_SHARED, fd, 0); + char *map_str = static_cast(mmap(nullptr, size, PROT_READ, MAP_SHARED, fd, 0)); if (map_str == MAP_FAILED) { close(fd); return; @@ -664,8 +635,8 @@ void QWaylandInputDevice::Keyboard::keyboard_keymap(uint32_t format, int32_t fd, releaseComposeState(); releaseKeyMap(); - mXkbContext = xkb_context_new(xkb_context_flags(0)); - mXkbMap = xkb_map_new_from_string(mXkbContext, map_str, XKB_KEYMAP_FORMAT_TEXT_V1, (xkb_keymap_compile_flags)0); + mXkbContext = xkb_context_new(XKB_CONTEXT_NO_FLAGS); + mXkbMap = xkb_map_new_from_string(mXkbContext, map_str, XKB_KEYMAP_FORMAT_TEXT_V1, XKB_KEYMAP_COMPILE_NO_FLAGS); munmap(map_str, size); close(fd); @@ -704,7 +675,7 @@ void QWaylandInputDevice::Keyboard::keyboard_leave(uint32_t time, struct wl_surf window->unfocus(); } - mFocus = NULL; + mFocus = nullptr; mParent->mQDisplay->handleKeyboardFocusChanged(mParent); @@ -735,7 +706,7 @@ void QWaylandInputDevice::Keyboard::keyboard_key(uint32_t serial, uint32_t time, { QWaylandWindow *window = mFocus; uint32_t code = key + 8; - bool isDown = state != 0; + bool isDown = state != WL_KEYBOARD_KEY_STATE_RELEASED; QEvent::Type type = isDown ? QEvent::KeyPress : QEvent::KeyRelease; QString text; int qtkey = key + 8; // qt-compositor substracts 8 for some reason @@ -874,7 +845,7 @@ void QWaylandInputDevice::Touch::touch_up(uint32_t serial, uint32_t time, int32_ { Q_UNUSED(serial); Q_UNUSED(time); - mFocus = 0; + mFocus = nullptr; mParent->handleTouchPoint(id, 0, 0, Qt::TouchPointReleased); // As of Weston 1.5.90 there is no touch_frame after the last touch_up @@ -900,7 +871,7 @@ void QWaylandInputDevice::Touch::touch_cancel() if (touchExt) touchExt->touchCanceled(); - QWindowSystemInterface::handleTouchCancelEvent(0, mParent->mTouchDevice); + QWindowSystemInterface::handleTouchCancelEvent(nullptr, mParent->mTouchDevice); } void QWaylandInputDevice::handleTouchPoint(int id, double x, double y, Qt::TouchPointState state) @@ -985,7 +956,7 @@ void QWaylandInputDevice::Touch::touch_frame() return; } - QWindow *window = mFocus ? mFocus->window() : 0; + QWindow *window = mFocus ? mFocus->window() : nullptr; if (mFocus) { const QWindowSystemInterface::TouchPoint &tp = mTouchPoints.last(); diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h index 07d261f35bf..8a02769e3bb 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h +++ b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h @@ -147,27 +147,27 @@ private: struct wl_display *mDisplay; int mVersion; - uint32_t mCaps; + uint32_t mCaps = 0; struct wl_surface *pointerSurface; #if QT_CONFIG(wayland_datadevice) - QWaylandDataDevice *mDataDevice; + QWaylandDataDevice *mDataDevice = nullptr; #endif - Keyboard *mKeyboard; - Pointer *mPointer; - Touch *mTouch; + Keyboard *mKeyboard = nullptr; + Pointer *mPointer = nullptr; + Touch *mTouch = nullptr; - QWaylandTextInput *mTextInput; + QWaylandTextInput *mTextInput = nullptr; - uint32_t mTime; - uint32_t mSerial; + uint32_t mTime = 0; + uint32_t mSerial = 0; void seat_capabilities(uint32_t caps) override; void handleTouchPoint(int id, double x, double y, Qt::TouchPointState state); - QTouchDevice *mTouchDevice; + QTouchDevice *mTouchDevice = nullptr; QSharedPointer mPixmapCursor; @@ -210,13 +210,13 @@ public: QWaylandInputDevice *mParent; QPointer mFocus; #if QT_CONFIG(xkbcommon_evdev) - xkb_context *mXkbContext; - xkb_keymap *mXkbMap; - xkb_state *mXkbState; + xkb_context *mXkbContext = nullptr; + xkb_keymap *mXkbMap = nullptr; + xkb_state *mXkbState = nullptr; xkb_compose_table *mXkbComposeTable = nullptr; xkb_compose_state *mXkbComposeState = nullptr; #endif - uint32_t mNativeModifiers; + uint32_t mNativeModifiers = 0; int mRepeatKey; uint32_t mRepeatCode; @@ -264,16 +264,16 @@ public: QWaylandInputDevice *mParent; QPointer mFocus; - uint32_t mEnterSerial; + uint32_t mEnterSerial = 0; #if QT_CONFIG(cursor) - uint32_t mCursorSerial; + uint32_t mCursorSerial = 0; #endif QPointF mSurfacePos; QPointF mGlobalPos; - Qt::MouseButtons mButtons; + Qt::MouseButtons mButtons = Qt::NoButton; #if QT_CONFIG(cursor) - wl_buffer *mCursorBuffer; - Qt::CursorShape mCursorShape; + wl_buffer *mCursorBuffer = nullptr; + Qt::CursorShape mCursorShape = Qt::BitmapCursor; #endif }; From 0f29ae002458fda0c68c39bdc41dd35221e1b8a3 Mon Sep 17 00:00:00 2001 From: Aleix Pol Date: Fri, 13 Oct 2017 15:44:09 +0200 Subject: [PATCH 0478/1507] Fix crash when opening a window with a hidden parent We have a transient parent but it doesn't have a shell surface. We need to make sure that it exists before setting the transient parent's shell surface as the parent to the window. Change-Id: I918b2f14074217638529ba73530f0102f7438079 Reviewed-by: David Edmundson Reviewed-by: Pier Luigi Fiorini --- src/plugins/platforms/wayland/qwaylandxdgshellv6.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandxdgshellv6.cpp b/src/plugins/platforms/wayland/qwaylandxdgshellv6.cpp index cd81778c79c..d9302ed57bb 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgshellv6.cpp +++ b/src/plugins/platforms/wayland/qwaylandxdgshellv6.cpp @@ -169,7 +169,8 @@ void QWaylandXdgSurfaceV6::setType(Qt::WindowType type, QWaylandWindow *transien setToplevel(); if (transientParent) { auto parentXdgSurface = static_cast(transientParent->shellSurface()); - m_toplevel->set_parent(parentXdgSurface->m_toplevel->object()); + if (parentXdgSurface) + m_toplevel->set_parent(parentXdgSurface->m_toplevel->object()); } } } From 0b60f768afdae51ba47e49a6878e0f0d90de3e90 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Fri, 15 Dec 2017 13:35:20 +0100 Subject: [PATCH 0479/1507] Client: Don't leak the last Wayland sync callback If QWaylandDisplay is deleted while waiting for a sync callback, don't leak the callback. Change-Id: I4fd46cdc8c431e44998d70d1afc01018c4908f27 Reviewed-by: Pier Luigi Fiorini --- src/plugins/platforms/wayland/qwaylanddisplay.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index 360da7a5ceb..02b1fd9a9e2 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -157,6 +157,9 @@ QWaylandDisplay::QWaylandDisplay(QWaylandIntegration *waylandIntegration) QWaylandDisplay::~QWaylandDisplay(void) { + if (mSyncCallback) + wl_callback_destroy(mSyncCallback); + qDeleteAll(mInputDevices); mInputDevices.clear(); From d7f4f6ba10e1b981d891b082e51ec5ce56e5d7b0 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Fri, 22 Dec 2017 11:26:41 +0100 Subject: [PATCH 0480/1507] Client tests: Fix wrong position being sent when mocking touch events We were sending ints when we should have been sending wl_fixed_ts. Change-Id: I9f074334cb3ea8a3d61789ff641c2d022a5989b7 Reviewed-by: Pier Luigi Fiorini --- tests/auto/wayland/client/mockinput.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/auto/wayland/client/mockinput.cpp b/tests/auto/wayland/client/mockinput.cpp index 99acdd43a75..b2bcdf2e6b6 100644 --- a/tests/auto/wayland/client/mockinput.cpp +++ b/tests/auto/wayland/client/mockinput.cpp @@ -365,7 +365,9 @@ void Touch::sendDown(Surface *surface, const QPoint &position, int id) Q_ASSERT(surface); Resource *resource = resourceMap().value(surface->resource()->client()); Q_ASSERT(resource); - wl_touch_send_down(resource->handle, serial, time, surface->resource()->handle, id, position.x(), position.y()); + auto x = wl_fixed_from_int(position.x()); + auto y = wl_fixed_from_int(position.y()); + wl_touch_send_down(resource->handle, serial, time, surface->resource()->handle, id, x, y); } void Touch::sendUp(Surface *surface, int id) @@ -378,7 +380,9 @@ void Touch::sendMotion(Surface *surface, const QPoint &position, int id) { Resource *resource = resourceMap().value(surface->resource()->client()); uint32_t time = m_compositor->time(); - wl_touch_send_motion(resource->handle, time, id, position.x(), position.y()); + auto x = wl_fixed_from_int(position.x()); + auto y = wl_fixed_from_int(position.y()); + wl_touch_send_motion(resource->handle, time, id, x, y); } void Touch::sendFrame(Surface *surface) From 2a82da8787a177691641b17337c317ef3c699b9e Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Tue, 21 Nov 2017 10:13:43 +0100 Subject: [PATCH 0481/1507] Revert "Ref count buffer usage" When a buffer is committed multiple times, not all compositors (i.e. Weston) send a matching number of release events. This caused clients to freeze on some occasions on those compositors because they were waiting for a release event that never came. This reverts commit 1fbffb9dfb011c3b7c7aaa41b7be3a8167ce0c8a. Backport from 5.10.0 to 5.9.4 Task-number: QTBUG-64631 Reviewed-by: David Edmundson Reviewed-by: Paul Olav Tvete (cherry picked from commit f1b07ea1ee9e839a5ca38c4c330511ab6cd0b56c) Change-Id: I2acf5574a1b792d3bbf928fb0bc328aa8ee8ffe0 Reviewed-by: Johan Helsing --- src/plugins/platforms/wayland/qwaylandbuffer.cpp | 2 +- src/plugins/platforms/wayland/qwaylandbuffer_p.h | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandbuffer.cpp b/src/plugins/platforms/wayland/qwaylandbuffer.cpp index 076a0d57d74..a0fcc532f5b 100644 --- a/src/plugins/platforms/wayland/qwaylandbuffer.cpp +++ b/src/plugins/platforms/wayland/qwaylandbuffer.cpp @@ -66,7 +66,7 @@ void QWaylandBuffer::init(wl_buffer *buf) void QWaylandBuffer::release(void *data, wl_buffer *) { - static_cast(data)->mBusy--; + static_cast(data)->mBusy = false; } const wl_buffer_listener QWaylandBuffer::listener = { diff --git a/src/plugins/platforms/wayland/qwaylandbuffer_p.h b/src/plugins/platforms/wayland/qwaylandbuffer_p.h index b3513d1515e..9e8cba2e490 100644 --- a/src/plugins/platforms/wayland/qwaylandbuffer_p.h +++ b/src/plugins/platforms/wayland/qwaylandbuffer_p.h @@ -73,14 +73,14 @@ public: virtual QSize size() const = 0; virtual int scale() const { return 1; } - void setBusy() { mBusy++; } - bool busy() const { return mBusy > 0; } + void setBusy() { mBusy = true; } + bool busy() const { return mBusy; } protected: struct wl_buffer *mBuffer; private: - int mBusy; + bool mBusy; static void release(void *data, wl_buffer *); static const wl_buffer_listener listener; From 0483742ad908d3408cdbf29330ee797972b3cf52 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Fri, 22 Dec 2017 11:21:38 +0100 Subject: [PATCH 0482/1507] Client tests: Support testing with window decorations enabled Previously tests would hang because eglInitialize (which was called on window decoration creation) would wait for a Wayland roundtrip while our compositor thread was waiting for more commands. Work around this by prematurely causing the clientBufferIntegration to be initialized before applicationInitialized (when the compositors switches to handling requests synchronously). Change-Id: I793c70a8f3a764cb3a70f00ddcab76cd4044b442 Reviewed-by: Pier Luigi Fiorini --- tests/auto/wayland/client/client.pro | 2 +- tests/auto/wayland/client/tst_client.cpp | 37 ++++++++++++++---------- 2 files changed, 23 insertions(+), 16 deletions(-) diff --git a/tests/auto/wayland/client/client.pro b/tests/auto/wayland/client/client.pro index 34fc67474db..e6e607c3f60 100644 --- a/tests/auto/wayland/client/client.pro +++ b/tests/auto/wayland/client/client.pro @@ -2,7 +2,7 @@ CONFIG += testcase link_pkgconfig TARGET = tst_client QT += testlib -QT += core-private gui-private +QT += core-private gui-private waylandclient-private QMAKE_USE += wayland-client wayland-server diff --git a/tests/auto/wayland/client/tst_client.cpp b/tests/auto/wayland/client/tst_client.cpp index 1eee90f49db..3897bd3b129 100644 --- a/tests/auto/wayland/client/tst_client.cpp +++ b/tests/auto/wayland/client/tst_client.cpp @@ -37,6 +37,8 @@ #include #include +#include +#include static const QSize screenSize(1600, 1200); @@ -96,6 +98,8 @@ public: ++touchEventCount; } + QPoint frameOffset() const { return QPoint(frameMargins().left(), frameMargins().top()); } + int focusInEventCount; int focusOutEventCount; int keyPressEventCount; @@ -201,7 +205,7 @@ void tst_WaylandClient::events() QPoint mousePressPos(16, 16); QCOMPARE(window.mousePressEventCount, 0); - compositor->sendMousePress(surface, mousePressPos); + compositor->sendMousePress(surface, window.frameOffset() + mousePressPos); QTRY_COMPARE(window.mousePressEventCount, 1); QTRY_COMPARE(window.mousePressPos, mousePressPos); @@ -210,7 +214,7 @@ void tst_WaylandClient::events() QTRY_COMPARE(window.mouseReleaseEventCount, 1); const int touchId = 0; - compositor->sendTouchDown(surface, QPoint(10, 10), touchId); + compositor->sendTouchDown(surface, window.frameOffset() + QPoint(10, 10), touchId); compositor->sendTouchFrame(surface); QTRY_COMPARE(window.touchEventCount, 1); @@ -269,6 +273,7 @@ public: m_dragIcon = QPixmap::fromImage(cursorImage); } ~DndWindow(){} + QPoint frameOffset() const { return QPoint(frameMargins().left(), frameMargins().top()); } bool dragStarted; protected: @@ -302,14 +307,14 @@ void tst_WaylandClient::touchDrag() QTRY_COMPARE(QGuiApplication::focusWindow(), &window); const int id = 0; - compositor->sendTouchDown(surface, QPoint(10, 10), id); + compositor->sendTouchDown(surface, window.frameOffset() + QPoint(10, 10), id); compositor->sendTouchFrame(surface); - compositor->sendTouchMotion(surface, QPoint(20, 20), id); + compositor->sendTouchMotion(surface, window.frameOffset() + QPoint(20, 20), id); compositor->sendTouchFrame(surface); compositor->waitForStartDrag(); compositor->sendDataDeviceDataOffer(surface); - compositor->sendDataDeviceEnter(surface, QPoint(20, 20)); - compositor->sendDataDeviceMotion( QPoint(21, 21)); + compositor->sendDataDeviceEnter(surface, window.frameOffset() + QPoint(20, 20)); + compositor->sendDataDeviceMotion(window.frameOffset() + QPoint(21, 21)); compositor->sendDataDeviceDrop(surface); compositor->sendDataDeviceLeave(surface); QTRY_VERIFY(window.dragStarted); @@ -326,10 +331,10 @@ void tst_WaylandClient::mouseDrag() compositor->setKeyboardFocus(surface); QTRY_COMPARE(QGuiApplication::focusWindow(), &window); - compositor->sendMousePress(surface, QPoint(10, 10)); + compositor->sendMousePress(surface, window.frameOffset() + QPoint(10, 10)); compositor->sendDataDeviceDataOffer(surface); - compositor->sendDataDeviceEnter(surface, QPoint(20, 20)); - compositor->sendDataDeviceMotion( QPoint(21, 21)); + compositor->sendDataDeviceEnter(surface, window.frameOffset() + QPoint(20, 20)); + compositor->sendDataDeviceMotion(window.frameOffset() + QPoint(21, 21)); compositor->waitForStartDrag(); compositor->sendDataDeviceDrop(surface); compositor->sendDataDeviceLeave(surface); @@ -390,7 +395,7 @@ void tst_WaylandClient::hiddenPopupParent() QTRY_VERIFY(surface = compositor->surface()); QPoint mousePressPos(16, 16); QCOMPARE(toplevel.mousePressEventCount, 0); - compositor->sendMousePress(surface, mousePressPos); + compositor->sendMousePress(surface, toplevel.frameOffset() + mousePressPos); QTRY_COMPARE(toplevel.mousePressEventCount, 1); QWindow popup; @@ -409,15 +414,17 @@ int main(int argc, char **argv) setenv("XDG_RUNTIME_DIR", ".", 1); setenv("QT_QPA_PLATFORM", "wayland", 1); // force QGuiApplication to use wayland plugin - // wayland-egl hangs in the test setup when we try to initialize. Until it gets - // figured out, avoid clientBufferIntegration() from being called in - // QWaylandWindow::createDecorations(). - setenv("QT_WAYLAND_DISABLE_WINDOWDECORATION", "1", 1); - MockCompositor compositor; compositor.setOutputGeometry(QRect(QPoint(), screenSize)); QGuiApplication app(argc, argv); + + // Initializing some client buffer integrations (i.e. eglInitialize) may block while waiting + // for a wayland sync. So we call clientBufferIntegration prior to applicationInitialized + // (while the compositor processes events without waiting) in order to avoid hanging later. + auto *waylandIntegration = static_cast(QGuiApplicationPrivate::platformIntegration()); + waylandIntegration->clientBufferIntegration(); + compositor.applicationInitialized(); tst_WaylandClient tc(&compositor); From 6b8598729919eca4d12426c46237d98860236e37 Mon Sep 17 00:00:00 2001 From: Liang Qi Date: Sat, 6 Jan 2018 23:11:56 +0100 Subject: [PATCH 0483/1507] Adapt to qtbase 5.10 API change: qssize_t -> qsizetype Task-number: QTBUG-65600 Done-with: Thiago Macieira Change-Id: I34116dad8eecd01090596270965b9a24f6fe8f39 Reviewed-by: Thiago Macieira --- src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp b/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp index a9883c5c642..a13a5f7643e 100644 --- a/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp +++ b/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp @@ -287,7 +287,7 @@ void QWaylandShmBackingStore::resize(const QSize &size) buffer = getBuffer(sizeWithMargins); } - qssize_t oldSize = mBackBuffer ? mBackBuffer->image()->sizeInBytes() : 0; + qsizetype oldSize = mBackBuffer ? mBackBuffer->image()->sizeInBytes() : 0; // mBackBuffer may have been deleted here but if so it means its size was different so we wouldn't copy it anyway if (mBackBuffer != buffer && oldSize == buffer->image()->sizeInBytes()) { memcpy(buffer->image()->bits(), mBackBuffer->image()->constBits(), buffer->image()->sizeInBytes()); From f94c0f2cb6cb1ffa7a03e93228729802bfb5af93 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Fri, 5 Jan 2018 12:44:30 +0100 Subject: [PATCH 0484/1507] Fix protocol error when destroying xdg surfaces (v6) Destroy role object for toplevels when destroying the xdg surface. Task-number: QTBUG-65568 Change-Id: Ibe027c3eef8160f9fd2cfb05971c92ceb155f95b Reviewed-by: David Edmundson Reviewed-by: Pier Luigi Fiorini --- src/plugins/platforms/wayland/qwaylandxdgshellv6.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/plugins/platforms/wayland/qwaylandxdgshellv6.cpp b/src/plugins/platforms/wayland/qwaylandxdgshellv6.cpp index cd81778c79c..7473174d1bf 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgshellv6.cpp +++ b/src/plugins/platforms/wayland/qwaylandxdgshellv6.cpp @@ -125,6 +125,8 @@ QWaylandXdgSurfaceV6::QWaylandXdgSurfaceV6(QWaylandXdgShellV6 *shell, ::zxdg_sur QWaylandXdgSurfaceV6::~QWaylandXdgSurfaceV6() { + if (m_toplevel) + zxdg_toplevel_v6_destroy(m_toplevel->object()); if (m_popup) zxdg_popup_v6_destroy(m_popup->object()); destroy(); From 8f880a5d5de73d05d466b11f348f804b34d5539c Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Wed, 10 Jan 2018 10:02:53 +0100 Subject: [PATCH 0485/1507] QWaylandWindow: Fix incorrect namespace order Change-Id: I741d3fb392c6121f2d8514ee2504fc88f99092ff Reviewed-by: Pier Luigi Fiorini --- src/plugins/platforms/wayland/qwaylandwindow_p.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index c9593441408..fca96f30d50 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -287,8 +287,8 @@ inline QPoint QWaylandWindow::attachOffset() const return mOffset; } -QT_END_NAMESPACE - } +QT_END_NAMESPACE + #endif // QWAYLANDWINDOW_H From 6ec8b1093a3d2f6d62846091abe35098c55eec10 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Tue, 16 Jan 2018 12:02:30 +0100 Subject: [PATCH 0486/1507] Fix static builds with libwayland-egl There was a naming conflict between the client buffer integration, wayland-egl, and the system library libwayland-egl.so Rename the plugin binary to qt-plugin-wayland-egl to avoid the issue. Task-number: QTBUG-65652 Change-Id: Ib074c25e269a5e11b087fb4c3ddb15fef7d4a7ee Reviewed-by: Paul Olav Tvete --- .../plugins/hardwareintegration/wayland-egl/wayland-egl.pro | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/wayland-egl.pro b/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/wayland-egl.pro index d85c5efaaa1..409cd37d7c7 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/wayland-egl.pro +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/wayland-egl.pro @@ -7,6 +7,8 @@ OTHER_FILES += \ SOURCES += main.cpp +TARGET = qt-plugin-wayland-egl + PLUGIN_TYPE = wayland-graphics-integration-client PLUGIN_CLASS_NAME = QWaylandEglClientBufferPlugin load(qt_plugin) From dd2018f0e54469dbb83930563a2ee603d1197e52 Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Wed, 3 Jan 2018 19:18:42 +0000 Subject: [PATCH 0487/1507] Don't recreate hidden egl surfaces QWaylandEglWindow deletes surfaces when a window changes from hidden to visible, presumably as a result of us not having a valid wl_surface object. By extension it doesn't make sense to create a surface whilst a window is still hidden. This fixes a crash where a QQuickWindow hides and then is destroyed. In QQuickWindow destruction we have to create a valid context in order to delete any textures/assets owned by the scene graph; as the wl_surface has gone this causes an error in the EGL libs when we create an EGL surface. Task-number: QTBUG-65553 Change-Id: I9b37a86326bf2cd7737c4e839c1aa8c74cf08116 Reviewed-by: Johan Helsing --- tests/auto/wayland/client/tst_client.cpp | 37 ++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/tests/auto/wayland/client/tst_client.cpp b/tests/auto/wayland/client/tst_client.cpp index 3897bd3b129..aed601d8a75 100644 --- a/tests/auto/wayland/client/tst_client.cpp +++ b/tests/auto/wayland/client/tst_client.cpp @@ -35,6 +35,8 @@ #include #include #include +#include +#include #include #include @@ -112,6 +114,25 @@ public: QPoint mousePressPos; }; +class TestGlWindow : public QOpenGLWindow +{ + Q_OBJECT + +public: + TestGlWindow(); + +protected: + void paintGL() override; +}; + +TestGlWindow::TestGlWindow() +{} + +void TestGlWindow::paintGL() +{ + glClear(GL_COLOR_BUFFER_BIT); +} + class tst_WaylandClient : public QObject { Q_OBJECT @@ -149,6 +170,7 @@ private slots: void dontCrashOnMultipleCommits(); void hiddenTransientParent(); void hiddenPopupParent(); + void glWindow(); private: MockCompositor *compositor; @@ -409,6 +431,21 @@ void tst_WaylandClient::hiddenPopupParent() QTRY_VERIFY(compositor->surface()); } +void tst_WaylandClient::glWindow() +{ + QSKIP("Skipping GL tests, as not supported by all CI systems: See https://bugreports.qt.io/browse/QTBUG-65802"); + + QScopedPointer testWindow(new TestGlWindow); + testWindow->show(); + QSharedPointer surface; + QTRY_VERIFY(surface = compositor->surface()); + + //confirm we don't crash when we delete an already hidden GL window + //QTBUG-65553 + testWindow->setVisible(false); + QTRY_VERIFY(!compositor->surface()); +} + int main(int argc, char **argv) { setenv("XDG_RUNTIME_DIR", ".", 1); From d4dc5f357353ca30e1a109983fa81d1231cf42e3 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Mon, 8 Jan 2018 13:30:51 +0100 Subject: [PATCH 0488/1507] Fix requestUpdate() After commit 027a7131543b0194a7d9e98a6b53928e30bc080f, mFrameCallback is set to null when the next buffer is attached, not when the callback arrives. This means that a requestUpdate() after the frame callback would never be delivered. The solution is to test mWaitingForFrameSync instead. There is still a small race condition, but the failure case is that the update will arrive after 5 ms instead of exactly at frame sync. Change-Id: I413ed2b76c8527f825e501077bab712146b6705f Reviewed-by: Johan Helsing --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 6d7c0885c80..d9870810049 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -1029,7 +1029,7 @@ QVariant QWaylandWindow::property(const QString &name, const QVariant &defaultVa void QWaylandWindow::requestUpdate() { - if (!mFrameCallback) + if (!mWaitingForFrameSync) QPlatformWindow::requestUpdate(); else mUpdateRequested = true; From 8de7183ae12e63fbd49ea776ca4d7ef08ccf1cb0 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Fri, 5 Jan 2018 12:31:15 +0100 Subject: [PATCH 0489/1507] Test that xdg_toplevel_v6s are destroyed before xdg_surface_v6s Adds an assert so tst_WaylandClientXdgShellV6::createDestroyWindow verifies deletion order. Task-number: QTBUG-65568 Change-Id: I0b4dd350f811495a9c7a78811915647fb713a43a Reviewed-by: Pier Luigi Fiorini --- tests/auto/wayland/shared/mockxdgshellv6.cpp | 25 ++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/tests/auto/wayland/shared/mockxdgshellv6.cpp b/tests/auto/wayland/shared/mockxdgshellv6.cpp index fe9d118570f..b26ac1c8df1 100644 --- a/tests/auto/wayland/shared/mockxdgshellv6.cpp +++ b/tests/auto/wayland/shared/mockxdgshellv6.cpp @@ -33,24 +33,41 @@ namespace Impl { +class XdgSurfaceV6; + class XdgToplevelV6 : public QtWaylandServer::zxdg_toplevel_v6 { public: - XdgToplevelV6(wl_client *client, uint32_t id, int version) + XdgToplevelV6(XdgSurfaceV6 *xdgSurface, wl_client *client, uint32_t id, int version) : QtWaylandServer::zxdg_toplevel_v6(client, id, version) + , m_xdgSurface(xdgSurface) {} - void zxdg_toplevel_v6_destroy_resource(Resource *resource) override { delete this; } + void zxdg_toplevel_v6_destroy_resource(Resource *) override { delete this; } + void zxdg_toplevel_v6_destroy(Resource *resource) override; + XdgSurfaceV6 *m_xdgSurface = nullptr; }; class XdgSurfaceV6 : public QtWaylandServer::zxdg_surface_v6 { public: XdgSurfaceV6(wl_client *client, uint32_t id, int version, Surface *surface); - void zxdg_surface_v6_destroy_resource(Resource *resource) override { delete this; } + void zxdg_surface_v6_destroy_resource(Resource *) override { delete this; } void zxdg_surface_v6_get_toplevel(Resource *resource, uint32_t id) override; + void zxdg_surface_v6_destroy(Resource *resource) override + { + Q_ASSERT(!m_toplevel); + wl_resource_destroy(resource->handle); + } Surface *m_surface = nullptr; + XdgToplevelV6 *m_toplevel = nullptr; }; +void XdgToplevelV6::zxdg_toplevel_v6_destroy(QtWaylandServer::zxdg_toplevel_v6::Resource *resource) +{ + m_xdgSurface->m_toplevel = nullptr; + wl_resource_destroy(resource->handle); +} + XdgSurfaceV6::XdgSurfaceV6(wl_client *client, uint32_t id, int version, Surface *surface) : QtWaylandServer::zxdg_surface_v6(client, id, version) , m_surface(surface) @@ -60,7 +77,7 @@ XdgSurfaceV6::XdgSurfaceV6(wl_client *client, uint32_t id, int version, Surface void XdgSurfaceV6::zxdg_surface_v6_get_toplevel(QtWaylandServer::zxdg_surface_v6::Resource *resource, uint32_t id) { int version = wl_resource_get_version(resource->handle); - new XdgToplevelV6(resource->client(), id, version); + m_toplevel = new XdgToplevelV6(this, resource->client(), id, version); m_surface->map(); } From 6eac43515d2e4970bf5cd7bb2449110472fdd854 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Tue, 20 Feb 2018 13:35:03 +0100 Subject: [PATCH 0490/1507] Use nullptr instead of 0 or NULL Applied automatic fixes using clang-tidy's modernize-use-nullptr, and some manual cleanup to prevent QFlag macros to be affected. Change-Id: I88f94390185bc6e6f23693b68723cd5710815ae6 Reviewed-by: Shawn Rutledge --- .../global/qwaylandclientextension.cpp | 2 +- ...qwaylandclientbufferintegrationfactory.cpp | 2 +- .../qwaylandclientbufferintegrationplugin_p.h | 2 +- .../qwaylandserverbufferintegration.cpp | 2 +- ...qwaylandserverbufferintegrationfactory.cpp | 2 +- .../qwaylandserverbufferintegrationplugin_p.h | 2 +- .../qwaylandinputdeviceintegrationplugin_p.h | 2 +- .../wayland/qwaylandabstractdecoration.cpp | 6 ++-- .../platforms/wayland/qwaylandbuffer.cpp | 2 +- .../platforms/wayland/qwaylandclipboard.cpp | 4 +-- .../platforms/wayland/qwaylandcursor.cpp | 12 ++++---- .../platforms/wayland/qwaylanddatadevice.cpp | 10 +++---- .../wayland/qwaylanddecorationfactory.cpp | 2 +- .../wayland/qwaylanddecorationplugin_p.h | 2 +- .../platforms/wayland/qwaylanddisplay.cpp | 30 +++++++++---------- .../wayland/qwaylandinputcontext.cpp | 2 +- .../platforms/wayland/qwaylandintegration.cpp | 4 +-- .../platforms/wayland/qwaylandscreen.cpp | 2 +- .../wayland/qwaylandshmbackingstore.cpp | 16 +++++----- .../platforms/wayland/qwaylandtouch.cpp | 4 +-- .../platforms/wayland/qwaylandwindow.cpp | 22 +++++++------- .../wayland/qwaylandwlshellsurface.cpp | 4 +-- .../qwaylandshellintegrationplugin_p.h | 2 +- .../qtwaylandscanner/qtwaylandscanner.cpp | 2 +- tests/auto/wayland/client/tst_client.cpp | 6 ++-- 25 files changed, 73 insertions(+), 73 deletions(-) diff --git a/src/plugins/platforms/wayland/global/qwaylandclientextension.cpp b/src/plugins/platforms/wayland/global/qwaylandclientextension.cpp index ad266a68392..60a8944f8bf 100644 --- a/src/plugins/platforms/wayland/global/qwaylandclientextension.cpp +++ b/src/plugins/platforms/wayland/global/qwaylandclientextension.cpp @@ -50,7 +50,7 @@ QT_BEGIN_NAMESPACE QWaylandClientExtensionPrivate::QWaylandClientExtensionPrivate() : QObjectPrivate() - , waylandIntegration(NULL) + , waylandIntegration(nullptr) , version(-1) , active(false) { diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationfactory.cpp b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationfactory.cpp index eebd69a8703..02bed461a85 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationfactory.cpp +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationfactory.cpp @@ -90,7 +90,7 @@ QWaylandClientBufferIntegration *QWaylandClientBufferIntegrationFactory::create( if (QWaylandClientBufferIntegration *ret = qLoadPlugin(loader(), name, args)) return ret; #endif - return 0; + return nullptr; } } diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationplugin_p.h b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationplugin_p.h index 6496b33ed3c..1711852c7c2 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationplugin_p.h +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationplugin_p.h @@ -69,7 +69,7 @@ class Q_WAYLAND_CLIENT_EXPORT QWaylandClientBufferIntegrationPlugin : public QOb { Q_OBJECT public: - explicit QWaylandClientBufferIntegrationPlugin(QObject *parent = 0); + explicit QWaylandClientBufferIntegrationPlugin(QObject *parent = nullptr); ~QWaylandClientBufferIntegrationPlugin(); virtual QWaylandClientBufferIntegration *create(const QString &key, const QStringList ¶mList) = 0; diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegration.cpp b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegration.cpp index 1d64e0f51bf..013ddae9f5a 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegration.cpp +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegration.cpp @@ -44,7 +44,7 @@ QT_BEGIN_NAMESPACE namespace QtWaylandClient { QWaylandServerBuffer::QWaylandServerBuffer() - : m_user_data(0) + : m_user_data(nullptr) { } diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationfactory.cpp b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationfactory.cpp index aa2f54cb7d5..39d65f88dbd 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationfactory.cpp +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationfactory.cpp @@ -90,7 +90,7 @@ QWaylandServerBufferIntegration *QWaylandServerBufferIntegrationFactory::create( if (QWaylandServerBufferIntegration *ret = qLoadPlugin(loader(), name, args)) return ret; #endif - return 0; + return nullptr; } } diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationplugin_p.h b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationplugin_p.h index b3ed3ccc5bf..bf6c04f8276 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationplugin_p.h +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationplugin_p.h @@ -69,7 +69,7 @@ class Q_WAYLAND_CLIENT_EXPORT QWaylandServerBufferIntegrationPlugin : public QOb { Q_OBJECT public: - explicit QWaylandServerBufferIntegrationPlugin(QObject *parent = 0); + explicit QWaylandServerBufferIntegrationPlugin(QObject *parent = nullptr); ~QWaylandServerBufferIntegrationPlugin(); virtual QWaylandServerBufferIntegration *create(const QString &key, const QStringList ¶mList) = 0; diff --git a/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationplugin_p.h b/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationplugin_p.h index 2d9961dba65..104d594ca08 100644 --- a/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationplugin_p.h +++ b/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationplugin_p.h @@ -69,7 +69,7 @@ class Q_WAYLAND_CLIENT_EXPORT QWaylandInputDeviceIntegrationPlugin : public QObj { Q_OBJECT public: - explicit QWaylandInputDeviceIntegrationPlugin(QObject *parent = 0); + explicit QWaylandInputDeviceIntegrationPlugin(QObject *parent = nullptr); ~QWaylandInputDeviceIntegrationPlugin(); virtual QWaylandInputDeviceIntegration *create(const QString &key, const QStringList ¶mList) = 0; diff --git a/src/plugins/platforms/wayland/qwaylandabstractdecoration.cpp b/src/plugins/platforms/wayland/qwaylandabstractdecoration.cpp index daaf4e6bc0d..6a7a2ef4cdb 100644 --- a/src/plugins/platforms/wayland/qwaylandabstractdecoration.cpp +++ b/src/plugins/platforms/wayland/qwaylandabstractdecoration.cpp @@ -70,10 +70,10 @@ public: }; QWaylandAbstractDecorationPrivate::QWaylandAbstractDecorationPrivate() - : m_window(0) - , m_wayland_window(0) + : m_window(nullptr) + , m_wayland_window(nullptr) , m_isDirty(true) - , m_decorationContentImage(0) + , m_decorationContentImage(nullptr) , m_mouseButtons(Qt::NoButton) { } diff --git a/src/plugins/platforms/wayland/qwaylandbuffer.cpp b/src/plugins/platforms/wayland/qwaylandbuffer.cpp index a0fcc532f5b..2dc99b3b758 100644 --- a/src/plugins/platforms/wayland/qwaylandbuffer.cpp +++ b/src/plugins/platforms/wayland/qwaylandbuffer.cpp @@ -47,7 +47,7 @@ QT_BEGIN_NAMESPACE namespace QtWaylandClient { QWaylandBuffer::QWaylandBuffer() - : mBuffer(0) + : mBuffer(nullptr) , mBusy(false) { } diff --git a/src/plugins/platforms/wayland/qwaylandclipboard.cpp b/src/plugins/platforms/wayland/qwaylandclipboard.cpp index 5da1202687e..60820da92d8 100644 --- a/src/plugins/platforms/wayland/qwaylandclipboard.cpp +++ b/src/plugins/platforms/wayland/qwaylandclipboard.cpp @@ -90,7 +90,7 @@ void QWaylandClipboard::setMimeData(QMimeData *data, QClipboard::Mode mode) static const QString utf8 = QStringLiteral("text/plain;charset=utf-8"); if (data && data->hasFormat(plain) && !data->hasFormat(utf8)) data->setData(utf8, data->data(plain)); - inputDevice->dataDevice()->setSelectionSource(data ? new QWaylandDataSource(mDisplay->dndSelectionHandler(), data) : 0); + inputDevice->dataDevice()->setSelectionSource(data ? new QWaylandDataSource(mDisplay->dndSelectionHandler(), data) : nullptr); emitChanged(mode); } @@ -109,7 +109,7 @@ bool QWaylandClipboard::ownsMode(QClipboard::Mode mode) const if (!inputDevice || !inputDevice->dataDevice()) return false; - return inputDevice->dataDevice()->selectionSource() != 0; + return inputDevice->dataDevice()->selectionSource() != nullptr; } } diff --git a/src/plugins/platforms/wayland/qwaylandcursor.cpp b/src/plugins/platforms/wayland/qwaylandcursor.cpp index bd820e28e84..21a6c0811c1 100644 --- a/src/plugins/platforms/wayland/qwaylandcursor.cpp +++ b/src/plugins/platforms/wayland/qwaylandcursor.cpp @@ -79,13 +79,13 @@ QWaylandCursor::~QWaylandCursor() struct wl_cursor_image *QWaylandCursor::cursorImage(Qt::CursorShape newShape) { - struct wl_cursor *waylandCursor = 0; + struct wl_cursor *waylandCursor = nullptr; /* Hide cursor */ if (newShape == Qt::BlankCursor) { - mDisplay->setCursor(NULL, NULL); - return NULL; + mDisplay->setCursor(nullptr, nullptr); + return nullptr; } if (newShape < Qt::BitmapCursor) { @@ -99,14 +99,14 @@ struct wl_cursor_image *QWaylandCursor::cursorImage(Qt::CursorShape newShape) if (!waylandCursor) { qDebug("Could not find cursor for shape %d", newShape); - return NULL; + return nullptr; } struct wl_cursor_image *image = waylandCursor->images[0]; struct wl_buffer *buffer = wl_cursor_image_get_buffer(image); if (!buffer) { qDebug("Could not find buffer for cursor"); - return NULL; + return nullptr; } return image; @@ -166,7 +166,7 @@ wl_cursor *QWaylandCursor::requestCursor(WaylandCursor shape) //If the cursor has not been loaded already, load it if (!cursor) { if (!mCursorTheme) - return NULL; + return nullptr; QList cursorNames = mCursorNamesMap.values(shape); foreach (const QByteArray &name, cursorNames) { diff --git a/src/plugins/platforms/wayland/qwaylanddatadevice.cpp b/src/plugins/platforms/wayland/qwaylanddatadevice.cpp index 66f36f75be7..83912035a4f 100644 --- a/src/plugins/platforms/wayland/qwaylanddatadevice.cpp +++ b/src/plugins/platforms/wayland/qwaylanddatadevice.cpp @@ -67,7 +67,7 @@ QWaylandDataDevice::QWaylandDataDevice(QWaylandDataDeviceManager *manager, QWayl , m_display(manager->display()) , m_inputDevice(inputDevice) , m_enterSerial(0) - , m_dragWindow(0) + , m_dragWindow(nullptr) , m_dragPoint() , m_dragOffer() , m_selectionOffer() @@ -135,7 +135,7 @@ void QWaylandDataDevice::data_device_drop() { QDrag *drag = static_cast(QGuiApplicationPrivate::platformIntegration()->drag())->currentDrag(); - QMimeData *dragData = 0; + QMimeData *dragData = nullptr; Qt::DropActions supportedActions; if (drag) { dragData = drag->mimeData(); @@ -182,14 +182,14 @@ void QWaylandDataDevice::data_device_enter(uint32_t serial, wl_surface *surface, if (response.isAccepted()) { wl_data_offer_accept(m_dragOffer->object(), m_enterSerial, m_dragOffer->firstFormat().toUtf8().constData()); } else { - wl_data_offer_accept(m_dragOffer->object(), m_enterSerial, 0); + wl_data_offer_accept(m_dragOffer->object(), m_enterSerial, nullptr); } } void QWaylandDataDevice::data_device_leave() { if (m_dragWindow) - QWindowSystemInterface::handleDrag(m_dragWindow, 0, QPoint(), Qt::IgnoreAction); + QWindowSystemInterface::handleDrag(m_dragWindow, nullptr, QPoint(), Qt::IgnoreAction); QDrag *drag = static_cast(QGuiApplicationPrivate::platformIntegration()->drag())->currentDrag(); if (!drag) { @@ -227,7 +227,7 @@ void QWaylandDataDevice::data_device_motion(uint32_t time, wl_fixed_t x, wl_fixe if (response.isAccepted()) { wl_data_offer_accept(m_dragOffer->object(), m_enterSerial, m_dragOffer->firstFormat().toUtf8().constData()); } else { - wl_data_offer_accept(m_dragOffer->object(), m_enterSerial, 0); + wl_data_offer_accept(m_dragOffer->object(), m_enterSerial, nullptr); } } #endif // QT_CONFIG(draganddrop) diff --git a/src/plugins/platforms/wayland/qwaylanddecorationfactory.cpp b/src/plugins/platforms/wayland/qwaylanddecorationfactory.cpp index ccf2c806c3a..32db96e581c 100644 --- a/src/plugins/platforms/wayland/qwaylanddecorationfactory.cpp +++ b/src/plugins/platforms/wayland/qwaylanddecorationfactory.cpp @@ -91,7 +91,7 @@ QWaylandAbstractDecoration *QWaylandDecorationFactory::create(const QString &nam return ret; #endif - return 0; + return nullptr; } } diff --git a/src/plugins/platforms/wayland/qwaylanddecorationplugin_p.h b/src/plugins/platforms/wayland/qwaylanddecorationplugin_p.h index c549b24bee9..4255de46f16 100644 --- a/src/plugins/platforms/wayland/qwaylanddecorationplugin_p.h +++ b/src/plugins/platforms/wayland/qwaylanddecorationplugin_p.h @@ -69,7 +69,7 @@ class Q_WAYLAND_CLIENT_EXPORT QWaylandDecorationPlugin : public QObject { Q_OBJECT public: - explicit QWaylandDecorationPlugin(QObject *parent = 0); + explicit QWaylandDecorationPlugin(QObject *parent = nullptr); ~QWaylandDecorationPlugin(); virtual QWaylandAbstractDecoration *create(const QString &key, const QStringList ¶mList) = 0; diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index 02b1fd9a9e2..942494f93cd 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -89,7 +89,7 @@ struct wl_surface *QWaylandDisplay::createSurface(void *handle) QWaylandShellSurface *QWaylandDisplay::createShellSurface(QWaylandWindow *window) { if (!mWaylandIntegration->shellIntegration()) - return 0; + return nullptr; return mWaylandIntegration->shellIntegration()->createShellSurface(window); } @@ -106,7 +106,7 @@ struct ::wl_region *QWaylandDisplay::createRegion(const QRegion &qregion) ::wl_subsurface *QWaylandDisplay::createSubSurface(QWaylandWindow *window, QWaylandWindow *parent) { if (!mSubCompositor) { - return NULL; + return nullptr; } return mSubCompositor->get_subsurface(window->object(), parent->object()); @@ -125,24 +125,24 @@ QWaylandWindowManagerIntegration *QWaylandDisplay::windowManagerIntegration() co QWaylandDisplay::QWaylandDisplay(QWaylandIntegration *waylandIntegration) : mWaylandIntegration(waylandIntegration) #if QT_CONFIG(wayland_datadevice) - , mDndSelectionHandler(0) + , mDndSelectionHandler(nullptr) #endif - , mWindowExtension(0) - , mSubCompositor(0) - , mTouchExtension(0) - , mQtKeyExtension(0) - , mTextInputManager(0) - , mHardwareIntegration(0) + , mWindowExtension(nullptr) + , mSubCompositor(nullptr) + , mTouchExtension(nullptr) + , mQtKeyExtension(nullptr) + , mTextInputManager(nullptr) + , mHardwareIntegration(nullptr) , mLastInputSerial(0) - , mLastInputDevice(0) - , mLastInputWindow(0) + , mLastInputDevice(nullptr) + , mLastInputWindow(nullptr) , mLastKeyboardFocus(nullptr) , mSyncCallback(nullptr) { qRegisterMetaType("uint32_t"); - mDisplay = wl_display_connect(NULL); - if (mDisplay == NULL) { + mDisplay = wl_display_connect(nullptr); + if (mDisplay == nullptr) { qErrnoWarning(errno, "Failed to create display"); ::exit(1); } @@ -219,7 +219,7 @@ QWaylandScreen *QWaylandDisplay::screenForOutput(struct wl_output *output) const if (screen->output() == output) return screen; } - return 0; + return nullptr; } void QWaylandDisplay::waitForScreens() @@ -333,7 +333,7 @@ uint32_t QWaylandDisplay::currentTimeMillisec() { //### we throw away the time information struct timeval tv; - int ret = gettimeofday(&tv, 0); + int ret = gettimeofday(&tv, nullptr); if (ret == 0) return tv.tv_sec*1000 + tv.tv_usec/1000; return 0; diff --git a/src/plugins/platforms/wayland/qwaylandinputcontext.cpp b/src/plugins/platforms/wayland/qwaylandinputcontext.cpp index fac5fb840ff..16ee057c54e 100644 --- a/src/plugins/platforms/wayland/qwaylandinputcontext.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputcontext.cpp @@ -403,7 +403,7 @@ QWaylandInputContext::~QWaylandInputContext() bool QWaylandInputContext::isValid() const { - return mDisplay->textInputManager() != 0; + return mDisplay->textInputManager() != nullptr; } void QWaylandInputContext::reset() diff --git a/src/plugins/platforms/wayland/qwaylandintegration.cpp b/src/plugins/platforms/wayland/qwaylandintegration.cpp index f0182218fd3..698abd8fd4a 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandintegration.cpp @@ -121,7 +121,7 @@ public: }; QWaylandIntegration::QWaylandIntegration() - : mClientBufferIntegration(0) + : mClientBufferIntegration(nullptr) , mInputDeviceIntegration(nullptr) , mFontDb(new QGenericUnixFontDatabase()) , mNativeInterface(new QWaylandNativeInterface(this)) @@ -198,7 +198,7 @@ QPlatformOpenGLContext *QWaylandIntegration::createPlatformOpenGLContext(QOpenGL { if (mDisplay->clientBufferIntegration()) return mDisplay->clientBufferIntegration()->createPlatformOpenGLContext(context->format(), context->shareHandle()); - return 0; + return nullptr; } #endif // opengl diff --git a/src/plugins/platforms/wayland/qwaylandscreen.cpp b/src/plugins/platforms/wayland/qwaylandscreen.cpp index b6336f2e6df..fba75557711 100644 --- a/src/plugins/platforms/wayland/qwaylandscreen.cpp +++ b/src/plugins/platforms/wayland/qwaylandscreen.cpp @@ -65,7 +65,7 @@ QWaylandScreen::QWaylandScreen(QWaylandDisplay *waylandDisplay, int version, uin , mOutputName(QStringLiteral("Screen%1").arg(id)) , m_orientation(Qt::PrimaryOrientation) #if QT_CONFIG(cursor) - , mWaylandCursor(0) + , mWaylandCursor(nullptr) #endif { } diff --git a/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp b/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp index a13a5f7643e..24554ee44b4 100644 --- a/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp +++ b/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp @@ -73,8 +73,8 @@ Q_LOGGING_CATEGORY(logCategory, "qt.qpa.wayland.backingstore") QWaylandShmBuffer::QWaylandShmBuffer(QWaylandDisplay *display, const QSize &size, QImage::Format format, int scale) : QWaylandBuffer() - , mShmPool(0) - , mMarginsImage(0) + , mShmPool(nullptr) + , mMarginsImage(nullptr) { int stride = size.width() * 4; int alloc = stride * size.height(); @@ -105,7 +105,7 @@ QWaylandShmBuffer::QWaylandShmBuffer(QWaylandDisplay *display, // map ourselves: QFile::map() will unmap when the object is destroyed, // but we want this mapping to persist (unmapping in destructor) uchar *data = (uchar *) - mmap(NULL, alloc, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); + mmap(nullptr, alloc, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); if (data == (uchar *) MAP_FAILED) { qErrnoWarning("QWaylandShmBuffer: mmap failed"); return; @@ -147,7 +147,7 @@ QImage *QWaylandShmBuffer::imageInsideMargins(const QMargins &marginsIn) } if (margins.isNull()) { delete mMarginsImage; - mMarginsImage = 0; + mMarginsImage = nullptr; } mMargins = margins; @@ -161,8 +161,8 @@ QImage *QWaylandShmBuffer::imageInsideMargins(const QMargins &marginsIn) QWaylandShmBackingStore::QWaylandShmBackingStore(QWindow *window) : QPlatformBackingStore(window) , mDisplay(QWaylandScreen::waylandScreenFromWindow(window)->display()) - , mFrontBuffer(0) - , mBackBuffer(0) + , mFrontBuffer(nullptr) + , mBackBuffer(nullptr) , mPainting(false) { @@ -249,7 +249,7 @@ QWaylandShmBuffer *QWaylandShmBackingStore::getBuffer(const QSize &size) } else { mBuffers.removeOne(b); if (mBackBuffer == b) - mBackBuffer = 0; + mBackBuffer = nullptr; delete b; } } @@ -262,7 +262,7 @@ QWaylandShmBuffer *QWaylandShmBackingStore::getBuffer(const QSize &size) mBuffers.prepend(b); return b; } - return 0; + return nullptr; } void QWaylandShmBackingStore::resize(const QSize &size) diff --git a/src/plugins/platforms/wayland/qwaylandtouch.cpp b/src/plugins/platforms/wayland/qwaylandtouch.cpp index f5521a31c72..48c869a600d 100644 --- a/src/plugins/platforms/wayland/qwaylandtouch.cpp +++ b/src/plugins/platforms/wayland/qwaylandtouch.cpp @@ -48,11 +48,11 @@ namespace QtWaylandClient { QWaylandTouchExtension::QWaylandTouchExtension(QWaylandDisplay *display, uint32_t id) : QtWayland::qt_touch_extension(display->wl_registry(), id, 1), mDisplay(display), - mTouchDevice(0), + mTouchDevice(nullptr), mPointsLeft(0), mFlags(0), mMouseSourceId(-1), - mInputDevice(0) + mInputDevice(nullptr) { } diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 2e709440f2d..75dfaa49910 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -75,15 +75,15 @@ QT_BEGIN_NAMESPACE namespace QtWaylandClient { -QWaylandWindow *QWaylandWindow::mMouseGrab = 0; +QWaylandWindow *QWaylandWindow::mMouseGrab = nullptr; QWaylandWindow::QWaylandWindow(QWindow *window) : QObject() , QPlatformWindow(window) , mDisplay(waylandScreen()->display()) - , mShellSurface(0) - , mSubSurfaceWindow(0) - , mWindowDecoration(0) + , mShellSurface(nullptr) + , mSubSurfaceWindow(nullptr) + , mWindowDecoration(nullptr) , mMouseEventsInContentArea(false) , mMousePressedInContentArea(Qt::NoButton) , mWaitingForFrameSync(false) @@ -124,7 +124,7 @@ QWaylandWindow::~QWaylandWindow() } if (mMouseGrab == this) { - mMouseGrab = 0; + mMouseGrab = nullptr; } } @@ -256,9 +256,9 @@ void QWaylandWindow::reset(bool sendDestroyEvent) QGuiApplication::sendEvent(window(), &e); } delete mShellSurface; - mShellSurface = 0; + mShellSurface = nullptr; delete mSubSurfaceWindow; - mSubSurfaceWindow = 0; + mSubSurfaceWindow = nullptr; if (isInitialized()) destroy(); @@ -285,7 +285,7 @@ void QWaylandWindow::setParent(const QPlatformWindow *parent) if (!window()->isVisible()) return; - QWaylandWindow *oldparent = mSubSurfaceWindow ? mSubSurfaceWindow->parent() : 0; + QWaylandWindow *oldparent = mSubSurfaceWindow ? mSubSurfaceWindow->parent() : nullptr; if (oldparent == parent) return; @@ -574,7 +574,7 @@ void QWaylandWindow::attach(QWaylandBuffer *buffer, int x, int y) attach(buffer->buffer(), x, y); } else { - QtWayland::wl_surface::attach(0, 0, 0); + QtWayland::wl_surface::attach(nullptr, 0, 0); } } @@ -777,7 +777,7 @@ bool QWaylandWindow::createDecoration() } } else { delete mWindowDecoration; - mWindowDecoration = 0; + mWindowDecoration = nullptr; } if (hadDecoration != (bool)mWindowDecoration) { @@ -984,7 +984,7 @@ bool QWaylandWindow::setMouseGrabEnabled(bool grab) return false; } - mMouseGrab = grab ? this : 0; + mMouseGrab = grab ? this : nullptr; return true; } diff --git a/src/plugins/platforms/wayland/qwaylandwlshellsurface.cpp b/src/plugins/platforms/wayland/qwaylandwlshellsurface.cpp index 185cfc4a9c4..7c8d5172147 100644 --- a/src/plugins/platforms/wayland/qwaylandwlshellsurface.cpp +++ b/src/plugins/platforms/wayland/qwaylandwlshellsurface.cpp @@ -127,14 +127,14 @@ void QWaylandWlShellSurface::setMaximized() { m_maximized = true; m_size = m_window->window()->geometry().size(); - set_maximized(0); + set_maximized(nullptr); } void QWaylandWlShellSurface::setFullscreen() { m_fullscreen = true; m_size = m_window->window()->geometry().size(); - set_fullscreen(WL_SHELL_SURFACE_FULLSCREEN_METHOD_DEFAULT, 0, 0); + set_fullscreen(WL_SHELL_SURFACE_FULLSCREEN_METHOD_DEFAULT, 0, nullptr); } void QWaylandWlShellSurface::setNormal() diff --git a/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationplugin_p.h b/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationplugin_p.h index 266e6980cc0..8ec9a542355 100644 --- a/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationplugin_p.h +++ b/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationplugin_p.h @@ -69,7 +69,7 @@ class Q_WAYLAND_CLIENT_EXPORT QWaylandShellIntegrationPlugin : public QObject { Q_OBJECT public: - explicit QWaylandShellIntegrationPlugin(QObject *parent = 0); + explicit QWaylandShellIntegrationPlugin(QObject *parent = nullptr); ~QWaylandShellIntegrationPlugin(); virtual QWaylandShellIntegration *create(const QString &key, const QStringList ¶mList) = 0; diff --git a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp index d6a83dbbceb..057002c9dff 100644 --- a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp +++ b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp @@ -228,7 +228,7 @@ const WaylandArgument *newIdArgument(const QList &arguments) if (arguments.at(i).type == "new_id") return &arguments.at(i); } - return 0; + return nullptr; } void printEvent(const WaylandEvent &e, bool omitNames = false, bool withResource = false) diff --git a/tests/auto/wayland/client/tst_client.cpp b/tests/auto/wayland/client/tst_client.cpp index 94198b457f3..0e086c7a6ab 100644 --- a/tests/auto/wayland/client/tst_client.cpp +++ b/tests/auto/wayland/client/tst_client.cpp @@ -295,9 +295,9 @@ void tst_WaylandClient::events() QTRY_COMPARE(QGuiApplication::focusWindow(), &window); QCOMPARE(window.focusOutEventCount, 0); - compositor->setKeyboardFocus(QSharedPointer(0)); + compositor->setKeyboardFocus(QSharedPointer(nullptr)); QTRY_COMPARE(window.focusOutEventCount, 1); - QTRY_COMPARE(QGuiApplication::focusWindow(), static_cast(0)); + QTRY_COMPARE(QGuiApplication::focusWindow(), static_cast(nullptr)); compositor->setKeyboardFocus(surface); QTRY_COMPARE(window.focusInEventCount, 2); @@ -375,7 +375,7 @@ class DndWindow : public QWindow Q_OBJECT public: - DndWindow(QWindow *parent = 0) + DndWindow(QWindow *parent = nullptr) : QWindow(parent) , dragStarted(false) { From e3d236cfa7bc0f2d78e175ec85e39febde835b83 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Wed, 21 Feb 2018 10:29:24 +0100 Subject: [PATCH 0491/1507] Fix flakiness in tst_WaylandClient::events The test was flaky because we have a workaround for a bug in Weston where Weston fails to send the last wl_touch.frame event (QTBUG-36602). We've worked around it by letting our client handle the wl_touch.up event before the frame event if it's the last up event. This caused a race condition in our tests, though (which include the frame event). Because Q_TRY_COMPARE(window.touchEventCount, 1) would pass and the window was sometimes destroyed before the frame event had been sent by the compositor thread. Work around it by moving the touch testing before the pointer testing, so the surface is still alive when the compositor tries to send the frame event. That way the test will not be flaky, and will continue to work when we eventually remove the workaround in QWaylandInputDevice. Task-number: QTBUG-66537 Change-Id: I5673445682810e75343c6df2d1b2a4f1c1b21bcb Reviewed-by: Paul Olav Tvete --- tests/auto/wayland/client/tst_client.cpp | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/tests/auto/wayland/client/tst_client.cpp b/tests/auto/wayland/client/tst_client.cpp index 0e086c7a6ab..981b8f129ec 100644 --- a/tests/auto/wayland/client/tst_client.cpp +++ b/tests/auto/wayland/client/tst_client.cpp @@ -314,6 +314,17 @@ void tst_WaylandClient::events() QTRY_COMPARE(window.keyReleaseEventCount, 1); QCOMPARE(window.keyCode, keyCode); + const int touchId = 0; + compositor->sendTouchDown(surface, window.frameOffset() + QPoint(10, 10), touchId); + // Note: wl_touch.frame should not be the last event in a test until QTBUG-66563 is fixed. + // See also: QTBUG-66537 + compositor->sendTouchFrame(surface); + QTRY_COMPARE(window.touchEventCount, 1); + + compositor->sendTouchUp(surface, touchId); + compositor->sendTouchFrame(surface); + QTRY_COMPARE(window.touchEventCount, 2); + QPoint mousePressPos(16, 16); QCOMPARE(window.mousePressEventCount, 0); compositor->sendMousePress(surface, window.frameOffset() + mousePressPos); @@ -323,15 +334,6 @@ void tst_WaylandClient::events() QCOMPARE(window.mouseReleaseEventCount, 0); compositor->sendMouseRelease(surface); QTRY_COMPARE(window.mouseReleaseEventCount, 1); - - const int touchId = 0; - compositor->sendTouchDown(surface, window.frameOffset() + QPoint(10, 10), touchId); - compositor->sendTouchFrame(surface); - QTRY_COMPARE(window.touchEventCount, 1); - - compositor->sendTouchUp(surface, touchId); - compositor->sendTouchFrame(surface); - QTRY_COMPARE(window.touchEventCount, 2); } void tst_WaylandClient::backingStore() From e87c6a38093e446cec14bea45873fee7a7deb5e0 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Thu, 8 Feb 2018 16:53:39 +0100 Subject: [PATCH 0492/1507] Fix crash when connecting a new screen In QWaylandWindow::virtualSiblings, don't include screens that have not been added yet. I.e. QWaylandScreens for which QPlatformIntegration::screenAdded has not yet been called. There are two reasons why this crash wasn't covered by the removePrimaryScreen() test. First of all, the mock output didn't send wl_output.done events when updating the mode/geometry. These wayland events are what causes QWindowSystemInterface::handleScreenGeometryChange() to be called (where virtualSiblings are called). Furthermore, virtualSiblings is only called when the geometry actually changes, so add a new test that changes the screen geometry of the existing screen while a new one is being added (i.e. moves it to the right). Task-number: QTBUG-62044 Change-Id: I623fbf8799d21c6b9293e7120ded301277639cc6 Reviewed-by: David Edmundson Reviewed-by: Aleix Pol Reviewed-by: Paul Olav Tvete --- .../platforms/wayland/qwaylandscreen.cpp | 6 +++-- tests/auto/wayland/client/tst_client.cpp | 25 +++++++++++++++++ tests/auto/wayland/shared/mockcompositor.cpp | 8 ++++++ tests/auto/wayland/shared/mockcompositor.h | 2 ++ tests/auto/wayland/shared/mockoutput.cpp | 27 +++++++++++++++++-- tests/auto/wayland/shared/mockoutput.h | 1 + 6 files changed, 65 insertions(+), 4 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandscreen.cpp b/src/plugins/platforms/wayland/qwaylandscreen.cpp index fba75557711..1c9ce23ba43 100644 --- a/src/plugins/platforms/wayland/qwaylandscreen.cpp +++ b/src/plugins/platforms/wayland/qwaylandscreen.cpp @@ -138,8 +138,10 @@ QList QWaylandScreen::virtualSiblings() const QList list; const QList screens = mWaylandDisplay->screens(); list.reserve(screens.count()); - foreach (QWaylandScreen *screen, screens) - list << screen; + for (QWaylandScreen *screen : qAsConst(screens)) { + if (screen->screen()) + list << screen; + } return list; } diff --git a/tests/auto/wayland/client/tst_client.cpp b/tests/auto/wayland/client/tst_client.cpp index 981b8f129ec..e244de7f20b 100644 --- a/tests/auto/wayland/client/tst_client.cpp +++ b/tests/auto/wayland/client/tst_client.cpp @@ -164,6 +164,7 @@ public slots: private slots: void primaryScreen(); void screens(); + void addScreenWithGeometryChange(); void windowScreens(); void removePrimaryScreen(); void createDestroyWindow(); @@ -197,6 +198,29 @@ void tst_WaylandClient::screens() QTRY_COMPARE(QGuiApplication::screens().size(), 1); } +//QTBUG-62044 +void tst_WaylandClient::addScreenWithGeometryChange() +{ + QTRY_COMPARE(QGuiApplication::screens().size(), 1); + const QRect oldGeometry = QGuiApplication::primaryScreen()->geometry(); + compositor->sendAddOutput(); + + // Move the primary screen to the right + const QRect newGeometry(QPoint(screenSize.width(), 0), screenSize); + Q_ASSERT(oldGeometry != newGeometry); + compositor->sendOutputGeometry(compositor->output(0), newGeometry); + + QTRY_COMPARE(QGuiApplication::screens().size(), 2); + QTRY_COMPARE(QGuiApplication::primaryScreen()->geometry(), newGeometry); + + compositor->sendRemoveOutput(compositor->output(1)); + QTRY_COMPARE(QGuiApplication::screens().size(), 1); + + // Move the screen back + compositor->sendOutputGeometry(compositor->output(0), oldGeometry); + QTRY_COMPARE(QGuiApplication::primaryScreen()->geometry(), oldGeometry); +} + void tst_WaylandClient::windowScreens() { QSharedPointer firstOutput; @@ -255,6 +279,7 @@ void tst_WaylandClient::removePrimaryScreen() compositor->sendAddOutput(); QTRY_COMPARE(QGuiApplication::screens().size(), 2); + QTRY_COMPARE(QGuiApplication::primaryScreen()->virtualSiblings().size(), 2); QScreen *secondaryScreen = QGuiApplication::screens().at(1); QVERIFY(secondaryScreen); diff --git a/tests/auto/wayland/shared/mockcompositor.cpp b/tests/auto/wayland/shared/mockcompositor.cpp index e7c6e90d285..bdeca4e239f 100644 --- a/tests/auto/wayland/shared/mockcompositor.cpp +++ b/tests/auto/wayland/shared/mockcompositor.cpp @@ -196,6 +196,14 @@ void MockCompositor::sendRemoveOutput(const QSharedPointer &output) processCommand(command); } +void MockCompositor::sendOutputGeometry(const QSharedPointer &output, const QRect &geometry) +{ + Command command = makeCommand(Impl::Compositor::sendOutputGeometry, m_compositor); + command.parameters << QVariant::fromValue(output); + command.parameters << QVariant::fromValue(geometry); + processCommand(command); +} + void MockCompositor::sendSurfaceEnter(const QSharedPointer &surface, QSharedPointer &output) { Command command = makeCommand(Impl::Compositor::sendSurfaceEnter, m_compositor); diff --git a/tests/auto/wayland/shared/mockcompositor.h b/tests/auto/wayland/shared/mockcompositor.h index 9258b192623..d4cf5f3671c 100644 --- a/tests/auto/wayland/shared/mockcompositor.h +++ b/tests/auto/wayland/shared/mockcompositor.h @@ -89,6 +89,7 @@ public: static void setOutputMode(void *compositor, const QList ¶meters); static void sendAddOutput(void *data, const QList ¶meters); static void sendRemoveOutput(void *data, const QList ¶meters); + static void sendOutputGeometry(void *data, const QList ¶meters); static void sendSurfaceEnter(void *data, const QList ¶meters); static void sendSurfaceLeave(void *data, const QList ¶meters); @@ -181,6 +182,7 @@ public: void sendDataDeviceLeave(const QSharedPointer &surface); void sendAddOutput(); void sendRemoveOutput(const QSharedPointer &output); + void sendOutputGeometry(const QSharedPointer &output, const QRect &geometry); void sendSurfaceEnter(const QSharedPointer &surface, QSharedPointer &output); void sendSurfaceLeave(const QSharedPointer &surface, QSharedPointer &output); void waitForStartDrag(); diff --git a/tests/auto/wayland/shared/mockoutput.cpp b/tests/auto/wayland/shared/mockoutput.cpp index 7d7b7413a3e..13e0524ad1d 100644 --- a/tests/auto/wayland/shared/mockoutput.cpp +++ b/tests/auto/wayland/shared/mockoutput.cpp @@ -54,6 +54,16 @@ void Compositor::sendRemoveOutput(void *data, const QList ¶meters) delete output; } +void Compositor::sendOutputGeometry(void *data, const QList ¶meters) +{ + Compositor *compositor = static_cast(data); + Q_ASSERT(compositor); + Output *output = resolveOutput(parameters.first()); + Q_ASSERT(output); + QRect geometry = parameters.at(1).toRect(); + output->sendGeometryAndMode(geometry); +} + void Compositor::setOutputMode(void *data, const QList ¶meters) { Compositor *compositor = static_cast(data); @@ -74,16 +84,29 @@ Output::Output(wl_display *display, const QSize &resolution, const QPoint &posit void Output::setCurrentMode(const QSize &size) { - qDebug() << Q_FUNC_INFO << size; m_size = size; - for (Resource *resource : resourceMap()) + for (Resource *resource : resourceMap()) { sendCurrentMode(resource); + send_done(resource->handle); + } +} + +void Output::sendGeometryAndMode(const QRect &geometry) +{ + m_size = geometry.size(); + m_position = geometry.topLeft(); + for (Resource *resource : resourceMap()) { + sendGeometry(resource); + sendCurrentMode(resource); + send_done(resource->handle); + } } void Output::output_bind_resource(QtWaylandServer::wl_output::Resource *resource) { sendGeometry(resource); sendCurrentMode(resource); + send_done(resource->handle); } void Output::sendGeometry(Resource *resource) diff --git a/tests/auto/wayland/shared/mockoutput.h b/tests/auto/wayland/shared/mockoutput.h index d5a2bb56b6e..9f261d5d7dd 100644 --- a/tests/auto/wayland/shared/mockoutput.h +++ b/tests/auto/wayland/shared/mockoutput.h @@ -44,6 +44,7 @@ public: QSharedPointer mockOutput() const { return m_mockOutput; } void setCurrentMode(const QSize &size); + void sendGeometryAndMode(const QRect &geometry); protected: void output_bind_resource(Resource *resource) override; From 91ef77f0955d4b682d6e462ac453f3e263260d33 Mon Sep 17 00:00:00 2001 From: Kari Oikarinen Date: Wed, 21 Feb 2018 14:44:27 +0200 Subject: [PATCH 0493/1507] Fix use after free in tst_WaylandClient::dontCrashOnMultipleCommits QBackingStore had a pointer to TestWindow window, but it was destroyed only after the TestWindow was already deleted. Change-Id: Id8fe38277cf843d532f2d8c2fdbe1f69d0309a7f Reviewed-by: Johan Helsing --- tests/auto/wayland/client/tst_client.cpp | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/tests/auto/wayland/client/tst_client.cpp b/tests/auto/wayland/client/tst_client.cpp index e244de7f20b..eb99b2e2f5f 100644 --- a/tests/auto/wayland/client/tst_client.cpp +++ b/tests/auto/wayland/client/tst_client.cpp @@ -487,19 +487,21 @@ void tst_WaylandClient::dontCrashOnMultipleCommits() QRect rect(QPoint(), window->size()); - QBackingStore backingStore(window); - backingStore.resize(rect.size()); - backingStore.beginPaint(rect); - QPainter p(backingStore.paintDevice()); - p.fillRect(rect, Qt::magenta); - p.end(); - backingStore.endPaint(); + { + QBackingStore backingStore(window); + backingStore.resize(rect.size()); + backingStore.beginPaint(rect); + QPainter p(backingStore.paintDevice()); + p.fillRect(rect, Qt::magenta); + p.end(); + backingStore.endPaint(); - backingStore.flush(rect); - backingStore.flush(rect); - backingStore.flush(rect); + backingStore.flush(rect); + backingStore.flush(rect); + backingStore.flush(rect); - compositor->processWaylandEvents(); + compositor->processWaylandEvents(); + } delete window; From bf18cfcd84fb36fa02e438ae233246cdc4fb5184 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Mon, 19 Feb 2018 15:28:01 +0100 Subject: [PATCH 0494/1507] Client tests: Use generated classes for mocking shells Removes a lot of boiler-plate code and makes the two shells more similar. This also makes it easier to extend the shells with additional mocking functionality. Change-Id: I4a846b06eeda695527d7c5679df339beae983af6 Reviewed-by: Paul Olav Tvete --- tests/auto/wayland/shared/mockcompositor.cpp | 6 +- tests/auto/wayland/shared/mockcompositor.h | 6 +- tests/auto/wayland/shared/mockshell.cpp | 180 ------------------- tests/auto/wayland/shared/mockwlshell.cpp | 52 ++++++ tests/auto/wayland/shared/mockwlshell.h | 45 +++++ tests/auto/wayland/shared/mockxdgshellv6.cpp | 59 +----- tests/auto/wayland/shared/mockxdgshellv6.h | 45 +++++ tests/auto/wayland/shared/shared.pri | 4 +- 8 files changed, 160 insertions(+), 237 deletions(-) delete mode 100644 tests/auto/wayland/shared/mockshell.cpp create mode 100644 tests/auto/wayland/shared/mockwlshell.cpp create mode 100644 tests/auto/wayland/shared/mockwlshell.h create mode 100644 tests/auto/wayland/shared/mockxdgshellv6.h diff --git a/tests/auto/wayland/shared/mockcompositor.cpp b/tests/auto/wayland/shared/mockcompositor.cpp index bdeca4e239f..2f1d68b0147 100644 --- a/tests/auto/wayland/shared/mockcompositor.cpp +++ b/tests/auto/wayland/shared/mockcompositor.cpp @@ -30,6 +30,8 @@ #include "mockinput.h" #include "mockoutput.h" #include "mocksurface.h" +#include "mockwlshell.h" +#include "mockxdgshellv6.h" #include @@ -331,8 +333,8 @@ Compositor::Compositor() m_touch = m_seat->touch(); m_outputs.append(new Output(m_display, QSize(1920, 1080), QPoint(0, 0))); - wl_global_create(m_display, &wl_shell_interface, 1, this, bindShell); - wl_global_create(m_display, &zxdg_shell_v6_interface, 1, this, bindXdgShellV6); + m_wlShell.reset(new WlShell(m_display)); + m_xdgShellV6.reset(new XdgShellV6(m_display)); m_loop = wl_display_get_event_loop(m_display); m_fd = wl_event_loop_get_fd(m_loop); diff --git a/tests/auto/wayland/shared/mockcompositor.h b/tests/auto/wayland/shared/mockcompositor.h index d4cf5f3671c..747da38fa06 100644 --- a/tests/auto/wayland/shared/mockcompositor.h +++ b/tests/auto/wayland/shared/mockcompositor.h @@ -52,6 +52,8 @@ class Seat; class DataDeviceManager; class Surface; class Output; +class WlShell; +class XdgShellV6; class Compositor { @@ -98,8 +100,6 @@ public: private: static void bindCompositor(wl_client *client, void *data, uint32_t version, uint32_t id); - static void bindShell(wl_client *client, void *data, uint32_t version, uint32_t id); - static void bindXdgShellV6(wl_client *client, void *compositorData, uint32_t version, uint32_t id); static Surface *resolveSurface(const QVariant &v); static Output *resolveOutput(const QVariant &v); @@ -121,6 +121,8 @@ private: QScopedPointer m_data_device_manager; QVector m_surfaces; QVector m_outputs; + QScopedPointer m_wlShell; + QScopedPointer m_xdgShellV6; }; void registerResource(wl_list *list, wl_resource *resource); diff --git a/tests/auto/wayland/shared/mockshell.cpp b/tests/auto/wayland/shared/mockshell.cpp deleted file mode 100644 index d5eede22e4d..00000000000 --- a/tests/auto/wayland/shared/mockshell.cpp +++ /dev/null @@ -1,180 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "mockcompositor.h" -#include "mocksurface.h" - -namespace Impl { - -void shell_surface_pong(wl_client *client, - wl_resource *surface_resource, - uint32_t serial) -{ - Q_UNUSED(client); - Q_UNUSED(surface_resource); - Q_UNUSED(serial); -} - -void shell_surface_move(wl_client *client, - wl_resource *surface_resource, - wl_resource *input_device_resource, - uint32_t time) -{ - Q_UNUSED(client); - Q_UNUSED(surface_resource); - Q_UNUSED(input_device_resource); - Q_UNUSED(time); -} - -void shell_surface_resize(wl_client *client, - wl_resource *surface_resource, - wl_resource *input_device_resource, - uint32_t time, - uint32_t edges) -{ - Q_UNUSED(client); - Q_UNUSED(surface_resource); - Q_UNUSED(input_device_resource); - Q_UNUSED(time); - Q_UNUSED(edges); - -} - -void shell_surface_set_toplevel(wl_client *client, - wl_resource *surface_resource) -{ - Q_UNUSED(client); - Q_UNUSED(surface_resource); -} - -void shell_surface_set_transient(wl_client *client, - wl_resource *surface_resource, - wl_resource *parent_surface_resource, - int x, - int y, - uint32_t flags) -{ - - Q_UNUSED(client); - Q_UNUSED(surface_resource); - Q_UNUSED(parent_surface_resource); - Q_UNUSED(x); - Q_UNUSED(y); - Q_UNUSED(flags); -} - -void shell_surface_set_fullscreen(wl_client *client, - wl_resource *surface_resource, - uint32_t method, - uint32_t framerate, - wl_resource *output) -{ - Q_UNUSED(client); - Q_UNUSED(surface_resource); - Q_UNUSED(method); - Q_UNUSED(framerate); - Q_UNUSED(output); -} - -void shell_surface_set_popup(wl_client *client, wl_resource *resource, - wl_resource *input_device, uint32_t time, - wl_resource *parent, - int32_t x, int32_t y, - uint32_t flags) -{ - Q_UNUSED(client); - Q_UNUSED(resource); - Q_UNUSED(input_device); - Q_UNUSED(time); - Q_UNUSED(parent); - Q_UNUSED(x); - Q_UNUSED(y); - Q_UNUSED(flags); -} - -void shell_surface_set_maximized(wl_client *client, - wl_resource *surface_resource, - wl_resource *output) -{ - Q_UNUSED(client); - Q_UNUSED(surface_resource); - Q_UNUSED(output); -} - -void shell_surface_set_title(wl_client *client, - wl_resource *surface_resource, - const char *title) -{ - Q_UNUSED(client); - Q_UNUSED(surface_resource); - Q_UNUSED(title); -} - -void shell_surface_set_class(wl_client *client, - wl_resource *surface_resource, - const char *class_) -{ - Q_UNUSED(client); - Q_UNUSED(surface_resource); - Q_UNUSED(class_); -} - -static void get_shell_surface(wl_client *client, wl_resource *compositorResource, uint32_t id, wl_resource *surfaceResource) -{ - static const struct wl_shell_surface_interface shellSurfaceInterface = { - shell_surface_pong, - shell_surface_move, - shell_surface_resize, - shell_surface_set_toplevel, - shell_surface_set_transient, - shell_surface_set_fullscreen, - shell_surface_set_popup, - shell_surface_set_maximized, - shell_surface_set_title, - shell_surface_set_class - }; - - int version = wl_resource_get_version(compositorResource); - wl_resource *shellSurface = wl_resource_create(client, &wl_shell_surface_interface, version, id); - wl_resource_set_implementation(shellSurface, &shellSurfaceInterface, surfaceResource->data, nullptr); - Surface *surf = Surface::fromResource(surfaceResource); - surf->map(); -} - -void Compositor::bindShell(wl_client *client, void *compositorData, uint32_t version, uint32_t id) -{ - static const struct wl_shell_interface shellInterface = { - get_shell_surface - }; - - wl_resource *resource = wl_resource_create(client, &wl_shell_interface, static_cast(version), id); - wl_resource_set_implementation(resource, &shellInterface, compositorData, nullptr); -} - -} - diff --git a/tests/auto/wayland/shared/mockwlshell.cpp b/tests/auto/wayland/shared/mockwlshell.cpp new file mode 100644 index 00000000000..b7700713f13 --- /dev/null +++ b/tests/auto/wayland/shared/mockwlshell.cpp @@ -0,0 +1,52 @@ +/**************************************************************************** +** +** Copyright (C) 2018 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "mockwlshell.h" +#include "mocksurface.h" + +namespace Impl { + +class WlShellSurface : public QtWaylandServer::wl_shell_surface +{ +public: + explicit WlShellSurface(::wl_client *client, int id, Surface *surface); + void shell_surface_destroy_resource(Resource *) override { delete this; } +}; + +WlShellSurface::WlShellSurface(wl_client *client, int id, Surface *surface) + : QtWaylandServer::wl_shell_surface(client, id, 1) +{ + surface->map(); +} + +void WlShell::shell_get_shell_surface(QtWaylandServer::wl_shell::Resource *resource, uint32_t id, wl_resource *surface) +{ + new WlShellSurface(resource->client(), id, Surface::fromResource(surface)); +} + +} // namespace Impl diff --git a/tests/auto/wayland/shared/mockwlshell.h b/tests/auto/wayland/shared/mockwlshell.h new file mode 100644 index 00000000000..c6000c7b242 --- /dev/null +++ b/tests/auto/wayland/shared/mockwlshell.h @@ -0,0 +1,45 @@ +/**************************************************************************** +** +** Copyright (C) 2018 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include + +#ifndef MOCKWLSHELL_H +#define MOCKWLSHELL_H + +namespace Impl { + +class WlShell : public QtWaylandServer::wl_shell +{ +public: + explicit WlShell(::wl_display *display) : wl_shell(display, 1) {} + void shell_get_shell_surface(Resource *resource, uint32_t id, ::wl_resource *surface) override; +}; + +} // namespace Impl + +#endif // MOCKWLSHELL_H diff --git a/tests/auto/wayland/shared/mockxdgshellv6.cpp b/tests/auto/wayland/shared/mockxdgshellv6.cpp index b26ac1c8df1..f909fa10847 100644 --- a/tests/auto/wayland/shared/mockxdgshellv6.cpp +++ b/tests/auto/wayland/shared/mockxdgshellv6.cpp @@ -26,11 +26,9 @@ ** ****************************************************************************/ -#include "mockcompositor.h" +#include "mockxdgshellv6.h" #include "mocksurface.h" -#include - namespace Impl { class XdgSurfaceV6; @@ -50,7 +48,7 @@ public: class XdgSurfaceV6 : public QtWaylandServer::zxdg_surface_v6 { public: - XdgSurfaceV6(wl_client *client, uint32_t id, int version, Surface *surface); + XdgSurfaceV6(wl_client *client, uint32_t id, Surface *surface); void zxdg_surface_v6_destroy_resource(Resource *) override { delete this; } void zxdg_surface_v6_get_toplevel(Resource *resource, uint32_t id) override; void zxdg_surface_v6_destroy(Resource *resource) override @@ -68,8 +66,8 @@ void XdgToplevelV6::zxdg_toplevel_v6_destroy(QtWaylandServer::zxdg_toplevel_v6:: wl_resource_destroy(resource->handle); } -XdgSurfaceV6::XdgSurfaceV6(wl_client *client, uint32_t id, int version, Surface *surface) - : QtWaylandServer::zxdg_surface_v6(client, id, version) +XdgSurfaceV6::XdgSurfaceV6(wl_client *client, uint32_t id, Surface *surface) + : QtWaylandServer::zxdg_surface_v6(client, id, 1) , m_surface(surface) { } @@ -81,52 +79,9 @@ void XdgSurfaceV6::zxdg_surface_v6_get_toplevel(QtWaylandServer::zxdg_surface_v6 m_surface->map(); } - -void shell_destroy(struct wl_client *client, - struct wl_resource *resource) +void Impl::XdgShellV6::zxdg_shell_v6_get_xdg_surface(QtWaylandServer::zxdg_shell_v6::Resource *resource, uint32_t id, wl_resource *surface) { - Q_UNUSED(client); - Q_UNUSED(resource); + new XdgSurfaceV6(resource->client(), id, Surface::fromResource(surface)); } -void create_positioner(struct wl_client *client, - struct wl_resource *resource, - uint32_t id) -{ - Q_UNUSED(client); - Q_UNUSED(resource); - Q_UNUSED(id); -} - -void get_xdg_surface(struct wl_client *client, - struct wl_resource *compositorResource, - uint32_t id, - struct wl_resource *surfaceResource) -{ - int version = wl_resource_get_version(compositorResource); - new XdgSurfaceV6(client, id, version, Surface::fromResource(surfaceResource)); -} - -void pong(struct wl_client *client, - struct wl_resource *resource, - uint32_t serial) -{ - Q_UNUSED(client); - Q_UNUSED(resource); - Q_UNUSED(serial); -} - -void Compositor::bindXdgShellV6(wl_client *client, void *compositorData, uint32_t version, uint32_t id) -{ - static const struct zxdg_shell_v6_interface shellInterface = { - shell_destroy, - create_positioner, - get_xdg_surface, - pong - }; - - wl_resource *resource = wl_resource_create(client, &zxdg_shell_v6_interface, static_cast(version), id); - wl_resource_set_implementation(resource, &shellInterface, compositorData, nullptr); -} - -} +} // namespace Impl diff --git a/tests/auto/wayland/shared/mockxdgshellv6.h b/tests/auto/wayland/shared/mockxdgshellv6.h new file mode 100644 index 00000000000..d72606d24c1 --- /dev/null +++ b/tests/auto/wayland/shared/mockxdgshellv6.h @@ -0,0 +1,45 @@ +/**************************************************************************** +** +** Copyright (C) 2018 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include + +#ifndef MOCKXDGSHELLV6_H +#define MOCKXDGSHELLV6_H + +namespace Impl { + +class XdgShellV6 : public QtWaylandServer::zxdg_shell_v6 +{ +public: + explicit XdgShellV6(::wl_display *display) : zxdg_shell_v6(display, 1) {} + void zxdg_shell_v6_get_xdg_surface(Resource *resource, uint32_t id, ::wl_resource *surface) override; +}; + +} // namespace Impl + +#endif // MOCKXDGSHELLV6_H diff --git a/tests/auto/wayland/shared/shared.pri b/tests/auto/wayland/shared/shared.pri index 608664bb74c..991dd29d166 100644 --- a/tests/auto/wayland/shared/shared.pri +++ b/tests/auto/wayland/shared/shared.pri @@ -14,7 +14,7 @@ INCLUDEPATH += ../shared SOURCES += \ ../shared/mockcompositor.cpp \ ../shared/mockinput.cpp \ - ../shared/mockshell.cpp \ + ../shared/mockwlshell.cpp \ ../shared/mockxdgshellv6.cpp \ ../shared/mocksurface.cpp \ ../shared/mockoutput.cpp @@ -22,5 +22,7 @@ SOURCES += \ HEADERS += \ ../shared/mockcompositor.h \ ../shared/mockinput.h \ + ../shared/mockwlshell.h \ + ../shared/mockxdgshellv6.h \ ../shared/mocksurface.h \ ../shared/mockoutput.h From ef99cac249b97bc06aac7a056a38532b1207d1ce Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Wed, 14 Feb 2018 16:22:25 +0100 Subject: [PATCH 0495/1507] Client: Fail gracefully when wl_display_connect fails [ChangeLog][QPA plugin] If we're unable to create a connection to the Wayland display, fail gracefully so other platform integrations can be tried instead. This also adds QWaylandIntegration::hasFailed() which can later be extended to report that the platform plugin is unusable for other reasons. I.e. no compatible shell extensions or similar. Task-number: QTBUG-59762 Change-Id: I0f1ae73982e2860814235c1a189741d130e1db3e Reviewed-by: Paul Olav Tvete --- src/plugins/platforms/wayland/qwaylanddisplay.cpp | 9 +++++---- src/plugins/platforms/wayland/qwaylandintegration.cpp | 4 ++++ src/plugins/platforms/wayland/qwaylandintegration_p.h | 3 +++ 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index 942494f93cd..179c0454e0c 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -142,9 +142,9 @@ QWaylandDisplay::QWaylandDisplay(QWaylandIntegration *waylandIntegration) qRegisterMetaType("uint32_t"); mDisplay = wl_display_connect(nullptr); - if (mDisplay == nullptr) { - qErrnoWarning(errno, "Failed to create display"); - ::exit(1); + if (!mDisplay) { + qErrnoWarning(errno, "Failed to create wl_display"); + return; } struct ::wl_registry *registry = wl_display_get_registry(mDisplay); @@ -170,7 +170,8 @@ QWaylandDisplay::~QWaylandDisplay(void) #if QT_CONFIG(wayland_datadevice) delete mDndSelectionHandler.take(); #endif - wl_display_disconnect(mDisplay); + if (mDisplay) + wl_display_disconnect(mDisplay); } void QWaylandDisplay::checkError() const diff --git a/src/plugins/platforms/wayland/qwaylandintegration.cpp b/src/plugins/platforms/wayland/qwaylandintegration.cpp index 698abd8fd4a..267e481ac9c 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandintegration.cpp @@ -134,6 +134,10 @@ QWaylandIntegration::QWaylandIntegration() { initializeInputDeviceIntegration(); mDisplay.reset(new QWaylandDisplay(this)); + if (!mDisplay->isInitialized()) { + mFailed = true; + return; + } #if QT_CONFIG(clipboard) mClipboard.reset(new QWaylandClipboard(mDisplay.data())); #endif diff --git a/src/plugins/platforms/wayland/qwaylandintegration_p.h b/src/plugins/platforms/wayland/qwaylandintegration_p.h index 174eca25315..17144b8d716 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration_p.h +++ b/src/plugins/platforms/wayland/qwaylandintegration_p.h @@ -73,6 +73,8 @@ public: QWaylandIntegration(); ~QWaylandIntegration(); + bool hasFailed() { return mFailed; } + bool hasCapability(QPlatformIntegration::Capability cap) const override; QPlatformWindow *createPlatformWindow(QWindow *window) const override; #if QT_CONFIG(opengl) @@ -144,6 +146,7 @@ private: #if QT_CONFIG(accessibility) QScopedPointer mAccessibility; #endif + bool mFailed = false; bool mClientBufferIntegrationInitialized; bool mServerBufferIntegrationInitialized; bool mShellIntegrationInitialized; From 9147c0e688e0935d09da34d62aff3a4ee8f85ecb Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Tue, 27 Feb 2018 11:32:15 +0100 Subject: [PATCH 0496/1507] Init variables where they are declared when possible (clang-tidy) clang-tidy -p compile_commands.json $file \ -checks='-*,modernize-use-default-member-init,readability-redundant-member-init' \ -config='{CheckOptions: [{key: modernize-use-default-member-init.UseAssignment, value: "1"}]}' \ -header-filter='qtwayland' \ -fix Afterwards I ran search and replace on the diff to clean up some whitespace errors: - Replaced '(\n\+[^:\n]*)(:\s+\+\s+)' with '$1: ' - Replaced '(\n\+[^,\n]*)(,\s+\+\s+)' with '$1, ' - Replaced '\n\+\s*\n' with '\n' I also had to do some manual edits, because for some reason, this particular clang-tidy check doesn't trigger for some files. Change-Id: I3b3909bac4bf20108bbe8ad1e01bcc54236dae1b Reviewed-by: Shawn Rutledge --- .../global/qwaylandclientextension.cpp | 4 -- .../global/qwaylandclientextension_p.h | 7 ++-- .../qwaylandserverbufferintegration.cpp | 1 - .../qwaylandserverbufferintegration_p.h | 2 +- .../plugins/decorations/bradient/main.cpp | 4 +- .../wayland/qwaylandabstractdecoration.cpp | 14 +++---- .../platforms/wayland/qwaylandbuffer.cpp | 2 - .../platforms/wayland/qwaylandbuffer_p.h | 4 +- .../platforms/wayland/qwaylanddatadevice.cpp | 5 --- .../platforms/wayland/qwaylanddatadevice_p.h | 6 +-- .../platforms/wayland/qwaylanddataoffer.cpp | 3 +- .../platforms/wayland/qwaylanddisplay.cpp | 14 ------- .../platforms/wayland/qwaylanddisplay_p.h | 6 +-- .../wayland/qwaylandinputcontext.cpp | 13 +------ .../wayland/qwaylandinputcontext_p.h | 10 ++--- .../platforms/wayland/qwaylandinputdevice.cpp | 3 +- .../platforms/wayland/qwaylandintegration.cpp | 7 +--- .../platforms/wayland/qwaylandintegration_p.h | 6 +-- .../platforms/wayland/qwaylandscreen.cpp | 12 +----- .../platforms/wayland/qwaylandscreen_p.h | 16 ++++---- .../wayland/qwaylandshmbackingstore.cpp | 6 --- .../wayland/qwaylandshmbackingstore_p.h | 12 +++--- .../platforms/wayland/qwaylandsubsurface.cpp | 1 - .../platforms/wayland/qwaylandsubsurface_p.h | 2 +- .../platforms/wayland/qwaylandwindow.cpp | 18 +-------- .../platforms/wayland/qwaylandwindow_p.h | 39 +++++++++---------- .../qwaylandwindowmanagerintegration.cpp | 8 ++-- .../wayland/qwaylandwlshellintegration.cpp | 1 - .../wayland/qwaylandwlshellintegration_p.h | 2 +- .../wayland/qwaylandwlshellsurface.cpp | 3 -- .../wayland/qwaylandwlshellsurface_p.h | 6 +-- .../platforms/wayland/qwaylandxdgpopup.cpp | 1 - .../platforms/wayland/qwaylandxdgpopup_p.h | 2 +- .../platforms/wayland/qwaylandxdgshell.cpp | 2 - .../platforms/wayland/qwaylandxdgshell_p.h | 2 +- .../wayland/qwaylandxdgshellintegration.cpp | 1 - .../wayland/qwaylandxdgshellintegration_p.h | 2 +- .../platforms/wayland/qwaylandxdgshellv6.cpp | 3 -- .../platforms/wayland/qwaylandxdgshellv6_p.h | 6 +-- .../wayland/qwaylandxdgshellv6integration.cpp | 1 - .../wayland/qwaylandxdgshellv6integration_p.h | 2 +- .../platforms/wayland/qwaylandxdgsurface.cpp | 5 --- .../platforms/wayland/qwaylandxdgsurface_p.h | 10 ++--- .../qwaylandinputmethodeventbuilder.cpp | 10 ----- .../qwaylandinputmethodeventbuilder_p.h | 12 +++--- tests/auto/wayland/client/tst_client.cpp | 27 +++++-------- tests/auto/wayland/shared/mockcompositor.cpp | 3 -- tests/auto/wayland/shared/mockcompositor.h | 6 +-- tests/auto/wayland/shared/mockinput.cpp | 15 ++----- tests/auto/wayland/shared/mockinput.h | 12 +++--- tests/auto/wayland/shared/mocksurface.cpp | 2 - tests/auto/wayland/shared/mocksurface.h | 4 +- 52 files changed, 113 insertions(+), 252 deletions(-) diff --git a/src/plugins/platforms/wayland/global/qwaylandclientextension.cpp b/src/plugins/platforms/wayland/global/qwaylandclientextension.cpp index 60a8944f8bf..125b1e19d94 100644 --- a/src/plugins/platforms/wayland/global/qwaylandclientextension.cpp +++ b/src/plugins/platforms/wayland/global/qwaylandclientextension.cpp @@ -49,10 +49,6 @@ QT_BEGIN_NAMESPACE QWaylandClientExtensionPrivate::QWaylandClientExtensionPrivate() - : QObjectPrivate() - , waylandIntegration(nullptr) - , version(-1) - , active(false) { // Keep the possibility to use a custom waylandIntegration as a plugin, // but also add the possibility to run it as a QML component. diff --git a/src/plugins/platforms/wayland/global/qwaylandclientextension_p.h b/src/plugins/platforms/wayland/global/qwaylandclientextension_p.h index 0fd59b3f782..69cc46a0a48 100644 --- a/src/plugins/platforms/wayland/global/qwaylandclientextension_p.h +++ b/src/plugins/platforms/wayland/global/qwaylandclientextension_p.h @@ -65,16 +65,15 @@ public: static void handleRegistryGlobal(void *data, ::wl_registry *registry, uint32_t id, const QString &interface, uint32_t version); - QtWaylandClient::QWaylandIntegration *waylandIntegration; - int version; - bool active; + QtWaylandClient::QWaylandIntegration *waylandIntegration = nullptr; + int version = -1; + bool active = false; }; class Q_WAYLAND_CLIENT_EXPORT QWaylandClientExtensionTemplatePrivate : public QWaylandClientExtensionPrivate { public: QWaylandClientExtensionTemplatePrivate() - : QWaylandClientExtensionPrivate() { } }; diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegration.cpp b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegration.cpp index 013ddae9f5a..d966a1919d2 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegration.cpp +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegration.cpp @@ -44,7 +44,6 @@ QT_BEGIN_NAMESPACE namespace QtWaylandClient { QWaylandServerBuffer::QWaylandServerBuffer() - : m_user_data(nullptr) { } diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegration_p.h b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegration_p.h index 3b8b3a6de2f..7439087d885 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegration_p.h +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegration_p.h @@ -89,7 +89,7 @@ protected: QSize m_size; private: - void *m_user_data; + void *m_user_data = nullptr; }; class Q_WAYLAND_CLIENT_EXPORT QWaylandServerBufferIntegration diff --git a/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp b/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp index ceb07c8032d..9a7e91e6f7b 100644 --- a/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp +++ b/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp @@ -153,14 +153,12 @@ private: QColor m_foregroundColor; QColor m_backgroundColor; QStaticText m_windowTitle; - Button m_clicking; + Button m_clicking = None; }; QWaylandBradientDecoration::QWaylandBradientDecoration() - : QWaylandAbstractDecoration() - , m_clicking(None) { QPalette palette; m_foregroundColor = palette.color(QPalette::Active, QPalette::HighlightedText); diff --git a/src/plugins/platforms/wayland/qwaylandabstractdecoration.cpp b/src/plugins/platforms/wayland/qwaylandabstractdecoration.cpp index 6a7a2ef4cdb..c20b70e9e29 100644 --- a/src/plugins/platforms/wayland/qwaylandabstractdecoration.cpp +++ b/src/plugins/platforms/wayland/qwaylandabstractdecoration.cpp @@ -60,21 +60,17 @@ public: QWaylandAbstractDecorationPrivate(); ~QWaylandAbstractDecorationPrivate(); - QWindow *m_window; - QWaylandWindow *m_wayland_window; + QWindow *m_window = nullptr; + QWaylandWindow *m_wayland_window = nullptr; - bool m_isDirty; + bool m_isDirty = true; QImage m_decorationContentImage; - Qt::MouseButtons m_mouseButtons; + Qt::MouseButtons m_mouseButtons = Qt::NoButton; }; QWaylandAbstractDecorationPrivate::QWaylandAbstractDecorationPrivate() - : m_window(nullptr) - , m_wayland_window(nullptr) - , m_isDirty(true) - , m_decorationContentImage(nullptr) - , m_mouseButtons(Qt::NoButton) + : m_decorationContentImage(nullptr) { } diff --git a/src/plugins/platforms/wayland/qwaylandbuffer.cpp b/src/plugins/platforms/wayland/qwaylandbuffer.cpp index 2dc99b3b758..9792cdd6136 100644 --- a/src/plugins/platforms/wayland/qwaylandbuffer.cpp +++ b/src/plugins/platforms/wayland/qwaylandbuffer.cpp @@ -47,8 +47,6 @@ QT_BEGIN_NAMESPACE namespace QtWaylandClient { QWaylandBuffer::QWaylandBuffer() - : mBuffer(nullptr) - , mBusy(false) { } diff --git a/src/plugins/platforms/wayland/qwaylandbuffer_p.h b/src/plugins/platforms/wayland/qwaylandbuffer_p.h index 9e8cba2e490..156ea9530b4 100644 --- a/src/plugins/platforms/wayland/qwaylandbuffer_p.h +++ b/src/plugins/platforms/wayland/qwaylandbuffer_p.h @@ -77,10 +77,10 @@ public: bool busy() const { return mBusy; } protected: - struct wl_buffer *mBuffer; + struct wl_buffer *mBuffer = nullptr; private: - bool mBusy; + bool mBusy = false; static void release(void *data, wl_buffer *); static const wl_buffer_listener listener; diff --git a/src/plugins/platforms/wayland/qwaylanddatadevice.cpp b/src/plugins/platforms/wayland/qwaylanddatadevice.cpp index 83912035a4f..4411ba65ccd 100644 --- a/src/plugins/platforms/wayland/qwaylanddatadevice.cpp +++ b/src/plugins/platforms/wayland/qwaylanddatadevice.cpp @@ -66,11 +66,6 @@ QWaylandDataDevice::QWaylandDataDevice(QWaylandDataDeviceManager *manager, QWayl : QtWayland::wl_data_device(manager->get_data_device(inputDevice->wl_seat())) , m_display(manager->display()) , m_inputDevice(inputDevice) - , m_enterSerial(0) - , m_dragWindow(nullptr) - , m_dragPoint() - , m_dragOffer() - , m_selectionOffer() { } diff --git a/src/plugins/platforms/wayland/qwaylanddatadevice_p.h b/src/plugins/platforms/wayland/qwaylanddatadevice_p.h index 7fb0003b4dd..29461930b37 100644 --- a/src/plugins/platforms/wayland/qwaylanddatadevice_p.h +++ b/src/plugins/platforms/wayland/qwaylanddatadevice_p.h @@ -117,9 +117,9 @@ private: QPoint calculateDragPosition(int x, int y, QWindow *wnd) const; #endif - QWaylandDisplay *m_display; - QWaylandInputDevice *m_inputDevice; - uint32_t m_enterSerial; + QWaylandDisplay *m_display = nullptr; + QWaylandInputDevice *m_inputDevice = nullptr; + uint32_t m_enterSerial = 0; QPointer m_dragWindow; QPoint m_dragPoint; QScopedPointer m_dragOffer; diff --git a/src/plugins/platforms/wayland/qwaylanddataoffer.cpp b/src/plugins/platforms/wayland/qwaylanddataoffer.cpp index 2491c658b12..35085a7f0d5 100644 --- a/src/plugins/platforms/wayland/qwaylanddataoffer.cpp +++ b/src/plugins/platforms/wayland/qwaylanddataoffer.cpp @@ -87,8 +87,7 @@ void QWaylandDataOffer::data_offer_offer(const QString &mime_type) } QWaylandMimeData::QWaylandMimeData(QWaylandDataOffer *dataOffer, QWaylandDisplay *display) - : QInternalMimeData() - , m_dataOffer(dataOffer) + : m_dataOffer(dataOffer) , m_display(display) { } diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index 179c0454e0c..abb0845225f 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -124,20 +124,6 @@ QWaylandWindowManagerIntegration *QWaylandDisplay::windowManagerIntegration() co QWaylandDisplay::QWaylandDisplay(QWaylandIntegration *waylandIntegration) : mWaylandIntegration(waylandIntegration) -#if QT_CONFIG(wayland_datadevice) - , mDndSelectionHandler(nullptr) -#endif - , mWindowExtension(nullptr) - , mSubCompositor(nullptr) - , mTouchExtension(nullptr) - , mQtKeyExtension(nullptr) - , mTextInputManager(nullptr) - , mHardwareIntegration(nullptr) - , mLastInputSerial(0) - , mLastInputDevice(nullptr) - , mLastInputWindow(nullptr) - , mLastKeyboardFocus(nullptr) - , mSyncCallback(nullptr) { qRegisterMetaType("uint32_t"); diff --git a/src/plugins/platforms/wayland/qwaylanddisplay_p.h b/src/plugins/platforms/wayland/qwaylanddisplay_p.h index 35d861760e5..0a7ea427a5d 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay_p.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay_p.h @@ -217,12 +217,12 @@ private: int mWritableNotificationFd; QList mGlobals; int mCompositorVersion; - uint32_t mLastInputSerial; - QWaylandInputDevice *mLastInputDevice; + uint32_t mLastInputSerial = 0; + QWaylandInputDevice *mLastInputDevice = nullptr; QPointer mLastInputWindow; QPointer mLastKeyboardFocus; QVector mActiveWindows; - struct wl_callback *mSyncCallback; + struct wl_callback *mSyncCallback = nullptr; static const wl_callback_listener syncCallbackListener; void registry_global(uint32_t id, const QString &interface, uint32_t version) override; diff --git a/src/plugins/platforms/wayland/qwaylandinputcontext.cpp b/src/plugins/platforms/wayland/qwaylandinputcontext.cpp index 16ee057c54e..58ad90d41b5 100644 --- a/src/plugins/platforms/wayland/qwaylandinputcontext.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputcontext.cpp @@ -71,15 +71,6 @@ const Qt::InputMethodQueries supportedQueries = Qt::ImEnabled | QWaylandTextInput::QWaylandTextInput(QWaylandDisplay *display, struct ::zwp_text_input_v2 *text_input) : QtWayland::zwp_text_input_v2(text_input) , m_display(display) - , m_builder() - , m_serial(0) - , m_surface(nullptr) - , m_preeditCommit() - , m_inputPanelVisible(false) - , m_keyboardRectangle() - , m_locale() - , m_inputDirection(Qt::LayoutDirectionAuto) - , m_resetCallback(nullptr) { } @@ -391,9 +382,7 @@ Qt::KeyboardModifiers QWaylandTextInput::modifiersToQtModifiers(uint32_t modifie } QWaylandInputContext::QWaylandInputContext(QWaylandDisplay *display) - : QPlatformInputContext() - , mDisplay(display) - , mCurrentWindow() + : mDisplay(display) { } diff --git a/src/plugins/platforms/wayland/qwaylandinputcontext_p.h b/src/plugins/platforms/wayland/qwaylandinputcontext_p.h index a131bc5bdf6..a554f23011c 100644 --- a/src/plugins/platforms/wayland/qwaylandinputcontext_p.h +++ b/src/plugins/platforms/wayland/qwaylandinputcontext_p.h @@ -112,17 +112,17 @@ private: QVector m_modifiersMap; - uint32_t m_serial; - struct ::wl_surface *m_surface; + uint32_t m_serial = 0; + struct ::wl_surface *m_surface = nullptr; QString m_preeditCommit; - bool m_inputPanelVisible; + bool m_inputPanelVisible = false; QRectF m_keyboardRectangle; QLocale m_locale; - Qt::LayoutDirection m_inputDirection; + Qt::LayoutDirection m_inputDirection = Qt::LayoutDirectionAuto; - struct ::wl_callback *m_resetCallback; + struct ::wl_callback *m_resetCallback = nullptr; static const wl_callback_listener callbackListener; static void resetCallback(void *data, struct wl_callback *wl_callback, uint32_t time); }; diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index b34504a1f4b..93344d13fed 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -200,8 +200,7 @@ QWaylandInputDevice::Touch::~Touch() } QWaylandInputDevice::QWaylandInputDevice(QWaylandDisplay *display, int version, uint32_t id) - : QObject() - , QtWayland::wl_seat(display->wl_registry(), id, qMin(version, 4)) + : QtWayland::wl_seat(display->wl_registry(), id, qMin(version, 4)) , mQDisplay(display) , mDisplay(display->wl_display()) , mVersion(qMin(version, 4)) diff --git a/src/plugins/platforms/wayland/qwaylandintegration.cpp b/src/plugins/platforms/wayland/qwaylandintegration.cpp index 267e481ac9c..fe1655c9f30 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandintegration.cpp @@ -121,16 +121,11 @@ public: }; QWaylandIntegration::QWaylandIntegration() - : mClientBufferIntegration(nullptr) - , mInputDeviceIntegration(nullptr) - , mFontDb(new QGenericUnixFontDatabase()) + : mFontDb(new QGenericUnixFontDatabase()) , mNativeInterface(new QWaylandNativeInterface(this)) #if QT_CONFIG(accessibility) , mAccessibility(new QPlatformAccessibility()) #endif - , mClientBufferIntegrationInitialized(false) - , mServerBufferIntegrationInitialized(false) - , mShellIntegrationInitialized(false) { initializeInputDeviceIntegration(); mDisplay.reset(new QWaylandDisplay(this)); diff --git a/src/plugins/platforms/wayland/qwaylandintegration_p.h b/src/plugins/platforms/wayland/qwaylandintegration_p.h index 17144b8d716..7ce79e6da1e 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration_p.h +++ b/src/plugins/platforms/wayland/qwaylandintegration_p.h @@ -147,9 +147,9 @@ private: QScopedPointer mAccessibility; #endif bool mFailed = false; - bool mClientBufferIntegrationInitialized; - bool mServerBufferIntegrationInitialized; - bool mShellIntegrationInitialized; + bool mClientBufferIntegrationInitialized = false; + bool mServerBufferIntegrationInitialized = false; + bool mShellIntegrationInitialized = false; friend class QWaylandDisplay; }; diff --git a/src/plugins/platforms/wayland/qwaylandscreen.cpp b/src/plugins/platforms/wayland/qwaylandscreen.cpp index 1c9ce23ba43..38d97a91dfb 100644 --- a/src/plugins/platforms/wayland/qwaylandscreen.cpp +++ b/src/plugins/platforms/wayland/qwaylandscreen.cpp @@ -53,20 +53,10 @@ QT_BEGIN_NAMESPACE namespace QtWaylandClient { QWaylandScreen::QWaylandScreen(QWaylandDisplay *waylandDisplay, int version, uint32_t id) - : QPlatformScreen() - , QtWayland::wl_output(waylandDisplay->wl_registry(), id, qMin(version, 2)) + : QtWayland::wl_output(waylandDisplay->wl_registry(), id, qMin(version, 2)) , m_outputId(id) , mWaylandDisplay(waylandDisplay) - , mScale(1) - , mDepth(32) - , mRefreshRate(60000) - , mTransform(-1) - , mFormat(QImage::Format_ARGB32_Premultiplied) , mOutputName(QStringLiteral("Screen%1").arg(id)) - , m_orientation(Qt::PrimaryOrientation) -#if QT_CONFIG(cursor) - , mWaylandCursor(nullptr) -#endif { } diff --git a/src/plugins/platforms/wayland/qwaylandscreen_p.h b/src/plugins/platforms/wayland/qwaylandscreen_p.h index 674e1a9134e..37c35cffff4 100644 --- a/src/plugins/platforms/wayland/qwaylandscreen_p.h +++ b/src/plugins/platforms/wayland/qwaylandscreen_p.h @@ -116,21 +116,21 @@ private: void output_done() override; int m_outputId; - QWaylandDisplay *mWaylandDisplay; + QWaylandDisplay *mWaylandDisplay = nullptr; QString mManufacturer; QString mModel; QRect mGeometry; - int mScale; - int mDepth; - int mRefreshRate; - int mTransform; - QImage::Format mFormat; + int mScale = 1; + int mDepth = 32; + int mRefreshRate = 60000; + int mTransform = -1; + QImage::Format mFormat = QImage::Format_ARGB32_Premultiplied; QSize mPhysicalSize; QString mOutputName; - Qt::ScreenOrientation m_orientation; + Qt::ScreenOrientation m_orientation = Qt::PrimaryOrientation; #if QT_CONFIG(cursor) - QWaylandCursor *mWaylandCursor; + QWaylandCursor *mWaylandCursor = nullptr; #endif }; diff --git a/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp b/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp index 24554ee44b4..cbfdf51576e 100644 --- a/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp +++ b/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp @@ -72,9 +72,6 @@ Q_LOGGING_CATEGORY(logCategory, "qt.qpa.wayland.backingstore") QWaylandShmBuffer::QWaylandShmBuffer(QWaylandDisplay *display, const QSize &size, QImage::Format format, int scale) - : QWaylandBuffer() - , mShmPool(nullptr) - , mMarginsImage(nullptr) { int stride = size.width() * 4; int alloc = stride * size.height(); @@ -161,9 +158,6 @@ QImage *QWaylandShmBuffer::imageInsideMargins(const QMargins &marginsIn) QWaylandShmBackingStore::QWaylandShmBackingStore(QWindow *window) : QPlatformBackingStore(window) , mDisplay(QWaylandScreen::waylandScreenFromWindow(window)->display()) - , mFrontBuffer(nullptr) - , mBackBuffer(nullptr) - , mPainting(false) { } diff --git a/src/plugins/platforms/wayland/qwaylandshmbackingstore_p.h b/src/plugins/platforms/wayland/qwaylandshmbackingstore_p.h index 251368efd47..628d1858be1 100644 --- a/src/plugins/platforms/wayland/qwaylandshmbackingstore_p.h +++ b/src/plugins/platforms/wayland/qwaylandshmbackingstore_p.h @@ -79,9 +79,9 @@ public: QImage *imageInsideMargins(const QMargins &margins); private: QImage mImage; - struct wl_shm_pool *mShmPool; + struct wl_shm_pool *mShmPool = nullptr; QMargins mMargins; - QImage *mMarginsImage; + QImage *mMarginsImage = nullptr; }; class Q_WAYLAND_CLIENT_EXPORT QWaylandShmBackingStore : public QPlatformBackingStore @@ -115,11 +115,11 @@ private: void updateDecorations(); QWaylandShmBuffer *getBuffer(const QSize &size); - QWaylandDisplay *mDisplay; + QWaylandDisplay *mDisplay = nullptr; QLinkedList mBuffers; - QWaylandShmBuffer *mFrontBuffer; - QWaylandShmBuffer *mBackBuffer; - bool mPainting; + QWaylandShmBuffer *mFrontBuffer = nullptr; + QWaylandShmBuffer *mBackBuffer = nullptr; + bool mPainting = false; QMutex mMutex; QSize mRequestedSize; diff --git a/src/plugins/platforms/wayland/qwaylandsubsurface.cpp b/src/plugins/platforms/wayland/qwaylandsubsurface.cpp index 36fdd1c7a24..2ff966cbc66 100644 --- a/src/plugins/platforms/wayland/qwaylandsubsurface.cpp +++ b/src/plugins/platforms/wayland/qwaylandsubsurface.cpp @@ -51,7 +51,6 @@ QWaylandSubSurface::QWaylandSubSurface(QWaylandWindow *window, QWaylandWindow *p : QtWayland::wl_subsurface(sub_surface) , m_window(window) , m_parent(parent) - , m_synchronized(false) { m_parent->mChildren << this; setDeSync(); diff --git a/src/plugins/platforms/wayland/qwaylandsubsurface_p.h b/src/plugins/platforms/wayland/qwaylandsubsurface_p.h index 00fb8d8edab..36a92a7559e 100644 --- a/src/plugins/platforms/wayland/qwaylandsubsurface_p.h +++ b/src/plugins/platforms/wayland/qwaylandsubsurface_p.h @@ -88,7 +88,7 @@ private: void set_desync(); QWaylandWindow *m_window; QWaylandWindow *m_parent; - bool m_synchronized; + bool m_synchronized = false; QMutex m_syncLock; }; diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 75dfaa49910..52461dc38bc 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -78,25 +78,9 @@ namespace QtWaylandClient { QWaylandWindow *QWaylandWindow::mMouseGrab = nullptr; QWaylandWindow::QWaylandWindow(QWindow *window) - : QObject() - , QPlatformWindow(window) + : QPlatformWindow(window) , mDisplay(waylandScreen()->display()) - , mShellSurface(nullptr) - , mSubSurfaceWindow(nullptr) - , mWindowDecoration(nullptr) - , mMouseEventsInContentArea(false) - , mMousePressedInContentArea(Qt::NoButton) - , mWaitingForFrameSync(false) - , mRequestResizeSent(false) - , mCanResize(true) - , mResizeDirty(false) , mResizeAfterSwap(qEnvironmentVariableIsSet("QT_WAYLAND_RESIZE_AFTER_SWAP")) - , mSentInitialResize(false) - , mScale(1) - , mState(Qt::WindowNoState) - , mMask() - , mBackingStore(nullptr) - , mUpdateRequested(false) { static WId id = 1; mWindowId = id++; diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index fca96f30d50..a74f188274f 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -81,9 +81,6 @@ class Q_WAYLAND_CLIENT_EXPORT QWaylandWindowConfigure { public: QWaylandWindowConfigure() - : width(0) - , height(0) - , edges(0) { } void clear() @@ -92,9 +89,9 @@ public: bool isEmpty() const { return !height || !width; } - int width; - int height; - uint32_t edges; + int width = 0; + int height = 0; + uint32_t edges = 0; }; class Q_WAYLAND_CLIENT_EXPORT QWaylandWindow : public QObject, public QPlatformWindow, public QtWayland::wl_surface @@ -214,39 +211,39 @@ protected: void surface_leave(struct ::wl_output *output) override; QVector mScreens; //As seen by wl_surface.enter/leave events. Chronological order. - QWaylandDisplay *mDisplay; - QWaylandShellSurface *mShellSurface; - QWaylandSubSurface *mSubSurfaceWindow; + QWaylandDisplay *mDisplay = nullptr; + QWaylandShellSurface *mShellSurface = nullptr; + QWaylandSubSurface *mSubSurfaceWindow = nullptr; QVector mChildren; - QWaylandAbstractDecoration *mWindowDecoration; - bool mMouseEventsInContentArea; - Qt::MouseButtons mMousePressedInContentArea; + QWaylandAbstractDecoration *mWindowDecoration = nullptr; + bool mMouseEventsInContentArea = false; + Qt::MouseButtons mMousePressedInContentArea = Qt::NoButton; WId mWindowId; - bool mWaitingForFrameSync; + bool mWaitingForFrameSync = false; struct ::wl_callback *mFrameCallback = nullptr; QWaitCondition mFrameSyncWait; QMutex mResizeLock; QWaylandWindowConfigure mConfigure; - bool mRequestResizeSent; - bool mCanResize; - bool mResizeDirty; + bool mRequestResizeSent = false; + bool mCanResize = true; + bool mResizeDirty = false; bool mResizeAfterSwap; QVariantMap m_properties; - bool mSentInitialResize; + bool mSentInitialResize = false; QPoint mOffset; - int mScale; + int mScale = 1; QIcon mWindowIcon; - Qt::WindowStates mState; + Qt::WindowStates mState = Qt::WindowNoState; Qt::WindowFlags mFlags; QRegion mMask; - QWaylandShmBackingStore *mBackingStore; + QWaylandShmBackingStore *mBackingStore = nullptr; private slots: void handleScreenRemoved(QScreen *qScreen); @@ -266,7 +263,7 @@ private: void handleMouseEventWithDecoration(QWaylandInputDevice *inputDevice, const QWaylandPointerEvent &e); void handleScreenChanged(); - bool mUpdateRequested; + bool mUpdateRequested = false; static const wl_callback_listener callbackListener; static void frameCallback(void *data, struct wl_callback *wl_callback, uint32_t time); diff --git a/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration.cpp b/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration.cpp index c519126e5a5..785a0a44d7c 100644 --- a/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration.cpp @@ -60,16 +60,14 @@ namespace QtWaylandClient { class QWaylandWindowManagerIntegrationPrivate { public: QWaylandWindowManagerIntegrationPrivate(QWaylandDisplay *waylandDisplay); - bool m_blockPropertyUpdates; + bool m_blockPropertyUpdates = false; QWaylandDisplay *m_waylandDisplay; QHash m_queuedProperties; - bool m_showIsFullScreen; + bool m_showIsFullScreen = false; }; QWaylandWindowManagerIntegrationPrivate::QWaylandWindowManagerIntegrationPrivate(QWaylandDisplay *waylandDisplay) - : m_blockPropertyUpdates(false) - , m_waylandDisplay(waylandDisplay) - , m_showIsFullScreen(false) + : m_waylandDisplay(waylandDisplay) { } diff --git a/src/plugins/platforms/wayland/qwaylandwlshellintegration.cpp b/src/plugins/platforms/wayland/qwaylandwlshellintegration.cpp index e516371086e..81c46be29e6 100644 --- a/src/plugins/platforms/wayland/qwaylandwlshellintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandwlshellintegration.cpp @@ -55,7 +55,6 @@ QWaylandWlShellIntegration *QWaylandWlShellIntegration::create(QWaylandDisplay * } QWaylandWlShellIntegration::QWaylandWlShellIntegration(QWaylandDisplay *display) - : m_wlShell(nullptr) { Q_FOREACH (QWaylandDisplay::RegistryGlobal global, display->globals()) { if (global.interface == QLatin1String("wl_shell")) { diff --git a/src/plugins/platforms/wayland/qwaylandwlshellintegration_p.h b/src/plugins/platforms/wayland/qwaylandwlshellintegration_p.h index 2e3ac3cc1cf..7a6b53524a9 100644 --- a/src/plugins/platforms/wayland/qwaylandwlshellintegration_p.h +++ b/src/plugins/platforms/wayland/qwaylandwlshellintegration_p.h @@ -70,7 +70,7 @@ public: private: QWaylandWlShellIntegration(QWaylandDisplay* display); - QtWayland::wl_shell *m_wlShell; + QtWayland::wl_shell *m_wlShell = nullptr; }; } diff --git a/src/plugins/platforms/wayland/qwaylandwlshellsurface.cpp b/src/plugins/platforms/wayland/qwaylandwlshellsurface.cpp index 7c8d5172147..00b070f3fd1 100644 --- a/src/plugins/platforms/wayland/qwaylandwlshellsurface.cpp +++ b/src/plugins/platforms/wayland/qwaylandwlshellsurface.cpp @@ -56,9 +56,6 @@ QWaylandWlShellSurface::QWaylandWlShellSurface(struct ::wl_shell_surface *shell_ : QWaylandShellSurface(window) , QtWayland::wl_shell_surface(shell_surface) , m_window(window) - , m_maximized(false) - , m_fullscreen(false) - , m_extendedWindow(nullptr) { if (window->display()->windowExtension()) m_extendedWindow = new QWaylandExtendedSurface(window); diff --git a/src/plugins/platforms/wayland/qwaylandwlshellsurface_p.h b/src/plugins/platforms/wayland/qwaylandwlshellsurface_p.h index 62583949b68..708c6f1132b 100644 --- a/src/plugins/platforms/wayland/qwaylandwlshellsurface_p.h +++ b/src/plugins/platforms/wayland/qwaylandwlshellsurface_p.h @@ -105,10 +105,10 @@ private: void setPopup(QWaylandWindow *parent, QWaylandInputDevice *device, uint serial); QWaylandWindow *m_window; - bool m_maximized; - bool m_fullscreen; + bool m_maximized = false; + bool m_fullscreen = false; QSize m_size; - QWaylandExtendedSurface *m_extendedWindow; + QWaylandExtendedSurface *m_extendedWindow = nullptr; void shell_surface_ping(uint32_t serial) override; void shell_surface_configure(uint32_t edges, diff --git a/src/plugins/platforms/wayland/qwaylandxdgpopup.cpp b/src/plugins/platforms/wayland/qwaylandxdgpopup.cpp index d5fc4969362..46a12a828a1 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgpopup.cpp +++ b/src/plugins/platforms/wayland/qwaylandxdgpopup.cpp @@ -50,7 +50,6 @@ namespace QtWaylandClient { QWaylandXdgPopup::QWaylandXdgPopup(struct ::xdg_popup *popup, QWaylandWindow *window) : QWaylandShellSurface(window) , QtWayland::xdg_popup(popup) - , m_extendedWindow(nullptr) , m_window(window) { if (window->display()->windowExtension()) diff --git a/src/plugins/platforms/wayland/qwaylandxdgpopup_p.h b/src/plugins/platforms/wayland/qwaylandxdgpopup_p.h index f45e717a953..85bd589bf7e 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgpopup_p.h +++ b/src/plugins/platforms/wayland/qwaylandxdgpopup_p.h @@ -80,7 +80,7 @@ protected: void xdg_popup_popup_done() override; private: - QWaylandExtendedSurface *m_extendedWindow; + QWaylandExtendedSurface *m_extendedWindow = nullptr; QWaylandWindow *m_window; }; diff --git a/src/plugins/platforms/wayland/qwaylandxdgshell.cpp b/src/plugins/platforms/wayland/qwaylandxdgshell.cpp index 6a99306081a..8b252b95323 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgshell.cpp +++ b/src/plugins/platforms/wayland/qwaylandxdgshell.cpp @@ -54,13 +54,11 @@ namespace QtWaylandClient { QWaylandXdgShell::QWaylandXdgShell(struct ::xdg_shell *shell) : QtWayland::xdg_shell(shell) - , m_popupSerial(0) { } QWaylandXdgShell::QWaylandXdgShell(struct ::wl_registry *registry, uint32_t id) : QtWayland::xdg_shell(registry, id, 1) - , m_popupSerial(0) { use_unstable_version(QtWayland::xdg_shell::version_current); } diff --git a/src/plugins/platforms/wayland/qwaylandxdgshell_p.h b/src/plugins/platforms/wayland/qwaylandxdgshell_p.h index f462f28281d..e01104cadf3 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgshell_p.h +++ b/src/plugins/platforms/wayland/qwaylandxdgshell_p.h @@ -85,7 +85,7 @@ private: void xdg_shell_ping(uint32_t serial) override; QVector m_popups; - uint m_popupSerial; + uint m_popupSerial = 0; }; QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandxdgshellintegration.cpp b/src/plugins/platforms/wayland/qwaylandxdgshellintegration.cpp index 7c40d2dd7fb..5fa4385d65b 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgshellintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandxdgshellintegration.cpp @@ -57,7 +57,6 @@ QWaylandXdgShellIntegration *QWaylandXdgShellIntegration::create(QWaylandDisplay } QWaylandXdgShellIntegration::QWaylandXdgShellIntegration(QWaylandDisplay *display) - : m_xdgShell(nullptr) { Q_FOREACH (QWaylandDisplay::RegistryGlobal global, display->globals()) { if (global.interface == QLatin1String("xdg_shell")) { diff --git a/src/plugins/platforms/wayland/qwaylandxdgshellintegration_p.h b/src/plugins/platforms/wayland/qwaylandxdgshellintegration_p.h index cc4493e3e1b..ed307a5de8b 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgshellintegration_p.h +++ b/src/plugins/platforms/wayland/qwaylandxdgshellintegration_p.h @@ -72,7 +72,7 @@ public: private: QWaylandXdgShellIntegration(QWaylandDisplay *display); - QWaylandXdgShell *m_xdgShell; + QWaylandXdgShell *m_xdgShell = nullptr; }; } diff --git a/src/plugins/platforms/wayland/qwaylandxdgshellv6.cpp b/src/plugins/platforms/wayland/qwaylandxdgshellv6.cpp index 1a60d65333f..69bbf55b866 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgshellv6.cpp +++ b/src/plugins/platforms/wayland/qwaylandxdgshellv6.cpp @@ -117,9 +117,6 @@ QWaylandXdgSurfaceV6::QWaylandXdgSurfaceV6(QWaylandXdgShellV6 *shell, ::zxdg_sur , zxdg_surface_v6(surface) , m_shell(shell) , m_window(window) - , m_toplevel(nullptr) - , m_popup(nullptr) - , m_configured(false) { } diff --git a/src/plugins/platforms/wayland/qwaylandxdgshellv6_p.h b/src/plugins/platforms/wayland/qwaylandxdgshellv6_p.h index 769f19837b4..122beed0c8c 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgshellv6_p.h +++ b/src/plugins/platforms/wayland/qwaylandxdgshellv6_p.h @@ -125,9 +125,9 @@ private: QWaylandXdgShellV6 *m_shell; QWaylandWindow *m_window; - Toplevel *m_toplevel; - Popup *m_popup; - bool m_configured; + Toplevel *m_toplevel = nullptr; + Popup *m_popup = nullptr; + bool m_configured = false; QRegion m_exposeRegion; }; diff --git a/src/plugins/platforms/wayland/qwaylandxdgshellv6integration.cpp b/src/plugins/platforms/wayland/qwaylandxdgshellv6integration.cpp index a3dca70bf56..cb82354b64c 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgshellv6integration.cpp +++ b/src/plugins/platforms/wayland/qwaylandxdgshellv6integration.cpp @@ -51,7 +51,6 @@ QT_BEGIN_NAMESPACE namespace QtWaylandClient { QWaylandXdgShellV6Integration::QWaylandXdgShellV6Integration(QWaylandDisplay *display) - : m_xdgShell(nullptr) { for (QWaylandDisplay::RegistryGlobal global : display->globals()) { if (global.interface == QLatin1String("zxdg_shell_v6")) { diff --git a/src/plugins/platforms/wayland/qwaylandxdgshellv6integration_p.h b/src/plugins/platforms/wayland/qwaylandxdgshellv6integration_p.h index f22b6a66adf..bdfd1972338 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgshellv6integration_p.h +++ b/src/plugins/platforms/wayland/qwaylandxdgshellv6integration_p.h @@ -71,7 +71,7 @@ public: private: QWaylandXdgShellV6Integration(QWaylandDisplay *display); - QWaylandXdgShellV6 *m_xdgShell; + QWaylandXdgShellV6 *m_xdgShell = nullptr; }; } diff --git a/src/plugins/platforms/wayland/qwaylandxdgsurface.cpp b/src/plugins/platforms/wayland/qwaylandxdgsurface.cpp index 60266af689d..40ed9f07aa1 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgsurface.cpp +++ b/src/plugins/platforms/wayland/qwaylandxdgsurface.cpp @@ -57,11 +57,6 @@ QWaylandXdgSurface::QWaylandXdgSurface(QWaylandXdgShell *shell, QWaylandWindow * , QtWayland::xdg_surface(shell->get_xdg_surface(window->object())) , m_window(window) , m_shell(shell) - , m_maximized(false) - , m_minimized(false) - , m_fullscreen(false) - , m_active(false) - , m_extendedWindow(nullptr) { if (window->display()->windowExtension()) m_extendedWindow = new QWaylandExtendedSurface(window); diff --git a/src/plugins/platforms/wayland/qwaylandxdgsurface_p.h b/src/plugins/platforms/wayland/qwaylandxdgsurface_p.h index 00154ade072..fa79632068a 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgsurface_p.h +++ b/src/plugins/platforms/wayland/qwaylandxdgsurface_p.h @@ -112,13 +112,13 @@ private: private: QWaylandWindow *m_window; QWaylandXdgShell* m_shell; - bool m_maximized; - bool m_minimized; - bool m_fullscreen; - bool m_active; + bool m_maximized = false; + bool m_minimized = false; + bool m_fullscreen = false; + bool m_active = false; QSize m_normalSize; QMargins m_margins; - QWaylandExtendedSurface *m_extendedWindow; + QWaylandExtendedSurface *m_extendedWindow = nullptr; void xdg_surface_configure(int32_t width, int32_t height, diff --git a/src/plugins/platforms/wayland/shared/qwaylandinputmethodeventbuilder.cpp b/src/plugins/platforms/wayland/shared/qwaylandinputmethodeventbuilder.cpp index 6acf312ed59..88056637df9 100644 --- a/src/plugins/platforms/wayland/shared/qwaylandinputmethodeventbuilder.cpp +++ b/src/plugins/platforms/wayland/shared/qwaylandinputmethodeventbuilder.cpp @@ -50,16 +50,6 @@ QT_BEGIN_NAMESPACE -QWaylandInputMethodEventBuilder::QWaylandInputMethodEventBuilder() - : m_anchor(0) - , m_cursor(0) - , m_deleteBefore(0) - , m_deleteAfter(0) - , m_preeditCursor(0) - , m_preeditStyles() -{ -} - QWaylandInputMethodEventBuilder::~QWaylandInputMethodEventBuilder() { } diff --git a/src/plugins/platforms/wayland/shared/qwaylandinputmethodeventbuilder_p.h b/src/plugins/platforms/wayland/shared/qwaylandinputmethodeventbuilder_p.h index 3912afc0424..a234cf44be8 100644 --- a/src/plugins/platforms/wayland/shared/qwaylandinputmethodeventbuilder_p.h +++ b/src/plugins/platforms/wayland/shared/qwaylandinputmethodeventbuilder_p.h @@ -47,7 +47,7 @@ QT_BEGIN_NAMESPACE class QWaylandInputMethodEventBuilder { public: - QWaylandInputMethodEventBuilder(); + QWaylandInputMethodEventBuilder() = default; ~QWaylandInputMethodEventBuilder(); void reset(); @@ -66,12 +66,12 @@ public: private: QPair replacementForDeleteSurrounding(); - int32_t m_anchor; - int32_t m_cursor; - uint32_t m_deleteBefore; - uint32_t m_deleteAfter; + int32_t m_anchor = 0; + int32_t m_cursor = 0; + uint32_t m_deleteBefore = 0; + uint32_t m_deleteAfter = 0; - int32_t m_preeditCursor; + int32_t m_preeditCursor = 0; QList m_preeditStyles; }; diff --git a/tests/auto/wayland/client/tst_client.cpp b/tests/auto/wayland/client/tst_client.cpp index eb99b2e2f5f..8ee52d7364f 100644 --- a/tests/auto/wayland/client/tst_client.cpp +++ b/tests/auto/wayland/client/tst_client.cpp @@ -48,14 +48,6 @@ class TestWindow : public QWindow { public: TestWindow() - : focusInEventCount(0) - , focusOutEventCount(0) - , keyPressEventCount(0) - , keyReleaseEventCount(0) - , mousePressEventCount(0) - , mouseReleaseEventCount(0) - , touchEventCount(0) - , keyCode(0) { setSurfaceType(QSurface::RasterSurface); setGeometry(0, 0, 32, 32); @@ -103,15 +95,15 @@ public: QPoint frameOffset() const { return QPoint(frameMargins().left(), frameMargins().top()); } - int focusInEventCount; - int focusOutEventCount; - int keyPressEventCount; - int keyReleaseEventCount; - int mousePressEventCount; - int mouseReleaseEventCount; - int touchEventCount; + int focusInEventCount = 0; + int focusOutEventCount = 0; + int keyPressEventCount = 0; + int keyReleaseEventCount = 0; + int mousePressEventCount = 0; + int mouseReleaseEventCount = 0; + int touchEventCount = 0; - uint keyCode; + uint keyCode = 0; QPoint mousePressPos; }; @@ -404,7 +396,6 @@ class DndWindow : public QWindow public: DndWindow(QWindow *parent = nullptr) : QWindow(parent) - , dragStarted(false) { QImage cursorImage(64,64,QImage::Format_ARGB32); cursorImage.fill(Qt::blue); @@ -412,7 +403,7 @@ public: } ~DndWindow(){} QPoint frameOffset() const { return QPoint(frameMargins().left(), frameMargins().top()); } - bool dragStarted; + bool dragStarted = false; protected: void mousePressEvent(QMouseEvent *event) override diff --git a/tests/auto/wayland/shared/mockcompositor.cpp b/tests/auto/wayland/shared/mockcompositor.cpp index 2f1d68b0147..1d76cec1200 100644 --- a/tests/auto/wayland/shared/mockcompositor.cpp +++ b/tests/auto/wayland/shared/mockcompositor.cpp @@ -37,9 +37,6 @@ #include MockCompositor::MockCompositor() - : m_alive(true) - , m_ready(false) - , m_compositor(0) { pthread_create(&m_thread, 0, run, this); diff --git a/tests/auto/wayland/shared/mockcompositor.h b/tests/auto/wayland/shared/mockcompositor.h index 747da38fa06..c6de12376a3 100644 --- a/tests/auto/wayland/shared/mockcompositor.h +++ b/tests/auto/wayland/shared/mockcompositor.h @@ -212,13 +212,13 @@ private: static void *run(void *data); - bool m_alive; - bool m_ready; + bool m_alive = true; + bool m_ready = false; pthread_t m_thread; QMutex m_mutex; QWaitCondition m_waitCondition; - Impl::Compositor *m_compositor; + Impl::Compositor *m_compositor = nullptr; QList m_commandQueue; }; diff --git a/tests/auto/wayland/shared/mockinput.cpp b/tests/auto/wayland/shared/mockinput.cpp index 9cea85b6d12..8b7592824d7 100644 --- a/tests/auto/wayland/shared/mockinput.cpp +++ b/tests/auto/wayland/shared/mockinput.cpp @@ -232,10 +232,7 @@ void Seat::seat_get_touch(Resource *resource, uint32_t id) } Keyboard::Keyboard(Compositor *compositor) - : wl_keyboard() - , m_compositor(compositor) - , m_focusResource(nullptr) - , m_focus(nullptr) + : m_compositor(compositor) { } @@ -286,10 +283,7 @@ void Keyboard::keyboard_destroy_resource(wl_keyboard::Resource *resource) } Pointer::Pointer(Compositor *compositor) - : wl_pointer() - , m_compositor(compositor) - , m_focusResource(nullptr) - , m_focus(nullptr) + : m_compositor(compositor) { } @@ -393,10 +387,7 @@ DataOffer::DataOffer() } DataDevice::DataDevice(Compositor *compositor) - : wl_data_device() - , m_compositor(compositor) - , m_dataOffer(nullptr) - , m_focus(nullptr) + : m_compositor(compositor) { } diff --git a/tests/auto/wayland/shared/mockinput.h b/tests/auto/wayland/shared/mockinput.h index 9c217b6acd2..5760ab40c63 100644 --- a/tests/auto/wayland/shared/mockinput.h +++ b/tests/auto/wayland/shared/mockinput.h @@ -85,8 +85,8 @@ protected: private: Compositor *m_compositor; - Resource *m_focusResource; - Surface *m_focus; + Resource *m_focusResource = nullptr; + Surface *m_focus = nullptr; }; class Pointer : public QtWaylandServer::wl_pointer @@ -108,8 +108,8 @@ protected: private: Compositor *m_compositor; - Resource *m_focusResource; - Surface *m_focus; + Resource *m_focusResource = nullptr; + Surface *m_focus = nullptr; }; class Touch : public QtWaylandServer::wl_touch @@ -146,8 +146,8 @@ protected: private: Compositor *m_compositor; - QtWaylandServer::wl_data_offer *m_dataOffer; - Surface* m_focus; + QtWaylandServer::wl_data_offer *m_dataOffer = nullptr; + Surface* m_focus = nullptr; }; class DataDeviceManager : public QtWaylandServer::wl_data_device_manager diff --git a/tests/auto/wayland/shared/mocksurface.cpp b/tests/auto/wayland/shared/mocksurface.cpp index 7aa2a00b2da..98a9615a624 100644 --- a/tests/auto/wayland/shared/mocksurface.cpp +++ b/tests/auto/wayland/shared/mocksurface.cpp @@ -62,10 +62,8 @@ void Compositor::sendSurfaceLeave(void *data, const QList ¶meters) Surface::Surface(wl_client *client, uint32_t id, int v, Compositor *compositor) : QtWaylandServer::wl_surface(client, id, v) - , m_buffer(nullptr) , m_compositor(compositor) , m_mockSurface(new MockSurface(this)) - , m_mapped(false) { } diff --git a/tests/auto/wayland/shared/mocksurface.h b/tests/auto/wayland/shared/mocksurface.h index 5155599bbfa..8bf6eb755a2 100644 --- a/tests/auto/wayland/shared/mocksurface.h +++ b/tests/auto/wayland/shared/mocksurface.h @@ -63,12 +63,12 @@ protected: uint32_t callback) override; void surface_commit(Resource *resource) override; private: - wl_resource *m_buffer; + wl_resource *m_buffer = nullptr; Compositor *m_compositor; QSharedPointer m_mockSurface; QList m_frameCallbackList; - bool m_mapped; + bool m_mapped = false; }; } From 290e12e5a63fa8ea066a8236cb525865144a8605 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Tue, 27 Feb 2018 16:21:17 +0100 Subject: [PATCH 0497/1507] Use default member initialization for raw pointers Initialize to nullptr to prevent undefined behavior. Change-Id: I7753c0be77a886d62ecb1cd7b86fc8c98340b0b8 Reviewed-by: Paul Olav Tvete Reviewed-by: Shawn Rutledge --- src/plugins/platforms/wayland/qwaylandclipboard_p.h | 2 +- src/plugins/platforms/wayland/qwaylandcursor_p.h | 4 ++-- src/plugins/platforms/wayland/qwaylanddatadevice.cpp | 2 +- .../platforms/wayland/qwaylanddatadevicemanager_p.h | 2 +- src/plugins/platforms/wayland/qwaylanddataoffer_p.h | 4 ++-- src/plugins/platforms/wayland/qwaylanddatasource_p.h | 4 ++-- src/plugins/platforms/wayland/qwaylanddisplay_p.h | 12 ++++++------ src/plugins/platforms/wayland/qwaylanddnd_p.h | 2 +- .../platforms/wayland/qwaylandextendedsurface_p.h | 2 +- .../platforms/wayland/qwaylandinputcontext_p.h | 4 ++-- .../platforms/wayland/qwaylandinputdevice_p.h | 12 ++++++------ .../platforms/wayland/qwaylandnativeinterface_p.h | 2 +- src/plugins/platforms/wayland/qwaylandqtkey_p.h | 2 +- .../platforms/wayland/qwaylandshellsurface_p.h | 2 +- src/plugins/platforms/wayland/qwaylandsubsurface_p.h | 4 ++-- src/plugins/platforms/wayland/qwaylandtouch_p.h | 8 ++++---- .../wayland/qwaylandwindowmanagerintegration.cpp | 2 +- .../platforms/wayland/qwaylandwlshellsurface_p.h | 2 +- src/plugins/platforms/wayland/qwaylandxdgpopup_p.h | 2 +- src/plugins/platforms/wayland/qwaylandxdgshellv6_p.h | 8 ++++---- src/plugins/platforms/wayland/qwaylandxdgsurface_p.h | 4 ++-- .../shared/qwaylandsharedmemoryformathelper_p.h | 2 +- .../shellintegration/qwaylandshellintegration_p.h | 2 +- tests/auto/wayland/client/tst_client.cpp | 2 +- tests/auto/wayland/shared/mockcompositor.h | 6 +++--- tests/auto/wayland/shared/mockinput.h | 12 ++++++------ tests/auto/wayland/shared/mocksurface.h | 2 +- tests/auto/wayland/xdgshellv6/tst_xdgshellv6.cpp | 2 +- 28 files changed, 57 insertions(+), 57 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandclipboard_p.h b/src/plugins/platforms/wayland/qwaylandclipboard_p.h index 28336202241..42202285967 100644 --- a/src/plugins/platforms/wayland/qwaylandclipboard_p.h +++ b/src/plugins/platforms/wayland/qwaylandclipboard_p.h @@ -78,7 +78,7 @@ public: bool ownsMode(QClipboard::Mode mode) const override; private: - QWaylandDisplay *mDisplay; + QWaylandDisplay *mDisplay = nullptr; QMimeData m_emptyData; }; diff --git a/src/plugins/platforms/wayland/qwaylandcursor_p.h b/src/plugins/platforms/wayland/qwaylandcursor_p.h index 916a464e455..b7b1c2a75e0 100644 --- a/src/plugins/platforms/wayland/qwaylandcursor_p.h +++ b/src/plugins/platforms/wayland/qwaylandcursor_p.h @@ -119,8 +119,8 @@ private: struct wl_cursor* requestCursor(WaylandCursor shape); void initCursorMap(); - QWaylandDisplay *mDisplay; - struct wl_cursor_theme *mCursorTheme; + QWaylandDisplay *mDisplay = nullptr; + struct wl_cursor_theme *mCursorTheme = nullptr; QPoint mLastPos; QMap mCursors; QMultiMap mCursorNamesMap; diff --git a/src/plugins/platforms/wayland/qwaylanddatadevice.cpp b/src/plugins/platforms/wayland/qwaylanddatadevice.cpp index 4411ba65ccd..300c9de0aa8 100644 --- a/src/plugins/platforms/wayland/qwaylanddatadevice.cpp +++ b/src/plugins/platforms/wayland/qwaylanddatadevice.cpp @@ -203,7 +203,7 @@ void QWaylandDataDevice::data_device_motion(uint32_t time, wl_fixed_t x, wl_fixe m_dragPoint = calculateDragPosition(x, y, m_dragWindow); - QMimeData *dragData; + QMimeData *dragData = nullptr; Qt::DropActions supportedActions; if (drag) { dragData = drag->mimeData(); diff --git a/src/plugins/platforms/wayland/qwaylanddatadevicemanager_p.h b/src/plugins/platforms/wayland/qwaylanddatadevicemanager_p.h index 3daf780aaa9..10df1bca912 100644 --- a/src/plugins/platforms/wayland/qwaylanddatadevicemanager_p.h +++ b/src/plugins/platforms/wayland/qwaylanddatadevicemanager_p.h @@ -76,7 +76,7 @@ public: QWaylandDisplay *display() const; private: - QWaylandDisplay *m_display; + QWaylandDisplay *m_display = nullptr; }; } diff --git a/src/plugins/platforms/wayland/qwaylanddataoffer_p.h b/src/plugins/platforms/wayland/qwaylanddataoffer_p.h index c9b9c21f17d..932506bf51a 100644 --- a/src/plugins/platforms/wayland/qwaylanddataoffer_p.h +++ b/src/plugins/platforms/wayland/qwaylanddataoffer_p.h @@ -98,8 +98,8 @@ protected: private: int readData(int fd, QByteArray &data) const; - mutable QWaylandDataOffer *m_dataOffer; - QWaylandDisplay *m_display; + mutable QWaylandDataOffer *m_dataOffer = nullptr; + QWaylandDisplay *m_display = nullptr; mutable QStringList m_types; mutable QHash m_data; }; diff --git a/src/plugins/platforms/wayland/qwaylanddatasource_p.h b/src/plugins/platforms/wayland/qwaylanddatasource_p.h index bba003f561b..a79cdcbfa1a 100644 --- a/src/plugins/platforms/wayland/qwaylanddatasource_p.h +++ b/src/plugins/platforms/wayland/qwaylanddatasource_p.h @@ -86,8 +86,8 @@ protected: void data_source_target(const QString &mime_type) override; private: - QWaylandDisplay *m_display; - QMimeData *m_mime_data; + QWaylandDisplay *m_display = nullptr; + QMimeData *m_mime_data = nullptr; }; } diff --git a/src/plugins/platforms/wayland/qwaylanddisplay_p.h b/src/plugins/platforms/wayland/qwaylanddisplay_p.h index 0a7ea427a5d..dbcc2112f46 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay_p.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay_p.h @@ -149,7 +149,7 @@ public: uint32_t id; QString interface; uint32_t version; - struct ::wl_registry *registry; + struct ::wl_registry *registry = nullptr; RegistryGlobal(uint32_t id_, const QString &interface_, uint32_t version_, struct ::wl_registry *registry_) : id(id_), interface(interface_), version(version_), registry(registry_) { } }; @@ -191,17 +191,17 @@ private: void requestWaylandSync(); struct Listener { - RegistryListener listener; - void *data; + RegistryListener listener = nullptr; + void *data = nullptr; }; - struct wl_display *mDisplay; + struct wl_display *mDisplay = nullptr; QtWayland::wl_compositor mCompositor; QScopedPointer mShm; QList mScreens; QList mInputDevices; QList mRegistryListeners; - QWaylandIntegration *mWaylandIntegration; + QWaylandIntegration *mWaylandIntegration = nullptr; #if QT_CONFIG(wayland_datadevice) QScopedPointer mDndSelectionHandler; #endif @@ -212,7 +212,7 @@ private: QScopedPointer mWindowManagerIntegration; QScopedPointer mTextInputManager; QScopedPointer mHardwareIntegration; - QSocketNotifier *mReadNotifier; + QSocketNotifier *mReadNotifier = nullptr; int mFd; int mWritableNotificationFd; QList mGlobals; diff --git a/src/plugins/platforms/wayland/qwaylanddnd_p.h b/src/plugins/platforms/wayland/qwaylanddnd_p.h index 8a1d7f1f1ef..0f14eb00be2 100644 --- a/src/plugins/platforms/wayland/qwaylanddnd_p.h +++ b/src/plugins/platforms/wayland/qwaylanddnd_p.h @@ -84,7 +84,7 @@ protected: private: - QWaylandDisplay *m_display; + QWaylandDisplay *m_display = nullptr; }; #endif } diff --git a/src/plugins/platforms/wayland/qwaylandextendedsurface_p.h b/src/plugins/platforms/wayland/qwaylandextendedsurface_p.h index 02700b2901d..dffd04281f6 100644 --- a/src/plugins/platforms/wayland/qwaylandextendedsurface_p.h +++ b/src/plugins/platforms/wayland/qwaylandextendedsurface_p.h @@ -83,7 +83,7 @@ private: void extended_surface_set_generic_property(const QString &name, wl_array *value) override; void extended_surface_close() override; - QWaylandWindow *m_window; + QWaylandWindow *m_window = nullptr; QVariantMap m_properties; }; diff --git a/src/plugins/platforms/wayland/qwaylandinputcontext_p.h b/src/plugins/platforms/wayland/qwaylandinputcontext_p.h index a554f23011c..cbb2e18dc75 100644 --- a/src/plugins/platforms/wayland/qwaylandinputcontext_p.h +++ b/src/plugins/platforms/wayland/qwaylandinputcontext_p.h @@ -107,7 +107,7 @@ protected: private: Qt::KeyboardModifiers modifiersToQtModifiers(uint32_t modifiers); - QWaylandDisplay *m_display; + QWaylandDisplay *m_display = nullptr; QWaylandInputMethodEventBuilder m_builder; QVector m_modifiersMap; @@ -155,7 +155,7 @@ public: private: QWaylandTextInput *textInput() const; - QWaylandDisplay *mDisplay; + QWaylandDisplay *mDisplay = nullptr; QPointer mCurrentWindow; }; diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h index 8a02769e3bb..2c7d2cffd61 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h +++ b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h @@ -143,13 +143,13 @@ public: private: void setCursor(Qt::CursorShape cursor, QWaylandScreen *screen); - QWaylandDisplay *mQDisplay; - struct wl_display *mDisplay; + QWaylandDisplay *mQDisplay = nullptr; + struct wl_display *mDisplay = nullptr; int mVersion; uint32_t mCaps = 0; - struct wl_surface *pointerSurface; + struct wl_surface *pointerSurface = nullptr; #if QT_CONFIG(wayland_datadevice) QWaylandDataDevice *mDataDevice = nullptr; @@ -207,7 +207,7 @@ public: uint32_t mods_locked, uint32_t group) override; - QWaylandInputDevice *mParent; + QWaylandInputDevice *mParent = nullptr; QPointer mFocus; #if QT_CONFIG(xkbcommon_evdev) xkb_context *mXkbContext = nullptr; @@ -262,7 +262,7 @@ public: void releaseButtons(); - QWaylandInputDevice *mParent; + QWaylandInputDevice *mParent = nullptr; QPointer mFocus; uint32_t mEnterSerial = 0; #if QT_CONFIG(cursor) @@ -302,7 +302,7 @@ public: bool allTouchPointsReleased(); void releasePoints(); - QWaylandInputDevice *mParent; + QWaylandInputDevice *mParent = nullptr; QPointer mFocus; QList mTouchPoints; QList mPrevTouchPoints; diff --git a/src/plugins/platforms/wayland/qwaylandnativeinterface_p.h b/src/plugins/platforms/wayland/qwaylandnativeinterface_p.h index c83180c0995..3de80eb6ac4 100644 --- a/src/plugins/platforms/wayland/qwaylandnativeinterface_p.h +++ b/src/plugins/platforms/wayland/qwaylandnativeinterface_p.h @@ -85,7 +85,7 @@ public: QFunctionPointer platformFunction(const QByteArray &resource) const override; private: - QWaylandIntegration *m_integration; + QWaylandIntegration *m_integration = nullptr; QHash m_windowProperties; static void setSync(QWindow *window); diff --git a/src/plugins/platforms/wayland/qwaylandqtkey_p.h b/src/plugins/platforms/wayland/qwaylandqtkey_p.h index 3374b907a44..9091cf81935 100644 --- a/src/plugins/platforms/wayland/qwaylandqtkey_p.h +++ b/src/plugins/platforms/wayland/qwaylandqtkey_p.h @@ -68,7 +68,7 @@ public: QWaylandQtKeyExtension(QWaylandDisplay *display, uint32_t id); private: - QWaylandDisplay *m_display; + QWaylandDisplay *m_display = nullptr; void key_extension_qtkey(struct wl_surface *surface, uint32_t time, diff --git a/src/plugins/platforms/wayland/qwaylandshellsurface_p.h b/src/plugins/platforms/wayland/qwaylandshellsurface_p.h index 06d92ba086a..3a725d822f8 100644 --- a/src/plugins/platforms/wayland/qwaylandshellsurface_p.h +++ b/src/plugins/platforms/wayland/qwaylandshellsurface_p.h @@ -104,7 +104,7 @@ protected: virtual void setMinimized() {} private: - QWaylandWindow *m_window; + QWaylandWindow *m_window = nullptr; friend class QWaylandWindow; }; diff --git a/src/plugins/platforms/wayland/qwaylandsubsurface_p.h b/src/plugins/platforms/wayland/qwaylandsubsurface_p.h index 36a92a7559e..a9fd76a887d 100644 --- a/src/plugins/platforms/wayland/qwaylandsubsurface_p.h +++ b/src/plugins/platforms/wayland/qwaylandsubsurface_p.h @@ -86,8 +86,8 @@ private: // to keep track of the sync state void set_sync(); void set_desync(); - QWaylandWindow *m_window; - QWaylandWindow *m_parent; + QWaylandWindow *m_window = nullptr; + QWaylandWindow *m_parent = nullptr; bool m_synchronized = false; QMutex m_syncLock; diff --git a/src/plugins/platforms/wayland/qwaylandtouch_p.h b/src/plugins/platforms/wayland/qwaylandtouch_p.h index 7d909769d8a..93a829e2115 100644 --- a/src/plugins/platforms/wayland/qwaylandtouch_p.h +++ b/src/plugins/platforms/wayland/qwaylandtouch_p.h @@ -73,7 +73,7 @@ public: private: void registerDevice(int caps); - QWaylandDisplay *mDisplay; + QWaylandDisplay *mDisplay = nullptr; void touch_extension_touch(uint32_t time, uint32_t id, @@ -95,15 +95,15 @@ private: QList mTouchPoints; QList mPrevTouchPoints; - QTouchDevice *mTouchDevice; + QTouchDevice *mTouchDevice = nullptr; uint32_t mTimestamp; int mPointsLeft; uint32_t mFlags; int mMouseSourceId; QPointF mLastMouseLocal; QPointF mLastMouseGlobal; - QWindow *mTargetWindow; - QWaylandInputDevice *mInputDevice; + QWindow *mTargetWindow = nullptr; + QWaylandInputDevice *mInputDevice = nullptr; }; } diff --git a/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration.cpp b/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration.cpp index 785a0a44d7c..17ae8a5ae85 100644 --- a/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration.cpp @@ -61,7 +61,7 @@ class QWaylandWindowManagerIntegrationPrivate { public: QWaylandWindowManagerIntegrationPrivate(QWaylandDisplay *waylandDisplay); bool m_blockPropertyUpdates = false; - QWaylandDisplay *m_waylandDisplay; + QWaylandDisplay *m_waylandDisplay = nullptr; QHash m_queuedProperties; bool m_showIsFullScreen = false; }; diff --git a/src/plugins/platforms/wayland/qwaylandwlshellsurface_p.h b/src/plugins/platforms/wayland/qwaylandwlshellsurface_p.h index 708c6f1132b..b0e677951cd 100644 --- a/src/plugins/platforms/wayland/qwaylandwlshellsurface_p.h +++ b/src/plugins/platforms/wayland/qwaylandwlshellsurface_p.h @@ -104,7 +104,7 @@ private: void updateTransientParent(QWindow *parent); void setPopup(QWaylandWindow *parent, QWaylandInputDevice *device, uint serial); - QWaylandWindow *m_window; + QWaylandWindow *m_window = nullptr; bool m_maximized = false; bool m_fullscreen = false; QSize m_size; diff --git a/src/plugins/platforms/wayland/qwaylandxdgpopup_p.h b/src/plugins/platforms/wayland/qwaylandxdgpopup_p.h index 85bd589bf7e..74c0dca2679 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgpopup_p.h +++ b/src/plugins/platforms/wayland/qwaylandxdgpopup_p.h @@ -81,7 +81,7 @@ protected: private: QWaylandExtendedSurface *m_extendedWindow = nullptr; - QWaylandWindow *m_window; + QWaylandWindow *m_window = nullptr; }; QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandxdgshellv6_p.h b/src/plugins/platforms/wayland/qwaylandxdgshellv6_p.h index 122beed0c8c..e59a67d69d8 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgshellv6_p.h +++ b/src/plugins/platforms/wayland/qwaylandxdgshellv6_p.h @@ -106,7 +106,7 @@ private: QVarLengthArray states; } m_configureState; - QWaylandXdgSurfaceV6 *m_xdgSurface; + QWaylandXdgSurfaceV6 *m_xdgSurface = nullptr; }; class Popup : public QtWayland::zxdg_popup_v6 { @@ -117,14 +117,14 @@ private: void applyConfigure(); void zxdg_popup_v6_popup_done() override; - QWaylandXdgSurfaceV6 *m_xdgSurface; + QWaylandXdgSurfaceV6 *m_xdgSurface = nullptr; }; void setToplevel(); void setPopup(QWaylandWindow *parent, QWaylandInputDevice *device, int serial, bool grab); - QWaylandXdgShellV6 *m_shell; - QWaylandWindow *m_window; + QWaylandXdgShellV6 *m_shell = nullptr; + QWaylandWindow *m_window = nullptr; Toplevel *m_toplevel = nullptr; Popup *m_popup = nullptr; bool m_configured = false; diff --git a/src/plugins/platforms/wayland/qwaylandxdgsurface_p.h b/src/plugins/platforms/wayland/qwaylandxdgsurface_p.h index fa79632068a..42846c665fa 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgsurface_p.h +++ b/src/plugins/platforms/wayland/qwaylandxdgsurface_p.h @@ -110,8 +110,8 @@ private: void updateTransientParent(QWaylandWindow *parent); private: - QWaylandWindow *m_window; - QWaylandXdgShell* m_shell; + QWaylandWindow *m_window = nullptr; + QWaylandXdgShell* m_shell = nullptr; bool m_maximized = false; bool m_minimized = false; bool m_fullscreen = false; diff --git a/src/plugins/platforms/wayland/shared/qwaylandsharedmemoryformathelper_p.h b/src/plugins/platforms/wayland/shared/qwaylandsharedmemoryformathelper_p.h index 7f2f77cc3c8..e5b5faf02e3 100644 --- a/src/plugins/platforms/wayland/shared/qwaylandsharedmemoryformathelper_p.h +++ b/src/plugins/platforms/wayland/shared/qwaylandsharedmemoryformathelper_p.h @@ -63,7 +63,7 @@ private: , data(data) { } const size_t size; - const wl_shm_format *data; + const wl_shm_format *data = nullptr; }; static const Array getData() diff --git a/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegration_p.h b/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegration_p.h index ab9b736bbca..7f3a2cefcfd 100644 --- a/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegration_p.h +++ b/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegration_p.h @@ -81,7 +81,7 @@ public: } protected: - QWaylandDisplay *m_display; + QWaylandDisplay *m_display = nullptr; }; } diff --git a/tests/auto/wayland/client/tst_client.cpp b/tests/auto/wayland/client/tst_client.cpp index 8ee52d7364f..4eb85818c76 100644 --- a/tests/auto/wayland/client/tst_client.cpp +++ b/tests/auto/wayland/client/tst_client.cpp @@ -170,7 +170,7 @@ private slots: void glWindow(); private: - MockCompositor *compositor; + MockCompositor *compositor = nullptr; }; void tst_WaylandClient::primaryScreen() diff --git a/tests/auto/wayland/shared/mockcompositor.h b/tests/auto/wayland/shared/mockcompositor.h index c6de12376a3..c0c3c884f34 100644 --- a/tests/auto/wayland/shared/mockcompositor.h +++ b/tests/auto/wayland/shared/mockcompositor.h @@ -141,7 +141,7 @@ private: friend class Impl::Compositor; friend class Impl::Surface; - Impl::Surface *m_surface; + Impl::Surface *m_surface = nullptr; }; Q_DECLARE_METATYPE(QSharedPointer) @@ -151,7 +151,7 @@ public: Impl::Output *handle() const { return m_output; } MockOutput(Impl::Output *output); private: - Impl::Output *m_output; + Impl::Output *m_output = nullptr; }; Q_DECLARE_METATYPE(QSharedPointer) @@ -201,7 +201,7 @@ private: typedef void (*Callback)(void *target, const QList ¶meters); Callback callback; - void *target; + void *target = nullptr; QList parameters; }; diff --git a/tests/auto/wayland/shared/mockinput.h b/tests/auto/wayland/shared/mockinput.h index 5760ab40c63..d9adb3621f2 100644 --- a/tests/auto/wayland/shared/mockinput.h +++ b/tests/auto/wayland/shared/mockinput.h @@ -60,7 +60,7 @@ protected: void seat_get_touch(Resource *resource, uint32_t id) override; private: - Compositor *m_compositor; + Compositor *m_compositor = nullptr; QScopedPointer m_keyboard; QScopedPointer m_pointer; @@ -83,7 +83,7 @@ protected: void keyboard_destroy_resource(wl_keyboard::Resource *resource) override; private: - Compositor *m_compositor; + Compositor *m_compositor = nullptr; Resource *m_focusResource = nullptr; Surface *m_focus = nullptr; @@ -106,7 +106,7 @@ protected: void pointer_destroy_resource(wl_pointer::Resource *resource) override; private: - Compositor *m_compositor; + Compositor *m_compositor = nullptr; Resource *m_focusResource = nullptr; Surface *m_focus = nullptr; @@ -121,7 +121,7 @@ public: void sendMotion(Surface *surface, const QPoint &position, int id); void sendFrame(Surface *surface); private: - Compositor *m_compositor; + Compositor *m_compositor = nullptr; }; class DataOffer : public QtWaylandServer::wl_data_offer @@ -145,7 +145,7 @@ protected: void data_device_start_drag(Resource *resource, struct ::wl_resource *source, struct ::wl_resource *origin, struct ::wl_resource *icon, uint32_t serial) override; private: - Compositor *m_compositor; + Compositor *m_compositor = nullptr; QtWaylandServer::wl_data_offer *m_dataOffer = nullptr; Surface* m_focus = nullptr; }; @@ -162,7 +162,7 @@ protected: void data_device_manager_create_data_source(Resource *resource, uint32_t id) override; private: - Compositor *m_compositor; + Compositor *m_compositor = nullptr; QScopedPointer m_data_device; }; diff --git a/tests/auto/wayland/shared/mocksurface.h b/tests/auto/wayland/shared/mocksurface.h index 8bf6eb755a2..68fe9b94ce4 100644 --- a/tests/auto/wayland/shared/mocksurface.h +++ b/tests/auto/wayland/shared/mocksurface.h @@ -65,7 +65,7 @@ protected: private: wl_resource *m_buffer = nullptr; - Compositor *m_compositor; + Compositor *m_compositor = nullptr; QSharedPointer m_mockSurface; QList m_frameCallbackList; bool m_mapped = false; diff --git a/tests/auto/wayland/xdgshellv6/tst_xdgshellv6.cpp b/tests/auto/wayland/xdgshellv6/tst_xdgshellv6.cpp index 5aac336f272..9e4aa8c07a1 100644 --- a/tests/auto/wayland/xdgshellv6/tst_xdgshellv6.cpp +++ b/tests/auto/wayland/xdgshellv6/tst_xdgshellv6.cpp @@ -82,7 +82,7 @@ private slots: void createDestroyWindow(); private: - MockCompositor *m_compositor; + MockCompositor *m_compositor = nullptr; }; void tst_WaylandClientXdgShellV6::createDestroyWindow() From bb409e849b28c31cb28e231eac0e299a30e0bde6 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Tue, 20 Feb 2018 14:00:19 +0100 Subject: [PATCH 0498/1507] Use override when applicable Applied automatic fixes using clang-tidy's modernize-use-override. This adds the "override" keyword where it's possible and also removes the "virtual" keyword when redundant. Change-Id: I899950e5cf8782785d30a245a9c69c1720905d50 Reviewed-by: Paul Olav Tvete --- .../qwaylandclientbufferintegrationplugin_p.h | 2 +- .../qwaylandserverbufferintegrationplugin_p.h | 2 +- .../qwaylandinputdeviceintegrationplugin_p.h | 2 +- .../wayland/qwaylandabstractdecoration.cpp | 2 +- .../wayland/qwaylandabstractdecoration_p.h | 2 +- .../platforms/wayland/qwaylandclipboard_p.h | 2 +- src/plugins/platforms/wayland/qwaylandcursor_p.h | 2 +- .../platforms/wayland/qwaylanddatadevice_p.h | 2 +- .../wayland/qwaylanddatadevicemanager_p.h | 2 +- .../platforms/wayland/qwaylanddataoffer_p.h | 4 ++-- .../platforms/wayland/qwaylanddatasource_p.h | 2 +- .../platforms/wayland/qwaylanddecorationplugin_p.h | 2 +- src/plugins/platforms/wayland/qwaylanddisplay_p.h | 2 +- src/plugins/platforms/wayland/qwaylanddnd_p.h | 2 +- .../platforms/wayland/qwaylandextendedsurface_p.h | 2 +- .../platforms/wayland/qwaylandinputcontext_p.h | 4 ++-- .../platforms/wayland/qwaylandinputdevice_p.h | 8 ++++---- .../platforms/wayland/qwaylandintegration_p.h | 2 +- src/plugins/platforms/wayland/qwaylandscreen_p.h | 2 +- .../platforms/wayland/qwaylandshellsurface_p.h | 2 +- src/plugins/platforms/wayland/qwaylandshm_p.h | 4 ++-- .../platforms/wayland/qwaylandshmbackingstore_p.h | 4 ++-- .../platforms/wayland/qwaylandshmwindow_p.h | 2 +- .../platforms/wayland/qwaylandsubsurface_p.h | 2 +- src/plugins/platforms/wayland/qwaylandwindow_p.h | 2 +- .../wayland/qwaylandwindowmanagerintegration_p.h | 2 +- .../platforms/wayland/qwaylandwlshellsurface_p.h | 2 +- src/plugins/platforms/wayland/qwaylandxdgpopup_p.h | 2 +- src/plugins/platforms/wayland/qwaylandxdgshell_p.h | 2 +- .../platforms/wayland/qwaylandxdgshellv6_p.h | 8 ++++---- .../platforms/wayland/qwaylandxdgsurface_p.h | 2 +- .../qwaylandshellintegrationplugin_p.h | 2 +- tests/auto/wayland/client/tst_client.cpp | 14 +++++++------- 33 files changed, 49 insertions(+), 49 deletions(-) diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationplugin_p.h b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationplugin_p.h index 1711852c7c2..e66021916ba 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationplugin_p.h +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationplugin_p.h @@ -70,7 +70,7 @@ class Q_WAYLAND_CLIENT_EXPORT QWaylandClientBufferIntegrationPlugin : public QOb Q_OBJECT public: explicit QWaylandClientBufferIntegrationPlugin(QObject *parent = nullptr); - ~QWaylandClientBufferIntegrationPlugin(); + ~QWaylandClientBufferIntegrationPlugin() override; virtual QWaylandClientBufferIntegration *create(const QString &key, const QStringList ¶mList) = 0; }; diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationplugin_p.h b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationplugin_p.h index bf6c04f8276..b5e7ede4781 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationplugin_p.h +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationplugin_p.h @@ -70,7 +70,7 @@ class Q_WAYLAND_CLIENT_EXPORT QWaylandServerBufferIntegrationPlugin : public QOb Q_OBJECT public: explicit QWaylandServerBufferIntegrationPlugin(QObject *parent = nullptr); - ~QWaylandServerBufferIntegrationPlugin(); + ~QWaylandServerBufferIntegrationPlugin() override; virtual QWaylandServerBufferIntegration *create(const QString &key, const QStringList ¶mList) = 0; }; diff --git a/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationplugin_p.h b/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationplugin_p.h index 104d594ca08..bae6e216694 100644 --- a/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationplugin_p.h +++ b/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationplugin_p.h @@ -70,7 +70,7 @@ class Q_WAYLAND_CLIENT_EXPORT QWaylandInputDeviceIntegrationPlugin : public QObj Q_OBJECT public: explicit QWaylandInputDeviceIntegrationPlugin(QObject *parent = nullptr); - ~QWaylandInputDeviceIntegrationPlugin(); + ~QWaylandInputDeviceIntegrationPlugin() override; virtual QWaylandInputDeviceIntegration *create(const QString &key, const QStringList ¶mList) = 0; }; diff --git a/src/plugins/platforms/wayland/qwaylandabstractdecoration.cpp b/src/plugins/platforms/wayland/qwaylandabstractdecoration.cpp index c20b70e9e29..c82ff539477 100644 --- a/src/plugins/platforms/wayland/qwaylandabstractdecoration.cpp +++ b/src/plugins/platforms/wayland/qwaylandabstractdecoration.cpp @@ -58,7 +58,7 @@ class QWaylandAbstractDecorationPrivate : public QObjectPrivate public: QWaylandAbstractDecorationPrivate(); - ~QWaylandAbstractDecorationPrivate(); + ~QWaylandAbstractDecorationPrivate() override; QWindow *m_window = nullptr; QWaylandWindow *m_wayland_window = nullptr; diff --git a/src/plugins/platforms/wayland/qwaylandabstractdecoration_p.h b/src/plugins/platforms/wayland/qwaylandabstractdecoration_p.h index 42c65be64cc..84a6d4dd79d 100644 --- a/src/plugins/platforms/wayland/qwaylandabstractdecoration_p.h +++ b/src/plugins/platforms/wayland/qwaylandabstractdecoration_p.h @@ -85,7 +85,7 @@ class Q_WAYLAND_CLIENT_EXPORT QWaylandAbstractDecoration : public QObject Q_DECLARE_PRIVATE(QWaylandAbstractDecoration) public: QWaylandAbstractDecoration(); - virtual ~QWaylandAbstractDecoration(); + ~QWaylandAbstractDecoration() override; void setWaylandWindow(QWaylandWindow *window); QWaylandWindow *waylandWindow() const; diff --git a/src/plugins/platforms/wayland/qwaylandclipboard_p.h b/src/plugins/platforms/wayland/qwaylandclipboard_p.h index 42202285967..ce14e1240e4 100644 --- a/src/plugins/platforms/wayland/qwaylandclipboard_p.h +++ b/src/plugins/platforms/wayland/qwaylandclipboard_p.h @@ -70,7 +70,7 @@ class Q_WAYLAND_CLIENT_EXPORT QWaylandClipboard : public QPlatformClipboard public: QWaylandClipboard(QWaylandDisplay *display); - ~QWaylandClipboard(); + ~QWaylandClipboard() override; QMimeData *mimeData(QClipboard::Mode mode = QClipboard::Clipboard) override; void setMimeData(QMimeData *data, QClipboard::Mode mode = QClipboard::Clipboard) override; diff --git a/src/plugins/platforms/wayland/qwaylandcursor_p.h b/src/plugins/platforms/wayland/qwaylandcursor_p.h index b7b1c2a75e0..b3df9316097 100644 --- a/src/plugins/platforms/wayland/qwaylandcursor_p.h +++ b/src/plugins/platforms/wayland/qwaylandcursor_p.h @@ -73,7 +73,7 @@ class Q_WAYLAND_CLIENT_EXPORT QWaylandCursor : public QPlatformCursor { public: QWaylandCursor(QWaylandScreen *screen); - ~QWaylandCursor(); + ~QWaylandCursor() override; void changeCursor(QCursor *cursor, QWindow *window) override; void pointerEvent(const QMouseEvent &event) override; diff --git a/src/plugins/platforms/wayland/qwaylanddatadevice_p.h b/src/plugins/platforms/wayland/qwaylanddatadevice_p.h index 29461930b37..0a7f42538da 100644 --- a/src/plugins/platforms/wayland/qwaylanddatadevice_p.h +++ b/src/plugins/platforms/wayland/qwaylanddatadevice_p.h @@ -80,7 +80,7 @@ class QWaylandDataDevice : public QObject, public QtWayland::wl_data_device Q_OBJECT public: QWaylandDataDevice(QWaylandDataDeviceManager *manager, QWaylandInputDevice *inputDevice); - ~QWaylandDataDevice(); + ~QWaylandDataDevice() override; QWaylandDataOffer *selectionOffer() const; void invalidateSelectionOffer(); diff --git a/src/plugins/platforms/wayland/qwaylanddatadevicemanager_p.h b/src/plugins/platforms/wayland/qwaylanddatadevicemanager_p.h index 10df1bca912..bd05c0fbb49 100644 --- a/src/plugins/platforms/wayland/qwaylanddatadevicemanager_p.h +++ b/src/plugins/platforms/wayland/qwaylanddatadevicemanager_p.h @@ -69,7 +69,7 @@ class Q_WAYLAND_CLIENT_EXPORT QWaylandDataDeviceManager : public QtWayland::wl_d { public: QWaylandDataDeviceManager(QWaylandDisplay *display, uint32_t id); - ~QWaylandDataDeviceManager(); + ~QWaylandDataDeviceManager() override; QWaylandDataDevice *getDataDevice(QWaylandInputDevice *inputDevice); diff --git a/src/plugins/platforms/wayland/qwaylanddataoffer_p.h b/src/plugins/platforms/wayland/qwaylanddataoffer_p.h index 932506bf51a..3e88b8f4ba2 100644 --- a/src/plugins/platforms/wayland/qwaylanddataoffer_p.h +++ b/src/plugins/platforms/wayland/qwaylanddataoffer_p.h @@ -69,7 +69,7 @@ class Q_WAYLAND_CLIENT_EXPORT QWaylandDataOffer : public QtWayland::wl_data_offe { public: explicit QWaylandDataOffer(QWaylandDisplay *display, struct ::wl_data_offer *offer); - ~QWaylandDataOffer(); + ~QWaylandDataOffer() override; QString firstFormat() const; @@ -86,7 +86,7 @@ private: class QWaylandMimeData : public QInternalMimeData { public: explicit QWaylandMimeData(QWaylandDataOffer *dataOffer, QWaylandDisplay *display); - ~QWaylandMimeData(); + ~QWaylandMimeData() override; void appendFormat(const QString &mimeType); diff --git a/src/plugins/platforms/wayland/qwaylanddatasource_p.h b/src/plugins/platforms/wayland/qwaylanddatasource_p.h index a79cdcbfa1a..25afff79c5a 100644 --- a/src/plugins/platforms/wayland/qwaylanddatasource_p.h +++ b/src/plugins/platforms/wayland/qwaylanddatasource_p.h @@ -72,7 +72,7 @@ class Q_WAYLAND_CLIENT_EXPORT QWaylandDataSource : public QObject, public QtWayl Q_OBJECT public: QWaylandDataSource(QWaylandDataDeviceManager *dataDeviceManager, QMimeData *mimeData); - ~QWaylandDataSource(); + ~QWaylandDataSource() override; QMimeData *mimeData() const; diff --git a/src/plugins/platforms/wayland/qwaylanddecorationplugin_p.h b/src/plugins/platforms/wayland/qwaylanddecorationplugin_p.h index 4255de46f16..41daaea05e3 100644 --- a/src/plugins/platforms/wayland/qwaylanddecorationplugin_p.h +++ b/src/plugins/platforms/wayland/qwaylanddecorationplugin_p.h @@ -70,7 +70,7 @@ class Q_WAYLAND_CLIENT_EXPORT QWaylandDecorationPlugin : public QObject Q_OBJECT public: explicit QWaylandDecorationPlugin(QObject *parent = nullptr); - ~QWaylandDecorationPlugin(); + ~QWaylandDecorationPlugin() override; virtual QWaylandAbstractDecoration *create(const QString &key, const QStringList ¶mList) = 0; }; diff --git a/src/plugins/platforms/wayland/qwaylanddisplay_p.h b/src/plugins/platforms/wayland/qwaylanddisplay_p.h index dbcc2112f46..bc4af7a504b 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay_p.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay_p.h @@ -109,7 +109,7 @@ class Q_WAYLAND_CLIENT_EXPORT QWaylandDisplay : public QObject, public QtWayland public: QWaylandDisplay(QWaylandIntegration *waylandIntegration); - ~QWaylandDisplay(void); + ~QWaylandDisplay(void) override; QList screens() const { return mScreens; } diff --git a/src/plugins/platforms/wayland/qwaylanddnd_p.h b/src/plugins/platforms/wayland/qwaylanddnd_p.h index 0f14eb00be2..04b39826c27 100644 --- a/src/plugins/platforms/wayland/qwaylanddnd_p.h +++ b/src/plugins/platforms/wayland/qwaylanddnd_p.h @@ -69,7 +69,7 @@ class Q_WAYLAND_CLIENT_EXPORT QWaylandDrag : public QBasicDrag { public: QWaylandDrag(QWaylandDisplay *display); - ~QWaylandDrag(); + ~QWaylandDrag() override; void updateTarget(const QString &mimeType); void setResponse(const QPlatformDragQtResponse &response); diff --git a/src/plugins/platforms/wayland/qwaylandextendedsurface_p.h b/src/plugins/platforms/wayland/qwaylandextendedsurface_p.h index dffd04281f6..cd604f34211 100644 --- a/src/plugins/platforms/wayland/qwaylandextendedsurface_p.h +++ b/src/plugins/platforms/wayland/qwaylandextendedsurface_p.h @@ -70,7 +70,7 @@ class Q_WAYLAND_CLIENT_EXPORT QWaylandExtendedSurface : public QtWayland::qt_ext { public: QWaylandExtendedSurface(QWaylandWindow *window); - ~QWaylandExtendedSurface(); + ~QWaylandExtendedSurface() override; void setContentOrientationMask(Qt::ScreenOrientations mask); diff --git a/src/plugins/platforms/wayland/qwaylandinputcontext_p.h b/src/plugins/platforms/wayland/qwaylandinputcontext_p.h index cbb2e18dc75..93300e1f5ac 100644 --- a/src/plugins/platforms/wayland/qwaylandinputcontext_p.h +++ b/src/plugins/platforms/wayland/qwaylandinputcontext_p.h @@ -74,7 +74,7 @@ class QWaylandTextInput : public QtWayland::zwp_text_input_v2 { public: QWaylandTextInput(QWaylandDisplay *display, struct ::zwp_text_input_v2 *text_input); - ~QWaylandTextInput(); + ~QWaylandTextInput() override; void reset(); void commit(); @@ -132,7 +132,7 @@ class QWaylandInputContext : public QPlatformInputContext Q_OBJECT public: explicit QWaylandInputContext(QWaylandDisplay *display); - ~QWaylandInputContext(); + ~QWaylandInputContext() override; bool isValid() const override; diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h index 2c7d2cffd61..48c1cf57f2d 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h +++ b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h @@ -102,7 +102,7 @@ public: class Touch; QWaylandInputDevice(QWaylandDisplay *display, int version, uint32_t id); - ~QWaylandInputDevice(); + ~QWaylandInputDevice() override; uint32_t capabilities() const { return mCaps; } @@ -187,7 +187,7 @@ class Q_WAYLAND_CLIENT_EXPORT QWaylandInputDevice::Keyboard : public QObject, pu public: Keyboard(QWaylandInputDevice *p); - virtual ~Keyboard(); + ~Keyboard() override; void stopRepeat(); @@ -247,7 +247,7 @@ class Q_WAYLAND_CLIENT_EXPORT QWaylandInputDevice::Pointer : public QtWayland::w public: Pointer(QWaylandInputDevice *p); - virtual ~Pointer(); + ~Pointer() override; void pointer_enter(uint32_t serial, struct wl_surface *surface, wl_fixed_t sx, wl_fixed_t sy) override; @@ -281,7 +281,7 @@ class Q_WAYLAND_CLIENT_EXPORT QWaylandInputDevice::Touch : public QtWayland::wl_ { public: Touch(QWaylandInputDevice *p); - virtual ~Touch(); + ~Touch() override; void touch_down(uint32_t serial, uint32_t time, diff --git a/src/plugins/platforms/wayland/qwaylandintegration_p.h b/src/plugins/platforms/wayland/qwaylandintegration_p.h index 7ce79e6da1e..8c34e7198a8 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration_p.h +++ b/src/plugins/platforms/wayland/qwaylandintegration_p.h @@ -71,7 +71,7 @@ class Q_WAYLAND_CLIENT_EXPORT QWaylandIntegration : public QPlatformIntegration { public: QWaylandIntegration(); - ~QWaylandIntegration(); + ~QWaylandIntegration() override; bool hasFailed() { return mFailed; } diff --git a/src/plugins/platforms/wayland/qwaylandscreen_p.h b/src/plugins/platforms/wayland/qwaylandscreen_p.h index 37c35cffff4..9df55d60340 100644 --- a/src/plugins/platforms/wayland/qwaylandscreen_p.h +++ b/src/plugins/platforms/wayland/qwaylandscreen_p.h @@ -67,7 +67,7 @@ class Q_WAYLAND_CLIENT_EXPORT QWaylandScreen : public QPlatformScreen, QtWayland { public: QWaylandScreen(QWaylandDisplay *waylandDisplay, int version, uint32_t id); - ~QWaylandScreen(); + ~QWaylandScreen() override; void init(); QWaylandDisplay *display() const; diff --git a/src/plugins/platforms/wayland/qwaylandshellsurface_p.h b/src/plugins/platforms/wayland/qwaylandshellsurface_p.h index 3a725d822f8..72bef9183e5 100644 --- a/src/plugins/platforms/wayland/qwaylandshellsurface_p.h +++ b/src/plugins/platforms/wayland/qwaylandshellsurface_p.h @@ -74,7 +74,7 @@ class Q_WAYLAND_CLIENT_EXPORT QWaylandShellSurface : public QObject Q_OBJECT public: explicit QWaylandShellSurface(QWaylandWindow *window); - virtual ~QWaylandShellSurface() {} + ~QWaylandShellSurface() override {} virtual void resize(QWaylandInputDevice * /*inputDevice*/, enum wl_shell_surface_resize /*edges*/) {} diff --git a/src/plugins/platforms/wayland/qwaylandshm_p.h b/src/plugins/platforms/wayland/qwaylandshm_p.h index 519482d09eb..639effa16d8 100644 --- a/src/plugins/platforms/wayland/qwaylandshm_p.h +++ b/src/plugins/platforms/wayland/qwaylandshm_p.h @@ -69,7 +69,7 @@ class Q_WAYLAND_CLIENT_EXPORT QWaylandShm : public QtWayland::wl_shm public: QWaylandShm(QWaylandDisplay *display, int version, uint32_t id); - ~QWaylandShm(); + ~QWaylandShm() override; bool formatSupported(wl_shm_format format) const; bool formatSupported(QImage::Format format) const; @@ -78,7 +78,7 @@ public: static QImage::Format formatFrom(wl_shm_format format); protected: - virtual void shm_format(uint32_t format); + void shm_format(uint32_t format) override; private: QVector m_formats; diff --git a/src/plugins/platforms/wayland/qwaylandshmbackingstore_p.h b/src/plugins/platforms/wayland/qwaylandshmbackingstore_p.h index 628d1858be1..cb66288fcd9 100644 --- a/src/plugins/platforms/wayland/qwaylandshmbackingstore_p.h +++ b/src/plugins/platforms/wayland/qwaylandshmbackingstore_p.h @@ -71,7 +71,7 @@ class Q_WAYLAND_CLIENT_EXPORT QWaylandShmBuffer : public QWaylandBuffer { public: QWaylandShmBuffer(QWaylandDisplay *display, const QSize &size, QImage::Format format, int scale = 1); - ~QWaylandShmBuffer(); + ~QWaylandShmBuffer() override; QSize size() const override { return mImage.size(); } int scale() const override { return int(mImage.devicePixelRatio()); } QImage *image() { return &mImage; } @@ -88,7 +88,7 @@ class Q_WAYLAND_CLIENT_EXPORT QWaylandShmBackingStore : public QPlatformBackingS { public: QWaylandShmBackingStore(QWindow *window); - ~QWaylandShmBackingStore(); + ~QWaylandShmBackingStore() override; QPaintDevice *paintDevice() override; void flush(QWindow *window, const QRegion ®ion, const QPoint &offset) override; diff --git a/src/plugins/platforms/wayland/qwaylandshmwindow_p.h b/src/plugins/platforms/wayland/qwaylandshmwindow_p.h index af86ce3a342..ae17278593b 100644 --- a/src/plugins/platforms/wayland/qwaylandshmwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandshmwindow_p.h @@ -62,7 +62,7 @@ class Q_WAYLAND_CLIENT_EXPORT QWaylandShmWindow : public QWaylandWindow { public: QWaylandShmWindow(QWindow *window); - ~QWaylandShmWindow(); + ~QWaylandShmWindow() override; WindowType windowType() const override; QSurfaceFormat format() const override { return QSurfaceFormat(); } diff --git a/src/plugins/platforms/wayland/qwaylandsubsurface_p.h b/src/plugins/platforms/wayland/qwaylandsubsurface_p.h index a9fd76a887d..e9a7cb20e70 100644 --- a/src/plugins/platforms/wayland/qwaylandsubsurface_p.h +++ b/src/plugins/platforms/wayland/qwaylandsubsurface_p.h @@ -70,7 +70,7 @@ class Q_WAYLAND_CLIENT_EXPORT QWaylandSubSurface : public QtWayland::wl_subsurfa { public: QWaylandSubSurface(QWaylandWindow *window, QWaylandWindow *parent, ::wl_subsurface *subsurface); - ~QWaylandSubSurface(); + ~QWaylandSubSurface() override; QWaylandWindow *window() const { return m_window; } QWaylandWindow *parent() const { return m_parent; } diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index a74f188274f..0680b14e586 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -104,7 +104,7 @@ public: }; QWaylandWindow(QWindow *window); - ~QWaylandWindow(); + ~QWaylandWindow() override; virtual WindowType windowType() const = 0; virtual void ensureSize(); diff --git a/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration_p.h b/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration_p.h index e399d4f0b82..1319abd9106 100644 --- a/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration_p.h @@ -75,7 +75,7 @@ class Q_WAYLAND_CLIENT_EXPORT QWaylandWindowManagerIntegration : public QObject, Q_DECLARE_PRIVATE(QWaylandWindowManagerIntegration) public: explicit QWaylandWindowManagerIntegration(QWaylandDisplay *waylandDisplay); - virtual ~QWaylandWindowManagerIntegration(); + ~QWaylandWindowManagerIntegration() override; bool openUrl(const QUrl &url) override; bool openDocument(const QUrl &url) override; diff --git a/src/plugins/platforms/wayland/qwaylandwlshellsurface_p.h b/src/plugins/platforms/wayland/qwaylandwlshellsurface_p.h index b0e677951cd..f9ac1bb4c0f 100644 --- a/src/plugins/platforms/wayland/qwaylandwlshellsurface_p.h +++ b/src/plugins/platforms/wayland/qwaylandwlshellsurface_p.h @@ -75,7 +75,7 @@ class Q_WAYLAND_CLIENT_EXPORT QWaylandWlShellSurface : public QWaylandShellSurfa Q_OBJECT public: QWaylandWlShellSurface(struct ::wl_shell_surface *shell_surface, QWaylandWindow *window); - virtual ~QWaylandWlShellSurface(); + ~QWaylandWlShellSurface() override; using QtWayland::wl_shell_surface::resize; void resize(QWaylandInputDevice *inputDevice, enum wl_shell_surface_resize edges) override; diff --git a/src/plugins/platforms/wayland/qwaylandxdgpopup_p.h b/src/plugins/platforms/wayland/qwaylandxdgpopup_p.h index 74c0dca2679..b027c05dc72 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgpopup_p.h +++ b/src/plugins/platforms/wayland/qwaylandxdgpopup_p.h @@ -72,7 +72,7 @@ class Q_WAYLAND_CLIENT_EXPORT QWaylandXdgPopup : public QWaylandShellSurface Q_OBJECT public: QWaylandXdgPopup(struct ::xdg_popup *popup, QWaylandWindow *window); - virtual ~QWaylandXdgPopup(); + ~QWaylandXdgPopup() override; void setType(Qt::WindowType type, QWaylandWindow *transientParent) override; diff --git a/src/plugins/platforms/wayland/qwaylandxdgshell_p.h b/src/plugins/platforms/wayland/qwaylandxdgshell_p.h index e01104cadf3..afbd9c591df 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgshell_p.h +++ b/src/plugins/platforms/wayland/qwaylandxdgshell_p.h @@ -76,7 +76,7 @@ class Q_WAYLAND_CLIENT_EXPORT QWaylandXdgShell : public QtWayland::xdg_shell public: QWaylandXdgShell(struct ::xdg_shell *shell); QWaylandXdgShell(struct ::wl_registry *registry, uint32_t id); - virtual ~QWaylandXdgShell(); + ~QWaylandXdgShell() override; QWaylandXdgSurface *createXdgSurface(QWaylandWindow *window); QWaylandXdgPopup *createXdgPopup(QWaylandWindow *window); diff --git a/src/plugins/platforms/wayland/qwaylandxdgshellv6_p.h b/src/plugins/platforms/wayland/qwaylandxdgshellv6_p.h index e59a67d69d8..baaf38074ff 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgshellv6_p.h +++ b/src/plugins/platforms/wayland/qwaylandxdgshellv6_p.h @@ -75,7 +75,7 @@ class Q_WAYLAND_CLIENT_EXPORT QWaylandXdgSurfaceV6 : public QWaylandShellSurface { public: QWaylandXdgSurfaceV6(QWaylandXdgShellV6 *shell, ::zxdg_surface_v6 *surface, QWaylandWindow *window); - ~QWaylandXdgSurfaceV6(); + ~QWaylandXdgSurfaceV6() override; void resize(QWaylandInputDevice *inputDevice, enum zxdg_toplevel_v6_resize_edge edges); void resize(QWaylandInputDevice *inputDevice, enum wl_shell_surface_resize edges) override; @@ -94,7 +94,7 @@ private: { public: Toplevel(QWaylandXdgSurfaceV6 *xdgSurface); - ~Toplevel(); + ~Toplevel() override; void applyConfigure(); @@ -112,7 +112,7 @@ private: class Popup : public QtWayland::zxdg_popup_v6 { public: Popup(QWaylandXdgSurfaceV6 *xdgSurface, QWaylandXdgSurfaceV6 *parent, QtWayland::zxdg_positioner_v6 *positioner); - ~Popup(); + ~Popup() override; void applyConfigure(); void zxdg_popup_v6_popup_done() override; @@ -138,7 +138,7 @@ public: QWaylandXdgSurfaceV6 *getXdgSurface(QWaylandWindow *window); - virtual ~QWaylandXdgShellV6(); + ~QWaylandXdgShellV6() override; private: void zxdg_shell_v6_ping(uint32_t serial) override; diff --git a/src/plugins/platforms/wayland/qwaylandxdgsurface_p.h b/src/plugins/platforms/wayland/qwaylandxdgsurface_p.h index 42846c665fa..9fcecca7ca4 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgsurface_p.h +++ b/src/plugins/platforms/wayland/qwaylandxdgsurface_p.h @@ -77,7 +77,7 @@ class Q_WAYLAND_CLIENT_EXPORT QWaylandXdgSurface : public QWaylandShellSurface Q_OBJECT public: QWaylandXdgSurface(QWaylandXdgShell *shell, QWaylandWindow *window); - virtual ~QWaylandXdgSurface(); + ~QWaylandXdgSurface() override; using QtWayland::xdg_surface::resize; void resize(QWaylandInputDevice *inputDevice, enum resize_edge edges); diff --git a/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationplugin_p.h b/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationplugin_p.h index 8ec9a542355..d6067569074 100644 --- a/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationplugin_p.h +++ b/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationplugin_p.h @@ -70,7 +70,7 @@ class Q_WAYLAND_CLIENT_EXPORT QWaylandShellIntegrationPlugin : public QObject Q_OBJECT public: explicit QWaylandShellIntegrationPlugin(QObject *parent = nullptr); - ~QWaylandShellIntegrationPlugin(); + ~QWaylandShellIntegrationPlugin() override; virtual QWaylandShellIntegration *create(const QString &key, const QStringList ¶mList) = 0; }; diff --git a/tests/auto/wayland/client/tst_client.cpp b/tests/auto/wayland/client/tst_client.cpp index 4eb85818c76..1e0fc5675b8 100644 --- a/tests/auto/wayland/client/tst_client.cpp +++ b/tests/auto/wayland/client/tst_client.cpp @@ -54,35 +54,35 @@ public: create(); } - void focusInEvent(QFocusEvent *) + void focusInEvent(QFocusEvent *) override { ++focusInEventCount; } - void focusOutEvent(QFocusEvent *) + void focusOutEvent(QFocusEvent *) override { ++focusOutEventCount; } - void keyPressEvent(QKeyEvent *event) + void keyPressEvent(QKeyEvent *event) override { ++keyPressEventCount; keyCode = event->nativeScanCode(); } - void keyReleaseEvent(QKeyEvent *event) + void keyReleaseEvent(QKeyEvent *event) override { ++keyReleaseEventCount; keyCode = event->nativeScanCode(); } - void mousePressEvent(QMouseEvent *event) + void mousePressEvent(QMouseEvent *event) override { ++mousePressEventCount; mousePressPos = event->pos(); } - void mouseReleaseEvent(QMouseEvent *) + void mouseReleaseEvent(QMouseEvent *) override { ++mouseReleaseEventCount; } @@ -401,7 +401,7 @@ public: cursorImage.fill(Qt::blue); m_dragIcon = QPixmap::fromImage(cursorImage); } - ~DndWindow(){} + ~DndWindow() override{} QPoint frameOffset() const { return QPoint(frameMargins().left(), frameMargins().top()); } bool dragStarted = false; From 01d0594c9e8fe9bf8c718086c6c57ef1650e612b Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Wed, 28 Feb 2018 13:26:48 +0100 Subject: [PATCH 0499/1507] Ensure paintGL() is called in tst_WaylandClient::glWindow() The test is still skipped due to CI problems, though (QTBUG-65802). Task-number: QTBUG-66511 Change-Id: I79a67a80708de4cf2a7347a96c4b6344182d3ae0 Reviewed-by: Paul Olav Tvete --- tests/auto/wayland/client/tst_client.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/auto/wayland/client/tst_client.cpp b/tests/auto/wayland/client/tst_client.cpp index 1e0fc5675b8..ab9e5754d39 100644 --- a/tests/auto/wayland/client/tst_client.cpp +++ b/tests/auto/wayland/client/tst_client.cpp @@ -113,6 +113,7 @@ class TestGlWindow : public QOpenGLWindow public: TestGlWindow(); + uint paintGLCalled = 0; protected: void paintGL() override; @@ -124,6 +125,7 @@ TestGlWindow::TestGlWindow() void TestGlWindow::paintGL() { glClear(GL_COLOR_BUFFER_BIT); + ++paintGLCalled; } class tst_WaylandClient : public QObject @@ -550,6 +552,8 @@ void tst_WaylandClient::glWindow() QSharedPointer surface; QTRY_VERIFY(surface = compositor->surface()); + QTRY_VERIFY(testWindow->paintGLCalled); + //confirm we don't crash when we delete an already hidden GL window //QTBUG-65553 testWindow->setVisible(false); From 2d468ebfa501b14e3ac4e7ae24fa538c979bb217 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Tue, 6 Feb 2018 13:36:03 +0100 Subject: [PATCH 0500/1507] Client: Implement QPlatformWindow::startSystemMove() Hooks into what we already use for the window decorations. Task-number: QTBUG-58044 Change-Id: Idcd971f69d52a5bb760bb6bffb26e9f5bdd429df Reviewed-by: Pier Luigi Fiorini Reviewed-by: Shawn Rutledge --- src/plugins/platforms/wayland/qwaylandshellsurface_p.h | 2 +- src/plugins/platforms/wayland/qwaylandwindow.cpp | 8 ++++++++ src/plugins/platforms/wayland/qwaylandwindow_p.h | 2 ++ src/plugins/platforms/wayland/qwaylandwlshellsurface.cpp | 3 ++- src/plugins/platforms/wayland/qwaylandwlshellsurface_p.h | 2 +- src/plugins/platforms/wayland/qwaylandxdgshellv6.cpp | 9 ++++++--- src/plugins/platforms/wayland/qwaylandxdgshellv6_p.h | 2 +- src/plugins/platforms/wayland/qwaylandxdgsurface.cpp | 3 ++- src/plugins/platforms/wayland/qwaylandxdgsurface_p.h | 2 +- 9 files changed, 24 insertions(+), 9 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandshellsurface_p.h b/src/plugins/platforms/wayland/qwaylandshellsurface_p.h index 72bef9183e5..fdc309a635d 100644 --- a/src/plugins/platforms/wayland/qwaylandshellsurface_p.h +++ b/src/plugins/platforms/wayland/qwaylandshellsurface_p.h @@ -78,7 +78,7 @@ public: virtual void resize(QWaylandInputDevice * /*inputDevice*/, enum wl_shell_surface_resize /*edges*/) {} - virtual void move(QWaylandInputDevice * /*inputDevice*/) {} + virtual bool move(QWaylandInputDevice *) { return false; } virtual void setTitle(const QString & /*title*/) {} virtual void setAppId(const QString & /*appId*/) {} diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 52461dc38bc..ecab8ffcca1 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -1045,6 +1045,14 @@ void QWaylandWindow::addAttachOffset(const QPoint point) mOffset += point; } +bool QtWaylandClient::QWaylandWindow::startSystemMove(const QPoint &pos) +{ + Q_UNUSED(pos); + if (auto seat = display()->lastInputDevice()) + return mShellSurface && mShellSurface->move(seat); + return false; +} + } QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index 0680b14e586..3324bf70056 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -201,6 +201,8 @@ public: void propagateSizeHints() override { } void addAttachOffset(const QPoint point); + bool startSystemMove(const QPoint &pos) override; + void requestUpdate() override; public slots: diff --git a/src/plugins/platforms/wayland/qwaylandwlshellsurface.cpp b/src/plugins/platforms/wayland/qwaylandwlshellsurface.cpp index 00b070f3fd1..f1b0bd2c349 100644 --- a/src/plugins/platforms/wayland/qwaylandwlshellsurface.cpp +++ b/src/plugins/platforms/wayland/qwaylandwlshellsurface.cpp @@ -74,10 +74,11 @@ void QWaylandWlShellSurface::resize(QWaylandInputDevice *inputDevice, enum wl_sh edges); } -void QWaylandWlShellSurface::move(QWaylandInputDevice *inputDevice) +bool QWaylandWlShellSurface::move(QWaylandInputDevice *inputDevice) { move(inputDevice->wl_seat(), inputDevice->serial()); + return true; } void QWaylandWlShellSurface::setTitle(const QString & title) diff --git a/src/plugins/platforms/wayland/qwaylandwlshellsurface_p.h b/src/plugins/platforms/wayland/qwaylandwlshellsurface_p.h index f9ac1bb4c0f..497ec604379 100644 --- a/src/plugins/platforms/wayland/qwaylandwlshellsurface_p.h +++ b/src/plugins/platforms/wayland/qwaylandwlshellsurface_p.h @@ -81,7 +81,7 @@ public: void resize(QWaylandInputDevice *inputDevice, enum wl_shell_surface_resize edges) override; using QtWayland::wl_shell_surface::move; - void move(QWaylandInputDevice *inputDevice) override; + bool move(QWaylandInputDevice *inputDevice) override; void setTitle(const QString & title) override; void setAppId(const QString &appId) override; diff --git a/src/plugins/platforms/wayland/qwaylandxdgshellv6.cpp b/src/plugins/platforms/wayland/qwaylandxdgshellv6.cpp index 69bbf55b866..c89c8316f7e 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgshellv6.cpp +++ b/src/plugins/platforms/wayland/qwaylandxdgshellv6.cpp @@ -142,10 +142,13 @@ void QWaylandXdgSurfaceV6::resize(QWaylandInputDevice *inputDevice, enum wl_shel } -void QWaylandXdgSurfaceV6::move(QWaylandInputDevice *inputDevice) +bool QWaylandXdgSurfaceV6::move(QWaylandInputDevice *inputDevice) { - Q_ASSERT(m_toplevel && m_toplevel->isInitialized()); - m_toplevel->move(inputDevice->wl_seat(), inputDevice->serial()); + if (m_toplevel && m_toplevel->isInitialized()) { + m_toplevel->move(inputDevice->wl_seat(), inputDevice->serial()); + return true; + } + return false; } void QWaylandXdgSurfaceV6::setTitle(const QString &title) diff --git a/src/plugins/platforms/wayland/qwaylandxdgshellv6_p.h b/src/plugins/platforms/wayland/qwaylandxdgshellv6_p.h index baaf38074ff..b72d3d18a9a 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgshellv6_p.h +++ b/src/plugins/platforms/wayland/qwaylandxdgshellv6_p.h @@ -79,7 +79,7 @@ public: void resize(QWaylandInputDevice *inputDevice, enum zxdg_toplevel_v6_resize_edge edges); void resize(QWaylandInputDevice *inputDevice, enum wl_shell_surface_resize edges) override; - void move(QWaylandInputDevice *inputDevice) override; + bool move(QWaylandInputDevice *inputDevice) override; void setTitle(const QString &title) override; void setAppId(const QString &appId) override; diff --git a/src/plugins/platforms/wayland/qwaylandxdgsurface.cpp b/src/plugins/platforms/wayland/qwaylandxdgsurface.cpp index 40ed9f07aa1..4dfc5e6daad 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgsurface.cpp +++ b/src/plugins/platforms/wayland/qwaylandxdgsurface.cpp @@ -85,10 +85,11 @@ void QWaylandXdgSurface::resize(QWaylandInputDevice *inputDevice, enum resize_ed edges); } -void QWaylandXdgSurface::move(QWaylandInputDevice *inputDevice) +bool QWaylandXdgSurface::move(QWaylandInputDevice *inputDevice) { move(inputDevice->wl_seat(), inputDevice->serial()); + return true; } void QWaylandXdgSurface::setMaximized() diff --git a/src/plugins/platforms/wayland/qwaylandxdgsurface_p.h b/src/plugins/platforms/wayland/qwaylandxdgsurface_p.h index 9fcecca7ca4..b8dd93f476a 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgsurface_p.h +++ b/src/plugins/platforms/wayland/qwaylandxdgsurface_p.h @@ -85,7 +85,7 @@ public: void resize(QWaylandInputDevice *inputDevice, enum wl_shell_surface_resize edges) override; using QtWayland::xdg_surface::move; - void move(QWaylandInputDevice *inputDevice) override; + bool move(QWaylandInputDevice *inputDevice) override; void setTitle(const QString &title) override; void setAppId(const QString &appId) override; From 5f32a06c280a79cb99c5ca85642190a75cf2a82e Mon Sep 17 00:00:00 2001 From: Antonio Larrosa Date: Mon, 5 Mar 2018 13:56:15 +0100 Subject: [PATCH 0501/1507] Test for null pointer before using it Task-number: QTBUG-66867 Change-Id: Ibbe407fa3ac32141b52fa0086e9f1ebfd27052ba Done-with: Fabian Vogt Reviewed-by: Johan Helsing Reviewed-by: Jan Grulich --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index ecab8ffcca1..7d868b30bce 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -785,7 +785,7 @@ static QWaylandWindow *closestShellSurfaceWindow(QWindow *window) { while (window) { auto w = static_cast(window->handle()); - if (w->shellSurface()) + if (w && w->shellSurface()) return w; window = window->transientParent() ? window->transientParent() : window->parent(); } From 1ed7da501a2a91c01af099ba5ef6faaa0995458c Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Mon, 5 Mar 2018 13:02:18 +0100 Subject: [PATCH 0502/1507] Add logging category for Wayland platform plugin Change-Id: Ic42119e47afc7bda72eb985fe86d1343a762c274 Reviewed-by: Pier Luigi Fiorini Reviewed-by: David Edmundson --- src/plugins/platforms/wayland/qwaylanddisplay.cpp | 2 ++ src/plugins/platforms/wayland/qwaylanddisplay_p.h | 3 +++ 2 files changed, 5 insertions(+) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index abb0845225f..a9fff410a4a 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -79,6 +79,8 @@ QT_BEGIN_NAMESPACE namespace QtWaylandClient { +Q_LOGGING_CATEGORY(lcQpaWayland, "qt.qpa.wayland"); // for general (uncategorized) Wayland platform logging + struct wl_surface *QWaylandDisplay::createSurface(void *handle) { struct wl_surface *surface = mCompositor.create_surface(); diff --git a/src/plugins/platforms/wayland/qwaylanddisplay_p.h b/src/plugins/platforms/wayland/qwaylanddisplay_p.h index bc4af7a504b..a65ed320d2a 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay_p.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay_p.h @@ -57,6 +57,7 @@ #include #include +#include #include @@ -83,6 +84,8 @@ namespace QtWayland { namespace QtWaylandClient { +Q_DECLARE_LOGGING_CATEGORY(lcQpaWayland); + class QWaylandInputDevice; class QWaylandBuffer; class QWaylandScreen; From fae6abb64bd40e6f863c9446b12cb145a452eab7 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Tue, 6 Mar 2018 16:24:45 +0100 Subject: [PATCH 0503/1507] Show warning when trying to minimize on wl-shell Change-Id: Ice040dad70d0bcaf8bd101da5956ae75e211fe91 Reviewed-by: Pier Luigi Fiorini --- src/plugins/platforms/wayland/qwaylandwlshellsurface.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandwlshellsurface.cpp b/src/plugins/platforms/wayland/qwaylandwlshellsurface.cpp index f1b0bd2c349..098eddcbccf 100644 --- a/src/plugins/platforms/wayland/qwaylandwlshellsurface.cpp +++ b/src/plugins/platforms/wayland/qwaylandwlshellsurface.cpp @@ -147,7 +147,7 @@ void QWaylandWlShellSurface::setNormal() void QWaylandWlShellSurface::setMinimized() { - // TODO: There's no wl_shell_surface API for this + qCWarning(lcQpaWayland) << "Minimization is not supported on wl-shell. Consider using xdg-shell instead."; } void QWaylandWlShellSurface::setTopLevel() From 88101641c07f05279842649bbf71eff128b35116 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Wed, 28 Feb 2018 16:07:41 +0100 Subject: [PATCH 0504/1507] Test what happens when wl_display_connect fails A failed wl_display_connect should make the platform plugin fail gracefully. Add a test for it to make sure. Change-Id: I87a3d9ee151fcdb1bc6ad9ffba44ad5014ede005 Reviewed-by: Friedemann Kleint Reviewed-by: Pier Luigi Fiorini --- tests/auto/wayland/client.pro | 3 +- .../auto/wayland/wl_connect/tst_wlconnect.cpp | 58 +++++++++++++++++++ tests/auto/wayland/wl_connect/wl_connect.pro | 5 ++ 3 files changed, 65 insertions(+), 1 deletion(-) create mode 100644 tests/auto/wayland/wl_connect/tst_wlconnect.cpp create mode 100644 tests/auto/wayland/wl_connect/wl_connect.pro diff --git a/tests/auto/wayland/client.pro b/tests/auto/wayland/client.pro index d19326797b2..a668d37d5f8 100644 --- a/tests/auto/wayland/client.pro +++ b/tests/auto/wayland/client.pro @@ -2,4 +2,5 @@ TEMPLATE=subdirs SUBDIRS += \ client \ - xdgshellv6 + xdgshellv6 \ + wl_connect diff --git a/tests/auto/wayland/wl_connect/tst_wlconnect.cpp b/tests/auto/wayland/wl_connect/tst_wlconnect.cpp new file mode 100644 index 00000000000..661f7ad6278 --- /dev/null +++ b/tests/auto/wayland/wl_connect/tst_wlconnect.cpp @@ -0,0 +1,58 @@ +/**************************************************************************** +** +** Copyright (C) 2018 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include +#include + +class tst_WlConnect : public QObject +{ + Q_OBJECT +private slots: + void failsGracefully() + { + // This tests whether the Wayland platform integration will fail gracefully when it's + // unable to connect to a compositor + + // Make sure the connection actually fails + setenv("XDG_RUNTIME_DIR", "/dev/null", 1); // a place where there are no Wayland sockets + setenv("WAYLAND_DISPLAY", "qt_invalid_socket", 1); // just to be sure + + QStringList arguments; + QString platformPluginPath; + int argc = 0; + char **argv = nullptr; //It's not currently used by the wayland plugin + auto *platformIntegration = QPlatformIntegrationFactory::create("wayland", arguments, argc, argv, platformPluginPath); + + // The factory method should return nullptr to signify it failed gracefully + Q_ASSERT(!platformIntegration); + } +}; + +QTEST_APPLESS_MAIN(tst_WlConnect) +#include diff --git a/tests/auto/wayland/wl_connect/wl_connect.pro b/tests/auto/wayland/wl_connect/wl_connect.pro new file mode 100644 index 00000000000..28723beee9b --- /dev/null +++ b/tests/auto/wayland/wl_connect/wl_connect.pro @@ -0,0 +1,5 @@ +CONFIG += testcase +QT += gui-private testlib + +SOURCES += tst_wlconnect.cpp +TARGET = tst_wlconnect From b127a86f1dbd542fbd9f7548ed303c6932b1a5c9 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Mon, 26 Feb 2018 13:27:37 +0100 Subject: [PATCH 0505/1507] Fix nullptr dereference in client tests Change-Id: I932cd20f17b5486a1161569c5e9a3feebabeee8e Reviewed-by: Pier Luigi Fiorini --- tests/auto/wayland/shared/mockcompositor.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/auto/wayland/shared/mockcompositor.cpp b/tests/auto/wayland/shared/mockcompositor.cpp index 1d76cec1200..ef2636b0f9f 100644 --- a/tests/auto/wayland/shared/mockcompositor.cpp +++ b/tests/auto/wayland/shared/mockcompositor.cpp @@ -245,7 +245,8 @@ QSharedPointer MockCompositor::output(int index) { QSharedPointer result; lock(); - result = m_compositor->outputs().at(index)->mockOutput(); + if (Impl::Output *output = m_compositor->outputs().value(index, nullptr)) + result = output->mockOutput(); unlock(); return result; } From 1605c84bbf71492562ed1d730de4da2197529c50 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Fri, 2 Mar 2018 17:02:15 +0100 Subject: [PATCH 0506/1507] QWindow::requestActivate() is not supported on Wayland MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Return false for the WindowActivation capability to ensure we don't run tests that require it. Change-Id: Ia24d6eef02d462a25f3d50597debda9e062b3955 Reviewed-by: Shawn Rutledge Reviewed-by: Tor Arne Vestbø Reviewed-by: Pier Luigi Fiorini --- src/plugins/platforms/wayland/qwaylandintegration.cpp | 2 ++ src/plugins/platforms/wayland/qwaylandwindow.cpp | 3 +-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandintegration.cpp b/src/plugins/platforms/wayland/qwaylandintegration.cpp index fe1655c9f30..b804988b2cf 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandintegration.cpp @@ -179,6 +179,8 @@ bool QWaylandIntegration::hasCapability(QPlatformIntegration::Capability cap) co return true; case RasterGLSurface: return true; + case WindowActivation: + return false; default: return QPlatformIntegration::hasCapability(cap); } } diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 7d868b30bce..fdfd66688fe 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -930,8 +930,7 @@ void QWaylandWindow::restoreMouseCursor(QWaylandInputDevice *device) void QWaylandWindow::requestActivateWindow() { - // no-op. Wayland does not have activation protocol, - // we rely on compositor setting keyboard focus based on window stacking. + qCWarning(lcQpaWayland) << "Wayland does not support QWindow::requestActivate()"; } void QWaylandWindow::unfocus() From 9df7980958e53053d5f493199cc78ea3dbcbe00d Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Thu, 22 Feb 2018 15:33:40 +0100 Subject: [PATCH 0507/1507] Client test for xdg-shell v6 configure events Task-number: QTBUG-66689 Change-Id: Ifdf38a9ab73357fdbe61e77f0464b227ddd2e8ac Reviewed-by: Andy Nichols --- tests/auto/wayland/client/tst_client.cpp | 1 + tests/auto/wayland/shared/mockcompositor.cpp | 28 +++++++ tests/auto/wayland/shared/mockcompositor.h | 24 ++++++ tests/auto/wayland/shared/mockxdgshellv6.cpp | 73 ++++++++++--------- tests/auto/wayland/shared/mockxdgshellv6.h | 56 ++++++++++++++ .../wayland/xdgshellv6/tst_xdgshellv6.cpp | 28 +++++++ 6 files changed, 176 insertions(+), 34 deletions(-) diff --git a/tests/auto/wayland/client/tst_client.cpp b/tests/auto/wayland/client/tst_client.cpp index ab9e5754d39..02c5bab3ef1 100644 --- a/tests/auto/wayland/client/tst_client.cpp +++ b/tests/auto/wayland/client/tst_client.cpp @@ -153,6 +153,7 @@ public slots: // make sure the surfaces from the last test are properly cleaned up // and don't show up as false positives in the next test QTRY_VERIFY(!compositor->surface()); + QTRY_VERIFY(!compositor->xdgToplevelV6()); } private slots: diff --git a/tests/auto/wayland/shared/mockcompositor.cpp b/tests/auto/wayland/shared/mockcompositor.cpp index ef2636b0f9f..c11d952a74b 100644 --- a/tests/auto/wayland/shared/mockcompositor.cpp +++ b/tests/auto/wayland/shared/mockcompositor.cpp @@ -219,6 +219,14 @@ void MockCompositor::sendSurfaceLeave(const QSharedPointer &surface processCommand(command); } +void MockCompositor::sendXdgToplevelV6Configure(const QSharedPointer toplevel, const QSize &size) +{ + Command command = makeCommand(Impl::Compositor::sendXdgToplevelV6Configure, m_compositor); + command.parameters << QVariant::fromValue(toplevel); + command.parameters << QVariant::fromValue(size); + processCommand(command); +} + void MockCompositor::waitForStartDrag() { Command command = makeCommand(Impl::Compositor::waitForStartDrag, m_compositor); @@ -251,6 +259,16 @@ QSharedPointer MockCompositor::output(int index) return result; } +QSharedPointer MockCompositor::xdgToplevelV6(int index) +{ + QSharedPointer result; + lock(); + if (Impl::XdgToplevelV6 *toplevel = m_compositor->xdgShellV6()->toplevels().value(index, nullptr)) + result = toplevel->mockToplevel(); + unlock(); + return result; +} + MockCompositor::Command MockCompositor::makeCommand(Command::Callback callback, void *target) { Command command; @@ -400,6 +418,11 @@ QVector Compositor::outputs() const return m_outputs; } +XdgShellV6 *Compositor::xdgShellV6() const +{ + return m_xdgShellV6.data(); +} + uint32_t Compositor::nextSerial() { return wl_display_next_serial(m_display); @@ -429,5 +452,10 @@ Output *Compositor::resolveOutput(const QVariant &v) return mockOutput ? mockOutput->handle() : nullptr; } +XdgToplevelV6 *Compositor::resolveToplevel(const QVariant &v) +{ + QSharedPointer mockToplevel = v.value>(); + return mockToplevel ? mockToplevel->handle() : nullptr; } +} diff --git a/tests/auto/wayland/shared/mockcompositor.h b/tests/auto/wayland/shared/mockcompositor.h index c0c3c884f34..48461e25301 100644 --- a/tests/auto/wayland/shared/mockcompositor.h +++ b/tests/auto/wayland/shared/mockcompositor.h @@ -29,6 +29,8 @@ #ifndef MOCKCOMPOSITOR_H #define MOCKCOMPOSITOR_H +#include "mockxdgshellv6.h" + #include #include #include @@ -70,6 +72,8 @@ public: QVector surfaces() const; QVector outputs() const; + XdgShellV6 *xdgShellV6() const; + void addSurface(Surface *surface); void removeSurface(Surface *surface); @@ -93,6 +97,7 @@ public: static void sendRemoveOutput(void *data, const QList ¶meters); static void sendOutputGeometry(void *data, const QList ¶meters); static void sendSurfaceEnter(void *data, const QList ¶meters); + static void sendXdgToplevelV6Configure(void *data, const QList ¶meters); static void sendSurfaceLeave(void *data, const QList ¶meters); public: @@ -102,6 +107,7 @@ private: static void bindCompositor(wl_client *client, void *data, uint32_t version, uint32_t id); static Surface *resolveSurface(const QVariant &v); static Output *resolveOutput(const QVariant &v); + static XdgToplevelV6 *resolveToplevel(const QVariant &v); void initShm(); @@ -146,6 +152,22 @@ private: Q_DECLARE_METATYPE(QSharedPointer) +class MockXdgToplevelV6 +{ +public: + Impl::XdgToplevelV6 *handle() const { return m_toplevel; } + + void sendConfigure(const QSharedPointer toplevel); +private: + MockXdgToplevelV6(Impl::XdgToplevelV6 *toplevel) : m_toplevel(toplevel) {} + friend class Impl::Compositor; + friend class Impl::XdgToplevelV6; + + Impl::XdgToplevelV6 *m_toplevel; +}; + +Q_DECLARE_METATYPE(QSharedPointer) + class MockOutput { public: Impl::Output *handle() const { return m_output; } @@ -187,10 +209,12 @@ public: void sendOutputGeometry(const QSharedPointer &output, const QRect &geometry); void sendSurfaceEnter(const QSharedPointer &surface, QSharedPointer &output); void sendSurfaceLeave(const QSharedPointer &surface, QSharedPointer &output); + void sendXdgToplevelV6Configure(const QSharedPointer toplevel, const QSize &size); void waitForStartDrag(); QSharedPointer surface(); QSharedPointer output(int index = 0); + QSharedPointer xdgToplevelV6(int index = 0); void lock(); void unlock(); diff --git a/tests/auto/wayland/shared/mockxdgshellv6.cpp b/tests/auto/wayland/shared/mockxdgshellv6.cpp index f909fa10847..5c83f2db385 100644 --- a/tests/auto/wayland/shared/mockxdgshellv6.cpp +++ b/tests/auto/wayland/shared/mockxdgshellv6.cpp @@ -28,47 +28,26 @@ #include "mockxdgshellv6.h" #include "mocksurface.h" +#include "mockcompositor.h" namespace Impl { -class XdgSurfaceV6; - -class XdgToplevelV6 : public QtWaylandServer::zxdg_toplevel_v6 +void Compositor::sendXdgToplevelV6Configure(void *data, const QList ¶meters) { -public: - XdgToplevelV6(XdgSurfaceV6 *xdgSurface, wl_client *client, uint32_t id, int version) - : QtWaylandServer::zxdg_toplevel_v6(client, id, version) - , m_xdgSurface(xdgSurface) - {} - void zxdg_toplevel_v6_destroy_resource(Resource *) override { delete this; } - void zxdg_toplevel_v6_destroy(Resource *resource) override; - XdgSurfaceV6 *m_xdgSurface = nullptr; -}; - -class XdgSurfaceV6 : public QtWaylandServer::zxdg_surface_v6 -{ -public: - XdgSurfaceV6(wl_client *client, uint32_t id, Surface *surface); - void zxdg_surface_v6_destroy_resource(Resource *) override { delete this; } - void zxdg_surface_v6_get_toplevel(Resource *resource, uint32_t id) override; - void zxdg_surface_v6_destroy(Resource *resource) override - { - Q_ASSERT(!m_toplevel); - wl_resource_destroy(resource->handle); - } - Surface *m_surface = nullptr; - XdgToplevelV6 *m_toplevel = nullptr; -}; - -void XdgToplevelV6::zxdg_toplevel_v6_destroy(QtWaylandServer::zxdg_toplevel_v6::Resource *resource) -{ - m_xdgSurface->m_toplevel = nullptr; - wl_resource_destroy(resource->handle); + Compositor *compositor = static_cast(data); + XdgToplevelV6 *toplevel = resolveToplevel(parameters.at(0)); + Q_ASSERT(toplevel && toplevel->resource()); + QSize size = parameters.at(1).toSize(); + Q_ASSERT(size.isValid()); + QByteArray states; + toplevel->send_configure(size.width(), size.height(), states); + toplevel->xdgSurface()->send_configure(compositor->nextSerial()); } -XdgSurfaceV6::XdgSurfaceV6(wl_client *client, uint32_t id, Surface *surface) +XdgSurfaceV6::XdgSurfaceV6(XdgShellV6 *shell, Surface *surface, wl_client *client, uint32_t id) : QtWaylandServer::zxdg_surface_v6(client, id, 1) , m_surface(surface) + , m_shell(shell) { } @@ -79,9 +58,35 @@ void XdgSurfaceV6::zxdg_surface_v6_get_toplevel(QtWaylandServer::zxdg_surface_v6 m_surface->map(); } +void XdgSurfaceV6::zxdg_surface_v6_destroy(QtWaylandServer::zxdg_surface_v6::Resource *resource) +{ + Q_ASSERT(!m_toplevel); + wl_resource_destroy(resource->handle); +} + +XdgToplevelV6::XdgToplevelV6(XdgSurfaceV6 *xdgSurface, wl_client *client, uint32_t id, int version) + : QtWaylandServer::zxdg_toplevel_v6(client, id, version) + , m_xdgSurface(xdgSurface) + , m_mockToplevel(new MockXdgToplevelV6(this)) +{ + m_xdgSurface->shell()->addToplevel(this); +} + +XdgToplevelV6::~XdgToplevelV6() +{ + m_xdgSurface->shell()->removeToplevel(this); + m_mockToplevel->m_toplevel = nullptr; +} + +void XdgToplevelV6::zxdg_toplevel_v6_destroy(QtWaylandServer::zxdg_toplevel_v6::Resource *resource) +{ + m_xdgSurface->m_toplevel = nullptr; + wl_resource_destroy(resource->handle); +} + void Impl::XdgShellV6::zxdg_shell_v6_get_xdg_surface(QtWaylandServer::zxdg_shell_v6::Resource *resource, uint32_t id, wl_resource *surface) { - new XdgSurfaceV6(resource->client(), id, Surface::fromResource(surface)); + new XdgSurfaceV6(this, Surface::fromResource(surface), resource->client(), id); } } // namespace Impl diff --git a/tests/auto/wayland/shared/mockxdgshellv6.h b/tests/auto/wayland/shared/mockxdgshellv6.h index d72606d24c1..f836ebd0780 100644 --- a/tests/auto/wayland/shared/mockxdgshellv6.h +++ b/tests/auto/wayland/shared/mockxdgshellv6.h @@ -28,16 +28,72 @@ #include +#include +#include + #ifndef MOCKXDGSHELLV6_H #define MOCKXDGSHELLV6_H +class MockXdgToplevelV6; + namespace Impl { +class XdgToplevelV6; +class XdgShellV6; +class Surface; + +class XdgSurfaceV6 : public QtWaylandServer::zxdg_surface_v6 +{ +public: + XdgSurfaceV6(XdgShellV6 *shell, Surface *surface, wl_client *client, uint32_t id); + XdgShellV6 *shell() const { return m_shell; } + +protected: + void zxdg_surface_v6_destroy_resource(Resource *) override { delete this; } + void zxdg_surface_v6_get_toplevel(Resource *resource, uint32_t id) override; + void zxdg_surface_v6_destroy(Resource *resource) override; + +private: + Surface *m_surface = nullptr; + XdgToplevelV6 *m_toplevel = nullptr; + XdgShellV6 *m_shell = nullptr; + + friend class XdgToplevelV6; +}; + +class XdgToplevelV6 : public QtWaylandServer::zxdg_toplevel_v6 +{ +public: + XdgToplevelV6(XdgSurfaceV6 *xdgSurface, wl_client *client, uint32_t id, int version); + ~XdgToplevelV6() override; + XdgSurfaceV6 *xdgSurface() const { return m_xdgSurface; } + + QSharedPointer mockToplevel() const { return m_mockToplevel; } + +protected: + void zxdg_toplevel_v6_destroy_resource(Resource *) override { delete this; } + void zxdg_toplevel_v6_destroy(Resource *resource) override; + +private: + XdgSurfaceV6 *m_xdgSurface = nullptr; + QSharedPointer m_mockToplevel; +}; + class XdgShellV6 : public QtWaylandServer::zxdg_shell_v6 { public: explicit XdgShellV6(::wl_display *display) : zxdg_shell_v6(display, 1) {} + QVector toplevels() const { return m_toplevels; } + +protected: void zxdg_shell_v6_get_xdg_surface(Resource *resource, uint32_t id, ::wl_resource *surface) override; + +private: + void addToplevel(XdgToplevelV6 *toplevel) { m_toplevels.append(toplevel); } + void removeToplevel(XdgToplevelV6 *toplevel) { m_toplevels.removeOne(toplevel); } + QVector m_toplevels; + + friend class XdgToplevelV6; }; } // namespace Impl diff --git a/tests/auto/wayland/xdgshellv6/tst_xdgshellv6.cpp b/tests/auto/wayland/xdgshellv6/tst_xdgshellv6.cpp index 9e4aa8c07a1..364cd1099f7 100644 --- a/tests/auto/wayland/xdgshellv6/tst_xdgshellv6.cpp +++ b/tests/auto/wayland/xdgshellv6/tst_xdgshellv6.cpp @@ -76,10 +76,12 @@ public slots: // make sure the surfaces from the last test are properly cleaned up // and don't show up as false positives in the next test QTRY_VERIFY(!m_compositor->surface()); + QTRY_VERIFY(!m_compositor->xdgToplevelV6()); } private slots: void createDestroyWindow(); + void configure(); private: MockCompositor *m_compositor = nullptr; @@ -96,6 +98,32 @@ void tst_WaylandClientXdgShellV6::createDestroyWindow() QTRY_VERIFY(!m_compositor->surface()); } +void tst_WaylandClientXdgShellV6::configure() +{ + QSharedPointer output; + QTRY_VERIFY(output = m_compositor->output()); + + TestWindow window; + window.show(); + + QSharedPointer surface; + QTRY_VERIFY(surface = m_compositor->surface()); + + m_compositor->processWaylandEvents(); + QTRY_VERIFY(window.isVisible()); + QTRY_VERIFY(!window.isExposed()); //Window should not be exposed before the first configure event + + //TODO: according to xdg-shell protocol, a buffer should not be attached to a the surface + //until it's configured. Ensure this in the test! + + QSharedPointer toplevel; + QTRY_VERIFY(toplevel = m_compositor->xdgToplevelV6()); + const QSize newSize(123, 456); + m_compositor->sendXdgToplevelV6Configure(toplevel, newSize); + QTRY_VERIFY(window.isExposed()); + QTRY_COMPARE(window.frameGeometry(), QRect(QPoint(), newSize)); +} + int main(int argc, char **argv) { setenv("XDG_RUNTIME_DIR", ".", 1); From 45dbab401aa712cd5c2a49da03d15aafd78d6ae7 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Mon, 26 Feb 2018 16:52:18 +0100 Subject: [PATCH 0508/1507] Send configure events in shell-agnostic client tests xdg-shell >= unstable v6 requires surfaces to be configured before buffers can be attached. Make sure to send a configure event when a compositor would normally do it. Task-number: QTBUG-66510 Change-Id: Icbff6ebaa597e858d92d621849aa0df7a8a976f3 Reviewed-by: Andy Nichols --- tests/auto/wayland/client/tst_client.cpp | 11 +++++++++++ tests/auto/wayland/shared/mockcompositor.cpp | 8 ++++++++ tests/auto/wayland/shared/mockcompositor.h | 6 ++++-- tests/auto/wayland/shared/mocksurface.cpp | 20 ++++++++++++++++++++ tests/auto/wayland/shared/mocksurface.h | 10 ++++++++++ tests/auto/wayland/shared/mockwlshell.cpp | 14 +++++++------- tests/auto/wayland/shared/mockwlshell.h | 13 +++++++++++++ tests/auto/wayland/shared/mockxdgshellv6.cpp | 5 ++++- tests/auto/wayland/shared/mockxdgshellv6.h | 1 + 9 files changed, 78 insertions(+), 10 deletions(-) diff --git a/tests/auto/wayland/client/tst_client.cpp b/tests/auto/wayland/client/tst_client.cpp index 02c5bab3ef1..1e3d0f1d14d 100644 --- a/tests/auto/wayland/client/tst_client.cpp +++ b/tests/auto/wayland/client/tst_client.cpp @@ -226,6 +226,8 @@ void tst_WaylandClient::windowScreens() QSharedPointer surface; QTRY_VERIFY(surface = compositor->surface()); + compositor->sendShellSurfaceConfigure(surface); + QTRY_COMPARE(QGuiApplication::screens().size(), 1); QScreen *primaryScreen = QGuiApplication::screens().first(); QCOMPARE(window.screen(), primaryScreen); @@ -267,6 +269,7 @@ void tst_WaylandClient::removePrimaryScreen() QSharedPointer surface; QTRY_VERIFY(surface = compositor->surface()); + compositor->sendShellSurfaceConfigure(surface); QTRY_COMPARE(QGuiApplication::screens().size(), 1); QScreen *primaryScreen = QGuiApplication::screens().first(); QCOMPARE(window.screen(), primaryScreen); @@ -308,6 +311,9 @@ void tst_WaylandClient::events() QSharedPointer surface; QTRY_VERIFY(surface = compositor->surface()); + compositor->sendShellSurfaceConfigure(surface); + + QTRY_VERIFY(window.isExposed()); QCOMPARE(window.focusInEventCount, 0); compositor->setKeyboardFocus(surface); @@ -363,6 +369,7 @@ void tst_WaylandClient::backingStore() QSharedPointer surface; QTRY_VERIFY(surface = compositor->surface()); + compositor->sendShellSurfaceConfigure(surface); QRect rect(QPoint(), window.size()); @@ -435,6 +442,7 @@ void tst_WaylandClient::touchDrag() QSharedPointer surface; QTRY_VERIFY(surface = compositor->surface()); + compositor->sendShellSurfaceConfigure(surface); compositor->setKeyboardFocus(surface); QTRY_COMPARE(QGuiApplication::focusWindow(), &window); @@ -460,6 +468,7 @@ void tst_WaylandClient::mouseDrag() QSharedPointer surface; QTRY_VERIFY(surface = compositor->surface()); + compositor->sendShellSurfaceConfigure(surface); compositor->setKeyboardFocus(surface); QTRY_COMPARE(QGuiApplication::focusWindow(), &window); @@ -528,6 +537,7 @@ void tst_WaylandClient::hiddenPopupParent() // with the set_popup request. QSharedPointer surface; QTRY_VERIFY(surface = compositor->surface()); + compositor->sendShellSurfaceConfigure(surface); QPoint mousePressPos(16, 16); QCOMPARE(toplevel.mousePressEventCount, 0); compositor->sendMousePress(surface, toplevel.frameOffset() + mousePressPos); @@ -552,6 +562,7 @@ void tst_WaylandClient::glWindow() testWindow->show(); QSharedPointer surface; QTRY_VERIFY(surface = compositor->surface()); + compositor->sendShellSurfaceConfigure(surface); QTRY_VERIFY(testWindow->paintGLCalled); diff --git a/tests/auto/wayland/shared/mockcompositor.cpp b/tests/auto/wayland/shared/mockcompositor.cpp index c11d952a74b..51a9546171c 100644 --- a/tests/auto/wayland/shared/mockcompositor.cpp +++ b/tests/auto/wayland/shared/mockcompositor.cpp @@ -219,6 +219,14 @@ void MockCompositor::sendSurfaceLeave(const QSharedPointer &surface processCommand(command); } +void MockCompositor::sendShellSurfaceConfigure(const QSharedPointer surface, const QSize &size) +{ + Command command = makeCommand(Impl::Compositor::sendShellSurfaceConfigure, m_compositor); + command.parameters << QVariant::fromValue(surface); + command.parameters << QVariant::fromValue(size); + processCommand(command); +} + void MockCompositor::sendXdgToplevelV6Configure(const QSharedPointer toplevel, const QSize &size) { Command command = makeCommand(Impl::Compositor::sendXdgToplevelV6Configure, m_compositor); diff --git a/tests/auto/wayland/shared/mockcompositor.h b/tests/auto/wayland/shared/mockcompositor.h index 48461e25301..5fe51c8966f 100644 --- a/tests/auto/wayland/shared/mockcompositor.h +++ b/tests/auto/wayland/shared/mockcompositor.h @@ -97,8 +97,9 @@ public: static void sendRemoveOutput(void *data, const QList ¶meters); static void sendOutputGeometry(void *data, const QList ¶meters); static void sendSurfaceEnter(void *data, const QList ¶meters); - static void sendXdgToplevelV6Configure(void *data, const QList ¶meters); static void sendSurfaceLeave(void *data, const QList ¶meters); + static void sendShellSurfaceConfigure(void *data, const QList ¶meters); + static void sendXdgToplevelV6Configure(void *data, const QList ¶meters); public: bool m_startDragSeen = false; @@ -209,7 +210,8 @@ public: void sendOutputGeometry(const QSharedPointer &output, const QRect &geometry); void sendSurfaceEnter(const QSharedPointer &surface, QSharedPointer &output); void sendSurfaceLeave(const QSharedPointer &surface, QSharedPointer &output); - void sendXdgToplevelV6Configure(const QSharedPointer toplevel, const QSize &size); + void sendShellSurfaceConfigure(const QSharedPointer surface, const QSize &size = QSize(0, 0)); + void sendXdgToplevelV6Configure(const QSharedPointer toplevel, const QSize &size = QSize(0, 0)); void waitForStartDrag(); QSharedPointer surface(); diff --git a/tests/auto/wayland/shared/mocksurface.cpp b/tests/auto/wayland/shared/mocksurface.cpp index 98a9615a624..4139d64fe9f 100644 --- a/tests/auto/wayland/shared/mocksurface.cpp +++ b/tests/auto/wayland/shared/mocksurface.cpp @@ -29,6 +29,9 @@ #include "mocksurface.h" #include "mockoutput.h" #include "mockcompositor.h" +#include "mockwlshell.h" + +#include namespace Impl { @@ -60,6 +63,23 @@ void Compositor::sendSurfaceLeave(void *data, const QList ¶meters) surface->send_leave(outputResource->handle); } +void Compositor::sendShellSurfaceConfigure(void *data, const QList ¶meters) +{ + Compositor *compositor = static_cast(data); + Surface *surface = resolveSurface(parameters.at(0)); + QSize size = parameters.at(1).toSize(); + Q_ASSERT(size.isValid()); + if (auto toplevel = surface->xdgToplevelV6()) { + toplevel->send_configure(size.width(), size.height(), QByteArray()); + toplevel->xdgSurface()->send_configure(compositor->nextSerial()); + } else if (auto wlShellSurface = surface->wlShellSurface()) { + const uint edges = 0; + wlShellSurface->send_configure(edges, size.width(), size.height()); + } else { + qWarning() << "The mocking framework doesn't know how to send a configure event for this surface"; + } +} + Surface::Surface(wl_client *client, uint32_t id, int v, Compositor *compositor) : QtWaylandServer::wl_surface(client, id, v) , m_compositor(compositor) diff --git a/tests/auto/wayland/shared/mocksurface.h b/tests/auto/wayland/shared/mocksurface.h index 68fe9b94ce4..3b0f01fdb9e 100644 --- a/tests/auto/wayland/shared/mocksurface.h +++ b/tests/auto/wayland/shared/mocksurface.h @@ -37,6 +37,9 @@ namespace Impl { +class XdgToplevelV6; +class WlShellSurface; + class Surface : public QtWaylandServer::wl_surface { public: @@ -47,6 +50,8 @@ public: static Surface *fromResource(struct ::wl_resource *resource); void map(); bool isMapped() const; + XdgToplevelV6 *xdgToplevelV6() const { return m_xdgToplevelV6; } + WlShellSurface *wlShellSurface() const { return m_wlShellSurface; } QSharedPointer mockSurface() const { return m_mockSurface; } @@ -64,11 +69,16 @@ protected: void surface_commit(Resource *resource) override; private: wl_resource *m_buffer = nullptr; + XdgToplevelV6 *m_xdgToplevelV6 = nullptr; + WlShellSurface *m_wlShellSurface = nullptr; Compositor *m_compositor = nullptr; QSharedPointer m_mockSurface; QList m_frameCallbackList; bool m_mapped = false; + + friend class XdgToplevelV6; + friend class WlShellSurface; }; } diff --git a/tests/auto/wayland/shared/mockwlshell.cpp b/tests/auto/wayland/shared/mockwlshell.cpp index b7700713f13..50e539932f8 100644 --- a/tests/auto/wayland/shared/mockwlshell.cpp +++ b/tests/auto/wayland/shared/mockwlshell.cpp @@ -31,19 +31,19 @@ namespace Impl { -class WlShellSurface : public QtWaylandServer::wl_shell_surface -{ -public: - explicit WlShellSurface(::wl_client *client, int id, Surface *surface); - void shell_surface_destroy_resource(Resource *) override { delete this; } -}; - WlShellSurface::WlShellSurface(wl_client *client, int id, Surface *surface) : QtWaylandServer::wl_shell_surface(client, id, 1) + , m_surface(surface) { + surface->m_wlShellSurface = this; surface->map(); } +WlShellSurface::~WlShellSurface() +{ + m_surface->m_wlShellSurface = nullptr; +} + void WlShell::shell_get_shell_surface(QtWaylandServer::wl_shell::Resource *resource, uint32_t id, wl_resource *surface) { new WlShellSurface(resource->client(), id, Surface::fromResource(surface)); diff --git a/tests/auto/wayland/shared/mockwlshell.h b/tests/auto/wayland/shared/mockwlshell.h index c6000c7b242..3da586ca88f 100644 --- a/tests/auto/wayland/shared/mockwlshell.h +++ b/tests/auto/wayland/shared/mockwlshell.h @@ -33,6 +33,19 @@ namespace Impl { +class Surface; + +class WlShellSurface : public QtWaylandServer::wl_shell_surface +{ +public: + explicit WlShellSurface(::wl_client *client, int id, Surface *surface); + ~WlShellSurface() override; + void shell_surface_destroy_resource(Resource *) override { delete this; } + +private: + Surface *m_surface = nullptr; +}; + class WlShell : public QtWaylandServer::wl_shell { public: diff --git a/tests/auto/wayland/shared/mockxdgshellv6.cpp b/tests/auto/wayland/shared/mockxdgshellv6.cpp index 5c83f2db385..39e03296d48 100644 --- a/tests/auto/wayland/shared/mockxdgshellv6.cpp +++ b/tests/auto/wayland/shared/mockxdgshellv6.cpp @@ -55,7 +55,6 @@ void XdgSurfaceV6::zxdg_surface_v6_get_toplevel(QtWaylandServer::zxdg_surface_v6 { int version = wl_resource_get_version(resource->handle); m_toplevel = new XdgToplevelV6(this, resource->client(), id, version); - m_surface->map(); } void XdgSurfaceV6::zxdg_surface_v6_destroy(QtWaylandServer::zxdg_surface_v6::Resource *resource) @@ -69,12 +68,16 @@ XdgToplevelV6::XdgToplevelV6(XdgSurfaceV6 *xdgSurface, wl_client *client, uint32 , m_xdgSurface(xdgSurface) , m_mockToplevel(new MockXdgToplevelV6(this)) { + auto *surface = m_xdgSurface->surface(); + surface->m_xdgToplevelV6 = this; m_xdgSurface->shell()->addToplevel(this); + surface->map(); } XdgToplevelV6::~XdgToplevelV6() { m_xdgSurface->shell()->removeToplevel(this); + m_xdgSurface->surface()->m_xdgToplevelV6 = nullptr; m_mockToplevel->m_toplevel = nullptr; } diff --git a/tests/auto/wayland/shared/mockxdgshellv6.h b/tests/auto/wayland/shared/mockxdgshellv6.h index f836ebd0780..92b808ba82a 100644 --- a/tests/auto/wayland/shared/mockxdgshellv6.h +++ b/tests/auto/wayland/shared/mockxdgshellv6.h @@ -47,6 +47,7 @@ class XdgSurfaceV6 : public QtWaylandServer::zxdg_surface_v6 public: XdgSurfaceV6(XdgShellV6 *shell, Surface *surface, wl_client *client, uint32_t id); XdgShellV6 *shell() const { return m_shell; } + Surface *surface() const { return m_surface; } protected: void zxdg_surface_v6_destroy_resource(Resource *) override { delete this; } From 08d813607115946da8e79135667926a3da9e3241 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Thu, 8 Mar 2018 12:32:59 +0100 Subject: [PATCH 0509/1507] Add client-side tests for ivi-application Tests ivi surface creation and configuration. Task-number: QTBUG-66512 Change-Id: Idff60eb99eb34b7fce1c935bd036ef18a8f97d7c Reviewed-by: Andy Nichols --- tests/auto/wayland/client.pro | 1 + .../wayland/iviapplication/iviapplication.pro | 5 ++ tests/auto/wayland/shared/mockcompositor.cpp | 31 +++++++ tests/auto/wayland/shared/mockcompositor.h | 24 ++++++ .../wayland/shared/mockiviapplication.cpp | 72 ++++++++++++++++ .../auto/wayland/shared/mockiviapplication.h | 85 +++++++++++++++++++ tests/auto/wayland/shared/shared.pri | 3 + 7 files changed, 221 insertions(+) create mode 100644 tests/auto/wayland/iviapplication/iviapplication.pro create mode 100644 tests/auto/wayland/shared/mockiviapplication.cpp create mode 100644 tests/auto/wayland/shared/mockiviapplication.h diff --git a/tests/auto/wayland/client.pro b/tests/auto/wayland/client.pro index a668d37d5f8..9fd8fc3f9f2 100644 --- a/tests/auto/wayland/client.pro +++ b/tests/auto/wayland/client.pro @@ -2,5 +2,6 @@ TEMPLATE=subdirs SUBDIRS += \ client \ + iviapplication \ xdgshellv6 \ wl_connect diff --git a/tests/auto/wayland/iviapplication/iviapplication.pro b/tests/auto/wayland/iviapplication/iviapplication.pro new file mode 100644 index 00000000000..32692137347 --- /dev/null +++ b/tests/auto/wayland/iviapplication/iviapplication.pro @@ -0,0 +1,5 @@ +include (../shared/shared.pri) + +TARGET = tst_client_iviapplication +SOURCES += tst_iviapplication.cpp + diff --git a/tests/auto/wayland/shared/mockcompositor.cpp b/tests/auto/wayland/shared/mockcompositor.cpp index 51a9546171c..9ef08ad953e 100644 --- a/tests/auto/wayland/shared/mockcompositor.cpp +++ b/tests/auto/wayland/shared/mockcompositor.cpp @@ -32,6 +32,7 @@ #include "mocksurface.h" #include "mockwlshell.h" #include "mockxdgshellv6.h" +#include "mockiviapplication.h" #include @@ -227,6 +228,14 @@ void MockCompositor::sendShellSurfaceConfigure(const QSharedPointer processCommand(command); } +void MockCompositor::sendIviSurfaceConfigure(const QSharedPointer iviSurface, const QSize &size) +{ + Command command = makeCommand(Impl::Compositor::sendIviSurfaceConfigure, m_compositor); + command.parameters << QVariant::fromValue(iviSurface); + command.parameters << QVariant::fromValue(size); + processCommand(command); +} + void MockCompositor::sendXdgToplevelV6Configure(const QSharedPointer toplevel, const QSize &size) { Command command = makeCommand(Impl::Compositor::sendXdgToplevelV6Configure, m_compositor); @@ -267,6 +276,16 @@ QSharedPointer MockCompositor::output(int index) return result; } +QSharedPointer MockCompositor::iviSurface(int index) +{ + QSharedPointer result; + lock(); + if (Impl::IviSurface *toplevel = m_compositor->iviApplication()->iviSurfaces().value(index, nullptr)) + result = toplevel->mockIviSurface(); + unlock(); + return result; +} + QSharedPointer MockCompositor::xdgToplevelV6(int index) { QSharedPointer result; @@ -357,6 +376,7 @@ Compositor::Compositor() m_touch = m_seat->touch(); m_outputs.append(new Output(m_display, QSize(1920, 1080), QPoint(0, 0))); + m_iviApplication.reset(new IviApplication(m_display)); m_wlShell.reset(new WlShell(m_display)); m_xdgShellV6.reset(new XdgShellV6(m_display)); @@ -426,6 +446,11 @@ QVector Compositor::outputs() const return m_outputs; } +IviApplication *Compositor::iviApplication() const +{ + return m_iviApplication.data(); +} + XdgShellV6 *Compositor::xdgShellV6() const { return m_xdgShellV6.data(); @@ -460,6 +485,12 @@ Output *Compositor::resolveOutput(const QVariant &v) return mockOutput ? mockOutput->handle() : nullptr; } +IviSurface *Compositor::resolveIviSurface(const QVariant &v) +{ + QSharedPointer mockIviSurface = v.value>(); + return mockIviSurface ? mockIviSurface->handle() : nullptr; +} + XdgToplevelV6 *Compositor::resolveToplevel(const QVariant &v) { QSharedPointer mockToplevel = v.value>(); diff --git a/tests/auto/wayland/shared/mockcompositor.h b/tests/auto/wayland/shared/mockcompositor.h index 5fe51c8966f..34c20943a46 100644 --- a/tests/auto/wayland/shared/mockcompositor.h +++ b/tests/auto/wayland/shared/mockcompositor.h @@ -30,6 +30,7 @@ #define MOCKCOMPOSITOR_H #include "mockxdgshellv6.h" +#include "mockiviapplication.h" #include #include @@ -54,6 +55,7 @@ class Seat; class DataDeviceManager; class Surface; class Output; +class IviApplication; class WlShell; class XdgShellV6; @@ -72,6 +74,7 @@ public: QVector surfaces() const; QVector outputs() const; + IviApplication *iviApplication() const; XdgShellV6 *xdgShellV6() const; void addSurface(Surface *surface); @@ -99,6 +102,7 @@ public: static void sendSurfaceEnter(void *data, const QList ¶meters); static void sendSurfaceLeave(void *data, const QList ¶meters); static void sendShellSurfaceConfigure(void *data, const QList ¶meters); + static void sendIviSurfaceConfigure(void *data, const QList ¶meters); static void sendXdgToplevelV6Configure(void *data, const QList ¶meters); public: @@ -108,6 +112,7 @@ private: static void bindCompositor(wl_client *client, void *data, uint32_t version, uint32_t id); static Surface *resolveSurface(const QVariant &v); static Output *resolveOutput(const QVariant &v); + static IviSurface *resolveIviSurface(const QVariant &v); static XdgToplevelV6 *resolveToplevel(const QVariant &v); void initShm(); @@ -128,6 +133,7 @@ private: QScopedPointer m_data_device_manager; QVector m_surfaces; QVector m_outputs; + QScopedPointer m_iviApplication; QScopedPointer m_wlShell; QScopedPointer m_xdgShellV6; }; @@ -153,6 +159,22 @@ private: Q_DECLARE_METATYPE(QSharedPointer) +class MockIviSurface +{ +public: + Impl::IviSurface *handle() const { return m_iviSurface; } + const uint iviId; + +private: + MockIviSurface(Impl::IviSurface *iviSurface) : iviId(iviSurface->iviId()), m_iviSurface(iviSurface) {} + friend class Impl::Compositor; + friend class Impl::IviSurface; + + Impl::IviSurface *m_iviSurface; +}; + +Q_DECLARE_METATYPE(QSharedPointer) + class MockXdgToplevelV6 { public: @@ -211,11 +233,13 @@ public: void sendSurfaceEnter(const QSharedPointer &surface, QSharedPointer &output); void sendSurfaceLeave(const QSharedPointer &surface, QSharedPointer &output); void sendShellSurfaceConfigure(const QSharedPointer surface, const QSize &size = QSize(0, 0)); + void sendIviSurfaceConfigure(const QSharedPointer iviSurface, const QSize &size); void sendXdgToplevelV6Configure(const QSharedPointer toplevel, const QSize &size = QSize(0, 0)); void waitForStartDrag(); QSharedPointer surface(); QSharedPointer output(int index = 0); + QSharedPointer iviSurface(int index = 0); QSharedPointer xdgToplevelV6(int index = 0); void lock(); diff --git a/tests/auto/wayland/shared/mockiviapplication.cpp b/tests/auto/wayland/shared/mockiviapplication.cpp new file mode 100644 index 00000000000..29a3089931e --- /dev/null +++ b/tests/auto/wayland/shared/mockiviapplication.cpp @@ -0,0 +1,72 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "mockiviapplication.h" +#include "mocksurface.h" +#include "mockcompositor.h" + +namespace Impl { + +void Compositor::sendIviSurfaceConfigure(void *data, const QList ¶meters) +{ + Q_UNUSED(data); + IviSurface *iviSurface = resolveIviSurface(parameters.at(0)); + Q_ASSERT(iviSurface && iviSurface->resource()); + QSize size = parameters.at(1).toSize(); + Q_ASSERT(!size.isEmpty()); + iviSurface->send_configure(size.width(), size.height()); +} + +IviSurface::IviSurface(IviApplication *iviApplication, Surface *surface, uint iviId, wl_client *client, uint32_t id) + : QtWaylandServer::ivi_surface(client, id, 1) + , m_surface(surface) + , m_iviApplication(iviApplication) + , m_iviId(iviId) + , m_mockIviSurface(new MockIviSurface(this)) +{ + iviApplication->addIviSurface(this); + surface->map(); +} + +IviSurface::~IviSurface() +{ + m_iviApplication->removeIviSurface(this); + m_mockIviSurface->m_iviSurface = nullptr; +} + +void IviSurface::ivi_surface_destroy(Resource *resource) +{ + wl_resource_destroy(resource->handle); +} + +void IviApplication::ivi_application_surface_create(Resource *resource, uint32_t ivi_id, ::wl_resource *surface, uint32_t id) +{ + new IviSurface(this, Surface::fromResource(surface), ivi_id, resource->client(), id); +} + +} // namespace Impl diff --git a/tests/auto/wayland/shared/mockiviapplication.h b/tests/auto/wayland/shared/mockiviapplication.h new file mode 100644 index 00000000000..4d65eeabaed --- /dev/null +++ b/tests/auto/wayland/shared/mockiviapplication.h @@ -0,0 +1,85 @@ +/**************************************************************************** +** +** Copyright (C) 2018 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef MOCKIVIAPPLICATION_H +#define MOCKIVIAPPLICATION_H + +#include + +#include +#include + +class MockIviSurface; + +namespace Impl { + +class Surface; +class IviApplication; + +class IviSurface : public QtWaylandServer::ivi_surface +{ +public: + IviSurface(IviApplication *iviApplication, Surface *surface, uint iviId, wl_client *client, uint32_t id); + ~IviSurface() override; + IviApplication *iviApplication() const { return m_iviApplication; } + Surface *surface() const { return m_surface; } + uint iviId() const { return m_iviId; } + + QSharedPointer mockIviSurface() const { return m_mockIviSurface; } + +protected: + void ivi_surface_destroy_resource(Resource *) override { delete this; } + void ivi_surface_destroy(Resource *resource) override; + +private: + Surface *m_surface = nullptr; + IviApplication *m_iviApplication = nullptr; + const uint m_iviId = 0; + QSharedPointer m_mockIviSurface; +}; + +class IviApplication : public QtWaylandServer::ivi_application +{ +public: + explicit IviApplication(::wl_display *display) : ivi_application(display, 1) {} + QVector iviSurfaces() const { return m_iviSurfaces; } + +protected: + void ivi_application_surface_create(Resource *resource, uint32_t ivi_id, ::wl_resource *surface, uint32_t id) override; + +private: + void addIviSurface(IviSurface *iviSurface) { m_iviSurfaces.append(iviSurface); } + void removeIviSurface(IviSurface *iviSurface) { m_iviSurfaces.removeOne(iviSurface); } + QVector m_iviSurfaces; + + friend class IviSurface; +}; + +} // namespace Impl + +#endif // MOCKIVIAPPLICATION_H diff --git a/tests/auto/wayland/shared/shared.pri b/tests/auto/wayland/shared/shared.pri index 991dd29d166..f3cb4d5a233 100644 --- a/tests/auto/wayland/shared/shared.pri +++ b/tests/auto/wayland/shared/shared.pri @@ -6,6 +6,7 @@ QMAKE_USE += wayland-client wayland-server CONFIG += wayland-scanner WAYLANDSERVERSOURCES += \ + ../../../../src/3rdparty/protocol/ivi-application.xml \ ../../../../src/3rdparty/protocol/wayland.xml \ ../../../../src/3rdparty/protocol/xdg-shell-unstable-v6.xml @@ -14,6 +15,7 @@ INCLUDEPATH += ../shared SOURCES += \ ../shared/mockcompositor.cpp \ ../shared/mockinput.cpp \ + ../shared/mockiviapplication.cpp \ ../shared/mockwlshell.cpp \ ../shared/mockxdgshellv6.cpp \ ../shared/mocksurface.cpp \ @@ -22,6 +24,7 @@ SOURCES += \ HEADERS += \ ../shared/mockcompositor.h \ ../shared/mockinput.h \ + ../shared/mockiviapplication.h \ ../shared/mockwlshell.h \ ../shared/mockxdgshellv6.h \ ../shared/mocksurface.h \ From e6c84abc5574c82018d693ba95dba6025cb0b30f Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Fri, 9 Mar 2018 14:40:52 +0100 Subject: [PATCH 0510/1507] Mocking compositor: Don't leak wl_shell_surfaces Change-Id: Ic133b41bdcfb98418be4a0141f382734f1d5db85 Reviewed-by: Andy Nichols --- tests/auto/wayland/shared/mocksurface.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/auto/wayland/shared/mocksurface.cpp b/tests/auto/wayland/shared/mocksurface.cpp index 4139d64fe9f..81a865f1194 100644 --- a/tests/auto/wayland/shared/mocksurface.cpp +++ b/tests/auto/wayland/shared/mocksurface.cpp @@ -115,6 +115,10 @@ void Surface::surface_destroy_resource(Resource *) void Surface::surface_destroy(Resource *resource) { + if (m_wlShellSurface) // on wl-shell the shell surface is automatically destroyed with the surface + wl_resource_destroy(m_wlShellSurface->resource()->handle); + Q_ASSERT(!m_wlShellSurface); + Q_ASSERT(!m_xdgToplevelV6); wl_resource_destroy(resource->handle); } From bfb8f070655990eee71736e44d0f24cb0ec4f146 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Mon, 12 Mar 2018 14:00:35 +0100 Subject: [PATCH 0511/1507] Run shell agnostic tests on all shells And not just the default one. Change-Id: I6debbda9ae249f5f9df914901dc60722253b7d09 Reviewed-by: Pier Luigi Fiorini --- tests/auto/wayland/client/client.pro | 2 ++ tests/auto/wayland/client/run-with-all-shells.sh | 6 ++++++ 2 files changed, 8 insertions(+) create mode 100755 tests/auto/wayland/client/run-with-all-shells.sh diff --git a/tests/auto/wayland/client/client.pro b/tests/auto/wayland/client/client.pro index edf80bb9b90..f4ced252c2a 100644 --- a/tests/auto/wayland/client/client.pro +++ b/tests/auto/wayland/client/client.pro @@ -2,3 +2,5 @@ include (../shared/shared.pri) TARGET = tst_client SOURCES += tst_client.cpp + +check.commands = $(TESTRUNNER) $${PWD}/run-with-all-shells.sh $(TESTARGS) diff --git a/tests/auto/wayland/client/run-with-all-shells.sh b/tests/auto/wayland/client/run-with-all-shells.sh new file mode 100755 index 00000000000..41f383900ea --- /dev/null +++ b/tests/auto/wayland/client/run-with-all-shells.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env bash +set -ex +$@ +env QT_WAYLAND_SHELL_INTEGRATION=wl-shell $@ +env QT_WAYLAND_SHELL_INTEGRATION=ivi-shell $@ +env QT_WAYLAND_SHELL_INTEGRATION=xdg-shell-v6 $@ From 2804d35cb43eb60496a27df1c92d31f3a8ae5613 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Mon, 19 Mar 2018 10:21:47 +0100 Subject: [PATCH 0512/1507] xdg-shell v5,v6 shell integrations: Fix crash when showing popups If a popup was shown without any input events happening first, it would cause nullptr dereferences in both xdg-shell v5 and v6. Fixes crashes in: - tst_QAccessibility::comboBoxTest - tst_QAccessibility::menuTest - tst_QWindow::touchInterruptedByPopup - tst_QFocusEvent::checkReason_Popup Task-number: QTBUG-67150 Change-Id: Ib3e06326f71e4ab5f74727cb4f79626a21c34d55 Reviewed-by: Paul Olav Tvete --- src/plugins/platforms/wayland/qwaylandxdgshell.cpp | 3 +-- src/plugins/platforms/wayland/qwaylandxdgshell_p.h | 2 +- .../platforms/wayland/qwaylandxdgshellintegration.cpp | 5 +++-- src/plugins/platforms/wayland/qwaylandxdgshellv6.cpp | 5 +++-- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandxdgshell.cpp b/src/plugins/platforms/wayland/qwaylandxdgshell.cpp index 8b252b95323..9a34e72dd1c 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgshell.cpp +++ b/src/plugins/platforms/wayland/qwaylandxdgshell.cpp @@ -73,12 +73,11 @@ QWaylandXdgSurface *QWaylandXdgShell::createXdgSurface(QWaylandWindow *window) return new QWaylandXdgSurface(this, window); } -QWaylandXdgPopup *QWaylandXdgShell::createXdgPopup(QWaylandWindow *window) +QWaylandXdgPopup *QWaylandXdgShell::createXdgPopup(QWaylandWindow *window, QWaylandInputDevice *inputDevice) { QWaylandWindow *parentWindow = m_popups.empty() ? window->transientParent() : m_popups.last(); ::wl_surface *parentSurface = parentWindow->object(); - QWaylandInputDevice *inputDevice = window->display()->lastInputDevice(); if (m_popupSerial == 0) m_popupSerial = inputDevice->serial(); ::wl_seat *seat = inputDevice->wl_seat(); diff --git a/src/plugins/platforms/wayland/qwaylandxdgshell_p.h b/src/plugins/platforms/wayland/qwaylandxdgshell_p.h index afbd9c591df..761f25218f6 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgshell_p.h +++ b/src/plugins/platforms/wayland/qwaylandxdgshell_p.h @@ -79,7 +79,7 @@ public: ~QWaylandXdgShell() override; QWaylandXdgSurface *createXdgSurface(QWaylandWindow *window); - QWaylandXdgPopup *createXdgPopup(QWaylandWindow *window); + QWaylandXdgPopup *createXdgPopup(QWaylandWindow *window, QWaylandInputDevice *inputDevice); private: void xdg_shell_ping(uint32_t serial) override; diff --git a/src/plugins/platforms/wayland/qwaylandxdgshellintegration.cpp b/src/plugins/platforms/wayland/qwaylandxdgshellintegration.cpp index 5fa4385d65b..ee72c2d5212 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgshellintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandxdgshellintegration.cpp @@ -74,8 +74,9 @@ bool QWaylandXdgShellIntegration::initialize(QWaylandDisplay *display) QWaylandShellSurface *QWaylandXdgShellIntegration::createShellSurface(QWaylandWindow *window) { - if (window->window()->type() == Qt::WindowType::Popup) - return m_xdgShell->createXdgPopup(window); + QWaylandInputDevice *inputDevice = window->display()->lastInputDevice(); + if (window->window()->type() == Qt::WindowType::Popup && inputDevice) + return m_xdgShell->createXdgPopup(window, inputDevice); else return m_xdgShell->createXdgSurface(window); } diff --git a/src/plugins/platforms/wayland/qwaylandxdgshellv6.cpp b/src/plugins/platforms/wayland/qwaylandxdgshellv6.cpp index c89c8316f7e..a166a3bc930 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgshellv6.cpp +++ b/src/plugins/platforms/wayland/qwaylandxdgshellv6.cpp @@ -165,8 +165,9 @@ void QWaylandXdgSurfaceV6::setAppId(const QString &appId) void QWaylandXdgSurfaceV6::setType(Qt::WindowType type, QWaylandWindow *transientParent) { - if ((type == Qt::Popup || type == Qt::ToolTip) && transientParent) { - setPopup(transientParent, m_window->display()->lastInputDevice(), m_window->display()->lastInputSerial(), type == Qt::Popup); + QWaylandDisplay *display = m_window->display(); + if ((type == Qt::Popup || type == Qt::ToolTip) && transientParent && display->lastInputDevice()) { + setPopup(transientParent, display->lastInputDevice(), display->lastInputSerial(), type == Qt::Popup); } else { setToplevel(); if (transientParent) { From 91e81af14cb0f6145b840db8dbb0c906f64f498b Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Wed, 28 Feb 2018 14:12:34 +0100 Subject: [PATCH 0513/1507] Fix crash when calling setVisible for EGL windows twice within one slot Task-number: QTBUG-63411 Change-Id: I56c367a1801d215e93bf195332272cfee300cdd8 Reviewed-by: Paul Olav Tvete --- tests/auto/wayland/client/tst_client.cpp | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/tests/auto/wayland/client/tst_client.cpp b/tests/auto/wayland/client/tst_client.cpp index 1e3d0f1d14d..05b8bac1afa 100644 --- a/tests/auto/wayland/client/tst_client.cpp +++ b/tests/auto/wayland/client/tst_client.cpp @@ -113,7 +113,10 @@ class TestGlWindow : public QOpenGLWindow public: TestGlWindow(); - uint paintGLCalled = 0; + int paintGLCalled = 0; + +public slots: + void hideShow(); protected: void paintGL() override; @@ -122,6 +125,12 @@ protected: TestGlWindow::TestGlWindow() {} +void TestGlWindow::hideShow() +{ + setVisible(false); + setVisible(true); +} + void TestGlWindow::paintGL() { glClear(GL_COLOR_BUFFER_BIT); @@ -564,7 +573,15 @@ void tst_WaylandClient::glWindow() QTRY_VERIFY(surface = compositor->surface()); compositor->sendShellSurfaceConfigure(surface); - QTRY_VERIFY(testWindow->paintGLCalled); + QTRY_COMPARE(testWindow->paintGLCalled, 1); + + //QTBUG-63411 + QMetaObject::invokeMethod(testWindow.data(), "hideShow", Qt::QueuedConnection); + testWindow->requestUpdate(); + QTRY_COMPARE(testWindow->paintGLCalled, 2); + + testWindow->requestUpdate(); + QTRY_COMPARE(testWindow->paintGLCalled, 3); //confirm we don't crash when we delete an already hidden GL window //QTBUG-65553 From faf99279d44487968cf3b2a5eeb1fe1a95732e00 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Wed, 4 Apr 2018 14:28:44 +0200 Subject: [PATCH 0514/1507] Use deliverUpdateRequest on QPlatformWindow instead of QWindowPrivate This is because bff59f87ba11cac1dfa710f021522372de7a776f in qtbase. Task-number: QTBUG-67480 Change-Id: I2bb89f94ecc1d78e8919cd16e7bf9d8877baf121 Reviewed-by: Pier Luigi Fiorini Reviewed-by: Liang Qi --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index fdfd66688fe..6154689dfb6 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -596,9 +596,8 @@ void QWaylandWindow::frameCallback(void *data, struct wl_callback *callback, uin self->mWaitingForFrameSync = false; if (self->mUpdateRequested) { - QWindowPrivate *w = QWindowPrivate::get(self->window()); self->mUpdateRequested = false; - w->deliverUpdateRequest(); + self->deliverUpdateRequest(); } } From 0fc0a890a080dd45fbb2785bd7ecc82f83413947 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Sun, 15 Apr 2018 10:44:46 +0200 Subject: [PATCH 0515/1507] Fix typo in wayland formats Change-Id: Ic4a8c64fa0e1b56a8d21316c96e3eeb3f20fb8b1 Reviewed-by: Johan Helsing --- .../wayland/shared/qwaylandsharedmemoryformathelper_p.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/shared/qwaylandsharedmemoryformathelper_p.h b/src/plugins/platforms/wayland/shared/qwaylandsharedmemoryformathelper_p.h index e5b5faf02e3..85905c02fa3 100644 --- a/src/plugins/platforms/wayland/shared/qwaylandsharedmemoryformathelper_p.h +++ b/src/plugins/platforms/wayland/shared/qwaylandsharedmemoryformathelper_p.h @@ -89,7 +89,7 @@ private: WL_SHM_FORMAT_ABGR8888, //Format_RGBA8888, WL_SHM_FORMAT_ABGR8888, //Format_RGBA8888_Premultiplied, WL_SHM_FORMAT_XBGR2101010, //Format_BGR30, - WL_SHM_FORMAT_ARGB2101010, //Format_A2BGR30_Premultiplied, + WL_SHM_FORMAT_ABGR2101010, //Format_A2BGR30_Premultiplied, WL_SHM_FORMAT_XRGB2101010, //Format_RGB30, WL_SHM_FORMAT_ARGB2101010, //Format_A2RGB30_Premultiplied, WL_SHM_FORMAT_C8, //Format_Alpha8, From d47119339b56d289cfd6751fa0bca995af5de859 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Tue, 6 Mar 2018 13:06:11 +0100 Subject: [PATCH 0516/1507] Client: Add acked configure support and implement it for xdg-shell v6 The problem: The code in QWaylandWindow::setWindowStateInternal made many assumptions about how the shell surface responded to new window states, and when and if they were applied. Particularly: - The shell integrations support different subsets of Qt::WindowStates, so it doesn't make sense to map from states to setFullscreen, setNormal, etc. in QWaylandWindow because it really depends on the shell integration how it should be handled. - Some states are not supported/unknown on some shells and should immediately be rejected. - On some shells, particularly those where the current state is unknown, flags need to be resent even though they didn't change. - Should handleWindowStatesChanged be called immediately (client decides) or should it wait for a configure event (compositor decides)? I.e. the mState variable only makes sense for some shells. Furthermore, when state changes come from the compositors, some shell integrations require that a configure event is acked by the client and that the next committed buffer's size and content matches that configure event. Previously, we would just ack immediately and still send a buffer with the old size before a correct frame was drawn. i.e. sending incorrect acks, which would lead to protocol errors on some compositors. Additionally, QWaylandWindow::createDecoration() also assumed that windows should have decorations unless they are fullscreen. This is not always the case, particularly on ivi-application and probably on future shell integrations for embedded or tiling window managers etc. The Solution: The responsibility of mapping requested window states to Wayland requests have been moved to the QWaylandShellSurface implementation. QWaylandWindow now calls a new virtual, QWaylandShellSurface::requestWindowStates(Qt::WindowStates), instead of trying to be smart about it. The virtual getters and setters for window states have now been removed from the QWaylandShellSurface interface. It's now also the shell surface implementation's responsibility to call QWaylandWindow::handleWindowStatesChanged if and when it knows a new state is effective. QWaylandWindow::configure has been replaced with QWaylandWindow::applyConfigureWhenPossible(), which causes another new virtual, QWaylandShellSurface::applyConfigure(), to be called whenever we're free to resize and change the states of the next buffer (this is when states should be acked). This means that shells that use acked states need to store the pending states themselves, call applyConfigureWhenPossible(), wait for applyConfigure() to be called, call resizeFromApplyConfigure() and handleWindowStatesChanged(), and finally ack the applied state. Acked state for xdg-shell v5 and v6 has now been implemented, which also means we've now: [ChangeLog][QPA plugin] Implemented support for maximizing, minimizing, and setting fullscreen with xdg-shell unstable v6. [ChangeLog][QPA plugin] QWindow::isActive now follows configure events on xdg-shell unstable v6 (like v5). QWaylandWindow::createDecoration queries QWaylandShellSurface::wantsDecoration before creating window decorations, instead of using the previously unreliable QWaylandWindow::isFullscreen(). [ChangeLog][QPA plugin] Window decorations are now automatically disabled for ivi-application. The refactor also removes a couple of hacks: - QWindowSystemInterface::flushWindowSystemEvents() was called in QWaylandWindow::setWindowStates. Since this hack was introduced, the events now have oldState and newState members, and their values seem to make sense (ensured in the tests). - The hack for unminimizing on xdg-shell v5 in QWaylandWindow::createDecoration was not needed anymore. Finally, tests have been added for xdg-shell v6 to ensure that the right Wayland requests are sent, that we respond to configure events from the compositor, and that the Qt events and signals emitted on the client side make sense. Task-number: QTBUG-53702 Task-number: QTBUG-63417 Task-number: QTBUG-63748 Task-number: QTBUG-66928 Change-Id: Ib4c36b69105750f9dbdcc78adcf71e2e994cc70d Reviewed-by: Paul Olav Tvete --- .../plugins/decorations/bradient/main.cpp | 7 +- .../wayland/qwaylandshellsurface_p.h | 9 +- .../platforms/wayland/qwaylandwindow.cpp | 120 ++++------- .../platforms/wayland/qwaylandwindow_p.h | 36 +--- .../wayland/qwaylandwlshellsurface.cpp | 89 ++++++--- .../wayland/qwaylandwlshellsurface_p.h | 21 +- .../platforms/wayland/qwaylandxdgshellv6.cpp | 119 +++++++++-- .../platforms/wayland/qwaylandxdgshellv6_p.h | 14 +- .../wayland/qwaylandxdgshellv6integration.cpp | 14 ++ .../wayland/qwaylandxdgshellv6integration_p.h | 1 + .../platforms/wayland/qwaylandxdgsurface.cpp | 149 +++++++------- .../platforms/wayland/qwaylandxdgsurface_p.h | 21 +- tests/auto/wayland/client/tst_client.cpp | 36 +++- tests/auto/wayland/shared/mockcompositor.cpp | 5 +- tests/auto/wayland/shared/mockcompositor.h | 14 +- tests/auto/wayland/shared/mockxdgshellv6.cpp | 35 +++- tests/auto/wayland/shared/mockxdgshellv6.h | 5 + .../wayland/xdgshellv6/tst_xdgshellv6.cpp | 189 ++++++++++++++++++ 18 files changed, 594 insertions(+), 290 deletions(-) diff --git a/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp b/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp index 9a7e91e6f7b..d3627d2f70b 100644 --- a/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp +++ b/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp @@ -270,8 +270,7 @@ void QWaylandBradientDecoration::paint(QPaintDevice *device) p.drawPixmap(closeButtonRect(), closePixmap, closePixmap.rect()); // Maximize button - QPixmap maximizePixmap(waylandWindow()->isMaximized() - ? qt_normalizeup_xpm : qt_maximize_xpm); + QPixmap maximizePixmap((window()->windowStates() & Qt::WindowMaximized) ? qt_normalizeup_xpm : qt_maximize_xpm); p.drawPixmap(maximizeButtonRect(), maximizePixmap, maximizePixmap.rect()); // Minimize button @@ -356,7 +355,7 @@ bool QWaylandBradientDecoration::handleMouse(QWaylandInputDevice *inputDevice, c QWindowSystemInterface::handleCloseEvent(window()); } else if (maximizeButtonRect().contains(local)) { if (clickButton(b, Maximize)) - window()->setWindowState(waylandWindow()->isMaximized() ? Qt::WindowNoState : Qt::WindowMaximized); + window()->setWindowStates(window()->windowStates() ^ Qt::WindowMaximized); } else if (minimizeButtonRect().contains(local)) { if (clickButton(b, Minimize)) window()->setWindowState(Qt::WindowMinimized); @@ -390,7 +389,7 @@ bool QWaylandBradientDecoration::handleTouch(QWaylandInputDevice *inputDevice, c if (closeButtonRect().contains(local)) QWindowSystemInterface::handleCloseEvent(window()); else if (maximizeButtonRect().contains(local)) - window()->setWindowState(waylandWindow()->isMaximized() ? Qt::WindowNoState : Qt::WindowMaximized); + window()->setWindowStates(window()->windowStates() ^ Qt::WindowMaximized); else if (minimizeButtonRect().contains(local)) window()->setWindowState(Qt::WindowMinimized); else if (local.y() <= margins().top()) diff --git a/src/plugins/platforms/wayland/qwaylandshellsurface_p.h b/src/plugins/platforms/wayland/qwaylandshellsurface_p.h index fdc309a635d..6b6bb9e84c7 100644 --- a/src/plugins/platforms/wayland/qwaylandshellsurface_p.h +++ b/src/plugins/platforms/wayland/qwaylandshellsurface_p.h @@ -96,12 +96,9 @@ public: inline QWaylandWindow *window() { return m_window; } virtual void setType(Qt::WindowType type, QWaylandWindow *transientParent) = 0; - -protected: - virtual void setMaximized() {} - virtual void setFullscreen() {} - virtual void setNormal() {} - virtual void setMinimized() {} + virtual void applyConfigure() {} + virtual void requestWindowStates(Qt::WindowStates states) {Q_UNUSED(states);} + virtual bool wantsDecorations() const { return false; } private: QWaylandWindow *m_window = nullptr; diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 6154689dfb6..21c9f82b07b 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -200,11 +200,8 @@ void QWaylandWindow::initWindow() else setGeometry_helper(window()->geometry()); setMask(window()->mask()); - // setWindowStateInternal is a no-op if the argument is equal to mState, - // but since we're creating the shellsurface only now we reset mState to - // make sure the state gets sent out to the compositor - mState = Qt::WindowNoState; - setWindowStateInternal(window()->windowStates()); + if (mShellSurface) + mShellSurface->requestWindowStates(window()->windowStates()); handleContentOrientationChange(window()->contentOrientation()); mFlags = window()->flags(); } @@ -333,7 +330,16 @@ void QWaylandWindow::setGeometry(const QRect &rect) sendExposeEvent(QRect(QPoint(), geometry().size())); } +void QWaylandWindow::resizeFromApplyConfigure(const QSize &sizeWithMargins, const QPoint &offset) +{ + QMargins margins = frameMargins(); + int widthWithoutMargins = qMax(sizeWithMargins.width() - (margins.left()+margins.right()), 1); + int heightWithoutMargins = qMax(sizeWithMargins.height() - (margins.top()+margins.bottom()), 1); + QRect geometry(QPoint(), QSize(widthWithoutMargins, heightWithoutMargins)); + mOffset += offset; + setGeometry(geometry); +} void QWaylandWindow::sendExposeEvent(const QRect &rect) { @@ -421,46 +427,24 @@ void QWaylandWindow::setMask(const QRegion &mask) wl_surface::commit(); } -void QWaylandWindow::configure(uint32_t edges, int32_t width, int32_t height) +void QWaylandWindow::applyConfigureWhenPossible() { QMutexLocker resizeLocker(&mResizeLock); - mConfigure.edges |= edges; - mConfigure.width = width; - mConfigure.height = height; - - if (!mRequestResizeSent && !mConfigure.isEmpty()) { - mRequestResizeSent= true; - QMetaObject::invokeMethod(this, "requestResize", Qt::QueuedConnection); + if (!mWaitingToApplyConfigure) { + mWaitingToApplyConfigure = true; + QMetaObject::invokeMethod(this, "applyConfigure", Qt::QueuedConnection); } } -void QWaylandWindow::doResize() +void QWaylandWindow::doApplyConfigure() { - if (mConfigure.isEmpty()) { + if (!mWaitingToApplyConfigure) return; - } - int widthWithoutMargins = qMax(mConfigure.width-(frameMargins().left() +frameMargins().right()),1); - int heightWithoutMargins = qMax(mConfigure.height-(frameMargins().top()+frameMargins().bottom()),1); + if (mShellSurface) + mShellSurface->applyConfigure(); - widthWithoutMargins = qMax(widthWithoutMargins, window()->minimumSize().width()); - heightWithoutMargins = qMax(heightWithoutMargins, window()->minimumSize().height()); - QRect geometry = QRect(0,0, widthWithoutMargins, heightWithoutMargins); - - int x = 0; - int y = 0; - QSize size = this->geometry().size(); - if (mConfigure.edges & WL_SHELL_SURFACE_RESIZE_LEFT) { - x = size.width() - geometry.width(); - } - if (mConfigure.edges & WL_SHELL_SURFACE_RESIZE_TOP) { - y = size.height() - geometry.height(); - } - mOffset += QPoint(x, y); - - setGeometry(geometry); - - mConfigure.clear(); + mWaitingToApplyConfigure = false; } void QWaylandWindow::setCanResize(bool canResize) @@ -472,8 +456,8 @@ void QWaylandWindow::setCanResize(bool canResize) if (mResizeDirty) { QWindowSystemInterface::handleGeometryChange(window(), geometry()); } - if (!mConfigure.isEmpty()) { - doResize(); + if (mWaitingToApplyConfigure) { + doApplyConfigure(); sendExposeEvent(QRect(QPoint(), geometry().size())); } else if (mResizeDirty) { mResizeDirty = false; @@ -482,15 +466,13 @@ void QWaylandWindow::setCanResize(bool canResize) } } -void QWaylandWindow::requestResize() +void QWaylandWindow::applyConfigure() { QMutexLocker lock(&mResizeLock); - if (mCanResize || !mSentInitialResize) { - doResize(); - } + if (mCanResize || !mSentInitialResize) + doApplyConfigure(); - mRequestResizeSent = false; lock.unlock(); sendExposeEvent(QRect(QPoint(), geometry().size())); QWindowSystemInterface::flushWindowSystemEvents(); @@ -672,10 +654,10 @@ void QWaylandWindow::setOrientationMask(Qt::ScreenOrientations mask) mShellSurface->setContentOrientationMask(mask); } -void QWaylandWindow::setWindowState(Qt::WindowStates state) +void QWaylandWindow::setWindowState(Qt::WindowStates states) { - if (setWindowStateInternal(state)) - QWindowSystemInterface::flushWindowSystemEvents(); // Required for oldState to work on WindowStateChanged + if (mShellSurface) + mShellSurface->requestWindowStates(states); } void QWaylandWindow::setWindowFlags(Qt::WindowFlags flags) @@ -689,20 +671,6 @@ void QWaylandWindow::setWindowFlags(Qt::WindowFlags flags) bool QWaylandWindow::createDecoration() { - // so far only xdg-shell support this "unminimize" trick, may be moved elsewhere - if (mState & Qt::WindowMinimized) { - QWaylandXdgSurface *xdgSurface = qobject_cast(mShellSurface); - if ( xdgSurface ) { - Qt::WindowStates states; - if (xdgSurface->isFullscreen()) - states |= Qt::WindowFullScreen; - if (xdgSurface->isMaximized()) - states |= Qt::WindowMaximized; - - setWindowStateInternal(states); - } - } - if (!mDisplay->supportsWindowDecoration()) return false; @@ -719,12 +687,14 @@ bool QWaylandWindow::createDecoration() default: break; } - if (mFlags & Qt::FramelessWindowHint || isFullscreen()) + if (mFlags & Qt::FramelessWindowHint) decoration = false; if (mFlags & Qt::BypassWindowManagerHint) decoration = false; if (mSubSurfaceWindow) decoration = false; + if (mShellSurface && !mShellSurface->wantsDecorations()) + decoration = false; bool hadDecoration = mWindowDecoration; if (decoration && !decorationPluginFailed) { @@ -970,31 +940,11 @@ bool QWaylandWindow::setMouseGrabEnabled(bool grab) return true; } -bool QWaylandWindow::setWindowStateInternal(Qt::WindowStates state) +void QWaylandWindow::handleWindowStatesChanged(Qt::WindowStates states) { - if (mState == state) { - return false; - } - - // As of february 2013 QWindow::setWindowState sets the new state value after - // QPlatformWindow::setWindowState returns, so we cannot rely on QWindow::windowState - // here. We use then this mState variable. - mState = state; - - if (mShellSurface) { - createDecoration(); - if (state & Qt::WindowMaximized) - mShellSurface->setMaximized(); - if (state & Qt::WindowFullScreen) - mShellSurface->setFullscreen(); - if (state & Qt::WindowMinimized) - mShellSurface->setMinimized(); - if (!state) - mShellSurface->setNormal(); - } - - QWindowSystemInterface::handleWindowStateChanged(window(), mState); - return true; + createDecoration(); + QWindowSystemInterface::handleWindowStateChanged(window(), states, mLastReportedWindowStates); + mLastReportedWindowStates = states; } void QWaylandWindow::sendProperty(const QString &name, const QVariant &value) diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index 3324bf70056..55f3a515fdb 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -77,23 +77,6 @@ class QWaylandScreen; class QWaylandShmBackingStore; class QWaylandPointerEvent; -class Q_WAYLAND_CLIENT_EXPORT QWaylandWindowConfigure -{ -public: - QWaylandWindowConfigure() - { } - - void clear() - { width = height = edges = 0; } - - bool isEmpty() const - { return !height || !width; } - - int width = 0; - int height = 0; - uint32_t edges = 0; -}; - class Q_WAYLAND_CLIENT_EXPORT QWaylandWindow : public QObject, public QPlatformWindow, public QtWayland::wl_surface { Q_OBJECT @@ -118,8 +101,9 @@ public: void setWindowIcon(const QIcon &icon) override; void setGeometry(const QRect &rect) override; + void resizeFromApplyConfigure(const QSize &sizeWithMargins, const QPoint &offset = {0, 0}); - void configure(uint32_t edges, int32_t width, int32_t height); + void applyConfigureWhenPossible(); //rename to possible? using QtWayland::wl_surface::attach; void attach(QWaylandBuffer *buffer, int x, int y); @@ -145,8 +129,9 @@ public: void handleContentOrientationChange(Qt::ScreenOrientation orientation) override; void setOrientationMask(Qt::ScreenOrientations mask); - void setWindowState(Qt::WindowStates state) override; + void setWindowState(Qt::WindowStates states) override; void setWindowFlags(Qt::WindowFlags flags) override; + void handleWindowStatesChanged(Qt::WindowStates states); void raise() override; void lower() override; @@ -170,9 +155,6 @@ public: bool createDecoration(); - inline bool isMaximized() const { return mState & Qt::WindowMaximized; } - inline bool isFullscreen() const { return mState & Qt::WindowFullScreen; } - #if QT_CONFIG(cursor) void setMouseCursor(QWaylandInputDevice *device, const QCursor &cursor); void restoreMouseCursor(QWaylandInputDevice *device); @@ -181,7 +163,7 @@ public: QWaylandWindow *transientParent() const; QMutex *resizeMutex() { return &mResizeLock; } - void doResize(); + void doApplyConfigure(); void setCanResize(bool canResize); bool setMouseGrabEnabled(bool grab) override; @@ -206,7 +188,7 @@ public: void requestUpdate() override; public slots: - void requestResize(); + void applyConfigure(); protected: void surface_enter(struct ::wl_output *output) override; @@ -228,8 +210,7 @@ protected: QWaitCondition mFrameSyncWait; QMutex mResizeLock; - QWaylandWindowConfigure mConfigure; - bool mRequestResizeSent = false; + bool mWaitingToApplyConfigure = false; bool mCanResize = true; bool mResizeDirty = false; bool mResizeAfterSwap; @@ -241,9 +222,9 @@ protected: QIcon mWindowIcon; - Qt::WindowStates mState = Qt::WindowNoState; Qt::WindowFlags mFlags; QRegion mMask; + Qt::WindowStates mLastReportedWindowStates = Qt::WindowNoState; QWaylandShmBackingStore *mBackingStore = nullptr; @@ -251,7 +232,6 @@ private slots: void handleScreenRemoved(QScreen *qScreen); private: - bool setWindowStateInternal(Qt::WindowStates flags); void setGeometry_helper(const QRect &rect); void initWindow(); void initializeWlSurface(); diff --git a/src/plugins/platforms/wayland/qwaylandwlshellsurface.cpp b/src/plugins/platforms/wayland/qwaylandwlshellsurface.cpp index 098eddcbccf..3601fd43765 100644 --- a/src/plugins/platforms/wayland/qwaylandwlshellsurface.cpp +++ b/src/plugins/platforms/wayland/qwaylandwlshellsurface.cpp @@ -121,35 +121,70 @@ void QWaylandWlShellSurface::sendProperty(const QString &name, const QVariant &v m_extendedWindow->updateGenericProperty(name, value); } -void QWaylandWlShellSurface::setMaximized() +void QWaylandWlShellSurface::applyConfigure() { - m_maximized = true; - m_size = m_window->window()->geometry().size(); - set_maximized(nullptr); -} - -void QWaylandWlShellSurface::setFullscreen() -{ - m_fullscreen = true; - m_size = m_window->window()->geometry().size(); - set_fullscreen(WL_SHELL_SURFACE_FULLSCREEN_METHOD_DEFAULT, 0, nullptr); -} - -void QWaylandWlShellSurface::setNormal() -{ - if (m_fullscreen || m_maximized) { - m_fullscreen = m_maximized = false; - setTopLevel(); - QMargins m = m_window->frameMargins(); - m_window->configure(0, m_size.width() + m.left() + m.right(), m_size.height() + m.top() + m.bottom()); + if ((m_pending.states & (Qt::WindowMaximized|Qt::WindowFullScreen)) + && !(m_applied.states & (Qt::WindowMaximized|Qt::WindowFullScreen))) { + m_normalSize = m_window->window()->frameGeometry().size(); } + + if (m_pending.states != m_applied.states) + m_window->handleWindowStatesChanged(m_pending.states); + + if (!m_pending.size.isEmpty()) { + int x = 0; + int y = 0; + if (m_pending.edges & resize_left) + x = m_applied.size.width() - m_pending.size.width(); + if (m_pending.edges & resize_top) + y = m_applied.size.height() - m_pending.size.height(); + QPoint offset(x, y); + m_window->resizeFromApplyConfigure(m_pending.size, offset); + } else if (m_pending.size.isValid() && !m_normalSize.isEmpty()) { + m_window->resizeFromApplyConfigure(m_normalSize); + } + + m_applied = m_pending; } -void QWaylandWlShellSurface::setMinimized() +bool QWaylandWlShellSurface::wantsDecorations() const { - qCWarning(lcQpaWayland) << "Minimization is not supported on wl-shell. Consider using xdg-shell instead."; + return !(m_pending.states & Qt::WindowFullScreen); } +void QWaylandWlShellSurface::requestWindowStates(Qt::WindowStates states) +{ + // On wl-shell the client is in charge of states, so diff from the pending state + Qt::WindowStates changedStates = m_pending.states ^ states; + Qt::WindowStates addedStates = changedStates & states; + + if (addedStates & Qt::WindowMinimized) + qCWarning(lcQpaWayland) << "Minimizing is not supported on wl-shell. Consider using xdg-shell instead."; + + if (addedStates & Qt::WindowMaximized) { + set_maximized(nullptr); + m_window->applyConfigureWhenPossible(); + } + + if (addedStates & Qt::WindowFullScreen) { + set_fullscreen(WL_SHELL_SURFACE_FULLSCREEN_METHOD_DEFAULT, 0, nullptr); + m_window->applyConfigureWhenPossible(); + } + + bool isNormal = ~states & (Qt::WindowMaximized | Qt::WindowFullScreen); + if (isNormal && (changedStates & (Qt::WindowMaximized | Qt::WindowFullScreen))) { + setTopLevel(); // set normal window + // There's usually no configure event after this, so just clear the rest of the pending + // configure here and queue the applyConfigure call + m_pending.size = {0, 0}; + m_pending.edges = resize_none; + m_window->applyConfigureWhenPossible(); + } + + m_pending.states = states & ~Qt::WindowMinimized; +} + + void QWaylandWlShellSurface::setTopLevel() { set_toplevel(); @@ -230,11 +265,13 @@ void QWaylandWlShellSurface::shell_surface_ping(uint32_t serial) pong(serial); } -void QWaylandWlShellSurface::shell_surface_configure(uint32_t edges, - int32_t width, - int32_t height) +void QWaylandWlShellSurface::shell_surface_configure(uint32_t edges, int32_t width, int32_t height) { - m_window->configure(edges, width, height); + m_pending.size = QSize(width, height); + m_pending.edges = static_cast(edges); + if (m_pending.edges && !m_pending.size.isEmpty()) + m_normalSize = m_pending.size; + m_window->applyConfigureWhenPossible(); } void QWaylandWlShellSurface::shell_surface_popup_done() diff --git a/src/plugins/platforms/wayland/qwaylandwlshellsurface_p.h b/src/plugins/platforms/wayland/qwaylandwlshellsurface_p.h index 497ec604379..ca81dd685aa 100644 --- a/src/plugins/platforms/wayland/qwaylandwlshellsurface_p.h +++ b/src/plugins/platforms/wayland/qwaylandwlshellsurface_p.h @@ -93,21 +93,26 @@ public: void sendProperty(const QString &name, const QVariant &value) override; void setType(Qt::WindowType type, QWaylandWindow *transientParent) override; + void applyConfigure() override; + bool wantsDecorations() const override; + +protected: + void requestWindowStates(Qt::WindowStates states) override; private: - void setMaximized() override; - void setFullscreen() override; - void setNormal() override; - void setMinimized() override; - void setTopLevel(); void updateTransientParent(QWindow *parent); void setPopup(QWaylandWindow *parent, QWaylandInputDevice *device, uint serial); QWaylandWindow *m_window = nullptr; - bool m_maximized = false; - bool m_fullscreen = false; - QSize m_size; + struct { + Qt::WindowStates states = Qt::WindowNoState; + QSize size; + enum resize edges = resize_none; + } m_applied, m_pending; + QSize m_normalSize; + // There's really no need to have pending and applied state on wl-shell, but we do it just to + // keep the different shell implementations more similar. QWaylandExtendedSurface *m_extendedWindow = nullptr; void shell_surface_ping(uint32_t serial) override; diff --git a/src/plugins/platforms/wayland/qwaylandxdgshellv6.cpp b/src/plugins/platforms/wayland/qwaylandxdgshellv6.cpp index a166a3bc930..beabddbbb48 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgshellv6.cpp +++ b/src/plugins/platforms/wayland/qwaylandxdgshellv6.cpp @@ -46,8 +46,6 @@ #include "qwaylandscreen_p.h" #include "qwaylandabstractdecoration_p.h" -#include - QT_BEGIN_NAMESPACE namespace QtWaylandClient { @@ -56,32 +54,65 @@ QWaylandXdgSurfaceV6::Toplevel::Toplevel(QWaylandXdgSurfaceV6 *xdgSurface) : QtWayland::zxdg_toplevel_v6(xdgSurface->get_toplevel()) , m_xdgSurface(xdgSurface) { + requestWindowStates(xdgSurface->window()->window()->windowStates()); } QWaylandXdgSurfaceV6::Toplevel::~Toplevel() { + if (m_applied.states & Qt::WindowActive) { + QWaylandWindow *window = m_xdgSurface->window(); + window->display()->handleWindowDeactivated(window); + } if (isInitialized()) destroy(); } void QWaylandXdgSurfaceV6::Toplevel::applyConfigure() { - //TODO: resize, activate etc - m_xdgSurface->m_window->configure(0, m_configureState.width, m_configureState.height); + if (!(m_applied.states & (Qt::WindowMaximized|Qt::WindowFullScreen))) + m_normalSize = m_xdgSurface->m_window->window()->frameGeometry().size(); + + if (m_pending.size.isEmpty() && !m_normalSize.isEmpty()) + m_pending.size = m_normalSize; + + if ((m_pending.states & Qt::WindowActive) && !(m_applied.states & Qt::WindowActive)) + m_xdgSurface->m_window->display()->handleWindowActivated(m_xdgSurface->m_window); + + if (!(m_pending.states & Qt::WindowActive) && (m_applied.states & Qt::WindowActive)) + m_xdgSurface->m_window->display()->handleWindowDeactivated(m_xdgSurface->m_window); + + // TODO: none of the other plugins send WindowActive either, but is it on purpose? + Qt::WindowStates statesWithoutActive = m_pending.states & ~Qt::WindowActive; + + m_xdgSurface->m_window->handleWindowStatesChanged(statesWithoutActive); + m_xdgSurface->m_window->resizeFromApplyConfigure(m_pending.size); + m_applied = m_pending; } void QWaylandXdgSurfaceV6::Toplevel::zxdg_toplevel_v6_configure(int32_t width, int32_t height, wl_array *states) { - m_configureState.width = width; - m_configureState.height = height; + m_pending.size = QSize(width, height); - uint32_t *state = reinterpret_cast(states->data); + auto *xdgStates = static_cast(states->data); size_t numStates = states->size / sizeof(uint32_t); - m_configureState.states.reserve(numStates); - m_configureState.states.clear(); - for (size_t i = 0; i < numStates; i++) - m_configureState.states << state[i]; + m_pending.states = Qt::WindowNoState; + + for (size_t i = 0; i < numStates; i++) { + switch (xdgStates[i]) { + case ZXDG_TOPLEVEL_V6_STATE_ACTIVATED: + m_pending.states |= Qt::WindowActive; + break; + case ZXDG_TOPLEVEL_V6_STATE_MAXIMIZED: + m_pending.states |= Qt::WindowMaximized; + break; + case ZXDG_TOPLEVEL_V6_STATE_FULLSCREEN: + m_pending.states |= Qt::WindowFullScreen; + break; + default: + break; + } + } } void QWaylandXdgSurfaceV6::Toplevel::zxdg_toplevel_v6_close() @@ -89,6 +120,32 @@ void QWaylandXdgSurfaceV6::Toplevel::zxdg_toplevel_v6_close() m_xdgSurface->m_window->window()->close(); } +void QWaylandXdgSurfaceV6::Toplevel::requestWindowStates(Qt::WindowStates states) +{ + // Re-send what's different from the applied state + Qt::WindowStates changedStates = m_applied.states ^ states; + + if (changedStates & Qt::WindowMaximized) { + if (states & Qt::WindowMaximized) + set_maximized(); + else + unset_maximized(); + } + + if (changedStates & Qt::WindowFullScreen) { + if (states & Qt::WindowFullScreen) + set_fullscreen(nullptr); + else + unset_fullscreen(); + } + + // Minimized state is not reported by the protocol, so always send it + if (states & Qt::WindowMinimized) { + set_minimized(); + m_xdgSurface->window()->handleWindowStatesChanged(states & ~Qt::WindowMinimized); + } +} + QWaylandXdgSurfaceV6::Popup::Popup(QWaylandXdgSurfaceV6 *xdgSurface, QWaylandXdgSurfaceV6 *parent, QtWayland::zxdg_positioner_v6 *positioner) : zxdg_popup_v6(xdgSurface->get_popup(parent->object(), positioner->object())) @@ -104,7 +161,6 @@ QWaylandXdgSurfaceV6::Popup::~Popup() void QWaylandXdgSurfaceV6::Popup::applyConfigure() { - } void QWaylandXdgSurfaceV6::Popup::zxdg_popup_v6_popup_done() @@ -187,6 +243,34 @@ bool QWaylandXdgSurfaceV6::handleExpose(const QRegion ®ion) return false; } +void QWaylandXdgSurfaceV6::applyConfigure() +{ + Q_ASSERT(m_pendingConfigureSerial != 0); + + if (m_toplevel) + m_toplevel->applyConfigure(); + if (m_popup) + m_popup->applyConfigure(); + + m_configured = true; + ack_configure(m_pendingConfigureSerial); + + m_pendingConfigureSerial = 0; +} + +bool QWaylandXdgSurfaceV6::wantsDecorations() const +{ + return m_toplevel && !(m_toplevel->m_pending.states & Qt::WindowFullScreen); +} + +void QWaylandXdgSurfaceV6::requestWindowStates(Qt::WindowStates states) +{ + if (m_toplevel) + m_toplevel->requestWindowStates(states); + else + qCWarning(lcQpaWayland) << "Non-toplevel surfaces can't request window states"; +} + void QWaylandXdgSurfaceV6::setToplevel() { Q_ASSERT(!m_toplevel && !m_popup); @@ -220,21 +304,14 @@ void QWaylandXdgSurfaceV6::setPopup(QWaylandWindow *parent, QWaylandInputDevice void QWaylandXdgSurfaceV6::zxdg_surface_v6_configure(uint32_t serial) { - m_configured = true; - if (m_toplevel) - m_toplevel->applyConfigure(); - else if (m_popup) - m_popup->applyConfigure(); - + m_window->applyConfigureWhenPossible(); + m_pendingConfigureSerial = serial; if (!m_exposeRegion.isEmpty()) { QWindowSystemInterface::handleExposeEvent(m_window->window(), m_exposeRegion); m_exposeRegion = QRegion(); } - ack_configure(serial); } - - QWaylandXdgShellV6::QWaylandXdgShellV6(struct ::wl_registry *registry, uint32_t id, uint32_t availableVersion) : QtWayland::zxdg_shell_v6(registry, id, qMin(availableVersion, 1u)) { diff --git a/src/plugins/platforms/wayland/qwaylandxdgshellv6_p.h b/src/plugins/platforms/wayland/qwaylandxdgshellv6_p.h index b72d3d18a9a..d2448bc664f 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgshellv6_p.h +++ b/src/plugins/platforms/wayland/qwaylandxdgshellv6_p.h @@ -73,6 +73,7 @@ class QWaylandXdgShellV6; class Q_WAYLAND_CLIENT_EXPORT QWaylandXdgSurfaceV6 : public QWaylandShellSurface, public QtWayland::zxdg_surface_v6 { + Q_OBJECT public: QWaylandXdgSurfaceV6(QWaylandXdgShellV6 *shell, ::zxdg_surface_v6 *surface, QWaylandWindow *window); ~QWaylandXdgSurfaceV6() override; @@ -85,8 +86,12 @@ public: void setType(Qt::WindowType type, QWaylandWindow *transientParent) override; bool handleExpose(const QRegion &) override; + bool handlesActiveState() const { return m_toplevel; } + void applyConfigure() override; + bool wantsDecorations() const override; protected: + void requestWindowStates(Qt::WindowStates states) override; void zxdg_surface_v6_configure(uint32_t serial) override; private: @@ -101,10 +106,12 @@ private: void zxdg_toplevel_v6_configure(int32_t width, int32_t height, wl_array *states) override; void zxdg_toplevel_v6_close() override; + void requestWindowStates(Qt::WindowStates states); struct { - int32_t width, height; - QVarLengthArray states; - } m_configureState; + QSize size = {0, 0}; + Qt::WindowStates states = Qt::WindowNoState; + } m_pending, m_applied; + QSize m_normalSize; QWaylandXdgSurfaceV6 *m_xdgSurface = nullptr; }; @@ -129,6 +136,7 @@ private: Popup *m_popup = nullptr; bool m_configured = false; QRegion m_exposeRegion; + uint m_pendingConfigureSerial = 0; }; class Q_WAYLAND_CLIENT_EXPORT QWaylandXdgShellV6 : public QtWayland::zxdg_shell_v6 diff --git a/src/plugins/platforms/wayland/qwaylandxdgshellv6integration.cpp b/src/plugins/platforms/wayland/qwaylandxdgshellv6integration.cpp index cb82354b64c..d3327ff39a8 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgshellv6integration.cpp +++ b/src/plugins/platforms/wayland/qwaylandxdgshellv6integration.cpp @@ -78,6 +78,20 @@ QWaylandShellSurface *QWaylandXdgShellV6Integration::createShellSurface(QWayland return m_xdgShell->getXdgSurface(window); } +void QWaylandXdgShellV6Integration::handleKeyboardFocusChanged(QWaylandWindow *newFocus, QWaylandWindow *oldFocus) +{ + if (newFocus) { + auto *xdgSurface = qobject_cast(newFocus->shellSurface()); + if (xdgSurface && xdgSurface->handlesActiveState()) + m_display->handleWindowActivated(newFocus); + } + if (oldFocus && qobject_cast(oldFocus->shellSurface())) { + auto *xdgSurface = qobject_cast(oldFocus->shellSurface()); + if (xdgSurface && xdgSurface->handlesActiveState()) + m_display->handleWindowDeactivated(oldFocus); + } +} + } QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandxdgshellv6integration_p.h b/src/plugins/platforms/wayland/qwaylandxdgshellv6integration_p.h index bdfd1972338..66323a77533 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgshellv6integration_p.h +++ b/src/plugins/platforms/wayland/qwaylandxdgshellv6integration_p.h @@ -67,6 +67,7 @@ public: static QWaylandXdgShellV6Integration *create(QWaylandDisplay* display); bool initialize(QWaylandDisplay *display) override; QWaylandShellSurface *createShellSurface(QWaylandWindow *window) override; + void handleKeyboardFocusChanged(QWaylandWindow *newFocus, QWaylandWindow *oldFocus) override; private: QWaylandXdgShellV6Integration(QWaylandDisplay *display); diff --git a/src/plugins/platforms/wayland/qwaylandxdgsurface.cpp b/src/plugins/platforms/wayland/qwaylandxdgsurface.cpp index 4dfc5e6daad..5b5aacbf4d6 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgsurface.cpp +++ b/src/plugins/platforms/wayland/qwaylandxdgsurface.cpp @@ -64,7 +64,7 @@ QWaylandXdgSurface::QWaylandXdgSurface(QWaylandXdgShell *shell, QWaylandWindow * QWaylandXdgSurface::~QWaylandXdgSurface() { - if (m_active) + if (m_acked.states & Qt::WindowActive) window()->display()->handleWindowDeactivated(m_window); xdg_surface_destroy(object()); @@ -92,38 +92,6 @@ bool QWaylandXdgSurface::move(QWaylandInputDevice *inputDevice) return true; } -void QWaylandXdgSurface::setMaximized() -{ - if (!m_maximized) - set_maximized(); -} - -void QWaylandXdgSurface::setFullscreen() -{ - if (!m_fullscreen) - set_fullscreen(nullptr); -} - -void QWaylandXdgSurface::setNormal() -{ - if (m_fullscreen || m_maximized || m_minimized) { - if (m_maximized) { - unset_maximized(); - } - if (m_fullscreen) { - unset_fullscreen(); - } - - m_fullscreen = m_maximized = m_minimized = false; - } -} - -void QWaylandXdgSurface::setMinimized() -{ - m_minimized = true; - set_minimized(); -} - void QWaylandXdgSurface::updateTransientParent(QWaylandWindow *parent) { if (!parent) @@ -180,71 +148,88 @@ void QWaylandXdgSurface::setType(Qt::WindowType type, QWaylandWindow *transientP updateTransientParent(transientParent); } +void QWaylandXdgSurface::applyConfigure() +{ + if (m_pending.isResizing) + m_normalSize = m_pending.size; + else if (!(m_acked.states & (Qt::WindowMaximized|Qt::WindowFullScreen))) + m_normalSize = m_window->window()->frameGeometry().size(); + + if ((m_pending.states & Qt::WindowActive) && !(m_acked.states & Qt::WindowActive)) + m_window->display()->handleWindowActivated(m_window); + + if (!(m_pending.states & Qt::WindowActive) && (m_acked.states & Qt::WindowActive)) + m_window->display()->handleWindowDeactivated(m_window); + + // TODO: none of the other plugins send WindowActive either, but is it on purpose? + Qt::WindowStates statesWithoutActive = m_pending.states & ~Qt::WindowActive; + + m_window->handleWindowStatesChanged(statesWithoutActive); + if (!m_pending.size.isEmpty()) + m_window->resizeFromApplyConfigure(m_pending.size); + else if (!m_normalSize.isEmpty()) + m_window->resizeFromApplyConfigure(m_normalSize); + ack_configure(m_pending.serial); + m_acked = m_pending; +} + +void QWaylandXdgSurface::requestWindowStates(Qt::WindowStates states) +{ + Qt::WindowStates changedStates = m_acked.states ^ states; + + if (changedStates & Qt::WindowMaximized) { + if (states & Qt::WindowMaximized) + set_maximized(); + else + unset_maximized(); + } + + if (changedStates & Qt::WindowFullScreen) { + if (states & Qt::WindowFullScreen) + set_fullscreen(nullptr); + else + unset_fullscreen(); + } + + // Minimized state is not reported by the protocol, so always send it + if (states & Qt::WindowMinimized) { + set_minimized(); + window()->handleWindowStatesChanged(states & ~Qt::WindowMinimized); + } +} + +bool QWaylandXdgSurface::wantsDecorations() const +{ + return !(m_pending.states & Qt::WindowFullScreen); +} + void QWaylandXdgSurface::xdg_surface_configure(int32_t width, int32_t height, struct wl_array *states,uint32_t serial) { - uint32_t *state = reinterpret_cast(states->data); + uint32_t *xdgStates = reinterpret_cast(states->data); size_t numStates = states->size / sizeof(uint32_t); - bool aboutToMaximize = false; - bool aboutToFullScreen = false; - bool aboutToActivate = false; - + m_pending.serial = serial; + m_pending.size = QSize(width, height); + m_pending.isResizing = false; + m_pending.states = Qt::WindowNoState; for (size_t i = 0; i < numStates; i++) { - switch (state[i]) { + switch (xdgStates[i]) { case XDG_SURFACE_STATE_MAXIMIZED: - aboutToMaximize = ((width > 0) && (height > 0)); + m_pending.states |= Qt::WindowMaximized; break; case XDG_SURFACE_STATE_FULLSCREEN: - aboutToFullScreen = true; + m_pending.states |= Qt::WindowFullScreen; break; case XDG_SURFACE_STATE_RESIZING: - m_normalSize = QSize(width, height); + m_pending.isResizing = true; break; case XDG_SURFACE_STATE_ACTIVATED: - aboutToActivate = true; + m_pending.states |= Qt::WindowActive; break; default: break; } } - - if (!m_active && aboutToActivate) { - m_active = true; - window()->display()->handleWindowActivated(m_window); - } else if (m_active && !aboutToActivate) { - m_active = false; - window()->display()->handleWindowDeactivated(m_window); - } - - if (!m_fullscreen && aboutToFullScreen) { - if (!m_maximized) - m_normalSize = m_window->window()->frameGeometry().size(); - m_fullscreen = true; - m_window->window()->showFullScreen(); - } else if (m_fullscreen && !aboutToFullScreen) { - m_fullscreen = false; - if ( m_maximized ) { - m_window->window()->showMaximized(); - } else { - m_window->window()->showNormal(); - } - } else if (!m_maximized && aboutToMaximize) { - if (!m_fullscreen) - m_normalSize = m_window->window()->frameGeometry().size(); - m_maximized = true; - m_window->window()->showMaximized(); - } else if (m_maximized && !aboutToMaximize) { - m_maximized = false; - m_window->window()->showNormal(); - } - - if (width <= 0 || height <= 0) { - if (!m_normalSize.isEmpty()) - m_window->configure(0, m_normalSize.width(), m_normalSize.height()); - } else { - m_window->configure(0, width, height); - } - - ack_configure(serial); + m_window->applyConfigureWhenPossible(); } void QWaylandXdgSurface::xdg_surface_close() diff --git a/src/plugins/platforms/wayland/qwaylandxdgsurface_p.h b/src/plugins/platforms/wayland/qwaylandxdgsurface_p.h index b8dd93f476a..059e79d8736 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgsurface_p.h +++ b/src/plugins/platforms/wayland/qwaylandxdgsurface_p.h @@ -96,26 +96,23 @@ public: void setWindowFlags(Qt::WindowFlags flags) override; void sendProperty(const QString &name, const QVariant &value) override; - bool isFullscreen() const { return m_fullscreen; } - bool isMaximized() const { return m_maximized; } - void setType(Qt::WindowType type, QWaylandWindow *transientParent) override; + void applyConfigure() override; + void requestWindowStates(Qt::WindowStates states) override; + bool wantsDecorations() const override; private: - void setMaximized() override; - void setFullscreen() override; - void setNormal() override; - void setMinimized() override; - void updateTransientParent(QWaylandWindow *parent); private: QWaylandWindow *m_window = nullptr; QWaylandXdgShell* m_shell = nullptr; - bool m_maximized = false; - bool m_minimized = false; - bool m_fullscreen = false; - bool m_active = false; + struct { + Qt::WindowStates states = Qt::WindowNoState; + bool isResizing = false; + QSize size = {0, 0}; + uint serial = 0; + } m_acked, m_pending; QSize m_normalSize; QMargins m_margins; QWaylandExtendedSurface *m_extendedWindow = nullptr; diff --git a/tests/auto/wayland/client/tst_client.cpp b/tests/auto/wayland/client/tst_client.cpp index 05b8bac1afa..7a7c7fa857c 100644 --- a/tests/auto/wayland/client/tst_client.cpp +++ b/tests/auto/wayland/client/tst_client.cpp @@ -172,6 +172,7 @@ private slots: void windowScreens(); void removePrimaryScreen(); void createDestroyWindow(); + void activeWindowFollowsKeyboardFocus(); void events(); void backingStore(); void touchDrag(); @@ -313,6 +314,31 @@ void tst_WaylandClient::createDestroyWindow() QTRY_VERIFY(!compositor->surface()); } +void tst_WaylandClient::activeWindowFollowsKeyboardFocus() +{ + TestWindow window; + window.show(); + + QSharedPointer surface; + QTRY_VERIFY(surface = compositor->surface()); + compositor->sendShellSurfaceConfigure(surface); + + QTRY_VERIFY(window.isExposed()); + + if (compositor->xdgToplevelV6()) + QSKIP("On xdg-shell v6 focus is handled by configure events"); + + QCOMPARE(window.focusInEventCount, 0); + compositor->setKeyboardFocus(surface); + QTRY_COMPARE(window.focusInEventCount, 1); + QTRY_COMPARE(QGuiApplication::focusWindow(), &window); + + QCOMPARE(window.focusOutEventCount, 0); + compositor->setKeyboardFocus(QSharedPointer(nullptr)); + QTRY_COMPARE(window.focusOutEventCount, 1); + QTRY_COMPARE(QGuiApplication::focusWindow(), static_cast(nullptr)); +} + void tst_WaylandClient::events() { TestWindow window; @@ -324,20 +350,10 @@ void tst_WaylandClient::events() QTRY_VERIFY(window.isExposed()); - QCOMPARE(window.focusInEventCount, 0); compositor->setKeyboardFocus(surface); QTRY_COMPARE(window.focusInEventCount, 1); QTRY_COMPARE(QGuiApplication::focusWindow(), &window); - QCOMPARE(window.focusOutEventCount, 0); - compositor->setKeyboardFocus(QSharedPointer(nullptr)); - QTRY_COMPARE(window.focusOutEventCount, 1); - QTRY_COMPARE(QGuiApplication::focusWindow(), static_cast(nullptr)); - - compositor->setKeyboardFocus(surface); - QTRY_COMPARE(window.focusInEventCount, 2); - QTRY_COMPARE(QGuiApplication::focusWindow(), &window); - uint keyCode = 80; // arbitrarily chosen QCOMPARE(window.keyPressEventCount, 0); compositor->sendKeyPress(surface, keyCode); diff --git a/tests/auto/wayland/shared/mockcompositor.cpp b/tests/auto/wayland/shared/mockcompositor.cpp index 9ef08ad953e..11b40d9fc84 100644 --- a/tests/auto/wayland/shared/mockcompositor.cpp +++ b/tests/auto/wayland/shared/mockcompositor.cpp @@ -236,11 +236,14 @@ void MockCompositor::sendIviSurfaceConfigure(const QSharedPointer toplevel, const QSize &size) +void MockCompositor::sendXdgToplevelV6Configure(const QSharedPointer toplevel, const QSize &size, const QVector &states) { Command command = makeCommand(Impl::Compositor::sendXdgToplevelV6Configure, m_compositor); command.parameters << QVariant::fromValue(toplevel); command.parameters << QVariant::fromValue(size); + auto statesBytes = QByteArray::fromRawData(reinterpret_cast(states.data()), + states.size() * static_cast(sizeof(uint))); + command.parameters << statesBytes; processCommand(command); } diff --git a/tests/auto/wayland/shared/mockcompositor.h b/tests/auto/wayland/shared/mockcompositor.h index 34c20943a46..d3568c1654c 100644 --- a/tests/auto/wayland/shared/mockcompositor.h +++ b/tests/auto/wayland/shared/mockcompositor.h @@ -175,12 +175,21 @@ private: Q_DECLARE_METATYPE(QSharedPointer) -class MockXdgToplevelV6 +class MockXdgToplevelV6 : public QObject { + Q_OBJECT public: Impl::XdgToplevelV6 *handle() const { return m_toplevel; } void sendConfigure(const QSharedPointer toplevel); + +signals: + uint setMinimizedRequested(); + uint setMaximizedRequested(); + uint unsetMaximizedRequested(); + uint setFullscreenRequested(); + uint unsetFullscreenRequested(); + private: MockXdgToplevelV6(Impl::XdgToplevelV6 *toplevel) : m_toplevel(toplevel) {} friend class Impl::Compositor; @@ -234,7 +243,8 @@ public: void sendSurfaceLeave(const QSharedPointer &surface, QSharedPointer &output); void sendShellSurfaceConfigure(const QSharedPointer surface, const QSize &size = QSize(0, 0)); void sendIviSurfaceConfigure(const QSharedPointer iviSurface, const QSize &size); - void sendXdgToplevelV6Configure(const QSharedPointer toplevel, const QSize &size = QSize(0, 0)); + void sendXdgToplevelV6Configure(const QSharedPointer toplevel, const QSize &size = QSize(0, 0), + const QVector &states = { ZXDG_TOPLEVEL_V6_STATE_ACTIVATED }); void waitForStartDrag(); QSharedPointer surface(); diff --git a/tests/auto/wayland/shared/mockxdgshellv6.cpp b/tests/auto/wayland/shared/mockxdgshellv6.cpp index 39e03296d48..6f6f0b90528 100644 --- a/tests/auto/wayland/shared/mockxdgshellv6.cpp +++ b/tests/auto/wayland/shared/mockxdgshellv6.cpp @@ -39,8 +39,8 @@ void Compositor::sendXdgToplevelV6Configure(void *data, const QList &p Q_ASSERT(toplevel && toplevel->resource()); QSize size = parameters.at(1).toSize(); Q_ASSERT(size.isValid()); - QByteArray states; - toplevel->send_configure(size.width(), size.height(), states); + auto statesBytes = parameters.at(2).toByteArray(); + toplevel->send_configure(size.width(), size.height(), statesBytes); toplevel->xdgSurface()->send_configure(compositor->nextSerial()); } @@ -87,6 +87,37 @@ void XdgToplevelV6::zxdg_toplevel_v6_destroy(QtWaylandServer::zxdg_toplevel_v6:: wl_resource_destroy(resource->handle); } +void XdgToplevelV6::zxdg_toplevel_v6_set_minimized(QtWaylandServer::zxdg_toplevel_v6::Resource *resource) +{ + Q_UNUSED(resource); + emit m_mockToplevel->setMinimizedRequested(); +} + +void XdgToplevelV6::zxdg_toplevel_v6_set_maximized(QtWaylandServer::zxdg_toplevel_v6::Resource *resource) +{ + Q_UNUSED(resource); + emit m_mockToplevel->setMaximizedRequested(); +} + +void XdgToplevelV6::zxdg_toplevel_v6_unset_maximized(QtWaylandServer::zxdg_toplevel_v6::Resource *resource) +{ + Q_UNUSED(resource); + emit m_mockToplevel->unsetMaximizedRequested(); +} + +void XdgToplevelV6::zxdg_toplevel_v6_set_fullscreen(QtWaylandServer::zxdg_toplevel_v6::Resource *resource, wl_resource *output) +{ + Q_UNUSED(resource); + Q_UNUSED(output); + emit m_mockToplevel->setFullscreenRequested(); +} + +void XdgToplevelV6::zxdg_toplevel_v6_unset_fullscreen(QtWaylandServer::zxdg_toplevel_v6::Resource *resource) +{ + Q_UNUSED(resource); + emit m_mockToplevel->unsetFullscreenRequested(); +} + void Impl::XdgShellV6::zxdg_shell_v6_get_xdg_surface(QtWaylandServer::zxdg_shell_v6::Resource *resource, uint32_t id, wl_resource *surface) { new XdgSurfaceV6(this, Surface::fromResource(surface), resource->client(), id); diff --git a/tests/auto/wayland/shared/mockxdgshellv6.h b/tests/auto/wayland/shared/mockxdgshellv6.h index 92b808ba82a..faadb785a0d 100644 --- a/tests/auto/wayland/shared/mockxdgshellv6.h +++ b/tests/auto/wayland/shared/mockxdgshellv6.h @@ -74,6 +74,11 @@ public: protected: void zxdg_toplevel_v6_destroy_resource(Resource *) override { delete this; } void zxdg_toplevel_v6_destroy(Resource *resource) override; + void zxdg_toplevel_v6_set_minimized(Resource *resource) override; + void zxdg_toplevel_v6_set_maximized(Resource *resource) override; + void zxdg_toplevel_v6_unset_maximized(Resource *resource) override; + void zxdg_toplevel_v6_set_fullscreen(Resource *resource, struct ::wl_resource *output) override; + void zxdg_toplevel_v6_unset_fullscreen(Resource *resource) override; private: XdgSurfaceV6 *m_xdgSurface = nullptr; diff --git a/tests/auto/wayland/xdgshellv6/tst_xdgshellv6.cpp b/tests/auto/wayland/xdgshellv6/tst_xdgshellv6.cpp index 364cd1099f7..0f72f58a9cf 100644 --- a/tests/auto/wayland/xdgshellv6/tst_xdgshellv6.cpp +++ b/tests/auto/wayland/xdgshellv6/tst_xdgshellv6.cpp @@ -42,6 +42,7 @@ static const QSize screenSize(1600, 1200); class TestWindow : public QWindow { + Q_OBJECT public: TestWindow() { @@ -49,6 +50,16 @@ public: setGeometry(0, 0, 32, 32); create(); } + + bool event(QEvent *event) override + { + if (event->type() == QEvent::WindowStateChange) + emit windowStateChangeEventReceived(static_cast(event)->oldState()); + return QWindow::event(event); + } + +signals: + void windowStateChangeEventReceived(uint oldState); }; class tst_WaylandClientXdgShellV6 : public QObject @@ -58,6 +69,7 @@ public: tst_WaylandClientXdgShellV6(MockCompositor *c) : m_compositor(c) { + qRegisterMetaType(); QSocketNotifier *notifier = new QSocketNotifier(m_compositor->waylandFileDescriptor(), QSocketNotifier::Read, this); connect(notifier, &QSocketNotifier::activated, this, &tst_WaylandClientXdgShellV6::processWaylandEvents); // connect to the event dispatcher to make sure to flush out the outgoing message queue @@ -82,6 +94,11 @@ public slots: private slots: void createDestroyWindow(); void configure(); + void showMinimized(); + void setMinimized(); + void unsetMaximized(); + void focusWindowFollowsConfigure(); + void windowStateChangedEvents(); private: MockCompositor *m_compositor = nullptr; @@ -118,10 +135,182 @@ void tst_WaylandClientXdgShellV6::configure() QSharedPointer toplevel; QTRY_VERIFY(toplevel = m_compositor->xdgToplevelV6()); + const QSize newSize(123, 456); m_compositor->sendXdgToplevelV6Configure(toplevel, newSize); QTRY_VERIFY(window.isExposed()); + QTRY_COMPARE(window.visibility(), QWindow::Windowed); + QTRY_COMPARE(window.windowStates(), Qt::WindowNoState); QTRY_COMPARE(window.frameGeometry(), QRect(QPoint(), newSize)); + + m_compositor->sendXdgToplevelV6Configure(toplevel, screenSize, { ZXDG_TOPLEVEL_V6_STATE_ACTIVATED, ZXDG_TOPLEVEL_V6_STATE_MAXIMIZED }); + QTRY_COMPARE(window.visibility(), QWindow::Maximized); + QTRY_COMPARE(window.windowStates(), Qt::WindowMaximized); + QTRY_COMPARE(window.frameGeometry(), QRect(QPoint(), screenSize)); + + m_compositor->sendXdgToplevelV6Configure(toplevel, screenSize, { ZXDG_TOPLEVEL_V6_STATE_ACTIVATED, ZXDG_TOPLEVEL_V6_STATE_FULLSCREEN }); + QTRY_COMPARE(window.visibility(), QWindow::FullScreen); + QTRY_COMPARE(window.windowStates(), Qt::WindowFullScreen); + QTRY_COMPARE(window.frameGeometry(), QRect(QPoint(), screenSize)); + + //The window should remember it's original size + m_compositor->sendXdgToplevelV6Configure(toplevel, QSize(0, 0), { ZXDG_TOPLEVEL_V6_STATE_ACTIVATED }); + QTRY_COMPARE(window.visibility(), QWindow::Windowed); + QTRY_COMPARE(window.windowStates(), Qt::WindowNoState); + QTRY_COMPARE(window.frameGeometry(), QRect(QPoint(), newSize)); +} + +void tst_WaylandClientXdgShellV6::showMinimized() +{ + // On xdg-shell v6 there's really no way for the compositor to tell the window if it's minimized + // There are wl_surface.enter events and so on, but there's really no way to differentiate + // between a window preview and an unminimized window. + TestWindow window; + window.showMinimized(); + QCOMPARE(window.windowStates(), Qt::WindowMinimized); // should return minimized until + QTRY_COMPARE(window.windowStates(), Qt::WindowNoState); // rejected by handleWindowStateChanged +} + +void tst_WaylandClientXdgShellV6::setMinimized() +{ + TestWindow window; + window.show(); + + QSharedPointer toplevel; + QTRY_VERIFY(toplevel = m_compositor->xdgToplevelV6()); + + m_compositor->sendXdgToplevelV6Configure(toplevel); + QTRY_COMPARE(window.visibility(), QWindow::Windowed); + QTRY_COMPARE(window.windowStates(), Qt::WindowNoState); + + QSignalSpy setMinimizedSpy(toplevel.data(), SIGNAL(setMinimizedRequested())); + QSignalSpy windowStateChangeSpy(&window, SIGNAL(windowStateChangeEventReceived(uint))); + + window.setVisibility(QWindow::Minimized); + QCOMPARE(window.visibility(), QWindow::Minimized); + QCOMPARE(window.windowStates(), Qt::WindowMinimized); + QTRY_COMPARE(setMinimizedSpy.count(), 1); + { + QTRY_VERIFY(windowStateChangeSpy.count() > 0); + Qt::WindowStates oldStates(windowStateChangeSpy.takeFirst().at(0).toUInt()); + QCOMPARE(oldStates, Qt::WindowNoState); + } + + // In the meantime the compositor may minimize, do nothing or reshow the window without + // telling us. + + QTRY_COMPARE(window.visibility(), QWindow::Windowed); // verify that we don't know anything + QTRY_COMPARE(window.windowStates(), Qt::WindowNoState); + { + QTRY_COMPARE(windowStateChangeSpy.count(), 1); + Qt::WindowStates oldStates(windowStateChangeSpy.takeFirst().at(0).toUInt()); + QCOMPARE(oldStates, Qt::WindowNoState); // because the window never was minimized + } + + // Setting visibility again should send another set_minimized request + window.setVisibility(QWindow::Minimized); + QTRY_COMPARE(setMinimizedSpy.count(), 2); +} + +void tst_WaylandClientXdgShellV6::unsetMaximized() +{ + TestWindow window; + window.show(); + + QSharedPointer toplevel; + QTRY_VERIFY(toplevel = m_compositor->xdgToplevelV6()); + + QSignalSpy unsetMaximizedSpy(toplevel.data(), SIGNAL(unsetMaximizedRequested())); + + QSignalSpy windowStateChangedSpy(&window, SIGNAL(windowStateChanged(Qt::WindowState))); + + m_compositor->sendXdgToplevelV6Configure(toplevel, screenSize, { ZXDG_TOPLEVEL_V6_STATE_MAXIMIZED }); + + QTRY_COMPARE(windowStateChangedSpy.count(), 1); + QCOMPARE(windowStateChangedSpy.takeFirst().at(0).toUInt(), Qt::WindowMaximized); + + window.setWindowStates(Qt::WindowNoState); + + QTRY_COMPARE(unsetMaximizedSpy.count(), 1); + QTRY_COMPARE(windowStateChangedSpy.count(), 1); + QCOMPARE(windowStateChangedSpy.takeFirst().at(0).toUInt(), Qt::WindowNoState); + + m_compositor->sendXdgToplevelV6Configure(toplevel, QSize(0, 0), {}); + + QTRY_COMPARE(windowStateChangedSpy.count(), 1); + QCOMPARE(windowStateChangedSpy.takeFirst().at(0).toUInt(), Qt::WindowNoState); +} + +void tst_WaylandClientXdgShellV6::focusWindowFollowsConfigure() +{ + TestWindow window; + window.show(); + + QSharedPointer toplevel; + QTRY_VERIFY(toplevel = m_compositor->xdgToplevelV6()); + QTRY_VERIFY(!window.isActive()); + + QSignalSpy windowStateChangeSpy(&window, SIGNAL(windowStateChangeEventReceived(uint))); + + m_compositor->sendXdgToplevelV6Configure(toplevel, QSize(0, 0), { ZXDG_TOPLEVEL_V6_STATE_ACTIVATED }); + QTRY_VERIFY(window.isActive()); + + m_compositor->sendXdgToplevelV6Configure(toplevel, QSize(0, 0), {}); + QTRY_VERIFY(!window.isActive()); +} + +void tst_WaylandClientXdgShellV6::windowStateChangedEvents() +{ + TestWindow window; + window.show(); + + QSharedPointer toplevel; + QTRY_VERIFY(toplevel = m_compositor->xdgToplevelV6()); + + QSignalSpy eventSpy(&window, SIGNAL(windowStateChangeEventReceived(uint))); + QSignalSpy signalSpy(&window, SIGNAL(windowStateChanged(Qt::WindowState))); + + m_compositor->sendXdgToplevelV6Configure(toplevel, screenSize, { ZXDG_TOPLEVEL_V6_STATE_MAXIMIZED }); + + QTRY_COMPARE(window.windowStates(), Qt::WindowMaximized); + QTRY_COMPARE(window.windowState(), Qt::WindowMaximized); + { + QTRY_COMPARE(eventSpy.count(), 1); + Qt::WindowStates oldStates(eventSpy.takeFirst().at(0).toUInt()); + QCOMPARE(oldStates, Qt::WindowNoState); + + QTRY_COMPARE(signalSpy.count(), 1); + uint newState = signalSpy.takeFirst().at(0).toUInt(); + QCOMPARE(newState, Qt::WindowMaximized); + } + + m_compositor->sendXdgToplevelV6Configure(toplevel, screenSize, { ZXDG_TOPLEVEL_V6_STATE_FULLSCREEN }); + + QTRY_COMPARE(window.windowStates(), Qt::WindowFullScreen); + QTRY_COMPARE(window.windowState(), Qt::WindowFullScreen); + { + QTRY_COMPARE(eventSpy.count(), 1); + Qt::WindowStates oldStates(eventSpy.takeFirst().at(0).toUInt()); + QCOMPARE(oldStates, Qt::WindowMaximized); + + QTRY_COMPARE(signalSpy.count(), 1); + uint newState = signalSpy.takeFirst().at(0).toUInt(); + QCOMPARE(newState, Qt::WindowFullScreen); + } + + m_compositor->sendXdgToplevelV6Configure(toplevel, QSize(0, 0), {}); + + QTRY_COMPARE(window.windowStates(), Qt::WindowNoState); + QTRY_COMPARE(window.windowState(), Qt::WindowNoState); + { + QTRY_COMPARE(eventSpy.count(), 1); + Qt::WindowStates oldStates(eventSpy.takeFirst().at(0).toUInt()); + QCOMPARE(oldStates, Qt::WindowFullScreen); + + QTRY_COMPARE(signalSpy.count(), 1); + uint newState = signalSpy.takeFirst().at(0).toUInt(); + QCOMPARE(newState, Qt::WindowNoState); + } } int main(int argc, char **argv) From b2a8bcb9c431b470fb0d64ab51165ec46542b440 Mon Sep 17 00:00:00 2001 From: Gatis Paeglis Date: Mon, 7 May 2018 08:25:03 +0200 Subject: [PATCH 0517/1507] update to use new dnd APIs For details see qtbase/10b3286313c78fa380b5fe676a7c14f3ae84f017 Change-Id: I197b2c158a0ffcb21cab973169c6257afa3d2c06 Reviewed-by: Johan Helsing --- src/plugins/platforms/wayland/qwaylanddnd.cpp | 8 ++++++-- src/plugins/platforms/wayland/qwaylanddnd_p.h | 4 ++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylanddnd.cpp b/src/plugins/platforms/wayland/qwaylanddnd.cpp index fe620506d52..b01a9db3614 100644 --- a/src/plugins/platforms/wayland/qwaylanddnd.cpp +++ b/src/plugins/platforms/wayland/qwaylanddnd.cpp @@ -77,15 +77,19 @@ void QWaylandDrag::cancel() m_display->currentInputDevice()->dataDevice()->cancelDrag(); } -void QWaylandDrag::move(const QPoint &globalPos) +void QWaylandDrag::move(const QPoint &globalPos, Qt::MouseButtons b, Qt::KeyboardModifiers mods) { Q_UNUSED(globalPos); + Q_UNUSED(b); + Q_UNUSED(mods); // Do nothing } -void QWaylandDrag::drop(const QPoint &globalPos) +void QWaylandDrag::drop(const QPoint &globalPos, Qt::MouseButtons b, Qt::KeyboardModifiers mods) { Q_UNUSED(globalPos); + Q_UNUSED(b); + Q_UNUSED(mods); // Do nothing } diff --git a/src/plugins/platforms/wayland/qwaylanddnd_p.h b/src/plugins/platforms/wayland/qwaylanddnd_p.h index 04b39826c27..474fe2ab105 100644 --- a/src/plugins/platforms/wayland/qwaylanddnd_p.h +++ b/src/plugins/platforms/wayland/qwaylanddnd_p.h @@ -78,8 +78,8 @@ public: protected: void startDrag() override; void cancel() override; - void move(const QPoint &globalPos) override; - void drop(const QPoint &globalPos) override; + void move(const QPoint &globalPos, Qt::MouseButtons b, Qt::KeyboardModifiers mods) override; + void drop(const QPoint &globalPos, Qt::MouseButtons b, Qt::KeyboardModifiers mods) override; void endDrag() override; From 4f292a12269c41b53cb0d5fb2ef63a824216070e Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Tue, 8 May 2018 16:31:55 +0200 Subject: [PATCH 0518/1507] Fix QWaylandXdgShellV6Integration::handleKeyboardFocusChanged The implementation was broken because it: 1. Didn't activate popups. 2. Activated toplevels with keyboard focus twice. 3. Tried to cast to xdg-shell-v5 classes, so windows were never deactivated. Change-Id: If492ebdbcd10a3214424f7bf6ac01e7ba8704bbf Reviewed-by: Paul Olav Tvete --- .../platforms/wayland/qwaylandxdgshellv6integration.cpp | 9 +++------ tests/auto/wayland/shared/mocksurface.cpp | 5 ++++- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandxdgshellv6integration.cpp b/src/plugins/platforms/wayland/qwaylandxdgshellv6integration.cpp index d3327ff39a8..2713ac37b9f 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgshellv6integration.cpp +++ b/src/plugins/platforms/wayland/qwaylandxdgshellv6integration.cpp @@ -41,9 +41,6 @@ #include #include -#include -#include -#include #include QT_BEGIN_NAMESPACE @@ -82,12 +79,12 @@ void QWaylandXdgShellV6Integration::handleKeyboardFocusChanged(QWaylandWindow *n { if (newFocus) { auto *xdgSurface = qobject_cast(newFocus->shellSurface()); - if (xdgSurface && xdgSurface->handlesActiveState()) + if (xdgSurface && !xdgSurface->handlesActiveState()) m_display->handleWindowActivated(newFocus); } - if (oldFocus && qobject_cast(oldFocus->shellSurface())) { + if (oldFocus && qobject_cast(oldFocus->shellSurface())) { auto *xdgSurface = qobject_cast(oldFocus->shellSurface()); - if (xdgSurface && xdgSurface->handlesActiveState()) + if (xdgSurface && !xdgSurface->handlesActiveState()) m_display->handleWindowDeactivated(oldFocus); } } diff --git a/tests/auto/wayland/shared/mocksurface.cpp b/tests/auto/wayland/shared/mocksurface.cpp index 81a865f1194..82ce37acb4c 100644 --- a/tests/auto/wayland/shared/mocksurface.cpp +++ b/tests/auto/wayland/shared/mocksurface.cpp @@ -70,7 +70,10 @@ void Compositor::sendShellSurfaceConfigure(void *data, const QList &pa QSize size = parameters.at(1).toSize(); Q_ASSERT(size.isValid()); if (auto toplevel = surface->xdgToplevelV6()) { - toplevel->send_configure(size.width(), size.height(), QByteArray()); + QVector states = { ZXDG_TOPLEVEL_V6_STATE_ACTIVATED }; + auto statesBytes = QByteArray::fromRawData(reinterpret_cast(states.data()), + states.size() * static_cast(sizeof(uint))); + toplevel->send_configure(size.width(), size.height(), statesBytes); toplevel->xdgSurface()->send_configure(compositor->nextSerial()); } else if (auto wlShellSurface = surface->wlShellSurface()) { const uint edges = 0; From 7ef6c33a690cc1152ff3a049c9fcc578752d944a Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Tue, 8 May 2018 16:31:16 +0200 Subject: [PATCH 0519/1507] Move xdg-shell-v5 to a plugin This is the first step in deprecating xdg-shell unstable v5 and making the good names available for the good names for xdg-shell stable. Shell initialization has been refactored slightly, so the QWaylandShellIntegrationFactory actually tries to initialize the shell integration before returning it. Similarly for the factory method of non-plugin shells. Change-Id: I85e60594c4fc03c6f302c04316110aed428d28dc Reviewed-by: Paul Olav Tvete --- src/plugins/platforms/wayland/client.pro | 9 --- .../shellintegration/shellintegration.pro | 4 +- .../shellintegration/xdg-shell-v5/main.cpp | 70 +++++++++++++++++++ .../xdg-shell-v5}/qwaylandxdgpopup.cpp | 6 +- .../xdg-shell-v5}/qwaylandxdgpopup_p.h | 3 +- .../xdg-shell-v5}/qwaylandxdgshell.cpp | 10 +-- .../xdg-shell-v5}/qwaylandxdgshell_p.h | 3 +- .../qwaylandxdgshellintegration.cpp | 28 +++----- .../qwaylandxdgshellintegration_p.h | 8 +-- .../xdg-shell-v5}/qwaylandxdgsurface.cpp | 16 ++--- .../xdg-shell-v5}/qwaylandxdgsurface_p.h | 9 +-- .../xdg-shell-v5/xdg-shell-v5.json | 3 + .../xdg-shell-v5/xdg-shell-v5.pro | 30 ++++++++ .../platforms/wayland/qwaylanddisplay.cpp | 3 - .../platforms/wayland/qwaylanddisplay_p.h | 1 - .../platforms/wayland/qwaylandintegration.cpp | 12 ++-- .../platforms/wayland/qwaylandwindow.cpp | 1 - .../wayland/qwaylandwlshellintegration.cpp | 12 +++- .../wayland/qwaylandxdgshellv6integration.cpp | 12 +++- .../qwaylandshellintegrationfactory.cpp | 17 +++-- .../qwaylandshellintegrationfactory_p.h | 5 +- 21 files changed, 183 insertions(+), 79 deletions(-) create mode 100644 src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/main.cpp rename src/plugins/platforms/wayland/{ => plugins/shellintegration/xdg-shell-v5}/qwaylandxdgpopup.cpp (93%) rename src/plugins/platforms/wayland/{ => plugins/shellintegration/xdg-shell-v5}/qwaylandxdgpopup_p.h (98%) rename src/plugins/platforms/wayland/{ => plugins/shellintegration/xdg-shell-v5}/qwaylandxdgshell.cpp (94%) rename src/plugins/platforms/wayland/{ => plugins/shellintegration/xdg-shell-v5}/qwaylandxdgshell_p.h (98%) rename src/plugins/platforms/wayland/{ => plugins/shellintegration/xdg-shell-v5}/qwaylandxdgshellintegration.cpp (82%) rename src/plugins/platforms/wayland/{ => plugins/shellintegration/xdg-shell-v5}/qwaylandxdgshellintegration_p.h (93%) rename src/plugins/platforms/wayland/{ => plugins/shellintegration/xdg-shell-v5}/qwaylandxdgsurface.cpp (94%) rename src/plugins/platforms/wayland/{ => plugins/shellintegration/xdg-shell-v5}/qwaylandxdgsurface_p.h (98%) create mode 100644 src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/xdg-shell-v5.json create mode 100644 src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/xdg-shell-v5.pro diff --git a/src/plugins/platforms/wayland/client.pro b/src/plugins/platforms/wayland/client.pro index eae7ad52ea2..1bcd6780c5b 100644 --- a/src/plugins/platforms/wayland/client.pro +++ b/src/plugins/platforms/wayland/client.pro @@ -28,7 +28,6 @@ WAYLANDCLIENTSOURCES += \ ../extensions/qtkey-extension.xml \ ../extensions/qt-windowmanager.xml \ ../3rdparty/protocol/text-input-unstable-v2.xml \ - ../3rdparty/protocol/xdg-shell.xml \ ../3rdparty/protocol/xdg-shell-unstable-v6.xml \ WAYLANDCLIENTSOURCES_SYSTEM += \ @@ -45,10 +44,6 @@ SOURCES += qwaylandintegration.cpp \ qwaylandshellsurface.cpp \ qwaylandwlshellsurface.cpp \ qwaylandwlshellintegration.cpp \ - qwaylandxdgshell.cpp \ - qwaylandxdgsurface.cpp \ - qwaylandxdgpopup.cpp \ - qwaylandxdgshellintegration.cpp \ qwaylandxdgshellv6.cpp \ qwaylandxdgshellv6integration.cpp \ qwaylandextendedsurface.cpp \ @@ -78,10 +73,6 @@ HEADERS += qwaylandintegration_p.h \ qwaylandshellsurface_p.h \ qwaylandwlshellsurface_p.h \ qwaylandwlshellintegration_p.h \ - qwaylandxdgshell_p.h \ - qwaylandxdgsurface_p.h \ - qwaylandxdgpopup_p.h \ - qwaylandxdgshellintegration_p.h \ qwaylandxdgshellv6_p.h \ qwaylandxdgshellv6integration_p.h \ qwaylandextendedsurface_p.h \ diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/shellintegration.pro b/src/plugins/platforms/wayland/plugins/shellintegration/shellintegration.pro index 9867d2b4035..7f465d61b4c 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/shellintegration.pro +++ b/src/plugins/platforms/wayland/plugins/shellintegration/shellintegration.pro @@ -1,3 +1,5 @@ TEMPLATE = subdirs -SUBDIRS += ivi-shell +SUBDIRS += \ + ivi-shell \ + xdg-shell-v5 diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/main.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/main.cpp new file mode 100644 index 00000000000..3df1beaf953 --- /dev/null +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/main.cpp @@ -0,0 +1,70 @@ +/**************************************************************************** +** +** Copyright (C) 2018 The Qt Company Ltd. +** Copyright (C) 2017 ITAGE Corporation, author: +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qwaylandxdgshellintegration_p.h" + +#include + +QT_BEGIN_NAMESPACE + +namespace QtWaylandClient { + +class QWaylandXdgShellV5IntegrationPlugin : public QWaylandShellIntegrationPlugin +{ + Q_OBJECT + Q_PLUGIN_METADATA(IID QWaylandShellIntegrationFactoryInterface_iid FILE "xdg-shell-v5.json") + +public: + QWaylandShellIntegration *create(const QString &key, const QStringList ¶mList) override; +}; + +QWaylandShellIntegration *QWaylandXdgShellV5IntegrationPlugin::create(const QString &key, const QStringList ¶mList) +{ + qDebug() << Q_FUNC_INFO; + Q_UNUSED(key); + Q_UNUSED(paramList); + return new QWaylandXdgShellIntegration(); +} + +} + +QT_END_NAMESPACE + +#include "main.moc" diff --git a/src/plugins/platforms/wayland/qwaylandxdgpopup.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgpopup.cpp similarity index 93% rename from src/plugins/platforms/wayland/qwaylandxdgpopup.cpp rename to src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgpopup.cpp index 46a12a828a1..04849355f5e 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgpopup.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgpopup.cpp @@ -39,9 +39,9 @@ #include "qwaylandxdgpopup_p.h" -#include "qwaylandwindow_p.h" -#include "qwaylanddisplay_p.h" -#include "qwaylandextendedsurface_p.h" +#include +#include +#include QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandxdgpopup_p.h b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgpopup_p.h similarity index 98% rename from src/plugins/platforms/wayland/qwaylandxdgpopup_p.h rename to src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgpopup_p.h index b027c05dc72..d9f7deec642 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgpopup_p.h +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgpopup_p.h @@ -51,10 +51,11 @@ // We mean it. // +#include "qwayland-xdg-shell.h" + #include #include -#include #include QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandxdgshell.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshell.cpp similarity index 94% rename from src/plugins/platforms/wayland/qwaylandxdgshell.cpp rename to src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshell.cpp index 9a34e72dd1c..bd76346d2ae 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgshell.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshell.cpp @@ -38,16 +38,16 @@ ****************************************************************************/ #include "qwaylandxdgshell_p.h" - -#include "qwaylanddisplay_p.h" -#include "qwaylandwindow_p.h" -#include "qwaylandinputdevice_p.h" -#include "qwaylandscreen_p.h" #include "qwaylandxdgpopup_p.h" #include "qwaylandxdgsurface_p.h" #include +#include +#include +#include +#include + QT_BEGIN_NAMESPACE namespace QtWaylandClient { diff --git a/src/plugins/platforms/wayland/qwaylandxdgshell_p.h b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshell_p.h similarity index 98% rename from src/plugins/platforms/wayland/qwaylandxdgshell_p.h rename to src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshell_p.h index 761f25218f6..9341c7a8fb4 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgshell_p.h +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshell_p.h @@ -51,12 +51,13 @@ // We mean it. // +#include "qwayland-xdg-shell.h" + #include #include #include -#include #include #include diff --git a/src/plugins/platforms/wayland/qwaylandxdgshellintegration.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshellintegration.cpp similarity index 82% rename from src/plugins/platforms/wayland/qwaylandxdgshellintegration.cpp rename to src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshellintegration.cpp index ee72c2d5212..0d0e8aba3ac 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgshellintegration.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshellintegration.cpp @@ -38,38 +38,32 @@ ****************************************************************************/ #include "qwaylandxdgshellintegration_p.h" +#include "qwaylandxdgsurface_p.h" +#include "qwaylandxdgpopup_p.h" +#include "qwaylandxdgshell_p.h" #include #include -#include -#include -#include QT_BEGIN_NAMESPACE namespace QtWaylandClient { -QWaylandXdgShellIntegration *QWaylandXdgShellIntegration::create(QWaylandDisplay *display) -{ - if (display->hasRegistryGlobal(QLatin1String("xdg_shell"))) - return new QWaylandXdgShellIntegration(display); - return nullptr; -} - -QWaylandXdgShellIntegration::QWaylandXdgShellIntegration(QWaylandDisplay *display) +bool QWaylandXdgShellIntegration::initialize(QWaylandDisplay *display) { Q_FOREACH (QWaylandDisplay::RegistryGlobal global, display->globals()) { if (global.interface == QLatin1String("xdg_shell")) { - m_xdgShell = new QWaylandXdgShell(display->wl_registry(), global.id); + m_xdgShell.reset(new QWaylandXdgShell(display->wl_registry(), global.id)); break; } } -} -bool QWaylandXdgShellIntegration::initialize(QWaylandDisplay *display) -{ - QWaylandShellIntegration::initialize(display); - return m_xdgShell != nullptr; + if (!m_xdgShell) { + qWarning() << "Couldn't find global xdg_shell for xdg-shell unstable v5"; + return false; + } + + return QWaylandShellIntegration::initialize(display); } QWaylandShellSurface *QWaylandXdgShellIntegration::createShellSurface(QWaylandWindow *window) diff --git a/src/plugins/platforms/wayland/qwaylandxdgshellintegration_p.h b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshellintegration_p.h similarity index 93% rename from src/plugins/platforms/wayland/qwaylandxdgshellintegration_p.h rename to src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshellintegration_p.h index ed307a5de8b..a3ff86cd763 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgshellintegration_p.h +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshellintegration_p.h @@ -51,7 +51,7 @@ // We mean it. // -#include +#include "qwaylandxdgshell_p.h" #include @@ -64,15 +64,13 @@ class QWaylandXdgShell; class Q_WAYLAND_CLIENT_EXPORT QWaylandXdgShellIntegration : public QWaylandShellIntegration { public: - static QWaylandXdgShellIntegration *create(QWaylandDisplay* display); + QWaylandXdgShellIntegration() {qDebug() << Q_FUNC_INFO;} bool initialize(QWaylandDisplay *display) override; QWaylandShellSurface *createShellSurface(QWaylandWindow *window) override; void handleKeyboardFocusChanged(QWaylandWindow *newFocus, QWaylandWindow *oldFocus) override; private: - QWaylandXdgShellIntegration(QWaylandDisplay *display); - - QWaylandXdgShell *m_xdgShell = nullptr; + QScopedPointer m_xdgShell; }; } diff --git a/src/plugins/platforms/wayland/qwaylandxdgsurface.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgsurface.cpp similarity index 94% rename from src/plugins/platforms/wayland/qwaylandxdgsurface.cpp rename to src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgsurface.cpp index 5b5aacbf4d6..ec096540a3d 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgsurface.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgsurface.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2018 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the config.tests of the Qt Toolkit. @@ -38,15 +38,15 @@ ****************************************************************************/ #include "qwaylandxdgsurface_p.h" - -#include "qwaylanddisplay_p.h" -#include "qwaylandwindow_p.h" -#include "qwaylandinputdevice_p.h" -#include "qwaylandabstractdecoration_p.h" -#include "qwaylandscreen_p.h" -#include "qwaylandextendedsurface_p.h" #include "qwaylandxdgshell_p.h" +#include +#include +#include +#include +#include +#include +#include QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandxdgsurface_p.h b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgsurface_p.h similarity index 98% rename from src/plugins/platforms/wayland/qwaylandxdgsurface_p.h rename to src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgsurface_p.h index 059e79d8736..cf4498a8372 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgsurface_p.h +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgsurface_p.h @@ -51,15 +51,16 @@ // We mean it. // +#include "qwayland-xdg-shell.h" + +#include +#include + #include #include #include -#include -#include -#include - QT_BEGIN_NAMESPACE class QWindow; diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/xdg-shell-v5.json b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/xdg-shell-v5.json new file mode 100644 index 00000000000..ba1ed448920 --- /dev/null +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/xdg-shell-v5.json @@ -0,0 +1,3 @@ +{ + "Keys":[ "xdg-shell-v5" ] +} diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/xdg-shell-v5.pro b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/xdg-shell-v5.pro new file mode 100644 index 00000000000..85052fef6f3 --- /dev/null +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/xdg-shell-v5.pro @@ -0,0 +1,30 @@ +QT += gui-private waylandclient-private +CONFIG += wayland-scanner + +QMAKE_USE += wayland-client + +qtConfig(xkbcommon-evdev): \ + QMAKE_USE += xkbcommon_evdev + +WAYLANDCLIENTSOURCES += \ + ../../../3rdparty/protocol/xdg-shell.xml + +HEADERS += \ + qwaylandxdgpopup_p.h \ + qwaylandxdgshell_p.h \ + qwaylandxdgshellintegration_p.h \ + qwaylandxdgsurface_p.h \ + +SOURCES += \ + main.cpp \ + qwaylandxdgpopup.cpp \ + qwaylandxdgshell.cpp \ + qwaylandxdgshellintegration.cpp \ + qwaylandxdgsurface.cpp \ + +OTHER_FILES += \ + xdg-shell-v5.json + +PLUGIN_TYPE = wayland-shell-integration +PLUGIN_CLASS_NAME = QWaylandXdgShellV5IntegrationPlugin +load(qt_plugin) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index a9fff410a4a..515888d4afe 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -51,8 +51,6 @@ #include "qwaylanddatadevicemanager_p.h" #endif #include "qwaylandhardwareintegration_p.h" -#include "qwaylandxdgshell_p.h" -#include "qwaylandxdgsurface_p.h" #include "qwaylandwlshellsurface_p.h" #include "qwaylandinputcontext_p.h" @@ -66,7 +64,6 @@ #include "qwaylandqtkey_p.h" #include -#include #include #include diff --git a/src/plugins/platforms/wayland/qwaylanddisplay_p.h b/src/plugins/platforms/wayland/qwaylanddisplay_p.h index a65ed320d2a..aa84a97b7b3 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay_p.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay_p.h @@ -63,7 +63,6 @@ #include #include -#include #include struct wl_cursor_image; diff --git a/src/plugins/platforms/wayland/qwaylandintegration.cpp b/src/plugins/platforms/wayland/qwaylandintegration.cpp index b804988b2cf..2a169aca652 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandintegration.cpp @@ -77,7 +77,6 @@ #include "qwaylandshellintegration_p.h" #include "qwaylandshellintegrationfactory_p.h" -#include "qwaylandxdgshellintegration_p.h" #include "qwaylandwlshellintegration_p.h" #include "qwaylandxdgshellv6integration_p.h" @@ -409,9 +408,9 @@ void QWaylandIntegration::initializeShellIntegration() } } - if (!mShellIntegration || !mShellIntegration->initialize(mDisplay.data())) { - mShellIntegration.reset(); - qWarning("Failed to load shell integration %s", qPrintable(targetKey)); + if (!mShellIntegration) { + qCWarning(lcQpaWayland) << "Loading shell integration failed."; + qCWarning(lcQpaWayland) << "Attempted to load the following shells" << preferredShells; } } @@ -445,13 +444,12 @@ QWaylandShellIntegration *QWaylandIntegration::createShellIntegration(const QStr { if (integrationName == QLatin1Literal("wl-shell")) { return QWaylandWlShellIntegration::create(mDisplay.data()); - } else if (integrationName == QLatin1Literal("xdg-shell-v5")) { - return QWaylandXdgShellIntegration::create(mDisplay.data()); } else if (integrationName == QLatin1Literal("xdg-shell-v6")) { return QWaylandXdgShellV6Integration::create(mDisplay.data()); } else if (QWaylandShellIntegrationFactory::keys().contains(integrationName)) { - return QWaylandShellIntegrationFactory::create(integrationName, QStringList()); + return QWaylandShellIntegrationFactory::create(integrationName, mDisplay.data()); } else { + qCWarning(lcQpaWayland) << "No shell integration named" << integrationName << "found"; return nullptr; } } diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 21c9f82b07b..45f9a19b2fd 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -45,7 +45,6 @@ #include "qwaylandscreen_p.h" #include "qwaylandshellsurface_p.h" #include "qwaylandwlshellsurface_p.h" -#include "qwaylandxdgsurface_p.h" #include "qwaylandsubsurface_p.h" #include "qwaylandabstractdecoration_p.h" #include "qwaylandwindowmanagerintegration_p.h" diff --git a/src/plugins/platforms/wayland/qwaylandwlshellintegration.cpp b/src/plugins/platforms/wayland/qwaylandwlshellintegration.cpp index 81c46be29e6..c76628420c0 100644 --- a/src/plugins/platforms/wayland/qwaylandwlshellintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandwlshellintegration.cpp @@ -49,9 +49,15 @@ namespace QtWaylandClient { QWaylandWlShellIntegration *QWaylandWlShellIntegration::create(QWaylandDisplay *display) { - if (display->hasRegistryGlobal(QLatin1String("wl_shell"))) - return new QWaylandWlShellIntegration(display); - return nullptr; + if (!display->hasRegistryGlobal(QLatin1String("wl_shell"))) + return nullptr; + + QScopedPointer integration; + integration.reset(new QWaylandWlShellIntegration(display)); + if (integration && !integration->initialize(display)) + return nullptr; + + return integration.take(); } QWaylandWlShellIntegration::QWaylandWlShellIntegration(QWaylandDisplay *display) diff --git a/src/plugins/platforms/wayland/qwaylandxdgshellv6integration.cpp b/src/plugins/platforms/wayland/qwaylandxdgshellv6integration.cpp index 2713ac37b9f..0eb6b592925 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgshellv6integration.cpp +++ b/src/plugins/platforms/wayland/qwaylandxdgshellv6integration.cpp @@ -59,9 +59,15 @@ QWaylandXdgShellV6Integration::QWaylandXdgShellV6Integration(QWaylandDisplay *di QWaylandXdgShellV6Integration *QWaylandXdgShellV6Integration::create(QWaylandDisplay *display) { - if (display->hasRegistryGlobal(QLatin1String("zxdg_shell_v6"))) - return new QWaylandXdgShellV6Integration(display); - return nullptr; + if (!display->hasRegistryGlobal(QLatin1String("zxdg_shell_v6"))) + return nullptr; + + QScopedPointer integration; + integration.reset(new QWaylandXdgShellV6Integration(display)); + if (integration && !integration->initialize(display)) + return nullptr; + + return integration.take(); } bool QWaylandXdgShellV6Integration::initialize(QWaylandDisplay *display) diff --git a/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationfactory.cpp b/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationfactory.cpp index c5a505bbe0b..48fda14d41b 100644 --- a/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationfactory.cpp +++ b/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationfactory.cpp @@ -78,19 +78,24 @@ QStringList QWaylandShellIntegrationFactory::keys(const QString &pluginPath) #endif } -QWaylandShellIntegration *QWaylandShellIntegrationFactory::create(const QString &name, const QStringList &args, const QString &pluginPath) +QWaylandShellIntegration *QWaylandShellIntegrationFactory::create(const QString &name, QWaylandDisplay *display, const QStringList &args, const QString &pluginPath) { #if QT_CONFIG(library) + QScopedPointer integration; + // Try loading the plugin from platformPluginPath first: if (!pluginPath.isEmpty()) { QCoreApplication::addLibraryPath(pluginPath); - if (QWaylandShellIntegration *ret = qLoadPlugin(directLoader(), name, args)) - return ret; + integration.reset(qLoadPlugin(directLoader(), name, args)); } - if (QWaylandShellIntegration *ret = qLoadPlugin(loader(), name, args)) - return ret; + if (!integration) + integration.reset(qLoadPlugin(loader(), name, args)); #endif - return nullptr; + + if (integration && !integration->initialize(display)) + return nullptr; + + return integration.take(); } } diff --git a/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationfactory_p.h b/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationfactory_p.h index 3edb0a89dbb..515a18e1f1c 100644 --- a/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationfactory_p.h +++ b/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationfactory_p.h @@ -51,7 +51,10 @@ // We mean it. // +#include + #include + #include QT_BEGIN_NAMESPACE @@ -64,7 +67,7 @@ class Q_WAYLAND_CLIENT_EXPORT QWaylandShellIntegrationFactory { public: static QStringList keys(const QString &pluginPath = QString()); - static QWaylandShellIntegration *create(const QString &name, const QStringList &args, const QString &pluginPath = QString()); + static QWaylandShellIntegration *create(const QString &name, QWaylandDisplay *display, const QStringList &args = QStringList(), const QString &pluginPath = QString()); }; } From 08d02f539273f5f516e135e57a06e90c13e86462 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Wed, 9 May 2018 14:01:07 +0200 Subject: [PATCH 0520/1507] Rename xdg-shell.xml to xdg-shell-unstable-v5.xml Also change the protocol name in the xml file from xdg_shell to xdg_shell_unstable_v5 (similar pattern as v6) because qtwaylandscanner doesn't support the file name being different from the protocol name. Change-Id: I1d9edf7c8ca512e716284250a2b2bc13e205c33c Reviewed-by: Paul Olav Tvete --- src/3rdparty/wayland/protocols/qt_attribution.json | 2 +- .../protocols/{xdg-shell.xml => xdg-shell-unstable-v5.xml} | 2 +- .../plugins/shellintegration/xdg-shell-v5/qwaylandxdgpopup_p.h | 2 +- .../plugins/shellintegration/xdg-shell-v5/qwaylandxdgshell_p.h | 2 +- .../shellintegration/xdg-shell-v5/qwaylandxdgsurface_p.h | 2 +- .../plugins/shellintegration/xdg-shell-v5/xdg-shell-v5.pro | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) rename src/3rdparty/wayland/protocols/{xdg-shell.xml => xdg-shell-unstable-v5.xml} (99%) diff --git a/src/3rdparty/wayland/protocols/qt_attribution.json b/src/3rdparty/wayland/protocols/qt_attribution.json index f35dec4f348..94d77f6097b 100644 --- a/src/3rdparty/wayland/protocols/qt_attribution.json +++ b/src/3rdparty/wayland/protocols/qt_attribution.json @@ -41,7 +41,7 @@ Copyright (c) 2013 BMW Car IT GmbH" "Name": "Wayland XDG Shell Protocol", "QDocModule": "qtwaylandcompositor", "QtUsage": "Used in the Qt Wayland Compositor, and the Qt Wayland platform plugin.", - "Files": "xdg-shell.xml", + "Files": "xdg-shell-unstable-v5.xml xdg-shell-unstable-v6.xml", "Description": "The XDG-Shell protocol is an extended way to manage surfaces under Wayland compositors.", "Homepage": "https://wayland.freedesktop.org", diff --git a/src/3rdparty/wayland/protocols/xdg-shell.xml b/src/3rdparty/wayland/protocols/xdg-shell-unstable-v5.xml similarity index 99% rename from src/3rdparty/wayland/protocols/xdg-shell.xml rename to src/3rdparty/wayland/protocols/xdg-shell-unstable-v5.xml index f98e760d482..89c9d58c52e 100644 --- a/src/3rdparty/wayland/protocols/xdg-shell.xml +++ b/src/3rdparty/wayland/protocols/xdg-shell-unstable-v5.xml @@ -1,5 +1,5 @@ - + Copyright © 2008-2013 Kristian Høgsberg diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgpopup_p.h b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgpopup_p.h index d9f7deec642..f7ea05c9ef7 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgpopup_p.h +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgpopup_p.h @@ -51,7 +51,7 @@ // We mean it. // -#include "qwayland-xdg-shell.h" +#include "qwayland-xdg-shell-unstable-v5.h" #include diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshell_p.h b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshell_p.h index 9341c7a8fb4..ead1e65d712 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshell_p.h +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshell_p.h @@ -51,7 +51,7 @@ // We mean it. // -#include "qwayland-xdg-shell.h" +#include "qwayland-xdg-shell-unstable-v5.h" #include #include diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgsurface_p.h b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgsurface_p.h index cf4498a8372..0153c80b1ad 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgsurface_p.h +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgsurface_p.h @@ -51,7 +51,7 @@ // We mean it. // -#include "qwayland-xdg-shell.h" +#include "qwayland-xdg-shell-unstable-v5.h" #include #include diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/xdg-shell-v5.pro b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/xdg-shell-v5.pro index 85052fef6f3..511699b2dbf 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/xdg-shell-v5.pro +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/xdg-shell-v5.pro @@ -7,7 +7,7 @@ qtConfig(xkbcommon-evdev): \ QMAKE_USE += xkbcommon_evdev WAYLANDCLIENTSOURCES += \ - ../../../3rdparty/protocol/xdg-shell.xml + ../../../3rdparty/protocol/xdg-shell-unstable-v5.xml HEADERS += \ qwaylandxdgpopup_p.h \ From 6f3e1212769a934445b2c520df93b28f57922070 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Wed, 9 May 2018 14:49:31 +0200 Subject: [PATCH 0521/1507] xdg-shell-v5: Suffix classes with v5 To make it easier to distinguish when implementing xdg-shell stable. Change-Id: I730f3b8411f68b7e5c707b7ba6b94b2563ac500e Reviewed-by: Paul Olav Tvete --- .../shellintegration/xdg-shell-v5/main.cpp | 4 +- ...andxdgpopup.cpp => qwaylandxdgpopupv5.cpp} | 10 ++--- ...andxdgpopup_p.h => qwaylandxdgpopupv5_p.h} | 12 ++--- ...andxdgshell.cpp => qwaylandxdgshellv5.cpp} | 24 +++++----- ...andxdgshell_p.h => qwaylandxdgshellv5_p.h} | 22 +++++----- ....cpp => qwaylandxdgshellv5integration.cpp} | 20 ++++----- ..._p.h => qwaylandxdgshellv5integration_p.h} | 16 +++---- ...dgsurface.cpp => qwaylandxdgsurfacev5.cpp} | 44 +++++++++---------- ...dgsurface_p.h => qwaylandxdgsurfacev5_p.h} | 16 +++---- .../xdg-shell-v5/xdg-shell-v5.pro | 16 +++---- 10 files changed, 92 insertions(+), 92 deletions(-) rename src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/{qwaylandxdgpopup.cpp => qwaylandxdgpopupv5.cpp} (89%) rename src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/{qwaylandxdgpopup_p.h => qwaylandxdgpopupv5_p.h} (90%) rename src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/{qwaylandxdgshell.cpp => qwaylandxdgshellv5.cpp} (79%) rename src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/{qwaylandxdgshell_p.h => qwaylandxdgshellv5_p.h} (83%) rename src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/{qwaylandxdgshellintegration.cpp => qwaylandxdgshellv5integration.cpp} (80%) rename src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/{qwaylandxdgshellintegration_p.h => qwaylandxdgshellv5integration_p.h} (86%) rename src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/{qwaylandxdgsurface.cpp => qwaylandxdgsurfacev5.cpp} (81%) rename src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/{qwaylandxdgsurface_p.h => qwaylandxdgsurfacev5_p.h} (92%) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/main.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/main.cpp index 3df1beaf953..9345f4401c1 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/main.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/main.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include "qwaylandxdgshellintegration_p.h" +#include "qwaylandxdgshellv5integration_p.h" #include @@ -60,7 +60,7 @@ QWaylandShellIntegration *QWaylandXdgShellV5IntegrationPlugin::create(const QStr qDebug() << Q_FUNC_INFO; Q_UNUSED(key); Q_UNUSED(paramList); - return new QWaylandXdgShellIntegration(); + return new QWaylandXdgShellV5Integration(); } } diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgpopup.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgpopupv5.cpp similarity index 89% rename from src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgpopup.cpp rename to src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgpopupv5.cpp index 04849355f5e..542b1628d0a 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgpopup.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgpopupv5.cpp @@ -37,7 +37,7 @@ ** ****************************************************************************/ -#include "qwaylandxdgpopup_p.h" +#include "qwaylandxdgpopupv5_p.h" #include #include @@ -47,7 +47,7 @@ QT_BEGIN_NAMESPACE namespace QtWaylandClient { -QWaylandXdgPopup::QWaylandXdgPopup(struct ::xdg_popup *popup, QWaylandWindow *window) +QWaylandXdgPopupV5::QWaylandXdgPopupV5(struct ::xdg_popup *popup, QWaylandWindow *window) : QWaylandShellSurface(window) , QtWayland::xdg_popup(popup) , m_window(window) @@ -56,19 +56,19 @@ QWaylandXdgPopup::QWaylandXdgPopup(struct ::xdg_popup *popup, QWaylandWindow *wi m_extendedWindow = new QWaylandExtendedSurface(window); } -QWaylandXdgPopup::~QWaylandXdgPopup() +QWaylandXdgPopupV5::~QWaylandXdgPopupV5() { xdg_popup_destroy(object()); delete m_extendedWindow; } -void QWaylandXdgPopup::setType(Qt::WindowType type, QWaylandWindow *transientParent) +void QWaylandXdgPopupV5::setType(Qt::WindowType type, QWaylandWindow *transientParent) { Q_UNUSED(type); Q_UNUSED(transientParent); } -void QWaylandXdgPopup::xdg_popup_popup_done() +void QWaylandXdgPopupV5::xdg_popup_popup_done() { m_window->window()->close(); } diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgpopup_p.h b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgpopupv5_p.h similarity index 90% rename from src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgpopup_p.h rename to src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgpopupv5_p.h index f7ea05c9ef7..638b7153412 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgpopup_p.h +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgpopupv5_p.h @@ -37,8 +37,8 @@ ** ****************************************************************************/ -#ifndef QWAYLANDXDGPOPUP_P_H -#define QWAYLANDXDGPOPUP_P_H +#ifndef QWAYLANDXDGPOPUPV5_P_H +#define QWAYLANDXDGPOPUPV5_P_H // // W A R N I N G @@ -67,13 +67,13 @@ namespace QtWaylandClient { class QWaylandWindow; class QWaylandExtendedSurface; -class Q_WAYLAND_CLIENT_EXPORT QWaylandXdgPopup : public QWaylandShellSurface +class Q_WAYLAND_CLIENT_EXPORT QWaylandXdgPopupV5 : public QWaylandShellSurface , public QtWayland::xdg_popup { Q_OBJECT public: - QWaylandXdgPopup(struct ::xdg_popup *popup, QWaylandWindow *window); - ~QWaylandXdgPopup() override; + QWaylandXdgPopupV5(struct ::xdg_popup *popup, QWaylandWindow *window); + ~QWaylandXdgPopupV5() override; void setType(Qt::WindowType type, QWaylandWindow *transientParent) override; @@ -89,4 +89,4 @@ QT_END_NAMESPACE } -#endif // QWAYLANDXDGPOPUP_P_H +#endif // QWAYLANDXDGPOPUPV5_P_H diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshell.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshellv5.cpp similarity index 79% rename from src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshell.cpp rename to src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshellv5.cpp index bd76346d2ae..6a693578cfa 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshell.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshellv5.cpp @@ -37,9 +37,9 @@ ** ****************************************************************************/ -#include "qwaylandxdgshell_p.h" -#include "qwaylandxdgpopup_p.h" -#include "qwaylandxdgsurface_p.h" +#include "qwaylandxdgshellv5_p.h" +#include "qwaylandxdgpopupv5_p.h" +#include "qwaylandxdgsurfacev5_p.h" #include @@ -52,28 +52,28 @@ QT_BEGIN_NAMESPACE namespace QtWaylandClient { -QWaylandXdgShell::QWaylandXdgShell(struct ::xdg_shell *shell) +QWaylandXdgShellV5::QWaylandXdgShellV5(struct ::xdg_shell *shell) : QtWayland::xdg_shell(shell) { } -QWaylandXdgShell::QWaylandXdgShell(struct ::wl_registry *registry, uint32_t id) +QWaylandXdgShellV5::QWaylandXdgShellV5(struct ::wl_registry *registry, uint32_t id) : QtWayland::xdg_shell(registry, id, 1) { use_unstable_version(QtWayland::xdg_shell::version_current); } -QWaylandXdgShell::~QWaylandXdgShell() +QWaylandXdgShellV5::~QWaylandXdgShellV5() { xdg_shell_destroy(object()); } -QWaylandXdgSurface *QWaylandXdgShell::createXdgSurface(QWaylandWindow *window) +QWaylandXdgSurfaceV5 *QWaylandXdgShellV5::createXdgSurface(QWaylandWindow *window) { - return new QWaylandXdgSurface(this, window); + return new QWaylandXdgSurfaceV5(this, window); } -QWaylandXdgPopup *QWaylandXdgShell::createXdgPopup(QWaylandWindow *window, QWaylandInputDevice *inputDevice) +QWaylandXdgPopupV5 *QWaylandXdgShellV5::createXdgPopup(QWaylandWindow *window, QWaylandInputDevice *inputDevice) { QWaylandWindow *parentWindow = m_popups.empty() ? window->transientParent() : m_popups.last(); ::wl_surface *parentSurface = parentWindow->object(); @@ -86,9 +86,9 @@ QWaylandXdgPopup *QWaylandXdgShell::createXdgPopup(QWaylandWindow *window, QWayl int x = position.x() + parentWindow->frameMargins().left(); int y = position.y() + parentWindow->frameMargins().top(); - auto popup = new QWaylandXdgPopup(get_xdg_popup(window->object(), parentSurface, seat, m_popupSerial, x, y), window); + auto popup = new QWaylandXdgPopupV5(get_xdg_popup(window->object(), parentSurface, seat, m_popupSerial, x, y), window); m_popups.append(window); - QObject::connect(popup, &QWaylandXdgPopup::destroyed, [this, window](){ + QObject::connect(popup, &QWaylandXdgPopupV5::destroyed, [this, window](){ m_popups.removeOne(window); if (m_popups.empty()) m_popupSerial = 0; @@ -96,7 +96,7 @@ QWaylandXdgPopup *QWaylandXdgShell::createXdgPopup(QWaylandWindow *window, QWayl return popup; } -void QWaylandXdgShell::xdg_shell_ping(uint32_t serial) +void QWaylandXdgShellV5::xdg_shell_ping(uint32_t serial) { pong(serial); } diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshell_p.h b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshellv5_p.h similarity index 83% rename from src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshell_p.h rename to src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshellv5_p.h index ead1e65d712..ec45bb32c90 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshell_p.h +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshellv5_p.h @@ -37,8 +37,8 @@ ** ****************************************************************************/ -#ifndef QWAYLANDXDGSHELL_H -#define QWAYLANDXDGSHELL_H +#ifndef QWAYLANDXDGSHELLV5_H +#define QWAYLANDXDGSHELLV5_H // // W A R N I N G @@ -69,18 +69,18 @@ namespace QtWaylandClient { class QWaylandWindow; class QWaylandInputDevice; -class QWaylandXdgSurface; -class QWaylandXdgPopup; +class QWaylandXdgSurfaceV5; +class QWaylandXdgPopupV5; -class Q_WAYLAND_CLIENT_EXPORT QWaylandXdgShell : public QtWayland::xdg_shell +class Q_WAYLAND_CLIENT_EXPORT QWaylandXdgShellV5 : public QtWayland::xdg_shell { public: - QWaylandXdgShell(struct ::xdg_shell *shell); - QWaylandXdgShell(struct ::wl_registry *registry, uint32_t id); - ~QWaylandXdgShell() override; + QWaylandXdgShellV5(struct ::xdg_shell *shell); + QWaylandXdgShellV5(struct ::wl_registry *registry, uint32_t id); + ~QWaylandXdgShellV5() override; - QWaylandXdgSurface *createXdgSurface(QWaylandWindow *window); - QWaylandXdgPopup *createXdgPopup(QWaylandWindow *window, QWaylandInputDevice *inputDevice); + QWaylandXdgSurfaceV5 *createXdgSurface(QWaylandWindow *window); + QWaylandXdgPopupV5 *createXdgPopup(QWaylandWindow *window, QWaylandInputDevice *inputDevice); private: void xdg_shell_ping(uint32_t serial) override; @@ -93,4 +93,4 @@ QT_END_NAMESPACE } -#endif // QWAYLANDXDGSHELL_H +#endif // QWAYLANDXDGSHELLV5_H diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshellintegration.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshellv5integration.cpp similarity index 80% rename from src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshellintegration.cpp rename to src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshellv5integration.cpp index 0d0e8aba3ac..47d748b1cad 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshellintegration.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshellv5integration.cpp @@ -37,10 +37,10 @@ ** ****************************************************************************/ -#include "qwaylandxdgshellintegration_p.h" -#include "qwaylandxdgsurface_p.h" -#include "qwaylandxdgpopup_p.h" -#include "qwaylandxdgshell_p.h" +#include "qwaylandxdgshellv5integration_p.h" +#include "qwaylandxdgsurfacev5_p.h" +#include "qwaylandxdgpopupv5_p.h" +#include "qwaylandxdgshellv5_p.h" #include #include @@ -49,11 +49,11 @@ QT_BEGIN_NAMESPACE namespace QtWaylandClient { -bool QWaylandXdgShellIntegration::initialize(QWaylandDisplay *display) +bool QWaylandXdgShellV5Integration::initialize(QWaylandDisplay *display) { Q_FOREACH (QWaylandDisplay::RegistryGlobal global, display->globals()) { if (global.interface == QLatin1String("xdg_shell")) { - m_xdgShell.reset(new QWaylandXdgShell(display->wl_registry(), global.id)); + m_xdgShell.reset(new QWaylandXdgShellV5(display->wl_registry(), global.id)); break; } } @@ -66,7 +66,7 @@ bool QWaylandXdgShellIntegration::initialize(QWaylandDisplay *display) return QWaylandShellIntegration::initialize(display); } -QWaylandShellSurface *QWaylandXdgShellIntegration::createShellSurface(QWaylandWindow *window) +QWaylandShellSurface *QWaylandXdgShellV5Integration::createShellSurface(QWaylandWindow *window) { QWaylandInputDevice *inputDevice = window->display()->lastInputDevice(); if (window->window()->type() == Qt::WindowType::Popup && inputDevice) @@ -75,10 +75,10 @@ QWaylandShellSurface *QWaylandXdgShellIntegration::createShellSurface(QWaylandWi return m_xdgShell->createXdgSurface(window); } -void QWaylandXdgShellIntegration::handleKeyboardFocusChanged(QWaylandWindow *newFocus, QWaylandWindow *oldFocus) { - if (newFocus && qobject_cast(newFocus->shellSurface())) +void QWaylandXdgShellV5Integration::handleKeyboardFocusChanged(QWaylandWindow *newFocus, QWaylandWindow *oldFocus) { + if (newFocus && qobject_cast(newFocus->shellSurface())) m_display->handleWindowActivated(newFocus); - if (oldFocus && qobject_cast(oldFocus->shellSurface())) + if (oldFocus && qobject_cast(oldFocus->shellSurface())) m_display->handleWindowDeactivated(oldFocus); } diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshellintegration_p.h b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshellv5integration_p.h similarity index 86% rename from src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshellintegration_p.h rename to src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshellv5integration_p.h index a3ff86cd763..e8c05c9a00f 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshellintegration_p.h +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshellv5integration_p.h @@ -37,8 +37,8 @@ ** ****************************************************************************/ -#ifndef QWAYLANDXDGSHELLINTEGRATION_P_H -#define QWAYLANDXDGSHELLINTEGRATION_P_H +#ifndef QWAYLANDXDGSHELLV5INTEGRATION_P_H +#define QWAYLANDXDGSHELLV5INTEGRATION_P_H // // W A R N I N G @@ -51,7 +51,7 @@ // We mean it. // -#include "qwaylandxdgshell_p.h" +#include "qwaylandxdgshellv5_p.h" #include @@ -59,22 +59,22 @@ QT_BEGIN_NAMESPACE namespace QtWaylandClient { -class QWaylandXdgShell; +class QWaylandXdgShellV5; -class Q_WAYLAND_CLIENT_EXPORT QWaylandXdgShellIntegration : public QWaylandShellIntegration +class Q_WAYLAND_CLIENT_EXPORT QWaylandXdgShellV5Integration : public QWaylandShellIntegration { public: - QWaylandXdgShellIntegration() {qDebug() << Q_FUNC_INFO;} + QWaylandXdgShellV5Integration() {qDebug() << Q_FUNC_INFO;} bool initialize(QWaylandDisplay *display) override; QWaylandShellSurface *createShellSurface(QWaylandWindow *window) override; void handleKeyboardFocusChanged(QWaylandWindow *newFocus, QWaylandWindow *oldFocus) override; private: - QScopedPointer m_xdgShell; + QScopedPointer m_xdgShell; }; } QT_END_NAMESPACE -#endif // QWAYLANDXDGSHELLINTEGRATION_P_H +#endif // QWAYLANDXDGSHELLV5INTEGRATION_P_H diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgsurface.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgsurfacev5.cpp similarity index 81% rename from src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgsurface.cpp rename to src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgsurfacev5.cpp index ec096540a3d..315dc62316e 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgsurface.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgsurfacev5.cpp @@ -37,8 +37,8 @@ ** ****************************************************************************/ -#include "qwaylandxdgsurface_p.h" -#include "qwaylandxdgshell_p.h" +#include "qwaylandxdgsurfacev5_p.h" +#include "qwaylandxdgshellv5_p.h" #include #include @@ -52,7 +52,7 @@ QT_BEGIN_NAMESPACE namespace QtWaylandClient { -QWaylandXdgSurface::QWaylandXdgSurface(QWaylandXdgShell *shell, QWaylandWindow *window) +QWaylandXdgSurfaceV5::QWaylandXdgSurfaceV5(QWaylandXdgShellV5 *shell, QWaylandWindow *window) : QWaylandShellSurface(window) , QtWayland::xdg_surface(shell->get_xdg_surface(window->object())) , m_window(window) @@ -62,7 +62,7 @@ QWaylandXdgSurface::QWaylandXdgSurface(QWaylandXdgShell *shell, QWaylandWindow * m_extendedWindow = new QWaylandExtendedSurface(window); } -QWaylandXdgSurface::~QWaylandXdgSurface() +QWaylandXdgSurfaceV5::~QWaylandXdgSurfaceV5() { if (m_acked.states & Qt::WindowActive) window()->display()->handleWindowDeactivated(m_window); @@ -71,84 +71,84 @@ QWaylandXdgSurface::~QWaylandXdgSurface() delete m_extendedWindow; } -void QWaylandXdgSurface::resize(QWaylandInputDevice *inputDevice, enum wl_shell_surface_resize edges) +void QWaylandXdgSurfaceV5::resize(QWaylandInputDevice *inputDevice, enum wl_shell_surface_resize edges) { // May need some conversion if types get incompatibles, ATM they're identical enum resize_edge const * const arg = reinterpret_cast(&edges); resize(inputDevice, *arg); } -void QWaylandXdgSurface::resize(QWaylandInputDevice *inputDevice, enum resize_edge edges) +void QWaylandXdgSurfaceV5::resize(QWaylandInputDevice *inputDevice, enum resize_edge edges) { resize(inputDevice->wl_seat(), inputDevice->serial(), edges); } -bool QWaylandXdgSurface::move(QWaylandInputDevice *inputDevice) +bool QWaylandXdgSurfaceV5::move(QWaylandInputDevice *inputDevice) { move(inputDevice->wl_seat(), inputDevice->serial()); return true; } -void QWaylandXdgSurface::updateTransientParent(QWaylandWindow *parent) +void QWaylandXdgSurfaceV5::updateTransientParent(QWaylandWindow *parent) { if (!parent) return; - auto parentXdgSurface = qobject_cast(parent->shellSurface()); + auto parentXdgSurface = qobject_cast(parent->shellSurface()); Q_ASSERT(parentXdgSurface); set_parent(parentXdgSurface->object()); } -void QWaylandXdgSurface::setTitle(const QString & title) +void QWaylandXdgSurfaceV5::setTitle(const QString & title) { return QtWayland::xdg_surface::set_title(title); } -void QWaylandXdgSurface::setAppId(const QString & appId) +void QWaylandXdgSurfaceV5::setAppId(const QString & appId) { return QtWayland::xdg_surface::set_app_id(appId); } -void QWaylandXdgSurface::raise() +void QWaylandXdgSurfaceV5::raise() { if (m_extendedWindow) m_extendedWindow->raise(); } -void QWaylandXdgSurface::lower() +void QWaylandXdgSurfaceV5::lower() { if (m_extendedWindow) m_extendedWindow->lower(); } -void QWaylandXdgSurface::setContentOrientationMask(Qt::ScreenOrientations orientation) +void QWaylandXdgSurfaceV5::setContentOrientationMask(Qt::ScreenOrientations orientation) { if (m_extendedWindow) m_extendedWindow->setContentOrientationMask(orientation); } -void QWaylandXdgSurface::setWindowFlags(Qt::WindowFlags flags) +void QWaylandXdgSurfaceV5::setWindowFlags(Qt::WindowFlags flags) { if (m_extendedWindow) m_extendedWindow->setWindowFlags(flags); } -void QWaylandXdgSurface::sendProperty(const QString &name, const QVariant &value) +void QWaylandXdgSurfaceV5::sendProperty(const QString &name, const QVariant &value) { if (m_extendedWindow) m_extendedWindow->updateGenericProperty(name, value); } -void QWaylandXdgSurface::setType(Qt::WindowType type, QWaylandWindow *transientParent) +void QWaylandXdgSurfaceV5::setType(Qt::WindowType type, QWaylandWindow *transientParent) { Q_UNUSED(type) if (transientParent) updateTransientParent(transientParent); } -void QWaylandXdgSurface::applyConfigure() +void QWaylandXdgSurfaceV5::applyConfigure() { if (m_pending.isResizing) m_normalSize = m_pending.size; @@ -173,7 +173,7 @@ void QWaylandXdgSurface::applyConfigure() m_acked = m_pending; } -void QWaylandXdgSurface::requestWindowStates(Qt::WindowStates states) +void QWaylandXdgSurfaceV5::requestWindowStates(Qt::WindowStates states) { Qt::WindowStates changedStates = m_acked.states ^ states; @@ -198,12 +198,12 @@ void QWaylandXdgSurface::requestWindowStates(Qt::WindowStates states) } } -bool QWaylandXdgSurface::wantsDecorations() const +bool QWaylandXdgSurfaceV5::wantsDecorations() const { return !(m_pending.states & Qt::WindowFullScreen); } -void QWaylandXdgSurface::xdg_surface_configure(int32_t width, int32_t height, struct wl_array *states,uint32_t serial) +void QWaylandXdgSurfaceV5::xdg_surface_configure(int32_t width, int32_t height, struct wl_array *states,uint32_t serial) { uint32_t *xdgStates = reinterpret_cast(states->data); size_t numStates = states->size / sizeof(uint32_t); @@ -232,7 +232,7 @@ void QWaylandXdgSurface::xdg_surface_configure(int32_t width, int32_t height, st m_window->applyConfigureWhenPossible(); } -void QWaylandXdgSurface::xdg_surface_close() +void QWaylandXdgSurfaceV5::xdg_surface_close() { } diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgsurface_p.h b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgsurfacev5_p.h similarity index 92% rename from src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgsurface_p.h rename to src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgsurfacev5_p.h index 0153c80b1ad..9283957795c 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgsurface_p.h +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgsurfacev5_p.h @@ -37,8 +37,8 @@ ** ****************************************************************************/ -#ifndef QWAYLANDXDGSURFACE_H -#define QWAYLANDXDGSURFACE_H +#ifndef QWAYLANDXDGSURFACEV5_P_H +#define QWAYLANDXDGSURFACEV5_P_H // // W A R N I N G @@ -70,15 +70,15 @@ namespace QtWaylandClient { class QWaylandWindow; class QWaylandInputDevice; class QWaylandExtendedSurface; -class QWaylandXdgShell; +class QWaylandXdgShellV5; -class Q_WAYLAND_CLIENT_EXPORT QWaylandXdgSurface : public QWaylandShellSurface +class Q_WAYLAND_CLIENT_EXPORT QWaylandXdgSurfaceV5 : public QWaylandShellSurface , public QtWayland::xdg_surface { Q_OBJECT public: - QWaylandXdgSurface(QWaylandXdgShell *shell, QWaylandWindow *window); - ~QWaylandXdgSurface() override; + QWaylandXdgSurfaceV5(QWaylandXdgShellV5 *shell, QWaylandWindow *window); + ~QWaylandXdgSurfaceV5() override; using QtWayland::xdg_surface::resize; void resize(QWaylandInputDevice *inputDevice, enum resize_edge edges); @@ -107,7 +107,7 @@ private: private: QWaylandWindow *m_window = nullptr; - QWaylandXdgShell* m_shell = nullptr; + QWaylandXdgShellV5* m_shell = nullptr; struct { Qt::WindowStates states = Qt::WindowNoState; bool isResizing = false; @@ -131,4 +131,4 @@ QT_END_NAMESPACE } -#endif // QWAYLANDXDGSURFACE_H +#endif // QWAYLANDXDGSURFACEV5_P_H diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/xdg-shell-v5.pro b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/xdg-shell-v5.pro index 511699b2dbf..0e97832e493 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/xdg-shell-v5.pro +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/xdg-shell-v5.pro @@ -10,17 +10,17 @@ WAYLANDCLIENTSOURCES += \ ../../../3rdparty/protocol/xdg-shell-unstable-v5.xml HEADERS += \ - qwaylandxdgpopup_p.h \ - qwaylandxdgshell_p.h \ - qwaylandxdgshellintegration_p.h \ - qwaylandxdgsurface_p.h \ + qwaylandxdgpopupv5_p.h \ + qwaylandxdgshellv5_p.h \ + qwaylandxdgshellv5integration_p.h \ + qwaylandxdgsurfacev5_p.h \ SOURCES += \ main.cpp \ - qwaylandxdgpopup.cpp \ - qwaylandxdgshell.cpp \ - qwaylandxdgshellintegration.cpp \ - qwaylandxdgsurface.cpp \ + qwaylandxdgpopupv5.cpp \ + qwaylandxdgshellv5.cpp \ + qwaylandxdgshellv5integration.cpp \ + qwaylandxdgsurfacev5.cpp \ OTHER_FILES += \ xdg-shell-v5.json From 1e345736748842be51634f68fcea77d6c46f6558 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Wed, 9 May 2018 14:59:13 +0200 Subject: [PATCH 0522/1507] Clean up forward class declarations in qwaylanddisplay_p.h Change-Id: I57ead68f2c243c14015afeddc9721866b3dd01f1 Reviewed-by: Paul Olav Tvete --- src/plugins/platforms/wayland/qwaylanddisplay_p.h | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay_p.h b/src/plugins/platforms/wayland/qwaylanddisplay_p.h index aa84a97b7b3..4100c798d8f 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay_p.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay_p.h @@ -74,11 +74,8 @@ class QSocketNotifier; class QPlatformScreen; namespace QtWayland { - class qt_shell; - class qt_sub_surface_extension; class qt_surface_extension; class zwp_text_input_manager_v2; - class xdg_shell; } namespace QtWaylandClient { @@ -94,10 +91,8 @@ class QWaylandDataDeviceManager; class QWaylandTouchExtension; class QWaylandQtKeyExtension; class QWaylandWindow; -class QWaylandEventThread; class QWaylandIntegration; class QWaylandHardwareIntegration; -class QWaylandXdgShell; class QWaylandShellSurface; typedef void (*RegistryListener)(void *data, From 9b49788540a283d3800454931e4c4ba63bc4a476 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Wed, 9 May 2018 22:58:18 +0200 Subject: [PATCH 0523/1507] xdg-shell-v5 client: Remove accidental qDebug Change-Id: I1dbe14b317dd0a460abf3602da1772968d2fe150 Reviewed-by: Pier Luigi Fiorini Reviewed-by: Paul Olav Tvete --- .../wayland/plugins/shellintegration/xdg-shell-v5/main.cpp | 1 - .../xdg-shell-v5/qwaylandxdgshellv5integration_p.h | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/main.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/main.cpp index 9345f4401c1..d365f682d08 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/main.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/main.cpp @@ -57,7 +57,6 @@ public: QWaylandShellIntegration *QWaylandXdgShellV5IntegrationPlugin::create(const QString &key, const QStringList ¶mList) { - qDebug() << Q_FUNC_INFO; Q_UNUSED(key); Q_UNUSED(paramList); return new QWaylandXdgShellV5Integration(); diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshellv5integration_p.h b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshellv5integration_p.h index e8c05c9a00f..ce6bdb9eebf 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshellv5integration_p.h +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshellv5integration_p.h @@ -64,7 +64,7 @@ class QWaylandXdgShellV5; class Q_WAYLAND_CLIENT_EXPORT QWaylandXdgShellV5Integration : public QWaylandShellIntegration { public: - QWaylandXdgShellV5Integration() {qDebug() << Q_FUNC_INFO;} + QWaylandXdgShellV5Integration() {} bool initialize(QWaylandDisplay *display) override; QWaylandShellSurface *createShellSurface(QWaylandWindow *window) override; void handleKeyboardFocusChanged(QWaylandWindow *newFocus, QWaylandWindow *oldFocus) override; From c6835714114ca25ecff7c8dc4232defc2c38ffdf Mon Sep 17 00:00:00 2001 From: Aleix Pol Date: Thu, 26 Apr 2018 17:38:10 +0200 Subject: [PATCH 0524/1507] Adapt the cursor size per screen Adapt the cursor size to the screen's devicePixelRatio, so we are not forced to have a tiny cursor on a high dpi screen or a huge cursor on external low-dpi displays. Change-Id: I3712dc64e5c5e2e05d0dc5943bd49ba5c1335cd3 Reviewed-by: Johan Helsing Reviewed-by: Pier Luigi Fiorini --- .../platforms/wayland/qwaylandcursor.cpp | 19 ++++++++++--------- .../platforms/wayland/qwaylanddisplay.cpp | 8 ++++---- .../platforms/wayland/qwaylanddisplay_p.h | 4 ++-- .../platforms/wayland/qwaylandinputdevice.cpp | 16 +++++++++------- .../platforms/wayland/qwaylandinputdevice_p.h | 6 +++--- 5 files changed, 28 insertions(+), 25 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandcursor.cpp b/src/plugins/platforms/wayland/qwaylandcursor.cpp index 21a6c0811c1..a356950c3df 100644 --- a/src/plugins/platforms/wayland/qwaylandcursor.cpp +++ b/src/plugins/platforms/wayland/qwaylandcursor.cpp @@ -60,11 +60,14 @@ QWaylandCursor::QWaylandCursor(QWaylandScreen *screen) QByteArray cursorTheme = qgetenv("XCURSOR_THEME"); if (cursorTheme.isEmpty()) cursorTheme = QByteArray("default"); - QByteArray cursorSizeFromEnv = qgetenv("XCURSOR_SIZE"); - bool hasCursorSize = false; - int cursorSize = cursorSizeFromEnv.toInt(&hasCursorSize); - if (!hasCursorSize || cursorSize <= 0) + int cursorSize = qEnvironmentVariableIntValue("XCURSOR_SIZE"); + if (cursorSize <= 0) cursorSize = 32; + + // wl_surface.set_buffer_scale is not supported on earlier versions + if (mDisplay->compositorVersion() >= 3) + cursorSize *= screen->devicePixelRatio(); + mCursorTheme = wl_cursor_theme_load(cursorTheme, cursorSize, mDisplay->shm()->object()); if (!mCursorTheme) qDebug() << "Could not load theme" << cursorTheme; @@ -84,7 +87,7 @@ struct wl_cursor_image *QWaylandCursor::cursorImage(Qt::CursorShape newShape) /* Hide cursor */ if (newShape == Qt::BlankCursor) { - mDisplay->setCursor(nullptr, nullptr); + mDisplay->setCursor(nullptr, nullptr, 1); return nullptr; } @@ -125,12 +128,10 @@ QSharedPointer QWaylandCursor::cursorBitmapImage(const QCursor * void QWaylandCursor::changeCursor(QCursor *cursor, QWindow *window) { - Q_UNUSED(window) - const Qt::CursorShape newShape = cursor ? cursor->shape() : Qt::ArrowCursor; if (newShape == Qt::BitmapCursor) { - mDisplay->setCursor(cursorBitmapImage(cursor), cursor->hotSpot()); + mDisplay->setCursor(cursorBitmapImage(cursor), cursor->hotSpot(), window->screen()->devicePixelRatio()); return; } @@ -140,7 +141,7 @@ void QWaylandCursor::changeCursor(QCursor *cursor, QWindow *window) } struct wl_buffer *buffer = wl_cursor_image_get_buffer(image); - mDisplay->setCursor(buffer, image); + mDisplay->setCursor(buffer, image, window->screen()->devicePixelRatio()); } void QWaylandCursor::pointerEvent(const QMouseEvent &event) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index 515888d4afe..1c2b47da522 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -474,23 +474,23 @@ QWaylandInputDevice *QWaylandDisplay::defaultInputDevice() const } #if QT_CONFIG(cursor) -void QWaylandDisplay::setCursor(struct wl_buffer *buffer, struct wl_cursor_image *image) +void QWaylandDisplay::setCursor(struct wl_buffer *buffer, struct wl_cursor_image *image, qreal dpr) { /* Qt doesn't tell us which input device we should set the cursor * for, so set it for all devices. */ for (int i = 0; i < mInputDevices.count(); i++) { QWaylandInputDevice *inputDevice = mInputDevices.at(i); - inputDevice->setCursor(buffer, image); + inputDevice->setCursor(buffer, image, dpr); } } -void QWaylandDisplay::setCursor(const QSharedPointer &buffer, const QPoint &hotSpot) +void QWaylandDisplay::setCursor(const QSharedPointer &buffer, const QPoint &hotSpot, qreal dpr) { /* Qt doesn't tell us which input device we should set the cursor * for, so set it for all devices. */ for (int i = 0; i < mInputDevices.count(); i++) { QWaylandInputDevice *inputDevice = mInputDevices.at(i); - inputDevice->setCursor(buffer, hotSpot); + inputDevice->setCursor(buffer, hotSpot, dpr); } } #endif // QT_CONFIG(cursor) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay_p.h b/src/plugins/platforms/wayland/qwaylanddisplay_p.h index 4100c798d8f..72f8444e0d3 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay_p.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay_p.h @@ -121,8 +121,8 @@ public: QWaylandWindowManagerIntegration *windowManagerIntegration() const; #if QT_CONFIG(cursor) - void setCursor(struct wl_buffer *buffer, struct wl_cursor_image *image); - void setCursor(const QSharedPointer &buffer, const QPoint &hotSpot); + void setCursor(struct wl_buffer *buffer, struct wl_cursor_image *image, qreal dpr); + void setCursor(const QSharedPointer &buffer, const QPoint &hotSpot, qreal dpr); #endif struct wl_display *wl_display() const { return mDisplay; } struct ::wl_registry *wl_registry() { return object(); } diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index 93344d13fed..4835bd68e9d 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -371,7 +371,7 @@ void QWaylandInputDevice::setCursor(Qt::CursorShape newShape, QWaylandScreen *sc } struct wl_buffer *buffer = wl_cursor_image_get_buffer(image); - setCursor(buffer, image); + setCursor(buffer, image, screen->devicePixelRatio()); } void QWaylandInputDevice::setCursor(const QCursor &cursor, QWaylandScreen *screen) @@ -381,20 +381,20 @@ void QWaylandInputDevice::setCursor(const QCursor &cursor, QWaylandScreen *scree mPointer->mCursorShape = cursor.shape(); if (cursor.shape() == Qt::BitmapCursor) { - setCursor(screen->waylandCursor()->cursorBitmapImage(&cursor), cursor.hotSpot()); + setCursor(screen->waylandCursor()->cursorBitmapImage(&cursor), cursor.hotSpot(), screen->devicePixelRatio()); return; } setCursor(cursor.shape(), screen); } -void QWaylandInputDevice::setCursor(struct wl_buffer *buffer, struct wl_cursor_image *image) +void QWaylandInputDevice::setCursor(struct wl_buffer *buffer, struct wl_cursor_image *image, int bufferScale) { setCursor(buffer, image ? QPoint(image->hotspot_x, image->hotspot_y) : QPoint(), - image ? QSize(image->width, image->height) : QSize()); + image ? QSize(image->width, image->height) : QSize(), bufferScale); } -void QWaylandInputDevice::setCursor(struct wl_buffer *buffer, const QPoint &hotSpot, const QSize &size) +void QWaylandInputDevice::setCursor(struct wl_buffer *buffer, const QPoint &hotSpot, const QSize &size, int bufferScale) { if (mCaps & WL_SEAT_CAPABILITY_POINTER) { bool force = mPointer->mEnterSerial > mPointer->mCursorSerial; @@ -417,14 +417,16 @@ void QWaylandInputDevice::setCursor(struct wl_buffer *buffer, const QPoint &hotS mPointer->set_cursor(mPointer->mEnterSerial, pointerSurface, hotSpot.x(), hotSpot.y()); wl_surface_attach(pointerSurface, buffer, 0, 0); + if (mQDisplay->compositorVersion() >= 3) + wl_surface_set_buffer_scale(pointerSurface, bufferScale); wl_surface_damage(pointerSurface, 0, 0, size.width(), size.height()); wl_surface_commit(pointerSurface); } } -void QWaylandInputDevice::setCursor(const QSharedPointer &buffer, const QPoint &hotSpot) +void QWaylandInputDevice::setCursor(const QSharedPointer &buffer, const QPoint &hotSpot, int bufferScale) { - setCursor(buffer->buffer(), hotSpot, buffer->size()); + setCursor(buffer->buffer(), hotSpot, buffer->size(), bufferScale); mPixmapCursor = buffer; } #endif diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h index 48c1cf57f2d..4b12cc089b2 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h +++ b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h @@ -110,9 +110,9 @@ public: #if QT_CONFIG(cursor) void setCursor(const QCursor &cursor, QWaylandScreen *screen); - void setCursor(struct wl_buffer *buffer, struct ::wl_cursor_image *image); - void setCursor(struct wl_buffer *buffer, const QPoint &hotSpot, const QSize &size); - void setCursor(const QSharedPointer &buffer, const QPoint &hotSpot); + void setCursor(struct wl_buffer *buffer, struct ::wl_cursor_image *image, int bufferScale); + void setCursor(struct wl_buffer *buffer, const QPoint &hotSpot, const QSize &size, int bufferScale); + void setCursor(const QSharedPointer &buffer, const QPoint &hotSpot, int bufferScale); #endif void handleWindowDestroyed(QWaylandWindow *window); void handleEndDrag(); From ae584145306a95e331b3ea377805848946b83341 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Wed, 16 May 2018 08:59:20 +0200 Subject: [PATCH 0525/1507] Client: Lazy load QWaylandCursor If nothing is trying to access QWaylandScreen::cursor() leave the platform cursor uninitialized. This in turn avoids initializing cursor themes, which may use a significant amount of shared memory depending on the cursor size, number of screens and screen DPI. Task-number: QTBUG-67796 Change-Id: Ifd062cb52c4889adcaadeb00bea928b8e84a2182 Reviewed-by: Paul Olav Tvete --- .../platforms/wayland/qwaylanddisplay.cpp | 1 - .../platforms/wayland/qwaylandscreen.cpp | 27 ++++++++----------- .../platforms/wayland/qwaylandscreen_p.h | 6 ++--- 3 files changed, 13 insertions(+), 21 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index 1c2b47da522..0199e169d73 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -238,7 +238,6 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin mScreens.append(screen); // We need to get the output events before creating surfaces forceRoundTrip(); - screen->init(); mWaylandIntegration->screenAdded(screen); } else if (interface == QStringLiteral("wl_compositor")) { mCompositorVersion = qMin((int)version, 3); diff --git a/src/plugins/platforms/wayland/qwaylandscreen.cpp b/src/plugins/platforms/wayland/qwaylandscreen.cpp index 38d97a91dfb..37fe5f3234b 100644 --- a/src/plugins/platforms/wayland/qwaylandscreen.cpp +++ b/src/plugins/platforms/wayland/qwaylandscreen.cpp @@ -60,20 +60,6 @@ QWaylandScreen::QWaylandScreen(QWaylandDisplay *waylandDisplay, int version, uin { } -QWaylandScreen::~QWaylandScreen() -{ -#if QT_CONFIG(cursor) - delete mWaylandCursor; -#endif -} - -void QWaylandScreen::init() -{ -#if QT_CONFIG(cursor) - mWaylandCursor = new QWaylandCursor(this); -#endif -} - QWaylandDisplay * QWaylandScreen::display() const { return mWaylandDisplay; @@ -165,11 +151,20 @@ qreal QWaylandScreen::refreshRate() const } #if QT_CONFIG(cursor) + QPlatformCursor *QWaylandScreen::cursor() const { - return mWaylandCursor; + return const_cast(this)->waylandCursor(); } -#endif + +QWaylandCursor *QWaylandScreen::waylandCursor() +{ + if (!mWaylandCursor) + mWaylandCursor.reset(new QWaylandCursor(this)); + return mWaylandCursor.data(); +} + +#endif // QT_CONFIG(cursor) QWaylandScreen * QWaylandScreen::waylandScreenFromWindow(QWindow *window) { diff --git a/src/plugins/platforms/wayland/qwaylandscreen_p.h b/src/plugins/platforms/wayland/qwaylandscreen_p.h index 9df55d60340..39b72bc2443 100644 --- a/src/plugins/platforms/wayland/qwaylandscreen_p.h +++ b/src/plugins/platforms/wayland/qwaylandscreen_p.h @@ -67,9 +67,7 @@ class Q_WAYLAND_CLIENT_EXPORT QWaylandScreen : public QPlatformScreen, QtWayland { public: QWaylandScreen(QWaylandDisplay *waylandDisplay, int version, uint32_t id); - ~QWaylandScreen() override; - void init(); QWaylandDisplay *display() const; QString manufacturer() const override; @@ -95,7 +93,7 @@ public: #if QT_CONFIG(cursor) QPlatformCursor *cursor() const override; - QWaylandCursor *waylandCursor() const { return mWaylandCursor; } + QWaylandCursor *waylandCursor(); #endif uint32_t outputId() const { return m_outputId; } @@ -130,7 +128,7 @@ private: Qt::ScreenOrientation m_orientation = Qt::PrimaryOrientation; #if QT_CONFIG(cursor) - QWaylandCursor *mWaylandCursor = nullptr; + QScopedPointer mWaylandCursor; #endif }; From d8e37e4b03f9c786e1cb3dda80b050f05f974752 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Wed, 9 May 2018 22:57:53 +0200 Subject: [PATCH 0526/1507] Move wl-shell to a plugin [ChangeLog][QPA plugin] The wl-shell shell integration has been moved to a plugin. This also adds API so shell integrations can return native resources for windows, as it was needed in order to continue to supporting wl_shell_surface. Change-Id: Ibc68ffcc5b0c6993d8f4e078f663e4d67340e1a5 Reviewed-by: Paul Olav Tvete --- src/plugins/platforms/wayland/client.pro | 4 -- .../shellintegration/shellintegration.pro | 4 +- .../shellintegration/wl-shell/main.cpp | 69 +++++++++++++++++++ .../wl-shell}/qwaylandwlshellintegration.cpp | 43 ++++++------ .../wl-shell}/qwaylandwlshellintegration_p.h | 5 +- .../wl-shell}/qwaylandwlshellsurface.cpp | 16 ++--- .../wl-shell}/qwaylandwlshellsurface_p.h | 0 .../shellintegration/wl-shell/wl-shell.json | 3 + .../shellintegration/wl-shell/wl-shell.pro | 23 +++++++ .../platforms/wayland/qwaylanddisplay.cpp | 1 - .../platforms/wayland/qwaylanddisplay_p.h | 2 +- .../platforms/wayland/qwaylandintegration.cpp | 5 +- .../wayland/qwaylandnativeinterface.cpp | 15 ++-- .../platforms/wayland/qwaylandwindow.cpp | 1 - .../qwaylandshellintegration_p.h | 5 ++ 15 files changed, 142 insertions(+), 54 deletions(-) create mode 100644 src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/main.cpp rename src/plugins/platforms/wayland/{ => plugins/shellintegration/wl-shell}/qwaylandwlshellintegration.cpp (78%) rename src/plugins/platforms/wayland/{ => plugins/shellintegration/wl-shell}/qwaylandwlshellintegration_p.h (95%) rename src/plugins/platforms/wayland/{ => plugins/shellintegration/wl-shell}/qwaylandwlshellsurface.cpp (94%) rename src/plugins/platforms/wayland/{ => plugins/shellintegration/wl-shell}/qwaylandwlshellsurface_p.h (100%) create mode 100644 src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/wl-shell.json create mode 100644 src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/wl-shell.pro diff --git a/src/plugins/platforms/wayland/client.pro b/src/plugins/platforms/wayland/client.pro index 1bcd6780c5b..b1457004667 100644 --- a/src/plugins/platforms/wayland/client.pro +++ b/src/plugins/platforms/wayland/client.pro @@ -42,8 +42,6 @@ SOURCES += qwaylandintegration.cpp \ qwaylandscreen.cpp \ qwaylandshmwindow.cpp \ qwaylandshellsurface.cpp \ - qwaylandwlshellsurface.cpp \ - qwaylandwlshellintegration.cpp \ qwaylandxdgshellv6.cpp \ qwaylandxdgshellv6integration.cpp \ qwaylandextendedsurface.cpp \ @@ -71,8 +69,6 @@ HEADERS += qwaylandintegration_p.h \ qwaylandbuffer_p.h \ qwaylandshmwindow_p.h \ qwaylandshellsurface_p.h \ - qwaylandwlshellsurface_p.h \ - qwaylandwlshellintegration_p.h \ qwaylandxdgshellv6_p.h \ qwaylandxdgshellv6integration_p.h \ qwaylandextendedsurface_p.h \ diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/shellintegration.pro b/src/plugins/platforms/wayland/plugins/shellintegration/shellintegration.pro index 7f465d61b4c..12a900db253 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/shellintegration.pro +++ b/src/plugins/platforms/wayland/plugins/shellintegration/shellintegration.pro @@ -2,4 +2,6 @@ TEMPLATE = subdirs SUBDIRS += \ ivi-shell \ - xdg-shell-v5 + xdg-shell-v5 \ + wl-shell \ + diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/main.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/main.cpp new file mode 100644 index 00000000000..9b033b5f33a --- /dev/null +++ b/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/main.cpp @@ -0,0 +1,69 @@ +/**************************************************************************** +** +** Copyright (C) 2018 The Qt Company Ltd. +** Copyright (C) 2017 ITAGE Corporation, author: +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qwaylandwlshellintegration_p.h" + +#include + +QT_BEGIN_NAMESPACE + +namespace QtWaylandClient { + +class QWaylandWlShellIntegrationPlugin : public QWaylandShellIntegrationPlugin +{ + Q_OBJECT + Q_PLUGIN_METADATA(IID QWaylandShellIntegrationFactoryInterface_iid FILE "wl-shell.json") + +public: + QWaylandShellIntegration *create(const QString &key, const QStringList ¶mList) override; +}; + +QWaylandShellIntegration *QWaylandWlShellIntegrationPlugin::create(const QString &key, const QStringList ¶mList) +{ + Q_UNUSED(key); + Q_UNUSED(paramList); + return new QWaylandWlShellIntegration(); +} + +} + +QT_END_NAMESPACE + +#include "main.moc" diff --git a/src/plugins/platforms/wayland/qwaylandwlshellintegration.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellintegration.cpp similarity index 78% rename from src/plugins/platforms/wayland/qwaylandwlshellintegration.cpp rename to src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellintegration.cpp index c76628420c0..be156dad21b 100644 --- a/src/plugins/platforms/wayland/qwaylandwlshellintegration.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellintegration.cpp @@ -38,29 +38,16 @@ ****************************************************************************/ #include "qwaylandwlshellintegration_p.h" +#include "qwaylandwlshellsurface_p.h" #include #include -#include QT_BEGIN_NAMESPACE namespace QtWaylandClient { -QWaylandWlShellIntegration *QWaylandWlShellIntegration::create(QWaylandDisplay *display) -{ - if (!display->hasRegistryGlobal(QLatin1String("wl_shell"))) - return nullptr; - - QScopedPointer integration; - integration.reset(new QWaylandWlShellIntegration(display)); - if (integration && !integration->initialize(display)) - return nullptr; - - return integration.take(); -} - -QWaylandWlShellIntegration::QWaylandWlShellIntegration(QWaylandDisplay *display) +bool QWaylandWlShellIntegration::initialize(QWaylandDisplay *display) { Q_FOREACH (QWaylandDisplay::RegistryGlobal global, display->globals()) { if (global.interface == QLatin1String("wl_shell")) { @@ -68,19 +55,33 @@ QWaylandWlShellIntegration::QWaylandWlShellIntegration(QWaylandDisplay *display) break; } } -} -bool QWaylandWlShellIntegration::initialize(QWaylandDisplay *display) -{ - QWaylandShellIntegration::initialize(display); - return m_wlShell != nullptr; -}; + if (!m_wlShell) { + qCDebug(lcQpaWayland) << "Couldn't find global wl_shell"; + return false; + } + + return QWaylandShellIntegration::initialize(display); +} QWaylandShellSurface *QWaylandWlShellIntegration::createShellSurface(QWaylandWindow *window) { return new QWaylandWlShellSurface(m_wlShell->get_shell_surface(window->object()), window); } +void *QWaylandWlShellIntegration::nativeResourceForWindow(const QByteArray &resource, QWindow *window) +{ + QByteArray lowerCaseResource = resource.toLower(); + if (lowerCaseResource == "wl_shell_surface") { + if (auto waylandWindow = static_cast(window->handle())) { + if (auto shellSurface = qobject_cast(waylandWindow->shellSurface())) { + return shellSurface->object(); + } + } + } + return nullptr; } +} // namespace QtWaylandClient + QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandwlshellintegration_p.h b/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellintegration_p.h similarity index 95% rename from src/plugins/platforms/wayland/qwaylandwlshellintegration_p.h rename to src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellintegration_p.h index 7a6b53524a9..80a7507d4b5 100644 --- a/src/plugins/platforms/wayland/qwaylandwlshellintegration_p.h +++ b/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellintegration_p.h @@ -63,13 +63,12 @@ namespace QtWaylandClient { class Q_WAYLAND_CLIENT_EXPORT QWaylandWlShellIntegration : public QWaylandShellIntegration { public: - static QWaylandWlShellIntegration *create(QWaylandDisplay* display); + QWaylandWlShellIntegration() {} bool initialize(QWaylandDisplay *) override; QWaylandShellSurface *createShellSurface(QWaylandWindow *window) override; + void *nativeResourceForWindow(const QByteArray &resource, QWindow *window) override; private: - QWaylandWlShellIntegration(QWaylandDisplay* display); - QtWayland::wl_shell *m_wlShell = nullptr; }; diff --git a/src/plugins/platforms/wayland/qwaylandwlshellsurface.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellsurface.cpp similarity index 94% rename from src/plugins/platforms/wayland/qwaylandwlshellsurface.cpp rename to src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellsurface.cpp index 3601fd43765..9f2bcc00c10 100644 --- a/src/plugins/platforms/wayland/qwaylandwlshellsurface.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellsurface.cpp @@ -39,12 +39,12 @@ #include "qwaylandwlshellsurface_p.h" -#include "qwaylanddisplay_p.h" -#include "qwaylandwindow_p.h" -#include "qwaylandinputdevice_p.h" -#include "qwaylandabstractdecoration_p.h" -#include "qwaylandscreen_p.h" -#include "qwaylandextendedsurface_p.h" +#include +#include +#include +#include +#include +#include #include @@ -229,11 +229,11 @@ void QWaylandWlShellSurface::setPopup(QWaylandWindow *parent, QWaylandInputDevic { QWaylandWindow *parent_wayland_window = parent; if (!parent_wayland_window) { - qWarning("setPopup called without parent window"); + qCWarning(lcQpaWayland) << "setPopup called without a parent window"; return; } if (!device) { - qWarning("setPopup called without input device"); + qCWarning(lcQpaWayland) << "setPopup called without an input device"; return; } diff --git a/src/plugins/platforms/wayland/qwaylandwlshellsurface_p.h b/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellsurface_p.h similarity index 100% rename from src/plugins/platforms/wayland/qwaylandwlshellsurface_p.h rename to src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellsurface_p.h diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/wl-shell.json b/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/wl-shell.json new file mode 100644 index 00000000000..1859bb58ad0 --- /dev/null +++ b/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/wl-shell.json @@ -0,0 +1,3 @@ +{ + "Keys":[ "wl-shell" ] +} diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/wl-shell.pro b/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/wl-shell.pro new file mode 100644 index 00000000000..211dc876f8e --- /dev/null +++ b/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/wl-shell.pro @@ -0,0 +1,23 @@ +QT += gui-private waylandclient-private +CONFIG += wayland-scanner + +QMAKE_USE += wayland-client + +WAYLANDCLIENTSOURCES += \ + ../../../3rdparty/protocol/wayland.xml + +HEADERS += \ + qwaylandwlshellintegration_p.h \ + qwaylandwlshellsurface_p.h \ + +SOURCES += \ + main.cpp \ + qwaylandwlshellintegration.cpp \ + qwaylandwlshellsurface.cpp \ + +OTHER_FILES += \ + wl-shell.json + +PLUGIN_TYPE = wayland-shell-integration +PLUGIN_CLASS_NAME = QWaylandWlShellIntegrationPlugin +load(qt_plugin) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index 0199e169d73..946e99bc89b 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -51,7 +51,6 @@ #include "qwaylanddatadevicemanager_p.h" #endif #include "qwaylandhardwareintegration_p.h" -#include "qwaylandwlshellsurface_p.h" #include "qwaylandinputcontext_p.h" #include "qwaylandwindowmanagerintegration_p.h" diff --git a/src/plugins/platforms/wayland/qwaylanddisplay_p.h b/src/plugins/platforms/wayland/qwaylanddisplay_p.h index 72f8444e0d3..d39e561f641 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay_p.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay_p.h @@ -80,7 +80,7 @@ namespace QtWayland { namespace QtWaylandClient { -Q_DECLARE_LOGGING_CATEGORY(lcQpaWayland); +Q_WAYLAND_CLIENT_EXPORT Q_DECLARE_LOGGING_CATEGORY(lcQpaWayland); class QWaylandInputDevice; class QWaylandBuffer; diff --git a/src/plugins/platforms/wayland/qwaylandintegration.cpp b/src/plugins/platforms/wayland/qwaylandintegration.cpp index 2a169aca652..fbfdd57f48b 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandintegration.cpp @@ -77,7 +77,6 @@ #include "qwaylandshellintegration_p.h" #include "qwaylandshellintegrationfactory_p.h" -#include "qwaylandwlshellintegration_p.h" #include "qwaylandxdgshellv6integration_p.h" #include "qwaylandinputdeviceintegration_p.h" @@ -442,9 +441,7 @@ void QWaylandIntegration::initializeInputDeviceIntegration() QWaylandShellIntegration *QWaylandIntegration::createShellIntegration(const QString &integrationName) { - if (integrationName == QLatin1Literal("wl-shell")) { - return QWaylandWlShellIntegration::create(mDisplay.data()); - } else if (integrationName == QLatin1Literal("xdg-shell-v6")) { + if (integrationName == QLatin1Literal("xdg-shell-v6")) { return QWaylandXdgShellV6Integration::create(mDisplay.data()); } else if (QWaylandShellIntegrationFactory::keys().contains(integrationName)) { return QWaylandShellIntegrationFactory::create(integrationName, mDisplay.data()); diff --git a/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp b/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp index 9946c323567..76acb526bf3 100644 --- a/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp +++ b/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp @@ -40,13 +40,13 @@ #include "qwaylandnativeinterface_p.h" #include "qwaylanddisplay_p.h" #include "qwaylandwindow_p.h" +#include "qwaylandshellintegration_p.h" #include "qwaylandsubsurface_p.h" #include "qwaylandextendedsurface_p.h" #include "qwaylandintegration_p.h" #include "qwaylanddisplay_p.h" #include "qwaylandwindowmanagerintegration_p.h" #include "qwaylandscreen_p.h" -#include "qwaylandwlshellsurface_p.h" #include #include #include @@ -91,18 +91,13 @@ void *QWaylandNativeInterface::nativeResourceForWindow(const QByteArray &resourc QWaylandWindow *w = static_cast(window->handle()); return w ? w->object() : nullptr; } - if (lowerCaseResource == "wl_shell_surface") { - QWaylandWindow *w = static_cast(window->handle()); - if (!w) - return nullptr; - QWaylandWlShellSurface *s = qobject_cast(w->shellSurface()); - if (!s) - return nullptr; - return s->object(); - } + if (lowerCaseResource == "egldisplay" && m_integration->clientBufferIntegration()) return m_integration->clientBufferIntegration()->nativeResource(QWaylandClientBufferIntegration::EglDisplay); + if (auto shellIntegration = m_integration->shellIntegration()) + return shellIntegration->nativeResourceForWindow(resourceString, window); + return nullptr; } diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 45f9a19b2fd..ef49e8ea8c8 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -44,7 +44,6 @@ #include "qwaylandinputdevice_p.h" #include "qwaylandscreen_p.h" #include "qwaylandshellsurface_p.h" -#include "qwaylandwlshellsurface_p.h" #include "qwaylandsubsurface_p.h" #include "qwaylandabstractdecoration_p.h" #include "qwaylandwindowmanagerintegration_p.h" diff --git a/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegration_p.h b/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegration_p.h index 7f3a2cefcfd..ccad0048192 100644 --- a/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegration_p.h +++ b/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegration_p.h @@ -79,6 +79,11 @@ public: if (oldFocus) m_display->handleWindowDeactivated(oldFocus); } + virtual void *nativeResourceForWindow(const QByteArray &resource, QWindow *window) { + Q_UNUSED(resource); + Q_UNUSED(window); + return nullptr; + } protected: QWaylandDisplay *m_display = nullptr; From 75b60471cf543a424f969d2536b04abee91af127 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 22 May 2018 17:46:08 -0300 Subject: [PATCH 0527/1507] Disable the -Wmissing-field-initializers warning for Clang too qwldatadevicemanager.cpp:277:1: warning: missing field 'finish' initializer [-Wmissing-field-initializers] Change-Id: I052407b777ec43f78378fffd15311263e7498287 Reviewed-by: Johan Helsing --- src/tools/qtwaylandscanner/qtwaylandscanner.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp index 057002c9dff..1b884a42467 100644 --- a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp +++ b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp @@ -394,6 +394,7 @@ void process(QXmlStreamReader &xml, const QByteArray &headerPath, const QByteArr printf("QT_BEGIN_NAMESPACE\n"); printf("QT_WARNING_PUSH\n"); printf("QT_WARNING_DISABLE_GCC(\"-Wmissing-field-initializers\")\n"); + printf("QT_WARNING_DISABLE_CLANG(\"-Wmissing-field-initializers\")\n"); QByteArray serverExport; if (headerPath.size()) { serverExport = QByteArray("Q_WAYLAND_SERVER_") + preProcessorProtocolName + "_EXPORT"; From 72a5628a34359c57aaf99463d8abc31403a8c8d1 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 22 May 2018 17:43:54 -0300 Subject: [PATCH 0528/1507] Suppress warning about MFD_CLOEXEC being redefined glibc 2.27 #defined it as just "1U" instead of the kernel "0x0001U". Same value, but because the tokens are different, this triggers a warning. Change-Id: I052407b777ec43f78378fffd153112449de8cf4f Reviewed-by: Johan Helsing --- src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp b/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp index cbfdf51576e..54b0b798c5e 100644 --- a/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp +++ b/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp @@ -59,7 +59,9 @@ #ifdef Q_OS_LINUX # include // from linux/memfd.h: -# define MFD_CLOEXEC 0x0001U +# ifndef MFD_CLOEXEC +# define MFD_CLOEXEC 0x0001U +# endif #endif QT_BEGIN_NAMESPACE From da03b6f2a265f067c4ac41518d2e629f67c3990b Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Wed, 23 May 2018 14:30:13 +0200 Subject: [PATCH 0529/1507] Add readme for internal protocol extension folder There have been some misunderstandings about the compatibility guarantees of our internal protocols. I.e. some compositors have started implementing them, and then we have removed or made backwards incompatible changes to the protocols. Also, when we've made backwards incompatible changes, we've previously incorrectly used the version attribute of the interface, however that attribute is supposed to be used for backwards *compatible* changes. This causes problems for both ourselves and others. So let's be explicit about it in a README and be more careful when reviewing protocol extension changes if they don't bump the version suffix (i.e. rename the protocol). This is the same versioning and naming scheme as used by the unstable protocols in wayland-protocols. Task-number QTBUG-68423 Change-Id: I9c1a7e13c9356660914bbfeff4139ec033f1d443 Reviewed-by: Paul Olav Tvete --- src/3rdparty/wayland/extensions/README.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 src/3rdparty/wayland/extensions/README.md diff --git a/src/3rdparty/wayland/extensions/README.md b/src/3rdparty/wayland/extensions/README.md new file mode 100644 index 00000000000..f75e0f23665 --- /dev/null +++ b/src/3rdparty/wayland/extensions/README.md @@ -0,0 +1,18 @@ +# Internal Qt protocol extensions + +The protocol extensions in this folder are considered implementation details of +Qt. I.e. they may removed, renamed or changed without warning. + +## Suffixed protocols + +For protocols that have a version suffix, however, we will strive to not break +backwards compatibility without bumping the suffix (renaming the protocol). +E.g.: If your client sees a `zqt_key_v1` global, it can safely bind to it: +the key event will always take the same number of arguments, regardless of +compositor version. + +This is important also within a Qt-only scope if there are multiple versions of +Qt on the system. Consider for instance an application statically linked to Qt +(such as Qt Creator) running against a Qt compositor installed by the distro). +In such cases we don't want the compositor and client to disagree on the +protocol definition. From 9391184890ee25cae6c18bde054c8201893b7747 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Wed, 23 May 2018 13:50:18 +0200 Subject: [PATCH 0530/1507] Replace qtkey-extension with qt-key-unstable-v1 - Remove the "dummy" request, which seems to be just leftover test code. - Rename the event from "qtkey" to "key". We've already prefixed the global interface, no need to also prefix the event. - Prefix the global with `zqt_` and suffix it with "_v1". If we make backwards incompatible changes, we should bump the suffix, rename the xml-file and reset the version number. - Add some documentation to the xml file. - Add notice about (lack of) compatibility guarantees. - Four spaces for indentation Task-number: QTBUG-68423 Change-Id: I78f0eaff4cac22f27318ba32c83c83feb2de857a Reviewed-by: Paul Olav Tvete --- ...y-extension.xml => qt-key-unstable-v1.xml} | 52 +++++++++++-------- src/plugins/platforms/wayland/client.pro | 2 +- .../platforms/wayland/qwaylanddisplay.cpp | 2 +- .../platforms/wayland/qwaylandqtkey.cpp | 4 +- .../platforms/wayland/qwaylandqtkey_p.h | 26 +++++----- 5 files changed, 48 insertions(+), 38 deletions(-) rename src/3rdparty/wayland/extensions/{qtkey-extension.xml => qt-key-unstable-v1.xml} (51%) diff --git a/src/3rdparty/wayland/extensions/qtkey-extension.xml b/src/3rdparty/wayland/extensions/qt-key-unstable-v1.xml similarity index 51% rename from src/3rdparty/wayland/extensions/qtkey-extension.xml rename to src/3rdparty/wayland/extensions/qt-key-unstable-v1.xml index 34cf24797de..0f8d8284c7b 100644 --- a/src/3rdparty/wayland/extensions/qtkey-extension.xml +++ b/src/3rdparty/wayland/extensions/qt-key-unstable-v1.xml @@ -1,7 +1,7 @@ - + - Copyright (C) 2015 The Qt Company Ltd. + Copyright (C) 2018 The Qt Company Ltd. Contact: http://www.qt.io/licensing/ This file is part of the plugins of the Qt Toolkit. @@ -38,26 +38,36 @@ $QT_END_LICENSE$ - - - - Serialized QKeyEvent - + + + This protocol is independent of the Wayland seat concept. Its + intention is to let a QKeyEvent be transferred from a Qt compositor + to a Qt client without losing or adding false information by going + through wl_seat and wl_keyboard. - - - - - - - - - - - + Note: This protocol is considered private to Qt. We will do our + best to bump version numbers when we make backwards compatible + changes, bump the protocol name and interface suffixes when we make + backwards incompatible changes, but we provide no guarantees. We + may also remove the protocol without warning. Implement this at + your own risk. + + + + The key event notifies the client that a QKeyEvent has occurred on + the server side. + + + + + + + + + + + + - - - diff --git a/src/plugins/platforms/wayland/client.pro b/src/plugins/platforms/wayland/client.pro index b1457004667..3b11902de8b 100644 --- a/src/plugins/platforms/wayland/client.pro +++ b/src/plugins/platforms/wayland/client.pro @@ -25,7 +25,7 @@ INCLUDEPATH += $$PWD/../shared WAYLANDCLIENTSOURCES += \ ../extensions/surface-extension.xml \ ../extensions/touch-extension.xml \ - ../extensions/qtkey-extension.xml \ + ../extensions/qt-key-unstable-v1.xml \ ../extensions/qt-windowmanager.xml \ ../3rdparty/protocol/text-input-unstable-v2.xml \ ../3rdparty/protocol/xdg-shell-unstable-v6.xml \ diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index 946e99bc89b..9cbb3524df7 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -256,7 +256,7 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin mSubCompositor.reset(new QtWayland::wl_subcompositor(registry, id, 1)); } else if (interface == QStringLiteral("qt_touch_extension")) { mTouchExtension.reset(new QWaylandTouchExtension(this, id)); - } else if (interface == QStringLiteral("qt_key_extension")) { + } else if (interface == QStringLiteral("zqt_key_v1")) { mQtKeyExtension.reset(new QWaylandQtKeyExtension(this, id)); } else if (interface == QStringLiteral("zwp_text_input_manager_v2")) { mTextInputManager.reset(new QtWayland::zwp_text_input_manager_v2(registry, id, 1)); diff --git a/src/plugins/platforms/wayland/qwaylandqtkey.cpp b/src/plugins/platforms/wayland/qwaylandqtkey.cpp index ce0d2124e77..a60185bd641 100644 --- a/src/plugins/platforms/wayland/qwaylandqtkey.cpp +++ b/src/plugins/platforms/wayland/qwaylandqtkey.cpp @@ -46,12 +46,12 @@ QT_BEGIN_NAMESPACE namespace QtWaylandClient { QWaylandQtKeyExtension::QWaylandQtKeyExtension(QWaylandDisplay *display, uint32_t id) - : QtWayland::qt_key_extension(display->wl_registry(), id, 2) + : QtWayland::zqt_key_v1(display->wl_registry(), id, 1) , m_display(display) { } -void QWaylandQtKeyExtension::key_extension_qtkey(struct wl_surface *surface, +void QWaylandQtKeyExtension::zqt_key_v1_key(struct wl_surface *surface, uint32_t time, uint32_t type, uint32_t key, diff --git a/src/plugins/platforms/wayland/qwaylandqtkey_p.h b/src/plugins/platforms/wayland/qwaylandqtkey_p.h index 9091cf81935..117c44a6d2e 100644 --- a/src/plugins/platforms/wayland/qwaylandqtkey_p.h +++ b/src/plugins/platforms/wayland/qwaylandqtkey_p.h @@ -54,7 +54,7 @@ #include #include -#include +#include QT_BEGIN_NAMESPACE @@ -62,7 +62,7 @@ namespace QtWaylandClient { class QWaylandDisplay; -class Q_WAYLAND_CLIENT_EXPORT QWaylandQtKeyExtension : public QtWayland::qt_key_extension +class Q_WAYLAND_CLIENT_EXPORT QWaylandQtKeyExtension : public QtWayland::zqt_key_v1 { public: QWaylandQtKeyExtension(QWaylandDisplay *display, uint32_t id); @@ -70,17 +70,17 @@ public: private: QWaylandDisplay *m_display = nullptr; - void key_extension_qtkey(struct wl_surface *surface, - uint32_t time, - uint32_t type, - uint32_t key, - uint32_t modifiers, - uint32_t nativeScanCode, - uint32_t nativeVirtualKey, - uint32_t nativeModifiers, - const QString &text, - uint32_t autorep, - uint32_t count) override; + void zqt_key_v1_key(struct wl_surface *surface, + uint32_t time, + uint32_t type, + uint32_t key, + uint32_t modifiers, + uint32_t nativeScanCode, + uint32_t nativeVirtualKey, + uint32_t nativeModifiers, + const QString &text, + uint32_t autorep, + uint32_t count) override; }; From 52b2e5a34691fad03b97bd88fa9161d79588539e Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Wed, 2 May 2018 14:37:02 +0200 Subject: [PATCH 0531/1507] Client tests: Remove redundant cleanup testing We already have a QTRY_VERIFY(!compositor->surface()); in tst_WaylandClient::cleanup() which is already run after every test. The assertions from tests that are explicitly testing surface creation and destruction have not been removed. Change-Id: I21d574f5fe33d4e4c309dcfb2f50bde447238df2 Reviewed-by: Paul Olav Tvete --- tests/auto/wayland/client/tst_client.cpp | 8 -------- 1 file changed, 8 deletions(-) diff --git a/tests/auto/wayland/client/tst_client.cpp b/tests/auto/wayland/client/tst_client.cpp index 05b8bac1afa..978a9d5e629 100644 --- a/tests/auto/wayland/client/tst_client.cpp +++ b/tests/auto/wayland/client/tst_client.cpp @@ -263,9 +263,6 @@ void tst_WaylandClient::windowScreens() compositor->sendRemoveOutput(secondOutput); QTRY_COMPARE(QGuiApplication::screens().size(), 1); QCOMPARE(window.screen(), primaryScreen); - - window.destroy(); - QTRY_VERIFY(!compositor->surface()); } void tst_WaylandClient::removePrimaryScreen() @@ -297,9 +294,6 @@ void tst_WaylandClient::removePrimaryScreen() QTRY_COMPARE(window.mousePressEventCount, 1); compositor->sendMouseRelease(surface); QTRY_COMPARE(window.mouseReleaseEventCount, 1); - - window.destroy(); - QTRY_VERIFY(!compositor->surface()); } void tst_WaylandClient::createDestroyWindow() @@ -516,8 +510,6 @@ void tst_WaylandClient::dontCrashOnMultipleCommits() } delete window; - - QTRY_VERIFY(!compositor->surface()); } void tst_WaylandClient::hiddenTransientParent() From 60146a92b8865e6bc791c64ac476b54c56c713dc Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Tue, 15 May 2018 09:58:18 +0200 Subject: [PATCH 0532/1507] Client: Only load cursor theme once Now cursor themes load once per device pixel ratio, and not once per screen. Task-number: QTBUG-67796 Change-Id: I4c253e65a791d69e7d510c4228989390a4343110 Reviewed-by: Paul Olav Tvete --- .../platforms/wayland/qwaylandcursor.cpp | 22 +----------- .../platforms/wayland/qwaylandcursor_p.h | 1 - .../platforms/wayland/qwaylanddisplay.cpp | 35 +++++++++++++++++++ .../platforms/wayland/qwaylanddisplay_p.h | 5 +++ 4 files changed, 41 insertions(+), 22 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandcursor.cpp b/src/plugins/platforms/wayland/qwaylandcursor.cpp index a356950c3df..3d2cbd76188 100644 --- a/src/plugins/platforms/wayland/qwaylandcursor.cpp +++ b/src/plugins/platforms/wayland/qwaylandcursor.cpp @@ -55,31 +55,11 @@ namespace QtWaylandClient { QWaylandCursor::QWaylandCursor(QWaylandScreen *screen) : mDisplay(screen->display()) + , mCursorTheme(mDisplay->loadCursorTheme(screen->devicePixelRatio())) { - //TODO: Make wl_cursor_theme_load arguments configurable here - QByteArray cursorTheme = qgetenv("XCURSOR_THEME"); - if (cursorTheme.isEmpty()) - cursorTheme = QByteArray("default"); - int cursorSize = qEnvironmentVariableIntValue("XCURSOR_SIZE"); - if (cursorSize <= 0) - cursorSize = 32; - - // wl_surface.set_buffer_scale is not supported on earlier versions - if (mDisplay->compositorVersion() >= 3) - cursorSize *= screen->devicePixelRatio(); - - mCursorTheme = wl_cursor_theme_load(cursorTheme, cursorSize, mDisplay->shm()->object()); - if (!mCursorTheme) - qDebug() << "Could not load theme" << cursorTheme; initCursorMap(); } -QWaylandCursor::~QWaylandCursor() -{ - if (mCursorTheme) - wl_cursor_theme_destroy(mCursorTheme); -} - struct wl_cursor_image *QWaylandCursor::cursorImage(Qt::CursorShape newShape) { struct wl_cursor *waylandCursor = nullptr; diff --git a/src/plugins/platforms/wayland/qwaylandcursor_p.h b/src/plugins/platforms/wayland/qwaylandcursor_p.h index b3df9316097..532e46c1966 100644 --- a/src/plugins/platforms/wayland/qwaylandcursor_p.h +++ b/src/plugins/platforms/wayland/qwaylandcursor_p.h @@ -73,7 +73,6 @@ class Q_WAYLAND_CLIENT_EXPORT QWaylandCursor : public QPlatformCursor { public: QWaylandCursor(QWaylandScreen *screen); - ~QWaylandCursor() override; void changeCursor(QCursor *cursor, QWindow *window) override; void pointerEvent(const QMouseEvent &event) override; diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index 9cbb3524df7..6a6370bf925 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -50,6 +50,9 @@ #if QT_CONFIG(wayland_datadevice) #include "qwaylanddatadevicemanager_p.h" #endif +#if QT_CONFIG(cursor) +#include +#endif #include "qwaylandhardwareintegration_p.h" #include "qwaylandinputcontext_p.h" @@ -151,8 +154,14 @@ QWaylandDisplay::~QWaylandDisplay(void) mWaylandIntegration->destroyScreen(screen); } mScreens.clear(); + #if QT_CONFIG(wayland_datadevice) delete mDndSelectionHandler.take(); +#endif +#if QT_CONFIG(cursor) + for (auto *cursorTheme : mCursorThemesBySize) + wl_cursor_theme_destroy(cursorTheme); + mCursorThemesBySize.clear(); #endif if (mDisplay) wl_display_disconnect(mDisplay); @@ -472,6 +481,7 @@ QWaylandInputDevice *QWaylandDisplay::defaultInputDevice() const } #if QT_CONFIG(cursor) + void QWaylandDisplay::setCursor(struct wl_buffer *buffer, struct wl_cursor_image *image, qreal dpr) { /* Qt doesn't tell us which input device we should set the cursor @@ -491,6 +501,31 @@ void QWaylandDisplay::setCursor(const QSharedPointer &buffer, co inputDevice->setCursor(buffer, hotSpot, dpr); } } + +struct ::wl_cursor_theme *QWaylandDisplay::loadCursorTheme(qreal devicePixelRatio) +{ + QByteArray themeName = qgetenv("XCURSOR_THEME"); + if (themeName.isEmpty()) + themeName = QByteArray("default"); + + int cursorSize = qEnvironmentVariableIntValue("XCURSOR_SIZE"); + if (cursorSize <= 0) + cursorSize = 32; + if (compositorVersion() >= 3) // set_buffer_scale is not supported on earlier versions + cursorSize *= devicePixelRatio; + + if (auto *theme = mCursorThemesBySize.value(cursorSize, nullptr)) + return theme; + + struct ::wl_cursor_theme *theme = wl_cursor_theme_load(themeName, cursorSize, shm()->object()); + + if (!theme) + qCWarning(lcQpaWayland) << "Could not load cursor theme" << themeName; + + mCursorThemesBySize[cursorSize] = theme; + return theme; +} + #endif // QT_CONFIG(cursor) } diff --git a/src/plugins/platforms/wayland/qwaylanddisplay_p.h b/src/plugins/platforms/wayland/qwaylanddisplay_p.h index d39e561f641..521119fe8d5 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay_p.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay_p.h @@ -66,6 +66,7 @@ #include struct wl_cursor_image; +struct wl_cursor_theme; QT_BEGIN_NAMESPACE @@ -123,6 +124,7 @@ public: #if QT_CONFIG(cursor) void setCursor(struct wl_buffer *buffer, struct wl_cursor_image *image, qreal dpr); void setCursor(const QSharedPointer &buffer, const QPoint &hotSpot, qreal dpr); + struct ::wl_cursor_theme *loadCursorTheme(qreal devicePixelRatio); #endif struct wl_display *wl_display() const { return mDisplay; } struct ::wl_registry *wl_registry() { return object(); } @@ -199,6 +201,9 @@ private: QList mInputDevices; QList mRegistryListeners; QWaylandIntegration *mWaylandIntegration = nullptr; +#if QT_CONFIG(cursor) + QMap mCursorThemesBySize; +#endif #if QT_CONFIG(wayland_datadevice) QScopedPointer mDndSelectionHandler; #endif From 389cc81a991d32256de00117bfb0006e21f94d55 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Tue, 15 May 2018 16:24:37 +0200 Subject: [PATCH 0533/1507] Client: Move cursor theme logic into its own class, QWaylandCursorTheme ...and out of QWaylandCursor. Encapsulates the ugly details of wayland cursor themes, and presents a simple interface. A theme is created with a given size and theme name. wl_cursor_images for a theme can be acquired through: wl_cursor_image *QWaylandCursorTheme::cursorImage(Qt::CursorShape shape); Change-Id: Ia6fc6f2997133ca25c1610ecdf075ecb5c4edbfa Reviewed-by: Paul Olav Tvete --- .../platforms/wayland/qwaylandcursor.cpp | 362 ++++++++++-------- .../platforms/wayland/qwaylandcursor_p.h | 41 +- .../platforms/wayland/qwaylanddisplay.cpp | 23 +- .../platforms/wayland/qwaylanddisplay_p.h | 6 +- 4 files changed, 231 insertions(+), 201 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandcursor.cpp b/src/plugins/platforms/wayland/qwaylandcursor.cpp index 3d2cbd76188..6947e97f1d7 100644 --- a/src/plugins/platforms/wayland/qwaylandcursor.cpp +++ b/src/plugins/platforms/wayland/qwaylandcursor.cpp @@ -53,48 +53,203 @@ QT_BEGIN_NAMESPACE namespace QtWaylandClient { -QWaylandCursor::QWaylandCursor(QWaylandScreen *screen) - : mDisplay(screen->display()) - , mCursorTheme(mDisplay->loadCursorTheme(screen->devicePixelRatio())) +QWaylandCursorTheme *QWaylandCursorTheme::create(QWaylandShm *shm, int size) { - initCursorMap(); + static QString themeName = qEnvironmentVariable("XCURSOR_THEME", QStringLiteral("default")); + return create(shm, size, themeName); } -struct wl_cursor_image *QWaylandCursor::cursorImage(Qt::CursorShape newShape) +QWaylandCursorTheme *QWaylandCursorTheme::create(QWaylandShm *shm, int size, const QString &themeName) { - struct wl_cursor *waylandCursor = nullptr; + QByteArray nameBytes = themeName.toLocal8Bit(); + struct ::wl_cursor_theme *theme = wl_cursor_theme_load(nameBytes.constData(), size, shm->object()); - /* Hide cursor */ - if (newShape == Qt::BlankCursor) - { - mDisplay->setCursor(nullptr, nullptr, 1); + if (!theme) { + qCWarning(lcQpaWayland) << "Could not load cursor theme" << themeName << "size" << size; return nullptr; } - if (newShape < Qt::BitmapCursor) { - waylandCursor = requestCursor((WaylandCursor)newShape); - } else if (newShape == Qt::BitmapCursor) { - // cannot create a wl_cursor_image for a CursorShape + return new QWaylandCursorTheme(theme); +} + +QWaylandCursorTheme::~QWaylandCursorTheme() +{ + wl_cursor_theme_destroy(m_theme); +} + +wl_cursor *QWaylandCursorTheme::requestCursor(WaylandCursor shape) +{ + if (struct wl_cursor *cursor = m_cursors.value(shape, nullptr)) + return cursor; + + static const QMultiMapcursorNamesMap { + {ArrowCursor, "left_ptr"}, + {ArrowCursor, "default"}, + {ArrowCursor, "top_left_arrow"}, + {ArrowCursor, "left_arrow"}, + + {UpArrowCursor, "up_arrow"}, + + {CrossCursor, "cross"}, + + {WaitCursor, "wait"}, + {WaitCursor, "watch"}, + {WaitCursor, "0426c94ea35c87780ff01dc239897213"}, + + {IBeamCursor, "ibeam"}, + {IBeamCursor, "text"}, + {IBeamCursor, "xterm"}, + + {SizeVerCursor, "size_ver"}, + {SizeVerCursor, "ns-resize"}, + {SizeVerCursor, "v_double_arrow"}, + {SizeVerCursor, "00008160000006810000408080010102"}, + + {SizeHorCursor, "size_hor"}, + {SizeHorCursor, "ew-resize"}, + {SizeHorCursor, "h_double_arrow"}, + {SizeHorCursor, "028006030e0e7ebffc7f7070c0600140"}, + + {SizeBDiagCursor, "size_bdiag"}, + {SizeBDiagCursor, "nesw-resize"}, + {SizeBDiagCursor, "50585d75b494802d0151028115016902"}, + {SizeBDiagCursor, "fcf1c3c7cd4491d801f1e1c78f100000"}, + + {SizeFDiagCursor, "size_fdiag"}, + {SizeFDiagCursor, "nwse-resize"}, + {SizeFDiagCursor, "38c5dff7c7b8962045400281044508d2"}, + {SizeFDiagCursor, "c7088f0f3e6c8088236ef8e1e3e70000"}, + + {SizeAllCursor, "size_all"}, + + {SplitVCursor, "split_v"}, + {SplitVCursor, "row-resize"}, + {SplitVCursor, "sb_v_double_arrow"}, + {SplitVCursor, "2870a09082c103050810ffdffffe0204"}, + {SplitVCursor, "c07385c7190e701020ff7ffffd08103c"}, + + {SplitHCursor, "split_h"}, + {SplitHCursor, "col-resize"}, + {SplitHCursor, "sb_h_double_arrow"}, + {SplitHCursor, "043a9f68147c53184671403ffa811cc5"}, + {SplitHCursor, "14fef782d02440884392942c11205230"}, + + {PointingHandCursor, "pointing_hand"}, + {PointingHandCursor, "pointer"}, + {PointingHandCursor, "hand1"}, + {PointingHandCursor, "e29285e634086352946a0e7090d73106"}, + + {ForbiddenCursor, "forbidden"}, + {ForbiddenCursor, "not-allowed"}, + {ForbiddenCursor, "crossed_circle"}, + {ForbiddenCursor, "circle"}, + {ForbiddenCursor, "03b6e0fcb3499374a867c041f52298f0"}, + + {WhatsThisCursor, "whats_this"}, + {WhatsThisCursor, "help"}, + {WhatsThisCursor, "question_arrow"}, + {WhatsThisCursor, "5c6cd98b3f3ebcb1f9c7f1c204630408"}, + {WhatsThisCursor, "d9ce0ab605698f320427677b458ad60b"}, + + {BusyCursor, "left_ptr_watch"}, + {BusyCursor, "half-busy"}, + {BusyCursor, "progress"}, + {BusyCursor, "00000000000000020006000e7e9ffc3f"}, + {BusyCursor, "08e8e1c95fe2fc01f976f1e063a24ccd"}, + + {OpenHandCursor, "openhand"}, + {OpenHandCursor, "fleur"}, + {OpenHandCursor, "5aca4d189052212118709018842178c0"}, + {OpenHandCursor, "9d800788f1b08800ae810202380a0822"}, + + {ClosedHandCursor, "closedhand"}, + {ClosedHandCursor, "grabbing"}, + {ClosedHandCursor, "208530c400c041818281048008011002"}, + + {DragCopyCursor, "dnd-copy"}, + {DragCopyCursor, "copy"}, + + {DragMoveCursor, "dnd-move"}, + {DragMoveCursor, "move"}, + + {DragLinkCursor, "dnd-link"}, + {DragLinkCursor, "link"}, + + {ResizeNorthCursor, "n-resize"}, + {ResizeNorthCursor, "top_side"}, + + {ResizeSouthCursor, "s-resize"}, + {ResizeSouthCursor, "bottom_side"}, + + {ResizeEastCursor, "e-resize"}, + {ResizeEastCursor, "right_side"}, + + {ResizeWestCursor, "w-resize"}, + {ResizeWestCursor, "left_side"}, + + {ResizeNorthWestCursor, "nw-resize"}, + {ResizeNorthWestCursor, "top_left_corner"}, + + {ResizeSouthEastCursor, "se-resize"}, + {ResizeSouthEastCursor, "bottom_right_corner"}, + + {ResizeNorthEastCursor, "ne-resize"}, + {ResizeNorthEastCursor, "top_right_corner"}, + + {ResizeSouthWestCursor, "sw-resize"}, + {ResizeSouthWestCursor, "bottom_left_corner"}, + }; + + QList cursorNames = cursorNamesMap.values(shape); + for (auto &name : qAsConst(cursorNames)) { + if (wl_cursor *cursor = wl_cursor_theme_get_cursor(m_theme, name.constData())) { + m_cursors.insert(shape, cursor); + return cursor; + } + } + + // Fallback to arrow cursor + if (shape != ArrowCursor) + return requestCursor(ArrowCursor); + + // Give up + return nullptr; +} + +struct wl_cursor_image *QWaylandCursorTheme::cursorImage(Qt::CursorShape shape) +{ + struct wl_cursor *waylandCursor = nullptr; + + if (shape < Qt::BitmapCursor) { + waylandCursor = requestCursor(WaylandCursor(shape)); + } else if (shape == Qt::BitmapCursor) { + qCWarning(lcQpaWayland) << "cannot create a wl_cursor_image for a CursorShape"; return nullptr; } else { //TODO: Custom cursor logic (for resize arrows) } if (!waylandCursor) { - qDebug("Could not find cursor for shape %d", newShape); + qCWarning(lcQpaWayland) << "Could not find cursor for shape" << shape; return nullptr; } struct wl_cursor_image *image = waylandCursor->images[0]; struct wl_buffer *buffer = wl_cursor_image_get_buffer(image); if (!buffer) { - qDebug("Could not find buffer for cursor"); + qCWarning(lcQpaWayland) << "Could not find buffer for cursor"; return nullptr; } return image; } +QWaylandCursor::QWaylandCursor(QWaylandScreen *screen) + : mDisplay(screen->display()) + , mCursorTheme(mDisplay->loadCursorTheme(screen->devicePixelRatio())) +{ +} + QSharedPointer QWaylandCursor::cursorBitmapImage(const QCursor *cursor) { if (cursor->shape() != Qt::BitmapCursor) @@ -106,22 +261,39 @@ QSharedPointer QWaylandCursor::cursorBitmapImage(const QCursor * return buffer; } +struct wl_cursor_image *QWaylandCursor::cursorImage(Qt::CursorShape shape) +{ + if (!mCursorTheme) + return nullptr; + return mCursorTheme->cursorImage(shape); +} + void QWaylandCursor::changeCursor(QCursor *cursor, QWindow *window) { const Qt::CursorShape newShape = cursor ? cursor->shape() : Qt::ArrowCursor; + if (newShape == Qt::BlankCursor) { + mDisplay->setCursor(nullptr, nullptr, 1); + return; + } + if (newShape == Qt::BitmapCursor) { mDisplay->setCursor(cursorBitmapImage(cursor), cursor->hotSpot(), window->screen()->devicePixelRatio()); return; } - struct wl_cursor_image *image = cursorImage(newShape); - if (!image) { + if (!mCursorTheme) { + qCWarning(lcQpaWayland) << "Can't set cursor from shape with no cursor theme"; return; } - struct wl_buffer *buffer = wl_cursor_image_get_buffer(image); - mDisplay->setCursor(buffer, image, window->screen()->devicePixelRatio()); + if (struct ::wl_cursor_image *image = mCursorTheme->cursorImage(newShape)) { + struct wl_buffer *buffer = wl_cursor_image_get_buffer(image); + mDisplay->setCursor(buffer, image, window->screen()->devicePixelRatio()); + return; + } + + qCWarning(lcQpaWayland) << "Unable to change to cursor" << cursor; } void QWaylandCursor::pointerEvent(const QMouseEvent &event) @@ -137,155 +309,7 @@ QPoint QWaylandCursor::pos() const void QWaylandCursor::setPos(const QPoint &pos) { Q_UNUSED(pos); - qWarning() << "QWaylandCursor::setPos: not implemented"; -} - -wl_cursor *QWaylandCursor::requestCursor(WaylandCursor shape) -{ - struct wl_cursor *cursor = mCursors.value(shape, 0); - - //If the cursor has not been loaded already, load it - if (!cursor) { - if (!mCursorTheme) - return nullptr; - - QList cursorNames = mCursorNamesMap.values(shape); - foreach (const QByteArray &name, cursorNames) { - cursor = wl_cursor_theme_get_cursor(mCursorTheme, name.constData()); - if (cursor) { - mCursors.insert(shape, cursor); - break; - } - } - } - - //If there still no cursor for a shape, use the default cursor - if (!cursor && shape != ArrowCursor) { - cursor = requestCursor(ArrowCursor); - } - - return cursor; -} - - -void QWaylandCursor::initCursorMap() -{ - //Fill the cursor name map will the table of xcursor names - mCursorNamesMap.insert(ArrowCursor, "left_ptr"); - mCursorNamesMap.insert(ArrowCursor, "default"); - mCursorNamesMap.insert(ArrowCursor, "top_left_arrow"); - mCursorNamesMap.insert(ArrowCursor, "left_arrow"); - - mCursorNamesMap.insert(UpArrowCursor, "up_arrow"); - - mCursorNamesMap.insert(CrossCursor, "cross"); - - mCursorNamesMap.insert(WaitCursor, "wait"); - mCursorNamesMap.insert(WaitCursor, "watch"); - mCursorNamesMap.insert(WaitCursor, "0426c94ea35c87780ff01dc239897213"); - - mCursorNamesMap.insert(IBeamCursor, "ibeam"); - mCursorNamesMap.insert(IBeamCursor, "text"); - mCursorNamesMap.insert(IBeamCursor, "xterm"); - - mCursorNamesMap.insert(SizeVerCursor, "size_ver"); - mCursorNamesMap.insert(SizeVerCursor, "ns-resize"); - mCursorNamesMap.insert(SizeVerCursor, "v_double_arrow"); - mCursorNamesMap.insert(SizeVerCursor, "00008160000006810000408080010102"); - - mCursorNamesMap.insert(SizeHorCursor, "size_hor"); - mCursorNamesMap.insert(SizeHorCursor, "ew-resize"); - mCursorNamesMap.insert(SizeHorCursor, "h_double_arrow"); - mCursorNamesMap.insert(SizeHorCursor, "028006030e0e7ebffc7f7070c0600140"); - - mCursorNamesMap.insert(SizeBDiagCursor, "size_bdiag"); - mCursorNamesMap.insert(SizeBDiagCursor, "nesw-resize"); - mCursorNamesMap.insert(SizeBDiagCursor, "50585d75b494802d0151028115016902"); - mCursorNamesMap.insert(SizeBDiagCursor, "fcf1c3c7cd4491d801f1e1c78f100000"); - - mCursorNamesMap.insert(SizeFDiagCursor, "size_fdiag"); - mCursorNamesMap.insert(SizeFDiagCursor, "nwse-resize"); - mCursorNamesMap.insert(SizeFDiagCursor, "38c5dff7c7b8962045400281044508d2"); - mCursorNamesMap.insert(SizeFDiagCursor, "c7088f0f3e6c8088236ef8e1e3e70000"); - - mCursorNamesMap.insert(SizeAllCursor, "size_all"); - - mCursorNamesMap.insert(SplitVCursor, "split_v"); - mCursorNamesMap.insert(SplitVCursor, "row-resize"); - mCursorNamesMap.insert(SplitVCursor, "sb_v_double_arrow"); - mCursorNamesMap.insert(SplitVCursor, "2870a09082c103050810ffdffffe0204"); - mCursorNamesMap.insert(SplitVCursor, "c07385c7190e701020ff7ffffd08103c"); - - mCursorNamesMap.insert(SplitHCursor, "split_h"); - mCursorNamesMap.insert(SplitHCursor, "col-resize"); - mCursorNamesMap.insert(SplitHCursor, "sb_h_double_arrow"); - mCursorNamesMap.insert(SplitHCursor, "043a9f68147c53184671403ffa811cc5"); - mCursorNamesMap.insert(SplitHCursor, "14fef782d02440884392942c11205230"); - - mCursorNamesMap.insert(PointingHandCursor, "pointing_hand"); - mCursorNamesMap.insert(PointingHandCursor, "pointer"); - mCursorNamesMap.insert(PointingHandCursor, "hand1"); - mCursorNamesMap.insert(PointingHandCursor, "e29285e634086352946a0e7090d73106"); - - mCursorNamesMap.insert(ForbiddenCursor, "forbidden"); - mCursorNamesMap.insert(ForbiddenCursor, "not-allowed"); - mCursorNamesMap.insert(ForbiddenCursor, "crossed_circle"); - mCursorNamesMap.insert(ForbiddenCursor, "circle"); - mCursorNamesMap.insert(ForbiddenCursor, "03b6e0fcb3499374a867c041f52298f0"); - - mCursorNamesMap.insert(WhatsThisCursor, "whats_this"); - mCursorNamesMap.insert(WhatsThisCursor, "help"); - mCursorNamesMap.insert(WhatsThisCursor, "question_arrow"); - mCursorNamesMap.insert(WhatsThisCursor, "5c6cd98b3f3ebcb1f9c7f1c204630408"); - mCursorNamesMap.insert(WhatsThisCursor, "d9ce0ab605698f320427677b458ad60b"); - - mCursorNamesMap.insert(BusyCursor, "left_ptr_watch"); - mCursorNamesMap.insert(BusyCursor, "half-busy"); - mCursorNamesMap.insert(BusyCursor, "progress"); - mCursorNamesMap.insert(BusyCursor, "00000000000000020006000e7e9ffc3f"); - mCursorNamesMap.insert(BusyCursor, "08e8e1c95fe2fc01f976f1e063a24ccd"); - - mCursorNamesMap.insert(OpenHandCursor, "openhand"); - mCursorNamesMap.insert(OpenHandCursor, "fleur"); - mCursorNamesMap.insert(OpenHandCursor, "5aca4d189052212118709018842178c0"); - mCursorNamesMap.insert(OpenHandCursor, "9d800788f1b08800ae810202380a0822"); - - mCursorNamesMap.insert(ClosedHandCursor, "closedhand"); - mCursorNamesMap.insert(ClosedHandCursor, "grabbing"); - mCursorNamesMap.insert(ClosedHandCursor, "208530c400c041818281048008011002"); - - mCursorNamesMap.insert(DragCopyCursor, "dnd-copy"); - mCursorNamesMap.insert(DragCopyCursor, "copy"); - - mCursorNamesMap.insert(DragMoveCursor, "dnd-move"); - mCursorNamesMap.insert(DragMoveCursor, "move"); - - mCursorNamesMap.insert(DragLinkCursor, "dnd-link"); - mCursorNamesMap.insert(DragLinkCursor, "link"); - - mCursorNamesMap.insert(ResizeNorthCursor, "n-resize"); - mCursorNamesMap.insert(ResizeNorthCursor, "top_side"); - - mCursorNamesMap.insert(ResizeSouthCursor, "s-resize"); - mCursorNamesMap.insert(ResizeSouthCursor, "bottom_side"); - - mCursorNamesMap.insert(ResizeEastCursor, "e-resize"); - mCursorNamesMap.insert(ResizeEastCursor, "right_side"); - - mCursorNamesMap.insert(ResizeWestCursor, "w-resize"); - mCursorNamesMap.insert(ResizeWestCursor, "left_side"); - - mCursorNamesMap.insert(ResizeNorthWestCursor, "nw-resize"); - mCursorNamesMap.insert(ResizeNorthWestCursor, "top_left_corner"); - - mCursorNamesMap.insert(ResizeSouthEastCursor, "se-resize"); - mCursorNamesMap.insert(ResizeSouthEastCursor, "bottom_right_corner"); - - mCursorNamesMap.insert(ResizeNorthEastCursor, "ne-resize"); - mCursorNamesMap.insert(ResizeNorthEastCursor, "top_right_corner"); - - mCursorNamesMap.insert(ResizeSouthWestCursor, "sw-resize"); - mCursorNamesMap.insert(ResizeSouthWestCursor, "bottom_left_corner"); + qCWarning(lcQpaWayland) << "Setting cursor position is not possible on wayland"; } } diff --git a/src/plugins/platforms/wayland/qwaylandcursor_p.h b/src/plugins/platforms/wayland/qwaylandcursor_p.h index 532e46c1966..71f9cd1b8b7 100644 --- a/src/plugins/platforms/wayland/qwaylandcursor_p.h +++ b/src/plugins/platforms/wayland/qwaylandcursor_p.h @@ -68,19 +68,15 @@ namespace QtWaylandClient { class QWaylandBuffer; class QWaylandDisplay; class QWaylandScreen; +class QWaylandShm; -class Q_WAYLAND_CLIENT_EXPORT QWaylandCursor : public QPlatformCursor +class Q_WAYLAND_CLIENT_EXPORT QWaylandCursorTheme { public: - QWaylandCursor(QWaylandScreen *screen); - - void changeCursor(QCursor *cursor, QWindow *window) override; - void pointerEvent(const QMouseEvent &event) override; - QPoint pos() const override; - void setPos(const QPoint &pos) override; - + static QWaylandCursorTheme *create(QWaylandShm *shm, int size); + static QWaylandCursorTheme *create(QWaylandShm *shm, int size, const QString &themeName); + ~QWaylandCursorTheme(); struct wl_cursor_image *cursorImage(Qt::CursorShape shape); - QSharedPointer cursorBitmapImage(const QCursor *cursor); private: enum WaylandCursor { @@ -106,6 +102,7 @@ private: DragCopyCursor, DragMoveCursor, DragLinkCursor, + // The following are used for cursors that don't have equivalents in Qt ResizeNorthCursor = Qt::CustomCursor + 1, ResizeSouthCursor, ResizeEastCursor, @@ -116,13 +113,29 @@ private: ResizeSouthWestCursor }; - struct wl_cursor* requestCursor(WaylandCursor shape); - void initCursorMap(); + explicit QWaylandCursorTheme(struct ::wl_cursor_theme *theme) : m_theme(theme) {} + struct ::wl_cursor *requestCursor(WaylandCursor shape); + struct ::wl_cursor_theme *m_theme = nullptr; + QMap m_cursors; +}; + +class Q_WAYLAND_CLIENT_EXPORT QWaylandCursor : public QPlatformCursor +{ +public: + QWaylandCursor(QWaylandScreen *screen); + + void changeCursor(QCursor *cursor, QWindow *window) override; + void pointerEvent(const QMouseEvent &event) override; + QPoint pos() const override; + void setPos(const QPoint &pos) override; + + QSharedPointer cursorBitmapImage(const QCursor *cursor); + struct wl_cursor_image *cursorImage(Qt::CursorShape shape); + +private: QWaylandDisplay *mDisplay = nullptr; - struct wl_cursor_theme *mCursorTheme = nullptr; + QWaylandCursorTheme *mCursorTheme = nullptr; QPoint mLastPos; - QMap mCursors; - QMultiMap mCursorNamesMap; }; } diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index 6a6370bf925..1cb499f5e0f 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -159,9 +159,7 @@ QWaylandDisplay::~QWaylandDisplay(void) delete mDndSelectionHandler.take(); #endif #if QT_CONFIG(cursor) - for (auto *cursorTheme : mCursorThemesBySize) - wl_cursor_theme_destroy(cursorTheme); - mCursorThemesBySize.clear(); + qDeleteAll(mCursorThemesBySize); #endif if (mDisplay) wl_display_disconnect(mDisplay); @@ -502,13 +500,9 @@ void QWaylandDisplay::setCursor(const QSharedPointer &buffer, co } } -struct ::wl_cursor_theme *QWaylandDisplay::loadCursorTheme(qreal devicePixelRatio) +QWaylandCursorTheme *QWaylandDisplay::loadCursorTheme(qreal devicePixelRatio) { - QByteArray themeName = qgetenv("XCURSOR_THEME"); - if (themeName.isEmpty()) - themeName = QByteArray("default"); - - int cursorSize = qEnvironmentVariableIntValue("XCURSOR_SIZE"); + static int cursorSize = qEnvironmentVariableIntValue("XCURSOR_SIZE"); if (cursorSize <= 0) cursorSize = 32; if (compositorVersion() >= 3) // set_buffer_scale is not supported on earlier versions @@ -517,13 +511,12 @@ struct ::wl_cursor_theme *QWaylandDisplay::loadCursorTheme(qreal devicePixelRati if (auto *theme = mCursorThemesBySize.value(cursorSize, nullptr)) return theme; - struct ::wl_cursor_theme *theme = wl_cursor_theme_load(themeName, cursorSize, shm()->object()); + if (auto *theme = QWaylandCursorTheme::create(shm(), cursorSize)) { + mCursorThemesBySize[cursorSize] = theme; + return theme; + } - if (!theme) - qCWarning(lcQpaWayland) << "Could not load cursor theme" << themeName; - - mCursorThemesBySize[cursorSize] = theme; - return theme; + return nullptr; } #endif // QT_CONFIG(cursor) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay_p.h b/src/plugins/platforms/wayland/qwaylanddisplay_p.h index 521119fe8d5..8570eba03e9 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay_p.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay_p.h @@ -66,7 +66,6 @@ #include struct wl_cursor_image; -struct wl_cursor_theme; QT_BEGIN_NAMESPACE @@ -95,6 +94,7 @@ class QWaylandWindow; class QWaylandIntegration; class QWaylandHardwareIntegration; class QWaylandShellSurface; +class QWaylandCursorTheme; typedef void (*RegistryListener)(void *data, struct wl_registry *registry, @@ -124,7 +124,7 @@ public: #if QT_CONFIG(cursor) void setCursor(struct wl_buffer *buffer, struct wl_cursor_image *image, qreal dpr); void setCursor(const QSharedPointer &buffer, const QPoint &hotSpot, qreal dpr); - struct ::wl_cursor_theme *loadCursorTheme(qreal devicePixelRatio); + QWaylandCursorTheme *loadCursorTheme(qreal devicePixelRatio); #endif struct wl_display *wl_display() const { return mDisplay; } struct ::wl_registry *wl_registry() { return object(); } @@ -202,7 +202,7 @@ private: QList mRegistryListeners; QWaylandIntegration *mWaylandIntegration = nullptr; #if QT_CONFIG(cursor) - QMap mCursorThemesBySize; + QMap mCursorThemesBySize; #endif #if QT_CONFIG(wayland_datadevice) QScopedPointer mDndSelectionHandler; From 4183147e80e522b49711579fccd453b4e38fedb3 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Mon, 28 May 2018 11:39:12 +0200 Subject: [PATCH 0534/1507] Fix flakiness in xdg-shell v6 client tests Change-Id: I4b63edef6ea130ad7f7f294bf0903d84b8db4723 Reviewed-by: Paul Olav Tvete --- tests/auto/wayland/xdgshellv6/tst_xdgshellv6.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/auto/wayland/xdgshellv6/tst_xdgshellv6.cpp b/tests/auto/wayland/xdgshellv6/tst_xdgshellv6.cpp index 0f72f58a9cf..070a9a34c79 100644 --- a/tests/auto/wayland/xdgshellv6/tst_xdgshellv6.cpp +++ b/tests/auto/wayland/xdgshellv6/tst_xdgshellv6.cpp @@ -169,6 +169,10 @@ void tst_WaylandClientXdgShellV6::showMinimized() window.showMinimized(); QCOMPARE(window.windowStates(), Qt::WindowMinimized); // should return minimized until QTRY_COMPARE(window.windowStates(), Qt::WindowNoState); // rejected by handleWindowStateChanged + + // Make sure the window on the compositor side is/was created here, and not after the test + // finishes, as that may mess up for later tests. + QTRY_VERIFY(m_compositor->xdgToplevelV6()); } void tst_WaylandClientXdgShellV6::setMinimized() From 390856f452f62d10f00b844e3849a834395a2b17 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Thu, 24 May 2018 12:12:53 +0200 Subject: [PATCH 0535/1507] Client: Move xdg-shell-v6 to a plugin [ChangeLog][QPA plugin] The xdg-shell-v6 shell integration has been moved to a plugin. Change-Id: I548d19590ddbc8ad3e791301359a6de17ac9dcd8 Reviewed-by: Paul Olav Tvete --- src/plugins/platforms/wayland/client.pro | 5 -- .../shellintegration/shellintegration.pro | 1 + .../shellintegration/xdg-shell-v6/main.cpp | 68 +++++++++++++++++++ .../xdg-shell-v6}/qwaylandxdgshellv6.cpp | 10 +-- .../xdg-shell-v6}/qwaylandxdgshellv6_p.h | 9 +-- .../qwaylandxdgshellv6integration.cpp | 27 ++------ .../qwaylandxdgshellv6integration_p.h | 10 +-- .../xdg-shell-v6/xdg-shell-v6.json | 3 + .../xdg-shell-v6/xdg-shell-v6.pro | 23 +++++++ .../platforms/wayland/qwaylandintegration.cpp | 5 +- 10 files changed, 116 insertions(+), 45 deletions(-) create mode 100644 src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/main.cpp rename src/plugins/platforms/wayland/{ => plugins/shellintegration/xdg-shell-v6}/qwaylandxdgshellv6.cpp (97%) rename src/plugins/platforms/wayland/{ => plugins/shellintegration/xdg-shell-v6}/qwaylandxdgshellv6_p.h (98%) rename src/plugins/platforms/wayland/{ => plugins/shellintegration/xdg-shell-v6}/qwaylandxdgshellv6integration.cpp (80%) rename src/plugins/platforms/wayland/{ => plugins/shellintegration/xdg-shell-v6}/qwaylandxdgshellv6integration_p.h (92%) create mode 100644 src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/xdg-shell-v6.json create mode 100644 src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/xdg-shell-v6.pro diff --git a/src/plugins/platforms/wayland/client.pro b/src/plugins/platforms/wayland/client.pro index 3b11902de8b..593e8daf67f 100644 --- a/src/plugins/platforms/wayland/client.pro +++ b/src/plugins/platforms/wayland/client.pro @@ -28,7 +28,6 @@ WAYLANDCLIENTSOURCES += \ ../extensions/qt-key-unstable-v1.xml \ ../extensions/qt-windowmanager.xml \ ../3rdparty/protocol/text-input-unstable-v2.xml \ - ../3rdparty/protocol/xdg-shell-unstable-v6.xml \ WAYLANDCLIENTSOURCES_SYSTEM += \ ../3rdparty/protocol/wayland.xml \ @@ -42,8 +41,6 @@ SOURCES += qwaylandintegration.cpp \ qwaylandscreen.cpp \ qwaylandshmwindow.cpp \ qwaylandshellsurface.cpp \ - qwaylandxdgshellv6.cpp \ - qwaylandxdgshellv6integration.cpp \ qwaylandextendedsurface.cpp \ qwaylandsubsurface.cpp \ qwaylandtouch.cpp \ @@ -69,8 +66,6 @@ HEADERS += qwaylandintegration_p.h \ qwaylandbuffer_p.h \ qwaylandshmwindow_p.h \ qwaylandshellsurface_p.h \ - qwaylandxdgshellv6_p.h \ - qwaylandxdgshellv6integration_p.h \ qwaylandextendedsurface_p.h \ qwaylandsubsurface_p.h \ qwaylandtouch_p.h \ diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/shellintegration.pro b/src/plugins/platforms/wayland/plugins/shellintegration/shellintegration.pro index 12a900db253..9be4e82a598 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/shellintegration.pro +++ b/src/plugins/platforms/wayland/plugins/shellintegration/shellintegration.pro @@ -3,5 +3,6 @@ TEMPLATE = subdirs SUBDIRS += \ ivi-shell \ xdg-shell-v5 \ + xdg-shell-v6 \ wl-shell \ diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/main.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/main.cpp new file mode 100644 index 00000000000..8cd302f328a --- /dev/null +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/main.cpp @@ -0,0 +1,68 @@ +/**************************************************************************** +** +** Copyright (C) 2018 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qwaylandxdgshellv6integration_p.h" + +#include + +QT_BEGIN_NAMESPACE + +namespace QtWaylandClient { + +class QWaylandXdgShellV6IntegrationPlugin : public QWaylandShellIntegrationPlugin +{ + Q_OBJECT + Q_PLUGIN_METADATA(IID QWaylandShellIntegrationFactoryInterface_iid FILE "xdg-shell-v6.json") + +public: + QWaylandShellIntegration *create(const QString &key, const QStringList ¶mList) override; +}; + +QWaylandShellIntegration *QWaylandXdgShellV6IntegrationPlugin::create(const QString &key, const QStringList ¶mList) +{ + Q_UNUSED(key); + Q_UNUSED(paramList); + return new QWaylandXdgShellV6Integration(); +} + +} + +QT_END_NAMESPACE + +#include "main.moc" diff --git a/src/plugins/platforms/wayland/qwaylandxdgshellv6.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp similarity index 97% rename from src/plugins/platforms/wayland/qwaylandxdgshellv6.cpp rename to src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp index beabddbbb48..550575f11b5 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgshellv6.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp @@ -40,11 +40,11 @@ #include "qwaylandxdgshellv6_p.h" -#include "qwaylanddisplay_p.h" -#include "qwaylandwindow_p.h" -#include "qwaylandinputdevice_p.h" -#include "qwaylandscreen_p.h" -#include "qwaylandabstractdecoration_p.h" +#include +#include +#include +#include +#include QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandxdgshellv6_p.h b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6_p.h similarity index 98% rename from src/plugins/platforms/wayland/qwaylandxdgshellv6_p.h rename to src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6_p.h index d2448bc664f..574e6dd9fb2 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgshellv6_p.h +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6_p.h @@ -52,15 +52,16 @@ // We mean it. // +#include "qwayland-xdg-shell-unstable-v6.h" + +#include +#include + #include #include #include -#include -#include -#include "qwaylandshellsurface_p.h" - QT_BEGIN_NAMESPACE class QWindow; diff --git a/src/plugins/platforms/wayland/qwaylandxdgshellv6integration.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6integration.cpp similarity index 80% rename from src/plugins/platforms/wayland/qwaylandxdgshellv6integration.cpp rename to src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6integration.cpp index 0eb6b592925..03164316514 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgshellv6integration.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6integration.cpp @@ -41,39 +41,26 @@ #include #include -#include QT_BEGIN_NAMESPACE namespace QtWaylandClient { -QWaylandXdgShellV6Integration::QWaylandXdgShellV6Integration(QWaylandDisplay *display) +bool QWaylandXdgShellV6Integration::initialize(QWaylandDisplay *display) { for (QWaylandDisplay::RegistryGlobal global : display->globals()) { if (global.interface == QLatin1String("zxdg_shell_v6")) { - m_xdgShell = new QWaylandXdgShellV6(display->wl_registry(), global.id, global.version); + m_xdgShell.reset(new QWaylandXdgShellV6(display->wl_registry(), global.id, global.version)); break; } } -} -QWaylandXdgShellV6Integration *QWaylandXdgShellV6Integration::create(QWaylandDisplay *display) -{ - if (!display->hasRegistryGlobal(QLatin1String("zxdg_shell_v6"))) - return nullptr; + if (!m_xdgShell) { + qCDebug(lcQpaWayland) << "Couldn't find global zxdg_shell_v6 for xdg-shell unstable v6"; + return false; + } - QScopedPointer integration; - integration.reset(new QWaylandXdgShellV6Integration(display)); - if (integration && !integration->initialize(display)) - return nullptr; - - return integration.take(); -} - -bool QWaylandXdgShellV6Integration::initialize(QWaylandDisplay *display) -{ - QWaylandShellIntegration::initialize(display); - return m_xdgShell != nullptr; + return QWaylandShellIntegration::initialize(display); } QWaylandShellSurface *QWaylandXdgShellV6Integration::createShellSurface(QWaylandWindow *window) diff --git a/src/plugins/platforms/wayland/qwaylandxdgshellv6integration_p.h b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6integration_p.h similarity index 92% rename from src/plugins/platforms/wayland/qwaylandxdgshellv6integration_p.h rename to src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6integration_p.h index 66323a77533..261f8cbb4f3 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgshellv6integration_p.h +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6integration_p.h @@ -51,7 +51,7 @@ // We mean it. // -#include +#include "qwaylandxdgshellv6_p.h" #include @@ -59,20 +59,16 @@ QT_BEGIN_NAMESPACE namespace QtWaylandClient { -class QWaylandXdgShellV6; - class Q_WAYLAND_CLIENT_EXPORT QWaylandXdgShellV6Integration : public QWaylandShellIntegration { public: - static QWaylandXdgShellV6Integration *create(QWaylandDisplay* display); + QWaylandXdgShellV6Integration() {} bool initialize(QWaylandDisplay *display) override; QWaylandShellSurface *createShellSurface(QWaylandWindow *window) override; void handleKeyboardFocusChanged(QWaylandWindow *newFocus, QWaylandWindow *oldFocus) override; private: - QWaylandXdgShellV6Integration(QWaylandDisplay *display); - - QWaylandXdgShellV6 *m_xdgShell = nullptr; + QScopedPointer m_xdgShell; }; } diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/xdg-shell-v6.json b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/xdg-shell-v6.json new file mode 100644 index 00000000000..b1b8db31b4f --- /dev/null +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/xdg-shell-v6.json @@ -0,0 +1,3 @@ +{ + "Keys":[ "xdg-shell-v6" ] +} diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/xdg-shell-v6.pro b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/xdg-shell-v6.pro new file mode 100644 index 00000000000..a5e0a51055f --- /dev/null +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/xdg-shell-v6.pro @@ -0,0 +1,23 @@ +QT += gui-private waylandclient-private +CONFIG += wayland-scanner + +QMAKE_USE += wayland-client + +WAYLANDCLIENTSOURCES += \ + ../../../3rdparty/protocol/xdg-shell-unstable-v6.xml + +HEADERS += \ + qwaylandxdgshellv6_p.h \ + qwaylandxdgshellv6integration_p.h \ + +SOURCES += \ + main.cpp \ + qwaylandxdgshellv6.cpp \ + qwaylandxdgshellv6integration.cpp \ + +OTHER_FILES += \ + xdg-shell-v6.json + +PLUGIN_TYPE = wayland-shell-integration +PLUGIN_CLASS_NAME = QWaylandXdgShellV6IntegrationPlugin +load(qt_plugin) diff --git a/src/plugins/platforms/wayland/qwaylandintegration.cpp b/src/plugins/platforms/wayland/qwaylandintegration.cpp index fbfdd57f48b..6ab5f0f203a 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandintegration.cpp @@ -77,7 +77,6 @@ #include "qwaylandshellintegration_p.h" #include "qwaylandshellintegrationfactory_p.h" -#include "qwaylandxdgshellv6integration_p.h" #include "qwaylandinputdeviceintegration_p.h" #include "qwaylandinputdeviceintegrationfactory_p.h" @@ -441,9 +440,7 @@ void QWaylandIntegration::initializeInputDeviceIntegration() QWaylandShellIntegration *QWaylandIntegration::createShellIntegration(const QString &integrationName) { - if (integrationName == QLatin1Literal("xdg-shell-v6")) { - return QWaylandXdgShellV6Integration::create(mDisplay.data()); - } else if (QWaylandShellIntegrationFactory::keys().contains(integrationName)) { + if (QWaylandShellIntegrationFactory::keys().contains(integrationName)) { return QWaylandShellIntegrationFactory::create(integrationName, mDisplay.data()); } else { qCWarning(lcQpaWayland) << "No shell integration named" << integrationName << "found"; From b8410dd23918a05844c06ffe44921d61df5cdd8b Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Wed, 2 May 2018 14:41:00 +0200 Subject: [PATCH 0536/1507] Client tests: Ensure there are no leftover ivi_surfaces Similarly to what we do for xdg-shell v6. Change-Id: Id72d0af53c7bcee461b741341bf6b587ffe98522 Reviewed-by: Paul Olav Tvete --- tests/auto/wayland/client/tst_client.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/auto/wayland/client/tst_client.cpp b/tests/auto/wayland/client/tst_client.cpp index 978a9d5e629..a8e2d5e19dd 100644 --- a/tests/auto/wayland/client/tst_client.cpp +++ b/tests/auto/wayland/client/tst_client.cpp @@ -162,6 +162,7 @@ public slots: // make sure the surfaces from the last test are properly cleaned up // and don't show up as false positives in the next test QTRY_VERIFY(!compositor->surface()); + QTRY_VERIFY(!compositor->iviSurface()); QTRY_VERIFY(!compositor->xdgToplevelV6()); } From 53749e2944052b2feddba305a097a38d9a7bca7b Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Fri, 25 May 2018 12:14:22 +0200 Subject: [PATCH 0537/1507] Client: Set unconfigured xdg surfaces (v6) as not exposed Previously, isExposed would always return true, which resulted in a wl_egl_window being created and an illegal attach and commit occurring. i.e. protocol errors such as: zxdg_surface_v6@15: error 3: xdg_surface has never been configured Change-Id: I277c65d663cfed0fe436a128fe1963d138f01c87 Reviewed-by: Paul Olav Tvete Reviewed-by: David Edmundson --- .../plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6_p.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6_p.h b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6_p.h index 574e6dd9fb2..a2d19447128 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6_p.h +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6_p.h @@ -86,6 +86,7 @@ public: void setAppId(const QString &appId) override; void setType(Qt::WindowType type, QWaylandWindow *transientParent) override; + bool isExposed() const override { return m_configured; } bool handleExpose(const QRegion &) override; bool handlesActiveState() const { return m_toplevel; } void applyConfigure() override; From 6482bf50754e36a89e157ce94096be05b108db75 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Thu, 24 May 2018 11:46:11 +0200 Subject: [PATCH 0538/1507] Client: Add shell integration for xdg-shell stable [ChangeLog][QPA plugin] Added support for xdg-shell stable. Mostly a copy of xdg_shell unstable v6 with prefixes and suffixes removed. Otherwise, this is what changed: - The global is now named "xdg_wm_base", since "xdg_shell" was taken by xdg-shell <= v5. - Anchors and gravities are not bitfields anymore. Task-number: QTBUG-66783 Change-Id: I8ca881aae52cc07b22ff5e26df13a9a1566f58f4 Reviewed-by: Paul Olav Tvete --- .../wayland/protocols/qt_attribution.json | 2 +- src/3rdparty/wayland/protocols/xdg-shell.xml | 1120 +++++++++++++++++ .../shellintegration/shellintegration.pro | 1 + .../shellintegration/xdg-shell/main.cpp | 68 + .../xdg-shell/qwaylandxdgshell.cpp | 337 +++++ .../xdg-shell/qwaylandxdgshell_p.h | 161 +++ .../xdg-shell/qwaylandxdgshellintegration.cpp | 87 ++ .../xdg-shell/qwaylandxdgshellintegration_p.h | 78 ++ .../shellintegration/xdg-shell/xdg-shell.json | 3 + .../shellintegration/xdg-shell/xdg-shell.pro | 23 + .../platforms/wayland/qwaylandintegration.cpp | 1 + 11 files changed, 1880 insertions(+), 1 deletion(-) create mode 100644 src/3rdparty/wayland/protocols/xdg-shell.xml create mode 100644 src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/main.cpp create mode 100644 src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp create mode 100644 src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h create mode 100644 src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshellintegration.cpp create mode 100644 src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshellintegration_p.h create mode 100644 src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/xdg-shell.json create mode 100644 src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/xdg-shell.pro diff --git a/src/3rdparty/wayland/protocols/qt_attribution.json b/src/3rdparty/wayland/protocols/qt_attribution.json index 94d77f6097b..d934622c957 100644 --- a/src/3rdparty/wayland/protocols/qt_attribution.json +++ b/src/3rdparty/wayland/protocols/qt_attribution.json @@ -41,7 +41,7 @@ Copyright (c) 2013 BMW Car IT GmbH" "Name": "Wayland XDG Shell Protocol", "QDocModule": "qtwaylandcompositor", "QtUsage": "Used in the Qt Wayland Compositor, and the Qt Wayland platform plugin.", - "Files": "xdg-shell-unstable-v5.xml xdg-shell-unstable-v6.xml", + "Files": "xdg-shell-unstable-v5.xml xdg-shell-unstable-v6.xml xdg-shell.xml", "Description": "The XDG-Shell protocol is an extended way to manage surfaces under Wayland compositors.", "Homepage": "https://wayland.freedesktop.org", diff --git a/src/3rdparty/wayland/protocols/xdg-shell.xml b/src/3rdparty/wayland/protocols/xdg-shell.xml new file mode 100644 index 00000000000..d524ea9e270 --- /dev/null +++ b/src/3rdparty/wayland/protocols/xdg-shell.xml @@ -0,0 +1,1120 @@ + + + + + Copyright © 2008-2013 Kristian Høgsberg + Copyright © 2013 Rafael Antognolli + Copyright © 2013 Jasper St. Pierre + Copyright © 2010-2013 Intel Corporation + Copyright © 2015-2017 Samsung Electronics Co., Ltd + Copyright © 2015-2017 Red Hat Inc. + + 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. + + + + + The xdg_wm_base interface is exposed as a global object enabling clients + to turn their wl_surfaces into windows in a desktop environment. It + defines the basic functionality needed for clients and the compositor to + create windows that can be dragged, resized, maximized, etc, as well as + creating transient windows such as popup menus. + + + + + + + + + + + + + + Destroy this xdg_wm_base object. + + Destroying a bound xdg_wm_base object while there are surfaces + still alive created by this xdg_wm_base object instance is illegal + and will result in a protocol error. + + + + + + Create a positioner object. A positioner object is used to position + surfaces relative to some parent surface. See the interface description + and xdg_surface.get_popup for details. + + + + + + + This creates an xdg_surface for the given surface. While xdg_surface + itself is not a role, the corresponding surface may only be assigned + a role extending xdg_surface, such as xdg_toplevel or xdg_popup. + + This creates an xdg_surface for the given surface. An xdg_surface is + used as basis to define a role to a given surface, such as xdg_toplevel + or xdg_popup. It also manages functionality shared between xdg_surface + based surface roles. + + See the documentation of xdg_surface for more details about what an + xdg_surface is and how it is used. + + + + + + + + A client must respond to a ping event with a pong request or + the client may be deemed unresponsive. See xdg_wm_base.ping. + + + + + + + The ping event asks the client if it's still alive. Pass the + serial specified in the event back to the compositor by sending + a "pong" request back with the specified serial. See xdg_wm_base.ping. + + Compositors can use this to determine if the client is still + alive. It's unspecified what will happen if the client doesn't + respond to the ping request, or in what timeframe. Clients should + try to respond in a reasonable amount of time. + + A compositor is free to ping in any way it wants, but a client must + always respond to any xdg_wm_base object it created. + + + + + + + + The xdg_positioner provides a collection of rules for the placement of a + child surface relative to a parent surface. Rules can be defined to ensure + the child surface remains within the visible area's borders, and to + specify how the child surface changes its position, such as sliding along + an axis, or flipping around a rectangle. These positioner-created rules are + constrained by the requirement that a child surface must intersect with or + be at least partially adjacent to its parent surface. + + See the various requests for details about possible rules. + + At the time of the request, the compositor makes a copy of the rules + specified by the xdg_positioner. Thus, after the request is complete the + xdg_positioner object can be destroyed or reused; further changes to the + object will have no effect on previous usages. + + For an xdg_positioner object to be considered complete, it must have a + non-zero size set by set_size, and a non-zero anchor rectangle set by + set_anchor_rect. Passing an incomplete xdg_positioner object when + positioning a surface raises an error. + + + + + + + + + Notify the compositor that the xdg_positioner will no longer be used. + + + + + + Set the size of the surface that is to be positioned with the positioner + object. The size is in surface-local coordinates and corresponds to the + window geometry. See xdg_surface.set_window_geometry. + + If a zero or negative size is set the invalid_input error is raised. + + + + + + + + Specify the anchor rectangle within the parent surface that the child + surface will be placed relative to. The rectangle is relative to the + window geometry as defined by xdg_surface.set_window_geometry of the + parent surface. + + When the xdg_positioner object is used to position a child surface, the + anchor rectangle may not extend outside the window geometry of the + positioned child's parent surface. + + If a negative size is set the invalid_input error is raised. + + + + + + + + + + + + + + + + + + + + + + Defines the anchor point for the anchor rectangle. The specified anchor + is used derive an anchor point that the child surface will be + positioned relative to. If a corner anchor is set (e.g. 'top_left' or + 'bottom_right'), the anchor point will be at the specified corner; + otherwise, the derived anchor point will be centered on the specified + edge, or in the center of the anchor rectangle if no edge is specified. + + + + + + + + + + + + + + + + + + + Defines in what direction a surface should be positioned, relative to + the anchor point of the parent surface. If a corner gravity is + specified (e.g. 'bottom_right' or 'top_left'), then the child surface + will be placed towards the specified gravity; otherwise, the child + surface will be centered over the anchor point on any axis that had no + gravity specified. + + + + + + + The constraint adjustment value define ways the compositor will adjust + the position of the surface, if the unadjusted position would result + in the surface being partly constrained. + + Whether a surface is considered 'constrained' is left to the compositor + to determine. For example, the surface may be partly outside the + compositor's defined 'work area', thus necessitating the child surface's + position be adjusted until it is entirely inside the work area. + + The adjustments can be combined, according to a defined precedence: 1) + Flip, 2) Slide, 3) Resize. + + + + Don't alter the surface position even if it is constrained on some + axis, for example partially outside the edge of an output. + + + + + Slide the surface along the x axis until it is no longer constrained. + + First try to slide towards the direction of the gravity on the x axis + until either the edge in the opposite direction of the gravity is + unconstrained or the edge in the direction of the gravity is + constrained. + + Then try to slide towards the opposite direction of the gravity on the + x axis until either the edge in the direction of the gravity is + unconstrained or the edge in the opposite direction of the gravity is + constrained. + + + + + Slide the surface along the y axis until it is no longer constrained. + + First try to slide towards the direction of the gravity on the y axis + until either the edge in the opposite direction of the gravity is + unconstrained or the edge in the direction of the gravity is + constrained. + + Then try to slide towards the opposite direction of the gravity on the + y axis until either the edge in the direction of the gravity is + unconstrained or the edge in the opposite direction of the gravity is + constrained. + + + + + Invert the anchor and gravity on the x axis if the surface is + constrained on the x axis. For example, if the left edge of the + surface is constrained, the gravity is 'left' and the anchor is + 'left', change the gravity to 'right' and the anchor to 'right'. + + If the adjusted position also ends up being constrained, the resulting + position of the flip_x adjustment will be the one before the + adjustment. + + + + + Invert the anchor and gravity on the y axis if the surface is + constrained on the y axis. For example, if the bottom edge of the + surface is constrained, the gravity is 'bottom' and the anchor is + 'bottom', change the gravity to 'top' and the anchor to 'top'. + + The adjusted position is calculated given the original anchor + rectangle and offset, but with the new flipped anchor and gravity + values. + + If the adjusted position also ends up being constrained, the resulting + position of the flip_y adjustment will be the one before the + adjustment. + + + + + Resize the surface horizontally so that it is completely + unconstrained. + + + + + Resize the surface vertically so that it is completely unconstrained. + + + + + + + Specify how the window should be positioned if the originally intended + position caused the surface to be constrained, meaning at least + partially outside positioning boundaries set by the compositor. The + adjustment is set by constructing a bitmask describing the adjustment to + be made when the surface is constrained on that axis. + + If no bit for one axis is set, the compositor will assume that the child + surface should not change its position on that axis when constrained. + + If more than one bit for one axis is set, the order of how adjustments + are applied is specified in the corresponding adjustment descriptions. + + The default adjustment is none. + + + + + + + Specify the surface position offset relative to the position of the + anchor on the anchor rectangle and the anchor on the surface. For + example if the anchor of the anchor rectangle is at (x, y), the surface + has the gravity bottom|right, and the offset is (ox, oy), the calculated + surface position will be (x + ox, y + oy). The offset position of the + surface is the one used for constraint testing. See + set_constraint_adjustment. + + An example use case is placing a popup menu on top of a user interface + element, while aligning the user interface element of the parent surface + with some user interface element placed somewhere in the popup surface. + + + + + + + + + An interface that may be implemented by a wl_surface, for + implementations that provide a desktop-style user interface. + + It provides a base set of functionality required to construct user + interface elements requiring management by the compositor, such as + toplevel windows, menus, etc. The types of functionality are split into + xdg_surface roles. + + Creating an xdg_surface does not set the role for a wl_surface. In order + to map an xdg_surface, the client must create a role-specific object + using, e.g., get_toplevel, get_popup. The wl_surface for any given + xdg_surface can have at most one role, and may not be assigned any role + not based on xdg_surface. + + A role must be assigned before any other requests are made to the + xdg_surface object. + + The client must call wl_surface.commit on the corresponding wl_surface + for the xdg_surface state to take effect. + + Creating an xdg_surface from a wl_surface which has a buffer attached or + committed is a client error, and any attempts by a client to attach or + manipulate a buffer prior to the first xdg_surface.configure call must + also be treated as errors. + + Mapping an xdg_surface-based role surface is defined as making it + possible for the surface to be shown by the compositor. Note that + a mapped surface is not guaranteed to be visible once it is mapped. + + For an xdg_surface to be mapped by the compositor, the following + conditions must be met: + (1) the client has assigned an xdg_surface-based role to the surface + (2) the client has set and committed the xdg_surface state and the + role-dependent state to the surface + (3) the client has committed a buffer to the surface + + A newly-unmapped surface is considered to have met condition (1) out + of the 3 required conditions for mapping a surface if its role surface + has not been destroyed. + + + + + + + + + + + Destroy the xdg_surface object. An xdg_surface must only be destroyed + after its role object has been destroyed. + + + + + + This creates an xdg_toplevel object for the given xdg_surface and gives + the associated wl_surface the xdg_toplevel role. + + See the documentation of xdg_toplevel for more details about what an + xdg_toplevel is and how it is used. + + + + + + + This creates an xdg_popup object for the given xdg_surface and gives + the associated wl_surface the xdg_popup role. + + If null is passed as a parent, a parent surface must be specified using + some other protocol, before committing the initial state. + + See the documentation of xdg_popup for more details about what an + xdg_popup is and how it is used. + + + + + + + + + The window geometry of a surface is its "visible bounds" from the + user's perspective. Client-side decorations often have invisible + portions like drop-shadows which should be ignored for the + purposes of aligning, placing and constraining windows. + + The window geometry is double buffered, and will be applied at the + time wl_surface.commit of the corresponding wl_surface is called. + + When maintaining a position, the compositor should treat the (x, y) + coordinate of the window geometry as the top left corner of the window. + A client changing the (x, y) window geometry coordinate should in + general not alter the position of the window. + + Once the window geometry of the surface is set, it is not possible to + unset it, and it will remain the same until set_window_geometry is + called again, even if a new subsurface or buffer is attached. + + If never set, the value is the full bounds of the surface, + including any subsurfaces. This updates dynamically on every + commit. This unset is meant for extremely simple clients. + + The arguments are given in the surface-local coordinate space of + the wl_surface associated with this xdg_surface. + + The width and height must be greater than zero. Setting an invalid size + will raise an error. When applied, the effective window geometry will be + the set window geometry clamped to the bounding rectangle of the + combined geometry of the surface of the xdg_surface and the associated + subsurfaces. + + + + + + + + + + When a configure event is received, if a client commits the + surface in response to the configure event, then the client + must make an ack_configure request sometime before the commit + request, passing along the serial of the configure event. + + For instance, for toplevel surfaces the compositor might use this + information to move a surface to the top left only when the client has + drawn itself for the maximized or fullscreen state. + + If the client receives multiple configure events before it + can respond to one, it only has to ack the last configure event. + + A client is not required to commit immediately after sending + an ack_configure request - it may even ack_configure several times + before its next surface commit. + + A client may send multiple ack_configure requests before committing, but + only the last request sent before a commit indicates which configure + event the client really is responding to. + + + + + + + The configure event marks the end of a configure sequence. A configure + sequence is a set of one or more events configuring the state of the + xdg_surface, including the final xdg_surface.configure event. + + Where applicable, xdg_surface surface roles will during a configure + sequence extend this event as a latched state sent as events before the + xdg_surface.configure event. Such events should be considered to make up + a set of atomically applied configuration states, where the + xdg_surface.configure commits the accumulated state. + + Clients should arrange their surface for the new states, and then send + an ack_configure request with the serial sent in this configure event at + some point before committing the new surface. + + If the client receives multiple configure events before it can respond + to one, it is free to discard all but the last event it received. + + + + + + + + This interface defines an xdg_surface role which allows a surface to, + among other things, set window-like properties such as maximize, + fullscreen, and minimize, set application-specific metadata like title and + id, and well as trigger user interactive operations such as interactive + resize and move. + + Unmapping an xdg_toplevel means that the surface cannot be shown + by the compositor until it is explicitly mapped again. + All active operations (e.g., move, resize) are canceled and all + attributes (e.g. title, state, stacking, ...) are discarded for + an xdg_toplevel surface when it is unmapped. + + Attaching a null buffer to a toplevel unmaps the surface. + + + + + This request destroys the role surface and unmaps the surface; + see "Unmapping" behavior in interface section for details. + + + + + + Set the "parent" of this surface. This surface should be stacked + above the parent surface and all other ancestor surfaces. + + Parent windows should be set on dialogs, toolboxes, or other + "auxiliary" surfaces, so that the parent is raised when the dialog + is raised. + + Setting a null parent for a child window removes any parent-child + relationship for the child. Setting a null parent for a window which + currently has no parent is a no-op. + + If the parent is unmapped then its children are managed as + though the parent of the now-unmapped parent has become the + parent of this surface. If no parent exists for the now-unmapped + parent then the children are managed as though they have no + parent surface. + + + + + + + Set a short title for the surface. + + This string may be used to identify the surface in a task bar, + window list, or other user interface elements provided by the + compositor. + + The string must be encoded in UTF-8. + + + + + + + Set an application identifier for the surface. + + The app ID identifies the general class of applications to which + the surface belongs. The compositor can use this to group multiple + surfaces together, or to determine how to launch a new application. + + For D-Bus activatable applications, the app ID is used as the D-Bus + service name. + + The compositor shell will try to group application surfaces together + by their app ID. As a best practice, it is suggested to select app + ID's that match the basename of the application's .desktop file. + For example, "org.freedesktop.FooViewer" where the .desktop file is + "org.freedesktop.FooViewer.desktop". + + See the desktop-entry specification [0] for more details on + application identifiers and how they relate to well-known D-Bus + names and .desktop files. + + [0] http://standards.freedesktop.org/desktop-entry-spec/ + + + + + + + Clients implementing client-side decorations might want to show + a context menu when right-clicking on the decorations, giving the + user a menu that they can use to maximize or minimize the window. + + This request asks the compositor to pop up such a window menu at + the given position, relative to the local surface coordinates of + the parent surface. There are no guarantees as to what menu items + the window menu contains. + + This request must be used in response to some sort of user action + like a button press, key press, or touch down event. + + + + + + + + + + Start an interactive, user-driven move of the surface. + + This request must be used in response to some sort of user action + like a button press, key press, or touch down event. The passed + serial is used to determine the type of interactive move (touch, + pointer, etc). + + The server may ignore move requests depending on the state of + the surface (e.g. fullscreen or maximized), or if the passed serial + is no longer valid. + + If triggered, the surface will lose the focus of the device + (wl_pointer, wl_touch, etc) used for the move. It is up to the + compositor to visually indicate that the move is taking place, such as + updating a pointer cursor, during the move. There is no guarantee + that the device focus will return when the move is completed. + + + + + + + + These values are used to indicate which edge of a surface + is being dragged in a resize operation. + + + + + + + + + + + + + + + Start a user-driven, interactive resize of the surface. + + This request must be used in response to some sort of user action + like a button press, key press, or touch down event. The passed + serial is used to determine the type of interactive resize (touch, + pointer, etc). + + The server may ignore resize requests depending on the state of + the surface (e.g. fullscreen or maximized). + + If triggered, the client will receive configure events with the + "resize" state enum value and the expected sizes. See the "resize" + enum value for more details about what is required. The client + must also acknowledge configure events using "ack_configure". After + the resize is completed, the client will receive another "configure" + event without the resize state. + + If triggered, the surface also will lose the focus of the device + (wl_pointer, wl_touch, etc) used for the resize. It is up to the + compositor to visually indicate that the resize is taking place, + such as updating a pointer cursor, during the resize. There is no + guarantee that the device focus will return when the resize is + completed. + + The edges parameter specifies how the surface should be resized, + and is one of the values of the resize_edge enum. The compositor + may use this information to update the surface position for + example when dragging the top left corner. The compositor may also + use this information to adapt its behavior, e.g. choose an + appropriate cursor image. + + + + + + + + + The different state values used on the surface. This is designed for + state values like maximized, fullscreen. It is paired with the + configure event to ensure that both the client and the compositor + setting the state can be synchronized. + + States set in this way are double-buffered. They will get applied on + the next commit. + + + + The surface is maximized. The window geometry specified in the configure + event must be obeyed by the client. + + + + + The surface is fullscreen. The window geometry specified in the + configure event is a maximum; the client cannot resize beyond it. For + a surface to cover the whole fullscreened area, the geometry + dimensions must be obeyed by the client. For more details, see + xdg_toplevel.set_fullscreen. + + + + + The surface is being resized. The window geometry specified in the + configure event is a maximum; the client cannot resize beyond it. + Clients that have aspect ratio or cell sizing configuration can use + a smaller size, however. + + + + + Client window decorations should be painted as if the window is + active. Do not assume this means that the window actually has + keyboard or pointer focus. + + + + + + + Set a maximum size for the window. + + The client can specify a maximum size so that the compositor does + not try to configure the window beyond this size. + + The width and height arguments are in window geometry coordinates. + See xdg_surface.set_window_geometry. + + Values set in this way are double-buffered. They will get applied + on the next commit. + + The compositor can use this information to allow or disallow + different states like maximize or fullscreen and draw accurate + animations. + + Similarly, a tiling window manager may use this information to + place and resize client windows in a more effective way. + + The client should not rely on the compositor to obey the maximum + size. The compositor may decide to ignore the values set by the + client and request a larger size. + + If never set, or a value of zero in the request, means that the + client has no expected maximum size in the given dimension. + As a result, a client wishing to reset the maximum size + to an unspecified state can use zero for width and height in the + request. + + Requesting a maximum size to be smaller than the minimum size of + a surface is illegal and will result in a protocol error. + + The width and height must be greater than or equal to zero. Using + strictly negative values for width and height will result in a + protocol error. + + + + + + + + Set a minimum size for the window. + + The client can specify a minimum size so that the compositor does + not try to configure the window below this size. + + The width and height arguments are in window geometry coordinates. + See xdg_surface.set_window_geometry. + + Values set in this way are double-buffered. They will get applied + on the next commit. + + The compositor can use this information to allow or disallow + different states like maximize or fullscreen and draw accurate + animations. + + Similarly, a tiling window manager may use this information to + place and resize client windows in a more effective way. + + The client should not rely on the compositor to obey the minimum + size. The compositor may decide to ignore the values set by the + client and request a smaller size. + + If never set, or a value of zero in the request, means that the + client has no expected minimum size in the given dimension. + As a result, a client wishing to reset the minimum size + to an unspecified state can use zero for width and height in the + request. + + Requesting a minimum size to be larger than the maximum size of + a surface is illegal and will result in a protocol error. + + The width and height must be greater than or equal to zero. Using + strictly negative values for width and height will result in a + protocol error. + + + + + + + + Maximize the surface. + + After requesting that the surface should be maximized, the compositor + will respond by emitting a configure event with the "maximized" state + and the required window geometry. The client should then update its + content, drawing it in a maximized state, i.e. without shadow or other + decoration outside of the window geometry. The client must also + acknowledge the configure when committing the new content (see + ack_configure). + + It is up to the compositor to decide how and where to maximize the + surface, for example which output and what region of the screen should + be used. + + If the surface was already maximized, the compositor will still emit + a configure event with the "maximized" state. + + If the surface is in a fullscreen state, this request has no direct + effect. It will alter the state the surface is returned to when + unmaximized if not overridden by the compositor. + + + + + + Unmaximize the surface. + + After requesting that the surface should be unmaximized, the compositor + will respond by emitting a configure event without the "maximized" + state. If available, the compositor will include the window geometry + dimensions the window had prior to being maximized in the configure + event. The client must then update its content, drawing it in a + regular state, i.e. potentially with shadow, etc. The client must also + acknowledge the configure when committing the new content (see + ack_configure). + + It is up to the compositor to position the surface after it was + unmaximized; usually the position the surface had before maximizing, if + applicable. + + If the surface was already not maximized, the compositor will still + emit a configure event without the "maximized" state. + + If the surface is in a fullscreen state, this request has no direct + effect. It will alter the state the surface is returned to when + unmaximized if not overridden by the compositor. + + + + + + Make the surface fullscreen. + + After requesting that the surface should be fullscreened, the + compositor will respond by emitting a configure event with the + "fullscreen" state and the fullscreen window geometry. The client must + also acknowledge the configure when committing the new content (see + ack_configure). + + The output passed by the request indicates the client's preference as + to which display it should be set fullscreen on. If this value is NULL, + it's up to the compositor to choose which display will be used to map + this surface. + + If the surface doesn't cover the whole output, the compositor will + position the surface in the center of the output and compensate with + with border fill covering the rest of the output. The content of the + border fill is undefined, but should be assumed to be in some way that + attempts to blend into the surrounding area (e.g. solid black). + + If the fullscreened surface is not opaque, the compositor must make + sure that other screen content not part of the same surface tree (made + up of subsurfaces, popups or similarly coupled surfaces) are not + visible below the fullscreened surface. + + + + + + + Make the surface no longer fullscreen. + + After requesting that the surface should be unfullscreened, the + compositor will respond by emitting a configure event without the + "fullscreen" state. + + Making a surface unfullscreen sets states for the surface based on the following: + * the state(s) it may have had before becoming fullscreen + * any state(s) decided by the compositor + * any state(s) requested by the client while the surface was fullscreen + + The compositor may include the previous window geometry dimensions in + the configure event, if applicable. + + The client must also acknowledge the configure when committing the new + content (see ack_configure). + + + + + + Request that the compositor minimize your surface. There is no + way to know if the surface is currently minimized, nor is there + any way to unset minimization on this surface. + + If you are looking to throttle redrawing when minimized, please + instead use the wl_surface.frame event for this, as this will + also work with live previews on windows in Alt-Tab, Expose or + similar compositor features. + + + + + + This configure event asks the client to resize its toplevel surface or + to change its state. The configured state should not be applied + immediately. See xdg_surface.configure for details. + + The width and height arguments specify a hint to the window + about how its surface should be resized in window geometry + coordinates. See set_window_geometry. + + If the width or height arguments are zero, it means the client + should decide its own window dimension. This may happen when the + compositor needs to configure the state of the surface but doesn't + have any information about any previous or expected dimension. + + The states listed in the event specify how the width/height + arguments should be interpreted, and possibly how it should be + drawn. + + Clients must send an ack_configure in response to this event. See + xdg_surface.configure and xdg_surface.ack_configure for details. + + + + + + + + + The close event is sent by the compositor when the user + wants the surface to be closed. This should be equivalent to + the user clicking the close button in client-side decorations, + if your application has any. + + This is only a request that the user intends to close the + window. The client may choose to ignore this request, or show + a dialog to ask the user to save their data, etc. + + + + + + + A popup surface is a short-lived, temporary surface. It can be used to + implement for example menus, popovers, tooltips and other similar user + interface concepts. + + A popup can be made to take an explicit grab. See xdg_popup.grab for + details. + + When the popup is dismissed, a popup_done event will be sent out, and at + the same time the surface will be unmapped. See the xdg_popup.popup_done + event for details. + + Explicitly destroying the xdg_popup object will also dismiss the popup and + unmap the surface. Clients that want to dismiss the popup when another + surface of their own is clicked should dismiss the popup using the destroy + request. + + The parent surface must have either the xdg_toplevel or xdg_popup surface + role. + + A newly created xdg_popup will be stacked on top of all previously created + xdg_popup surfaces associated with the same xdg_toplevel. + + The parent of an xdg_popup must be mapped (see the xdg_surface + description) before the xdg_popup itself. + + The x and y arguments passed when creating the popup object specify + where the top left of the popup should be placed, relative to the + local surface coordinates of the parent surface. See + xdg_surface.get_popup. An xdg_popup must intersect with or be at least + partially adjacent to its parent surface. + + The client must call wl_surface.commit on the corresponding wl_surface + for the xdg_popup state to take effect. + + + + + + + + + This destroys the popup. Explicitly destroying the xdg_popup + object will also dismiss the popup, and unmap the surface. + + If this xdg_popup is not the "topmost" popup, a protocol error + will be sent. + + + + + + This request makes the created popup take an explicit grab. An explicit + grab will be dismissed when the user dismisses the popup, or when the + client destroys the xdg_popup. This can be done by the user clicking + outside the surface, using the keyboard, or even locking the screen + through closing the lid or a timeout. + + If the compositor denies the grab, the popup will be immediately + dismissed. + + This request must be used in response to some sort of user action like a + button press, key press, or touch down event. The serial number of the + event should be passed as 'serial'. + + The parent of a grabbing popup must either be an xdg_toplevel surface or + another xdg_popup with an explicit grab. If the parent is another + xdg_popup it means that the popups are nested, with this popup now being + the topmost popup. + + Nested popups must be destroyed in the reverse order they were created + in, e.g. the only popup you are allowed to destroy at all times is the + topmost one. + + When compositors choose to dismiss a popup, they may dismiss every + nested grabbing popup as well. When a compositor dismisses popups, it + will follow the same dismissing order as required from the client. + + The parent of a grabbing popup must either be another xdg_popup with an + active explicit grab, or an xdg_popup or xdg_toplevel, if there are no + explicit grabs already taken. + + If the topmost grabbing popup is destroyed, the grab will be returned to + the parent of the popup, if that parent previously had an explicit grab. + + If the parent is a grabbing popup which has already been dismissed, this + popup will be immediately dismissed. If the parent is a popup that did + not take an explicit grab, an error will be raised. + + During a popup grab, the client owning the grab will receive pointer + and touch events for all their surfaces as normal (similar to an + "owner-events" grab in X11 parlance), while the top most grabbing popup + will always have keyboard focus. + + + + + + + + This event asks the popup surface to configure itself given the + configuration. The configured state should not be applied immediately. + See xdg_surface.configure for details. + + The x and y arguments represent the position the popup was placed at + given the xdg_positioner rule, relative to the upper left corner of the + window geometry of the parent surface. + + + + + + + + + + The popup_done event is sent out when a popup is dismissed by the + compositor. The client should destroy the xdg_popup object at this + point. + + + + + diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/shellintegration.pro b/src/plugins/platforms/wayland/plugins/shellintegration/shellintegration.pro index 9be4e82a598..48b6efa363f 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/shellintegration.pro +++ b/src/plugins/platforms/wayland/plugins/shellintegration/shellintegration.pro @@ -2,6 +2,7 @@ TEMPLATE = subdirs SUBDIRS += \ ivi-shell \ + xdg-shell \ xdg-shell-v5 \ xdg-shell-v6 \ wl-shell \ diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/main.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/main.cpp new file mode 100644 index 00000000000..a9ea4bc1e02 --- /dev/null +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/main.cpp @@ -0,0 +1,68 @@ +/**************************************************************************** +** +** Copyright (C) 2018 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qwaylandxdgshellintegration_p.h" + +#include + +QT_BEGIN_NAMESPACE + +namespace QtWaylandClient { + +class QWaylandXdgShellIntegrationPlugin : public QWaylandShellIntegrationPlugin +{ + Q_OBJECT + Q_PLUGIN_METADATA(IID QWaylandShellIntegrationFactoryInterface_iid FILE "xdg-shell.json") + +public: + QWaylandShellIntegration *create(const QString &key, const QStringList ¶mList) override; +}; + +QWaylandShellIntegration *QWaylandXdgShellIntegrationPlugin::create(const QString &key, const QStringList ¶mList) +{ + Q_UNUSED(key); + Q_UNUSED(paramList); + return new QWaylandXdgShellIntegration(); +} + +} + +QT_END_NAMESPACE + +#include "main.moc" diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp new file mode 100644 index 00000000000..4097cecefa3 --- /dev/null +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp @@ -0,0 +1,337 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Copyright (C) 2017 Eurogiciel, author: +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the config.tests of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qwaylandxdgshell_p.h" + +#include +#include +#include +#include +#include + +QT_BEGIN_NAMESPACE + +namespace QtWaylandClient { + +QWaylandXdgSurface::Toplevel::Toplevel(QWaylandXdgSurface *xdgSurface) + : QtWayland::xdg_toplevel(xdgSurface->get_toplevel()) + , m_xdgSurface(xdgSurface) +{ + requestWindowStates(xdgSurface->window()->window()->windowStates()); +} + +QWaylandXdgSurface::Toplevel::~Toplevel() +{ + if (m_applied.states & Qt::WindowActive) { + QWaylandWindow *window = m_xdgSurface->window(); + window->display()->handleWindowDeactivated(window); + } + if (isInitialized()) + destroy(); +} + +void QWaylandXdgSurface::Toplevel::applyConfigure() +{ + if (!(m_applied.states & (Qt::WindowMaximized|Qt::WindowFullScreen))) + m_normalSize = m_xdgSurface->m_window->window()->frameGeometry().size(); + + if (m_pending.size.isEmpty() && !m_normalSize.isEmpty()) + m_pending.size = m_normalSize; + + if ((m_pending.states & Qt::WindowActive) && !(m_applied.states & Qt::WindowActive)) + m_xdgSurface->m_window->display()->handleWindowActivated(m_xdgSurface->m_window); + + if (!(m_pending.states & Qt::WindowActive) && (m_applied.states & Qt::WindowActive)) + m_xdgSurface->m_window->display()->handleWindowDeactivated(m_xdgSurface->m_window); + + // TODO: none of the other plugins send WindowActive either, but is it on purpose? + Qt::WindowStates statesWithoutActive = m_pending.states & ~Qt::WindowActive; + + m_xdgSurface->m_window->handleWindowStatesChanged(statesWithoutActive); + m_xdgSurface->m_window->resizeFromApplyConfigure(m_pending.size); + m_applied = m_pending; +} + +void QWaylandXdgSurface::Toplevel::xdg_toplevel_configure(int32_t width, int32_t height, wl_array *states) +{ + m_pending.size = QSize(width, height); + + auto *xdgStates = static_cast(states->data); + size_t numStates = states->size / sizeof(uint32_t); + + m_pending.states = Qt::WindowNoState; + + for (size_t i = 0; i < numStates; i++) { + switch (xdgStates[i]) { + case XDG_TOPLEVEL_STATE_ACTIVATED: + m_pending.states |= Qt::WindowActive; + break; + case XDG_TOPLEVEL_STATE_MAXIMIZED: + m_pending.states |= Qt::WindowMaximized; + break; + case XDG_TOPLEVEL_STATE_FULLSCREEN: + m_pending.states |= Qt::WindowFullScreen; + break; + default: + break; + } + } +} + +void QWaylandXdgSurface::Toplevel::xdg_toplevel_close() +{ + m_xdgSurface->m_window->window()->close(); +} + +void QWaylandXdgSurface::Toplevel::requestWindowStates(Qt::WindowStates states) +{ + // Re-send what's different from the applied state + Qt::WindowStates changedStates = m_applied.states ^ states; + + if (changedStates & Qt::WindowMaximized) { + if (states & Qt::WindowMaximized) + set_maximized(); + else + unset_maximized(); + } + + if (changedStates & Qt::WindowFullScreen) { + if (states & Qt::WindowFullScreen) + set_fullscreen(nullptr); + else + unset_fullscreen(); + } + + // Minimized state is not reported by the protocol, so always send it + if (states & Qt::WindowMinimized) { + set_minimized(); + m_xdgSurface->window()->handleWindowStatesChanged(states & ~Qt::WindowMinimized); + } +} + +QWaylandXdgSurface::Popup::Popup(QWaylandXdgSurface *xdgSurface, QWaylandXdgSurface *parent, + QtWayland::xdg_positioner *positioner) + : xdg_popup(xdgSurface->get_popup(parent->object(), positioner->object())) + , m_xdgSurface(xdgSurface) +{ +} + +QWaylandXdgSurface::Popup::~Popup() +{ + if (isInitialized()) + destroy(); +} + +void QWaylandXdgSurface::Popup::applyConfigure() +{ +} + +void QWaylandXdgSurface::Popup::xdg_popup_popup_done() +{ + m_xdgSurface->m_window->window()->close(); +} + +QWaylandXdgSurface::QWaylandXdgSurface(QWaylandXdgShell *shell, ::xdg_surface *surface, QWaylandWindow *window) + : QWaylandShellSurface(window) + , xdg_surface(surface) + , m_shell(shell) + , m_window(window) +{ +} + +QWaylandXdgSurface::~QWaylandXdgSurface() +{ + if (m_toplevel) + xdg_toplevel_destroy(m_toplevel->object()); + if (m_popup) + xdg_popup_destroy(m_popup->object()); + destroy(); +} + +void QWaylandXdgSurface::resize(QWaylandInputDevice *inputDevice, xdg_toplevel_resize_edge edges) +{ + Q_ASSERT(m_toplevel && m_toplevel->isInitialized()); + m_toplevel->resize(inputDevice->wl_seat(), inputDevice->serial(), edges); +} + +void QWaylandXdgSurface::resize(QWaylandInputDevice *inputDevice, enum wl_shell_surface_resize edges) +{ + auto xdgEdges = reinterpret_cast(&edges); + resize(inputDevice, *xdgEdges); +} + + +bool QWaylandXdgSurface::move(QWaylandInputDevice *inputDevice) +{ + if (m_toplevel && m_toplevel->isInitialized()) { + m_toplevel->move(inputDevice->wl_seat(), inputDevice->serial()); + return true; + } + return false; +} + +void QWaylandXdgSurface::setTitle(const QString &title) +{ + if (m_toplevel) + m_toplevel->set_title(title); +} + +void QWaylandXdgSurface::setAppId(const QString &appId) +{ + if (m_toplevel) + m_toplevel->set_app_id(appId); +} + +void QWaylandXdgSurface::setType(Qt::WindowType type, QWaylandWindow *transientParent) +{ + QWaylandDisplay *display = m_window->display(); + if ((type == Qt::Popup || type == Qt::ToolTip) && transientParent && display->lastInputDevice()) { + setPopup(transientParent, display->lastInputDevice(), display->lastInputSerial(), type == Qt::Popup); + } else { + setToplevel(); + if (transientParent) { + auto parentXdgSurface = static_cast(transientParent->shellSurface()); + if (parentXdgSurface) + m_toplevel->set_parent(parentXdgSurface->m_toplevel->object()); + } + } +} + +bool QWaylandXdgSurface::handleExpose(const QRegion ®ion) +{ + if (!m_configured && !region.isEmpty()) { + m_exposeRegion = region; + return true; + } + return false; +} + +void QWaylandXdgSurface::applyConfigure() +{ + Q_ASSERT(m_pendingConfigureSerial != 0); + + if (m_toplevel) + m_toplevel->applyConfigure(); + if (m_popup) + m_popup->applyConfigure(); + + m_configured = true; + ack_configure(m_pendingConfigureSerial); + + m_pendingConfigureSerial = 0; +} + +bool QWaylandXdgSurface::wantsDecorations() const +{ + return m_toplevel && !(m_toplevel->m_pending.states & Qt::WindowFullScreen); +} + +void QWaylandXdgSurface::requestWindowStates(Qt::WindowStates states) +{ + if (m_toplevel) + m_toplevel->requestWindowStates(states); + else + qCWarning(lcQpaWayland) << "Non-toplevel surfaces can't request window states"; +} + +void QWaylandXdgSurface::setToplevel() +{ + Q_ASSERT(!m_toplevel && !m_popup); + m_toplevel = new Toplevel(this); +} + +void QWaylandXdgSurface::setPopup(QWaylandWindow *parent, QWaylandInputDevice *device, int serial, bool grab) +{ + Q_ASSERT(!m_toplevel && !m_popup); + + auto parentXdgSurface = static_cast(parent->shellSurface()); + auto positioner = new QtWayland::xdg_positioner(m_shell->create_positioner()); + // set_popup expects a position relative to the parent + QPoint transientPos = m_window->geometry().topLeft(); // this is absolute + transientPos -= parent->geometry().topLeft(); + if (parent->decoration()) { + transientPos.setX(transientPos.x() + parent->decoration()->margins().left()); + transientPos.setY(transientPos.y() + parent->decoration()->margins().top()); + } + positioner->set_anchor_rect(transientPos.x(), transientPos.y(), 1, 1); + positioner->set_anchor(QtWayland::xdg_positioner::anchor_top_left); + positioner->set_gravity(QtWayland::xdg_positioner::gravity_bottom_right); + positioner->set_size(m_window->geometry().width(), m_window->geometry().height()); + m_popup = new Popup(this, parentXdgSurface, positioner); + positioner->destroy(); + delete positioner; + if (grab) { + m_popup->grab(device->wl_seat(), serial); + } +} + +void QWaylandXdgSurface::xdg_surface_configure(uint32_t serial) +{ + m_window->applyConfigureWhenPossible(); + m_pendingConfigureSerial = serial; + if (!m_exposeRegion.isEmpty()) { + QWindowSystemInterface::handleExposeEvent(m_window->window(), m_exposeRegion); + m_exposeRegion = QRegion(); + } +} + +QWaylandXdgShell::QWaylandXdgShell(struct ::wl_registry *registry, uint32_t id, uint32_t availableVersion) + : QtWayland::xdg_wm_base(registry, id, qMin(availableVersion, 1u)) +{ +} + +QWaylandXdgShell::~QWaylandXdgShell() +{ + destroy(); +} + +QWaylandXdgSurface *QWaylandXdgShell::getXdgSurface(QWaylandWindow *window) +{ + return new QWaylandXdgSurface(this, get_xdg_surface(window->object()), window); +} + +void QWaylandXdgShell::xdg_wm_base_ping(uint32_t serial) +{ + pong(serial); +} + +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h new file mode 100644 index 00000000000..1b312bd2db4 --- /dev/null +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h @@ -0,0 +1,161 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Copyright (C) 2017 Eurogiciel, author: +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the config.tests of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWAYLANDXDGSHELL_H +#define QWAYLANDXDGSHELL_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include "qwayland-xdg-shell.h" + +#include +#include + +#include +#include + +#include + +QT_BEGIN_NAMESPACE + +class QWindow; + +namespace QtWaylandClient { + +class QWaylandWindow; +class QWaylandInputDevice; +class QWaylandXdgShell; + +class Q_WAYLAND_CLIENT_EXPORT QWaylandXdgSurface : public QWaylandShellSurface, public QtWayland::xdg_surface +{ + Q_OBJECT +public: + QWaylandXdgSurface(QWaylandXdgShell *shell, ::xdg_surface *surface, QWaylandWindow *window); + ~QWaylandXdgSurface() override; + + void resize(QWaylandInputDevice *inputDevice, enum xdg_toplevel_resize_edge edges); + void resize(QWaylandInputDevice *inputDevice, enum wl_shell_surface_resize edges) override; + bool move(QWaylandInputDevice *inputDevice) override; + void setTitle(const QString &title) override; + void setAppId(const QString &appId) override; + + void setType(Qt::WindowType type, QWaylandWindow *transientParent) override; + bool isExposed() const override { return m_configured; } + bool handleExpose(const QRegion &) override; + bool handlesActiveState() const { return m_toplevel; } + void applyConfigure() override; + bool wantsDecorations() const override; + +protected: + void requestWindowStates(Qt::WindowStates states) override; + void xdg_surface_configure(uint32_t serial) override; + +private: + class Toplevel: public QtWayland::xdg_toplevel + { + public: + Toplevel(QWaylandXdgSurface *xdgSurface); + ~Toplevel() override; + + void applyConfigure(); + + void xdg_toplevel_configure(int32_t width, int32_t height, wl_array *states) override; + void xdg_toplevel_close() override; + + void requestWindowStates(Qt::WindowStates states); + struct { + QSize size = {0, 0}; + Qt::WindowStates states = Qt::WindowNoState; + } m_pending, m_applied; + QSize m_normalSize; + + QWaylandXdgSurface *m_xdgSurface = nullptr; + }; + + class Popup : public QtWayland::xdg_popup { + public: + Popup(QWaylandXdgSurface *xdgSurface, QWaylandXdgSurface *parent, QtWayland::xdg_positioner *positioner); + ~Popup() override; + + void applyConfigure(); + void xdg_popup_popup_done() override; + + QWaylandXdgSurface *m_xdgSurface = nullptr; + }; + + void setToplevel(); + void setPopup(QWaylandWindow *parent, QWaylandInputDevice *device, int serial, bool grab); + + QWaylandXdgShell *m_shell = nullptr; + QWaylandWindow *m_window = nullptr; + Toplevel *m_toplevel = nullptr; + Popup *m_popup = nullptr; + bool m_configured = false; + QRegion m_exposeRegion; + uint m_pendingConfigureSerial = 0; +}; + +class Q_WAYLAND_CLIENT_EXPORT QWaylandXdgShell : public QtWayland::xdg_wm_base +{ +public: + QWaylandXdgShell(struct ::wl_registry *registry, uint32_t id, uint32_t availableVersion); + + QWaylandXdgSurface *getXdgSurface(QWaylandWindow *window); + + ~QWaylandXdgShell() override; + +private: + void xdg_wm_base_ping(uint32_t serial) override; +}; + +QT_END_NAMESPACE + +} + +#endif // QWAYLANDXDGSHELL_H diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshellintegration.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshellintegration.cpp new file mode 100644 index 00000000000..54d5b55ed6b --- /dev/null +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshellintegration.cpp @@ -0,0 +1,87 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qwaylandxdgshellintegration_p.h" + +#include +#include + +QT_BEGIN_NAMESPACE + +namespace QtWaylandClient { + +bool QWaylandXdgShellIntegration::initialize(QWaylandDisplay *display) +{ + for (QWaylandDisplay::RegistryGlobal global : display->globals()) { + if (global.interface == QLatin1String("xdg_wm_base")) { + m_xdgShell.reset(new QWaylandXdgShell(display->wl_registry(), global.id, global.version)); + break; + } + } + + if (!m_xdgShell) { + qCDebug(lcQpaWayland) << "Couldn't find global xdg_wm_base for xdg-shell stable"; + return false; + } + + return QWaylandShellIntegration::initialize(display); +} + +QWaylandShellSurface *QWaylandXdgShellIntegration::createShellSurface(QWaylandWindow *window) +{ + return m_xdgShell->getXdgSurface(window); +} + +void QWaylandXdgShellIntegration::handleKeyboardFocusChanged(QWaylandWindow *newFocus, QWaylandWindow *oldFocus) +{ + if (newFocus) { + auto *xdgSurface = qobject_cast(newFocus->shellSurface()); + if (xdgSurface && !xdgSurface->handlesActiveState()) + m_display->handleWindowActivated(newFocus); + } + if (oldFocus && qobject_cast(oldFocus->shellSurface())) { + auto *xdgSurface = qobject_cast(oldFocus->shellSurface()); + if (xdgSurface && !xdgSurface->handlesActiveState()) + m_display->handleWindowDeactivated(oldFocus); + } +} + +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshellintegration_p.h b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshellintegration_p.h new file mode 100644 index 00000000000..b6caa6c95c1 --- /dev/null +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshellintegration_p.h @@ -0,0 +1,78 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWAYLANDXDGSHELLINTEGRATION_P_H +#define QWAYLANDXDGSHELLINTEGRATION_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include "qwaylandxdgshell_p.h" + +#include + +QT_BEGIN_NAMESPACE + +namespace QtWaylandClient { + +class Q_WAYLAND_CLIENT_EXPORT QWaylandXdgShellIntegration : public QWaylandShellIntegration +{ +public: + QWaylandXdgShellIntegration() {} + bool initialize(QWaylandDisplay *display) override; + QWaylandShellSurface *createShellSurface(QWaylandWindow *window) override; + void handleKeyboardFocusChanged(QWaylandWindow *newFocus, QWaylandWindow *oldFocus) override; + +private: + QScopedPointer m_xdgShell; +}; + +} + +QT_END_NAMESPACE + +#endif // QWAYLANDXDGSHELLINTEGRATION_P_H diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/xdg-shell.json b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/xdg-shell.json new file mode 100644 index 00000000000..2de86b8d0ac --- /dev/null +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/xdg-shell.json @@ -0,0 +1,3 @@ +{ + "Keys":[ "xdg-shell" ] +} diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/xdg-shell.pro b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/xdg-shell.pro new file mode 100644 index 00000000000..b6d4a9b2ee6 --- /dev/null +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/xdg-shell.pro @@ -0,0 +1,23 @@ +QT += gui-private waylandclient-private +CONFIG += wayland-scanner + +QMAKE_USE += wayland-client + +WAYLANDCLIENTSOURCES += \ + ../../../3rdparty/protocol/xdg-shell.xml + +HEADERS += \ + qwaylandxdgshell_p.h \ + qwaylandxdgshellintegration_p.h \ + +SOURCES += \ + main.cpp \ + qwaylandxdgshell.cpp \ + qwaylandxdgshellintegration.cpp \ + +OTHER_FILES += \ + xdg-shell.json + +PLUGIN_TYPE = wayland-shell-integration +PLUGIN_CLASS_NAME = QWaylandXdgShellIntegrationPlugin +load(qt_plugin) diff --git a/src/plugins/platforms/wayland/qwaylandintegration.cpp b/src/plugins/platforms/wayland/qwaylandintegration.cpp index 6ab5f0f203a..f05d146c304 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandintegration.cpp @@ -388,6 +388,7 @@ void QWaylandIntegration::initializeShellIntegration() if (!targetKey.isEmpty()) { preferredShells << targetKey; } else { + preferredShells << QLatin1String("xdg-shell"); preferredShells << QLatin1String("xdg-shell-v6"); QString useXdgShell = QString::fromLocal8Bit(qgetenv("QT_WAYLAND_USE_XDG_SHELL")); if (!useXdgShell.isEmpty() && useXdgShell != QLatin1String("0")) { From 796b02d398dba0d4c0dbe0eb9f3a7a6f6cfba5cc Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Mon, 28 May 2018 12:13:28 +0200 Subject: [PATCH 0539/1507] Client xdg-shell v6 tests: Fix dangling pointer usage Fixes some flaky tests Change-Id: Ifac7c95d12714d61afc37f879f4c70b2a7dbe0cf Reviewed-by: Paul Olav Tvete --- tests/auto/wayland/shared/mockcompositor.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/auto/wayland/shared/mockcompositor.cpp b/tests/auto/wayland/shared/mockcompositor.cpp index 11b40d9fc84..077b8ee05de 100644 --- a/tests/auto/wayland/shared/mockcompositor.cpp +++ b/tests/auto/wayland/shared/mockcompositor.cpp @@ -241,8 +241,8 @@ void MockCompositor::sendXdgToplevelV6Configure(const QSharedPointer(states.data()), - states.size() * static_cast(sizeof(uint))); + QByteArray statesBytes(reinterpret_cast(states.data()), + states.size() * static_cast(sizeof(uint))); command.parameters << statesBytes; processCommand(command); } From e6a0a0ce537e2d8d1af87f550bd2071e5d14a6c8 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Tue, 29 May 2018 15:20:39 +0200 Subject: [PATCH 0540/1507] Client: Accept prioritized list of shell integrations [ChangeLog][QPA plugin] QT_WAYLAND_SHELL_INTEGRATION environment variable now accepts a semicolon-separated list of shell integrations. Change-Id: I91364f53ea584bfbd9693b5ea58df07226c3e2c6 Reviewed-by: Johan Helsing Reviewed-by: David Edmundson --- src/plugins/platforms/wayland/qwaylandintegration.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandintegration.cpp b/src/plugins/platforms/wayland/qwaylandintegration.cpp index f05d146c304..a3ae802ffae 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandintegration.cpp @@ -381,12 +381,12 @@ void QWaylandIntegration::initializeShellIntegration() { mShellIntegrationInitialized = true; - QByteArray integrationName = qgetenv("QT_WAYLAND_SHELL_INTEGRATION"); - QString targetKey = QString::fromLocal8Bit(integrationName); + QByteArray integrationNames = qgetenv("QT_WAYLAND_SHELL_INTEGRATION"); + QString targetKeys = QString::fromLocal8Bit(integrationNames); QStringList preferredShells; - if (!targetKey.isEmpty()) { - preferredShells << targetKey; + if (!targetKeys.isEmpty()) { + preferredShells = targetKeys.split(QLatin1Char(';')); } else { preferredShells << QLatin1String("xdg-shell"); preferredShells << QLatin1String("xdg-shell-v6"); From 6b54806003b4d65faa0c8921c699a1b73e98e507 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Fri, 25 May 2018 13:54:22 +0200 Subject: [PATCH 0541/1507] Correct the include for QInternalMimeData Since qtbase/9f27bfb3, users of QInternalMimeData should include qinternalmimedata_p.h. Change-Id: I531d5fa318f55497b955b03c7e25d51a6f87ba05 Reviewed-by: Paul Olav Tvete --- src/plugins/platforms/wayland/qwaylanddataoffer_p.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylanddataoffer_p.h b/src/plugins/platforms/wayland/qwaylanddataoffer_p.h index 3e88b8f4ba2..5412400a59e 100644 --- a/src/plugins/platforms/wayland/qwaylanddataoffer_p.h +++ b/src/plugins/platforms/wayland/qwaylanddataoffer_p.h @@ -51,7 +51,7 @@ // We mean it. // -#include +#include #include #include From 2987de952cf6b20b396621eb5b4be6395da2873d Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Thu, 3 May 2018 15:21:01 +0200 Subject: [PATCH 0542/1507] xdg-shell v6: Make sure popup parent is topmost popup when grabbing Avoids protocol errors on Weston, gnome-shell and wlroots-based compositors. [ChangeLog][QPA Plugin] Fixed a protocol error that sometimes happened when showing popups such as nested menus on xdg-shell unstable v6. Task-number: QTBUG-67988 Change-Id: I037aec94fba3d177dd0392e5a216a604bc65ac4f Reviewed-by: Paul Olav Tvete --- .../platforms/wayland/qwaylandxdgshellv6.cpp | 33 ++++++++++++++++--- .../platforms/wayland/qwaylandxdgshellv6_p.h | 8 +++++ 2 files changed, 36 insertions(+), 5 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandxdgshellv6.cpp b/src/plugins/platforms/wayland/qwaylandxdgshellv6.cpp index a166a3bc930..5bcd3b25496 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgshellv6.cpp +++ b/src/plugins/platforms/wayland/qwaylandxdgshellv6.cpp @@ -93,6 +93,7 @@ QWaylandXdgSurfaceV6::Popup::Popup(QWaylandXdgSurfaceV6 *xdgSurface, QWaylandXdg QtWayland::zxdg_positioner_v6 *positioner) : zxdg_popup_v6(xdgSurface->get_popup(parent->object(), positioner->object())) , m_xdgSurface(xdgSurface) + , m_parent(parent) { } @@ -100,6 +101,12 @@ QWaylandXdgSurfaceV6::Popup::~Popup() { if (isInitialized()) destroy(); + + if (m_grabbing) { + auto *shell = m_xdgSurface->m_shell; + Q_ASSERT(shell->m_topmostPopup == this); + shell->m_topmostPopup = m_parent->m_popup; + } } void QWaylandXdgSurfaceV6::Popup::applyConfigure() @@ -107,6 +114,13 @@ void QWaylandXdgSurfaceV6::Popup::applyConfigure() } +void QWaylandXdgSurfaceV6::Popup::grab(QWaylandInputDevice *seat, uint serial) +{ + m_xdgSurface->m_shell->m_topmostPopup = this; + zxdg_popup_v6::grab(seat->wl_seat(), serial); + m_grabbing = true; +} + void QWaylandXdgSurfaceV6::Popup::zxdg_popup_v6_popup_done() { m_xdgSurface->m_window->window()->close(); @@ -124,8 +138,10 @@ QWaylandXdgSurfaceV6::~QWaylandXdgSurfaceV6() { if (m_toplevel) zxdg_toplevel_v6_destroy(m_toplevel->object()); - if (m_popup) - zxdg_popup_v6_destroy(m_popup->object()); + if (m_popup) { + delete m_popup; + m_popup = nullptr; + } destroy(); } @@ -198,6 +214,14 @@ void QWaylandXdgSurfaceV6::setPopup(QWaylandWindow *parent, QWaylandInputDevice Q_ASSERT(!m_toplevel && !m_popup); auto parentXdgSurface = static_cast(parent->shellSurface()); + + auto *top = m_shell->m_topmostPopup; + if (grab && top && top->m_xdgSurface != parentXdgSurface) { + qCWarning(lcQpaWayland) << "setPopup called for a surface that was not the topmost popup, positions might be off."; + parentXdgSurface = top->m_xdgSurface; + parent = top->m_xdgSurface->m_window; + } + auto positioner = new QtWayland::zxdg_positioner_v6(m_shell->create_positioner()); // set_popup expects a position relative to the parent QPoint transientPos = m_window->geometry().topLeft(); // this is absolute @@ -213,9 +237,8 @@ void QWaylandXdgSurfaceV6::setPopup(QWaylandWindow *parent, QWaylandInputDevice m_popup = new Popup(this, parentXdgSurface, positioner); positioner->destroy(); delete positioner; - if (grab) { - m_popup->grab(device->wl_seat(), serial); - } + if (grab) + m_popup->grab(device, serial); } void QWaylandXdgSurfaceV6::zxdg_surface_v6_configure(uint32_t serial) diff --git a/src/plugins/platforms/wayland/qwaylandxdgshellv6_p.h b/src/plugins/platforms/wayland/qwaylandxdgshellv6_p.h index b72d3d18a9a..e6434c02fc6 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgshellv6_p.h +++ b/src/plugins/platforms/wayland/qwaylandxdgshellv6_p.h @@ -115,9 +115,12 @@ private: ~Popup() override; void applyConfigure(); + void grab(QWaylandInputDevice *seat, uint serial); void zxdg_popup_v6_popup_done() override; QWaylandXdgSurfaceV6 *m_xdgSurface = nullptr; + QWaylandXdgSurfaceV6 *m_parent = nullptr; + bool m_grabbing = false; }; void setToplevel(); @@ -129,6 +132,8 @@ private: Popup *m_popup = nullptr; bool m_configured = false; QRegion m_exposeRegion; + + friend class QWaylandXdgShellV6; }; class Q_WAYLAND_CLIENT_EXPORT QWaylandXdgShellV6 : public QtWayland::zxdg_shell_v6 @@ -142,6 +147,9 @@ public: private: void zxdg_shell_v6_ping(uint32_t serial) override; + QWaylandXdgSurfaceV6::Popup *m_topmostPopup = nullptr; + + friend class QWaylandXdgSurfaceV6; }; QT_END_NAMESPACE From 19403799d778d3c26eefd5b2998221999e4e28de Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Thu, 31 May 2018 11:20:28 +0200 Subject: [PATCH 0543/1507] Don't ask libwayland to set absurdly long window titles It will cause libwayland to terminate the application. Task-number: QTBUG-68715 Change-Id: I1d1830453da224bec8bf4c5d6ab087c0e05328a8 Reviewed-by: Paul Olav Tvete --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 13 ++++++++++++- tests/auto/wayland/client/tst_client.cpp | 11 +++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index fdfd66688fe..5d658f675d6 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -287,7 +287,18 @@ void QWaylandWindow::setWindowTitle(const QString &title) { if (mShellSurface) { const QString separator = QString::fromUtf8(" \xe2\x80\x94 "); // unicode character U+2014, EM DASH - mShellSurface->setTitle(formatWindowTitle(title, separator)); + const QString formatted = formatWindowTitle(title, separator); + + const int libwaylandMaxBufferSize = 4096; + // Some parts of the buffer is used for metadata, so subtract 100 to be on the safe side + const int maxLength = libwaylandMaxBufferSize - 100; + + auto truncated = QStringRef(&formatted).left(maxLength); + if (truncated.length() < formatted.length()) { + qCWarning(lcQpaWayland) << "Window titles longer than" << maxLength << "characters are not supported." + << "Truncating window title (from" << formatted.length() << "chars)"; + } + mShellSurface->setTitle(truncated.toString()); } if (mWindowDecoration && window()->isVisible()) diff --git a/tests/auto/wayland/client/tst_client.cpp b/tests/auto/wayland/client/tst_client.cpp index a8e2d5e19dd..dcc0cb773d6 100644 --- a/tests/auto/wayland/client/tst_client.cpp +++ b/tests/auto/wayland/client/tst_client.cpp @@ -181,6 +181,7 @@ private slots: void hiddenTransientParent(); void hiddenPopupParent(); void glWindow(); + void longWindowTitle(); private: MockCompositor *compositor = nullptr; @@ -582,6 +583,16 @@ void tst_WaylandClient::glWindow() QTRY_VERIFY(!compositor->surface()); } +void tst_WaylandClient::longWindowTitle() +{ + // See QTBUG-68715 + QWindow window; + QString absurdlyLongTitle(10000, QLatin1Char('z')); + window.setTitle(absurdlyLongTitle); + window.show(); + QTRY_VERIFY(compositor->surface()); +} + int main(int argc, char **argv) { setenv("XDG_RUNTIME_DIR", ".", 1); From 90336adc178f977d271c10fc132e6834b79f0bd9 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Thu, 31 May 2018 11:26:34 +0200 Subject: [PATCH 0544/1507] Client: Set window geometry for xdg-shell v6 and stable Eventhough, according to the protocol spec, it should work perfectly fine without setting the geometry, gnome-shell 3.28.2 chokes on it and applications get stuck in the upper right corner and can't be moved. Qt seems to be the only toolkit left that doesn't set the window geometry, so let's just do it the simple, though somewhat incorrect, way. The downside of this patch, is that the unset window geometry used to include subsurfaces that extended outside the parent surface, but here we just set it to the frameGeometry of the window. Task-number: QTBUG-68575 Change-Id: I8a9d029ff6d57bd33294658e3bfd69ff08cd38c1 Reviewed-by: Paul Olav Tvete --- .../shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp | 2 ++ .../plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp index 550575f11b5..d986bc69d1b 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp @@ -86,6 +86,8 @@ void QWaylandXdgSurfaceV6::Toplevel::applyConfigure() m_xdgSurface->m_window->handleWindowStatesChanged(statesWithoutActive); m_xdgSurface->m_window->resizeFromApplyConfigure(m_pending.size); + QSize windowGeometrySize = m_xdgSurface->m_window->window()->frameGeometry().size(); + m_xdgSurface->set_window_geometry(0, 0, windowGeometrySize.width(), windowGeometrySize.height()); m_applied = m_pending; } diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp index 4097cecefa3..183576da0c1 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp @@ -86,6 +86,8 @@ void QWaylandXdgSurface::Toplevel::applyConfigure() m_xdgSurface->m_window->handleWindowStatesChanged(statesWithoutActive); m_xdgSurface->m_window->resizeFromApplyConfigure(m_pending.size); + QSize windowGeometrySize = m_xdgSurface->m_window->window()->frameGeometry().size(); + m_xdgSurface->set_window_geometry(0, 0, windowGeometrySize.width(), windowGeometrySize.height()); m_applied = m_pending; } From 2c9bb12fe3b1d4e775fe5849159af6bdfbefb5ed Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Tue, 5 Jun 2018 16:16:13 +0200 Subject: [PATCH 0545/1507] Client: Add tests for xdg-shell v6 window geometry Change-Id: Ifb7a1d63a136349cd99d516e63732b4393967468 Reviewed-by: Paul Olav Tvete --- tests/auto/wayland/shared/mockcompositor.h | 1 + tests/auto/wayland/shared/mockxdgshellv6.cpp | 8 ++++ tests/auto/wayland/shared/mockxdgshellv6.h | 1 + .../wayland/xdgshellv6/tst_xdgshellv6.cpp | 43 +++++++++++++++++++ 4 files changed, 53 insertions(+) diff --git a/tests/auto/wayland/shared/mockcompositor.h b/tests/auto/wayland/shared/mockcompositor.h index d3568c1654c..51b6f4bfb93 100644 --- a/tests/auto/wayland/shared/mockcompositor.h +++ b/tests/auto/wayland/shared/mockcompositor.h @@ -189,6 +189,7 @@ signals: uint unsetMaximizedRequested(); uint setFullscreenRequested(); uint unsetFullscreenRequested(); + void windowGeometryRequested(QRect geometry); // NOTE: This is really an xdg surface event private: MockXdgToplevelV6(Impl::XdgToplevelV6 *toplevel) : m_toplevel(toplevel) {} diff --git a/tests/auto/wayland/shared/mockxdgshellv6.cpp b/tests/auto/wayland/shared/mockxdgshellv6.cpp index 6f6f0b90528..014a24be7c2 100644 --- a/tests/auto/wayland/shared/mockxdgshellv6.cpp +++ b/tests/auto/wayland/shared/mockxdgshellv6.cpp @@ -57,6 +57,14 @@ void XdgSurfaceV6::zxdg_surface_v6_get_toplevel(QtWaylandServer::zxdg_surface_v6 m_toplevel = new XdgToplevelV6(this, resource->client(), id, version); } +void XdgSurfaceV6::zxdg_surface_v6_set_window_geometry(QtWaylandServer::zxdg_surface_v6::Resource *resource, int32_t x, int32_t y, int32_t width, int32_t height) +{ + if (m_toplevel) { + QRect geometry(x, y, width, height); + emit m_toplevel->mockToplevel()->windowGeometryRequested(geometry); + } +} + void XdgSurfaceV6::zxdg_surface_v6_destroy(QtWaylandServer::zxdg_surface_v6::Resource *resource) { Q_ASSERT(!m_toplevel); diff --git a/tests/auto/wayland/shared/mockxdgshellv6.h b/tests/auto/wayland/shared/mockxdgshellv6.h index faadb785a0d..bd5e1306313 100644 --- a/tests/auto/wayland/shared/mockxdgshellv6.h +++ b/tests/auto/wayland/shared/mockxdgshellv6.h @@ -52,6 +52,7 @@ public: protected: void zxdg_surface_v6_destroy_resource(Resource *) override { delete this; } void zxdg_surface_v6_get_toplevel(Resource *resource, uint32_t id) override; + void zxdg_surface_v6_set_window_geometry(Resource *resource, int32_t x, int32_t y, int32_t width, int32_t height) override; void zxdg_surface_v6_destroy(Resource *resource) override; private: diff --git a/tests/auto/wayland/xdgshellv6/tst_xdgshellv6.cpp b/tests/auto/wayland/xdgshellv6/tst_xdgshellv6.cpp index 070a9a34c79..91679cb57c0 100644 --- a/tests/auto/wayland/xdgshellv6/tst_xdgshellv6.cpp +++ b/tests/auto/wayland/xdgshellv6/tst_xdgshellv6.cpp @@ -99,6 +99,8 @@ private slots: void unsetMaximized(); void focusWindowFollowsConfigure(); void windowStateChangedEvents(); + void windowGeometrySimple(); + void windowGeometryFixed(); private: MockCompositor *m_compositor = nullptr; @@ -317,6 +319,47 @@ void tst_WaylandClientXdgShellV6::windowStateChangedEvents() } } +void tst_WaylandClientXdgShellV6::windowGeometrySimple() +{ + QWindow window; + window.show(); + + QSharedPointer toplevel; + QTRY_VERIFY(toplevel = m_compositor->xdgToplevelV6()); + QSignalSpy geometrySpy(toplevel.data(), SIGNAL(windowGeometryRequested(QRect))); + + m_compositor->sendXdgToplevelV6Configure(toplevel); + QTRY_COMPARE(geometrySpy.count(), 1); + QCOMPARE(geometrySpy.takeFirst().at(0).toRect().size(), window.frameGeometry().size()); + + m_compositor->sendXdgToplevelV6Configure(toplevel, QSize(123, 456)); + QTRY_COMPARE(geometrySpy.count(), 1); + QCOMPARE(geometrySpy.takeFirst().at(0).toRect().size(), QSize(123, 456)); +} + +void tst_WaylandClientXdgShellV6::windowGeometryFixed() +{ + QWindow window; + window.resize(QSize(1337, 137)); + window.setMaximumSize(window.size()); + window.setMinimumSize(window.size()); + window.show(); + + QSharedPointer toplevel; + QTRY_VERIFY(toplevel = m_compositor->xdgToplevelV6()); + QSignalSpy geometrySpy(toplevel.data(), SIGNAL(windowGeometryRequested(QRect))); + + m_compositor->sendXdgToplevelV6Configure(toplevel); + QTRY_COMPARE(geometrySpy.count(), 1); + QRect initialWindowGeometry = geometrySpy.takeFirst().at(0).toRect(); + QCOMPARE(initialWindowGeometry.size(), window.frameGeometry().size()); + + m_compositor->sendXdgToplevelV6Configure(toplevel, QSize(123, 456)); + QTRY_COMPARE(geometrySpy.count(), 1); + // Configuring the window should not change the window geometry + QCOMPARE(geometrySpy.takeFirst().at(0).toRect().size(), initialWindowGeometry.size()); +} + int main(int argc, char **argv) { setenv("XDG_RUNTIME_DIR", ".", 1); From 6ac25c4b120eb1e11a8af14e9299742421eec571 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Fri, 8 Jun 2018 15:18:14 +0200 Subject: [PATCH 0546/1507] Skip flaky tst_WaylandClient::dontCrashOnMultipleCommits() Until we figure out the cause, just skip it. Task-number: QTBUG-68756 Change-Id: I70d84ddabae4ef9df834ff8a471dddeee97e18f9 Reviewed-by: Paul Olav Tvete --- tests/auto/wayland/client/tst_client.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/auto/wayland/client/tst_client.cpp b/tests/auto/wayland/client/tst_client.cpp index dcc0cb773d6..874de82cc18 100644 --- a/tests/auto/wayland/client/tst_client.cpp +++ b/tests/auto/wayland/client/tst_client.cpp @@ -490,6 +490,7 @@ void tst_WaylandClient::mouseDrag() void tst_WaylandClient::dontCrashOnMultipleCommits() { + QSKIP("This test is flaky. See QTBUG-68756."); auto window = new TestWindow(); window->show(); From e16b3c1cc1b00296d3591a0c4ac900a8c9c53eba Mon Sep 17 00:00:00 2001 From: Robert Griebl Date: Thu, 17 May 2018 13:27:55 +0200 Subject: [PATCH 0547/1507] Add support for building QtWayland on macOS Change-Id: I98aadd5019e913bf0adcf0122b7b209981926278 Reviewed-by: Paul Olav Tvete --- src/plugins/platforms/wayland/qwaylanddataoffer.cpp | 2 +- src/plugins/platforms/wayland/qwaylandintegration.cpp | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylanddataoffer.cpp b/src/plugins/platforms/wayland/qwaylanddataoffer.cpp index 35085a7f0d5..0c732c02078 100644 --- a/src/plugins/platforms/wayland/qwaylanddataoffer.cpp +++ b/src/plugins/platforms/wayland/qwaylanddataoffer.cpp @@ -135,7 +135,7 @@ QVariant QWaylandMimeData::retrieveData_sys(const QString &mimeType, QVariant::T } int pipefd[2]; - if (::pipe2(pipefd, O_CLOEXEC|O_NONBLOCK) == -1) { + if (qt_safe_pipe(pipefd, O_NONBLOCK) == -1) { qWarning("QWaylandMimeData: pipe2() failed"); return QVariant(); } diff --git a/src/plugins/platforms/wayland/qwaylandintegration.cpp b/src/plugins/platforms/wayland/qwaylandintegration.cpp index b804988b2cf..6b2faf0c449 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandintegration.cpp @@ -52,7 +52,12 @@ #include "qwaylandwindowmanagerintegration_p.h" #include "qwaylandscreen_p.h" -#include +#if defined(Q_OS_MACOS) +# include +# include +#else +# include +#endif #include #include @@ -121,7 +126,11 @@ public: }; QWaylandIntegration::QWaylandIntegration() +#if defined(Q_OS_MACOS) + : mFontDb(new QCoreTextFontDatabaseEngineFactory) +#else : mFontDb(new QGenericUnixFontDatabase()) +#endif , mNativeInterface(new QWaylandNativeInterface(this)) #if QT_CONFIG(accessibility) , mAccessibility(new QPlatformAccessibility()) From 56b088d13e0d5ae42b872f543b30c9a7151dacd4 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Tue, 5 Jun 2018 13:56:02 +0200 Subject: [PATCH 0548/1507] Client: Remove applyConfigure for xdg-shell popups It's just dead code, we can add it back in the unlikely event that we should need it. Change-Id: I209fe92fb160e022c992384d731964e774596f74 Reviewed-by: Paul Olav Tvete --- .../shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp | 6 ------ .../shellintegration/xdg-shell-v6/qwaylandxdgshellv6_p.h | 1 - .../plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp | 6 ------ .../plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h | 1 - 4 files changed, 14 deletions(-) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp index d986bc69d1b..36a82fe9834 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp @@ -161,10 +161,6 @@ QWaylandXdgSurfaceV6::Popup::~Popup() destroy(); } -void QWaylandXdgSurfaceV6::Popup::applyConfigure() -{ -} - void QWaylandXdgSurfaceV6::Popup::zxdg_popup_v6_popup_done() { m_xdgSurface->m_window->window()->close(); @@ -251,8 +247,6 @@ void QWaylandXdgSurfaceV6::applyConfigure() if (m_toplevel) m_toplevel->applyConfigure(); - if (m_popup) - m_popup->applyConfigure(); m_configured = true; ack_configure(m_pendingConfigureSerial); diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6_p.h b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6_p.h index a2d19447128..c1d8564ac8f 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6_p.h +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6_p.h @@ -123,7 +123,6 @@ private: Popup(QWaylandXdgSurfaceV6 *xdgSurface, QWaylandXdgSurfaceV6 *parent, QtWayland::zxdg_positioner_v6 *positioner); ~Popup() override; - void applyConfigure(); void zxdg_popup_v6_popup_done() override; QWaylandXdgSurfaceV6 *m_xdgSurface = nullptr; diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp index 183576da0c1..9fdfb3e1647 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp @@ -161,10 +161,6 @@ QWaylandXdgSurface::Popup::~Popup() destroy(); } -void QWaylandXdgSurface::Popup::applyConfigure() -{ -} - void QWaylandXdgSurface::Popup::xdg_popup_popup_done() { m_xdgSurface->m_window->window()->close(); @@ -251,8 +247,6 @@ void QWaylandXdgSurface::applyConfigure() if (m_toplevel) m_toplevel->applyConfigure(); - if (m_popup) - m_popup->applyConfigure(); m_configured = true; ack_configure(m_pendingConfigureSerial); diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h index 1b312bd2db4..3dfe16242db 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h @@ -123,7 +123,6 @@ private: Popup(QWaylandXdgSurface *xdgSurface, QWaylandXdgSurface *parent, QtWayland::xdg_positioner *positioner); ~Popup() override; - void applyConfigure(); void xdg_popup_popup_done() override; QWaylandXdgSurface *m_xdgSurface = nullptr; From 14beea787a56bfb56616c3c7c43d38e641ab06ae Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Sat, 16 Jun 2018 21:15:17 +0200 Subject: [PATCH 0549/1507] Client: Fix bradient compilation error without xpm Change-Id: I8cbe939352713f643474d383da95b6d13be798a8 Reviewed-by: Paul Olav Tvete --- .../platforms/wayland/plugins/decorations/bradient/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp b/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp index d3627d2f70b..4d3099d7780 100644 --- a/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp +++ b/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp @@ -305,7 +305,7 @@ void QWaylandBradientDecoration::paint(QPaintDevice *device) p.save(); p.drawRect(maximizeButtonRect()); rect = maximizeButtonRect().adjusted(5, 5, -5, -5); - if (waylandWindow()->isMaximized()) { + if ((window()->windowStates() & Qt::WindowMaximized)) { QRectF rect1 = rect.adjusted(rect.width() / 3, 0, 0, -rect.height() / 3); QRectF rect2 = rect.adjusted(0, rect.height() / 4, -rect.width() / 4, 0); p.drawRect(rect1); From 7e5daff5dd6eed810e6931075ca17bc113f465d8 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Sat, 16 Jun 2018 23:32:48 +0200 Subject: [PATCH 0550/1507] Client: Don't restore content cursor when on the window decorations Problem: When the cursor entered the window decorations, QWaylandWindow::restoreMouseCursor would be called from the pointer enter handler messing up the cursor from the decorations, making the resize border seemingly hard to hit. Don't restore the cursor unless inside the window contents. [ChangeLog][QPA plugin] Fixed a bug where the arrow cursor would be shown instead of the resize cursor when hovering over the window decoration border. Change-Id: I2fabd8d626deaa7006734a4d5c6d10d6c0114466 Reviewed-by: Paul Olav Tvete --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index e071330634f..17602626b71 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -804,8 +804,13 @@ void QWaylandWindow::handleMouse(QWaylandInputDevice *inputDevice, const QWaylan } #if QT_CONFIG(cursor) - if (e.type == QWaylandPointerEvent::Enter) - restoreMouseCursor(inputDevice); + if (e.type == QWaylandPointerEvent::Enter) { + QRect windowGeometry = window()->frameGeometry(); + windowGeometry.moveTopLeft({0, 0}); // convert to wayland surface coordinates + QRect contentGeometry = windowGeometry.marginsRemoved(frameMargins()); + if (contentGeometry.contains(e.local.toPoint())) + restoreMouseCursor(inputDevice); + } #endif } From b40a7bd4b34f063172f5b9eb18aaaa1a95495c26 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Sun, 17 Jun 2018 00:42:37 +0200 Subject: [PATCH 0551/1507] Client: Use a pixel font size for window decorations The window title bar's height is given in device pixels, so the font size should be as well. Task-number: QTBUG-68834 Change-Id: I5a82deb39439088dd55152fb8bae5c2d19d8b33e Reviewed-by: Paul Olav Tvete Reviewed-by: Pier Luigi Fiorini --- .../platforms/wayland/plugins/decorations/bradient/main.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp b/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp index 4d3099d7780..02332a6464f 100644 --- a/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp +++ b/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp @@ -255,6 +255,7 @@ void QWaylandBradientDecoration::paint(QPaintDevice *device) int dy = (top.height()- size.height()) /2; QFont font = p.font(); font.setBold(true); + font.setPixelSize(12); p.setFont(font); QPoint windowTitlePoint(top.topLeft().x() + dx, top.topLeft().y() + dy); From 6dfa35b7a26946f87cf9cc62da179c0d9d46f74a Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Fri, 15 Jun 2018 14:59:26 +0200 Subject: [PATCH 0552/1507] Client: Get rid of QWaylandShellSurface::setType This shouldn't change any behavior, but lets the shell integrations choose if they want to use the extremely hacky QWaylandWindow::transientParent(). Hint: Not all shells need the hacks, and not all shells need them in all cases, and some shells may need even more hacks. Change-Id: Id105e4feb83cc9c14dcf07dcca55fcd5e63d4a2b Reviewed-by: Paul Olav Tvete --- .../wl-shell/qwaylandwlshellsurface.cpp | 19 ++++++------ .../wl-shell/qwaylandwlshellsurface_p.h | 1 - .../xdg-shell-v5/qwaylandxdgpopupv5.cpp | 6 ---- .../xdg-shell-v5/qwaylandxdgpopupv5_p.h | 2 -- .../xdg-shell-v5/qwaylandxdgsurfacev5.cpp | 9 ++---- .../xdg-shell-v5/qwaylandxdgsurfacev5_p.h | 1 - .../xdg-shell-v6/qwaylandxdgshellv6.cpp | 29 +++++++++---------- .../xdg-shell-v6/qwaylandxdgshellv6_p.h | 1 - .../xdg-shell/qwaylandxdgshell.cpp | 29 +++++++++---------- .../xdg-shell/qwaylandxdgshell_p.h | 1 - .../wayland/qwaylandshellsurface_p.h | 1 - .../platforms/wayland/qwaylandwindow.cpp | 2 -- 12 files changed, 39 insertions(+), 62 deletions(-) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellsurface.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellsurface.cpp index 9f2bcc00c10..d9bc83059b8 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellsurface.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellsurface.cpp @@ -59,6 +59,15 @@ QWaylandWlShellSurface::QWaylandWlShellSurface(struct ::wl_shell_surface *shell_ { if (window->display()->windowExtension()) m_extendedWindow = new QWaylandExtendedSurface(window); + + Qt::WindowType type = window->window()->type(); + auto *transientParent = window->transientParent(); + if (type == Qt::Popup && transientParent && transientParent->object()) + setPopup(transientParent, m_window->display()->lastInputDevice(), m_window->display()->lastInputSerial()); + else if (transientParent && transientParent->object()) + updateTransientParent(transientParent->window()); + else + setTopLevel(); } QWaylandWlShellSurface::~QWaylandWlShellSurface() @@ -250,16 +259,6 @@ void QWaylandWlShellSurface::setPopup(QWaylandWindow *parent, QWaylandInputDevic transientPos.x(), transientPos.y(), 0); } -void QWaylandWlShellSurface::setType(Qt::WindowType type, QWaylandWindow *transientParent) -{ - if (type == Qt::Popup && transientParent && transientParent->object()) - setPopup(transientParent, m_window->display()->lastInputDevice(), m_window->display()->lastInputSerial()); - else if (transientParent && transientParent->object()) - updateTransientParent(transientParent->window()); - else - setTopLevel(); -} - void QWaylandWlShellSurface::shell_surface_ping(uint32_t serial) { pong(serial); diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellsurface_p.h b/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellsurface_p.h index ca81dd685aa..57e06525aea 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellsurface_p.h +++ b/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellsurface_p.h @@ -92,7 +92,6 @@ public: void setWindowFlags(Qt::WindowFlags flags) override; void sendProperty(const QString &name, const QVariant &value) override; - void setType(Qt::WindowType type, QWaylandWindow *transientParent) override; void applyConfigure() override; bool wantsDecorations() const override; diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgpopupv5.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgpopupv5.cpp index 542b1628d0a..539abcac78c 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgpopupv5.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgpopupv5.cpp @@ -62,12 +62,6 @@ QWaylandXdgPopupV5::~QWaylandXdgPopupV5() delete m_extendedWindow; } -void QWaylandXdgPopupV5::setType(Qt::WindowType type, QWaylandWindow *transientParent) -{ - Q_UNUSED(type); - Q_UNUSED(transientParent); -} - void QWaylandXdgPopupV5::xdg_popup_popup_done() { m_window->window()->close(); diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgpopupv5_p.h b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgpopupv5_p.h index 638b7153412..cb748c5ccb7 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgpopupv5_p.h +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgpopupv5_p.h @@ -75,8 +75,6 @@ public: QWaylandXdgPopupV5(struct ::xdg_popup *popup, QWaylandWindow *window); ~QWaylandXdgPopupV5() override; - void setType(Qt::WindowType type, QWaylandWindow *transientParent) override; - protected: void xdg_popup_popup_done() override; diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgsurfacev5.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgsurfacev5.cpp index 315dc62316e..6d43a66beb5 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgsurfacev5.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgsurfacev5.cpp @@ -60,6 +60,8 @@ QWaylandXdgSurfaceV5::QWaylandXdgSurfaceV5(QWaylandXdgShellV5 *shell, QWaylandWi { if (window->display()->windowExtension()) m_extendedWindow = new QWaylandExtendedSurface(window); + + updateTransientParent(window->transientParent()); } QWaylandXdgSurfaceV5::~QWaylandXdgSurfaceV5() @@ -141,13 +143,6 @@ void QWaylandXdgSurfaceV5::sendProperty(const QString &name, const QVariant &val m_extendedWindow->updateGenericProperty(name, value); } -void QWaylandXdgSurfaceV5::setType(Qt::WindowType type, QWaylandWindow *transientParent) -{ - Q_UNUSED(type) - if (transientParent) - updateTransientParent(transientParent); -} - void QWaylandXdgSurfaceV5::applyConfigure() { if (m_pending.isResizing) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgsurfacev5_p.h b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgsurfacev5_p.h index 9283957795c..e69433248e5 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgsurfacev5_p.h +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgsurfacev5_p.h @@ -97,7 +97,6 @@ public: void setWindowFlags(Qt::WindowFlags flags) override; void sendProperty(const QString &name, const QVariant &value) override; - void setType(Qt::WindowType type, QWaylandWindow *transientParent) override; void applyConfigure() override; void requestWindowStates(Qt::WindowStates states) override; bool wantsDecorations() const override; diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp index 36a82fe9834..ef400a8d472 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp @@ -172,6 +172,20 @@ QWaylandXdgSurfaceV6::QWaylandXdgSurfaceV6(QWaylandXdgShellV6 *shell, ::zxdg_sur , m_shell(shell) , m_window(window) { + QWaylandDisplay *display = window->display(); + Qt::WindowType type = window->window()->type(); + auto *transientParent = window->transientParent(); + + if ((type == Qt::Popup || type == Qt::ToolTip) && transientParent && display->lastInputDevice()) { + setPopup(transientParent, display->lastInputDevice(), display->lastInputSerial(), type == Qt::Popup); + } else { + setToplevel(); + if (transientParent) { + auto parentXdgSurface = static_cast(transientParent->shellSurface()); + if (parentXdgSurface) + m_toplevel->set_parent(parentXdgSurface->m_toplevel->object()); + } + } } QWaylandXdgSurfaceV6::~QWaylandXdgSurfaceV6() @@ -217,21 +231,6 @@ void QWaylandXdgSurfaceV6::setAppId(const QString &appId) m_toplevel->set_app_id(appId); } -void QWaylandXdgSurfaceV6::setType(Qt::WindowType type, QWaylandWindow *transientParent) -{ - QWaylandDisplay *display = m_window->display(); - if ((type == Qt::Popup || type == Qt::ToolTip) && transientParent && display->lastInputDevice()) { - setPopup(transientParent, display->lastInputDevice(), display->lastInputSerial(), type == Qt::Popup); - } else { - setToplevel(); - if (transientParent) { - auto parentXdgSurface = static_cast(transientParent->shellSurface()); - if (parentXdgSurface) - m_toplevel->set_parent(parentXdgSurface->m_toplevel->object()); - } - } -} - bool QWaylandXdgSurfaceV6::handleExpose(const QRegion ®ion) { if (!m_configured && !region.isEmpty()) { diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6_p.h b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6_p.h index c1d8564ac8f..8168ae5650a 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6_p.h +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6_p.h @@ -85,7 +85,6 @@ public: void setTitle(const QString &title) override; void setAppId(const QString &appId) override; - void setType(Qt::WindowType type, QWaylandWindow *transientParent) override; bool isExposed() const override { return m_configured; } bool handleExpose(const QRegion &) override; bool handlesActiveState() const { return m_toplevel; } diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp index 9fdfb3e1647..19530cb3da2 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp @@ -172,6 +172,20 @@ QWaylandXdgSurface::QWaylandXdgSurface(QWaylandXdgShell *shell, ::xdg_surface *s , m_shell(shell) , m_window(window) { + QWaylandDisplay *display = window->display(); + Qt::WindowType type = window->window()->type(); + auto *transientParent = window->transientParent(); + + if ((type == Qt::Popup || type == Qt::ToolTip) && transientParent && display->lastInputDevice()) { + setPopup(transientParent, display->lastInputDevice(), display->lastInputSerial(), type == Qt::Popup); + } else { + setToplevel(); + if (transientParent) { + auto parentXdgSurface = static_cast(transientParent->shellSurface()); + if (parentXdgSurface) + m_toplevel->set_parent(parentXdgSurface->m_toplevel->object()); + } + } } QWaylandXdgSurface::~QWaylandXdgSurface() @@ -217,21 +231,6 @@ void QWaylandXdgSurface::setAppId(const QString &appId) m_toplevel->set_app_id(appId); } -void QWaylandXdgSurface::setType(Qt::WindowType type, QWaylandWindow *transientParent) -{ - QWaylandDisplay *display = m_window->display(); - if ((type == Qt::Popup || type == Qt::ToolTip) && transientParent && display->lastInputDevice()) { - setPopup(transientParent, display->lastInputDevice(), display->lastInputSerial(), type == Qt::Popup); - } else { - setToplevel(); - if (transientParent) { - auto parentXdgSurface = static_cast(transientParent->shellSurface()); - if (parentXdgSurface) - m_toplevel->set_parent(parentXdgSurface->m_toplevel->object()); - } - } -} - bool QWaylandXdgSurface::handleExpose(const QRegion ®ion) { if (!m_configured && !region.isEmpty()) { diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h index 3dfe16242db..7fb85131585 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h @@ -85,7 +85,6 @@ public: void setTitle(const QString &title) override; void setAppId(const QString &appId) override; - void setType(Qt::WindowType type, QWaylandWindow *transientParent) override; bool isExposed() const override { return m_configured; } bool handleExpose(const QRegion &) override; bool handlesActiveState() const { return m_toplevel; } diff --git a/src/plugins/platforms/wayland/qwaylandshellsurface_p.h b/src/plugins/platforms/wayland/qwaylandshellsurface_p.h index 6b6bb9e84c7..6bc3258c799 100644 --- a/src/plugins/platforms/wayland/qwaylandshellsurface_p.h +++ b/src/plugins/platforms/wayland/qwaylandshellsurface_p.h @@ -95,7 +95,6 @@ public: inline QWaylandWindow *window() { return m_window; } - virtual void setType(Qt::WindowType type, QWaylandWindow *transientParent) = 0; virtual void applyConfigure() {} virtual void requestWindowStates(Qt::WindowStates states) {Q_UNUSED(states);} virtual bool wantsDecorations() const { return false; } diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 17602626b71..9378f9cebc7 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -139,8 +139,6 @@ void QWaylandWindow::initWindow() mShellSurface = mDisplay->createShellSurface(this); if (mShellSurface) { - mShellSurface->setType(window()->type(), transientParent()); - // Set initial surface title setWindowTitle(window()->title()); From 0424118abdf52fbd120360b9af502c687262c1bd Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Sat, 16 Jun 2018 22:57:53 +0200 Subject: [PATCH 0553/1507] Client: Move bradient buttons inside processMouseTop To avoid them covering for the edges of the window Change-Id: Id8a1362ec11bd25f54cb2c9fbcbd562af8f283d8 Reviewed-by: Paul Olav Tvete --- .../plugins/decorations/bradient/main.cpp | 27 ++++++++++--------- 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp b/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp index 02332a6464f..d79322bf45c 100644 --- a/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp +++ b/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp @@ -351,16 +351,7 @@ bool QWaylandBradientDecoration::handleMouse(QWaylandInputDevice *inputDevice, c Q_UNUSED(global); // Figure out what area mouse is in - if (closeButtonRect().contains(local)) { - if (clickButton(b, Close)) - QWindowSystemInterface::handleCloseEvent(window()); - } else if (maximizeButtonRect().contains(local)) { - if (clickButton(b, Maximize)) - window()->setWindowStates(window()->windowStates() ^ Qt::WindowMaximized); - } else if (minimizeButtonRect().contains(local)) { - if (clickButton(b, Minimize)) - window()->setWindowState(Qt::WindowMinimized); - } else if (local.y() <= margins().top()) { + if (local.y() <= margins().top()) { processMouseTop(inputDevice,local,b,mods); } else if (local.y() > window()->height() + margins().top()) { processMouseBottom(inputDevice,local,b,mods); @@ -419,19 +410,31 @@ void QWaylandBradientDecoration::processMouseTop(QWaylandInputDevice *inputDevic #endif startResize(inputDevice,WL_SHELL_SURFACE_RESIZE_TOP_RIGHT,b); } else { - //top reszie bit + //top resize bit #if QT_CONFIG(cursor) waylandWindow()->setMouseCursor(inputDevice, Qt::SplitVCursor); #endif startResize(inputDevice,WL_SHELL_SURFACE_RESIZE_TOP,b); } + } else if (local.x() <= margins().left()) { + processMouseLeft(inputDevice, local, b, mods); + } else if (local.x() > window()->width() + margins().left()) { + processMouseRight(inputDevice, local, b, mods); + } else if (closeButtonRect().contains(local)) { + if (clickButton(b, Close)) + QWindowSystemInterface::handleCloseEvent(window()); + } else if (maximizeButtonRect().contains(local)) { + if (clickButton(b, Maximize)) + window()->setWindowStates(window()->windowStates() ^ Qt::WindowMaximized); + } else if (minimizeButtonRect().contains(local)) { + if (clickButton(b, Minimize)) + window()->setWindowState(Qt::WindowMinimized); } else { #if QT_CONFIG(cursor) waylandWindow()->restoreMouseCursor(inputDevice); #endif startMove(inputDevice,b); } - } void QWaylandBradientDecoration::processMouseBottom(QWaylandInputDevice *inputDevice, const QPointF &local, Qt::MouseButtons b, Qt::KeyboardModifiers mods) From f2610e8d76cfec9d4b7d30ef5bf0168102cd15ad Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Sat, 16 Jun 2018 06:06:17 -0700 Subject: [PATCH 0554/1507] Fix warning about extra const qwaylandxdgsurfacev5.cpp:77:97: warning: type qualifiers ignored on cast result type [-Wignored-qualifiers] Change-Id: I6efb28c3145047559ec0fffd1538a5ce04f2721b Reviewed-by: Johan Helsing --- .../shellintegration/xdg-shell-v5/qwaylandxdgsurfacev5.cpp | 2 +- .../shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp | 2 +- .../plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgsurfacev5.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgsurfacev5.cpp index 6d43a66beb5..31c7dff7b96 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgsurfacev5.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgsurfacev5.cpp @@ -76,7 +76,7 @@ QWaylandXdgSurfaceV5::~QWaylandXdgSurfaceV5() void QWaylandXdgSurfaceV5::resize(QWaylandInputDevice *inputDevice, enum wl_shell_surface_resize edges) { // May need some conversion if types get incompatibles, ATM they're identical - enum resize_edge const * const arg = reinterpret_cast(&edges); + enum resize_edge const * const arg = reinterpret_cast(&edges); resize(inputDevice, *arg); } diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp index ef400a8d472..a8bfaac690a 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp @@ -205,7 +205,7 @@ void QWaylandXdgSurfaceV6::resize(QWaylandInputDevice *inputDevice, zxdg_topleve void QWaylandXdgSurfaceV6::resize(QWaylandInputDevice *inputDevice, enum wl_shell_surface_resize edges) { - auto xdgEdges = reinterpret_cast(&edges); + auto xdgEdges = reinterpret_cast(&edges); resize(inputDevice, *xdgEdges); } diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp index 19530cb3da2..cab7dc08e84 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp @@ -205,7 +205,7 @@ void QWaylandXdgSurface::resize(QWaylandInputDevice *inputDevice, xdg_toplevel_r void QWaylandXdgSurface::resize(QWaylandInputDevice *inputDevice, enum wl_shell_surface_resize edges) { - auto xdgEdges = reinterpret_cast(&edges); + auto xdgEdges = reinterpret_cast(&edges); resize(inputDevice, *xdgEdges); } From 764a79e01dc6095fe625a45f7b617493ed61c5f2 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Sat, 16 Jun 2018 06:14:36 -0700 Subject: [PATCH 0555/1507] Fix build: some shells need to link to libxkbcommon They use QtWaylandClient's private headers. In file included from qwaylandinputdevice_p.h:1, from qwaylandxdgshellv6.cpp:45: qwaylandinputdevice_p.h:69:10: fatal error: xkbcommon/xkbcommon.h: No such file or directory Change-Id: I6efb28c3145047559ec0fffd1538a642167da67f Reviewed-by: Oswald Buddenhagen Reviewed-by: Johan Helsing --- .../wayland/plugins/shellintegration/wl-shell/wl-shell.pro | 2 ++ .../plugins/shellintegration/xdg-shell-v6/xdg-shell-v6.pro | 2 ++ .../wayland/plugins/shellintegration/xdg-shell/xdg-shell.pro | 2 ++ 3 files changed, 6 insertions(+) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/wl-shell.pro b/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/wl-shell.pro index 211dc876f8e..fbff63c712e 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/wl-shell.pro +++ b/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/wl-shell.pro @@ -2,6 +2,8 @@ QT += gui-private waylandclient-private CONFIG += wayland-scanner QMAKE_USE += wayland-client +qtConfig(xkbcommon-evdev): \ + QMAKE_USE_PRIVATE += xkbcommon_evdev WAYLANDCLIENTSOURCES += \ ../../../3rdparty/protocol/wayland.xml diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/xdg-shell-v6.pro b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/xdg-shell-v6.pro index a5e0a51055f..5d5046f6066 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/xdg-shell-v6.pro +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/xdg-shell-v6.pro @@ -2,6 +2,8 @@ QT += gui-private waylandclient-private CONFIG += wayland-scanner QMAKE_USE += wayland-client +qtConfig(xkbcommon-evdev): \ + QMAKE_USE_PRIVATE += xkbcommon_evdev WAYLANDCLIENTSOURCES += \ ../../../3rdparty/protocol/xdg-shell-unstable-v6.xml diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/xdg-shell.pro b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/xdg-shell.pro index b6d4a9b2ee6..1fabf2c64d4 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/xdg-shell.pro +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/xdg-shell.pro @@ -2,6 +2,8 @@ QT += gui-private waylandclient-private CONFIG += wayland-scanner QMAKE_USE += wayland-client +qtConfig(xkbcommon-evdev): \ + QMAKE_USE_PRIVATE += xkbcommon_evdev WAYLANDCLIENTSOURCES += \ ../../../3rdparty/protocol/xdg-shell.xml From d923a194913b2d6343f161a5d65fe026fd8f86ab Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Sat, 16 Jun 2018 21:32:11 +0200 Subject: [PATCH 0556/1507] Client: Improve the look of bradient [ChangeLog][QPA plugin] The window decorations have had a redesign, they now use the window background color instead of the blue gradient. Changes: - Removed the gradient - Used QPalette::Window for color instead of QPalette::Highlight - Removed the xpm buttons as they look bad on high-dpi - Redid the non-xpm buttons, removing their border - Used anti-aliasing for cross icon (diagonal lines) - Size of buttons have been increased, to be easier to click - The position of the buttons have been shifted slightly - Reduced rounding of the corners slightly - Switched to non-bold and increased the font size for the window title Task-number: QTBUG-68834 Change-Id: I17b2464c5e2518294d795512493bfe93e9a2f550 Reviewed-by: Paul Olav Tvete Reviewed-by: Pier Luigi Fiorini --- .../plugins/decorations/bradient/main.cpp | 126 +++--------------- 1 file changed, 18 insertions(+), 108 deletions(-) diff --git a/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp b/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp index d79322bf45c..d1675fe5083 100644 --- a/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp +++ b/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp @@ -55,72 +55,8 @@ QT_BEGIN_NAMESPACE namespace QtWaylandClient { #define BUTTON_SPACING 5 - -#if QT_CONFIG(imageformat_xpm) -# define BUTTON_WIDTH 10 - -static const char * const qt_close_xpm[] = { -"10 10 2 1", -"# c #000000", -". c None", -"..........", -".##....##.", -"..##..##..", -"...####...", -"....##....", -"...####...", -"..##..##..", -".##....##.", -"..........", -".........."}; - -static const char * const qt_maximize_xpm[]={ -"10 10 2 1", -"# c #000000", -". c None", -"#########.", -"#########.", -"#.......#.", -"#.......#.", -"#.......#.", -"#.......#.", -"#.......#.", -"#.......#.", -"#########.", -".........."}; - -static const char * const qt_minimize_xpm[] = { -"10 10 2 1", -"# c #000000", -". c None", -"..........", -"..........", -"..........", -"..........", -"..........", -"..........", -"..........", -".#######..", -".#######..", -".........."}; - -static const char * const qt_normalizeup_xpm[] = { -"10 10 2 1", -"# c #000000", -". c None", -"...######.", -"...######.", -"...#....#.", -".######.#.", -".######.#.", -".#....###.", -".#....#...", -".#....#...", -".######...", -".........."}; -#else -# define BUTTON_WIDTH 22 -#endif +#define BUTTON_WIDTH 18 +#define BUTTONS_RIGHT_MARGIN 8 enum Button { @@ -161,8 +97,8 @@ private: QWaylandBradientDecoration::QWaylandBradientDecoration() { QPalette palette; - m_foregroundColor = palette.color(QPalette::Active, QPalette::HighlightedText); - m_backgroundColor = palette.color(QPalette::Active, QPalette::Highlight); + m_foregroundColor = palette.color(QPalette::Active, QPalette::WindowText); + m_backgroundColor = palette.color(QPalette::Active, QPalette::Window); QTextOption option(Qt::AlignHCenter | Qt::AlignVCenter); option.setWrapMode(QTextOption::NoWrap); @@ -171,19 +107,19 @@ QWaylandBradientDecoration::QWaylandBradientDecoration() QRectF QWaylandBradientDecoration::closeButtonRect() const { - return QRectF(window()->frameGeometry().width() - BUTTON_WIDTH - BUTTON_SPACING * 2, + return QRectF(window()->frameGeometry().width() - BUTTON_WIDTH - BUTTON_SPACING * 0 - BUTTONS_RIGHT_MARGIN, (margins().top() - BUTTON_WIDTH) / 2, BUTTON_WIDTH, BUTTON_WIDTH); } QRectF QWaylandBradientDecoration::maximizeButtonRect() const { - return QRectF(window()->frameGeometry().width() - BUTTON_WIDTH * 2 - BUTTON_SPACING * 3, + return QRectF(window()->frameGeometry().width() - BUTTON_WIDTH * 2 - BUTTON_SPACING * 1 - BUTTONS_RIGHT_MARGIN, (margins().top() - BUTTON_WIDTH) / 2, BUTTON_WIDTH, BUTTON_WIDTH); } QRectF QWaylandBradientDecoration::minimizeButtonRect() const { - return QRectF(window()->frameGeometry().width() - BUTTON_WIDTH * 3 - BUTTON_SPACING * 4, + return QRectF(window()->frameGeometry().width() - BUTTON_WIDTH * 3 - BUTTON_SPACING * 2 - BUTTONS_RIGHT_MARGIN, (margins().top() - BUTTON_WIDTH) / 2, BUTTON_WIDTH, BUTTON_WIDTH); } @@ -209,16 +145,12 @@ void QWaylandBradientDecoration::paint(QPaintDevice *device) p.setRenderHint(QPainter::Antialiasing); // Title bar - QLinearGradient grad(top.topLeft(), top.bottomLeft()); - QColor base(m_backgroundColor); - grad.setColorAt(0, base.lighter(100)); - grad.setColorAt(1, base.darker(180)); QPainterPath roundedRect; - roundedRect.addRoundedRect(surfaceRect, 6, 6); + roundedRect.addRoundedRect(surfaceRect, 3, 3); for (int i = 0; i < 4; ++i) { p.save(); p.setClipRect(clips[i]); - p.fillPath(roundedRect, grad); + p.fillPath(roundedRect, m_backgroundColor); p.restore(); } @@ -254,8 +186,7 @@ void QWaylandBradientDecoration::paint(QPaintDevice *device) int dx = (top.width() - size.width()) /2; int dy = (top.height()- size.height()) /2; QFont font = p.font(); - font.setBold(true); - font.setPixelSize(12); + font.setPixelSize(14); p.setFont(font); QPoint windowTitlePoint(top.topLeft().x() + dx, top.topLeft().y() + dy); @@ -263,26 +194,6 @@ void QWaylandBradientDecoration::paint(QPaintDevice *device) p.restore(); } -#if QT_CONFIG(imageformat_xpm) - p.save(); - - // Close button - QPixmap closePixmap(qt_close_xpm); - p.drawPixmap(closeButtonRect(), closePixmap, closePixmap.rect()); - - // Maximize button - QPixmap maximizePixmap((window()->windowStates() & Qt::WindowMaximized) ? qt_normalizeup_xpm : qt_maximize_xpm); - p.drawPixmap(maximizeButtonRect(), maximizePixmap, maximizePixmap.rect()); - - // Minimize button - QPixmap minimizePixmap(qt_minimize_xpm); - p.drawPixmap(minimizeButtonRect(), minimizePixmap, minimizePixmap.rect()); - - p.restore(); -#else - // We don't need antialiasing from now on - p.setRenderHint(QPainter::Antialiasing, false); - QRectF rect; // Default pen @@ -292,8 +203,7 @@ void QWaylandBradientDecoration::paint(QPaintDevice *device) // Close button p.save(); rect = closeButtonRect(); - p.drawRect(rect); - qreal crossSize = rect.height() / 2; + qreal crossSize = rect.height() / 2.3; QPointF crossCenter(rect.center()); QRectF crossRect(crossCenter.x() - crossSize / 2, crossCenter.y() - crossSize / 2, crossSize, crossSize); pen.setWidth(2); @@ -304,15 +214,16 @@ void QWaylandBradientDecoration::paint(QPaintDevice *device) // Maximize button p.save(); - p.drawRect(maximizeButtonRect()); - rect = maximizeButtonRect().adjusted(5, 5, -5, -5); + p.setRenderHint(QPainter::Antialiasing, false); + rect = maximizeButtonRect().adjusted(4, 5, -4, -5); if ((window()->windowStates() & Qt::WindowMaximized)) { - QRectF rect1 = rect.adjusted(rect.width() / 3, 0, 0, -rect.height() / 3); - QRectF rect2 = rect.adjusted(0, rect.height() / 4, -rect.width() / 4, 0); + qreal inset = 2; + QRectF rect1 = rect.adjusted(inset, 0, 0, -inset); + QRectF rect2 = rect.adjusted(0, inset, -inset, 0); p.drawRect(rect1); + p.setBrush(m_backgroundColor); // need to cover up some lines from the other rect p.drawRect(rect2); } else { - p.setPen(m_foregroundColor); p.drawRect(rect); p.drawLine(rect.left(), rect.top() + 1, rect.right(), rect.top() + 1); } @@ -320,13 +231,12 @@ void QWaylandBradientDecoration::paint(QPaintDevice *device) // Minimize button p.save(); - p.drawRect(minimizeButtonRect()); + p.setRenderHint(QPainter::Antialiasing, false); rect = minimizeButtonRect().adjusted(5, 5, -5, -5); pen.setWidth(2); p.setPen(pen); p.drawLine(rect.bottomLeft(), rect.bottomRight()); p.restore(); -#endif } bool QWaylandBradientDecoration::clickButton(Qt::MouseButtons b, Button btn) From 3e66edd846feae4c6b60c9da485353493f175d81 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Mon, 25 Jun 2018 15:49:32 +0200 Subject: [PATCH 0557/1507] Client: Fix cursor hotspot on high-dpi QWaylandInputDevice::setCursor(wl_buffer, QPoint, QSize, bufferscale) assumes a hotspot and a size in surface coordinates, while wl_cursor_image uses pixel coordinates. Divide by bufferScale to get the correct values. This breaks hidpi cursors on kwin 5.13.1 and earlier, where buffer scale for cursor surfaces are ignored. Change-Id: I7c86bc541ccf5fb878facebbe93d2b1f842dfc5c Reviewed-by: David Edmundson Reviewed-by: Paul Olav Tvete --- .../platforms/wayland/qwaylandinputdevice.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index 4835bd68e9d..b4b7c4ef323 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -389,11 +389,17 @@ void QWaylandInputDevice::setCursor(const QCursor &cursor, QWaylandScreen *scree void QWaylandInputDevice::setCursor(struct wl_buffer *buffer, struct wl_cursor_image *image, int bufferScale) { - setCursor(buffer, - image ? QPoint(image->hotspot_x, image->hotspot_y) : QPoint(), - image ? QSize(image->width, image->height) : QSize(), bufferScale); + if (image) { + // Convert from pixel coordinates to surface coordinates + QPoint hotspot = QPoint(image->hotspot_x, image->hotspot_y) / bufferScale; + QSize size = QSize(image->width, image->height) / bufferScale; + setCursor(buffer, hotspot, size, bufferScale); + } else { + setCursor(buffer, QPoint(), QSize(), bufferScale); + } } +// size and hotspot are in surface coordinates void QWaylandInputDevice::setCursor(struct wl_buffer *buffer, const QPoint &hotSpot, const QSize &size, int bufferScale) { if (mCaps & WL_SEAT_CAPABILITY_POINTER) { From ede3963eba6085896f71116aadfc34dd18e14126 Mon Sep 17 00:00:00 2001 From: Daniel d'Andrada Date: Thu, 28 Jun 2018 09:59:25 +0200 Subject: [PATCH 0558/1507] Implement QWaylandXdgSurface::xdg_surface_close() Change-Id: Ia2f708fc668a802f4468efd0765f36aab0944e10 Reviewed-by: Johan Helsing --- src/plugins/platforms/wayland/qwaylandxdgsurface.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/plugins/platforms/wayland/qwaylandxdgsurface.cpp b/src/plugins/platforms/wayland/qwaylandxdgsurface.cpp index 4dfc5e6daad..42738528c48 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgsurface.cpp +++ b/src/plugins/platforms/wayland/qwaylandxdgsurface.cpp @@ -249,6 +249,7 @@ void QWaylandXdgSurface::xdg_surface_configure(int32_t width, int32_t height, st void QWaylandXdgSurface::xdg_surface_close() { + m_window->window()->close(); } } From 9706945157fd307f9631ce42927e3d4906e9848d Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Wed, 27 Jun 2018 17:26:49 +0200 Subject: [PATCH 0559/1507] Send damage for window decorations Compositors that only update damaged regions would show the old content of the decorations. [ChangeLog][QPA plugin] Fixed the window decorations sometimes not updating on some compositors. Change-Id: I75ab40e159bf165152a58e438dd7f70e7f9e9b22 Reviewed-by: Paul Olav Tvete --- .../wayland/qwaylandabstractdecoration.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/plugins/platforms/wayland/qwaylandabstractdecoration.cpp b/src/plugins/platforms/wayland/qwaylandabstractdecoration.cpp index c82ff539477..479a857502f 100644 --- a/src/plugins/platforms/wayland/qwaylandabstractdecoration.cpp +++ b/src/plugins/platforms/wayland/qwaylandabstractdecoration.cpp @@ -100,6 +100,16 @@ void QWaylandAbstractDecoration::setWaylandWindow(QWaylandWindow *window) d->m_wayland_window = window; } +static QRegion marginsRegion(const QSize &size, const QMargins &margins) +{ + QRegion r; + r += QRect(0, 0, size.width(), margins.top()); // top + r += QRect(0, size.height()+margins.top(), size.width(), margins.bottom()); //bottom + r += QRect(0, 0, margins.left(), size.height()); //left + r += QRect(size.width()+margins.left(), 0, margins.right(), size.height()); // right + return r; +} + const QImage &QWaylandAbstractDecoration::contentImage() { Q_D(QWaylandAbstractDecoration); @@ -113,6 +123,10 @@ const QImage &QWaylandAbstractDecoration::contentImage() d->m_decorationContentImage.fill(Qt::transparent); this->paint(&d->m_decorationContentImage); + QRegion damage = marginsRegion(window()->frameGeometry().size(), window()->frameMargins()); + for (QRect r : damage) + waylandWindow()->damage(r); + d->m_isDirty = false; } From 4d87e7e34bdc37c1f02bd8c3634dff9200b653f4 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Sat, 16 Jun 2018 22:37:38 +0200 Subject: [PATCH 0560/1507] Draw disabled text color for inactive window decorations Task-number: QTBUG-68834 Change-Id: Iced478d12b56fc360c0d824cf5876855d887f9a2 Reviewed-by: Paul Olav Tvete Reviewed-by: Pier Luigi Fiorini --- .../wayland/plugins/decorations/bradient/main.cpp | 6 ++++-- src/plugins/platforms/wayland/qwaylanddisplay.cpp | 7 +++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp b/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp index d1675fe5083..1df3ac62b21 100644 --- a/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp +++ b/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp @@ -87,6 +87,7 @@ private: QRectF minimizeButtonRect() const; QColor m_foregroundColor; + QColor m_foregroundInactiveColor; QColor m_backgroundColor; QStaticText m_windowTitle; Button m_clicking = None; @@ -99,6 +100,7 @@ QWaylandBradientDecoration::QWaylandBradientDecoration() QPalette palette; m_foregroundColor = palette.color(QPalette::Active, QPalette::WindowText); m_backgroundColor = palette.color(QPalette::Active, QPalette::Window); + m_foregroundInactiveColor = palette.color(QPalette::Disabled, QPalette::WindowText); QTextOption option(Qt::AlignHCenter | Qt::AlignVCenter); option.setWrapMode(QTextOption::NoWrap); @@ -181,7 +183,7 @@ void QWaylandBradientDecoration::paint(QPaintDevice *device) p.save(); p.setClipRect(titleBar); - p.setPen(m_foregroundColor); + p.setPen(window()->isActive() ? m_foregroundColor : m_foregroundInactiveColor); QSizeF size = m_windowTitle.size(); int dx = (top.width() - size.width()) /2; int dy = (top.height()- size.height()) /2; @@ -197,7 +199,7 @@ void QWaylandBradientDecoration::paint(QPaintDevice *device) QRectF rect; // Default pen - QPen pen(m_foregroundColor); + QPen pen(window()->isActive() ? m_foregroundColor : m_foregroundInactiveColor); p.setPen(pen); // Close button diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index 1cb499f5e0f..03e4e3a2c0f 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -41,6 +41,7 @@ #include "qwaylandintegration_p.h" #include "qwaylandwindow_p.h" +#include "qwaylandabstractdecoration_p.h" #include "qwaylandscreen_p.h" #include "qwaylandcursor_p.h" #include "qwaylandinputdevice_p.h" @@ -407,6 +408,9 @@ void QWaylandDisplay::handleWindowActivated(QWaylandWindow *window) mActiveWindows.append(window); requestWaylandSync(); + + if (auto *decoration = window->decoration()) + decoration->update(); } void QWaylandDisplay::handleWindowDeactivated(QWaylandWindow *window) @@ -417,6 +421,9 @@ void QWaylandDisplay::handleWindowDeactivated(QWaylandWindow *window) requestWaylandSync(); mActiveWindows.removeOne(window); + + if (auto *decoration = window->decoration()) + decoration->update(); } void QWaylandDisplay::handleKeyboardFocusChanged(QWaylandInputDevice *inputDevice) From 7023f9de8536501c99a347f4308f09de7082ee20 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Fri, 22 Jun 2018 11:28:16 +0200 Subject: [PATCH 0561/1507] Proper naming for backingstore logging category The logging category is exported, so the name should be specific. Change-Id: Iffdc89875ef9e3091009780edc614fee10c05532 Reviewed-by: Johan Helsing --- src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp b/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp index 54b0b798c5e..dde01357b76 100644 --- a/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp +++ b/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp @@ -68,9 +68,9 @@ QT_BEGIN_NAMESPACE namespace QtWaylandClient { -Q_DECLARE_LOGGING_CATEGORY(logCategory) +Q_DECLARE_LOGGING_CATEGORY(lcWaylandBackingstore) -Q_LOGGING_CATEGORY(logCategory, "qt.qpa.wayland.backingstore") +Q_LOGGING_CATEGORY(lcWaylandBackingstore, "qt.qpa.wayland.backingstore") QWaylandShmBuffer::QWaylandShmBuffer(QWaylandDisplay *display, const QSize &size, QImage::Format format, int scale) @@ -277,7 +277,7 @@ void QWaylandShmBackingStore::resize(const QSize &size) // run single buffered, while with the pixman renderer we have to use two. QWaylandShmBuffer *buffer = getBuffer(sizeWithMargins); while (!buffer) { - qCDebug(logCategory, "QWaylandShmBackingStore: stalling waiting for a buffer to be released from the compositor..."); + qCDebug(lcWaylandBackingstore, "QWaylandShmBackingStore: stalling waiting for a buffer to be released from the compositor..."); mDisplay->blockingReadEvents(); buffer = getBuffer(sizeWithMargins); From 8ce206f324082b3b41e8534c8a36673a26f5c25b Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Tue, 26 Jun 2018 18:45:30 +0100 Subject: [PATCH 0562/1507] Add XdgOutput client support XdgOutput is an extension of wl_output with the benefit of having the logical size of a screen as an explicit parameter, instead of clients inferring it from modeSize / scale. This is useful as it allows compositors to implement fractional scaling whilst clients can still fill the screen. In the future XdgOutputV2 will support a more useful name and ID that we can use. [ChangeLog][QPA plugin] Added support for xdg-output-unstable-v1 Change-Id: I2e1e64ad6cb497a1cbb7b7b170f28ac92231c2c4 Reviewed-by: Pier Luigi Fiorini Reviewed-by: Johan Helsing --- .../wayland/protocols/qt_attribution.json | 16 ++ .../protocols/xdg-output-unstable-v1.xml | 209 ++++++++++++++++++ src/plugins/platforms/wayland/client.pro | 1 + .../platforms/wayland/qwaylanddisplay.cpp | 5 + .../platforms/wayland/qwaylanddisplay_p.h | 4 + .../platforms/wayland/qwaylandscreen.cpp | 47 +++- .../platforms/wayland/qwaylandscreen_p.h | 15 +- 7 files changed, 290 insertions(+), 7 deletions(-) create mode 100644 src/3rdparty/wayland/protocols/xdg-output-unstable-v1.xml diff --git a/src/3rdparty/wayland/protocols/qt_attribution.json b/src/3rdparty/wayland/protocols/qt_attribution.json index d934622c957..6034508ba43 100644 --- a/src/3rdparty/wayland/protocols/qt_attribution.json +++ b/src/3rdparty/wayland/protocols/qt_attribution.json @@ -36,6 +36,22 @@ Copyright (c) 2013 BMW Car IT GmbH" }, + { + "Id": "wayland-xdg-output-protocol", + "Name": "Wayland XDG Output Protocol", + "QDocModule": "qtwaylandcompositor", + "QtUsage": "Used in the Qt Wayland platform plugin.", + "Files": "xdg-output-unstable-v1.xml", + "Description": "The XDG Output protocol is an extended way to describe output regions under Wayland", + "Homepage": "https://wayland.freedesktop.org", + "Version": "unstable v1, version 2", + "DownloadLocation": "https://cgit.freedesktop.org/wayland/wayland-protocols/plain/unstable/xdg-output/xdg-output-unstable-v1.xml?h=1.16", + "LicenseId": "MIT", + "License": "MIT License", + "LicenseFile": "MIT_LICENSE.txt", + "Copyright": "Copyright © 2017 Red Hat Inc." + }, + { "Id": "wayland-xdg-shell-protocol", "Name": "Wayland XDG Shell Protocol", diff --git a/src/3rdparty/wayland/protocols/xdg-output-unstable-v1.xml b/src/3rdparty/wayland/protocols/xdg-output-unstable-v1.xml new file mode 100644 index 00000000000..ccbfe1c9a95 --- /dev/null +++ b/src/3rdparty/wayland/protocols/xdg-output-unstable-v1.xml @@ -0,0 +1,209 @@ + + + + + Copyright © 2017 Red Hat Inc. + + 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. + + + + This protocol aims at describing outputs in a way which is more in line + with the concept of an output on desktop oriented systems. + + Some information are more specific to the concept of an output for + a desktop oriented system and may not make sense in other applications, + such as IVI systems for example. + + Typically, the global compositor space on a desktop system is made of + a contiguous or overlapping set of rectangular regions. + + Some of the information provided in this protocol might be identical + to their counterparts already available from wl_output, in which case + the information provided by this protocol should be preferred to their + equivalent in wl_output. The goal is to move the desktop specific + concepts (such as output location within the global compositor space, + the connector name and types, etc.) out of the core wl_output protocol. + + Warning! The protocol described in this file is experimental and + backward incompatible changes may be made. Backward compatible + changes may be added together with the corresponding interface + version bump. + Backward incompatible changes are done by bumping the version + number in the protocol and interface names and resetting the + interface version. Once the protocol is to be declared stable, + the 'z' prefix and the version number in the protocol and + interface names are removed and the interface version number is + reset. + + + + + A global factory interface for xdg_output objects. + + + + + Using this request a client can tell the server that it is not + going to use the xdg_output_manager object anymore. + + Any objects already created through this instance are not affected. + + + + + + This creates a new xdg_output object for the given wl_output. + + + + + + + + + An xdg_output describes part of the compositor geometry. + + This typically corresponds to a monitor that displays part of the + compositor space. + + + + + Using this request a client can tell the server that it is not + going to use the xdg_output object anymore. + + + + + + The position event describes the location of the wl_output within + the global compositor space. + + The logical_position event is sent after creating an xdg_output + (see xdg_output_manager.get_xdg_output) and whenever the location + of the output changes within the global compositor space. + + + + + + + + The logical_size event describes the size of the output in the + global compositor space. + + For example, a surface without any buffer scale, transformation + nor rotation set, with the size matching the logical_size will + have the same size as the corresponding output when displayed. + + Most regular Wayland clients should not pay attention to the + logical size and would rather rely on xdg_shell interfaces. + + Some clients such as Xwayland, however, need this to configure + their surfaces in the global compositor space as the compositor + may apply a different scale from what is advertised by the output + scaling property (to achieve fractional scaling, for example). + + For example, for a wl_output mode 3840×2160 and a scale factor 2: + + - A compositor not scaling the surface buffers will advertise a + logical size of 3840×2160, + + - A compositor automatically scaling the surface buffers will + advertise a logical size of 1920×1080, + + - A compositor using a fractional scale of 1.5 will advertise a + logical size to 2560×1620. + + For example, for a wl_output mode 1920×1080 and a 90 degree rotation, + the compositor will advertise a logical size of 1080x1920. + + The logical_size event is sent after creating an xdg_output + (see xdg_output_manager.get_xdg_output) and whenever the logical + size of the output changes, either as a result of a change in the + applied scale or because of a change in the corresponding output + mode(see wl_output.mode) or transform (see wl_output.transform). + + + + + + + + This event is sent after all other properties of an xdg_output + have been sent. + + This allows changes to the xdg_output properties to be seen as + atomic, even if they happen via multiple events. + + + + + + + + Many compositors will assign names to their outputs, show them to the + user, allow them to be configured by name, etc. The client may wish to + know this name as well to offer the user similar behaviors. + + The naming convention is compositor defined, but limited to + alphanumeric characters and dashes (-). Each name is unique among all + wl_output globals, but if a wl_output global is destroyed the same name + may be reused later. The names will also remain consistent across + sessions with the same hardware and software configuration. + + Examples of names include 'HDMI-A-1', 'WL-1', 'X11-1', etc. However, do + not assume that the name is a reflection of an underlying DRM + connector, X11 connection, etc. + + The name event is sent after creating an xdg_output (see + xdg_output_manager.get_xdg_output). This event is only sent once per + xdg_output, and the name does not change over the lifetime of the + wl_output global. + + + + + + + Many compositors can produce human-readable descriptions of their + outputs. The client may wish to know this description as well, to + communicate the user for various purposes. + + The description is a UTF-8 string with no convention defined for its + contents. Examples might include 'Foocorp 11" Display' or 'Virtual X11 + output via :1'. + + The description event is sent after creating an xdg_output (see + xdg_output_manager.get_xdg_output). This event is only sent once per + xdg_output, and the description does not change over the lifetime of + the wl_output global. The description is optional, and may not be sent + at all. + + + + + + diff --git a/src/plugins/platforms/wayland/client.pro b/src/plugins/platforms/wayland/client.pro index 593e8daf67f..45bbb976b4e 100644 --- a/src/plugins/platforms/wayland/client.pro +++ b/src/plugins/platforms/wayland/client.pro @@ -28,6 +28,7 @@ WAYLANDCLIENTSOURCES += \ ../extensions/qt-key-unstable-v1.xml \ ../extensions/qt-windowmanager.xml \ ../3rdparty/protocol/text-input-unstable-v2.xml \ + ../3rdparty/protocol/xdg-output-unstable-v1.xml \ WAYLANDCLIENTSOURCES_SYSTEM += \ ../3rdparty/protocol/wayland.xml \ diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index 03e4e3a2c0f..40ceafd963c 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -276,6 +276,11 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin // make a roundtrip here since we need to receive the events sent by // qt_hardware_integration before creating windows forceRoundTrip(); + } else if (interface == QLatin1String("zxdg_output_manager_v1")) { + mXdgOutputManager.reset(new QtWayland::zxdg_output_manager_v1(registry, id, 1)); + for (auto *screen : qAsConst(mScreens)) + screen->initXdgOutput(xdgOutputManager()); + forceRoundTrip(); } mGlobals.append(RegistryGlobal(id, interface, version, registry)); diff --git a/src/plugins/platforms/wayland/qwaylanddisplay_p.h b/src/plugins/platforms/wayland/qwaylanddisplay_p.h index 8570eba03e9..aee1ed45f7a 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay_p.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay_p.h @@ -76,6 +76,7 @@ class QPlatformScreen; namespace QtWayland { class qt_surface_extension; class zwp_text_input_manager_v2; + class zxdg_output_manager_v1; } namespace QtWaylandClient { @@ -143,6 +144,8 @@ public: QWaylandTouchExtension *touchExtension() const { return mTouchExtension.data(); } QtWayland::zwp_text_input_manager_v2 *textInputManager() const { return mTextInputManager.data(); } QWaylandHardwareIntegration *hardwareIntegration() const { return mHardwareIntegration.data(); } + QtWayland::zxdg_output_manager_v1 *xdgOutputManager() const { return mXdgOutputManager.data(); } + struct RegistryGlobal { uint32_t id; @@ -214,6 +217,7 @@ private: QScopedPointer mWindowManagerIntegration; QScopedPointer mTextInputManager; QScopedPointer mHardwareIntegration; + QScopedPointer mXdgOutputManager; QSocketNotifier *mReadNotifier = nullptr; int mFd; int mWritableNotificationFd; diff --git a/src/plugins/platforms/wayland/qwaylandscreen.cpp b/src/plugins/platforms/wayland/qwaylandscreen.cpp index 37fe5f3234b..892ef974b47 100644 --- a/src/plugins/platforms/wayland/qwaylandscreen.cpp +++ b/src/plugins/platforms/wayland/qwaylandscreen.cpp @@ -58,6 +58,23 @@ QWaylandScreen::QWaylandScreen(QWaylandDisplay *waylandDisplay, int version, uin , mWaylandDisplay(waylandDisplay) , mOutputName(QStringLiteral("Screen%1").arg(id)) { + if (auto *xdgOutputManager = waylandDisplay->xdgOutputManager()) + initXdgOutput(xdgOutputManager); +} + +QWaylandScreen::~QWaylandScreen() +{ + if (zxdg_output_v1::isInitialized()) + zxdg_output_v1::destroy(); +} + +void QWaylandScreen::initXdgOutput(QtWayland::zxdg_output_manager_v1 *xdgOutputManager) +{ + Q_ASSERT(xdgOutputManager); + if (zxdg_output_v1::isInitialized()) + return; + + zxdg_output_v1::init(xdgOutputManager->get_xdg_output(wl_output::object())); } QWaylandDisplay * QWaylandScreen::display() const @@ -77,9 +94,13 @@ QString QWaylandScreen::model() const QRect QWaylandScreen::geometry() const { - // Scale geometry for QScreen. This makes window and screen - // geometry be in the same coordinate system. - return QRect(mGeometry.topLeft(), mGeometry.size() / mScale); + if (zxdg_output_v1::isInitialized()) { + return mXdgGeometry; + } else { + // Scale geometry for QScreen. This makes window and screen + // geometry be in the same coordinate system. + return QRect(mGeometry.topLeft(), mGeometry.size() / mScale); + } } int QWaylandScreen::depth() const @@ -184,7 +205,6 @@ void QWaylandScreen::output_mode(uint32_t flags, int width, int height, int refr return; QSize size(width, height); - if (size != mGeometry.size()) mGeometry.setSize(size); @@ -247,8 +267,25 @@ void QWaylandScreen::output_done() QWindowSystemInterface::handleScreenOrientationChange(screen(), m_orientation); mTransform = -1; } - QWindowSystemInterface::handleScreenGeometryChange(screen(), geometry(), geometry()); QWindowSystemInterface::handleScreenRefreshRateChange(screen(), refreshRate()); + if (!zxdg_output_v1::isInitialized()) + QWindowSystemInterface::handleScreenGeometryChange(screen(), geometry(), geometry()); +} + + +void QWaylandScreen::zxdg_output_v1_logical_position(int32_t x, int32_t y) +{ + mXdgGeometry.moveTopLeft(QPoint(x, y)); +} + +void QWaylandScreen::zxdg_output_v1_logical_size(int32_t width, int32_t height) +{ + mXdgGeometry.setSize(QSize(width, height)); +} + +void QWaylandScreen::zxdg_output_v1_done() +{ + QWindowSystemInterface::handleScreenGeometryChange(screen(), geometry(), geometry()); } } diff --git a/src/plugins/platforms/wayland/qwaylandscreen_p.h b/src/plugins/platforms/wayland/qwaylandscreen_p.h index 39b72bc2443..6e4ed94f7a2 100644 --- a/src/plugins/platforms/wayland/qwaylandscreen_p.h +++ b/src/plugins/platforms/wayland/qwaylandscreen_p.h @@ -55,6 +55,8 @@ #include #include +#include + QT_BEGIN_NAMESPACE @@ -63,10 +65,13 @@ namespace QtWaylandClient { class QWaylandDisplay; class QWaylandCursor; -class Q_WAYLAND_CLIENT_EXPORT QWaylandScreen : public QPlatformScreen, QtWayland::wl_output +class Q_WAYLAND_CLIENT_EXPORT QWaylandScreen : public QPlatformScreen, QtWayland::wl_output, QtWayland::zxdg_output_v1 { public: QWaylandScreen(QWaylandDisplay *waylandDisplay, int version, uint32_t id); + ~QWaylandScreen() override; + + void initXdgOutput(QtWayland::zxdg_output_manager_v1 *xdgOutputManager); QWaylandDisplay *display() const; @@ -97,7 +102,7 @@ public: #endif uint32_t outputId() const { return m_outputId; } - ::wl_output *output() { return object(); } + ::wl_output *output() { return QtWayland::wl_output::object(); } static QWaylandScreen *waylandScreenFromWindow(QWindow *window); static QWaylandScreen *fromWlOutput(::wl_output *output); @@ -113,11 +118,17 @@ private: void output_scale(int32_t factor) override; void output_done() override; + // XdgOutput + void zxdg_output_v1_logical_position(int32_t x, int32_t y) override; + void zxdg_output_v1_logical_size(int32_t width, int32_t height) override; + void zxdg_output_v1_done() override; + int m_outputId; QWaylandDisplay *mWaylandDisplay = nullptr; QString mManufacturer; QString mModel; QRect mGeometry; + QRect mXdgGeometry; int mScale = 1; int mDepth = 32; int mRefreshRate = 60000; From 019427b9ae963c172a05defb21d7034db1ac76a5 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Tue, 19 Jun 2018 14:51:08 +0200 Subject: [PATCH 0563/1507] Don't commit same buffer multiple times In Qt we call flush() when we think the window might need to be updated. It is also possible to trigger a flush while painting. Two fixes: 1) If there are attempted flushes between beginPaint() and endPaint, queue them up, and do them in endPaint(). 2) Make sure we only commit the buffer once: after that the compositor owns the buffer, and it can repaint on its own. Change-Id: Ibf61068fa95760eb67dbc0b1d0534854114ea528 Reviewed-by: Johan Helsing --- .../platforms/wayland/qwaylandbuffer.cpp | 4 +++- .../platforms/wayland/qwaylandbuffer_p.h | 4 ++++ .../wayland/qwaylandshmbackingstore.cpp | 17 ++++++++++++----- .../wayland/qwaylandshmbackingstore_p.h | 2 ++ .../platforms/wayland/qwaylandwindow.cpp | 9 +++++++++ .../platforms/wayland/qwaylandwindow_p.h | 3 +++ 6 files changed, 33 insertions(+), 6 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandbuffer.cpp b/src/plugins/platforms/wayland/qwaylandbuffer.cpp index 9792cdd6136..12df9cc4fb2 100644 --- a/src/plugins/platforms/wayland/qwaylandbuffer.cpp +++ b/src/plugins/platforms/wayland/qwaylandbuffer.cpp @@ -64,7 +64,9 @@ void QWaylandBuffer::init(wl_buffer *buf) void QWaylandBuffer::release(void *data, wl_buffer *) { - static_cast(data)->mBusy = false; + QWaylandBuffer *self = static_cast(data); + self->mBusy = false; + self->mCommitted = false; } const wl_buffer_listener QWaylandBuffer::listener = { diff --git a/src/plugins/platforms/wayland/qwaylandbuffer_p.h b/src/plugins/platforms/wayland/qwaylandbuffer_p.h index 156ea9530b4..eea090f35cd 100644 --- a/src/plugins/platforms/wayland/qwaylandbuffer_p.h +++ b/src/plugins/platforms/wayland/qwaylandbuffer_p.h @@ -76,11 +76,15 @@ public: void setBusy() { mBusy = true; } bool busy() const { return mBusy; } + void setCommitted() { mCommitted = true; } + bool committed() const { return mCommitted; } + protected: struct wl_buffer *mBuffer = nullptr; private: bool mBusy = false; + bool mCommitted = false; static void release(void *data, wl_buffer *); static const wl_buffer_listener listener; diff --git a/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp b/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp index dde01357b76..ecb03c0d602 100644 --- a/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp +++ b/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp @@ -48,7 +48,6 @@ #include #include #include -#include #include #include @@ -68,10 +67,6 @@ QT_BEGIN_NAMESPACE namespace QtWaylandClient { -Q_DECLARE_LOGGING_CATEGORY(lcWaylandBackingstore) - -Q_LOGGING_CATEGORY(lcWaylandBackingstore, "qt.qpa.wayland.backingstore") - QWaylandShmBuffer::QWaylandShmBuffer(QWaylandDisplay *display, const QSize &size, QImage::Format format, int scale) { @@ -199,6 +194,8 @@ void QWaylandShmBackingStore::beginPaint(const QRegion ®ion) void QWaylandShmBackingStore::endPaint() { mPainting = false; + if (mPendingFlush) + flush(window(), mPendingRegion, QPoint()); waylandWindow()->setCanResize(true); } @@ -218,9 +215,19 @@ void QWaylandShmBackingStore::flush(QWindow *window, const QRegion ®ion, cons // called instead. The default implementation from QPlatformBackingStore is sufficient // however so no need to reimplement that. + Q_UNUSED(window); Q_UNUSED(offset); + if (mPainting) { + mPendingRegion |= region; + mPendingFlush = true; + return; + } + + mPendingFlush = false; + mPendingRegion = QRegion(); + if (windowDecoration() && windowDecoration()->isDirty()) updateDecorations(); diff --git a/src/plugins/platforms/wayland/qwaylandshmbackingstore_p.h b/src/plugins/platforms/wayland/qwaylandshmbackingstore_p.h index cb66288fcd9..88ecfc5ece1 100644 --- a/src/plugins/platforms/wayland/qwaylandshmbackingstore_p.h +++ b/src/plugins/platforms/wayland/qwaylandshmbackingstore_p.h @@ -120,6 +120,8 @@ private: QWaylandShmBuffer *mFrontBuffer = nullptr; QWaylandShmBuffer *mBackBuffer = nullptr; bool mPainting = false; + bool mPendingFlush = false; + QRegion mPendingRegion; QMutex mMutex; QSize mRequestedSize; diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 5d658f675d6..b88541ad850 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -75,6 +75,8 @@ QT_BEGIN_NAMESPACE namespace QtWaylandClient { +Q_LOGGING_CATEGORY(lcWaylandBackingstore, "qt.qpa.wayland.backingstore") + QWaylandWindow *QWaylandWindow::mMouseGrab = nullptr; QWaylandWindow::QWaylandWindow(QWindow *window) @@ -556,6 +558,7 @@ void QWaylandWindow::handleScreenRemoved(QScreen *qScreen) void QWaylandWindow::attach(QWaylandBuffer *buffer, int x, int y) { + Q_ASSERT(!buffer->committed()); if (mFrameCallback) { wl_callback_destroy(mFrameCallback); mFrameCallback = nullptr; @@ -586,12 +589,18 @@ void QWaylandWindow::damage(const QRect &rect) void QWaylandWindow::commit(QWaylandBuffer *buffer, const QRegion &damage) { + if (buffer->committed()) { + qCDebug(lcWaylandBackingstore) << "Buffer already committed, ignoring."; + return; + } if (!isInitialized()) return; attachOffset(buffer); for (const QRect &rect: damage) wl_surface::damage(rect.x(), rect.y(), rect.width(), rect.height()); + Q_ASSERT(!buffer->committed()); + buffer->setCommitted(); wl_surface::commit(); } diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index 3324bf70056..366548635a2 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -55,6 +55,7 @@ #include #include #include +#include #include @@ -67,6 +68,8 @@ QT_BEGIN_NAMESPACE namespace QtWaylandClient { +Q_DECLARE_LOGGING_CATEGORY(lcWaylandBackingstore) + class QWaylandDisplay; class QWaylandBuffer; class QWaylandShellSurface; From fc8cf4426399e320ac64ae117406ab00025e8c0f Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Fri, 3 Aug 2018 11:42:19 +0200 Subject: [PATCH 0564/1507] Client: Don't leak toplevels for xdg-shell-unstable-v6 Change-Id: Ifd6d4956eeed663e45219b428dfe562e7a82e626 Reviewed-by: David Edmundson Reviewed-by: Paul Olav Tvete --- src/plugins/platforms/wayland/qwaylandxdgshellv6.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandxdgshellv6.cpp b/src/plugins/platforms/wayland/qwaylandxdgshellv6.cpp index 5bcd3b25496..2c910d116f1 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgshellv6.cpp +++ b/src/plugins/platforms/wayland/qwaylandxdgshellv6.cpp @@ -136,8 +136,10 @@ QWaylandXdgSurfaceV6::QWaylandXdgSurfaceV6(QWaylandXdgShellV6 *shell, ::zxdg_sur QWaylandXdgSurfaceV6::~QWaylandXdgSurfaceV6() { - if (m_toplevel) - zxdg_toplevel_v6_destroy(m_toplevel->object()); + if (m_toplevel) { + delete m_toplevel; + m_toplevel = nullptr; + } if (m_popup) { delete m_popup; m_popup = nullptr; From 0f9595ae098281b7fae4bf01d7d978a780314c77 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Fri, 3 Aug 2018 11:30:33 +0200 Subject: [PATCH 0565/1507] Client: Fix memory leak for xdg_popup and xdg_toplevel Change-Id: I561e2af0cdc812ea4f499525b4af0a4ab7ad8182 Reviewed-by: Paul Olav Tvete --- .../shellintegration/xdg-shell/qwaylandxdgshell.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp index cab7dc08e84..eac33aa7ad7 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp @@ -190,10 +190,14 @@ QWaylandXdgSurface::QWaylandXdgSurface(QWaylandXdgShell *shell, ::xdg_surface *s QWaylandXdgSurface::~QWaylandXdgSurface() { - if (m_toplevel) - xdg_toplevel_destroy(m_toplevel->object()); - if (m_popup) - xdg_popup_destroy(m_popup->object()); + if (m_toplevel) { + delete m_toplevel; + m_toplevel = nullptr; + } + if (m_popup) { + delete m_popup; + m_popup = nullptr; + } destroy(); } From 83abc8bf6095090ea6574bb8eb441a992d27a667 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Mon, 6 Aug 2018 17:30:26 +0200 Subject: [PATCH 0566/1507] Convert qtwaylandscanner into a class Encapsulate what the scanner needs of functions and state into a class, Scanner, instead of keeping everything in the global namespace. Change-Id: Idd4b412bb7f709f24c86abe82b135c09b7985878 Reviewed-by: Paul Olav Tvete --- .../qtwaylandscanner/qtwaylandscanner.cpp | 321 +++++++++++------- 1 file changed, 192 insertions(+), 129 deletions(-) diff --git a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp index 1b884a42467..bdcbffa0d3c 100644 --- a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp +++ b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp @@ -41,92 +41,152 @@ #include #include -enum Option { - ClientHeader, - ServerHeader, - ClientCode, - ServerCode -} option; - -bool isServerSide() +class Scanner { - return option == ServerHeader || option == ServerCode; +public: + explicit Scanner() {} + ~Scanner() { delete m_xml; } + + bool parseArguments(int argc, char **argv); + void printUsage(); + bool process(); + void printErrors(); + +private: + struct WaylandEnumEntry { + QByteArray name; + QByteArray value; + QByteArray summary; + }; + + struct WaylandEnum { + QByteArray name; + + QList entries; + }; + + struct WaylandArgument { + QByteArray name; + QByteArray type; + QByteArray interface; + QByteArray summary; + bool allowNull; + }; + + struct WaylandEvent { + bool request; + QByteArray name; + QByteArray type; + QList arguments; + }; + + struct WaylandInterface { + QByteArray name; + int version; + + QList enums; + QList events; + QList requests; + }; + + bool isServerSide(); + bool parseOption(const char *str); + + QByteArray byteArrayValue(const QXmlStreamReader &xml, const char *name); + int intValue(const QXmlStreamReader &xml, const char *name, int defaultValue = 0); + bool boolValue(const QXmlStreamReader &xml, const char *name); + WaylandEvent readEvent(QXmlStreamReader &xml, bool request); + Scanner::WaylandEnum readEnum(QXmlStreamReader &xml); + Scanner::WaylandInterface readInterface(QXmlStreamReader &xml); + QByteArray waylandToCType(const QByteArray &waylandType, const QByteArray &interface); + QByteArray waylandToQtType(const QByteArray &waylandType, const QByteArray &interface, bool cStyleArray); + const Scanner::WaylandArgument *newIdArgument(const QList &arguments); + + void printEvent(const WaylandEvent &e, bool omitNames = false, bool withResource = false); + void printEventHandlerSignature(const WaylandEvent &e, const char *interfaceName, bool deepIndent = true); + void printEnums(const QList &enums); + + QByteArray stripInterfaceName(const QByteArray &name); + bool ignoreInterface(const QByteArray &name); + + enum Option { + ClientHeader, + ServerHeader, + ClientCode, + ServerCode + } m_option; + + QByteArray m_protocolName; + QByteArray m_protocolFilePath; + QByteArray m_scannerName; + QByteArray m_headerPath; + QByteArray m_prefix; + QXmlStreamReader *m_xml = nullptr; +}; + +bool Scanner::parseArguments(int argc, char **argv) +{ + QByteArray m_scannerName = argv[0]; + + if (argc <= 2 || !parseOption(argv[1])) + return false; + + m_protocolFilePath = QByteArray(argv[2]); + + if (argc >= 4) + m_headerPath = QByteArray(argv[3]); + if (argc == 5) + m_prefix = QByteArray(argv[4]); + + return true; } -QByteArray protocolName; +void Scanner::printUsage() +{ + fprintf(stderr, "Usage: %s [client-header|server-header|client-code|server-code] specfile [header-path] [prefix]\n", m_scannerName.constData()); +} -bool parseOption(const char *str, Option *option) +bool Scanner::isServerSide() +{ + return m_option == ServerHeader || m_option == ServerCode; +} + +bool Scanner::parseOption(const char *str) { if (str == QLatin1String("client-header")) - *option = ClientHeader; + m_option = ClientHeader; else if (str == QLatin1String("server-header")) - *option = ServerHeader; + m_option = ServerHeader; else if (str == QLatin1String("client-code")) - *option = ClientCode; + m_option = ClientCode; else if (str == QLatin1String("server-code")) - *option = ServerCode; + m_option = ServerCode; else return false; return true; } -struct WaylandEnumEntry { - QByteArray name; - QByteArray value; - QByteArray summary; -}; - -struct WaylandEnum { - QByteArray name; - - QList entries; -}; - -struct WaylandArgument { - QByteArray name; - QByteArray type; - QByteArray interface; - QByteArray summary; - bool allowNull; -}; - -struct WaylandEvent { - bool request; - QByteArray name; - QByteArray type; - QList arguments; -}; - -struct WaylandInterface { - QByteArray name; - int version; - - QList enums; - QList events; - QList requests; -}; - -QByteArray byteArrayValue(const QXmlStreamReader &xml, const char *name) +QByteArray Scanner::byteArrayValue(const QXmlStreamReader &xml, const char *name) { if (xml.attributes().hasAttribute(name)) return xml.attributes().value(name).toUtf8(); return QByteArray(); } -int intValue(const QXmlStreamReader &xml, const char *name, int defaultValue = 0) +int Scanner::intValue(const QXmlStreamReader &xml, const char *name, int defaultValue) { bool ok; int result = byteArrayValue(xml, name).toInt(&ok); return ok ? result : defaultValue; } -bool boolValue(const QXmlStreamReader &xml, const char *name) +bool Scanner::boolValue(const QXmlStreamReader &xml, const char *name) { return byteArrayValue(xml, name) == "true"; } -WaylandEvent readEvent(QXmlStreamReader &xml, bool request) +Scanner::WaylandEvent Scanner::readEvent(QXmlStreamReader &xml, bool request) { WaylandEvent event; event.request = request; @@ -148,7 +208,7 @@ WaylandEvent readEvent(QXmlStreamReader &xml, bool request) return event; } -WaylandEnum readEnum(QXmlStreamReader &xml) +Scanner::WaylandEnum Scanner::readEnum(QXmlStreamReader &xml) { WaylandEnum result; result.name = byteArrayValue(xml, "name"); @@ -168,7 +228,7 @@ WaylandEnum readEnum(QXmlStreamReader &xml) return result; } -WaylandInterface readInterface(QXmlStreamReader &xml) +Scanner::WaylandInterface Scanner::readInterface(QXmlStreamReader &xml) { WaylandInterface interface; interface.name = byteArrayValue(xml, "name"); @@ -188,7 +248,7 @@ WaylandInterface readInterface(QXmlStreamReader &xml) return interface; } -QByteArray waylandToCType(const QByteArray &waylandType, const QByteArray &interface) +QByteArray Scanner::waylandToCType(const QByteArray &waylandType, const QByteArray &interface) { if (waylandType == "string") return "const char *"; @@ -212,7 +272,7 @@ QByteArray waylandToCType(const QByteArray &waylandType, const QByteArray &inter return waylandType; } -QByteArray waylandToQtType(const QByteArray &waylandType, const QByteArray &interface, bool cStyleArray) +QByteArray Scanner::waylandToQtType(const QByteArray &waylandType, const QByteArray &interface, bool cStyleArray) { if (waylandType == "string") return "const QString &"; @@ -222,7 +282,7 @@ QByteArray waylandToQtType(const QByteArray &waylandType, const QByteArray &inte return waylandToCType(waylandType, interface); } -const WaylandArgument *newIdArgument(const QList &arguments) +const Scanner::WaylandArgument *Scanner::newIdArgument(const QList &arguments) { for (int i = 0; i < arguments.size(); ++i) { if (arguments.at(i).type == "new_id") @@ -231,7 +291,7 @@ const WaylandArgument *newIdArgument(const QList &arguments) return nullptr; } -void printEvent(const WaylandEvent &e, bool omitNames = false, bool withResource = false) +void Scanner::printEvent(const WaylandEvent &e, bool omitNames, bool withResource) { printf("%s(", e.name.constData()); bool needsComma = false; @@ -274,7 +334,7 @@ void printEvent(const WaylandEvent &e, bool omitNames = false, bool withResource printf(")"); } -void printEventHandlerSignature(const WaylandEvent &e, const char *interfaceName, bool deepIndent = true) +void Scanner::printEventHandlerSignature(const WaylandEvent &e, const char *interfaceName, bool deepIndent) { const char *indent = deepIndent ? " " : ""; printf("handle_%s(\n", e.name.constData()); @@ -299,7 +359,7 @@ void printEventHandlerSignature(const WaylandEvent &e, const char *interfaceName printf(")"); } -void printEnums(const QList &enums) +void Scanner::printEnums(const QList &enums) { for (int i = 0; i < enums.size(); ++i) { printf("\n"); @@ -318,66 +378,73 @@ void printEnums(const QList &enums) } } -QByteArray stripInterfaceName(const QByteArray &name, const QByteArray &prefix) +QByteArray Scanner::stripInterfaceName(const QByteArray &name) { - if (!prefix.isEmpty() && name.startsWith(prefix)) - return name.mid(prefix.size()); + if (!m_prefix.isEmpty() && name.startsWith(m_prefix)) + return name.mid(m_prefix.size()); if (name.startsWith("qt_") || name.startsWith("wl_")) return name.mid(3); return name; } -bool ignoreInterface(const QByteArray &name) +bool Scanner::ignoreInterface(const QByteArray &name) { return name == "wl_display" || (isServerSide() && name == "wl_registry"); } -void process(QXmlStreamReader &xml, const QByteArray &headerPath, const QByteArray &prefix) +bool Scanner::process() { - if (!xml.readNextStartElement()) - return; - - if (xml.name() != "protocol") { - xml.raiseError(QStringLiteral("The file is not a wayland protocol file.")); - return; + QFile file(m_protocolFilePath); + if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { + fprintf(stderr, "Unable to open file %s\n", m_protocolFilePath.constData()); + return false; } - protocolName = byteArrayValue(xml, "name"); + m_xml = new QXmlStreamReader(&file); + if (!m_xml->readNextStartElement()) + return false; - if (protocolName.isEmpty()) { - xml.raiseError(QStringLiteral("Missing protocol name.")); - return; + if (m_xml->name() != "protocol") { + m_xml->raiseError(QStringLiteral("The file is not a wayland protocol file.")); + return false; + } + + m_protocolName = byteArrayValue(*m_xml, "name"); + + if (m_protocolName.isEmpty()) { + m_xml->raiseError(QStringLiteral("Missing protocol name.")); + return false; } //We should convert - to _ so that the preprocessor wont generate code which will lead to unexpected behavior //However, the wayland-scanner doesn't do so we will do the same for now - //QByteArray preProcessorProtocolName = QByteArray(protocolName).replace('-', '_').toUpper(); - QByteArray preProcessorProtocolName = QByteArray(protocolName).toUpper(); + //QByteArray preProcessorProtocolName = QByteArray(m_protocolName).replace('-', '_').toUpper(); + QByteArray preProcessorProtocolName = QByteArray(m_protocolName).toUpper(); QList interfaces; - while (xml.readNextStartElement()) { - if (xml.name() == "interface") - interfaces << readInterface(xml); + while (m_xml->readNextStartElement()) { + if (m_xml->name() == "interface") + interfaces << readInterface(*m_xml); else - xml.skipCurrentElement(); + m_xml->skipCurrentElement(); } - if (xml.hasError()) - return; + if (m_xml->hasError()) + return false; - if (option == ServerHeader) { + if (m_option == ServerHeader) { QByteArray inclusionGuard = QByteArray("QT_WAYLAND_SERVER_") + preProcessorProtocolName.constData(); printf("#ifndef %s\n", inclusionGuard.constData()); printf("#define %s\n", inclusionGuard.constData()); printf("\n"); printf("#include \"wayland-server.h\"\n"); - if (headerPath.isEmpty()) - printf("#include \"wayland-%s-server-protocol.h\"\n", QByteArray(protocolName).replace('_', '-').constData()); + if (m_headerPath.isEmpty()) + printf("#include \"wayland-%s-server-protocol.h\"\n", QByteArray(m_protocolName).replace('_', '-').constData()); else - printf("#include <%s/wayland-%s-server-protocol.h>\n", headerPath.constData(), QByteArray(protocolName).replace('_', '-').constData()); + printf("#include <%s/wayland-%s-server-protocol.h>\n", m_headerPath.constData(), QByteArray(m_protocolName).replace('_', '-').constData()); printf("#include \n"); printf("#include \n"); printf("#include \n"); @@ -396,7 +463,7 @@ void process(QXmlStreamReader &xml, const QByteArray &headerPath, const QByteArr printf("QT_WARNING_DISABLE_GCC(\"-Wmissing-field-initializers\")\n"); printf("QT_WARNING_DISABLE_CLANG(\"-Wmissing-field-initializers\")\n"); QByteArray serverExport; - if (headerPath.size()) { + if (m_headerPath.size()) { serverExport = QByteArray("Q_WAYLAND_SERVER_") + preProcessorProtocolName + "_EXPORT"; printf("\n"); printf("#if !defined(%s)\n", serverExport.constData()); @@ -418,7 +485,7 @@ void process(QXmlStreamReader &xml, const QByteArray &headerPath, const QByteArr const char *interfaceName = interface.name.constData(); - QByteArray stripped = stripInterfaceName(interface.name, prefix); + QByteArray stripped = stripInterfaceName(interface.name); const char *interfaceNameStripped = stripped.constData(); printf(" class %s %s\n {\n", serverExport.constData(), interfaceName); @@ -547,11 +614,11 @@ void process(QXmlStreamReader &xml, const QByteArray &headerPath, const QByteArr printf("#endif\n"); } - if (option == ServerCode) { - if (headerPath.isEmpty()) - printf("#include \"qwayland-server-%s.h\"\n", QByteArray(protocolName).replace('_', '-').constData()); + if (m_option == ServerCode) { + if (m_headerPath.isEmpty()) + printf("#include \"qwayland-server-%s.h\"\n", QByteArray(m_protocolName).replace('_', '-').constData()); else - printf("#include <%s/qwayland-server-%s.h>\n", headerPath.constData(), QByteArray(protocolName).replace('_', '-').constData()); + printf("#include <%s/qwayland-server-%s.h>\n", m_headerPath.constData(), QByteArray(m_protocolName).replace('_', '-').constData()); printf("\n"); printf("QT_BEGIN_NAMESPACE\n"); printf("QT_WARNING_PUSH\n"); @@ -573,7 +640,7 @@ void process(QXmlStreamReader &xml, const QByteArray &headerPath, const QByteArr const char *interfaceName = interface.name.constData(); - QByteArray stripped = stripInterfaceName(interface.name, prefix); + QByteArray stripped = stripInterfaceName(interface.name); const char *interfaceNameStripped = stripped.constData(); printf(" %s::%s(struct ::wl_client *client, int id, int version)\n", interfaceName, interfaceName); @@ -860,15 +927,15 @@ void process(QXmlStreamReader &xml, const QByteArray &headerPath, const QByteArr printf("QT_END_NAMESPACE\n"); } - if (option == ClientHeader) { + if (m_option == ClientHeader) { QByteArray inclusionGuard = QByteArray("QT_WAYLAND_") + preProcessorProtocolName.constData(); printf("#ifndef %s\n", inclusionGuard.constData()); printf("#define %s\n", inclusionGuard.constData()); printf("\n"); - if (headerPath.isEmpty()) - printf("#include \"wayland-%s-client-protocol.h\"\n", QByteArray(protocolName).replace('_', '-').constData()); + if (m_headerPath.isEmpty()) + printf("#include \"wayland-%s-client-protocol.h\"\n", QByteArray(m_protocolName).replace('_', '-').constData()); else - printf("#include <%s/wayland-%s-client-protocol.h>\n", headerPath.constData(), QByteArray(protocolName).replace('_', '-').constData()); + printf("#include <%s/wayland-%s-client-protocol.h>\n", m_headerPath.constData(), QByteArray(m_protocolName).replace('_', '-').constData()); printf("#include \n"); printf("#include \n"); printf("\n"); @@ -878,7 +945,7 @@ void process(QXmlStreamReader &xml, const QByteArray &headerPath, const QByteArr QByteArray clientExport; - if (headerPath.size()) { + if (m_headerPath.size()) { clientExport = QByteArray("Q_WAYLAND_CLIENT_") + preProcessorProtocolName + "_EXPORT"; printf("\n"); printf("#if !defined(%s)\n", clientExport.constData()); @@ -899,7 +966,7 @@ void process(QXmlStreamReader &xml, const QByteArray &headerPath, const QByteArr const char *interfaceName = interface.name.constData(); - QByteArray stripped = stripInterfaceName(interface.name, prefix); + QByteArray stripped = stripInterfaceName(interface.name); const char *interfaceNameStripped = stripped.constData(); printf(" class %s %s\n {\n", clientExport.constData(), interfaceName); @@ -978,11 +1045,11 @@ void process(QXmlStreamReader &xml, const QByteArray &headerPath, const QByteArr printf("#endif\n"); } - if (option == ClientCode) { - if (headerPath.isEmpty()) - printf("#include \"qwayland-%s.h\"\n", QByteArray(protocolName).replace('_', '-').constData()); + if (m_option == ClientCode) { + if (m_headerPath.isEmpty()) + printf("#include \"qwayland-%s.h\"\n", QByteArray(m_protocolName).replace('_', '-').constData()); else - printf("#include <%s/qwayland-%s.h>\n", headerPath.constData(), QByteArray(protocolName).replace('_', '-').constData()); + printf("#include <%s/qwayland-%s.h>\n", m_headerPath.constData(), QByteArray(m_protocolName).replace('_', '-').constData()); printf("\n"); printf("QT_BEGIN_NAMESPACE\n"); printf("QT_WARNING_PUSH\n"); @@ -997,7 +1064,7 @@ void process(QXmlStreamReader &xml, const QByteArray &headerPath, const QByteArr const char *interfaceName = interface.name.constData(); - QByteArray stripped = stripInterfaceName(interface.name, prefix); + QByteArray stripped = stripInterfaceName(interface.name); const char *interfaceNameStripped = stripped.constData(); bool hasEvents = !interface.events.isEmpty(); @@ -1172,34 +1239,30 @@ void process(QXmlStreamReader &xml, const QByteArray &headerPath, const QByteArr printf("QT_WARNING_POP\n"); printf("QT_END_NAMESPACE\n"); } + + return true; +} + +void Scanner::printErrors() +{ + if (m_xml->hasError()) + fprintf(stderr, "XML error: %s\nLine %lld, column %lld\n", m_xml->errorString().toLocal8Bit().constData(), m_xml->lineNumber(), m_xml->columnNumber()); } int main(int argc, char **argv) { - if (argc <= 2 || !parseOption(argv[1], &option)) { - fprintf(stderr, "Usage: %s [client-header|server-header|client-code|server-code] specfile [header-path] [prefix]\n", argv[0]); - return 1; - } - QCoreApplication app(argc, argv); + Scanner scanner; - QByteArray headerPath; - if (argc >= 4) - headerPath = QByteArray(argv[3]); - QByteArray prefix; - if (argc == 5) - prefix = QByteArray(argv[4]); - QFile file(argv[2]); - if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { - fprintf(stderr, "Unable to open file %s\n", argv[2]); - return 1; + if (!scanner.parseArguments(argc, argv)) { + scanner.printUsage(); + return EXIT_FAILURE; } - QXmlStreamReader xml(&file); - process(xml, headerPath, prefix); - - if (xml.hasError()) { - fprintf(stderr, "XML error: %s\nLine %lld, column %lld\n", xml.errorString().toLocal8Bit().constData(), xml.lineNumber(), xml.columnNumber()); - return 1; + if (!scanner.process()) { + scanner.printErrors(); + return EXIT_FAILURE; } + + return EXIT_SUCCESS; } From ee24f1a145fffba1e35534f88c78a45fc908ee0f Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Thu, 9 Aug 2018 11:59:01 +0200 Subject: [PATCH 0567/1507] Client: Log configure states to logging category States are not visible in WAYLAND_DEBUG output since array values are not printed there. Logging the states to the Wayland QPA logging category gives us a convenient way of seeing what states are configured. Change-Id: If71c6df3180eba3f8efb08135a67b417940c3ffe Reviewed-by: Paul Olav Tvete --- .../shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp | 2 ++ .../plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp index 986deceb19a..f151d1eb696 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp @@ -115,6 +115,8 @@ void QWaylandXdgSurfaceV6::Toplevel::zxdg_toplevel_v6_configure(int32_t width, i break; } } + qCDebug(lcQpaWayland) << "Received zxdg_toplevel_v6.configure with" << m_pending.size + << "and" << m_pending.states; } void QWaylandXdgSurfaceV6::Toplevel::zxdg_toplevel_v6_close() diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp index eac33aa7ad7..12c77d80d86 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp @@ -115,6 +115,8 @@ void QWaylandXdgSurface::Toplevel::xdg_toplevel_configure(int32_t width, int32_t break; } } + qCDebug(lcQpaWayland) << "Received xdg_toplevel.configure with" << m_pending.size + << "and" << m_pending.states; } void QWaylandXdgSurface::Toplevel::xdg_toplevel_close() From 0848300f0b43868425c005a12b5153b37a485ec4 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Fri, 10 Aug 2018 11:54:54 +0200 Subject: [PATCH 0568/1507] Client decorations: Don't spam mouse leave events Previously, we would send one leave event each time the mouse was moved on the decorations. Change-Id: I57bd6e57261447db8a8c5ab45dc8f3fdfed33a49 Reviewed-by: Paul Olav Tvete --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 9378f9cebc7..df9e8437e37 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -837,8 +837,10 @@ void QWaylandWindow::handleMouseEventWithDecoration(QWaylandInputDevice *inputDe { if (mMousePressedInContentArea == Qt::NoButton && mWindowDecoration->handleMouse(inputDevice, e.local, e.global, e.buttons, e.modifiers)) { - if (mMouseEventsInContentArea) + if (mMouseEventsInContentArea) { QWindowSystemInterface::handleLeaveEvent(window()); + mMouseEventsInContentArea = false; + } return; } From b21ecf062a11506b0023933fd2151fdf069f60de Mon Sep 17 00:00:00 2001 From: Giulio Camuffo Date: Fri, 12 May 2017 18:08:20 +0200 Subject: [PATCH 0569/1507] Client: Return a fixed value for the logical screen DPI MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [ChangeLog][QPA plugin] Font and UI scaling is now based on the screen scale factor rather than the physical DPI. The logical DPI is set to 96 unless overridden by the the environment variable QT_WAYLAND_FORCE_DPI, which may be set to a specific DPI or to "physical" to get the old behavior. Change-Id: Ife417bf5537b0f6c9ecceffea46937951770b150 Reviewed-by: Morten Johan Sørvig --- src/plugins/platforms/wayland/qwaylandscreen.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandscreen.cpp b/src/plugins/platforms/wayland/qwaylandscreen.cpp index 892ef974b47..38d61f88c35 100644 --- a/src/plugins/platforms/wayland/qwaylandscreen.cpp +++ b/src/plugins/platforms/wayland/qwaylandscreen.cpp @@ -123,11 +123,15 @@ QSizeF QWaylandScreen::physicalSize() const QDpi QWaylandScreen::logicalDpi() const { - static int force_dpi = !qgetenv("QT_WAYLAND_FORCE_DPI").isEmpty() ? qgetenv("QT_WAYLAND_FORCE_DPI").toInt() : -1; - if (force_dpi > 0) - return QDpi(force_dpi, force_dpi); + static bool physicalDpi = qEnvironmentVariable("QT_WAYLAND_FORCE_DPI") == QStringLiteral("physical"); + if (physicalDpi) + return QPlatformScreen::logicalDpi(); - return QPlatformScreen::logicalDpi(); + static int forceDpi = qgetenv("QT_WAYLAND_FORCE_DPI").toInt(); + if (forceDpi) + return QDpi(forceDpi, forceDpi); + + return QDpi(96, 96); } QList QWaylandScreen::virtualSiblings() const From 87752e03d20a832212327d56606a8b776e7d0944 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Tue, 7 Aug 2018 13:14:28 +0200 Subject: [PATCH 0570/1507] Compositor: Use customized version of generated files for xdg-shell-v5 Checking in wayland-scanner and qtwaylandscanner generated files with renamed symbols to avoid conflicts with xdg-shell stable. Task-number: QTBUG-66784 Change-Id: I1b1a055d3be12bfa7d16e7bb7209e96497cbf28c Reviewed-by: Paul Olav Tvete --- src/3rdparty/wayland/protocols/qt_attribution.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/3rdparty/wayland/protocols/qt_attribution.json b/src/3rdparty/wayland/protocols/qt_attribution.json index 6034508ba43..0a795498993 100644 --- a/src/3rdparty/wayland/protocols/qt_attribution.json +++ b/src/3rdparty/wayland/protocols/qt_attribution.json @@ -57,7 +57,7 @@ Copyright (c) 2013 BMW Car IT GmbH" "Name": "Wayland XDG Shell Protocol", "QDocModule": "qtwaylandcompositor", "QtUsage": "Used in the Qt Wayland Compositor, and the Qt Wayland platform plugin.", - "Files": "xdg-shell-unstable-v5.xml xdg-shell-unstable-v6.xml xdg-shell.xml", + "Files": "xdg-shell-unstable-v5.xml xdg-shell-unstable-v6.xml xdg-shell.xml ../../compositor/extensions/pregenerated/3rdparty/qwayland-server-xdg-shell-unstable-v5.cpp ../../compositor/extensions/pregenerated/3rdparty/qwayland-server-xdg-shell-unstable-v5_p.h ../../compositor/extensions/pregenerated/3rdparty/wayland-xdg-shell-unstable-v5-protocol.c ../../compositor/extensions/pregenerated/3rdparty/wayland-xdg-shell-unstable-v5-server-protocol_p.h", "Description": "The XDG-Shell protocol is an extended way to manage surfaces under Wayland compositors.", "Homepage": "https://wayland.freedesktop.org", From c2f156e27bf8865dc12108e1aba7cc78bd0dba38 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Thu, 2 Aug 2018 15:41:52 +0200 Subject: [PATCH 0571/1507] Client: Implement xdg-decoration-unstable-v1 for SSD support [ChangeLog][QPA plugin] Added client-side support for the xdg-decoration-unstable-v1 Wayland extension. Qt clients will now let the compositor draw the window decorations if configured through this extension. Note: The env var QT_WAYLAND_DISABLE_WINDOWDECORATION is still supported, but works on a higher level, and for all shell integrations, while xdg-decoration only works with xdg-shell stable. Task-number: QTBUG-69746 Change-Id: I9dd0331bbd8d624c6be54ed23ee3b96446d5820d Reviewed-by: Pier Luigi Fiorini --- .../wayland/protocols/qt_attribution.json | 17 ++ .../protocols/xdg-decoration-unstable-v1.xml | 156 ++++++++++++++++++ .../xdg-shell/qwaylandxdgdecorationv1.cpp | 105 ++++++++++++ .../xdg-shell/qwaylandxdgdecorationv1_p.h | 97 +++++++++++ .../xdg-shell/qwaylandxdgshell.cpp | 53 +++++- .../xdg-shell/qwaylandxdgshell_p.h | 24 ++- .../xdg-shell/qwaylandxdgshellintegration.cpp | 3 +- .../shellintegration/xdg-shell/xdg-shell.pro | 3 + .../platforms/wayland/qwaylanddisplay.cpp | 7 + .../platforms/wayland/qwaylanddisplay_p.h | 1 + .../platforms/wayland/qwaylandintegration_p.h | 3 +- 11 files changed, 458 insertions(+), 11 deletions(-) create mode 100644 src/3rdparty/wayland/protocols/xdg-decoration-unstable-v1.xml create mode 100644 src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgdecorationv1.cpp create mode 100644 src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgdecorationv1_p.h diff --git a/src/3rdparty/wayland/protocols/qt_attribution.json b/src/3rdparty/wayland/protocols/qt_attribution.json index 0a795498993..ac6ba44ce5d 100644 --- a/src/3rdparty/wayland/protocols/qt_attribution.json +++ b/src/3rdparty/wayland/protocols/qt_attribution.json @@ -36,6 +36,23 @@ Copyright (c) 2013 BMW Car IT GmbH" }, + { + "Id": "wayland-xdg-decoration-protocol", + "Name": "Wayland xdg-decoration Protocol", + "QDocModule": "qtwaylandcompositor", + "QtUsage": "Used in the Qt Wayland platform plugin.", + "Files": "xdg-decoration-unstable-v1.xml", + + "Description": "The xdg-decoration protocol allows a compositor to announce support for server-side decorations.", + "Homepage": "https://wayland.freedesktop.org", + "Version": "unstable v1, version 1", + "DownloadLocation": "https://cgit.freedesktop.org/wayland/wayland-protocols/plain/unstable/xdg-decoration/xdg-decoration-unstable-v1.xml?h=1.16", + "LicenseId": "MIT", + "License": "MIT License", + "LicenseFile": "MIT_LICENSE.txt", + "Copyright": "Copyright © 2018 Simon Ser" + }, + { "Id": "wayland-xdg-output-protocol", "Name": "Wayland XDG Output Protocol", diff --git a/src/3rdparty/wayland/protocols/xdg-decoration-unstable-v1.xml b/src/3rdparty/wayland/protocols/xdg-decoration-unstable-v1.xml new file mode 100644 index 00000000000..378e8ff4bbf --- /dev/null +++ b/src/3rdparty/wayland/protocols/xdg-decoration-unstable-v1.xml @@ -0,0 +1,156 @@ + + + + Copyright © 2018 Simon Ser + + 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. + + + + + This interface allows a compositor to announce support for server-side + decorations. + + A window decoration is a set of window controls as deemed appropriate by + the party managing them, such as user interface components used to move, + resize and change a window's state. + + A client can use this protocol to request being decorated by a supporting + compositor. + + If compositor and client do not negotiate the use of a server-side + decoration using this protocol, clients continue to self-decorate as they + see fit. + + Warning! The protocol described in this file is experimental and + backward incompatible changes may be made. Backward compatible changes + may be added together with the corresponding interface version bump. + Backward incompatible changes are done by bumping the version number in + the protocol and interface names and resetting the interface version. + Once the protocol is to be declared stable, the 'z' prefix and the + version number in the protocol and interface names are removed and the + interface version number is reset. + + + + + Destroy the decoration manager. This doesn't destroy objects created + with the manager. + + + + + + Create a new decoration object associated with the given toplevel. + + Creating an xdg_toplevel_decoration from an xdg_toplevel which has a + buffer attached or committed is a client error, and any attempts by a + client to attach or manipulate a buffer prior to the first + xdg_toplevel_decoration.configure event must also be treated as + errors. + + + + + + + + + The decoration object allows the compositor to toggle server-side window + decorations for a toplevel surface. The client can request to switch to + another mode. + + The xdg_toplevel_decoration object must be destroyed before its + xdg_toplevel. + + + + + + + + + + + Switch back to a mode without any server-side decorations at the next + commit. + + + + + + These values describe window decoration modes. + + + + + + + + Set the toplevel surface decoration mode. This informs the compositor + that the client prefers the provided decoration mode. + + After requesting a decoration mode, the compositor will respond by + emitting a xdg_surface.configure event. The client should then update + its content, drawing it without decorations if the received mode is + server-side decorations. The client must also acknowledge the configure + when committing the new content (see xdg_surface.ack_configure). + + The compositor can decide not to use the client's mode and enforce a + different mode instead. + + Clients whose decoration mode depend on the xdg_toplevel state may send + a set_mode request in response to a xdg_surface.configure event and wait + for the next xdg_surface.configure event to prevent unwanted state. + Such clients are responsible for preventing configure loops and must + make sure not to send multiple successive set_mode requests with the + same decoration mode. + + + + + + + Unset the toplevel surface decoration mode. This informs the compositor + that the client doesn't prefer a particular decoration mode. + + This request has the same semantics as set_mode. + + + + + + The configure event asks the client to change its decoration mode. The + configured state should not be applied immediately. Clients must send an + ack_configure in response to this event. See xdg_surface.configure and + xdg_surface.ack_configure for details. + + A configure event can be sent at any time. The specified mode must be + obeyed by the client. + + + + + diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgdecorationv1.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgdecorationv1.cpp new file mode 100644 index 00000000000..345ff32ad90 --- /dev/null +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgdecorationv1.cpp @@ -0,0 +1,105 @@ +/**************************************************************************** +** +** Copyright (C) 2018 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the config.tests of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qwaylandxdgdecorationv1_p.h" +#include "qwaylandxdgshell_p.h" + +QT_BEGIN_NAMESPACE + +namespace QtWaylandClient { + +QWaylandXdgDecorationManagerV1::QWaylandXdgDecorationManagerV1(wl_registry *registry, uint32_t id, uint32_t availableVersion) + : QtWayland::zxdg_decoration_manager_v1(registry, id, qMin(availableVersion, 1u)) +{ +} + +QWaylandXdgDecorationManagerV1::~QWaylandXdgDecorationManagerV1() +{ + Q_ASSERT(isInitialized()); + destroy(); +} + +QWaylandXdgToplevelDecorationV1 *QWaylandXdgDecorationManagerV1::createToplevelDecoration(::xdg_toplevel *toplevel) +{ + Q_ASSERT(toplevel); + return new QWaylandXdgToplevelDecorationV1(get_toplevel_decoration(toplevel)); +} + +QWaylandXdgToplevelDecorationV1::QWaylandXdgToplevelDecorationV1(::zxdg_toplevel_decoration_v1 *decoration) + : QtWayland::zxdg_toplevel_decoration_v1(decoration) +{ +} + +QWaylandXdgToplevelDecorationV1::~QWaylandXdgToplevelDecorationV1() +{ + Q_ASSERT(isInitialized()); + destroy(); +} + +void QWaylandXdgToplevelDecorationV1::requestMode(QtWayland::zxdg_toplevel_decoration_v1::mode mode) +{ + // According to the spec the client is responsible for not requesting a mode repeatedly. + if (m_modeSet && m_requested == mode) + return; + + set_mode(mode); + m_requested = mode; + m_modeSet = true; +} + +void QWaylandXdgToplevelDecorationV1::unsetMode() +{ + unset_mode(); + m_modeSet = false; + m_requested = mode_client_side; +} + +QWaylandXdgToplevelDecorationV1::mode QWaylandXdgToplevelDecorationV1::pending() const +{ + return m_pending; +} + +void QtWaylandClient::QWaylandXdgToplevelDecorationV1::zxdg_toplevel_decoration_v1_configure(uint32_t mode) +{ + m_pending = zxdg_toplevel_decoration_v1::mode(mode); +} + +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgdecorationv1_p.h b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgdecorationv1_p.h new file mode 100644 index 00000000000..d6d8ce94e45 --- /dev/null +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgdecorationv1_p.h @@ -0,0 +1,97 @@ +/**************************************************************************** +** +** Copyright (C) 2018 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the config.tests of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWAYLANDXDGDECORATIONV1_P_H +#define QWAYLANDXDGDECORATIONV1_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include "qwayland-xdg-decoration-unstable-v1.h" + +#include + +QT_BEGIN_NAMESPACE + +class QWindow; + +namespace QtWaylandClient { + +class QWaylandXdgToplevel; +class QWaylandXdgToplevelDecorationV1; + +class Q_WAYLAND_CLIENT_EXPORT QWaylandXdgDecorationManagerV1 : public QtWayland::zxdg_decoration_manager_v1 +{ +public: + QWaylandXdgDecorationManagerV1(struct ::wl_registry *registry, uint32_t id, uint32_t availableVersion); + ~QWaylandXdgDecorationManagerV1() override; + QWaylandXdgToplevelDecorationV1 *createToplevelDecoration(::xdg_toplevel *toplevel); +}; + +class Q_WAYLAND_CLIENT_EXPORT QWaylandXdgToplevelDecorationV1 : public QtWayland::zxdg_toplevel_decoration_v1 +{ +public: + QWaylandXdgToplevelDecorationV1(::zxdg_toplevel_decoration_v1 *decoration); + ~QWaylandXdgToplevelDecorationV1() override; + void requestMode(mode mode); + void unsetMode(); + mode pending() const; + +protected: + void zxdg_toplevel_decoration_v1_configure(uint32_t mode) override; + +private: + mode m_pending = mode_client_side; + mode m_requested = mode_client_side; + bool m_modeSet = false; +}; + +QT_END_NAMESPACE + +} + +#endif // QWAYLANDXDGDECORATIONV1_P_H diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp index 12c77d80d86..7dabd96f2cc 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp @@ -54,7 +54,12 @@ QWaylandXdgSurface::Toplevel::Toplevel(QWaylandXdgSurface *xdgSurface) : QtWayland::xdg_toplevel(xdgSurface->get_toplevel()) , m_xdgSurface(xdgSurface) { - requestWindowStates(xdgSurface->window()->window()->windowStates()); + if (auto *decorationManager = m_xdgSurface->m_shell->decorationManager()) + m_decoration = decorationManager->createToplevelDecoration(object()); + + QWindow *window = xdgSurface->window()->window(); + requestWindowStates(window->windowStates()); + requestWindowFlags(window->flags()); } QWaylandXdgSurface::Toplevel::~Toplevel() @@ -63,6 +68,11 @@ QWaylandXdgSurface::Toplevel::~Toplevel() QWaylandWindow *window = m_xdgSurface->window(); window->display()->handleWindowDeactivated(window); } + + // The protocol spec requires that the decoration object is deleted before xdg_toplevel. + delete m_decoration; + m_decoration = nullptr; + if (isInitialized()) destroy(); } @@ -91,6 +101,14 @@ void QWaylandXdgSurface::Toplevel::applyConfigure() m_applied = m_pending; } +bool QWaylandXdgSurface::Toplevel::wantsDecorations() +{ + if (m_decoration && m_decoration->pending() == QWaylandXdgToplevelDecorationV1::mode_server_side) + return false; + + return !(m_pending.states & Qt::WindowFullScreen); +} + void QWaylandXdgSurface::Toplevel::xdg_toplevel_configure(int32_t width, int32_t height, wl_array *states) { m_pending.size = QSize(width, height); @@ -124,6 +142,16 @@ void QWaylandXdgSurface::Toplevel::xdg_toplevel_close() m_xdgSurface->m_window->window()->close(); } +void QWaylandXdgSurface::Toplevel::requestWindowFlags(Qt::WindowFlags flags) +{ + if (m_decoration) { + if (flags & Qt::FramelessWindowHint) + m_decoration->requestMode(QWaylandXdgToplevelDecorationV1::mode_client_side); + else + m_decoration->unsetMode(); + } +} + void QWaylandXdgSurface::Toplevel::requestWindowStates(Qt::WindowStates states) { // Re-send what's different from the applied state @@ -237,6 +265,12 @@ void QWaylandXdgSurface::setAppId(const QString &appId) m_toplevel->set_app_id(appId); } +void QWaylandXdgSurface::setWindowFlags(Qt::WindowFlags flags) +{ + if (m_toplevel) + m_toplevel->requestWindowFlags(flags); +} + bool QWaylandXdgSurface::handleExpose(const QRegion ®ion) { if (!m_configured && !region.isEmpty()) { @@ -261,7 +295,7 @@ void QWaylandXdgSurface::applyConfigure() bool QWaylandXdgSurface::wantsDecorations() const { - return m_toplevel && !(m_toplevel->m_pending.states & Qt::WindowFullScreen); + return m_toplevel && m_toplevel->wantsDecorations(); } void QWaylandXdgSurface::requestWindowStates(Qt::WindowStates states) @@ -313,13 +347,16 @@ void QWaylandXdgSurface::xdg_surface_configure(uint32_t serial) } } -QWaylandXdgShell::QWaylandXdgShell(struct ::wl_registry *registry, uint32_t id, uint32_t availableVersion) - : QtWayland::xdg_wm_base(registry, id, qMin(availableVersion, 1u)) +QWaylandXdgShell::QWaylandXdgShell(QWaylandDisplay *display, uint32_t id, uint32_t availableVersion) + : QtWayland::xdg_wm_base(display->wl_registry(), id, qMin(availableVersion, 1u)) + , m_display(display) { + display->addRegistryListener(&QWaylandXdgShell::handleRegistryGlobal, this); } QWaylandXdgShell::~QWaylandXdgShell() { + m_display->removeListener(&QWaylandXdgShell::handleRegistryGlobal, this); destroy(); } @@ -333,6 +370,14 @@ void QWaylandXdgShell::xdg_wm_base_ping(uint32_t serial) pong(serial); } +void QWaylandXdgShell::handleRegistryGlobal(void *data, wl_registry *registry, uint id, + const QString &interface, uint version) +{ + QWaylandXdgShell *xdgShell = static_cast(data); + if (interface == QLatin1String(QWaylandXdgDecorationManagerV1::interface()->name)) + xdgShell->m_xdgDecorationManager.reset(new QWaylandXdgDecorationManagerV1(registry, id, version)); +} + } QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h index 7fb85131585..37a4a8a4c71 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h @@ -54,6 +54,8 @@ #include "qwayland-xdg-shell.h" +#include "qwaylandxdgdecorationv1_p.h" + #include #include @@ -68,6 +70,7 @@ class QWindow; namespace QtWaylandClient { +class QWaylandDisplay; class QWaylandWindow; class QWaylandInputDevice; class QWaylandXdgShell; @@ -84,6 +87,7 @@ public: bool move(QWaylandInputDevice *inputDevice) override; void setTitle(const QString &title) override; void setAppId(const QString &appId) override; + void setWindowFlags(Qt::WindowFlags flags) override; bool isExposed() const override { return m_configured; } bool handleExpose(const QRegion &) override; @@ -103,10 +107,12 @@ private: ~Toplevel() override; void applyConfigure(); + bool wantsDecorations(); void xdg_toplevel_configure(int32_t width, int32_t height, wl_array *states) override; void xdg_toplevel_close() override; + void requestWindowFlags(Qt::WindowFlags flags); void requestWindowStates(Qt::WindowStates states); struct { QSize size = {0, 0}; @@ -115,6 +121,7 @@ private: QSize m_normalSize; QWaylandXdgSurface *m_xdgSurface = nullptr; + QWaylandXdgToplevelDecorationV1 *m_decoration = nullptr; }; class Popup : public QtWayland::xdg_popup { @@ -142,14 +149,21 @@ private: class Q_WAYLAND_CLIENT_EXPORT QWaylandXdgShell : public QtWayland::xdg_wm_base { public: - QWaylandXdgShell(struct ::wl_registry *registry, uint32_t id, uint32_t availableVersion); - - QWaylandXdgSurface *getXdgSurface(QWaylandWindow *window); - + QWaylandXdgShell(QWaylandDisplay *display, uint32_t id, uint32_t availableVersion); ~QWaylandXdgShell() override; -private: + QWaylandXdgDecorationManagerV1 *decorationManager() { return m_xdgDecorationManager.data(); } + QWaylandXdgSurface *getXdgSurface(QWaylandWindow *window); + +protected: void xdg_wm_base_ping(uint32_t serial) override; + +private: + static void handleRegistryGlobal(void *data, ::wl_registry *registry, uint id, + const QString &interface, uint version); + + QWaylandDisplay *m_display = nullptr; + QScopedPointer m_xdgDecorationManager; }; QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshellintegration.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshellintegration.cpp index 54d5b55ed6b..8769d971667 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshellintegration.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshellintegration.cpp @@ -38,6 +38,7 @@ ****************************************************************************/ #include "qwaylandxdgshellintegration_p.h" +#include "qwaylandxdgdecorationv1_p.h" #include #include @@ -50,7 +51,7 @@ bool QWaylandXdgShellIntegration::initialize(QWaylandDisplay *display) { for (QWaylandDisplay::RegistryGlobal global : display->globals()) { if (global.interface == QLatin1String("xdg_wm_base")) { - m_xdgShell.reset(new QWaylandXdgShell(display->wl_registry(), global.id, global.version)); + m_xdgShell.reset(new QWaylandXdgShell(display, global.id, global.version)); break; } } diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/xdg-shell.pro b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/xdg-shell.pro index 1fabf2c64d4..2b1191af03a 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/xdg-shell.pro +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/xdg-shell.pro @@ -6,14 +6,17 @@ qtConfig(xkbcommon-evdev): \ QMAKE_USE_PRIVATE += xkbcommon_evdev WAYLANDCLIENTSOURCES += \ + ../../../3rdparty/protocol/xdg-decoration-unstable-v1.xml \ ../../../3rdparty/protocol/xdg-shell.xml HEADERS += \ + qwaylandxdgdecorationv1_p.h \ qwaylandxdgshell_p.h \ qwaylandxdgshellintegration_p.h \ SOURCES += \ main.cpp \ + qwaylandxdgdecorationv1.cpp \ qwaylandxdgshell.cpp \ qwaylandxdgshellintegration.cpp \ diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index 40ceafd963c..5e67cd3a693 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -326,6 +326,13 @@ void QWaylandDisplay::addRegistryListener(RegistryListener listener, void *data) (*l.listener)(l.data, mGlobals[i].registry, mGlobals[i].id, mGlobals[i].interface, mGlobals[i].version); } +void QWaylandDisplay::removeListener(RegistryListener listener, void *data) +{ + std::remove_if(mRegistryListeners.begin(), mRegistryListeners.end(), [=](Listener l){ + return (l.listener == listener && l.data == data); + }); +} + uint32_t QWaylandDisplay::currentTimeMillisec() { //### we throw away the time information diff --git a/src/plugins/platforms/wayland/qwaylanddisplay_p.h b/src/plugins/platforms/wayland/qwaylanddisplay_p.h index aee1ed45f7a..8839bbe4cc0 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay_p.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay_p.h @@ -161,6 +161,7 @@ public: /* wl_registry_add_listener does not add but rather sets a listener, so this function is used * to enable many listeners at once. */ void addRegistryListener(RegistryListener listener, void *data); + void removeListener(RegistryListener listener, void *data); QWaylandShm *shm() const { return mShm.data(); } diff --git a/src/plugins/platforms/wayland/qwaylandintegration_p.h b/src/plugins/platforms/wayland/qwaylandintegration_p.h index 8c34e7198a8..a5a3d7b6956 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration_p.h +++ b/src/plugins/platforms/wayland/qwaylandintegration_p.h @@ -117,7 +117,8 @@ public: virtual QWaylandShellIntegration *shellIntegration() const; private: - // NOTE: mDisplay *must* be destructed after mDrag and mClientBufferIntegration. + // NOTE: mDisplay *must* be destructed after mDrag and mClientBufferIntegration + // and mShellIntegration. // Do not move this definition into the private section at the bottom. QScopedPointer mDisplay; From e581d7dda49ac9838303da45acd7667db67940aa Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Thu, 16 Aug 2018 13:49:16 +0200 Subject: [PATCH 0572/1507] Client: Clear entered screens when resetting window Previously, windows that were hidden and shown again would have the old list of entered screens. Aside from occasionally getting the current screen wrong, this also polluted the log with bogus warnings about unexpected enter events. This problem could be seen quite easily by opening, closing and opening a menu. [ChangeLog][QPA plugin] Fixed a bug where a window that was hidden and then shown on different screen would still think it was on the first screen. Change-Id: I1b27433ea6607a218384d814ae4c16b9c4395948 Reviewed-by: Paul Olav Tvete --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index b88541ad850..7149a2adb01 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -247,6 +247,7 @@ void QWaylandWindow::reset(bool sendDestroyEvent) mSubSurfaceWindow = nullptr; if (isInitialized()) destroy(); + mScreens.clear(); if (mFrameCallback) { wl_callback_destroy(mFrameCallback); From 1d51503daead2e09cc2526a0114bedd4669c1d3f Mon Sep 17 00:00:00 2001 From: Robin Burchell Date: Sun, 30 Jul 2017 21:50:41 +0200 Subject: [PATCH 0573/1507] Upgrade wayland.xml to version 1.10.0 Change-Id: I85b58ca9d14a1d37959475b05e0be8c9c8721186 Reviewed-by: Paul Olav Tvete --- .../wayland/protocols/qt_attribution.json | 4 +- src/3rdparty/wayland/protocols/wayland.xml | 741 ++++++++++++++++-- 2 files changed, 661 insertions(+), 84 deletions(-) diff --git a/src/3rdparty/wayland/protocols/qt_attribution.json b/src/3rdparty/wayland/protocols/qt_attribution.json index ac6ba44ce5d..bf5851f84ca 100644 --- a/src/3rdparty/wayland/protocols/qt_attribution.json +++ b/src/3rdparty/wayland/protocols/qt_attribution.json @@ -8,8 +8,8 @@ "Description": "Wayland is a protocol for a compositor to talk to its clients.", "Homepage": "https://wayland.freedesktop.org", - "Version": "1.6.1", - "DownloadLocation": "https://cgit.freedesktop.org/wayland/wayland/tag/?id=1.6.1", + "Version": "1.10.0", + "DownloadLocation": "https://cgit.freedesktop.org/wayland/wayland/tag/?id=1.10.0", "LicenseId": "HPND", "License": "HPND License", "LicenseFile": "HPND_LICENSE.txt", diff --git a/src/3rdparty/wayland/protocols/wayland.xml b/src/3rdparty/wayland/protocols/wayland.xml index bb457bcf74f..8739cd319c0 100644 --- a/src/3rdparty/wayland/protocols/wayland.xml +++ b/src/3rdparty/wayland/protocols/wayland.xml @@ -6,26 +6,26 @@ Copyright © 2010-2011 Intel Corporation Copyright © 2012-2013 Collabora, Ltd. - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that copyright notice and this permission - notice appear in supporting documentation, and that the name of - the copyright holders not be used in advertising or publicity - pertaining to distribution of the software without specific, - written prior permission. The copyright holders make no - representations about the suitability of this software for any - purpose. It is provided "as is" without express or implied - warranty. + 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 COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS - SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND - FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY - SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN - AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, - ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF - THIS SOFTWARE. + 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. @@ -176,7 +176,7 @@ - + A compositor. This object is a singleton global. The compositor is in charge of combining the contents of multiple @@ -367,7 +367,7 @@ can be used for buffers. Known formats include argb8888 and xrgb8888. - + @@ -408,7 +408,7 @@ - + A wl_data_offer represents a piece of data offered for transfer by another client (the source client). It is used by the @@ -418,12 +418,33 @@ data directly from the source client. + + + + + + + Indicate that the client can accept the given mime type, or NULL for not accepted. - Used for feedback during drag-and-drop. + For objects of version 2 or older, this request is used by the + client to give feedback whether the client can receive the given + mime type, or NULL if none is accepted; the feedback does not + determine whether the drag-and-drop operation succeeds or not. + + For objects of version 3 or newer, this request determines the + final result of the drag-and-drop operation. If the end result + is that no mime types were accepted, the drag-and-drop operation + will be cancelled and the corresponding drag source will receive + wl_data_source.cancelled. Clients may still use this event in + conjunction with wl_data_source.action for feedback. @@ -440,8 +461,13 @@ file descriptor. The receiving client reads from the read end of the pipe until - EOF and the closes its end, at which point the transfer is + EOF and then closes its end, at which point the transfer is complete. + + This request may happen multiple times for different mimetypes, + both before and after wl_data_device.drop. Drag-and-drop destination + clients may preemptively fetch data or examine it more closely to + determine acceptance. @@ -461,9 +487,115 @@ + + + + + + Notifies the compositor that the drag destination successfully + finished the drag-and-drop operation. + + Upon receiving this request, the compositor will emit + wl_data_source.dnd_finished on the drag source client. + + It is a client error to perform other requests than + wl_data_offer.destroy after this one. It is also an error to perform + this request after a NULL mime type has been set in + wl_data_offer.accept or no action was received through + wl_data_offer.action. + + + + + + Sets the actions that the destination side client supports for + this operation. This request may trigger the emission of + wl_data_source.action and wl_data_offer.action events if the compositor + need to change the selected action. + + This request can be called multiple times throughout the + drag-and-drop operation, typically in response to wl_data_device.enter + or wl_data_device.motion events. + + This request determines the final result of the drag-and-drop + operation. If the end result is that no action is accepted, + the drag source will receive wl_drag_source.cancelled. + + The dnd_actions argument must contain only values expressed in the + wl_data_device_manager.dnd_actions enum, and the preferred_action + argument must only contain one of those values set, otherwise it + will result in a protocol error. + + While managing an "ask" action, the destination drag-and-drop client + may perform further wl_data_offer.receive requests, and is expected + to perform one last wl_data_offer.set_actions request with a preferred + action other than "ask" (and optionally wl_data_offer.accept) before + requesting wl_data_offer.finish, in order to convey the action selected + by the user. If the preferred action is not in the + wl_data_offer.source_actions mask, an error will be raised. + + If the "ask" action is dismissed (e.g. user cancellation), the client + is expected to perform wl_data_offer.destroy right away. + + This request can only be made on drag-and-drop offers, a protocol error + will be raised otherwise. + + + + + + + + This event indicates the actions offered by the data source. It + will be sent right after wl_data_device.enter, or anytime the source + side changes its offered actions through wl_data_source.set_actions. + + + + + + + This event indicates the action selected by the compositor after + matching the source/destination side actions. Only one action (or + none) will be offered here. + + This event can be emitted multiple times during the drag-and-drop + operation in response to destination side action changes through + wl_data_offer.set_actions. + + This event will no longer be emitted after wl_data_device.drop + happened on the drag-and-drop destination, the client must + honor the last action received, or the last preferred one set + through wl_data_offer.set_actions when handling an "ask" action. + + Compositors may also change the selected action on the fly, mainly + in response to keyboard modifier changes during the drag-and-drop + operation. + + The most recent action received is always the valid one. Prior to + receiving wl_data_device.drop, the chosen action may change (e.g. + due to keyboard modifiers being pressed). At the time of receiving + wl_data_device.drop the drag-and-drop destination must honor the + last action received. + + Action changes may still happen after wl_data_device.drop, + especially on "ask" actions, where the drag-and-drop destination + may choose another action afterwards. Action changes happening + at this stage are always the result of inter-client negotiation, the + compositor shall no longer be able to induce a different action. + + Upon "ask" actions, it is expected that the drag-and-drop destination + may potentially choose different a different action and/or mime type, + based on wl_data_offer.source_actions and finally chosen by the + user (e.g. popping up a menu with the available options). The + final wl_data_offer.set_actions and wl_data_offer.accept requests + must happen before the call to wl_data_offer.finish. + + + - + The wl_data_source object is the source side of a wl_data_offer. It is created by the source client in a data transfer and @@ -471,6 +603,13 @@ to requests to transfer the data. + + + + + This request adds a mime type to the set of mime types @@ -510,14 +649,108 @@ - This data source has been replaced by another data source. + This data source is no longer valid. There are several reasons why + this could happen: + + - The data source has been replaced by another data source. + - The drag-and-drop operation was performed, but the drop destination + did not accept any of the mimetypes offered through + wl_data_source.target. + - The drag-and-drop operation was performed, but the drop destination + did not select any of the actions present in the mask offered through + wl_data_source.action. + - The drag-and-drop operation was performed but didn't happen over a + surface. + - The compositor cancelled the drag-and-drop operation (e.g. compositor + dependent timeouts to avoid stale drag-and-drop transfers). + The client should clean up and destroy this data source. + + For objects of version 2 or older, wl_data_source.cancelled will + only be emitted if the data source was replaced by another data + source. + + + + + Sets the actions that the source side client supports for this + operation. This request may trigger wl_data_source.action and + wl_data_offer.action events if the compositor needs to change the + selected action. + + The dnd_actions argument must contain only values expressed in the + wl_data_device_manager.dnd_actions enum, otherwise it will result + in a protocol error. + + This request must be made once only, and can only be made on sources + used in drag-and-drop, so it must be performed before + wl_data_device.start_drag. Attempting to use the source other than + for drag-and-drop will raise a protocol error. + + + + + + + The user performed the drop action. This event does not indicate + acceptance, wl_data_source.cancelled may still be emitted afterwards + if the drop destination does not accept any mimetype. + + However, this event might however not be received if the compositor + cancelled the drag-and-drop operation before this event could happen. + + Note that the data_source may still be used in the future and should + not be destroyed here. + + + + + + The drop destination finished interoperating with this data + source, so the client is now free to destroy this data source and + free all associated data. + + If the action used to perform the operation was "move", the + source can now delete the transferred data. + + + + + + This event indicates the action selected by the compositor after + matching the source/destination side actions. Only one action (or + none) will be offered here. + + This event can be emitted multiple times during the drag-and-drop + operation, mainly in response to destination side changes through + wl_data_offer.set_actions, and as the data device enters/leaves + surfaces. + + It is only possible to receive this event after + wl_data_source.dnd_drop_performed if the drag-and-drop operation + ended in an "ask" action, in which case the final wl_data_source.action + event will happen immediately before wl_data_source.dnd_finished. + + Compositors may also change the selected action on the fly, mainly + in response to keyboard modifier changes during the drag-and-drop + operation. + + The most recent action received is always the valid one. The chosen + action may change alongside negotiation (e.g. an "ask" action can turn + into a "move" operation), so the effects of the final action must + always be applied in wl_data_offer.dnd_finished. + + Clients can trigger cursor surface changes from this point, so + they reflect the current action. + + + - + There is one wl_data_device per seat which can be obtained from the global wl_data_device_manager singleton. @@ -525,6 +758,11 @@ A wl_data_device provides access to inter-client data transfer mechanisms such as copy-and-paste and drag-and-drop. + + + + + This request asks the compositor to start a drag-and-drop @@ -545,7 +783,9 @@ the top-left corner of the icon surface is placed at the cursor hotspot, but subsequent wl_surface.attach request can move the relative position. Attach requests must be confirmed with - wl_surface.commit as usual. + wl_surface.commit as usual. The icon surface is given the role of + a drag-and-drop icon. If the icon surface already has another role, + it raises a protocol error. The current and pending input regions of the icon wl_surface are cleared, and wl_surface.set_input_region is ignored until the @@ -623,6 +863,17 @@ The event is sent when a drag-and-drop operation is ended because the implicit grab is removed. + + The drag-and-drop destination is expected to honor the last action + received through wl_data_offer.action, if the resulting action is + "copy" or "move", the destination can still perform + wl_data_offer.receive requests, and is expected to end all + transfers with a wl_data_offer.finish request. + + If the resulting action is "ask", the action will not be considered + final. The drag-and-drop destination is expected to perform one last + wl_data_offer.set_actions request, or wl_data_offer.destroy in order + to cancel the operation. @@ -636,19 +887,34 @@ immediately before receiving keyboard focus and when a new selection is set while the client has keyboard focus. The data_offer is valid until a new data_offer or NULL is received - or until the client loses keyboard focus. + or until the client loses keyboard focus. The client must + destroy the previous selection data_offer, if any, upon receiving + this event. + + + + + + This request destroys the data device. + + - + The wl_data_device_manager is a singleton global object that provides access to inter-client data transfer mechanisms such as copy-and-paste and drag-and-drop. These mechanisms are tied to a wl_seat and this interface lets a client get a wl_data_device corresponding to a wl_seat. + + Depending on the version bound, the objects created from the bound + wl_data_device_manager object will have different requirements for + functioning properly. See wl_data_source.set_actions, + wl_data_offer.accept and wl_data_offer.finish for details. @@ -665,6 +931,40 @@ + + + + + + This is a bitmask of the available/preferred actions in a + drag-and-drop operation. + + In the compositor, the selected action is a result of matching the + actions offered by the source and destination sides. "action" events + with a "none" action will be sent to both source and destination if + there is no match. All further checks will effectively happen on + (source actions ∩ destination actions). + + In addition, compositors may also pick different actions in + reaction to key modifiers being pressed, one common design that + is used in major toolkits (and the behavior recommended for + compositors) is: + + - If no modifiers are pressed, the first match (in bit order) + will be used. + - Pressing Shift selects "move", if enabled in the mask. + - Pressing Control selects "copy", if enabled in the mask. + + Behavior beyond that is considered implementation-dependent. + Compositors may for example bind other modifiers (like Alt/Meta) + or drags initiated with other buttons than BTN_LEFT to specific + actions (e.g. "ask"). + + + + + + @@ -676,9 +976,15 @@ a basic surface. + + + + - Create a shell surface for an existing surface. + Create a shell surface for an existing surface. This gives + the wl_surface the role of a shell surface. If the wl_surface + already has another role, it raises a protocol error. Only one shell surface can be associated with a given surface. @@ -723,7 +1029,7 @@ - + These values are used to indicate which edge of a surface is being dragged in a resize operation. The server may @@ -751,7 +1057,7 @@ - + @@ -762,7 +1068,7 @@ - + These flags specify details of the expected behaviour of transient surfaces. Used in the set_transient request. @@ -784,7 +1090,7 @@ - + @@ -835,7 +1141,7 @@ with the dimensions for the output on which the surface will be made fullscreen. - + @@ -868,7 +1174,7 @@ - + @@ -949,7 +1255,7 @@ in surface local coordinates. - + @@ -963,7 +1269,7 @@ - + A surface is a rectangular area that is displayed on the screen. It has a location, size and pixel contents. @@ -973,8 +1279,37 @@ local coordinates of the pixel content, in case a buffer_transform or a buffer_scale is used. - Surfaces are also used for some special purposes, e.g. as - cursor images for pointers, drag icons, etc. + A surface without a "role" is fairly useless, a compositor does + not know where, when or how to present it. The role is the + purpose of a wl_surface. Examples of roles are a cursor for a + pointer (as set by wl_pointer.set_cursor), a drag icon + (wl_data_device.start_drag), a sub-surface + (wl_subcompositor.get_subsurface), and a window as defined by a + shell protocol (e.g. wl_shell.get_shell_surface). + + A surface can have only one role at a time. Initially a + wl_surface does not have a role. Once a wl_surface is given a + role, it is set permanently for the whole lifetime of the + wl_surface object. Giving the current role again is allowed, + unless explicitly forbidden by the relevant interface + specification. + + Surface roles are given by requests in other interfaces such as + wl_pointer.set_cursor. The request should explicitly mention + that this request gives a role to a wl_surface. Often, this + request also creates a new protocol object that represents the + role and adds additional functionality to wl_surface. When a + client wants to destroy a wl_surface, they must destroy this 'role + object' before the wl_surface. + + Destroying the role object does not remove the role from the + wl_surface, but it may stop the wl_surface from "playing the role". + For instance, if a wl_subsurface object is destroyed, the wl_surface + it was created for will be unmapped and forget its position and + z-order. It is allowed to create a wl_subsurface for the same + wl_surface again, but it is not allowed to use the wl_surface as + a cursor (cursor is a different role than sub-surface, and role + switching is not allowed). @@ -1043,10 +1378,8 @@ This request is used to describe the regions where the pending buffer is different from the current surface contents, and where - the surface therefore needs to be repainted. The pending buffer - must be set by wl_surface.attach before sending damage. The - compositor ignores the parts of the damage that fall outside of - the surface. + the surface therefore needs to be repainted. The compositor + ignores the parts of the damage that fall outside of the surface. Damage is double-buffered state, see wl_surface.commit. @@ -1059,6 +1392,10 @@ wl_surface.commit assigns pending damage as the current damage, and clears pending damage. The server will clear the current damage as it repaints the surface. + + Alternatively, damage can be posted with wl_surface.damage_buffer + which uses buffer co-ordinates instead of surface co-ordinates, + and is probably the preferred and intuitive way of doing this. @@ -1275,9 +1612,51 @@ + + + + + This request is used to describe the regions where the pending + buffer is different from the current surface contents, and where + the surface therefore needs to be repainted. The compositor + ignores the parts of the damage that fall outside of the surface. + + Damage is double-buffered state, see wl_surface.commit. + + The damage rectangle is specified in buffer coordinates. + + The initial value for pending damage is empty: no damage. + wl_surface.damage_buffer adds pending damage: the new pending + damage is the union of old pending damage and the given rectangle. + + wl_surface.commit assigns pending damage as the current damage, + and clears pending damage. The server will clear the current + damage as it repaints the surface. + + This request differs from wl_surface.damage in only one way - it + takes damage in buffer co-ordinates instead of surface local + co-ordinates. While this generally is more intuitive than surface + co-ordinates, it is especially desirable when using wp_viewport + or when a drawing library (like EGL) is unaware of buffer scale + and buffer transform. + + Note: Because buffer transformation changes and damage requests may + be interleaved in the protocol stream, It is impossible to determine + the actual mapping between surface and buffer damage until + wl_surface.commit time. Therefore, compositors wishing to take both + kinds of damage into account will have to accumulate damage from the + two requests separately and only transform from one to the other + after receiving the wl_surface.commit. + + + + + + + - + A seat is a group of keyboards, pointer and touch devices. This object is published as a global during start up, or when such a @@ -1285,7 +1664,7 @@ maintains a keyboard focus and a pointer focus. - + This is a bitmask of capabilities this seat has; if a member is set, then it is present on the seat. @@ -1297,47 +1676,74 @@ - This is emitted whenever a seat gains or loses the pointer, + This is emitted whenever a seat gains or loses the pointer, keyboard or touch capabilities. The argument is a capability enum containing the complete set of capabilities this seat has. + + When the pointer capability is added, a client may create a + wl_pointer object using the wl_seat.get_pointer request. This object + will receive pointer events until the capability is removed in the + future. + + When the pointer capability is removed, a client should destroy the + wl_pointer objects associated with the seat where the capability was + removed, using the wl_pointer.release request. No further pointer + events will be received on these objects. + + In some compositors, if a seat regains the pointer capability and a + client has a previously obtained wl_pointer object of version 4 or + less, that object may start sending pointer events again. This + behavior is considered a misinterpretation of the intended behavior + and must not be relied upon by the client. wl_pointer objects of + version 5 or later must not send events if created before the most + recent event notifying the client of an added pointer capability. + + The above behavior also applies to wl_keyboard and wl_touch with the + keyboard and touch capabilities, respectively. - + - The ID provided will be initialized to the wl_pointer interface + The ID provided will be initialized to the wl_pointer interface for this seat. - This request only takes effect if the seat has the pointer - capability. + This request only takes effect if the seat has the pointer + capability, or has had the pointer capability in the past. + It is a protocol violation to issue this request on a seat that has + never had the pointer capability. - The ID provided will be initialized to the wl_keyboard interface + The ID provided will be initialized to the wl_keyboard interface for this seat. - This request only takes effect if the seat has the keyboard - capability. + This request only takes effect if the seat has the keyboard + capability, or has had the keyboard capability in the past. + It is a protocol violation to issue this request on a seat that has + never had the keyboard capability. - The ID provided will be initialized to the wl_touch interface + The ID provided will be initialized to the wl_touch interface for this seat. - This request only takes effect if the seat has the touch - capability. + This request only takes effect if the seat has the touch + capability, or has had the touch capability in the past. + It is a protocol violation to issue this request on a seat that has + never had the touch capability. - + @@ -1348,9 +1754,18 @@ + + + + + Using this request client can tell the server that it is not going to + use the seat object anymore. + + + - + The wl_pointer interface represents one or more input devices, such as mice, which control the pointer location and pointer_focus @@ -1362,10 +1777,18 @@ and scrolling. + + + + Set the pointer surface, i.e., the surface that contains the - pointer image (cursor). This request only takes effect if the pointer + pointer image (cursor). This request gives the surface the role + of a cursor. If the surface already has another role, it raises + a protocol error. + + The cursor actually changes only if the pointer focus for this device is one of the requesting client's surfaces or the surface parameter is the current pointer surface. If there was a previous surface set with this request it is @@ -1461,7 +1884,7 @@ - + @@ -1493,19 +1916,169 @@ - + - + + Using this request client can tell the server that it is not going to + use the pointer object anymore. + + This request destroys the pointer proxy object, so user must not call + wl_pointer_destroy() after using this request. + + + + + + Indicates the end of a set of events that logically belong together. + A client is expected to accumulate the data in all events within the + frame before proceeding. + + All wl_pointer events before a wl_pointer.frame event belong + logically together. For example, in a diagonal scroll motion the + compositor will send an optional wl_pointer.axis_source event, two + wl_pointer.axis events (horizontal and vertical) and finally a + wl_pointer.frame event. The client may use this information to + calculate a diagonal vector for scrolling. + + When multiple wl_pointer.axis events occur within the same frame, + the motion vector is the combined motion of all events. + When a wl_pointer.axis and a wl_pointer.axis_stop event occur within + the same frame, this indicates that axis movement in one axis has + stopped but continues in the other axis. + When multiple wl_pointer.axis_stop events occur within in the same + frame, this indicates that these axes stopped in the same instance. + + A wl_pointer.frame event is sent for every logical event group, + even if the group only contains a single wl_pointer event. + Specifically, a client may get a sequence: motion, frame, button, + frame, axis, frame, axis_stop, frame. + + The wl_pointer.enter and wl_pointer.leave events are logical events + generated by the compositor and not the hardware. These events are + also grouped by a wl_pointer.frame. When a pointer moves from one + surface to the another, a compositor should group the + wl_pointer.leave event within the same wl_pointer.frame. + However, a client must not rely on wl_pointer.leave and + wl_pointer.enter being in the same wl_pointer.frame. + Compositor-specific policies may require the wl_pointer.leave and + wl_pointer.enter event being split across multiple wl_pointer.frame + groups. + + + + + + Describes the source types for axis events. This indicates to the + client how an axis event was physically generated; a client may + adjust the user interface accordingly. For example, scroll events + from a "finger" source may be in a smooth coordinate space with + kinetic scrolling whereas a "wheel" source may be in discrete steps + of a number of lines. + + The "continuous" axis source is a device generating events in a + continuous coordinate space, but using something other than a + finger. One example for this source is button-based scrolling where + the vertical motion of a device is converted to scroll events while + a button is held down. + + + + + + + + + Source information for scroll and other axes. + + This event does not occur on its own. It is sent before a + wl_pointer.frame event and carries the source information for + all events within that frame. + + The source specifies how this event was generated. If the source is + wl_pointer.axis_source.finger, a wl_pointer.axis_stop event will be + sent when the user lifts the finger off the device. + + If the source is wl_pointer axis_source.wheel or + wl_pointer.axis_source.continuous, a wl_pointer.axis_stop event may + or may not be sent. Whether a compositor sends a axis_stop event + for these sources is hardware-specific and implementation-dependent; + clients must not rely on receiving an axis_stop event for these + scroll sources and should treat scroll sequences from these scroll + sources as unterminated by default. + + This event is optional. If the source is unknown for a particular + axis event sequence, no event is sent. + Only one wl_pointer.axis_source event is permitted per frame. + + The order of wl_pointer.axis_discrete and wl_pointer.axis_source is + not guaranteed. + + + + + + + Stop notification for scroll and other axes. + + For some wl_pointer.axis_source types, a wl_pointer.axis_stop event + is sent to notify a client that the axis sequence has terminated. + This enables the client to implement kinetic scrolling. + See the wl_pointer.axis_source documentation for information on when + this event may be generated. + + Any wl_pointer.axis events with the same axis_source after this + event should be considered as the start of a new axis motion. + + The timestamp is to be interpreted identical to the timestamp in the + wl_pointer.axis event. The timestamp value may be the same as a + preceeding wl_pointer.axis event. + + + + + + + + Discrete step information for scroll and other axes. + + This event carries the axis value of the wl_pointer.axis event in + discrete steps (e.g. mouse wheel clicks). + + This event does not occur on its own, it is coupled with a + wl_pointer.axis event that represents this axis value on a + continuous scale. The protocol guarantees that each axis_discrete + event is always followed by exactly one axis event with the same + axis number within the same wl_pointer.frame. Note that the protocol + allows for other events to occur between the axis_discrete and + its coupled axis event, including other axis_discrete or axis + events. + + This event is optional; continuous scrolling devices + like two-finger scrolling on touchpads do not have discrete + steps and do not generate this event. + + The discrete value carries the directional information. e.g. a value + of -2 is two steps towards the negative direction of this axis. + + The axis number is identical to the axis number in the associate + axis event. + + The order of wl_pointer.axis_discrete and wl_pointer.axis_source is + not guaranteed. + + + + - + The wl_keyboard interface represents one or more keyboards associated with a seat. @@ -1527,7 +2100,7 @@ This event provides a file descriptor to the client which can be memory-mapped to provide a keyboard mapping description. - + @@ -1572,7 +2145,7 @@ - + @@ -1619,7 +2192,7 @@ - + The wl_touch interface represents a touchscreen associated with a seat. @@ -1704,7 +2277,7 @@ This enumeration describes how the physical - pixels on an output are layed out. + pixels on an output are laid out. @@ -1753,17 +2326,17 @@ summary="width in millimeters of the output"/> - - - + These flags describe properties of an output mode. They are used in the flags bitfield of the mode event. @@ -1790,7 +2363,7 @@ the output may be scaled, as described in wl_output.scale, or transformed , as described in wl_output.transform. - + @@ -1911,9 +2484,9 @@ associate it with the given parent surface. This turns a plain wl_surface into a sub-surface. - The to-be sub-surface must not already have a dedicated - purpose, like any shell surface type, cursor image, drag icon, - or sub-surface. Otherwise a protocol error is raised. + The to-be sub-surface must not already have another role, and it + must not have an existing wl_subsurface object. Otherwise a protocol + error is raised. Change the commit behaviour of the sub-surface to synchronized - mode, also described as the parent dependant mode. + mode, also described as the parent dependent mode. In synchronized mode, wl_surface.commit on a sub-surface will accumulate the committed state in a cache, but the state will From 4a6cf17488e5f14e5f5f47ead4cf755f4b7c7c35 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Mon, 13 Aug 2018 16:18:47 +0200 Subject: [PATCH 0574/1507] Compositor API: Add xdg-decoration unstable v1 support And add an example with server-side window decorations. Task-number: QTBUG-69934 Change-Id: Ic3984b50cf7574cae5135dea51eb4b1c80bb45a7 Reviewed-by: Paul Olav Tvete --- src/3rdparty/wayland/protocols/qt_attribution.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/3rdparty/wayland/protocols/qt_attribution.json b/src/3rdparty/wayland/protocols/qt_attribution.json index bf5851f84ca..84dafe93846 100644 --- a/src/3rdparty/wayland/protocols/qt_attribution.json +++ b/src/3rdparty/wayland/protocols/qt_attribution.json @@ -40,7 +40,7 @@ Copyright (c) 2013 BMW Car IT GmbH" "Id": "wayland-xdg-decoration-protocol", "Name": "Wayland xdg-decoration Protocol", "QDocModule": "qtwaylandcompositor", - "QtUsage": "Used in the Qt Wayland platform plugin.", + "QtUsage": "Used in the Qt Wayland Compositor API, and the Qt Wayland platform plugin.", "Files": "xdg-decoration-unstable-v1.xml", "Description": "The xdg-decoration protocol allows a compositor to announce support for server-side decorations.", From 059debd75a8c17cd40c8c0d5e7dcb6fac27fc9e8 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Fri, 3 Aug 2018 12:53:38 +0200 Subject: [PATCH 0575/1507] xdg-shell stable: Make sure popup parent is topmost popup when grabbing Avoids protocol errors on Weston, gnome-shell and wlroots-based compositors. This is the same fix as 2987de95, but for the stable version of xdg shell. Change-Id: Ic998fb920a8b1b131e42833a61e663704c8663e4 Reviewed-by: Paul Olav Tvete --- .../xdg-shell/qwaylandxdgshell.cpp | 27 ++++++++++++++++--- .../xdg-shell/qwaylandxdgshell_p.h | 8 ++++++ 2 files changed, 32 insertions(+), 3 deletions(-) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp index 7dabd96f2cc..8b3d07481cb 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp @@ -182,6 +182,7 @@ QWaylandXdgSurface::Popup::Popup(QWaylandXdgSurface *xdgSurface, QWaylandXdgSurf QtWayland::xdg_positioner *positioner) : xdg_popup(xdgSurface->get_popup(parent->object(), positioner->object())) , m_xdgSurface(xdgSurface) + , m_parent(parent) { } @@ -189,6 +190,19 @@ QWaylandXdgSurface::Popup::~Popup() { if (isInitialized()) destroy(); + + if (m_grabbing) { + auto *shell = m_xdgSurface->m_shell; + Q_ASSERT(shell->m_topmostPopup == this); + shell->m_topmostPopup = m_parent->m_popup; + } +} + +void QWaylandXdgSurface::Popup::grab(QWaylandInputDevice *seat, uint serial) +{ + m_xdgSurface->m_shell->m_topmostPopup = this; + xdg_popup::grab(seat->wl_seat(), serial); + m_grabbing = true; } void QWaylandXdgSurface::Popup::xdg_popup_popup_done() @@ -317,6 +331,14 @@ void QWaylandXdgSurface::setPopup(QWaylandWindow *parent, QWaylandInputDevice *d Q_ASSERT(!m_toplevel && !m_popup); auto parentXdgSurface = static_cast(parent->shellSurface()); + + auto *top = m_shell->m_topmostPopup; + if (grab && top && top->m_xdgSurface != parentXdgSurface) { + qCWarning(lcQpaWayland) << "setPopup called for a surface that was not the topmost popup, positions might be off."; + parentXdgSurface = top->m_xdgSurface; + parent = top->m_xdgSurface->m_window; + } + auto positioner = new QtWayland::xdg_positioner(m_shell->create_positioner()); // set_popup expects a position relative to the parent QPoint transientPos = m_window->geometry().topLeft(); // this is absolute @@ -332,9 +354,8 @@ void QWaylandXdgSurface::setPopup(QWaylandWindow *parent, QWaylandInputDevice *d m_popup = new Popup(this, parentXdgSurface, positioner); positioner->destroy(); delete positioner; - if (grab) { - m_popup->grab(device->wl_seat(), serial); - } + if (grab) + m_popup->grab(device, serial); } void QWaylandXdgSurface::xdg_surface_configure(uint32_t serial) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h index 37a4a8a4c71..45d7d4b0e0f 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h @@ -129,9 +129,12 @@ private: Popup(QWaylandXdgSurface *xdgSurface, QWaylandXdgSurface *parent, QtWayland::xdg_positioner *positioner); ~Popup() override; + void grab(QWaylandInputDevice *seat, uint serial); void xdg_popup_popup_done() override; QWaylandXdgSurface *m_xdgSurface = nullptr; + QWaylandXdgSurface *m_parent = nullptr; + bool m_grabbing = false; }; void setToplevel(); @@ -144,6 +147,8 @@ private: bool m_configured = false; QRegion m_exposeRegion; uint m_pendingConfigureSerial = 0; + + friend class QWaylandXdgShell; }; class Q_WAYLAND_CLIENT_EXPORT QWaylandXdgShell : public QtWayland::xdg_wm_base @@ -164,6 +169,9 @@ private: QWaylandDisplay *m_display = nullptr; QScopedPointer m_xdgDecorationManager; + QWaylandXdgSurface::Popup *m_topmostPopup = nullptr; + + friend class QWaylandXdgSurface; }; QT_END_NAMESPACE From f746be7c7f57354121c8cb4cf3c824710f3672ab Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Mon, 27 Aug 2018 09:25:50 +0200 Subject: [PATCH 0576/1507] Client: Fix regression; drawing decorations of active windows as inactive We can't trust QWindow::isActive, because it relies on focusWindow, which may be updated too late, and there might also be multiple active toplevel windows at once on Wayland. Even though Qt doesn't support multiple seats, we should still draw the decorations of active windows correctly. This implements QPlatformWindow::isActive and uses it in the decorations. Change-Id: I34d79b354e2d26694533e2319a26f24085212243 Reviewed-by: Paul Olav Tvete --- .../platforms/wayland/plugins/decorations/bradient/main.cpp | 5 +++-- src/plugins/platforms/wayland/qwaylanddisplay.cpp | 5 +++++ src/plugins/platforms/wayland/qwaylanddisplay_p.h | 1 + src/plugins/platforms/wayland/qwaylandwindow.cpp | 5 +++++ src/plugins/platforms/wayland/qwaylandwindow_p.h | 1 + 5 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp b/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp index 1df3ac62b21..3fa723446db 100644 --- a/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp +++ b/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp @@ -132,6 +132,7 @@ QMargins QWaylandBradientDecoration::margins() const void QWaylandBradientDecoration::paint(QPaintDevice *device) { + bool active = window()->handle()->isActive(); QRect surfaceRect(QPoint(), window()->frameGeometry().size()); QRect clips[] = { @@ -183,7 +184,7 @@ void QWaylandBradientDecoration::paint(QPaintDevice *device) p.save(); p.setClipRect(titleBar); - p.setPen(window()->isActive() ? m_foregroundColor : m_foregroundInactiveColor); + p.setPen(active ? m_foregroundColor : m_foregroundInactiveColor); QSizeF size = m_windowTitle.size(); int dx = (top.width() - size.width()) /2; int dy = (top.height()- size.height()) /2; @@ -199,7 +200,7 @@ void QWaylandBradientDecoration::paint(QPaintDevice *device) QRectF rect; // Default pen - QPen pen(window()->isActive() ? m_foregroundColor : m_foregroundInactiveColor); + QPen pen(active ? m_foregroundColor : m_foregroundInactiveColor); p.setPen(pen); // Close button diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index 5e67cd3a693..c57dc13add2 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -413,6 +413,11 @@ void QWaylandDisplay::setLastInputDevice(QWaylandInputDevice *device, uint32_t s mLastInputWindow = win; } +bool QWaylandDisplay::isWindowActivated(const QWaylandWindow *window) +{ + return mActiveWindows.contains(const_cast(window)); +} + void QWaylandDisplay::handleWindowActivated(QWaylandWindow *window) { if (mActiveWindows.contains(window)) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay_p.h b/src/plugins/platforms/wayland/qwaylanddisplay_p.h index 8839bbe4cc0..71a39dd928c 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay_p.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay_p.h @@ -176,6 +176,7 @@ public: QWaylandWindow *lastInputWindow() const; void setLastInputDevice(QWaylandInputDevice *device, uint32_t serial, QWaylandWindow *window); + bool isWindowActivated(const QWaylandWindow *window); void handleWindowActivated(QWaylandWindow *window); void handleWindowDeactivated(QWaylandWindow *window); void handleKeyboardFocusChanged(QWaylandInputDevice *inputDevice); diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 76039091711..e58e87221df 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -943,6 +943,11 @@ bool QWaylandWindow::isExposed() const return QPlatformWindow::isExposed(); } +bool QWaylandWindow::isActive() const +{ + return mDisplay->isWindowActivated(this); +} + int QWaylandWindow::scale() const { return mScale; diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index b6b499a3b71..d11ed871bf8 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -146,6 +146,7 @@ public: void requestActivateWindow() override; bool isExposed() const override; + bool isActive() const override; void unfocus(); QWaylandAbstractDecoration *decoration() const; From 3c4ea05c754bfdc7e353f60e3bf3498867c4b0ea Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Tue, 28 Aug 2018 16:07:06 +0200 Subject: [PATCH 0577/1507] Scanner: Don't crash when calling fromResource with nullptr Change-Id: I85c17e50cf917a51e74fa03fcdc647def6e4bdfd Reviewed-by: Paul Olav Tvete Reviewed-by: Pier Luigi Fiorini --- src/tools/qtwaylandscanner/qtwaylandscanner.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp index bdcbffa0d3c..c08c00f4fc3 100644 --- a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp +++ b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp @@ -806,6 +806,8 @@ bool Scanner::process() printf(" %s::Resource *%s::Resource::fromResource(struct ::wl_resource *resource)\n", interfaceName, interfaceName); printf(" {\n"); + printf(" if (Q_UNLIKELY(!resource))\n"); + printf(" return nullptr;\n"); printf(" if (wl_resource_instance_of(resource, &::%s_interface, %s))\n", interfaceName, interfaceMember.constData()); printf(" return static_cast(resource->data);\n"); printf(" return nullptr;\n"); From db0838a117db11152903fc58fcd601cc326318ff Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Tue, 28 Aug 2018 16:29:38 +0200 Subject: [PATCH 0578/1507] Compositor: Fix nullptr dereferences in fromResource functions If there was no resource for the given wl_resource*, don't try to dereference it. Change-Id: I3a27a5805699148bb26029e8b4179042c3c1117a Reviewed-by: Paul Olav Tvete Reviewed-by: Pier Luigi Fiorini --- tests/auto/wayland/shared/mocksurface.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/auto/wayland/shared/mocksurface.cpp b/tests/auto/wayland/shared/mocksurface.cpp index 82ce37acb4c..4de4265d773 100644 --- a/tests/auto/wayland/shared/mocksurface.cpp +++ b/tests/auto/wayland/shared/mocksurface.cpp @@ -107,7 +107,9 @@ bool Surface::isMapped() const Surface *Surface::fromResource(struct ::wl_resource *resource) { - return static_cast(Resource::fromResource(resource)->surface_object); + if (auto *r = Resource::fromResource(resource)) + return static_cast(r->surface_object); + return nullptr; } void Surface::surface_destroy_resource(Resource *) From b70ab36e1ceb80084b8665a7e357ec1c3b014bbf Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Wed, 22 Aug 2018 13:24:31 +0200 Subject: [PATCH 0579/1507] Client: Deprecate xdg-shell-v5 and wl-shell [ChangeLog][QPA plugin] Deprecated the shell integrations for xdg-shell-unstable-v5 and wl-shell. The stable version of xdg-shell should be used instead. Task-number: QTBUG-68838 Change-Id: Iab89059ec13efc2f72c3317a26439d7683e03e79 Reviewed-by: Pier Luigi Fiorini --- .../shellintegration/wl-shell/qwaylandwlshellintegration.cpp | 4 ++++ .../xdg-shell-v5/qwaylandxdgshellv5integration.cpp | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellintegration.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellintegration.cpp index be156dad21b..008da3d8a83 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellintegration.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellintegration.cpp @@ -49,6 +49,10 @@ namespace QtWaylandClient { bool QWaylandWlShellIntegration::initialize(QWaylandDisplay *display) { + qCWarning(lcQpaWayland) << "\"wl-shell\" is a deprecated shell extension, prefer using" + << "\"xdg-shell-v6\" or \"xdg-shell\" if supported by the compositor" + << "by setting the environment variable QT_WAYLAND_SHELL_INTEGRATION"; + Q_FOREACH (QWaylandDisplay::RegistryGlobal global, display->globals()) { if (global.interface == QLatin1String("wl_shell")) { m_wlShell = new QtWayland::wl_shell(display->wl_registry(), global.id, 1); diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshellv5integration.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshellv5integration.cpp index 47d748b1cad..d032002b159 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshellv5integration.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshellv5integration.cpp @@ -51,6 +51,10 @@ namespace QtWaylandClient { bool QWaylandXdgShellV5Integration::initialize(QWaylandDisplay *display) { + qCWarning(lcQpaWayland) << "\"xdg-shell-v5\" is a deprecated shell extension, prefer using" + << "\"xdg-shell-v6\" or \"xdg-shell\" if supported by the compositor" + << "by setting the environment variable QT_WAYLAND_SHELL_INTEGRATION"; + Q_FOREACH (QWaylandDisplay::RegistryGlobal global, display->globals()) { if (global.interface == QLatin1String("xdg_shell")) { m_xdgShell.reset(new QWaylandXdgShellV5(display->wl_registry(), global.id)); From c1df229b5dab653a9f01e3eca404a1e79813d6a1 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Thu, 30 Aug 2018 14:48:54 +0200 Subject: [PATCH 0580/1507] Client: Use customized version of generated files for xdg-shell-v5 Check in qtwaylandscanner and wayland-scanner generated files with renamed symbols to avoid conflicts with xdg-shell stable. When this was done on the compositor side, we thought we didn't have to do it for the client side because the conflicting symbols are used in separate plugins. Turns out this breaks static builds, though. Task-number: QTBUG-69896 Change-Id: I461df8e136b741063eafe13e858734a3aafdf020 Reviewed-by: Paul Olav Tvete --- .../wayland/protocols/qt_attribution.json | 2 +- .../qwayland-xdg-shell-unstable-v5.cpp | 398 ++++++ .../qwayland-xdg-shell-unstable-v5_p.h | 198 +++ ...-xdg-shell-unstable-v5-client-protocol_p.h | 1112 +++++++++++++++++ .../wayland-xdg-shell-unstable-v5-protocol.c | 126 ++ .../pregenerated/xdg-shell-v5.pri | 12 + .../xdg-shell-v5/qwaylandxdgpopupv5.cpp | 4 +- .../xdg-shell-v5/qwaylandxdgpopupv5_p.h | 6 +- .../xdg-shell-v5/qwaylandxdgshellv5.cpp | 8 +- .../xdg-shell-v5/qwaylandxdgshellv5_p.h | 6 +- .../xdg-shell-v5/qwaylandxdgsurfacev5.cpp | 6 +- .../xdg-shell-v5/qwaylandxdgsurfacev5_p.h | 8 +- .../xdg-shell-v5/xdg-shell-v5.pro | 5 +- 13 files changed, 1868 insertions(+), 23 deletions(-) create mode 100644 src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/pregenerated/3rdparty/qwayland-xdg-shell-unstable-v5.cpp create mode 100644 src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/pregenerated/3rdparty/qwayland-xdg-shell-unstable-v5_p.h create mode 100644 src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/pregenerated/3rdparty/wayland-xdg-shell-unstable-v5-client-protocol_p.h create mode 100644 src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/pregenerated/3rdparty/wayland-xdg-shell-unstable-v5-protocol.c create mode 100644 src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/pregenerated/xdg-shell-v5.pri diff --git a/src/3rdparty/wayland/protocols/qt_attribution.json b/src/3rdparty/wayland/protocols/qt_attribution.json index 84dafe93846..ba199812ba2 100644 --- a/src/3rdparty/wayland/protocols/qt_attribution.json +++ b/src/3rdparty/wayland/protocols/qt_attribution.json @@ -74,7 +74,7 @@ Copyright (c) 2013 BMW Car IT GmbH" "Name": "Wayland XDG Shell Protocol", "QDocModule": "qtwaylandcompositor", "QtUsage": "Used in the Qt Wayland Compositor, and the Qt Wayland platform plugin.", - "Files": "xdg-shell-unstable-v5.xml xdg-shell-unstable-v6.xml xdg-shell.xml ../../compositor/extensions/pregenerated/3rdparty/qwayland-server-xdg-shell-unstable-v5.cpp ../../compositor/extensions/pregenerated/3rdparty/qwayland-server-xdg-shell-unstable-v5_p.h ../../compositor/extensions/pregenerated/3rdparty/wayland-xdg-shell-unstable-v5-protocol.c ../../compositor/extensions/pregenerated/3rdparty/wayland-xdg-shell-unstable-v5-server-protocol_p.h", + "Files": " xdg-shell-unstable-v5.xml xdg-shell-unstable-v6.xml xdg-shell.xml ../../compositor/extensions/pregenerated/3rdparty/qwayland-server-xdg-shell-unstable-v5.cpp ../../compositor/extensions/pregenerated/3rdparty/qwayland-server-xdg-shell-unstable-v5_p.h ../../compositor/extensions/pregenerated/3rdparty/wayland-xdg-shell-unstable-v5-protocol.c ../../compositor/extensions/pregenerated/3rdparty/wayland-xdg-shell-unstable-v5-server-protocol_p.h ../../plugins/shellintegration/xdg-shell-v5/pregenerated/3rdparty/qwayland-xdg-shell-unstable-v5.cpp ../../plugins/shellintegration/xdg-shell-v5/pregenerated/3rdparty/qwayland-xdg-shell-unstable-v5_p.h ../../plugins/shellintegration/xdg-shell-v5/pregenerated/3rdparty/wayland-xdg-shell-unstable-v5-client-protocol_p.h ../../plugins/shellintegration/xdg-shell-v5/pregenerated/3rdparty/wayland-xdg-shell-unstable-v5-protocol.c", "Description": "The XDG-Shell protocol is an extended way to manage surfaces under Wayland compositors.", "Homepage": "https://wayland.freedesktop.org", diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/pregenerated/3rdparty/qwayland-xdg-shell-unstable-v5.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/pregenerated/3rdparty/qwayland-xdg-shell-unstable-v5.cpp new file mode 100644 index 00000000000..0115eb1dacd --- /dev/null +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/pregenerated/3rdparty/qwayland-xdg-shell-unstable-v5.cpp @@ -0,0 +1,398 @@ +// Hand-edited to resolve conflicts with xdg-shell stable +/* + * Copyright © 2008-2013 Kristian Høgsberg + * Copyright © 2013 Rafael Antognolli + * Copyright © 2013 Jasper St. Pierre + * Copyright © 2010-2013 Intel Corporation + * + * 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 "qwayland-xdg-shell-unstable-v5_p.h" + +QT_BEGIN_NAMESPACE +QT_WARNING_PUSH +QT_WARNING_DISABLE_GCC("-Wmissing-field-initializers") + +namespace QtWayland { + xdg_shell_v5::xdg_shell_v5(struct ::wl_registry *registry, int id, int version) + { + init(registry, id, version); + } + + xdg_shell_v5::xdg_shell_v5(struct ::xdg_shell_v5 *obj) + : m_xdg_shell(obj) + { + init_listener(); + } + + xdg_shell_v5::xdg_shell_v5() + : m_xdg_shell(nullptr) + { + } + + xdg_shell_v5::~xdg_shell_v5() + { + } + + void xdg_shell_v5::init(struct ::wl_registry *registry, int id, int version) + { + m_xdg_shell = static_cast(wl_registry_bind(registry, id, &xdg_shell_v5_interface, version)); + init_listener(); + } + + void xdg_shell_v5::init(struct ::xdg_shell_v5 *obj) + { + m_xdg_shell = obj; + init_listener(); + } + + bool xdg_shell_v5::isInitialized() const + { + return m_xdg_shell != nullptr; + } + + const struct wl_interface *xdg_shell_v5::interface() + { + return &::xdg_shell_v5_interface; + } + + void xdg_shell_v5::destroy() + { + xdg_shell_destroy( + m_xdg_shell); + m_xdg_shell = nullptr; + } + + void xdg_shell_v5::use_unstable_version(int32_t version) + { + xdg_shell_use_unstable_version( + m_xdg_shell, + version); + } + + struct ::xdg_surface_v5 *xdg_shell_v5::get_xdg_surface(struct ::wl_surface *surface) + { + return xdg_shell_get_xdg_surface( + m_xdg_shell, + surface); + } + + struct ::xdg_popup_v5 *xdg_shell_v5::get_xdg_popup(struct ::wl_surface *surface, struct ::wl_surface *parent, struct ::wl_seat *seat, uint32_t serial, int32_t x, int32_t y) + { + return xdg_shell_get_xdg_popup( + m_xdg_shell, + surface, + parent, + seat, + serial, + x, + y); + } + + void xdg_shell_v5::pong(uint32_t serial) + { + xdg_shell_pong( + m_xdg_shell, + serial); + } + + void xdg_shell_v5::xdg_shell_ping(uint32_t ) + { + } + + void xdg_shell_v5::handle_ping( + void *data, + struct ::xdg_shell_v5 *object, + uint32_t serial) + { + Q_UNUSED(object); + static_cast(data)->xdg_shell_ping( + serial); + } + + const struct xdg_shell_listener xdg_shell_v5::m_xdg_shell_listener = { + xdg_shell_v5::handle_ping + }; + + void xdg_shell_v5::init_listener() + { + xdg_shell_add_listener(m_xdg_shell, &m_xdg_shell_listener, this); + } + + xdg_surface_v5::xdg_surface_v5(struct ::wl_registry *registry, int id, int version) + { + init(registry, id, version); + } + + xdg_surface_v5::xdg_surface_v5(struct ::xdg_surface_v5 *obj) + : m_xdg_surface(obj) + { + init_listener(); + } + + xdg_surface_v5::xdg_surface_v5() + : m_xdg_surface(nullptr) + { + } + + xdg_surface_v5::~xdg_surface_v5() + { + } + + void xdg_surface_v5::init(struct ::wl_registry *registry, int id, int version) + { + m_xdg_surface = static_cast(wl_registry_bind(registry, id, &xdg_surface_v5_interface, version)); + init_listener(); + } + + void xdg_surface_v5::init(struct ::xdg_surface_v5 *obj) + { + m_xdg_surface = obj; + init_listener(); + } + + bool xdg_surface_v5::isInitialized() const + { + return m_xdg_surface != nullptr; + } + + const struct wl_interface *xdg_surface_v5::interface() + { + return &::xdg_surface_v5_interface; + } + + void xdg_surface_v5::destroy() + { + xdg_surface_destroy( + m_xdg_surface); + m_xdg_surface = nullptr; + } + + void xdg_surface_v5::set_parent(struct ::xdg_surface_v5 *parent) + { + xdg_surface_set_parent( + m_xdg_surface, + parent); + } + + void xdg_surface_v5::set_title(const QString &title) + { + xdg_surface_set_title( + m_xdg_surface, + title.toUtf8().constData()); + } + + void xdg_surface_v5::set_app_id(const QString &app_id) + { + xdg_surface_set_app_id( + m_xdg_surface, + app_id.toUtf8().constData()); + } + + void xdg_surface_v5::show_window_menu(struct ::wl_seat *seat, uint32_t serial, int32_t x, int32_t y) + { + xdg_surface_show_window_menu( + m_xdg_surface, + seat, + serial, + x, + y); + } + + void xdg_surface_v5::move(struct ::wl_seat *seat, uint32_t serial) + { + xdg_surface_move( + m_xdg_surface, + seat, + serial); + } + + void xdg_surface_v5::resize(struct ::wl_seat *seat, uint32_t serial, uint32_t edges) + { + xdg_surface_resize( + m_xdg_surface, + seat, + serial, + edges); + } + + void xdg_surface_v5::ack_configure(uint32_t serial) + { + xdg_surface_ack_configure( + m_xdg_surface, + serial); + } + + void xdg_surface_v5::set_window_geometry(int32_t x, int32_t y, int32_t width, int32_t height) + { + xdg_surface_set_window_geometry( + m_xdg_surface, + x, + y, + width, + height); + } + + void xdg_surface_v5::set_maximized() + { + xdg_surface_set_maximized( + m_xdg_surface); + } + + void xdg_surface_v5::unset_maximized() + { + xdg_surface_unset_maximized( + m_xdg_surface); + } + + void xdg_surface_v5::set_fullscreen(struct ::wl_output *output) + { + xdg_surface_set_fullscreen( + m_xdg_surface, + output); + } + + void xdg_surface_v5::unset_fullscreen() + { + xdg_surface_unset_fullscreen( + m_xdg_surface); + } + + void xdg_surface_v5::set_minimized() + { + xdg_surface_set_minimized( + m_xdg_surface); + } + + void xdg_surface_v5::xdg_surface_configure(int32_t , int32_t , wl_array *, uint32_t ) + { + } + + void xdg_surface_v5::handle_configure( + void *data, + struct ::xdg_surface_v5 *object, + int32_t width, + int32_t height, + wl_array *states, + uint32_t serial) + { + Q_UNUSED(object); + static_cast(data)->xdg_surface_configure( + width, + height, + states, + serial); + } + + void xdg_surface_v5::xdg_surface_close() + { + } + + void xdg_surface_v5::handle_close( + void *data, + struct ::xdg_surface_v5 *object) + { + Q_UNUSED(object); + static_cast(data)->xdg_surface_close(); + } + + const struct xdg_surface_listener xdg_surface_v5::m_xdg_surface_listener = { + xdg_surface_v5::handle_configure, + xdg_surface_v5::handle_close + }; + + void xdg_surface_v5::init_listener() + { + xdg_surface_add_listener(m_xdg_surface, &m_xdg_surface_listener, this); + } + + xdg_popup_v5::xdg_popup_v5(struct ::wl_registry *registry, int id, int version) + { + init(registry, id, version); + } + + xdg_popup_v5::xdg_popup_v5(struct ::xdg_popup_v5 *obj) + : m_xdg_popup(obj) + { + init_listener(); + } + + xdg_popup_v5::xdg_popup_v5() + : m_xdg_popup(nullptr) + { + } + + xdg_popup_v5::~xdg_popup_v5() + { + } + + void xdg_popup_v5::init(struct ::wl_registry *registry, int id, int version) + { + m_xdg_popup = static_cast(wl_registry_bind(registry, id, &xdg_popup_v5_interface, version)); + init_listener(); + } + + void xdg_popup_v5::init(struct ::xdg_popup_v5 *obj) + { + m_xdg_popup = obj; + init_listener(); + } + + bool xdg_popup_v5::isInitialized() const + { + return m_xdg_popup != nullptr; + } + + const struct wl_interface *xdg_popup_v5::interface() + { + return &::xdg_popup_v5_interface; + } + + void xdg_popup_v5::destroy() + { + xdg_popup_destroy( + m_xdg_popup); + m_xdg_popup = nullptr; + } + + void xdg_popup_v5::xdg_popup_popup_done() + { + } + + void xdg_popup_v5::handle_popup_done( + void *data, + struct ::xdg_popup_v5 *object) + { + Q_UNUSED(object); + static_cast(data)->xdg_popup_popup_done(); + } + + const struct xdg_popup_listener xdg_popup_v5::m_xdg_popup_listener = { + xdg_popup_v5::handle_popup_done + }; + + void xdg_popup_v5::init_listener() + { + xdg_popup_add_listener(m_xdg_popup, &m_xdg_popup_listener, this); + } +} + +QT_WARNING_POP +QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/pregenerated/3rdparty/qwayland-xdg-shell-unstable-v5_p.h b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/pregenerated/3rdparty/qwayland-xdg-shell-unstable-v5_p.h new file mode 100644 index 00000000000..3d8a6c13d92 --- /dev/null +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/pregenerated/3rdparty/qwayland-xdg-shell-unstable-v5_p.h @@ -0,0 +1,198 @@ +// Hand-edited to resolve conflicts with xdg-shell stable +/* + * Copyright © 2008-2013 Kristian Høgsberg + * Copyright © 2013 Rafael Antognolli + * Copyright © 2013 Jasper St. Pierre + * Copyright © 2010-2013 Intel Corporation + * + * 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. + */ +#ifndef QT_WAYLAND_XDG_SHELL_UNSTABLE_V5 +#define QT_WAYLAND_XDG_SHELL_UNSTABLE_V5 + +#include "wayland-xdg-shell-unstable-v5-client-protocol_p.h" +#include +#include + +QT_BEGIN_NAMESPACE +QT_WARNING_PUSH +QT_WARNING_DISABLE_GCC("-Wmissing-field-initializers") + +namespace QtWayland { + class xdg_shell_v5 + { + public: + xdg_shell_v5(struct ::wl_registry *registry, int id, int version); + xdg_shell_v5(struct ::xdg_shell_v5 *object); + xdg_shell_v5(); + + virtual ~xdg_shell_v5(); + + void init(struct ::wl_registry *registry, int id, int version); + void init(struct ::xdg_shell_v5 *object); + + struct ::xdg_shell_v5 *object() { return m_xdg_shell; } + const struct ::xdg_shell_v5 *object() const { return m_xdg_shell; } + + bool isInitialized() const; + + static const struct ::wl_interface *interface(); + + enum version { + version_current = 5 // Always the latest version + }; + + enum error { + error_role = 0, // given wl_surface has another role + error_defunct_surfaces = 1, // xdg_shell was destroyed before children + error_not_the_topmost_popup = 2, // the client tried to map or destroy a non-topmost popup + error_invalid_popup_parent = 3 // the client specified an invalid popup parent surface + }; + + void destroy(); + void use_unstable_version(int32_t version); + struct ::xdg_surface_v5 *get_xdg_surface(struct ::wl_surface *surface); + struct ::xdg_popup_v5 *get_xdg_popup(struct ::wl_surface *surface, struct ::wl_surface *parent, struct ::wl_seat *seat, uint32_t serial, int32_t x, int32_t y); + void pong(uint32_t serial); + + protected: + virtual void xdg_shell_ping(uint32_t serial); + + private: + void init_listener(); + static const struct xdg_shell_listener m_xdg_shell_listener; + static void handle_ping( + void *data, + struct ::xdg_shell_v5 *object, + uint32_t serial); + struct ::xdg_shell_v5 *m_xdg_shell; + }; + + class xdg_surface_v5 + { + public: + xdg_surface_v5(struct ::wl_registry *registry, int id, int version); + xdg_surface_v5(struct ::xdg_surface_v5 *object); + xdg_surface_v5(); + + virtual ~xdg_surface_v5(); + + void init(struct ::wl_registry *registry, int id, int version); + void init(struct ::xdg_surface_v5 *object); + + struct ::xdg_surface_v5 *object() { return m_xdg_surface; } + const struct ::xdg_surface_v5 *object() const { return m_xdg_surface; } + + bool isInitialized() const; + + static const struct ::wl_interface *interface(); + + enum resize_edge { + resize_edge_none = 0, + resize_edge_top = 1, + resize_edge_bottom = 2, + resize_edge_left = 4, + resize_edge_top_left = 5, + resize_edge_bottom_left = 6, + resize_edge_right = 8, + resize_edge_top_right = 9, + resize_edge_bottom_right = 10 + }; + + enum state { + state_maximized = 1, // the surface is maximized + state_fullscreen = 2, // the surface is fullscreen + state_resizing = 3, + state_activated = 4 + }; + + void destroy(); + void set_parent(struct ::xdg_surface_v5 *parent); + void set_title(const QString &title); + void set_app_id(const QString &app_id); + void show_window_menu(struct ::wl_seat *seat, uint32_t serial, int32_t x, int32_t y); + void move(struct ::wl_seat *seat, uint32_t serial); + void resize(struct ::wl_seat *seat, uint32_t serial, uint32_t edges); + void ack_configure(uint32_t serial); + void set_window_geometry(int32_t x, int32_t y, int32_t width, int32_t height); + void set_maximized(); + void unset_maximized(); + void set_fullscreen(struct ::wl_output *output); + void unset_fullscreen(); + void set_minimized(); + + protected: + virtual void xdg_surface_configure(int32_t width, int32_t height, wl_array *states, uint32_t serial); + virtual void xdg_surface_close(); + + private: + void init_listener(); + static const struct xdg_surface_listener m_xdg_surface_listener; + static void handle_configure( + void *data, + struct ::xdg_surface_v5 *object, + int32_t width, + int32_t height, + wl_array *states, + uint32_t serial); + static void handle_close( + void *data, + struct ::xdg_surface_v5 *object); + struct ::xdg_surface_v5 *m_xdg_surface; + }; + + class xdg_popup_v5 + { + public: + xdg_popup_v5(struct ::wl_registry *registry, int id, int version); + xdg_popup_v5(struct ::xdg_popup_v5 *object); + xdg_popup_v5(); + + virtual ~xdg_popup_v5(); + + void init(struct ::wl_registry *registry, int id, int version); + void init(struct ::xdg_popup_v5 *object); + + struct ::xdg_popup_v5 *object() { return m_xdg_popup; } + const struct ::xdg_popup_v5 *object() const { return m_xdg_popup; } + + bool isInitialized() const; + + static const struct ::wl_interface *interface(); + + void destroy(); + + protected: + virtual void xdg_popup_popup_done(); + + private: + void init_listener(); + static const struct xdg_popup_listener m_xdg_popup_listener; + static void handle_popup_done( + void *data, + struct ::xdg_popup_v5 *object); + struct ::xdg_popup_v5 *m_xdg_popup; + }; +} + +QT_WARNING_POP +QT_END_NAMESPACE + +#endif diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/pregenerated/3rdparty/wayland-xdg-shell-unstable-v5-client-protocol_p.h b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/pregenerated/3rdparty/wayland-xdg-shell-unstable-v5-client-protocol_p.h new file mode 100644 index 00000000000..62b6a7858de --- /dev/null +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/pregenerated/3rdparty/wayland-xdg-shell-unstable-v5-client-protocol_p.h @@ -0,0 +1,1112 @@ +/* Generated by wayland-scanner 1.13.0 */ +// Hand-edited to resolve conflicts with xdg-shell stable + +#ifndef XDG_SHELL_UNSTABLE_V5_CLIENT_PROTOCOL_H +#define XDG_SHELL_UNSTABLE_V5_CLIENT_PROTOCOL_H + +#include +#include +#include "wayland-client.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @page page_xdg_shell_unstable_v5 The xdg_shell_unstable_v5 protocol + * @section page_ifaces_xdg_shell_unstable_v5 Interfaces + * - @subpage page_iface_xdg_shell_v5 - create desktop-style surfaces + * - @subpage page_iface_xdg_surface_v5 - A desktop window + * - @subpage page_iface_xdg_popup_v5 - short-lived, popup surfaces for menus + * @section page_copyright_xdg_shell_unstable_v5 Copyright + *
+ *
+ * Copyright © 2008-2013 Kristian Høgsberg
+ * Copyright © 2013      Rafael Antognolli
+ * Copyright © 2013      Jasper St. Pierre
+ * Copyright © 2010-2013 Intel Corporation
+ *
+ * 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.
+ * 
+ */ +struct wl_output; +struct wl_seat; +struct wl_surface; +struct xdg_popup_v5; +struct xdg_shell_v5; +struct xdg_surface_v5; + +/** + * @page page_iface_xdg_shell_v5 xdg_shell + * @section page_iface_xdg_shell_desc Description + * + * xdg_shell_v5 allows clients to turn a wl_surface into a "real window" + * which can be dragged, resized, stacked, and moved around by the + * user. Everything about this interface is suited towards traditional + * desktop environments. + * @section page_iface_xdg_shell_api API + * See @ref iface_xdg_shell. + */ +/** + * @defgroup iface_xdg_shell_v5 The xdg_shell_v5 interface + * + * xdg_shell_v5 allows clients to turn a wl_surface into a "real window" + * which can be dragged, resized, stacked, and moved around by the + * user. Everything about this interface is suited towards traditional + * desktop environments. + */ +extern const struct wl_interface xdg_shell_v5_interface; +/** + * @page page_iface_xdg_surface_v5 xdg_surface + * @section page_iface_xdg_surface_desc Description + * + * An interface that may be implemented by a wl_surface, for + * implementations that provide a desktop-style user interface. + * + * It provides requests to treat surfaces like windows, allowing to set + * properties like maximized, fullscreen, minimized, and to move and resize + * them, and associate metadata like title and app id. + * + * The client must call wl_surface.commit on the corresponding wl_surface + * for the xdg_surface_v5 state to take effect. Prior to committing the new + * state, it can set up initial configuration, such as maximizing or setting + * a window geometry. + * + * Even without attaching a buffer the compositor must respond to initial + * committed configuration, for instance sending a configure event with + * expected window geometry if the client maximized its surface during + * initialization. + * + * For a surface to be mapped by the compositor the client must have + * committed both an xdg_surface_v5 state and a buffer. + * @section page_iface_xdg_surface_api API + * See @ref iface_xdg_surface. + */ +/** + * @defgroup iface_xdg_surface_v5 The xdg_surface_v5 interface + * + * An interface that may be implemented by a wl_surface, for + * implementations that provide a desktop-style user interface. + * + * It provides requests to treat surfaces like windows, allowing to set + * properties like maximized, fullscreen, minimized, and to move and resize + * them, and associate metadata like title and app id. + * + * The client must call wl_surface.commit on the corresponding wl_surface + * for the xdg_surface_v5 state to take effect. Prior to committing the new + * state, it can set up initial configuration, such as maximizing or setting + * a window geometry. + * + * Even without attaching a buffer the compositor must respond to initial + * committed configuration, for instance sending a configure event with + * expected window geometry if the client maximized its surface during + * initialization. + * + * For a surface to be mapped by the compositor the client must have + * committed both an xdg_surface_v5 state and a buffer. + */ +extern const struct wl_interface xdg_surface_v5_interface; +/** + * @page page_iface_xdg_popup_v5 xdg_popup + * @section page_iface_xdg_popup_desc Description + * + * A popup surface is a short-lived, temporary surface that can be + * used to implement menus. It takes an explicit grab on the surface + * that will be dismissed when the user dismisses the popup. This can + * be done by the user clicking outside the surface, using the keyboard, + * or even locking the screen through closing the lid or a timeout. + * + * When the popup is dismissed, a popup_done event will be sent out, + * and at the same time the surface will be unmapped. The xdg_popup + * object is now inert and cannot be reactivated, so clients should + * destroy it. Explicitly destroying the xdg_popup_v5 object will also + * dismiss the popup and unmap the surface. + * + * Clients will receive events for all their surfaces during this + * grab (which is an "owner-events" grab in X11 parlance). This is + * done so that users can navigate through submenus and other + * "nested" popup windows without having to dismiss the topmost + * popup. + * + * Clients that want to dismiss the popup when another surface of + * their own is clicked should dismiss the popup using the destroy + * request. + * + * The parent surface must have either an xdg_surface_v5 or xdg_popup + * role. + * + * Specifying an xdg_popup_v5 for the parent means that the popups are + * nested, with this popup now being the topmost popup. Nested + * popups must be destroyed in the reverse order they were created + * in, e.g. the only popup you are allowed to destroy at all times + * is the topmost one. + * + * If there is an existing popup when creating a new popup, the + * parent must be the current topmost popup. + * + * A parent surface must be mapped before the new popup is mapped. + * + * When compositors choose to dismiss a popup, they will likely + * dismiss every nested popup as well. When a compositor dismisses + * popups, it will follow the same dismissing order as required + * from the client. + * + * The x and y arguments passed when creating the popup object specify + * where the top left of the popup should be placed, relative to the + * local surface coordinates of the parent surface. See + * xdg_shell.get_xdg_popup. + * + * The client must call wl_surface.commit on the corresponding wl_surface + * for the xdg_popup_v5 state to take effect. + * + * For a surface to be mapped by the compositor the client must have + * committed both the xdg_popup_v5 state and a buffer. + * @section page_iface_xdg_popup_api API + * See @ref iface_xdg_popup. + */ +/** + * @defgroup iface_xdg_popup_v5 The xdg_popup_v5 interface + * + * A popup surface is a short-lived, temporary surface that can be + * used to implement menus. It takes an explicit grab on the surface + * that will be dismissed when the user dismisses the popup. This can + * be done by the user clicking outside the surface, using the keyboard, + * or even locking the screen through closing the lid or a timeout. + * + * When the popup is dismissed, a popup_done event will be sent out, + * and at the same time the surface will be unmapped. The xdg_popup + * object is now inert and cannot be reactivated, so clients should + * destroy it. Explicitly destroying the xdg_popup_v5 object will also + * dismiss the popup and unmap the surface. + * + * Clients will receive events for all their surfaces during this + * grab (which is an "owner-events" grab in X11 parlance). This is + * done so that users can navigate through submenus and other + * "nested" popup windows without having to dismiss the topmost + * popup. + * + * Clients that want to dismiss the popup when another surface of + * their own is clicked should dismiss the popup using the destroy + * request. + * + * The parent surface must have either an xdg_surface_v5 or xdg_popup + * role. + * + * Specifying an xdg_popup_v5 for the parent means that the popups are + * nested, with this popup now being the topmost popup. Nested + * popups must be destroyed in the reverse order they were created + * in, e.g. the only popup you are allowed to destroy at all times + * is the topmost one. + * + * If there is an existing popup when creating a new popup, the + * parent must be the current topmost popup. + * + * A parent surface must be mapped before the new popup is mapped. + * + * When compositors choose to dismiss a popup, they will likely + * dismiss every nested popup as well. When a compositor dismisses + * popups, it will follow the same dismissing order as required + * from the client. + * + * The x and y arguments passed when creating the popup object specify + * where the top left of the popup should be placed, relative to the + * local surface coordinates of the parent surface. See + * xdg_shell.get_xdg_popup. + * + * The client must call wl_surface.commit on the corresponding wl_surface + * for the xdg_popup_v5 state to take effect. + * + * For a surface to be mapped by the compositor the client must have + * committed both the xdg_popup_v5 state and a buffer. + */ +extern const struct wl_interface xdg_popup_v5_interface; + +#ifndef XDG_SHELL_VERSION_ENUM +#define XDG_SHELL_VERSION_ENUM +/** + * @ingroup iface_xdg_shell + * latest protocol version + * + * The 'current' member of this enum gives the version of the + * protocol. Implementations can compare this to the version + * they implement using static_assert to ensure the protocol and + * implementation versions match. + */ +enum xdg_shell_version { + /** + * Always the latest version + */ + XDG_SHELL_VERSION_CURRENT = 5, +}; +#endif /* XDG_SHELL_VERSION_ENUM */ + +#ifndef XDG_SHELL_ERROR_ENUM +#define XDG_SHELL_ERROR_ENUM +enum xdg_shell_error { + /** + * given wl_surface has another role + */ + XDG_SHELL_ERROR_ROLE = 0, + /** + * xdg_shell_v5 was destroyed before children + */ + XDG_SHELL_ERROR_DEFUNCT_SURFACES = 1, + /** + * the client tried to map or destroy a non-topmost popup + */ + XDG_SHELL_ERROR_NOT_THE_TOPMOST_POPUP = 2, + /** + * the client specified an invalid popup parent surface + */ + XDG_SHELL_ERROR_INVALID_POPUP_PARENT = 3, +}; +#endif /* XDG_SHELL_ERROR_ENUM */ + +/** + * @ingroup iface_xdg_shell + * @struct xdg_shell_listener + */ +struct xdg_shell_listener { + /** + * check if the client is alive + * + * The ping event asks the client if it's still alive. Pass the + * serial specified in the event back to the compositor by sending + * a "pong" request back with the specified serial. + * + * Compositors can use this to determine if the client is still + * alive. It's unspecified what will happen if the client doesn't + * respond to the ping request, or in what timeframe. Clients + * should try to respond in a reasonable amount of time. + * + * A compositor is free to ping in any way it wants, but a client + * must always respond to any xdg_shell_v5 object it created. + * @param serial pass this to the pong request + */ + void (*ping)(void *data, + struct xdg_shell_v5 *xdg_shell_v5, + uint32_t serial); +}; + +/** + * @ingroup iface_xdg_shell + */ +static inline int +xdg_shell_add_listener(struct xdg_shell_v5 *xdg_shell, + const struct xdg_shell_listener *listener, void *data) +{ + return wl_proxy_add_listener((struct wl_proxy *) xdg_shell, + (void (**)(void)) listener, data); +} + +#define XDG_SHELL_DESTROY 0 +#define XDG_SHELL_USE_UNSTABLE_VERSION 1 +#define XDG_SHELL_GET_XDG_SURFACE 2 +#define XDG_SHELL_GET_XDG_POPUP 3 +#define XDG_SHELL_PONG 4 + +/** + * @ingroup iface_xdg_shell + */ +#define XDG_SHELL_PING_SINCE_VERSION 1 + +/** + * @ingroup iface_xdg_shell + */ +#define XDG_SHELL_DESTROY_SINCE_VERSION 1 +/** + * @ingroup iface_xdg_shell + */ +#define XDG_SHELL_USE_UNSTABLE_VERSION_SINCE_VERSION 1 +/** + * @ingroup iface_xdg_shell + */ +#define XDG_SHELL_GET_XDG_SURFACE_SINCE_VERSION 1 +/** + * @ingroup iface_xdg_shell + */ +#define XDG_SHELL_GET_XDG_POPUP_SINCE_VERSION 1 +/** + * @ingroup iface_xdg_shell + */ +#define XDG_SHELL_PONG_SINCE_VERSION 1 + +/** @ingroup iface_xdg_shell_v5 */ +static inline void +xdg_shell_set_user_data(struct xdg_shell_v5 *xdg_shell, void *user_data) +{ + wl_proxy_set_user_data((struct wl_proxy *) xdg_shell, user_data); +} + +/** @ingroup iface_xdg_shell_v5 */ +static inline void * +xdg_shell_get_user_data(struct xdg_shell_v5 *xdg_shell) +{ + return wl_proxy_get_user_data((struct wl_proxy *) xdg_shell); +} + +static inline uint32_t +xdg_shell_get_version(struct xdg_shell_v5 *xdg_shell) +{ + return wl_proxy_get_version((struct wl_proxy *) xdg_shell); +} + +/** + * @ingroup iface_xdg_shell + * + * Destroy this xdg_shell_v5 object. + * + * Destroying a bound xdg_shell_v5 object while there are surfaces + * still alive created by this xdg_shell_v5 object instance is illegal + * and will result in a protocol error. + */ +static inline void +xdg_shell_destroy(struct xdg_shell_v5 *xdg_shell) +{ + wl_proxy_marshal((struct wl_proxy *) xdg_shell, + XDG_SHELL_DESTROY); + + wl_proxy_destroy((struct wl_proxy *) xdg_shell); +} + +/** + * @ingroup iface_xdg_shell + * + * Negotiate the unstable version of the interface. This + * mechanism is in place to ensure client and server agree on the + * unstable versions of the protocol that they speak or exit + * cleanly if they don't agree. This request will go away once + * the xdg-shell protocol is stable. + */ +static inline void +xdg_shell_use_unstable_version(struct xdg_shell_v5 *xdg_shell, int32_t version) +{ + wl_proxy_marshal((struct wl_proxy *) xdg_shell, + XDG_SHELL_USE_UNSTABLE_VERSION, version); +} + +/** + * @ingroup iface_xdg_shell + * + * This creates an xdg_surface_v5 for the given surface and gives it the + * xdg_surface_v5 role. A wl_surface can only be given an xdg_surface_v5 role + * once. If get_xdg_surface_v5 is called with a wl_surface that already has + * an active xdg_surface_v5 associated with it, or if it had any other role, + * an error is raised. + * + * See the documentation of xdg_surface_v5 for more details about what an + * xdg_surface_v5 is and how it is used. + */ +static inline struct xdg_surface_v5 * +xdg_shell_get_xdg_surface(struct xdg_shell_v5 *xdg_shell, struct wl_surface *surface) +{ + struct wl_proxy *id; + + id = wl_proxy_marshal_constructor((struct wl_proxy *) xdg_shell, + XDG_SHELL_GET_XDG_SURFACE, &xdg_surface_v5_interface, NULL, surface); + + return (struct xdg_surface_v5 *) id; +} + +/** + * @ingroup iface_xdg_shell + * + * This creates an xdg_popup_v5 for the given surface and gives it the + * xdg_popup_v5 role. A wl_surface can only be given an xdg_popup_v5 role + * once. If get_xdg_popup_v5 is called with a wl_surface that already has + * an active xdg_popup_v5 associated with it, or if it had any other role, + * an error is raised. + * + * This request must be used in response to some sort of user action + * like a button press, key press, or touch down event. + * + * See the documentation of xdg_popup_v5 for more details about what an + * xdg_popup_v5 is and how it is used. + */ +static inline struct xdg_popup_v5 * +xdg_shell_get_xdg_popup(struct xdg_shell_v5 *xdg_shell, struct wl_surface *surface, struct wl_surface *parent, struct wl_seat *seat, uint32_t serial, int32_t x, int32_t y) +{ + struct wl_proxy *id; + + id = wl_proxy_marshal_constructor((struct wl_proxy *) xdg_shell, + XDG_SHELL_GET_XDG_POPUP, &xdg_popup_v5_interface, NULL, surface, parent, seat, serial, x, y); + + return (struct xdg_popup_v5 *) id; +} + +/** + * @ingroup iface_xdg_shell + * + * A client must respond to a ping event with a pong request or + * the client may be deemed unresponsive. + */ +static inline void +xdg_shell_pong(struct xdg_shell_v5 *xdg_shell, uint32_t serial) +{ + wl_proxy_marshal((struct wl_proxy *) xdg_shell, + XDG_SHELL_PONG, serial); +} + +#ifndef XDG_SURFACE_RESIZE_EDGE_ENUM +#define XDG_SURFACE_RESIZE_EDGE_ENUM +/** + * @ingroup iface_xdg_surface + * edge values for resizing + * + * These values are used to indicate which edge of a surface + * is being dragged in a resize operation. + */ +enum xdg_surface_resize_edge { + XDG_SURFACE_RESIZE_EDGE_NONE = 0, + XDG_SURFACE_RESIZE_EDGE_TOP = 1, + XDG_SURFACE_RESIZE_EDGE_BOTTOM = 2, + XDG_SURFACE_RESIZE_EDGE_LEFT = 4, + XDG_SURFACE_RESIZE_EDGE_TOP_LEFT = 5, + XDG_SURFACE_RESIZE_EDGE_BOTTOM_LEFT = 6, + XDG_SURFACE_RESIZE_EDGE_RIGHT = 8, + XDG_SURFACE_RESIZE_EDGE_TOP_RIGHT = 9, + XDG_SURFACE_RESIZE_EDGE_BOTTOM_RIGHT = 10, +}; +#endif /* XDG_SURFACE_RESIZE_EDGE_ENUM */ + +#ifndef XDG_SURFACE_STATE_ENUM +#define XDG_SURFACE_STATE_ENUM +/** + * @ingroup iface_xdg_surface + * types of state on the surface + * + * The different state values used on the surface. This is designed for + * state values like maximized, fullscreen. It is paired with the + * configure event to ensure that both the client and the compositor + * setting the state can be synchronized. + * + * States set in this way are double-buffered. They will get applied on + * the next commit. + * + * Desktop environments may extend this enum by taking up a range of + * values and documenting the range they chose in this description. + * They are not required to document the values for the range that they + * chose. Ideally, any good extensions from a desktop environment should + * make its way into standardization into this enum. + * + * The current reserved ranges are: + * + * 0x0000 - 0x0FFF: xdg-shell core values, documented below. + * 0x1000 - 0x1FFF: GNOME + */ +enum xdg_surface_state { + /** + * the surface is maximized + */ + XDG_SURFACE_STATE_MAXIMIZED = 1, + /** + * the surface is fullscreen + */ + XDG_SURFACE_STATE_FULLSCREEN = 2, + XDG_SURFACE_STATE_RESIZING = 3, + XDG_SURFACE_STATE_ACTIVATED = 4, +}; +#endif /* XDG_SURFACE_STATE_ENUM */ + +/** + * @ingroup iface_xdg_surface + * @struct xdg_surface_listener + */ +struct xdg_surface_listener { + /** + * suggest a surface change + * + * The configure event asks the client to resize its surface or + * to change its state. + * + * The width and height arguments specify a hint to the window + * about how its surface should be resized in window geometry + * coordinates. See set_window_geometry. + * + * If the width or height arguments are zero, it means the client + * should decide its own window dimension. This may happen when the + * compositor need to configure the state of the surface but + * doesn't have any information about any previous or expected + * dimension. + * + * The states listed in the event specify how the width/height + * arguments should be interpreted, and possibly how it should be + * drawn. + * + * Clients should arrange their surface for the new size and + * states, and then send a ack_configure request with the serial + * sent in this configure event at some point before committing the + * new surface. + * + * If the client receives multiple configure events before it can + * respond to one, it is free to discard all but the last event it + * received. + */ + void (*configure)(void *data, + struct xdg_surface_v5 *xdg_surface_v5, + int32_t width, + int32_t height, + struct wl_array *states, + uint32_t serial); + /** + * surface wants to be closed + * + * The close event is sent by the compositor when the user wants + * the surface to be closed. This should be equivalent to the user + * clicking the close button in client-side decorations, if your + * application has any... + * + * This is only a request that the user intends to close your + * window. The client may choose to ignore this request, or show a + * dialog to ask the user to save their data... + */ + void (*close)(void *data, + struct xdg_surface_v5 *xdg_surface_v5); +}; + +/** + * @ingroup iface_xdg_surface + */ +static inline int +xdg_surface_add_listener(struct xdg_surface_v5 *xdg_surface, + const struct xdg_surface_listener *listener, void *data) +{ + return wl_proxy_add_listener((struct wl_proxy *) xdg_surface, + (void (**)(void)) listener, data); +} + +#define XDG_SURFACE_DESTROY 0 +#define XDG_SURFACE_SET_PARENT 1 +#define XDG_SURFACE_SET_TITLE 2 +#define XDG_SURFACE_SET_APP_ID 3 +#define XDG_SURFACE_SHOW_WINDOW_MENU 4 +#define XDG_SURFACE_MOVE 5 +#define XDG_SURFACE_RESIZE 6 +#define XDG_SURFACE_ACK_CONFIGURE 7 +#define XDG_SURFACE_SET_WINDOW_GEOMETRY 8 +#define XDG_SURFACE_SET_MAXIMIZED 9 +#define XDG_SURFACE_UNSET_MAXIMIZED 10 +#define XDG_SURFACE_SET_FULLSCREEN 11 +#define XDG_SURFACE_UNSET_FULLSCREEN 12 +#define XDG_SURFACE_SET_MINIMIZED 13 + +/** + * @ingroup iface_xdg_surface + */ +#define XDG_SURFACE_CONFIGURE_SINCE_VERSION 1 +/** + * @ingroup iface_xdg_surface + */ +#define XDG_SURFACE_CLOSE_SINCE_VERSION 1 + +/** + * @ingroup iface_xdg_surface + */ +#define XDG_SURFACE_DESTROY_SINCE_VERSION 1 +/** + * @ingroup iface_xdg_surface + */ +#define XDG_SURFACE_SET_PARENT_SINCE_VERSION 1 +/** + * @ingroup iface_xdg_surface + */ +#define XDG_SURFACE_SET_TITLE_SINCE_VERSION 1 +/** + * @ingroup iface_xdg_surface + */ +#define XDG_SURFACE_SET_APP_ID_SINCE_VERSION 1 +/** + * @ingroup iface_xdg_surface + */ +#define XDG_SURFACE_SHOW_WINDOW_MENU_SINCE_VERSION 1 +/** + * @ingroup iface_xdg_surface + */ +#define XDG_SURFACE_MOVE_SINCE_VERSION 1 +/** + * @ingroup iface_xdg_surface + */ +#define XDG_SURFACE_RESIZE_SINCE_VERSION 1 +/** + * @ingroup iface_xdg_surface + */ +#define XDG_SURFACE_ACK_CONFIGURE_SINCE_VERSION 1 +/** + * @ingroup iface_xdg_surface + */ +#define XDG_SURFACE_SET_WINDOW_GEOMETRY_SINCE_VERSION 1 +/** + * @ingroup iface_xdg_surface + */ +#define XDG_SURFACE_SET_MAXIMIZED_SINCE_VERSION 1 +/** + * @ingroup iface_xdg_surface + */ +#define XDG_SURFACE_UNSET_MAXIMIZED_SINCE_VERSION 1 +/** + * @ingroup iface_xdg_surface + */ +#define XDG_SURFACE_SET_FULLSCREEN_SINCE_VERSION 1 +/** + * @ingroup iface_xdg_surface + */ +#define XDG_SURFACE_UNSET_FULLSCREEN_SINCE_VERSION 1 +/** + * @ingroup iface_xdg_surface + */ +#define XDG_SURFACE_SET_MINIMIZED_SINCE_VERSION 1 + +/** @ingroup iface_xdg_surface_v5 */ +static inline void +xdg_surface_set_user_data(struct xdg_surface_v5 *xdg_surface, void *user_data) +{ + wl_proxy_set_user_data((struct wl_proxy *) xdg_surface, user_data); +} + +/** @ingroup iface_xdg_surface_v5 */ +static inline void * +xdg_surface_get_user_data(struct xdg_surface_v5 *xdg_surface) +{ + return wl_proxy_get_user_data((struct wl_proxy *) xdg_surface); +} + +static inline uint32_t +xdg_surface_get_version(struct xdg_surface_v5 *xdg_surface) +{ + return wl_proxy_get_version((struct wl_proxy *) xdg_surface); +} + +/** + * @ingroup iface_xdg_surface + * + * Unmap and destroy the window. The window will be effectively + * hidden from the user's point of view, and all state like + * maximization, fullscreen, and so on, will be lost. + */ +static inline void +xdg_surface_destroy(struct xdg_surface_v5 *xdg_surface) +{ + wl_proxy_marshal((struct wl_proxy *) xdg_surface, + XDG_SURFACE_DESTROY); + + wl_proxy_destroy((struct wl_proxy *) xdg_surface); +} + +/** + * @ingroup iface_xdg_surface + * + * Set the "parent" of this surface. This window should be stacked + * above a parent. The parent surface must be mapped as long as this + * surface is mapped. + * + * Parent windows should be set on dialogs, toolboxes, or other + * "auxiliary" surfaces, so that the parent is raised when the dialog + * is raised. + */ +static inline void +xdg_surface_set_parent(struct xdg_surface_v5 *xdg_surface, struct xdg_surface_v5 *parent) +{ + wl_proxy_marshal((struct wl_proxy *) xdg_surface, + XDG_SURFACE_SET_PARENT, parent); +} + +/** + * @ingroup iface_xdg_surface + * + * Set a short title for the surface. + * + * This string may be used to identify the surface in a task bar, + * window list, or other user interface elements provided by the + * compositor. + * + * The string must be encoded in UTF-8. + */ +static inline void +xdg_surface_set_title(struct xdg_surface_v5 *xdg_surface, const char *title) +{ + wl_proxy_marshal((struct wl_proxy *) xdg_surface, + XDG_SURFACE_SET_TITLE, title); +} + +/** + * @ingroup iface_xdg_surface + * + * Set an application identifier for the surface. + * + * The app ID identifies the general class of applications to which + * the surface belongs. The compositor can use this to group multiple + * surfaces together, or to determine how to launch a new application. + * + * For D-Bus activatable applications, the app ID is used as the D-Bus + * service name. + * + * The compositor shell will try to group application surfaces together + * by their app ID. As a best practice, it is suggested to select app + * ID's that match the basename of the application's .desktop file. + * For example, "org.freedesktop.FooViewer" where the .desktop file is + * "org.freedesktop.FooViewer.desktop". + * + * See the desktop-entry specification [0] for more details on + * application identifiers and how they relate to well-known D-Bus + * names and .desktop files. + * + * [0] http://standards.freedesktop.org/desktop-entry-spec/ + */ +static inline void +xdg_surface_set_app_id(struct xdg_surface_v5 *xdg_surface, const char *app_id) +{ + wl_proxy_marshal((struct wl_proxy *) xdg_surface, + XDG_SURFACE_SET_APP_ID, app_id); +} + +/** + * @ingroup iface_xdg_surface + * + * Clients implementing client-side decorations might want to show + * a context menu when right-clicking on the decorations, giving the + * user a menu that they can use to maximize or minimize the window. + * + * This request asks the compositor to pop up such a window menu at + * the given position, relative to the local surface coordinates of + * the parent surface. There are no guarantees as to what menu items + * the window menu contains. + * + * This request must be used in response to some sort of user action + * like a button press, key press, or touch down event. + */ +static inline void +xdg_surface_show_window_menu(struct xdg_surface_v5 *xdg_surface, struct wl_seat *seat, uint32_t serial, int32_t x, int32_t y) +{ + wl_proxy_marshal((struct wl_proxy *) xdg_surface, + XDG_SURFACE_SHOW_WINDOW_MENU, seat, serial, x, y); +} + +/** + * @ingroup iface_xdg_surface + * + * Start an interactive, user-driven move of the surface. + * + * This request must be used in response to some sort of user action + * like a button press, key press, or touch down event. The passed + * serial is used to determine the type of interactive move (touch, + * pointer, etc). + * + * The server may ignore move requests depending on the state of + * the surface (e.g. fullscreen or maximized), or if the passed serial + * is no longer valid. + * + * If triggered, the surface will lose the focus of the device + * (wl_pointer, wl_touch, etc) used for the move. It is up to the + * compositor to visually indicate that the move is taking place, such as + * updating a pointer cursor, during the move. There is no guarantee + * that the device focus will return when the move is completed. + */ +static inline void +xdg_surface_move(struct xdg_surface_v5 *xdg_surface, struct wl_seat *seat, uint32_t serial) +{ + wl_proxy_marshal((struct wl_proxy *) xdg_surface, + XDG_SURFACE_MOVE, seat, serial); +} + +/** + * @ingroup iface_xdg_surface + * + * Start a user-driven, interactive resize of the surface. + * + * This request must be used in response to some sort of user action + * like a button press, key press, or touch down event. The passed + * serial is used to determine the type of interactive resize (touch, + * pointer, etc). + * + * The server may ignore resize requests depending on the state of + * the surface (e.g. fullscreen or maximized). + * + * If triggered, the client will receive configure events with the + * "resize" state enum value and the expected sizes. See the "resize" + * enum value for more details about what is required. The client + * must also acknowledge configure events using "ack_configure". After + * the resize is completed, the client will receive another "configure" + * event without the resize state. + * + * If triggered, the surface also will lose the focus of the device + * (wl_pointer, wl_touch, etc) used for the resize. It is up to the + * compositor to visually indicate that the resize is taking place, + * such as updating a pointer cursor, during the resize. There is no + * guarantee that the device focus will return when the resize is + * completed. + * + * The edges parameter specifies how the surface should be resized, + * and is one of the values of the resize_edge enum. The compositor + * may use this information to update the surface position for + * example when dragging the top left corner. The compositor may also + * use this information to adapt its behavior, e.g. choose an + * appropriate cursor image. + */ +static inline void +xdg_surface_resize(struct xdg_surface_v5 *xdg_surface, struct wl_seat *seat, uint32_t serial, uint32_t edges) +{ + wl_proxy_marshal((struct wl_proxy *) xdg_surface, + XDG_SURFACE_RESIZE, seat, serial, edges); +} + +/** + * @ingroup iface_xdg_surface + * + * When a configure event is received, if a client commits the + * surface in response to the configure event, then the client + * must make a ack_configure request before the commit request, + * passing along the serial of the configure event. + * + * For instance, the compositor might use this information to move + * a surface to the top left only when the client has drawn itself + * for the maximized or fullscreen state. + * + * If the client receives multiple configure events before it + * can respond to one, it only has to ack the last configure event. + */ +static inline void +xdg_surface_ack_configure(struct xdg_surface_v5 *xdg_surface, uint32_t serial) +{ + wl_proxy_marshal((struct wl_proxy *) xdg_surface, + XDG_SURFACE_ACK_CONFIGURE, serial); +} + +/** + * @ingroup iface_xdg_surface + * + * The window geometry of a window is its "visible bounds" from the + * user's perspective. Client-side decorations often have invisible + * portions like drop-shadows which should be ignored for the + * purposes of aligning, placing and constraining windows. + * + * The window geometry is double buffered, and will be applied at the + * time wl_surface.commit of the corresponding wl_surface is called. + * + * Once the window geometry of the surface is set once, it is not + * possible to unset it, and it will remain the same until + * set_window_geometry is called again, even if a new subsurface or + * buffer is attached. + * + * If never set, the value is the full bounds of the surface, + * including any subsurfaces. This updates dynamically on every + * commit. This unset mode is meant for extremely simple clients. + * + * If responding to a configure event, the window geometry in here + * must respect the sizing negotiations specified by the states in + * the configure event. + * + * The arguments are given in the surface local coordinate space of + * the wl_surface associated with this xdg_surface. + * + * The width and height must be greater than zero. + */ +static inline void +xdg_surface_set_window_geometry(struct xdg_surface_v5 *xdg_surface, int32_t x, int32_t y, int32_t width, int32_t height) +{ + wl_proxy_marshal((struct wl_proxy *) xdg_surface, + XDG_SURFACE_SET_WINDOW_GEOMETRY, x, y, width, height); +} + +/** + * @ingroup iface_xdg_surface + * + * Maximize the surface. + * + * After requesting that the surface should be maximized, the compositor + * will respond by emitting a configure event with the "maximized" state + * and the required window geometry. The client should then update its + * content, drawing it in a maximized state, i.e. without shadow or other + * decoration outside of the window geometry. The client must also + * acknowledge the configure when committing the new content (see + * ack_configure). + * + * It is up to the compositor to decide how and where to maximize the + * surface, for example which output and what region of the screen should + * be used. + * + * If the surface was already maximized, the compositor will still emit + * a configure event with the "maximized" state. + */ +static inline void +xdg_surface_set_maximized(struct xdg_surface_v5 *xdg_surface) +{ + wl_proxy_marshal((struct wl_proxy *) xdg_surface, + XDG_SURFACE_SET_MAXIMIZED); +} + +/** + * @ingroup iface_xdg_surface + * + * Unmaximize the surface. + * + * After requesting that the surface should be unmaximized, the compositor + * will respond by emitting a configure event without the "maximized" + * state. If available, the compositor will include the window geometry + * dimensions the window had prior to being maximized in the configure + * request. The client must then update its content, drawing it in a + * regular state, i.e. potentially with shadow, etc. The client must also + * acknowledge the configure when committing the new content (see + * ack_configure). + * + * It is up to the compositor to position the surface after it was + * unmaximized; usually the position the surface had before maximizing, if + * applicable. + * + * If the surface was already not maximized, the compositor will still + * emit a configure event without the "maximized" state. + */ +static inline void +xdg_surface_unset_maximized(struct xdg_surface_v5 *xdg_surface) +{ + wl_proxy_marshal((struct wl_proxy *) xdg_surface, + XDG_SURFACE_UNSET_MAXIMIZED); +} + +/** + * @ingroup iface_xdg_surface + * + * Make the surface fullscreen. + * + * You can specify an output that you would prefer to be fullscreen. + * If this value is NULL, it's up to the compositor to choose which + * display will be used to map this surface. + * + * If the surface doesn't cover the whole output, the compositor will + * position the surface in the center of the output and compensate with + * black borders filling the rest of the output. + */ +static inline void +xdg_surface_set_fullscreen(struct xdg_surface_v5 *xdg_surface, struct wl_output *output) +{ + wl_proxy_marshal((struct wl_proxy *) xdg_surface, + XDG_SURFACE_SET_FULLSCREEN, output); +} + +/** + * @ingroup iface_xdg_surface + */ +static inline void +xdg_surface_unset_fullscreen(struct xdg_surface_v5 *xdg_surface) +{ + wl_proxy_marshal((struct wl_proxy *) xdg_surface, + XDG_SURFACE_UNSET_FULLSCREEN); +} + +/** + * @ingroup iface_xdg_surface + * + * Request that the compositor minimize your surface. There is no + * way to know if the surface is currently minimized, nor is there + * any way to unset minimization on this surface. + * + * If you are looking to throttle redrawing when minimized, please + * instead use the wl_surface.frame event for this, as this will + * also work with live previews on windows in Alt-Tab, Expose or + * similar compositor features. + */ +static inline void +xdg_surface_set_minimized(struct xdg_surface_v5 *xdg_surface) +{ + wl_proxy_marshal((struct wl_proxy *) xdg_surface, + XDG_SURFACE_SET_MINIMIZED); +} + +/** + * @ingroup iface_xdg_popup + * @struct xdg_popup_listener + */ +struct xdg_popup_listener { + /** + * popup interaction is done + * + * The popup_done event is sent out when a popup is dismissed by + * the compositor. The client should destroy the xdg_popup_v5 object + * at this point. + */ + void (*popup_done)(void *data, + struct xdg_popup_v5 *xdg_popup_v5); +}; + +/** + * @ingroup iface_xdg_popup + */ +static inline int +xdg_popup_add_listener(struct xdg_popup_v5 *xdg_popup, + const struct xdg_popup_listener *listener, void *data) +{ + return wl_proxy_add_listener((struct wl_proxy *) xdg_popup, + (void (**)(void)) listener, data); +} + +#define XDG_POPUP_DESTROY 0 + +/** + * @ingroup iface_xdg_popup + */ +#define XDG_POPUP_POPUP_DONE_SINCE_VERSION 1 + +/** + * @ingroup iface_xdg_popup + */ +#define XDG_POPUP_DESTROY_SINCE_VERSION 1 + +/** @ingroup iface_xdg_popup_v5 */ +static inline void +xdg_popup_set_user_data(struct xdg_popup_v5 *xdg_popup, void *user_data) +{ + wl_proxy_set_user_data((struct wl_proxy *) xdg_popup, user_data); +} + +/** @ingroup iface_xdg_popup_v5 */ +static inline void * +xdg_popup_get_user_data(struct xdg_popup_v5 *xdg_popup) +{ + return wl_proxy_get_user_data((struct wl_proxy *) xdg_popup); +} + +static inline uint32_t +xdg_popup_get_version(struct xdg_popup_v5 *xdg_popup) +{ + return wl_proxy_get_version((struct wl_proxy *) xdg_popup); +} + +/** + * @ingroup iface_xdg_popup + * + * This destroys the popup. Explicitly destroying the xdg_popup + * object will also dismiss the popup, and unmap the surface. + * + * If this xdg_popup_v5 is not the "topmost" popup, a protocol error + * will be sent. + */ +static inline void +xdg_popup_destroy(struct xdg_popup_v5 *xdg_popup) +{ + wl_proxy_marshal((struct wl_proxy *) xdg_popup, + XDG_POPUP_DESTROY); + + wl_proxy_destroy((struct wl_proxy *) xdg_popup); +} + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/pregenerated/3rdparty/wayland-xdg-shell-unstable-v5-protocol.c b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/pregenerated/3rdparty/wayland-xdg-shell-unstable-v5-protocol.c new file mode 100644 index 00000000000..50a42437cf5 --- /dev/null +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/pregenerated/3rdparty/wayland-xdg-shell-unstable-v5-protocol.c @@ -0,0 +1,126 @@ +/* Generated by wayland-scanner 1.13.0 */ +// Hand-edited to resolve conflicts with xdg-shell stable + +/* + * Copyright © 2008-2013 Kristian Høgsberg + * Copyright © 2013 Rafael Antognolli + * Copyright © 2013 Jasper St. Pierre + * Copyright © 2010-2013 Intel Corporation + * + * 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 +#include +#include "wayland-util.h" + +extern const struct wl_interface wl_output_interface; +extern const struct wl_interface wl_seat_interface; +extern const struct wl_interface wl_surface_interface; +extern const struct wl_interface xdg_popup_v5_interface; +extern const struct wl_interface xdg_surface_v5_interface; + +static const struct wl_interface *types[] = { + NULL, + NULL, + NULL, + NULL, + &xdg_surface_v5_interface, + &wl_surface_interface, + &xdg_popup_v5_interface, + &wl_surface_interface, + &wl_surface_interface, + &wl_seat_interface, + NULL, + NULL, + NULL, + &xdg_surface_v5_interface, + &wl_seat_interface, + NULL, + NULL, + NULL, + &wl_seat_interface, + NULL, + &wl_seat_interface, + NULL, + NULL, + &wl_output_interface, +}; + +static const struct wl_message xdg_shell_requests[] = { + { "destroy", "", types + 0 }, + { "use_unstable_version", "i", types + 0 }, + { "get_xdg_surface", "no", types + 4 }, + { "get_xdg_popup", "nooouii", types + 6 }, + { "pong", "u", types + 0 }, +}; + +static const struct wl_message xdg_shell_events[] = { + { "ping", "u", types + 0 }, +}; + +WL_EXPORT const struct wl_interface xdg_shell_v5_interface = { + "xdg_shell", 1, + 5, xdg_shell_requests, + 1, xdg_shell_events, +}; + +static const struct wl_message xdg_surface_requests[] = { + { "destroy", "", types + 0 }, + { "set_parent", "?o", types + 13 }, + { "set_title", "s", types + 0 }, + { "set_app_id", "s", types + 0 }, + { "show_window_menu", "ouii", types + 14 }, + { "move", "ou", types + 18 }, + { "resize", "ouu", types + 20 }, + { "ack_configure", "u", types + 0 }, + { "set_window_geometry", "iiii", types + 0 }, + { "set_maximized", "", types + 0 }, + { "unset_maximized", "", types + 0 }, + { "set_fullscreen", "?o", types + 23 }, + { "unset_fullscreen", "", types + 0 }, + { "set_minimized", "", types + 0 }, +}; + +static const struct wl_message xdg_surface_events[] = { + { "configure", "iiau", types + 0 }, + { "close", "", types + 0 }, +}; + +WL_EXPORT const struct wl_interface xdg_surface_v5_interface = { + "xdg_surface", 1, + 14, xdg_surface_requests, + 2, xdg_surface_events, +}; + +static const struct wl_message xdg_popup_requests[] = { + { "destroy", "", types + 0 }, +}; + +static const struct wl_message xdg_popup_events[] = { + { "popup_done", "", types + 0 }, +}; + +WL_EXPORT const struct wl_interface xdg_popup_v5_interface = { + "xdg_popup", 1, + 1, xdg_popup_requests, + 1, xdg_popup_events, +}; + diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/pregenerated/xdg-shell-v5.pri b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/pregenerated/xdg-shell-v5.pri new file mode 100644 index 00000000000..2990fd0f669 --- /dev/null +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/pregenerated/xdg-shell-v5.pri @@ -0,0 +1,12 @@ +# Putting pregenerated files in a 3rdparty directory to avoid +# qtqa's license checking failing. + +HEADERS += \ + $$PWD/3rdparty/qwayland-xdg-shell-unstable-v5_p.h \ + $$PWD/3rdparty/wayland-xdg-shell-unstable-v5-client-protocol_p.h + +SOURCES += \ + $$PWD/3rdparty/qwayland-xdg-shell-unstable-v5.cpp \ + $$PWD/3rdparty/wayland-xdg-shell-unstable-v5-protocol.c + +INCLUDEPATH += $$PWD/3rdparty diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgpopupv5.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgpopupv5.cpp index 539abcac78c..85d25e3c07a 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgpopupv5.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgpopupv5.cpp @@ -47,9 +47,9 @@ QT_BEGIN_NAMESPACE namespace QtWaylandClient { -QWaylandXdgPopupV5::QWaylandXdgPopupV5(struct ::xdg_popup *popup, QWaylandWindow *window) +QWaylandXdgPopupV5::QWaylandXdgPopupV5(struct ::xdg_popup_v5 *popup, QWaylandWindow *window) : QWaylandShellSurface(window) - , QtWayland::xdg_popup(popup) + , QtWayland::xdg_popup_v5(popup) , m_window(window) { if (window->display()->windowExtension()) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgpopupv5_p.h b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgpopupv5_p.h index cb748c5ccb7..ff8e5639f63 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgpopupv5_p.h +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgpopupv5_p.h @@ -51,7 +51,7 @@ // We mean it. // -#include "qwayland-xdg-shell-unstable-v5.h" +#include "qwayland-xdg-shell-unstable-v5_p.h" #include @@ -68,11 +68,11 @@ class QWaylandWindow; class QWaylandExtendedSurface; class Q_WAYLAND_CLIENT_EXPORT QWaylandXdgPopupV5 : public QWaylandShellSurface - , public QtWayland::xdg_popup + , public QtWayland::xdg_popup_v5 { Q_OBJECT public: - QWaylandXdgPopupV5(struct ::xdg_popup *popup, QWaylandWindow *window); + QWaylandXdgPopupV5(struct ::xdg_popup_v5 *popup, QWaylandWindow *window); ~QWaylandXdgPopupV5() override; protected: diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshellv5.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshellv5.cpp index 6a693578cfa..b893b36b281 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshellv5.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshellv5.cpp @@ -52,15 +52,15 @@ QT_BEGIN_NAMESPACE namespace QtWaylandClient { -QWaylandXdgShellV5::QWaylandXdgShellV5(struct ::xdg_shell *shell) - : QtWayland::xdg_shell(shell) +QWaylandXdgShellV5::QWaylandXdgShellV5(struct ::xdg_shell_v5 *shell) + : QtWayland::xdg_shell_v5(shell) { } QWaylandXdgShellV5::QWaylandXdgShellV5(struct ::wl_registry *registry, uint32_t id) - : QtWayland::xdg_shell(registry, id, 1) + : QtWayland::xdg_shell_v5(registry, id, 1) { - use_unstable_version(QtWayland::xdg_shell::version_current); + use_unstable_version(QtWayland::xdg_shell_v5::version_current); } QWaylandXdgShellV5::~QWaylandXdgShellV5() diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshellv5_p.h b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshellv5_p.h index ec45bb32c90..5e3badeed73 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshellv5_p.h +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshellv5_p.h @@ -51,7 +51,7 @@ // We mean it. // -#include "qwayland-xdg-shell-unstable-v5.h" +#include "qwayland-xdg-shell-unstable-v5_p.h" #include #include @@ -72,10 +72,10 @@ class QWaylandInputDevice; class QWaylandXdgSurfaceV5; class QWaylandXdgPopupV5; -class Q_WAYLAND_CLIENT_EXPORT QWaylandXdgShellV5 : public QtWayland::xdg_shell +class Q_WAYLAND_CLIENT_EXPORT QWaylandXdgShellV5 : public QtWayland::xdg_shell_v5 { public: - QWaylandXdgShellV5(struct ::xdg_shell *shell); + QWaylandXdgShellV5(struct ::xdg_shell_v5 *shell); QWaylandXdgShellV5(struct ::wl_registry *registry, uint32_t id); ~QWaylandXdgShellV5() override; diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgsurfacev5.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgsurfacev5.cpp index 40e2a994daa..61a865cb211 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgsurfacev5.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgsurfacev5.cpp @@ -54,7 +54,7 @@ namespace QtWaylandClient { QWaylandXdgSurfaceV5::QWaylandXdgSurfaceV5(QWaylandXdgShellV5 *shell, QWaylandWindow *window) : QWaylandShellSurface(window) - , QtWayland::xdg_surface(shell->get_xdg_surface(window->object())) + , QtWayland::xdg_surface_v5(shell->get_xdg_surface(window->object())) , m_window(window) , m_shell(shell) { @@ -105,12 +105,12 @@ void QWaylandXdgSurfaceV5::updateTransientParent(QWaylandWindow *parent) void QWaylandXdgSurfaceV5::setTitle(const QString & title) { - return QtWayland::xdg_surface::set_title(title); + return QtWayland::xdg_surface_v5::set_title(title); } void QWaylandXdgSurfaceV5::setAppId(const QString & appId) { - return QtWayland::xdg_surface::set_app_id(appId); + return QtWayland::xdg_surface_v5::set_app_id(appId); } void QWaylandXdgSurfaceV5::raise() diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgsurfacev5_p.h b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgsurfacev5_p.h index e69433248e5..b938047eccd 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgsurfacev5_p.h +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgsurfacev5_p.h @@ -51,7 +51,7 @@ // We mean it. // -#include "qwayland-xdg-shell-unstable-v5.h" +#include "qwayland-xdg-shell-unstable-v5_p.h" #include #include @@ -73,19 +73,19 @@ class QWaylandExtendedSurface; class QWaylandXdgShellV5; class Q_WAYLAND_CLIENT_EXPORT QWaylandXdgSurfaceV5 : public QWaylandShellSurface - , public QtWayland::xdg_surface + , public QtWayland::xdg_surface_v5 { Q_OBJECT public: QWaylandXdgSurfaceV5(QWaylandXdgShellV5 *shell, QWaylandWindow *window); ~QWaylandXdgSurfaceV5() override; - using QtWayland::xdg_surface::resize; + using QtWayland::xdg_surface_v5::resize; void resize(QWaylandInputDevice *inputDevice, enum resize_edge edges); void resize(QWaylandInputDevice *inputDevice, enum wl_shell_surface_resize edges) override; - using QtWayland::xdg_surface::move; + using QtWayland::xdg_surface_v5::move; bool move(QWaylandInputDevice *inputDevice) override; void setTitle(const QString &title) override; diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/xdg-shell-v5.pro b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/xdg-shell-v5.pro index 0e97832e493..bf9edba7842 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/xdg-shell-v5.pro +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/xdg-shell-v5.pro @@ -6,9 +6,6 @@ QMAKE_USE += wayland-client qtConfig(xkbcommon-evdev): \ QMAKE_USE += xkbcommon_evdev -WAYLANDCLIENTSOURCES += \ - ../../../3rdparty/protocol/xdg-shell-unstable-v5.xml - HEADERS += \ qwaylandxdgpopupv5_p.h \ qwaylandxdgshellv5_p.h \ @@ -22,6 +19,8 @@ SOURCES += \ qwaylandxdgshellv5integration.cpp \ qwaylandxdgsurfacev5.cpp \ +include (pregenerated/xdg-shell-v5.pri) + OTHER_FILES += \ xdg-shell-v5.json From 8f582e8e0b8d22f35ca6439cdc28b3a7c93ce3d3 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Wed, 22 Aug 2018 13:23:20 +0200 Subject: [PATCH 0581/1507] Client: Remove unused constructor for xdg-shell v5 Change-Id: Idcb2220237b3dba0a296fbb9a86497a3d0022d5f Reviewed-by: Paul Olav Tvete --- .../shellintegration/xdg-shell-v5/qwaylandxdgshellv5.cpp | 5 ----- .../shellintegration/xdg-shell-v5/qwaylandxdgshellv5_p.h | 1 - 2 files changed, 6 deletions(-) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshellv5.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshellv5.cpp index b893b36b281..4cbafbd71b5 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshellv5.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshellv5.cpp @@ -52,11 +52,6 @@ QT_BEGIN_NAMESPACE namespace QtWaylandClient { -QWaylandXdgShellV5::QWaylandXdgShellV5(struct ::xdg_shell_v5 *shell) - : QtWayland::xdg_shell_v5(shell) -{ -} - QWaylandXdgShellV5::QWaylandXdgShellV5(struct ::wl_registry *registry, uint32_t id) : QtWayland::xdg_shell_v5(registry, id, 1) { diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshellv5_p.h b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshellv5_p.h index 5e3badeed73..67e5d32a7a3 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshellv5_p.h +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshellv5_p.h @@ -75,7 +75,6 @@ class QWaylandXdgPopupV5; class Q_WAYLAND_CLIENT_EXPORT QWaylandXdgShellV5 : public QtWayland::xdg_shell_v5 { public: - QWaylandXdgShellV5(struct ::xdg_shell_v5 *shell); QWaylandXdgShellV5(struct ::wl_registry *registry, uint32_t id); ~QWaylandXdgShellV5() override; From 108bd7ca2639ec6ce1e2cf2dcb5a917321a90487 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Fri, 7 Sep 2018 12:21:15 +0200 Subject: [PATCH 0582/1507] Prefix and suffix server buffer integrations [ChangeLog][Compositor] Features for server buffer integrations have been renamed. "drm-egl-server" is now "wayland-drm-egl-server-buffer" and "libhybris-egl-server" is "wayland-libhybris-egl-server-buffer". Change-Id: I06a9d1b1c9219c88045fe966be134ff072cd756e Reviewed-by: Paul Olav Tvete --- src/plugins/platforms/wayland/configure.json | 8 ++++---- .../wayland/plugins/hardwareintegration/client.pro | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/plugins/platforms/wayland/configure.json b/src/plugins/platforms/wayland/configure.json index b11416f688b..02c36de1075 100644 --- a/src/plugins/platforms/wayland/configure.json +++ b/src/plugins/platforms/wayland/configure.json @@ -101,12 +101,12 @@ "condition": "features.wayland-client && features.opengl && !features.opengles2 && features.xlib && libs.xcomposite && libs.glx", "output": [ "privateFeature" ] }, - "drm-egl-server": { + "wayland-drm-egl-server-buffer": { "label": "DRM EGL", "condition": "features.wayland-client && features.opengl && features.egl && tests.drm-egl-server", "output": [ "privateFeature" ] }, - "libhybris-egl-server": { + "wayland-libhybris-egl-server-buffer": { "label": "libhybris EGL", "condition": "features.wayland-client && features.opengl && features.egl && tests.libhybris-egl-server", "output": [ "privateFeature" ] @@ -130,8 +130,8 @@ "wayland-brcm", "xcomposite-egl", "xcomposite-glx", - "drm-egl-server", - "libhybris-egl-server" + "wayland-drm-egl-server-buffer", + "wayland-libhybris-egl-server-buffer" ] }, "wayland-client" diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/client.pro b/src/plugins/platforms/wayland/plugins/hardwareintegration/client.pro index f1c71f08455..8001c9de6c0 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/client.pro +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/client.pro @@ -9,9 +9,9 @@ qtConfig(xcomposite-egl): \ SUBDIRS += xcomposite-egl qtConfig(xcomposite-glx): \ SUBDIRS += xcomposite-glx -qtConfig(drm-egl-server): \ +qtConfig(wayland-drm-egl-server-buffer): \ SUBDIRS += drm-egl-server -qtConfig(libhybris-egl-server): \ +qtConfig(wayland-libhybris-egl-server-buffer): \ SUBDIRS += libhybris-egl-server ### TODO: make shm-emulation configurable From a9f0ac5e33a9c88816b1730a2864379a5a5a3842 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Wed, 5 Sep 2018 15:09:14 +0200 Subject: [PATCH 0583/1507] Create feature wayland-shm-emulation-server-buffer And make OpenGL a requirement, in order to make builds without OpenGL work again. Fixes: QTBUG-69779 Change-Id: Iff1153b0aaca8e115f47c59c2ceb028e638e3fe9 Reviewed-by: Paul Olav Tvete --- src/plugins/platforms/wayland/configure.json | 8 +++++++- .../wayland/plugins/hardwareintegration/client.pro | 6 +++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/plugins/platforms/wayland/configure.json b/src/plugins/platforms/wayland/configure.json index 02c36de1075..ef5e87bb7e5 100644 --- a/src/plugins/platforms/wayland/configure.json +++ b/src/plugins/platforms/wayland/configure.json @@ -110,6 +110,11 @@ "label": "libhybris EGL", "condition": "features.wayland-client && features.opengl && features.egl && tests.libhybris-egl-server", "output": [ "privateFeature" ] + }, + "wayland-shm-emulation-server-buffer": { + "label": "Shm emulation server buffer integration", + "condition": "features.wayland-client && features.opengl", + "output": [ "privateFeature" ] } }, @@ -131,7 +136,8 @@ "xcomposite-egl", "xcomposite-glx", "wayland-drm-egl-server-buffer", - "wayland-libhybris-egl-server-buffer" + "wayland-libhybris-egl-server-buffer", + "wayland-shm-emulation-server-buffer" ] }, "wayland-client" diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/client.pro b/src/plugins/platforms/wayland/plugins/hardwareintegration/client.pro index 8001c9de6c0..eab62f8d08e 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/client.pro +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/client.pro @@ -9,10 +9,10 @@ qtConfig(xcomposite-egl): \ SUBDIRS += xcomposite-egl qtConfig(xcomposite-glx): \ SUBDIRS += xcomposite-glx + qtConfig(wayland-drm-egl-server-buffer): \ SUBDIRS += drm-egl-server qtConfig(wayland-libhybris-egl-server-buffer): \ SUBDIRS += libhybris-egl-server - -### TODO: make shm-emulation configurable -SUBDIRS += shm-emulation-server +qtConfig(wayland-shm-emulation-server-buffer): \ + SUBDIRS += shm-emulation-server From 6f0c854a3f83792a78a091f785bed1ed67e407f0 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Mon, 20 Aug 2018 11:33:34 +0200 Subject: [PATCH 0584/1507] Client: Clean up hardware integration initialization If QT_WAYLAND_DISABLE_HW_INTEGRATION is set, clients no longer bind to the qt_hardware_integration interface. [ChangeLog][QPA plugin] The environment variables, QT_WAYLAND_CLIENT_BUFFER_INTEGRATION and QT_WAYLAND_SERVER_BUFFER_INTEGRATION, now takes precedence over what is communicated through the qt_hardware_integration wayland interface. Change-Id: Iff68ccc151781c3c2ad6def8497bca65e89a0b20 Reviewed-by: Paul Olav Tvete --- .../platforms/wayland/qwaylanddisplay.cpp | 11 ++-- .../platforms/wayland/qwaylandintegration.cpp | 57 ++++++++++--------- 2 files changed, 36 insertions(+), 32 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index c57dc13add2..8a29ffc99c1 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -272,10 +272,13 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin inputDevice->setTextInput(new QWaylandTextInput(this, mTextInputManager->get_text_input(inputDevice->wl_seat()))); } } else if (interface == QStringLiteral("qt_hardware_integration")) { - mHardwareIntegration.reset(new QWaylandHardwareIntegration(registry, id)); - // make a roundtrip here since we need to receive the events sent by - // qt_hardware_integration before creating windows - forceRoundTrip(); + bool disableHardwareIntegration = qEnvironmentVariableIntValue("QT_WAYLAND_DISABLE_HW_INTEGRATION"); + if (!disableHardwareIntegration) { + mHardwareIntegration.reset(new QWaylandHardwareIntegration(registry, id)); + // make a roundtrip here since we need to receive the events sent by + // qt_hardware_integration before creating windows + forceRoundTrip(); + } } else if (interface == QLatin1String("zxdg_output_manager_v1")) { mXdgOutputManager.reset(new QtWayland::zxdg_output_manager_v1(registry, id, 1)); for (auto *screen : qAsConst(mScreens)) diff --git a/src/plugins/platforms/wayland/qwaylandintegration.cpp b/src/plugins/platforms/wayland/qwaylandintegration.cpp index e935ef31f5f..d2fa8568c78 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandintegration.cpp @@ -329,16 +329,13 @@ void QWaylandIntegration::initializeClientBufferIntegration() { mClientBufferIntegrationInitialized = true; - QString targetKey; - bool disableHardwareIntegration = qEnvironmentVariableIsSet("QT_WAYLAND_DISABLE_HW_INTEGRATION"); - disableHardwareIntegration = disableHardwareIntegration || !mDisplay->hardwareIntegration(); - if (disableHardwareIntegration) { - QByteArray clientBufferIntegrationName = qgetenv("QT_WAYLAND_CLIENT_BUFFER_INTEGRATION"); - if (clientBufferIntegrationName.isEmpty()) - clientBufferIntegrationName = QByteArrayLiteral("wayland-egl"); - targetKey = QString::fromLocal8Bit(clientBufferIntegrationName); - } else { - targetKey = mDisplay->hardwareIntegration()->clientBufferIntegration(); + QString targetKey = QString::fromLocal8Bit(qgetenv("QT_WAYLAND_CLIENT_BUFFER_INTEGRATION")); + + if (targetKey.isEmpty()) { + if (mDisplay->hardwareIntegration()) + targetKey = mDisplay->hardwareIntegration()->clientBufferIntegration(); + else + targetKey = QLatin1Literal("wayland-egl"); } if (targetKey.isEmpty()) { @@ -347,29 +344,28 @@ void QWaylandIntegration::initializeClientBufferIntegration() } QStringList keys = QWaylandClientBufferIntegrationFactory::keys(); - if (keys.contains(targetKey)) { + qCDebug(lcQpaWayland) << "Available client buffer integrations:" << keys; + + if (keys.contains(targetKey)) mClientBufferIntegration.reset(QWaylandClientBufferIntegrationFactory::create(targetKey, QStringList())); - } - if (mClientBufferIntegration) + + if (mClientBufferIntegration) { + qCDebug(lcQpaWayland) << "Initializing client buffer integration" << targetKey; mClientBufferIntegration->initialize(mDisplay.data()); - else - qWarning("Failed to load client buffer integration: %s\n", qPrintable(targetKey)); + } else { + qCWarning(lcQpaWayland) << "Failed to load client buffer integration:" << targetKey; + qCWarning(lcQpaWayland) << "Available client buffer integrations:" << keys; + } } void QWaylandIntegration::initializeServerBufferIntegration() { mServerBufferIntegrationInitialized = true; - QString targetKey; + QString targetKey = QString::fromLocal8Bit(qgetenv("QT_WAYLAND_SERVER_BUFFER_INTEGRATION")); - bool disableHardwareIntegration = qEnvironmentVariableIsSet("QT_WAYLAND_DISABLE_HW_INTEGRATION"); - disableHardwareIntegration = disableHardwareIntegration || !mDisplay->hardwareIntegration(); - if (disableHardwareIntegration) { - QByteArray serverBufferIntegrationName = qgetenv("QT_WAYLAND_SERVER_BUFFER_INTEGRATION"); - targetKey = QString::fromLocal8Bit(serverBufferIntegrationName); - } else { + if (targetKey.isEmpty() && mDisplay->hardwareIntegration()) targetKey = mDisplay->hardwareIntegration()->serverBufferIntegration(); - } if (targetKey.isEmpty()) { qWarning("Failed to determine what server buffer integration to use"); @@ -377,13 +373,18 @@ void QWaylandIntegration::initializeServerBufferIntegration() } QStringList keys = QWaylandServerBufferIntegrationFactory::keys(); - if (keys.contains(targetKey)) { + qCDebug(lcQpaWayland) << "Available server buffer integrations:" << keys; + + if (keys.contains(targetKey)) mServerBufferIntegration.reset(QWaylandServerBufferIntegrationFactory::create(targetKey, QStringList())); - } - if (mServerBufferIntegration) + + if (mServerBufferIntegration) { + qCDebug(lcQpaWayland) << "Initializing server buffer integration" << targetKey; mServerBufferIntegration->initialize(mDisplay.data()); - else - qWarning("Failed to load server buffer integration %s\n", qPrintable(targetKey)); + } else { + qCWarning(lcQpaWayland) << "Failed to load server buffer integration: " << targetKey; + qCWarning(lcQpaWayland) << "Available server buffer integrations:" << keys; + } } void QWaylandIntegration::initializeShellIntegration() From e784fb8d140c027f64c801de93707699669ef2ee Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Thu, 13 Sep 2018 09:44:51 +0200 Subject: [PATCH 0585/1507] Don't try to use wl_proxy_get_version with libwayland < 1.10 The pregenerated header for xdg-shell was generated using wayland-scanner 1.13 which uses wl_proxy_get_version which was introduced in 1.10. Change-Id: I19507ff6e543d4b0aa53e0d022d680090c34ab50 Reviewed-by: Paul Olav Tvete --- .../wayland-xdg-shell-unstable-v5-client-protocol_p.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/pregenerated/3rdparty/wayland-xdg-shell-unstable-v5-client-protocol_p.h b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/pregenerated/3rdparty/wayland-xdg-shell-unstable-v5-client-protocol_p.h index 62b6a7858de..46644610b75 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/pregenerated/3rdparty/wayland-xdg-shell-unstable-v5-client-protocol_p.h +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/pregenerated/3rdparty/wayland-xdg-shell-unstable-v5-client-protocol_p.h @@ -1,5 +1,6 @@ /* Generated by wayland-scanner 1.13.0 */ // Hand-edited to resolve conflicts with xdg-shell stable +// And make it build with libwayland < 1.10 #ifndef XDG_SHELL_UNSTABLE_V5_CLIENT_PROTOCOL_H #define XDG_SHELL_UNSTABLE_V5_CLIENT_PROTOCOL_H @@ -362,11 +363,13 @@ xdg_shell_get_user_data(struct xdg_shell_v5 *xdg_shell) return wl_proxy_get_user_data((struct wl_proxy *) xdg_shell); } +#if WAYLAND_VERSION_MAJOR > 1 || WAYLAND_VERSION_MINOR >= 10 static inline uint32_t xdg_shell_get_version(struct xdg_shell_v5 *xdg_shell) { return wl_proxy_get_version((struct wl_proxy *) xdg_shell); } +#endif /** * @ingroup iface_xdg_shell @@ -687,11 +690,13 @@ xdg_surface_get_user_data(struct xdg_surface_v5 *xdg_surface) return wl_proxy_get_user_data((struct wl_proxy *) xdg_surface); } +#if WAYLAND_VERSION_MAJOR > 1 || WAYLAND_VERSION_MINOR >= 10 static inline uint32_t xdg_surface_get_version(struct xdg_surface_v5 *xdg_surface) { return wl_proxy_get_version((struct wl_proxy *) xdg_surface); } +#endif /** * @ingroup iface_xdg_surface @@ -1081,11 +1086,13 @@ xdg_popup_get_user_data(struct xdg_popup_v5 *xdg_popup) return wl_proxy_get_user_data((struct wl_proxy *) xdg_popup); } +#if WAYLAND_VERSION_MAJOR > 1 || WAYLAND_VERSION_MINOR >= 10 static inline uint32_t xdg_popup_get_version(struct xdg_popup_v5 *xdg_popup) { return wl_proxy_get_version((struct wl_proxy *) xdg_popup); } +#endif /** * @ingroup iface_xdg_popup From c8d10612b0d4bd5b66322311a18c90d70952aff2 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Thu, 13 Sep 2018 11:57:54 +0200 Subject: [PATCH 0586/1507] Add missing Q_UNUSED Change-Id: I7e6b4460aac92cb9669ac1d0d0f4785a8444925d Reviewed-by: Paul Olav Tvete --- tests/auto/wayland/shared/mockxdgshellv6.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/auto/wayland/shared/mockxdgshellv6.cpp b/tests/auto/wayland/shared/mockxdgshellv6.cpp index 014a24be7c2..5dc8da599a7 100644 --- a/tests/auto/wayland/shared/mockxdgshellv6.cpp +++ b/tests/auto/wayland/shared/mockxdgshellv6.cpp @@ -59,6 +59,7 @@ void XdgSurfaceV6::zxdg_surface_v6_get_toplevel(QtWaylandServer::zxdg_surface_v6 void XdgSurfaceV6::zxdg_surface_v6_set_window_geometry(QtWaylandServer::zxdg_surface_v6::Resource *resource, int32_t x, int32_t y, int32_t width, int32_t height) { + Q_UNUSED(resource); if (m_toplevel) { QRect geometry(x, y, width, height); emit m_toplevel->mockToplevel()->windowGeometryRequested(geometry); From 082922b4c36e8e8c4ebf30c1b3d1dd8aba52c19e Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Wed, 12 Sep 2018 13:45:04 +0200 Subject: [PATCH 0587/1507] Don't include wayland-client-core.h It requires libwayland 1.8 and we're supposed to support versions as old as 1.6 Task-number: QTBUG-70528 Change-Id: Iff4c2542d103d53aba8db99ecceddfccb79cfcb6 Reviewed-by: Paul Olav Tvete --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index e58e87221df..cc69fac95d9 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -67,7 +67,7 @@ #include -#include +#include QT_BEGIN_NAMESPACE From d95ba68c14ad24537150934ae69e6939aab4dde2 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Thu, 13 Sep 2018 11:57:21 +0200 Subject: [PATCH 0588/1507] Remove unnecessary function declaration Change-Id: I55a7b579babfa99707e3e4b4cf15c34f48459825 Reviewed-by: Paul Olav Tvete --- src/plugins/platforms/wayland/qwaylanddisplay_p.h | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay_p.h b/src/plugins/platforms/wayland/qwaylanddisplay_p.h index 71a39dd928c..0dd8d7affb8 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay_p.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay_p.h @@ -235,11 +235,6 @@ private: void registry_global(uint32_t id, const QString &interface, uint32_t version) override; void registry_global_remove(uint32_t id) override; - - static void shellHandleConfigure(void *data, struct wl_shell *shell, - uint32_t time, uint32_t edges, - struct wl_surface *surface, - int32_t width, int32_t height); }; } From 014ea9cdc48a3c0708d5b4d2604767241612deaa Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Fri, 14 Sep 2018 15:20:03 +0200 Subject: [PATCH 0589/1507] Remove ifdefs for unsupported libwayland versions The ifdefs were for version 1.2.0. Change-Id: Ie58745c7cf4c0fba45bc5203d24e9913d3a8b8ce Reviewed-by: Paul Olav Tvete --- src/tools/qtwaylandscanner/qtwaylandscanner.cpp | 3 --- tests/auto/wayland/shared/mocksurface.cpp | 7 ------- 2 files changed, 10 deletions(-) diff --git a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp index c08c00f4fc3..ec1341e8ac1 100644 --- a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp +++ b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp @@ -772,9 +772,6 @@ bool Scanner::process() printf(" that->m_resource_map.remove(resource->client(), resource);\n"); printf(" that->%s_destroy_resource(resource);\n", interfaceNameStripped); printf(" delete resource;\n"); - printf("#if !WAYLAND_VERSION_CHECK(1, 2, 0)\n"); - printf(" free(client_resource);\n"); - printf("#endif\n"); printf(" }\n"); printf("\n"); diff --git a/tests/auto/wayland/shared/mocksurface.cpp b/tests/auto/wayland/shared/mocksurface.cpp index 4de4265d773..c0d51618c7d 100644 --- a/tests/auto/wayland/shared/mocksurface.cpp +++ b/tests/auto/wayland/shared/mocksurface.cpp @@ -161,14 +161,7 @@ void Surface::surface_commit(Resource *resource) Q_UNUSED(resource); if (m_buffer) { -#if WAYLAND_VERSION_CHECK(1, 2, 0) struct ::wl_shm_buffer *shm_buffer = wl_shm_buffer_get(m_buffer); -#else - struct ::wl_buffer *shm_buffer = 0; - if (wl_buffer_is_shm(static_cast(m_buffer->data))) - shm_buffer = static_cast(m_buffer->data); -#endif - if (shm_buffer) { int stride = wl_shm_buffer_get_stride(shm_buffer); uint format = wl_shm_buffer_get_format(shm_buffer); From f27a3ff689ee268c867a926a3049371ad84918f9 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Wed, 12 Sep 2018 12:48:41 +0200 Subject: [PATCH 0590/1507] Revert "Upgrade wayland.xml to version 1.10.0" Since we're using the deprecated ways of including wayland (wayland-server.h instead of wayland-server-core.h), we can't upgrade wayland.xml to a version that's newer than the system libwayland. Our minimum supported version is 1.6. This reverts commit 1d51503daead2e09cc2526a0114bedd4669c1d3f. Fixes: QTBUG-70528 Change-Id: I102cb215a40a1aaaeba6f463200eefc3be653c52 Reviewed-by: Paul Olav Tvete --- .../wayland/protocols/qt_attribution.json | 4 +- src/3rdparty/wayland/protocols/wayland.xml | 741 ++---------------- 2 files changed, 84 insertions(+), 661 deletions(-) diff --git a/src/3rdparty/wayland/protocols/qt_attribution.json b/src/3rdparty/wayland/protocols/qt_attribution.json index ba199812ba2..e5bf91e1023 100644 --- a/src/3rdparty/wayland/protocols/qt_attribution.json +++ b/src/3rdparty/wayland/protocols/qt_attribution.json @@ -8,8 +8,8 @@ "Description": "Wayland is a protocol for a compositor to talk to its clients.", "Homepage": "https://wayland.freedesktop.org", - "Version": "1.10.0", - "DownloadLocation": "https://cgit.freedesktop.org/wayland/wayland/tag/?id=1.10.0", + "Version": "1.6.1", + "DownloadLocation": "https://cgit.freedesktop.org/wayland/wayland/tag/?id=1.6.1", "LicenseId": "HPND", "License": "HPND License", "LicenseFile": "HPND_LICENSE.txt", diff --git a/src/3rdparty/wayland/protocols/wayland.xml b/src/3rdparty/wayland/protocols/wayland.xml index 8739cd319c0..bb457bcf74f 100644 --- a/src/3rdparty/wayland/protocols/wayland.xml +++ b/src/3rdparty/wayland/protocols/wayland.xml @@ -6,26 +6,26 @@ Copyright © 2010-2011 Intel Corporation Copyright © 2012-2013 Collabora, Ltd. - 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: + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that copyright notice and this permission + notice appear in supporting documentation, and that the name of + the copyright holders not be used in advertising or publicity + pertaining to distribution of the software without specific, + written prior permission. The copyright holders make no + representations about the suitability of this software for any + purpose. It is provided "as is" without express or implied + warranty. - 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. + THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS + SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND + FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY + SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN + AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF + THIS SOFTWARE.
@@ -176,7 +176,7 @@ - + A compositor. This object is a singleton global. The compositor is in charge of combining the contents of multiple @@ -367,7 +367,7 @@ can be used for buffers. Known formats include argb8888 and xrgb8888. - + @@ -408,7 +408,7 @@ - + A wl_data_offer represents a piece of data offered for transfer by another client (the source client). It is used by the @@ -418,33 +418,12 @@ data directly from the source client. - - - - - - - Indicate that the client can accept the given mime type, or NULL for not accepted. - For objects of version 2 or older, this request is used by the - client to give feedback whether the client can receive the given - mime type, or NULL if none is accepted; the feedback does not - determine whether the drag-and-drop operation succeeds or not. - - For objects of version 3 or newer, this request determines the - final result of the drag-and-drop operation. If the end result - is that no mime types were accepted, the drag-and-drop operation - will be cancelled and the corresponding drag source will receive - wl_data_source.cancelled. Clients may still use this event in - conjunction with wl_data_source.action for feedback. + Used for feedback during drag-and-drop. @@ -461,13 +440,8 @@ file descriptor. The receiving client reads from the read end of the pipe until - EOF and then closes its end, at which point the transfer is + EOF and the closes its end, at which point the transfer is complete. - - This request may happen multiple times for different mimetypes, - both before and after wl_data_device.drop. Drag-and-drop destination - clients may preemptively fetch data or examine it more closely to - determine acceptance. @@ -487,115 +461,9 @@ - - - - - - Notifies the compositor that the drag destination successfully - finished the drag-and-drop operation. - - Upon receiving this request, the compositor will emit - wl_data_source.dnd_finished on the drag source client. - - It is a client error to perform other requests than - wl_data_offer.destroy after this one. It is also an error to perform - this request after a NULL mime type has been set in - wl_data_offer.accept or no action was received through - wl_data_offer.action. - - - - - - Sets the actions that the destination side client supports for - this operation. This request may trigger the emission of - wl_data_source.action and wl_data_offer.action events if the compositor - need to change the selected action. - - This request can be called multiple times throughout the - drag-and-drop operation, typically in response to wl_data_device.enter - or wl_data_device.motion events. - - This request determines the final result of the drag-and-drop - operation. If the end result is that no action is accepted, - the drag source will receive wl_drag_source.cancelled. - - The dnd_actions argument must contain only values expressed in the - wl_data_device_manager.dnd_actions enum, and the preferred_action - argument must only contain one of those values set, otherwise it - will result in a protocol error. - - While managing an "ask" action, the destination drag-and-drop client - may perform further wl_data_offer.receive requests, and is expected - to perform one last wl_data_offer.set_actions request with a preferred - action other than "ask" (and optionally wl_data_offer.accept) before - requesting wl_data_offer.finish, in order to convey the action selected - by the user. If the preferred action is not in the - wl_data_offer.source_actions mask, an error will be raised. - - If the "ask" action is dismissed (e.g. user cancellation), the client - is expected to perform wl_data_offer.destroy right away. - - This request can only be made on drag-and-drop offers, a protocol error - will be raised otherwise. - - - - - - - - This event indicates the actions offered by the data source. It - will be sent right after wl_data_device.enter, or anytime the source - side changes its offered actions through wl_data_source.set_actions. - - - - - - - This event indicates the action selected by the compositor after - matching the source/destination side actions. Only one action (or - none) will be offered here. - - This event can be emitted multiple times during the drag-and-drop - operation in response to destination side action changes through - wl_data_offer.set_actions. - - This event will no longer be emitted after wl_data_device.drop - happened on the drag-and-drop destination, the client must - honor the last action received, or the last preferred one set - through wl_data_offer.set_actions when handling an "ask" action. - - Compositors may also change the selected action on the fly, mainly - in response to keyboard modifier changes during the drag-and-drop - operation. - - The most recent action received is always the valid one. Prior to - receiving wl_data_device.drop, the chosen action may change (e.g. - due to keyboard modifiers being pressed). At the time of receiving - wl_data_device.drop the drag-and-drop destination must honor the - last action received. - - Action changes may still happen after wl_data_device.drop, - especially on "ask" actions, where the drag-and-drop destination - may choose another action afterwards. Action changes happening - at this stage are always the result of inter-client negotiation, the - compositor shall no longer be able to induce a different action. - - Upon "ask" actions, it is expected that the drag-and-drop destination - may potentially choose different a different action and/or mime type, - based on wl_data_offer.source_actions and finally chosen by the - user (e.g. popping up a menu with the available options). The - final wl_data_offer.set_actions and wl_data_offer.accept requests - must happen before the call to wl_data_offer.finish. - - - - + The wl_data_source object is the source side of a wl_data_offer. It is created by the source client in a data transfer and @@ -603,13 +471,6 @@ to requests to transfer the data. - - - - - This request adds a mime type to the set of mime types @@ -649,108 +510,14 @@ - This data source is no longer valid. There are several reasons why - this could happen: - - - The data source has been replaced by another data source. - - The drag-and-drop operation was performed, but the drop destination - did not accept any of the mimetypes offered through - wl_data_source.target. - - The drag-and-drop operation was performed, but the drop destination - did not select any of the actions present in the mask offered through - wl_data_source.action. - - The drag-and-drop operation was performed but didn't happen over a - surface. - - The compositor cancelled the drag-and-drop operation (e.g. compositor - dependent timeouts to avoid stale drag-and-drop transfers). - + This data source has been replaced by another data source. The client should clean up and destroy this data source. - - For objects of version 2 or older, wl_data_source.cancelled will - only be emitted if the data source was replaced by another data - source. - - - - - Sets the actions that the source side client supports for this - operation. This request may trigger wl_data_source.action and - wl_data_offer.action events if the compositor needs to change the - selected action. - - The dnd_actions argument must contain only values expressed in the - wl_data_device_manager.dnd_actions enum, otherwise it will result - in a protocol error. - - This request must be made once only, and can only be made on sources - used in drag-and-drop, so it must be performed before - wl_data_device.start_drag. Attempting to use the source other than - for drag-and-drop will raise a protocol error. - - - - - - - The user performed the drop action. This event does not indicate - acceptance, wl_data_source.cancelled may still be emitted afterwards - if the drop destination does not accept any mimetype. - - However, this event might however not be received if the compositor - cancelled the drag-and-drop operation before this event could happen. - - Note that the data_source may still be used in the future and should - not be destroyed here. - - - - - - The drop destination finished interoperating with this data - source, so the client is now free to destroy this data source and - free all associated data. - - If the action used to perform the operation was "move", the - source can now delete the transferred data. - - - - - - This event indicates the action selected by the compositor after - matching the source/destination side actions. Only one action (or - none) will be offered here. - - This event can be emitted multiple times during the drag-and-drop - operation, mainly in response to destination side changes through - wl_data_offer.set_actions, and as the data device enters/leaves - surfaces. - - It is only possible to receive this event after - wl_data_source.dnd_drop_performed if the drag-and-drop operation - ended in an "ask" action, in which case the final wl_data_source.action - event will happen immediately before wl_data_source.dnd_finished. - - Compositors may also change the selected action on the fly, mainly - in response to keyboard modifier changes during the drag-and-drop - operation. - - The most recent action received is always the valid one. The chosen - action may change alongside negotiation (e.g. an "ask" action can turn - into a "move" operation), so the effects of the final action must - always be applied in wl_data_offer.dnd_finished. - - Clients can trigger cursor surface changes from this point, so - they reflect the current action. - - - - + There is one wl_data_device per seat which can be obtained from the global wl_data_device_manager singleton. @@ -758,11 +525,6 @@ A wl_data_device provides access to inter-client data transfer mechanisms such as copy-and-paste and drag-and-drop. - - - - - This request asks the compositor to start a drag-and-drop @@ -783,9 +545,7 @@ the top-left corner of the icon surface is placed at the cursor hotspot, but subsequent wl_surface.attach request can move the relative position. Attach requests must be confirmed with - wl_surface.commit as usual. The icon surface is given the role of - a drag-and-drop icon. If the icon surface already has another role, - it raises a protocol error. + wl_surface.commit as usual. The current and pending input regions of the icon wl_surface are cleared, and wl_surface.set_input_region is ignored until the @@ -863,17 +623,6 @@ The event is sent when a drag-and-drop operation is ended because the implicit grab is removed. - - The drag-and-drop destination is expected to honor the last action - received through wl_data_offer.action, if the resulting action is - "copy" or "move", the destination can still perform - wl_data_offer.receive requests, and is expected to end all - transfers with a wl_data_offer.finish request. - - If the resulting action is "ask", the action will not be considered - final. The drag-and-drop destination is expected to perform one last - wl_data_offer.set_actions request, or wl_data_offer.destroy in order - to cancel the operation. @@ -887,34 +636,19 @@ immediately before receiving keyboard focus and when a new selection is set while the client has keyboard focus. The data_offer is valid until a new data_offer or NULL is received - or until the client loses keyboard focus. The client must - destroy the previous selection data_offer, if any, upon receiving - this event. + or until the client loses keyboard focus. - - - - - - This request destroys the data device. - - - + The wl_data_device_manager is a singleton global object that provides access to inter-client data transfer mechanisms such as copy-and-paste and drag-and-drop. These mechanisms are tied to a wl_seat and this interface lets a client get a wl_data_device corresponding to a wl_seat. - - Depending on the version bound, the objects created from the bound - wl_data_device_manager object will have different requirements for - functioning properly. See wl_data_source.set_actions, - wl_data_offer.accept and wl_data_offer.finish for details. @@ -931,40 +665,6 @@ - - - - - - This is a bitmask of the available/preferred actions in a - drag-and-drop operation. - - In the compositor, the selected action is a result of matching the - actions offered by the source and destination sides. "action" events - with a "none" action will be sent to both source and destination if - there is no match. All further checks will effectively happen on - (source actions ∩ destination actions). - - In addition, compositors may also pick different actions in - reaction to key modifiers being pressed, one common design that - is used in major toolkits (and the behavior recommended for - compositors) is: - - - If no modifiers are pressed, the first match (in bit order) - will be used. - - Pressing Shift selects "move", if enabled in the mask. - - Pressing Control selects "copy", if enabled in the mask. - - Behavior beyond that is considered implementation-dependent. - Compositors may for example bind other modifiers (like Alt/Meta) - or drags initiated with other buttons than BTN_LEFT to specific - actions (e.g. "ask"). - - - - - - @@ -976,15 +676,9 @@ a basic surface. - - - - - Create a shell surface for an existing surface. This gives - the wl_surface the role of a shell surface. If the wl_surface - already has another role, it raises a protocol error. + Create a shell surface for an existing surface. Only one shell surface can be associated with a given surface. @@ -1029,7 +723,7 @@ - + These values are used to indicate which edge of a surface is being dragged in a resize operation. The server may @@ -1057,7 +751,7 @@ - + @@ -1068,7 +762,7 @@ - + These flags specify details of the expected behaviour of transient surfaces. Used in the set_transient request. @@ -1090,7 +784,7 @@ - + @@ -1141,7 +835,7 @@ with the dimensions for the output on which the surface will be made fullscreen. - + @@ -1174,7 +868,7 @@ - + @@ -1255,7 +949,7 @@ in surface local coordinates. - + @@ -1269,7 +963,7 @@ - + A surface is a rectangular area that is displayed on the screen. It has a location, size and pixel contents. @@ -1279,37 +973,8 @@ local coordinates of the pixel content, in case a buffer_transform or a buffer_scale is used. - A surface without a "role" is fairly useless, a compositor does - not know where, when or how to present it. The role is the - purpose of a wl_surface. Examples of roles are a cursor for a - pointer (as set by wl_pointer.set_cursor), a drag icon - (wl_data_device.start_drag), a sub-surface - (wl_subcompositor.get_subsurface), and a window as defined by a - shell protocol (e.g. wl_shell.get_shell_surface). - - A surface can have only one role at a time. Initially a - wl_surface does not have a role. Once a wl_surface is given a - role, it is set permanently for the whole lifetime of the - wl_surface object. Giving the current role again is allowed, - unless explicitly forbidden by the relevant interface - specification. - - Surface roles are given by requests in other interfaces such as - wl_pointer.set_cursor. The request should explicitly mention - that this request gives a role to a wl_surface. Often, this - request also creates a new protocol object that represents the - role and adds additional functionality to wl_surface. When a - client wants to destroy a wl_surface, they must destroy this 'role - object' before the wl_surface. - - Destroying the role object does not remove the role from the - wl_surface, but it may stop the wl_surface from "playing the role". - For instance, if a wl_subsurface object is destroyed, the wl_surface - it was created for will be unmapped and forget its position and - z-order. It is allowed to create a wl_subsurface for the same - wl_surface again, but it is not allowed to use the wl_surface as - a cursor (cursor is a different role than sub-surface, and role - switching is not allowed). + Surfaces are also used for some special purposes, e.g. as + cursor images for pointers, drag icons, etc. @@ -1378,8 +1043,10 @@ This request is used to describe the regions where the pending buffer is different from the current surface contents, and where - the surface therefore needs to be repainted. The compositor - ignores the parts of the damage that fall outside of the surface. + the surface therefore needs to be repainted. The pending buffer + must be set by wl_surface.attach before sending damage. The + compositor ignores the parts of the damage that fall outside of + the surface. Damage is double-buffered state, see wl_surface.commit. @@ -1392,10 +1059,6 @@ wl_surface.commit assigns pending damage as the current damage, and clears pending damage. The server will clear the current damage as it repaints the surface. - - Alternatively, damage can be posted with wl_surface.damage_buffer - which uses buffer co-ordinates instead of surface co-ordinates, - and is probably the preferred and intuitive way of doing this. @@ -1612,51 +1275,9 @@ - - - - - This request is used to describe the regions where the pending - buffer is different from the current surface contents, and where - the surface therefore needs to be repainted. The compositor - ignores the parts of the damage that fall outside of the surface. - - Damage is double-buffered state, see wl_surface.commit. - - The damage rectangle is specified in buffer coordinates. - - The initial value for pending damage is empty: no damage. - wl_surface.damage_buffer adds pending damage: the new pending - damage is the union of old pending damage and the given rectangle. - - wl_surface.commit assigns pending damage as the current damage, - and clears pending damage. The server will clear the current - damage as it repaints the surface. - - This request differs from wl_surface.damage in only one way - it - takes damage in buffer co-ordinates instead of surface local - co-ordinates. While this generally is more intuitive than surface - co-ordinates, it is especially desirable when using wp_viewport - or when a drawing library (like EGL) is unaware of buffer scale - and buffer transform. - - Note: Because buffer transformation changes and damage requests may - be interleaved in the protocol stream, It is impossible to determine - the actual mapping between surface and buffer damage until - wl_surface.commit time. Therefore, compositors wishing to take both - kinds of damage into account will have to accumulate damage from the - two requests separately and only transform from one to the other - after receiving the wl_surface.commit. - - - - - - - - + A seat is a group of keyboards, pointer and touch devices. This object is published as a global during start up, or when such a @@ -1664,7 +1285,7 @@ maintains a keyboard focus and a pointer focus. - + This is a bitmask of capabilities this seat has; if a member is set, then it is present on the seat. @@ -1676,74 +1297,47 @@ - This is emitted whenever a seat gains or loses the pointer, + This is emitted whenever a seat gains or loses the pointer, keyboard or touch capabilities. The argument is a capability enum containing the complete set of capabilities this seat has. - - When the pointer capability is added, a client may create a - wl_pointer object using the wl_seat.get_pointer request. This object - will receive pointer events until the capability is removed in the - future. - - When the pointer capability is removed, a client should destroy the - wl_pointer objects associated with the seat where the capability was - removed, using the wl_pointer.release request. No further pointer - events will be received on these objects. - - In some compositors, if a seat regains the pointer capability and a - client has a previously obtained wl_pointer object of version 4 or - less, that object may start sending pointer events again. This - behavior is considered a misinterpretation of the intended behavior - and must not be relied upon by the client. wl_pointer objects of - version 5 or later must not send events if created before the most - recent event notifying the client of an added pointer capability. - - The above behavior also applies to wl_keyboard and wl_touch with the - keyboard and touch capabilities, respectively. - + - The ID provided will be initialized to the wl_pointer interface + The ID provided will be initialized to the wl_pointer interface for this seat. - This request only takes effect if the seat has the pointer - capability, or has had the pointer capability in the past. - It is a protocol violation to issue this request on a seat that has - never had the pointer capability. + This request only takes effect if the seat has the pointer + capability. - The ID provided will be initialized to the wl_keyboard interface + The ID provided will be initialized to the wl_keyboard interface for this seat. - This request only takes effect if the seat has the keyboard - capability, or has had the keyboard capability in the past. - It is a protocol violation to issue this request on a seat that has - never had the keyboard capability. + This request only takes effect if the seat has the keyboard + capability. - The ID provided will be initialized to the wl_touch interface + The ID provided will be initialized to the wl_touch interface for this seat. - This request only takes effect if the seat has the touch - capability, or has had the touch capability in the past. - It is a protocol violation to issue this request on a seat that has - never had the touch capability. + This request only takes effect if the seat has the touch + capability. - + @@ -1754,18 +1348,9 @@ - - - - - Using this request client can tell the server that it is not going to - use the seat object anymore. - - - - + The wl_pointer interface represents one or more input devices, such as mice, which control the pointer location and pointer_focus @@ -1777,18 +1362,10 @@ and scrolling. - - - - Set the pointer surface, i.e., the surface that contains the - pointer image (cursor). This request gives the surface the role - of a cursor. If the surface already has another role, it raises - a protocol error. - - The cursor actually changes only if the pointer + pointer image (cursor). This request only takes effect if the pointer focus for this device is one of the requesting client's surfaces or the surface parameter is the current pointer surface. If there was a previous surface set with this request it is @@ -1884,7 +1461,7 @@ - + @@ -1916,169 +1493,19 @@ - + - - Using this request client can tell the server that it is not going to - use the pointer object anymore. - - This request destroys the pointer proxy object, so user must not call - wl_pointer_destroy() after using this request. - + - - - - - Indicates the end of a set of events that logically belong together. - A client is expected to accumulate the data in all events within the - frame before proceeding. - - All wl_pointer events before a wl_pointer.frame event belong - logically together. For example, in a diagonal scroll motion the - compositor will send an optional wl_pointer.axis_source event, two - wl_pointer.axis events (horizontal and vertical) and finally a - wl_pointer.frame event. The client may use this information to - calculate a diagonal vector for scrolling. - - When multiple wl_pointer.axis events occur within the same frame, - the motion vector is the combined motion of all events. - When a wl_pointer.axis and a wl_pointer.axis_stop event occur within - the same frame, this indicates that axis movement in one axis has - stopped but continues in the other axis. - When multiple wl_pointer.axis_stop events occur within in the same - frame, this indicates that these axes stopped in the same instance. - - A wl_pointer.frame event is sent for every logical event group, - even if the group only contains a single wl_pointer event. - Specifically, a client may get a sequence: motion, frame, button, - frame, axis, frame, axis_stop, frame. - - The wl_pointer.enter and wl_pointer.leave events are logical events - generated by the compositor and not the hardware. These events are - also grouped by a wl_pointer.frame. When a pointer moves from one - surface to the another, a compositor should group the - wl_pointer.leave event within the same wl_pointer.frame. - However, a client must not rely on wl_pointer.leave and - wl_pointer.enter being in the same wl_pointer.frame. - Compositor-specific policies may require the wl_pointer.leave and - wl_pointer.enter event being split across multiple wl_pointer.frame - groups. - - - - - - Describes the source types for axis events. This indicates to the - client how an axis event was physically generated; a client may - adjust the user interface accordingly. For example, scroll events - from a "finger" source may be in a smooth coordinate space with - kinetic scrolling whereas a "wheel" source may be in discrete steps - of a number of lines. - - The "continuous" axis source is a device generating events in a - continuous coordinate space, but using something other than a - finger. One example for this source is button-based scrolling where - the vertical motion of a device is converted to scroll events while - a button is held down. - - - - - - - - - Source information for scroll and other axes. - - This event does not occur on its own. It is sent before a - wl_pointer.frame event and carries the source information for - all events within that frame. - - The source specifies how this event was generated. If the source is - wl_pointer.axis_source.finger, a wl_pointer.axis_stop event will be - sent when the user lifts the finger off the device. - - If the source is wl_pointer axis_source.wheel or - wl_pointer.axis_source.continuous, a wl_pointer.axis_stop event may - or may not be sent. Whether a compositor sends a axis_stop event - for these sources is hardware-specific and implementation-dependent; - clients must not rely on receiving an axis_stop event for these - scroll sources and should treat scroll sequences from these scroll - sources as unterminated by default. - - This event is optional. If the source is unknown for a particular - axis event sequence, no event is sent. - Only one wl_pointer.axis_source event is permitted per frame. - - The order of wl_pointer.axis_discrete and wl_pointer.axis_source is - not guaranteed. - - - - - - - Stop notification for scroll and other axes. - - For some wl_pointer.axis_source types, a wl_pointer.axis_stop event - is sent to notify a client that the axis sequence has terminated. - This enables the client to implement kinetic scrolling. - See the wl_pointer.axis_source documentation for information on when - this event may be generated. - - Any wl_pointer.axis events with the same axis_source after this - event should be considered as the start of a new axis motion. - - The timestamp is to be interpreted identical to the timestamp in the - wl_pointer.axis event. The timestamp value may be the same as a - preceeding wl_pointer.axis event. - - - - - - - - Discrete step information for scroll and other axes. - - This event carries the axis value of the wl_pointer.axis event in - discrete steps (e.g. mouse wheel clicks). - - This event does not occur on its own, it is coupled with a - wl_pointer.axis event that represents this axis value on a - continuous scale. The protocol guarantees that each axis_discrete - event is always followed by exactly one axis event with the same - axis number within the same wl_pointer.frame. Note that the protocol - allows for other events to occur between the axis_discrete and - its coupled axis event, including other axis_discrete or axis - events. - - This event is optional; continuous scrolling devices - like two-finger scrolling on touchpads do not have discrete - steps and do not generate this event. - - The discrete value carries the directional information. e.g. a value - of -2 is two steps towards the negative direction of this axis. - - The axis number is identical to the axis number in the associate - axis event. - - The order of wl_pointer.axis_discrete and wl_pointer.axis_source is - not guaranteed. - - - - - + The wl_keyboard interface represents one or more keyboards associated with a seat. @@ -2100,7 +1527,7 @@ This event provides a file descriptor to the client which can be memory-mapped to provide a keyboard mapping description. - + @@ -2145,7 +1572,7 @@ - + @@ -2192,7 +1619,7 @@ - + The wl_touch interface represents a touchscreen associated with a seat. @@ -2277,7 +1704,7 @@ This enumeration describes how the physical - pixels on an output are laid out. + pixels on an output are layed out. @@ -2326,17 +1753,17 @@ summary="width in millimeters of the output"/> - - - + These flags describe properties of an output mode. They are used in the flags bitfield of the mode event. @@ -2363,7 +1790,7 @@ the output may be scaled, as described in wl_output.scale, or transformed , as described in wl_output.transform. - + @@ -2484,9 +1911,9 @@ associate it with the given parent surface. This turns a plain wl_surface into a sub-surface. - The to-be sub-surface must not already have another role, and it - must not have an existing wl_subsurface object. Otherwise a protocol - error is raised. + The to-be sub-surface must not already have a dedicated + purpose, like any shell surface type, cursor image, drag icon, + or sub-surface. Otherwise a protocol error is raised. Change the commit behaviour of the sub-surface to synchronized - mode, also described as the parent dependent mode. + mode, also described as the parent dependant mode. In synchronized mode, wl_surface.commit on a sub-surface will accumulate the committed state in a cache, but the state will From 6513ac85824541dc23674d6205ab10efcaa6bdf1 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Mon, 17 Sep 2018 08:44:38 +0200 Subject: [PATCH 0591/1507] Update xdg-shell-unstable-v5.xml The old xdg-shell-unstable-v5.xml was malformed, and was missing some tags. The updated version passes wayland-scanner run with --strict. Hopefully we can start to use it soon. Otherwise, it's just documentation fixes. Change-Id: Id28ad7196643156cd22407e12ed7ff1e7fb34ce6 Reviewed-by: Pier Luigi Fiorini --- .../protocols/xdg-shell-unstable-v5.xml | 49 ++++++++++++------- 1 file changed, 32 insertions(+), 17 deletions(-) diff --git a/src/3rdparty/wayland/protocols/xdg-shell-unstable-v5.xml b/src/3rdparty/wayland/protocols/xdg-shell-unstable-v5.xml index 89c9d58c52e..ef0180d0107 100644 --- a/src/3rdparty/wayland/protocols/xdg-shell-unstable-v5.xml +++ b/src/3rdparty/wayland/protocols/xdg-shell-unstable-v5.xml @@ -234,7 +234,6 @@ This request must be used in response to some sort of user action like a button press, key press, or touch down event. - @@ -338,25 +337,34 @@ 0x0000 - 0x0FFF: xdg-shell core values, documented below. 0x1000 - 0x1FFF: GNOME + 0x2000 - 0x2FFF: EFL - The surface is maximized. The window geometry specified in the configure - event must be obeyed by the client. + + The surface is maximized. The window geometry specified in the configure + event must be obeyed by the client. + - The surface is fullscreen. The window geometry specified in the configure - event must be obeyed by the client. + + The surface is fullscreen. The window geometry specified in the configure + event must be obeyed by the client. + - - The surface is being resized. The window geometry specified in the - configure event is a maximum; the client cannot resize beyond it. - Clients that have aspect ratio or cell sizing configuration can use - a smaller size, however. + + + The surface is being resized. The window geometry specified in the + configure event is a maximum; the client cannot resize beyond it. + Clients that have aspect ratio or cell sizing configuration can use + a smaller size, however. + - - Client window decorations should be painted as if the window is - active. Do not assume this means that the window actually has - keyboard or pointer focus. + + + Client window decorations should be painted as if the window is + active. Do not assume this means that the window actually has + keyboard or pointer focus. + @@ -387,7 +395,6 @@ can respond to one, it is free to discard all but the last event it received. - @@ -398,8 +405,8 @@ When a configure event is received, if a client commits the surface in response to the configure event, then the client - must make a ack_configure request before the commit request, - passing along the serial of the configure event. + must make an ack_configure request sometime before the commit + request, passing along the serial of the configure event. For instance, the compositor might use this information to move a surface to the top left only when the client has drawn itself @@ -407,6 +414,14 @@ If the client receives multiple configure events before it can respond to one, it only has to ack the last configure event. + + A client is not required to commit immediately after sending + an ack_configure request - it may even ack_configure several times + before its next surface commit. + + The compositor expects that the most recently received + ack_configure request at the time of a commit indicates which + configure event the client is responding to. From 2f9379552c1165bdc7c49019901d67fb0bb3072a Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Wed, 12 Sep 2018 14:17:43 +0200 Subject: [PATCH 0592/1507] Don't use members of wl_resource When we switch to only including core wayland headers, wl_resource will be an opaque type. Use the getters and setter functions instead. Task-number: QTBUG-70553 Change-Id: I7d84d48a4ee3586f231a331cd15716686dcee775 Reviewed-by: Paul Olav Tvete --- src/tools/qtwaylandscanner/qtwaylandscanner.cpp | 4 ++-- tests/auto/wayland/shared/mockcompositor.cpp | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp index ec1341e8ac1..f2e2d24de5e 100644 --- a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp +++ b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp @@ -506,7 +506,7 @@ bool Scanner::process() printf(" %s *%s_object;\n", interfaceName, interfaceNameStripped); printf(" struct ::wl_resource *handle;\n"); printf("\n"); - printf(" struct ::wl_client *client() const { return handle->client; }\n"); + printf(" struct ::wl_client *client() const { return wl_resource_get_client(handle); }\n"); printf(" int version() const { return wl_resource_get_version(handle); }\n"); printf("\n"); printf(" static Resource *fromResource(struct ::wl_resource *resource);\n"); @@ -806,7 +806,7 @@ bool Scanner::process() printf(" if (Q_UNLIKELY(!resource))\n"); printf(" return nullptr;\n"); printf(" if (wl_resource_instance_of(resource, &::%s_interface, %s))\n", interfaceName, interfaceMember.constData()); - printf(" return static_cast(resource->data);\n"); + printf(" return static_cast(wl_resource_get_user_data(resource));\n"); printf(" return nullptr;\n"); printf(" }\n"); diff --git a/tests/auto/wayland/shared/mockcompositor.cpp b/tests/auto/wayland/shared/mockcompositor.cpp index 077b8ee05de..797c05c44ec 100644 --- a/tests/auto/wayland/shared/mockcompositor.cpp +++ b/tests/auto/wayland/shared/mockcompositor.cpp @@ -400,7 +400,7 @@ void Compositor::dispatchEvents(int timeout) static void compositor_create_surface(wl_client *client, wl_resource *compositorResource, uint32_t id) { - Compositor *compositor = static_cast(compositorResource->data); + Compositor *compositor = static_cast(wl_resource_get_user_data(compositorResource)); compositor->addSurface(new Surface(client, id, wl_resource_get_version(compositorResource), compositor)); } @@ -425,18 +425,18 @@ void Compositor::bindCompositor(wl_client *client, void *compositorData, uint32_ static void unregisterResourceCallback(wl_listener *listener, void *data) { struct wl_resource *resource = reinterpret_cast(data); - wl_list_remove(&resource->link); + wl_list_remove(wl_resource_get_link(resource)); delete listener; } void registerResource(wl_list *list, wl_resource *resource) { - wl_list_insert(list, &resource->link); + wl_list_insert(list, wl_resource_get_link(resource)); wl_listener *listener = new wl_listener; listener->notify = unregisterResourceCallback; - wl_signal_add(&resource->destroy_signal, listener); + wl_resource_add_destroy_listener(resource, listener); } QVector Compositor::surfaces() const From 088dc0556da37a2d21ad93119a1be4c6cfab4abf Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Wed, 12 Sep 2018 15:02:09 +0200 Subject: [PATCH 0593/1507] Decorations: Don't depend on wl_shell [ChangeLog][QPA plugin] The private window decoration API method, QWaylandAbstractDecoration::startResize, now takes Qt::Edges argument instead of a wl_shell_surface_resize enum. This will break window decoration plugins written for older versions of Qt Wayland. Change-Id: I4fc9aab949e91efd48a4943f8e116f51dfc373b8 Reviewed-by: Paul Olav Tvete Reviewed-by: Pier Luigi Fiorini --- .../plugins/decorations/bradient/main.cpp | 16 +++++++------- .../wl-shell/qwaylandwlshellsurface.cpp | 15 +++++++++---- .../wl-shell/qwaylandwlshellsurface_p.h | 3 ++- .../xdg-shell-v5/qwaylandxdgsurfacev5.cpp | 17 ++++++++------- .../xdg-shell-v5/qwaylandxdgsurfacev5_p.h | 5 ++--- .../xdg-shell-v6/qwaylandxdgshellv6.cpp | 21 +++++++++++-------- .../xdg-shell-v6/qwaylandxdgshellv6_p.h | 6 ++++-- .../xdg-shell/qwaylandxdgshell.cpp | 21 +++++++++++-------- .../xdg-shell/qwaylandxdgshell_p.h | 6 ++++-- .../wayland/qwaylandabstractdecoration.cpp | 4 ++-- .../wayland/qwaylandabstractdecoration_p.h | 2 +- .../wayland/qwaylandshellsurface_p.h | 3 +-- 12 files changed, 68 insertions(+), 51 deletions(-) diff --git a/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp b/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp index 3fa723446db..83dc8604b45 100644 --- a/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp +++ b/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp @@ -315,19 +315,19 @@ void QWaylandBradientDecoration::processMouseTop(QWaylandInputDevice *inputDevic #if QT_CONFIG(cursor) waylandWindow()->setMouseCursor(inputDevice, Qt::SizeFDiagCursor); #endif - startResize(inputDevice,WL_SHELL_SURFACE_RESIZE_TOP_LEFT,b); + startResize(inputDevice, Qt::TopEdge | Qt::LeftEdge, b); } else if (local.x() > window()->width() + margins().left()) { //top right bit #if QT_CONFIG(cursor) waylandWindow()->setMouseCursor(inputDevice, Qt::SizeBDiagCursor); #endif - startResize(inputDevice,WL_SHELL_SURFACE_RESIZE_TOP_RIGHT,b); + startResize(inputDevice, Qt::TopEdge | Qt::RightEdge, b); } else { //top resize bit #if QT_CONFIG(cursor) waylandWindow()->setMouseCursor(inputDevice, Qt::SplitVCursor); #endif - startResize(inputDevice,WL_SHELL_SURFACE_RESIZE_TOP,b); + startResize(inputDevice, Qt::TopEdge, b); } } else if (local.x() <= margins().left()) { processMouseLeft(inputDevice, local, b, mods); @@ -358,19 +358,19 @@ void QWaylandBradientDecoration::processMouseBottom(QWaylandInputDevice *inputDe #if QT_CONFIG(cursor) waylandWindow()->setMouseCursor(inputDevice, Qt::SizeBDiagCursor); #endif - startResize(inputDevice, WL_SHELL_SURFACE_RESIZE_BOTTOM_LEFT,b); + startResize(inputDevice, Qt::BottomEdge | Qt::LeftEdge, b); } else if (local.x() > window()->width() + margins().left()) { //bottom right bit #if QT_CONFIG(cursor) waylandWindow()->setMouseCursor(inputDevice, Qt::SizeFDiagCursor); #endif - startResize(inputDevice, WL_SHELL_SURFACE_RESIZE_BOTTOM_RIGHT,b); + startResize(inputDevice, Qt::BottomEdge | Qt::RightEdge, b); } else { //bottom bit #if QT_CONFIG(cursor) waylandWindow()->setMouseCursor(inputDevice, Qt::SplitVCursor); #endif - startResize(inputDevice,WL_SHELL_SURFACE_RESIZE_BOTTOM,b); + startResize(inputDevice, Qt::BottomEdge, b); } } @@ -381,7 +381,7 @@ void QWaylandBradientDecoration::processMouseLeft(QWaylandInputDevice *inputDevi #if QT_CONFIG(cursor) waylandWindow()->setMouseCursor(inputDevice, Qt::SplitHCursor); #endif - startResize(inputDevice,WL_SHELL_SURFACE_RESIZE_LEFT,b); + startResize(inputDevice, Qt::LeftEdge, b); } void QWaylandBradientDecoration::processMouseRight(QWaylandInputDevice *inputDevice, const QPointF &local, Qt::MouseButtons b, Qt::KeyboardModifiers mods) @@ -391,7 +391,7 @@ void QWaylandBradientDecoration::processMouseRight(QWaylandInputDevice *inputDev #if QT_CONFIG(cursor) waylandWindow()->setMouseCursor(inputDevice, Qt::SplitHCursor); #endif - startResize(inputDevice, WL_SHELL_SURFACE_RESIZE_RIGHT,b); + startResize(inputDevice, Qt::RightEdge, b); } class QWaylandBradientDecorationPlugin : public QWaylandDecorationPlugin diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellsurface.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellsurface.cpp index d9bc83059b8..ccab131d8a1 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellsurface.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellsurface.cpp @@ -76,11 +76,10 @@ QWaylandWlShellSurface::~QWaylandWlShellSurface() delete m_extendedWindow; } -void QWaylandWlShellSurface::resize(QWaylandInputDevice *inputDevice, enum wl_shell_surface_resize edges) +void QWaylandWlShellSurface::resize(QWaylandInputDevice *inputDevice, Qt::Edges edges) { - resize(inputDevice->wl_seat(), - inputDevice->serial(), - edges); + enum resize resizeEdges = convertToResizeEdges(edges); + resize(inputDevice->wl_seat(), inputDevice->serial(), resizeEdges); } bool QWaylandWlShellSurface::move(QWaylandInputDevice *inputDevice) @@ -193,6 +192,14 @@ void QWaylandWlShellSurface::requestWindowStates(Qt::WindowStates states) m_pending.states = states & ~Qt::WindowMinimized; } +enum QWaylandWlShellSurface::resize QWaylandWlShellSurface::convertToResizeEdges(Qt::Edges edges) +{ + return static_cast( + ((edges & Qt::TopEdge) ? resize_top : 0) + | ((edges & Qt::BottomEdge) ? resize_bottom : 0) + | ((edges & Qt::LeftEdge) ? resize_left : 0) + | ((edges & Qt::RightEdge) ? resize_right : 0)); +} void QWaylandWlShellSurface::setTopLevel() { diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellsurface_p.h b/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellsurface_p.h index 57e06525aea..86305e4e5e0 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellsurface_p.h +++ b/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellsurface_p.h @@ -78,7 +78,7 @@ public: ~QWaylandWlShellSurface() override; using QtWayland::wl_shell_surface::resize; - void resize(QWaylandInputDevice *inputDevice, enum wl_shell_surface_resize edges) override; + void resize(QWaylandInputDevice *inputDevice, Qt::Edges edges) override; using QtWayland::wl_shell_surface::move; bool move(QWaylandInputDevice *inputDevice) override; @@ -99,6 +99,7 @@ protected: void requestWindowStates(Qt::WindowStates states) override; private: + static enum resize convertToResizeEdges(Qt::Edges edges); void setTopLevel(); void updateTransientParent(QWindow *parent); void setPopup(QWaylandWindow *parent, QWaylandInputDevice *device, uint serial); diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgsurfacev5.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgsurfacev5.cpp index 61a865cb211..b691ee74718 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgsurfacev5.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgsurfacev5.cpp @@ -73,18 +73,19 @@ QWaylandXdgSurfaceV5::~QWaylandXdgSurfaceV5() delete m_extendedWindow; } -void QWaylandXdgSurfaceV5::resize(QWaylandInputDevice *inputDevice, enum wl_shell_surface_resize edges) +QtWayland::xdg_surface_v5::resize_edge QWaylandXdgSurfaceV5::convertToResizeEdges(Qt::Edges edges) { - // May need some conversion if types get incompatibles, ATM they're identical - enum resize_edge const * const arg = reinterpret_cast(&edges); - resize(inputDevice, *arg); + return static_cast( + ((edges & Qt::TopEdge) ? resize_edge_top : 0) + | ((edges & Qt::BottomEdge) ? resize_edge_bottom : 0) + | ((edges & Qt::LeftEdge) ? resize_edge_left : 0) + | ((edges & Qt::RightEdge) ? resize_edge_right : 0)); } -void QWaylandXdgSurfaceV5::resize(QWaylandInputDevice *inputDevice, enum resize_edge edges) +void QWaylandXdgSurfaceV5::resize(QWaylandInputDevice *inputDevice, Qt::Edges edges) { - resize(inputDevice->wl_seat(), - inputDevice->serial(), - edges); + resize_edge resizeEdges = convertToResizeEdges(edges); + resize(inputDevice->wl_seat(), inputDevice->serial(), resizeEdges); } bool QWaylandXdgSurfaceV5::move(QWaylandInputDevice *inputDevice) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgsurfacev5_p.h b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgsurfacev5_p.h index b938047eccd..741366fb544 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgsurfacev5_p.h +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgsurfacev5_p.h @@ -81,9 +81,8 @@ public: ~QWaylandXdgSurfaceV5() override; using QtWayland::xdg_surface_v5::resize; - void resize(QWaylandInputDevice *inputDevice, enum resize_edge edges); - - void resize(QWaylandInputDevice *inputDevice, enum wl_shell_surface_resize edges) override; + static resize_edge convertToResizeEdges(Qt::Edges edges); + void resize(QWaylandInputDevice *inputDevice, Qt::Edges edges) override; using QtWayland::xdg_surface_v5::move; bool move(QWaylandInputDevice *inputDevice) override; diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp index 1dc43b371fd..f43df36cbcd 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp @@ -150,6 +150,15 @@ void QWaylandXdgSurfaceV6::Toplevel::requestWindowStates(Qt::WindowStates states } } +QtWayland::zxdg_toplevel_v6::resize_edge QWaylandXdgSurfaceV6::Toplevel::convertToResizeEdges(Qt::Edges edges) +{ + return static_cast( + ((edges & Qt::TopEdge) ? resize_edge_top : 0) + | ((edges & Qt::BottomEdge) ? resize_edge_bottom : 0) + | ((edges & Qt::LeftEdge) ? resize_edge_left : 0) + | ((edges & Qt::RightEdge) ? resize_edge_right : 0)); +} + QWaylandXdgSurfaceV6::Popup::Popup(QWaylandXdgSurfaceV6 *xdgSurface, QWaylandXdgSurfaceV6 *parent, QtWayland::zxdg_positioner_v6 *positioner) : zxdg_popup_v6(xdgSurface->get_popup(parent->object(), positioner->object())) @@ -217,19 +226,13 @@ QWaylandXdgSurfaceV6::~QWaylandXdgSurfaceV6() destroy(); } -void QWaylandXdgSurfaceV6::resize(QWaylandInputDevice *inputDevice, zxdg_toplevel_v6_resize_edge edges) +void QWaylandXdgSurfaceV6::resize(QWaylandInputDevice *inputDevice, Qt::Edges edges) { Q_ASSERT(m_toplevel && m_toplevel->isInitialized()); - m_toplevel->resize(inputDevice->wl_seat(), inputDevice->serial(), edges); + auto resizeEdges = Toplevel::convertToResizeEdges(edges); + m_toplevel->resize(inputDevice->wl_seat(), inputDevice->serial(), resizeEdges); } -void QWaylandXdgSurfaceV6::resize(QWaylandInputDevice *inputDevice, enum wl_shell_surface_resize edges) -{ - auto xdgEdges = reinterpret_cast(&edges); - resize(inputDevice, *xdgEdges); -} - - bool QWaylandXdgSurfaceV6::move(QWaylandInputDevice *inputDevice) { if (m_toplevel && m_toplevel->isInitialized()) { diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6_p.h b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6_p.h index 38b711f88d2..c6e89812179 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6_p.h +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6_p.h @@ -79,8 +79,7 @@ public: QWaylandXdgSurfaceV6(QWaylandXdgShellV6 *shell, ::zxdg_surface_v6 *surface, QWaylandWindow *window); ~QWaylandXdgSurfaceV6() override; - void resize(QWaylandInputDevice *inputDevice, enum zxdg_toplevel_v6_resize_edge edges); - void resize(QWaylandInputDevice *inputDevice, enum wl_shell_surface_resize edges) override; + void resize(QWaylandInputDevice *inputDevice, Qt::Edges edges) override; bool move(QWaylandInputDevice *inputDevice) override; void setTitle(const QString &title) override; void setAppId(const QString &appId) override; @@ -108,6 +107,9 @@ private: void zxdg_toplevel_v6_close() override; void requestWindowStates(Qt::WindowStates states); + + static resize_edge convertToResizeEdges(Qt::Edges edges); + struct { QSize size = {0, 0}; Qt::WindowStates states = Qt::WindowNoState; diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp index 8b3d07481cb..07067e12026 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp @@ -178,6 +178,15 @@ void QWaylandXdgSurface::Toplevel::requestWindowStates(Qt::WindowStates states) } } +QtWayland::xdg_toplevel::resize_edge QWaylandXdgSurface::Toplevel::convertToResizeEdges(Qt::Edges edges) +{ + return static_cast( + ((edges & Qt::TopEdge) ? resize_edge_top : 0) + | ((edges & Qt::BottomEdge) ? resize_edge_bottom : 0) + | ((edges & Qt::LeftEdge) ? resize_edge_left : 0) + | ((edges & Qt::RightEdge) ? resize_edge_right : 0)); +} + QWaylandXdgSurface::Popup::Popup(QWaylandXdgSurface *xdgSurface, QWaylandXdgSurface *parent, QtWayland::xdg_positioner *positioner) : xdg_popup(xdgSurface->get_popup(parent->object(), positioner->object())) @@ -245,19 +254,13 @@ QWaylandXdgSurface::~QWaylandXdgSurface() destroy(); } -void QWaylandXdgSurface::resize(QWaylandInputDevice *inputDevice, xdg_toplevel_resize_edge edges) +void QWaylandXdgSurface::resize(QWaylandInputDevice *inputDevice, Qt::Edges edges) { Q_ASSERT(m_toplevel && m_toplevel->isInitialized()); - m_toplevel->resize(inputDevice->wl_seat(), inputDevice->serial(), edges); + auto resizeEdges = Toplevel::convertToResizeEdges(edges); + m_toplevel->resize(inputDevice->wl_seat(), inputDevice->serial(), resizeEdges); } -void QWaylandXdgSurface::resize(QWaylandInputDevice *inputDevice, enum wl_shell_surface_resize edges) -{ - auto xdgEdges = reinterpret_cast(&edges); - resize(inputDevice, *xdgEdges); -} - - bool QWaylandXdgSurface::move(QWaylandInputDevice *inputDevice) { if (m_toplevel && m_toplevel->isInitialized()) { diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h index 45d7d4b0e0f..591df9dddc6 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h @@ -82,8 +82,7 @@ public: QWaylandXdgSurface(QWaylandXdgShell *shell, ::xdg_surface *surface, QWaylandWindow *window); ~QWaylandXdgSurface() override; - void resize(QWaylandInputDevice *inputDevice, enum xdg_toplevel_resize_edge edges); - void resize(QWaylandInputDevice *inputDevice, enum wl_shell_surface_resize edges) override; + void resize(QWaylandInputDevice *inputDevice, Qt::Edges edges) override; bool move(QWaylandInputDevice *inputDevice) override; void setTitle(const QString &title) override; void setAppId(const QString &appId) override; @@ -114,6 +113,9 @@ private: void requestWindowFlags(Qt::WindowFlags flags); void requestWindowStates(Qt::WindowStates states); + + static resize_edge convertToResizeEdges(Qt::Edges edges); + struct { QSize size = {0, 0}; Qt::WindowStates states = Qt::WindowNoState; diff --git a/src/plugins/platforms/wayland/qwaylandabstractdecoration.cpp b/src/plugins/platforms/wayland/qwaylandabstractdecoration.cpp index 479a857502f..503ad41fce0 100644 --- a/src/plugins/platforms/wayland/qwaylandabstractdecoration.cpp +++ b/src/plugins/platforms/wayland/qwaylandabstractdecoration.cpp @@ -145,11 +145,11 @@ void QWaylandAbstractDecoration::setMouseButtons(Qt::MouseButtons mb) d->m_mouseButtons = mb; } -void QWaylandAbstractDecoration::startResize(QWaylandInputDevice *inputDevice, enum wl_shell_surface_resize resize, Qt::MouseButtons buttons) +void QWaylandAbstractDecoration::startResize(QWaylandInputDevice *inputDevice, Qt::Edges edges, Qt::MouseButtons buttons) { Q_D(QWaylandAbstractDecoration); if (isLeftClicked(buttons) && d->m_wayland_window->shellSurface()) { - d->m_wayland_window->shellSurface()->resize(inputDevice, resize); + d->m_wayland_window->shellSurface()->resize(inputDevice, edges); inputDevice->removeMouseButtonFromState(Qt::LeftButton); } } diff --git a/src/plugins/platforms/wayland/qwaylandabstractdecoration_p.h b/src/plugins/platforms/wayland/qwaylandabstractdecoration_p.h index 84a6d4dd79d..d1b11928ac3 100644 --- a/src/plugins/platforms/wayland/qwaylandabstractdecoration_p.h +++ b/src/plugins/platforms/wayland/qwaylandabstractdecoration_p.h @@ -105,7 +105,7 @@ protected: void setMouseButtons(Qt::MouseButtons mb); - void startResize(QWaylandInputDevice *inputDevice,enum wl_shell_surface_resize resize, Qt::MouseButtons buttons); + void startResize(QWaylandInputDevice *inputDevice, Qt::Edges edges, Qt::MouseButtons buttons); void startMove(QWaylandInputDevice *inputDevice, Qt::MouseButtons buttons); bool isLeftClicked(Qt::MouseButtons newMouseButtonState); diff --git a/src/plugins/platforms/wayland/qwaylandshellsurface_p.h b/src/plugins/platforms/wayland/qwaylandshellsurface_p.h index 6bc3258c799..f034e1bdb3d 100644 --- a/src/plugins/platforms/wayland/qwaylandshellsurface_p.h +++ b/src/plugins/platforms/wayland/qwaylandshellsurface_p.h @@ -75,8 +75,7 @@ class Q_WAYLAND_CLIENT_EXPORT QWaylandShellSurface : public QObject public: explicit QWaylandShellSurface(QWaylandWindow *window); ~QWaylandShellSurface() override {} - virtual void resize(QWaylandInputDevice * /*inputDevice*/, enum wl_shell_surface_resize /*edges*/) - {} + virtual void resize(QWaylandInputDevice * /*inputDevice*/, Qt::Edges /*edges*/) {} virtual bool move(QWaylandInputDevice *) { return false; } virtual void setTitle(const QString & /*title*/) {} From 5efef3d98134c3d4f8b4c587bbee13f8b619d28b Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Tue, 11 Sep 2018 13:02:39 +0200 Subject: [PATCH 0594/1507] Add server buffer integration using Linux dma-buf Fixes: QTBUG-70494 Change-Id: Iaa4990fe9d39a1f9fb81f5e5f19039aa2e52dcac Reviewed-by: Johan Helsing --- .../extensions/qt-dmabuf-server-buffer.xml | 60 +++++++++++++++++ src/plugins/platforms/wayland/configure.json | 11 ++++ .../plugins/hardwareintegration/client.pro | 2 + .../dmabuf-server/dmabuf-server.json | 3 + .../dmabuf-server/dmabuf-server.pro | 15 +++++ .../dmabuf-server/main.cpp | 64 +++++++++++++++++++ .../hardwareintegration/wayland-egl/main.cpp | 4 +- 7 files changed, 156 insertions(+), 3 deletions(-) create mode 100644 src/3rdparty/wayland/extensions/qt-dmabuf-server-buffer.xml create mode 100644 src/plugins/platforms/wayland/plugins/hardwareintegration/dmabuf-server/dmabuf-server.json create mode 100644 src/plugins/platforms/wayland/plugins/hardwareintegration/dmabuf-server/dmabuf-server.pro create mode 100644 src/plugins/platforms/wayland/plugins/hardwareintegration/dmabuf-server/main.cpp diff --git a/src/3rdparty/wayland/extensions/qt-dmabuf-server-buffer.xml b/src/3rdparty/wayland/extensions/qt-dmabuf-server-buffer.xml new file mode 100644 index 00000000000..6b1d426fc07 --- /dev/null +++ b/src/3rdparty/wayland/extensions/qt-dmabuf-server-buffer.xml @@ -0,0 +1,60 @@ + + + + Copyright (C) 2018 The Qt Company Ltd. + Contact: http://www.qt.io/licensing/ + + This file is part of the plugins of the Qt Toolkit. + + $QT_BEGIN_LICENSE:BSD$ + You may use this file under the terms of the BSD license as follows: + + "Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + * Neither the name of The Qt Company Ltd nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." + + $QT_END_LICENSE$ + + + + This protocol is used internally by Qt for implementing the + qt_server_buffer extension on hardware that supports Linux dma-buf. + + This protocol is not part of the Qt API. It exists purely as an + implementation detail and may change from version to + version without notice, or even be removed. + + + + + + + + + + + + + diff --git a/src/plugins/platforms/wayland/configure.json b/src/plugins/platforms/wayland/configure.json index ef5e87bb7e5..1f86a49360f 100644 --- a/src/plugins/platforms/wayland/configure.json +++ b/src/plugins/platforms/wayland/configure.json @@ -68,6 +68,12 @@ "type": "compile", "test": "libhybris_egl_server", "use": "egl" + }, + "dmabuf-server-buffer": { + "label": "Linux dma-buf Buffer Sharing", + "type": "compile", + "test": "dmabuf_server_buffer", + "use": "egl" } }, @@ -111,6 +117,11 @@ "condition": "features.wayland-client && features.opengl && features.egl && tests.libhybris-egl-server", "output": [ "privateFeature" ] }, + "wayland-dmabuf-server-buffer": { + "label": "Linux dma-buf server buffer integration", + "condition": "features.wayland-client && features.opengl && features.egl && tests.dmabuf-server-buffer", + "output": [ "privateFeature" ] + }, "wayland-shm-emulation-server-buffer": { "label": "Shm emulation server buffer integration", "condition": "features.wayland-client && features.opengl", diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/client.pro b/src/plugins/platforms/wayland/plugins/hardwareintegration/client.pro index eab62f8d08e..82e431ee869 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/client.pro +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/client.pro @@ -16,3 +16,5 @@ qtConfig(wayland-libhybris-egl-server-buffer): \ SUBDIRS += libhybris-egl-server qtConfig(wayland-shm-emulation-server-buffer): \ SUBDIRS += shm-emulation-server +qtConfig(wayland-dmabuf-server-buffer): \ + SUBDIRS += dmabuf-server diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/dmabuf-server/dmabuf-server.json b/src/plugins/platforms/wayland/plugins/hardwareintegration/dmabuf-server/dmabuf-server.json new file mode 100644 index 00000000000..22272a4abe9 --- /dev/null +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/dmabuf-server/dmabuf-server.json @@ -0,0 +1,3 @@ +{ + "Keys": [ "dmabuf-server" ] +} diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/dmabuf-server/dmabuf-server.pro b/src/plugins/platforms/wayland/plugins/hardwareintegration/dmabuf-server/dmabuf-server.pro new file mode 100644 index 00000000000..5925c8b04f1 --- /dev/null +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/dmabuf-server/dmabuf-server.pro @@ -0,0 +1,15 @@ +# We have a bunch of C code with casts, so we can't have this option +QMAKE_CXXFLAGS_WARN_ON -= -Wcast-qual + +QT += waylandclient-private + +include(../../../../hardwareintegration/client/dmabuf-server/dmabuf-server.pri) + +OTHER_FILES += \ + dmabuf-server.json + +SOURCES += main.cpp + +PLUGIN_TYPE = wayland-graphics-integration-client +PLUGIN_CLASS_NAME = DmaBufServerBufferPlugin +load(qt_plugin) diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/dmabuf-server/main.cpp b/src/plugins/platforms/wayland/plugins/hardwareintegration/dmabuf-server/main.cpp new file mode 100644 index 00000000000..d4955d458f1 --- /dev/null +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/dmabuf-server/main.cpp @@ -0,0 +1,64 @@ +/**************************************************************************** +** +** Copyright (C) 2018 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include "dmabufserverbufferintegration.h" + +QT_BEGIN_NAMESPACE + +namespace QtWaylandClient { + +class DmaBufServerBufferPlugin : public QWaylandServerBufferIntegrationPlugin +{ + Q_OBJECT + Q_PLUGIN_METADATA(IID QWaylandServerBufferIntegrationFactoryInterface_iid FILE "dmabuf-server.json") +public: + QWaylandServerBufferIntegration *create(const QString&, const QStringList&) override; +}; + +QWaylandServerBufferIntegration *DmaBufServerBufferPlugin::create(const QString&, const QStringList&) +{ + return new DmaBufServerBufferIntegration(); +} + +} + +QT_END_NAMESPACE + +#include "main.moc" diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/main.cpp b/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/main.cpp index 05053ff950d..0890635536f 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/main.cpp +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/main.cpp @@ -52,10 +52,8 @@ public: QWaylandClientBufferIntegration *create(const QString&, const QStringList&) override; }; -QWaylandClientBufferIntegration *QWaylandEglClientBufferPlugin::create(const QString& system, const QStringList& paramList) +QWaylandClientBufferIntegration *QWaylandEglClientBufferPlugin::create(const QString&, const QStringList&) { - Q_UNUSED(paramList); - Q_UNUSED(system); return new QWaylandEglClientBufferIntegration(); } From fc7eaa1ece889153e756005e4457958014cf89b1 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Thu, 30 Aug 2018 16:18:49 +0200 Subject: [PATCH 0595/1507] Client: Make features for shell integrations [ChangeLog][QPA plugin] Shell integrations are now features that can be enabled or disabled at build time. Change-Id: I1c48bb5d444074ac25331cb1ca8a9f49ebcd9805 Reviewed-by: Paul Olav Tvete --- src/plugins/platforms/wayland/configure.json | 36 +++++++++++++++++++ .../shellintegration/shellintegration.pro | 13 ++++--- 2 files changed, 42 insertions(+), 7 deletions(-) diff --git a/src/plugins/platforms/wayland/configure.json b/src/plugins/platforms/wayland/configure.json index ef5e87bb7e5..e5a0e5c7f16 100644 --- a/src/plugins/platforms/wayland/configure.json +++ b/src/plugins/platforms/wayland/configure.json @@ -81,6 +81,31 @@ "condition": "features.draganddrop || features.clipboard", "output": [ "privateFeature" ] }, + "wayland-client-ivi-shell": { + "label": "ivi-shell", + "condition": "features.wayland-client", + "output": [ "privateFeature" ] + }, + "wayland-client-wl-shell": { + "label": "wl-shell (deprecated)", + "condition": "features.wayland-client", + "output": [ "privateFeature" ] + }, + "wayland-client-xdg-shell": { + "label": "xdg-shell", + "condition": "features.wayland-client", + "output": [ "privateFeature" ] + }, + "wayland-client-xdg-shell-v5": { + "label": "xdg-shell unstable v5 (deprecated)", + "condition": "features.wayland-client", + "output": [ "privateFeature" ] + }, + "wayland-client-xdg-shell-v6": { + "label": "xdg-shell unstable v6", + "condition": "features.wayland-client", + "output": [ "privateFeature" ] + }, "wayland-egl": { "label": "EGL", "condition": "features.wayland-client && features.opengl && features.egl && libs.wayland-egl", @@ -140,6 +165,17 @@ "wayland-shm-emulation-server-buffer" ] }, + { + "section": "Qt Wayland Client Shell Integrations", + "condition": "features.wayland-client", + "entries": [ + "wayland-client-xdg-shell", + "wayland-client-xdg-shell-v5", + "wayland-client-xdg-shell-v6", + "wayland-client-ivi-shell", + "wayland-client-wl-shell" + ] + }, "wayland-client" ] } diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/shellintegration.pro b/src/plugins/platforms/wayland/plugins/shellintegration/shellintegration.pro index 48b6efa363f..627c7668eec 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/shellintegration.pro +++ b/src/plugins/platforms/wayland/plugins/shellintegration/shellintegration.pro @@ -1,9 +1,8 @@ TEMPLATE = subdirs +QT_FOR_CONFIG += waylandclient-private -SUBDIRS += \ - ivi-shell \ - xdg-shell \ - xdg-shell-v5 \ - xdg-shell-v6 \ - wl-shell \ - +qtConfig(wayland-client-ivi-shell): SUBDIRS += ivi-shell +qtConfig(wayland-client-wl-shell): SUBDIRS += wl-shell +qtConfig(wayland-client-xdg-shell): SUBDIRS += xdg-shell +qtConfig(wayland-client-xdg-shell-v5): SUBDIRS += xdg-shell-v5 +qtConfig(wayland-client-xdg-shell-v6): SUBDIRS += xdg-shell-v6 From f086d9603559f1aaa0300b8ecf7878b89f095872 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Tue, 2 Oct 2018 13:54:59 +0200 Subject: [PATCH 0596/1507] Client: Remove failing assert on compositors without wl_data_device Some compositors don't advertise wl_data_device_manager support, and the client has no control over this, so the assertion doesn't make sense. Returning nullptr in that case should be fine. Change-Id: If0b145326d074ea4ebf8f5a12654962d56012a2d Reviewed-by: Paul Olav Tvete --- src/plugins/platforms/wayland/qwaylandinputdevice.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index b4b7c4ef323..37c6fbe9fd0 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -297,7 +297,6 @@ void QWaylandInputDevice::setDataDevice(QWaylandDataDevice *device) QWaylandDataDevice *QWaylandInputDevice::dataDevice() const { - Q_ASSERT(mDataDevice); return mDataDevice; } #endif From e7c0cbac89a14ea1a88406ff11ac95ab84ed809e Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Wed, 12 Sep 2018 14:12:44 +0200 Subject: [PATCH 0597/1507] Don't include system versions of wayland protocol wayland-client.h and wayland-server.h includes protocol generated for the version of wayland.xml corresponding to the libwayland version. This becomes a problem when we want to support a version of wayland.xml that's newer than the system libwayland. The solution is to include wayland-client-core.h and wayland-client-server.h instead. These headers don't include any wayland-scanner generated code, so we can safely compile and link code generated against the version of wayland.xml that we ship. [ChangeLog] Code generated by qtwaylandscanner now includes wayland-client-core.h and wayland-server-core.h instead of wayland-client.h and wayland-server.h. This might break source compatibility for code using custom wayland extensions. Fixes: QTBUG-70553 Change-Id: Ice0cdb60ecc4f936acc0e158b96f7978549f62c1 Reviewed-by: Paul Olav Tvete --- src/plugins/platforms/wayland/client.pro | 4 +--- .../wl-shell/qwaylandwlshellintegration_p.h | 1 - .../wl-shell/qwaylandwlshellsurface_p.h | 2 -- .../3rdparty/qwayland-xdg-shell-unstable-v5.cpp | 1 + .../3rdparty/qwayland-xdg-shell-unstable-v5_p.h | 2 ++ ...nd-xdg-shell-unstable-v5-client-protocol_p.h | 2 +- .../xdg-shell-v5/qwaylandxdgpopupv5_p.h | 2 -- .../xdg-shell-v5/qwaylandxdgshellv5_p.h | 2 -- .../xdg-shell-v5/qwaylandxdgsurfacev5_p.h | 2 -- .../xdg-shell-v6/qwaylandxdgshellv6_p.h | 2 -- .../xdg-shell/qwaylandxdgshell_p.h | 2 -- .../wayland/qwaylandabstractdecoration_p.h | 2 -- .../platforms/wayland/qwaylandbuffer_p.h | 3 +-- .../platforms/wayland/qwaylanddisplay_p.h | 2 -- .../wayland/qwaylandextendedsurface_p.h | 1 - .../platforms/wayland/qwaylandinputcontext_p.h | 3 +++ .../platforms/wayland/qwaylandinputdevice_p.h | 2 -- .../platforms/wayland/qwaylandshellsurface_p.h | 2 -- .../wayland/qwaylandshmbackingstore.cpp | 3 +-- .../platforms/wayland/qwaylandsubsurface_p.h | 2 -- .../qwaylandwindowmanagerintegration_p.h | 1 - src/tools/qtwaylandscanner/qtwaylandscanner.cpp | 17 +++++++++++++++-- tests/auto/wayland/shared/mockcompositor.h | 3 +-- 23 files changed, 26 insertions(+), 37 deletions(-) diff --git a/src/plugins/platforms/wayland/client.pro b/src/plugins/platforms/wayland/client.pro index 45bbb976b4e..d65866e616e 100644 --- a/src/plugins/platforms/wayland/client.pro +++ b/src/plugins/platforms/wayland/client.pro @@ -29,9 +29,7 @@ WAYLANDCLIENTSOURCES += \ ../extensions/qt-windowmanager.xml \ ../3rdparty/protocol/text-input-unstable-v2.xml \ ../3rdparty/protocol/xdg-output-unstable-v1.xml \ - -WAYLANDCLIENTSOURCES_SYSTEM += \ - ../3rdparty/protocol/wayland.xml \ + ../3rdparty/protocol/wayland.xml SOURCES += qwaylandintegration.cpp \ qwaylandnativeinterface.cpp \ diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellintegration_p.h b/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellintegration_p.h index 80a7507d4b5..3d76cc31073 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellintegration_p.h +++ b/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellintegration_p.h @@ -51,7 +51,6 @@ // We mean it. // -#include #include #include diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellsurface_p.h b/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellsurface_p.h index 86305e4e5e0..324c10aacae 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellsurface_p.h +++ b/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellsurface_p.h @@ -53,8 +53,6 @@ #include -#include - #include #include #include diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/pregenerated/3rdparty/qwayland-xdg-shell-unstable-v5.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/pregenerated/3rdparty/qwayland-xdg-shell-unstable-v5.cpp index 0115eb1dacd..51979acf77c 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/pregenerated/3rdparty/qwayland-xdg-shell-unstable-v5.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/pregenerated/3rdparty/qwayland-xdg-shell-unstable-v5.cpp @@ -25,6 +25,7 @@ * DEALINGS IN THE SOFTWARE. */ #include "qwayland-xdg-shell-unstable-v5_p.h" +#include QT_BEGIN_NAMESPACE QT_WARNING_PUSH diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/pregenerated/3rdparty/qwayland-xdg-shell-unstable-v5_p.h b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/pregenerated/3rdparty/qwayland-xdg-shell-unstable-v5_p.h index 3d8a6c13d92..8fb1ea7b86a 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/pregenerated/3rdparty/qwayland-xdg-shell-unstable-v5_p.h +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/pregenerated/3rdparty/qwayland-xdg-shell-unstable-v5_p.h @@ -31,6 +31,8 @@ #include #include +struct wl_registry; + QT_BEGIN_NAMESPACE QT_WARNING_PUSH QT_WARNING_DISABLE_GCC("-Wmissing-field-initializers") diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/pregenerated/3rdparty/wayland-xdg-shell-unstable-v5-client-protocol_p.h b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/pregenerated/3rdparty/wayland-xdg-shell-unstable-v5-client-protocol_p.h index 46644610b75..8877e8830c3 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/pregenerated/3rdparty/wayland-xdg-shell-unstable-v5-client-protocol_p.h +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/pregenerated/3rdparty/wayland-xdg-shell-unstable-v5-client-protocol_p.h @@ -7,7 +7,7 @@ #include #include -#include "wayland-client.h" +#include "wayland-client-core.h" #ifdef __cplusplus extern "C" { diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgpopupv5_p.h b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgpopupv5_p.h index ff8e5639f63..7494f6a67ea 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgpopupv5_p.h +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgpopupv5_p.h @@ -53,8 +53,6 @@ #include "qwayland-xdg-shell-unstable-v5_p.h" -#include - #include #include diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshellv5_p.h b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshellv5_p.h index 67e5d32a7a3..2b0a59f1749 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshellv5_p.h +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshellv5_p.h @@ -56,8 +56,6 @@ #include #include -#include - #include #include diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgsurfacev5_p.h b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgsurfacev5_p.h index 741366fb544..231a56d8433 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgsurfacev5_p.h +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgsurfacev5_p.h @@ -59,8 +59,6 @@ #include #include -#include - QT_BEGIN_NAMESPACE class QWindow; diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6_p.h b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6_p.h index c6e89812179..c88d111d22d 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6_p.h +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6_p.h @@ -60,8 +60,6 @@ #include #include -#include - QT_BEGIN_NAMESPACE class QWindow; diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h index 591df9dddc6..77d6ec82829 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h @@ -62,8 +62,6 @@ #include #include -#include - QT_BEGIN_NAMESPACE class QWindow; diff --git a/src/plugins/platforms/wayland/qwaylandabstractdecoration_p.h b/src/plugins/platforms/wayland/qwaylandabstractdecoration_p.h index d1b11928ac3..f5b1854dd92 100644 --- a/src/plugins/platforms/wayland/qwaylandabstractdecoration_p.h +++ b/src/plugins/platforms/wayland/qwaylandabstractdecoration_p.h @@ -61,8 +61,6 @@ #include #include -#include - #include QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandbuffer_p.h b/src/plugins/platforms/wayland/qwaylandbuffer_p.h index eea090f35cd..945f1279af4 100644 --- a/src/plugins/platforms/wayland/qwaylandbuffer_p.h +++ b/src/plugins/platforms/wayland/qwaylandbuffer_p.h @@ -56,8 +56,7 @@ #include #include -#include -#include +#include QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylanddisplay_p.h b/src/plugins/platforms/wayland/qwaylanddisplay_p.h index 0dd8d7affb8..d03ea294af3 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay_p.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay_p.h @@ -59,8 +59,6 @@ #include #include -#include - #include #include #include diff --git a/src/plugins/platforms/wayland/qwaylandextendedsurface_p.h b/src/plugins/platforms/wayland/qwaylandextendedsurface_p.h index cd604f34211..d71ac6be9db 100644 --- a/src/plugins/platforms/wayland/qwaylandextendedsurface_p.h +++ b/src/plugins/platforms/wayland/qwaylandextendedsurface_p.h @@ -56,7 +56,6 @@ #include -#include #include QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandinputcontext_p.h b/src/plugins/platforms/wayland/qwaylandinputcontext_p.h index 93300e1f5ac..10132dfe19b 100644 --- a/src/plugins/platforms/wayland/qwaylandinputcontext_p.h +++ b/src/plugins/platforms/wayland/qwaylandinputcontext_p.h @@ -62,6 +62,9 @@ #include #include +struct wl_callback; +struct wl_callback_listener; + QT_BEGIN_NAMESPACE Q_DECLARE_LOGGING_CATEGORY(qLcQpaInputMethods) diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h index 4b12cc089b2..e1f0f50708f 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h +++ b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h @@ -61,8 +61,6 @@ #include #include -#include - #include #if QT_CONFIG(xkbcommon_evdev) diff --git a/src/plugins/platforms/wayland/qwaylandshellsurface_p.h b/src/plugins/platforms/wayland/qwaylandshellsurface_p.h index f034e1bdb3d..f683d9e013d 100644 --- a/src/plugins/platforms/wayland/qwaylandshellsurface_p.h +++ b/src/plugins/platforms/wayland/qwaylandshellsurface_p.h @@ -54,8 +54,6 @@ #include #include -#include - #include #include diff --git a/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp b/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp index ecb03c0d602..8cc9598fa3e 100644 --- a/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp +++ b/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp @@ -49,8 +49,7 @@ #include #include -#include -#include +#include #include #include diff --git a/src/plugins/platforms/wayland/qwaylandsubsurface_p.h b/src/plugins/platforms/wayland/qwaylandsubsurface_p.h index e9a7cb20e70..76da10b2459 100644 --- a/src/plugins/platforms/wayland/qwaylandsubsurface_p.h +++ b/src/plugins/platforms/wayland/qwaylandsubsurface_p.h @@ -51,8 +51,6 @@ // We mean it. // -#include - #include #include diff --git a/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration_p.h b/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration_p.h index 1319abd9106..31de6ddd34f 100644 --- a/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration_p.h @@ -54,7 +54,6 @@ #include #include -#include #include #include diff --git a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp index f2e2d24de5e..4494b7c620b 100644 --- a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp +++ b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp @@ -440,7 +440,7 @@ bool Scanner::process() printf("#ifndef %s\n", inclusionGuard.constData()); printf("#define %s\n", inclusionGuard.constData()); printf("\n"); - printf("#include \"wayland-server.h\"\n"); + printf("#include \"wayland-server-core.h\"\n"); if (m_headerPath.isEmpty()) printf("#include \"wayland-%s-server-protocol.h\"\n", QByteArray(m_protocolName).replace('_', '-').constData()); else @@ -938,6 +938,8 @@ bool Scanner::process() printf("#include \n"); printf("#include \n"); printf("\n"); + printf("struct wl_registry;\n"); + printf("\n"); printf("QT_BEGIN_NAMESPACE\n"); printf("QT_WARNING_PUSH\n"); printf("QT_WARNING_DISABLE_GCC(\"-Wmissing-field-initializers\")\n"); @@ -1055,6 +1057,17 @@ bool Scanner::process() printf("QT_WARNING_DISABLE_GCC(\"-Wmissing-field-initializers\")\n"); printf("\n"); printf("namespace QtWayland {\n"); + printf("\n"); + + // wl_registry_bind is part of the protocol, so we can't use that... instead we use core + // libwayland API to do the same thing a wayland-scanner generated wl_registry_bind would. + printf("static inline void *wlRegistryBind(struct ::wl_registry *registry, uint32_t name, const struct ::wl_interface *interface, uint32_t version)\n"); + printf("{\n"); + printf(" const uint32_t bindOpCode = 0;\n"); + printf(" return (void *) wl_proxy_marshal_constructor_versioned((struct wl_proxy *) registry,\n"); + printf(" bindOpCode, interface, version, name, interface->name, version, NULL);\n"); + printf("}\n"); + printf("\n"); for (int j = 0; j < interfaces.size(); ++j) { const WaylandInterface &interface = interfaces.at(j); @@ -1095,7 +1108,7 @@ bool Scanner::process() printf(" void %s::init(struct ::wl_registry *registry, int id, int version)\n", interfaceName); printf(" {\n"); - printf(" m_%s = static_cast(wl_registry_bind(registry, id, &%s_interface, version));\n", interfaceName, interfaceName, interfaceName); + printf(" m_%s = static_cast(wlRegistryBind(registry, id, &%s_interface, version));\n", interfaceName, interfaceName, interfaceName); if (hasEvents) printf(" init_listener();\n"); printf(" }\n"); diff --git a/tests/auto/wayland/shared/mockcompositor.h b/tests/auto/wayland/shared/mockcompositor.h index 51b6f4bfb93..b0d6b08855c 100644 --- a/tests/auto/wayland/shared/mockcompositor.h +++ b/tests/auto/wayland/shared/mockcompositor.h @@ -34,7 +34,7 @@ #include #include -#include +#include #include #include @@ -121,7 +121,6 @@ private: wl_display *m_display = nullptr; wl_event_loop *m_loop = nullptr; - wl_shm *m_shm = nullptr; int m_fd = -1; uint32_t m_time = 0; From b25af2c7687b5802b48076ba1a885cc986084629 Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Sun, 30 Sep 2018 11:30:18 +0300 Subject: [PATCH 0598/1507] Avoid spurious move events after configure call Whilst wayland can't actually move the window in a QWindow::setGeometry call the previous behavior was to keep it so that it appeared to the client that it had moved. The new behavior is non-consistent, QWindow::setPosition will update QWindow::position until the first configure call is received at which point it will move back to 0,0. This then generates a QMoveEvent for the window that hasn't moved. This patch keeps the QWindow::position consistent with the user request and doesn't generate move events. Change-Id: Ifb1433b3902d44c1b2e43036bc1805a6e00128fb Reviewed-by: Johan Helsing --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index cc69fac95d9..52bee6ae318 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -345,7 +345,7 @@ void QWaylandWindow::resizeFromApplyConfigure(const QSize &sizeWithMargins, cons QMargins margins = frameMargins(); int widthWithoutMargins = qMax(sizeWithMargins.width() - (margins.left()+margins.right()), 1); int heightWithoutMargins = qMax(sizeWithMargins.height() - (margins.top()+margins.bottom()), 1); - QRect geometry(QPoint(), QSize(widthWithoutMargins, heightWithoutMargins)); + QRect geometry(windowGeometry().topLeft(), QSize(widthWithoutMargins, heightWithoutMargins)); mOffset += offset; setGeometry(geometry); From 702fa089af78368e4094b3dac5b601000c858652 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Wed, 3 Oct 2018 12:03:30 +0200 Subject: [PATCH 0599/1507] Remove wayland-client.h include Change-Id: I44df8aa9117e12280f6397f7d75dc10959905302 Reviewed-by: Paul Olav Tvete --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index cc69fac95d9..75a1610eedc 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -67,8 +67,6 @@ #include -#include - QT_BEGIN_NAMESPACE namespace QtWaylandClient { From d78e0e3457b10b6a9353943b3ad60c87003ef94b Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Fri, 5 Oct 2018 12:06:41 +0200 Subject: [PATCH 0600/1507] Fix compilation with libwayland < 1.10 (again) wl_proxy_marshal_constructor_versioned was added in libwayland v1.10.0, use the old way with wl_proxy_marshal_constructor for older versions instead. Change-Id: I4514212e0b44ecbf200769759667186f71b279b6 Reviewed-by: Paul Olav Tvete --- src/tools/qtwaylandscanner/qtwaylandscanner.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp index 4494b7c620b..1da8bdb443b 100644 --- a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp +++ b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp @@ -1064,8 +1064,13 @@ bool Scanner::process() printf("static inline void *wlRegistryBind(struct ::wl_registry *registry, uint32_t name, const struct ::wl_interface *interface, uint32_t version)\n"); printf("{\n"); printf(" const uint32_t bindOpCode = 0;\n"); + printf("#if (WAYLAND_VERSION_MAJOR == 1 && WAYLAND_VERSION_MINOR > 10) || WAYLAND_VERSION_MAJOR > 1\n"); printf(" return (void *) wl_proxy_marshal_constructor_versioned((struct wl_proxy *) registry,\n"); - printf(" bindOpCode, interface, version, name, interface->name, version, NULL);\n"); + printf(" bindOpCode, interface, version, name, interface->name, version, nullptr);\n"); + printf("#else\n"); + printf(" return (void *) wl_proxy_marshal_constructor((struct wl_proxy *) registry,\n"); + printf(" bindOpCode, interface, name, interface->name, version, nullptr);\n"); + printf("#endif\n"); printf("}\n"); printf("\n"); for (int j = 0; j < interfaces.size(); ++j) { From e71099c07e23d1ed1776caa432c4207b0d535885 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Mon, 8 Oct 2018 11:25:32 +0200 Subject: [PATCH 0601/1507] Client: Fix cursor size becoming bigger and bigger when switching screens cursorSize was a static which was multiplied with the dpr each time loadCursorSize was called resulting in a bigger and bigger cursor size. Fix it by making the static constant. Change-Id: Ie23cf0cc0d6c13721feecebe214d7c794be35077 Reviewed-by: Paul Olav Tvete Reviewed-by: David Edmundson --- src/plugins/platforms/wayland/qwaylanddisplay.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index c57dc13add2..a2957e0dd3d 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -526,9 +526,10 @@ void QWaylandDisplay::setCursor(const QSharedPointer &buffer, co QWaylandCursorTheme *QWaylandDisplay::loadCursorTheme(qreal devicePixelRatio) { - static int cursorSize = qEnvironmentVariableIntValue("XCURSOR_SIZE"); - if (cursorSize <= 0) - cursorSize = 32; + constexpr int defaultCursorSize = 32; + static const int xCursorSize = qEnvironmentVariableIntValue("XCURSOR_SIZE"); + int cursorSize = xCursorSize > 0 ? xCursorSize : defaultCursorSize; + if (compositorVersion() >= 3) // set_buffer_scale is not supported on earlier versions cursorSize *= devicePixelRatio; From 6f183c7db7a91a05ef463031dd2a9521ef1e081d Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Tue, 19 Jun 2018 15:00:20 +0200 Subject: [PATCH 0602/1507] Client (xdg-shell): Only restore normal size when not maximized kwin and perhaps other compositors sometimes send questionable configure events with state set to maximized and size == {0,0}. Previously, we would then restore the m_normalSize, which would give us a maximized window with the size of a windowed (normal) one. A size of zero usually means that it's up to the client to decide, which makes sense for non-maximized windows, but not so much for maximized ones. This is what the protocol spec says about the maximized state: The surface is maximized. The window geometry specified in the configure event must be obeyed by the client. It's fixed in the dev version of kwin, but until then, let's be on the safe side and only resize the window if things make sense. [ChangeLog][QPA plugin] Fixed a bug where maximized windows would resize to their unmaximized size if the compositor sent an invalid configure event. Change-Id: I2371b29c82426ac48cd1c18c14c3dd0fe4f2250e Reviewed-by: David Edmundson Reviewed-by: Paul Olav Tvete --- .../xdg-shell-v6/qwaylandxdgshellv6.cpp | 15 +++++++++++---- .../xdg-shell/qwaylandxdgshell.cpp | 15 +++++++++++---- 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp index 1dc43b371fd..447e8fb6a5f 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp @@ -72,9 +72,6 @@ void QWaylandXdgSurfaceV6::Toplevel::applyConfigure() if (!(m_applied.states & (Qt::WindowMaximized|Qt::WindowFullScreen))) m_normalSize = m_xdgSurface->m_window->window()->frameGeometry().size(); - if (m_pending.size.isEmpty() && !m_normalSize.isEmpty()) - m_pending.size = m_normalSize; - if ((m_pending.states & Qt::WindowActive) && !(m_applied.states & Qt::WindowActive)) m_xdgSurface->m_window->display()->handleWindowActivated(m_xdgSurface->m_window); @@ -85,10 +82,20 @@ void QWaylandXdgSurfaceV6::Toplevel::applyConfigure() Qt::WindowStates statesWithoutActive = m_pending.states & ~Qt::WindowActive; m_xdgSurface->m_window->handleWindowStatesChanged(statesWithoutActive); - m_xdgSurface->m_window->resizeFromApplyConfigure(m_pending.size); + + if (m_pending.size.isEmpty()) { + // An empty size in the configure means it's up to the client to choose the size + bool normalPending = !(m_pending.states & (Qt::WindowMaximized|Qt::WindowFullScreen)); + if (normalPending && !m_normalSize.isEmpty()) + m_xdgSurface->m_window->resizeFromApplyConfigure(m_normalSize); + } else { + m_xdgSurface->m_window->resizeFromApplyConfigure(m_pending.size); + } + QSize windowGeometrySize = m_xdgSurface->m_window->window()->frameGeometry().size(); m_xdgSurface->set_window_geometry(0, 0, windowGeometrySize.width(), windowGeometrySize.height()); m_applied = m_pending; + qCDebug(lcQpaWayland) << "Applied pending zxdg_toplevel_v6 configure event:" << m_applied.size << m_applied.states; } void QWaylandXdgSurfaceV6::Toplevel::zxdg_toplevel_v6_configure(int32_t width, int32_t height, wl_array *states) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp index 8b3d07481cb..0756e4d020c 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp @@ -82,9 +82,6 @@ void QWaylandXdgSurface::Toplevel::applyConfigure() if (!(m_applied.states & (Qt::WindowMaximized|Qt::WindowFullScreen))) m_normalSize = m_xdgSurface->m_window->window()->frameGeometry().size(); - if (m_pending.size.isEmpty() && !m_normalSize.isEmpty()) - m_pending.size = m_normalSize; - if ((m_pending.states & Qt::WindowActive) && !(m_applied.states & Qt::WindowActive)) m_xdgSurface->m_window->display()->handleWindowActivated(m_xdgSurface->m_window); @@ -95,10 +92,20 @@ void QWaylandXdgSurface::Toplevel::applyConfigure() Qt::WindowStates statesWithoutActive = m_pending.states & ~Qt::WindowActive; m_xdgSurface->m_window->handleWindowStatesChanged(statesWithoutActive); - m_xdgSurface->m_window->resizeFromApplyConfigure(m_pending.size); + + if (m_pending.size.isEmpty()) { + // An empty size in the configure means it's up to the client to choose the size + bool normalPending = !(m_pending.states & (Qt::WindowMaximized|Qt::WindowFullScreen)); + if (normalPending && !m_normalSize.isEmpty()) + m_xdgSurface->m_window->resizeFromApplyConfigure(m_normalSize); + } else { + m_xdgSurface->m_window->resizeFromApplyConfigure(m_pending.size); + } + QSize windowGeometrySize = m_xdgSurface->m_window->window()->frameGeometry().size(); m_xdgSurface->set_window_geometry(0, 0, windowGeometrySize.width(), windowGeometrySize.height()); m_applied = m_pending; + qCDebug(lcQpaWayland) << "Applied pending xdg_toplevel configure event:" << m_applied.size << m_applied.states; } bool QWaylandXdgSurface::Toplevel::wantsDecorations() From 833e1cef0624fbe7ca79df2ca9b6522742ea368f Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Fri, 15 Sep 2017 18:34:49 +0200 Subject: [PATCH 0603/1507] Load the Linux SPI Accessibility bridge This is mostly a copy of XCB's atspi brige loading, only it creates the original QPlatformAccessility() instance if the atspi bridge is not available, to match the current behavior. This also moves accesibility module to be lazy-loaded to match both Mir and XCB QPAs. Change-Id: I7b7ccadbec3760ab8a9449124db0db3f28c1f355 Reviewed-by: Frederik Gladhorn --- src/plugins/platforms/wayland/client.pro | 3 +++ .../platforms/wayland/qwaylandintegration.cpp | 16 +++++++++++++--- .../platforms/wayland/qwaylandintegration_p.h | 2 +- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/src/plugins/platforms/wayland/client.pro b/src/plugins/platforms/wayland/client.pro index d65866e616e..42e7cae8c5c 100644 --- a/src/plugins/platforms/wayland/client.pro +++ b/src/plugins/platforms/wayland/client.pro @@ -18,6 +18,9 @@ CONFIG += link_pkgconfig wayland-scanner qtConfig(xkbcommon-evdev): \ QMAKE_USE_PRIVATE += xkbcommon_evdev +qtHaveModule(linuxaccessibility_support_private): \ + QT += linuxaccessibility_support_private + QMAKE_USE += wayland-client INCLUDEPATH += $$PWD/../shared diff --git a/src/plugins/platforms/wayland/qwaylandintegration.cpp b/src/plugins/platforms/wayland/qwaylandintegration.cpp index d2fa8568c78..c3163ee3dc4 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandintegration.cpp @@ -86,6 +86,10 @@ #include "qwaylandinputdeviceintegration_p.h" #include "qwaylandinputdeviceintegrationfactory_p.h" +#ifndef QT_NO_ACCESSIBILITY_ATSPI_BRIDGE +#include +#endif + QT_BEGIN_NAMESPACE namespace QtWaylandClient { @@ -129,9 +133,6 @@ QWaylandIntegration::QWaylandIntegration() : mFontDb(new QGenericUnixFontDatabase()) #endif , mNativeInterface(new QWaylandNativeInterface(this)) -#if QT_CONFIG(accessibility) - , mAccessibility(new QPlatformAccessibility()) -#endif { initializeInputDeviceIntegration(); mDisplay.reset(new QWaylandDisplay(this)); @@ -277,6 +278,15 @@ QVariant QWaylandIntegration::styleHint(StyleHint hint) const #if QT_CONFIG(accessibility) QPlatformAccessibility *QWaylandIntegration::accessibility() const { + if (!mAccessibility) { +#ifndef QT_NO_ACCESSIBILITY_ATSPI_BRIDGE + Q_ASSERT_X(QCoreApplication::eventDispatcher(), "QXcbIntegration", + "Initializing accessibility without event-dispatcher!"); + mAccessibility.reset(new QSpiAccessibleBridge()); +#else + mAccessibility.reset(new QPlatformAccessibility()); +#endif + } return mAccessibility.data(); } #endif diff --git a/src/plugins/platforms/wayland/qwaylandintegration_p.h b/src/plugins/platforms/wayland/qwaylandintegration_p.h index a5a3d7b6956..944f635bbfb 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration_p.h +++ b/src/plugins/platforms/wayland/qwaylandintegration_p.h @@ -145,7 +145,7 @@ private: QScopedPointer mNativeInterface; QScopedPointer mInputContext; #if QT_CONFIG(accessibility) - QScopedPointer mAccessibility; + mutable QScopedPointer mAccessibility; #endif bool mFailed = false; bool mClientBufferIntegrationInitialized = false; From 3b4dd0f24b412f9b921d730fb731f2efa097aa5c Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Thu, 11 Oct 2018 10:37:40 +0200 Subject: [PATCH 0604/1507] Client: Set key repeat rate and delay from the repeat_info event [ChangeLog][QPA plugin] Clients now follow the keyboard key repeat delay and interval configured by the compositor. Change-Id: I8a88d341a2bb648d70f95494fe19e941273ae31b Reviewed-by: Pier Luigi Fiorini --- src/plugins/platforms/wayland/qwaylandinputdevice.cpp | 10 ++++++++-- src/plugins/platforms/wayland/qwaylandinputdevice_p.h | 3 +++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index 37c6fbe9fd0..5b5ad7a3211 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -781,7 +781,7 @@ void QWaylandInputDevice::Keyboard::keyboard_key(uint32_t serial, uint32_t time, #if QT_CONFIG(xkbcommon_evdev) mRepeatSym = sym; #endif - mRepeatTimer.setInterval(400); + mRepeatTimer.setInterval(mRepeatDelay); mRepeatTimer.start(); } else if (mRepeatCode == code) { mRepeatTimer.stop(); @@ -790,7 +790,7 @@ void QWaylandInputDevice::Keyboard::keyboard_key(uint32_t serial, uint32_t time, void QWaylandInputDevice::Keyboard::repeatKey() { - mRepeatTimer.setInterval(25); + mRepeatTimer.setInterval(mRepeatRate); sendKey(mFocus->window(), mRepeatTime, QEvent::KeyRelease, mRepeatKey, modifiers(), mRepeatCode, #if QT_CONFIG(xkbcommon_evdev) mRepeatSym, mNativeModifiers, @@ -830,6 +830,12 @@ void QWaylandInputDevice::Keyboard::keyboard_modifiers(uint32_t serial, #endif } +void QWaylandInputDevice::Keyboard::keyboard_repeat_info(int32_t rate, int32_t delay) +{ + mRepeatRate = rate; + mRepeatDelay = delay; +} + void QWaylandInputDevice::Touch::touch_down(uint32_t serial, uint32_t time, struct wl_surface *surface, diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h index e1f0f50708f..d1ff0da23bb 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h +++ b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h @@ -204,6 +204,7 @@ public: uint32_t mods_latched, uint32_t mods_locked, uint32_t group) override; + void keyboard_repeat_info(int32_t rate, int32_t delay) override; QWaylandInputDevice *mParent = nullptr; QPointer mFocus; @@ -219,6 +220,8 @@ public: int mRepeatKey; uint32_t mRepeatCode; uint32_t mRepeatTime; + int mRepeatRate = 25; + int mRepeatDelay = 400; QString mRepeatText; #if QT_CONFIG(xkbcommon_evdev) xkb_keysym_t mRepeatSym; From 46aece51330b6f9b5b4bfd68a5b3b183dc5b1c38 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Mon, 24 Sep 2018 13:04:51 +0200 Subject: [PATCH 0605/1507] Client: Don't attach buffers to unexposed windows QBackingStore::flush is sometimes called with an unxeposed window, in that case, don't attach the buffer to the wl_surface immediately, as that causes protocol errors with xdg_shell. Flushed buffers are instead stored until we get the first configure event. [ChangeLog][QPA plugin][xdg-shell] Fixed a bug where buffers were sometimes attached and committed before the first configure event, causing protocol errors. Fixes: QTBUG-71345 Change-Id: If9409d97bd25f6b13940c56141920a664c349c8e Reviewed-by: Paul Olav Tvete Reviewed-by: David Edmundson --- .../xdg-shell-v6/qwaylandxdgshellv6.cpp | 19 ++++++++-- .../xdg-shell-v6/qwaylandxdgshellv6_p.h | 2 +- .../xdg-shell/qwaylandxdgshell.cpp | 19 ++++++++-- .../xdg-shell/qwaylandxdgshell_p.h | 2 +- .../wayland/qwaylandshmbackingstore.cpp | 3 +- .../platforms/wayland/qwaylandwindow.cpp | 22 ++++++++++++ .../platforms/wayland/qwaylandwindow_p.h | 4 +++ tests/auto/wayland/shared/mocksurface.cpp | 12 ++++--- tests/auto/wayland/shared/mocksurface.h | 7 ++-- tests/auto/wayland/shared/mockxdgshellv6.cpp | 14 ++++++-- tests/auto/wayland/shared/mockxdgshellv6.h | 6 ++++ .../wayland/xdgshellv6/tst_xdgshellv6.cpp | 35 +++++++++++++++++++ 12 files changed, 126 insertions(+), 19 deletions(-) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp index 447e8fb6a5f..3d3af6929dd 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp @@ -258,9 +258,14 @@ void QWaylandXdgSurfaceV6::setAppId(const QString &appId) m_toplevel->set_app_id(appId); } +bool QWaylandXdgSurfaceV6::isExposed() const +{ + return m_configured || m_pendingConfigureSerial; +} + bool QWaylandXdgSurfaceV6::handleExpose(const QRegion ®ion) { - if (!m_configured && !region.isEmpty()) { + if (!isExposed() && !region.isEmpty()) { m_exposeRegion = region; return true; } @@ -333,10 +338,18 @@ void QWaylandXdgSurfaceV6::setPopup(QWaylandWindow *parent, QWaylandInputDevice void QWaylandXdgSurfaceV6::zxdg_surface_v6_configure(uint32_t serial) { - m_window->applyConfigureWhenPossible(); m_pendingConfigureSerial = serial; + if (!m_configured) { + // We have to do the initial applyConfigure() immediately, since that is the expose. + applyConfigure(); + } else { + // Later configures are probably resizes, so we have to queue them up for a time when we + // are not painting to the window. + m_window->applyConfigureWhenPossible(); + } + if (!m_exposeRegion.isEmpty()) { - QWindowSystemInterface::handleExposeEvent(m_window->window(), m_exposeRegion); + m_window->handleExpose(m_exposeRegion); m_exposeRegion = QRegion(); } } diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6_p.h b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6_p.h index 38b711f88d2..874dba014a7 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6_p.h +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6_p.h @@ -85,7 +85,7 @@ public: void setTitle(const QString &title) override; void setAppId(const QString &appId) override; - bool isExposed() const override { return m_configured; } + bool isExposed() const override; bool handleExpose(const QRegion &) override; bool handlesActiveState() const { return m_toplevel; } void applyConfigure() override; diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp index 0756e4d020c..c723192c8e0 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp @@ -292,9 +292,14 @@ void QWaylandXdgSurface::setWindowFlags(Qt::WindowFlags flags) m_toplevel->requestWindowFlags(flags); } +bool QWaylandXdgSurface::isExposed() const +{ + return m_configured || m_pendingConfigureSerial; +} + bool QWaylandXdgSurface::handleExpose(const QRegion ®ion) { - if (!m_configured && !region.isEmpty()) { + if (!isExposed() && !region.isEmpty()) { m_exposeRegion = region; return true; } @@ -367,10 +372,18 @@ void QWaylandXdgSurface::setPopup(QWaylandWindow *parent, QWaylandInputDevice *d void QWaylandXdgSurface::xdg_surface_configure(uint32_t serial) { - m_window->applyConfigureWhenPossible(); m_pendingConfigureSerial = serial; + if (!m_configured) { + // We have to do the initial applyConfigure() immediately, since that is the expose. + applyConfigure(); + } else { + // Later configures are probably resizes, so we have to queue them up for a time when we + // are not painting to the window. + m_window->applyConfigureWhenPossible(); + } + if (!m_exposeRegion.isEmpty()) { - QWindowSystemInterface::handleExposeEvent(m_window->window(), m_exposeRegion); + m_window->handleExpose(m_exposeRegion); m_exposeRegion = QRegion(); } } diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h index 45d7d4b0e0f..5e97a34b31c 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h @@ -89,7 +89,7 @@ public: void setAppId(const QString &appId) override; void setWindowFlags(Qt::WindowFlags flags) override; - bool isExposed() const override { return m_configured; } + bool isExposed() const override; bool handleExpose(const QRegion &) override; bool handlesActiveState() const { return m_toplevel; } void applyConfigure() override; diff --git a/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp b/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp index ecb03c0d602..3fe2ce80cdd 100644 --- a/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp +++ b/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp @@ -234,8 +234,7 @@ void QWaylandShmBackingStore::flush(QWindow *window, const QRegion ®ion, cons mFrontBuffer = mBackBuffer; QMargins margins = windowDecorationMargins(); - - waylandWindow()->commit(mFrontBuffer, region.translated(margins.left(), margins.top())); + waylandWindow()->safeCommit(mFrontBuffer, region.translated(margins.left(), margins.top())); } void QWaylandShmBackingStore::resize(const QSize &size, const QRegion &) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 52bee6ae318..1801c2a4bc0 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -248,6 +248,7 @@ void QWaylandWindow::reset(bool sendDestroyEvent) } mMask = QRegion(); + mQueuedBuffer = nullptr; } QWaylandWindow *QWaylandWindow::fromWlSurface(::wl_surface *surface) @@ -566,8 +567,29 @@ void QWaylandWindow::damage(const QRect &rect) damage(rect.x(), rect.y(), rect.width(), rect.height()); } +void QWaylandWindow::safeCommit(QWaylandBuffer *buffer, const QRegion &damage) +{ + if (isExposed()) { + commit(buffer, damage); + } else { + mQueuedBuffer = buffer; + mQueuedBufferDamage = damage; + } +} + +void QWaylandWindow::handleExpose(const QRegion ®ion) +{ + QWindowSystemInterface::handleExposeEvent(window(), region); + if (mQueuedBuffer) { + commit(mQueuedBuffer, mQueuedBufferDamage); + mQueuedBuffer = nullptr; + mQueuedBufferDamage = QRegion(); + } +} + void QWaylandWindow::commit(QWaylandBuffer *buffer, const QRegion &damage) { + Q_ASSERT(isExposed()); if (buffer->committed()) { qCDebug(lcWaylandBackingstore) << "Buffer already committed, ignoring."; return; diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index d11ed871bf8..ad24b735815 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -116,6 +116,8 @@ public: using QtWayland::wl_surface::damage; void damage(const QRect &rect); + void safeCommit(QWaylandBuffer *buffer, const QRegion &damage); + void handleExpose(const QRegion ®ion); void commit(QWaylandBuffer *buffer, const QRegion &damage); void waitForFrameSync(); @@ -231,6 +233,8 @@ protected: Qt::WindowStates mLastReportedWindowStates = Qt::WindowNoState; QWaylandShmBackingStore *mBackingStore = nullptr; + QWaylandBuffer *mQueuedBuffer = nullptr; + QRegion mQueuedBufferDamage; private slots: void handleScreenRemoved(QScreen *qScreen); diff --git a/tests/auto/wayland/shared/mocksurface.cpp b/tests/auto/wayland/shared/mocksurface.cpp index c0d51618c7d..84dcda6b010 100644 --- a/tests/auto/wayland/shared/mocksurface.cpp +++ b/tests/auto/wayland/shared/mocksurface.cpp @@ -74,7 +74,7 @@ void Compositor::sendShellSurfaceConfigure(void *data, const QList &pa auto statesBytes = QByteArray::fromRawData(reinterpret_cast(states.data()), states.size() * static_cast(sizeof(uint))); toplevel->send_configure(size.width(), size.height(), statesBytes); - toplevel->xdgSurface()->send_configure(compositor->nextSerial()); + toplevel->xdgSurface()->sendConfigure(compositor->nextSerial()); } else if (auto wlShellSurface = surface->wlShellSurface()) { const uint edges = 0; wlShellSurface->send_configure(edges, size.width(), size.height()); @@ -123,13 +123,17 @@ void Surface::surface_destroy(Resource *resource) if (m_wlShellSurface) // on wl-shell the shell surface is automatically destroyed with the surface wl_resource_destroy(m_wlShellSurface->resource()->handle); Q_ASSERT(!m_wlShellSurface); - Q_ASSERT(!m_xdgToplevelV6); + Q_ASSERT(!m_xdgSurfaceV6); wl_resource_destroy(resource->handle); } -void Surface::surface_attach(Resource *resource, - struct wl_resource *buffer, int x, int y) +void Surface::surface_attach(Resource *resource, struct wl_resource *buffer, int x, int y) { + if (m_xdgSurfaceV6) { + // It's a protocol error to attach a buffer to an xdgSurface that's not configured + Q_ASSERT(xdgSurfaceV6()->configureSent()); + } + Q_UNUSED(resource); Q_UNUSED(x); Q_UNUSED(y); diff --git a/tests/auto/wayland/shared/mocksurface.h b/tests/auto/wayland/shared/mocksurface.h index 3b0f01fdb9e..949dc23dd67 100644 --- a/tests/auto/wayland/shared/mocksurface.h +++ b/tests/auto/wayland/shared/mocksurface.h @@ -50,7 +50,8 @@ public: static Surface *fromResource(struct ::wl_resource *resource); void map(); bool isMapped() const; - XdgToplevelV6 *xdgToplevelV6() const { return m_xdgToplevelV6; } + XdgSurfaceV6 *xdgSurfaceV6() const { return m_xdgSurfaceV6; } + XdgToplevelV6 *xdgToplevelV6() const { return m_xdgSurfaceV6 ? m_xdgSurfaceV6->toplevel() : nullptr; } WlShellSurface *wlShellSurface() const { return m_wlShellSurface; } QSharedPointer mockSurface() const { return m_mockSurface; } @@ -69,7 +70,7 @@ protected: void surface_commit(Resource *resource) override; private: wl_resource *m_buffer = nullptr; - XdgToplevelV6 *m_xdgToplevelV6 = nullptr; + XdgSurfaceV6 *m_xdgSurfaceV6 = nullptr; WlShellSurface *m_wlShellSurface = nullptr; Compositor *m_compositor = nullptr; @@ -77,7 +78,7 @@ private: QList m_frameCallbackList; bool m_mapped = false; - friend class XdgToplevelV6; + friend class XdgSurfaceV6; friend class WlShellSurface; }; diff --git a/tests/auto/wayland/shared/mockxdgshellv6.cpp b/tests/auto/wayland/shared/mockxdgshellv6.cpp index 5dc8da599a7..05eff74ad68 100644 --- a/tests/auto/wayland/shared/mockxdgshellv6.cpp +++ b/tests/auto/wayland/shared/mockxdgshellv6.cpp @@ -49,6 +49,18 @@ XdgSurfaceV6::XdgSurfaceV6(XdgShellV6 *shell, Surface *surface, wl_client *clien , m_surface(surface) , m_shell(shell) { + m_surface->m_xdgSurfaceV6 = this; +} + +XdgSurfaceV6::~XdgSurfaceV6() +{ + m_surface->m_xdgSurfaceV6 = nullptr; +} + +void XdgSurfaceV6::sendConfigure(uint32_t serial) +{ + send_configure(serial); + m_configureSent = true; } void XdgSurfaceV6::zxdg_surface_v6_get_toplevel(QtWaylandServer::zxdg_surface_v6::Resource *resource, uint32_t id) @@ -78,7 +90,6 @@ XdgToplevelV6::XdgToplevelV6(XdgSurfaceV6 *xdgSurface, wl_client *client, uint32 , m_mockToplevel(new MockXdgToplevelV6(this)) { auto *surface = m_xdgSurface->surface(); - surface->m_xdgToplevelV6 = this; m_xdgSurface->shell()->addToplevel(this); surface->map(); } @@ -86,7 +97,6 @@ XdgToplevelV6::XdgToplevelV6(XdgSurfaceV6 *xdgSurface, wl_client *client, uint32 XdgToplevelV6::~XdgToplevelV6() { m_xdgSurface->shell()->removeToplevel(this); - m_xdgSurface->surface()->m_xdgToplevelV6 = nullptr; m_mockToplevel->m_toplevel = nullptr; } diff --git a/tests/auto/wayland/shared/mockxdgshellv6.h b/tests/auto/wayland/shared/mockxdgshellv6.h index bd5e1306313..a238fa56209 100644 --- a/tests/auto/wayland/shared/mockxdgshellv6.h +++ b/tests/auto/wayland/shared/mockxdgshellv6.h @@ -46,8 +46,13 @@ class XdgSurfaceV6 : public QtWaylandServer::zxdg_surface_v6 { public: XdgSurfaceV6(XdgShellV6 *shell, Surface *surface, wl_client *client, uint32_t id); + ~XdgSurfaceV6() override; XdgShellV6 *shell() const { return m_shell; } Surface *surface() const { return m_surface; } + XdgToplevelV6 *toplevel() const { return m_toplevel; } + + void sendConfigure(uint32_t serial); + bool configureSent() const { return m_configureSent; } protected: void zxdg_surface_v6_destroy_resource(Resource *) override { delete this; } @@ -59,6 +64,7 @@ private: Surface *m_surface = nullptr; XdgToplevelV6 *m_toplevel = nullptr; XdgShellV6 *m_shell = nullptr; + bool m_configureSent = false; friend class XdgToplevelV6; }; diff --git a/tests/auto/wayland/xdgshellv6/tst_xdgshellv6.cpp b/tests/auto/wayland/xdgshellv6/tst_xdgshellv6.cpp index 91679cb57c0..3fd8153e65e 100644 --- a/tests/auto/wayland/xdgshellv6/tst_xdgshellv6.cpp +++ b/tests/auto/wayland/xdgshellv6/tst_xdgshellv6.cpp @@ -101,6 +101,7 @@ private slots: void windowStateChangedEvents(); void windowGeometrySimple(); void windowGeometryFixed(); + void flushUnconfiguredXdgSurface(); private: MockCompositor *m_compositor = nullptr; @@ -360,6 +361,40 @@ void tst_WaylandClientXdgShellV6::windowGeometryFixed() QCOMPARE(geometrySpy.takeFirst().at(0).toRect().size(), initialWindowGeometry.size()); } +void tst_WaylandClientXdgShellV6::flushUnconfiguredXdgSurface() +{ + TestWindow window; + window.show(); + + QSharedPointer surface; + QTRY_VERIFY(surface = m_compositor->surface()); + + // Paint and flush some magenta + QBackingStore backingStore(&window); + QRect rect(QPoint(), window.size()); + backingStore.resize(rect.size()); + backingStore.beginPaint(rect); + QColor color = Qt::magenta; + QPainter p(backingStore.paintDevice()); + p.fillRect(rect, color); + p.end(); + backingStore.endPaint(); + backingStore.flush(rect); + + // We're not allowed to send buffer on this surface since it isn't yet configured. + // So, from the compositor's point of view there should be no buffer data yet. + m_compositor->processWaylandEvents(); + QVERIFY(surface->image.isNull()); + QVERIFY(!window.isExposed()); + + // Finally sending the configure should trigger an attach and commit with the + // right buffer. + m_compositor->sendShellSurfaceConfigure(surface); + QTRY_COMPARE(surface->image.size(), window.frameGeometry().size()); + QTRY_COMPARE(surface->image.pixel(window.frameMargins().left(), window.frameMargins().top()), color.rgba()); + QVERIFY(window.isExposed()); +} + int main(int argc, char **argv) { setenv("XDG_RUNTIME_DIR", ".", 1); From 52c9c71d91556f9d5a622bec71ad574dbc8e4b1e Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Fri, 12 Oct 2018 10:36:23 +0200 Subject: [PATCH 0606/1507] Client: Don't spam expose events Only send expose event when the geometry actually changed. Change-Id: Ic06986ce5d11e0ff7a842303f57093b8ff25b9f6 Reviewed-by: Paul Olav Tvete Reviewed-by: David Edmundson --- .../platforms/wayland/qwaylandwindow.cpp | 5 +++- .../platforms/wayland/qwaylandwindow_p.h | 1 + .../wayland/xdgshellv6/tst_xdgshellv6.cpp | 23 +++++++++++++++++++ 3 files changed, 28 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 1801c2a4bc0..4ac2ca51e1e 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -338,7 +338,9 @@ void QWaylandWindow::setGeometry(const QRect &rect) mSentInitialResize = true; } - sendExposeEvent(QRect(QPoint(), geometry().size())); + QRect exposeGeometry(QPoint(), geometry().size()); + if (exposeGeometry != mLastExposeGeometry) + sendExposeEvent(exposeGeometry); } void QWaylandWindow::resizeFromApplyConfigure(const QSize &sizeWithMargins, const QPoint &offset) @@ -356,6 +358,7 @@ void QWaylandWindow::sendExposeEvent(const QRect &rect) { if (!(mShellSurface && mShellSurface->handleExpose(rect))) QWindowSystemInterface::handleExposeEvent(window(), rect); + mLastExposeGeometry = rect; } diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index ad24b735815..56ebd3cc641 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -254,6 +254,7 @@ private: void handleScreenChanged(); bool mUpdateRequested = false; + QRect mLastExposeGeometry; static const wl_callback_listener callbackListener; static void frameCallback(void *data, struct wl_callback *wl_callback, uint32_t time); diff --git a/tests/auto/wayland/xdgshellv6/tst_xdgshellv6.cpp b/tests/auto/wayland/xdgshellv6/tst_xdgshellv6.cpp index 3fd8153e65e..3c822325bd9 100644 --- a/tests/auto/wayland/xdgshellv6/tst_xdgshellv6.cpp +++ b/tests/auto/wayland/xdgshellv6/tst_xdgshellv6.cpp @@ -58,6 +58,14 @@ public: return QWindow::event(event); } + void exposeEvent(QExposeEvent *event) override + { + ++exposeEventCount; + QWindow::exposeEvent(event); + } + + int exposeEventCount = 0; + signals: void windowStateChangeEventReceived(uint oldState); }; @@ -102,6 +110,7 @@ private slots: void windowGeometrySimple(); void windowGeometryFixed(); void flushUnconfiguredXdgSurface(); + void dontSpamExposeEvents(); private: MockCompositor *m_compositor = nullptr; @@ -395,6 +404,20 @@ void tst_WaylandClientXdgShellV6::flushUnconfiguredXdgSurface() QVERIFY(window.isExposed()); } +void tst_WaylandClientXdgShellV6::dontSpamExposeEvents() +{ + TestWindow window; + window.show(); + + QSharedPointer surface; + QTRY_VERIFY(surface = m_compositor->surface()); + QTRY_VERIFY(window.exposeEventCount == 0); + + m_compositor->sendShellSurfaceConfigure(surface); + QTRY_VERIFY(window.isExposed()); + QTRY_VERIFY(window.exposeEventCount == 1); +} + int main(int argc, char **argv) { setenv("XDG_RUNTIME_DIR", ".", 1); From f033e17099488d399d5f4147a4789b9bad58e000 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Wed, 24 Oct 2018 09:25:42 +0200 Subject: [PATCH 0607/1507] Client: Fix fullscreen regression on wl-shell The code for isNormal was wrong, so set_toplevel (which clears fullscreen state) would be sent unless the window was both maximized and fullscreen. Fixed it and made it a little bit more readable. Change-Id: Icaa52d3a058df064a0bd1164119af3f511cb4220 Fixes: QTBUG-71350 Reviewed-by: Paul Olav Tvete Reviewed-by: David Edmundson --- .../shellintegration/wl-shell/qwaylandwlshellsurface.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellsurface.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellsurface.cpp index d9bc83059b8..88a63655ce1 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellsurface.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellsurface.cpp @@ -180,7 +180,7 @@ void QWaylandWlShellSurface::requestWindowStates(Qt::WindowStates states) m_window->applyConfigureWhenPossible(); } - bool isNormal = ~states & (Qt::WindowMaximized | Qt::WindowFullScreen); + bool isNormal = !(states & Qt::WindowMaximized) && !(states & Qt::WindowFullScreen); if (isNormal && (changedStates & (Qt::WindowMaximized | Qt::WindowFullScreen))) { setTopLevel(); // set normal window // There's usually no configure event after this, so just clear the rest of the pending From e6d55239c454d454978edb7d8b17f6c993e7ba07 Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Tue, 30 Oct 2018 19:02:26 +0000 Subject: [PATCH 0608/1507] Client: Explicitly send expose window on first configure Before 46aece51330b6f9b5b4bfd68a5b3b183dc5b1c38 we would always call QWaylandWindow::applyConfigure which in turn sends an expose event. Without that clients do not commit their initial buffer. This adds back the expose event on the first received configure. Fixes: QTBUG-71509 Change-Id: Ica39bb23245957948e1e1f75caf4f16f7b086ef7 Reviewed-by: Johan Helsing --- .../plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp | 1 + .../plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp | 1 + 2 files changed, 2 insertions(+) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp index 3d3af6929dd..c055cbb1fae 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp @@ -342,6 +342,7 @@ void QWaylandXdgSurfaceV6::zxdg_surface_v6_configure(uint32_t serial) if (!m_configured) { // We have to do the initial applyConfigure() immediately, since that is the expose. applyConfigure(); + m_exposeRegion = QRegion(QRect(QPoint(), m_window->geometry().size())); } else { // Later configures are probably resizes, so we have to queue them up for a time when we // are not painting to the window. diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp index c723192c8e0..014b6bed5f2 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp @@ -376,6 +376,7 @@ void QWaylandXdgSurface::xdg_surface_configure(uint32_t serial) if (!m_configured) { // We have to do the initial applyConfigure() immediately, since that is the expose. applyConfigure(); + m_exposeRegion = QRegion(QRect(QPoint(), m_window->geometry().size())); } else { // Later configures are probably resizes, so we have to queue them up for a time when we // are not painting to the window. From 2f72ea6d82ae2b9afee2af8cd2bfa94c7a943f7e Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Thu, 1 Nov 2018 13:48:15 +0100 Subject: [PATCH 0609/1507] Client: Use logging category for chosen shell integration Nothing is wrong, so we shouldn't pollute stderr. Change-Id: I05538c8e5199f97ebb1a1233e866f3a93179b799 Reviewed-by: David Edmundson Reviewed-by: Pier Luigi Fiorini --- src/plugins/platforms/wayland/qwaylandintegration.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandintegration.cpp b/src/plugins/platforms/wayland/qwaylandintegration.cpp index c3163ee3dc4..073258d41e7 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandintegration.cpp @@ -422,7 +422,7 @@ void QWaylandIntegration::initializeShellIntegration() Q_FOREACH (QString preferredShell, preferredShells) { mShellIntegration.reset(createShellIntegration(preferredShell)); if (mShellIntegration) { - qDebug("Using the '%s' shell integration", qPrintable(preferredShell)); + qCDebug(lcQpaWayland, "Using the '%s' shell integration", qPrintable(preferredShell)); break; } } From e82a4695d2ce7c08fa75df5bcdd50f251de274f6 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Thu, 1 Nov 2018 10:22:40 +0100 Subject: [PATCH 0610/1507] Scanner: Assert resource in destroy handlers Change-Id: I8e32b267a4cc5a4cfc462f7819a378573e179134 Reviewed-by: Pier Luigi Fiorini --- src/tools/qtwaylandscanner/qtwaylandscanner.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp index 1da8bdb443b..bc0262bc0a2 100644 --- a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp +++ b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp @@ -768,6 +768,7 @@ bool Scanner::process() printf(" void %s::destroy_func(struct ::wl_resource *client_resource)\n", interfaceName); printf(" {\n"); printf(" Resource *resource = Resource::fromResource(client_resource);\n"); + printf(" Q_ASSERT(resource);\n"); printf(" %s *that = resource->%s_object;\n", interfaceName, interfaceNameStripped); printf(" that->m_resource_map.remove(resource->client(), resource);\n"); printf(" that->%s_destroy_resource(resource);\n", interfaceNameStripped); From 237f8b94e518bc518c1623c573ee51e4efac02b3 Mon Sep 17 00:00:00 2001 From: Pier Luigi Fiorini Date: Wed, 13 Jun 2018 22:11:00 +0200 Subject: [PATCH 0611/1507] Client: Add fullscreen shell integration [ChangeLog][QPA plugin] Added support for fullscreen-shell unstable v1. The fullscreen_shell_unstable_v1 interface displays a single surface per output and it is used for nested compositors, where each output is rendered in a surface that is then displayed by the main compositor. For example weston could be the main compositor and a QML compositor could be launched as a client using this shell integration to display it inside weston. Change-Id: I037679a283ff03cb4bdf4b3fed59945090ec9250 Reviewed-by: Johan Helsing --- .../fullscreen-shell-unstable-v1.xml | 245 ++++++++++++++++++ .../wayland/protocols/qt_attribution.json | 19 ++ src/plugins/platforms/wayland/configure.json | 5 + .../fullscreen-shell-v1.json | 3 + .../fullscreen-shell-v1.pro | 23 ++ .../fullscreen-shell-v1/main.cpp | 69 +++++ .../qwaylandfullscreenshellv1integration.cpp | 71 +++++ .../qwaylandfullscreenshellv1integration.h | 67 +++++ .../qwaylandfullscreenshellv1surface.cpp | 61 +++++ .../qwaylandfullscreenshellv1surface.h | 67 +++++ .../shellintegration/shellintegration.pro | 1 + tests/auto/wayland/client.pro | 1 + .../fullscreenshellv1/fullscreenshellv1.pro | 4 + .../tst_fullscreenshellv1.cpp | 111 ++++++++ tests/auto/wayland/shared/mockcompositor.cpp | 17 ++ tests/auto/wayland/shared/mockcompositor.h | 4 + .../wayland/shared/mockfullscreenshellv1.cpp | 43 +++ .../wayland/shared/mockfullscreenshellv1.h | 58 +++++ tests/auto/wayland/shared/shared.pri | 5 +- 19 files changed, 873 insertions(+), 1 deletion(-) create mode 100644 src/3rdparty/wayland/protocols/fullscreen-shell-unstable-v1.xml create mode 100644 src/plugins/platforms/wayland/plugins/shellintegration/fullscreen-shell-v1/fullscreen-shell-v1.json create mode 100644 src/plugins/platforms/wayland/plugins/shellintegration/fullscreen-shell-v1/fullscreen-shell-v1.pro create mode 100644 src/plugins/platforms/wayland/plugins/shellintegration/fullscreen-shell-v1/main.cpp create mode 100644 src/plugins/platforms/wayland/plugins/shellintegration/fullscreen-shell-v1/qwaylandfullscreenshellv1integration.cpp create mode 100644 src/plugins/platforms/wayland/plugins/shellintegration/fullscreen-shell-v1/qwaylandfullscreenshellv1integration.h create mode 100644 src/plugins/platforms/wayland/plugins/shellintegration/fullscreen-shell-v1/qwaylandfullscreenshellv1surface.cpp create mode 100644 src/plugins/platforms/wayland/plugins/shellintegration/fullscreen-shell-v1/qwaylandfullscreenshellv1surface.h create mode 100644 tests/auto/wayland/fullscreenshellv1/fullscreenshellv1.pro create mode 100644 tests/auto/wayland/fullscreenshellv1/tst_fullscreenshellv1.cpp create mode 100644 tests/auto/wayland/shared/mockfullscreenshellv1.cpp create mode 100644 tests/auto/wayland/shared/mockfullscreenshellv1.h diff --git a/src/3rdparty/wayland/protocols/fullscreen-shell-unstable-v1.xml b/src/3rdparty/wayland/protocols/fullscreen-shell-unstable-v1.xml new file mode 100644 index 00000000000..1bca7b7c7d2 --- /dev/null +++ b/src/3rdparty/wayland/protocols/fullscreen-shell-unstable-v1.xml @@ -0,0 +1,245 @@ + + + + + Copyright © 2016 Yong Bakos + Copyright © 2015 Jason Ekstrand + Copyright © 2015 Jonas Ådahl + + 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. + + + + + Displays a single surface per output. + + This interface provides a mechanism for a single client to display + simple full-screen surfaces. While there technically may be multiple + clients bound to this interface, only one of those clients should be + shown at a time. + + To present a surface, the client uses either the present_surface or + present_surface_for_mode requests. Presenting a surface takes effect + on the next wl_surface.commit. See the individual requests for + details about scaling and mode switches. + + The client can have at most one surface per output at any time. + Requesting a surface to be presented on an output that already has a + surface replaces the previously presented surface. Presenting a null + surface removes its content and effectively disables the output. + Exactly what happens when an output is "disabled" is + compositor-specific. The same surface may be presented on multiple + outputs simultaneously. + + Once a surface is presented on an output, it stays on that output + until either the client removes it or the compositor destroys the + output. This way, the client can update the output's contents by + simply attaching a new buffer. + + Warning! The protocol described in this file is experimental and + backward incompatible changes may be made. Backward compatible changes + may be added together with the corresponding interface version bump. + Backward incompatible changes are done by bumping the version number in + the protocol and interface names and resetting the interface version. + Once the protocol is to be declared stable, the 'z' prefix and the + version number in the protocol and interface names are removed and the + interface version number is reset. + + + + + Release the binding from the wl_fullscreen_shell interface. + + This destroys the server-side object and frees this binding. If + the client binds to wl_fullscreen_shell multiple times, it may wish + to free some of those bindings. + + + + + + Various capabilities that can be advertised by the compositor. They + are advertised one-at-a-time when the wl_fullscreen_shell interface is + bound. See the wl_fullscreen_shell.capability event for more details. + + ARBITRARY_MODES: + This is a hint to the client that indicates that the compositor is + capable of setting practically any mode on its outputs. If this + capability is provided, wl_fullscreen_shell.present_surface_for_mode + will almost never fail and clients should feel free to set whatever + mode they like. If the compositor does not advertise this, it may + still support some modes that are not advertised through wl_global.mode + but it is less likely. + + CURSOR_PLANE: + This is a hint to the client that indicates that the compositor can + handle a cursor surface from the client without actually compositing. + This may be because of a hardware cursor plane or some other mechanism. + If the compositor does not advertise this capability then setting + wl_pointer.cursor may degrade performance or be ignored entirely. If + CURSOR_PLANE is not advertised, it is recommended that the client draw + its own cursor and set wl_pointer.cursor(NULL). + + + + + + + + Advertises a single capability of the compositor. + + When the wl_fullscreen_shell interface is bound, this event is emitted + once for each capability advertised. Valid capabilities are given by + the wl_fullscreen_shell.capability enum. If clients want to take + advantage of any of these capabilities, they should use a + wl_display.sync request immediately after binding to ensure that they + receive all the capability events. + + + + + + + Hints to indicate to the compositor how to deal with a conflict + between the dimensions of the surface and the dimensions of the + output. The compositor is free to ignore this parameter. + + + + + + + + + + + Present a surface on the given output. + + If the output is null, the compositor will present the surface on + whatever display (or displays) it thinks best. In particular, this + may replace any or all surfaces currently presented so it should + not be used in combination with placing surfaces on specific + outputs. + + The method parameter is a hint to the compositor for how the surface + is to be presented. In particular, it tells the compositor how to + handle a size mismatch between the presented surface and the + output. The compositor is free to ignore this parameter. + + The "zoom", "zoom_crop", and "stretch" methods imply a scaling + operation on the surface. This will override any kind of output + scaling, so the buffer_scale property of the surface is effectively + ignored. + + + + + + + + + Presents a surface on the given output for a particular mode. + + If the current size of the output differs from that of the surface, + the compositor will attempt to change the size of the output to + match the surface. The result of the mode-switch operation will be + returned via the provided wl_fullscreen_shell_mode_feedback object. + + If the current output mode matches the one requested or if the + compositor successfully switches the mode to match the surface, + then the mode_successful event will be sent and the output will + contain the contents of the given surface. If the compositor + cannot match the output size to the surface size, the mode_failed + will be sent and the output will contain the contents of the + previously presented surface (if any). If another surface is + presented on the given output before either of these has a chance + to happen, the present_cancelled event will be sent. + + Due to race conditions and other issues unknown to the client, no + mode-switch operation is guaranteed to succeed. However, if the + mode is one advertised by wl_output.mode or if the compositor + advertises the ARBITRARY_MODES capability, then the client should + expect that the mode-switch operation will usually succeed. + + If the size of the presented surface changes, the resulting output + is undefined. The compositor may attempt to change the output mode + to compensate. However, there is no guarantee that a suitable mode + will be found and the client has no way to be notified of success + or failure. + + The framerate parameter specifies the desired framerate for the + output in mHz. The compositor is free to ignore this parameter. A + value of 0 indicates that the client has no preference. + + If the value of wl_output.scale differs from wl_surface.buffer_scale, + then the compositor may choose a mode that matches either the buffer + size or the surface size. In either case, the surface will fill the + output. + + + + + + + + + + These errors can be emitted in response to wl_fullscreen_shell requests. + + + + + + + + + This event indicates that the attempted mode switch operation was + successful. A surface of the size requested in the mode switch + will fill the output without scaling. + + Upon receiving this event, the client should destroy the + wl_fullscreen_shell_mode_feedback object. + + + + + + This event indicates that the attempted mode switch operation + failed. This may be because the requested output mode is not + possible or it may mean that the compositor does not want to allow it. + + Upon receiving this event, the client should destroy the + wl_fullscreen_shell_mode_feedback object. + + + + + + This event indicates that the attempted mode switch operation was + cancelled. Most likely this is because the client requested a + second mode switch before the first one completed. + + Upon receiving this event, the client should destroy the + wl_fullscreen_shell_mode_feedback object. + + + + + diff --git a/src/3rdparty/wayland/protocols/qt_attribution.json b/src/3rdparty/wayland/protocols/qt_attribution.json index e5bf91e1023..615e95a9f34 100644 --- a/src/3rdparty/wayland/protocols/qt_attribution.json +++ b/src/3rdparty/wayland/protocols/qt_attribution.json @@ -1,4 +1,23 @@ [ + { + "Id": "wayland-fullscreen-protocol", + "Name": "Wayland Fullscreen Shell Protocol", + "QDocModule": "qtwaylandcompositor", + "QtUsage": "Used in the Qt Wayland platform plugin.", + "Files": "fullscreen-shell-unstable-v1.xml", + + "Description": "A Wayland shell for displaying a single surface per output", + "Homepage": "https://wayland.freedesktop.org", + "Version": "unstable v1", + "DownloadLocation": "https://cgit.freedesktop.org/wayland/wayland-protocols", + "LicenseId": "MIT", + "License": "MIT License", + "LicenseFile": "MIT_LICENSE.txt", + "Copyright": "Copyright © 2016 Yong Bakos +Copyright © 2015 Jason Ekstrand +Copyright © 2015 Jonas Ådahl" + }, + { "Id": "wayland-protocol", "Name": "Wayland Protocol", diff --git a/src/plugins/platforms/wayland/configure.json b/src/plugins/platforms/wayland/configure.json index 518514011ca..b5146680e61 100644 --- a/src/plugins/platforms/wayland/configure.json +++ b/src/plugins/platforms/wayland/configure.json @@ -87,6 +87,11 @@ "condition": "features.draganddrop || features.clipboard", "output": [ "privateFeature" ] }, + "wayland-client-fullscreen-shell-v1": { + "label": "fullscreen-shell-v1", + "condition": "features.wayland-client", + "output": [ "privateFeature" ] + }, "wayland-client-ivi-shell": { "label": "ivi-shell", "condition": "features.wayland-client", diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/fullscreen-shell-v1/fullscreen-shell-v1.json b/src/plugins/platforms/wayland/plugins/shellintegration/fullscreen-shell-v1/fullscreen-shell-v1.json new file mode 100644 index 00000000000..f32637bccfc --- /dev/null +++ b/src/plugins/platforms/wayland/plugins/shellintegration/fullscreen-shell-v1/fullscreen-shell-v1.json @@ -0,0 +1,3 @@ +{ + "Keys": [ "fullscreen-shell-v1" ] +} diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/fullscreen-shell-v1/fullscreen-shell-v1.pro b/src/plugins/platforms/wayland/plugins/shellintegration/fullscreen-shell-v1/fullscreen-shell-v1.pro new file mode 100644 index 00000000000..a522f87a8d3 --- /dev/null +++ b/src/plugins/platforms/wayland/plugins/shellintegration/fullscreen-shell-v1/fullscreen-shell-v1.pro @@ -0,0 +1,23 @@ +QT += gui-private waylandclient-private +CONFIG += wayland-scanner + +QMAKE_USE += wayland-client + +WAYLANDCLIENTSOURCES += \ + ../../../3rdparty/protocol/fullscreen-shell-unstable-v1.xml + +HEADERS += \ + qwaylandfullscreenshellv1integration.h \ + qwaylandfullscreenshellv1surface.h + +SOURCES += \ + main.cpp \ + qwaylandfullscreenshellv1integration.cpp \ + qwaylandfullscreenshellv1surface.cpp + +OTHER_FILES += \ + fullscreen-shell-v1.json + +PLUGIN_TYPE = wayland-shell-integration +PLUGIN_CLASS_NAME = QWaylandFullScreenShellV1IntegrationPlugin +load(qt_plugin) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/fullscreen-shell-v1/main.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/fullscreen-shell-v1/main.cpp new file mode 100644 index 00000000000..dfcd997da38 --- /dev/null +++ b/src/plugins/platforms/wayland/plugins/shellintegration/fullscreen-shell-v1/main.cpp @@ -0,0 +1,69 @@ +/**************************************************************************** +** +** Copyright (C) 2018 Pier Luigi Fiorini +** Contact: http://www.qt-project.org/legal +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include + +#include "qwaylandfullscreenshellv1integration.h" + +QT_BEGIN_NAMESPACE + +namespace QtWaylandClient { + +class QWaylandFullScreenShellV1IntegrationPlugin : public QWaylandShellIntegrationPlugin +{ + Q_OBJECT + Q_PLUGIN_METADATA(IID QWaylandShellIntegrationFactoryInterface_iid FILE "fullscreen-shell-v1.json") +public: + QWaylandShellIntegration *create(const QString &key, const QStringList ¶mList) override; +}; + +QWaylandShellIntegration *QWaylandFullScreenShellV1IntegrationPlugin::create(const QString &key, const QStringList ¶mList) +{ + Q_UNUSED(paramList); + + if (key == QLatin1String("fullscreen-shell-v1")) + return new QWaylandFullScreenShellV1Integration(); + return nullptr; +} + +} // namespace QtWaylandClient + +QT_END_NAMESPACE + +#include "main.moc" diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/fullscreen-shell-v1/qwaylandfullscreenshellv1integration.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/fullscreen-shell-v1/qwaylandfullscreenshellv1integration.cpp new file mode 100644 index 00000000000..0cd2cb1e893 --- /dev/null +++ b/src/plugins/platforms/wayland/plugins/shellintegration/fullscreen-shell-v1/qwaylandfullscreenshellv1integration.cpp @@ -0,0 +1,71 @@ +/**************************************************************************** +** +** Copyright (C) 2018 Pier Luigi Fiorini +** Contact: http://www.qt-project.org/legal +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qwaylandfullscreenshellv1integration.h" +#include "qwaylandfullscreenshellv1surface.h" + +QT_BEGIN_NAMESPACE + +namespace QtWaylandClient { + +bool QWaylandFullScreenShellV1Integration::initialize(QWaylandDisplay *display) +{ + for (const QWaylandDisplay::RegistryGlobal &global : display->globals()) { + if (global.interface == QLatin1String("zwp_fullscreen_shell_v1") && !m_shell) { + m_shell.reset(new QtWayland::zwp_fullscreen_shell_v1(display->wl_registry(), global.id, global.version)); + break; + } + } + + if (!m_shell) { + qCDebug(lcQpaWayland) << "Couldn't find global zwp_fullscreen_shell_v1 for fullscreen-shell"; + return false; + } + + return QWaylandShellIntegration::initialize(display); +} + +QWaylandShellSurface *QWaylandFullScreenShellV1Integration::createShellSurface(QWaylandWindow *window) +{ + return new QWaylandFullScreenShellV1Surface(m_shell.data(), window); +} + +} // namespace QtWaylandClient + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/fullscreen-shell-v1/qwaylandfullscreenshellv1integration.h b/src/plugins/platforms/wayland/plugins/shellintegration/fullscreen-shell-v1/qwaylandfullscreenshellv1integration.h new file mode 100644 index 00000000000..131f9e72097 --- /dev/null +++ b/src/plugins/platforms/wayland/plugins/shellintegration/fullscreen-shell-v1/qwaylandfullscreenshellv1integration.h @@ -0,0 +1,67 @@ +/**************************************************************************** +** +** Copyright (C) 2018 Pier Luigi Fiorini +** Contact: http://www.qt-project.org/legal +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWAYLANDFULLSCREENSHELLV1INTEGRATION_H +#define QWAYLANDFULLSCREENSHELLV1INTEGRATION_H + +#include +#include +#include + +#include "qwayland-fullscreen-shell-unstable-v1.h" + +QT_BEGIN_NAMESPACE + +namespace QtWaylandClient { + +class Q_WAYLAND_CLIENT_EXPORT QWaylandFullScreenShellV1Integration : public QWaylandShellIntegration +{ +public: + bool initialize(QWaylandDisplay *display) override; + QWaylandShellSurface *createShellSurface(QWaylandWindow *window) override; + +private: + QScopedPointer m_shell; +}; + +} // namespace QtWaylandClient + +QT_END_NAMESPACE + +#endif // QWAYLANDFULLSCREENSHELLV1INTEGRATION_H diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/fullscreen-shell-v1/qwaylandfullscreenshellv1surface.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/fullscreen-shell-v1/qwaylandfullscreenshellv1surface.cpp new file mode 100644 index 00000000000..9a829f6e9e9 --- /dev/null +++ b/src/plugins/platforms/wayland/plugins/shellintegration/fullscreen-shell-v1/qwaylandfullscreenshellv1surface.cpp @@ -0,0 +1,61 @@ +/**************************************************************************** +** +** Copyright (C) 2018 Pier Luigi Fiorini +** Contact: http://www.qt-project.org/legal +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include + +#include "qwaylandfullscreenshellv1surface.h" + +QT_BEGIN_NAMESPACE + +namespace QtWaylandClient { + +QWaylandFullScreenShellV1Surface::QWaylandFullScreenShellV1Surface(QtWayland::zwp_fullscreen_shell_v1 *shell, QWaylandWindow *window) + : QWaylandShellSurface(window) + , m_shell(shell) + , m_window(window) +{ + auto screen = static_cast(m_window->screen()); + m_shell->present_surface(m_window->object(), + QtWayland::zwp_fullscreen_shell_v1::present_method_default, + screen->output()); +} + +} // namespace QtWaylandClient + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/fullscreen-shell-v1/qwaylandfullscreenshellv1surface.h b/src/plugins/platforms/wayland/plugins/shellintegration/fullscreen-shell-v1/qwaylandfullscreenshellv1surface.h new file mode 100644 index 00000000000..718e1e861a7 --- /dev/null +++ b/src/plugins/platforms/wayland/plugins/shellintegration/fullscreen-shell-v1/qwaylandfullscreenshellv1surface.h @@ -0,0 +1,67 @@ +/**************************************************************************** +** +** Copyright (C) 2018 Pier Luigi Fiorini +** Contact: http://www.qt-project.org/legal +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWAYLANDFULLSCREENSHELLV1SURFACE_H +#define QWAYLANDFULLSCREENSHELLV1SURFACE_H + +#include +#include +#include + +#include "qwayland-fullscreen-shell-unstable-v1.h" + +QT_BEGIN_NAMESPACE + +namespace QtWaylandClient { + +class Q_WAYLAND_CLIENT_EXPORT QWaylandFullScreenShellV1Surface : public QWaylandShellSurface +{ +public: + QWaylandFullScreenShellV1Surface(QtWayland::zwp_fullscreen_shell_v1 *shell, QWaylandWindow *window); + +private: + QtWayland::zwp_fullscreen_shell_v1 *m_shell = nullptr; + QWaylandWindow *m_window = nullptr; +}; + +} // namespace QtWaylandClient + +QT_END_NAMESPACE + +#endif // QWAYLANDFULLSCREENSHELLV1SURFACE_H diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/shellintegration.pro b/src/plugins/platforms/wayland/plugins/shellintegration/shellintegration.pro index 627c7668eec..39c57940aff 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/shellintegration.pro +++ b/src/plugins/platforms/wayland/plugins/shellintegration/shellintegration.pro @@ -1,6 +1,7 @@ TEMPLATE = subdirs QT_FOR_CONFIG += waylandclient-private +qtConfig(wayland-client-fullscreen-shell-v1): SUBDIRS += fullscreen-shell-v1 qtConfig(wayland-client-ivi-shell): SUBDIRS += ivi-shell qtConfig(wayland-client-wl-shell): SUBDIRS += wl-shell qtConfig(wayland-client-xdg-shell): SUBDIRS += xdg-shell diff --git a/tests/auto/wayland/client.pro b/tests/auto/wayland/client.pro index 9fd8fc3f9f2..14ce4407d95 100644 --- a/tests/auto/wayland/client.pro +++ b/tests/auto/wayland/client.pro @@ -2,6 +2,7 @@ TEMPLATE=subdirs SUBDIRS += \ client \ + fullscreenshellv1 \ iviapplication \ xdgshellv6 \ wl_connect diff --git a/tests/auto/wayland/fullscreenshellv1/fullscreenshellv1.pro b/tests/auto/wayland/fullscreenshellv1/fullscreenshellv1.pro new file mode 100644 index 00000000000..8ce6dfe5c0f --- /dev/null +++ b/tests/auto/wayland/fullscreenshellv1/fullscreenshellv1.pro @@ -0,0 +1,4 @@ +include (../shared/shared.pri) + +TARGET = tst_client_fullscreenshell1 +SOURCES += tst_fullscreenshellv1.cpp diff --git a/tests/auto/wayland/fullscreenshellv1/tst_fullscreenshellv1.cpp b/tests/auto/wayland/fullscreenshellv1/tst_fullscreenshellv1.cpp new file mode 100644 index 00000000000..f93d9fbc5d2 --- /dev/null +++ b/tests/auto/wayland/fullscreenshellv1/tst_fullscreenshellv1.cpp @@ -0,0 +1,111 @@ +/**************************************************************************** +** +** Copyright (C) 2018 Pier Luigi Fiorini +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "mockcompositor.h" + +#include + +#include + +static const QSize screenSize(1600, 1200); + +class TestWindow : public QWindow +{ +public: + TestWindow() + { + setSurfaceType(QSurface::RasterSurface); + setGeometry(0, 0, 800, 600); + create(); + } +}; + +class tst_WaylandClientFullScreenShellV1 : public QObject +{ + Q_OBJECT +public: + tst_WaylandClientFullScreenShellV1(MockCompositor *c) + : m_compositor(c) + { + QSocketNotifier *notifier = new QSocketNotifier(m_compositor->waylandFileDescriptor(), QSocketNotifier::Read, this); + connect(notifier, &QSocketNotifier::activated, this, &tst_WaylandClientFullScreenShellV1::processWaylandEvents); + // connect to the event dispatcher to make sure to flush out the outgoing message queue + connect(QCoreApplication::eventDispatcher(), &QAbstractEventDispatcher::awake, this, &tst_WaylandClientFullScreenShellV1::processWaylandEvents); + connect(QCoreApplication::eventDispatcher(), &QAbstractEventDispatcher::aboutToBlock, this, &tst_WaylandClientFullScreenShellV1::processWaylandEvents); + } + +public slots: + void processWaylandEvents() + { + m_compositor->processWaylandEvents(); + } + + void cleanup() + { + // make sure the surfaces from the last test are properly cleaned up + // and don't show up as false positives in the next test + QTRY_VERIFY(!m_compositor->fullScreenShellV1Surface()); + } + +private slots: + void createDestroyWindow(); + +private: + MockCompositor *m_compositor = nullptr; +}; + +void tst_WaylandClientFullScreenShellV1::createDestroyWindow() +{ + TestWindow window; + window.show(); + + QTRY_VERIFY(m_compositor->fullScreenShellV1Surface()); + + window.destroy(); + QTRY_VERIFY(!m_compositor->fullScreenShellV1Surface()); +} + +int main(int argc, char **argv) +{ + setenv("XDG_RUNTIME_DIR", ".", 1); + setenv("QT_QPA_PLATFORM", "wayland", 1); // force QGuiApplication to use wayland plugin + setenv("QT_WAYLAND_SHELL_INTEGRATION", "fullscreen-shell-v1", 1); + setenv("QT_WAYLAND_DISABLE_WINDOWDECORATION", "1", 1); // window decorations don't make much sense here + + MockCompositor compositor; + compositor.setOutputMode(screenSize); + + QGuiApplication app(argc, argv); + compositor.applicationInitialized(); + + tst_WaylandClientFullScreenShellV1 tc(&compositor); + return QTest::qExec(&tc, argc, argv); +} + +#include diff --git a/tests/auto/wayland/shared/mockcompositor.cpp b/tests/auto/wayland/shared/mockcompositor.cpp index 797c05c44ec..df24b4091b5 100644 --- a/tests/auto/wayland/shared/mockcompositor.cpp +++ b/tests/auto/wayland/shared/mockcompositor.cpp @@ -299,6 +299,16 @@ QSharedPointer MockCompositor::xdgToplevelV6(int index) return result; } +QSharedPointer MockCompositor::fullScreenShellV1Surface(int index) +{ + QSharedPointer result; + lock(); + if (Impl::Surface *surface = m_compositor->fullScreenShellV1()->surfaces().value(index, nullptr)) + result = surface->mockSurface(); + unlock(); + return result; +} + MockCompositor::Command MockCompositor::makeCommand(Command::Callback callback, void *target) { Command command; @@ -382,6 +392,7 @@ Compositor::Compositor() m_iviApplication.reset(new IviApplication(m_display)); m_wlShell.reset(new WlShell(m_display)); m_xdgShellV6.reset(new XdgShellV6(m_display)); + m_fullScreenShellV1.reset(new FullScreenShellV1(m_display)); m_loop = wl_display_get_event_loop(m_display); m_fd = wl_event_loop_get_fd(m_loop); @@ -459,6 +470,11 @@ XdgShellV6 *Compositor::xdgShellV6() const return m_xdgShellV6.data(); } +FullScreenShellV1 *Compositor::fullScreenShellV1() const +{ + return m_fullScreenShellV1.data(); +} + uint32_t Compositor::nextSerial() { return wl_display_next_serial(m_display); @@ -474,6 +490,7 @@ void Compositor::removeSurface(Surface *surface) m_surfaces.removeOne(surface); m_keyboard->handleSurfaceDestroyed(surface); m_pointer->handleSurfaceDestroyed(surface); + m_fullScreenShellV1->removeSurface(surface); } Surface *Compositor::resolveSurface(const QVariant &v) diff --git a/tests/auto/wayland/shared/mockcompositor.h b/tests/auto/wayland/shared/mockcompositor.h index b0d6b08855c..4bab1ed67a0 100644 --- a/tests/auto/wayland/shared/mockcompositor.h +++ b/tests/auto/wayland/shared/mockcompositor.h @@ -31,6 +31,7 @@ #include "mockxdgshellv6.h" #include "mockiviapplication.h" +#include "mockfullscreenshellv1.h" #include #include @@ -76,6 +77,7 @@ public: IviApplication *iviApplication() const; XdgShellV6 *xdgShellV6() const; + FullScreenShellV1 *fullScreenShellV1() const; void addSurface(Surface *surface); void removeSurface(Surface *surface); @@ -135,6 +137,7 @@ private: QScopedPointer m_iviApplication; QScopedPointer m_wlShell; QScopedPointer m_xdgShellV6; + QScopedPointer m_fullScreenShellV1; }; void registerResource(wl_list *list, wl_resource *resource); @@ -251,6 +254,7 @@ public: QSharedPointer output(int index = 0); QSharedPointer iviSurface(int index = 0); QSharedPointer xdgToplevelV6(int index = 0); + QSharedPointer fullScreenShellV1Surface(int index = 0); void lock(); void unlock(); diff --git a/tests/auto/wayland/shared/mockfullscreenshellv1.cpp b/tests/auto/wayland/shared/mockfullscreenshellv1.cpp new file mode 100644 index 00000000000..22c49cde60b --- /dev/null +++ b/tests/auto/wayland/shared/mockfullscreenshellv1.cpp @@ -0,0 +1,43 @@ +/**************************************************************************** +** +** Copyright (C) 2018 Pier Luigi Fiorini +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "mockfullscreenshellv1.h" +#include "mocksurface.h" + +namespace Impl { + +void FullScreenShellV1::zwp_fullscreen_shell_v1_present_surface(Resource *resource, struct ::wl_resource *surface, uint32_t method, struct ::wl_resource *output) +{ + Q_UNUSED(resource) + Q_UNUSED(method) + Q_UNUSED(output) + + m_surfaces.append(Surface::fromResource(surface)); +} + +} // namespace Impl diff --git a/tests/auto/wayland/shared/mockfullscreenshellv1.h b/tests/auto/wayland/shared/mockfullscreenshellv1.h new file mode 100644 index 00000000000..819bbc186c7 --- /dev/null +++ b/tests/auto/wayland/shared/mockfullscreenshellv1.h @@ -0,0 +1,58 @@ +/**************************************************************************** +** +** Copyright (C) 2018 Pier Luigi Fiorini +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef MOCKFULLSCREENSHELLV1_H +#define MOCKFULLSCREENSHELLV1_H + +#include + +#include + +namespace Impl { + +class Surface; +class FullScreenShellV1; + +class FullScreenShellV1 : public QtWaylandServer::zwp_fullscreen_shell_v1 +{ +public: + explicit FullScreenShellV1(::wl_display *display) : zwp_fullscreen_shell_v1(display, 1) {} + + QVector surfaces() const { return m_surfaces; } + void removeSurface(Surface *surface) { m_surfaces.removeOne(surface); } + +protected: + void zwp_fullscreen_shell_v1_present_surface(Resource *resource, struct ::wl_resource *surface, uint32_t method, struct ::wl_resource *output) override; + +private: + QVector m_surfaces; +}; + +} // namespace Impl + +#endif // MOCKFULLSCREENSHELLV1_H diff --git a/tests/auto/wayland/shared/shared.pri b/tests/auto/wayland/shared/shared.pri index f3cb4d5a233..db71de52891 100644 --- a/tests/auto/wayland/shared/shared.pri +++ b/tests/auto/wayland/shared/shared.pri @@ -8,12 +8,14 @@ CONFIG += wayland-scanner WAYLANDSERVERSOURCES += \ ../../../../src/3rdparty/protocol/ivi-application.xml \ ../../../../src/3rdparty/protocol/wayland.xml \ - ../../../../src/3rdparty/protocol/xdg-shell-unstable-v6.xml + ../../../../src/3rdparty/protocol/xdg-shell-unstable-v6.xml \ + ../../../../src/3rdparty/protocol/fullscreen-shell-unstable-v1.xml INCLUDEPATH += ../shared SOURCES += \ ../shared/mockcompositor.cpp \ + ../shared/mockfullscreenshellv1.cpp \ ../shared/mockinput.cpp \ ../shared/mockiviapplication.cpp \ ../shared/mockwlshell.cpp \ @@ -23,6 +25,7 @@ SOURCES += \ HEADERS += \ ../shared/mockcompositor.h \ + ../shared/mockfullscreenshellv1.h \ ../shared/mockinput.h \ ../shared/mockiviapplication.h \ ../shared/mockwlshell.h \ From 70b5d99bc2aff716b5329276211bf8295cc226bc Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Wed, 7 Nov 2018 11:23:44 +0100 Subject: [PATCH 0612/1507] Only print deprecation warning when using deprecated shells Avoids printing deprecation warnings for shells that are available by default but not actually used. In particular, avoids warning about wl-shell when using ivi-shell. Change-Id: Id075e97572e6ec876ad24f369808c61a479e9b07 Reviewed-by: Johan Helsing --- .../wl-shell/qwaylandwlshellintegration.cpp | 8 ++++---- .../xdg-shell-v5/qwaylandxdgshellv5integration.cpp | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellintegration.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellintegration.cpp index 008da3d8a83..1edb24b3c01 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellintegration.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellintegration.cpp @@ -49,10 +49,6 @@ namespace QtWaylandClient { bool QWaylandWlShellIntegration::initialize(QWaylandDisplay *display) { - qCWarning(lcQpaWayland) << "\"wl-shell\" is a deprecated shell extension, prefer using" - << "\"xdg-shell-v6\" or \"xdg-shell\" if supported by the compositor" - << "by setting the environment variable QT_WAYLAND_SHELL_INTEGRATION"; - Q_FOREACH (QWaylandDisplay::RegistryGlobal global, display->globals()) { if (global.interface == QLatin1String("wl_shell")) { m_wlShell = new QtWayland::wl_shell(display->wl_registry(), global.id, 1); @@ -65,6 +61,10 @@ bool QWaylandWlShellIntegration::initialize(QWaylandDisplay *display) return false; } + qCWarning(lcQpaWayland) << "\"wl-shell\" is a deprecated shell extension, prefer using" + << "\"xdg-shell-v6\" or \"xdg-shell\" if supported by the compositor" + << "by setting the environment variable QT_WAYLAND_SHELL_INTEGRATION"; + return QWaylandShellIntegration::initialize(display); } diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshellv5integration.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshellv5integration.cpp index d032002b159..12cc95b1538 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshellv5integration.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshellv5integration.cpp @@ -51,10 +51,6 @@ namespace QtWaylandClient { bool QWaylandXdgShellV5Integration::initialize(QWaylandDisplay *display) { - qCWarning(lcQpaWayland) << "\"xdg-shell-v5\" is a deprecated shell extension, prefer using" - << "\"xdg-shell-v6\" or \"xdg-shell\" if supported by the compositor" - << "by setting the environment variable QT_WAYLAND_SHELL_INTEGRATION"; - Q_FOREACH (QWaylandDisplay::RegistryGlobal global, display->globals()) { if (global.interface == QLatin1String("xdg_shell")) { m_xdgShell.reset(new QWaylandXdgShellV5(display->wl_registry(), global.id)); @@ -67,6 +63,10 @@ bool QWaylandXdgShellV5Integration::initialize(QWaylandDisplay *display) return false; } + qCWarning(lcQpaWayland) << "\"xdg-shell-v5\" is a deprecated shell extension, prefer using" + << "\"xdg-shell-v6\" or \"xdg-shell\" if supported by the compositor" + << "by setting the environment variable QT_WAYLAND_SHELL_INTEGRATION"; + return QWaylandShellIntegration::initialize(display); } From 27d39e7b3a385285431c06dae6eb2f5a0ef3cda8 Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Fri, 9 Nov 2018 15:00:21 +0000 Subject: [PATCH 0613/1507] Client: Don't require an input device for non-grabbing popups It's valid to create a non-grabbing XDG-popup, such as a tooltip, before an input event. The current guard should only apply for grabbing popups, otherwise tooltips created early are turned into XDG-toplevels resulting in incorrect positioning. Change-Id: I5bb59a68964ef2375c81e8b4e1a73361b9d2cbcc Reviewed-by: Johan Helsing --- .../xdg-shell-v6/qwaylandxdgshellv6.cpp | 30 +++++++++++-------- .../xdg-shell-v6/qwaylandxdgshellv6_p.h | 3 +- .../xdg-shell/qwaylandxdgshell.cpp | 30 +++++++++++-------- .../xdg-shell/qwaylandxdgshell_p.h | 3 +- 4 files changed, 40 insertions(+), 26 deletions(-) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp index 3d3af6929dd..ea0315c4e15 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp @@ -199,8 +199,10 @@ QWaylandXdgSurfaceV6::QWaylandXdgSurfaceV6(QWaylandXdgShellV6 *shell, ::zxdg_sur Qt::WindowType type = window->window()->type(); auto *transientParent = window->transientParent(); - if ((type == Qt::Popup || type == Qt::ToolTip) && transientParent && display->lastInputDevice()) { - setPopup(transientParent, display->lastInputDevice(), display->lastInputSerial(), type == Qt::Popup); + if (type == Qt::ToolTip && transientParent) { + setPopup(transientParent); + } else if (type == Qt::Popup && transientParent && display->lastInputDevice()) { + setGrabPopup(transientParent, display->lastInputDevice(), display->lastInputSerial()); } else { setToplevel(); if (transientParent) { @@ -304,19 +306,12 @@ void QWaylandXdgSurfaceV6::setToplevel() m_toplevel = new Toplevel(this); } -void QWaylandXdgSurfaceV6::setPopup(QWaylandWindow *parent, QWaylandInputDevice *device, int serial, bool grab) +void QWaylandXdgSurfaceV6::setPopup(QWaylandWindow *parent) { Q_ASSERT(!m_toplevel && !m_popup); auto parentXdgSurface = static_cast(parent->shellSurface()); - auto *top = m_shell->m_topmostPopup; - if (grab && top && top->m_xdgSurface != parentXdgSurface) { - qCWarning(lcQpaWayland) << "setPopup called for a surface that was not the topmost popup, positions might be off."; - parentXdgSurface = top->m_xdgSurface; - parent = top->m_xdgSurface->m_window; - } - auto positioner = new QtWayland::zxdg_positioner_v6(m_shell->create_positioner()); // set_popup expects a position relative to the parent QPoint transientPos = m_window->geometry().topLeft(); // this is absolute @@ -332,8 +327,19 @@ void QWaylandXdgSurfaceV6::setPopup(QWaylandWindow *parent, QWaylandInputDevice m_popup = new Popup(this, parentXdgSurface, positioner); positioner->destroy(); delete positioner; - if (grab) - m_popup->grab(device, serial); +} + +void QWaylandXdgSurfaceV6::setGrabPopup(QWaylandWindow *parent, QWaylandInputDevice *device, int serial) +{ + auto parentXdgSurface = static_cast(parent->shellSurface()); + auto *top = m_shell->m_topmostPopup; + + if (top && top->m_xdgSurface != parentXdgSurface) { + qCWarning(lcQpaWayland) << "setGrabPopup called for a surface that was not the topmost popup, positions might be off."; + parent = top->m_xdgSurface->m_window; + } + setPopup(parent); + m_popup->grab(device, serial); } void QWaylandXdgSurfaceV6::zxdg_surface_v6_configure(uint32_t serial) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6_p.h b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6_p.h index 874dba014a7..659cd75a15c 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6_p.h +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6_p.h @@ -131,7 +131,8 @@ private: }; void setToplevel(); - void setPopup(QWaylandWindow *parent, QWaylandInputDevice *device, int serial, bool grab); + void setPopup(QWaylandWindow *parent); + void setGrabPopup(QWaylandWindow *parent, QWaylandInputDevice *device, int serial); QWaylandXdgShellV6 *m_shell = nullptr; QWaylandWindow *m_window = nullptr; diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp index c723192c8e0..9787fa5eba4 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp @@ -227,8 +227,10 @@ QWaylandXdgSurface::QWaylandXdgSurface(QWaylandXdgShell *shell, ::xdg_surface *s Qt::WindowType type = window->window()->type(); auto *transientParent = window->transientParent(); - if ((type == Qt::Popup || type == Qt::ToolTip) && transientParent && display->lastInputDevice()) { - setPopup(transientParent, display->lastInputDevice(), display->lastInputSerial(), type == Qt::Popup); + if (type == Qt::ToolTip && transientParent) { + setPopup(transientParent); + } else if (type == Qt::Popup && transientParent && display->lastInputDevice()) { + setGrabPopup(transientParent, display->lastInputDevice(), display->lastInputSerial()); } else { setToplevel(); if (transientParent) { @@ -338,19 +340,12 @@ void QWaylandXdgSurface::setToplevel() m_toplevel = new Toplevel(this); } -void QWaylandXdgSurface::setPopup(QWaylandWindow *parent, QWaylandInputDevice *device, int serial, bool grab) +void QWaylandXdgSurface::setPopup(QWaylandWindow *parent) { Q_ASSERT(!m_toplevel && !m_popup); auto parentXdgSurface = static_cast(parent->shellSurface()); - auto *top = m_shell->m_topmostPopup; - if (grab && top && top->m_xdgSurface != parentXdgSurface) { - qCWarning(lcQpaWayland) << "setPopup called for a surface that was not the topmost popup, positions might be off."; - parentXdgSurface = top->m_xdgSurface; - parent = top->m_xdgSurface->m_window; - } - auto positioner = new QtWayland::xdg_positioner(m_shell->create_positioner()); // set_popup expects a position relative to the parent QPoint transientPos = m_window->geometry().topLeft(); // this is absolute @@ -366,8 +361,19 @@ void QWaylandXdgSurface::setPopup(QWaylandWindow *parent, QWaylandInputDevice *d m_popup = new Popup(this, parentXdgSurface, positioner); positioner->destroy(); delete positioner; - if (grab) - m_popup->grab(device, serial); +} + +void QWaylandXdgSurface::setGrabPopup(QWaylandWindow *parent, QWaylandInputDevice *device, int serial) +{ + auto parentXdgSurface = static_cast(parent->shellSurface()); + auto *top = m_shell->m_topmostPopup; + + if (top && top->m_xdgSurface != parentXdgSurface) { + qCWarning(lcQpaWayland) << "setGrabPopup called for a surface that was not the topmost popup, positions might be off."; + parent = top->m_xdgSurface->m_window; + } + setPopup(parent); + m_popup->grab(device, serial); } void QWaylandXdgSurface::xdg_surface_configure(uint32_t serial) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h index 5e97a34b31c..8804d580739 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h @@ -138,7 +138,8 @@ private: }; void setToplevel(); - void setPopup(QWaylandWindow *parent, QWaylandInputDevice *device, int serial, bool grab); + void setPopup(QWaylandWindow *parent); + void setGrabPopup(QWaylandWindow *parent, QWaylandInputDevice *device, int serial); QWaylandXdgShell *m_shell = nullptr; QWaylandWindow *m_window = nullptr; From 3684b835891746df632bf6aa976074662a7ed290 Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Mon, 12 Nov 2018 10:14:33 +0000 Subject: [PATCH 0614/1507] Client: Rename m_topmostPopup to clarify its goal This is used when creating new grabbed popups to ensure they are only created on the topmost grabbing popup as per the specification. Non-grabbing popups don't have this restriction. Change-Id: I8e2b8cd0f091688c847f81f2e5d33ce2f0df96a1 Reviewed-by: Johan Helsing --- .../shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp | 8 ++++---- .../shellintegration/xdg-shell-v6/qwaylandxdgshellv6_p.h | 2 +- .../shellintegration/xdg-shell/qwaylandxdgshell.cpp | 8 ++++---- .../shellintegration/xdg-shell/qwaylandxdgshell_p.h | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp index ea0315c4e15..fb33b4ab488 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp @@ -172,14 +172,14 @@ QWaylandXdgSurfaceV6::Popup::~Popup() if (m_grabbing) { auto *shell = m_xdgSurface->m_shell; - Q_ASSERT(shell->m_topmostPopup == this); - shell->m_topmostPopup = m_parent->m_popup; + Q_ASSERT(shell->m_topmostGrabbingPopup == this); + shell->m_topmostGrabbingPopup = m_parent->m_popup; } } void QWaylandXdgSurfaceV6::Popup::grab(QWaylandInputDevice *seat, uint serial) { - m_xdgSurface->m_shell->m_topmostPopup = this; + m_xdgSurface->m_shell->m_topmostGrabbingPopup = this; zxdg_popup_v6::grab(seat->wl_seat(), serial); m_grabbing = true; } @@ -332,7 +332,7 @@ void QWaylandXdgSurfaceV6::setPopup(QWaylandWindow *parent) void QWaylandXdgSurfaceV6::setGrabPopup(QWaylandWindow *parent, QWaylandInputDevice *device, int serial) { auto parentXdgSurface = static_cast(parent->shellSurface()); - auto *top = m_shell->m_topmostPopup; + auto *top = m_shell->m_topmostGrabbingPopup; if (top && top->m_xdgSurface != parentXdgSurface) { qCWarning(lcQpaWayland) << "setGrabPopup called for a surface that was not the topmost popup, positions might be off."; diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6_p.h b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6_p.h index 659cd75a15c..659aad047b8 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6_p.h +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6_p.h @@ -156,7 +156,7 @@ public: private: void zxdg_shell_v6_ping(uint32_t serial) override; - QWaylandXdgSurfaceV6::Popup *m_topmostPopup = nullptr; + QWaylandXdgSurfaceV6::Popup *m_topmostGrabbingPopup = nullptr; friend class QWaylandXdgSurfaceV6; }; diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp index 9787fa5eba4..6c98dc6ad1d 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp @@ -200,14 +200,14 @@ QWaylandXdgSurface::Popup::~Popup() if (m_grabbing) { auto *shell = m_xdgSurface->m_shell; - Q_ASSERT(shell->m_topmostPopup == this); - shell->m_topmostPopup = m_parent->m_popup; + Q_ASSERT(shell->m_topmostGrabbingPopup == this); + shell->m_topmostGrabbingPopup = m_parent->m_popup; } } void QWaylandXdgSurface::Popup::grab(QWaylandInputDevice *seat, uint serial) { - m_xdgSurface->m_shell->m_topmostPopup = this; + m_xdgSurface->m_shell->m_topmostGrabbingPopup = this; xdg_popup::grab(seat->wl_seat(), serial); m_grabbing = true; } @@ -366,7 +366,7 @@ void QWaylandXdgSurface::setPopup(QWaylandWindow *parent) void QWaylandXdgSurface::setGrabPopup(QWaylandWindow *parent, QWaylandInputDevice *device, int serial) { auto parentXdgSurface = static_cast(parent->shellSurface()); - auto *top = m_shell->m_topmostPopup; + auto *top = m_shell->m_topmostGrabbingPopup; if (top && top->m_xdgSurface != parentXdgSurface) { qCWarning(lcQpaWayland) << "setGrabPopup called for a surface that was not the topmost popup, positions might be off."; diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h index 8804d580739..741b83cfd60 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h @@ -170,7 +170,7 @@ private: QWaylandDisplay *m_display = nullptr; QScopedPointer m_xdgDecorationManager; - QWaylandXdgSurface::Popup *m_topmostPopup = nullptr; + QWaylandXdgSurface::Popup *m_topmostGrabbingPopup = nullptr; friend class QWaylandXdgSurface; }; From a544de1bc0e005ede75a510be0d97f98d44f87c9 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Thu, 15 Nov 2018 10:01:16 +0100 Subject: [PATCH 0615/1507] qtwaylandscanner: Generate Resource::object without interface prefix This allows writing template functions like this template return_type *fromResource(struct ::wl_resource *resource) { if (auto *r = return_type::Resource::fromResource(resource)) return static_cast(r->object()); return nullptr; } Letting us easily cast a wl_resource to a wrapper type, i.e.: wl_resource *resource = ... auto *surfacePrivate = fromResource(resource); This can hopefully let us reduce some boilerplate in the future. Change-Id: I41630f35b3472baa39d88d89c1c6503cc0e6584a Reviewed-by: Paul Olav Tvete --- src/tools/qtwaylandscanner/qtwaylandscanner.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp index bc0262bc0a2..91a6d6eef24 100644 --- a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp +++ b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp @@ -504,6 +504,7 @@ bool Scanner::process() printf(" virtual ~Resource() {}\n"); printf("\n"); printf(" %s *%s_object;\n", interfaceName, interfaceNameStripped); + printf(" %s *object() { return %s_object; } \n", interfaceName, interfaceNameStripped); printf(" struct ::wl_resource *handle;\n"); printf("\n"); printf(" struct ::wl_client *client() const { return wl_resource_get_client(handle); }\n"); From a800b2951e52cc0a8d0d3313d5281dbb806c5053 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Tue, 20 Nov 2018 09:47:02 +0100 Subject: [PATCH 0616/1507] Client: Don't create cursor surface until we can set its role We can't set the cursor role until we have gotten an enter event, so wait with creating the surface until we want to set the role for the first time. Makes testing easier since we don't have to deal with role-less surfaces that may or may not be the cursor surface. Change-Id: I99803d9b0b5933a271b6b1d56f74d4ff79813e40 Reviewed-by: Paul Olav Tvete Reviewed-by: David Edmundson --- src/plugins/platforms/wayland/qwaylandinputdevice.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index 5b5ad7a3211..8f90a81a459 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -238,7 +238,6 @@ void QWaylandInputDevice::seat_capabilities(uint32_t caps) if (caps & WL_SEAT_CAPABILITY_POINTER && !mPointer) { mPointer = createPointer(this); mPointer->init(get_pointer()); - pointerSurface = mQDisplay->createSurface(this); } else if (!(caps & WL_SEAT_CAPABILITY_POINTER) && mPointer) { delete mPointer; mPointer = nullptr; @@ -419,6 +418,9 @@ void QWaylandInputDevice::setCursor(struct wl_buffer *buffer, const QPoint &hotS return; } + if (!pointerSurface) + pointerSurface = mQDisplay->createSurface(this); + mPointer->set_cursor(mPointer->mEnterSerial, pointerSurface, hotSpot.x(), hotSpot.y()); wl_surface_attach(pointerSurface, buffer, 0, 0); From 29707d3476d500b222b58b044dd40ec6bc65c231 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Tue, 20 Nov 2018 12:23:51 +0100 Subject: [PATCH 0617/1507] Client: Fix incorrect enter serial in set_cursor Change-Id: Ibeacc5218acbd6003b85811a175ed00fd62a4b51 Reviewed-by: Paul Olav Tvete --- src/plugins/platforms/wayland/qwaylandinputdevice.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index 37c6fbe9fd0..9d675ae21d7 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -451,10 +451,6 @@ void QWaylandInputDevice::Pointer::pointer_enter(uint32_t serial, struct wl_surf return; QWaylandWindow *window = QWaylandWindow::fromWlSurface(surface); -#if QT_CONFIG(cursor) - window->window()->setCursor(window->window()->cursor()); -#endif - mFocus = window; mSurfacePos = QPointF(wl_fixed_to_double(sx), wl_fixed_to_double(sy)); mGlobalPos = window->window()->mapToGlobal(mSurfacePos.toPoint()); @@ -462,6 +458,11 @@ void QWaylandInputDevice::Pointer::pointer_enter(uint32_t serial, struct wl_surf mParent->mSerial = serial; mEnterSerial = serial; +#if QT_CONFIG(cursor) + // Depends on mEnterSerial being updated + window->window()->setCursor(window->window()->cursor()); +#endif + QWaylandWindow *grab = QWaylandWindow::mouseGrab(); if (!grab) { EnterEvent evt(mSurfacePos, mGlobalPos); From 5dd593598966835af7915673e2972c499526974d Mon Sep 17 00:00:00 2001 From: Sergio Martins Date: Fri, 30 Nov 2018 10:49:51 +0000 Subject: [PATCH 0618/1507] Fix unused variables, in preparation for adding warning_clean The QByteArray one seems like an actual bug. Change-Id: I11de9c7a10cdd3e70f9f6af18bcce3bd3bf54320 Reviewed-by: Johan Helsing --- src/tools/qtwaylandscanner/qtwaylandscanner.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp index f2e2d24de5e..57f3f1a9f20 100644 --- a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp +++ b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp @@ -126,7 +126,7 @@ private: bool Scanner::parseArguments(int argc, char **argv) { - QByteArray m_scannerName = argv[0]; + m_scannerName = argv[0]; if (argc <= 2 || !parseOption(argv[1])) return false; @@ -1200,8 +1200,6 @@ bool Scanner::process() for (int i = 0; i < e.arguments.size(); ++i) { printf("\n"); const WaylandArgument &a = e.arguments.at(i); - QByteArray cType = waylandToCType(a.type, a.interface); - QByteArray qtType = waylandToQtType(a.type, a.interface, e.request); const char *argumentName = a.name.constData(); if (a.type == "string") printf(" QString::fromUtf8(%s)", argumentName); From 130a6d7e605ad89dedaa1a95538f2fbae09aafc9 Mon Sep 17 00:00:00 2001 From: Ville Voutilainen Date: Mon, 3 Dec 2018 16:12:09 +0200 Subject: [PATCH 0619/1507] Fix compilation with gcc 4.8 GCC 4.8 doesn't like QPointers in signal connections. Also, Default Member Initializers for aggregates are C++14, so we need to write a constructor to make a class with DMIs work in C++11. Change-Id: I567c60a8081fa2f268517ec747bd6534674bcce5 Reviewed-by: Simon Hausmann --- src/plugins/platforms/wayland/qwaylanddisplay_p.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay_p.h b/src/plugins/platforms/wayland/qwaylanddisplay_p.h index 0dd8d7affb8..43ccc0a96e1 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay_p.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay_p.h @@ -195,6 +195,11 @@ private: void requestWaylandSync(); struct Listener { + Listener() = default; + Listener(RegistryListener incomingListener, + void* incomingData) + : listener(incomingListener), data(incomingData) + {} RegistryListener listener = nullptr; void *data = nullptr; }; From a3e23fe5609ed1a8ec20196d3261bca8e6a60a6f Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Wed, 5 Dec 2018 10:03:29 +0100 Subject: [PATCH 0620/1507] Scanner: Add include for QList QList is not included when built with QT_NO_QOBJECT defined. Change-Id: Iaf8874583e81b08a49ec246a5de0b62803c8ed7e Reviewed-by: Sami Nurmenniemi Reviewed-by: Liang Qi --- src/tools/qtwaylandscanner/qtwaylandscanner.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp index 57f3f1a9f20..6f4a33b5f6b 100644 --- a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp +++ b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp @@ -40,6 +40,7 @@ #include #include #include +#include class Scanner { From f1e49d930965dd780f6bc03481b3705a3878a838 Mon Sep 17 00:00:00 2001 From: Gatis Paeglis Date: Mon, 19 Nov 2018 16:32:12 +0100 Subject: [PATCH 0621/1507] use new feature name xkbcommon_evdev -> xkbcommon The xkbcommon configure logic was refactored in qtbase/c3a963da1f9e7b1d37e63eedded61da4fbdaaf9a. For more details see the relevant commit. Change-Id: Ic1aa26846ab8266c589f6e92dc8b81aba36df58a Reviewed-by: Johan Helsing --- src/plugins/platforms/wayland/client.pro | 4 ++-- .../shellintegration/wl-shell/wl-shell.pro | 4 ++-- .../xdg-shell-v5/xdg-shell-v5.pro | 4 ++-- .../xdg-shell-v6/xdg-shell-v6.pro | 4 ++-- .../shellintegration/xdg-shell/xdg-shell.pro | 4 ++-- .../platforms/wayland/qwaylandinputdevice.cpp | 22 +++++++++---------- .../platforms/wayland/qwaylandinputdevice_p.h | 10 ++++----- .../platforms/wayland/shared/qwaylandxkb.cpp | 10 ++++----- .../platforms/wayland/shared/qwaylandxkb_p.h | 2 +- 9 files changed, 32 insertions(+), 32 deletions(-) diff --git a/src/plugins/platforms/wayland/client.pro b/src/plugins/platforms/wayland/client.pro index 45bbb976b4e..30f32dd7e18 100644 --- a/src/plugins/platforms/wayland/client.pro +++ b/src/plugins/platforms/wayland/client.pro @@ -15,8 +15,8 @@ use_gold_linker: CONFIG += no_linker_version_script CONFIG -= precompile_header CONFIG += link_pkgconfig wayland-scanner -qtConfig(xkbcommon-evdev): \ - QMAKE_USE_PRIVATE += xkbcommon_evdev +qtConfig(xkbcommon): \ + QMAKE_USE_PRIVATE += xkbcommon QMAKE_USE += wayland-client diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/wl-shell.pro b/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/wl-shell.pro index fbff63c712e..bb2c1829afe 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/wl-shell.pro +++ b/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/wl-shell.pro @@ -2,8 +2,8 @@ QT += gui-private waylandclient-private CONFIG += wayland-scanner QMAKE_USE += wayland-client -qtConfig(xkbcommon-evdev): \ - QMAKE_USE_PRIVATE += xkbcommon_evdev +qtConfig(xkbcommon): \ + QMAKE_USE_PRIVATE += xkbcommon WAYLANDCLIENTSOURCES += \ ../../../3rdparty/protocol/wayland.xml diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/xdg-shell-v5.pro b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/xdg-shell-v5.pro index bf9edba7842..4f6dde9bcf6 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/xdg-shell-v5.pro +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/xdg-shell-v5.pro @@ -3,8 +3,8 @@ CONFIG += wayland-scanner QMAKE_USE += wayland-client -qtConfig(xkbcommon-evdev): \ - QMAKE_USE += xkbcommon_evdev +qtConfig(xkbcommon): \ + QMAKE_USE += xkbcommon HEADERS += \ qwaylandxdgpopupv5_p.h \ diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/xdg-shell-v6.pro b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/xdg-shell-v6.pro index 5d5046f6066..3c1aaee818e 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/xdg-shell-v6.pro +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/xdg-shell-v6.pro @@ -2,8 +2,8 @@ QT += gui-private waylandclient-private CONFIG += wayland-scanner QMAKE_USE += wayland-client -qtConfig(xkbcommon-evdev): \ - QMAKE_USE_PRIVATE += xkbcommon_evdev +qtConfig(xkbcommon): \ + QMAKE_USE_PRIVATE += xkbcommon WAYLANDCLIENTSOURCES += \ ../../../3rdparty/protocol/xdg-shell-unstable-v6.xml diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/xdg-shell.pro b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/xdg-shell.pro index 2b1191af03a..261715845c8 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/xdg-shell.pro +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/xdg-shell.pro @@ -2,8 +2,8 @@ QT += gui-private waylandclient-private CONFIG += wayland-scanner QMAKE_USE += wayland-client -qtConfig(xkbcommon-evdev): \ - QMAKE_USE_PRIVATE += xkbcommon_evdev +qtConfig(xkbcommon): \ + QMAKE_USE_PRIVATE += xkbcommon WAYLANDCLIENTSOURCES += \ ../../../3rdparty/protocol/xdg-decoration-unstable-v1.xml \ diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index 9d675ae21d7..ba55e6e1721 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -70,7 +70,7 @@ #include -#if QT_CONFIG(xkbcommon_evdev) +#if QT_CONFIG(xkbcommon) #include #endif @@ -84,7 +84,7 @@ QWaylandInputDevice::Keyboard::Keyboard(QWaylandInputDevice *p) connect(&mRepeatTimer, SIGNAL(timeout()), this, SLOT(repeatKey())); } -#if QT_CONFIG(xkbcommon_evdev) +#if QT_CONFIG(xkbcommon) bool QWaylandInputDevice::Keyboard::createDefaultKeyMap() { if (mXkbContext && mXkbMap && mXkbState) { @@ -156,7 +156,7 @@ void QWaylandInputDevice::Keyboard::releaseComposeState() QWaylandInputDevice::Keyboard::~Keyboard() { -#if QT_CONFIG(xkbcommon_evdev) +#if QT_CONFIG(xkbcommon) releaseComposeState(); releaseKeyMap(); #endif @@ -344,7 +344,7 @@ Qt::KeyboardModifiers QWaylandInputDevice::Keyboard::modifiers() const { Qt::KeyboardModifiers ret = Qt::NoModifier; -#if QT_CONFIG(xkbcommon_evdev) +#if QT_CONFIG(xkbcommon) if (!mXkbState) return ret; @@ -625,7 +625,7 @@ void QWaylandInputDevice::Pointer::pointer_axis(uint32_t time, uint32_t axis, in void QWaylandInputDevice::Keyboard::keyboard_keymap(uint32_t format, int32_t fd, uint32_t size) { -#if QT_CONFIG(xkbcommon_evdev) +#if QT_CONFIG(xkbcommon) if (format != WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1) { close(fd); return; @@ -728,7 +728,7 @@ void QWaylandInputDevice::Keyboard::keyboard_key(uint32_t serial, uint32_t time, if (isDown) mParent->mQDisplay->setLastInputDevice(mParent, serial, window); -#if QT_CONFIG(xkbcommon_evdev) +#if QT_CONFIG(xkbcommon) if (!createDefaultKeyMap()) { return; } @@ -771,7 +771,7 @@ void QWaylandInputDevice::Keyboard::keyboard_key(uint32_t serial, uint32_t time, #endif if (state == WL_KEYBOARD_KEY_STATE_PRESSED -#if QT_CONFIG(xkbcommon_evdev) +#if QT_CONFIG(xkbcommon) && xkb_keymap_key_repeats(mXkbMap, code) #endif ) { @@ -779,7 +779,7 @@ void QWaylandInputDevice::Keyboard::keyboard_key(uint32_t serial, uint32_t time, mRepeatCode = code; mRepeatTime = time; mRepeatText = text; -#if QT_CONFIG(xkbcommon_evdev) +#if QT_CONFIG(xkbcommon) mRepeatSym = sym; #endif mRepeatTimer.setInterval(400); @@ -793,7 +793,7 @@ void QWaylandInputDevice::Keyboard::repeatKey() { mRepeatTimer.setInterval(25); sendKey(mFocus->window(), mRepeatTime, QEvent::KeyRelease, mRepeatKey, modifiers(), mRepeatCode, -#if QT_CONFIG(xkbcommon_evdev) +#if QT_CONFIG(xkbcommon) mRepeatSym, mNativeModifiers, #else 0, 0, @@ -801,7 +801,7 @@ void QWaylandInputDevice::Keyboard::repeatKey() mRepeatText, true); sendKey(mFocus->window(), mRepeatTime, QEvent::KeyPress, mRepeatKey, modifiers(), mRepeatCode, -#if QT_CONFIG(xkbcommon_evdev) +#if QT_CONFIG(xkbcommon) mRepeatSym, mNativeModifiers, #else 0, 0, @@ -816,7 +816,7 @@ void QWaylandInputDevice::Keyboard::keyboard_modifiers(uint32_t serial, uint32_t group) { Q_UNUSED(serial); -#if QT_CONFIG(xkbcommon_evdev) +#if QT_CONFIG(xkbcommon) if (mXkbState) xkb_state_update_mask(mXkbState, mods_depressed, mods_latched, mods_locked, diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h index 4b12cc089b2..7aa86539b49 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h +++ b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h @@ -65,7 +65,7 @@ #include -#if QT_CONFIG(xkbcommon_evdev) +#if QT_CONFIG(xkbcommon) #include #include #endif @@ -77,7 +77,7 @@ struct wl_cursor_image; #endif -#if QT_CONFIG(xkbcommon_evdev) +#if QT_CONFIG(xkbcommon) struct xkb_compose_state; struct xkb_compose_table; #endif @@ -209,7 +209,7 @@ public: QWaylandInputDevice *mParent = nullptr; QPointer mFocus; -#if QT_CONFIG(xkbcommon_evdev) +#if QT_CONFIG(xkbcommon) xkb_context *mXkbContext = nullptr; xkb_keymap *mXkbMap = nullptr; xkb_state *mXkbState = nullptr; @@ -222,7 +222,7 @@ public: uint32_t mRepeatCode; uint32_t mRepeatTime; QString mRepeatText; -#if QT_CONFIG(xkbcommon_evdev) +#if QT_CONFIG(xkbcommon) xkb_keysym_t mRepeatSym; #endif QTimer mRepeatTimer; @@ -233,7 +233,7 @@ private slots: void repeatKey(); private: -#if QT_CONFIG(xkbcommon_evdev) +#if QT_CONFIG(xkbcommon) bool createDefaultKeyMap(); void releaseKeyMap(); void createComposeState(); diff --git a/src/plugins/platforms/wayland/shared/qwaylandxkb.cpp b/src/plugins/platforms/wayland/shared/qwaylandxkb.cpp index a0e388a1c9b..3cfc4b074e5 100644 --- a/src/plugins/platforms/wayland/shared/qwaylandxkb.cpp +++ b/src/plugins/platforms/wayland/shared/qwaylandxkb.cpp @@ -43,13 +43,13 @@ #include #include -#if QT_CONFIG(xkbcommon_evdev) +#if QT_CONFIG(xkbcommon) #include #endif QT_BEGIN_NAMESPACE -#if QT_CONFIG(xkbcommon_evdev) +#if QT_CONFIG(xkbcommon) static const uint32_t KeyTbl[] = { XKB_KEY_Escape, Qt::Key_Escape, XKB_KEY_Tab, Qt::Key_Tab, @@ -297,7 +297,7 @@ static xkb_keysym_t toKeysymFromTable(uint32_t key) std::pair QWaylandXkb::keysymToQtKey(xkb_keysym_t keysym, Qt::KeyboardModifiers &modifiers) { -#if QT_CONFIG(xkbcommon_evdev) +#if QT_CONFIG(xkbcommon) QString text; uint utf32 = xkb_keysym_to_utf32(keysym); if (utf32) @@ -339,7 +339,7 @@ std::pair QWaylandXkb::keysymToQtKey(xkb_keysym_t keysym, Qt::Keyb Qt::KeyboardModifiers QWaylandXkb::modifiers(struct xkb_state *state) { -#if QT_CONFIG(xkbcommon_evdev) +#if QT_CONFIG(xkbcommon) Qt::KeyboardModifiers modifiers = Qt::NoModifier; xkb_state_component cstate = static_cast(XKB_STATE_DEPRESSED | XKB_STATE_LATCHED | XKB_STATE_LOCKED); @@ -367,7 +367,7 @@ QEvent::Type QWaylandXkb::toQtEventType(uint32_t state) QVector QWaylandXkb::toKeysym(QKeyEvent *event) { -#if QT_CONFIG(xkbcommon_evdev) +#if QT_CONFIG(xkbcommon) QVector keysyms; if (event->key() >= Qt::Key_F1 && event->key() <= Qt::Key_F35) { keysyms.append(XKB_KEY_F1 + (event->key() - Qt::Key_F1)); diff --git a/src/plugins/platforms/wayland/shared/qwaylandxkb_p.h b/src/plugins/platforms/wayland/shared/qwaylandxkb_p.h index 6fa1ea45b8e..4820d94bea6 100644 --- a/src/plugins/platforms/wayland/shared/qwaylandxkb_p.h +++ b/src/plugins/platforms/wayland/shared/qwaylandxkb_p.h @@ -45,7 +45,7 @@ #include #include -#if QT_CONFIG(xkbcommon_evdev) +#if QT_CONFIG(xkbcommon) #include #else typedef quint32 xkb_keysym_t; From f6dd4ab120f2f3822a19233233e791d4449e134a Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Wed, 24 Oct 2018 08:46:06 +0200 Subject: [PATCH 0622/1507] Create a new type of mock compositor for client tests There are a number of issues with the current client testing: - Adding new compositor functionality is cumbersome (need to add compositor send method, command, implementation, not to mention creating new wrapper objects. - Customizing available globals and their versions is not possible and would be hard to implement. I.e. how to test that functionality works with old and new versions of an interface? Handle globals being destroyed. We did this with wl_output, but it was painfully cumbersome. - Hard to verify that the compositor state is clean between tests. It is currently done in some tests, but requires boiler plate code which needs to be added and maintained for each test. - In general lots of boiler-plate for new tests. (We have to have separate tests as long as Qt has global/static state. I.e. if one shell extension has been initialized, we can't deinitialize and initialize another one, so tests have to be separate.) - Dispatching server events tied to the client event loop sometimes makes it hard to write tests without deadlocks. - Abstraction, encapsulation and automatic behavior that can't be disabled makes it hard to test low-level functionality like surface exposure. So, in an attempt to mitigate these issues, I wrote a new testing framework. - Compositor dispatch is running continuously in it's own thread, access to compositor state is guarded by a mutex on the compositor, locking this will make dispatching stop, so the test can safely access internals. Although a bit cumbersome at first this makes it much easier to directly use server protocol commands from the test itself, i.e. no need to create commands for every single thing we want to test. - The CoreCompositor::exec template method can accept a lambda that will be run with dispatching stopped. It can also return a value, conveniently letting us safely extract or modify compositor state from tests. - This framework also takes full advantage of the qtwaylandscanner, using wrapper classes for everything, reducing boiler plate considerably. - The compositor parts are designed to do as little as possible automatically, but still provide easy ways to enable common functionality, like releasing buffers automatically, configuring shell surfaces etc. - Compositor globals are pluggable, use add() and remove() to add new global interfaces. I.e. easy to create a compositor with or without data_device_manager for instance. - DefaultCompositor provides a sensible default set of functionality and convenience methods for most test-cases. Custom ones can still be made by inheriting from CoreCompositor directly instead or by removing or adding globals to DefaultCompositor. - Globals have an isClean() method. Implement it to verify that the client didn't leave any objects lying around from the previous test. CoreCompositor::isClean calls isClean on the globals so a single call is all that's needed. In short, we've traded mock compositor encapsulation and thread safety guarantees for less boiler-plate, easier and more convenient access to internals. Anything accessing compositor state should go into a exec() call, or through the wrapper macros QCOMPOSITOR_VERIFY and QCOMPOSITOR_COMPARE (or the TRY versions). I've also tried to make the compositor print warnings if compositor state is accessed in an unsafe way. The mock compositor is currently built once per test due to CI limitations (same thing as with the old tests). Change-Id: Ia3feb80ce175d3814292b7f4768a0cc719f8b0e8 Reviewed-by: Paul Olav Tvete --- tests/auto/wayland/client.pro | 7 +- tests/auto/wayland/client/client.pro | 2 +- .../fullscreenshellv1/fullscreenshellv1.pro | 2 +- .../wayland/iviapplication/iviapplication.pro | 2 +- tests/auto/wayland/seatv4/seatv4.pro | 4 + tests/auto/wayland/seatv4/tst_seatv4.cpp | 266 +++++++++ tests/auto/wayland/shared/corecompositor.cpp | 140 +++++ tests/auto/wayland/shared/corecompositor.h | 209 +++++++ tests/auto/wayland/shared/coreprotocol.cpp | 322 +++++++++++ tests/auto/wayland/shared/coreprotocol.h | 313 +++++++++++ tests/auto/wayland/shared/mockcompositor.cpp | 524 ++---------------- tests/auto/wayland/shared/mockcompositor.h | 289 ++-------- tests/auto/wayland/shared/shared.pri | 43 +- tests/auto/wayland/shared/xdgshell.cpp | 186 +++++++ tests/auto/wayland/shared/xdgshell.h | 127 +++++ .../wayland/shared_old/mockcompositor.cpp | 520 +++++++++++++++++ .../auto/wayland/shared_old/mockcompositor.h | 290 ++++++++++ .../mockfullscreenshellv1.cpp | 0 .../mockfullscreenshellv1.h | 0 .../{shared => shared_old}/mockinput.cpp | 0 .../{shared => shared_old}/mockinput.h | 0 .../mockiviapplication.cpp | 0 .../mockiviapplication.h | 0 .../{shared => shared_old}/mockoutput.cpp | 0 .../{shared => shared_old}/mockoutput.h | 0 .../{shared => shared_old}/mocksurface.cpp | 0 .../{shared => shared_old}/mocksurface.h | 0 .../{shared => shared_old}/mockwlshell.cpp | 0 .../{shared => shared_old}/mockwlshell.h | 0 .../{shared => shared_old}/mockxdgshellv6.cpp | 0 .../{shared => shared_old}/mockxdgshellv6.h | 0 tests/auto/wayland/shared_old/shared_old.pri | 34 ++ tests/auto/wayland/surface/surface.pro | 5 + tests/auto/wayland/surface/tst_surface.cpp | 158 ++++++ tests/auto/wayland/xdgshell/tst_xdgshell.cpp | 269 +++++++++ tests/auto/wayland/xdgshell/xdgshell.pro | 5 + tests/auto/wayland/xdgshellv6/xdgshellv6.pro | 2 +- 37 files changed, 2960 insertions(+), 759 deletions(-) create mode 100644 tests/auto/wayland/seatv4/seatv4.pro create mode 100644 tests/auto/wayland/seatv4/tst_seatv4.cpp create mode 100644 tests/auto/wayland/shared/corecompositor.cpp create mode 100644 tests/auto/wayland/shared/corecompositor.h create mode 100644 tests/auto/wayland/shared/coreprotocol.cpp create mode 100644 tests/auto/wayland/shared/coreprotocol.h create mode 100644 tests/auto/wayland/shared/xdgshell.cpp create mode 100644 tests/auto/wayland/shared/xdgshell.h create mode 100644 tests/auto/wayland/shared_old/mockcompositor.cpp create mode 100644 tests/auto/wayland/shared_old/mockcompositor.h rename tests/auto/wayland/{shared => shared_old}/mockfullscreenshellv1.cpp (100%) rename tests/auto/wayland/{shared => shared_old}/mockfullscreenshellv1.h (100%) rename tests/auto/wayland/{shared => shared_old}/mockinput.cpp (100%) rename tests/auto/wayland/{shared => shared_old}/mockinput.h (100%) rename tests/auto/wayland/{shared => shared_old}/mockiviapplication.cpp (100%) rename tests/auto/wayland/{shared => shared_old}/mockiviapplication.h (100%) rename tests/auto/wayland/{shared => shared_old}/mockoutput.cpp (100%) rename tests/auto/wayland/{shared => shared_old}/mockoutput.h (100%) rename tests/auto/wayland/{shared => shared_old}/mocksurface.cpp (100%) rename tests/auto/wayland/{shared => shared_old}/mocksurface.h (100%) rename tests/auto/wayland/{shared => shared_old}/mockwlshell.cpp (100%) rename tests/auto/wayland/{shared => shared_old}/mockwlshell.h (100%) rename tests/auto/wayland/{shared => shared_old}/mockxdgshellv6.cpp (100%) rename tests/auto/wayland/{shared => shared_old}/mockxdgshellv6.h (100%) create mode 100644 tests/auto/wayland/shared_old/shared_old.pri create mode 100644 tests/auto/wayland/surface/surface.pro create mode 100644 tests/auto/wayland/surface/tst_surface.cpp create mode 100644 tests/auto/wayland/xdgshell/tst_xdgshell.cpp create mode 100644 tests/auto/wayland/xdgshell/xdgshell.pro diff --git a/tests/auto/wayland/client.pro b/tests/auto/wayland/client.pro index 14ce4407d95..af7889d5f33 100644 --- a/tests/auto/wayland/client.pro +++ b/tests/auto/wayland/client.pro @@ -4,5 +4,8 @@ SUBDIRS += \ client \ fullscreenshellv1 \ iviapplication \ - xdgshellv6 \ - wl_connect + seatv4 \ + surface \ + wl_connect \ + xdgshell \ + xdgshellv6 diff --git a/tests/auto/wayland/client/client.pro b/tests/auto/wayland/client/client.pro index f4ced252c2a..7c3a934d067 100644 --- a/tests/auto/wayland/client/client.pro +++ b/tests/auto/wayland/client/client.pro @@ -1,4 +1,4 @@ -include (../shared/shared.pri) +include (../shared_old/shared_old.pri) TARGET = tst_client SOURCES += tst_client.cpp diff --git a/tests/auto/wayland/fullscreenshellv1/fullscreenshellv1.pro b/tests/auto/wayland/fullscreenshellv1/fullscreenshellv1.pro index 8ce6dfe5c0f..49d19d5c30d 100644 --- a/tests/auto/wayland/fullscreenshellv1/fullscreenshellv1.pro +++ b/tests/auto/wayland/fullscreenshellv1/fullscreenshellv1.pro @@ -1,4 +1,4 @@ -include (../shared/shared.pri) +include (../shared_old/shared_old.pri) TARGET = tst_client_fullscreenshell1 SOURCES += tst_fullscreenshellv1.cpp diff --git a/tests/auto/wayland/iviapplication/iviapplication.pro b/tests/auto/wayland/iviapplication/iviapplication.pro index 32692137347..f2d596e6c93 100644 --- a/tests/auto/wayland/iviapplication/iviapplication.pro +++ b/tests/auto/wayland/iviapplication/iviapplication.pro @@ -1,4 +1,4 @@ -include (../shared/shared.pri) +include (../shared_old/shared_old.pri) TARGET = tst_client_iviapplication SOURCES += tst_iviapplication.cpp diff --git a/tests/auto/wayland/seatv4/seatv4.pro b/tests/auto/wayland/seatv4/seatv4.pro new file mode 100644 index 00000000000..c02db58559c --- /dev/null +++ b/tests/auto/wayland/seatv4/seatv4.pro @@ -0,0 +1,4 @@ +include (../shared/shared.pri) + +TARGET = tst_seatv4 +SOURCES += tst_seatv4.cpp diff --git a/tests/auto/wayland/seatv4/tst_seatv4.cpp b/tests/auto/wayland/seatv4/tst_seatv4.cpp new file mode 100644 index 00000000000..a95dbfcc2d4 --- /dev/null +++ b/tests/auto/wayland/seatv4/tst_seatv4.cpp @@ -0,0 +1,266 @@ +/**************************************************************************** +** +** Copyright (C) 2018 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "mockcompositor.h" + +#include +#include + +using namespace MockCompositor; + +// wl_seat version 5 was introduced in wayland 1.10, and although that's pretty old, +// there are still compositors that have yet to update their implementation to support +// the new version (most importantly our own QtWaylandCompositor). +// As long as that's the case, this test makes sure input events still works on version 4. +class SeatV4Compositor : public DefaultCompositor { +public: + explicit SeatV4Compositor() + { + exec([this] { + m_config.autoConfigure = true; + + removeAll(); + + uint capabilities = MockCompositor::Seat::capability_pointer; + int version = 4; + add(capabilities, version); + }); + } +}; + +class tst_seatv4 : public QObject, private SeatV4Compositor +{ + Q_OBJECT +private slots: + void cleanup(); + void bindsToSeat(); + void createsPointer(); + void setsCursorOnEnter(); + void usesEnterSerial(); + void simpleAxis_data(); + void simpleAxis(); + void invalidPointerEvents(); + void scaledCursor(); +}; + +void tst_seatv4::cleanup() +{ + QTRY_VERIFY2(isClean(), qPrintable(dirtyMessage())); + QCOMPOSITOR_COMPARE(getAll().size(), 1); // No extra outputs left +} + +void tst_seatv4::bindsToSeat() +{ + QCOMPOSITOR_COMPARE(get()->resourceMap().size(), 1); + QCOMPOSITOR_COMPARE(get()->resourceMap().first()->version(), 4); +} + +void tst_seatv4::createsPointer() +{ + QCOMPOSITOR_TRY_COMPARE(pointer()->resourceMap().size(), 1); + QCOMPOSITOR_TRY_COMPARE(pointer()->resourceMap().first()->version(), 4); +} + +void tst_seatv4::setsCursorOnEnter() +{ + QRasterWindow window; + window.resize(64, 64); + window.show(); + QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial); + + exec([=] { pointer()->sendEnter(xdgSurface()->m_surface, {32, 32}); }); + QCOMPOSITOR_TRY_VERIFY(pointer()->cursorSurface()); +} + +void tst_seatv4::usesEnterSerial() +{ + QSignalSpy setCursorSpy(exec([=] { return pointer(); }), &Pointer::setCursor); + QRasterWindow window; + window.resize(64, 64); + window.show(); + QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial); + + uint enterSerial = exec([=] { + return pointer()->sendEnter(xdgSurface()->m_surface, {32, 32}); + }); + QCOMPOSITOR_TRY_VERIFY(pointer()->cursorSurface()); + + QTRY_COMPARE(setCursorSpy.count(), 1); + QCOMPARE(setCursorSpy.takeFirst().at(0).toUInt(), enterSerial); +} + +void tst_seatv4::simpleAxis_data() +{ + QTest::addColumn("axis"); + QTest::addColumn("value"); + QTest::addColumn("orientation"); + QTest::addColumn("angleDelta"); + + // Directions in regular windows/linux terms (no "natural" scrolling) + QTest::newRow("down") << uint(Pointer::axis_vertical_scroll) << 1.0 << Qt::Vertical << QPoint{0, -12}; + QTest::newRow("up") << uint(Pointer::axis_vertical_scroll) << -1.0 << Qt::Vertical << QPoint{0, 12}; + QTest::newRow("left") << uint(Pointer::axis_horizontal_scroll) << 1.0 << Qt::Horizontal << QPoint{-12, 0}; + QTest::newRow("right") << uint(Pointer::axis_horizontal_scroll) << -1.0 << Qt::Horizontal << QPoint{12, 0}; + QTest::newRow("up big") << uint(Pointer::axis_vertical_scroll) << -10.0 << Qt::Vertical << QPoint{0, 120}; +} + +void tst_seatv4::simpleAxis() +{ + QFETCH(uint, axis); + QFETCH(qreal, value); + QFETCH(Qt::Orientation, orientation); + QFETCH(QPoint, angleDelta); + + class WheelWindow : QRasterWindow { + public: + explicit WheelWindow() + { + resize(64, 64); + show(); + } + void wheelEvent(QWheelEvent *event) override + { + QRasterWindow::wheelEvent(event); + // Angle delta should always be provided (says docs) + QVERIFY(!event->angleDelta().isNull()); + + // There are now scroll phases on Wayland prior to v5 + QCOMPARE(event->phase(), Qt::NoScrollPhase); + + // Pixel delta should only be set if we know it's a high-res input device (which we don't) + QCOMPARE(event->pixelDelta(), QPoint(0, 0)); + + // The axis vector of the event is already in surface space, so there is now way to tell + // whether it is inverted or not. + QCOMPARE(event->inverted(), false); + + // We didn't press any buttons + QCOMPARE(event->buttons(), Qt::NoButton); + + if (event->orientation() == Qt::Horizontal) + QCOMPARE(event->delta(), event->angleDelta().x()); + else + QCOMPARE(event->delta(), event->angleDelta().y()); + + // There has been no information about what created the event. + // Documentation says not synthesized is appropriate in such cases + QCOMPARE(event->source(), Qt::MouseEventNotSynthesized); + + m_events.append(Event(event->pixelDelta(), event->angleDelta(), event->orientation())); + } + struct Event // Because I didn't find a convenient way to copy it entirely + { + // TODO: Constructors can be removed when we start supporting brace-initializers + Event() = default; + Event(const QPoint &pixelDelta, const QPoint &angleDelta, Qt::Orientation orientation) + : pixelDelta(pixelDelta), angleDelta(angleDelta), orientation(orientation) + {} + const QPoint pixelDelta; + const QPoint angleDelta; // eights of a degree, positive is upwards, left + const Qt::Orientation orientation{}; + }; + QVector m_events; + }; + + WheelWindow window; + QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial); + + exec([=] { + Surface *surface = xdgSurface()->m_surface; + pointer()->sendEnter(surface, {32, 32}); + wl_client *client = surface->resource()->client(); + // Length of vector in surface-local space. i.e. positive is downwards + pointer()->sendAxis( + client, + Pointer::axis(axis), + value // Length of vector in surface-local space. i.e. positive is downwards + ); + }); + + QTRY_COMPARE(window.m_events.size(), 1); + auto event = window.m_events.takeFirst(); + QCOMPARE(event.angleDelta, angleDelta); + QCOMPARE(event.orientation, orientation); +} + +void tst_seatv4::invalidPointerEvents() +{ + QRasterWindow window; + window.resize(64, 64); + window.show(); + QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial); + + exec([=] { + auto *p = pointer(); + auto *c = client(); + // Purposefully send events without a wl_pointer.enter + p->sendMotion(c, {32, 32}); + p->sendButton(c, BTN_LEFT, Pointer::button_state_pressed); + p->sendAxis(c, Pointer::axis_vertical_scroll, 1.0); + }); + + // Make sure we get here without crashing + xdgPingAndWaitForPong(); +} + +void tst_seatv4::scaledCursor() +{ + QSKIP("Currently broken and should be fixed"); + // Add a highdpi output + exec([&] { + int scale = 2; + add(scale); + }); + + QRasterWindow window; + window.resize(64, 64); + window.show(); + QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial); + + exec([=] { pointer()->sendEnter(xdgSurface()->m_surface, {32, 32}); }); + QCOMPOSITOR_TRY_VERIFY(pointer()->cursorSurface()); + QCOMPOSITOR_TRY_VERIFY(pointer()->cursorSurface()->m_committed.buffer); + QCOMPOSITOR_TRY_COMPARE(pointer()->cursorSurface()->m_committed.bufferScale, 1); + QSize unscaledPixelSize = exec([=] { + return pointer()->cursorSurface()->m_committed.buffer->size(); + }); + + exec([=] { + auto *surface = pointer()->cursorSurface(); + surface->sendEnter(getAll()[1]); + surface->sendLeave(getAll()[0]); + }); + + QCOMPOSITOR_TRY_COMPARE(pointer()->cursorSurface()->m_committed.buffer->size(), unscaledPixelSize * 2); + + // Remove the extra output to clean up for the next test + exec([&] { remove(getAll()[1]); }); +} + +QCOMPOSITOR_TEST_MAIN(tst_seatv4) +#include "tst_seatv4.moc" diff --git a/tests/auto/wayland/shared/corecompositor.cpp b/tests/auto/wayland/shared/corecompositor.cpp new file mode 100644 index 00000000000..afa25e94c71 --- /dev/null +++ b/tests/auto/wayland/shared/corecompositor.cpp @@ -0,0 +1,140 @@ +/**************************************************************************** +** +** Copyright (C) 2018 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "corecompositor.h" + +namespace MockCompositor { + +CoreCompositor::CoreCompositor() + : m_display(wl_display_create()) + , m_socketName(wl_display_add_socket_auto(m_display)) + , m_eventLoop(wl_display_get_event_loop(m_display)) + + // Start dispatching + , m_dispatchThread([this](){ + while (m_running) { + std::this_thread::sleep_for(std::chrono::milliseconds(20)); + dispatch(); + } + }) +{ + m_timer.start(); + Q_ASSERT(isClean()); +} + +CoreCompositor::~CoreCompositor() +{ + m_running = false; + m_dispatchThread.join(); + wl_display_destroy(m_display); +} + +bool CoreCompositor::isClean() +{ + Lock lock(this); + for (auto *global : qAsConst(m_globals)) { + if (!global->isClean()) + return false; + } + return true; +} + +QString CoreCompositor::dirtyMessage() +{ + Lock lock(this); + QStringList messages; + for (auto *global : qAsConst(m_globals)) { + if (!global->isClean()) + messages << (global->metaObject()->className() % QLatin1String(": ") % global->dirtyMessage()); + } + return messages.join(", "); +} + +void CoreCompositor::dispatch() +{ + Lock lock(this); + wl_display_flush_clients(m_display); + constexpr int timeout = 0; // immediate return + wl_event_loop_dispatch(m_eventLoop, timeout); +} + +/*! + * \brief Adds a new global interface for the compositor + * + * Takes ownership of \a global + */ +void CoreCompositor::add(Global *global) +{ + warnIfNotLockedByThread(Q_FUNC_INFO); + m_globals.append(global); +} + +void CoreCompositor::remove(Global *global) +{ + warnIfNotLockedByThread(Q_FUNC_INFO); + //TODO: Need to delete global as well! + m_globals.removeAll(global); +} + +uint CoreCompositor::nextSerial() +{ + warnIfNotLockedByThread(Q_FUNC_INFO); + return wl_display_next_serial(m_display); +} + +uint CoreCompositor::currentTimeMilliseconds() +{ + warnIfNotLockedByThread(Q_FUNC_INFO); + return uint(m_timer.elapsed()); +} + +wl_client *CoreCompositor::client(int index) +{ + warnIfNotLockedByThread(Q_FUNC_INFO); + wl_list *clients = wl_display_get_client_list(m_display); + wl_client *client = nullptr; + int i = 0; + wl_client_for_each(client, clients) { + if (i++ == index) + return client; + } + return nullptr; +} + +void CoreCompositor::warnIfNotLockedByThread(const char *caller) +{ + if (!m_lock || !m_lock->isOwnedByCurrentThread()) { + qWarning() << caller << "called without locking the compositor to the current thread." + << "This means the compositor can start dispatching at any moment," + << "potentially leading to threading issues." + << "Unless you know what you are doing you should probably fix the test" + << "by locking the compositor before accessing it (see mutex())."; + } +} + +} // namespace MockCompositor diff --git a/tests/auto/wayland/shared/corecompositor.h b/tests/auto/wayland/shared/corecompositor.h new file mode 100644 index 00000000000..875b7d050ac --- /dev/null +++ b/tests/auto/wayland/shared/corecompositor.h @@ -0,0 +1,209 @@ +/**************************************************************************** +** +** Copyright (C) 2018 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef MOCKCOMPOSITOR_CORECOMPOSITOR_H +#define MOCKCOMPOSITOR_CORECOMPOSITOR_H + +#include + +#include + +struct wl_resource; + +namespace MockCompositor { + +class Global : public QObject +{ + Q_OBJECT +public: + virtual bool isClean() { return true; } + virtual QString dirtyMessage() { return isClean() ? "clean" : "dirty"; } +}; + +class CoreCompositor +{ +public: + explicit CoreCompositor(); + ~CoreCompositor(); + bool isClean(); + QString dirtyMessage(); + void dispatch(); + + template + auto exec(function_type func, arg_types&&... args) -> decltype(func()) + { + Lock lock(this); + return func(std::forward(args)...); + } + + template + auto call(function_type func, arg_types&&... args) -> decltype(func()) + { + Lock lock(this); + auto boundFunc = std::bind(func, this); + return boundFunc(this, std::forward(args)...); + } + + // Unsafe section below, YOU are responsible that the compositor is locked or + // this is run through the mutex() method! + + void add(Global *global); + void remove(Global *global); + + /*! + * \brief Constructs and adds a new global with the given parameters + * + * Convenience function. i.e. + * + * compositor->add(new MyGlobal(compositor, version); + * + * can be written as: + * + * compositor->add(version); + * + * Returns the new global + */ + template + global_type *add(arg_types&&... args) + { + warnIfNotLockedByThread(Q_FUNC_INFO); + auto *global = new global_type(this, std::forward(args)...); + m_globals.append(global); + return global; + } + + /*! + * \brief Removes all globals of the given type + * + * Convenience function + */ + template + void removeAll() + { + const auto globals = getAll(); + for (auto global : globals) + remove(global); + } + + /*! + * \brief Returns a global with the given type, if any + */ + template + global_type *get() + { + warnIfNotLockedByThread(Q_FUNC_INFO); + for (auto *global : qAsConst(m_globals)) { + if (auto *casted = qobject_cast(global)) + return casted; + } + return nullptr; + } + + /*! + * \brief Returns all globals with the given type, if any + */ + template + QVector getAll() + { + warnIfNotLockedByThread(Q_FUNC_INFO); + QVector matching; + for (auto *global : qAsConst(m_globals)) { + if (auto *casted = qobject_cast(global)) + matching.append(casted); + } + return matching; + } + + uint nextSerial(); + uint currentTimeMilliseconds(); + wl_client *client(int index = 0); + void warnIfNotLockedByThread(const char* caller = "warnIfNotLockedbyThread"); + +public: + // Only use this carefully from the test thread (i.e. lock first) + wl_display *m_display = nullptr; +protected: + class Lock { + public: + explicit Lock(CoreCompositor *compositor) + : m_compositor(compositor) + , m_threadId(std::this_thread::get_id()) + { + // Can't use a QMutexLocker here, as it's not movable + compositor->m_mutex.lock(); + Q_ASSERT(compositor->m_lock == nullptr); + compositor->m_lock = this; + } + ~Lock() + { + Q_ASSERT(m_compositor->m_lock == this); + m_compositor->m_lock = nullptr; + m_compositor->m_mutex.unlock(); + } + + // Move semantics + Lock(Lock &&) = default; + Lock &operator=(Lock &&) = default; + + // Disable copying + Lock(const Lock &) = delete; + Lock &operator=(const Lock &) = delete; + + bool isOwnedByCurrentThread() const { return m_threadId == std::this_thread::get_id(); } + private: + CoreCompositor *m_compositor = nullptr; + std::thread::id m_threadId; + }; + QByteArray m_socketName; + wl_event_loop *m_eventLoop = nullptr; + bool m_running = true; + QVector m_globals; + QElapsedTimer m_timer; + +private: + Lock *m_lock = nullptr; + QMutex m_mutex; + std::thread m_dispatchThread; +}; + +template +QByteArray toByteArray(container_type container) +{ + return QByteArray(reinterpret_cast(container.data()), sizeof (container[0]) * container.size()); +} + +template +return_type *fromResource(::wl_resource *resource) { + if (auto *r = return_type::Resource::fromResource(resource)) + return static_cast(r->object()); + return nullptr; +} + +} // namespace MockCompositor + +#endif // MOCKCOMPOSITOR_CORECOMPOSITOR_H diff --git a/tests/auto/wayland/shared/coreprotocol.cpp b/tests/auto/wayland/shared/coreprotocol.cpp new file mode 100644 index 00000000000..46d46d980a6 --- /dev/null +++ b/tests/auto/wayland/shared/coreprotocol.cpp @@ -0,0 +1,322 @@ +/**************************************************************************** +** +** Copyright (C) 2018 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "coreprotocol.h" + +namespace MockCompositor { + +void Surface::sendFrameCallbacks() +{ + uint time = m_wlCompositor->m_compositor->currentTimeMilliseconds(); + for (auto *callback : m_waitingFrameCallbacks) + callback->sendDone(time); + m_waitingFrameCallbacks.clear(); +} + +void Surface::sendEnter(Output *output) +{ + m_outputs.append(output); + const auto outputResources = output->resourceMap().values(resource()->client()); + for (auto outputResource: outputResources) + wl_surface::send_enter(resource()->handle, outputResource->handle); +} + +void Surface::sendLeave(Output *output) +{ + m_outputs.removeOne(output); + const auto outputResources = output->resourceMap().values(resource()->client()); + for (auto outputResource: outputResources) + wl_surface::send_leave(resource()->handle, outputResource->handle); +} + +void Surface::surface_destroy_resource(Resource *resource) +{ + Q_UNUSED(resource); + for (auto *commit : m_commits) + delete commit->commitSpecific.frame; + bool removed = m_wlCompositor->m_surfaces.removeOne(this); + Q_ASSERT(removed); + delete this; +} + +void Surface::surface_attach(Resource *resource, wl_resource *buffer, int32_t x, int32_t y) +{ + Q_UNUSED(resource); + QPoint offset(x, y); + m_pending.buffer = fromResource(buffer); + m_pending.commitSpecific.attachOffset = offset; + m_pending.commitSpecific.attached = true; + emit attach(buffer, offset); +} + +void Surface::surface_set_buffer_scale(QtWaylandServer::wl_surface::Resource *resource, int32_t scale) +{ + Q_UNUSED(resource); + m_pending.bufferScale = scale; +} + +void Surface::surface_commit(Resource *resource) +{ + Q_UNUSED(resource); + m_committed = m_pending; + m_commits.append(new DoubleBufferedState(m_committed)); + + if (auto *frame = m_pending.commitSpecific.frame) + m_waitingFrameCallbacks.append(frame); + + m_pending.commitSpecific = PerCommitData(); + emit commit(); + if (m_committed.commitSpecific.attached) + emit bufferCommitted(); +} + +void Surface::surface_frame(Resource *resource, uint32_t callback) +{ + // Although valid, there is really no point having multiple frame requests in the same commit. + // Make sure we don't do it + QCOMPARE(m_pending.commitSpecific.frame, nullptr); + + auto *frame = new Callback(resource->client(), callback, 1); + m_pending.commitSpecific.frame = frame; +} + +bool WlCompositor::isClean() { + for (auto *surface : qAsConst(m_surfaces)) { + if (!CursorRole::fromSurface(surface)) + return false; + } + return true; +} + +QString WlCompositor::dirtyMessage() +{ + if (isClean()) + return "clean"; + QStringList messages; + for (auto *s : qAsConst(m_surfaces)) { + QString role = s->m_role ? s->m_role->staticMetaObject.className(): "none/unknown"; + messages << "Surface with role: " + role; + } + return "Dirty, surfaces left:\n\t" + messages.join("\n\t"); +} + +void Output::sendScale(int factor) +{ + Q_ASSERT(m_version >= WL_OUTPUT_SCALE_SINCE_VERSION); + m_scale = factor; + const auto resources = resourceMap().values(); + for (auto r: resources) + wl_output::send_scale(r->handle, factor); +} + +void Output::sendDone() +{ + Q_ASSERT(m_version >= WL_OUTPUT_DONE_SINCE_VERSION); + const auto resources = resourceMap().values(); + for (auto r: resources) + wl_output::send_done(r->handle); +} + +void Output::output_bind_resource(QtWaylandServer::wl_output::Resource *resource) +{ + if (m_version >= WL_OUTPUT_SCALE_SINCE_VERSION) + wl_output::send_scale(resource->handle, m_scale); + //TODO: send other required stuff as well + if (m_version >= WL_OUTPUT_DONE_SINCE_VERSION) + wl_output::send_done(resource->handle); +} + +// Seat stuff +Seat::Seat(CoreCompositor *compositor, uint capabilities, int version) //TODO: check version + : QtWaylandServer::wl_seat(compositor->m_display, version) + , m_compositor(compositor) +{ + setCapabilities(capabilities); +} + +Seat::~Seat() +{ + qDeleteAll(m_oldPointers); + delete m_pointer; +} + +void Seat::setCapabilities(uint capabilities) { + // TODO: Add support for touch and keyboard + Q_ASSERT(capabilities == 0 || capabilities == capability_pointer); + + m_capabilities = capabilities; + + if (m_capabilities & capability_pointer) { + if (!m_pointer) + m_pointer = (new Pointer(this)); + } else if (m_pointer) { + m_oldPointers << m_pointer; + m_pointer = nullptr; + } + + for (auto *resource : resourceMap()) + wl_seat::send_capabilities(resource->handle, capabilities); +} + +void Seat::seat_get_pointer(Resource *resource, uint32_t id) +{ + if (~m_capabilities & capability_pointer) { + qWarning() << "Client requested a wl_pointer without the capability being available." + << "This Could be a race condition when hotunplugging," + << "but is most likely a client error"; + Pointer *pointer = new Pointer(this); + pointer->add(resource->client(), id, resource->version()); + // TODO: mark as destroyed + m_oldPointers << pointer; + return; + } + m_pointer->add(resource->client(), id, resource->version()); +} + +Surface *Pointer::cursorSurface() +{ + return m_cursorRole ? m_cursorRole->m_surface : nullptr; +} + +uint Pointer::sendEnter(Surface *surface, const QPointF &position) +{ + wl_fixed_t x = wl_fixed_from_double(position.x()); + wl_fixed_t y = wl_fixed_from_double(position.y()); + m_enterSerial = m_seat->m_compositor->nextSerial(); + + wl_client *client = surface->resource()->client(); + const auto pointerResources = resourceMap().values(client); + for (auto *r : pointerResources) + send_enter(r->handle, m_enterSerial, surface->resource()->handle, x ,y); + return m_enterSerial; +} + +// Make sure you call enter, frame etc. first +void Pointer::sendMotion(wl_client *client, const QPointF &position) +{ + wl_fixed_t x = wl_fixed_from_double(position.x()); + wl_fixed_t y = wl_fixed_from_double(position.y()); + auto time = m_seat->m_compositor->currentTimeMilliseconds(); + const auto pointerResources = resourceMap().values(client); + for (auto *r : pointerResources) + send_motion(r->handle, time, x, y); +} + +// Make sure you call enter, frame etc. first +uint Pointer::sendButton(wl_client *client, uint button, uint state) +{ + Q_ASSERT(state == button_state_pressed || state == button_state_released); + auto time = m_seat->m_compositor->currentTimeMilliseconds(); + uint serial = m_seat->m_compositor->nextSerial(); + const auto pointerResources = resourceMap().values(client); + for (auto *r : pointerResources) + send_button(r->handle, serial, time, button, state); + return serial; +} + +// Make sure you call enter, frame etc. first +void Pointer::sendAxis(wl_client *client, axis axis, qreal value) +{ + auto time = m_seat->m_compositor->currentTimeMilliseconds(); + wl_fixed_t val = wl_fixed_from_double(value); + const auto pointerResources = resourceMap().values(client); + for (auto *r : pointerResources) + send_axis(r->handle, time, axis, val); +} + +void Pointer::pointer_set_cursor(Resource *resource, uint32_t serial, wl_resource *surface, int32_t hotspot_x, int32_t hotspot_y) +{ + Q_UNUSED(resource); + Q_UNUSED(hotspot_x); + Q_UNUSED(hotspot_y); + auto *s = fromResource(surface); + QVERIFY(s); + + if (s->m_role) { + auto *cursorRole = CursorRole::fromSurface(s); + QVERIFY(cursorRole); + QVERIFY(cursorRole == m_cursorRole); + } else { + m_cursorRole = new CursorRole(s); //TODO: make sure we don't leak CursorRole + s->m_role = m_cursorRole; + } +// QCOMPARE(serial, m_enterSerial); //TODO: uncomment when this bug is fixed + emit setCursor(serial); +} + +// Shm implementation +Shm::Shm(CoreCompositor *compositor, QVector formats, int version) + : QtWaylandServer::wl_shm(compositor->m_display, version) + , m_compositor(compositor) + , m_formats(formats) +{ + // Some formats are specified as mandatory + Q_ASSERT(m_formats.contains(format_argb8888)); + Q_ASSERT(m_formats.contains(format_xrgb8888)); +} + +bool Shm::isClean() +{ +// for (ShmPool *pool : qAsConst(m_pools)) { +// //TODO: return false if not cursor buffer +// if (pool->m_buffers.isEmpty()) { +// return false; +// } +// } + return true; +} + +void Shm::shm_create_pool(Resource *resource, uint32_t id, int32_t fd, int32_t size) +{ + Q_UNUSED(fd); + Q_UNUSED(size); + auto *pool = new ShmPool(this, resource->client(), id, 1); + m_pools.append(pool); +} + +ShmPool::ShmPool(Shm *shm, wl_client *client, int id, int version) + : QtWaylandServer::wl_shm_pool(client, id, version) + , m_shm(shm) +{ +} + +void ShmPool::shm_pool_create_buffer(Resource *resource, uint32_t id, int32_t offset, int32_t width, int32_t height, int32_t stride, uint32_t format) +{ + QSize size(width, height); + new ShmBuffer(offset, size, stride, Shm::format(format), resource->client(), id); +} + +void ShmPool::shm_pool_destroy_resource(Resource *resource) +{ + Q_UNUSED(resource); + bool removed = m_shm->m_pools.removeOne(this); + Q_ASSERT(removed); + delete this; +} + +} // namespace MockCompositor diff --git a/tests/auto/wayland/shared/coreprotocol.h b/tests/auto/wayland/shared/coreprotocol.h new file mode 100644 index 00000000000..2fbe9b139e8 --- /dev/null +++ b/tests/auto/wayland/shared/coreprotocol.h @@ -0,0 +1,313 @@ +/**************************************************************************** +** +** Copyright (C) 2018 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef MOCKCOMPOSITOR_COREPROTOCOL_H +#define MOCKCOMPOSITOR_COREPROTOCOL_H + +#include "corecompositor.h" + +#include + +namespace MockCompositor { + +class WlCompositor; +class Output; +class Pointer; +class CursorRole; +class ShmPool; +class ShmBuffer; + +class Buffer : public QObject, public QtWaylandServer::wl_buffer +{ + Q_OBJECT +public: + explicit Buffer(wl_client *client, int id, int version) + : QtWaylandServer::wl_buffer(client, id, version) + { + } + virtual QSize size() const = 0; + bool m_destroyed = false; + +protected: + void buffer_destroy_resource(Resource *resource) override + { + Q_UNUSED(resource); + m_destroyed = true; + // The client side resource has been destroyed, but we keep this object because it may be + // be used as a reference by e.g. surface for the currently committed buffer so it's not + // yet safe to free it. + + //TODO: The memory should be freed by its factory + } + void buffer_destroy(Resource *resource) override { wl_resource_destroy(resource->handle); } +}; + +class Callback : public QObject, public QtWaylandServer::wl_callback +{ + Q_OBJECT +public: + explicit Callback(wl_client *client, int id, int version = 1) + : QtWaylandServer::wl_callback(client, id, version) + { + } + ~Callback() override { if (!m_destroyed) wl_resource_destroy(resource()->handle); } + void send_done(uint32_t data) = delete; // use state-tracking method below instead + void sendDone(uint data) { Q_ASSERT(!m_done); QtWaylandServer::wl_callback::send_done(data); m_done = true; } + void sendDoneAndDestroy(uint data) { sendDone(data); wl_resource_destroy(resource()->handle); } + bool m_done = false; + bool m_destroyed = false; +protected: + void callback_destroy_resource(Resource *resource) override { Q_UNUSED(resource); m_destroyed = true; } +}; + +class SurfaceRole : public QObject { + Q_OBJECT +}; + +class Surface : public QObject, public QtWaylandServer::wl_surface +{ + Q_OBJECT +public: + explicit Surface(WlCompositor *wlCompositor, wl_client *client, int id, int version) + : QtWaylandServer::wl_surface(client, id, version) + , m_wlCompositor(wlCompositor) + { + } + ~Surface() override { qDeleteAll(m_commits); } // TODO: maybe make sure buffers are released? + void sendFrameCallbacks(); + void sendEnter(Output *output); + void send_enter(::wl_resource *output) = delete; + void sendLeave(Output *output); + void send_leave(::wl_resource *output) = delete; + + WlCompositor *m_wlCompositor; + struct PerCommitData { + Callback *frame = nullptr; + QPoint attachOffset; + bool attached = false; + }; + struct DoubleBufferedState { + PerCommitData commitSpecific; + Buffer *buffer = nullptr; + uint configureSerial = 0; + int bufferScale = 1; + } m_pending, m_committed; + QVector m_commits; + QVector m_waitingFrameCallbacks; + QVector m_outputs; + SurfaceRole *m_role = nullptr; + +signals: + void attach(void *buffer, QPoint offset); + void commit(); + void bufferCommitted(); + +protected: + void surface_destroy_resource(Resource *resource) override; + void surface_destroy(Resource *resource) override { wl_resource_destroy(resource->handle); } + void surface_attach(Resource *resource, wl_resource *buffer, int32_t x, int32_t y) override; + void surface_set_buffer_scale(Resource *resource, int32_t scale) override; + void surface_commit(Resource *resource) override; + void surface_frame(Resource *resource, uint32_t callback) override; +}; + +class WlCompositor : public Global, public QtWaylandServer::wl_compositor +{ + Q_OBJECT +public: + explicit WlCompositor(CoreCompositor *compositor, int version = 3) + : QtWaylandServer::wl_compositor(compositor->m_display, version) + , m_compositor(compositor) + {} + bool isClean() override; + QString dirtyMessage() override; + QVector m_surfaces; + CoreCompositor *m_compositor = nullptr; + +signals: + void surfaceCreated(Surface *surface); + +protected: + void compositor_create_surface(Resource *resource, uint32_t id) override + { + auto *surface = new Surface(this, resource->client(), id, resource->version()); + m_surfaces.append(surface); + emit surfaceCreated(surface); + } +}; + +class SubCompositor : public Global, public QtWaylandServer::wl_subcompositor +{ + Q_OBJECT +public: + explicit SubCompositor(CoreCompositor *compositor, int version = 1) + : QtWaylandServer::wl_subcompositor(compositor->m_display, version) + {} + // TODO +}; + +class Output : public Global, public QtWaylandServer::wl_output +{ + Q_OBJECT +public: + explicit Output(CoreCompositor *compositor, int scale = 1, int version = 2) + : QtWaylandServer::wl_output(compositor->m_display, version) + , m_scale(scale) + , m_version(version) + {} + void sendScale(int factor); + void send_scale(int32_t factor) = delete; + void send_scale(struct ::wl_resource *resource, int32_t factor) = delete; + void sendDone(); + int m_scale = 1; + int m_version = 1; // TODO: remove on libwayland upgrade + +protected: + void output_bind_resource(Resource *resource) override; +}; + +class Seat : public Global, public QtWaylandServer::wl_seat +{ + Q_OBJECT +public: + explicit Seat(CoreCompositor *compositor, uint capabilities, int version = 4); + ~Seat() override; + void send_capabilities(Resource *resource, uint capabilities) = delete; // Use wrapper instead + void send_capabilities(uint capabilities) = delete; // Use wrapper instead + void setCapabilities(uint capabilities); + + CoreCompositor *m_compositor = nullptr; + + Pointer* m_pointer = nullptr; + QVector m_oldPointers; + + uint m_capabilities = 0; + +protected: + void seat_bind_resource(Resource *resource) override + { + wl_seat::send_capabilities(resource->handle, m_capabilities); + } + + void seat_get_pointer(Resource *resource, uint32_t id) override; +// void seat_get_keyboard(Resource *resource, uint32_t id) override; +// void seat_get_touch(Resource *resource, uint32_t id) override; + +// void seat_release(Resource *resource) override; +}; + +class Pointer : public QObject, public QtWaylandServer::wl_pointer +{ + Q_OBJECT +public: + explicit Pointer(Seat *seat) : m_seat(seat) {} + Surface *cursorSurface(); + CursorRole* m_cursorRole = nullptr; //TODO: cleanup + uint sendEnter(Surface *surface, const QPointF &position); + void sendMotion(wl_client *client, const QPointF &position); + uint sendButton(wl_client *client, uint button, uint state); + void sendAxis(wl_client *client, axis axis, qreal value); + + Seat *m_seat = nullptr; + uint m_enterSerial = 0; + +signals: + void setCursor(uint serial); //TODO: add arguments? + +protected: + void pointer_set_cursor(Resource *resource, uint32_t serial, ::wl_resource *surface, int32_t hotspot_x, int32_t hotspot_y) override; + //TODO +}; + +class CursorRole : public SurfaceRole { + Q_OBJECT +public: + explicit CursorRole(Surface *surface) // TODO: needs some more args + : m_surface(surface) + { + } + static CursorRole *fromSurface(Surface *surface) { return qobject_cast(surface->m_role); } + Surface *m_surface = nullptr; +}; + +class Shm : public Global, public QtWaylandServer::wl_shm +{ + Q_OBJECT +public: + explicit Shm(CoreCompositor *compositor, QVector formats = {format_argb8888, format_xrgb8888, format_rgb888}, int version = 1); + bool isClean() override; + CoreCompositor *m_compositor = nullptr; + QVector m_pools; + const QVector m_formats; + +protected: + void shm_create_pool(Resource *resource, uint32_t id, int32_t fd, int32_t size) override; + void shm_bind_resource(Resource *resource) override + { + for (auto format : qAsConst(m_formats)) + send_format(resource->handle, format); + } +}; + +class ShmPool : QObject, public QtWaylandServer::wl_shm_pool +{ + Q_OBJECT +public: + explicit ShmPool(Shm *shm, wl_client *client, int id, int version = 1); + Shm *m_shm = nullptr; + QVector m_buffers; + +protected: + void shm_pool_create_buffer(Resource *resource, uint32_t id, int32_t offset, int32_t width, int32_t height, int32_t stride, uint32_t format) override; + void shm_pool_destroy_resource(Resource *resource) override; + void shm_pool_destroy(Resource *resource) override { wl_resource_destroy(resource->handle); } +}; + +class ShmBuffer : public Buffer +{ + Q_OBJECT +public: + static ShmBuffer *fromBuffer(Buffer *buffer) { return qobject_cast(buffer); } + explicit ShmBuffer(int offset, const QSize &size, int stride, Shm::format format, wl_client *client, int id, int version = 1) + : Buffer(client, id, version) + , m_offset(offset) + , m_size(size) + , m_stride(stride) + , m_format(format) + { + } + QSize size() const override { return m_size; } + const int m_offset; + const QSize m_size; + const int m_stride; + const Shm::format m_format; +}; + +} // namespace MockCompositor + +#endif // MOCKCOMPOSITOR_COREPROTOCOL_H diff --git a/tests/auto/wayland/shared/mockcompositor.cpp b/tests/auto/wayland/shared/mockcompositor.cpp index df24b4091b5..45d62a153c2 100644 --- a/tests/auto/wayland/shared/mockcompositor.cpp +++ b/tests/auto/wayland/shared/mockcompositor.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2018 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the test suite of the Qt Toolkit. @@ -27,494 +27,64 @@ ****************************************************************************/ #include "mockcompositor.h" -#include "mockinput.h" -#include "mockoutput.h" -#include "mocksurface.h" -#include "mockwlshell.h" -#include "mockxdgshellv6.h" -#include "mockiviapplication.h" -#include +namespace MockCompositor { -#include -MockCompositor::MockCompositor() +DefaultCompositor::DefaultCompositor() { - pthread_create(&m_thread, 0, run, this); + { + Lock l(this); - m_mutex.lock(); - m_waitCondition.wait(&m_mutex); - m_mutex.unlock(); -} + // Globals: Should ideally always be at least the latest versions we support. + // Legacy versions can override in separate tests by removing and adding. + add(); + add(); + add(); + add(Seat::capability_pointer); + add(); + add(); + // TODO: other shells, viewporter, xdgoutput etc -MockCompositor::~MockCompositor() -{ - m_alive = false; - m_waitCondition.wakeOne(); - pthread_join(m_thread, 0); -} + QObject::connect(get(), &WlCompositor::surfaceCreated, [&] (Surface *surface){ + QObject::connect(surface, &Surface::bufferCommitted, [=] { + if (m_config.autoRelease) { + // Pretend we made a copy of the buffer and just release it immediately + surface->m_committed.buffer->send_release(); + } + if (m_config.autoEnter && surface->m_outputs.empty()) + surface->sendEnter(get()); + wl_display_flush_clients(m_display); + }); + }); -void MockCompositor::lock() -{ - m_mutex.lock(); -} - -void MockCompositor::unlock() -{ - m_mutex.unlock(); -} - -void MockCompositor::applicationInitialized() -{ - m_ready = true; -} - -int MockCompositor::waylandFileDescriptor() const -{ - return m_compositor->fileDescriptor(); -} - -void MockCompositor::processWaylandEvents() -{ - m_waitCondition.wakeOne(); -} - -void MockCompositor::setOutputMode(const QSize &size) -{ - Command command = makeCommand(Impl::Compositor::setOutputMode, m_compositor); - command.parameters << size; - processCommand(command); -} - -void MockCompositor::setKeyboardFocus(const QSharedPointer &surface) -{ - Command command = makeCommand(Impl::Compositor::setKeyboardFocus, m_compositor); - command.parameters << QVariant::fromValue(surface); - processCommand(command); -} - -void MockCompositor::sendMousePress(const QSharedPointer &surface, const QPoint &pos) -{ - Command command = makeCommand(Impl::Compositor::sendMousePress, m_compositor); - command.parameters << QVariant::fromValue(surface) << pos; - processCommand(command); -} - -void MockCompositor::sendMouseRelease(const QSharedPointer &surface) -{ - Command command = makeCommand(Impl::Compositor::sendMouseRelease, m_compositor); - command.parameters << QVariant::fromValue(surface); - processCommand(command); -} - -void MockCompositor::sendKeyPress(const QSharedPointer &surface, uint code) -{ - Command command = makeCommand(Impl::Compositor::sendKeyPress, m_compositor); - command.parameters << QVariant::fromValue(surface) << code; - processCommand(command); -} - -void MockCompositor::sendKeyRelease(const QSharedPointer &surface, uint code) -{ - Command command = makeCommand(Impl::Compositor::sendKeyRelease, m_compositor); - command.parameters << QVariant::fromValue(surface) << code; - processCommand(command); -} - -void MockCompositor::sendTouchDown(const QSharedPointer &surface, const QPoint &position, int id) -{ - Command command = makeCommand(Impl::Compositor::sendTouchDown, m_compositor); - command.parameters << QVariant::fromValue(surface) << position << id; - processCommand(command); -} - -void MockCompositor::sendTouchMotion(const QSharedPointer &surface, const QPoint &position, int id) -{ - Command command = makeCommand(Impl::Compositor::sendTouchMotion, m_compositor); - command.parameters << QVariant::fromValue(surface) << position << id; - processCommand(command); -} - -void MockCompositor::sendTouchUp(const QSharedPointer &surface, int id) -{ - Command command = makeCommand(Impl::Compositor::sendTouchUp, m_compositor); - command.parameters << QVariant::fromValue(surface) << id; - processCommand(command); -} - -void MockCompositor::sendTouchFrame(const QSharedPointer &surface) -{ - Command command = makeCommand(Impl::Compositor::sendTouchFrame, m_compositor); - command.parameters << QVariant::fromValue(surface); - processCommand(command); -} - -void MockCompositor::sendDataDeviceDataOffer(const QSharedPointer &surface) -{ - Command command = makeCommand(Impl::Compositor::sendDataDeviceDataOffer, m_compositor); - command.parameters << QVariant::fromValue(surface); - processCommand(command); -} - -void MockCompositor::sendDataDeviceEnter(const QSharedPointer &surface, const QPoint& position) -{ - Command command = makeCommand(Impl::Compositor::sendDataDeviceEnter, m_compositor); - command.parameters << QVariant::fromValue(surface) << QVariant::fromValue(position); - processCommand(command); -} - -void MockCompositor::sendDataDeviceMotion(const QPoint &position) -{ - Command command = makeCommand(Impl::Compositor::sendDataDeviceMotion, m_compositor); - command.parameters << QVariant::fromValue(position); - processCommand(command); -} - -void MockCompositor::sendDataDeviceDrop(const QSharedPointer &surface) -{ - Command command = makeCommand(Impl::Compositor::sendDataDeviceDrop, m_compositor); - command.parameters << QVariant::fromValue(surface); - processCommand(command); -} - -void MockCompositor::sendDataDeviceLeave(const QSharedPointer &surface) -{ - Command command = makeCommand(Impl::Compositor::sendDataDeviceLeave, m_compositor); - command.parameters << QVariant::fromValue(surface); - processCommand(command); -} - -void MockCompositor::sendAddOutput() -{ - Command command = makeCommand(Impl::Compositor::sendAddOutput, m_compositor); - processCommand(command); -} - -void MockCompositor::sendRemoveOutput(const QSharedPointer &output) -{ - Command command = makeCommand(Impl::Compositor::sendRemoveOutput, m_compositor); - command.parameters << QVariant::fromValue(output); - processCommand(command); -} - -void MockCompositor::sendOutputGeometry(const QSharedPointer &output, const QRect &geometry) -{ - Command command = makeCommand(Impl::Compositor::sendOutputGeometry, m_compositor); - command.parameters << QVariant::fromValue(output); - command.parameters << QVariant::fromValue(geometry); - processCommand(command); -} - -void MockCompositor::sendSurfaceEnter(const QSharedPointer &surface, QSharedPointer &output) -{ - Command command = makeCommand(Impl::Compositor::sendSurfaceEnter, m_compositor); - command.parameters << QVariant::fromValue(surface); - command.parameters << QVariant::fromValue(output); - processCommand(command); -} - -void MockCompositor::sendSurfaceLeave(const QSharedPointer &surface, QSharedPointer &output) -{ - Command command = makeCommand(Impl::Compositor::sendSurfaceLeave, m_compositor); - command.parameters << QVariant::fromValue(surface); - command.parameters << QVariant::fromValue(output); - processCommand(command); -} - -void MockCompositor::sendShellSurfaceConfigure(const QSharedPointer surface, const QSize &size) -{ - Command command = makeCommand(Impl::Compositor::sendShellSurfaceConfigure, m_compositor); - command.parameters << QVariant::fromValue(surface); - command.parameters << QVariant::fromValue(size); - processCommand(command); -} - -void MockCompositor::sendIviSurfaceConfigure(const QSharedPointer iviSurface, const QSize &size) -{ - Command command = makeCommand(Impl::Compositor::sendIviSurfaceConfigure, m_compositor); - command.parameters << QVariant::fromValue(iviSurface); - command.parameters << QVariant::fromValue(size); - processCommand(command); -} - -void MockCompositor::sendXdgToplevelV6Configure(const QSharedPointer toplevel, const QSize &size, const QVector &states) -{ - Command command = makeCommand(Impl::Compositor::sendXdgToplevelV6Configure, m_compositor); - command.parameters << QVariant::fromValue(toplevel); - command.parameters << QVariant::fromValue(size); - QByteArray statesBytes(reinterpret_cast(states.data()), - states.size() * static_cast(sizeof(uint))); - command.parameters << statesBytes; - processCommand(command); -} - -void MockCompositor::waitForStartDrag() -{ - Command command = makeCommand(Impl::Compositor::waitForStartDrag, m_compositor); - processCommand(command); -} - -QSharedPointer MockCompositor::surface() -{ - QSharedPointer result; - lock(); - QVector surfaces = m_compositor->surfaces(); - foreach (Impl::Surface *surface, surfaces) { - // we don't want to mistake the cursor surface for a window surface - if (surface->isMapped()) { - result = surface->mockSurface(); - break; - } + QObject::connect(get(), &XdgWmBase::toplevelCreated, [&] (XdgToplevel *toplevel) { + // Needed because lambdas don't support Qt::DirectConnection + exec([&]{ + if (m_config.autoConfigure) + toplevel->sendCompleteConfigure(); + }); + }); } - unlock(); - return result; + Q_ASSERT(isClean()); } -QSharedPointer MockCompositor::output(int index) +uint DefaultCompositor::sendXdgShellPing() { - QSharedPointer result; - lock(); - if (Impl::Output *output = m_compositor->outputs().value(index, nullptr)) - result = output->mockOutput(); - unlock(); - return result; + warnIfNotLockedByThread(Q_FUNC_INFO); + uint serial = nextSerial(); + auto *base = get(); + const auto resourceMap = base->resourceMap(); + Q_ASSERT(resourceMap.size() == 1); // binding more than once shouldn't be needed + base->send_ping(resourceMap.first()->handle, serial); + return serial; } -QSharedPointer MockCompositor::iviSurface(int index) +void DefaultCompositor::xdgPingAndWaitForPong() { - QSharedPointer result; - lock(); - if (Impl::IviSurface *toplevel = m_compositor->iviApplication()->iviSurfaces().value(index, nullptr)) - result = toplevel->mockIviSurface(); - unlock(); - return result; + QSignalSpy pongSpy(exec([=] { return get(); }), &XdgWmBase::pong); + uint serial = exec([=] { return sendXdgShellPing(); }); + QTRY_COMPARE(pongSpy.count(), 1); + QTRY_COMPARE(pongSpy.first().at(0).toUInt(), serial); } -QSharedPointer MockCompositor::xdgToplevelV6(int index) -{ - QSharedPointer result; - lock(); - if (Impl::XdgToplevelV6 *toplevel = m_compositor->xdgShellV6()->toplevels().value(index, nullptr)) - result = toplevel->mockToplevel(); - unlock(); - return result; -} - -QSharedPointer MockCompositor::fullScreenShellV1Surface(int index) -{ - QSharedPointer result; - lock(); - if (Impl::Surface *surface = m_compositor->fullScreenShellV1()->surfaces().value(index, nullptr)) - result = surface->mockSurface(); - unlock(); - return result; -} - -MockCompositor::Command MockCompositor::makeCommand(Command::Callback callback, void *target) -{ - Command command; - command.callback = callback; - command.target = target; - return command; -} - -void MockCompositor::processCommand(const Command &command) -{ - lock(); - m_commandQueue << command; - unlock(); - - m_waitCondition.wakeOne(); -} - -void MockCompositor::dispatchCommands() -{ - lock(); - int count = m_commandQueue.length(); - unlock(); - - for (int i = 0; i < count; ++i) { - lock(); - const Command command = m_commandQueue.takeFirst(); - unlock(); - command.callback(command.target, command.parameters); - } -} - -void *MockCompositor::run(void *data) -{ - MockCompositor *controller = static_cast(data); - - Impl::Compositor compositor; - - controller->m_compositor = &compositor; - controller->m_waitCondition.wakeOne(); - - while (!controller->m_ready) { - controller->dispatchCommands(); - compositor.dispatchEvents(20); - } - - while (controller->m_alive) { - { - QMutexLocker locker(&controller->m_mutex); - if (controller->m_commandQueue.isEmpty()) - controller->m_waitCondition.wait(&controller->m_mutex); - } - controller->dispatchCommands(); - compositor.dispatchEvents(20); - } - - return 0; -} - -namespace Impl { - -Compositor::Compositor() - : m_display(wl_display_create()) -{ - if (wl_display_add_socket(m_display, 0)) { - fprintf(stderr, "Fatal: Failed to open server socket\n"); - exit(EXIT_FAILURE); - } - - wl_global_create(m_display, &wl_compositor_interface, 1, this, bindCompositor); - - m_data_device_manager.reset(new DataDeviceManager(this, m_display)); - - wl_display_init_shm(m_display); - - m_seat.reset(new Seat(this, m_display)); - m_pointer = m_seat->pointer(); - m_keyboard = m_seat->keyboard(); - m_touch = m_seat->touch(); - - m_outputs.append(new Output(m_display, QSize(1920, 1080), QPoint(0, 0))); - m_iviApplication.reset(new IviApplication(m_display)); - m_wlShell.reset(new WlShell(m_display)); - m_xdgShellV6.reset(new XdgShellV6(m_display)); - m_fullScreenShellV1.reset(new FullScreenShellV1(m_display)); - - m_loop = wl_display_get_event_loop(m_display); - m_fd = wl_event_loop_get_fd(m_loop); -} - -Compositor::~Compositor() -{ - wl_display_destroy(m_display); -} - -void Compositor::dispatchEvents(int timeout) -{ - wl_display_flush_clients(m_display); - wl_event_loop_dispatch(m_loop, timeout); -} - -static void compositor_create_surface(wl_client *client, wl_resource *compositorResource, uint32_t id) -{ - Compositor *compositor = static_cast(wl_resource_get_user_data(compositorResource)); - compositor->addSurface(new Surface(client, id, wl_resource_get_version(compositorResource), compositor)); -} - -static void compositor_create_region(wl_client *client, wl_resource *compositorResource, uint32_t id) -{ - Q_UNUSED(client); - Q_UNUSED(compositorResource); - Q_UNUSED(id); -} - -void Compositor::bindCompositor(wl_client *client, void *compositorData, uint32_t version, uint32_t id) -{ - static const struct wl_compositor_interface compositorInterface = { - compositor_create_surface, - compositor_create_region - }; - - wl_resource *resource = wl_resource_create(client, &wl_compositor_interface, static_cast(version), id); - wl_resource_set_implementation(resource, &compositorInterface, compositorData, nullptr); -} - -static void unregisterResourceCallback(wl_listener *listener, void *data) -{ - struct wl_resource *resource = reinterpret_cast(data); - wl_list_remove(wl_resource_get_link(resource)); - delete listener; -} - -void registerResource(wl_list *list, wl_resource *resource) -{ - wl_list_insert(list, wl_resource_get_link(resource)); - - wl_listener *listener = new wl_listener; - listener->notify = unregisterResourceCallback; - - wl_resource_add_destroy_listener(resource, listener); -} - -QVector Compositor::surfaces() const -{ - return m_surfaces; -} - -QVector Compositor::outputs() const -{ - return m_outputs; -} - -IviApplication *Compositor::iviApplication() const -{ - return m_iviApplication.data(); -} - -XdgShellV6 *Compositor::xdgShellV6() const -{ - return m_xdgShellV6.data(); -} - -FullScreenShellV1 *Compositor::fullScreenShellV1() const -{ - return m_fullScreenShellV1.data(); -} - -uint32_t Compositor::nextSerial() -{ - return wl_display_next_serial(m_display); -} - -void Compositor::addSurface(Surface *surface) -{ - m_surfaces << surface; -} - -void Compositor::removeSurface(Surface *surface) -{ - m_surfaces.removeOne(surface); - m_keyboard->handleSurfaceDestroyed(surface); - m_pointer->handleSurfaceDestroyed(surface); - m_fullScreenShellV1->removeSurface(surface); -} - -Surface *Compositor::resolveSurface(const QVariant &v) -{ - QSharedPointer mockSurface = v.value >(); - return mockSurface ? mockSurface->handle() : nullptr; -} - -Output *Compositor::resolveOutput(const QVariant &v) -{ - QSharedPointer mockOutput = v.value >(); - return mockOutput ? mockOutput->handle() : nullptr; -} - -IviSurface *Compositor::resolveIviSurface(const QVariant &v) -{ - QSharedPointer mockIviSurface = v.value>(); - return mockIviSurface ? mockIviSurface->handle() : nullptr; -} - -XdgToplevelV6 *Compositor::resolveToplevel(const QVariant &v) -{ - QSharedPointer mockToplevel = v.value>(); - return mockToplevel ? mockToplevel->handle() : nullptr; -} - -} +} // namespace MockCompositor diff --git a/tests/auto/wayland/shared/mockcompositor.h b/tests/auto/wayland/shared/mockcompositor.h index 4bab1ed67a0..07366a4939a 100644 --- a/tests/auto/wayland/shared/mockcompositor.h +++ b/tests/auto/wayland/shared/mockcompositor.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2018 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the test suite of the Qt Toolkit. @@ -29,262 +29,55 @@ #ifndef MOCKCOMPOSITOR_H #define MOCKCOMPOSITOR_H -#include "mockxdgshellv6.h" -#include "mockiviapplication.h" -#include "mockfullscreenshellv1.h" +#include "corecompositor.h" +#include "coreprotocol.h" +#include "xdgshell.h" -#include -#include -#include +#include -#include -#include -#include -#include -#include -#include -#include +#ifndef BTN_LEFT +// As defined in linux/input-event-codes.h +#define BTN_LEFT 0x110 +#endif -namespace Impl { +namespace MockCompositor { -typedef void (**Implementation)(void); - -class Keyboard; -class Pointer; -class Touch; -class Seat; -class DataDeviceManager; -class Surface; -class Output; -class IviApplication; -class WlShell; -class XdgShellV6; - -class Compositor +class DefaultCompositor : public CoreCompositor { public: - Compositor(); - ~Compositor(); - - int fileDescriptor() const { return m_fd; } - void dispatchEvents(int timeout = 0); - - uint32_t nextSerial(); - uint32_t time() { return ++m_time; } - - QVector surfaces() const; - QVector outputs() const; - - IviApplication *iviApplication() const; - XdgShellV6 *xdgShellV6() const; - FullScreenShellV1 *fullScreenShellV1() const; - - void addSurface(Surface *surface); - void removeSurface(Surface *surface); - - static void setKeyboardFocus(void *data, const QList ¶meters); - static void sendMousePress(void *data, const QList ¶meters); - static void sendMouseRelease(void *data, const QList ¶meters); - static void sendKeyPress(void *data, const QList ¶meters); - static void sendKeyRelease(void *data, const QList ¶meters); - static void sendTouchDown(void *data, const QList ¶meters); - static void sendTouchUp(void *data, const QList ¶meters); - static void sendTouchMotion(void *data, const QList ¶meters); - static void sendTouchFrame(void *data, const QList ¶meters); - static void sendDataDeviceDataOffer(void *data, const QList ¶meters); - static void sendDataDeviceEnter(void *data, const QList ¶meters); - static void sendDataDeviceMotion(void *data, const QList ¶meters); - static void sendDataDeviceDrop(void *data, const QList ¶meters); - static void sendDataDeviceLeave(void *data, const QList ¶meters); - static void waitForStartDrag(void *data, const QList ¶meters); - static void setOutputMode(void *compositor, const QList ¶meters); - static void sendAddOutput(void *data, const QList ¶meters); - static void sendRemoveOutput(void *data, const QList ¶meters); - static void sendOutputGeometry(void *data, const QList ¶meters); - static void sendSurfaceEnter(void *data, const QList ¶meters); - static void sendSurfaceLeave(void *data, const QList ¶meters); - static void sendShellSurfaceConfigure(void *data, const QList ¶meters); - static void sendIviSurfaceConfigure(void *data, const QList ¶meters); - static void sendXdgToplevelV6Configure(void *data, const QList ¶meters); - -public: - bool m_startDragSeen = false; - -private: - static void bindCompositor(wl_client *client, void *data, uint32_t version, uint32_t id); - static Surface *resolveSurface(const QVariant &v); - static Output *resolveOutput(const QVariant &v); - static IviSurface *resolveIviSurface(const QVariant &v); - static XdgToplevelV6 *resolveToplevel(const QVariant &v); - - void initShm(); - - QRect m_outputGeometry; - - wl_display *m_display = nullptr; - wl_event_loop *m_loop = nullptr; - int m_fd = -1; - - uint32_t m_time = 0; - - QScopedPointer m_seat; - Pointer *m_pointer = nullptr; - Keyboard *m_keyboard = nullptr; - Touch *m_touch = nullptr; - QScopedPointer m_data_device_manager; - QVector m_surfaces; - QVector m_outputs; - QScopedPointer m_iviApplication; - QScopedPointer m_wlShell; - QScopedPointer m_xdgShellV6; - QScopedPointer m_fullScreenShellV1; + explicit DefaultCompositor(); + // Convenience functions + Surface *surface(int i = 0) { return get()->m_surfaces.value(i, nullptr); } + XdgSurface *xdgSurface(int i = 0) { return get()->m_xdgSurfaces.value(i, nullptr); } + XdgToplevel *xdgToplevel(int i = 0) { return get()->toplevel(i); } + XdgPopup *xdgPopup(int i = 0) { return get()->popup(i); } + Pointer *pointer() { auto *seat = get(); Q_ASSERT(seat); return seat->m_pointer; } + uint sendXdgShellPing(); + void xdgPingAndWaitForPong(); + // Things that can be changed run-time without confusing the client (i.e. don't require separate tests) + struct Config { + bool autoEnter = true; + bool autoRelease = true; + bool autoConfigure = false; + } m_config; + void resetConfig() { exec([&] { m_config = Config{}; }); } }; -void registerResource(wl_list *list, wl_resource *resource); +} // namespace MockCompositor -} +#define QCOMPOSITOR_VERIFY(expr) QVERIFY(exec([&]{ return expr; })) +#define QCOMPOSITOR_TRY_VERIFY(expr) QTRY_VERIFY(exec([&]{ return expr; })) +#define QCOMPOSITOR_COMPARE(expr, expr2) QCOMPARE(exec([&]{ return expr; }), expr2) +#define QCOMPOSITOR_TRY_COMPARE(expr, expr2) QTRY_COMPARE(exec([&]{ return expr; }), expr2) -class MockSurface -{ -public: - Impl::Surface *handle() const { return m_surface; } - - QImage image; - -private: - MockSurface(Impl::Surface *surface); - friend class Impl::Compositor; - friend class Impl::Surface; - - Impl::Surface *m_surface = nullptr; -}; - -Q_DECLARE_METATYPE(QSharedPointer) - -class MockIviSurface -{ -public: - Impl::IviSurface *handle() const { return m_iviSurface; } - const uint iviId; - -private: - MockIviSurface(Impl::IviSurface *iviSurface) : iviId(iviSurface->iviId()), m_iviSurface(iviSurface) {} - friend class Impl::Compositor; - friend class Impl::IviSurface; - - Impl::IviSurface *m_iviSurface; -}; - -Q_DECLARE_METATYPE(QSharedPointer) - -class MockXdgToplevelV6 : public QObject -{ - Q_OBJECT -public: - Impl::XdgToplevelV6 *handle() const { return m_toplevel; } - - void sendConfigure(const QSharedPointer toplevel); - -signals: - uint setMinimizedRequested(); - uint setMaximizedRequested(); - uint unsetMaximizedRequested(); - uint setFullscreenRequested(); - uint unsetFullscreenRequested(); - void windowGeometryRequested(QRect geometry); // NOTE: This is really an xdg surface event - -private: - MockXdgToplevelV6(Impl::XdgToplevelV6 *toplevel) : m_toplevel(toplevel) {} - friend class Impl::Compositor; - friend class Impl::XdgToplevelV6; - - Impl::XdgToplevelV6 *m_toplevel; -}; - -Q_DECLARE_METATYPE(QSharedPointer) - -class MockOutput { -public: - Impl::Output *handle() const { return m_output; } - MockOutput(Impl::Output *output); -private: - Impl::Output *m_output = nullptr; -}; - -Q_DECLARE_METATYPE(QSharedPointer) - -class MockCompositor -{ -public: - MockCompositor(); - ~MockCompositor(); - - void applicationInitialized(); - - int waylandFileDescriptor() const; - void processWaylandEvents(); - - void setOutputMode(const QSize &size); - void setKeyboardFocus(const QSharedPointer &surface); - void sendMousePress(const QSharedPointer &surface, const QPoint &pos); - void sendMouseRelease(const QSharedPointer &surface); - void sendKeyPress(const QSharedPointer &surface, uint code); - void sendKeyRelease(const QSharedPointer &surface, uint code); - void sendTouchDown(const QSharedPointer &surface, const QPoint &position, int id); - void sendTouchMotion(const QSharedPointer &surface, const QPoint &position, int id); - void sendTouchUp(const QSharedPointer &surface, int id); - void sendTouchFrame(const QSharedPointer &surface); - void sendDataDeviceDataOffer(const QSharedPointer &surface); - void sendDataDeviceEnter(const QSharedPointer &surface, const QPoint &position); - void sendDataDeviceMotion(const QPoint &position); - void sendDataDeviceDrop(const QSharedPointer &surface); - void sendDataDeviceLeave(const QSharedPointer &surface); - void sendAddOutput(); - void sendRemoveOutput(const QSharedPointer &output); - void sendOutputGeometry(const QSharedPointer &output, const QRect &geometry); - void sendSurfaceEnter(const QSharedPointer &surface, QSharedPointer &output); - void sendSurfaceLeave(const QSharedPointer &surface, QSharedPointer &output); - void sendShellSurfaceConfigure(const QSharedPointer surface, const QSize &size = QSize(0, 0)); - void sendIviSurfaceConfigure(const QSharedPointer iviSurface, const QSize &size); - void sendXdgToplevelV6Configure(const QSharedPointer toplevel, const QSize &size = QSize(0, 0), - const QVector &states = { ZXDG_TOPLEVEL_V6_STATE_ACTIVATED }); - void waitForStartDrag(); - - QSharedPointer surface(); - QSharedPointer output(int index = 0); - QSharedPointer iviSurface(int index = 0); - QSharedPointer xdgToplevelV6(int index = 0); - QSharedPointer fullScreenShellV1Surface(int index = 0); - - void lock(); - void unlock(); - -private: - struct Command - { - typedef void (*Callback)(void *target, const QList ¶meters); - - Callback callback; - void *target = nullptr; - QList parameters; - }; - - static Command makeCommand(Command::Callback callback, void *target); - - void processCommand(const Command &command); - void dispatchCommands(); - - static void *run(void *data); - - bool m_alive = true; - bool m_ready = false; - pthread_t m_thread; - QMutex m_mutex; - QWaitCondition m_waitCondition; - - Impl::Compositor *m_compositor = nullptr; - - QList m_commandQueue; -}; +#define QCOMPOSITOR_TEST_MAIN(test) \ +int main(int argc, char **argv) \ +{ \ + setenv("XDG_RUNTIME_DIR", ".", 1); \ + setenv("QT_QPA_PLATFORM", "wayland", 1); \ + test tc; \ + QGuiApplication app(argc, argv); \ + return QTest::qExec(&tc, argc, argv); \ +} \ #endif diff --git a/tests/auto/wayland/shared/shared.pri b/tests/auto/wayland/shared/shared.pri index db71de52891..3376c73bcc9 100644 --- a/tests/auto/wayland/shared/shared.pri +++ b/tests/auto/wayland/shared/shared.pri @@ -1,34 +1,21 @@ -CONFIG += testcase link_pkgconfig -QT += testlib -QT += core-private gui-private waylandclient-private +QT += testlib waylandclient-private +CONFIG += testcase wayland-scanner +QMAKE_USE += wayland-server -QMAKE_USE += wayland-client wayland-server - -CONFIG += wayland-scanner WAYLANDSERVERSOURCES += \ - ../../../../src/3rdparty/protocol/ivi-application.xml \ - ../../../../src/3rdparty/protocol/wayland.xml \ - ../../../../src/3rdparty/protocol/xdg-shell-unstable-v6.xml \ - ../../../../src/3rdparty/protocol/fullscreen-shell-unstable-v1.xml + $$PWD/../../../../src/3rdparty/protocol/wayland.xml \ + $$PWD/../../../../src/3rdparty/protocol/xdg-shell.xml INCLUDEPATH += ../shared -SOURCES += \ - ../shared/mockcompositor.cpp \ - ../shared/mockfullscreenshellv1.cpp \ - ../shared/mockinput.cpp \ - ../shared/mockiviapplication.cpp \ - ../shared/mockwlshell.cpp \ - ../shared/mockxdgshellv6.cpp \ - ../shared/mocksurface.cpp \ - ../shared/mockoutput.cpp - HEADERS += \ - ../shared/mockcompositor.h \ - ../shared/mockfullscreenshellv1.h \ - ../shared/mockinput.h \ - ../shared/mockiviapplication.h \ - ../shared/mockwlshell.h \ - ../shared/mockxdgshellv6.h \ - ../shared/mocksurface.h \ - ../shared/mockoutput.h + $$PWD/corecompositor.h \ + $$PWD/coreprotocol.h \ + $$PWD/mockcompositor.h \ + $$PWD/xdgshell.h + +SOURCES += \ + $$PWD/corecompositor.cpp \ + $$PWD/coreprotocol.cpp \ + $$PWD/mockcompositor.cpp \ + $$PWD/xdgshell.cpp diff --git a/tests/auto/wayland/shared/xdgshell.cpp b/tests/auto/wayland/shared/xdgshell.cpp new file mode 100644 index 00000000000..ebbcc2942d4 --- /dev/null +++ b/tests/auto/wayland/shared/xdgshell.cpp @@ -0,0 +1,186 @@ +/**************************************************************************** +** +** Copyright (C) 2018 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "xdgshell.h" + +namespace MockCompositor { + +XdgWmBase::XdgWmBase(CoreCompositor *compositor, int version) + : QtWaylandServer::xdg_wm_base(compositor->m_display, version) + , m_compositor(compositor) +{ +} + +XdgToplevel *XdgWmBase::toplevel(int i) +{ + int j = 0; + for (auto *xdgSurface : qAsConst(m_xdgSurfaces)) { + if (auto *toplevel = xdgSurface->m_toplevel) { + if (j == i) + return toplevel; + ++j; + } + } + return nullptr; +} + +XdgPopup *XdgWmBase::popup(int i) +{ + int j = 0; + for (auto *xdgSurface : qAsConst(m_xdgSurfaces)) { + if (auto *popup = xdgSurface->m_popup) { + if (j == i) + return popup; + ++j; + } + } + return nullptr; +} + +void XdgWmBase::xdg_wm_base_get_xdg_surface(Resource *resource, uint32_t id, wl_resource *surface) +{ + auto *s = fromResource(surface); + auto *xdgSurface = new XdgSurface(this, s, resource->client(), id, resource->version()); + m_xdgSurfaces << xdgSurface; + emit xdgSurfaceCreated(xdgSurface); +} + +void XdgWmBase::xdg_wm_base_pong(Resource *resource, uint32_t serial) +{ + Q_UNUSED(resource); + emit pong(serial); +} + +XdgSurface::XdgSurface(XdgWmBase *xdgWmBase, Surface *surface, wl_client *client, int id, int version) + : QtWaylandServer::xdg_surface(client, id, version) + , m_xdgWmBase(xdgWmBase) + , m_surface(surface) +{ + QVERIFY(!surface->m_pending.buffer); + QVERIFY(!surface->m_committed.buffer); + connect(this, &XdgSurface::toplevelCreated, xdgWmBase, &XdgWmBase::toplevelCreated); + connect(surface, &Surface::attach, this, &XdgSurface::verifyConfigured); + connect(surface, &Surface::commit, this, [this] { + if (m_ackedConfigureSerial != m_committedConfigureSerial) { + m_committedConfigureSerial = m_ackedConfigureSerial; + emit configureCommitted(m_committedConfigureSerial); + } + }); +} + +void XdgSurface::sendConfigure(uint serial) +{ + Q_ASSERT(serial); + m_pendingConfigureSerials.append(serial); + m_configureSent = true; + xdg_surface::send_configure(serial); +} + +uint XdgSurface::sendConfigure() +{ + const uint serial = m_xdgWmBase->m_compositor->nextSerial(); + sendConfigure(serial); + return serial; +} + +void XdgSurface::xdg_surface_get_toplevel(Resource *resource, uint32_t id) +{ + QVERIFY(!m_toplevel); + QVERIFY(!m_popup); + m_toplevel = new XdgToplevel(this, id, resource->version()); + emit toplevelCreated(m_toplevel); +} + +void XdgSurface::xdg_surface_get_popup(Resource *resource, uint32_t id, wl_resource *parent, wl_resource *positioner) +{ + Q_UNUSED(parent); + Q_UNUSED(positioner); + QVERIFY(!m_toplevel); + QVERIFY(!m_popup); + m_popup = new XdgPopup(this, id, resource->version()); +} + +void XdgSurface::xdg_surface_destroy_resource(Resource *resource) +{ + Q_UNUSED(resource); + bool removed = m_xdgWmBase->m_xdgSurfaces.removeOne(this); + Q_ASSERT(removed); + delete this; +} + +void XdgSurface::xdg_surface_ack_configure(Resource *resource, uint32_t serial) +{ + Q_UNUSED(resource); + QVERIFY2(m_pendingConfigureSerials.contains(serial), qPrintable(QString::number(serial))); + m_ackedConfigureSerial = serial; + while (!m_pendingConfigureSerials.empty()) { + uint s = m_pendingConfigureSerials.takeFirst(); + if (s == serial) + return; + } +} + +XdgToplevel::XdgToplevel(XdgSurface *xdgSurface, int id, int version) + : QtWaylandServer::xdg_toplevel(xdgSurface->resource()->client(), id, version) + , m_xdgSurface(xdgSurface) +{ +} + +void XdgToplevel::sendConfigure(const QSize &size, const QVector &states) +{ + send_configure(size.width(), size.height(), toByteArray(states)); +} + +uint XdgToplevel::sendCompleteConfigure(const QSize &size, const QVector &states) +{ + sendConfigure(size, states); + return m_xdgSurface->sendConfigure(); +} + +XdgPopup::XdgPopup(XdgSurface *xdgSurface, int id, int version) + : QtWaylandServer::xdg_popup(xdgSurface->resource()->client(), id, version) + , m_xdgSurface(xdgSurface) +{ +} + +void XdgPopup::sendConfigure(const QRect &geometry) +{ + send_configure(geometry.x(), geometry.y(), geometry.width(), geometry.height()); +} + +void XdgPopup::xdg_popup_grab(QtWaylandServer::xdg_popup::Resource *resource, wl_resource *seat, uint32_t serial) +{ + Q_UNUSED(resource); + Q_UNUSED(seat); // TODO: verify correct seat as well + //TODO: verify no other popup has grabbed + QVERIFY(!m_grabbed); + m_grabbed = true; + m_grabSerial = serial; +} + +} // namespace MockCompositor diff --git a/tests/auto/wayland/shared/xdgshell.h b/tests/auto/wayland/shared/xdgshell.h new file mode 100644 index 00000000000..3fcec79832a --- /dev/null +++ b/tests/auto/wayland/shared/xdgshell.h @@ -0,0 +1,127 @@ +/**************************************************************************** +** +** Copyright (C) 2018 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef MOCKCOMPOSITOR_XDGSHELL_H +#define MOCKCOMPOSITOR_XDGSHELL_H + +#include "coreprotocol.h" +#include + +namespace MockCompositor { + +class XdgSurface; +class XdgToplevel; +class XdgPopup; +using XdgPositioner = QtWaylandServer::xdg_positioner; + +class XdgWmBase : public Global, public QtWaylandServer::xdg_wm_base +{ + Q_OBJECT +public: + explicit XdgWmBase(CoreCompositor *compositor, int version = 1); + using QtWaylandServer::xdg_wm_base::send_ping; + void send_ping(uint32_t) = delete; // It's a global, use resource specific instead + bool isClean() override { return m_xdgSurfaces.empty(); } + QString dirtyMessage() override { return m_xdgSurfaces.empty() ? "clean" : "remaining xdg surfaces"; } + QVector m_xdgSurfaces; + XdgToplevel *toplevel(int i = 0); + XdgPopup *popup(int i = 0); + CoreCompositor *m_compositor = nullptr; + +signals: + void pong(uint serial); + void xdgSurfaceCreated(XdgSurface *xdgSurface); + void toplevelCreated(XdgToplevel *toplevel); + +protected: + void xdg_wm_base_get_xdg_surface(Resource *resource, uint32_t id, ::wl_resource *surface) override; + void xdg_wm_base_pong(Resource *resource, uint32_t serial) override; + void xdg_wm_base_create_positioner(Resource *resource, uint32_t id) override + { + new XdgPositioner(resource->client(), id, resource->version()); + } +}; + +class XdgSurface : public QObject, public QtWaylandServer::xdg_surface +{ + Q_OBJECT +public: + explicit XdgSurface(XdgWmBase *xdgWmBase, Surface *surface, wl_client *client, int id, int version); + void send_configure(uint serial) = delete; // Use the one below instead, as it tracks state + void sendConfigure(uint serial); + uint sendConfigure(); + XdgToplevel *m_toplevel = nullptr; + XdgPopup *m_popup = nullptr; + XdgWmBase *m_xdgWmBase = nullptr; + Surface *m_surface = nullptr; + bool m_configureSent = false; + QVector m_pendingConfigureSerials; + uint m_ackedConfigureSerial = 0; + uint m_committedConfigureSerial = 0; + +public slots: + void verifyConfigured() { QVERIFY(m_configureSent); } + +signals: + void configureCommitted(uint); + void toplevelCreated(XdgToplevel *toplevel); + +protected: + void xdg_surface_get_toplevel(Resource *resource, uint32_t id) override; + void xdg_surface_get_popup(Resource *resource, uint32_t id, ::wl_resource *parent, ::wl_resource *positioner) override; + void xdg_surface_destroy_resource(Resource *resource) override; + void xdg_surface_destroy(Resource *resource) override { wl_resource_destroy(resource->handle); } + void xdg_surface_ack_configure(Resource *resource, uint32_t serial) override; +}; + +class XdgToplevel : public QtWaylandServer::xdg_toplevel +{ +public: + explicit XdgToplevel(XdgSurface *xdgSurface, int id, int version = 1); + void sendConfigure(const QSize &size = {0, 0}, const QVector &states = {}); + uint sendCompleteConfigure(const QSize &size = {0, 0}, const QVector &states = {}); + Surface *surface() { return m_xdgSurface->m_surface; } + XdgSurface *m_xdgSurface = nullptr; +}; + +class XdgPopup : public QtWaylandServer::xdg_popup +{ +public: + explicit XdgPopup(XdgSurface *xdgSurface, int id, int version = 1); + void sendConfigure(const QRect &geometry); + Surface *surface() { return m_xdgSurface->m_surface; } + XdgSurface *m_xdgSurface = nullptr; + bool m_grabbed = false; + uint m_grabSerial = 0; +protected: + void xdg_popup_grab(Resource *resource, ::wl_resource *seat, uint32_t serial) override; +}; + +} // namespace MockCompositor + +#endif // MOCKCOMPOSITOR_XDGSHELL_H diff --git a/tests/auto/wayland/shared_old/mockcompositor.cpp b/tests/auto/wayland/shared_old/mockcompositor.cpp new file mode 100644 index 00000000000..df24b4091b5 --- /dev/null +++ b/tests/auto/wayland/shared_old/mockcompositor.cpp @@ -0,0 +1,520 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "mockcompositor.h" +#include "mockinput.h" +#include "mockoutput.h" +#include "mocksurface.h" +#include "mockwlshell.h" +#include "mockxdgshellv6.h" +#include "mockiviapplication.h" + +#include + +#include +MockCompositor::MockCompositor() +{ + pthread_create(&m_thread, 0, run, this); + + m_mutex.lock(); + m_waitCondition.wait(&m_mutex); + m_mutex.unlock(); +} + +MockCompositor::~MockCompositor() +{ + m_alive = false; + m_waitCondition.wakeOne(); + pthread_join(m_thread, 0); +} + +void MockCompositor::lock() +{ + m_mutex.lock(); +} + +void MockCompositor::unlock() +{ + m_mutex.unlock(); +} + +void MockCompositor::applicationInitialized() +{ + m_ready = true; +} + +int MockCompositor::waylandFileDescriptor() const +{ + return m_compositor->fileDescriptor(); +} + +void MockCompositor::processWaylandEvents() +{ + m_waitCondition.wakeOne(); +} + +void MockCompositor::setOutputMode(const QSize &size) +{ + Command command = makeCommand(Impl::Compositor::setOutputMode, m_compositor); + command.parameters << size; + processCommand(command); +} + +void MockCompositor::setKeyboardFocus(const QSharedPointer &surface) +{ + Command command = makeCommand(Impl::Compositor::setKeyboardFocus, m_compositor); + command.parameters << QVariant::fromValue(surface); + processCommand(command); +} + +void MockCompositor::sendMousePress(const QSharedPointer &surface, const QPoint &pos) +{ + Command command = makeCommand(Impl::Compositor::sendMousePress, m_compositor); + command.parameters << QVariant::fromValue(surface) << pos; + processCommand(command); +} + +void MockCompositor::sendMouseRelease(const QSharedPointer &surface) +{ + Command command = makeCommand(Impl::Compositor::sendMouseRelease, m_compositor); + command.parameters << QVariant::fromValue(surface); + processCommand(command); +} + +void MockCompositor::sendKeyPress(const QSharedPointer &surface, uint code) +{ + Command command = makeCommand(Impl::Compositor::sendKeyPress, m_compositor); + command.parameters << QVariant::fromValue(surface) << code; + processCommand(command); +} + +void MockCompositor::sendKeyRelease(const QSharedPointer &surface, uint code) +{ + Command command = makeCommand(Impl::Compositor::sendKeyRelease, m_compositor); + command.parameters << QVariant::fromValue(surface) << code; + processCommand(command); +} + +void MockCompositor::sendTouchDown(const QSharedPointer &surface, const QPoint &position, int id) +{ + Command command = makeCommand(Impl::Compositor::sendTouchDown, m_compositor); + command.parameters << QVariant::fromValue(surface) << position << id; + processCommand(command); +} + +void MockCompositor::sendTouchMotion(const QSharedPointer &surface, const QPoint &position, int id) +{ + Command command = makeCommand(Impl::Compositor::sendTouchMotion, m_compositor); + command.parameters << QVariant::fromValue(surface) << position << id; + processCommand(command); +} + +void MockCompositor::sendTouchUp(const QSharedPointer &surface, int id) +{ + Command command = makeCommand(Impl::Compositor::sendTouchUp, m_compositor); + command.parameters << QVariant::fromValue(surface) << id; + processCommand(command); +} + +void MockCompositor::sendTouchFrame(const QSharedPointer &surface) +{ + Command command = makeCommand(Impl::Compositor::sendTouchFrame, m_compositor); + command.parameters << QVariant::fromValue(surface); + processCommand(command); +} + +void MockCompositor::sendDataDeviceDataOffer(const QSharedPointer &surface) +{ + Command command = makeCommand(Impl::Compositor::sendDataDeviceDataOffer, m_compositor); + command.parameters << QVariant::fromValue(surface); + processCommand(command); +} + +void MockCompositor::sendDataDeviceEnter(const QSharedPointer &surface, const QPoint& position) +{ + Command command = makeCommand(Impl::Compositor::sendDataDeviceEnter, m_compositor); + command.parameters << QVariant::fromValue(surface) << QVariant::fromValue(position); + processCommand(command); +} + +void MockCompositor::sendDataDeviceMotion(const QPoint &position) +{ + Command command = makeCommand(Impl::Compositor::sendDataDeviceMotion, m_compositor); + command.parameters << QVariant::fromValue(position); + processCommand(command); +} + +void MockCompositor::sendDataDeviceDrop(const QSharedPointer &surface) +{ + Command command = makeCommand(Impl::Compositor::sendDataDeviceDrop, m_compositor); + command.parameters << QVariant::fromValue(surface); + processCommand(command); +} + +void MockCompositor::sendDataDeviceLeave(const QSharedPointer &surface) +{ + Command command = makeCommand(Impl::Compositor::sendDataDeviceLeave, m_compositor); + command.parameters << QVariant::fromValue(surface); + processCommand(command); +} + +void MockCompositor::sendAddOutput() +{ + Command command = makeCommand(Impl::Compositor::sendAddOutput, m_compositor); + processCommand(command); +} + +void MockCompositor::sendRemoveOutput(const QSharedPointer &output) +{ + Command command = makeCommand(Impl::Compositor::sendRemoveOutput, m_compositor); + command.parameters << QVariant::fromValue(output); + processCommand(command); +} + +void MockCompositor::sendOutputGeometry(const QSharedPointer &output, const QRect &geometry) +{ + Command command = makeCommand(Impl::Compositor::sendOutputGeometry, m_compositor); + command.parameters << QVariant::fromValue(output); + command.parameters << QVariant::fromValue(geometry); + processCommand(command); +} + +void MockCompositor::sendSurfaceEnter(const QSharedPointer &surface, QSharedPointer &output) +{ + Command command = makeCommand(Impl::Compositor::sendSurfaceEnter, m_compositor); + command.parameters << QVariant::fromValue(surface); + command.parameters << QVariant::fromValue(output); + processCommand(command); +} + +void MockCompositor::sendSurfaceLeave(const QSharedPointer &surface, QSharedPointer &output) +{ + Command command = makeCommand(Impl::Compositor::sendSurfaceLeave, m_compositor); + command.parameters << QVariant::fromValue(surface); + command.parameters << QVariant::fromValue(output); + processCommand(command); +} + +void MockCompositor::sendShellSurfaceConfigure(const QSharedPointer surface, const QSize &size) +{ + Command command = makeCommand(Impl::Compositor::sendShellSurfaceConfigure, m_compositor); + command.parameters << QVariant::fromValue(surface); + command.parameters << QVariant::fromValue(size); + processCommand(command); +} + +void MockCompositor::sendIviSurfaceConfigure(const QSharedPointer iviSurface, const QSize &size) +{ + Command command = makeCommand(Impl::Compositor::sendIviSurfaceConfigure, m_compositor); + command.parameters << QVariant::fromValue(iviSurface); + command.parameters << QVariant::fromValue(size); + processCommand(command); +} + +void MockCompositor::sendXdgToplevelV6Configure(const QSharedPointer toplevel, const QSize &size, const QVector &states) +{ + Command command = makeCommand(Impl::Compositor::sendXdgToplevelV6Configure, m_compositor); + command.parameters << QVariant::fromValue(toplevel); + command.parameters << QVariant::fromValue(size); + QByteArray statesBytes(reinterpret_cast(states.data()), + states.size() * static_cast(sizeof(uint))); + command.parameters << statesBytes; + processCommand(command); +} + +void MockCompositor::waitForStartDrag() +{ + Command command = makeCommand(Impl::Compositor::waitForStartDrag, m_compositor); + processCommand(command); +} + +QSharedPointer MockCompositor::surface() +{ + QSharedPointer result; + lock(); + QVector surfaces = m_compositor->surfaces(); + foreach (Impl::Surface *surface, surfaces) { + // we don't want to mistake the cursor surface for a window surface + if (surface->isMapped()) { + result = surface->mockSurface(); + break; + } + } + unlock(); + return result; +} + +QSharedPointer MockCompositor::output(int index) +{ + QSharedPointer result; + lock(); + if (Impl::Output *output = m_compositor->outputs().value(index, nullptr)) + result = output->mockOutput(); + unlock(); + return result; +} + +QSharedPointer MockCompositor::iviSurface(int index) +{ + QSharedPointer result; + lock(); + if (Impl::IviSurface *toplevel = m_compositor->iviApplication()->iviSurfaces().value(index, nullptr)) + result = toplevel->mockIviSurface(); + unlock(); + return result; +} + +QSharedPointer MockCompositor::xdgToplevelV6(int index) +{ + QSharedPointer result; + lock(); + if (Impl::XdgToplevelV6 *toplevel = m_compositor->xdgShellV6()->toplevels().value(index, nullptr)) + result = toplevel->mockToplevel(); + unlock(); + return result; +} + +QSharedPointer MockCompositor::fullScreenShellV1Surface(int index) +{ + QSharedPointer result; + lock(); + if (Impl::Surface *surface = m_compositor->fullScreenShellV1()->surfaces().value(index, nullptr)) + result = surface->mockSurface(); + unlock(); + return result; +} + +MockCompositor::Command MockCompositor::makeCommand(Command::Callback callback, void *target) +{ + Command command; + command.callback = callback; + command.target = target; + return command; +} + +void MockCompositor::processCommand(const Command &command) +{ + lock(); + m_commandQueue << command; + unlock(); + + m_waitCondition.wakeOne(); +} + +void MockCompositor::dispatchCommands() +{ + lock(); + int count = m_commandQueue.length(); + unlock(); + + for (int i = 0; i < count; ++i) { + lock(); + const Command command = m_commandQueue.takeFirst(); + unlock(); + command.callback(command.target, command.parameters); + } +} + +void *MockCompositor::run(void *data) +{ + MockCompositor *controller = static_cast(data); + + Impl::Compositor compositor; + + controller->m_compositor = &compositor; + controller->m_waitCondition.wakeOne(); + + while (!controller->m_ready) { + controller->dispatchCommands(); + compositor.dispatchEvents(20); + } + + while (controller->m_alive) { + { + QMutexLocker locker(&controller->m_mutex); + if (controller->m_commandQueue.isEmpty()) + controller->m_waitCondition.wait(&controller->m_mutex); + } + controller->dispatchCommands(); + compositor.dispatchEvents(20); + } + + return 0; +} + +namespace Impl { + +Compositor::Compositor() + : m_display(wl_display_create()) +{ + if (wl_display_add_socket(m_display, 0)) { + fprintf(stderr, "Fatal: Failed to open server socket\n"); + exit(EXIT_FAILURE); + } + + wl_global_create(m_display, &wl_compositor_interface, 1, this, bindCompositor); + + m_data_device_manager.reset(new DataDeviceManager(this, m_display)); + + wl_display_init_shm(m_display); + + m_seat.reset(new Seat(this, m_display)); + m_pointer = m_seat->pointer(); + m_keyboard = m_seat->keyboard(); + m_touch = m_seat->touch(); + + m_outputs.append(new Output(m_display, QSize(1920, 1080), QPoint(0, 0))); + m_iviApplication.reset(new IviApplication(m_display)); + m_wlShell.reset(new WlShell(m_display)); + m_xdgShellV6.reset(new XdgShellV6(m_display)); + m_fullScreenShellV1.reset(new FullScreenShellV1(m_display)); + + m_loop = wl_display_get_event_loop(m_display); + m_fd = wl_event_loop_get_fd(m_loop); +} + +Compositor::~Compositor() +{ + wl_display_destroy(m_display); +} + +void Compositor::dispatchEvents(int timeout) +{ + wl_display_flush_clients(m_display); + wl_event_loop_dispatch(m_loop, timeout); +} + +static void compositor_create_surface(wl_client *client, wl_resource *compositorResource, uint32_t id) +{ + Compositor *compositor = static_cast(wl_resource_get_user_data(compositorResource)); + compositor->addSurface(new Surface(client, id, wl_resource_get_version(compositorResource), compositor)); +} + +static void compositor_create_region(wl_client *client, wl_resource *compositorResource, uint32_t id) +{ + Q_UNUSED(client); + Q_UNUSED(compositorResource); + Q_UNUSED(id); +} + +void Compositor::bindCompositor(wl_client *client, void *compositorData, uint32_t version, uint32_t id) +{ + static const struct wl_compositor_interface compositorInterface = { + compositor_create_surface, + compositor_create_region + }; + + wl_resource *resource = wl_resource_create(client, &wl_compositor_interface, static_cast(version), id); + wl_resource_set_implementation(resource, &compositorInterface, compositorData, nullptr); +} + +static void unregisterResourceCallback(wl_listener *listener, void *data) +{ + struct wl_resource *resource = reinterpret_cast(data); + wl_list_remove(wl_resource_get_link(resource)); + delete listener; +} + +void registerResource(wl_list *list, wl_resource *resource) +{ + wl_list_insert(list, wl_resource_get_link(resource)); + + wl_listener *listener = new wl_listener; + listener->notify = unregisterResourceCallback; + + wl_resource_add_destroy_listener(resource, listener); +} + +QVector Compositor::surfaces() const +{ + return m_surfaces; +} + +QVector Compositor::outputs() const +{ + return m_outputs; +} + +IviApplication *Compositor::iviApplication() const +{ + return m_iviApplication.data(); +} + +XdgShellV6 *Compositor::xdgShellV6() const +{ + return m_xdgShellV6.data(); +} + +FullScreenShellV1 *Compositor::fullScreenShellV1() const +{ + return m_fullScreenShellV1.data(); +} + +uint32_t Compositor::nextSerial() +{ + return wl_display_next_serial(m_display); +} + +void Compositor::addSurface(Surface *surface) +{ + m_surfaces << surface; +} + +void Compositor::removeSurface(Surface *surface) +{ + m_surfaces.removeOne(surface); + m_keyboard->handleSurfaceDestroyed(surface); + m_pointer->handleSurfaceDestroyed(surface); + m_fullScreenShellV1->removeSurface(surface); +} + +Surface *Compositor::resolveSurface(const QVariant &v) +{ + QSharedPointer mockSurface = v.value >(); + return mockSurface ? mockSurface->handle() : nullptr; +} + +Output *Compositor::resolveOutput(const QVariant &v) +{ + QSharedPointer mockOutput = v.value >(); + return mockOutput ? mockOutput->handle() : nullptr; +} + +IviSurface *Compositor::resolveIviSurface(const QVariant &v) +{ + QSharedPointer mockIviSurface = v.value>(); + return mockIviSurface ? mockIviSurface->handle() : nullptr; +} + +XdgToplevelV6 *Compositor::resolveToplevel(const QVariant &v) +{ + QSharedPointer mockToplevel = v.value>(); + return mockToplevel ? mockToplevel->handle() : nullptr; +} + +} diff --git a/tests/auto/wayland/shared_old/mockcompositor.h b/tests/auto/wayland/shared_old/mockcompositor.h new file mode 100644 index 00000000000..4bab1ed67a0 --- /dev/null +++ b/tests/auto/wayland/shared_old/mockcompositor.h @@ -0,0 +1,290 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef MOCKCOMPOSITOR_H +#define MOCKCOMPOSITOR_H + +#include "mockxdgshellv6.h" +#include "mockiviapplication.h" +#include "mockfullscreenshellv1.h" + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +namespace Impl { + +typedef void (**Implementation)(void); + +class Keyboard; +class Pointer; +class Touch; +class Seat; +class DataDeviceManager; +class Surface; +class Output; +class IviApplication; +class WlShell; +class XdgShellV6; + +class Compositor +{ +public: + Compositor(); + ~Compositor(); + + int fileDescriptor() const { return m_fd; } + void dispatchEvents(int timeout = 0); + + uint32_t nextSerial(); + uint32_t time() { return ++m_time; } + + QVector surfaces() const; + QVector outputs() const; + + IviApplication *iviApplication() const; + XdgShellV6 *xdgShellV6() const; + FullScreenShellV1 *fullScreenShellV1() const; + + void addSurface(Surface *surface); + void removeSurface(Surface *surface); + + static void setKeyboardFocus(void *data, const QList ¶meters); + static void sendMousePress(void *data, const QList ¶meters); + static void sendMouseRelease(void *data, const QList ¶meters); + static void sendKeyPress(void *data, const QList ¶meters); + static void sendKeyRelease(void *data, const QList ¶meters); + static void sendTouchDown(void *data, const QList ¶meters); + static void sendTouchUp(void *data, const QList ¶meters); + static void sendTouchMotion(void *data, const QList ¶meters); + static void sendTouchFrame(void *data, const QList ¶meters); + static void sendDataDeviceDataOffer(void *data, const QList ¶meters); + static void sendDataDeviceEnter(void *data, const QList ¶meters); + static void sendDataDeviceMotion(void *data, const QList ¶meters); + static void sendDataDeviceDrop(void *data, const QList ¶meters); + static void sendDataDeviceLeave(void *data, const QList ¶meters); + static void waitForStartDrag(void *data, const QList ¶meters); + static void setOutputMode(void *compositor, const QList ¶meters); + static void sendAddOutput(void *data, const QList ¶meters); + static void sendRemoveOutput(void *data, const QList ¶meters); + static void sendOutputGeometry(void *data, const QList ¶meters); + static void sendSurfaceEnter(void *data, const QList ¶meters); + static void sendSurfaceLeave(void *data, const QList ¶meters); + static void sendShellSurfaceConfigure(void *data, const QList ¶meters); + static void sendIviSurfaceConfigure(void *data, const QList ¶meters); + static void sendXdgToplevelV6Configure(void *data, const QList ¶meters); + +public: + bool m_startDragSeen = false; + +private: + static void bindCompositor(wl_client *client, void *data, uint32_t version, uint32_t id); + static Surface *resolveSurface(const QVariant &v); + static Output *resolveOutput(const QVariant &v); + static IviSurface *resolveIviSurface(const QVariant &v); + static XdgToplevelV6 *resolveToplevel(const QVariant &v); + + void initShm(); + + QRect m_outputGeometry; + + wl_display *m_display = nullptr; + wl_event_loop *m_loop = nullptr; + int m_fd = -1; + + uint32_t m_time = 0; + + QScopedPointer m_seat; + Pointer *m_pointer = nullptr; + Keyboard *m_keyboard = nullptr; + Touch *m_touch = nullptr; + QScopedPointer m_data_device_manager; + QVector m_surfaces; + QVector m_outputs; + QScopedPointer m_iviApplication; + QScopedPointer m_wlShell; + QScopedPointer m_xdgShellV6; + QScopedPointer m_fullScreenShellV1; +}; + +void registerResource(wl_list *list, wl_resource *resource); + +} + +class MockSurface +{ +public: + Impl::Surface *handle() const { return m_surface; } + + QImage image; + +private: + MockSurface(Impl::Surface *surface); + friend class Impl::Compositor; + friend class Impl::Surface; + + Impl::Surface *m_surface = nullptr; +}; + +Q_DECLARE_METATYPE(QSharedPointer) + +class MockIviSurface +{ +public: + Impl::IviSurface *handle() const { return m_iviSurface; } + const uint iviId; + +private: + MockIviSurface(Impl::IviSurface *iviSurface) : iviId(iviSurface->iviId()), m_iviSurface(iviSurface) {} + friend class Impl::Compositor; + friend class Impl::IviSurface; + + Impl::IviSurface *m_iviSurface; +}; + +Q_DECLARE_METATYPE(QSharedPointer) + +class MockXdgToplevelV6 : public QObject +{ + Q_OBJECT +public: + Impl::XdgToplevelV6 *handle() const { return m_toplevel; } + + void sendConfigure(const QSharedPointer toplevel); + +signals: + uint setMinimizedRequested(); + uint setMaximizedRequested(); + uint unsetMaximizedRequested(); + uint setFullscreenRequested(); + uint unsetFullscreenRequested(); + void windowGeometryRequested(QRect geometry); // NOTE: This is really an xdg surface event + +private: + MockXdgToplevelV6(Impl::XdgToplevelV6 *toplevel) : m_toplevel(toplevel) {} + friend class Impl::Compositor; + friend class Impl::XdgToplevelV6; + + Impl::XdgToplevelV6 *m_toplevel; +}; + +Q_DECLARE_METATYPE(QSharedPointer) + +class MockOutput { +public: + Impl::Output *handle() const { return m_output; } + MockOutput(Impl::Output *output); +private: + Impl::Output *m_output = nullptr; +}; + +Q_DECLARE_METATYPE(QSharedPointer) + +class MockCompositor +{ +public: + MockCompositor(); + ~MockCompositor(); + + void applicationInitialized(); + + int waylandFileDescriptor() const; + void processWaylandEvents(); + + void setOutputMode(const QSize &size); + void setKeyboardFocus(const QSharedPointer &surface); + void sendMousePress(const QSharedPointer &surface, const QPoint &pos); + void sendMouseRelease(const QSharedPointer &surface); + void sendKeyPress(const QSharedPointer &surface, uint code); + void sendKeyRelease(const QSharedPointer &surface, uint code); + void sendTouchDown(const QSharedPointer &surface, const QPoint &position, int id); + void sendTouchMotion(const QSharedPointer &surface, const QPoint &position, int id); + void sendTouchUp(const QSharedPointer &surface, int id); + void sendTouchFrame(const QSharedPointer &surface); + void sendDataDeviceDataOffer(const QSharedPointer &surface); + void sendDataDeviceEnter(const QSharedPointer &surface, const QPoint &position); + void sendDataDeviceMotion(const QPoint &position); + void sendDataDeviceDrop(const QSharedPointer &surface); + void sendDataDeviceLeave(const QSharedPointer &surface); + void sendAddOutput(); + void sendRemoveOutput(const QSharedPointer &output); + void sendOutputGeometry(const QSharedPointer &output, const QRect &geometry); + void sendSurfaceEnter(const QSharedPointer &surface, QSharedPointer &output); + void sendSurfaceLeave(const QSharedPointer &surface, QSharedPointer &output); + void sendShellSurfaceConfigure(const QSharedPointer surface, const QSize &size = QSize(0, 0)); + void sendIviSurfaceConfigure(const QSharedPointer iviSurface, const QSize &size); + void sendXdgToplevelV6Configure(const QSharedPointer toplevel, const QSize &size = QSize(0, 0), + const QVector &states = { ZXDG_TOPLEVEL_V6_STATE_ACTIVATED }); + void waitForStartDrag(); + + QSharedPointer surface(); + QSharedPointer output(int index = 0); + QSharedPointer iviSurface(int index = 0); + QSharedPointer xdgToplevelV6(int index = 0); + QSharedPointer fullScreenShellV1Surface(int index = 0); + + void lock(); + void unlock(); + +private: + struct Command + { + typedef void (*Callback)(void *target, const QList ¶meters); + + Callback callback; + void *target = nullptr; + QList parameters; + }; + + static Command makeCommand(Command::Callback callback, void *target); + + void processCommand(const Command &command); + void dispatchCommands(); + + static void *run(void *data); + + bool m_alive = true; + bool m_ready = false; + pthread_t m_thread; + QMutex m_mutex; + QWaitCondition m_waitCondition; + + Impl::Compositor *m_compositor = nullptr; + + QList m_commandQueue; +}; + +#endif diff --git a/tests/auto/wayland/shared/mockfullscreenshellv1.cpp b/tests/auto/wayland/shared_old/mockfullscreenshellv1.cpp similarity index 100% rename from tests/auto/wayland/shared/mockfullscreenshellv1.cpp rename to tests/auto/wayland/shared_old/mockfullscreenshellv1.cpp diff --git a/tests/auto/wayland/shared/mockfullscreenshellv1.h b/tests/auto/wayland/shared_old/mockfullscreenshellv1.h similarity index 100% rename from tests/auto/wayland/shared/mockfullscreenshellv1.h rename to tests/auto/wayland/shared_old/mockfullscreenshellv1.h diff --git a/tests/auto/wayland/shared/mockinput.cpp b/tests/auto/wayland/shared_old/mockinput.cpp similarity index 100% rename from tests/auto/wayland/shared/mockinput.cpp rename to tests/auto/wayland/shared_old/mockinput.cpp diff --git a/tests/auto/wayland/shared/mockinput.h b/tests/auto/wayland/shared_old/mockinput.h similarity index 100% rename from tests/auto/wayland/shared/mockinput.h rename to tests/auto/wayland/shared_old/mockinput.h diff --git a/tests/auto/wayland/shared/mockiviapplication.cpp b/tests/auto/wayland/shared_old/mockiviapplication.cpp similarity index 100% rename from tests/auto/wayland/shared/mockiviapplication.cpp rename to tests/auto/wayland/shared_old/mockiviapplication.cpp diff --git a/tests/auto/wayland/shared/mockiviapplication.h b/tests/auto/wayland/shared_old/mockiviapplication.h similarity index 100% rename from tests/auto/wayland/shared/mockiviapplication.h rename to tests/auto/wayland/shared_old/mockiviapplication.h diff --git a/tests/auto/wayland/shared/mockoutput.cpp b/tests/auto/wayland/shared_old/mockoutput.cpp similarity index 100% rename from tests/auto/wayland/shared/mockoutput.cpp rename to tests/auto/wayland/shared_old/mockoutput.cpp diff --git a/tests/auto/wayland/shared/mockoutput.h b/tests/auto/wayland/shared_old/mockoutput.h similarity index 100% rename from tests/auto/wayland/shared/mockoutput.h rename to tests/auto/wayland/shared_old/mockoutput.h diff --git a/tests/auto/wayland/shared/mocksurface.cpp b/tests/auto/wayland/shared_old/mocksurface.cpp similarity index 100% rename from tests/auto/wayland/shared/mocksurface.cpp rename to tests/auto/wayland/shared_old/mocksurface.cpp diff --git a/tests/auto/wayland/shared/mocksurface.h b/tests/auto/wayland/shared_old/mocksurface.h similarity index 100% rename from tests/auto/wayland/shared/mocksurface.h rename to tests/auto/wayland/shared_old/mocksurface.h diff --git a/tests/auto/wayland/shared/mockwlshell.cpp b/tests/auto/wayland/shared_old/mockwlshell.cpp similarity index 100% rename from tests/auto/wayland/shared/mockwlshell.cpp rename to tests/auto/wayland/shared_old/mockwlshell.cpp diff --git a/tests/auto/wayland/shared/mockwlshell.h b/tests/auto/wayland/shared_old/mockwlshell.h similarity index 100% rename from tests/auto/wayland/shared/mockwlshell.h rename to tests/auto/wayland/shared_old/mockwlshell.h diff --git a/tests/auto/wayland/shared/mockxdgshellv6.cpp b/tests/auto/wayland/shared_old/mockxdgshellv6.cpp similarity index 100% rename from tests/auto/wayland/shared/mockxdgshellv6.cpp rename to tests/auto/wayland/shared_old/mockxdgshellv6.cpp diff --git a/tests/auto/wayland/shared/mockxdgshellv6.h b/tests/auto/wayland/shared_old/mockxdgshellv6.h similarity index 100% rename from tests/auto/wayland/shared/mockxdgshellv6.h rename to tests/auto/wayland/shared_old/mockxdgshellv6.h diff --git a/tests/auto/wayland/shared_old/shared_old.pri b/tests/auto/wayland/shared_old/shared_old.pri new file mode 100644 index 00000000000..467e98115a2 --- /dev/null +++ b/tests/auto/wayland/shared_old/shared_old.pri @@ -0,0 +1,34 @@ +CONFIG += testcase link_pkgconfig +QT += testlib +QT += core-private gui-private waylandclient-private + +QMAKE_USE += wayland-client wayland-server + +CONFIG += wayland-scanner +WAYLANDSERVERSOURCES += \ + ../../../../src/3rdparty/protocol/ivi-application.xml \ + ../../../../src/3rdparty/protocol/wayland.xml \ + ../../../../src/3rdparty/protocol/xdg-shell-unstable-v6.xml \ + ../../../../src/3rdparty/protocol/fullscreen-shell-unstable-v1.xml + +INCLUDEPATH += ../shared_old + +SOURCES += \ + ../shared_old/mockcompositor.cpp \ + ../shared_old/mockfullscreenshellv1.cpp \ + ../shared_old/mockinput.cpp \ + ../shared_old/mockiviapplication.cpp \ + ../shared_old/mockwlshell.cpp \ + ../shared_old/mockxdgshellv6.cpp \ + ../shared_old/mocksurface.cpp \ + ../shared_old/mockoutput.cpp + +HEADERS += \ + ../shared_old/mockcompositor.h \ + ../shared_old/mockfullscreenshellv1.h \ + ../shared_old/mockinput.h \ + ../shared_old/mockiviapplication.h \ + ../shared_old/mockwlshell.h \ + ../shared_old/mockxdgshellv6.h \ + ../shared_old/mocksurface.h \ + ../shared_old/mockoutput.h diff --git a/tests/auto/wayland/surface/surface.pro b/tests/auto/wayland/surface/surface.pro new file mode 100644 index 00000000000..36882aa2df2 --- /dev/null +++ b/tests/auto/wayland/surface/surface.pro @@ -0,0 +1,5 @@ +include (../shared/shared.pri) + +TARGET = tst_surface +SOURCES += tst_surface.cpp + diff --git a/tests/auto/wayland/surface/tst_surface.cpp b/tests/auto/wayland/surface/tst_surface.cpp new file mode 100644 index 00000000000..dddff0866f0 --- /dev/null +++ b/tests/auto/wayland/surface/tst_surface.cpp @@ -0,0 +1,158 @@ +/**************************************************************************** +** +** Copyright (C) 2018 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "mockcompositor.h" +#include +#include + +using namespace MockCompositor; + +class tst_surface : public QObject, private DefaultCompositor +{ + Q_OBJECT +private slots: + void cleanup() { QTRY_VERIFY2(isClean(), qPrintable(dirtyMessage())); } + void createDestroySurface(); + void waitForFrameCallbackRaster(); + void waitForFrameCallbackGl(); + void negotiateShmFormat(); +}; + +void tst_surface::createDestroySurface() +{ + QWindow window; + window.show(); + + QCOMPOSITOR_TRY_VERIFY(surface()); + + window.destroy(); + QCOMPOSITOR_TRY_VERIFY(!surface()); +} + +void tst_surface::waitForFrameCallbackRaster() +{ + QSKIP("TODO: This currently fails, needs a fix"); + class TestWindow : public QRasterWindow { + public: + explicit TestWindow() { resize(40, 40); } + void paintEvent(QPaintEvent *event) override + { + Q_UNUSED(event); + update(); + } + }; + TestWindow window; + window.show(); + QCOMPOSITOR_TRY_VERIFY(xdgToplevel()); + QSignalSpy bufferSpy(exec([=] { return xdgSurface()->m_surface; }), &Surface::bufferCommitted); + exec([=] { xdgToplevel()->sendCompleteConfigure(); }); + + // We should get the first buffer without waiting for a frame callback + QTRY_COMPARE(bufferSpy.count(), 1); + bufferSpy.removeFirst(); + + // Make sure we follow frame callbacks for some frames + for (int i = 0; i < 5; ++i) { + xdgPingAndWaitForPong(); // Make sure things have happened on the client + exec([&] { + QVERIFY(bufferSpy.empty()); // Make sure no extra buffers have arrived + QVERIFY(!xdgToplevel()->surface()->m_waitingFrameCallbacks.empty()); + xdgToplevel()->surface()->sendFrameCallbacks(); + }); + QTRY_COMPARE(bufferSpy.count(), 1); + bufferSpy.removeFirst(); + } +} + +void tst_surface::waitForFrameCallbackGl() +{ + QSKIP("TODO: This currently fails, needs a fix"); + class TestWindow : public QOpenGLWindow { + public: + explicit TestWindow() + { + resize(40, 40); + connect(this, &QOpenGLWindow::frameSwapped, + this, QOverload<>::of(&QPaintDeviceWindow::update)); + update(); + } + void paintGL() override + { + glClearColor(1, 0, 0, 1); + glClear(GL_COLOR_BUFFER_BIT); + } + }; + TestWindow window; + window.show(); + QCOMPOSITOR_TRY_VERIFY(xdgToplevel()); + QSignalSpy bufferSpy(exec([=] { return xdgSurface()->m_surface; }), &Surface::bufferCommitted); + exec([=] { xdgToplevel()->sendCompleteConfigure(); }); + + // We should get the first buffer without waiting for a frame callback + QTRY_COMPARE(bufferSpy.count(), 1); + bufferSpy.removeFirst(); + + // Make sure we follow frame callbacks for some frames + for (int i = 0; i < 5; ++i) { + xdgPingAndWaitForPong(); // Make sure things have happened on the client + exec([&] { + QVERIFY(bufferSpy.empty()); // Make sure no extra buffers have arrived + QVERIFY(!xdgToplevel()->surface()->m_waitingFrameCallbacks.empty()); + xdgToplevel()->surface()->sendFrameCallbacks(); + }); + QTRY_COMPARE(bufferSpy.count(), 1); + bufferSpy.removeFirst(); + } +} + +void tst_surface::negotiateShmFormat() +{ + QSKIP("TODO: I'm not sure why we're choosing xrgb over argb in this case..."); + QRasterWindow window; + window.setFlag(Qt::FramelessWindowHint); // decorations force alpha + QSurfaceFormat format; + format.setAlphaBufferSize(0); + window.setFormat(format); + window.resize(64, 48); + window.show(); + QCOMPOSITOR_TRY_VERIFY(xdgToplevel()); + QSignalSpy bufferSpy(exec([=] { return xdgSurface()->m_surface; }), &Surface::bufferCommitted); + const uint serial = exec([=] { return xdgToplevel()->sendCompleteConfigure(); }); + QCOMPOSITOR_TRY_COMPARE(xdgSurface()->m_committedConfigureSerial, serial); + exec([&] { + Buffer *buffer = xdgToplevel()->surface()->m_committed.buffer; + QVERIFY(buffer); + auto *shmBuffer = ShmBuffer::fromBuffer(buffer); + QVERIFY(shmBuffer); + qDebug() << "shmBuffer->m_format" << shmBuffer->m_format; + QCOMPARE(shmBuffer->m_format, Shm::format_xrgb8888); + }); +} + +QCOMPOSITOR_TEST_MAIN(tst_surface) +#include "tst_surface.moc" diff --git a/tests/auto/wayland/xdgshell/tst_xdgshell.cpp b/tests/auto/wayland/xdgshell/tst_xdgshell.cpp new file mode 100644 index 00000000000..55e994b061a --- /dev/null +++ b/tests/auto/wayland/xdgshell/tst_xdgshell.cpp @@ -0,0 +1,269 @@ +/**************************************************************************** +** +** Copyright (C) 2018 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "mockcompositor.h" +#include +#include + +using namespace MockCompositor; + +class tst_xdgshell : public QObject, private DefaultCompositor +{ + Q_OBJECT +private slots: + void cleanup() { QTRY_VERIFY2(isClean(), qPrintable(dirtyMessage())); } + void showMinimized(); + void basicConfigure(); + void configureSize(); + void configureStates(); + void popup(); + void pongs(); +}; + +void tst_xdgshell::showMinimized() +{ + QSKIP("TODO: This currently fails, needs a fix"); + // On xdg-shell there's really no way for the compositor to tell the window if it's minimized + // There are wl_surface.enter events and so on, but there's really no way to differentiate + // between a window preview and an unminimized window. + QWindow window; + window.showMinimized(); + QCOMPARE(window.windowStates(), Qt::WindowMinimized); // should return minimized until + QTRY_COMPARE(window.windowStates(), Qt::WindowNoState); // rejected by handleWindowStateChanged + + // Make sure the window on the compositor side is/was created here, and not after the test + // finishes, as that may mess up for later tests. + QCOMPOSITOR_TRY_VERIFY(surface()); + QVERIFY(!window.isExposed()); +} + +void tst_xdgshell::basicConfigure() +{ + QRasterWindow window; + window.resize(64, 48); + window.show(); + QCOMPOSITOR_TRY_VERIFY(xdgToplevel()); + + QSignalSpy configureSpy(exec([=] { return xdgSurface(); }), &XdgSurface::configureCommitted); + + QTRY_VERIFY(window.isVisible()); + // The window should not be exposed before the first xdg_surface configure event + QTRY_VERIFY(!window.isExposed()); + + exec([=] { + xdgToplevel()->sendConfigure({0, 0}, {}); // Let the window decide the size + }); + + // Nothing should happen before the *xdg_surface* configure + QTRY_VERIFY(!window.isExposed()); //Window should not be exposed before the first configure event + QVERIFY(configureSpy.isEmpty()); + + const uint serial = exec([=] { return nextSerial(); }); + + exec([=] { + xdgSurface()->sendConfigure(serial); + }); + + // Finally, we're exposed + QTRY_VERIFY(window.isExposed()); + + // The client is now going to ack the configure + QTRY_COMPARE(configureSpy.count(), 1); + QCOMPARE(configureSpy.takeFirst().at(0).toUInt(), serial); + + // And attach a buffer + exec([&] { + Buffer *buffer = xdgToplevel()->surface()->m_committed.buffer; + QVERIFY(buffer); + QCOMPARE(buffer->size(), window.frameGeometry().size()); + }); +} + +void tst_xdgshell::configureSize() +{ + QRasterWindow window; + window.resize(64, 48); + window.show(); + QCOMPOSITOR_TRY_VERIFY(xdgToplevel()); + + QSignalSpy configureSpy(exec([=] { return xdgSurface(); }), &XdgSurface::configureCommitted); + + const QSize configureSize(60, 40); + + exec([=] { + xdgToplevel()->sendCompleteConfigure(configureSize); + }); + + QTRY_COMPARE(configureSpy.count(), 1); + + exec([=] { + Buffer *buffer = xdgToplevel()->surface()->m_committed.buffer; + QVERIFY(buffer); + QCOMPARE(buffer->size(), configureSize); + }); +} + +void tst_xdgshell::configureStates() +{ + QRasterWindow window; + window.resize(64, 48); + window.show(); + QCOMPOSITOR_TRY_VERIFY(xdgToplevel()); + + const QSize windowedSize(320, 240); + const uint windowedSerial = exec([=] { + return xdgToplevel()->sendCompleteConfigure(windowedSize, { XdgToplevel::state_activated }); + }); + QCOMPOSITOR_TRY_COMPARE(xdgSurface()->m_committedConfigureSerial, windowedSerial); + QCOMPARE(window.visibility(), QWindow::Windowed); + QCOMPARE(window.windowStates(), Qt::WindowNoState); + QCOMPARE(window.frameGeometry().size(), windowedSize); + // Toplevel windows don't know their position on xdg-shell +// QCOMPARE(window.frameGeometry().topLeft(), QPoint()); // TODO: this doesn't currently work when window decorations are enabled + +// QEXPECT_FAIL("", "configure has already been acked, we shouldn't have to wait for isActive", Continue); +// QVERIFY(window.isActive()); + QTRY_VERIFY(window.isActive()); // Just make sure it eventually get's set correctly + + const QSize screenSize(640, 480); + const uint maximizedSerial = exec([=] { + return xdgToplevel()->sendCompleteConfigure(screenSize, { XdgToplevel::state_activated, XdgToplevel::state_maximized }); + }); + QCOMPOSITOR_TRY_COMPARE(xdgSurface()->m_committedConfigureSerial, maximizedSerial); + QCOMPARE(window.visibility(), QWindow::Maximized); + QCOMPARE(window.windowStates(), Qt::WindowMaximized); + QCOMPARE(window.frameGeometry().size(), screenSize); +// QCOMPARE(window.frameGeometry().topLeft(), QPoint()); // TODO: this doesn't currently work when window decorations are enabled + + const uint fullscreenSerial = exec([=] { + return xdgToplevel()->sendCompleteConfigure(screenSize, { XdgToplevel::state_activated, XdgToplevel::state_fullscreen }); + }); + QCOMPOSITOR_TRY_COMPARE(xdgSurface()->m_committedConfigureSerial, fullscreenSerial); + QCOMPARE(window.visibility(), QWindow::FullScreen); + QCOMPARE(window.windowStates(), Qt::WindowFullScreen); + QCOMPARE(window.frameGeometry().size(), screenSize); +// QCOMPARE(window.frameGeometry().topLeft(), QPoint()); // TODO: this doesn't currently work when window decorations are enabled + + // The window should remember its original size + const uint restoreSerial = exec([=] { + return xdgToplevel()->sendCompleteConfigure({0, 0}, { XdgToplevel::state_activated }); + }); + QCOMPOSITOR_TRY_COMPARE(xdgSurface()->m_committedConfigureSerial, restoreSerial); + QCOMPARE(window.visibility(), QWindow::Windowed); + QCOMPARE(window.windowStates(), Qt::WindowNoState); + QCOMPARE(window.frameGeometry().size(), windowedSize); +// QCOMPARE(window.frameGeometry().topLeft(), QPoint()); // TODO: this doesn't currently work when window decorations are enabled +} + +void tst_xdgshell::popup() +{ + class Window : public QRasterWindow { + public: + void mousePressEvent(QMouseEvent *event) override + { + QRasterWindow::mousePressEvent(event); + m_popup.reset(new QRasterWindow); + m_popup->setTransientParent(this); + m_popup->setFlags(Qt::Popup); + m_popup->resize(100, 100); + m_popup->show(); + } + QScopedPointer m_popup; + }; + Window window; + window.resize(200, 200); + window.show(); + + QCOMPOSITOR_TRY_VERIFY(xdgToplevel()); + QSignalSpy toplevelConfigureSpy(exec([=] { return xdgSurface(); }), &XdgSurface::configureCommitted); + exec([=] { xdgToplevel()->sendCompleteConfigure(); }); + QTRY_COMPARE(toplevelConfigureSpy.count(), 1); + + uint clickSerial = exec([=] { + auto *surface = xdgToplevel()->surface(); + auto *p = pointer(); + p->sendEnter(surface, {100, 100}); +// p->sendFrame(); //TODO: uncomment when we support seat v5 + uint serial = p->sendButton(client(), BTN_LEFT, Pointer::button_state_pressed); + p->sendButton(client(), BTN_LEFT, Pointer::button_state_released); + return serial; +// p->sendFrame(); //TODO: uncomment when we support seat v5 + }); + + QTRY_VERIFY(window.m_popup); + QCOMPOSITOR_TRY_VERIFY(xdgPopup()); + QSignalSpy popupConfigureSpy(exec([=] { return xdgPopup()->m_xdgSurface; }), &XdgSurface::configureCommitted); + QCOMPOSITOR_TRY_VERIFY(xdgPopup()->m_grabbed); + QCOMPOSITOR_TRY_COMPARE(xdgPopup()->m_grabSerial, clickSerial); + + QRasterWindow *popup = window.m_popup.get(); + QVERIFY(!popup->isExposed()); // wait for configure + + //TODO: Verify it works with a different configure window geometry + exec([=] { xdgPopup()->sendConfigure(QRect(100, 100, 100, 100)); }); + + // Nothing should happen before the *xdg_surface* configure + QTRY_VERIFY(!popup->isExposed()); // Popup shouldn't be exposed before the first configure event + QVERIFY(popupConfigureSpy.isEmpty()); + + const uint configureSerial = exec([=] { + return xdgPopup()->m_xdgSurface->sendConfigure(); + }); + + // Finally, we're exposed + QTRY_VERIFY(popup->isExposed()); + + // The client is now going to ack the configure + QTRY_COMPARE(popupConfigureSpy.count(), 1); + QCOMPARE(popupConfigureSpy.takeFirst().at(0).toUInt(), configureSerial); + + // And attach a buffer + exec([&] { + Buffer *buffer = xdgPopup()->surface()->m_committed.buffer; + QVERIFY(buffer); + QCOMPARE(buffer->size(), popup->frameGeometry().size()); + }); +} + +void tst_xdgshell::pongs() +{ + QSignalSpy pongSpy(exec([=] { return get(); }), &XdgWmBase::pong); + // Verify that the client has bound to the global + QCOMPOSITOR_TRY_COMPARE(get()->resourceMap().size(), 1); + const uint serial = exec([=] { return nextSerial(); }); + exec([=] { + auto *base = get(); + wl_resource *resource = base->resourceMap().first()->handle; + base->send_ping(resource, serial); + }); + QTRY_COMPARE(pongSpy.count(), 1); + QCOMPARE(pongSpy.first().at(0).toUInt(), serial); +} + +QCOMPOSITOR_TEST_MAIN(tst_xdgshell) +#include "tst_xdgshell.moc" diff --git a/tests/auto/wayland/xdgshell/xdgshell.pro b/tests/auto/wayland/xdgshell/xdgshell.pro new file mode 100644 index 00000000000..d7c3f9df658 --- /dev/null +++ b/tests/auto/wayland/xdgshell/xdgshell.pro @@ -0,0 +1,5 @@ +include (../shared/shared.pri) + +TARGET = tst_xdgshell +SOURCES += tst_xdgshell.cpp + diff --git a/tests/auto/wayland/xdgshellv6/xdgshellv6.pro b/tests/auto/wayland/xdgshellv6/xdgshellv6.pro index 4fec593df19..cc8a22d83e0 100644 --- a/tests/auto/wayland/xdgshellv6/xdgshellv6.pro +++ b/tests/auto/wayland/xdgshellv6/xdgshellv6.pro @@ -1,4 +1,4 @@ -include (../shared/shared.pri) +include (../shared_old/shared_old.pri) TARGET = tst_client_xdgshellv6 SOURCES += tst_xdgshellv6.cpp From 98b7643fdd5af8a4dccf2e6e6f2bc3bedda7d23f Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Thu, 6 Dec 2018 09:06:33 +0100 Subject: [PATCH 0623/1507] Client: Clarify warnings about unexpected enter/leave events With the previous wording it was a bit unclear whether this was a client problem or not. Also adds logging category. Change-Id: I61084c0b2c7f17408575d1d4b6cc7809c4c6d99d Reviewed-by: David Edmundson Reviewed-by: Paul Olav Tvete --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 8e8726f0218..029820e2c7f 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -496,9 +496,11 @@ void QWaylandWindow::surface_enter(wl_output *output) auto addedScreen = QWaylandScreen::fromWlOutput(output); if (mScreens.contains(addedScreen)) { - qWarning() << "Unexpected wl_surface.enter received for output with id:" - << wl_proxy_get_id(reinterpret_cast(output)) - << "screen name:" << addedScreen->name() << "screen model:" << addedScreen->model(); + qWarning(lcQpaWayland) << "Ignoring unexpected wl_surface.enter received for output with id:" + << wl_proxy_get_id(reinterpret_cast(output)) + << "screen name:" << addedScreen->name() + << "screen model:" << addedScreen->model() + << "This is most likely a bug in the compositor."; return; } @@ -515,9 +517,11 @@ void QWaylandWindow::surface_leave(wl_output *output) auto *removedScreen = QWaylandScreen::fromWlOutput(output); bool wasRemoved = mScreens.removeOne(removedScreen); if (!wasRemoved) { - qWarning() << "Unexpected wl_surface.leave received for output with id:" - << wl_proxy_get_id(reinterpret_cast(output)) - << "screen name:" << removedScreen->name() << "screen model:" << removedScreen->model(); + qWarning(lcQpaWayland) << "Ignoring unexpected wl_surface.leave received for output with id:" + << wl_proxy_get_id(reinterpret_cast(output)) + << "screen name:" << removedScreen->name() + << "screen model:" << removedScreen->model() + << "This is most likely a bug in the compositor."; return; } From ed34fa051d8caaf468351ee8542eeffaeb4fd31d Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Thu, 13 Dec 2018 09:05:51 +0100 Subject: [PATCH 0624/1507] Client tests: Add simple test for mouse click Change-Id: I2eb9bf8aa03e8df61a26d26da061f4030d8de0be Reviewed-by: Paul Olav Tvete --- tests/auto/wayland/seatv4/tst_seatv4.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/tests/auto/wayland/seatv4/tst_seatv4.cpp b/tests/auto/wayland/seatv4/tst_seatv4.cpp index a95dbfcc2d4..0e0ada5d0a2 100644 --- a/tests/auto/wayland/seatv4/tst_seatv4.cpp +++ b/tests/auto/wayland/seatv4/tst_seatv4.cpp @@ -62,6 +62,7 @@ private slots: void createsPointer(); void setsCursorOnEnter(); void usesEnterSerial(); + void mousePress(); void simpleAxis_data(); void simpleAxis(); void invalidPointerEvents(); @@ -114,6 +115,28 @@ void tst_seatv4::usesEnterSerial() QCOMPARE(setCursorSpy.takeFirst().at(0).toUInt(), enterSerial); } +void tst_seatv4::mousePress() +{ + class Window : public QRasterWindow { + public: + void mousePressEvent(QMouseEvent *) override { m_pressed = true; } + bool m_pressed = false; + }; + + Window window; + window.resize(64, 64); + window.show(); + QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial); + + exec([&] { + auto *surface = xdgSurface()->m_surface; + pointer()->sendEnter(surface, {32, 32}); + pointer()->sendButton(client(), BTN_LEFT, 1); + pointer()->sendButton(client(), BTN_LEFT, 0); + }); + QTRY_VERIFY(window.m_pressed); +} + void tst_seatv4::simpleAxis_data() { QTest::addColumn("axis"); From 24ef6801e42b15be0f31860476199106c69e15d6 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Thu, 1 Nov 2018 10:07:14 +0100 Subject: [PATCH 0625/1507] Client: Full implementation for frame callbacks The Wayland plugin now takes full control over delivering update request and implement frame callbacks for both egl and shm. Fixes two bugs: [ChangeLog][Client] The non-blocking version of eglSwapBuffers is now used. This fixed a bug where minimized windows would block the event loop. Also, when we relied on the QPA version of requestUpdate, we would sometimes deliver one update request while we were waiting for a frame callback. When we implement the fallback timer ourselves we can make sure we only deliver the fallback if there are no pending frame callbacks. Fixes: QTBUG-69077 Change-Id: I2d3a6896c32e63d8520b57448a3601a817816a91 Reviewed-by: Paul Olav Tvete --- .../platforms/wayland/qwaylandwindow.cpp | 107 ++++++++++++++---- .../platforms/wayland/qwaylandwindow_p.h | 9 +- 2 files changed, 96 insertions(+), 20 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 4ac2ca51e1e..f596438b6e1 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -358,6 +358,8 @@ void QWaylandWindow::sendExposeEvent(const QRect &rect) { if (!(mShellSurface && mShellSurface->handleExpose(rect))) QWindowSystemInterface::handleExposeEvent(window(), rect); + else + qCDebug(lcQpaWayland) << "sendExposeEvent: intercepted by shell extension, not sending"; mLastExposeGeometry = rect; } @@ -542,18 +544,11 @@ void QWaylandWindow::handleScreenRemoved(QScreen *qScreen) void QWaylandWindow::attach(QWaylandBuffer *buffer, int x, int y) { Q_ASSERT(!buffer->committed()); - if (mFrameCallback) { - wl_callback_destroy(mFrameCallback); - mFrameCallback = nullptr; - } - if (buffer) { - mFrameCallback = frame(); - wl_callback_add_listener(mFrameCallback, &QWaylandWindow::callbackListener, this); - mWaitingForFrameSync = true; + handleUpdate(); buffer->setBusy(); - attach(buffer->buffer(), x, y); + QtWayland::wl_surface::attach(buffer->buffer(), x, y); } else { QtWayland::wl_surface::attach(nullptr, 0, 0); } @@ -618,11 +613,9 @@ void QWaylandWindow::frameCallback(void *data, struct wl_callback *callback, uin Q_UNUSED(callback); QWaylandWindow *self = static_cast(data); - self->mWaitingForFrameSync = false; - if (self->mUpdateRequested) { - self->mUpdateRequested = false; + self->mWaitingForFrameCallback = false; + if (self->mUpdateRequested) self->deliverUpdateRequest(); - } } QMutex QWaylandWindow::mFrameSyncMutex; @@ -630,10 +623,10 @@ QMutex QWaylandWindow::mFrameSyncMutex; void QWaylandWindow::waitForFrameSync() { QMutexLocker locker(&mFrameSyncMutex); - if (!mWaitingForFrameSync) + if (!mWaitingForFrameCallback) return; mDisplay->flushRequests(); - while (mWaitingForFrameSync) + while (mWaitingForFrameCallback) mDisplay->blockingReadEvents(); } @@ -1034,12 +1027,88 @@ QVariant QWaylandWindow::property(const QString &name, const QVariant &defaultVa return m_properties.value(name, defaultValue); } +void QWaylandWindow::timerEvent(QTimerEvent *event) +{ + if (event->timerId() == mFallbackUpdateTimerId) { + killTimer(mFallbackUpdateTimerId); + mFallbackUpdateTimerId = -1; + + if (!isExposed()) { + qCDebug(lcWaylandBackingstore) << "Fallback update timer: Window not exposed," + << "not delivering update request."; + return; + } + + if (mWaitingForUpdate && mUpdateRequested && !mWaitingForFrameCallback) { + qCWarning(lcWaylandBackingstore) << "Delivering update request through fallback timer," + << "may not be in sync with display"; + deliverUpdateRequest(); + } + } +} + void QWaylandWindow::requestUpdate() { - if (!mWaitingForFrameSync) - QPlatformWindow::requestUpdate(); - else - mUpdateRequested = true; + if (mUpdateRequested) + return; + + mUpdateRequested = true; + + // If we have a frame callback all is good and will be taken care of there + if (mWaitingForFrameCallback) + return; + + // If we've already called deliverUpdateRequest(), but haven't seen any attach+commit/swap yet + if (mWaitingForUpdate) { + // Ideally, we should just have returned here, but we're not guaranteed that the client + // will actually update, so start this timer to deliver another request update after a while + // *IF* the client doesn't update. + int fallbackTimeout = 100; + mFallbackUpdateTimerId = startTimer(fallbackTimeout); + return; + } + + // Some applications (such as Qt Quick) depend on updates being delivered asynchronously, + // so use invokeMethod to delay the delivery a bit. + QMetaObject::invokeMethod(this, [this] { + // Things might have changed in the meantime + if (mUpdateRequested && !mWaitingForUpdate && !mWaitingForFrameCallback) + deliverUpdateRequest(); + }, Qt::QueuedConnection); +} + +// Should be called whenever we commit a buffer (directly through wl_surface.commit or indirectly +// with eglSwapBuffers) to know when it's time to commit the next one. +// Can be called from the render thread (without locking anything) so make sure to not make races in this method. +void QWaylandWindow::handleUpdate() +{ + // TODO: Should sync subsurfaces avoid requesting frame callbacks? + + if (mFrameCallback) { + wl_callback_destroy(mFrameCallback); + mFrameCallback = nullptr; + } + + if (mFallbackUpdateTimerId != -1) { + // Ideally, we would stop the fallback timer here, but since we're on another thread, + // it's not allowed. Instead we set mFallbackUpdateTimer to -1 here, so we'll just + // ignore it if it times out before it's cleaned up by the invokeMethod call. + int id = mFallbackUpdateTimerId; + mFallbackUpdateTimerId = -1; + QMetaObject::invokeMethod(this, [=] { killTimer(id); }, Qt::QueuedConnection); + } + + mFrameCallback = frame(); + wl_callback_add_listener(mFrameCallback, &QWaylandWindow::callbackListener, this); + mWaitingForFrameCallback = true; + mWaitingForUpdate = false; +} + +void QWaylandWindow::deliverUpdateRequest() +{ + mUpdateRequested = false; + mWaitingForUpdate = true; + QPlatformWindow::deliverUpdateRequest(); } void QWaylandWindow::addAttachOffset(const QPoint point) diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index 56ebd3cc641..e5838d23173 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -191,7 +191,10 @@ public: bool startSystemMove(const QPoint &pos) override; + void timerEvent(QTimerEvent *event) override; void requestUpdate() override; + void handleUpdate(); + void deliverUpdateRequest() override; public slots: void applyConfigure(); @@ -211,10 +214,14 @@ protected: Qt::MouseButtons mMousePressedInContentArea = Qt::NoButton; WId mWindowId; - bool mWaitingForFrameSync = false; + bool mWaitingForFrameCallback = false; struct ::wl_callback *mFrameCallback = nullptr; QWaitCondition mFrameSyncWait; + // True when we have called deliverRequestUpdate, but the client has not yet attached a new buffer + bool mWaitingForUpdate = false; + int mFallbackUpdateTimerId = -1; + QMutex mResizeLock; bool mWaitingToApplyConfigure = false; bool mCanResize = true; From 30e8e1535548656ee7d458546b86854a9b9c6f2a Mon Sep 17 00:00:00 2001 From: Andreas Cord-Landwehr Date: Wed, 6 Dec 2017 13:30:12 +0100 Subject: [PATCH 0626/1507] Compositor: Implement linux-dmabuf-unstable-v1 [ChangeLog][Compositor] Added support for linux-dmabuf-unstable-v1. Implement client side DMABUF buffer sharing support by supporting the linux-dmabuf-unstable-v1 (version 3) protocol. For enabling DMABUF, set the following environment variables for the compositor: QT_QPA_PLATFORM=eglfs QT_WAYLAND_CLIENT_BUFFER_INTEGRATION=linux-dmabuf-unstable-v1 The current implementation supports the following DRM buffer formats: - RGB and RGBA - YUYV This implementation requires Mesa with the following patch applied. Otherwise, textures are not updated. The patch is contained in Mesa 18.1.5. See https://patchwork.freedesktop.org/patch/238080/ Fixes: QTBUG-66288 Fixes: QTBUG-67845 Change-Id: Id4d90337dbe0be956b0f964426ebed3f281c6c30 Reviewed-by: Johan Helsing --- .../protocols/linux-dmabuf-unstable-v1.xml | 348 ++++++++++++++++++ .../wayland/protocols/qt_attribution.json | 15 + .../platforms/wayland/qwaylandintegration.cpp | 6 +- 3 files changed, 367 insertions(+), 2 deletions(-) create mode 100644 src/3rdparty/wayland/protocols/linux-dmabuf-unstable-v1.xml diff --git a/src/3rdparty/wayland/protocols/linux-dmabuf-unstable-v1.xml b/src/3rdparty/wayland/protocols/linux-dmabuf-unstable-v1.xml new file mode 100644 index 00000000000..154afe23e1b --- /dev/null +++ b/src/3rdparty/wayland/protocols/linux-dmabuf-unstable-v1.xml @@ -0,0 +1,348 @@ + + + + + Copyright © 2014, 2015 Collabora, Ltd. + + 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. + + + + + Following the interfaces from: + https://www.khronos.org/registry/egl/extensions/EXT/EGL_EXT_image_dma_buf_import.txt + and the Linux DRM sub-system's AddFb2 ioctl. + + This interface offers ways to create generic dmabuf-based + wl_buffers. Immediately after a client binds to this interface, + the set of supported formats and format modifiers is sent with + 'format' and 'modifier' events. + + The following are required from clients: + + - Clients must ensure that either all data in the dma-buf is + coherent for all subsequent read access or that coherency is + correctly handled by the underlying kernel-side dma-buf + implementation. + + - Don't make any more attachments after sending the buffer to the + compositor. Making more attachments later increases the risk of + the compositor not being able to use (re-import) an existing + dmabuf-based wl_buffer. + + The underlying graphics stack must ensure the following: + + - The dmabuf file descriptors relayed to the server will stay valid + for the whole lifetime of the wl_buffer. This means the server may + at any time use those fds to import the dmabuf into any kernel + sub-system that might accept it. + + To create a wl_buffer from one or more dmabufs, a client creates a + zwp_linux_dmabuf_params_v1 object with a zwp_linux_dmabuf_v1.create_params + request. All planes required by the intended format are added with + the 'add' request. Finally, a 'create' or 'create_immed' request is + issued, which has the following outcome depending on the import success. + + The 'create' request, + - on success, triggers a 'created' event which provides the final + wl_buffer to the client. + - on failure, triggers a 'failed' event to convey that the server + cannot use the dmabufs received from the client. + + For the 'create_immed' request, + - on success, the server immediately imports the added dmabufs to + create a wl_buffer. No event is sent from the server in this case. + - on failure, the server can choose to either: + - terminate the client by raising a fatal error. + - mark the wl_buffer as failed, and send a 'failed' event to the + client. If the client uses a failed wl_buffer as an argument to any + request, the behaviour is compositor implementation-defined. + + Warning! The protocol described in this file is experimental and + backward incompatible changes may be made. Backward compatible changes + may be added together with the corresponding interface version bump. + Backward incompatible changes are done by bumping the version number in + the protocol and interface names and resetting the interface version. + Once the protocol is to be declared stable, the 'z' prefix and the + version number in the protocol and interface names are removed and the + interface version number is reset. + + + + + Objects created through this interface, especially wl_buffers, will + remain valid. + + + + + + This temporary object is used to collect multiple dmabuf handles into + a single batch to create a wl_buffer. It can only be used once and + should be destroyed after a 'created' or 'failed' event has been + received. + + + + + + + This event advertises one buffer format that the server supports. + All the supported formats are advertised once when the client + binds to this interface. A roundtrip after binding guarantees + that the client has received all supported formats. + + For the definition of the format codes, see the + zwp_linux_buffer_params_v1::create request. + + Warning: the 'format' event is likely to be deprecated and replaced + with the 'modifier' event introduced in zwp_linux_dmabuf_v1 + version 3, described below. Please refrain from using the information + received from this event. + + + + + + + This event advertises the formats that the server supports, along with + the modifiers supported for each format. All the supported modifiers + for all the supported formats are advertised once when the client + binds to this interface. A roundtrip after binding guarantees that + the client has received all supported format-modifier pairs. + + For the definition of the format and modifier codes, see the + zwp_linux_buffer_params_v1::create request. + + + + + + + + + + This temporary object is a collection of dmabufs and other + parameters that together form a single logical buffer. The temporary + object may eventually create one wl_buffer unless cancelled by + destroying it before requesting 'create'. + + Single-planar formats only require one dmabuf, however + multi-planar formats may require more than one dmabuf. For all + formats, an 'add' request must be called once per plane (even if the + underlying dmabuf fd is identical). + + You must use consecutive plane indices ('plane_idx' argument for 'add') + from zero to the number of planes used by the drm_fourcc format code. + All planes required by the format must be given exactly once, but can + be given in any order. Each plane index can be set only once. + + + + + + + + + + + + + + + + Cleans up the temporary data sent to the server for dmabuf-based + wl_buffer creation. + + + + + + This request adds one dmabuf to the set in this + zwp_linux_buffer_params_v1. + + The 64-bit unsigned value combined from modifier_hi and modifier_lo + is the dmabuf layout modifier. DRM AddFB2 ioctl calls this the + fb modifier, which is defined in drm_mode.h of Linux UAPI. + This is an opaque token. Drivers use this token to express tiling, + compression, etc. driver-specific modifications to the base format + defined by the DRM fourcc code. + + This request raises the PLANE_IDX error if plane_idx is too large. + The error PLANE_SET is raised if attempting to set a plane that + was already set. + + + + + + + + + + + + + + + + + + This asks for creation of a wl_buffer from the added dmabuf + buffers. The wl_buffer is not created immediately but returned via + the 'created' event if the dmabuf sharing succeeds. The sharing + may fail at runtime for reasons a client cannot predict, in + which case the 'failed' event is triggered. + + The 'format' argument is a DRM_FORMAT code, as defined by the + libdrm's drm_fourcc.h. The Linux kernel's DRM sub-system is the + authoritative source on how the format codes should work. + + The 'flags' is a bitfield of the flags defined in enum "flags". + 'y_invert' means the that the image needs to be y-flipped. + + Flag 'interlaced' means that the frame in the buffer is not + progressive as usual, but interlaced. An interlaced buffer as + supported here must always contain both top and bottom fields. + The top field always begins on the first pixel row. The temporal + ordering between the two fields is top field first, unless + 'bottom_first' is specified. It is undefined whether 'bottom_first' + is ignored if 'interlaced' is not set. + + This protocol does not convey any information about field rate, + duration, or timing, other than the relative ordering between the + two fields in one buffer. A compositor may have to estimate the + intended field rate from the incoming buffer rate. It is undefined + whether the time of receiving wl_surface.commit with a new buffer + attached, applying the wl_surface state, wl_surface.frame callback + trigger, presentation, or any other point in the compositor cycle + is used to measure the frame or field times. There is no support + for detecting missed or late frames/fields/buffers either, and + there is no support whatsoever for cooperating with interlaced + compositor output. + + The composited image quality resulting from the use of interlaced + buffers is explicitly undefined. A compositor may use elaborate + hardware features or software to deinterlace and create progressive + output frames from a sequence of interlaced input buffers, or it + may produce substandard image quality. However, compositors that + cannot guarantee reasonable image quality in all cases are recommended + to just reject all interlaced buffers. + + Any argument errors, including non-positive width or height, + mismatch between the number of planes and the format, bad + format, bad offset or stride, may be indicated by fatal protocol + errors: INCOMPLETE, INVALID_FORMAT, INVALID_DIMENSIONS, + OUT_OF_BOUNDS. + + Dmabuf import errors in the server that are not obvious client + bugs are returned via the 'failed' event as non-fatal. This + allows attempting dmabuf sharing and falling back in the client + if it fails. + + This request can be sent only once in the object's lifetime, after + which the only legal request is destroy. This object should be + destroyed after issuing a 'create' request. Attempting to use this + object after issuing 'create' raises ALREADY_USED protocol error. + + It is not mandatory to issue 'create'. If a client wants to + cancel the buffer creation, it can just destroy this object. + + + + + + + + + + This event indicates that the attempted buffer creation was + successful. It provides the new wl_buffer referencing the dmabuf(s). + + Upon receiving this event, the client should destroy the + zlinux_dmabuf_params object. + + + + + + + This event indicates that the attempted buffer creation has + failed. It usually means that one of the dmabuf constraints + has not been fulfilled. + + Upon receiving this event, the client should destroy the + zlinux_buffer_params object. + + + + + + This asks for immediate creation of a wl_buffer by importing the + added dmabufs. + + In case of import success, no event is sent from the server, and the + wl_buffer is ready to be used by the client. + + Upon import failure, either of the following may happen, as seen fit + by the implementation: + - the client is terminated with one of the following fatal protocol + errors: + - INCOMPLETE, INVALID_FORMAT, INVALID_DIMENSIONS, OUT_OF_BOUNDS, + in case of argument errors such as mismatch between the number + of planes and the format, bad format, non-positive width or + height, or bad offset or stride. + - INVALID_WL_BUFFER, in case the cause for failure is unknown or + plaform specific. + - the server creates an invalid wl_buffer, marks it as failed and + sends a 'failed' event to the client. The result of using this + invalid wl_buffer as an argument in any request by the client is + defined by the compositor implementation. + + This takes the same arguments as a 'create' request, and obeys the + same restrictions. + + + + + + + + + + + diff --git a/src/3rdparty/wayland/protocols/qt_attribution.json b/src/3rdparty/wayland/protocols/qt_attribution.json index 615e95a9f34..3b286dbd446 100644 --- a/src/3rdparty/wayland/protocols/qt_attribution.json +++ b/src/3rdparty/wayland/protocols/qt_attribution.json @@ -122,5 +122,20 @@ Copyright © 2010-2013 Intel Corporation" "LicenseFile": "HPND_LICENSE.txt", "Copyright": "Copyright © 2012, 2013 Intel Corporation Copyright © 2015, 2016 Jan Arne Petersen" + }, + + { + "Id": "wayland-linux-dmabuf-unstable-v1", + "Name": "Wayland Linux Dmabuf Unstable V1 Protocol", + "QDocModule": "qtwaylandcompositor", + "QtUsage": "Used in the Qt Wayland Compositor", + "Files": "linux-dmabuf-unstable-v1.xml", + + "Description": "The linux dmabuf protocol is a way to create dmabuf-based wl_buffers", + "Homepage": "https://wayland.freedesktop.org", + "LicenseId": "MIT", + "License": "MIT License", + "LicenseFile": "MIT_LICENSE.txt", + "Copyright": "Copyright © 2014, 2015 Collabora, Ltd." } ] diff --git a/src/plugins/platforms/wayland/qwaylandintegration.cpp b/src/plugins/platforms/wayland/qwaylandintegration.cpp index 073258d41e7..1ffaf3c8930 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandintegration.cpp @@ -342,10 +342,12 @@ void QWaylandIntegration::initializeClientBufferIntegration() QString targetKey = QString::fromLocal8Bit(qgetenv("QT_WAYLAND_CLIENT_BUFFER_INTEGRATION")); if (targetKey.isEmpty()) { - if (mDisplay->hardwareIntegration()) + if (mDisplay->hardwareIntegration() + && mDisplay->hardwareIntegration()->clientBufferIntegration() != QLatin1String("linux-dmabuf-unstable-v1")) { targetKey = mDisplay->hardwareIntegration()->clientBufferIntegration(); - else + } else { targetKey = QLatin1Literal("wayland-egl"); + } } if (targetKey.isEmpty()) { From 433901b37d17ea424f912a37941e16e27b2923e0 Mon Sep 17 00:00:00 2001 From: Gatis Paeglis Date: Sat, 15 Dec 2018 23:06:30 +0100 Subject: [PATCH 0627/1507] remove stray Q_UNUSED call The variable actually is used. Change-Id: I758c35e49b5c9f861ae40c34dcd4fa60d85361ae Reviewed-by: Johan Helsing --- src/plugins/platforms/wayland/qwaylanddisplay.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index bd75b6bcde0..91c1d4115dd 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -236,8 +236,6 @@ void QWaylandDisplay::waitForScreens() void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uint32_t version) { - Q_UNUSED(version); - struct ::wl_registry *registry = object(); if (interface == QStringLiteral("wl_output")) { From ac1d9c43e6db439e2d15c9e53d4423c99716e1ce Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Fri, 21 Dec 2018 14:41:03 +0100 Subject: [PATCH 0628/1507] Client xdg-shell: Fix protocol error for tooltips on popups [ChangeLog][QPA plugin] Fixed a protocol error that used to happen when closing a menu with an active tooltip. Fixes: QTBUG-71734 Change-Id: I784fef08494fabaa4debea11f51116cf9de1f86e Reviewed-by: David Edmundson Reviewed-by: Pier Luigi Fiorini --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index f596438b6e1..470ae00910a 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -386,7 +386,7 @@ QWaylandScreen *QWaylandWindow::calculateScreenFromSurfaceEvents() const void QWaylandWindow::setVisible(bool visible) { if (visible) { - if (window()->type() == Qt::Popup) + if (window()->type() & (Qt::Popup | Qt::ToolTip)) activePopups << this; initWindow(); mDisplay->flushRequests(); From dffa087e4762ef5057e8f7ccce3805f8d7dc29a5 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Tue, 16 Oct 2018 09:06:20 +0200 Subject: [PATCH 0629/1507] Compositor: Implement support for the viewporter extension [ChangeLog][Compositor] Added support for the viewporter Wayland extension. Change-Id: I1d33652fab6ff18da4ae1ae3497f0ca43517420a Reviewed-by: Pier Luigi Fiorini --- .../wayland/protocols/qt_attribution.json | 17 ++ src/3rdparty/wayland/protocols/viewporter.xml | 186 ++++++++++++++++++ 2 files changed, 203 insertions(+) create mode 100644 src/3rdparty/wayland/protocols/viewporter.xml diff --git a/src/3rdparty/wayland/protocols/qt_attribution.json b/src/3rdparty/wayland/protocols/qt_attribution.json index 3b286dbd446..47729311833 100644 --- a/src/3rdparty/wayland/protocols/qt_attribution.json +++ b/src/3rdparty/wayland/protocols/qt_attribution.json @@ -55,6 +55,23 @@ Copyright © 2015 Jonas Ådahl" Copyright (c) 2013 BMW Car IT GmbH" }, + { + "Id": "wayland-viewporter-protocol", + "Name": "Wayland Viewporter Protocol", + "QDocModule": "qtwaylandcompositor", + "QtUsage": "Used in the Qt Wayland Compositor API", + "Files": "viewporter.xml", + + "Description": "The Wayland viewporter extension allows a client to scale or crop a surface without modifying the buffer", + "Homepage": "https://wayland.freedesktop.org", + "Version": "1", + "DownloadLocation": "https://cgit.freedesktop.org/wayland/wayland-protocols/plain/stable/viewporter/viewporter.xml", + "LicenseId": "MIT", + "License": "MIT License", + "LicenseFile": "MIT_LICENSE.txt", + "Copyright": "Copyright © 2013-2016 Collabora, Ltd." + }, + { "Id": "wayland-xdg-decoration-protocol", "Name": "Wayland xdg-decoration Protocol", diff --git a/src/3rdparty/wayland/protocols/viewporter.xml b/src/3rdparty/wayland/protocols/viewporter.xml new file mode 100644 index 00000000000..c732d8c35bc --- /dev/null +++ b/src/3rdparty/wayland/protocols/viewporter.xml @@ -0,0 +1,186 @@ + + + + + Copyright © 2013-2016 Collabora, Ltd. + + 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. + + + + + The global interface exposing surface cropping and scaling + capabilities is used to instantiate an interface extension for a + wl_surface object. This extended interface will then allow + cropping and scaling the surface contents, effectively + disconnecting the direct relationship between the buffer and the + surface size. + + + + + Informs the server that the client will not be using this + protocol object anymore. This does not affect any other objects, + wp_viewport objects included. + + + + + + + + + + Instantiate an interface extension for the given wl_surface to + crop and scale its content. If the given wl_surface already has + a wp_viewport object associated, the viewport_exists + protocol error is raised. + + + + + + + + + An additional interface to a wl_surface object, which allows the + client to specify the cropping and scaling of the surface + contents. + + This interface works with two concepts: the source rectangle (src_x, + src_y, src_width, src_height), and the destination size (dst_width, + dst_height). The contents of the source rectangle are scaled to the + destination size, and content outside the source rectangle is ignored. + This state is double-buffered, and is applied on the next + wl_surface.commit. + + The two parts of crop and scale state are independent: the source + rectangle, and the destination size. Initially both are unset, that + is, no scaling is applied. The whole of the current wl_buffer is + used as the source, and the surface size is as defined in + wl_surface.attach. + + If the destination size is set, it causes the surface size to become + dst_width, dst_height. The source (rectangle) is scaled to exactly + this size. This overrides whatever the attached wl_buffer size is, + unless the wl_buffer is NULL. If the wl_buffer is NULL, the surface + has no content and therefore no size. Otherwise, the size is always + at least 1x1 in surface local coordinates. + + If the source rectangle is set, it defines what area of the wl_buffer is + taken as the source. If the source rectangle is set and the destination + size is not set, then src_width and src_height must be integers, and the + surface size becomes the source rectangle size. This results in cropping + without scaling. If src_width or src_height are not integers and + destination size is not set, the bad_size protocol error is raised when + the surface state is applied. + + The coordinate transformations from buffer pixel coordinates up to + the surface-local coordinates happen in the following order: + 1. buffer_transform (wl_surface.set_buffer_transform) + 2. buffer_scale (wl_surface.set_buffer_scale) + 3. crop and scale (wp_viewport.set*) + This means, that the source rectangle coordinates of crop and scale + are given in the coordinates after the buffer transform and scale, + i.e. in the coordinates that would be the surface-local coordinates + if the crop and scale was not applied. + + If src_x or src_y are negative, the bad_value protocol error is raised. + Otherwise, if the source rectangle is partially or completely outside of + the non-NULL wl_buffer, then the out_of_buffer protocol error is raised + when the surface state is applied. A NULL wl_buffer does not raise the + out_of_buffer error. + + The x, y arguments of wl_surface.attach are applied as normal to + the surface. They indicate how many pixels to remove from the + surface size from the left and the top. In other words, they are + still in the surface-local coordinate system, just like dst_width + and dst_height are. + + If the wl_surface associated with the wp_viewport is destroyed, + all wp_viewport requests except 'destroy' raise the protocol error + no_surface. + + If the wp_viewport object is destroyed, the crop and scale + state is removed from the wl_surface. The change will be applied + on the next wl_surface.commit. + + + + + The associated wl_surface's crop and scale state is removed. + The change is applied on the next wl_surface.commit. + + + + + + + + + + + + + Set the source rectangle of the associated wl_surface. See + wp_viewport for the description, and relation to the wl_buffer + size. + + If all of x, y, width and height are -1.0, the source rectangle is + unset instead. Any other set of values where width or height are zero + or negative, or x or y are negative, raise the bad_value protocol + error. + + The crop and scale state is double-buffered state, and will be + applied on the next wl_surface.commit. + + + + + + + + + + Set the destination size of the associated wl_surface. See + wp_viewport for the description, and relation to the wl_buffer + size. + + If width is -1 and height is -1, the destination size is unset + instead. Any other pair of values for width and height that + contains zero or negative values raises the bad_value protocol + error. + + The crop and scale state is double-buffered state, and will be + applied on the next wl_surface.commit. + + + + + + + From 08c6462d1bda473d94fdd446bbfecb13279fb30f Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Mon, 3 Dec 2018 10:35:13 +0100 Subject: [PATCH 0630/1507] Client: Fix various input related crashes for events without focus Some compositors fail to send wl_pointer.enter events before button and axis events. This led to nullptr dereference crashes. [ChangeLog][QPA plugin] Fixed a crash caused by compositors sending incorrect pointer events. Fix it by adding nullptr checks before trying to access the pointer focus in case the compositor didn't send enter, or if something deleted the surface (it's a QPointer). This means we are now silently ignoring events for misbehaving compositors (which is probably not optimal), but I don't see how we can easily distinguish between a missing enter and a deleted QWaylandSurface without adding more bookkeeping overhead. Ditto for wl_keyboard. Fixes: QTBUG-72235 Change-Id: I4bfaa3da4ebae37b059e1e450975566559edf40b Reviewed-by: Pier Luigi Fiorini --- .../platforms/wayland/qwaylandinputdevice.cpp | 39 ++++++++++++------- 1 file changed, 25 insertions(+), 14 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index ba55e6e1721..90e138a3dcc 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -499,10 +499,9 @@ public: void QWaylandInputDevice::Pointer::pointer_motion(uint32_t time, wl_fixed_t surface_x, wl_fixed_t surface_y) { QWaylandWindow *window = mFocus; - if (!window) { - // We destroyed the pointer focus surface, but the server - // didn't get the message yet. + // We destroyed the pointer focus surface, but the server didn't get the message yet... + // or the server didn't send an enter event first. In either case, ignore the event. return; } @@ -533,6 +532,12 @@ void QWaylandInputDevice::Pointer::pointer_button(uint32_t serial, uint32_t time uint32_t button, uint32_t state) { QWaylandWindow *window = mFocus; + if (!window) { + // We destroyed the pointer focus surface, but the server didn't get the message yet... + // or the server didn't send an enter event first. In either case, ignore the event. + return; + } + Qt::MouseButton qt_button; // translate from kernel (input.h) 'button' to corresponding Qt:MouseButton. @@ -599,15 +604,15 @@ public: void QWaylandInputDevice::Pointer::pointer_axis(uint32_t time, uint32_t axis, int32_t value) { QWaylandWindow *window = mFocus; - QPoint pixelDelta; - QPoint angleDelta; - if (!window) { - // We destroyed the pointer focus surface, but the server - // didn't get the message yet. + // We destroyed the pointer focus surface, but the server didn't get the message yet... + // or the server didn't send an enter event first. In either case, ignore the event. return; } + QPoint pixelDelta; + QPoint angleDelta; + //normalize value and inverse axis int valueDelta = wl_fixed_to_int(value) * -12; @@ -712,6 +717,12 @@ static void sendKey(QWindow *tlw, ulong timestamp, QEvent::Type type, int key, Q void QWaylandInputDevice::Keyboard::keyboard_key(uint32_t serial, uint32_t time, uint32_t key, uint32_t state) { QWaylandWindow *window = mFocus; + if (!window) { + // We destroyed the keyboard focus surface, but the server didn't get the message yet... + // or the server didn't send an enter event first. In either case, ignore the event. + return; + } + uint32_t code = key + 8; bool isDown = state != WL_KEYBOARD_KEY_STATE_RELEASED; QEvent::Type type = isDown ? QEvent::KeyPress : QEvent::KeyRelease; @@ -719,12 +730,6 @@ void QWaylandInputDevice::Keyboard::keyboard_key(uint32_t serial, uint32_t time, int qtkey = key + 8; // qt-compositor substracts 8 for some reason mParent->mSerial = serial; - if (!window) { - // We destroyed the keyboard focus surface, but the server - // didn't get the message yet. - return; - } - if (isDown) mParent->mQDisplay->setLastInputDevice(mParent, serial, window); @@ -791,6 +796,12 @@ void QWaylandInputDevice::Keyboard::keyboard_key(uint32_t serial, uint32_t time, void QWaylandInputDevice::Keyboard::repeatKey() { + if (!mFocus) { + // We destroyed the keyboard focus surface, but the server didn't get the message yet... + // or the server didn't send an enter event first. + return; + } + mRepeatTimer.setInterval(25); sendKey(mFocus->window(), mRepeatTime, QEvent::KeyRelease, mRepeatKey, modifiers(), mRepeatCode, #if QT_CONFIG(xkbcommon) From c09a3a27b6c50c76e7cee3e0b8e7478fb6fce7a0 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Wed, 2 Jan 2019 15:04:23 +0100 Subject: [PATCH 0631/1507] Client: Fix incorrect damage for decoration edges [ChangeLog][QPA plugin] Fixed a bug where surface damage for window decorations was outside the surface. Fixes: QTBUG-72818 Change-Id: I32d00174f1c308952a98bdb55731eb77be54f331 Reviewed-by: Pier Luigi Fiorini --- src/plugins/platforms/wayland/qwaylandabstractdecoration.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandabstractdecoration.cpp b/src/plugins/platforms/wayland/qwaylandabstractdecoration.cpp index 479a857502f..6a8f1d92d92 100644 --- a/src/plugins/platforms/wayland/qwaylandabstractdecoration.cpp +++ b/src/plugins/platforms/wayland/qwaylandabstractdecoration.cpp @@ -100,6 +100,7 @@ void QWaylandAbstractDecoration::setWaylandWindow(QWaylandWindow *window) d->m_wayland_window = window; } +// \a size is without margins static QRegion marginsRegion(const QSize &size, const QMargins &margins) { QRegion r; @@ -123,7 +124,7 @@ const QImage &QWaylandAbstractDecoration::contentImage() d->m_decorationContentImage.fill(Qt::transparent); this->paint(&d->m_decorationContentImage); - QRegion damage = marginsRegion(window()->frameGeometry().size(), window()->frameMargins()); + QRegion damage = marginsRegion(window()->geometry().size(), window()->frameMargins()); for (QRect r : damage) waylandWindow()->damage(r); From d812e2ea357f08dad82b6c362c5e375fa9375ad2 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Wed, 2 Jan 2019 12:33:03 +0100 Subject: [PATCH 0632/1507] Client: Don't assume windows have surfaces in QWaylandInputContext::update Fixes: QTBUG-72751 Change-Id: I6018a34d4a4cfcbdef5d6cd05d2d4ef12846efea Reviewed-by: Paul Olav Tvete --- .../wayland/qwaylandinputcontext.cpp | 23 +++++++++++++------ 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandinputcontext.cpp b/src/plugins/platforms/wayland/qwaylandinputcontext.cpp index 58ad90d41b5..e85faaf8e28 100644 --- a/src/plugins/platforms/wayland/qwaylandinputcontext.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputcontext.cpp @@ -417,6 +417,15 @@ void QWaylandInputContext::commit() textInput()->commit(); } +static ::wl_surface *surfaceForWindow(QWindow *window) +{ + if (!window || !window->handle()) + return nullptr; + + auto *waylandWindow = static_cast(window->handle()); + return waylandWindow->wl_surface::object(); +} + void QWaylandInputContext::update(Qt::InputMethodQueries queries) { qCDebug(qLcQpaInputMethods) << Q_FUNC_INFO << queries; @@ -424,15 +433,15 @@ void QWaylandInputContext::update(Qt::InputMethodQueries queries) if (!QGuiApplication::focusObject() || !textInput()) return; - if (mCurrentWindow && mCurrentWindow->handle() && !inputMethodAccepted()) { - struct ::wl_surface *surface = static_cast(mCurrentWindow->handle())->object(); - textInput()->disable(surface); + auto *currentSurface = surfaceForWindow(mCurrentWindow); + + if (currentSurface && !inputMethodAccepted()) { + textInput()->disable(currentSurface); mCurrentWindow.clear(); - } else if (!mCurrentWindow && inputMethodAccepted()) { + } else if (!currentSurface && inputMethodAccepted()) { QWindow *window = QGuiApplication::focusWindow(); - if (window && window->handle()) { - struct ::wl_surface *surface = static_cast(window->handle())->object(); - textInput()->enable(surface); + if (auto *focusSurface = surfaceForWindow(window)) { + textInput()->enable(focusSurface); mCurrentWindow = window; } } From 3877eac8a4596090a2c736439c10be74685aa4e1 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Mon, 7 Jan 2019 15:01:20 +0100 Subject: [PATCH 0633/1507] wl_eglstream_controller implementation for NVIDIA This adds a new client buffer integration: wayland-eglstream-controller, which contains the EGLStream logic from wayland-egl, and additionally uses NVIDIA's wayland-eglstream-controller protocol to avoid the issue where the stream is not ready at the time of first buffer attach. This is not enabled by default. Can be used like this: QT_WAYLAND_CLIENT_BUFFER_INTEGRATION=wayland-eglstream-controller ./pure-qml Fixes: QTBUG-71697 Change-Id: I73bb2a8fe9852afe1b5807cbb8c35dc4c7624dad Reviewed-by: Johan Helsing --- .../wayland/protocols/qt_attribution.json | 17 ++++++++- .../protocols/wl-eglstream-controller.xml | 37 +++++++++++++++++++ .../platforms/wayland/qwaylandintegration.cpp | 2 + 3 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 src/3rdparty/wayland/protocols/wl-eglstream-controller.xml diff --git a/src/3rdparty/wayland/protocols/qt_attribution.json b/src/3rdparty/wayland/protocols/qt_attribution.json index e5bf91e1023..7881e6b0de5 100644 --- a/src/3rdparty/wayland/protocols/qt_attribution.json +++ b/src/3rdparty/wayland/protocols/qt_attribution.json @@ -103,5 +103,20 @@ Copyright © 2010-2013 Intel Corporation" "LicenseFile": "HPND_LICENSE.txt", "Copyright": "Copyright © 2012, 2013 Intel Corporation Copyright © 2015, 2016 Jan Arne Petersen" - } + }, + + { + "Id": "wayland-eglstream-controller", + "Name": "Wayland EGLStream Controller Protocol", + "QDocModule": "qtwaylandcompositor", + "QtUsage": "Used in the Qt Wayland Compositor", + "Files": "wayland-eglstream-controller.xml", + + "Description": "Allows clients to request that the compositor creates its EGLStream.", + "Homepage": "https://github.com/NVIDIA/egl-wayland", + "LicenseId": "MIT", + "License": "MIT License", + "LicenseFile": "MIT_LICENSE.txt", + "Copyright": "Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved." + } ] diff --git a/src/3rdparty/wayland/protocols/wl-eglstream-controller.xml b/src/3rdparty/wayland/protocols/wl-eglstream-controller.xml new file mode 100644 index 00000000000..dea072e64b5 --- /dev/null +++ b/src/3rdparty/wayland/protocols/wl-eglstream-controller.xml @@ -0,0 +1,37 @@ + + + + Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved. + + 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 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. + + + + + Creates the corresponding server side EGLStream from the given wl_buffer + and attaches a consumer to it. + + + + + + diff --git a/src/plugins/platforms/wayland/qwaylandintegration.cpp b/src/plugins/platforms/wayland/qwaylandintegration.cpp index e935ef31f5f..97e0203cdc9 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandintegration.cpp @@ -339,6 +339,8 @@ void QWaylandIntegration::initializeClientBufferIntegration() targetKey = QString::fromLocal8Bit(clientBufferIntegrationName); } else { targetKey = mDisplay->hardwareIntegration()->clientBufferIntegration(); + if (targetKey == QLatin1String("wayland-eglstream-controller")) + targetKey = QLatin1String("wayland-egl"); } if (targetKey.isEmpty()) { From ff9e5830d367b29f86acc5e7e550154f76bc957a Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Tue, 8 Jan 2019 12:15:55 +0100 Subject: [PATCH 0634/1507] Revert "Client: Full implementation for frame callbacks" This caused regressions because QtQuick depends on swapBuffers for throttling animations. We probably need to emulate a blocking swapBuffers and continue after a timeout, but until we have a patch for this, revert this to avoid releasing a regression. This brings back the bug with a frozen event loop when a surface is waiting for a frame callback, but this is preferable to a regression. This reverts commit 24ef6801e42b15be0f31860476199106c69e15d6. Fixes: QTBUG-72578 Change-Id: If6435a947aae5e9fd775404649a392bfafe9130a Reviewed-by: Paul Olav Tvete --- .../platforms/wayland/qwaylandwindow.cpp | 107 ++++-------------- .../platforms/wayland/qwaylandwindow_p.h | 9 +- 2 files changed, 20 insertions(+), 96 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 470ae00910a..282179efb53 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -358,8 +358,6 @@ void QWaylandWindow::sendExposeEvent(const QRect &rect) { if (!(mShellSurface && mShellSurface->handleExpose(rect))) QWindowSystemInterface::handleExposeEvent(window(), rect); - else - qCDebug(lcQpaWayland) << "sendExposeEvent: intercepted by shell extension, not sending"; mLastExposeGeometry = rect; } @@ -544,11 +542,18 @@ void QWaylandWindow::handleScreenRemoved(QScreen *qScreen) void QWaylandWindow::attach(QWaylandBuffer *buffer, int x, int y) { Q_ASSERT(!buffer->committed()); + if (mFrameCallback) { + wl_callback_destroy(mFrameCallback); + mFrameCallback = nullptr; + } + if (buffer) { - handleUpdate(); + mFrameCallback = frame(); + wl_callback_add_listener(mFrameCallback, &QWaylandWindow::callbackListener, this); + mWaitingForFrameSync = true; buffer->setBusy(); - QtWayland::wl_surface::attach(buffer->buffer(), x, y); + attach(buffer->buffer(), x, y); } else { QtWayland::wl_surface::attach(nullptr, 0, 0); } @@ -613,9 +618,11 @@ void QWaylandWindow::frameCallback(void *data, struct wl_callback *callback, uin Q_UNUSED(callback); QWaylandWindow *self = static_cast(data); - self->mWaitingForFrameCallback = false; - if (self->mUpdateRequested) + self->mWaitingForFrameSync = false; + if (self->mUpdateRequested) { + self->mUpdateRequested = false; self->deliverUpdateRequest(); + } } QMutex QWaylandWindow::mFrameSyncMutex; @@ -623,10 +630,10 @@ QMutex QWaylandWindow::mFrameSyncMutex; void QWaylandWindow::waitForFrameSync() { QMutexLocker locker(&mFrameSyncMutex); - if (!mWaitingForFrameCallback) + if (!mWaitingForFrameSync) return; mDisplay->flushRequests(); - while (mWaitingForFrameCallback) + while (mWaitingForFrameSync) mDisplay->blockingReadEvents(); } @@ -1027,88 +1034,12 @@ QVariant QWaylandWindow::property(const QString &name, const QVariant &defaultVa return m_properties.value(name, defaultValue); } -void QWaylandWindow::timerEvent(QTimerEvent *event) -{ - if (event->timerId() == mFallbackUpdateTimerId) { - killTimer(mFallbackUpdateTimerId); - mFallbackUpdateTimerId = -1; - - if (!isExposed()) { - qCDebug(lcWaylandBackingstore) << "Fallback update timer: Window not exposed," - << "not delivering update request."; - return; - } - - if (mWaitingForUpdate && mUpdateRequested && !mWaitingForFrameCallback) { - qCWarning(lcWaylandBackingstore) << "Delivering update request through fallback timer," - << "may not be in sync with display"; - deliverUpdateRequest(); - } - } -} - void QWaylandWindow::requestUpdate() { - if (mUpdateRequested) - return; - - mUpdateRequested = true; - - // If we have a frame callback all is good and will be taken care of there - if (mWaitingForFrameCallback) - return; - - // If we've already called deliverUpdateRequest(), but haven't seen any attach+commit/swap yet - if (mWaitingForUpdate) { - // Ideally, we should just have returned here, but we're not guaranteed that the client - // will actually update, so start this timer to deliver another request update after a while - // *IF* the client doesn't update. - int fallbackTimeout = 100; - mFallbackUpdateTimerId = startTimer(fallbackTimeout); - return; - } - - // Some applications (such as Qt Quick) depend on updates being delivered asynchronously, - // so use invokeMethod to delay the delivery a bit. - QMetaObject::invokeMethod(this, [this] { - // Things might have changed in the meantime - if (mUpdateRequested && !mWaitingForUpdate && !mWaitingForFrameCallback) - deliverUpdateRequest(); - }, Qt::QueuedConnection); -} - -// Should be called whenever we commit a buffer (directly through wl_surface.commit or indirectly -// with eglSwapBuffers) to know when it's time to commit the next one. -// Can be called from the render thread (without locking anything) so make sure to not make races in this method. -void QWaylandWindow::handleUpdate() -{ - // TODO: Should sync subsurfaces avoid requesting frame callbacks? - - if (mFrameCallback) { - wl_callback_destroy(mFrameCallback); - mFrameCallback = nullptr; - } - - if (mFallbackUpdateTimerId != -1) { - // Ideally, we would stop the fallback timer here, but since we're on another thread, - // it's not allowed. Instead we set mFallbackUpdateTimer to -1 here, so we'll just - // ignore it if it times out before it's cleaned up by the invokeMethod call. - int id = mFallbackUpdateTimerId; - mFallbackUpdateTimerId = -1; - QMetaObject::invokeMethod(this, [=] { killTimer(id); }, Qt::QueuedConnection); - } - - mFrameCallback = frame(); - wl_callback_add_listener(mFrameCallback, &QWaylandWindow::callbackListener, this); - mWaitingForFrameCallback = true; - mWaitingForUpdate = false; -} - -void QWaylandWindow::deliverUpdateRequest() -{ - mUpdateRequested = false; - mWaitingForUpdate = true; - QPlatformWindow::deliverUpdateRequest(); + if (!mWaitingForFrameSync) + QPlatformWindow::requestUpdate(); + else + mUpdateRequested = true; } void QWaylandWindow::addAttachOffset(const QPoint point) diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index e5838d23173..56ebd3cc641 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -191,10 +191,7 @@ public: bool startSystemMove(const QPoint &pos) override; - void timerEvent(QTimerEvent *event) override; void requestUpdate() override; - void handleUpdate(); - void deliverUpdateRequest() override; public slots: void applyConfigure(); @@ -214,14 +211,10 @@ protected: Qt::MouseButtons mMousePressedInContentArea = Qt::NoButton; WId mWindowId; - bool mWaitingForFrameCallback = false; + bool mWaitingForFrameSync = false; struct ::wl_callback *mFrameCallback = nullptr; QWaitCondition mFrameSyncWait; - // True when we have called deliverRequestUpdate, but the client has not yet attached a new buffer - bool mWaitingForUpdate = false; - int mFallbackUpdateTimerId = -1; - QMutex mResizeLock; bool mWaitingToApplyConfigure = false; bool mCanResize = true; From 516c75d5d0f952a84d997c3b42a424a232b0741c Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Fri, 11 Jan 2019 11:22:23 +0100 Subject: [PATCH 0635/1507] Client decorations: Show menu on right click [ChangeLog][QPA plugin] A window menu is now shown when the window decorations are right-clicked (if supported by the compositor). Change-Id: I13bf0c8cd91a6e5a3b44e47114dfdc2ff0e97f3a Reviewed-by: Paul Olav Tvete Reviewed-by: Pier Luigi Fiorini --- .../plugins/decorations/bradient/main.cpp | 2 ++ .../xdg-shell-v5/qwaylandxdgsurfacev5.cpp | 7 +++++++ .../xdg-shell-v5/qwaylandxdgsurfacev5_p.h | 1 + .../xdg-shell-v6/qwaylandxdgshellv6.cpp | 10 +++++++++ .../xdg-shell-v6/qwaylandxdgshellv6_p.h | 1 + .../xdg-shell/qwaylandxdgshell.cpp | 10 +++++++++ .../xdg-shell/qwaylandxdgshell_p.h | 1 + .../wayland/qwaylandabstractdecoration.cpp | 21 +++++++++++++------ .../wayland/qwaylandabstractdecoration_p.h | 2 ++ .../platforms/wayland/qwaylandinputdevice.cpp | 5 +++++ .../platforms/wayland/qwaylandinputdevice_p.h | 2 ++ .../wayland/qwaylandshellsurface_p.h | 1 + 12 files changed, 57 insertions(+), 6 deletions(-) diff --git a/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp b/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp index 83dc8604b45..1bf67bbc393 100644 --- a/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp +++ b/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp @@ -333,6 +333,8 @@ void QWaylandBradientDecoration::processMouseTop(QWaylandInputDevice *inputDevic processMouseLeft(inputDevice, local, b, mods); } else if (local.x() > window()->width() + margins().left()) { processMouseRight(inputDevice, local, b, mods); + } else if (isRightClicked(b)) { + showWindowMenu(inputDevice); } else if (closeButtonRect().contains(local)) { if (clickButton(b, Close)) QWindowSystemInterface::handleCloseEvent(window()); diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgsurfacev5.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgsurfacev5.cpp index b691ee74718..e9f64e2e6cb 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgsurfacev5.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgsurfacev5.cpp @@ -95,6 +95,13 @@ bool QWaylandXdgSurfaceV5::move(QWaylandInputDevice *inputDevice) return true; } +bool QWaylandXdgSurfaceV5::showWindowMenu(QWaylandInputDevice *seat) +{ + QPoint position = seat->pointerSurfacePosition().toPoint(); + show_window_menu(seat->wl_seat(), seat->serial(), position.x(), position.y()); + return true; +} + void QWaylandXdgSurfaceV5::updateTransientParent(QWaylandWindow *parent) { if (!parent) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgsurfacev5_p.h b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgsurfacev5_p.h index 231a56d8433..feebee7f431 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgsurfacev5_p.h +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgsurfacev5_p.h @@ -84,6 +84,7 @@ public: using QtWayland::xdg_surface_v5::move; bool move(QWaylandInputDevice *inputDevice) override; + bool showWindowMenu(QWaylandInputDevice *seat) override; void setTitle(const QString &title) override; void setAppId(const QString &appId) override; diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp index e12573ad06d..01122769ee3 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp @@ -251,6 +251,16 @@ bool QWaylandXdgSurfaceV6::move(QWaylandInputDevice *inputDevice) return false; } +bool QWaylandXdgSurfaceV6::showWindowMenu(QWaylandInputDevice *seat) +{ + if (m_toplevel && m_toplevel->isInitialized()) { + QPoint position = seat->pointerSurfacePosition().toPoint(); + m_toplevel->show_window_menu(seat->wl_seat(), seat->serial(), position.x(), position.y()); + return true; + } + return false; +} + void QWaylandXdgSurfaceV6::setTitle(const QString &title) { if (m_toplevel) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6_p.h b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6_p.h index 5a2867379ab..e688f751af7 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6_p.h +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6_p.h @@ -79,6 +79,7 @@ public: void resize(QWaylandInputDevice *inputDevice, Qt::Edges edges) override; bool move(QWaylandInputDevice *inputDevice) override; + bool showWindowMenu(QWaylandInputDevice *seat) override; void setTitle(const QString &title) override; void setAppId(const QString &appId) override; diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp index 8759cb8c96e..cabba5b3b08 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp @@ -279,6 +279,16 @@ bool QWaylandXdgSurface::move(QWaylandInputDevice *inputDevice) return false; } +bool QWaylandXdgSurface::showWindowMenu(QWaylandInputDevice *seat) +{ + if (m_toplevel && m_toplevel->isInitialized()) { + QPoint position = seat->pointerSurfacePosition().toPoint(); + m_toplevel->show_window_menu(seat->wl_seat(), seat->serial(), position.x(), position.y()); + return true; + } + return false; +} + void QWaylandXdgSurface::setTitle(const QString &title) { if (m_toplevel) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h index 1dc1def23cc..416feee2cff 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h @@ -82,6 +82,7 @@ public: void resize(QWaylandInputDevice *inputDevice, Qt::Edges edges) override; bool move(QWaylandInputDevice *inputDevice) override; + bool showWindowMenu(QWaylandInputDevice *seat) override; void setTitle(const QString &title) override; void setAppId(const QString &appId) override; void setWindowFlags(Qt::WindowFlags flags) override; diff --git a/src/plugins/platforms/wayland/qwaylandabstractdecoration.cpp b/src/plugins/platforms/wayland/qwaylandabstractdecoration.cpp index 3196af3b0bd..32fa6e1b575 100644 --- a/src/plugins/platforms/wayland/qwaylandabstractdecoration.cpp +++ b/src/plugins/platforms/wayland/qwaylandabstractdecoration.cpp @@ -164,20 +164,29 @@ void QWaylandAbstractDecoration::startMove(QWaylandInputDevice *inputDevice, Qt: } } +void QWaylandAbstractDecoration::showWindowMenu(QWaylandInputDevice *inputDevice) +{ + Q_D(QWaylandAbstractDecoration); + if (auto *s = d->m_wayland_window->shellSurface()) + s->showWindowMenu(inputDevice); +} + bool QWaylandAbstractDecoration::isLeftClicked(Qt::MouseButtons newMouseButtonState) { Q_D(QWaylandAbstractDecoration); - if (!(d->m_mouseButtons & Qt::LeftButton) && (newMouseButtonState & Qt::LeftButton)) - return true; - return false; + return !(d->m_mouseButtons & Qt::LeftButton) && (newMouseButtonState & Qt::LeftButton); +} + +bool QWaylandAbstractDecoration::isRightClicked(Qt::MouseButtons newMouseButtonState) +{ + Q_D(QWaylandAbstractDecoration); + return !(d->m_mouseButtons & Qt::RightButton) && (newMouseButtonState & Qt::RightButton); } bool QWaylandAbstractDecoration::isLeftReleased(Qt::MouseButtons newMouseButtonState) { Q_D(QWaylandAbstractDecoration); - if ((d->m_mouseButtons & Qt::LeftButton) && !(newMouseButtonState & Qt::LeftButton)) - return true; - return false; + return (d->m_mouseButtons & Qt::LeftButton) && !(newMouseButtonState & Qt::LeftButton); } bool QWaylandAbstractDecoration::isDirty() const diff --git a/src/plugins/platforms/wayland/qwaylandabstractdecoration_p.h b/src/plugins/platforms/wayland/qwaylandabstractdecoration_p.h index f5b1854dd92..81c8e1771cb 100644 --- a/src/plugins/platforms/wayland/qwaylandabstractdecoration_p.h +++ b/src/plugins/platforms/wayland/qwaylandabstractdecoration_p.h @@ -105,8 +105,10 @@ protected: void startResize(QWaylandInputDevice *inputDevice, Qt::Edges edges, Qt::MouseButtons buttons); void startMove(QWaylandInputDevice *inputDevice, Qt::MouseButtons buttons); + void showWindowMenu(QWaylandInputDevice *inputDevice); bool isLeftClicked(Qt::MouseButtons newMouseButtonState); + bool isRightClicked(Qt::MouseButtons newMouseButtonState); bool isLeftReleased(Qt::MouseButtons newMouseButtonState); }; diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index 2dff4b6c351..31495a45324 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -331,6 +331,11 @@ QWaylandWindow *QWaylandInputDevice::touchFocus() const return mTouch ? mTouch->mFocus : nullptr; } +QPointF QWaylandInputDevice::pointerSurfacePosition() const +{ + return mPointer ? mPointer->mSurfacePos : QPointF(); +} + Qt::KeyboardModifiers QWaylandInputDevice::modifiers() const { if (!mKeyboard) diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h index f27f329be50..c2fd57bb0df 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h +++ b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h @@ -129,6 +129,8 @@ public: QWaylandWindow *keyboardFocus() const; QWaylandWindow *touchFocus() const; + QPointF pointerSurfacePosition() const; + Qt::KeyboardModifiers modifiers() const; uint32_t serial() const; diff --git a/src/plugins/platforms/wayland/qwaylandshellsurface_p.h b/src/plugins/platforms/wayland/qwaylandshellsurface_p.h index f683d9e013d..d33a98a1e1e 100644 --- a/src/plugins/platforms/wayland/qwaylandshellsurface_p.h +++ b/src/plugins/platforms/wayland/qwaylandshellsurface_p.h @@ -76,6 +76,7 @@ public: virtual void resize(QWaylandInputDevice * /*inputDevice*/, Qt::Edges /*edges*/) {} virtual bool move(QWaylandInputDevice *) { return false; } + virtual bool showWindowMenu(QWaylandInputDevice *seat) { Q_UNUSED(seat); return false; } virtual void setTitle(const QString & /*title*/) {} virtual void setAppId(const QString & /*appId*/) {} From 3572bcb831437cc5ef1f4947c2f9dfdb22e21fcc Mon Sep 17 00:00:00 2001 From: Pier Luigi Fiorini Date: Sun, 6 Jan 2019 19:21:20 +0100 Subject: [PATCH 0636/1507] Set size hints for xdg-shell and xdg-shell-v6 Send minimum and maximum size hints to compositors. [ChangeLog][QPA plugin] Implement minimum and maximum size in the xdg-shell and xdg-shell-v6 shell integrations. Change-Id: I631c3348c8333d7a246b21228a92c436f5adb5dc Reviewed-by: Johan Helsing --- .../xdg-shell-v6/qwaylandxdgshellv6.cpp | 30 +++++++++++++++++++ .../xdg-shell-v6/qwaylandxdgshellv6_p.h | 3 ++ .../xdg-shell/qwaylandxdgshell.cpp | 30 +++++++++++++++++++ .../xdg-shell/qwaylandxdgshell_p.h | 3 ++ .../wayland/qwaylandshellsurface_p.h | 2 ++ .../platforms/wayland/qwaylandwindow.cpp | 11 +++++++ .../platforms/wayland/qwaylandwindow_p.h | 4 ++- 7 files changed, 82 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp index 01122769ee3..6652c876813 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp @@ -46,6 +46,8 @@ #include #include +#include + QT_BEGIN_NAMESPACE namespace QtWaylandClient { @@ -94,6 +96,9 @@ void QWaylandXdgSurfaceV6::Toplevel::applyConfigure() QSize windowGeometrySize = m_xdgSurface->m_window->window()->frameGeometry().size(); m_xdgSurface->set_window_geometry(0, 0, windowGeometrySize.width(), windowGeometrySize.height()); + + m_xdgSurface->setSizeHints(); + m_applied = m_pending; qCDebug(lcQpaWayland) << "Applied pending zxdg_toplevel_v6 configure event:" << m_applied.size << m_applied.states; } @@ -305,6 +310,31 @@ bool QWaylandXdgSurfaceV6::wantsDecorations() const return m_toplevel && !(m_toplevel->m_pending.states & Qt::WindowFullScreen); } +void QWaylandXdgSurfaceV6::propagateSizeHints() +{ + setSizeHints(); + + if (m_toplevel && m_window) + m_window->commit(); +} + +void QWaylandXdgSurfaceV6::setSizeHints() +{ + if (m_toplevel && m_window) { + const int minWidth = qMax(0, m_window->windowMinimumSize().width()); + const int minHeight = qMax(0, m_window->windowMinimumSize().height()); + m_toplevel->set_min_size(minWidth, minHeight); + + int maxWidth = qMax(0, m_window->windowMaximumSize().width()); + if (maxWidth == QWINDOWSIZE_MAX) + maxWidth = 0; + int maxHeight = qMax(0, m_window->windowMaximumSize().height()); + if (maxHeight == QWINDOWSIZE_MAX) + maxHeight = 0; + m_toplevel->set_max_size(maxWidth, maxHeight); + } +} + void QWaylandXdgSurfaceV6::requestWindowStates(Qt::WindowStates states) { if (m_toplevel) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6_p.h b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6_p.h index e688f751af7..62c13157ed7 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6_p.h +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6_p.h @@ -88,6 +88,9 @@ public: bool handlesActiveState() const { return m_toplevel; } void applyConfigure() override; bool wantsDecorations() const override; + void propagateSizeHints() override; + + void setSizeHints(); protected: void requestWindowStates(Qt::WindowStates states) override; diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp index cabba5b3b08..fc515ca1bdc 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp @@ -46,6 +46,8 @@ #include #include +#include + QT_BEGIN_NAMESPACE namespace QtWaylandClient { @@ -104,6 +106,9 @@ void QWaylandXdgSurface::Toplevel::applyConfigure() QSize windowGeometrySize = m_xdgSurface->m_window->window()->frameGeometry().size(); m_xdgSurface->set_window_geometry(0, 0, windowGeometrySize.width(), windowGeometrySize.height()); + + m_xdgSurface->setSizeHints(); + m_applied = m_pending; qCDebug(lcQpaWayland) << "Applied pending xdg_toplevel configure event:" << m_applied.size << m_applied.states; } @@ -339,6 +344,31 @@ bool QWaylandXdgSurface::wantsDecorations() const return m_toplevel && m_toplevel->wantsDecorations(); } +void QWaylandXdgSurface::propagateSizeHints() +{ + setSizeHints(); + + if (m_toplevel && m_window) + m_window->commit(); +} + +void QWaylandXdgSurface::setSizeHints() +{ + if (m_toplevel && m_window) { + const int minWidth = qMax(0, m_window->windowMinimumSize().width()); + const int minHeight = qMax(0, m_window->windowMinimumSize().height()); + m_toplevel->set_min_size(minWidth, minHeight); + + int maxWidth = qMax(0, m_window->windowMaximumSize().width()); + if (maxWidth == QWINDOWSIZE_MAX) + maxWidth = 0; + int maxHeight = qMax(0, m_window->windowMaximumSize().height()); + if (maxHeight == QWINDOWSIZE_MAX) + maxHeight = 0; + m_toplevel->set_max_size(maxWidth, maxHeight); + } +} + void QWaylandXdgSurface::requestWindowStates(Qt::WindowStates states) { if (m_toplevel) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h index 416feee2cff..c39ccde3b43 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h @@ -92,6 +92,9 @@ public: bool handlesActiveState() const { return m_toplevel; } void applyConfigure() override; bool wantsDecorations() const override; + void propagateSizeHints() override; + + void setSizeHints(); protected: void requestWindowStates(Qt::WindowStates states) override; diff --git a/src/plugins/platforms/wayland/qwaylandshellsurface_p.h b/src/plugins/platforms/wayland/qwaylandshellsurface_p.h index d33a98a1e1e..804056e549d 100644 --- a/src/plugins/platforms/wayland/qwaylandshellsurface_p.h +++ b/src/plugins/platforms/wayland/qwaylandshellsurface_p.h @@ -97,6 +97,8 @@ public: virtual void requestWindowStates(Qt::WindowStates states) {Q_UNUSED(states);} virtual bool wantsDecorations() const { return false; } + virtual void propagateSizeHints() {} + private: QWaylandWindow *m_window = nullptr; friend class QWaylandWindow; diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 17576eceec1..e8ff081c8fb 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -605,6 +605,11 @@ void QWaylandWindow::commit(QWaylandBuffer *buffer, const QRegion &damage) wl_surface::commit(); } +void QWaylandWindow::commit() +{ + wl_surface::commit(); +} + const wl_callback_listener QWaylandWindow::callbackListener = { QWaylandWindow::frameCallback }; @@ -1118,6 +1123,12 @@ void QWaylandWindow::addAttachOffset(const QPoint point) mOffset += point; } +void QWaylandWindow::propagateSizeHints() +{ + if (mShellSurface) + mShellSurface->propagateSizeHints(); +} + bool QtWaylandClient::QWaylandWindow::startSystemMove(const QPoint &pos) { Q_UNUSED(pos); diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index e5838d23173..52cbc3e5920 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -120,6 +120,8 @@ public: void handleExpose(const QRegion ®ion); void commit(QWaylandBuffer *buffer, const QRegion &damage); + void commit(); + void waitForFrameSync(); QMargins frameMargins() const override; @@ -186,7 +188,7 @@ public: QWaylandShmBackingStore *backingStore() const { return mBackingStore; } bool setKeyboardGrabEnabled(bool) override { return false; } - void propagateSizeHints() override { } + void propagateSizeHints() override; void addAttachOffset(const QPoint point); bool startSystemMove(const QPoint &pos) override; From 8d23c3b5b8282e6e3c88da6ffa81b7223556821e Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Thu, 10 Jan 2019 15:12:07 +0100 Subject: [PATCH 0637/1507] Client: Test for xdg toplevel min and max size Change-Id: I60605f494eebfde9a7737911eefe69a93041ced5 Reviewed-by: Pier Luigi Fiorini --- tests/auto/wayland/shared/xdgshell.cpp | 17 +++++++++++++++ tests/auto/wayland/shared/xdgshell.h | 12 ++++++++++- tests/auto/wayland/xdgshell/tst_xdgshell.cpp | 22 ++++++++++++++++++++ 3 files changed, 50 insertions(+), 1 deletion(-) diff --git a/tests/auto/wayland/shared/xdgshell.cpp b/tests/auto/wayland/shared/xdgshell.cpp index ebbcc2942d4..4cabd3d87b1 100644 --- a/tests/auto/wayland/shared/xdgshell.cpp +++ b/tests/auto/wayland/shared/xdgshell.cpp @@ -149,6 +149,7 @@ XdgToplevel::XdgToplevel(XdgSurface *xdgSurface, int id, int version) : QtWaylandServer::xdg_toplevel(xdgSurface->resource()->client(), id, version) , m_xdgSurface(xdgSurface) { + connect(surface(), &Surface::commit, this, [this] { m_committed = m_pending; }); } void XdgToplevel::sendConfigure(const QSize &size, const QVector &states) @@ -162,6 +163,22 @@ uint XdgToplevel::sendCompleteConfigure(const QSize &size, const QVector & return m_xdgSurface->sendConfigure(); } +void XdgToplevel::xdg_toplevel_set_max_size(Resource *resource, int32_t width, int32_t height) +{ + Q_UNUSED(resource); + QSize size(width, height); + QVERIFY(size.isValid()); + m_pending.maxSize = size; +} + +void XdgToplevel::xdg_toplevel_set_min_size(Resource *resource, int32_t width, int32_t height) +{ + Q_UNUSED(resource); + QSize size(width, height); + QVERIFY(size.isValid()); + m_pending.minSize = size; +} + XdgPopup::XdgPopup(XdgSurface *xdgSurface, int id, int version) : QtWaylandServer::xdg_popup(xdgSurface->resource()->client(), id, version) , m_xdgSurface(xdgSurface) diff --git a/tests/auto/wayland/shared/xdgshell.h b/tests/auto/wayland/shared/xdgshell.h index 3fcec79832a..037de20d1fa 100644 --- a/tests/auto/wayland/shared/xdgshell.h +++ b/tests/auto/wayland/shared/xdgshell.h @@ -99,14 +99,24 @@ protected: void xdg_surface_ack_configure(Resource *resource, uint32_t serial) override; }; -class XdgToplevel : public QtWaylandServer::xdg_toplevel +class XdgToplevel : public QObject, public QtWaylandServer::xdg_toplevel { + Q_OBJECT public: explicit XdgToplevel(XdgSurface *xdgSurface, int id, int version = 1); void sendConfigure(const QSize &size = {0, 0}, const QVector &states = {}); uint sendCompleteConfigure(const QSize &size = {0, 0}, const QVector &states = {}); Surface *surface() { return m_xdgSurface->m_surface; } + XdgSurface *m_xdgSurface = nullptr; + struct DoubleBufferedState { + QSize minSize = {0, 0}; + QSize maxSize = {0, 0}; + } m_pending, m_committed; + +protected: + void xdg_toplevel_set_max_size(Resource *resource, int32_t width, int32_t height) override; + void xdg_toplevel_set_min_size(Resource *resource, int32_t width, int32_t height) override; }; class XdgPopup : public QtWaylandServer::xdg_popup diff --git a/tests/auto/wayland/xdgshell/tst_xdgshell.cpp b/tests/auto/wayland/xdgshell/tst_xdgshell.cpp index 55e994b061a..1bfabe55f98 100644 --- a/tests/auto/wayland/xdgshell/tst_xdgshell.cpp +++ b/tests/auto/wayland/xdgshell/tst_xdgshell.cpp @@ -43,6 +43,7 @@ private slots: void configureStates(); void popup(); void pongs(); + void minMaxSize(); }; void tst_xdgshell::showMinimized() @@ -265,5 +266,26 @@ void tst_xdgshell::pongs() QCOMPARE(pongSpy.first().at(0).toUInt(), serial); } +void tst_xdgshell::minMaxSize() +{ + QRasterWindow window; + window.setMinimumSize(QSize(100, 100)); + window.setMaximumSize(QSize(1000, 1000)); + window.resize(400, 320); + window.show(); + QCOMPOSITOR_TRY_VERIFY(xdgToplevel()); + + exec([=] { xdgToplevel()->sendCompleteConfigure(); }); + + QCOMPOSITOR_TRY_COMPARE(xdgToplevel()->m_committed.minSize, QSize(100, 100)); + QCOMPOSITOR_TRY_COMPARE(xdgToplevel()->m_committed.maxSize, QSize(1000, 1000)); + + window.setMaximumSize(QSize(500, 400)); + QCOMPOSITOR_TRY_COMPARE(xdgToplevel()->m_committed.maxSize, QSize(500, 400)); + + window.setMinimumSize(QSize(50, 40)); + QCOMPOSITOR_TRY_COMPARE(xdgToplevel()->m_committed.minSize, QSize(50, 40)); +} + QCOMPOSITOR_TEST_MAIN(tst_xdgshell) #include "tst_xdgshell.moc" From a9c9f52620c5f730421b3921125a93a3a813af53 Mon Sep 17 00:00:00 2001 From: Pier Luigi Fiorini Date: Mon, 14 Jan 2019 00:43:28 +0100 Subject: [PATCH 0638/1507] Track changes to window geometry for xdg-shell and xdg-shell-v6 Send window geometry every time the window is resized. [ChangeLog][QPA plugin] Send window geometry every time the window is resized. Change-Id: I8f3824c31455345be2b582e7d3a55077b47851b6 Reviewed-by: Johan Helsing --- .../shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp | 8 +++++--- .../shellintegration/xdg-shell-v6/qwaylandxdgshellv6_p.h | 1 + .../shellintegration/xdg-shell/qwaylandxdgshell.cpp | 8 +++++--- .../shellintegration/xdg-shell/qwaylandxdgshell_p.h | 1 + src/plugins/platforms/wayland/qwaylandshellsurface_p.h | 2 ++ src/plugins/platforms/wayland/qwaylandwindow.cpp | 3 +++ 6 files changed, 17 insertions(+), 6 deletions(-) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp index 6652c876813..60540fb0c81 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp @@ -94,9 +94,6 @@ void QWaylandXdgSurfaceV6::Toplevel::applyConfigure() m_xdgSurface->m_window->resizeFromApplyConfigure(m_pending.size); } - QSize windowGeometrySize = m_xdgSurface->m_window->window()->frameGeometry().size(); - m_xdgSurface->set_window_geometry(0, 0, windowGeometrySize.width(), windowGeometrySize.height()); - m_xdgSurface->setSizeHints(); m_applied = m_pending; @@ -318,6 +315,11 @@ void QWaylandXdgSurfaceV6::propagateSizeHints() m_window->commit(); } +void QWaylandXdgSurfaceV6::setWindowGeometry(const QRect &rect) +{ + set_window_geometry(rect.x(), rect.y(), rect.width(), rect.height()); +} + void QWaylandXdgSurfaceV6::setSizeHints() { if (m_toplevel && m_window) { diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6_p.h b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6_p.h index 62c13157ed7..f77a4d4baeb 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6_p.h +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6_p.h @@ -89,6 +89,7 @@ public: void applyConfigure() override; bool wantsDecorations() const override; void propagateSizeHints() override; + void setWindowGeometry(const QRect &rect) override; void setSizeHints(); diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp index fc515ca1bdc..78b7b45c8ab 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp @@ -104,9 +104,6 @@ void QWaylandXdgSurface::Toplevel::applyConfigure() m_xdgSurface->m_window->resizeFromApplyConfigure(m_pending.size); } - QSize windowGeometrySize = m_xdgSurface->m_window->window()->frameGeometry().size(); - m_xdgSurface->set_window_geometry(0, 0, windowGeometrySize.width(), windowGeometrySize.height()); - m_xdgSurface->setSizeHints(); m_applied = m_pending; @@ -352,6 +349,11 @@ void QWaylandXdgSurface::propagateSizeHints() m_window->commit(); } +void QWaylandXdgSurface::setWindowGeometry(const QRect &rect) +{ + set_window_geometry(rect.x(), rect.y(), rect.width(), rect.height()); +} + void QWaylandXdgSurface::setSizeHints() { if (m_toplevel && m_window) { diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h index c39ccde3b43..8f8682a4792 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h @@ -93,6 +93,7 @@ public: void applyConfigure() override; bool wantsDecorations() const override; void propagateSizeHints() override; + void setWindowGeometry(const QRect &rect) override; void setSizeHints(); diff --git a/src/plugins/platforms/wayland/qwaylandshellsurface_p.h b/src/plugins/platforms/wayland/qwaylandshellsurface_p.h index 804056e549d..f5f202d0817 100644 --- a/src/plugins/platforms/wayland/qwaylandshellsurface_p.h +++ b/src/plugins/platforms/wayland/qwaylandshellsurface_p.h @@ -99,6 +99,8 @@ public: virtual void propagateSizeHints() {} + virtual void setWindowGeometry(const QRect &rect) { Q_UNUSED(rect); } + private: QWaylandWindow *m_window = nullptr; friend class QWaylandWindow; diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index e8ff081c8fb..2301875c912 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -339,6 +339,9 @@ void QWaylandWindow::setGeometry(const QRect &rect) QRect exposeGeometry(QPoint(), geometry().size()); if (exposeGeometry != mLastExposeGeometry) sendExposeEvent(exposeGeometry); + + if (mShellSurface) + mShellSurface->setWindowGeometry(QRect(QPoint(0, 0), window()->frameGeometry().size())); } void QWaylandWindow::resizeFromApplyConfigure(const QSize &sizeWithMargins, const QPoint &offset) From 6c71a283d888c36d95832f294d0a1409f7591211 Mon Sep 17 00:00:00 2001 From: Pier Luigi Fiorini Date: Sun, 13 Jan 2019 23:28:06 +0100 Subject: [PATCH 0639/1507] Client: Test for xdg surface window geometry Change-Id: I2f336a81682317b1f7dc939d911906b4db60a386 Reviewed-by: Johan Helsing --- tests/auto/wayland/shared/xdgshell.cpp | 10 ++++++++++ tests/auto/wayland/shared/xdgshell.h | 4 ++++ tests/auto/wayland/xdgshell/tst_xdgshell.cpp | 16 ++++++++++++++++ 3 files changed, 30 insertions(+) diff --git a/tests/auto/wayland/shared/xdgshell.cpp b/tests/auto/wayland/shared/xdgshell.cpp index 4cabd3d87b1..6bc303020f8 100644 --- a/tests/auto/wayland/shared/xdgshell.cpp +++ b/tests/auto/wayland/shared/xdgshell.cpp @@ -86,6 +86,8 @@ XdgSurface::XdgSurface(XdgWmBase *xdgWmBase, Surface *surface, wl_client *client connect(this, &XdgSurface::toplevelCreated, xdgWmBase, &XdgWmBase::toplevelCreated); connect(surface, &Surface::attach, this, &XdgSurface::verifyConfigured); connect(surface, &Surface::commit, this, [this] { + m_committed = m_pending; + if (m_ackedConfigureSerial != m_committedConfigureSerial) { m_committedConfigureSerial = m_ackedConfigureSerial; emit configureCommitted(m_committedConfigureSerial); @@ -133,6 +135,14 @@ void XdgSurface::xdg_surface_destroy_resource(Resource *resource) delete this; } +void XdgSurface::xdg_surface_set_window_geometry(Resource *resource, int32_t x, int32_t y, int32_t width, int32_t height) +{ + Q_UNUSED(resource); + QRect rect(x, y, width, height); + QVERIFY(rect.isValid()); + m_pending.windowGeometry = rect; +} + void XdgSurface::xdg_surface_ack_configure(Resource *resource, uint32_t serial) { Q_UNUSED(resource); diff --git a/tests/auto/wayland/shared/xdgshell.h b/tests/auto/wayland/shared/xdgshell.h index 037de20d1fa..1a01ea1eabc 100644 --- a/tests/auto/wayland/shared/xdgshell.h +++ b/tests/auto/wayland/shared/xdgshell.h @@ -83,6 +83,9 @@ public: QVector m_pendingConfigureSerials; uint m_ackedConfigureSerial = 0; uint m_committedConfigureSerial = 0; + struct DoubleBufferedState { + QRect windowGeometry = {0, 0, 0, 0}; + } m_pending, m_committed; public slots: void verifyConfigured() { QVERIFY(m_configureSent); } @@ -96,6 +99,7 @@ protected: void xdg_surface_get_popup(Resource *resource, uint32_t id, ::wl_resource *parent, ::wl_resource *positioner) override; void xdg_surface_destroy_resource(Resource *resource) override; void xdg_surface_destroy(Resource *resource) override { wl_resource_destroy(resource->handle); } + void xdg_surface_set_window_geometry(Resource *resource, int32_t x, int32_t y, int32_t width, int32_t height) override; void xdg_surface_ack_configure(Resource *resource, uint32_t serial) override; }; diff --git a/tests/auto/wayland/xdgshell/tst_xdgshell.cpp b/tests/auto/wayland/xdgshell/tst_xdgshell.cpp index 1bfabe55f98..de034101411 100644 --- a/tests/auto/wayland/xdgshell/tst_xdgshell.cpp +++ b/tests/auto/wayland/xdgshell/tst_xdgshell.cpp @@ -44,6 +44,7 @@ private slots: void popup(); void pongs(); void minMaxSize(); + void windowGeometry(); }; void tst_xdgshell::showMinimized() @@ -287,5 +288,20 @@ void tst_xdgshell::minMaxSize() QCOMPOSITOR_TRY_COMPARE(xdgToplevel()->m_committed.minSize, QSize(50, 40)); } +void tst_xdgshell::windowGeometry() +{ + QRasterWindow window; + window.resize(400, 320); + window.show(); + QCOMPOSITOR_TRY_VERIFY(xdgToplevel()); + + exec([=] { xdgToplevel()->sendCompleteConfigure(); }); + + QCOMPOSITOR_TRY_COMPARE(xdgSurface()->m_committed.windowGeometry, QRect(QPoint(0, 0), window.frameGeometry().size())); + + window.resize(800, 600); + QCOMPOSITOR_TRY_COMPARE(xdgSurface()->m_committed.windowGeometry, QRect(QPoint(0, 0), window.frameGeometry().size())); +} + QCOMPOSITOR_TEST_MAIN(tst_xdgshell) #include "tst_xdgshell.moc" From c34abdb08b3923e46b1997fb557f26f6614fbb82 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Wed, 28 Feb 2018 12:30:33 +0100 Subject: [PATCH 0640/1507] Member init for some variables that are not covered by constructors Where it makes sense, default init variables to sensible values Change-Id: Ie2aa6ab79a6a3c8322bb0ff804f340f7ffd1c1d1 Reviewed-by: Pier Luigi Fiorini --- .../hardwareintegration/qwaylandserverbufferintegration_p.h | 2 +- src/plugins/platforms/wayland/qwaylanddisplay_p.h | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegration_p.h b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegration_p.h index 7439087d885..632429befa3 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegration_p.h +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegration_p.h @@ -85,7 +85,7 @@ public: void *userData() const; protected: - Format m_format; + Format m_format = RGBA32; QSize m_size; private: diff --git a/src/plugins/platforms/wayland/qwaylanddisplay_p.h b/src/plugins/platforms/wayland/qwaylanddisplay_p.h index e9439d1be85..41ad7025fb1 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay_p.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay_p.h @@ -224,10 +224,10 @@ private: QScopedPointer mHardwareIntegration; QScopedPointer mXdgOutputManager; QSocketNotifier *mReadNotifier = nullptr; - int mFd; - int mWritableNotificationFd; + int mFd = -1; + int mWritableNotificationFd = -1; QList mGlobals; - int mCompositorVersion; + int mCompositorVersion = -1; uint32_t mLastInputSerial = 0; QWaylandInputDevice *mLastInputDevice = nullptr; QPointer mLastInputWindow; From badf0575a260af34d9c080ca93c53a30889880c7 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Thu, 10 Jan 2019 09:02:56 +0100 Subject: [PATCH 0641/1507] Client: Add wl_output tests Also removes overlapping old tests and adds a (currently failing) test for QTBUG-72828. Task-number: QTBUG-72828 Change-Id: Id93d5872ed1c4f181935c1e493e9d8d0ae9cfaf3 Reviewed-by: Pier Luigi Fiorini --- tests/auto/wayland/client.pro | 1 + tests/auto/wayland/client/tst_client.cpp | 116 --------- tests/auto/wayland/output/output.pro | 5 + tests/auto/wayland/output/tst_output.cpp | 231 ++++++++++++++++++ tests/auto/wayland/seatv4/tst_seatv4.cpp | 8 +- tests/auto/wayland/shared/corecompositor.cpp | 2 +- tests/auto/wayland/shared/coreprotocol.cpp | 39 ++- tests/auto/wayland/shared/coreprotocol.h | 49 +++- tests/auto/wayland/shared/mockcompositor.cpp | 3 +- tests/auto/wayland/shared/mockcompositor.h | 1 + .../wayland/shared_old/mockcompositor.cpp | 37 --- .../auto/wayland/shared_old/mockcompositor.h | 8 - tests/auto/wayland/shared_old/mockoutput.cpp | 42 ---- tests/auto/wayland/shared_old/mockoutput.h | 1 - tests/auto/wayland/shared_old/mocksurface.cpp | 28 --- 15 files changed, 323 insertions(+), 248 deletions(-) create mode 100644 tests/auto/wayland/output/output.pro create mode 100644 tests/auto/wayland/output/tst_output.cpp diff --git a/tests/auto/wayland/client.pro b/tests/auto/wayland/client.pro index af7889d5f33..b4f1571221d 100644 --- a/tests/auto/wayland/client.pro +++ b/tests/auto/wayland/client.pro @@ -4,6 +4,7 @@ SUBDIRS += \ client \ fullscreenshellv1 \ iviapplication \ + output \ seatv4 \ surface \ wl_connect \ diff --git a/tests/auto/wayland/client/tst_client.cpp b/tests/auto/wayland/client/tst_client.cpp index 470db25a4c7..08120c8c24f 100644 --- a/tests/auto/wayland/client/tst_client.cpp +++ b/tests/auto/wayland/client/tst_client.cpp @@ -167,11 +167,6 @@ public slots: } private slots: - void primaryScreen(); - void screens(); - void addScreenWithGeometryChange(); - void windowScreens(); - void removePrimaryScreen(); void createDestroyWindow(); void activeWindowFollowsKeyboardFocus(); void events(); @@ -188,117 +183,6 @@ private: MockCompositor *compositor = nullptr; }; -void tst_WaylandClient::primaryScreen() -{ - compositor->setOutputMode(screenSize); - QTRY_COMPARE(QGuiApplication::primaryScreen()->size(), screenSize); -} - -void tst_WaylandClient::screens() -{ - QTRY_COMPARE(QGuiApplication::screens().size(), 1); - compositor->sendAddOutput(); - QTRY_COMPARE(QGuiApplication::screens().size(), 2); - QSharedPointer secondOutput; - QTRY_VERIFY(secondOutput = compositor->output(1)); - compositor->sendRemoveOutput(secondOutput); - QTRY_COMPARE(QGuiApplication::screens().size(), 1); -} - -//QTBUG-62044 -void tst_WaylandClient::addScreenWithGeometryChange() -{ - QTRY_COMPARE(QGuiApplication::screens().size(), 1); - const QRect oldGeometry = QGuiApplication::primaryScreen()->geometry(); - compositor->sendAddOutput(); - - // Move the primary screen to the right - const QRect newGeometry(QPoint(screenSize.width(), 0), screenSize); - Q_ASSERT(oldGeometry != newGeometry); - compositor->sendOutputGeometry(compositor->output(0), newGeometry); - - QTRY_COMPARE(QGuiApplication::screens().size(), 2); - QTRY_COMPARE(QGuiApplication::primaryScreen()->geometry(), newGeometry); - - compositor->sendRemoveOutput(compositor->output(1)); - QTRY_COMPARE(QGuiApplication::screens().size(), 1); - - // Move the screen back - compositor->sendOutputGeometry(compositor->output(0), oldGeometry); - QTRY_COMPARE(QGuiApplication::primaryScreen()->geometry(), oldGeometry); -} - -void tst_WaylandClient::windowScreens() -{ - QSharedPointer firstOutput; - QTRY_VERIFY(firstOutput = compositor->output()); - - TestWindow window; - window.show(); - - QSharedPointer surface; - QTRY_VERIFY(surface = compositor->surface()); - compositor->sendShellSurfaceConfigure(surface); - - QTRY_COMPARE(QGuiApplication::screens().size(), 1); - QScreen *primaryScreen = QGuiApplication::screens().first(); - QCOMPARE(window.screen(), primaryScreen); - - compositor->sendAddOutput(); - - QTRY_COMPARE(QGuiApplication::screens().size(), 2); - QScreen *secondaryScreen = QGuiApplication::screens().at(1); - QVERIFY(secondaryScreen); - - window.setScreen(secondaryScreen); - QCOMPARE(window.screen(), secondaryScreen); - - QSharedPointer secondOutput; - QTRY_VERIFY(secondOutput = compositor->output(1)); - compositor->sendSurfaceEnter(surface, firstOutput); - - compositor->sendSurfaceEnter(surface, secondOutput); - QTRY_COMPARE(window.screen(), primaryScreen); - - compositor->sendSurfaceLeave(surface, firstOutput); - QTRY_COMPARE(window.screen(), secondaryScreen); - - compositor->sendRemoveOutput(secondOutput); - QTRY_COMPARE(QGuiApplication::screens().size(), 1); - QCOMPARE(window.screen(), primaryScreen); -} - -void tst_WaylandClient::removePrimaryScreen() -{ - QSharedPointer firstOutput; - QTRY_VERIFY(firstOutput = compositor->output()); - - TestWindow window; - window.show(); - - QSharedPointer surface; - QTRY_VERIFY(surface = compositor->surface()); - compositor->sendShellSurfaceConfigure(surface); - QTRY_COMPARE(QGuiApplication::screens().size(), 1); - QScreen *primaryScreen = QGuiApplication::screens().first(); - QCOMPARE(window.screen(), primaryScreen); - - compositor->sendAddOutput(); - - QTRY_COMPARE(QGuiApplication::screens().size(), 2); - QTRY_COMPARE(QGuiApplication::primaryScreen()->virtualSiblings().size(), 2); - QScreen *secondaryScreen = QGuiApplication::screens().at(1); - QVERIFY(secondaryScreen); - - compositor->sendRemoveOutput(firstOutput); - QTRY_COMPARE(QGuiApplication::screens().size(), 1); - - compositor->sendMousePress(surface, window.frameOffset() + QPoint(10, 10)); - QTRY_COMPARE(window.mousePressEventCount, 1); - compositor->sendMouseRelease(surface); - QTRY_COMPARE(window.mouseReleaseEventCount, 1); -} - void tst_WaylandClient::createDestroyWindow() { TestWindow window; diff --git a/tests/auto/wayland/output/output.pro b/tests/auto/wayland/output/output.pro new file mode 100644 index 00000000000..d1dc672f060 --- /dev/null +++ b/tests/auto/wayland/output/output.pro @@ -0,0 +1,5 @@ +include (../shared/shared.pri) + +TARGET = tst_output +SOURCES += tst_output.cpp + diff --git a/tests/auto/wayland/output/tst_output.cpp b/tests/auto/wayland/output/tst_output.cpp new file mode 100644 index 00000000000..451679481e6 --- /dev/null +++ b/tests/auto/wayland/output/tst_output.cpp @@ -0,0 +1,231 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "mockcompositor.h" +#include +#include + +using namespace MockCompositor; + +class tst_output : public QObject, private DefaultCompositor +{ + Q_OBJECT +private slots: + void initTestCase() + { + m_config.autoConfigure = true; + m_config.autoEnter = false; + } + void cleanup() + { + QCOMPOSITOR_COMPARE(getAll().size(), 1); // Only the default output should be left + QTRY_COMPARE(QGuiApplication::screens().size(), 1); + QTRY_VERIFY2(isClean(), qPrintable(dirtyMessage())); + } + void primaryScreen(); + void secondaryHiDpiScreen(); + void addScreenWithGeometryChange(); + void windowScreens(); + void removePrimaryScreen(); + void screenOrder(); +}; + +void tst_output::primaryScreen() +{ + // Verify that the client has bound to the output global + QCOMPOSITOR_TRY_COMPARE(output()->resourceMap().size(), 1); + QTRY_VERIFY(QGuiApplication::primaryScreen()); + QScreen *screen = QGuiApplication::primaryScreen(); + QCOMPARE(screen->manufacturer(), "Make"); + QCOMPARE(screen->model(), "Model"); + QCOMPARE(screen->size(), QSize(1920, 1080)); + QCOMPARE(screen->refreshRate(), 60); + QCOMPARE(qRound(screen->physicalDotsPerInch()), 96 / screen->devicePixelRatio()); + QCOMPARE(screen->devicePixelRatio(), 1); + QCOMPARE(screen->logicalDotsPerInch(), 96); +} + +void tst_output::secondaryHiDpiScreen() +{ + exec([=] { + OutputData d; + d.position = {1920, 0}; // in global compositor space (not pixels) + d.mode.resolution = {800, 640}; + d.physicalSize = d.mode.physicalSizeForDpi(200); + d.scale = 2; + add(d); + }); + + // Verify that the client has bound to the output global + QCOMPOSITOR_TRY_VERIFY(output(1) && output(1)->resourceMap().size() == 1); + + QTRY_COMPARE(QGuiApplication::screens().size(), 2); + QScreen *screen = QGuiApplication::screens()[1]; + QCOMPARE(screen->refreshRate(), 60); + QCOMPARE(screen->devicePixelRatio(), 2); + QCOMPARE(screen->logicalDotsPerInch(), 96); + + // Dots currently means device pixels, not actual pixels (see QTBUG-62649) + QCOMPARE(qRound(screen->physicalDotsPerInch() * screen->devicePixelRatio()), 200); + + // Size is in logical pixel coordinates + QCOMPARE(screen->size(), QSize(800, 640) / 2); + QCOMPARE(screen->geometry(), QRect(QPoint(1920, 0), QSize(400, 320))); + QCOMPARE(screen->virtualGeometry(), QRect(QPoint(0, 0), QSize(1920 + 800 / 2, 1080))); + + exec([=] { remove(output(1)); }); +} + +// QTBUG-62044 +void tst_output::addScreenWithGeometryChange() +{ + const QPoint initialPosition = exec([=] { return output(0)->m_data.position; }); + + exec([=] { + auto *oldOutput = output(0); + auto *newOutput = add(); + newOutput->m_data.mode.resolution = {1280, 720}; + // Move the primary output to the right + QPoint newPosition(newOutput->m_data.mode.resolution.width(), 0); + Q_ASSERT(newPosition != initialPosition); + oldOutput->m_data.position = newPosition; + oldOutput->sendGeometry(); + oldOutput->sendDone(); + }); + + QTRY_COMPARE(QGuiApplication::screens().size(), 2); + QTRY_COMPARE(QGuiApplication::primaryScreen()->geometry(), QRect(QPoint(1280, 0), QSize(1920, 1080))); + + // Remove the extra output and move the old one back + exec([=] { + remove(output(1)); + output()->m_data.position = initialPosition; + output()->sendGeometry(); + output()->sendDone(); + }); + QTRY_COMPARE(QGuiApplication::screens().size(), 1); + QTRY_COMPARE(QGuiApplication::primaryScreen()->geometry(), QRect(QPoint(0, 0), QSize(1920, 1080))); +} + +void tst_output::windowScreens() +{ + QRasterWindow window; + window.resize(400, 320); + window.show(); + QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial); + + QTRY_COMPARE(QGuiApplication::screens().size(), 1); + QScreen *primaryScreen = QGuiApplication::screens().first(); + QCOMPARE(window.screen(), primaryScreen); + + exec([=] { add(); }); + + QTRY_COMPARE(QGuiApplication::screens().size(), 2); + QScreen *secondaryScreen = QGuiApplication::screens().at(1); + QVERIFY(secondaryScreen); + + window.setScreen(secondaryScreen); + QCOMPARE(window.screen(), secondaryScreen); + + exec([=] { + xdgToplevel()->surface()->sendEnter(output(0)); + xdgToplevel()->surface()->sendEnter(output(1)); + }); + + QTRY_COMPARE(window.screen(), primaryScreen); + + exec([=] { + xdgToplevel()->surface()->sendLeave(output(0)); + }); + QTRY_COMPARE(window.screen(), secondaryScreen); + + exec([=] { + remove(output(1)); + }); + QTRY_COMPARE(QGuiApplication::screens().size(), 1); + QCOMPARE(window.screen(), primaryScreen); +} + +void tst_output::removePrimaryScreen() +{ + QRasterWindow window; + window.resize(400, 320); + window.show(); + QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial); + + QTRY_COMPARE(QGuiApplication::screens().size(), 1); + QScreen *primaryScreen = QGuiApplication::screens().first(); + QCOMPARE(window.screen(), primaryScreen); + + // Add a clone of the primary output + exec([&] { add(output()->m_data); }); + + QTRY_COMPARE(QGuiApplication::screens().size(), 2); + QTRY_COMPARE(QGuiApplication::primaryScreen()->virtualSiblings().size(), 2); + QScreen *secondaryScreen = QGuiApplication::screens().at(1); + QVERIFY(secondaryScreen); + + exec([&] { remove(output()); }); + QTRY_COMPARE(QGuiApplication::screens().size(), 1); + + exec([&] { + auto *surface = xdgToplevel()->surface(); + pointer()->sendEnter(surface, {32, 32}); + pointer()->sendButton(client(), BTN_LEFT, 1); + pointer()->sendButton(client(), BTN_LEFT, 0); + }); + + // Wait to make sure mouse events dont't cause a crash now that the screen has changed + xdgPingAndWaitForPong(); +} + +// QTBUG-72828 +void tst_output::screenOrder() +{ + exec([=] { + add()->m_data.model = "Screen 1"; + add()->m_data.model = "Screen 2"; + }); + + QTRY_COMPARE(QGuiApplication::screens().size(), 3); + const auto screens = QGuiApplication::screens(); + + QEXPECT_FAIL(nullptr, "TODO: fix screen order", Continue); + QCOMPARE(screens[1]->model(), "Screen 1"); + + QEXPECT_FAIL(nullptr, "TODO: fix screen order", Continue); + QCOMPARE(screens[2]->model(), "Screen 2"); + + exec([=] { + remove(output(2)); + remove(output(1)); + }); +} + +QCOMPOSITOR_TEST_MAIN(tst_output) +#include "tst_output.moc" diff --git a/tests/auto/wayland/seatv4/tst_seatv4.cpp b/tests/auto/wayland/seatv4/tst_seatv4.cpp index 0e0ada5d0a2..b6357a25b99 100644 --- a/tests/auto/wayland/seatv4/tst_seatv4.cpp +++ b/tests/auto/wayland/seatv4/tst_seatv4.cpp @@ -256,8 +256,10 @@ void tst_seatv4::scaledCursor() QSKIP("Currently broken and should be fixed"); // Add a highdpi output exec([&] { - int scale = 2; - add(scale); + OutputData d; + d.scale = 2; + d.position = {1920, 0}; + add(d); }); QRasterWindow window; @@ -282,7 +284,7 @@ void tst_seatv4::scaledCursor() QCOMPOSITOR_TRY_COMPARE(pointer()->cursorSurface()->m_committed.buffer->size(), unscaledPixelSize * 2); // Remove the extra output to clean up for the next test - exec([&] { remove(getAll()[1]); }); + exec([&] { remove(output(1)); }); } QCOMPOSITOR_TEST_MAIN(tst_seatv4) diff --git a/tests/auto/wayland/shared/corecompositor.cpp b/tests/auto/wayland/shared/corecompositor.cpp index afa25e94c71..7edb1c2d434 100644 --- a/tests/auto/wayland/shared/corecompositor.cpp +++ b/tests/auto/wayland/shared/corecompositor.cpp @@ -97,8 +97,8 @@ void CoreCompositor::add(Global *global) void CoreCompositor::remove(Global *global) { warnIfNotLockedByThread(Q_FUNC_INFO); - //TODO: Need to delete global as well! m_globals.removeAll(global); + delete global; } uint CoreCompositor::nextSerial() diff --git a/tests/auto/wayland/shared/coreprotocol.cpp b/tests/auto/wayland/shared/coreprotocol.cpp index 46d46d980a6..fdd5f627c80 100644 --- a/tests/auto/wayland/shared/coreprotocol.cpp +++ b/tests/auto/wayland/shared/coreprotocol.cpp @@ -125,28 +125,55 @@ QString WlCompositor::dirtyMessage() return "Dirty, surfaces left:\n\t" + messages.join("\n\t"); } +void Output::sendGeometry() +{ + const auto resources = resourceMap().values(); + for (auto r : resources) + sendGeometry(r); +} + +void Output::sendGeometry(Resource *resource) +{ + // TODO: check resource version as well? + wl_output::send_geometry(resource->handle, + m_data.position.x(), m_data.position.y(), + m_data.physicalSize.width(), m_data.physicalSize.height(), + m_data.subpixel, m_data.make, m_data.model, m_data.transform); +} + void Output::sendScale(int factor) { Q_ASSERT(m_version >= WL_OUTPUT_SCALE_SINCE_VERSION); - m_scale = factor; + m_data.scale = factor; const auto resources = resourceMap().values(); - for (auto r: resources) - wl_output::send_scale(r->handle, factor); + for (auto r : resources) + sendScale(r); +} + +void Output::sendScale(Resource *resource) +{ + Q_ASSERT(m_version >= WL_OUTPUT_SCALE_SINCE_VERSION); + // TODO: check resource version as well? + wl_output::send_scale(resource->handle, m_data.scale); } void Output::sendDone() { Q_ASSERT(m_version >= WL_OUTPUT_DONE_SINCE_VERSION); + // TODO: check resource version as well? const auto resources = resourceMap().values(); - for (auto r: resources) + for (auto r : resources) wl_output::send_done(r->handle); } void Output::output_bind_resource(QtWaylandServer::wl_output::Resource *resource) { + sendGeometry(resource); + send_mode(resource->handle, mode_preferred | mode_current, + m_data.mode.resolution.width(), m_data.mode.resolution.height(), m_data.mode.refreshRate); if (m_version >= WL_OUTPUT_SCALE_SINCE_VERSION) - wl_output::send_scale(resource->handle, m_scale); - //TODO: send other required stuff as well + sendScale(resource); + if (m_version >= WL_OUTPUT_DONE_SINCE_VERSION) wl_output::send_done(resource->handle); } diff --git a/tests/auto/wayland/shared/coreprotocol.h b/tests/auto/wayland/shared/coreprotocol.h index 2fbe9b139e8..565ae66ae04 100644 --- a/tests/auto/wayland/shared/coreprotocol.h +++ b/tests/auto/wayland/shared/coreprotocol.h @@ -171,20 +171,59 @@ public: // TODO }; +struct OutputMode { + explicit OutputMode() = default; + explicit OutputMode(const QSize &resolution, int refreshRate = 60000) + : resolution(resolution), refreshRate(refreshRate) + {} + QSize resolution = QSize(1920, 1080); + int refreshRate = 60000; // In mHz + //TODO: flags (they're currently hard-coded) + + // in mm + QSize physicalSizeForDpi(int dpi) { return (QSizeF(resolution) * 25.4 / dpi).toSize(); } +}; + +struct OutputData { + using Subpixel = QtWaylandServer::wl_output::subpixel; + using Transform = QtWaylandServer::wl_output::transform; + explicit OutputData() = default; + + // for geometry event + QPoint position; + QSize physicalSize = QSize(0, 0); // means unknown physical size + QString make = "Make"; + QString model = "Model"; + Subpixel subpixel = Subpixel::subpixel_unknown; + Transform transform = Transform::transform_normal; + + int scale = 1; // for scale event + OutputMode mode; // for mode event +}; + class Output : public Global, public QtWaylandServer::wl_output { Q_OBJECT public: - explicit Output(CoreCompositor *compositor, int scale = 1, int version = 2) + explicit Output(CoreCompositor *compositor, OutputData data = OutputData(), int version = 2) : QtWaylandServer::wl_output(compositor->m_display, version) - , m_scale(scale) + , m_data(std::move(data)) , m_version(version) {} - void sendScale(int factor); + + void send_geometry() = delete; + void sendGeometry(); + void sendGeometry(Resource *resource); // Sends to only one client + void send_scale(int32_t factor) = delete; - void send_scale(struct ::wl_resource *resource, int32_t factor) = delete; + void sendScale(int factor); + void sendScale(Resource *resource); // Sends current scale to only one client + void sendDone(); - int m_scale = 1; + + int scale() const { return m_data.scale; } + + OutputData m_data; int m_version = 1; // TODO: remove on libwayland upgrade protected: diff --git a/tests/auto/wayland/shared/mockcompositor.cpp b/tests/auto/wayland/shared/mockcompositor.cpp index 45d62a153c2..bb7cd6f4675 100644 --- a/tests/auto/wayland/shared/mockcompositor.cpp +++ b/tests/auto/wayland/shared/mockcompositor.cpp @@ -39,7 +39,8 @@ DefaultCompositor::DefaultCompositor() // Legacy versions can override in separate tests by removing and adding. add(); add(); - add(); + auto *output = add(); + output->m_data.physicalSize = output->m_data.mode.physicalSizeForDpi(96); add(Seat::capability_pointer); add(); add(); diff --git a/tests/auto/wayland/shared/mockcompositor.h b/tests/auto/wayland/shared/mockcompositor.h index 07366a4939a..c7ea4d0091c 100644 --- a/tests/auto/wayland/shared/mockcompositor.h +++ b/tests/auto/wayland/shared/mockcompositor.h @@ -47,6 +47,7 @@ class DefaultCompositor : public CoreCompositor public: explicit DefaultCompositor(); // Convenience functions + Output *output(int i = 0) { return getAll().value(i, nullptr); } Surface *surface(int i = 0) { return get()->m_surfaces.value(i, nullptr); } XdgSurface *xdgSurface(int i = 0) { return get()->m_xdgSurfaces.value(i, nullptr); } XdgToplevel *xdgToplevel(int i = 0) { return get()->toplevel(i); } diff --git a/tests/auto/wayland/shared_old/mockcompositor.cpp b/tests/auto/wayland/shared_old/mockcompositor.cpp index df24b4091b5..f6a8757472c 100644 --- a/tests/auto/wayland/shared_old/mockcompositor.cpp +++ b/tests/auto/wayland/shared_old/mockcompositor.cpp @@ -183,43 +183,6 @@ void MockCompositor::sendDataDeviceLeave(const QSharedPointer &surf processCommand(command); } -void MockCompositor::sendAddOutput() -{ - Command command = makeCommand(Impl::Compositor::sendAddOutput, m_compositor); - processCommand(command); -} - -void MockCompositor::sendRemoveOutput(const QSharedPointer &output) -{ - Command command = makeCommand(Impl::Compositor::sendRemoveOutput, m_compositor); - command.parameters << QVariant::fromValue(output); - processCommand(command); -} - -void MockCompositor::sendOutputGeometry(const QSharedPointer &output, const QRect &geometry) -{ - Command command = makeCommand(Impl::Compositor::sendOutputGeometry, m_compositor); - command.parameters << QVariant::fromValue(output); - command.parameters << QVariant::fromValue(geometry); - processCommand(command); -} - -void MockCompositor::sendSurfaceEnter(const QSharedPointer &surface, QSharedPointer &output) -{ - Command command = makeCommand(Impl::Compositor::sendSurfaceEnter, m_compositor); - command.parameters << QVariant::fromValue(surface); - command.parameters << QVariant::fromValue(output); - processCommand(command); -} - -void MockCompositor::sendSurfaceLeave(const QSharedPointer &surface, QSharedPointer &output) -{ - Command command = makeCommand(Impl::Compositor::sendSurfaceLeave, m_compositor); - command.parameters << QVariant::fromValue(surface); - command.parameters << QVariant::fromValue(output); - processCommand(command); -} - void MockCompositor::sendShellSurfaceConfigure(const QSharedPointer surface, const QSize &size) { Command command = makeCommand(Impl::Compositor::sendShellSurfaceConfigure, m_compositor); diff --git a/tests/auto/wayland/shared_old/mockcompositor.h b/tests/auto/wayland/shared_old/mockcompositor.h index 4bab1ed67a0..404a18e7550 100644 --- a/tests/auto/wayland/shared_old/mockcompositor.h +++ b/tests/auto/wayland/shared_old/mockcompositor.h @@ -98,11 +98,6 @@ public: static void sendDataDeviceLeave(void *data, const QList ¶meters); static void waitForStartDrag(void *data, const QList ¶meters); static void setOutputMode(void *compositor, const QList ¶meters); - static void sendAddOutput(void *data, const QList ¶meters); - static void sendRemoveOutput(void *data, const QList ¶meters); - static void sendOutputGeometry(void *data, const QList ¶meters); - static void sendSurfaceEnter(void *data, const QList ¶meters); - static void sendSurfaceLeave(void *data, const QList ¶meters); static void sendShellSurfaceConfigure(void *data, const QList ¶meters); static void sendIviSurfaceConfigure(void *data, const QList ¶meters); static void sendXdgToplevelV6Configure(void *data, const QList ¶meters); @@ -239,9 +234,6 @@ public: void sendDataDeviceMotion(const QPoint &position); void sendDataDeviceDrop(const QSharedPointer &surface); void sendDataDeviceLeave(const QSharedPointer &surface); - void sendAddOutput(); - void sendRemoveOutput(const QSharedPointer &output); - void sendOutputGeometry(const QSharedPointer &output, const QRect &geometry); void sendSurfaceEnter(const QSharedPointer &surface, QSharedPointer &output); void sendSurfaceLeave(const QSharedPointer &surface, QSharedPointer &output); void sendShellSurfaceConfigure(const QSharedPointer surface, const QSize &size = QSize(0, 0)); diff --git a/tests/auto/wayland/shared_old/mockoutput.cpp b/tests/auto/wayland/shared_old/mockoutput.cpp index 13e0524ad1d..cb7285959f2 100644 --- a/tests/auto/wayland/shared_old/mockoutput.cpp +++ b/tests/auto/wayland/shared_old/mockoutput.cpp @@ -33,37 +33,6 @@ namespace Impl { -void Compositor::sendAddOutput(void *data, const QList ¶meters) { - Q_UNUSED(parameters); - Compositor *compositor = static_cast(data); - auto output = new Output(compositor->m_display, QSize(1920, 1200), QPoint(0, 0)); - compositor->m_outputs.append(output); - - // Wait for the client to bind to the output - while (output->resourceMap().isEmpty()) - compositor->dispatchEvents(); -} - -void Compositor::sendRemoveOutput(void *data, const QList ¶meters) { - Compositor *compositor = static_cast(data); - Q_ASSERT(compositor); - Output *output = resolveOutput(parameters.first()); - Q_ASSERT(output); - bool wasRemoved = compositor->m_outputs.removeOne(output); - Q_ASSERT(wasRemoved); - delete output; -} - -void Compositor::sendOutputGeometry(void *data, const QList ¶meters) -{ - Compositor *compositor = static_cast(data); - Q_ASSERT(compositor); - Output *output = resolveOutput(parameters.first()); - Q_ASSERT(output); - QRect geometry = parameters.at(1).toRect(); - output->sendGeometryAndMode(geometry); -} - void Compositor::setOutputMode(void *data, const QList ¶meters) { Compositor *compositor = static_cast(data); @@ -91,17 +60,6 @@ void Output::setCurrentMode(const QSize &size) } } -void Output::sendGeometryAndMode(const QRect &geometry) -{ - m_size = geometry.size(); - m_position = geometry.topLeft(); - for (Resource *resource : resourceMap()) { - sendGeometry(resource); - sendCurrentMode(resource); - send_done(resource->handle); - } -} - void Output::output_bind_resource(QtWaylandServer::wl_output::Resource *resource) { sendGeometry(resource); diff --git a/tests/auto/wayland/shared_old/mockoutput.h b/tests/auto/wayland/shared_old/mockoutput.h index 9f261d5d7dd..d5a2bb56b6e 100644 --- a/tests/auto/wayland/shared_old/mockoutput.h +++ b/tests/auto/wayland/shared_old/mockoutput.h @@ -44,7 +44,6 @@ public: QSharedPointer mockOutput() const { return m_mockOutput; } void setCurrentMode(const QSize &size); - void sendGeometryAndMode(const QRect &geometry); protected: void output_bind_resource(Resource *resource) override; diff --git a/tests/auto/wayland/shared_old/mocksurface.cpp b/tests/auto/wayland/shared_old/mocksurface.cpp index 84dcda6b010..81a5edbd05f 100644 --- a/tests/auto/wayland/shared_old/mocksurface.cpp +++ b/tests/auto/wayland/shared_old/mocksurface.cpp @@ -35,34 +35,6 @@ namespace Impl { -void Compositor::sendSurfaceEnter(void *data, const QList ¶meters) -{ - Q_UNUSED(data); - Surface *surface = resolveSurface(parameters.at(0)); - Output *output = resolveOutput(parameters.at(1)); - Q_ASSERT(surface && surface->resource()); - Q_ASSERT(output); - auto outputResources = output->resourceMap().values(surface->resource()->client()); - Q_ASSERT(!outputResources.isEmpty()); - - for (auto outputResource : outputResources) - surface->send_enter(outputResource->handle); -} - -void Compositor::sendSurfaceLeave(void *data, const QList ¶meters) -{ - Q_UNUSED(data); - Surface *surface = resolveSurface(parameters.at(0)); - Output *output = resolveOutput(parameters.at(1)); - Q_ASSERT(surface && surface->resource()); - Q_ASSERT(output); - auto outputResources = output->resourceMap().values(surface->resource()->client()); - Q_ASSERT(!outputResources.isEmpty()); - - for (auto outputResource : outputResources) - surface->send_leave(outputResource->handle); -} - void Compositor::sendShellSurfaceConfigure(void *data, const QList ¶meters) { Compositor *compositor = static_cast(data); From 9860fc8f6f477744d1104ac2b264128bb18f5e0b Mon Sep 17 00:00:00 2001 From: Pier Luigi Fiorini Date: Sat, 29 Dec 2018 14:52:43 +0100 Subject: [PATCH 0642/1507] Clean up .gitignore Ignore more files resulting from the build process. Glob all scanner generated files, and add exceptions for pregenerated files. Change-Id: Ica60951356bdc145ebd66f5e6fc6bf4e23f2aa72 Reviewed-by: Johan Helsing --- .../xdg-shell-v5/pregenerated/3rdparty/.gitignore | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/pregenerated/3rdparty/.gitignore diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/pregenerated/3rdparty/.gitignore b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/pregenerated/3rdparty/.gitignore new file mode 100644 index 00000000000..6a2d3c20777 --- /dev/null +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/pregenerated/3rdparty/.gitignore @@ -0,0 +1,3 @@ +!qwayland-*.cpp +!qwayland-*.h +!wayland-*-protocol.c From 8c1ecf019625ae66baf0e5a60f06f1f81958bc0b Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Mon, 7 Jan 2019 11:30:33 +0100 Subject: [PATCH 0643/1507] Client: Add tests for xdg-output-unstable-v1 Change-Id: I4b460bd1e5ac8541dcbf9afb2782187218d257e1 Reviewed-by: Pier Luigi Fiorini --- tests/auto/wayland/client.pro | 1 + .../auto/wayland/xdgoutput/tst_xdgoutput.cpp | 147 ++++++++++++++++++ tests/auto/wayland/xdgoutput/xdgoutput.pro | 8 + 3 files changed, 156 insertions(+) create mode 100644 tests/auto/wayland/xdgoutput/tst_xdgoutput.cpp create mode 100644 tests/auto/wayland/xdgoutput/xdgoutput.pro diff --git a/tests/auto/wayland/client.pro b/tests/auto/wayland/client.pro index b4f1571221d..a8e81e46351 100644 --- a/tests/auto/wayland/client.pro +++ b/tests/auto/wayland/client.pro @@ -8,5 +8,6 @@ SUBDIRS += \ seatv4 \ surface \ wl_connect \ + xdgoutput \ xdgshell \ xdgshellv6 diff --git a/tests/auto/wayland/xdgoutput/tst_xdgoutput.cpp b/tests/auto/wayland/xdgoutput/tst_xdgoutput.cpp new file mode 100644 index 00000000000..6da2c35e82b --- /dev/null +++ b/tests/auto/wayland/xdgoutput/tst_xdgoutput.cpp @@ -0,0 +1,147 @@ +/**************************************************************************** +** +** Copyright (C) 2018 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "mockcompositor.h" +#include +#include +#include + +#include + +using namespace MockCompositor; + +// TODO: move to shared folder? +class XdgOutputV1 : public QObject, public QtWaylandServer::zxdg_output_v1 +{ +public: + explicit XdgOutputV1(Output *output) + : m_output(output) + , m_logicalGeometry(m_output->m_data.position, QSize(m_output->m_data.mode.resolution / m_output->m_data.scale)) + , m_name(QString("WL-%1").arg(s_nextId++)) + {} + + void addResource(wl_client *client, int id, int version) + { + auto *resource = add(client, id, version)->handle; + send_logical_size(resource, m_logicalGeometry.width(), m_logicalGeometry.height()); + send_logical_position(resource, m_logicalGeometry.x(), m_logicalGeometry.y()); + if (version >= ZXDG_OUTPUT_V1_NAME_SINCE_VERSION) + send_name(resource, m_name); + if (version >= ZXDG_OUTPUT_V1_DESCRIPTION_SINCE_VERSION) + send_description(resource, m_description); + send_done(resource); + } + Output *m_output = nullptr; + QRect m_logicalGeometry; + QString m_name; + QString m_description = "This is an Xdg Output description"; + static int s_nextId; +}; + +int XdgOutputV1::s_nextId = 1; + +class XdgOutputManagerV1 : public Global, public QtWaylandServer::zxdg_output_manager_v1 +{ + Q_OBJECT +public: + explicit XdgOutputManagerV1(CoreCompositor *compositor, int version = 2) + : QtWaylandServer::zxdg_output_manager_v1(compositor->m_display, version) + , m_version(version) + {} + int m_version = 1; // TODO: remove on libwayland upgrade + QMap m_xdgOutputs; + XdgOutputV1 *getXdgOutput(Output *output) + { + if (auto *xdgOutput = m_xdgOutputs.value(output)) + return xdgOutput; + return m_xdgOutputs[output] = new XdgOutputV1(output); // TODO: free memory + } + +protected: + void zxdg_output_manager_v1_get_xdg_output(Resource *resource, uint32_t id, wl_resource *outputResource) override + { + auto *output = fromResource(outputResource); + auto *xdgOutput = getXdgOutput(output); + xdgOutput->addResource(resource->client(), id, resource->version()); + } +}; + +class XdgOutputV1Compositor : public DefaultCompositor { +public: + explicit XdgOutputV1Compositor() + { + exec([this] { + int version = 2; // version 2 of of unstable-v1 + add(version); + }); + } +}; + +class tst_xdgoutput : public QObject, private XdgOutputV1Compositor +{ + Q_OBJECT +private slots: + void cleanup(); + void primaryScreen(); + void overrideGeometry(); +}; + +void tst_xdgoutput::cleanup() +{ + QCOMPOSITOR_COMPARE(getAll().size(), 1); // Only the default output should be left + QTRY_VERIFY2(isClean(), qPrintable(dirtyMessage())); +} + +void tst_xdgoutput::primaryScreen() +{ + // Verify that the client has bound to the global + QCOMPOSITOR_TRY_COMPARE(get()->resourceMap().size(), 1); + auto *s = QGuiApplication::primaryScreen(); + QTRY_COMPARE(s->size(), QSize(1920, 1080)); + QTRY_COMPARE(s->geometry().topLeft(), QPoint(0, 0)); +} + +void tst_xdgoutput::overrideGeometry() +{ + exec([=] { + auto *output = add(); + auto *xdgOutput = get()->getXdgOutput(output); + xdgOutput->m_logicalGeometry = QRect(10, 20, 800, 1200); + }); + + QTRY_COMPARE(QGuiApplication::screens().size(), 2); + auto *s = QGuiApplication::screens()[1]; + + QTRY_COMPARE(s->size(), QSize(800, 1200)); + QTRY_COMPARE(s->geometry().topLeft(), QPoint(10, 20)); + + exec([=] { remove(output(1)); }); +} + +QCOMPOSITOR_TEST_MAIN(tst_xdgoutput) +#include "tst_xdgoutput.moc" diff --git a/tests/auto/wayland/xdgoutput/xdgoutput.pro b/tests/auto/wayland/xdgoutput/xdgoutput.pro new file mode 100644 index 00000000000..3cfbb6a7602 --- /dev/null +++ b/tests/auto/wayland/xdgoutput/xdgoutput.pro @@ -0,0 +1,8 @@ +include (../shared/shared.pri) + +WAYLANDSERVERSOURCES += \ + $$PWD/../../../../src/3rdparty/protocol/xdg-output-unstable-v1.xml + +TARGET = tst_xdgoutput +SOURCES += tst_xdgoutput.cpp + From 3187836ad3d15612d605a01a6a990bb378a87d75 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Wed, 16 Jan 2019 10:39:42 +0100 Subject: [PATCH 0644/1507] Client: Implement xdg-output-unstable-v1 version 2 Adds handler for the new name event and updates tests accordingly. This means QScreen::name() will now typically return strings like: "VGA-1", "WL-1", "DP-2", "HDMI-A-1" instead of "Screen25", "Screen26", "Screen27" etc. Change-Id: I3d5748a2fd0d772e2344ac53f0ed808790a84ba5 Reviewed-by: Pier Luigi Fiorini --- src/plugins/platforms/wayland/qwaylanddisplay.cpp | 2 +- src/plugins/platforms/wayland/qwaylandscreen.cpp | 5 +++++ src/plugins/platforms/wayland/qwaylandscreen_p.h | 1 + tests/auto/wayland/xdgoutput/tst_xdgoutput.cpp | 6 ++++++ 4 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index 91c1d4115dd..fc4241f82da 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -278,7 +278,7 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin forceRoundTrip(); } } else if (interface == QLatin1String("zxdg_output_manager_v1")) { - mXdgOutputManager.reset(new QtWayland::zxdg_output_manager_v1(registry, id, 1)); + mXdgOutputManager.reset(new QtWayland::zxdg_output_manager_v1(registry, id, qMin(2, int(version)))); for (auto *screen : qAsConst(mScreens)) screen->initXdgOutput(xdgOutputManager()); forceRoundTrip(); diff --git a/src/plugins/platforms/wayland/qwaylandscreen.cpp b/src/plugins/platforms/wayland/qwaylandscreen.cpp index 38d61f88c35..a6caae0da4b 100644 --- a/src/plugins/platforms/wayland/qwaylandscreen.cpp +++ b/src/plugins/platforms/wayland/qwaylandscreen.cpp @@ -292,6 +292,11 @@ void QWaylandScreen::zxdg_output_v1_done() QWindowSystemInterface::handleScreenGeometryChange(screen(), geometry(), geometry()); } +void QWaylandScreen::zxdg_output_v1_name(const QString &name) +{ + mOutputName = name; } +} // namespace QtWaylandClient + QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandscreen_p.h b/src/plugins/platforms/wayland/qwaylandscreen_p.h index 6e4ed94f7a2..36009cce866 100644 --- a/src/plugins/platforms/wayland/qwaylandscreen_p.h +++ b/src/plugins/platforms/wayland/qwaylandscreen_p.h @@ -122,6 +122,7 @@ private: void zxdg_output_v1_logical_position(int32_t x, int32_t y) override; void zxdg_output_v1_logical_size(int32_t width, int32_t height) override; void zxdg_output_v1_done() override; + void zxdg_output_v1_name(const QString &name) override; int m_outputId; QWaylandDisplay *mWaylandDisplay = nullptr; diff --git a/tests/auto/wayland/xdgoutput/tst_xdgoutput.cpp b/tests/auto/wayland/xdgoutput/tst_xdgoutput.cpp index 6da2c35e82b..a628810d19c 100644 --- a/tests/auto/wayland/xdgoutput/tst_xdgoutput.cpp +++ b/tests/auto/wayland/xdgoutput/tst_xdgoutput.cpp @@ -100,6 +100,7 @@ public: add(version); }); } + XdgOutputV1 *xdgOutput(int i = 0) { return get()->getXdgOutput(output(i)); } }; class tst_xdgoutput : public QObject, private XdgOutputV1Compositor @@ -121,9 +122,14 @@ void tst_xdgoutput::primaryScreen() { // Verify that the client has bound to the global QCOMPOSITOR_TRY_COMPARE(get()->resourceMap().size(), 1); + exec([=] { + auto *resource = xdgOutput()->resourceMap().value(client()); + QCOMPARE(resource->version(), 2); + }); auto *s = QGuiApplication::primaryScreen(); QTRY_COMPARE(s->size(), QSize(1920, 1080)); QTRY_COMPARE(s->geometry().topLeft(), QPoint(0, 0)); + QTRY_COMPARE(s->name(), QString("WL-1")); } void tst_xdgoutput::overrideGeometry() From b3b101ae8009053671d9bc183d58da3270723dd3 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Fri, 18 Jan 2019 11:19:57 +0100 Subject: [PATCH 0645/1507] Skip flaky tests It seems clients are sometimes sending more geometry events than needed, causing the tests to fail. Skip the tests for now to make builds pass again. Fixes: QTBUG-73130 Change-Id: Ia9f82ddd3561d84119dc4d9f8ef15ebc48964148 Reviewed-by: Pier Luigi Fiorini --- tests/auto/wayland/xdgshellv6/tst_xdgshellv6.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/auto/wayland/xdgshellv6/tst_xdgshellv6.cpp b/tests/auto/wayland/xdgshellv6/tst_xdgshellv6.cpp index 3c822325bd9..a397f60eb4e 100644 --- a/tests/auto/wayland/xdgshellv6/tst_xdgshellv6.cpp +++ b/tests/auto/wayland/xdgshellv6/tst_xdgshellv6.cpp @@ -331,6 +331,7 @@ void tst_WaylandClientXdgShellV6::windowStateChangedEvents() void tst_WaylandClientXdgShellV6::windowGeometrySimple() { + QSKIP("TODO: This test is flaky, figure out why."); QWindow window; window.show(); @@ -349,6 +350,7 @@ void tst_WaylandClientXdgShellV6::windowGeometrySimple() void tst_WaylandClientXdgShellV6::windowGeometryFixed() { + QSKIP("TODO: This test is flaky, figure out why."); QWindow window; window.resize(QSize(1337, 137)); window.setMaximumSize(window.size()); From 738130c02401c3ba98f03b28118f44ef10d844a0 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Mon, 1 Oct 2018 14:47:29 +0200 Subject: [PATCH 0646/1507] Update wayland.xml to version 1.16.0 Now that we've stopped including the system libwayland protocol headers, i.e. wayland-client.h and wayland-server.h, it should be safe to update the protocol definitions to the latest version. Note that this just updates the protocol definition, the implementations for the various interfaces are still using the old versions. Change-Id: I961e762553756e11e4c5b33c74101f0c16661232 Reviewed-by: Paul Olav Tvete --- .../wayland/protocols/qt_attribution.json | 14 +- src/3rdparty/wayland/protocols/wayland.xml | 1605 ++++++++++++----- 2 files changed, 1146 insertions(+), 473 deletions(-) diff --git a/src/3rdparty/wayland/protocols/qt_attribution.json b/src/3rdparty/wayland/protocols/qt_attribution.json index 47729311833..a9fddb84082 100644 --- a/src/3rdparty/wayland/protocols/qt_attribution.json +++ b/src/3rdparty/wayland/protocols/qt_attribution.json @@ -27,14 +27,14 @@ Copyright © 2015 Jonas Ådahl" "Description": "Wayland is a protocol for a compositor to talk to its clients.", "Homepage": "https://wayland.freedesktop.org", - "Version": "1.6.1", - "DownloadLocation": "https://cgit.freedesktop.org/wayland/wayland/tag/?id=1.6.1", - "LicenseId": "HPND", - "License": "HPND License", - "LicenseFile": "HPND_LICENSE.txt", + "Version": "1.16.0", + "DownloadLocation": "https://gitlab.freedesktop.org/wayland/wayland/raw/1.16.0/protocol/wayland.xml", + "LicenseId": "MIT", + "License": "MIT License", + "LicenseFile": "MIT_LICENSE.txt", "Copyright": "Copyright © 2008-2011 Kristian Høgsberg - Copyright © 2010-2011 Intel Corporation - Copyright © 2012-2013 Collabora, Ltd." +Copyright © 2010-2011 Intel Corporation +Copyright © 2012-2013 Collabora, Ltd." }, { diff --git a/src/3rdparty/wayland/protocols/wayland.xml b/src/3rdparty/wayland/protocols/wayland.xml index bb457bcf74f..141038b7a71 100644 --- a/src/3rdparty/wayland/protocols/wayland.xml +++ b/src/3rdparty/wayland/protocols/wayland.xml @@ -6,26 +6,26 @@ Copyright © 2010-2011 Intel Corporation Copyright © 2012-2013 Collabora, Ltd. - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that copyright notice and this permission - notice appear in supporting documentation, and that the name of - the copyright holders not be used in advertising or publicity - pertaining to distribution of the software without specific, - written prior permission. The copyright holders make no - representations about the suitability of this software for any - purpose. It is provided "as is" without express or implied - warranty. + 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 COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS - SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND - FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY - SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN - AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, - ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF - THIS SOFTWARE. + 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.
@@ -48,7 +48,8 @@ The callback_data passed in the callback is the event serial. - + @@ -56,8 +57,15 @@ This request creates a registry object that allows the client to list and bind the global objects available from the compositor. + + It should be noted that the server side resources consumed in + response to a get_registry request can only be released when the + client disconnects, not when the client side proxy is destroyed. + Therefore, clients should invoke get_registry as infrequently as + possible to avoid wasting memory. - + @@ -67,12 +75,12 @@ where the error occurred, most often in response to a request to that object. The code identifies the error and is defined by the object interface. As such, each interface defines its - own set of error codes. The message is an brief description + own set of error codes. The message is a brief description of the error, for (debugging) convenience. - - - + + + @@ -93,17 +101,17 @@ This event is used internally by the object ID management logic. When a client deletes an object, the server will send this event to acknowledge that it has seen the delete request. - When the client receive this event, it will know that it can + When the client receives this event, it will know that it can safely reuse the object ID. - + - The global registry object. The server has a number of global - objects that are available to all clients. These objects + The singleton global registry object. The server has a number of + global objects that are available to all clients. These objects typically represent an actual object in the server (for example, an input device) or they are singleton objects that provide extension functionality. @@ -127,39 +135,39 @@ Binds a new, client-created object to the server using the - specified name as the identifier. + specified name as the identifier. - - + + Notify the client of global objects. - The event notifies the client that a global object with - the given name is now available, and it implements the - given version of the given interface. + The event notifies the client that a global object with + the given name is now available, and it implements the + given version of the given interface. - - - + + + Notify the client of removed global objects. - This event notifies the client that the global identified - by name is no longer available. If the client bound to - the global using the bind request, the client should now - destroy that object. + This event notifies the client that the global identified + by name is no longer available. If the client bound to + the global using the bind request, the client should now + destroy that object. The object remains valid and requests to the object will be ignored until the client destroys it, to avoid races between the global going away and a client sending a request to it. - + @@ -168,15 +176,16 @@ Clients can handle the 'done' event to get notified when the related request is done. + - Notify the client when the related request is done. + Notify the client when the related request is done. - +
- + A compositor. This object is a singleton global. The compositor is in charge of combining the contents of multiple @@ -187,14 +196,14 @@ Ask the compositor to create a new surface. - + Ask the compositor to create a new region. - + @@ -214,8 +223,8 @@ Create a wl_buffer object from the pool. The buffer is created offset bytes into the pool and has - width and height as specified. The stride arguments specifies - the number of bytes from beginning of one row to the beginning + width and height as specified. The stride argument specifies + the number of bytes from the beginning of one row to the beginning of the next. The format is the pixel format of the buffer and must be one of those advertised through the wl_shm.format event. @@ -223,13 +232,12 @@ so it is valid to destroy the pool immediately after creating a buffer from it. - - - - - - - + + + + + + @@ -249,14 +257,13 @@ created, but using the new size. This request can only be used to make the pool bigger. - - + - A global singleton object that provides support for shared + A singleton global object that provides support for shared memory. Clients can create wl_shm_pool objects using the create_pool @@ -278,73 +285,74 @@ - This describes the memory layout of an individual pixel. + This describes the memory layout of an individual pixel. - All renderers should support argb8888 and xrgb8888 but any other - formats are optional and may not be supported by the particular - renderer in use. + All renderers should support argb8888 and xrgb8888 but any other + formats are optional and may not be supported by the particular + renderer in use. + + The drm format codes match the macros defined in drm_fourcc.h. + The formats actually supported by the compositor will be + reported by the format event. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -353,12 +361,11 @@ The pool can be used to create shared memory based buffer objects. The server will mmap size bytes of the passed file - descriptor, to use as backing memory for the pool. + descriptor, to use as backing memory for the pool. - - - - + + + @@ -367,7 +374,7 @@ can be used for buffers. Known formats include argb8888 and xrgb8888. - + @@ -392,13 +399,13 @@ Sent when this wl_buffer is no longer used by the compositor. - The client is now free to re-use or destroy this buffer and its + The client is now free to reuse or destroy this buffer and its backing storage. If a client receives a release event before the frame callback requested in the same wl_surface.commit that attaches this wl_buffer to a surface, then the client is immediately free to - re-use the buffer and its backing storage, and does not need a + reuse the buffer and its backing storage, and does not need a second buffer for the next surface content update. Typically this is possible, when the compositor maintains a copy of the wl_surface contents, e.g. as a GL texture. This is an important @@ -407,8 +414,7 @@
- - + A wl_data_offer represents a piece of data offered for transfer by another client (the source client). It is used by the @@ -418,16 +424,36 @@ data directly from the source client. + + + + + + + Indicate that the client can accept the given mime type, or NULL for not accepted. - Used for feedback during drag-and-drop. - + For objects of version 2 or older, this request is used by the + client to give feedback whether the client can receive the given + mime type, or NULL if none is accepted; the feedback does not + determine whether the drag-and-drop operation succeeds or not. - - + For objects of version 3 or newer, this request determines the + final result of the drag-and-drop operation. If the end result + is that no mime types were accepted, the drag-and-drop operation + will be cancelled and the corresponding drag source will receive + wl_data_source.cancelled. Clients may still use this event in + conjunction with wl_data_source.action for feedback. + + + @@ -440,11 +466,16 @@ file descriptor. The receiving client reads from the read end of the pipe until - EOF and the closes its end, at which point the transfer is + EOF and then closes its end, at which point the transfer is complete. + + This request may happen multiple times for different mime types, + both before and after wl_data_device.drop. Drag-and-drop destination + clients may preemptively fetch data or examine it more closely to + determine acceptance. - - + + @@ -458,12 +489,117 @@ Sent immediately after creating the wl_data_offer object. One event per offered mime type. + + - + + + + + Notifies the compositor that the drag destination successfully + finished the drag-and-drop operation. + + Upon receiving this request, the compositor will emit + wl_data_source.dnd_finished on the drag source client. + + It is a client error to perform other requests than + wl_data_offer.destroy after this one. It is also an error to perform + this request after a NULL mime type has been set in + wl_data_offer.accept or no action was received through + wl_data_offer.action. + + + + + + Sets the actions that the destination side client supports for + this operation. This request may trigger the emission of + wl_data_source.action and wl_data_offer.action events if the compositor + needs to change the selected action. + + This request can be called multiple times throughout the + drag-and-drop operation, typically in response to wl_data_device.enter + or wl_data_device.motion events. + + This request determines the final result of the drag-and-drop + operation. If the end result is that no action is accepted, + the drag source will receive wl_drag_source.cancelled. + + The dnd_actions argument must contain only values expressed in the + wl_data_device_manager.dnd_actions enum, and the preferred_action + argument must only contain one of those values set, otherwise it + will result in a protocol error. + + While managing an "ask" action, the destination drag-and-drop client + may perform further wl_data_offer.receive requests, and is expected + to perform one last wl_data_offer.set_actions request with a preferred + action other than "ask" (and optionally wl_data_offer.accept) before + requesting wl_data_offer.finish, in order to convey the action selected + by the user. If the preferred action is not in the + wl_data_offer.source_actions mask, an error will be raised. + + If the "ask" action is dismissed (e.g. user cancellation), the client + is expected to perform wl_data_offer.destroy right away. + + This request can only be made on drag-and-drop offers, a protocol error + will be raised otherwise. + + + + + + + + This event indicates the actions offered by the data source. It + will be sent right after wl_data_device.enter, or anytime the source + side changes its offered actions through wl_data_source.set_actions. + + + + + + + This event indicates the action selected by the compositor after + matching the source/destination side actions. Only one action (or + none) will be offered here. + + This event can be emitted multiple times during the drag-and-drop + operation in response to destination side action changes through + wl_data_offer.set_actions. + + This event will no longer be emitted after wl_data_device.drop + happened on the drag-and-drop destination, the client must + honor the last action received, or the last preferred one set + through wl_data_offer.set_actions when handling an "ask" action. + + Compositors may also change the selected action on the fly, mainly + in response to keyboard modifier changes during the drag-and-drop + operation. + + The most recent action received is always the valid one. Prior to + receiving wl_data_device.drop, the chosen action may change (e.g. + due to keyboard modifiers being pressed). At the time of receiving + wl_data_device.drop the drag-and-drop destination must honor the + last action received. + + Action changes may still happen after wl_data_device.drop, + especially on "ask" actions, where the drag-and-drop destination + may choose another action afterwards. Action changes happening + at this stage are always the result of inter-client negotiation, the + compositor shall no longer be able to induce a different action. + + Upon "ask" actions, it is expected that the drag-and-drop destination + may potentially choose a different action and/or mime type, + based on wl_data_offer.source_actions and finally chosen by the + user (e.g. popping up a menu with the available options). The + final wl_data_offer.set_actions and wl_data_offer.accept requests + must happen before the call to wl_data_offer.finish. + + - + The wl_data_source object is the source side of a wl_data_offer. It is created by the source client in a data transfer and @@ -471,13 +607,20 @@ to requests to transfer the data. + + + + + This request adds a mime type to the set of mime types advertised to targets. Can be called several times to offer multiple types. - + @@ -493,8 +636,7 @@ Used for feedback during drag-and-drop. - - + @@ -503,21 +645,114 @@ specified mime type over the passed file descriptor, then close it. - - - + + - This data source has been replaced by another data source. + This data source is no longer valid. There are several reasons why + this could happen: + + - The data source has been replaced by another data source. + - The drag-and-drop operation was performed, but the drop destination + did not accept any of the mime types offered through + wl_data_source.target. + - The drag-and-drop operation was performed, but the drop destination + did not select any of the actions present in the mask offered through + wl_data_source.action. + - The drag-and-drop operation was performed but didn't happen over a + surface. + - The compositor cancelled the drag-and-drop operation (e.g. compositor + dependent timeouts to avoid stale drag-and-drop transfers). + The client should clean up and destroy this data source. + + For objects of version 2 or older, wl_data_source.cancelled will + only be emitted if the data source was replaced by another data + source. + + + + + Sets the actions that the source side client supports for this + operation. This request may trigger wl_data_source.action and + wl_data_offer.action events if the compositor needs to change the + selected action. + + The dnd_actions argument must contain only values expressed in the + wl_data_device_manager.dnd_actions enum, otherwise it will result + in a protocol error. + + This request must be made once only, and can only be made on sources + used in drag-and-drop, so it must be performed before + wl_data_device.start_drag. Attempting to use the source other than + for drag-and-drop will raise a protocol error. + + + + + + + The user performed the drop action. This event does not indicate + acceptance, wl_data_source.cancelled may still be emitted afterwards + if the drop destination does not accept any mime type. + + However, this event might however not be received if the compositor + cancelled the drag-and-drop operation before this event could happen. + + Note that the data_source may still be used in the future and should + not be destroyed here. + + + + + + The drop destination finished interoperating with this data + source, so the client is now free to destroy this data source and + free all associated data. + + If the action used to perform the operation was "move", the + source can now delete the transferred data. + + + + + + This event indicates the action selected by the compositor after + matching the source/destination side actions. Only one action (or + none) will be offered here. + + This event can be emitted multiple times during the drag-and-drop + operation, mainly in response to destination side changes through + wl_data_offer.set_actions, and as the data device enters/leaves + surfaces. + + It is only possible to receive this event after + wl_data_source.dnd_drop_performed if the drag-and-drop operation + ended in an "ask" action, in which case the final wl_data_source.action + event will happen immediately before wl_data_source.dnd_finished. + + Compositors may also change the selected action on the fly, mainly + in response to keyboard modifier changes during the drag-and-drop + operation. + + The most recent action received is always the valid one. The chosen + action may change alongside negotiation (e.g. an "ask" action can turn + into a "move" operation), so the effects of the final action must + always be applied in wl_data_offer.dnd_finished. + + Clients can trigger cursor surface changes from this point, so + they reflect the current action. + + + - + There is one wl_data_device per seat which can be obtained from the global wl_data_device_manager singleton. @@ -525,6 +760,11 @@ A wl_data_device provides access to inter-client data transfer mechanisms such as copy-and-paste and drag-and-drop. + + + + + This request asks the compositor to start a drag-and-drop @@ -545,7 +785,9 @@ the top-left corner of the icon surface is placed at the cursor hotspot, but subsequent wl_surface.attach request can move the relative position. Attach requests must be confirmed with - wl_surface.commit as usual. + wl_surface.commit as usual. The icon surface is given the role of + a drag-and-drop icon. If the icon surface already has another role, + it raises a protocol error. The current and pending input regions of the icon wl_surface are cleared, and wl_surface.set_input_region is ignored until the @@ -553,10 +795,10 @@ as an icon ends, the current and pending input regions become undefined, and the wl_surface is unmapped. - - - - + + + + @@ -566,8 +808,8 @@ To unset the selection, set the source to NULL. - - + + @@ -580,23 +822,22 @@ object will send out data_offer.offer events to describe the mime types it offers. - - + This event is sent when an active drag-and-drop pointer enters a surface owned by the client. The position of the pointer at - enter time is provided by the x and y arguments, in surface - local coordinates. + enter time is provided by the x and y arguments, in surface-local + coordinates. - - - - - - + + + + + @@ -611,18 +852,29 @@ This event is sent when the drag-and-drop pointer moves within the currently focused surface. The new position of the pointer - is provided by the x and y arguments, in surface local + is provided by the x and y arguments, in surface-local coordinates. - - + + - + The event is sent when a drag-and-drop operation is ended because the implicit grab is removed. + + The drag-and-drop destination is expected to honor the last action + received through wl_data_offer.action, if the resulting action is + "copy" or "move", the destination can still perform + wl_data_offer.receive requests, and is expected to end all + transfers with a wl_data_offer.finish request. + + If the resulting action is "ask", the action will not be considered + final. The drag-and-drop destination is expected to perform one last + wl_data_offer.set_actions request, or wl_data_offer.destroy in order + to cancel the operation. @@ -636,35 +888,85 @@ immediately before receiving keyboard focus and when a new selection is set while the client has keyboard focus. The data_offer is valid until a new data_offer or NULL is received - or until the client loses keyboard focus. + or until the client loses keyboard focus. The client must + destroy the previous selection data_offer, if any, upon receiving + this event. - + + + + + + + This request destroys the data device. + + - + The wl_data_device_manager is a singleton global object that provides access to inter-client data transfer mechanisms such as copy-and-paste and drag-and-drop. These mechanisms are tied to a wl_seat and this interface lets a client get a wl_data_device corresponding to a wl_seat. + + Depending on the version bound, the objects created from the bound + wl_data_device_manager object will have different requirements for + functioning properly. See wl_data_source.set_actions, + wl_data_offer.accept and wl_data_offer.finish for details. - Create a new data source. + Create a new data source. - + - Create a new data device for a given seat. + Create a new data device for a given seat. - - + + + + + + + + This is a bitmask of the available/preferred actions in a + drag-and-drop operation. + + In the compositor, the selected action is a result of matching the + actions offered by the source and destination sides. "action" events + with a "none" action will be sent to both source and destination if + there is no match. All further checks will effectively happen on + (source actions ∩ destination actions). + + In addition, compositors may also pick different actions in + reaction to key modifiers being pressed. One common design that + is used in major toolkits (and the behavior recommended for + compositors) is: + + - If no modifiers are pressed, the first match (in bit order) + will be used. + - Pressing Shift selects "move", if enabled in the mask. + - Pressing Control selects "copy", if enabled in the mask. + + Behavior beyond that is considered implementation-dependent. + Compositors may for example bind other modifiers (like Alt/Meta) + or drags initiated with other buttons than BTN_LEFT to specific + actions (e.g. "ask"). + + + + + + @@ -674,21 +976,29 @@ It allows clients to associate a wl_shell_surface with a basic surface. + + Note! This protocol is deprecated and not intended for production use. + For desktop-style user interfaces, use xdg_shell. + + + + - Create a shell surface for an existing surface. + Create a shell surface for an existing surface. This gives + the wl_surface the role of a shell surface. If the wl_surface + already has another role, it raises a protocol error. Only one shell surface can be associated with a given surface. - - + + - An interface that may be implemented by a wl_surface, for implementations that provide a desktop-style user interface. @@ -698,7 +1008,7 @@ metadata like title and class, etc. On the server side the object is automatically destroyed when - the related wl_surface is destroyed. On client side, + the related wl_surface is destroyed. On the client side, wl_shell_surface_destroy() must be called before destroying the wl_surface object. @@ -708,7 +1018,7 @@ A client must respond to a ping event with a pong request or the client may be deemed unresponsive. - + @@ -719,26 +1029,26 @@ The server may ignore move requests depending on the state of the surface (e.g. fullscreen or maximized). - - + + - + These values are used to indicate which edge of a surface is being dragged in a resize operation. The server may use this information to adapt its behavior, e.g. choose an appropriate cursor image. - - - - - - - - - + + + + + + + + + @@ -749,9 +1059,9 @@ The server may ignore resize requests depending on the state of the surface (e.g. fullscreen or maximized). - - - + + + @@ -762,7 +1072,7 @@ - + These flags specify details of the expected behaviour of transient surfaces. Used in the set_transient request. @@ -774,17 +1084,16 @@ Map the surface relative to an existing surface. - The x and y arguments specify the locations of the upper left + The x and y arguments specify the location of the upper left corner of the surface relative to the upper left corner of the - parent surface, in surface local coordinates. + parent surface, in surface-local coordinates. The flags argument controls details of the transient behaviour. - - - - - + + + + @@ -815,7 +1124,7 @@ The framerate parameter is used only when the method is set to "driver", to indicate the preferred framerate. A value of 0 - indicates that the app does not care about framerate. The + indicates that the client does not care about framerate. The framerate is specified in mHz, that is framerate of 60000 is 60Hz. A method of "scale" or "driver" implies a scaling operation of @@ -835,9 +1144,10 @@ with the dimensions for the output on which the surface will be made fullscreen. - - - + + + @@ -853,22 +1163,21 @@ be unmapped). The popup grab continues until the window is destroyed or a - mouse button is pressed in any other clients window. A click - in any of the clients surfaces is reported as normal, however, - clicks in other clients surfaces will be discarded and trigger + mouse button is pressed in any other client's window. A click + in any of the client's surfaces is reported as normal, however, + clicks in other clients' surfaces will be discarded and trigger the callback. - The x and y arguments specify the locations of the upper left + The x and y arguments specify the location of the upper left corner of the surface relative to the upper left corner of the - parent surface, in surface local coordinates. + parent surface, in surface-local coordinates. - - - - - - - + + + + + + @@ -886,13 +1195,14 @@ on the next buffer attach to this surface. A maximized surface typically fills the entire output it is - bound to, except for desktop element such as panels. This is + bound to, except for desktop elements such as panels. This is the main difference between a maximized shell surface and a fullscreen shell surface. The details depend on the compositor implementation. - + @@ -905,7 +1215,7 @@ The string must be encoded in UTF-8. - + @@ -917,7 +1227,7 @@ file name (or the full path if it is a non-standard location) of the application's .desktop file as the class. - + @@ -925,7 +1235,7 @@ Ping a client to check if it is receiving events and sending requests. A client is expected to reply with a pong request. - + @@ -946,12 +1256,11 @@ event it received. The width and height arguments specify the size of the window - in surface local coordinates. + in surface-local coordinates. - - - - + + + @@ -963,23 +1272,52 @@ - + A surface is a rectangular area that is displayed on the screen. It has a location, size and pixel contents. The size of a surface (and relative positions on it) is described - in surface local coordinates, which may differ from the buffer - local coordinates of the pixel content, in case a buffer_transform + in surface-local coordinates, which may differ from the buffer + coordinates of the pixel content, in case a buffer_transform or a buffer_scale is used. - Surfaces are also used for some special purposes, e.g. as - cursor images for pointers, drag icons, etc. + A surface without a "role" is fairly useless: a compositor does + not know where, when or how to present it. The role is the + purpose of a wl_surface. Examples of roles are a cursor for a + pointer (as set by wl_pointer.set_cursor), a drag icon + (wl_data_device.start_drag), a sub-surface + (wl_subcompositor.get_subsurface), and a window as defined by a + shell protocol (e.g. wl_shell.get_shell_surface). + + A surface can have only one role at a time. Initially a + wl_surface does not have a role. Once a wl_surface is given a + role, it is set permanently for the whole lifetime of the + wl_surface object. Giving the current role again is allowed, + unless explicitly forbidden by the relevant interface + specification. + + Surface roles are given by requests in other interfaces such as + wl_pointer.set_cursor. The request should explicitly mention + that this request gives a role to a wl_surface. Often, this + request also creates a new protocol object that represents the + role and adds additional functionality to wl_surface. When a + client wants to destroy a wl_surface, they must destroy this 'role + object' before the wl_surface. + + Destroying the role object does not remove the role from the + wl_surface, but it may stop the wl_surface from "playing the role". + For instance, if a wl_subsurface object is destroyed, the wl_surface + it was created for will be unmapped and forget its position and + z-order. It is allowed to create a wl_subsurface for the same + wl_surface again, but it is not allowed to use the wl_surface as + a cursor (cursor is a different role than sub-surface, and role + switching is not allowed). - These errors can be emitted in response to wl_surface requests. + These errors can be emitted in response to wl_surface requests. @@ -1002,7 +1340,7 @@ The x and y arguments specify the location of the new pending buffer's upper left corner, relative to the current buffer's upper - left corner, in surface local coordinates. In other words, the + left corner, in surface-local coordinates. In other words, the x and y, combined with the new surface size define in which directions the surface's size changes. @@ -1020,7 +1358,7 @@ any time after the wl_surface.commit request. When the compositor will not access the pixels anymore, it will send the wl_buffer.release event. Only after receiving wl_buffer.release, - the client may re-use the wl_buffer. A wl_buffer that has been + the client may reuse the wl_buffer. A wl_buffer that has been attached and then replaced by another attach instead of committed will not receive a release event, and is not used by the compositor. @@ -1033,24 +1371,23 @@ If wl_surface.attach is sent with a NULL wl_buffer, the following wl_surface.commit will remove the surface content. - - - - + + + This request is used to describe the regions where the pending buffer is different from the current surface contents, and where - the surface therefore needs to be repainted. The pending buffer - must be set by wl_surface.attach before sending damage. The - compositor ignores the parts of the damage that fall outside of - the surface. + the surface therefore needs to be repainted. The compositor + ignores the parts of the damage that fall outside of the surface. Damage is double-buffered state, see wl_surface.commit. - The damage rectangle is specified in surface local coordinates. + The damage rectangle is specified in surface-local coordinates, + where x and y specify the upper left corner of the damage rectangle. The initial value for pending damage is empty: no damage. wl_surface.damage adds pending damage: the new pending damage @@ -1059,17 +1396,20 @@ wl_surface.commit assigns pending damage as the current damage, and clears pending damage. The server will clear the current damage as it repaints the surface. - - - - - + Alternatively, damage can be posted with wl_surface.damage_buffer + which uses buffer coordinates instead of surface coordinates, + and is probably the preferred and intuitive way of doing this. + + + + + - Request a notification when it is a good time start drawing a new + Request a notification when it is a good time to start drawing a new frame, by creating a frame callback. This is useful for throttling redrawing operations, and driving animations. @@ -1088,10 +1428,10 @@ will not send excessive updates, while still allowing the highest possible update rate for clients that wait for the reply before drawing again. The server should give some time for the client - to draw and commit after sending the frame callback events to let them + to draw and commit after sending the frame callback events to let it hit the next output refresh. - A server should avoid signalling the frame callbacks if the + A server should avoid signaling the frame callbacks if the surface is not visible in any way, e.g. the surface is off-screen, or completely obscured by other opaque surfaces. @@ -1102,8 +1442,7 @@ The callback_data passed in the callback is the current time, in milliseconds, with an undefined base. - - + @@ -1112,12 +1451,12 @@ opaque content. The opaque region is an optimization hint for the compositor - that lets it optimize out redrawing of content behind opaque + that lets it optimize the redrawing of content behind opaque regions. Setting an opaque region is not required for correct behaviour, but marking transparent content as opaque will result in repaint artifacts. - The opaque region is specified in surface local coordinates. + The opaque region is specified in surface-local coordinates. The compositor ignores the parts of the opaque region that fall outside of the surface. @@ -1128,13 +1467,13 @@ wl_surface.commit copies the pending region to the current region. Otherwise, the pending and current regions are never changed. - The initial value for opaque region is empty. Setting the pending + The initial value for an opaque region is empty. Setting the pending opaque region has copy semantics, and the wl_region object can be destroyed immediately. A NULL wl_region causes the pending opaque region to be set to empty. - - + @@ -1146,7 +1485,7 @@ surface in the server surface stack. The compositor ignores the parts of the input region that fall outside of the surface. - The input region is specified in surface local coordinates. + The input region is specified in surface-local coordinates. Input region is double-buffered state, see wl_surface.commit. @@ -1156,26 +1495,26 @@ except cursor and icon surfaces are special cases, see wl_pointer.set_cursor and wl_data_device.start_drag. - The initial value for input region is infinite. That means the + The initial value for an input region is infinite. That means the whole surface will accept input. Setting the pending input region has copy semantics, and the wl_region object can be destroyed immediately. A NULL wl_region causes the input region to be set to infinite. - - + Surface state (input, opaque, and damage regions, attached buffers, - etc.) is double-buffered. Protocol requests modify the pending - state, as opposed to current state in use by the compositor. Commit + etc.) is double-buffered. Protocol requests modify the pending state, + as opposed to the current state in use by the compositor. A commit request atomically applies all pending state, replacing the current state. After commit, the new pending state is as documented for each related request. - On commit, a pending wl_buffer is applied first, all other state + On commit, a pending wl_buffer is applied first, and all other state second. This means that all coordinates in double-buffered state are relative to the new wl_buffer coming into use, except for wl_surface.attach itself. If there is no pending wl_buffer, the @@ -1196,7 +1535,7 @@ Note that a surface may be overlapping with zero or more outputs. - + @@ -1205,7 +1544,7 @@ results in it no longer having any part of it within the scanout region of an output. - + @@ -1227,7 +1566,7 @@ values are never changed. The purpose of this request is to allow clients to render content - according to the output transform, thus permiting the compositor to + according to the output transform, thus permitting the compositor to use certain optimizations even if the display is rotated. Using hardware overlays and scanning out a client buffer for fullscreen surfaces are examples of such optimizations. Those optimizations are @@ -1242,7 +1581,8 @@ wl_output.transform enum the invalid_transform protocol error is raised. - + @@ -1261,9 +1601,9 @@ Otherwise, the pending and current values are never changed. The purpose of this request is to allow clients to supply higher - resolution buffer data for use on high resolution outputs. Its - intended that you pick the same buffer scale as the scale of the - output that the surface is displayed on.This means the compositor + resolution buffer data for use on high resolution outputs. It is + intended that you pick the same buffer scale as the scale of the + output that the surface is displayed on. This means the compositor can avoid scaling when rendering the surface on that output. Note that if the scale is larger than 1, then you have to attach @@ -1273,11 +1613,54 @@ If scale is not positive the invalid_scale protocol error is raised. - + + + + + + + This request is used to describe the regions where the pending + buffer is different from the current surface contents, and where + the surface therefore needs to be repainted. The compositor + ignores the parts of the damage that fall outside of the surface. + + Damage is double-buffered state, see wl_surface.commit. + + The damage rectangle is specified in buffer coordinates, + where x and y specify the upper left corner of the damage rectangle. + + The initial value for pending damage is empty: no damage. + wl_surface.damage_buffer adds pending damage: the new pending + damage is the union of old pending damage and the given rectangle. + + wl_surface.commit assigns pending damage as the current damage, + and clears pending damage. The server will clear the current + damage as it repaints the surface. + + This request differs from wl_surface.damage in only one way - it + takes damage in buffer coordinates instead of surface-local + coordinates. While this generally is more intuitive than surface + coordinates, it is especially desirable when using wp_viewport + or when a drawing library (like EGL) is unaware of buffer scale + and buffer transform. + + Note: Because buffer transformation changes and damage requests may + be interleaved in the protocol stream, it is impossible to determine + the actual mapping between surface and buffer damage until + wl_surface.commit time. Therefore, compositors wishing to take both + kinds of damage into account will have to accumulate damage from the + two requests separately and only transform from one to the other + after receiving the wl_surface.commit. + + + + + - + A seat is a group of keyboards, pointer and touch devices. This object is published as a global during start up, or when such a @@ -1285,59 +1668,86 @@ maintains a keyboard focus and a pointer focus. - + - This is a bitmask of capabilities this seat has; if a member is - set, then it is present on the seat. + This is a bitmask of capabilities this seat has; if a member is + set, then it is present on the seat. - - - + + + - This is emitted whenever a seat gains or loses the pointer, + This is emitted whenever a seat gains or loses the pointer, keyboard or touch capabilities. The argument is a capability enum containing the complete set of capabilities this seat has. + + When the pointer capability is added, a client may create a + wl_pointer object using the wl_seat.get_pointer request. This object + will receive pointer events until the capability is removed in the + future. + + When the pointer capability is removed, a client should destroy the + wl_pointer objects associated with the seat where the capability was + removed, using the wl_pointer.release request. No further pointer + events will be received on these objects. + + In some compositors, if a seat regains the pointer capability and a + client has a previously obtained wl_pointer object of version 4 or + less, that object may start sending pointer events again. This + behavior is considered a misinterpretation of the intended behavior + and must not be relied upon by the client. wl_pointer objects of + version 5 or later must not send events if created before the most + recent event notifying the client of an added pointer capability. + + The above behavior also applies to wl_keyboard and wl_touch with the + keyboard and touch capabilities, respectively. - + - The ID provided will be initialized to the wl_pointer interface + The ID provided will be initialized to the wl_pointer interface for this seat. - This request only takes effect if the seat has the pointer - capability. + This request only takes effect if the seat has the pointer + capability, or has had the pointer capability in the past. + It is a protocol violation to issue this request on a seat that has + never had the pointer capability. - + - The ID provided will be initialized to the wl_keyboard interface + The ID provided will be initialized to the wl_keyboard interface for this seat. - This request only takes effect if the seat has the keyboard - capability. + This request only takes effect if the seat has the keyboard + capability, or has had the keyboard capability in the past. + It is a protocol violation to issue this request on a seat that has + never had the keyboard capability. - + - The ID provided will be initialized to the wl_touch interface + The ID provided will be initialized to the wl_touch interface for this seat. - This request only takes effect if the seat has the touch - capability. + This request only takes effect if the seat has the touch + capability, or has had the touch capability in the past. + It is a protocol violation to issue this request on a seat that has + never had the touch capability. - + - + @@ -1345,12 +1755,21 @@ identify which physical devices the seat represents. Based on the seat configuration used by the compositor. - + + + + + + Using this request a client can tell the server that it is not going to + use the seat object anymore. + + + - + The wl_pointer interface represents one or more input devices, such as mice, which control the pointer location and pointer_focus @@ -1362,10 +1781,18 @@ and scrolling. + + + + Set the pointer surface, i.e., the surface that contains the - pointer image (cursor). This request only takes effect if the pointer + pointer image (cursor). This request gives the surface the role + of a cursor. If the surface already has another role, it raises + a protocol error. + + The cursor actually changes only if the pointer focus for this device is one of the requesting client's surfaces or the surface parameter is the current pointer surface. If there was a previous surface set with this request it is @@ -1374,8 +1801,8 @@ The parameters hotspot_x and hotspot_y define the position of the pointer surface relative to the pointer location. Its top-left corner is always at (x, y) - (hotspot_x, hotspot_y), - where (x, y) are the coordinates of the pointer location, in surface - local coordinates. + where (x, y) are the coordinates of the pointer location, in + surface-local coordinates. On surface.attach requests to the pointer surface, hotspot_x and hotspot_y are decremented by the x and y parameters @@ -1392,11 +1819,11 @@ cursor ends, the current and pending input regions become undefined, and the wl_surface is unmapped. - - - - - + + + + @@ -1404,15 +1831,14 @@ Notification that this seat's pointer is focused on a certain surface. - When an seat's focus enters a surface, the pointer image + When a seat's focus enters a surface, the pointer image is undefined and a client should respond to this event by setting an appropriate pointer image with the set_cursor request. - - - - - + + + + @@ -1423,8 +1849,8 @@ The leave notification is sent before the enter notification for the new focus. - - + + @@ -1433,19 +1859,18 @@ surface_x and surface_y are the location relative to the focused surface. - - - + + - Describes the physical state of a button which provoked the button + Describes the physical state of a button that produced the button event. - - + + @@ -1454,22 +1879,29 @@ The location of the click is given by the last motion or enter event. - The time argument is a timestamp with millisecond - granularity, with an undefined base. - + The time argument is a timestamp with millisecond + granularity, with an undefined base. - + The button is a button code as defined in the Linux kernel's + linux/input-event-codes.h header file, e.g. BTN_LEFT. + + Any 16-bit button code value is reserved for future additions to the + kernel's event code list. All other button codes above 0xFFFF are + currently undefined but may be used in future versions of this + protocol. + + - - + + Describes the axis types of scroll events. - - + + @@ -1488,24 +1920,179 @@ choose to emit scroll events where the motion vector is equivalent to a motion event vector. - When applicable, clients can transform its view relative to the + When applicable, a client can transform its content relative to the scroll distance. - - - + + - + + Using this request a client can tell the server that it is not going to + use the pointer object anymore. + + This request destroys the pointer proxy object, so clients must not call + wl_pointer_destroy() after using this request. + + + + + + Indicates the end of a set of events that logically belong together. + A client is expected to accumulate the data in all events within the + frame before proceeding. + + All wl_pointer events before a wl_pointer.frame event belong + logically together. For example, in a diagonal scroll motion the + compositor will send an optional wl_pointer.axis_source event, two + wl_pointer.axis events (horizontal and vertical) and finally a + wl_pointer.frame event. The client may use this information to + calculate a diagonal vector for scrolling. + + When multiple wl_pointer.axis events occur within the same frame, + the motion vector is the combined motion of all events. + When a wl_pointer.axis and a wl_pointer.axis_stop event occur within + the same frame, this indicates that axis movement in one axis has + stopped but continues in the other axis. + When multiple wl_pointer.axis_stop events occur within the same + frame, this indicates that these axes stopped in the same instance. + + A wl_pointer.frame event is sent for every logical event group, + even if the group only contains a single wl_pointer event. + Specifically, a client may get a sequence: motion, frame, button, + frame, axis, frame, axis_stop, frame. + + The wl_pointer.enter and wl_pointer.leave events are logical events + generated by the compositor and not the hardware. These events are + also grouped by a wl_pointer.frame. When a pointer moves from one + surface to another, a compositor should group the + wl_pointer.leave event within the same wl_pointer.frame. + However, a client must not rely on wl_pointer.leave and + wl_pointer.enter being in the same wl_pointer.frame. + Compositor-specific policies may require the wl_pointer.leave and + wl_pointer.enter event being split across multiple wl_pointer.frame + groups. + + + + + + Describes the source types for axis events. This indicates to the + client how an axis event was physically generated; a client may + adjust the user interface accordingly. For example, scroll events + from a "finger" source may be in a smooth coordinate space with + kinetic scrolling whereas a "wheel" source may be in discrete steps + of a number of lines. + + The "continuous" axis source is a device generating events in a + continuous coordinate space, but using something other than a + finger. One example for this source is button-based scrolling where + the vertical motion of a device is converted to scroll events while + a button is held down. + + The "wheel tilt" axis source indicates that the actual device is a + wheel but the scroll event is not caused by a rotation but a + (usually sideways) tilt of the wheel. + + + + + + + + + + Source information for scroll and other axes. + + This event does not occur on its own. It is sent before a + wl_pointer.frame event and carries the source information for + all events within that frame. + + The source specifies how this event was generated. If the source is + wl_pointer.axis_source.finger, a wl_pointer.axis_stop event will be + sent when the user lifts the finger off the device. + + If the source is wl_pointer.axis_source.wheel, + wl_pointer.axis_source.wheel_tilt or + wl_pointer.axis_source.continuous, a wl_pointer.axis_stop event may + or may not be sent. Whether a compositor sends an axis_stop event + for these sources is hardware-specific and implementation-dependent; + clients must not rely on receiving an axis_stop event for these + scroll sources and should treat scroll sequences from these scroll + sources as unterminated by default. + + This event is optional. If the source is unknown for a particular + axis event sequence, no event is sent. + Only one wl_pointer.axis_source event is permitted per frame. + + The order of wl_pointer.axis_discrete and wl_pointer.axis_source is + not guaranteed. + + + + + + + Stop notification for scroll and other axes. + + For some wl_pointer.axis_source types, a wl_pointer.axis_stop event + is sent to notify a client that the axis sequence has terminated. + This enables the client to implement kinetic scrolling. + See the wl_pointer.axis_source documentation for information on when + this event may be generated. + + Any wl_pointer.axis events with the same axis_source after this + event should be considered as the start of a new axis motion. + + The timestamp is to be interpreted identical to the timestamp in the + wl_pointer.axis event. The timestamp value may be the same as a + preceding wl_pointer.axis event. + + + + + + + + Discrete step information for scroll and other axes. + + This event carries the axis value of the wl_pointer.axis event in + discrete steps (e.g. mouse wheel clicks). + + This event does not occur on its own, it is coupled with a + wl_pointer.axis event that represents this axis value on a + continuous scale. The protocol guarantees that each axis_discrete + event is always followed by exactly one axis event with the same + axis number within the same wl_pointer.frame. Note that the protocol + allows for other events to occur between the axis_discrete and + its coupled axis event, including other axis_discrete or axis + events. + + This event is optional; continuous scrolling devices + like two-finger scrolling on touchpads do not have discrete + steps and do not generate this event. + + The discrete value carries the directional information. e.g. a value + of -2 is two steps towards the negative direction of this axis. + + The axis number is identical to the axis number in the associated + axis event. + + The order of wl_pointer.axis_discrete and wl_pointer.axis_source is + not guaranteed. + + + + - + The wl_keyboard interface represents one or more keyboards associated with a seat. @@ -1519,7 +2106,7 @@ + summary="libxkbcommon compatible; to determine the xkb keycode, clients must add 8 to the key event keycode"/> @@ -1527,9 +2114,9 @@ This event provides a file descriptor to the client which can be memory-mapped to provide a keyboard mapping description. - - - + + + @@ -1537,8 +2124,8 @@ Notification that this seat's keyboard focus is on a certain surface. - - + + @@ -1550,13 +2137,13 @@ The leave notification is sent before the enter notification for the new focus. - - + + - Describes the physical state of a key which provoked the key event. + Describes the physical state of a key that produced the key event. @@ -1565,14 +2152,13 @@ A key was pressed or released. - The time argument is a timestamp with millisecond - granularity, with an undefined base. + The time argument is a timestamp with millisecond + granularity, with an undefined base. - - + - - + + @@ -1580,12 +2166,11 @@ Notifies clients that the modifier and/or group state has changed, and it should update its local state. - - - - - - + + + + + @@ -1598,28 +2183,27 @@ - Informs the client about the keyboard's repeat rate and delay. + Informs the client about the keyboard's repeat rate and delay. - This event is sent as soon as the wl_keyboard object has been created, - and is guaranteed to be received by the client before any key press - event. + This event is sent as soon as the wl_keyboard object has been created, + and is guaranteed to be received by the client before any key press + event. - Negative values for either rate or delay are illegal. A rate of zero - will disable any repeating (regardless of the value of delay). + Negative values for either rate or delay are illegal. A rate of zero + will disable any repeating (regardless of the value of delay). - This event can be sent later on as well with a new value if necessary, - so clients should continue listening for the event past the creation - of wl_keyboard. + This event can be sent later on as well with a new value if necessary, + so clients should continue listening for the event past the creation + of wl_keyboard. - + summary="the rate of repeating keys in characters per second"/> + summary="delay in milliseconds since key down until repeating starts"/> - + The wl_touch interface represents a touchscreen associated with a seat. @@ -1634,42 +2218,49 @@ A new touch point has appeared on the surface. This touch point is - assigned a unique @id. Future events from this touchpoint reference + assigned a unique ID. Future events from this touch point reference this ID. The ID ceases to be valid after a touch up event and may be - re-used in the future. + reused in the future. - + - + - - + + The touch point has disappeared. No further events will be sent for - this touchpoint and the touch point's ID is released and may be - re-used in a future touch down event. + this touch point and the touch point's ID is released and may be + reused in a future touch down event. - + - A touchpoint has changed coordinates. + A touch point has changed coordinates. - - + + - Indicates the end of a contact point list. + Indicates the end of a set of events that logically belong together. + A client is expected to accumulate the data in all events within the + frame before proceeding. + + A wl_touch.frame terminates at least one event but otherwise no + guarantee is provided about the set of events within a frame. A client + must assume that any state not updated in a frame is unchanged from the + previously known state. @@ -1680,7 +2271,7 @@ particular gesture. Touch cancellation applies to all touch points currently active on this client's surface. The client is responsible for finalizing the touch points, future touch points on - this surface may re-use the touch point ID. + this surface may reuse the touch point ID. @@ -1689,13 +2280,78 @@ + + + + + + Sent when a touchpoint has changed its shape. + + This event does not occur on its own. It is sent before a + wl_touch.frame event and carries the new shape information for + any previously reported, or new touch points of that frame. + + Other events describing the touch point such as wl_touch.down, + wl_touch.motion or wl_touch.orientation may be sent within the + same wl_touch.frame. A client should treat these events as a single + logical touch point update. The order of wl_touch.shape, + wl_touch.orientation and wl_touch.motion is not guaranteed. + A wl_touch.down event is guaranteed to occur before the first + wl_touch.shape event for this touch ID but both events may occur within + the same wl_touch.frame. + + A touchpoint shape is approximated by an ellipse through the major and + minor axis length. The major axis length describes the longer diameter + of the ellipse, while the minor axis length describes the shorter + diameter. Major and minor are orthogonal and both are specified in + surface-local coordinates. The center of the ellipse is always at the + touchpoint location as reported by wl_touch.down or wl_touch.move. + + This event is only sent by the compositor if the touch device supports + shape reports. The client has to make reasonable assumptions about the + shape if it did not receive this event. + + + + + + + + + Sent when a touchpoint has changed its orientation. + + This event does not occur on its own. It is sent before a + wl_touch.frame event and carries the new shape information for + any previously reported, or new touch points of that frame. + + Other events describing the touch point such as wl_touch.down, + wl_touch.motion or wl_touch.shape may be sent within the + same wl_touch.frame. A client should treat these events as a single + logical touch point update. The order of wl_touch.shape, + wl_touch.orientation and wl_touch.motion is not guaranteed. + A wl_touch.down event is guaranteed to occur before the first + wl_touch.orientation event for this touch ID but both events may occur + within the same wl_touch.frame. + + The orientation describes the clockwise angle of a touchpoint's major + axis to the positive surface y-axis and is normalized to the -180 to + +180 degree range. The granularity of orientation depends on the touch + device, some devices only support binary rotation values between 0 and + 90 degrees. + + This event is only sent by the compositor if the touch device supports + orientation reports. + + + + - + An output describes part of the compositor geometry. The compositor works in the 'compositor coordinate system' and an - output corresponds to rectangular area in that space that is + output corresponds to a rectangular area in that space that is actually visible. This typically corresponds to a monitor that displays part of the compositor space. This object is published as global during start up, or when a monitor is hotplugged. @@ -1704,14 +2360,14 @@ This enumeration describes how the physical - pixels on an output are layed out. + pixels on an output are laid out. - - - - - - + + + + + + @@ -1723,20 +2379,19 @@ The flipped values correspond to an initial flip around a vertical axis followed by rotation. - The purpose is mainly to allow clients render accordingly and + The purpose is mainly to allow clients to render accordingly and tell the compositor, so that for fullscreen surfaces, the compositor will still be able to scan out directly from client surfaces. - - - - - - - - - + + + + + + + + @@ -1744,6 +2399,9 @@ The geometry event describes geometric properties of the output. The event is sent when binding to the output object and whenever any of the properties change. + + The physical size can be set to zero if it doesn't make sense for this + output (e.g. for projectors or virtual outputs). @@ -1753,17 +2411,17 @@ summary="width in millimeters of the output"/> - - - + These flags describe properties of an output mode. They are used in the flags bitfield of the mode event. @@ -1785,33 +2443,35 @@ mode that was received with the current flag set. The size of a mode is given in physical hardware units of - the output device. This is not necessarily the same as - the output size in the global compositor space. For instance, - the output may be scaled, as described in wl_output.scale, - or transformed , as described in wl_output.transform. + the output device. This is not necessarily the same as + the output size in the global compositor space. For instance, + the output may be scaled, as described in wl_output.scale, + or transformed, as described in wl_output.transform. - + + + - This event is sent after all other properties has been - sent after binding to the output object and after any - other property changes done after that. This allows - changes to the output properties to be seen as - atomic, even if they happen via multiple events. + This event is sent after all other properties have been + sent after binding to the output object and after any + other property changes done after that. This allows + changes to the output properties to be seen as + atomic, even if they happen via multiple events. This event contains scaling geometry information - that is not in the geometry event. It may be sent after - binding the output object or if the output scale changes - later. If it is not sent, the client should assume a + that is not in the geometry event. It may be sent after + binding the output object or if the output scale changes + later. If it is not sent, the client should assume a scale of 1. A scale larger than 1 means that the compositor will @@ -1829,6 +2489,15 @@ + + + + + + Using this request a client can tell the server that it is not going to + use the output object anymore. + + @@ -1849,24 +2518,21 @@ Add the specified rectangle to the region. - - - - - + + + + Subtract the specified rectangle from the region. - - - - - + + + + - @@ -1902,7 +2568,7 @@ + summary="the to-be sub-surface is invalid"/> @@ -1911,17 +2577,24 @@ associate it with the given parent surface. This turns a plain wl_surface into a sub-surface. - The to-be sub-surface must not already have a dedicated - purpose, like any shell surface type, cursor image, drag icon, - or sub-surface. Otherwise a protocol error is raised. - + The to-be sub-surface must not already have another role, and it + must not have an existing wl_subsurface object. Otherwise a protocol + error is raised. + Adding sub-surfaces to a parent is a double-buffered operation on the + parent (see wl_surface.commit). The effect of adding a sub-surface + becomes visible on the next time the state of the parent surface is + applied. + + This request modifies the behaviour of wl_surface.commit request on + the sub-surface, see the documentation on wl_subsurface interface. + + summary="the new sub-surface object ID"/> + summary="the surface to be turned into a sub-surface"/> + summary="the parent surface"/> @@ -1939,7 +2612,7 @@ hidden, or if a NULL wl_buffer is applied. These rules apply recursively through the tree of surfaces. - The behaviour of wl_surface.commit request on a sub-surface + The behaviour of a wl_surface.commit request on a sub-surface depends on the sub-surface's mode. The possible modes are synchronized and desynchronized, see methods wl_subsurface.set_sync and wl_subsurface.set_desync. Synchronized @@ -1981,28 +2654,30 @@ The sub-surface interface is removed from the wl_surface object - that was turned into a sub-surface with + that was turned into a sub-surface with a wl_subcompositor.get_subsurface request. The wl_surface's association to the parent is deleted, and the wl_surface loses its role as - a sub-surface. The wl_surface is unmapped. + a sub-surface. The wl_surface is unmapped immediately. + summary="wl_surface is not a sibling or the parent"/> This schedules a sub-surface position change. - The sub-surface will be moved so, that its origin (top-left + The sub-surface will be moved so that its origin (top left corner pixel) will be at the location x, y of the parent surface coordinate system. The coordinates are not restricted to the parent surface area. Negative values are allowed. - The next wl_surface.commit on the parent surface will reset - the sub-surface's position to the scheduled coordinates. + The scheduled coordinates will take effect whenever the state of the + parent surface is applied. When this happens depends on whether the + parent surface is in synchronized mode or not. See + wl_subsurface.set_sync and wl_subsurface.set_desync for details. If more than one set_position request is invoked by the client before the commit of the parent surface, the position of a new request always @@ -2010,9 +2685,8 @@ The initial position is 0, 0. - - - + + @@ -2024,32 +2698,32 @@ will cause a protocol error. The z-order is double-buffered. Requests are handled in order and - applied immediately to a pending state, then committed to the active - state on the next commit of the parent surface. - See wl_surface.commit and wl_subcompositor.get_subsurface. + applied immediately to a pending state. The final pending state is + copied to the active state the next time the state of the parent + surface is applied. When this happens depends on whether the parent + surface is in synchronized mode or not. See wl_subsurface.set_sync and + wl_subsurface.set_desync for details. A new sub-surface is initially added as the top-most in the stack of its siblings and parent. - + summary="the reference surface"/> - The sub-surface is placed just below of the reference surface. + The sub-surface is placed just below the reference surface. See wl_subsurface.place_above. - + summary="the reference surface"/> Change the commit behaviour of the sub-surface to synchronized - mode, also described as the parent dependant mode. + mode, also described as the parent dependent mode. In synchronized mode, wl_surface.commit on a sub-surface will accumulate the committed state in a cache, but the state will @@ -2077,7 +2751,7 @@ If cached state exists when wl_surface.commit is called in desynchronized mode, the pending state is added to the cached - state, and applied as whole. This invalidates the cache. + state, and applied as a whole. This invalidates the cache. Note: even if a sub-surface is set to desynchronized, a parent sub-surface may override it to behave as synchronized. For details, @@ -2087,7 +2761,6 @@ the cached state is applied on set_desync. - From db7724afe36e95f0ddeab2c940f2590e3daff57c Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Wed, 14 Nov 2018 15:47:00 +0100 Subject: [PATCH 0647/1507] Add deprecated support for wl_scaler [ChangeLog][Compositor] Add deprecated support for the deprecated wl_scaler. Some clients are stuck on the unofficial Weston protocol wl_scaler instead of the standardized and stable wp_viewporter. This implements optional support for wl_scaler. This patch has been written to be easily removable in Qt 6, and touches a minimal amount of other code. The implementation can be tested using the new manual test compositor: tests/manual/wlscaler. Weston 1.11.1 has a demo client named weston-resizor, which can be used to test. Note that although newer versions of Weston also have weston-resizor, those versions use wp_viewporter instead of wl_scaler, so you really need 1.11.1 or earlier to test. Fixes: QTBUG-69635 Change-Id: Id572e28044cd764eaf63b1259a92bc589711c39d Reviewed-by: Paul Olav Tvete --- .../wayland/protocols/qt_attribution.json | 17 ++ src/3rdparty/wayland/protocols/scaler.xml | 208 ++++++++++++++++++ 2 files changed, 225 insertions(+) create mode 100644 src/3rdparty/wayland/protocols/scaler.xml diff --git a/src/3rdparty/wayland/protocols/qt_attribution.json b/src/3rdparty/wayland/protocols/qt_attribution.json index 657c032827c..ad32d3af343 100644 --- a/src/3rdparty/wayland/protocols/qt_attribution.json +++ b/src/3rdparty/wayland/protocols/qt_attribution.json @@ -55,6 +55,23 @@ Copyright © 2012-2013 Collabora, Ltd." Copyright (c) 2013 BMW Car IT GmbH" }, + { + "Id": "wayland-scaler-protocol", + "Name": "Wayland Scaler Protocol", + "QDocModule": "qtwaylandcompositor", + "QtUsage": "Used in the Qt Wayland Compositor API", + "Files": "scaler.xml", + + "Description": "The Wayland scaler extension allows a client to scale or crop a surface without modifying the buffer", + "Homepage": "https://wayland.freedesktop.org", + "Version": "2", + "DownloadLocation": "https://cgit.freedesktop.org/wayland/weston/plain/protocol/scaler.xml?h=1.11.1", + "LicenseId": "MIT", + "License": "MIT License", + "LicenseFile": "MIT_LICENSE.txt", + "Copyright": "Copyright © 2013-2014 Collabora, Ltd." + }, + { "Id": "wayland-viewporter-protocol", "Name": "Wayland Viewporter Protocol", diff --git a/src/3rdparty/wayland/protocols/scaler.xml b/src/3rdparty/wayland/protocols/scaler.xml new file mode 100644 index 00000000000..0e482a63518 --- /dev/null +++ b/src/3rdparty/wayland/protocols/scaler.xml @@ -0,0 +1,208 @@ + + + + + Copyright © 2013-2014 Collabora, Ltd. + + 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. + + + + + The global interface exposing surface cropping and scaling + capabilities is used to instantiate an interface extension for a + wl_surface object. This extended interface will then allow + cropping and scaling the surface contents, effectively + disconnecting the direct relationship between the buffer and the + surface size. + + + + + Informs the server that the client will not be using this + protocol object anymore. This does not affect any other objects, + wl_viewport objects included. + + + + + + + + + + Instantiate an interface extension for the given wl_surface to + crop and scale its content. If the given wl_surface already has + a wl_viewport object associated, the viewport_exists + protocol error is raised. + + + + + + + + + + An additional interface to a wl_surface object, which allows the + client to specify the cropping and scaling of the surface + contents. + + This interface allows to define the source rectangle (src_x, + src_y, src_width, src_height) from where to take the wl_buffer + contents, and scale that to destination size (dst_width, + dst_height). This state is double-buffered, and is applied on the + next wl_surface.commit. + + The two parts of crop and scale state are independent: the source + rectangle, and the destination size. Initially both are unset, that + is, no scaling is applied. The whole of the current wl_buffer is + used as the source, and the surface size is as defined in + wl_surface.attach. + + If the destination size is set, it causes the surface size to become + dst_width, dst_height. The source (rectangle) is scaled to exactly + this size. This overrides whatever the attached wl_buffer size is, + unless the wl_buffer is NULL. If the wl_buffer is NULL, the surface + has no content and therefore no size. Otherwise, the size is always + at least 1x1 in surface coordinates. + + If the source rectangle is set, it defines what area of the + wl_buffer is taken as the source. If the source rectangle is set and + the destination size is not set, the surface size becomes the source + rectangle size rounded up to the nearest integer. If the source size + is already exactly integers, this results in cropping without scaling. + + The coordinate transformations from buffer pixel coordinates up to + the surface-local coordinates happen in the following order: + 1. buffer_transform (wl_surface.set_buffer_transform) + 2. buffer_scale (wl_surface.set_buffer_scale) + 3. crop and scale (wl_viewport.set*) + This means, that the source rectangle coordinates of crop and scale + are given in the coordinates after the buffer transform and scale, + i.e. in the coordinates that would be the surface-local coordinates + if the crop and scale was not applied. + + If the source rectangle is partially or completely outside of the + wl_buffer, then the surface contents are undefined (not void), and + the surface size is still dst_width, dst_height. + + The x, y arguments of wl_surface.attach are applied as normal to + the surface. They indicate how many pixels to remove from the + surface size from the left and the top. In other words, they are + still in the surface-local coordinate system, just like dst_width + and dst_height are. + + If the wl_surface associated with the wl_viewport is destroyed, + the wl_viewport object becomes inert. + + If the wl_viewport object is destroyed, the crop and scale + state is removed from the wl_surface. The change will be applied + on the next wl_surface.commit. + + + + + The associated wl_surface's crop and scale state is removed. + The change is applied on the next wl_surface.commit. + + + + + + + + + + Set both source rectangle and destination size of the associated + wl_surface. See wl_viewport for the description, and relation to + the wl_buffer size. + + The bad_value protocol error is raised if src_width or + src_height is negative, or if dst_width or dst_height is not + positive. + + The crop and scale state is double-buffered state, and will be + applied on the next wl_surface.commit. + + Arguments dst_x and dst_y do not exist here, use the x and y + arguments to wl_surface.attach. The x, y, dst_width, and dst_height + define the surface-local coordinate system irrespective of the + attached wl_buffer size. + + + + + + + + + + + + + Set the source rectangle of the associated wl_surface. See + wl_viewport for the description, and relation to the wl_buffer + size. + + If width is -1.0 and height is -1.0, the source rectangle is unset + instead. Any other pair of values for width and height that + contains zero or negative values raises the bad_value protocol + error. + + The crop and scale state is double-buffered state, and will be + applied on the next wl_surface.commit. + + + + + + + + + + + Set the destination size of the associated wl_surface. See + wl_viewport for the description, and relation to the wl_buffer + size. + + If width is -1 and height is -1, the destination size is unset + instead. Any other pair of values for width and height that + contains zero or negative values raises the bad_value protocol + error. + + The crop and scale state is double-buffered state, and will be + applied on the next wl_surface.commit. + + Arguments x and y do not exist here, use the x and y arguments to + wl_surface.attach. The x, y, width, and height define the + surface-local coordinate system irrespective of the attached + wl_buffer size. + + + + + + + From f91e358902d91edc12a541bdcd705e1d97e4c6ca Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Tue, 22 Jan 2019 14:38:44 +0100 Subject: [PATCH 0648/1507] Client: Fix incorrect decoration size when QT_SCALE_FACTOR is set [ChangeLog][QPA plugin] Fixed a bug where window decorations were to small for for the content when QT_SCALE_FACTOR was set. Fixes: QTBUG-72993 Change-Id: I1ed26e038c27f7c4454a6bcc04f0849e4af789e7 Reviewed-by: Paul Olav Tvete --- .../plugins/decorations/bradient/main.cpp | 39 +++++++++++-------- .../wayland/qwaylandabstractdecoration.cpp | 11 +++--- .../platforms/wayland/qwaylandwindow.cpp | 23 +++++++++-- .../platforms/wayland/qwaylandwindow_p.h | 2 + 4 files changed, 49 insertions(+), 26 deletions(-) diff --git a/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp b/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp index 1bf67bbc393..96ad261b2dc 100644 --- a/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp +++ b/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp @@ -109,19 +109,22 @@ QWaylandBradientDecoration::QWaylandBradientDecoration() QRectF QWaylandBradientDecoration::closeButtonRect() const { - return QRectF(window()->frameGeometry().width() - BUTTON_WIDTH - BUTTON_SPACING * 0 - BUTTONS_RIGHT_MARGIN, + const int windowRight = waylandWindow()->windowGeometry().right() + 1; + return QRectF(windowRight - BUTTON_WIDTH - BUTTON_SPACING * 0 - BUTTONS_RIGHT_MARGIN, (margins().top() - BUTTON_WIDTH) / 2, BUTTON_WIDTH, BUTTON_WIDTH); } QRectF QWaylandBradientDecoration::maximizeButtonRect() const { - return QRectF(window()->frameGeometry().width() - BUTTON_WIDTH * 2 - BUTTON_SPACING * 1 - BUTTONS_RIGHT_MARGIN, + const int windowRight = waylandWindow()->windowGeometry().right() + 1; + return QRectF(windowRight - BUTTON_WIDTH * 2 - BUTTON_SPACING * 1 - BUTTONS_RIGHT_MARGIN, (margins().top() - BUTTON_WIDTH) / 2, BUTTON_WIDTH, BUTTON_WIDTH); } QRectF QWaylandBradientDecoration::minimizeButtonRect() const { - return QRectF(window()->frameGeometry().width() - BUTTON_WIDTH * 3 - BUTTON_SPACING * 2 - BUTTONS_RIGHT_MARGIN, + const int windowRight = waylandWindow()->windowGeometry().right() + 1; + return QRectF(windowRight - BUTTON_WIDTH * 3 - BUTTON_SPACING * 2 - BUTTONS_RIGHT_MARGIN, (margins().top() - BUTTON_WIDTH) / 2, BUTTON_WIDTH, BUTTON_WIDTH); } @@ -133,13 +136,13 @@ QMargins QWaylandBradientDecoration::margins() const void QWaylandBradientDecoration::paint(QPaintDevice *device) { bool active = window()->handle()->isActive(); - QRect surfaceRect(QPoint(), window()->frameGeometry().size()); + QRect wg = waylandWindow()->windowGeometry(); QRect clips[] = { - QRect(0, 0, surfaceRect.width(), margins().top()), - QRect(0, surfaceRect.height() - margins().bottom(), surfaceRect.width(), margins().bottom()), - QRect(0, margins().top(), margins().left(), surfaceRect.height() - margins().top() - margins().bottom()), - QRect(surfaceRect.width() - margins().right(), margins().top(), margins().left(), surfaceRect.height() - margins().top() - margins().bottom()) + QRect(wg.left(), wg.top(), wg.width(), margins().top()), + QRect(wg.left(), (wg.bottom() + 1) - margins().bottom(), wg.width(), margins().bottom()), + QRect(wg.left(), margins().top(), margins().left(), wg.height() - margins().top() - margins().bottom()), + QRect((wg.right() + 1) - margins().right(), wg.top() + margins().top(), margins().right(), wg.height() - margins().top() - margins().bottom()) }; QRect top = clips[0]; @@ -149,7 +152,7 @@ void QWaylandBradientDecoration::paint(QPaintDevice *device) // Title bar QPainterPath roundedRect; - roundedRect.addRoundedRect(surfaceRect, 3, 3); + roundedRect.addRoundedRect(wg, 3, 3); for (int i = 0; i < 4; ++i) { p.save(); p.setClipRect(clips[i]); @@ -264,13 +267,14 @@ bool QWaylandBradientDecoration::handleMouse(QWaylandInputDevice *inputDevice, c Q_UNUSED(global); // Figure out what area mouse is in - if (local.y() <= margins().top()) { + QRect wg = waylandWindow()->windowGeometry(); + if (local.y() <= wg.top() + margins().top()) { processMouseTop(inputDevice,local,b,mods); - } else if (local.y() > window()->height() + margins().top()) { + } else if (local.y() > wg.bottom() - margins().bottom()) { processMouseBottom(inputDevice,local,b,mods); - } else if (local.x() <= margins().left()) { + } else if (local.x() <= wg.left() + margins().left()) { processMouseLeft(inputDevice,local,b,mods); - } else if (local.x() > window()->width() + margins().left()) { + } else if (local.x() > wg.right() - margins().right()) { processMouseRight(inputDevice,local,b,mods); } else { #if QT_CONFIG(cursor) @@ -308,15 +312,16 @@ bool QWaylandBradientDecoration::handleTouch(QWaylandInputDevice *inputDevice, c void QWaylandBradientDecoration::processMouseTop(QWaylandInputDevice *inputDevice, const QPointF &local, Qt::MouseButtons b, Qt::KeyboardModifiers mods) { + QRect wg = waylandWindow()->windowGeometry(); Q_UNUSED(mods); - if (local.y() <= margins().bottom()) { + if (local.y() <= wg.top() + margins().bottom()) { if (local.x() <= margins().left()) { //top left bit #if QT_CONFIG(cursor) waylandWindow()->setMouseCursor(inputDevice, Qt::SizeFDiagCursor); #endif startResize(inputDevice, Qt::TopEdge | Qt::LeftEdge, b); - } else if (local.x() > window()->width() + margins().left()) { + } else if (local.x() > wg.right() - margins().right()) { //top right bit #if QT_CONFIG(cursor) waylandWindow()->setMouseCursor(inputDevice, Qt::SizeBDiagCursor); @@ -329,9 +334,9 @@ void QWaylandBradientDecoration::processMouseTop(QWaylandInputDevice *inputDevic #endif startResize(inputDevice, Qt::TopEdge, b); } - } else if (local.x() <= margins().left()) { + } else if (local.x() <= wg.left() + margins().left()) { processMouseLeft(inputDevice, local, b, mods); - } else if (local.x() > window()->width() + margins().left()) { + } else if (local.x() > wg.right() - margins().right()) { processMouseRight(inputDevice, local, b, mods); } else if (isRightClicked(b)) { showWindowMenu(inputDevice); diff --git a/src/plugins/platforms/wayland/qwaylandabstractdecoration.cpp b/src/plugins/platforms/wayland/qwaylandabstractdecoration.cpp index 32fa6e1b575..0f00b9890d5 100644 --- a/src/plugins/platforms/wayland/qwaylandabstractdecoration.cpp +++ b/src/plugins/platforms/wayland/qwaylandabstractdecoration.cpp @@ -115,16 +115,17 @@ const QImage &QWaylandAbstractDecoration::contentImage() { Q_D(QWaylandAbstractDecoration); if (d->m_isDirty) { - //Update the decoration backingstore + // Update the decoration backingstore - const int scale = waylandWindow()->scale(); - const QSize imageSize = window()->frameGeometry().size() * scale; + const int bufferScale = waylandWindow()->scale(); + const QSize imageSize = waylandWindow()->surfaceSize() * bufferScale; d->m_decorationContentImage = QImage(imageSize, QImage::Format_ARGB32_Premultiplied); - d->m_decorationContentImage.setDevicePixelRatio(scale); + // Only scale by buffer scale, not QT_SCALE_FACTOR etc. + d->m_decorationContentImage.setDevicePixelRatio(bufferScale); d->m_decorationContentImage.fill(Qt::transparent); this->paint(&d->m_decorationContentImage); - QRegion damage = marginsRegion(window()->geometry().size(), window()->frameMargins()); + QRegion damage = marginsRegion(waylandWindow()->surfaceSize(), waylandWindow()->frameMargins()); for (QRect r : damage) waylandWindow()->damage(r); diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index e81221fb5dd..9e95b306867 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -341,7 +341,7 @@ void QWaylandWindow::setGeometry(const QRect &rect) sendExposeEvent(exposeGeometry); if (mShellSurface) - mShellSurface->setWindowGeometry(QRect(QPoint(0, 0), window()->frameGeometry().size())); + mShellSurface->setWindowGeometry(windowGeometry()); } void QWaylandWindow::resizeFromApplyConfigure(const QSize &sizeWithMargins, const QPoint &offset) @@ -654,6 +654,23 @@ QMargins QWaylandWindow::frameMargins() const return QPlatformWindow::frameMargins(); } +/*! + * Size, with decorations (including including eventual shadows) in wl_surface coordinates + */ +QSize QWaylandWindow::surfaceSize() const +{ + return geometry().marginsAdded(frameMargins()).size(); +} + +/*! + * Window geometry as defined by the xdg-shell spec (in wl_surface coordinates) + * topLeft is where the shadow stops and the decorations border start. + */ +QRect QWaylandWindow::windowGeometry() const +{ + return QRect(QPoint(), surfaceSize()); +} + QWaylandShellSurface *QWaylandWindow::shellSurface() const { return mShellSurface; @@ -848,9 +865,7 @@ void QWaylandWindow::handleMouse(QWaylandInputDevice *inputDevice, const QWaylan #if QT_CONFIG(cursor) if (e.type == QWaylandPointerEvent::Enter) { - QRect windowGeometry = window()->frameGeometry(); - windowGeometry.moveTopLeft({0, 0}); // convert to wayland surface coordinates - QRect contentGeometry = windowGeometry.marginsRemoved(frameMargins()); + QRect contentGeometry = windowGeometry().marginsRemoved(frameMargins()); if (contentGeometry.contains(e.local.toPoint())) restoreMouseCursor(inputDevice); } diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index 146767a1e76..0e573f350eb 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -125,6 +125,8 @@ public: void waitForFrameSync(); QMargins frameMargins() const override; + QSize surfaceSize() const; + QRect windowGeometry() const; static QWaylandWindow *fromWlSurface(::wl_surface *surface); From d2c9c5537d555d178dcde7183099b57aec643154 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Thu, 13 Dec 2018 09:39:05 +0100 Subject: [PATCH 0649/1507] Client tests: Add simple test for keyboard press Change-Id: Ib28be5277af9145834c7808f993c747e21845616 Reviewed-by: Paul Olav Tvete --- tests/auto/wayland/seatv4/tst_seatv4.cpp | 27 ++++++++- tests/auto/wayland/shared/coreprotocol.cpp | 58 +++++++++++++++++++- tests/auto/wayland/shared/coreprotocol.h | 18 +++++- tests/auto/wayland/shared/mockcompositor.cpp | 2 +- tests/auto/wayland/shared/mockcompositor.h | 1 + 5 files changed, 101 insertions(+), 5 deletions(-) diff --git a/tests/auto/wayland/seatv4/tst_seatv4.cpp b/tests/auto/wayland/seatv4/tst_seatv4.cpp index b6357a25b99..f1e948ee25c 100644 --- a/tests/auto/wayland/seatv4/tst_seatv4.cpp +++ b/tests/auto/wayland/seatv4/tst_seatv4.cpp @@ -46,7 +46,7 @@ public: removeAll(); - uint capabilities = MockCompositor::Seat::capability_pointer; + uint capabilities = Seat::capability_pointer | Seat::capability_keyboard; int version = 4; add(capabilities, version); }); @@ -67,6 +67,8 @@ private slots: void simpleAxis(); void invalidPointerEvents(); void scaledCursor(); + + void keyboardKeyPress(); }; void tst_seatv4::cleanup() @@ -287,5 +289,28 @@ void tst_seatv4::scaledCursor() exec([&] { remove(output(1)); }); } +void tst_seatv4::keyboardKeyPress() +{ + class Window : public QRasterWindow { + public: + void keyPressEvent(QKeyEvent *) override { m_pressed = true; } + bool m_pressed = false; + }; + + Window window; + window.resize(64, 64); + window.show(); + QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial); + + uint keyCode = 80; // arbitrarily chosen + exec([&] { + auto *surface = xdgSurface()->m_surface; + keyboard()->sendEnter(surface); + keyboard()->sendKey(client(), keyCode, Keyboard::key_state_pressed); + keyboard()->sendKey(client(), keyCode, Keyboard::key_state_released); + }); + QTRY_VERIFY(window.m_pressed); +} + QCOMPOSITOR_TEST_MAIN(tst_seatv4) #include "tst_seatv4.moc" diff --git a/tests/auto/wayland/shared/coreprotocol.cpp b/tests/auto/wayland/shared/coreprotocol.cpp index fdd5f627c80..16494d789c6 100644 --- a/tests/auto/wayland/shared/coreprotocol.cpp +++ b/tests/auto/wayland/shared/coreprotocol.cpp @@ -193,8 +193,8 @@ Seat::~Seat() } void Seat::setCapabilities(uint capabilities) { - // TODO: Add support for touch and keyboard - Q_ASSERT(capabilities == 0 || capabilities == capability_pointer); + // TODO: Add support for touch + Q_ASSERT(~capabilities & capability_touch); m_capabilities = capabilities; @@ -206,6 +206,14 @@ void Seat::setCapabilities(uint capabilities) { m_pointer = nullptr; } + if (m_capabilities & capability_keyboard) { + if (!m_keyboard) + m_keyboard = (new Keyboard(this)); + } else if (m_keyboard) { + m_oldKeyboards << m_keyboard; + m_keyboard = nullptr; + } + for (auto *resource : resourceMap()) wl_seat::send_capabilities(resource->handle, capabilities); } @@ -225,6 +233,21 @@ void Seat::seat_get_pointer(Resource *resource, uint32_t id) m_pointer->add(resource->client(), id, resource->version()); } +void Seat::seat_get_keyboard(QtWaylandServer::wl_seat::Resource *resource, uint32_t id) +{ + if (~m_capabilities & capability_pointer) { + qWarning() << "Client requested a wl_keyboard without the capability being available." + << "This Could be a race condition when hotunplugging," + << "but is most likely a client error"; + Keyboard *keyboard = new Keyboard(this); + keyboard->add(resource->client(), id, resource->version()); + // TODO: mark as destroyed + m_oldKeyboards << keyboard; + return; + } + m_keyboard->add(resource->client(), id, resource->version()); +} + Surface *Pointer::cursorSurface() { return m_cursorRole ? m_cursorRole->m_surface : nullptr; @@ -296,6 +319,37 @@ void Pointer::pointer_set_cursor(Resource *resource, uint32_t serial, wl_resourc emit setCursor(serial); } +uint Keyboard::sendEnter(Surface *surface) +{ + auto serial = m_seat->m_compositor->nextSerial(); + wl_client *client = surface->resource()->client(); + const auto pointerResources = resourceMap().values(client); + for (auto *r : pointerResources) + send_enter(r->handle, serial, surface->resource()->handle, QByteArray()); + return serial; +} + +uint Keyboard::sendLeave(Surface *surface) +{ + auto serial = m_seat->m_compositor->nextSerial(); + wl_client *client = surface->resource()->client(); + const auto pointerResources = resourceMap().values(client); + for (auto *r : pointerResources) + send_leave(r->handle, serial, surface->resource()->handle); + return serial; +} + +uint Keyboard::sendKey(wl_client *client, uint key, uint state) +{ + Q_ASSERT(state == key_state_pressed || state == key_state_released); + auto time = m_seat->m_compositor->currentTimeMilliseconds(); + uint serial = m_seat->m_compositor->nextSerial(); + const auto pointerResources = resourceMap().values(client); + for (auto *r : pointerResources) + send_key(r->handle, serial, time, key, state); + return serial; +} + // Shm implementation Shm::Shm(CoreCompositor *compositor, QVector formats, int version) : QtWaylandServer::wl_shm(compositor->m_display, version) diff --git a/tests/auto/wayland/shared/coreprotocol.h b/tests/auto/wayland/shared/coreprotocol.h index 565ae66ae04..da171c20203 100644 --- a/tests/auto/wayland/shared/coreprotocol.h +++ b/tests/auto/wayland/shared/coreprotocol.h @@ -38,6 +38,7 @@ namespace MockCompositor { class WlCompositor; class Output; class Pointer; +class Keyboard; class CursorRole; class ShmPool; class ShmBuffer; @@ -245,6 +246,9 @@ public: Pointer* m_pointer = nullptr; QVector m_oldPointers; + Keyboard* m_keyboard = nullptr; + QVector m_oldKeyboards; + uint m_capabilities = 0; protected: @@ -254,7 +258,7 @@ protected: } void seat_get_pointer(Resource *resource, uint32_t id) override; -// void seat_get_keyboard(Resource *resource, uint32_t id) override; + void seat_get_keyboard(Resource *resource, uint32_t id) override; // void seat_get_touch(Resource *resource, uint32_t id) override; // void seat_release(Resource *resource) override; @@ -294,6 +298,18 @@ public: Surface *m_surface = nullptr; }; +class Keyboard : public QObject, public QtWaylandServer::wl_keyboard +{ + Q_OBJECT +public: + explicit Keyboard(Seat *seat) : m_seat(seat) {} + //TODO: Keymap event + uint sendEnter(Surface *surface); + uint sendLeave(Surface *surface); + uint sendKey(wl_client *client, uint key, uint state); + Seat *m_seat = nullptr; +}; + class Shm : public Global, public QtWaylandServer::wl_shm { Q_OBJECT diff --git a/tests/auto/wayland/shared/mockcompositor.cpp b/tests/auto/wayland/shared/mockcompositor.cpp index bb7cd6f4675..6b9af4295b8 100644 --- a/tests/auto/wayland/shared/mockcompositor.cpp +++ b/tests/auto/wayland/shared/mockcompositor.cpp @@ -41,7 +41,7 @@ DefaultCompositor::DefaultCompositor() add(); auto *output = add(); output->m_data.physicalSize = output->m_data.mode.physicalSizeForDpi(96); - add(Seat::capability_pointer); + add(Seat::capability_pointer | Seat::capability_keyboard); add(); add(); // TODO: other shells, viewporter, xdgoutput etc diff --git a/tests/auto/wayland/shared/mockcompositor.h b/tests/auto/wayland/shared/mockcompositor.h index c7ea4d0091c..a6515c04c84 100644 --- a/tests/auto/wayland/shared/mockcompositor.h +++ b/tests/auto/wayland/shared/mockcompositor.h @@ -53,6 +53,7 @@ public: XdgToplevel *xdgToplevel(int i = 0) { return get()->toplevel(i); } XdgPopup *xdgPopup(int i = 0) { return get()->popup(i); } Pointer *pointer() { auto *seat = get(); Q_ASSERT(seat); return seat->m_pointer; } + Keyboard *keyboard() { auto *seat = get(); Q_ASSERT(seat); return seat->m_keyboard; } uint sendXdgShellPing(); void xdgPingAndWaitForPong(); // Things that can be changed run-time without confusing the client (i.e. don't require separate tests) From 4aa82cf999418ba201376adba30d2b76d081dace Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Thu, 13 Dec 2018 09:58:50 +0100 Subject: [PATCH 0650/1507] Add client test for data device Change-Id: Id89ec40a3f484808385401829a09a43781a1bed7 Reviewed-by: Paul Olav Tvete --- tests/auto/wayland/client.pro | 1 + .../wayland/datadevicev1/datadevicev1.pro | 4 + .../wayland/datadevicev1/tst_datadevicev1.cpp | 111 ++++++++++++++++++ tests/auto/wayland/shared/coreprotocol.cpp | 1 + tests/auto/wayland/shared/coreprotocol.h | 4 + tests/auto/wayland/shared/datadevice.cpp | 70 +++++++++++ tests/auto/wayland/shared/datadevice.h | 85 ++++++++++++++ tests/auto/wayland/shared/mockcompositor.h | 1 + tests/auto/wayland/shared/shared.pri | 2 + 9 files changed, 279 insertions(+) create mode 100644 tests/auto/wayland/datadevicev1/datadevicev1.pro create mode 100644 tests/auto/wayland/datadevicev1/tst_datadevicev1.cpp create mode 100644 tests/auto/wayland/shared/datadevice.cpp create mode 100644 tests/auto/wayland/shared/datadevice.h diff --git a/tests/auto/wayland/client.pro b/tests/auto/wayland/client.pro index a8e81e46351..e99db20ba4f 100644 --- a/tests/auto/wayland/client.pro +++ b/tests/auto/wayland/client.pro @@ -2,6 +2,7 @@ TEMPLATE=subdirs SUBDIRS += \ client \ + datadevicev1 \ fullscreenshellv1 \ iviapplication \ output \ diff --git a/tests/auto/wayland/datadevicev1/datadevicev1.pro b/tests/auto/wayland/datadevicev1/datadevicev1.pro new file mode 100644 index 00000000000..b3c687c4dff --- /dev/null +++ b/tests/auto/wayland/datadevicev1/datadevicev1.pro @@ -0,0 +1,4 @@ +include (../shared/shared.pri) + +TARGET = tst_datadevicev1 +SOURCES += tst_datadevicev1.cpp diff --git a/tests/auto/wayland/datadevicev1/tst_datadevicev1.cpp b/tests/auto/wayland/datadevicev1/tst_datadevicev1.cpp new file mode 100644 index 00000000000..9b42cb2806d --- /dev/null +++ b/tests/auto/wayland/datadevicev1/tst_datadevicev1.cpp @@ -0,0 +1,111 @@ +/**************************************************************************** +** +** Copyright (C) 2018 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "mockcompositor.h" + +#include +#include + +//TODO: move? +#include + +using namespace MockCompositor; + +constexpr int dataDeviceVersion = 1; + +class DataDeviceCompositor : public DefaultCompositor { +public: + explicit DataDeviceCompositor() + { + exec([this] { + m_config.autoConfigure = true; + add(dataDeviceVersion); + }); + } + DataDevice *dataDevice() { return get()->dataDevice(); } +}; + +class tst_datadevicev1 : public QObject, private DataDeviceCompositor +{ + Q_OBJECT +private slots: + void cleanup() { QTRY_VERIFY2(isClean(), qPrintable(dirtyMessage())); } + void initTestCase(); + void pasteAscii(); +}; + +void tst_datadevicev1::initTestCase() +{ + QCOMPOSITOR_TRY_VERIFY(pointer()); + QCOMPOSITOR_TRY_VERIFY(!pointer()->resourceMap().empty()); + QCOMPOSITOR_TRY_COMPARE(pointer()->resourceMap().first()->version(), 4); + + QCOMPOSITOR_TRY_VERIFY(keyboard()); + + QCOMPOSITOR_TRY_VERIFY(dataDevice()); + QCOMPOSITOR_TRY_COMPARE(dataDevice()->resource()->version(), dataDeviceVersion); +} + +void tst_datadevicev1::pasteAscii() +{ + class Window : public QRasterWindow { + public: + void mousePressEvent(QMouseEvent *) override { m_text = QGuiApplication::clipboard()->text(); } + QString m_text; + }; + + Window window; + window.resize(64, 64); + window.show(); + + QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial); + exec([&] { + auto *offer = new DataOffer(client(), dataDeviceVersion); // Cleaned up by destroy_resource + connect(offer, &DataOffer::receive, [](QString mimeType, int fd) { + QFile file; + file.open(fd, QIODevice::WriteOnly, QFile::FileHandleFlag::AutoCloseHandle); + QCOMPARE(mimeType, "text/plain"); + file.write(QByteArray("normal ascii")); + file.close(); + }); + dataDevice()->sendDataOffer(offer); + offer->send_offer("text/plain"); + dataDevice()->sendSelection(offer); + + auto *surface = xdgSurface()->m_surface; + keyboard()->sendEnter(surface); // Need to set keyboard focus according to protocol + + pointer()->sendEnter(surface, {32, 32}); + pointer()->sendButton(client(), BTN_LEFT, 1); + pointer()->sendButton(client(), BTN_LEFT, 0); + }); + QTRY_COMPARE(window.m_text, "normal ascii"); +} + +QCOMPOSITOR_TEST_MAIN(tst_datadevicev1) +#include "tst_datadevicev1.moc" diff --git a/tests/auto/wayland/shared/coreprotocol.cpp b/tests/auto/wayland/shared/coreprotocol.cpp index 16494d789c6..54725e81258 100644 --- a/tests/auto/wayland/shared/coreprotocol.cpp +++ b/tests/auto/wayland/shared/coreprotocol.cpp @@ -27,6 +27,7 @@ ****************************************************************************/ #include "coreprotocol.h" +#include "datadevice.h" namespace MockCompositor { diff --git a/tests/auto/wayland/shared/coreprotocol.h b/tests/auto/wayland/shared/coreprotocol.h index da171c20203..11b35eb4d88 100644 --- a/tests/auto/wayland/shared/coreprotocol.h +++ b/tests/auto/wayland/shared/coreprotocol.h @@ -42,6 +42,7 @@ class Keyboard; class CursorRole; class ShmPool; class ShmBuffer; +class DataDevice; class Buffer : public QObject, public QtWaylandServer::wl_buffer { @@ -249,6 +250,9 @@ public: Keyboard* m_keyboard = nullptr; QVector m_oldKeyboards; + DataDevice *dataDevice() { return m_dataDevice.data(); } + QScopedPointer m_dataDevice; + uint m_capabilities = 0; protected: diff --git a/tests/auto/wayland/shared/datadevice.cpp b/tests/auto/wayland/shared/datadevice.cpp new file mode 100644 index 00000000000..c136c75968f --- /dev/null +++ b/tests/auto/wayland/shared/datadevice.cpp @@ -0,0 +1,70 @@ +/**************************************************************************** +** +** Copyright (C) 2018 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "datadevice.h" + +namespace MockCompositor { + +void DataDeviceManager::data_device_manager_get_data_device(Resource *resource, uint32_t id, wl_resource *seatResource) +{ + auto *seat = fromResource(seatResource); + QVERIFY(seat); + QVERIFY(!seat->m_dataDevice); + seat->m_dataDevice.reset(new DataDevice(resource->client(), id, resource->version())); +} + +DataDevice::~DataDevice() +{ + // If the client hasn't deleted the wayland object, just ignore subsequent events + if (auto *r = resource()->handle) + wl_resource_set_implementation(r, nullptr, nullptr, nullptr); +} + +void DataDevice::sendDataOffer(DataOffer *offer) +{ + wl_data_device::send_data_offer(offer->resource()->handle); +} + +void DataDevice::sendSelection(DataOffer *offer) +{ + wl_data_device::send_selection(offer->resource()->handle); +} + +void DataOffer::data_offer_destroy_resource(Resource *resource) +{ + Q_UNUSED(resource); + delete this; +} + +void DataOffer::data_offer_receive(Resource *resource, const QString &mime_type, int32_t fd) +{ + Q_UNUSED(resource); + emit receive(mime_type, fd); +} + +} // namespace MockCompositor diff --git a/tests/auto/wayland/shared/datadevice.h b/tests/auto/wayland/shared/datadevice.h new file mode 100644 index 00000000000..4613db7761e --- /dev/null +++ b/tests/auto/wayland/shared/datadevice.h @@ -0,0 +1,85 @@ +/**************************************************************************** +** +** Copyright (C) 2018 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef MOCKCOMPOSITOR_DATADEVICE_H +#define MOCKCOMPOSITOR_DATADEVICE_H + +//TODO: need this? +#include "coreprotocol.h" + +namespace MockCompositor { + +class DataOffer; + +class DataDeviceManager : public Global, public QtWaylandServer::wl_data_device_manager +{ + Q_OBJECT +public: + explicit DataDeviceManager(CoreCompositor *compositor, int version = 1) + : QtWaylandServer::wl_data_device_manager(compositor->m_display, version) + {} + QVector m_dataDevices; + +protected: + void data_device_manager_get_data_device(Resource *resource, uint32_t id, ::wl_resource *seatResource) override; +}; + +class DataDevice : public QtWaylandServer::wl_data_device +{ +public: + explicit DataDevice(::wl_client *client, int id, int version) + : QtWaylandServer::wl_data_device(client, id, version) + {} + ~DataDevice() override; + void send_data_offer(::wl_resource *resource) = delete; + void sendDataOffer(DataOffer *offer); + void send_selection(::wl_resource *resource) = delete; + void sendSelection(DataOffer *offer); +}; + +class DataOffer : public QObject, public QtWaylandServer::wl_data_offer +{ + Q_OBJECT +public: + explicit DataOffer(::wl_client *client, int version) + : QtWaylandServer::wl_data_offer (client, 0, version) + {} + +signals: + void receive(QString mimeType, int fd); + +protected: + void data_offer_destroy_resource(Resource *resource) override; + void data_offer_receive(Resource *resource, const QString &mime_type, int32_t fd) override; +// void data_offer_accept(Resource *resource, uint32_t serial, const QString &mime_type) override; +// void data_offer_destroy(Resource *resource) override; +}; + +} // namespace MockCompositor + +#endif // MOCKCOMPOSITOR_DATADEVICE_H diff --git a/tests/auto/wayland/shared/mockcompositor.h b/tests/auto/wayland/shared/mockcompositor.h index a6515c04c84..ddbd7f34264 100644 --- a/tests/auto/wayland/shared/mockcompositor.h +++ b/tests/auto/wayland/shared/mockcompositor.h @@ -31,6 +31,7 @@ #include "corecompositor.h" #include "coreprotocol.h" +#include "datadevice.h" #include "xdgshell.h" #include diff --git a/tests/auto/wayland/shared/shared.pri b/tests/auto/wayland/shared/shared.pri index 3376c73bcc9..303e1304692 100644 --- a/tests/auto/wayland/shared/shared.pri +++ b/tests/auto/wayland/shared/shared.pri @@ -11,11 +11,13 @@ INCLUDEPATH += ../shared HEADERS += \ $$PWD/corecompositor.h \ $$PWD/coreprotocol.h \ + $$PWD/datadevice.h \ $$PWD/mockcompositor.h \ $$PWD/xdgshell.h SOURCES += \ $$PWD/corecompositor.cpp \ $$PWD/coreprotocol.cpp \ + $$PWD/datadevice.cpp \ $$PWD/mockcompositor.cpp \ $$PWD/xdgshell.cpp From 9d84dc61ba64245907ebfcf74857b42a89a5d305 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Thu, 13 Dec 2018 10:01:14 +0100 Subject: [PATCH 0651/1507] Client test: Prefer UTF-8 when ASCII is also available [ChangeLog][QPA plugin] Fixed a bug where pasting from the clipboard would prefer ASCII over UTF-8, causing loss of special characters. The bug was fixed in QtBase, this is just the test. Task-number: QTBUG-54786 Change-Id: Ibe08bf455ad0be8fdd7a3e082dec6131f19c25d6 Reviewed-by: Paul Olav Tvete --- .../wayland/datadevicev1/tst_datadevicev1.cpp | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/tests/auto/wayland/datadevicev1/tst_datadevicev1.cpp b/tests/auto/wayland/datadevicev1/tst_datadevicev1.cpp index 9b42cb2806d..a85b10c7490 100644 --- a/tests/auto/wayland/datadevicev1/tst_datadevicev1.cpp +++ b/tests/auto/wayland/datadevicev1/tst_datadevicev1.cpp @@ -57,6 +57,7 @@ private slots: void cleanup() { QTRY_VERIFY2(isClean(), qPrintable(dirtyMessage())); } void initTestCase(); void pasteAscii(); + void pasteUtf8(); }; void tst_datadevicev1::initTestCase() @@ -107,5 +108,42 @@ void tst_datadevicev1::pasteAscii() QTRY_COMPARE(window.m_text, "normal ascii"); } +void tst_datadevicev1::pasteUtf8() +{ + class Window : public QRasterWindow { + public: + void mousePressEvent(QMouseEvent *) override { m_text = QGuiApplication::clipboard()->text(); } + QString m_text; + }; + + Window window; + window.resize(64, 64); + window.show(); + + QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial); + exec([&] { + auto *offer = new DataOffer(client(), dataDeviceVersion); // Cleaned up by destroy_resource + connect(offer, &DataOffer::receive, [](QString mimeType, int fd) { + QFile file; + file.open(fd, QIODevice::WriteOnly, QFile::FileHandleFlag::AutoCloseHandle); + QCOMPARE(mimeType, "text/plain;charset=utf-8"); + file.write(QByteArray("face with tears of joy: 😂")); + file.close(); + }); + dataDevice()->sendDataOffer(offer); + offer->send_offer("text/plain"); + offer->send_offer("text/plain;charset=utf-8"); + dataDevice()->sendSelection(offer); + + auto *surface = xdgSurface()->m_surface; + keyboard()->sendEnter(surface); // Need to set keyboard focus according to protocol + + pointer()->sendEnter(surface, {32, 32}); + pointer()->sendButton(client(), BTN_LEFT, 1); + pointer()->sendButton(client(), BTN_LEFT, 0); + }); + QTRY_COMPARE(window.m_text, "face with tears of joy: 😂"); +} + QCOMPOSITOR_TEST_MAIN(tst_datadevicev1) #include "tst_datadevicev1.moc" From 49fc676e8b0dbb5d80d065b04eb01e50c39106a3 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Fri, 21 Dec 2018 14:31:58 +0100 Subject: [PATCH 0652/1507] Client xdg-shell: Add test for tooltips on popups This used to cause protocol errors. Task-number: QTBUG-71734 Change-Id: Ic937210fc42c93f1d411fb0fb4f269de01f07b5b Reviewed-by: Paul Olav Tvete --- tests/auto/wayland/shared/coreprotocol.cpp | 14 +++- tests/auto/wayland/shared/coreprotocol.h | 3 + tests/auto/wayland/shared/xdgshell.cpp | 36 ++++++++- tests/auto/wayland/shared/xdgshell.h | 14 +++- tests/auto/wayland/xdgshell/tst_xdgshell.cpp | 80 ++++++++++++++++++++ 5 files changed, 140 insertions(+), 7 deletions(-) diff --git a/tests/auto/wayland/shared/coreprotocol.cpp b/tests/auto/wayland/shared/coreprotocol.cpp index 54725e81258..6f51a9793c9 100644 --- a/tests/auto/wayland/shared/coreprotocol.cpp +++ b/tests/auto/wayland/shared/coreprotocol.cpp @@ -263,10 +263,22 @@ uint Pointer::sendEnter(Surface *surface, const QPointF &position) wl_client *client = surface->resource()->client(); const auto pointerResources = resourceMap().values(client); for (auto *r : pointerResources) - send_enter(r->handle, m_enterSerial, surface->resource()->handle, x ,y); + wl_pointer::send_enter(r->handle, m_enterSerial, surface->resource()->handle, x ,y); return m_enterSerial; } +uint Pointer::sendLeave(Surface *surface) +{ + m_enterSerial = 0; + uint serial = m_seat->m_compositor->nextSerial(); + + wl_client *client = surface->resource()->client(); + const auto pointerResources = resourceMap().values(client); + for (auto *r : pointerResources) + wl_pointer::send_leave(r->handle, serial, surface->resource()->handle); + return serial; +} + // Make sure you call enter, frame etc. first void Pointer::sendMotion(wl_client *client, const QPointF &position) { diff --git a/tests/auto/wayland/shared/coreprotocol.h b/tests/auto/wayland/shared/coreprotocol.h index 11b35eb4d88..249c16f428b 100644 --- a/tests/auto/wayland/shared/coreprotocol.h +++ b/tests/auto/wayland/shared/coreprotocol.h @@ -275,7 +275,10 @@ public: explicit Pointer(Seat *seat) : m_seat(seat) {} Surface *cursorSurface(); CursorRole* m_cursorRole = nullptr; //TODO: cleanup + void send_enter() = delete; uint sendEnter(Surface *surface, const QPointF &position); + void send_leave() = delete; + uint sendLeave(Surface *surface); void sendMotion(wl_client *client, const QPointF &position); uint sendButton(wl_client *client, uint button, uint state); void sendAxis(wl_client *client, axis axis, qreal value); diff --git a/tests/auto/wayland/shared/xdgshell.cpp b/tests/auto/wayland/shared/xdgshell.cpp index 6bc303020f8..9437688adf5 100644 --- a/tests/auto/wayland/shared/xdgshell.cpp +++ b/tests/auto/wayland/shared/xdgshell.cpp @@ -120,11 +120,11 @@ void XdgSurface::xdg_surface_get_toplevel(Resource *resource, uint32_t id) void XdgSurface::xdg_surface_get_popup(Resource *resource, uint32_t id, wl_resource *parent, wl_resource *positioner) { - Q_UNUSED(parent); Q_UNUSED(positioner); QVERIFY(!m_toplevel); QVERIFY(!m_popup); - m_popup = new XdgPopup(this, id, resource->version()); + auto *p = fromResource(parent); + m_popup = new XdgPopup(this, p, id, resource->version()); } void XdgSurface::xdg_surface_destroy_resource(Resource *resource) @@ -135,6 +135,12 @@ void XdgSurface::xdg_surface_destroy_resource(Resource *resource) delete this; } +void XdgSurface::xdg_surface_destroy(QtWaylandServer::xdg_surface::Resource *resource) +{ + QVERIFY(m_popups.empty()); + wl_resource_destroy(resource->handle); +} + void XdgSurface::xdg_surface_set_window_geometry(Resource *resource, int32_t x, int32_t y, int32_t width, int32_t height) { Q_UNUSED(resource); @@ -189,10 +195,14 @@ void XdgToplevel::xdg_toplevel_set_min_size(Resource *resource, int32_t width, i m_pending.minSize = size; } -XdgPopup::XdgPopup(XdgSurface *xdgSurface, int id, int version) +XdgPopup::XdgPopup(XdgSurface *xdgSurface, XdgSurface *parent, int id, int version) : QtWaylandServer::xdg_popup(xdgSurface->resource()->client(), id, version) , m_xdgSurface(xdgSurface) + , m_parentXdgSurface(parent) { + Q_ASSERT(m_xdgSurface); + Q_ASSERT(m_parentXdgSurface); + m_parentXdgSurface->m_popups << this; } void XdgPopup::sendConfigure(const QRect &geometry) @@ -200,14 +210,32 @@ void XdgPopup::sendConfigure(const QRect &geometry) send_configure(geometry.x(), geometry.y(), geometry.width(), geometry.height()); } +uint XdgPopup::sendCompleteConfigure(const QRect &geometry) +{ + sendConfigure(geometry); + return m_xdgSurface->sendConfigure(); +} + void XdgPopup::xdg_popup_grab(QtWaylandServer::xdg_popup::Resource *resource, wl_resource *seat, uint32_t serial) { Q_UNUSED(resource); Q_UNUSED(seat); // TODO: verify correct seat as well - //TODO: verify no other popup has grabbed QVERIFY(!m_grabbed); + QVERIFY(m_parentXdgSurface->isValidPopupGrabParent()); + m_xdgSurface->m_xdgWmBase->m_topmostGrabbingPopup = this; m_grabbed = true; m_grabSerial = serial; } +void XdgPopup::xdg_popup_destroy(Resource *resource) { + Q_UNUSED(resource); + if (m_grabbed) { + auto *base = m_xdgSurface->m_xdgWmBase; + QCOMPARE(base->m_topmostGrabbingPopup, this); + base->m_topmostGrabbingPopup = this->m_parentXdgSurface->m_popup; + } + m_xdgSurface->m_popup = nullptr; + m_parentXdgSurface->m_popups.removeAll(this); +} + } // namespace MockCompositor diff --git a/tests/auto/wayland/shared/xdgshell.h b/tests/auto/wayland/shared/xdgshell.h index 1a01ea1eabc..ca19c293fc3 100644 --- a/tests/auto/wayland/shared/xdgshell.h +++ b/tests/auto/wayland/shared/xdgshell.h @@ -51,6 +51,7 @@ public: QVector m_xdgSurfaces; XdgToplevel *toplevel(int i = 0); XdgPopup *popup(int i = 0); + XdgPopup *m_topmostGrabbingPopup = nullptr; CoreCompositor *m_compositor = nullptr; signals: @@ -75,8 +76,13 @@ public: void send_configure(uint serial) = delete; // Use the one below instead, as it tracks state void sendConfigure(uint serial); uint sendConfigure(); + bool isTopmostGrabbingPopup() const { return m_popup && m_xdgWmBase->m_topmostGrabbingPopup == m_popup; } + bool isValidPopupGrabParent() const { return isTopmostGrabbingPopup() || (m_toplevel && !m_xdgWmBase->m_topmostGrabbingPopup); } + + // Role objects XdgToplevel *m_toplevel = nullptr; XdgPopup *m_popup = nullptr; + XdgWmBase *m_xdgWmBase = nullptr; Surface *m_surface = nullptr; bool m_configureSent = false; @@ -86,6 +92,7 @@ public: struct DoubleBufferedState { QRect windowGeometry = {0, 0, 0, 0}; } m_pending, m_committed; + QVector m_popups; public slots: void verifyConfigured() { QVERIFY(m_configureSent); } @@ -98,7 +105,7 @@ protected: void xdg_surface_get_toplevel(Resource *resource, uint32_t id) override; void xdg_surface_get_popup(Resource *resource, uint32_t id, ::wl_resource *parent, ::wl_resource *positioner) override; void xdg_surface_destroy_resource(Resource *resource) override; - void xdg_surface_destroy(Resource *resource) override { wl_resource_destroy(resource->handle); } + void xdg_surface_destroy(Resource *resource) override; void xdg_surface_set_window_geometry(Resource *resource, int32_t x, int32_t y, int32_t width, int32_t height) override; void xdg_surface_ack_configure(Resource *resource, uint32_t serial) override; }; @@ -126,14 +133,17 @@ protected: class XdgPopup : public QtWaylandServer::xdg_popup { public: - explicit XdgPopup(XdgSurface *xdgSurface, int id, int version = 1); + explicit XdgPopup(XdgSurface *xdgSurface, XdgSurface *parent, int id, int version = 1); void sendConfigure(const QRect &geometry); + uint sendCompleteConfigure(const QRect &geometry); Surface *surface() { return m_xdgSurface->m_surface; } XdgSurface *m_xdgSurface = nullptr; + XdgSurface *m_parentXdgSurface = nullptr; bool m_grabbed = false; uint m_grabSerial = 0; protected: void xdg_popup_grab(Resource *resource, ::wl_resource *seat, uint32_t serial) override; + void xdg_popup_destroy(Resource *resource) override; }; } // namespace MockCompositor diff --git a/tests/auto/wayland/xdgshell/tst_xdgshell.cpp b/tests/auto/wayland/xdgshell/tst_xdgshell.cpp index de034101411..32b62689e60 100644 --- a/tests/auto/wayland/xdgshell/tst_xdgshell.cpp +++ b/tests/auto/wayland/xdgshell/tst_xdgshell.cpp @@ -42,6 +42,7 @@ private slots: void configureSize(); void configureStates(); void popup(); + void tooltipOnPopup(); void pongs(); void minMaxSize(); void windowGeometry(); @@ -252,6 +253,85 @@ void tst_xdgshell::popup() }); } +void tst_xdgshell::tooltipOnPopup() +{ + class Popup : public QRasterWindow { + public: + explicit Popup(QWindow *parent) { + setTransientParent(parent); + setFlags(Qt::Popup); + resize(100, 100); + show(); + } + void mousePressEvent(QMouseEvent *event) override { + QRasterWindow::mousePressEvent(event); + m_tooltip = new QRasterWindow; + m_tooltip->setTransientParent(this); + m_tooltip->setFlags(Qt::ToolTip); + m_tooltip->resize(100, 100); + m_tooltip->show(); + } + QWindow *m_tooltip = nullptr; + }; + + class Window : public QRasterWindow { + public: + void mousePressEvent(QMouseEvent *event) override { + QRasterWindow::mousePressEvent(event); + m_popup = new Popup(this); + } + Popup *m_popup = nullptr; + }; + + Window window; + window.resize(200, 200); + window.show(); + + QCOMPOSITOR_TRY_VERIFY(xdgToplevel()); + exec([=] { xdgToplevel()->sendCompleteConfigure(); }); + QCOMPOSITOR_TRY_VERIFY(xdgToplevel()->m_xdgSurface->m_committedConfigureSerial); + + exec([=] { + auto *surface = xdgToplevel()->surface(); + auto *p = pointer(); + p->sendEnter(surface, {100, 100}); +// p->sendFrame(); //TODO: uncomment when we support seat v5 + p->sendButton(client(), BTN_LEFT, Pointer::button_state_pressed); + p->sendButton(client(), BTN_LEFT, Pointer::button_state_released); +// p->sendFrame(); + p->sendLeave(surface); +// p->sendFrame(); + }); + + QCOMPOSITOR_TRY_VERIFY(xdgPopup()); + exec([=] { xdgPopup()->sendCompleteConfigure(QRect(100, 100, 100, 100)); }); + QCOMPOSITOR_TRY_VERIFY(xdgPopup()->m_xdgSurface->m_committedConfigureSerial); + QCOMPOSITOR_TRY_VERIFY(xdgPopup()->m_grabbed); + + exec([=] { + auto *surface = xdgPopup()->surface(); + auto *p = pointer(); + p->sendEnter(surface, {100, 100}); +// p->sendFrame(); + p->sendButton(client(), BTN_LEFT, Pointer::button_state_pressed); + p->sendButton(client(), BTN_LEFT, Pointer::button_state_released); +// p->sendFrame(); + }); + + QCOMPOSITOR_TRY_VERIFY(xdgPopup(1)); + exec([=] { xdgPopup(1)->sendCompleteConfigure(QRect(100, 100, 100, 100)); }); + QCOMPOSITOR_TRY_VERIFY(xdgPopup(1)->m_xdgSurface->m_committedConfigureSerial); + QCOMPOSITOR_TRY_VERIFY(!xdgPopup(1)->m_grabbed); + + // Close the middle popup (according protocol this should also destroy any nested popups) + window.m_popup->close(); + + // Close order is verified in XdgSurface::xdg_surface_destroy + + QCOMPOSITOR_TRY_COMPARE(xdgPopup(1), nullptr); + QCOMPOSITOR_TRY_COMPARE(xdgPopup(0), nullptr); +} + void tst_xdgshell::pongs() { QSignalSpy pongSpy(exec([=] { return get(); }), &XdgWmBase::pong); From 843c98d2d2488eeafc08412b6cc2992ad8b4e536 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Fri, 8 Feb 2019 13:16:53 +0100 Subject: [PATCH 0653/1507] Fix race condition in autotests The QVector m_surface is modified in both threads. Change-Id: I1818a5e1307d191f1613513b86703eaa7bda3c6e Reviewed-by: Johan Helsing --- .../wayland/shared_old/mockcompositor.cpp | 24 ++++++++++++------- .../auto/wayland/shared_old/mockcompositor.h | 5 +++- 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/tests/auto/wayland/shared_old/mockcompositor.cpp b/tests/auto/wayland/shared_old/mockcompositor.cpp index f6a8757472c..0dfaef5eaa6 100644 --- a/tests/auto/wayland/shared_old/mockcompositor.cpp +++ b/tests/auto/wayland/shared_old/mockcompositor.cpp @@ -220,12 +220,14 @@ QSharedPointer MockCompositor::surface() { QSharedPointer result; lock(); - QVector surfaces = m_compositor->surfaces(); - foreach (Impl::Surface *surface, surfaces) { - // we don't want to mistake the cursor surface for a window surface - if (surface->isMapped()) { - result = surface->mockSurface(); - break; + { + QVector surfaces = m_compositor->surfaces(); + foreach (Impl::Surface *surface, surfaces) { + // we don't want to mistake the cursor surface for a window surface + if (surface->isMapped()) { + result = surface->mockSurface(); + break; + } } } unlock(); @@ -307,7 +309,7 @@ void *MockCompositor::run(void *data) { MockCompositor *controller = static_cast(data); - Impl::Compositor compositor; + Impl::Compositor compositor(controller); controller->m_compositor = &compositor; controller->m_waitCondition.wakeOne(); @@ -332,8 +334,8 @@ void *MockCompositor::run(void *data) namespace Impl { -Compositor::Compositor() - : m_display(wl_display_create()) +Compositor::Compositor(MockCompositor *mockCompositor) + : m_mockCompositor(mockCompositor), m_display(wl_display_create()) { if (wl_display_add_socket(m_display, 0)) { fprintf(stderr, "Fatal: Failed to open server socket\n"); @@ -445,15 +447,19 @@ uint32_t Compositor::nextSerial() void Compositor::addSurface(Surface *surface) { + m_mockCompositor->lock(); m_surfaces << surface; + m_mockCompositor->unlock(); } void Compositor::removeSurface(Surface *surface) { + m_mockCompositor->lock(); m_surfaces.removeOne(surface); m_keyboard->handleSurfaceDestroyed(surface); m_pointer->handleSurfaceDestroyed(surface); m_fullScreenShellV1->removeSurface(surface); + m_mockCompositor->unlock(); } Surface *Compositor::resolveSurface(const QVariant &v) diff --git a/tests/auto/wayland/shared_old/mockcompositor.h b/tests/auto/wayland/shared_old/mockcompositor.h index 404a18e7550..2433ac005da 100644 --- a/tests/auto/wayland/shared_old/mockcompositor.h +++ b/tests/auto/wayland/shared_old/mockcompositor.h @@ -45,6 +45,8 @@ #include #include +class MockCompositor; + namespace Impl { typedef void (**Implementation)(void); @@ -63,7 +65,7 @@ class XdgShellV6; class Compositor { public: - Compositor(); + Compositor(MockCompositor *mockCompositor); ~Compositor(); int fileDescriptor() const { return m_fd; } @@ -114,6 +116,7 @@ private: void initShm(); + MockCompositor *m_mockCompositor = nullptr; QRect m_outputGeometry; wl_display *m_display = nullptr; From e1eec6874231c4405dcd786d56318d9df2780ed3 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Mon, 4 Feb 2019 16:34:52 +0100 Subject: [PATCH 0654/1507] Client xdg-shell: Fix crash when switching popups The call to flushWindowSystemEvents() sometimes caused new popups to be shown in the middle of hiding another. I.e. if multiple events show and hide surfaces, they would be shown/hidden in opposite order of their corresponding events. QMenus sometimes suffered from this (can be seen with the qopenglwidget example from qtbase). When the flush was added 5 years ago in 70c578cb5, it was to "reduce the chances of seeing a bad frame". I don't see any rendering artifacts, though, and I can't find any bug report on it. So let's hope it's safe to remove the hack. [ChangeLog][QPA plugin] Fixed a crash that sometimes happened when switching popups. Also adds more info to the workaround warning message that appears when a popup grab is attempted and there already is another grabbing popup that is not the parent. Fixes: QTBUG-73524 Change-Id: Ibfcbb48c4bbe295c2be1a30add2d7e05cad398c5 Reviewed-by: Paul Olav Tvete --- .../shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp | 9 ++++++++- .../shellintegration/xdg-shell/qwaylandxdgshell.cpp | 9 ++++++++- src/plugins/platforms/wayland/qwaylandwindow.cpp | 9 ++------- 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp index 9e55e3e1680..2f729d9717b 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp @@ -335,7 +335,14 @@ void QWaylandXdgSurfaceV6::setGrabPopup(QWaylandWindow *parent, QWaylandInputDev auto *top = m_shell->m_topmostGrabbingPopup; if (top && top->m_xdgSurface != parentXdgSurface) { - qCWarning(lcQpaWayland) << "setGrabPopup called for a surface that was not the topmost popup, positions might be off."; + qCWarning(lcQpaWayland) << "setGrabPopup called with a parent," << parentXdgSurface + << "which does not match the current topmost grabbing popup," + << top->m_xdgSurface << "According to the xdg-shell-v6 protocol, this" + << "is not allowed. The wayland QPA plugin is currently handling" + << "it by setting the parent to the topmost grabbing popup." + << "Note, however, that this may cause positioning errors and" + << "popups closing unxpectedly because xdg-shell-v6 mandate that child" + << "popups close before parents"; parent = top->m_xdgSurface->m_window; } setPopup(parent); diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp index 1310e340da2..d2452aa483d 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp @@ -369,7 +369,14 @@ void QWaylandXdgSurface::setGrabPopup(QWaylandWindow *parent, QWaylandInputDevic auto *top = m_shell->m_topmostGrabbingPopup; if (top && top->m_xdgSurface != parentXdgSurface) { - qCWarning(lcQpaWayland) << "setGrabPopup called for a surface that was not the topmost popup, positions might be off."; + qCWarning(lcQpaWayland) << "setGrabPopup called with a parent," << parentXdgSurface + << "which does not match the current topmost grabbing popup," + << top->m_xdgSurface << "According to the xdg-shell protocol, this" + << "is not allowed. The wayland QPA plugin is currently handling" + << "it by setting the parent to the topmost grabbing popup." + << "Note, however, that this may cause positioning errors and" + << "popups closing unxpectedly because xdg-shell mandate that child" + << "popups close before parents"; parent = top->m_xdgSurface->m_window; } setPopup(parent); diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 282179efb53..c46c49813fb 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -395,14 +395,9 @@ void QWaylandWindow::setVisible(bool visible) // QWaylandShmBackingStore::beginPaint(). } else { sendExposeEvent(QRect()); - // when flushing the event queue, it could contain a close event, in which - // case 'this' will be deleted. When that happens, we must abort right away. - QPointer deleteGuard(this); - QWindowSystemInterface::flushWindowSystemEvents(); - if (!deleteGuard.isNull() && window()->type() == Qt::Popup) + if (window()->type() == Qt::Popup) closePopups(this); - if (!deleteGuard.isNull()) - reset(); + reset(); } } From a5bcdd0f8679504aa434bf3260e40c11e7b7c5aa Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Thu, 6 Dec 2018 12:00:55 +0100 Subject: [PATCH 0655/1507] Client: Refactor cursors and fix various bugs This patch is mostly a cleanup to prepare for implementations of xcursor-configuration, but also fixes a couple of issues. Most of the logic has now been moved out of QWaylandDisplay and QWaylandCursor and into QWaylandInputDevice and QWaylandInputDevice::Pointer. QWaylandDisplay now only contains mechanisms for avoiding loading the same theme multiple times. There is now only one setCursor method on QWaylandInputDevice, accepting a QCursor and storing its values so changing scale factor doesn't require calling setCursor again. QWaylandInputDevice::Pointer::updateCursor() is called instead. Cursor buffer scale is now set according to enter/leave events of the cursor surface itself instead of the current window, this fixes incorrect buffer scales for cursors on windows that span multiple outputs. The window buffer scale can still be passed into the seat as a fallback until the first enter event is received. This also fixes a bug where the QWaylandBuffer of a bitmap cursor could be deleted while it was being used as a cursor. [ChangeLog][QPA plugin] Fixed a bug where the DPI of bitmap cursors were not sent to the compositor, leading to the compositor incorrectly scaling the cursor up or down. [ChangeLog][QPA plugin] Fixed a bug where bitmap cursor hotspots were off when the screen scale factor was different from the bitmap cursor device pixel ratio. Task-number: QTBUG-68571 Change-Id: I747a47ffff01b7b5f6a0ede3552ab37884c4fa60 Reviewed-by: Paul Olav Tvete --- .../platforms/wayland/qwaylandcursor.cpp | 65 ++--- .../platforms/wayland/qwaylandcursor_p.h | 6 +- .../platforms/wayland/qwaylanddisplay.cpp | 40 +-- .../platforms/wayland/qwaylanddisplay_p.h | 9 +- .../platforms/wayland/qwaylandinputdevice.cpp | 257 ++++++++++++------ .../platforms/wayland/qwaylandinputdevice_p.h | 45 ++- .../platforms/wayland/qwaylandscreen.cpp | 11 +- .../platforms/wayland/qwaylandscreen_p.h | 1 - .../platforms/wayland/qwaylandwindow.cpp | 3 +- tests/auto/wayland/seatv4/seatv4.pro | 5 + tests/auto/wayland/seatv4/tst_seatv4.cpp | 190 +++++++++++-- tests/auto/wayland/shared/coreprotocol.cpp | 20 +- tests/auto/wayland/shared/coreprotocol.h | 3 +- 13 files changed, 437 insertions(+), 218 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandcursor.cpp b/src/plugins/platforms/wayland/qwaylandcursor.cpp index 6947e97f1d7..8b2ed036def 100644 --- a/src/plugins/platforms/wayland/qwaylandcursor.cpp +++ b/src/plugins/platforms/wayland/qwaylandcursor.cpp @@ -41,7 +41,6 @@ #include "qwaylanddisplay_p.h" #include "qwaylandinputdevice_p.h" -#include "qwaylandscreen_p.h" #include "qwaylandshmbackingstore_p.h" #include @@ -53,12 +52,6 @@ QT_BEGIN_NAMESPACE namespace QtWaylandClient { -QWaylandCursorTheme *QWaylandCursorTheme::create(QWaylandShm *shm, int size) -{ - static QString themeName = qEnvironmentVariable("XCURSOR_THEME", QStringLiteral("default")); - return create(shm, size, themeName); -} - QWaylandCursorTheme *QWaylandCursorTheme::create(QWaylandShm *shm, int size, const QString &themeName) { QByteArray nameBytes = themeName.toLocal8Bit(); @@ -244,56 +237,32 @@ struct wl_cursor_image *QWaylandCursorTheme::cursorImage(Qt::CursorShape shape) return image; } -QWaylandCursor::QWaylandCursor(QWaylandScreen *screen) - : mDisplay(screen->display()) - , mCursorTheme(mDisplay->loadCursorTheme(screen->devicePixelRatio())) +QWaylandCursor::QWaylandCursor(QWaylandDisplay *display) + : mDisplay(display) { } -QSharedPointer QWaylandCursor::cursorBitmapImage(const QCursor *cursor) +QSharedPointer QWaylandCursor::cursorBitmapBuffer(QWaylandDisplay *display, const QCursor *cursor) { - if (cursor->shape() != Qt::BitmapCursor) - return QSharedPointer(); - + Q_ASSERT(cursor->shape() == Qt::BitmapCursor); const QImage &img = cursor->pixmap().toImage(); - QSharedPointer buffer(new QWaylandShmBuffer(mDisplay, img.size(), img.format())); - memcpy(buffer->image()->bits(), img.bits(), img.sizeInBytes()); - return buffer; -} - -struct wl_cursor_image *QWaylandCursor::cursorImage(Qt::CursorShape shape) -{ - if (!mCursorTheme) - return nullptr; - return mCursorTheme->cursorImage(shape); + QSharedPointer buffer(new QWaylandShmBuffer(display, img.size(), img.format())); + memcpy(buffer->image()->bits(), img.bits(), size_t(img.sizeInBytes())); + return std::move(buffer); } void QWaylandCursor::changeCursor(QCursor *cursor, QWindow *window) { - const Qt::CursorShape newShape = cursor ? cursor->shape() : Qt::ArrowCursor; + Q_UNUSED(window); + // Create the buffer here so we don't have to create one per input device + QSharedPointer bitmapBuffer; + if (cursor && cursor->shape() == Qt::BitmapCursor) + bitmapBuffer = cursorBitmapBuffer(mDisplay, cursor); - if (newShape == Qt::BlankCursor) { - mDisplay->setCursor(nullptr, nullptr, 1); - return; - } - - if (newShape == Qt::BitmapCursor) { - mDisplay->setCursor(cursorBitmapImage(cursor), cursor->hotSpot(), window->screen()->devicePixelRatio()); - return; - } - - if (!mCursorTheme) { - qCWarning(lcQpaWayland) << "Can't set cursor from shape with no cursor theme"; - return; - } - - if (struct ::wl_cursor_image *image = mCursorTheme->cursorImage(newShape)) { - struct wl_buffer *buffer = wl_cursor_image_get_buffer(image); - mDisplay->setCursor(buffer, image, window->screen()->devicePixelRatio()); - return; - } - - qCWarning(lcQpaWayland) << "Unable to change to cursor" << cursor; + int fallbackOutputScale = int(window->devicePixelRatio()); + const auto seats = mDisplay->inputDevices(); + for (auto *seat : seats) + seat->setCursor(cursor, bitmapBuffer, fallbackOutputScale); } void QWaylandCursor::pointerEvent(const QMouseEvent &event) @@ -312,6 +281,6 @@ void QWaylandCursor::setPos(const QPoint &pos) qCWarning(lcQpaWayland) << "Setting cursor position is not possible on wayland"; } -} +} // namespace QtWaylandClient QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandcursor_p.h b/src/plugins/platforms/wayland/qwaylandcursor_p.h index 71f9cd1b8b7..6c48fb628b8 100644 --- a/src/plugins/platforms/wayland/qwaylandcursor_p.h +++ b/src/plugins/platforms/wayland/qwaylandcursor_p.h @@ -73,7 +73,6 @@ class QWaylandShm; class Q_WAYLAND_CLIENT_EXPORT QWaylandCursorTheme { public: - static QWaylandCursorTheme *create(QWaylandShm *shm, int size); static QWaylandCursorTheme *create(QWaylandShm *shm, int size, const QString &themeName); ~QWaylandCursorTheme(); struct wl_cursor_image *cursorImage(Qt::CursorShape shape); @@ -122,19 +121,18 @@ private: class Q_WAYLAND_CLIENT_EXPORT QWaylandCursor : public QPlatformCursor { public: - QWaylandCursor(QWaylandScreen *screen); + explicit QWaylandCursor(QWaylandDisplay *display); void changeCursor(QCursor *cursor, QWindow *window) override; void pointerEvent(const QMouseEvent &event) override; QPoint pos() const override; void setPos(const QPoint &pos) override; - QSharedPointer cursorBitmapImage(const QCursor *cursor); + static QSharedPointer cursorBitmapBuffer(QWaylandDisplay *display, const QCursor *cursor); struct wl_cursor_image *cursorImage(Qt::CursorShape shape); private: QWaylandDisplay *mDisplay = nullptr; - QWaylandCursorTheme *mCursorTheme = nullptr; QPoint mLastPos; }; diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index fc4241f82da..3675806b2d8 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -160,7 +160,7 @@ QWaylandDisplay::~QWaylandDisplay(void) delete mDndSelectionHandler.take(); #endif #if QT_CONFIG(cursor) - qDeleteAll(mCursorThemesBySize); + qDeleteAll(mCursorThemes); #endif if (mDisplay) wl_display_disconnect(mDisplay); @@ -505,40 +505,20 @@ QWaylandInputDevice *QWaylandDisplay::defaultInputDevice() const #if QT_CONFIG(cursor) -void QWaylandDisplay::setCursor(struct wl_buffer *buffer, struct wl_cursor_image *image, qreal dpr) +QWaylandCursor *QWaylandDisplay::waylandCursor() { - /* Qt doesn't tell us which input device we should set the cursor - * for, so set it for all devices. */ - for (int i = 0; i < mInputDevices.count(); i++) { - QWaylandInputDevice *inputDevice = mInputDevices.at(i); - inputDevice->setCursor(buffer, image, dpr); - } + if (!mCursor) + mCursor.reset(new QWaylandCursor(this)); + return mCursor.data(); } -void QWaylandDisplay::setCursor(const QSharedPointer &buffer, const QPoint &hotSpot, qreal dpr) +QWaylandCursorTheme *QWaylandDisplay::loadCursorTheme(const QString &name, int pixelSize) { - /* Qt doesn't tell us which input device we should set the cursor - * for, so set it for all devices. */ - for (int i = 0; i < mInputDevices.count(); i++) { - QWaylandInputDevice *inputDevice = mInputDevices.at(i); - inputDevice->setCursor(buffer, hotSpot, dpr); - } -} - -QWaylandCursorTheme *QWaylandDisplay::loadCursorTheme(qreal devicePixelRatio) -{ - constexpr int defaultCursorSize = 32; - static const int xCursorSize = qEnvironmentVariableIntValue("XCURSOR_SIZE"); - int cursorSize = xCursorSize > 0 ? xCursorSize : defaultCursorSize; - - if (compositorVersion() >= 3) // set_buffer_scale is not supported on earlier versions - cursorSize *= devicePixelRatio; - - if (auto *theme = mCursorThemesBySize.value(cursorSize, nullptr)) + if (auto *theme = mCursorThemes.value({name, pixelSize}, nullptr)) return theme; - if (auto *theme = QWaylandCursorTheme::create(shm(), cursorSize)) { - mCursorThemesBySize[cursorSize] = theme; + if (auto *theme = QWaylandCursorTheme::create(shm(), pixelSize, name)) { + mCursorThemes[{name, pixelSize}] = theme; return theme; } @@ -547,6 +527,6 @@ QWaylandCursorTheme *QWaylandDisplay::loadCursorTheme(qreal devicePixelRatio) #endif // QT_CONFIG(cursor) -} +} // namespace QtWaylandClient QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylanddisplay_p.h b/src/plugins/platforms/wayland/qwaylanddisplay_p.h index 41ad7025fb1..4a98b935bb6 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay_p.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay_p.h @@ -93,6 +93,7 @@ class QWaylandWindow; class QWaylandIntegration; class QWaylandHardwareIntegration; class QWaylandShellSurface; +class QWaylandCursor; class QWaylandCursorTheme; typedef void (*RegistryListener)(void *data, @@ -121,9 +122,8 @@ public: QWaylandWindowManagerIntegration *windowManagerIntegration() const; #if QT_CONFIG(cursor) - void setCursor(struct wl_buffer *buffer, struct wl_cursor_image *image, qreal dpr); - void setCursor(const QSharedPointer &buffer, const QPoint &hotSpot, qreal dpr); - QWaylandCursorTheme *loadCursorTheme(qreal devicePixelRatio); + QWaylandCursor *waylandCursor(); + QWaylandCursorTheme *loadCursorTheme(const QString &name, int pixelSize); #endif struct wl_display *wl_display() const { return mDisplay; } struct ::wl_registry *wl_registry() { return object(); } @@ -210,7 +210,8 @@ private: QList mRegistryListeners; QWaylandIntegration *mWaylandIntegration = nullptr; #if QT_CONFIG(cursor) - QMap mCursorThemesBySize; + QMap, QWaylandCursorTheme *> mCursorThemes; // theme name and size + QScopedPointer mCursor; #endif #if QT_CONFIG(wayland_datadevice) QScopedPointer mDndSelectionHandler; diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index 31495a45324..cb26def687a 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -173,8 +173,8 @@ void QWaylandInputDevice::Keyboard::stopRepeat() mRepeatTimer.stop(); } -QWaylandInputDevice::Pointer::Pointer(QWaylandInputDevice *p) - : mParent(p) +QWaylandInputDevice::Pointer::Pointer(QWaylandInputDevice *seat) + : mParent(seat) { } @@ -186,6 +186,153 @@ QWaylandInputDevice::Pointer::~Pointer() wl_pointer_destroy(object()); } +#if QT_CONFIG(cursor) + +class CursorSurface : public QtWayland::wl_surface { +public: + explicit CursorSurface(QWaylandInputDevice::Pointer *pointer, QWaylandDisplay *display) + : m_pointer(pointer) + { + init(display->createSurface(this)); + //TODO: When we upgrade to libwayland 1.10, use wl_surface_get_version instead. + m_version = display->compositorVersion(); + } + + void hide() + { + m_pointer->set_cursor(m_pointer->mEnterSerial, nullptr, 0, 0); + m_setSerial = 0; + } + + // Size and hotspot are in surface coordinates + void update(wl_buffer *buffer, const QPoint &hotspot, const QSize &size, int bufferScale) + { + // Calling code needs to ensure buffer scale is supported if != 1 + Q_ASSERT(bufferScale == 1 || m_version >= 3); + + auto enterSerial = m_pointer->mEnterSerial; + if (m_setSerial < enterSerial || m_hotspot != hotspot) { + m_pointer->set_cursor(m_pointer->mEnterSerial, object(), hotspot.x(), hotspot.y()); + m_setSerial = enterSerial; + m_hotspot = hotspot; + } + + if (m_version >= 3) + set_buffer_scale(bufferScale); + + attach(buffer, 0, 0); + damage(0, 0, size.width(), size.height()); + commit(); + } + + int outputScale() const { return m_outputScale; } + +protected: + void surface_enter(struct ::wl_output *output) override + { + //TODO: Can be improved to keep track of all entered screens + int scale = QWaylandScreen::fromWlOutput(output)->scale(); + if (scale == m_outputScale) + return; + + m_outputScale = scale; + m_pointer->updateCursor(); + } + +private: + QWaylandInputDevice::Pointer *m_pointer = nullptr; + uint m_version = 0; + uint m_setSerial = 0; + QPoint m_hotspot; + int m_outputScale = 0; +}; + +QString QWaylandInputDevice::Pointer::cursorThemeName() const +{ + static QString themeName = qEnvironmentVariable("XCURSOR_THEME", QStringLiteral("default")); + return themeName; +} + +int QWaylandInputDevice::Pointer::cursorSize() const +{ + constexpr int defaultCursorSize = 32; + static const int xCursorSize = qEnvironmentVariableIntValue("XCURSOR_SIZE"); + return xCursorSize > 0 ? xCursorSize : defaultCursorSize; +} + +int QWaylandInputDevice::Pointer::idealCursorScale() const +{ + // set_buffer_scale is not supported on earlier versions + if (seat()->mQDisplay->compositorVersion() < 3) + return 1; + + if (auto *s = mCursor.surface.data()) { + if (s->outputScale() > 0) + return s->outputScale(); + } + + return seat()->mCursor.fallbackOutputScale; +} + +void QWaylandInputDevice::Pointer::updateCursorTheme() +{ + int scale = idealCursorScale(); + int pixelSize = cursorSize() * scale; + auto *display = seat()->mQDisplay; + mCursor.theme = display->loadCursorTheme(cursorThemeName(), pixelSize); + mCursor.themeBufferScale = scale; +} + +void QWaylandInputDevice::Pointer::updateCursor() +{ + if (mEnterSerial == 0) + return; + + auto shape = seat()->mCursor.shape; + + if (shape == Qt::BlankCursor) { + if (mCursor.surface) + mCursor.surface->hide(); + return; + } + + if (shape == Qt::BitmapCursor) { + auto buffer = seat()->mCursor.bitmapBuffer; + if (!buffer) { + qCWarning(lcQpaWayland) << "No buffer for bitmap cursor, can't set cursor"; + return; + } + auto hotspot = seat()->mCursor.hotspot; + int bufferScale = seat()->mCursor.bitmapScale; + getOrCreateCursorSurface()->update(buffer->buffer(), hotspot, buffer->size(), bufferScale); + return; + } + + if (!mCursor.theme || idealCursorScale() != mCursor.themeBufferScale) + updateCursorTheme(); + + // Set from shape using theme + if (struct ::wl_cursor_image *image = mCursor.theme->cursorImage(shape)) { + struct wl_buffer *buffer = wl_cursor_image_get_buffer(image); + int bufferScale = mCursor.themeBufferScale; + QPoint hotspot = QPoint(image->hotspot_x, image->hotspot_y) / bufferScale; + QSize size = QSize(image->width, image->height) / bufferScale; + getOrCreateCursorSurface()->update(buffer, hotspot, size, bufferScale); + return; + } + + qCWarning(lcQpaWayland) << "Unable to change to cursor" << shape; +} + +CursorSurface *QWaylandInputDevice::Pointer::getOrCreateCursorSurface() +{ + if (!mCursor.surface) + mCursor.surface.reset(new CursorSurface(this, seat()->mQDisplay)); + return mCursor.surface.get(); +} + +#endif // QT_CONFIG(cursor) + QWaylandInputDevice::Touch::Touch(QWaylandInputDevice *p) : mParent(p) { @@ -359,87 +506,33 @@ Qt::KeyboardModifiers QWaylandInputDevice::Keyboard::modifiers() const } #if QT_CONFIG(cursor) -uint32_t QWaylandInputDevice::cursorSerial() const +void QWaylandInputDevice::setCursor(const QCursor *cursor, const QSharedPointer &cachedBuffer, int fallbackOutputScale) { + CursorState oldCursor = mCursor; + mCursor = CursorState(); // Clear any previous state + mCursor.shape = cursor ? cursor->shape() : Qt::ArrowCursor; + mCursor.hotspot = cursor ? cursor->hotSpot() : QPoint(); + mCursor.fallbackOutputScale = fallbackOutputScale; + + if (mCursor.shape == Qt::BitmapCursor) { + mCursor.bitmapBuffer = cachedBuffer ? cachedBuffer : QWaylandCursor::cursorBitmapBuffer(mQDisplay, cursor); + qreal dpr = cursor->pixmap().devicePixelRatio(); + mCursor.bitmapScale = int(dpr); // Wayland doesn't support fractional buffer scale + // If there was a fractional part of the dpr, we need to scale the hotspot accordingly + if (mCursor.bitmapScale < dpr) + mCursor.hotspot *= dpr / mCursor.bitmapScale; + } + + // Return early if setCursor was called redundantly (mostly happens from decorations) + if (mCursor.shape != Qt::BitmapCursor + && mCursor.shape == oldCursor.shape + && mCursor.hotspot == oldCursor.hotspot + && mCursor.fallbackOutputScale == oldCursor.fallbackOutputScale) { + return; + } + if (mPointer) - return mPointer->mCursorSerial; - return 0; -} - -void QWaylandInputDevice::setCursor(Qt::CursorShape newShape, QWaylandScreen *screen) -{ - struct wl_cursor_image *image = screen->waylandCursor()->cursorImage(newShape); - if (!image) { - return; - } - - struct wl_buffer *buffer = wl_cursor_image_get_buffer(image); - setCursor(buffer, image, screen->devicePixelRatio()); -} - -void QWaylandInputDevice::setCursor(const QCursor &cursor, QWaylandScreen *screen) -{ - if (mPointer->mCursorSerial >= mPointer->mEnterSerial && (cursor.shape() != Qt::BitmapCursor && cursor.shape() == mPointer->mCursorShape)) - return; - - mPointer->mCursorShape = cursor.shape(); - if (cursor.shape() == Qt::BitmapCursor) { - setCursor(screen->waylandCursor()->cursorBitmapImage(&cursor), cursor.hotSpot(), screen->devicePixelRatio()); - return; - } - setCursor(cursor.shape(), screen); -} - -void QWaylandInputDevice::setCursor(struct wl_buffer *buffer, struct wl_cursor_image *image, int bufferScale) -{ - if (image) { - // Convert from pixel coordinates to surface coordinates - QPoint hotspot = QPoint(image->hotspot_x, image->hotspot_y) / bufferScale; - QSize size = QSize(image->width, image->height) / bufferScale; - setCursor(buffer, hotspot, size, bufferScale); - } else { - setCursor(buffer, QPoint(), QSize(), bufferScale); - } -} - -// size and hotspot are in surface coordinates -void QWaylandInputDevice::setCursor(struct wl_buffer *buffer, const QPoint &hotSpot, const QSize &size, int bufferScale) -{ - if (mCaps & WL_SEAT_CAPABILITY_POINTER) { - bool force = mPointer->mEnterSerial > mPointer->mCursorSerial; - - if (!force && mPointer->mCursorBuffer == buffer) - return; - - mPixmapCursor.clear(); - mPointer->mCursorSerial = mPointer->mEnterSerial; - - mPointer->mCursorBuffer = buffer; - - /* Hide cursor */ - if (!buffer) - { - mPointer->set_cursor(mPointer->mEnterSerial, nullptr, 0, 0); - return; - } - - if (!pointerSurface) - pointerSurface = mQDisplay->createSurface(this); - - mPointer->set_cursor(mPointer->mEnterSerial, pointerSurface, - hotSpot.x(), hotSpot.y()); - wl_surface_attach(pointerSurface, buffer, 0, 0); - if (mQDisplay->compositorVersion() >= 3) - wl_surface_set_buffer_scale(pointerSurface, bufferScale); - wl_surface_damage(pointerSurface, 0, 0, size.width(), size.height()); - wl_surface_commit(pointerSurface); - } -} - -void QWaylandInputDevice::setCursor(const QSharedPointer &buffer, const QPoint &hotSpot, int bufferScale) -{ - setCursor(buffer->buffer(), hotSpot, buffer->size(), bufferScale); - mPixmapCursor = buffer; + mPointer->updateCursor(); } #endif @@ -467,7 +560,7 @@ void QWaylandInputDevice::Pointer::pointer_enter(uint32_t serial, struct wl_surf #if QT_CONFIG(cursor) // Depends on mEnterSerial being updated - window->window()->setCursor(window->window()->cursor()); + updateCursor(); #endif QWaylandWindow *grab = QWaylandWindow::mouseGrab(); diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h index c2fd57bb0df..e57d7f4fd53 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h +++ b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h @@ -88,6 +88,10 @@ class QWaylandWindow; class QWaylandDisplay; class QWaylandDataDevice; class QWaylandTextInput; +#if QT_CONFIG(cursor) +class QWaylandCursorTheme; +class CursorSurface; +#endif class Q_WAYLAND_CLIENT_EXPORT QWaylandInputDevice : public QObject @@ -107,10 +111,7 @@ public: struct ::wl_seat *wl_seat() { return QtWayland::wl_seat::object(); } #if QT_CONFIG(cursor) - void setCursor(const QCursor &cursor, QWaylandScreen *screen); - void setCursor(struct wl_buffer *buffer, struct ::wl_cursor_image *image, int bufferScale); - void setCursor(struct wl_buffer *buffer, const QPoint &hotSpot, const QSize &size, int bufferScale); - void setCursor(const QSharedPointer &buffer, const QPoint &hotSpot, int bufferScale); + void setCursor(const QCursor *cursor, const QSharedPointer &cachedBuffer = {}, int fallbackOutputScale = 1); #endif void handleWindowDestroyed(QWaylandWindow *window); void handleEndDrag(); @@ -134,22 +135,27 @@ public: Qt::KeyboardModifiers modifiers() const; uint32_t serial() const; - uint32_t cursorSerial() const; virtual Keyboard *createKeyboard(QWaylandInputDevice *device); virtual Pointer *createPointer(QWaylandInputDevice *device); virtual Touch *createTouch(QWaylandInputDevice *device); private: - void setCursor(Qt::CursorShape cursor, QWaylandScreen *screen); - QWaylandDisplay *mQDisplay = nullptr; struct wl_display *mDisplay = nullptr; int mVersion; uint32_t mCaps = 0; - struct wl_surface *pointerSurface = nullptr; +#if QT_CONFIG(cursor) + struct CursorState { + QSharedPointer bitmapBuffer; // not used with shape cursors + int bitmapScale = 1; + Qt::CursorShape shape = Qt::ArrowCursor; + int fallbackOutputScale = 1; + QPoint hotspot; + } mCursor; +#endif #if QT_CONFIG(wayland_datadevice) QWaylandDataDevice *mDataDevice = nullptr; @@ -169,8 +175,6 @@ private: QTouchDevice *mTouchDevice = nullptr; - QSharedPointer mPixmapCursor; - friend class QWaylandTouchExtension; friend class QWaylandQtKeyExtension; }; @@ -247,11 +251,20 @@ private: class Q_WAYLAND_CLIENT_EXPORT QWaylandInputDevice::Pointer : public QtWayland::wl_pointer { - public: - Pointer(QWaylandInputDevice *p); + explicit Pointer(QWaylandInputDevice *seat); ~Pointer() override; +#if QT_CONFIG(cursor) + QString cursorThemeName() const; + int cursorSize() const; // in surface coordinates + int idealCursorScale() const; + void updateCursorTheme(); + void updateCursor(); + CursorSurface *getOrCreateCursorSurface(); +#endif + QWaylandInputDevice *seat() const { return mParent; } +protected: void pointer_enter(uint32_t serial, struct wl_surface *surface, wl_fixed_t sx, wl_fixed_t sy) override; void pointer_leave(uint32_t time, struct wl_surface *surface) override; @@ -263,13 +276,19 @@ public: uint32_t axis, wl_fixed_t value) override; +public: void releaseButtons(); QWaylandInputDevice *mParent = nullptr; QPointer mFocus; uint32_t mEnterSerial = 0; #if QT_CONFIG(cursor) - uint32_t mCursorSerial = 0; + struct { + uint32_t serial = 0; + QWaylandCursorTheme *theme = nullptr; + int themeBufferScale = 0; + QScopedPointer surface; + } mCursor; #endif QPointF mSurfacePos; QPointF mGlobalPos; diff --git a/src/plugins/platforms/wayland/qwaylandscreen.cpp b/src/plugins/platforms/wayland/qwaylandscreen.cpp index a6caae0da4b..b2e3ce819b9 100644 --- a/src/plugins/platforms/wayland/qwaylandscreen.cpp +++ b/src/plugins/platforms/wayland/qwaylandscreen.cpp @@ -176,19 +176,10 @@ qreal QWaylandScreen::refreshRate() const } #if QT_CONFIG(cursor) - QPlatformCursor *QWaylandScreen::cursor() const { - return const_cast(this)->waylandCursor(); + return mWaylandDisplay->waylandCursor(); } - -QWaylandCursor *QWaylandScreen::waylandCursor() -{ - if (!mWaylandCursor) - mWaylandCursor.reset(new QWaylandCursor(this)); - return mWaylandCursor.data(); -} - #endif // QT_CONFIG(cursor) QWaylandScreen * QWaylandScreen::waylandScreenFromWindow(QWindow *window) diff --git a/src/plugins/platforms/wayland/qwaylandscreen_p.h b/src/plugins/platforms/wayland/qwaylandscreen_p.h index 36009cce866..4ef58c0c1d7 100644 --- a/src/plugins/platforms/wayland/qwaylandscreen_p.h +++ b/src/plugins/platforms/wayland/qwaylandscreen_p.h @@ -98,7 +98,6 @@ public: #if QT_CONFIG(cursor) QPlatformCursor *cursor() const override; - QWaylandCursor *waylandCursor(); #endif uint32_t outputId() const { return m_outputId; } diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 9e95b306867..ad7fe680fb3 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -962,7 +962,8 @@ void QWaylandWindow::handleScreenChanged() #if QT_CONFIG(cursor) void QWaylandWindow::setMouseCursor(QWaylandInputDevice *device, const QCursor &cursor) { - device->setCursor(cursor, waylandScreen()); + int fallbackBufferScale = int(devicePixelRatio()); + device->setCursor(&cursor, {}, fallbackBufferScale); } void QWaylandWindow::restoreMouseCursor(QWaylandInputDevice *device) diff --git a/tests/auto/wayland/seatv4/seatv4.pro b/tests/auto/wayland/seatv4/seatv4.pro index c02db58559c..7a86cbf0390 100644 --- a/tests/auto/wayland/seatv4/seatv4.pro +++ b/tests/auto/wayland/seatv4/seatv4.pro @@ -1,4 +1,9 @@ include (../shared/shared.pri) +qtConfig(cursor) { + QMAKE_USE += wayland-cursor + QT += gui-private +} + TARGET = tst_seatv4 SOURCES += tst_seatv4.cpp diff --git a/tests/auto/wayland/seatv4/tst_seatv4.cpp b/tests/auto/wayland/seatv4/tst_seatv4.cpp index f1e948ee25c..bc768fa61d1 100644 --- a/tests/auto/wayland/seatv4/tst_seatv4.cpp +++ b/tests/auto/wayland/seatv4/tst_seatv4.cpp @@ -30,6 +30,12 @@ #include #include +#if QT_CONFIG(cursor) +#include +#include +#include +#include +#endif using namespace MockCompositor; @@ -59,6 +65,8 @@ class tst_seatv4 : public QObject, private SeatV4Compositor private slots: void cleanup(); void bindsToSeat(); + void keyboardKeyPress(); +#if QT_CONFIG(cursor) void createsPointer(); void setsCursorOnEnter(); void usesEnterSerial(); @@ -67,8 +75,10 @@ private slots: void simpleAxis(); void invalidPointerEvents(); void scaledCursor(); - - void keyboardKeyPress(); + void bitmapCursor(); + void hidpiBitmapCursor(); + void hidpiBitmapCursorNonInt(); +#endif }; void tst_seatv4::cleanup() @@ -83,6 +93,31 @@ void tst_seatv4::bindsToSeat() QCOMPOSITOR_COMPARE(get()->resourceMap().first()->version(), 4); } +void tst_seatv4::keyboardKeyPress() +{ + class Window : public QRasterWindow { + public: + void keyPressEvent(QKeyEvent *) override { m_pressed = true; } + bool m_pressed = false; + }; + + Window window; + window.resize(64, 64); + window.show(); + QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial); + + uint keyCode = 80; // arbitrarily chosen + exec([&] { + auto *surface = xdgSurface()->m_surface; + keyboard()->sendEnter(surface); + keyboard()->sendKey(client(), keyCode, Keyboard::key_state_pressed); + keyboard()->sendKey(client(), keyCode, Keyboard::key_state_released); + }); + QTRY_VERIFY(window.m_pressed); +} + +#if QT_CONFIG(cursor) + void tst_seatv4::createsPointer() { QCOMPOSITOR_TRY_COMPARE(pointer()->resourceMap().size(), 1); @@ -253,9 +288,36 @@ void tst_seatv4::invalidPointerEvents() xdgPingAndWaitForPong(); } +static bool supportsCursorSize(uint size, wl_shm *shm) +{ + auto *theme = wl_cursor_theme_load(nullptr, size, shm); + if (!theme) + return false; + + constexpr std::array names{"left_ptr", "default", "left_arrow", "top_left_arrow"}; + for (const char *name : names) { + if (auto *cursor = wl_cursor_theme_get_cursor(theme, name)) { + auto *image = cursor->images[0]; + return image->width == image->height && image->width == size; + } + } + return false; +} + +static bool supportsCursorSizes(const QVector &sizes) +{ + auto *waylandIntegration = static_cast(QGuiApplicationPrivate::platformIntegration()); + wl_shm *shm = waylandIntegration->display()->shm()->object(); + return std::all_of(sizes.begin(), sizes.end(), [=](uint size) { + return supportsCursorSize(size, shm); + }); +} + void tst_seatv4::scaledCursor() { - QSKIP("Currently broken and should be fixed"); + if (!supportsCursorSizes({32, 64})) + QSKIP("Cursor themes with sizes 32 and 64 not found."); + // Add a highdpi output exec([&] { OutputData d; @@ -289,28 +351,122 @@ void tst_seatv4::scaledCursor() exec([&] { remove(output(1)); }); } -void tst_seatv4::keyboardKeyPress() +void tst_seatv4::bitmapCursor() { - class Window : public QRasterWindow { - public: - void keyPressEvent(QKeyEvent *) override { m_pressed = true; } - bool m_pressed = false; - }; + // Add a highdpi output + exec([&] { + OutputData d; + d.scale = 2; + d.position = {1920, 0}; + add(d); + }); - Window window; + QRasterWindow window; window.resize(64, 64); + + QPixmap pixmap(24, 24); + pixmap.setDevicePixelRatio(1); + QPoint hotspot(12, 12); // In device pixel coordinates + QCursor cursor(pixmap, hotspot.x(), hotspot.y()); + window.setCursor(cursor); + window.show(); QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial); - uint keyCode = 80; // arbitrarily chosen - exec([&] { - auto *surface = xdgSurface()->m_surface; - keyboard()->sendEnter(surface); - keyboard()->sendKey(client(), keyCode, Keyboard::key_state_pressed); - keyboard()->sendKey(client(), keyCode, Keyboard::key_state_released); + exec([=] { pointer()->sendEnter(xdgSurface()->m_surface, {32, 32}); }); + QCOMPOSITOR_TRY_VERIFY(pointer()->cursorSurface()); + QCOMPOSITOR_TRY_VERIFY(pointer()->cursorSurface()->m_committed.buffer); + QCOMPOSITOR_COMPARE(pointer()->cursorSurface()->m_committed.buffer->size(), QSize(24, 24)); + QCOMPOSITOR_COMPARE(pointer()->cursorSurface()->m_committed.bufferScale, 1); + QCOMPOSITOR_COMPARE(pointer()->m_hotspot, QPoint(12, 12)); + + exec([=] { + auto *surface = pointer()->cursorSurface(); + surface->sendEnter(getAll()[1]); + surface->sendLeave(getAll()[0]); }); - QTRY_VERIFY(window.m_pressed); + + xdgPingAndWaitForPong(); + + // Everything should remain the same, the cursor still has dpr 1 + QCOMPOSITOR_COMPARE(pointer()->cursorSurface()->m_committed.bufferScale, 1); + QCOMPOSITOR_COMPARE(pointer()->cursorSurface()->m_committed.buffer->size(), QSize(24, 24)); + QCOMPOSITOR_COMPARE(pointer()->m_hotspot, QPoint(12, 12)); + + // Remove the extra output to clean up for the next test + exec([&] { remove(getAll()[1]); }); } +void tst_seatv4::hidpiBitmapCursor() +{ + // Add a highdpi output + exec([&] { + OutputData d; + d.scale = 2; + d.position = {1920, 0}; + add(d); + }); + + QRasterWindow window; + window.resize(64, 64); + + QPixmap pixmap(48, 48); + pixmap.setDevicePixelRatio(2); + QPoint hotspot(12, 12); // In device pixel coordinates + QCursor cursor(pixmap, hotspot.x(), hotspot.y()); + window.setCursor(cursor); + + window.show(); + QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial); + + exec([=] { pointer()->sendEnter(xdgSurface()->m_surface, {32, 32}); }); + QCOMPOSITOR_TRY_VERIFY(pointer()->cursorSurface()); + QCOMPOSITOR_TRY_VERIFY(pointer()->cursorSurface()->m_committed.buffer); + QCOMPOSITOR_COMPARE(pointer()->cursorSurface()->m_committed.buffer->size(), QSize(48, 48)); + QCOMPOSITOR_COMPARE(pointer()->cursorSurface()->m_committed.bufferScale, 2); + QCOMPOSITOR_COMPARE(pointer()->m_hotspot, QPoint(12, 12)); + + exec([=] { + auto *surface = pointer()->cursorSurface(); + surface->sendEnter(getAll()[1]); + surface->sendLeave(getAll()[0]); + }); + + xdgPingAndWaitForPong(); + + QCOMPOSITOR_COMPARE(pointer()->cursorSurface()->m_committed.bufferScale, 2); + QCOMPOSITOR_COMPARE(pointer()->cursorSurface()->m_committed.buffer->size(), QSize(48, 48)); + QCOMPOSITOR_COMPARE(pointer()->m_hotspot, QPoint(12, 12)); + + // Remove the extra output to clean up for the next test + exec([&] { remove(getAll()[1]); }); +} + +void tst_seatv4::hidpiBitmapCursorNonInt() +{ + QRasterWindow window; + window.resize(64, 64); + + QPixmap pixmap(100, 100); + pixmap.setDevicePixelRatio(2.5); // dpr width is now 100 / 2.5 = 40 + QPoint hotspot(20, 20); // In device pixel coordinates (middle of buffer) + QCursor cursor(pixmap, hotspot.x(), hotspot.y()); + window.setCursor(cursor); + + window.show(); + QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial); + + exec([=] { pointer()->sendEnter(xdgSurface()->m_surface, {32, 32}); }); + QCOMPOSITOR_TRY_VERIFY(pointer()->cursorSurface()); + QCOMPOSITOR_TRY_VERIFY(pointer()->cursorSurface()->m_committed.buffer); + QCOMPOSITOR_COMPARE(pointer()->cursorSurface()->m_committed.buffer->size(), QSize(100, 100)); + QCOMPOSITOR_COMPARE(pointer()->cursorSurface()->m_committed.bufferScale, 2); + // Verify that the hotspot was scaled correctly + // Surface size is now 100 / 2 = 50, so the middle should be at 25 in surface coordinates + QCOMPOSITOR_COMPARE(pointer()->m_hotspot, QPoint(25, 25)); +} + +#endif // QT_CONFIG(cursor) + QCOMPOSITOR_TEST_MAIN(tst_seatv4) #include "tst_seatv4.moc" diff --git a/tests/auto/wayland/shared/coreprotocol.cpp b/tests/auto/wayland/shared/coreprotocol.cpp index 6f51a9793c9..c4dc3f34156 100644 --- a/tests/auto/wayland/shared/coreprotocol.cpp +++ b/tests/auto/wayland/shared/coreprotocol.cpp @@ -258,18 +258,19 @@ uint Pointer::sendEnter(Surface *surface, const QPointF &position) { wl_fixed_t x = wl_fixed_from_double(position.x()); wl_fixed_t y = wl_fixed_from_double(position.y()); - m_enterSerial = m_seat->m_compositor->nextSerial(); + + uint serial = m_seat->m_compositor->nextSerial(); + m_enterSerials << serial; wl_client *client = surface->resource()->client(); const auto pointerResources = resourceMap().values(client); for (auto *r : pointerResources) - wl_pointer::send_enter(r->handle, m_enterSerial, surface->resource()->handle, x ,y); - return m_enterSerial; + wl_pointer::send_enter(r->handle, serial, surface->resource()->handle, x ,y); + return serial; } uint Pointer::sendLeave(Surface *surface) { - m_enterSerial = 0; uint serial = m_seat->m_compositor->nextSerial(); wl_client *client = surface->resource()->client(); @@ -315,8 +316,6 @@ void Pointer::sendAxis(wl_client *client, axis axis, qreal value) void Pointer::pointer_set_cursor(Resource *resource, uint32_t serial, wl_resource *surface, int32_t hotspot_x, int32_t hotspot_y) { Q_UNUSED(resource); - Q_UNUSED(hotspot_x); - Q_UNUSED(hotspot_y); auto *s = fromResource(surface); QVERIFY(s); @@ -328,7 +327,14 @@ void Pointer::pointer_set_cursor(Resource *resource, uint32_t serial, wl_resourc m_cursorRole = new CursorRole(s); //TODO: make sure we don't leak CursorRole s->m_role = m_cursorRole; } -// QCOMPARE(serial, m_enterSerial); //TODO: uncomment when this bug is fixed + + // Directly checking the last serial would be racy, we may just have sent leaves/enters which + // the client hasn't yet seen. Instead just check if the serial matches an enter serial since + // the last time the client sent a set_cursor request. + QVERIFY(m_enterSerials.contains(serial)); + while (m_enterSerials.first() < serial) { m_enterSerials.removeFirst(); } + + m_hotspot = QPoint(hotspot_x, hotspot_y); emit setCursor(serial); } diff --git a/tests/auto/wayland/shared/coreprotocol.h b/tests/auto/wayland/shared/coreprotocol.h index 249c16f428b..699dcbdeda7 100644 --- a/tests/auto/wayland/shared/coreprotocol.h +++ b/tests/auto/wayland/shared/coreprotocol.h @@ -284,7 +284,8 @@ public: void sendAxis(wl_client *client, axis axis, qreal value); Seat *m_seat = nullptr; - uint m_enterSerial = 0; + QVector m_enterSerials; + QPoint m_hotspot; signals: void setCursor(uint serial); //TODO: add arguments? From 04be9cf380dee87f2f6797a4383d119589c313e0 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Thu, 14 Feb 2019 13:41:30 +0100 Subject: [PATCH 0656/1507] Client: Don't leak wl_data_offers [ChangeLog][QPA plugin] Fixed a leak of wl_data_offers. Data offers would previously leak when a surface with keyboard focus was destroyed... or if it was hidden... or if it changed type, and so on. Make keyboard focus follow a wl_surface instead of a QWaylandWindow. This also fixes a couple of other minor issues, such as the mRepeatTimer not stopping when a wl_surface was destroyed. Ideally, we would have a QWaylandSurface class separate from the QWaylandWindow, but that's out of scope for this fix. Fixes: QTBUG-73825 Change-Id: I56e502512c3959e3fcdb63744adc4a7698e3d53d Reviewed-by: Paul Olav Tvete --- .../platforms/wayland/qwaylanddisplay.cpp | 1 + .../platforms/wayland/qwaylandinputdevice.cpp | 77 ++++++++++++------- .../platforms/wayland/qwaylandinputdevice_p.h | 7 +- .../platforms/wayland/qwaylandwindow.cpp | 23 +----- .../platforms/wayland/qwaylandwindow_p.h | 4 +- 5 files changed, 62 insertions(+), 50 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index 3675806b2d8..491b66e153a 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -50,6 +50,7 @@ #endif #if QT_CONFIG(wayland_datadevice) #include "qwaylanddatadevicemanager_p.h" +#include "qwaylanddatadevice_p.h" #endif #if QT_CONFIG(cursor) #include diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index cb26def687a..43ca6dbd018 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -168,9 +168,9 @@ QWaylandInputDevice::Keyboard::~Keyboard() wl_keyboard_destroy(object()); } -void QWaylandInputDevice::Keyboard::stopRepeat() +QWaylandWindow *QWaylandInputDevice::Keyboard::focusWindow() const { - mRepeatTimer.stop(); + return mFocus ? QWaylandWindow::fromWlSurface(mFocus) : nullptr; } QWaylandInputDevice::Pointer::Pointer(QWaylandInputDevice *seat) @@ -421,12 +421,6 @@ QWaylandInputDevice::Touch *QWaylandInputDevice::createTouch(QWaylandInputDevice return new Touch(device); } -void QWaylandInputDevice::handleWindowDestroyed(QWaylandWindow *window) -{ - if (mKeyboard && window == mKeyboard->mFocus) - mKeyboard->stopRepeat(); -} - void QWaylandInputDevice::handleEndDrag() { if (mTouch) @@ -470,7 +464,7 @@ QWaylandWindow *QWaylandInputDevice::pointerFocus() const QWaylandWindow *QWaylandInputDevice::keyboardFocus() const { - return mKeyboard ? mKeyboard->mFocus : nullptr; + return mKeyboard ? mKeyboard->focusWindow() : nullptr; } QWaylandWindow *QWaylandInputDevice::touchFocus() const @@ -767,12 +761,19 @@ void QWaylandInputDevice::Keyboard::keyboard_enter(uint32_t time, struct wl_surf Q_UNUSED(time); Q_UNUSED(keys); - if (!surface) + if (!surface) { + // Ignoring wl_keyboard.enter event with null surface. This is either a compositor bug, + // or it's a race with a wl_surface.destroy request. In either case, ignore the event. return; + } + if (mFocus) { + qCWarning(lcQpaWayland()) << "Unexpected wl_keyboard.enter event. Keyboard already has focus"; + disconnect(focusWindow(), &QWaylandWindow::wlSurfaceDestroyed, this, &Keyboard::handleFocusDestroyed); + } - QWaylandWindow *window = QWaylandWindow::fromWlSurface(surface); - mFocus = window; + mFocus = surface; + connect(focusWindow(), &QWaylandWindow::wlSurfaceDestroyed, this, &Keyboard::handleFocusDestroyed); mParent->mQDisplay->handleKeyboardFocusChanged(mParent); } @@ -780,18 +781,20 @@ void QWaylandInputDevice::Keyboard::keyboard_enter(uint32_t time, struct wl_surf void QWaylandInputDevice::Keyboard::keyboard_leave(uint32_t time, struct wl_surface *surface) { Q_UNUSED(time); - Q_UNUSED(surface); - if (surface) { - QWaylandWindow *window = QWaylandWindow::fromWlSurface(surface); - window->unfocus(); + if (!surface) { + // Either a compositor bug, or a race condition with wl_surface.destroy, ignore the event. + return; } - mFocus = nullptr; - - mParent->mQDisplay->handleKeyboardFocusChanged(mParent); - - mRepeatTimer.stop(); + if (surface != mFocus) { + qCWarning(lcQpaWayland) << "Ignoring unexpected wl_keyboard.leave event." + << "wl_surface argument does not match the current focus" + << "This is most likely a compositor bug"; + return; + } + disconnect(focusWindow(), &QWaylandWindow::wlSurfaceDestroyed, this, &Keyboard::handleFocusDestroyed); + handleFocusLost(); } static void sendKey(QWindow *tlw, ulong timestamp, QEvent::Type type, int key, Qt::KeyboardModifiers modifiers, @@ -816,7 +819,7 @@ static void sendKey(QWindow *tlw, ulong timestamp, QEvent::Type type, int key, Q void QWaylandInputDevice::Keyboard::keyboard_key(uint32_t serial, uint32_t time, uint32_t key, uint32_t state) { - QWaylandWindow *window = mFocus; + auto *window = focusWindow(); if (!window) { // We destroyed the keyboard focus surface, but the server didn't get the message yet... // or the server didn't send an enter event first. In either case, ignore the event. @@ -896,14 +899,15 @@ void QWaylandInputDevice::Keyboard::keyboard_key(uint32_t serial, uint32_t time, void QWaylandInputDevice::Keyboard::repeatKey() { - if (!mFocus) { + auto *window = focusWindow(); + if (!window) { // We destroyed the keyboard focus surface, but the server didn't get the message yet... // or the server didn't send an enter event first. return; } mRepeatTimer.setInterval(mRepeatRate); - sendKey(mFocus->window(), mRepeatTime, QEvent::KeyRelease, mRepeatKey, modifiers(), mRepeatCode, + sendKey(window->window(), mRepeatTime, QEvent::KeyRelease, mRepeatKey, modifiers(), mRepeatCode, #if QT_CONFIG(xkbcommon) mRepeatSym, mNativeModifiers, #else @@ -911,7 +915,7 @@ void QWaylandInputDevice::Keyboard::repeatKey() #endif mRepeatText, true); - sendKey(mFocus->window(), mRepeatTime, QEvent::KeyPress, mRepeatKey, modifiers(), mRepeatCode, + sendKey(window->window(), mRepeatTime, QEvent::KeyPress, mRepeatKey, modifiers(), mRepeatCode, #if QT_CONFIG(xkbcommon) mRepeatSym, mNativeModifiers, #else @@ -920,6 +924,27 @@ void QWaylandInputDevice::Keyboard::repeatKey() mRepeatText, true); } +void QWaylandInputDevice::Keyboard::handleFocusDestroyed() +{ + // The signal is emitted by QWaylandWindow, which is not necessarily destroyed along with the + // surface, so we still need to disconnect the signal + auto *window = qobject_cast(sender()); + disconnect(window, &QWaylandWindow::wlSurfaceDestroyed, this, &Keyboard::handleFocusDestroyed); + Q_ASSERT(window->object() == mFocus); + handleFocusLost(); +} + +void QWaylandInputDevice::Keyboard::handleFocusLost() +{ + mFocus = nullptr; +#if QT_CONFIG(clipboard) + if (auto *dataDevice = mParent->dataDevice()) + dataDevice->invalidateSelectionOffer(); +#endif + mParent->mQDisplay->handleKeyboardFocusChanged(mParent); + mRepeatTimer.stop(); +} + void QWaylandInputDevice::Keyboard::keyboard_modifiers(uint32_t serial, uint32_t mods_depressed, uint32_t mods_latched, @@ -1021,7 +1046,7 @@ void QWaylandInputDevice::handleTouchPoint(int id, double x, double y, Qt::Touch if (!win && mPointer) win = mPointer->mFocus; if (!win && mKeyboard) - win = mKeyboard->mFocus; + win = mKeyboard->focusWindow(); if (!win || !win->window()) return; diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h index e57d7f4fd53..cb382da31a3 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h +++ b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h @@ -113,7 +113,6 @@ public: #if QT_CONFIG(cursor) void setCursor(const QCursor *cursor, const QSharedPointer &cachedBuffer = {}, int fallbackOutputScale = 1); #endif - void handleWindowDestroyed(QWaylandWindow *window); void handleEndDrag(); #if QT_CONFIG(wayland_datadevice) @@ -193,7 +192,7 @@ public: Keyboard(QWaylandInputDevice *p); ~Keyboard() override; - void stopRepeat(); + QWaylandWindow *focusWindow() const; void keyboard_keymap(uint32_t format, int32_t fd, @@ -213,7 +212,7 @@ public: void keyboard_repeat_info(int32_t rate, int32_t delay) override; QWaylandInputDevice *mParent = nullptr; - QPointer mFocus; + ::wl_surface *mFocus = nullptr; #if QT_CONFIG(xkbcommon) xkb_context *mXkbContext = nullptr; xkb_keymap *mXkbMap = nullptr; @@ -238,6 +237,8 @@ public: private slots: void repeatKey(); + void handleFocusDestroyed(); + void handleFocusLost(); private: #if QT_CONFIG(xkbcommon) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index ae4fc57720b..ca4d176fed6 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -51,11 +51,6 @@ #include "qwaylanddecorationfactory_p.h" #include "qwaylandshmbackingstore_p.h" -#if QT_CONFIG(wayland_datadevice) -#include "qwaylanddatadevice_p.h" -#endif - - #include #include #include @@ -95,10 +90,6 @@ QWaylandWindow::~QWaylandWindow() if (isInitialized()) reset(false); - QList inputDevices = mDisplay->inputDevices(); - for (int i = 0; i < inputDevices.size(); ++i) - inputDevices.at(i)->handleWindowDestroyed(this); - const QWindow *parent = window(); foreach (QWindow *w, QGuiApplication::topLevelWindows()) { if (w->transientParent() == parent) @@ -236,8 +227,10 @@ void QWaylandWindow::reset(bool sendDestroyEvent) mShellSurface = nullptr; delete mSubSurfaceWindow; mSubSurfaceWindow = nullptr; - if (isInitialized()) + if (isInitialized()) { + emit wlSurfaceDestroyed(); destroy(); + } mScreens.clear(); if (mFrameCallback) { @@ -972,16 +965,6 @@ void QWaylandWindow::requestActivateWindow() qCWarning(lcQpaWayland) << "Wayland does not support QWindow::requestActivate()"; } -void QWaylandWindow::unfocus() -{ -#if QT_CONFIG(clipboard) - QWaylandInputDevice *inputDevice = mDisplay->currentInputDevice(); - if (inputDevice && inputDevice->dataDevice()) { - inputDevice->dataDevice()->invalidateSelectionOffer(); - } -#endif -} - bool QWaylandWindow::isExposed() const { if (mShellSurface) diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index 0e573f350eb..8999682d91a 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -153,7 +153,6 @@ public: void requestActivateWindow() override; bool isExposed() const override; bool isActive() const override; - void unfocus(); QWaylandAbstractDecoration *decoration() const; @@ -200,6 +199,9 @@ public: public slots: void applyConfigure(); +signals: + void wlSurfaceDestroyed(); + protected: void surface_enter(struct ::wl_output *output) override; void surface_leave(struct ::wl_output *output) override; From de2fd1db6be2a825481aef054e613b9f06246d26 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Thu, 14 Feb 2019 10:26:48 +0100 Subject: [PATCH 0657/1507] Client: Add test for wl_data_offer leaks Also refactors the mocking code for data device manager and implements its isClean method to verify there are no leaks after each test. MockCompositor::DataDevice now persists across get_data_device requests. Task-number: QTBUG-73825 Change-Id: Ib5866e0c54d021e12557f9a96f27950010f2611b Reviewed-by: Paul Olav Tvete --- .../wayland/datadevicev1/tst_datadevicev1.cpp | 90 ++++++++++++++++--- tests/auto/wayland/shared/coreprotocol.h | 3 - tests/auto/wayland/shared/datadevice.cpp | 54 +++++++++-- tests/auto/wayland/shared/datadevice.h | 36 ++++++-- 4 files changed, 153 insertions(+), 30 deletions(-) diff --git a/tests/auto/wayland/datadevicev1/tst_datadevicev1.cpp b/tests/auto/wayland/datadevicev1/tst_datadevicev1.cpp index a85b10c7490..fe68d520d59 100644 --- a/tests/auto/wayland/datadevicev1/tst_datadevicev1.cpp +++ b/tests/auto/wayland/datadevicev1/tst_datadevicev1.cpp @@ -47,7 +47,7 @@ public: add(dataDeviceVersion); }); } - DataDevice *dataDevice() { return get()->dataDevice(); } + DataDevice *dataDevice() { return get()->deviceFor(get()); } }; class tst_datadevicev1 : public QObject, private DataDeviceCompositor @@ -58,6 +58,8 @@ private slots: void initTestCase(); void pasteAscii(); void pasteUtf8(); + void destroysPreviousSelection(); + void destroysSelectionWithSurface(); }; void tst_datadevicev1::initTestCase() @@ -69,7 +71,8 @@ void tst_datadevicev1::initTestCase() QCOMPOSITOR_TRY_VERIFY(keyboard()); QCOMPOSITOR_TRY_VERIFY(dataDevice()); - QCOMPOSITOR_TRY_COMPARE(dataDevice()->resource()->version(), dataDeviceVersion); + QCOMPOSITOR_TRY_VERIFY(dataDevice()->resourceMap().contains(client())); + QCOMPOSITOR_TRY_COMPARE(dataDevice()->resourceMap().value(client())->version(), dataDeviceVersion); } void tst_datadevicev1::pasteAscii() @@ -86,7 +89,8 @@ void tst_datadevicev1::pasteAscii() QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial); exec([&] { - auto *offer = new DataOffer(client(), dataDeviceVersion); // Cleaned up by destroy_resource + auto *client = xdgSurface()->resource()->client(); + auto *offer = dataDevice()->sendDataOffer(client, {"text/plain"}); connect(offer, &DataOffer::receive, [](QString mimeType, int fd) { QFile file; file.open(fd, QIODevice::WriteOnly, QFile::FileHandleFlag::AutoCloseHandle); @@ -94,16 +98,14 @@ void tst_datadevicev1::pasteAscii() file.write(QByteArray("normal ascii")); file.close(); }); - dataDevice()->sendDataOffer(offer); - offer->send_offer("text/plain"); dataDevice()->sendSelection(offer); auto *surface = xdgSurface()->m_surface; keyboard()->sendEnter(surface); // Need to set keyboard focus according to protocol pointer()->sendEnter(surface, {32, 32}); - pointer()->sendButton(client(), BTN_LEFT, 1); - pointer()->sendButton(client(), BTN_LEFT, 0); + pointer()->sendButton(client, BTN_LEFT, 1); + pointer()->sendButton(client, BTN_LEFT, 0); }); QTRY_COMPARE(window.m_text, "normal ascii"); } @@ -122,7 +124,8 @@ void tst_datadevicev1::pasteUtf8() QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial); exec([&] { - auto *offer = new DataOffer(client(), dataDeviceVersion); // Cleaned up by destroy_resource + auto *client = xdgSurface()->resource()->client(); + auto *offer = dataDevice()->sendDataOffer(client, {"text/plain", "text/plain;charset=utf-8"}); connect(offer, &DataOffer::receive, [](QString mimeType, int fd) { QFile file; file.open(fd, QIODevice::WriteOnly, QFile::FileHandleFlag::AutoCloseHandle); @@ -130,20 +133,81 @@ void tst_datadevicev1::pasteUtf8() file.write(QByteArray("face with tears of joy: 😂")); file.close(); }); - dataDevice()->sendDataOffer(offer); - offer->send_offer("text/plain"); - offer->send_offer("text/plain;charset=utf-8"); dataDevice()->sendSelection(offer); auto *surface = xdgSurface()->m_surface; keyboard()->sendEnter(surface); // Need to set keyboard focus according to protocol pointer()->sendEnter(surface, {32, 32}); - pointer()->sendButton(client(), BTN_LEFT, 1); - pointer()->sendButton(client(), BTN_LEFT, 0); + pointer()->sendButton(client, BTN_LEFT, 1); + pointer()->sendButton(client, BTN_LEFT, 0); }); QTRY_COMPARE(window.m_text, "face with tears of joy: 😂"); } +void tst_datadevicev1::destroysPreviousSelection() +{ + QRasterWindow window; + window.resize(64, 64); + window.show(); + QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial); + + // When the client receives a selection event, it is required to destroy the previous offer + exec([&] { + QCOMPARE(dataDevice()->m_sentSelectionOffers.size(), 0); + auto *offer = dataDevice()->sendDataOffer(client(), {"text/plain"}); + dataDevice()->sendSelection(offer); + auto *surface = xdgSurface()->m_surface; + keyboard()->sendEnter(surface); // Need to set keyboard focus according to protocol + QCOMPARE(dataDevice()->m_sentSelectionOffers.size(), 1); + }); + + exec([&] { + auto *offer = dataDevice()->sendDataOffer(client(), {"text/plain"}); + dataDevice()->sendSelection(offer); + QCOMPARE(dataDevice()->m_sentSelectionOffers.size(), 2); + }); + + // Verify the first offer gets destroyed + QCOMPOSITOR_TRY_COMPARE(dataDevice()->m_sentSelectionOffers.size(), 1); + + exec([&] { + auto *offer = dataDevice()->sendDataOffer(client(), {"text/plain"}); + dataDevice()->sendSelection(offer); + auto *surface = xdgSurface()->m_surface; + keyboard()->sendLeave(surface); + }); + + // Clients are required to destroy their offer when losing keyboard focus + QCOMPOSITOR_TRY_COMPARE(dataDevice()->m_sentSelectionOffers.size(), 0); +} + +void tst_datadevicev1::destroysSelectionWithSurface() +{ + auto *window = new QRasterWindow; + window->resize(64, 64); + window->show(); + + QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial); + + // When the client receives a selection event, it is required to destroy the previous offer + exec([&] { + QCOMPARE(dataDevice()->m_sentSelectionOffers.size(), 0); + auto *offer = dataDevice()->sendDataOffer(client(), {"text/plain"}); + dataDevice()->sendSelection(offer); + auto *surface = xdgSurface()->m_surface; + keyboard()->sendEnter(surface); // Need to set keyboard focus according to protocol + QCOMPARE(dataDevice()->m_sentSelectionOffers.size(), 1); + }); + + // Ping to make sure we receive the wl_keyboard enter and leave events, before destroying the + // surface. Otherwise, the client will receive enter and leave events with a destroyed (null) + // surface, which is not what we are trying to test for here. + xdgPingAndWaitForPong(); + window->destroy(); + + QCOMPOSITOR_TRY_COMPARE(dataDevice()->m_sentSelectionOffers.size(), 0); +} + QCOMPOSITOR_TEST_MAIN(tst_datadevicev1) #include "tst_datadevicev1.moc" diff --git a/tests/auto/wayland/shared/coreprotocol.h b/tests/auto/wayland/shared/coreprotocol.h index 699dcbdeda7..5cef476c8f6 100644 --- a/tests/auto/wayland/shared/coreprotocol.h +++ b/tests/auto/wayland/shared/coreprotocol.h @@ -250,9 +250,6 @@ public: Keyboard* m_keyboard = nullptr; QVector m_oldKeyboards; - DataDevice *dataDevice() { return m_dataDevice.data(); } - QScopedPointer m_dataDevice; - uint m_capabilities = 0; protected: diff --git a/tests/auto/wayland/shared/datadevice.cpp b/tests/auto/wayland/shared/datadevice.cpp index c136c75968f..dfa18952c35 100644 --- a/tests/auto/wayland/shared/datadevice.cpp +++ b/tests/auto/wayland/shared/datadevice.cpp @@ -30,29 +30,60 @@ namespace MockCompositor { +bool DataDeviceManager::isClean() +{ + for (auto *device : qAsConst(m_dataDevices)) { + // The client should not leak selection offers, i.e. if this fails, there is a missing + // data_offer.destroy request + if (!device->m_sentSelectionOffers.empty()) + return false; + } + return true; +} + +DataDevice *DataDeviceManager::deviceFor(Seat *seat) +{ + Q_ASSERT(seat); + if (auto *device = m_dataDevices.value(seat, nullptr)) + return device; + + auto *device = new DataDevice(this, seat); + m_dataDevices[seat] = device; + return device; +} + void DataDeviceManager::data_device_manager_get_data_device(Resource *resource, uint32_t id, wl_resource *seatResource) { auto *seat = fromResource(seatResource); QVERIFY(seat); - QVERIFY(!seat->m_dataDevice); - seat->m_dataDevice.reset(new DataDevice(resource->client(), id, resource->version())); + auto *device = deviceFor(seat); + device->add(resource->client(), id, resource->version()); } DataDevice::~DataDevice() { - // If the client hasn't deleted the wayland object, just ignore subsequent events - if (auto *r = resource()->handle) - wl_resource_set_implementation(r, nullptr, nullptr, nullptr); + // If the client(s) hasn't deleted the wayland object, just ignore subsequent events + for (auto *r : resourceMap()) + wl_resource_set_implementation(r->handle, nullptr, nullptr, nullptr); } -void DataDevice::sendDataOffer(DataOffer *offer) +DataOffer *DataDevice::sendDataOffer(wl_client *client, const QStringList &mimeTypes) { - wl_data_device::send_data_offer(offer->resource()->handle); + Q_ASSERT(client); + auto *offer = new DataOffer(this, client, m_manager->m_version); + for (auto *resource : resourceMap().values(client)) + wl_data_device::send_data_offer(resource->handle, offer->resource()->handle); + for (const auto &mimeType : mimeTypes) + offer->send_offer(mimeType); + return offer; } void DataDevice::sendSelection(DataOffer *offer) { - wl_data_device::send_selection(offer->resource()->handle); + auto *client = offer->resource()->client(); + for (auto *resource : resourceMap().values(client)) + wl_data_device::send_selection(resource->handle, offer->resource()->handle); + m_sentSelectionOffers << offer; } void DataOffer::data_offer_destroy_resource(Resource *resource) @@ -67,4 +98,11 @@ void DataOffer::data_offer_receive(Resource *resource, const QString &mime_type, emit receive(mime_type, fd); } +void DataOffer::data_offer_destroy(QtWaylandServer::wl_data_offer::Resource *resource) +{ + bool removed = m_dataDevice->m_sentSelectionOffers.removeOne(this); + QVERIFY(removed); + wl_resource_destroy(resource->handle); +} + } // namespace MockCompositor diff --git a/tests/auto/wayland/shared/datadevice.h b/tests/auto/wayland/shared/datadevice.h index 4613db7761e..a96da86f081 100644 --- a/tests/auto/wayland/shared/datadevice.h +++ b/tests/auto/wayland/shared/datadevice.h @@ -42,8 +42,14 @@ class DataDeviceManager : public Global, public QtWaylandServer::wl_data_device_ public: explicit DataDeviceManager(CoreCompositor *compositor, int version = 1) : QtWaylandServer::wl_data_device_manager(compositor->m_display, version) + , m_version(version) {} - QVector m_dataDevices; + ~DataDeviceManager() override { qDeleteAll(m_dataDevices); } + bool isClean() override; + DataDevice *deviceFor(Seat *seat); + + int m_version = 1; // TODO: remove on libwayland upgrade + QMap m_dataDevices; protected: void data_device_manager_get_data_device(Resource *resource, uint32_t id, ::wl_resource *seatResource) override; @@ -52,24 +58,42 @@ protected: class DataDevice : public QtWaylandServer::wl_data_device { public: - explicit DataDevice(::wl_client *client, int id, int version) - : QtWaylandServer::wl_data_device(client, id, version) + explicit DataDevice(DataDeviceManager *manager, Seat *seat) + : m_manager(manager) + , m_seat(seat) {} ~DataDevice() override; void send_data_offer(::wl_resource *resource) = delete; - void sendDataOffer(DataOffer *offer); + DataOffer *sendDataOffer(::wl_client *client, const QStringList &mimeTypes = {}); + DataOffer *sendDataOffer(const QStringList &mimeTypes = {}); + void send_selection(::wl_resource *resource) = delete; void sendSelection(DataOffer *offer); + + DataDeviceManager *m_manager = nullptr; + Seat *m_seat = nullptr; + QVector m_sentSelectionOffers; + +protected: + void data_device_release(Resource *resource) override + { + int removed = m_manager->m_dataDevices.remove(m_seat); + QVERIFY(removed); + wl_resource_destroy(resource->handle); + } }; class DataOffer : public QObject, public QtWaylandServer::wl_data_offer { Q_OBJECT public: - explicit DataOffer(::wl_client *client, int version) + explicit DataOffer(DataDevice *dataDevice, ::wl_client *client, int version) : QtWaylandServer::wl_data_offer (client, 0, version) + , m_dataDevice(dataDevice) {} + DataDevice *m_dataDevice = nullptr; + signals: void receive(QString mimeType, int fd); @@ -77,7 +101,7 @@ protected: void data_offer_destroy_resource(Resource *resource) override; void data_offer_receive(Resource *resource, const QString &mime_type, int32_t fd) override; // void data_offer_accept(Resource *resource, uint32_t serial, const QString &mime_type) override; -// void data_offer_destroy(Resource *resource) override; + void data_offer_destroy(Resource *resource) override; }; } // namespace MockCompositor From f07397208c0c6846706929bad986f5d72aff36c1 Mon Sep 17 00:00:00 2001 From: Liang Qi Date: Fri, 22 Feb 2019 15:15:02 +0100 Subject: [PATCH 0658/1507] Fix the build with -no-gui Change-Id: I9ff6ac4e33e89691e06965515a54e91a831b7a0a Reviewed-by: Oswald Buddenhagen Reviewed-by: Joerg Bornemann --- src/plugins/platforms/wayland/configure.json | 1 + 1 file changed, 1 insertion(+) diff --git a/src/plugins/platforms/wayland/configure.json b/src/plugins/platforms/wayland/configure.json index 1f86a49360f..586da6f66a9 100644 --- a/src/plugins/platforms/wayland/configure.json +++ b/src/plugins/platforms/wayland/configure.json @@ -1,5 +1,6 @@ { "module": "waylandclient", + "condition": "module.gui", "depends": [ "gui-private" ], From 446a9753abfc09d394d8ac9c2300a98d05313102 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Thu, 24 Jan 2019 14:42:28 +0100 Subject: [PATCH 0659/1507] Client: Decrease buffer_scale for small cursor themes Not all setups or themes have cursors with a matching DPI. In such cases, wl_cursor_load_theme will then return a theme that is the closest resolution it can get. With the previous implementation, cursors themes without a high dpi version would become become really tiny on high DPI displays. This patch prevents it by setting a lower wl_surface.scale for those themes. This also implements proper tracking of the cursor surface's entered outputs (i.e. if the entered surface is destroyed, the scale is reset, and similarly the following sequence of events should also be handled: wl_surface.enter(wl_output@1) wl_surface.enter(wl_output@2) wl_surface.leave(wl_output@2) In the old implementation, we would be stuck with the scale from wl_output@2, but now we now should correctly get the scale of wl_output@1. [ChangeLog][QPA plugin] Cursors on high DPI screens are now scaled up if the cursor theme does not have an appropriate high resolution version. Change-Id: Ic87d00e35612b5afdf8c2e3a4463fcfef1f1f09d Reviewed-by: Giulio Camuffo --- .../platforms/wayland/qwaylandinputdevice.cpp | 52 +++++++++++++--- tests/auto/wayland/seatv4/tst_seatv4.cpp | 62 ++++++++++++++++++- 2 files changed, 103 insertions(+), 11 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index 43ca6dbd018..65267869fba 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -188,7 +188,8 @@ QWaylandInputDevice::Pointer::~Pointer() #if QT_CONFIG(cursor) -class CursorSurface : public QtWayland::wl_surface { +class CursorSurface : public QObject, public QtWayland::wl_surface +{ public: explicit CursorSurface(QWaylandInputDevice::Pointer *pointer, QWaylandDisplay *display) : m_pointer(pointer) @@ -196,6 +197,14 @@ public: init(display->createSurface(this)); //TODO: When we upgrade to libwayland 1.10, use wl_surface_get_version instead. m_version = display->compositorVersion(); + connect(qApp, &QGuiApplication::screenRemoved, this, [this](QScreen *screen) { + int oldScale = outputScale(); + if (!m_screens.removeOne(static_cast(screen->handle()))) + return; + + if (outputScale() != oldScale) + m_pointer->updateCursor(); + }); } void hide() @@ -225,18 +234,38 @@ public: commit(); } - int outputScale() const { return m_outputScale; } + int outputScale() const + { + int scale = 0; + for (auto *screen : m_screens) + scale = qMax(scale, screen->scale()); + return scale; + } protected: void surface_enter(struct ::wl_output *output) override { - //TODO: Can be improved to keep track of all entered screens - int scale = QWaylandScreen::fromWlOutput(output)->scale(); - if (scale == m_outputScale) + int oldScale = outputScale(); + auto *screen = QWaylandScreen::fromWlOutput(output); + if (m_screens.contains(screen)) return; - m_outputScale = scale; - m_pointer->updateCursor(); + m_screens.append(screen); + + if (outputScale() != oldScale) + m_pointer->updateCursor(); + } + + void surface_leave(struct ::wl_output *output) override + { + int oldScale = outputScale(); + auto *screen = QWaylandScreen::fromWlOutput(output); + + if (!m_screens.removeOne(screen)) + return; + + if (outputScale() != oldScale) + m_pointer->updateCursor(); } private: @@ -244,7 +273,7 @@ private: uint m_version = 0; uint m_setSerial = 0; QPoint m_hotspot; - int m_outputScale = 0; + QVector m_screens; }; QString QWaylandInputDevice::Pointer::cursorThemeName() const @@ -280,6 +309,13 @@ void QWaylandInputDevice::Pointer::updateCursorTheme() int pixelSize = cursorSize() * scale; auto *display = seat()->mQDisplay; mCursor.theme = display->loadCursorTheme(cursorThemeName(), pixelSize); + if (auto *arrow = mCursor.theme->cursorImage(Qt::ArrowCursor)) { + int arrowPixelSize = qMax(arrow->width, arrow->height); // Not all cursor themes are square + while (scale > 1 && arrowPixelSize / scale < cursorSize()) + --scale; + } else { + qWarning(lcQpaWayland) << "Cursor theme does not support the arrow cursor"; + } mCursor.themeBufferScale = scale; } diff --git a/tests/auto/wayland/seatv4/tst_seatv4.cpp b/tests/auto/wayland/seatv4/tst_seatv4.cpp index bc768fa61d1..8fa81b608df 100644 --- a/tests/auto/wayland/seatv4/tst_seatv4.cpp +++ b/tests/auto/wayland/seatv4/tst_seatv4.cpp @@ -75,6 +75,7 @@ private slots: void simpleAxis(); void invalidPointerEvents(); void scaledCursor(); + void unscaledFallbackCursor(); void bitmapCursor(); void hidpiBitmapCursor(); void hidpiBitmapCursorNonInt(); @@ -290,7 +291,7 @@ void tst_seatv4::invalidPointerEvents() static bool supportsCursorSize(uint size, wl_shm *shm) { - auto *theme = wl_cursor_theme_load(nullptr, size, shm); + auto *theme = wl_cursor_theme_load(qgetenv("XCURSOR_THEME"), size, shm); if (!theme) return false; @@ -313,10 +314,16 @@ static bool supportsCursorSizes(const QVector &sizes) }); } +static uint defaultCursorSize() { + const int xCursorSize = qEnvironmentVariableIntValue("XCURSOR_SIZE"); + return xCursorSize > 0 ? uint(xCursorSize) : 32; +} + void tst_seatv4::scaledCursor() { - if (!supportsCursorSizes({32, 64})) - QSKIP("Cursor themes with sizes 32 and 64 not found."); + const uint defaultSize = defaultCursorSize(); + if (!supportsCursorSizes({defaultSize, defaultSize * 2})) + QSKIP("Cursor themes with default size and 2x default size not found."); // Add a highdpi output exec([&] { @@ -351,6 +358,55 @@ void tst_seatv4::scaledCursor() exec([&] { remove(output(1)); }); } +void tst_seatv4::unscaledFallbackCursor() +{ + const uint defaultSize = defaultCursorSize(); + if (!supportsCursorSizes({defaultSize})) + QSKIP("Default cursor size not supported"); + + const int screens = 4; // with scales 1, 2, 4, 8 + + exec([=] { + for (int i = 1; i < screens; ++i) { + OutputData d; + d.scale = int(qPow(2, i)); + d.position = {1920 * i, 0}; + add(d); + } + }); + + QRasterWindow window; + window.resize(64, 64); + window.show(); + QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial); + exec([=] { pointer()->sendEnter(xdgSurface()->m_surface, {32, 32}); }); + QCOMPOSITOR_TRY_VERIFY(pointer()->cursorSurface()); + QCOMPOSITOR_TRY_VERIFY(pointer()->cursorSurface()->m_committed.buffer); + QCOMPOSITOR_TRY_COMPARE(pointer()->cursorSurface()->m_committed.bufferScale, 1); + QSize unscaledPixelSize = exec([=] { + return pointer()->cursorSurface()->m_committed.buffer->size(); + }); + + QCOMPARE(unscaledPixelSize.width(), int(defaultSize)); + QCOMPARE(unscaledPixelSize.height(), int(defaultSize)); + + for (int i = 1; i < screens; ++i) { + exec([=] { + auto *surface = pointer()->cursorSurface(); + surface->sendEnter(getAll()[i]); + surface->sendLeave(getAll()[i-1]); + }); + + xdgPingAndWaitForPong(); // Give the client a chance to mess up + + // Surface size (buffer size / scale) should stay constant + QCOMPOSITOR_TRY_COMPARE(pointer()->cursorSurface()->m_committed.buffer->size() / pointer()->cursorSurface()->m_committed.bufferScale, unscaledPixelSize); + } + + // Remove the extra outputs to clean up for the next test + exec([&] { while (auto *o = output(1)) remove(o); }); +} + void tst_seatv4::bitmapCursor() { // Add a highdpi output From ecd0d448faaa4c92a712bb1f04a00e4c2811d45d Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Wed, 6 Feb 2019 09:31:41 +0100 Subject: [PATCH 0660/1507] Client tests: Add convenience for getting cursor surface Let's simplify all those pointer()->surfaceCursor() calls. Change-Id: I83c51f460fa2313a0b84c8c64509d48027156443 Reviewed-by: Giulio Camuffo --- tests/auto/wayland/seatv4/tst_seatv4.cpp | 62 +++++++++++----------- tests/auto/wayland/shared/mockcompositor.h | 1 + 2 files changed, 32 insertions(+), 31 deletions(-) diff --git a/tests/auto/wayland/seatv4/tst_seatv4.cpp b/tests/auto/wayland/seatv4/tst_seatv4.cpp index 8fa81b608df..771307d7e2d 100644 --- a/tests/auto/wayland/seatv4/tst_seatv4.cpp +++ b/tests/auto/wayland/seatv4/tst_seatv4.cpp @@ -133,7 +133,7 @@ void tst_seatv4::setsCursorOnEnter() QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial); exec([=] { pointer()->sendEnter(xdgSurface()->m_surface, {32, 32}); }); - QCOMPOSITOR_TRY_VERIFY(pointer()->cursorSurface()); + QCOMPOSITOR_TRY_VERIFY(cursorSurface()); } void tst_seatv4::usesEnterSerial() @@ -339,20 +339,20 @@ void tst_seatv4::scaledCursor() QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial); exec([=] { pointer()->sendEnter(xdgSurface()->m_surface, {32, 32}); }); - QCOMPOSITOR_TRY_VERIFY(pointer()->cursorSurface()); - QCOMPOSITOR_TRY_VERIFY(pointer()->cursorSurface()->m_committed.buffer); - QCOMPOSITOR_TRY_COMPARE(pointer()->cursorSurface()->m_committed.bufferScale, 1); + QCOMPOSITOR_TRY_VERIFY(cursorSurface()); + QCOMPOSITOR_TRY_VERIFY(cursorSurface()->m_committed.buffer); + QCOMPOSITOR_TRY_COMPARE(cursorSurface()->m_committed.bufferScale, 1); QSize unscaledPixelSize = exec([=] { - return pointer()->cursorSurface()->m_committed.buffer->size(); + return cursorSurface()->m_committed.buffer->size(); }); exec([=] { - auto *surface = pointer()->cursorSurface(); + auto *surface = cursorSurface(); surface->sendEnter(getAll()[1]); surface->sendLeave(getAll()[0]); }); - QCOMPOSITOR_TRY_COMPARE(pointer()->cursorSurface()->m_committed.buffer->size(), unscaledPixelSize * 2); + QCOMPOSITOR_TRY_COMPARE(cursorSurface()->m_committed.buffer->size(), unscaledPixelSize * 2); // Remove the extra output to clean up for the next test exec([&] { remove(output(1)); }); @@ -380,11 +380,11 @@ void tst_seatv4::unscaledFallbackCursor() window.show(); QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial); exec([=] { pointer()->sendEnter(xdgSurface()->m_surface, {32, 32}); }); - QCOMPOSITOR_TRY_VERIFY(pointer()->cursorSurface()); - QCOMPOSITOR_TRY_VERIFY(pointer()->cursorSurface()->m_committed.buffer); - QCOMPOSITOR_TRY_COMPARE(pointer()->cursorSurface()->m_committed.bufferScale, 1); + QCOMPOSITOR_TRY_VERIFY(cursorSurface()); + QCOMPOSITOR_TRY_VERIFY(cursorSurface()->m_committed.buffer); + QCOMPOSITOR_TRY_COMPARE(cursorSurface()->m_committed.bufferScale, 1); QSize unscaledPixelSize = exec([=] { - return pointer()->cursorSurface()->m_committed.buffer->size(); + return cursorSurface()->m_committed.buffer->size(); }); QCOMPARE(unscaledPixelSize.width(), int(defaultSize)); @@ -392,7 +392,7 @@ void tst_seatv4::unscaledFallbackCursor() for (int i = 1; i < screens; ++i) { exec([=] { - auto *surface = pointer()->cursorSurface(); + auto *surface = cursorSurface(); surface->sendEnter(getAll()[i]); surface->sendLeave(getAll()[i-1]); }); @@ -400,7 +400,7 @@ void tst_seatv4::unscaledFallbackCursor() xdgPingAndWaitForPong(); // Give the client a chance to mess up // Surface size (buffer size / scale) should stay constant - QCOMPOSITOR_TRY_COMPARE(pointer()->cursorSurface()->m_committed.buffer->size() / pointer()->cursorSurface()->m_committed.bufferScale, unscaledPixelSize); + QCOMPOSITOR_TRY_COMPARE(cursorSurface()->m_committed.buffer->size() / cursorSurface()->m_committed.bufferScale, unscaledPixelSize); } // Remove the extra outputs to clean up for the next test @@ -430,14 +430,14 @@ void tst_seatv4::bitmapCursor() QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial); exec([=] { pointer()->sendEnter(xdgSurface()->m_surface, {32, 32}); }); - QCOMPOSITOR_TRY_VERIFY(pointer()->cursorSurface()); - QCOMPOSITOR_TRY_VERIFY(pointer()->cursorSurface()->m_committed.buffer); - QCOMPOSITOR_COMPARE(pointer()->cursorSurface()->m_committed.buffer->size(), QSize(24, 24)); - QCOMPOSITOR_COMPARE(pointer()->cursorSurface()->m_committed.bufferScale, 1); + QCOMPOSITOR_TRY_VERIFY(cursorSurface()); + QCOMPOSITOR_TRY_VERIFY(cursorSurface()->m_committed.buffer); + QCOMPOSITOR_COMPARE(cursorSurface()->m_committed.buffer->size(), QSize(24, 24)); + QCOMPOSITOR_COMPARE(cursorSurface()->m_committed.bufferScale, 1); QCOMPOSITOR_COMPARE(pointer()->m_hotspot, QPoint(12, 12)); exec([=] { - auto *surface = pointer()->cursorSurface(); + auto *surface = cursorSurface(); surface->sendEnter(getAll()[1]); surface->sendLeave(getAll()[0]); }); @@ -445,8 +445,8 @@ void tst_seatv4::bitmapCursor() xdgPingAndWaitForPong(); // Everything should remain the same, the cursor still has dpr 1 - QCOMPOSITOR_COMPARE(pointer()->cursorSurface()->m_committed.bufferScale, 1); - QCOMPOSITOR_COMPARE(pointer()->cursorSurface()->m_committed.buffer->size(), QSize(24, 24)); + QCOMPOSITOR_COMPARE(cursorSurface()->m_committed.bufferScale, 1); + QCOMPOSITOR_COMPARE(cursorSurface()->m_committed.buffer->size(), QSize(24, 24)); QCOMPOSITOR_COMPARE(pointer()->m_hotspot, QPoint(12, 12)); // Remove the extra output to clean up for the next test @@ -476,22 +476,22 @@ void tst_seatv4::hidpiBitmapCursor() QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial); exec([=] { pointer()->sendEnter(xdgSurface()->m_surface, {32, 32}); }); - QCOMPOSITOR_TRY_VERIFY(pointer()->cursorSurface()); - QCOMPOSITOR_TRY_VERIFY(pointer()->cursorSurface()->m_committed.buffer); - QCOMPOSITOR_COMPARE(pointer()->cursorSurface()->m_committed.buffer->size(), QSize(48, 48)); - QCOMPOSITOR_COMPARE(pointer()->cursorSurface()->m_committed.bufferScale, 2); + QCOMPOSITOR_TRY_VERIFY(cursorSurface()); + QCOMPOSITOR_TRY_VERIFY(cursorSurface()->m_committed.buffer); + QCOMPOSITOR_COMPARE(cursorSurface()->m_committed.buffer->size(), QSize(48, 48)); + QCOMPOSITOR_COMPARE(cursorSurface()->m_committed.bufferScale, 2); QCOMPOSITOR_COMPARE(pointer()->m_hotspot, QPoint(12, 12)); exec([=] { - auto *surface = pointer()->cursorSurface(); + auto *surface = cursorSurface(); surface->sendEnter(getAll()[1]); surface->sendLeave(getAll()[0]); }); xdgPingAndWaitForPong(); - QCOMPOSITOR_COMPARE(pointer()->cursorSurface()->m_committed.bufferScale, 2); - QCOMPOSITOR_COMPARE(pointer()->cursorSurface()->m_committed.buffer->size(), QSize(48, 48)); + QCOMPOSITOR_COMPARE(cursorSurface()->m_committed.bufferScale, 2); + QCOMPOSITOR_COMPARE(cursorSurface()->m_committed.buffer->size(), QSize(48, 48)); QCOMPOSITOR_COMPARE(pointer()->m_hotspot, QPoint(12, 12)); // Remove the extra output to clean up for the next test @@ -513,10 +513,10 @@ void tst_seatv4::hidpiBitmapCursorNonInt() QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial); exec([=] { pointer()->sendEnter(xdgSurface()->m_surface, {32, 32}); }); - QCOMPOSITOR_TRY_VERIFY(pointer()->cursorSurface()); - QCOMPOSITOR_TRY_VERIFY(pointer()->cursorSurface()->m_committed.buffer); - QCOMPOSITOR_COMPARE(pointer()->cursorSurface()->m_committed.buffer->size(), QSize(100, 100)); - QCOMPOSITOR_COMPARE(pointer()->cursorSurface()->m_committed.bufferScale, 2); + QCOMPOSITOR_TRY_VERIFY(cursorSurface()); + QCOMPOSITOR_TRY_VERIFY(cursorSurface()->m_committed.buffer); + QCOMPOSITOR_COMPARE(cursorSurface()->m_committed.buffer->size(), QSize(100, 100)); + QCOMPOSITOR_COMPARE(cursorSurface()->m_committed.bufferScale, 2); // Verify that the hotspot was scaled correctly // Surface size is now 100 / 2 = 50, so the middle should be at 25 in surface coordinates QCOMPOSITOR_COMPARE(pointer()->m_hotspot, QPoint(25, 25)); diff --git a/tests/auto/wayland/shared/mockcompositor.h b/tests/auto/wayland/shared/mockcompositor.h index ddbd7f34264..75ef1eaea1d 100644 --- a/tests/auto/wayland/shared/mockcompositor.h +++ b/tests/auto/wayland/shared/mockcompositor.h @@ -54,6 +54,7 @@ public: XdgToplevel *xdgToplevel(int i = 0) { return get()->toplevel(i); } XdgPopup *xdgPopup(int i = 0) { return get()->popup(i); } Pointer *pointer() { auto *seat = get(); Q_ASSERT(seat); return seat->m_pointer; } + Surface *cursorSurface() { auto *p = pointer(); return p ? p->cursorSurface() : nullptr; } Keyboard *keyboard() { auto *seat = get(); Q_ASSERT(seat); return seat->m_keyboard; } uint sendXdgShellPing(); void xdgPingAndWaitForPong(); From 7fa16ebff6ca429daf9cb0eddc2d8ff362423ba8 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Wed, 6 Feb 2019 09:30:09 +0100 Subject: [PATCH 0661/1507] Client: Don't send illegal wl_pointer.set_cursor requests When the cursor focus' wl_surface is destroyed, or the pointer leaves a surface, we have to reset the enter serial to avoid sending illegal set_cursor requests. Change-Id: I0c886e4123acb4aebd325b07bf15b9d3fa8589da Reviewed-by: Giulio Camuffo --- .../platforms/wayland/qwaylandinputdevice.cpp | 23 +++++++++++-- .../platforms/wayland/qwaylandinputdevice_p.h | 10 ++++-- tests/auto/wayland/seatv4/tst_seatv4.cpp | 34 ++++++++++++++++++- tests/auto/wayland/shared/coreprotocol.cpp | 6 ++-- 4 files changed, 65 insertions(+), 8 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index 65267869fba..76000e54203 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -209,7 +209,9 @@ public: void hide() { - m_pointer->set_cursor(m_pointer->mEnterSerial, nullptr, 0, 0); + uint serial = m_pointer->mEnterSerial; + Q_ASSERT(serial); + m_pointer->set_cursor(serial, nullptr, 0, 0); m_setSerial = 0; } @@ -581,7 +583,16 @@ void QWaylandInputDevice::Pointer::pointer_enter(uint32_t serial, struct wl_surf return; QWaylandWindow *window = QWaylandWindow::fromWlSurface(surface); + + if (mFocus) { + qWarning(lcQpaWayland) << "The compositor sent a wl_pointer.enter event before sending a" + << "leave event first, this is not allowed by the wayland protocol" + << "attempting to work around it by invalidating the current focus"; + invalidateFocus(); + } mFocus = window; + connect(mFocus, &QWaylandWindow::wlSurfaceDestroyed, this, &Pointer::handleFocusDestroyed); + mSurfacePos = QPointF(wl_fixed_to_double(sx), wl_fixed_to_double(sy)); mGlobalPos = window->window()->mapToGlobal(mSurfacePos.toPoint()); @@ -611,7 +622,8 @@ void QWaylandInputDevice::Pointer::pointer_leave(uint32_t time, struct wl_surfac QWaylandWindow *window = QWaylandWindow::fromWlSurface(surface); window->handleMouseLeave(mParent); } - mFocus = nullptr; + + invalidateFocus(); mButtons = Qt::NoButton; mParent->mTime = time; @@ -714,6 +726,13 @@ void QWaylandInputDevice::Pointer::pointer_button(uint32_t serial, uint32_t time } } +void QWaylandInputDevice::Pointer::invalidateFocus() +{ + disconnect(mFocus, &QWaylandWindow::wlSurfaceDestroyed, this, &Pointer::handleFocusDestroyed); + mFocus = nullptr; + mEnterSerial = 0; +} + void QWaylandInputDevice::Pointer::releaseButtons() { mButtons = Qt::NoButton; diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h index cb382da31a3..50b1af385a9 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h +++ b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h @@ -250,8 +250,9 @@ private: }; -class Q_WAYLAND_CLIENT_EXPORT QWaylandInputDevice::Pointer : public QtWayland::wl_pointer +class Q_WAYLAND_CLIENT_EXPORT QWaylandInputDevice::Pointer : public QObject, public QtWayland::wl_pointer { + Q_OBJECT public: explicit Pointer(QWaylandInputDevice *seat); ~Pointer() override; @@ -277,6 +278,12 @@ protected: uint32_t axis, wl_fixed_t value) override; +private slots: + void handleFocusDestroyed() { invalidateFocus(); } + +private: + void invalidateFocus(); + public: void releaseButtons(); @@ -285,7 +292,6 @@ public: uint32_t mEnterSerial = 0; #if QT_CONFIG(cursor) struct { - uint32_t serial = 0; QWaylandCursorTheme *theme = nullptr; int themeBufferScale = 0; QScopedPointer surface; diff --git a/tests/auto/wayland/seatv4/tst_seatv4.cpp b/tests/auto/wayland/seatv4/tst_seatv4.cpp index 771307d7e2d..7dc2e727a6a 100644 --- a/tests/auto/wayland/seatv4/tst_seatv4.cpp +++ b/tests/auto/wayland/seatv4/tst_seatv4.cpp @@ -70,6 +70,7 @@ private slots: void createsPointer(); void setsCursorOnEnter(); void usesEnterSerial(); + void focusDestruction(); void mousePress(); void simpleAxis_data(); void simpleAxis(); @@ -147,12 +148,43 @@ void tst_seatv4::usesEnterSerial() uint enterSerial = exec([=] { return pointer()->sendEnter(xdgSurface()->m_surface, {32, 32}); }); - QCOMPOSITOR_TRY_VERIFY(pointer()->cursorSurface()); + QCOMPOSITOR_TRY_VERIFY(cursorSurface()); QTRY_COMPARE(setCursorSpy.count(), 1); QCOMPARE(setCursorSpy.takeFirst().at(0).toUInt(), enterSerial); } +void tst_seatv4::focusDestruction() +{ + QSignalSpy setCursorSpy(exec([=] { return pointer(); }), &Pointer::setCursor); + QRasterWindow window; + window.resize(64, 64); + window.show(); + QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial); + // Setting a cursor now is not allowed since there has been no enter event + QCOMPARE(setCursorSpy.count(), 0); + + uint enterSerial = exec([=] { + return pointer()->sendEnter(xdgSurface()->m_surface, {32, 32}); + }); + QCOMPOSITOR_TRY_VERIFY(cursorSurface()); + QTRY_COMPARE(setCursorSpy.count(), 1); + QCOMPARE(setCursorSpy.takeFirst().at(0).toUInt(), enterSerial); + + // Destroy the focus + window.close(); + + QRasterWindow window2; + window2.resize(64, 64); + window2.show(); + window2.setCursor(Qt::WaitCursor); + QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial); + + // Setting a cursor now is not allowed since there has been no enter event + xdgPingAndWaitForPong(); + QCOMPARE(setCursorSpy.count(), 0); +} + void tst_seatv4::mousePress() { class Window : public QRasterWindow { diff --git a/tests/auto/wayland/shared/coreprotocol.cpp b/tests/auto/wayland/shared/coreprotocol.cpp index c4dc3f34156..729d481f83b 100644 --- a/tests/auto/wayland/shared/coreprotocol.cpp +++ b/tests/auto/wayland/shared/coreprotocol.cpp @@ -261,6 +261,7 @@ uint Pointer::sendEnter(Surface *surface, const QPointF &position) uint serial = m_seat->m_compositor->nextSerial(); m_enterSerials << serial; + m_cursorRole = nullptr; // According to the protocol, the pointer image is undefined after enter wl_client *client = surface->resource()->client(); const auto pointerResources = resourceMap().values(client); @@ -320,9 +321,8 @@ void Pointer::pointer_set_cursor(Resource *resource, uint32_t serial, wl_resourc QVERIFY(s); if (s->m_role) { - auto *cursorRole = CursorRole::fromSurface(s); - QVERIFY(cursorRole); - QVERIFY(cursorRole == m_cursorRole); + m_cursorRole = CursorRole::fromSurface(s); + QVERIFY(m_cursorRole); } else { m_cursorRole = new CursorRole(s); //TODO: make sure we don't leak CursorRole s->m_role = m_cursorRole; From c104decfdd3a8fd679ca0fefef571f96b1cc2415 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Tue, 5 Feb 2019 10:07:56 +0100 Subject: [PATCH 0662/1507] Client xdg-shell: Add test for switching popups Task-number: QTBUG-73524 Change-Id: Ie9a13aeae52a7576699147e5515e2ed32a3a4d1c Reviewed-by: Giulio Camuffo --- tests/auto/wayland/shared/xdgshell.cpp | 1 + tests/auto/wayland/shared/xdgshell.h | 5 +- tests/auto/wayland/xdgshell/tst_xdgshell.cpp | 89 ++++++++++++++++++++ 3 files changed, 94 insertions(+), 1 deletion(-) diff --git a/tests/auto/wayland/shared/xdgshell.cpp b/tests/auto/wayland/shared/xdgshell.cpp index 9437688adf5..13acc01e219 100644 --- a/tests/auto/wayland/shared/xdgshell.cpp +++ b/tests/auto/wayland/shared/xdgshell.cpp @@ -236,6 +236,7 @@ void XdgPopup::xdg_popup_destroy(Resource *resource) { } m_xdgSurface->m_popup = nullptr; m_parentXdgSurface->m_popups.removeAll(this); + emit destroyRequested(); } } // namespace MockCompositor diff --git a/tests/auto/wayland/shared/xdgshell.h b/tests/auto/wayland/shared/xdgshell.h index ca19c293fc3..618babde73a 100644 --- a/tests/auto/wayland/shared/xdgshell.h +++ b/tests/auto/wayland/shared/xdgshell.h @@ -130,8 +130,9 @@ protected: void xdg_toplevel_set_min_size(Resource *resource, int32_t width, int32_t height) override; }; -class XdgPopup : public QtWaylandServer::xdg_popup +class XdgPopup : public QObject, public QtWaylandServer::xdg_popup { + Q_OBJECT public: explicit XdgPopup(XdgSurface *xdgSurface, XdgSurface *parent, int id, int version = 1); void sendConfigure(const QRect &geometry); @@ -141,6 +142,8 @@ public: XdgSurface *m_parentXdgSurface = nullptr; bool m_grabbed = false; uint m_grabSerial = 0; +signals: + void destroyRequested(); protected: void xdg_popup_grab(Resource *resource, ::wl_resource *seat, uint32_t serial) override; void xdg_popup_destroy(Resource *resource) override; diff --git a/tests/auto/wayland/xdgshell/tst_xdgshell.cpp b/tests/auto/wayland/xdgshell/tst_xdgshell.cpp index 32b62689e60..6efffc8a4b6 100644 --- a/tests/auto/wayland/xdgshell/tst_xdgshell.cpp +++ b/tests/auto/wayland/xdgshell/tst_xdgshell.cpp @@ -43,6 +43,7 @@ private slots: void configureStates(); void popup(); void tooltipOnPopup(); + void switchPopups(); void pongs(); void minMaxSize(); void windowGeometry(); @@ -332,6 +333,94 @@ void tst_xdgshell::tooltipOnPopup() QCOMPOSITOR_TRY_COMPARE(xdgPopup(0), nullptr); } +// QTBUG-65680 +void tst_xdgshell::switchPopups() +{ + class Popup : public QRasterWindow { + public: + explicit Popup(QWindow *parent) { + setTransientParent(parent); + setFlags(Qt::Popup); + resize(10, 10); + show(); + } + }; + + class Window : public QRasterWindow { + public: + void mousePressEvent(QMouseEvent *event) override { + QRasterWindow::mousePressEvent(event); + if (!m_popups.empty()) + m_popups.last()->setVisible(false); + } + // The bug this checks for, is the case where there is a flushWindowSystemEvents() call + // somewhere within setVisible(false) before the grab has been released. + // This leads to the the release event below—including its show() call—to be handled + // At a time where there is still an active grab, making it illegal for the new popup to + // grab. + void mouseReleaseEvent(QMouseEvent *event) override { + QRasterWindow::mouseReleaseEvent(event); + m_popups << new Popup(this); + } + ~Window() override { qDeleteAll(m_popups); } + QVector m_popups; + }; + + Window window; + window.resize(200, 200); + window.show(); + + QCOMPOSITOR_TRY_VERIFY(xdgToplevel()); + exec([=] { xdgToplevel()->sendCompleteConfigure(); }); + QCOMPOSITOR_TRY_VERIFY(xdgToplevel()->m_xdgSurface->m_committedConfigureSerial); + + exec([=] { + auto *surface = xdgToplevel()->surface(); + auto *p = pointer(); + p->sendEnter(surface, {100, 100}); +// p->sendFrame(); //TODO: uncomment when we support seat v5 + p->sendButton(client(), BTN_LEFT, Pointer::button_state_pressed); + p->sendButton(client(), BTN_LEFT, Pointer::button_state_released); +// p->sendFrame(); + p->sendLeave(surface); +// p->sendFrame(); + }); + + QCOMPOSITOR_TRY_VERIFY(xdgPopup()); + exec([=] { xdgPopup()->sendCompleteConfigure(QRect(100, 100, 100, 100)); }); + QCOMPOSITOR_TRY_VERIFY(xdgPopup()->m_xdgSurface->m_committedConfigureSerial); + QCOMPOSITOR_TRY_VERIFY(xdgPopup()->m_grabbed); + + QSignalSpy firstDestroyed(exec([=] { return xdgPopup(); }), &XdgPopup::destroyRequested); + + exec([=] { + auto *surface = xdgToplevel()->surface(); + auto *p = pointer(); + p->sendEnter(surface, {100, 100}); +// p->sendFrame(); + p->sendButton(client(), BTN_LEFT, Pointer::button_state_pressed); + p->sendButton(client(), BTN_LEFT, Pointer::button_state_released); +// p->sendFrame(); + }); + + // The client will now hide one popup and then show another + firstDestroyed.wait(); + + QCOMPOSITOR_TRY_VERIFY(xdgPopup()); + QCOMPOSITOR_TRY_VERIFY(!xdgPopup(1)); + + // Verify we still grabbed in case the client has checks to avoid illegal grabs + QCOMPOSITOR_TRY_VERIFY(xdgPopup()->m_grabbed); + + // Sometimes the popup will select another parent if one is illegal at the time it tries to + // grab. So we verify we got the intended parent on the compositor side. + QCOMPOSITOR_TRY_VERIFY(xdgPopup()->m_parentXdgSurface == xdgToplevel()->m_xdgSurface); + + // For good measure just check that configuring works as usual + exec([=] { xdgPopup()->sendCompleteConfigure(QRect(100, 100, 100, 100)); }); + QCOMPOSITOR_TRY_VERIFY(xdgPopup()->m_xdgSurface->m_committedConfigureSerial); +} + void tst_xdgshell::pongs() { QSignalSpy pongSpy(exec([=] { return get(); }), &XdgWmBase::pong); From 7f21a684f7fc98a687cda207175b900aec7e551e Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Thu, 28 Feb 2019 10:23:16 +0100 Subject: [PATCH 0663/1507] Guarantee compatibility for Qt's extension protocols Spell out and formalize the policy that we have been following since Qt 5.4: We don't break compatibility for our internal protocols. Otherwise, it would not be safe to use a Qt client with a Qt-based compositor. Change-Id: I632e9fbb56095ab07560413977c79777ae9fdcd2 Reviewed-by: Johan Helsing Reviewed-by: Pier Luigi Fiorini --- src/3rdparty/wayland/extensions/README.md | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/3rdparty/wayland/extensions/README.md b/src/3rdparty/wayland/extensions/README.md index f75e0f23665..8024ffa80e7 100644 --- a/src/3rdparty/wayland/extensions/README.md +++ b/src/3rdparty/wayland/extensions/README.md @@ -3,12 +3,10 @@ The protocol extensions in this folder are considered implementation details of Qt. I.e. they may removed, renamed or changed without warning. -## Suffixed protocols - -For protocols that have a version suffix, however, we will strive to not break -backwards compatibility without bumping the suffix (renaming the protocol). -E.g.: If your client sees a `zqt_key_v1` global, it can safely bind to it: -the key event will always take the same number of arguments, regardless of +However, starting with Qt 5.4, we promise not to break backwards compatibility +without renaming (or removing) the protocol. I.e., if your client sees a global +from one of these extensions, it can safely bind to it: the existing events +and requests will always take the same number of arguments, regardless of compositor version. This is important also within a Qt-only scope if there are multiple versions of @@ -16,3 +14,11 @@ Qt on the system. Consider for instance an application statically linked to Qt (such as Qt Creator) running against a Qt compositor installed by the distro). In such cases we don't want the compositor and client to disagree on the protocol definition. + +## Protocol versioning. + +Protocol extensions in this folder should be versioned (e.g. `zqt_key_v1`). +If it is necessary to break protocol compatibility, they will be renamed by +incrementing the version number. For legacy reasons, there are also unversioned +protocols in this folder. Those protocols should be renamed to be versioned +if compatibility is broken. From df531a6f3c74dc666036f6171610d292415d81ad Mon Sep 17 00:00:00 2001 From: Robin Burchell Date: Sun, 30 Jul 2017 21:50:41 +0200 Subject: [PATCH 0664/1507] Client: Implement wl_pointer version 5 Version 5 adds frame events, which groups multiple pointer events together, enabling diagonal scrolling, leave and enter without an intermediate state, and together with the new axis_source, axis_discrete and axis_stop also adds what needed to differentiate between wheel events and touchpad scrolling. This patch adds scroll phases and pixel deltas to QWaylandInputDevice, and makes sure handleWheelEvent is called accordingly. [ChangeLog][QPA plugin] Pixel delta is now set for mouse scrolling events if originating from an appropriate device such as a touch pad (requires compositor support for wl_seat version 5 or later). Fixes: QTBUG-69876 Fixes: QTBUG-63720 Change-Id: I094a1ef0365893bee135cae7e6df89fafdafa2f2 Reviewed-by: Giulio Camuffo --- .../platforms/wayland/qwaylandinputdevice.cpp | 338 +++++++++++++-- .../platforms/wayland/qwaylandinputdevice_p.h | 80 +++- .../platforms/wayland/qwaylandwindow.cpp | 42 +- .../platforms/wayland/qwaylandwindow_p.h | 1 - tests/auto/wayland/client.pro | 1 + tests/auto/wayland/seatv5/seatv5.pro | 4 + tests/auto/wayland/seatv5/tst_seatv5.cpp | 387 ++++++++++++++++++ tests/auto/wayland/shared/coreprotocol.cpp | 33 ++ tests/auto/wayland/shared/coreprotocol.h | 4 + 9 files changed, 816 insertions(+), 74 deletions(-) create mode 100644 tests/auto/wayland/seatv5/seatv5.pro create mode 100644 tests/auto/wayland/seatv5/tst_seatv5.cpp diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index 31495a45324..23a84e4bd1d 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -78,6 +78,8 @@ QT_BEGIN_NAMESPACE namespace QtWaylandClient { +Q_LOGGING_CATEGORY(lcQpaWaylandInput, "qt.qpa.wayland.input"); + QWaylandInputDevice::Keyboard::Keyboard(QWaylandInputDevice *p) : mParent(p) { @@ -200,10 +202,10 @@ QWaylandInputDevice::Touch::~Touch() } QWaylandInputDevice::QWaylandInputDevice(QWaylandDisplay *display, int version, uint32_t id) - : QtWayland::wl_seat(display->wl_registry(), id, qMin(version, 4)) + : QtWayland::wl_seat(display->wl_registry(), id, qMin(version, 5)) , mQDisplay(display) , mDisplay(display->wl_display()) - , mVersion(qMin(version, 4)) + , mVersion(qMin(version, 5)) { #if QT_CONFIG(wayland_datadevice) if (mQDisplay->dndSelectionHandler()) { @@ -446,8 +448,9 @@ void QWaylandInputDevice::setCursor(const QSharedPointer &buffer class EnterEvent : public QWaylandPointerEvent { public: - EnterEvent(const QPointF &l, const QPointF &g) - : QWaylandPointerEvent(QWaylandPointerEvent::Enter, 0, l, g, nullptr, Qt::NoModifier) + EnterEvent(QWaylandWindow *surface, const QPointF &local, const QPointF &global) + : QWaylandPointerEvent(QWaylandPointerEvent::Enter, Qt::NoScrollPhase, surface, 0, + local, global, nullptr, Qt::NoModifier) {} }; @@ -471,12 +474,19 @@ void QWaylandInputDevice::Pointer::pointer_enter(uint32_t serial, struct wl_surf #endif QWaylandWindow *grab = QWaylandWindow::mouseGrab(); - if (!grab) { - EnterEvent evt(mSurfacePos, mGlobalPos); - window->handleMouse(mParent, evt); - } + if (!grab) + setFrameEvent(new EnterEvent(window, mSurfacePos, mGlobalPos)); } +class LeaveEvent : public QWaylandPointerEvent +{ +public: + LeaveEvent(QWaylandWindow *surface, const QPointF &localPos, const QPointF &globalPos) + : QWaylandPointerEvent(QWaylandPointerEvent::Leave, Qt::NoScrollPhase, surface, 0, + localPos, globalPos, nullptr, Qt::NoModifier) + {} +}; + void QWaylandInputDevice::Pointer::pointer_leave(uint32_t time, struct wl_surface *surface) { // The event may arrive after destroying the window, indicated by @@ -486,7 +496,7 @@ void QWaylandInputDevice::Pointer::pointer_leave(uint32_t time, struct wl_surfac if (!QWaylandWindow::mouseGrab()) { QWaylandWindow *window = QWaylandWindow::fromWlSurface(surface); - window->handleMouseLeave(mParent); + setFrameEvent(new LeaveEvent(window, mSurfacePos, mGlobalPos)); } mFocus = nullptr; mButtons = Qt::NoButton; @@ -497,8 +507,10 @@ void QWaylandInputDevice::Pointer::pointer_leave(uint32_t time, struct wl_surfac class MotionEvent : public QWaylandPointerEvent { public: - MotionEvent(ulong t, const QPointF &l, const QPointF &g, Qt::MouseButtons b, Qt::KeyboardModifiers m) - : QWaylandPointerEvent(QWaylandPointerEvent::Motion, t, l, g, b, m) + MotionEvent(QWaylandWindow *surface, ulong timestamp, const QPointF &localPos, + const QPointF &globalPos, Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers) + : QWaylandPointerEvent(QWaylandPointerEvent::Motion, Qt::NoScrollPhase, surface, + timestamp, localPos, globalPos, buttons, modifiers) { } }; @@ -527,14 +539,33 @@ void QWaylandInputDevice::Pointer::pointer_motion(uint32_t time, wl_fixed_t surf // so we just set it outside of the window boundaries. pos = QPointF(-1, -1); global = grab->window()->mapToGlobal(pos.toPoint()); - MotionEvent e(time, pos, global, mButtons, mParent->modifiers()); - grab->handleMouse(mParent, e); - } else { - MotionEvent e(time, mSurfacePos, mGlobalPos, mButtons, mParent->modifiers()); - window->handleMouse(mParent, e); + window = grab; } + setFrameEvent(new MotionEvent(window, time, pos, global, mButtons, mParent->modifiers())); } +class PressEvent : public QWaylandPointerEvent +{ +public: + PressEvent(QWaylandWindow *surface, ulong timestamp, const QPointF &localPos, + const QPointF &globalPos, Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers) + : QWaylandPointerEvent(QWaylandPointerEvent::Press, Qt::NoScrollPhase, surface, + timestamp, localPos, globalPos, buttons, modifiers) + { + } +}; + +class ReleaseEvent : public QWaylandPointerEvent +{ +public: + ReleaseEvent(QWaylandWindow *surface, ulong timestamp, const QPointF &localPos, + const QPointF &globalPos, Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers) + : QWaylandPointerEvent(QWaylandPointerEvent::Release, Qt::NoScrollPhase, surface, + timestamp, localPos, globalPos, buttons, modifiers) + { + } +}; + void QWaylandInputDevice::Pointer::pointer_button(uint32_t serial, uint32_t time, uint32_t button, uint32_t state) { @@ -580,21 +611,26 @@ void QWaylandInputDevice::Pointer::pointer_button(uint32_t serial, uint32_t time mParent->mQDisplay->setLastInputDevice(mParent, serial, window); QWaylandWindow *grab = QWaylandWindow::mouseGrab(); + + QPointF pos = mSurfacePos; + QPointF global = mGlobalPos; if (grab && grab != mFocus) { - QPointF pos = QPointF(-1, -1); - QPointF global = grab->window()->mapToGlobal(pos.toPoint()); - MotionEvent e(time, pos, global, mButtons, mParent->modifiers()); - grab->handleMouse(mParent, e); - } else if (window) { - MotionEvent e(time, mSurfacePos, mGlobalPos, mButtons, mParent->modifiers()); - window->handleMouse(mParent, e); + pos = QPointF(-1, -1); + global = grab->window()->mapToGlobal(pos.toPoint()); + + window = grab; } + + if (state) + setFrameEvent(new PressEvent(window, time, pos, global, mButtons, mParent->modifiers())); + else + setFrameEvent(new ReleaseEvent(window, time, pos, global, mButtons, mParent->modifiers())); } void QWaylandInputDevice::Pointer::releaseButtons() { mButtons = Qt::NoButton; - MotionEvent e(mParent->mTime, mSurfacePos, mGlobalPos, mButtons, mParent->modifiers()); + MotionEvent e(mFocus, mParent->mTime, mSurfacePos, mGlobalPos, mButtons, mParent->modifiers()); if (mFocus) mFocus->handleMouse(mParent, e); } @@ -602,8 +638,11 @@ void QWaylandInputDevice::Pointer::releaseButtons() class WheelEvent : public QWaylandPointerEvent { public: - WheelEvent(ulong t, const QPointF &l, const QPointF &g, const QPoint &pd, const QPoint &ad, Qt::KeyboardModifiers m) - : QWaylandPointerEvent(QWaylandPointerEvent::Wheel, t, l, g, pd, ad, m) + WheelEvent(QWaylandWindow *surface, Qt::ScrollPhase phase, ulong timestamp, const QPointF &local, + const QPointF &global, const QPoint &pixelDelta, const QPoint &angleDelta, + Qt::MouseEventSource source, Qt::KeyboardModifiers modifiers) + : QWaylandPointerEvent(QWaylandPointerEvent::Wheel, phase, surface, timestamp, + local, global, pixelDelta, angleDelta, source, modifiers) { } }; @@ -611,28 +650,247 @@ public: void QWaylandInputDevice::Pointer::pointer_axis(uint32_t time, uint32_t axis, int32_t value) { QWaylandWindow *window = mFocus; + if (!window) { // We destroyed the pointer focus surface, but the server didn't get the message yet... // or the server didn't send an enter event first. In either case, ignore the event. return; } - QPoint pixelDelta; - QPoint angleDelta; - - //normalize value and inverse axis - int valueDelta = wl_fixed_to_int(value) * -12; - - if (axis == WL_POINTER_AXIS_HORIZONTAL_SCROLL) { - pixelDelta = QPoint(); - angleDelta.setX(valueDelta); - } else { - pixelDelta = QPoint(); - angleDelta.setY(valueDelta); + // Get the delta and convert it into the expected range + switch (axis) { + case WL_POINTER_AXIS_VERTICAL_SCROLL: + mFrameData.delta.ry() += wl_fixed_to_double(value); + qCDebug(lcQpaWaylandInput) << "wl_pointer.axis vertical:" << mFrameData.delta.y(); + break; + case WL_POINTER_AXIS_HORIZONTAL_SCROLL: + mFrameData.delta.rx() += wl_fixed_to_double(value); + qCDebug(lcQpaWaylandInput) << "wl_pointer.axis horizontal:" << mFrameData.delta.x(); + break; + default: + //TODO: is this really needed? + qCWarning(lcQpaWaylandInput) << "wl_pointer.axis: Unknown axis:" << axis; + return; } - WheelEvent e(time, mSurfacePos, mGlobalPos, pixelDelta, angleDelta, mParent->modifiers()); - window->handleMouse(mParent, e); + mParent->mTime = time; + + if (mParent->mVersion < WL_POINTER_FRAME_SINCE_VERSION) { + qCDebug(lcQpaWaylandInput) << "Flushing new event; no frame event in this version"; + flushFrameEvent(); + } +} + +void QWaylandInputDevice::Pointer::pointer_frame() +{ + flushFrameEvent(); +} + +void QWaylandInputDevice::Pointer::pointer_axis_source(uint32_t source) +{ + switch (source) { + case axis_source_wheel: + qCDebug(lcQpaWaylandInput) << "Axis source wheel"; + break; + case axis_source_finger: + qCDebug(lcQpaWaylandInput) << "Axis source finger"; + break; + case axis_source_continuous: + qCDebug(lcQpaWaylandInput) << "Axis source continuous"; + break; + } + mFrameData.axisSource = axis_source(source); +} + +void QWaylandInputDevice::Pointer::pointer_axis_stop(uint32_t time, uint32_t axis) +{ + QWaylandWindow *window = mFocus; + if (window == nullptr) + return; + + mParent->mTime = time; + switch (axis) { + case axis_vertical_scroll: + qCDebug(lcQpaWaylandInput) << "Received vertical wl_pointer.axis_stop"; + mFrameData.delta.setY(0); //TODO: what's the point of doing this? + break; + case axis_horizontal_scroll: + qCDebug(lcQpaWaylandInput) << "Received horizontal wl_pointer.axis_stop"; + mFrameData.delta.setX(0); + break; + default: + qCWarning(lcQpaWaylandInput) << "wl_pointer.axis_stop: Unknown axis: " << axis + << "This is most likely a compositor bug"; + return; + } + + // May receive axis_stop for events we haven't sent a ScrollBegin for because + // most axis_sources do not mandate an axis_stop event to be sent. + if (!mScrollBeginSent) { + // TODO: For now, we just ignore these events, but we could perhaps take this as an + // indication that this compositor will in fact send axis_stop events for these sources + // and send a ScrollBegin the next time an axis_source event with this type is encountered. + return; + } + + QWaylandWindow *target = QWaylandWindow::mouseGrab(); + if (!target) + target = mFocus; + Qt::KeyboardModifiers mods = mParent->modifiers(); + WheelEvent wheelEvent(mFocus, Qt::ScrollEnd, mParent->mTime, mSurfacePos, mGlobalPos, + QPoint(), QPoint(), Qt::MouseEventNotSynthesized, mods); + target->handleMouse(mParent, wheelEvent); + mScrollBeginSent = false; + mScrollDeltaRemainder = QPointF(); +} + +void QWaylandInputDevice::Pointer::pointer_axis_discrete(uint32_t axis, int32_t value) +{ + QWaylandWindow *window = mFocus; + if (window == nullptr) + return; + + switch (axis) { + case axis_vertical_scroll: + qCDebug(lcQpaWaylandInput) << "wl_pointer.axis_discrete vertical:" << value; + mFrameData.discreteDelta.ry() += value; + break; + case axis_horizontal_scroll: + qCDebug(lcQpaWaylandInput) << "wl_pointer.axis_discrete horizontal:" << value; + mFrameData.discreteDelta.rx() += value; + break; + default: + //TODO: is this really needed? + qCWarning(lcQpaWaylandInput) << "wl_pointer.axis_discrete: Unknown axis:" << axis; + return; + } +} + +void QWaylandInputDevice::Pointer::setFrameEvent(QWaylandPointerEvent *event) +{ + qCDebug(lcQpaWaylandInput) << "Setting frame event " << event->type; + if (mFrameData.event && mFrameData.event->type != event->type) { + qCDebug(lcQpaWaylandInput) << "Flushing; previous was " << mFrameData.event->type; + flushFrameEvent(); + } + + mFrameData.event = event; + + if (mParent->mVersion < WL_POINTER_FRAME_SINCE_VERSION) { + qCDebug(lcQpaWaylandInput) << "Flushing new event; no frame event in this version"; + flushFrameEvent(); + } +} + +void QWaylandInputDevice::Pointer::FrameData::resetScrollData() +{ + discreteDelta = QPoint(); + delta = QPointF(); + axisSource = axis_source_wheel; +} + +bool QWaylandInputDevice::Pointer::FrameData::hasPixelDelta() const +{ + switch (axisSource) { + case axis_source_wheel_tilt: // sideways tilt of the wheel + case axis_source_wheel: + // In the case of wheel events, a pixel delta doesn't really make sense, + // and will make Qt think this is a continuous scroll event when it isn't, + // so just ignore it. + return false; + case axis_source_finger: + case axis_source_continuous: + return !delta.isNull(); + } +} + +QPoint QWaylandInputDevice::Pointer::FrameData::pixelDeltaAndError(QPointF *accumulatedError) const +{ + if (!hasPixelDelta()) + return QPoint(); + + Q_ASSERT(accumulatedError); + // Add accumulated rounding error before rounding again + QPoint pixelDelta = (delta + *accumulatedError).toPoint(); + *accumulatedError += delta - pixelDelta; + Q_ASSERT(qAbs(accumulatedError->x()) < 1.0); + Q_ASSERT(qAbs(accumulatedError->y()) < 1.0); + return pixelDelta; +} + +QPoint QWaylandInputDevice::Pointer::FrameData::angleDelta() const +{ + if (discreteDelta.isNull()) { + // If we didn't get any discrete events, then we need to fall back to + // the continuous information. + return (delta * -12).toPoint(); //TODO: why multiply by 12? + } + + // The angle delta is in eights of degrees, and our docs says most mice have + // 1 click = 15 degrees. It's also in the opposite direction of surface space. + return -discreteDelta * 15 * 8; +} + +Qt::MouseEventSource QWaylandInputDevice::Pointer::FrameData::wheelEventSource() const +{ + switch (axisSource) { + case axis_source_wheel_tilt: // sideways tilt of the wheel + case axis_source_wheel: + return Qt::MouseEventNotSynthesized; + case axis_source_finger: + case axis_source_continuous: + default: // Whatever other sources might be added are probably not mouse wheels + return Qt::MouseEventSynthesizedBySystem; + } +} + +void QWaylandInputDevice::Pointer::flushScrollEvent() +{ + QPoint angleDelta = mFrameData.angleDelta(); + + // Angle delta is required for Qt wheel events, so don't try to send events if it's zero + if (!angleDelta.isNull()) { + QWaylandWindow *target = QWaylandWindow::mouseGrab(); + if (!target) + target = mFocus; + + if (isDefinitelyTerminated(mFrameData.axisSource) && !mScrollBeginSent) { + qCDebug(lcQpaWaylandInput) << "Flushing scroll event sending ScrollBegin"; + target->handleMouse(mParent, WheelEvent(mFocus, Qt::ScrollBegin, mParent->mTime, + mSurfacePos, mGlobalPos, QPoint(), QPoint(), + Qt::MouseEventNotSynthesized, + mParent->modifiers())); + mScrollBeginSent = true; + mScrollDeltaRemainder = QPointF(); + } + + Qt::ScrollPhase phase = mScrollBeginSent ? Qt::ScrollUpdate : Qt::NoScrollPhase; + QPoint pixelDelta = mFrameData.pixelDeltaAndError(&mScrollDeltaRemainder); + Qt::MouseEventSource source = mFrameData.wheelEventSource(); + + qCDebug(lcQpaWaylandInput) << "Flushing scroll event" << phase << pixelDelta << angleDelta; + target->handleMouse(mParent, WheelEvent(mFocus, phase, mParent->mTime, mSurfacePos, mGlobalPos, + pixelDelta, angleDelta, source, mParent->modifiers())); + } + + mFrameData.resetScrollData(); +} + +void QWaylandInputDevice::Pointer::flushFrameEvent() +{ + if (mFrameData.event) { + mFrameData.event->surface->handleMouse(mParent, *mFrameData.event); + delete mFrameData.event; + mFrameData.event = nullptr; + } + + //TODO: do modifiers get passed correctly here? + flushScrollEvent(); +} + +bool QWaylandInputDevice::Pointer::isDefinitelyTerminated(QtWayland::wl_pointer::axis_source source) const +{ + return source == axis_source_finger; } void QWaylandInputDevice::Keyboard::keyboard_keymap(uint32_t format, int32_t fd, uint32_t size) diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h index c2fd57bb0df..0da73e5d59e 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h +++ b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h @@ -262,6 +262,10 @@ public: void pointer_axis(uint32_t time, uint32_t axis, wl_fixed_t value) override; + void pointer_axis_source(uint32_t source) override; + void pointer_axis_stop(uint32_t time, uint32_t axis) override; + void pointer_axis_discrete(uint32_t axis, int32_t value) override; + void pointer_frame() override; void releaseButtons(); @@ -278,6 +282,30 @@ public: wl_buffer *mCursorBuffer = nullptr; Qt::CursorShape mCursorShape = Qt::BitmapCursor; #endif + + struct FrameData { + QWaylandPointerEvent *event = nullptr; + + QPointF delta; + QPoint discreteDelta; + axis_source axisSource = axis_source_wheel; + + void resetScrollData(); + bool hasPixelDelta() const; + QPoint pixelDeltaAndError(QPointF *accumulatedError) const; + QPoint pixelDelta() const { return hasPixelDelta() ? delta.toPoint() : QPoint(); } + QPoint angleDelta() const; + Qt::MouseEventSource wheelEventSource() const; + } mFrameData; + + bool mScrollBeginSent = false; + QPointF mScrollDeltaRemainder; + + void setFrameEvent(QWaylandPointerEvent *event); + void flushScrollEvent(); + void flushFrameEvent(); +private: //TODO: should other methods be private as well? + bool isDefinitelyTerminated(axis_source source) const; }; class Q_WAYLAND_CLIENT_EXPORT QWaylandInputDevice::Touch : public QtWayland::wl_touch @@ -313,38 +341,58 @@ public: class QWaylandPointerEvent { + Q_GADGET public: enum Type { Enter, + Leave, Motion, + Press, + Release, Wheel }; - inline QWaylandPointerEvent(Type t, ulong ts, const QPointF &l, const QPointF &g, Qt::MouseButtons b, Qt::KeyboardModifiers m) - : type(t) - , timestamp(ts) - , local(l) - , global(g) - , buttons(b) - , modifiers(m) + Q_ENUM(Type) + + inline QWaylandPointerEvent(Type type, Qt::ScrollPhase phase, QWaylandWindow *surface, + ulong timestamp, const QPointF &localPos, const QPointF &globalPos, + Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers) + : type(type) + , phase(phase) + , timestamp(timestamp) + , local(localPos) + , global(globalPos) + , buttons(buttons) + , modifiers(modifiers) + , surface(surface) {} - inline QWaylandPointerEvent(Type t, ulong ts, const QPointF &l, const QPointF &g, const QPoint &pd, const QPoint &ad, Qt::KeyboardModifiers m) - : type(t) - , timestamp(ts) - , local(l) - , global(g) - , modifiers(m) - , pixelDelta(pd) - , angleDelta(ad) + inline QWaylandPointerEvent(Type type, Qt::ScrollPhase phase, QWaylandWindow *surface, + ulong timestamp, const QPointF &local, const QPointF &global, + const QPoint &pixelDelta, const QPoint &angleDelta, + Qt::MouseEventSource source, + Qt::KeyboardModifiers modifiers) + : type(type) + , phase(phase) + , timestamp(timestamp) + , local(local) + , global(global) + , modifiers(modifiers) + , pixelDelta(pixelDelta) + , angleDelta(angleDelta) + , source(source) + , surface(surface) {} Type type; - ulong timestamp; + Qt::ScrollPhase phase = Qt::NoScrollPhase; + ulong timestamp = 0; QPointF local; QPointF global; Qt::MouseButtons buttons; Qt::KeyboardModifiers modifiers; QPoint pixelDelta; QPoint angleDelta; + Qt::MouseEventSource source = Qt::MouseEventNotSynthesized; + QWaylandWindow *surface = nullptr; }; } diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 9e95b306867..abbea6291bd 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -846,6 +846,18 @@ QWaylandWindow *QWaylandWindow::transientParent() const void QWaylandWindow::handleMouse(QWaylandInputDevice *inputDevice, const QWaylandPointerEvent &e) { + if (e.type == QWaylandPointerEvent::Leave) { + if (mWindowDecoration) { + if (mMouseEventsInContentArea) + QWindowSystemInterface::handleLeaveEvent(window()); + } else { + QWindowSystemInterface::handleLeaveEvent(window()); + } +#if QT_CONFIG(cursor) + restoreMouseCursor(inputDevice); +#endif + return; + } if (mWindowDecoration) { handleMouseEventWithDecoration(inputDevice, e); @@ -854,11 +866,15 @@ void QWaylandWindow::handleMouse(QWaylandInputDevice *inputDevice, const QWaylan case QWaylandPointerEvent::Enter: QWindowSystemInterface::handleEnterEvent(window(), e.local, e.global); break; + case QWaylandPointerEvent::Press: + case QWaylandPointerEvent::Release: case QWaylandPointerEvent::Motion: QWindowSystemInterface::handleMouseEvent(window(), e.timestamp, e.local, e.global, e.buttons, e.modifiers); break; case QWaylandPointerEvent::Wheel: - QWindowSystemInterface::handleWheelEvent(window(), e.timestamp, e.local, e.global, e.pixelDelta, e.angleDelta, e.modifiers); + QWindowSystemInterface::handleWheelEvent(window(), e.timestamp, e.local, e.global, + e.pixelDelta, e.angleDelta, e.modifiers, + e.phase, e.source, false); break; } } @@ -872,20 +888,6 @@ void QWaylandWindow::handleMouse(QWaylandInputDevice *inputDevice, const QWaylan #endif } -void QWaylandWindow::handleMouseLeave(QWaylandInputDevice *inputDevice) -{ - if (mWindowDecoration) { - if (mMouseEventsInContentArea) { - QWindowSystemInterface::handleLeaveEvent(window()); - } - } else { - QWindowSystemInterface::handleLeaveEvent(window()); - } -#if QT_CONFIG(cursor) - restoreMouseCursor(inputDevice); -#endif -} - bool QWaylandWindow::touchDragDecoration(QWaylandInputDevice *inputDevice, const QPointF &local, const QPointF &global, Qt::TouchPointState state, Qt::KeyboardModifiers mods) { if (!mWindowDecoration) @@ -927,12 +929,18 @@ void QWaylandWindow::handleMouseEventWithDecoration(QWaylandInputDevice *inputDe case QWaylandPointerEvent::Enter: QWindowSystemInterface::handleEnterEvent(window(), localTranslated, globalTranslated); break; + case QWaylandPointerEvent::Press: + case QWaylandPointerEvent::Release: case QWaylandPointerEvent::Motion: QWindowSystemInterface::handleMouseEvent(window(), e.timestamp, localTranslated, globalTranslated, e.buttons, e.modifiers); break; - case QWaylandPointerEvent::Wheel: - QWindowSystemInterface::handleWheelEvent(window(), e.timestamp, localTranslated, globalTranslated, e.pixelDelta, e.angleDelta, e.modifiers); + case QWaylandPointerEvent::Wheel: { + QWindowSystemInterface::handleWheelEvent(window(), e.timestamp, + localTranslated, globalTranslated, + e.pixelDelta, e.angleDelta, e.modifiers, + e.phase, e.source, false); break; + } } mMouseEventsInContentArea = true; diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index 0e573f350eb..19c71627b56 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -158,7 +158,6 @@ public: QWaylandAbstractDecoration *decoration() const; void handleMouse(QWaylandInputDevice *inputDevice, const QWaylandPointerEvent &e); - void handleMouseLeave(QWaylandInputDevice *inputDevice); bool touchDragDecoration(QWaylandInputDevice *inputDevice, const QPointF &local, const QPointF &global, Qt::TouchPointState state, Qt::KeyboardModifiers mods); diff --git a/tests/auto/wayland/client.pro b/tests/auto/wayland/client.pro index e99db20ba4f..97d99bd3248 100644 --- a/tests/auto/wayland/client.pro +++ b/tests/auto/wayland/client.pro @@ -7,6 +7,7 @@ SUBDIRS += \ iviapplication \ output \ seatv4 \ + seatv5 \ surface \ wl_connect \ xdgoutput \ diff --git a/tests/auto/wayland/seatv5/seatv5.pro b/tests/auto/wayland/seatv5/seatv5.pro new file mode 100644 index 00000000000..2081845efa8 --- /dev/null +++ b/tests/auto/wayland/seatv5/seatv5.pro @@ -0,0 +1,4 @@ +include (../shared/shared.pri) + +TARGET = tst_seatv5 +SOURCES += tst_seatv5.cpp diff --git a/tests/auto/wayland/seatv5/tst_seatv5.cpp b/tests/auto/wayland/seatv5/tst_seatv5.cpp new file mode 100644 index 00000000000..5b9235d9aa3 --- /dev/null +++ b/tests/auto/wayland/seatv5/tst_seatv5.cpp @@ -0,0 +1,387 @@ +/**************************************************************************** +** +** Copyright (C) 2018 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "mockcompositor.h" +#include +#include + +using namespace MockCompositor; + +class SeatV5Compositor : public DefaultCompositor { +public: + explicit SeatV5Compositor() + { + exec([this] { + m_config.autoConfigure = true; + + removeAll(); + + uint capabilities = MockCompositor::Seat::capability_pointer; + int version = 5; + add(capabilities, version); + }); + } + + Pointer *pointer() + { + auto *seat = get(); + Q_ASSERT(seat); + return seat->m_pointer; + } +}; + +class tst_seatv5 : public QObject, private SeatV5Compositor +{ + Q_OBJECT +private slots: + void cleanup() { QTRY_VERIFY2(isClean(), qPrintable(dirtyMessage())); } + void bindsToSeat(); + void createsPointer(); + void setsCursorOnEnter(); + void usesEnterSerial(); + void simpleAxis_data(); + void simpleAxis(); + void fingerScroll(); + void fingerScrollSlow(); + void wheelDiscreteScroll(); +}; + +void tst_seatv5::bindsToSeat() +{ + QCOMPOSITOR_COMPARE(get()->resourceMap().size(), 1); + QCOMPOSITOR_COMPARE(get()->resourceMap().first()->version(), 5); +} + +void tst_seatv5::createsPointer() +{ + QCOMPOSITOR_TRY_COMPARE(pointer()->resourceMap().size(), 1); + QCOMPOSITOR_TRY_COMPARE(pointer()->resourceMap().first()->version(), 5); +} + +void tst_seatv5::setsCursorOnEnter() +{ + QRasterWindow window; + window.resize(64, 64); + window.show(); + QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial); + + exec([=] { + auto *surface = xdgSurface()->m_surface; + pointer()->sendEnter(surface, {0, 0}); + pointer()->sendFrame(surface->resource()->client()); + }); + + QCOMPOSITOR_TRY_VERIFY(pointer()->cursorSurface()); +} + +void tst_seatv5::usesEnterSerial() +{ + QSignalSpy setCursorSpy(exec([=] { return pointer(); }), &Pointer::setCursor); + QRasterWindow window; + window.resize(64, 64); + window.show(); + QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial); + + uint enterSerial = exec([=] { + return pointer()->sendEnter(xdgSurface()->m_surface, {0, 0}); + }); + QCOMPOSITOR_TRY_VERIFY(pointer()->cursorSurface()); + + QTRY_COMPARE(setCursorSpy.count(), 1); + QCOMPARE(setCursorSpy.takeFirst().at(0).toUInt(), enterSerial); +} + +class WheelWindow : QRasterWindow { +public: + WheelWindow() + { + resize(64, 64); + show(); + } + void wheelEvent(QWheelEvent *event) override + { + QRasterWindow::wheelEvent(event); +// qDebug() << event << "angleDelta" << event->angleDelta() << "pixelDelta" << event->pixelDelta(); + + if (event->phase() == Qt::ScrollUpdate || event->phase() == Qt::NoScrollPhase) { + // Angle delta should always be provided (says docs, but QPA sends compatibility events + // for Qt4 with zero angleDelta, and with a delta) + QVERIFY(!event->angleDelta().isNull() || event->delta()); + } else { + // Shouldn't have deltas in the other phases + QCOMPARE(event->angleDelta(), QPoint(0, 0)); + QCOMPARE(event->pixelDelta(), QPoint(0, 0)); + } + + // The axis vector of the event is already in surface space, so there is now way to tell + // whether it is inverted or not. + QCOMPARE(event->inverted(), false); + + // We didn't press any buttons + QCOMPARE(event->buttons(), Qt::NoButton); + + if (!event->angleDelta().isNull()) { + if (event->orientation() == Qt::Horizontal) + QCOMPARE(event->delta(), event->angleDelta().x()); + else + QCOMPARE(event->delta(), event->angleDelta().y()); + } + + m_events.append(Event{event}); + } + struct Event // Because I didn't find a convenient way to copy it entirely + { + explicit Event() = default; + explicit Event(const QWheelEvent *event) + : phase(event->phase()) + , pixelDelta(event->pixelDelta()) + , angleDelta(event->angleDelta()) + , orientation(event->orientation()) + , source(event->source()) + { + } + const Qt::ScrollPhase phase{}; + const QPoint pixelDelta; + const QPoint angleDelta; // eights of a degree, positive is upwards, left + const Qt::Orientation orientation{}; + const Qt::MouseEventSource source{}; + }; + QVector m_events; +}; + +void tst_seatv5::simpleAxis_data() +{ + QTest::addColumn("axis"); + QTest::addColumn("value"); + QTest::addColumn("orientation"); + QTest::addColumn("angleDelta"); + + // Directions in regular windows/linux terms (no "natural" scrolling) + QTest::newRow("down") << uint(Pointer::axis_vertical_scroll) << 1.0 << Qt::Vertical << QPoint{0, -12}; + QTest::newRow("up") << uint(Pointer::axis_vertical_scroll) << -1.0 << Qt::Vertical << QPoint{0, 12}; + QTest::newRow("left") << uint(Pointer::axis_horizontal_scroll) << 1.0 << Qt::Horizontal << QPoint{-12, 0}; + QTest::newRow("right") << uint(Pointer::axis_horizontal_scroll) << -1.0 << Qt::Horizontal << QPoint{12, 0}; + QTest::newRow("up big") << uint(Pointer::axis_vertical_scroll) << -10.0 << Qt::Vertical << QPoint{0, 120}; +} + +void tst_seatv5::simpleAxis() +{ + QFETCH(uint, axis); + QFETCH(qreal, value); + QFETCH(Qt::Orientation, orientation); + QFETCH(QPoint, angleDelta); + + WheelWindow window; + QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial); + + exec([=] { + auto *p = pointer(); + p->sendEnter(xdgToplevel()->surface(), {32, 32}); + p->sendFrame(client()); + p->sendAxis( + client(), + Pointer::axis(axis), + value // Length of vector in surface-local space. i.e. positive is downwards + ); + p->sendFrame(client()); + }); + + QTRY_VERIFY(!window.m_events.empty()); + { + auto e = window.m_events.takeFirst(); + QCOMPARE(e.phase, Qt::NoScrollPhase); + // Pixel delta should only be set if we know it's a high-res input device (which we don't) + QCOMPARE(e.pixelDelta, QPoint(0, 0)); + // There has been no information about what created the event. + // Documentation says not synthesized is appropriate in such cases + QCOMPARE(e.source, Qt::MouseEventNotSynthesized); + QCOMPARE(e.orientation, orientation); + QCOMPARE(e.angleDelta, angleDelta); + } + + // Sending axis_stop is not mandatory when axis source != finger +} + +void tst_seatv5::fingerScroll() +{ + WheelWindow window; + QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial); + + exec([=] { + auto *p = pointer(); + auto *c = client(); + p->sendEnter(xdgToplevel()->surface(), {32, 32}); + p->sendFrame(c); + p->sendAxisSource(c, Pointer::axis_source_finger); + p->sendAxis(c, Pointer::axis_vertical_scroll, 10); + p->sendFrame(c); + }); + + QTRY_VERIFY(!window.m_events.empty()); + { + auto e = window.m_events.takeFirst(); + QCOMPARE(e.phase, Qt::ScrollBegin); + QCOMPARE(e.angleDelta, QPoint()); + QCOMPARE(e.pixelDelta, QPoint()); + } + + QTRY_VERIFY(!window.m_events.empty()); + // For some reason we send two ScrollBegins, one for each direction, not sure if this is really + // necessary, (could be removed from QtBase, hence the conditional below. + if (window.m_events.first().phase == Qt::ScrollBegin) { + auto e = window.m_events.takeFirst(); + QCOMPARE(e.angleDelta, QPoint()); + QCOMPARE(e.pixelDelta, QPoint()); + } + + QTRY_VERIFY(!window.m_events.empty()); + { + auto e = window.m_events.takeFirst(); + QCOMPARE(e.phase, Qt::ScrollUpdate); + QCOMPARE(e.orientation, Qt::Vertical); +// QCOMPARE(e.angleDelta, angleDelta); // TODO: what should this be? + QCOMPARE(e.pixelDelta, QPoint(0, 10)); + QCOMPARE(e.source, Qt::MouseEventSynthesizedBySystem); // A finger is not a wheel + } + + QTRY_VERIFY(window.m_events.empty()); + + // Scroll horizontally as well + exec([=] { + pointer()->sendAxisSource(client(), Pointer::axis_source_finger); + pointer()->sendAxis(client(), Pointer::axis_horizontal_scroll, 10); + pointer()->sendFrame(client()); + }); + QTRY_VERIFY(!window.m_events.empty()); + { + auto e = window.m_events.takeFirst(); + QCOMPARE(e.phase, Qt::ScrollUpdate); + QCOMPARE(e.orientation, Qt::Horizontal); + QCOMPARE(e.pixelDelta, QPoint(10, 0)); + QCOMPARE(e.source, Qt::MouseEventSynthesizedBySystem); // A finger is not a wheel + } + + // Scroll diagonally + exec([=] { + pointer()->sendAxisSource(client(), Pointer::axis_source_finger); + pointer()->sendAxis(client(), Pointer::axis_horizontal_scroll, 10); + pointer()->sendAxis(client(), Pointer::axis_vertical_scroll, 10); + pointer()->sendFrame(client()); + }); + QTRY_VERIFY(!window.m_events.empty()); + { + auto e = window.m_events.takeFirst(); + QCOMPARE(e.phase, Qt::ScrollUpdate); + QCOMPARE(e.pixelDelta, QPoint(10, 10)); + QCOMPARE(e.source, Qt::MouseEventSynthesizedBySystem); // A finger is not a wheel + } + + // For diagonal events, Qt sends an additional compatibility ScrollUpdate event + if (window.m_events.first().phase == Qt::ScrollUpdate) { + auto e = window.m_events.takeFirst(); + QCOMPARE(e.angleDelta, QPoint()); + QCOMPARE(e.pixelDelta, QPoint()); + } + + QVERIFY(window.m_events.empty()); + + // Sending axis_stop is mandatory when axis source == finger + exec([=] { + pointer()->sendAxisStop(client(), Pointer::axis_vertical_scroll); + pointer()->sendFrame(client()); + }); + + QTRY_VERIFY(!window.m_events.empty()); + { + auto e = window.m_events.takeFirst(); + QCOMPARE(e.phase, Qt::ScrollEnd); + } +} + + +void tst_seatv5::fingerScrollSlow() +{ + WheelWindow window; + QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial); + + exec([=] { + auto *p = pointer(); + auto *c = client(); + p->sendEnter(xdgToplevel()->surface(), {32, 32}); + p->sendFrame(c); + // Send 10 really small updates + for (int i = 0; i < 10; ++i) { + p->sendAxisSource(c, Pointer::axis_source_finger); + p->sendAxis(c, Pointer::axis_vertical_scroll, 0.1); + p->sendFrame(c); + } + p->sendAxisStop(c, Pointer::axis_vertical_scroll); + p->sendFrame(c); + }); + + QTRY_VERIFY(!window.m_events.empty()); + QPoint accumulated; + while (window.m_events.first().phase != Qt::ScrollEnd) { + auto e = window.m_events.takeFirst(); + accumulated += e.pixelDelta; + QTRY_VERIFY(!window.m_events.empty()); + } + QCOMPARE(accumulated.y(), 1); +} +void tst_seatv5::wheelDiscreteScroll() +{ + WheelWindow window; + QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial); + + exec([=] { + auto *p = pointer(); + auto *c = client(); + p->sendEnter(xdgToplevel()->surface(), {32, 32}); + p->sendFrame(c); + p->sendAxisSource(c, Pointer::axis_source_wheel); + p->sendAxisDiscrete(c, Pointer::axis_vertical_scroll, 1); // 1 click downwards + p->sendAxis(c, Pointer::axis_vertical_scroll, 1.0); + p->sendFrame(c); + }); + + QTRY_VERIFY(!window.m_events.empty()); + { + auto e = window.m_events.takeFirst(); + QCOMPARE(e.phase, Qt::NoScrollPhase); + QCOMPARE(e.orientation, Qt::Vertical); + // According to the docs the angle delta is in eights of a degree and most mice have + // 1 click = 15 degrees. The angle delta should therefore be: + // 15 degrees / (1/8 eights per degrees) = 120 eights of degrees. + QCOMPARE(e.angleDelta, QPoint(0, -120)); + // Click scrolls are not continuous and should not have a pixel delta + QCOMPARE(e.pixelDelta, QPoint(0, 0)); + } +} + +QCOMPOSITOR_TEST_MAIN(tst_seatv5) +#include "tst_seatv5.moc" diff --git a/tests/auto/wayland/shared/coreprotocol.cpp b/tests/auto/wayland/shared/coreprotocol.cpp index 6f51a9793c9..b37f7f29cc5 100644 --- a/tests/auto/wayland/shared/coreprotocol.cpp +++ b/tests/auto/wayland/shared/coreprotocol.cpp @@ -312,6 +312,39 @@ void Pointer::sendAxis(wl_client *client, axis axis, qreal value) send_axis(r->handle, time, axis, val); } +void Pointer::sendAxisDiscrete(wl_client *client, QtWaylandServer::wl_pointer::axis axis, int discrete) +{ + // TODO: assert v5 or newer + const auto pointerResources = resourceMap().values(client); + for (auto *r : pointerResources) + send_axis_discrete(r->handle, axis, discrete); +} + +void Pointer::sendAxisSource(wl_client *client, QtWaylandServer::wl_pointer::axis_source source) +{ + // TODO: assert v5 or newer + const auto pointerResources = resourceMap().values(client); + for (auto *r : pointerResources) + send_axis_source(r->handle, source); +} + +void Pointer::sendAxisStop(wl_client *client, QtWaylandServer::wl_pointer::axis axis) +{ + // TODO: assert v5 or newer + auto time = m_seat->m_compositor->currentTimeMilliseconds(); + const auto pointerResources = resourceMap().values(client); + for (auto *r : pointerResources) + send_axis_stop(r->handle, time, axis); +} + +void Pointer::sendFrame(wl_client *client) +{ + //TODO: assert version 5 or newer? + const auto pointerResources = resourceMap().values(client); + for (auto *r : pointerResources) + send_frame(r->handle); +} + void Pointer::pointer_set_cursor(Resource *resource, uint32_t serial, wl_resource *surface, int32_t hotspot_x, int32_t hotspot_y) { Q_UNUSED(resource); diff --git a/tests/auto/wayland/shared/coreprotocol.h b/tests/auto/wayland/shared/coreprotocol.h index 249c16f428b..94876f15f04 100644 --- a/tests/auto/wayland/shared/coreprotocol.h +++ b/tests/auto/wayland/shared/coreprotocol.h @@ -282,6 +282,10 @@ public: void sendMotion(wl_client *client, const QPointF &position); uint sendButton(wl_client *client, uint button, uint state); void sendAxis(wl_client *client, axis axis, qreal value); + void sendAxisDiscrete(wl_client *client, axis axis, int discrete); + void sendAxisSource(wl_client *client, axis_source source); + void sendAxisStop(wl_client *client, axis axis); + void sendFrame(wl_client *client); Seat *m_seat = nullptr; uint m_enterSerial = 0; From 11e0fc58b6d065d56669ccbb9fe340a500fb466d Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Thu, 14 Mar 2019 09:37:41 +0100 Subject: [PATCH 0665/1507] Client: Fix incorrect damage region for window decorations The previous implementation had gaps in several places. [ChangeLog][QPA plugin] Fixed a bug where the window decoration's damaged area didn't cover the entire decoration. This meant some compositors would not redraw those areas. Change-Id: Ic72663dde301936635b2a1cfa90570a53227e8ea Fixes: QTBUG-74341 Reviewed-by: Paul Olav Tvete Reviewed-by: Pier Luigi Fiorini --- .../wayland/qwaylandabstractdecoration.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandabstractdecoration.cpp b/src/plugins/platforms/wayland/qwaylandabstractdecoration.cpp index 6a8f1d92d92..98a0b17d5e1 100644 --- a/src/plugins/platforms/wayland/qwaylandabstractdecoration.cpp +++ b/src/plugins/platforms/wayland/qwaylandabstractdecoration.cpp @@ -100,14 +100,19 @@ void QWaylandAbstractDecoration::setWaylandWindow(QWaylandWindow *window) d->m_wayland_window = window; } -// \a size is without margins +// Creates regions like this on the outside of a rectangle with inner size \a size +// ----- +// | | +// ----- +// I.e. the top and bottom extends into the corners static QRegion marginsRegion(const QSize &size, const QMargins &margins) { QRegion r; - r += QRect(0, 0, size.width(), margins.top()); // top - r += QRect(0, size.height()+margins.top(), size.width(), margins.bottom()); //bottom - r += QRect(0, 0, margins.left(), size.height()); //left - r += QRect(size.width()+margins.left(), 0, margins.right(), size.height()); // right + const int widthWithMargins = margins.left() + size.width() + margins.right(); + r += QRect(0, 0, widthWithMargins, margins.top()); // top + r += QRect(0, size.height()+margins.top(), widthWithMargins, margins.bottom()); //bottom + r += QRect(0, margins.top(), margins.left(), size.height()); //left + r += QRect(size.width()+margins.left(), margins.top(), margins.right(), size.height()); // right return r; } From d749d553e483a3e1c177574b8d0cd19f0aa23494 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Mon, 11 Mar 2019 14:02:12 +0100 Subject: [PATCH 0666/1507] Client: Make QWaylandWindow's wl_surface inheritance private QWaylandWindow inheriting wl_surface is a leftover from the old days, and today it is sometimes causing great problems. Especially on xdg_shell and other shells where the wl_surface needs to recreated with a different role if the QWindow::type changes. This is currently worked around by calling reset() on the surface, which will destroy the wl_surface, and emit some necessary events and signals. However, much of the rest of the code still assumes that a QWaylandWindow maps directly to a single wl_surface which won't change over the lifetime of the QWaylandWindow. Today, it would make sense to implement this with composition rather than inheritance. This is a major undertaking and so this is the first small step; hide the inheritance in QWaylandWindow's public API. This makes it much more visible when and where the rest of the QPA plugin is using it, so we can eventually move it into its own class later. Task-number: QTBUG-74373 Change-Id: I257729e33c3a5368cef4bb1e16148ba392e65bd2 Reviewed-by: Paul Olav Tvete Reviewed-by: Pier Luigi Fiorini --- .../qwaylandfullscreenshellv1surface.cpp | 2 +- .../wl-shell/qwaylandwlshellintegration.cpp | 2 +- .../wl-shell/qwaylandwlshellsurface.cpp | 19 +++++++++---------- .../xdg-shell-v5/qwaylandxdgshellv5.cpp | 4 ++-- .../xdg-shell-v5/qwaylandxdgsurfacev5.cpp | 2 +- .../xdg-shell-v6/qwaylandxdgshellv6.cpp | 2 +- .../xdg-shell/qwaylandxdgshell.cpp | 2 +- .../platforms/wayland/qwaylanddatadevice.cpp | 2 +- .../platforms/wayland/qwaylanddisplay.cpp | 2 +- .../wayland/qwaylandextendedsurface.cpp | 2 +- .../wayland/qwaylandinputcontext.cpp | 8 ++++---- .../wayland/qwaylandnativeinterface.cpp | 2 +- .../platforms/wayland/qwaylandwindow_p.h | 3 ++- 13 files changed, 26 insertions(+), 26 deletions(-) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/fullscreen-shell-v1/qwaylandfullscreenshellv1surface.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/fullscreen-shell-v1/qwaylandfullscreenshellv1surface.cpp index 9a829f6e9e9..26f598895c3 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/fullscreen-shell-v1/qwaylandfullscreenshellv1surface.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/fullscreen-shell-v1/qwaylandfullscreenshellv1surface.cpp @@ -51,7 +51,7 @@ QWaylandFullScreenShellV1Surface::QWaylandFullScreenShellV1Surface(QtWayland::zw , m_window(window) { auto screen = static_cast(m_window->screen()); - m_shell->present_surface(m_window->object(), + m_shell->present_surface(m_window->wlSurface(), QtWayland::zwp_fullscreen_shell_v1::present_method_default, screen->output()); } diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellintegration.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellintegration.cpp index 1edb24b3c01..f396e840267 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellintegration.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellintegration.cpp @@ -70,7 +70,7 @@ bool QWaylandWlShellIntegration::initialize(QWaylandDisplay *display) QWaylandShellSurface *QWaylandWlShellIntegration::createShellSurface(QWaylandWindow *window) { - return new QWaylandWlShellSurface(m_wlShell->get_shell_surface(window->object()), window); + return new QWaylandWlShellSurface(m_wlShell->get_shell_surface(window->wlSurface()), window); } void *QWaylandWlShellIntegration::nativeResourceForWindow(const QByteArray &resource, QWindow *window) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellsurface.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellsurface.cpp index 4506c312ae4..48e14c753fe 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellsurface.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellsurface.cpp @@ -62,9 +62,9 @@ QWaylandWlShellSurface::QWaylandWlShellSurface(struct ::wl_shell_surface *shell_ Qt::WindowType type = window->window()->type(); auto *transientParent = window->transientParent(); - if (type == Qt::Popup && transientParent && transientParent->object()) + if (type == Qt::Popup && transientParent && transientParent->wlSurface()) setPopup(transientParent, m_window->display()->lastInputDevice(), m_window->display()->lastInputSerial()); - else if (transientParent && transientParent->object()) + else if (transientParent && transientParent->wlSurface()) updateTransientParent(transientParent->window()); else setTopLevel(); @@ -234,11 +234,9 @@ void QWaylandWlShellSurface::updateTransientParent(QWindow *parent) || testShowWithoutActivating(m_window->window())) flags |= WL_SHELL_SURFACE_TRANSIENT_INACTIVE; - Q_ASSERT(parent_wayland_window->object()); - set_transient(parent_wayland_window->object(), - transientPos.x(), - transientPos.y(), - flags); + auto *parentSurface = parent_wayland_window->wlSurface(); + Q_ASSERT(parentSurface); + set_transient(parentSurface, transientPos.x(), transientPos.y(), flags); } void QWaylandWlShellSurface::setPopup(QWaylandWindow *parent, QWaylandInputDevice *device, uint serial) @@ -261,9 +259,10 @@ void QWaylandWlShellSurface::setPopup(QWaylandWindow *parent, QWaylandInputDevic transientPos.setY(transientPos.y() + parent_wayland_window->decoration()->margins().top()); } - Q_ASSERT(parent_wayland_window->object()); - set_popup(device->wl_seat(), serial, parent_wayland_window->object(), - transientPos.x(), transientPos.y(), 0); + auto *parentSurface = parent_wayland_window->wlSurface(); + Q_ASSERT(parentSurface); + uint flags = 0; + set_popup(device->wl_seat(), serial, parentSurface, transientPos.x(), transientPos.y(), flags); } void QWaylandWlShellSurface::shell_surface_ping(uint32_t serial) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshellv5.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshellv5.cpp index 4cbafbd71b5..fa9d0d8cfc9 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshellv5.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshellv5.cpp @@ -71,7 +71,7 @@ QWaylandXdgSurfaceV5 *QWaylandXdgShellV5::createXdgSurface(QWaylandWindow *windo QWaylandXdgPopupV5 *QWaylandXdgShellV5::createXdgPopup(QWaylandWindow *window, QWaylandInputDevice *inputDevice) { QWaylandWindow *parentWindow = m_popups.empty() ? window->transientParent() : m_popups.last(); - ::wl_surface *parentSurface = parentWindow->object(); + ::wl_surface *parentSurface = parentWindow->wlSurface(); if (m_popupSerial == 0) m_popupSerial = inputDevice->serial(); @@ -81,7 +81,7 @@ QWaylandXdgPopupV5 *QWaylandXdgShellV5::createXdgPopup(QWaylandWindow *window, Q int x = position.x() + parentWindow->frameMargins().left(); int y = position.y() + parentWindow->frameMargins().top(); - auto popup = new QWaylandXdgPopupV5(get_xdg_popup(window->object(), parentSurface, seat, m_popupSerial, x, y), window); + auto popup = new QWaylandXdgPopupV5(get_xdg_popup(window->wlSurface(), parentSurface, seat, m_popupSerial, x, y), window); m_popups.append(window); QObject::connect(popup, &QWaylandXdgPopupV5::destroyed, [this, window](){ m_popups.removeOne(window); diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgsurfacev5.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgsurfacev5.cpp index e9f64e2e6cb..e8bff91935e 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgsurfacev5.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgsurfacev5.cpp @@ -54,7 +54,7 @@ namespace QtWaylandClient { QWaylandXdgSurfaceV5::QWaylandXdgSurfaceV5(QWaylandXdgShellV5 *shell, QWaylandWindow *window) : QWaylandShellSurface(window) - , QtWayland::xdg_surface_v5(shell->get_xdg_surface(window->object())) + , QtWayland::xdg_surface_v5(shell->get_xdg_surface(window->wlSurface())) , m_window(window) , m_shell(shell) { diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp index 60540fb0c81..9e2c8e6d24a 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp @@ -418,7 +418,7 @@ QWaylandXdgShellV6::~QWaylandXdgShellV6() QWaylandXdgSurfaceV6 *QWaylandXdgShellV6::getXdgSurface(QWaylandWindow *window) { - return new QWaylandXdgSurfaceV6(this, get_xdg_surface(window->object()), window); + return new QWaylandXdgSurfaceV6(this, get_xdg_surface(window->wlSurface()), window); } void QWaylandXdgShellV6::zxdg_shell_v6_ping(uint32_t serial) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp index 78b7b45c8ab..acce08b5a09 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp @@ -455,7 +455,7 @@ QWaylandXdgShell::~QWaylandXdgShell() QWaylandXdgSurface *QWaylandXdgShell::getXdgSurface(QWaylandWindow *window) { - return new QWaylandXdgSurface(this, get_xdg_surface(window->object()), window); + return new QWaylandXdgSurface(this, get_xdg_surface(window->wlSurface()), window); } void QWaylandXdgShell::xdg_wm_base_ping(uint32_t serial) diff --git a/src/plugins/platforms/wayland/qwaylanddatadevice.cpp b/src/plugins/platforms/wayland/qwaylanddatadevice.cpp index 300c9de0aa8..fde0f71a250 100644 --- a/src/plugins/platforms/wayland/qwaylanddatadevice.cpp +++ b/src/plugins/platforms/wayland/qwaylanddatadevice.cpp @@ -111,7 +111,7 @@ void QWaylandDataDevice::startDrag(QMimeData *mimeData, QWaylandWindow *icon) if (!origin) origin = m_display->currentInputDevice()->touchFocus(); - start_drag(m_dragSource->object(), origin->object(), icon->object(), m_display->currentInputDevice()->serial()); + start_drag(m_dragSource->object(), origin->wlSurface(), icon->wlSurface(), m_display->currentInputDevice()->serial()); } void QWaylandDataDevice::cancelDrag() diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index fc4241f82da..77db05f1d57 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -111,7 +111,7 @@ struct ::wl_region *QWaylandDisplay::createRegion(const QRegion &qregion) return nullptr; } - return mSubCompositor->get_subsurface(window->object(), parent->object()); + return mSubCompositor->get_subsurface(window->wlSurface(), parent->wlSurface()); } QWaylandClientBufferIntegration * QWaylandDisplay::clientBufferIntegration() const diff --git a/src/plugins/platforms/wayland/qwaylandextendedsurface.cpp b/src/plugins/platforms/wayland/qwaylandextendedsurface.cpp index c5db6d7baf2..a7836e292ec 100644 --- a/src/plugins/platforms/wayland/qwaylandextendedsurface.cpp +++ b/src/plugins/platforms/wayland/qwaylandextendedsurface.cpp @@ -54,7 +54,7 @@ QT_BEGIN_NAMESPACE namespace QtWaylandClient { QWaylandExtendedSurface::QWaylandExtendedSurface(QWaylandWindow *window) - : QtWayland::qt_extended_surface(window->display()->windowExtension()->get_extended_surface(window->object())) + : QtWayland::qt_extended_surface(window->display()->windowExtension()->get_extended_surface(window->wlSurface())) , m_window(window) { } diff --git a/src/plugins/platforms/wayland/qwaylandinputcontext.cpp b/src/plugins/platforms/wayland/qwaylandinputcontext.cpp index e85faaf8e28..55e7641e530 100644 --- a/src/plugins/platforms/wayland/qwaylandinputcontext.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputcontext.cpp @@ -120,7 +120,7 @@ void QWaylandTextInput::updateState(Qt::InputMethodQueries queries, uint32_t fla if (!QGuiApplication::focusWindow() || !QGuiApplication::focusWindow()->handle()) return; - struct ::wl_surface *surface = static_cast(QGuiApplication::focusWindow()->handle())->object(); + auto *surface = static_cast(QGuiApplication::focusWindow()->handle())->wlSurface(); if (!surface || (surface != m_surface)) return; @@ -423,7 +423,7 @@ static ::wl_surface *surfaceForWindow(QWindow *window) return nullptr; auto *waylandWindow = static_cast(window->handle()); - return waylandWindow->wl_surface::object(); + return waylandWindow->wlSurface(); } void QWaylandInputContext::update(Qt::InputMethodQueries queries) @@ -529,7 +529,7 @@ void QWaylandInputContext::setFocusObject(QObject *) if (mCurrentWindow && mCurrentWindow->handle()) { if (mCurrentWindow.data() != window || !inputMethodAccepted()) { - struct ::wl_surface *surface = static_cast(mCurrentWindow->handle())->object(); + auto *surface = static_cast(mCurrentWindow->handle())->wlSurface(); if (surface) textInput()->disable(surface); mCurrentWindow.clear(); @@ -538,7 +538,7 @@ void QWaylandInputContext::setFocusObject(QObject *) if (window && window->handle() && inputMethodAccepted()) { if (mCurrentWindow.data() != window) { - struct ::wl_surface *surface = static_cast(window->handle())->object(); + auto *surface = static_cast(window->handle())->wlSurface(); if (surface) { textInput()->enable(surface); mCurrentWindow = window; diff --git a/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp b/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp index 76acb526bf3..cf227d489a5 100644 --- a/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp +++ b/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp @@ -89,7 +89,7 @@ void *QWaylandNativeInterface::nativeResourceForWindow(const QByteArray &resourc return const_cast(m_integration->display()->wl_compositor()); if (lowerCaseResource == "surface") { QWaylandWindow *w = static_cast(window->handle()); - return w ? w->object() : nullptr; + return w ? w->wlSurface() : nullptr; } if (lowerCaseResource == "egldisplay" && m_integration->clientBufferIntegration()) diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index 19c71627b56..7791c5e41e2 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -80,7 +80,7 @@ class QWaylandScreen; class QWaylandShmBackingStore; class QWaylandPointerEvent; -class Q_WAYLAND_CLIENT_EXPORT QWaylandWindow : public QObject, public QPlatformWindow, public QtWayland::wl_surface +class Q_WAYLAND_CLIENT_EXPORT QWaylandWindow : public QObject, public QPlatformWindow, private QtWayland::wl_surface { Q_OBJECT public: @@ -128,6 +128,7 @@ public: QSize surfaceSize() const; QRect windowGeometry() const; + ::wl_surface *wlSurface() { return object(); } static QWaylandWindow *fromWlSurface(::wl_surface *surface); QWaylandDisplay *display() const { return mDisplay; } From a998944b2035c80999db4c1d9f7666c87ba73a86 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Mon, 21 Jan 2019 10:06:49 +0100 Subject: [PATCH 0667/1507] Add server buffer integration based on Vulkan Using NVIDIA's Vulkan/GL interop function: glGetVkProcAddrNV [ChangeLog] Added Vulkan-based server buffer integration for NVIDIA EGLStreams. Change-Id: I500f80ff3b00a9585178976d8e400baa38e89ef6 Reviewed-by: Johan Helsing --- .../qt-vulkan-server-buffer-unstable-v1.xml | 64 ++++++++++++++++++ src/plugins/platforms/wayland/configure.json | 12 ++++ .../plugins/hardwareintegration/client.pro | 2 + .../vulkan-server/main.cpp | 66 +++++++++++++++++++ .../vulkan-server/vulkan-server.json | 3 + .../vulkan-server/vulkan-server.pro | 15 +++++ 6 files changed, 162 insertions(+) create mode 100644 src/3rdparty/wayland/extensions/qt-vulkan-server-buffer-unstable-v1.xml create mode 100644 src/plugins/platforms/wayland/plugins/hardwareintegration/vulkan-server/main.cpp create mode 100644 src/plugins/platforms/wayland/plugins/hardwareintegration/vulkan-server/vulkan-server.json create mode 100644 src/plugins/platforms/wayland/plugins/hardwareintegration/vulkan-server/vulkan-server.pro diff --git a/src/3rdparty/wayland/extensions/qt-vulkan-server-buffer-unstable-v1.xml b/src/3rdparty/wayland/extensions/qt-vulkan-server-buffer-unstable-v1.xml new file mode 100644 index 00000000000..211d0a7c730 --- /dev/null +++ b/src/3rdparty/wayland/extensions/qt-vulkan-server-buffer-unstable-v1.xml @@ -0,0 +1,64 @@ + + + + Copyright (C) 2019 The Qt Company Ltd. + Contact: http://www.qt.io/licensing/ + + This file is part of the plugins of the Qt Toolkit. + + $QT_BEGIN_LICENSE:BSD$ + You may use this file under the terms of the BSD license as follows: + + "Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + * Neither the name of The Qt Company Ltd nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." + + $QT_END_LICENSE$ + + + + This protocol is used internally by Qt for implementing the + qt_server_buffer extension on hardware that supports Vulkan external memory . + + This protocol is not part of the Qt API. It exists purely as an + implementation detail and may change from version to + version without notice, or even be removed. + + + + Informs the client about a newly created server buffer. + The "fd" argument is a POSIX file descriptor representing the + underlying resources of a Vulkan device memory object as defined + in the GL_EXT_memory_object_fd extension. + + + + + + + + + + diff --git a/src/plugins/platforms/wayland/configure.json b/src/plugins/platforms/wayland/configure.json index b5146680e61..4f1a297e507 100644 --- a/src/plugins/platforms/wayland/configure.json +++ b/src/plugins/platforms/wayland/configure.json @@ -74,6 +74,11 @@ "type": "compile", "test": "dmabuf_server_buffer", "use": "egl" + }, + "vulkan-server-buffer": { + "label": "Vulkan Buffer Sharing", + "type": "compile", + "test": "vulkan_server_buffer" } }, @@ -152,6 +157,11 @@ "condition": "features.wayland-client && features.opengl && features.egl && tests.dmabuf-server-buffer", "output": [ "privateFeature" ] }, + "wayland-vulkan-server-buffer": { + "label": "Vulkan-based server buffer integration", + "condition": "features.wayland-client && features.opengl && features.egl && tests.vulkan-server-buffer", + "output": [ "privateFeature" ] + }, "wayland-shm-emulation-server-buffer": { "label": "Shm emulation server buffer integration", "condition": "features.wayland-client && features.opengl", @@ -178,6 +188,8 @@ "xcomposite-glx", "wayland-drm-egl-server-buffer", "wayland-libhybris-egl-server-buffer", + "wayland-dmabuf-server-buffer", + "wayland-vulkan-server-buffer", "wayland-shm-emulation-server-buffer" ] }, diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/client.pro b/src/plugins/platforms/wayland/plugins/hardwareintegration/client.pro index 82e431ee869..7b7e8a49af8 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/client.pro +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/client.pro @@ -18,3 +18,5 @@ qtConfig(wayland-shm-emulation-server-buffer): \ SUBDIRS += shm-emulation-server qtConfig(wayland-dmabuf-server-buffer): \ SUBDIRS += dmabuf-server +qtConfig(wayland-vulkan-server-buffer): \ + SUBDIRS += vulkan-server diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/vulkan-server/main.cpp b/src/plugins/platforms/wayland/plugins/hardwareintegration/vulkan-server/main.cpp new file mode 100644 index 00000000000..b8f64bf225e --- /dev/null +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/vulkan-server/main.cpp @@ -0,0 +1,66 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include "vulkanserverbufferintegration.h" + +QT_BEGIN_NAMESPACE + +namespace QtWaylandClient { + +class VulkanServerBufferPlugin : public QWaylandServerBufferIntegrationPlugin +{ + Q_OBJECT + Q_PLUGIN_METADATA(IID QWaylandServerBufferIntegrationFactoryInterface_iid FILE "vulkan-server.json") +public: + QWaylandServerBufferIntegration *create(const QString&, const QStringList&) override; +}; + +QWaylandServerBufferIntegration *VulkanServerBufferPlugin::create(const QString& key, const QStringList& paramList) +{ + Q_UNUSED(paramList); + Q_UNUSED(key); + return new VulkanServerBufferIntegration(); +} + +} + +QT_END_NAMESPACE + +#include "main.moc" diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/vulkan-server/vulkan-server.json b/src/plugins/platforms/wayland/plugins/hardwareintegration/vulkan-server/vulkan-server.json new file mode 100644 index 00000000000..baadd152928 --- /dev/null +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/vulkan-server/vulkan-server.json @@ -0,0 +1,3 @@ +{ + "Keys": [ "vulkan-server" ] +} diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/vulkan-server/vulkan-server.pro b/src/plugins/platforms/wayland/plugins/hardwareintegration/vulkan-server/vulkan-server.pro new file mode 100644 index 00000000000..1be60f7c10f --- /dev/null +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/vulkan-server/vulkan-server.pro @@ -0,0 +1,15 @@ +# We have a bunch of C code with casts, so we can't have this option +QMAKE_CXXFLAGS_WARN_ON -= -Wcast-qual + +QT += waylandclient-private + +include(../../../../hardwareintegration/client/vulkan-server/vulkan-server.pri) + +OTHER_FILES += \ + vulkan-server.json + +SOURCES += main.cpp + +PLUGIN_TYPE = wayland-graphics-integration-client +PLUGIN_CLASS_NAME = VulkanServerBufferPlugin +load(qt_plugin) From 3d147d01e38ce15a31b78db21e1fa767f695cdb7 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Fri, 22 Mar 2019 11:24:27 +0100 Subject: [PATCH 0668/1507] Fix compilation with QT_NO_WARNING_OUTPUT Use qCWarning instead of qWarning if logging into a category. This fixes compilation with QT_NO_WARNING_OUPUT, but in addition also avoids unnecessary string formatting if the category is disabled. Fixes: QTBUG-74359 Change-Id: I0e316a833f3f7d4a9122377a1154e739bcb080b1 Reviewed-by: Johan Helsing --- .../platforms/wayland/qwaylandinputdevice.cpp | 8 +++---- .../platforms/wayland/qwaylandwindow.cpp | 21 ++++++++++--------- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index 76000e54203..2ae2caca223 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -316,7 +316,7 @@ void QWaylandInputDevice::Pointer::updateCursorTheme() while (scale > 1 && arrowPixelSize / scale < cursorSize()) --scale; } else { - qWarning(lcQpaWayland) << "Cursor theme does not support the arrow cursor"; + qCWarning(lcQpaWayland) << "Cursor theme does not support the arrow cursor"; } mCursor.themeBufferScale = scale; } @@ -585,9 +585,9 @@ void QWaylandInputDevice::Pointer::pointer_enter(uint32_t serial, struct wl_surf QWaylandWindow *window = QWaylandWindow::fromWlSurface(surface); if (mFocus) { - qWarning(lcQpaWayland) << "The compositor sent a wl_pointer.enter event before sending a" - << "leave event first, this is not allowed by the wayland protocol" - << "attempting to work around it by invalidating the current focus"; + qCWarning(lcQpaWayland) << "The compositor sent a wl_pointer.enter event before sending a" + << "leave event first, this is not allowed by the wayland protocol" + << "attempting to work around it by invalidating the current focus"; invalidateFocus(); } mFocus = window; diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index ca4d176fed6..20a671c6c6a 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -487,11 +487,11 @@ void QWaylandWindow::surface_enter(wl_output *output) auto addedScreen = QWaylandScreen::fromWlOutput(output); if (mScreens.contains(addedScreen)) { - qWarning(lcQpaWayland) << "Ignoring unexpected wl_surface.enter received for output with id:" - << wl_proxy_get_id(reinterpret_cast(output)) - << "screen name:" << addedScreen->name() - << "screen model:" << addedScreen->model() - << "This is most likely a bug in the compositor."; + qCWarning(lcQpaWayland) + << "Ignoring unexpected wl_surface.enter received for output with id:" + << wl_proxy_get_id(reinterpret_cast(output)) + << "screen name:" << addedScreen->name() << "screen model:" << addedScreen->model() + << "This is most likely a bug in the compositor."; return; } @@ -508,11 +508,12 @@ void QWaylandWindow::surface_leave(wl_output *output) auto *removedScreen = QWaylandScreen::fromWlOutput(output); bool wasRemoved = mScreens.removeOne(removedScreen); if (!wasRemoved) { - qWarning(lcQpaWayland) << "Ignoring unexpected wl_surface.leave received for output with id:" - << wl_proxy_get_id(reinterpret_cast(output)) - << "screen name:" << removedScreen->name() - << "screen model:" << removedScreen->model() - << "This is most likely a bug in the compositor."; + qCWarning(lcQpaWayland) + << "Ignoring unexpected wl_surface.leave received for output with id:" + << wl_proxy_get_id(reinterpret_cast(output)) + << "screen name:" << removedScreen->name() + << "screen model:" << removedScreen->model() + << "This is most likely a bug in the compositor."; return; } From 4f87adc442a318b9c05fc73ae1020d0df0dfded3 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Thu, 7 Feb 2019 08:55:13 +0100 Subject: [PATCH 0669/1507] Compressed texture support for vulkan server buffers Adding new virtual function createServerBufferFromData() to the ServerBufferIntegration class. Change-Id: I6009fd5aec07f1794431bd52ccd56cfae9d0f77b Reviewed-by: Johan Helsing --- src/3rdparty/util/LICENSE-APACHE-2.0.txt | 202 ++++++++++++++ src/3rdparty/util/qt_attribution.json | 15 + src/3rdparty/util/vk_format.h | 264 ++++++++++++++++++ .../qwaylandserverbufferintegration_p.h | 3 +- 4 files changed, 483 insertions(+), 1 deletion(-) create mode 100644 src/3rdparty/util/LICENSE-APACHE-2.0.txt create mode 100644 src/3rdparty/util/qt_attribution.json create mode 100644 src/3rdparty/util/vk_format.h diff --git a/src/3rdparty/util/LICENSE-APACHE-2.0.txt b/src/3rdparty/util/LICENSE-APACHE-2.0.txt new file mode 100644 index 00000000000..d6456956733 --- /dev/null +++ b/src/3rdparty/util/LICENSE-APACHE-2.0.txt @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/src/3rdparty/util/qt_attribution.json b/src/3rdparty/util/qt_attribution.json new file mode 100644 index 00000000000..07e85dc20df --- /dev/null +++ b/src/3rdparty/util/qt_attribution.json @@ -0,0 +1,15 @@ +[ + { + "Id": "VK_FORMAT_H", + "Name": "Wayland Protocol", + "QDocModule": "qtwaylandcompositor", + "QtUsage": "Used in the Qt Wayland Compositor vulkan-server-buffer.", + "Files": "vk_format.h", + "Description": "Vulkan format conversion from OpenGL.", + "DownloadLocation": "https://github.com/KhronosGroup/KTX-Software/blob/master/lib/vk_format.h", + "License": "Apache License 2.0", + "LicenseId": "Apache-2.0", + "LicenseFile": "LICENSE-APACHE-2.0.txt", + "Copyright": "Copyright (c) 2016 Oculus VR, LLC. All Rights reserved." + } +] diff --git a/src/3rdparty/util/vk_format.h b/src/3rdparty/util/vk_format.h new file mode 100644 index 00000000000..d17783c75f4 --- /dev/null +++ b/src/3rdparty/util/vk_format.h @@ -0,0 +1,264 @@ +/* +================================================================================================ + +Description : Vulkan format conversion from OpenGL. +Author : J.M.P. van Waveren +Date : 07/17/2016 +Language : C99 +Copyright : Copyright (c) 2016 Oculus VR, LLC. All Rights reserved. + + +LICENSE +------- + +Copyright (c) 2016 Oculus VR, LLC. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +================================================================================================ +*/ + +#if !defined( VK_FORMAT_H ) +#define VK_FORMAT_H + +static inline VkFormat vkGetFormatFromOpenGLInternalFormat( const GLenum internalFormat ) +{ + switch ( internalFormat ) + { + // + // 8 bits per component + // +#ifdef GL_R8 + case GL_R8: return VK_FORMAT_R8_UNORM; // 1-component, 8-bit unsigned normalized + case GL_RG8: return VK_FORMAT_R8G8_UNORM; // 2-component, 8-bit unsigned normalized +#endif + case GL_RGB8: return VK_FORMAT_R8G8B8_UNORM; // 3-component, 8-bit unsigned normalized + case GL_RGBA8: return VK_FORMAT_R8G8B8A8_UNORM; // 4-component, 8-bit unsigned normalized + + case GL_R8_SNORM: return VK_FORMAT_R8_SNORM; // 1-component, 8-bit signed normalized + case GL_RG8_SNORM: return VK_FORMAT_R8G8_SNORM; // 2-component, 8-bit signed normalized + case GL_RGB8_SNORM: return VK_FORMAT_R8G8B8_SNORM; // 3-component, 8-bit signed normalized + case GL_RGBA8_SNORM: return VK_FORMAT_R8G8B8A8_SNORM; // 4-component, 8-bit signed normalized + + case GL_R8UI: return VK_FORMAT_R8_UINT; // 1-component, 8-bit unsigned integer + case GL_RG8UI: return VK_FORMAT_R8G8_UINT; // 2-component, 8-bit unsigned integer + case GL_RGB8UI: return VK_FORMAT_R8G8B8_UINT; // 3-component, 8-bit unsigned integer + case GL_RGBA8UI: return VK_FORMAT_R8G8B8A8_UINT; // 4-component, 8-bit unsigned integer + + case GL_R8I: return VK_FORMAT_R8_SINT; // 1-component, 8-bit signed integer + case GL_RG8I: return VK_FORMAT_R8G8_SINT; // 2-component, 8-bit signed integer + case GL_RGB8I: return VK_FORMAT_R8G8B8_SINT; // 3-component, 8-bit signed integer + case GL_RGBA8I: return VK_FORMAT_R8G8B8A8_SINT; // 4-component, 8-bit signed integer + + case GL_SR8_EXT: return VK_FORMAT_R8_SRGB; // 1-component, 8-bit sRGB +#ifdef GL_SRG8_EXT + case GL_SRG8_EXT: return VK_FORMAT_R8G8_SRGB; // 2-component, 8-bit sRGB +#endif +#ifdef GL_SRGB8_NV + case GL_SRGB8_NV: return VK_FORMAT_R8G8B8_SRGB; // 3-component, 8-bit sRGB +#endif +#ifdef GL_SRGB8_ALPHA8 + case GL_SRGB8_ALPHA8: return VK_FORMAT_R8G8B8A8_SRGB; // 4-component, 8-bit sRGB +#endif + // + // 16 bits per component + // +#ifdef GL_R16_EXT + case GL_R16_EXT: return VK_FORMAT_R16_UNORM; // 1-component, 16-bit unsigned normalized + case GL_RG16_EXT: return VK_FORMAT_R16G16_UNORM; // 2-component, 16-bit unsigned normalized +#endif + case GL_RGB16_EXT: return VK_FORMAT_R16G16B16_UNORM; // 3-component, 16-bit unsigned normalized + case GL_RGBA16_EXT: return VK_FORMAT_R16G16B16A16_UNORM; // 4-component, 16-bit unsigned normalized + +#ifdef GL_R16_SNORM_EXT + case GL_R16_SNORM_EXT: return VK_FORMAT_R16_SNORM; // 1-component, 16-bit signed normalized + case GL_RG16_SNORM_EXT: return VK_FORMAT_R16G16_SNORM; // 2-component, 16-bit signed normalized + case GL_RGB16_SNORM_EXT: return VK_FORMAT_R16G16B16_SNORM; // 3-component, 16-bit signed normalized + case GL_RGBA16_SNORM_EXT: return VK_FORMAT_R16G16B16A16_SNORM; // 4-component, 16-bit signed normalized +#endif + + case GL_R16UI: return VK_FORMAT_R16_UINT; // 1-component, 16-bit unsigned integer + case GL_RG16UI: return VK_FORMAT_R16G16_UINT; // 2-component, 16-bit unsigned integer + case GL_RGB16UI: return VK_FORMAT_R16G16B16_UINT; // 3-component, 16-bit unsigned integer + case GL_RGBA16UI: return VK_FORMAT_R16G16B16A16_UINT; // 4-component, 16-bit unsigned integer + + case GL_R16I: return VK_FORMAT_R16_SINT; // 1-component, 16-bit signed integer + case GL_RG16I: return VK_FORMAT_R16G16_SINT; // 2-component, 16-bit signed integer + case GL_RGB16I: return VK_FORMAT_R16G16B16_SINT; // 3-component, 16-bit signed integer + case GL_RGBA16I: return VK_FORMAT_R16G16B16A16_SINT; // 4-component, 16-bit signed integer + + case GL_R16F: return VK_FORMAT_R16_SFLOAT; // 1-component, 16-bit floating-point + case GL_RG16F: return VK_FORMAT_R16G16_SFLOAT; // 2-component, 16-bit floating-point + case GL_RGB16F: return VK_FORMAT_R16G16B16_SFLOAT; // 3-component, 16-bit floating-point + case GL_RGBA16F: return VK_FORMAT_R16G16B16A16_SFLOAT; // 4-component, 16-bit floating-point + + // + // 32 bits per component + // + case GL_R32UI: return VK_FORMAT_R32_UINT; // 1-component, 32-bit unsigned integer + case GL_RG32UI: return VK_FORMAT_R32G32_UINT; // 2-component, 32-bit unsigned integer + case GL_RGB32UI: return VK_FORMAT_R32G32B32_UINT; // 3-component, 32-bit unsigned integer + case GL_RGBA32UI: return VK_FORMAT_R32G32B32A32_UINT; // 4-component, 32-bit unsigned integer + + case GL_R32I: return VK_FORMAT_R32_SINT; // 1-component, 32-bit signed integer + case GL_RG32I: return VK_FORMAT_R32G32_SINT; // 2-component, 32-bit signed integer + case GL_RGB32I: return VK_FORMAT_R32G32B32_SINT; // 3-component, 32-bit signed integer + case GL_RGBA32I: return VK_FORMAT_R32G32B32A32_SINT; // 4-component, 32-bit signed integer + + case GL_R32F: return VK_FORMAT_R32_SFLOAT; // 1-component, 32-bit floating-point + case GL_RG32F: return VK_FORMAT_R32G32_SFLOAT; // 2-component, 32-bit floating-point + case GL_RGB32F: return VK_FORMAT_R32G32B32_SFLOAT; // 3-component, 32-bit floating-point + case GL_RGBA32F: return VK_FORMAT_R32G32B32A32_SFLOAT; // 4-component, 32-bit floating-point + + // + // Packed + // +// case GL_R3_G3_B2: return VK_FORMAT_UNDEFINED; // 3-component 3:3:2, unsigned normalized +// case GL_RGB4: return VK_FORMAT_UNDEFINED; // 3-component 4:4:4, unsigned normalized +#ifdef GL_RGB5 + case GL_RGB5: return VK_FORMAT_R5G5B5A1_UNORM_PACK16; // 3-component 5:5:5, unsigned normalized +#endif + case GL_RGB565: return VK_FORMAT_R5G6B5_UNORM_PACK16; // 3-component 5:6:5, unsigned normalized + case GL_RGB10_EXT: return VK_FORMAT_A2R10G10B10_UNORM_PACK32; // 3-component 10:10:10, unsigned normalized + // case GL_RGB12: return VK_FORMAT_UNDEFINED; // 3-component 12:12:12, unsigned normalized + // case GL_RGBA2: return VK_FORMAT_UNDEFINED; // 4-component 2:2:2:2, unsigned normalized + case GL_RGBA4: return VK_FORMAT_R4G4B4A4_UNORM_PACK16; // 4-component 4:4:4:4, unsigned normalized +// case GL_RGBA12: return VK_FORMAT_UNDEFINED; // 4-component 12:12:12:12, unsigned normalized + case GL_RGB5_A1: return VK_FORMAT_A1R5G5B5_UNORM_PACK16; // 4-component 5:5:5:1, unsigned normalized + case GL_RGB10_A2: return VK_FORMAT_A2R10G10B10_UNORM_PACK32; // 4-component 10:10:10:2, unsigned normalized + case GL_RGB10_A2UI: return VK_FORMAT_A2R10G10B10_UINT_PACK32; // 4-component 10:10:10:2, unsigned integer + case GL_R11F_G11F_B10F: return VK_FORMAT_B10G11R11_UFLOAT_PACK32; // 3-component 11:11:10, floating-point + case GL_RGB9_E5: return VK_FORMAT_E5B9G9R9_UFLOAT_PACK32; // 3-component/exp 9:9:9/5, floating-point + + // + // S3TC/DXT/BC + // + + case GL_COMPRESSED_RGB_S3TC_DXT1_EXT: return VK_FORMAT_BC1_RGB_UNORM_BLOCK; // line through 3D space, 4x4 blocks, unsigned normalized + case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT: return VK_FORMAT_BC1_RGBA_UNORM_BLOCK; // line through 3D space plus 1-bit alpha, 4x4 blocks, unsigned normalized + case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT: return VK_FORMAT_BC2_UNORM_BLOCK; // line through 3D space plus line through 1D space, 4x4 blocks, unsigned normalized + case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT: return VK_FORMAT_BC3_UNORM_BLOCK; // line through 3D space plus 4-bit alpha, 4x4 blocks, unsigned normalized + + case GL_COMPRESSED_SRGB_S3TC_DXT1_EXT: return VK_FORMAT_BC1_RGB_SRGB_BLOCK; // line through 3D space, 4x4 blocks, sRGB + case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT: return VK_FORMAT_BC1_RGBA_SRGB_BLOCK; // line through 3D space plus 1-bit alpha, 4x4 blocks, sRGB + case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT: return VK_FORMAT_BC2_SRGB_BLOCK; // line through 3D space plus line through 1D space, 4x4 blocks, sRGB + case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT: return VK_FORMAT_BC3_SRGB_BLOCK; // line through 3D space plus 4-bit alpha, 4x4 blocks, sRGB +#ifdef GL_COMPRESSED_LUMINANCE_LATC1_EXT + case GL_COMPRESSED_LUMINANCE_LATC1_EXT: return VK_FORMAT_BC4_UNORM_BLOCK; // line through 1D space, 4x4 blocks, unsigned normalized +#endif +#ifdef GL_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT + case GL_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT: return VK_FORMAT_BC5_UNORM_BLOCK; // two lines through 1D space, 4x4 blocks, unsigned normalized +#endif +#ifdef GL_COMPRESSED_SIGNED_LUMINANCE_LATC1_EXT + case GL_COMPRESSED_SIGNED_LUMINANCE_LATC1_EXT: return VK_FORMAT_BC4_SNORM_BLOCK; // line through 1D space, 4x4 blocks, signed normalized +#endif +#ifdef GL_COMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2_EXT + case GL_COMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2_EXT: return VK_FORMAT_BC5_SNORM_BLOCK; // two lines through 1D space, 4x4 blocks, signed normalized +#endif + case GL_COMPRESSED_RED_RGTC1_EXT: return VK_FORMAT_BC4_UNORM_BLOCK; // line through 1D space, 4x4 blocks, unsigned normalized +#ifdef GL_COMPRESSED_RG_RGTC2_EXT + case GL_COMPRESSED_RG_RGTC2_EXT: return VK_FORMAT_BC5_UNORM_BLOCK; // two lines through 1D space, 4x4 blocks, unsigned normalized +#endif + case GL_COMPRESSED_SIGNED_RED_RGTC1_EXT: return VK_FORMAT_BC4_SNORM_BLOCK; // line through 1D space, 4x4 blocks, signed normalized +#ifdef GL_COMPRESSED_SIGNED_RG_RGTC2_EXT + case GL_COMPRESSED_SIGNED_RG_RGTC2_EXT: return VK_FORMAT_BC5_SNORM_BLOCK; // two lines through 1D space, 4x4 blocks, signed normalized +#endif + +#if defined(GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT) + case GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT: return VK_FORMAT_BC6H_UFLOAT_BLOCK; // 3-component, 4x4 blocks, unsigned floating-point + case GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT: return VK_FORMAT_BC6H_SFLOAT_BLOCK; // 3-component, 4x4 blocks, signed floating-point + case GL_COMPRESSED_RGBA_BPTC_UNORM_EXT: return VK_FORMAT_BC7_UNORM_BLOCK; // 4-component, 4x4 blocks, unsigned normalized + case GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT: return VK_FORMAT_BC7_SRGB_BLOCK; // 4-component, 4x4 blocks, sRGB +#elif defined(GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT) + case GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT: return VK_FORMAT_BC6H_UFLOAT_BLOCK; // 3-component, 4x4 blocks, unsigned floating-point + case GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT: return VK_FORMAT_BC6H_SFLOAT_BLOCK; // 3-component, 4x4 blocks, signed floating-point + case GL_COMPRESSED_RGBA_BPTC_UNORM: return VK_FORMAT_BC7_UNORM_BLOCK; // 4-component, 4x4 blocks, unsigned normalized + case GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM: return VK_FORMAT_BC7_SRGB_BLOCK; // 4-component, 4x4 blocks, sRGB +#endif + // + // ETC + // +#ifdef GL_ETC1_RGB8_OES + case GL_ETC1_RGB8_OES: return VK_FORMAT_ETC2_R8G8B8_UNORM_BLOCK; // 3-component ETC1, 4x4 blocks, unsigned normalized +#endif + + case GL_COMPRESSED_RGB8_ETC2: return VK_FORMAT_ETC2_R8G8B8_UNORM_BLOCK; // 3-component ETC2, 4x4 blocks, unsigned normalized + case GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2: return VK_FORMAT_ETC2_R8G8B8A1_UNORM_BLOCK; // 4-component ETC2 with 1-bit alpha, 4x4 blocks, unsigned normalized + case GL_COMPRESSED_RGBA8_ETC2_EAC: return VK_FORMAT_ETC2_R8G8B8A8_UNORM_BLOCK; // 4-component ETC2, 4x4 blocks, unsigned normalized + + case GL_COMPRESSED_SRGB8_ETC2: return VK_FORMAT_ETC2_R8G8B8_SRGB_BLOCK; // 3-component ETC2, 4x4 blocks, sRGB + case GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2: return VK_FORMAT_ETC2_R8G8B8A1_SRGB_BLOCK; // 4-component ETC2 with 1-bit alpha, 4x4 blocks, sRGB + case GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC: return VK_FORMAT_ETC2_R8G8B8A8_SRGB_BLOCK; // 4-component ETC2, 4x4 blocks, sRGB + + case GL_COMPRESSED_R11_EAC: return VK_FORMAT_EAC_R11_UNORM_BLOCK; // 1-component ETC, 4x4 blocks, unsigned normalized + case GL_COMPRESSED_RG11_EAC: return VK_FORMAT_EAC_R11G11_UNORM_BLOCK; // 2-component ETC, 4x4 blocks, unsigned normalized + case GL_COMPRESSED_SIGNED_R11_EAC: return VK_FORMAT_EAC_R11_SNORM_BLOCK; // 1-component ETC, 4x4 blocks, signed normalized + case GL_COMPRESSED_SIGNED_RG11_EAC: return VK_FORMAT_EAC_R11G11_SNORM_BLOCK; // 2-component ETC, 4x4 blocks, signed normalized + + // + // ASTC + // + case GL_COMPRESSED_RGBA_ASTC_4x4_KHR: return VK_FORMAT_ASTC_4x4_UNORM_BLOCK; // 4-component ASTC, 4x4 blocks, unsigned normalized + case GL_COMPRESSED_RGBA_ASTC_5x4_KHR: return VK_FORMAT_ASTC_5x4_UNORM_BLOCK; // 4-component ASTC, 5x4 blocks, unsigned normalized + case GL_COMPRESSED_RGBA_ASTC_5x5_KHR: return VK_FORMAT_ASTC_5x5_UNORM_BLOCK; // 4-component ASTC, 5x5 blocks, unsigned normalized + case GL_COMPRESSED_RGBA_ASTC_6x5_KHR: return VK_FORMAT_ASTC_6x5_UNORM_BLOCK; // 4-component ASTC, 6x5 blocks, unsigned normalized + case GL_COMPRESSED_RGBA_ASTC_6x6_KHR: return VK_FORMAT_ASTC_6x6_UNORM_BLOCK; // 4-component ASTC, 6x6 blocks, unsigned normalized + case GL_COMPRESSED_RGBA_ASTC_8x5_KHR: return VK_FORMAT_ASTC_8x5_UNORM_BLOCK; // 4-component ASTC, 8x5 blocks, unsigned normalized + case GL_COMPRESSED_RGBA_ASTC_8x6_KHR: return VK_FORMAT_ASTC_8x6_UNORM_BLOCK; // 4-component ASTC, 8x6 blocks, unsigned normalized + case GL_COMPRESSED_RGBA_ASTC_8x8_KHR: return VK_FORMAT_ASTC_8x8_UNORM_BLOCK; // 4-component ASTC, 8x8 blocks, unsigned normalized + case GL_COMPRESSED_RGBA_ASTC_10x5_KHR: return VK_FORMAT_ASTC_10x5_UNORM_BLOCK; // 4-component ASTC, 10x5 blocks, unsigned normalized + case GL_COMPRESSED_RGBA_ASTC_10x6_KHR: return VK_FORMAT_ASTC_10x6_UNORM_BLOCK; // 4-component ASTC, 10x6 blocks, unsigned normalized + case GL_COMPRESSED_RGBA_ASTC_10x8_KHR: return VK_FORMAT_ASTC_10x8_UNORM_BLOCK; // 4-component ASTC, 10x8 blocks, unsigned normalized + case GL_COMPRESSED_RGBA_ASTC_10x10_KHR: return VK_FORMAT_ASTC_10x10_UNORM_BLOCK; // 4-component ASTC, 10x10 blocks, unsigned normalized + case GL_COMPRESSED_RGBA_ASTC_12x10_KHR: return VK_FORMAT_ASTC_12x10_UNORM_BLOCK; // 4-component ASTC, 12x10 blocks, unsigned normalized + case GL_COMPRESSED_RGBA_ASTC_12x12_KHR: return VK_FORMAT_ASTC_12x12_UNORM_BLOCK; // 4-component ASTC, 12x12 blocks, unsigned normalized + + case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR: return VK_FORMAT_ASTC_4x4_SRGB_BLOCK; // 4-component ASTC, 4x4 blocks, sRGB + case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR: return VK_FORMAT_ASTC_5x4_SRGB_BLOCK; // 4-component ASTC, 5x4 blocks, sRGB + case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR: return VK_FORMAT_ASTC_5x5_SRGB_BLOCK; // 4-component ASTC, 5x5 blocks, sRGB + case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR: return VK_FORMAT_ASTC_6x5_SRGB_BLOCK; // 4-component ASTC, 6x5 blocks, sRGB + case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR: return VK_FORMAT_ASTC_6x6_SRGB_BLOCK; // 4-component ASTC, 6x6 blocks, sRGB + case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR: return VK_FORMAT_ASTC_8x5_SRGB_BLOCK; // 4-component ASTC, 8x5 blocks, sRGB + case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR: return VK_FORMAT_ASTC_8x6_SRGB_BLOCK; // 4-component ASTC, 8x6 blocks, sRGB + case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR: return VK_FORMAT_ASTC_8x8_SRGB_BLOCK; // 4-component ASTC, 8x8 blocks, sRGB + case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR: return VK_FORMAT_ASTC_10x5_SRGB_BLOCK; // 4-component ASTC, 10x5 blocks, sRGB + case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR: return VK_FORMAT_ASTC_10x6_SRGB_BLOCK; // 4-component ASTC, 10x6 blocks, sRGB + case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR: return VK_FORMAT_ASTC_10x8_SRGB_BLOCK; // 4-component ASTC, 10x8 blocks, sRGB + case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR: return VK_FORMAT_ASTC_10x10_SRGB_BLOCK; // 4-component ASTC, 10x10 blocks, sRGB + case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR: return VK_FORMAT_ASTC_12x10_SRGB_BLOCK; // 4-component ASTC, 12x10 blocks, sRGB + case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR: return VK_FORMAT_ASTC_12x12_SRGB_BLOCK; // 4-component ASTC, 12x12 blocks, sRGB + + // + // Depth/stencil + // + case GL_DEPTH_COMPONENT16: return VK_FORMAT_D16_UNORM; + case GL_DEPTH_COMPONENT24: return VK_FORMAT_X8_D24_UNORM_PACK32; +// case GL_DEPTH_COMPONENT32: return VK_FORMAT_UNDEFINED; + case GL_DEPTH_COMPONENT32F: return VK_FORMAT_D32_SFLOAT; +#ifdef GL_DEPTH_COMPONENT32F_NV + case GL_DEPTH_COMPONENT32F_NV: return VK_FORMAT_D32_SFLOAT; +#endif +// case GL_STENCIL_INDEX1: return VK_FORMAT_UNDEFINED; +// case GL_STENCIL_INDEX4: return VK_FORMAT_UNDEFINED; + case GL_STENCIL_INDEX8: return VK_FORMAT_S8_UINT; +// case GL_STENCIL_INDEX16: return VK_FORMAT_UNDEFINED; + case GL_DEPTH24_STENCIL8: return VK_FORMAT_D24_UNORM_S8_UINT; + case GL_DEPTH32F_STENCIL8: return VK_FORMAT_D32_SFLOAT_S8_UINT; +#ifdef GL_DEPTH32F_STENCIL8_NV + case GL_DEPTH32F_STENCIL8_NV: return VK_FORMAT_D32_SFLOAT_S8_UINT; +#endif + default: return VK_FORMAT_UNDEFINED; + } +} + +#endif // !VK_FORMAT_H diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegration_p.h b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegration_p.h index 632429befa3..6833efd0c28 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegration_p.h +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegration_p.h @@ -70,7 +70,8 @@ class Q_WAYLAND_CLIENT_EXPORT QWaylandServerBuffer public: enum Format { RGBA32, - A8 + A8, + Custom }; QWaylandServerBuffer(); From b09e808bf222984196cebd4447880781e3265714 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Wed, 30 Jan 2019 10:33:55 +0100 Subject: [PATCH 0670/1507] New texture sharing protocol and infrastructure This adds a higher level protocol on top of the server buffer extension, providing an easy way for Qt Quick applications to use the shared textures. [ChangeLog] Added protocol and Qt Quick image provider for sharing textures in graphics memory between compositor and multiple clients. Task-number: QTBUG-73822 Change-Id: Idc41b3479d6ca37be35d9ccd7b89e9994ff17f8f Reviewed-by: Johan Helsing --- .../qt-texture-sharing-unstable-v1.xml | 57 +++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 src/3rdparty/wayland/extensions/qt-texture-sharing-unstable-v1.xml diff --git a/src/3rdparty/wayland/extensions/qt-texture-sharing-unstable-v1.xml b/src/3rdparty/wayland/extensions/qt-texture-sharing-unstable-v1.xml new file mode 100644 index 00000000000..262ae487c22 --- /dev/null +++ b/src/3rdparty/wayland/extensions/qt-texture-sharing-unstable-v1.xml @@ -0,0 +1,57 @@ + + + + Copyright (C) 2019 The Qt Company Ltd. + Contact: http://www.qt.io/licensing/ + + This file is part of the plugins of the Qt Toolkit. + + $QT_BEGIN_LICENSE:BSD$ + You may use this file under the terms of the BSD license as follows: + + "Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + * Neither the name of The Qt Company Ltd nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." + + $QT_END_LICENSE$ + + + + + + + + + + + + + + + + + + + From 544d5e1221b043571d1b7f2f039e4da49fd68ace Mon Sep 17 00:00:00 2001 From: Jesus Fernandez Date: Fri, 29 Mar 2019 09:42:02 +0100 Subject: [PATCH 0671/1507] Fix build - screen maintenance functions moved to QWSI This is an ammendment to 01e1df90a7debd333314720fdd5cf6cd9964d796 in qtbase. Task-number: QTBUG-74816 Change-Id: I493ff0f64f765683d2398c32626ada28d7f202b5 Reviewed-by: Liang Qi --- src/plugins/platforms/wayland/qwaylanddisplay.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index 491b66e153a..5b1b9bffb76 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -70,6 +70,7 @@ #include #include +#include #include #include @@ -153,7 +154,7 @@ QWaylandDisplay::~QWaylandDisplay(void) mInputDevices.clear(); foreach (QWaylandScreen *screen, mScreens) { - mWaylandIntegration->destroyScreen(screen); + QWindowSystemInterface::handleScreenRemoved(screen); } mScreens.clear(); @@ -244,7 +245,7 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin mScreens.append(screen); // We need to get the output events before creating surfaces forceRoundTrip(); - mWaylandIntegration->screenAdded(screen); + QWindowSystemInterface::handleScreenAdded(screen); } else if (interface == QStringLiteral("wl_compositor")) { mCompositorVersion = qMin((int)version, 3); mCompositor.init(registry, id, mCompositorVersion); @@ -300,7 +301,7 @@ void QWaylandDisplay::registry_global_remove(uint32_t id) foreach (QWaylandScreen *screen, mScreens) { if (screen->outputId() == id) { mScreens.removeOne(screen); - mWaylandIntegration->destroyScreen(screen); + QWindowSystemInterface::handleScreenRemoved(screen); break; } } From 2df3b8a81484a51f8784c040d278d86079834b04 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Fri, 21 Dec 2018 15:24:49 +0100 Subject: [PATCH 0672/1507] Client xdg-shell v5: Fix crash when creating a popup without a valid parent Fixes: QTBUG-72696 Change-Id: I43f0a02a4447238aa93142981d22597c452790fd Reviewed-by: Paul Olav Tvete --- .../xdg-shell-v5/qwaylandxdgshellv5.cpp | 3 +++ .../xdg-shell-v5/qwaylandxdgshellv5integration.cpp | 13 +++++++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshellv5.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshellv5.cpp index 4cbafbd71b5..3eda43d7ca3 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshellv5.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshellv5.cpp @@ -71,6 +71,9 @@ QWaylandXdgSurfaceV5 *QWaylandXdgShellV5::createXdgSurface(QWaylandWindow *windo QWaylandXdgPopupV5 *QWaylandXdgShellV5::createXdgPopup(QWaylandWindow *window, QWaylandInputDevice *inputDevice) { QWaylandWindow *parentWindow = m_popups.empty() ? window->transientParent() : m_popups.last(); + if (!parentWindow) + return nullptr; + ::wl_surface *parentSurface = parentWindow->object(); if (m_popupSerial == 0) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshellv5integration.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshellv5integration.cpp index 12cc95b1538..410f2700129 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshellv5integration.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshellv5integration.cpp @@ -73,10 +73,15 @@ bool QWaylandXdgShellV5Integration::initialize(QWaylandDisplay *display) QWaylandShellSurface *QWaylandXdgShellV5Integration::createShellSurface(QWaylandWindow *window) { QWaylandInputDevice *inputDevice = window->display()->lastInputDevice(); - if (window->window()->type() == Qt::WindowType::Popup && inputDevice) - return m_xdgShell->createXdgPopup(window, inputDevice); - else - return m_xdgShell->createXdgSurface(window); + if (window->window()->type() == Qt::WindowType::Popup && inputDevice) { + if (auto *popup = m_xdgShell->createXdgPopup(window, inputDevice)) + return popup; + + qWarning(lcQpaWayland) << "Failed to create xdg-popup v5 for window" << window->window() + << "falling back to creating an xdg-surface"; + } + + return m_xdgShell->createXdgSurface(window); } void QWaylandXdgShellV5Integration::handleKeyboardFocusChanged(QWaylandWindow *newFocus, QWaylandWindow *oldFocus) { From dfa4796eae910b5ca09d971102450e6eea8b9a10 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Thu, 12 Jan 2017 14:04:04 +0100 Subject: [PATCH 0673/1507] Compositor: Don't require OpenGL to build the QML APIs [ChangeLog][Compositor API] The compositor API now works without OpenGL support. This makes the compositor API work with shared memory clients only. If OpenGL clients connect they will currently punch holes in the compositor window, but fixing that is out of scope for this patch. Fixes: QTBUG-74896 Change-Id: I6c1ba82f28ba9edecf380e471124e15d16f9518e Reviewed-by: Paul Olav Tvete --- tests/auto/wayland/client/tst_client.cpp | 8 ++++++++ tests/auto/wayland/surface/tst_surface.cpp | 6 ++++++ 2 files changed, 14 insertions(+) diff --git a/tests/auto/wayland/client/tst_client.cpp b/tests/auto/wayland/client/tst_client.cpp index 08120c8c24f..e9ae5e4b352 100644 --- a/tests/auto/wayland/client/tst_client.cpp +++ b/tests/auto/wayland/client/tst_client.cpp @@ -36,7 +36,9 @@ #include #include #include +#if QT_CONFIG(opengl) #include +#endif #include #include @@ -107,6 +109,7 @@ public: QPoint mousePressPos; }; +#if QT_CONFIG(opengl) class TestGlWindow : public QOpenGLWindow { Q_OBJECT @@ -136,6 +139,7 @@ void TestGlWindow::paintGL() glClear(GL_COLOR_BUFFER_BIT); ++paintGLCalled; } +#endif // QT_CONFIG(opengl) class tst_WaylandClient : public QObject { @@ -176,7 +180,9 @@ private slots: void dontCrashOnMultipleCommits(); void hiddenTransientParent(); void hiddenPopupParent(); +#if QT_CONFIG(opengl) void glWindow(); +#endif // QT_CONFIG(opengl) void longWindowTitle(); private: @@ -458,6 +464,7 @@ void tst_WaylandClient::hiddenPopupParent() QTRY_VERIFY(compositor->surface()); } +#if QT_CONFIG(opengl) void tst_WaylandClient::glWindow() { QSKIP("Skipping GL tests, as not supported by all CI systems: See https://bugreports.qt.io/browse/QTBUG-65802"); @@ -483,6 +490,7 @@ void tst_WaylandClient::glWindow() testWindow->setVisible(false); QTRY_VERIFY(!compositor->surface()); } +#endif // QT_CONFIG(opengl) void tst_WaylandClient::longWindowTitle() { diff --git a/tests/auto/wayland/surface/tst_surface.cpp b/tests/auto/wayland/surface/tst_surface.cpp index dddff0866f0..9659235a079 100644 --- a/tests/auto/wayland/surface/tst_surface.cpp +++ b/tests/auto/wayland/surface/tst_surface.cpp @@ -28,7 +28,9 @@ #include "mockcompositor.h" #include +#if QT_CONFIG(opengl) #include +#endif using namespace MockCompositor; @@ -39,7 +41,9 @@ private slots: void cleanup() { QTRY_VERIFY2(isClean(), qPrintable(dirtyMessage())); } void createDestroySurface(); void waitForFrameCallbackRaster(); +#if QT_CONFIG(opengl) void waitForFrameCallbackGl(); +#endif void negotiateShmFormat(); }; @@ -89,6 +93,7 @@ void tst_surface::waitForFrameCallbackRaster() } } +#if QT_CONFIG(opengl) void tst_surface::waitForFrameCallbackGl() { QSKIP("TODO: This currently fails, needs a fix"); @@ -129,6 +134,7 @@ void tst_surface::waitForFrameCallbackGl() bufferSpy.removeFirst(); } } +#endif // QT_CONFIG(opengl) void tst_surface::negotiateShmFormat() { From c6cb08225d91305190a83019650dfe810962192b Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Thu, 1 Nov 2018 13:48:52 +0100 Subject: [PATCH 0674/1507] Client: Don't be exposed if we want to create a sub or shell surface Because some shells don't allow attaching buffers before configure, we need to not be exposed until we know that we don't want a shell surface. Change-Id: Ida7101a99f953d02cf6401e4ea8d28cfabd6e102 Reviewed-by: Giulio Camuffo Reviewed-by: David Edmundson --- .../platforms/wayland/qwaylanddisplay.cpp | 13 ++++++------- .../platforms/wayland/qwaylanddisplay_p.h | 6 +++--- .../platforms/wayland/qwaylandwindow.cpp | 18 +++++++++++++++--- 3 files changed, 24 insertions(+), 13 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index a2957e0dd3d..f2bd3160a8a 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -88,13 +88,6 @@ struct wl_surface *QWaylandDisplay::createSurface(void *handle) return surface; } -QWaylandShellSurface *QWaylandDisplay::createShellSurface(QWaylandWindow *window) -{ - if (!mWaylandIntegration->shellIntegration()) - return nullptr; - return mWaylandIntegration->shellIntegration()->createShellSurface(window); -} - struct ::wl_region *QWaylandDisplay::createRegion(const QRegion &qregion) { struct ::wl_region *region = mCompositor.create_region(); @@ -108,12 +101,18 @@ struct ::wl_region *QWaylandDisplay::createRegion(const QRegion &qregion) ::wl_subsurface *QWaylandDisplay::createSubSurface(QWaylandWindow *window, QWaylandWindow *parent) { if (!mSubCompositor) { + qCWarning(lcQpaWayland) << "Can't create subsurface, not supported by the compositor."; return nullptr; } return mSubCompositor->get_subsurface(window->object(), parent->object()); } +QWaylandShellIntegration *QWaylandDisplay::shellIntegration() const +{ + return mWaylandIntegration->shellIntegration(); +} + QWaylandClientBufferIntegration * QWaylandDisplay::clientBufferIntegration() const { return mWaylandIntegration->clientBufferIntegration(); diff --git a/src/plugins/platforms/wayland/qwaylanddisplay_p.h b/src/plugins/platforms/wayland/qwaylanddisplay_p.h index 43ccc0a96e1..fe1d7874e08 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay_p.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay_p.h @@ -94,7 +94,7 @@ class QWaylandQtKeyExtension; class QWaylandWindow; class QWaylandIntegration; class QWaylandHardwareIntegration; -class QWaylandShellSurface; +class QWaylandShellIntegration; class QWaylandCursorTheme; typedef void (*RegistryListener)(void *data, @@ -115,13 +115,13 @@ public: QWaylandScreen *screenForOutput(struct wl_output *output) const; struct wl_surface *createSurface(void *handle); - QWaylandShellSurface *createShellSurface(QWaylandWindow *window); struct ::wl_region *createRegion(const QRegion &qregion); struct ::wl_subsurface *createSubSurface(QWaylandWindow *window, QWaylandWindow *parent); + QWaylandShellIntegration *shellIntegration() const; QWaylandClientBufferIntegration *clientBufferIntegration() const; - QWaylandWindowManagerIntegration *windowManagerIntegration() const; + #if QT_CONFIG(cursor) void setCursor(struct wl_buffer *buffer, struct wl_cursor_image *image, qreal dpr); void setCursor(const QSharedPointer &buffer, const QPoint &hotSpot, qreal dpr); diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index c46c49813fb..79639cba0ea 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -50,6 +50,7 @@ #include "qwaylandnativeinterface_p.h" #include "qwaylanddecorationfactory_p.h" #include "qwaylandshmbackingstore_p.h" +#include "qwaylandshellintegration_p.h" #if QT_CONFIG(wayland_datadevice) #include "qwaylanddatadevice_p.h" @@ -138,8 +139,9 @@ void QWaylandWindow::initWindow() } } else if (shouldCreateShellSurface()) { Q_ASSERT(!mShellSurface); + Q_ASSERT(mDisplay->shellIntegration()); - mShellSurface = mDisplay->createShellSurface(this); + mShellSurface = mDisplay->shellIntegration()->createShellSurface(this); if (mShellSurface) { // Set initial surface title setWindowTitle(window()->title()); @@ -211,6 +213,9 @@ void QWaylandWindow::initializeWlSurface() bool QWaylandWindow::shouldCreateShellSurface() const { + if (!mDisplay->shellIntegration()) + return false; + if (shouldCreateSubSurface()) return false; @@ -958,9 +963,16 @@ void QWaylandWindow::unfocus() bool QWaylandWindow::isExposed() const { + if (!window()->isVisible()) + return false; + if (mShellSurface) - return window()->isVisible() && mShellSurface->isExposed(); - return QPlatformWindow::isExposed(); + return mShellSurface->isExposed(); + + if (mSubSurfaceWindow) + return mSubSurfaceWindow->parent()->isExposed(); + + return !(shouldCreateShellSurface() || shouldCreateSubSurface()); } bool QWaylandWindow::isActive() const From 24be607d501049eafbc27c04c741e3a40d05d6cf Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Fri, 5 Apr 2019 12:50:19 +0200 Subject: [PATCH 0675/1507] Client: Remove QWaylandWindow wl_surface inheritance ...and introduce a client-side QWaylandSurface. The goal of this is to remove the assumption that a QWaylandWindow maps 1:1 with a wl_surface and also to be able to share implementation with the cursor implementation and other parts of the plugin that needs to use surfaces, but are not QWaylandWindows. QWaylandWindow and QWaylandSurface are still tightly coupled and a lot of the implementation remains as part of QWaylandWindow, but I'm hoping to fix this in later patch sets. Task-number: QTBUG-74373 Change-Id: Ia5a192c8d133847336d266f63ec216fb3639b8c5 Reviewed-by: Paul Olav Tvete --- src/plugins/platforms/wayland/client.pro | 2 + .../platforms/wayland/qwaylanddisplay.cpp | 1 + .../platforms/wayland/qwaylanddisplay_p.h | 1 + .../platforms/wayland/qwaylandsurface.cpp | 113 ++++++++++++++++ .../platforms/wayland/qwaylandsurface_p.h | 96 +++++++++++++ .../platforms/wayland/qwaylandwindow.cpp | 128 +++++++----------- .../platforms/wayland/qwaylandwindow_p.h | 18 +-- 7 files changed, 267 insertions(+), 92 deletions(-) create mode 100644 src/plugins/platforms/wayland/qwaylandsurface.cpp create mode 100644 src/plugins/platforms/wayland/qwaylandsurface_p.h diff --git a/src/plugins/platforms/wayland/client.pro b/src/plugins/platforms/wayland/client.pro index 38d0ac3e1b6..4be288c81d1 100644 --- a/src/plugins/platforms/wayland/client.pro +++ b/src/plugins/platforms/wayland/client.pro @@ -45,6 +45,7 @@ SOURCES += qwaylandintegration.cpp \ qwaylandshellsurface.cpp \ qwaylandextendedsurface.cpp \ qwaylandsubsurface.cpp \ + qwaylandsurface.cpp \ qwaylandtouch.cpp \ qwaylandqtkey.cpp \ ../shared/qwaylandmimehelper.cpp \ @@ -70,6 +71,7 @@ HEADERS += qwaylandintegration_p.h \ qwaylandshellsurface_p.h \ qwaylandextendedsurface_p.h \ qwaylandsubsurface_p.h \ + qwaylandsurface_p.h \ qwaylandtouch_p.h \ qwaylandqtkey_p.h \ qwaylandabstractdecoration_p.h \ diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index 26f99f0ed5d..9a4c76b1d87 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -41,6 +41,7 @@ #include "qwaylandintegration_p.h" #include "qwaylandwindow_p.h" +#include "qwaylandsurface_p.h" #include "qwaylandabstractdecoration_p.h" #include "qwaylandscreen_p.h" #include "qwaylandcursor_p.h" diff --git a/src/plugins/platforms/wayland/qwaylanddisplay_p.h b/src/plugins/platforms/wayland/qwaylanddisplay_p.h index 4a98b935bb6..c518cb94ea6 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay_p.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay_p.h @@ -93,6 +93,7 @@ class QWaylandWindow; class QWaylandIntegration; class QWaylandHardwareIntegration; class QWaylandShellSurface; +class QWaylandSurface; class QWaylandCursor; class QWaylandCursorTheme; diff --git a/src/plugins/platforms/wayland/qwaylandsurface.cpp b/src/plugins/platforms/wayland/qwaylandsurface.cpp new file mode 100644 index 00000000000..03a1c1f526b --- /dev/null +++ b/src/plugins/platforms/wayland/qwaylandsurface.cpp @@ -0,0 +1,113 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the config.tests of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qwaylandsurface_p.h" +#include "qwaylanddisplay_p.h" +#include "qwaylandscreen_p.h" + +#include + +QT_BEGIN_NAMESPACE + +namespace QtWaylandClient { + +QWaylandSurface::QWaylandSurface(QWaylandDisplay *display) + : wl_surface(display->createSurface(this)) +{ + connect(qApp, &QGuiApplication::screenRemoved, this, &QWaylandSurface::handleScreenRemoved); +} + +QWaylandSurface::~QWaylandSurface() +{ + destroy(); +} + +QWaylandScreen *QWaylandSurface::oldestEnteredScreen() +{ + return m_screens.value(0, nullptr); +} + +QWaylandSurface *QWaylandSurface::fromWlSurface(::wl_surface *surface) +{ + return static_cast(static_cast(wl_surface_get_user_data(surface))); +} + +void QWaylandSurface::handleScreenRemoved(QScreen *qScreen) +{ + auto *screen = static_cast(qScreen->handle()); + if (m_screens.removeOne(screen)) + emit screensChanged(); +} + +void QWaylandSurface::surface_enter(wl_output *output) +{ + auto addedScreen = QWaylandScreen::fromWlOutput(output); + + if (m_screens.contains(addedScreen)) { + qCWarning(lcQpaWayland) + << "Ignoring unexpected wl_surface.enter received for output with id:" + << wl_proxy_get_id(reinterpret_cast(output)) + << "screen name:" << addedScreen->name() << "screen model:" << addedScreen->model() + << "This is most likely a bug in the compositor."; + return; + } + + m_screens.append(addedScreen); + emit screensChanged(); +} + +void QWaylandSurface::surface_leave(wl_output *output) +{ + auto *removedScreen = QWaylandScreen::fromWlOutput(output); + bool wasRemoved = m_screens.removeOne(removedScreen); + if (!wasRemoved) { + qCWarning(lcQpaWayland) + << "Ignoring unexpected wl_surface.leave received for output with id:" + << wl_proxy_get_id(reinterpret_cast(output)) + << "screen name:" << removedScreen->name() + << "screen model:" << removedScreen->model() + << "This is most likely a bug in the compositor."; + return; + } + emit screensChanged(); +} + +} // namespace QtWaylandClient + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandsurface_p.h b/src/plugins/platforms/wayland/qwaylandsurface_p.h new file mode 100644 index 00000000000..01f0e63cd4d --- /dev/null +++ b/src/plugins/platforms/wayland/qwaylandsurface_p.h @@ -0,0 +1,96 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the config.tests of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWAYLANDSURFACE_P_H +#define QWAYLANDSURFACE_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include + +#include + +QT_BEGIN_NAMESPACE + +namespace QtWaylandClient { + +class QWaylandScreen; +class QWaylandWindow; +class QWaylandDisplay; + +class QWaylandSurface : public QObject, public QtWayland::wl_surface +{ + Q_OBJECT +public: + explicit QWaylandSurface(QWaylandDisplay *display); + ~QWaylandSurface() override; + QWaylandScreen *oldestEnteredScreen(); + + static QWaylandSurface *fromWlSurface(::wl_surface *surface); + +signals: + void screensChanged(); + +private slots: + void handleScreenRemoved(QScreen *qScreen); + +protected: + void surface_enter(struct ::wl_output *output) override; + void surface_leave(struct ::wl_output *output) override; + + QVector m_screens; //As seen by wl_surface.enter/leave events. Chronological order. + QWaylandWindow *m_window = nullptr; + + friend class QWaylandWindow; // TODO: shouldn't need to be friends +}; + +} // namespace QtWaylandClient + +QT_END_NAMESPACE + +#endif // QWAYLANDSURFACE_P_H diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 12b99dc9f05..d0cb63172bf 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -41,6 +41,7 @@ #include "qwaylandbuffer_p.h" #include "qwaylanddisplay_p.h" +#include "qwaylandsurface_p.h" #include "qwaylandinputdevice_p.h" #include "qwaylandscreen_p.h" #include "qwaylandshellsurface_p.h" @@ -77,7 +78,6 @@ QWaylandWindow::QWaylandWindow(QWindow *window) { static WId id = 1; mWindowId = id++; - connect(qApp, &QGuiApplication::screenRemoved, this, &QWaylandWindow::handleScreenRemoved); initializeWlSurface(); } @@ -87,7 +87,7 @@ QWaylandWindow::~QWaylandWindow() delete mWindowDecoration; - if (isInitialized()) + if (mSurface) reset(false); const QWindow *parent = window(); @@ -112,7 +112,7 @@ void QWaylandWindow::initWindow() if (window()->type() == Qt::Desktop) return; - if (!isInitialized()) { + if (!mSurface) { initializeWlSurface(); QPlatformSurfaceEvent e(QPlatformSurfaceEvent::SurfaceCreated); QGuiApplication::sendEvent(window(), &e); @@ -177,7 +177,7 @@ void QWaylandWindow::initWindow() // typically be integer 1 (normal-dpi) or 2 (high-dpi). Call set_buffer_scale() // to inform the compositor that high-resolution buffers will be provided. if (mDisplay->compositorVersion() >= 3) - set_buffer_scale(scale()); + mSurface->set_buffer_scale(scale()); if (QScreen *s = window()->screen()) setOrientationMask(s->orientationUpdateMask()); @@ -195,7 +195,11 @@ void QWaylandWindow::initWindow() void QWaylandWindow::initializeWlSurface() { - init(mDisplay->createSurface(static_cast(this))); + Q_ASSERT(!mSurface); + mSurface.reset(new QWaylandSurface(mDisplay)); + connect(mSurface.data(), &QWaylandSurface::screensChanged, + this, &QWaylandWindow::handleScreensChanged); + mSurface->m_window = this; } bool QWaylandWindow::shouldCreateShellSurface() const @@ -219,7 +223,7 @@ bool QWaylandWindow::shouldCreateSubSurface() const void QWaylandWindow::reset(bool sendDestroyEvent) { - if (isInitialized() && sendDestroyEvent) { + if (mSurface && sendDestroyEvent) { QPlatformSurfaceEvent e(QPlatformSurfaceEvent::SurfaceAboutToBeDestroyed); QGuiApplication::sendEvent(window(), &e); } @@ -227,11 +231,10 @@ void QWaylandWindow::reset(bool sendDestroyEvent) mShellSurface = nullptr; delete mSubSurfaceWindow; mSubSurfaceWindow = nullptr; - if (isInitialized()) { + if (mSurface) { emit wlSurfaceDestroyed(); - destroy(); + mSurface.reset(); } - mScreens.clear(); if (mFrameCallback) { wl_callback_destroy(mFrameCallback); @@ -244,7 +247,9 @@ void QWaylandWindow::reset(bool sendDestroyEvent) QWaylandWindow *QWaylandWindow::fromWlSurface(::wl_surface *surface) { - return static_cast(static_cast(wl_surface_get_user_data(surface))); + if (auto *s = QWaylandSurface::fromWlSurface(surface)) + return s->m_window; + return nullptr; } WId QWaylandWindow::winId() const @@ -372,7 +377,12 @@ void QWaylandWindow::closePopups(QWaylandWindow *parent) QWaylandScreen *QWaylandWindow::calculateScreenFromSurfaceEvents() const { - return mScreens.isEmpty() ? waylandScreen() : mScreens.first(); + if (mSurface) { + if (auto *screen = mSurface->oldestEnteredScreen()) + return screen; + } + + return waylandScreen(); } void QWaylandWindow::setVisible(bool visible) @@ -416,18 +426,18 @@ void QWaylandWindow::setMask(const QRegion &mask) mMask = mask; - if (!isInitialized()) + if (!mSurface) return; if (mMask.isEmpty()) { - set_input_region(nullptr); + mSurface->set_input_region(nullptr); } else { struct ::wl_region *region = mDisplay->createRegion(mMask); - set_input_region(region); + mSurface->set_input_region(region); wl_region_destroy(region); } - wl_surface::commit(); + mSurface->commit(); } void QWaylandWindow::applyConfigureWhenPossible() @@ -481,58 +491,6 @@ void QWaylandWindow::applyConfigure() QWindowSystemInterface::flushWindowSystemEvents(); } -void QWaylandWindow::surface_enter(wl_output *output) -{ - QWaylandScreen *oldScreen = calculateScreenFromSurfaceEvents(); - auto addedScreen = QWaylandScreen::fromWlOutput(output); - - if (mScreens.contains(addedScreen)) { - qCWarning(lcQpaWayland) - << "Ignoring unexpected wl_surface.enter received for output with id:" - << wl_proxy_get_id(reinterpret_cast(output)) - << "screen name:" << addedScreen->name() << "screen model:" << addedScreen->model() - << "This is most likely a bug in the compositor."; - return; - } - - mScreens.append(addedScreen); - - QWaylandScreen *newScreen = calculateScreenFromSurfaceEvents(); - if (oldScreen != newScreen) //currently this will only happen if the first wl_surface.enter is for a non-primary screen - handleScreenChanged(); -} - -void QWaylandWindow::surface_leave(wl_output *output) -{ - QWaylandScreen *oldScreen = calculateScreenFromSurfaceEvents(); - auto *removedScreen = QWaylandScreen::fromWlOutput(output); - bool wasRemoved = mScreens.removeOne(removedScreen); - if (!wasRemoved) { - qCWarning(lcQpaWayland) - << "Ignoring unexpected wl_surface.leave received for output with id:" - << wl_proxy_get_id(reinterpret_cast(output)) - << "screen name:" << removedScreen->name() - << "screen model:" << removedScreen->model() - << "This is most likely a bug in the compositor."; - return; - } - - QWaylandScreen *newScreen = calculateScreenFromSurfaceEvents(); - if (oldScreen != newScreen) - handleScreenChanged(); -} - -void QWaylandWindow::handleScreenRemoved(QScreen *qScreen) -{ - QWaylandScreen *oldScreen = calculateScreenFromSurfaceEvents(); - bool wasRemoved = mScreens.removeOne(static_cast(qScreen->handle())); - if (wasRemoved) { - QWaylandScreen *newScreen = calculateScreenFromSurfaceEvents(); - if (oldScreen != newScreen) - handleScreenChanged(); - } -} - void QWaylandWindow::attach(QWaylandBuffer *buffer, int x, int y) { Q_ASSERT(!buffer->committed()); @@ -542,14 +500,14 @@ void QWaylandWindow::attach(QWaylandBuffer *buffer, int x, int y) } if (buffer) { - mFrameCallback = frame(); + mFrameCallback = mSurface->frame(); wl_callback_add_listener(mFrameCallback, &QWaylandWindow::callbackListener, this); mWaitingForFrameSync = true; buffer->setBusy(); - attach(buffer->buffer(), x, y); + mSurface->attach(buffer->buffer(), x, y); } else { - QtWayland::wl_surface::attach(nullptr, 0, 0); + mSurface->attach(nullptr, 0, 0); } } @@ -561,7 +519,7 @@ void QWaylandWindow::attachOffset(QWaylandBuffer *buffer) void QWaylandWindow::damage(const QRect &rect) { - damage(rect.x(), rect.y(), rect.width(), rect.height()); + mSurface->damage(rect.x(), rect.y(), rect.width(), rect.height()); } void QWaylandWindow::safeCommit(QWaylandBuffer *buffer, const QRegion &damage) @@ -591,20 +549,20 @@ void QWaylandWindow::commit(QWaylandBuffer *buffer, const QRegion &damage) qCDebug(lcWaylandBackingstore) << "Buffer already committed, ignoring."; return; } - if (!isInitialized()) + if (!mSurface) return; attachOffset(buffer); for (const QRect &rect: damage) - wl_surface::damage(rect.x(), rect.y(), rect.width(), rect.height()); + mSurface->damage(rect.x(), rect.y(), rect.width(), rect.height()); Q_ASSERT(!buffer->committed()); buffer->setCommitted(); - wl_surface::commit(); + mSurface->commit(); } void QWaylandWindow::commit() { - wl_surface::commit(); + mSurface->commit(); } const wl_callback_listener QWaylandWindow::callbackListener = { @@ -660,6 +618,11 @@ QRect QWaylandWindow::windowGeometry() const return QRect(QPoint(), surfaceSize()); } +wl_surface *QWaylandWindow::wlSurface() +{ + return mSurface ? mSurface->object() : nullptr; +} + QWaylandShellSurface *QWaylandWindow::shellSurface() const { return mShellSurface; @@ -701,9 +664,9 @@ void QWaylandWindow::handleContentOrientationChange(Qt::ScreenOrientation orient default: Q_UNREACHABLE(); } - set_buffer_transform(transform); + mSurface->set_buffer_transform(transform); // set_buffer_transform is double buffered, we need to commit. - wl_surface::commit(); + mSurface->commit(); } void QWaylandWindow::setOrientationMask(Qt::ScreenOrientations mask) @@ -942,16 +905,21 @@ void QWaylandWindow::handleMouseEventWithDecoration(QWaylandInputDevice *inputDe } } -void QWaylandWindow::handleScreenChanged() +void QWaylandWindow::handleScreensChanged() { QWaylandScreen *newScreen = calculateScreenFromSurfaceEvents(); + + if (newScreen == mLastReportedScreen) + return; + QWindowSystemInterface::handleWindowScreenChanged(window(), newScreen->QPlatformScreen::screen()); + mLastReportedScreen = newScreen; int scale = newScreen->scale(); if (scale != mScale) { mScale = scale; - if (isInitialized() && mDisplay->compositorVersion() >= 3) - set_buffer_scale(mScale); + if (mSurface && mDisplay->compositorVersion() >= 3) + mSurface->set_buffer_scale(mScale); ensureSize(); } } diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index 43eaba64f70..30ff671f7db 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -79,8 +79,9 @@ class QWaylandInputDevice; class QWaylandScreen; class QWaylandShmBackingStore; class QWaylandPointerEvent; +class QWaylandSurface; -class Q_WAYLAND_CLIENT_EXPORT QWaylandWindow : public QObject, public QPlatformWindow, private QtWayland::wl_surface +class Q_WAYLAND_CLIENT_EXPORT QWaylandWindow : public QObject, public QPlatformWindow { Q_OBJECT public: @@ -108,12 +109,10 @@ public: void applyConfigureWhenPossible(); //rename to possible? - using QtWayland::wl_surface::attach; void attach(QWaylandBuffer *buffer, int x, int y); void attachOffset(QWaylandBuffer *buffer); QPoint attachOffset() const; - using QtWayland::wl_surface::damage; void damage(const QRect &rect); void safeCommit(QWaylandBuffer *buffer, const QRegion &damage); @@ -128,7 +127,7 @@ public: QSize surfaceSize() const; QRect windowGeometry() const; - ::wl_surface *wlSurface() { return object(); } + ::wl_surface *wlSurface(); static QWaylandWindow *fromWlSurface(::wl_surface *surface); QWaylandDisplay *display() const { return mDisplay; } @@ -203,11 +202,8 @@ signals: void wlSurfaceDestroyed(); protected: - void surface_enter(struct ::wl_output *output) override; - void surface_leave(struct ::wl_output *output) override; - - QVector mScreens; //As seen by wl_surface.enter/leave events. Chronological order. QWaylandDisplay *mDisplay = nullptr; + QScopedPointer mSurface; QWaylandShellSurface *mShellSurface = nullptr; QWaylandSubSurface *mSubSurfaceWindow = nullptr; QVector mChildren; @@ -231,6 +227,7 @@ protected: bool mSentInitialResize = false; QPoint mOffset; int mScale = 1; + QWaylandScreen *mLastReportedScreen = nullptr; QIcon mWindowIcon; @@ -242,9 +239,6 @@ protected: QWaylandBuffer *mQueuedBuffer = nullptr; QRegion mQueuedBufferDamage; -private slots: - void handleScreenRemoved(QScreen *qScreen); - private: void setGeometry_helper(const QRect &rect); void initWindow(); @@ -257,7 +251,7 @@ private: QWaylandScreen *calculateScreenFromSurfaceEvents() const; void handleMouseEventWithDecoration(QWaylandInputDevice *inputDevice, const QWaylandPointerEvent &e); - void handleScreenChanged(); + void handleScreensChanged(); bool mUpdateRequested = false; QRect mLastExposeGeometry; From b384628f8bb151c13d59befb2c05929e3ab69687 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Fri, 5 Apr 2019 14:36:57 +0200 Subject: [PATCH 0676/1507] Client: Make CursorSurface inherit from QWaylandSurface QWaylandSurface has now been decoupled from QWaylandWindow so we can share some implementation with it and get rid of a lot of duplication. Task-number: QTBUG-74373 Change-Id: Ieb9aa3a5cf11abe381b7cf407122d3ca7a9251fc Reviewed-by: Giulio Camuffo --- .../platforms/wayland/qwaylandinputdevice.cpp | 44 +++---------------- 1 file changed, 6 insertions(+), 38 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index 711f5b422c9..daad6f15c26 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -41,6 +41,7 @@ #include "qwaylandintegration_p.h" #include "qwaylandwindow_p.h" +#include "qwaylandsurface_p.h" #include "qwaylandbuffer_p.h" #if QT_CONFIG(wayland_datadevice) #include "qwaylanddatadevice_p.h" @@ -190,23 +191,17 @@ QWaylandInputDevice::Pointer::~Pointer() #if QT_CONFIG(cursor) -class CursorSurface : public QObject, public QtWayland::wl_surface +class CursorSurface : public QWaylandSurface { public: explicit CursorSurface(QWaylandInputDevice::Pointer *pointer, QWaylandDisplay *display) - : m_pointer(pointer) + : QWaylandSurface(display) + , m_pointer(pointer) { - init(display->createSurface(this)); //TODO: When we upgrade to libwayland 1.10, use wl_surface_get_version instead. m_version = display->compositorVersion(); - connect(qApp, &QGuiApplication::screenRemoved, this, [this](QScreen *screen) { - int oldScale = outputScale(); - if (!m_screens.removeOne(static_cast(screen->handle()))) - return; - - if (outputScale() != oldScale) - m_pointer->updateCursor(); - }); + connect(this, &QWaylandSurface::screensChanged, + m_pointer, &QWaylandInputDevice::Pointer::updateCursor); } void hide() @@ -246,38 +241,11 @@ public: return scale; } -protected: - void surface_enter(struct ::wl_output *output) override - { - int oldScale = outputScale(); - auto *screen = QWaylandScreen::fromWlOutput(output); - if (m_screens.contains(screen)) - return; - - m_screens.append(screen); - - if (outputScale() != oldScale) - m_pointer->updateCursor(); - } - - void surface_leave(struct ::wl_output *output) override - { - int oldScale = outputScale(); - auto *screen = QWaylandScreen::fromWlOutput(output); - - if (!m_screens.removeOne(screen)) - return; - - if (outputScale() != oldScale) - m_pointer->updateCursor(); - } - private: QWaylandInputDevice::Pointer *m_pointer = nullptr; uint m_version = 0; uint m_setSerial = 0; QPoint m_hotspot; - QVector m_screens; }; QString QWaylandInputDevice::Pointer::cursorThemeName() const From 637e03a6f335a7b0a0a385efb985820855a42ab7 Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Thu, 11 Apr 2019 03:58:06 +0100 Subject: [PATCH 0677/1507] Client: Avoid shadowing QPlatformWindow::windowGeometry windowGeometry is an existing method in QPlatformWindow with an entirely different meaning to the newly added QWaylandWindow::windowGeometry. This led to the existing call in resizeFromApplyConfigure calling the wrong method. Change-Id: Ib344cf09178e77e5b4d5427325d840346663ec9d Reviewed-by: Johan Helsing --- .../wayland/plugins/decorations/bradient/main.cpp | 12 ++++++------ src/plugins/platforms/wayland/qwaylandwindow.cpp | 6 +++--- src/plugins/platforms/wayland/qwaylandwindow_p.h | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp b/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp index 96ad261b2dc..e8e35775e58 100644 --- a/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp +++ b/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp @@ -109,21 +109,21 @@ QWaylandBradientDecoration::QWaylandBradientDecoration() QRectF QWaylandBradientDecoration::closeButtonRect() const { - const int windowRight = waylandWindow()->windowGeometry().right() + 1; + const int windowRight = waylandWindow()->windowContentGeometry().right() + 1; return QRectF(windowRight - BUTTON_WIDTH - BUTTON_SPACING * 0 - BUTTONS_RIGHT_MARGIN, (margins().top() - BUTTON_WIDTH) / 2, BUTTON_WIDTH, BUTTON_WIDTH); } QRectF QWaylandBradientDecoration::maximizeButtonRect() const { - const int windowRight = waylandWindow()->windowGeometry().right() + 1; + const int windowRight = waylandWindow()->windowContentGeometry().right() + 1; return QRectF(windowRight - BUTTON_WIDTH * 2 - BUTTON_SPACING * 1 - BUTTONS_RIGHT_MARGIN, (margins().top() - BUTTON_WIDTH) / 2, BUTTON_WIDTH, BUTTON_WIDTH); } QRectF QWaylandBradientDecoration::minimizeButtonRect() const { - const int windowRight = waylandWindow()->windowGeometry().right() + 1; + const int windowRight = waylandWindow()->windowContentGeometry().right() + 1; return QRectF(windowRight - BUTTON_WIDTH * 3 - BUTTON_SPACING * 2 - BUTTONS_RIGHT_MARGIN, (margins().top() - BUTTON_WIDTH) / 2, BUTTON_WIDTH, BUTTON_WIDTH); } @@ -136,7 +136,7 @@ QMargins QWaylandBradientDecoration::margins() const void QWaylandBradientDecoration::paint(QPaintDevice *device) { bool active = window()->handle()->isActive(); - QRect wg = waylandWindow()->windowGeometry(); + QRect wg = waylandWindow()->windowContentGeometry(); QRect clips[] = { QRect(wg.left(), wg.top(), wg.width(), margins().top()), @@ -267,7 +267,7 @@ bool QWaylandBradientDecoration::handleMouse(QWaylandInputDevice *inputDevice, c Q_UNUSED(global); // Figure out what area mouse is in - QRect wg = waylandWindow()->windowGeometry(); + QRect wg = waylandWindow()->windowContentGeometry(); if (local.y() <= wg.top() + margins().top()) { processMouseTop(inputDevice,local,b,mods); } else if (local.y() > wg.bottom() - margins().bottom()) { @@ -312,7 +312,7 @@ bool QWaylandBradientDecoration::handleTouch(QWaylandInputDevice *inputDevice, c void QWaylandBradientDecoration::processMouseTop(QWaylandInputDevice *inputDevice, const QPointF &local, Qt::MouseButtons b, Qt::KeyboardModifiers mods) { - QRect wg = waylandWindow()->windowGeometry(); + QRect wg = waylandWindow()->windowContentGeometry(); Q_UNUSED(mods); if (local.y() <= wg.top() + margins().bottom()) { if (local.x() <= margins().left()) { diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 20a671c6c6a..2a08677655d 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -334,7 +334,7 @@ void QWaylandWindow::setGeometry(const QRect &rect) sendExposeEvent(exposeGeometry); if (mShellSurface) - mShellSurface->setWindowGeometry(windowGeometry()); + mShellSurface->setWindowGeometry(windowContentGeometry()); } void QWaylandWindow::resizeFromApplyConfigure(const QSize &sizeWithMargins, const QPoint &offset) @@ -655,7 +655,7 @@ QSize QWaylandWindow::surfaceSize() const * Window geometry as defined by the xdg-shell spec (in wl_surface coordinates) * topLeft is where the shadow stops and the decorations border start. */ -QRect QWaylandWindow::windowGeometry() const +QRect QWaylandWindow::windowContentGeometry() const { return QRect(QPoint(), surfaceSize()); } @@ -854,7 +854,7 @@ void QWaylandWindow::handleMouse(QWaylandInputDevice *inputDevice, const QWaylan #if QT_CONFIG(cursor) if (e.type == QWaylandPointerEvent::Enter) { - QRect contentGeometry = windowGeometry().marginsRemoved(frameMargins()); + QRect contentGeometry = windowContentGeometry().marginsRemoved(frameMargins()); if (contentGeometry.contains(e.local.toPoint())) restoreMouseCursor(inputDevice); } diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index 8999682d91a..7ab0ca74e8f 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -126,7 +126,7 @@ public: QMargins frameMargins() const override; QSize surfaceSize() const; - QRect windowGeometry() const; + QRect windowContentGeometry() const; static QWaylandWindow *fromWlSurface(::wl_surface *surface); From e61e037f4d96882cfa986176ff028477498c38d6 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Thu, 11 Apr 2019 13:43:07 +0200 Subject: [PATCH 0678/1507] Fix incorrect path to wl-eglstream-controller.xml Change-Id: I1d4bceeb87b7e95b7b4b9c9885e06052bd7536e9 Reviewed-by: Paul Olav Tvete --- src/3rdparty/wayland/protocols/qt_attribution.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/3rdparty/wayland/protocols/qt_attribution.json b/src/3rdparty/wayland/protocols/qt_attribution.json index 7881e6b0de5..051bd3f95c9 100644 --- a/src/3rdparty/wayland/protocols/qt_attribution.json +++ b/src/3rdparty/wayland/protocols/qt_attribution.json @@ -110,7 +110,7 @@ Copyright © 2015, 2016 Jan Arne Petersen" "Name": "Wayland EGLStream Controller Protocol", "QDocModule": "qtwaylandcompositor", "QtUsage": "Used in the Qt Wayland Compositor", - "Files": "wayland-eglstream-controller.xml", + "Files": "wl-eglstream-controller.xml", "Description": "Allows clients to request that the compositor creates its EGLStream.", "Homepage": "https://github.com/NVIDIA/egl-wayland", From 95469e731cfd7382df54e5497adc0c47ae443b88 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Wed, 10 Apr 2019 12:47:40 +0200 Subject: [PATCH 0679/1507] tst_xdgshell::showMinimized: Really make sure the window was created The surface(), may be a leftover cursor surface from earlier tests. Check for an xdgSurface instead, as those are verified to be cleaned up between tests. Change-Id: I6a2b402130814e896d335787fcb90fd8d57cafb7 Reviewed-by: Paul Olav Tvete --- tests/auto/wayland/xdgshell/tst_xdgshell.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/wayland/xdgshell/tst_xdgshell.cpp b/tests/auto/wayland/xdgshell/tst_xdgshell.cpp index 6efffc8a4b6..dc463e38f63 100644 --- a/tests/auto/wayland/xdgshell/tst_xdgshell.cpp +++ b/tests/auto/wayland/xdgshell/tst_xdgshell.cpp @@ -62,7 +62,7 @@ void tst_xdgshell::showMinimized() // Make sure the window on the compositor side is/was created here, and not after the test // finishes, as that may mess up for later tests. - QCOMPOSITOR_TRY_VERIFY(surface()); + QCOMPOSITOR_TRY_VERIFY(xdgSurface()); QVERIFY(!window.isExposed()); } From 17512700761372e84637f3695a973cab3f78dd61 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Wed, 10 Apr 2019 12:44:06 +0200 Subject: [PATCH 0680/1507] Client tests: Fix tst_xdgShell::pongs when run as the only test The shell integration is initialized lazily, so it's not possible to send ping events to the client before the first window has been initialized. This adds a simple window to the pong test. Change-Id: I13b4a9cb802b7abe18bfc23cf8c75eb873ded3ca Reviewed-by: Paul Olav Tvete --- tests/auto/wayland/xdgshell/tst_xdgshell.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tests/auto/wayland/xdgshell/tst_xdgshell.cpp b/tests/auto/wayland/xdgshell/tst_xdgshell.cpp index dc463e38f63..9b18abdc30d 100644 --- a/tests/auto/wayland/xdgshell/tst_xdgshell.cpp +++ b/tests/auto/wayland/xdgshell/tst_xdgshell.cpp @@ -423,9 +423,16 @@ void tst_xdgshell::switchPopups() void tst_xdgshell::pongs() { - QSignalSpy pongSpy(exec([=] { return get(); }), &XdgWmBase::pong); + // Create and show a window to trigger shell integration initialzation, + // otherwise we don't have anything to send ping events to. + QRasterWindow window; + window.resize(200, 200); + window.show(); + // Verify that the client has bound to the global QCOMPOSITOR_TRY_COMPARE(get()->resourceMap().size(), 1); + + QSignalSpy pongSpy(exec([=] { return get(); }), &XdgWmBase::pong); const uint serial = exec([=] { return nextSerial(); }); exec([=] { auto *base = get(); From 9a782df3e7f6f937a1bae3fa5e964a29fbe5980b Mon Sep 17 00:00:00 2001 From: Gatis Paeglis Date: Thu, 13 Dec 2018 12:14:59 +0100 Subject: [PATCH 0681/1507] client: rework input method handling The existing solution was parsing compose tables on startup, it is better to lazy initialize the compose table/state on a first key press, instead of doing it on an application startup. This logic is inside of the compose input plugin. The existing code did not utilize correctly how Qt handles complex text input. It used libxkbcommon-compose APIs to compose user input and then passed the same input again to QPlatformInputContext (from QWaylandInputDevice::Keyboard::sendKey), which was erroneous. This also means that code was forcing "xkb compose", and did not respect QT_IM_MODULE at client-side. From commit that added compose key handling (dd13698a730594d9f40baa367dcfe05bc23f1016): "We should expand on it in the future to handle things like resetting the compose state on text field switching". This is now handled by properly utilizing Qt IM framework. Converted QWaylandInputDevice::Keyboard::sendKey into a class member function to avoid adding one more arg (mXkbContext) to the already long argument list. That whole function should be simplified, but that is out-of-scope for this patch. The reworked code uses qxkbcommon support library to reduce code duplication between platforms and to unify behavior. Some users might mistakenly think that this patch introduces a regression with Qt on KDE, but it is actually a KWin/Wayland compositor bug: https://bugs.kde.org/show_bug.cgi?id=405388 The work around on KDE is to use QT_IM_MODULE at client-side to select input method, as KWin compositor over the wire supports only the qtvirtualkeyboard module. Setting this envvar is not someting out of the ordinary for users on Linux. Input method handling at compositor-side is new feature and clearly not very well supported yet. Task-number: QTBUG-65503 Change-Id: Ie511d950396fa2fb6cbe6672996cee9791f3ab11 Reviewed-by: Johan Helsing --- src/plugins/platforms/wayland/client.pro | 5 +- .../platforms/wayland/qwaylanddisplay.cpp | 12 +- .../platforms/wayland/qwaylanddisplay_p.h | 8 + .../platforms/wayland/qwaylandinputdevice.cpp | 85 ++------ .../platforms/wayland/qwaylandinputdevice_p.h | 16 +- .../platforms/wayland/qwaylandintegration.cpp | 54 +++-- .../platforms/wayland/qwaylandintegration_p.h | 2 + tests/auto/wayland/client.pro | 2 + .../wayland/inputcontext/inputcontext.pro | 6 + .../wayland/inputcontext/tst_inputcontext.cpp | 184 ++++++++++++++++++ tests/auto/wayland/shared/shared.pri | 9 +- tests/auto/wayland/shared/textinput.cpp | 45 +++++ tests/auto/wayland/shared/textinput.h | 51 +++++ 13 files changed, 376 insertions(+), 103 deletions(-) create mode 100644 tests/auto/wayland/inputcontext/inputcontext.pro create mode 100644 tests/auto/wayland/inputcontext/tst_inputcontext.cpp create mode 100644 tests/auto/wayland/shared/textinput.cpp create mode 100644 tests/auto/wayland/shared/textinput.h diff --git a/src/plugins/platforms/wayland/client.pro b/src/plugins/platforms/wayland/client.pro index 38d0ac3e1b6..9f7d979dcd5 100644 --- a/src/plugins/platforms/wayland/client.pro +++ b/src/plugins/platforms/wayland/client.pro @@ -15,8 +15,9 @@ use_gold_linker: CONFIG += no_linker_version_script CONFIG -= precompile_header CONFIG += link_pkgconfig wayland-scanner -qtConfig(xkbcommon): \ - QMAKE_USE_PRIVATE += xkbcommon +qtConfig(xkbcommon) { + QT_PRIVATE += xkbcommon_support-private +} qtHaveModule(linuxaccessibility_support_private): \ QT += linuxaccessibility_support_private diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index 5b1b9bffb76..22a79124da7 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -266,11 +266,11 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin mTouchExtension.reset(new QWaylandTouchExtension(this, id)); } else if (interface == QStringLiteral("zqt_key_v1")) { mQtKeyExtension.reset(new QWaylandQtKeyExtension(this, id)); - } else if (interface == QStringLiteral("zwp_text_input_manager_v2")) { + } else if (interface == QStringLiteral("zwp_text_input_manager_v2") && !mClientSideInputContextRequested) { mTextInputManager.reset(new QtWayland::zwp_text_input_manager_v2(registry, id, 1)); - foreach (QWaylandInputDevice *inputDevice, mInputDevices) { + for (QWaylandInputDevice *inputDevice : qAsConst(mInputDevices)) inputDevice->setTextInput(new QWaylandTextInput(this, mTextInputManager->get_text_input(inputDevice->wl_seat()))); - } + mWaylandIntegration->reconfigureInputContext(); } else if (interface == QStringLiteral("qt_hardware_integration")) { bool disableHardwareIntegration = qEnvironmentVariableIntValue("QT_WAYLAND_DISABLE_HW_INTEGRATION"); if (!disableHardwareIntegration) { @@ -306,6 +306,12 @@ void QWaylandDisplay::registry_global_remove(uint32_t id) } } } + if (global.interface == QStringLiteral("zwp_text_input_manager_v2")) { + mTextInputManager.reset(); + for (QWaylandInputDevice *inputDevice : qAsConst(mInputDevices)) + inputDevice->setTextInput(nullptr); + mWaylandIntegration->reconfigureInputContext(); + } mGlobals.removeAt(i); break; } diff --git a/src/plugins/platforms/wayland/qwaylanddisplay_p.h b/src/plugins/platforms/wayland/qwaylanddisplay_p.h index 4a98b935bb6..836ee0f9af2 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay_p.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay_p.h @@ -63,6 +63,8 @@ #include #include +#include + struct wl_cursor_image; QT_BEGIN_NAMESPACE @@ -144,6 +146,7 @@ public: QWaylandHardwareIntegration *hardwareIntegration() const { return mHardwareIntegration.data(); } QtWayland::zxdg_output_manager_v1 *xdgOutputManager() const { return mXdgOutputManager.data(); } + bool usingInputContextFromCompositor() const { return mUsingInputContextFromCompositor; } struct RegistryGlobal { uint32_t id; @@ -237,8 +240,13 @@ private: struct wl_callback *mSyncCallback = nullptr; static const wl_callback_listener syncCallbackListener; + bool mClientSideInputContextRequested = !QPlatformInputContextFactory::requested().isNull(); + bool mUsingInputContextFromCompositor = false; + void registry_global(uint32_t id, const QString &interface, uint32_t version) override; void registry_global_remove(uint32_t id) override; + + friend class QWaylandIntegration; }; } diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index 2ae2caca223..f31ab274571 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -71,7 +71,7 @@ #include #if QT_CONFIG(xkbcommon) -#include +#include #endif QT_BEGIN_NAMESPACE @@ -110,7 +110,7 @@ bool QWaylandInputDevice::Keyboard::createDefaultKeyMap() qWarning() << "xkb_map_new_from_names failed, no key input"; return false; } - createComposeState(); + return true; } @@ -123,41 +123,11 @@ void QWaylandInputDevice::Keyboard::releaseKeyMap() if (mXkbContext) xkb_context_unref(mXkbContext); } - -void QWaylandInputDevice::Keyboard::createComposeState() -{ - static const char *locale = nullptr; - if (!locale) { - locale = getenv("LC_ALL"); - if (!locale) - locale = getenv("LC_CTYPE"); - if (!locale) - locale = getenv("LANG"); - if (!locale) - locale = "C"; - } - - mXkbComposeTable = xkb_compose_table_new_from_locale(mXkbContext, locale, XKB_COMPOSE_COMPILE_NO_FLAGS); - if (mXkbComposeTable) - mXkbComposeState = xkb_compose_state_new(mXkbComposeTable, XKB_COMPOSE_STATE_NO_FLAGS); -} - -void QWaylandInputDevice::Keyboard::releaseComposeState() -{ - if (mXkbComposeState) - xkb_compose_state_unref(mXkbComposeState); - if (mXkbComposeTable) - xkb_compose_table_unref(mXkbComposeTable); - mXkbComposeState = nullptr; - mXkbComposeTable = nullptr; -} - #endif QWaylandInputDevice::Keyboard::~Keyboard() { #if QT_CONFIG(xkbcommon) - releaseComposeState(); releaseKeyMap(); #endif if (mFocus) @@ -396,9 +366,9 @@ QWaylandInputDevice::QWaylandInputDevice(QWaylandDisplay *display, int version, } #endif - if (mQDisplay->textInputManager()) { - mTextInput = new QWaylandTextInput(mQDisplay, mQDisplay->textInputManager()->get_text_input(wl_seat())); - } + if (mQDisplay->textInputManager()) + mTextInput.reset(new QWaylandTextInput(mQDisplay, mQDisplay->textInputManager()->get_text_input(wl_seat()))); + } QWaylandInputDevice::~QWaylandInputDevice() @@ -481,12 +451,12 @@ QWaylandDataDevice *QWaylandInputDevice::dataDevice() const void QWaylandInputDevice::setTextInput(QWaylandTextInput *textInput) { - mTextInput = textInput; + mTextInput.reset(textInput); } QWaylandTextInput *QWaylandInputDevice::textInput() const { - return mTextInput; + return mTextInput.data(); } void QWaylandInputDevice::removeMouseButtonFromState(Qt::MouseButton button) @@ -793,7 +763,6 @@ void QWaylandInputDevice::Keyboard::keyboard_keymap(uint32_t format, int32_t fd, // Release the old keymap resources in the case they were already created in // the key event or when the compositor issues a new map - releaseComposeState(); releaseKeyMap(); mXkbContext = xkb_context_new(XKB_CONTEXT_NO_FLAGS); @@ -802,8 +771,6 @@ void QWaylandInputDevice::Keyboard::keyboard_keymap(uint32_t format, int32_t fd, close(fd); mXkbState = xkb_state_new(mXkbMap); - createComposeState(); - #else Q_UNUSED(format); Q_UNUSED(fd); @@ -852,16 +819,17 @@ void QWaylandInputDevice::Keyboard::keyboard_leave(uint32_t time, struct wl_surf handleFocusLost(); } -static void sendKey(QWindow *tlw, ulong timestamp, QEvent::Type type, int key, Qt::KeyboardModifiers modifiers, - quint32 nativeScanCode, quint32 nativeVirtualKey, quint32 nativeModifiers, - const QString& text = QString(), bool autorep = false, ushort count = 1) +void QWaylandInputDevice::Keyboard::sendKey(QWindow *tlw, ulong timestamp, QEvent::Type type, int key, + Qt::KeyboardModifiers modifiers, quint32 nativeScanCode, + quint32 nativeVirtualKey, quint32 nativeModifiers, + const QString& text, bool autorep, ushort count) { QPlatformInputContext *inputContext = QGuiApplicationPrivate::platformIntegration()->inputContext(); bool filtered = false; - if (inputContext) { - QKeyEvent event(type, key, modifiers, nativeScanCode, nativeVirtualKey, nativeModifiers, - text, autorep, count); + if (inputContext && !mParent->mQDisplay->usingInputContextFromCompositor()) { + QKeyEvent event(type, key, modifiers, nativeScanCode, nativeVirtualKey, + nativeModifiers, text, autorep, count); event.setTimestamp(timestamp); filtered = inputContext->filterEvent(&event); } @@ -896,37 +864,12 @@ void QWaylandInputDevice::Keyboard::keyboard_key(uint32_t serial, uint32_t time, return; } - QString composedText; xkb_keysym_t sym = xkb_state_key_get_one_sym(mXkbState, code); - if (mXkbComposeState) { - if (isDown) - xkb_compose_state_feed(mXkbComposeState, sym); - xkb_compose_status status = xkb_compose_state_get_status(mXkbComposeState); - - switch (status) { - case XKB_COMPOSE_COMPOSED: { - int size = xkb_compose_state_get_utf8(mXkbComposeState, nullptr, 0); - QVarLengthArray buffer(size + 1); - xkb_compose_state_get_utf8(mXkbComposeState, buffer.data(), buffer.size()); - composedText = QString::fromUtf8(buffer.constData()); - sym = xkb_compose_state_get_one_sym(mXkbComposeState); - xkb_compose_state_reset(mXkbComposeState); - } break; - case XKB_COMPOSE_COMPOSING: - case XKB_COMPOSE_CANCELLED: - return; - case XKB_COMPOSE_NOTHING: - break; - } - } Qt::KeyboardModifiers modifiers = mParent->modifiers(); std::tie(qtkey, text) = QWaylandXkb::keysymToQtKey(sym, modifiers); - if (!composedText.isNull()) - text = composedText; - sendKey(window->window(), time, type, qtkey, modifiers, code, sym, mNativeModifiers, text); #else // Generic fallback for single hard keys: Assume 'key' is a Qt key code. diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h index 50b1af385a9..4149e500556 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h +++ b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h @@ -54,6 +54,7 @@ #include #include +#include #include #include #include @@ -75,11 +76,6 @@ struct wl_cursor_image; #endif -#if QT_CONFIG(xkbcommon) -struct xkb_compose_state; -struct xkb_compose_table; -#endif - QT_BEGIN_NAMESPACE namespace QtWaylandClient { @@ -164,7 +160,7 @@ private: Pointer *mPointer = nullptr; Touch *mTouch = nullptr; - QWaylandTextInput *mTextInput = nullptr; + QScopedPointer mTextInput; uint32_t mTime = 0; uint32_t mSerial = 0; @@ -217,8 +213,6 @@ public: xkb_context *mXkbContext = nullptr; xkb_keymap *mXkbMap = nullptr; xkb_state *mXkbState = nullptr; - xkb_compose_table *mXkbComposeTable = nullptr; - xkb_compose_state *mXkbComposeState = nullptr; #endif uint32_t mNativeModifiers = 0; @@ -244,10 +238,10 @@ private: #if QT_CONFIG(xkbcommon) bool createDefaultKeyMap(); void releaseKeyMap(); - void createComposeState(); - void releaseComposeState(); #endif - + void sendKey(QWindow *tlw, ulong timestamp, QEvent::Type type, int key, Qt::KeyboardModifiers modifiers, + quint32 nativeScanCode, quint32 nativeVirtualKey, quint32 nativeModifiers, + const QString& text = QString(), bool autorep = false, ushort count = 1); }; class Q_WAYLAND_CLIENT_EXPORT QWaylandInputDevice::Pointer : public QObject, public QtWayland::wl_pointer diff --git a/src/plugins/platforms/wayland/qwaylandintegration.cpp b/src/plugins/platforms/wayland/qwaylandintegration.cpp index 45957629f77..8bfe3b6fc82 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandintegration.cpp @@ -90,6 +90,10 @@ #include #endif +#if QT_CONFIG(xkbcommon) +#include +#endif + QT_BEGIN_NAMESPACE namespace QtWaylandClient { @@ -146,20 +150,8 @@ QWaylandIntegration::QWaylandIntegration() #if QT_CONFIG(draganddrop) mDrag.reset(new QWaylandDrag(mDisplay.data())); #endif - QString icStr = QPlatformInputContextFactory::requested(); - if (!icStr.isNull()) { - mInputContext.reset(QPlatformInputContextFactory::create(icStr)); - } else { - //try to use the input context using the wl_text_input interface - QPlatformInputContext *ctx = new QWaylandInputContext(mDisplay.data()); - mInputContext.reset(ctx); - //use the traditional way for on screen keyboards for now - if (!mInputContext.data()->isValid()) { - ctx = QPlatformInputContextFactory::create(); - mInputContext.reset(ctx); - } - } + reconfigureInputContext(); } QWaylandIntegration::~QWaylandIntegration() @@ -462,6 +454,42 @@ void QWaylandIntegration::initializeInputDeviceIntegration() } } +void QWaylandIntegration::reconfigureInputContext() +{ + if (!mDisplay) { + // This function can be called from QWaylandDisplay::registry_global() when we + // are in process of constructing QWaylandDisplay. Configuring input context + // in that case is done by calling reconfigureInputContext() from QWaylandIntegration + // constructor, after QWaylandDisplay has been constructed. + return; + } + + const QString &requested = QPlatformInputContextFactory::requested(); + if (requested == QLatin1String("qtvirtualkeyboard")) + qCWarning(lcQpaWayland) << "qtvirtualkeyboard currently is not supported at client-side," + " use QT_IM_MODULE=qtvirtualkeyboard at compositor-side."; + + if (requested.isNull()) + mInputContext.reset(new QWaylandInputContext(mDisplay.data())); + else + mInputContext.reset(QPlatformInputContextFactory::create(requested)); + + const QString defaultInputContext(QStringLiteral("compose")); + if ((!mInputContext || !mInputContext->isValid()) && requested != defaultInputContext) + mInputContext.reset(QPlatformInputContextFactory::create(defaultInputContext)); + +#if QT_CONFIG(xkbcommon) + QXkbCommon::setXkbContext(mInputContext.data(), xkb_context_new(XKB_CONTEXT_NO_FLAGS)); +#endif + + // Even if compositor-side input context handling has been requested, we fallback to + // client-side handling if compositor does not provide the text-input extension. This + // is why we need to check here which input context actually is being used. + mDisplay->mUsingInputContextFromCompositor = qobject_cast(mInputContext.data()); + + qCDebug(lcQpaWayland) << "using input method:" << inputContext()->metaObject()->className(); +} + QWaylandShellIntegration *QWaylandIntegration::createShellIntegration(const QString &integrationName) { if (QWaylandShellIntegrationFactory::keys().contains(integrationName)) { diff --git a/src/plugins/platforms/wayland/qwaylandintegration_p.h b/src/plugins/platforms/wayland/qwaylandintegration_p.h index 944f635bbfb..5e6f16d09f1 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration_p.h +++ b/src/plugins/platforms/wayland/qwaylandintegration_p.h @@ -116,6 +116,8 @@ public: virtual QWaylandServerBufferIntegration *serverBufferIntegration() const; virtual QWaylandShellIntegration *shellIntegration() const; + void reconfigureInputContext(); + private: // NOTE: mDisplay *must* be destructed after mDrag and mClientBufferIntegration // and mShellIntegration. diff --git a/tests/auto/wayland/client.pro b/tests/auto/wayland/client.pro index e99db20ba4f..051cb4e3d13 100644 --- a/tests/auto/wayland/client.pro +++ b/tests/auto/wayland/client.pro @@ -12,3 +12,5 @@ SUBDIRS += \ xdgoutput \ xdgshell \ xdgshellv6 + +qtConfig(im): SUBDIRS += inputcontext diff --git a/tests/auto/wayland/inputcontext/inputcontext.pro b/tests/auto/wayland/inputcontext/inputcontext.pro new file mode 100644 index 00000000000..4419b3e77ad --- /dev/null +++ b/tests/auto/wayland/inputcontext/inputcontext.pro @@ -0,0 +1,6 @@ +include (../shared/shared.pri) + +QT += waylandcompositor + +TARGET = tst_inputcontext +SOURCES += tst_inputcontext.cpp diff --git a/tests/auto/wayland/inputcontext/tst_inputcontext.cpp b/tests/auto/wayland/inputcontext/tst_inputcontext.cpp new file mode 100644 index 00000000000..b1a5a7f17f8 --- /dev/null +++ b/tests/auto/wayland/inputcontext/tst_inputcontext.cpp @@ -0,0 +1,184 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "mockcompositor.h" +#include "textinput.h" + +#include +#include + +#include +#include +#include +#include + +#include + +using namespace MockCompositor; + +class tst_inputcontext : public QObject, private DefaultCompositor +{ + Q_OBJECT +private slots: + void initTestCase(); + void selectingInputContext_data(); + void selectingInputContext(); + void inputContextReconfigurationWhenTogglingTextInputExtension(); + +private: + QByteArray inputContextName() const; + void ensureTextInputPresentOnCompositor(); + void ensureTextInputNotPresentOnCompositor(); + + QByteArray mComposeModule = QByteArray("QComposeInputContext"); // default input context + QByteArray mIbusModule = QByteArray("QIBusPlatformInputContext"); + QByteArray mWaylandModule = QByteArray("QtWaylandClient::QWaylandInputContext"); + + TextInputManager *mTextInputManager = nullptr; +}; + +void tst_inputcontext::initTestCase() +{ + // Verify that plugins are present and valid + QPlatformInputContext *context = QPlatformInputContextFactory::create(QStringLiteral("compose")); + QVERIFY(context && context->isValid()); + + context = QPlatformInputContextFactory::create(QStringLiteral("ibus")); + // The ibus plugin depends on properly configured system services, if plugin is not valid + // verify that wayland qpa plugin properly fallbacks to default input context. + if (!context || !context->isValid()) + mIbusModule = mComposeModule; +} + +QByteArray tst_inputcontext::inputContextName() const +{ + QPlatformIntegration *platformIntegration = QGuiApplicationPrivate::platformIntegration(); + if (platformIntegration->inputContext()) + return platformIntegration->inputContext()->metaObject()->className(); + + return QByteArray(""); +} + +void tst_inputcontext::ensureTextInputPresentOnCompositor() +{ + exec([&] { + QVector extensions = getAll(); + if (extensions.length() > 1) + QFAIL("TextInputManager is a singleton, hence there should not be more then one object returned"); + if (extensions.length() == 0) + add(); + }); +} + +void tst_inputcontext::ensureTextInputNotPresentOnCompositor() +{ + exec([&] { + QVector extensions = getAll(); + if (extensions.length() > 1) + QFAIL("TextInputManager is a singleton, hence there should not be more then one object returned"); + if (extensions.length() == 1) + remove(extensions.first()); + }); +} + +void tst_inputcontext::selectingInputContext_data() +{ + QTest::addColumn("requestedModule"); + QTest::addColumn("expectedModule"); + + // Test compositor without Text Input extension + QTest::newRow("ibus") << QByteArray("ibus") << mIbusModule; + QTest::newRow("compose") << QByteArray("compose") << mComposeModule; + QTest::newRow("empty") << QByteArray("") << mComposeModule; + QTest::newRow("null") << QByteArray() << mComposeModule; + QTest::newRow("fake") << QByteArray("fake") << mComposeModule; + + // Test compositor with Text Input extension + QTest::newRow("ibus:text-input") << QByteArray("ibus") << mIbusModule; + QTest::newRow("compose:text-input") << QByteArray("compose") << mComposeModule; + QTest::newRow("empty:text-input") << QByteArray("") << mComposeModule; + QTest::newRow("null:text-input") << QByteArray() << mWaylandModule; + QTest::newRow("fake:text-input") << QByteArray("fake") << mComposeModule; +} + +void tst_inputcontext::selectingInputContext() +{ + QFETCH(QByteArray, requestedModule); + QFETCH(QByteArray, expectedModule); + + if (requestedModule.isNull()) + qunsetenv("QT_IM_MODULE"); + else + qputenv("QT_IM_MODULE", requestedModule); + + const bool withTextInputAtCompositorSide = QByteArray(QTest::currentDataTag()).endsWith(":text-input"); + + if (withTextInputAtCompositorSide) + ensureTextInputPresentOnCompositor(); + else + ensureTextInputNotPresentOnCompositor(); + + int argc = 0; + QGuiApplication app(argc, nullptr); // loads the platform plugin + + QCOMPARE(inputContextName(), expectedModule); +} + +void tst_inputcontext::inputContextReconfigurationWhenTogglingTextInputExtension() +{ + qunsetenv("QT_IM_MODULE"); + + ensureTextInputPresentOnCompositor(); + int argc = 0; + QGuiApplication app(argc, nullptr); // loads the platform plugin + QCOMPARE(inputContextName(), mWaylandModule); + + // remove text input extension after the platform plugin has been loaded + ensureTextInputNotPresentOnCompositor(); + // QTRY_* because we need to spin the event loop for wayland QPA plugin + // to handle registry_global_remove() + QTRY_COMPARE(inputContextName(), mComposeModule); + + // add text input extension after the platform plugin has been loaded + ensureTextInputPresentOnCompositor(); + // QTRY_* because we need to spin the event loop for wayland QPA plugin + // to handle registry_global() + QTRY_COMPARE(inputContextName(), mWaylandModule); +} + +int main(int argc, char *argv[]) +{ + qputenv("XDG_RUNTIME_DIR", "."); + qputenv("QT_QPA_PLATFORM", "wayland"); + + tst_inputcontext tc; + QTEST_SET_MAIN_SOURCE_PATH + return QTest::qExec(&tc, argc, argv); +} + +#include "tst_inputcontext.moc" diff --git a/tests/auto/wayland/shared/shared.pri b/tests/auto/wayland/shared/shared.pri index 303e1304692..c86183b3d62 100644 --- a/tests/auto/wayland/shared/shared.pri +++ b/tests/auto/wayland/shared/shared.pri @@ -4,7 +4,8 @@ QMAKE_USE += wayland-server WAYLANDSERVERSOURCES += \ $$PWD/../../../../src/3rdparty/protocol/wayland.xml \ - $$PWD/../../../../src/3rdparty/protocol/xdg-shell.xml + $$PWD/../../../../src/3rdparty/protocol/xdg-shell.xml \ + $$PWD/../../../../src/3rdparty/protocol/text-input-unstable-v2.xml INCLUDEPATH += ../shared @@ -13,11 +14,13 @@ HEADERS += \ $$PWD/coreprotocol.h \ $$PWD/datadevice.h \ $$PWD/mockcompositor.h \ - $$PWD/xdgshell.h + $$PWD/xdgshell.h \ + $$PWD/textinput.h SOURCES += \ $$PWD/corecompositor.cpp \ $$PWD/coreprotocol.cpp \ $$PWD/datadevice.cpp \ $$PWD/mockcompositor.cpp \ - $$PWD/xdgshell.cpp + $$PWD/xdgshell.cpp \ + $$PWD/textinput.cpp diff --git a/tests/auto/wayland/shared/textinput.cpp b/tests/auto/wayland/shared/textinput.cpp new file mode 100644 index 00000000000..f9fd287bb22 --- /dev/null +++ b/tests/auto/wayland/shared/textinput.cpp @@ -0,0 +1,45 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "textinput.h" + +namespace MockCompositor { + +TextInputManager::TextInputManager(CoreCompositor *compositor) +{ + init(compositor->m_display, 1); +} + +void TextInputManager::zwp_text_input_manager_v2_get_text_input(Resource *resource, uint32_t id, wl_resource *seatResource) +{ + Q_UNUSED(resource); + Q_UNUSED(id); + Q_UNUSED(seatResource); +} + +} // namespace MockCompositor diff --git a/tests/auto/wayland/shared/textinput.h b/tests/auto/wayland/shared/textinput.h new file mode 100644 index 00000000000..85072e74beb --- /dev/null +++ b/tests/auto/wayland/shared/textinput.h @@ -0,0 +1,51 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef MOCKCOMPOSITOR_TEXTINPUT_H +#define MOCKCOMPOSITOR_TEXTINPUT_H + +#include "coreprotocol.h" +#include + +#include + +namespace MockCompositor { + +class TextInputManager : public Global, public QtWaylandServer::zwp_text_input_manager_v2 +{ + Q_OBJECT +public: + TextInputManager(CoreCompositor *compositor); + +protected: + void zwp_text_input_manager_v2_get_text_input(Resource *resource, uint32_t id, struct ::wl_resource *seatResource) override; +}; + +} // namespace MockCompositor + +#endif // MOCKCOMPOSITOR_TEXTINPUT_H From 90fe97b01752f7611ecc152a20f925aed20149ac Mon Sep 17 00:00:00 2001 From: Gatis Paeglis Date: Thu, 13 Dec 2018 22:04:18 +0100 Subject: [PATCH 0682/1507] client: rework xkb context/keymap/state handling - Use smart pointers from xkbcommon_support-private. - Remove needless strdup() calls. - Don't recreate context. And move it into qwaylanddisplay so it can be shared in future between several keyboards. It contains things like a logging level and include paths. Change-Id: I5d1f667e710046e6b62aa2caf82fdb2decc24520 Reviewed-by: Johan Helsing --- src/plugins/platforms/wayland/client.pro | 2 +- .../platforms/wayland/qwaylanddisplay.cpp | 6 ++ .../platforms/wayland/qwaylanddisplay_p.h | 12 +++ .../platforms/wayland/qwaylandinputdevice.cpp | 76 +++++++------------ .../platforms/wayland/qwaylandinputdevice_p.h | 21 +++-- .../platforms/wayland/qwaylandintegration.cpp | 2 +- 6 files changed, 56 insertions(+), 63 deletions(-) diff --git a/src/plugins/platforms/wayland/client.pro b/src/plugins/platforms/wayland/client.pro index 9f7d979dcd5..81152f756be 100644 --- a/src/plugins/platforms/wayland/client.pro +++ b/src/plugins/platforms/wayland/client.pro @@ -16,7 +16,7 @@ CONFIG -= precompile_header CONFIG += link_pkgconfig wayland-scanner qtConfig(xkbcommon) { - QT_PRIVATE += xkbcommon_support-private + QT_FOR_PRIVATE += xkbcommon_support-private } qtHaveModule(linuxaccessibility_support_private): \ diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index 22a79124da7..e96e52fe4cb 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -142,6 +142,12 @@ QWaylandDisplay::QWaylandDisplay(QWaylandIntegration *waylandIntegration) mWindowManagerIntegration.reset(new QWaylandWindowManagerIntegration(this)); +#if QT_CONFIG(xkbcommon) + mXkbContext.reset(xkb_context_new(XKB_CONTEXT_NO_FLAGS)); + if (!mXkbContext) + qCWarning(lcQpaWayland, "failed to create xkb context"); +#endif + forceRoundTrip(); } diff --git a/src/plugins/platforms/wayland/qwaylanddisplay_p.h b/src/plugins/platforms/wayland/qwaylanddisplay_p.h index 836ee0f9af2..3ced2d9e378 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay_p.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay_p.h @@ -65,6 +65,10 @@ #include +#if QT_CONFIG(xkbcommon) +#include +#endif + struct wl_cursor_image; QT_BEGIN_NAMESPACE @@ -111,6 +115,10 @@ public: QWaylandDisplay(QWaylandIntegration *waylandIntegration); ~QWaylandDisplay(void) override; +#if QT_CONFIG(xkbcommon) + struct xkb_context *xkbContext() const { return mXkbContext.get(); } +#endif + QList screens() const { return mScreens; } QWaylandScreen *screenForOutput(struct wl_output *output) const; @@ -246,6 +254,10 @@ private: void registry_global(uint32_t id, const QString &interface, uint32_t version) override; void registry_global_remove(uint32_t id) override; +#if QT_CONFIG(xkbcommon) + QXkbCommon::ScopedXKBContext mXkbContext; +#endif + friend class QWaylandIntegration; }; diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index f31ab274571..572ce1e5059 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -70,10 +70,6 @@ #include -#if QT_CONFIG(xkbcommon) -#include -#endif - QT_BEGIN_NAMESPACE namespace QtWaylandClient { @@ -85,51 +81,34 @@ QWaylandInputDevice::Keyboard::Keyboard(QWaylandInputDevice *p) } #if QT_CONFIG(xkbcommon) -bool QWaylandInputDevice::Keyboard::createDefaultKeyMap() +bool QWaylandInputDevice::Keyboard::createDefaultKeymap() { - if (mXkbContext && mXkbMap && mXkbState) { - return true; - } + struct xkb_context *ctx = mParent->mQDisplay->xkbContext(); + if (!ctx) + return false; - xkb_rule_names names; - names.rules = strdup("evdev"); - names.model = strdup("pc105"); - names.layout = strdup("us"); - names.variant = strdup(""); - names.options = strdup(""); + struct xkb_rule_names names; + names.rules = "evdev"; + names.model = "pc105"; + names.layout = "us"; + names.variant = ""; + names.options = ""; - mXkbContext = xkb_context_new(xkb_context_flags(0)); - if (mXkbContext) { - mXkbMap = xkb_map_new_from_names(mXkbContext, &names, xkb_map_compile_flags(0)); - if (mXkbMap) { - mXkbState = xkb_state_new(mXkbMap); - } - } + mXkbKeymap.reset(xkb_keymap_new_from_names(ctx, &names, XKB_KEYMAP_COMPILE_NO_FLAGS)); + if (mXkbKeymap) + mXkbState.reset(xkb_state_new(mXkbKeymap.get())); - if (!mXkbContext || !mXkbMap || !mXkbState) { - qWarning() << "xkb_map_new_from_names failed, no key input"; + if (!mXkbKeymap || !mXkbState) { + qCWarning(lcQpaWayland, "failed to create default keymap"); return false; } return true; } - -void QWaylandInputDevice::Keyboard::releaseKeyMap() -{ - if (mXkbState) - xkb_state_unref(mXkbState); - if (mXkbMap) - xkb_map_unref(mXkbMap); - if (mXkbContext) - xkb_context_unref(mXkbContext); -} #endif QWaylandInputDevice::Keyboard::~Keyboard() { -#if QT_CONFIG(xkbcommon) - releaseKeyMap(); -#endif if (mFocus) QWindowSystemInterface::handleWindowActivated(nullptr); if (mParent->mVersion >= 3) @@ -501,7 +480,7 @@ Qt::KeyboardModifiers QWaylandInputDevice::Keyboard::modifiers() const if (!mXkbState) return ret; - ret = QWaylandXkb::modifiers(mXkbState); + ret = QWaylandXkb::modifiers(mXkbState.get()); #endif return ret; @@ -761,16 +740,16 @@ void QWaylandInputDevice::Keyboard::keyboard_keymap(uint32_t format, int32_t fd, return; } - // Release the old keymap resources in the case they were already created in - // the key event or when the compositor issues a new map - releaseKeyMap(); - - mXkbContext = xkb_context_new(XKB_CONTEXT_NO_FLAGS); - mXkbMap = xkb_map_new_from_string(mXkbContext, map_str, XKB_KEYMAP_FORMAT_TEXT_V1, XKB_KEYMAP_COMPILE_NO_FLAGS); + mXkbKeymap.reset(xkb_keymap_new_from_string(mParent->mQDisplay->xkbContext(), map_str, + XKB_KEYMAP_FORMAT_TEXT_V1, + XKB_KEYMAP_COMPILE_NO_FLAGS)); munmap(map_str, size); close(fd); - mXkbState = xkb_state_new(mXkbMap); + if (mXkbKeymap) + mXkbState.reset(xkb_state_new(mXkbKeymap.get())); + else + mXkbState.reset(nullptr); #else Q_UNUSED(format); Q_UNUSED(fd); @@ -860,11 +839,10 @@ void QWaylandInputDevice::Keyboard::keyboard_key(uint32_t serial, uint32_t time, mParent->mQDisplay->setLastInputDevice(mParent, serial, window); #if QT_CONFIG(xkbcommon) - if (!createDefaultKeyMap()) { + if ((!mXkbKeymap || !mXkbState) && !createDefaultKeymap()) return; - } - xkb_keysym_t sym = xkb_state_key_get_one_sym(mXkbState, code); + xkb_keysym_t sym = xkb_state_key_get_one_sym(mXkbState.get(), code); Qt::KeyboardModifiers modifiers = mParent->modifiers(); @@ -878,7 +856,7 @@ void QWaylandInputDevice::Keyboard::keyboard_key(uint32_t serial, uint32_t time, if (state == WL_KEYBOARD_KEY_STATE_PRESSED #if QT_CONFIG(xkbcommon) - && xkb_keymap_key_repeats(mXkbMap, code) + && xkb_keymap_key_repeats(mXkbKeymap.get(), code) #endif ) { mRepeatKey = qtkey; @@ -952,7 +930,7 @@ void QWaylandInputDevice::Keyboard::keyboard_modifiers(uint32_t serial, Q_UNUSED(serial); #if QT_CONFIG(xkbcommon) if (mXkbState) - xkb_state_update_mask(mXkbState, + xkb_state_update_mask(mXkbState.get(), mods_depressed, mods_latched, mods_locked, 0, 0, group); mNativeModifiers = mods_depressed | mods_latched | mods_locked; diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h index 4149e500556..98e60286e83 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h +++ b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h @@ -65,8 +65,7 @@ #include #if QT_CONFIG(xkbcommon) -#include -#include +#include #endif #include @@ -209,11 +208,7 @@ public: QWaylandInputDevice *mParent = nullptr; ::wl_surface *mFocus = nullptr; -#if QT_CONFIG(xkbcommon) - xkb_context *mXkbContext = nullptr; - xkb_keymap *mXkbMap = nullptr; - xkb_state *mXkbState = nullptr; -#endif + uint32_t mNativeModifiers = 0; int mRepeatKey; @@ -222,9 +217,6 @@ public: int mRepeatRate = 25; int mRepeatDelay = 400; QString mRepeatText; -#if QT_CONFIG(xkbcommon) - xkb_keysym_t mRepeatSym; -#endif QTimer mRepeatTimer; Qt::KeyboardModifiers modifiers() const; @@ -236,12 +228,17 @@ private slots: private: #if QT_CONFIG(xkbcommon) - bool createDefaultKeyMap(); - void releaseKeyMap(); + bool createDefaultKeymap(); #endif void sendKey(QWindow *tlw, ulong timestamp, QEvent::Type type, int key, Qt::KeyboardModifiers modifiers, quint32 nativeScanCode, quint32 nativeVirtualKey, quint32 nativeModifiers, const QString& text = QString(), bool autorep = false, ushort count = 1); + +#if QT_CONFIG(xkbcommon) + xkb_keysym_t mRepeatSym = XKB_KEY_NoSymbol; + QXkbCommon::ScopedXKBKeymap mXkbKeymap; + QXkbCommon::ScopedXKBState mXkbState; +#endif }; class Q_WAYLAND_CLIENT_EXPORT QWaylandInputDevice::Pointer : public QObject, public QtWayland::wl_pointer diff --git a/src/plugins/platforms/wayland/qwaylandintegration.cpp b/src/plugins/platforms/wayland/qwaylandintegration.cpp index 8bfe3b6fc82..3a389d9ec89 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandintegration.cpp @@ -479,7 +479,7 @@ void QWaylandIntegration::reconfigureInputContext() mInputContext.reset(QPlatformInputContextFactory::create(defaultInputContext)); #if QT_CONFIG(xkbcommon) - QXkbCommon::setXkbContext(mInputContext.data(), xkb_context_new(XKB_CONTEXT_NO_FLAGS)); + QXkbCommon::setXkbContext(mInputContext.data(), mDisplay->xkbContext()); #endif // Even if compositor-side input context handling has been requested, we fallback to From 19c4ae1adcca761c3063eb28c734cee2d4c35ad8 Mon Sep 17 00:00:00 2001 From: Gatis Paeglis Date: Fri, 14 Dec 2018 17:14:06 +0100 Subject: [PATCH 0683/1507] xkbcommon: replace deprecated APIs See xkbcommon/xkbcommon-compat.h Change-Id: I2a70e14481db227fc0be657fbcf4f6550d62e7e8 Reviewed-by: Johan Helsing --- src/plugins/platforms/wayland/shared/qwaylandxkb.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/plugins/platforms/wayland/shared/qwaylandxkb.cpp b/src/plugins/platforms/wayland/shared/qwaylandxkb.cpp index 3cfc4b074e5..6a81e9fd4e1 100644 --- a/src/plugins/platforms/wayland/shared/qwaylandxkb.cpp +++ b/src/plugins/platforms/wayland/shared/qwaylandxkb.cpp @@ -342,15 +342,13 @@ Qt::KeyboardModifiers QWaylandXkb::modifiers(struct xkb_state *state) #if QT_CONFIG(xkbcommon) Qt::KeyboardModifiers modifiers = Qt::NoModifier; - xkb_state_component cstate = static_cast(XKB_STATE_DEPRESSED | XKB_STATE_LATCHED | XKB_STATE_LOCKED); - - if (xkb_state_mod_name_is_active(state, XKB_MOD_NAME_SHIFT, cstate)) + if (xkb_state_mod_name_is_active(state, XKB_MOD_NAME_SHIFT, XKB_STATE_MODS_EFFECTIVE)) modifiers |= Qt::ShiftModifier; - if (xkb_state_mod_name_is_active(state, XKB_MOD_NAME_CTRL, cstate)) + if (xkb_state_mod_name_is_active(state, XKB_MOD_NAME_CTRL, XKB_STATE_MODS_EFFECTIVE)) modifiers |= Qt::ControlModifier; - if (xkb_state_mod_name_is_active(state, XKB_MOD_NAME_ALT, cstate)) + if (xkb_state_mod_name_is_active(state, XKB_MOD_NAME_ALT, XKB_STATE_MODS_EFFECTIVE)) modifiers |= Qt::AltModifier; - if (xkb_state_mod_name_is_active(state, XKB_MOD_NAME_LOGO, cstate)) + if (xkb_state_mod_name_is_active(state, XKB_MOD_NAME_LOGO, XKB_STATE_MODS_EFFECTIVE)) modifiers |= Qt::MetaModifier; return modifiers; From 97232a3fd8970a072e36ac3d080ce828dd9243fb Mon Sep 17 00:00:00 2001 From: Gatis Paeglis Date: Wed, 16 Jan 2019 14:42:50 +0100 Subject: [PATCH 0684/1507] rework key handling - Document the magical 8 keycode offset in QKeyEvent::nativeScanCode() - Check if we are working with the expected keymap format. - Rename sendKey() to handleKey() as that is typical naming convention for events that are passed to QWindowSystemInterface. - WL_KEYBOARD_KEYMAP_FORMAT_NO_KEYMAP is in the bundled xml so use it in send_keymap() - Rename toWaylandXkbV1Key() to toWaylandKey() as previous name was incorrect. - Remove "Generic fallback" in keyboard_key() as it was non-functional, you can't expect any useful output when mapping scan code directly to Qt::Key. It was not working in 5.9 (did not check beyond that) and no one has complained. It is safe to assume that the fallback code path is dead and can be dropped. To use HW keyboard with wayland, you need to build with libxkbcommon. We require this on XCB since Qt 5.1.0, so it is not an unreasonable requirement for Wayland. - Cleanup auto-repeat key handling. - Cleanup "#if QT_CONFIG(xkbcommon)" checks. Change-Id: Ie9fcc628621487fb58bc55dd595bf0d51eedfc92 Reviewed-by: Johan Helsing --- .../platforms/wayland/qwaylandinputdevice.cpp | 127 +++++++++--------- .../platforms/wayland/qwaylandinputdevice_p.h | 26 ++-- 2 files changed, 77 insertions(+), 76 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index 572ce1e5059..166be1934ed 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -77,7 +77,20 @@ namespace QtWaylandClient { QWaylandInputDevice::Keyboard::Keyboard(QWaylandInputDevice *p) : mParent(p) { - connect(&mRepeatTimer, SIGNAL(timeout()), this, SLOT(repeatKey())); + mRepeatTimer.callOnTimeout([&]() { + if (!focusWindow()) { + // We destroyed the keyboard focus surface, but the server didn't get the message yet... + // or the server didn't send an enter event first. + return; + } + mRepeatTimer.setInterval(mRepeatRate); + handleKey(mRepeatKey.time, QEvent::KeyRelease, mRepeatKey.key, mRepeatKey.modifiers, + mRepeatKey.code, mRepeatKey.nativeVirtualKey, mRepeatKey.nativeModifiers, + mRepeatKey.text, true); + handleKey(mRepeatKey.time, QEvent::KeyPress, mRepeatKey.key, mRepeatKey.modifiers, + mRepeatKey.code, mRepeatKey.nativeVirtualKey, mRepeatKey.nativeModifiers, + mRepeatKey.text, true); + }); } #if QT_CONFIG(xkbcommon) @@ -728,8 +741,10 @@ void QWaylandInputDevice::Pointer::pointer_axis(uint32_t time, uint32_t axis, in void QWaylandInputDevice::Keyboard::keyboard_keymap(uint32_t format, int32_t fd, uint32_t size) { + mKeymapFormat = format; #if QT_CONFIG(xkbcommon) if (format != WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1) { + qCWarning(lcQpaWayland) << "unknown keymap format:" << format; close(fd); return; } @@ -751,7 +766,6 @@ void QWaylandInputDevice::Keyboard::keyboard_keymap(uint32_t format, int32_t fd, else mXkbState.reset(nullptr); #else - Q_UNUSED(format); Q_UNUSED(fd); Q_UNUSED(size); #endif @@ -798,29 +812,34 @@ void QWaylandInputDevice::Keyboard::keyboard_leave(uint32_t time, struct wl_surf handleFocusLost(); } -void QWaylandInputDevice::Keyboard::sendKey(QWindow *tlw, ulong timestamp, QEvent::Type type, int key, - Qt::KeyboardModifiers modifiers, quint32 nativeScanCode, - quint32 nativeVirtualKey, quint32 nativeModifiers, - const QString& text, bool autorep, ushort count) +void QWaylandInputDevice::Keyboard::handleKey(ulong timestamp, QEvent::Type type, int key, + Qt::KeyboardModifiers modifiers, quint32 nativeScanCode, + quint32 nativeVirtualKey, quint32 nativeModifiers, + const QString &text, bool autorepeat, ushort count) { QPlatformInputContext *inputContext = QGuiApplicationPrivate::platformIntegration()->inputContext(); bool filtered = false; if (inputContext && !mParent->mQDisplay->usingInputContextFromCompositor()) { QKeyEvent event(type, key, modifiers, nativeScanCode, nativeVirtualKey, - nativeModifiers, text, autorep, count); + nativeModifiers, text, autorepeat, count); event.setTimestamp(timestamp); filtered = inputContext->filterEvent(&event); } if (!filtered) { - QWindowSystemInterface::handleExtendedKeyEvent(tlw, timestamp, type, key, modifiers, - nativeScanCode, nativeVirtualKey, nativeModifiers, text, autorep, count); + QWindowSystemInterface::handleExtendedKeyEvent(focusWindow()->window(), timestamp, type, key, modifiers, + nativeScanCode, nativeVirtualKey, nativeModifiers, text, autorepeat, count); } } void QWaylandInputDevice::Keyboard::keyboard_key(uint32_t serial, uint32_t time, uint32_t key, uint32_t state) { + if (mKeymapFormat != WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1 && mKeymapFormat != WL_KEYBOARD_KEYMAP_FORMAT_NO_KEYMAP) { + qCWarning(lcQpaWayland) << Q_FUNC_INFO << "unknown keymap format:" << mKeymapFormat; + return; + } + auto *window = focusWindow(); if (!window) { // We destroyed the keyboard focus surface, but the server didn't get the message yet... @@ -828,76 +847,53 @@ void QWaylandInputDevice::Keyboard::keyboard_key(uint32_t serial, uint32_t time, return; } - uint32_t code = key + 8; - bool isDown = state != WL_KEYBOARD_KEY_STATE_RELEASED; - QEvent::Type type = isDown ? QEvent::KeyPress : QEvent::KeyRelease; - QString text; - int qtkey = key + 8; // qt-compositor substracts 8 for some reason mParent->mSerial = serial; + const bool isDown = state != WL_KEYBOARD_KEY_STATE_RELEASED; if (isDown) mParent->mQDisplay->setLastInputDevice(mParent, serial, window); + if (mKeymapFormat == WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1) { #if QT_CONFIG(xkbcommon) - if ((!mXkbKeymap || !mXkbState) && !createDefaultKeymap()) - return; + if ((!mXkbKeymap || !mXkbState) && !createDefaultKeymap()) + return; - xkb_keysym_t sym = xkb_state_key_get_one_sym(mXkbState.get(), code); + auto code = key + 8; // map to wl_keyboard::keymap_format::keymap_format_xkb_v1 - Qt::KeyboardModifiers modifiers = mParent->modifiers(); + xkb_keysym_t sym = xkb_state_key_get_one_sym(mXkbState.get(), code); - std::tie(qtkey, text) = QWaylandXkb::keysymToQtKey(sym, modifiers); + Qt::KeyboardModifiers modifiers = mParent->modifiers(); - sendKey(window->window(), time, type, qtkey, modifiers, code, sym, mNativeModifiers, text); + int qtkey = 0; + QString text; + std::tie(qtkey, text) = QWaylandXkb::keysymToQtKey(sym, modifiers); + + QEvent::Type type = isDown ? QEvent::KeyPress : QEvent::KeyRelease; + handleKey(time, type, qtkey, modifiers, code, sym, mNativeModifiers, text); + + if (state == WL_KEYBOARD_KEY_STATE_PRESSED && xkb_keymap_key_repeats(mXkbKeymap.get(), code)) { + mRepeatKey.key = qtkey; + mRepeatKey.code = code; + mRepeatKey.time = time; + mRepeatKey.text = text; + mRepeatKey.modifiers = modifiers; + mRepeatKey.nativeModifiers = mNativeModifiers; + mRepeatKey.nativeVirtualKey = sym; + mRepeatTimer.setInterval(mRepeatDelay); + mRepeatTimer.start(); + } else if (mRepeatKey.code == code) { + mRepeatTimer.stop(); + } #else - // Generic fallback for single hard keys: Assume 'key' is a Qt key code. - sendKey(window->window(), time, type, qtkey, Qt::NoModifier, code, 0, 0); + Q_UNUSED(time); + Q_UNUSED(key); + qCWarning(lcQpaWayland, "xkbcommon not available on this build, not performing key mapping"); + return; #endif - - if (state == WL_KEYBOARD_KEY_STATE_PRESSED -#if QT_CONFIG(xkbcommon) - && xkb_keymap_key_repeats(mXkbKeymap.get(), code) -#endif - ) { - mRepeatKey = qtkey; - mRepeatCode = code; - mRepeatTime = time; - mRepeatText = text; -#if QT_CONFIG(xkbcommon) - mRepeatSym = sym; -#endif - mRepeatTimer.setInterval(mRepeatDelay); - mRepeatTimer.start(); - } else if (mRepeatCode == code) { - mRepeatTimer.stop(); - } -} - -void QWaylandInputDevice::Keyboard::repeatKey() -{ - auto *window = focusWindow(); - if (!window) { - // We destroyed the keyboard focus surface, but the server didn't get the message yet... - // or the server didn't send an enter event first. + } else if (mKeymapFormat == WL_KEYBOARD_KEYMAP_FORMAT_NO_KEYMAP) { + // raw scan code return; } - - mRepeatTimer.setInterval(mRepeatRate); - sendKey(window->window(), mRepeatTime, QEvent::KeyRelease, mRepeatKey, modifiers(), mRepeatCode, -#if QT_CONFIG(xkbcommon) - mRepeatSym, mNativeModifiers, -#else - 0, 0, -#endif - mRepeatText, true); - - sendKey(window->window(), mRepeatTime, QEvent::KeyPress, mRepeatKey, modifiers(), mRepeatCode, -#if QT_CONFIG(xkbcommon) - mRepeatSym, mNativeModifiers, -#else - 0, 0, -#endif - mRepeatText, true); } void QWaylandInputDevice::Keyboard::handleFocusDestroyed() @@ -935,7 +931,6 @@ void QWaylandInputDevice::Keyboard::keyboard_modifiers(uint32_t serial, 0, 0, group); mNativeModifiers = mods_depressed | mods_latched | mods_locked; #else - Q_UNUSED(serial); Q_UNUSED(mods_depressed); Q_UNUSED(mods_latched); Q_UNUSED(mods_locked); diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h index 98e60286e83..2dc3ddc274f 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h +++ b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h @@ -211,18 +211,25 @@ public: uint32_t mNativeModifiers = 0; - int mRepeatKey; - uint32_t mRepeatCode; - uint32_t mRepeatTime; + struct repeatKey { + int key; + uint32_t code; + uint32_t time; + QString text; + Qt::KeyboardModifiers modifiers; + uint32_t nativeVirtualKey; + uint32_t nativeModifiers; + } mRepeatKey; + + QTimer mRepeatTimer; int mRepeatRate = 25; int mRepeatDelay = 400; - QString mRepeatText; - QTimer mRepeatTimer; + + uint32_t mKeymapFormat = WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1; Qt::KeyboardModifiers modifiers() const; private slots: - void repeatKey(); void handleFocusDestroyed(); void handleFocusLost(); @@ -230,12 +237,11 @@ private: #if QT_CONFIG(xkbcommon) bool createDefaultKeymap(); #endif - void sendKey(QWindow *tlw, ulong timestamp, QEvent::Type type, int key, Qt::KeyboardModifiers modifiers, - quint32 nativeScanCode, quint32 nativeVirtualKey, quint32 nativeModifiers, - const QString& text = QString(), bool autorep = false, ushort count = 1); + void handleKey(ulong timestamp, QEvent::Type type, int key, Qt::KeyboardModifiers modifiers, + quint32 nativeScanCode, quint32 nativeVirtualKey, quint32 nativeModifiers, + const QString &text, bool autorepeat = false, ushort count = 1); #if QT_CONFIG(xkbcommon) - xkb_keysym_t mRepeatSym = XKB_KEY_NoSymbol; QXkbCommon::ScopedXKBKeymap mXkbKeymap; QXkbCommon::ScopedXKBState mXkbState; #endif From 0a424704754e804251a87340127b779a0eb6654d Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Mon, 28 Jan 2019 09:48:26 +0100 Subject: [PATCH 0685/1507] Client: Full implementation for frame callbacks (second try) The Wayland plugin now takes full control over delivering update request and implement frame callbacks for both egl and shm. [ChangeLog][QPA plugin] The non-blocking version of eglSwapBuffers is now used, if supported. This fixed a bug where minimized windows would block the event loop. [ChangeLog][QPA plugin] Windows that don't get frame callbacks from the compositor within 100 ms are now set as not exposed. This should stop most clients from rendering unnecessary frames to minimized or hidden windows. Also, when we relied on the QPA version of requestUpdate, we would sometimes deliver one update request while we were waiting for a frame callback. When we implement the fallback timer ourselves we can make sure we only deliver the fallback if there are no pending frame callbacks. QtQuick and other applications often depend on blocking swapBuffers to throttle animations. If the context's surface format has a non-zero swapInterval, try to emulate a blocking swap. Fixes: QTBUG-69077 Change-Id: I3c6964f31a16e9aff70b8ec3c5340e640a30fef2 Reviewed-by: Paul Olav Tvete --- .../platforms/wayland/qwaylanddisplay.cpp | 38 +++- .../platforms/wayland/qwaylanddisplay_p.h | 3 + .../platforms/wayland/qwaylandwindow.cpp | 180 +++++++++++++++--- .../platforms/wayland/qwaylandwindow_p.h | 17 +- 4 files changed, 205 insertions(+), 33 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index f2bd3160a8a..82003a308c6 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -68,6 +68,8 @@ #include +#include + #include #include @@ -190,7 +192,6 @@ void QWaylandDisplay::flushRequests() wl_display_flush(mDisplay); } - void QWaylandDisplay::blockingReadEvents() { if (wl_display_dispatch(mDisplay) < 0) { @@ -204,6 +205,41 @@ void QWaylandDisplay::exitWithError() ::exit(1); } +wl_event_queue *QWaylandDisplay::createEventQueue() +{ + return wl_display_create_queue(mDisplay); +} + +void QWaylandDisplay::dispatchQueueWhile(wl_event_queue *queue, std::function condition, int timeout) +{ + if (!condition()) + return; + + QElapsedTimer timer; + timer.start(); + struct pollfd pFd = qt_make_pollfd(wl_display_get_fd(mDisplay), POLLIN); + while (timeout == -1 || timer.elapsed() < timeout) { + while (wl_display_prepare_read_queue(mDisplay, queue) != 0) + wl_display_dispatch_queue_pending(mDisplay, queue); + + wl_display_flush(mDisplay); + + const int remaining = qMax(timeout - timer.elapsed(), 0ll); + const int pollTimeout = timeout == -1 ? -1 : remaining; + if (qt_poll_msecs(&pFd, 1, pollTimeout) > 0) + wl_display_read_events(mDisplay); + else + wl_display_cancel_read(mDisplay); + + if (wl_display_dispatch_queue_pending(mDisplay, queue) < 0) { + checkError(); + exitWithError(); + } + if (!condition()) + break; + } +} + QWaylandScreen *QWaylandDisplay::screenForOutput(struct wl_output *output) const { for (int i = 0; i < mScreens.size(); ++i) { diff --git a/src/plugins/platforms/wayland/qwaylanddisplay_p.h b/src/plugins/platforms/wayland/qwaylanddisplay_p.h index fe1d7874e08..6bf6abd5de3 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay_p.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay_p.h @@ -182,6 +182,9 @@ public: void handleKeyboardFocusChanged(QWaylandInputDevice *inputDevice); void handleWindowDestroyed(QWaylandWindow *window); + wl_event_queue *createEventQueue(); + void dispatchQueueWhile(wl_event_queue *queue, std::function condition, int timeout = -1); + public slots: void blockingReadEvents(); void flushRequests(); diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 79639cba0ea..58e0fc5857e 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -67,6 +67,7 @@ #include #include +#include #include @@ -81,6 +82,7 @@ QWaylandWindow *QWaylandWindow::mMouseGrab = nullptr; QWaylandWindow::QWaylandWindow(QWindow *window) : QPlatformWindow(window) , mDisplay(waylandScreen()->display()) + , mFrameQueue(mDisplay->createEventQueue()) , mResizeAfterSwap(qEnvironmentVariableIsSet("QT_WAYLAND_RESIZE_AFTER_SWAP")) { static WId id = 1; @@ -363,6 +365,8 @@ void QWaylandWindow::sendExposeEvent(const QRect &rect) { if (!(mShellSurface && mShellSurface->handleExpose(rect))) QWindowSystemInterface::handleExposeEvent(window(), rect); + else + qCDebug(lcQpaWayland) << "sendExposeEvent: intercepted by shell extension, not sending"; mLastExposeGeometry = rect; } @@ -542,18 +546,11 @@ void QWaylandWindow::handleScreenRemoved(QScreen *qScreen) void QWaylandWindow::attach(QWaylandBuffer *buffer, int x, int y) { Q_ASSERT(!buffer->committed()); - if (mFrameCallback) { - wl_callback_destroy(mFrameCallback); - mFrameCallback = nullptr; - } - if (buffer) { - mFrameCallback = frame(); - wl_callback_add_listener(mFrameCallback, &QWaylandWindow::callbackListener, this); - mWaitingForFrameSync = true; + handleUpdate(); buffer->setBusy(); - attach(buffer->buffer(), x, y); + QtWayland::wl_surface::attach(buffer->buffer(), x, y); } else { QtWayland::wl_surface::attach(nullptr, 0, 0); } @@ -609,32 +606,61 @@ void QWaylandWindow::commit(QWaylandBuffer *buffer, const QRegion &damage) } const wl_callback_listener QWaylandWindow::callbackListener = { - QWaylandWindow::frameCallback + [](void *data, wl_callback *callback, uint32_t time) { + Q_UNUSED(callback); + Q_UNUSED(time); + auto *window = static_cast(data); + if (window->thread() != QThread::currentThread()) + QMetaObject::invokeMethod(window, [=] { window->handleFrameCallback(); }, Qt::QueuedConnection); + else + window->handleFrameCallback(); + } }; -void QWaylandWindow::frameCallback(void *data, struct wl_callback *callback, uint32_t time) +void QWaylandWindow::handleFrameCallback() { - Q_UNUSED(time); - Q_UNUSED(callback); - QWaylandWindow *self = static_cast(data); + bool wasExposed = isExposed(); - self->mWaitingForFrameSync = false; - if (self->mUpdateRequested) { - self->mUpdateRequested = false; - self->deliverUpdateRequest(); + if (mFrameCallbackTimerId != -1) { + killTimer(mFrameCallbackTimerId); + mFrameCallbackTimerId = -1; } + + mWaitingForFrameCallback = false; + mFrameCallbackTimedOut = false; + + if (!wasExposed && isExposed()) + sendExposeEvent(QRect(QPoint(), geometry().size())); + if (wasExposed && hasPendingUpdateRequest()) + deliverUpdateRequest(); } QMutex QWaylandWindow::mFrameSyncMutex; -void QWaylandWindow::waitForFrameSync() +bool QWaylandWindow::waitForFrameSync(int timeout) { QMutexLocker locker(&mFrameSyncMutex); - if (!mWaitingForFrameSync) - return; - mDisplay->flushRequests(); - while (mWaitingForFrameSync) - mDisplay->blockingReadEvents(); + if (!mWaitingForFrameCallback) + return true; + + wl_proxy_set_queue(reinterpret_cast(mFrameCallback), mFrameQueue); + mDisplay->dispatchQueueWhile(mFrameQueue, [&]() { return mWaitingForFrameCallback; }, timeout); + + if (mWaitingForFrameCallback) { + qCDebug(lcWaylandBackingstore) << "Didn't receive frame callback in time, window should now be inexposed"; + mFrameCallbackTimedOut = true; + mWaitingForUpdate = false; + sendExposeEvent(QRect()); + } + + // Stop current frame timer if any, can't use killTimer directly, because we might be on a diffent thread + if (mFrameCallbackTimerId != -1) { + int id = mFrameCallbackTimerId; + mFrameCallbackTimerId = -1; + QMetaObject::invokeMethod(this, [=] { killTimer(id); }, Qt::QueuedConnection); + } + + return !mWaitingForFrameCallback; } QMargins QWaylandWindow::frameMargins() const @@ -966,6 +992,9 @@ bool QWaylandWindow::isExposed() const if (!window()->isVisible()) return false; + if (mFrameCallbackTimedOut) + return false; + if (mShellSurface) return mShellSurface->isExposed(); @@ -1041,12 +1070,107 @@ QVariant QWaylandWindow::property(const QString &name, const QVariant &defaultVa return m_properties.value(name, defaultValue); } +void QWaylandWindow::timerEvent(QTimerEvent *event) +{ + if (event->timerId() == mFallbackUpdateTimerId) { + killTimer(mFallbackUpdateTimerId); + mFallbackUpdateTimerId = -1; + qCDebug(lcWaylandBackingstore) << "mFallbackUpdateTimer timed out"; + + if (!isExposed()) { + qCDebug(lcWaylandBackingstore) << "Fallback update timer: Window not exposed," + << "not delivering update request."; + return; + } + + if (mWaitingForUpdate && hasPendingUpdateRequest() && !mWaitingForFrameCallback) { + qCWarning(lcWaylandBackingstore) << "Delivering update request through fallback timer," + << "may not be in sync with display"; + deliverUpdateRequest(); + } + } + + if (event->timerId() == mFrameCallbackTimerId) { + killTimer(mFrameCallbackTimerId); + mFrameCallbackTimerId = -1; + qCDebug(lcWaylandBackingstore) << "Didn't receive frame callback in time, window should now be inexposed"; + mFrameCallbackTimedOut = true; + mWaitingForUpdate = false; + sendExposeEvent(QRect()); + } +} + void QWaylandWindow::requestUpdate() { - if (!mWaitingForFrameSync) - QPlatformWindow::requestUpdate(); - else - mUpdateRequested = true; + Q_ASSERT(hasPendingUpdateRequest()); // should be set by QPA + + // If we have a frame callback all is good and will be taken care of there + if (mWaitingForFrameCallback) + return; + + // If we've already called deliverUpdateRequest(), but haven't seen any attach+commit/swap yet + if (mWaitingForUpdate) { + // Ideally, we should just have returned here, but we're not guaranteed that the client + // will actually update, so start this timer to deliver another request update after a while + // *IF* the client doesn't update. + int fallbackTimeout = 100; + mFallbackUpdateTimerId = startTimer(fallbackTimeout); + return; + } + + // Some applications (such as Qt Quick) depend on updates being delivered asynchronously, + // so use invokeMethod to delay the delivery a bit. + QMetaObject::invokeMethod(this, [this] { + // Things might have changed in the meantime + if (hasPendingUpdateRequest() && !mWaitingForUpdate && !mWaitingForFrameCallback) + deliverUpdateRequest(); + }, Qt::QueuedConnection); +} + +// Should be called whenever we commit a buffer (directly through wl_surface.commit or indirectly +// with eglSwapBuffers) to know when it's time to commit the next one. +// Can be called from the render thread (without locking anything) so make sure to not make races in this method. +void QWaylandWindow::handleUpdate() +{ + // TODO: Should sync subsurfaces avoid requesting frame callbacks? + + if (mFrameCallback) { + wl_callback_destroy(mFrameCallback); + mFrameCallback = nullptr; + } + + if (mFallbackUpdateTimerId != -1) { + // Ideally, we would stop the fallback timer here, but since we're on another thread, + // it's not allowed. Instead we set mFallbackUpdateTimer to -1 here, so we'll just + // ignore it if it times out before it's cleaned up by the invokeMethod call. + int id = mFallbackUpdateTimerId; + mFallbackUpdateTimerId = -1; + QMetaObject::invokeMethod(this, [=] { killTimer(id); }, Qt::QueuedConnection); + } + + mFrameCallback = frame(); + wl_callback_add_listener(mFrameCallback, &QWaylandWindow::callbackListener, this); + mWaitingForFrameCallback = true; + mWaitingForUpdate = false; + + // Stop current frame timer if any, can't use killTimer directly, see comment above. + if (mFrameCallbackTimerId != -1) { + int id = mFrameCallbackTimerId; + mFrameCallbackTimerId = -1; + QMetaObject::invokeMethod(this, [=] { killTimer(id); }, Qt::QueuedConnection); + } + + // Start a timer for handling the case when the compositor stops sending frame callbacks. + QMetaObject::invokeMethod(this, [=] { // Again; can't do it directly + if (mWaitingForFrameCallback) + mFrameCallbackTimerId = startTimer(100); + }, Qt::QueuedConnection); +} + +void QWaylandWindow::deliverUpdateRequest() +{ + mWaitingForUpdate = true; + QPlatformWindow::deliverUpdateRequest(); } void QWaylandWindow::addAttachOffset(const QPoint point) diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index 56ebd3cc641..c47123dc9c8 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -120,7 +120,7 @@ public: void handleExpose(const QRegion ®ion); void commit(QWaylandBuffer *buffer, const QRegion &damage); - void waitForFrameSync(); + bool waitForFrameSync(int timeout); QMargins frameMargins() const override; @@ -191,7 +191,10 @@ public: bool startSystemMove(const QPoint &pos) override; + void timerEvent(QTimerEvent *event) override; void requestUpdate() override; + void handleUpdate(); + void deliverUpdateRequest() override; public slots: void applyConfigure(); @@ -211,10 +214,17 @@ protected: Qt::MouseButtons mMousePressedInContentArea = Qt::NoButton; WId mWindowId; - bool mWaitingForFrameSync = false; + bool mWaitingForFrameCallback = false; + bool mFrameCallbackTimedOut = false; // Whether the frame callback has timed out + int mFrameCallbackTimerId = -1; // Started on commit, reset on frame callback struct ::wl_callback *mFrameCallback = nullptr; + struct ::wl_event_queue *mFrameQueue = nullptr; QWaitCondition mFrameSyncWait; + // True when we have called deliverRequestUpdate, but the client has not yet attached a new buffer + bool mWaitingForUpdate = false; + int mFallbackUpdateTimerId = -1; // Started when waiting for app to commit + QMutex mResizeLock; bool mWaitingToApplyConfigure = false; bool mCanResize = true; @@ -253,11 +263,10 @@ private: void handleMouseEventWithDecoration(QWaylandInputDevice *inputDevice, const QWaylandPointerEvent &e); void handleScreenChanged(); - bool mUpdateRequested = false; QRect mLastExposeGeometry; static const wl_callback_listener callbackListener; - static void frameCallback(void *data, struct wl_callback *wl_callback, uint32_t time); + void handleFrameCallback(); static QMutex mFrameSyncMutex; static QWaylandWindow *mMouseGrab; From 9558d4f8ea476f3869c5a8d139b50800baff67f2 Mon Sep 17 00:00:00 2001 From: Gatis Paeglis Date: Fri, 14 Dec 2018 21:07:08 +0100 Subject: [PATCH 0686/1507] drop qwaylandxkb and share the logic with X11 QtWayland can benefit from sharing code with X11. This will fix issues that have been reported and fixed on XCB a long time ago. Task-number: QTBUG-65503 Fixes: QTBUG-71301 Fixes: QTBUG-66497 Change-Id: I09cbf8e1c9cf29e8d7f46b97bc2f11d6e91b61a5 Reviewed-by: Johan Helsing --- src/plugins/platforms/wayland/client.pro | 2 - .../wayland/qwaylandinputcontext.cpp | 15 +- .../platforms/wayland/qwaylandinputdevice.cpp | 10 +- .../platforms/wayland/shared/qwaylandxkb.cpp | 393 ------------------ .../platforms/wayland/shared/qwaylandxkb_p.h | 73 ---- 5 files changed, 15 insertions(+), 478 deletions(-) delete mode 100644 src/plugins/platforms/wayland/shared/qwaylandxkb.cpp delete mode 100644 src/plugins/platforms/wayland/shared/qwaylandxkb_p.h diff --git a/src/plugins/platforms/wayland/client.pro b/src/plugins/platforms/wayland/client.pro index 81152f756be..db91bd6913e 100644 --- a/src/plugins/platforms/wayland/client.pro +++ b/src/plugins/platforms/wayland/client.pro @@ -49,7 +49,6 @@ SOURCES += qwaylandintegration.cpp \ qwaylandtouch.cpp \ qwaylandqtkey.cpp \ ../shared/qwaylandmimehelper.cpp \ - ../shared/qwaylandxkb.cpp \ ../shared/qwaylandinputmethodeventbuilder.cpp \ qwaylandabstractdecoration.cpp \ qwaylanddecorationfactory.cpp \ @@ -83,7 +82,6 @@ HEADERS += qwaylandintegration_p.h \ qtwaylandclientglobal_p.h \ ../shared/qwaylandinputmethodeventbuilder_p.h \ ../shared/qwaylandmimehelper_p.h \ - ../shared/qwaylandxkb_p.h \ ../shared/qwaylandsharedmemoryformathelper_p.h \ qtConfig(clipboard) { diff --git a/src/plugins/platforms/wayland/qwaylandinputcontext.cpp b/src/plugins/platforms/wayland/qwaylandinputcontext.cpp index e85faaf8e28..c6f287ddaac 100644 --- a/src/plugins/platforms/wayland/qwaylandinputcontext.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputcontext.cpp @@ -50,7 +50,6 @@ #include "qwaylandinputdevice_p.h" #include "qwaylandinputmethodeventbuilder_p.h" #include "qwaylandwindow_p.h" -#include "qwaylandxkb_p.h" QT_BEGIN_NAMESPACE @@ -315,6 +314,7 @@ void QWaylandTextInput::zwp_text_input_v2_delete_surrounding_text(uint32_t befor void QWaylandTextInput::zwp_text_input_v2_keysym(uint32_t time, uint32_t sym, uint32_t state, uint32_t modifiers) { +#if QT_CONFIG(xkbcommon) if (m_resetCallback) { qCDebug(qLcQpaInputMethods()) << "discard keysym: reset not confirmed"; return; @@ -325,13 +325,18 @@ void QWaylandTextInput::zwp_text_input_v2_keysym(uint32_t time, uint32_t sym, ui Qt::KeyboardModifiers qtModifiers = modifiersToQtModifiers(modifiers); - QEvent::Type type = QWaylandXkb::toQtEventType(state); - QString text; - int qtkey; - std::tie(qtkey, text) = QWaylandXkb::keysymToQtKey(sym, qtModifiers); + QEvent::Type type = state == WL_KEYBOARD_KEY_STATE_PRESSED ? QEvent::KeyPress : QEvent::KeyRelease; + QString text = QXkbCommon::lookupStringNoKeysymTransformations(sym); + int qtkey = QXkbCommon::keysymToQtKey(sym, qtModifiers); QWindowSystemInterface::handleKeyEvent(QGuiApplication::focusWindow(), time, type, qtkey, qtModifiers, text); +#else + Q_UNUSED(time); + Q_UNUSED(sym); + Q_UNUSED(state); + Q_UNUSED(modifiers); +#endif } void QWaylandTextInput::zwp_text_input_v2_language(const QString &language) diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index 166be1934ed..17c408a3d53 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -51,7 +51,6 @@ #include "qwaylandcursor_p.h" #include "qwaylanddisplay_p.h" #include "qwaylandshmbackingstore_p.h" -#include "../shared/qwaylandxkb_p.h" #include "qwaylandinputcontext_p.h" #include @@ -493,7 +492,7 @@ Qt::KeyboardModifiers QWaylandInputDevice::Keyboard::modifiers() const if (!mXkbState) return ret; - ret = QWaylandXkb::modifiers(mXkbState.get()); + ret = QXkbCommon::modifiers(mXkbState.get()); #endif return ret; @@ -758,6 +757,8 @@ void QWaylandInputDevice::Keyboard::keyboard_keymap(uint32_t format, int32_t fd, mXkbKeymap.reset(xkb_keymap_new_from_string(mParent->mQDisplay->xkbContext(), map_str, XKB_KEYMAP_FORMAT_TEXT_V1, XKB_KEYMAP_COMPILE_NO_FLAGS)); + QXkbCommon::verifyHasLatinLayout(mXkbKeymap.get()); + munmap(map_str, size); close(fd); @@ -864,9 +865,8 @@ void QWaylandInputDevice::Keyboard::keyboard_key(uint32_t serial, uint32_t time, Qt::KeyboardModifiers modifiers = mParent->modifiers(); - int qtkey = 0; - QString text; - std::tie(qtkey, text) = QWaylandXkb::keysymToQtKey(sym, modifiers); + int qtkey = QXkbCommon::keysymToQtKey(sym, modifiers, mXkbState.get(), code); + QString text = QXkbCommon::lookupString(mXkbState.get(), code); QEvent::Type type = isDown ? QEvent::KeyPress : QEvent::KeyRelease; handleKey(time, type, qtkey, modifiers, code, sym, mNativeModifiers, text); diff --git a/src/plugins/platforms/wayland/shared/qwaylandxkb.cpp b/src/plugins/platforms/wayland/shared/qwaylandxkb.cpp deleted file mode 100644 index 6a81e9fd4e1..00000000000 --- a/src/plugins/platforms/wayland/shared/qwaylandxkb.cpp +++ /dev/null @@ -1,393 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Copyright (C) 2016 Jolla Ltd -** Contact: http://www.qt-project.org/legal -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qwaylandxkb_p.h" - -#include -#include - -#if QT_CONFIG(xkbcommon) -#include -#endif - -QT_BEGIN_NAMESPACE - -#if QT_CONFIG(xkbcommon) -static const uint32_t KeyTbl[] = { - XKB_KEY_Escape, Qt::Key_Escape, - XKB_KEY_Tab, Qt::Key_Tab, - XKB_KEY_ISO_Left_Tab, Qt::Key_Backtab, - XKB_KEY_BackSpace, Qt::Key_Backspace, - XKB_KEY_Return, Qt::Key_Return, - XKB_KEY_Insert, Qt::Key_Insert, - XKB_KEY_Delete, Qt::Key_Delete, - XKB_KEY_Clear, Qt::Key_Delete, - XKB_KEY_Pause, Qt::Key_Pause, - XKB_KEY_Print, Qt::Key_Print, - - XKB_KEY_Home, Qt::Key_Home, - XKB_KEY_End, Qt::Key_End, - XKB_KEY_Left, Qt::Key_Left, - XKB_KEY_Up, Qt::Key_Up, - XKB_KEY_Right, Qt::Key_Right, - XKB_KEY_Down, Qt::Key_Down, - XKB_KEY_Prior, Qt::Key_PageUp, - XKB_KEY_Next, Qt::Key_PageDown, - - XKB_KEY_Shift_L, Qt::Key_Shift, - XKB_KEY_Shift_R, Qt::Key_Shift, - XKB_KEY_Shift_Lock, Qt::Key_Shift, - XKB_KEY_Control_L, Qt::Key_Control, - XKB_KEY_Control_R, Qt::Key_Control, - XKB_KEY_Meta_L, Qt::Key_Meta, - XKB_KEY_Meta_R, Qt::Key_Meta, - XKB_KEY_Alt_L, Qt::Key_Alt, - XKB_KEY_Alt_R, Qt::Key_Alt, - XKB_KEY_Caps_Lock, Qt::Key_CapsLock, - XKB_KEY_Num_Lock, Qt::Key_NumLock, - XKB_KEY_Scroll_Lock, Qt::Key_ScrollLock, - XKB_KEY_Super_L, Qt::Key_Super_L, - XKB_KEY_Super_R, Qt::Key_Super_R, - XKB_KEY_Menu, Qt::Key_Menu, - XKB_KEY_Hyper_L, Qt::Key_Hyper_L, - XKB_KEY_Hyper_R, Qt::Key_Hyper_R, - XKB_KEY_Help, Qt::Key_Help, - - XKB_KEY_KP_Space, Qt::Key_Space, - XKB_KEY_KP_Tab, Qt::Key_Tab, - XKB_KEY_KP_Enter, Qt::Key_Enter, - XKB_KEY_KP_Home, Qt::Key_Home, - XKB_KEY_KP_Left, Qt::Key_Left, - XKB_KEY_KP_Up, Qt::Key_Up, - XKB_KEY_KP_Right, Qt::Key_Right, - XKB_KEY_KP_Down, Qt::Key_Down, - XKB_KEY_KP_Prior, Qt::Key_PageUp, - XKB_KEY_KP_Next, Qt::Key_PageDown, - XKB_KEY_KP_End, Qt::Key_End, - XKB_KEY_KP_Begin, Qt::Key_Clear, - XKB_KEY_KP_Insert, Qt::Key_Insert, - XKB_KEY_KP_Delete, Qt::Key_Delete, - XKB_KEY_KP_Equal, Qt::Key_Equal, - XKB_KEY_KP_Multiply, Qt::Key_Asterisk, - XKB_KEY_KP_Add, Qt::Key_Plus, - XKB_KEY_KP_Separator, Qt::Key_Comma, - XKB_KEY_KP_Subtract, Qt::Key_Minus, - XKB_KEY_KP_Decimal, Qt::Key_Period, - XKB_KEY_KP_Divide, Qt::Key_Slash, - - XKB_KEY_ISO_Level3_Shift, Qt::Key_AltGr, - XKB_KEY_Multi_key, Qt::Key_Multi_key, - XKB_KEY_Codeinput, Qt::Key_Codeinput, - XKB_KEY_SingleCandidate, Qt::Key_SingleCandidate, - XKB_KEY_MultipleCandidate, Qt::Key_MultipleCandidate, - XKB_KEY_PreviousCandidate, Qt::Key_PreviousCandidate, - - XKB_KEY_Mode_switch, Qt::Key_Mode_switch, - XKB_KEY_script_switch, Qt::Key_Mode_switch, - - XKB_KEY_XF86Back, Qt::Key_Back, - XKB_KEY_XF86Forward, Qt::Key_Forward, - XKB_KEY_XF86Stop, Qt::Key_Stop, - XKB_KEY_XF86Refresh, Qt::Key_Refresh, - XKB_KEY_XF86Favorites, Qt::Key_Favorites, - XKB_KEY_XF86AudioMedia, Qt::Key_LaunchMedia, - XKB_KEY_XF86OpenURL, Qt::Key_OpenUrl, - XKB_KEY_XF86HomePage, Qt::Key_HomePage, - XKB_KEY_XF86Search, Qt::Key_Search, - XKB_KEY_XF86AudioLowerVolume, Qt::Key_VolumeDown, - XKB_KEY_XF86AudioMute, Qt::Key_VolumeMute, - XKB_KEY_XF86AudioRaiseVolume, Qt::Key_VolumeUp, - XKB_KEY_XF86AudioPlay, Qt::Key_MediaTogglePlayPause, - XKB_KEY_XF86AudioStop, Qt::Key_MediaStop, - XKB_KEY_XF86AudioPrev, Qt::Key_MediaPrevious, - XKB_KEY_XF86AudioNext, Qt::Key_MediaNext, - XKB_KEY_XF86AudioRecord, Qt::Key_MediaRecord, - XKB_KEY_XF86AudioPause, Qt::Key_MediaPause, - XKB_KEY_XF86Mail, Qt::Key_LaunchMail, - XKB_KEY_XF86Calculator, Qt::Key_Calculator, - XKB_KEY_XF86Memo, Qt::Key_Memo, - XKB_KEY_XF86ToDoList, Qt::Key_ToDoList, - XKB_KEY_XF86Calendar, Qt::Key_Calendar, - XKB_KEY_XF86PowerDown, Qt::Key_PowerDown, - XKB_KEY_XF86ContrastAdjust, Qt::Key_ContrastAdjust, - XKB_KEY_XF86Standby, Qt::Key_Standby, - XKB_KEY_XF86MonBrightnessUp, Qt::Key_MonBrightnessUp, - XKB_KEY_XF86MonBrightnessDown, Qt::Key_MonBrightnessDown, - XKB_KEY_XF86KbdLightOnOff, Qt::Key_KeyboardLightOnOff, - XKB_KEY_XF86KbdBrightnessUp, Qt::Key_KeyboardBrightnessUp, - XKB_KEY_XF86KbdBrightnessDown, Qt::Key_KeyboardBrightnessDown, - XKB_KEY_XF86PowerOff, Qt::Key_PowerOff, - XKB_KEY_XF86WakeUp, Qt::Key_WakeUp, - XKB_KEY_XF86Eject, Qt::Key_Eject, - XKB_KEY_XF86ScreenSaver, Qt::Key_ScreenSaver, - XKB_KEY_XF86WWW, Qt::Key_WWW, - XKB_KEY_XF86Sleep, Qt::Key_Sleep, - XKB_KEY_XF86LightBulb, Qt::Key_LightBulb, - XKB_KEY_XF86Shop, Qt::Key_Shop, - XKB_KEY_XF86History, Qt::Key_History, - XKB_KEY_XF86AddFavorite, Qt::Key_AddFavorite, - XKB_KEY_XF86HotLinks, Qt::Key_HotLinks, - XKB_KEY_XF86BrightnessAdjust, Qt::Key_BrightnessAdjust, - XKB_KEY_XF86Finance, Qt::Key_Finance, - XKB_KEY_XF86Community, Qt::Key_Community, - XKB_KEY_XF86AudioRewind, Qt::Key_AudioRewind, - XKB_KEY_XF86BackForward, Qt::Key_BackForward, - XKB_KEY_XF86ApplicationLeft, Qt::Key_ApplicationLeft, - XKB_KEY_XF86ApplicationRight, Qt::Key_ApplicationRight, - XKB_KEY_XF86Book, Qt::Key_Book, - XKB_KEY_XF86CD, Qt::Key_CD, - XKB_KEY_XF86Calculater, Qt::Key_Calculator, - XKB_KEY_XF86Clear, Qt::Key_Clear, - XKB_KEY_XF86ClearGrab, Qt::Key_ClearGrab, - XKB_KEY_XF86Close, Qt::Key_Close, - XKB_KEY_XF86Copy, Qt::Key_Copy, - XKB_KEY_XF86Cut, Qt::Key_Cut, - XKB_KEY_XF86Display, Qt::Key_Display, - XKB_KEY_XF86DOS, Qt::Key_DOS, - XKB_KEY_XF86Documents, Qt::Key_Documents, - XKB_KEY_XF86Excel, Qt::Key_Excel, - XKB_KEY_XF86Explorer, Qt::Key_Explorer, - XKB_KEY_XF86Game, Qt::Key_Game, - XKB_KEY_XF86Go, Qt::Key_Go, - XKB_KEY_XF86iTouch, Qt::Key_iTouch, - XKB_KEY_XF86LogOff, Qt::Key_LogOff, - XKB_KEY_XF86Market, Qt::Key_Market, - XKB_KEY_XF86Meeting, Qt::Key_Meeting, - XKB_KEY_XF86MenuKB, Qt::Key_MenuKB, - XKB_KEY_XF86MenuPB, Qt::Key_MenuPB, - XKB_KEY_XF86MySites, Qt::Key_MySites, - XKB_KEY_XF86New, Qt::Key_New, - XKB_KEY_XF86News, Qt::Key_News, - XKB_KEY_XF86OfficeHome, Qt::Key_OfficeHome, - XKB_KEY_XF86Open, Qt::Key_Open, - XKB_KEY_XF86Option, Qt::Key_Option, - XKB_KEY_XF86Paste, Qt::Key_Paste, - XKB_KEY_XF86Phone, Qt::Key_Phone, - XKB_KEY_XF86Reply, Qt::Key_Reply, - XKB_KEY_XF86Reload, Qt::Key_Reload, - XKB_KEY_XF86RotateWindows, Qt::Key_RotateWindows, - XKB_KEY_XF86RotationPB, Qt::Key_RotationPB, - XKB_KEY_XF86RotationKB, Qt::Key_RotationKB, - XKB_KEY_XF86Save, Qt::Key_Save, - XKB_KEY_XF86Send, Qt::Key_Send, - XKB_KEY_XF86Spell, Qt::Key_Spell, - XKB_KEY_XF86SplitScreen, Qt::Key_SplitScreen, - XKB_KEY_XF86Support, Qt::Key_Support, - XKB_KEY_XF86TaskPane, Qt::Key_TaskPane, - XKB_KEY_XF86Terminal, Qt::Key_Terminal, - XKB_KEY_XF86Tools, Qt::Key_Tools, - XKB_KEY_XF86Travel, Qt::Key_Travel, - XKB_KEY_XF86Video, Qt::Key_Video, - XKB_KEY_XF86Word, Qt::Key_Word, - XKB_KEY_XF86Xfer, Qt::Key_Xfer, - XKB_KEY_XF86ZoomIn, Qt::Key_ZoomIn, - XKB_KEY_XF86ZoomOut, Qt::Key_ZoomOut, - XKB_KEY_XF86Away, Qt::Key_Away, - XKB_KEY_XF86Messenger, Qt::Key_Messenger, - XKB_KEY_XF86WebCam, Qt::Key_WebCam, - XKB_KEY_XF86MailForward, Qt::Key_MailForward, - XKB_KEY_XF86Pictures, Qt::Key_Pictures, - XKB_KEY_XF86Music, Qt::Key_Music, - XKB_KEY_XF86Battery, Qt::Key_Battery, - XKB_KEY_XF86Bluetooth, Qt::Key_Bluetooth, - XKB_KEY_XF86WLAN, Qt::Key_WLAN, - XKB_KEY_XF86UWB, Qt::Key_UWB, - XKB_KEY_XF86AudioForward, Qt::Key_AudioForward, - XKB_KEY_XF86AudioRepeat, Qt::Key_AudioRepeat, - XKB_KEY_XF86AudioRandomPlay, Qt::Key_AudioRandomPlay, - XKB_KEY_XF86Subtitle, Qt::Key_Subtitle, - XKB_KEY_XF86AudioCycleTrack, Qt::Key_AudioCycleTrack, - XKB_KEY_XF86Time, Qt::Key_Time, - XKB_KEY_XF86Select, Qt::Key_Select, - XKB_KEY_XF86View, Qt::Key_View, - XKB_KEY_XF86TopMenu, Qt::Key_TopMenu, - XKB_KEY_XF86Red, Qt::Key_Red, - XKB_KEY_XF86Green, Qt::Key_Green, - XKB_KEY_XF86Yellow, Qt::Key_Yellow, - XKB_KEY_XF86Blue, Qt::Key_Blue, - XKB_KEY_XF86Bluetooth, Qt::Key_Bluetooth, - XKB_KEY_XF86Suspend, Qt::Key_Suspend, - XKB_KEY_XF86Hibernate, Qt::Key_Hibernate, - XKB_KEY_XF86TouchpadToggle, Qt::Key_TouchpadToggle, - XKB_KEY_XF86TouchpadOn, Qt::Key_TouchpadOn, - XKB_KEY_XF86TouchpadOff, Qt::Key_TouchpadOff, - XKB_KEY_XF86AudioMicMute, Qt::Key_MicMute, - XKB_KEY_XF86Launch0, Qt::Key_Launch0, - XKB_KEY_XF86Launch1, Qt::Key_Launch1, - XKB_KEY_XF86Launch2, Qt::Key_Launch2, - XKB_KEY_XF86Launch3, Qt::Key_Launch3, - XKB_KEY_XF86Launch4, Qt::Key_Launch4, - XKB_KEY_XF86Launch5, Qt::Key_Launch5, - XKB_KEY_XF86Launch6, Qt::Key_Launch6, - XKB_KEY_XF86Launch7, Qt::Key_Launch7, - XKB_KEY_XF86Launch8, Qt::Key_Launch8, - XKB_KEY_XF86Launch9, Qt::Key_Launch9, - XKB_KEY_XF86LaunchA, Qt::Key_LaunchA, - XKB_KEY_XF86LaunchB, Qt::Key_LaunchB, - XKB_KEY_XF86LaunchC, Qt::Key_LaunchC, - XKB_KEY_XF86LaunchD, Qt::Key_LaunchD, - XKB_KEY_XF86LaunchE, Qt::Key_LaunchE, - XKB_KEY_XF86LaunchF, Qt::Key_LaunchF, - - 0, 0 -}; - -static int lookupKeysym(xkb_keysym_t key) -{ - int code = 0; - int i = 0; - while (KeyTbl[i]) { - if (key == KeyTbl[i]) { - code = (int)KeyTbl[i+1]; - break; - } - i += 2; - } - - return code; -} - -static xkb_keysym_t toKeysymFromTable(uint32_t key) -{ - for (int i = 0; KeyTbl[i]; i += 2) { - if (key == KeyTbl[i + 1]) - return KeyTbl[i]; - } - - return 0; -} -#endif - -std::pair QWaylandXkb::keysymToQtKey(xkb_keysym_t keysym, Qt::KeyboardModifiers &modifiers) -{ -#if QT_CONFIG(xkbcommon) - QString text; - uint utf32 = xkb_keysym_to_utf32(keysym); - if (utf32) - text = QString::fromUcs4(&utf32, 1); - - int code = 0; - - if (keysym >= XKB_KEY_F1 && keysym <= XKB_KEY_F35) { - code = Qt::Key_F1 + (int(keysym) - XKB_KEY_F1); - } else if (keysym >= XKB_KEY_KP_Space && keysym <= XKB_KEY_KP_9) { - if (keysym >= XKB_KEY_KP_0) { - // numeric keypad keys - code = Qt::Key_0 + ((int)keysym - XKB_KEY_KP_0); - } else { - code = lookupKeysym(keysym); - } - modifiers |= Qt::KeypadModifier; - } else if (text.length() == 1 && text.unicode()->unicode() > 0x1f - && text.unicode()->unicode() != 0x7f - && !(keysym >= XKB_KEY_dead_grave && keysym <= XKB_KEY_dead_currency)) { - code = text.unicode()->toUpper().unicode(); - } else { - // any other keys - code = lookupKeysym(keysym); - } - - // Map control + letter to proper text - if (utf32 >= 'A' && utf32 <= '~' && (modifiers & Qt::ControlModifier)) { - utf32 &= ~0x60; - text = QString::fromUcs4(&utf32, 1); - } - - return { code, text }; -#else - Q_UNUSED(modifiers) - return { keysym, "" }; -#endif -} - -Qt::KeyboardModifiers QWaylandXkb::modifiers(struct xkb_state *state) -{ -#if QT_CONFIG(xkbcommon) - Qt::KeyboardModifiers modifiers = Qt::NoModifier; - - if (xkb_state_mod_name_is_active(state, XKB_MOD_NAME_SHIFT, XKB_STATE_MODS_EFFECTIVE)) - modifiers |= Qt::ShiftModifier; - if (xkb_state_mod_name_is_active(state, XKB_MOD_NAME_CTRL, XKB_STATE_MODS_EFFECTIVE)) - modifiers |= Qt::ControlModifier; - if (xkb_state_mod_name_is_active(state, XKB_MOD_NAME_ALT, XKB_STATE_MODS_EFFECTIVE)) - modifiers |= Qt::AltModifier; - if (xkb_state_mod_name_is_active(state, XKB_MOD_NAME_LOGO, XKB_STATE_MODS_EFFECTIVE)) - modifiers |= Qt::MetaModifier; - - return modifiers; -#else - Q_UNUSED(state) - return Qt::NoModifier; -#endif -} - -QEvent::Type QWaylandXkb::toQtEventType(uint32_t state) -{ - return state != 0 ? QEvent::KeyPress : QEvent::KeyRelease; -} - -QVector QWaylandXkb::toKeysym(QKeyEvent *event) -{ -#if QT_CONFIG(xkbcommon) - QVector keysyms; - if (event->key() >= Qt::Key_F1 && event->key() <= Qt::Key_F35) { - keysyms.append(XKB_KEY_F1 + (event->key() - Qt::Key_F1)); - } else if (event->modifiers() & Qt::KeypadModifier) { - if (event->key() >= Qt::Key_0 && event->key() <= Qt::Key_9) - keysyms.append(XKB_KEY_KP_0 + (event->key() - Qt::Key_0)); - else - keysyms.append(toKeysymFromTable(event->key())); - } else if (!event->text().isEmpty()) { - // From libxkbcommon keysym-utf.c: - // "We allow to represent any UCS character in the range U-00000000 to - // U-00FFFFFF by a keysym value in the range 0x01000000 to 0x01ffffff." - foreach (uint utf32, event->text().toUcs4()) { - keysyms.append(utf32 | 0x01000000); - } - } else { - keysyms.append(toKeysymFromTable(event->key())); - } - return keysyms; -#else - return QVector() << event->nativeScanCode(); -#endif -} - -QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/shared/qwaylandxkb_p.h b/src/plugins/platforms/wayland/shared/qwaylandxkb_p.h deleted file mode 100644 index 4820d94bea6..00000000000 --- a/src/plugins/platforms/wayland/shared/qwaylandxkb_p.h +++ /dev/null @@ -1,73 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Copyright (C) 2016 Jolla Ltd -** Contact: http://www.qt-project.org/legal -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QWAYLANDXKB_H -#define QWAYLANDXKB_H - -#include -#include -#include - -#if QT_CONFIG(xkbcommon) -#include -#else -typedef quint32 xkb_keysym_t; -struct xkb_state; -#endif - -#include - -QT_BEGIN_NAMESPACE - -class QKeyEvent; - -class QWaylandXkb -{ -public: - static std::pair keysymToQtKey(xkb_keysym_t keysym, Qt::KeyboardModifiers &modifiers); - static Qt::KeyboardModifiers modifiers(struct xkb_state *state); - - static QEvent::Type toQtEventType(uint32_t state); - static QVector toKeysym(QKeyEvent *event); -}; - -QT_END_NAMESPACE - -#endif From e70fd9016d378fc361c30c5a2f2a733f0e9a1855 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Wed, 16 Jan 2019 10:36:52 +0100 Subject: [PATCH 0687/1507] Client: Fix reverse screen order [ChangeLog][QPA plugin] Fixed a bug where QGuiApplication::screens() and primaryScreen() would return initial screens in the reverse order they were added by the compositor. QGuiApplication::primaryScreen() will now return the first output added by the compositor. Calling forceRoundTrip in registry_global() meant it would call itself recursively if there were additional wl_output events in the queue. This in turn meant the screens got added in the reverse order. Instead we now add the screen to a list of not yet initialized screens and add it properly when we've received the required done events (wl_output and possibly zdg_output_v1). This also has the added benefit of wl_output hot plugging not calling forceRoundTrip(). Fixes: QTBUG-72828 Change-Id: I35c6959d6c219f65fd19d571a25b5a6cdb3f741b Reviewed-by: Gatis Paeglis --- .../platforms/wayland/qwaylanddisplay.cpp | 30 ++++++++--- .../platforms/wayland/qwaylanddisplay_p.h | 2 + .../platforms/wayland/qwaylandscreen.cpp | 52 +++++++++++++++++-- .../platforms/wayland/qwaylandscreen_p.h | 7 +++ tests/auto/wayland/output/tst_output.cpp | 3 -- 5 files changed, 81 insertions(+), 13 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index 43401325ac1..eccc382bd40 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -148,6 +148,11 @@ QWaylandDisplay::QWaylandDisplay(QWaylandIntegration *waylandIntegration) #endif forceRoundTrip(); + + if (!mWaitingScreens.isEmpty()) { + // Give wl_output.done and zxdg_output_v1.done events a chance to arrive + forceRoundTrip(); + } } QWaylandDisplay::~QWaylandDisplay(void) @@ -162,6 +167,7 @@ QWaylandDisplay::~QWaylandDisplay(void) QWindowSystemInterface::handleScreenRemoved(screen); } mScreens.clear(); + qDeleteAll(mWaitingScreens); #if QT_CONFIG(wayland_datadevice) delete mDndSelectionHandler.take(); @@ -222,6 +228,14 @@ QWaylandScreen *QWaylandDisplay::screenForOutput(struct wl_output *output) const return nullptr; } +void QWaylandDisplay::handleScreenInitialized(QWaylandScreen *screen) +{ + if (!mWaitingScreens.removeOne(screen)) + return; + mScreens.append(screen); + QWindowSystemInterface::handleScreenAdded(screen); +} + void QWaylandDisplay::waitForScreens() { flushRequests(); @@ -246,11 +260,7 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin struct ::wl_registry *registry = object(); if (interface == QStringLiteral("wl_output")) { - QWaylandScreen *screen = new QWaylandScreen(this, version, id); - mScreens.append(screen); - // We need to get the output events before creating surfaces - forceRoundTrip(); - QWindowSystemInterface::handleScreenAdded(screen); + mWaitingScreens << new QWaylandScreen(this, version, id); } else if (interface == QStringLiteral("wl_compositor")) { mCompositorVersion = qMin((int)version, 3); mCompositor.init(registry, id, mCompositorVersion); @@ -286,7 +296,7 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin } } else if (interface == QLatin1String("zxdg_output_manager_v1")) { mXdgOutputManager.reset(new QtWayland::zxdg_output_manager_v1(registry, id, qMin(2, int(version)))); - for (auto *screen : qAsConst(mScreens)) + for (auto *screen : qAsConst(mWaitingScreens)) screen->initXdgOutput(xdgOutputManager()); forceRoundTrip(); } @@ -303,6 +313,14 @@ void QWaylandDisplay::registry_global_remove(uint32_t id) RegistryGlobal &global = mGlobals[i]; if (global.id == id) { if (global.interface == QStringLiteral("wl_output")) { + for (auto *screen : mWaitingScreens) { + if (screen->outputId() == id) { + mWaitingScreens.removeOne(screen); + delete screen; + break; + } + } + foreach (QWaylandScreen *screen, mScreens) { if (screen->outputId() == id) { mScreens.removeOne(screen); diff --git a/src/plugins/platforms/wayland/qwaylanddisplay_p.h b/src/plugins/platforms/wayland/qwaylanddisplay_p.h index 2d5832d8d1d..f4b3c26c534 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay_p.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay_p.h @@ -122,6 +122,7 @@ public: QList screens() const { return mScreens; } QWaylandScreen *screenForOutput(struct wl_output *output) const; + void handleScreenInitialized(QWaylandScreen *screen); struct wl_surface *createSurface(void *handle); struct ::wl_region *createRegion(const QRegion &qregion); @@ -216,6 +217,7 @@ private: struct wl_display *mDisplay = nullptr; QtWayland::wl_compositor mCompositor; QScopedPointer mShm; + QList mWaitingScreens; QList mScreens; QList mInputDevices; QList mRegistryListeners; diff --git a/src/plugins/platforms/wayland/qwaylandscreen.cpp b/src/plugins/platforms/wayland/qwaylandscreen.cpp index b2e3ce819b9..5b04ae60907 100644 --- a/src/plugins/platforms/wayland/qwaylandscreen.cpp +++ b/src/plugins/platforms/wayland/qwaylandscreen.cpp @@ -40,6 +40,7 @@ #include "qwaylandscreen_p.h" #include "qwaylanddisplay_p.h" +#include "qwaylandintegration_p.h" #include "qwaylandcursor_p.h" #include "qwaylandwindow_p.h" @@ -60,6 +61,14 @@ QWaylandScreen::QWaylandScreen(QWaylandDisplay *waylandDisplay, int version, uin { if (auto *xdgOutputManager = waylandDisplay->xdgOutputManager()) initXdgOutput(xdgOutputManager); + + if (version < WL_OUTPUT_DONE_SINCE_VERSION) { + qCWarning(lcQpaWayland) << "wl_output done event not supported by compositor," + << "QScreen may not work correctly"; + mWaylandDisplay->forceRoundTrip(); // Give the compositor a chance to send geometry etc. + mOutputDone = true; // Fake the done event + maybeInitialize(); + } } QWaylandScreen::~QWaylandScreen() @@ -68,6 +77,24 @@ QWaylandScreen::~QWaylandScreen() zxdg_output_v1::destroy(); } +void QWaylandScreen::maybeInitialize() +{ + Q_ASSERT(!mInitialized); + + if (!mOutputDone) + return; + + if (mWaylandDisplay->xdgOutputManager() && !mXdgOutputDone) + return; + + mInitialized = true; + mWaylandDisplay->handleScreenInitialized(this); + + updateOutputProperties(); + if (zxdg_output_v1::isInitialized()) + updateXdgOutputProperties(); +} + void QWaylandScreen::initXdgOutput(QtWayland::zxdg_output_manager_v1 *xdgOutputManager) { Q_ASSERT(xdgOutputManager); @@ -232,10 +259,15 @@ void QWaylandScreen::output_scale(int32_t factor) void QWaylandScreen::output_done() { - // the done event is sent after all the geometry and the mode events are sent, - // and the last mode event to be sent is the active one, so we can trust the - // values of mGeometry and mRefreshRate here + mOutputDone = true; + if (mInitialized) + updateOutputProperties(); + else + maybeInitialize(); +} +void QWaylandScreen::updateOutputProperties() +{ if (mTransform >= 0) { bool isPortrait = mGeometry.height() > mGeometry.width(); switch (mTransform) { @@ -262,7 +294,9 @@ void QWaylandScreen::output_done() QWindowSystemInterface::handleScreenOrientationChange(screen(), m_orientation); mTransform = -1; } + QWindowSystemInterface::handleScreenRefreshRateChange(screen(), refreshRate()); + if (!zxdg_output_v1::isInitialized()) QWindowSystemInterface::handleScreenGeometryChange(screen(), geometry(), geometry()); } @@ -280,7 +314,11 @@ void QWaylandScreen::zxdg_output_v1_logical_size(int32_t width, int32_t height) void QWaylandScreen::zxdg_output_v1_done() { - QWindowSystemInterface::handleScreenGeometryChange(screen(), geometry(), geometry()); + mXdgOutputDone = true; + if (mInitialized) + updateXdgOutputProperties(); + else + maybeInitialize(); } void QWaylandScreen::zxdg_output_v1_name(const QString &name) @@ -288,6 +326,12 @@ void QWaylandScreen::zxdg_output_v1_name(const QString &name) mOutputName = name; } +void QWaylandScreen::updateXdgOutputProperties() +{ + Q_ASSERT(zxdg_output_v1::isInitialized()); + QWindowSystemInterface::handleScreenGeometryChange(screen(), geometry(), geometry()); +} + } // namespace QtWaylandClient QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandscreen_p.h b/src/plugins/platforms/wayland/qwaylandscreen_p.h index 4ef58c0c1d7..e9e07d9cd50 100644 --- a/src/plugins/platforms/wayland/qwaylandscreen_p.h +++ b/src/plugins/platforms/wayland/qwaylandscreen_p.h @@ -71,6 +71,8 @@ public: QWaylandScreen(QWaylandDisplay *waylandDisplay, int version, uint32_t id); ~QWaylandScreen() override; + void maybeInitialize(); + void initXdgOutput(QtWayland::zxdg_output_manager_v1 *xdgOutputManager); QWaylandDisplay *display() const; @@ -116,12 +118,14 @@ private: int32_t transform) override; void output_scale(int32_t factor) override; void output_done() override; + void updateOutputProperties(); // XdgOutput void zxdg_output_v1_logical_position(int32_t x, int32_t y) override; void zxdg_output_v1_logical_size(int32_t width, int32_t height) override; void zxdg_output_v1_done() override; void zxdg_output_v1_name(const QString &name) override; + void updateXdgOutputProperties(); int m_outputId; QWaylandDisplay *mWaylandDisplay = nullptr; @@ -137,6 +141,9 @@ private: QSize mPhysicalSize; QString mOutputName; Qt::ScreenOrientation m_orientation = Qt::PrimaryOrientation; + bool mOutputDone = false; + bool mXdgOutputDone = false; + bool mInitialized = false; #if QT_CONFIG(cursor) QScopedPointer mWaylandCursor; diff --git a/tests/auto/wayland/output/tst_output.cpp b/tests/auto/wayland/output/tst_output.cpp index 451679481e6..2d2c8efd682 100644 --- a/tests/auto/wayland/output/tst_output.cpp +++ b/tests/auto/wayland/output/tst_output.cpp @@ -215,10 +215,7 @@ void tst_output::screenOrder() QTRY_COMPARE(QGuiApplication::screens().size(), 3); const auto screens = QGuiApplication::screens(); - QEXPECT_FAIL(nullptr, "TODO: fix screen order", Continue); QCOMPARE(screens[1]->model(), "Screen 1"); - - QEXPECT_FAIL(nullptr, "TODO: fix screen order", Continue); QCOMPARE(screens[2]->model(), "Screen 2"); exec([=] { From 3a3f3eb92478028d7e68c19353d65e4aada09bba Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Thu, 25 Apr 2019 08:58:49 +0200 Subject: [PATCH 0688/1507] Client: Avoid unnecessarily redrawing decorations Note: QWaylandAbstractDecoration::update() doesn't actually update anything, it just sets a dirty flag, and this is done explicitly in the other cases when the decorations need to be redrawn as well (title and icon changes). Fixes: QTBUG-75377 Change-Id: I2e8bd3abd3664c741e69a3e83ebf409872ddf31a Reviewed-by: Paul Olav Tvete --- .../platforms/wayland/qwaylandshmbackingstore.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp b/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp index 34044ec9bca..c16d346eb3f 100644 --- a/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp +++ b/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp @@ -288,12 +288,15 @@ void QWaylandShmBackingStore::resize(const QSize &size) buffer = getBuffer(sizeWithMargins); } - qsizetype oldSize = mBackBuffer ? mBackBuffer->image()->sizeInBytes() : 0; + qsizetype oldSizeInBytes = mBackBuffer ? mBackBuffer->image()->sizeInBytes() : 0; + qsizetype newSizeInBytes = buffer->image()->sizeInBytes(); + // mBackBuffer may have been deleted here but if so it means its size was different so we wouldn't copy it anyway - if (mBackBuffer != buffer && oldSize == buffer->image()->sizeInBytes()) { - memcpy(buffer->image()->bits(), mBackBuffer->image()->constBits(), buffer->image()->sizeInBytes()); - } + if (mBackBuffer != buffer && oldSizeInBytes == newSizeInBytes) + memcpy(buffer->image()->bits(), mBackBuffer->image()->constBits(), newSizeInBytes); + mBackBuffer = buffer; + // ensure the new buffer is at the beginning of the list so next time getBuffer() will pick // it if possible if (mBuffers.first() != buffer) { @@ -301,7 +304,7 @@ void QWaylandShmBackingStore::resize(const QSize &size) mBuffers.prepend(buffer); } - if (windowDecoration() && window()->isVisible()) + if (windowDecoration() && window()->isVisible() && oldSizeInBytes != newSizeInBytes) windowDecoration()->update(); } From 7c682530d884b89856ed0b8386ac68a64a29ffd4 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Mon, 8 Apr 2019 14:51:29 +0200 Subject: [PATCH 0689/1507] Client: Add test for surfaces created by application code This used to crash the client. Task-number: QTBUG-73801 Change-Id: I04d1c6fcc45b6d90f2ac28844e753da2cdf3ab08 Reviewed-by: Paul Olav Tvete --- tests/auto/wayland/xdgshell/tst_xdgshell.cpp | 30 ++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/tests/auto/wayland/xdgshell/tst_xdgshell.cpp b/tests/auto/wayland/xdgshell/tst_xdgshell.cpp index 6efffc8a4b6..809e564eadb 100644 --- a/tests/auto/wayland/xdgshell/tst_xdgshell.cpp +++ b/tests/auto/wayland/xdgshell/tst_xdgshell.cpp @@ -29,6 +29,8 @@ #include "mockcompositor.h" #include #include +#include +#include using namespace MockCompositor; @@ -47,6 +49,7 @@ private slots: void pongs(); void minMaxSize(); void windowGeometry(); + void foreignSurface(); }; void tst_xdgshell::showMinimized() @@ -472,5 +475,32 @@ void tst_xdgshell::windowGeometry() QCOMPOSITOR_TRY_COMPARE(xdgSurface()->m_committed.windowGeometry, QRect(QPoint(0, 0), window.frameGeometry().size())); } +void tst_xdgshell::foreignSurface() +{ + auto *ni = QGuiApplication::platformNativeInterface(); + auto *compositor = static_cast<::wl_compositor *>(ni->nativeResourceForIntegration("compositor")); + ::wl_surface *foreignSurface = wl_compositor_create_surface(compositor); + + // There *could* be cursor surfaces lying around, we don't want to confuse those with + // the foreign surface we will be creating. + const int newSurfaceIndex = exec([&]{ + return get()->m_surfaces.size(); + }); + + QCOMPOSITOR_TRY_VERIFY(surface(newSurfaceIndex)); + exec([&] { + pointer()->sendEnter(surface(newSurfaceIndex), {32, 32}); + pointer()->sendLeave(surface(newSurfaceIndex)); + }); + + // Just do something to make sure we don't destroy the surface before + // the pointer events above are handled. + QSignalSpy spy(exec([=] { return surface(newSurfaceIndex); }), &Surface::commit); + wl_surface_commit(foreignSurface); + QTRY_COMPARE(spy.count(), 1); + + wl_surface_destroy(foreignSurface); +} + QCOMPOSITOR_TEST_MAIN(tst_xdgshell) #include "tst_xdgshell.moc" From c6476ae915b8ac64121d379274363227b1c300ff Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Mon, 8 Apr 2019 13:51:28 +0200 Subject: [PATCH 0690/1507] Client: Add safer fromObject function to scanner Makes the scanner produce generated static functions such as QtWaylandClient::wl_surface *wl_surface::fromObject(struct ::wl_surface *object); Which casts from the wayland-scanner generated types, such as struct ::wl_surface *, to types types generated by qtwaylandscanner, but performs a check to see if the listener is set to the wrapper class first (at least for interfaces with events). This lets us easily fix crashes in a couple of places where we receive events with wayland objects that we didn't create. Also adds nullptr checks whenever we use the fromWlSurface() and fromWlOutput() functions to handle failed conversions. Task-number: QTBUG-73801 Fixes: QTBUG-74085 Change-Id: I9f33c31c7d1a939ccb3ebbbcb0eb67af10037237 Reviewed-by: Jaroslaw Kubik Reviewed-by: Paul Olav Tvete --- .../platforms/wayland/qwaylanddatadevice.cpp | 8 ++++++-- .../platforms/wayland/qwaylandinputdevice.cpp | 17 +++++++++++++---- src/plugins/platforms/wayland/qwaylandqtkey.cpp | 6 +++++- .../platforms/wayland/qwaylandscreen.cpp | 5 +++-- .../platforms/wayland/qwaylandsurface.cpp | 11 ++++++++++- src/tools/qtwaylandscanner/qtwaylandscanner.cpp | 11 +++++++++++ 6 files changed, 48 insertions(+), 10 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylanddatadevice.cpp b/src/plugins/platforms/wayland/qwaylanddatadevice.cpp index fde0f71a250..7cdcd108cd1 100644 --- a/src/plugins/platforms/wayland/qwaylanddatadevice.cpp +++ b/src/plugins/platforms/wayland/qwaylanddatadevice.cpp @@ -151,9 +151,13 @@ void QWaylandDataDevice::data_device_drop() void QWaylandDataDevice::data_device_enter(uint32_t serial, wl_surface *surface, wl_fixed_t x, wl_fixed_t y, wl_data_offer *id) { - m_enterSerial = serial; - m_dragWindow = QWaylandWindow::fromWlSurface(surface)->window(); + auto *dragWaylandWindow = QWaylandWindow::fromWlSurface(surface); + if (!dragWaylandWindow) + return; // Ignore foreign surfaces + + m_dragWindow = dragWaylandWindow->window(); m_dragPoint = calculateDragPosition(x, y, m_dragWindow); + m_enterSerial = serial; QMimeData *dragData = nullptr; Qt::DropActions supportedActions; diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index daad6f15c26..8231dd9c30c 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -555,6 +555,9 @@ void QWaylandInputDevice::Pointer::pointer_enter(uint32_t serial, struct wl_surf QWaylandWindow *window = QWaylandWindow::fromWlSurface(surface); + if (!window) + return; // Ignore foreign surfaces + if (mFocus) { qCWarning(lcQpaWayland) << "The compositor sent a wl_pointer.enter event before sending a" << "leave event first, this is not allowed by the wayland protocol" @@ -596,10 +599,12 @@ void QWaylandInputDevice::Pointer::pointer_leave(uint32_t time, struct wl_surfac if (!surface) return; - if (!QWaylandWindow::mouseGrab()) { - QWaylandWindow *window = QWaylandWindow::fromWlSurface(surface); + auto *window = QWaylandWindow::fromWlSurface(surface); + if (!window) + return; // Ignore foreign surfaces + + if (!QWaylandWindow::mouseGrab()) setFrameEvent(new LeaveEvent(window, mSurfacePos, mGlobalPos)); - } invalidateFocus(); mButtons = Qt::NoButton; @@ -1264,9 +1269,13 @@ void QWaylandInputDevice::Touch::touch_down(uint32_t serial, if (!surface) return; + auto *window = QWaylandWindow::fromWlSurface(surface); + if (!window) + return; // Ignore foreign surfaces + mParent->mTime = time; mParent->mSerial = serial; - mFocus = QWaylandWindow::fromWlSurface(surface); + mFocus = window; mParent->mQDisplay->setLastInputDevice(mParent, serial, mFocus); mParent->handleTouchPoint(id, wl_fixed_to_double(x), wl_fixed_to_double(y), Qt::TouchPointPressed); } diff --git a/src/plugins/platforms/wayland/qwaylandqtkey.cpp b/src/plugins/platforms/wayland/qwaylandqtkey.cpp index a60185bd641..19261973853 100644 --- a/src/plugins/platforms/wayland/qwaylandqtkey.cpp +++ b/src/plugins/platforms/wayland/qwaylandqtkey.cpp @@ -70,7 +70,11 @@ void QWaylandQtKeyExtension::zqt_key_v1_key(struct wl_surface *surface, } QWaylandInputDevice *dev = inputDevices.first(); - QWaylandWindow *win = surface ? QWaylandWindow::fromWlSurface(surface) : dev->keyboardFocus(); + + auto *win = surface ? QWaylandWindow::fromWlSurface(surface) : nullptr; + + if (!win) + win = dev->keyboardFocus(); if (!win || !win->window()) { qWarning("qt_key_extension: handle_qtkey: No keyboard focus"); diff --git a/src/plugins/platforms/wayland/qwaylandscreen.cpp b/src/plugins/platforms/wayland/qwaylandscreen.cpp index b2e3ce819b9..ee6f949aa59 100644 --- a/src/plugins/platforms/wayland/qwaylandscreen.cpp +++ b/src/plugins/platforms/wayland/qwaylandscreen.cpp @@ -190,8 +190,9 @@ QWaylandScreen * QWaylandScreen::waylandScreenFromWindow(QWindow *window) QWaylandScreen *QWaylandScreen::fromWlOutput(::wl_output *output) { - auto wlOutput = static_cast(wl_output_get_user_data(output)); - return static_cast(wlOutput); + if (auto *o = QtWayland::wl_output::fromObject(output)) + return static_cast(o); + return nullptr; } void QWaylandScreen::output_mode(uint32_t flags, int width, int height, int refresh) diff --git a/src/plugins/platforms/wayland/qwaylandsurface.cpp b/src/plugins/platforms/wayland/qwaylandsurface.cpp index 03a1c1f526b..c35f01b56c3 100644 --- a/src/plugins/platforms/wayland/qwaylandsurface.cpp +++ b/src/plugins/platforms/wayland/qwaylandsurface.cpp @@ -65,7 +65,9 @@ QWaylandScreen *QWaylandSurface::oldestEnteredScreen() QWaylandSurface *QWaylandSurface::fromWlSurface(::wl_surface *surface) { - return static_cast(static_cast(wl_surface_get_user_data(surface))); + if (auto *s = QtWayland::wl_surface::fromObject(surface)) + return static_cast(s); + return nullptr; } void QWaylandSurface::handleScreenRemoved(QScreen *qScreen) @@ -79,6 +81,9 @@ void QWaylandSurface::surface_enter(wl_output *output) { auto addedScreen = QWaylandScreen::fromWlOutput(output); + if (!addedScreen) + return; + if (m_screens.contains(addedScreen)) { qCWarning(lcQpaWayland) << "Ignoring unexpected wl_surface.enter received for output with id:" @@ -95,6 +100,10 @@ void QWaylandSurface::surface_enter(wl_output *output) void QWaylandSurface::surface_leave(wl_output *output) { auto *removedScreen = QWaylandScreen::fromWlOutput(output); + + if (!removedScreen) + return; + bool wasRemoved = m_screens.removeOne(removedScreen); if (!wasRemoved) { qCWarning(lcQpaWayland) diff --git a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp index 56045e88058..7f3dc5ad6bb 100644 --- a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp +++ b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp @@ -986,6 +986,7 @@ bool Scanner::process() printf("\n"); printf(" struct ::%s *object() { return m_%s; }\n", interfaceName, interfaceName); printf(" const struct ::%s *object() const { return m_%s; }\n", interfaceName, interfaceName); + printf(" static %s *fromObject(struct ::%s *object);\n", interfaceName, interfaceName); printf("\n"); printf(" bool isInitialized() const;\n"); printf("\n"); @@ -1130,6 +1131,16 @@ bool Scanner::process() printf(" }\n"); printf("\n"); + printf(" %s *%s::fromObject(struct ::%s *object)\n", interfaceName, interfaceName, interfaceName); + printf(" {\n"); + if (hasEvents) { + printf(" if (wl_proxy_get_listener((struct ::wl_proxy *)object) != (void *)&m_%s_listener)\n", interfaceName); + printf(" return nullptr;\n"); + } + printf(" return static_cast<%s *>(%s_get_user_data(object));\n", interfaceName, interfaceName); + printf(" }\n"); + printf("\n"); + printf(" bool %s::isInitialized() const\n", interfaceName); printf(" {\n"); printf(" return m_%s != nullptr;\n", interfaceName); From 5d1b75d9c1066406ec76d58c84c9cf8db0ce2997 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Wed, 6 Feb 2019 09:32:22 +0100 Subject: [PATCH 0691/1507] Client: Add support for animated cursors [ChangeLog][QPA plugin] Added support for animated cursors. Previously we would just show the first frame of the animation. Fixes: QTBUG-48181 Change-Id: Ie06bff8950678b5ff7b7e2e50915c85905a1200b Reviewed-by: Paul Olav Tvete --- .../platforms/wayland/qwaylandcursor.cpp | 7 ++-- .../platforms/wayland/qwaylandcursor_p.h | 2 +- .../platforms/wayland/qwaylandinputdevice.cpp | 38 +++++++++++++++++-- .../platforms/wayland/qwaylandinputdevice_p.h | 4 +- tests/auto/wayland/seatv4/tst_seatv4.cpp | 31 +++++++++++++++ 5 files changed, 74 insertions(+), 8 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandcursor.cpp b/src/plugins/platforms/wayland/qwaylandcursor.cpp index 8b2ed036def..165df776295 100644 --- a/src/plugins/platforms/wayland/qwaylandcursor.cpp +++ b/src/plugins/platforms/wayland/qwaylandcursor.cpp @@ -209,7 +209,7 @@ wl_cursor *QWaylandCursorTheme::requestCursor(WaylandCursor shape) return nullptr; } -struct wl_cursor_image *QWaylandCursorTheme::cursorImage(Qt::CursorShape shape) +::wl_cursor_image *QWaylandCursorTheme::cursorImage(Qt::CursorShape shape, uint millisecondsIntoAnimation) { struct wl_cursor *waylandCursor = nullptr; @@ -227,8 +227,9 @@ struct wl_cursor_image *QWaylandCursorTheme::cursorImage(Qt::CursorShape shape) return nullptr; } - struct wl_cursor_image *image = waylandCursor->images[0]; - struct wl_buffer *buffer = wl_cursor_image_get_buffer(image); + int frame = wl_cursor_frame(waylandCursor, millisecondsIntoAnimation); + ::wl_cursor_image *image = waylandCursor->images[frame]; + ::wl_buffer *buffer = wl_cursor_image_get_buffer(image); if (!buffer) { qCWarning(lcQpaWayland) << "Could not find buffer for cursor"; return nullptr; diff --git a/src/plugins/platforms/wayland/qwaylandcursor_p.h b/src/plugins/platforms/wayland/qwaylandcursor_p.h index 6c48fb628b8..a4605f3d275 100644 --- a/src/plugins/platforms/wayland/qwaylandcursor_p.h +++ b/src/plugins/platforms/wayland/qwaylandcursor_p.h @@ -75,7 +75,7 @@ class Q_WAYLAND_CLIENT_EXPORT QWaylandCursorTheme public: static QWaylandCursorTheme *create(QWaylandShm *shm, int size, const QString &themeName); ~QWaylandCursorTheme(); - struct wl_cursor_image *cursorImage(Qt::CursorShape shape); + ::wl_cursor_image *cursorImage(Qt::CursorShape shape, uint millisecondsIntoAnimation = 0); private: enum WaylandCursor { diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index 8231dd9c30c..04aefa166c7 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -191,6 +191,27 @@ QWaylandInputDevice::Pointer::~Pointer() #if QT_CONFIG(cursor) +class WlCallback : public QtWayland::wl_callback { +public: + explicit WlCallback(::wl_callback *callback, std::function fn, bool autoDelete = false) + : QtWayland::wl_callback(callback) + , m_fn(fn) + , m_autoDelete(autoDelete) + {} + ~WlCallback() override { wl_callback_destroy(object()); } + bool done() const { return m_done; } + void callback_done(uint32_t callback_data) override { + m_done = true; + m_fn(callback_data); + if (m_autoDelete) + delete this; + } +private: + bool m_done = false; + std::function m_fn; + bool m_autoDelete = false; +}; + class CursorSurface : public QWaylandSurface { public: @@ -213,7 +234,7 @@ public: } // Size and hotspot are in surface coordinates - void update(wl_buffer *buffer, const QPoint &hotspot, const QSize &size, int bufferScale) + void update(wl_buffer *buffer, const QPoint &hotspot, const QSize &size, int bufferScale, bool animated = false) { // Calling code needs to ensure buffer scale is supported if != 1 Q_ASSERT(bufferScale == 1 || m_version >= 3); @@ -230,6 +251,13 @@ public: attach(buffer, 0, 0); damage(0, 0, size.width(), size.height()); + m_frameCallback.reset(); + if (animated) { + m_frameCallback.reset(new WlCallback(frame(), [this](uint32_t time){ + Q_UNUSED(time); + m_pointer->updateCursor(); + })); + } commit(); } @@ -242,6 +270,7 @@ public: } private: + QScopedPointer m_frameCallback; QWaylandInputDevice::Pointer *m_pointer = nullptr; uint m_version = 0; uint m_setSerial = 0; @@ -320,12 +349,14 @@ void QWaylandInputDevice::Pointer::updateCursor() updateCursorTheme(); // Set from shape using theme - if (struct ::wl_cursor_image *image = mCursor.theme->cursorImage(shape)) { + uint time = seat()->mCursor.animationTimer.elapsed(); + if (struct ::wl_cursor_image *image = mCursor.theme->cursorImage(shape, time)) { struct wl_buffer *buffer = wl_cursor_image_get_buffer(image); int bufferScale = mCursor.themeBufferScale; QPoint hotspot = QPoint(image->hotspot_x, image->hotspot_y) / bufferScale; QSize size = QSize(image->width, image->height) / bufferScale; - getOrCreateCursorSurface()->update(buffer, hotspot, size, bufferScale); + bool animated = image->delay > 0; + getOrCreateCursorSurface()->update(buffer, hotspot, size, bufferScale, animated); return; } @@ -515,6 +546,7 @@ void QWaylandInputDevice::setCursor(const QCursor *cursor, const QSharedPointer< mCursor.shape = cursor ? cursor->shape() : Qt::ArrowCursor; mCursor.hotspot = cursor ? cursor->hotSpot() : QPoint(); mCursor.fallbackOutputScale = fallbackOutputScale; + mCursor.animationTimer.start(); if (mCursor.shape == Qt::BitmapCursor) { mCursor.bitmapBuffer = cachedBuffer ? cachedBuffer : QWaylandCursor::cursorBitmapBuffer(mQDisplay, cursor); diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h index e87de6ae7b0..f9fa43c9288 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h +++ b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h @@ -69,7 +69,8 @@ #endif #include -#include +#include +#include #if QT_CONFIG(cursor) struct wl_cursor_image; @@ -153,6 +154,7 @@ private: Qt::CursorShape shape = Qt::ArrowCursor; int fallbackOutputScale = 1; QPoint hotspot; + QElapsedTimer animationTimer; } mCursor; #endif diff --git a/tests/auto/wayland/seatv4/tst_seatv4.cpp b/tests/auto/wayland/seatv4/tst_seatv4.cpp index 7dc2e727a6a..77304deafb3 100644 --- a/tests/auto/wayland/seatv4/tst_seatv4.cpp +++ b/tests/auto/wayland/seatv4/tst_seatv4.cpp @@ -80,6 +80,7 @@ private slots: void bitmapCursor(); void hidpiBitmapCursor(); void hidpiBitmapCursorNonInt(); + void animatedCursor(); #endif }; @@ -554,6 +555,36 @@ void tst_seatv4::hidpiBitmapCursorNonInt() QCOMPOSITOR_COMPARE(pointer()->m_hotspot, QPoint(25, 25)); } +void tst_seatv4::animatedCursor() +{ + QRasterWindow window; + window.resize(64, 64); + window.setCursor(Qt::WaitCursor); // TODO: verify that the theme has an animated wait cursor or skip test + window.show(); + QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial); + + exec([=] { pointer()->sendEnter(xdgSurface()->m_surface, {32, 32}); }); + QCOMPOSITOR_TRY_VERIFY(cursorSurface()); + + // We should get the first buffer without waiting for a frame callback + QCOMPOSITOR_TRY_VERIFY(cursorSurface()->m_committed.buffer); + QSignalSpy bufferSpy(exec([=] { return cursorSurface(); }), &Surface::bufferCommitted); + + exec([&] { + // Make sure no extra buffers have arrived + QVERIFY(bufferSpy.empty()); + + // The client should send a frame request in order to time animations correctly + QVERIFY(!cursorSurface()->m_waitingFrameCallbacks.empty()); + + // Tell the client it's time to animate + cursorSurface()->sendFrameCallbacks(); + }); + + // Verify that we get a new cursor buffer + QTRY_COMPARE(bufferSpy.count(), 1); +} + #endif // QT_CONFIG(cursor) QCOMPOSITOR_TEST_MAIN(tst_seatv4) From 4b40d018197f8447f00ba3bb029b848fd9eeecca Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Fri, 5 Apr 2019 16:34:03 +0200 Subject: [PATCH 0692/1507] Client: Use a QWaylandSurface for pointer focus Task-number: QTBUG-74373 Change-Id: Idfd94442ff542b81956d4852e07eb3b5dff80712 Reviewed-by: Paul Olav Tvete --- .../platforms/wayland/qwaylanddatadevice.cpp | 6 ++- .../platforms/wayland/qwaylandinputdevice.cpp | 49 ++++++++++--------- .../platforms/wayland/qwaylandinputdevice_p.h | 3 +- .../platforms/wayland/qwaylandsurface_p.h | 1 + .../platforms/wayland/qwaylandtouch.cpp | 1 + .../platforms/wayland/qwaylandwindow_p.h | 1 + 6 files changed, 35 insertions(+), 26 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylanddatadevice.cpp b/src/plugins/platforms/wayland/qwaylanddatadevice.cpp index 7cdcd108cd1..9dbef8d5bf0 100644 --- a/src/plugins/platforms/wayland/qwaylanddatadevice.cpp +++ b/src/plugins/platforms/wayland/qwaylanddatadevice.cpp @@ -47,6 +47,7 @@ #include "qwaylandinputdevice_p.h" #include "qwaylanddisplay_p.h" #include "qwaylandabstractdecoration_p.h" +#include "qwaylandsurface_p.h" #include #include @@ -107,9 +108,10 @@ void QWaylandDataDevice::startDrag(QMimeData *mimeData, QWaylandWindow *icon) m_dragSource.reset(new QWaylandDataSource(m_display->dndSelectionHandler(), mimeData)); connect(m_dragSource.data(), &QWaylandDataSource::cancelled, this, &QWaylandDataDevice::dragSourceCancelled); - QWaylandWindow *origin = m_display->currentInputDevice()->pointerFocus(); + auto *seat = m_display->currentInputDevice(); + auto *origin = seat->pointerFocus(); if (!origin) - origin = m_display->currentInputDevice()->touchFocus(); + origin = seat->touchFocus(); start_drag(m_dragSource->object(), origin->wlSurface(), icon->wlSurface(), m_display->currentInputDevice()->serial()); } diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index 04aefa166c7..89b50f0ad85 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -189,6 +189,11 @@ QWaylandInputDevice::Pointer::~Pointer() wl_pointer_destroy(object()); } +QWaylandWindow *QWaylandInputDevice::Pointer::focusWindow() const +{ + return mFocus ? mFocus->waylandWindow() : nullptr; +} + #if QT_CONFIG(cursor) class WlCallback : public QtWayland::wl_callback { @@ -498,7 +503,7 @@ void QWaylandInputDevice::removeMouseButtonFromState(Qt::MouseButton button) QWaylandWindow *QWaylandInputDevice::pointerFocus() const { - return mPointer ? mPointer->mFocus : nullptr; + return mPointer ? mPointer->focusWindow() : nullptr; } QWaylandWindow *QWaylandInputDevice::keyboardFocus() const @@ -596,8 +601,8 @@ void QWaylandInputDevice::Pointer::pointer_enter(uint32_t serial, struct wl_surf << "attempting to work around it by invalidating the current focus"; invalidateFocus(); } - mFocus = window; - connect(mFocus, &QWaylandWindow::wlSurfaceDestroyed, this, &Pointer::handleFocusDestroyed); + mFocus = window->waylandSurface(); + connect(mFocus, &QObject::destroyed, this, &Pointer::handleFocusDestroyed); mSurfacePos = QPointF(wl_fixed_to_double(sx), wl_fixed_to_double(sy)); mGlobalPos = window->window()->mapToGlobal(mSurfacePos.toPoint()); @@ -657,7 +662,7 @@ public: void QWaylandInputDevice::Pointer::pointer_motion(uint32_t time, wl_fixed_t surface_x, wl_fixed_t surface_y) { - QWaylandWindow *window = mFocus; + QWaylandWindow *window = focusWindow(); if (!window) { // We destroyed the pointer focus surface, but the server didn't get the message yet... // or the server didn't send an enter event first. In either case, ignore the event. @@ -709,7 +714,7 @@ public: void QWaylandInputDevice::Pointer::pointer_button(uint32_t serial, uint32_t time, uint32_t button, uint32_t state) { - QWaylandWindow *window = mFocus; + QWaylandWindow *window = focusWindow(); if (!window) { // We destroyed the pointer focus surface, but the server didn't get the message yet... // or the server didn't send an enter event first. In either case, ignore the event. @@ -754,7 +759,7 @@ void QWaylandInputDevice::Pointer::pointer_button(uint32_t serial, uint32_t time QPointF pos = mSurfacePos; QPointF global = mGlobalPos; - if (grab && grab != mFocus) { + if (grab && grab != focusWindow()) { pos = QPointF(-1, -1); global = grab->window()->mapToGlobal(pos.toPoint()); @@ -769,7 +774,7 @@ void QWaylandInputDevice::Pointer::pointer_button(uint32_t serial, uint32_t time void QWaylandInputDevice::Pointer::invalidateFocus() { - disconnect(mFocus, &QWaylandWindow::wlSurfaceDestroyed, this, &Pointer::handleFocusDestroyed); + disconnect(mFocus, &QObject::destroyed, this, &Pointer::handleFocusDestroyed); mFocus = nullptr; mEnterSerial = 0; } @@ -777,9 +782,11 @@ void QWaylandInputDevice::Pointer::invalidateFocus() void QWaylandInputDevice::Pointer::releaseButtons() { mButtons = Qt::NoButton; - MotionEvent e(mFocus, mParent->mTime, mSurfacePos, mGlobalPos, mButtons, mParent->modifiers()); - if (mFocus) - mFocus->handleMouse(mParent, e); + + if (auto *window = focusWindow()) { + MotionEvent e(focusWindow(), mParent->mTime, mSurfacePos, mGlobalPos, mButtons, mParent->modifiers()); + window->handleMouse(mParent, e); + } } class WheelEvent : public QWaylandPointerEvent @@ -796,9 +803,7 @@ public: void QWaylandInputDevice::Pointer::pointer_axis(uint32_t time, uint32_t axis, int32_t value) { - QWaylandWindow *window = mFocus; - - if (!window) { + if (!focusWindow()) { // We destroyed the pointer focus surface, but the server didn't get the message yet... // or the server didn't send an enter event first. In either case, ignore the event. return; @@ -851,8 +856,7 @@ void QWaylandInputDevice::Pointer::pointer_axis_source(uint32_t source) void QWaylandInputDevice::Pointer::pointer_axis_stop(uint32_t time, uint32_t axis) { - QWaylandWindow *window = mFocus; - if (window == nullptr) + if (!focusWindow()) return; mParent->mTime = time; @@ -882,9 +886,9 @@ void QWaylandInputDevice::Pointer::pointer_axis_stop(uint32_t time, uint32_t axi QWaylandWindow *target = QWaylandWindow::mouseGrab(); if (!target) - target = mFocus; + target = focusWindow(); Qt::KeyboardModifiers mods = mParent->modifiers(); - WheelEvent wheelEvent(mFocus, Qt::ScrollEnd, mParent->mTime, mSurfacePos, mGlobalPos, + WheelEvent wheelEvent(focusWindow(), Qt::ScrollEnd, mParent->mTime, mSurfacePos, mGlobalPos, QPoint(), QPoint(), Qt::MouseEventNotSynthesized, mods); target->handleMouse(mParent, wheelEvent); mScrollBeginSent = false; @@ -893,8 +897,7 @@ void QWaylandInputDevice::Pointer::pointer_axis_stop(uint32_t time, uint32_t axi void QWaylandInputDevice::Pointer::pointer_axis_discrete(uint32_t axis, int32_t value) { - QWaylandWindow *window = mFocus; - if (window == nullptr) + if (!focusWindow()) return; switch (axis) { @@ -999,11 +1002,11 @@ void QWaylandInputDevice::Pointer::flushScrollEvent() if (!angleDelta.isNull()) { QWaylandWindow *target = QWaylandWindow::mouseGrab(); if (!target) - target = mFocus; + target = focusWindow(); if (isDefinitelyTerminated(mFrameData.axisSource) && !mScrollBeginSent) { qCDebug(lcQpaWaylandInput) << "Flushing scroll event sending ScrollBegin"; - target->handleMouse(mParent, WheelEvent(mFocus, Qt::ScrollBegin, mParent->mTime, + target->handleMouse(mParent, WheelEvent(focusWindow(), Qt::ScrollBegin, mParent->mTime, mSurfacePos, mGlobalPos, QPoint(), QPoint(), Qt::MouseEventNotSynthesized, mParent->modifiers())); @@ -1016,7 +1019,7 @@ void QWaylandInputDevice::Pointer::flushScrollEvent() Qt::MouseEventSource source = mFrameData.wheelEventSource(); qCDebug(lcQpaWaylandInput) << "Flushing scroll event" << phase << pixelDelta << angleDelta; - target->handleMouse(mParent, WheelEvent(mFocus, phase, mParent->mTime, mSurfacePos, mGlobalPos, + target->handleMouse(mParent, WheelEvent(focusWindow(), phase, mParent->mTime, mSurfacePos, mGlobalPos, pixelDelta, angleDelta, source, mParent->modifiers())); } @@ -1366,7 +1369,7 @@ void QWaylandInputDevice::handleTouchPoint(int id, double x, double y, Qt::Touch //is it possible that mTouchFocus is null; if (!win && mPointer) - win = mPointer->mFocus; + win = mPointer->focusWindow(); if (!win && mKeyboard) win = mKeyboard->focusWindow(); if (!win || !win->window()) diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h index f9fa43c9288..404bcf5718f 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h +++ b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h @@ -258,6 +258,7 @@ class Q_WAYLAND_CLIENT_EXPORT QWaylandInputDevice::Pointer : public QObject, pub public: explicit Pointer(QWaylandInputDevice *seat); ~Pointer() override; + QWaylandWindow *focusWindow() const; #if QT_CONFIG(cursor) QString cursorThemeName() const; int cursorSize() const; // in surface coordinates @@ -294,7 +295,7 @@ public: void releaseButtons(); QWaylandInputDevice *mParent = nullptr; - QPointer mFocus; + QPointer mFocus; uint32_t mEnterSerial = 0; #if QT_CONFIG(cursor) struct { diff --git a/src/plugins/platforms/wayland/qwaylandsurface_p.h b/src/plugins/platforms/wayland/qwaylandsurface_p.h index 01f0e63cd4d..541010934ad 100644 --- a/src/plugins/platforms/wayland/qwaylandsurface_p.h +++ b/src/plugins/platforms/wayland/qwaylandsurface_p.h @@ -70,6 +70,7 @@ public: explicit QWaylandSurface(QWaylandDisplay *display); ~QWaylandSurface() override; QWaylandScreen *oldestEnteredScreen(); + QWaylandWindow *waylandWindow() const { return m_window; } static QWaylandSurface *fromWlSurface(::wl_surface *surface); diff --git a/src/plugins/platforms/wayland/qwaylandtouch.cpp b/src/plugins/platforms/wayland/qwaylandtouch.cpp index 48c869a600d..0394aef31be 100644 --- a/src/plugins/platforms/wayland/qwaylandtouch.cpp +++ b/src/plugins/platforms/wayland/qwaylandtouch.cpp @@ -40,6 +40,7 @@ #include "qwaylandtouch_p.h" #include "qwaylandinputdevice_p.h" #include "qwaylanddisplay_p.h" +#include "qwaylandsurface_p.h" QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index 30ff671f7db..3e9b438519d 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -127,6 +127,7 @@ public: QSize surfaceSize() const; QRect windowGeometry() const; + QWaylandSurface *waylandSurface() const { return mSurface.data(); } ::wl_surface *wlSurface(); static QWaylandWindow *fromWlSurface(::wl_surface *surface); From f7eada4f197cd7f6bf2f5889c1cf44874aebeda7 Mon Sep 17 00:00:00 2001 From: Gatis Paeglis Date: Sun, 10 Feb 2019 14:22:59 +0100 Subject: [PATCH 0693/1507] client: reimplement QPlatformIntegration::possibleKeys() This is required to trigger more complex shortcut sequences. For example, with 'us' keyboard layout to enter '%' or '+' you have to press 'Shift' button. Previosly the following shortcuts could not be triggered: 'Shift' + '5' '%' 'Ctrl' + '+' 'Ctrl' + 'Shift' + '=' The same function also ensures that these shortcuts work with non-latin keyboard layouts. Change-Id: Id50c7bb28cf76b9f7a861ced7894b2cacae6ed65 Reviewed-by: David Edmundson Reviewed-by: Gatis Paeglis Reviewed-by: Johan Helsing --- src/plugins/platforms/wayland/qwaylandinputdevice.cpp | 11 +++++++++++ src/plugins/platforms/wayland/qwaylandinputdevice_p.h | 3 +++ src/plugins/platforms/wayland/qwaylandintegration.cpp | 7 +++++++ src/plugins/platforms/wayland/qwaylandintegration_p.h | 2 ++ 4 files changed, 23 insertions(+) diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index 17c408a3d53..39c02d962c7 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -476,6 +476,17 @@ QPointF QWaylandInputDevice::pointerSurfacePosition() const return mPointer ? mPointer->mSurfacePos : QPointF(); } +QList QWaylandInputDevice::possibleKeys(const QKeyEvent *event) const +{ +#if QT_CONFIG(xkbcommon) + if (mKeyboard && mKeyboard->mXkbState) + return QXkbCommon::possibleKeys(mKeyboard->mXkbState.get(), event); +#else + Q_UNUSED(event); +#endif + return {}; +} + Qt::KeyboardModifiers QWaylandInputDevice::modifiers() const { if (!mKeyboard) diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h index 2dc3ddc274f..39ca9dca539 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h +++ b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h @@ -124,6 +124,8 @@ public: QWaylandWindow *keyboardFocus() const; QWaylandWindow *touchFocus() const; + QList possibleKeys(const QKeyEvent *event) const; + QPointF pointerSurfacePosition() const; Qt::KeyboardModifiers modifiers() const; @@ -245,6 +247,7 @@ private: QXkbCommon::ScopedXKBKeymap mXkbKeymap; QXkbCommon::ScopedXKBState mXkbState; #endif + friend class QWaylandInputDevice; }; class Q_WAYLAND_CLIENT_EXPORT QWaylandInputDevice::Pointer : public QObject, public QtWayland::wl_pointer diff --git a/src/plugins/platforms/wayland/qwaylandintegration.cpp b/src/plugins/platforms/wayland/qwaylandintegration.cpp index 3a389d9ec89..ea2b50b4aea 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandintegration.cpp @@ -293,6 +293,13 @@ QWaylandDisplay *QWaylandIntegration::display() const return mDisplay.data(); } +QList QWaylandIntegration::possibleKeys(const QKeyEvent *event) const +{ + if (auto *seat = mDisplay->currentInputDevice()) + return seat->possibleKeys(event); + return {}; +} + QStringList QWaylandIntegration::themeNames() const { return GenericWaylandTheme::themeNames(); diff --git a/src/plugins/platforms/wayland/qwaylandintegration_p.h b/src/plugins/platforms/wayland/qwaylandintegration_p.h index 5e6f16d09f1..3aef2c4d988 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration_p.h +++ b/src/plugins/platforms/wayland/qwaylandintegration_p.h @@ -106,6 +106,8 @@ public: QWaylandDisplay *display() const; + QList possibleKeys(const QKeyEvent *event) const override; + QStringList themeNames() const override; QPlatformTheme *createPlatformTheme(const QString &name) const override; From 50d2c36a571fa35d7a6a5c8339c405072c6e27d9 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Thu, 11 Apr 2019 16:56:59 +0200 Subject: [PATCH 0694/1507] Remove Apache licensed Vulkan helper function Use the QVkConvenience library instead. Fixes: QTBUG-75108 Change-Id: I9687aec3e7b697b04e9cfa5638055132c617ad9a Reviewed-by: Paul Olav Tvete --- src/3rdparty/util/LICENSE-APACHE-2.0.txt | 202 ----------------- src/3rdparty/util/qt_attribution.json | 15 -- src/3rdparty/util/vk_format.h | 264 ----------------------- 3 files changed, 481 deletions(-) delete mode 100644 src/3rdparty/util/LICENSE-APACHE-2.0.txt delete mode 100644 src/3rdparty/util/qt_attribution.json delete mode 100644 src/3rdparty/util/vk_format.h diff --git a/src/3rdparty/util/LICENSE-APACHE-2.0.txt b/src/3rdparty/util/LICENSE-APACHE-2.0.txt deleted file mode 100644 index d6456956733..00000000000 --- a/src/3rdparty/util/LICENSE-APACHE-2.0.txt +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/src/3rdparty/util/qt_attribution.json b/src/3rdparty/util/qt_attribution.json deleted file mode 100644 index 07e85dc20df..00000000000 --- a/src/3rdparty/util/qt_attribution.json +++ /dev/null @@ -1,15 +0,0 @@ -[ - { - "Id": "VK_FORMAT_H", - "Name": "Wayland Protocol", - "QDocModule": "qtwaylandcompositor", - "QtUsage": "Used in the Qt Wayland Compositor vulkan-server-buffer.", - "Files": "vk_format.h", - "Description": "Vulkan format conversion from OpenGL.", - "DownloadLocation": "https://github.com/KhronosGroup/KTX-Software/blob/master/lib/vk_format.h", - "License": "Apache License 2.0", - "LicenseId": "Apache-2.0", - "LicenseFile": "LICENSE-APACHE-2.0.txt", - "Copyright": "Copyright (c) 2016 Oculus VR, LLC. All Rights reserved." - } -] diff --git a/src/3rdparty/util/vk_format.h b/src/3rdparty/util/vk_format.h deleted file mode 100644 index d17783c75f4..00000000000 --- a/src/3rdparty/util/vk_format.h +++ /dev/null @@ -1,264 +0,0 @@ -/* -================================================================================================ - -Description : Vulkan format conversion from OpenGL. -Author : J.M.P. van Waveren -Date : 07/17/2016 -Language : C99 -Copyright : Copyright (c) 2016 Oculus VR, LLC. All Rights reserved. - - -LICENSE -------- - -Copyright (c) 2016 Oculus VR, LLC. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. - -================================================================================================ -*/ - -#if !defined( VK_FORMAT_H ) -#define VK_FORMAT_H - -static inline VkFormat vkGetFormatFromOpenGLInternalFormat( const GLenum internalFormat ) -{ - switch ( internalFormat ) - { - // - // 8 bits per component - // -#ifdef GL_R8 - case GL_R8: return VK_FORMAT_R8_UNORM; // 1-component, 8-bit unsigned normalized - case GL_RG8: return VK_FORMAT_R8G8_UNORM; // 2-component, 8-bit unsigned normalized -#endif - case GL_RGB8: return VK_FORMAT_R8G8B8_UNORM; // 3-component, 8-bit unsigned normalized - case GL_RGBA8: return VK_FORMAT_R8G8B8A8_UNORM; // 4-component, 8-bit unsigned normalized - - case GL_R8_SNORM: return VK_FORMAT_R8_SNORM; // 1-component, 8-bit signed normalized - case GL_RG8_SNORM: return VK_FORMAT_R8G8_SNORM; // 2-component, 8-bit signed normalized - case GL_RGB8_SNORM: return VK_FORMAT_R8G8B8_SNORM; // 3-component, 8-bit signed normalized - case GL_RGBA8_SNORM: return VK_FORMAT_R8G8B8A8_SNORM; // 4-component, 8-bit signed normalized - - case GL_R8UI: return VK_FORMAT_R8_UINT; // 1-component, 8-bit unsigned integer - case GL_RG8UI: return VK_FORMAT_R8G8_UINT; // 2-component, 8-bit unsigned integer - case GL_RGB8UI: return VK_FORMAT_R8G8B8_UINT; // 3-component, 8-bit unsigned integer - case GL_RGBA8UI: return VK_FORMAT_R8G8B8A8_UINT; // 4-component, 8-bit unsigned integer - - case GL_R8I: return VK_FORMAT_R8_SINT; // 1-component, 8-bit signed integer - case GL_RG8I: return VK_FORMAT_R8G8_SINT; // 2-component, 8-bit signed integer - case GL_RGB8I: return VK_FORMAT_R8G8B8_SINT; // 3-component, 8-bit signed integer - case GL_RGBA8I: return VK_FORMAT_R8G8B8A8_SINT; // 4-component, 8-bit signed integer - - case GL_SR8_EXT: return VK_FORMAT_R8_SRGB; // 1-component, 8-bit sRGB -#ifdef GL_SRG8_EXT - case GL_SRG8_EXT: return VK_FORMAT_R8G8_SRGB; // 2-component, 8-bit sRGB -#endif -#ifdef GL_SRGB8_NV - case GL_SRGB8_NV: return VK_FORMAT_R8G8B8_SRGB; // 3-component, 8-bit sRGB -#endif -#ifdef GL_SRGB8_ALPHA8 - case GL_SRGB8_ALPHA8: return VK_FORMAT_R8G8B8A8_SRGB; // 4-component, 8-bit sRGB -#endif - // - // 16 bits per component - // -#ifdef GL_R16_EXT - case GL_R16_EXT: return VK_FORMAT_R16_UNORM; // 1-component, 16-bit unsigned normalized - case GL_RG16_EXT: return VK_FORMAT_R16G16_UNORM; // 2-component, 16-bit unsigned normalized -#endif - case GL_RGB16_EXT: return VK_FORMAT_R16G16B16_UNORM; // 3-component, 16-bit unsigned normalized - case GL_RGBA16_EXT: return VK_FORMAT_R16G16B16A16_UNORM; // 4-component, 16-bit unsigned normalized - -#ifdef GL_R16_SNORM_EXT - case GL_R16_SNORM_EXT: return VK_FORMAT_R16_SNORM; // 1-component, 16-bit signed normalized - case GL_RG16_SNORM_EXT: return VK_FORMAT_R16G16_SNORM; // 2-component, 16-bit signed normalized - case GL_RGB16_SNORM_EXT: return VK_FORMAT_R16G16B16_SNORM; // 3-component, 16-bit signed normalized - case GL_RGBA16_SNORM_EXT: return VK_FORMAT_R16G16B16A16_SNORM; // 4-component, 16-bit signed normalized -#endif - - case GL_R16UI: return VK_FORMAT_R16_UINT; // 1-component, 16-bit unsigned integer - case GL_RG16UI: return VK_FORMAT_R16G16_UINT; // 2-component, 16-bit unsigned integer - case GL_RGB16UI: return VK_FORMAT_R16G16B16_UINT; // 3-component, 16-bit unsigned integer - case GL_RGBA16UI: return VK_FORMAT_R16G16B16A16_UINT; // 4-component, 16-bit unsigned integer - - case GL_R16I: return VK_FORMAT_R16_SINT; // 1-component, 16-bit signed integer - case GL_RG16I: return VK_FORMAT_R16G16_SINT; // 2-component, 16-bit signed integer - case GL_RGB16I: return VK_FORMAT_R16G16B16_SINT; // 3-component, 16-bit signed integer - case GL_RGBA16I: return VK_FORMAT_R16G16B16A16_SINT; // 4-component, 16-bit signed integer - - case GL_R16F: return VK_FORMAT_R16_SFLOAT; // 1-component, 16-bit floating-point - case GL_RG16F: return VK_FORMAT_R16G16_SFLOAT; // 2-component, 16-bit floating-point - case GL_RGB16F: return VK_FORMAT_R16G16B16_SFLOAT; // 3-component, 16-bit floating-point - case GL_RGBA16F: return VK_FORMAT_R16G16B16A16_SFLOAT; // 4-component, 16-bit floating-point - - // - // 32 bits per component - // - case GL_R32UI: return VK_FORMAT_R32_UINT; // 1-component, 32-bit unsigned integer - case GL_RG32UI: return VK_FORMAT_R32G32_UINT; // 2-component, 32-bit unsigned integer - case GL_RGB32UI: return VK_FORMAT_R32G32B32_UINT; // 3-component, 32-bit unsigned integer - case GL_RGBA32UI: return VK_FORMAT_R32G32B32A32_UINT; // 4-component, 32-bit unsigned integer - - case GL_R32I: return VK_FORMAT_R32_SINT; // 1-component, 32-bit signed integer - case GL_RG32I: return VK_FORMAT_R32G32_SINT; // 2-component, 32-bit signed integer - case GL_RGB32I: return VK_FORMAT_R32G32B32_SINT; // 3-component, 32-bit signed integer - case GL_RGBA32I: return VK_FORMAT_R32G32B32A32_SINT; // 4-component, 32-bit signed integer - - case GL_R32F: return VK_FORMAT_R32_SFLOAT; // 1-component, 32-bit floating-point - case GL_RG32F: return VK_FORMAT_R32G32_SFLOAT; // 2-component, 32-bit floating-point - case GL_RGB32F: return VK_FORMAT_R32G32B32_SFLOAT; // 3-component, 32-bit floating-point - case GL_RGBA32F: return VK_FORMAT_R32G32B32A32_SFLOAT; // 4-component, 32-bit floating-point - - // - // Packed - // -// case GL_R3_G3_B2: return VK_FORMAT_UNDEFINED; // 3-component 3:3:2, unsigned normalized -// case GL_RGB4: return VK_FORMAT_UNDEFINED; // 3-component 4:4:4, unsigned normalized -#ifdef GL_RGB5 - case GL_RGB5: return VK_FORMAT_R5G5B5A1_UNORM_PACK16; // 3-component 5:5:5, unsigned normalized -#endif - case GL_RGB565: return VK_FORMAT_R5G6B5_UNORM_PACK16; // 3-component 5:6:5, unsigned normalized - case GL_RGB10_EXT: return VK_FORMAT_A2R10G10B10_UNORM_PACK32; // 3-component 10:10:10, unsigned normalized - // case GL_RGB12: return VK_FORMAT_UNDEFINED; // 3-component 12:12:12, unsigned normalized - // case GL_RGBA2: return VK_FORMAT_UNDEFINED; // 4-component 2:2:2:2, unsigned normalized - case GL_RGBA4: return VK_FORMAT_R4G4B4A4_UNORM_PACK16; // 4-component 4:4:4:4, unsigned normalized -// case GL_RGBA12: return VK_FORMAT_UNDEFINED; // 4-component 12:12:12:12, unsigned normalized - case GL_RGB5_A1: return VK_FORMAT_A1R5G5B5_UNORM_PACK16; // 4-component 5:5:5:1, unsigned normalized - case GL_RGB10_A2: return VK_FORMAT_A2R10G10B10_UNORM_PACK32; // 4-component 10:10:10:2, unsigned normalized - case GL_RGB10_A2UI: return VK_FORMAT_A2R10G10B10_UINT_PACK32; // 4-component 10:10:10:2, unsigned integer - case GL_R11F_G11F_B10F: return VK_FORMAT_B10G11R11_UFLOAT_PACK32; // 3-component 11:11:10, floating-point - case GL_RGB9_E5: return VK_FORMAT_E5B9G9R9_UFLOAT_PACK32; // 3-component/exp 9:9:9/5, floating-point - - // - // S3TC/DXT/BC - // - - case GL_COMPRESSED_RGB_S3TC_DXT1_EXT: return VK_FORMAT_BC1_RGB_UNORM_BLOCK; // line through 3D space, 4x4 blocks, unsigned normalized - case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT: return VK_FORMAT_BC1_RGBA_UNORM_BLOCK; // line through 3D space plus 1-bit alpha, 4x4 blocks, unsigned normalized - case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT: return VK_FORMAT_BC2_UNORM_BLOCK; // line through 3D space plus line through 1D space, 4x4 blocks, unsigned normalized - case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT: return VK_FORMAT_BC3_UNORM_BLOCK; // line through 3D space plus 4-bit alpha, 4x4 blocks, unsigned normalized - - case GL_COMPRESSED_SRGB_S3TC_DXT1_EXT: return VK_FORMAT_BC1_RGB_SRGB_BLOCK; // line through 3D space, 4x4 blocks, sRGB - case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT: return VK_FORMAT_BC1_RGBA_SRGB_BLOCK; // line through 3D space plus 1-bit alpha, 4x4 blocks, sRGB - case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT: return VK_FORMAT_BC2_SRGB_BLOCK; // line through 3D space plus line through 1D space, 4x4 blocks, sRGB - case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT: return VK_FORMAT_BC3_SRGB_BLOCK; // line through 3D space plus 4-bit alpha, 4x4 blocks, sRGB -#ifdef GL_COMPRESSED_LUMINANCE_LATC1_EXT - case GL_COMPRESSED_LUMINANCE_LATC1_EXT: return VK_FORMAT_BC4_UNORM_BLOCK; // line through 1D space, 4x4 blocks, unsigned normalized -#endif -#ifdef GL_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT - case GL_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT: return VK_FORMAT_BC5_UNORM_BLOCK; // two lines through 1D space, 4x4 blocks, unsigned normalized -#endif -#ifdef GL_COMPRESSED_SIGNED_LUMINANCE_LATC1_EXT - case GL_COMPRESSED_SIGNED_LUMINANCE_LATC1_EXT: return VK_FORMAT_BC4_SNORM_BLOCK; // line through 1D space, 4x4 blocks, signed normalized -#endif -#ifdef GL_COMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2_EXT - case GL_COMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2_EXT: return VK_FORMAT_BC5_SNORM_BLOCK; // two lines through 1D space, 4x4 blocks, signed normalized -#endif - case GL_COMPRESSED_RED_RGTC1_EXT: return VK_FORMAT_BC4_UNORM_BLOCK; // line through 1D space, 4x4 blocks, unsigned normalized -#ifdef GL_COMPRESSED_RG_RGTC2_EXT - case GL_COMPRESSED_RG_RGTC2_EXT: return VK_FORMAT_BC5_UNORM_BLOCK; // two lines through 1D space, 4x4 blocks, unsigned normalized -#endif - case GL_COMPRESSED_SIGNED_RED_RGTC1_EXT: return VK_FORMAT_BC4_SNORM_BLOCK; // line through 1D space, 4x4 blocks, signed normalized -#ifdef GL_COMPRESSED_SIGNED_RG_RGTC2_EXT - case GL_COMPRESSED_SIGNED_RG_RGTC2_EXT: return VK_FORMAT_BC5_SNORM_BLOCK; // two lines through 1D space, 4x4 blocks, signed normalized -#endif - -#if defined(GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT) - case GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT: return VK_FORMAT_BC6H_UFLOAT_BLOCK; // 3-component, 4x4 blocks, unsigned floating-point - case GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT: return VK_FORMAT_BC6H_SFLOAT_BLOCK; // 3-component, 4x4 blocks, signed floating-point - case GL_COMPRESSED_RGBA_BPTC_UNORM_EXT: return VK_FORMAT_BC7_UNORM_BLOCK; // 4-component, 4x4 blocks, unsigned normalized - case GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT: return VK_FORMAT_BC7_SRGB_BLOCK; // 4-component, 4x4 blocks, sRGB -#elif defined(GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT) - case GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT: return VK_FORMAT_BC6H_UFLOAT_BLOCK; // 3-component, 4x4 blocks, unsigned floating-point - case GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT: return VK_FORMAT_BC6H_SFLOAT_BLOCK; // 3-component, 4x4 blocks, signed floating-point - case GL_COMPRESSED_RGBA_BPTC_UNORM: return VK_FORMAT_BC7_UNORM_BLOCK; // 4-component, 4x4 blocks, unsigned normalized - case GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM: return VK_FORMAT_BC7_SRGB_BLOCK; // 4-component, 4x4 blocks, sRGB -#endif - // - // ETC - // -#ifdef GL_ETC1_RGB8_OES - case GL_ETC1_RGB8_OES: return VK_FORMAT_ETC2_R8G8B8_UNORM_BLOCK; // 3-component ETC1, 4x4 blocks, unsigned normalized -#endif - - case GL_COMPRESSED_RGB8_ETC2: return VK_FORMAT_ETC2_R8G8B8_UNORM_BLOCK; // 3-component ETC2, 4x4 blocks, unsigned normalized - case GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2: return VK_FORMAT_ETC2_R8G8B8A1_UNORM_BLOCK; // 4-component ETC2 with 1-bit alpha, 4x4 blocks, unsigned normalized - case GL_COMPRESSED_RGBA8_ETC2_EAC: return VK_FORMAT_ETC2_R8G8B8A8_UNORM_BLOCK; // 4-component ETC2, 4x4 blocks, unsigned normalized - - case GL_COMPRESSED_SRGB8_ETC2: return VK_FORMAT_ETC2_R8G8B8_SRGB_BLOCK; // 3-component ETC2, 4x4 blocks, sRGB - case GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2: return VK_FORMAT_ETC2_R8G8B8A1_SRGB_BLOCK; // 4-component ETC2 with 1-bit alpha, 4x4 blocks, sRGB - case GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC: return VK_FORMAT_ETC2_R8G8B8A8_SRGB_BLOCK; // 4-component ETC2, 4x4 blocks, sRGB - - case GL_COMPRESSED_R11_EAC: return VK_FORMAT_EAC_R11_UNORM_BLOCK; // 1-component ETC, 4x4 blocks, unsigned normalized - case GL_COMPRESSED_RG11_EAC: return VK_FORMAT_EAC_R11G11_UNORM_BLOCK; // 2-component ETC, 4x4 blocks, unsigned normalized - case GL_COMPRESSED_SIGNED_R11_EAC: return VK_FORMAT_EAC_R11_SNORM_BLOCK; // 1-component ETC, 4x4 blocks, signed normalized - case GL_COMPRESSED_SIGNED_RG11_EAC: return VK_FORMAT_EAC_R11G11_SNORM_BLOCK; // 2-component ETC, 4x4 blocks, signed normalized - - // - // ASTC - // - case GL_COMPRESSED_RGBA_ASTC_4x4_KHR: return VK_FORMAT_ASTC_4x4_UNORM_BLOCK; // 4-component ASTC, 4x4 blocks, unsigned normalized - case GL_COMPRESSED_RGBA_ASTC_5x4_KHR: return VK_FORMAT_ASTC_5x4_UNORM_BLOCK; // 4-component ASTC, 5x4 blocks, unsigned normalized - case GL_COMPRESSED_RGBA_ASTC_5x5_KHR: return VK_FORMAT_ASTC_5x5_UNORM_BLOCK; // 4-component ASTC, 5x5 blocks, unsigned normalized - case GL_COMPRESSED_RGBA_ASTC_6x5_KHR: return VK_FORMAT_ASTC_6x5_UNORM_BLOCK; // 4-component ASTC, 6x5 blocks, unsigned normalized - case GL_COMPRESSED_RGBA_ASTC_6x6_KHR: return VK_FORMAT_ASTC_6x6_UNORM_BLOCK; // 4-component ASTC, 6x6 blocks, unsigned normalized - case GL_COMPRESSED_RGBA_ASTC_8x5_KHR: return VK_FORMAT_ASTC_8x5_UNORM_BLOCK; // 4-component ASTC, 8x5 blocks, unsigned normalized - case GL_COMPRESSED_RGBA_ASTC_8x6_KHR: return VK_FORMAT_ASTC_8x6_UNORM_BLOCK; // 4-component ASTC, 8x6 blocks, unsigned normalized - case GL_COMPRESSED_RGBA_ASTC_8x8_KHR: return VK_FORMAT_ASTC_8x8_UNORM_BLOCK; // 4-component ASTC, 8x8 blocks, unsigned normalized - case GL_COMPRESSED_RGBA_ASTC_10x5_KHR: return VK_FORMAT_ASTC_10x5_UNORM_BLOCK; // 4-component ASTC, 10x5 blocks, unsigned normalized - case GL_COMPRESSED_RGBA_ASTC_10x6_KHR: return VK_FORMAT_ASTC_10x6_UNORM_BLOCK; // 4-component ASTC, 10x6 blocks, unsigned normalized - case GL_COMPRESSED_RGBA_ASTC_10x8_KHR: return VK_FORMAT_ASTC_10x8_UNORM_BLOCK; // 4-component ASTC, 10x8 blocks, unsigned normalized - case GL_COMPRESSED_RGBA_ASTC_10x10_KHR: return VK_FORMAT_ASTC_10x10_UNORM_BLOCK; // 4-component ASTC, 10x10 blocks, unsigned normalized - case GL_COMPRESSED_RGBA_ASTC_12x10_KHR: return VK_FORMAT_ASTC_12x10_UNORM_BLOCK; // 4-component ASTC, 12x10 blocks, unsigned normalized - case GL_COMPRESSED_RGBA_ASTC_12x12_KHR: return VK_FORMAT_ASTC_12x12_UNORM_BLOCK; // 4-component ASTC, 12x12 blocks, unsigned normalized - - case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR: return VK_FORMAT_ASTC_4x4_SRGB_BLOCK; // 4-component ASTC, 4x4 blocks, sRGB - case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR: return VK_FORMAT_ASTC_5x4_SRGB_BLOCK; // 4-component ASTC, 5x4 blocks, sRGB - case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR: return VK_FORMAT_ASTC_5x5_SRGB_BLOCK; // 4-component ASTC, 5x5 blocks, sRGB - case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR: return VK_FORMAT_ASTC_6x5_SRGB_BLOCK; // 4-component ASTC, 6x5 blocks, sRGB - case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR: return VK_FORMAT_ASTC_6x6_SRGB_BLOCK; // 4-component ASTC, 6x6 blocks, sRGB - case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR: return VK_FORMAT_ASTC_8x5_SRGB_BLOCK; // 4-component ASTC, 8x5 blocks, sRGB - case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR: return VK_FORMAT_ASTC_8x6_SRGB_BLOCK; // 4-component ASTC, 8x6 blocks, sRGB - case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR: return VK_FORMAT_ASTC_8x8_SRGB_BLOCK; // 4-component ASTC, 8x8 blocks, sRGB - case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR: return VK_FORMAT_ASTC_10x5_SRGB_BLOCK; // 4-component ASTC, 10x5 blocks, sRGB - case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR: return VK_FORMAT_ASTC_10x6_SRGB_BLOCK; // 4-component ASTC, 10x6 blocks, sRGB - case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR: return VK_FORMAT_ASTC_10x8_SRGB_BLOCK; // 4-component ASTC, 10x8 blocks, sRGB - case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR: return VK_FORMAT_ASTC_10x10_SRGB_BLOCK; // 4-component ASTC, 10x10 blocks, sRGB - case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR: return VK_FORMAT_ASTC_12x10_SRGB_BLOCK; // 4-component ASTC, 12x10 blocks, sRGB - case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR: return VK_FORMAT_ASTC_12x12_SRGB_BLOCK; // 4-component ASTC, 12x12 blocks, sRGB - - // - // Depth/stencil - // - case GL_DEPTH_COMPONENT16: return VK_FORMAT_D16_UNORM; - case GL_DEPTH_COMPONENT24: return VK_FORMAT_X8_D24_UNORM_PACK32; -// case GL_DEPTH_COMPONENT32: return VK_FORMAT_UNDEFINED; - case GL_DEPTH_COMPONENT32F: return VK_FORMAT_D32_SFLOAT; -#ifdef GL_DEPTH_COMPONENT32F_NV - case GL_DEPTH_COMPONENT32F_NV: return VK_FORMAT_D32_SFLOAT; -#endif -// case GL_STENCIL_INDEX1: return VK_FORMAT_UNDEFINED; -// case GL_STENCIL_INDEX4: return VK_FORMAT_UNDEFINED; - case GL_STENCIL_INDEX8: return VK_FORMAT_S8_UINT; -// case GL_STENCIL_INDEX16: return VK_FORMAT_UNDEFINED; - case GL_DEPTH24_STENCIL8: return VK_FORMAT_D24_UNORM_S8_UINT; - case GL_DEPTH32F_STENCIL8: return VK_FORMAT_D32_SFLOAT_S8_UINT; -#ifdef GL_DEPTH32F_STENCIL8_NV - case GL_DEPTH32F_STENCIL8_NV: return VK_FORMAT_D32_SFLOAT_S8_UINT; -#endif - default: return VK_FORMAT_UNDEFINED; - } -} - -#endif // !VK_FORMAT_H From 72cae9c58ccae53f3970ae68618a830377709578 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Tue, 13 Nov 2018 15:40:14 +0100 Subject: [PATCH 0695/1507] Client: Implement primary-selection-unstable-v1 [ChangeLog][QPA plugin] Added support for middle mouse pasting through the primary-selection-unstable-v1 protocol. Fixes: QTBUG-66008 Change-Id: I7c8fb9aa2c856f5b6794aeab1ee75d80cad05dcd Reviewed-by: Paul Olav Tvete --- .../wayland/protocols/qt_attribution.json | 17 + .../wp-primary-selection-unstable-v1.xml | 225 +++++++++ src/plugins/platforms/wayland/client.pro | 6 + src/plugins/platforms/wayland/configure.json | 5 + .../platforms/wayland/qwaylandclipboard.cpp | 71 ++- .../platforms/wayland/qwaylanddataoffer.cpp | 15 +- .../platforms/wayland/qwaylanddataoffer_p.h | 24 +- .../platforms/wayland/qwaylanddisplay.cpp | 10 +- .../platforms/wayland/qwaylanddisplay_p.h | 9 + .../platforms/wayland/qwaylandinputdevice.cpp | 25 + .../platforms/wayland/qwaylandinputdevice_p.h | 19 +- .../wayland/qwaylandprimaryselectionv1.cpp | 162 ++++++ .../wayland/qwaylandprimaryselectionv1_p.h | 148 ++++++ tests/auto/wayland/client.pro | 1 + .../primaryselectionv1/primaryselectionv1.pro | 7 + .../tst_primaryselectionv1.cpp | 466 ++++++++++++++++++ tests/auto/wayland/shared/corecompositor.h | 17 + tests/auto/wayland/shared/coreprotocol.cpp | 2 + tests/auto/wayland/shared/coreprotocol.h | 3 +- tests/auto/wayland/shared/mockcompositor.h | 8 +- 20 files changed, 1205 insertions(+), 35 deletions(-) create mode 100644 src/3rdparty/wayland/protocols/wp-primary-selection-unstable-v1.xml create mode 100644 src/plugins/platforms/wayland/qwaylandprimaryselectionv1.cpp create mode 100644 src/plugins/platforms/wayland/qwaylandprimaryselectionv1_p.h create mode 100644 tests/auto/wayland/primaryselectionv1/primaryselectionv1.pro create mode 100644 tests/auto/wayland/primaryselectionv1/tst_primaryselectionv1.cpp diff --git a/src/3rdparty/wayland/protocols/qt_attribution.json b/src/3rdparty/wayland/protocols/qt_attribution.json index 7e068f755d6..e6f90698b89 100644 --- a/src/3rdparty/wayland/protocols/qt_attribution.json +++ b/src/3rdparty/wayland/protocols/qt_attribution.json @@ -55,6 +55,23 @@ Copyright © 2012-2013 Collabora, Ltd." Copyright (c) 2013 BMW Car IT GmbH" }, + { + "Id": "wayland-primary-selection-protocol", + "Name": "Wayland Primary Selection Protocol", + "QDocModule": "qtwaylandcompositor", + "QtUsage": "Used in the Qt Wayland platform plugin", + "Files": "wp-primary-selection-unstable-v1.xml", + + "Description": "The primary selection extension allows copying text by selecting it and pasting it with the middle mouse button.", + "Homepage": "https://wayland.freedesktop.org", + "Version": "1", + "DownloadLocation": "https://cgit.freedesktop.org/wayland/wayland-protocols/plain/unstable/primary-selection/primary-selection-unstable-v1.xml", + "LicenseId": "MIT", + "License": "MIT License", + "LicenseFile": "MIT_LICENSE.txt", + "Copyright": "Copyright © 2015 2016 Red Hat" + }, + { "Id": "wayland-scaler-protocol", "Name": "Wayland Scaler Protocol", diff --git a/src/3rdparty/wayland/protocols/wp-primary-selection-unstable-v1.xml b/src/3rdparty/wayland/protocols/wp-primary-selection-unstable-v1.xml new file mode 100644 index 00000000000..e5a39e34cec --- /dev/null +++ b/src/3rdparty/wayland/protocols/wp-primary-selection-unstable-v1.xml @@ -0,0 +1,225 @@ + + + + Copyright © 2015, 2016 Red Hat + + 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. + + + + This protocol provides the ability to have a primary selection device to + match that of the X server. This primary selection is a shortcut to the + common clipboard selection, where text just needs to be selected in order + to allow copying it elsewhere. The de facto way to perform this action + is the middle mouse button, although it is not limited to this one. + + Clients wishing to honor primary selection should create a primary + selection source and set it as the selection through + wp_primary_selection_device.set_selection whenever the text selection + changes. In order to minimize calls in pointer-driven text selection, + it should happen only once after the operation finished. Similarly, + a NULL source should be set when text is unselected. + + wp_primary_selection_offer objects are first announced through the + wp_primary_selection_device.data_offer event. Immediately after this event, + the primary data offer will emit wp_primary_selection_offer.offer events + to let know of the mime types being offered. + + When the primary selection changes, the client with the keyboard focus + will receive wp_primary_selection_device.selection events. Only the client + with the keyboard focus will receive such events with a non-NULL + wp_primary_selection_offer. Across keyboard focus changes, previously + focused clients will receive wp_primary_selection_device.events with a + NULL wp_primary_selection_offer. + + In order to request the primary selection data, the client must pass + a recent serial pertaining to the press event that is triggering the + operation, if the compositor deems the serial valid and recent, the + wp_primary_selection_source.send event will happen in the other end + to let the transfer begin. The client owning the primary selection + should write the requested data, and close the file descriptor + immediately. + + If the primary selection owner client disappeared during the transfer, + the client reading the data will receive a + wp_primary_selection_device.selection event with a NULL + wp_primary_selection_offer, the client should take this as a hint + to finish the reads related to the no longer existing offer. + + The primary selection owner should be checking for errors during + writes, merely cancelling the ongoing transfer if any happened. + + + + + The primary selection device manager is a singleton global object that + provides access to the primary selection. It allows to create + wp_primary_selection_source objects, as well as retrieving the per-seat + wp_primary_selection_device objects. + + + + + Create a new primary selection source. + + + + + + + Create a new data device for a given seat. + + + + + + + + Destroy the primary selection device manager. + + + + + + + + Replaces the current selection. The previous owner of the primary + selection will receive a wp_primary_selection_source.cancelled event. + + To unset the selection, set the source to NULL. + + + + + + + + Introduces a new wp_primary_selection_offer object that may be used + to receive the current primary selection. Immediately following this + event, the new wp_primary_selection_offer object will send + wp_primary_selection_offer.offer events to describe the offered mime + types. + + + + + + + The wp_primary_selection_device.selection event is sent to notify the + client of a new primary selection. This event is sent after the + wp_primary_selection.data_offer event introducing this object, and after + the offer has announced its mimetypes through + wp_primary_selection_offer.offer. + + The data_offer is valid until a new offer or NULL is received + or until the client loses keyboard focus. The client must destroy the + previous selection data_offer, if any, upon receiving this event. + + + + + + + Destroy the primary selection device. + + + + + + + A wp_primary_selection_offer represents an offer to transfer the contents + of the primary selection clipboard to the client. Similar to + wl_data_offer, the offer also describes the mime types that the data can + be converted to and provides the mechanisms for transferring the data + directly to the client. + + + + + To transfer the contents of the primary selection clipboard, the client + issues this request and indicates the mime type that it wants to + receive. The transfer happens through the passed file descriptor + (typically created with the pipe system call). The source client writes + the data in the mime type representation requested and then closes the + file descriptor. + + The receiving client reads from the read end of the pipe until EOF and + closes its end, at which point the transfer is complete. + + + + + + + + Destroy the primary selection offer. + + + + + + Sent immediately after creating announcing the + wp_primary_selection_offer through + wp_primary_selection_device.data_offer. One event is sent per offered + mime type. + + + + + + + + The source side of a wp_primary_selection_offer, it provides a way to + describe the offered data and respond to requests to transfer the + requested contents of the primary selection clipboard. + + + + + This request adds a mime type to the set of mime types advertised to + targets. Can be called several times to offer multiple types. + + + + + + + Destroy the primary selection source. + + + + + + Request for the current primary selection contents from the client. + Send the specified mime type over the passed file descriptor, then + close it. + + + + + + + + This primary selection source is no longer valid. The client should + clean up and destroy this primary selection source. + + + + diff --git a/src/plugins/platforms/wayland/client.pro b/src/plugins/platforms/wayland/client.pro index ff9e845f130..4f4c58328d6 100644 --- a/src/plugins/platforms/wayland/client.pro +++ b/src/plugins/platforms/wayland/client.pro @@ -31,6 +31,7 @@ WAYLANDCLIENTSOURCES += \ ../extensions/touch-extension.xml \ ../extensions/qt-key-unstable-v1.xml \ ../extensions/qt-windowmanager.xml \ + ../3rdparty/protocol/wp-primary-selection-unstable-v1.xml \ ../3rdparty/protocol/text-input-unstable-v2.xml \ ../3rdparty/protocol/xdg-output-unstable-v1.xml \ ../3rdparty/protocol/wayland.xml @@ -118,6 +119,11 @@ qtConfig(wayland-datadevice) { qwaylanddatasource.cpp } +qtConfig(wayland-client-primary-selection) { + HEADERS += qwaylandprimaryselectionv1_p.h + SOURCES += qwaylandprimaryselectionv1.cpp +} + qtConfig(draganddrop) { HEADERS += \ qwaylanddnd_p.h diff --git a/src/plugins/platforms/wayland/configure.json b/src/plugins/platforms/wayland/configure.json index 2ec87eb49ea..403a2edcf13 100644 --- a/src/plugins/platforms/wayland/configure.json +++ b/src/plugins/platforms/wayland/configure.json @@ -93,6 +93,11 @@ "condition": "features.draganddrop || features.clipboard", "output": [ "privateFeature" ] }, + "wayland-client-primary-selection": { + "label": "primary-selection clipboard", + "condition": "features.clipboard", + "output": [ "privateFeature" ] + }, "wayland-client-fullscreen-shell-v1": { "label": "fullscreen-shell-v1", "condition": "features.wayland-client", diff --git a/src/plugins/platforms/wayland/qwaylandclipboard.cpp b/src/plugins/platforms/wayland/qwaylandclipboard.cpp index 60820da92d8..369c6ec07db 100644 --- a/src/plugins/platforms/wayland/qwaylandclipboard.cpp +++ b/src/plugins/platforms/wayland/qwaylandclipboard.cpp @@ -43,6 +43,9 @@ #include "qwaylanddataoffer_p.h" #include "qwaylanddatasource_p.h" #include "qwaylanddatadevice_p.h" +#if QT_CONFIG(wayland_client_primary_selection) +#include "qwaylandprimaryselectionv1_p.h" +#endif QT_BEGIN_NAMESPACE @@ -59,44 +62,74 @@ QWaylandClipboard::~QWaylandClipboard() QMimeData *QWaylandClipboard::mimeData(QClipboard::Mode mode) { - if (mode != QClipboard::Clipboard) + auto *seat = mDisplay->currentInputDevice(); + if (!seat) return &m_emptyData; - QWaylandInputDevice *inputDevice = mDisplay->currentInputDevice(); - if (!inputDevice || !inputDevice->dataDevice()) + switch (mode) { + case QClipboard::Clipboard: + if (auto *dataDevice = seat->dataDevice()) { + if (auto *source = dataDevice->selectionSource()) + return source->mimeData(); + if (auto *offer = dataDevice->selectionOffer()) + return offer->mimeData(); + } + return &m_emptyData; + case QClipboard::Selection: +#if QT_CONFIG(wayland_client_primary_selection) + if (auto *selectionDevice = seat->primarySelectionDevice()) { + if (auto *source = selectionDevice->selectionSource()) + return source->mimeData(); + if (auto *offer = selectionDevice->selectionOffer()) + return offer->mimeData(); + } +#endif + return &m_emptyData; + default: return &m_emptyData; - - QWaylandDataSource *source = inputDevice->dataDevice()->selectionSource(); - if (source) { - return source->mimeData(); } - - if (inputDevice->dataDevice()->selectionOffer()) - return inputDevice->dataDevice()->selectionOffer()->mimeData(); - - return &m_emptyData; } void QWaylandClipboard::setMimeData(QMimeData *data, QClipboard::Mode mode) { - if (mode != QClipboard::Clipboard) - return; - - QWaylandInputDevice *inputDevice = mDisplay->currentInputDevice(); - if (!inputDevice || !inputDevice->dataDevice()) + auto *seat = mDisplay->currentInputDevice(); + if (!seat) return; static const QString plain = QStringLiteral("text/plain"); static const QString utf8 = QStringLiteral("text/plain;charset=utf-8"); + if (data && data->hasFormat(plain) && !data->hasFormat(utf8)) data->setData(utf8, data->data(plain)); - inputDevice->dataDevice()->setSelectionSource(data ? new QWaylandDataSource(mDisplay->dndSelectionHandler(), data) : nullptr); - emitChanged(mode); + switch (mode) { + case QClipboard::Clipboard: + if (auto *dataDevice = seat->dataDevice()) { + dataDevice->setSelectionSource(data ? new QWaylandDataSource(mDisplay->dndSelectionHandler(), data) : nullptr); + emitChanged(mode); + } + break; + case QClipboard::Selection: +#if QT_CONFIG(wayland_client_primary_selection) + if (auto *selectionDevice = seat->primarySelectionDevice()) { + selectionDevice->setSelectionSource(data ? new QWaylandPrimarySelectionSourceV1(mDisplay->primarySelectionManager(), data) : nullptr); + emitChanged(mode); + } +#endif + break; + default: + break; + } } bool QWaylandClipboard::supportsMode(QClipboard::Mode mode) const { +#if QT_CONFIG(wayland_client_primary_selection) + if (mode == QClipboard::Selection) { + auto *seat = mDisplay->currentInputDevice(); + return seat && seat->primarySelectionDevice(); + } +#endif return mode == QClipboard::Clipboard; } diff --git a/src/plugins/platforms/wayland/qwaylanddataoffer.cpp b/src/plugins/platforms/wayland/qwaylanddataoffer.cpp index 0c732c02078..e31e1220f46 100644 --- a/src/plugins/platforms/wayland/qwaylanddataoffer.cpp +++ b/src/plugins/platforms/wayland/qwaylanddataoffer.cpp @@ -58,7 +58,8 @@ static QString utf8Text() QWaylandDataOffer::QWaylandDataOffer(QWaylandDisplay *display, struct ::wl_data_offer *offer) : QtWayland::wl_data_offer(offer) - , m_mimeData(new QWaylandMimeData(this, display)) + , m_display(display) + , m_mimeData(new QWaylandMimeData(this)) { } @@ -81,14 +82,19 @@ QMimeData *QWaylandDataOffer::mimeData() return m_mimeData.data(); } +void QWaylandDataOffer::startReceiving(const QString &mimeType, int fd) +{ + receive(mimeType, fd); + wl_display_flush(m_display->wl_display()); +} + void QWaylandDataOffer::data_offer_offer(const QString &mime_type) { m_mimeData->appendFormat(mime_type); } -QWaylandMimeData::QWaylandMimeData(QWaylandDataOffer *dataOffer, QWaylandDisplay *display) +QWaylandMimeData::QWaylandMimeData(QWaylandAbstractDataOffer *dataOffer) : m_dataOffer(dataOffer) - , m_display(display) { } @@ -140,8 +146,7 @@ QVariant QWaylandMimeData::retrieveData_sys(const QString &mimeType, QVariant::T return QVariant(); } - m_dataOffer->receive(mime, pipefd[1]); - wl_display_flush(m_display->wl_display()); + m_dataOffer->startReceiving(mime, pipefd[1]); close(pipefd[1]); diff --git a/src/plugins/platforms/wayland/qwaylanddataoffer_p.h b/src/plugins/platforms/wayland/qwaylanddataoffer_p.h index 5412400a59e..9cf1483ca6d 100644 --- a/src/plugins/platforms/wayland/qwaylanddataoffer_p.h +++ b/src/plugins/platforms/wayland/qwaylanddataoffer_p.h @@ -65,27 +65,40 @@ namespace QtWaylandClient { class QWaylandDisplay; class QWaylandMimeData; -class Q_WAYLAND_CLIENT_EXPORT QWaylandDataOffer : public QtWayland::wl_data_offer +class QWaylandAbstractDataOffer +{ +public: + virtual void startReceiving(const QString &mimeType, int fd) = 0; + virtual QMimeData *mimeData() = 0; + + virtual ~QWaylandAbstractDataOffer() = default; +}; + +class Q_WAYLAND_CLIENT_EXPORT QWaylandDataOffer + : public QtWayland::wl_data_offer // needs to be the first because we do static casts from the user pointer to the wrapper + , public QWaylandAbstractDataOffer { public: explicit QWaylandDataOffer(QWaylandDisplay *display, struct ::wl_data_offer *offer); ~QWaylandDataOffer() override; + QMimeData *mimeData() override; QString firstFormat() const; - QMimeData *mimeData(); + void startReceiving(const QString &mimeType, int fd) override; protected: void data_offer_offer(const QString &mime_type) override; private: + QWaylandDisplay *m_display = nullptr; QScopedPointer m_mimeData; }; class QWaylandMimeData : public QInternalMimeData { public: - explicit QWaylandMimeData(QWaylandDataOffer *dataOffer, QWaylandDisplay *display); + explicit QWaylandMimeData(QWaylandAbstractDataOffer *dataOffer); ~QWaylandMimeData() override; void appendFormat(const QString &mimeType); @@ -98,13 +111,12 @@ protected: private: int readData(int fd, QByteArray &data) const; - mutable QWaylandDataOffer *m_dataOffer = nullptr; - QWaylandDisplay *m_display = nullptr; + QWaylandAbstractDataOffer *m_dataOffer = nullptr; mutable QStringList m_types; mutable QHash m_data; }; -} +} // namespace QtWaylandClient QT_END_NAMESPACE #endif diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index 7c32b6bf59a..1febca9b1ed 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -52,7 +52,10 @@ #if QT_CONFIG(wayland_datadevice) #include "qwaylanddatadevicemanager_p.h" #include "qwaylanddatadevice_p.h" -#endif +#endif // QT_CONFIG(wayland_datadevice) +#if QT_CONFIG(wayland_client_primary_selection) +#include "qwaylandprimaryselectionv1_p.h" +#endif // QT_CONFIG(wayland_client_primary_selection) #if QT_CONFIG(cursor) #include #endif @@ -69,6 +72,7 @@ #include "qwaylandqtkey_p.h" #include +#include #include @@ -318,6 +322,10 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin mTouchExtension.reset(new QWaylandTouchExtension(this, id)); } else if (interface == QStringLiteral("zqt_key_v1")) { mQtKeyExtension.reset(new QWaylandQtKeyExtension(this, id)); +#if QT_CONFIG(wayland_client_primary_selection) + } else if (interface == QStringLiteral("zwp_primary_selection_device_manager_v1")) { + mPrimarySelectionManager.reset(new QWaylandPrimarySelectionDeviceManagerV1(this, id, 1)); +#endif } else if (interface == QStringLiteral("zwp_text_input_manager_v2") && !mClientSideInputContextRequested) { mTextInputManager.reset(new QtWayland::zwp_text_input_manager_v2(registry, id, 1)); for (QWaylandInputDevice *inputDevice : qAsConst(mInputDevices)) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay_p.h b/src/plugins/platforms/wayland/qwaylanddisplay_p.h index 2c7ed32317c..67df545f67b 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay_p.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay_p.h @@ -93,6 +93,9 @@ class QWaylandScreen; class QWaylandClientBufferIntegration; class QWaylandWindowManagerIntegration; class QWaylandDataDeviceManager; +#if QT_CONFIG(wayland_client_primary_selection) +class QWaylandPrimarySelectionDeviceManagerV1; +#endif class QWaylandTouchExtension; class QWaylandQtKeyExtension; class QWaylandWindow; @@ -149,6 +152,9 @@ public: QWaylandInputDevice *currentInputDevice() const { return defaultInputDevice(); } #if QT_CONFIG(wayland_datadevice) QWaylandDataDeviceManager *dndSelectionHandler() const { return mDndSelectionHandler.data(); } +#endif +#if QT_CONFIG(wayland_client_primary_selection) + QWaylandPrimarySelectionDeviceManagerV1 *primarySelectionManager() const { return mPrimarySelectionManager.data(); } #endif QtWayland::qt_surface_extension *windowExtension() const { return mWindowExtension.data(); } QWaylandTouchExtension *touchExtension() const { return mTouchExtension.data(); } @@ -238,6 +244,9 @@ private: QScopedPointer mTouchExtension; QScopedPointer mQtKeyExtension; QScopedPointer mWindowManagerIntegration; +#if QT_CONFIG(wayland_client_primary_selection) + QScopedPointer mPrimarySelectionManager; +#endif QScopedPointer mTextInputManager; QScopedPointer mHardwareIntegration; QScopedPointer mXdgOutputManager; diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index f0fd995634c..8a580898d81 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -47,6 +47,9 @@ #include "qwaylanddatadevice_p.h" #include "qwaylanddatadevicemanager_p.h" #endif +#if QT_CONFIG(wayland_client_primary_selection) +#include "qwaylandprimaryselectionv1_p.h" +#endif #include "qwaylandtouch_p.h" #include "qwaylandscreen_p.h" #include "qwaylandcursor_p.h" @@ -363,6 +366,12 @@ QWaylandInputDevice::QWaylandInputDevice(QWaylandDisplay *display, int version, } #endif +#if QT_CONFIG(wayland_client_primary_selection) + // TODO: Could probably decouple this more if there was a signal for new seat added + if (auto *psm = mQDisplay->primarySelectionManager()) + setPrimarySelectionDevice(psm->createDevice(this)); +#endif + if (mQDisplay->textInputManager()) mTextInput.reset(new QWaylandTextInput(mQDisplay, mQDisplay->textInputManager()->get_text_input(wl_seat()))); @@ -446,6 +455,18 @@ QWaylandDataDevice *QWaylandInputDevice::dataDevice() const } #endif +#if QT_CONFIG(wayland_client_primary_selection) +void QWaylandInputDevice::setPrimarySelectionDevice(QWaylandPrimarySelectionDeviceV1 *primarySelectionDevice) +{ + mPrimarySelectionDevice.reset(primarySelectionDevice); +} + +QWaylandPrimarySelectionDeviceV1 *QWaylandInputDevice::primarySelectionDevice() const +{ + return mPrimarySelectionDevice.data(); +} +#endif + void QWaylandInputDevice::setTextInput(QWaylandTextInput *textInput) { mTextInput.reset(textInput); @@ -1189,6 +1210,10 @@ void QWaylandInputDevice::Keyboard::handleFocusLost() #if QT_CONFIG(clipboard) if (auto *dataDevice = mParent->dataDevice()) dataDevice->invalidateSelectionOffer(); +#endif +#if QT_CONFIG(wayland_client_primary_selection) + if (auto *device = mParent->primarySelectionDevice()) + device->invalidateSelectionOffer(); #endif mParent->mQDisplay->handleKeyboardFocusChanged(mParent); mRepeatTimer.stop(); diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h index f44f1ab1fb4..06ba5d5664e 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h +++ b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h @@ -78,11 +78,17 @@ struct wl_cursor_image; QT_BEGIN_NAMESPACE +namespace QtWayland { +class zwp_primary_selection_device_v1; +} //namespace QtWayland + namespace QtWaylandClient { -class QWaylandWindow; -class QWaylandDisplay; class QWaylandDataDevice; +class QWaylandDisplay; +#if QT_CONFIG(wayland_client_primary_selection) +class QWaylandPrimarySelectionDeviceV1; +#endif class QWaylandTextInput; #if QT_CONFIG(cursor) class QWaylandCursorTheme; @@ -116,6 +122,11 @@ public: QWaylandDataDevice *dataDevice() const; #endif +#if QT_CONFIG(wayland_client_primary_selection) + void setPrimarySelectionDevice(QWaylandPrimarySelectionDeviceV1 *primarySelectionDevice); + QWaylandPrimarySelectionDeviceV1 *primarySelectionDevice() const; +#endif + void setTextInput(QWaylandTextInput *textInput); QWaylandTextInput *textInput() const; @@ -159,6 +170,10 @@ private: QWaylandDataDevice *mDataDevice = nullptr; #endif +#if QT_CONFIG(wayland_client_primary_selection) + QScopedPointer mPrimarySelectionDevice; +#endif + Keyboard *mKeyboard = nullptr; Pointer *mPointer = nullptr; Touch *mTouch = nullptr; diff --git a/src/plugins/platforms/wayland/qwaylandprimaryselectionv1.cpp b/src/plugins/platforms/wayland/qwaylandprimaryselectionv1.cpp new file mode 100644 index 00000000000..3ddf6dac376 --- /dev/null +++ b/src/plugins/platforms/wayland/qwaylandprimaryselectionv1.cpp @@ -0,0 +1,162 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qwaylandprimaryselectionv1_p.h" +#include "qwaylandinputdevice_p.h" +#include "qwaylanddisplay_p.h" +#include "qwaylandmimehelper_p.h" + +#include + +#include + +QT_BEGIN_NAMESPACE + +namespace QtWaylandClient { + +QWaylandPrimarySelectionDeviceManagerV1::QWaylandPrimarySelectionDeviceManagerV1(QWaylandDisplay *display, uint id, uint version) + : zwp_primary_selection_device_manager_v1(display->wl_registry(), id, qMin(version, uint(1))) + , m_display(display) +{ + // Create devices for all seats. + // This only works if we get the global before all devices + const auto seats = m_display->inputDevices(); + for (auto *seat : seats) + seat->setPrimarySelectionDevice(createDevice(seat)); +} + +QWaylandPrimarySelectionDeviceV1 *QWaylandPrimarySelectionDeviceManagerV1::createDevice(QWaylandInputDevice *seat) +{ + return new QWaylandPrimarySelectionDeviceV1(this, seat); +} + +QWaylandPrimarySelectionOfferV1::QWaylandPrimarySelectionOfferV1(QWaylandDisplay *display, ::zwp_primary_selection_offer_v1 *offer) + : zwp_primary_selection_offer_v1(offer) + , m_display(display) + , m_mimeData(new QWaylandMimeData(this)) +{} + +void QWaylandPrimarySelectionOfferV1::startReceiving(const QString &mimeType, int fd) +{ + receive(mimeType, fd); + wl_display_flush(m_display->wl_display()); +} + +void QWaylandPrimarySelectionOfferV1::zwp_primary_selection_offer_v1_offer(const QString &mime_type) +{ + m_mimeData->appendFormat(mime_type); +} + +QWaylandPrimarySelectionDeviceV1::QWaylandPrimarySelectionDeviceV1( + QWaylandPrimarySelectionDeviceManagerV1 *manager, QWaylandInputDevice *seat) + : QtWayland::zwp_primary_selection_device_v1(manager->get_device(seat->wl_seat())) + , m_display(manager->display()) + , m_seat(seat) +{ +} + +QWaylandPrimarySelectionDeviceV1::~QWaylandPrimarySelectionDeviceV1() +{ + destroy(); +} + +void QWaylandPrimarySelectionDeviceV1::setSelectionSource(QWaylandPrimarySelectionSourceV1 *source) +{ + if (source) { + connect(source, &QWaylandPrimarySelectionSourceV1::cancelled, this, [this]() { + m_selectionSource.reset(); + QGuiApplicationPrivate::platformIntegration()->clipboard()->emitChanged(QClipboard::Selection); + }); + } + set_selection(source ? source->object() : nullptr, m_seat->serial()); + m_selectionSource.reset(source); +} + +void QWaylandPrimarySelectionDeviceV1::zwp_primary_selection_device_v1_data_offer(zwp_primary_selection_offer_v1 *offer) +{ + new QWaylandPrimarySelectionOfferV1(m_display, offer); +} + +void QWaylandPrimarySelectionDeviceV1::zwp_primary_selection_device_v1_selection(zwp_primary_selection_offer_v1 *id) +{ + + if (id) + m_selectionOffer.reset(static_cast(zwp_primary_selection_offer_v1_get_user_data(id))); + else + m_selectionOffer.reset(); + + QGuiApplicationPrivate::platformIntegration()->clipboard()->emitChanged(QClipboard::Selection); +} + +QWaylandPrimarySelectionSourceV1::QWaylandPrimarySelectionSourceV1(QWaylandPrimarySelectionDeviceManagerV1 *manager, QMimeData *mimeData) + : QtWayland::zwp_primary_selection_source_v1(manager->create_source()) + , m_mimeData(mimeData) +{ + if (!mimeData) + return; + for (auto &format : mimeData->formats()) + offer(format); +} + +QWaylandPrimarySelectionSourceV1::~QWaylandPrimarySelectionSourceV1() +{ + destroy(); +} + +void QWaylandPrimarySelectionSourceV1::zwp_primary_selection_source_v1_send(const QString &mime_type, int32_t fd) +{ + QByteArray content = QWaylandMimeHelper::getByteArray(m_mimeData, mime_type); + if (!content.isEmpty()) { + // Create a sigpipe handler that does nothing, or clients may be forced to terminate + // if the pipe is closed in the other end. + struct sigaction action, oldAction; + action.sa_handler = SIG_IGN; + sigemptyset (&action.sa_mask); + action.sa_flags = 0; + + sigaction(SIGPIPE, &action, &oldAction); + write(fd, content.constData(), size_t(content.size())); + sigaction(SIGPIPE, &oldAction, nullptr); + } + close(fd); +} + +} // namespace QtWaylandClient + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandprimaryselectionv1_p.h b/src/plugins/platforms/wayland/qwaylandprimaryselectionv1_p.h new file mode 100644 index 00000000000..b165c51b8c6 --- /dev/null +++ b/src/plugins/platforms/wayland/qwaylandprimaryselectionv1_p.h @@ -0,0 +1,148 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWAYLANDPRIMARYSELECTIONV1_P_H +#define QWAYLANDPRIMARYSELECTIONV1_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include + +#include +#include + +#include + +QT_REQUIRE_CONFIG(wayland_client_primary_selection); + +QT_BEGIN_NAMESPACE + +class QMimeData; + +namespace QtWaylandClient { + +class QWaylandInputDevice; +class QWaylandPrimarySelectionDeviceV1; + +class QWaylandPrimarySelectionDeviceManagerV1 : public QtWayland::zwp_primary_selection_device_manager_v1 +{ +public: + explicit QWaylandPrimarySelectionDeviceManagerV1(QWaylandDisplay *display, uint id, uint version); + QWaylandPrimarySelectionDeviceV1 *createDevice(QWaylandInputDevice *seat); + QWaylandDisplay *display() const { return m_display; } + +private: + QWaylandDisplay *m_display = nullptr; +}; + +class QWaylandPrimarySelectionOfferV1 : public QtWayland::zwp_primary_selection_offer_v1, public QWaylandAbstractDataOffer +{ +public: + explicit QWaylandPrimarySelectionOfferV1(QWaylandDisplay *display, ::zwp_primary_selection_offer_v1 *offer); + ~QWaylandPrimarySelectionOfferV1() override { destroy(); } + void startReceiving(const QString &mimeType, int fd) override; + QMimeData *mimeData() override { return m_mimeData.data(); } + +protected: + void zwp_primary_selection_offer_v1_offer(const QString &mime_type) override; + +private: + QWaylandDisplay *m_display = nullptr; + QScopedPointer m_mimeData; +}; + +class Q_WAYLAND_CLIENT_EXPORT QWaylandPrimarySelectionSourceV1 : public QObject, public QtWayland::zwp_primary_selection_source_v1 +{ + Q_OBJECT +public: + explicit QWaylandPrimarySelectionSourceV1(QWaylandPrimarySelectionDeviceManagerV1 *manager, QMimeData *mimeData); + ~QWaylandPrimarySelectionSourceV1() override; + + QMimeData *mimeData() const { return m_mimeData; } + +signals: + void cancelled(); + +protected: + void zwp_primary_selection_source_v1_send(const QString &mime_type, int32_t fd) override; + void zwp_primary_selection_source_v1_cancelled() override { emit cancelled(); } + +private: + QWaylandDisplay *m_display = nullptr; + QMimeData *m_mimeData = nullptr; +}; + +class QWaylandPrimarySelectionDeviceV1 : public QObject, public QtWayland::zwp_primary_selection_device_v1 +{ + Q_OBJECT + QWaylandPrimarySelectionDeviceV1(QWaylandPrimarySelectionDeviceManagerV1 *manager, QWaylandInputDevice *seat); + +public: + ~QWaylandPrimarySelectionDeviceV1() override; + QWaylandPrimarySelectionOfferV1 *selectionOffer() const { return m_selectionOffer.data(); } + void invalidateSelectionOffer() { m_selectionOffer.reset(); } + QWaylandPrimarySelectionSourceV1 *selectionSource() const { return m_selectionSource.data(); } + void setSelectionSource(QWaylandPrimarySelectionSourceV1 *source); + +protected: + void zwp_primary_selection_device_v1_data_offer(struct ::zwp_primary_selection_offer_v1 *offer) override; + void zwp_primary_selection_device_v1_selection(struct ::zwp_primary_selection_offer_v1 *id) override; + +private: + QWaylandDisplay *m_display = nullptr; + QWaylandInputDevice *m_seat = nullptr; + QScopedPointer m_selectionOffer; + QScopedPointer m_selectionSource; + friend class QWaylandPrimarySelectionDeviceManagerV1; +}; + +} // namespace QtWaylandClient + +QT_END_NAMESPACE + +#endif // QWAYLANDPRIMARYSELECTIONV1_P_H diff --git a/tests/auto/wayland/client.pro b/tests/auto/wayland/client.pro index 5e0dcab8c00..61bf678538d 100644 --- a/tests/auto/wayland/client.pro +++ b/tests/auto/wayland/client.pro @@ -6,6 +6,7 @@ SUBDIRS += \ fullscreenshellv1 \ iviapplication \ output \ + primaryselectionv1 \ seatv4 \ seatv5 \ surface \ diff --git a/tests/auto/wayland/primaryselectionv1/primaryselectionv1.pro b/tests/auto/wayland/primaryselectionv1/primaryselectionv1.pro new file mode 100644 index 00000000000..9d00562df81 --- /dev/null +++ b/tests/auto/wayland/primaryselectionv1/primaryselectionv1.pro @@ -0,0 +1,7 @@ +include (../shared/shared.pri) + +WAYLANDSERVERSOURCES += \ + $$PWD/../../../../src/3rdparty/protocol/wp-primary-selection-unstable-v1.xml + +TARGET = tst_primaryselectionv1 +SOURCES += tst_primaryselectionv1.cpp diff --git a/tests/auto/wayland/primaryselectionv1/tst_primaryselectionv1.cpp b/tests/auto/wayland/primaryselectionv1/tst_primaryselectionv1.cpp new file mode 100644 index 00000000000..281e4c5d11a --- /dev/null +++ b/tests/auto/wayland/primaryselectionv1/tst_primaryselectionv1.cpp @@ -0,0 +1,466 @@ +/**************************************************************************** +** +** Copyright (C) 2018 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "mockcompositor.h" + +#include + +#include +#include +#include +#include + +#include + +using namespace MockCompositor; + +constexpr int primarySelectionVersion = 1; // protocol VERSION, not the name suffix (_v1) + +class PrimarySelectionDeviceV1; +class PrimarySelectionDeviceManagerV1; + +class PrimarySelectionOfferV1 : public QObject, public QtWaylandServer::zwp_primary_selection_offer_v1 +{ + Q_OBJECT +public: + explicit PrimarySelectionOfferV1(PrimarySelectionDeviceV1 *device, wl_client *client, int version) + : zwp_primary_selection_offer_v1(client, 0, version) + , m_device(device) + {} + void send_offer() = delete; + void sendOffer(const QString &offer) + { + zwp_primary_selection_offer_v1::send_offer(offer); + m_mimeTypes << offer; + } + + PrimarySelectionDeviceV1 *m_device = nullptr; + QStringList m_mimeTypes; + +signals: + void receive(QString mimeType, int fd); + +protected: + void zwp_primary_selection_offer_v1_destroy_resource(Resource *resource) override + { + Q_UNUSED(resource); + delete this; + } + + void zwp_primary_selection_offer_v1_receive(Resource *resource, const QString &mime_type, int32_t fd) override + { + Q_UNUSED(resource); + QTRY_VERIFY(m_mimeTypes.contains(mime_type)); + emit receive(mime_type, fd); + } + + void zwp_primary_selection_offer_v1_destroy(Resource *resource) override; +}; + +class PrimarySelectionSourceV1 : public QObject, public QtWaylandServer::zwp_primary_selection_source_v1 +{ + Q_OBJECT +public: + explicit PrimarySelectionSourceV1(wl_client *client, int id, int version) + : zwp_primary_selection_source_v1(client, id, version) + { + } + QStringList m_offers; +protected: + void zwp_primary_selection_source_v1_destroy_resource(Resource *resource) override + { + Q_UNUSED(resource); + delete this; + } + void zwp_primary_selection_source_v1_offer(Resource *resource, const QString &mime_type) override + { + Q_UNUSED(resource); + m_offers << mime_type; + } + void zwp_primary_selection_source_v1_destroy(Resource *resource) override + { + wl_resource_destroy(resource->handle); + } +}; + +class PrimarySelectionDeviceV1 : public QObject, public QtWaylandServer::zwp_primary_selection_device_v1 +{ + Q_OBJECT +public: + explicit PrimarySelectionDeviceV1(PrimarySelectionDeviceManagerV1 *manager, Seat *seat) + : m_manager(manager) + , m_seat(seat) + {} + + void send_data_offer(::wl_resource *resource) = delete; + + PrimarySelectionOfferV1 *sendDataOffer(::wl_client *client, const QStringList &mimeTypes = {}); + + PrimarySelectionOfferV1 *sendDataOffer(const QStringList &mimeTypes = {}) // creates a new offer for the focused surface and sends it + { + Q_ASSERT(m_seat->m_capabilities & Seat::capability_keyboard); + Q_ASSERT(m_seat->m_keyboard->m_enteredSurface); + auto *client = m_seat->m_keyboard->m_enteredSurface->resource()->client(); + return sendDataOffer(client, mimeTypes); + } + + void send_selection(::wl_resource *resource) = delete; + void sendSelection(PrimarySelectionOfferV1 *offer) + { + auto *client = offer->resource()->client(); + for (auto *resource : resourceMap().values(client)) + zwp_primary_selection_device_v1::send_selection(resource->handle, offer->resource()->handle); + m_sentSelectionOffers << offer; + } + + PrimarySelectionDeviceManagerV1 *m_manager = nullptr; + Seat *m_seat = nullptr; + QVector m_sentSelectionOffers; + PrimarySelectionSourceV1 *m_selectionSource = nullptr; + uint m_serial = 0; + +protected: + void zwp_primary_selection_device_v1_set_selection(Resource *resource, ::wl_resource *source, uint32_t serial) override + { + Q_UNUSED(resource); + m_selectionSource = fromResource(source); + m_serial = serial; + } + void zwp_primary_selection_device_v1_destroy(Resource *resource) override + { + wl_resource_destroy(resource->handle); + } + void zwp_primary_selection_device_v1_destroy_resource(Resource *resource) override + { + Q_UNUSED(resource); + delete this; + } +}; + +class PrimarySelectionDeviceManagerV1 : public Global, public QtWaylandServer::zwp_primary_selection_device_manager_v1 +{ + Q_OBJECT +public: + explicit PrimarySelectionDeviceManagerV1(CoreCompositor *compositor, int version = 1) + : QtWaylandServer::zwp_primary_selection_device_manager_v1(compositor->m_display, version) + , m_version(version) + {} + bool isClean() override + { + for (auto *device : qAsConst(m_devices)) { + // The client should not leak selection offers, i.e. if this fails, there is a missing + // zwp_primary_selection_offer_v1.destroy request + if (!device->m_sentSelectionOffers.empty()) + return false; + } + return true; + } + + PrimarySelectionDeviceV1 *deviceFor(Seat *seat) + { + Q_ASSERT(seat); + if (auto *device = m_devices.value(seat, nullptr)) + return device; + + auto *device = new PrimarySelectionDeviceV1(this, seat); + m_devices[seat] = device; + return device; + } + + int m_version = 1; // TODO: Remove on libwayland upgrade + QMap m_devices; + QVector m_sources; +protected: + void zwp_primary_selection_device_manager_v1_destroy(Resource *resource) override + { + // The protocol doesn't say whether managed objects should be destroyed as well, + // so leave them alone, they'll be cleaned up in the destructor anyway + wl_resource_destroy(resource->handle); + } + + void zwp_primary_selection_device_manager_v1_create_source(Resource *resource, uint32_t id) override + { + int version = m_version; + m_sources << new PrimarySelectionSourceV1(resource->client(), id, version); + } + void zwp_primary_selection_device_manager_v1_get_device(Resource *resource, uint32_t id, ::wl_resource *seatResource) override + { + auto *seat = fromResource(seatResource); + QVERIFY(seat); + auto *device = deviceFor(seat); + device->add(resource->client(), id, resource->version()); + } +}; + +PrimarySelectionOfferV1 *PrimarySelectionDeviceV1::sendDataOffer(wl_client *client, const QStringList &mimeTypes) +{ + Q_ASSERT(client); + auto *offer = new PrimarySelectionOfferV1(this, client, m_manager->m_version); + for (auto *resource : resourceMap().values(client)) + zwp_primary_selection_device_v1::send_data_offer(resource->handle, offer->resource()->handle); + for (const auto &mimeType : mimeTypes) + offer->sendOffer(mimeType); + return offer; +} + +void PrimarySelectionOfferV1::zwp_primary_selection_offer_v1_destroy(QtWaylandServer::zwp_primary_selection_offer_v1::Resource *resource) +{ + bool removed = m_device->m_sentSelectionOffers.removeOne(this); + QVERIFY(removed); + wl_resource_destroy(resource->handle); +} + +class PrimarySelectionCompositor : public DefaultCompositor { +public: + explicit PrimarySelectionCompositor() + { + exec([this] { + m_config.autoConfigure = true; + add(primarySelectionVersion); + }); + } + PrimarySelectionDeviceV1 *primarySelectionDevice(int i = 0) { + return get()->deviceFor(get(i)); + } +}; + +class tst_primaryselectionv1 : public QObject, private PrimarySelectionCompositor +{ + Q_OBJECT +private slots: + void cleanup() { QTRY_VERIFY2(isClean(), qPrintable(dirtyMessage())); } + void initTestCase(); + void bindsToManager(); + void createsPrimaryDevice(); + void createsPrimaryDeviceForNewSeats(); + void pasteAscii(); + void pasteUtf8(); + void destroysPreviousSelection(); + void copy(); +}; + +void tst_primaryselectionv1::initTestCase() +{ + QCOMPOSITOR_TRY_VERIFY(pointer()); + QCOMPOSITOR_TRY_VERIFY(!pointer()->resourceMap().empty()); + QCOMPOSITOR_TRY_COMPARE(pointer()->resourceMap().first()->version(), 4); + + QCOMPOSITOR_TRY_VERIFY(keyboard()); +} + +void tst_primaryselectionv1::bindsToManager() +{ + QCOMPOSITOR_TRY_COMPARE(get()->resourceMap().size(), 1); + QCOMPOSITOR_TRY_COMPARE(get()->resourceMap().first()->version(), primarySelectionVersion); +} + +void tst_primaryselectionv1::createsPrimaryDevice() +{ + QCOMPOSITOR_TRY_VERIFY(primarySelectionDevice()); + QCOMPOSITOR_TRY_VERIFY(primarySelectionDevice()->resourceMap().contains(client())); + QCOMPOSITOR_TRY_COMPARE(primarySelectionDevice()->resourceMap().value(client())->version(), primarySelectionVersion); + QTRY_VERIFY(QGuiApplication::clipboard()->supportsSelection()); +} + +void tst_primaryselectionv1::createsPrimaryDeviceForNewSeats() +{ + exec([=] { add(); }); + QCOMPOSITOR_TRY_VERIFY(primarySelectionDevice(1)); +} + +void tst_primaryselectionv1::pasteAscii() +{ + class Window : public QRasterWindow { + public: + void mousePressEvent(QMouseEvent *event) override + { + Q_UNUSED(event); + auto *mimeData = QGuiApplication::clipboard()->mimeData(QClipboard::Selection); + m_formats = mimeData->formats(); + m_text = QGuiApplication::clipboard()->text(QClipboard::Selection); + } + QStringList m_formats; + QString m_text; + }; + + Window window; + window.resize(64, 64); + window.show(); + + QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial); + exec([&] { + auto *surface = xdgSurface()->m_surface; + keyboard()->sendEnter(surface); // Need to set keyboard focus according to protocol + + auto *device = primarySelectionDevice(); + auto *offer = device->sendDataOffer({"text/plain"}); + connect(offer, &PrimarySelectionOfferV1::receive, [](QString mimeType, int fd) { + QFile file; + file.open(fd, QIODevice::WriteOnly, QFile::FileHandleFlag::AutoCloseHandle); + QCOMPARE(mimeType, "text/plain"); + file.write(QByteArray("normal ascii")); + file.close(); + }); + device->sendSelection(offer); + + pointer()->sendEnter(surface, {32, 32}); + pointer()->sendButton(client(), BTN_MIDDLE, 1); + pointer()->sendButton(client(), BTN_MIDDLE, 0); + }); + QTRY_COMPARE(window.m_formats, QStringList{"text/plain"}); + QTRY_COMPARE(window.m_text, "normal ascii"); +} + +void tst_primaryselectionv1::pasteUtf8() +{ + class Window : public QRasterWindow { + public: + void mousePressEvent(QMouseEvent *event) override + { + Q_UNUSED(event); + auto *mimeData = QGuiApplication::clipboard()->mimeData(QClipboard::Selection); + m_formats = mimeData->formats(); + m_text = QGuiApplication::clipboard()->text(QClipboard::Selection); + } + QStringList m_formats; + QString m_text; + }; + + Window window; + window.resize(64, 64); + window.show(); + + QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial); + exec([&] { + auto *surface = xdgSurface()->m_surface; + keyboard()->sendEnter(surface); // Need to set keyboard focus according to protocol + + auto *device = primarySelectionDevice(); + auto *offer = device->sendDataOffer({"text/plain", "text/plain;charset=utf-8"}); + connect(offer, &PrimarySelectionOfferV1::receive, [](QString mimeType, int fd) { + QFile file; + file.open(fd, QIODevice::WriteOnly, QFile::FileHandleFlag::AutoCloseHandle); + QCOMPARE(mimeType, "text/plain;charset=utf-8"); + file.write(QByteArray("face with tears of joy: 😂")); + file.close(); + }); + device->sendSelection(offer); + + pointer()->sendEnter(surface, {32, 32}); + pointer()->sendButton(client(), BTN_MIDDLE, 1); + pointer()->sendButton(client(), BTN_MIDDLE, 0); + }); + QTRY_COMPARE(window.m_formats, QStringList({"text/plain", "text/plain;charset=utf-8"})); + QTRY_COMPARE(window.m_text, "face with tears of joy: 😂"); +} + +void tst_primaryselectionv1::destroysPreviousSelection() +{ + QRasterWindow window; + window.resize(64, 64); + window.show(); + QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial); + + // When the client receives a selection event, it is required to destroy the previous offer + exec([&] { + auto *surface = xdgSurface()->m_surface; + keyboard()->sendEnter(surface); // Need to set keyboard focus according to protocol + + auto *offer = primarySelectionDevice()->sendDataOffer({"text/plain"}); + primarySelectionDevice()->sendSelection(offer); + }); + + exec([&] { + auto *offer = primarySelectionDevice()->sendDataOffer({"text/plain"}); + primarySelectionDevice()->sendSelection(offer); + QCOMPARE(primarySelectionDevice()->m_sentSelectionOffers.size(), 2); + }); + + // Verify the first offer gets destroyed + QCOMPOSITOR_TRY_COMPARE(primarySelectionDevice()->m_sentSelectionOffers.size(), 1); +} + +void tst_primaryselectionv1::copy() +{ + class Window : public QRasterWindow { + public: + void mousePressEvent(QMouseEvent *event) override + { + Q_UNUSED(event); + QGuiApplication::clipboard()->setText("face with tears of joy: 😂", QClipboard::Selection); + } + QStringList m_formats; + QString m_text; + }; + + Window window; + window.resize(64, 64); + window.show(); + + QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial); + QVector mouseSerials; + exec([&] { + auto *surface = xdgSurface()->m_surface; + keyboard()->sendEnter(surface); // Need to set keyboard focus according to protocol + pointer()->sendEnter(surface, {32, 32}); + mouseSerials << pointer()->sendButton(client(), BTN_MIDDLE, 1); + mouseSerials << pointer()->sendButton(client(), BTN_MIDDLE, 0); + }); + QCOMPOSITOR_TRY_VERIFY(primarySelectionDevice()->m_selectionSource); + QCOMPOSITOR_TRY_VERIFY(mouseSerials.contains(primarySelectionDevice()->m_serial)); + QByteArray pastedBuf; + exec([&](){ + auto *source = primarySelectionDevice()->m_selectionSource; + QCOMPARE(source->m_offers, QStringList({"text/plain", "text/plain;charset=utf-8"})); + int fd[2]; + if (pipe(fd) == -1) + QSKIP("Failed to create pipe"); + fcntl(fd[0], F_SETFL, fcntl(fd[0], F_GETFL, 0) | O_NONBLOCK); + source->send_send("text/plain;charset=utf-8", fd[1]); + auto *notifier = new QSocketNotifier(fd[0], QSocketNotifier::Read, this); + connect(notifier, &QSocketNotifier::activated, this, [&](int fd) { + exec([&]{ + static char buf[1024]; + int n = QT_READ(fd, buf, sizeof buf); + if (n <= 0) { + delete notifier; + close(fd); + } else { + pastedBuf.append(buf, n); + } + }); + }); + }); + + QCOMPOSITOR_TRY_VERIFY(pastedBuf.size()); // this assumes we got everything in one read + auto pasted = QString::fromUtf8(pastedBuf); + QCOMPARE(pasted, "face with tears of joy: 😂"); +} + +QCOMPOSITOR_TEST_MAIN(tst_primaryselectionv1) +#include "tst_primaryselectionv1.moc" diff --git a/tests/auto/wayland/shared/corecompositor.h b/tests/auto/wayland/shared/corecompositor.h index 875b7d050ac..254465ee6ec 100644 --- a/tests/auto/wayland/shared/corecompositor.h +++ b/tests/auto/wayland/shared/corecompositor.h @@ -124,6 +124,23 @@ public: return nullptr; } + /*! + * \brief Returns the nth global with the given type, if any + */ + template + global_type *get(int index) + { + warnIfNotLockedByThread(Q_FUNC_INFO); + for (auto *global : qAsConst(m_globals)) { + if (auto *casted = qobject_cast(global)) { + if (index--) + continue; + return casted; + } + } + return nullptr; + } + /*! * \brief Returns all globals with the given type, if any */ diff --git a/tests/auto/wayland/shared/coreprotocol.cpp b/tests/auto/wayland/shared/coreprotocol.cpp index b10377c2cbd..f9335e7834a 100644 --- a/tests/auto/wayland/shared/coreprotocol.cpp +++ b/tests/auto/wayland/shared/coreprotocol.cpp @@ -378,6 +378,7 @@ uint Keyboard::sendEnter(Surface *surface) const auto pointerResources = resourceMap().values(client); for (auto *r : pointerResources) send_enter(r->handle, serial, surface->resource()->handle, QByteArray()); + m_enteredSurface = surface; return serial; } @@ -388,6 +389,7 @@ uint Keyboard::sendLeave(Surface *surface) const auto pointerResources = resourceMap().values(client); for (auto *r : pointerResources) send_leave(r->handle, serial, surface->resource()->handle); + m_enteredSurface = nullptr; return serial; } diff --git a/tests/auto/wayland/shared/coreprotocol.h b/tests/auto/wayland/shared/coreprotocol.h index 3563331c74c..264c5f694e6 100644 --- a/tests/auto/wayland/shared/coreprotocol.h +++ b/tests/auto/wayland/shared/coreprotocol.h @@ -236,7 +236,7 @@ class Seat : public Global, public QtWaylandServer::wl_seat { Q_OBJECT public: - explicit Seat(CoreCompositor *compositor, uint capabilities, int version = 4); + explicit Seat(CoreCompositor *compositor, uint capabilities = Seat::capability_pointer | Seat::capability_keyboard, int version = 4); ~Seat() override; void send_capabilities(Resource *resource, uint capabilities) = delete; // Use wrapper instead void send_capabilities(uint capabilities) = delete; // Use wrapper instead @@ -317,6 +317,7 @@ public: uint sendLeave(Surface *surface); uint sendKey(wl_client *client, uint key, uint state); Seat *m_seat = nullptr; + Surface *m_enteredSurface = nullptr; }; class Shm : public Global, public QtWaylandServer::wl_shm diff --git a/tests/auto/wayland/shared/mockcompositor.h b/tests/auto/wayland/shared/mockcompositor.h index 75ef1eaea1d..aa85a4aeace 100644 --- a/tests/auto/wayland/shared/mockcompositor.h +++ b/tests/auto/wayland/shared/mockcompositor.h @@ -36,10 +36,16 @@ #include -#ifndef BTN_LEFT // As defined in linux/input-event-codes.h +#ifndef BTN_LEFT #define BTN_LEFT 0x110 #endif +#ifndef BTN_RIGHT +#define BTN_RIGHT 0x111 +#endif +#ifndef BTN_MIDDLE +#define BTN_MIDDLE 0x112 +#endif namespace MockCompositor { From 6b761b744891ab9b4b0e48c6f836ea5ebc9cb076 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Fri, 17 May 2019 10:54:12 +0200 Subject: [PATCH 0696/1507] QWaylandDisplay: make hasRegistryGlobal() const-correct and take a QStringView Also port a Q_FOREACH loop to C++11 ranged-for. Change-Id: Ifde232a00e6abed285efaf146a48521c7df25378 Reviewed-by: Johan Helsing --- src/plugins/platforms/wayland/qwaylanddisplay.cpp | 4 ++-- src/plugins/platforms/wayland/qwaylanddisplay_p.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index 1febca9b1ed..d0f98170201 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -386,9 +386,9 @@ void QWaylandDisplay::registry_global_remove(uint32_t id) } } -bool QWaylandDisplay::hasRegistryGlobal(const QString &interfaceName) +bool QWaylandDisplay::hasRegistryGlobal(QStringView interfaceName) const { - Q_FOREACH (const RegistryGlobal &global, mGlobals) + for (const RegistryGlobal &global : mGlobals) if (global.interface == interfaceName) return true; diff --git a/src/plugins/platforms/wayland/qwaylanddisplay_p.h b/src/plugins/platforms/wayland/qwaylanddisplay_p.h index 67df545f67b..1f085e67ecd 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay_p.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay_p.h @@ -173,7 +173,7 @@ public: : id(id_), interface(interface_), version(version_), registry(registry_) { } }; QList globals() const { return mGlobals; } - bool hasRegistryGlobal(const QString &interfaceName); + bool hasRegistryGlobal(QStringView interfaceName) const; /* wl_registry_add_listener does not add but rather sets a listener, so this function is used * to enable many listeners at once. */ From 13ee0581fa6d00d8597c9acc304445ca2a059272 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Tue, 14 May 2019 09:38:08 +0200 Subject: [PATCH 0697/1507] xdg-shell v6 client test: use QTRY_COMPARE instead of QTRY_VERIFY Change-Id: I5f04676e0090bcb849a765ae5365845f199de987 Reviewed-by: Paul Olav Tvete --- tests/auto/wayland/xdgshellv6/tst_xdgshellv6.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/auto/wayland/xdgshellv6/tst_xdgshellv6.cpp b/tests/auto/wayland/xdgshellv6/tst_xdgshellv6.cpp index a397f60eb4e..027e1dfa807 100644 --- a/tests/auto/wayland/xdgshellv6/tst_xdgshellv6.cpp +++ b/tests/auto/wayland/xdgshellv6/tst_xdgshellv6.cpp @@ -413,11 +413,11 @@ void tst_WaylandClientXdgShellV6::dontSpamExposeEvents() QSharedPointer surface; QTRY_VERIFY(surface = m_compositor->surface()); - QTRY_VERIFY(window.exposeEventCount == 0); + QTRY_COMPARE(window.exposeEventCount, 0); m_compositor->sendShellSurfaceConfigure(surface); QTRY_VERIFY(window.isExposed()); - QTRY_VERIFY(window.exposeEventCount == 1); + QTRY_COMPARE(window.exposeEventCount, 1); } int main(int argc, char **argv) From 9f64f52e23c3ee5fce84127ec238cc177f96aee5 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Fri, 17 May 2019 11:07:02 +0200 Subject: [PATCH 0698/1507] Eradicate Q_FOREACH loops [1/2]: trivial cases In this patch, we port Q_FOREACH loops to C++11 ranged-for loops. All cases are trivial in the sense that either the argument is already const or is trivially marked as const, either by qAsConst(), or, in the case of rvalues, by storing to a const auto temporary first. In addition, all loop bodies are clear enough to confirm that the container we iterate over is not changed under iteration. This does not exclude cases where a loop is prematurely exited just after calling a modifier on the container, as that is safe, if not especially elegant. Change-Id: I87a63f07797437d421567d60e52305391a3c4f21 Reviewed-by: Johan Helsing --- .../wl-shell/qwaylandwlshellintegration.cpp | 3 ++- .../xdg-shell-v5/qwaylandxdgshellv5integration.cpp | 3 ++- src/plugins/platforms/wayland/qwaylanddatasource.cpp | 3 ++- src/plugins/platforms/wayland/qwaylanddisplay.cpp | 2 +- src/plugins/platforms/wayland/qwaylandinputcontext.cpp | 4 ++-- src/plugins/platforms/wayland/qwaylandinputdevice.cpp | 2 +- src/plugins/platforms/wayland/qwaylandintegration.cpp | 2 +- src/plugins/platforms/wayland/qwaylandscreen.cpp | 3 ++- .../platforms/wayland/qwaylandshmbackingstore.cpp | 3 ++- src/plugins/platforms/wayland/qwaylandwindow.cpp | 5 +++-- .../wayland/shared/qwaylandinputmethodeventbuilder.cpp | 2 +- src/tools/qtwaylandscanner/qtwaylandscanner.cpp | 10 +++++----- tests/auto/wayland/shared_old/mockcompositor.cpp | 4 ++-- 13 files changed, 26 insertions(+), 20 deletions(-) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellintegration.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellintegration.cpp index f396e840267..ab809806241 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellintegration.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellintegration.cpp @@ -49,7 +49,8 @@ namespace QtWaylandClient { bool QWaylandWlShellIntegration::initialize(QWaylandDisplay *display) { - Q_FOREACH (QWaylandDisplay::RegistryGlobal global, display->globals()) { + const auto globals = display->globals(); + for (QWaylandDisplay::RegistryGlobal global : globals) { if (global.interface == QLatin1String("wl_shell")) { m_wlShell = new QtWayland::wl_shell(display->wl_registry(), global.id, 1); break; diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshellv5integration.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshellv5integration.cpp index 410f2700129..4e25949fa30 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshellv5integration.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshellv5integration.cpp @@ -51,7 +51,8 @@ namespace QtWaylandClient { bool QWaylandXdgShellV5Integration::initialize(QWaylandDisplay *display) { - Q_FOREACH (QWaylandDisplay::RegistryGlobal global, display->globals()) { + const auto globals = display->globals(); + for (QWaylandDisplay::RegistryGlobal global : globals) { if (global.interface == QLatin1String("xdg_shell")) { m_xdgShell.reset(new QWaylandXdgShellV5(display->wl_registry(), global.id)); break; diff --git a/src/plugins/platforms/wayland/qwaylanddatasource.cpp b/src/plugins/platforms/wayland/qwaylanddatasource.cpp index 0c6ad50e4b7..ea76943a734 100644 --- a/src/plugins/platforms/wayland/qwaylanddatasource.cpp +++ b/src/plugins/platforms/wayland/qwaylanddatasource.cpp @@ -60,7 +60,8 @@ QWaylandDataSource::QWaylandDataSource(QWaylandDataDeviceManager *dataDeviceMana { if (!mimeData) return; - Q_FOREACH (const QString &format, mimeData->formats()) { + const auto formats = mimeData->formats(); + for (const QString &format : formats) { offer(format); } } diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index d0f98170201..41bdf6b056b 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -366,7 +366,7 @@ void QWaylandDisplay::registry_global_remove(uint32_t id) } } - foreach (QWaylandScreen *screen, mScreens) { + for (QWaylandScreen *screen : qAsConst(mScreens)) { if (screen->outputId() == id) { mScreens.removeOne(screen); QWindowSystemInterface::handleScreenRemoved(screen); diff --git a/src/plugins/platforms/wayland/qwaylandinputcontext.cpp b/src/plugins/platforms/wayland/qwaylandinputcontext.cpp index 1d34f06cc45..068c058e7a0 100644 --- a/src/plugins/platforms/wayland/qwaylandinputcontext.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputcontext.cpp @@ -221,11 +221,11 @@ void QWaylandTextInput::zwp_text_input_v2_leave(uint32_t serial, ::wl_surface *s void QWaylandTextInput::zwp_text_input_v2_modifiers_map(wl_array *map) { - QList modifiersMap = QByteArray::fromRawData(static_cast(map->data), map->size).split('\0'); + const QList modifiersMap = QByteArray::fromRawData(static_cast(map->data), map->size).split('\0'); m_modifiersMap.clear(); - Q_FOREACH (const QByteArray &modifier, modifiersMap) { + for (const QByteArray &modifier : modifiersMap) { if (modifier == "Shift") m_modifiersMap.append(Qt::ShiftModifier); else if (modifier == "Control") diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index 8a580898d81..6ebc3bed748 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -1349,7 +1349,7 @@ bool QWaylandInputDevice::Touch::allTouchPointsReleased() void QWaylandInputDevice::Touch::releasePoints() { - Q_FOREACH (const QWindowSystemInterface::TouchPoint &previousPoint, mPrevTouchPoints) { + for (const QWindowSystemInterface::TouchPoint &previousPoint : qAsConst(mPrevTouchPoints)) { QWindowSystemInterface::TouchPoint tp = previousPoint; tp.state = Qt::TouchPointReleased; mTouchPoints.append(tp); diff --git a/src/plugins/platforms/wayland/qwaylandintegration.cpp b/src/plugins/platforms/wayland/qwaylandintegration.cpp index ea2b50b4aea..e75aebd9e9a 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandintegration.cpp @@ -421,7 +421,7 @@ void QWaylandIntegration::initializeShellIntegration() preferredShells << QLatin1String("wl-shell") << QLatin1String("ivi-shell"); } - Q_FOREACH (QString preferredShell, preferredShells) { + for (const QString &preferredShell : qAsConst(preferredShells)) { mShellIntegration.reset(createShellIntegration(preferredShell)); if (mShellIntegration) { qCDebug(lcQpaWayland, "Using the '%s' shell integration", qPrintable(preferredShell)); diff --git a/src/plugins/platforms/wayland/qwaylandscreen.cpp b/src/plugins/platforms/wayland/qwaylandscreen.cpp index d116a807bb9..e707968322d 100644 --- a/src/plugins/platforms/wayland/qwaylandscreen.cpp +++ b/src/plugins/platforms/wayland/qwaylandscreen.cpp @@ -175,7 +175,8 @@ QList QWaylandScreen::virtualSiblings() const void QWaylandScreen::setOrientationUpdateMask(Qt::ScreenOrientations mask) { - foreach (QWindow *window, QGuiApplication::allWindows()) { + const auto allWindows = QGuiApplication::allWindows(); + for (QWindow *window : allWindows) { QWaylandWindow *w = static_cast(window->handle()); if (w && w->waylandScreen() == this) w->setOrientationMask(mask); diff --git a/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp b/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp index c16d346eb3f..d768e7fc236 100644 --- a/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp +++ b/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp @@ -243,7 +243,8 @@ void QWaylandShmBackingStore::resize(const QSize &size, const QRegion &) QWaylandShmBuffer *QWaylandShmBackingStore::getBuffer(const QSize &size) { - foreach (QWaylandShmBuffer *b, mBuffers) { + const auto copy = mBuffers; // remove when ported to vector + remove_if + for (QWaylandShmBuffer *b : copy) { if (!b->busy()) { if (b->size() == size) { return b; diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 9bc400f8af8..c3bfdeaff5f 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -94,7 +94,8 @@ QWaylandWindow::~QWaylandWindow() reset(false); const QWindow *parent = window(); - foreach (QWindow *w, QGuiApplication::topLevelWindows()) { + const auto tlw = QGuiApplication::topLevelWindows(); + for (QWindow *w : tlw) { if (w->transientParent() == parent) QWindowSystemInterface::handleCloseEvent(w); } @@ -786,7 +787,7 @@ bool QWaylandWindow::createDecoration() } if (hadDecoration != (bool)mWindowDecoration) { - foreach (QWaylandSubSurface *subsurf, mChildren) { + for (QWaylandSubSurface *subsurf : qAsConst(mChildren)) { QPoint pos = subsurf->window()->geometry().topLeft(); QMargins m = frameMargins(); subsurf->set_position(pos.x() + m.left(), pos.y() + m.top()); diff --git a/src/plugins/platforms/wayland/shared/qwaylandinputmethodeventbuilder.cpp b/src/plugins/platforms/wayland/shared/qwaylandinputmethodeventbuilder.cpp index 88056637df9..526d0ef465e 100644 --- a/src/plugins/platforms/wayland/shared/qwaylandinputmethodeventbuilder.cpp +++ b/src/plugins/platforms/wayland/shared/qwaylandinputmethodeventbuilder.cpp @@ -157,7 +157,7 @@ QInputMethodEvent QWaylandInputMethodEventBuilder::buildPreedit(const QString &t attributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::Cursor, indexFromWayland(text, m_preeditCursor), 1, QVariant())); } - Q_FOREACH (const QInputMethodEvent::Attribute &attr, m_preeditStyles) { + for (const QInputMethodEvent::Attribute &attr : qAsConst(m_preeditStyles)) { int start = indexFromWayland(text, attr.start); int length = indexFromWayland(text, attr.start + attr.length) - start; attributes.append(QInputMethodEvent::Attribute(attr.type, start, length, attr.value)); diff --git a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp index 7f3dc5ad6bb..02bb5701cda 100644 --- a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp +++ b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp @@ -542,7 +542,7 @@ bool Scanner::process() if (hasEvents) { printf("\n"); - foreach (const WaylandEvent &e, interface.events) { + for (const WaylandEvent &e : interface.events) { printf(" void send_"); printEvent(e); printf(";\n"); @@ -563,7 +563,7 @@ bool Scanner::process() if (hasRequests) { printf("\n"); - foreach (const WaylandEvent &e, interface.requests) { + for (const WaylandEvent &e : interface.requests) { printf(" virtual void %s_", interfaceNameStripped); printEvent(e); printf(";\n"); @@ -826,7 +826,7 @@ bool Scanner::process() printf("\n"); printf(" };\n"); - foreach (const WaylandEvent &e, interface.requests) { + for (const WaylandEvent &e : interface.requests) { printf("\n"); printf(" void %s::%s_", interfaceName, interfaceNameStripped); printEvent(e, true); @@ -996,7 +996,7 @@ bool Scanner::process() if (!interface.requests.isEmpty()) { printf("\n"); - foreach (const WaylandEvent &e, interface.requests) { + for (const WaylandEvent &e : interface.requests) { const WaylandArgument *new_id = newIdArgument(e.arguments); QByteArray new_id_str = "void "; if (new_id) { @@ -1016,7 +1016,7 @@ bool Scanner::process() if (hasEvents) { printf("\n"); printf(" protected:\n"); - foreach (const WaylandEvent &e, interface.events) { + for (const WaylandEvent &e : interface.events) { printf(" virtual void %s_", interfaceNameStripped); printEvent(e); printf(";\n"); diff --git a/tests/auto/wayland/shared_old/mockcompositor.cpp b/tests/auto/wayland/shared_old/mockcompositor.cpp index 0dfaef5eaa6..f71a78102e9 100644 --- a/tests/auto/wayland/shared_old/mockcompositor.cpp +++ b/tests/auto/wayland/shared_old/mockcompositor.cpp @@ -221,8 +221,8 @@ QSharedPointer MockCompositor::surface() QSharedPointer result; lock(); { - QVector surfaces = m_compositor->surfaces(); - foreach (Impl::Surface *surface, surfaces) { + const QVector surfaces = m_compositor->surfaces(); + for (Impl::Surface *surface : surfaces) { // we don't want to mistake the cursor surface for a window surface if (surface->isMapped()) { result = surface->mockSurface(); From 0f80177d988ce8122bf6c4f8225a1f84b110e269 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Fri, 17 May 2019 11:38:48 +0200 Subject: [PATCH 0699/1507] Use some qExchange() This makes the code more compact and avoids any doubts regarding accesses to the underlying container under iteration, if any. Change-Id: I6cf8a6113f182ae5c4401cb44fce2a3904c67489 Reviewed-by: Johan Helsing --- src/plugins/platforms/wayland/qwaylanddisplay.cpp | 6 ++---- tests/auto/wayland/shared_old/mocksurface.cpp | 3 +-- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index 41bdf6b056b..53f5cfcea44 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -167,13 +167,11 @@ QWaylandDisplay::~QWaylandDisplay(void) if (mSyncCallback) wl_callback_destroy(mSyncCallback); - qDeleteAll(mInputDevices); - mInputDevices.clear(); + qDeleteAll(qExchange(mInputDevices, {})); - foreach (QWaylandScreen *screen, mScreens) { + for (QWaylandScreen *screen : qExchange(mScreens, {})) { QWindowSystemInterface::handleScreenRemoved(screen); } - mScreens.clear(); qDeleteAll(mWaitingScreens); #if QT_CONFIG(wayland_datadevice) diff --git a/tests/auto/wayland/shared_old/mocksurface.cpp b/tests/auto/wayland/shared_old/mocksurface.cpp index 81a5edbd05f..e9df5f90750 100644 --- a/tests/auto/wayland/shared_old/mocksurface.cpp +++ b/tests/auto/wayland/shared_old/mocksurface.cpp @@ -149,11 +149,10 @@ void Surface::surface_commit(Resource *resource) } } - foreach (wl_resource *frameCallback, m_frameCallbackList) { + for (wl_resource *frameCallback : qExchange(m_frameCallbackList, {})) { wl_callback_send_done(frameCallback, m_compositor->time()); wl_resource_destroy(frameCallback); } - m_frameCallbackList.clear(); } } From 84c3fcffd937d2e826cc9f835a44a63490b62dcf Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Tue, 21 May 2019 09:06:30 +0200 Subject: [PATCH 0700/1507] Client: Don't crash when the cursor theme fails to load Fixes: QTBUG-75920 Change-Id: I29d84b487afb2a90b8a633abce2fcc39ca75adae Reviewed-by: Paul Olav Tvete Reviewed-by: Jani Heikkinen --- src/plugins/platforms/wayland/qwaylandinputdevice.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index 39c02d962c7..7f6f01cd1b9 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -272,6 +272,10 @@ void QWaylandInputDevice::Pointer::updateCursorTheme() int pixelSize = cursorSize() * scale; auto *display = seat()->mQDisplay; mCursor.theme = display->loadCursorTheme(cursorThemeName(), pixelSize); + + if (!mCursor.theme) + return; // A warning has already been printed in loadCursorTheme + if (auto *arrow = mCursor.theme->cursorImage(Qt::ArrowCursor)) { int arrowPixelSize = qMax(arrow->width, arrow->height); // Not all cursor themes are square while (scale > 1 && arrowPixelSize / scale < cursorSize()) @@ -310,6 +314,9 @@ void QWaylandInputDevice::Pointer::updateCursor() if (!mCursor.theme || idealCursorScale() != mCursor.themeBufferScale) updateCursorTheme(); + if (!mCursor.theme) + return; + // Set from shape using theme if (struct ::wl_cursor_image *image = mCursor.theme->cursorImage(shape)) { struct wl_buffer *buffer = wl_cursor_image_get_buffer(image); From c2e19ca64ed70e4f567f0ca5662778737818d49e Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Wed, 22 May 2019 23:49:20 +0100 Subject: [PATCH 0701/1507] Avoid creating decoration whilst Xdg Decoration is pending configure Currently even when we are on on a compositor with SSDs we always create a decoration instance only to discard it. Not only is this somewhat wasteful, it creates sizing problems as the frame geometry changes, leading to constantly expanding windows on kwin. This patch assumes that if we have a decoration manager we should have no decoration until it is configured to do so. This is safe because we request a mode in the constructor, a compositor must reply with a configure event and we shouldn't be showing any buffers until the first configure event is received. Behavior without a decoration manager is unchanged Change-Id: I72b2cf4423fe6461ba405612262f76cefe4d6201 Reviewed-by: Johan Helsing --- .../shellintegration/xdg-shell/qwaylandxdgdecorationv1.cpp | 6 ++++++ .../shellintegration/xdg-shell/qwaylandxdgdecorationv1_p.h | 2 ++ .../plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp | 3 ++- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgdecorationv1.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgdecorationv1.cpp index 345ff32ad90..c6e1afabc5e 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgdecorationv1.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgdecorationv1.cpp @@ -95,9 +95,15 @@ QWaylandXdgToplevelDecorationV1::mode QWaylandXdgToplevelDecorationV1::pending() return m_pending; } +bool QWaylandXdgToplevelDecorationV1::isConfigured() const +{ + return m_configured; +} + void QtWaylandClient::QWaylandXdgToplevelDecorationV1::zxdg_toplevel_decoration_v1_configure(uint32_t mode) { m_pending = zxdg_toplevel_decoration_v1::mode(mode); + m_configured = true; } } diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgdecorationv1_p.h b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgdecorationv1_p.h index d6d8ce94e45..c3a13ce3291 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgdecorationv1_p.h +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgdecorationv1_p.h @@ -80,6 +80,7 @@ public: void requestMode(mode mode); void unsetMode(); mode pending() const; + bool isConfigured() const; protected: void zxdg_toplevel_decoration_v1_configure(uint32_t mode) override; @@ -88,6 +89,7 @@ private: mode m_pending = mode_client_side; mode m_requested = mode_client_side; bool m_modeSet = false; + bool m_configured = false; }; QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp index 385651bbef3..f55298134fe 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp @@ -112,7 +112,8 @@ void QWaylandXdgSurface::Toplevel::applyConfigure() bool QWaylandXdgSurface::Toplevel::wantsDecorations() { - if (m_decoration && m_decoration->pending() == QWaylandXdgToplevelDecorationV1::mode_server_side) + if (m_decoration && (m_decoration->pending() == QWaylandXdgToplevelDecorationV1::mode_server_side + || !m_decoration->isConfigured())) return false; return !(m_pending.states & Qt::WindowFullScreen); From 867af0f5578cb1f1580fb6fbbe6a878dc2a8590e Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Fri, 17 May 2019 11:42:53 +0200 Subject: [PATCH 0702/1507] Eradicate Q_FOREACH loops [2/2]: non-trivial cases This patch contains two changes where there is a non-neglible chance that through some indirect call the container we iterate over could be modified. In the listener case, it's not impossible that a listener de-registers when it's notified. So take a copy. In the polish_objects case, the 'initialized' flag is set before the loop starts, and the only other reference to polish_objects, in addPolishObject(), does not append to polish_objects in that case, but sends the polish event directly. So use a consume loop, to release the memory and the QPointers once they're dealt with. Change-Id: I63d32e8a298ed5e1a7d5446434c421df80c0c795 Reviewed-by: Johan Helsing --- src/plugins/platforms/wayland/qwaylanddisplay.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index 53f5cfcea44..cb4f190ad86 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -346,7 +346,8 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin mGlobals.append(RegistryGlobal(id, interface, version, registry)); - foreach (Listener l, mRegistryListeners) + const auto copy = mRegistryListeners; // be prepared for listeners unregistering on notification + for (Listener l : copy) (*l.listener)(l.data, registry, id, interface, version); } From 4a9a5e2f62935488b1eeb06cd5d69a168a5a9308 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Wed, 5 Jun 2019 13:10:38 +0200 Subject: [PATCH 0703/1507] Client: Don't add all windows to activePopups Neither Qt::ToolTip nor Qt::Popup are single bits in Qt::WindowFlags, and do in fact include Qt::Window. This meant that when we or'ed them and did a bitwise and with QWindow::type(), we would match more types than just Qt::Popup and Qt::ToolTip. We would for instance get any Qt::Window as well, which meant the main window would be added to activePopups, leading to strange things happening, such as crashes and the main window closing unexpectedly. [ChangeLog][QPA plugin] Fixed a crash when closing multiple popups at once. Fixes: QTBUG-76124 Change-Id: I1a6a59e161a436604a7ac8ab824396481dc99a20 Reviewed-by: Paul Olav Tvete --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 58e0fc5857e..cecdbda9214 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -393,7 +393,7 @@ QWaylandScreen *QWaylandWindow::calculateScreenFromSurfaceEvents() const void QWaylandWindow::setVisible(bool visible) { if (visible) { - if (window()->type() & (Qt::Popup | Qt::ToolTip)) + if (window()->type() == Qt::Popup || window()->type() == Qt::ToolTip) activePopups << this; initWindow(); mDisplay->flushRequests(); From c6d679eabc7bdb2c957f501d580f72c3023096a1 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Wed, 5 Jun 2019 13:10:38 +0200 Subject: [PATCH 0704/1507] Client: Don't add all windows to activePopups Neither Qt::ToolTip nor Qt::Popup are single bits in Qt::WindowFlags, and do in fact include Qt::Window. This meant that when we or'ed them and did a bitwise and with QWindow::type(), we would match more types than just Qt::Popup and Qt::ToolTip. We would for instance get any Qt::Window as well, which meant the main window would be added to activePopups, leading to strange things happening, such as crashes and the main window closing unexpectedly. [ChangeLog][QPA plugin] Fixed a crash when closing multiple popups at once. Fixes: QTBUG-76124 Change-Id: I1a6a59e161a436604a7ac8ab824396481dc99a20 Reviewed-by: Paul Olav Tvete (cherry picked from commit 4a9a5e2f62935488b1eeb06cd5d69a168a5a9308) --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 58e0fc5857e..cecdbda9214 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -393,7 +393,7 @@ QWaylandScreen *QWaylandWindow::calculateScreenFromSurfaceEvents() const void QWaylandWindow::setVisible(bool visible) { if (visible) { - if (window()->type() & (Qt::Popup | Qt::ToolTip)) + if (window()->type() == Qt::Popup || window()->type() == Qt::ToolTip) activePopups << this; initWindow(); mDisplay->flushRequests(); From 1c59778c10ddcebfdef182c7a2fe82c280af9d2a Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Wed, 5 Jun 2019 13:10:38 +0200 Subject: [PATCH 0705/1507] Client: Don't add all windows to activePopups Neither Qt::ToolTip nor Qt::Popup are single bits in Qt::WindowFlags, and do in fact include Qt::Window. This meant that when we or'ed them and did a bitwise and with QWindow::type(), we would match more types than just Qt::Popup and Qt::ToolTip. We would for instance get any Qt::Window as well, which meant the main window would be added to activePopups, leading to strange things happening, such as crashes and the main window closing unexpectedly. [ChangeLog][QPA plugin] Fixed a crash when closing multiple popups at once. Fixes: QTBUG-76124 Change-Id: I1a6a59e161a436604a7ac8ab824396481dc99a20 Reviewed-by: Paul Olav Tvete (cherry picked from commit 4a9a5e2f62935488b1eeb06cd5d69a168a5a9308) --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 4532bc23607..8b2c12277c5 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -387,7 +387,7 @@ QWaylandScreen *QWaylandWindow::calculateScreenFromSurfaceEvents() const void QWaylandWindow::setVisible(bool visible) { if (visible) { - if (window()->type() & (Qt::Popup | Qt::ToolTip)) + if (window()->type() == Qt::Popup || window()->type() == Qt::ToolTip) activePopups << this; initWindow(); mDisplay->flushRequests(); From 002fade6293be14991e90e599b1c9d1954c21e97 Mon Sep 17 00:00:00 2001 From: Aleix Pol Date: Wed, 12 Jun 2019 16:03:13 +0200 Subject: [PATCH 0706/1507] Don't crash if we start a drag without dragFocus Sometimes origin will be nullptr, triggering a crash. [ChangeLog][QPA plugin] Fixed a crash that sometimes happened when starting a drag-and-drop operation. Fixes: QTBUG-76368 Change-Id: I8f4e6b05f073644834c3c72a8307dac5b897f626 Reviewed-by: Johan Helsing --- src/plugins/platforms/wayland/qwaylanddatadevice.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylanddatadevice.cpp b/src/plugins/platforms/wayland/qwaylanddatadevice.cpp index 300c9de0aa8..11984f9d394 100644 --- a/src/plugins/platforms/wayland/qwaylanddatadevice.cpp +++ b/src/plugins/platforms/wayland/qwaylanddatadevice.cpp @@ -111,7 +111,10 @@ void QWaylandDataDevice::startDrag(QMimeData *mimeData, QWaylandWindow *icon) if (!origin) origin = m_display->currentInputDevice()->touchFocus(); - start_drag(m_dragSource->object(), origin->object(), icon->object(), m_display->currentInputDevice()->serial()); + if (origin) + start_drag(m_dragSource->object(), origin->object(), icon->object(), m_display->currentInputDevice()->serial()); + else + qCDebug(lcQpaWayland) << "Couldn't start a drag because the origin window could not be found."; } void QWaylandDataDevice::cancelDrag() From 26c5d5e62b1c3642565511d1761bbc4bdda8ca1e Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Wed, 19 Jun 2019 14:05:22 +0200 Subject: [PATCH 0707/1507] Client: Fix stuttering when the GUI thread is busy When we did invokeMethod for handling the frame callbacks, we had to wait for the GUI thread to finish whatever it's doing before we would stop blocking. Fix it by clearing the frame callback timer and stop blocking immediately, while delaying the rest of the work until it can be run on the other thread. Fixes: QTBUG-76397 Change-Id: I343e4feac4838926b4fa2ccac2948988bc6c3bb7 Reviewed-by: Paul Olav Tvete --- .../platforms/wayland/qwaylandwindow.cpp | 61 ++++++++++--------- .../platforms/wayland/qwaylandwindow_p.h | 2 +- 2 files changed, 33 insertions(+), 30 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index cecdbda9214..7c8ecadaa72 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -610,29 +610,34 @@ const wl_callback_listener QWaylandWindow::callbackListener = { Q_UNUSED(callback); Q_UNUSED(time); auto *window = static_cast(data); - if (window->thread() != QThread::currentThread()) - QMetaObject::invokeMethod(window, [=] { window->handleFrameCallback(); }, Qt::QueuedConnection); - else - window->handleFrameCallback(); + window->handleFrameCallback(); } }; void QWaylandWindow::handleFrameCallback() { - bool wasExposed = isExposed(); - - if (mFrameCallbackTimerId != -1) { - killTimer(mFrameCallbackTimerId); - mFrameCallbackTimerId = -1; - } - + // Stop the timer and stop waiting immediately + int timerId = mFrameCallbackTimerId.fetchAndStoreOrdered(-1); mWaitingForFrameCallback = false; - mFrameCallbackTimedOut = false; - if (!wasExposed && isExposed()) - sendExposeEvent(QRect(QPoint(), geometry().size())); - if (wasExposed && hasPendingUpdateRequest()) - deliverUpdateRequest(); + // The rest can wait until we can run it on the correct thread + auto doHandleExpose = [this, timerId]() { + if (timerId != -1) + killTimer(timerId); + + bool wasExposed = isExposed(); + mFrameCallbackTimedOut = false; + if (!wasExposed && isExposed()) // Did setting mFrameCallbackTimedOut make the window exposed? + sendExposeEvent(QRect(QPoint(), geometry().size())); + if (wasExposed && hasPendingUpdateRequest()) + deliverUpdateRequest(); + }; + + if (thread() != QThread::currentThread()) { + QMetaObject::invokeMethod(this, doHandleExpose); + } else { + doHandleExpose(); + } } QMutex QWaylandWindow::mFrameSyncMutex; @@ -654,11 +659,11 @@ bool QWaylandWindow::waitForFrameSync(int timeout) } // Stop current frame timer if any, can't use killTimer directly, because we might be on a diffent thread - if (mFrameCallbackTimerId != -1) { - int id = mFrameCallbackTimerId; - mFrameCallbackTimerId = -1; - QMetaObject::invokeMethod(this, [=] { killTimer(id); }, Qt::QueuedConnection); - } + // Ordered semantics is needed to avoid stopping the timer twice and not miss it when it's + // started by other writes + int fcbId = mFrameCallbackTimerId.fetchAndStoreOrdered(-1); + if (fcbId != -1) + QMetaObject::invokeMethod(this, [=] { killTimer(fcbId); }, Qt::QueuedConnection); return !mWaitingForFrameCallback; } @@ -1090,9 +1095,9 @@ void QWaylandWindow::timerEvent(QTimerEvent *event) } } - if (event->timerId() == mFrameCallbackTimerId) { - killTimer(mFrameCallbackTimerId); - mFrameCallbackTimerId = -1; + + if (mFrameCallbackTimerId.testAndSetOrdered(event->timerId(), -1)) { + killTimer(event->timerId()); qCDebug(lcWaylandBackingstore) << "Didn't receive frame callback in time, window should now be inexposed"; mFrameCallbackTimedOut = true; mWaitingForUpdate = false; @@ -1154,11 +1159,9 @@ void QWaylandWindow::handleUpdate() mWaitingForUpdate = false; // Stop current frame timer if any, can't use killTimer directly, see comment above. - if (mFrameCallbackTimerId != -1) { - int id = mFrameCallbackTimerId; - mFrameCallbackTimerId = -1; - QMetaObject::invokeMethod(this, [=] { killTimer(id); }, Qt::QueuedConnection); - } + int fcbId = mFrameCallbackTimerId.fetchAndStoreOrdered(-1); + if (fcbId != -1) + QMetaObject::invokeMethod(this, [=] { killTimer(fcbId); }, Qt::QueuedConnection); // Start a timer for handling the case when the compositor stops sending frame callbacks. QMetaObject::invokeMethod(this, [=] { // Again; can't do it directly diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index c47123dc9c8..e8c9d5684cf 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -216,7 +216,7 @@ protected: WId mWindowId; bool mWaitingForFrameCallback = false; bool mFrameCallbackTimedOut = false; // Whether the frame callback has timed out - int mFrameCallbackTimerId = -1; // Started on commit, reset on frame callback + QAtomicInt mFrameCallbackTimerId = -1; // Started on commit, reset on frame callback struct ::wl_callback *mFrameCallback = nullptr; struct ::wl_event_queue *mFrameQueue = nullptr; QWaitCondition mFrameSyncWait; From 41794625507002bbe5f44cd5f94c64c8103d6457 Mon Sep 17 00:00:00 2001 From: Sona Kurazyan Date: Tue, 25 Jun 2019 10:00:11 +0200 Subject: [PATCH 0708/1507] Remove usages of deprecated QLatin1Literal Task-number: QTBUG-76491 Change-Id: I8f96c049e134843e4eb2bffef6274497eca8b5cf Reviewed-by: Johan Helsing --- src/plugins/platforms/wayland/qwaylandintegration.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandintegration.cpp b/src/plugins/platforms/wayland/qwaylandintegration.cpp index e75aebd9e9a..078e5be196d 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandintegration.cpp @@ -346,7 +346,7 @@ void QWaylandIntegration::initializeClientBufferIntegration() && mDisplay->hardwareIntegration()->clientBufferIntegration() != QLatin1String("linux-dmabuf-unstable-v1")) { targetKey = mDisplay->hardwareIntegration()->clientBufferIntegration(); } else { - targetKey = QLatin1Literal("wayland-egl"); + targetKey = QLatin1String("wayland-egl"); } } From 32b338a8dced136a4981fe136e1bd08627277bc2 Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Sun, 23 Jun 2019 13:25:16 +0200 Subject: [PATCH 0709/1507] Client: Reset frame callback timer when hiding a window If we hide a window whilst a compositor has a pending frame to show, it's possible the compositor will not render the frame and not return the callback. If this happens on the next window expose we can be left with mFrameCallbackTimedOut still true causing isExposed() to remain false and us to not send the next buffer when we later show the window again. Change-Id: I507410415d1a930fd5fa736412055e68fdf6c1d3 Reviewed-by: Johan Helsing --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 7c8ecadaa72..2b243bc4409 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -254,6 +254,13 @@ void QWaylandWindow::reset(bool sendDestroyEvent) mFrameCallback = nullptr; } + int timerId = mFrameCallbackTimerId.fetchAndStoreOrdered(-1); + if (timerId != -1) { + killTimer(timerId); + } + mWaitingForFrameCallback = false; + mFrameCallbackTimedOut = false; + mMask = QRegion(); mQueuedBuffer = nullptr; } From 4d2c78dae4d9cd15312ee1263b57f9185c49dcfd Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Sat, 6 Jul 2019 21:05:32 +0200 Subject: [PATCH 0710/1507] Fix compilation with C++20 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Implicit capture of 'this' in [=] is deprecated in C++20. Fix by using explicit captures. Change-Id: Ie3a94ec60d7c56b2856d201fa3d68d0670bdd7b9 Reviewed-by: Mårten Nordheim --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 2b243bc4409..5ea0dce1e6c 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -670,7 +670,7 @@ bool QWaylandWindow::waitForFrameSync(int timeout) // started by other writes int fcbId = mFrameCallbackTimerId.fetchAndStoreOrdered(-1); if (fcbId != -1) - QMetaObject::invokeMethod(this, [=] { killTimer(fcbId); }, Qt::QueuedConnection); + QMetaObject::invokeMethod(this, [this, fcbId] { killTimer(fcbId); }, Qt::QueuedConnection); return !mWaitingForFrameCallback; } @@ -1157,7 +1157,7 @@ void QWaylandWindow::handleUpdate() // ignore it if it times out before it's cleaned up by the invokeMethod call. int id = mFallbackUpdateTimerId; mFallbackUpdateTimerId = -1; - QMetaObject::invokeMethod(this, [=] { killTimer(id); }, Qt::QueuedConnection); + QMetaObject::invokeMethod(this, [this, id] { killTimer(id); }, Qt::QueuedConnection); } mFrameCallback = frame(); @@ -1168,10 +1168,10 @@ void QWaylandWindow::handleUpdate() // Stop current frame timer if any, can't use killTimer directly, see comment above. int fcbId = mFrameCallbackTimerId.fetchAndStoreOrdered(-1); if (fcbId != -1) - QMetaObject::invokeMethod(this, [=] { killTimer(fcbId); }, Qt::QueuedConnection); + QMetaObject::invokeMethod(this, [this, fcbId] { killTimer(fcbId); }, Qt::QueuedConnection); // Start a timer for handling the case when the compositor stops sending frame callbacks. - QMetaObject::invokeMethod(this, [=] { // Again; can't do it directly + QMetaObject::invokeMethod(this, [this] { // Again; can't do it directly if (mWaitingForFrameCallback) mFrameCallbackTimerId = startTimer(100); }, Qt::QueuedConnection); From afe5668bb6d181e7cd067439c86c84d9ae48400b Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Tue, 4 Jun 2019 20:11:32 +0200 Subject: [PATCH 0711/1507] QWaylandShmBackingStore: replace a QLinkedList with std::list MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ...and mark the module QLinkedList-free. QLinkedList is going to be deprecated. Change-Id: Ieb9efef24cd8677edc1262f22b7c6d41b6376347 Reviewed-by: Mårten Nordheim Reviewed-by: Johan Helsing --- .../platforms/wayland/qwaylandshmbackingstore.cpp | 14 +++++++------- .../platforms/wayland/qwaylandshmbackingstore_p.h | 5 +++-- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp b/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp index d768e7fc236..9b5971a21e9 100644 --- a/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp +++ b/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp @@ -249,7 +249,7 @@ QWaylandShmBuffer *QWaylandShmBackingStore::getBuffer(const QSize &size) if (b->size() == size) { return b; } else { - mBuffers.removeOne(b); + mBuffers.remove(b); if (mBackBuffer == b) mBackBuffer = nullptr; delete b; @@ -257,11 +257,11 @@ QWaylandShmBuffer *QWaylandShmBackingStore::getBuffer(const QSize &size) } } - static const int MAX_BUFFERS = 5; - if (mBuffers.count() < MAX_BUFFERS) { + static const size_t MAX_BUFFERS = 5; + if (mBuffers.size() < MAX_BUFFERS) { QImage::Format format = QPlatformScreen::platformScreenForWindow(window())->format(); QWaylandShmBuffer *b = new QWaylandShmBuffer(mDisplay, size, format, waylandWindow()->scale()); - mBuffers.prepend(b); + mBuffers.push_front(b); return b; } return nullptr; @@ -300,9 +300,9 @@ void QWaylandShmBackingStore::resize(const QSize &size) // ensure the new buffer is at the beginning of the list so next time getBuffer() will pick // it if possible - if (mBuffers.first() != buffer) { - mBuffers.removeOne(buffer); - mBuffers.prepend(buffer); + if (mBuffers.front() != buffer) { + mBuffers.remove(buffer); + mBuffers.push_front(buffer); } if (windowDecoration() && window()->isVisible() && oldSizeInBytes != newSizeInBytes) diff --git a/src/plugins/platforms/wayland/qwaylandshmbackingstore_p.h b/src/plugins/platforms/wayland/qwaylandshmbackingstore_p.h index 88ecfc5ece1..8a85cd7f34a 100644 --- a/src/plugins/platforms/wayland/qwaylandshmbackingstore_p.h +++ b/src/plugins/platforms/wayland/qwaylandshmbackingstore_p.h @@ -57,7 +57,8 @@ #include #include #include -#include + +#include QT_BEGIN_NAMESPACE @@ -116,7 +117,7 @@ private: QWaylandShmBuffer *getBuffer(const QSize &size); QWaylandDisplay *mDisplay = nullptr; - QLinkedList mBuffers; + std::list mBuffers; QWaylandShmBuffer *mFrontBuffer = nullptr; QWaylandShmBuffer *mBackBuffer = nullptr; bool mPainting = false; From 4572d9671488d5d0d97d179462bd4b99a39a0a29 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Sun, 21 Jul 2019 18:34:48 +0300 Subject: [PATCH 0712/1507] QWaylandCursor: replace a static QMap with a C array MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The content of the QMultiMap cursorNameMaps is static, so using a dynamic container is overkill. Replace the map by a (sorted) C array of struct {Key, Value}, and use std::equal_range to find matching cursors. This also avoids the creation of a QList on each call (due to the use of QMap:values() instead of QMap::equal_range), as well as the creation of QByteArrays, which the underlying wayland C API doesn't know about, anyway. The entries were already sorted, so the initializer_list stays the same. Add an assert that the list is ordered. Since this is library code, don't use the attractive struct { WaylandCursor, const char *name }, as that causes relocations that delay the loading of the shared object, and make sharing of the data between processes impossible. This wastes some memory, due to all the NUL padding up to the common maximum, and the next alignment step, but can be optimized later when someone writes a C++-only version of Q_STRINGTABLE. Even so, this saves 10.5KiB in text size on optimized AMD64 Linux GCC 9.1 builds. Change-Id: I19fa1742e2fcaf9de74af1e5908e796b0588d507 Reviewed-by: Mårten Nordheim --- .../platforms/wayland/qwaylandcursor.cpp | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandcursor.cpp b/src/plugins/platforms/wayland/qwaylandcursor.cpp index 165df776295..4356b23a0a8 100644 --- a/src/plugins/platforms/wayland/qwaylandcursor.cpp +++ b/src/plugins/platforms/wayland/qwaylandcursor.cpp @@ -48,6 +48,8 @@ #include +#include + QT_BEGIN_NAMESPACE namespace QtWaylandClient { @@ -75,7 +77,10 @@ wl_cursor *QWaylandCursorTheme::requestCursor(WaylandCursor shape) if (struct wl_cursor *cursor = m_cursors.value(shape, nullptr)) return cursor; - static const QMultiMapcursorNamesMap { + static Q_CONSTEXPR struct ShapeAndName { + WaylandCursor shape; + const char name[33]; + } cursorNamesMap[] = { {ArrowCursor, "left_ptr"}, {ArrowCursor, "default"}, {ArrowCursor, "top_left_arrow"}, @@ -193,9 +198,14 @@ wl_cursor *QWaylandCursorTheme::requestCursor(WaylandCursor shape) {ResizeSouthWestCursor, "bottom_left_corner"}, }; - QList cursorNames = cursorNamesMap.values(shape); - for (auto &name : qAsConst(cursorNames)) { - if (wl_cursor *cursor = wl_cursor_theme_get_cursor(m_theme, name.constData())) { + const auto byShape = [](ShapeAndName lhs, ShapeAndName rhs) { + return lhs.shape < rhs.shape; + }; + Q_ASSERT(std::is_sorted(std::begin(cursorNamesMap), std::end(cursorNamesMap), byShape)); + const auto p = std::equal_range(std::begin(cursorNamesMap), std::end(cursorNamesMap), + ShapeAndName{shape, ""}, byShape); + for (auto it = p.first; it != p.second; ++it) { + if (wl_cursor *cursor = wl_cursor_theme_get_cursor(m_theme, it->name)) { m_cursors.insert(shape, cursor); return cursor; } From d268aa90ecc0ef9384f8274708b940bb3e4909fd Mon Sep 17 00:00:00 2001 From: Pier Luigi Fiorini Date: Wed, 24 Jul 2019 23:40:55 +0200 Subject: [PATCH 0713/1507] Fix use of private dependency With 833e1cef, Linux SPI Accessibility bridge was added to the Wayland QPA plugin, but this had a bad side-effect to QtWaylandClient. Linux Accessibility support is a private module, this means we have to link to it with QT_PRIVATE not QT, otherwise CMake and pkg-config files for Qt5WaylandClient will depend on it. Change-Id: I6182267f97adc2cd5bd66895df148a6a45614f45 Fixes: QTBUG-76042 Reviewed-by: Frederik Gladhorn --- src/plugins/platforms/wayland/client.pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/client.pro b/src/plugins/platforms/wayland/client.pro index db91bd6913e..4233ac9504d 100644 --- a/src/plugins/platforms/wayland/client.pro +++ b/src/plugins/platforms/wayland/client.pro @@ -20,7 +20,7 @@ qtConfig(xkbcommon) { } qtHaveModule(linuxaccessibility_support_private): \ - QT += linuxaccessibility_support_private + QT_PRIVATE += linuxaccessibility_support_private QMAKE_USE += wayland-client From eb4198edf153c49c8624c0f240a05011cbc5a26d Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Wed, 24 Jul 2019 10:29:33 +0300 Subject: [PATCH 0714/1507] QWaylandScanner: add trailing commas to enumerations and braced initialization MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is allowed since C++11, and K&R C, resp., and doing so simplifies the code. Change-Id: I4bf5bc50b46c6b811ec386b92bfb0a7529a32645 Reviewed-by: Mårten Nordheim --- src/tools/qtwaylandscanner/qtwaylandscanner.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp index 02bb5701cda..272c6abd23d 100644 --- a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp +++ b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp @@ -368,9 +368,7 @@ void Scanner::printEnums(const QList &enums) printf(" enum %s {\n", e.name.constData()); for (int i = 0; i < e.entries.size(); ++i) { const WaylandEnumEntry &entry = e.entries.at(i); - printf(" %s_%s = %s", e.name.constData(), entry.name.constData(), entry.value.constData()); - if (i < e.entries.size() - 1) - printf(","); + printf(" %s_%s = %s,", e.name.constData(), entry.name.constData(), entry.value.constData()); if (!entry.summary.isNull()) printf(" // %s", entry.summary.constData()); printf("\n"); @@ -1249,7 +1247,7 @@ bool Scanner::process() printf(" const struct %s_listener %s::m_%s_listener = {\n", interfaceName, interfaceName, interfaceName); for (int i = 0; i < interface.events.size(); ++i) { const WaylandEvent &e = interface.events.at(i); - printf(" %s::handle_%s%s\n", interfaceName, e.name.constData(), i < interface.events.size() - 1 ? "," : ""); + printf(" %s::handle_%s,\n", interfaceName, e.name.constData()); } printf(" };\n"); printf("\n"); From 391a169ff9813b78d20721e53bf3c63aa4937b32 Mon Sep 17 00:00:00 2001 From: Pier Luigi Fiorini Date: Thu, 25 Jul 2019 00:00:27 +0200 Subject: [PATCH 0715/1507] Fix typo Correct a typo introduced with 833e1cef. Change-Id: I5c101e015c0fbd7de03d26ff3f8629418f070db2 Reviewed-by: David Edmundson Reviewed-by: Johan Helsing --- src/plugins/platforms/wayland/qwaylandintegration.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandintegration.cpp b/src/plugins/platforms/wayland/qwaylandintegration.cpp index 078e5be196d..7f79d6b9863 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandintegration.cpp @@ -272,7 +272,7 @@ QPlatformAccessibility *QWaylandIntegration::accessibility() const { if (!mAccessibility) { #ifndef QT_NO_ACCESSIBILITY_ATSPI_BRIDGE - Q_ASSERT_X(QCoreApplication::eventDispatcher(), "QXcbIntegration", + Q_ASSERT_X(QCoreApplication::eventDispatcher(), "QWaylandIntegration", "Initializing accessibility without event-dispatcher!"); mAccessibility.reset(new QSpiAccessibleBridge()); #else From ff42bda500ec496ee05fc38ddc0de08f9c709b81 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Thu, 25 Jul 2019 10:27:03 +0300 Subject: [PATCH 0716/1507] QWaylandScanner: tidy up This change - standardizes on using boolean needsXy to handle join-style omissions of commas or newlines instead of inspecting the index of the element in various forms, which enables - standardize on C++11 ranged for loops instead of indexed loops - use braced initialization for structs, with designators, which are strictly a C++20 feature but are being used in QtWayland already, so should be safe (they originally come from C99). Together, they make the code easier to understand, because the variation of patterns used in the program is reduced. Change-Id: Ib96620a9ecbe4ee47e59290ed758f0ec1bffcfd6 Reviewed-by: Johan Helsing --- .../qtwaylandscanner/qtwaylandscanner.cpp | 160 +++++++++--------- 1 file changed, 79 insertions(+), 81 deletions(-) diff --git a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp index 272c6abd23d..da58fc56797 100644 --- a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp +++ b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp @@ -189,18 +189,21 @@ bool Scanner::boolValue(const QXmlStreamReader &xml, const char *name) Scanner::WaylandEvent Scanner::readEvent(QXmlStreamReader &xml, bool request) { - WaylandEvent event; - event.request = request; - event.name = byteArrayValue(xml, "name"); - event.type = byteArrayValue(xml, "type"); + WaylandEvent event = { + .request = request, + .name = byteArrayValue(xml, "name"), + .type = byteArrayValue(xml, "type"), + .arguments = {}, + }; while (xml.readNextStartElement()) { if (xml.name() == "arg") { - WaylandArgument argument; - argument.name = byteArrayValue(xml, "name"); - argument.type = byteArrayValue(xml, "type"); - argument.interface = byteArrayValue(xml, "interface"); - argument.summary = byteArrayValue(xml, "summary"); - argument.allowNull = boolValue(xml, "allowNull"); + WaylandArgument argument = { + .name = byteArrayValue(xml, "name"), + .type = byteArrayValue(xml, "type"), + .interface = byteArrayValue(xml, "interface"), + .summary = byteArrayValue(xml, "summary"), + .allowNull = boolValue(xml, "allowNull"), + }; event.arguments << argument; } @@ -211,15 +214,18 @@ Scanner::WaylandEvent Scanner::readEvent(QXmlStreamReader &xml, bool request) Scanner::WaylandEnum Scanner::readEnum(QXmlStreamReader &xml) { - WaylandEnum result; - result.name = byteArrayValue(xml, "name"); + WaylandEnum result = { + .name = byteArrayValue(xml, "name"), + .entries = {}, + }; while (xml.readNextStartElement()) { if (xml.name() == "entry") { - WaylandEnumEntry entry; - entry.name = byteArrayValue(xml, "name"); - entry.value = byteArrayValue(xml, "value"); - entry.summary = byteArrayValue(xml, "summary"); + WaylandEnumEntry entry = { + .name = byteArrayValue(xml, "name"), + .value = byteArrayValue(xml, "value"), + .summary = byteArrayValue(xml, "summary"), + }; result.entries << entry; } @@ -231,9 +237,13 @@ Scanner::WaylandEnum Scanner::readEnum(QXmlStreamReader &xml) Scanner::WaylandInterface Scanner::readInterface(QXmlStreamReader &xml) { - WaylandInterface interface; - interface.name = byteArrayValue(xml, "name"); - interface.version = intValue(xml, "version", 1); + WaylandInterface interface = { + .name = byteArrayValue(xml, "name"), + .version = intValue(xml, "version", 1), + .enums = {}, + .events = {}, + .requests = {}, + }; while (xml.readNextStartElement()) { if (xml.name() == "event") @@ -285,9 +295,9 @@ QByteArray Scanner::waylandToQtType(const QByteArray &waylandType, const QByteAr const Scanner::WaylandArgument *Scanner::newIdArgument(const QList &arguments) { - for (int i = 0; i < arguments.size(); ++i) { - if (arguments.at(i).type == "new_id") - return &arguments.at(i); + for (const WaylandArgument &a : arguments) { + if (a.type == "new_id") + return &a; } return nullptr; } @@ -305,8 +315,7 @@ void Scanner::printEvent(const WaylandEvent &e, bool omitNames, bool withResourc needsComma = true; } } - for (int i = 0; i < e.arguments.size(); ++i) { - const WaylandArgument &a = e.arguments.at(i); + for (const WaylandArgument &a : e.arguments) { bool isNewId = a.type == "new_id"; if (isNewId && !isServerSide() && (a.interface.isEmpty() != e.request)) continue; @@ -346,9 +355,8 @@ void Scanner::printEventHandlerSignature(const WaylandEvent &e, const char *inte printf(" %svoid *data,\n", indent); printf(" %sstruct ::%s *object", indent, interfaceName); } - for (int i = 0; i < e.arguments.size(); ++i) { + for (const WaylandArgument &a : e.arguments) { printf(",\n"); - const WaylandArgument &a = e.arguments.at(i); bool isNewId = a.type == "new_id"; if (isServerSide() && isNewId) { printf(" %suint32_t %s", indent, a.name.constData()); @@ -362,12 +370,10 @@ void Scanner::printEventHandlerSignature(const WaylandEvent &e, const char *inte void Scanner::printEnums(const QList &enums) { - for (int i = 0; i < enums.size(); ++i) { + for (const WaylandEnum &e : enums) { printf("\n"); - const WaylandEnum &e = enums.at(i); printf(" enum %s {\n", e.name.constData()); - for (int i = 0; i < e.entries.size(); ++i) { - const WaylandEnumEntry &entry = e.entries.at(i); + for (const WaylandEnumEntry &entry : e.entries) { printf(" %s_%s = %s,", e.name.constData(), entry.name.constData(), entry.value.constData()); if (!entry.summary.isNull()) printf(" // %s", entry.summary.constData()); @@ -476,12 +482,16 @@ bool Scanner::process() printf("\n"); printf("namespace QtWaylandServer {\n"); - for (int j = 0; j < interfaces.size(); ++j) { - const WaylandInterface &interface = interfaces.at(j); + bool needsNewLine = false; + for (const WaylandInterface &interface : interfaces) { if (ignoreInterface(interface.name)) continue; + if (needsNewLine) + printf("\n"); + needsNewLine = true; + const char *interfaceName = interface.name.constData(); QByteArray stripped = stripInterfaceName(interface.name); @@ -582,8 +592,7 @@ bool Scanner::process() printf(" static const struct ::%s_interface m_%s_interface;\n", interfaceName, interfaceName); printf("\n"); - for (int i = 0; i < interface.requests.size(); ++i) { - const WaylandEvent &e = interface.requests.at(i); + for (const WaylandEvent &e : interface.requests) { printf(" static void "); printEventHandlerSignature(e, interfaceName); @@ -601,9 +610,6 @@ bool Scanner::process() printf(" };\n"); printf(" DisplayDestroyedListener m_displayDestroyedListener;\n"); printf(" };\n"); - - if (j < interfaces.size() - 1) - printf("\n"); } printf("}\n"); @@ -627,8 +633,7 @@ bool Scanner::process() printf("namespace QtWaylandServer {\n"); bool needsNewLine = false; - for (int j = 0; j < interfaces.size(); ++j) { - const WaylandInterface &interface = interfaces.at(j); + for (const WaylandInterface &interface : interfaces) { if (ignoreInterface(interface.name)) continue; @@ -814,11 +819,12 @@ bool Scanner::process() if (hasRequests) { printf("\n"); printf(" const struct ::%s_interface %s::m_%s_interface = {", interfaceName, interfaceName, interfaceName); - for (int i = 0; i < interface.requests.size(); ++i) { - if (i > 0) + bool needsComma = false; + for (const WaylandEvent &e : interface.requests) { + if (needsComma) printf(","); + needsComma = true; printf("\n"); - const WaylandEvent &e = interface.requests.at(i); printf(" %s::handle_%s", interfaceName, e.name.constData()); } printf("\n"); @@ -834,11 +840,10 @@ bool Scanner::process() } printf("\n"); - for (int i = 0; i < interface.requests.size(); ++i) { + for (const WaylandEvent &e : interface.requests) { printf("\n"); printf(" void %s::", interfaceName); - const WaylandEvent &e = interface.requests.at(i); printEventHandlerSignature(e, interfaceName, false); printf("\n"); @@ -847,9 +852,8 @@ bool Scanner::process() printf(" Resource *r = Resource::fromResource(resource);\n"); printf(" static_cast<%s *>(r->%s_object)->%s_%s(\n", interfaceName, interfaceNameStripped, interfaceNameStripped, e.name.constData()); printf(" r"); - for (int i = 0; i < e.arguments.size(); ++i) { + for (const WaylandArgument &a : e.arguments) { printf(",\n"); - const WaylandArgument &a = e.arguments.at(i); QByteArray cType = waylandToCType(a.type, a.interface); QByteArray qtType = waylandToQtType(a.type, a.interface, e.request); const char *argumentName = a.name.constData(); @@ -863,17 +867,15 @@ bool Scanner::process() } } - for (int i = 0; i < interface.events.size(); ++i) { + for (const WaylandEvent &e : interface.events) { printf("\n"); - const WaylandEvent &e = interface.events.at(i); printf(" void %s::send_", interfaceName); printEvent(e); printf("\n"); printf(" {\n"); printf(" send_%s(\n", e.name.constData()); printf(" m_resource->handle"); - for (int i = 0; i < e.arguments.size(); ++i) { - const WaylandArgument &a = e.arguments.at(i); + for (const WaylandArgument &a : e.arguments) { printf(",\n"); printf(" %s", a.name.constData()); } @@ -886,8 +888,7 @@ bool Scanner::process() printf("\n"); printf(" {\n"); - for (int i = 0; i < e.arguments.size(); ++i) { - const WaylandArgument &a = e.arguments.at(i); + for (const WaylandArgument &a : e.arguments) { if (a.type != "array") continue; QByteArray array = a.name + "_data"; @@ -903,8 +904,7 @@ bool Scanner::process() printf(" %s_send_%s(\n", interfaceName, e.name.constData()); printf(" resource"); - for (int i = 0; i < e.arguments.size(); ++i) { - const WaylandArgument &a = e.arguments.at(i); + for (const WaylandArgument &a : e.arguments) { printf(",\n"); QByteArray cType = waylandToCType(a.type, a.interface); QByteArray qtType = waylandToQtType(a.type, a.interface, e.request); @@ -960,12 +960,17 @@ bool Scanner::process() } printf("\n"); printf("namespace QtWayland {\n"); - for (int j = 0; j < interfaces.size(); ++j) { - const WaylandInterface &interface = interfaces.at(j); + + bool needsNewLine = false; + for (const WaylandInterface &interface : interfaces) { if (ignoreInterface(interface.name)) continue; + if (needsNewLine) + printf("\n"); + needsNewLine = true; + const char *interfaceName = interface.name.constData(); QByteArray stripped = stripInterfaceName(interface.name); @@ -1026,8 +1031,7 @@ bool Scanner::process() if (hasEvents) { printf(" void init_listener();\n"); printf(" static const struct %s_listener m_%s_listener;\n", interfaceName, interfaceName); - for (int i = 0; i < interface.events.size(); ++i) { - const WaylandEvent &e = interface.events.at(i); + for (const WaylandEvent &e : interface.events) { printf(" static void "); printEventHandlerSignature(e, interfaceName); @@ -1036,9 +1040,6 @@ bool Scanner::process() } printf(" struct ::%s *m_%s;\n", interfaceName, interfaceName); printf(" };\n"); - - if (j < interfaces.size() - 1) - printf("\n"); } printf("}\n"); printf("\n"); @@ -1075,12 +1076,17 @@ bool Scanner::process() printf("#endif\n"); printf("}\n"); printf("\n"); - for (int j = 0; j < interfaces.size(); ++j) { - const WaylandInterface &interface = interfaces.at(j); + + bool needsNewLine = false; + for (const WaylandInterface &interface : interfaces) { if (ignoreInterface(interface.name)) continue; + if (needsNewLine) + printf("\n"); + needsNewLine = true; + const char *interfaceName = interface.name.constData(); QByteArray stripped = stripInterfaceName(interface.name); @@ -1150,9 +1156,8 @@ bool Scanner::process() printf(" return &::%s_interface;\n", interfaceName); printf(" }\n"); - for (int i = 0; i < interface.requests.size(); ++i) { + for (const WaylandEvent &e : interface.requests) { printf("\n"); - const WaylandEvent &e = interface.requests.at(i); const WaylandArgument *new_id = newIdArgument(e.arguments); QByteArray new_id_str = "void "; if (new_id) { @@ -1165,8 +1170,7 @@ bool Scanner::process() printEvent(e); printf("\n"); printf(" {\n"); - for (int i = 0; i < e.arguments.size(); ++i) { - const WaylandArgument &a = e.arguments.at(i); + for (const WaylandArgument &a : e.arguments) { if (a.type != "array") continue; QByteArray array = a.name + "_data"; @@ -1182,8 +1186,7 @@ bool Scanner::process() printf(" %s%s_%s(\n", new_id ? "return " : "", interfaceName, e.name.constData()); printf(" m_%s%s", interfaceName, actualArgumentCount > 0 ? "," : ""); bool needsComma = false; - for (int i = 0; i < e.arguments.size(); ++i) { - const WaylandArgument &a = e.arguments.at(i); + for (const WaylandArgument &a : e.arguments) { bool isNewId = a.type == "new_id"; if (isNewId && !a.interface.isEmpty()) continue; @@ -1213,8 +1216,7 @@ bool Scanner::process() if (hasEvents) { printf("\n"); - for (int i = 0; i < interface.events.size(); ++i) { - const WaylandEvent &e = interface.events.at(i); + for (const WaylandEvent &e : interface.events) { printf(" void %s::%s_", interfaceName, interfaceNameStripped); printEvent(e, true); printf("\n"); @@ -1227,17 +1229,17 @@ bool Scanner::process() printf(" {\n"); printf(" Q_UNUSED(object);\n"); printf(" static_cast<%s *>(data)->%s_%s(", interfaceName, interfaceNameStripped, e.name.constData()); - for (int i = 0; i < e.arguments.size(); ++i) { + bool needsComma = false; + for (const WaylandArgument &a : e.arguments) { + if (needsComma) + printf(","); + needsComma = true; printf("\n"); - const WaylandArgument &a = e.arguments.at(i); const char *argumentName = a.name.constData(); if (a.type == "string") printf(" QString::fromUtf8(%s)", argumentName); else printf(" %s", argumentName); - - if (i < e.arguments.size() - 1) - printf(","); } printf(");\n"); @@ -1245,8 +1247,7 @@ bool Scanner::process() printf("\n"); } printf(" const struct %s_listener %s::m_%s_listener = {\n", interfaceName, interfaceName, interfaceName); - for (int i = 0; i < interface.events.size(); ++i) { - const WaylandEvent &e = interface.events.at(i); + for (const WaylandEvent &e : interface.events) { printf(" %s::handle_%s,\n", interfaceName, e.name.constData()); } printf(" };\n"); @@ -1257,9 +1258,6 @@ bool Scanner::process() printf(" %s_add_listener(m_%s, &m_%s_listener, this);\n", interfaceName, interfaceName, interfaceName); printf(" }\n"); } - - if (j < interfaces.size() - 1) - printf("\n"); } printf("}\n"); printf("\n"); From 738d8a57b144da2f96d9addbe3f31b5a5e132290 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Thu, 25 Jul 2019 10:40:21 +0300 Subject: [PATCH 0717/1507] QWaylandScanner: port from QList to std::vector QList is going away in Qt 6, and CoW is not needed, as containers and elements are only ever moved, not copied, and NRVO is in effect everywhere. Change-Id: Ie738da3619f0b8048fbd07e5911db0960133d553 Reviewed-by: Johan Helsing --- .../qtwaylandscanner/qtwaylandscanner.cpp | 49 ++++++++++--------- 1 file changed, 25 insertions(+), 24 deletions(-) diff --git a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp index da58fc56797..9691b857f27 100644 --- a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp +++ b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp @@ -40,7 +40,8 @@ #include #include #include -#include + +#include class Scanner { @@ -63,7 +64,7 @@ private: struct WaylandEnum { QByteArray name; - QList entries; + std::vector entries; }; struct WaylandArgument { @@ -78,16 +79,16 @@ private: bool request; QByteArray name; QByteArray type; - QList arguments; + std::vector arguments; }; struct WaylandInterface { QByteArray name; int version; - QList enums; - QList events; - QList requests; + std::vector enums; + std::vector events; + std::vector requests; }; bool isServerSide(); @@ -101,11 +102,11 @@ private: Scanner::WaylandInterface readInterface(QXmlStreamReader &xml); QByteArray waylandToCType(const QByteArray &waylandType, const QByteArray &interface); QByteArray waylandToQtType(const QByteArray &waylandType, const QByteArray &interface, bool cStyleArray); - const Scanner::WaylandArgument *newIdArgument(const QList &arguments); + const Scanner::WaylandArgument *newIdArgument(const std::vector &arguments); void printEvent(const WaylandEvent &e, bool omitNames = false, bool withResource = false); void printEventHandlerSignature(const WaylandEvent &e, const char *interfaceName, bool deepIndent = true); - void printEnums(const QList &enums); + void printEnums(const std::vector &enums); QByteArray stripInterfaceName(const QByteArray &name); bool ignoreInterface(const QByteArray &name); @@ -204,7 +205,7 @@ Scanner::WaylandEvent Scanner::readEvent(QXmlStreamReader &xml, bool request) .summary = byteArrayValue(xml, "summary"), .allowNull = boolValue(xml, "allowNull"), }; - event.arguments << argument; + event.arguments.push_back(std::move(argument)); } xml.skipCurrentElement(); @@ -226,7 +227,7 @@ Scanner::WaylandEnum Scanner::readEnum(QXmlStreamReader &xml) .value = byteArrayValue(xml, "value"), .summary = byteArrayValue(xml, "summary"), }; - result.entries << entry; + result.entries.push_back(std::move(entry)); } xml.skipCurrentElement(); @@ -247,11 +248,11 @@ Scanner::WaylandInterface Scanner::readInterface(QXmlStreamReader &xml) while (xml.readNextStartElement()) { if (xml.name() == "event") - interface.events << readEvent(xml, false); + interface.events.push_back(readEvent(xml, false)); else if (xml.name() == "request") - interface.requests << readEvent(xml, true); + interface.requests.push_back(readEvent(xml, true)); else if (xml.name() == "enum") - interface.enums << readEnum(xml); + interface.enums.push_back(readEnum(xml)); else xml.skipCurrentElement(); } @@ -293,7 +294,7 @@ QByteArray Scanner::waylandToQtType(const QByteArray &waylandType, const QByteAr return waylandToCType(waylandType, interface); } -const Scanner::WaylandArgument *Scanner::newIdArgument(const QList &arguments) +const Scanner::WaylandArgument *Scanner::newIdArgument(const std::vector &arguments) { for (const WaylandArgument &a : arguments) { if (a.type == "new_id") @@ -368,7 +369,7 @@ void Scanner::printEventHandlerSignature(const WaylandEvent &e, const char *inte printf(")"); } -void Scanner::printEnums(const QList &enums) +void Scanner::printEnums(const std::vector &enums) { for (const WaylandEnum &e : enums) { printf("\n"); @@ -428,11 +429,11 @@ bool Scanner::process() //QByteArray preProcessorProtocolName = QByteArray(m_protocolName).replace('-', '_').toUpper(); QByteArray preProcessorProtocolName = QByteArray(m_protocolName).toUpper(); - QList interfaces; + std::vector interfaces; while (m_xml->readNextStartElement()) { if (m_xml->name() == "interface") - interfaces << readInterface(*m_xml); + interfaces.push_back(readInterface(*m_xml)); else m_xml->skipCurrentElement(); } @@ -546,7 +547,7 @@ bool Scanner::process() printEnums(interface.enums); - bool hasEvents = !interface.events.isEmpty(); + bool hasEvents = !interface.events.empty(); if (hasEvents) { printf("\n"); @@ -567,7 +568,7 @@ bool Scanner::process() printf(" virtual void %s_bind_resource(Resource *resource);\n", interfaceNameStripped); printf(" virtual void %s_destroy_resource(Resource *resource);\n", interfaceNameStripped); - bool hasRequests = !interface.requests.isEmpty(); + bool hasRequests = !interface.requests.empty(); if (hasRequests) { printf("\n"); @@ -781,7 +782,7 @@ bool Scanner::process() printf(" }\n"); printf("\n"); - bool hasRequests = !interface.requests.isEmpty(); + bool hasRequests = !interface.requests.empty(); QByteArray interfaceMember = hasRequests ? "&m_" + interface.name + "_interface" : QByteArray("nullptr"); @@ -997,7 +998,7 @@ bool Scanner::process() printEnums(interface.enums); - if (!interface.requests.isEmpty()) { + if (!interface.requests.empty()) { printf("\n"); for (const WaylandEvent &e : interface.requests) { const WaylandArgument *new_id = newIdArgument(e.arguments); @@ -1014,7 +1015,7 @@ bool Scanner::process() } } - bool hasEvents = !interface.events.isEmpty(); + bool hasEvents = !interface.events.empty(); if (hasEvents) { printf("\n"); @@ -1092,7 +1093,7 @@ bool Scanner::process() QByteArray stripped = stripInterfaceName(interface.name); const char *interfaceNameStripped = stripped.constData(); - bool hasEvents = !interface.events.isEmpty(); + bool hasEvents = !interface.events.empty(); printf(" %s::%s(struct ::wl_registry *registry, int id, int version)\n", interfaceName, interfaceName); printf(" {\n"); @@ -1182,7 +1183,7 @@ bool Scanner::process() printf(" %s.alloc = 0;\n", arrayName); printf("\n"); } - int actualArgumentCount = new_id ? e.arguments.size() - 1 : e.arguments.size(); + int actualArgumentCount = new_id ? int(e.arguments.size()) - 1 : int(e.arguments.size()); printf(" %s%s_%s(\n", new_id ? "return " : "", interfaceName, e.name.constData()); printf(" m_%s%s", interfaceName, actualArgumentCount > 0 ? "," : ""); bool needsComma = false; From f922bd5ddaa01874b64f0afad52c7aa8c1e2c34b Mon Sep 17 00:00:00 2001 From: Ville Voutilainen Date: Fri, 9 Aug 2019 08:29:28 +0300 Subject: [PATCH 0718/1507] Fix GCC 4.8 build Change-Id: I0a193ceaa1549c08acad02b59db62ae313d6b334 Reviewed-by: Simon Hausmann --- src/plugins/platforms/wayland/qwaylandinputdevice.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index 7f6f01cd1b9..9ee3c19d4bb 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -570,7 +570,7 @@ void QWaylandInputDevice::Pointer::pointer_enter(uint32_t serial, struct wl_surf invalidateFocus(); } mFocus = window; - connect(mFocus, &QWaylandWindow::wlSurfaceDestroyed, this, &Pointer::handleFocusDestroyed); + connect(mFocus.data(), &QWaylandWindow::wlSurfaceDestroyed, this, &Pointer::handleFocusDestroyed); mSurfacePos = QPointF(wl_fixed_to_double(sx), wl_fixed_to_double(sy)); mGlobalPos = window->window()->mapToGlobal(mSurfacePos.toPoint()); @@ -707,7 +707,7 @@ void QWaylandInputDevice::Pointer::pointer_button(uint32_t serial, uint32_t time void QWaylandInputDevice::Pointer::invalidateFocus() { - disconnect(mFocus, &QWaylandWindow::wlSurfaceDestroyed, this, &Pointer::handleFocusDestroyed); + disconnect(mFocus.data(), &QWaylandWindow::wlSurfaceDestroyed, this, &Pointer::handleFocusDestroyed); mFocus = nullptr; mEnterSerial = 0; } From 94b8d9dedaa5282542fabc5500ec000621666894 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Tue, 16 Apr 2019 12:09:37 +0200 Subject: [PATCH 0719/1507] Fix expose event compression For shells that do not send configure events when exposed: If setGeometry() was called before the window was initialized, Qt would not mark the window as mapped, and the window would never become visible. Change-Id: Ic933cbbff20702424129c11264215181330cc7d1 Reviewed-by: Johan Helsing --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 4 +++- src/plugins/platforms/wayland/qwaylandwindow_p.h | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 5ea0dce1e6c..76d7715a852 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -353,7 +353,7 @@ void QWaylandWindow::setGeometry(const QRect &rect) mSentInitialResize = true; } QRect exposeGeometry(QPoint(), geometry().size()); - if (exposeGeometry != mLastExposeGeometry) + if (isExposed() && !mInResizeFromApplyConfigure && exposeGeometry != mLastExposeGeometry) sendExposeEvent(exposeGeometry); } @@ -365,7 +365,9 @@ void QWaylandWindow::resizeFromApplyConfigure(const QSize &sizeWithMargins, cons QRect geometry(windowGeometry().topLeft(), QSize(widthWithoutMargins, heightWithoutMargins)); mOffset += offset; + mInResizeFromApplyConfigure = true; setGeometry(geometry); + mInResizeFromApplyConfigure = false; } void QWaylandWindow::sendExposeEvent(const QRect &rect) diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index e8c9d5684cf..23432e39873 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -263,6 +263,7 @@ private: void handleMouseEventWithDecoration(QWaylandInputDevice *inputDevice, const QWaylandPointerEvent &e); void handleScreenChanged(); + bool mInResizeFromApplyConfigure = false; QRect mLastExposeGeometry; static const wl_callback_listener callbackListener; From 37377fc044290cfd7e120ce4184775dbc1cfb51c Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Mon, 21 Jan 2019 10:06:49 +0100 Subject: [PATCH 0720/1507] Backport texture sharing for NVIDIA This commit backports the Vulkan server buffer and texture sharing code from Qt 5.14 to Qt 5.12 as an opt-in feature. To enable, configure with "-feature-wayland-client-texture-sharing-experimental -feature-wayland-compositor-texture-sharing-experimental" Contains code from the following commits: Add server buffer integration based on Vulkan (commit a998944b2035c80999db4c1d9f7666c87ba73a86) Compressed texture support for vulkan server buffers (commit 4f87adc442a318b9c05fc73ae1020d0df0dfded3) Implement server-side toOpenGlTexture for Vulkan (commit 19361e7259f04b08925b1e8e99faf9460770ee7b) New texture sharing protocol and infrastructure (commit b09e808bf222984196cebd4447880781e3265714) Change-Id: I6c36ef7fddcd4db39e80d03a822d89f15eae3434 Reviewed-by: Lars Knoll Reviewed-by: Johan Helsing --- .../qt-texture-sharing-unstable-v1.xml | 57 ++++++++++++++++ .../qt-vulkan-server-buffer-unstable-v1.xml | 64 ++++++++++++++++++ src/plugins/platforms/wayland/configure.json | 17 +++++ .../qwaylandserverbufferintegration_p.h | 3 +- .../plugins/hardwareintegration/client.pro | 2 + .../vulkan-server/main.cpp | 66 +++++++++++++++++++ .../vulkan-server/vulkan-server.json | 3 + .../vulkan-server/vulkan-server.pro | 15 +++++ 8 files changed, 226 insertions(+), 1 deletion(-) create mode 100644 src/3rdparty/wayland/extensions/qt-texture-sharing-unstable-v1.xml create mode 100644 src/3rdparty/wayland/extensions/qt-vulkan-server-buffer-unstable-v1.xml create mode 100644 src/plugins/platforms/wayland/plugins/hardwareintegration/vulkan-server/main.cpp create mode 100644 src/plugins/platforms/wayland/plugins/hardwareintegration/vulkan-server/vulkan-server.json create mode 100644 src/plugins/platforms/wayland/plugins/hardwareintegration/vulkan-server/vulkan-server.pro diff --git a/src/3rdparty/wayland/extensions/qt-texture-sharing-unstable-v1.xml b/src/3rdparty/wayland/extensions/qt-texture-sharing-unstable-v1.xml new file mode 100644 index 00000000000..262ae487c22 --- /dev/null +++ b/src/3rdparty/wayland/extensions/qt-texture-sharing-unstable-v1.xml @@ -0,0 +1,57 @@ + + + + Copyright (C) 2019 The Qt Company Ltd. + Contact: http://www.qt.io/licensing/ + + This file is part of the plugins of the Qt Toolkit. + + $QT_BEGIN_LICENSE:BSD$ + You may use this file under the terms of the BSD license as follows: + + "Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + * Neither the name of The Qt Company Ltd nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." + + $QT_END_LICENSE$ + + + + + + + + + + + + + + + + + + + diff --git a/src/3rdparty/wayland/extensions/qt-vulkan-server-buffer-unstable-v1.xml b/src/3rdparty/wayland/extensions/qt-vulkan-server-buffer-unstable-v1.xml new file mode 100644 index 00000000000..211d0a7c730 --- /dev/null +++ b/src/3rdparty/wayland/extensions/qt-vulkan-server-buffer-unstable-v1.xml @@ -0,0 +1,64 @@ + + + + Copyright (C) 2019 The Qt Company Ltd. + Contact: http://www.qt.io/licensing/ + + This file is part of the plugins of the Qt Toolkit. + + $QT_BEGIN_LICENSE:BSD$ + You may use this file under the terms of the BSD license as follows: + + "Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + * Neither the name of The Qt Company Ltd nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." + + $QT_END_LICENSE$ + + + + This protocol is used internally by Qt for implementing the + qt_server_buffer extension on hardware that supports Vulkan external memory . + + This protocol is not part of the Qt API. It exists purely as an + implementation detail and may change from version to + version without notice, or even be removed. + + + + Informs the client about a newly created server buffer. + The "fd" argument is a POSIX file descriptor representing the + underlying resources of a Vulkan device memory object as defined + in the GL_EXT_memory_object_fd extension. + + + + + + + + + + diff --git a/src/plugins/platforms/wayland/configure.json b/src/plugins/platforms/wayland/configure.json index 586da6f66a9..06fa87757ff 100644 --- a/src/plugins/platforms/wayland/configure.json +++ b/src/plugins/platforms/wayland/configure.json @@ -75,6 +75,11 @@ "type": "compile", "test": "dmabuf_server_buffer", "use": "egl" + }, + "vulkan-server-buffer": { + "label": "Vulkan Buffer Sharing", + "type": "compile", + "test": "vulkan_server_buffer" } }, @@ -123,6 +128,16 @@ "condition": "features.wayland-client && features.opengl && features.egl && tests.dmabuf-server-buffer", "output": [ "privateFeature" ] }, + "wayland-client-texture-sharing-experimental" : { + "label": "Texture sharing (experimental)", + "autoDetect": "false", + "output": [ "privateFeature" ] + }, + "wayland-vulkan-server-buffer": { + "label": "Vulkan-based server buffer integration", + "condition": "features.wayland-client && features.opengl && features.egl && tests.vulkan-server-buffer && features.wayland-client-texture-sharing-experimental", + "output": [ "privateFeature" ] + }, "wayland-shm-emulation-server-buffer": { "label": "Shm emulation server buffer integration", "condition": "features.wayland-client && features.opengl", @@ -149,6 +164,8 @@ "xcomposite-glx", "wayland-drm-egl-server-buffer", "wayland-libhybris-egl-server-buffer", + "wayland-dmabuf-server-buffer", + "wayland-vulkan-server-buffer", "wayland-shm-emulation-server-buffer" ] }, diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegration_p.h b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegration_p.h index 7439087d885..719dad9ed39 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegration_p.h +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegration_p.h @@ -70,7 +70,8 @@ class Q_WAYLAND_CLIENT_EXPORT QWaylandServerBuffer public: enum Format { RGBA32, - A8 + A8, + Custom }; QWaylandServerBuffer(); diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/client.pro b/src/plugins/platforms/wayland/plugins/hardwareintegration/client.pro index 82e431ee869..7b7e8a49af8 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/client.pro +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/client.pro @@ -18,3 +18,5 @@ qtConfig(wayland-shm-emulation-server-buffer): \ SUBDIRS += shm-emulation-server qtConfig(wayland-dmabuf-server-buffer): \ SUBDIRS += dmabuf-server +qtConfig(wayland-vulkan-server-buffer): \ + SUBDIRS += vulkan-server diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/vulkan-server/main.cpp b/src/plugins/platforms/wayland/plugins/hardwareintegration/vulkan-server/main.cpp new file mode 100644 index 00000000000..b8f64bf225e --- /dev/null +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/vulkan-server/main.cpp @@ -0,0 +1,66 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include "vulkanserverbufferintegration.h" + +QT_BEGIN_NAMESPACE + +namespace QtWaylandClient { + +class VulkanServerBufferPlugin : public QWaylandServerBufferIntegrationPlugin +{ + Q_OBJECT + Q_PLUGIN_METADATA(IID QWaylandServerBufferIntegrationFactoryInterface_iid FILE "vulkan-server.json") +public: + QWaylandServerBufferIntegration *create(const QString&, const QStringList&) override; +}; + +QWaylandServerBufferIntegration *VulkanServerBufferPlugin::create(const QString& key, const QStringList& paramList) +{ + Q_UNUSED(paramList); + Q_UNUSED(key); + return new VulkanServerBufferIntegration(); +} + +} + +QT_END_NAMESPACE + +#include "main.moc" diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/vulkan-server/vulkan-server.json b/src/plugins/platforms/wayland/plugins/hardwareintegration/vulkan-server/vulkan-server.json new file mode 100644 index 00000000000..baadd152928 --- /dev/null +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/vulkan-server/vulkan-server.json @@ -0,0 +1,3 @@ +{ + "Keys": [ "vulkan-server" ] +} diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/vulkan-server/vulkan-server.pro b/src/plugins/platforms/wayland/plugins/hardwareintegration/vulkan-server/vulkan-server.pro new file mode 100644 index 00000000000..1be60f7c10f --- /dev/null +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/vulkan-server/vulkan-server.pro @@ -0,0 +1,15 @@ +# We have a bunch of C code with casts, so we can't have this option +QMAKE_CXXFLAGS_WARN_ON -= -Wcast-qual + +QT += waylandclient-private + +include(../../../../hardwareintegration/client/vulkan-server/vulkan-server.pri) + +OTHER_FILES += \ + vulkan-server.json + +SOURCES += main.cpp + +PLUGIN_TYPE = wayland-graphics-integration-client +PLUGIN_CLASS_NAME = VulkanServerBufferPlugin +load(qt_plugin) From 0b803993e706c6abb7eb3c49e3fc3a1fd7e288dc Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Mon, 8 Apr 2019 13:51:28 +0200 Subject: [PATCH 0721/1507] Client: Add safer fromObject function to scanner Makes the scanner produce generated static functions such as QtWaylandClient::wl_surface *wl_surface::fromObject(struct ::wl_surface *object); Which casts from the wayland-scanner generated types, such as struct ::wl_surface *, to types types generated by qtwaylandscanner, but performs a check to see if the listener is set to the wrapper class first (at least for interfaces with events). This lets us easily fix crashes in a couple of places where we receive events with wayland objects that we didn't create. Also adds nullptr checks whenever we use the fromWlSurface() and fromWlOutput() functions to handle failed conversions. Task-number: QTBUG-73801 Fixes: QTBUG-74085 Change-Id: I9f33c31c7d1a939ccb3ebbbcb0eb67af10037237 Reviewed-by: Jaroslaw Kubik Reviewed-by: Paul Olav Tvete (cherry picked from commit c6476ae915b8ac64121d379274363227b1c300ff) Reviewed-by: Pier Luigi Fiorini --- .../platforms/wayland/qwaylanddatadevice.cpp | 8 ++++++-- .../platforms/wayland/qwaylandinputdevice.cpp | 13 ++++++++++++- src/plugins/platforms/wayland/qwaylandqtkey.cpp | 6 +++++- src/plugins/platforms/wayland/qwaylandscreen.cpp | 5 +++-- src/tools/qtwaylandscanner/qtwaylandscanner.cpp | 11 +++++++++++ 5 files changed, 37 insertions(+), 6 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylanddatadevice.cpp b/src/plugins/platforms/wayland/qwaylanddatadevice.cpp index 11984f9d394..6b2a408eb19 100644 --- a/src/plugins/platforms/wayland/qwaylanddatadevice.cpp +++ b/src/plugins/platforms/wayland/qwaylanddatadevice.cpp @@ -154,9 +154,13 @@ void QWaylandDataDevice::data_device_drop() void QWaylandDataDevice::data_device_enter(uint32_t serial, wl_surface *surface, wl_fixed_t x, wl_fixed_t y, wl_data_offer *id) { - m_enterSerial = serial; - m_dragWindow = QWaylandWindow::fromWlSurface(surface)->window(); + auto *dragWaylandWindow = QWaylandWindow::fromWlSurface(surface); + if (!dragWaylandWindow) + return; // Ignore foreign surfaces + + m_dragWindow = dragWaylandWindow->window(); m_dragPoint = calculateDragPosition(x, y, m_dragWindow); + m_enterSerial = serial; QMimeData *dragData = nullptr; Qt::DropActions supportedActions; diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index 90e138a3dcc..495f258ded9 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -451,6 +451,9 @@ void QWaylandInputDevice::Pointer::pointer_enter(uint32_t serial, struct wl_surf return; QWaylandWindow *window = QWaylandWindow::fromWlSurface(surface); + if (!window) + return; // Ignore foreign surfaces + mFocus = window; mSurfacePos = QPointF(wl_fixed_to_double(sx), wl_fixed_to_double(sy)); mGlobalPos = window->window()->mapToGlobal(mSurfacePos.toPoint()); @@ -477,6 +480,10 @@ void QWaylandInputDevice::Pointer::pointer_leave(uint32_t time, struct wl_surfac if (!surface) return; + auto *window = QWaylandWindow::fromWlSurface(surface); + if (!window) + return; // Ignore foreign surfaces + if (!QWaylandWindow::mouseGrab()) { QWaylandWindow *window = QWaylandWindow::fromWlSurface(surface); window->handleMouseLeave(mParent); @@ -852,9 +859,13 @@ void QWaylandInputDevice::Touch::touch_down(uint32_t serial, if (!surface) return; + auto *window = QWaylandWindow::fromWlSurface(surface); + if (!window) + return; // Ignore foreign surfaces + mParent->mTime = time; mParent->mSerial = serial; - mFocus = QWaylandWindow::fromWlSurface(surface); + mFocus = window; mParent->mQDisplay->setLastInputDevice(mParent, serial, mFocus); mParent->handleTouchPoint(id, wl_fixed_to_double(x), wl_fixed_to_double(y), Qt::TouchPointPressed); } diff --git a/src/plugins/platforms/wayland/qwaylandqtkey.cpp b/src/plugins/platforms/wayland/qwaylandqtkey.cpp index a60185bd641..19261973853 100644 --- a/src/plugins/platforms/wayland/qwaylandqtkey.cpp +++ b/src/plugins/platforms/wayland/qwaylandqtkey.cpp @@ -70,7 +70,11 @@ void QWaylandQtKeyExtension::zqt_key_v1_key(struct wl_surface *surface, } QWaylandInputDevice *dev = inputDevices.first(); - QWaylandWindow *win = surface ? QWaylandWindow::fromWlSurface(surface) : dev->keyboardFocus(); + + auto *win = surface ? QWaylandWindow::fromWlSurface(surface) : nullptr; + + if (!win) + win = dev->keyboardFocus(); if (!win || !win->window()) { qWarning("qt_key_extension: handle_qtkey: No keyboard focus"); diff --git a/src/plugins/platforms/wayland/qwaylandscreen.cpp b/src/plugins/platforms/wayland/qwaylandscreen.cpp index 38d61f88c35..1fe0125e64b 100644 --- a/src/plugins/platforms/wayland/qwaylandscreen.cpp +++ b/src/plugins/platforms/wayland/qwaylandscreen.cpp @@ -199,8 +199,9 @@ QWaylandScreen * QWaylandScreen::waylandScreenFromWindow(QWindow *window) QWaylandScreen *QWaylandScreen::fromWlOutput(::wl_output *output) { - auto wlOutput = static_cast(wl_output_get_user_data(output)); - return static_cast(wlOutput); + if (auto *o = QtWayland::wl_output::fromObject(output)) + return static_cast(o); + return nullptr; } void QWaylandScreen::output_mode(uint32_t flags, int width, int height, int refresh) diff --git a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp index 6f4a33b5f6b..c617369aee2 100644 --- a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp +++ b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp @@ -982,6 +982,7 @@ bool Scanner::process() printf("\n"); printf(" struct ::%s *object() { return m_%s; }\n", interfaceName, interfaceName); printf(" const struct ::%s *object() const { return m_%s; }\n", interfaceName, interfaceName); + printf(" static %s *fromObject(struct ::%s *object);\n", interfaceName, interfaceName); printf("\n"); printf(" bool isInitialized() const;\n"); printf("\n"); @@ -1110,6 +1111,16 @@ bool Scanner::process() printf(" }\n"); printf("\n"); + printf(" %s *%s::fromObject(struct ::%s *object)\n", interfaceName, interfaceName, interfaceName); + printf(" {\n"); + if (hasEvents) { + printf(" if (wl_proxy_get_listener((struct ::wl_proxy *)object) != (void *)&m_%s_listener)\n", interfaceName); + printf(" return nullptr;\n"); + } + printf(" return static_cast<%s *>(%s_get_user_data(object));\n", interfaceName, interfaceName); + printf(" }\n"); + printf("\n"); + printf(" bool %s::isInitialized() const\n", interfaceName); printf(" {\n"); printf(" return m_%s != nullptr;\n", interfaceName); From 48211e072ed4df6e860a077f4f6e37b2749443f7 Mon Sep 17 00:00:00 2001 From: Pier Luigi Fiorini Date: Fri, 18 Jan 2019 15:06:56 +0100 Subject: [PATCH 0722/1507] Test the exact window size Make sure we test exactly the size we expect. We used frameGeometry() to take client-side decoration margins into account, but actually frameMargins() returns exactly that, this means we can compute the actual size that we want to test. Change-Id: I2f41ffdb2aa2e3a4253a1ff7038c4bc2e43cdf98 Reviewed-by: Johan Helsing --- tests/auto/wayland/xdgshell/tst_xdgshell.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/auto/wayland/xdgshell/tst_xdgshell.cpp b/tests/auto/wayland/xdgshell/tst_xdgshell.cpp index 038ff6624f7..c887e5d4442 100644 --- a/tests/auto/wayland/xdgshell/tst_xdgshell.cpp +++ b/tests/auto/wayland/xdgshell/tst_xdgshell.cpp @@ -476,10 +476,14 @@ void tst_xdgshell::windowGeometry() exec([=] { xdgToplevel()->sendCompleteConfigure(); }); - QCOMPOSITOR_TRY_COMPARE(xdgSurface()->m_committed.windowGeometry, QRect(QPoint(0, 0), window.frameGeometry().size())); + QSize marginsSize; + marginsSize.setWidth(window.frameMargins().left() + window.frameMargins().right()); + marginsSize.setHeight(window.frameMargins().top() + window.frameMargins().bottom()); + + QCOMPOSITOR_TRY_COMPARE(xdgSurface()->m_committed.windowGeometry, QRect(QPoint(0, 0), QSize(400, 320) + marginsSize)); window.resize(800, 600); - QCOMPOSITOR_TRY_COMPARE(xdgSurface()->m_committed.windowGeometry, QRect(QPoint(0, 0), window.frameGeometry().size())); + QCOMPOSITOR_TRY_COMPARE(xdgSurface()->m_committed.windowGeometry, QRect(QPoint(0, 0), QSize(800, 600) + marginsSize)); } void tst_xdgshell::foreignSurface() From 0ac92cee76be9cfbe75fe6ea98680901649a34b5 Mon Sep 17 00:00:00 2001 From: Pier Luigi Fiorini Date: Sun, 6 Jan 2019 18:09:00 +0100 Subject: [PATCH 0723/1507] Compositor: Add idle-inhibit unstable v1 protocol Allows disabling of screen blanking on a per-surface basis. [ChangeLog][Compositor] Added support for idle-inhibit unstable v1 Wayland extension. Change-Id: I3cd392f9e1bb3604691f2a496579aad3b87383b6 Reviewed-by: Johan Helsing --- .../protocols/idle-inhibit-unstable-v1.xml | 83 +++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 src/3rdparty/wayland/protocols/idle-inhibit-unstable-v1.xml diff --git a/src/3rdparty/wayland/protocols/idle-inhibit-unstable-v1.xml b/src/3rdparty/wayland/protocols/idle-inhibit-unstable-v1.xml new file mode 100644 index 00000000000..9c06cdcba6c --- /dev/null +++ b/src/3rdparty/wayland/protocols/idle-inhibit-unstable-v1.xml @@ -0,0 +1,83 @@ + + + + + Copyright © 2015 Samsung Electronics Co., Ltd + + 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. + + + + + This interface permits inhibiting the idle behavior such as screen + blanking, locking, and screensaving. The client binds the idle manager + globally, then creates idle-inhibitor objects for each surface. + + Warning! The protocol described in this file is experimental and + backward incompatible changes may be made. Backward compatible changes + may be added together with the corresponding interface version bump. + Backward incompatible changes are done by bumping the version number in + the protocol and interface names and resetting the interface version. + Once the protocol is to be declared stable, the 'z' prefix and the + version number in the protocol and interface names are removed and the + interface version number is reset. + + + + + Destroy the inhibit manager. + + + + + + Create a new inhibitor object associated with the given surface. + + + + + + + + + + An idle inhibitor prevents the output that the associated surface is + visible on from being set to a state where it is not visually usable due + to lack of user interaction (e.g. blanked, dimmed, locked, set to power + save, etc.) Any screensaver processes are also blocked from displaying. + + If the surface is destroyed, unmapped, becomes occluded, loses + visibility, or otherwise becomes not visually relevant for the user, the + idle inhibitor will not be honored by the compositor; if the surface + subsequently regains visibility the inhibitor takes effect once again. + Likewise, the inhibitor isn't honored if the system was already idled at + the time the inhibitor was established, although if the system later + de-idles and re-idles the inhibitor will take effect. + + + + + Remove the inhibitor effect from the associated wl_surface. + + + + + From 7163c286e4b451c8436a95b94dc32b7f62b19ee2 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Fri, 16 Aug 2019 12:54:56 +0200 Subject: [PATCH 0724/1507] Fix incorrect conversion to straight alpha pixel formats Previously, QWaylandSharedMemoryFormatHelper::fromWaylandShmFormat(WL_SHM_FORMAT_ARGB8888) would return Format_ARGB32, i.e. the non-premultiplied version, while, according to the wayland-devel mailing list (https://lists.freedesktop.org/archives/wayland-devel/2017-August/034791.html), all Wayland RGB-based pixel formats with alpha should have premultiplied alpha. This patch makes sure we return the premultiplied variants for ARGB8888, as well as for ABGR8888. Using a switch instead of the array also allows us more freedom to choose the preferred format in other cases where multiple QImage formats map to the same wl_shm format. While being wrapped and exported as QtWaylandClient::QWaylandShm::fromFormat (private API), this conversion function doesn't seem to be used anywhere, so this patch shouldn't cause any changes in behavior for projects that only use public API. Change-Id: Ie09f9a339b4540dd0383a72b3c951eb8c93e3ab4 Reviewed-by: Pier Luigi Fiorini --- .../qwaylandsharedmemoryformathelper_p.h | 31 ++++++++++++------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/src/plugins/platforms/wayland/shared/qwaylandsharedmemoryformathelper_p.h b/src/plugins/platforms/wayland/shared/qwaylandsharedmemoryformathelper_p.h index 85905c02fa3..72cc8401c26 100644 --- a/src/plugins/platforms/wayland/shared/qwaylandsharedmemoryformathelper_p.h +++ b/src/plugins/platforms/wayland/shared/qwaylandsharedmemoryformathelper_p.h @@ -51,7 +51,26 @@ class QWaylandSharedMemoryFormatHelper { public: static inline wl_shm_format fromQImageFormat(QImage::Format format); - static inline QImage::Format fromWaylandShmFormat(wl_shm_format format); + static inline QImage::Format fromWaylandShmFormat(wl_shm_format format) + { + switch (format) { + case WL_SHM_FORMAT_XRGB8888: return QImage::Format_RGB32; + case WL_SHM_FORMAT_ARGB8888: return QImage::Format_ARGB32_Premultiplied; + case WL_SHM_FORMAT_RGB565: return QImage::Format_RGB16; + case WL_SHM_FORMAT_XRGB1555: return QImage::Format_RGB555; + case WL_SHM_FORMAT_RGB888: return QImage::Format_RGB888; + case WL_SHM_FORMAT_XRGB4444: return QImage::Format_RGB444; + case WL_SHM_FORMAT_ARGB4444: return QImage::Format_ARGB4444_Premultiplied; + case WL_SHM_FORMAT_XBGR8888: return QImage::Format_RGBX8888; + case WL_SHM_FORMAT_ABGR8888: return QImage::Format_RGBA8888_Premultiplied; + case WL_SHM_FORMAT_XBGR2101010: return QImage::Format_BGR30; + case WL_SHM_FORMAT_ABGR2101010: return QImage::Format_A2BGR30_Premultiplied; + case WL_SHM_FORMAT_XRGB2101010: return QImage::Format_RGB30; + case WL_SHM_FORMAT_ARGB2101010: return QImage::Format_A2RGB30_Premultiplied; + case WL_SHM_FORMAT_C8: return QImage::Format_Alpha8; + default: return QImage::Format_Invalid; + } + } static inline QVector supportedWaylandFormats(); private: @@ -108,16 +127,6 @@ wl_shm_format QWaylandSharedMemoryFormatHelper::fromQImageFormat(QImage::Format return array.data[format]; } -QImage::Format QWaylandSharedMemoryFormatHelper::fromWaylandShmFormat(wl_shm_format format) -{ - Array array = getData(); - for (size_t i = 0; i < array.size; i++) { - if (array.data[i] == format) - return QImage::Format(i); - } - return QImage::Format_Invalid; -} - QVector QWaylandSharedMemoryFormatHelper::supportedWaylandFormats() { QVector retFormats; From cb68cead894f058315fe7a0736d6f9da24d4fcd1 Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Tue, 23 Jul 2019 01:40:36 +0200 Subject: [PATCH 0725/1507] Client: Fix large clipboard pasting With the non-blocking file opening, when no data was available in the pipe, read could return 0 even though we were not at the end of the file. This resulted in truncated data when pasting the clipboard. This patch uses select to block until a file is available, removing the polling sleep. This means the file can be safely opened in blocking mode whilst keeping the timeout feature allowing read to work as intended. Change-Id: I936aa85e9f25197e7abe6fb3fa729b618c00924d Reviewed-by: David Faure Reviewed-by: Johan Helsing --- .../platforms/wayland/qwaylanddataoffer.cpp | 41 +++++++++++-------- 1 file changed, 25 insertions(+), 16 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylanddataoffer.cpp b/src/plugins/platforms/wayland/qwaylanddataoffer.cpp index 0c732c02078..3da16ed0041 100644 --- a/src/plugins/platforms/wayland/qwaylanddataoffer.cpp +++ b/src/plugins/platforms/wayland/qwaylanddataoffer.cpp @@ -135,7 +135,7 @@ QVariant QWaylandMimeData::retrieveData_sys(const QString &mimeType, QVariant::T } int pipefd[2]; - if (qt_safe_pipe(pipefd, O_NONBLOCK) == -1) { + if (qt_safe_pipe(pipefd) == -1) { qWarning("QWaylandMimeData: pipe2() failed"); return QVariant(); } @@ -158,23 +158,32 @@ QVariant QWaylandMimeData::retrieveData_sys(const QString &mimeType, QVariant::T int QWaylandMimeData::readData(int fd, QByteArray &data) const { - char buf[4096]; - int retryCount = 0; - int n; - while (true) { - n = QT_READ(fd, buf, sizeof buf); - if (n == -1 && (errno == EAGAIN || errno == EWOULDBLOCK) && ++retryCount < 1000) - usleep(1000); - else - break; - } - if (retryCount >= 1000) + fd_set readset; + FD_ZERO(&readset); + FD_SET(fd, &readset); + struct timeval timeout; + timeout.tv_sec = 1; + timeout.tv_usec = 0; + + int ready = select(FD_SETSIZE, &readset, nullptr, nullptr, &timeout); + if (ready < 0) { + qWarning() << "QWaylandDataOffer: select() failed"; + return -1; + } else if (ready == 0) { qWarning("QWaylandDataOffer: timeout reading from pipe"); - if (n > 0) { - data.append(buf, n); - n = readData(fd, data); + return -1; + } else { + char buf[4096]; + int n = QT_READ(fd, buf, sizeof buf); + + if (n > 0) { + data.append(buf, n); + n = readData(fd, data); + } else if (n < 0) { + qWarning("QWaylandDataOffer: read() failed"); + } + return n; } - return n; } } From ec510cb38c00231406f77dfea771e3c96874412b Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Wed, 26 Jun 2019 09:47:03 +0200 Subject: [PATCH 0726/1507] Client: Emit wl_surface lifetime signals on QWaylandWindow Recent changes in QtBase means QtWayland will have to follow the convention of the rest of the QPA plugins and have QPlatformSurfaceEvent::SurfaceCreated and SurfaceAboutToBeDestroyed follow the QPlatformWindow (QWaylandWindow) lifetime and not the lifetime of wl_surface. Some users were depending on those events to get notified about wl_surface changes and used QPlatformNativeInterface in order to get the window's underlying wl_surfaces in responses to the events. The good news is that QPlatformNativeInterface is private (QPA) API, so we can provide an alternative by exposing new private API, which is what this patch does. The QWaylandWindow::wlSurfaceDestroyed signal already exists in the dev branch (introduced in 04be9cf380), so this is a backport of that signal as well as an addition of a new QWaylandWindow::wlSurfaceCreated signal. Task-number: QTBUG-76324 Change-Id: Ibc5748474cd52f5b9461fd1ad6cef973491174b1 Reviewed-by: Pier Luigi Fiorini --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 6 +++++- src/plugins/platforms/wayland/qwaylandwindow_p.h | 4 ++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 76d7715a852..abc54f58438 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -210,7 +210,9 @@ void QWaylandWindow::initWindow() void QWaylandWindow::initializeWlSurface() { + Q_ASSERT(!isInitialized()); init(mDisplay->createSurface(static_cast(this))); + emit wlSurfaceCreated(); } bool QWaylandWindow::shouldCreateShellSurface() const @@ -245,8 +247,10 @@ void QWaylandWindow::reset(bool sendDestroyEvent) mShellSurface = nullptr; delete mSubSurfaceWindow; mSubSurfaceWindow = nullptr; - if (isInitialized()) + if (isInitialized()) { + emit wlSurfaceDestroyed(); destroy(); + } mScreens.clear(); if (mFrameCallback) { diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index 23432e39873..ec9bd7d0288 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -199,6 +199,10 @@ public: public slots: void applyConfigure(); +signals: + void wlSurfaceCreated(); + void wlSurfaceDestroyed(); + protected: void surface_enter(struct ::wl_output *output) override; void surface_leave(struct ::wl_output *output) override; From 39b50c36bda73ced9565757f379285b9b1b66087 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Thu, 15 Aug 2019 14:14:23 +0200 Subject: [PATCH 0727/1507] Make it possible to build only the compositor module Reduces unnecessary coupling between the compositor and client modules. [ChangeLog][Compositor] The compositor module no longer depends on the client module. Change-Id: I108e56960835b6c31c450d5ae08a0a101af9422b Reviewed-by: Johan Helsing Reviewed-by: Paul Olav Tvete --- tests/auto/wayland/inputcontext/inputcontext.pro | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/auto/wayland/inputcontext/inputcontext.pro b/tests/auto/wayland/inputcontext/inputcontext.pro index 4419b3e77ad..1971d455ead 100644 --- a/tests/auto/wayland/inputcontext/inputcontext.pro +++ b/tests/auto/wayland/inputcontext/inputcontext.pro @@ -1,6 +1,4 @@ include (../shared/shared.pri) -QT += waylandcompositor - TARGET = tst_inputcontext SOURCES += tst_inputcontext.cpp From 8b50d2c6cc99e6da91ac50477ae8191e29b35f8c Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Mon, 8 Jul 2019 10:22:03 +0200 Subject: [PATCH 0728/1507] Fix race condition for client buffer integration initialization This race happened because QWaylandIntegration::clientBufferIntegration (which lazily initializes the integration) was called from numerous places including code that may run on different threads without any kind of syncrhonization. An example of this is Qt3D, which indirectly and simultaneously calls createPlatformWindow (from the GUI thread) and createPlatformOpenGLContext (from its render thread), both of which needs to use the client buffer integration. In this patch, we fix it by first checking if the integration is initialized. In that case, it's safe to use it. Otherwise we lock a mutex, re-check if initialization has happened on another thread in the meantime, and then finally we initialize it. This way we should avoid the expense of mutex locking after initialization is complete, while still staying race free during initialization. Fixes: QTBUG-76504 Change-Id: I327840ebf41e014882cb659bc3e4fafb7bdb7a98 Reviewed-by: David Edmundson Reviewed-by: Paul Olav Tvete --- .../platforms/wayland/qwaylandintegration.cpp | 31 ++++++++++++------- .../platforms/wayland/qwaylandintegration_p.h | 2 ++ 2 files changed, 22 insertions(+), 11 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandintegration.cpp b/src/plugins/platforms/wayland/qwaylandintegration.cpp index 97e0203cdc9..46bef2944fe 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandintegration.cpp @@ -301,11 +301,14 @@ QPlatformTheme *QWaylandIntegration::createPlatformTheme(const QString &name) co return GenericWaylandTheme::createUnixTheme(name); } +// May be called from non-GUI threads QWaylandClientBufferIntegration *QWaylandIntegration::clientBufferIntegration() const { - if (!mClientBufferIntegrationInitialized) + // Do an inexpensive check first to avoid locking whenever possible + if (Q_UNLIKELY(!mClientBufferIntegrationInitialized)) const_cast(this)->initializeClientBufferIntegration(); + Q_ASSERT(mClientBufferIntegrationInitialized); return mClientBufferIntegration && mClientBufferIntegration->isValid() ? mClientBufferIntegration.data() : nullptr; } @@ -325,9 +328,12 @@ QWaylandShellIntegration *QWaylandIntegration::shellIntegration() const return mShellIntegration.data(); } +// May be called from non-GUI threads void QWaylandIntegration::initializeClientBufferIntegration() { - mClientBufferIntegrationInitialized = true; + QMutexLocker lock(&mClientBufferInitLock); + if (mClientBufferIntegrationInitialized) + return; QString targetKey; bool disableHardwareIntegration = qEnvironmentVariableIsSet("QT_WAYLAND_DISABLE_HW_INTEGRATION"); @@ -345,17 +351,20 @@ void QWaylandIntegration::initializeClientBufferIntegration() if (targetKey.isEmpty()) { qWarning("Failed to determine what client buffer integration to use"); - return; + } else { + QStringList keys = QWaylandClientBufferIntegrationFactory::keys(); + if (keys.contains(targetKey)) { + mClientBufferIntegration.reset(QWaylandClientBufferIntegrationFactory::create(targetKey, QStringList())); + } + if (mClientBufferIntegration) + mClientBufferIntegration->initialize(mDisplay.data()); + else + qWarning("Failed to load client buffer integration: %s\n", qPrintable(targetKey)); } - QStringList keys = QWaylandClientBufferIntegrationFactory::keys(); - if (keys.contains(targetKey)) { - mClientBufferIntegration.reset(QWaylandClientBufferIntegrationFactory::create(targetKey, QStringList())); - } - if (mClientBufferIntegration) - mClientBufferIntegration->initialize(mDisplay.data()); - else - qWarning("Failed to load client buffer integration: %s\n", qPrintable(targetKey)); + // This must be set last to make sure other threads don't use the + // integration before initialization is complete. + mClientBufferIntegrationInitialized = true; } void QWaylandIntegration::initializeServerBufferIntegration() diff --git a/src/plugins/platforms/wayland/qwaylandintegration_p.h b/src/plugins/platforms/wayland/qwaylandintegration_p.h index a5a3d7b6956..7c1cb978abe 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration_p.h +++ b/src/plugins/platforms/wayland/qwaylandintegration_p.h @@ -54,6 +54,7 @@ #include #include #include +#include QT_BEGIN_NAMESPACE @@ -148,6 +149,7 @@ private: QScopedPointer mAccessibility; #endif bool mFailed = false; + QMutex mClientBufferInitLock; bool mClientBufferIntegrationInitialized = false; bool mServerBufferIntegrationInitialized = false; bool mShellIntegrationInitialized = false; From f168c11529709a4fc3c3ec180bbc5c2e47960b34 Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Tue, 9 Jul 2019 13:15:20 +0200 Subject: [PATCH 0729/1507] Handle Key_Return explicitly instead of depending on the text When Key_Return is sent from Qt VirtualKeyboard it will send it as \n and not \r which means it will be interpreted as an unknown key. So since we know it will be able to map it in this case, we explicitly account for it so it can be mapped to the right key. Change-Id: Id5d8d9653e78975203f80790b7a3d332f0e011fa Reviewed-by: Johan Helsing --- src/plugins/platforms/wayland/shared/qwaylandxkb.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/shared/qwaylandxkb.cpp b/src/plugins/platforms/wayland/shared/qwaylandxkb.cpp index 3cfc4b074e5..2dff8a5b16d 100644 --- a/src/plugins/platforms/wayland/shared/qwaylandxkb.cpp +++ b/src/plugins/platforms/wayland/shared/qwaylandxkb.cpp @@ -376,7 +376,7 @@ QVector QWaylandXkb::toKeysym(QKeyEvent *event) keysyms.append(XKB_KEY_KP_0 + (event->key() - Qt::Key_0)); else keysyms.append(toKeysymFromTable(event->key())); - } else if (!event->text().isEmpty()) { + } else if (!event->text().isEmpty() && event->key() != Qt::Key_Return) { // From libxkbcommon keysym-utf.c: // "We allow to represent any UCS character in the range U-00000000 to // U-00FFFFFF by a keysym value in the range 0x01000000 to 0x01ffffff." From b4ee20efff96534895060dab6a3e7ced5d41f9c2 Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Sun, 23 Jun 2019 14:48:30 +0200 Subject: [PATCH 0730/1507] Client: Make handleUpdate aware of exposure changes The wl_surface can be destroyed whilst a render is happening. Calling wl_surface::frame after the window is reset can crash as wl_surface is null. Fixes: QTBUG-77747 Change-Id: I139a9b234cb6acba81d6c1d5fa58629904a25053 Reviewed-by: Paul Olav Tvete --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 9 ++++++++- src/plugins/platforms/wayland/qwaylandwindow_p.h | 4 ++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 76d7715a852..1d4315a395f 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -210,6 +210,8 @@ void QWaylandWindow::initWindow() void QWaylandWindow::initializeWlSurface() { + Q_ASSERT(!isInitialized()); + QWriteLocker lock(&mSurfaceLock); init(mDisplay->createSurface(static_cast(this))); } @@ -245,8 +247,10 @@ void QWaylandWindow::reset(bool sendDestroyEvent) mShellSurface = nullptr; delete mSubSurfaceWindow; mSubSurfaceWindow = nullptr; - if (isInitialized()) + if (isInitialized()) { + QWriteLocker lock(&mSurfaceLock); destroy(); + } mScreens.clear(); if (mFrameCallback) { @@ -1147,6 +1151,9 @@ void QWaylandWindow::requestUpdate() void QWaylandWindow::handleUpdate() { // TODO: Should sync subsurfaces avoid requesting frame callbacks? + QReadLocker lock(&mSurfaceLock); + if (!isInitialized()) + return; if (mFrameCallback) { wl_callback_destroy(mFrameCallback); diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index 23432e39873..ed4061f0eae 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -53,6 +53,8 @@ #include #include +#include + #include #include #include @@ -272,6 +274,8 @@ private: static QMutex mFrameSyncMutex; static QWaylandWindow *mMouseGrab; + QReadWriteLock mSurfaceLock; + friend class QWaylandSubSurface; }; From d87b6d823153d855fe4b052ccd503eeb6cdbcd8d Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Tue, 20 Aug 2019 13:38:12 +0200 Subject: [PATCH 0731/1507] Client: Crash instead of exit when there's a wayland error Qt applications should not call exit. Task-number: QTBUG-75779 Change-Id: I91190b10f8c8e111996cd73283061e6ceaa6b1f6 Reviewed-by: Pier Luigi Fiorini --- .../platforms/wayland/qwaylanddisplay.cpp | 22 +++++-------------- .../platforms/wayland/qwaylanddisplay_p.h | 1 - 2 files changed, 6 insertions(+), 17 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index 82003a308c6..47b107e807f 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -172,9 +172,9 @@ void QWaylandDisplay::checkError() const int ecode = wl_display_get_error(mDisplay); if ((ecode == EPIPE || ecode == ECONNRESET)) { // special case this to provide a nicer error - qWarning("The Wayland connection broke. Did the Wayland compositor die?"); + qFatal("The Wayland connection broke. Did the Wayland compositor die?"); } else { - qErrnoWarning(ecode, "The Wayland connection experienced a fatal error"); + qFatal("The Wayland connection experienced a fatal error: %s", strerror(ecode)); } } @@ -184,25 +184,16 @@ void QWaylandDisplay::flushRequests() wl_display_read_events(mDisplay); } - if (wl_display_dispatch_pending(mDisplay) < 0) { + if (wl_display_dispatch_pending(mDisplay) < 0) checkError(); - exitWithError(); - } wl_display_flush(mDisplay); } void QWaylandDisplay::blockingReadEvents() { - if (wl_display_dispatch(mDisplay) < 0) { + if (wl_display_dispatch(mDisplay) < 0) checkError(); - exitWithError(); - } -} - -void QWaylandDisplay::exitWithError() -{ - ::exit(1); } wl_event_queue *QWaylandDisplay::createEventQueue() @@ -231,10 +222,9 @@ void QWaylandDisplay::dispatchQueueWhile(wl_event_queue *queue, std::function Date: Sat, 17 Aug 2019 10:37:39 +0200 Subject: [PATCH 0732/1507] Client: Expose default input device through integration Expose the whole default input device to clients. [ChangeLog][QPA plugin] Expose default input device to clients through the QPA API. Change-Id: I2608178f8b0ac09f766434588a280bcc2b30627d Reviewed-by: Johan Helsing --- .../platforms/wayland/qwaylandinputdevice.cpp | 15 +++++++++++++ .../platforms/wayland/qwaylandinputdevice_p.h | 10 +++++++++ .../wayland/qwaylandnativeinterface.cpp | 22 +++++++++++++++++++ 3 files changed, 47 insertions(+) diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index 8c794ddaedb..65f80f308bb 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -442,6 +442,21 @@ QWaylandInputDevice::Touch *QWaylandInputDevice::createTouch(QWaylandInputDevice return new Touch(device); } +QWaylandInputDevice::Keyboard *QWaylandInputDevice::keyboard() const +{ + return mKeyboard; +} + +QWaylandInputDevice::Pointer *QWaylandInputDevice::pointer() const +{ + return mPointer; +} + +QWaylandInputDevice::Touch *QWaylandInputDevice::touch() const +{ + return mTouch; +} + void QWaylandInputDevice::handleEndDrag() { if (mTouch) diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h index 06ba5d5664e..4ac1dca3525 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h +++ b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h @@ -148,6 +148,10 @@ public: virtual Pointer *createPointer(QWaylandInputDevice *device); virtual Touch *createTouch(QWaylandInputDevice *device); + Keyboard *keyboard() const; + Pointer *pointer() const; + Touch *touch() const; + private: QWaylandDisplay *mQDisplay = nullptr; struct wl_display *mDisplay = nullptr; @@ -248,6 +252,8 @@ public: Qt::KeyboardModifiers modifiers() const; + struct ::wl_keyboard *wl_keyboard() { return QtWayland::wl_keyboard::object(); } + private slots: void handleFocusDestroyed(); void handleFocusLost(); @@ -284,6 +290,8 @@ public: #endif QWaylandInputDevice *seat() const { return mParent; } + struct ::wl_pointer *wl_pointer() { return QtWayland::wl_pointer::object(); } + protected: void pointer_enter(uint32_t serial, struct wl_surface *surface, wl_fixed_t sx, wl_fixed_t sy) override; @@ -377,6 +385,8 @@ public: bool allTouchPointsReleased(); void releasePoints(); + struct ::wl_touch *wl_touch() { return QtWayland::wl_touch::object(); } + QWaylandInputDevice *mParent = nullptr; QPointer mFocus; QList mTouchPoints; diff --git a/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp b/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp index cf227d489a5..b4ecc009098 100644 --- a/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp +++ b/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp @@ -47,6 +47,7 @@ #include "qwaylanddisplay_p.h" #include "qwaylandwindowmanagerintegration_p.h" #include "qwaylandscreen_p.h" +#include "qwaylandinputdevice_p.h" #include #include #include @@ -76,6 +77,27 @@ void *QWaylandNativeInterface::nativeResourceForIntegration(const QByteArray &re if (lowerCaseResource == "egldisplay" && m_integration->clientBufferIntegration()) return m_integration->clientBufferIntegration()->nativeResource(QWaylandClientBufferIntegration::EglDisplay); + if (lowerCaseResource == "wl_seat") + return m_integration->display()->defaultInputDevice()->wl_seat(); + if (lowerCaseResource == "wl_keyboard") { + auto *keyboard = m_integration->display()->defaultInputDevice()->keyboard(); + if (keyboard) + return keyboard->wl_keyboard(); + return nullptr; + } + if (lowerCaseResource == "wl_pointer") { + auto *pointer = m_integration->display()->defaultInputDevice()->pointer(); + if (pointer) + return pointer->wl_pointer(); + return nullptr; + } + if (lowerCaseResource == "wl_touch") { + auto *touch = m_integration->display()->defaultInputDevice()->touch(); + if (touch) + return touch->wl_touch(); + return nullptr; + } + return nullptr; } From 963829b27da7d0223d72ec3c1d6a18b45f123ddb Mon Sep 17 00:00:00 2001 From: Pier Luigi Fiorini Date: Wed, 16 Jan 2019 08:34:11 +0100 Subject: [PATCH 0733/1507] Compositor: Add xdg-output unstable v1 support We already have a client-side implementation in the QPA plugin, and now we add the server-side implementation. In order to have a nice declarative API, we let users create a XdgOutputV1 instance and then associate it with the zxdg_output_v1 object when it is requested by the client. If the user forgets to create XdgOutputV1 beforehand we post an error to the client. To anticipate protocol version 3, we send zxdg_output_v1.done when we send wl_output.done. The multi-output example is extended using this protocol. [ChangeLog][Compositor] Added support for xdg-output unstable v1 Wayland extension. Change-Id: I1ec5913d8330cc01d7d634d05a289f4dc8b4fd22 Reviewed-by: Johan Helsing --- src/3rdparty/wayland/protocols/qt_attribution.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/3rdparty/wayland/protocols/qt_attribution.json b/src/3rdparty/wayland/protocols/qt_attribution.json index e6f90698b89..c49ead4f33d 100644 --- a/src/3rdparty/wayland/protocols/qt_attribution.json +++ b/src/3rdparty/wayland/protocols/qt_attribution.json @@ -127,8 +127,9 @@ Copyright (c) 2013 BMW Car IT GmbH" "Id": "wayland-xdg-output-protocol", "Name": "Wayland XDG Output Protocol", "QDocModule": "qtwaylandcompositor", - "QtUsage": "Used in the Qt Wayland platform plugin.", + "QtUsage": "Used in the Qt Wayland Compositor API, and the Qt Wayland platform plugin.", "Files": "xdg-output-unstable-v1.xml", + "Description": "The XDG Output protocol is an extended way to describe output regions under Wayland", "Homepage": "https://wayland.freedesktop.org", "Version": "unstable v1, version 2", From 464f33e5b452e7e8b119f595353fa2e499010b2e Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Fri, 23 Aug 2019 11:10:36 +0200 Subject: [PATCH 0734/1507] Client tests: Upgrade tests to wl_seat v5 This means that pointer events need to be followed by frame events. wl_seat version 4 is tested by the "tst_seatv4" autotest. Change-Id: Ifa8e6d6edc998853be7cd901003e619029fc6f68 Reviewed-by: Paul Olav Tvete --- .../wayland/datadevicev1/tst_datadevicev1.cpp | 8 +++- tests/auto/wayland/output/tst_output.cpp | 3 ++ .../tst_primaryselectionv1.cpp | 11 +++++- tests/auto/wayland/shared/coreprotocol.h | 2 +- tests/auto/wayland/xdgshell/tst_xdgshell.cpp | 39 +++++++++++-------- 5 files changed, 43 insertions(+), 20 deletions(-) diff --git a/tests/auto/wayland/datadevicev1/tst_datadevicev1.cpp b/tests/auto/wayland/datadevicev1/tst_datadevicev1.cpp index fe68d520d59..35ac7252866 100644 --- a/tests/auto/wayland/datadevicev1/tst_datadevicev1.cpp +++ b/tests/auto/wayland/datadevicev1/tst_datadevicev1.cpp @@ -66,7 +66,7 @@ void tst_datadevicev1::initTestCase() { QCOMPOSITOR_TRY_VERIFY(pointer()); QCOMPOSITOR_TRY_VERIFY(!pointer()->resourceMap().empty()); - QCOMPOSITOR_TRY_COMPARE(pointer()->resourceMap().first()->version(), 4); + QCOMPOSITOR_TRY_COMPARE(pointer()->resourceMap().first()->version(), 5); QCOMPOSITOR_TRY_VERIFY(keyboard()); @@ -104,8 +104,11 @@ void tst_datadevicev1::pasteAscii() keyboard()->sendEnter(surface); // Need to set keyboard focus according to protocol pointer()->sendEnter(surface, {32, 32}); + pointer()->sendFrame(client); pointer()->sendButton(client, BTN_LEFT, 1); + pointer()->sendFrame(client); pointer()->sendButton(client, BTN_LEFT, 0); + pointer()->sendFrame(client); }); QTRY_COMPARE(window.m_text, "normal ascii"); } @@ -139,8 +142,11 @@ void tst_datadevicev1::pasteUtf8() keyboard()->sendEnter(surface); // Need to set keyboard focus according to protocol pointer()->sendEnter(surface, {32, 32}); + pointer()->sendFrame(client); pointer()->sendButton(client, BTN_LEFT, 1); + pointer()->sendFrame(client); pointer()->sendButton(client, BTN_LEFT, 0); + pointer()->sendFrame(client); }); QTRY_COMPARE(window.m_text, "face with tears of joy: 😂"); } diff --git a/tests/auto/wayland/output/tst_output.cpp b/tests/auto/wayland/output/tst_output.cpp index 2d2c8efd682..29c773cf65e 100644 --- a/tests/auto/wayland/output/tst_output.cpp +++ b/tests/auto/wayland/output/tst_output.cpp @@ -196,8 +196,11 @@ void tst_output::removePrimaryScreen() exec([&] { auto *surface = xdgToplevel()->surface(); pointer()->sendEnter(surface, {32, 32}); + pointer()->sendFrame(client()); pointer()->sendButton(client(), BTN_LEFT, 1); + pointer()->sendFrame(client()); pointer()->sendButton(client(), BTN_LEFT, 0); + pointer()->sendFrame(client()); }); // Wait to make sure mouse events dont't cause a crash now that the screen has changed diff --git a/tests/auto/wayland/primaryselectionv1/tst_primaryselectionv1.cpp b/tests/auto/wayland/primaryselectionv1/tst_primaryselectionv1.cpp index 281e4c5d11a..216db85cd6b 100644 --- a/tests/auto/wayland/primaryselectionv1/tst_primaryselectionv1.cpp +++ b/tests/auto/wayland/primaryselectionv1/tst_primaryselectionv1.cpp @@ -268,7 +268,7 @@ void tst_primaryselectionv1::initTestCase() { QCOMPOSITOR_TRY_VERIFY(pointer()); QCOMPOSITOR_TRY_VERIFY(!pointer()->resourceMap().empty()); - QCOMPOSITOR_TRY_COMPARE(pointer()->resourceMap().first()->version(), 4); + QCOMPOSITOR_TRY_COMPARE(pointer()->resourceMap().first()->version(), 5); QCOMPOSITOR_TRY_VERIFY(keyboard()); } @@ -329,8 +329,11 @@ void tst_primaryselectionv1::pasteAscii() device->sendSelection(offer); pointer()->sendEnter(surface, {32, 32}); + pointer()->sendFrame(client()); pointer()->sendButton(client(), BTN_MIDDLE, 1); + pointer()->sendFrame(client()); pointer()->sendButton(client(), BTN_MIDDLE, 0); + pointer()->sendFrame(client()); }); QTRY_COMPARE(window.m_formats, QStringList{"text/plain"}); QTRY_COMPARE(window.m_text, "normal ascii"); @@ -372,8 +375,11 @@ void tst_primaryselectionv1::pasteUtf8() device->sendSelection(offer); pointer()->sendEnter(surface, {32, 32}); + pointer()->sendFrame(client()); pointer()->sendButton(client(), BTN_MIDDLE, 1); + pointer()->sendFrame(client()); pointer()->sendButton(client(), BTN_MIDDLE, 0); + pointer()->sendFrame(client()); }); QTRY_COMPARE(window.m_formats, QStringList({"text/plain", "text/plain;charset=utf-8"})); QTRY_COMPARE(window.m_text, "face with tears of joy: 😂"); @@ -428,8 +434,11 @@ void tst_primaryselectionv1::copy() auto *surface = xdgSurface()->m_surface; keyboard()->sendEnter(surface); // Need to set keyboard focus according to protocol pointer()->sendEnter(surface, {32, 32}); + pointer()->sendFrame(client()); mouseSerials << pointer()->sendButton(client(), BTN_MIDDLE, 1); + pointer()->sendFrame(client()); mouseSerials << pointer()->sendButton(client(), BTN_MIDDLE, 0); + pointer()->sendFrame(client()); }); QCOMPOSITOR_TRY_VERIFY(primarySelectionDevice()->m_selectionSource); QCOMPOSITOR_TRY_VERIFY(mouseSerials.contains(primarySelectionDevice()->m_serial)); diff --git a/tests/auto/wayland/shared/coreprotocol.h b/tests/auto/wayland/shared/coreprotocol.h index 264c5f694e6..2347a83656d 100644 --- a/tests/auto/wayland/shared/coreprotocol.h +++ b/tests/auto/wayland/shared/coreprotocol.h @@ -236,7 +236,7 @@ class Seat : public Global, public QtWaylandServer::wl_seat { Q_OBJECT public: - explicit Seat(CoreCompositor *compositor, uint capabilities = Seat::capability_pointer | Seat::capability_keyboard, int version = 4); + explicit Seat(CoreCompositor *compositor, uint capabilities = Seat::capability_pointer | Seat::capability_keyboard, int version = 5); ~Seat() override; void send_capabilities(Resource *resource, uint capabilities) = delete; // Use wrapper instead void send_capabilities(uint capabilities) = delete; // Use wrapper instead diff --git a/tests/auto/wayland/xdgshell/tst_xdgshell.cpp b/tests/auto/wayland/xdgshell/tst_xdgshell.cpp index c887e5d4442..ac5c24988f8 100644 --- a/tests/auto/wayland/xdgshell/tst_xdgshell.cpp +++ b/tests/auto/wayland/xdgshell/tst_xdgshell.cpp @@ -214,12 +214,13 @@ void tst_xdgshell::popup() uint clickSerial = exec([=] { auto *surface = xdgToplevel()->surface(); auto *p = pointer(); + auto *c = client(); p->sendEnter(surface, {100, 100}); -// p->sendFrame(); //TODO: uncomment when we support seat v5 + p->sendFrame(c); uint serial = p->sendButton(client(), BTN_LEFT, Pointer::button_state_pressed); - p->sendButton(client(), BTN_LEFT, Pointer::button_state_released); + p->sendButton(c, BTN_LEFT, Pointer::button_state_released); return serial; -// p->sendFrame(); //TODO: uncomment when we support seat v5 + p->sendFrame(c); }); QTRY_VERIFY(window.m_popup); @@ -298,13 +299,14 @@ void tst_xdgshell::tooltipOnPopup() exec([=] { auto *surface = xdgToplevel()->surface(); auto *p = pointer(); + auto *c = client(); p->sendEnter(surface, {100, 100}); -// p->sendFrame(); //TODO: uncomment when we support seat v5 + p->sendFrame(c); p->sendButton(client(), BTN_LEFT, Pointer::button_state_pressed); p->sendButton(client(), BTN_LEFT, Pointer::button_state_released); -// p->sendFrame(); + p->sendFrame(c); p->sendLeave(surface); -// p->sendFrame(); + p->sendFrame(c); }); QCOMPOSITOR_TRY_VERIFY(xdgPopup()); @@ -315,11 +317,12 @@ void tst_xdgshell::tooltipOnPopup() exec([=] { auto *surface = xdgPopup()->surface(); auto *p = pointer(); + auto *c = client(); p->sendEnter(surface, {100, 100}); -// p->sendFrame(); + p->sendFrame(c); p->sendButton(client(), BTN_LEFT, Pointer::button_state_pressed); p->sendButton(client(), BTN_LEFT, Pointer::button_state_released); -// p->sendFrame(); + p->sendFrame(c); }); QCOMPOSITOR_TRY_VERIFY(xdgPopup(1)); @@ -380,13 +383,14 @@ void tst_xdgshell::switchPopups() exec([=] { auto *surface = xdgToplevel()->surface(); auto *p = pointer(); + auto *c = client(); p->sendEnter(surface, {100, 100}); -// p->sendFrame(); //TODO: uncomment when we support seat v5 - p->sendButton(client(), BTN_LEFT, Pointer::button_state_pressed); - p->sendButton(client(), BTN_LEFT, Pointer::button_state_released); -// p->sendFrame(); + p->sendFrame(c); + p->sendButton(c, BTN_LEFT, Pointer::button_state_pressed); + p->sendButton(c, BTN_LEFT, Pointer::button_state_released); + p->sendFrame(c); p->sendLeave(surface); -// p->sendFrame(); + p->sendFrame(c); }); QCOMPOSITOR_TRY_VERIFY(xdgPopup()); @@ -399,11 +403,12 @@ void tst_xdgshell::switchPopups() exec([=] { auto *surface = xdgToplevel()->surface(); auto *p = pointer(); + auto *c = client(); p->sendEnter(surface, {100, 100}); -// p->sendFrame(); - p->sendButton(client(), BTN_LEFT, Pointer::button_state_pressed); - p->sendButton(client(), BTN_LEFT, Pointer::button_state_released); -// p->sendFrame(); + p->sendFrame(c); + p->sendButton(c, BTN_LEFT, Pointer::button_state_pressed); + p->sendButton(c, BTN_LEFT, Pointer::button_state_released); + p->sendFrame(c); }); // The client will now hide one popup and then show another From b36c46f2d6f483cb1c8ed3b3adb0ab92fa46e09d Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Fri, 23 Aug 2019 09:17:07 +0200 Subject: [PATCH 0735/1507] Client tests: Remove redundant pointer helper function Change-Id: If5d435a227b54f566f121331385e849b615fb615 Reviewed-by: Paul Olav Tvete --- tests/auto/wayland/seatv5/tst_seatv5.cpp | 7 ------- 1 file changed, 7 deletions(-) diff --git a/tests/auto/wayland/seatv5/tst_seatv5.cpp b/tests/auto/wayland/seatv5/tst_seatv5.cpp index 5b9235d9aa3..4e5d6ccecac 100644 --- a/tests/auto/wayland/seatv5/tst_seatv5.cpp +++ b/tests/auto/wayland/seatv5/tst_seatv5.cpp @@ -46,13 +46,6 @@ public: add(capabilities, version); }); } - - Pointer *pointer() - { - auto *seat = get(); - Q_ASSERT(seat); - return seat->m_pointer; - } }; class tst_seatv5 : public QObject, private SeatV5Compositor From c0d8e3dc36b7e19fca711b81dd406a546219ad9e Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Fri, 23 Aug 2019 09:19:03 +0200 Subject: [PATCH 0736/1507] Client tests: Add missing cleanup for keyboards Change-Id: Ia085dbe34b6e3b7cf83b4f55c265e12b1145ab8a Reviewed-by: Paul Olav Tvete --- tests/auto/wayland/shared/coreprotocol.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/auto/wayland/shared/coreprotocol.cpp b/tests/auto/wayland/shared/coreprotocol.cpp index f9335e7834a..fcc9f311c4a 100644 --- a/tests/auto/wayland/shared/coreprotocol.cpp +++ b/tests/auto/wayland/shared/coreprotocol.cpp @@ -191,6 +191,9 @@ Seat::~Seat() { qDeleteAll(m_oldPointers); delete m_pointer; + + qDeleteAll(m_oldKeyboards); + delete m_keyboard; } void Seat::setCapabilities(uint capabilities) { From ae5db4fec199b25fa55fb0a3659f70ca94b1a0eb Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Fri, 23 Aug 2019 09:20:00 +0200 Subject: [PATCH 0737/1507] Client tests: Fix incorrect test for keyboard capability Change-Id: I4e35e86f489941dcce986ba416f3fe55d968d186 Reviewed-by: Paul Olav Tvete --- tests/auto/wayland/shared/coreprotocol.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/wayland/shared/coreprotocol.cpp b/tests/auto/wayland/shared/coreprotocol.cpp index fcc9f311c4a..5f51e417729 100644 --- a/tests/auto/wayland/shared/coreprotocol.cpp +++ b/tests/auto/wayland/shared/coreprotocol.cpp @@ -239,7 +239,7 @@ void Seat::seat_get_pointer(Resource *resource, uint32_t id) void Seat::seat_get_keyboard(QtWaylandServer::wl_seat::Resource *resource, uint32_t id) { - if (~m_capabilities & capability_pointer) { + if (~m_capabilities & capability_keyboard) { qWarning() << "Client requested a wl_keyboard without the capability being available." << "This Could be a race condition when hotunplugging," << "but is most likely a client error"; From 74e3dd6d609a50aaf807bfef76fe8b63b1675161 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Fri, 23 Aug 2019 09:25:56 +0200 Subject: [PATCH 0738/1507] Client tests: Add touch infrastructure and simple test This doesn't test much, but adds the infrastructure needed for more thorough tests later on. More or less exactly matches the mocking for wl_keyboard and wl_pointer. Change-Id: I563bb9be7ccaaf0aa83611e84d051cc307455ccb Reviewed-by: Paul Olav Tvete --- tests/auto/wayland/seatv5/tst_seatv5.cpp | 13 ++++++++- tests/auto/wayland/shared/coreprotocol.cpp | 29 ++++++++++++++++++-- tests/auto/wayland/shared/coreprotocol.h | 16 +++++++++-- tests/auto/wayland/shared/mockcompositor.cpp | 2 +- tests/auto/wayland/shared/mockcompositor.h | 1 + 5 files changed, 54 insertions(+), 7 deletions(-) diff --git a/tests/auto/wayland/seatv5/tst_seatv5.cpp b/tests/auto/wayland/seatv5/tst_seatv5.cpp index 4e5d6ccecac..c2b1b0e4b4d 100644 --- a/tests/auto/wayland/seatv5/tst_seatv5.cpp +++ b/tests/auto/wayland/seatv5/tst_seatv5.cpp @@ -41,7 +41,7 @@ public: removeAll(); - uint capabilities = MockCompositor::Seat::capability_pointer; + uint capabilities = MockCompositor::Seat::capability_pointer | MockCompositor::Seat::capability_touch; int version = 5; add(capabilities, version); }); @@ -54,6 +54,8 @@ class tst_seatv5 : public QObject, private SeatV5Compositor private slots: void cleanup() { QTRY_VERIFY2(isClean(), qPrintable(dirtyMessage())); } void bindsToSeat(); + + // Pointer tests void createsPointer(); void setsCursorOnEnter(); void usesEnterSerial(); @@ -62,6 +64,9 @@ private slots: void fingerScroll(); void fingerScrollSlow(); void wheelDiscreteScroll(); + + // Touch tests + void createsTouch(); }; void tst_seatv5::bindsToSeat() @@ -376,5 +381,11 @@ void tst_seatv5::wheelDiscreteScroll() } } +void tst_seatv5::createsTouch() +{ + QCOMPOSITOR_TRY_COMPARE(touch()->resourceMap().size(), 1); + QCOMPOSITOR_TRY_COMPARE(touch()->resourceMap().first()->version(), 5); +} + QCOMPOSITOR_TEST_MAIN(tst_seatv5) #include "tst_seatv5.moc" diff --git a/tests/auto/wayland/shared/coreprotocol.cpp b/tests/auto/wayland/shared/coreprotocol.cpp index 5f51e417729..006c4a80bde 100644 --- a/tests/auto/wayland/shared/coreprotocol.cpp +++ b/tests/auto/wayland/shared/coreprotocol.cpp @@ -192,14 +192,14 @@ Seat::~Seat() qDeleteAll(m_oldPointers); delete m_pointer; + qDeleteAll(m_oldTouchs); + delete m_touch; + qDeleteAll(m_oldKeyboards); delete m_keyboard; } void Seat::setCapabilities(uint capabilities) { - // TODO: Add support for touch - Q_ASSERT(~capabilities & capability_touch); - m_capabilities = capabilities; if (m_capabilities & capability_pointer) { @@ -210,6 +210,14 @@ void Seat::setCapabilities(uint capabilities) { m_pointer = nullptr; } + if (m_capabilities & capability_touch) { + if (!m_touch) + m_touch = (new Touch(this)); + } else if (m_touch) { + m_oldTouchs << m_touch; + m_touch = nullptr; + } + if (m_capabilities & capability_keyboard) { if (!m_keyboard) m_keyboard = (new Keyboard(this)); @@ -237,6 +245,21 @@ void Seat::seat_get_pointer(Resource *resource, uint32_t id) m_pointer->add(resource->client(), id, resource->version()); } +void Seat::seat_get_touch(QtWaylandServer::wl_seat::Resource *resource, uint32_t id) +{ + if (~m_capabilities & capability_touch) { + qWarning() << "Client requested a wl_touch without the capability being available." + << "This Could be a race condition when hotunplugging," + << "but is most likely a client error"; + Touch *touch = new Touch(this); + touch->add(resource->client(), id, resource->version()); + // TODO: mark as destroyed + m_oldTouchs << touch; + return; + } + m_touch->add(resource->client(), id, resource->version()); +} + void Seat::seat_get_keyboard(QtWaylandServer::wl_seat::Resource *resource, uint32_t id) { if (~m_capabilities & capability_keyboard) { diff --git a/tests/auto/wayland/shared/coreprotocol.h b/tests/auto/wayland/shared/coreprotocol.h index 2347a83656d..6905ab5d54b 100644 --- a/tests/auto/wayland/shared/coreprotocol.h +++ b/tests/auto/wayland/shared/coreprotocol.h @@ -38,6 +38,7 @@ namespace MockCompositor { class WlCompositor; class Output; class Pointer; +class Touch; class Keyboard; class CursorRole; class ShmPool; @@ -236,7 +237,7 @@ class Seat : public Global, public QtWaylandServer::wl_seat { Q_OBJECT public: - explicit Seat(CoreCompositor *compositor, uint capabilities = Seat::capability_pointer | Seat::capability_keyboard, int version = 5); + explicit Seat(CoreCompositor *compositor, uint capabilities = Seat::capability_pointer | Seat::capability_keyboard | Seat::capability_touch, int version = 5); ~Seat() override; void send_capabilities(Resource *resource, uint capabilities) = delete; // Use wrapper instead void send_capabilities(uint capabilities) = delete; // Use wrapper instead @@ -247,6 +248,9 @@ public: Pointer* m_pointer = nullptr; QVector m_oldPointers; + Touch* m_touch = nullptr; + QVector m_oldTouchs; + Keyboard* m_keyboard = nullptr; QVector m_oldKeyboards; @@ -259,8 +263,8 @@ protected: } void seat_get_pointer(Resource *resource, uint32_t id) override; + void seat_get_touch(Resource *resource, uint32_t id) override; void seat_get_keyboard(Resource *resource, uint32_t id) override; -// void seat_get_touch(Resource *resource, uint32_t id) override; // void seat_release(Resource *resource) override; }; @@ -307,6 +311,14 @@ public: Surface *m_surface = nullptr; }; +class Touch : public QObject, public QtWaylandServer::wl_touch +{ + Q_OBJECT +public: + explicit Touch(Seat *seat) : m_seat(seat) {} + Seat *m_seat = nullptr; +}; + class Keyboard : public QObject, public QtWaylandServer::wl_keyboard { Q_OBJECT diff --git a/tests/auto/wayland/shared/mockcompositor.cpp b/tests/auto/wayland/shared/mockcompositor.cpp index 6b9af4295b8..5f2d89078e5 100644 --- a/tests/auto/wayland/shared/mockcompositor.cpp +++ b/tests/auto/wayland/shared/mockcompositor.cpp @@ -41,7 +41,7 @@ DefaultCompositor::DefaultCompositor() add(); auto *output = add(); output->m_data.physicalSize = output->m_data.mode.physicalSizeForDpi(96); - add(Seat::capability_pointer | Seat::capability_keyboard); + add(Seat::capability_pointer | Seat::capability_keyboard | Seat::capability_touch); add(); add(); // TODO: other shells, viewporter, xdgoutput etc diff --git a/tests/auto/wayland/shared/mockcompositor.h b/tests/auto/wayland/shared/mockcompositor.h index aa85a4aeace..3cb9b337c7c 100644 --- a/tests/auto/wayland/shared/mockcompositor.h +++ b/tests/auto/wayland/shared/mockcompositor.h @@ -60,6 +60,7 @@ public: XdgToplevel *xdgToplevel(int i = 0) { return get()->toplevel(i); } XdgPopup *xdgPopup(int i = 0) { return get()->popup(i); } Pointer *pointer() { auto *seat = get(); Q_ASSERT(seat); return seat->m_pointer; } + Touch *touch() { auto *seat = get(); Q_ASSERT(seat); return seat->m_touch; } Surface *cursorSurface() { auto *p = pointer(); return p ? p->cursorSurface() : nullptr; } Keyboard *keyboard() { auto *seat = get(); Q_ASSERT(seat); return seat->m_keyboard; } uint sendXdgShellPing(); From 0d745e8b28e6f1b1d731390095ec15db7617cc81 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Tue, 20 Aug 2019 14:12:51 +0200 Subject: [PATCH 0739/1507] Client: Don't try to disconnect destroy handler from destroyed objects Gets rid of warning about disconnecting null objects on application exit. Change-Id: Ie96d4321dfab113622d7059f6849acf15715dfa2 Reviewed-by: Pier Luigi Fiorini --- src/plugins/platforms/wayland/qwaylandinputdevice.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index 65f80f308bb..8aa0239d079 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -789,8 +789,10 @@ void QWaylandInputDevice::Pointer::pointer_button(uint32_t serial, uint32_t time void QWaylandInputDevice::Pointer::invalidateFocus() { - disconnect(mFocus.data(), &QObject::destroyed, this, &Pointer::handleFocusDestroyed); - mFocus = nullptr; + if (mFocus) { + disconnect(mFocus.data(), &QObject::destroyed, this, &Pointer::handleFocusDestroyed); + mFocus = nullptr; + } mEnterSerial = 0; } From 68bbf5fd1c9dcd07a9b37c51a6beb46a7e98227b Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Fri, 23 Aug 2019 09:25:56 +0200 Subject: [PATCH 0740/1507] Client tests: Add test for a simple wl_touch tap Change-Id: I35aec950da0ac0d10cf1fa0c4bc1f56ba232cf89 Reviewed-by: Paul Olav Tvete --- tests/auto/wayland/seatv5/tst_seatv5.cpp | 60 ++++++++++++++++++++++ tests/auto/wayland/shared/coreprotocol.cpp | 34 ++++++++++++ tests/auto/wayland/shared/coreprotocol.h | 4 ++ 3 files changed, 98 insertions(+) diff --git a/tests/auto/wayland/seatv5/tst_seatv5.cpp b/tests/auto/wayland/seatv5/tst_seatv5.cpp index c2b1b0e4b4d..76a68b86f04 100644 --- a/tests/auto/wayland/seatv5/tst_seatv5.cpp +++ b/tests/auto/wayland/seatv5/tst_seatv5.cpp @@ -67,6 +67,7 @@ private slots: // Touch tests void createsTouch(); + void singleTap(); }; void tst_seatv5::bindsToSeat() @@ -387,5 +388,64 @@ void tst_seatv5::createsTouch() QCOMPOSITOR_TRY_COMPARE(touch()->resourceMap().first()->version(), 5); } +class TouchWindow : public QRasterWindow { +public: + TouchWindow() + { + resize(64, 64); + show(); + } + void touchEvent(QTouchEvent *event) override + { + QRasterWindow::touchEvent(event); + m_events.append(Event{event}); + } + struct Event // Because I didn't find a convenient way to copy it entirely + { + explicit Event() = default; + explicit Event(const QTouchEvent *event) + : type(event->type()) + , touchPointStates(event->touchPointStates()) + , touchPoints(event->touchPoints()) + { + } + const QEvent::Type type{}; + const Qt::TouchPointStates touchPointStates{}; + const QList touchPoints; + }; + QVector m_events; +}; + +void tst_seatv5::singleTap() +{ + TouchWindow window; + QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial); + + exec([=] { + auto *t = touch(); + auto *c = client(); + t->sendDown(xdgToplevel()->surface(), {32, 32}, 1); + t->sendFrame(c); + t->sendUp(c, 1); + t->sendFrame(c); + }); + + QTRY_VERIFY(!window.m_events.empty()); + { + auto e = window.m_events.takeFirst(); + QCOMPARE(e.type, QEvent::TouchBegin); + QCOMPARE(e.touchPointStates, Qt::TouchPointState::TouchPointPressed); + QCOMPARE(e.touchPoints.length(), 1); + QCOMPARE(e.touchPoints.first().pos(), QPointF(32-window.frameMargins().left(), 32-window.frameMargins().top())); + } + { + auto e = window.m_events.takeFirst(); + QCOMPARE(e.type, QEvent::TouchEnd); + QCOMPARE(e.touchPointStates, Qt::TouchPointState::TouchPointReleased); + QCOMPARE(e.touchPoints.length(), 1); + QCOMPARE(e.touchPoints.first().pos(), QPointF(32-window.frameMargins().left(), 32-window.frameMargins().top())); + } +} + QCOMPOSITOR_TEST_MAIN(tst_seatv5) #include "tst_seatv5.moc" diff --git a/tests/auto/wayland/shared/coreprotocol.cpp b/tests/auto/wayland/shared/coreprotocol.cpp index 006c4a80bde..120c256c653 100644 --- a/tests/auto/wayland/shared/coreprotocol.cpp +++ b/tests/auto/wayland/shared/coreprotocol.cpp @@ -397,6 +397,40 @@ void Pointer::pointer_set_cursor(Resource *resource, uint32_t serial, wl_resourc emit setCursor(serial); } +uint Touch::sendDown(Surface *surface, const QPointF &position, int id) +{ + wl_fixed_t x = wl_fixed_from_double(position.x()); + wl_fixed_t y = wl_fixed_from_double(position.y()); + uint serial = m_seat->m_compositor->nextSerial(); + auto time = m_seat->m_compositor->currentTimeMilliseconds(); + wl_client *client = surface->resource()->client(); + + const auto touchResources = resourceMap().values(client); + for (auto *r : touchResources) + wl_touch::send_down(r->handle, serial, time, surface->resource()->handle, id, x, y); + + return serial; +} + +uint Touch::sendUp(wl_client *client, int id) +{ + uint serial = m_seat->m_compositor->nextSerial(); + auto time = m_seat->m_compositor->currentTimeMilliseconds(); + + const auto touchResources = resourceMap().values(client); + for (auto *r : touchResources) + wl_touch::send_up(r->handle, serial, time, id); + + return serial; +} + +void Touch::sendFrame(wl_client *client) +{ + const auto touchResources = resourceMap().values(client); + for (auto *r : touchResources) + send_frame(r->handle); +} + uint Keyboard::sendEnter(Surface *surface) { auto serial = m_seat->m_compositor->nextSerial(); diff --git a/tests/auto/wayland/shared/coreprotocol.h b/tests/auto/wayland/shared/coreprotocol.h index 6905ab5d54b..50812c29658 100644 --- a/tests/auto/wayland/shared/coreprotocol.h +++ b/tests/auto/wayland/shared/coreprotocol.h @@ -316,6 +316,10 @@ class Touch : public QObject, public QtWaylandServer::wl_touch Q_OBJECT public: explicit Touch(Seat *seat) : m_seat(seat) {} + uint sendDown(Surface *surface, const QPointF &position, int id); + uint sendUp(wl_client *client, int id); + void sendFrame(wl_client *client); + Seat *m_seat = nullptr; }; From 93985ff12678e1b818058805d004528e93ee0734 Mon Sep 17 00:00:00 2001 From: Sona Kurazyan Date: Mon, 26 Aug 2019 13:35:14 +0200 Subject: [PATCH 0741/1507] Remove usages of deprecated APIs of QWheelEvent - Replaced the usages of deprecated QWheelEvent::delta() and QWheelEvent::orientation() with QWheelEvent::angleDelta(). - Removed the tests for deprecated APIs. Task-number: QTBUG-76491 Change-Id: I2f9a53d3236bce8ba6cee66ec1b0b933d50518aa Reviewed-by: Johan Helsing --- tests/auto/wayland/seatv4/tst_seatv4.cpp | 26 +++++------------ tests/auto/wayland/seatv5/tst_seatv5.cpp | 36 +++++++----------------- 2 files changed, 17 insertions(+), 45 deletions(-) diff --git a/tests/auto/wayland/seatv4/tst_seatv4.cpp b/tests/auto/wayland/seatv4/tst_seatv4.cpp index 77304deafb3..40f8742a2fb 100644 --- a/tests/auto/wayland/seatv4/tst_seatv4.cpp +++ b/tests/auto/wayland/seatv4/tst_seatv4.cpp @@ -212,22 +212,20 @@ void tst_seatv4::simpleAxis_data() { QTest::addColumn("axis"); QTest::addColumn("value"); - QTest::addColumn("orientation"); QTest::addColumn("angleDelta"); // Directions in regular windows/linux terms (no "natural" scrolling) - QTest::newRow("down") << uint(Pointer::axis_vertical_scroll) << 1.0 << Qt::Vertical << QPoint{0, -12}; - QTest::newRow("up") << uint(Pointer::axis_vertical_scroll) << -1.0 << Qt::Vertical << QPoint{0, 12}; - QTest::newRow("left") << uint(Pointer::axis_horizontal_scroll) << 1.0 << Qt::Horizontal << QPoint{-12, 0}; - QTest::newRow("right") << uint(Pointer::axis_horizontal_scroll) << -1.0 << Qt::Horizontal << QPoint{12, 0}; - QTest::newRow("up big") << uint(Pointer::axis_vertical_scroll) << -10.0 << Qt::Vertical << QPoint{0, 120}; + QTest::newRow("down") << uint(Pointer::axis_vertical_scroll) << 1.0 << QPoint{0, -12}; + QTest::newRow("up") << uint(Pointer::axis_vertical_scroll) << -1.0 << QPoint{0, 12}; + QTest::newRow("left") << uint(Pointer::axis_horizontal_scroll) << 1.0 << QPoint{-12, 0}; + QTest::newRow("right") << uint(Pointer::axis_horizontal_scroll) << -1.0 << QPoint{12, 0}; + QTest::newRow("up big") << uint(Pointer::axis_vertical_scroll) << -10.0 << QPoint{0, 120}; } void tst_seatv4::simpleAxis() { QFETCH(uint, axis); QFETCH(qreal, value); - QFETCH(Qt::Orientation, orientation); QFETCH(QPoint, angleDelta); class WheelWindow : QRasterWindow { @@ -256,27 +254,18 @@ void tst_seatv4::simpleAxis() // We didn't press any buttons QCOMPARE(event->buttons(), Qt::NoButton); - if (event->orientation() == Qt::Horizontal) - QCOMPARE(event->delta(), event->angleDelta().x()); - else - QCOMPARE(event->delta(), event->angleDelta().y()); - // There has been no information about what created the event. // Documentation says not synthesized is appropriate in such cases QCOMPARE(event->source(), Qt::MouseEventNotSynthesized); - m_events.append(Event(event->pixelDelta(), event->angleDelta(), event->orientation())); + m_events.append(Event{event->pixelDelta(), event->angleDelta()}); } struct Event // Because I didn't find a convenient way to copy it entirely { - // TODO: Constructors can be removed when we start supporting brace-initializers Event() = default; - Event(const QPoint &pixelDelta, const QPoint &angleDelta, Qt::Orientation orientation) - : pixelDelta(pixelDelta), angleDelta(angleDelta), orientation(orientation) - {} + const QPoint pixelDelta; const QPoint angleDelta; // eights of a degree, positive is upwards, left - const Qt::Orientation orientation{}; }; QVector m_events; }; @@ -299,7 +288,6 @@ void tst_seatv4::simpleAxis() QTRY_COMPARE(window.m_events.size(), 1); auto event = window.m_events.takeFirst(); QCOMPARE(event.angleDelta, angleDelta); - QCOMPARE(event.orientation, orientation); } void tst_seatv4::invalidPointerEvents() diff --git a/tests/auto/wayland/seatv5/tst_seatv5.cpp b/tests/auto/wayland/seatv5/tst_seatv5.cpp index 76a68b86f04..ca8de31acb1 100644 --- a/tests/auto/wayland/seatv5/tst_seatv5.cpp +++ b/tests/auto/wayland/seatv5/tst_seatv5.cpp @@ -127,12 +127,8 @@ public: QRasterWindow::wheelEvent(event); // qDebug() << event << "angleDelta" << event->angleDelta() << "pixelDelta" << event->pixelDelta(); - if (event->phase() == Qt::ScrollUpdate || event->phase() == Qt::NoScrollPhase) { - // Angle delta should always be provided (says docs, but QPA sends compatibility events - // for Qt4 with zero angleDelta, and with a delta) - QVERIFY(!event->angleDelta().isNull() || event->delta()); - } else { - // Shouldn't have deltas in the other phases + if (event->phase() != Qt::ScrollUpdate && event->phase() != Qt::NoScrollPhase) { + // Shouldn't have deltas in the these phases QCOMPARE(event->angleDelta(), QPoint(0, 0)); QCOMPARE(event->pixelDelta(), QPoint(0, 0)); } @@ -144,13 +140,6 @@ public: // We didn't press any buttons QCOMPARE(event->buttons(), Qt::NoButton); - if (!event->angleDelta().isNull()) { - if (event->orientation() == Qt::Horizontal) - QCOMPARE(event->delta(), event->angleDelta().x()); - else - QCOMPARE(event->delta(), event->angleDelta().y()); - } - m_events.append(Event{event}); } struct Event // Because I didn't find a convenient way to copy it entirely @@ -160,14 +149,12 @@ public: : phase(event->phase()) , pixelDelta(event->pixelDelta()) , angleDelta(event->angleDelta()) - , orientation(event->orientation()) , source(event->source()) { } const Qt::ScrollPhase phase{}; const QPoint pixelDelta; const QPoint angleDelta; // eights of a degree, positive is upwards, left - const Qt::Orientation orientation{}; const Qt::MouseEventSource source{}; }; QVector m_events; @@ -177,22 +164,20 @@ void tst_seatv5::simpleAxis_data() { QTest::addColumn("axis"); QTest::addColumn("value"); - QTest::addColumn("orientation"); QTest::addColumn("angleDelta"); // Directions in regular windows/linux terms (no "natural" scrolling) - QTest::newRow("down") << uint(Pointer::axis_vertical_scroll) << 1.0 << Qt::Vertical << QPoint{0, -12}; - QTest::newRow("up") << uint(Pointer::axis_vertical_scroll) << -1.0 << Qt::Vertical << QPoint{0, 12}; - QTest::newRow("left") << uint(Pointer::axis_horizontal_scroll) << 1.0 << Qt::Horizontal << QPoint{-12, 0}; - QTest::newRow("right") << uint(Pointer::axis_horizontal_scroll) << -1.0 << Qt::Horizontal << QPoint{12, 0}; - QTest::newRow("up big") << uint(Pointer::axis_vertical_scroll) << -10.0 << Qt::Vertical << QPoint{0, 120}; + QTest::newRow("down") << uint(Pointer::axis_vertical_scroll) << 1.0 << QPoint{0, -12}; + QTest::newRow("up") << uint(Pointer::axis_vertical_scroll) << -1.0 << QPoint{0, 12}; + QTest::newRow("left") << uint(Pointer::axis_horizontal_scroll) << 1.0 << QPoint{-12, 0}; + QTest::newRow("right") << uint(Pointer::axis_horizontal_scroll) << -1.0 << QPoint{12, 0}; + QTest::newRow("up big") << uint(Pointer::axis_vertical_scroll) << -10.0 << QPoint{0, 120}; } void tst_seatv5::simpleAxis() { QFETCH(uint, axis); QFETCH(qreal, value); - QFETCH(Qt::Orientation, orientation); QFETCH(QPoint, angleDelta); WheelWindow window; @@ -219,7 +204,6 @@ void tst_seatv5::simpleAxis() // There has been no information about what created the event. // Documentation says not synthesized is appropriate in such cases QCOMPARE(e.source, Qt::MouseEventNotSynthesized); - QCOMPARE(e.orientation, orientation); QCOMPARE(e.angleDelta, angleDelta); } @@ -262,7 +246,7 @@ void tst_seatv5::fingerScroll() { auto e = window.m_events.takeFirst(); QCOMPARE(e.phase, Qt::ScrollUpdate); - QCOMPARE(e.orientation, Qt::Vertical); + QVERIFY(qAbs(e.angleDelta.x()) <= qAbs(e.angleDelta.y())); // Vertical scroll // QCOMPARE(e.angleDelta, angleDelta); // TODO: what should this be? QCOMPARE(e.pixelDelta, QPoint(0, 10)); QCOMPARE(e.source, Qt::MouseEventSynthesizedBySystem); // A finger is not a wheel @@ -280,7 +264,7 @@ void tst_seatv5::fingerScroll() { auto e = window.m_events.takeFirst(); QCOMPARE(e.phase, Qt::ScrollUpdate); - QCOMPARE(e.orientation, Qt::Horizontal); + QVERIFY(qAbs(e.angleDelta.x()) > qAbs(e.angleDelta.y())); // Horizontal scroll QCOMPARE(e.pixelDelta, QPoint(10, 0)); QCOMPARE(e.source, Qt::MouseEventSynthesizedBySystem); // A finger is not a wheel } @@ -372,7 +356,7 @@ void tst_seatv5::wheelDiscreteScroll() { auto e = window.m_events.takeFirst(); QCOMPARE(e.phase, Qt::NoScrollPhase); - QCOMPARE(e.orientation, Qt::Vertical); + QVERIFY(qAbs(e.angleDelta.x()) <= qAbs(e.angleDelta.y())); // Vertical scroll // According to the docs the angle delta is in eights of a degree and most mice have // 1 click = 15 degrees. The angle delta should therefore be: // 15 degrees / (1/8 eights per degrees) = 120 eights of degrees. From 928a81ec1333db3608a731a96a0aee8ff32320ff Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Wed, 28 Aug 2019 11:13:55 +0200 Subject: [PATCH 0742/1507] Client tests: Set XDG_CURRENT_DESKTOP to avoid platform themes If the client tests are run from within a desktop environment, the XDG_CURRENT_DESKTOP variable may be set, causing the client to try to load a platform theme for the user's desktop. The tests, however, are running against a mock Wayland compositor, so launching a platform theme that expects to connect to a certain compositor implementation is probably not a good idea. And furthermore, if the gtk3 platform theme is used, it will start binding to interfaces and create wayland objects, confusing our existing test code. Setting XDG_CURRENT_DESKTOP to qtwaylandtests will prevent detection of the (outer) desktop environment, making tests more predictable. Change-Id: I57fa76e51cecdd0cbe8be6bd075ce67e9d2892bc Reviewed-by: David Edmundson Reviewed-by: Paul Olav Tvete --- tests/auto/wayland/shared/mockcompositor.h | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/auto/wayland/shared/mockcompositor.h b/tests/auto/wayland/shared/mockcompositor.h index 75ef1eaea1d..05bf32c8d50 100644 --- a/tests/auto/wayland/shared/mockcompositor.h +++ b/tests/auto/wayland/shared/mockcompositor.h @@ -78,6 +78,7 @@ public: int main(int argc, char **argv) \ { \ setenv("XDG_RUNTIME_DIR", ".", 1); \ + setenv("XDG_CURRENT_DESKTOP", "qtwaylandtests", 1); \ setenv("QT_QPA_PLATFORM", "wayland", 1); \ test tc; \ QGuiApplication app(argc, argv); \ From 59486fdf3ba485524a16578a5b76051f2f8c0026 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Wed, 21 Aug 2019 13:44:05 +0200 Subject: [PATCH 0743/1507] Client: Don't freeze in QDrag::exec if there was no drag focus 002fade6 fixed a crash when starting a drag without a valid focus, but there is still a problem, because QDrag::exec will never return because it's waiting indefinitely in an event loop. - QWaylandDataDevice::startDrag can now fail by returning false. - When starting a drag fails, we cancel the drag through QWaylandDrag::cancelDrag wrapped in invokeMethod. - Also, don't unnecessarily create a data_source if we cannot start a drag. [ChangeLog][QPA plugin] Fixed a freeze that happened when starting a drag-and-drop operation without a valid source surface. Change-Id: Iea19b0c92c196a44d1274a966bee4ff519632d34 Reviewed-by: Paul Olav Tvete --- .../platforms/wayland/qwaylanddatadevice.cpp | 17 ++++++++++------- .../platforms/wayland/qwaylanddatadevice_p.h | 2 +- src/plugins/platforms/wayland/qwaylanddnd.cpp | 9 +++++++-- 3 files changed, 18 insertions(+), 10 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylanddatadevice.cpp b/src/plugins/platforms/wayland/qwaylanddatadevice.cpp index 6b2a408eb19..990f92ba9fc 100644 --- a/src/plugins/platforms/wayland/qwaylanddatadevice.cpp +++ b/src/plugins/platforms/wayland/qwaylanddatadevice.cpp @@ -102,19 +102,22 @@ QWaylandDataOffer *QWaylandDataDevice::dragOffer() const return m_dragOffer.data(); } -void QWaylandDataDevice::startDrag(QMimeData *mimeData, QWaylandWindow *icon) +bool QWaylandDataDevice::startDrag(QMimeData *mimeData, QWaylandWindow *icon) { - m_dragSource.reset(new QWaylandDataSource(m_display->dndSelectionHandler(), mimeData)); - connect(m_dragSource.data(), &QWaylandDataSource::cancelled, this, &QWaylandDataDevice::dragSourceCancelled); - QWaylandWindow *origin = m_display->currentInputDevice()->pointerFocus(); if (!origin) origin = m_display->currentInputDevice()->touchFocus(); - if (origin) - start_drag(m_dragSource->object(), origin->object(), icon->object(), m_display->currentInputDevice()->serial()); - else + if (!origin) { qCDebug(lcQpaWayland) << "Couldn't start a drag because the origin window could not be found."; + return false; + } + + m_dragSource.reset(new QWaylandDataSource(m_display->dndSelectionHandler(), mimeData)); + connect(m_dragSource.data(), &QWaylandDataSource::cancelled, this, &QWaylandDataDevice::dragSourceCancelled); + + start_drag(m_dragSource->object(), origin->object(), icon->object(), m_display->currentInputDevice()->serial()); + return true; } void QWaylandDataDevice::cancelDrag() diff --git a/src/plugins/platforms/wayland/qwaylanddatadevice_p.h b/src/plugins/platforms/wayland/qwaylanddatadevice_p.h index 0a7f42538da..16c3ad28e44 100644 --- a/src/plugins/platforms/wayland/qwaylanddatadevice_p.h +++ b/src/plugins/platforms/wayland/qwaylanddatadevice_p.h @@ -89,7 +89,7 @@ public: #if QT_CONFIG(draganddrop) QWaylandDataOffer *dragOffer() const; - void startDrag(QMimeData *mimeData, QWaylandWindow *icon); + bool startDrag(QMimeData *mimeData, QWaylandWindow *icon); void cancelDrag(); #endif diff --git a/src/plugins/platforms/wayland/qwaylanddnd.cpp b/src/plugins/platforms/wayland/qwaylanddnd.cpp index b01a9db3614..6535aa16be1 100644 --- a/src/plugins/platforms/wayland/qwaylanddnd.cpp +++ b/src/plugins/platforms/wayland/qwaylanddnd.cpp @@ -66,8 +66,13 @@ void QWaylandDrag::startDrag() { QBasicDrag::startDrag(); QWaylandWindow *icon = static_cast(shapedPixmapWindow()->handle()); - m_display->currentInputDevice()->dataDevice()->startDrag(drag()->mimeData(), icon); - icon->addAttachOffset(-drag()->hotSpot()); + if (m_display->currentInputDevice()->dataDevice()->startDrag(drag()->mimeData(), icon)) { + icon->addAttachOffset(-drag()->hotSpot()); + } else { + // Cancelling immediately does not work, since the event loop for QDrag::exec is started + // after this function returns. + QMetaObject::invokeMethod(this, [this](){ cancelDrag(); }, Qt::QueuedConnection); + } } void QWaylandDrag::cancel() From 84acc4a4e9da1b7a691fd95af2872cda2ccdc648 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Mon, 19 Aug 2019 13:46:08 +0200 Subject: [PATCH 0744/1507] Client: Refactor touch handling and fix various bugs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Rename mTouchPoints to mPendingTouchPoints, to clarify that they're the accumulated state so far, which will be applied with the wl_touch.frame event. QWaylandInputDevice::Touch::mPrevTouchPoints is no longer needed and has been removed. Fixes the following issues with the old approach: - touchPointsReleased() only checked mTouchPoints, which was cleared on touch_frame and populated again on touch_motion and touch_down, which meant that it could return true even though there were still touch points left. Leading to the workaround for missing wl_touch.frame events on Weston being triggered to often. - Touch focus was cleared on any wl_touch.up event, not just the last one. - The order of the touch events was not stable and relied on the order of the events (QTBUG-77014). Fixes: QTBUG-77014 Change-Id: Ic3ecdc87e77b0e0276afefd127ad2b965142cbd4 Reviewed-by: Jan Arve Sæther Reviewed-by: Shawn Rutledge --- .../platforms/wayland/qwaylandinputdevice.cpp | 102 ++++++++---------- .../platforms/wayland/qwaylandinputdevice_p.h | 3 +- 2 files changed, 45 insertions(+), 60 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index 495f258ded9..6016589a6ef 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -874,15 +874,20 @@ void QWaylandInputDevice::Touch::touch_up(uint32_t serial, uint32_t time, int32_ { Q_UNUSED(serial); Q_UNUSED(time); - mFocus = nullptr; mParent->handleTouchPoint(id, 0, 0, Qt::TouchPointReleased); - // As of Weston 1.5.90 there is no touch_frame after the last touch_up - // (i.e. when the last finger is released). To accommodate for this, issue a - // touch_frame. This cannot hurt since it is safe to call the touch_frame - // handler multiple times when there are no points left. - if (allTouchPointsReleased()) + if (allTouchPointsReleased()) { + mFocus = nullptr; + + // As of Weston 7.0.0 there is no touch_frame after the last touch_up + // (i.e. when the last finger is released). To accommodate for this, issue a + // touch_frame. This cannot hurt since it is safe to call the touch_frame + // handler multiple times when there are no points left. + // See: https://gitlab.freedesktop.org/wayland/weston/issues/44 + // TODO: change logging category to lcQpaWaylandInput in newer versions. + qCDebug(lcQpaWayland, "Generating fake frame event to work around Weston bug"); touch_frame(); + } } void QWaylandInputDevice::Touch::touch_motion(uint32_t time, int32_t id, wl_fixed_t x, wl_fixed_t y) @@ -893,8 +898,7 @@ void QWaylandInputDevice::Touch::touch_motion(uint32_t time, int32_t id, wl_fixe void QWaylandInputDevice::Touch::touch_cancel() { - mPrevTouchPoints.clear(); - mTouchPoints.clear(); + mPendingTouchPoints.clear(); QWaylandTouchExtension *touchExt = mParent->mQDisplay->touchExtension(); if (touchExt) @@ -905,19 +909,16 @@ void QWaylandInputDevice::Touch::touch_cancel() void QWaylandInputDevice::handleTouchPoint(int id, double x, double y, Qt::TouchPointState state) { - QWindowSystemInterface::TouchPoint tp; + auto end = mTouch->mPendingTouchPoints.end(); + auto it = std::find_if(mTouch->mPendingTouchPoints.begin(), end, [id](auto tp){ return tp.id == id; }); + if (it == end) { + it = mTouch->mPendingTouchPoints.insert(end, QWindowSystemInterface::TouchPoint()); + it->id = id; + } + QWindowSystemInterface::TouchPoint &tp = *it; - // Find out the coordinates for Released events. - bool coordsOk = false; - if (state == Qt::TouchPointReleased) - for (int i = 0; i < mTouch->mPrevTouchPoints.count(); ++i) - if (mTouch->mPrevTouchPoints.at(i).id == id) { - tp.area = mTouch->mPrevTouchPoints.at(i).area; - coordsOk = true; - break; - } - - if (!coordsOk) { + // Only moved and pressed needs to update/set position + if (state == Qt::TouchPointMoved || state == Qt::TouchPointPressed) { // x and y are surface relative. // We need a global (screen) position. QWaylandWindow *win = mTouch->mFocus; @@ -936,59 +937,37 @@ void QWaylandInputDevice::handleTouchPoint(int id, double x, double y, Qt::Touch } tp.state = state; - tp.id = id; tp.pressure = tp.state == Qt::TouchPointReleased ? 0 : 1; - mTouch->mTouchPoints.append(tp); } bool QWaylandInputDevice::Touch::allTouchPointsReleased() { - for (int i = 0; i < mTouchPoints.count(); ++i) - if (mTouchPoints.at(i).state != Qt::TouchPointReleased) + for (const auto &tp : qAsConst(mPendingTouchPoints)) { + if (tp.state != Qt::TouchPointReleased) return false; - + } return true; } void QWaylandInputDevice::Touch::releasePoints() { - Q_FOREACH (const QWindowSystemInterface::TouchPoint &previousPoint, mPrevTouchPoints) { - QWindowSystemInterface::TouchPoint tp = previousPoint; + if (mPendingTouchPoints.empty()) + return; + + for (QWindowSystemInterface::TouchPoint &tp : mPendingTouchPoints) tp.state = Qt::TouchPointReleased; - mTouchPoints.append(tp); - } + touch_frame(); } void QWaylandInputDevice::Touch::touch_frame() { - // Copy all points, that are in the previous but not in the current list, as stationary. - for (int i = 0; i < mPrevTouchPoints.count(); ++i) { - const QWindowSystemInterface::TouchPoint &prevPoint(mPrevTouchPoints.at(i)); - if (prevPoint.state == Qt::TouchPointReleased) - continue; - bool found = false; - for (int j = 0; j < mTouchPoints.count(); ++j) - if (mTouchPoints.at(j).id == prevPoint.id) { - found = true; - break; - } - if (!found) { - QWindowSystemInterface::TouchPoint p = prevPoint; - p.state = Qt::TouchPointStationary; - mTouchPoints.append(p); - } - } - - if (mTouchPoints.isEmpty()) { - mPrevTouchPoints.clear(); - return; - } + // TODO: early return if no events? QWindow *window = mFocus ? mFocus->window() : nullptr; if (mFocus) { - const QWindowSystemInterface::TouchPoint &tp = mTouchPoints.last(); + const QWindowSystemInterface::TouchPoint &tp = mPendingTouchPoints.last(); // When the touch event is received, the global pos is calculated with the margins // in mind. Now we need to adjust again to get the correct local pos back. QMargins margins = window->frameMargins(); @@ -997,14 +976,21 @@ void QWaylandInputDevice::Touch::touch_frame() if (mFocus->touchDragDecoration(mParent, localPos, tp.area.center(), tp.state, mParent->modifiers())) return; } - QWindowSystemInterface::handleTouchEvent(window, mParent->mTouchDevice, mTouchPoints); - if (allTouchPointsReleased()) - mPrevTouchPoints.clear(); - else - mPrevTouchPoints = mTouchPoints; + QWindowSystemInterface::handleTouchEvent(window, mParent->mTouchDevice, mPendingTouchPoints); + + // Prepare state for next frame + const auto prevTouchPoints = mPendingTouchPoints; + mPendingTouchPoints.clear(); + for (const auto &prevPoint: prevTouchPoints) { + // All non-released touch points should be part of the next touch event + if (prevPoint.state != Qt::TouchPointReleased) { + QWindowSystemInterface::TouchPoint tp = prevPoint; + tp.state = Qt::TouchPointStationary; // ... as stationary (unless proven otherwise) + mPendingTouchPoints.append(tp); + } + } - mTouchPoints.clear(); } } diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h index 7aa86539b49..d9bae9836c7 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h +++ b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h @@ -304,8 +304,7 @@ public: QWaylandInputDevice *mParent = nullptr; QPointer mFocus; - QList mTouchPoints; - QList mPrevTouchPoints; + QList mPendingTouchPoints; }; class QWaylandPointerEvent From f199375e5cee3e115aa90f3bdf4105d94cc25c13 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Mon, 2 Sep 2019 10:45:20 +0200 Subject: [PATCH 0745/1507] Client: Fix crash on wl_pointer.up after destroying a window When wl_pointer version 5 was implemented, we added a raw QWaylandWindow pointer in QWaylandPointerEvent. This is a problem, because the events are stored, and the window may be deleted in the meantime. This manifested itself as flakiness in tst_xdgshell::popup() which is now fixed. Fixes: QTBUG-77976 Change-Id: If34eee0286d5a63734535d67503378516d5768c3 Reviewed-by: Paul Olav Tvete --- src/plugins/platforms/wayland/qwaylandinputdevice.cpp | 11 +++++++++-- src/plugins/platforms/wayland/qwaylandinputdevice_p.h | 2 +- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index 8aa0239d079..f2dee75e63c 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -1045,8 +1045,15 @@ void QWaylandInputDevice::Pointer::flushScrollEvent() void QWaylandInputDevice::Pointer::flushFrameEvent() { - if (mFrameData.event) { - mFrameData.event->surface->handleMouse(mParent, *mFrameData.event); + if (auto *event = mFrameData.event) { + if (auto window = event->surface) { + window->handleMouse(mParent, *event); + } else if (mFrameData.event->type == QWaylandPointerEvent::Type::Release) { + // If the window has been destroyed, we still need to report an up event, but it can't + // be handled by the destroyed window (obviously), so send the event here instead. + QWindowSystemInterface::handleMouseEvent(nullptr, event->timestamp, event->local, + event->global, event->buttons, event->modifiers); + } delete mFrameData.event; mFrameData.event = nullptr; } diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h index 4ac1dca3525..7fbb5667f70 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h +++ b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h @@ -446,7 +446,7 @@ public: QPoint pixelDelta; QPoint angleDelta; Qt::MouseEventSource source = Qt::MouseEventNotSynthesized; - QWaylandWindow *surface = nullptr; + QPointer surface; }; } From 47340e8c6f4b441f11ac6ec9496b64bc956d03be Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Fri, 24 May 2019 14:20:18 +0200 Subject: [PATCH 0746/1507] Add client test for xdg-decoration-unstable-v1 And verify that we don't create decorations prematurely. Change-Id: I621631f0c355529e5afb6a615f909f18c2a4b509 Reviewed-by: David Edmundson Reviewed-by: Paul Olav Tvete --- tests/auto/wayland/client.pro | 1 + .../xdgdecorationv1/tst_xdgdecorationv1.cpp | 186 ++++++++++++++++++ .../xdgdecorationv1/xdgdecorationv1.pro | 7 + 3 files changed, 194 insertions(+) create mode 100644 tests/auto/wayland/xdgdecorationv1/tst_xdgdecorationv1.cpp create mode 100644 tests/auto/wayland/xdgdecorationv1/xdgdecorationv1.pro diff --git a/tests/auto/wayland/client.pro b/tests/auto/wayland/client.pro index 051cb4e3d13..06c1cb8772a 100644 --- a/tests/auto/wayland/client.pro +++ b/tests/auto/wayland/client.pro @@ -9,6 +9,7 @@ SUBDIRS += \ seatv4 \ surface \ wl_connect \ + xdgdecorationv1 \ xdgoutput \ xdgshell \ xdgshellv6 diff --git a/tests/auto/wayland/xdgdecorationv1/tst_xdgdecorationv1.cpp b/tests/auto/wayland/xdgdecorationv1/tst_xdgdecorationv1.cpp new file mode 100644 index 00000000000..386713cf567 --- /dev/null +++ b/tests/auto/wayland/xdgdecorationv1/tst_xdgdecorationv1.cpp @@ -0,0 +1,186 @@ +/**************************************************************************** +** +** Copyright (C) 2018 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "mockcompositor.h" + +#include + +#include +#include +#include +#include + +#include + +using namespace MockCompositor; + +constexpr int xdgDecorationVersion = 1; // protocol VERSION, not the name suffix (_v1) + +class XdgDecorationManagerV1; +class XdgToplevelDecorationV1 : public QObject, public QtWaylandServer::zxdg_toplevel_decoration_v1 +{ + Q_OBJECT +public: + explicit XdgToplevelDecorationV1(XdgDecorationManagerV1 *manager, XdgToplevel *toplevel, int id, int version) + : zxdg_toplevel_decoration_v1(toplevel->resource()->client(), id, version) + , m_manager(manager) + , m_toplevel(toplevel) + { + } + void sendConfigure(mode mode) + { + if (!m_configureSent) { + // Attaching buffers before the configure is a protocol error + QVERIFY(!m_toplevel->surface()->m_pending.buffer); + QVERIFY(!m_toplevel->surface()->m_committed.buffer); + } + send_configure(mode); + m_configureSent = true; + } + void zxdg_toplevel_decoration_v1_destroy(Resource *resource) override + { + wl_resource_destroy(resource->handle); + } + void zxdg_toplevel_decoration_v1_destroy_resource(Resource *resource) override; + void zxdg_toplevel_decoration_v1_set_mode(Resource *resource, uint32_t mode) override + { + Q_UNUSED(resource); + m_unsetModeRequested = false; + m_requestedMode = XdgToplevelDecorationV1::mode(mode); + } + void zxdg_toplevel_decoration_v1_unset_mode(Resource *resource) override + { + Q_UNUSED(resource); + m_unsetModeRequested = true; + m_requestedMode = mode(0); + } + XdgDecorationManagerV1 *m_manager = nullptr; + XdgToplevel *m_toplevel = nullptr; + mode m_requestedMode = mode(0); + bool m_unsetModeRequested = false; + bool m_configureSent = false; +}; + +class XdgDecorationManagerV1 : public Global, public QtWaylandServer::zxdg_decoration_manager_v1 +{ + Q_OBJECT +public: + explicit XdgDecorationManagerV1(CoreCompositor *compositor, int version = 1) + : QtWaylandServer::zxdg_decoration_manager_v1(compositor->m_display, version) + , m_version(version) + {} + bool isClean() override { return m_decorations.empty(); } + XdgToplevelDecorationV1 *decorationFor(XdgToplevel *toplevel) + { + return m_decorations.value(toplevel, nullptr); + } + + int m_version = 1; // TODO: Remove on libwayland upgrade + QMap m_decorations; + +protected: + void zxdg_decoration_manager_v1_destroy(Resource *resource) override + { + //TODO: Should the decorations be destroyed at this point? + wl_resource_destroy(resource->handle); + } + + void zxdg_decoration_manager_v1_get_toplevel_decoration(Resource *resource, uint32_t id, ::wl_resource *toplevelResource) override + { + auto *toplevel = fromResource(toplevelResource); + QVERIFY(toplevel); + QVERIFY(!decorationFor(toplevel)); + + // Attaching buffers before the configure is a protocol error + QVERIFY(!toplevel->surface()->m_pending.buffer); + QVERIFY(!toplevel->surface()->m_committed.buffer); + + m_decorations[toplevel] = new XdgToplevelDecorationV1(this, toplevel, id, resource->version()); + } +}; + +void XdgToplevelDecorationV1::zxdg_toplevel_decoration_v1_destroy_resource(QtWaylandServer::zxdg_toplevel_decoration_v1::Resource *resource) +{ + Q_UNUSED(resource); + int removed = m_manager->m_decorations.remove(m_toplevel); + Q_ASSERT(removed == 1); + delete this; +} + +class XdgDecorationCompositor : public DefaultCompositor { +public: + explicit XdgDecorationCompositor() + { + exec([this] { + m_config.autoConfigure = true; + add(xdgDecorationVersion); + }); + } + XdgToplevelDecorationV1 *toplevelDecoration(int i = 0) { + return get()->decorationFor(xdgToplevel(i)); + } +}; + +class tst_xdgdecorationv1 : public QObject, private XdgDecorationCompositor +{ + Q_OBJECT +private slots: + void initTestCase(); + void cleanup() { QTRY_VERIFY2(isClean(), qPrintable(dirtyMessage())); } + void clientSidePreferredByCompositor(); +}; + +void tst_xdgdecorationv1::initTestCase() +{ + if (qEnvironmentVariableIntValue("QT_WAYLAND_DISABLE_WINDOWDECORATION")) + QSKIP("This test doesn't make sense when QT_WAYLAND_DISABLE_WINDOWDECORATION is set in the environment"); +} + +void tst_xdgdecorationv1::clientSidePreferredByCompositor() +{ + QRasterWindow window; + window.show(); + QCOMPOSITOR_TRY_COMPARE(get()->resourceMap().size(), 1); + QCOMPOSITOR_TRY_COMPARE(get()->resourceMap().first()->version(), xdgDecorationVersion); + QCOMPOSITOR_TRY_VERIFY(toplevelDecoration()); // The client creates a toplevel object + + // Check that we don't assume decorations before the server has configured them + QVERIFY(window.frameMargins().isNull()); + + QCOMPOSITOR_TRY_VERIFY(xdgToplevel()); + QCOMPOSITOR_TRY_VERIFY(toplevelDecoration()->m_unsetModeRequested); + QVERIFY(window.frameMargins().isNull()); // We're still waiting for a configure + exec([=] { + toplevelDecoration()->sendConfigure(XdgToplevelDecorationV1::mode_client_side); + xdgToplevel()->sendCompleteConfigure(); + }); + QTRY_VERIFY(!window.frameMargins().isNull()); +} + +QCOMPOSITOR_TEST_MAIN(tst_xdgdecorationv1) +#include "tst_xdgdecorationv1.moc" diff --git a/tests/auto/wayland/xdgdecorationv1/xdgdecorationv1.pro b/tests/auto/wayland/xdgdecorationv1/xdgdecorationv1.pro new file mode 100644 index 00000000000..0b553720582 --- /dev/null +++ b/tests/auto/wayland/xdgdecorationv1/xdgdecorationv1.pro @@ -0,0 +1,7 @@ +include (../shared/shared.pri) + +WAYLANDSERVERSOURCES += \ + $$PWD/../../../../src/3rdparty/protocol/xdg-decoration-unstable-v1.xml + +TARGET = tst_xdgdecorationv1 +SOURCES += tst_xdgdecorationv1.cpp From c357505f3a0bc1ac29ad30107075facd68dc1364 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Tue, 3 Sep 2019 07:50:26 +0200 Subject: [PATCH 0747/1507] Client: Adjust for window border when setting text-input cursor rect set_cursor_rectangle takes wl_surface coordinates, but we sent window coordinates. Fixes: QTBUG-77987 Change-Id: Ia0bf98f9749723128bec27c3c607d1ccde2d5fd3 Reviewed-by: Gatis Paeglis --- src/plugins/platforms/wayland/qwaylandinputcontext.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandinputcontext.cpp b/src/plugins/platforms/wayland/qwaylandinputcontext.cpp index c6f287ddaac..0f27f551d31 100644 --- a/src/plugins/platforms/wayland/qwaylandinputcontext.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputcontext.cpp @@ -119,7 +119,8 @@ void QWaylandTextInput::updateState(Qt::InputMethodQueries queries, uint32_t fla if (!QGuiApplication::focusWindow() || !QGuiApplication::focusWindow()->handle()) return; - struct ::wl_surface *surface = static_cast(QGuiApplication::focusWindow()->handle())->object(); + auto *window = static_cast(QGuiApplication::focusWindow()->handle()); + auto *surface = window->object(); if (!surface || (surface != m_surface)) return; @@ -157,8 +158,10 @@ void QWaylandTextInput::updateState(Qt::InputMethodQueries queries, uint32_t fla if (queries & Qt::ImCursorRectangle) { const QRect &cRect = event.value(Qt::ImCursorRectangle).toRect(); - const QRect &tRect = QGuiApplication::inputMethod()->inputItemTransform().mapRect(cRect); - set_cursor_rectangle(tRect.x(), tRect.y(), tRect.width(), tRect.height()); + const QRect &windowRect = QGuiApplication::inputMethod()->inputItemTransform().mapRect(cRect); + const QMargins margins = window->frameMargins(); + const QRect &surfaceRect = windowRect.translated(margins.left(), margins.top()); + set_cursor_rectangle(surfaceRect.x(), surfaceRect.y(), surfaceRect.width(), surfaceRect.height()); } if (queries & Qt::ImPreferredLanguage) { From 183018747164f94048205093538fdd4a88c9ff33 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Tue, 3 Sep 2019 08:22:44 +0200 Subject: [PATCH 0748/1507] Client: Don't spam stderr about ignored window states Since it is not supported by the protocol, neither we, nor the application developer can do anything about it. Change it from warning to debug so it only shows up when enabled. Task-number: QTBUG-76061 Change-Id: I81420e0c72a9e9652f6592d65c70c7df1e5725b9 Reviewed-by: Paul Olav Tvete Reviewed-by: Pier Luigi Fiorini --- .../shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp | 2 +- .../plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp index 980e4a601a4..99b478d98ba 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp @@ -342,7 +342,7 @@ void QWaylandXdgSurfaceV6::requestWindowStates(Qt::WindowStates states) if (m_toplevel) m_toplevel->requestWindowStates(states); else - qCWarning(lcQpaWayland) << "Non-toplevel surfaces can't request window states"; + qCDebug(lcQpaWayland) << "Ignoring window states requested by non-toplevel."; } void QWaylandXdgSurfaceV6::setToplevel() diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp index f55298134fe..026bb56a0e7 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp @@ -377,7 +377,7 @@ void QWaylandXdgSurface::requestWindowStates(Qt::WindowStates states) if (m_toplevel) m_toplevel->requestWindowStates(states); else - qCWarning(lcQpaWayland) << "Non-toplevel surfaces can't request window states"; + qCDebug(lcQpaWayland) << "Ignoring window states requested by non-toplevel zxdg_surface_v6."; } void QWaylandXdgSurface::setToplevel() From c3960e59979f3a71d6f1c1bef0bfcb4c0dc2153f Mon Sep 17 00:00:00 2001 From: Pavel Tumakaev Date: Wed, 31 Jul 2019 13:26:51 +0300 Subject: [PATCH 0749/1507] Fix deadlock in QWaylandWindow::waitForFrameSync Calling the QOpenGLContext::swapBuffers from QGuiApplicationPrivate::processExposeEvent in some cases leads to recursive calls of QWaylandWindow::waitForFrameSync. Since the mWaitingForFrameCallback check in WaylandWindow::waitForFrameSync is performed after the mutex is locked, the QMutexLocker tries to lock the mFrameSyncMutex mutex in every recursive call, that leads to a deadlock. This patch moves the performing of the mWaitingForFrameCallback check before locking the mutex. Change-Id: Ia2d834b7dd03fcd91bbe29a3a897b4db2d155527 Reviewed-by: Johan Helsing --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index abc54f58438..95358232316 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -657,10 +657,11 @@ QMutex QWaylandWindow::mFrameSyncMutex; bool QWaylandWindow::waitForFrameSync(int timeout) { - QMutexLocker locker(&mFrameSyncMutex); if (!mWaitingForFrameCallback) return true; + QMutexLocker locker(&mFrameSyncMutex); + wl_proxy_set_queue(reinterpret_cast(mFrameCallback), mFrameQueue); mDisplay->dispatchQueueWhile(mFrameQueue, [&]() { return mWaitingForFrameCallback; }, timeout); From dfe1739bda0d6e8031beba15cd4600d96bd3f045 Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Sat, 7 Sep 2019 11:41:49 +0200 Subject: [PATCH 0750/1507] Client: Disable key repeating when rate is set to 0 From the docs of repeat_info: "A rate of zero will disable any repeating (regardless of the value of delay)." Avoiding starting the initial timer effectively disables everything Change-Id: I7489f61b2bc0e000efddb4255f1968072eeff2b8 Reviewed-by: Johan Helsing --- src/plugins/platforms/wayland/qwaylandinputdevice.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index b5c18a07481..9ceb222d9d9 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -896,7 +896,7 @@ void QWaylandInputDevice::Keyboard::keyboard_key(uint32_t serial, uint32_t time, QEvent::Type type = isDown ? QEvent::KeyPress : QEvent::KeyRelease; handleKey(time, type, qtkey, modifiers, code, sym, mNativeModifiers, text); - if (state == WL_KEYBOARD_KEY_STATE_PRESSED && xkb_keymap_key_repeats(mXkbKeymap.get(), code)) { + if (state == WL_KEYBOARD_KEY_STATE_PRESSED && xkb_keymap_key_repeats(mXkbKeymap.get(), code) && mRepeatRate > 0) { mRepeatKey.key = qtkey; mRepeatKey.code = code; mRepeatKey.time = time; From 3b34e5f86d4c5a56ac1411c86fb0129d46d74464 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Fri, 14 Jun 2019 08:45:29 +0200 Subject: [PATCH 0751/1507] Client: Add test for starting a drag operation without input focus This used to crash the client. Task-number: QTBUG-76368 Change-Id: I855f3bda15b4b2bccbdb2aa8239e26c0eecf7cb3 Reviewed-by: Paul Olav Tvete --- .../wayland/datadevicev1/tst_datadevicev1.cpp | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/tests/auto/wayland/datadevicev1/tst_datadevicev1.cpp b/tests/auto/wayland/datadevicev1/tst_datadevicev1.cpp index fe68d520d59..7368829d13b 100644 --- a/tests/auto/wayland/datadevicev1/tst_datadevicev1.cpp +++ b/tests/auto/wayland/datadevicev1/tst_datadevicev1.cpp @@ -30,9 +30,8 @@ #include #include - -//TODO: move? #include +#include using namespace MockCompositor; @@ -60,6 +59,7 @@ private slots: void pasteUtf8(); void destroysPreviousSelection(); void destroysSelectionWithSurface(); + void dragWithoutFocus(); }; void tst_datadevicev1::initTestCase() @@ -209,5 +209,22 @@ void tst_datadevicev1::destroysSelectionWithSurface() QCOMPOSITOR_TRY_COMPARE(dataDevice()->m_sentSelectionOffers.size(), 0); } +// The application should not crash if it attempts to start a drag operation +// when it doesn't have input focus (QTBUG-76368) +void tst_datadevicev1::dragWithoutFocus() +{ + QRasterWindow window; + window.resize(64, 64); + window.show(); + QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial); + + auto *mimeData = new QMimeData; + const QByteArray data("testData"); + mimeData->setData("text/plain", data); + QDrag drag(&window); + drag.setMimeData(mimeData); + drag.exec(); +} + QCOMPOSITOR_TEST_MAIN(tst_datadevicev1) #include "tst_datadevicev1.moc" From c9994d46fe1fca08a66a70893ca0c7d53a90ab6c Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Wed, 4 Sep 2019 11:47:13 +0200 Subject: [PATCH 0752/1507] Client: Fix touch rounding errors Touch now accounts for fractional input in the same way as for pointer input. Task-number: QTBUG-77457 Change-Id: I18e633bf7c7033187a641f757b8b24f52479971a Reviewed-by: Paul Olav Tvete --- .../platforms/wayland/qwaylandinputdevice.cpp | 18 ++++++++++++------ .../platforms/wayland/qwaylandinputdevice_p.h | 2 +- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index 731285eab81..8f3df8e4dda 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -987,14 +987,15 @@ void QWaylandInputDevice::Touch::touch_down(uint32_t serial, mParent->mSerial = serial; mFocus = window; mParent->mQDisplay->setLastInputDevice(mParent, serial, mFocus); - mParent->handleTouchPoint(id, wl_fixed_to_double(x), wl_fixed_to_double(y), Qt::TouchPointPressed); + QPointF position(wl_fixed_to_double(x), wl_fixed_to_double(y)); + mParent->handleTouchPoint(id, Qt::TouchPointPressed, position); } void QWaylandInputDevice::Touch::touch_up(uint32_t serial, uint32_t time, int32_t id) { Q_UNUSED(serial); Q_UNUSED(time); - mParent->handleTouchPoint(id, 0, 0, Qt::TouchPointReleased); + mParent->handleTouchPoint(id, Qt::TouchPointReleased); if (allTouchPointsReleased()) { mFocus = nullptr; @@ -1013,7 +1014,8 @@ void QWaylandInputDevice::Touch::touch_up(uint32_t serial, uint32_t time, int32_ void QWaylandInputDevice::Touch::touch_motion(uint32_t time, int32_t id, wl_fixed_t x, wl_fixed_t y) { Q_UNUSED(time); - mParent->handleTouchPoint(id, wl_fixed_to_double(x), wl_fixed_to_double(y), Qt::TouchPointMoved); + QPointF position(wl_fixed_to_double(x), wl_fixed_to_double(y)); + mParent->handleTouchPoint(id, Qt::TouchPointMoved, position); } void QWaylandInputDevice::Touch::touch_cancel() @@ -1027,7 +1029,7 @@ void QWaylandInputDevice::Touch::touch_cancel() QWindowSystemInterface::handleTouchCancelEvent(nullptr, mParent->mTouchDevice); } -void QWaylandInputDevice::handleTouchPoint(int id, double x, double y, Qt::TouchPointState state) +void QWaylandInputDevice::handleTouchPoint(int id, Qt::TouchPointState state, const QPointF &surfacePosition) { auto end = mTouch->mPendingTouchPoints.end(); auto it = std::find_if(mTouch->mPendingTouchPoints.begin(), end, [id](auto tp){ return tp.id == id; }); @@ -1039,7 +1041,6 @@ void QWaylandInputDevice::handleTouchPoint(int id, double x, double y, Qt::Touch // Only moved and pressed needs to update/set position if (state == Qt::TouchPointMoved || state == Qt::TouchPointPressed) { - // x and y are surface relative. // We need a global (screen) position. QWaylandWindow *win = mTouch->mFocus; @@ -1053,7 +1054,12 @@ void QWaylandInputDevice::handleTouchPoint(int id, double x, double y, Qt::Touch tp.area = QRectF(0, 0, 8, 8); QMargins margins = win->frameMargins(); - tp.area.moveCenter(win->window()->mapToGlobal(QPoint(x - margins.left(), y - margins.top()))); + QPointF localPosition = surfacePosition - QPointF(margins.left(), margins.top()); + // TODO: This doesn't account for high dpi scaling for the delta, but at least it matches + // what we have for mouse input. + QPointF delta = localPosition - localPosition.toPoint(); + QPointF globalPosition = win->window()->mapToGlobal(localPosition.toPoint()) + delta; + tp.area.moveCenter(globalPosition); } tp.state = state; diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h index b0b02216196..143e1122099 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h +++ b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h @@ -167,7 +167,7 @@ private: uint32_t mSerial = 0; void seat_capabilities(uint32_t caps) override; - void handleTouchPoint(int id, double x, double y, Qt::TouchPointState state); + void handleTouchPoint(int id, Qt::TouchPointState state, const QPointF &surfacePosition = QPoint()); QTouchDevice *mTouchDevice = nullptr; From fea2383cf191763e74a2c79d0fb14c3cdda20091 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Wed, 4 Sep 2019 10:57:42 +0200 Subject: [PATCH 0753/1507] Add client test for floating point mouse press Change-Id: Ia7cfb1bc86945e08a2ff2c794afb405110e819f9 Reviewed-by: Paul Olav Tvete --- tests/auto/wayland/seatv4/tst_seatv4.cpp | 25 ++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/tests/auto/wayland/seatv4/tst_seatv4.cpp b/tests/auto/wayland/seatv4/tst_seatv4.cpp index 7dc2e727a6a..1d6fb6b9c36 100644 --- a/tests/auto/wayland/seatv4/tst_seatv4.cpp +++ b/tests/auto/wayland/seatv4/tst_seatv4.cpp @@ -72,6 +72,7 @@ private slots: void usesEnterSerial(); void focusDestruction(); void mousePress(); + void mousePressFloat(); void simpleAxis_data(); void simpleAxis(); void invalidPointerEvents(); @@ -207,6 +208,30 @@ void tst_seatv4::mousePress() QTRY_VERIFY(window.m_pressed); } +void tst_seatv4::mousePressFloat() +{ + class Window : public QRasterWindow { + public: + void mousePressEvent(QMouseEvent *e) override { m_position = e->localPos(); } + QPointF m_position; + }; + + Window window; + window.resize(64, 64); + window.show(); + QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial); + + exec([&] { + auto *surface = xdgSurface()->m_surface; + pointer()->sendEnter(surface, {32.75, 32.25}); + pointer()->sendButton(client(), BTN_LEFT, 1); + pointer()->sendButton(client(), BTN_LEFT, 0); + }); + QMargins m = window.frameMargins(); + QPointF pressedPosition(32.75 -m.left(), 32.25 - m.top()); + QTRY_COMPARE(window.m_position, pressedPosition); +} + void tst_seatv4::simpleAxis_data() { QTest::addColumn("axis"); From fe5f437f31745fc83555b5b5fb95181c0e2526f9 Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Wed, 11 Sep 2019 13:49:09 +0200 Subject: [PATCH 0754/1507] If egl_x11 is not available then don't turn on xcomposite-egl Since xcomposite-egl depends on the egl_x11 feature in qtbase, then this should be explicit. Change-Id: Ic1dce9526fb50f6f56e18abd58b69bcaed6d204e Reviewed-by: Paul Olav Tvete --- src/plugins/platforms/wayland/configure.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/configure.json b/src/plugins/platforms/wayland/configure.json index 7feeee4bfc2..91024c9d377 100644 --- a/src/plugins/platforms/wayland/configure.json +++ b/src/plugins/platforms/wayland/configure.json @@ -135,7 +135,7 @@ }, "xcomposite-egl": { "label": "XComposite EGL", - "condition": "features.wayland-client && features.opengl && features.egl && features.xlib && libs.xcomposite", + "condition": "features.wayland-client && features.opengl && features.egl && features.xlib && libs.xcomposite && features.egl_x11", "output": [ "privateFeature" ] }, "xcomposite-glx": { From 527a890cd3db3e1b313e83d094e54ab36089d5f5 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Wed, 4 Sep 2019 11:13:46 +0200 Subject: [PATCH 0755/1507] Add client test for floating point touch Task-number: QTBUG-77457 Change-Id: I49df80f3e00d349fed273363cd2625b841c085c5 Reviewed-by: Paul Olav Tvete --- tests/auto/wayland/seatv5/tst_seatv5.cpp | 32 ++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/tests/auto/wayland/seatv5/tst_seatv5.cpp b/tests/auto/wayland/seatv5/tst_seatv5.cpp index ca8de31acb1..ae7c3db2f90 100644 --- a/tests/auto/wayland/seatv5/tst_seatv5.cpp +++ b/tests/auto/wayland/seatv5/tst_seatv5.cpp @@ -68,6 +68,7 @@ private slots: // Touch tests void createsTouch(); void singleTap(); + void singleTapFloat(); }; void tst_seatv5::bindsToSeat() @@ -431,5 +432,36 @@ void tst_seatv5::singleTap() } } +void tst_seatv5::singleTapFloat() +{ + TouchWindow window; + QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial); + + exec([=] { + auto *t = touch(); + auto *c = client(); + t->sendDown(xdgToplevel()->surface(), {32.75, 32.25}, 1); + t->sendFrame(c); + t->sendUp(c, 1); + t->sendFrame(c); + }); + + QTRY_VERIFY(!window.m_events.empty()); + { + auto e = window.m_events.takeFirst(); + QCOMPARE(e.type, QEvent::TouchBegin); + QCOMPARE(e.touchPointStates, Qt::TouchPointState::TouchPointPressed); + QCOMPARE(e.touchPoints.length(), 1); + QCOMPARE(e.touchPoints.first().pos(), QPointF(32.75-window.frameMargins().left(), 32.25-window.frameMargins().top())); + } + { + auto e = window.m_events.takeFirst(); + QCOMPARE(e.type, QEvent::TouchEnd); + QCOMPARE(e.touchPointStates, Qt::TouchPointState::TouchPointReleased); + QCOMPARE(e.touchPoints.length(), 1); + QCOMPARE(e.touchPoints.first().pos(), QPointF(32.75-window.frameMargins().left(), 32.25-window.frameMargins().top())); + } +} + QCOMPOSITOR_TEST_MAIN(tst_seatv5) #include "tst_seatv5.moc" From 36663a187de8637a5d69b888bc8b786106afec3b Mon Sep 17 00:00:00 2001 From: Liang Qi Date: Tue, 17 Sep 2019 07:07:26 +0200 Subject: [PATCH 0756/1507] Blacklist tst_seatv4::animatedCursor() in b2qt Task-number: QTBUG-78317 Change-Id: I66e35782470cedd4d3cfeed6ffdfd8d54bc0ba26 Reviewed-by: Jani Heikkinen --- tests/auto/wayland/seatv4/BLACKLIST | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 tests/auto/wayland/seatv4/BLACKLIST diff --git a/tests/auto/wayland/seatv4/BLACKLIST b/tests/auto/wayland/seatv4/BLACKLIST new file mode 100644 index 00000000000..1c761a74efc --- /dev/null +++ b/tests/auto/wayland/seatv4/BLACKLIST @@ -0,0 +1,2 @@ +[animatedCursor] +b2qt From 00a2ff93f6c649983857194190aee36ba8f4f309 Mon Sep 17 00:00:00 2001 From: Jan Grulich Date: Wed, 31 Jul 2019 07:58:21 +0200 Subject: [PATCH 0757/1507] Use QGenericUnixTheme to provide themes This makes wayland platform plugin to use same platform themes as xcb plugin, which also can load platform theme plugin for apps running in Gnome. Change-Id: I9f4e3504d153e26c5580d9e33443d8a11201cd52 Reviewed-by: Johan Helsing --- .../platforms/wayland/qwaylandintegration.cpp | 36 ++----------------- 1 file changed, 2 insertions(+), 34 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandintegration.cpp b/src/plugins/platforms/wayland/qwaylandintegration.cpp index f6a80e18fde..fbbcedbee91 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandintegration.cpp @@ -98,38 +98,6 @@ QT_BEGIN_NAMESPACE namespace QtWaylandClient { -class GenericWaylandTheme: public QGenericUnixTheme -{ -public: - static QStringList themeNames() - { - QStringList result; - - if (QGuiApplication::desktopSettingsAware()) { - const QByteArray desktopEnvironment = QGuiApplicationPrivate::platformIntegration()->services()->desktopEnvironment(); - - if (desktopEnvironment == QByteArrayLiteral("KDE")) { -#if QT_CONFIG(settings) - result.push_back(QStringLiteral("kde")); -#endif - } else if (!desktopEnvironment.isEmpty() && - desktopEnvironment != QByteArrayLiteral("UNKNOWN") && - desktopEnvironment != QByteArrayLiteral("GNOME") && - desktopEnvironment != QByteArrayLiteral("UNITY") && - desktopEnvironment != QByteArrayLiteral("MATE") && - desktopEnvironment != QByteArrayLiteral("XFCE") && - desktopEnvironment != QByteArrayLiteral("LXDE")) - // Ignore X11 desktop environments - result.push_back(QString::fromLocal8Bit(desktopEnvironment.toLower())); - } - - if (result.isEmpty()) - result.push_back(QLatin1String(QGenericUnixTheme::name)); - - return result; - } -}; - QWaylandIntegration::QWaylandIntegration() #if defined(Q_OS_MACOS) : mFontDb(new QCoreTextFontDatabaseEngineFactory) @@ -302,12 +270,12 @@ QList QWaylandIntegration::possibleKeys(const QKeyEvent *event) const QStringList QWaylandIntegration::themeNames() const { - return GenericWaylandTheme::themeNames(); + return QGenericUnixTheme::themeNames(); } QPlatformTheme *QWaylandIntegration::createPlatformTheme(const QString &name) const { - return GenericWaylandTheme::createUnixTheme(name); + return QGenericUnixTheme::createUnixTheme(name); } // May be called from non-GUI threads From 13055e46e385f0db7653f8827c01dc5e043b8682 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Fri, 23 Aug 2019 11:42:46 +0200 Subject: [PATCH 0758/1507] Add client test for multi touch motion Make sure touchPoint order doesn't change even though the compositor event order does. Task-number: QTBUG-77014 Change-Id: If6b8a930344836ca52cc12fe7f29c8ac863d81ba Reviewed-by: Paul Olav Tvete --- tests/auto/wayland/seatv5/tst_seatv5.cpp | 73 ++++++++++++++++++++++ tests/auto/wayland/shared/coreprotocol.cpp | 12 ++++ tests/auto/wayland/shared/coreprotocol.h | 1 + 3 files changed, 86 insertions(+) diff --git a/tests/auto/wayland/seatv5/tst_seatv5.cpp b/tests/auto/wayland/seatv5/tst_seatv5.cpp index ae7c3db2f90..bf3c4f99d21 100644 --- a/tests/auto/wayland/seatv5/tst_seatv5.cpp +++ b/tests/auto/wayland/seatv5/tst_seatv5.cpp @@ -69,6 +69,7 @@ private slots: void createsTouch(); void singleTap(); void singleTapFloat(); + void multiTouch(); }; void tst_seatv5::bindsToSeat() @@ -463,5 +464,77 @@ void tst_seatv5::singleTapFloat() } } +void tst_seatv5::multiTouch() +{ + TouchWindow window; + QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial); + + exec([=] { + auto *t = touch(); + auto *c = client(); + + t->sendDown(xdgToplevel()->surface(), {32, 32}, 0); + t->sendDown(xdgToplevel()->surface(), {48, 48}, 1); + t->sendFrame(c); + + // Compositor event order should not change the order of the QTouchEvent::touchPoints() + // See QTBUG-77014 + t->sendMotion(c, {49, 48}, 1); + t->sendMotion(c, {33, 32}, 0); + t->sendFrame(c); + + t->sendUp(c, 0); + t->sendFrame(c); + + t->sendUp(c, 1); + t->sendFrame(c); + }); + + QTRY_VERIFY(!window.m_events.empty()); + { + auto e = window.m_events.takeFirst(); + QCOMPARE(e.type, QEvent::TouchBegin); + QCOMPARE(e.touchPointStates, Qt::TouchPointState::TouchPointPressed); + QCOMPARE(e.touchPoints.length(), 2); + + QCOMPARE(e.touchPoints[0].state(), Qt::TouchPointState::TouchPointPressed); + QCOMPARE(e.touchPoints[0].pos(), QPointF(32-window.frameMargins().left(), 32-window.frameMargins().top())); + + QCOMPARE(e.touchPoints[1].state(), Qt::TouchPointState::TouchPointPressed); + QCOMPARE(e.touchPoints[1].pos(), QPointF(48-window.frameMargins().left(), 48-window.frameMargins().top())); + } + { + auto e = window.m_events.takeFirst(); + QCOMPARE(e.type, QEvent::TouchUpdate); + QCOMPARE(e.touchPoints.length(), 2); + + QCOMPARE(e.touchPoints[0].state(), Qt::TouchPointState::TouchPointMoved); + QCOMPARE(e.touchPoints[0].pos(), QPointF(33-window.frameMargins().left(), 32-window.frameMargins().top())); + + QCOMPARE(e.touchPoints[1].state(), Qt::TouchPointState::TouchPointMoved); + QCOMPARE(e.touchPoints[1].pos(), QPointF(49-window.frameMargins().left(), 48-window.frameMargins().top())); + } + { + auto e = window.m_events.takeFirst(); + QCOMPARE(e.type, QEvent::TouchUpdate); + QCOMPARE(e.touchPointStates, Qt::TouchPointState::TouchPointReleased | Qt::TouchPointState::TouchPointStationary); + QCOMPARE(e.touchPoints.length(), 2); + + QCOMPARE(e.touchPoints[0].state(), Qt::TouchPointState::TouchPointReleased); + QCOMPARE(e.touchPoints[0].pos(), QPointF(33-window.frameMargins().left(), 32-window.frameMargins().top())); + + QCOMPARE(e.touchPoints[1].state(), Qt::TouchPointState::TouchPointStationary); + QCOMPARE(e.touchPoints[1].pos(), QPointF(49-window.frameMargins().left(), 48-window.frameMargins().top())); + } + { + auto e = window.m_events.takeFirst(); + QCOMPARE(e.type, QEvent::TouchEnd); + QCOMPARE(e.touchPointStates, Qt::TouchPointState::TouchPointReleased); + QCOMPARE(e.touchPoints.length(), 1); + QCOMPARE(e.touchPoints[0].state(), Qt::TouchPointState::TouchPointReleased); + QCOMPARE(e.touchPoints[0].pos(), QPointF(49-window.frameMargins().left(), 48-window.frameMargins().top())); + } +} + QCOMPOSITOR_TEST_MAIN(tst_seatv5) #include "tst_seatv5.moc" diff --git a/tests/auto/wayland/shared/coreprotocol.cpp b/tests/auto/wayland/shared/coreprotocol.cpp index 120c256c653..b0be2cb4e5b 100644 --- a/tests/auto/wayland/shared/coreprotocol.cpp +++ b/tests/auto/wayland/shared/coreprotocol.cpp @@ -424,6 +424,18 @@ uint Touch::sendUp(wl_client *client, int id) return serial; } +void Touch::sendMotion(wl_client *client, const QPointF &position, int id) +{ + wl_fixed_t x = wl_fixed_from_double(position.x()); + wl_fixed_t y = wl_fixed_from_double(position.y()); + + auto time = m_seat->m_compositor->currentTimeMilliseconds(); + + const auto touchResources = resourceMap().values(client); + for (auto *r : touchResources) + wl_touch::send_motion(r->handle, time, id, x, y); +} + void Touch::sendFrame(wl_client *client) { const auto touchResources = resourceMap().values(client); diff --git a/tests/auto/wayland/shared/coreprotocol.h b/tests/auto/wayland/shared/coreprotocol.h index 50812c29658..fe8202ad114 100644 --- a/tests/auto/wayland/shared/coreprotocol.h +++ b/tests/auto/wayland/shared/coreprotocol.h @@ -318,6 +318,7 @@ public: explicit Touch(Seat *seat) : m_seat(seat) {} uint sendDown(Surface *surface, const QPointF &position, int id); uint sendUp(wl_client *client, int id); + void sendMotion(wl_client *client, const QPointF &position, int id); void sendFrame(wl_client *client); Seat *m_seat = nullptr; From 9b228df7850c7c46cc91945ab2849d8dc97aa0c3 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Wed, 18 Sep 2019 09:19:39 +0200 Subject: [PATCH 0759/1507] Convert most config tests to configure.json inline format And remove the now unused entries in config.tests. Now only the wayland-scanner test remains, as that uses qmake features that do not easily translate to the inline format. This makes it much easier to port QtWayland to cmake. This also removes some config.tests that weren't used. Task-number: QTBUG-78177 Change-Id: Ia21a0025f9fac45b9f4815ee0f196e9e5759cdc6 Reviewed-by: Paul Olav Tvete --- src/plugins/platforms/wayland/configure.json | 59 ++++++++++++++++++-- 1 file changed, 55 insertions(+), 4 deletions(-) diff --git a/src/plugins/platforms/wayland/configure.json b/src/plugins/platforms/wayland/configure.json index e9e16324b60..a25b61f5517 100644 --- a/src/plugins/platforms/wayland/configure.json +++ b/src/plugins/platforms/wayland/configure.json @@ -61,25 +61,76 @@ "drm-egl-server": { "label": "DRM EGL Server", "type": "compile", - "test": "drm_egl_server", + "test": { + "include": [ + "EGL/egl.h", + "EGL/eglext.h" + ], + "main": [ + "#ifdef EGL_MESA_drm_image", + "return 0;", + "#else", + "#error Requires EGL_MESA_drm_image to be defined", + "return 1;", + "#endif" + ] + }, "use": "egl" }, "libhybris-egl-server": { "label": "libhybris EGL Server", "type": "compile", - "test": "libhybris_egl_server", + "test": { + "include": [ + "EGL/egl.h", + "EGL/eglext.h", + "hybris/eglplatformcommon/hybris_nativebufferext.h" + ], + "main": [ + "#ifdef EGL_HYBRIS_native_buffer", + "return 0;", + "#else", + "#error Requires EGL_HYBRIS_native_buffer to be defined", + "return 1;", + "#endif" + ] + }, "use": "egl" }, "dmabuf-server-buffer": { "label": "Linux dma-buf Buffer Sharing", "type": "compile", - "test": "dmabuf_server_buffer", + "test": { + "include": [ + "EGL/egl.h", + "EGL/eglext.h", + "drm_fourcc.h" + ], + "main": [ + "#ifdef EGL_LINUX_DMA_BUF_EXT", + "return 0;", + "#else", + "#error Requires EGL_LINUX_DMA_BUF_EXT", + "return 1;", + "#endif" + ] + }, "use": "egl" }, "vulkan-server-buffer": { "label": "Vulkan Buffer Sharing", "type": "compile", - "test": "vulkan_server_buffer" + "test": { + "include": [ + "vulkan/vulkan.h" + ], + "main": [ + "VkExportMemoryAllocateInfoKHR exportAllocInfo = {};", + "exportAllocInfo.sType = VK_STRUCTURE_TYPE_EXPORT_MEMORY_ALLOCATE_INFO_KHR;", + "exportAllocInfo.handleTypes = VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT_KHR;", + "return 0;" + ] + } } }, From 7dfa3f9d50feeb9525d832057cdc804f082ad3bd Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Fri, 20 Sep 2019 10:38:34 +0200 Subject: [PATCH 0760/1507] Fix wrong target name for tst_client_fullscreenshellv1 Task-number: QTBUG-78177 Change-Id: Id44794523511241b408e79383e438e52f769d62a Reviewed-by: Pier Luigi Fiorini --- tests/auto/wayland/fullscreenshellv1/fullscreenshellv1.pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/wayland/fullscreenshellv1/fullscreenshellv1.pro b/tests/auto/wayland/fullscreenshellv1/fullscreenshellv1.pro index 49d19d5c30d..c4006cdd870 100644 --- a/tests/auto/wayland/fullscreenshellv1/fullscreenshellv1.pro +++ b/tests/auto/wayland/fullscreenshellv1/fullscreenshellv1.pro @@ -1,4 +1,4 @@ include (../shared_old/shared_old.pri) -TARGET = tst_client_fullscreenshell1 +TARGET = tst_client_fullscreenshellv1 SOURCES += tst_fullscreenshellv1.cpp From 6f836567472b3fbc103da33af2b29f9da7f22903 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Mon, 26 Aug 2019 14:55:16 +0200 Subject: [PATCH 0761/1507] Client: Test that wl_touch.up events don't split touch frames We have a workaround for Weston not sending wl_touch.frame events after the last wl_touch.up event. It calls Touch::touch_frame to generate a fake event. The problem, however, is that it used to erroneously do this on wl_touch.up events even when it was not for the last touch point. This in turn, lead to extra frame events being inserted in the middle of a touch sequence, effectively splitting up one touch frame into multiple. Accumulated touch state would be handled prematurely, preventing wl_touch.cancel from working correctly for instance. This tests that we've stopped doing that. Change-Id: Ic545bbb18c23b827e5fa07a642a374094d720dae Reviewed-by: Paul Olav Tvete --- tests/auto/wayland/seatv5/tst_seatv5.cpp | 50 ++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/tests/auto/wayland/seatv5/tst_seatv5.cpp b/tests/auto/wayland/seatv5/tst_seatv5.cpp index bf3c4f99d21..636f260815a 100644 --- a/tests/auto/wayland/seatv5/tst_seatv5.cpp +++ b/tests/auto/wayland/seatv5/tst_seatv5.cpp @@ -70,6 +70,7 @@ private slots: void singleTap(); void singleTapFloat(); void multiTouch(); + void multiTouchUpAndMotionFrame(); }; void tst_seatv5::bindsToSeat() @@ -536,5 +537,54 @@ void tst_seatv5::multiTouch() } } +void tst_seatv5::multiTouchUpAndMotionFrame() +{ + TouchWindow window; + QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial); + + exec([=] { + auto *t = touch(); + auto *c = client(); + + t->sendDown(xdgToplevel()->surface(), {32, 32}, 0); + t->sendDown(xdgToplevel()->surface(), {48, 48}, 1); + t->sendFrame(c); + + // Sending an up event after a frame event, before any motion or down events used to + // unnecessarily trigger a workaround for a bug in an old version of Weston. The workaround + // would prematurely insert a fake frame event splitting the touch event up into two events. + // However, this should only be needed on the up event for the very last touch point. So in + // this test we verify that it doesn't unncecessarily break up the events. + t->sendUp(c, 0); + t->sendMotion(c, {49, 48}, 1); + t->sendFrame(c); + + t->sendUp(c, 1); + t->sendFrame(c); + }); + + QTRY_VERIFY(!window.m_events.empty()); + { + auto e = window.m_events.takeFirst(); + QCOMPARE(e.type, QEvent::TouchBegin); + QCOMPARE(e.touchPoints[0].state(), Qt::TouchPointState::TouchPointPressed); + QCOMPARE(e.touchPoints[1].state(), Qt::TouchPointState::TouchPointPressed); + } + { + auto e = window.m_events.takeFirst(); + QCOMPARE(e.type, QEvent::TouchUpdate); + QCOMPARE(e.touchPoints.length(), 2); + QCOMPARE(e.touchPoints[0].state(), Qt::TouchPointState::TouchPointReleased); + QCOMPARE(e.touchPoints[1].state(), Qt::TouchPointState::TouchPointMoved); + } + { + auto e = window.m_events.takeFirst(); + QCOMPARE(e.type, QEvent::TouchEnd); + QCOMPARE(e.touchPoints.length(), 1); + QCOMPARE(e.touchPoints[0].state(), Qt::TouchPointState::TouchPointReleased); + } + QVERIFY(window.m_events.empty()); +} + QCOMPOSITOR_TEST_MAIN(tst_seatv5) #include "tst_seatv5.moc" From 79196d387754f2b270ca848c0eb685dec278c85c Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Fri, 20 Sep 2019 15:55:29 +0200 Subject: [PATCH 0762/1507] Use new ifdef style for accessibility_atspi_bridge Change-Id: I9537017198ef3be862b22b2ed893f9438dc92b65 Reviewed-by: Paul Olav Tvete --- src/plugins/platforms/wayland/qwaylandintegration.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandintegration.cpp b/src/plugins/platforms/wayland/qwaylandintegration.cpp index fbbcedbee91..ce72c334068 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandintegration.cpp @@ -86,7 +86,7 @@ #include "qwaylandinputdeviceintegration_p.h" #include "qwaylandinputdeviceintegrationfactory_p.h" -#ifndef QT_NO_ACCESSIBILITY_ATSPI_BRIDGE +#if QT_CONFIG(accessibility_atspi_bridge) #include #endif @@ -239,7 +239,7 @@ QVariant QWaylandIntegration::styleHint(StyleHint hint) const QPlatformAccessibility *QWaylandIntegration::accessibility() const { if (!mAccessibility) { -#ifndef QT_NO_ACCESSIBILITY_ATSPI_BRIDGE +#if QT_CONFIG(accessibility_atspi_bridge) Q_ASSERT_X(QCoreApplication::eventDispatcher(), "QWaylandIntegration", "Initializing accessibility without event-dispatcher!"); mAccessibility.reset(new QSpiAccessibleBridge()); From 7c4b2334a392fe4ce6339bdb77372334fed49bf9 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Wed, 18 Sep 2019 08:56:57 +0200 Subject: [PATCH 0763/1507] Client: Don't crash with long window titles using UTF-16 characters Previously, we set the max length in QString character length, which means UTF-16 characters (of potentially three bytes) counts as one character. The max limit of libwayland, however, is in bytes (and the string itself is converted to UTF-8). Fix it by dividing the character limit by three because in the worst case each UTF-16 character will use three bytes when UTF-8 encoded. Fixes: QTBUG-78478 Change-Id: Idf4721894e0fe6f3cd92bdc6ada7b0ea4199ea63 Reviewed-by: Paul Olav Tvete --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 6 ++++-- tests/auto/wayland/client/tst_client.cpp | 11 +++++++++++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index ccfcaf933fb..ae26ba04946 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -298,8 +298,10 @@ void QWaylandWindow::setWindowTitle(const QString &title) const QString formatted = formatWindowTitle(title, separator); const int libwaylandMaxBufferSize = 4096; - // Some parts of the buffer is used for metadata, so subtract 100 to be on the safe side - const int maxLength = libwaylandMaxBufferSize - 100; + // Some parts of the buffer is used for metadata, so subtract 100 to be on the safe side. + // Also, QString is in utf-16, which means that in the worst case each character will be + // three bytes when converted to utf-8 (which is what libwayland uses), so divide by three. + const int maxLength = libwaylandMaxBufferSize / 3 - 100; auto truncated = QStringRef(&formatted).left(maxLength); if (truncated.length() < formatted.length()) { diff --git a/tests/auto/wayland/client/tst_client.cpp b/tests/auto/wayland/client/tst_client.cpp index 08120c8c24f..83b9e6ce0b3 100644 --- a/tests/auto/wayland/client/tst_client.cpp +++ b/tests/auto/wayland/client/tst_client.cpp @@ -178,6 +178,7 @@ private slots: void hiddenPopupParent(); void glWindow(); void longWindowTitle(); + void longWindowTitleWithUtf16Characters(); private: MockCompositor *compositor = nullptr; @@ -494,6 +495,16 @@ void tst_WaylandClient::longWindowTitle() QTRY_VERIFY(compositor->surface()); } +void tst_WaylandClient::longWindowTitleWithUtf16Characters() +{ + QWindow window; + QString absurdlyLongTitle = QString("三").repeated(10000); + Q_ASSERT(absurdlyLongTitle.length() == 10000); // just making sure the test isn't broken + window.setTitle(absurdlyLongTitle); + window.show(); + QTRY_VERIFY(compositor->surface()); +} + int main(int argc, char **argv) { setenv("XDG_RUNTIME_DIR", ".", 1); From fab564c40b9a53c39844cd60976f8e247e3a7b8b Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Tue, 24 Sep 2019 13:36:38 +0200 Subject: [PATCH 0764/1507] Configure: Remove libs.glx libs.glx just checks if we can can link against x11 and gl, this should already be covered by features.xlib and features.opengl. Also, it probably makes sense to not build these plugins if Qt is configured with no-feature-xlib. Task-number: QTBUG-78177 Change-Id: I56ccdc80a4601ccbf03cc5e65abe0adb3a579f99 Reviewed-by: Simon Hausmann --- src/plugins/platforms/wayland/configure.json | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/src/plugins/platforms/wayland/configure.json b/src/plugins/platforms/wayland/configure.json index 403a2edcf13..99cdc43047e 100644 --- a/src/plugins/platforms/wayland/configure.json +++ b/src/plugins/platforms/wayland/configure.json @@ -40,14 +40,6 @@ { "type": "pkgConfig", "args": "xcomposite" }, "-lxcomposite" ] - }, - "glx": { - "label": "GLX", - "test": "glx", - "sources": [ - { "type": "pkgConfig", "args": "x11 gl" }, - "-lX11 -lGl" - ] } }, @@ -145,7 +137,7 @@ }, "xcomposite-glx": { "label": "XComposite GLX", - "condition": "features.wayland-client && features.opengl && !features.opengles2 && features.xlib && libs.xcomposite && libs.glx", + "condition": "features.wayland-client && features.opengl && !features.opengles2 && features.xlib && libs.xcomposite", "output": [ "privateFeature" ] }, "wayland-drm-egl-server-buffer": { From 235f8f12fa1163cb7d149b71522a58247ee96e5f Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Fri, 13 Sep 2019 15:31:49 +0200 Subject: [PATCH 0765/1507] Client: Create context menu event when pressing the menu key Effectively is a copy of the code in XCB. When the menu key is pressed, a context menu event should be generated at the current cursor position. The global position in the event isn't truly global as that doesn't exist in wayland but should match client expectations. Change-Id: Ib814883aba632ca5eec58730846e1762b680467f Reviewed-by: Johan Helsing --- .../platforms/wayland/qwaylandinputdevice.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index e39ccf25ee2..a9da452dcbd 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -1158,7 +1158,18 @@ void QWaylandInputDevice::Keyboard::handleKey(ulong timestamp, QEvent::Type type } if (!filtered) { - QWindowSystemInterface::handleExtendedKeyEvent(focusWindow()->window(), timestamp, type, key, modifiers, + auto window = focusWindow()->window(); + + if (type == QEvent::KeyPress && key == Qt::Key_Menu) { + auto cursor = window->screen()->handle()->cursor(); + if (cursor) { + const QPoint globalPos = cursor->pos(); + const QPoint pos = window->mapFromGlobal(globalPos); + QWindowSystemInterface::handleContextMenuEvent(window, false, pos, globalPos, modifiers); + } + } + + QWindowSystemInterface::handleExtendedKeyEvent(window, timestamp, type, key, modifiers, nativeScanCode, nativeVirtualKey, nativeModifiers, text, autorepeat, count); } } From 276a64e0f4f2864b953ea48ee5f96ddafc127c62 Mon Sep 17 00:00:00 2001 From: Kari Oikarinen Date: Mon, 30 Sep 2019 12:34:33 +0300 Subject: [PATCH 0766/1507] Remove unused member variable Change-Id: I767ece2b090f95947fce34e743eec37299e62749 Reviewed-by: Johan Helsing --- tests/auto/wayland/inputcontext/tst_inputcontext.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/auto/wayland/inputcontext/tst_inputcontext.cpp b/tests/auto/wayland/inputcontext/tst_inputcontext.cpp index b1a5a7f17f8..7c0132e35a1 100644 --- a/tests/auto/wayland/inputcontext/tst_inputcontext.cpp +++ b/tests/auto/wayland/inputcontext/tst_inputcontext.cpp @@ -58,8 +58,6 @@ private: QByteArray mComposeModule = QByteArray("QComposeInputContext"); // default input context QByteArray mIbusModule = QByteArray("QIBusPlatformInputContext"); QByteArray mWaylandModule = QByteArray("QtWaylandClient::QWaylandInputContext"); - - TextInputManager *mTextInputManager = nullptr; }; void tst_inputcontext::initTestCase() From 7ddc7a34a404dc4d68a10b2caa64666ca2276843 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Tue, 24 Sep 2019 13:31:50 +0200 Subject: [PATCH 0767/1507] Make qtwaylandscanner accept named arguments and add --add-include Task-number: QTBUG-78177 Change-Id: I275cd815e0fe737af94fc46580ec9756eba54451 Reviewed-by: Johan Helsing Reviewed-by: Simon Hausmann --- .../qtwaylandscanner/qtwaylandscanner.cpp | 57 ++++++++++++++----- 1 file changed, 43 insertions(+), 14 deletions(-) diff --git a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp index 9691b857f27..24977a2f234 100644 --- a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp +++ b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp @@ -92,7 +92,7 @@ private: }; bool isServerSide(); - bool parseOption(const char *str); + bool parseOption(const QByteArray &str); QByteArray byteArrayValue(const QXmlStreamReader &xml, const char *name); int intValue(const QXmlStreamReader &xml, const char *name, int defaultValue = 0); @@ -123,29 +123,55 @@ private: QByteArray m_scannerName; QByteArray m_headerPath; QByteArray m_prefix; + QVector m_includes; QXmlStreamReader *m_xml = nullptr; }; bool Scanner::parseArguments(int argc, char **argv) { - m_scannerName = argv[0]; + QVector args; + args.reserve(argc); + for (int i = 0; i < argc; ++i) + args << QByteArray(argv[i]); - if (argc <= 2 || !parseOption(argv[1])) + m_scannerName = args[0]; + + if (argc <= 2 || !parseOption(args[1])) return false; - m_protocolFilePath = QByteArray(argv[2]); + m_protocolFilePath = args[2]; - if (argc >= 4) - m_headerPath = QByteArray(argv[3]); - if (argc == 5) - m_prefix = QByteArray(argv[4]); + if (argc > 3 && !args[3].startsWith('-')) { + // legacy positional arguments + m_headerPath = args[3]; + if (argc == 5) + m_prefix = args[4]; + } else { + // --header-path= (14 characters) + // --prefix= (9 characters) + // --add-include= (14 characters) + for (int pos = 3; pos < argc; pos++) { + const QByteArray &option = args[pos]; + if (option.startsWith("--header-path=")) { + m_headerPath = option.mid(14); + } else if (option.startsWith("--prefix=")) { + m_prefix = option.mid(10); + } else if (option.startsWith("--add-include=")) { + auto include = option.mid(14); + if (!include.isEmpty()) + m_includes << include; + } else { + return false; + } + } + } return true; } void Scanner::printUsage() { - fprintf(stderr, "Usage: %s [client-header|server-header|client-code|server-code] specfile [header-path] [prefix]\n", m_scannerName.constData()); + fprintf(stderr, "Usage: %s [client-header|server-header|client-code|server-code] specfile [--header-path=] [--prefix=] [--add-include=]\n", m_scannerName.constData()); } bool Scanner::isServerSide() @@ -153,15 +179,15 @@ bool Scanner::isServerSide() return m_option == ServerHeader || m_option == ServerCode; } -bool Scanner::parseOption(const char *str) +bool Scanner::parseOption(const QByteArray &str) { - if (str == QLatin1String("client-header")) + if (str == "client-header") m_option = ClientHeader; - else if (str == QLatin1String("server-header")) + else if (str == "server-header") m_option = ServerHeader; - else if (str == QLatin1String("client-code")) + else if (str == "client-code") m_option = ClientCode; - else if (str == QLatin1String("server-code")) + else if (str == "server-code") m_option = ServerCode; else return false; @@ -441,6 +467,9 @@ bool Scanner::process() if (m_xml->hasError()) return false; + for (auto b : qAsConst(m_includes)) + printf("#include %s\n", b.constData()); + if (m_option == ServerHeader) { QByteArray inclusionGuard = QByteArray("QT_WAYLAND_SERVER_") + preProcessorProtocolName.constData(); printf("#ifndef %s\n", inclusionGuard.constData()); From 5d83deaad2446b10aabc7cccc82f3181e2109651 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Mon, 7 Oct 2019 13:45:28 +0200 Subject: [PATCH 0768/1507] Add missing config tests for wayland, glx, xcomposite The intention of 9b228df was to inline all the tests and delete the rest. Unfortunately, some tests were deleted without being inlined, which led to the tests failing, which in turn led to nothing being built. This was not detected by coin, as configure currently passes although nothing is built. Fixes: QTBUG-79057 Change-Id: Ib09538ebf4b2d369d0fc1087f4b8fbea93d8c5b3 Reviewed-by: Joerg Bornemann --- src/plugins/platforms/wayland/configure.json | 44 +++++++++++++++++--- 1 file changed, 39 insertions(+), 5 deletions(-) diff --git a/src/plugins/platforms/wayland/configure.json b/src/plugins/platforms/wayland/configure.json index a25b61f5517..f49beaf703c 100644 --- a/src/plugins/platforms/wayland/configure.json +++ b/src/plugins/platforms/wayland/configure.json @@ -9,7 +9,24 @@ "libraries": { "wayland-client": { "label": "Wayland client library", - "test": "wayland", + "headers": "wayland-version.h", + "test": { + "main": [ + "#if WAYLAND_VERSION_MAJOR < 1", + "# error Wayland 1.8.0 or higher required", + "#endif", + "#if WAYLAND_VERSION_MAJOR == 1", + "# if WAYLAND_VERSION_MINOR < 8", + "# error Wayland 1.8.0 or higher required", + "# endif", + "# if WAYLAND_VERSION_MINOR == 8", + "# if WAYLAND_VERSION_MICRO < 0", + "# error Wayland 1.8.0 or higher required", + "# endif", + "# endif", + "#endif" + ] + }, "sources": [ { "type": "pkgConfig", "args": "wayland-client" }, "-lwayland-client" @@ -17,7 +34,10 @@ }, "wayland-cursor": { "label": "Wayland cursor library", - "test": "wayland_cursor", + "headers": "wayland-cursor.h", + "test": { + "main": "struct wl_cursor_image *image = 0;" + }, "use": "wayland-client", "sources": [ { "type": "pkgConfig", "args": "wayland-cursor" }, @@ -26,7 +46,10 @@ }, "wayland-egl": { "label": "Wayland EGL library", - "test": "wayland_egl", + "headers": "wayland-egl.h", + "test": { + "main": "struct wl_egl_window *window = wl_egl_window_create(0, 100, 100);" + }, "sources": [ { "type": "pkgConfig", "args": "wayland-egl" }, "-lwayland-egl", @@ -35,7 +58,11 @@ }, "xcomposite": { "label": "XComposite", - "test": "xcomposite", + "headers": "X11/extensions/Xcomposite.h", + "test": { + "main": "XCompositeRedirectWindow((Display *)0,(Window) 0, CompositeRedirectManual);" + + }, "sources": [ { "type": "pkgConfig", "args": "xcomposite" }, "-lxcomposite" @@ -43,7 +70,14 @@ }, "glx": { "label": "GLX", - "test": "glx", + "headers": "GL/glx.h", + "test": { + "main": [ + "Display *dpy = XOpenDisplay(0);", + "int items = 0;", + "GLXFBConfig *fbc = glXChooseFBConfig(dpy, DefaultScreen(dpy), 0 , &items);" + ] + }, "sources": [ { "type": "pkgConfig", "args": "x11 gl" }, "-lX11 -lGl" From 918cc075b9c4ebdf40c985dd17a087e151d88dba Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Mon, 14 Oct 2019 11:10:42 +0200 Subject: [PATCH 0769/1507] Fix build: Use temporary directories for tests' XDG_RUNTIME_DIR Using XDG_RUNTIME_DIR="." does not work after qtbase 5542785, and it was a rather brittle solution anyway. Fixes: QTBUG-79185 Change-Id: Iaf9ced66709cc6cbac8a2d54efc64e1a8c528561 Reviewed-by: Paul Olav Tvete --- tests/auto/wayland/client/tst_client.cpp | 3 ++- tests/auto/wayland/inputcontext/tst_inputcontext.cpp | 3 ++- tests/auto/wayland/shared/mockcompositor.h | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/tests/auto/wayland/client/tst_client.cpp b/tests/auto/wayland/client/tst_client.cpp index 83b9e6ce0b3..e7729ce8b20 100644 --- a/tests/auto/wayland/client/tst_client.cpp +++ b/tests/auto/wayland/client/tst_client.cpp @@ -507,7 +507,8 @@ void tst_WaylandClient::longWindowTitleWithUtf16Characters() int main(int argc, char **argv) { - setenv("XDG_RUNTIME_DIR", ".", 1); + QTemporaryDir tmpRuntimeDir; + setenv("XDG_RUNTIME_DIR", tmpRuntimeDir.path().toLocal8Bit(), 1); setenv("QT_QPA_PLATFORM", "wayland", 1); // force QGuiApplication to use wayland plugin MockCompositor compositor; diff --git a/tests/auto/wayland/inputcontext/tst_inputcontext.cpp b/tests/auto/wayland/inputcontext/tst_inputcontext.cpp index b1a5a7f17f8..3e6de4a0800 100644 --- a/tests/auto/wayland/inputcontext/tst_inputcontext.cpp +++ b/tests/auto/wayland/inputcontext/tst_inputcontext.cpp @@ -173,7 +173,8 @@ void tst_inputcontext::inputContextReconfigurationWhenTogglingTextInputExtension int main(int argc, char *argv[]) { - qputenv("XDG_RUNTIME_DIR", "."); + QTemporaryDir tmpRuntimeDir; + qputenv("XDG_RUNTIME_DIR", tmpRuntimeDir.path().toLocal8Bit()); qputenv("QT_QPA_PLATFORM", "wayland"); tst_inputcontext tc; diff --git a/tests/auto/wayland/shared/mockcompositor.h b/tests/auto/wayland/shared/mockcompositor.h index 05bf32c8d50..f5264ccf611 100644 --- a/tests/auto/wayland/shared/mockcompositor.h +++ b/tests/auto/wayland/shared/mockcompositor.h @@ -77,7 +77,8 @@ public: #define QCOMPOSITOR_TEST_MAIN(test) \ int main(int argc, char **argv) \ { \ - setenv("XDG_RUNTIME_DIR", ".", 1); \ + QTemporaryDir tmpRuntimeDir; \ + setenv("XDG_RUNTIME_DIR", tmpRuntimeDir.path().toLocal8Bit(), 1); \ setenv("XDG_CURRENT_DESKTOP", "qtwaylandtests", 1); \ setenv("QT_QPA_PLATFORM", "wayland", 1); \ test tc; \ From da9d36b394dc27914fdf1145894efd5ef466c4c5 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Tue, 15 Oct 2019 09:51:43 +0200 Subject: [PATCH 0770/1507] Client: Fix 100ms freeze when applications do not swap after deliverUpdateRequest [ChangeLog][QPA plugin] Fixed a 100 ms freeze that would occur if applications did not draw after receiving a deliverUpdateRequest(). QtQuick does this at the start of animations. This should get rid of those backingstore warnings (and also remove a 100ms freeze before animations start in those instances). Fixes: QTBUG-76813 Change-Id: Id366bf4a14f402fa44530ae46e7b66d9988c14f6 Reviewed-by: Paul Olav Tvete Reviewed-by: John Brooks --- .../platforms/wayland/qwaylandwindow.cpp | 46 ++++--------------- .../platforms/wayland/qwaylandwindow_p.h | 1 - 2 files changed, 9 insertions(+), 38 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index ae26ba04946..8d34afd1f11 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -1105,25 +1105,6 @@ QVariant QWaylandWindow::property(const QString &name, const QVariant &defaultVa void QWaylandWindow::timerEvent(QTimerEvent *event) { - if (event->timerId() == mFallbackUpdateTimerId) { - killTimer(mFallbackUpdateTimerId); - mFallbackUpdateTimerId = -1; - qCDebug(lcWaylandBackingstore) << "mFallbackUpdateTimer timed out"; - - if (!isExposed()) { - qCDebug(lcWaylandBackingstore) << "Fallback update timer: Window not exposed," - << "not delivering update request."; - return; - } - - if (mWaitingForUpdate && hasPendingUpdateRequest() && !mWaitingForFrameCallback) { - qCWarning(lcWaylandBackingstore) << "Delivering update request through fallback timer," - << "may not be in sync with display"; - deliverUpdateRequest(); - } - } - - if (mFrameCallbackTimerId.testAndSetOrdered(event->timerId(), -1)) { killTimer(event->timerId()); qCDebug(lcWaylandBackingstore) << "Didn't receive frame callback in time, window should now be inexposed"; @@ -1135,6 +1116,7 @@ void QWaylandWindow::timerEvent(QTimerEvent *event) void QWaylandWindow::requestUpdate() { + qCDebug(lcWaylandBackingstore) << "requestUpdate"; Q_ASSERT(hasPendingUpdateRequest()); // should be set by QPA // If we have a frame callback all is good and will be taken care of there @@ -1142,20 +1124,17 @@ void QWaylandWindow::requestUpdate() return; // If we've already called deliverUpdateRequest(), but haven't seen any attach+commit/swap yet - if (mWaitingForUpdate) { - // Ideally, we should just have returned here, but we're not guaranteed that the client - // will actually update, so start this timer to deliver another request update after a while - // *IF* the client doesn't update. - int fallbackTimeout = 100; - mFallbackUpdateTimerId = startTimer(fallbackTimeout); - return; - } + // This is a somewhat redundant behavior and might indicate a bug in the calling code, so log + // here so we can get this information when debugging update/frame callback issues. + // Continue as nothing happened, though. + if (mWaitingForUpdate) + qCDebug(lcWaylandBackingstore) << "requestUpdate called twice without committing anything"; // Some applications (such as Qt Quick) depend on updates being delivered asynchronously, // so use invokeMethod to delay the delivery a bit. QMetaObject::invokeMethod(this, [this] { // Things might have changed in the meantime - if (hasPendingUpdateRequest() && !mWaitingForUpdate && !mWaitingForFrameCallback) + if (hasPendingUpdateRequest() && !mWaitingForFrameCallback) deliverUpdateRequest(); }, Qt::QueuedConnection); } @@ -1165,6 +1144,7 @@ void QWaylandWindow::requestUpdate() // Can be called from the render thread (without locking anything) so make sure to not make races in this method. void QWaylandWindow::handleUpdate() { + qCDebug(lcWaylandBackingstore) << "handleUpdate" << QThread::currentThread(); // TODO: Should sync subsurfaces avoid requesting frame callbacks? QReadLocker lock(&mSurfaceLock); if (!isInitialized()) @@ -1175,15 +1155,6 @@ void QWaylandWindow::handleUpdate() mFrameCallback = nullptr; } - if (mFallbackUpdateTimerId != -1) { - // Ideally, we would stop the fallback timer here, but since we're on another thread, - // it's not allowed. Instead we set mFallbackUpdateTimer to -1 here, so we'll just - // ignore it if it times out before it's cleaned up by the invokeMethod call. - int id = mFallbackUpdateTimerId; - mFallbackUpdateTimerId = -1; - QMetaObject::invokeMethod(this, [this, id] { killTimer(id); }, Qt::QueuedConnection); - } - mFrameCallback = frame(); wl_callback_add_listener(mFrameCallback, &QWaylandWindow::callbackListener, this); mWaitingForFrameCallback = true; @@ -1203,6 +1174,7 @@ void QWaylandWindow::handleUpdate() void QWaylandWindow::deliverUpdateRequest() { + qCDebug(lcWaylandBackingstore) << "deliverUpdateRequest"; mWaitingForUpdate = true; QPlatformWindow::deliverUpdateRequest(); } diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index b03d92e5633..e4a1124e7d6 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -232,7 +232,6 @@ protected: // True when we have called deliverRequestUpdate, but the client has not yet attached a new buffer bool mWaitingForUpdate = false; - int mFallbackUpdateTimerId = -1; // Started when waiting for app to commit QMutex mResizeLock; bool mWaitingToApplyConfigure = false; From e38ac423a00e0b2c69ac7534bbb9c41b35fe9512 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Fri, 18 Oct 2019 14:22:28 +0200 Subject: [PATCH 0771/1507] Client: Print a warning when trying to set clipboard without a seat This warning can save some time when trying to understand why some qtbase auto tests are failing on headless Weston (which doesn't have seats at the moment). Change-Id: I361546611d12bff8a465af5bb103f61e80d73a15 Reviewed-by: Pier Luigi Fiorini --- src/plugins/platforms/wayland/qwaylandclipboard.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandclipboard.cpp b/src/plugins/platforms/wayland/qwaylandclipboard.cpp index 369c6ec07db..c3a526ddc01 100644 --- a/src/plugins/platforms/wayland/qwaylandclipboard.cpp +++ b/src/plugins/platforms/wayland/qwaylandclipboard.cpp @@ -93,8 +93,10 @@ QMimeData *QWaylandClipboard::mimeData(QClipboard::Mode mode) void QWaylandClipboard::setMimeData(QMimeData *data, QClipboard::Mode mode) { auto *seat = mDisplay->currentInputDevice(); - if (!seat) + if (!seat) { + qCWarning(lcQpaWayland) << "Can't set clipboard contents with no wl_seats available"; return; + } static const QString plain = QStringLiteral("text/plain"); static const QString utf8 = QStringLiteral("text/plain;charset=utf-8"); From eda76963a83f881d12f0d9c1ab68ef70372643cd Mon Sep 17 00:00:00 2001 From: Pekka Vuorela Date: Mon, 14 Oct 2019 17:20:59 +0300 Subject: [PATCH 0772/1507] Fix url getting broken on openUrl UTF-8 byte array cannot be split in random position and assume getting valid content on resulting parts. Switched chunk size to be based on characters, encoded size will vary but don't think that should matter. Change-Id: Ic41ea16d2111b1620993b60fdbc6e739929f25d7 Reviewed-by: Paul Olav Tvete --- .../wayland/qwaylandwindowmanagerintegration.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration.cpp b/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration.cpp index 17ae8a5ae85..dd1acaf7215 100644 --- a/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration.cpp @@ -110,13 +110,17 @@ void QWaylandWindowManagerIntegration::windowmanager_quit() void QWaylandWindowManagerIntegration::openUrl_helper(const QUrl &url) { Q_ASSERT(isInitialized()); - QByteArray data = url.toString().toUtf8(); + QString data = url.toString(); static const int chunkSize = 128; while (!data.isEmpty()) { - QByteArray chunk = data.left(chunkSize); + QString chunk = data.left(chunkSize); data = data.mid(chunkSize); - open_url(!data.isEmpty(), QString::fromUtf8(chunk)); + if (chunk.at(chunk.size() - 1).isHighSurrogate() && !data.isEmpty()) { + chunk.append(data.at(0)); + data = data.mid(1); + } + open_url(!data.isEmpty(), chunk); } } From 7cc704a3a7f58b055ca9113cbdfd1e6bb4eeb6d7 Mon Sep 17 00:00:00 2001 From: Pekka Vuorela Date: Thu, 17 Oct 2019 12:18:16 +0300 Subject: [PATCH 0773/1507] Signal clipboard change when focus lost clears the selection offer Change-Id: I311a5d422f31347029795dbd2479a771ae93c01f Reviewed-by: Johan Helsing --- src/plugins/platforms/wayland/qwaylanddatadevice.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/plugins/platforms/wayland/qwaylanddatadevice.cpp b/src/plugins/platforms/wayland/qwaylanddatadevice.cpp index fc3c7077a84..f7d135e49f3 100644 --- a/src/plugins/platforms/wayland/qwaylanddatadevice.cpp +++ b/src/plugins/platforms/wayland/qwaylanddatadevice.cpp @@ -81,7 +81,14 @@ QWaylandDataOffer *QWaylandDataDevice::selectionOffer() const void QWaylandDataDevice::invalidateSelectionOffer() { + if (m_selectionOffer.isNull()) + return; + m_selectionOffer.reset(); + +#if QT_CONFIG(clipboard) + QGuiApplicationPrivate::platformIntegration()->clipboard()->emitChanged(QClipboard::Clipboard); +#endif } QWaylandDataSource *QWaylandDataDevice::selectionSource() const From 37e0cd278a35ac8d34f998ca77ce1bd02af712bb Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Tue, 22 Oct 2019 12:30:09 +0200 Subject: [PATCH 0774/1507] Add client test for clipboard when losing keyboard focus Also, verifies that we fixed a recent bug about QClipboard::dataChanged not being emitted when the clipboard is invalidated due to losing focus. Change-Id: Ie92b618a4f673c21d6582979249700aef8785536 Reviewed-by: Pekka Vuorela --- .../wayland/datadevicev1/tst_datadevicev1.cpp | 30 +++++++++++++++++++ tests/auto/wayland/shared/datadevice.h | 1 - 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/tests/auto/wayland/datadevicev1/tst_datadevicev1.cpp b/tests/auto/wayland/datadevicev1/tst_datadevicev1.cpp index e3babceb53e..1568b3b9680 100644 --- a/tests/auto/wayland/datadevicev1/tst_datadevicev1.cpp +++ b/tests/auto/wayland/datadevicev1/tst_datadevicev1.cpp @@ -59,6 +59,7 @@ private slots: void pasteUtf8(); void destroysPreviousSelection(); void destroysSelectionWithSurface(); + void destroysSelectionOnLeave(); void dragWithoutFocus(); }; @@ -215,6 +216,35 @@ void tst_datadevicev1::destroysSelectionWithSurface() QCOMPOSITOR_TRY_COMPARE(dataDevice()->m_sentSelectionOffers.size(), 0); } +void tst_datadevicev1::destroysSelectionOnLeave() +{ + QRasterWindow window; + window.resize(64, 64); + window.show(); + QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial); + + exec([&] { + auto *offer = dataDevice()->sendDataOffer(client(), {"text/plain"}); + dataDevice()->sendSelection(offer); + + auto *surface = xdgSurface()->m_surface; + keyboard()->sendEnter(surface); // Need to set keyboard focus according to protocol + }); + + QTRY_VERIFY(QGuiApplication::clipboard()->mimeData(QClipboard::Clipboard)); + QTRY_VERIFY(QGuiApplication::clipboard()->mimeData(QClipboard::Clipboard)->hasText()); + + QSignalSpy dataChangedSpy(QGuiApplication::clipboard(), &QClipboard::dataChanged); + + exec([&] { + auto *surface = xdgSurface()->m_surface; + keyboard()->sendLeave(surface); + }); + + QTRY_COMPARE(dataChangedSpy.count(), 1); + QVERIFY(!QGuiApplication::clipboard()->mimeData(QClipboard::Clipboard)->hasText()); +} + // The application should not crash if it attempts to start a drag operation // when it doesn't have input focus (QTBUG-76368) void tst_datadevicev1::dragWithoutFocus() diff --git a/tests/auto/wayland/shared/datadevice.h b/tests/auto/wayland/shared/datadevice.h index a96da86f081..98e780b2283 100644 --- a/tests/auto/wayland/shared/datadevice.h +++ b/tests/auto/wayland/shared/datadevice.h @@ -65,7 +65,6 @@ public: ~DataDevice() override; void send_data_offer(::wl_resource *resource) = delete; DataOffer *sendDataOffer(::wl_client *client, const QStringList &mimeTypes = {}); - DataOffer *sendDataOffer(const QStringList &mimeTypes = {}); void send_selection(::wl_resource *resource) = delete; void sendSelection(DataOffer *offer); From 87b4273398c2e1768820146fc136c99a15e14cc9 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Mon, 14 Oct 2019 12:21:41 +0200 Subject: [PATCH 0775/1507] Client tests: Set WAYLAND_DISPLAY The tests would previously fail if WAYLAND_DISPLAY was set to something other than empty or wayland-0. For instance when running multiple compositors and trying to run the tests, they would fail because they create a compositor on wayland-0 (using wl_display_add_socket_auto()), but would try to connect to wayland-1 due to the env var. Change-Id: I7771d41737410d5c32f5a6db3de4987096cb4d22 Reviewed-by: Paul Olav Tvete --- tests/auto/wayland/shared/corecompositor.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/auto/wayland/shared/corecompositor.cpp b/tests/auto/wayland/shared/corecompositor.cpp index 7edb1c2d434..5c6c83baa88 100644 --- a/tests/auto/wayland/shared/corecompositor.cpp +++ b/tests/auto/wayland/shared/corecompositor.cpp @@ -43,6 +43,7 @@ CoreCompositor::CoreCompositor() } }) { + qputenv("WAYLAND_DISPLAY", m_socketName); m_timer.start(); Q_ASSERT(isClean()); } From 94ea0eaf839fe9893e2881b4e52a486ac8c5acd8 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Tue, 22 Oct 2019 10:17:56 +0200 Subject: [PATCH 0776/1507] Fix missing emission of QClipboard::selectionChanged And add a test to verify we've fixed it. Change-Id: Ic6d5e64b3000444465935f7caf7e32ec9c4f1012 Reviewed-by: Paul Olav Tvete --- .../wayland/qwaylandprimaryselectionv1.cpp | 9 ++++++ .../wayland/qwaylandprimaryselectionv1_p.h | 2 +- .../tst_primaryselectionv1.cpp | 30 +++++++++++++++++++ 3 files changed, 40 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandprimaryselectionv1.cpp b/src/plugins/platforms/wayland/qwaylandprimaryselectionv1.cpp index 3ddf6dac376..832f967804a 100644 --- a/src/plugins/platforms/wayland/qwaylandprimaryselectionv1.cpp +++ b/src/plugins/platforms/wayland/qwaylandprimaryselectionv1.cpp @@ -96,6 +96,15 @@ QWaylandPrimarySelectionDeviceV1::~QWaylandPrimarySelectionDeviceV1() destroy(); } +void QWaylandPrimarySelectionDeviceV1::invalidateSelectionOffer() +{ + if (!m_selectionOffer) + return; + + m_selectionOffer.reset(); + QGuiApplicationPrivate::platformIntegration()->clipboard()->emitChanged(QClipboard::Selection); +} + void QWaylandPrimarySelectionDeviceV1::setSelectionSource(QWaylandPrimarySelectionSourceV1 *source) { if (source) { diff --git a/src/plugins/platforms/wayland/qwaylandprimaryselectionv1_p.h b/src/plugins/platforms/wayland/qwaylandprimaryselectionv1_p.h index b165c51b8c6..3f0a42a6702 100644 --- a/src/plugins/platforms/wayland/qwaylandprimaryselectionv1_p.h +++ b/src/plugins/platforms/wayland/qwaylandprimaryselectionv1_p.h @@ -125,7 +125,7 @@ class QWaylandPrimarySelectionDeviceV1 : public QObject, public QtWayland::zwp_p public: ~QWaylandPrimarySelectionDeviceV1() override; QWaylandPrimarySelectionOfferV1 *selectionOffer() const { return m_selectionOffer.data(); } - void invalidateSelectionOffer() { m_selectionOffer.reset(); } + void invalidateSelectionOffer(); QWaylandPrimarySelectionSourceV1 *selectionSource() const { return m_selectionSource.data(); } void setSelectionSource(QWaylandPrimarySelectionSourceV1 *source); diff --git a/tests/auto/wayland/primaryselectionv1/tst_primaryselectionv1.cpp b/tests/auto/wayland/primaryselectionv1/tst_primaryselectionv1.cpp index 216db85cd6b..b3fa2b13c60 100644 --- a/tests/auto/wayland/primaryselectionv1/tst_primaryselectionv1.cpp +++ b/tests/auto/wayland/primaryselectionv1/tst_primaryselectionv1.cpp @@ -261,6 +261,7 @@ private slots: void pasteAscii(); void pasteUtf8(); void destroysPreviousSelection(); + void destroysSelectionOnLeave(); void copy(); }; @@ -411,6 +412,35 @@ void tst_primaryselectionv1::destroysPreviousSelection() QCOMPOSITOR_TRY_COMPARE(primarySelectionDevice()->m_sentSelectionOffers.size(), 1); } +void tst_primaryselectionv1::destroysSelectionOnLeave() +{ + QRasterWindow window; + window.resize(64, 64); + window.show(); + QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial); + + exec([&] { + auto *surface = xdgSurface()->m_surface; + keyboard()->sendEnter(surface); // Need to set keyboard focus according to protocol + + auto *offer = primarySelectionDevice()->sendDataOffer({"text/plain"}); + primarySelectionDevice()->sendSelection(offer); + }); + + QTRY_VERIFY(QGuiApplication::clipboard()->mimeData(QClipboard::Selection)); + QTRY_VERIFY(QGuiApplication::clipboard()->mimeData(QClipboard::Selection)->hasText()); + + QSignalSpy selectionChangedSpy(QGuiApplication::clipboard(), &QClipboard::selectionChanged); + + exec([&] { + auto *surface = xdgSurface()->m_surface; + keyboard()->sendLeave(surface); + }); + + QTRY_COMPARE(selectionChangedSpy.count(), 1); + QVERIFY(!QGuiApplication::clipboard()->mimeData(QClipboard::Selection)->hasText()); +} + void tst_primaryselectionv1::copy() { class Window : public QRasterWindow { From f8651a551dca9d5062aa3f077bc3e48fd4f96784 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Tue, 22 Oct 2019 12:02:23 +0200 Subject: [PATCH 0777/1507] Fix QClipboard::ownSelection always returning false It would return false regardless of whether we owned the selection. Change-Id: I6df394d8dbceeccb6eb6d0670b4351af1a158491 Reviewed-by: Paul Olav Tvete --- .../platforms/wayland/qwaylandclipboard.cpp | 16 +++++++++++----- .../tst_primaryselectionv1.cpp | 1 + 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandclipboard.cpp b/src/plugins/platforms/wayland/qwaylandclipboard.cpp index c3a526ddc01..81f48e05ee3 100644 --- a/src/plugins/platforms/wayland/qwaylandclipboard.cpp +++ b/src/plugins/platforms/wayland/qwaylandclipboard.cpp @@ -137,14 +137,20 @@ bool QWaylandClipboard::supportsMode(QClipboard::Mode mode) const bool QWaylandClipboard::ownsMode(QClipboard::Mode mode) const { - if (mode != QClipboard::Clipboard) + QWaylandInputDevice *seat = mDisplay->currentInputDevice(); + if (!seat) return false; - QWaylandInputDevice *inputDevice = mDisplay->currentInputDevice(); - if (!inputDevice || !inputDevice->dataDevice()) + switch (mode) { + case QClipboard::Clipboard: + return seat->dataDevice() && seat->dataDevice()->selectionSource() != nullptr; +#if QT_CONFIG(wayland_client_primary_selection) + case QClipboard::Selection: + return seat->primarySelectionDevice() && seat->primarySelectionDevice()->selectionSource() != nullptr; +#endif + default: return false; - - return inputDevice->dataDevice()->selectionSource() != nullptr; + } } } diff --git a/tests/auto/wayland/primaryselectionv1/tst_primaryselectionv1.cpp b/tests/auto/wayland/primaryselectionv1/tst_primaryselectionv1.cpp index b3fa2b13c60..ee9fa110e4b 100644 --- a/tests/auto/wayland/primaryselectionv1/tst_primaryselectionv1.cpp +++ b/tests/auto/wayland/primaryselectionv1/tst_primaryselectionv1.cpp @@ -472,6 +472,7 @@ void tst_primaryselectionv1::copy() }); QCOMPOSITOR_TRY_VERIFY(primarySelectionDevice()->m_selectionSource); QCOMPOSITOR_TRY_VERIFY(mouseSerials.contains(primarySelectionDevice()->m_serial)); + QVERIFY(QGuiApplication::clipboard()->ownsSelection()); QByteArray pastedBuf; exec([&](){ auto *source = primarySelectionDevice()->m_selectionSource; From a3e5de6c0dae6d9f02350efe1d325b7496c24494 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Fri, 4 Oct 2019 11:25:19 +0200 Subject: [PATCH 0778/1507] Client: Add Vulkan support for Wayland Inspired by the xcb version. hellovulkantriangle runs smootly, but freezes in some multi-monitor setups. [ChangeLog][QPA plugin] Added Vulkan support. Fixes: QTBUG-78000 Change-Id: I8711b5b47e4b71cde78295aab9acb3f5945b141b Reviewed-by: Laszlo Agocs --- src/plugins/platforms/wayland/client.pro | 14 ++ .../platforms/wayland/qwaylandintegration.cpp | 17 +++ .../platforms/wayland/qwaylandintegration_p.h | 4 + .../wayland/qwaylandnativeinterface.cpp | 12 ++ .../wayland/qwaylandvulkaninstance.cpp | 132 ++++++++++++++++++ .../wayland/qwaylandvulkaninstance_p.h | 80 +++++++++++ .../wayland/qwaylandvulkanwindow.cpp | 84 +++++++++++ .../wayland/qwaylandvulkanwindow_p.h | 68 +++++++++ .../platforms/wayland/qwaylandwindow_p.h | 3 +- 9 files changed, 413 insertions(+), 1 deletion(-) create mode 100644 src/plugins/platforms/wayland/qwaylandvulkaninstance.cpp create mode 100644 src/plugins/platforms/wayland/qwaylandvulkaninstance_p.h create mode 100644 src/plugins/platforms/wayland/qwaylandvulkanwindow.cpp create mode 100644 src/plugins/platforms/wayland/qwaylandvulkanwindow_p.h diff --git a/src/plugins/platforms/wayland/client.pro b/src/plugins/platforms/wayland/client.pro index d0ae9009e94..458e4936010 100644 --- a/src/plugins/platforms/wayland/client.pro +++ b/src/plugins/platforms/wayland/client.pro @@ -5,6 +5,10 @@ QT += core-private gui-private QT_FOR_PRIVATE += service_support-private QT_PRIVATE += fontdatabase_support-private eventdispatcher_support-private theme_support-private +qtConfig(vulkan) { + QT_PRIVATE += vulkan_support-private +} + # We have a bunch of C code with casts, so we can't have this option QMAKE_CXXFLAGS_WARN_ON -= -Wcast-qual @@ -97,6 +101,16 @@ include(shellintegration/shellintegration.pri) include(inputdeviceintegration/inputdeviceintegration.pri) include(global/global.pri) +qtConfig(vulkan) { + HEADERS += \ + qwaylandvulkaninstance_p.h \ + qwaylandvulkanwindow_p.h + + SOURCES += \ + qwaylandvulkaninstance.cpp \ + qwaylandvulkanwindow.cpp +} + qtConfig(cursor) { QMAKE_USE += wayland-cursor diff --git a/src/plugins/platforms/wayland/qwaylandintegration.cpp b/src/plugins/platforms/wayland/qwaylandintegration.cpp index ce72c334068..9bdd9cc129f 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandintegration.cpp @@ -94,6 +94,11 @@ #include #endif +#if QT_CONFIG(vulkan) +#include "qwaylandvulkaninstance_p.h" +#include "qwaylandvulkanwindow_p.h" +#endif + QT_BEGIN_NAMESPACE namespace QtWaylandClient { @@ -158,6 +163,11 @@ QPlatformWindow *QWaylandIntegration::createPlatformWindow(QWindow *window) cons && mDisplay->clientBufferIntegration()) return mDisplay->clientBufferIntegration()->createEglWindow(window); +#if QT_CONFIG(vulkan) + if (window->surfaceType() == QSurface::VulkanSurface) + return new QWaylandVulkanWindow(window); +#endif // QT_CONFIG(vulkan) + return new QWaylandShmWindow(window); } @@ -278,6 +288,13 @@ QPlatformTheme *QWaylandIntegration::createPlatformTheme(const QString &name) co return QGenericUnixTheme::createUnixTheme(name); } +#if QT_CONFIG(vulkan) +QPlatformVulkanInstance *QWaylandIntegration::createPlatformVulkanInstance(QVulkanInstance *instance) const +{ + return new QWaylandVulkanInstance(instance); +} +#endif // QT_CONFIG(vulkan) + // May be called from non-GUI threads QWaylandClientBufferIntegration *QWaylandIntegration::clientBufferIntegration() const { diff --git a/src/plugins/platforms/wayland/qwaylandintegration_p.h b/src/plugins/platforms/wayland/qwaylandintegration_p.h index a66999c7f22..ff70ae25dba 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration_p.h +++ b/src/plugins/platforms/wayland/qwaylandintegration_p.h @@ -113,6 +113,10 @@ public: QPlatformTheme *createPlatformTheme(const QString &name) const override; +#if QT_CONFIG(vulkan) + QPlatformVulkanInstance *createPlatformVulkanInstance(QVulkanInstance *instance) const override; +#endif + QWaylandInputDevice *createInputDevice(QWaylandDisplay *display, int version, uint32_t id); virtual QWaylandClientBufferIntegration *clientBufferIntegration() const; diff --git a/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp b/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp index b4ecc009098..bf54a1a00f9 100644 --- a/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp +++ b/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp @@ -51,6 +51,9 @@ #include #include #include +#if QT_CONFIG(vulkan) +#include +#endif #include @@ -117,6 +120,15 @@ void *QWaylandNativeInterface::nativeResourceForWindow(const QByteArray &resourc if (lowerCaseResource == "egldisplay" && m_integration->clientBufferIntegration()) return m_integration->clientBufferIntegration()->nativeResource(QWaylandClientBufferIntegration::EglDisplay); +#if QT_CONFIG(vulkan) + if (lowerCaseResource == "vksurface") { + if (window->surfaceType() == QSurface::VulkanSurface && window->handle()) { + // return a pointer to the VkSurfaceKHR value, not the value itself + return static_cast(window->handle())->surface(); + } + } +#endif + if (auto shellIntegration = m_integration->shellIntegration()) return shellIntegration->nativeResourceForWindow(resourceString, window); diff --git a/src/plugins/platforms/wayland/qwaylandvulkaninstance.cpp b/src/plugins/platforms/wayland/qwaylandvulkaninstance.cpp new file mode 100644 index 00000000000..5edbd4757d6 --- /dev/null +++ b/src/plugins/platforms/wayland/qwaylandvulkaninstance.cpp @@ -0,0 +1,132 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qwaylandvulkaninstance_p.h" +#include "qwaylandwindow_p.h" +#include "qwaylandscreen_p.h" +#include "qwaylanddisplay_p.h" + +QT_BEGIN_NAMESPACE + +namespace QtWaylandClient { + +QWaylandVulkanInstance::QWaylandVulkanInstance(QVulkanInstance *instance) + : m_instance(instance) +{ + loadVulkanLibrary(QStringLiteral("vulkan")); +} + +QWaylandVulkanInstance::~QWaylandVulkanInstance() = default; + +void QWaylandVulkanInstance::createOrAdoptInstance() +{ + QByteArrayList extraExtensions; + extraExtensions << QByteArrayLiteral("VK_KHR_wayland_surface"); + initInstance(m_instance, extraExtensions); + + if (!m_vkInst) + return; + + m_getPhysDevPresSupport = reinterpret_cast( + m_vkGetInstanceProcAddr(m_vkInst, "vkGetPhysicalDeviceWaylandPresentationSupportKHR")); + if (!m_getPhysDevPresSupport) + qWarning() << "Failed to find vkGetPhysicalDeviceWaylandPresentationSupportKHR"; +} + +bool QWaylandVulkanInstance::supportsPresent(VkPhysicalDevice physicalDevice, + uint32_t queueFamilyIndex, + QWindow *window) +{ + if (!m_getPhysDevPresSupport || !m_getPhysDevSurfaceSupport) + return true; + + auto *w = static_cast(window->handle()); + if (!w) { + qWarning() << "Attempted to call supportsPresent() without a valid platform window"; + return false; + } + wl_display *display = w->display()->wl_display(); + bool ok = m_getPhysDevPresSupport(physicalDevice, queueFamilyIndex, display); + + VkSurfaceKHR surface = QVulkanInstance::surfaceForWindow(window); + VkBool32 supported = false; + m_getPhysDevSurfaceSupport(physicalDevice, queueFamilyIndex, surface, &supported); + ok &= bool(supported); + + return ok; +} + +VkSurfaceKHR QWaylandVulkanInstance::createSurface(QWaylandWindow *window) +{ + VkSurfaceKHR surface = VK_NULL_HANDLE; + + if (!m_createSurface) { + m_createSurface = reinterpret_cast( + m_vkGetInstanceProcAddr(m_vkInst, "vkCreateWaylandSurfaceKHR")); + } + if (!m_createSurface) { + qWarning() << "Failed to find vkCreateWaylandSurfaceKHR"; + return surface; + } + + VkWaylandSurfaceCreateInfoKHR surfaceInfo; + memset(&surfaceInfo, 0, sizeof(surfaceInfo)); + surfaceInfo.sType = VK_STRUCTURE_TYPE_WAYLAND_SURFACE_CREATE_INFO_KHR; + surfaceInfo.display = window->display()->wl_display(); + surfaceInfo.surface = window->wlSurface(); + VkResult err = m_createSurface(m_vkInst, &surfaceInfo, nullptr, &surface); + if (err != VK_SUCCESS) + qWarning("Failed to create Vulkan surface: %d", err); + + return surface; +} + +void QWaylandVulkanInstance::presentAboutToBeQueued(QWindow *window) +{ + auto *w = static_cast(window->handle()); + if (!w) { + qWarning() << "Attempted to call presentAboutToBeQueued() without a valid platform window"; + return; + } + w->handleUpdate(); +} + +} // namespace QtWaylandClient + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandvulkaninstance_p.h b/src/plugins/platforms/wayland/qwaylandvulkaninstance_p.h new file mode 100644 index 00000000000..b68293b78d2 --- /dev/null +++ b/src/plugins/platforms/wayland/qwaylandvulkaninstance_p.h @@ -0,0 +1,80 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWAYLANDVULKANINSTANCE_P_H +#define QWAYLANDVULKANINSTANCE_P_H + +#if defined(VULKAN_H_) && !defined(VK_USE_PLATFORM_WAYLAND_KHR) +#error "vulkan.h included without Wayland WSI" +#endif + +#define VK_USE_PLATFORM_WAYLAND_KHR + +#include +#include + +QT_BEGIN_NAMESPACE + +namespace QtWaylandClient { + +class QWaylandWindow; + +class QWaylandVulkanInstance : public QBasicPlatformVulkanInstance +{ +public: + explicit QWaylandVulkanInstance(QVulkanInstance *instance); + ~QWaylandVulkanInstance() override; + + void createOrAdoptInstance() override; + bool supportsPresent(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, QWindow *window) override; + void presentAboutToBeQueued(QWindow *window) override; + + VkSurfaceKHR createSurface(QWaylandWindow *window); + +private: + QVulkanInstance *m_instance = nullptr; + PFN_vkGetPhysicalDeviceWaylandPresentationSupportKHR m_getPhysDevPresSupport = nullptr; + PFN_vkCreateWaylandSurfaceKHR m_createSurface = nullptr; +}; + +} // namespace QtWaylandClient + +QT_END_NAMESPACE + +#endif // QWAYLANDVULKANINSTANCE_P_H diff --git a/src/plugins/platforms/wayland/qwaylandvulkanwindow.cpp b/src/plugins/platforms/wayland/qwaylandvulkanwindow.cpp new file mode 100644 index 00000000000..4c67b6b3287 --- /dev/null +++ b/src/plugins/platforms/wayland/qwaylandvulkanwindow.cpp @@ -0,0 +1,84 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qwaylandvulkanwindow_p.h" + +QT_BEGIN_NAMESPACE + +namespace QtWaylandClient { + +QWaylandVulkanWindow::QWaylandVulkanWindow(QWindow *window) + : QWaylandWindow(window) +{ +} + +QWaylandVulkanWindow::~QWaylandVulkanWindow() +{ + if (m_surface) { + QVulkanInstance *inst = window()->vulkanInstance(); + if (inst) + static_cast(inst->handle())->destroySurface(m_surface); + } +} + +QWaylandWindow::WindowType QWaylandVulkanWindow::windowType() const +{ + return QWaylandWindow::Vulkan; +} + +VkSurfaceKHR *QWaylandVulkanWindow::surface() +{ + if (m_surface) + return &m_surface; + + QVulkanInstance *vulkanInstance = window()->vulkanInstance(); + if (!vulkanInstance) { + qWarning() << "Attempted to create Vulkan surface without an instance; was QWindow::setVulkanInstance() called?"; + return nullptr; + } + + auto *waylandVulkanInstance = static_cast(vulkanInstance->handle()); + m_surface = waylandVulkanInstance->createSurface(this); + + return &m_surface; +} + +} // namespace QtWaylandClient + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandvulkanwindow_p.h b/src/plugins/platforms/wayland/qwaylandvulkanwindow_p.h new file mode 100644 index 00000000000..d0b2de75d03 --- /dev/null +++ b/src/plugins/platforms/wayland/qwaylandvulkanwindow_p.h @@ -0,0 +1,68 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWAYLANDVULKANWINDOW_P_H +#define QWAYLANDVULKANWINDOW_P_H + +#include "qwaylandwindow_p.h" +#include "qwaylandvulkaninstance_p.h" + +QT_BEGIN_NAMESPACE + +namespace QtWaylandClient { + +class QWaylandVulkanWindow : public QWaylandWindow +{ +public: + explicit QWaylandVulkanWindow(QWindow *window); + ~QWaylandVulkanWindow() override; + + WindowType windowType() const override; + + VkSurfaceKHR *surface(); + +private: + VkSurfaceKHR m_surface = VK_NULL_HANDLE; +}; + +} // namespace QtWaylandClient + +QT_END_NAMESPACE + +#endif // QWAYLANDVULKANWINDOW_P_H diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index 52e57c72ae0..8d582eb7e4c 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -89,7 +89,8 @@ class Q_WAYLAND_CLIENT_EXPORT QWaylandWindow : public QObject, public QPlatformW public: enum WindowType { Shm, - Egl + Egl, + Vulkan }; QWaylandWindow(QWindow *window); From 68e70fd9507319af4a2971b797077d1994ff9a9f Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Thu, 31 Oct 2019 10:02:09 +0100 Subject: [PATCH 0779/1507] Set temporary XDG_RUNTIME_DIR for more tests Some tests were left out when we switched to using a temporary XDG_RUNTIME_DIR. Fixes: QTBUG-79652 Change-Id: I8208d63f3f6a937406d25b1a8cf3f5b0be04bc73 Reviewed-by: Paul Olav Tvete Reviewed-by: Pier Luigi Fiorini --- tests/auto/wayland/fullscreenshellv1/tst_fullscreenshellv1.cpp | 3 ++- tests/auto/wayland/xdgshellv6/tst_xdgshellv6.cpp | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/auto/wayland/fullscreenshellv1/tst_fullscreenshellv1.cpp b/tests/auto/wayland/fullscreenshellv1/tst_fullscreenshellv1.cpp index f93d9fbc5d2..55158474c3e 100644 --- a/tests/auto/wayland/fullscreenshellv1/tst_fullscreenshellv1.cpp +++ b/tests/auto/wayland/fullscreenshellv1/tst_fullscreenshellv1.cpp @@ -93,7 +93,8 @@ void tst_WaylandClientFullScreenShellV1::createDestroyWindow() int main(int argc, char **argv) { - setenv("XDG_RUNTIME_DIR", ".", 1); + QTemporaryDir tmpRuntimeDir; + setenv("XDG_RUNTIME_DIR", tmpRuntimeDir.path().toLocal8Bit(), 1); setenv("QT_QPA_PLATFORM", "wayland", 1); // force QGuiApplication to use wayland plugin setenv("QT_WAYLAND_SHELL_INTEGRATION", "fullscreen-shell-v1", 1); setenv("QT_WAYLAND_DISABLE_WINDOWDECORATION", "1", 1); // window decorations don't make much sense here diff --git a/tests/auto/wayland/xdgshellv6/tst_xdgshellv6.cpp b/tests/auto/wayland/xdgshellv6/tst_xdgshellv6.cpp index a397f60eb4e..9885ee2bc68 100644 --- a/tests/auto/wayland/xdgshellv6/tst_xdgshellv6.cpp +++ b/tests/auto/wayland/xdgshellv6/tst_xdgshellv6.cpp @@ -422,7 +422,8 @@ void tst_WaylandClientXdgShellV6::dontSpamExposeEvents() int main(int argc, char **argv) { - setenv("XDG_RUNTIME_DIR", ".", 1); + QTemporaryDir tmpRuntimeDir; + setenv("XDG_RUNTIME_DIR", tmpRuntimeDir.path().toLocal8Bit(), 1); setenv("QT_QPA_PLATFORM", "wayland", 1); // force QGuiApplication to use wayland plugin setenv("QT_WAYLAND_SHELL_INTEGRATION", "xdg-shell-v6", 1); From 5e5235e0e621f782fbec4ccb3cd340ea0ce5f917 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Wed, 30 Oct 2019 08:59:49 +0100 Subject: [PATCH 0780/1507] Client tests: Fix flaky deadlock Sometimes the test would wait indefinitely in the compositor constructor, while also waiting in the compositor thread for m_ready to become true. m_ready is set to true in applicationInitialized(), which is supposed to be called from the client thread after QGuiApplication has been created (and also after the MockCompositor constructor has returned). I.e. the problem is that the wake in MockCompositor::run may sometimes happen before the MockCompositor::MockCompositor starts waiting. Move the wake inside the pre-initialized compositor loop. Essentially waking every 20 ms until the application is initialized. Fixes: QTBUG-66570 Change-Id: Ia5eba5d08ce4d1d3eeca99eae6cfa7d9d4fd5a0b Reviewed-by: Paul Olav Tvete --- tests/auto/wayland/shared_old/mockcompositor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/wayland/shared_old/mockcompositor.cpp b/tests/auto/wayland/shared_old/mockcompositor.cpp index 0dfaef5eaa6..96dc059e794 100644 --- a/tests/auto/wayland/shared_old/mockcompositor.cpp +++ b/tests/auto/wayland/shared_old/mockcompositor.cpp @@ -312,9 +312,9 @@ void *MockCompositor::run(void *data) Impl::Compositor compositor(controller); controller->m_compositor = &compositor; - controller->m_waitCondition.wakeOne(); while (!controller->m_ready) { + controller->m_waitCondition.wakeOne(); controller->dispatchCommands(); compositor.dispatchEvents(20); } From 027f48b7d949ce2de688f82c8af6ea5323615f35 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Fri, 1 Nov 2019 10:14:20 +0100 Subject: [PATCH 0781/1507] Add basic client test for subsurfaces Change-Id: I1ef21287933a2afccad989f47e4fe59329b6f537 Reviewed-by: Paul Olav Tvete --- tests/auto/wayland/shared/coreprotocol.h | 25 +++++++++++++++++++++- tests/auto/wayland/shared/mockcompositor.h | 1 + tests/auto/wayland/surface/tst_surface.cpp | 18 ++++++++++++++++ 3 files changed, 43 insertions(+), 1 deletion(-) diff --git a/tests/auto/wayland/shared/coreprotocol.h b/tests/auto/wayland/shared/coreprotocol.h index 5cef476c8f6..f92842e025d 100644 --- a/tests/auto/wayland/shared/coreprotocol.h +++ b/tests/auto/wayland/shared/coreprotocol.h @@ -163,6 +163,16 @@ protected: } }; +class Subsurface : public QObject, public QtWaylandServer::wl_subsurface +{ + Q_OBJECT +public: + explicit Subsurface(wl_client *client, int id, int version) + : QtWaylandServer::wl_subsurface(client, id, version) + { + } +}; + class SubCompositor : public Global, public QtWaylandServer::wl_subcompositor { Q_OBJECT @@ -170,7 +180,20 @@ public: explicit SubCompositor(CoreCompositor *compositor, int version = 1) : QtWaylandServer::wl_subcompositor(compositor->m_display, version) {} - // TODO + QVector m_subsurfaces; + +signals: + void subsurfaceCreated(Subsurface *subsurface); + +protected: + void subcompositor_get_subsurface(Resource *resource, uint32_t id, ::wl_resource *surface, ::wl_resource *parent) override + { + QTRY_VERIFY(parent); + QTRY_VERIFY(surface); + auto *subsurface = new Subsurface(resource->client(), id, resource->version()); + m_subsurfaces.append(subsurface); // TODO: clean up? + emit subsurfaceCreated(subsurface); + } }; struct OutputMode { diff --git a/tests/auto/wayland/shared/mockcompositor.h b/tests/auto/wayland/shared/mockcompositor.h index f5264ccf611..f17c934261e 100644 --- a/tests/auto/wayland/shared/mockcompositor.h +++ b/tests/auto/wayland/shared/mockcompositor.h @@ -50,6 +50,7 @@ public: // Convenience functions Output *output(int i = 0) { return getAll().value(i, nullptr); } Surface *surface(int i = 0) { return get()->m_surfaces.value(i, nullptr); } + Subsurface *subSurface(int i = 0) { return get()->m_subsurfaces.value(i, nullptr); } XdgSurface *xdgSurface(int i = 0) { return get()->m_xdgSurfaces.value(i, nullptr); } XdgToplevel *xdgToplevel(int i = 0) { return get()->toplevel(i); } XdgPopup *xdgPopup(int i = 0) { return get()->popup(i); } diff --git a/tests/auto/wayland/surface/tst_surface.cpp b/tests/auto/wayland/surface/tst_surface.cpp index dddff0866f0..451fbac75b6 100644 --- a/tests/auto/wayland/surface/tst_surface.cpp +++ b/tests/auto/wayland/surface/tst_surface.cpp @@ -41,6 +41,8 @@ private slots: void waitForFrameCallbackRaster(); void waitForFrameCallbackGl(); void negotiateShmFormat(); + + void createSubsurface(); }; void tst_surface::createDestroySurface() @@ -154,5 +156,21 @@ void tst_surface::negotiateShmFormat() }); } +void tst_surface::createSubsurface() +{ + QRasterWindow window; + window.resize(64, 64); + window.show(); + QCOMPOSITOR_TRY_VERIFY(xdgToplevel()); + exec([=] { xdgToplevel()->sendCompleteConfigure(); }); + QCOMPOSITOR_TRY_VERIFY(xdgSurface()->m_committedConfigureSerial); + + QRasterWindow subWindow; + subWindow.setParent(&window); + subWindow.resize(64, 64); + subWindow.show(); + QCOMPOSITOR_TRY_VERIFY(subSurface()); +} + QCOMPOSITOR_TEST_MAIN(tst_surface) #include "tst_surface.moc" From 8d409b0952c0d62a4001d0b448fa2bd5d55a120b Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Fri, 1 Nov 2019 11:24:26 +0100 Subject: [PATCH 0782/1507] Client: Fix crash when showing a child window with a hidden parent [ChangeLog][QPA plugin] Fixed a crash when showing a window with a hidden parent. Now we just avoid creating the subsurface, so nothing is shown. Seems to be the same behavior as on xcb. Fixes: QTBUG-79674 Change-Id: Ia46fcd9a0da5aad4704816a41515cb1e128ac65f Reviewed-by: Paul Olav Tvete --- src/plugins/platforms/wayland/qwaylanddisplay.cpp | 4 ++++ src/plugins/platforms/wayland/qwaylandwindow.cpp | 7 ++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index 78524f6fcaf..27e38ccf7cc 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -109,6 +109,10 @@ struct ::wl_region *QWaylandDisplay::createRegion(const QRegion &qregion) return nullptr; } + // Make sure we don't pass NULL surfaces to libwayland (crashes) + Q_ASSERT(parent->object()); + Q_ASSERT(window->object()); + return mSubCompositor->get_subsurface(window->object(), parent->object()); } diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 8d34afd1f11..7098568b4e5 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -124,9 +124,10 @@ void QWaylandWindow::initWindow() if (shouldCreateSubSurface()) { Q_ASSERT(!mSubSurfaceWindow); - QWaylandWindow *p = static_cast(QPlatformWindow::parent()); - if (::wl_subsurface *ss = mDisplay->createSubSurface(this, p)) { - mSubSurfaceWindow = new QWaylandSubSurface(this, p, ss); + auto *parent = static_cast(QPlatformWindow::parent()); + if (parent->object()) { + if (::wl_subsurface *subsurface = mDisplay->createSubSurface(this, parent)) + mSubSurfaceWindow = new QWaylandSubSurface(this, parent, subsurface); } } else if (shouldCreateShellSurface()) { Q_ASSERT(!mShellSurface); From 41216bedd4a5eba1b12dacdad2c6368ac8978c77 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Fri, 1 Nov 2019 10:16:43 +0100 Subject: [PATCH 0783/1507] Add client test for subsurface with hidden parent Task-number: QTBUG-79674 Change-Id: I451ee4423dee511f41070498a61167912920c086 Reviewed-by: Paul Olav Tvete --- tests/auto/wayland/surface/tst_surface.cpp | 23 ++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/tests/auto/wayland/surface/tst_surface.cpp b/tests/auto/wayland/surface/tst_surface.cpp index 451fbac75b6..f9dcec58117 100644 --- a/tests/auto/wayland/surface/tst_surface.cpp +++ b/tests/auto/wayland/surface/tst_surface.cpp @@ -42,7 +42,9 @@ private slots: void waitForFrameCallbackGl(); void negotiateShmFormat(); + // Subsurfaces void createSubsurface(); + void createSubsurfaceForHiddenParent(); }; void tst_surface::createDestroySurface() @@ -172,5 +174,26 @@ void tst_surface::createSubsurface() QCOMPOSITOR_TRY_VERIFY(subSurface()); } +// Used to cause a crash in libwayland (QTBUG-79674) +void tst_surface::createSubsurfaceForHiddenParent() +{ + QRasterWindow window; + window.resize(64, 64); + window.show(); + QCOMPOSITOR_TRY_VERIFY(xdgToplevel()); + exec([=] { xdgToplevel()->sendCompleteConfigure(); }); + QCOMPOSITOR_TRY_VERIFY(xdgSurface()->m_committedConfigureSerial); + + window.hide(); + + QRasterWindow subWindow; + subWindow.setParent(&window); + subWindow.resize(64, 64); + subWindow.show(); + + // Make sure the client doesn't quit before it has a chance to crash + xdgPingAndWaitForPong(); +} + QCOMPOSITOR_TEST_MAIN(tst_surface) #include "tst_surface.moc" From 9d186a4dd5c0f8a22ff06e8382cd925c24201e13 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Mon, 4 Nov 2019 14:21:18 +0100 Subject: [PATCH 0784/1507] Fix touch being ignored when down and motion are in the same frame The Wayland protocol gives no guarantees about which events are part of a frame, so handle the case where we receive wl_touch.down and wl_touch.motion within the same frame. Fixes: QTBUG-79744 Change-Id: I5dd9302576d81da38e003c8e7e74da6a98def603 Reviewed-by: Paul Olav Tvete --- src/plugins/platforms/wayland/qwaylandinputdevice.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index 8f3df8e4dda..193ce714b8b 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -1062,7 +1062,10 @@ void QWaylandInputDevice::handleTouchPoint(int id, Qt::TouchPointState state, co tp.area.moveCenter(globalPosition); } - tp.state = state; + // If the touch point was pressed earlier this frame, we don't want to overwrite its state. + if (tp.state != Qt::TouchPointPressed) + tp.state = state; + tp.pressure = tp.state == Qt::TouchPointReleased ? 0 : 1; } From bf1336af6a2f260d9c198356eb2ff0abfcb55c8b Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Thu, 7 Nov 2019 09:56:55 +0100 Subject: [PATCH 0785/1507] Fix race condition in tests on xdg_toplevel configure Tests should not use non-direct connections, as that means tests can run when the compositor is not locked. Change-Id: I7b1f0e3bb866db540f72307ad96f778ec0edd7ee Reviewed-by: Paul Olav Tvete --- tests/auto/wayland/shared/mockcompositor.cpp | 11 ++++------- tests/auto/wayland/shared/xdgshell.cpp | 2 +- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/tests/auto/wayland/shared/mockcompositor.cpp b/tests/auto/wayland/shared/mockcompositor.cpp index 6b9af4295b8..0711c5d8e56 100644 --- a/tests/auto/wayland/shared/mockcompositor.cpp +++ b/tests/auto/wayland/shared/mockcompositor.cpp @@ -58,13 +58,10 @@ DefaultCompositor::DefaultCompositor() }); }); - QObject::connect(get(), &XdgWmBase::toplevelCreated, [&] (XdgToplevel *toplevel) { - // Needed because lambdas don't support Qt::DirectConnection - exec([&]{ - if (m_config.autoConfigure) - toplevel->sendCompleteConfigure(); - }); - }); + QObject::connect(get(), &XdgWmBase::toplevelCreated, get(), [&] (XdgToplevel *toplevel) { + if (m_config.autoConfigure) + toplevel->sendCompleteConfigure(); + }, Qt::DirectConnection); } Q_ASSERT(isClean()); } diff --git a/tests/auto/wayland/shared/xdgshell.cpp b/tests/auto/wayland/shared/xdgshell.cpp index 13acc01e219..72582f48d7f 100644 --- a/tests/auto/wayland/shared/xdgshell.cpp +++ b/tests/auto/wayland/shared/xdgshell.cpp @@ -83,7 +83,7 @@ XdgSurface::XdgSurface(XdgWmBase *xdgWmBase, Surface *surface, wl_client *client { QVERIFY(!surface->m_pending.buffer); QVERIFY(!surface->m_committed.buffer); - connect(this, &XdgSurface::toplevelCreated, xdgWmBase, &XdgWmBase::toplevelCreated); + connect(this, &XdgSurface::toplevelCreated, xdgWmBase, &XdgWmBase::toplevelCreated, Qt::DirectConnection); connect(surface, &Surface::attach, this, &XdgSurface::verifyConfigured); connect(surface, &Surface::commit, this, [this] { m_committed = m_pending; From b5f100975d4d36f292f8a4cc23c1a7f9f3ddfb79 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Mon, 28 Oct 2019 12:05:09 +0100 Subject: [PATCH 0786/1507] Client: Support running with no screens [ChangeLog][QPA plugin] The QPA plugin now supports running with no screens attached. This is handled by adding a fake screen when the last screen is disconnected, similarly to what the other QPA plugins do. Fixes: QTBUG-79111 Change-Id: I4a0e023ae784217dd030f0c62f12487fdff4825c Reviewed-by: Paul Olav Tvete --- .../qwaylandfullscreenshellv1surface.cpp | 5 +++-- .../platforms/wayland/qwaylanddisplay.cpp | 22 +++++++++++++++++-- .../platforms/wayland/qwaylanddisplay_p.h | 4 ++++ .../platforms/wayland/qwaylandintegration.cpp | 12 +++++----- .../platforms/wayland/qwaylandscreen.cpp | 13 +++++++++-- .../platforms/wayland/qwaylandscreen_p.h | 1 - .../wayland/qwaylandshmbackingstore.cpp | 4 ++-- .../wayland/qwaylandshmbackingstore_p.h | 2 +- .../platforms/wayland/qwaylandshmwindow.cpp | 4 ++-- .../platforms/wayland/qwaylandshmwindow_p.h | 2 +- .../platforms/wayland/qwaylandsurface.cpp | 8 +++++-- .../wayland/qwaylandvulkanwindow.cpp | 4 ++-- .../wayland/qwaylandvulkanwindow_p.h | 2 +- .../platforms/wayland/qwaylandwindow.cpp | 20 ++++++++++------- .../platforms/wayland/qwaylandwindow_p.h | 6 ++--- 15 files changed, 73 insertions(+), 36 deletions(-) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/fullscreen-shell-v1/qwaylandfullscreenshellv1surface.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/fullscreen-shell-v1/qwaylandfullscreenshellv1surface.cpp index 26f598895c3..636ef08074b 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/fullscreen-shell-v1/qwaylandfullscreenshellv1surface.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/fullscreen-shell-v1/qwaylandfullscreenshellv1surface.cpp @@ -50,10 +50,11 @@ QWaylandFullScreenShellV1Surface::QWaylandFullScreenShellV1Surface(QtWayland::zw , m_shell(shell) , m_window(window) { - auto screen = static_cast(m_window->screen()); + auto *screen = m_window->waylandScreen(); + auto *output = screen ? screen->output() : nullptr; m_shell->present_surface(m_window->wlSurface(), QtWayland::zwp_fullscreen_shell_v1::present_method_default, - screen->output()); + output); } } // namespace QtWaylandClient diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index 0464d3a4273..a8d19dc6c51 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -188,6 +188,18 @@ QWaylandDisplay::~QWaylandDisplay(void) wl_display_disconnect(mDisplay); } +void QWaylandDisplay::ensureScreen() +{ + if (!mScreens.empty() || mPlaceholderScreen) + return; // There are real screens or we already have a fake one + + qCInfo(lcQpaWayland) << "Creating a fake screen in order for Qt not to crash"; + + mPlaceholderScreen = new QPlatformPlaceholderScreen(); + QWindowSystemInterface::handleScreenAdded(mPlaceholderScreen); + Q_ASSERT(!QGuiApplication::screens().empty()); +} + void QWaylandDisplay::checkError() const { int ecode = wl_display_get_error(mDisplay); @@ -253,8 +265,7 @@ void QWaylandDisplay::dispatchQueueWhile(wl_event_queue *queue, std::function(mScreens.at(i)); + for (auto screen : qAsConst(mScreens)) { if (screen->output() == output) return screen; } @@ -267,6 +278,11 @@ void QWaylandDisplay::handleScreenInitialized(QWaylandScreen *screen) return; mScreens.append(screen); QWindowSystemInterface::handleScreenAdded(screen); + if (mPlaceholderScreen) { + QWindowSystemInterface::handleScreenRemoved(mPlaceholderScreen); + // handleScreenRemoved deletes the platform screen + mPlaceholderScreen = nullptr; + } } void QWaylandDisplay::waitForScreens() @@ -362,6 +378,8 @@ void QWaylandDisplay::registry_global_remove(uint32_t id) for (QWaylandScreen *screen : qAsConst(mScreens)) { if (screen->outputId() == id) { mScreens.removeOne(screen); + // If this is the last screen, we have to add a fake screen, or Qt will break. + ensureScreen(); QWindowSystemInterface::handleScreenRemoved(screen); break; } diff --git a/src/plugins/platforms/wayland/qwaylanddisplay_p.h b/src/plugins/platforms/wayland/qwaylanddisplay_p.h index 14bb7719841..cd845b44e35 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay_p.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay_p.h @@ -76,6 +76,7 @@ QT_BEGIN_NAMESPACE class QAbstractEventDispatcher; class QSocketNotifier; class QPlatformScreen; +class QPlatformPlaceholderScreen; namespace QtWayland { class qt_surface_extension; @@ -124,6 +125,8 @@ public: #endif QList screens() const { return mScreens; } + QPlatformPlaceholderScreen *placeholderScreen() const { return mPlaceholderScreen; } + void ensureScreen(); QWaylandScreen *screenForOutput(struct wl_output *output) const; void handleScreenInitialized(QWaylandScreen *screen); @@ -228,6 +231,7 @@ private: QScopedPointer mShm; QList mWaitingScreens; QList mScreens; + QPlatformPlaceholderScreen *mPlaceholderScreen = nullptr; QList mInputDevices; QList mRegistryListeners; QWaylandIntegration *mWaylandIntegration = nullptr; diff --git a/src/plugins/platforms/wayland/qwaylandintegration.cpp b/src/plugins/platforms/wayland/qwaylandintegration.cpp index 9bdd9cc129f..33e64c6e890 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandintegration.cpp @@ -165,10 +165,10 @@ QPlatformWindow *QWaylandIntegration::createPlatformWindow(QWindow *window) cons #if QT_CONFIG(vulkan) if (window->surfaceType() == QSurface::VulkanSurface) - return new QWaylandVulkanWindow(window); + return new QWaylandVulkanWindow(window, mDisplay.data()); #endif // QT_CONFIG(vulkan) - return new QWaylandShmWindow(window); + return new QWaylandShmWindow(window, mDisplay.data()); } #if QT_CONFIG(opengl) @@ -182,7 +182,7 @@ QPlatformOpenGLContext *QWaylandIntegration::createPlatformOpenGLContext(QOpenGL QPlatformBackingStore *QWaylandIntegration::createPlatformBackingStore(QWindow *window) const { - return new QWaylandShmBackingStore(window); + return new QWaylandShmBackingStore(window, mDisplay.data()); } QAbstractEventDispatcher *QWaylandIntegration::createEventDispatcher() const @@ -200,10 +200,8 @@ void QWaylandIntegration::initialize() QSocketNotifier *sn = new QSocketNotifier(fd, QSocketNotifier::Read, mDisplay.data()); QObject::connect(sn, SIGNAL(activated(int)), mDisplay.data(), SLOT(flushRequests())); - if (mDisplay->screens().isEmpty()) { - qWarning() << "Running on a compositor with no screens is not supported"; - ::exit(EXIT_FAILURE); - } + // Qt does not support running with no screens + mDisplay->ensureScreen(); } QPlatformFontDatabase *QWaylandIntegration::fontDatabase() const diff --git a/src/plugins/platforms/wayland/qwaylandscreen.cpp b/src/plugins/platforms/wayland/qwaylandscreen.cpp index e707968322d..4f0cd9b0a60 100644 --- a/src/plugins/platforms/wayland/qwaylandscreen.cpp +++ b/src/plugins/platforms/wayland/qwaylandscreen.cpp @@ -165,11 +165,18 @@ QList QWaylandScreen::virtualSiblings() const { QList list; const QList screens = mWaylandDisplay->screens(); - list.reserve(screens.count()); + auto *placeholder = mWaylandDisplay->placeholderScreen(); + + list.reserve(screens.count() + (placeholder ? 1 : 0)); + for (QWaylandScreen *screen : qAsConst(screens)) { if (screen->screen()) list << screen; } + + if (placeholder) + list << placeholder; + return list; } @@ -210,9 +217,11 @@ QPlatformCursor *QWaylandScreen::cursor() const } #endif // QT_CONFIG(cursor) -QWaylandScreen * QWaylandScreen::waylandScreenFromWindow(QWindow *window) +QWaylandScreen *QWaylandScreen::waylandScreenFromWindow(QWindow *window) { QPlatformScreen *platformScreen = QPlatformScreen::platformScreenForWindow(window); + if (platformScreen->isPlaceholder()) + return nullptr; return static_cast(platformScreen); } diff --git a/src/plugins/platforms/wayland/qwaylandscreen_p.h b/src/plugins/platforms/wayland/qwaylandscreen_p.h index e9e07d9cd50..ae91c621111 100644 --- a/src/plugins/platforms/wayland/qwaylandscreen_p.h +++ b/src/plugins/platforms/wayland/qwaylandscreen_p.h @@ -57,7 +57,6 @@ #include #include - QT_BEGIN_NAMESPACE namespace QtWaylandClient { diff --git a/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp b/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp index 9b5971a21e9..8d5b977d586 100644 --- a/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp +++ b/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp @@ -151,9 +151,9 @@ QImage *QWaylandShmBuffer::imageInsideMargins(const QMargins &marginsIn) } -QWaylandShmBackingStore::QWaylandShmBackingStore(QWindow *window) +QWaylandShmBackingStore::QWaylandShmBackingStore(QWindow *window, QWaylandDisplay *display) : QPlatformBackingStore(window) - , mDisplay(QWaylandScreen::waylandScreenFromWindow(window)->display()) + , mDisplay(display) { } diff --git a/src/plugins/platforms/wayland/qwaylandshmbackingstore_p.h b/src/plugins/platforms/wayland/qwaylandshmbackingstore_p.h index 8a85cd7f34a..e01632daf75 100644 --- a/src/plugins/platforms/wayland/qwaylandshmbackingstore_p.h +++ b/src/plugins/platforms/wayland/qwaylandshmbackingstore_p.h @@ -88,7 +88,7 @@ private: class Q_WAYLAND_CLIENT_EXPORT QWaylandShmBackingStore : public QPlatformBackingStore { public: - QWaylandShmBackingStore(QWindow *window); + QWaylandShmBackingStore(QWindow *window, QWaylandDisplay *display); ~QWaylandShmBackingStore() override; QPaintDevice *paintDevice() override; diff --git a/src/plugins/platforms/wayland/qwaylandshmwindow.cpp b/src/plugins/platforms/wayland/qwaylandshmwindow.cpp index 52833803db1..e305d028d56 100644 --- a/src/plugins/platforms/wayland/qwaylandshmwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandshmwindow.cpp @@ -49,8 +49,8 @@ QT_BEGIN_NAMESPACE namespace QtWaylandClient { -QWaylandShmWindow::QWaylandShmWindow(QWindow *window) - : QWaylandWindow(window) +QWaylandShmWindow::QWaylandShmWindow(QWindow *window, QWaylandDisplay *display) + : QWaylandWindow(window, display) { } diff --git a/src/plugins/platforms/wayland/qwaylandshmwindow_p.h b/src/plugins/platforms/wayland/qwaylandshmwindow_p.h index ae17278593b..81251b3aa96 100644 --- a/src/plugins/platforms/wayland/qwaylandshmwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandshmwindow_p.h @@ -61,7 +61,7 @@ namespace QtWaylandClient { class Q_WAYLAND_CLIENT_EXPORT QWaylandShmWindow : public QWaylandWindow { public: - QWaylandShmWindow(QWindow *window); + QWaylandShmWindow(QWindow *window, QWaylandDisplay *display); ~QWaylandShmWindow() override; WindowType windowType() const override; diff --git a/src/plugins/platforms/wayland/qwaylandsurface.cpp b/src/plugins/platforms/wayland/qwaylandsurface.cpp index c35f01b56c3..21e70ce4fe8 100644 --- a/src/plugins/platforms/wayland/qwaylandsurface.cpp +++ b/src/plugins/platforms/wayland/qwaylandsurface.cpp @@ -72,8 +72,12 @@ QWaylandSurface *QWaylandSurface::fromWlSurface(::wl_surface *surface) void QWaylandSurface::handleScreenRemoved(QScreen *qScreen) { - auto *screen = static_cast(qScreen->handle()); - if (m_screens.removeOne(screen)) + auto *platformScreen = qScreen->handle(); + if (platformScreen->isPlaceholder()) + return; + + auto *waylandScreen = static_cast(qScreen->handle()); + if (m_screens.removeOne(waylandScreen)) emit screensChanged(); } diff --git a/src/plugins/platforms/wayland/qwaylandvulkanwindow.cpp b/src/plugins/platforms/wayland/qwaylandvulkanwindow.cpp index 4c67b6b3287..eb341529aeb 100644 --- a/src/plugins/platforms/wayland/qwaylandvulkanwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandvulkanwindow.cpp @@ -43,8 +43,8 @@ QT_BEGIN_NAMESPACE namespace QtWaylandClient { -QWaylandVulkanWindow::QWaylandVulkanWindow(QWindow *window) - : QWaylandWindow(window) +QWaylandVulkanWindow::QWaylandVulkanWindow(QWindow *window, QWaylandDisplay *display) + : QWaylandWindow(window, display) { } diff --git a/src/plugins/platforms/wayland/qwaylandvulkanwindow_p.h b/src/plugins/platforms/wayland/qwaylandvulkanwindow_p.h index d0b2de75d03..3fd394e62ea 100644 --- a/src/plugins/platforms/wayland/qwaylandvulkanwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandvulkanwindow_p.h @@ -50,7 +50,7 @@ namespace QtWaylandClient { class QWaylandVulkanWindow : public QWaylandWindow { public: - explicit QWaylandVulkanWindow(QWindow *window); + explicit QWaylandVulkanWindow(QWindow *window, QWaylandDisplay *display); ~QWaylandVulkanWindow() override; WindowType windowType() const override; diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 950486c0cfe..751058d8914 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -73,9 +73,9 @@ Q_LOGGING_CATEGORY(lcWaylandBackingstore, "qt.qpa.wayland.backingstore") QWaylandWindow *QWaylandWindow::mMouseGrab = nullptr; -QWaylandWindow::QWaylandWindow(QWindow *window) +QWaylandWindow::QWaylandWindow(QWindow *window, QWaylandDisplay *display) : QPlatformWindow(window) - , mDisplay(waylandScreen()->display()) + , mDisplay(display) , mFrameQueue(mDisplay->createEventQueue()) , mResizeAfterSwap(qEnvironmentVariableIsSet("QT_WAYLAND_RESIZE_AFTER_SWAP")) { @@ -177,7 +177,7 @@ void QWaylandWindow::initWindow() } } - mScale = waylandScreen()->scale(); + mScale = waylandScreen() ? waylandScreen()->scale() : 1; // fallback to 1 if we don't have a real screen // Enable high-dpi rendering. Scale() returns the screen scale factor and will // typically be integer 1 (normal-dpi) or 2 (high-dpi). Call set_buffer_scale() @@ -402,14 +402,14 @@ void QWaylandWindow::closePopups(QWaylandWindow *parent) } } -QWaylandScreen *QWaylandWindow::calculateScreenFromSurfaceEvents() const +QPlatformScreen *QWaylandWindow::calculateScreenFromSurfaceEvents() const { if (mSurface) { if (auto *screen = mSurface->oldestEnteredScreen()) return screen; } - return waylandScreen(); + return QPlatformWindow::screen(); } void QWaylandWindow::setVisible(bool visible) @@ -690,7 +690,11 @@ QWaylandSubSurface *QWaylandWindow::subSurfaceWindow() const QWaylandScreen *QWaylandWindow::waylandScreen() const { - return static_cast(QPlatformWindow::screen()); + auto *platformScreen = QPlatformWindow::screen(); + Q_ASSERT(platformScreen); + if (platformScreen->isPlaceholder()) + return nullptr; + return static_cast(platformScreen); } void QWaylandWindow::handleContentOrientationChange(Qt::ScreenOrientation orientation) @@ -962,7 +966,7 @@ void QWaylandWindow::handleMouseEventWithDecoration(QWaylandInputDevice *inputDe void QWaylandWindow::handleScreensChanged() { - QWaylandScreen *newScreen = calculateScreenFromSurfaceEvents(); + QPlatformScreen *newScreen = calculateScreenFromSurfaceEvents(); if (newScreen == mLastReportedScreen) return; @@ -970,7 +974,7 @@ void QWaylandWindow::handleScreensChanged() QWindowSystemInterface::handleWindowScreenChanged(window(), newScreen->QPlatformScreen::screen()); mLastReportedScreen = newScreen; - int scale = newScreen->scale(); + int scale = newScreen->isPlaceholder() ? 1 : static_cast(newScreen)->scale(); if (scale != mScale) { mScale = scale; if (mSurface && mDisplay->compositorVersion() >= 3) diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index c488c2e3f42..36cbee89b62 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -93,7 +93,7 @@ public: Vulkan }; - QWaylandWindow(QWindow *window); + QWaylandWindow(QWindow *window, QWaylandDisplay *display); ~QWaylandWindow() override; virtual WindowType windowType() const = 0; @@ -241,7 +241,7 @@ protected: bool mSentInitialResize = false; QPoint mOffset; int mScale = 1; - QWaylandScreen *mLastReportedScreen = nullptr; + QPlatformScreen *mLastReportedScreen = nullptr; QIcon mWindowIcon; @@ -262,7 +262,7 @@ private: void reset(bool sendDestroyEvent = true); void sendExposeEvent(const QRect &rect); static void closePopups(QWaylandWindow *parent); - QWaylandScreen *calculateScreenFromSurfaceEvents() const; + QPlatformScreen *calculateScreenFromSurfaceEvents() const; void handleMouseEventWithDecoration(QWaylandInputDevice *inputDevice, const QWaylandPointerEvent &e); void handleScreensChanged(); From 3ba851c777f91e850c4eea4341d7b8ee3d4137ff Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Mon, 28 Oct 2019 12:05:09 +0100 Subject: [PATCH 0787/1507] Client: Add test for removing and adding a screen at runtime Task-number: QTBUG-79111 Change-Id: I4b8f08148850fe02972266936ba7d8d6ed1f36bb Reviewed-by: Paul Olav Tvete --- tests/auto/wayland/output/tst_output.cpp | 43 ++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/tests/auto/wayland/output/tst_output.cpp b/tests/auto/wayland/output/tst_output.cpp index 29c773cf65e..e9944f8157f 100644 --- a/tests/auto/wayland/output/tst_output.cpp +++ b/tests/auto/wayland/output/tst_output.cpp @@ -53,6 +53,7 @@ private slots: void windowScreens(); void removePrimaryScreen(); void screenOrder(); + void removeAllScreens(); }; void tst_output::primaryScreen() @@ -227,5 +228,47 @@ void tst_output::screenOrder() }); } +// This is different from tst_nooutput::noScreens because here we have a screen at platform +// integration initialization, which we then remove. +void tst_output::removeAllScreens() +{ + QRasterWindow window1; + window1.resize(400, 320); + window1.show(); + QCOMPOSITOR_TRY_VERIFY(xdgSurface(0) && xdgSurface(0)->m_committedConfigureSerial); + + const QString wlOutputPrimaryScreenModel = QGuiApplication::primaryScreen()->model(); + + // Get screen info so we can restore it after + auto screenInfo = exec([=] { return output()->m_data; }); + exec([=] { remove(output()); }); + + // Make sure the wl_output is actually removed before we continue + QTRY_VERIFY(!QGuiApplication::primaryScreen() || QGuiApplication::primaryScreen()->model() != wlOutputPrimaryScreenModel); + + // Adding a window while there are no screens should also work + QRasterWindow window2; + window2.resize(400, 320); + window2.show(); + + exec([=] { add(screenInfo); }); + + // Things should be back to normal + QTRY_VERIFY(QGuiApplication::primaryScreen()); + QTRY_COMPARE(QGuiApplication::primaryScreen()->model(), wlOutputPrimaryScreenModel); + + // Test that we don't leave any fake screens around after we get a wl_output back. + QTRY_COMPARE(QGuiApplication::screens().size(), 1); + + // Qt may choose to recreate/hide windows in response to changing screens, so give the client + // some time to potentially mess up before we verify that the windows are visible. + xdgPingAndWaitForPong(); + + // Windows should be visible after we've reconnected the screen + QCOMPOSITOR_TRY_VERIFY(xdgToplevel(0) && xdgToplevel(0)->m_xdgSurface->m_committedConfigureSerial); + QCOMPOSITOR_TRY_VERIFY(xdgToplevel(1) && xdgToplevel(1)->m_xdgSurface->m_committedConfigureSerial); + +} + QCOMPOSITOR_TEST_MAIN(tst_output) #include "tst_output.moc" From 857cbf07791cee60c79e2288e2c3c6357eb17ffe Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Fri, 15 Nov 2019 15:42:40 +0100 Subject: [PATCH 0788/1507] Fix spelling of linuxaccessibility_support-private Fixes issues with the cmake conversion tool. Task-number: QTBUG-78177 Change-Id: I49edbcba7494d1916cf6bf976148c9433615d8a0 Reviewed-by: Alexandru Croitor --- src/plugins/platforms/wayland/client.pro | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/wayland/client.pro b/src/plugins/platforms/wayland/client.pro index d0ae9009e94..32156470cba 100644 --- a/src/plugins/platforms/wayland/client.pro +++ b/src/plugins/platforms/wayland/client.pro @@ -19,8 +19,8 @@ qtConfig(xkbcommon) { QT_FOR_PRIVATE += xkbcommon_support-private } -qtHaveModule(linuxaccessibility_support_private): \ - QT_PRIVATE += linuxaccessibility_support_private +qtHaveModule(linuxaccessibility_support-private): \ + QT_PRIVATE += linuxaccessibility_support-private QMAKE_USE += wayland-client From 7279debf1b9d98efad609213037ccc23094783c9 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Wed, 18 Sep 2019 17:14:44 +0200 Subject: [PATCH 0789/1507] Initial CMake port The client, compositor, tests, plugins and examples now build. There are still a few minor issues: - The protocol source generation is a bit hacky. - The tests for checking if building CMake projects don't work anymore as they have Qt 5 specific code. They have just been commented out for now. Fixes: QTBUG-78177 Change-Id: Ie17cb05f0cdbd5b098970ce765adaeccf61a8fde Reviewed-by: Pier Luigi Fiorini Reviewed-by: Alexandru Croitor Reviewed-by: Qt CMake Build Bot --- src/platformsupport/wayland/CMakeLists.txt | 58 ++++++ .../platforms/wayland/.prev_CMakeLists.txt | 135 ++++++++++++ src/plugins/platforms/wayland/CMakeLists.txt | 135 ++++++++++++ src/plugins/platforms/wayland/configure.cmake | 194 ++++++++++++++++++ .../platforms/wayland/plugins/CMakeLists.txt | 8 + .../plugins/decorations/CMakeLists.txt | 3 + .../decorations/bradient/CMakeLists.txt | 22 ++ .../hardwareintegration/CMakeLists.txt | 29 +++ .../brcm-egl/CMakeLists.txt | 36 ++++ .../dmabuf-server/CMakeLists.txt | 32 +++ .../drm-egl-server/CMakeLists.txt | 32 +++ .../libhybris-egl-server/CMakeLists.txt | 31 +++ .../shm-emulation-server/CMakeLists.txt | 31 +++ .../vulkan-server/CMakeLists.txt | 31 +++ .../wayland-egl/CMakeLists.txt | 32 +++ .../xcomposite-egl/CMakeLists.txt | 40 ++++ .../xcomposite-glx/CMakeLists.txt | 39 ++++ .../plugins/shellintegration/CMakeLists.txt | 20 ++ .../fullscreen-shell-v1/CMakeLists.txt | 30 +++ .../shellintegration/wl-shell/CMakeLists.txt | 38 ++++ .../xdg-shell-v5/CMakeLists.txt | 40 ++++ .../xdg-shell-v6/CMakeLists.txt | 38 ++++ .../shellintegration/xdg-shell/CMakeLists.txt | 40 ++++ src/tools/qtwaylandscanner/CMakeLists.txt | 16 ++ .../Qt6WaylandClientMacros.cmake | 59 ++++++ .../Qt6WaylandCompositorMacros.cmake | 50 +++++ tests/auto/wayland/CMakeLists.txt | 19 ++ .../auto/wayland/client/.prev_CMakeLists.txt | 40 ++++ tests/auto/wayland/client/CMakeLists.txt | 41 ++++ .../wayland/datadevicev1/.prev_CMakeLists.txt | 31 +++ .../auto/wayland/datadevicev1/CMakeLists.txt | 32 +++ .../fullscreenshellv1/.prev_CMakeLists.txt | 37 ++++ .../wayland/fullscreenshellv1/CMakeLists.txt | 38 ++++ .../wayland/inputcontext/.prev_CMakeLists.txt | 31 +++ .../auto/wayland/inputcontext/CMakeLists.txt | 32 +++ .../iviapplication/.prev_CMakeLists.txt | 37 ++++ .../auto/wayland/output/.prev_CMakeLists.txt | 31 +++ tests/auto/wayland/output/CMakeLists.txt | 32 +++ .../primaryselectionv1/.prev_CMakeLists.txt | 32 +++ .../wayland/primaryselectionv1/CMakeLists.txt | 33 +++ .../auto/wayland/seatv4/.prev_CMakeLists.txt | 42 ++++ tests/auto/wayland/seatv4/CMakeLists.txt | 43 ++++ .../auto/wayland/seatv5/.prev_CMakeLists.txt | 31 +++ tests/auto/wayland/seatv5/CMakeLists.txt | 32 +++ .../auto/wayland/surface/.prev_CMakeLists.txt | 31 +++ tests/auto/wayland/surface/CMakeLists.txt | 32 +++ tests/auto/wayland/wl_connect/CMakeLists.txt | 14 ++ .../xdgdecorationv1/.prev_CMakeLists.txt | 32 +++ .../wayland/xdgdecorationv1/CMakeLists.txt | 33 +++ .../wayland/xdgoutput/.prev_CMakeLists.txt | 32 +++ tests/auto/wayland/xdgoutput/CMakeLists.txt | 33 +++ .../wayland/xdgshell/.prev_CMakeLists.txt | 31 +++ tests/auto/wayland/xdgshell/CMakeLists.txt | 32 +++ .../wayland/xdgshellv6/.prev_CMakeLists.txt | 37 ++++ tests/auto/wayland/xdgshellv6/CMakeLists.txt | 38 ++++ 55 files changed, 2178 insertions(+) create mode 100644 src/platformsupport/wayland/CMakeLists.txt create mode 100644 src/plugins/platforms/wayland/.prev_CMakeLists.txt create mode 100644 src/plugins/platforms/wayland/CMakeLists.txt create mode 100644 src/plugins/platforms/wayland/configure.cmake create mode 100644 src/plugins/platforms/wayland/plugins/CMakeLists.txt create mode 100644 src/plugins/platforms/wayland/plugins/decorations/CMakeLists.txt create mode 100644 src/plugins/platforms/wayland/plugins/decorations/bradient/CMakeLists.txt create mode 100644 src/plugins/platforms/wayland/plugins/hardwareintegration/CMakeLists.txt create mode 100644 src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/CMakeLists.txt create mode 100644 src/plugins/platforms/wayland/plugins/hardwareintegration/dmabuf-server/CMakeLists.txt create mode 100644 src/plugins/platforms/wayland/plugins/hardwareintegration/drm-egl-server/CMakeLists.txt create mode 100644 src/plugins/platforms/wayland/plugins/hardwareintegration/libhybris-egl-server/CMakeLists.txt create mode 100644 src/plugins/platforms/wayland/plugins/hardwareintegration/shm-emulation-server/CMakeLists.txt create mode 100644 src/plugins/platforms/wayland/plugins/hardwareintegration/vulkan-server/CMakeLists.txt create mode 100644 src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/CMakeLists.txt create mode 100644 src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-egl/CMakeLists.txt create mode 100644 src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-glx/CMakeLists.txt create mode 100644 src/plugins/platforms/wayland/plugins/shellintegration/CMakeLists.txt create mode 100644 src/plugins/platforms/wayland/plugins/shellintegration/fullscreen-shell-v1/CMakeLists.txt create mode 100644 src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/CMakeLists.txt create mode 100644 src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/CMakeLists.txt create mode 100644 src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/CMakeLists.txt create mode 100644 src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/CMakeLists.txt create mode 100644 src/tools/qtwaylandscanner/CMakeLists.txt create mode 100644 src/tools/qtwaylandscanner/Qt6WaylandClientMacros.cmake create mode 100644 src/tools/qtwaylandscanner/Qt6WaylandCompositorMacros.cmake create mode 100644 tests/auto/wayland/CMakeLists.txt create mode 100644 tests/auto/wayland/client/.prev_CMakeLists.txt create mode 100644 tests/auto/wayland/client/CMakeLists.txt create mode 100644 tests/auto/wayland/datadevicev1/.prev_CMakeLists.txt create mode 100644 tests/auto/wayland/datadevicev1/CMakeLists.txt create mode 100644 tests/auto/wayland/fullscreenshellv1/.prev_CMakeLists.txt create mode 100644 tests/auto/wayland/fullscreenshellv1/CMakeLists.txt create mode 100644 tests/auto/wayland/inputcontext/.prev_CMakeLists.txt create mode 100644 tests/auto/wayland/inputcontext/CMakeLists.txt create mode 100644 tests/auto/wayland/iviapplication/.prev_CMakeLists.txt create mode 100644 tests/auto/wayland/output/.prev_CMakeLists.txt create mode 100644 tests/auto/wayland/output/CMakeLists.txt create mode 100644 tests/auto/wayland/primaryselectionv1/.prev_CMakeLists.txt create mode 100644 tests/auto/wayland/primaryselectionv1/CMakeLists.txt create mode 100644 tests/auto/wayland/seatv4/.prev_CMakeLists.txt create mode 100644 tests/auto/wayland/seatv4/CMakeLists.txt create mode 100644 tests/auto/wayland/seatv5/.prev_CMakeLists.txt create mode 100644 tests/auto/wayland/seatv5/CMakeLists.txt create mode 100644 tests/auto/wayland/surface/.prev_CMakeLists.txt create mode 100644 tests/auto/wayland/surface/CMakeLists.txt create mode 100644 tests/auto/wayland/wl_connect/CMakeLists.txt create mode 100644 tests/auto/wayland/xdgdecorationv1/.prev_CMakeLists.txt create mode 100644 tests/auto/wayland/xdgdecorationv1/CMakeLists.txt create mode 100644 tests/auto/wayland/xdgoutput/.prev_CMakeLists.txt create mode 100644 tests/auto/wayland/xdgoutput/CMakeLists.txt create mode 100644 tests/auto/wayland/xdgshell/.prev_CMakeLists.txt create mode 100644 tests/auto/wayland/xdgshell/CMakeLists.txt create mode 100644 tests/auto/wayland/xdgshellv6/.prev_CMakeLists.txt create mode 100644 tests/auto/wayland/xdgshellv6/CMakeLists.txt diff --git a/src/platformsupport/wayland/CMakeLists.txt b/src/platformsupport/wayland/CMakeLists.txt new file mode 100644 index 00000000000..62c1adbec41 --- /dev/null +++ b/src/platformsupport/wayland/CMakeLists.txt @@ -0,0 +1,58 @@ +# Generated from src.pro. +# special case begin +qt_find_package(WaylandScanner PROVIDED_TARGETS Wayland::Scanner) +qt_find_package(Wayland) + +if (NOT WaylandScanner_FOUND OR NOT Wayland_FOUND) + message(WARNING "QtWayland is missing required dependencies, nothing will be built. \ +Although this could be considered an error, the configuration will still pass as coin (Qt's \ +continuous integration system) will fail the build if configure fails, but will still try to \ +configure the module on targets that are missing dependencies.") + return() +endif() + +# We conditionally add_subdirectory(client) based on a feature that is defined +# in client/configure.cmake, so we need this hack to make sure the feature is +# defined on this level as well. +# TODO: when we remove configure.json support and stop generating +# configure.cmake, we should move the features up one level and deduplicate the +# features shared with the compositor. +qt_feature_module_begin( + NO_MODULE + PUBLIC_FILE "qtwayland-client-config.h" + PRIVATE_FILE "qtwayland-client-config_p.h" +) +include("${CMAKE_CURRENT_SOURCE_DIR}/client/configure.cmake") +qt_feature_module_end(NO_MODULE) + +# Similar hack as above, but for the compositor +qt_feature_module_begin( + NO_MODULE + PUBLIC_FILE "qtwayland-compositor-config.h" + PRIVATE_FILE "qtwayland-compositor-config_p.h" +) +include("${CMAKE_CURRENT_SOURCE_DIR}/compositor/configure.cmake") +qt_feature_module_end(NO_MODULE) +# special case end + +add_subdirectory(qtwaylandscanner) + +# special case begin +# TODO: Ideally these macros would be part of the qtwaylandscanner tool, and not the compositor/client +include(client/Qt6WaylandClientMacros.cmake) +include(compositor/Qt6WaylandCompositorMacros.cmake) +#special case end + +if (QT_FEATURE_wayland_client) + add_subdirectory(client) +endif() + +if (QT_FEATURE_wayland_server) + add_subdirectory(compositor) +endif() + +if (QT_FEATURE_wayland_server OR QT_FEATURE_wayland_client) + add_subdirectory(plugins) + add_subdirectory(imports) +endif() +# special case end diff --git a/src/plugins/platforms/wayland/.prev_CMakeLists.txt b/src/plugins/platforms/wayland/.prev_CMakeLists.txt new file mode 100644 index 00000000000..274cf70d670 --- /dev/null +++ b/src/plugins/platforms/wayland/.prev_CMakeLists.txt @@ -0,0 +1,135 @@ +# Generated from client.pro. + +##################################################################### +## WaylandClient Module: +##################################################################### + +qt_add_module(WaylandClient + PLUGIN_TYPES wayland-graphics-integration-client wayland-inputdevice-integration wayland-decoration-client wayland-shell-integration + SOURCES + ../shared/qwaylandinputmethodeventbuilder.cpp ../shared/qwaylandinputmethodeventbuilder_p.h + ../shared/qwaylandmimehelper.cpp ../shared/qwaylandmimehelper_p.h + ../shared/qwaylandsharedmemoryformathelper_p.h + global/qwaylandclientextension.cpp global/qwaylandclientextension.h global/qwaylandclientextension_p.h + hardwareintegration/qwaylandclientbufferintegration.cpp hardwareintegration/qwaylandclientbufferintegration_p.h + hardwareintegration/qwaylandclientbufferintegrationfactory.cpp hardwareintegration/qwaylandclientbufferintegrationfactory_p.h + hardwareintegration/qwaylandclientbufferintegrationplugin.cpp hardwareintegration/qwaylandclientbufferintegrationplugin_p.h + hardwareintegration/qwaylandhardwareintegration.cpp hardwareintegration/qwaylandhardwareintegration_p.h + hardwareintegration/qwaylandserverbufferintegration.cpp hardwareintegration/qwaylandserverbufferintegration_p.h + hardwareintegration/qwaylandserverbufferintegrationfactory.cpp hardwareintegration/qwaylandserverbufferintegrationfactory_p.h + hardwareintegration/qwaylandserverbufferintegrationplugin.cpp hardwareintegration/qwaylandserverbufferintegrationplugin_p.h + inputdeviceintegration/qwaylandinputdeviceintegration_p.h + inputdeviceintegration/qwaylandinputdeviceintegrationfactory.cpp inputdeviceintegration/qwaylandinputdeviceintegrationfactory_p.h + inputdeviceintegration/qwaylandinputdeviceintegrationplugin.cpp inputdeviceintegration/qwaylandinputdeviceintegrationplugin_p.h + qtwaylandclientglobal.h qtwaylandclientglobal_p.h + qwaylandabstractdecoration.cpp qwaylandabstractdecoration_p.h + qwaylandbuffer.cpp qwaylandbuffer_p.h + qwaylanddecorationfactory.cpp qwaylanddecorationfactory_p.h + qwaylanddecorationplugin.cpp qwaylanddecorationplugin_p.h + qwaylanddisplay.cpp qwaylanddisplay_p.h + qwaylandextendedsurface.cpp qwaylandextendedsurface_p.h + qwaylandinputcontext.cpp qwaylandinputcontext_p.h + qwaylandinputdevice.cpp qwaylandinputdevice_p.h + qwaylandintegration.cpp qwaylandintegration_p.h + qwaylandnativeinterface.cpp qwaylandnativeinterface_p.h + qwaylandqtkey.cpp qwaylandqtkey_p.h + qwaylandscreen.cpp qwaylandscreen_p.h + qwaylandshellsurface.cpp qwaylandshellsurface_p.h + qwaylandshm.cpp qwaylandshm_p.h + qwaylandshmbackingstore.cpp qwaylandshmbackingstore_p.h + qwaylandshmwindow.cpp qwaylandshmwindow_p.h + qwaylandsubsurface.cpp qwaylandsubsurface_p.h + qwaylandsurface.cpp qwaylandsurface_p.h + qwaylandtouch.cpp qwaylandtouch_p.h + qwaylandwindow.cpp qwaylandwindow_p.h + qwaylandwindowmanagerintegration.cpp qwaylandwindowmanagerintegration_p.h + shellintegration/qwaylandshellintegration_p.h + shellintegration/qwaylandshellintegrationfactory.cpp shellintegration/qwaylandshellintegrationfactory_p.h + shellintegration/qwaylandshellintegrationplugin.cpp shellintegration/qwaylandshellintegrationplugin_p.h + INCLUDE_DIRECTORIES + ../shared + global + hardwareintegration + inputdeviceintegration + shellintegration + LIBRARIES + Qt::CorePrivate + Qt::EventDispatcherSupportPrivate + Qt::FontDatabaseSupportPrivate + Qt::GuiPrivate + Qt::ServiceSupportPrivate + Qt::ThemeSupportPrivate + PUBLIC_LIBRARIES + Qt::Core + Qt::Gui + Wayland::Client +) + +qt6_generate_wayland_protocol_client_sources(WaylandClient + FILES + ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/text-input-unstable-v2.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/wayland.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/wp-primary-selection-unstable-v1.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/xdg-output-unstable-v1.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../extensions/qt-key-unstable-v1.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../extensions/qt-windowmanager.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../extensions/surface-extension.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../extensions/touch-extension.xml + ${CMAKE_CURRENT_SOURCE_DIR}/hardwareintegration/../../extensions/hardware-integration.xml + ${CMAKE_CURRENT_SOURCE_DIR}/hardwareintegration/../../extensions/server-buffer-extension.xml +) + +#### Keys ignored in scope 1:.:.:client.pro:: +# MODULE = "waylandclient" +# QMAKE_CXXFLAGS_WARN_ON = "--Wcast-qual" + +## Scopes: +##################################################################### + +qt_extend_target(WaylandClient CONDITION QT_FEATURE_vulkan + SOURCES + qwaylandvulkaninstance.cpp qwaylandvulkaninstance_p.h + qwaylandvulkanwindow.cpp qwaylandvulkanwindow_p.h + LIBRARIES + Qt::VulkanSupportPrivate +) + +qt_extend_target(WaylandClient CONDITION QT_FEATURE_xkbcommon + LIBRARIES + Qt::XkbCommonSupportPrivate +) + +qt_extend_target(WaylandClient CONDITION TARGET linuxaccessibility_support_private + LIBRARIES + linuxaccessibility_support_private +) + +qt_extend_target(WaylandClient CONDITION QT_FEATURE_clipboard + SOURCES + qwaylandclipboard.cpp qwaylandclipboard_p.h +) + +qt_extend_target(WaylandClient CONDITION QT_FEATURE_cursor + SOURCES + qwaylandcursor.cpp qwaylandcursor_p.h + PUBLIC_LIBRARIES + Wayland::Cursor +) + +qt_extend_target(WaylandClient CONDITION QT_FEATURE_wayland_datadevice + SOURCES + qwaylanddatadevice.cpp qwaylanddatadevice_p.h + qwaylanddatadevicemanager.cpp qwaylanddatadevicemanager_p.h + qwaylanddataoffer.cpp qwaylanddataoffer_p.h + qwaylanddatasource.cpp qwaylanddatasource_p.h +) + +qt_extend_target(WaylandClient CONDITION QT_FEATURE_wayland_client_primary_selection + SOURCES + qwaylandprimaryselectionv1.cpp qwaylandprimaryselectionv1_p.h +) + +qt_extend_target(WaylandClient CONDITION QT_FEATURE_draganddrop + SOURCES + qwaylanddnd.cpp qwaylanddnd_p.h +) diff --git a/src/plugins/platforms/wayland/CMakeLists.txt b/src/plugins/platforms/wayland/CMakeLists.txt new file mode 100644 index 00000000000..1338651794c --- /dev/null +++ b/src/plugins/platforms/wayland/CMakeLists.txt @@ -0,0 +1,135 @@ +# Generated from client.pro. + +##################################################################### +## WaylandClient Module: +##################################################################### + +qt_add_module(WaylandClient + PLUGIN_TYPES wayland-graphics-integration-client wayland-inputdevice-integration wayland-decoration-client wayland-shell-integration + SOURCES + ../shared/qwaylandinputmethodeventbuilder.cpp ../shared/qwaylandinputmethodeventbuilder_p.h + ../shared/qwaylandmimehelper.cpp ../shared/qwaylandmimehelper_p.h + ../shared/qwaylandsharedmemoryformathelper_p.h + global/qwaylandclientextension.cpp global/qwaylandclientextension.h global/qwaylandclientextension_p.h + hardwareintegration/qwaylandclientbufferintegration.cpp hardwareintegration/qwaylandclientbufferintegration_p.h + hardwareintegration/qwaylandclientbufferintegrationfactory.cpp hardwareintegration/qwaylandclientbufferintegrationfactory_p.h + hardwareintegration/qwaylandclientbufferintegrationplugin.cpp hardwareintegration/qwaylandclientbufferintegrationplugin_p.h + hardwareintegration/qwaylandhardwareintegration.cpp hardwareintegration/qwaylandhardwareintegration_p.h + hardwareintegration/qwaylandserverbufferintegration.cpp hardwareintegration/qwaylandserverbufferintegration_p.h + hardwareintegration/qwaylandserverbufferintegrationfactory.cpp hardwareintegration/qwaylandserverbufferintegrationfactory_p.h + hardwareintegration/qwaylandserverbufferintegrationplugin.cpp hardwareintegration/qwaylandserverbufferintegrationplugin_p.h + inputdeviceintegration/qwaylandinputdeviceintegration_p.h + inputdeviceintegration/qwaylandinputdeviceintegrationfactory.cpp inputdeviceintegration/qwaylandinputdeviceintegrationfactory_p.h + inputdeviceintegration/qwaylandinputdeviceintegrationplugin.cpp inputdeviceintegration/qwaylandinputdeviceintegrationplugin_p.h + qtwaylandclientglobal.h qtwaylandclientglobal_p.h + qwaylandabstractdecoration.cpp qwaylandabstractdecoration_p.h + qwaylandbuffer.cpp qwaylandbuffer_p.h + qwaylanddecorationfactory.cpp qwaylanddecorationfactory_p.h + qwaylanddecorationplugin.cpp qwaylanddecorationplugin_p.h + qwaylanddisplay.cpp qwaylanddisplay_p.h + qwaylandextendedsurface.cpp qwaylandextendedsurface_p.h + qwaylandinputcontext.cpp qwaylandinputcontext_p.h + qwaylandinputdevice.cpp qwaylandinputdevice_p.h + qwaylandintegration.cpp qwaylandintegration_p.h + qwaylandnativeinterface.cpp qwaylandnativeinterface_p.h + qwaylandqtkey.cpp qwaylandqtkey_p.h + qwaylandscreen.cpp qwaylandscreen_p.h + qwaylandshellsurface.cpp qwaylandshellsurface_p.h + qwaylandshm.cpp qwaylandshm_p.h + qwaylandshmbackingstore.cpp qwaylandshmbackingstore_p.h + qwaylandshmwindow.cpp qwaylandshmwindow_p.h + qwaylandsubsurface.cpp qwaylandsubsurface_p.h + qwaylandsurface.cpp qwaylandsurface_p.h + qwaylandtouch.cpp qwaylandtouch_p.h + qwaylandwindow.cpp qwaylandwindow_p.h + qwaylandwindowmanagerintegration.cpp qwaylandwindowmanagerintegration_p.h + shellintegration/qwaylandshellintegration_p.h + shellintegration/qwaylandshellintegrationfactory.cpp shellintegration/qwaylandshellintegrationfactory_p.h + shellintegration/qwaylandshellintegrationplugin.cpp shellintegration/qwaylandshellintegrationplugin_p.h + INCLUDE_DIRECTORIES + ../shared + global + hardwareintegration + inputdeviceintegration + shellintegration + LIBRARIES + Qt::CorePrivate + Qt::EventDispatcherSupportPrivate + Qt::FontDatabaseSupportPrivate + Qt::GuiPrivate + Qt::ServiceSupportPrivate + Qt::ThemeSupportPrivate + PUBLIC_LIBRARIES + Qt::Core + Qt::Gui + Wayland::Client +) + +qt6_generate_wayland_protocol_client_sources(WaylandClient + FILES + ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/text-input-unstable-v2.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/wayland.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/wp-primary-selection-unstable-v1.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/xdg-output-unstable-v1.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../extensions/qt-key-unstable-v1.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../extensions/qt-windowmanager.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../extensions/surface-extension.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../extensions/touch-extension.xml + ${CMAKE_CURRENT_SOURCE_DIR}/hardwareintegration/../../extensions/hardware-integration.xml + ${CMAKE_CURRENT_SOURCE_DIR}/hardwareintegration/../../extensions/server-buffer-extension.xml +) + +#### Keys ignored in scope 1:.:.:client.pro:: +# MODULE = "waylandclient" +# QMAKE_CXXFLAGS_WARN_ON = "--Wcast-qual" + +## Scopes: +##################################################################### + +qt_extend_target(WaylandClient CONDITION QT_FEATURE_vulkan + SOURCES + qwaylandvulkaninstance.cpp qwaylandvulkaninstance_p.h + qwaylandvulkanwindow.cpp qwaylandvulkanwindow_p.h + LIBRARIES + Qt::VulkanSupportPrivate +) + +qt_extend_target(WaylandClient CONDITION QT_FEATURE_xkbcommon + LIBRARIES + Qt::XkbCommonSupportPrivate +) + +qt_extend_target(WaylandClient CONDITION TARGET Qt::LinuxAccessibilitySupportPrivate # special case + LIBRARIES + Qt::LinuxAccessibilitySupportPrivate # special case +) + +qt_extend_target(WaylandClient CONDITION QT_FEATURE_clipboard + SOURCES + qwaylandclipboard.cpp qwaylandclipboard_p.h +) + +qt_extend_target(WaylandClient CONDITION QT_FEATURE_cursor + SOURCES + qwaylandcursor.cpp qwaylandcursor_p.h + PUBLIC_LIBRARIES + Wayland::Cursor +) + +qt_extend_target(WaylandClient CONDITION QT_FEATURE_wayland_datadevice + SOURCES + qwaylanddatadevice.cpp qwaylanddatadevice_p.h + qwaylanddatadevicemanager.cpp qwaylanddatadevicemanager_p.h + qwaylanddataoffer.cpp qwaylanddataoffer_p.h + qwaylanddatasource.cpp qwaylanddatasource_p.h +) + +qt_extend_target(WaylandClient CONDITION QT_FEATURE_wayland_client_primary_selection + SOURCES + qwaylandprimaryselectionv1.cpp qwaylandprimaryselectionv1_p.h +) + +qt_extend_target(WaylandClient CONDITION QT_FEATURE_draganddrop + SOURCES + qwaylanddnd.cpp qwaylanddnd_p.h +) diff --git a/src/plugins/platforms/wayland/configure.cmake b/src/plugins/platforms/wayland/configure.cmake new file mode 100644 index 00000000000..99aed833e5a --- /dev/null +++ b/src/plugins/platforms/wayland/configure.cmake @@ -0,0 +1,194 @@ + + +#### Inputs + + + +#### Libraries + +if((LINUX) OR QT_FIND_ALL_PACKAGES_ALWAYS) + qt_find_package(Wayland PROVIDED_TARGETS Wayland::Client) +endif() +if((LINUX) OR QT_FIND_ALL_PACKAGES_ALWAYS) + qt_find_package(Wayland PROVIDED_TARGETS Wayland::Cursor) +endif() +if((LINUX) OR QT_FIND_ALL_PACKAGES_ALWAYS) + qt_find_package(Wayland PROVIDED_TARGETS Wayland::Egl) +endif() +qt_find_package(XComposite PROVIDED_TARGETS PkgConfig::XComposite) + + +#### Tests + +# drm-egl-server +qt_config_compile_test(drm_egl_server + LABEL "DRM EGL Server" + LIBRARIES + EGL::EGL + CODE +" +#include +#include + +int main(int argc, char **argv) +{ + (void)argc; (void)argv; + /* BEGIN TEST: */ +#ifdef EGL_MESA_drm_image +return 0; +#else +#error Requires EGL_MESA_drm_image to be defined +return 1; +#endif + /* END TEST: */ + return 0; +} +") + +# libhybris-egl-server +qt_config_compile_test(libhybris_egl_server + LABEL "libhybris EGL Server" + LIBRARIES + EGL::EGL + CODE +" +#include +#include +#include + +int main(int argc, char **argv) +{ + (void)argc; (void)argv; + /* BEGIN TEST: */ +#ifdef EGL_HYBRIS_native_buffer +return 0; +#else +#error Requires EGL_HYBRIS_native_buffer to be defined +return 1; +#endif + /* END TEST: */ + return 0; +} +") + +# dmabuf-server-buffer +qt_config_compile_test(dmabuf_server_buffer + LABEL "Linux dma-buf Buffer Sharing" + LIBRARIES + EGL::EGL + CODE +" +#include +#include +#include + +int main(int argc, char **argv) +{ + (void)argc; (void)argv; + /* BEGIN TEST: */ +#ifdef EGL_LINUX_DMA_BUF_EXT +return 0; +#else +#error Requires EGL_LINUX_DMA_BUF_EXT +return 1; +#endif + /* END TEST: */ + return 0; +} +") + +# vulkan-server-buffer +qt_config_compile_test(vulkan_server_buffer + LABEL "Vulkan Buffer Sharing" + CODE +" +#include + +int main(int argc, char **argv) +{ + (void)argc; (void)argv; + /* BEGIN TEST: */ +VkExportMemoryAllocateInfoKHR exportAllocInfo = {}; +exportAllocInfo.sType = VK_STRUCTURE_TYPE_EXPORT_MEMORY_ALLOCATE_INFO_KHR; +exportAllocInfo.handleTypes = VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT_KHR; +return 0; + /* END TEST: */ + return 0; +} +") + + + +#### Features + +qt_feature("wayland_client" PRIVATE + LABEL "Qt Wayland Client" + CONDITION NOT WIN32 AND Wayland_FOUND AND Wayland_FOUND AND WaylandScanner_FOUND +) +qt_feature("wayland_datadevice" PRIVATE + CONDITION QT_FEATURE_draganddrop OR QT_FEATURE_clipboard +) +qt_feature("wayland_client_primary_selection" PRIVATE + LABEL "primary-selection clipboard" + CONDITION QT_FEATURE_clipboard +) +qt_feature("wayland_client_fullscreen_shell_v1" PRIVATE + LABEL "fullscreen-shell-v1" + CONDITION QT_FEATURE_wayland_client +) +qt_feature("wayland_client_ivi_shell" PRIVATE + LABEL "ivi-shell" + CONDITION QT_FEATURE_wayland_client +) +qt_feature("wayland_client_wl_shell" PRIVATE + LABEL "wl-shell (deprecated)" + CONDITION QT_FEATURE_wayland_client +) +qt_feature("wayland_client_xdg_shell" PRIVATE + LABEL "xdg-shell" + CONDITION QT_FEATURE_wayland_client +) +qt_feature("wayland_client_xdg_shell_v5" PRIVATE + LABEL "xdg-shell unstable v5 (deprecated)" + CONDITION QT_FEATURE_wayland_client +) +qt_feature("wayland_client_xdg_shell_v6" PRIVATE + LABEL "xdg-shell unstable v6" + CONDITION QT_FEATURE_wayland_client +) +qt_feature("wayland_egl" PRIVATE + LABEL "EGL" + CONDITION QT_FEATURE_wayland_client AND QT_FEATURE_opengl AND QT_FEATURE_egl AND Wayland_FOUND +) +qt_feature("wayland_brcm" PRIVATE + LABEL "Raspberry Pi" + CONDITION QT_FEATURE_wayland_client AND QT_FEATURE_eglfs_brcm +) +qt_feature("xcomposite_egl" PRIVATE + LABEL "XComposite EGL" + CONDITION QT_FEATURE_wayland_client AND QT_FEATURE_opengl AND QT_FEATURE_egl AND QT_FEATURE_xlib AND XComposite_FOUND AND QT_FEATURE_egl_x11 +) +qt_feature("xcomposite_glx" PRIVATE + LABEL "XComposite GLX" + CONDITION QT_FEATURE_wayland_client AND QT_FEATURE_opengl AND NOT QT_FEATURE_opengles2 AND QT_FEATURE_xlib AND XComposite_FOUND +) +qt_feature("wayland_drm_egl_server_buffer" PRIVATE + LABEL "DRM EGL" + CONDITION QT_FEATURE_wayland_client AND QT_FEATURE_opengl AND QT_FEATURE_egl AND TEST_drm_egl_server +) +qt_feature("wayland_libhybris_egl_server_buffer" PRIVATE + LABEL "libhybris EGL" + CONDITION QT_FEATURE_wayland_client AND QT_FEATURE_opengl AND QT_FEATURE_egl AND TEST_libhybris_egl_server +) +qt_feature("wayland_dmabuf_server_buffer" PRIVATE + LABEL "Linux dma-buf server buffer integration" + CONDITION QT_FEATURE_wayland_client AND QT_FEATURE_opengl AND QT_FEATURE_egl AND TEST_dmabuf_server_buffer +) +qt_feature("wayland_vulkan_server_buffer" PRIVATE + LABEL "Vulkan-based server buffer integration" + CONDITION QT_FEATURE_wayland_client AND QT_FEATURE_opengl AND QT_FEATURE_egl AND TEST_vulkan_server_buffer +) +qt_feature("wayland_shm_emulation_server_buffer" PRIVATE + LABEL "Shm emulation server buffer integration" + CONDITION QT_FEATURE_wayland_client AND QT_FEATURE_opengl +) diff --git a/src/plugins/platforms/wayland/plugins/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/CMakeLists.txt new file mode 100644 index 00000000000..ef58376aede --- /dev/null +++ b/src/plugins/platforms/wayland/plugins/CMakeLists.txt @@ -0,0 +1,8 @@ +# Generated from plugins.pro. + +add_subdirectory(hardwareintegration) +if(TARGET Qt::WaylandClient) + add_subdirectory(platforms) + add_subdirectory(decorations) + add_subdirectory(shellintegration) +endif() diff --git a/src/plugins/platforms/wayland/plugins/decorations/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/decorations/CMakeLists.txt new file mode 100644 index 00000000000..fd7fbeb2034 --- /dev/null +++ b/src/plugins/platforms/wayland/plugins/decorations/CMakeLists.txt @@ -0,0 +1,3 @@ +# Generated from decorations.pro. + +add_subdirectory(bradient) diff --git a/src/plugins/platforms/wayland/plugins/decorations/bradient/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/decorations/bradient/CMakeLists.txt new file mode 100644 index 00000000000..760718cac7c --- /dev/null +++ b/src/plugins/platforms/wayland/plugins/decorations/bradient/CMakeLists.txt @@ -0,0 +1,22 @@ +# Generated from bradient.pro. + +##################################################################### +## bradient Plugin: +##################################################################### + +qt_add_plugin(bradient + TYPE wayland-decoration-client + CLASS_NAME QWaylandBradientDecorationPlugin + SOURCES + main.cpp + LIBRARIES + Qt::WaylandClientPrivate + PUBLIC_LIBRARIES + Qt::Core + Qt::Gui + Qt::WaylandClient + Wayland::Client +) + +#### Keys ignored in scope 1:.:.:bradient.pro:: +# OTHER_FILES = "bradient.json" diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/hardwareintegration/CMakeLists.txt new file mode 100644 index 00000000000..32493e4bcb4 --- /dev/null +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/CMakeLists.txt @@ -0,0 +1,29 @@ +# Generated from client.pro. + +if(QT_FEATURE_wayland_egl) + add_subdirectory(wayland-egl) +endif() +if(QT_FEATURE_wayland_brcm) + add_subdirectory(brcm-egl) +endif() +if(QT_FEATURE_xcomposite_egl) + add_subdirectory(xcomposite-egl) +endif() +if(QT_FEATURE_xcomposite_glx) + add_subdirectory(xcomposite-glx) +endif() +if(QT_FEATURE_wayland_drm_egl_server_buffer) + add_subdirectory(drm-egl-server) +endif() +if(QT_FEATURE_wayland_libhybris_egl_server_buffer) + add_subdirectory(libhybris-egl-server) +endif() +if(QT_FEATURE_wayland_shm_emulation_server_buffer) + add_subdirectory(shm-emulation-server) +endif() +if(QT_FEATURE_wayland_dmabuf_server_buffer) + add_subdirectory(dmabuf-server) +endif() +if(QT_FEATURE_wayland_vulkan_server_buffer) + add_subdirectory(vulkan-server) +endif() diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/CMakeLists.txt new file mode 100644 index 00000000000..e02b020e6df --- /dev/null +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/CMakeLists.txt @@ -0,0 +1,36 @@ +# Generated from brcm-egl.pro. + +##################################################################### +## brcm-egl Plugin: +##################################################################### + +qt_add_plugin(brcm-egl + TYPE wayland-graphics-integration-client + CLASS_NAME QWaylandBrcmEglClientBufferPlugin + SOURCES + ../../../../hardwareintegration/client/brcm-egl/qwaylandbrcmeglintegration.cpp ../../../../hardwareintegration/client/brcm-egl/qwaylandbrcmeglintegration.h + ../../../../hardwareintegration/client/brcm-egl/qwaylandbrcmeglwindow.cpp ../../../../hardwareintegration/client/brcm-egl/qwaylandbrcmeglwindow.h + ../../../../hardwareintegration/client/brcm-egl/qwaylandbrcmglcontext.cpp ../../../../hardwareintegration/client/brcm-egl/qwaylandbrcmglcontext.h + main.cpp + INCLUDE_DIRECTORIES + ../../../../hardwareintegration/client/brcm-egl + LIBRARIES + Qt::EglSupportPrivate + Qt::WaylandClientPrivate + PUBLIC_LIBRARIES + ${CMAKE_DL_LIBS} + EGL::EGL + Qt::Core + Qt::EglSupport + Qt::Gui + Qt::WaylandClient + Wayland::Client +) + +qt6_generate_wayland_protocol_client_sources(brcm-egl + FILES + ${CMAKE_CURRENT_SOURCE_DIR}/../../../../hardwareintegration/client/brcm-egl/../../../extensions/brcm.xml +) + +#### Keys ignored in scope 1:.:.:brcm-egl.pro:: +# OTHER_FILES = "brcm-egl.json" diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/dmabuf-server/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/hardwareintegration/dmabuf-server/CMakeLists.txt new file mode 100644 index 00000000000..41d7c12e252 --- /dev/null +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/dmabuf-server/CMakeLists.txt @@ -0,0 +1,32 @@ +# Generated from dmabuf-server.pro. + +##################################################################### +## dmabuf-server Plugin: +##################################################################### + +qt_add_plugin(dmabuf-server + TYPE wayland-graphics-integration-client + CLASS_NAME DmaBufServerBufferPlugin + SOURCES + ../../../../hardwareintegration/client/dmabuf-server/dmabufserverbufferintegration.cpp ../../../../hardwareintegration/client/dmabuf-server/dmabufserverbufferintegration.h + main.cpp + INCLUDE_DIRECTORIES + ../../../../hardwareintegration/client/dmabuf-server + LIBRARIES + Qt::WaylandClientPrivate + PUBLIC_LIBRARIES + EGL::EGL + Qt::Core + Qt::Gui + Qt::WaylandClient + Wayland::Client +) + +qt6_generate_wayland_protocol_client_sources(dmabuf-server + FILES + ${CMAKE_CURRENT_SOURCE_DIR}/../../../../hardwareintegration/client/dmabuf-server/../../../extensions/qt-dmabuf-server-buffer.xml +) + +#### Keys ignored in scope 1:.:.:dmabuf-server.pro:: +# OTHER_FILES = "dmabuf-server.json" +# QMAKE_CXXFLAGS_WARN_ON = "--Wcast-qual" diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/drm-egl-server/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/hardwareintegration/drm-egl-server/CMakeLists.txt new file mode 100644 index 00000000000..337857cc259 --- /dev/null +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/drm-egl-server/CMakeLists.txt @@ -0,0 +1,32 @@ +# Generated from drm-egl-server.pro. + +##################################################################### +## drm-egl-server Plugin: +##################################################################### + +qt_add_plugin(drm-egl-server + TYPE wayland-graphics-integration-client + CLASS_NAME DrmEglServerBufferPlugin + SOURCES + ../../../../hardwareintegration/client/drm-egl-server/drmeglserverbufferintegration.cpp ../../../../hardwareintegration/client/drm-egl-server/drmeglserverbufferintegration.h + main.cpp + INCLUDE_DIRECTORIES + ../../../../hardwareintegration/client/drm-egl-server + LIBRARIES + Qt::WaylandClientPrivate + PUBLIC_LIBRARIES + EGL::EGL + Qt::Core + Qt::Gui + Qt::WaylandClient + Wayland::Client +) + +qt6_generate_wayland_protocol_client_sources(drm-egl-server + FILES + ${CMAKE_CURRENT_SOURCE_DIR}/../../../../hardwareintegration/client/drm-egl-server/../../../extensions/drm-egl-server-buffer.xml +) + +#### Keys ignored in scope 1:.:.:drm-egl-server.pro:: +# OTHER_FILES = "drm-egl-server.json" +# QMAKE_CXXFLAGS_WARN_ON = "--Wcast-qual" diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/libhybris-egl-server/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/hardwareintegration/libhybris-egl-server/CMakeLists.txt new file mode 100644 index 00000000000..ca1738f50f3 --- /dev/null +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/libhybris-egl-server/CMakeLists.txt @@ -0,0 +1,31 @@ +# Generated from libhybris-egl-server.pro. + +##################################################################### +## libhybris-egl-server Plugin: +##################################################################### + +qt_add_plugin(libhybris-egl-server + TYPE wayland-graphics-integration-client + CLASS_NAME LibHybrisEglServerBufferPlugin + SOURCES + ../../../../hardwareintegration/client/libhybris-egl-server/libhybriseglserverbufferintegration.cpp ../../../../hardwareintegration/client/libhybris-egl-server/libhybriseglserverbufferintegration.h + main.cpp + INCLUDE_DIRECTORIES + ../../../../hardwareintegration/client/libhybris-egl-server + LIBRARIES + Qt::WaylandClientPrivate + PUBLIC_LIBRARIES + EGL::EGL + Qt::Core + Qt::Gui + Qt::WaylandClient + Wayland::Client +) + +qt6_generate_wayland_protocol_client_sources(libhybris-egl-server + FILES + ${CMAKE_CURRENT_SOURCE_DIR}/../../../../hardwareintegration/client/libhybris-egl-server/../../../extensions/libhybris-egl-server-buffer.xml +) + +#### Keys ignored in scope 1:.:.:libhybris-egl-server.pro:: +# OTHER_FILES = "libhybris-egl-server.json" diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/shm-emulation-server/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/hardwareintegration/shm-emulation-server/CMakeLists.txt new file mode 100644 index 00000000000..d7a7294ec9a --- /dev/null +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/shm-emulation-server/CMakeLists.txt @@ -0,0 +1,31 @@ +# Generated from shm-emulation-server.pro. + +##################################################################### +## shm-emulation-server Plugin: +##################################################################### + +qt_add_plugin(shm-emulation-server + TYPE wayland-graphics-integration-client + CLASS_NAME ShmServerBufferPlugin + SOURCES + ../../../../hardwareintegration/client/shm-emulation-server/shmserverbufferintegration.cpp ../../../../hardwareintegration/client/shm-emulation-server/shmserverbufferintegration.h + main.cpp + INCLUDE_DIRECTORIES + ../../../../hardwareintegration/client/shm-emulation-server + LIBRARIES + Qt::WaylandClientPrivate + PUBLIC_LIBRARIES + Qt::Core + Qt::Gui + Qt::WaylandClient + Wayland::Client +) + +qt6_generate_wayland_protocol_client_sources(shm-emulation-server + FILES + ${CMAKE_CURRENT_SOURCE_DIR}/../../../../hardwareintegration/client/shm-emulation-server/../../../extensions/shm-emulation-server-buffer.xml +) + +#### Keys ignored in scope 1:.:.:shm-emulation-server.pro:: +# OTHER_FILES = "shm-emulation-server.json" +# QMAKE_CXXFLAGS_WARN_ON = "--Wcast-qual" diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/vulkan-server/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/hardwareintegration/vulkan-server/CMakeLists.txt new file mode 100644 index 00000000000..46ad01249d2 --- /dev/null +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/vulkan-server/CMakeLists.txt @@ -0,0 +1,31 @@ +# Generated from vulkan-server.pro. + +##################################################################### +## vulkan-server Plugin: +##################################################################### + +qt_add_plugin(vulkan-server + TYPE wayland-graphics-integration-client + CLASS_NAME VulkanServerBufferPlugin + SOURCES + ../../../../hardwareintegration/client/vulkan-server/vulkanserverbufferintegration.cpp ../../../../hardwareintegration/client/vulkan-server/vulkanserverbufferintegration.h + main.cpp + INCLUDE_DIRECTORIES + ../../../../hardwareintegration/client/vulkan-server + LIBRARIES + Qt::WaylandClientPrivate + PUBLIC_LIBRARIES + Qt::Core + Qt::Gui + Qt::WaylandClient + Wayland::Client +) + +qt6_generate_wayland_protocol_client_sources(vulkan-server + FILES + ${CMAKE_CURRENT_SOURCE_DIR}/../../../../hardwareintegration/client/vulkan-server/../../../extensions/qt-vulkan-server-buffer-unstable-v1.xml +) + +#### Keys ignored in scope 1:.:.:vulkan-server.pro:: +# OTHER_FILES = "vulkan-server.json" +# QMAKE_CXXFLAGS_WARN_ON = "--Wcast-qual" diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/CMakeLists.txt new file mode 100644 index 00000000000..cbe1b6a9f9a --- /dev/null +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/CMakeLists.txt @@ -0,0 +1,32 @@ +# Generated from wayland-egl.pro. + +##################################################################### +## qt-plugin-wayland-egl Plugin: +##################################################################### + +qt_add_plugin(qt-plugin-wayland-egl + TYPE wayland-graphics-integration-client + CLASS_NAME QWaylandEglClientBufferPlugin + SOURCES + ../../../../hardwareintegration/client/wayland-egl/qwaylandeglclientbufferintegration.cpp ../../../../hardwareintegration/client/wayland-egl/qwaylandeglclientbufferintegration.h + ../../../../hardwareintegration/client/wayland-egl/qwaylandeglinclude.h + ../../../../hardwareintegration/client/wayland-egl/qwaylandeglwindow.cpp ../../../../hardwareintegration/client/wayland-egl/qwaylandeglwindow.h + ../../../../hardwareintegration/client/wayland-egl/qwaylandglcontext.cpp ../../../../hardwareintegration/client/wayland-egl/qwaylandglcontext.h + main.cpp + INCLUDE_DIRECTORIES + ../../../../hardwareintegration/client/wayland-egl + LIBRARIES + Qt::EglSupportPrivate + Qt::WaylandClientPrivate + PUBLIC_LIBRARIES + EGL::EGL + Qt::Core + Qt::EglSupport + Qt::Gui + Qt::WaylandClient + Wayland::Client + Wayland::Egl +) + +#### Keys ignored in scope 1:.:.:wayland-egl.pro:: +# OTHER_FILES = "wayland-egl.json" diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-egl/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-egl/CMakeLists.txt new file mode 100644 index 00000000000..a4b6e27413b --- /dev/null +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-egl/CMakeLists.txt @@ -0,0 +1,40 @@ +# Generated from xcomposite-egl.pro. + +##################################################################### +## xcomposite-egl Plugin: +##################################################################### + +qt_add_plugin(xcomposite-egl + TYPE wayland-graphics-integration-client + CLASS_NAME QWaylandXCompositeEglClientBufferPlugin + SOURCES + ../../../../hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglclientbufferintegration.cpp ../../../../hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglclientbufferintegration.h + ../../../../hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglcontext.cpp ../../../../hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglcontext.h + ../../../../hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglwindow.cpp ../../../../hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglwindow.h + ../../../../hardwareintegration/client/xcomposite_share/qwaylandxcompositebuffer.cpp ../../../../hardwareintegration/client/xcomposite_share/qwaylandxcompositebuffer.h + main.cpp + INCLUDE_DIRECTORIES + ../../../../hardwareintegration/client/xcomposite-egl + ../../../../hardwareintegration/client/xcomposite_share + LIBRARIES + Qt::EglSupportPrivate + Qt::WaylandClientPrivate + PUBLIC_LIBRARIES + EGL::EGL + PkgConfig::XComposite + Qt::Core + Qt::EglSupport + Qt::Gui + Qt::WaylandClient + Wayland::Client + X11::X11 +) + +qt6_generate_wayland_protocol_client_sources(xcomposite-egl + FILES + ${CMAKE_CURRENT_SOURCE_DIR}/../../../../hardwareintegration/client/xcomposite_share/../../../extensions/xcomposite.xml +) + +#### Keys ignored in scope 1:.:.:xcomposite-egl.pro:: +# OTHER_FILES = "xcomposite-egl.json" +# QMAKE_CXXFLAGS_WARN_ON = "--Wcast-qual" diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-glx/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-glx/CMakeLists.txt new file mode 100644 index 00000000000..179dd8db2e5 --- /dev/null +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-glx/CMakeLists.txt @@ -0,0 +1,39 @@ +# Generated from xcomposite-glx.pro. + +##################################################################### +## xcomposite-glx Plugin: +##################################################################### + +qt_add_plugin(xcomposite-glx + TYPE wayland-graphics-integration-client + CLASS_NAME QWaylandXCompositeGlxClientBufferPlugin + SOURCES + ../../../../hardwareintegration/client/xcomposite-glx/qwaylandxcompositeglxcontext.cpp ../../../../hardwareintegration/client/xcomposite-glx/qwaylandxcompositeglxcontext.h + ../../../../hardwareintegration/client/xcomposite-glx/qwaylandxcompositeglxintegration.cpp ../../../../hardwareintegration/client/xcomposite-glx/qwaylandxcompositeglxintegration.h + ../../../../hardwareintegration/client/xcomposite-glx/qwaylandxcompositeglxwindow.cpp ../../../../hardwareintegration/client/xcomposite-glx/qwaylandxcompositeglxwindow.h + ../../../../hardwareintegration/client/xcomposite_share/qwaylandxcompositebuffer.cpp ../../../../hardwareintegration/client/xcomposite_share/qwaylandxcompositebuffer.h + main.cpp + INCLUDE_DIRECTORIES + ../../../../hardwareintegration/client/xcomposite-glx + ../../../../hardwareintegration/client/xcomposite_share + LIBRARIES + Qt::GlxSupportPrivate + Qt::WaylandClientPrivate + PUBLIC_LIBRARIES + ${CMAKE_DL_LIBS} + PkgConfig::XComposite + Qt::Core + Qt::GlxSupport + Qt::Gui + Qt::WaylandClient + Wayland::Client + X11::X11 +) + +qt6_generate_wayland_protocol_client_sources(xcomposite-glx + FILES + ${CMAKE_CURRENT_SOURCE_DIR}/../../../../hardwareintegration/client/xcomposite_share/../../../extensions/xcomposite.xml +) + +#### Keys ignored in scope 1:.:.:xcomposite-glx.pro:: +# OTHER_FILES = "xcomposite-glx.json" diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/shellintegration/CMakeLists.txt new file mode 100644 index 00000000000..03364328c25 --- /dev/null +++ b/src/plugins/platforms/wayland/plugins/shellintegration/CMakeLists.txt @@ -0,0 +1,20 @@ +# Generated from shellintegration.pro. + +if(QT_FEATURE_wayland_client_fullscreen_shell_v1) + add_subdirectory(fullscreen-shell-v1) +endif() +if(QT_FEATURE_wayland_client_ivi_shell) + add_subdirectory(ivi-shell) +endif() +if(QT_FEATURE_wayland_client_wl_shell) + add_subdirectory(wl-shell) +endif() +if(QT_FEATURE_wayland_client_xdg_shell) + add_subdirectory(xdg-shell) +endif() +if(QT_FEATURE_wayland_client_xdg_shell_v5) + add_subdirectory(xdg-shell-v5) +endif() +if(QT_FEATURE_wayland_client_xdg_shell_v6) + add_subdirectory(xdg-shell-v6) +endif() diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/fullscreen-shell-v1/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/shellintegration/fullscreen-shell-v1/CMakeLists.txt new file mode 100644 index 00000000000..7cc47c75729 --- /dev/null +++ b/src/plugins/platforms/wayland/plugins/shellintegration/fullscreen-shell-v1/CMakeLists.txt @@ -0,0 +1,30 @@ +# Generated from fullscreen-shell-v1.pro. + +##################################################################### +## fullscreen-shell-v1 Plugin: +##################################################################### + +qt_add_plugin(fullscreen-shell-v1 + TYPE wayland-shell-integration + CLASS_NAME QWaylandFullScreenShellV1IntegrationPlugin + SOURCES + main.cpp + qwaylandfullscreenshellv1integration.cpp qwaylandfullscreenshellv1integration.h + qwaylandfullscreenshellv1surface.cpp qwaylandfullscreenshellv1surface.h + LIBRARIES + Qt::GuiPrivate + Qt::WaylandClientPrivate + PUBLIC_LIBRARIES + Qt::Core + Qt::Gui + Qt::WaylandClient + Wayland::Client +) + +qt6_generate_wayland_protocol_client_sources(fullscreen-shell-v1 + FILES + ${CMAKE_CURRENT_SOURCE_DIR}/../../../3rdparty/protocol/fullscreen-shell-unstable-v1.xml +) + +#### Keys ignored in scope 1:.:.:fullscreen-shell-v1.pro:: +# OTHER_FILES = "fullscreen-shell-v1.json" diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/CMakeLists.txt new file mode 100644 index 00000000000..85891524287 --- /dev/null +++ b/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/CMakeLists.txt @@ -0,0 +1,38 @@ +# Generated from wl-shell.pro. + +##################################################################### +## wl-shell Plugin: +##################################################################### + +qt_add_plugin(wl-shell + TYPE wayland-shell-integration + CLASS_NAME QWaylandWlShellIntegrationPlugin + SOURCES + main.cpp + qwaylandwlshellintegration.cpp qwaylandwlshellintegration_p.h + qwaylandwlshellsurface.cpp qwaylandwlshellsurface_p.h + LIBRARIES + Qt::GuiPrivate + Qt::WaylandClientPrivate + PUBLIC_LIBRARIES + Qt::Core + Qt::Gui + Qt::WaylandClient + Wayland::Client +) + +qt6_generate_wayland_protocol_client_sources(wl-shell + FILES + ${CMAKE_CURRENT_SOURCE_DIR}/../../../3rdparty/protocol/wayland.xml +) + +#### Keys ignored in scope 1:.:.:wl-shell.pro:: +# OTHER_FILES = "wl-shell.json" + +## Scopes: +##################################################################### + +qt_extend_target(wl-shell CONDITION QT_FEATURE_xkbcommon + LIBRARIES + XKB::XKB +) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/CMakeLists.txt new file mode 100644 index 00000000000..3fa2ba746a4 --- /dev/null +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/CMakeLists.txt @@ -0,0 +1,40 @@ +# Generated from xdg-shell-v5.pro. + +##################################################################### +## xdg-shell-v5 Plugin: +##################################################################### + +qt_add_plugin(xdg-shell-v5 + TYPE wayland-shell-integration + CLASS_NAME QWaylandXdgShellV5IntegrationPlugin + SOURCES + main.cpp + pregenerated/3rdparty/qwayland-xdg-shell-unstable-v5.cpp pregenerated/3rdparty/qwayland-xdg-shell-unstable-v5_p.h + pregenerated/3rdparty/wayland-xdg-shell-unstable-v5-client-protocol_p.h + pregenerated/3rdparty/wayland-xdg-shell-unstable-v5-protocol.c + qwaylandxdgpopupv5.cpp qwaylandxdgpopupv5_p.h + qwaylandxdgshellv5.cpp qwaylandxdgshellv5_p.h + qwaylandxdgshellv5integration.cpp qwaylandxdgshellv5integration_p.h + qwaylandxdgsurfacev5.cpp qwaylandxdgsurfacev5_p.h + INCLUDE_DIRECTORIES + pregenerated/3rdparty + LIBRARIES + Qt::GuiPrivate + Qt::WaylandClientPrivate + PUBLIC_LIBRARIES + Qt::Core + Qt::Gui + Qt::WaylandClient + Wayland::Client +) + +#### Keys ignored in scope 1:.:.:xdg-shell-v5.pro:: +# OTHER_FILES = "xdg-shell-v5.json" + +## Scopes: +##################################################################### + +qt_extend_target(xdg-shell-v5 CONDITION QT_FEATURE_xkbcommon + PUBLIC_LIBRARIES + XKB::XKB +) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/CMakeLists.txt new file mode 100644 index 00000000000..d6fa7dd6a45 --- /dev/null +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/CMakeLists.txt @@ -0,0 +1,38 @@ +# Generated from xdg-shell-v6.pro. + +##################################################################### +## xdg-shell-v6 Plugin: +##################################################################### + +qt_add_plugin(xdg-shell-v6 + TYPE wayland-shell-integration + CLASS_NAME QWaylandXdgShellV6IntegrationPlugin + SOURCES + main.cpp + qwaylandxdgshellv6.cpp qwaylandxdgshellv6_p.h + qwaylandxdgshellv6integration.cpp qwaylandxdgshellv6integration_p.h + LIBRARIES + Qt::GuiPrivate + Qt::WaylandClientPrivate + PUBLIC_LIBRARIES + Qt::Core + Qt::Gui + Qt::WaylandClient + Wayland::Client +) + +qt6_generate_wayland_protocol_client_sources(xdg-shell-v6 + FILES + ${CMAKE_CURRENT_SOURCE_DIR}/../../../3rdparty/protocol/xdg-shell-unstable-v6.xml +) + +#### Keys ignored in scope 1:.:.:xdg-shell-v6.pro:: +# OTHER_FILES = "xdg-shell-v6.json" + +## Scopes: +##################################################################### + +qt_extend_target(xdg-shell-v6 CONDITION QT_FEATURE_xkbcommon + LIBRARIES + XKB::XKB +) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/CMakeLists.txt new file mode 100644 index 00000000000..96a02fc7f85 --- /dev/null +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/CMakeLists.txt @@ -0,0 +1,40 @@ +# Generated from xdg-shell.pro. + +##################################################################### +## xdg-shell Plugin: +##################################################################### + +qt_add_plugin(xdg-shell + TYPE wayland-shell-integration + CLASS_NAME QWaylandXdgShellIntegrationPlugin + SOURCES + main.cpp + qwaylandxdgdecorationv1.cpp qwaylandxdgdecorationv1_p.h + qwaylandxdgshell.cpp qwaylandxdgshell_p.h + qwaylandxdgshellintegration.cpp qwaylandxdgshellintegration_p.h + LIBRARIES + Qt::GuiPrivate + Qt::WaylandClientPrivate + PUBLIC_LIBRARIES + Qt::Core + Qt::Gui + Qt::WaylandClient + Wayland::Client +) + +qt6_generate_wayland_protocol_client_sources(xdg-shell + FILES + ${CMAKE_CURRENT_SOURCE_DIR}/../../../3rdparty/protocol/xdg-decoration-unstable-v1.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../../../3rdparty/protocol/xdg-shell.xml +) + +#### Keys ignored in scope 1:.:.:xdg-shell.pro:: +# OTHER_FILES = "xdg-shell.json" + +## Scopes: +##################################################################### + +qt_extend_target(xdg-shell CONDITION QT_FEATURE_xkbcommon + LIBRARIES + XKB::XKB +) diff --git a/src/tools/qtwaylandscanner/CMakeLists.txt b/src/tools/qtwaylandscanner/CMakeLists.txt new file mode 100644 index 00000000000..107702c3196 --- /dev/null +++ b/src/tools/qtwaylandscanner/CMakeLists.txt @@ -0,0 +1,16 @@ +# Generated from qtwaylandscanner.pro. + +##################################################################### +## qtwaylandscanner Tool: +##################################################################### + +qt_add_tool(qtwaylandscanner + TOOLS_TARGET QtWaylandScanner # special case + SOURCES + qtwaylandscanner.cpp + PUBLIC_LIBRARIES + Qt::Gui +) + +#### Keys ignored in scope 1:.:.:qtwaylandscanner.pro:: +# _OPTION = "host_build" diff --git a/src/tools/qtwaylandscanner/Qt6WaylandClientMacros.cmake b/src/tools/qtwaylandscanner/Qt6WaylandClientMacros.cmake new file mode 100644 index 00000000000..83e557ffd4d --- /dev/null +++ b/src/tools/qtwaylandscanner/Qt6WaylandClientMacros.cmake @@ -0,0 +1,59 @@ +function(qt6_generate_wayland_protocol_client_sources target) + qt_parse_all_arguments(arg "qt6_generate_wayland_protocol_client_sources" "" "" "FILES" ${ARGN}) + get_target_property(target_binary_dir ${target} BINARY_DIR) + + foreach(protocol_file IN LISTS arg_FILES) + get_filename_component(protocol_name "${protocol_file}" NAME_WLE) + + set(waylandscanner_header_output "${target_binary_dir}/wayland-${protocol_name}-client-protocol.h") + set(waylandscanner_code_output "${target_binary_dir}/wayland-${protocol_name}-protocol.c") + # TODO: Maybe add "client" prefix or suffix to these in Qt6? + set(qtwaylandscanner_header_output "${target_binary_dir}/qwayland-${protocol_name}.h") + set(qtwaylandscanner_code_output "${target_binary_dir}/qwayland-${protocol_name}.cpp") + + add_custom_command( + OUTPUT "${waylandscanner_header_output}" + #TODO: Maybe put the files in ${CMAKE_CURRENT_BINARY_DIR/wayland_generated instead? + COMMAND Wayland::Scanner --include-core-only client-header < "${protocol_file}" > "${waylandscanner_header_output}" + ) + + add_custom_command( + OUTPUT "${waylandscanner_code_output}" + COMMAND Wayland::Scanner --include-core-only code < "${protocol_file}" > "${waylandscanner_code_output}" + ) + + # TODO: Make this less hacky + set(wayland_include_dir "") + get_target_property(is_for_module "${target}" INTERFACE_MODULE_HAS_HEADERS) + if (is_for_module) + set(wayland_include_dir "QtWaylandClient/private") + endif() + + add_custom_command( + OUTPUT "${qtwaylandscanner_header_output}" + COMMAND Qt6::qtwaylandscanner client-header "${protocol_file}" "${wayland_include_dir}" > "${qtwaylandscanner_header_output}" + ) + + # TODO: We need this hack in order to get the xcomposite plugins to build... + # unfortunately, it's not going to work outside QtWayland because we're using waylandclient-private includes + set(qtwaylandscanner_code_include "") + set (targets_that_need_include "xcomposite-egl" "xcomposite-glx" "qwayland-xcomposite-egl" "qwayland-xcomposite-glx") + if ("${target}" IN_LIST targets_that_need_include OR is_for_module) + set(qtwaylandscanner_code_include "") + endif() + + add_custom_command( + OUTPUT "${qtwaylandscanner_code_output}" + COMMAND Qt6::qtwaylandscanner client-code "${protocol_file}" --header-path='${wayland_include_dir}' --add-include='${qtwaylandscanner_code_include}' > "${qtwaylandscanner_code_output}" + ) + + target_sources(${target} PRIVATE + "${waylandscanner_header_output}" + "${waylandscanner_code_output}" + "${qtwaylandscanner_header_output}" + "${qtwaylandscanner_code_output}" + ) + endforeach() + target_include_directories(${target} PRIVATE ${target_binary_dir}) +endfunction() + diff --git a/src/tools/qtwaylandscanner/Qt6WaylandCompositorMacros.cmake b/src/tools/qtwaylandscanner/Qt6WaylandCompositorMacros.cmake new file mode 100644 index 00000000000..15444e6cc69 --- /dev/null +++ b/src/tools/qtwaylandscanner/Qt6WaylandCompositorMacros.cmake @@ -0,0 +1,50 @@ +function(qt6_generate_wayland_protocol_server_sources target) + qt_parse_all_arguments(arg "qt6_generate_wayland_protocol_server_sources" "" "" "FILES" ${ARGN}) + get_target_property(target_binary_dir ${target} BINARY_DIR) + + foreach(protocol_file IN LISTS arg_FILES) + get_filename_component(protocol_name "${protocol_file}" NAME_WLE) + + set(waylandscanner_header_output "${target_binary_dir}/wayland-${protocol_name}-server-protocol.h") + set(waylandscanner_code_output "${target_binary_dir}/wayland-${protocol_name}-protocol.c") + set(qtwaylandscanner_header_output "${target_binary_dir}/qwayland-server-${protocol_name}.h") + set(qtwaylandscanner_code_output "${target_binary_dir}/qwayland-server-${protocol_name}.cpp") + + add_custom_command( + OUTPUT "${waylandscanner_header_output}" + #TODO: Maybe put the files in ${CMAKE_CURRENT_BINARY_DIR/wayland_generated instead? + COMMAND Wayland::Scanner --include-core-only server-header < "${protocol_file}" > "${waylandscanner_header_output}" + ) + add_custom_command( + OUTPUT "${waylandscanner_code_output}" + COMMAND Wayland::Scanner --include-core-only code < "${protocol_file}" > "${waylandscanner_code_output}" + ) + + # TODO: make this less hacky + set(wayland_include_dir "") + #get_target_property(qt_module "${target}" QT_MODULE) + get_target_property(is_for_module "${target}" INTERFACE_MODULE_HAS_HEADERS) + if (is_for_module) + set(wayland_include_dir "QtWaylandCompositor/private") + endif() + + add_custom_command( + OUTPUT "${qtwaylandscanner_header_output}" + COMMAND Qt6::qtwaylandscanner server-header "${protocol_file}" "${wayland_include_dir}" > "${qtwaylandscanner_header_output}" + ) + + add_custom_command( + OUTPUT "${qtwaylandscanner_code_output}" + COMMAND Qt6::qtwaylandscanner server-code "${protocol_file}" "${wayland_include_dir}" > "${qtwaylandscanner_code_output}" + ) + + target_sources(${target} PRIVATE + "${waylandscanner_header_output}" + "${waylandscanner_code_output}" + "${qtwaylandscanner_header_output}" + "${qtwaylandscanner_code_output}" + ) + endforeach() + target_include_directories(${target} PRIVATE ${target_binary_dir}) +endfunction() + diff --git a/tests/auto/wayland/CMakeLists.txt b/tests/auto/wayland/CMakeLists.txt new file mode 100644 index 00000000000..bd18ec3e185 --- /dev/null +++ b/tests/auto/wayland/CMakeLists.txt @@ -0,0 +1,19 @@ +# Generated from client.pro. + +add_subdirectory(client) +add_subdirectory(datadevicev1) +add_subdirectory(fullscreenshellv1) +add_subdirectory(iviapplication) +add_subdirectory(output) +add_subdirectory(primaryselectionv1) +add_subdirectory(seatv4) +add_subdirectory(seatv5) +add_subdirectory(surface) +add_subdirectory(wl_connect) +add_subdirectory(xdgdecorationv1) +add_subdirectory(xdgoutput) +add_subdirectory(xdgshell) +add_subdirectory(xdgshellv6) +if(QT_FEATURE_im) + add_subdirectory(inputcontext) +endif() diff --git a/tests/auto/wayland/client/.prev_CMakeLists.txt b/tests/auto/wayland/client/.prev_CMakeLists.txt new file mode 100644 index 00000000000..6fe4bb92d8c --- /dev/null +++ b/tests/auto/wayland/client/.prev_CMakeLists.txt @@ -0,0 +1,40 @@ +# Generated from client.pro. + +##################################################################### +## tst_client Test: +##################################################################### + +qt_add_test(tst_client + SOURCES + ../shared_old/mockcompositor.cpp ../shared_old/mockcompositor.h + ../shared_old/mockfullscreenshellv1.cpp ../shared_old/mockfullscreenshellv1.h + ../shared_old/mockinput.cpp ../shared_old/mockinput.h + ../shared_old/mockiviapplication.cpp ../shared_old/mockiviapplication.h + ../shared_old/mockoutput.cpp ../shared_old/mockoutput.h + ../shared_old/mocksurface.cpp ../shared_old/mocksurface.h + ../shared_old/mockwlshell.cpp ../shared_old/mockwlshell.h + ../shared_old/mockxdgshellv6.cpp ../shared_old/mockxdgshellv6.h + tst_client.cpp + INCLUDE_DIRECTORIES + ../shared_old + LIBRARIES + Qt::CorePrivate + Qt::GuiPrivate + Qt::WaylandClientPrivate + PUBLIC_LIBRARIES + Qt::Gui + Qt::WaylandClient + Wayland::Client + Wayland::Server +) + +qt6_generate_wayland_protocol_server_sources(tst_client + FILES + ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/fullscreen-shell-unstable-v1.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/ivi-application.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/wayland.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/xdg-shell-unstable-v6.xml +) + +#### Keys ignored in scope 1:.:.:client.pro:: +# check.commands = "$(TESTRUNNER)" "$${PWD}/run-with-all-shells.sh" "$(TESTARGS)" diff --git a/tests/auto/wayland/client/CMakeLists.txt b/tests/auto/wayland/client/CMakeLists.txt new file mode 100644 index 00000000000..a20ea811ce8 --- /dev/null +++ b/tests/auto/wayland/client/CMakeLists.txt @@ -0,0 +1,41 @@ +# Generated from client.pro. + +##################################################################### +## tst_client Test: +##################################################################### + +qt_add_test(tst_client + SOURCES + ../shared_old/mockcompositor.cpp ../shared_old/mockcompositor.h + ../shared_old/mockfullscreenshellv1.cpp ../shared_old/mockfullscreenshellv1.h + ../shared_old/mockinput.cpp ../shared_old/mockinput.h + ../shared_old/mockiviapplication.cpp ../shared_old/mockiviapplication.h + ../shared_old/mockoutput.cpp ../shared_old/mockoutput.h + ../shared_old/mocksurface.cpp ../shared_old/mocksurface.h + ../shared_old/mockwlshell.cpp ../shared_old/mockwlshell.h + ../shared_old/mockxdgshellv6.cpp ../shared_old/mockxdgshellv6.h + tst_client.cpp + INCLUDE_DIRECTORIES + ../shared_old + LIBRARIES + Qt::CorePrivate + Qt::GuiPrivate + Qt::WaylandClientPrivate + PUBLIC_LIBRARIES + Qt::Gui + Qt::WaylandClient + Wayland::Client + Wayland::Server + Threads::Threads # special case +) + +qt6_generate_wayland_protocol_server_sources(tst_client + FILES + ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/fullscreen-shell-unstable-v1.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/ivi-application.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/wayland.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/xdg-shell-unstable-v6.xml +) + +#### Keys ignored in scope 1:.:.:client.pro:: +# check.commands = "$(TESTRUNNER)" "$${PWD}/run-with-all-shells.sh" "$(TESTARGS)" diff --git a/tests/auto/wayland/datadevicev1/.prev_CMakeLists.txt b/tests/auto/wayland/datadevicev1/.prev_CMakeLists.txt new file mode 100644 index 00000000000..bfea1434910 --- /dev/null +++ b/tests/auto/wayland/datadevicev1/.prev_CMakeLists.txt @@ -0,0 +1,31 @@ +# Generated from datadevicev1.pro. + +##################################################################### +## tst_datadevicev1 Test: +##################################################################### + +qt_add_test(tst_datadevicev1 + SOURCES + ../shared/corecompositor.cpp ../shared/corecompositor.h + ../shared/coreprotocol.cpp ../shared/coreprotocol.h + ../shared/datadevice.cpp ../shared/datadevice.h + ../shared/mockcompositor.cpp ../shared/mockcompositor.h + ../shared/textinput.cpp ../shared/textinput.h + ../shared/xdgshell.cpp ../shared/xdgshell.h + tst_datadevicev1.cpp + INCLUDE_DIRECTORIES + ../shared + LIBRARIES + Qt::WaylandClientPrivate + PUBLIC_LIBRARIES + Qt::Gui + Qt::WaylandClient + Wayland::Server +) + +qt6_generate_wayland_protocol_server_sources(tst_datadevicev1 + FILES + ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/text-input-unstable-v2.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/wayland.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-shell.xml +) diff --git a/tests/auto/wayland/datadevicev1/CMakeLists.txt b/tests/auto/wayland/datadevicev1/CMakeLists.txt new file mode 100644 index 00000000000..ad58772d4b0 --- /dev/null +++ b/tests/auto/wayland/datadevicev1/CMakeLists.txt @@ -0,0 +1,32 @@ +# Generated from datadevicev1.pro. + +##################################################################### +## tst_datadevicev1 Test: +##################################################################### + +qt_add_test(tst_datadevicev1 + SOURCES + ../shared/corecompositor.cpp ../shared/corecompositor.h + ../shared/coreprotocol.cpp ../shared/coreprotocol.h + ../shared/datadevice.cpp ../shared/datadevice.h + ../shared/mockcompositor.cpp ../shared/mockcompositor.h + ../shared/textinput.cpp ../shared/textinput.h + ../shared/xdgshell.cpp ../shared/xdgshell.h + tst_datadevicev1.cpp + INCLUDE_DIRECTORIES + ../shared + LIBRARIES + Qt::WaylandClientPrivate + PUBLIC_LIBRARIES + Qt::Gui + Qt::WaylandClient + Wayland::Server + Threads::Threads # special case +) + +qt6_generate_wayland_protocol_server_sources(tst_datadevicev1 + FILES + ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/text-input-unstable-v2.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/wayland.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-shell.xml +) diff --git a/tests/auto/wayland/fullscreenshellv1/.prev_CMakeLists.txt b/tests/auto/wayland/fullscreenshellv1/.prev_CMakeLists.txt new file mode 100644 index 00000000000..5daef3bb3ff --- /dev/null +++ b/tests/auto/wayland/fullscreenshellv1/.prev_CMakeLists.txt @@ -0,0 +1,37 @@ +# Generated from fullscreenshellv1.pro. + +##################################################################### +## tst_client_fullscreenshellv1 Test: +##################################################################### + +qt_add_test(tst_client_fullscreenshellv1 + SOURCES + ../shared_old/mockcompositor.cpp ../shared_old/mockcompositor.h + ../shared_old/mockfullscreenshellv1.cpp ../shared_old/mockfullscreenshellv1.h + ../shared_old/mockinput.cpp ../shared_old/mockinput.h + ../shared_old/mockiviapplication.cpp ../shared_old/mockiviapplication.h + ../shared_old/mockoutput.cpp ../shared_old/mockoutput.h + ../shared_old/mocksurface.cpp ../shared_old/mocksurface.h + ../shared_old/mockwlshell.cpp ../shared_old/mockwlshell.h + ../shared_old/mockxdgshellv6.cpp ../shared_old/mockxdgshellv6.h + tst_fullscreenshellv1.cpp + INCLUDE_DIRECTORIES + ../shared_old + LIBRARIES + Qt::CorePrivate + Qt::GuiPrivate + Qt::WaylandClientPrivate + PUBLIC_LIBRARIES + Qt::Gui + Qt::WaylandClient + Wayland::Client + Wayland::Server +) + +qt6_generate_wayland_protocol_server_sources(tst_client_fullscreenshellv1 + FILES + ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/fullscreen-shell-unstable-v1.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/ivi-application.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/wayland.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/xdg-shell-unstable-v6.xml +) diff --git a/tests/auto/wayland/fullscreenshellv1/CMakeLists.txt b/tests/auto/wayland/fullscreenshellv1/CMakeLists.txt new file mode 100644 index 00000000000..00348df9948 --- /dev/null +++ b/tests/auto/wayland/fullscreenshellv1/CMakeLists.txt @@ -0,0 +1,38 @@ +# Generated from fullscreenshellv1.pro. + +##################################################################### +## tst_client_fullscreenshellv1 Test: +##################################################################### + +qt_add_test(tst_client_fullscreenshellv1 + SOURCES + ../shared_old/mockcompositor.cpp ../shared_old/mockcompositor.h + ../shared_old/mockfullscreenshellv1.cpp ../shared_old/mockfullscreenshellv1.h + ../shared_old/mockinput.cpp ../shared_old/mockinput.h + ../shared_old/mockiviapplication.cpp ../shared_old/mockiviapplication.h + ../shared_old/mockoutput.cpp ../shared_old/mockoutput.h + ../shared_old/mocksurface.cpp ../shared_old/mocksurface.h + ../shared_old/mockwlshell.cpp ../shared_old/mockwlshell.h + ../shared_old/mockxdgshellv6.cpp ../shared_old/mockxdgshellv6.h + tst_fullscreenshellv1.cpp + INCLUDE_DIRECTORIES + ../shared_old + LIBRARIES + Qt::CorePrivate + Qt::GuiPrivate + Qt::WaylandClientPrivate + PUBLIC_LIBRARIES + Qt::Gui + Qt::WaylandClient + Wayland::Client + Wayland::Server + Threads::Threads # special case +) + +qt6_generate_wayland_protocol_server_sources(tst_client_fullscreenshellv1 + FILES + ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/fullscreen-shell-unstable-v1.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/ivi-application.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/wayland.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/xdg-shell-unstable-v6.xml +) diff --git a/tests/auto/wayland/inputcontext/.prev_CMakeLists.txt b/tests/auto/wayland/inputcontext/.prev_CMakeLists.txt new file mode 100644 index 00000000000..d5df86a13eb --- /dev/null +++ b/tests/auto/wayland/inputcontext/.prev_CMakeLists.txt @@ -0,0 +1,31 @@ +# Generated from inputcontext.pro. + +##################################################################### +## tst_inputcontext Test: +##################################################################### + +qt_add_test(tst_inputcontext + SOURCES + ../shared/corecompositor.cpp ../shared/corecompositor.h + ../shared/coreprotocol.cpp ../shared/coreprotocol.h + ../shared/datadevice.cpp ../shared/datadevice.h + ../shared/mockcompositor.cpp ../shared/mockcompositor.h + ../shared/textinput.cpp ../shared/textinput.h + ../shared/xdgshell.cpp ../shared/xdgshell.h + tst_inputcontext.cpp + INCLUDE_DIRECTORIES + ../shared + LIBRARIES + Qt::WaylandClientPrivate + PUBLIC_LIBRARIES + Qt::Gui + Qt::WaylandClient + Wayland::Server +) + +qt6_generate_wayland_protocol_server_sources(tst_inputcontext + FILES + ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/text-input-unstable-v2.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/wayland.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-shell.xml +) diff --git a/tests/auto/wayland/inputcontext/CMakeLists.txt b/tests/auto/wayland/inputcontext/CMakeLists.txt new file mode 100644 index 00000000000..dfa788b313b --- /dev/null +++ b/tests/auto/wayland/inputcontext/CMakeLists.txt @@ -0,0 +1,32 @@ +# Generated from inputcontext.pro. + +##################################################################### +## tst_inputcontext Test: +##################################################################### + +qt_add_test(tst_inputcontext + SOURCES + ../shared/corecompositor.cpp ../shared/corecompositor.h + ../shared/coreprotocol.cpp ../shared/coreprotocol.h + ../shared/datadevice.cpp ../shared/datadevice.h + ../shared/mockcompositor.cpp ../shared/mockcompositor.h + ../shared/textinput.cpp ../shared/textinput.h + ../shared/xdgshell.cpp ../shared/xdgshell.h + tst_inputcontext.cpp + INCLUDE_DIRECTORIES + ../shared + LIBRARIES + Qt::WaylandClientPrivate + PUBLIC_LIBRARIES + Qt::Gui + Qt::WaylandClient + Wayland::Server + Threads::Threads # special case +) + +qt6_generate_wayland_protocol_server_sources(tst_inputcontext + FILES + ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/text-input-unstable-v2.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/wayland.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-shell.xml +) diff --git a/tests/auto/wayland/iviapplication/.prev_CMakeLists.txt b/tests/auto/wayland/iviapplication/.prev_CMakeLists.txt new file mode 100644 index 00000000000..4193ba9b07f --- /dev/null +++ b/tests/auto/wayland/iviapplication/.prev_CMakeLists.txt @@ -0,0 +1,37 @@ +# Generated from iviapplication.pro. + +##################################################################### +## tst_client_iviapplication Test: +##################################################################### + +qt_add_test(tst_client_iviapplication + SOURCES + ../shared_old/mockcompositor.cpp ../shared_old/mockcompositor.h + ../shared_old/mockfullscreenshellv1.cpp ../shared_old/mockfullscreenshellv1.h + ../shared_old/mockinput.cpp ../shared_old/mockinput.h + ../shared_old/mockiviapplication.cpp ../shared_old/mockiviapplication.h + ../shared_old/mockoutput.cpp ../shared_old/mockoutput.h + ../shared_old/mocksurface.cpp ../shared_old/mocksurface.h + ../shared_old/mockwlshell.cpp ../shared_old/mockwlshell.h + ../shared_old/mockxdgshellv6.cpp ../shared_old/mockxdgshellv6.h + tst_iviapplication.cpp + INCLUDE_DIRECTORIES + ../shared_old + LIBRARIES + Qt::CorePrivate + Qt::GuiPrivate + Qt::WaylandClientPrivate + PUBLIC_LIBRARIES + Qt::Gui + Qt::WaylandClient + Wayland::Client + Wayland::Server +) + +qt6_generate_wayland_protocol_server_sources(tst_client_iviapplication + FILES + ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/fullscreen-shell-unstable-v1.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/ivi-application.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/wayland.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/xdg-shell-unstable-v6.xml +) diff --git a/tests/auto/wayland/output/.prev_CMakeLists.txt b/tests/auto/wayland/output/.prev_CMakeLists.txt new file mode 100644 index 00000000000..8595888e955 --- /dev/null +++ b/tests/auto/wayland/output/.prev_CMakeLists.txt @@ -0,0 +1,31 @@ +# Generated from output.pro. + +##################################################################### +## tst_output Test: +##################################################################### + +qt_add_test(tst_output + SOURCES + ../shared/corecompositor.cpp ../shared/corecompositor.h + ../shared/coreprotocol.cpp ../shared/coreprotocol.h + ../shared/datadevice.cpp ../shared/datadevice.h + ../shared/mockcompositor.cpp ../shared/mockcompositor.h + ../shared/textinput.cpp ../shared/textinput.h + ../shared/xdgshell.cpp ../shared/xdgshell.h + tst_output.cpp + INCLUDE_DIRECTORIES + ../shared + LIBRARIES + Qt::WaylandClientPrivate + PUBLIC_LIBRARIES + Qt::Gui + Qt::WaylandClient + Wayland::Server +) + +qt6_generate_wayland_protocol_server_sources(tst_output + FILES + ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/text-input-unstable-v2.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/wayland.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-shell.xml +) diff --git a/tests/auto/wayland/output/CMakeLists.txt b/tests/auto/wayland/output/CMakeLists.txt new file mode 100644 index 00000000000..c453ac424f1 --- /dev/null +++ b/tests/auto/wayland/output/CMakeLists.txt @@ -0,0 +1,32 @@ +# Generated from output.pro. + +##################################################################### +## tst_output Test: +##################################################################### + +qt_add_test(tst_output + SOURCES + ../shared/corecompositor.cpp ../shared/corecompositor.h + ../shared/coreprotocol.cpp ../shared/coreprotocol.h + ../shared/datadevice.cpp ../shared/datadevice.h + ../shared/mockcompositor.cpp ../shared/mockcompositor.h + ../shared/textinput.cpp ../shared/textinput.h + ../shared/xdgshell.cpp ../shared/xdgshell.h + tst_output.cpp + INCLUDE_DIRECTORIES + ../shared + LIBRARIES + Qt::WaylandClientPrivate + PUBLIC_LIBRARIES + Qt::Gui + Qt::WaylandClient + Wayland::Server + Threads::Threads # special case +) + +qt6_generate_wayland_protocol_server_sources(tst_output + FILES + ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/text-input-unstable-v2.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/wayland.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-shell.xml +) diff --git a/tests/auto/wayland/primaryselectionv1/.prev_CMakeLists.txt b/tests/auto/wayland/primaryselectionv1/.prev_CMakeLists.txt new file mode 100644 index 00000000000..77a994dd4f9 --- /dev/null +++ b/tests/auto/wayland/primaryselectionv1/.prev_CMakeLists.txt @@ -0,0 +1,32 @@ +# Generated from primaryselectionv1.pro. + +##################################################################### +## tst_primaryselectionv1 Test: +##################################################################### + +qt_add_test(tst_primaryselectionv1 + SOURCES + ../shared/corecompositor.cpp ../shared/corecompositor.h + ../shared/coreprotocol.cpp ../shared/coreprotocol.h + ../shared/datadevice.cpp ../shared/datadevice.h + ../shared/mockcompositor.cpp ../shared/mockcompositor.h + ../shared/textinput.cpp ../shared/textinput.h + ../shared/xdgshell.cpp ../shared/xdgshell.h + tst_primaryselectionv1.cpp + INCLUDE_DIRECTORIES + ../shared + LIBRARIES + Qt::WaylandClientPrivate + PUBLIC_LIBRARIES + Qt::Gui + Qt::WaylandClient + Wayland::Server +) + +qt6_generate_wayland_protocol_server_sources(tst_primaryselectionv1 + FILES + ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/wp-primary-selection-unstable-v1.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/text-input-unstable-v2.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/wayland.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-shell.xml +) diff --git a/tests/auto/wayland/primaryselectionv1/CMakeLists.txt b/tests/auto/wayland/primaryselectionv1/CMakeLists.txt new file mode 100644 index 00000000000..af912234398 --- /dev/null +++ b/tests/auto/wayland/primaryselectionv1/CMakeLists.txt @@ -0,0 +1,33 @@ +# Generated from primaryselectionv1.pro. + +##################################################################### +## tst_primaryselectionv1 Test: +##################################################################### + +qt_add_test(tst_primaryselectionv1 + SOURCES + ../shared/corecompositor.cpp ../shared/corecompositor.h + ../shared/coreprotocol.cpp ../shared/coreprotocol.h + ../shared/datadevice.cpp ../shared/datadevice.h + ../shared/mockcompositor.cpp ../shared/mockcompositor.h + ../shared/textinput.cpp ../shared/textinput.h + ../shared/xdgshell.cpp ../shared/xdgshell.h + tst_primaryselectionv1.cpp + INCLUDE_DIRECTORIES + ../shared + LIBRARIES + Qt::WaylandClientPrivate + PUBLIC_LIBRARIES + Qt::Gui + Qt::WaylandClient + Wayland::Server + Threads::Threads # special case +) + +qt6_generate_wayland_protocol_server_sources(tst_primaryselectionv1 + FILES + ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/wp-primary-selection-unstable-v1.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/text-input-unstable-v2.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/wayland.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-shell.xml +) diff --git a/tests/auto/wayland/seatv4/.prev_CMakeLists.txt b/tests/auto/wayland/seatv4/.prev_CMakeLists.txt new file mode 100644 index 00000000000..ab7eb380f04 --- /dev/null +++ b/tests/auto/wayland/seatv4/.prev_CMakeLists.txt @@ -0,0 +1,42 @@ +# Generated from seatv4.pro. + +##################################################################### +## tst_seatv4 Test: +##################################################################### + +qt_add_test(tst_seatv4 + SOURCES + ../shared/corecompositor.cpp ../shared/corecompositor.h + ../shared/coreprotocol.cpp ../shared/coreprotocol.h + ../shared/datadevice.cpp ../shared/datadevice.h + ../shared/mockcompositor.cpp ../shared/mockcompositor.h + ../shared/textinput.cpp ../shared/textinput.h + ../shared/xdgshell.cpp ../shared/xdgshell.h + tst_seatv4.cpp + INCLUDE_DIRECTORIES + ../shared + LIBRARIES + Qt::WaylandClientPrivate + PUBLIC_LIBRARIES + Qt::Gui + Qt::WaylandClient + Wayland::Server +) + +qt6_generate_wayland_protocol_server_sources(tst_seatv4 + FILES + ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/text-input-unstable-v2.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/wayland.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-shell.xml +) + +## Scopes: +##################################################################### + +qt_extend_target(tst_seatv4 CONDITION QT_FEATURE_cursor + LIBRARIES + Qt::GuiPrivate + PUBLIC_LIBRARIES + Qt::Gui + Wayland::Cursor +) diff --git a/tests/auto/wayland/seatv4/CMakeLists.txt b/tests/auto/wayland/seatv4/CMakeLists.txt new file mode 100644 index 00000000000..bd14a6a8bf6 --- /dev/null +++ b/tests/auto/wayland/seatv4/CMakeLists.txt @@ -0,0 +1,43 @@ +# Generated from seatv4.pro. + +##################################################################### +## tst_seatv4 Test: +##################################################################### + +qt_add_test(tst_seatv4 + SOURCES + ../shared/corecompositor.cpp ../shared/corecompositor.h + ../shared/coreprotocol.cpp ../shared/coreprotocol.h + ../shared/datadevice.cpp ../shared/datadevice.h + ../shared/mockcompositor.cpp ../shared/mockcompositor.h + ../shared/textinput.cpp ../shared/textinput.h + ../shared/xdgshell.cpp ../shared/xdgshell.h + tst_seatv4.cpp + INCLUDE_DIRECTORIES + ../shared + LIBRARIES + Qt::WaylandClientPrivate + PUBLIC_LIBRARIES + Qt::Gui + Qt::WaylandClient + Wayland::Server + Threads::Threads # special case +) + +qt6_generate_wayland_protocol_server_sources(tst_seatv4 + FILES + ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/text-input-unstable-v2.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/wayland.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-shell.xml +) + +## Scopes: +##################################################################### + +qt_extend_target(tst_seatv4 CONDITION QT_FEATURE_cursor + LIBRARIES + Qt::GuiPrivate + PUBLIC_LIBRARIES + Qt::Gui + Wayland::Cursor +) diff --git a/tests/auto/wayland/seatv5/.prev_CMakeLists.txt b/tests/auto/wayland/seatv5/.prev_CMakeLists.txt new file mode 100644 index 00000000000..778c42c0bf3 --- /dev/null +++ b/tests/auto/wayland/seatv5/.prev_CMakeLists.txt @@ -0,0 +1,31 @@ +# Generated from seatv5.pro. + +##################################################################### +## tst_seatv5 Test: +##################################################################### + +qt_add_test(tst_seatv5 + SOURCES + ../shared/corecompositor.cpp ../shared/corecompositor.h + ../shared/coreprotocol.cpp ../shared/coreprotocol.h + ../shared/datadevice.cpp ../shared/datadevice.h + ../shared/mockcompositor.cpp ../shared/mockcompositor.h + ../shared/textinput.cpp ../shared/textinput.h + ../shared/xdgshell.cpp ../shared/xdgshell.h + tst_seatv5.cpp + INCLUDE_DIRECTORIES + ../shared + LIBRARIES + Qt::WaylandClientPrivate + PUBLIC_LIBRARIES + Qt::Gui + Qt::WaylandClient + Wayland::Server +) + +qt6_generate_wayland_protocol_server_sources(tst_seatv5 + FILES + ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/text-input-unstable-v2.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/wayland.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-shell.xml +) diff --git a/tests/auto/wayland/seatv5/CMakeLists.txt b/tests/auto/wayland/seatv5/CMakeLists.txt new file mode 100644 index 00000000000..38c5d980f53 --- /dev/null +++ b/tests/auto/wayland/seatv5/CMakeLists.txt @@ -0,0 +1,32 @@ +# Generated from seatv5.pro. + +##################################################################### +## tst_seatv5 Test: +##################################################################### + +qt_add_test(tst_seatv5 + SOURCES + ../shared/corecompositor.cpp ../shared/corecompositor.h + ../shared/coreprotocol.cpp ../shared/coreprotocol.h + ../shared/datadevice.cpp ../shared/datadevice.h + ../shared/mockcompositor.cpp ../shared/mockcompositor.h + ../shared/textinput.cpp ../shared/textinput.h + ../shared/xdgshell.cpp ../shared/xdgshell.h + tst_seatv5.cpp + INCLUDE_DIRECTORIES + ../shared + LIBRARIES + Qt::WaylandClientPrivate + PUBLIC_LIBRARIES + Qt::Gui + Qt::WaylandClient + Wayland::Server + Threads::Threads # special case +) + +qt6_generate_wayland_protocol_server_sources(tst_seatv5 + FILES + ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/text-input-unstable-v2.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/wayland.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-shell.xml +) diff --git a/tests/auto/wayland/surface/.prev_CMakeLists.txt b/tests/auto/wayland/surface/.prev_CMakeLists.txt new file mode 100644 index 00000000000..bb728928614 --- /dev/null +++ b/tests/auto/wayland/surface/.prev_CMakeLists.txt @@ -0,0 +1,31 @@ +# Generated from surface.pro. + +##################################################################### +## tst_surface Test: +##################################################################### + +qt_add_test(tst_surface + SOURCES + ../shared/corecompositor.cpp ../shared/corecompositor.h + ../shared/coreprotocol.cpp ../shared/coreprotocol.h + ../shared/datadevice.cpp ../shared/datadevice.h + ../shared/mockcompositor.cpp ../shared/mockcompositor.h + ../shared/textinput.cpp ../shared/textinput.h + ../shared/xdgshell.cpp ../shared/xdgshell.h + tst_surface.cpp + INCLUDE_DIRECTORIES + ../shared + LIBRARIES + Qt::WaylandClientPrivate + PUBLIC_LIBRARIES + Qt::Gui + Qt::WaylandClient + Wayland::Server +) + +qt6_generate_wayland_protocol_server_sources(tst_surface + FILES + ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/text-input-unstable-v2.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/wayland.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-shell.xml +) diff --git a/tests/auto/wayland/surface/CMakeLists.txt b/tests/auto/wayland/surface/CMakeLists.txt new file mode 100644 index 00000000000..1470f414e60 --- /dev/null +++ b/tests/auto/wayland/surface/CMakeLists.txt @@ -0,0 +1,32 @@ +# Generated from surface.pro. + +##################################################################### +## tst_surface Test: +##################################################################### + +qt_add_test(tst_surface + SOURCES + ../shared/corecompositor.cpp ../shared/corecompositor.h + ../shared/coreprotocol.cpp ../shared/coreprotocol.h + ../shared/datadevice.cpp ../shared/datadevice.h + ../shared/mockcompositor.cpp ../shared/mockcompositor.h + ../shared/textinput.cpp ../shared/textinput.h + ../shared/xdgshell.cpp ../shared/xdgshell.h + tst_surface.cpp + INCLUDE_DIRECTORIES + ../shared + LIBRARIES + Qt::WaylandClientPrivate + PUBLIC_LIBRARIES + Qt::Gui + Qt::WaylandClient + Wayland::Server + Threads::Threads # special case +) + +qt6_generate_wayland_protocol_server_sources(tst_surface + FILES + ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/text-input-unstable-v2.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/wayland.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-shell.xml +) diff --git a/tests/auto/wayland/wl_connect/CMakeLists.txt b/tests/auto/wayland/wl_connect/CMakeLists.txt new file mode 100644 index 00000000000..5ad3ac6a4a3 --- /dev/null +++ b/tests/auto/wayland/wl_connect/CMakeLists.txt @@ -0,0 +1,14 @@ +# Generated from wl_connect.pro. + +##################################################################### +## tst_wlconnect Test: +##################################################################### + +qt_add_test(tst_wlconnect + SOURCES + tst_wlconnect.cpp + LIBRARIES + Qt::GuiPrivate + PUBLIC_LIBRARIES + Qt::Gui +) diff --git a/tests/auto/wayland/xdgdecorationv1/.prev_CMakeLists.txt b/tests/auto/wayland/xdgdecorationv1/.prev_CMakeLists.txt new file mode 100644 index 00000000000..a73e1055c75 --- /dev/null +++ b/tests/auto/wayland/xdgdecorationv1/.prev_CMakeLists.txt @@ -0,0 +1,32 @@ +# Generated from xdgdecorationv1.pro. + +##################################################################### +## tst_xdgdecorationv1 Test: +##################################################################### + +qt_add_test(tst_xdgdecorationv1 + SOURCES + ../shared/corecompositor.cpp ../shared/corecompositor.h + ../shared/coreprotocol.cpp ../shared/coreprotocol.h + ../shared/datadevice.cpp ../shared/datadevice.h + ../shared/mockcompositor.cpp ../shared/mockcompositor.h + ../shared/textinput.cpp ../shared/textinput.h + ../shared/xdgshell.cpp ../shared/xdgshell.h + tst_xdgdecorationv1.cpp + INCLUDE_DIRECTORIES + ../shared + LIBRARIES + Qt::WaylandClientPrivate + PUBLIC_LIBRARIES + Qt::Gui + Qt::WaylandClient + Wayland::Server +) + +qt6_generate_wayland_protocol_server_sources(tst_xdgdecorationv1 + FILES + ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/xdg-decoration-unstable-v1.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/text-input-unstable-v2.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/wayland.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-shell.xml +) diff --git a/tests/auto/wayland/xdgdecorationv1/CMakeLists.txt b/tests/auto/wayland/xdgdecorationv1/CMakeLists.txt new file mode 100644 index 00000000000..5d26b7fc865 --- /dev/null +++ b/tests/auto/wayland/xdgdecorationv1/CMakeLists.txt @@ -0,0 +1,33 @@ +# Generated from xdgdecorationv1.pro. + +##################################################################### +## tst_xdgdecorationv1 Test: +##################################################################### + +qt_add_test(tst_xdgdecorationv1 + SOURCES + ../shared/corecompositor.cpp ../shared/corecompositor.h + ../shared/coreprotocol.cpp ../shared/coreprotocol.h + ../shared/datadevice.cpp ../shared/datadevice.h + ../shared/mockcompositor.cpp ../shared/mockcompositor.h + ../shared/textinput.cpp ../shared/textinput.h + ../shared/xdgshell.cpp ../shared/xdgshell.h + tst_xdgdecorationv1.cpp + INCLUDE_DIRECTORIES + ../shared + LIBRARIES + Qt::WaylandClientPrivate + PUBLIC_LIBRARIES + Qt::Gui + Qt::WaylandClient + Wayland::Server + Threads::Threads # special case +) + +qt6_generate_wayland_protocol_server_sources(tst_xdgdecorationv1 + FILES + ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/xdg-decoration-unstable-v1.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/text-input-unstable-v2.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/wayland.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-shell.xml +) diff --git a/tests/auto/wayland/xdgoutput/.prev_CMakeLists.txt b/tests/auto/wayland/xdgoutput/.prev_CMakeLists.txt new file mode 100644 index 00000000000..1a3afc1e292 --- /dev/null +++ b/tests/auto/wayland/xdgoutput/.prev_CMakeLists.txt @@ -0,0 +1,32 @@ +# Generated from xdgoutput.pro. + +##################################################################### +## tst_xdgoutput Test: +##################################################################### + +qt_add_test(tst_xdgoutput + SOURCES + ../shared/corecompositor.cpp ../shared/corecompositor.h + ../shared/coreprotocol.cpp ../shared/coreprotocol.h + ../shared/datadevice.cpp ../shared/datadevice.h + ../shared/mockcompositor.cpp ../shared/mockcompositor.h + ../shared/textinput.cpp ../shared/textinput.h + ../shared/xdgshell.cpp ../shared/xdgshell.h + tst_xdgoutput.cpp + INCLUDE_DIRECTORIES + ../shared + LIBRARIES + Qt::WaylandClientPrivate + PUBLIC_LIBRARIES + Qt::Gui + Qt::WaylandClient + Wayland::Server +) + +qt6_generate_wayland_protocol_server_sources(tst_xdgoutput + FILES + ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/xdg-output-unstable-v1.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/text-input-unstable-v2.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/wayland.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-shell.xml +) diff --git a/tests/auto/wayland/xdgoutput/CMakeLists.txt b/tests/auto/wayland/xdgoutput/CMakeLists.txt new file mode 100644 index 00000000000..855268c9453 --- /dev/null +++ b/tests/auto/wayland/xdgoutput/CMakeLists.txt @@ -0,0 +1,33 @@ +# Generated from xdgoutput.pro. + +##################################################################### +## tst_xdgoutput Test: +##################################################################### + +qt_add_test(tst_xdgoutput + SOURCES + ../shared/corecompositor.cpp ../shared/corecompositor.h + ../shared/coreprotocol.cpp ../shared/coreprotocol.h + ../shared/datadevice.cpp ../shared/datadevice.h + ../shared/mockcompositor.cpp ../shared/mockcompositor.h + ../shared/textinput.cpp ../shared/textinput.h + ../shared/xdgshell.cpp ../shared/xdgshell.h + tst_xdgoutput.cpp + INCLUDE_DIRECTORIES + ../shared + LIBRARIES + Qt::WaylandClientPrivate + PUBLIC_LIBRARIES + Qt::Gui + Qt::WaylandClient + Wayland::Server + Threads::Threads # special case +) + +qt6_generate_wayland_protocol_server_sources(tst_xdgoutput + FILES + ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/xdg-output-unstable-v1.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/text-input-unstable-v2.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/wayland.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-shell.xml +) diff --git a/tests/auto/wayland/xdgshell/.prev_CMakeLists.txt b/tests/auto/wayland/xdgshell/.prev_CMakeLists.txt new file mode 100644 index 00000000000..4dc670e9d91 --- /dev/null +++ b/tests/auto/wayland/xdgshell/.prev_CMakeLists.txt @@ -0,0 +1,31 @@ +# Generated from xdgshell.pro. + +##################################################################### +## tst_xdgshell Test: +##################################################################### + +qt_add_test(tst_xdgshell + SOURCES + ../shared/corecompositor.cpp ../shared/corecompositor.h + ../shared/coreprotocol.cpp ../shared/coreprotocol.h + ../shared/datadevice.cpp ../shared/datadevice.h + ../shared/mockcompositor.cpp ../shared/mockcompositor.h + ../shared/textinput.cpp ../shared/textinput.h + ../shared/xdgshell.cpp ../shared/xdgshell.h + tst_xdgshell.cpp + INCLUDE_DIRECTORIES + ../shared + LIBRARIES + Qt::WaylandClientPrivate + PUBLIC_LIBRARIES + Qt::Gui + Qt::WaylandClient + Wayland::Server +) + +qt6_generate_wayland_protocol_server_sources(tst_xdgshell + FILES + ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/text-input-unstable-v2.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/wayland.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-shell.xml +) diff --git a/tests/auto/wayland/xdgshell/CMakeLists.txt b/tests/auto/wayland/xdgshell/CMakeLists.txt new file mode 100644 index 00000000000..025013e9f26 --- /dev/null +++ b/tests/auto/wayland/xdgshell/CMakeLists.txt @@ -0,0 +1,32 @@ +# Generated from xdgshell.pro. + +##################################################################### +## tst_xdgshell Test: +##################################################################### + +qt_add_test(tst_xdgshell + SOURCES + ../shared/corecompositor.cpp ../shared/corecompositor.h + ../shared/coreprotocol.cpp ../shared/coreprotocol.h + ../shared/datadevice.cpp ../shared/datadevice.h + ../shared/mockcompositor.cpp ../shared/mockcompositor.h + ../shared/textinput.cpp ../shared/textinput.h + ../shared/xdgshell.cpp ../shared/xdgshell.h + tst_xdgshell.cpp + INCLUDE_DIRECTORIES + ../shared + LIBRARIES + Qt::WaylandClientPrivate + PUBLIC_LIBRARIES + Qt::Gui + Qt::WaylandClient + Wayland::Server + Threads::Threads # special case +) + +qt6_generate_wayland_protocol_server_sources(tst_xdgshell + FILES + ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/text-input-unstable-v2.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/wayland.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-shell.xml +) diff --git a/tests/auto/wayland/xdgshellv6/.prev_CMakeLists.txt b/tests/auto/wayland/xdgshellv6/.prev_CMakeLists.txt new file mode 100644 index 00000000000..ee3514f58a1 --- /dev/null +++ b/tests/auto/wayland/xdgshellv6/.prev_CMakeLists.txt @@ -0,0 +1,37 @@ +# Generated from xdgshellv6.pro. + +##################################################################### +## tst_client_xdgshellv6 Test: +##################################################################### + +qt_add_test(tst_client_xdgshellv6 + SOURCES + ../shared_old/mockcompositor.cpp ../shared_old/mockcompositor.h + ../shared_old/mockfullscreenshellv1.cpp ../shared_old/mockfullscreenshellv1.h + ../shared_old/mockinput.cpp ../shared_old/mockinput.h + ../shared_old/mockiviapplication.cpp ../shared_old/mockiviapplication.h + ../shared_old/mockoutput.cpp ../shared_old/mockoutput.h + ../shared_old/mocksurface.cpp ../shared_old/mocksurface.h + ../shared_old/mockwlshell.cpp ../shared_old/mockwlshell.h + ../shared_old/mockxdgshellv6.cpp ../shared_old/mockxdgshellv6.h + tst_xdgshellv6.cpp + INCLUDE_DIRECTORIES + ../shared_old + LIBRARIES + Qt::CorePrivate + Qt::GuiPrivate + Qt::WaylandClientPrivate + PUBLIC_LIBRARIES + Qt::Gui + Qt::WaylandClient + Wayland::Client + Wayland::Server +) + +qt6_generate_wayland_protocol_server_sources(tst_client_xdgshellv6 + FILES + ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/fullscreen-shell-unstable-v1.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/ivi-application.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/wayland.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/xdg-shell-unstable-v6.xml +) diff --git a/tests/auto/wayland/xdgshellv6/CMakeLists.txt b/tests/auto/wayland/xdgshellv6/CMakeLists.txt new file mode 100644 index 00000000000..fe358889906 --- /dev/null +++ b/tests/auto/wayland/xdgshellv6/CMakeLists.txt @@ -0,0 +1,38 @@ +# Generated from xdgshellv6.pro. + +##################################################################### +## tst_client_xdgshellv6 Test: +##################################################################### + +qt_add_test(tst_client_xdgshellv6 + SOURCES + ../shared_old/mockcompositor.cpp ../shared_old/mockcompositor.h + ../shared_old/mockfullscreenshellv1.cpp ../shared_old/mockfullscreenshellv1.h + ../shared_old/mockinput.cpp ../shared_old/mockinput.h + ../shared_old/mockiviapplication.cpp ../shared_old/mockiviapplication.h + ../shared_old/mockoutput.cpp ../shared_old/mockoutput.h + ../shared_old/mocksurface.cpp ../shared_old/mocksurface.h + ../shared_old/mockwlshell.cpp ../shared_old/mockwlshell.h + ../shared_old/mockxdgshellv6.cpp ../shared_old/mockxdgshellv6.h + tst_xdgshellv6.cpp + INCLUDE_DIRECTORIES + ../shared_old + LIBRARIES + Qt::CorePrivate + Qt::GuiPrivate + Qt::WaylandClientPrivate + PUBLIC_LIBRARIES + Qt::Gui + Qt::WaylandClient + Wayland::Client + Wayland::Server + Threads::Threads # special case +) + +qt6_generate_wayland_protocol_server_sources(tst_client_xdgshellv6 + FILES + ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/fullscreen-shell-unstable-v1.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/ivi-application.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/wayland.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/xdg-shell-unstable-v6.xml +) From b8b8c1ce5acceab8751f5c192314e305565503f0 Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Thu, 28 Nov 2019 02:31:17 +0100 Subject: [PATCH 0790/1507] Avoid animating single frame cursors Currently to determine if a cursor is animated or not we check the cursor theme delay. This doesn't work in practice as by default many cursor themes have a delay of 50 set even if they don't animate. This comes from xcursorgen which specifies a delay of 50ms if there isn't anything set in the config. (https://github.com/freedesktop/xcursorgen/blob/master/xcursorgen.c#L92) Given many themes will have a delay we should also check the number of images in a given cursor. In order to do that without a double lookup QWaylandCursor needed to return the native wl_cursor, not wl_cursor_image and move the relevant logic. Change-Id: Ie782ace8054910ae76e61cab33ceca0377194929 Reviewed-by: Johan Helsing --- src/plugins/platforms/wayland/qwaylandcursor.cpp | 12 ++---------- src/plugins/platforms/wayland/qwaylandcursor_p.h | 3 +-- .../platforms/wayland/qwaylandinputdevice.cpp | 16 ++++++++++++---- 3 files changed, 15 insertions(+), 16 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandcursor.cpp b/src/plugins/platforms/wayland/qwaylandcursor.cpp index 4356b23a0a8..1d3d88bea3a 100644 --- a/src/plugins/platforms/wayland/qwaylandcursor.cpp +++ b/src/plugins/platforms/wayland/qwaylandcursor.cpp @@ -219,7 +219,7 @@ wl_cursor *QWaylandCursorTheme::requestCursor(WaylandCursor shape) return nullptr; } -::wl_cursor_image *QWaylandCursorTheme::cursorImage(Qt::CursorShape shape, uint millisecondsIntoAnimation) +::wl_cursor *QWaylandCursorTheme::cursor(Qt::CursorShape shape) { struct wl_cursor *waylandCursor = nullptr; @@ -237,15 +237,7 @@ wl_cursor *QWaylandCursorTheme::requestCursor(WaylandCursor shape) return nullptr; } - int frame = wl_cursor_frame(waylandCursor, millisecondsIntoAnimation); - ::wl_cursor_image *image = waylandCursor->images[frame]; - ::wl_buffer *buffer = wl_cursor_image_get_buffer(image); - if (!buffer) { - qCWarning(lcQpaWayland) << "Could not find buffer for cursor"; - return nullptr; - } - - return image; + return waylandCursor; } QWaylandCursor::QWaylandCursor(QWaylandDisplay *display) diff --git a/src/plugins/platforms/wayland/qwaylandcursor_p.h b/src/plugins/platforms/wayland/qwaylandcursor_p.h index a4605f3d275..751ffa68b71 100644 --- a/src/plugins/platforms/wayland/qwaylandcursor_p.h +++ b/src/plugins/platforms/wayland/qwaylandcursor_p.h @@ -75,7 +75,7 @@ class Q_WAYLAND_CLIENT_EXPORT QWaylandCursorTheme public: static QWaylandCursorTheme *create(QWaylandShm *shm, int size, const QString &themeName); ~QWaylandCursorTheme(); - ::wl_cursor_image *cursorImage(Qt::CursorShape shape, uint millisecondsIntoAnimation = 0); + ::wl_cursor *cursor(Qt::CursorShape shape); private: enum WaylandCursor { @@ -129,7 +129,6 @@ public: void setPos(const QPoint &pos) override; static QSharedPointer cursorBitmapBuffer(QWaylandDisplay *display, const QCursor *cursor); - struct wl_cursor_image *cursorImage(Qt::CursorShape shape); private: QWaylandDisplay *mDisplay = nullptr; diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index a4098edd3a7..d812918e72a 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -283,8 +283,8 @@ void QWaylandInputDevice::Pointer::updateCursorTheme() if (!mCursor.theme) return; // A warning has already been printed in loadCursorTheme - if (auto *arrow = mCursor.theme->cursorImage(Qt::ArrowCursor)) { - int arrowPixelSize = qMax(arrow->width, arrow->height); // Not all cursor themes are square + if (auto *arrow = mCursor.theme->cursor(Qt::ArrowCursor)) { + int arrowPixelSize = qMax(arrow->images[0]->width, arrow->images[0]->height); // Not all cursor themes are square while (scale > 1 && arrowPixelSize / scale < cursorSize()) --scale; } else { @@ -326,12 +326,20 @@ void QWaylandInputDevice::Pointer::updateCursor() // Set from shape using theme uint time = seat()->mCursor.animationTimer.elapsed(); - if (struct ::wl_cursor_image *image = mCursor.theme->cursorImage(shape, time)) { + + if (struct ::wl_cursor *waylandCursor = mCursor.theme->cursor(shape)) { + int frame = wl_cursor_frame(waylandCursor, time); + ::wl_cursor_image *image = waylandCursor->images[frame]; + struct wl_buffer *buffer = wl_cursor_image_get_buffer(image); + if (!buffer) { + qCWarning(lcQpaWayland) << "Could not find buffer for cursor" << shape; + return; + } int bufferScale = mCursor.themeBufferScale; QPoint hotspot = QPoint(image->hotspot_x, image->hotspot_y) / bufferScale; QSize size = QSize(image->width, image->height) / bufferScale; - bool animated = image->delay > 0; + bool animated = waylandCursor->image_count > 1 && image->delay > 0; getOrCreateCursorSurface()->update(buffer, hotspot, size, bufferScale, animated); return; } From d9b7325cc030080cc42542b26392e68c153c02da Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Mon, 4 Nov 2019 14:21:51 +0100 Subject: [PATCH 0791/1507] Add client test for touch down and motion in same frame MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Task-number: QTBUG-79744 Change-Id: Ibb8239b4f53a345105bee3cc7a0fb4b777cabf9b Reviewed-by: Jan Arve Sæther Reviewed-by: Paul Olav Tvete --- tests/auto/wayland/seatv5/tst_seatv5.cpp | 33 ++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/tests/auto/wayland/seatv5/tst_seatv5.cpp b/tests/auto/wayland/seatv5/tst_seatv5.cpp index 636f260815a..e333082ecc7 100644 --- a/tests/auto/wayland/seatv5/tst_seatv5.cpp +++ b/tests/auto/wayland/seatv5/tst_seatv5.cpp @@ -71,6 +71,7 @@ private slots: void singleTapFloat(); void multiTouch(); void multiTouchUpAndMotionFrame(); + void tapAndMoveInSameFrame(); }; void tst_seatv5::bindsToSeat() @@ -586,5 +587,37 @@ void tst_seatv5::multiTouchUpAndMotionFrame() QVERIFY(window.m_events.empty()); } +void tst_seatv5::tapAndMoveInSameFrame() +{ + TouchWindow window; + QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial); + + exec([=] { + auto *t = touch(); + auto *c = client(); + + t->sendDown(xdgToplevel()->surface(), {32, 32}, 0); + t->sendMotion(c, {33, 33}, 0); + t->sendFrame(c); + + // Don't leave touch in a weird state + t->sendUp(c, 0); + t->sendFrame(c); + }); + + QTRY_VERIFY(!window.m_events.empty()); + { + auto e = window.m_events.takeFirst(); + QCOMPARE(e.type, QEvent::TouchBegin); + QCOMPARE(e.touchPoints.size(), 1); + QCOMPARE(e.touchPoints[0].state(), Qt::TouchPointState::TouchPointPressed); + // Position isn't that important, we just want to make sure we actually get the pressed event + } + + // Make sure we eventually release + QTRY_VERIFY(!window.m_events.empty()); + QTRY_COMPARE(window.m_events.last().touchPoints.first().state(), Qt::TouchPointState::TouchPointReleased); +} + QCOMPOSITOR_TEST_MAIN(tst_seatv5) #include "tst_seatv5.moc" From 5b53f5c7629e44c61e8017caa1605dd3b2048333 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Mon, 28 Oct 2019 12:05:09 +0100 Subject: [PATCH 0792/1507] Client: Add test for a compositor with no outputs This needs to be a separate test and can't be part of tst_output because there is special screen handling at platform integration initialization, which only happens once per test process. Task-number: QTBUG-79111 Change-Id: Iad9f98be6807c9071c783db1fa8e8c81a7de08be Reviewed-by: Paul Olav Tvete --- tests/auto/wayland/client.pro | 1 + tests/auto/wayland/nooutput/nooutput.pro | 5 ++ tests/auto/wayland/nooutput/tst_nooutput.cpp | 68 ++++++++++++++++++++ tests/auto/wayland/shared/mockcompositor.cpp | 2 +- 4 files changed, 75 insertions(+), 1 deletion(-) create mode 100644 tests/auto/wayland/nooutput/nooutput.pro create mode 100644 tests/auto/wayland/nooutput/tst_nooutput.cpp diff --git a/tests/auto/wayland/client.pro b/tests/auto/wayland/client.pro index 4b1eb245809..cda1765e3b1 100644 --- a/tests/auto/wayland/client.pro +++ b/tests/auto/wayland/client.pro @@ -5,6 +5,7 @@ SUBDIRS += \ datadevicev1 \ fullscreenshellv1 \ iviapplication \ + nooutput \ output \ primaryselectionv1 \ seatv4 \ diff --git a/tests/auto/wayland/nooutput/nooutput.pro b/tests/auto/wayland/nooutput/nooutput.pro new file mode 100644 index 00000000000..1d8dc562663 --- /dev/null +++ b/tests/auto/wayland/nooutput/nooutput.pro @@ -0,0 +1,5 @@ +include (../shared/shared.pri) + +TARGET = tst_nooutput +SOURCES += tst_nooutput.cpp + diff --git a/tests/auto/wayland/nooutput/tst_nooutput.cpp b/tests/auto/wayland/nooutput/tst_nooutput.cpp new file mode 100644 index 00000000000..098d88d9908 --- /dev/null +++ b/tests/auto/wayland/nooutput/tst_nooutput.cpp @@ -0,0 +1,68 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "mockcompositor.h" +#include +#include + +using namespace MockCompositor; + +class NoOutputCompositor : public DefaultCompositor { +public: + NoOutputCompositor() + { + exec([this] { removeAll(); }); + m_config.autoConfigure = true; + } +}; + +class tst_nooutput : public QObject, private NoOutputCompositor +{ + Q_OBJECT +private slots: + void cleanup() + { + // There should be no wl_outputs in this test + QCOMPOSITOR_COMPARE(getAll().size(), 0); + QTRY_VERIFY2(isClean(), qPrintable(dirtyMessage())); + } + void noScreens(); +}; + +void tst_nooutput::noScreens() +{ + QRasterWindow window; + window.resize(16, 16); + window.show(); + + // We have to handle showing a window when there are no real outputs + QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial); +} + +QCOMPOSITOR_TEST_MAIN(tst_nooutput) +#include "tst_nooutput.moc" diff --git a/tests/auto/wayland/shared/mockcompositor.cpp b/tests/auto/wayland/shared/mockcompositor.cpp index e44cea63c11..dca9dac49ae 100644 --- a/tests/auto/wayland/shared/mockcompositor.cpp +++ b/tests/auto/wayland/shared/mockcompositor.cpp @@ -52,7 +52,7 @@ DefaultCompositor::DefaultCompositor() // Pretend we made a copy of the buffer and just release it immediately surface->m_committed.buffer->send_release(); } - if (m_config.autoEnter && surface->m_outputs.empty()) + if (m_config.autoEnter && get() && surface->m_outputs.empty()) surface->sendEnter(get()); wl_display_flush_clients(m_display); }); From e3764dff8581f0d48bb4728144d58c66dbc1657d Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Thu, 5 Dec 2019 13:41:32 +0100 Subject: [PATCH 0793/1507] Client tests: Fix missing frame event Change-Id: I8bda37560ff8b3c97699831427b0a148f8a5970c Reviewed-by: David Edmundson --- tests/auto/wayland/xdgshell/tst_xdgshell.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/wayland/xdgshell/tst_xdgshell.cpp b/tests/auto/wayland/xdgshell/tst_xdgshell.cpp index ac5c24988f8..d1c2882a0f7 100644 --- a/tests/auto/wayland/xdgshell/tst_xdgshell.cpp +++ b/tests/auto/wayland/xdgshell/tst_xdgshell.cpp @@ -219,8 +219,8 @@ void tst_xdgshell::popup() p->sendFrame(c); uint serial = p->sendButton(client(), BTN_LEFT, Pointer::button_state_pressed); p->sendButton(c, BTN_LEFT, Pointer::button_state_released); - return serial; p->sendFrame(c); + return serial; }); QTRY_VERIFY(window.m_popup); From e86d1995461b79a184783189c2d91ab56f11d878 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Thu, 5 Dec 2019 12:24:07 +0100 Subject: [PATCH 0794/1507] Client: Always close popups when hiding a window It's not just popups that may have popups open on them. Always close open popups when hiding a window to prevent dangling pointers. [ChangeLog][QPA plugin] Fixed a crash when re-showing a popup after hiding its parent. Fixes: QTBUG-80562 Change-Id: I7cdac5c7a30e0add5ebf00259401e4d74626ce96 Reviewed-by: Paul Olav Tvete Reviewed-by: David Edmundson --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 950486c0cfe..0df99d9fe6c 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -426,8 +426,7 @@ void QWaylandWindow::setVisible(bool visible) // QWaylandShmBackingStore::beginPaint(). } else { sendExposeEvent(QRect()); - if (window()->type() == Qt::Popup) - closePopups(this); + closePopups(this); reset(); } } From d637993c5fcf21f93c531e4e8fdc2e43892514ae Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Thu, 5 Dec 2019 12:51:22 +0100 Subject: [PATCH 0795/1507] Add client test for hiding the toplevel parent of a popup This used to cause undefined behavior. Task-number: QTBUG-80562 Change-Id: I0397b7b304f316616d2a713063bc5a634dc081bc Reviewed-by: Paul Olav Tvete --- tests/auto/wayland/xdgshell/tst_xdgshell.cpp | 45 ++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/tests/auto/wayland/xdgshell/tst_xdgshell.cpp b/tests/auto/wayland/xdgshell/tst_xdgshell.cpp index d1c2882a0f7..2277bbb80ab 100644 --- a/tests/auto/wayland/xdgshell/tst_xdgshell.cpp +++ b/tests/auto/wayland/xdgshell/tst_xdgshell.cpp @@ -46,6 +46,7 @@ private slots: void popup(); void tooltipOnPopup(); void switchPopups(); + void hidePopupParent(); void pongs(); void minMaxSize(); void windowGeometry(); @@ -429,6 +430,50 @@ void tst_xdgshell::switchPopups() QCOMPOSITOR_TRY_VERIFY(xdgPopup()->m_xdgSurface->m_committedConfigureSerial); } +void tst_xdgshell::hidePopupParent() +{ + class Window : public QRasterWindow { + public: + void mousePressEvent(QMouseEvent *event) override + { + QRasterWindow::mousePressEvent(event); + m_popup.reset(new QRasterWindow); + m_popup->setTransientParent(this); + m_popup->setFlags(Qt::Popup); + m_popup->resize(100, 100); + m_popup->show(); + } + QScopedPointer m_popup; + }; + Window window; + window.resize(200, 200); + window.show(); + + QCOMPOSITOR_TRY_VERIFY(xdgToplevel()); + exec([=] { xdgToplevel()->sendCompleteConfigure(); }); + QCOMPOSITOR_TRY_VERIFY(xdgToplevel()->m_xdgSurface->m_committedConfigureSerial); + + exec([=] { + auto *surface = xdgToplevel()->surface(); + auto *p = pointer(); + auto *c = client(); + p->sendEnter(surface, {100, 100}); + p->sendFrame(c); + p->sendButton(c, BTN_LEFT, Pointer::button_state_pressed); + p->sendButton(c, BTN_LEFT, Pointer::button_state_released); + p->sendFrame(c); + }); + QCOMPOSITOR_TRY_VERIFY(xdgPopup()); + exec([=] { + xdgPopup()->sendConfigure(QRect(100, 100, 100, 100)); + xdgPopup()->m_xdgSurface->sendConfigure(); + }); + QCOMPOSITOR_TRY_VERIFY(xdgPopup()->m_xdgSurface->m_committedConfigureSerial); + + window.hide(); + QCOMPOSITOR_TRY_VERIFY(!xdgToplevel()); +} + void tst_xdgshell::pongs() { // Create and show a window to trigger shell integration initialzation, From 7b3936cd0682194359be4009e9a1e59adc4c3a08 Mon Sep 17 00:00:00 2001 From: James McDonnell Date: Thu, 5 Dec 2019 11:55:20 -0500 Subject: [PATCH 0796/1507] Adjust the Wayland Vulkan configuration tests Define VK_USE_PLATFORM_WAYLAND_KHR before the vulkan.h include so the test will fail if the Wayland WSI header doesn't exist. Require features.vulkan so that vulkan related code won't build when --disable-vulkan is used. Change-Id: I275efcb3e728b59c6f99598c235074b941f1fbf0 Reviewed-by: Dan Cape Reviewed-by: Paul Olav Tvete Reviewed-by: Johan Helsing --- src/plugins/platforms/wayland/configure.json | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/configure.json b/src/plugins/platforms/wayland/configure.json index f49beaf703c..94a1531d7ad 100644 --- a/src/plugins/platforms/wayland/configure.json +++ b/src/plugins/platforms/wayland/configure.json @@ -155,6 +155,9 @@ "label": "Vulkan Buffer Sharing", "type": "compile", "test": { + "head": [ + "#define VK_USE_PLATFORM_WAYLAND_KHR 1" + ], "include": [ "vulkan/vulkan.h" ], @@ -250,7 +253,7 @@ }, "wayland-vulkan-server-buffer": { "label": "Vulkan-based server buffer integration", - "condition": "features.wayland-client && features.opengl && features.egl && tests.vulkan-server-buffer", + "condition": "features.wayland-client && features.vulkan && features.opengl && features.egl && tests.vulkan-server-buffer", "output": [ "privateFeature" ] }, "wayland-shm-emulation-server-buffer": { From 2a13fba24b3f4bdf1bfd125244ad56629811b85b Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Thu, 12 Dec 2019 11:07:00 +0100 Subject: [PATCH 0797/1507] Wait for window.isExposed() in flushUnconfiguredXdgSurface() test We generally don't expect the window to react synchronously, as shown in other tests that already have the QTRY_VERIFY(window.isExposed()). Add the waiting behavior to flushUnconfiguredXdgSurface() in order to avoid flakiness. Change-Id: I5824be0a806ec4bd0df30b3187a6549fd81d16be Reviewed-by: Paul Olav Tvete --- tests/auto/wayland/xdgshellv6/tst_xdgshellv6.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/wayland/xdgshellv6/tst_xdgshellv6.cpp b/tests/auto/wayland/xdgshellv6/tst_xdgshellv6.cpp index e44475de71d..76df6eb58dd 100644 --- a/tests/auto/wayland/xdgshellv6/tst_xdgshellv6.cpp +++ b/tests/auto/wayland/xdgshellv6/tst_xdgshellv6.cpp @@ -403,7 +403,7 @@ void tst_WaylandClientXdgShellV6::flushUnconfiguredXdgSurface() m_compositor->sendShellSurfaceConfigure(surface); QTRY_COMPARE(surface->image.size(), window.frameGeometry().size()); QTRY_COMPARE(surface->image.pixel(window.frameMargins().left(), window.frameMargins().top()), color.rgba()); - QVERIFY(window.isExposed()); + QTRY_VERIFY(window.isExposed()); } void tst_WaylandClientXdgShellV6::dontSpamExposeEvents() From 2f1b67c17b34d4635d17c933d82f76bb8c9c96c9 Mon Sep 17 00:00:00 2001 From: "Jan Alexander Steffens (heftig)" Date: Sun, 15 Dec 2019 00:07:08 +0100 Subject: [PATCH 0798/1507] Client: Fix detection of linux-dmabuf Change I84c8c1008724b49b6bedb4fc3ef398e292f1c6c7 fixed the tests in compositor/configure.json but missed the test in client/configure.json. Change-Id: I65ad424406438baa74ca80a9418e133510142118 Reviewed-by: Johan Helsing --- src/plugins/platforms/wayland/configure.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/configure.json b/src/plugins/platforms/wayland/configure.json index e9e16324b60..0621396858f 100644 --- a/src/plugins/platforms/wayland/configure.json +++ b/src/plugins/platforms/wayland/configure.json @@ -74,7 +74,7 @@ "label": "Linux dma-buf Buffer Sharing", "type": "compile", "test": "dmabuf_server_buffer", - "use": "egl" + "use": "egl drm" }, "vulkan-server-buffer": { "label": "Vulkan Buffer Sharing", From fbc93070adeeb2b50ee5b1545d20e691b36fdea3 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Mon, 9 Dec 2019 11:06:18 +0100 Subject: [PATCH 0799/1507] Client: Fix inverse repeat rate implementation The rate from wl_keyboard.repeat_info was used as if it was an interval. Fixed by converting from key strokes per second to milliseconds per key stroke. This fixes a regression, as repeat rate used to be hard-coded to something sensible before. [ChangeLog][QPA plugin] Fixed keyboard repeat rate being set inversely, so higher rates would actually result in fewer characters per second, and vice versa. Fixes: QTBUG-80613 Change-Id: Ie783b90cba13dde6f37c0cd1be584d352cddfe7c Reviewed-by: David Edmundson Reviewed-by: Paul Olav Tvete --- src/plugins/platforms/wayland/qwaylandinputdevice.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index d812918e72a..3b26dc427d2 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -88,7 +88,7 @@ QWaylandInputDevice::Keyboard::Keyboard(QWaylandInputDevice *p) // or the server didn't send an enter event first. return; } - mRepeatTimer.setInterval(mRepeatRate); + mRepeatTimer.setInterval(1000 / mRepeatRate); handleKey(mRepeatKey.time, QEvent::KeyRelease, mRepeatKey.key, mRepeatKey.modifiers, mRepeatKey.code, mRepeatKey.nativeVirtualKey, mRepeatKey.nativeModifiers, mRepeatKey.text, true); From 85d216ad0f1486e605a20da895a5e80ec3aa2c09 Mon Sep 17 00:00:00 2001 From: "Jan Alexander Steffens (heftig)" Date: Fri, 13 Dec 2019 22:15:32 +0100 Subject: [PATCH 0800/1507] Drive cursor animation with a timer Using only wl_surface_frame callbacks to update the cursor does so much more often than needed. In addition, at least GNOME and Weston fire the callback for the cursor surface immediately, which ends up updating the cursor at over 3000 Hz here. Use wl_cursor_frame_and_duration to drive a single shot timer. This function is also guaranteed to return 0 for single frame cursors, so we can avoid starting the timer at all. We wait for both the surface frame callback and the timer to fire before updating the cursor for the next frame of animation. This reduces our update rate to the frame rate of the cursor or the rate requested by the compositor, whichever is lower. Change-Id: I10277460ebe9b547ebaf7f73424b9ef17614107f Reviewed-by: Johan Helsing --- .../platforms/wayland/qwaylandinputdevice.cpp | 34 +++++++++++++++++-- .../platforms/wayland/qwaylandinputdevice_p.h | 5 +++ 2 files changed, 36 insertions(+), 3 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index 3b26dc427d2..3f0d61d6aa3 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -143,6 +143,12 @@ QWaylandWindow *QWaylandInputDevice::Keyboard::focusWindow() const QWaylandInputDevice::Pointer::Pointer(QWaylandInputDevice *seat) : mParent(seat) { +#if QT_CONFIG(cursor) + mCursor.frameTimer.setSingleShot(true); + mCursor.frameTimer.callOnTimeout([&]() { + cursorTimerCallback(); + }); +#endif } QWaylandInputDevice::Pointer::~Pointer() @@ -224,7 +230,7 @@ public: if (animated) { m_frameCallback.reset(new WlCallback(frame(), [this](uint32_t time){ Q_UNUSED(time); - m_pointer->updateCursor(); + m_pointer->cursorFrameCallback(); })); } commit(); @@ -328,7 +334,8 @@ void QWaylandInputDevice::Pointer::updateCursor() uint time = seat()->mCursor.animationTimer.elapsed(); if (struct ::wl_cursor *waylandCursor = mCursor.theme->cursor(shape)) { - int frame = wl_cursor_frame(waylandCursor, time); + uint duration = 0; + int frame = wl_cursor_frame_and_duration(waylandCursor, time, &duration); ::wl_cursor_image *image = waylandCursor->images[frame]; struct wl_buffer *buffer = wl_cursor_image_get_buffer(image); @@ -339,7 +346,12 @@ void QWaylandInputDevice::Pointer::updateCursor() int bufferScale = mCursor.themeBufferScale; QPoint hotspot = QPoint(image->hotspot_x, image->hotspot_y) / bufferScale; QSize size = QSize(image->width, image->height) / bufferScale; - bool animated = waylandCursor->image_count > 1 && image->delay > 0; + bool animated = duration > 0; + if (animated) { + mCursor.gotFrameCallback = false; + mCursor.gotTimerCallback = false; + mCursor.frameTimer.start(duration); + } getOrCreateCursorSurface()->update(buffer, hotspot, size, bufferScale, animated); return; } @@ -354,6 +366,22 @@ CursorSurface *QWaylandInputDevice::Pointer::getOrCreateCursorSurface() return mCursor.surface.get(); } +void QWaylandInputDevice::Pointer::cursorTimerCallback() +{ + mCursor.gotTimerCallback = true; + if (mCursor.gotFrameCallback) { + updateCursor(); + } +} + +void QWaylandInputDevice::Pointer::cursorFrameCallback() +{ + mCursor.gotFrameCallback = true; + if (mCursor.gotTimerCallback) { + updateCursor(); + } +} + #endif // QT_CONFIG(cursor) QWaylandInputDevice::Touch::Touch(QWaylandInputDevice *p) diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h index 60d6f2c17ba..a567c57b422 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h +++ b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h @@ -286,6 +286,8 @@ public: int idealCursorScale() const; void updateCursorTheme(); void updateCursor(); + void cursorTimerCallback(); + void cursorFrameCallback(); CursorSurface *getOrCreateCursorSurface(); #endif QWaylandInputDevice *seat() const { return mParent; } @@ -325,6 +327,9 @@ public: QWaylandCursorTheme *theme = nullptr; int themeBufferScale = 0; QScopedPointer surface; + QTimer frameTimer; + bool gotFrameCallback = false; + bool gotTimerCallback = false; } mCursor; #endif QPointF mSurfacePos; From 84c2b4802f207a4fc33cbdcd9e37409b9fcc59c3 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Fri, 20 Dec 2019 09:31:04 +0100 Subject: [PATCH 0801/1507] Client: Add QWaylandWindow::mapFromWlSurface Qt window coordinates start inside the decorations, while wl_surface coordinates start at the first pixel of the buffer. Potentially, that would be in the shadow, although we don't have those. So for now, it's the first pixel of the decorations. Change-Id: Idccf8a359035f5477d6bc9e2e03a0e9fafe16971 Reviewed-by: Pier Luigi Fiorini --- .../platforms/wayland/qwaylandinputdevice.cpp | 3 +-- .../platforms/wayland/qwaylandwindow.cpp | 17 ++++++++++++++--- .../platforms/wayland/qwaylandwindow_p.h | 1 + 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index 3f0d61d6aa3..8f23805decb 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -1408,8 +1408,7 @@ void QWaylandInputDevice::handleTouchPoint(int id, Qt::TouchPointState state, co return; tp.area = QRectF(0, 0, 8, 8); - QMargins margins = win->frameMargins(); - QPointF localPosition = surfacePosition - QPointF(margins.left(), margins.top()); + QPointF localPosition = win->mapFromWlSurface(surfacePosition); // TODO: This doesn't account for high dpi scaling for the delta, but at least it matches // what we have for mouse input. QPointF delta = localPosition - localPosition.toPoint(); diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index a6134cf4960..0a623e9a24f 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -672,6 +672,19 @@ QRect QWaylandWindow::windowContentGeometry() const return QRect(QPoint(), surfaceSize()); } +/*! + * Converts from wl_surface coordinates to Qt window coordinates. Qt window + * coordinates start inside (not including) the window decorations, while + * wl_surface coordinates start at the first pixel of the buffer. Potentially, + * this should be in the window shadow, although we don't have those. So for + * now, it's the first pixel of the decorations. + */ +QPointF QWaylandWindow::mapFromWlSurface(const QPointF &surfacePosition) const +{ + const QMargins margins = frameMargins(); + return QPointF(surfacePosition.x() - margins.left(), surfacePosition.y() - margins.top()); +} + wl_surface *QWaylandWindow::wlSurface() { return mSurface ? mSurface->object() : nullptr; @@ -922,10 +935,8 @@ void QWaylandWindow::handleMouseEventWithDecoration(QWaylandInputDevice *inputDe geometry().size().width() - marg.right(), geometry().size().height() - marg.bottom()); if (windowRect.contains(e.local.toPoint()) || mMousePressedInContentArea != Qt::NoButton) { - QPointF localTranslated = e.local; + const QPointF localTranslated = mapFromWlSurface(e.local); QPointF globalTranslated = e.global; - localTranslated.setX(localTranslated.x() - marg.left()); - localTranslated.setY(localTranslated.y() - marg.top()); globalTranslated.setX(globalTranslated.x() - marg.left()); globalTranslated.setY(globalTranslated.y() - marg.top()); if (!mMouseEventsInContentArea) { diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index 36cbee89b62..35fa1fdfcef 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -129,6 +129,7 @@ public: QMargins frameMargins() const override; QSize surfaceSize() const; QRect windowContentGeometry() const; + QPointF mapFromWlSurface(const QPointF &surfacePosition) const; QWaylandSurface *waylandSurface() const { return mSurface.data(); } ::wl_surface *wlSurface(); From 5220e4929562104da42561623ba3d6d164128313 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Thu, 14 Nov 2019 11:36:01 +0100 Subject: [PATCH 0802/1507] Stop using modern C++ Fixes compilation errors with c++11. Fixes: QTBUG-81024 Change-Id: I13ae380a122a2d52b7b362a7a39e661a22c74afc Reviewed-by: Pier Luigi Fiorini --- src/plugins/platforms/wayland/qwaylandinputdevice.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index 3f0d61d6aa3..320e3404062 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -1387,7 +1387,7 @@ void QWaylandInputDevice::Touch::touch_cancel() void QWaylandInputDevice::handleTouchPoint(int id, Qt::TouchPointState state, const QPointF &surfacePosition) { auto end = mTouch->mPendingTouchPoints.end(); - auto it = std::find_if(mTouch->mPendingTouchPoints.begin(), end, [id](auto tp){ return tp.id == id; }); + auto it = std::find_if(mTouch->mPendingTouchPoints.begin(), end, [id](const QWindowSystemInterface::TouchPoint &tp){ return tp.id == id; }); if (it == end) { it = mTouch->mPendingTouchPoints.insert(end, QWindowSystemInterface::TouchPoint()); it->id = id; From 6111649b41ee101a2896c350b4bed50837939e6f Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Mon, 21 Oct 2019 12:02:15 +0200 Subject: [PATCH 0803/1507] Client: Don't use deprecated handleMouseEvent version The new version requires the button that caused the event, as well as the event type. Instead of adding a conversion functions to and from QWaylandInputDevice::Type to QEvent::Type, just use QEvent::Type directly, as there is one-to-one mappings for all the event types we need. Fixes: QTBUG-80044 Change-Id: I0f6e0e8e7f2e026a1d601f86e819affe0570a1b2 Reviewed-by: Shawn Rutledge Reviewed-by: Pier Luigi Fiorini --- .../platforms/wayland/qwaylandinputdevice.cpp | 38 ++++++++++--------- .../platforms/wayland/qwaylandinputdevice_p.h | 21 ++++------ .../platforms/wayland/qwaylandwindow.cpp | 32 +++++++++------- 3 files changed, 46 insertions(+), 45 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index 8f23805decb..56809f77f01 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -630,8 +630,8 @@ class EnterEvent : public QWaylandPointerEvent { public: EnterEvent(QWaylandWindow *surface, const QPointF &local, const QPointF &global) - : QWaylandPointerEvent(QWaylandPointerEvent::Enter, Qt::NoScrollPhase, surface, 0, - local, global, nullptr, Qt::NoModifier) + : QWaylandPointerEvent(QEvent::Enter, Qt::NoScrollPhase, surface, 0, + local, global, Qt::NoButton, Qt::NoButton, Qt::NoModifier) {} }; @@ -675,8 +675,8 @@ class LeaveEvent : public QWaylandPointerEvent { public: LeaveEvent(QWaylandWindow *surface, const QPointF &localPos, const QPointF &globalPos) - : QWaylandPointerEvent(QWaylandPointerEvent::Leave, Qt::NoScrollPhase, surface, 0, - localPos, globalPos, nullptr, Qt::NoModifier) + : QWaylandPointerEvent(QEvent::Leave, Qt::NoScrollPhase, surface, 0, + localPos, globalPos, Qt::NoButton, Qt::NoButton, Qt::NoModifier) {} }; @@ -705,8 +705,8 @@ class MotionEvent : public QWaylandPointerEvent public: MotionEvent(QWaylandWindow *surface, ulong timestamp, const QPointF &localPos, const QPointF &globalPos, Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers) - : QWaylandPointerEvent(QWaylandPointerEvent::Motion, Qt::NoScrollPhase, surface, - timestamp, localPos, globalPos, buttons, modifiers) + : QWaylandPointerEvent(QEvent::MouseMove, Qt::NoScrollPhase, surface, + timestamp, localPos, globalPos, buttons, Qt::NoButton, modifiers) { } }; @@ -744,9 +744,10 @@ class PressEvent : public QWaylandPointerEvent { public: PressEvent(QWaylandWindow *surface, ulong timestamp, const QPointF &localPos, - const QPointF &globalPos, Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers) - : QWaylandPointerEvent(QWaylandPointerEvent::Press, Qt::NoScrollPhase, surface, - timestamp, localPos, globalPos, buttons, modifiers) + const QPointF &globalPos, Qt::MouseButtons buttons, Qt::MouseButton button, + Qt::KeyboardModifiers modifiers) + : QWaylandPointerEvent(QEvent::MouseButtonPress, Qt::NoScrollPhase, surface, + timestamp, localPos, globalPos, buttons, button, modifiers) { } }; @@ -755,9 +756,10 @@ class ReleaseEvent : public QWaylandPointerEvent { public: ReleaseEvent(QWaylandWindow *surface, ulong timestamp, const QPointF &localPos, - const QPointF &globalPos, Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers) - : QWaylandPointerEvent(QWaylandPointerEvent::Release, Qt::NoScrollPhase, surface, - timestamp, localPos, globalPos, buttons, modifiers) + const QPointF &globalPos, Qt::MouseButtons buttons, Qt::MouseButton button, + Qt::KeyboardModifiers modifiers) + : QWaylandPointerEvent(QEvent::MouseButtonRelease, Qt::NoScrollPhase, surface, + timestamp, localPos, globalPos, buttons, button, modifiers) { } }; @@ -818,9 +820,9 @@ void QWaylandInputDevice::Pointer::pointer_button(uint32_t serial, uint32_t time } if (state) - setFrameEvent(new PressEvent(window, time, pos, global, mButtons, mParent->modifiers())); + setFrameEvent(new PressEvent(window, time, pos, global, mButtons, qt_button, mParent->modifiers())); else - setFrameEvent(new ReleaseEvent(window, time, pos, global, mButtons, mParent->modifiers())); + setFrameEvent(new ReleaseEvent(window, time, pos, global, mButtons, qt_button, mParent->modifiers())); } void QWaylandInputDevice::Pointer::invalidateFocus() @@ -848,7 +850,7 @@ public: WheelEvent(QWaylandWindow *surface, Qt::ScrollPhase phase, ulong timestamp, const QPointF &local, const QPointF &global, const QPoint &pixelDelta, const QPoint &angleDelta, Qt::MouseEventSource source, Qt::KeyboardModifiers modifiers) - : QWaylandPointerEvent(QWaylandPointerEvent::Wheel, phase, surface, timestamp, + : QWaylandPointerEvent(QEvent::Wheel, phase, surface, timestamp, local, global, pixelDelta, angleDelta, source, modifiers) { } @@ -1084,11 +1086,13 @@ void QWaylandInputDevice::Pointer::flushFrameEvent() if (auto *event = mFrameData.event) { if (auto window = event->surface) { window->handleMouse(mParent, *event); - } else if (mFrameData.event->type == QWaylandPointerEvent::Type::Release) { + } else if (mFrameData.event->type == QEvent::MouseButtonRelease) { // If the window has been destroyed, we still need to report an up event, but it can't // be handled by the destroyed window (obviously), so send the event here instead. QWindowSystemInterface::handleMouseEvent(nullptr, event->timestamp, event->local, - event->global, event->buttons, event->modifiers); + event->global, event->buttons, + event->button, event->type, + event->modifiers);// , Qt::MouseEventSource source = Qt::MouseEventNotSynthesized); } delete mFrameData.event; mFrameData.event = nullptr; diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h index a567c57b422..87f8559c4b6 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h +++ b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h @@ -401,29 +401,21 @@ class QWaylandPointerEvent { Q_GADGET public: - enum Type { - Enter, - Leave, - Motion, - Press, - Release, - Wheel - }; - Q_ENUM(Type) - - inline QWaylandPointerEvent(Type type, Qt::ScrollPhase phase, QWaylandWindow *surface, + inline QWaylandPointerEvent(QEvent::Type type, Qt::ScrollPhase phase, QWaylandWindow *surface, ulong timestamp, const QPointF &localPos, const QPointF &globalPos, - Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers) + Qt::MouseButtons buttons, Qt::MouseButton button, + Qt::KeyboardModifiers modifiers) : type(type) , phase(phase) , timestamp(timestamp) , local(localPos) , global(globalPos) , buttons(buttons) + , button(button) , modifiers(modifiers) , surface(surface) {} - inline QWaylandPointerEvent(Type type, Qt::ScrollPhase phase, QWaylandWindow *surface, + inline QWaylandPointerEvent(QEvent::Type type, Qt::ScrollPhase phase, QWaylandWindow *surface, ulong timestamp, const QPointF &local, const QPointF &global, const QPoint &pixelDelta, const QPoint &angleDelta, Qt::MouseEventSource source, @@ -440,12 +432,13 @@ public: , surface(surface) {} - Type type; + QEvent::Type type = QEvent::None; Qt::ScrollPhase phase = Qt::NoScrollPhase; ulong timestamp = 0; QPointF local; QPointF global; Qt::MouseButtons buttons; + Qt::MouseButton button = Qt::NoButton; // Button that caused the event (QMouseEvent::button) Qt::KeyboardModifiers modifiers; QPoint pixelDelta; QPoint angleDelta; diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 0a623e9a24f..8cc26d71ca1 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -869,7 +869,7 @@ QWaylandWindow *QWaylandWindow::transientParent() const void QWaylandWindow::handleMouse(QWaylandInputDevice *inputDevice, const QWaylandPointerEvent &e) { - if (e.type == QWaylandPointerEvent::Leave) { + if (e.type == QEvent::Leave) { if (mWindowDecoration) { if (mMouseEventsInContentArea) QWindowSystemInterface::handleLeaveEvent(window()); @@ -886,24 +886,26 @@ void QWaylandWindow::handleMouse(QWaylandInputDevice *inputDevice, const QWaylan handleMouseEventWithDecoration(inputDevice, e); } else { switch (e.type) { - case QWaylandPointerEvent::Enter: + case QEvent::Enter: QWindowSystemInterface::handleEnterEvent(window(), e.local, e.global); break; - case QWaylandPointerEvent::Press: - case QWaylandPointerEvent::Release: - case QWaylandPointerEvent::Motion: - QWindowSystemInterface::handleMouseEvent(window(), e.timestamp, e.local, e.global, e.buttons, e.modifiers); + case QEvent::MouseButtonPress: + case QEvent::MouseButtonRelease: + case QEvent::MouseMove: + QWindowSystemInterface::handleMouseEvent(window(), e.timestamp, e.local, e.global, e.buttons, e.button, e.type, e.modifiers); break; - case QWaylandPointerEvent::Wheel: + case QEvent::Wheel: QWindowSystemInterface::handleWheelEvent(window(), e.timestamp, e.local, e.global, e.pixelDelta, e.angleDelta, e.modifiers, e.phase, e.source, false); break; + default: + Q_UNREACHABLE(); } } #if QT_CONFIG(cursor) - if (e.type == QWaylandPointerEvent::Enter) { + if (e.type == QEvent::Enter) { QRect contentGeometry = windowContentGeometry().marginsRemoved(frameMargins()); if (contentGeometry.contains(e.local.toPoint())) restoreMouseCursor(inputDevice); @@ -947,21 +949,23 @@ void QWaylandWindow::handleMouseEventWithDecoration(QWaylandInputDevice *inputDe } switch (e.type) { - case QWaylandPointerEvent::Enter: + case QEvent::Enter: QWindowSystemInterface::handleEnterEvent(window(), localTranslated, globalTranslated); break; - case QWaylandPointerEvent::Press: - case QWaylandPointerEvent::Release: - case QWaylandPointerEvent::Motion: - QWindowSystemInterface::handleMouseEvent(window(), e.timestamp, localTranslated, globalTranslated, e.buttons, e.modifiers); + case QEvent::MouseButtonPress: + case QEvent::MouseButtonRelease: + case QEvent::MouseMove: + QWindowSystemInterface::handleMouseEvent(window(), e.timestamp, localTranslated, globalTranslated, e.buttons, e.button, e.type, e.modifiers); break; - case QWaylandPointerEvent::Wheel: { + case QEvent::Wheel: { QWindowSystemInterface::handleWheelEvent(window(), e.timestamp, localTranslated, globalTranslated, e.pixelDelta, e.angleDelta, e.modifiers, e.phase, e.source, false); break; } + default: + Q_UNREACHABLE(); } mMouseEventsInContentArea = true; From 196c2e3fa825d73bd374fcc127268094fda4e490 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Thu, 2 Jan 2020 14:46:47 +0100 Subject: [PATCH 0804/1507] Fix compiler warnings Change-Id: Ie0bed19704bed89044d3cf25e7aaa1f740a4b39a Reviewed-by: Johan Helsing --- .../platforms/wayland/qwaylanddatadevice.cpp | 16 ++++++++++++---- .../platforms/wayland/qwaylandinputdevice.cpp | 2 ++ src/plugins/platforms/wayland/qwaylandtouch.cpp | 2 +- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylanddatadevice.cpp b/src/plugins/platforms/wayland/qwaylanddatadevice.cpp index f7d135e49f3..19944a349e6 100644 --- a/src/plugins/platforms/wayland/qwaylanddatadevice.cpp +++ b/src/plugins/platforms/wayland/qwaylanddatadevice.cpp @@ -157,7 +157,9 @@ void QWaylandDataDevice::data_device_drop() return; } - QPlatformDropQtResponse response = QWindowSystemInterface::handleDrop(m_dragWindow, dragData, m_dragPoint, supportedActions); + QPlatformDropQtResponse response = QWindowSystemInterface::handleDrop(m_dragWindow, dragData, m_dragPoint, supportedActions, + QGuiApplication::mouseButtons(), + QGuiApplication::keyboardModifiers()); if (drag) { static_cast(QGuiApplicationPrivate::platformIntegration()->drag())->finishDrag(response); @@ -187,7 +189,9 @@ void QWaylandDataDevice::data_device_enter(uint32_t serial, wl_surface *surface, supportedActions = Qt::CopyAction | Qt::MoveAction | Qt::LinkAction; } - const QPlatformDragQtResponse &response = QWindowSystemInterface::handleDrag(m_dragWindow, dragData, m_dragPoint, supportedActions); + const QPlatformDragQtResponse &response = QWindowSystemInterface::handleDrag(m_dragWindow, dragData, m_dragPoint, supportedActions, + QGuiApplication::mouseButtons(), + QGuiApplication::keyboardModifiers()); if (drag) { static_cast(QGuiApplicationPrivate::platformIntegration()->drag())->setResponse(response); @@ -203,7 +207,9 @@ void QWaylandDataDevice::data_device_enter(uint32_t serial, wl_surface *surface, void QWaylandDataDevice::data_device_leave() { if (m_dragWindow) - QWindowSystemInterface::handleDrag(m_dragWindow, nullptr, QPoint(), Qt::IgnoreAction); + QWindowSystemInterface::handleDrag(m_dragWindow, nullptr, QPoint(), Qt::IgnoreAction, + QGuiApplication::mouseButtons(), + QGuiApplication::keyboardModifiers()); QDrag *drag = static_cast(QGuiApplicationPrivate::platformIntegration()->drag())->currentDrag(); if (!drag) { @@ -232,7 +238,9 @@ void QWaylandDataDevice::data_device_motion(uint32_t time, wl_fixed_t x, wl_fixe supportedActions = Qt::CopyAction | Qt::MoveAction | Qt::LinkAction; } - QPlatformDragQtResponse response = QWindowSystemInterface::handleDrag(m_dragWindow, dragData, m_dragPoint, supportedActions); + QPlatformDragQtResponse response = QWindowSystemInterface::handleDrag(m_dragWindow, dragData, m_dragPoint, supportedActions, + QGuiApplication::mouseButtons(), + QGuiApplication::keyboardModifiers()); if (drag) { static_cast(QGuiApplicationPrivate::platformIntegration()->drag())->setResponse(response); diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index d33b0db8b30..ce086ee4c7f 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -1006,6 +1006,8 @@ bool QWaylandInputDevice::Pointer::FrameData::hasPixelDelta() const case axis_source_finger: case axis_source_continuous: return !delta.isNull(); + default: + return false; } } diff --git a/src/plugins/platforms/wayland/qwaylandtouch.cpp b/src/plugins/platforms/wayland/qwaylandtouch.cpp index 0394aef31be..b79f5cf5b45 100644 --- a/src/plugins/platforms/wayland/qwaylandtouch.cpp +++ b/src/plugins/platforms/wayland/qwaylandtouch.cpp @@ -165,7 +165,7 @@ void QWaylandTouchExtension::sendTouchEvent() QWindowSystemInterface::handleTouchEvent(mTargetWindow, mTimestamp, mTouchDevice, mTouchPoints); - Qt::TouchPointStates states = 0; + Qt::TouchPointStates states = {}; for (int i = 0; i < mTouchPoints.count(); ++i) states |= mTouchPoints.at(i).state; From 8abd3e5f553a01c6663136af29640433fc317a37 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Fri, 3 Jan 2020 12:22:09 +0100 Subject: [PATCH 0805/1507] Don't use deprecated handleMouseEvent() The new version takes the event type and the button responsible as arguments. This commit adds logic to figure those out when mapping touch events to mouse events. Change-Id: Iadd1cf33aed12a05fcd28c74e2439ac8ac00f632 Reviewed-by: Johan Helsing --- src/plugins/platforms/wayland/qwaylandtouch.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandtouch.cpp b/src/plugins/platforms/wayland/qwaylandtouch.cpp index b79f5cf5b45..8f56e7aa6e0 100644 --- a/src/plugins/platforms/wayland/qwaylandtouch.cpp +++ b/src/plugins/platforms/wayland/qwaylandtouch.cpp @@ -170,17 +170,23 @@ void QWaylandTouchExtension::sendTouchEvent() states |= mTouchPoints.at(i).state; if (mFlags & QT_TOUCH_EXTENSION_FLAGS_MOUSE_FROM_TOUCH) { - if (states == Qt::TouchPointPressed) + const bool firstPress = states == Qt::TouchPointPressed; + if (firstPress) mMouseSourceId = mTouchPoints.first().id; for (int i = 0; i < mTouchPoints.count(); ++i) { const QWindowSystemInterface::TouchPoint &tp(mTouchPoints.at(i)); if (tp.id == mMouseSourceId) { - Qt::MouseButtons buttons = tp.state == Qt::TouchPointReleased ? Qt::NoButton : Qt::LeftButton; + const bool released = tp.state == Qt::TouchPointReleased; + Qt::MouseButtons buttons = released ? Qt::NoButton : Qt::LeftButton; + QEvent::Type eventType = firstPress ? QEvent::MouseButtonPress + : released ? QEvent::MouseButtonRelease + : QEvent::MouseMove; mLastMouseGlobal = tp.area.center(); QPoint globalPoint = mLastMouseGlobal.toPoint(); QPointF delta = mLastMouseGlobal - globalPoint; mLastMouseLocal = mTargetWindow->mapFromGlobal(globalPoint) + delta; - QWindowSystemInterface::handleMouseEvent(mTargetWindow, mTimestamp, mLastMouseLocal, mLastMouseGlobal, buttons); + QWindowSystemInterface::handleMouseEvent(mTargetWindow, mTimestamp, mLastMouseLocal, mLastMouseGlobal, + buttons, Qt::LeftButton, eventType); if (buttons == Qt::NoButton) mMouseSourceId = -1; break; @@ -200,7 +206,7 @@ void QWaylandTouchExtension::touchCanceled() mTouchPoints.clear(); mPrevTouchPoints.clear(); if (mMouseSourceId != -1) - QWindowSystemInterface::handleMouseEvent(mTargetWindow, mTimestamp, mLastMouseLocal, mLastMouseGlobal, Qt::NoButton); + QWindowSystemInterface::handleMouseEvent(mTargetWindow, mTimestamp, mLastMouseLocal, mLastMouseGlobal, Qt::NoButton, Qt::LeftButton, QEvent::MouseButtonRelease); } void QWaylandTouchExtension::touch_extension_configure(uint32_t flags) From 4d844d36404597713a63879dc24f051de0ad3e5b Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Tue, 17 Dec 2019 12:08:54 +0100 Subject: [PATCH 0806/1507] Client: Add basic support for tablet-unstable-v2 [ChangeLog][QPA plugin] Added support for drawing tablets through the tablet-unstable-v2 protocol. Adds support for the basic one tablet, one tool, no pads scenario. Besides the auto tests, I tested with a Huion Kamvas Pro 16 with a simple pressure sensitive pen with two buttons. As far as I can tell, it works the same way as on xcb on Sway and Gnome Shell. Also tested on a Wacom PTZ-630 with a mouse, art pen, airbrush and a stylus. Mapped the distance event to QTabletEvent::Z and slider to QTabletEvent::tangentialPressure. For now we send QTabletEvents even when there's a mouse or finger on the tablet. Those should ideally be sent as QMouseEvents/QTouchEvents, but that's out of scope for this patch, but at least we will send synthesized mouse events if the tablet events are not accepted. Change-Id: I93291ffa5f00fa2bb8533eddd8d873b84a3386b8 Reviewed-by: Shawn Rutledge --- .../wayland/protocols/qt_attribution.json | 18 + .../wayland/protocols/tablet-unstable-v2.xml | 1178 +++++++++++++++++ src/plugins/platforms/wayland/client.pro | 3 + .../platforms/wayland/qwaylanddisplay.cpp | 3 + .../platforms/wayland/qwaylanddisplay_p.h | 3 + .../platforms/wayland/qwaylandinputdevice.cpp | 3 + .../platforms/wayland/qwaylandinputdevice_p.h | 5 + .../platforms/wayland/qwaylandintegration.cpp | 2 + .../platforms/wayland/qwaylandtabletv2.cpp | 332 +++++ .../platforms/wayland/qwaylandtabletv2_p.h | 191 +++ tests/auto/wayland/client.pro | 1 + tests/auto/wayland/tabletv2/tabletv2.pro | 7 + tests/auto/wayland/tabletv2/tst_tabletv2.cpp | 918 +++++++++++++ 13 files changed, 2664 insertions(+) create mode 100644 src/3rdparty/wayland/protocols/tablet-unstable-v2.xml create mode 100644 src/plugins/platforms/wayland/qwaylandtabletv2.cpp create mode 100644 src/plugins/platforms/wayland/qwaylandtabletv2_p.h create mode 100644 tests/auto/wayland/tabletv2/tabletv2.pro create mode 100644 tests/auto/wayland/tabletv2/tst_tabletv2.cpp diff --git a/src/3rdparty/wayland/protocols/qt_attribution.json b/src/3rdparty/wayland/protocols/qt_attribution.json index c49ead4f33d..dad8c42565b 100644 --- a/src/3rdparty/wayland/protocols/qt_attribution.json +++ b/src/3rdparty/wayland/protocols/qt_attribution.json @@ -89,6 +89,24 @@ Copyright (c) 2013 BMW Car IT GmbH" "Copyright": "Copyright © 2013-2014 Collabora, Ltd." }, + { + "Id": "wayland-tablet-protocol", + "Name": "Wayland Tablet Protocol", + "QDocModule": "qtwaylandcompositor", + "QtUsage": "Used in the Qt Wayland platform plugin", + "Files": "tablet-unstable-v2.xml", + + "Description": "", + "Homepage": "https://wayland.freedesktop.org", + "Version": "unstable v2, version 1", + "DownloadLocation": "https://cgit.freedesktop.org/wayland/wayland-protocols/plain/unstable/tablet/tablet-unstable-v2.xml", + "LicenseId": "MIT", + "License": "MIT License", + "LicenseFile": "MIT_LICENSE.txt", + "Copyright": "Copyright 2014 © Stephen "Lyude" Chandler Paul +Copyright 2015-2016 © Red Hat, Inc." + }, + { "Id": "wayland-viewporter-protocol", "Name": "Wayland Viewporter Protocol", diff --git a/src/3rdparty/wayland/protocols/tablet-unstable-v2.xml b/src/3rdparty/wayland/protocols/tablet-unstable-v2.xml new file mode 100644 index 00000000000..b286d964af8 --- /dev/null +++ b/src/3rdparty/wayland/protocols/tablet-unstable-v2.xml @@ -0,0 +1,1178 @@ + + + + + Copyright 2014 © Stephen "Lyude" Chandler Paul + Copyright 2015-2016 © Red Hat, Inc. + + 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. + + + + This description provides a high-level overview of the interplay between + the interfaces defined this protocol. For details, see the protocol + specification. + + More than one tablet may exist, and device-specifics matter. Tablets are + not represented by a single virtual device like wl_pointer. A client + binds to the tablet manager object which is just a proxy object. From + that, the client requests wp_tablet_manager.get_tablet_seat(wl_seat) + and that returns the actual interface that has all the tablets. With + this indirection, we can avoid merging wp_tablet into the actual Wayland + protocol, a long-term benefit. + + The wp_tablet_seat sends a "tablet added" event for each tablet + connected. That event is followed by descriptive events about the + hardware; currently that includes events for name, vid/pid and + a wp_tablet.path event that describes a local path. This path can be + used to uniquely identify a tablet or get more information through + libwacom. Emulated or nested tablets can skip any of those, e.g. a + virtual tablet may not have a vid/pid. The sequence of descriptive + events is terminated by a wp_tablet.done event to signal that a client + may now finalize any initialization for that tablet. + + Events from tablets require a tool in proximity. Tools are also managed + by the tablet seat; a "tool added" event is sent whenever a tool is new + to the compositor. That event is followed by a number of descriptive + events about the hardware; currently that includes capabilities, + hardware id and serial number, and tool type. Similar to the tablet + interface, a wp_tablet_tool.done event is sent to terminate that initial + sequence. + + Any event from a tool happens on the wp_tablet_tool interface. When the + tool gets into proximity of the tablet, a proximity_in event is sent on + the wp_tablet_tool interface, listing the tablet and the surface. That + event is followed by a motion event with the coordinates. After that, + it's the usual motion, axis, button, etc. events. The protocol's + serialisation means events are grouped by wp_tablet_tool.frame events. + + Two special events (that don't exist in X) are down and up. They signal + "tip touching the surface". For tablets without real proximity + detection, the sequence is: proximity_in, motion, down, frame. + + When the tool leaves proximity, a proximity_out event is sent. If any + button is still down, a button release event is sent before this + proximity event. These button events are sent in the same frame as the + proximity event to signal to the client that the buttons were held when + the tool left proximity. + + If the tool moves out of the surface but stays in proximity (i.e. + between windows), compositor-specific grab policies apply. This usually + means that the proximity-out is delayed until all buttons are released. + + Moving a tool physically from one tablet to the other has no real effect + on the protocol, since we already have the tool object from the "tool + added" event. All the information is already there and the proximity + events on both tablets are all a client needs to reconstruct what + happened. + + Some extra axes are normalized, i.e. the client knows the range as + specified in the protocol (e.g. [0, 65535]), the granularity however is + unknown. The current normalized axes are pressure, distance, and slider. + + Other extra axes are in physical units as specified in the protocol. + The current extra axes with physical units are tilt, rotation and + wheel rotation. + + Since tablets work independently of the pointer controlled by the mouse, + the focus handling is independent too and controlled by proximity. + The wp_tablet_tool.set_cursor request sets a tool-specific cursor. + This cursor surface may be the same as the mouse cursor, and it may be + the same across tools but it is possible to be more fine-grained. For + example, a client may set different cursors for the pen and eraser. + + Tools are generally independent of tablets and it is + compositor-specific policy when a tool can be removed. Common approaches + will likely include some form of removing a tool when all tablets the + tool was used on are removed. + + Warning! The protocol described in this file is experimental and + backward incompatible changes may be made. Backward compatible changes + may be added together with the corresponding interface version bump. + Backward incompatible changes are done by bumping the version number in + the protocol and interface names and resetting the interface version. + Once the protocol is to be declared stable, the 'z' prefix and the + version number in the protocol and interface names are removed and the + interface version number is reset. + + + + + An object that provides access to the graphics tablets available on this + system. All tablets are associated with a seat, to get access to the + actual tablets, use wp_tablet_manager.get_tablet_seat. + + + + + Get the wp_tablet_seat object for the given seat. This object + provides access to all graphics tablets in this seat. + + + + + + + + Destroy the wp_tablet_manager object. Objects created from this + object are unaffected and should be destroyed separately. + + + + + + + An object that provides access to the graphics tablets available on this + seat. After binding to this interface, the compositor sends a set of + wp_tablet_seat.tablet_added and wp_tablet_seat.tool_added events. + + + + + Destroy the wp_tablet_seat object. Objects created from this + object are unaffected and should be destroyed separately. + + + + + + This event is sent whenever a new tablet becomes available on this + seat. This event only provides the object id of the tablet, any + static information about the tablet (device name, vid/pid, etc.) is + sent through the wp_tablet interface. + + + + + + + This event is sent whenever a tool that has not previously been used + with a tablet comes into use. This event only provides the object id + of the tool; any static information about the tool (capabilities, + type, etc.) is sent through the wp_tablet_tool interface. + + + + + + + This event is sent whenever a new pad is known to the system. Typically, + pads are physically attached to tablets and a pad_added event is + sent immediately after the wp_tablet_seat.tablet_added. + However, some standalone pad devices logically attach to tablets at + runtime, and the client must wait for wp_tablet_pad.enter to know + the tablet a pad is attached to. + + This event only provides the object id of the pad. All further + features (buttons, strips, rings) are sent through the wp_tablet_pad + interface. + + + + + + + + An object that represents a physical tool that has been, or is + currently in use with a tablet in this seat. Each wp_tablet_tool + object stays valid until the client destroys it; the compositor + reuses the wp_tablet_tool object to indicate that the object's + respective physical tool has come into proximity of a tablet again. + + A wp_tablet_tool object's relation to a physical tool depends on the + tablet's ability to report serial numbers. If the tablet supports + this capability, then the object represents a specific physical tool + and can be identified even when used on multiple tablets. + + A tablet tool has a number of static characteristics, e.g. tool type, + hardware_serial and capabilities. These capabilities are sent in an + event sequence after the wp_tablet_seat.tool_added event before any + actual events from this tool. This initial event sequence is + terminated by a wp_tablet_tool.done event. + + Tablet tool events are grouped by wp_tablet_tool.frame events. + Any events received before a wp_tablet_tool.frame event should be + considered part of the same hardware state change. + + + + + Sets the surface of the cursor used for this tool on the given + tablet. This request only takes effect if the tool is in proximity + of one of the requesting client's surfaces or the surface parameter + is the current pointer surface. If there was a previous surface set + with this request it is replaced. If surface is NULL, the cursor + image is hidden. + + The parameters hotspot_x and hotspot_y define the position of the + pointer surface relative to the pointer location. Its top-left corner + is always at (x, y) - (hotspot_x, hotspot_y), where (x, y) are the + coordinates of the pointer location, in surface-local coordinates. + + On surface.attach requests to the pointer surface, hotspot_x and + hotspot_y are decremented by the x and y parameters passed to the + request. Attach must be confirmed by wl_surface.commit as usual. + + The hotspot can also be updated by passing the currently set pointer + surface to this request with new values for hotspot_x and hotspot_y. + + The current and pending input regions of the wl_surface are cleared, + and wl_surface.set_input_region is ignored until the wl_surface is no + longer used as the cursor. When the use as a cursor ends, the current + and pending input regions become undefined, and the wl_surface is + unmapped. + + This request gives the surface the role of a wp_tablet_tool cursor. A + surface may only ever be used as the cursor surface for one + wp_tablet_tool. If the surface already has another role or has + previously been used as cursor surface for a different tool, a + protocol error is raised. + + + + + + + + + + This destroys the client's resource for this tool object. + + + + + + Describes the physical type of a tool. The physical type of a tool + generally defines its base usage. + + The mouse tool represents a mouse-shaped tool that is not a relative + device but bound to the tablet's surface, providing absolute + coordinates. + + The lens tool is a mouse-shaped tool with an attached lens to + provide precision focus. + + + + + + + + + + + + + + The tool type is the high-level type of the tool and usually decides + the interaction expected from this tool. + + This event is sent in the initial burst of events before the + wp_tablet_tool.done event. + + + + + + + If the physical tool can be identified by a unique 64-bit serial + number, this event notifies the client of this serial number. + + If multiple tablets are available in the same seat and the tool is + uniquely identifiable by the serial number, that tool may move + between tablets. + + Otherwise, if the tool has no serial number and this event is + missing, the tool is tied to the tablet it first comes into + proximity with. Even if the physical tool is used on multiple + tablets, separate wp_tablet_tool objects will be created, one per + tablet. + + This event is sent in the initial burst of events before the + wp_tablet_tool.done event. + + + + + + + + This event notifies the client of a hardware id available on this tool. + + The hardware id is a device-specific 64-bit id that provides extra + information about the tool in use, beyond the wl_tool.type + enumeration. The format of the id is specific to tablets made by + Wacom Inc. For example, the hardware id of a Wacom Grip + Pen (a stylus) is 0x802. + + This event is sent in the initial burst of events before the + wp_tablet_tool.done event. + + + + + + + + Describes extra capabilities on a tablet. + + Any tool must provide x and y values, extra axes are + device-specific. + + + + + + + + + + + + This event notifies the client of any capabilities of this tool, + beyond the main set of x/y axes and tip up/down detection. + + One event is sent for each extra capability available on this tool. + + This event is sent in the initial burst of events before the + wp_tablet_tool.done event. + + + + + + + This event signals the end of the initial burst of descriptive + events. A client may consider the static description of the tool to + be complete and finalize initialization of the tool. + + + + + + This event is sent when the tool is removed from the system and will + send no further events. Should the physical tool come back into + proximity later, a new wp_tablet_tool object will be created. + + It is compositor-dependent when a tool is removed. A compositor may + remove a tool on proximity out, tablet removal or any other reason. + A compositor may also keep a tool alive until shutdown. + + If the tool is currently in proximity, a proximity_out event will be + sent before the removed event. See wp_tablet_tool.proximity_out for + the handling of any buttons logically down. + + When this event is received, the client must wp_tablet_tool.destroy + the object. + + + + + + Notification that this tool is focused on a certain surface. + + This event can be received when the tool has moved from one surface to + another, or when the tool has come back into proximity above the + surface. + + If any button is logically down when the tool comes into proximity, + the respective button event is sent after the proximity_in event but + within the same frame as the proximity_in event. + + + + + + + + + Notification that this tool has either left proximity, or is no + longer focused on a certain surface. + + When the tablet tool leaves proximity of the tablet, button release + events are sent for each button that was held down at the time of + leaving proximity. These events are sent before the proximity_out + event but within the same wp_tablet.frame. + + If the tool stays within proximity of the tablet, but the focus + changes from one surface to another, a button release event may not + be sent until the button is actually released or the tool leaves the + proximity of the tablet. + + + + + + Sent whenever the tablet tool comes in contact with the surface of the + tablet. + + If the tool is already in contact with the tablet when entering the + input region, the client owning said region will receive a + wp_tablet.proximity_in event, followed by a wp_tablet.down + event and a wp_tablet.frame event. + + Note that this event describes logical contact, not physical + contact. On some devices, a compositor may not consider a tool in + logical contact until a minimum physical pressure threshold is + exceeded. + + + + + + + Sent whenever the tablet tool stops making contact with the surface of + the tablet, or when the tablet tool moves out of the input region + and the compositor grab (if any) is dismissed. + + If the tablet tool moves out of the input region while in contact + with the surface of the tablet and the compositor does not have an + ongoing grab on the surface, the client owning said region will + receive a wp_tablet.up event, followed by a wp_tablet.proximity_out + event and a wp_tablet.frame event. If the compositor has an ongoing + grab on this device, this event sequence is sent whenever the grab + is dismissed in the future. + + Note that this event describes logical contact, not physical + contact. On some devices, a compositor may not consider a tool out + of logical contact until physical pressure falls below a specific + threshold. + + + + + + Sent whenever a tablet tool moves. + + + + + + + + Sent whenever the pressure axis on a tool changes. The value of this + event is normalized to a value between 0 and 65535. + + Note that pressure may be nonzero even when a tool is not in logical + contact. See the down and up events for more details. + + + + + + + Sent whenever the distance axis on a tool changes. The value of this + event is normalized to a value between 0 and 65535. + + Note that distance may be nonzero even when a tool is not in logical + contact. See the down and up events for more details. + + + + + + + Sent whenever one or both of the tilt axes on a tool change. Each tilt + value is in degrees, relative to the z-axis of the tablet. + The angle is positive when the top of a tool tilts along the + positive x or y axis. + + + + + + + + Sent whenever the z-rotation axis on the tool changes. The + rotation value is in degrees clockwise from the tool's + logical neutral position. + + + + + + + Sent whenever the slider position on the tool changes. The + value is normalized between -65535 and 65535, with 0 as the logical + neutral position of the slider. + + The slider is available on e.g. the Wacom Airbrush tool. + + + + + + + Sent whenever the wheel on the tool emits an event. This event + contains two values for the same axis change. The degrees value is + in the same orientation as the wl_pointer.vertical_scroll axis. The + clicks value is in discrete logical clicks of the mouse wheel. This + value may be zero if the movement of the wheel was less + than one logical click. + + Clients should choose either value and avoid mixing degrees and + clicks. The compositor may accumulate values smaller than a logical + click and emulate click events when a certain threshold is met. + Thus, wl_tablet_tool.wheel events with non-zero clicks values may + have different degrees values. + + + + + + + + Describes the physical state of a button that produced the button event. + + + + + + + + Sent whenever a button on the tool is pressed or released. + + If a button is held down when the tool moves in or out of proximity, + button events are generated by the compositor. See + wp_tablet_tool.proximity_in and wp_tablet_tool.proximity_out for + details. + + + + + + + + + Marks the end of a series of axis and/or button updates from the + tablet. The Wayland protocol requires axis updates to be sent + sequentially, however all events within a frame should be considered + one hardware event. + + + + + + + + + + + + The wp_tablet interface represents one graphics tablet device. The + tablet interface itself does not generate events; all events are + generated by wp_tablet_tool objects when in proximity above a tablet. + + A tablet has a number of static characteristics, e.g. device name and + pid/vid. These capabilities are sent in an event sequence after the + wp_tablet_seat.tablet_added event. This initial event sequence is + terminated by a wp_tablet.done event. + + + + + This destroys the client's resource for this tablet object. + + + + + + This event is sent in the initial burst of events before the + wp_tablet.done event. + + + + + + + This event is sent in the initial burst of events before the + wp_tablet.done event. + + + + + + + + A system-specific device path that indicates which device is behind + this wp_tablet. This information may be used to gather additional + information about the device, e.g. through libwacom. + + A device may have more than one device path. If so, multiple + wp_tablet.path events are sent. A device may be emulated and not + have a device path, and in that case this event will not be sent. + + The format of the path is unspecified, it may be a device node, a + sysfs path, or some other identifier. It is up to the client to + identify the string provided. + + This event is sent in the initial burst of events before the + wp_tablet.done event. + + + + + + + This event is sent immediately to signal the end of the initial + burst of descriptive events. A client may consider the static + description of the tablet to be complete and finalize initialization + of the tablet. + + + + + + Sent when the tablet has been removed from the system. When a tablet + is removed, some tools may be removed. + + When this event is received, the client must wp_tablet.destroy + the object. + + + + + + + A circular interaction area, such as the touch ring on the Wacom Intuos + Pro series tablets. + + Events on a ring are logically grouped by the wl_tablet_pad_ring.frame + event. + + + + + Request that the compositor use the provided feedback string + associated with this ring. This request should be issued immediately + after a wp_tablet_pad_group.mode_switch event from the corresponding + group is received, or whenever the ring is mapped to a different + action. See wp_tablet_pad_group.mode_switch for more details. + + Clients are encouraged to provide context-aware descriptions for + the actions associated with the ring; compositors may use this + information to offer visual feedback about the button layout + (eg. on-screen displays). + + The provided string 'description' is a UTF-8 encoded string to be + associated with this ring, and is considered user-visible; general + internationalization rules apply. + + The serial argument will be that of the last + wp_tablet_pad_group.mode_switch event received for the group of this + ring. Requests providing other serials than the most recent one will be + ignored. + + + + + + + + This destroys the client's resource for this ring object. + + + + + + Describes the source types for ring events. This indicates to the + client how a ring event was physically generated; a client may + adjust the user interface accordingly. For example, events + from a "finger" source may trigger kinetic scrolling. + + + + + + + Source information for ring events. + + This event does not occur on its own. It is sent before a + wp_tablet_pad_ring.frame event and carries the source information + for all events within that frame. + + The source specifies how this event was generated. If the source is + wp_tablet_pad_ring.source.finger, a wp_tablet_pad_ring.stop event + will be sent when the user lifts the finger off the device. + + This event is optional. If the source is unknown for an interaction, + no event is sent. + + + + + + + Sent whenever the angle on a ring changes. + + The angle is provided in degrees clockwise from the logical + north of the ring in the pad's current rotation. + + + + + + + Stop notification for ring events. + + For some wp_tablet_pad_ring.source types, a wp_tablet_pad_ring.stop + event is sent to notify a client that the interaction with the ring + has terminated. This enables the client to implement kinetic scrolling. + See the wp_tablet_pad_ring.source documentation for information on + when this event may be generated. + + Any wp_tablet_pad_ring.angle events with the same source after this + event should be considered as the start of a new interaction. + + + + + + Indicates the end of a set of ring events that logically belong + together. A client is expected to accumulate the data in all events + within the frame before proceeding. + + All wp_tablet_pad_ring events before a wp_tablet_pad_ring.frame event belong + logically together. For example, on termination of a finger interaction + on a ring the compositor will send a wp_tablet_pad_ring.source event, + a wp_tablet_pad_ring.stop event and a wp_tablet_pad_ring.frame event. + + A wp_tablet_pad_ring.frame event is sent for every logical event + group, even if the group only contains a single wp_tablet_pad_ring + event. Specifically, a client may get a sequence: angle, frame, + angle, frame, etc. + + + + + + + + A linear interaction area, such as the strips found in Wacom Cintiq + models. + + Events on a strip are logically grouped by the wl_tablet_pad_strip.frame + event. + + + + + Requests the compositor to use the provided feedback string + associated with this strip. This request should be issued immediately + after a wp_tablet_pad_group.mode_switch event from the corresponding + group is received, or whenever the strip is mapped to a different + action. See wp_tablet_pad_group.mode_switch for more details. + + Clients are encouraged to provide context-aware descriptions for + the actions associated with the strip, and compositors may use this + information to offer visual feedback about the button layout + (eg. on-screen displays). + + The provided string 'description' is a UTF-8 encoded string to be + associated with this ring, and is considered user-visible; general + internationalization rules apply. + + The serial argument will be that of the last + wp_tablet_pad_group.mode_switch event received for the group of this + strip. Requests providing other serials than the most recent one will be + ignored. + + + + + + + + This destroys the client's resource for this strip object. + + + + + + Describes the source types for strip events. This indicates to the + client how a strip event was physically generated; a client may + adjust the user interface accordingly. For example, events + from a "finger" source may trigger kinetic scrolling. + + + + + + + Source information for strip events. + + This event does not occur on its own. It is sent before a + wp_tablet_pad_strip.frame event and carries the source information + for all events within that frame. + + The source specifies how this event was generated. If the source is + wp_tablet_pad_strip.source.finger, a wp_tablet_pad_strip.stop event + will be sent when the user lifts their finger off the device. + + This event is optional. If the source is unknown for an interaction, + no event is sent. + + + + + + + Sent whenever the position on a strip changes. + + The position is normalized to a range of [0, 65535], the 0-value + represents the top-most and/or left-most position of the strip in + the pad's current rotation. + + + + + + + Stop notification for strip events. + + For some wp_tablet_pad_strip.source types, a wp_tablet_pad_strip.stop + event is sent to notify a client that the interaction with the strip + has terminated. This enables the client to implement kinetic + scrolling. See the wp_tablet_pad_strip.source documentation for + information on when this event may be generated. + + Any wp_tablet_pad_strip.position events with the same source after this + event should be considered as the start of a new interaction. + + + + + + Indicates the end of a set of events that represent one logical + hardware strip event. A client is expected to accumulate the data + in all events within the frame before proceeding. + + All wp_tablet_pad_strip events before a wp_tablet_pad_strip.frame event belong + logically together. For example, on termination of a finger interaction + on a strip the compositor will send a wp_tablet_pad_strip.source event, + a wp_tablet_pad_strip.stop event and a wp_tablet_pad_strip.frame + event. + + A wp_tablet_pad_strip.frame event is sent for every logical event + group, even if the group only contains a single wp_tablet_pad_strip + event. Specifically, a client may get a sequence: position, frame, + position, frame, etc. + + + + + + + + A pad group describes a distinct (sub)set of buttons, rings and strips + present in the tablet. The criteria of this grouping is usually positional, + eg. if a tablet has buttons on the left and right side, 2 groups will be + presented. The physical arrangement of groups is undisclosed and may + change on the fly. + + Pad groups will announce their features during pad initialization. Between + the corresponding wp_tablet_pad.group event and wp_tablet_pad_group.done, the + pad group will announce the buttons, rings and strips contained in it, + plus the number of supported modes. + + Modes are a mechanism to allow multiple groups of actions for every element + in the pad group. The number of groups and available modes in each is + persistent across device plugs. The current mode is user-switchable, it + will be announced through the wp_tablet_pad_group.mode_switch event both + whenever it is switched, and after wp_tablet_pad.enter. + + The current mode logically applies to all elements in the pad group, + although it is at clients' discretion whether to actually perform different + actions, and/or issue the respective .set_feedback requests to notify the + compositor. See the wp_tablet_pad_group.mode_switch event for more details. + + + + + Destroy the wp_tablet_pad_group object. Objects created from this object + are unaffected and should be destroyed separately. + + + + + + Sent on wp_tablet_pad_group initialization to announce the available + buttons in the group. Button indices start at 0, a button may only be + in one group at a time. + + This event is first sent in the initial burst of events before the + wp_tablet_pad_group.done event. + + Some buttons are reserved by the compositor. These buttons may not be + assigned to any wp_tablet_pad_group. Compositors may broadcast this + event in the case of changes to the mapping of these reserved buttons. + If the compositor happens to reserve all buttons in a group, this event + will be sent with an empty array. + + + + + + + Sent on wp_tablet_pad_group initialization to announce available rings. + One event is sent for each ring available on this pad group. + + This event is sent in the initial burst of events before the + wp_tablet_pad_group.done event. + + + + + + + Sent on wp_tablet_pad initialization to announce available strips. + One event is sent for each strip available on this pad group. + + This event is sent in the initial burst of events before the + wp_tablet_pad_group.done event. + + + + + + + Sent on wp_tablet_pad_group initialization to announce that the pad + group may switch between modes. A client may use a mode to store a + specific configuration for buttons, rings and strips and use the + wl_tablet_pad_group.mode_switch event to toggle between these + configurations. Mode indices start at 0. + + Switching modes is compositor-dependent. See the + wp_tablet_pad_group.mode_switch event for more details. + + This event is sent in the initial burst of events before the + wp_tablet_pad_group.done event. This event is only sent when more than + more than one mode is available. + + + + + + + This event is sent immediately to signal the end of the initial + burst of descriptive events. A client may consider the static + description of the tablet to be complete and finalize initialization + of the tablet group. + + + + + + Notification that the mode was switched. + + A mode applies to all buttons, rings and strips in a group + simultaneously, but a client is not required to assign different actions + for each mode. For example, a client may have mode-specific button + mappings but map the ring to vertical scrolling in all modes. Mode + indices start at 0. + + Switching modes is compositor-dependent. The compositor may provide + visual cues to the client about the mode, e.g. by toggling LEDs on + the tablet device. Mode-switching may be software-controlled or + controlled by one or more physical buttons. For example, on a Wacom + Intuos Pro, the button inside the ring may be assigned to switch + between modes. + + The compositor will also send this event after wp_tablet_pad.enter on + each group in order to notify of the current mode. Groups that only + feature one mode will use mode=0 when emitting this event. + + If a button action in the new mode differs from the action in the + previous mode, the client should immediately issue a + wp_tablet_pad.set_feedback request for each changed button. + + If a ring or strip action in the new mode differs from the action + in the previous mode, the client should immediately issue a + wp_tablet_ring.set_feedback or wp_tablet_strip.set_feedback request + for each changed ring or strip. + + + + + + + + + + A pad device is a set of buttons, rings and strips + usually physically present on the tablet device itself. Some + exceptions exist where the pad device is physically detached, e.g. the + Wacom ExpressKey Remote. + + Pad devices have no axes that control the cursor and are generally + auxiliary devices to the tool devices used on the tablet surface. + + A pad device has a number of static characteristics, e.g. the number + of rings. These capabilities are sent in an event sequence after the + wp_tablet_seat.pad_added event before any actual events from this pad. + This initial event sequence is terminated by a wp_tablet_pad.done + event. + + All pad features (buttons, rings and strips) are logically divided into + groups and all pads have at least one group. The available groups are + notified through the wp_tablet_pad.group event; the compositor will + emit one event per group before emitting wp_tablet_pad.done. + + Groups may have multiple modes. Modes allow clients to map multiple + actions to a single pad feature. Only one mode can be active per group, + although different groups may have different active modes. + + + + + Requests the compositor to use the provided feedback string + associated with this button. This request should be issued immediately + after a wp_tablet_pad_group.mode_switch event from the corresponding + group is received, or whenever a button is mapped to a different + action. See wp_tablet_pad_group.mode_switch for more details. + + Clients are encouraged to provide context-aware descriptions for + the actions associated with each button, and compositors may use + this information to offer visual feedback on the button layout + (e.g. on-screen displays). + + Button indices start at 0. Setting the feedback string on a button + that is reserved by the compositor (i.e. not belonging to any + wp_tablet_pad_group) does not generate an error but the compositor + is free to ignore the request. + + The provided string 'description' is a UTF-8 encoded string to be + associated with this ring, and is considered user-visible; general + internationalization rules apply. + + The serial argument will be that of the last + wp_tablet_pad_group.mode_switch event received for the group of this + button. Requests providing other serials than the most recent one will + be ignored. + + + + + + + + + Destroy the wp_tablet_pad object. Objects created from this object + are unaffected and should be destroyed separately. + + + + + + Sent on wp_tablet_pad initialization to announce available groups. + One event is sent for each pad group available. + + This event is sent in the initial burst of events before the + wp_tablet_pad.done event. At least one group will be announced. + + + + + + + A system-specific device path that indicates which device is behind + this wp_tablet_pad. This information may be used to gather additional + information about the device, e.g. through libwacom. + + The format of the path is unspecified, it may be a device node, a + sysfs path, or some other identifier. It is up to the client to + identify the string provided. + + This event is sent in the initial burst of events before the + wp_tablet_pad.done event. + + + + + + + Sent on wp_tablet_pad initialization to announce the available + buttons. + + This event is sent in the initial burst of events before the + wp_tablet_pad.done event. This event is only sent when at least one + button is available. + + + + + + + This event signals the end of the initial burst of descriptive + events. A client may consider the static description of the pad to + be complete and finalize initialization of the pad. + + + + + + Describes the physical state of a button that caused the button + event. + + + + + + + + Sent whenever the physical state of a button changes. + + + + + + + + + Notification that this pad is focused on the specified surface. + + + + + + + + + Notification that this pad is no longer focused on the specified + surface. + + + + + + + + Sent when the pad has been removed from the system. When a tablet + is removed its pad(s) will be removed too. + + When this event is received, the client must destroy all rings, strips + and groups that were offered by this pad, and issue wp_tablet_pad.destroy + the pad itself. + + + + diff --git a/src/plugins/platforms/wayland/client.pro b/src/plugins/platforms/wayland/client.pro index 1b514eeec5c..793a44183c2 100644 --- a/src/plugins/platforms/wayland/client.pro +++ b/src/plugins/platforms/wayland/client.pro @@ -36,6 +36,7 @@ WAYLANDCLIENTSOURCES += \ ../extensions/qt-key-unstable-v1.xml \ ../extensions/qt-windowmanager.xml \ ../3rdparty/protocol/wp-primary-selection-unstable-v1.xml \ + ../3rdparty/protocol/tablet-unstable-v2.xml \ ../3rdparty/protocol/text-input-unstable-v2.xml \ ../3rdparty/protocol/xdg-output-unstable-v1.xml \ ../3rdparty/protocol/wayland.xml @@ -52,6 +53,7 @@ SOURCES += qwaylandintegration.cpp \ qwaylandextendedsurface.cpp \ qwaylandsubsurface.cpp \ qwaylandsurface.cpp \ + qwaylandtabletv2.cpp \ qwaylandtouch.cpp \ qwaylandqtkey.cpp \ ../shared/qwaylandmimehelper.cpp \ @@ -77,6 +79,7 @@ HEADERS += qwaylandintegration_p.h \ qwaylandextendedsurface_p.h \ qwaylandsubsurface_p.h \ qwaylandsurface_p.h \ + qwaylandtabletv2_p.h \ qwaylandtouch_p.h \ qwaylandqtkey_p.h \ qwaylandabstractdecoration_p.h \ diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index a8d19dc6c51..ffcc72ff92d 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -69,6 +69,7 @@ #include "qwaylandextendedsurface_p.h" #include "qwaylandsubsurface_p.h" #include "qwaylandtouch_p.h" +#include "qwaylandtabletv2_p.h" #include "qwaylandqtkey_p.h" #include @@ -330,6 +331,8 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin mTouchExtension.reset(new QWaylandTouchExtension(this, id)); } else if (interface == QStringLiteral("zqt_key_v1")) { mQtKeyExtension.reset(new QWaylandQtKeyExtension(this, id)); + } else if (interface == QStringLiteral("zwp_tablet_manager_v2")) { + mTabletManager.reset(new QWaylandTabletManagerV2(this, id, qMin(1, int(version)))); #if QT_CONFIG(wayland_client_primary_selection) } else if (interface == QStringLiteral("zwp_primary_selection_device_manager_v1")) { mPrimarySelectionManager.reset(new QWaylandPrimarySelectionDeviceManagerV1(this, id, 1)); diff --git a/src/plugins/platforms/wayland/qwaylanddisplay_p.h b/src/plugins/platforms/wayland/qwaylanddisplay_p.h index cd845b44e35..e99ec198395 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay_p.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay_p.h @@ -97,6 +97,7 @@ class QWaylandDataDeviceManager; #if QT_CONFIG(wayland_client_primary_selection) class QWaylandPrimarySelectionDeviceManagerV1; #endif +class QWaylandTabletManagerV2; class QWaylandTouchExtension; class QWaylandQtKeyExtension; class QWaylandWindow; @@ -160,6 +161,7 @@ public: QWaylandPrimarySelectionDeviceManagerV1 *primarySelectionManager() const { return mPrimarySelectionManager.data(); } #endif QtWayland::qt_surface_extension *windowExtension() const { return mWindowExtension.data(); } + QWaylandTabletManagerV2 *tabletManager() const { return mTabletManager.data(); } QWaylandTouchExtension *touchExtension() const { return mTouchExtension.data(); } QtWayland::zwp_text_input_manager_v2 *textInputManager() const { return mTextInputManager.data(); } QWaylandHardwareIntegration *hardwareIntegration() const { return mHardwareIntegration.data(); } @@ -247,6 +249,7 @@ private: QScopedPointer mTouchExtension; QScopedPointer mQtKeyExtension; QScopedPointer mWindowManagerIntegration; + QScopedPointer mTabletManager; #if QT_CONFIG(wayland_client_primary_selection) QScopedPointer mPrimarySelectionManager; #endif diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index ce086ee4c7f..e0f0c6c8ec4 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -50,6 +50,7 @@ #if QT_CONFIG(wayland_client_primary_selection) #include "qwaylandprimaryselectionv1_p.h" #endif +#include "qwaylandtabletv2_p.h" #include "qwaylandtouch_p.h" #include "qwaylandscreen_p.h" #include "qwaylandcursor_p.h" @@ -418,6 +419,8 @@ QWaylandInputDevice::QWaylandInputDevice(QWaylandDisplay *display, int version, if (mQDisplay->textInputManager()) mTextInput.reset(new QWaylandTextInput(mQDisplay, mQDisplay->textInputManager()->get_text_input(wl_seat()))); + if (auto *tm = mQDisplay->tabletManager()) + mTabletSeat.reset(new QWaylandTabletSeatV2(tm, this)); } QWaylandInputDevice::~QWaylandInputDevice() diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h index 87f8559c4b6..448d0fce5dc 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h +++ b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h @@ -89,6 +89,7 @@ class QWaylandDisplay; #if QT_CONFIG(wayland_client_primary_selection) class QWaylandPrimarySelectionDeviceV1; #endif +class QWaylandTabletSeatV2; class QWaylandTextInput; #if QT_CONFIG(cursor) class QWaylandCursorTheme; @@ -127,6 +128,9 @@ public: QWaylandPrimarySelectionDeviceV1 *primarySelectionDevice() const; #endif + void setTabletSeat(QWaylandTabletSeatV2 *tabletSeat); + QWaylandTabletSeatV2* tabletSeat() const; + void setTextInput(QWaylandTextInput *textInput); QWaylandTextInput *textInput() const; @@ -183,6 +187,7 @@ private: Touch *mTouch = nullptr; QScopedPointer mTextInput; + QScopedPointer mTabletSeat; uint32_t mTime = 0; uint32_t mSerial = 0; diff --git a/src/plugins/platforms/wayland/qwaylandintegration.cpp b/src/plugins/platforms/wayland/qwaylandintegration.cpp index 33e64c6e890..85c1990b612 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandintegration.cpp @@ -425,6 +425,8 @@ void QWaylandIntegration::initializeShellIntegration() qCWarning(lcQpaWayland) << "Loading shell integration failed."; qCWarning(lcQpaWayland) << "Attempted to load the following shells" << preferredShells; } + + QWindowSystemInterfacePrivate::TabletEvent::setPlatformSynthesizesMouse(false); } QWaylandInputDevice *QWaylandIntegration::createInputDevice(QWaylandDisplay *display, int version, uint32_t id) diff --git a/src/plugins/platforms/wayland/qwaylandtabletv2.cpp b/src/plugins/platforms/wayland/qwaylandtabletv2.cpp new file mode 100644 index 00000000000..eb2e865f6e7 --- /dev/null +++ b/src/plugins/platforms/wayland/qwaylandtabletv2.cpp @@ -0,0 +1,332 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qwaylandtabletv2_p.h" +#include "qwaylandinputdevice_p.h" +#include "qwaylanddisplay_p.h" +#include "qwaylandsurface_p.h" + +QT_BEGIN_NAMESPACE + +namespace QtWaylandClient { + +QWaylandTabletManagerV2::QWaylandTabletManagerV2(QWaylandDisplay *display, uint id, uint version) + : zwp_tablet_manager_v2(display->wl_registry(), id, qMin(version, uint(1))) +{ + // Create tabletSeats for all seats. + // This only works if we get the manager after all seats + const auto seats = display->inputDevices(); + for (auto *seat : seats) + createTabletSeat(seat); +} + +QWaylandTabletSeatV2 *QWaylandTabletManagerV2::createTabletSeat(QWaylandInputDevice *seat) +{ + return new QWaylandTabletSeatV2(this, seat); +} + +QWaylandTabletSeatV2::QWaylandTabletSeatV2(QWaylandTabletManagerV2 *manager, QWaylandInputDevice *seat) + : QtWayland::zwp_tablet_seat_v2(manager->get_tablet_seat(seat->wl_seat())) +{ +} + +QWaylandTabletSeatV2::~QWaylandTabletSeatV2() +{ + for (auto *tablet : m_tablets) + tablet->destroy(); + for (auto *tool : m_tools) + tool->destroy(); + for (auto *pad : m_pads) + pad->destroy(); + destroy(); +} + +void QWaylandTabletSeatV2::zwp_tablet_seat_v2_tablet_added(zwp_tablet_v2 *id) +{ + auto *tablet = new QWaylandTabletV2(id); + m_tablets.push_back(tablet); + connect(tablet, &QWaylandTabletV2::destroyed, this, [this, tablet] { m_tablets.removeOne(tablet); }); +} + +void QWaylandTabletSeatV2::zwp_tablet_seat_v2_tool_added(zwp_tablet_tool_v2 *id) +{ + auto *tool = new QWaylandTabletToolV2(id); + m_tools.push_back(tool); + connect(tool, &QWaylandTabletToolV2::destroyed, this, [this, tool] { m_tools.removeOne(tool); }); +} + +void QWaylandTabletSeatV2::zwp_tablet_seat_v2_pad_added(zwp_tablet_pad_v2 *id) +{ + auto *pad = new QWaylandTabletPadV2(id); + m_pads.push_back(pad); + connect(pad, &QWaylandTabletPadV2::destroyed, this, [this, pad] { m_pads.removeOne(pad); }); +} + +QWaylandTabletV2::QWaylandTabletV2(::zwp_tablet_v2 *tablet) + : QtWayland::zwp_tablet_v2(tablet) +{ +} + +void QWaylandTabletV2::zwp_tablet_v2_removed() +{ + destroy(); + delete this; +} + +QWaylandTabletToolV2::QWaylandTabletToolV2(::zwp_tablet_tool_v2 *tool) + : QtWayland::zwp_tablet_tool_v2(tool) +{ +} + +void QWaylandTabletToolV2::zwp_tablet_tool_v2_type(uint32_t tool_type) +{ + m_toolType = type(tool_type); +} + +void QWaylandTabletToolV2::zwp_tablet_tool_v2_hardware_serial(uint32_t hardware_serial_hi, uint32_t hardware_serial_lo) +{ + m_uid = (quint64(hardware_serial_hi) << 32) + hardware_serial_lo; +} + +void QWaylandTabletToolV2::zwp_tablet_tool_v2_capability(uint32_t capability) +{ + if (capability == capability_rotation) + m_hasRotation = true; +} + +void QWaylandTabletToolV2::zwp_tablet_tool_v2_done() +{ + switch (m_toolType) { + case type::type_airbrush: + case type::type_brush: + case type::type_pencil: + case type::type_pen: + m_pointerType = QTabletEvent::PointerType::Pen; + break; + case type::type_eraser: + m_pointerType = QTabletEvent::PointerType::Eraser; + break; + case type::type_mouse: + case type::type_lens: + m_pointerType = QTabletEvent::PointerType::Cursor; + break; + case type::type_finger: + m_pointerType = QTabletEvent::PointerType::UnknownPointer; + break; + } + switch (m_toolType) { + case type::type_airbrush: + m_tabletDevice = QTabletEvent::TabletDevice::Airbrush; + break; + case type::type_brush: + case type::type_pencil: + case type::type_pen: + case type::type_eraser: + m_tabletDevice = m_hasRotation ? QTabletEvent::TabletDevice::RotationStylus : QTabletEvent::TabletDevice::Stylus; + break; + case type::type_lens: + m_tabletDevice = QTabletEvent::TabletDevice::Puck; + break; + case type::type_mouse: + case type::type_finger: + m_tabletDevice = QTabletEvent::TabletDevice::NoDevice; + break; + } +} + +void QWaylandTabletToolV2::zwp_tablet_tool_v2_removed() +{ + destroy(); + delete this; +} + +void QWaylandTabletToolV2::zwp_tablet_tool_v2_proximity_in(uint32_t serial, zwp_tablet_v2 *tablet, wl_surface *surface) +{ + Q_UNUSED(tablet); + Q_UNUSED(serial); + if (Q_UNLIKELY(!surface)) { + qCDebug(lcQpaWayland) << "Ignoring zwp_tablet_tool_v2_proximity_v2 with no surface"; + return; + } + m_pending.enteredSurface = true; + m_pending.proximitySurface = QWaylandSurface::fromWlSurface(surface); +} + +void QWaylandTabletToolV2::zwp_tablet_tool_v2_proximity_out() +{ + m_pending.enteredSurface = false; + m_pending.proximitySurface = nullptr; +} + +void QWaylandTabletToolV2::zwp_tablet_tool_v2_down(uint32_t serial) +{ + Q_UNUSED(serial); + m_pending.down = true; +} + +void QWaylandTabletToolV2::zwp_tablet_tool_v2_up() +{ + m_pending.down = false; +} + +void QWaylandTabletToolV2::zwp_tablet_tool_v2_motion(wl_fixed_t x, wl_fixed_t y) +{ + m_pending.surfacePosition = QPointF(wl_fixed_to_double(x), wl_fixed_to_double(y)); +} + +void QWaylandTabletToolV2::zwp_tablet_tool_v2_pressure(uint32_t pressure) +{ + const int maxPressure = 65535; + m_pending.pressure = qreal(pressure)/maxPressure; +} + +void QWaylandTabletToolV2::zwp_tablet_tool_v2_distance(uint32_t distance) +{ + m_pending.distance = distance; +} + +void QWaylandTabletToolV2::zwp_tablet_tool_v2_tilt(wl_fixed_t tilt_x, wl_fixed_t tilt_y) +{ + m_pending.xTilt = wl_fixed_to_double(tilt_x); + m_pending.yTilt = wl_fixed_to_double(tilt_y); +} + +void QWaylandTabletToolV2::zwp_tablet_tool_v2_rotation(wl_fixed_t degrees) +{ + m_pending.rotation = wl_fixed_to_double(degrees); +} + +void QWaylandTabletToolV2::zwp_tablet_tool_v2_slider(int32_t position) +{ + m_pending.slider = qreal(position) / 65535; +} + +static Qt::MouseButton mouseButtonFromTablet(uint button) +{ + switch (button) { + case 0x110: return Qt::MouseButton::LeftButton; // BTN_LEFT + case 0x14b: return Qt::MouseButton::MiddleButton; // BTN_STYLUS + case 0x14c: return Qt::MouseButton::RightButton; // BTN_STYLUS2 + default: + return Qt::NoButton; + } +} + +void QWaylandTabletToolV2::zwp_tablet_tool_v2_button(uint32_t serial, uint32_t button, uint32_t state) +{ + Q_UNUSED(serial); + Qt::MouseButton mouseButton = mouseButtonFromTablet(button); + if (state == button_state_pressed) + m_pending.buttons |= mouseButton; + else + m_pending.buttons &= ~mouseButton; +} + +void QWaylandTabletToolV2::zwp_tablet_tool_v2_frame(uint32_t time) +{ + if (m_pending.proximitySurface && !m_applied.proximitySurface) { + QWindowSystemInterface::handleTabletEnterProximityEvent(m_tabletDevice, m_pointerType, m_uid); + m_applied.proximitySurface = m_pending.proximitySurface; + } + + if (!(m_pending == m_applied) && m_pending.proximitySurface) { + if (!m_pending.proximitySurface) { + qCWarning(lcQpaWayland) << "Can't send tablet event with no proximity surface, ignoring"; + return; + } + QWaylandWindow *waylandWindow = QWaylandWindow::fromWlSurface(m_pending.proximitySurface->object()); + QWindow *window = waylandWindow->window(); + ulong timestamp = time; + const QPointF localPosition = waylandWindow->mapFromWlSurface(m_pending.surfacePosition); + + QPointF delta = localPosition - localPosition.toPoint(); + QPointF globalPosition = window->mapToGlobal(localPosition.toPoint()); + globalPosition += delta; + + Qt::MouseButtons buttons = m_pending.down ? Qt::MouseButton::LeftButton : Qt::MouseButton::NoButton; + buttons |= m_pending.buttons; + qreal pressure = m_pending.pressure; + int xTilt = int(m_pending.xTilt); + int yTilt = int(m_pending.yTilt); + qreal tangentialPressure = m_pending.slider; + qreal rotation = m_pending.rotation; + int z = int(m_pending.distance); + QWindowSystemInterface::handleTabletEvent(window, timestamp, localPosition, globalPosition, + m_tabletDevice, m_pointerType, buttons, pressure, + xTilt, yTilt, tangentialPressure, rotation, z, m_uid); + } + + if (!m_pending.proximitySurface && m_applied.enteredSurface) { + QWindowSystemInterface::handleTabletLeaveProximityEvent(m_tabletDevice, m_pointerType, m_uid); + m_pending = State(); // Don't leave pressure etc. lying around when we enter the next surface + } + + m_applied = m_pending; +} + +// TODO: delete when upgrading to c++20 +bool QWaylandTabletToolV2::State::operator==(const QWaylandTabletToolV2::State &o) const { + return + down == o.down && + proximitySurface.data() == o.proximitySurface.data() && + enteredSurface == o.enteredSurface && + surfacePosition == o.surfacePosition && + distance == o.distance && + pressure == o.pressure && + rotation == o.rotation && + xTilt == o.xTilt && + yTilt == o.yTilt && + slider == o.slider && + buttons == o.buttons; +} + +QWaylandTabletPadV2::QWaylandTabletPadV2(::zwp_tablet_pad_v2 *pad) + : QtWayland::zwp_tablet_pad_v2(pad) +{ +} + +void QWaylandTabletPadV2::zwp_tablet_pad_v2_removed() +{ + destroy(); + delete this; +} + +} // namespace QtWaylandClient + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandtabletv2_p.h b/src/plugins/platforms/wayland/qwaylandtabletv2_p.h new file mode 100644 index 00000000000..b4daaf5dbbb --- /dev/null +++ b/src/plugins/platforms/wayland/qwaylandtabletv2_p.h @@ -0,0 +1,191 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWAYLANDTABLETV2_P_H +#define QWAYLANDTABLETV2_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include + +#include + +#include +#include +#include +#include + +QT_BEGIN_NAMESPACE + +namespace QtWaylandClient { + +class QWaylandDisplay; +class QWaylandInputDevice; +class QWaylandSurface; + +class QWaylandTabletSeatV2; +class QWaylandTabletV2; +class QWaylandTabletToolV2; +class QWaylandTabletPadV2; + +class Q_WAYLAND_CLIENT_EXPORT QWaylandTabletManagerV2 : public QtWayland::zwp_tablet_manager_v2 +{ +public: + explicit QWaylandTabletManagerV2(QWaylandDisplay *display, uint id, uint version); + QWaylandTabletSeatV2 *createTabletSeat(QWaylandInputDevice *seat); +}; + +class Q_WAYLAND_CLIENT_EXPORT QWaylandTabletSeatV2 : public QObject, public QtWayland::zwp_tablet_seat_v2 +{ + Q_OBJECT +public: + explicit QWaylandTabletSeatV2(QWaylandTabletManagerV2 *manager, QWaylandInputDevice *seat); + ~QWaylandTabletSeatV2() override; + +protected: + void zwp_tablet_seat_v2_tablet_added(struct ::zwp_tablet_v2 *id) override; + void zwp_tablet_seat_v2_tool_added(struct ::zwp_tablet_tool_v2 *id) override; + void zwp_tablet_seat_v2_pad_added(struct ::zwp_tablet_pad_v2 *id) override; + +private: + QVector m_tablets; + QVector m_tools; + QVector m_pads; +}; + +class Q_WAYLAND_CLIENT_EXPORT QWaylandTabletV2 : public QObject, public QtWayland::zwp_tablet_v2 +{ + Q_OBJECT +public: + explicit QWaylandTabletV2(::zwp_tablet_v2 *tablet); + +protected: +// void zwp_tablet_v2_name(const QString &name) override; +// void zwp_tablet_v2_id(uint32_t vid, uint32_t pid) override; +// void zwp_tablet_v2_path(const QString &path) override; +// void zwp_tablet_v2_done() override; + void zwp_tablet_v2_removed() override; +}; + +class Q_WAYLAND_CLIENT_EXPORT QWaylandTabletToolV2 : public QObject, public QtWayland::zwp_tablet_tool_v2 +{ + Q_OBJECT +public: + explicit QWaylandTabletToolV2(::zwp_tablet_tool_v2 *tool); + +protected: + void zwp_tablet_tool_v2_type(uint32_t tool_type) override; + void zwp_tablet_tool_v2_hardware_serial(uint32_t hardware_serial_hi, uint32_t hardware_serial_lo) override; +// void zwp_tablet_tool_v2_hardware_id_wacom(uint32_t hardware_id_hi, uint32_t hardware_id_lo) override; + void zwp_tablet_tool_v2_capability(uint32_t capability) override; + void zwp_tablet_tool_v2_done() override; + void zwp_tablet_tool_v2_removed() override; + void zwp_tablet_tool_v2_proximity_in(uint32_t serial, struct ::zwp_tablet_v2 *tablet, struct ::wl_surface *surface) override; + void zwp_tablet_tool_v2_proximity_out() override; + void zwp_tablet_tool_v2_down(uint32_t serial) override; + void zwp_tablet_tool_v2_up() override; + void zwp_tablet_tool_v2_motion(wl_fixed_t x, wl_fixed_t y) override; + void zwp_tablet_tool_v2_pressure(uint32_t pressure) override; + void zwp_tablet_tool_v2_distance(uint32_t distance) override; + void zwp_tablet_tool_v2_tilt(wl_fixed_t tilt_x, wl_fixed_t tilt_y) override; + void zwp_tablet_tool_v2_rotation(wl_fixed_t degrees) override; + void zwp_tablet_tool_v2_slider(int32_t position) override; +// void zwp_tablet_tool_v2_wheel(wl_fixed_t degrees, int32_t clicks) override; + void zwp_tablet_tool_v2_button(uint32_t serial, uint32_t button, uint32_t state) override; + void zwp_tablet_tool_v2_frame(uint32_t time) override; + +private: + + // Static state (sent before done event) + QTabletEvent::PointerType m_pointerType = QTabletEvent::PointerType::UnknownPointer; + QTabletEvent::TabletDevice m_tabletDevice = QTabletEvent::TabletDevice::NoDevice; + type m_toolType = type_pen; + bool m_hasRotation = false; + quint64 m_uid = 0; + + // Accumulated state (applied on frame event) + struct State { + bool down = false; + QPointer proximitySurface; + bool enteredSurface = false; // Not enough with just proximitySurface, if the surface is deleted, we still want to send a leave event + QPointF surfacePosition; + uint distance = 0; + qreal pressure = 0; + qreal rotation = 0; + qreal xTilt = 0; + qreal yTilt = 0; + qreal slider = 0; + Qt::MouseButtons buttons = Qt::MouseButton::NoButton; // Actual buttons, down state -> left mouse is mapped inside the frame handler + //auto operator<=>(const Point&) const = default; // TODO: use this when upgrading to C++20 + bool operator==(const State &o) const; + } m_pending, m_applied; +}; + +// We don't actually use this, but need to handle the "removed" event to comply with the protocol +class Q_WAYLAND_CLIENT_EXPORT QWaylandTabletPadV2 : public QObject, public QtWayland::zwp_tablet_pad_v2 +{ + Q_OBJECT +public: + explicit QWaylandTabletPadV2(::zwp_tablet_pad_v2 *pad); + +protected: +// void zwp_tablet_pad_v2_group(struct ::zwp_tablet_pad_group_v2 *pad_group) override; +// void zwp_tablet_pad_v2_path(const QString &path) override; +// void zwp_tablet_pad_v2_buttons(uint32_t buttons) override; +// void zwp_tablet_pad_v2_done() override; +// void zwp_tablet_pad_v2_button(uint32_t time, uint32_t button, uint32_t state) override; +// void zwp_tablet_pad_v2_enter(uint32_t serial, struct ::zwp_tablet_v2 *tablet, struct ::wl_surface *surface) override; +// void zwp_tablet_pad_v2_leave(uint32_t serial, struct ::wl_surface *surface) override; + void zwp_tablet_pad_v2_removed() override; +}; + +} // namespace QtWaylandClient + +QT_END_NAMESPACE + +#endif // QWAYLANDTABLETV2_P_H diff --git a/tests/auto/wayland/client.pro b/tests/auto/wayland/client.pro index cda1765e3b1..46a3aa42ec0 100644 --- a/tests/auto/wayland/client.pro +++ b/tests/auto/wayland/client.pro @@ -11,6 +11,7 @@ SUBDIRS += \ seatv4 \ seatv5 \ surface \ + tabletv2 \ wl_connect \ xdgdecorationv1 \ xdgoutput \ diff --git a/tests/auto/wayland/tabletv2/tabletv2.pro b/tests/auto/wayland/tabletv2/tabletv2.pro new file mode 100644 index 00000000000..9dc9636e910 --- /dev/null +++ b/tests/auto/wayland/tabletv2/tabletv2.pro @@ -0,0 +1,7 @@ +include (../shared/shared.pri) + +WAYLANDSERVERSOURCES += \ + $$PWD/../../../../src/3rdparty/protocol/tablet-unstable-v2.xml + +TARGET = tst_tabletv2 +SOURCES += tst_tabletv2.cpp diff --git a/tests/auto/wayland/tabletv2/tst_tabletv2.cpp b/tests/auto/wayland/tabletv2/tst_tabletv2.cpp new file mode 100644 index 00000000000..2fe2ff42025 --- /dev/null +++ b/tests/auto/wayland/tabletv2/tst_tabletv2.cpp @@ -0,0 +1,918 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "mockcompositor.h" + +#include + +#include + +using namespace MockCompositor; + +constexpr int tabletVersion = 1; // protocol VERSION, not the name suffix (_v2) + +class TabletManagerV2; +class TabletSeatV2; + +class TabletV2 : public QObject, public QtWaylandServer::zwp_tablet_v2 +{ + Q_OBJECT +public: + explicit TabletV2(TabletSeatV2 *tabletSeat) + : m_tabletSeat(tabletSeat) + { + } + + void send_removed() = delete; + void send_removed(struct ::wl_resource *resource) = delete; + void sendRemoved(); + + QPointer m_tabletSeat; // destroy order is not guaranteed +protected: + void zwp_tablet_v2_destroy(Resource *resource) override; +}; + +class TabletToolV2 : public QObject, public QtWaylandServer::zwp_tablet_tool_v2 +{ + Q_OBJECT +public: + using ToolType = QtWaylandServer::zwp_tablet_tool_v2::type; + explicit TabletToolV2(TabletSeatV2 *tabletSeat, ToolType toolType, quint64 hardwareSerial) + : m_tabletSeat(tabletSeat) + , m_toolType(toolType) + , m_hardwareSerial(hardwareSerial) + { + } + + wl_resource *toolResource() // for convenience + { + Q_ASSERT(resourceMap().size() == 1); + // Strictly speaking, there may be more than one resource for the tool, for intsance if + // if there are multiple clients, or a client has called get_tablet_seat multiple times. + // For now we'll pretend there can only be one resource. + return resourceMap().first()->handle; + } + + void send_removed() = delete; + void send_removed(struct ::wl_resource *resource) = delete; + void sendRemoved(); + + uint sendProximityIn(TabletV2 *tablet, Surface *surface); + void sendProximityOut(); + void sendMotion(QPointF position) + { + Q_ASSERT(m_proximitySurface); + for (auto *resource : resourceMap()) + send_motion(resource->handle, wl_fixed_from_double(position.x()), wl_fixed_from_double(position.y())); + } + uint sendDown(); + void sendUp() { send_up(toolResource()); } + void sendPressure(uint pressure); + void sendTilt(qreal tiltX, qreal tiltY) { send_tilt(toolResource(), wl_fixed_from_double(tiltX), wl_fixed_from_double(tiltY)); } + void sendRotation(qreal rotation) { send_rotation(toolResource(), wl_fixed_from_double(rotation)); } + uint sendButton(uint button, bool pressed); + uint sendFrame(); + + QPointer m_tabletSeat; // destruction order is not guaranteed + ToolType m_toolType = ToolType::type_pen; + quint64 m_hardwareSerial = 0; + QPointer m_proximitySurface; +protected: + void zwp_tablet_tool_v2_destroy(Resource *resource) override; +}; + +class TabletPadV2 : public QObject, public QtWaylandServer::zwp_tablet_pad_v2 +{ + Q_OBJECT +public: + explicit TabletPadV2(TabletSeatV2 *tabletSeat) + : m_tabletSeat(tabletSeat) + { + } + + void send_removed() = delete; + void send_removed(struct ::wl_resource *resource) = delete; + void sendRemoved(); + + QPointer m_tabletSeat; // destroy order is not guaranteed +protected: + void zwp_tablet_pad_v2_destroy(Resource *resource) override; +}; + +class TabletSeatV2 : public QObject, public QtWaylandServer::zwp_tablet_seat_v2 +{ + Q_OBJECT +public: + explicit TabletSeatV2(TabletManagerV2 *manager, Seat *seat) + : m_manager(manager) + , m_seat(seat) + {} + TabletV2 *addTablet() + { + auto *tablet = new TabletV2(this); + m_tablets.append(tablet); + for (auto *resource : resourceMap()) + sendTabletAdded(resource, tablet); + return tablet; + } + + void sendTabletAdded(Resource *resource, TabletV2 *tablet) + { + // Although, not necessarily correct, assuming just one tablet_seat per client + auto *tabletResource = tablet->add(resource->client(), resource->version()); + zwp_tablet_seat_v2::send_tablet_added(resource->handle, tabletResource->handle); + // TODO: send extra stuff before done? + tablet->send_done(tabletResource->handle); + } + + using ToolType = QtWaylandServer::zwp_tablet_tool_v2::type; + TabletToolV2 *addTool(ToolType toolType = ToolType::type_pen, quint64 hardwareSerial = 0) + { + auto *tool = new TabletToolV2(this, toolType, hardwareSerial); + m_tools.append(tool); + for (auto *resource : resourceMap()) + sendToolAdded(resource, tool); + return tool; + } + + void sendToolAdded(Resource *resource, TabletToolV2 *tool) + { + // Although, not necessarily correct, assuming just one tablet_seat per client + auto *toolResource = tool->add(resource->client(), resource->version())->handle; + zwp_tablet_seat_v2::send_tool_added(resource->handle, toolResource); + tool->send_type(toolResource, tool->m_toolType); + if (tool->m_hardwareSerial) { + const uint hi = tool->m_hardwareSerial >> 32; + const uint lo = tool->m_hardwareSerial & 0xffffffff; + tool->send_hardware_serial(toolResource, hi, lo); + } + tool->send_done(toolResource); + } + + TabletPadV2 *addPad() + { + auto *pad = new TabletPadV2(this); + m_pads.append(pad); + for (auto *resource : resourceMap()) + sendPadAdded(resource, pad); + return pad; + } + + void sendPadAdded(Resource *resource, TabletPadV2 *pad) + { + // Although, not necessarily correct, assuming just one tablet_seat per client + auto *padResource = pad->add(resource->client(), resource->version())->handle; + zwp_tablet_seat_v2::send_pad_added(resource->handle, padResource); + pad->send_done(padResource); + } + + void removeAll() + { + const auto tools = m_tools; + for (auto *tool : tools) + tool->sendRemoved(); + + const auto tablets = m_tablets; + for (auto *tablet : tablets) + tablet->sendRemoved(); + + const auto pads = m_pads; + for (auto *pad : pads) + pad->sendRemoved(); + } + + TabletManagerV2 *m_manager = nullptr; + Seat *m_seat = nullptr; + QVector m_tablets; + QVector m_tabletsWaitingForDestroy; + QVector m_tools; + QVector m_toolsWaitingForDestroy; + QVector m_pads; + QVector m_padsWaitingForDestroy; + +protected: + void zwp_tablet_seat_v2_bind_resource(Resource *resource) + { + for (auto *tablet : m_tablets) + sendTabletAdded(resource, tablet); + for (auto *tool : m_tools) + sendToolAdded(resource, tool); + for (auto *pad : m_pads) + sendPadAdded(resource, pad); + } +}; + +class TabletManagerV2 : public Global, public QtWaylandServer::zwp_tablet_manager_v2 +{ + Q_OBJECT +public: + explicit TabletManagerV2(CoreCompositor *compositor, int version = 1) + : QtWaylandServer::zwp_tablet_manager_v2(compositor->m_display, version) + , m_version(version) + {} + bool isClean() override + { + for (auto *seat : m_tabletSeats) { + if (!seat->m_tabletsWaitingForDestroy.empty()) + return false; + if (!seat->m_toolsWaitingForDestroy.empty()) + return false; + if (!seat->m_padsWaitingForDestroy.empty()) + return false; + } + return true; + } + + TabletSeatV2 *tabletSeatFor(Seat *seat) + { + Q_ASSERT(seat); + if (auto *tabletSeat = m_tabletSeats.value(seat, nullptr)) + return tabletSeat; + + auto *tabletSeat = new TabletSeatV2(this, seat); + m_tabletSeats[seat] = tabletSeat; + return tabletSeat; + } + + int m_version = 1; // TODO: Remove on libwayland upgrade + QMap m_tabletSeats; + +protected: + void zwp_tablet_manager_v2_destroy(Resource *resource) override + { + // tablet_seats created from this object are unaffected and should be destroyed separately. + wl_resource_destroy(resource->handle); + } + + void zwp_tablet_manager_v2_get_tablet_seat(Resource *resource, uint32_t id, ::wl_resource *seatResource) override + { + auto *seat = fromResource(seatResource); + QVERIFY(seat); + auto *tabletSeat = tabletSeatFor(seat); + tabletSeat->add(resource->client(), id, resource->version()); + } +}; + +void TabletV2::sendRemoved() +{ + for (auto *resource : resourceMap()) + zwp_tablet_v2_send_removed(resource->handle); + bool removed = m_tabletSeat->m_tablets.removeOne(this); + QVERIFY(removed); + m_tabletSeat->m_tabletsWaitingForDestroy.append(this); +} + +void TabletV2::zwp_tablet_v2_destroy(QtWaylandServer::zwp_tablet_v2::Resource *resource) +{ + Q_UNUSED(resource) + if (m_tabletSeat) { + bool removed = m_tabletSeat->m_tabletsWaitingForDestroy.removeOne(this); + QVERIFY(removed); + } + wl_resource_destroy(resource->handle); +} + +void TabletToolV2::sendRemoved() +{ + for (auto *resource : resourceMap()) + zwp_tablet_tool_v2_send_removed(resource->handle); + bool removed = m_tabletSeat->m_tools.removeOne(this); + QVERIFY(removed); + m_tabletSeat->m_toolsWaitingForDestroy.append(this); +} + +uint TabletToolV2::sendProximityIn(TabletV2 *tablet, Surface *surface) +{ + Q_ASSERT(!m_proximitySurface); + m_proximitySurface = surface; + uint serial = m_tabletSeat->m_seat->m_compositor->nextSerial(); + auto *client = surface->resource()->client(); + auto tabletResource = tablet->resourceMap().value(client)->handle; + send_proximity_in(toolResource(), serial, tabletResource, surface->resource()->handle); + return serial; +} + +void TabletToolV2::sendProximityOut() +{ + Q_ASSERT(m_proximitySurface); + send_proximity_out(toolResource()); + m_proximitySurface = nullptr; +} + +uint TabletToolV2::sendDown() +{ + uint serial = m_tabletSeat->m_seat->m_compositor->nextSerial(); + send_down(toolResource(), serial); + return serial; +} + +void TabletToolV2::sendPressure(uint pressure) +{ + Q_ASSERT(m_proximitySurface); + auto *client = m_proximitySurface->resource()->client(); + auto toolResource = resourceMap().value(client)->handle; + send_pressure(toolResource, pressure); +} + +uint TabletToolV2::sendButton(uint button, bool pressed) +{ + button_state state = pressed ? button_state_pressed : button_state_released; + uint serial = m_tabletSeat->m_seat->m_compositor->nextSerial(); + send_button(toolResource(), serial, button, state); + return serial; +} + +uint TabletToolV2::sendFrame() +{ + uint time = m_tabletSeat->m_seat->m_compositor->currentTimeMilliseconds(); + for (auto *resource : resourceMap()) + send_frame(resource->handle, time); + return time; +} + +void TabletToolV2::zwp_tablet_tool_v2_destroy(QtWaylandServer::zwp_tablet_tool_v2::Resource *resource) +{ + if (m_tabletSeat) { + bool removed = m_tabletSeat->m_toolsWaitingForDestroy.removeOne(this); + QVERIFY(removed); + } + wl_resource_destroy(resource->handle); +} + +void TabletPadV2::sendRemoved() +{ + for (auto *resource : resourceMap()) + zwp_tablet_pad_v2_send_removed(resource->handle); + bool removed = m_tabletSeat->m_pads.removeOne(this); + QVERIFY(removed); + m_tabletSeat->m_padsWaitingForDestroy.append(this); +} + +void TabletPadV2::zwp_tablet_pad_v2_destroy(QtWaylandServer::zwp_tablet_pad_v2::Resource *resource) +{ + if (m_tabletSeat) { + bool removed = m_tabletSeat->m_padsWaitingForDestroy.removeOne(this); + QVERIFY(removed); + } + wl_resource_destroy(resource->handle); +} + +class TabletCompositor : public DefaultCompositor { +public: + explicit TabletCompositor() + { + exec([this] { + m_config.autoConfigure = true; + add(tabletVersion); + }); + } + TabletSeatV2 *tabletSeat(int i = 0) + { + return get()->tabletSeatFor(get(i)); + } + TabletV2 *tablet(int i = 0, int iSeat = 0) + { + if (auto *ts = tabletSeat(iSeat)) + return ts->m_tablets.value(i, nullptr); + return nullptr; + } + TabletToolV2 *tabletTool(int i = 0, int iSeat = 0) + { + if (auto *ts = tabletSeat(iSeat)) + return ts->m_tools.value(i, nullptr); + return nullptr; + } + TabletPadV2 *tabletPad(int i = 0, int iSeat = 0) + { + if (auto *ts = tabletSeat(iSeat)) + return ts->m_pads.value(i, nullptr); + return nullptr; + } +}; + +Q_DECLARE_METATYPE(QtWaylandServer::zwp_tablet_tool_v2::type); +Q_DECLARE_METATYPE(QTabletEvent::PointerType); +Q_DECLARE_METATYPE(Qt::MouseButton); + +class tst_tabletv2 : public QObject, private TabletCompositor +{ + using ToolType = QtWaylandServer::zwp_tablet_tool_v2::type; + Q_OBJECT +private slots: + void cleanup(); + void bindsToManager(); + void createsTabletSeat(); + void destroysTablet(); + void destroysTool(); + void destroysPad(); + void proximityEvents(); + void moveEvent(); + void pointerType_data(); + void pointerType(); + void hardwareSerial(); + void buttons_data(); + void buttons(); + void tabletEvents(); +}; + +class ProximityFilter : public QObject { + Q_OBJECT +public: + ProximityFilter() { qApp->installEventFilter(this); } + ~ProximityFilter() override { qDeleteAll(m_events); } + QVector m_events; + + int nextEventIndex = 0; + int numEvents() const { return m_events.size() - nextEventIndex; } + QTabletEvent *popEvent() + { + auto *event = m_events.value(nextEventIndex, nullptr); + if (event) + ++nextEventIndex; + return event; + } + +protected: + bool eventFilter(QObject *object, QEvent *event) override + { + Q_UNUSED(object); + switch (event->type()) { + case QEvent::TabletEnterProximity: + case QEvent::TabletLeaveProximity: { + auto *e = static_cast(event); + auto *ev = new QTabletEvent(e->type(), e->posF(), e->globalPosF(), e->device(), + e->pointerType(), e->pressure(), e->xTilt(), e->yTilt(), + e->tangentialPressure(), e->rotation(), e->z(), + Qt::KeyboardModifier::NoModifier, e->uniqueId(), + e->button(), e->buttons()); + m_events << ev; + break; + } + default: + break; + } + return false; + } +}; + +void tst_tabletv2::cleanup() +{ + exec([&] { + tabletSeat()->removeAll(); + }); + QCOMPOSITOR_COMPARE(get()->m_tabletSeats.size(), 1); + QCOMPOSITOR_COMPARE(tabletSeat()->m_tablets.size(), 0); + QCOMPOSITOR_COMPARE(tabletSeat()->m_tools.size(), 0); + QCOMPOSITOR_COMPARE(tabletSeat()->m_pads.size(), 0); + + QTRY_VERIFY2(isClean(), qPrintable(dirtyMessage())); +} + +void tst_tabletv2::bindsToManager() +{ + QCOMPOSITOR_TRY_COMPARE(get()->resourceMap().size(), 1); + QCOMPOSITOR_TRY_COMPARE(get()->resourceMap().first()->version(), tabletVersion); +} + +void tst_tabletv2::createsTabletSeat() +{ + QCOMPOSITOR_TRY_VERIFY(tabletSeat()); + QCOMPOSITOR_TRY_VERIFY(tabletSeat()->resourceMap().contains(client())); + QCOMPOSITOR_TRY_COMPARE(tabletSeat()->resourceMap().value(client())->version(), tabletVersion); + //TODO: Maybe also assert some capability reported though qt APIs? +} + +void tst_tabletv2::destroysTablet() +{ + QCOMPOSITOR_TRY_VERIFY(tabletSeat()); + exec([&] { + tabletSeat()->addTablet(); + }); + QCOMPOSITOR_TRY_VERIFY(tablet()); + + exec([&] { + tablet()->sendRemoved(); + }); + + QCOMPOSITOR_TRY_VERIFY(!tablet()); + QCOMPOSITOR_TRY_VERIFY(tabletSeat()->m_tabletsWaitingForDestroy.empty()); +} + +void tst_tabletv2::destroysTool() +{ + QCOMPOSITOR_TRY_VERIFY(tabletSeat()); + exec([&] { + tabletSeat()->addTool(); + }); + QCOMPOSITOR_TRY_VERIFY(tabletTool()); + + exec([&] { + tabletTool()->sendRemoved(); + }); + + QCOMPOSITOR_TRY_VERIFY(!tabletTool()); + QCOMPOSITOR_TRY_VERIFY(tabletSeat()->m_toolsWaitingForDestroy.empty()); +} + +void tst_tabletv2::destroysPad() +{ + QCOMPOSITOR_TRY_VERIFY(tabletSeat()); + exec([&] { + tabletSeat()->addPad(); + }); + QCOMPOSITOR_TRY_VERIFY(tabletPad()); + + exec([&] { + tabletPad()->sendRemoved(); + }); + + QCOMPOSITOR_TRY_VERIFY(!tabletPad()); + QCOMPOSITOR_TRY_VERIFY(tabletSeat()->m_padsWaitingForDestroy.empty()); +} + +void tst_tabletv2::proximityEvents() +{ + ProximityFilter filter; + + QCOMPOSITOR_TRY_VERIFY(tabletSeat()); + exec([&] { + tabletSeat()->addTablet(); + tabletSeat()->addTool(); + }); + + QRasterWindow window; + window.resize(64, 64); + window.show(); + QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial); + + QCOMPOSITOR_TRY_VERIFY(tablet()); + exec([&] { + auto *surface = xdgSurface()->m_surface; + auto *tool = tabletTool(); + tool->sendProximityIn(tablet(), surface); + tool->sendFrame(); + }); + + QTRY_COMPARE(filter.numEvents(), 1); + QTabletEvent *enterEvent = filter.popEvent(); + QCOMPARE(enterEvent->type(), QEvent::TabletEnterProximity); + + exec([&] { + auto *tool = tabletTool(); + tool->sendProximityOut(); + tool->sendFrame(); + }); + + QTRY_COMPARE(filter.numEvents(), 1); + QTabletEvent *leaveEvent = filter.popEvent(); + QCOMPARE(leaveEvent->type(), QEvent::TabletLeaveProximity); +} + +class TabletWindow : public QRasterWindow { + Q_OBJECT +public: + ~TabletWindow() override { qDeleteAll(m_events); } + + void tabletEvent(QTabletEvent *e) override + { + m_events << new QTabletEvent(e->type(), e->posF(), e->globalPosF(), e->device(), + e->pointerType(), e->pressure(), e->xTilt(), e->yTilt(), + e->tangentialPressure(), e->rotation(), e->z(), + Qt::KeyboardModifier::NoModifier, e->uniqueId(), e->button(), + e->buttons()); + emit tabletEventReceived(m_events.last()); + } + int nextEventIndex = 0; + int numEvents() const { return m_events.size() - nextEventIndex; } + QTabletEvent *popEvent() + { + auto *event = m_events.value(nextEventIndex, nullptr); + if (event) + ++nextEventIndex; + return event; + } + +signals: + void tabletEventReceived(QTabletEvent *event); + +private: + QVector m_events; +}; + +void tst_tabletv2::moveEvent() +{ + QCOMPOSITOR_TRY_VERIFY(tabletSeat()); + exec([&] { + tabletSeat()->addTablet(); + tabletSeat()->addTool(); + }); + + TabletWindow window; + window.resize(64, 64); + window.show(); + QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial); + + QCOMPOSITOR_TRY_VERIFY(tablet()); + exec([&] { + auto *surface = xdgSurface()->m_surface; + auto *tool = tabletTool(); + tool->sendProximityIn(tablet(), surface); + QMargins margins = window.frameMargins(); + tool->sendMotion(QPointF(12 + margins.left(), 34 + margins.top())); + tool->sendFrame(); + }); + QTRY_VERIFY(window.numEvents()); + QTabletEvent *event = window.popEvent(); + QCOMPARE(event->type(), QEvent::TabletMove); + QCOMPARE(event->pressure(), 0); + QCOMPARE(event->posF(), QPointF(12, 34)); +} + +void tst_tabletv2::pointerType_data() +{ + QTest::addColumn("toolType"); + QTest::addColumn("pointerType"); + QTest::addColumn("tabletDevice"); + + QTest::newRow("pen") << ToolType::type_pen << QTabletEvent::PointerType::Pen << QTabletEvent::TabletDevice::Stylus; + QTest::newRow("eraser") << ToolType::type_eraser << QTabletEvent::PointerType::Eraser << QTabletEvent::TabletDevice::Stylus; + QTest::newRow("pencil") << ToolType::type_pencil << QTabletEvent::PointerType::Pen << QTabletEvent::TabletDevice::Stylus; + QTest::newRow("airbrush") << ToolType::type_airbrush << QTabletEvent::PointerType::Pen << QTabletEvent::TabletDevice::Airbrush; + QTest::newRow("brush") << ToolType::type_brush << QTabletEvent::PointerType::Pen << QTabletEvent::TabletDevice::Stylus; // TODO: is TabletDevice::Stylus the right thing? + QTest::newRow("lens") << ToolType::type_lens << QTabletEvent::PointerType::Cursor << QTabletEvent::TabletDevice::Puck; + // TODO: also add tests for FourDMouse and RotationStylus (also need to send capabilities) + + // TODO: should these rather be mapped to touch/mouse events? + QTest::newRow("finger") << ToolType::type_finger << QTabletEvent::PointerType::UnknownPointer << QTabletEvent::TabletDevice::NoDevice; + QTest::newRow("mouse") << ToolType::type_mouse << QTabletEvent::PointerType::Cursor << QTabletEvent::TabletDevice::NoDevice; +} + +void tst_tabletv2::pointerType() +{ + using ToolType = QtWaylandServer::zwp_tablet_tool_v2::type; + QFETCH(ToolType, toolType); + QFETCH(QTabletEvent::PointerType, pointerType); + QFETCH(QTabletEvent::TabletDevice, tabletDevice); + + ProximityFilter filter; + + QCOMPOSITOR_TRY_VERIFY(tabletSeat()); + exec([&] { + tabletSeat()->addTablet(); + tabletSeat()->addTool(toolType); + }); + + TabletWindow window; + window.resize(64, 64); + window.show(); + QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial); + + QCOMPOSITOR_TRY_VERIFY(tablet()); + exec([&] { + auto *surface = xdgSurface()->m_surface; + auto *tool = tabletTool(); + tool->sendProximityIn(tablet(), surface); + QMargins margins = window.frameMargins(); + tool->sendMotion(QPointF(12 + margins.left(), 34 + margins.top())); + tool->sendFrame(); + }); + + QTRY_COMPARE(filter.numEvents(), 1); + QTabletEvent *event = filter.popEvent(); + QCOMPARE(event->pointerType(), pointerType); + QCOMPARE(event->device(), tabletDevice); + + QTRY_VERIFY(window.numEvents()); + event = window.popEvent(); + QCOMPARE(event->pointerType(), pointerType); + QCOMPARE(event->device(), tabletDevice); + + exec([&] { + tabletTool()->sendProximityOut(); + tabletTool()->sendFrame(); + }); + + QTRY_VERIFY(filter.numEvents()); + event = filter.popEvent(); + QCOMPARE(event->pointerType(), pointerType); + QCOMPARE(event->device(), tabletDevice); +} + +void tst_tabletv2::hardwareSerial() +{ + ProximityFilter filter; + const quint64 uid = 0xbaba15dead15f00d; + + QCOMPOSITOR_TRY_VERIFY(tabletSeat()); + exec([&] { + tabletSeat()->addTablet(); + tabletSeat()->addTool(ToolType::type_pen, uid); + }); + + TabletWindow window; + window.resize(64, 64); + window.show(); + QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial); + + QCOMPOSITOR_TRY_VERIFY(tablet()); + exec([&] { + auto *surface = xdgSurface()->m_surface; + auto *tool = tabletTool(); + tool->sendProximityIn(tablet(), surface); + QMargins margins = window.frameMargins(); + tool->sendMotion(QPointF(12 + margins.left(), 34 + margins.top())); + tool->sendFrame(); + }); + + QTRY_COMPARE(filter.numEvents(), 1); + QTabletEvent *event = filter.popEvent(); + QCOMPARE(event->uniqueId(), uid); + + QTRY_VERIFY(window.numEvents()); + event = window.popEvent(); + QCOMPARE(event->uniqueId(), uid); + + exec([&] { + tabletTool()->sendProximityOut(); + tabletTool()->sendFrame(); + }); + + QTRY_VERIFY(filter.numEvents()); + event = filter.popEvent(); + QCOMPARE(event->uniqueId(), uid); +} + +// As defined in linux/input-event-codes.h +#ifndef BTN_STYLUS +#define BTN_STYLUS 0x14b +#endif +#ifndef BTN_STYLUS2 +#define BTN_STYLUS2 0x14c +#endif + +void tst_tabletv2::buttons_data() +{ + QTest::addColumn("tabletButton"); + QTest::addColumn("mouseButton"); + + QTest::newRow("BTN_STYLUS2") << uint(BTN_STYLUS2) << Qt::MouseButton::RightButton; + QTest::newRow("BTN_STYLUS") << uint(BTN_STYLUS) << Qt::MouseButton::MiddleButton; +} + +void tst_tabletv2::buttons() +{ + QFETCH(uint, tabletButton); + QFETCH(Qt::MouseButton, mouseButton); + + QCOMPOSITOR_TRY_VERIFY(tabletSeat()); + exec([&] { + tabletSeat()->addTablet(); + tabletSeat()->addTool(); + }); + + TabletWindow window; + window.resize(64, 64); + window.show(); + QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial); + + QCOMPOSITOR_TRY_VERIFY(tablet()); + exec([&] { + tabletTool()->sendProximityIn(tablet(), xdgSurface()->m_surface); + QMargins margins = window.frameMargins(); + tabletTool()->sendMotion(QPointF(12 + margins.left(), 34 + margins.top())); + tabletTool()->sendFrame(); + }); + + QTRY_VERIFY(window.numEvents()); + window.popEvent(); + + QCOMPOSITOR_TRY_VERIFY(tablet()); + exec([&] { + tabletTool()->sendButton(tabletButton, true); + tabletTool()->sendFrame(); + tabletTool()->sendButton(tabletButton, false); + tabletTool()->sendFrame(); + }); + + QTRY_VERIFY(window.numEvents()); + QTabletEvent *event = window.popEvent(); + QCOMPARE(event->buttons(), mouseButton); + + exec([&] { + tabletTool()->sendProximityOut(); + tabletTool()->sendFrame(); + }); +} + +void tst_tabletv2::tabletEvents() +{ + QCOMPOSITOR_TRY_VERIFY(tabletSeat()); + exec([&] { + tabletSeat()->addTablet(); + tabletSeat()->addTool(); + }); + + TabletWindow window; + window.resize(64, 64); + window.show(); + QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial); + + const QPointF insideDecorations(window.frameMargins().left(), window.frameMargins().top()); + + QCOMPOSITOR_TRY_VERIFY(tablet()); + exec([&] { + auto *surface = xdgSurface()->m_surface; + auto *tool = tabletTool(); + // TODO: encapsulate this into a helper function? + tool->sendProximityIn(tablet(), surface); + tool->sendMotion(QPointF(12, 34) + insideDecorations); + tool->sendDown(); + tool->sendPressure(65535); + tool->sendFrame(); + }); + + QTRY_VERIFY(window.numEvents()); + QTabletEvent *event = window.popEvent(); + QCOMPARE(event->type(), QEvent::TabletPress); + QCOMPARE(event->pressure(), 1.0); + QCOMPARE(event->posF(), QPointF(12, 34)); + + // Values we didn't send should be 0 + QCOMPARE(event->rotation(), 0); + QCOMPARE(event->xTilt(), 0); + QCOMPARE(event->yTilt(), 0); + + exec([&] { + tabletTool()->sendMotion(QPointF(45, 56) + insideDecorations); + tabletTool()->sendPressure(65535/2); + tabletTool()->sendRotation(90); + tabletTool()->sendTilt(13, 37); + tabletTool()->sendFrame(); + }); + + QTRY_VERIFY(window.numEvents()); + event = window.popEvent(); + QCOMPARE(event->type(), QEvent::TabletMove); + QVERIFY(qAbs(event->pressure() - 0.5) < 0.01); + QVERIFY(qAbs(event->rotation() - 90) < 0.01); + QVERIFY(qAbs(event->xTilt() - 13) < 0.01); + QVERIFY(qAbs(event->yTilt() - 37) < 0.01); + QCOMPARE(event->posF(), QPointF(45, 56)); + + // Verify that the values stay the same if we don't update them + exec([&] { + tabletTool()->sendMotion(QPointF(10, 11) + insideDecorations); // Change position only + tabletTool()->sendFrame(); + }); + QTRY_VERIFY(window.numEvents()); + event = window.popEvent(); + QCOMPARE(event->type(), QEvent::TabletMove); + QVERIFY(qAbs(event->pressure() - 0.5) < 0.01); + QVERIFY(qAbs(event->rotation() - 90) < 0.01); + QVERIFY(qAbs(event->xTilt() - 13) < 0.01); + QVERIFY(qAbs(event->yTilt() - 37) < 0.01); + QCOMPARE(event->posF(), QPointF(10, 11)); + + exec([&] { + tabletTool()->sendPressure(0); + tabletTool()->sendUp(); + tabletTool()->sendFrame(); + + tabletTool()->sendProximityOut(); + tabletTool()->sendFrame(); + }); + + QTRY_VERIFY(window.numEvents()); + event = window.popEvent(); + QCOMPARE(event->type(), QEvent::TabletRelease); + QCOMPARE(event->pressure(), 0); + QCOMPARE(event->posF(), QPointF(10, 11)); +} + +QCOMPOSITOR_TEST_MAIN(tst_tabletv2) +#include "tst_tabletv2.moc" From f31330eeac41f0c8bf20ba7427c865d29ec03a65 Mon Sep 17 00:00:00 2001 From: Aleix Pol Date: Tue, 7 Jan 2020 19:29:28 +0100 Subject: [PATCH 0807/1507] Add a comment at the top explaining where the generated file comes from It's useful to have the source of the generated file on top when reaching it from the IDE. Also it is useful to explain that it's a generated file at all. [ChangeLog][qtwaylandscanner] Include a comment on top explaining what xml file is being represented. Change-Id: Ie0584295791f246b0e8c83e0afd3a521f6bdbb2e Reviewed-by: Johan Helsing --- src/tools/qtwaylandscanner/qtwaylandscanner.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp index 24977a2f234..05f00beee7b 100644 --- a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp +++ b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp @@ -467,6 +467,9 @@ bool Scanner::process() if (m_xml->hasError()) return false; + printf("// This file was generated by qtwaylandscanner\n"); + printf("// source file is %s\n\n", qPrintable(m_protocolFilePath)); + for (auto b : qAsConst(m_includes)) printf("#include %s\n", b.constData()); From ece34c57f821319c2c0d3c4af1a4247aebb31e14 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Wed, 8 Jan 2020 16:23:40 +0100 Subject: [PATCH 0808/1507] Update to latest release for xdg-shell-unstable-v6 These are just textual changes in the protocol, so shouldn't change anything except the comments in the generated code. Change-Id: I0c93f593a171b0af3c9a812c6a45c3b1416b42f6 Reviewed-by: David Edmundson Reviewed-by: Pier Luigi Fiorini --- src/3rdparty/wayland/protocols/xdg-shell-unstable-v6.xml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/3rdparty/wayland/protocols/xdg-shell-unstable-v6.xml b/src/3rdparty/wayland/protocols/xdg-shell-unstable-v6.xml index e49d74fccd8..1c0f92452b9 100644 --- a/src/3rdparty/wayland/protocols/xdg-shell-unstable-v6.xml +++ b/src/3rdparty/wayland/protocols/xdg-shell-unstable-v6.xml @@ -118,7 +118,9 @@ child surface relative to a parent surface. Rules can be defined to ensure the child surface remains within the visible area's borders, and to specify how the child surface changes its position, such as sliding along - an axis, or flipping around a rectangle. + an axis, or flipping around a rectangle. These positioner-created rules are + constrained by the requirement that a child surface must intersect with or + be at least partially adjacent to its parent surface. See the various requests for details about possible rules. @@ -941,7 +943,8 @@ The x and y arguments passed when creating the popup object specify where the top left of the popup should be placed, relative to the local surface coordinates of the parent surface. See - xdg_surface.get_popup. + xdg_surface.get_popup. An xdg_popup must intersect with or be at least + partially adjacent to its parent surface. The client must call wl_surface.commit on the corresponding wl_surface for the xdg_popup state to take effect. From 03414a616b0acecdeb28799331dbc6bf7be1ac77 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Thu, 9 Jan 2020 09:32:41 +0100 Subject: [PATCH 0809/1507] Update protocol for xdg-shell stable to version 2 This is just the protocol, it doesn't implement any new interfaces or behavior. Also update the project url, xdg-shell is now part of wayland-protocols, not Weston. Change-Id: I719cc99fc2c59af9abfc0c9abcb9c1daf9b43c74 Reviewed-by: David Edmundson Reviewed-by: Pier Luigi Fiorini --- .../wayland/protocols/qt_attribution.json | 11 ++- src/3rdparty/wayland/protocols/xdg-shell.xml | 91 ++++++++++++------- 2 files changed, 66 insertions(+), 36 deletions(-) diff --git a/src/3rdparty/wayland/protocols/qt_attribution.json b/src/3rdparty/wayland/protocols/qt_attribution.json index dad8c42565b..615b02406d9 100644 --- a/src/3rdparty/wayland/protocols/qt_attribution.json +++ b/src/3rdparty/wayland/protocols/qt_attribution.json @@ -166,16 +166,19 @@ Copyright 2015-2016 © Red Hat, Inc." "Files": " xdg-shell-unstable-v5.xml xdg-shell-unstable-v6.xml xdg-shell.xml ../../compositor/extensions/pregenerated/3rdparty/qwayland-server-xdg-shell-unstable-v5.cpp ../../compositor/extensions/pregenerated/3rdparty/qwayland-server-xdg-shell-unstable-v5_p.h ../../compositor/extensions/pregenerated/3rdparty/wayland-xdg-shell-unstable-v5-protocol.c ../../compositor/extensions/pregenerated/3rdparty/wayland-xdg-shell-unstable-v5-server-protocol_p.h ../../plugins/shellintegration/xdg-shell-v5/pregenerated/3rdparty/qwayland-xdg-shell-unstable-v5.cpp ../../plugins/shellintegration/xdg-shell-v5/pregenerated/3rdparty/qwayland-xdg-shell-unstable-v5_p.h ../../plugins/shellintegration/xdg-shell-v5/pregenerated/3rdparty/wayland-xdg-shell-unstable-v5-client-protocol_p.h ../../plugins/shellintegration/xdg-shell-v5/pregenerated/3rdparty/wayland-xdg-shell-unstable-v5-protocol.c", "Description": "The XDG-Shell protocol is an extended way to manage surfaces under Wayland compositors.", - "Homepage": "https://wayland.freedesktop.org", - "Version": "1.9.0", - "DownloadLocation": "https://cgit.freedesktop.org/wayland/weston/tag/?id=1.9.0", + "Homepage": "https://gitlab.freedesktop.org/wayland/wayland-protocols/", + "Version": "1.18", + "DownloadLocation": "https://gitlab.freedesktop.org/wayland/wayland-protocols/tree/1.18/", "LicenseId": "MIT", "License": "MIT License", "LicenseFile": "MIT_LICENSE.txt", "Copyright": "Copyright © 2008-2013 Kristian Høgsberg Copyright © 2013 Rafael Antognolli Copyright © 2013 Jasper St. Pierre -Copyright © 2010-2013 Intel Corporation" +Copyright © 2010-2013 Intel Corporation +Copyright © 2015-2017 Samsung Electronics Co., Ltd +Copyright © 2015-2017 Red Hat Inc. +" }, { diff --git a/src/3rdparty/wayland/protocols/xdg-shell.xml b/src/3rdparty/wayland/protocols/xdg-shell.xml index d524ea9e270..3a87a9ed6ed 100644 --- a/src/3rdparty/wayland/protocols/xdg-shell.xml +++ b/src/3rdparty/wayland/protocols/xdg-shell.xml @@ -29,7 +29,7 @@ DEALINGS IN THE SOFTWARE. - + The xdg_wm_base interface is exposed as a global object enabling clients to turn their wl_surfaces into windows in a desktop environment. It @@ -101,7 +101,7 @@ The ping event asks the client if it's still alive. Pass the serial specified in the event back to the compositor by sending - a "pong" request back with the specified serial. See xdg_wm_base.ping. + a "pong" request back with the specified serial. See xdg_wm_base.pong. Compositors can use this to determine if the client is still alive. It's unspecified what will happen if the client doesn't @@ -115,7 +115,7 @@ - + The xdg_positioner provides a collection of rules for the placement of a child surface relative to a parent surface. Rules can be defined to ensure @@ -359,7 +359,7 @@ - + An interface that may be implemented by a wl_surface, for implementations that provide a desktop-style user interface. @@ -528,7 +528,7 @@ - + This interface defines an xdg_surface role which allows a surface to, among other things, set window-like properties such as maximize, @@ -604,6 +604,9 @@ For example, "org.freedesktop.FooViewer" where the .desktop file is "org.freedesktop.FooViewer.desktop". + Like other properties, a set_app_id request can be sent after the + xdg_toplevel has been mapped to update the property. + See the desktop-entry specification [0] for more details on application identifiers and how they relate to well-known D-Bus names and .desktop files. @@ -724,6 +727,9 @@ The surface is maximized. The window geometry specified in the configure event must be obeyed by the client. + + The client should draw without shadow or other + decoration outside of the window geometry.
@@ -750,6 +756,30 @@ keyboard or pointer focus. + + + The window is currently in a tiled layout and the left edge is + considered to be adjacent to another part of the tiling grid. + + + + + The window is currently in a tiled layout and the right edge is + considered to be adjacent to another part of the tiling grid. + + + + + The window is currently in a tiled layout and the top edge is + considered to be adjacent to another part of the tiling grid. + + + + + The window is currently in a tiled layout and the bottom edge is + considered to be adjacent to another part of the tiling grid. + + @@ -839,12 +869,11 @@ Maximize the surface. After requesting that the surface should be maximized, the compositor - will respond by emitting a configure event with the "maximized" state - and the required window geometry. The client should then update its - content, drawing it in a maximized state, i.e. without shadow or other - decoration outside of the window geometry. The client must also - acknowledge the configure when committing the new content (see - ack_configure). + will respond by emitting a configure event. Whether this configure + actually sets the window maximized is subject to compositor policies. + The client must then update its content, drawing in the configured + state. The client must also acknowledge the configure when committing + the new content (see ack_configure). It is up to the compositor to decide how and where to maximize the surface, for example which output and what region of the screen should @@ -854,8 +883,8 @@ a configure event with the "maximized" state. If the surface is in a fullscreen state, this request has no direct - effect. It will alter the state the surface is returned to when - unmaximized if not overridden by the compositor. + effect. It may alter the state the surface is returned to when + unmaximized unless overridden by the compositor. @@ -864,13 +893,13 @@ Unmaximize the surface. After requesting that the surface should be unmaximized, the compositor - will respond by emitting a configure event without the "maximized" - state. If available, the compositor will include the window geometry - dimensions the window had prior to being maximized in the configure - event. The client must then update its content, drawing it in a - regular state, i.e. potentially with shadow, etc. The client must also - acknowledge the configure when committing the new content (see - ack_configure). + will respond by emitting a configure event. Whether this actually + un-maximizes the window is subject to compositor policies. + If available and applicable, the compositor will include the window + geometry dimensions the window had prior to being maximized in the + configure event. The client must then update its content, drawing it in + the configured state. The client must also acknowledge the configure + when committing the new content (see ack_configure). It is up to the compositor to position the surface after it was unmaximized; usually the position the surface had before maximizing, if @@ -880,8 +909,8 @@ emit a configure event without the "maximized" state. If the surface is in a fullscreen state, this request has no direct - effect. It will alter the state the surface is returned to when - unmaximized if not overridden by the compositor. + effect. It may alter the state the surface is returned to when + unmaximized unless overridden by the compositor. @@ -890,10 +919,10 @@ Make the surface fullscreen. After requesting that the surface should be fullscreened, the - compositor will respond by emitting a configure event with the - "fullscreen" state and the fullscreen window geometry. The client must - also acknowledge the configure when committing the new content (see - ack_configure). + compositor will respond by emitting a configure event. Whether the + client is actually put into a fullscreen state is subject to compositor + policies. The client must also acknowledge the configure when + committing the new content (see ack_configure). The output passed by the request indicates the client's preference as to which display it should be set fullscreen on. If this value is NULL, @@ -919,8 +948,9 @@ Make the surface no longer fullscreen. After requesting that the surface should be unfullscreened, the - compositor will respond by emitting a configure event without the - "fullscreen" state. + compositor will respond by emitting a configure event. + Whether this actually removes the fullscreen state of the client is + subject to compositor policies. Making a surface unfullscreen sets states for the surface based on the following: * the state(s) it may have had before becoming fullscreen @@ -989,7 +1019,7 @@ - + A popup surface is a short-lived, temporary surface. It can be used to implement for example menus, popovers, tooltips and other similar user @@ -1007,9 +1037,6 @@ surface of their own is clicked should dismiss the popup using the destroy request. - The parent surface must have either the xdg_toplevel or xdg_popup surface - role. - A newly created xdg_popup will be stacked on top of all previously created xdg_popup surfaces associated with the same xdg_toplevel. From 7c181d3733b35d296a2243b38f4f6c6d9730ab12 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Thu, 9 Jan 2020 09:47:09 +0100 Subject: [PATCH 0810/1507] Update protocol for linux-dmabuf-unstable-v1 Just updates the text of the protocol, no new functionality. Change-Id: I08a09b2a3d37f61fc28967fbb1306f35a2921f0a Reviewed-by: David Edmundson Reviewed-by: Pier Luigi Fiorini --- .../protocols/linux-dmabuf-unstable-v1.xml | 16 +++++++++++++++- .../wayland/protocols/qt_attribution.json | 2 ++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/3rdparty/wayland/protocols/linux-dmabuf-unstable-v1.xml b/src/3rdparty/wayland/protocols/linux-dmabuf-unstable-v1.xml index 154afe23e1b..b43e81ca0bc 100644 --- a/src/3rdparty/wayland/protocols/linux-dmabuf-unstable-v1.xml +++ b/src/3rdparty/wayland/protocols/linux-dmabuf-unstable-v1.xml @@ -28,6 +28,7 @@ Following the interfaces from: https://www.khronos.org/registry/egl/extensions/EXT/EGL_EXT_image_dma_buf_import.txt + https://www.khronos.org/registry/EGL/extensions/EXT/EGL_EXT_image_dma_buf_import_modifiers.txt and the Linux DRM sub-system's AddFb2 ioctl. This interface offers ways to create generic dmabuf-based @@ -129,8 +130,16 @@ binds to this interface. A roundtrip after binding guarantees that the client has received all supported format-modifier pairs. + For legacy support, DRM_FORMAT_MOD_INVALID (that is, modifier_hi == + 0x00ffffff and modifier_lo == 0xffffffff) is allowed in this event. + It indicates that the server can support the format with an implicit + modifier. When a plane has DRM_FORMAT_MOD_INVALID as its modifier, it + is as if no explicit modifier is specified. The effective modifier + will be derived from the dmabuf. + For the definition of the format and modifier codes, see the - zwp_linux_buffer_params_v1::create request. + zwp_linux_buffer_params_v1::create and zwp_linux_buffer_params_v1::add + requests. Date: Thu, 9 Jan 2020 09:56:12 +0100 Subject: [PATCH 0811/1507] Fix various issues in qt_attribution.json freedesktop.org is moving over to GitLab, so let's update the urls. Some entries were also missing a DownloadLocation, or didn't link to a single version (which they're supposed to according to the documentation). So fixed those as well. Also, a couple of spelling fixes. Change-Id: I37f5365368bc0d97420488c6d62b25adc26590f5 Reviewed-by: David Edmundson Reviewed-by: Pier Luigi Fiorini --- .../wayland/protocols/qt_attribution.json | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/3rdparty/wayland/protocols/qt_attribution.json b/src/3rdparty/wayland/protocols/qt_attribution.json index 32bf7f91dc7..afbcbc27d9d 100644 --- a/src/3rdparty/wayland/protocols/qt_attribution.json +++ b/src/3rdparty/wayland/protocols/qt_attribution.json @@ -9,7 +9,7 @@ "Description": "A Wayland shell for displaying a single surface per output", "Homepage": "https://wayland.freedesktop.org", "Version": "unstable v1", - "DownloadLocation": "https://cgit.freedesktop.org/wayland/wayland-protocols", + "DownloadLocation": "https://gitlab.freedesktop.org/wayland/wayland-protocols/raw/1.18/unstable/fullscreen-shell/fullscreen-shell-unstable-v1.xml", "LicenseId": "MIT", "License": "MIT License", "LicenseFile": "MIT_LICENSE.txt", @@ -65,11 +65,11 @@ Copyright (c) 2013 BMW Car IT GmbH" "Description": "The primary selection extension allows copying text by selecting it and pasting it with the middle mouse button.", "Homepage": "https://wayland.freedesktop.org", "Version": "1", - "DownloadLocation": "https://cgit.freedesktop.org/wayland/wayland-protocols/plain/unstable/primary-selection/primary-selection-unstable-v1.xml", + "DownloadLocation": "https://gitlab.freedesktop.org/wayland/wayland-protocols/raw/1.18/unstable/primary-selection/primary-selection-unstable-v1.xml", "LicenseId": "MIT", "License": "MIT License", "LicenseFile": "MIT_LICENSE.txt", - "Copyright": "Copyright © 2015 2016 Red Hat" + "Copyright": "Copyright © 2015, 2016 Red Hat" }, { @@ -82,7 +82,7 @@ Copyright (c) 2013 BMW Car IT GmbH" "Description": "The Wayland scaler extension allows a client to scale or crop a surface without modifying the buffer", "Homepage": "https://wayland.freedesktop.org", "Version": "2", - "DownloadLocation": "https://cgit.freedesktop.org/wayland/weston/plain/protocol/scaler.xml?h=1.11.1", + "DownloadLocation": "https://gitlab.freedesktop.org/wayland/weston/raw/1.11/protocol/scaler.xml", "LicenseId": "MIT", "License": "MIT License", "LicenseFile": "MIT_LICENSE.txt", @@ -117,7 +117,7 @@ Copyright 2015-2016 © Red Hat, Inc." "Description": "The Wayland viewporter extension allows a client to scale or crop a surface without modifying the buffer", "Homepage": "https://wayland.freedesktop.org", "Version": "1", - "DownloadLocation": "https://cgit.freedesktop.org/wayland/wayland-protocols/plain/stable/viewporter/viewporter.xml", + "DownloadLocation": "https://gitlab.freedesktop.org/wayland/wayland-protocols/raw/1.18/stable/viewporter/viewporter.xml", "LicenseId": "MIT", "License": "MIT License", "LicenseFile": "MIT_LICENSE.txt", @@ -134,7 +134,7 @@ Copyright 2015-2016 © Red Hat, Inc." "Description": "The xdg-decoration protocol allows a compositor to announce support for server-side decorations.", "Homepage": "https://wayland.freedesktop.org", "Version": "unstable v1, version 1", - "DownloadLocation": "https://cgit.freedesktop.org/wayland/wayland-protocols/plain/unstable/xdg-decoration/xdg-decoration-unstable-v1.xml?h=1.16", + "DownloadLocation": "https://gitlab.freedesktop.org/wayland/wayland-protocols/raw/1.18/unstable/xdg-decoration/xdg-decoration-unstable-v1.xml", "LicenseId": "MIT", "License": "MIT License", "LicenseFile": "MIT_LICENSE.txt", @@ -151,7 +151,7 @@ Copyright 2015-2016 © Red Hat, Inc." "Description": "The XDG Output protocol is an extended way to describe output regions under Wayland", "Homepage": "https://wayland.freedesktop.org", "Version": "unstable v1, version 2", - "DownloadLocation": "https://cgit.freedesktop.org/wayland/wayland-protocols/plain/unstable/xdg-output/xdg-output-unstable-v1.xml?h=1.16", + "DownloadLocation": "https://gitlab.freedesktop.org/wayland/wayland-protocols/raw/1.17/unstable/xdg-output/xdg-output-unstable-v1.xml", "LicenseId": "MIT", "License": "MIT License", "LicenseFile": "MIT_LICENSE.txt", @@ -182,7 +182,7 @@ Copyright © 2015-2017 Red Hat Inc. }, { - "Id": "wayland-txt-input-unstable", + "Id": "wayland-text-input-unstable", "Name": "Wayland Text Input Protocol", "QDocModule": "qtwaylandcompositor", "QtUsage": "Used in the Qt Wayland Compositor, and the Qt Wayland platform plugin.", @@ -190,6 +190,7 @@ Copyright © 2015-2017 Red Hat Inc. "Description": "Adds support for text input and input methods to applications.", "Homepage": "https://wayland.freedesktop.org", + "Version": "unstable v2", "LicenseId": "HPND", "License": "HPND License", "LicenseFile": "HPND_LICENSE.txt", @@ -223,6 +224,8 @@ Copyright © 2015, 2016 Jan Arne Petersen" "Description": "Allows clients to request that the compositor creates its EGLStream.", "Homepage": "https://github.com/NVIDIA/egl-wayland", + "Version": "1.1.1", + "DownloadLocation": "https://raw.githubusercontent.com/NVIDIA/egl-wayland/1.1.1/wayland-eglstream/wayland-eglstream-controller.xml", "LicenseId": "MIT", "License": "MIT License", "LicenseFile": "MIT_LICENSE.txt", From 174a93750a3f3bbce22a7a4c69a66686649fd15d Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Thu, 9 Jan 2020 10:08:23 +0100 Subject: [PATCH 0812/1507] Update protocol for xdg-output-unstable-v1 Change-Id: I7d7a2fdbd1f44469b90c467c9490448c13025fa5 Reviewed-by: Pier Luigi Fiorini --- .../wayland/protocols/qt_attribution.json | 4 ++-- .../protocols/xdg-output-unstable-v1.xml | 21 ++++++++++++++----- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/src/3rdparty/wayland/protocols/qt_attribution.json b/src/3rdparty/wayland/protocols/qt_attribution.json index afbcbc27d9d..ddda0e9716c 100644 --- a/src/3rdparty/wayland/protocols/qt_attribution.json +++ b/src/3rdparty/wayland/protocols/qt_attribution.json @@ -150,8 +150,8 @@ Copyright 2015-2016 © Red Hat, Inc." "Description": "The XDG Output protocol is an extended way to describe output regions under Wayland", "Homepage": "https://wayland.freedesktop.org", - "Version": "unstable v1, version 2", - "DownloadLocation": "https://gitlab.freedesktop.org/wayland/wayland-protocols/raw/1.17/unstable/xdg-output/xdg-output-unstable-v1.xml", + "Version": "unstable v1, version 3", + "DownloadLocation": "https://gitlab.freedesktop.org/wayland/wayland-protocols/raw/1.18/unstable/xdg-output/xdg-output-unstable-v1.xml", "LicenseId": "MIT", "License": "MIT License", "LicenseFile": "MIT_LICENSE.txt", diff --git a/src/3rdparty/wayland/protocols/xdg-output-unstable-v1.xml b/src/3rdparty/wayland/protocols/xdg-output-unstable-v1.xml index ccbfe1c9a95..fe3a70aab0d 100644 --- a/src/3rdparty/wayland/protocols/xdg-output-unstable-v1.xml +++ b/src/3rdparty/wayland/protocols/xdg-output-unstable-v1.xml @@ -54,7 +54,7 @@ reset. - + A global factory interface for xdg_output objects. @@ -77,12 +77,17 @@ - + An xdg_output describes part of the compositor geometry. This typically corresponds to a monitor that displays part of the compositor space. + + For objects version 3 onwards, after all xdg_output properties have been + sent (when the object is created and when properties are updated), a + wl_output.done event is sent. This allows changes to the output + properties to be seen as atomic, even if they happen via multiple events. @@ -157,6 +162,10 @@ This allows changes to the xdg_output properties to be seen as atomic, even if they happen via multiple events. + + For objects version 3 onwards, this event is deprecated. Compositors + are not required to send it anymore and must send wl_output.done + instead. @@ -197,10 +206,12 @@ output via :1'. The description event is sent after creating an xdg_output (see - xdg_output_manager.get_xdg_output). This event is only sent once per + xdg_output_manager.get_xdg_output) and whenever the description + changes. The description is optional, and may not be sent at all. + + For objects of version 2 and lower, this event is only sent once per xdg_output, and the description does not change over the lifetime of - the wl_output global. The description is optional, and may not be sent - at all. + the wl_output global. From 98e42661d5cc6f3d679dd554e743f916a8da9115 Mon Sep 17 00:00:00 2001 From: Jarek Kobus Date: Fri, 10 Jan 2020 13:02:17 +0100 Subject: [PATCH 0813/1507] Don't use deprecated QMatrix class anymore Task-number: QTBUG-46653 Change-Id: I038a370ca8af642605709fa5ffdb1c619c60433b Reviewed-by: Johan Helsing --- src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp b/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp index 8d5b977d586..dc7ff67086f 100644 --- a/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp +++ b/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp @@ -47,6 +47,7 @@ #include #include #include +#include #include #include @@ -328,7 +329,7 @@ void QWaylandShmBackingStore::updateDecorations() qreal dp = sourceImage.devicePixelRatio(); int dpWidth = int(sourceImage.width() / dp); int dpHeight = int(sourceImage.height() / dp); - QMatrix sourceMatrix; + QTransform sourceMatrix; sourceMatrix.scale(dp, dp); QRect target; // needs to be in device independent pixels From 84549ae23d959a8aad48cfd1ceda7d2e5136fd0f Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Thu, 9 Jan 2020 12:26:21 +0100 Subject: [PATCH 0814/1507] Client: Upgrade to xdg-output-unstable-v1 version 3 [ChangeLog][QPA plugin] xdg-output-unstable-v1 version 3 is now supported. Change-Id: I054b2946e86175eabe76731bac94e5f287c4ee58 Reviewed-by: Paul Olav Tvete --- .../platforms/wayland/qwaylanddisplay.cpp | 2 +- .../platforms/wayland/qwaylanddisplay_p.h | 6 +++--- .../platforms/wayland/qwaylandscreen.cpp | 20 ++++++++++++++++--- .../platforms/wayland/qwaylandscreen_p.h | 10 +++++++++- 4 files changed, 30 insertions(+), 8 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index ffcc72ff92d..37cb0e9bc41 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -351,7 +351,7 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin forceRoundTrip(); } } else if (interface == QLatin1String("zxdg_output_manager_v1")) { - mXdgOutputManager.reset(new QtWayland::zxdg_output_manager_v1(registry, id, qMin(2, int(version)))); + mXdgOutputManager.reset(new QWaylandXdgOutputManagerV1(this, id, version)); for (auto *screen : qAsConst(mWaitingScreens)) screen->initXdgOutput(xdgOutputManager()); forceRoundTrip(); diff --git a/src/plugins/platforms/wayland/qwaylanddisplay_p.h b/src/plugins/platforms/wayland/qwaylanddisplay_p.h index e99ec198395..a52c89fe9c7 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay_p.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay_p.h @@ -81,7 +81,6 @@ class QPlatformPlaceholderScreen; namespace QtWayland { class qt_surface_extension; class zwp_text_input_manager_v2; - class zxdg_output_manager_v1; } namespace QtWaylandClient { @@ -91,6 +90,7 @@ Q_WAYLAND_CLIENT_EXPORT Q_DECLARE_LOGGING_CATEGORY(lcQpaWayland); class QWaylandInputDevice; class QWaylandBuffer; class QWaylandScreen; +class QWaylandXdgOutputManagerV1; class QWaylandClientBufferIntegration; class QWaylandWindowManagerIntegration; class QWaylandDataDeviceManager; @@ -165,7 +165,7 @@ public: QWaylandTouchExtension *touchExtension() const { return mTouchExtension.data(); } QtWayland::zwp_text_input_manager_v2 *textInputManager() const { return mTextInputManager.data(); } QWaylandHardwareIntegration *hardwareIntegration() const { return mHardwareIntegration.data(); } - QtWayland::zxdg_output_manager_v1 *xdgOutputManager() const { return mXdgOutputManager.data(); } + QWaylandXdgOutputManagerV1 *xdgOutputManager() const { return mXdgOutputManager.data(); } bool usingInputContextFromCompositor() const { return mUsingInputContextFromCompositor; } @@ -255,7 +255,7 @@ private: #endif QScopedPointer mTextInputManager; QScopedPointer mHardwareIntegration; - QScopedPointer mXdgOutputManager; + QScopedPointer mXdgOutputManager; QSocketNotifier *mReadNotifier = nullptr; int mFd = -1; int mWritableNotificationFd = -1; diff --git a/src/plugins/platforms/wayland/qwaylandscreen.cpp b/src/plugins/platforms/wayland/qwaylandscreen.cpp index 4f0cd9b0a60..6cb337de388 100644 --- a/src/plugins/platforms/wayland/qwaylandscreen.cpp +++ b/src/plugins/platforms/wayland/qwaylandscreen.cpp @@ -53,6 +53,12 @@ QT_BEGIN_NAMESPACE namespace QtWaylandClient { +QWaylandXdgOutputManagerV1::QWaylandXdgOutputManagerV1(QWaylandDisplay* display, uint id, uint version) + : QtWayland::zxdg_output_manager_v1(display->wl_registry(), id, qMin(3u, version)) + , m_version(qMin(3u, version)) +{ +} + QWaylandScreen::QWaylandScreen(QWaylandDisplay *waylandDisplay, int version, uint32_t id) : QtWayland::wl_output(waylandDisplay->wl_registry(), id, qMin(version, 2)) , m_outputId(id) @@ -95,7 +101,7 @@ void QWaylandScreen::maybeInitialize() updateXdgOutputProperties(); } -void QWaylandScreen::initXdgOutput(QtWayland::zxdg_output_manager_v1 *xdgOutputManager) +void QWaylandScreen::initXdgOutput(QWaylandXdgOutputManagerV1 *xdgOutputManager) { Q_ASSERT(xdgOutputManager); if (zxdg_output_v1::isInitialized()) @@ -271,10 +277,15 @@ void QWaylandScreen::output_scale(int32_t factor) void QWaylandScreen::output_done() { mOutputDone = true; - if (mInitialized) + if (zxdg_output_v1::isInitialized() && mWaylandDisplay->xdgOutputManager()->version() >= 3) + mXdgOutputDone = true; + if (mInitialized) { updateOutputProperties(); - else + if (zxdg_output_v1::isInitialized()) + updateXdgOutputProperties(); + } else { maybeInitialize(); + } } void QWaylandScreen::updateOutputProperties() @@ -325,6 +336,9 @@ void QWaylandScreen::zxdg_output_v1_logical_size(int32_t width, int32_t height) void QWaylandScreen::zxdg_output_v1_done() { + if (Q_UNLIKELY(mWaylandDisplay->xdgOutputManager()->version() >= 3)) + qWarning(lcQpaWayland) << "zxdg_output_v1.done received on version 3 or newer, this is most likely a bug in the compositor"; + mXdgOutputDone = true; if (mInitialized) updateXdgOutputProperties(); diff --git a/src/plugins/platforms/wayland/qwaylandscreen_p.h b/src/plugins/platforms/wayland/qwaylandscreen_p.h index ae91c621111..df1c94f248e 100644 --- a/src/plugins/platforms/wayland/qwaylandscreen_p.h +++ b/src/plugins/platforms/wayland/qwaylandscreen_p.h @@ -64,6 +64,14 @@ namespace QtWaylandClient { class QWaylandDisplay; class QWaylandCursor; +class Q_WAYLAND_CLIENT_EXPORT QWaylandXdgOutputManagerV1 : public QtWayland::zxdg_output_manager_v1 { +public: + QWaylandXdgOutputManagerV1(QWaylandDisplay *display, uint id, uint version); + uint version() const { return m_version; } +private: + uint m_version = 1; // TODO: remove when we upgrade minimum libwayland requriement to 1.10 +}; + class Q_WAYLAND_CLIENT_EXPORT QWaylandScreen : public QPlatformScreen, QtWayland::wl_output, QtWayland::zxdg_output_v1 { public: @@ -72,7 +80,7 @@ public: void maybeInitialize(); - void initXdgOutput(QtWayland::zxdg_output_manager_v1 *xdgOutputManager); + void initXdgOutput(QWaylandXdgOutputManagerV1 *xdgOutputManager); QWaylandDisplay *display() const; From d1d0e2d6b03e12f725fdf2f55e0bdabab6775bb2 Mon Sep 17 00:00:00 2001 From: James McDonnell Date: Thu, 5 Dec 2019 12:12:37 -0500 Subject: [PATCH 0815/1507] Enable QtWayland for QNX Make EGL 1.5 with EGL_PLATFORM_WAYLAND_EXT a requirement for QNX and add some EGL 1.5 code alternatives. Avoids the need to deal with incompatibility problems between the QNX native display/window type and Wayland display/window type. Change-Id: Ib26a020e1f8c7f570c6af08697d8c8153c887294 Reviewed-by: Paul Olav Tvete Reviewed-by: Johan Helsing Reviewed-by: Dan Cape --- src/plugins/platforms/wayland/configure.json | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/wayland/configure.json b/src/plugins/platforms/wayland/configure.json index 7d446824062..9b8b4345741 100644 --- a/src/plugins/platforms/wayland/configure.json +++ b/src/plugins/platforms/wayland/configure.json @@ -168,6 +168,21 @@ "return 0;" ] } + }, + "egl_1_5-wayland": { + "label": "EGL 1.5 with Wayland Platform", + "type": "compile", + "test": { + "include": [ + "EGL/egl.h", + "EGL/eglext.h", + "wayland-client.h" + ], + "main": [ + "eglGetPlatformDisplay(EGL_PLATFORM_WAYLAND_EXT, (struct wl_display *)(nullptr), nullptr);" + ] + }, + "use": "egl" } }, @@ -218,7 +233,7 @@ }, "wayland-egl": { "label": "EGL", - "condition": "features.wayland-client && features.opengl && features.egl && libs.wayland-egl", + "condition": "features.wayland-client && features.opengl && features.egl && libs.wayland-egl && (!config.qnx || tests.egl_1_5-wayland)", "output": [ "privateFeature" ] }, "wayland-brcm": { @@ -238,7 +253,7 @@ }, "wayland-drm-egl-server-buffer": { "label": "DRM EGL", - "condition": "features.wayland-client && features.opengl && features.egl && tests.drm-egl-server", + "condition": "features.wayland-client && features.opengl && features.egl && tests.drm-egl-server && (!config.qnx || tests.egl_1_5-wayland)", "output": [ "privateFeature" ] }, "wayland-libhybris-egl-server-buffer": { From 3a6859e80818395de5d24b13ce56b3f3a8049164 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Wed, 22 Jan 2020 12:39:59 +0100 Subject: [PATCH 0816/1507] Fix build: Add dependency on OpenGL module Several of the QOpenGL* classes we depend on has moved to QtOpenGL, add the dependency and fix the include paths. Task-number: QTBUG-74409 Change-Id: Iab7949dd67befaa71cf2cfa041771e93f4e47160 Reviewed-by: Johan Helsing Reviewed-by: Simon Hausmann --- .../hardwareintegration/dmabuf-server/dmabuf-server.pro | 2 +- .../hardwareintegration/drm-egl-server/drm-egl-server.pro | 2 +- .../shm-emulation-server/shm-emulation-server.pro | 2 +- .../hardwareintegration/vulkan-server/vulkan-server.pro | 2 +- tests/auto/wayland/datadevicev1/tst_datadevicev1.cpp | 2 +- .../wayland/primaryselectionv1/tst_primaryselectionv1.cpp | 2 +- tests/auto/wayland/seatv4/tst_seatv4.cpp | 2 +- tests/auto/wayland/seatv5/tst_seatv5.cpp | 8 ++++---- tests/auto/wayland/shared/shared.pri | 2 +- tests/auto/wayland/shared_old/shared_old.pri | 2 +- tests/auto/wayland/surface/tst_surface.cpp | 2 +- .../auto/wayland/xdgdecorationv1/tst_xdgdecorationv1.cpp | 2 +- tests/auto/wayland/xdgoutput/tst_xdgoutput.cpp | 2 +- tests/auto/wayland/xdgshell/tst_xdgshell.cpp | 2 +- 14 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/dmabuf-server/dmabuf-server.pro b/src/plugins/platforms/wayland/plugins/hardwareintegration/dmabuf-server/dmabuf-server.pro index 5925c8b04f1..3c91b2ecf0a 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/dmabuf-server/dmabuf-server.pro +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/dmabuf-server/dmabuf-server.pro @@ -1,7 +1,7 @@ # We have a bunch of C code with casts, so we can't have this option QMAKE_CXXFLAGS_WARN_ON -= -Wcast-qual -QT += waylandclient-private +QT += waylandclient-private opengl include(../../../../hardwareintegration/client/dmabuf-server/dmabuf-server.pri) diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/drm-egl-server/drm-egl-server.pro b/src/plugins/platforms/wayland/plugins/hardwareintegration/drm-egl-server/drm-egl-server.pro index 2fba5bd1fdf..390278b1c7d 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/drm-egl-server/drm-egl-server.pro +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/drm-egl-server/drm-egl-server.pro @@ -1,7 +1,7 @@ # We have a bunch of C code with casts, so we can't have this option QMAKE_CXXFLAGS_WARN_ON -= -Wcast-qual -QT += waylandclient-private +QT += waylandclient-private opengl include(../../../../hardwareintegration/client/drm-egl-server/drm-egl-server.pri) diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/shm-emulation-server/shm-emulation-server.pro b/src/plugins/platforms/wayland/plugins/hardwareintegration/shm-emulation-server/shm-emulation-server.pro index 8b1c6e5f2da..9e9319d2535 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/shm-emulation-server/shm-emulation-server.pro +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/shm-emulation-server/shm-emulation-server.pro @@ -1,7 +1,7 @@ # We have a bunch of C code with casts, so we can't have this option QMAKE_CXXFLAGS_WARN_ON -= -Wcast-qual -QT += waylandclient-private +QT += waylandclient-private opengl include(../../../../hardwareintegration/client/shm-emulation-server/shm-emulation-server.pri) diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/vulkan-server/vulkan-server.pro b/src/plugins/platforms/wayland/plugins/hardwareintegration/vulkan-server/vulkan-server.pro index 1be60f7c10f..13cb2ab90e6 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/vulkan-server/vulkan-server.pro +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/vulkan-server/vulkan-server.pro @@ -1,7 +1,7 @@ # We have a bunch of C code with casts, so we can't have this option QMAKE_CXXFLAGS_WARN_ON -= -Wcast-qual -QT += waylandclient-private +QT += waylandclient-private opengl include(../../../../hardwareintegration/client/vulkan-server/vulkan-server.pri) diff --git a/tests/auto/wayland/datadevicev1/tst_datadevicev1.cpp b/tests/auto/wayland/datadevicev1/tst_datadevicev1.cpp index 1568b3b9680..91a479e28d3 100644 --- a/tests/auto/wayland/datadevicev1/tst_datadevicev1.cpp +++ b/tests/auto/wayland/datadevicev1/tst_datadevicev1.cpp @@ -28,8 +28,8 @@ #include "mockcompositor.h" +#include #include -#include #include #include diff --git a/tests/auto/wayland/primaryselectionv1/tst_primaryselectionv1.cpp b/tests/auto/wayland/primaryselectionv1/tst_primaryselectionv1.cpp index ee9fa110e4b..660d1f83e11 100644 --- a/tests/auto/wayland/primaryselectionv1/tst_primaryselectionv1.cpp +++ b/tests/auto/wayland/primaryselectionv1/tst_primaryselectionv1.cpp @@ -30,8 +30,8 @@ #include +#include #include -#include #include #include diff --git a/tests/auto/wayland/seatv4/tst_seatv4.cpp b/tests/auto/wayland/seatv4/tst_seatv4.cpp index 2e17bef8727..f5c07896322 100644 --- a/tests/auto/wayland/seatv4/tst_seatv4.cpp +++ b/tests/auto/wayland/seatv4/tst_seatv4.cpp @@ -28,8 +28,8 @@ #include "mockcompositor.h" +#include #include -#include #if QT_CONFIG(cursor) #include #include diff --git a/tests/auto/wayland/seatv5/tst_seatv5.cpp b/tests/auto/wayland/seatv5/tst_seatv5.cpp index e333082ecc7..2a2a05cd253 100644 --- a/tests/auto/wayland/seatv5/tst_seatv5.cpp +++ b/tests/auto/wayland/seatv5/tst_seatv5.cpp @@ -27,8 +27,8 @@ ****************************************************************************/ #include "mockcompositor.h" +#include #include -#include using namespace MockCompositor; @@ -397,9 +397,9 @@ public: , touchPoints(event->touchPoints()) { } - const QEvent::Type type{}; - const Qt::TouchPointStates touchPointStates{}; - const QList touchPoints; + QEvent::Type type{}; + Qt::TouchPointStates touchPointStates{}; + QList touchPoints; }; QVector m_events; }; diff --git a/tests/auto/wayland/shared/shared.pri b/tests/auto/wayland/shared/shared.pri index c86183b3d62..b59cdc481da 100644 --- a/tests/auto/wayland/shared/shared.pri +++ b/tests/auto/wayland/shared/shared.pri @@ -1,4 +1,4 @@ -QT += testlib waylandclient-private +QT += testlib waylandclient-private opengl CONFIG += testcase wayland-scanner QMAKE_USE += wayland-server diff --git a/tests/auto/wayland/shared_old/shared_old.pri b/tests/auto/wayland/shared_old/shared_old.pri index 467e98115a2..6989e613e6c 100644 --- a/tests/auto/wayland/shared_old/shared_old.pri +++ b/tests/auto/wayland/shared_old/shared_old.pri @@ -1,6 +1,6 @@ CONFIG += testcase link_pkgconfig QT += testlib -QT += core-private gui-private waylandclient-private +QT += core-private gui-private waylandclient-private opengl QMAKE_USE += wayland-client wayland-server diff --git a/tests/auto/wayland/surface/tst_surface.cpp b/tests/auto/wayland/surface/tst_surface.cpp index b8a65f1595f..289fbd62153 100644 --- a/tests/auto/wayland/surface/tst_surface.cpp +++ b/tests/auto/wayland/surface/tst_surface.cpp @@ -29,7 +29,7 @@ #include "mockcompositor.h" #include #if QT_CONFIG(opengl) -#include +#include #endif using namespace MockCompositor; diff --git a/tests/auto/wayland/xdgdecorationv1/tst_xdgdecorationv1.cpp b/tests/auto/wayland/xdgdecorationv1/tst_xdgdecorationv1.cpp index 386713cf567..cf20a137392 100644 --- a/tests/auto/wayland/xdgdecorationv1/tst_xdgdecorationv1.cpp +++ b/tests/auto/wayland/xdgdecorationv1/tst_xdgdecorationv1.cpp @@ -30,8 +30,8 @@ #include +#include #include -#include #include #include diff --git a/tests/auto/wayland/xdgoutput/tst_xdgoutput.cpp b/tests/auto/wayland/xdgoutput/tst_xdgoutput.cpp index a628810d19c..16e29a3c6d9 100644 --- a/tests/auto/wayland/xdgoutput/tst_xdgoutput.cpp +++ b/tests/auto/wayland/xdgoutput/tst_xdgoutput.cpp @@ -27,8 +27,8 @@ ****************************************************************************/ #include "mockcompositor.h" +#include #include -#include #include #include diff --git a/tests/auto/wayland/xdgshell/tst_xdgshell.cpp b/tests/auto/wayland/xdgshell/tst_xdgshell.cpp index 2277bbb80ab..eabf29b7e64 100644 --- a/tests/auto/wayland/xdgshell/tst_xdgshell.cpp +++ b/tests/auto/wayland/xdgshell/tst_xdgshell.cpp @@ -27,8 +27,8 @@ ****************************************************************************/ #include "mockcompositor.h" +#include #include -#include #include #include From a319f4a597bb97532b6d89ad7272aec52e4656bb Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Thu, 30 Jan 2020 15:48:41 +0100 Subject: [PATCH 0817/1507] Client: Temporarily disable QPA startSystemMove The signature of startSysteMove has changed, remove the override temporarily so qt5.git can update. Then we can add the correct override back afterwards. Fixes: QTBUG-81751 Change-Id: I4ef9aec1e8299e853be4ef868ecfc3a374ae6f27 Reviewed-by: Qt CI Bot Reviewed-by: David Edmundson Reviewed-by: Pier Luigi Fiorini --- src/plugins/platforms/wayland/qwaylandwindow_p.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index 35fa1fdfcef..c0328996d5d 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -196,7 +196,7 @@ public: void propagateSizeHints() override; void addAttachOffset(const QPoint point); - bool startSystemMove(const QPoint &pos) override; + bool startSystemMove(const QPoint &pos); void timerEvent(QTimerEvent *event) override; void requestUpdate() override; From 37b79a5968dc708b1afc699195ef4982e6262e6a Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Wed, 30 Oct 2019 10:33:34 -0400 Subject: [PATCH 0818/1507] Client: Update to new signature for startSystemMove() In a319f4a5, we temporarily disabled the override to let qt5.git update, now we add it back with the new signature. This means QWindow::startSystemMove now works for Wayland. Task-number: QTBUG-81751 Task-number: QTBUG-73011 Change-Id: I1459300d6f7fb77a9ae07bb4f5c2b80722f9b02c Reviewed-by: Pier Luigi Fiorini --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 3 +-- src/plugins/platforms/wayland/qwaylandwindow_p.h | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 8cc26d71ca1..7802aca6673 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -1185,9 +1185,8 @@ void QWaylandWindow::propagateSizeHints() mShellSurface->propagateSizeHints(); } -bool QtWaylandClient::QWaylandWindow::startSystemMove(const QPoint &pos) +bool QtWaylandClient::QWaylandWindow::startSystemMove() { - Q_UNUSED(pos); if (auto seat = display()->lastInputDevice()) return mShellSurface && mShellSurface->move(seat); return false; diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index c0328996d5d..8a22baccaf9 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -196,7 +196,7 @@ public: void propagateSizeHints() override; void addAttachOffset(const QPoint point); - bool startSystemMove(const QPoint &pos); + bool startSystemMove() override; void timerEvent(QTimerEvent *event) override; void requestUpdate() override; From 84209cf53b82df6fd4085546d66ee66798d842da Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Mon, 14 Jan 2019 09:38:51 +0100 Subject: [PATCH 0819/1507] Client: Implement QPlatformWindow::startSystemResize Task-number: QTBUG-73011 Change-Id: Ife0d9949b4d4dd7e6f16d3de88d0cb4bf4991e09 Reviewed-by: Pier Luigi Fiorini Reviewed-by: David Edmundson --- .../shellintegration/wl-shell/qwaylandwlshellsurface.cpp | 3 ++- .../shellintegration/wl-shell/qwaylandwlshellsurface_p.h | 2 +- .../shellintegration/xdg-shell-v5/qwaylandxdgsurfacev5.cpp | 3 ++- .../shellintegration/xdg-shell-v5/qwaylandxdgsurfacev5_p.h | 2 +- .../shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp | 7 +++++-- .../shellintegration/xdg-shell-v6/qwaylandxdgshellv6_p.h | 2 +- .../shellintegration/xdg-shell/qwaylandxdgshell.cpp | 7 +++++-- .../shellintegration/xdg-shell/qwaylandxdgshell_p.h | 2 +- src/plugins/platforms/wayland/qwaylandshellsurface_p.h | 3 +-- src/plugins/platforms/wayland/qwaylandwindow.cpp | 7 +++++++ src/plugins/platforms/wayland/qwaylandwindow_p.h | 1 + 11 files changed, 27 insertions(+), 12 deletions(-) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellsurface.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellsurface.cpp index 48e14c753fe..245fec19670 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellsurface.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellsurface.cpp @@ -76,10 +76,11 @@ QWaylandWlShellSurface::~QWaylandWlShellSurface() delete m_extendedWindow; } -void QWaylandWlShellSurface::resize(QWaylandInputDevice *inputDevice, Qt::Edges edges) +bool QWaylandWlShellSurface::resize(QWaylandInputDevice *inputDevice, Qt::Edges edges) { enum resize resizeEdges = convertToResizeEdges(edges); resize(inputDevice->wl_seat(), inputDevice->serial(), resizeEdges); + return true; } bool QWaylandWlShellSurface::move(QWaylandInputDevice *inputDevice) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellsurface_p.h b/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellsurface_p.h index 324c10aacae..ca7ba602c73 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellsurface_p.h +++ b/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellsurface_p.h @@ -76,7 +76,7 @@ public: ~QWaylandWlShellSurface() override; using QtWayland::wl_shell_surface::resize; - void resize(QWaylandInputDevice *inputDevice, Qt::Edges edges) override; + bool resize(QWaylandInputDevice *inputDevice, Qt::Edges edges) override; using QtWayland::wl_shell_surface::move; bool move(QWaylandInputDevice *inputDevice) override; diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgsurfacev5.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgsurfacev5.cpp index e8bff91935e..770fad7e853 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgsurfacev5.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgsurfacev5.cpp @@ -82,10 +82,11 @@ QtWayland::xdg_surface_v5::resize_edge QWaylandXdgSurfaceV5::convertToResizeEdge | ((edges & Qt::RightEdge) ? resize_edge_right : 0)); } -void QWaylandXdgSurfaceV5::resize(QWaylandInputDevice *inputDevice, Qt::Edges edges) +bool QWaylandXdgSurfaceV5::resize(QWaylandInputDevice *inputDevice, Qt::Edges edges) { resize_edge resizeEdges = convertToResizeEdges(edges); resize(inputDevice->wl_seat(), inputDevice->serial(), resizeEdges); + return true; } bool QWaylandXdgSurfaceV5::move(QWaylandInputDevice *inputDevice) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgsurfacev5_p.h b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgsurfacev5_p.h index feebee7f431..bf221079e99 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgsurfacev5_p.h +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgsurfacev5_p.h @@ -80,7 +80,7 @@ public: using QtWayland::xdg_surface_v5::resize; static resize_edge convertToResizeEdges(Qt::Edges edges); - void resize(QWaylandInputDevice *inputDevice, Qt::Edges edges) override; + bool resize(QWaylandInputDevice *inputDevice, Qt::Edges edges) override; using QtWayland::xdg_surface_v5::move; bool move(QWaylandInputDevice *inputDevice) override; diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp index dc3cfdbfa11..c137b308bc0 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp @@ -237,11 +237,14 @@ QWaylandXdgSurfaceV6::~QWaylandXdgSurfaceV6() destroy(); } -void QWaylandXdgSurfaceV6::resize(QWaylandInputDevice *inputDevice, Qt::Edges edges) +bool QWaylandXdgSurfaceV6::resize(QWaylandInputDevice *inputDevice, Qt::Edges edges) { - Q_ASSERT(m_toplevel && m_toplevel->isInitialized()); + if (!m_toplevel || !m_toplevel->isInitialized()) + return false; + auto resizeEdges = Toplevel::convertToResizeEdges(edges); m_toplevel->resize(inputDevice->wl_seat(), inputDevice->serial(), resizeEdges); + return true; } bool QWaylandXdgSurfaceV6::move(QWaylandInputDevice *inputDevice) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6_p.h b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6_p.h index f77a4d4baeb..757b982b9db 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6_p.h +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6_p.h @@ -77,7 +77,7 @@ public: QWaylandXdgSurfaceV6(QWaylandXdgShellV6 *shell, ::zxdg_surface_v6 *surface, QWaylandWindow *window); ~QWaylandXdgSurfaceV6() override; - void resize(QWaylandInputDevice *inputDevice, Qt::Edges edges) override; + bool resize(QWaylandInputDevice *inputDevice, Qt::Edges edges) override; bool move(QWaylandInputDevice *inputDevice) override; bool showWindowMenu(QWaylandInputDevice *seat) override; void setTitle(const QString &title) override; diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp index bd1f5a210e5..a8e66267919 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp @@ -266,11 +266,14 @@ QWaylandXdgSurface::~QWaylandXdgSurface() destroy(); } -void QWaylandXdgSurface::resize(QWaylandInputDevice *inputDevice, Qt::Edges edges) +bool QWaylandXdgSurface::resize(QWaylandInputDevice *inputDevice, Qt::Edges edges) { - Q_ASSERT(m_toplevel && m_toplevel->isInitialized()); + if (!m_toplevel || !m_toplevel->isInitialized()) + return false; + auto resizeEdges = Toplevel::convertToResizeEdges(edges); m_toplevel->resize(inputDevice->wl_seat(), inputDevice->serial(), resizeEdges); + return true; } bool QWaylandXdgSurface::move(QWaylandInputDevice *inputDevice) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h index 8f8682a4792..0c98be35cdc 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h @@ -80,7 +80,7 @@ public: QWaylandXdgSurface(QWaylandXdgShell *shell, ::xdg_surface *surface, QWaylandWindow *window); ~QWaylandXdgSurface() override; - void resize(QWaylandInputDevice *inputDevice, Qt::Edges edges) override; + bool resize(QWaylandInputDevice *inputDevice, Qt::Edges edges) override; bool move(QWaylandInputDevice *inputDevice) override; bool showWindowMenu(QWaylandInputDevice *seat) override; void setTitle(const QString &title) override; diff --git a/src/plugins/platforms/wayland/qwaylandshellsurface_p.h b/src/plugins/platforms/wayland/qwaylandshellsurface_p.h index f5f202d0817..989cdb81b1c 100644 --- a/src/plugins/platforms/wayland/qwaylandshellsurface_p.h +++ b/src/plugins/platforms/wayland/qwaylandshellsurface_p.h @@ -73,8 +73,7 @@ class Q_WAYLAND_CLIENT_EXPORT QWaylandShellSurface : public QObject public: explicit QWaylandShellSurface(QWaylandWindow *window); ~QWaylandShellSurface() override {} - virtual void resize(QWaylandInputDevice * /*inputDevice*/, Qt::Edges /*edges*/) {} - + virtual bool resize(QWaylandInputDevice *, Qt::Edges) { return false; } virtual bool move(QWaylandInputDevice *) { return false; } virtual bool showWindowMenu(QWaylandInputDevice *seat) { Q_UNUSED(seat); return false; } virtual void setTitle(const QString & /*title*/) {} diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 7802aca6673..c8a01dc2e3f 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -1185,6 +1185,13 @@ void QWaylandWindow::propagateSizeHints() mShellSurface->propagateSizeHints(); } +bool QWaylandWindow::startSystemResize(Qt::Edges edges) +{ + if (auto *seat = display()->lastInputDevice()) + return mShellSurface && mShellSurface->resize(seat, edges); + return false; +} + bool QtWaylandClient::QWaylandWindow::startSystemMove() { if (auto seat = display()->lastInputDevice()) diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index 8a22baccaf9..823e4a9701b 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -196,6 +196,7 @@ public: void propagateSizeHints() override; void addAttachOffset(const QPoint point); + bool startSystemResize(Qt::Edges edges) override; bool startSystemMove() override; void timerEvent(QTimerEvent *event) override; From f6155a7622d9f6b40a2c6d190024682cf33d616a Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Sun, 21 Jul 2019 18:55:01 +0300 Subject: [PATCH 0820/1507] QWaylandCursorTheme: replace a QMap with a C array MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The QMap's key is an enumeration with small values (<= 33, as of this writing), and while the range has a hole, it's not a terribly big one. So, instead of using a QMap, just use a C array of mapped_type, using the key as an index into the array. This gives a 'map' with zero memory allocations. It also saves a bit more than 700B in text size on optimized Linux AMD64 GCC 9.1 builds. Change-Id: If538ba80075f1bbdffd82b070e871391e6a5a6d1 Reviewed-by: Mårten Nordheim --- src/plugins/platforms/wayland/qwaylandcursor.cpp | 4 ++-- src/plugins/platforms/wayland/qwaylandcursor_p.h | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandcursor.cpp b/src/plugins/platforms/wayland/qwaylandcursor.cpp index 1d3d88bea3a..4d540c5db76 100644 --- a/src/plugins/platforms/wayland/qwaylandcursor.cpp +++ b/src/plugins/platforms/wayland/qwaylandcursor.cpp @@ -74,7 +74,7 @@ QWaylandCursorTheme::~QWaylandCursorTheme() wl_cursor *QWaylandCursorTheme::requestCursor(WaylandCursor shape) { - if (struct wl_cursor *cursor = m_cursors.value(shape, nullptr)) + if (struct wl_cursor *cursor = m_cursors[shape]) return cursor; static Q_CONSTEXPR struct ShapeAndName { @@ -206,7 +206,7 @@ wl_cursor *QWaylandCursorTheme::requestCursor(WaylandCursor shape) ShapeAndName{shape, ""}, byShape); for (auto it = p.first; it != p.second; ++it) { if (wl_cursor *cursor = wl_cursor_theme_get_cursor(m_theme, it->name)) { - m_cursors.insert(shape, cursor); + m_cursors[shape] = cursor; return cursor; } } diff --git a/src/plugins/platforms/wayland/qwaylandcursor_p.h b/src/plugins/platforms/wayland/qwaylandcursor_p.h index 751ffa68b71..3e5cff9bca1 100644 --- a/src/plugins/platforms/wayland/qwaylandcursor_p.h +++ b/src/plugins/platforms/wayland/qwaylandcursor_p.h @@ -109,13 +109,15 @@ private: ResizeNorthWestCursor, ResizeSouthEastCursor, ResizeNorthEastCursor, - ResizeSouthWestCursor + ResizeSouthWestCursor, + + NumWaylandCursors }; explicit QWaylandCursorTheme(struct ::wl_cursor_theme *theme) : m_theme(theme) {} struct ::wl_cursor *requestCursor(WaylandCursor shape); struct ::wl_cursor_theme *m_theme = nullptr; - QMap m_cursors; + wl_cursor *m_cursors[NumWaylandCursors] = {}; }; class Q_WAYLAND_CLIENT_EXPORT QWaylandCursor : public QPlatformCursor From b74257332f2d9a69cbfa2d874db43ffb14a1905f Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Tue, 11 Feb 2020 14:28:32 +0100 Subject: [PATCH 0821/1507] Client: Don't allow decorations for frameless windows This only fixes it for when Qt::FramelessWindowHint is set appropriately before the window is shown. [ChangeLog][QPA plugin] Windows with Qt::FramelessWindowHint no longer create zxdg_toplevel_decoration_v1, as that allowed compositors to force server-side decorations. Fixes: QTBUG-80702 Change-Id: I47a582a59f6682a57128c0c9d4e4b9a6181925a4 Reviewed-by: Pier Luigi Fiorini --- .../xdg-shell/qwaylandxdgshell.cpp | 7 ++++--- .../xdgdecorationv1/tst_xdgdecorationv1.cpp | 18 ++++++++++++++++++ 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp index a8e66267919..56d77ec4f5a 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp @@ -56,10 +56,11 @@ QWaylandXdgSurface::Toplevel::Toplevel(QWaylandXdgSurface *xdgSurface) : QtWayland::xdg_toplevel(xdgSurface->get_toplevel()) , m_xdgSurface(xdgSurface) { - if (auto *decorationManager = m_xdgSurface->m_shell->decorationManager()) - m_decoration = decorationManager->createToplevelDecoration(object()); - QWindow *window = xdgSurface->window()->window(); + if (auto *decorationManager = m_xdgSurface->m_shell->decorationManager()) { + if (!(window->flags() & Qt::FramelessWindowHint)) + m_decoration = decorationManager->createToplevelDecoration(object()); + } requestWindowStates(window->windowStates()); requestWindowFlags(window->flags()); } diff --git a/tests/auto/wayland/xdgdecorationv1/tst_xdgdecorationv1.cpp b/tests/auto/wayland/xdgdecorationv1/tst_xdgdecorationv1.cpp index 386713cf567..391abd83bd2 100644 --- a/tests/auto/wayland/xdgdecorationv1/tst_xdgdecorationv1.cpp +++ b/tests/auto/wayland/xdgdecorationv1/tst_xdgdecorationv1.cpp @@ -153,6 +153,7 @@ private slots: void initTestCase(); void cleanup() { QTRY_VERIFY2(isClean(), qPrintable(dirtyMessage())); } void clientSidePreferredByCompositor(); + void initialFramelessWindowHint(); }; void tst_xdgdecorationv1::initTestCase() @@ -182,5 +183,22 @@ void tst_xdgdecorationv1::clientSidePreferredByCompositor() QTRY_VERIFY(!window.frameMargins().isNull()); } +void tst_xdgdecorationv1::initialFramelessWindowHint() +{ + QRasterWindow window; + window.setFlag(Qt::FramelessWindowHint, true); + window.show(); + QCOMPOSITOR_TRY_COMPARE(get()->resourceMap().size(), 1); + QCOMPOSITOR_TRY_VERIFY(xdgToplevel()); + exec([=]{ + xdgToplevel()->sendCompleteConfigure(); + }); + QCOMPOSITOR_TRY_VERIFY(xdgSurface()->m_committedConfigureSerial); + + // The client should not have create a decoration object, because that allows the compositor + // to override our decision and add server side decorations to our window. + QCOMPOSITOR_TRY_VERIFY(!toplevelDecoration()); +} + QCOMPOSITOR_TEST_MAIN(tst_xdgdecorationv1) #include "tst_xdgdecorationv1.moc" From ea3a3638e688fcc37fdbe9eb665aca12c0d8d4bd Mon Sep 17 00:00:00 2001 From: Aleix Pol Date: Mon, 20 Jan 2020 19:05:46 +0100 Subject: [PATCH 0822/1507] Make generated files more resilient to crashes If m_resource is not initialized when calling a send_* method it will simply crash. This change checks for it beforehand so we get a warning instead. Change-Id: I601f9070a35a1b3e595567991f7e54e9a6572c2d Reviewed-by: Johan Helsing --- src/tools/qtwaylandscanner/qtwaylandscanner.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp index 05f00beee7b..3cecb5bcfbe 100644 --- a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp +++ b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp @@ -906,6 +906,11 @@ bool Scanner::process() printEvent(e); printf("\n"); printf(" {\n"); + printf(" Q_ASSERT_X(m_resource, \"%s::%s\", \"Uninitialised resource\");\n", interfaceName, e.name.constData()); + printf(" if (Q_UNLIKELY(!m_resource)) {\n"); + printf(" qWarning(\"could not call %s::%s as it's not initialised\");\n", interfaceName, e.name.constData()); + printf(" return;\n"); + printf(" }\n"); printf(" send_%s(\n", e.name.constData()); printf(" m_resource->handle"); for (const WaylandArgument &a : e.arguments) { From e8247e5eb5815aff8c1fd1931d4770b58c8896db Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Wed, 22 Jan 2020 12:46:18 +0100 Subject: [PATCH 0823/1507] Inject OpenGL dependency for backing store The backing store no longer has OpenGL support by default, so we need to enable it. Task-number: QTBUG-74409 Change-Id: Ie132dae523db86091134279ade61cffe2ff10a73 Reviewed-by: Simon Hausmann --- src/plugins/platforms/wayland/client.pro | 3 +++ src/plugins/platforms/wayland/qwaylandintegration.cpp | 9 ++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/client.pro b/src/plugins/platforms/wayland/client.pro index 793a44183c2..4aeba860bc5 100644 --- a/src/plugins/platforms/wayland/client.pro +++ b/src/plugins/platforms/wayland/client.pro @@ -23,6 +23,9 @@ qtConfig(xkbcommon) { QT_FOR_PRIVATE += xkbcommon_support-private } +qtHaveModule(platformcompositor_support-private): \ + QT_PRIVATE += platformcompositor_support-private + qtHaveModule(linuxaccessibility_support-private): \ QT_PRIVATE += linuxaccessibility_support-private diff --git a/src/plugins/platforms/wayland/qwaylandintegration.cpp b/src/plugins/platforms/wayland/qwaylandintegration.cpp index 85c1990b612..82ffc503a9b 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandintegration.cpp @@ -66,7 +66,10 @@ #include #include #include +#if QT_CONFIG(opengl) #include +#include +#endif // QT_CONFIG(opengl) #include #include @@ -182,7 +185,11 @@ QPlatformOpenGLContext *QWaylandIntegration::createPlatformOpenGLContext(QOpenGL QPlatformBackingStore *QWaylandIntegration::createPlatformBackingStore(QWindow *window) const { - return new QWaylandShmBackingStore(window, mDisplay.data()); + auto *backingStore = new QWaylandShmBackingStore(window, mDisplay.data()); +#if QT_CONFIG(opengl) + backingStore->setOpenGLSupport(new QPlatformBackingStoreOpenGLSupport(backingStore)); +#endif + return backingStore; } QAbstractEventDispatcher *QWaylandIntegration::createEventDispatcher() const From f8e2c2fb4798eecfbe17ce54dba0d180b974cd31 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Wed, 19 Feb 2020 09:41:06 +0100 Subject: [PATCH 0824/1507] Fix compile errors in tests const qualifiers made default assignment operators invalid. Change-Id: I8b22a04f6e2f3b9b76a971b0a59f5fdce589c8e5 Reviewed-by: Pier Luigi Fiorini --- tests/auto/wayland/seatv4/tst_seatv4.cpp | 4 ++-- tests/auto/wayland/seatv5/tst_seatv5.cpp | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/auto/wayland/seatv4/tst_seatv4.cpp b/tests/auto/wayland/seatv4/tst_seatv4.cpp index f5c07896322..46d91e02876 100644 --- a/tests/auto/wayland/seatv4/tst_seatv4.cpp +++ b/tests/auto/wayland/seatv4/tst_seatv4.cpp @@ -289,8 +289,8 @@ void tst_seatv4::simpleAxis() { Event() = default; - const QPoint pixelDelta; - const QPoint angleDelta; // eights of a degree, positive is upwards, left + QPoint pixelDelta; + QPoint angleDelta; // eights of a degree, positive is upwards, left }; QVector m_events; }; diff --git a/tests/auto/wayland/seatv5/tst_seatv5.cpp b/tests/auto/wayland/seatv5/tst_seatv5.cpp index 2a2a05cd253..081a0aa7016 100644 --- a/tests/auto/wayland/seatv5/tst_seatv5.cpp +++ b/tests/auto/wayland/seatv5/tst_seatv5.cpp @@ -156,10 +156,10 @@ public: , source(event->source()) { } - const Qt::ScrollPhase phase{}; - const QPoint pixelDelta; - const QPoint angleDelta; // eights of a degree, positive is upwards, left - const Qt::MouseEventSource source{}; + Qt::ScrollPhase phase{}; + QPoint pixelDelta; + QPoint angleDelta; // eights of a degree, positive is upwards, left + Qt::MouseEventSource source{}; }; QVector m_events; }; From 97c1e5337e7e214c4ada98e1cc360b7e674996aa Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Tue, 23 Jul 2019 08:44:46 +0200 Subject: [PATCH 0825/1507] Client: Remove recursion in data offer retrieval A loop functions just as well is more readable and uses less stack memory. Change-Id: I6f6c6b7b8047c42080fb8b9e0bc3eae96f8872ab Reviewed-by: David Faure Reviewed-by: Johan Helsing --- .../platforms/wayland/qwaylanddataoffer.cpp | 35 ++++++++++--------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylanddataoffer.cpp b/src/plugins/platforms/wayland/qwaylanddataoffer.cpp index 4c06277fe87..2297e8a16d6 100644 --- a/src/plugins/platforms/wayland/qwaylanddataoffer.cpp +++ b/src/plugins/platforms/wayland/qwaylanddataoffer.cpp @@ -170,24 +170,27 @@ int QWaylandMimeData::readData(int fd, QByteArray &data) const timeout.tv_sec = 1; timeout.tv_usec = 0; - int ready = select(FD_SETSIZE, &readset, nullptr, nullptr, &timeout); - if (ready < 0) { - qWarning() << "QWaylandDataOffer: select() failed"; - return -1; - } else if (ready == 0) { - qWarning("QWaylandDataOffer: timeout reading from pipe"); - return -1; - } else { - char buf[4096]; - int n = QT_READ(fd, buf, sizeof buf); + Q_FOREVER { + int ready = select(FD_SETSIZE, &readset, nullptr, nullptr, &timeout); + if (ready < 0) { + qWarning() << "QWaylandDataOffer: select() failed"; + return -1; + } else if (ready == 0) { + qWarning("QWaylandDataOffer: timeout reading from pipe"); + return -1; + } else { + char buf[4096]; + int n = QT_READ(fd, buf, sizeof buf); - if (n > 0) { - data.append(buf, n); - n = readData(fd, data); - } else if (n < 0) { - qWarning("QWaylandDataOffer: read() failed"); + if (n < 0) { + qWarning("QWaylandDataOffer: read() failed"); + return -1; + } else if (n == 0) { + return 0; + } else if (n > 0) { + data.append(buf, n); + } } - return n; } } From d4027bc3fe44b4d24df56e28f35e61459e169701 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Thu, 9 Jan 2020 10:28:24 +0100 Subject: [PATCH 0826/1507] Move XdgOutput mocking to shared folder Change-Id: Ia4fe187d33ddfd25a87dac8567143de6466c75a2 Reviewed-by: Shawn Rutledge --- tests/auto/wayland/shared/shared.pri | 3 + tests/auto/wayland/shared/xdgoutputv1.cpp | 35 +++++++ tests/auto/wayland/shared/xdgoutputv1.h | 93 +++++++++++++++++++ .../auto/wayland/xdgoutput/tst_xdgoutput.cpp | 60 +----------- 4 files changed, 133 insertions(+), 58 deletions(-) create mode 100644 tests/auto/wayland/shared/xdgoutputv1.cpp create mode 100644 tests/auto/wayland/shared/xdgoutputv1.h diff --git a/tests/auto/wayland/shared/shared.pri b/tests/auto/wayland/shared/shared.pri index c86183b3d62..e4d368b9a0d 100644 --- a/tests/auto/wayland/shared/shared.pri +++ b/tests/auto/wayland/shared/shared.pri @@ -4,6 +4,7 @@ QMAKE_USE += wayland-server WAYLANDSERVERSOURCES += \ $$PWD/../../../../src/3rdparty/protocol/wayland.xml \ + $$PWD/../../../../src/3rdparty/protocol/xdg-output-unstable-v1.xml \ $$PWD/../../../../src/3rdparty/protocol/xdg-shell.xml \ $$PWD/../../../../src/3rdparty/protocol/text-input-unstable-v2.xml @@ -14,6 +15,7 @@ HEADERS += \ $$PWD/coreprotocol.h \ $$PWD/datadevice.h \ $$PWD/mockcompositor.h \ + $$PWD/xdgoutputv1.h \ $$PWD/xdgshell.h \ $$PWD/textinput.h @@ -22,5 +24,6 @@ SOURCES += \ $$PWD/coreprotocol.cpp \ $$PWD/datadevice.cpp \ $$PWD/mockcompositor.cpp \ + $$PWD/xdgoutputv1.cpp \ $$PWD/xdgshell.cpp \ $$PWD/textinput.cpp diff --git a/tests/auto/wayland/shared/xdgoutputv1.cpp b/tests/auto/wayland/shared/xdgoutputv1.cpp new file mode 100644 index 00000000000..21bfdaca54b --- /dev/null +++ b/tests/auto/wayland/shared/xdgoutputv1.cpp @@ -0,0 +1,35 @@ +/**************************************************************************** +** +** Copyright (C) 2020 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "xdgoutputv1.h" + +namespace MockCompositor { + +int XdgOutputV1::s_nextId = 1; + +} // namespace MockCompositor diff --git a/tests/auto/wayland/shared/xdgoutputv1.h b/tests/auto/wayland/shared/xdgoutputv1.h new file mode 100644 index 00000000000..e37b01e649b --- /dev/null +++ b/tests/auto/wayland/shared/xdgoutputv1.h @@ -0,0 +1,93 @@ +/**************************************************************************** +** +** Copyright (C) 2020 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef MOCKCOMPOSITOR_XDGOUTPUTV1_H +#define MOCKCOMPOSITOR_XDGOUTPUTV1_H + +#include "coreprotocol.h" + +#include + +namespace MockCompositor { + +class XdgOutputV1 : public QObject, public QtWaylandServer::zxdg_output_v1 +{ +public: + explicit XdgOutputV1(Output *output) + : m_output(output) + , m_logicalGeometry(m_output->m_data.position, QSize(m_output->m_data.mode.resolution / m_output->m_data.scale)) + , m_name(QString("WL-%1").arg(s_nextId++)) + {} + + void addResource(wl_client *client, int id, int version) + { + auto *resource = add(client, id, version)->handle; + send_logical_size(resource, m_logicalGeometry.width(), m_logicalGeometry.height()); + send_logical_position(resource, m_logicalGeometry.x(), m_logicalGeometry.y()); + if (version >= ZXDG_OUTPUT_V1_NAME_SINCE_VERSION) + send_name(resource, m_name); + if (version >= ZXDG_OUTPUT_V1_DESCRIPTION_SINCE_VERSION) + send_description(resource, m_description); + send_done(resource); + } + Output *m_output = nullptr; + QRect m_logicalGeometry; + QString m_name; + QString m_description = "This is an Xdg Output description"; + static int s_nextId; +}; + +class XdgOutputManagerV1 : public Global, public QtWaylandServer::zxdg_output_manager_v1 +{ + Q_OBJECT +public: + explicit XdgOutputManagerV1(CoreCompositor *compositor, int version = 2) + : QtWaylandServer::zxdg_output_manager_v1(compositor->m_display, version) + , m_version(version) + {} + int m_version = 1; // TODO: remove on libwayland upgrade + QMap m_xdgOutputs; + XdgOutputV1 *getXdgOutput(Output *output) + { + if (auto *xdgOutput = m_xdgOutputs.value(output)) + return xdgOutput; + return m_xdgOutputs[output] = new XdgOutputV1(output); // TODO: free memory + } + +protected: + void zxdg_output_manager_v1_get_xdg_output(Resource *resource, uint32_t id, wl_resource *outputResource) override + { + auto *output = fromResource(outputResource); + auto *xdgOutput = getXdgOutput(output); + xdgOutput->addResource(resource->client(), id, resource->version()); + } +}; + +} // namespace MockCompositor + +#endif // MOCKCOMPOSITOR_XDGOUTPUTV1_H diff --git a/tests/auto/wayland/xdgoutput/tst_xdgoutput.cpp b/tests/auto/wayland/xdgoutput/tst_xdgoutput.cpp index a628810d19c..2f28d1fe6b0 100644 --- a/tests/auto/wayland/xdgoutput/tst_xdgoutput.cpp +++ b/tests/auto/wayland/xdgoutput/tst_xdgoutput.cpp @@ -26,71 +26,15 @@ ** ****************************************************************************/ +#include "xdgoutputv1.h" #include "mockcompositor.h" + #include #include #include -#include - using namespace MockCompositor; -// TODO: move to shared folder? -class XdgOutputV1 : public QObject, public QtWaylandServer::zxdg_output_v1 -{ -public: - explicit XdgOutputV1(Output *output) - : m_output(output) - , m_logicalGeometry(m_output->m_data.position, QSize(m_output->m_data.mode.resolution / m_output->m_data.scale)) - , m_name(QString("WL-%1").arg(s_nextId++)) - {} - - void addResource(wl_client *client, int id, int version) - { - auto *resource = add(client, id, version)->handle; - send_logical_size(resource, m_logicalGeometry.width(), m_logicalGeometry.height()); - send_logical_position(resource, m_logicalGeometry.x(), m_logicalGeometry.y()); - if (version >= ZXDG_OUTPUT_V1_NAME_SINCE_VERSION) - send_name(resource, m_name); - if (version >= ZXDG_OUTPUT_V1_DESCRIPTION_SINCE_VERSION) - send_description(resource, m_description); - send_done(resource); - } - Output *m_output = nullptr; - QRect m_logicalGeometry; - QString m_name; - QString m_description = "This is an Xdg Output description"; - static int s_nextId; -}; - -int XdgOutputV1::s_nextId = 1; - -class XdgOutputManagerV1 : public Global, public QtWaylandServer::zxdg_output_manager_v1 -{ - Q_OBJECT -public: - explicit XdgOutputManagerV1(CoreCompositor *compositor, int version = 2) - : QtWaylandServer::zxdg_output_manager_v1(compositor->m_display, version) - , m_version(version) - {} - int m_version = 1; // TODO: remove on libwayland upgrade - QMap m_xdgOutputs; - XdgOutputV1 *getXdgOutput(Output *output) - { - if (auto *xdgOutput = m_xdgOutputs.value(output)) - return xdgOutput; - return m_xdgOutputs[output] = new XdgOutputV1(output); // TODO: free memory - } - -protected: - void zxdg_output_manager_v1_get_xdg_output(Resource *resource, uint32_t id, wl_resource *outputResource) override - { - auto *output = fromResource(outputResource); - auto *xdgOutput = getXdgOutput(output); - xdgOutput->addResource(resource->client(), id, resource->version()); - } -}; - class XdgOutputV1Compositor : public DefaultCompositor { public: explicit XdgOutputV1Compositor() From a23d0f458771ae52abafbe89f4d40f04a8796d0e Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Thu, 9 Jan 2020 12:20:23 +0100 Subject: [PATCH 0827/1507] Client tests for xdg-output unstable v1 version 3 Change-Id: If6d7547c14dfaf06532a83ab2fbda4d0198837dc Reviewed-by: Shawn Rutledge Reviewed-by: Pier Luigi Fiorini --- tests/auto/wayland/shared/coreprotocol.cpp | 8 ++++ tests/auto/wayland/shared/coreprotocol.h | 1 + tests/auto/wayland/shared/xdgoutputv1.cpp | 24 ++++++++++ tests/auto/wayland/shared/xdgoutputv1.h | 19 +++----- .../auto/wayland/xdgoutput/tst_xdgoutput.cpp | 45 ++++++++++++++++++- 5 files changed, 83 insertions(+), 14 deletions(-) diff --git a/tests/auto/wayland/shared/coreprotocol.cpp b/tests/auto/wayland/shared/coreprotocol.cpp index b0be2cb4e5b..0d98852160d 100644 --- a/tests/auto/wayland/shared/coreprotocol.cpp +++ b/tests/auto/wayland/shared/coreprotocol.cpp @@ -158,6 +158,14 @@ void Output::sendScale(Resource *resource) wl_output::send_scale(resource->handle, m_data.scale); } +void Output::sendDone(wl_client *client) +{ + Q_ASSERT(m_version >= WL_OUTPUT_DONE_SINCE_VERSION); + auto resources = resourceMap().values(client); + for (auto *r : resources) + wl_output::send_done(r->handle); +} + void Output::sendDone() { Q_ASSERT(m_version >= WL_OUTPUT_DONE_SINCE_VERSION); diff --git a/tests/auto/wayland/shared/coreprotocol.h b/tests/auto/wayland/shared/coreprotocol.h index a12d22d3658..8d5e2d66d31 100644 --- a/tests/auto/wayland/shared/coreprotocol.h +++ b/tests/auto/wayland/shared/coreprotocol.h @@ -245,6 +245,7 @@ public: void sendScale(int factor); void sendScale(Resource *resource); // Sends current scale to only one client + void sendDone(wl_client *client); void sendDone(); int scale() const { return m_data.scale; } diff --git a/tests/auto/wayland/shared/xdgoutputv1.cpp b/tests/auto/wayland/shared/xdgoutputv1.cpp index 21bfdaca54b..2b491d2ee76 100644 --- a/tests/auto/wayland/shared/xdgoutputv1.cpp +++ b/tests/auto/wayland/shared/xdgoutputv1.cpp @@ -32,4 +32,28 @@ namespace MockCompositor { int XdgOutputV1::s_nextId = 1; +void XdgOutputV1::sendLogicalSize(const QSize &size) +{ + m_logicalGeometry.setSize(size); + for (auto *resource : resourceMap()) + zxdg_output_v1::send_logical_size(resource->handle, size.width(), size.height()); +} + +void XdgOutputV1::addResource(wl_client *client, int id, int version) +{ + auto *resource = add(client, id, version)->handle; + zxdg_output_v1::send_logical_size(resource, m_logicalGeometry.width(), m_logicalGeometry.height()); + send_logical_position(resource, m_logicalGeometry.x(), m_logicalGeometry.y()); + if (version >= ZXDG_OUTPUT_V1_NAME_SINCE_VERSION) + send_name(resource, m_name); + if (version >= ZXDG_OUTPUT_V1_DESCRIPTION_SINCE_VERSION) + send_description(resource, m_description); + + if (version < 3) // zxdg_output_v1.done has been deprecated + zxdg_output_v1::send_done(resource); + else { + m_output->sendDone(client); + } +} + } // namespace MockCompositor diff --git a/tests/auto/wayland/shared/xdgoutputv1.h b/tests/auto/wayland/shared/xdgoutputv1.h index e37b01e649b..85b134500a0 100644 --- a/tests/auto/wayland/shared/xdgoutputv1.h +++ b/tests/auto/wayland/shared/xdgoutputv1.h @@ -44,17 +44,12 @@ public: , m_name(QString("WL-%1").arg(s_nextId++)) {} - void addResource(wl_client *client, int id, int version) - { - auto *resource = add(client, id, version)->handle; - send_logical_size(resource, m_logicalGeometry.width(), m_logicalGeometry.height()); - send_logical_position(resource, m_logicalGeometry.x(), m_logicalGeometry.y()); - if (version >= ZXDG_OUTPUT_V1_NAME_SINCE_VERSION) - send_name(resource, m_name); - if (version >= ZXDG_OUTPUT_V1_DESCRIPTION_SINCE_VERSION) - send_description(resource, m_description); - send_done(resource); - } + void send_logical_size(int32_t width, int32_t height) = delete; + void sendLogicalSize(const QSize &size); + + void send_done() = delete; // zxdg_output_v1.done has been deprecated (in protocol version 3) + + void addResource(wl_client *client, int id, int version); Output *m_output = nullptr; QRect m_logicalGeometry; QString m_name; @@ -66,7 +61,7 @@ class XdgOutputManagerV1 : public Global, public QtWaylandServer::zxdg_output_ma { Q_OBJECT public: - explicit XdgOutputManagerV1(CoreCompositor *compositor, int version = 2) + explicit XdgOutputManagerV1(CoreCompositor *compositor, int version = 3) : QtWaylandServer::zxdg_output_manager_v1(compositor->m_display, version) , m_version(version) {} diff --git a/tests/auto/wayland/xdgoutput/tst_xdgoutput.cpp b/tests/auto/wayland/xdgoutput/tst_xdgoutput.cpp index 2f28d1fe6b0..80429608101 100644 --- a/tests/auto/wayland/xdgoutput/tst_xdgoutput.cpp +++ b/tests/auto/wayland/xdgoutput/tst_xdgoutput.cpp @@ -40,7 +40,7 @@ public: explicit XdgOutputV1Compositor() { exec([this] { - int version = 2; // version 2 of of unstable-v1 + int version = 3; // version 3 of of unstable-v1 add(version); }); } @@ -54,11 +54,13 @@ private slots: void cleanup(); void primaryScreen(); void overrideGeometry(); + void changeGeometry(); }; void tst_xdgoutput::cleanup() { QCOMPOSITOR_COMPARE(getAll().size(), 1); // Only the default output should be left + QTRY_COMPARE(QGuiApplication::screens().size(), 1); QTRY_VERIFY2(isClean(), qPrintable(dirtyMessage())); } @@ -68,7 +70,8 @@ void tst_xdgoutput::primaryScreen() QCOMPOSITOR_TRY_COMPARE(get()->resourceMap().size(), 1); exec([=] { auto *resource = xdgOutput()->resourceMap().value(client()); - QCOMPARE(resource->version(), 2); + QCOMPARE(resource->version(), 3); + QCOMPARE(xdgOutput()->m_logicalGeometry.size(), QSize(1920, 1080)); }); auto *s = QGuiApplication::primaryScreen(); QTRY_COMPARE(s->size(), QSize(1920, 1080)); @@ -93,5 +96,43 @@ void tst_xdgoutput::overrideGeometry() exec([=] { remove(output(1)); }); } +void tst_xdgoutput::changeGeometry() +{ + auto *xdgOutput = exec([=] { + auto *output = add(); + auto *xdgOutput = get()->getXdgOutput(output); + xdgOutput->m_logicalGeometry = QRect(10, 20, 800, 1200); + return xdgOutput; + }); + + QTRY_COMPARE(QGuiApplication::screens().size(), 2); + auto *screen = QGuiApplication::screens()[1]; + QTRY_COMPARE(screen->size(), QSize(800, 1200)); + + exec([=] { + xdgOutput->sendLogicalSize(QSize(1024, 768)); + }); + + // Now we want to check that the client doesn't apply the size immediately, but waits for the + // done event. If we TRY_COMPARE immediately, we risk that the client just hasn't handled the + // logical_size request yet, so we add a screen and verify it on the client side just to give + // the client a chance to mess up. + exec([=] { add(); }); + QTRY_COMPARE(QGuiApplication::screens().size(), 3); + exec([=] { remove(output(2)); }); + + // The logical_size event should have been handled by now, but state should not have been applied yet. + QTRY_COMPARE(screen->size(), QSize(800, 1200)); + + exec([=] { + xdgOutput->m_output->sendDone(); + }); + + // Finally, the size should change + QTRY_COMPARE(screen->size(), QSize(1024, 768)); + + exec([=] { remove(output(1)); }); +} + QCOMPOSITOR_TEST_MAIN(tst_xdgoutput) #include "tst_xdgoutput.moc" From 75fd4b4669afa9c699b35cd7e0f88f402294c1be Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Tue, 11 Feb 2020 15:45:32 +0100 Subject: [PATCH 0828/1507] Client: Workaround for QPlatformWindow::setVisible(true) being called twice Fixes a crash. Otherwise we created two shell surface objects in some cases. Change-Id: Ieded56261061da6acf27ccabba81c8f578ca1596 Reviewed-by: Pier Luigi Fiorini --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 5 +++++ src/plugins/platforms/wayland/qwaylandwindow_p.h | 1 + 2 files changed, 6 insertions(+) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index c8a01dc2e3f..3a335563c93 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -414,6 +414,11 @@ QPlatformScreen *QWaylandWindow::calculateScreenFromSurfaceEvents() const void QWaylandWindow::setVisible(bool visible) { + // Workaround for issue where setVisible may be called with the same value twice + if (lastVisible == visible) + return; + lastVisible = visible; + if (visible) { if (window()->type() == Qt::Popup || window()->type() == Qt::ToolTip) activePopups << this; diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index 823e4a9701b..352df89daf6 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -270,6 +270,7 @@ private: void handleScreensChanged(); bool mInResizeFromApplyConfigure = false; + bool lastVisible = false; QRect mLastExposeGeometry; static const wl_callback_listener callbackListener; From 9b50fed3c4184ceb49f8f1a225d331bd2733db96 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Tue, 11 Feb 2020 14:46:17 +0100 Subject: [PATCH 0829/1507] Client: Delete decoration object when frameless window hint is added We don't want windows with FramelessWindowHint to have a zxdg_toplevel_decoration_v1 object, because that allows the compositor to force server-side window decorations. We already have code in place that avoids creating the decoration object when the window is created. However, if the frameless window hint is added after the window has been shown, then the decoration object has already been created. The protocol states that if a decoration object is destroyed, the window will switch back to a mode without any server-side decorations on the next commit... so this is what we do in this patch. Unfortunately, there is no clean way to handle the case when the hint is removed while the window is visible since the protocol explicitly forbids creating toplevel decoration objects for surfaces with committed buffers. Discussion is ongoing as to whether this should be fixed in the next version of the protocol: https://gitlab.freedesktop.org/wayland/wayland-protocols/issues/9 If we want to work around it, it is perhaps possible to destroy and create a new wl_surface, but ideally, it will be fixed in the next version of the xdg-decoration protocol and we can just wait for that. Task-number: QTBUG-80702 Change-Id: I7e76c05fc3629f1fbbba1d18482808fe588e3878 Reviewed-by: Shawn Rutledge --- .../xdg-shell/qwaylandxdgshell.cpp | 8 +++++--- .../xdgdecorationv1/tst_xdgdecorationv1.cpp | 20 +++++++++++++++++++ 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp index 56d77ec4f5a..b6d23ac10a6 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp @@ -156,10 +156,12 @@ void QWaylandXdgSurface::Toplevel::xdg_toplevel_close() void QWaylandXdgSurface::Toplevel::requestWindowFlags(Qt::WindowFlags flags) { if (m_decoration) { - if (flags & Qt::FramelessWindowHint) - m_decoration->requestMode(QWaylandXdgToplevelDecorationV1::mode_client_side); - else + if (flags & Qt::FramelessWindowHint) { + delete m_decoration; + m_decoration = nullptr; + } else { m_decoration->unsetMode(); + } } } diff --git a/tests/auto/wayland/xdgdecorationv1/tst_xdgdecorationv1.cpp b/tests/auto/wayland/xdgdecorationv1/tst_xdgdecorationv1.cpp index 391abd83bd2..e02ebeff962 100644 --- a/tests/auto/wayland/xdgdecorationv1/tst_xdgdecorationv1.cpp +++ b/tests/auto/wayland/xdgdecorationv1/tst_xdgdecorationv1.cpp @@ -154,6 +154,7 @@ private slots: void cleanup() { QTRY_VERIFY2(isClean(), qPrintable(dirtyMessage())); } void clientSidePreferredByCompositor(); void initialFramelessWindowHint(); + void delayedFramelessWindowHint(); }; void tst_xdgdecorationv1::initTestCase() @@ -200,5 +201,24 @@ void tst_xdgdecorationv1::initialFramelessWindowHint() QCOMPOSITOR_TRY_VERIFY(!toplevelDecoration()); } +void tst_xdgdecorationv1::delayedFramelessWindowHint() +{ + QRasterWindow window; + window.show(); + QCOMPOSITOR_TRY_COMPARE(get()->resourceMap().size(), 1); + QCOMPOSITOR_TRY_VERIFY(xdgToplevel()); + exec([=]{ + xdgToplevel()->sendCompleteConfigure(); + }); + QCOMPOSITOR_TRY_VERIFY(xdgSurface()->m_committedConfigureSerial); + QCOMPOSITOR_TRY_VERIFY(toplevelDecoration()); + + window.setFlag(Qt::FramelessWindowHint, true); + + // The client should now destroy the decoration object, so the compositor is no longer + // able to force window decorations + QCOMPOSITOR_TRY_VERIFY(!toplevelDecoration()); +} + QCOMPOSITOR_TEST_MAIN(tst_xdgdecorationv1) #include "tst_xdgdecorationv1.moc" From f5e071ee2ce938987ab26b58c9e8a7a028196ffe Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Tue, 25 Feb 2020 15:41:37 +0100 Subject: [PATCH 0830/1507] Use Qt::SplitBehavior in preference to QString::SplitBehavior The Qt version was added in 5.14 "for use as eventual replacement for QString::SplitBehavior." Move another step closer to that goal. Change-Id: Ie19f7580d75694982ac26c08ad5aabb73d830494 Reviewed-by: Johan Helsing --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 3a335563c93..5830c1368c2 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -157,7 +157,7 @@ void QWaylandWindow::initWindow() QFileInfo fi = QCoreApplication::instance()->applicationFilePath(); QStringList domainName = QCoreApplication::instance()->organizationDomain().split(QLatin1Char('.'), - QString::SkipEmptyParts); + Qt::SkipEmptyParts); if (domainName.isEmpty()) { mShellSurface->setAppId(fi.baseName()); From ecd7d9658d340921de7c312b87cd9ac692c2016f Mon Sep 17 00:00:00 2001 From: Samuli Piippo Date: Wed, 26 Feb 2020 16:14:30 +0200 Subject: [PATCH 0831/1507] Test the EGL wayland platform extensions before using them The Khronos headers may be recent enough to have the ifdefs but implementation might still be missing on some platforms. Don't use the extensions unless the configure test passes. Change-Id: I23129115729567fa92bc23da099d27df598fc206 Reviewed-by: James McDonnell --- src/plugins/platforms/wayland/configure.json | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/wayland/configure.json b/src/plugins/platforms/wayland/configure.json index 9b8b4345741..73f233622be 100644 --- a/src/plugins/platforms/wayland/configure.json +++ b/src/plugins/platforms/wayland/configure.json @@ -231,9 +231,14 @@ "condition": "features.wayland-client", "output": [ "privateFeature" ] }, + "egl-extension-platform-wayland": { + "label": "EGL wayland platform extension", + "condition": "features.wayland-client && features.opengl && features.egl && tests.egl_1_5-wayland", + "output": [ "privateFeature" ] + }, "wayland-egl": { "label": "EGL", - "condition": "features.wayland-client && features.opengl && features.egl && libs.wayland-egl && (!config.qnx || tests.egl_1_5-wayland)", + "condition": "features.wayland-client && features.opengl && features.egl && libs.wayland-egl && (!config.qnx || features.egl-extension-platform-wayland)", "output": [ "privateFeature" ] }, "wayland-brcm": { @@ -253,7 +258,7 @@ }, "wayland-drm-egl-server-buffer": { "label": "DRM EGL", - "condition": "features.wayland-client && features.opengl && features.egl && tests.drm-egl-server && (!config.qnx || tests.egl_1_5-wayland)", + "condition": "features.wayland-client && features.opengl && features.egl && tests.drm-egl-server && (!config.qnx || features.egl-extension-platform-wayland)", "output": [ "privateFeature" ] }, "wayland-libhybris-egl-server-buffer": { From ef26bf8ff54f60147f27e1d5caa6afc072f5d4e1 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Tue, 10 Mar 2020 13:08:07 +0100 Subject: [PATCH 0832/1507] Fix incomplete QPainterPath Fixes: QTBUG-82789 Change-Id: I8cab4edfac68aec81bc86cfdf022c3600f7a32a8 Reviewed-by: Jarek Kobus --- .../platforms/wayland/plugins/decorations/bradient/main.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp b/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp index e8e35775e58..e75fda3ced5 100644 --- a/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp +++ b/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp @@ -40,6 +40,7 @@ #include #include +#include #include #include From 613d0b6603ae8d4bc15eeda61809188dadafc894 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Mon, 16 Mar 2020 11:33:49 +0000 Subject: [PATCH 0833/1507] Fix build after header changes in qtbase QTouchDevice is not implicitly included anymore. Change-Id: I4fcfdb70e1850da7243b520df8b2d1deba2e7424 Reviewed-by: Alexandru Croitor --- src/plugins/platforms/wayland/qwaylandinputdevice.cpp | 1 + src/plugins/platforms/wayland/qwaylandtouch.cpp | 2 ++ 2 files changed, 3 insertions(+) diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index e0f0c6c8ec4..1de2ef17cee 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -73,6 +73,7 @@ #endif #include +#include QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandtouch.cpp b/src/plugins/platforms/wayland/qwaylandtouch.cpp index 8f56e7aa6e0..17c41fa8d42 100644 --- a/src/plugins/platforms/wayland/qwaylandtouch.cpp +++ b/src/plugins/platforms/wayland/qwaylandtouch.cpp @@ -42,6 +42,8 @@ #include "qwaylanddisplay_p.h" #include "qwaylandsurface_p.h" +#include + QT_BEGIN_NAMESPACE namespace QtWaylandClient { From 38ab2bf15fe99fab613a4db230b3c8cd926a9e96 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Mon, 16 Mar 2020 11:34:57 +0000 Subject: [PATCH 0834/1507] Fix build after header changes in qtbase QPainterPath is not implicitly included anymore. Change-Id: I5a7a7c9a69f7cdee04c5ca7798811daac15b7bd5 Reviewed-by: Alexandru Croitor --- .../platforms/wayland/plugins/decorations/bradient/main.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp b/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp index e8e35775e58..666dd39d147 100644 --- a/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp +++ b/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp @@ -42,6 +42,7 @@ #include #include #include +#include #include From 8d8e4f3ffb1ccd9ab2cdc855a0ba088d7ca8c475 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Mon, 16 Mar 2020 11:35:19 +0000 Subject: [PATCH 0835/1507] Fix build after event API changes Some deprecated functions were removed in dev. Change-Id: Iad9910051efe0a499f0e0a4f2e151c39ddd0fcd0 Reviewed-by: Alexandru Croitor --- tests/auto/wayland/tabletv2/tst_tabletv2.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/auto/wayland/tabletv2/tst_tabletv2.cpp b/tests/auto/wayland/tabletv2/tst_tabletv2.cpp index 2fe2ff42025..03fb2933d07 100644 --- a/tests/auto/wayland/tabletv2/tst_tabletv2.cpp +++ b/tests/auto/wayland/tabletv2/tst_tabletv2.cpp @@ -465,7 +465,7 @@ protected: case QEvent::TabletEnterProximity: case QEvent::TabletLeaveProximity: { auto *e = static_cast(event); - auto *ev = new QTabletEvent(e->type(), e->posF(), e->globalPosF(), e->device(), + auto *ev = new QTabletEvent(e->type(), e->posF(), e->globalPosF(), e->deviceType(), e->pointerType(), e->pressure(), e->xTilt(), e->yTilt(), e->tangentialPressure(), e->rotation(), e->z(), Qt::KeyboardModifier::NoModifier, e->uniqueId(), @@ -600,7 +600,7 @@ public: void tabletEvent(QTabletEvent *e) override { - m_events << new QTabletEvent(e->type(), e->posF(), e->globalPosF(), e->device(), + m_events << new QTabletEvent(e->type(), e->posF(), e->globalPosF(), e->deviceType(), e->pointerType(), e->pressure(), e->xTilt(), e->yTilt(), e->tangentialPressure(), e->rotation(), e->z(), Qt::KeyboardModifier::NoModifier, e->uniqueId(), e->button(), @@ -705,12 +705,12 @@ void tst_tabletv2::pointerType() QTRY_COMPARE(filter.numEvents(), 1); QTabletEvent *event = filter.popEvent(); QCOMPARE(event->pointerType(), pointerType); - QCOMPARE(event->device(), tabletDevice); + QCOMPARE(event->deviceType(), tabletDevice); QTRY_VERIFY(window.numEvents()); event = window.popEvent(); QCOMPARE(event->pointerType(), pointerType); - QCOMPARE(event->device(), tabletDevice); + QCOMPARE(event->deviceType(), tabletDevice); exec([&] { tabletTool()->sendProximityOut(); @@ -720,7 +720,7 @@ void tst_tabletv2::pointerType() QTRY_VERIFY(filter.numEvents()); event = filter.popEvent(); QCOMPARE(event->pointerType(), pointerType); - QCOMPARE(event->device(), tabletDevice); + QCOMPARE(event->deviceType(), tabletDevice); } void tst_tabletv2::hardwareSerial() From c78ea023d4ea4c90c5f02ecb0f60179e3a5927e2 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Tue, 17 Mar 2020 10:05:25 +0100 Subject: [PATCH 0836/1507] Fix invalid json in qt_attribution.json Amends 4d844d364045977 Change-Id: Ifec3dc5d8698229cc0c2f375eebd5a4ebfd62d35 Reviewed-by: Johan Helsing --- src/3rdparty/wayland/protocols/qt_attribution.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/3rdparty/wayland/protocols/qt_attribution.json b/src/3rdparty/wayland/protocols/qt_attribution.json index ddda0e9716c..87f2422761d 100644 --- a/src/3rdparty/wayland/protocols/qt_attribution.json +++ b/src/3rdparty/wayland/protocols/qt_attribution.json @@ -103,7 +103,7 @@ Copyright (c) 2013 BMW Car IT GmbH" "LicenseId": "MIT", "License": "MIT License", "LicenseFile": "MIT_LICENSE.txt", - "Copyright": "Copyright 2014 © Stephen "Lyude" Chandler Paul + "Copyright": "Copyright 2014 © Stephen \"Lyude\" Chandler Paul Copyright 2015-2016 © Red Hat, Inc." }, From 6f9b27769fc14ad1f631062aba16ba77e4b1c25c Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Tue, 24 Mar 2020 16:23:53 +0100 Subject: [PATCH 0837/1507] CMake: Regenerate and adjust projects after merge Some of the changes that were needed - adjusted wayland macros due to changed target names for plugins - a few direct moc file includes, to get rid of compilation errors - Threads::Threads linking for a few tests - a few special cases for QT_FOR_PRIVATE handling because pro2cmake doesn't handle those correctly at the moment (they map to PRIVATE_MODULE_INTERFACE rather than PRIVATE_LIBRARIES) - just regenerating all projects Change-Id: I418ce91b1c69c7388d41eb22b94a93a9e80fa732 Reviewed-by: Leander Beernaert Reviewed-by: Alexandru Croitor --- .../platforms/wayland/.prev_CMakeLists.txt | 14 ++++++-- src/plugins/platforms/wayland/CMakeLists.txt | 17 ++++++++-- .../decorations/bradient/CMakeLists.txt | 10 +++--- .../brcm-egl/CMakeLists.txt | 15 ++++----- .../dmabuf-server/CMakeLists.txt | 13 ++++---- .../drm-egl-server/CMakeLists.txt | 13 ++++---- .../libhybris-egl-server/CMakeLists.txt | 12 +++---- .../shm-emulation-server/CMakeLists.txt | 13 ++++---- .../vulkan-server/CMakeLists.txt | 13 ++++---- .../wayland-egl/CMakeLists.txt | 14 ++++---- .../xcomposite-egl/CMakeLists.txt | 15 ++++----- .../xcomposite-glx/CMakeLists.txt | 15 ++++----- .../fullscreen-shell-v1/CMakeLists.txt | 14 ++++---- .../shellintegration/wl-shell/CMakeLists.txt | 16 ++++------ .../xdg-shell-v5/CMakeLists.txt | 14 ++++---- .../xdg-shell-v6/CMakeLists.txt | 16 ++++------ .../shellintegration/xdg-shell/CMakeLists.txt | 16 ++++------ .../qtwaylandscanner/.prev_CMakeLists.txt | 15 +++++++++ .../Qt6WaylandClientMacros.cmake | 6 +++- tests/auto/wayland/CMakeLists.txt | 2 ++ .../auto/wayland/client/.prev_CMakeLists.txt | 9 +++--- tests/auto/wayland/client/CMakeLists.txt | 9 +++--- .../wayland/datadevicev1/.prev_CMakeLists.txt | 5 ++- .../auto/wayland/datadevicev1/CMakeLists.txt | 5 ++- .../fullscreenshellv1/.prev_CMakeLists.txt | 9 +++--- .../wayland/fullscreenshellv1/CMakeLists.txt | 9 +++--- .../wayland/inputcontext/.prev_CMakeLists.txt | 5 ++- .../auto/wayland/inputcontext/CMakeLists.txt | 5 ++- .../iviapplication/.prev_CMakeLists.txt | 9 +++--- .../wayland/nooutput/.prev_CMakeLists.txt | 30 +++++++++++++++++ tests/auto/wayland/nooutput/CMakeLists.txt | 31 ++++++++++++++++++ .../auto/wayland/output/.prev_CMakeLists.txt | 5 ++- tests/auto/wayland/output/CMakeLists.txt | 5 ++- .../primaryselectionv1/.prev_CMakeLists.txt | 5 ++- .../wayland/primaryselectionv1/CMakeLists.txt | 5 ++- .../auto/wayland/seatv4/.prev_CMakeLists.txt | 9 ++---- tests/auto/wayland/seatv4/CMakeLists.txt | 9 ++---- .../auto/wayland/seatv5/.prev_CMakeLists.txt | 5 ++- tests/auto/wayland/seatv5/CMakeLists.txt | 5 ++- .../auto/wayland/surface/.prev_CMakeLists.txt | 5 ++- tests/auto/wayland/surface/CMakeLists.txt | 5 ++- .../wayland/tabletv2/.prev_CMakeLists.txt | 31 ++++++++++++++++++ tests/auto/wayland/tabletv2/CMakeLists.txt | 32 +++++++++++++++++++ tests/auto/wayland/wl_connect/CMakeLists.txt | 3 +- .../xdgdecorationv1/.prev_CMakeLists.txt | 5 ++- .../wayland/xdgdecorationv1/CMakeLists.txt | 5 ++- .../wayland/xdgoutput/.prev_CMakeLists.txt | 5 ++- tests/auto/wayland/xdgoutput/CMakeLists.txt | 5 ++- .../wayland/xdgshell/.prev_CMakeLists.txt | 5 ++- tests/auto/wayland/xdgshell/CMakeLists.txt | 5 ++- .../wayland/xdgshellv6/.prev_CMakeLists.txt | 9 +++--- tests/auto/wayland/xdgshellv6/CMakeLists.txt | 9 +++--- 52 files changed, 334 insertions(+), 227 deletions(-) create mode 100644 src/tools/qtwaylandscanner/.prev_CMakeLists.txt create mode 100644 tests/auto/wayland/nooutput/.prev_CMakeLists.txt create mode 100644 tests/auto/wayland/nooutput/CMakeLists.txt create mode 100644 tests/auto/wayland/tabletv2/.prev_CMakeLists.txt create mode 100644 tests/auto/wayland/tabletv2/CMakeLists.txt diff --git a/src/plugins/platforms/wayland/.prev_CMakeLists.txt b/src/plugins/platforms/wayland/.prev_CMakeLists.txt index 274cf70d670..58861b94514 100644 --- a/src/plugins/platforms/wayland/.prev_CMakeLists.txt +++ b/src/plugins/platforms/wayland/.prev_CMakeLists.txt @@ -40,6 +40,7 @@ qt_add_module(WaylandClient qwaylandshmwindow.cpp qwaylandshmwindow_p.h qwaylandsubsurface.cpp qwaylandsubsurface_p.h qwaylandsurface.cpp qwaylandsurface_p.h + qwaylandtabletv2.cpp qwaylandtabletv2_p.h qwaylandtouch.cpp qwaylandtouch_p.h qwaylandwindow.cpp qwaylandwindow_p.h qwaylandwindowmanagerintegration.cpp qwaylandwindowmanagerintegration_p.h @@ -63,10 +64,14 @@ qt_add_module(WaylandClient Qt::Core Qt::Gui Wayland::Client + PRIVATE_MODULE_INTERFACE + Qt::CorePrivate + Qt::GuiPrivate ) qt6_generate_wayland_protocol_client_sources(WaylandClient FILES + ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/tablet-unstable-v2.xml ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/text-input-unstable-v2.xml ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/wayland.xml ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/wp-primary-selection-unstable-v1.xml @@ -99,9 +104,14 @@ qt_extend_target(WaylandClient CONDITION QT_FEATURE_xkbcommon Qt::XkbCommonSupportPrivate ) -qt_extend_target(WaylandClient CONDITION TARGET linuxaccessibility_support_private +qt_extend_target(WaylandClient CONDITION TARGET Qt::PlatformCompositorSupportPrivate LIBRARIES - linuxaccessibility_support_private + Qt::PlatformCompositorSupportPrivate +) + +qt_extend_target(WaylandClient CONDITION TARGET Qt::LinuxAccessibilitySupportPrivate + LIBRARIES + Qt::LinuxAccessibilitySupportPrivate ) qt_extend_target(WaylandClient CONDITION QT_FEATURE_clipboard diff --git a/src/plugins/platforms/wayland/CMakeLists.txt b/src/plugins/platforms/wayland/CMakeLists.txt index 1338651794c..248f7213665 100644 --- a/src/plugins/platforms/wayland/CMakeLists.txt +++ b/src/plugins/platforms/wayland/CMakeLists.txt @@ -40,6 +40,7 @@ qt_add_module(WaylandClient qwaylandshmwindow.cpp qwaylandshmwindow_p.h qwaylandsubsurface.cpp qwaylandsubsurface_p.h qwaylandsurface.cpp qwaylandsurface_p.h + qwaylandtabletv2.cpp qwaylandtabletv2_p.h qwaylandtouch.cpp qwaylandtouch_p.h qwaylandwindow.cpp qwaylandwindow_p.h qwaylandwindowmanagerintegration.cpp qwaylandwindowmanagerintegration_p.h @@ -63,10 +64,15 @@ qt_add_module(WaylandClient Qt::Core Qt::Gui Wayland::Client + PRIVATE_MODULE_INTERFACE + Qt::CorePrivate + Qt::GuiPrivate + Qt::ServiceSupportPrivate # special case QTBUG-83063 ) qt6_generate_wayland_protocol_client_sources(WaylandClient FILES + ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/tablet-unstable-v2.xml ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/text-input-unstable-v2.xml ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/wayland.xml ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/wp-primary-selection-unstable-v1.xml @@ -97,11 +103,18 @@ qt_extend_target(WaylandClient CONDITION QT_FEATURE_vulkan qt_extend_target(WaylandClient CONDITION QT_FEATURE_xkbcommon LIBRARIES Qt::XkbCommonSupportPrivate + PRIVATE_MODULE_INTERFACE # special case QTBUG-83063 + Qt::XkbCommonSupportPrivate # special case ) -qt_extend_target(WaylandClient CONDITION TARGET Qt::LinuxAccessibilitySupportPrivate # special case +qt_extend_target(WaylandClient CONDITION TARGET Qt::PlatformCompositorSupportPrivate LIBRARIES - Qt::LinuxAccessibilitySupportPrivate # special case + Qt::PlatformCompositorSupportPrivate +) + +qt_extend_target(WaylandClient CONDITION TARGET Qt::LinuxAccessibilitySupportPrivate + LIBRARIES + Qt::LinuxAccessibilitySupportPrivate ) qt_extend_target(WaylandClient CONDITION QT_FEATURE_clipboard diff --git a/src/plugins/platforms/wayland/plugins/decorations/bradient/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/decorations/bradient/CMakeLists.txt index 760718cac7c..9bd875a40c9 100644 --- a/src/plugins/platforms/wayland/plugins/decorations/bradient/CMakeLists.txt +++ b/src/plugins/platforms/wayland/plugins/decorations/bradient/CMakeLists.txt @@ -1,20 +1,18 @@ # Generated from bradient.pro. ##################################################################### -## bradient Plugin: +## QWaylandBradientDecorationPlugin Plugin: ##################################################################### -qt_add_plugin(bradient +qt_add_plugin(QWaylandBradientDecorationPlugin + OUTPUT_NAME bradient TYPE wayland-decoration-client - CLASS_NAME QWaylandBradientDecorationPlugin SOURCES main.cpp - LIBRARIES - Qt::WaylandClientPrivate PUBLIC_LIBRARIES Qt::Core Qt::Gui - Qt::WaylandClient + Qt::WaylandClientPrivate Wayland::Client ) diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/CMakeLists.txt index e02b020e6df..038a8843c0f 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/CMakeLists.txt +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/CMakeLists.txt @@ -1,12 +1,12 @@ # Generated from brcm-egl.pro. ##################################################################### -## brcm-egl Plugin: +## QWaylandBrcmEglClientBufferPlugin Plugin: ##################################################################### -qt_add_plugin(brcm-egl +qt_add_plugin(QWaylandBrcmEglClientBufferPlugin + OUTPUT_NAME brcm-egl TYPE wayland-graphics-integration-client - CLASS_NAME QWaylandBrcmEglClientBufferPlugin SOURCES ../../../../hardwareintegration/client/brcm-egl/qwaylandbrcmeglintegration.cpp ../../../../hardwareintegration/client/brcm-egl/qwaylandbrcmeglintegration.h ../../../../hardwareintegration/client/brcm-egl/qwaylandbrcmeglwindow.cpp ../../../../hardwareintegration/client/brcm-egl/qwaylandbrcmeglwindow.h @@ -14,20 +14,17 @@ qt_add_plugin(brcm-egl main.cpp INCLUDE_DIRECTORIES ../../../../hardwareintegration/client/brcm-egl - LIBRARIES - Qt::EglSupportPrivate - Qt::WaylandClientPrivate PUBLIC_LIBRARIES ${CMAKE_DL_LIBS} EGL::EGL Qt::Core - Qt::EglSupport + Qt::EglSupportPrivate Qt::Gui - Qt::WaylandClient + Qt::WaylandClientPrivate Wayland::Client ) -qt6_generate_wayland_protocol_client_sources(brcm-egl +qt6_generate_wayland_protocol_client_sources(QWaylandBrcmEglClientBufferPlugin FILES ${CMAKE_CURRENT_SOURCE_DIR}/../../../../hardwareintegration/client/brcm-egl/../../../extensions/brcm.xml ) diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/dmabuf-server/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/hardwareintegration/dmabuf-server/CMakeLists.txt index 41d7c12e252..f31e868ac8c 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/dmabuf-server/CMakeLists.txt +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/dmabuf-server/CMakeLists.txt @@ -1,28 +1,27 @@ # Generated from dmabuf-server.pro. ##################################################################### -## dmabuf-server Plugin: +## DmaBufServerBufferPlugin Plugin: ##################################################################### -qt_add_plugin(dmabuf-server +qt_add_plugin(DmaBufServerBufferPlugin + OUTPUT_NAME dmabuf-server TYPE wayland-graphics-integration-client - CLASS_NAME DmaBufServerBufferPlugin SOURCES ../../../../hardwareintegration/client/dmabuf-server/dmabufserverbufferintegration.cpp ../../../../hardwareintegration/client/dmabuf-server/dmabufserverbufferintegration.h main.cpp INCLUDE_DIRECTORIES ../../../../hardwareintegration/client/dmabuf-server - LIBRARIES - Qt::WaylandClientPrivate PUBLIC_LIBRARIES EGL::EGL Qt::Core Qt::Gui - Qt::WaylandClient + Qt::OpenGL + Qt::WaylandClientPrivate Wayland::Client ) -qt6_generate_wayland_protocol_client_sources(dmabuf-server +qt6_generate_wayland_protocol_client_sources(DmaBufServerBufferPlugin FILES ${CMAKE_CURRENT_SOURCE_DIR}/../../../../hardwareintegration/client/dmabuf-server/../../../extensions/qt-dmabuf-server-buffer.xml ) diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/drm-egl-server/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/hardwareintegration/drm-egl-server/CMakeLists.txt index 337857cc259..ce3f9425408 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/drm-egl-server/CMakeLists.txt +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/drm-egl-server/CMakeLists.txt @@ -1,28 +1,27 @@ # Generated from drm-egl-server.pro. ##################################################################### -## drm-egl-server Plugin: +## DrmEglServerBufferPlugin Plugin: ##################################################################### -qt_add_plugin(drm-egl-server +qt_add_plugin(DrmEglServerBufferPlugin + OUTPUT_NAME drm-egl-server TYPE wayland-graphics-integration-client - CLASS_NAME DrmEglServerBufferPlugin SOURCES ../../../../hardwareintegration/client/drm-egl-server/drmeglserverbufferintegration.cpp ../../../../hardwareintegration/client/drm-egl-server/drmeglserverbufferintegration.h main.cpp INCLUDE_DIRECTORIES ../../../../hardwareintegration/client/drm-egl-server - LIBRARIES - Qt::WaylandClientPrivate PUBLIC_LIBRARIES EGL::EGL Qt::Core Qt::Gui - Qt::WaylandClient + Qt::OpenGL + Qt::WaylandClientPrivate Wayland::Client ) -qt6_generate_wayland_protocol_client_sources(drm-egl-server +qt6_generate_wayland_protocol_client_sources(DrmEglServerBufferPlugin FILES ${CMAKE_CURRENT_SOURCE_DIR}/../../../../hardwareintegration/client/drm-egl-server/../../../extensions/drm-egl-server-buffer.xml ) diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/libhybris-egl-server/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/hardwareintegration/libhybris-egl-server/CMakeLists.txt index ca1738f50f3..24cc9219e04 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/libhybris-egl-server/CMakeLists.txt +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/libhybris-egl-server/CMakeLists.txt @@ -1,28 +1,26 @@ # Generated from libhybris-egl-server.pro. ##################################################################### -## libhybris-egl-server Plugin: +## LibHybrisEglServerBufferPlugin Plugin: ##################################################################### -qt_add_plugin(libhybris-egl-server +qt_add_plugin(LibHybrisEglServerBufferPlugin + OUTPUT_NAME libhybris-egl-server TYPE wayland-graphics-integration-client - CLASS_NAME LibHybrisEglServerBufferPlugin SOURCES ../../../../hardwareintegration/client/libhybris-egl-server/libhybriseglserverbufferintegration.cpp ../../../../hardwareintegration/client/libhybris-egl-server/libhybriseglserverbufferintegration.h main.cpp INCLUDE_DIRECTORIES ../../../../hardwareintegration/client/libhybris-egl-server - LIBRARIES - Qt::WaylandClientPrivate PUBLIC_LIBRARIES EGL::EGL Qt::Core Qt::Gui - Qt::WaylandClient + Qt::WaylandClientPrivate Wayland::Client ) -qt6_generate_wayland_protocol_client_sources(libhybris-egl-server +qt6_generate_wayland_protocol_client_sources(LibHybrisEglServerBufferPlugin FILES ${CMAKE_CURRENT_SOURCE_DIR}/../../../../hardwareintegration/client/libhybris-egl-server/../../../extensions/libhybris-egl-server-buffer.xml ) diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/shm-emulation-server/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/hardwareintegration/shm-emulation-server/CMakeLists.txt index d7a7294ec9a..aa6e443311c 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/shm-emulation-server/CMakeLists.txt +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/shm-emulation-server/CMakeLists.txt @@ -1,27 +1,26 @@ # Generated from shm-emulation-server.pro. ##################################################################### -## shm-emulation-server Plugin: +## ShmServerBufferPlugin Plugin: ##################################################################### -qt_add_plugin(shm-emulation-server +qt_add_plugin(ShmServerBufferPlugin + OUTPUT_NAME shm-emulation-server TYPE wayland-graphics-integration-client - CLASS_NAME ShmServerBufferPlugin SOURCES ../../../../hardwareintegration/client/shm-emulation-server/shmserverbufferintegration.cpp ../../../../hardwareintegration/client/shm-emulation-server/shmserverbufferintegration.h main.cpp INCLUDE_DIRECTORIES ../../../../hardwareintegration/client/shm-emulation-server - LIBRARIES - Qt::WaylandClientPrivate PUBLIC_LIBRARIES Qt::Core Qt::Gui - Qt::WaylandClient + Qt::OpenGL + Qt::WaylandClientPrivate Wayland::Client ) -qt6_generate_wayland_protocol_client_sources(shm-emulation-server +qt6_generate_wayland_protocol_client_sources(ShmServerBufferPlugin FILES ${CMAKE_CURRENT_SOURCE_DIR}/../../../../hardwareintegration/client/shm-emulation-server/../../../extensions/shm-emulation-server-buffer.xml ) diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/vulkan-server/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/hardwareintegration/vulkan-server/CMakeLists.txt index 46ad01249d2..64ea378faad 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/vulkan-server/CMakeLists.txt +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/vulkan-server/CMakeLists.txt @@ -1,27 +1,26 @@ # Generated from vulkan-server.pro. ##################################################################### -## vulkan-server Plugin: +## VulkanServerBufferPlugin Plugin: ##################################################################### -qt_add_plugin(vulkan-server +qt_add_plugin(VulkanServerBufferPlugin + OUTPUT_NAME vulkan-server TYPE wayland-graphics-integration-client - CLASS_NAME VulkanServerBufferPlugin SOURCES ../../../../hardwareintegration/client/vulkan-server/vulkanserverbufferintegration.cpp ../../../../hardwareintegration/client/vulkan-server/vulkanserverbufferintegration.h main.cpp INCLUDE_DIRECTORIES ../../../../hardwareintegration/client/vulkan-server - LIBRARIES - Qt::WaylandClientPrivate PUBLIC_LIBRARIES Qt::Core Qt::Gui - Qt::WaylandClient + Qt::OpenGL + Qt::WaylandClientPrivate Wayland::Client ) -qt6_generate_wayland_protocol_client_sources(vulkan-server +qt6_generate_wayland_protocol_client_sources(VulkanServerBufferPlugin FILES ${CMAKE_CURRENT_SOURCE_DIR}/../../../../hardwareintegration/client/vulkan-server/../../../extensions/qt-vulkan-server-buffer-unstable-v1.xml ) diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/CMakeLists.txt index cbe1b6a9f9a..2eaf092ccf5 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/CMakeLists.txt +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/CMakeLists.txt @@ -1,12 +1,12 @@ # Generated from wayland-egl.pro. ##################################################################### -## qt-plugin-wayland-egl Plugin: +## QWaylandEglClientBufferPlugin Plugin: ##################################################################### -qt_add_plugin(qt-plugin-wayland-egl +qt_add_plugin(QWaylandEglClientBufferPlugin + OUTPUT_NAME qt-plugin-wayland-egl TYPE wayland-graphics-integration-client - CLASS_NAME QWaylandEglClientBufferPlugin SOURCES ../../../../hardwareintegration/client/wayland-egl/qwaylandeglclientbufferintegration.cpp ../../../../hardwareintegration/client/wayland-egl/qwaylandeglclientbufferintegration.h ../../../../hardwareintegration/client/wayland-egl/qwaylandeglinclude.h @@ -15,15 +15,13 @@ qt_add_plugin(qt-plugin-wayland-egl main.cpp INCLUDE_DIRECTORIES ../../../../hardwareintegration/client/wayland-egl - LIBRARIES - Qt::EglSupportPrivate - Qt::WaylandClientPrivate PUBLIC_LIBRARIES EGL::EGL Qt::Core - Qt::EglSupport + Qt::EglSupportPrivate Qt::Gui - Qt::WaylandClient + Qt::OpenGLPrivate + Qt::WaylandClientPrivate Wayland::Client Wayland::Egl ) diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-egl/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-egl/CMakeLists.txt index a4b6e27413b..972cb1ace27 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-egl/CMakeLists.txt +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-egl/CMakeLists.txt @@ -1,12 +1,12 @@ # Generated from xcomposite-egl.pro. ##################################################################### -## xcomposite-egl Plugin: +## QWaylandXCompositeEglClientBufferPlugin Plugin: ##################################################################### -qt_add_plugin(xcomposite-egl +qt_add_plugin(QWaylandXCompositeEglClientBufferPlugin + OUTPUT_NAME xcomposite-egl TYPE wayland-graphics-integration-client - CLASS_NAME QWaylandXCompositeEglClientBufferPlugin SOURCES ../../../../hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglclientbufferintegration.cpp ../../../../hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglclientbufferintegration.h ../../../../hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglcontext.cpp ../../../../hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglcontext.h @@ -16,21 +16,18 @@ qt_add_plugin(xcomposite-egl INCLUDE_DIRECTORIES ../../../../hardwareintegration/client/xcomposite-egl ../../../../hardwareintegration/client/xcomposite_share - LIBRARIES - Qt::EglSupportPrivate - Qt::WaylandClientPrivate PUBLIC_LIBRARIES EGL::EGL PkgConfig::XComposite Qt::Core - Qt::EglSupport + Qt::EglSupportPrivate Qt::Gui - Qt::WaylandClient + Qt::WaylandClientPrivate Wayland::Client X11::X11 ) -qt6_generate_wayland_protocol_client_sources(xcomposite-egl +qt6_generate_wayland_protocol_client_sources(QWaylandXCompositeEglClientBufferPlugin FILES ${CMAKE_CURRENT_SOURCE_DIR}/../../../../hardwareintegration/client/xcomposite_share/../../../extensions/xcomposite.xml ) diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-glx/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-glx/CMakeLists.txt index 179dd8db2e5..d074fe4ee3d 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-glx/CMakeLists.txt +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-glx/CMakeLists.txt @@ -1,12 +1,12 @@ # Generated from xcomposite-glx.pro. ##################################################################### -## xcomposite-glx Plugin: +## QWaylandXCompositeGlxClientBufferPlugin Plugin: ##################################################################### -qt_add_plugin(xcomposite-glx +qt_add_plugin(QWaylandXCompositeGlxClientBufferPlugin + OUTPUT_NAME xcomposite-glx TYPE wayland-graphics-integration-client - CLASS_NAME QWaylandXCompositeGlxClientBufferPlugin SOURCES ../../../../hardwareintegration/client/xcomposite-glx/qwaylandxcompositeglxcontext.cpp ../../../../hardwareintegration/client/xcomposite-glx/qwaylandxcompositeglxcontext.h ../../../../hardwareintegration/client/xcomposite-glx/qwaylandxcompositeglxintegration.cpp ../../../../hardwareintegration/client/xcomposite-glx/qwaylandxcompositeglxintegration.h @@ -16,21 +16,18 @@ qt_add_plugin(xcomposite-glx INCLUDE_DIRECTORIES ../../../../hardwareintegration/client/xcomposite-glx ../../../../hardwareintegration/client/xcomposite_share - LIBRARIES - Qt::GlxSupportPrivate - Qt::WaylandClientPrivate PUBLIC_LIBRARIES ${CMAKE_DL_LIBS} PkgConfig::XComposite Qt::Core - Qt::GlxSupport + Qt::GlxSupportPrivate Qt::Gui - Qt::WaylandClient + Qt::WaylandClientPrivate Wayland::Client X11::X11 ) -qt6_generate_wayland_protocol_client_sources(xcomposite-glx +qt6_generate_wayland_protocol_client_sources(QWaylandXCompositeGlxClientBufferPlugin FILES ${CMAKE_CURRENT_SOURCE_DIR}/../../../../hardwareintegration/client/xcomposite_share/../../../extensions/xcomposite.xml ) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/fullscreen-shell-v1/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/shellintegration/fullscreen-shell-v1/CMakeLists.txt index 7cc47c75729..9e068dfe280 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/fullscreen-shell-v1/CMakeLists.txt +++ b/src/plugins/platforms/wayland/plugins/shellintegration/fullscreen-shell-v1/CMakeLists.txt @@ -1,27 +1,25 @@ # Generated from fullscreen-shell-v1.pro. ##################################################################### -## fullscreen-shell-v1 Plugin: +## QWaylandFullScreenShellV1IntegrationPlugin Plugin: ##################################################################### -qt_add_plugin(fullscreen-shell-v1 +qt_add_plugin(QWaylandFullScreenShellV1IntegrationPlugin + OUTPUT_NAME fullscreen-shell-v1 TYPE wayland-shell-integration - CLASS_NAME QWaylandFullScreenShellV1IntegrationPlugin SOURCES main.cpp qwaylandfullscreenshellv1integration.cpp qwaylandfullscreenshellv1integration.h qwaylandfullscreenshellv1surface.cpp qwaylandfullscreenshellv1surface.h - LIBRARIES - Qt::GuiPrivate - Qt::WaylandClientPrivate PUBLIC_LIBRARIES Qt::Core Qt::Gui - Qt::WaylandClient + Qt::GuiPrivate + Qt::WaylandClientPrivate Wayland::Client ) -qt6_generate_wayland_protocol_client_sources(fullscreen-shell-v1 +qt6_generate_wayland_protocol_client_sources(QWaylandFullScreenShellV1IntegrationPlugin FILES ${CMAKE_CURRENT_SOURCE_DIR}/../../../3rdparty/protocol/fullscreen-shell-unstable-v1.xml ) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/CMakeLists.txt index 85891524287..496bbe68c09 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/CMakeLists.txt +++ b/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/CMakeLists.txt @@ -1,27 +1,25 @@ # Generated from wl-shell.pro. ##################################################################### -## wl-shell Plugin: +## QWaylandWlShellIntegrationPlugin Plugin: ##################################################################### -qt_add_plugin(wl-shell +qt_add_plugin(QWaylandWlShellIntegrationPlugin + OUTPUT_NAME wl-shell TYPE wayland-shell-integration - CLASS_NAME QWaylandWlShellIntegrationPlugin SOURCES main.cpp qwaylandwlshellintegration.cpp qwaylandwlshellintegration_p.h qwaylandwlshellsurface.cpp qwaylandwlshellsurface_p.h - LIBRARIES - Qt::GuiPrivate - Qt::WaylandClientPrivate PUBLIC_LIBRARIES Qt::Core Qt::Gui - Qt::WaylandClient + Qt::GuiPrivate + Qt::WaylandClientPrivate Wayland::Client ) -qt6_generate_wayland_protocol_client_sources(wl-shell +qt6_generate_wayland_protocol_client_sources(QWaylandWlShellIntegrationPlugin FILES ${CMAKE_CURRENT_SOURCE_DIR}/../../../3rdparty/protocol/wayland.xml ) @@ -32,7 +30,7 @@ qt6_generate_wayland_protocol_client_sources(wl-shell ## Scopes: ##################################################################### -qt_extend_target(wl-shell CONDITION QT_FEATURE_xkbcommon +qt_extend_target(QWaylandWlShellIntegrationPlugin CONDITION QT_FEATURE_xkbcommon LIBRARIES XKB::XKB ) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/CMakeLists.txt index 3fa2ba746a4..fec8b2c89a2 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/CMakeLists.txt +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/CMakeLists.txt @@ -1,12 +1,12 @@ # Generated from xdg-shell-v5.pro. ##################################################################### -## xdg-shell-v5 Plugin: +## QWaylandXdgShellV5IntegrationPlugin Plugin: ##################################################################### -qt_add_plugin(xdg-shell-v5 +qt_add_plugin(QWaylandXdgShellV5IntegrationPlugin + OUTPUT_NAME xdg-shell-v5 TYPE wayland-shell-integration - CLASS_NAME QWaylandXdgShellV5IntegrationPlugin SOURCES main.cpp pregenerated/3rdparty/qwayland-xdg-shell-unstable-v5.cpp pregenerated/3rdparty/qwayland-xdg-shell-unstable-v5_p.h @@ -18,13 +18,11 @@ qt_add_plugin(xdg-shell-v5 qwaylandxdgsurfacev5.cpp qwaylandxdgsurfacev5_p.h INCLUDE_DIRECTORIES pregenerated/3rdparty - LIBRARIES - Qt::GuiPrivate - Qt::WaylandClientPrivate PUBLIC_LIBRARIES Qt::Core Qt::Gui - Qt::WaylandClient + Qt::GuiPrivate + Qt::WaylandClientPrivate Wayland::Client ) @@ -34,7 +32,7 @@ qt_add_plugin(xdg-shell-v5 ## Scopes: ##################################################################### -qt_extend_target(xdg-shell-v5 CONDITION QT_FEATURE_xkbcommon +qt_extend_target(QWaylandXdgShellV5IntegrationPlugin CONDITION QT_FEATURE_xkbcommon PUBLIC_LIBRARIES XKB::XKB ) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/CMakeLists.txt index d6fa7dd6a45..094610155fa 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/CMakeLists.txt +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/CMakeLists.txt @@ -1,27 +1,25 @@ # Generated from xdg-shell-v6.pro. ##################################################################### -## xdg-shell-v6 Plugin: +## QWaylandXdgShellV6IntegrationPlugin Plugin: ##################################################################### -qt_add_plugin(xdg-shell-v6 +qt_add_plugin(QWaylandXdgShellV6IntegrationPlugin + OUTPUT_NAME xdg-shell-v6 TYPE wayland-shell-integration - CLASS_NAME QWaylandXdgShellV6IntegrationPlugin SOURCES main.cpp qwaylandxdgshellv6.cpp qwaylandxdgshellv6_p.h qwaylandxdgshellv6integration.cpp qwaylandxdgshellv6integration_p.h - LIBRARIES - Qt::GuiPrivate - Qt::WaylandClientPrivate PUBLIC_LIBRARIES Qt::Core Qt::Gui - Qt::WaylandClient + Qt::GuiPrivate + Qt::WaylandClientPrivate Wayland::Client ) -qt6_generate_wayland_protocol_client_sources(xdg-shell-v6 +qt6_generate_wayland_protocol_client_sources(QWaylandXdgShellV6IntegrationPlugin FILES ${CMAKE_CURRENT_SOURCE_DIR}/../../../3rdparty/protocol/xdg-shell-unstable-v6.xml ) @@ -32,7 +30,7 @@ qt6_generate_wayland_protocol_client_sources(xdg-shell-v6 ## Scopes: ##################################################################### -qt_extend_target(xdg-shell-v6 CONDITION QT_FEATURE_xkbcommon +qt_extend_target(QWaylandXdgShellV6IntegrationPlugin CONDITION QT_FEATURE_xkbcommon LIBRARIES XKB::XKB ) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/CMakeLists.txt index 96a02fc7f85..848a0ec603b 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/CMakeLists.txt +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/CMakeLists.txt @@ -1,28 +1,26 @@ # Generated from xdg-shell.pro. ##################################################################### -## xdg-shell Plugin: +## QWaylandXdgShellIntegrationPlugin Plugin: ##################################################################### -qt_add_plugin(xdg-shell +qt_add_plugin(QWaylandXdgShellIntegrationPlugin + OUTPUT_NAME xdg-shell TYPE wayland-shell-integration - CLASS_NAME QWaylandXdgShellIntegrationPlugin SOURCES main.cpp qwaylandxdgdecorationv1.cpp qwaylandxdgdecorationv1_p.h qwaylandxdgshell.cpp qwaylandxdgshell_p.h qwaylandxdgshellintegration.cpp qwaylandxdgshellintegration_p.h - LIBRARIES - Qt::GuiPrivate - Qt::WaylandClientPrivate PUBLIC_LIBRARIES Qt::Core Qt::Gui - Qt::WaylandClient + Qt::GuiPrivate + Qt::WaylandClientPrivate Wayland::Client ) -qt6_generate_wayland_protocol_client_sources(xdg-shell +qt6_generate_wayland_protocol_client_sources(QWaylandXdgShellIntegrationPlugin FILES ${CMAKE_CURRENT_SOURCE_DIR}/../../../3rdparty/protocol/xdg-decoration-unstable-v1.xml ${CMAKE_CURRENT_SOURCE_DIR}/../../../3rdparty/protocol/xdg-shell.xml @@ -34,7 +32,7 @@ qt6_generate_wayland_protocol_client_sources(xdg-shell ## Scopes: ##################################################################### -qt_extend_target(xdg-shell CONDITION QT_FEATURE_xkbcommon +qt_extend_target(QWaylandXdgShellIntegrationPlugin CONDITION QT_FEATURE_xkbcommon LIBRARIES XKB::XKB ) diff --git a/src/tools/qtwaylandscanner/.prev_CMakeLists.txt b/src/tools/qtwaylandscanner/.prev_CMakeLists.txt new file mode 100644 index 00000000000..bb413544cb5 --- /dev/null +++ b/src/tools/qtwaylandscanner/.prev_CMakeLists.txt @@ -0,0 +1,15 @@ +# Generated from qtwaylandscanner.pro. + +##################################################################### +## qtwaylandscanner Tool: +##################################################################### + +qt_add_tool(qtwaylandscanner + SOURCES + qtwaylandscanner.cpp + PUBLIC_LIBRARIES + Qt::Gui +) + +#### Keys ignored in scope 1:.:.:qtwaylandscanner.pro:: +# _OPTION = "host_build" diff --git a/src/tools/qtwaylandscanner/Qt6WaylandClientMacros.cmake b/src/tools/qtwaylandscanner/Qt6WaylandClientMacros.cmake index 83e557ffd4d..6624c84f26e 100644 --- a/src/tools/qtwaylandscanner/Qt6WaylandClientMacros.cmake +++ b/src/tools/qtwaylandscanner/Qt6WaylandClientMacros.cmake @@ -37,7 +37,11 @@ function(qt6_generate_wayland_protocol_client_sources target) # TODO: We need this hack in order to get the xcomposite plugins to build... # unfortunately, it's not going to work outside QtWayland because we're using waylandclient-private includes set(qtwaylandscanner_code_include "") - set (targets_that_need_include "xcomposite-egl" "xcomposite-glx" "qwayland-xcomposite-egl" "qwayland-xcomposite-glx") + set (targets_that_need_include + "QWaylandXCompositeEglClientBufferPlugin" + "QWaylandXCompositeGlxClientBufferPlugin" + "QWaylandXCompositeEglPlatformIntegrationPlugin" + "QWaylandXCompositeGlxPlatformIntegrationPlugin") if ("${target}" IN_LIST targets_that_need_include OR is_for_module) set(qtwaylandscanner_code_include "") endif() diff --git a/tests/auto/wayland/CMakeLists.txt b/tests/auto/wayland/CMakeLists.txt index bd18ec3e185..5939853ccd4 100644 --- a/tests/auto/wayland/CMakeLists.txt +++ b/tests/auto/wayland/CMakeLists.txt @@ -4,11 +4,13 @@ add_subdirectory(client) add_subdirectory(datadevicev1) add_subdirectory(fullscreenshellv1) add_subdirectory(iviapplication) +add_subdirectory(nooutput) add_subdirectory(output) add_subdirectory(primaryselectionv1) add_subdirectory(seatv4) add_subdirectory(seatv5) add_subdirectory(surface) +add_subdirectory(tabletv2) add_subdirectory(wl_connect) add_subdirectory(xdgdecorationv1) add_subdirectory(xdgoutput) diff --git a/tests/auto/wayland/client/.prev_CMakeLists.txt b/tests/auto/wayland/client/.prev_CMakeLists.txt index 6fe4bb92d8c..c52ab320b98 100644 --- a/tests/auto/wayland/client/.prev_CMakeLists.txt +++ b/tests/auto/wayland/client/.prev_CMakeLists.txt @@ -17,13 +17,12 @@ qt_add_test(tst_client tst_client.cpp INCLUDE_DIRECTORIES ../shared_old - LIBRARIES - Qt::CorePrivate - Qt::GuiPrivate - Qt::WaylandClientPrivate PUBLIC_LIBRARIES + Qt::CorePrivate Qt::Gui - Qt::WaylandClient + Qt::GuiPrivate + Qt::OpenGL + Qt::WaylandClientPrivate Wayland::Client Wayland::Server ) diff --git a/tests/auto/wayland/client/CMakeLists.txt b/tests/auto/wayland/client/CMakeLists.txt index a20ea811ce8..f7e317c772e 100644 --- a/tests/auto/wayland/client/CMakeLists.txt +++ b/tests/auto/wayland/client/CMakeLists.txt @@ -17,13 +17,12 @@ qt_add_test(tst_client tst_client.cpp INCLUDE_DIRECTORIES ../shared_old - LIBRARIES - Qt::CorePrivate - Qt::GuiPrivate - Qt::WaylandClientPrivate PUBLIC_LIBRARIES + Qt::CorePrivate Qt::Gui - Qt::WaylandClient + Qt::GuiPrivate + Qt::OpenGL + Qt::WaylandClientPrivate Wayland::Client Wayland::Server Threads::Threads # special case diff --git a/tests/auto/wayland/datadevicev1/.prev_CMakeLists.txt b/tests/auto/wayland/datadevicev1/.prev_CMakeLists.txt index bfea1434910..97dedb85579 100644 --- a/tests/auto/wayland/datadevicev1/.prev_CMakeLists.txt +++ b/tests/auto/wayland/datadevicev1/.prev_CMakeLists.txt @@ -15,11 +15,10 @@ qt_add_test(tst_datadevicev1 tst_datadevicev1.cpp INCLUDE_DIRECTORIES ../shared - LIBRARIES - Qt::WaylandClientPrivate PUBLIC_LIBRARIES Qt::Gui - Qt::WaylandClient + Qt::OpenGL + Qt::WaylandClientPrivate Wayland::Server ) diff --git a/tests/auto/wayland/datadevicev1/CMakeLists.txt b/tests/auto/wayland/datadevicev1/CMakeLists.txt index ad58772d4b0..e635e33ce4a 100644 --- a/tests/auto/wayland/datadevicev1/CMakeLists.txt +++ b/tests/auto/wayland/datadevicev1/CMakeLists.txt @@ -15,11 +15,10 @@ qt_add_test(tst_datadevicev1 tst_datadevicev1.cpp INCLUDE_DIRECTORIES ../shared - LIBRARIES - Qt::WaylandClientPrivate PUBLIC_LIBRARIES Qt::Gui - Qt::WaylandClient + Qt::OpenGL + Qt::WaylandClientPrivate Wayland::Server Threads::Threads # special case ) diff --git a/tests/auto/wayland/fullscreenshellv1/.prev_CMakeLists.txt b/tests/auto/wayland/fullscreenshellv1/.prev_CMakeLists.txt index 5daef3bb3ff..c9e5eae13a8 100644 --- a/tests/auto/wayland/fullscreenshellv1/.prev_CMakeLists.txt +++ b/tests/auto/wayland/fullscreenshellv1/.prev_CMakeLists.txt @@ -17,13 +17,12 @@ qt_add_test(tst_client_fullscreenshellv1 tst_fullscreenshellv1.cpp INCLUDE_DIRECTORIES ../shared_old - LIBRARIES - Qt::CorePrivate - Qt::GuiPrivate - Qt::WaylandClientPrivate PUBLIC_LIBRARIES + Qt::CorePrivate Qt::Gui - Qt::WaylandClient + Qt::GuiPrivate + Qt::OpenGL + Qt::WaylandClientPrivate Wayland::Client Wayland::Server ) diff --git a/tests/auto/wayland/fullscreenshellv1/CMakeLists.txt b/tests/auto/wayland/fullscreenshellv1/CMakeLists.txt index 00348df9948..73d92ead8ee 100644 --- a/tests/auto/wayland/fullscreenshellv1/CMakeLists.txt +++ b/tests/auto/wayland/fullscreenshellv1/CMakeLists.txt @@ -17,13 +17,12 @@ qt_add_test(tst_client_fullscreenshellv1 tst_fullscreenshellv1.cpp INCLUDE_DIRECTORIES ../shared_old - LIBRARIES - Qt::CorePrivate - Qt::GuiPrivate - Qt::WaylandClientPrivate PUBLIC_LIBRARIES + Qt::CorePrivate Qt::Gui - Qt::WaylandClient + Qt::GuiPrivate + Qt::OpenGL + Qt::WaylandClientPrivate Wayland::Client Wayland::Server Threads::Threads # special case diff --git a/tests/auto/wayland/inputcontext/.prev_CMakeLists.txt b/tests/auto/wayland/inputcontext/.prev_CMakeLists.txt index d5df86a13eb..cf2301e770d 100644 --- a/tests/auto/wayland/inputcontext/.prev_CMakeLists.txt +++ b/tests/auto/wayland/inputcontext/.prev_CMakeLists.txt @@ -15,11 +15,10 @@ qt_add_test(tst_inputcontext tst_inputcontext.cpp INCLUDE_DIRECTORIES ../shared - LIBRARIES - Qt::WaylandClientPrivate PUBLIC_LIBRARIES Qt::Gui - Qt::WaylandClient + Qt::OpenGL + Qt::WaylandClientPrivate Wayland::Server ) diff --git a/tests/auto/wayland/inputcontext/CMakeLists.txt b/tests/auto/wayland/inputcontext/CMakeLists.txt index dfa788b313b..f061a7ea239 100644 --- a/tests/auto/wayland/inputcontext/CMakeLists.txt +++ b/tests/auto/wayland/inputcontext/CMakeLists.txt @@ -15,11 +15,10 @@ qt_add_test(tst_inputcontext tst_inputcontext.cpp INCLUDE_DIRECTORIES ../shared - LIBRARIES - Qt::WaylandClientPrivate PUBLIC_LIBRARIES Qt::Gui - Qt::WaylandClient + Qt::OpenGL + Qt::WaylandClientPrivate Wayland::Server Threads::Threads # special case ) diff --git a/tests/auto/wayland/iviapplication/.prev_CMakeLists.txt b/tests/auto/wayland/iviapplication/.prev_CMakeLists.txt index 4193ba9b07f..0453aad8190 100644 --- a/tests/auto/wayland/iviapplication/.prev_CMakeLists.txt +++ b/tests/auto/wayland/iviapplication/.prev_CMakeLists.txt @@ -17,13 +17,12 @@ qt_add_test(tst_client_iviapplication tst_iviapplication.cpp INCLUDE_DIRECTORIES ../shared_old - LIBRARIES - Qt::CorePrivate - Qt::GuiPrivate - Qt::WaylandClientPrivate PUBLIC_LIBRARIES + Qt::CorePrivate Qt::Gui - Qt::WaylandClient + Qt::GuiPrivate + Qt::OpenGL + Qt::WaylandClientPrivate Wayland::Client Wayland::Server ) diff --git a/tests/auto/wayland/nooutput/.prev_CMakeLists.txt b/tests/auto/wayland/nooutput/.prev_CMakeLists.txt new file mode 100644 index 00000000000..3f09f584c21 --- /dev/null +++ b/tests/auto/wayland/nooutput/.prev_CMakeLists.txt @@ -0,0 +1,30 @@ +# Generated from nooutput.pro. + +##################################################################### +## tst_nooutput Test: +##################################################################### + +qt_add_test(tst_nooutput + SOURCES + ../shared/corecompositor.cpp ../shared/corecompositor.h + ../shared/coreprotocol.cpp ../shared/coreprotocol.h + ../shared/datadevice.cpp ../shared/datadevice.h + ../shared/mockcompositor.cpp ../shared/mockcompositor.h + ../shared/textinput.cpp ../shared/textinput.h + ../shared/xdgshell.cpp ../shared/xdgshell.h + tst_nooutput.cpp + INCLUDE_DIRECTORIES + ../shared + PUBLIC_LIBRARIES + Qt::Gui + Qt::OpenGL + Qt::WaylandClientPrivate + Wayland::Server +) + +qt6_generate_wayland_protocol_server_sources(tst_nooutput + FILES + ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/text-input-unstable-v2.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/wayland.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-shell.xml +) diff --git a/tests/auto/wayland/nooutput/CMakeLists.txt b/tests/auto/wayland/nooutput/CMakeLists.txt new file mode 100644 index 00000000000..e5110c0c903 --- /dev/null +++ b/tests/auto/wayland/nooutput/CMakeLists.txt @@ -0,0 +1,31 @@ +# Generated from nooutput.pro. + +##################################################################### +## tst_nooutput Test: +##################################################################### + +qt_add_test(tst_nooutput + SOURCES + ../shared/corecompositor.cpp ../shared/corecompositor.h + ../shared/coreprotocol.cpp ../shared/coreprotocol.h + ../shared/datadevice.cpp ../shared/datadevice.h + ../shared/mockcompositor.cpp ../shared/mockcompositor.h + ../shared/textinput.cpp ../shared/textinput.h + ../shared/xdgshell.cpp ../shared/xdgshell.h + tst_nooutput.cpp + INCLUDE_DIRECTORIES + ../shared + PUBLIC_LIBRARIES + Qt::Gui + Qt::OpenGL + Qt::WaylandClientPrivate + Wayland::Server + Threads::Threads # special case +) + +qt6_generate_wayland_protocol_server_sources(tst_nooutput + FILES + ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/text-input-unstable-v2.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/wayland.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-shell.xml +) diff --git a/tests/auto/wayland/output/.prev_CMakeLists.txt b/tests/auto/wayland/output/.prev_CMakeLists.txt index 8595888e955..09ca5d6d491 100644 --- a/tests/auto/wayland/output/.prev_CMakeLists.txt +++ b/tests/auto/wayland/output/.prev_CMakeLists.txt @@ -15,11 +15,10 @@ qt_add_test(tst_output tst_output.cpp INCLUDE_DIRECTORIES ../shared - LIBRARIES - Qt::WaylandClientPrivate PUBLIC_LIBRARIES Qt::Gui - Qt::WaylandClient + Qt::OpenGL + Qt::WaylandClientPrivate Wayland::Server ) diff --git a/tests/auto/wayland/output/CMakeLists.txt b/tests/auto/wayland/output/CMakeLists.txt index c453ac424f1..5d2dfbf9d54 100644 --- a/tests/auto/wayland/output/CMakeLists.txt +++ b/tests/auto/wayland/output/CMakeLists.txt @@ -15,11 +15,10 @@ qt_add_test(tst_output tst_output.cpp INCLUDE_DIRECTORIES ../shared - LIBRARIES - Qt::WaylandClientPrivate PUBLIC_LIBRARIES Qt::Gui - Qt::WaylandClient + Qt::OpenGL + Qt::WaylandClientPrivate Wayland::Server Threads::Threads # special case ) diff --git a/tests/auto/wayland/primaryselectionv1/.prev_CMakeLists.txt b/tests/auto/wayland/primaryselectionv1/.prev_CMakeLists.txt index 77a994dd4f9..f86e81e12ed 100644 --- a/tests/auto/wayland/primaryselectionv1/.prev_CMakeLists.txt +++ b/tests/auto/wayland/primaryselectionv1/.prev_CMakeLists.txt @@ -15,11 +15,10 @@ qt_add_test(tst_primaryselectionv1 tst_primaryselectionv1.cpp INCLUDE_DIRECTORIES ../shared - LIBRARIES - Qt::WaylandClientPrivate PUBLIC_LIBRARIES Qt::Gui - Qt::WaylandClient + Qt::OpenGL + Qt::WaylandClientPrivate Wayland::Server ) diff --git a/tests/auto/wayland/primaryselectionv1/CMakeLists.txt b/tests/auto/wayland/primaryselectionv1/CMakeLists.txt index af912234398..d101c8b3d97 100644 --- a/tests/auto/wayland/primaryselectionv1/CMakeLists.txt +++ b/tests/auto/wayland/primaryselectionv1/CMakeLists.txt @@ -15,11 +15,10 @@ qt_add_test(tst_primaryselectionv1 tst_primaryselectionv1.cpp INCLUDE_DIRECTORIES ../shared - LIBRARIES - Qt::WaylandClientPrivate PUBLIC_LIBRARIES Qt::Gui - Qt::WaylandClient + Qt::OpenGL + Qt::WaylandClientPrivate Wayland::Server Threads::Threads # special case ) diff --git a/tests/auto/wayland/seatv4/.prev_CMakeLists.txt b/tests/auto/wayland/seatv4/.prev_CMakeLists.txt index ab7eb380f04..9e0e4c37ebe 100644 --- a/tests/auto/wayland/seatv4/.prev_CMakeLists.txt +++ b/tests/auto/wayland/seatv4/.prev_CMakeLists.txt @@ -15,11 +15,10 @@ qt_add_test(tst_seatv4 tst_seatv4.cpp INCLUDE_DIRECTORIES ../shared - LIBRARIES - Qt::WaylandClientPrivate PUBLIC_LIBRARIES Qt::Gui - Qt::WaylandClient + Qt::OpenGL + Qt::WaylandClientPrivate Wayland::Server ) @@ -34,9 +33,7 @@ qt6_generate_wayland_protocol_server_sources(tst_seatv4 ##################################################################### qt_extend_target(tst_seatv4 CONDITION QT_FEATURE_cursor - LIBRARIES - Qt::GuiPrivate PUBLIC_LIBRARIES - Qt::Gui + Qt::GuiPrivate Wayland::Cursor ) diff --git a/tests/auto/wayland/seatv4/CMakeLists.txt b/tests/auto/wayland/seatv4/CMakeLists.txt index bd14a6a8bf6..36b0c847183 100644 --- a/tests/auto/wayland/seatv4/CMakeLists.txt +++ b/tests/auto/wayland/seatv4/CMakeLists.txt @@ -15,11 +15,10 @@ qt_add_test(tst_seatv4 tst_seatv4.cpp INCLUDE_DIRECTORIES ../shared - LIBRARIES - Qt::WaylandClientPrivate PUBLIC_LIBRARIES Qt::Gui - Qt::WaylandClient + Qt::OpenGL + Qt::WaylandClientPrivate Wayland::Server Threads::Threads # special case ) @@ -35,9 +34,7 @@ qt6_generate_wayland_protocol_server_sources(tst_seatv4 ##################################################################### qt_extend_target(tst_seatv4 CONDITION QT_FEATURE_cursor - LIBRARIES - Qt::GuiPrivate PUBLIC_LIBRARIES - Qt::Gui + Qt::GuiPrivate Wayland::Cursor ) diff --git a/tests/auto/wayland/seatv5/.prev_CMakeLists.txt b/tests/auto/wayland/seatv5/.prev_CMakeLists.txt index 778c42c0bf3..11d615fb2f7 100644 --- a/tests/auto/wayland/seatv5/.prev_CMakeLists.txt +++ b/tests/auto/wayland/seatv5/.prev_CMakeLists.txt @@ -15,11 +15,10 @@ qt_add_test(tst_seatv5 tst_seatv5.cpp INCLUDE_DIRECTORIES ../shared - LIBRARIES - Qt::WaylandClientPrivate PUBLIC_LIBRARIES Qt::Gui - Qt::WaylandClient + Qt::OpenGL + Qt::WaylandClientPrivate Wayland::Server ) diff --git a/tests/auto/wayland/seatv5/CMakeLists.txt b/tests/auto/wayland/seatv5/CMakeLists.txt index 38c5d980f53..fefdcf8dbe2 100644 --- a/tests/auto/wayland/seatv5/CMakeLists.txt +++ b/tests/auto/wayland/seatv5/CMakeLists.txt @@ -15,11 +15,10 @@ qt_add_test(tst_seatv5 tst_seatv5.cpp INCLUDE_DIRECTORIES ../shared - LIBRARIES - Qt::WaylandClientPrivate PUBLIC_LIBRARIES Qt::Gui - Qt::WaylandClient + Qt::OpenGL + Qt::WaylandClientPrivate Wayland::Server Threads::Threads # special case ) diff --git a/tests/auto/wayland/surface/.prev_CMakeLists.txt b/tests/auto/wayland/surface/.prev_CMakeLists.txt index bb728928614..43d6ec34e5a 100644 --- a/tests/auto/wayland/surface/.prev_CMakeLists.txt +++ b/tests/auto/wayland/surface/.prev_CMakeLists.txt @@ -15,11 +15,10 @@ qt_add_test(tst_surface tst_surface.cpp INCLUDE_DIRECTORIES ../shared - LIBRARIES - Qt::WaylandClientPrivate PUBLIC_LIBRARIES Qt::Gui - Qt::WaylandClient + Qt::OpenGL + Qt::WaylandClientPrivate Wayland::Server ) diff --git a/tests/auto/wayland/surface/CMakeLists.txt b/tests/auto/wayland/surface/CMakeLists.txt index 1470f414e60..a1545115e43 100644 --- a/tests/auto/wayland/surface/CMakeLists.txt +++ b/tests/auto/wayland/surface/CMakeLists.txt @@ -15,11 +15,10 @@ qt_add_test(tst_surface tst_surface.cpp INCLUDE_DIRECTORIES ../shared - LIBRARIES - Qt::WaylandClientPrivate PUBLIC_LIBRARIES Qt::Gui - Qt::WaylandClient + Qt::OpenGL + Qt::WaylandClientPrivate Wayland::Server Threads::Threads # special case ) diff --git a/tests/auto/wayland/tabletv2/.prev_CMakeLists.txt b/tests/auto/wayland/tabletv2/.prev_CMakeLists.txt new file mode 100644 index 00000000000..e7fc3f60f3a --- /dev/null +++ b/tests/auto/wayland/tabletv2/.prev_CMakeLists.txt @@ -0,0 +1,31 @@ +# Generated from tabletv2.pro. + +##################################################################### +## tst_tabletv2 Test: +##################################################################### + +qt_add_test(tst_tabletv2 + SOURCES + ../shared/corecompositor.cpp ../shared/corecompositor.h + ../shared/coreprotocol.cpp ../shared/coreprotocol.h + ../shared/datadevice.cpp ../shared/datadevice.h + ../shared/mockcompositor.cpp ../shared/mockcompositor.h + ../shared/textinput.cpp ../shared/textinput.h + ../shared/xdgshell.cpp ../shared/xdgshell.h + tst_tabletv2.cpp + INCLUDE_DIRECTORIES + ../shared + PUBLIC_LIBRARIES + Qt::Gui + Qt::OpenGL + Qt::WaylandClientPrivate + Wayland::Server +) + +qt6_generate_wayland_protocol_server_sources(tst_tabletv2 + FILES + ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/tablet-unstable-v2.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/text-input-unstable-v2.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/wayland.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-shell.xml +) diff --git a/tests/auto/wayland/tabletv2/CMakeLists.txt b/tests/auto/wayland/tabletv2/CMakeLists.txt new file mode 100644 index 00000000000..f5a12c55441 --- /dev/null +++ b/tests/auto/wayland/tabletv2/CMakeLists.txt @@ -0,0 +1,32 @@ +# Generated from tabletv2.pro. + +##################################################################### +## tst_tabletv2 Test: +##################################################################### + +qt_add_test(tst_tabletv2 + SOURCES + ../shared/corecompositor.cpp ../shared/corecompositor.h + ../shared/coreprotocol.cpp ../shared/coreprotocol.h + ../shared/datadevice.cpp ../shared/datadevice.h + ../shared/mockcompositor.cpp ../shared/mockcompositor.h + ../shared/textinput.cpp ../shared/textinput.h + ../shared/xdgshell.cpp ../shared/xdgshell.h + tst_tabletv2.cpp + INCLUDE_DIRECTORIES + ../shared + PUBLIC_LIBRARIES + Qt::Gui + Qt::OpenGL + Qt::WaylandClientPrivate + Wayland::Server + Threads::Threads # special case +) + +qt6_generate_wayland_protocol_server_sources(tst_tabletv2 + FILES + ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/tablet-unstable-v2.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/text-input-unstable-v2.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/wayland.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-shell.xml +) diff --git a/tests/auto/wayland/wl_connect/CMakeLists.txt b/tests/auto/wayland/wl_connect/CMakeLists.txt index 5ad3ac6a4a3..5a01bedd069 100644 --- a/tests/auto/wayland/wl_connect/CMakeLists.txt +++ b/tests/auto/wayland/wl_connect/CMakeLists.txt @@ -7,8 +7,7 @@ qt_add_test(tst_wlconnect SOURCES tst_wlconnect.cpp - LIBRARIES - Qt::GuiPrivate PUBLIC_LIBRARIES Qt::Gui + Qt::GuiPrivate ) diff --git a/tests/auto/wayland/xdgdecorationv1/.prev_CMakeLists.txt b/tests/auto/wayland/xdgdecorationv1/.prev_CMakeLists.txt index a73e1055c75..9311070a818 100644 --- a/tests/auto/wayland/xdgdecorationv1/.prev_CMakeLists.txt +++ b/tests/auto/wayland/xdgdecorationv1/.prev_CMakeLists.txt @@ -15,11 +15,10 @@ qt_add_test(tst_xdgdecorationv1 tst_xdgdecorationv1.cpp INCLUDE_DIRECTORIES ../shared - LIBRARIES - Qt::WaylandClientPrivate PUBLIC_LIBRARIES Qt::Gui - Qt::WaylandClient + Qt::OpenGL + Qt::WaylandClientPrivate Wayland::Server ) diff --git a/tests/auto/wayland/xdgdecorationv1/CMakeLists.txt b/tests/auto/wayland/xdgdecorationv1/CMakeLists.txt index 5d26b7fc865..de067a135c9 100644 --- a/tests/auto/wayland/xdgdecorationv1/CMakeLists.txt +++ b/tests/auto/wayland/xdgdecorationv1/CMakeLists.txt @@ -15,11 +15,10 @@ qt_add_test(tst_xdgdecorationv1 tst_xdgdecorationv1.cpp INCLUDE_DIRECTORIES ../shared - LIBRARIES - Qt::WaylandClientPrivate PUBLIC_LIBRARIES Qt::Gui - Qt::WaylandClient + Qt::OpenGL + Qt::WaylandClientPrivate Wayland::Server Threads::Threads # special case ) diff --git a/tests/auto/wayland/xdgoutput/.prev_CMakeLists.txt b/tests/auto/wayland/xdgoutput/.prev_CMakeLists.txt index 1a3afc1e292..505c7c0502f 100644 --- a/tests/auto/wayland/xdgoutput/.prev_CMakeLists.txt +++ b/tests/auto/wayland/xdgoutput/.prev_CMakeLists.txt @@ -15,11 +15,10 @@ qt_add_test(tst_xdgoutput tst_xdgoutput.cpp INCLUDE_DIRECTORIES ../shared - LIBRARIES - Qt::WaylandClientPrivate PUBLIC_LIBRARIES Qt::Gui - Qt::WaylandClient + Qt::OpenGL + Qt::WaylandClientPrivate Wayland::Server ) diff --git a/tests/auto/wayland/xdgoutput/CMakeLists.txt b/tests/auto/wayland/xdgoutput/CMakeLists.txt index 855268c9453..e0a4b756eca 100644 --- a/tests/auto/wayland/xdgoutput/CMakeLists.txt +++ b/tests/auto/wayland/xdgoutput/CMakeLists.txt @@ -15,11 +15,10 @@ qt_add_test(tst_xdgoutput tst_xdgoutput.cpp INCLUDE_DIRECTORIES ../shared - LIBRARIES - Qt::WaylandClientPrivate PUBLIC_LIBRARIES Qt::Gui - Qt::WaylandClient + Qt::OpenGL + Qt::WaylandClientPrivate Wayland::Server Threads::Threads # special case ) diff --git a/tests/auto/wayland/xdgshell/.prev_CMakeLists.txt b/tests/auto/wayland/xdgshell/.prev_CMakeLists.txt index 4dc670e9d91..65f76210771 100644 --- a/tests/auto/wayland/xdgshell/.prev_CMakeLists.txt +++ b/tests/auto/wayland/xdgshell/.prev_CMakeLists.txt @@ -15,11 +15,10 @@ qt_add_test(tst_xdgshell tst_xdgshell.cpp INCLUDE_DIRECTORIES ../shared - LIBRARIES - Qt::WaylandClientPrivate PUBLIC_LIBRARIES Qt::Gui - Qt::WaylandClient + Qt::OpenGL + Qt::WaylandClientPrivate Wayland::Server ) diff --git a/tests/auto/wayland/xdgshell/CMakeLists.txt b/tests/auto/wayland/xdgshell/CMakeLists.txt index 025013e9f26..cab6c882550 100644 --- a/tests/auto/wayland/xdgshell/CMakeLists.txt +++ b/tests/auto/wayland/xdgshell/CMakeLists.txt @@ -15,11 +15,10 @@ qt_add_test(tst_xdgshell tst_xdgshell.cpp INCLUDE_DIRECTORIES ../shared - LIBRARIES - Qt::WaylandClientPrivate PUBLIC_LIBRARIES Qt::Gui - Qt::WaylandClient + Qt::OpenGL + Qt::WaylandClientPrivate Wayland::Server Threads::Threads # special case ) diff --git a/tests/auto/wayland/xdgshellv6/.prev_CMakeLists.txt b/tests/auto/wayland/xdgshellv6/.prev_CMakeLists.txt index ee3514f58a1..8fb87235bde 100644 --- a/tests/auto/wayland/xdgshellv6/.prev_CMakeLists.txt +++ b/tests/auto/wayland/xdgshellv6/.prev_CMakeLists.txt @@ -17,13 +17,12 @@ qt_add_test(tst_client_xdgshellv6 tst_xdgshellv6.cpp INCLUDE_DIRECTORIES ../shared_old - LIBRARIES - Qt::CorePrivate - Qt::GuiPrivate - Qt::WaylandClientPrivate PUBLIC_LIBRARIES + Qt::CorePrivate Qt::Gui - Qt::WaylandClient + Qt::GuiPrivate + Qt::OpenGL + Qt::WaylandClientPrivate Wayland::Client Wayland::Server ) diff --git a/tests/auto/wayland/xdgshellv6/CMakeLists.txt b/tests/auto/wayland/xdgshellv6/CMakeLists.txt index fe358889906..03acb48150a 100644 --- a/tests/auto/wayland/xdgshellv6/CMakeLists.txt +++ b/tests/auto/wayland/xdgshellv6/CMakeLists.txt @@ -17,13 +17,12 @@ qt_add_test(tst_client_xdgshellv6 tst_xdgshellv6.cpp INCLUDE_DIRECTORIES ../shared_old - LIBRARIES - Qt::CorePrivate - Qt::GuiPrivate - Qt::WaylandClientPrivate PUBLIC_LIBRARIES + Qt::CorePrivate Qt::Gui - Qt::WaylandClient + Qt::GuiPrivate + Qt::OpenGL + Qt::WaylandClientPrivate Wayland::Client Wayland::Server Threads::Threads # special case From 58b9cfd916d393212c132f83a662d8de432fcffd Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Fri, 15 Nov 2019 17:53:14 +0100 Subject: [PATCH 0838/1507] Fix qtwaylandscanner package dependencies Use the new API provided in qtbase, to register a package dependency between the client module and the QtWaylandScannerTools package. Do the same for the compositor module. Also register a dependency between the QtWaylandScannerTools package and the WaylandScanner package. Also fix the tests condition to check the correct _FOUND variable. Change-Id: Id961a365715cef2d7d0b8a54ca9000dc3890ffd7 Reviewed-by: Leander Beernaert Reviewed-by: Alexandru Croitor --- src/plugins/platforms/wayland/CMakeLists.txt | 4 ++++ src/tools/qtwaylandscanner/CMakeLists.txt | 8 +++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/CMakeLists.txt b/src/plugins/platforms/wayland/CMakeLists.txt index 248f7213665..597321a2ce2 100644 --- a/src/plugins/platforms/wayland/CMakeLists.txt +++ b/src/plugins/platforms/wayland/CMakeLists.txt @@ -146,3 +146,7 @@ qt_extend_target(WaylandClient CONDITION QT_FEATURE_draganddrop SOURCES qwaylanddnd.cpp qwaylanddnd_p.h ) + +# special case begin +qt_record_extra_qt_package_dependency(WaylandClient WaylandScannerTools "") +# special case end diff --git a/src/tools/qtwaylandscanner/CMakeLists.txt b/src/tools/qtwaylandscanner/CMakeLists.txt index 107702c3196..17254afc3c3 100644 --- a/src/tools/qtwaylandscanner/CMakeLists.txt +++ b/src/tools/qtwaylandscanner/CMakeLists.txt @@ -5,7 +5,7 @@ ##################################################################### qt_add_tool(qtwaylandscanner - TOOLS_TARGET QtWaylandScanner # special case + TOOLS_TARGET WaylandScanner # special case SOURCES qtwaylandscanner.cpp PUBLIC_LIBRARIES @@ -14,3 +14,9 @@ qt_add_tool(qtwaylandscanner #### Keys ignored in scope 1:.:.:qtwaylandscanner.pro:: # _OPTION = "host_build" + +# special case begin +# Abuse the function to make sure the package providing qtwaylandscanner calls +# find_package(WaylandScanner), aka the non-qt provided package. +qt_record_extra_package_dependency(qtwaylandscanner WaylandScanner "") +# special case end From 592cfb27f8d52ae33bbd0bec34ca9a55255ebf88 Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Tue, 23 Jul 2019 08:44:46 +0200 Subject: [PATCH 0839/1507] Client: Remove recursion in data offer retrieval A loop functions just as well is more readable and uses less stack memory. Change-Id: I6f6c6b7b8047c42080fb8b9e0bc3eae96f8872ab Reviewed-by: David Faure Reviewed-by: Johan Helsing (cherry picked from commit 97c1e5337e7e214c4ada98e1cc360b7e674996aa) Reviewed-by: Eskil Abrahamsen Blomfeldt --- .../platforms/wayland/qwaylanddataoffer.cpp | 35 ++++++++++--------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylanddataoffer.cpp b/src/plugins/platforms/wayland/qwaylanddataoffer.cpp index 4c06277fe87..2297e8a16d6 100644 --- a/src/plugins/platforms/wayland/qwaylanddataoffer.cpp +++ b/src/plugins/platforms/wayland/qwaylanddataoffer.cpp @@ -170,24 +170,27 @@ int QWaylandMimeData::readData(int fd, QByteArray &data) const timeout.tv_sec = 1; timeout.tv_usec = 0; - int ready = select(FD_SETSIZE, &readset, nullptr, nullptr, &timeout); - if (ready < 0) { - qWarning() << "QWaylandDataOffer: select() failed"; - return -1; - } else if (ready == 0) { - qWarning("QWaylandDataOffer: timeout reading from pipe"); - return -1; - } else { - char buf[4096]; - int n = QT_READ(fd, buf, sizeof buf); + Q_FOREVER { + int ready = select(FD_SETSIZE, &readset, nullptr, nullptr, &timeout); + if (ready < 0) { + qWarning() << "QWaylandDataOffer: select() failed"; + return -1; + } else if (ready == 0) { + qWarning("QWaylandDataOffer: timeout reading from pipe"); + return -1; + } else { + char buf[4096]; + int n = QT_READ(fd, buf, sizeof buf); - if (n > 0) { - data.append(buf, n); - n = readData(fd, data); - } else if (n < 0) { - qWarning("QWaylandDataOffer: read() failed"); + if (n < 0) { + qWarning("QWaylandDataOffer: read() failed"); + return -1; + } else if (n == 0) { + return 0; + } else if (n > 0) { + data.append(buf, n); + } } - return n; } } From 88eb97dd0abeef7d5112f66de00e84b23a9af6c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A5rten=20Nordheim?= Date: Tue, 24 Mar 2020 10:02:13 +0100 Subject: [PATCH 0840/1507] Update connects to QSocketNotifier::activated The int-overload will in some cases truncate the descriptor. So it's being replaced. On Linux it won't truncate, so the slot can stay as int, but we still update which signal to connect to. Task-number: QTBUG-70441 Change-Id: I516a453c381e8d29464febabfd69c788e58db5fe Reviewed-by: Timur Pocheptsov --- src/plugins/platforms/wayland/qwaylandintegration.cpp | 2 +- tests/auto/wayland/client/tst_client.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandintegration.cpp b/src/plugins/platforms/wayland/qwaylandintegration.cpp index 85c1990b612..e3b86ee9fd6 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandintegration.cpp @@ -198,7 +198,7 @@ void QWaylandIntegration::initialize() int fd = wl_display_get_fd(mDisplay->wl_display()); QSocketNotifier *sn = new QSocketNotifier(fd, QSocketNotifier::Read, mDisplay.data()); - QObject::connect(sn, SIGNAL(activated(int)), mDisplay.data(), SLOT(flushRequests())); + QObject::connect(sn, SIGNAL(activated(QSocketDescriptor)), mDisplay.data(), SLOT(flushRequests())); // Qt does not support running with no screens mDisplay->ensureScreen(); diff --git a/tests/auto/wayland/client/tst_client.cpp b/tests/auto/wayland/client/tst_client.cpp index 499a93a1dde..42e23b54ce9 100644 --- a/tests/auto/wayland/client/tst_client.cpp +++ b/tests/auto/wayland/client/tst_client.cpp @@ -149,7 +149,7 @@ public: : compositor(c) { QSocketNotifier *notifier = new QSocketNotifier(compositor->waylandFileDescriptor(), QSocketNotifier::Read, this); - connect(notifier, SIGNAL(activated(int)), this, SLOT(processWaylandEvents())); + connect(notifier, SIGNAL(activated(QSocketDescriptor)), this, SLOT(processWaylandEvents())); // connect to the event dispatcher to make sure to flush out the outgoing message queue connect(QCoreApplication::eventDispatcher(), &QAbstractEventDispatcher::awake, this, &tst_WaylandClient::processWaylandEvents); connect(QCoreApplication::eventDispatcher(), &QAbstractEventDispatcher::aboutToBlock, this, &tst_WaylandClient::processWaylandEvents); From 1bef0aa9b8d4d935bb0bd1c44654b99a1326ea77 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Tue, 21 Apr 2020 10:11:41 +0200 Subject: [PATCH 0841/1507] Don't force gamma-correction off The freetype backend can now do selective gamma-correcting, but need to have a useful gamma-value. Fixes: QTBUG-83636 Change-Id: I89e99d0a63b75d15d70763ee0c2459caa761beee Reviewed-by: David Edmundson Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/plugins/platforms/wayland/qwaylandintegration.cpp | 7 ------- 1 file changed, 7 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandintegration.cpp b/src/plugins/platforms/wayland/qwaylandintegration.cpp index 85c1990b612..2e0d508f974 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandintegration.cpp @@ -233,13 +233,6 @@ QVariant QWaylandIntegration::styleHint(StyleHint hint) const if (hint == ShowIsFullScreen && mDisplay->windowManagerIntegration()) return mDisplay->windowManagerIntegration()->showIsFullScreen(); - switch (hint) { - case QPlatformIntegration::FontSmoothingGamma: - return qreal(1.0); - default: - break; - } - return QPlatformIntegration::styleHint(hint); } From 849d741b218545a16d90efa9d9bcff79b62eacfb Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 21 Apr 2020 09:12:16 -0700 Subject: [PATCH 0842/1507] Fix GCC 9 warning about redundant std::move use qwaylandcursor.cpp:254:21: warning: redundant move in return statement [-Wredundant-move] Change-Id: I9709abb1c3734e10a7defffd1607e1b3ed279d32 Reviewed-by: David Edmundson --- src/plugins/platforms/wayland/qwaylandcursor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandcursor.cpp b/src/plugins/platforms/wayland/qwaylandcursor.cpp index 1d3d88bea3a..3263b17f1e3 100644 --- a/src/plugins/platforms/wayland/qwaylandcursor.cpp +++ b/src/plugins/platforms/wayland/qwaylandcursor.cpp @@ -251,7 +251,7 @@ QSharedPointer QWaylandCursor::cursorBitmapBuffer(QWaylandDispla const QImage &img = cursor->pixmap().toImage(); QSharedPointer buffer(new QWaylandShmBuffer(display, img.size(), img.format())); memcpy(buffer->image()->bits(), img.bits(), size_t(img.sizeInBytes())); - return std::move(buffer); + return buffer; } void QWaylandCursor::changeCursor(QCursor *cursor, QWindow *window) From 85f4f2827bf07217fdb35ec9afe002c0d1d241c8 Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Wed, 8 Apr 2020 18:19:00 +0100 Subject: [PATCH 0843/1507] Client: Reset wl_egl_window before wl_surface Semantically we want things in this order as wl_egl_window_create takes a reference to the wl_surface. Teardown typically is the opposite of construction. This brings us in line with GTK which also tears down in this order. This fixes a repeatable crash when using Nvidia's EGLStreams and closing a window. Change-Id: I356dfbba9a7315717c8ecdc7023ca7b047622697 Reviewed-by: Frederik Gladhorn Reviewed-by: Johan Helsing --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 5830c1368c2..9fa2f15f5f7 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -244,6 +244,8 @@ void QWaylandWindow::reset(bool sendDestroyEvent) mShellSurface = nullptr; delete mSubSurfaceWindow; mSubSurfaceWindow = nullptr; + + invalidateSurface(); if (mSurface) { emit wlSurfaceDestroyed(); QWriteLocker lock(&mSurfaceLock); From be03178c4fc0fcc9cdcb142d57e57f71be1e357a Mon Sep 17 00:00:00 2001 From: Janne Koskinen Date: Tue, 24 Mar 2020 14:22:35 +0200 Subject: [PATCH 0844/1507] Fix leaking of callback timers Use two timers to create timeout trigger for framecallback. Removes multiple timers approach that is subject to race conditions. This was mistakenly pushed to 5.12 branch which will not be automatically merged upstream, so it has to be cherry-picked. Fixes: QTBUG-82914 Reviewed-by: Eskil Abrahamsen Blomfeldt (cherry picked from commit d18c29931b0bc889fff66bdbde89133544ba0529) Change-Id: I258c0c08f0ac5803192fc0024e40ba72e72c37a8 Reviewed-by: Janne Koskinen --- .../platforms/wayland/qwaylandwindow.cpp | 46 ++++++++----------- .../platforms/wayland/qwaylandwindow_p.h | 4 +- 2 files changed, 22 insertions(+), 28 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 9fa2f15f5f7..884a9793acd 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -257,10 +257,7 @@ void QWaylandWindow::reset(bool sendDestroyEvent) mFrameCallback = nullptr; } - int timerId = mFrameCallbackTimerId.fetchAndStoreOrdered(-1); - if (timerId != -1) { - killTimer(timerId); - } + mFrameCallbackElapsedTimer.invalidate(); mWaitingForFrameCallback = false; mFrameCallbackTimedOut = false; @@ -602,15 +599,11 @@ const wl_callback_listener QWaylandWindow::callbackListener = { void QWaylandWindow::handleFrameCallback() { - // Stop the timer and stop waiting immediately - int timerId = mFrameCallbackTimerId.fetchAndStoreOrdered(-1); mWaitingForFrameCallback = false; + mFrameCallbackElapsedTimer.invalidate(); // The rest can wait until we can run it on the correct thread - auto doHandleExpose = [this, timerId]() { - if (timerId != -1) - killTimer(timerId); - + auto doHandleExpose = [this]() { bool wasExposed = isExposed(); mFrameCallbackTimedOut = false; if (!wasExposed && isExposed()) // Did setting mFrameCallbackTimedOut make the window exposed? @@ -645,13 +638,6 @@ bool QWaylandWindow::waitForFrameSync(int timeout) sendExposeEvent(QRect()); } - // Stop current frame timer if any, can't use killTimer directly, because we might be on a diffent thread - // Ordered semantics is needed to avoid stopping the timer twice and not miss it when it's - // started by other writes - int fcbId = mFrameCallbackTimerId.fetchAndStoreOrdered(-1); - if (fcbId != -1) - QMetaObject::invokeMethod(this, [this, fcbId] { killTimer(fcbId); }, Qt::QueuedConnection); - return !mWaitingForFrameCallback; } @@ -1107,8 +1093,16 @@ QVariant QWaylandWindow::property(const QString &name, const QVariant &defaultVa void QWaylandWindow::timerEvent(QTimerEvent *event) { - if (mFrameCallbackTimerId.testAndSetOrdered(event->timerId(), -1)) { - killTimer(event->timerId()); + if (event->timerId() != mFrameCallbackCheckIntervalTimerId) + return; + + bool callbackTimerExpired = mFrameCallbackElapsedTimer.hasExpired(100); + if (!mFrameCallbackElapsedTimer.isValid() || callbackTimerExpired ) { + killTimer(mFrameCallbackCheckIntervalTimerId); + mFrameCallbackCheckIntervalTimerId = -1; + } + if (mFrameCallbackElapsedTimer.isValid() && callbackTimerExpired) { + mFrameCallbackElapsedTimer.invalidate(); qCDebug(lcWaylandBackingstore) << "Didn't receive frame callback in time, window should now be inexposed"; mFrameCallbackTimedOut = true; mWaitingForUpdate = false; @@ -1162,15 +1156,13 @@ void QWaylandWindow::handleUpdate() mWaitingForFrameCallback = true; mWaitingForUpdate = false; - // Stop current frame timer if any, can't use killTimer directly, see comment above. - int fcbId = mFrameCallbackTimerId.fetchAndStoreOrdered(-1); - if (fcbId != -1) - QMetaObject::invokeMethod(this, [this, fcbId] { killTimer(fcbId); }, Qt::QueuedConnection); - // Start a timer for handling the case when the compositor stops sending frame callbacks. - QMetaObject::invokeMethod(this, [this] { // Again; can't do it directly - if (mWaitingForFrameCallback) - mFrameCallbackTimerId = startTimer(100); + QMetaObject::invokeMethod(this, [this] { + if (mWaitingForFrameCallback) { + if (mFrameCallbackCheckIntervalTimerId < 0) + mFrameCallbackCheckIntervalTimerId = startTimer(100); + mFrameCallbackElapsedTimer.start(); + } }, Qt::QueuedConnection); } diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index 352df89daf6..ef03fd1f459 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -58,6 +58,7 @@ #include #include #include +#include #include @@ -225,7 +226,8 @@ protected: WId mWindowId; bool mWaitingForFrameCallback = false; bool mFrameCallbackTimedOut = false; // Whether the frame callback has timed out - QAtomicInt mFrameCallbackTimerId = -1; // Started on commit, reset on frame callback + int mFrameCallbackCheckIntervalTimerId = -1; + QElapsedTimer mFrameCallbackElapsedTimer; struct ::wl_callback *mFrameCallback = nullptr; struct ::wl_event_queue *mFrameQueue = nullptr; QWaitCondition mFrameSyncWait; From 29fa4de2f482a7ae55d2555c280ebdf93a6e17df Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Mon, 6 Apr 2020 09:52:33 +0200 Subject: [PATCH 0845/1507] Client: Make frame back callback timeout configurable To avoid rendering when windows are minimized, we try to detect this case by checking if 100 ms passes after an update before any frame callback arrives. Wayland expects to drive the rendering through frame callbacks, while Qt expects to be informed when a window is no longer visible and will run a tight, vsynced render loop until it gets the appropriate event. This mismatch causes issues, and the timeout is an attempt to avoid actively rendering to a hidden surface by detecting the missing callbacks. It causes problems on embedded, though, when a device is so busy that the timeout happens even when the window is visible. So we introduce a way to configure the timeout. Either increase its duration if you can guarantee a certain minimum time between events even with high load, or set it to 0 to disable it completely. (at the expense of drawing to invisible windows). Note that this is required for fixing a critical memory leak that happens when using Wayland on embedded. This was mistakenly pushed to 5.12 branch, so it will not be automatically merged upstream. Therefore we have to cherry-pick it. [ChangeLog][Client] Added support for QT_WAYLAND_FRAME_CALLBACK_TIMEOUT environment variable, which can be used to disable or change the internal frame callback timeout. If you see windows that stop rendering or minimize on heavy load, then try setting the variable to 0. Task-number: QTBUG-82914 Reviewed-by: David Edmundson (cherry picked from commit 0a0e0eb8dca699858435dec5194b0b8b6ebd3cf8) Change-Id: I2aeeecb0fab8f7be9b838e477c88eae22b322d75 Reviewed-by: Janne Koskinen --- .../platforms/wayland/qwaylandwindow.cpp | 25 +++++++++++++------ .../platforms/wayland/qwaylandwindow_p.h | 1 + 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 884a9793acd..0545c80f4c7 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -79,6 +79,13 @@ QWaylandWindow::QWaylandWindow(QWindow *window, QWaylandDisplay *display) , mFrameQueue(mDisplay->createEventQueue()) , mResizeAfterSwap(qEnvironmentVariableIsSet("QT_WAYLAND_RESIZE_AFTER_SWAP")) { + { + bool ok; + int frameCallbackTimeout = qEnvironmentVariableIntValue("QT_WAYLAND_FRAME_CALLBACK_TIMEOUT", &ok); + if (ok) + mFrameCallbackTimeout = frameCallbackTimeout; + } + static WId id = 1; mWindowId = id++; initializeWlSurface(); @@ -1096,7 +1103,7 @@ void QWaylandWindow::timerEvent(QTimerEvent *event) if (event->timerId() != mFrameCallbackCheckIntervalTimerId) return; - bool callbackTimerExpired = mFrameCallbackElapsedTimer.hasExpired(100); + bool callbackTimerExpired = mFrameCallbackElapsedTimer.hasExpired(mFrameCallbackTimeout); if (!mFrameCallbackElapsedTimer.isValid() || callbackTimerExpired ) { killTimer(mFrameCallbackCheckIntervalTimerId); mFrameCallbackCheckIntervalTimerId = -1; @@ -1157,13 +1164,15 @@ void QWaylandWindow::handleUpdate() mWaitingForUpdate = false; // Start a timer for handling the case when the compositor stops sending frame callbacks. - QMetaObject::invokeMethod(this, [this] { - if (mWaitingForFrameCallback) { - if (mFrameCallbackCheckIntervalTimerId < 0) - mFrameCallbackCheckIntervalTimerId = startTimer(100); - mFrameCallbackElapsedTimer.start(); - } - }, Qt::QueuedConnection); + if (mFrameCallbackTimeout > 0) { + QMetaObject::invokeMethod(this, [this] { + if (mWaitingForFrameCallback) { + if (mFrameCallbackCheckIntervalTimerId < 0) + mFrameCallbackCheckIntervalTimerId = startTimer(mFrameCallbackTimeout); + mFrameCallbackElapsedTimer.start(); + } + }, Qt::QueuedConnection); + } } void QWaylandWindow::deliverUpdateRequest() diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index ef03fd1f459..89d6272d81d 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -240,6 +240,7 @@ protected: bool mCanResize = true; bool mResizeDirty = false; bool mResizeAfterSwap; + int mFrameCallbackTimeout = 100; QVariantMap m_properties; bool mSentInitialResize = false; From 1a7dedc2d12dd6ae2eebc632b331b6cf3d9ae538 Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Sun, 23 Jun 2019 15:09:51 +0200 Subject: [PATCH 0846/1507] Client: Don't send fake SurfaceCreated/Destroyed events MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit QPlatformSurface relates to the platform window, not the wl_surface. The events are already emitted by QPlatformWindow on create/destroy. To preserve compatibility for a previous KDE version it was faked to emit the events when the wl_surface is created/hidden to keep behavior. This is no longer necessary, and it has caused multiple errors, the latest being a crash when switching between sub-menus with the Sway compositor. [ChangeLog][QPA plugin] QWaylandWindow no longer sends fake SurfaceCreated/Destroyed events. Use expose events to be notified when a Wayland surface appears. Task-number: QTBUG-76324 Fixes: QTBUG-81952 Pick-to: 5.15 Change-Id: I2f003bc9da85f032a0053677fd281152099fc9eb Reviewed-by: Paul Olav Tvete Reviewed-by: Tor Arne Vestbø Reviewed-by: David Edmundson --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 10 ++-------- src/plugins/platforms/wayland/qwaylandwindow_p.h | 2 +- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 8cc26d71ca1..523bdc73294 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -91,7 +91,7 @@ QWaylandWindow::~QWaylandWindow() delete mWindowDecoration; if (mSurface) - reset(false); + reset(); const QWindow *parent = window(); const auto tlw = QGuiApplication::topLevelWindows(); @@ -118,8 +118,6 @@ void QWaylandWindow::initWindow() if (!mSurface) { initializeWlSurface(); - QPlatformSurfaceEvent e(QPlatformSurfaceEvent::SurfaceCreated); - QGuiApplication::sendEvent(window(), &e); } if (shouldCreateSubSurface()) { @@ -234,12 +232,8 @@ bool QWaylandWindow::shouldCreateSubSurface() const return QPlatformWindow::parent() != nullptr; } -void QWaylandWindow::reset(bool sendDestroyEvent) +void QWaylandWindow::reset() { - if (mSurface && sendDestroyEvent) { - QPlatformSurfaceEvent e(QPlatformSurfaceEvent::SurfaceAboutToBeDestroyed); - QGuiApplication::sendEvent(window(), &e); - } delete mShellSurface; mShellSurface = nullptr; delete mSubSurfaceWindow; diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index c0328996d5d..6ad63d354a8 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -260,7 +260,7 @@ private: void initializeWlSurface(); bool shouldCreateShellSurface() const; bool shouldCreateSubSurface() const; - void reset(bool sendDestroyEvent = true); + void reset(); void sendExposeEvent(const QRect &rect); static void closePopups(QWaylandWindow *parent); QPlatformScreen *calculateScreenFromSurfaceEvents() const; From 4e78f559bec9de1c0cfdc79d56d65f4579f78611 Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Fri, 8 May 2020 17:48:30 +0200 Subject: [PATCH 0847/1507] Remove uses of QScreen::orientationUpdateMask It has been removed in qtbase 3e12951c0b35041920989d6089ddb6c2f5c2d3d1. Task-number: QTBUG-35427 Task-number: QTBUG-38576 Task-number: QTBUG-44569 Task-number: QTBUG-51012 Task-number: QTBUG-83055 Change-Id: I3ec0907185b237c329f4ec34148b19c5a7706c22 Reviewed-by: Liang Qi --- src/plugins/platforms/wayland/qwaylandscreen.cpp | 10 ---------- src/plugins/platforms/wayland/qwaylandscreen_p.h | 2 -- src/plugins/platforms/wayland/qwaylandwindow.cpp | 2 -- 3 files changed, 14 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandscreen.cpp b/src/plugins/platforms/wayland/qwaylandscreen.cpp index 6cb337de388..854f3b08212 100644 --- a/src/plugins/platforms/wayland/qwaylandscreen.cpp +++ b/src/plugins/platforms/wayland/qwaylandscreen.cpp @@ -186,16 +186,6 @@ QList QWaylandScreen::virtualSiblings() const return list; } -void QWaylandScreen::setOrientationUpdateMask(Qt::ScreenOrientations mask) -{ - const auto allWindows = QGuiApplication::allWindows(); - for (QWindow *window : allWindows) { - QWaylandWindow *w = static_cast(window->handle()); - if (w && w->waylandScreen() == this) - w->setOrientationMask(mask); - } -} - Qt::ScreenOrientation QWaylandScreen::orientation() const { return m_orientation; diff --git a/src/plugins/platforms/wayland/qwaylandscreen_p.h b/src/plugins/platforms/wayland/qwaylandscreen_p.h index df1c94f248e..404d0f1ecbf 100644 --- a/src/plugins/platforms/wayland/qwaylandscreen_p.h +++ b/src/plugins/platforms/wayland/qwaylandscreen_p.h @@ -96,8 +96,6 @@ public: QDpi logicalDpi() const override; QList virtualSiblings() const override; - void setOrientationUpdateMask(Qt::ScreenOrientations mask) override; - Qt::ScreenOrientation orientation() const override; int scale() const; qreal devicePixelRatio() const override; diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 70ba132e83d..e342c04203e 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -183,8 +183,6 @@ void QWaylandWindow::initWindow() if (mDisplay->compositorVersion() >= 3) mSurface->set_buffer_scale(scale()); - if (QScreen *s = window()->screen()) - setOrientationMask(s->orientationUpdateMask()); setWindowFlags(window()->flags()); if (window()->geometry().isEmpty()) setGeometry_helper(QRect(QPoint(), QSize(500,500))); From f5d3beded969a195fd95a577063ec74d1920aa6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tony=20Saraj=C3=A4rvi?= Date: Mon, 11 May 2020 09:06:58 +0000 Subject: [PATCH 0848/1507] Blacklist animatedCursor in SLES Task-number: QTBUG-78317 Change-Id: Ic2fdbf98dc744c659091f46b33de8e8a34ed8cb1 Reviewed-by: Heikki Halmet --- tests/auto/wayland/seatv4/BLACKLIST | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/auto/wayland/seatv4/BLACKLIST b/tests/auto/wayland/seatv4/BLACKLIST index 1c761a74efc..e3353940624 100644 --- a/tests/auto/wayland/seatv4/BLACKLIST +++ b/tests/auto/wayland/seatv4/BLACKLIST @@ -1,2 +1,3 @@ [animatedCursor] b2qt +sles From c962b8c2df8e8a2cbbb7fc4eceebc37bcf3506b9 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Wed, 5 Jun 2019 17:27:10 +0200 Subject: [PATCH 0849/1507] QWaylandDisplay: replace a QMap, pointer*> with a std::vector<{QString, int, unique_ptr}> The vector is sorted, so lookup performance is the same, or better. Insertion performance is worse, of course, at least in big-O terms, but probably not in practice. But now the good part: saves a stunning 7.2KiB (0.6%) in text size on optimized AMD 64 Linux GCC 9.1 builds. Change-Id: Ie604f83d7d51111430db1d0bb89d8cc3a52301bf Reviewed-by: Lars Knoll --- .../platforms/wayland/qwaylandcursor.cpp | 4 +-- .../platforms/wayland/qwaylandcursor_p.h | 4 ++- .../platforms/wayland/qwaylanddisplay.cpp | 31 ++++++++++++++----- .../platforms/wayland/qwaylanddisplay_p.h | 17 +++++++++- 4 files changed, 45 insertions(+), 11 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandcursor.cpp b/src/plugins/platforms/wayland/qwaylandcursor.cpp index c9e3eb9ca88..5a6ab44bc73 100644 --- a/src/plugins/platforms/wayland/qwaylandcursor.cpp +++ b/src/plugins/platforms/wayland/qwaylandcursor.cpp @@ -54,7 +54,7 @@ QT_BEGIN_NAMESPACE namespace QtWaylandClient { -QWaylandCursorTheme *QWaylandCursorTheme::create(QWaylandShm *shm, int size, const QString &themeName) +std::unique_ptr QWaylandCursorTheme::create(QWaylandShm *shm, int size, const QString &themeName) { QByteArray nameBytes = themeName.toLocal8Bit(); struct ::wl_cursor_theme *theme = wl_cursor_theme_load(nameBytes.constData(), size, shm->object()); @@ -64,7 +64,7 @@ QWaylandCursorTheme *QWaylandCursorTheme::create(QWaylandShm *shm, int size, con return nullptr; } - return new QWaylandCursorTheme(theme); + return std::unique_ptr{new QWaylandCursorTheme(theme)}; } QWaylandCursorTheme::~QWaylandCursorTheme() diff --git a/src/plugins/platforms/wayland/qwaylandcursor_p.h b/src/plugins/platforms/wayland/qwaylandcursor_p.h index 3e5cff9bca1..de96c22b233 100644 --- a/src/plugins/platforms/wayland/qwaylandcursor_p.h +++ b/src/plugins/platforms/wayland/qwaylandcursor_p.h @@ -57,6 +57,8 @@ #if QT_CONFIG(cursor) +#include + struct wl_cursor; struct wl_cursor_image; struct wl_cursor_theme; @@ -73,7 +75,7 @@ class QWaylandShm; class Q_WAYLAND_CLIENT_EXPORT QWaylandCursorTheme { public: - static QWaylandCursorTheme *create(QWaylandShm *shm, int size, const QString &themeName); + static std::unique_ptr create(QWaylandShm *shm, int size, const QString &themeName); ~QWaylandCursorTheme(); ::wl_cursor *cursor(Qt::CursorShape shape); diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index 37cb0e9bc41..11af5f58950 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -85,6 +85,8 @@ #include +#include // for std::tie + QT_BEGIN_NAMESPACE namespace QtWaylandClient { @@ -183,7 +185,7 @@ QWaylandDisplay::~QWaylandDisplay(void) delete mDndSelectionHandler.take(); #endif #if QT_CONFIG(cursor) - qDeleteAll(mCursorThemes); + mCursorThemes.clear(); #endif if (mDisplay) wl_display_disconnect(mDisplay); @@ -602,15 +604,30 @@ QWaylandCursor *QWaylandDisplay::waylandCursor() return mCursor.data(); } +auto QWaylandDisplay::findExistingCursorTheme(const QString &name, int pixelSize) const noexcept + -> FindExistingCursorThemeResult +{ + const auto byNameAndSize = [](const WaylandCursorTheme &lhs, const WaylandCursorTheme &rhs) { + return std::tie(lhs.pixelSize, lhs.name) < std::tie(rhs.pixelSize, rhs.name); + }; + + const WaylandCursorTheme prototype = {name, pixelSize, nullptr}; + + const auto it = std::lower_bound(mCursorThemes.cbegin(), mCursorThemes.cend(), prototype, byNameAndSize); + if (it != mCursorThemes.cend() && it->name == name && it->pixelSize == pixelSize) + return {it, true}; + else + return {it, false}; +} + QWaylandCursorTheme *QWaylandDisplay::loadCursorTheme(const QString &name, int pixelSize) { - if (auto *theme = mCursorThemes.value({name, pixelSize}, nullptr)) - return theme; + const auto result = findExistingCursorTheme(name, pixelSize); + if (result.found) + return result.theme(); - if (auto *theme = QWaylandCursorTheme::create(shm(), pixelSize, name)) { - mCursorThemes[{name, pixelSize}] = theme; - return theme; - } + if (auto theme = QWaylandCursorTheme::create(shm(), pixelSize, name)) + return mCursorThemes.insert(result.position, {name, pixelSize, std::move(theme)})->theme.get(); return nullptr; } diff --git a/src/plugins/platforms/wayland/qwaylanddisplay_p.h b/src/plugins/platforms/wayland/qwaylanddisplay_p.h index a52c89fe9c7..83a56556e33 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay_p.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay_p.h @@ -238,7 +238,22 @@ private: QList mRegistryListeners; QWaylandIntegration *mWaylandIntegration = nullptr; #if QT_CONFIG(cursor) - QMap, QWaylandCursorTheme *> mCursorThemes; // theme name and size + struct WaylandCursorTheme { + QString name; + int pixelSize; + std::unique_ptr theme; + }; + std::vector mCursorThemes; + + struct FindExistingCursorThemeResult { + std::vector::const_iterator position; + bool found; + + QWaylandCursorTheme *theme() const noexcept + { return found ? position->theme.get() : nullptr; } + }; + FindExistingCursorThemeResult findExistingCursorTheme(const QString &name, int pixelSize) const; + QScopedPointer mCursor; #endif #if QT_CONFIG(wayland_datadevice) From 0d36b9c7d0e43b8758b077ba8c20d22fdd0088ba Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Tue, 26 May 2020 13:19:58 +0200 Subject: [PATCH 0850/1507] Adapt to removal of vulkan_support in qtbase MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit QtVulkanSupport module has been removed and its content was merged into QtGui and QtOpenGL in 7a1650e34331f87bab5a9372087d2a1135f9f63a in qtbase. Change-Id: I33b567208aebfeb15350ea088cb7fcd092e2a48a Reviewed-by: Tor Arne Vestbø --- src/plugins/platforms/wayland/.prev_CMakeLists.txt | 14 ++++++-------- src/plugins/platforms/wayland/CMakeLists.txt | 14 ++++++-------- src/plugins/platforms/wayland/client.pro | 4 ---- .../platforms/wayland/qwaylandvulkaninstance_p.h | 2 +- 4 files changed, 13 insertions(+), 21 deletions(-) diff --git a/src/plugins/platforms/wayland/.prev_CMakeLists.txt b/src/plugins/platforms/wayland/.prev_CMakeLists.txt index 58861b94514..de526fceaee 100644 --- a/src/plugins/platforms/wayland/.prev_CMakeLists.txt +++ b/src/plugins/platforms/wayland/.prev_CMakeLists.txt @@ -91,14 +91,6 @@ qt6_generate_wayland_protocol_client_sources(WaylandClient ## Scopes: ##################################################################### -qt_extend_target(WaylandClient CONDITION QT_FEATURE_vulkan - SOURCES - qwaylandvulkaninstance.cpp qwaylandvulkaninstance_p.h - qwaylandvulkanwindow.cpp qwaylandvulkanwindow_p.h - LIBRARIES - Qt::VulkanSupportPrivate -) - qt_extend_target(WaylandClient CONDITION QT_FEATURE_xkbcommon LIBRARIES Qt::XkbCommonSupportPrivate @@ -119,6 +111,12 @@ qt_extend_target(WaylandClient CONDITION QT_FEATURE_clipboard qwaylandclipboard.cpp qwaylandclipboard_p.h ) +qt_extend_target(WaylandClient CONDITION QT_FEATURE_vulkan + SOURCES + qwaylandvulkaninstance.cpp qwaylandvulkaninstance_p.h + qwaylandvulkanwindow.cpp qwaylandvulkanwindow_p.h +) + qt_extend_target(WaylandClient CONDITION QT_FEATURE_cursor SOURCES qwaylandcursor.cpp qwaylandcursor_p.h diff --git a/src/plugins/platforms/wayland/CMakeLists.txt b/src/plugins/platforms/wayland/CMakeLists.txt index 597321a2ce2..af045bb8312 100644 --- a/src/plugins/platforms/wayland/CMakeLists.txt +++ b/src/plugins/platforms/wayland/CMakeLists.txt @@ -92,14 +92,6 @@ qt6_generate_wayland_protocol_client_sources(WaylandClient ## Scopes: ##################################################################### -qt_extend_target(WaylandClient CONDITION QT_FEATURE_vulkan - SOURCES - qwaylandvulkaninstance.cpp qwaylandvulkaninstance_p.h - qwaylandvulkanwindow.cpp qwaylandvulkanwindow_p.h - LIBRARIES - Qt::VulkanSupportPrivate -) - qt_extend_target(WaylandClient CONDITION QT_FEATURE_xkbcommon LIBRARIES Qt::XkbCommonSupportPrivate @@ -122,6 +114,12 @@ qt_extend_target(WaylandClient CONDITION QT_FEATURE_clipboard qwaylandclipboard.cpp qwaylandclipboard_p.h ) +qt_extend_target(WaylandClient CONDITION QT_FEATURE_vulkan + SOURCES + qwaylandvulkaninstance.cpp qwaylandvulkaninstance_p.h + qwaylandvulkanwindow.cpp qwaylandvulkanwindow_p.h +) + qt_extend_target(WaylandClient CONDITION QT_FEATURE_cursor SOURCES qwaylandcursor.cpp qwaylandcursor_p.h diff --git a/src/plugins/platforms/wayland/client.pro b/src/plugins/platforms/wayland/client.pro index 4aeba860bc5..3355d663573 100644 --- a/src/plugins/platforms/wayland/client.pro +++ b/src/plugins/platforms/wayland/client.pro @@ -5,10 +5,6 @@ QT += core-private gui-private QT_FOR_PRIVATE += service_support-private QT_PRIVATE += fontdatabase_support-private eventdispatcher_support-private theme_support-private -qtConfig(vulkan) { - QT_PRIVATE += vulkan_support-private -} - # We have a bunch of C code with casts, so we can't have this option QMAKE_CXXFLAGS_WARN_ON -= -Wcast-qual diff --git a/src/plugins/platforms/wayland/qwaylandvulkaninstance_p.h b/src/plugins/platforms/wayland/qwaylandvulkaninstance_p.h index b68293b78d2..3f565ed2454 100644 --- a/src/plugins/platforms/wayland/qwaylandvulkaninstance_p.h +++ b/src/plugins/platforms/wayland/qwaylandvulkaninstance_p.h @@ -46,7 +46,7 @@ #define VK_USE_PLATFORM_WAYLAND_KHR -#include +#include #include QT_BEGIN_NAMESPACE From e4512b858c14d712256150f17ecf56ec8a23221b Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Tue, 26 May 2020 13:21:45 +0200 Subject: [PATCH 0851/1507] CMake: Regenerate projects Change-Id: I51a365ef29277bfcb3a62d04954dbe109ab6eac7 Reviewed-by: Joerg Bornemann --- src/plugins/platforms/wayland/.prev_CMakeLists.txt | 3 +++ src/plugins/platforms/wayland/CMakeLists.txt | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/plugins/platforms/wayland/.prev_CMakeLists.txt b/src/plugins/platforms/wayland/.prev_CMakeLists.txt index de526fceaee..c19adbed8b0 100644 --- a/src/plugins/platforms/wayland/.prev_CMakeLists.txt +++ b/src/plugins/platforms/wayland/.prev_CMakeLists.txt @@ -67,6 +67,7 @@ qt_add_module(WaylandClient PRIVATE_MODULE_INTERFACE Qt::CorePrivate Qt::GuiPrivate + Qt::ServiceSupportPrivate ) qt6_generate_wayland_protocol_client_sources(WaylandClient @@ -94,6 +95,8 @@ qt6_generate_wayland_protocol_client_sources(WaylandClient qt_extend_target(WaylandClient CONDITION QT_FEATURE_xkbcommon LIBRARIES Qt::XkbCommonSupportPrivate + PRIVATE_MODULE_INTERFACE + Qt::XkbCommonSupportPrivate ) qt_extend_target(WaylandClient CONDITION TARGET Qt::PlatformCompositorSupportPrivate diff --git a/src/plugins/platforms/wayland/CMakeLists.txt b/src/plugins/platforms/wayland/CMakeLists.txt index af045bb8312..fa5c34be480 100644 --- a/src/plugins/platforms/wayland/CMakeLists.txt +++ b/src/plugins/platforms/wayland/CMakeLists.txt @@ -67,7 +67,7 @@ qt_add_module(WaylandClient PRIVATE_MODULE_INTERFACE Qt::CorePrivate Qt::GuiPrivate - Qt::ServiceSupportPrivate # special case QTBUG-83063 + Qt::ServiceSupportPrivate ) qt6_generate_wayland_protocol_client_sources(WaylandClient @@ -95,8 +95,8 @@ qt6_generate_wayland_protocol_client_sources(WaylandClient qt_extend_target(WaylandClient CONDITION QT_FEATURE_xkbcommon LIBRARIES Qt::XkbCommonSupportPrivate - PRIVATE_MODULE_INTERFACE # special case QTBUG-83063 - Qt::XkbCommonSupportPrivate # special case + PRIVATE_MODULE_INTERFACE + Qt::XkbCommonSupportPrivate ) qt_extend_target(WaylandClient CONDITION TARGET Qt::PlatformCompositorSupportPrivate From c587035d51881a7bd98935edb8e5217cb07b5b2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Tue, 26 May 2020 15:01:05 +0200 Subject: [PATCH 0852/1507] Adapt to QtPlatformCompositorSupport removal Change-Id: Ic85f91d64c625a7196694cb49ff19df0661d5cbc Reviewed-by: Liang Qi --- src/plugins/platforms/wayland/CMakeLists.txt | 4 ++-- src/plugins/platforms/wayland/client.pro | 3 +-- src/plugins/platforms/wayland/qwaylandintegration.cpp | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/plugins/platforms/wayland/CMakeLists.txt b/src/plugins/platforms/wayland/CMakeLists.txt index fa5c34be480..883424aa036 100644 --- a/src/plugins/platforms/wayland/CMakeLists.txt +++ b/src/plugins/platforms/wayland/CMakeLists.txt @@ -99,9 +99,9 @@ qt_extend_target(WaylandClient CONDITION QT_FEATURE_xkbcommon Qt::XkbCommonSupportPrivate ) -qt_extend_target(WaylandClient CONDITION TARGET Qt::PlatformCompositorSupportPrivate +qt_extend_target(WaylandClient CONDITION QT_FEATURE_opengl LIBRARIES - Qt::PlatformCompositorSupportPrivate + Qt::OpenGLPrivate ) qt_extend_target(WaylandClient CONDITION TARGET Qt::LinuxAccessibilitySupportPrivate diff --git a/src/plugins/platforms/wayland/client.pro b/src/plugins/platforms/wayland/client.pro index 3355d663573..9ebdcf0e25b 100644 --- a/src/plugins/platforms/wayland/client.pro +++ b/src/plugins/platforms/wayland/client.pro @@ -19,8 +19,7 @@ qtConfig(xkbcommon) { QT_FOR_PRIVATE += xkbcommon_support-private } -qtHaveModule(platformcompositor_support-private): \ - QT_PRIVATE += platformcompositor_support-private +qtConfig(opengl): QT += opengl-private qtHaveModule(linuxaccessibility_support-private): \ QT_PRIVATE += linuxaccessibility_support-private diff --git a/src/plugins/platforms/wayland/qwaylandintegration.cpp b/src/plugins/platforms/wayland/qwaylandintegration.cpp index b5535cabfb0..4a5fce48a82 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandintegration.cpp @@ -68,7 +68,7 @@ #include #if QT_CONFIG(opengl) #include -#include +#include #endif // QT_CONFIG(opengl) #include From 212b040408ea691b120f5dc3792063db93121d86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Tue, 26 May 2020 15:21:16 +0200 Subject: [PATCH 0853/1507] Adapt to QPlatformBackingStoreOpenGLSupport removal Change-Id: Ib655030a51d9f4eb1fa111d7cf8d0215decc5780 Reviewed-by: Johan Helsing --- src/plugins/platforms/wayland/CMakeLists.txt | 5 ----- src/plugins/platforms/wayland/client.pro | 2 -- src/plugins/platforms/wayland/qwaylandintegration.cpp | 7 +------ 3 files changed, 1 insertion(+), 13 deletions(-) diff --git a/src/plugins/platforms/wayland/CMakeLists.txt b/src/plugins/platforms/wayland/CMakeLists.txt index 883424aa036..fba3c37e5e9 100644 --- a/src/plugins/platforms/wayland/CMakeLists.txt +++ b/src/plugins/platforms/wayland/CMakeLists.txt @@ -99,11 +99,6 @@ qt_extend_target(WaylandClient CONDITION QT_FEATURE_xkbcommon Qt::XkbCommonSupportPrivate ) -qt_extend_target(WaylandClient CONDITION QT_FEATURE_opengl - LIBRARIES - Qt::OpenGLPrivate -) - qt_extend_target(WaylandClient CONDITION TARGET Qt::LinuxAccessibilitySupportPrivate LIBRARIES Qt::LinuxAccessibilitySupportPrivate diff --git a/src/plugins/platforms/wayland/client.pro b/src/plugins/platforms/wayland/client.pro index 9ebdcf0e25b..1d496b78d44 100644 --- a/src/plugins/platforms/wayland/client.pro +++ b/src/plugins/platforms/wayland/client.pro @@ -19,8 +19,6 @@ qtConfig(xkbcommon) { QT_FOR_PRIVATE += xkbcommon_support-private } -qtConfig(opengl): QT += opengl-private - qtHaveModule(linuxaccessibility_support-private): \ QT_PRIVATE += linuxaccessibility_support-private diff --git a/src/plugins/platforms/wayland/qwaylandintegration.cpp b/src/plugins/platforms/wayland/qwaylandintegration.cpp index 4a5fce48a82..b7e32c87c9b 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandintegration.cpp @@ -68,7 +68,6 @@ #include #if QT_CONFIG(opengl) #include -#include #endif // QT_CONFIG(opengl) #include @@ -185,11 +184,7 @@ QPlatformOpenGLContext *QWaylandIntegration::createPlatformOpenGLContext(QOpenGL QPlatformBackingStore *QWaylandIntegration::createPlatformBackingStore(QWindow *window) const { - auto *backingStore = new QWaylandShmBackingStore(window, mDisplay.data()); -#if QT_CONFIG(opengl) - backingStore->setOpenGLSupport(new QPlatformBackingStoreOpenGLSupport(backingStore)); -#endif - return backingStore; + return new QWaylandShmBackingStore(window, mDisplay.data()); } QAbstractEventDispatcher *QWaylandIntegration::createEventDispatcher() const From 6ea7ae3c194281966845fd85a64a0cee4409e610 Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Thu, 4 Jun 2020 19:10:35 +0200 Subject: [PATCH 0854/1507] CMake: Regenerate configure.cmake files This adds the required qmake mixing informaiton. Change-Id: I5732611edfa4bc8f9038f1ad80df00bcb4da6bb2 Reviewed-by: Cristian Adam --- src/plugins/platforms/wayland/configure.cmake | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/plugins/platforms/wayland/configure.cmake b/src/plugins/platforms/wayland/configure.cmake index 29252417163..2310ba8dabe 100644 --- a/src/plugins/platforms/wayland/configure.cmake +++ b/src/plugins/platforms/wayland/configure.cmake @@ -7,15 +7,16 @@ #### Libraries if((LINUX) OR QT_FIND_ALL_PACKAGES_ALWAYS) - qt_find_package(Wayland PROVIDED_TARGETS Wayland::Client) + qt_find_package(Wayland PROVIDED_TARGETS Wayland::Client MODULE_NAME waylandclient QMAKE_LIB wayland-client) endif() if((LINUX) OR QT_FIND_ALL_PACKAGES_ALWAYS) - qt_find_package(Wayland PROVIDED_TARGETS Wayland::Cursor) + qt_find_package(Wayland PROVIDED_TARGETS Wayland::Cursor MODULE_NAME waylandclient QMAKE_LIB wayland-cursor) endif() +qt_add_qmake_lib_dependency(wayland-cursor wayland-client) if((LINUX) OR QT_FIND_ALL_PACKAGES_ALWAYS) - qt_find_package(Wayland PROVIDED_TARGETS Wayland::Egl) + qt_find_package(Wayland PROVIDED_TARGETS Wayland::Egl MODULE_NAME waylandclient QMAKE_LIB wayland-egl) endif() -qt_find_package(XComposite PROVIDED_TARGETS PkgConfig::XComposite) +qt_find_package(XComposite PROVIDED_TARGETS PkgConfig::XComposite MODULE_NAME waylandclient QMAKE_LIB xcomposite) #### Tests From b4542740df075929ca0383bd111660f50d0c0ee7 Mon Sep 17 00:00:00 2001 From: Jarek Kobus Date: Fri, 5 Jun 2020 14:49:44 +0200 Subject: [PATCH 0855/1507] Use QList instead of QVector Task-number: QTBUG-84469 Change-Id: I4bc7b2eb2913fc828f09f96e21480b76cabf8656 Reviewed-by: Lars Knoll --- .../xdg-shell-v5/qwaylandxdgshellv5_p.h | 4 +-- .../platforms/wayland/qwaylanddisplay_p.h | 6 ++--- .../wayland/qwaylandinputcontext_p.h | 4 +-- src/plugins/platforms/wayland/qwaylandshm_p.h | 4 +-- .../platforms/wayland/qwaylandshmwindow.cpp | 2 -- .../platforms/wayland/qwaylandsurface_p.h | 2 +- .../platforms/wayland/qwaylandtabletv2_p.h | 8 +++--- .../platforms/wayland/qwaylandwindow.cpp | 2 +- .../platforms/wayland/qwaylandwindow_p.h | 2 +- .../qwaylandsharedmemoryformathelper_p.h | 6 ++--- .../qtwaylandscanner/qtwaylandscanner.cpp | 4 +-- .../wayland/inputcontext/tst_inputcontext.cpp | 4 +-- .../tst_primaryselectionv1.cpp | 6 ++--- tests/auto/wayland/seatv4/tst_seatv4.cpp | 4 +-- tests/auto/wayland/seatv5/tst_seatv5.cpp | 4 +-- tests/auto/wayland/shared/corecompositor.h | 6 ++--- tests/auto/wayland/shared/coreprotocol.cpp | 2 +- tests/auto/wayland/shared/coreprotocol.h | 26 +++++++++---------- tests/auto/wayland/shared/datadevice.h | 2 +- tests/auto/wayland/shared/xdgshell.cpp | 4 +-- tests/auto/wayland/shared/xdgshell.h | 10 +++---- .../wayland/shared_old/mockcompositor.cpp | 8 +++--- .../auto/wayland/shared_old/mockcompositor.h | 12 ++++----- .../shared_old/mockfullscreenshellv1.h | 6 ++--- .../wayland/shared_old/mockiviapplication.h | 6 ++--- tests/auto/wayland/shared_old/mocksurface.cpp | 2 +- .../auto/wayland/shared_old/mockxdgshellv6.h | 6 ++--- tests/auto/wayland/tabletv2/tst_tabletv2.cpp | 16 ++++++------ tests/auto/wayland/xdgshell/tst_xdgshell.cpp | 2 +- 29 files changed, 84 insertions(+), 86 deletions(-) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshellv5_p.h b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshellv5_p.h index 2b0a59f1749..d0bdc8bc688 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshellv5_p.h +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshellv5_p.h @@ -54,7 +54,7 @@ #include "qwayland-xdg-shell-unstable-v5_p.h" #include -#include +#include #include #include @@ -82,7 +82,7 @@ public: private: void xdg_shell_ping(uint32_t serial) override; - QVector m_popups; + QList m_popups; uint m_popupSerial = 0; }; diff --git a/src/plugins/platforms/wayland/qwaylanddisplay_p.h b/src/plugins/platforms/wayland/qwaylanddisplay_p.h index 83a56556e33..12e3f413eed 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay_p.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay_p.h @@ -51,10 +51,10 @@ // We mean it. // +#include #include -#include #include -#include +#include #include #include @@ -280,7 +280,7 @@ private: QWaylandInputDevice *mLastInputDevice = nullptr; QPointer mLastInputWindow; QPointer mLastKeyboardFocus; - QVector mActiveWindows; + QList mActiveWindows; struct wl_callback *mSyncCallback = nullptr; static const wl_callback_listener syncCallbackListener; diff --git a/src/plugins/platforms/wayland/qwaylandinputcontext_p.h b/src/plugins/platforms/wayland/qwaylandinputcontext_p.h index 10132dfe19b..d3bf5a78562 100644 --- a/src/plugins/platforms/wayland/qwaylandinputcontext_p.h +++ b/src/plugins/platforms/wayland/qwaylandinputcontext_p.h @@ -54,10 +54,10 @@ #include +#include #include #include #include -#include #include #include @@ -113,7 +113,7 @@ private: QWaylandDisplay *m_display = nullptr; QWaylandInputMethodEventBuilder m_builder; - QVector m_modifiersMap; + QList m_modifiersMap; uint32_t m_serial = 0; struct ::wl_surface *m_surface = nullptr; diff --git a/src/plugins/platforms/wayland/qwaylandshm_p.h b/src/plugins/platforms/wayland/qwaylandshm_p.h index 639effa16d8..bf2bbce4ecf 100644 --- a/src/plugins/platforms/wayland/qwaylandshm_p.h +++ b/src/plugins/platforms/wayland/qwaylandshm_p.h @@ -51,8 +51,8 @@ // We mean it. // -#include #include +#include #include #include @@ -81,7 +81,7 @@ protected: void shm_format(uint32_t format) override; private: - QVector m_formats; + QList m_formats; }; diff --git a/src/plugins/platforms/wayland/qwaylandshmwindow.cpp b/src/plugins/platforms/wayland/qwaylandshmwindow.cpp index e305d028d56..9214665e47d 100644 --- a/src/plugins/platforms/wayland/qwaylandshmwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandshmwindow.cpp @@ -41,8 +41,6 @@ #include "qwaylandbuffer_p.h" -#include - #include QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandsurface_p.h b/src/plugins/platforms/wayland/qwaylandsurface_p.h index 541010934ad..930a137ac84 100644 --- a/src/plugins/platforms/wayland/qwaylandsurface_p.h +++ b/src/plugins/platforms/wayland/qwaylandsurface_p.h @@ -84,7 +84,7 @@ protected: void surface_enter(struct ::wl_output *output) override; void surface_leave(struct ::wl_output *output) override; - QVector m_screens; //As seen by wl_surface.enter/leave events. Chronological order. + QList m_screens; //As seen by wl_surface.enter/leave events. Chronological order. QWaylandWindow *m_window = nullptr; friend class QWaylandWindow; // TODO: shouldn't need to be friends diff --git a/src/plugins/platforms/wayland/qwaylandtabletv2_p.h b/src/plugins/platforms/wayland/qwaylandtabletv2_p.h index b4daaf5dbbb..36dd4268983 100644 --- a/src/plugins/platforms/wayland/qwaylandtabletv2_p.h +++ b/src/plugins/platforms/wayland/qwaylandtabletv2_p.h @@ -55,10 +55,10 @@ #include -#include #include #include #include +#include QT_BEGIN_NAMESPACE @@ -93,9 +93,9 @@ protected: void zwp_tablet_seat_v2_pad_added(struct ::zwp_tablet_pad_v2 *id) override; private: - QVector m_tablets; - QVector m_tools; - QVector m_pads; + QList m_tablets; + QList m_tools; + QList m_pads; }; class Q_WAYLAND_CLIENT_EXPORT QWaylandTabletV2 : public QObject, public QtWayland::zwp_tablet_v2 diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 7a186b326e1..fa2a5b7409c 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -386,7 +386,7 @@ void QWaylandWindow::sendExposeEvent(const QRect &rect) } -static QVector> activePopups; +static QList> activePopups; void QWaylandWindow::closePopups(QWaylandWindow *parent) { diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index be06e435fe5..93015dece6e 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -217,7 +217,7 @@ protected: QScopedPointer mSurface; QWaylandShellSurface *mShellSurface = nullptr; QWaylandSubSurface *mSubSurfaceWindow = nullptr; - QVector mChildren; + QList mChildren; QWaylandAbstractDecoration *mWindowDecoration = nullptr; bool mMouseEventsInContentArea = false; diff --git a/src/plugins/platforms/wayland/shared/qwaylandsharedmemoryformathelper_p.h b/src/plugins/platforms/wayland/shared/qwaylandsharedmemoryformathelper_p.h index 72cc8401c26..ac4428dfd5f 100644 --- a/src/plugins/platforms/wayland/shared/qwaylandsharedmemoryformathelper_p.h +++ b/src/plugins/platforms/wayland/shared/qwaylandsharedmemoryformathelper_p.h @@ -71,7 +71,7 @@ public: default: return QImage::Format_Invalid; } } - static inline QVector supportedWaylandFormats(); + static inline QList supportedWaylandFormats(); private: //IMPLEMENTATION (which has to be inline in the header because of the include trick) @@ -127,9 +127,9 @@ wl_shm_format QWaylandSharedMemoryFormatHelper::fromQImageFormat(QImage::Format return array.data[format]; } -QVector QWaylandSharedMemoryFormatHelper::supportedWaylandFormats() +QList QWaylandSharedMemoryFormatHelper::supportedWaylandFormats() { - QVector retFormats; + QList retFormats; Array array = getData(); for (size_t i = 0; i < array.size; i++) { if (int(array.data[i]) != INT_MIN diff --git a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp index 3cecb5bcfbe..130a71554c6 100644 --- a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp +++ b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp @@ -123,13 +123,13 @@ private: QByteArray m_scannerName; QByteArray m_headerPath; QByteArray m_prefix; - QVector m_includes; + QList m_includes; QXmlStreamReader *m_xml = nullptr; }; bool Scanner::parseArguments(int argc, char **argv) { - QVector args; + QList args; args.reserve(argc); for (int i = 0; i < argc; ++i) args << QByteArray(argv[i]); diff --git a/tests/auto/wayland/inputcontext/tst_inputcontext.cpp b/tests/auto/wayland/inputcontext/tst_inputcontext.cpp index 1f07eb5203a..d421b0d2202 100644 --- a/tests/auto/wayland/inputcontext/tst_inputcontext.cpp +++ b/tests/auto/wayland/inputcontext/tst_inputcontext.cpp @@ -85,7 +85,7 @@ QByteArray tst_inputcontext::inputContextName() const void tst_inputcontext::ensureTextInputPresentOnCompositor() { exec([&] { - QVector extensions = getAll(); + QList extensions = getAll(); if (extensions.length() > 1) QFAIL("TextInputManager is a singleton, hence there should not be more then one object returned"); if (extensions.length() == 0) @@ -96,7 +96,7 @@ void tst_inputcontext::ensureTextInputPresentOnCompositor() void tst_inputcontext::ensureTextInputNotPresentOnCompositor() { exec([&] { - QVector extensions = getAll(); + QList extensions = getAll(); if (extensions.length() > 1) QFAIL("TextInputManager is a singleton, hence there should not be more then one object returned"); if (extensions.length() == 1) diff --git a/tests/auto/wayland/primaryselectionv1/tst_primaryselectionv1.cpp b/tests/auto/wayland/primaryselectionv1/tst_primaryselectionv1.cpp index 660d1f83e11..f7a63d13ec6 100644 --- a/tests/auto/wayland/primaryselectionv1/tst_primaryselectionv1.cpp +++ b/tests/auto/wayland/primaryselectionv1/tst_primaryselectionv1.cpp @@ -140,7 +140,7 @@ public: PrimarySelectionDeviceManagerV1 *m_manager = nullptr; Seat *m_seat = nullptr; - QVector m_sentSelectionOffers; + QList m_sentSelectionOffers; PrimarySelectionSourceV1 *m_selectionSource = nullptr; uint m_serial = 0; @@ -194,7 +194,7 @@ public: int m_version = 1; // TODO: Remove on libwayland upgrade QMap m_devices; - QVector m_sources; + QList m_sources; protected: void zwp_primary_selection_device_manager_v1_destroy(Resource *resource) override { @@ -459,7 +459,7 @@ void tst_primaryselectionv1::copy() window.show(); QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial); - QVector mouseSerials; + QList mouseSerials; exec([&] { auto *surface = xdgSurface()->m_surface; keyboard()->sendEnter(surface); // Need to set keyboard focus according to protocol diff --git a/tests/auto/wayland/seatv4/tst_seatv4.cpp b/tests/auto/wayland/seatv4/tst_seatv4.cpp index 46d91e02876..1c1e7a02b5f 100644 --- a/tests/auto/wayland/seatv4/tst_seatv4.cpp +++ b/tests/auto/wayland/seatv4/tst_seatv4.cpp @@ -292,7 +292,7 @@ void tst_seatv4::simpleAxis() QPoint pixelDelta; QPoint angleDelta; // eights of a degree, positive is upwards, left }; - QVector m_events; + QList m_events; }; WheelWindow window; @@ -351,7 +351,7 @@ static bool supportsCursorSize(uint size, wl_shm *shm) return false; } -static bool supportsCursorSizes(const QVector &sizes) +static bool supportsCursorSizes(const QList &sizes) { auto *waylandIntegration = static_cast(QGuiApplicationPrivate::platformIntegration()); wl_shm *shm = waylandIntegration->display()->shm()->object(); diff --git a/tests/auto/wayland/seatv5/tst_seatv5.cpp b/tests/auto/wayland/seatv5/tst_seatv5.cpp index 081a0aa7016..2f7e70dc936 100644 --- a/tests/auto/wayland/seatv5/tst_seatv5.cpp +++ b/tests/auto/wayland/seatv5/tst_seatv5.cpp @@ -161,7 +161,7 @@ public: QPoint angleDelta; // eights of a degree, positive is upwards, left Qt::MouseEventSource source{}; }; - QVector m_events; + QList m_events; }; void tst_seatv5::simpleAxis_data() @@ -401,7 +401,7 @@ public: Qt::TouchPointStates touchPointStates{}; QList touchPoints; }; - QVector m_events; + QList m_events; }; void tst_seatv5::singleTap() diff --git a/tests/auto/wayland/shared/corecompositor.h b/tests/auto/wayland/shared/corecompositor.h index 254465ee6ec..1b43fd70360 100644 --- a/tests/auto/wayland/shared/corecompositor.h +++ b/tests/auto/wayland/shared/corecompositor.h @@ -145,10 +145,10 @@ public: * \brief Returns all globals with the given type, if any */ template - QVector getAll() + QList getAll() { warnIfNotLockedByThread(Q_FUNC_INFO); - QVector matching; + QList matching; for (auto *global : qAsConst(m_globals)) { if (auto *casted = qobject_cast(global)) matching.append(casted); @@ -199,7 +199,7 @@ protected: QByteArray m_socketName; wl_event_loop *m_eventLoop = nullptr; bool m_running = true; - QVector m_globals; + QList m_globals; QElapsedTimer m_timer; private: diff --git a/tests/auto/wayland/shared/coreprotocol.cpp b/tests/auto/wayland/shared/coreprotocol.cpp index 0d98852160d..c4181cb9445 100644 --- a/tests/auto/wayland/shared/coreprotocol.cpp +++ b/tests/auto/wayland/shared/coreprotocol.cpp @@ -485,7 +485,7 @@ uint Keyboard::sendKey(wl_client *client, uint key, uint state) } // Shm implementation -Shm::Shm(CoreCompositor *compositor, QVector formats, int version) +Shm::Shm(CoreCompositor *compositor, QList formats, int version) : QtWaylandServer::wl_shm(compositor->m_display, version) , m_compositor(compositor) , m_formats(formats) diff --git a/tests/auto/wayland/shared/coreprotocol.h b/tests/auto/wayland/shared/coreprotocol.h index 8d5e2d66d31..8bc8deece25 100644 --- a/tests/auto/wayland/shared/coreprotocol.h +++ b/tests/auto/wayland/shared/coreprotocol.h @@ -120,9 +120,9 @@ public: uint configureSerial = 0; int bufferScale = 1; } m_pending, m_committed; - QVector m_commits; - QVector m_waitingFrameCallbacks; - QVector m_outputs; + QList m_commits; + QList m_waitingFrameCallbacks; + QList m_outputs; SurfaceRole *m_role = nullptr; signals: @@ -149,7 +149,7 @@ public: {} bool isClean() override; QString dirtyMessage() override; - QVector m_surfaces; + QList m_surfaces; CoreCompositor *m_compositor = nullptr; signals: @@ -181,7 +181,7 @@ public: explicit SubCompositor(CoreCompositor *compositor, int version = 1) : QtWaylandServer::wl_subcompositor(compositor->m_display, version) {} - QVector m_subsurfaces; + QList m_subsurfaces; signals: void subsurfaceCreated(Subsurface *subsurface); @@ -270,13 +270,13 @@ public: CoreCompositor *m_compositor = nullptr; Pointer* m_pointer = nullptr; - QVector m_oldPointers; + QList m_oldPointers; Touch* m_touch = nullptr; - QVector m_oldTouchs; + QList m_oldTouchs; Keyboard* m_keyboard = nullptr; - QVector m_oldKeyboards; + QList m_oldKeyboards; uint m_capabilities = 0; @@ -313,7 +313,7 @@ public: void sendFrame(wl_client *client); Seat *m_seat = nullptr; - QVector m_enterSerials; + QList m_enterSerials; QPoint m_hotspot; signals: @@ -365,11 +365,11 @@ class Shm : public Global, public QtWaylandServer::wl_shm { Q_OBJECT public: - explicit Shm(CoreCompositor *compositor, QVector formats = {format_argb8888, format_xrgb8888, format_rgb888}, int version = 1); + explicit Shm(CoreCompositor *compositor, QList formats = {format_argb8888, format_xrgb8888, format_rgb888}, int version = 1); bool isClean() override; CoreCompositor *m_compositor = nullptr; - QVector m_pools; - const QVector m_formats; + QList m_pools; + const QList m_formats; protected: void shm_create_pool(Resource *resource, uint32_t id, int32_t fd, int32_t size) override; @@ -386,7 +386,7 @@ class ShmPool : QObject, public QtWaylandServer::wl_shm_pool public: explicit ShmPool(Shm *shm, wl_client *client, int id, int version = 1); Shm *m_shm = nullptr; - QVector m_buffers; + QList m_buffers; protected: void shm_pool_create_buffer(Resource *resource, uint32_t id, int32_t offset, int32_t width, int32_t height, int32_t stride, uint32_t format) override; diff --git a/tests/auto/wayland/shared/datadevice.h b/tests/auto/wayland/shared/datadevice.h index 98e780b2283..a8c30f8f2d9 100644 --- a/tests/auto/wayland/shared/datadevice.h +++ b/tests/auto/wayland/shared/datadevice.h @@ -71,7 +71,7 @@ public: DataDeviceManager *m_manager = nullptr; Seat *m_seat = nullptr; - QVector m_sentSelectionOffers; + QList m_sentSelectionOffers; protected: void data_device_release(Resource *resource) override diff --git a/tests/auto/wayland/shared/xdgshell.cpp b/tests/auto/wayland/shared/xdgshell.cpp index 72582f48d7f..79d5ea382ab 100644 --- a/tests/auto/wayland/shared/xdgshell.cpp +++ b/tests/auto/wayland/shared/xdgshell.cpp @@ -168,12 +168,12 @@ XdgToplevel::XdgToplevel(XdgSurface *xdgSurface, int id, int version) connect(surface(), &Surface::commit, this, [this] { m_committed = m_pending; }); } -void XdgToplevel::sendConfigure(const QSize &size, const QVector &states) +void XdgToplevel::sendConfigure(const QSize &size, const QList &states) { send_configure(size.width(), size.height(), toByteArray(states)); } -uint XdgToplevel::sendCompleteConfigure(const QSize &size, const QVector &states) +uint XdgToplevel::sendCompleteConfigure(const QSize &size, const QList &states) { sendConfigure(size, states); return m_xdgSurface->sendConfigure(); diff --git a/tests/auto/wayland/shared/xdgshell.h b/tests/auto/wayland/shared/xdgshell.h index 618babde73a..485da9d9f10 100644 --- a/tests/auto/wayland/shared/xdgshell.h +++ b/tests/auto/wayland/shared/xdgshell.h @@ -48,7 +48,7 @@ public: void send_ping(uint32_t) = delete; // It's a global, use resource specific instead bool isClean() override { return m_xdgSurfaces.empty(); } QString dirtyMessage() override { return m_xdgSurfaces.empty() ? "clean" : "remaining xdg surfaces"; } - QVector m_xdgSurfaces; + QList m_xdgSurfaces; XdgToplevel *toplevel(int i = 0); XdgPopup *popup(int i = 0); XdgPopup *m_topmostGrabbingPopup = nullptr; @@ -86,13 +86,13 @@ public: XdgWmBase *m_xdgWmBase = nullptr; Surface *m_surface = nullptr; bool m_configureSent = false; - QVector m_pendingConfigureSerials; + QList m_pendingConfigureSerials; uint m_ackedConfigureSerial = 0; uint m_committedConfigureSerial = 0; struct DoubleBufferedState { QRect windowGeometry = {0, 0, 0, 0}; } m_pending, m_committed; - QVector m_popups; + QList m_popups; public slots: void verifyConfigured() { QVERIFY(m_configureSent); } @@ -115,8 +115,8 @@ class XdgToplevel : public QObject, public QtWaylandServer::xdg_toplevel Q_OBJECT public: explicit XdgToplevel(XdgSurface *xdgSurface, int id, int version = 1); - void sendConfigure(const QSize &size = {0, 0}, const QVector &states = {}); - uint sendCompleteConfigure(const QSize &size = {0, 0}, const QVector &states = {}); + void sendConfigure(const QSize &size = {0, 0}, const QList &states = {}); + uint sendCompleteConfigure(const QSize &size = {0, 0}, const QList &states = {}); Surface *surface() { return m_xdgSurface->m_surface; } XdgSurface *m_xdgSurface = nullptr; diff --git a/tests/auto/wayland/shared_old/mockcompositor.cpp b/tests/auto/wayland/shared_old/mockcompositor.cpp index 9553076dd52..43b9ec839dc 100644 --- a/tests/auto/wayland/shared_old/mockcompositor.cpp +++ b/tests/auto/wayland/shared_old/mockcompositor.cpp @@ -199,7 +199,7 @@ void MockCompositor::sendIviSurfaceConfigure(const QSharedPointer toplevel, const QSize &size, const QVector &states) +void MockCompositor::sendXdgToplevelV6Configure(const QSharedPointer toplevel, const QSize &size, const QList &states) { Command command = makeCommand(Impl::Compositor::sendXdgToplevelV6Configure, m_compositor); command.parameters << QVariant::fromValue(toplevel); @@ -221,7 +221,7 @@ QSharedPointer MockCompositor::surface() QSharedPointer result; lock(); { - const QVector surfaces = m_compositor->surfaces(); + const QList surfaces = m_compositor->surfaces(); for (Impl::Surface *surface : surfaces) { // we don't want to mistake the cursor surface for a window surface if (surface->isMapped()) { @@ -415,12 +415,12 @@ void registerResource(wl_list *list, wl_resource *resource) wl_resource_add_destroy_listener(resource, listener); } -QVector Compositor::surfaces() const +QList Compositor::surfaces() const { return m_surfaces; } -QVector Compositor::outputs() const +QList Compositor::outputs() const { return m_outputs; } diff --git a/tests/auto/wayland/shared_old/mockcompositor.h b/tests/auto/wayland/shared_old/mockcompositor.h index 2433ac005da..3238039960a 100644 --- a/tests/auto/wayland/shared_old/mockcompositor.h +++ b/tests/auto/wayland/shared_old/mockcompositor.h @@ -38,11 +38,11 @@ #include #include +#include #include #include #include #include -#include #include class MockCompositor; @@ -74,8 +74,8 @@ public: uint32_t nextSerial(); uint32_t time() { return ++m_time; } - QVector surfaces() const; - QVector outputs() const; + QList surfaces() const; + QList outputs() const; IviApplication *iviApplication() const; XdgShellV6 *xdgShellV6() const; @@ -130,8 +130,8 @@ private: Keyboard *m_keyboard = nullptr; Touch *m_touch = nullptr; QScopedPointer m_data_device_manager; - QVector m_surfaces; - QVector m_outputs; + QList m_surfaces; + QList m_outputs; QScopedPointer m_iviApplication; QScopedPointer m_wlShell; QScopedPointer m_xdgShellV6; @@ -242,7 +242,7 @@ public: void sendShellSurfaceConfigure(const QSharedPointer surface, const QSize &size = QSize(0, 0)); void sendIviSurfaceConfigure(const QSharedPointer iviSurface, const QSize &size); void sendXdgToplevelV6Configure(const QSharedPointer toplevel, const QSize &size = QSize(0, 0), - const QVector &states = { ZXDG_TOPLEVEL_V6_STATE_ACTIVATED }); + const QList &states = { ZXDG_TOPLEVEL_V6_STATE_ACTIVATED }); void waitForStartDrag(); QSharedPointer surface(); diff --git a/tests/auto/wayland/shared_old/mockfullscreenshellv1.h b/tests/auto/wayland/shared_old/mockfullscreenshellv1.h index 819bbc186c7..c932d4f4d90 100644 --- a/tests/auto/wayland/shared_old/mockfullscreenshellv1.h +++ b/tests/auto/wayland/shared_old/mockfullscreenshellv1.h @@ -31,7 +31,7 @@ #include -#include +#include namespace Impl { @@ -43,14 +43,14 @@ class FullScreenShellV1 : public QtWaylandServer::zwp_fullscreen_shell_v1 public: explicit FullScreenShellV1(::wl_display *display) : zwp_fullscreen_shell_v1(display, 1) {} - QVector surfaces() const { return m_surfaces; } + QList surfaces() const { return m_surfaces; } void removeSurface(Surface *surface) { m_surfaces.removeOne(surface); } protected: void zwp_fullscreen_shell_v1_present_surface(Resource *resource, struct ::wl_resource *surface, uint32_t method, struct ::wl_resource *output) override; private: - QVector m_surfaces; + QList m_surfaces; }; } // namespace Impl diff --git a/tests/auto/wayland/shared_old/mockiviapplication.h b/tests/auto/wayland/shared_old/mockiviapplication.h index 4d65eeabaed..e2e3cb46563 100644 --- a/tests/auto/wayland/shared_old/mockiviapplication.h +++ b/tests/auto/wayland/shared_old/mockiviapplication.h @@ -31,8 +31,8 @@ #include +#include #include -#include class MockIviSurface; @@ -67,7 +67,7 @@ class IviApplication : public QtWaylandServer::ivi_application { public: explicit IviApplication(::wl_display *display) : ivi_application(display, 1) {} - QVector iviSurfaces() const { return m_iviSurfaces; } + QList iviSurfaces() const { return m_iviSurfaces; } protected: void ivi_application_surface_create(Resource *resource, uint32_t ivi_id, ::wl_resource *surface, uint32_t id) override; @@ -75,7 +75,7 @@ protected: private: void addIviSurface(IviSurface *iviSurface) { m_iviSurfaces.append(iviSurface); } void removeIviSurface(IviSurface *iviSurface) { m_iviSurfaces.removeOne(iviSurface); } - QVector m_iviSurfaces; + QList m_iviSurfaces; friend class IviSurface; }; diff --git a/tests/auto/wayland/shared_old/mocksurface.cpp b/tests/auto/wayland/shared_old/mocksurface.cpp index e9df5f90750..8ad45ae45b7 100644 --- a/tests/auto/wayland/shared_old/mocksurface.cpp +++ b/tests/auto/wayland/shared_old/mocksurface.cpp @@ -42,7 +42,7 @@ void Compositor::sendShellSurfaceConfigure(void *data, const QList &pa QSize size = parameters.at(1).toSize(); Q_ASSERT(size.isValid()); if (auto toplevel = surface->xdgToplevelV6()) { - QVector states = { ZXDG_TOPLEVEL_V6_STATE_ACTIVATED }; + QList states = { ZXDG_TOPLEVEL_V6_STATE_ACTIVATED }; auto statesBytes = QByteArray::fromRawData(reinterpret_cast(states.data()), states.size() * static_cast(sizeof(uint))); toplevel->send_configure(size.width(), size.height(), statesBytes); diff --git a/tests/auto/wayland/shared_old/mockxdgshellv6.h b/tests/auto/wayland/shared_old/mockxdgshellv6.h index a238fa56209..4528dd1b4f8 100644 --- a/tests/auto/wayland/shared_old/mockxdgshellv6.h +++ b/tests/auto/wayland/shared_old/mockxdgshellv6.h @@ -28,8 +28,8 @@ #include +#include #include -#include #ifndef MOCKXDGSHELLV6_H #define MOCKXDGSHELLV6_H @@ -96,7 +96,7 @@ class XdgShellV6 : public QtWaylandServer::zxdg_shell_v6 { public: explicit XdgShellV6(::wl_display *display) : zxdg_shell_v6(display, 1) {} - QVector toplevels() const { return m_toplevels; } + QList toplevels() const { return m_toplevels; } protected: void zxdg_shell_v6_get_xdg_surface(Resource *resource, uint32_t id, ::wl_resource *surface) override; @@ -104,7 +104,7 @@ protected: private: void addToplevel(XdgToplevelV6 *toplevel) { m_toplevels.append(toplevel); } void removeToplevel(XdgToplevelV6 *toplevel) { m_toplevels.removeOne(toplevel); } - QVector m_toplevels; + QList m_toplevels; friend class XdgToplevelV6; }; diff --git a/tests/auto/wayland/tabletv2/tst_tabletv2.cpp b/tests/auto/wayland/tabletv2/tst_tabletv2.cpp index 03fb2933d07..1c48a77f977 100644 --- a/tests/auto/wayland/tabletv2/tst_tabletv2.cpp +++ b/tests/auto/wayland/tabletv2/tst_tabletv2.cpp @@ -208,12 +208,12 @@ public: TabletManagerV2 *m_manager = nullptr; Seat *m_seat = nullptr; - QVector m_tablets; - QVector m_tabletsWaitingForDestroy; - QVector m_tools; - QVector m_toolsWaitingForDestroy; - QVector m_pads; - QVector m_padsWaitingForDestroy; + QList m_tablets; + QList m_tabletsWaitingForDestroy; + QList m_tools; + QList m_toolsWaitingForDestroy; + QList m_pads; + QList m_padsWaitingForDestroy; protected: void zwp_tablet_seat_v2_bind_resource(Resource *resource) @@ -445,7 +445,7 @@ class ProximityFilter : public QObject { public: ProximityFilter() { qApp->installEventFilter(this); } ~ProximityFilter() override { qDeleteAll(m_events); } - QVector m_events; + QList m_events; int nextEventIndex = 0; int numEvents() const { return m_events.size() - nextEventIndex; } @@ -621,7 +621,7 @@ signals: void tabletEventReceived(QTabletEvent *event); private: - QVector m_events; + QList m_events; }; void tst_tabletv2::moveEvent() diff --git a/tests/auto/wayland/xdgshell/tst_xdgshell.cpp b/tests/auto/wayland/xdgshell/tst_xdgshell.cpp index eabf29b7e64..3007fb32674 100644 --- a/tests/auto/wayland/xdgshell/tst_xdgshell.cpp +++ b/tests/auto/wayland/xdgshell/tst_xdgshell.cpp @@ -370,7 +370,7 @@ void tst_xdgshell::switchPopups() m_popups << new Popup(this); } ~Window() override { qDeleteAll(m_popups); } - QVector m_popups; + QList m_popups; }; Window window; From 9ef67d07698ec33c60022e76dfc1578abfa785da Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 10 Jun 2020 14:21:12 +0200 Subject: [PATCH 0856/1507] Adapt to moving EventDispatchers to QtGui MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Task-number: QTBUG-83255 Change-Id: Iea32600c1d2443c86723653a4fb8b568363cd796 Reviewed-by: Tor Arne Vestbø --- src/plugins/platforms/wayland/.prev_CMakeLists.txt | 6 ------ src/plugins/platforms/wayland/CMakeLists.txt | 1 - src/plugins/platforms/wayland/client.pro | 2 +- src/plugins/platforms/wayland/qwaylandintegration.cpp | 2 +- 4 files changed, 2 insertions(+), 9 deletions(-) diff --git a/src/plugins/platforms/wayland/.prev_CMakeLists.txt b/src/plugins/platforms/wayland/.prev_CMakeLists.txt index c19adbed8b0..e7e24dac212 100644 --- a/src/plugins/platforms/wayland/.prev_CMakeLists.txt +++ b/src/plugins/platforms/wayland/.prev_CMakeLists.txt @@ -55,7 +55,6 @@ qt_add_module(WaylandClient shellintegration LIBRARIES Qt::CorePrivate - Qt::EventDispatcherSupportPrivate Qt::FontDatabaseSupportPrivate Qt::GuiPrivate Qt::ServiceSupportPrivate @@ -99,11 +98,6 @@ qt_extend_target(WaylandClient CONDITION QT_FEATURE_xkbcommon Qt::XkbCommonSupportPrivate ) -qt_extend_target(WaylandClient CONDITION TARGET Qt::PlatformCompositorSupportPrivate - LIBRARIES - Qt::PlatformCompositorSupportPrivate -) - qt_extend_target(WaylandClient CONDITION TARGET Qt::LinuxAccessibilitySupportPrivate LIBRARIES Qt::LinuxAccessibilitySupportPrivate diff --git a/src/plugins/platforms/wayland/CMakeLists.txt b/src/plugins/platforms/wayland/CMakeLists.txt index fba3c37e5e9..696cb1f66c6 100644 --- a/src/plugins/platforms/wayland/CMakeLists.txt +++ b/src/plugins/platforms/wayland/CMakeLists.txt @@ -55,7 +55,6 @@ qt_add_module(WaylandClient shellintegration LIBRARIES Qt::CorePrivate - Qt::EventDispatcherSupportPrivate Qt::FontDatabaseSupportPrivate Qt::GuiPrivate Qt::ServiceSupportPrivate diff --git a/src/plugins/platforms/wayland/client.pro b/src/plugins/platforms/wayland/client.pro index 1d496b78d44..d76bdbf7151 100644 --- a/src/plugins/platforms/wayland/client.pro +++ b/src/plugins/platforms/wayland/client.pro @@ -3,7 +3,7 @@ MODULE = waylandclient QT += core-private gui-private QT_FOR_PRIVATE += service_support-private -QT_PRIVATE += fontdatabase_support-private eventdispatcher_support-private theme_support-private +QT_PRIVATE += fontdatabase_support-private theme_support-private # We have a bunch of C code with casts, so we can't have this option QMAKE_CXXFLAGS_WARN_ON -= -Wcast-qual diff --git a/src/plugins/platforms/wayland/qwaylandintegration.cpp b/src/plugins/platforms/wayland/qwaylandintegration.cpp index b7e32c87c9b..d310a189c50 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandintegration.cpp @@ -58,7 +58,7 @@ #else # include #endif -#include +#include #include #include From 132579d38c6ad10e04a03289e555b18740d1d884 Mon Sep 17 00:00:00 2001 From: Karsten Heimrich Date: Thu, 11 Jun 2020 13:41:55 +0200 Subject: [PATCH 0857/1507] Qt6: Port QtWayland from QStringRef to QStringView Task-number: QTBUG-84319 Change-Id: I5dc2f4506c149e5f2793cd7cab083278b93a980e Reviewed-by: Lars Knoll --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 2 +- .../wayland/shared/qwaylandinputmethodeventbuilder.cpp | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index fa2a5b7409c..802be1e02ad 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -307,7 +307,7 @@ void QWaylandWindow::setWindowTitle(const QString &title) // three bytes when converted to utf-8 (which is what libwayland uses), so divide by three. const int maxLength = libwaylandMaxBufferSize / 3 - 100; - auto truncated = QStringRef(&formatted).left(maxLength); + auto truncated = QStringView{formatted}.left(maxLength); if (truncated.length() < formatted.length()) { qCWarning(lcQpaWayland) << "Window titles longer than" << maxLength << "characters are not supported." << "Truncating window title (from" << formatted.length() << "chars)"; diff --git a/src/plugins/platforms/wayland/shared/qwaylandinputmethodeventbuilder.cpp b/src/plugins/platforms/wayland/shared/qwaylandinputmethodeventbuilder.cpp index 526d0ef465e..5f3c8a55df5 100644 --- a/src/plugins/platforms/wayland/shared/qwaylandinputmethodeventbuilder.cpp +++ b/src/plugins/platforms/wayland/shared/qwaylandinputmethodeventbuilder.cpp @@ -265,17 +265,17 @@ int QWaylandInputMethodEventBuilder::indexFromWayland(const QString &text, int l return base; if (length < 0) { - const QByteArray &utf8 = text.leftRef(base).toUtf8(); + const QByteArray &utf8 = QStringView{text}.left(base).toUtf8(); return QString::fromUtf8(utf8.left(qMax(utf8.length() + length, 0))).length(); } else { - const QByteArray &utf8 = text.midRef(base).toUtf8(); + const QByteArray &utf8 = QStringView{text}.mid(base).toUtf8(); return QString::fromUtf8(utf8.left(length)).length() + base; } } int QWaylandInputMethodEventBuilder::indexToWayland(const QString &text, int length, int base) { - return text.midRef(base, length).toUtf8().size(); + return QStringView{text}.mid(base, length).toUtf8().size(); } QT_END_NAMESPACE From fb8a7a484f08c8950ae84463f6425243b1f560a0 Mon Sep 17 00:00:00 2001 From: Liang Qi Date: Tue, 16 Jun 2020 08:50:58 +0200 Subject: [PATCH 0858/1507] Update dependencies on 'dev' in qt/qtwayland Remove FontDatabaseSupportPrivate/fontdatabase_support-private in the libraries dependency. The libraries were removed in qtbase in 6be9830d865be32f224e15d13ddefd9c7e176553 and the functionality is now in QtGui. Remove PlatformCompositorSupport mentions, it was removed in qtbase in 7172b5112e5dbf0cb63dec68d2f916a323748aa1, and functionality moved to QtGui. Add explicit package dependency on OpenGL, in case if qtdeclarative modules are missing, so that qtwayland can still be built without qtdeclarative. Change-Id: I5e8ec4cddd293e52c288ba629e6ba954c689a803 Reviewed-by: Alexandru Croitor --- src/plugins/platforms/wayland/.prev_CMakeLists.txt | 1 - src/plugins/platforms/wayland/CMakeLists.txt | 1 - src/plugins/platforms/wayland/client.pro | 2 +- src/plugins/platforms/wayland/qwaylandintegration.cpp | 6 +++--- 4 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/plugins/platforms/wayland/.prev_CMakeLists.txt b/src/plugins/platforms/wayland/.prev_CMakeLists.txt index e7e24dac212..84be2329153 100644 --- a/src/plugins/platforms/wayland/.prev_CMakeLists.txt +++ b/src/plugins/platforms/wayland/.prev_CMakeLists.txt @@ -55,7 +55,6 @@ qt_add_module(WaylandClient shellintegration LIBRARIES Qt::CorePrivate - Qt::FontDatabaseSupportPrivate Qt::GuiPrivate Qt::ServiceSupportPrivate Qt::ThemeSupportPrivate diff --git a/src/plugins/platforms/wayland/CMakeLists.txt b/src/plugins/platforms/wayland/CMakeLists.txt index 696cb1f66c6..b5fd478017b 100644 --- a/src/plugins/platforms/wayland/CMakeLists.txt +++ b/src/plugins/platforms/wayland/CMakeLists.txt @@ -55,7 +55,6 @@ qt_add_module(WaylandClient shellintegration LIBRARIES Qt::CorePrivate - Qt::FontDatabaseSupportPrivate Qt::GuiPrivate Qt::ServiceSupportPrivate Qt::ThemeSupportPrivate diff --git a/src/plugins/platforms/wayland/client.pro b/src/plugins/platforms/wayland/client.pro index d76bdbf7151..8c8d4936977 100644 --- a/src/plugins/platforms/wayland/client.pro +++ b/src/plugins/platforms/wayland/client.pro @@ -3,7 +3,7 @@ MODULE = waylandclient QT += core-private gui-private QT_FOR_PRIVATE += service_support-private -QT_PRIVATE += fontdatabase_support-private theme_support-private +QT_PRIVATE += theme_support-private # We have a bunch of C code with casts, so we can't have this option QMAKE_CXXFLAGS_WARN_ON -= -Wcast-qual diff --git a/src/plugins/platforms/wayland/qwaylandintegration.cpp b/src/plugins/platforms/wayland/qwaylandintegration.cpp index d310a189c50..97678f33180 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandintegration.cpp @@ -53,10 +53,10 @@ #include "qwaylandscreen_p.h" #if defined(Q_OS_MACOS) -# include -# include +# include +# include #else -# include +# include #endif #include #include From 01c959c74ebd1690d2ad3a8cd2f05ce2e7824151 Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Wed, 29 Apr 2020 13:55:12 +0200 Subject: [PATCH 0859/1507] CMake: Unify "wayland components" qt_find_package() calls So that the top-level call in src/CMakeLists.txt finds all the components, rather than doing it separately in each directory. This should prevent issues with dependency tracking of found packages even after the revert of dd7e40b1086020f6a054957f4972720cd6849280 in qtbase which is found at 8ddd3ee60bff1197b251feadf871fdaeb995ef3b. Amends a9430f98b399ed39d67ba28544568b898ec55392 Change-Id: I05eef9db2de30a61b1aee532edc331b33fc027fb Reviewed-by: Qt CI Bot Reviewed-by: Simon Hausmann --- src/platformsupport/wayland/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/platformsupport/wayland/CMakeLists.txt b/src/platformsupport/wayland/CMakeLists.txt index 62c1adbec41..ef145edd45c 100644 --- a/src/platformsupport/wayland/CMakeLists.txt +++ b/src/platformsupport/wayland/CMakeLists.txt @@ -1,7 +1,7 @@ # Generated from src.pro. # special case begin qt_find_package(WaylandScanner PROVIDED_TARGETS Wayland::Scanner) -qt_find_package(Wayland) +qt_find_package(Wayland PROVIDED_TARGETS Wayland::Client Wayland::Server) if (NOT WaylandScanner_FOUND OR NOT Wayland_FOUND) message(WARNING "QtWayland is missing required dependencies, nothing will be built. \ From f4807a0e1d82de0d407c7adbd54f35337e2a05fc Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Thu, 25 Jun 2020 15:04:20 +0200 Subject: [PATCH 0860/1507] Adapt to new QPointingDevice API QTouchDevice has been replaced with a more general QPointingDevice. All input devices need detailed information and need to be registered via QWindowSystemInterface::registerInputDevice(). This patch is not doing that yet; it's just enough to get qtwayland to compile again. Done-With: Liang Qi Change-Id: Id3a2e475ed07294a1977004fc72b11e466acc216 Reviewed-by: Liang Qi Reviewed-by: Qt CI Bot Reviewed-by: Allan Sandfeld Jensen --- .../platforms/wayland/qwaylandinputdevice.cpp | 11 +++-- .../platforms/wayland/qwaylandinputdevice_p.h | 2 +- .../platforms/wayland/qwaylandtabletv2.cpp | 22 ++++----- .../platforms/wayland/qwaylandtabletv2_p.h | 7 +-- .../platforms/wayland/qwaylandtouch.cpp | 11 +++-- .../platforms/wayland/qwaylandtouch_p.h | 2 +- tests/auto/wayland/seatv4/tst_seatv4.cpp | 2 +- tests/auto/wayland/seatv5/tst_seatv5.cpp | 22 ++++----- tests/auto/wayland/tabletv2/tst_tabletv2.cpp | 46 +++++++++---------- 9 files changed, 64 insertions(+), 61 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index 1de2ef17cee..af9458b44f9 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -73,7 +73,7 @@ #endif #include -#include +#include QT_BEGIN_NAMESPACE @@ -456,10 +456,11 @@ void QWaylandInputDevice::seat_capabilities(uint32_t caps) mTouch->init(get_touch()); if (!mTouchDevice) { - mTouchDevice = new QTouchDevice; - mTouchDevice->setType(QTouchDevice::TouchScreen); - mTouchDevice->setCapabilities(QTouchDevice::Position); - QWindowSystemInterface::registerTouchDevice(mTouchDevice); + // TODO number of touchpoints, actual name and ID + mTouchDevice = new QPointingDevice(QLatin1String("some touchscreen"), 0, + QInputDevice::DeviceType::TouchScreen, QPointingDevice::PointerType::Finger, + QInputDevice::Capability::Position, 10, 0); + QWindowSystemInterface::registerInputDevice(mTouchDevice); } } else if (!(caps & WL_SEAT_CAPABILITY_TOUCH) && mTouch) { delete mTouch; diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h index 448d0fce5dc..8e2dd184bdd 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h +++ b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h @@ -195,7 +195,7 @@ private: void seat_capabilities(uint32_t caps) override; void handleTouchPoint(int id, Qt::TouchPointState state, const QPointF &surfacePosition = QPoint()); - QTouchDevice *mTouchDevice = nullptr; + QPointingDevice *mTouchDevice = nullptr; friend class QWaylandTouchExtension; friend class QWaylandQtKeyExtension; diff --git a/src/plugins/platforms/wayland/qwaylandtabletv2.cpp b/src/plugins/platforms/wayland/qwaylandtabletv2.cpp index eb2e865f6e7..0f55aba9e00 100644 --- a/src/plugins/platforms/wayland/qwaylandtabletv2.cpp +++ b/src/plugins/platforms/wayland/qwaylandtabletv2.cpp @@ -137,35 +137,35 @@ void QWaylandTabletToolV2::zwp_tablet_tool_v2_done() case type::type_brush: case type::type_pencil: case type::type_pen: - m_pointerType = QTabletEvent::PointerType::Pen; + m_pointerType = QPointingDevice::PointerType::Pen; break; case type::type_eraser: - m_pointerType = QTabletEvent::PointerType::Eraser; + m_pointerType = QPointingDevice::PointerType::Eraser; break; case type::type_mouse: case type::type_lens: - m_pointerType = QTabletEvent::PointerType::Cursor; + m_pointerType = QPointingDevice::PointerType::Cursor; break; case type::type_finger: - m_pointerType = QTabletEvent::PointerType::UnknownPointer; + m_pointerType = QPointingDevice::PointerType::Unknown; break; } switch (m_toolType) { case type::type_airbrush: - m_tabletDevice = QTabletEvent::TabletDevice::Airbrush; + m_tabletDevice = QInputDevice::DeviceType::Airbrush; break; case type::type_brush: case type::type_pencil: case type::type_pen: case type::type_eraser: - m_tabletDevice = m_hasRotation ? QTabletEvent::TabletDevice::RotationStylus : QTabletEvent::TabletDevice::Stylus; + m_tabletDevice = QInputDevice::DeviceType::Stylus; break; case type::type_lens: - m_tabletDevice = QTabletEvent::TabletDevice::Puck; + m_tabletDevice = QInputDevice::DeviceType::Puck; break; case type::type_mouse: case type::type_finger: - m_tabletDevice = QTabletEvent::TabletDevice::NoDevice; + m_tabletDevice = QInputDevice::DeviceType::Unknown; break; } } @@ -261,7 +261,7 @@ void QWaylandTabletToolV2::zwp_tablet_tool_v2_button(uint32_t serial, uint32_t b void QWaylandTabletToolV2::zwp_tablet_tool_v2_frame(uint32_t time) { if (m_pending.proximitySurface && !m_applied.proximitySurface) { - QWindowSystemInterface::handleTabletEnterProximityEvent(m_tabletDevice, m_pointerType, m_uid); + QWindowSystemInterface::handleTabletEnterProximityEvent(int(m_tabletDevice), int(m_pointerType), m_uid); m_applied.proximitySurface = m_pending.proximitySurface; } @@ -288,12 +288,12 @@ void QWaylandTabletToolV2::zwp_tablet_tool_v2_frame(uint32_t time) qreal rotation = m_pending.rotation; int z = int(m_pending.distance); QWindowSystemInterface::handleTabletEvent(window, timestamp, localPosition, globalPosition, - m_tabletDevice, m_pointerType, buttons, pressure, + int(m_tabletDevice), int(m_pointerType), buttons, pressure, xTilt, yTilt, tangentialPressure, rotation, z, m_uid); } if (!m_pending.proximitySurface && m_applied.enteredSurface) { - QWindowSystemInterface::handleTabletLeaveProximityEvent(m_tabletDevice, m_pointerType, m_uid); + QWindowSystemInterface::handleTabletLeaveProximityEvent(int(m_tabletDevice), int(m_pointerType), m_uid); m_pending = State(); // Don't leave pressure etc. lying around when we enter the next surface } diff --git a/src/plugins/platforms/wayland/qwaylandtabletv2_p.h b/src/plugins/platforms/wayland/qwaylandtabletv2_p.h index 36dd4268983..bf3c78f0522 100644 --- a/src/plugins/platforms/wayland/qwaylandtabletv2_p.h +++ b/src/plugins/platforms/wayland/qwaylandtabletv2_p.h @@ -58,7 +58,8 @@ #include #include #include -#include +#include +#include QT_BEGIN_NAMESPACE @@ -142,8 +143,8 @@ protected: private: // Static state (sent before done event) - QTabletEvent::PointerType m_pointerType = QTabletEvent::PointerType::UnknownPointer; - QTabletEvent::TabletDevice m_tabletDevice = QTabletEvent::TabletDevice::NoDevice; + QPointingDevice::PointerType m_pointerType = QPointingDevice::PointerType::Unknown; + QInputDevice::DeviceType m_tabletDevice = QInputDevice::DeviceType::Unknown; type m_toolType = type_pen; bool m_hasRotation = false; quint64 m_uid = 0; diff --git a/src/plugins/platforms/wayland/qwaylandtouch.cpp b/src/plugins/platforms/wayland/qwaylandtouch.cpp index 17c41fa8d42..06fa822a3d9 100644 --- a/src/plugins/platforms/wayland/qwaylandtouch.cpp +++ b/src/plugins/platforms/wayland/qwaylandtouch.cpp @@ -42,7 +42,7 @@ #include "qwaylanddisplay_p.h" #include "qwaylandsurface_p.h" -#include +#include QT_BEGIN_NAMESPACE @@ -61,10 +61,11 @@ QWaylandTouchExtension::QWaylandTouchExtension(QWaylandDisplay *display, uint32_ void QWaylandTouchExtension::registerDevice(int caps) { - mTouchDevice = new QTouchDevice; - mTouchDevice->setType(QTouchDevice::TouchScreen); - mTouchDevice->setCapabilities(QTouchDevice::Capabilities(caps)); - QWindowSystemInterface::registerTouchDevice(mTouchDevice); + // TODO number of touchpoints, actual name and ID + mTouchDevice = new QPointingDevice(QLatin1String("some touchscreen"), 0, + QInputDevice::DeviceType::TouchScreen, QPointingDevice::PointerType::Finger, + QInputDevice::Capabilities(caps), 10, 0); + QWindowSystemInterface::registerInputDevice(mTouchDevice); } static inline qreal fromFixed(int f) diff --git a/src/plugins/platforms/wayland/qwaylandtouch_p.h b/src/plugins/platforms/wayland/qwaylandtouch_p.h index 93a829e2115..444e63facae 100644 --- a/src/plugins/platforms/wayland/qwaylandtouch_p.h +++ b/src/plugins/platforms/wayland/qwaylandtouch_p.h @@ -95,7 +95,7 @@ private: QList mTouchPoints; QList mPrevTouchPoints; - QTouchDevice *mTouchDevice = nullptr; + QPointingDevice *mTouchDevice = nullptr; uint32_t mTimestamp; int mPointsLeft; uint32_t mFlags; diff --git a/tests/auto/wayland/seatv4/tst_seatv4.cpp b/tests/auto/wayland/seatv4/tst_seatv4.cpp index 1c1e7a02b5f..b6394652baa 100644 --- a/tests/auto/wayland/seatv4/tst_seatv4.cpp +++ b/tests/auto/wayland/seatv4/tst_seatv4.cpp @@ -213,7 +213,7 @@ void tst_seatv4::mousePressFloat() { class Window : public QRasterWindow { public: - void mousePressEvent(QMouseEvent *e) override { m_position = e->localPos(); } + void mousePressEvent(QMouseEvent *e) override { m_position = e->position(); } QPointF m_position; }; diff --git a/tests/auto/wayland/seatv5/tst_seatv5.cpp b/tests/auto/wayland/seatv5/tst_seatv5.cpp index 2f7e70dc936..a4d4fe4dd48 100644 --- a/tests/auto/wayland/seatv5/tst_seatv5.cpp +++ b/tests/auto/wayland/seatv5/tst_seatv5.cpp @@ -424,14 +424,14 @@ void tst_seatv5::singleTap() QCOMPARE(e.type, QEvent::TouchBegin); QCOMPARE(e.touchPointStates, Qt::TouchPointState::TouchPointPressed); QCOMPARE(e.touchPoints.length(), 1); - QCOMPARE(e.touchPoints.first().pos(), QPointF(32-window.frameMargins().left(), 32-window.frameMargins().top())); + QCOMPARE(e.touchPoints.first().position(), QPointF(32-window.frameMargins().left(), 32-window.frameMargins().top())); } { auto e = window.m_events.takeFirst(); QCOMPARE(e.type, QEvent::TouchEnd); QCOMPARE(e.touchPointStates, Qt::TouchPointState::TouchPointReleased); QCOMPARE(e.touchPoints.length(), 1); - QCOMPARE(e.touchPoints.first().pos(), QPointF(32-window.frameMargins().left(), 32-window.frameMargins().top())); + QCOMPARE(e.touchPoints.first().position(), QPointF(32-window.frameMargins().left(), 32-window.frameMargins().top())); } } @@ -455,14 +455,14 @@ void tst_seatv5::singleTapFloat() QCOMPARE(e.type, QEvent::TouchBegin); QCOMPARE(e.touchPointStates, Qt::TouchPointState::TouchPointPressed); QCOMPARE(e.touchPoints.length(), 1); - QCOMPARE(e.touchPoints.first().pos(), QPointF(32.75-window.frameMargins().left(), 32.25-window.frameMargins().top())); + QCOMPARE(e.touchPoints.first().position(), QPointF(32.75-window.frameMargins().left(), 32.25-window.frameMargins().top())); } { auto e = window.m_events.takeFirst(); QCOMPARE(e.type, QEvent::TouchEnd); QCOMPARE(e.touchPointStates, Qt::TouchPointState::TouchPointReleased); QCOMPARE(e.touchPoints.length(), 1); - QCOMPARE(e.touchPoints.first().pos(), QPointF(32.75-window.frameMargins().left(), 32.25-window.frameMargins().top())); + QCOMPARE(e.touchPoints.first().position(), QPointF(32.75-window.frameMargins().left(), 32.25-window.frameMargins().top())); } } @@ -500,10 +500,10 @@ void tst_seatv5::multiTouch() QCOMPARE(e.touchPoints.length(), 2); QCOMPARE(e.touchPoints[0].state(), Qt::TouchPointState::TouchPointPressed); - QCOMPARE(e.touchPoints[0].pos(), QPointF(32-window.frameMargins().left(), 32-window.frameMargins().top())); + QCOMPARE(e.touchPoints[0].position(), QPointF(32-window.frameMargins().left(), 32-window.frameMargins().top())); QCOMPARE(e.touchPoints[1].state(), Qt::TouchPointState::TouchPointPressed); - QCOMPARE(e.touchPoints[1].pos(), QPointF(48-window.frameMargins().left(), 48-window.frameMargins().top())); + QCOMPARE(e.touchPoints[1].position(), QPointF(48-window.frameMargins().left(), 48-window.frameMargins().top())); } { auto e = window.m_events.takeFirst(); @@ -511,10 +511,10 @@ void tst_seatv5::multiTouch() QCOMPARE(e.touchPoints.length(), 2); QCOMPARE(e.touchPoints[0].state(), Qt::TouchPointState::TouchPointMoved); - QCOMPARE(e.touchPoints[0].pos(), QPointF(33-window.frameMargins().left(), 32-window.frameMargins().top())); + QCOMPARE(e.touchPoints[0].position(), QPointF(33-window.frameMargins().left(), 32-window.frameMargins().top())); QCOMPARE(e.touchPoints[1].state(), Qt::TouchPointState::TouchPointMoved); - QCOMPARE(e.touchPoints[1].pos(), QPointF(49-window.frameMargins().left(), 48-window.frameMargins().top())); + QCOMPARE(e.touchPoints[1].position(), QPointF(49-window.frameMargins().left(), 48-window.frameMargins().top())); } { auto e = window.m_events.takeFirst(); @@ -523,10 +523,10 @@ void tst_seatv5::multiTouch() QCOMPARE(e.touchPoints.length(), 2); QCOMPARE(e.touchPoints[0].state(), Qt::TouchPointState::TouchPointReleased); - QCOMPARE(e.touchPoints[0].pos(), QPointF(33-window.frameMargins().left(), 32-window.frameMargins().top())); + QCOMPARE(e.touchPoints[0].position(), QPointF(33-window.frameMargins().left(), 32-window.frameMargins().top())); QCOMPARE(e.touchPoints[1].state(), Qt::TouchPointState::TouchPointStationary); - QCOMPARE(e.touchPoints[1].pos(), QPointF(49-window.frameMargins().left(), 48-window.frameMargins().top())); + QCOMPARE(e.touchPoints[1].position(), QPointF(49-window.frameMargins().left(), 48-window.frameMargins().top())); } { auto e = window.m_events.takeFirst(); @@ -534,7 +534,7 @@ void tst_seatv5::multiTouch() QCOMPARE(e.touchPointStates, Qt::TouchPointState::TouchPointReleased); QCOMPARE(e.touchPoints.length(), 1); QCOMPARE(e.touchPoints[0].state(), Qt::TouchPointState::TouchPointReleased); - QCOMPARE(e.touchPoints[0].pos(), QPointF(49-window.frameMargins().left(), 48-window.frameMargins().top())); + QCOMPARE(e.touchPoints[0].position(), QPointF(49-window.frameMargins().left(), 48-window.frameMargins().top())); } } diff --git a/tests/auto/wayland/tabletv2/tst_tabletv2.cpp b/tests/auto/wayland/tabletv2/tst_tabletv2.cpp index 1c48a77f977..2cbafa35f7f 100644 --- a/tests/auto/wayland/tabletv2/tst_tabletv2.cpp +++ b/tests/auto/wayland/tabletv2/tst_tabletv2.cpp @@ -416,7 +416,7 @@ public: }; Q_DECLARE_METATYPE(QtWaylandServer::zwp_tablet_tool_v2::type); -Q_DECLARE_METATYPE(QTabletEvent::PointerType); +Q_DECLARE_METATYPE(QPointingDevice::PointerType); Q_DECLARE_METATYPE(Qt::MouseButton); class tst_tabletv2 : public QObject, private TabletCompositor @@ -465,8 +465,8 @@ protected: case QEvent::TabletEnterProximity: case QEvent::TabletLeaveProximity: { auto *e = static_cast(event); - auto *ev = new QTabletEvent(e->type(), e->posF(), e->globalPosF(), e->deviceType(), - e->pointerType(), e->pressure(), e->xTilt(), e->yTilt(), + auto *ev = new QTabletEvent(e->type(), e->position(), e->globalPosition(), int(e->deviceType()), + int(e->pointerType()), e->pressure(), e->xTilt(), e->yTilt(), e->tangentialPressure(), e->rotation(), e->z(), Qt::KeyboardModifier::NoModifier, e->uniqueId(), e->button(), e->buttons()); @@ -600,8 +600,8 @@ public: void tabletEvent(QTabletEvent *e) override { - m_events << new QTabletEvent(e->type(), e->posF(), e->globalPosF(), e->deviceType(), - e->pointerType(), e->pressure(), e->xTilt(), e->yTilt(), + m_events << new QTabletEvent(e->type(), e->position(), e->globalPosition(), int(e->deviceType()), + int(e->pointerType()), e->pressure(), e->xTilt(), e->yTilt(), e->tangentialPressure(), e->rotation(), e->z(), Qt::KeyboardModifier::NoModifier, e->uniqueId(), e->button(), e->buttons()); @@ -650,34 +650,34 @@ void tst_tabletv2::moveEvent() QTabletEvent *event = window.popEvent(); QCOMPARE(event->type(), QEvent::TabletMove); QCOMPARE(event->pressure(), 0); - QCOMPARE(event->posF(), QPointF(12, 34)); + QCOMPARE(event->position(), QPointF(12, 34)); } void tst_tabletv2::pointerType_data() { QTest::addColumn("toolType"); - QTest::addColumn("pointerType"); - QTest::addColumn("tabletDevice"); + QTest::addColumn("pointerType"); + QTest::addColumn("tabletDevice"); - QTest::newRow("pen") << ToolType::type_pen << QTabletEvent::PointerType::Pen << QTabletEvent::TabletDevice::Stylus; - QTest::newRow("eraser") << ToolType::type_eraser << QTabletEvent::PointerType::Eraser << QTabletEvent::TabletDevice::Stylus; - QTest::newRow("pencil") << ToolType::type_pencil << QTabletEvent::PointerType::Pen << QTabletEvent::TabletDevice::Stylus; - QTest::newRow("airbrush") << ToolType::type_airbrush << QTabletEvent::PointerType::Pen << QTabletEvent::TabletDevice::Airbrush; - QTest::newRow("brush") << ToolType::type_brush << QTabletEvent::PointerType::Pen << QTabletEvent::TabletDevice::Stylus; // TODO: is TabletDevice::Stylus the right thing? - QTest::newRow("lens") << ToolType::type_lens << QTabletEvent::PointerType::Cursor << QTabletEvent::TabletDevice::Puck; + QTest::newRow("pen") << ToolType::type_pen << QPointingDevice::PointerType::Pen << QInputDevice::DeviceType::Stylus; + QTest::newRow("eraser") << ToolType::type_eraser << QPointingDevice::PointerType::Eraser << QInputDevice::DeviceType::Stylus; + QTest::newRow("pencil") << ToolType::type_pencil << QPointingDevice::PointerType::Pen << QInputDevice::DeviceType::Stylus; + QTest::newRow("airbrush") << ToolType::type_airbrush << QPointingDevice::PointerType::Pen << QInputDevice::DeviceType::Airbrush; + QTest::newRow("brush") << ToolType::type_brush << QPointingDevice::PointerType::Pen << QInputDevice::DeviceType::Stylus; // TODO: is TabletDevice::Stylus the right thing? + QTest::newRow("lens") << ToolType::type_lens << QPointingDevice::PointerType::Cursor << QInputDevice::DeviceType::Puck; // TODO: also add tests for FourDMouse and RotationStylus (also need to send capabilities) // TODO: should these rather be mapped to touch/mouse events? - QTest::newRow("finger") << ToolType::type_finger << QTabletEvent::PointerType::UnknownPointer << QTabletEvent::TabletDevice::NoDevice; - QTest::newRow("mouse") << ToolType::type_mouse << QTabletEvent::PointerType::Cursor << QTabletEvent::TabletDevice::NoDevice; + QTest::newRow("finger") << ToolType::type_finger << QPointingDevice::PointerType::Unknown << QInputDevice::DeviceType::Unknown; + QTest::newRow("mouse") << ToolType::type_mouse << QPointingDevice::PointerType::Cursor << QInputDevice::DeviceType::Unknown; } void tst_tabletv2::pointerType() { using ToolType = QtWaylandServer::zwp_tablet_tool_v2::type; QFETCH(ToolType, toolType); - QFETCH(QTabletEvent::PointerType, pointerType); - QFETCH(QTabletEvent::TabletDevice, tabletDevice); + QFETCH(QPointingDevice::PointerType, pointerType); + QFETCH(QInputDevice::DeviceType, tabletDevice); ProximityFilter filter; @@ -726,7 +726,7 @@ void tst_tabletv2::pointerType() void tst_tabletv2::hardwareSerial() { ProximityFilter filter; - const quint64 uid = 0xbaba15dead15f00d; + const qint64 uid = 0xbaba15dead15f00d; QCOMPOSITOR_TRY_VERIFY(tabletSeat()); exec([&] { @@ -860,7 +860,7 @@ void tst_tabletv2::tabletEvents() QTabletEvent *event = window.popEvent(); QCOMPARE(event->type(), QEvent::TabletPress); QCOMPARE(event->pressure(), 1.0); - QCOMPARE(event->posF(), QPointF(12, 34)); + QCOMPARE(event->position(), QPointF(12, 34)); // Values we didn't send should be 0 QCOMPARE(event->rotation(), 0); @@ -882,7 +882,7 @@ void tst_tabletv2::tabletEvents() QVERIFY(qAbs(event->rotation() - 90) < 0.01); QVERIFY(qAbs(event->xTilt() - 13) < 0.01); QVERIFY(qAbs(event->yTilt() - 37) < 0.01); - QCOMPARE(event->posF(), QPointF(45, 56)); + QCOMPARE(event->position(), QPointF(45, 56)); // Verify that the values stay the same if we don't update them exec([&] { @@ -896,7 +896,7 @@ void tst_tabletv2::tabletEvents() QVERIFY(qAbs(event->rotation() - 90) < 0.01); QVERIFY(qAbs(event->xTilt() - 13) < 0.01); QVERIFY(qAbs(event->yTilt() - 37) < 0.01); - QCOMPARE(event->posF(), QPointF(10, 11)); + QCOMPARE(event->position(), QPointF(10, 11)); exec([&] { tabletTool()->sendPressure(0); @@ -911,7 +911,7 @@ void tst_tabletv2::tabletEvents() event = window.popEvent(); QCOMPARE(event->type(), QEvent::TabletRelease); QCOMPARE(event->pressure(), 0); - QCOMPARE(event->posF(), QPointF(10, 11)); + QCOMPARE(event->position(), QPointF(10, 11)); } QCOMPOSITOR_TEST_MAIN(tst_tabletv2) From 8deb43d1387470b85468a9dfc7b47524518a1a3f Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 18 Jun 2020 16:57:00 +0200 Subject: [PATCH 0861/1507] Adapt to moving of UNIX services/themes into QtGui Task-number: QTBUG-83255 Change-Id: I4770b796eb90c1ff76db940cd0cda44ea47648fa Reviewed-by: Liang Qi --- src/plugins/platforms/wayland/.prev_CMakeLists.txt | 3 --- src/plugins/platforms/wayland/CMakeLists.txt | 3 --- src/plugins/platforms/wayland/client.pro | 2 -- src/plugins/platforms/wayland/qwaylandintegration.cpp | 2 +- .../platforms/wayland/qwaylandwindowmanagerintegration_p.h | 2 +- 5 files changed, 2 insertions(+), 10 deletions(-) diff --git a/src/plugins/platforms/wayland/.prev_CMakeLists.txt b/src/plugins/platforms/wayland/.prev_CMakeLists.txt index 84be2329153..5b1a73e5a1e 100644 --- a/src/plugins/platforms/wayland/.prev_CMakeLists.txt +++ b/src/plugins/platforms/wayland/.prev_CMakeLists.txt @@ -56,8 +56,6 @@ qt_add_module(WaylandClient LIBRARIES Qt::CorePrivate Qt::GuiPrivate - Qt::ServiceSupportPrivate - Qt::ThemeSupportPrivate PUBLIC_LIBRARIES Qt::Core Qt::Gui @@ -65,7 +63,6 @@ qt_add_module(WaylandClient PRIVATE_MODULE_INTERFACE Qt::CorePrivate Qt::GuiPrivate - Qt::ServiceSupportPrivate ) qt6_generate_wayland_protocol_client_sources(WaylandClient diff --git a/src/plugins/platforms/wayland/CMakeLists.txt b/src/plugins/platforms/wayland/CMakeLists.txt index b5fd478017b..362b721beff 100644 --- a/src/plugins/platforms/wayland/CMakeLists.txt +++ b/src/plugins/platforms/wayland/CMakeLists.txt @@ -56,8 +56,6 @@ qt_add_module(WaylandClient LIBRARIES Qt::CorePrivate Qt::GuiPrivate - Qt::ServiceSupportPrivate - Qt::ThemeSupportPrivate PUBLIC_LIBRARIES Qt::Core Qt::Gui @@ -65,7 +63,6 @@ qt_add_module(WaylandClient PRIVATE_MODULE_INTERFACE Qt::CorePrivate Qt::GuiPrivate - Qt::ServiceSupportPrivate ) qt6_generate_wayland_protocol_client_sources(WaylandClient diff --git a/src/plugins/platforms/wayland/client.pro b/src/plugins/platforms/wayland/client.pro index 8c8d4936977..bdcf4256127 100644 --- a/src/plugins/platforms/wayland/client.pro +++ b/src/plugins/platforms/wayland/client.pro @@ -2,8 +2,6 @@ TARGET = QtWaylandClient MODULE = waylandclient QT += core-private gui-private -QT_FOR_PRIVATE += service_support-private -QT_PRIVATE += theme_support-private # We have a bunch of C code with casts, so we can't have this option QMAKE_CXXFLAGS_WARN_ON -= -Wcast-qual diff --git a/src/plugins/platforms/wayland/qwaylandintegration.cpp b/src/plugins/platforms/wayland/qwaylandintegration.cpp index 97678f33180..3d0631c37b9 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandintegration.cpp @@ -59,7 +59,7 @@ # include #endif #include -#include +#include #include diff --git a/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration_p.h b/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration_p.h index 31de6ddd34f..1c36f67bb18 100644 --- a/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration_p.h @@ -54,7 +54,7 @@ #include #include -#include +#include #include #include From 08a3e9eb8d9c8ac659e91bcfc8458a8d274ccf90 Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Mon, 8 Jun 2020 10:08:22 +0200 Subject: [PATCH 0862/1507] Declare QWaylandDisplay::findExistingCursorTheme noexcept Fixes error: exception specification in declaration does not match previous declaration Amends c962b8c2df8e8a2cbbb7fc4eceebc37bcf3506b9 Change-Id: I7e27ffd5bb3aa4c71680809268d86ba25242833a Reviewed-by: Pier Luigi Fiorini --- src/plugins/platforms/wayland/qwaylanddisplay_p.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay_p.h b/src/plugins/platforms/wayland/qwaylanddisplay_p.h index 12e3f413eed..818b5ba9048 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay_p.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay_p.h @@ -252,7 +252,7 @@ private: QWaylandCursorTheme *theme() const noexcept { return found ? position->theme.get() : nullptr; } }; - FindExistingCursorThemeResult findExistingCursorTheme(const QString &name, int pixelSize) const; + FindExistingCursorThemeResult findExistingCursorTheme(const QString &name, int pixelSize) const noexcept; QScopedPointer mCursor; #endif From a695c7fbc8b3e4eea2f2f0c384dc372d6c946047 Mon Sep 17 00:00:00 2001 From: Jide Zhang Date: Sat, 27 Jun 2020 16:04:41 +0800 Subject: [PATCH 0863/1507] Add spaces around '+' Like most other Qt coding styles, the necessary spaces should be added to the sides of the '+' Pick-to: 5.15 Change-Id: I6fdbc6b24861e7a75633354a0ded636b1a38cd21 Reviewed-by: Liang Qi --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 802be1e02ad..110e69a9346 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -366,8 +366,8 @@ void QWaylandWindow::setGeometry(const QRect &rect) void QWaylandWindow::resizeFromApplyConfigure(const QSize &sizeWithMargins, const QPoint &offset) { QMargins margins = frameMargins(); - int widthWithoutMargins = qMax(sizeWithMargins.width() - (margins.left()+margins.right()), 1); - int heightWithoutMargins = qMax(sizeWithMargins.height() - (margins.top()+margins.bottom()), 1); + int widthWithoutMargins = qMax(sizeWithMargins.width() - (margins.left() + margins.right()), 1); + int heightWithoutMargins = qMax(sizeWithMargins.height() - (margins.top() + margins.bottom()), 1); QRect geometry(windowGeometry().topLeft(), QSize(widthWithoutMargins, heightWithoutMargins)); mOffset += offset; From 2b827691dc7484afc58342c07794211c0a84afcb Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Mon, 8 Jun 2020 10:49:03 +0200 Subject: [PATCH 0864/1507] Replace calls to deprecated QEvent accessor functions Several event accessors were deprecated in qtbase/24e52c10deedbaef833c0e2c3ee7bee03eacc4f5. Replacements were generated by clazy using the new qevent-accessors check: $ export CLAZY_CHECKS=qevent-accessors $ export CLAZY_EXPORT_FIXES=1 $ ../qt6/configure -platform linux-clang -developer-build -debug -no-optimize-debug -opensource -confirm-license -no-pch QMAKE_CXX=clazy $ make $ cd ../../qt6/qtwayland $ find . -name "*.clazy.yaml" $ clang-apply-replacements . Task-number: QTBUG-20885 Task-number: QTBUG-84775 Change-Id: If822ba409f974f737dc46ac31f6e8e92cc1603cc Reviewed-by: Allan Sandfeld Jensen --- src/plugins/platforms/wayland/qwaylandcursor.cpp | 2 +- tests/auto/wayland/client/tst_client.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandcursor.cpp b/src/plugins/platforms/wayland/qwaylandcursor.cpp index 5a6ab44bc73..56caf05e2f1 100644 --- a/src/plugins/platforms/wayland/qwaylandcursor.cpp +++ b/src/plugins/platforms/wayland/qwaylandcursor.cpp @@ -270,7 +270,7 @@ void QWaylandCursor::changeCursor(QCursor *cursor, QWindow *window) void QWaylandCursor::pointerEvent(const QMouseEvent &event) { - mLastPos = event.globalPos(); + mLastPos = event.globalPosition().toPoint(); } QPoint QWaylandCursor::pos() const diff --git a/tests/auto/wayland/client/tst_client.cpp b/tests/auto/wayland/client/tst_client.cpp index 42e23b54ce9..ad63eca0a7d 100644 --- a/tests/auto/wayland/client/tst_client.cpp +++ b/tests/auto/wayland/client/tst_client.cpp @@ -81,7 +81,7 @@ public: void mousePressEvent(QMouseEvent *event) override { ++mousePressEventCount; - mousePressPos = event->pos(); + mousePressPos = event->position().toPoint(); } void mouseReleaseEvent(QMouseEvent *) override From a15ab037340d5f7378ab18f6ab8f6fd5ecdccabe Mon Sep 17 00:00:00 2001 From: Lars Schmertmann Date: Sat, 27 Jun 2020 13:03:01 +0200 Subject: [PATCH 0865/1507] Add ; to Q_UNUSED This is required to remove the ; from the macro with Qt 6. Task-number: QTBUG-82978 Change-Id: Ia626b9fbc2e4215cb9232ef9bcb71742d62dff4e Reviewed-by: Liang Qi --- src/plugins/platforms/wayland/qwaylanddisplay.cpp | 2 +- src/plugins/platforms/wayland/qwaylandshellsurface.cpp | 4 ++-- src/plugins/platforms/wayland/qwaylandshellsurface_p.h | 2 +- tests/auto/wayland/shared_old/mockfullscreenshellv1.cpp | 6 +++--- tests/auto/wayland/tabletv2/tst_tabletv2.cpp | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index 11af5f58950..e8c2ab8af30 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -439,7 +439,7 @@ uint32_t QWaylandDisplay::currentTimeMillisec() static void sync_callback(void *data, struct wl_callback *callback, uint32_t serial) { - Q_UNUSED(serial) + Q_UNUSED(serial); bool *done = static_cast(data); *done = true; diff --git a/src/plugins/platforms/wayland/qwaylandshellsurface.cpp b/src/plugins/platforms/wayland/qwaylandshellsurface.cpp index 91cc2c2c039..1dfdfd5e007 100644 --- a/src/plugins/platforms/wayland/qwaylandshellsurface.cpp +++ b/src/plugins/platforms/wayland/qwaylandshellsurface.cpp @@ -57,8 +57,8 @@ void QWaylandShellSurface::setWindowFlags(Qt::WindowFlags flags) void QWaylandShellSurface::sendProperty(const QString &name, const QVariant &value) { - Q_UNUSED(name) - Q_UNUSED(value) + Q_UNUSED(name); + Q_UNUSED(value); } } diff --git a/src/plugins/platforms/wayland/qwaylandshellsurface_p.h b/src/plugins/platforms/wayland/qwaylandshellsurface_p.h index 989cdb81b1c..080d13851bc 100644 --- a/src/plugins/platforms/wayland/qwaylandshellsurface_p.h +++ b/src/plugins/platforms/wayland/qwaylandshellsurface_p.h @@ -86,7 +86,7 @@ public: virtual void raise() {} virtual void lower() {} - virtual void setContentOrientationMask(Qt::ScreenOrientations orientation) { Q_UNUSED(orientation) } + virtual void setContentOrientationMask(Qt::ScreenOrientations orientation) { Q_UNUSED(orientation); } virtual void sendProperty(const QString &name, const QVariant &value); diff --git a/tests/auto/wayland/shared_old/mockfullscreenshellv1.cpp b/tests/auto/wayland/shared_old/mockfullscreenshellv1.cpp index 22c49cde60b..7463d23f672 100644 --- a/tests/auto/wayland/shared_old/mockfullscreenshellv1.cpp +++ b/tests/auto/wayland/shared_old/mockfullscreenshellv1.cpp @@ -33,9 +33,9 @@ namespace Impl { void FullScreenShellV1::zwp_fullscreen_shell_v1_present_surface(Resource *resource, struct ::wl_resource *surface, uint32_t method, struct ::wl_resource *output) { - Q_UNUSED(resource) - Q_UNUSED(method) - Q_UNUSED(output) + Q_UNUSED(resource); + Q_UNUSED(method); + Q_UNUSED(output); m_surfaces.append(Surface::fromResource(surface)); } diff --git a/tests/auto/wayland/tabletv2/tst_tabletv2.cpp b/tests/auto/wayland/tabletv2/tst_tabletv2.cpp index 2cbafa35f7f..f52db64f497 100644 --- a/tests/auto/wayland/tabletv2/tst_tabletv2.cpp +++ b/tests/auto/wayland/tabletv2/tst_tabletv2.cpp @@ -289,7 +289,7 @@ void TabletV2::sendRemoved() void TabletV2::zwp_tablet_v2_destroy(QtWaylandServer::zwp_tablet_v2::Resource *resource) { - Q_UNUSED(resource) + Q_UNUSED(resource); if (m_tabletSeat) { bool removed = m_tabletSeat->m_tabletsWaitingForDestroy.removeOne(this); QVERIFY(removed); From 71eb32d3280b920d3626c8b1bd204103012eff7b Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Thu, 2 Jul 2020 12:17:25 +0200 Subject: [PATCH 0866/1507] Update libwayland requirement to 1.15.0 [ChangeLog] libwayland 1.15.0 is now required. Fixes: QTBUG-73636 Change-Id: I585bb80c7d14ebfceb623b55cf7959121121599f Reviewed-by: Alexandru Croitor Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/platformsupport/wayland/CMakeLists.txt | 2 +- src/plugins/platforms/wayland/configure.json | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/platformsupport/wayland/CMakeLists.txt b/src/platformsupport/wayland/CMakeLists.txt index ef145edd45c..8e60f0ba8f5 100644 --- a/src/platformsupport/wayland/CMakeLists.txt +++ b/src/platformsupport/wayland/CMakeLists.txt @@ -1,7 +1,7 @@ # Generated from src.pro. # special case begin qt_find_package(WaylandScanner PROVIDED_TARGETS Wayland::Scanner) -qt_find_package(Wayland PROVIDED_TARGETS Wayland::Client Wayland::Server) +qt_find_package(Wayland 1.15 PROVIDED_TARGETS Wayland::Client Wayland::Server) if (NOT WaylandScanner_FOUND OR NOT Wayland_FOUND) message(WARNING "QtWayland is missing required dependencies, nothing will be built. \ diff --git a/src/plugins/platforms/wayland/configure.json b/src/plugins/platforms/wayland/configure.json index e054f144911..e799f8349ab 100644 --- a/src/plugins/platforms/wayland/configure.json +++ b/src/plugins/platforms/wayland/configure.json @@ -13,15 +13,15 @@ "test": { "main": [ "#if WAYLAND_VERSION_MAJOR < 1", - "# error Wayland 1.8.0 or higher required", + "# error Wayland 1.15.0 or higher required", "#endif", "#if WAYLAND_VERSION_MAJOR == 1", - "# if WAYLAND_VERSION_MINOR < 8", - "# error Wayland 1.8.0 or higher required", + "# if WAYLAND_VERSION_MINOR < 15", + "# error Wayland 1.15.0 or higher required", "# endif", - "# if WAYLAND_VERSION_MINOR == 8", + "# if WAYLAND_VERSION_MINOR == 15", "# if WAYLAND_VERSION_MICRO < 0", - "# error Wayland 1.8.0 or higher required", + "# error Wayland 1.15.0 or higher required", "# endif", "# endif", "#endif" From 0143b0dac902638a69b52f317a105e8722cf19c2 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Fri, 3 Jul 2020 14:13:25 +0200 Subject: [PATCH 0867/1507] Remove checks for old Wayland versions Now that the minimum libwayland version is 1.15, there is no point in checking whether the version is greater than 1.10. Task-number: QTBUG-73636 Change-Id: I75a97bec7e464aa6b04e21d1c23566d17ac7684a Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/tools/qtwaylandscanner/qtwaylandscanner.cpp | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp index 130a71554c6..f550651b2b5 100644 --- a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp +++ b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp @@ -1105,13 +1105,8 @@ bool Scanner::process() printf("static inline void *wlRegistryBind(struct ::wl_registry *registry, uint32_t name, const struct ::wl_interface *interface, uint32_t version)\n"); printf("{\n"); printf(" const uint32_t bindOpCode = 0;\n"); - printf("#if (WAYLAND_VERSION_MAJOR == 1 && WAYLAND_VERSION_MINOR > 10) || WAYLAND_VERSION_MAJOR > 1\n"); printf(" return (void *) wl_proxy_marshal_constructor_versioned((struct wl_proxy *) registry,\n"); - printf(" bindOpCode, interface, version, name, interface->name, version, nullptr);\n"); - printf("#else\n"); - printf(" return (void *) wl_proxy_marshal_constructor((struct wl_proxy *) registry,\n"); - printf(" bindOpCode, interface, name, interface->name, version, nullptr);\n"); - printf("#endif\n"); + printf(" bindOpCode, interface, version, name, interface->name, version, nullptr);\n"); printf("}\n"); printf("\n"); From 4189b0b2a2e3ac07fba010f25260db9a7b34e3d1 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Thu, 2 Jul 2020 09:12:27 +0200 Subject: [PATCH 0868/1507] Remove deprecated code XdgShellv5 and XdgShellv6 have been deprecated in the compositor since 5.15, and wl-scaler since 5.13. These are now removed. Since the qwindow-compositor has not been updated for a long time, it depends on the outdated protocols. This change removes it, since it no longer represents best practices. This means we will be missing a proper C++-based compositor for now, so we will have to create a new one later. Change-Id: Icc6ef97c17e553f266c4145abeef26ddd631d6bf Reviewed-by: Qt CI Bot Reviewed-by: Paul Olav Tvete --- src/3rdparty/wayland/protocols/qt_attribution.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/3rdparty/wayland/protocols/qt_attribution.json b/src/3rdparty/wayland/protocols/qt_attribution.json index 87f2422761d..d714d1dc410 100644 --- a/src/3rdparty/wayland/protocols/qt_attribution.json +++ b/src/3rdparty/wayland/protocols/qt_attribution.json @@ -163,7 +163,7 @@ Copyright 2015-2016 © Red Hat, Inc." "Name": "Wayland XDG Shell Protocol", "QDocModule": "qtwaylandcompositor", "QtUsage": "Used in the Qt Wayland Compositor, and the Qt Wayland platform plugin.", - "Files": " xdg-shell-unstable-v5.xml xdg-shell-unstable-v6.xml xdg-shell.xml ../../compositor/extensions/pregenerated/3rdparty/qwayland-server-xdg-shell-unstable-v5.cpp ../../compositor/extensions/pregenerated/3rdparty/qwayland-server-xdg-shell-unstable-v5_p.h ../../compositor/extensions/pregenerated/3rdparty/wayland-xdg-shell-unstable-v5-protocol.c ../../compositor/extensions/pregenerated/3rdparty/wayland-xdg-shell-unstable-v5-server-protocol_p.h ../../plugins/shellintegration/xdg-shell-v5/pregenerated/3rdparty/qwayland-xdg-shell-unstable-v5.cpp ../../plugins/shellintegration/xdg-shell-v5/pregenerated/3rdparty/qwayland-xdg-shell-unstable-v5_p.h ../../plugins/shellintegration/xdg-shell-v5/pregenerated/3rdparty/wayland-xdg-shell-unstable-v5-client-protocol_p.h ../../plugins/shellintegration/xdg-shell-v5/pregenerated/3rdparty/wayland-xdg-shell-unstable-v5-protocol.c", + "Files": " xdg-shell-unstable-v5.xml xdg-shell-unstable-v6.xml xdg-shell.xml ../../plugins/shellintegration/xdg-shell-v5/pregenerated/3rdparty/qwayland-xdg-shell-unstable-v5.cpp ../../plugins/shellintegration/xdg-shell-v5/pregenerated/3rdparty/qwayland-xdg-shell-unstable-v5_p.h ../../plugins/shellintegration/xdg-shell-v5/pregenerated/3rdparty/wayland-xdg-shell-unstable-v5-client-protocol_p.h ../../plugins/shellintegration/xdg-shell-v5/pregenerated/3rdparty/wayland-xdg-shell-unstable-v5-protocol.c", "Description": "The XDG-Shell protocol is an extended way to manage surfaces under Wayland compositors.", "Homepage": "https://gitlab.freedesktop.org/wayland/wayland-protocols/", From 7eea720dbd2c30edaccdbf21747af0a9a65e3796 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Mon, 6 Jul 2020 14:37:35 +0200 Subject: [PATCH 0869/1507] Use wl_surface.damage_buffer on the client side Prefer the newer, recommended damage_buffer when the compositor supports it. Fixes: QTBUG-74929 Change-Id: I9107966910b616a666931404a7b41bfac14c22c0 Reviewed-by: Eskil Abrahamsen Blomfeldt --- .../platforms/wayland/qwaylanddisplay.cpp | 2 +- src/plugins/platforms/wayland/qwaylandwindow.cpp | 16 +++++++++++++--- tests/auto/wayland/shared/coreprotocol.h | 2 +- tests/auto/wayland/shared_old/mockcompositor.cpp | 2 +- tests/auto/wayland/shared_old/mocksurface.cpp | 10 ++++++++++ tests/auto/wayland/shared_old/mocksurface.h | 2 ++ 6 files changed, 28 insertions(+), 6 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index e8c2ab8af30..9e5359357d8 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -314,7 +314,7 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin if (interface == QStringLiteral("wl_output")) { mWaitingScreens << new QWaylandScreen(this, version, id); } else if (interface == QStringLiteral("wl_compositor")) { - mCompositorVersion = qMin((int)version, 3); + mCompositorVersion = qMin((int)version, 4); mCompositor.init(registry, id, mCompositorVersion); } else if (interface == QStringLiteral("wl_shm")) { mShm.reset(new QWaylandShm(this, version, id)); diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 110e69a9346..f74cacf8cd7 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -541,7 +541,11 @@ void QWaylandWindow::attachOffset(QWaylandBuffer *buffer) void QWaylandWindow::damage(const QRect &rect) { - mSurface->damage(rect.x(), rect.y(), rect.width(), rect.height()); + const int s = scale(); + if (mDisplay->compositorVersion() >= 4) + mSurface->damage_buffer(s * rect.x(), s * rect.y(), s * rect.width(), s * rect.height()); + else + mSurface->damage(rect.x(), rect.y(), rect.width(), rect.height()); } void QWaylandWindow::safeCommit(QWaylandBuffer *buffer, const QRegion &damage) @@ -575,8 +579,14 @@ void QWaylandWindow::commit(QWaylandBuffer *buffer, const QRegion &damage) return; attachOffset(buffer); - for (const QRect &rect: damage) - mSurface->damage(rect.x(), rect.y(), rect.width(), rect.height()); + if (mDisplay->compositorVersion() >= 4) { + const int s = scale(); + for (const QRect &rect: damage) + mSurface->damage_buffer(s * rect.x(), s * rect.y(), s * rect.width(), s * rect.height()); + } else { + for (const QRect &rect: damage) + mSurface->damage(rect.x(), rect.y(), rect.width(), rect.height()); + } Q_ASSERT(!buffer->committed()); buffer->setCommitted(); mSurface->commit(); diff --git a/tests/auto/wayland/shared/coreprotocol.h b/tests/auto/wayland/shared/coreprotocol.h index 8bc8deece25..3670dc641ea 100644 --- a/tests/auto/wayland/shared/coreprotocol.h +++ b/tests/auto/wayland/shared/coreprotocol.h @@ -143,7 +143,7 @@ class WlCompositor : public Global, public QtWaylandServer::wl_compositor { Q_OBJECT public: - explicit WlCompositor(CoreCompositor *compositor, int version = 3) + explicit WlCompositor(CoreCompositor *compositor, int version = 4) : QtWaylandServer::wl_compositor(compositor->m_display, version) , m_compositor(compositor) {} diff --git a/tests/auto/wayland/shared_old/mockcompositor.cpp b/tests/auto/wayland/shared_old/mockcompositor.cpp index 43b9ec839dc..61494cbb5f1 100644 --- a/tests/auto/wayland/shared_old/mockcompositor.cpp +++ b/tests/auto/wayland/shared_old/mockcompositor.cpp @@ -342,7 +342,7 @@ Compositor::Compositor(MockCompositor *mockCompositor) exit(EXIT_FAILURE); } - wl_global_create(m_display, &wl_compositor_interface, 1, this, bindCompositor); + wl_global_create(m_display, &wl_compositor_interface, 4, this, bindCompositor); m_data_device_manager.reset(new DataDeviceManager(this, m_display)); diff --git a/tests/auto/wayland/shared_old/mocksurface.cpp b/tests/auto/wayland/shared_old/mocksurface.cpp index 8ad45ae45b7..23e088d3133 100644 --- a/tests/auto/wayland/shared_old/mocksurface.cpp +++ b/tests/auto/wayland/shared_old/mocksurface.cpp @@ -125,6 +125,16 @@ void Surface::surface_damage(Resource *resource, Q_UNUSED(height); } +void Surface::surface_damage_buffer(Resource *resource, + int32_t x, int32_t y, int32_t width, int32_t height) +{ + Q_UNUSED(resource); + Q_UNUSED(x); + Q_UNUSED(y); + Q_UNUSED(width); + Q_UNUSED(height); +} + void Surface::surface_frame(Resource *resource, uint32_t callback) { diff --git a/tests/auto/wayland/shared_old/mocksurface.h b/tests/auto/wayland/shared_old/mocksurface.h index 949dc23dd67..d176837e73b 100644 --- a/tests/auto/wayland/shared_old/mocksurface.h +++ b/tests/auto/wayland/shared_old/mocksurface.h @@ -65,6 +65,8 @@ protected: struct wl_resource *buffer, int x, int y) override; void surface_damage(Resource *resource, int32_t x, int32_t y, int32_t width, int32_t height) override; + void surface_damage_buffer(Resource *resource, + int32_t x, int32_t y, int32_t width, int32_t height) override; void surface_frame(Resource *resource, uint32_t callback) override; void surface_commit(Resource *resource) override; From 0815723d6dc754045651e2e33030ac0350d97104 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Tue, 7 Jul 2020 15:07:24 +0200 Subject: [PATCH 0870/1507] Stop using deprecated wayland-scanner argument The argument "code" is deprecated. Use "public-code" instead. Task-number: QTBUG-73099 Change-Id: Idc8dca127581e07b81d7174ece3312c27b6ba9db Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/tools/qtwaylandscanner/Qt6WaylandClientMacros.cmake | 2 +- src/tools/qtwaylandscanner/Qt6WaylandCompositorMacros.cmake | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/tools/qtwaylandscanner/Qt6WaylandClientMacros.cmake b/src/tools/qtwaylandscanner/Qt6WaylandClientMacros.cmake index 6624c84f26e..f81812d2df5 100644 --- a/src/tools/qtwaylandscanner/Qt6WaylandClientMacros.cmake +++ b/src/tools/qtwaylandscanner/Qt6WaylandClientMacros.cmake @@ -19,7 +19,7 @@ function(qt6_generate_wayland_protocol_client_sources target) add_custom_command( OUTPUT "${waylandscanner_code_output}" - COMMAND Wayland::Scanner --include-core-only code < "${protocol_file}" > "${waylandscanner_code_output}" + COMMAND Wayland::Scanner --include-core-only public-code < "${protocol_file}" > "${waylandscanner_code_output}" ) # TODO: Make this less hacky diff --git a/src/tools/qtwaylandscanner/Qt6WaylandCompositorMacros.cmake b/src/tools/qtwaylandscanner/Qt6WaylandCompositorMacros.cmake index 15444e6cc69..0a1241a6d04 100644 --- a/src/tools/qtwaylandscanner/Qt6WaylandCompositorMacros.cmake +++ b/src/tools/qtwaylandscanner/Qt6WaylandCompositorMacros.cmake @@ -17,7 +17,7 @@ function(qt6_generate_wayland_protocol_server_sources target) ) add_custom_command( OUTPUT "${waylandscanner_code_output}" - COMMAND Wayland::Scanner --include-core-only code < "${protocol_file}" > "${waylandscanner_code_output}" + COMMAND Wayland::Scanner --include-core-only public-code < "${protocol_file}" > "${waylandscanner_code_output}" ) # TODO: make this less hacky From bae4e9528ac0983c7a37e1c5104f090c1202b1cd Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Tue, 7 Jul 2020 15:23:25 +0200 Subject: [PATCH 0871/1507] Use --strict option for wayland-scanner Make protocol definition errors build errors. Task-number: QTBUG-73100 Change-Id: I1987bb93117f3bd017449f47eeb7e272597563dc Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/tools/qtwaylandscanner/Qt6WaylandClientMacros.cmake | 4 ++-- src/tools/qtwaylandscanner/Qt6WaylandCompositorMacros.cmake | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/tools/qtwaylandscanner/Qt6WaylandClientMacros.cmake b/src/tools/qtwaylandscanner/Qt6WaylandClientMacros.cmake index f81812d2df5..7b103fd6d97 100644 --- a/src/tools/qtwaylandscanner/Qt6WaylandClientMacros.cmake +++ b/src/tools/qtwaylandscanner/Qt6WaylandClientMacros.cmake @@ -14,12 +14,12 @@ function(qt6_generate_wayland_protocol_client_sources target) add_custom_command( OUTPUT "${waylandscanner_header_output}" #TODO: Maybe put the files in ${CMAKE_CURRENT_BINARY_DIR/wayland_generated instead? - COMMAND Wayland::Scanner --include-core-only client-header < "${protocol_file}" > "${waylandscanner_header_output}" + COMMAND Wayland::Scanner --strict --include-core-only client-header < "${protocol_file}" > "${waylandscanner_header_output}" ) add_custom_command( OUTPUT "${waylandscanner_code_output}" - COMMAND Wayland::Scanner --include-core-only public-code < "${protocol_file}" > "${waylandscanner_code_output}" + COMMAND Wayland::Scanner --strict --include-core-only public-code < "${protocol_file}" > "${waylandscanner_code_output}" ) # TODO: Make this less hacky diff --git a/src/tools/qtwaylandscanner/Qt6WaylandCompositorMacros.cmake b/src/tools/qtwaylandscanner/Qt6WaylandCompositorMacros.cmake index 0a1241a6d04..51e76b4d7eb 100644 --- a/src/tools/qtwaylandscanner/Qt6WaylandCompositorMacros.cmake +++ b/src/tools/qtwaylandscanner/Qt6WaylandCompositorMacros.cmake @@ -13,11 +13,11 @@ function(qt6_generate_wayland_protocol_server_sources target) add_custom_command( OUTPUT "${waylandscanner_header_output}" #TODO: Maybe put the files in ${CMAKE_CURRENT_BINARY_DIR/wayland_generated instead? - COMMAND Wayland::Scanner --include-core-only server-header < "${protocol_file}" > "${waylandscanner_header_output}" + COMMAND Wayland::Scanner --strict --include-core-only server-header < "${protocol_file}" > "${waylandscanner_header_output}" ) add_custom_command( OUTPUT "${waylandscanner_code_output}" - COMMAND Wayland::Scanner --include-core-only public-code < "${protocol_file}" > "${waylandscanner_code_output}" + COMMAND Wayland::Scanner --strict --include-core-only public-code < "${protocol_file}" > "${waylandscanner_code_output}" ) # TODO: make this less hacky From d2688a83a17ab9123f36ad5e026b1c4490d9b902 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Tue, 7 Jul 2020 16:27:32 +0200 Subject: [PATCH 0872/1507] Fix inconsistent signedness in qtwaylandscanner Use uint32_t everywhere for id. This is what libwayland does. Fixes: QTBUG-73098 Change-Id: Ie9564e59001cd9b29481d982b3136a4f31ece717 Reviewed-by: Eskil Abrahamsen Blomfeldt --- .../qtwaylandscanner/qtwaylandscanner.cpp | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp index f550651b2b5..8cc5fd470ee 100644 --- a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp +++ b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp @@ -532,7 +532,7 @@ bool Scanner::process() printf(" class %s %s\n {\n", serverExport.constData(), interfaceName); printf(" public:\n"); - printf(" %s(struct ::wl_client *client, int id, int version);\n", interfaceName); + printf(" %s(struct ::wl_client *client, uint32_t id, int version);\n", interfaceName); printf(" %s(struct ::wl_display *display, int version);\n", interfaceName); printf(" %s(struct ::wl_resource *resource);\n", interfaceName); printf(" %s();\n", interfaceName); @@ -555,13 +555,13 @@ bool Scanner::process() printf(" static Resource *fromResource(struct ::wl_resource *resource);\n"); printf(" };\n"); printf("\n"); - printf(" void init(struct ::wl_client *client, int id, int version);\n"); + printf(" void init(struct ::wl_client *client, uint32_t id, int version);\n"); printf(" void init(struct ::wl_display *display, int version);\n"); printf(" void init(struct ::wl_resource *resource);\n"); printf("\n"); printf(" Resource *add(struct ::wl_client *client, int version);\n"); - printf(" Resource *add(struct ::wl_client *client, int id, int version);\n"); - printf(" Resource *add(struct wl_list *resource_list, struct ::wl_client *client, int id, int version);\n"); + printf(" Resource *add(struct ::wl_client *client, uint32_t id, int version);\n"); + printf(" Resource *add(struct wl_list *resource_list, struct ::wl_client *client, uint32_t id, int version);\n"); printf("\n"); printf(" Resource *resource() { return m_resource; }\n"); printf(" const Resource *resource() const { return m_resource; }\n"); @@ -681,7 +681,7 @@ bool Scanner::process() QByteArray stripped = stripInterfaceName(interface.name); const char *interfaceNameStripped = stripped.constData(); - printf(" %s::%s(struct ::wl_client *client, int id, int version)\n", interfaceName, interfaceName); + printf(" %s::%s(struct ::wl_client *client, uint32_t id, int version)\n", interfaceName, interfaceName); printf(" : m_resource_map()\n"); printf(" , m_resource(nullptr)\n"); printf(" , m_global(nullptr)\n"); @@ -728,7 +728,7 @@ bool Scanner::process() printf(" }\n"); printf("\n"); - printf(" void %s::init(struct ::wl_client *client, int id, int version)\n", interfaceName); + printf(" void %s::init(struct ::wl_client *client, uint32_t id, int version)\n", interfaceName); printf(" {\n"); printf(" m_resource = bind(client, id, version);\n"); printf(" }\n"); @@ -748,7 +748,7 @@ bool Scanner::process() printf(" }\n"); printf("\n"); - printf(" %s::Resource *%s::add(struct ::wl_client *client, int id, int version)\n", interfaceName, interfaceName); + printf(" %s::Resource *%s::add(struct ::wl_client *client, uint32_t id, int version)\n", interfaceName, interfaceName); printf(" {\n"); printf(" Resource *resource = bind(client, id, version);\n"); printf(" m_resource_map.insert(client, resource);\n"); @@ -1016,13 +1016,13 @@ bool Scanner::process() printf(" class %s %s\n {\n", clientExport.constData(), interfaceName); printf(" public:\n"); - printf(" %s(struct ::wl_registry *registry, int id, int version);\n", interfaceName); + printf(" %s(struct ::wl_registry *registry, uint32_t id, int version);\n", interfaceName); printf(" %s(struct ::%s *object);\n", interfaceName, interfaceName); printf(" %s();\n", interfaceName); printf("\n"); printf(" virtual ~%s();\n", interfaceName); printf("\n"); - printf(" void init(struct ::wl_registry *registry, int id, int version);\n"); + printf(" void init(struct ::wl_registry *registry, uint32_t id, int version);\n"); printf(" void init(struct ::%s *object);\n", interfaceName); printf("\n"); printf(" struct ::%s *object() { return m_%s; }\n", interfaceName, interfaceName); @@ -1127,7 +1127,7 @@ bool Scanner::process() bool hasEvents = !interface.events.empty(); - printf(" %s::%s(struct ::wl_registry *registry, int id, int version)\n", interfaceName, interfaceName); + printf(" %s::%s(struct ::wl_registry *registry, uint32_t id, int version)\n", interfaceName, interfaceName); printf(" {\n"); printf(" init(registry, id, version);\n"); printf(" }\n"); @@ -1152,7 +1152,7 @@ bool Scanner::process() printf(" }\n"); printf("\n"); - printf(" void %s::init(struct ::wl_registry *registry, int id, int version)\n", interfaceName); + printf(" void %s::init(struct ::wl_registry *registry, uint32_t id, int version)\n", interfaceName); printf(" {\n"); printf(" m_%s = static_cast(wlRegistryBind(registry, id, &%s_interface, version));\n", interfaceName, interfaceName, interfaceName); if (hasEvents) From 1d5d2b66704e4033facd2994575cc38f6a300682 Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Thu, 9 Jul 2020 14:27:53 +0200 Subject: [PATCH 0873/1507] CMake: Regenerate projects We need the qt_add_tool changes to successfully configure qemu builds. The rest of the changes are just to be in sync with the .pro files. Change-Id: I64e92edc2486a71c88bd964a07adf502481b200d Reviewed-by: Joerg Bornemann --- src/tools/qtwaylandscanner/.prev_CMakeLists.txt | 3 ++- src/tools/qtwaylandscanner/CMakeLists.txt | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/tools/qtwaylandscanner/.prev_CMakeLists.txt b/src/tools/qtwaylandscanner/.prev_CMakeLists.txt index bb413544cb5..baa16eaebf7 100644 --- a/src/tools/qtwaylandscanner/.prev_CMakeLists.txt +++ b/src/tools/qtwaylandscanner/.prev_CMakeLists.txt @@ -4,7 +4,8 @@ ## qtwaylandscanner Tool: ##################################################################### -qt_add_tool(qtwaylandscanner +qt_get_tool_target_name(target_name qtwaylandscanner) +qt_add_tool(${target_name} SOURCES qtwaylandscanner.cpp PUBLIC_LIBRARIES diff --git a/src/tools/qtwaylandscanner/CMakeLists.txt b/src/tools/qtwaylandscanner/CMakeLists.txt index 17254afc3c3..74acf3419d0 100644 --- a/src/tools/qtwaylandscanner/CMakeLists.txt +++ b/src/tools/qtwaylandscanner/CMakeLists.txt @@ -4,7 +4,8 @@ ## qtwaylandscanner Tool: ##################################################################### -qt_add_tool(qtwaylandscanner +qt_get_tool_target_name(target_name qtwaylandscanner) +qt_add_tool(${target_name} TOOLS_TARGET WaylandScanner # special case SOURCES qtwaylandscanner.cpp From 7544734a332ef3fbc311f8d5c4188bb80ffdc248 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 2 Jul 2020 14:42:45 +0200 Subject: [PATCH 0874/1507] Adapt to recent qtbase changes and update dependencies MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - moving linuxaccessibility/xkbcommon/eglsupport/glxsupport to QtGui - event refactoring Task-number: QTBUG-83255 Change-Id: Ic82ee6ef5652413781468edb58c601ee7dce2e3b Reviewed-by: Tor Arne Vestbø --- .../platforms/wayland/.prev_CMakeLists.txt | 13 +------ src/plugins/platforms/wayland/CMakeLists.txt | 13 +------ src/plugins/platforms/wayland/client.pro | 9 ++--- .../brcm-egl/CMakeLists.txt | 1 - .../wayland-egl/.prev_CMakeLists.txt | 30 ++++++++++++++++ .../wayland-egl/CMakeLists.txt | 3 +- .../xcomposite-egl/.prev_CMakeLists.txt | 36 +++++++++++++++++++ .../xcomposite-egl/CMakeLists.txt | 2 +- .../xcomposite-glx/CMakeLists.txt | 1 - .../platforms/wayland/qwaylanddisplay_p.h | 2 +- .../platforms/wayland/qwaylandinputdevice.cpp | 16 ++++----- .../platforms/wayland/qwaylandinputdevice_p.h | 2 +- .../platforms/wayland/qwaylandintegration.cpp | 4 +-- .../wayland/qwaylandnativeinterface.cpp | 2 +- .../platforms/wayland/qwaylandtouch.cpp | 11 +++--- tests/auto/wayland/seatv5/tst_seatv5.cpp | 2 +- tests/auto/wayland/tabletv2/tst_tabletv2.cpp | 18 +++++----- 17 files changed, 101 insertions(+), 64 deletions(-) create mode 100644 src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/.prev_CMakeLists.txt create mode 100644 src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-egl/.prev_CMakeLists.txt diff --git a/src/plugins/platforms/wayland/.prev_CMakeLists.txt b/src/plugins/platforms/wayland/.prev_CMakeLists.txt index 5b1a73e5a1e..ac323a56f3f 100644 --- a/src/plugins/platforms/wayland/.prev_CMakeLists.txt +++ b/src/plugins/platforms/wayland/.prev_CMakeLists.txt @@ -56,6 +56,7 @@ qt_add_module(WaylandClient LIBRARIES Qt::CorePrivate Qt::GuiPrivate + Qt::PlatformHeadersPrivate PUBLIC_LIBRARIES Qt::Core Qt::Gui @@ -87,18 +88,6 @@ qt6_generate_wayland_protocol_client_sources(WaylandClient ## Scopes: ##################################################################### -qt_extend_target(WaylandClient CONDITION QT_FEATURE_xkbcommon - LIBRARIES - Qt::XkbCommonSupportPrivate - PRIVATE_MODULE_INTERFACE - Qt::XkbCommonSupportPrivate -) - -qt_extend_target(WaylandClient CONDITION TARGET Qt::LinuxAccessibilitySupportPrivate - LIBRARIES - Qt::LinuxAccessibilitySupportPrivate -) - qt_extend_target(WaylandClient CONDITION QT_FEATURE_clipboard SOURCES qwaylandclipboard.cpp qwaylandclipboard_p.h diff --git a/src/plugins/platforms/wayland/CMakeLists.txt b/src/plugins/platforms/wayland/CMakeLists.txt index 362b721beff..b49a72920d4 100644 --- a/src/plugins/platforms/wayland/CMakeLists.txt +++ b/src/plugins/platforms/wayland/CMakeLists.txt @@ -56,6 +56,7 @@ qt_add_module(WaylandClient LIBRARIES Qt::CorePrivate Qt::GuiPrivate + Qt::PlatformHeadersPrivate PUBLIC_LIBRARIES Qt::Core Qt::Gui @@ -87,18 +88,6 @@ qt6_generate_wayland_protocol_client_sources(WaylandClient ## Scopes: ##################################################################### -qt_extend_target(WaylandClient CONDITION QT_FEATURE_xkbcommon - LIBRARIES - Qt::XkbCommonSupportPrivate - PRIVATE_MODULE_INTERFACE - Qt::XkbCommonSupportPrivate -) - -qt_extend_target(WaylandClient CONDITION TARGET Qt::LinuxAccessibilitySupportPrivate - LIBRARIES - Qt::LinuxAccessibilitySupportPrivate -) - qt_extend_target(WaylandClient CONDITION QT_FEATURE_clipboard SOURCES qwaylandclipboard.cpp qwaylandclipboard_p.h diff --git a/src/plugins/platforms/wayland/client.pro b/src/plugins/platforms/wayland/client.pro index bdcf4256127..38b129e9edb 100644 --- a/src/plugins/platforms/wayland/client.pro +++ b/src/plugins/platforms/wayland/client.pro @@ -3,6 +3,8 @@ MODULE = waylandclient QT += core-private gui-private +QT_PRIVATE += platformheaders-private + # We have a bunch of C code with casts, so we can't have this option QMAKE_CXXFLAGS_WARN_ON -= -Wcast-qual @@ -13,13 +15,6 @@ use_gold_linker: CONFIG += no_linker_version_script CONFIG -= precompile_header CONFIG += link_pkgconfig wayland-scanner -qtConfig(xkbcommon) { - QT_FOR_PRIVATE += xkbcommon_support-private -} - -qtHaveModule(linuxaccessibility_support-private): \ - QT_PRIVATE += linuxaccessibility_support-private - QMAKE_USE += wayland-client INCLUDEPATH += $$PWD/../shared diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/CMakeLists.txt index f264dfbe937..5cf358b006c 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/CMakeLists.txt +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/CMakeLists.txt @@ -18,7 +18,6 @@ qt_internal_add_plugin(QWaylandBrcmEglClientBufferPlugin ${CMAKE_DL_LIBS} EGL::EGL Qt::Core - Qt::EglSupportPrivate Qt::Gui Qt::WaylandClientPrivate Wayland::Client diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/.prev_CMakeLists.txt b/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/.prev_CMakeLists.txt new file mode 100644 index 00000000000..b1732b014b4 --- /dev/null +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/.prev_CMakeLists.txt @@ -0,0 +1,30 @@ +# Generated from wayland-egl.pro. + +##################################################################### +## QWaylandEglClientBufferPlugin Plugin: +##################################################################### + +qt_internal_add_plugin(QWaylandEglClientBufferPlugin + OUTPUT_NAME qt-plugin-wayland-egl + TYPE wayland-graphics-integration-client + SOURCES + ../../../../hardwareintegration/client/wayland-egl/qwaylandeglclientbufferintegration.cpp ../../../../hardwareintegration/client/wayland-egl/qwaylandeglclientbufferintegration.h + ../../../../hardwareintegration/client/wayland-egl/qwaylandeglinclude.h + ../../../../hardwareintegration/client/wayland-egl/qwaylandeglwindow.cpp ../../../../hardwareintegration/client/wayland-egl/qwaylandeglwindow.h + ../../../../hardwareintegration/client/wayland-egl/qwaylandglcontext.cpp ../../../../hardwareintegration/client/wayland-egl/qwaylandglcontext.h + main.cpp + INCLUDE_DIRECTORIES + ../../../../hardwareintegration/client/wayland-egl + PUBLIC_LIBRARIES + ${CMAKE_DL_LIBS} + EGL::EGL + Qt::Core + Qt::Gui + Qt::OpenGLPrivate + Qt::WaylandClientPrivate + Wayland::Client + Wayland::Egl +) + +#### Keys ignored in scope 1:.:.:wayland-egl.pro:: +# OTHER_FILES = "wayland-egl.json" diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/CMakeLists.txt index b7e274170fd..1742f1173a8 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/CMakeLists.txt +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/CMakeLists.txt @@ -3,6 +3,7 @@ ##################################################################### ## QWaylandEglClientBufferPlugin Plugin: ##################################################################### +qt_find_package(EGL) # special case qt_internal_add_plugin(QWaylandEglClientBufferPlugin OUTPUT_NAME qt-plugin-wayland-egl @@ -16,9 +17,9 @@ qt_internal_add_plugin(QWaylandEglClientBufferPlugin INCLUDE_DIRECTORIES ../../../../hardwareintegration/client/wayland-egl PUBLIC_LIBRARIES + ${CMAKE_DL_LIBS} EGL::EGL Qt::Core - Qt::EglSupportPrivate Qt::Gui Qt::OpenGLPrivate Qt::WaylandClientPrivate diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-egl/.prev_CMakeLists.txt b/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-egl/.prev_CMakeLists.txt new file mode 100644 index 00000000000..f575d44e935 --- /dev/null +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-egl/.prev_CMakeLists.txt @@ -0,0 +1,36 @@ +# Generated from xcomposite-egl.pro. + +##################################################################### +## QWaylandXCompositeEglClientBufferPlugin Plugin: +##################################################################### + +qt_internal_add_plugin(QWaylandXCompositeEglClientBufferPlugin + OUTPUT_NAME xcomposite-egl + TYPE wayland-graphics-integration-client + SOURCES + ../../../../hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglclientbufferintegration.cpp ../../../../hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglclientbufferintegration.h + ../../../../hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglcontext.cpp ../../../../hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglcontext.h + ../../../../hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglwindow.cpp ../../../../hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglwindow.h + ../../../../hardwareintegration/client/xcomposite_share/qwaylandxcompositebuffer.cpp ../../../../hardwareintegration/client/xcomposite_share/qwaylandxcompositebuffer.h + main.cpp + INCLUDE_DIRECTORIES + ../../../../hardwareintegration/client/xcomposite-egl + ../../../../hardwareintegration/client/xcomposite_share + PUBLIC_LIBRARIES + EGL::EGL + PkgConfig::XComposite + Qt::Core + Qt::Gui + Qt::WaylandClientPrivate + Wayland::Client + X11::X11 +) + +qt6_generate_wayland_protocol_client_sources(QWaylandXCompositeEglClientBufferPlugin + FILES + ${CMAKE_CURRENT_SOURCE_DIR}/../../../../hardwareintegration/client/xcomposite_share/../../../extensions/xcomposite.xml +) + +#### Keys ignored in scope 1:.:.:xcomposite-egl.pro:: +# OTHER_FILES = "xcomposite-egl.json" +# QMAKE_CXXFLAGS_WARN_ON = "--Wcast-qual" diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-egl/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-egl/CMakeLists.txt index 6ed42e74fa0..9b7324ccd74 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-egl/CMakeLists.txt +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-egl/CMakeLists.txt @@ -3,6 +3,7 @@ ##################################################################### ## QWaylandXCompositeEglClientBufferPlugin Plugin: ##################################################################### +qt_find_package(EGL) # special case qt_internal_add_plugin(QWaylandXCompositeEglClientBufferPlugin OUTPUT_NAME xcomposite-egl @@ -20,7 +21,6 @@ qt_internal_add_plugin(QWaylandXCompositeEglClientBufferPlugin EGL::EGL PkgConfig::XComposite Qt::Core - Qt::EglSupportPrivate Qt::Gui Qt::WaylandClientPrivate Wayland::Client diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-glx/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-glx/CMakeLists.txt index 54c18d0ed9a..0f0ea0733b2 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-glx/CMakeLists.txt +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-glx/CMakeLists.txt @@ -20,7 +20,6 @@ qt_internal_add_plugin(QWaylandXCompositeGlxClientBufferPlugin ${CMAKE_DL_LIBS} PkgConfig::XComposite Qt::Core - Qt::GlxSupportPrivate Qt::Gui Qt::WaylandClientPrivate Wayland::Client diff --git a/src/plugins/platforms/wayland/qwaylanddisplay_p.h b/src/plugins/platforms/wayland/qwaylanddisplay_p.h index 818b5ba9048..d386c66ac68 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay_p.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay_p.h @@ -66,7 +66,7 @@ #include #if QT_CONFIG(xkbcommon) -#include +#include #endif struct wl_cursor_image; diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index af9458b44f9..e86274276f0 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -1428,16 +1428,16 @@ void QWaylandInputDevice::handleTouchPoint(int id, Qt::TouchPointState state, co } // If the touch point was pressed earlier this frame, we don't want to overwrite its state. - if (tp.state != Qt::TouchPointPressed) - tp.state = state; + if (tp.state != QEventPoint::Pressed) + tp.state = QEventPoint::State(state); - tp.pressure = tp.state == Qt::TouchPointReleased ? 0 : 1; + tp.pressure = tp.state == QEventPoint::Released ? 0 : 1; } bool QWaylandInputDevice::Touch::allTouchPointsReleased() { for (const auto &tp : qAsConst(mPendingTouchPoints)) { - if (tp.state != Qt::TouchPointReleased) + if (tp.state != QEventPoint::Released) return false; } return true; @@ -1449,7 +1449,7 @@ void QWaylandInputDevice::Touch::releasePoints() return; for (QWindowSystemInterface::TouchPoint &tp : mPendingTouchPoints) - tp.state = Qt::TouchPointReleased; + tp.state = QEventPoint::Released; touch_frame(); } @@ -1467,7 +1467,7 @@ void QWaylandInputDevice::Touch::touch_frame() QMargins margins = window->frameMargins(); QPoint p = tp.area.center().toPoint(); QPointF localPos(window->mapFromGlobal(QPoint(p.x() + margins.left(), p.y() + margins.top()))); - if (mFocus->touchDragDecoration(mParent, localPos, tp.area.center(), tp.state, mParent->modifiers())) + if (mFocus->touchDragDecoration(mParent, localPos, tp.area.center(), Qt::TouchPointState(tp.state), mParent->modifiers())) return; } @@ -1478,9 +1478,9 @@ void QWaylandInputDevice::Touch::touch_frame() mPendingTouchPoints.clear(); for (const auto &prevPoint: prevTouchPoints) { // All non-released touch points should be part of the next touch event - if (prevPoint.state != Qt::TouchPointReleased) { + if (prevPoint.state != QEventPoint::Released) { QWindowSystemInterface::TouchPoint tp = prevPoint; - tp.state = Qt::TouchPointStationary; // ... as stationary (unless proven otherwise) + tp.state = QEventPoint::Stationary; // ... as stationary (unless proven otherwise) mPendingTouchPoints.append(tp); } } diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h index 8e2dd184bdd..31bd3008849 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h +++ b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h @@ -65,7 +65,7 @@ #include #if QT_CONFIG(xkbcommon) -#include +#include #endif #include diff --git a/src/plugins/platforms/wayland/qwaylandintegration.cpp b/src/plugins/platforms/wayland/qwaylandintegration.cpp index 3d0631c37b9..0aa18f09825 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandintegration.cpp @@ -89,11 +89,11 @@ #include "qwaylandinputdeviceintegrationfactory_p.h" #if QT_CONFIG(accessibility_atspi_bridge) -#include +#include #endif #if QT_CONFIG(xkbcommon) -#include +#include #endif #if QT_CONFIG(vulkan) diff --git a/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp b/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp index bf54a1a00f9..da788547789 100644 --- a/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp +++ b/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp @@ -55,7 +55,7 @@ #include #endif -#include +#include QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandtouch.cpp b/src/plugins/platforms/wayland/qwaylandtouch.cpp index 06fa822a3d9..6c723903451 100644 --- a/src/plugins/platforms/wayland/qwaylandtouch.cpp +++ b/src/plugins/platforms/wayland/qwaylandtouch.cpp @@ -101,13 +101,12 @@ void QWaylandTouchExtension::touch_extension_touch(uint32_t time, QWindowSystemInterface::TouchPoint tp; tp.id = id; - tp.state = Qt::TouchPointState(int(state & 0xFFFF)); + tp.state = QEventPoint::State(int(state & 0xFFFF)); int sentPointCount = state >> 16; if (!mPointsLeft) { Q_ASSERT(sentPointCount > 0); mPointsLeft = sentPointCount; } - tp.flags = QTouchEvent::TouchPoint::InfoFlags(int(flags & 0xFFFF)); if (!mTouchDevice) registerDevice(flags >> 16); @@ -146,7 +145,7 @@ void QWaylandTouchExtension::sendTouchEvent() // Copy all points, that are in the previous but not in the current list, as stationary. for (int i = 0; i < mPrevTouchPoints.count(); ++i) { const QWindowSystemInterface::TouchPoint &prevPoint(mPrevTouchPoints.at(i)); - if (prevPoint.state == Qt::TouchPointReleased) + if (prevPoint.state == QEventPoint::Released) continue; bool found = false; for (int j = 0; j < mTouchPoints.count(); ++j) @@ -156,7 +155,7 @@ void QWaylandTouchExtension::sendTouchEvent() } if (!found) { QWindowSystemInterface::TouchPoint p = prevPoint; - p.state = Qt::TouchPointStationary; + p.state = QEventPoint::Stationary; mTouchPoints.append(p); } } @@ -168,7 +167,7 @@ void QWaylandTouchExtension::sendTouchEvent() QWindowSystemInterface::handleTouchEvent(mTargetWindow, mTimestamp, mTouchDevice, mTouchPoints); - Qt::TouchPointStates states = {}; + QEventPoint::States states = {}; for (int i = 0; i < mTouchPoints.count(); ++i) states |= mTouchPoints.at(i).state; @@ -179,7 +178,7 @@ void QWaylandTouchExtension::sendTouchEvent() for (int i = 0; i < mTouchPoints.count(); ++i) { const QWindowSystemInterface::TouchPoint &tp(mTouchPoints.at(i)); if (tp.id == mMouseSourceId) { - const bool released = tp.state == Qt::TouchPointReleased; + const bool released = tp.state == QEventPoint::Released; Qt::MouseButtons buttons = released ? Qt::NoButton : Qt::LeftButton; QEvent::Type eventType = firstPress ? QEvent::MouseButtonPress : released ? QEvent::MouseButtonRelease diff --git a/tests/auto/wayland/seatv5/tst_seatv5.cpp b/tests/auto/wayland/seatv5/tst_seatv5.cpp index a4d4fe4dd48..701c5ede9d9 100644 --- a/tests/auto/wayland/seatv5/tst_seatv5.cpp +++ b/tests/auto/wayland/seatv5/tst_seatv5.cpp @@ -398,7 +398,7 @@ public: { } QEvent::Type type{}; - Qt::TouchPointStates touchPointStates{}; + QEventPoint::States touchPointStates{}; QList touchPoints; }; QList m_events; diff --git a/tests/auto/wayland/tabletv2/tst_tabletv2.cpp b/tests/auto/wayland/tabletv2/tst_tabletv2.cpp index f52db64f497..3e68e5d1e00 100644 --- a/tests/auto/wayland/tabletv2/tst_tabletv2.cpp +++ b/tests/auto/wayland/tabletv2/tst_tabletv2.cpp @@ -465,11 +465,11 @@ protected: case QEvent::TabletEnterProximity: case QEvent::TabletLeaveProximity: { auto *e = static_cast(event); - auto *ev = new QTabletEvent(e->type(), e->position(), e->globalPosition(), int(e->deviceType()), - int(e->pointerType()), e->pressure(), e->xTilt(), e->yTilt(), - e->tangentialPressure(), e->rotation(), e->z(), - Qt::KeyboardModifier::NoModifier, e->uniqueId(), - e->button(), e->buttons()); + auto *ev = new QTabletEvent(e->type(), e->pointingDevice(), e->position(), e->globalPosition(), + e->pressure(), e->xTilt(), e->yTilt(), + e->tangentialPressure(), e->rotation(), e->z(), + Qt::KeyboardModifier::NoModifier, + e->button(), e->buttons()); m_events << ev; break; } @@ -600,11 +600,11 @@ public: void tabletEvent(QTabletEvent *e) override { - m_events << new QTabletEvent(e->type(), e->position(), e->globalPosition(), int(e->deviceType()), - int(e->pointerType()), e->pressure(), e->xTilt(), e->yTilt(), + m_events << new QTabletEvent(e->type(), e->pointingDevice(), e->position(), e->globalPosition(), + e->pressure(), e->xTilt(), e->yTilt(), e->tangentialPressure(), e->rotation(), e->z(), - Qt::KeyboardModifier::NoModifier, e->uniqueId(), e->button(), - e->buttons()); + Qt::KeyboardModifier::NoModifier, + e->button(), e->buttons()); emit tabletEventReceived(m_events.last()); } int nextEventIndex = 0; From ea199834ce9ea055026aca1fd002b613fd3004eb Mon Sep 17 00:00:00 2001 From: Samuel Gaist Date: Fri, 24 Jul 2020 11:00:01 +0200 Subject: [PATCH 0875/1507] Fix qt_attribution.json files by replacing newlines with \n escapes In their current state theses files contains invalid json. While they are parsed successfully by qtattributionsscanner, they cannot be loaded by libraries such as Python's json module. This patch fixes this. The output generated by qtattributionsscanner stays the same. Pick-to: 5.15 Change-Id: I661d9b6f8a956a33b301fe58add5910d6de293f1 Reviewed-by: David Edmundson --- .../wayland/protocols/qt_attribution.json | 25 +++++-------------- 1 file changed, 6 insertions(+), 19 deletions(-) diff --git a/src/3rdparty/wayland/protocols/qt_attribution.json b/src/3rdparty/wayland/protocols/qt_attribution.json index d714d1dc410..c5d2058d083 100644 --- a/src/3rdparty/wayland/protocols/qt_attribution.json +++ b/src/3rdparty/wayland/protocols/qt_attribution.json @@ -13,9 +13,7 @@ "LicenseId": "MIT", "License": "MIT License", "LicenseFile": "MIT_LICENSE.txt", - "Copyright": "Copyright © 2016 Yong Bakos -Copyright © 2015 Jason Ekstrand -Copyright © 2015 Jonas Ådahl" + "Copyright": "Copyright © 2016 Yong Bakos\nCopyright © 2015 Jason Ekstrand\nCopyright © 2015 Jonas Ådahl" }, { @@ -32,9 +30,7 @@ Copyright © 2015 Jonas Ådahl" "LicenseId": "MIT", "License": "MIT License", "LicenseFile": "MIT_LICENSE.txt", - "Copyright": "Copyright © 2008-2011 Kristian Høgsberg -Copyright © 2010-2011 Intel Corporation -Copyright © 2012-2013 Collabora, Ltd." + "Copyright": "Copyright © 2008-2011 Kristian Høgsberg\nCopyright © 2010-2011 Intel Corporation\nCopyright © 2012-2013 Collabora, Ltd." }, { @@ -51,8 +47,7 @@ Copyright © 2012-2013 Collabora, Ltd." "LicenseId": "MIT", "License": "MIT License", "LicenseFile": "MIT_LICENSE.txt", - "Copyright": "Copyright (C) 2013 DENSO CORPORATION -Copyright (c) 2013 BMW Car IT GmbH" + "Copyright": "Copyright (C) 2013 DENSO CORPORATION\nCopyright (c) 2013 BMW Car IT GmbH" }, { @@ -103,8 +98,7 @@ Copyright (c) 2013 BMW Car IT GmbH" "LicenseId": "MIT", "License": "MIT License", "LicenseFile": "MIT_LICENSE.txt", - "Copyright": "Copyright 2014 © Stephen \"Lyude\" Chandler Paul -Copyright 2015-2016 © Red Hat, Inc." + "Copyright": "Copyright 2014 © Stephen \"Lyude\" Chandler Paul\nCopyright 2015-2016 © Red Hat, Inc." }, { @@ -172,13 +166,7 @@ Copyright 2015-2016 © Red Hat, Inc." "LicenseId": "MIT", "License": "MIT License", "LicenseFile": "MIT_LICENSE.txt", - "Copyright": "Copyright © 2008-2013 Kristian Høgsberg -Copyright © 2013 Rafael Antognolli -Copyright © 2013 Jasper St. Pierre -Copyright © 2010-2013 Intel Corporation -Copyright © 2015-2017 Samsung Electronics Co., Ltd -Copyright © 2015-2017 Red Hat Inc. -" + "Copyright": "Copyright © 2008-2013 Kristian Høgsberg\nCopyright © 2013 Rafael Antognolli\nCopyright © 2013 Jasper St. Pierre\nCopyright © 2010-2013 Intel Corporation\nCopyright © 2015-2017 Samsung Electronics Co., Ltd\nCopyright © 2015-2017 Red Hat Inc.\n" }, { @@ -194,8 +182,7 @@ Copyright © 2015-2017 Red Hat Inc. "LicenseId": "HPND", "License": "HPND License", "LicenseFile": "HPND_LICENSE.txt", - "Copyright": "Copyright © 2012, 2013 Intel Corporation -Copyright © 2015, 2016 Jan Arne Petersen" + "Copyright": "Copyright © 2012, 2013 Intel Corporation\nCopyright © 2015, 2016 Jan Arne Petersen" }, { From 74d7982b94dc0c5558faeef7edb48d49ba081490 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Wed, 5 Aug 2020 12:27:10 +0200 Subject: [PATCH 0876/1507] Update to match qtbase changes to platform headers Change-Id: I8e39d87361728c81b526f1ad89b45136500c9913 Reviewed-by: Paul Olav Tvete --- src/plugins/platforms/wayland/CMakeLists.txt | 1 - src/plugins/platforms/wayland/client.pro | 2 - .../wayland/qwaylandnativeinterface.cpp | 40 ------------------- .../wayland/qwaylandnativeinterface_p.h | 6 --- 4 files changed, 49 deletions(-) diff --git a/src/plugins/platforms/wayland/CMakeLists.txt b/src/plugins/platforms/wayland/CMakeLists.txt index b49a72920d4..88b27b5f3a9 100644 --- a/src/plugins/platforms/wayland/CMakeLists.txt +++ b/src/plugins/platforms/wayland/CMakeLists.txt @@ -56,7 +56,6 @@ qt_add_module(WaylandClient LIBRARIES Qt::CorePrivate Qt::GuiPrivate - Qt::PlatformHeadersPrivate PUBLIC_LIBRARIES Qt::Core Qt::Gui diff --git a/src/plugins/platforms/wayland/client.pro b/src/plugins/platforms/wayland/client.pro index 38b129e9edb..d6df946b58e 100644 --- a/src/plugins/platforms/wayland/client.pro +++ b/src/plugins/platforms/wayland/client.pro @@ -3,8 +3,6 @@ MODULE = waylandclient QT += core-private gui-private -QT_PRIVATE += platformheaders-private - # We have a bunch of C code with casts, so we can't have this option QMAKE_CXXFLAGS_WARN_ON -= -Wcast-qual diff --git a/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp b/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp index da788547789..2c9ba899fb9 100644 --- a/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp +++ b/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp @@ -55,8 +55,6 @@ #include #endif -#include - QT_BEGIN_NAMESPACE namespace QtWaylandClient { @@ -194,44 +192,6 @@ void QWaylandNativeInterface::emitWindowPropertyChanged(QPlatformWindow *window, emit windowPropertyChanged(window,name); } -QFunctionPointer QWaylandNativeInterface::platformFunction(const QByteArray &resource) const -{ - if (resource == QWaylandWindowFunctions::setSyncIdentifier()) { - return QFunctionPointer(setSync); - } else if (resource == QWaylandWindowFunctions::setDeSyncIdentifier()) { - return QFunctionPointer(setDeSync); - } else if (resource == QWaylandWindowFunctions::isSyncIdentifier()) { - return QFunctionPointer(isSync); - } - return nullptr; -} - - -void QWaylandNativeInterface::setSync(QWindow *window) -{ - QWaylandWindow *ww = static_cast(window->handle()); - if (ww->subSurfaceWindow()) { - ww->subSurfaceWindow()->setSync(); - } -} - -void QWaylandNativeInterface::setDeSync(QWindow *window) -{ - QWaylandWindow *ww = static_cast(window->handle()); - if (ww->subSurfaceWindow()) { - ww->subSurfaceWindow()->setDeSync(); - } -} - -bool QWaylandNativeInterface::isSync(QWindow *window) -{ - QWaylandWindow *ww = static_cast(window->handle()); - if (ww->subSurfaceWindow()) { - return ww->subSurfaceWindow()->isSync(); - } - return false; -} - } QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandnativeinterface_p.h b/src/plugins/platforms/wayland/qwaylandnativeinterface_p.h index 3de80eb6ac4..0edbdc9e697 100644 --- a/src/plugins/platforms/wayland/qwaylandnativeinterface_p.h +++ b/src/plugins/platforms/wayland/qwaylandnativeinterface_p.h @@ -82,15 +82,9 @@ public: void emitWindowPropertyChanged(QPlatformWindow *window, const QString &name); - QFunctionPointer platformFunction(const QByteArray &resource) const override; - private: QWaylandIntegration *m_integration = nullptr; QHash m_windowProperties; - - static void setSync(QWindow *window); - static void setDeSync(QWindow *window); - static bool isSync(QWindow *window); }; } From 8631b43a2d7a41a2061a9fc4b53840fa1f4bea2c Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Wed, 8 Jul 2020 09:20:55 +0200 Subject: [PATCH 0877/1507] Add API for selecting supported wl_shm formats We would always reported all formats we could convert from as supported on the wl_shm protocol. This would sometimes cause clients to pick formats that required internal conversion when creating OpenGL textures from the images. To avoid this, we default to only supporting the RGB32 and ARGB32_Premultiplied formats (which are required and advertised automatically) and if the user wants to add additional formats, we now have a additionalShmFormats property for this. [ChangeLog][QtWaylandCompositor] The compositor will now by default only advertise support for the required wl_shm formats. Additional formats can be added to the list by setting the additionalShmFormats property on the compositor. Fixes: QTBUG-77531 Change-Id: Ibd5d5be2a37968353c00308abbfff7ca6f8d310d Reviewed-by: Paul Olav Tvete --- .../shared/qwaylandsharedmemoryformathelper_p.h | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/src/plugins/platforms/wayland/shared/qwaylandsharedmemoryformathelper_p.h b/src/plugins/platforms/wayland/shared/qwaylandsharedmemoryformathelper_p.h index ac4428dfd5f..6feaff3f9a7 100644 --- a/src/plugins/platforms/wayland/shared/qwaylandsharedmemoryformathelper_p.h +++ b/src/plugins/platforms/wayland/shared/qwaylandsharedmemoryformathelper_p.h @@ -71,7 +71,6 @@ public: default: return QImage::Format_Invalid; } } - static inline QList supportedWaylandFormats(); private: //IMPLEMENTATION (which has to be inline in the header because of the include trick) @@ -127,19 +126,6 @@ wl_shm_format QWaylandSharedMemoryFormatHelper::fromQImageFormat(QImage::Format return array.data[format]; } -QList QWaylandSharedMemoryFormatHelper::supportedWaylandFormats() -{ - QList retFormats; - Array array = getData(); - for (size_t i = 0; i < array.size; i++) { - if (int(array.data[i]) != INT_MIN - && !retFormats.contains(array.data[i])) { - retFormats.append(array.data[i]); - } - } - return retFormats; -} - QT_END_NAMESPACE #endif //QWAYLANDSHAREDMEMORYFORMATHELPER_H From 6d8b4bbadb728e4d03dcfa274193ad7c610b5aff Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Sun, 26 Jul 2020 17:56:25 +0100 Subject: [PATCH 0878/1507] Client: Send subsurface expose event when toplevel is configured If a subsurface is set to be visible on the cilent side before the top level is configured it will do not create an exposeEvent and map a buffer as we fail the check in isExposed() where we check the parent. This is correct behavior. However, when the toplevel receives an applyConfigure from the shell client we need subsurfaces to update accordingly. This fixes a race where subsurfaces are not shown with slow compositors. Change-Id: Icd156e7655d5b25535acc4d2fe77c31e19ebfa32 Pick-to: 5.15 Fixes: QTBUG-86176 Reviewed-by: David Edmundson --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 14 +++++++++++++- src/plugins/platforms/wayland/qwaylandwindow_p.h | 1 + 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index f74cacf8cd7..f2655160820 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -516,10 +516,22 @@ void QWaylandWindow::applyConfigure() doApplyConfigure(); lock.unlock(); - sendExposeEvent(QRect(QPoint(), geometry().size())); + sendRecursiveExposeEvent(); QWindowSystemInterface::flushWindowSystemEvents(); } +void QWaylandWindow::sendRecursiveExposeEvent() +{ + if (!window()->isVisible()) + return; + sendExposeEvent(QRect(QPoint(), geometry().size())); + + for (QWaylandSubSurface *subSurface : qAsConst(mChildren)) { + auto subWindow = subSurface->window(); + subWindow->sendRecursiveExposeEvent(); + } +} + void QWaylandWindow::attach(QWaylandBuffer *buffer, int x, int y) { Q_ASSERT(!buffer->committed()); diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index 93015dece6e..9272d368019 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -271,6 +271,7 @@ private: void handleMouseEventWithDecoration(QWaylandInputDevice *inputDevice, const QWaylandPointerEvent &e); void handleScreensChanged(); + void sendRecursiveExposeEvent(); bool mInResizeFromApplyConfigure = false; bool lastVisible = false; From a8b91863d3ed74dea4f9e2c5c1da33a6afe85f75 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Mon, 24 Aug 2020 15:51:41 +0200 Subject: [PATCH 0879/1507] Compile against latest qtbase Change-Id: I6111cd2e280a7cff610d3f89d51fb3964d61b51f Reviewed-by: Fabian Kosmale --- .../platforms/wayland/qwaylandinputcontext_p.h | 1 + src/tools/qtwaylandscanner/qtwaylandscanner.cpp | 14 +++++++------- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandinputcontext_p.h b/src/plugins/platforms/wayland/qwaylandinputcontext_p.h index d3bf5a78562..df91856c460 100644 --- a/src/plugins/platforms/wayland/qwaylandinputcontext_p.h +++ b/src/plugins/platforms/wayland/qwaylandinputcontext_p.h @@ -58,6 +58,7 @@ #include #include #include +#include #include #include diff --git a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp index 8cc5fd470ee..e984b8684ee 100644 --- a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp +++ b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp @@ -223,7 +223,7 @@ Scanner::WaylandEvent Scanner::readEvent(QXmlStreamReader &xml, bool request) .arguments = {}, }; while (xml.readNextStartElement()) { - if (xml.name() == "arg") { + if (xml.name() == u"arg") { WaylandArgument argument = { .name = byteArrayValue(xml, "name"), .type = byteArrayValue(xml, "type"), @@ -247,7 +247,7 @@ Scanner::WaylandEnum Scanner::readEnum(QXmlStreamReader &xml) }; while (xml.readNextStartElement()) { - if (xml.name() == "entry") { + if (xml.name() == u"entry") { WaylandEnumEntry entry = { .name = byteArrayValue(xml, "name"), .value = byteArrayValue(xml, "value"), @@ -273,11 +273,11 @@ Scanner::WaylandInterface Scanner::readInterface(QXmlStreamReader &xml) }; while (xml.readNextStartElement()) { - if (xml.name() == "event") + if (xml.name() == u"event") interface.events.push_back(readEvent(xml, false)); - else if (xml.name() == "request") + else if (xml.name() == u"request") interface.requests.push_back(readEvent(xml, true)); - else if (xml.name() == "enum") + else if (xml.name() == u"enum") interface.enums.push_back(readEnum(xml)); else xml.skipCurrentElement(); @@ -438,7 +438,7 @@ bool Scanner::process() if (!m_xml->readNextStartElement()) return false; - if (m_xml->name() != "protocol") { + if (m_xml->name() != u"protocol") { m_xml->raiseError(QStringLiteral("The file is not a wayland protocol file.")); return false; } @@ -458,7 +458,7 @@ bool Scanner::process() std::vector interfaces; while (m_xml->readNextStartElement()) { - if (m_xml->name() == "interface") + if (m_xml->name() == u"interface") interfaces.push_back(readInterface(*m_xml)); else m_xml->skipCurrentElement(); From 6578795ab5de18d1a39c3a31c619a4414eca7453 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Fri, 14 Aug 2020 09:51:07 +0200 Subject: [PATCH 0880/1507] New input method protocol for use with Qt clients We introduce an alternative input-method protocol, which is a one-to-one mapping to Qt's input method API. Input methods such as the virtual keyboard's hunspell integration is quite sensitive to the inner workings of the input method handling, both in terms of when state is updated and which updates are delivered when. With a one-to-one mapping we are able to match these expectations and keep a well-synchronized state. Task-number: QTBUG-85135 Task-number: QTBUG-85134 Change-Id: Id69c22a7b0885ea59f39fdcc8d663749af56c7ce Reviewed-by: Paul Olav Tvete --- .../qt-text-input-method-unstable-v1.xml | 301 +++++++++++++ .../platforms/wayland/.prev_CMakeLists.txt | 3 +- src/plugins/platforms/wayland/CMakeLists.txt | 2 + src/plugins/platforms/wayland/client.pro | 3 + .../platforms/wayland/qwaylanddisplay.cpp | 13 + .../platforms/wayland/qwaylanddisplay_p.h | 3 + .../platforms/wayland/qwaylandinputdevice.cpp | 14 + .../platforms/wayland/qwaylandinputdevice_p.h | 5 + .../wayland/qwaylandinputmethodcontext.cpp | 421 ++++++++++++++++++ .../wayland/qwaylandinputmethodcontext_p.h | 152 +++++++ .../platforms/wayland/qwaylandintegration.cpp | 11 +- 11 files changed, 924 insertions(+), 4 deletions(-) create mode 100644 src/3rdparty/wayland/extensions/qt-text-input-method-unstable-v1.xml create mode 100644 src/plugins/platforms/wayland/qwaylandinputmethodcontext.cpp create mode 100644 src/plugins/platforms/wayland/qwaylandinputmethodcontext_p.h diff --git a/src/3rdparty/wayland/extensions/qt-text-input-method-unstable-v1.xml b/src/3rdparty/wayland/extensions/qt-text-input-method-unstable-v1.xml new file mode 100644 index 00000000000..2e8cd4ec3a6 --- /dev/null +++ b/src/3rdparty/wayland/extensions/qt-text-input-method-unstable-v1.xml @@ -0,0 +1,301 @@ + + + + + Copyright © 2020 The Qt Company Ltd. + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that copyright notice and this permission + notice appear in supporting documentation, and that the name of + the copyright holders not be used in advertising or publicity + pertaining to distribution of the software without specific, + written prior permission. The copyright holders make no + representations about the suitability of this software for any + purpose. It is provided "as is" without express or implied + warranty. + + THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS + SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND + FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY + SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN + AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF + THIS SOFTWARE. + + + + + The qt_text_input_method interface represents input method events + associated with a seat, and is intended to exactly match the + internal events of the Qt framework. + + + + + Destroy the qt_text_input_method object. + + + + + + Enable text input in a surface (usually when a text entry inside of it + has focus). + + This can be called before or after a surface gets text (or keyboard) + focus via the enter event. Text input to a surface is only active + when it has the current text (or keyboard) focus and is enabled. + + + + + + + Disable text input in a surface (typically when there is no focus on any + text entry inside the surface). + + + + + + + Notification that this seat's text-input focus is on a certain surface. + + When the seat has the keyboard capability the text-input focus follows + the keyboard focus. + + + + + + + Notification that this seat's text-input focus is no longer on + a certain surface. + + The leave notification is sent before the enter notification + for the new focus. + + When the seat has the keyboard capability the text-input focus follows + the keyboard focus. + + + + + + + A QKeyEvent has been sent from the input method. + + + + + + + + + + + + + + + Starts an input method event. This can be followed by + any number of input_method_event_attribute events + and will always be finished by an end_input_method_event. + + + + + + + + Appends an attribute to the input method event with + the given serial. Must be preceded by a start_input_method_event + and concluded by a an end_input_method_event. See documentation + of QInputMethodEvent for details on the attributes. + + + + + + + + + + + Concludes a previously started input method event. Together with + the preceding input_method_event_attribute events with the same + serial, this should be converted into a QInputMethodEvent. + + + + + + + + + + + Event to notify client that the visibility of the input method has + been changed. + + + + + + + Event to notify client that the keyboard rectangle of the input method + has been changed. + + + + + + + + + + Event to notify client that the locale of the input method + has been changed. + + + + + + + Event to notify client that the input direction of the input method + has been changed. + + + + + + + Request for the input method to reset. Corresponds to QInputMethod::reset(). + + + + + + Request for the input method to commit its current content. Corresponds to QInputMethod::commit(). + + + + + + Passes a mouse click or context menu request from the client to the server. Corresponds to QInputMethod::invokeAction(). + + + + + + + + Notifies the server of the client's current input method hints. + + + + + + + Notifies the server of the client's current cursor rectangle. + + + + + + + + + + Notifies the server of the client's current cursor position. + + + + + + + Notifies the server of the client's current surrounding text and its offset in the + complete text. + + + + + + + + Notifies the server of the client's current anchor position. + + + + + + + Notifies the server of the client's current absolute cursor position. + + + + + + + Notifies the server of the client's current preferred language. + + + + + + + Starts an update sequence to notify the server that the client's state has + changed. This is followed by any number of update requests for specific + parts of the state and concluded by an end_update request. + + + + + + + Concludes the previously started update request. + + + + + + Requests that the input panel of the input method is visible. + + + + + + Requests that the input panel of the input method is not visible. + + + + + + Sent on receipt of an end_input_method_event to acknowledge that + the client has received and handled the event. + + + + + + + Manages qt_text_input_method objects. + + + + + Destroy the qt_text_input_method_manager object. + + + + + + Creates a new text-input-method object for a given seat. + + + + + + diff --git a/src/plugins/platforms/wayland/.prev_CMakeLists.txt b/src/plugins/platforms/wayland/.prev_CMakeLists.txt index ac323a56f3f..454b06ae38f 100644 --- a/src/plugins/platforms/wayland/.prev_CMakeLists.txt +++ b/src/plugins/platforms/wayland/.prev_CMakeLists.txt @@ -30,6 +30,7 @@ qt_add_module(WaylandClient qwaylandextendedsurface.cpp qwaylandextendedsurface_p.h qwaylandinputcontext.cpp qwaylandinputcontext_p.h qwaylandinputdevice.cpp qwaylandinputdevice_p.h + qwaylandinputmethodcontext.cpp qwaylandinputmethodcontext_p.h qwaylandintegration.cpp qwaylandintegration_p.h qwaylandnativeinterface.cpp qwaylandnativeinterface_p.h qwaylandqtkey.cpp qwaylandqtkey_p.h @@ -56,7 +57,6 @@ qt_add_module(WaylandClient LIBRARIES Qt::CorePrivate Qt::GuiPrivate - Qt::PlatformHeadersPrivate PUBLIC_LIBRARIES Qt::Core Qt::Gui @@ -74,6 +74,7 @@ qt6_generate_wayland_protocol_client_sources(WaylandClient ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/wp-primary-selection-unstable-v1.xml ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/xdg-output-unstable-v1.xml ${CMAKE_CURRENT_SOURCE_DIR}/../extensions/qt-key-unstable-v1.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../extensions/qt-text-input-method-unstable-v1.xml ${CMAKE_CURRENT_SOURCE_DIR}/../extensions/qt-windowmanager.xml ${CMAKE_CURRENT_SOURCE_DIR}/../extensions/surface-extension.xml ${CMAKE_CURRENT_SOURCE_DIR}/../extensions/touch-extension.xml diff --git a/src/plugins/platforms/wayland/CMakeLists.txt b/src/plugins/platforms/wayland/CMakeLists.txt index 88b27b5f3a9..01957eacd7f 100644 --- a/src/plugins/platforms/wayland/CMakeLists.txt +++ b/src/plugins/platforms/wayland/CMakeLists.txt @@ -30,6 +30,7 @@ qt_add_module(WaylandClient qwaylandextendedsurface.cpp qwaylandextendedsurface_p.h qwaylandinputcontext.cpp qwaylandinputcontext_p.h qwaylandinputdevice.cpp qwaylandinputdevice_p.h + qwaylandinputmethodcontext.cpp qwaylandinputmethodcontext_p.h qwaylandintegration.cpp qwaylandintegration_p.h qwaylandnativeinterface.cpp qwaylandnativeinterface_p.h qwaylandqtkey.cpp qwaylandqtkey_p.h @@ -73,6 +74,7 @@ qt6_generate_wayland_protocol_client_sources(WaylandClient ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/wp-primary-selection-unstable-v1.xml ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/xdg-output-unstable-v1.xml ${CMAKE_CURRENT_SOURCE_DIR}/../extensions/qt-key-unstable-v1.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../extensions/qt-text-input-method-unstable-v1.xml ${CMAKE_CURRENT_SOURCE_DIR}/../extensions/qt-windowmanager.xml ${CMAKE_CURRENT_SOURCE_DIR}/../extensions/surface-extension.xml ${CMAKE_CURRENT_SOURCE_DIR}/../extensions/touch-extension.xml diff --git a/src/plugins/platforms/wayland/client.pro b/src/plugins/platforms/wayland/client.pro index d6df946b58e..da6a926dc48 100644 --- a/src/plugins/platforms/wayland/client.pro +++ b/src/plugins/platforms/wayland/client.pro @@ -22,6 +22,7 @@ WAYLANDCLIENTSOURCES += \ ../extensions/touch-extension.xml \ ../extensions/qt-key-unstable-v1.xml \ ../extensions/qt-windowmanager.xml \ + ../extensions/qt-text-input-method-unstable-v1.xml \ ../3rdparty/protocol/wp-primary-selection-unstable-v1.xml \ ../3rdparty/protocol/tablet-unstable-v2.xml \ ../3rdparty/protocol/text-input-unstable-v2.xml \ @@ -50,6 +51,7 @@ SOURCES += qwaylandintegration.cpp \ qwaylanddecorationplugin.cpp \ qwaylandwindowmanagerintegration.cpp \ qwaylandinputcontext.cpp \ + qwaylandinputmethodcontext.cpp \ qwaylandshm.cpp \ qwaylandbuffer.cpp \ @@ -74,6 +76,7 @@ HEADERS += qwaylandintegration_p.h \ qwaylanddecorationplugin_p.h \ qwaylandwindowmanagerintegration_p.h \ qwaylandinputcontext_p.h \ + qwaylandinputmethodcontext_p.h \ qwaylandshm_p.h \ qtwaylandclientglobal.h \ qtwaylandclientglobal_p.h \ diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index 9e5359357d8..e39f912809b 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -61,6 +61,7 @@ #endif #include "qwaylandhardwareintegration_p.h" #include "qwaylandinputcontext_p.h" +#include "qwaylandinputmethodcontext_p.h" #include "qwaylandwindowmanagerintegration_p.h" #include "qwaylandshellintegration_p.h" @@ -74,6 +75,7 @@ #include #include +#include #include @@ -339,6 +341,11 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin } else if (interface == QStringLiteral("zwp_primary_selection_device_manager_v1")) { mPrimarySelectionManager.reset(new QWaylandPrimarySelectionDeviceManagerV1(this, id, 1)); #endif + } else if (interface == QStringLiteral("qt_text_input_method_manager_v1") && !mClientSideInputContextRequested) { + mTextInputMethodManager.reset(new QtWayland::qt_text_input_method_manager_v1(registry, id, 1)); + for (QWaylandInputDevice *inputDevice : qAsConst(mInputDevices)) + inputDevice->setTextInputMethod(new QWaylandTextInputMethod(this, mTextInputMethodManager->get_text_input_method(inputDevice->wl_seat()))); + mWaylandIntegration->reconfigureInputContext(); } else if (interface == QStringLiteral("zwp_text_input_manager_v2") && !mClientSideInputContextRequested) { mTextInputManager.reset(new QtWayland::zwp_text_input_manager_v2(registry, id, 1)); for (QWaylandInputDevice *inputDevice : qAsConst(mInputDevices)) @@ -396,6 +403,12 @@ void QWaylandDisplay::registry_global_remove(uint32_t id) inputDevice->setTextInput(nullptr); mWaylandIntegration->reconfigureInputContext(); } + if (global.interface == QStringLiteral("qt_text_input_method_manager_v1")) { + mTextInputMethodManager.reset(); + for (QWaylandInputDevice *inputDevice : qAsConst(mInputDevices)) + inputDevice->setTextInputMethod(nullptr); + mWaylandIntegration->reconfigureInputContext(); + } mGlobals.removeAt(i); break; } diff --git a/src/plugins/platforms/wayland/qwaylanddisplay_p.h b/src/plugins/platforms/wayland/qwaylanddisplay_p.h index d386c66ac68..68d72812f52 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay_p.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay_p.h @@ -81,6 +81,7 @@ class QPlatformPlaceholderScreen; namespace QtWayland { class qt_surface_extension; class zwp_text_input_manager_v2; + class qt_text_input_method_manager_v1; } namespace QtWaylandClient { @@ -163,6 +164,7 @@ public: QtWayland::qt_surface_extension *windowExtension() const { return mWindowExtension.data(); } QWaylandTabletManagerV2 *tabletManager() const { return mTabletManager.data(); } QWaylandTouchExtension *touchExtension() const { return mTouchExtension.data(); } + QtWayland::qt_text_input_method_manager_v1 *textInputMethodManager() const { return mTextInputMethodManager.data(); } QtWayland::zwp_text_input_manager_v2 *textInputManager() const { return mTextInputManager.data(); } QWaylandHardwareIntegration *hardwareIntegration() const { return mHardwareIntegration.data(); } QWaylandXdgOutputManagerV1 *xdgOutputManager() const { return mXdgOutputManager.data(); } @@ -268,6 +270,7 @@ private: #if QT_CONFIG(wayland_client_primary_selection) QScopedPointer mPrimarySelectionManager; #endif + QScopedPointer mTextInputMethodManager; QScopedPointer mTextInputManager; QScopedPointer mHardwareIntegration; QScopedPointer mXdgOutputManager; diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index e86274276f0..343ccc8d7e2 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -57,6 +57,7 @@ #include "qwaylanddisplay_p.h" #include "qwaylandshmbackingstore_p.h" #include "qwaylandinputcontext_p.h" +#include "qwaylandinputmethodcontext_p.h" #include #include @@ -420,6 +421,9 @@ QWaylandInputDevice::QWaylandInputDevice(QWaylandDisplay *display, int version, if (mQDisplay->textInputManager()) mTextInput.reset(new QWaylandTextInput(mQDisplay, mQDisplay->textInputManager()->get_text_input(wl_seat()))); + if (mQDisplay->textInputMethodManager()) + mTextInputMethod.reset(new QWaylandTextInputMethod(mQDisplay, mQDisplay->textInputMethodManager()->get_text_input_method(wl_seat()))); + if (auto *tm = mQDisplay->tabletManager()) mTabletSeat.reset(new QWaylandTabletSeatV2(tm, this)); } @@ -535,11 +539,21 @@ void QWaylandInputDevice::setTextInput(QWaylandTextInput *textInput) mTextInput.reset(textInput); } +void QWaylandInputDevice::setTextInputMethod(QWaylandTextInputMethod *textInputMethod) +{ + mTextInputMethod.reset(textInputMethod); +} + QWaylandTextInput *QWaylandInputDevice::textInput() const { return mTextInput.data(); } +QWaylandTextInputMethod *QWaylandInputDevice::textInputMethod() const +{ + return mTextInputMethod.data(); +} + void QWaylandInputDevice::removeMouseButtonFromState(Qt::MouseButton button) { if (mPointer) diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h index 31bd3008849..53691e68254 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h +++ b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h @@ -91,6 +91,7 @@ class QWaylandPrimarySelectionDeviceV1; #endif class QWaylandTabletSeatV2; class QWaylandTextInput; +class QWaylandTextInputMethod; #if QT_CONFIG(cursor) class QWaylandCursorTheme; class CursorSurface; @@ -134,6 +135,9 @@ public: void setTextInput(QWaylandTextInput *textInput); QWaylandTextInput *textInput() const; + void setTextInputMethod(QWaylandTextInputMethod *textInputMethod); + QWaylandTextInputMethod *textInputMethod() const; + void removeMouseButtonFromState(Qt::MouseButton button); QWaylandWindow *pointerFocus() const; @@ -187,6 +191,7 @@ private: Touch *mTouch = nullptr; QScopedPointer mTextInput; + QScopedPointer mTextInputMethod; QScopedPointer mTabletSeat; uint32_t mTime = 0; diff --git a/src/plugins/platforms/wayland/qwaylandinputmethodcontext.cpp b/src/plugins/platforms/wayland/qwaylandinputmethodcontext.cpp new file mode 100644 index 00000000000..e6ab1da4ff1 --- /dev/null +++ b/src/plugins/platforms/wayland/qwaylandinputmethodcontext.cpp @@ -0,0 +1,421 @@ +/**************************************************************************** +** +** Copyright (C) 2020 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qwaylandinputmethodcontext_p.h" +#include "qwaylanddisplay_p.h" +#include "qwaylandinputdevice_p.h" + +#include +#include + +QT_BEGIN_NAMESPACE + +Q_DECLARE_LOGGING_CATEGORY(qLcQpaInputMethods) + +namespace QtWaylandClient { + +static constexpr int maxStringSize = 1000; // actual max is 4096/3 + +QWaylandTextInputMethod::QWaylandTextInputMethod(QWaylandDisplay *display, struct ::qt_text_input_method_v1 *textInputMethod) + : QtWayland::qt_text_input_method_v1(textInputMethod) + , m_display(display) +{ +} + +QWaylandTextInputMethod::~QWaylandTextInputMethod() +{ +} + +void QWaylandTextInputMethod::text_input_method_v1_visible_changed(int32_t visible) +{ + m_isVisible = visible; +} + +void QWaylandTextInputMethod::text_input_method_v1_locale_changed(const QString &localeName) +{ + m_locale = QLocale(localeName); +} + +void QWaylandTextInputMethod::text_input_method_v1_input_direction_changed(int32_t inputDirection) +{ + m_layoutDirection = Qt::LayoutDirection(inputDirection); +} + +void QWaylandTextInputMethod::text_input_method_v1_keyboard_rectangle_changed(wl_fixed_t x, wl_fixed_t y, wl_fixed_t width, wl_fixed_t height) +{ + m_keyboardRect = QRectF(wl_fixed_to_double(x), + wl_fixed_to_double(y), + wl_fixed_to_double(width), + wl_fixed_to_double(height)); +} + +void QWaylandTextInputMethod::text_input_method_v1_start_input_method_event(uint32_t serial, int32_t surrounding_text_offset) +{ + if (m_pendingInputMethodEvents.contains(serial)) { + qCWarning(qLcQpaInputMethods) << "Input method event with serial" << serial << "already started"; + return; + } + + m_pendingInputMethodEvents[serial] = QList{}; + m_offsetFromCompositor[serial] = surrounding_text_offset; +} + +// We need to keep surrounding text below maxStringSize characters, with cursorPos centered in that substring + +static int calculateOffset(const QString &text, int cursorPos) +{ + int size = text.size(); + int halfSize = maxStringSize/2; + if (size <= maxStringSize || cursorPos < halfSize) + return 0; + if (cursorPos > size - halfSize) + return size - maxStringSize; + return cursorPos - halfSize; +} + +static QString mapSurroundingTextToCompositor(const QString &s, int offset) +{ + return s.mid(offset, maxStringSize); +} + +static int mapPositionToCompositor(int pos, int offset) +{ + return pos - offset; +} + +static int mapPositionFromCompositor(int pos, int offset) +{ + return pos + offset; +} + +void QWaylandTextInputMethod::text_input_method_v1_input_method_event_attribute(uint32_t serial, int32_t type, int32_t start, int32_t length, const QString &value) +{ + if (!m_pendingInputMethodEvents.contains(serial)) { + qCWarning(qLcQpaInputMethods) << "Input method event with serial" << serial << "does not exist"; + return; + } + + int startMapped = mapPositionFromCompositor(start, m_offsetFromCompositor[serial]); + QList &attributes = m_pendingInputMethodEvents[serial]; + switch (type) { + case QInputMethodEvent::Selection: + attributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::AttributeType(type), startMapped, length)); + break; + case QInputMethodEvent::Cursor: + attributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::AttributeType(type), start, length, QColor(value))); + break; + case QInputMethodEvent::TextFormat: + { + QTextCharFormat textFormat; + textFormat.setProperty(QTextFormat::FontUnderline, true); + textFormat.setProperty(QTextFormat::TextUnderlineStyle, QTextCharFormat::SingleUnderline); + attributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::AttributeType(type), start, length, textFormat)); + break; + } + case QInputMethodEvent::Language: + case QInputMethodEvent::Ruby: + attributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::AttributeType(type), start, length, value)); + break; + }; +} + +void QWaylandTextInputMethod::sendInputState(QInputMethodQueryEvent *event, Qt::InputMethodQueries queries) +{ + int cursorPosition = event->value(Qt::ImCursorPosition).toInt(); + int anchorPosition = event->value(Qt::ImAnchorPosition).toInt(); + QString surroundingText = event->value(Qt::ImSurroundingText).toString(); + int offset = calculateOffset(surroundingText, cursorPosition); + + if (queries & Qt::ImCursorPosition) + update_cursor_position(mapPositionToCompositor(cursorPosition, offset)); + if (queries & Qt::ImSurroundingText) + update_surrounding_text(mapSurroundingTextToCompositor(surroundingText, offset), offset); + if (queries & Qt::ImAnchorPosition) + update_anchor_position(mapPositionToCompositor(anchorPosition, offset)); + if (queries & Qt::ImAbsolutePosition) + update_absolute_position(event->value(Qt::ImAbsolutePosition).toInt()); // do not map: this is the position in the whole document +} + + +void QWaylandTextInputMethod::text_input_method_v1_end_input_method_event(uint32_t serial, const QString &commitString, const QString &preeditString, int32_t replacementStart, int32_t replacementLength) +{ + if (!m_pendingInputMethodEvents.contains(serial)) { + qCWarning(qLcQpaInputMethods) << "Input method event with serial" << serial << "does not exist"; + return; + } + + QList attributes = m_pendingInputMethodEvents.take(serial); + m_offsetFromCompositor.remove(serial); + if (QGuiApplication::focusObject() != nullptr) { + QInputMethodEvent event(preeditString, attributes); + event.setCommitString(commitString, replacementStart, replacementLength); + QCoreApplication::sendEvent(QGuiApplication::focusObject(), &event); + } + + // Send current state to make sure it matches + if (QGuiApplication::focusObject() != nullptr) { + QInputMethodQueryEvent event(Qt::ImCursorPosition | Qt::ImSurroundingText | Qt::ImAnchorPosition | Qt::ImAbsolutePosition); + QCoreApplication::sendEvent(QGuiApplication::focusObject(), &event); + sendInputState(&event); + } + + acknowledge_input_method(); +} + +void QWaylandTextInputMethod::text_input_method_v1_key(int32_t type, + int32_t key, + int32_t modifiers, + int32_t autoRepeat, + int32_t count, + int32_t nativeScanCode, + int32_t nativeVirtualKey, + int32_t nativeModifiers, + const QString &text) +{ + if (QGuiApplication::focusObject() != nullptr) { + QKeyEvent event(QKeyEvent::Type(type), + key, + Qt::KeyboardModifiers(modifiers), + nativeScanCode, + nativeVirtualKey, + nativeModifiers, + text, + autoRepeat, + count); + QCoreApplication::sendEvent(QGuiApplication::focusObject(), &event); + } +} + +void QWaylandTextInputMethod::text_input_method_v1_enter(struct ::wl_surface *surface) +{ + m_surface = surface; +} + +void QWaylandTextInputMethod::text_input_method_v1_leave(struct ::wl_surface *surface) +{ + if (surface != m_surface) { + qCWarning(qLcQpaInputMethods) << "Got leave event for surface without corresponding enter"; + } else { + m_surface = nullptr; + } +} + +QWaylandInputMethodContext::QWaylandInputMethodContext(QWaylandDisplay *display) + : m_display(display) +{ +} + +QWaylandInputMethodContext::~QWaylandInputMethodContext() +{ +} + +bool QWaylandInputMethodContext::isValid() const +{ + return m_display->textInputMethodManager() != nullptr; +} + +void QWaylandInputMethodContext::reset() +{ + QWaylandTextInputMethod *inputMethod = textInputMethod(); + if (inputMethod != nullptr) + inputMethod->reset(); +} + +void QWaylandInputMethodContext::commit() +{ + QWaylandTextInputMethod *inputMethod = textInputMethod(); + if (inputMethod != nullptr) + inputMethod->commit(); + + m_display->forceRoundTrip(); +} + +void QWaylandInputMethodContext::update(Qt::InputMethodQueries queries) +{ + wl_surface *currentSurface = m_currentWindow != nullptr && m_currentWindow->handle() != nullptr + ? static_cast(m_currentWindow->handle())->wlSurface() + : nullptr; + if (currentSurface != nullptr && !inputMethodAccepted()) { + textInputMethod()->disable(currentSurface); + m_currentWindow.clear(); + } else if (currentSurface == nullptr && inputMethodAccepted()) { + QWindow *window = QGuiApplication::focusWindow(); + currentSurface = window != nullptr && window->handle() != nullptr + ? static_cast(window->handle())->wlSurface() + : nullptr; + if (currentSurface != nullptr) { + textInputMethod()->disable(currentSurface); + m_currentWindow = window; + } + } + + queries &= (Qt::ImEnabled + | Qt::ImHints + | Qt::ImCursorRectangle + | Qt::ImCursorPosition + | Qt::ImSurroundingText + | Qt::ImCurrentSelection + | Qt::ImAnchorPosition + | Qt::ImTextAfterCursor + | Qt::ImTextBeforeCursor + | Qt::ImPreferredLanguage); + + const Qt::InputMethodQueries queriesNeedingOffset = Qt::ImCursorPosition | Qt::ImSurroundingText | Qt::ImAnchorPosition; + if (queries & queriesNeedingOffset) + queries |= queriesNeedingOffset; + + QWaylandTextInputMethod *inputMethod = textInputMethod(); + if (inputMethod != nullptr && QGuiApplication::focusObject() != nullptr) { + QInputMethodQueryEvent event(queries); + QCoreApplication::sendEvent(QGuiApplication::focusObject(), &event); + + inputMethod->start_update(int(queries)); + + if (queries & Qt::ImHints) + inputMethod->update_hints(event.value(Qt::ImHints).toInt()); + + if (queries & Qt::ImCursorRectangle) { + QRect rect = event.value(Qt::ImCursorRectangle).toRect(); + inputMethod->update_cursor_rectangle(rect.x(), rect.y(), rect.width(), rect.height()); + } + + inputMethod->sendInputState(&event, queries); + + if (queries & Qt::ImPreferredLanguage) + inputMethod->update_preferred_language(event.value(Qt::ImPreferredLanguage).toString()); + + inputMethod->end_update(); + + // ### Should we do a display sync here and ignore all events until it is received? + } +} + +void QWaylandInputMethodContext::invokeAction(QInputMethod::Action action, int cursorPosition) +{ + QWaylandTextInputMethod *inputMethod = textInputMethod(); + if (inputMethod != nullptr) + inputMethod->invoke_action(int(action), cursorPosition); +} + +void QWaylandInputMethodContext::showInputPanel() +{ + QWaylandTextInputMethod *inputMethod = textInputMethod(); + if (inputMethod != nullptr) + inputMethod->show_input_panel(); +} + +void QWaylandInputMethodContext::hideInputPanel() +{ + QWaylandTextInputMethod *inputMethod = textInputMethod(); + if (inputMethod != nullptr) + inputMethod->hide_input_panel(); +} + +bool QWaylandInputMethodContext::isInputPanelVisible() const +{ + QWaylandTextInputMethod *inputMethod = textInputMethod(); + if (inputMethod != nullptr) + return inputMethod->isVisible(); + else + return false; +} + +QRectF QWaylandInputMethodContext::keyboardRect() const +{ + QWaylandTextInputMethod *inputMethod = textInputMethod(); + if (inputMethod != nullptr) + return inputMethod->keyboardRect(); + else + return QRectF(); +} + +QLocale QWaylandInputMethodContext::locale() const +{ + QWaylandTextInputMethod *inputMethod = textInputMethod(); + if (inputMethod != nullptr) + return inputMethod->locale(); + else + return QLocale(); +} + +Qt::LayoutDirection QWaylandInputMethodContext::inputDirection() const +{ + QWaylandTextInputMethod *inputMethod = textInputMethod(); + if (inputMethod != nullptr) + return inputMethod->inputDirection(); + else + return Qt::LeftToRight; +} + +void QWaylandInputMethodContext::setFocusObject(QObject *) +{ + QWaylandTextInputMethod *inputMethod = textInputMethod(); + if (inputMethod == nullptr) + return; + + QWindow *window = QGuiApplication::focusWindow(); + + if (m_currentWindow != nullptr && m_currentWindow->handle() != nullptr) { + if (m_currentWindow.data() != window || !inputMethodAccepted()) { + auto *surface = static_cast(m_currentWindow->handle())->wlSurface(); + if (surface) + inputMethod->disable(surface); + m_currentWindow.clear(); + } + } + + if (window != nullptr && window->handle() != nullptr && inputMethodAccepted()) { + if (m_currentWindow.data() != window) { + auto *surface = static_cast(window->handle())->wlSurface(); + if (surface != nullptr) { + inputMethod->enable(surface); + m_currentWindow = window; + } + } + } +} + +QWaylandTextInputMethod *QWaylandInputMethodContext::textInputMethod() const +{ + return m_display->defaultInputDevice()->textInputMethod(); +} + +} // QtWaylandClient + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandinputmethodcontext_p.h b/src/plugins/platforms/wayland/qwaylandinputmethodcontext_p.h new file mode 100644 index 00000000000..8be65f447b3 --- /dev/null +++ b/src/plugins/platforms/wayland/qwaylandinputmethodcontext_p.h @@ -0,0 +1,152 @@ +/**************************************************************************** +** +** Copyright (C) 2020 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWAYLANDINPUTMETHODCONTEXT_P_H +#define QWAYLANDINPUTMETHODCONTEXT_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include +#include +#include +#include + +#include + +QT_BEGIN_NAMESPACE + +namespace QtWaylandClient { + class QWaylandDisplay; + +class QWaylandTextInputMethod : public QtWayland::qt_text_input_method_v1 +{ +public: + QWaylandTextInputMethod(QWaylandDisplay *display, struct ::qt_text_input_method_v1 *textInputMethod); + ~QWaylandTextInputMethod() override; + + void text_input_method_v1_visible_changed(int32_t visible) override; + void text_input_method_v1_enter(struct ::wl_surface *surface) override; + void text_input_method_v1_leave(struct ::wl_surface *surface) override; + void text_input_method_v1_locale_changed(const QString &localeName) override; + void text_input_method_v1_input_direction_changed(int32_t inputDirection) override; + void text_input_method_v1_keyboard_rectangle_changed(wl_fixed_t x, wl_fixed_t y, wl_fixed_t width, wl_fixed_t height) override; + void text_input_method_v1_key(int32_t type, int32_t key, int32_t modifiers, int32_t autoRepeat, int32_t count, int32_t nativeScanCode, int32_t nativeVirtualKey, int32_t nativeModifiers, const QString &text) override; + void text_input_method_v1_start_input_method_event(uint32_t serial, int32_t surrounding_text_offset) override; + void text_input_method_v1_end_input_method_event(uint32_t serial, const QString &commitString, const QString &preeditString, int32_t replacementStart, int32_t replacementLength) override; + void text_input_method_v1_input_method_event_attribute(uint32_t serial, int32_t type, int32_t start, int32_t length, const QString &value) override; + + inline bool isVisible() const + { + return m_isVisible; + } + + inline QRectF keyboardRect() const + { + return m_keyboardRect; + } + + inline QLocale locale() const + { + return m_locale; + } + + inline Qt::LayoutDirection inputDirection() const + { + return m_layoutDirection; + } + + void sendInputState(QInputMethodQueryEvent *state, Qt::InputMethodQueries queries = Qt::ImQueryInput); + +private: + QWaylandDisplay *m_display; + + QHash > m_pendingInputMethodEvents; + QHash m_offsetFromCompositor; + + struct ::wl_surface *m_surface; + + // Cached state + bool m_isVisible = false; + QRectF m_keyboardRect; + QLocale m_locale; + Qt::LayoutDirection m_layoutDirection; +}; + +class QWaylandInputMethodContext : public QPlatformInputContext +{ +public: + QWaylandInputMethodContext(QWaylandDisplay *display); + ~QWaylandInputMethodContext() override; + + bool isValid() const override; + void reset() override; + void commit() override; + void update(Qt::InputMethodQueries) override; + void invokeAction(QInputMethod::Action, int cursorPosition) override; + void showInputPanel() override; + void hideInputPanel() override; + + bool isInputPanelVisible() const override; + QRectF keyboardRect() const override; + QLocale locale() const override; + Qt::LayoutDirection inputDirection() const override; + + void setFocusObject(QObject *object) override; + +private: + QWaylandTextInputMethod *textInputMethod() const; + + QWaylandDisplay *m_display; + QPointer m_currentWindow; +}; + +} // QtWaylandClient + +QT_END_NAMESPACE + +#endif // QWAYLANDINPUTMETHODCONTEXT_P_H diff --git a/src/plugins/platforms/wayland/qwaylandintegration.cpp b/src/plugins/platforms/wayland/qwaylandintegration.cpp index 0aa18f09825..764acc2d919 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandintegration.cpp @@ -43,6 +43,7 @@ #include "qwaylandshmwindow_p.h" #include "qwaylandinputdevice_p.h" #include "qwaylandinputcontext_p.h" +#include "qwaylandinputmethodcontext_p.h" #include "qwaylandshmbackingstore_p.h" #include "qwaylandnativeinterface_p.h" #if QT_CONFIG(clipboard) @@ -465,10 +466,14 @@ void QWaylandIntegration::reconfigureInputContext() qCWarning(lcQpaWayland) << "qtvirtualkeyboard currently is not supported at client-side," " use QT_IM_MODULE=qtvirtualkeyboard at compositor-side."; - if (requested.isNull()) - mInputContext.reset(new QWaylandInputContext(mDisplay.data())); - else + if (requested.isNull()) { + if (mDisplay->textInputMethodManager() != nullptr) + mInputContext.reset(new QWaylandInputMethodContext(mDisplay.data())); + else + mInputContext.reset(new QWaylandInputContext(mDisplay.data())); + } else { mInputContext.reset(QPlatformInputContextFactory::create(requested)); + } const QString defaultInputContext(QStringLiteral("compose")); if ((!mInputContext || !mInputContext->isValid()) && requested != defaultInputContext) From 5f7efad86e59f2646ddc75ca717116bd7e4b6f43 Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Wed, 29 Jul 2020 18:30:43 +0100 Subject: [PATCH 0881/1507] Client: Add warning about private headers to vulkan header files Pick-to 5.15 Change-Id: Ie13fb1ba31efd8e12fd502b3f37363ed341be2d6 Reviewed-by: Kai Uwe Broulik Reviewed-by: Paul Olav Tvete --- .../platforms/wayland/qwaylandvulkaninstance_p.h | 11 +++++++++++ .../platforms/wayland/qwaylandvulkanwindow_p.h | 11 +++++++++++ 2 files changed, 22 insertions(+) diff --git a/src/plugins/platforms/wayland/qwaylandvulkaninstance_p.h b/src/plugins/platforms/wayland/qwaylandvulkaninstance_p.h index 3f565ed2454..08246c4dcc7 100644 --- a/src/plugins/platforms/wayland/qwaylandvulkaninstance_p.h +++ b/src/plugins/platforms/wayland/qwaylandvulkaninstance_p.h @@ -40,6 +40,17 @@ #ifndef QWAYLANDVULKANINSTANCE_P_H #define QWAYLANDVULKANINSTANCE_P_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #if defined(VULKAN_H_) && !defined(VK_USE_PLATFORM_WAYLAND_KHR) #error "vulkan.h included without Wayland WSI" #endif diff --git a/src/plugins/platforms/wayland/qwaylandvulkanwindow_p.h b/src/plugins/platforms/wayland/qwaylandvulkanwindow_p.h index 3fd394e62ea..442b6769043 100644 --- a/src/plugins/platforms/wayland/qwaylandvulkanwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandvulkanwindow_p.h @@ -40,6 +40,17 @@ #ifndef QWAYLANDVULKANWINDOW_P_H #define QWAYLANDVULKANWINDOW_P_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include "qwaylandwindow_p.h" #include "qwaylandvulkaninstance_p.h" From 90de870987b00e46cfeb6977685547dac98f35ca Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Fri, 24 Jul 2020 16:35:09 +0100 Subject: [PATCH 0882/1507] Client: Initialize mScale on creation instead of on show At the time of creating a QPlatformWindow we will have a QScreen assigned. It may not be the right one until we get a screen_entered event, pointing instead to the primary screen. When we get the screen_entered event we get the correct scale and call handleWindowScreenChanged. However if it's the same screen as before QWindowPrivate::setTopLevelScreen will no-op because from it's POV the screen hasn't changed at all. This leaves the window having the scale change without any notification. This is notable with QQuickWidget which creates an FBO very early on before the window is shown. This would then use the devicePixelRatio of 1 as it is currently unset and then not get any change notification. Change-Id: Ia7e4072e0bd900abc558bf8930fef4e1e7d2c553 Pick-to: 5.15 Reviewed-by: Paul Olav Tvete --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index f2655160820..382c258f356 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -86,6 +86,8 @@ QWaylandWindow::QWaylandWindow(QWindow *window, QWaylandDisplay *display) mFrameCallbackTimeout = frameCallbackTimeout; } + mScale = waylandScreen() ? waylandScreen()->scale() : 1; // fallback to 1 if we don't have a real screen + static WId id = 1; mWindowId = id++; initializeWlSurface(); @@ -182,8 +184,6 @@ void QWaylandWindow::initWindow() } } - mScale = waylandScreen() ? waylandScreen()->scale() : 1; // fallback to 1 if we don't have a real screen - // Enable high-dpi rendering. Scale() returns the screen scale factor and will // typically be integer 1 (normal-dpi) or 2 (high-dpi). Call set_buffer_scale() // to inform the compositor that high-resolution buffers will be provided. From e1f73494ca529a0901b72b7caefb55ab20c48487 Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Tue, 7 Apr 2020 17:36:19 +0100 Subject: [PATCH 0883/1507] Client: Fix scroll direction with touchpads Wayland axis events and QWheelEvents are opposite way rounds. This was handled for the case of discrete events, but not continuous events. This leads to touchpads moving the wrong way round compared to other clients. Change-Id: Iee4f5c620940a491949d4039cb3ac70649d83a2b Pick-to: 5.15 Task-number: QTBUG-85767 Reviewed-by: Paul Olav Tvete --- .../platforms/wayland/qwaylandinputdevice.cpp | 6 ++++ tests/auto/wayland/seatv5/tst_seatv5.cpp | 35 ++++++++++++++++--- 2 files changed, 37 insertions(+), 4 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index 343ccc8d7e2..5be49993a46 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -1041,6 +1041,12 @@ QPoint QWaylandInputDevice::Pointer::FrameData::pixelDeltaAndError(QPointF *accu *accumulatedError += delta - pixelDelta; Q_ASSERT(qAbs(accumulatedError->x()) < 1.0); Q_ASSERT(qAbs(accumulatedError->y()) < 1.0); + + // for continuous scroll events things should be + // in the same direction + // i.e converted so downwards surface co-ordinates (positive axis_value) + // goes to downwards in wheel event (negative value) + pixelDelta *= -1; return pixelDelta; } diff --git a/tests/auto/wayland/seatv5/tst_seatv5.cpp b/tests/auto/wayland/seatv5/tst_seatv5.cpp index 701c5ede9d9..0c4dcfe0699 100644 --- a/tests/auto/wayland/seatv5/tst_seatv5.cpp +++ b/tests/auto/wayland/seatv5/tst_seatv5.cpp @@ -63,6 +63,7 @@ private slots: void simpleAxis(); void fingerScroll(); void fingerScrollSlow(); + void continuousScroll(); void wheelDiscreteScroll(); // Touch tests @@ -252,7 +253,7 @@ void tst_seatv5::fingerScroll() QCOMPARE(e.phase, Qt::ScrollUpdate); QVERIFY(qAbs(e.angleDelta.x()) <= qAbs(e.angleDelta.y())); // Vertical scroll // QCOMPARE(e.angleDelta, angleDelta); // TODO: what should this be? - QCOMPARE(e.pixelDelta, QPoint(0, 10)); + QCOMPARE(e.pixelDelta, QPoint(0, -10)); QCOMPARE(e.source, Qt::MouseEventSynthesizedBySystem); // A finger is not a wheel } @@ -269,7 +270,7 @@ void tst_seatv5::fingerScroll() auto e = window.m_events.takeFirst(); QCOMPARE(e.phase, Qt::ScrollUpdate); QVERIFY(qAbs(e.angleDelta.x()) > qAbs(e.angleDelta.y())); // Horizontal scroll - QCOMPARE(e.pixelDelta, QPoint(10, 0)); + QCOMPARE(e.pixelDelta, QPoint(-10, 0)); QCOMPARE(e.source, Qt::MouseEventSynthesizedBySystem); // A finger is not a wheel } @@ -284,7 +285,7 @@ void tst_seatv5::fingerScroll() { auto e = window.m_events.takeFirst(); QCOMPARE(e.phase, Qt::ScrollUpdate); - QCOMPARE(e.pixelDelta, QPoint(10, 10)); + QCOMPARE(e.pixelDelta, QPoint(-10, -10)); QCOMPARE(e.source, Qt::MouseEventSynthesizedBySystem); // A finger is not a wheel } @@ -338,7 +339,7 @@ void tst_seatv5::fingerScrollSlow() accumulated += e.pixelDelta; QTRY_VERIFY(!window.m_events.empty()); } - QCOMPARE(accumulated.y(), 1); + QCOMPARE(accumulated.y(), -1); } void tst_seatv5::wheelDiscreteScroll() { @@ -370,6 +371,32 @@ void tst_seatv5::wheelDiscreteScroll() } } +void tst_seatv5::continuousScroll() +{ + WheelWindow window; + QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial); + + exec([=] { + auto *p = pointer(); + auto *c = client(); + p->sendEnter(xdgToplevel()->surface(), {32, 32}); + p->sendFrame(c); + p->sendAxisSource(c, Pointer::axis_source_continuous); + p->sendAxis(c, Pointer::axis_vertical_scroll, 10); + p->sendAxis(c, Pointer::axis_horizontal_scroll, -5); + p->sendFrame(c); + }); + + QTRY_VERIFY(!window.m_events.empty()); + { + auto e = window.m_events.takeFirst(); + QCOMPARE(e.phase, Qt::NoScrollPhase); + QCOMPARE(e.pixelDelta, QPoint(5, -10)); + QCOMPARE(e.source, Qt::MouseEventSynthesizedBySystem); // touchpads are not wheels + } + // Sending axis_stop is not mandatory when axis source != finger +} + void tst_seatv5::createsTouch() { QCOMPOSITOR_TRY_COMPARE(touch()->resourceMap().size(), 1); From af89d09f9208f81231a5ef2f866b26e54a1634ff Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Wed, 12 Aug 2020 14:42:41 +0100 Subject: [PATCH 0884/1507] Client: Expose XdgShell native resources Many new specifications now rely on passing xdg_surface/xdg_toplevel as arguments to other protocols. wl_shell is currently exposed through native resources but xdg-shell related classes were not. Fixes: QTBUG-81479 Change-Id: I2023f39ad6813ff58e8a86d739f307d791794b16 Reviewed-by: Paul Olav Tvete --- .../xdg-shell/qwaylandxdgshell.cpp | 12 ++++++++++++ .../xdg-shell/qwaylandxdgshell_p.h | 2 ++ .../xdg-shell/qwaylandxdgshellintegration.cpp | 10 ++++++++++ .../xdg-shell/qwaylandxdgshellintegration_p.h | 1 + tests/auto/wayland/xdgshell/tst_xdgshell.cpp | 19 +++++++++++++++++++ 5 files changed, 44 insertions(+) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp index b6d23ac10a6..43360ede3a2 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp @@ -378,6 +378,18 @@ void QWaylandXdgSurface::setSizeHints() } } +void *QWaylandXdgSurface::nativeResource(const QByteArray &resource) +{ + QByteArray lowerCaseResource = resource.toLower(); + if (lowerCaseResource == "xdg_surface") + return object(); + else if (lowerCaseResource == "xdg_toplevel" && m_toplevel) + return m_toplevel->object(); + else if (lowerCaseResource == "xdg_popup" && m_popup) + return m_popup->object(); + return nullptr; +} + void QWaylandXdgSurface::requestWindowStates(Qt::WindowStates states) { if (m_toplevel) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h index 0c98be35cdc..5aeec2eb910 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h @@ -97,6 +97,8 @@ public: void setSizeHints(); + void *nativeResource(const QByteArray &resource); + protected: void requestWindowStates(Qt::WindowStates states) override; void xdg_surface_configure(uint32_t serial) override; diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshellintegration.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshellintegration.cpp index 8769d971667..b259a301016 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshellintegration.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshellintegration.cpp @@ -83,6 +83,16 @@ void QWaylandXdgShellIntegration::handleKeyboardFocusChanged(QWaylandWindow *new } } +void *QWaylandXdgShellIntegration::nativeResourceForWindow(const QByteArray &resource, QWindow *window) +{ + if (auto waylandWindow = static_cast(window->handle())) { + if (auto xdgSurface = qobject_cast(waylandWindow->shellSurface())) { + return xdgSurface->nativeResource(resource); + } + } + return nullptr; +} + } QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshellintegration_p.h b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshellintegration_p.h index b6caa6c95c1..ceca0335db0 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshellintegration_p.h +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshellintegration_p.h @@ -66,6 +66,7 @@ public: bool initialize(QWaylandDisplay *display) override; QWaylandShellSurface *createShellSurface(QWaylandWindow *window) override; void handleKeyboardFocusChanged(QWaylandWindow *newFocus, QWaylandWindow *oldFocus) override; + void *nativeResourceForWindow(const QByteArray &resource, QWindow *window) override; private: QScopedPointer m_xdgShell; diff --git a/tests/auto/wayland/xdgshell/tst_xdgshell.cpp b/tests/auto/wayland/xdgshell/tst_xdgshell.cpp index 3007fb32674..891bc0b28e3 100644 --- a/tests/auto/wayland/xdgshell/tst_xdgshell.cpp +++ b/tests/auto/wayland/xdgshell/tst_xdgshell.cpp @@ -51,6 +51,7 @@ private slots: void minMaxSize(); void windowGeometry(); void foreignSurface(); + void nativeResources(); }; void tst_xdgshell::showMinimized() @@ -563,5 +564,23 @@ void tst_xdgshell::foreignSurface() wl_surface_destroy(foreignSurface); } +void tst_xdgshell::nativeResources() +{ + QRasterWindow window; + window.resize(400, 320); + window.show(); + QCOMPOSITOR_TRY_VERIFY(xdgToplevel()); + + auto *ni = QGuiApplication::platformNativeInterface(); + auto *xdg_surface_proxy = static_cast<::wl_proxy *>(ni->nativeResourceForWindow("xdg_surface", &window)); + QCOMPARE(wl_proxy_get_class(xdg_surface_proxy), "xdg_surface"); + + auto *xdg_toplevel_proxy = static_cast<::wl_proxy *>(ni->nativeResourceForWindow("xdg_toplevel", &window)); + QCOMPARE(wl_proxy_get_class(xdg_toplevel_proxy), "xdg_toplevel"); + + auto *xdg_popup_proxy = static_cast<::wl_proxy *>(ni->nativeResourceForWindow("xdg_popup", &window)); + QCOMPARE(xdg_popup_proxy, nullptr); +} + QCOMPOSITOR_TEST_MAIN(tst_xdgshell) #include "tst_xdgshell.moc" From 42d9e19e4096f46bc10ed253429e231f5d2d05c1 Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Wed, 9 Sep 2020 18:43:40 +0200 Subject: [PATCH 0885/1507] CMake: Add checks that the wayland scanner targets are found There was an issue when cross-compiling Qt tools with Yocto, that the dependency between QtWaylandScannerTools and WaylandScanner was not registered, leading to failures at build time, try to run an executable called "Wayland::Scanner". Explicitly check that the targets exist, and fail at configure time in case they don't exist. Task-number: QTBUG-83968 Change-Id: I19ece78b77619761394d047f15cd3a7a37fb0cbf Reviewed-by: Joerg Bornemann --- src/tools/qtwaylandscanner/Qt6WaylandClientMacros.cmake | 8 ++++++++ .../qtwaylandscanner/Qt6WaylandCompositorMacros.cmake | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/src/tools/qtwaylandscanner/Qt6WaylandClientMacros.cmake b/src/tools/qtwaylandscanner/Qt6WaylandClientMacros.cmake index 7b103fd6d97..eb566f63a38 100644 --- a/src/tools/qtwaylandscanner/Qt6WaylandClientMacros.cmake +++ b/src/tools/qtwaylandscanner/Qt6WaylandClientMacros.cmake @@ -2,6 +2,14 @@ function(qt6_generate_wayland_protocol_client_sources target) qt_parse_all_arguments(arg "qt6_generate_wayland_protocol_client_sources" "" "" "FILES" ${ARGN}) get_target_property(target_binary_dir ${target} BINARY_DIR) + if(NOT TARGET Wayland::Scanner) + message(FATAL_ERROR "Wayland::Scanner target not found. You might be missing the WaylandScanner CMake package.") + endif() + + if(NOT TARGET Qt6::qtwaylandscanner) + message(FATAL_ERROR "qtwaylandscanner executable not found. Most likely there is an issue with your Qt installation.") + endif() + foreach(protocol_file IN LISTS arg_FILES) get_filename_component(protocol_name "${protocol_file}" NAME_WLE) diff --git a/src/tools/qtwaylandscanner/Qt6WaylandCompositorMacros.cmake b/src/tools/qtwaylandscanner/Qt6WaylandCompositorMacros.cmake index 51e76b4d7eb..0350efdda32 100644 --- a/src/tools/qtwaylandscanner/Qt6WaylandCompositorMacros.cmake +++ b/src/tools/qtwaylandscanner/Qt6WaylandCompositorMacros.cmake @@ -2,6 +2,14 @@ function(qt6_generate_wayland_protocol_server_sources target) qt_parse_all_arguments(arg "qt6_generate_wayland_protocol_server_sources" "" "" "FILES" ${ARGN}) get_target_property(target_binary_dir ${target} BINARY_DIR) + if(NOT TARGET Wayland::Scanner) + message(FATAL_ERROR "Wayland::Scanner target not found. You might be missing the WaylandScanner CMake package.") + endif() + + if(NOT TARGET Qt6::qtwaylandscanner) + message(FATAL_ERROR "qtwaylandscanner executable not found. Most likely there is an issue with your Qt installation.") + endif() + foreach(protocol_file IN LISTS arg_FILES) get_filename_component(protocol_name "${protocol_file}" NAME_WLE) From 5e927fb8d6b376cb41cf516781a84fb47cebb584 Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Mon, 14 Sep 2020 15:13:35 +0200 Subject: [PATCH 0886/1507] CMake: Explicitly search for X11 with proper dependency tracking Replace the hardcoded find_package(X11) with qt_find_package in both the compositor and client projects. This should ensure proper dependency tracking. Calling qt_find_package(X11) is now necessary, because QtGui doesn't publically link against X11 anymore, which means we have to do it explicitly for qtwayland. The relevant qtbase change is 69004cb2900dcfc530e1e2efb783f559661a8a50 The calls need to be protected by an if(NOT TARGET) to prevent configuration issues in static builds, where the dependency does get propagated. This amends commit dfaf374a3d8d34b9aa90bfc4c5e074f9fd8b9981. Change-Id: Ia39e1e78cd0af386d7b48cd1922887289823c1fa Reviewed-by: Qt CI Bot Reviewed-by: Joerg Bornemann --- src/plugins/platforms/wayland/configure.cmake | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/configure.cmake b/src/plugins/platforms/wayland/configure.cmake index 2310ba8dabe..6e6b0f33d41 100644 --- a/src/plugins/platforms/wayland/configure.cmake +++ b/src/plugins/platforms/wayland/configure.cmake @@ -17,7 +17,14 @@ if((LINUX) OR QT_FIND_ALL_PACKAGES_ALWAYS) qt_find_package(Wayland PROVIDED_TARGETS Wayland::Egl MODULE_NAME waylandclient QMAKE_LIB wayland-egl) endif() qt_find_package(XComposite PROVIDED_TARGETS PkgConfig::XComposite MODULE_NAME waylandclient QMAKE_LIB xcomposite) - +# special case begin +# X11 is not a public dependency of QtGui anymore, so we need to find it manually in a shared build. +# In a static build the dependency is still propagated, so check for the target existence to prevent +# the 'Attempt to promote imported target "X11::X11" to global scope' issue. +if(NOT TARGET X11::X11) + qt_find_package(X11 PROVIDED_TARGETS X11::X11 MODULE_NAME gui QMAKE_LIB xlib) +endif() +# special case end #### Tests From ae42ed7cd3e6e9416a180b9c6fd00e715bc8b4d3 Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Fri, 11 Sep 2020 11:30:46 +0200 Subject: [PATCH 0887/1507] CMake: Make sure test blacklists are found Some of the qtwayland tests are failing on qemu configs and are thus blacklisted. When the tests were built with CMake, the blacklist file was not found. This is due to the custom QCOMPOSITOR_TEST_MAIN function which does not provide the location of the test source folder, and thus the QTestPrivate::parseBlackList -> QTest::qFindTestData call fails to find black list file. Bring the custom test main function in line with what the other QTest main functions do, which is call QTEST_SET_MAIN_SOURCE_PATH. Note in qmake builds this was not necessary, because the way the source and build folders are computed for tests is slightly different from the CMake way. I don't recall the exact details, but basically CMake builds need this extra information that is set by the QTEST_SET_MAIN_SOURCE_PATH call. Task-number: QTBUG-83968 Change-Id: Ia4742488097a65f18594881c89af48c9d621e6e1 Reviewed-by: Joerg Bornemann --- tests/auto/wayland/shared/mockcompositor.h | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/auto/wayland/shared/mockcompositor.h b/tests/auto/wayland/shared/mockcompositor.h index deef1f909e6..485816178f9 100644 --- a/tests/auto/wayland/shared/mockcompositor.h +++ b/tests/auto/wayland/shared/mockcompositor.h @@ -91,6 +91,7 @@ int main(int argc, char **argv) \ setenv("QT_QPA_PLATFORM", "wayland", 1); \ test tc; \ QGuiApplication app(argc, argv); \ + QTEST_SET_MAIN_SOURCE_PATH \ return QTest::qExec(&tc, argc, argv); \ } \ From 8abcf3fa901ad88abd7c4edc24a3c3a88aa86f74 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Tue, 15 Sep 2020 15:39:26 +0200 Subject: [PATCH 0888/1507] CMake: Explicitly search for XKB ...like we do for X11 in 5e927fb8d6b376cb41cf516781a84fb47cebb584. Change-Id: Ib058b6d9fc3a8d6b27327794aba9b2f3dd828bcc Reviewed-by: Alexandru Croitor --- src/plugins/platforms/wayland/configure.cmake | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/plugins/platforms/wayland/configure.cmake b/src/plugins/platforms/wayland/configure.cmake index 6e6b0f33d41..62da9940b0d 100644 --- a/src/plugins/platforms/wayland/configure.cmake +++ b/src/plugins/platforms/wayland/configure.cmake @@ -24,6 +24,10 @@ qt_find_package(XComposite PROVIDED_TARGETS PkgConfig::XComposite MODULE_NAME wa if(NOT TARGET X11::X11) qt_find_package(X11 PROVIDED_TARGETS X11::X11 MODULE_NAME gui QMAKE_LIB xlib) endif() +# Same for XKB. +if(NOT TARGET XKB::XKB) + qt_find_package(XKB 0.5.0 PROVIDED_TARGETS XKB::XKB MODULE_NAME gui QMAKE_LIB xkbcommon) +endif() # special case end #### Tests From 9659ddb38a86dd00dc565e4384aab55f59b1a23d Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Tue, 15 Sep 2020 21:55:23 +0200 Subject: [PATCH 0889/1507] Update dependencies on dev in qt/qtwayland Add one moc include to make things compile after the changes in qtbase. The nooutput test fails with this update because high-dpi is now enabled by default. When running with a placeholder screen, we get a scale factor of NaN because the default logicalDpi() implementation divides by physical size, which is 0x0 in the case of the placeholder. We temporarily disable the test in order to get the update in. Task-number: QTBUG-86698 Change-Id: I474f6970186e93905332c679f2cec5fea459de64 Reviewed-by: Lars Knoll --- tests/auto/wayland/nooutput/tst_nooutput.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/auto/wayland/nooutput/tst_nooutput.cpp b/tests/auto/wayland/nooutput/tst_nooutput.cpp index 098d88d9908..7f491c84009 100644 --- a/tests/auto/wayland/nooutput/tst_nooutput.cpp +++ b/tests/auto/wayland/nooutput/tst_nooutput.cpp @@ -56,6 +56,7 @@ private slots: void tst_nooutput::noScreens() { + QSKIP("QTBUG-86698 - Temporarily skipped for dependency update"); QRasterWindow window; window.resize(16, 16); window.show(); From 769bef69c8583ff7cd44411da5da1012e2b61b87 Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Thu, 10 Sep 2020 18:47:27 +0200 Subject: [PATCH 0890/1507] CMake: Record QtWaylandScannerTools as a tools package dependency The change uses new API introduced in qtbase, to register QtWaylandScannerTools as a tools package dependency, ensuring that the proper host prefix manipulation is done to find the host package. This fixes the QEMU CI standalone test building by using the host qtwaylandscanner. Task-number: QTBUG-83968 Change-Id: I67facb32e1a1e33197090fde324755c0fc880684 Reviewed-by: Qt CI Bot Reviewed-by: Lars Knoll Reviewed-by: Cristian Adam --- src/plugins/platforms/wayland/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/CMakeLists.txt b/src/plugins/platforms/wayland/CMakeLists.txt index 01957eacd7f..62bc7e09e9f 100644 --- a/src/plugins/platforms/wayland/CMakeLists.txt +++ b/src/plugins/platforms/wayland/CMakeLists.txt @@ -126,5 +126,5 @@ qt_extend_target(WaylandClient CONDITION QT_FEATURE_draganddrop ) # special case begin -qt_record_extra_qt_package_dependency(WaylandClient WaylandScannerTools "") +qt_record_extra_qt_main_tools_package_dependency(WaylandClient WaylandScannerTools "${PROJECT_VERSION}") # special case end From f1b5619ca066bec13c69ce33681f0f1f6a0e449a Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Tue, 22 Sep 2020 12:29:17 +0200 Subject: [PATCH 0891/1507] Re-visit the xkbcommon dependency QtGui doesn't expose xkbcommon as public dependency anymore. QtGuiPrivate, however does now, but only in the CMake build. Fix the qmake build by adding an explicit xkbcommon dependency to client.pro, like it's done for the compositor. Commented out the explicit xkbcommon dependencies in the CMakeLists.txt files of client and compositor. Mark the XKB packages as optional, such that qtwayland can actually be built if the feature xkbcommon is OFF and no libxkbcommon-dev package is installed. Change-Id: Ia1c7a8333dc8a93b4924e03f7f2284a709a9d65b Reviewed-by: Alexandru Croitor --- src/plugins/platforms/wayland/.prev_CMakeLists.txt | 5 +++++ src/plugins/platforms/wayland/CMakeLists.txt | 10 ++++++++++ src/plugins/platforms/wayland/client.pro | 2 ++ src/plugins/platforms/wayland/configure.cmake | 2 +- 4 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/.prev_CMakeLists.txt b/src/plugins/platforms/wayland/.prev_CMakeLists.txt index 454b06ae38f..142a8a272aa 100644 --- a/src/plugins/platforms/wayland/.prev_CMakeLists.txt +++ b/src/plugins/platforms/wayland/.prev_CMakeLists.txt @@ -89,6 +89,11 @@ qt6_generate_wayland_protocol_client_sources(WaylandClient ## Scopes: ##################################################################### +qt_extend_target(WaylandClient CONDITION QT_FEATURE_xkbcommon + PUBLIC_LIBRARIES + XKB::XKB +) + qt_extend_target(WaylandClient CONDITION QT_FEATURE_clipboard SOURCES qwaylandclipboard.cpp qwaylandclipboard_p.h diff --git a/src/plugins/platforms/wayland/CMakeLists.txt b/src/plugins/platforms/wayland/CMakeLists.txt index 62bc7e09e9f..b72dbb36a41 100644 --- a/src/plugins/platforms/wayland/CMakeLists.txt +++ b/src/plugins/platforms/wayland/CMakeLists.txt @@ -89,6 +89,16 @@ qt6_generate_wayland_protocol_client_sources(WaylandClient ## Scopes: ##################################################################### +# special case begin +# +# Do not explicitly add XKB::XKB. This is already done by Qt::GuiPrivate. +# +# qt_extend_target(WaylandClient CONDITION QT_FEATURE_xkbcommon +# PUBLIC_LIBRARIES +# XKB::XKB +# ) +# special case end + qt_extend_target(WaylandClient CONDITION QT_FEATURE_clipboard SOURCES qwaylandclipboard.cpp qwaylandclipboard_p.h diff --git a/src/plugins/platforms/wayland/client.pro b/src/plugins/platforms/wayland/client.pro index da6a926dc48..5a071d9ed93 100644 --- a/src/plugins/platforms/wayland/client.pro +++ b/src/plugins/platforms/wayland/client.pro @@ -14,6 +14,8 @@ CONFIG -= precompile_header CONFIG += link_pkgconfig wayland-scanner QMAKE_USE += wayland-client +qtConfig(xkbcommon): \ + QMAKE_USE += xkbcommon INCLUDEPATH += $$PWD/../shared diff --git a/src/plugins/platforms/wayland/configure.cmake b/src/plugins/platforms/wayland/configure.cmake index 62da9940b0d..201f5d46290 100644 --- a/src/plugins/platforms/wayland/configure.cmake +++ b/src/plugins/platforms/wayland/configure.cmake @@ -26,7 +26,7 @@ if(NOT TARGET X11::X11) endif() # Same for XKB. if(NOT TARGET XKB::XKB) - qt_find_package(XKB 0.5.0 PROVIDED_TARGETS XKB::XKB MODULE_NAME gui QMAKE_LIB xkbcommon) + qt_find_package(XKB 0.5.0 PROVIDED_TARGETS XKB::XKB MODULE_NAME gui QMAKE_LIB xkbcommon MARK_OPTIONAL) endif() # special case end From 4fe2d5d2c877541a63f49c8771df9e7cee8332cd Mon Sep 17 00:00:00 2001 From: Peter Seiderer Date: Fri, 3 Apr 2020 21:52:30 +0200 Subject: [PATCH 0892/1507] fix libdrm related configure test failure Fixes: Project ERROR: Test config.qtwayland_client.tests.dmabuf-server-buffer tries to use undeclared library 'drm' Project ERROR: Test config.qtwayland_compositor.tests.dmabuf-server-buffer tries to use undeclared library 'drm' Project ERROR: Test config.qtwayland_compositor.tests.dmabuf-client-buffer tries to use undeclared library 'drm' Task-number: QTBUG-83303 Change-Id: I3970f4e3855fcfa760493631a14adb6a16950aa9 Reviewed-by: Ville Voutilainen Reviewed-by: Heikki Halmet Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/plugins/platforms/wayland/configure.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/configure.json b/src/plugins/platforms/wayland/configure.json index e799f8349ab..e4ac68f46b9 100644 --- a/src/plugins/platforms/wayland/configure.json +++ b/src/plugins/platforms/wayland/configure.json @@ -134,7 +134,8 @@ "#endif" ] }, - "use": "egl drm" + "libs": "-ldrm", + "use": "egl" }, "vulkan-server-buffer": { "label": "Vulkan Buffer Sharing", From f88ad7944f0b8188e8fb841770b4c2522b0be3cd Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Mon, 28 Sep 2020 12:11:27 +0200 Subject: [PATCH 0893/1507] Fix compilation after mime data API changes Follows 848927b688d4709d0b71590518e2c32fe7866147 in qtbase, where the signature of retrieveData_sys() was changed. Fixes: QTBUG-87003 Change-Id: I8b88c8f9547e599328f40345a9fbf57c07ec31a4 Reviewed-by: Lars Knoll --- src/plugins/platforms/wayland/qwaylanddataoffer.cpp | 2 +- src/plugins/platforms/wayland/qwaylanddataoffer_p.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylanddataoffer.cpp b/src/plugins/platforms/wayland/qwaylanddataoffer.cpp index 2297e8a16d6..5d0a8d472f7 100644 --- a/src/plugins/platforms/wayland/qwaylanddataoffer.cpp +++ b/src/plugins/platforms/wayland/qwaylanddataoffer.cpp @@ -124,7 +124,7 @@ QStringList QWaylandMimeData::formats_sys() const return m_types; } -QVariant QWaylandMimeData::retrieveData_sys(const QString &mimeType, QVariant::Type type) const +QVariant QWaylandMimeData::retrieveData_sys(const QString &mimeType, QMetaType type) const { Q_UNUSED(type); diff --git a/src/plugins/platforms/wayland/qwaylanddataoffer_p.h b/src/plugins/platforms/wayland/qwaylanddataoffer_p.h index 9cf1483ca6d..50c05732bd4 100644 --- a/src/plugins/platforms/wayland/qwaylanddataoffer_p.h +++ b/src/plugins/platforms/wayland/qwaylanddataoffer_p.h @@ -106,7 +106,7 @@ public: protected: bool hasFormat_sys(const QString &mimeType) const override; QStringList formats_sys() const override; - QVariant retrieveData_sys(const QString &mimeType, QVariant::Type type) const override; + QVariant retrieveData_sys(const QString &mimeType, QMetaType type) const override; private: int readData(int fd, QByteArray &data) const; From 142bd4c562673cd555700cd8436cc0f8c5230afe Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Tue, 22 Sep 2020 18:20:29 +0200 Subject: [PATCH 0894/1507] CMake: Regenerate projects to use new qt_internal_ API Modify special case locations to use the new API as well. Task-number: QTBUG-86815 Change-Id: I2ba7753b64f3d88332e919dc90c98e252e20dd98 Reviewed-by: Joerg Bornemann --- .../platforms/wayland/.prev_CMakeLists.txt | 16 ++++++++-------- src/plugins/platforms/wayland/CMakeLists.txt | 16 ++++++++-------- .../shellintegration/wl-shell/CMakeLists.txt | 2 +- .../shellintegration/xdg-shell-v5/CMakeLists.txt | 2 +- .../shellintegration/xdg-shell-v6/CMakeLists.txt | 2 +- .../shellintegration/xdg-shell/CMakeLists.txt | 2 +- src/tools/qtwaylandscanner/.prev_CMakeLists.txt | 2 +- src/tools/qtwaylandscanner/CMakeLists.txt | 2 +- tests/auto/wayland/client/.prev_CMakeLists.txt | 2 +- tests/auto/wayland/client/CMakeLists.txt | 2 +- .../wayland/datadevicev1/.prev_CMakeLists.txt | 2 +- tests/auto/wayland/datadevicev1/CMakeLists.txt | 2 +- .../fullscreenshellv1/.prev_CMakeLists.txt | 2 +- .../wayland/fullscreenshellv1/CMakeLists.txt | 2 +- .../wayland/inputcontext/.prev_CMakeLists.txt | 2 +- tests/auto/wayland/inputcontext/CMakeLists.txt | 2 +- .../wayland/iviapplication/.prev_CMakeLists.txt | 2 +- tests/auto/wayland/nooutput/.prev_CMakeLists.txt | 2 +- tests/auto/wayland/nooutput/CMakeLists.txt | 2 +- tests/auto/wayland/output/.prev_CMakeLists.txt | 2 +- tests/auto/wayland/output/CMakeLists.txt | 2 +- .../primaryselectionv1/.prev_CMakeLists.txt | 2 +- .../wayland/primaryselectionv1/CMakeLists.txt | 2 +- tests/auto/wayland/seatv4/.prev_CMakeLists.txt | 4 ++-- tests/auto/wayland/seatv4/CMakeLists.txt | 4 ++-- tests/auto/wayland/seatv5/.prev_CMakeLists.txt | 2 +- tests/auto/wayland/seatv5/CMakeLists.txt | 2 +- tests/auto/wayland/surface/.prev_CMakeLists.txt | 2 +- tests/auto/wayland/surface/CMakeLists.txt | 2 +- tests/auto/wayland/tabletv2/.prev_CMakeLists.txt | 2 +- tests/auto/wayland/tabletv2/CMakeLists.txt | 2 +- tests/auto/wayland/wl_connect/CMakeLists.txt | 2 +- .../wayland/xdgdecorationv1/.prev_CMakeLists.txt | 2 +- .../auto/wayland/xdgdecorationv1/CMakeLists.txt | 2 +- .../auto/wayland/xdgoutput/.prev_CMakeLists.txt | 2 +- tests/auto/wayland/xdgoutput/CMakeLists.txt | 2 +- tests/auto/wayland/xdgshell/.prev_CMakeLists.txt | 2 +- tests/auto/wayland/xdgshell/CMakeLists.txt | 2 +- .../auto/wayland/xdgshellv6/.prev_CMakeLists.txt | 2 +- tests/auto/wayland/xdgshellv6/CMakeLists.txt | 2 +- 40 files changed, 56 insertions(+), 56 deletions(-) diff --git a/src/plugins/platforms/wayland/.prev_CMakeLists.txt b/src/plugins/platforms/wayland/.prev_CMakeLists.txt index 142a8a272aa..ede73a07ca0 100644 --- a/src/plugins/platforms/wayland/.prev_CMakeLists.txt +++ b/src/plugins/platforms/wayland/.prev_CMakeLists.txt @@ -4,7 +4,7 @@ ## WaylandClient Module: ##################################################################### -qt_add_module(WaylandClient +qt_internal_add_module(WaylandClient PLUGIN_TYPES wayland-graphics-integration-client wayland-inputdevice-integration wayland-decoration-client wayland-shell-integration SOURCES ../shared/qwaylandinputmethodeventbuilder.cpp ../shared/qwaylandinputmethodeventbuilder_p.h @@ -89,30 +89,30 @@ qt6_generate_wayland_protocol_client_sources(WaylandClient ## Scopes: ##################################################################### -qt_extend_target(WaylandClient CONDITION QT_FEATURE_xkbcommon +qt_internal_extend_target(WaylandClient CONDITION QT_FEATURE_xkbcommon PUBLIC_LIBRARIES XKB::XKB ) -qt_extend_target(WaylandClient CONDITION QT_FEATURE_clipboard +qt_internal_extend_target(WaylandClient CONDITION QT_FEATURE_clipboard SOURCES qwaylandclipboard.cpp qwaylandclipboard_p.h ) -qt_extend_target(WaylandClient CONDITION QT_FEATURE_vulkan +qt_internal_extend_target(WaylandClient CONDITION QT_FEATURE_vulkan SOURCES qwaylandvulkaninstance.cpp qwaylandvulkaninstance_p.h qwaylandvulkanwindow.cpp qwaylandvulkanwindow_p.h ) -qt_extend_target(WaylandClient CONDITION QT_FEATURE_cursor +qt_internal_extend_target(WaylandClient CONDITION QT_FEATURE_cursor SOURCES qwaylandcursor.cpp qwaylandcursor_p.h PUBLIC_LIBRARIES Wayland::Cursor ) -qt_extend_target(WaylandClient CONDITION QT_FEATURE_wayland_datadevice +qt_internal_extend_target(WaylandClient CONDITION QT_FEATURE_wayland_datadevice SOURCES qwaylanddatadevice.cpp qwaylanddatadevice_p.h qwaylanddatadevicemanager.cpp qwaylanddatadevicemanager_p.h @@ -120,12 +120,12 @@ qt_extend_target(WaylandClient CONDITION QT_FEATURE_wayland_datadevice qwaylanddatasource.cpp qwaylanddatasource_p.h ) -qt_extend_target(WaylandClient CONDITION QT_FEATURE_wayland_client_primary_selection +qt_internal_extend_target(WaylandClient CONDITION QT_FEATURE_wayland_client_primary_selection SOURCES qwaylandprimaryselectionv1.cpp qwaylandprimaryselectionv1_p.h ) -qt_extend_target(WaylandClient CONDITION QT_FEATURE_draganddrop +qt_internal_extend_target(WaylandClient CONDITION QT_FEATURE_draganddrop SOURCES qwaylanddnd.cpp qwaylanddnd_p.h ) diff --git a/src/plugins/platforms/wayland/CMakeLists.txt b/src/plugins/platforms/wayland/CMakeLists.txt index b72dbb36a41..61bf7159876 100644 --- a/src/plugins/platforms/wayland/CMakeLists.txt +++ b/src/plugins/platforms/wayland/CMakeLists.txt @@ -4,7 +4,7 @@ ## WaylandClient Module: ##################################################################### -qt_add_module(WaylandClient +qt_internal_add_module(WaylandClient PLUGIN_TYPES wayland-graphics-integration-client wayland-inputdevice-integration wayland-decoration-client wayland-shell-integration SOURCES ../shared/qwaylandinputmethodeventbuilder.cpp ../shared/qwaylandinputmethodeventbuilder_p.h @@ -93,31 +93,31 @@ qt6_generate_wayland_protocol_client_sources(WaylandClient # # Do not explicitly add XKB::XKB. This is already done by Qt::GuiPrivate. # -# qt_extend_target(WaylandClient CONDITION QT_FEATURE_xkbcommon +# qt_internal_extend_target(WaylandClient CONDITION QT_FEATURE_xkbcommon # PUBLIC_LIBRARIES # XKB::XKB # ) # special case end -qt_extend_target(WaylandClient CONDITION QT_FEATURE_clipboard +qt_internal_extend_target(WaylandClient CONDITION QT_FEATURE_clipboard SOURCES qwaylandclipboard.cpp qwaylandclipboard_p.h ) -qt_extend_target(WaylandClient CONDITION QT_FEATURE_vulkan +qt_internal_extend_target(WaylandClient CONDITION QT_FEATURE_vulkan SOURCES qwaylandvulkaninstance.cpp qwaylandvulkaninstance_p.h qwaylandvulkanwindow.cpp qwaylandvulkanwindow_p.h ) -qt_extend_target(WaylandClient CONDITION QT_FEATURE_cursor +qt_internal_extend_target(WaylandClient CONDITION QT_FEATURE_cursor SOURCES qwaylandcursor.cpp qwaylandcursor_p.h PUBLIC_LIBRARIES Wayland::Cursor ) -qt_extend_target(WaylandClient CONDITION QT_FEATURE_wayland_datadevice +qt_internal_extend_target(WaylandClient CONDITION QT_FEATURE_wayland_datadevice SOURCES qwaylanddatadevice.cpp qwaylanddatadevice_p.h qwaylanddatadevicemanager.cpp qwaylanddatadevicemanager_p.h @@ -125,12 +125,12 @@ qt_extend_target(WaylandClient CONDITION QT_FEATURE_wayland_datadevice qwaylanddatasource.cpp qwaylanddatasource_p.h ) -qt_extend_target(WaylandClient CONDITION QT_FEATURE_wayland_client_primary_selection +qt_internal_extend_target(WaylandClient CONDITION QT_FEATURE_wayland_client_primary_selection SOURCES qwaylandprimaryselectionv1.cpp qwaylandprimaryselectionv1_p.h ) -qt_extend_target(WaylandClient CONDITION QT_FEATURE_draganddrop +qt_internal_extend_target(WaylandClient CONDITION QT_FEATURE_draganddrop SOURCES qwaylanddnd.cpp qwaylanddnd_p.h ) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/CMakeLists.txt index 3e630c7c832..56cc5b85393 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/CMakeLists.txt +++ b/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/CMakeLists.txt @@ -30,7 +30,7 @@ qt6_generate_wayland_protocol_client_sources(QWaylandWlShellIntegrationPlugin ## Scopes: ##################################################################### -qt_extend_target(QWaylandWlShellIntegrationPlugin CONDITION QT_FEATURE_xkbcommon +qt_internal_extend_target(QWaylandWlShellIntegrationPlugin CONDITION QT_FEATURE_xkbcommon LIBRARIES XKB::XKB ) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/CMakeLists.txt index 231bac0877a..25bd0ca7210 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/CMakeLists.txt +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/CMakeLists.txt @@ -32,7 +32,7 @@ qt_internal_add_plugin(QWaylandXdgShellV5IntegrationPlugin ## Scopes: ##################################################################### -qt_extend_target(QWaylandXdgShellV5IntegrationPlugin CONDITION QT_FEATURE_xkbcommon +qt_internal_extend_target(QWaylandXdgShellV5IntegrationPlugin CONDITION QT_FEATURE_xkbcommon PUBLIC_LIBRARIES XKB::XKB ) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/CMakeLists.txt index 190c6698f15..4ea237f6a69 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/CMakeLists.txt +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/CMakeLists.txt @@ -30,7 +30,7 @@ qt6_generate_wayland_protocol_client_sources(QWaylandXdgShellV6IntegrationPlugin ## Scopes: ##################################################################### -qt_extend_target(QWaylandXdgShellV6IntegrationPlugin CONDITION QT_FEATURE_xkbcommon +qt_internal_extend_target(QWaylandXdgShellV6IntegrationPlugin CONDITION QT_FEATURE_xkbcommon LIBRARIES XKB::XKB ) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/CMakeLists.txt index 1b55b8eb7c6..88a78df7f35 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/CMakeLists.txt +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/CMakeLists.txt @@ -32,7 +32,7 @@ qt6_generate_wayland_protocol_client_sources(QWaylandXdgShellIntegrationPlugin ## Scopes: ##################################################################### -qt_extend_target(QWaylandXdgShellIntegrationPlugin CONDITION QT_FEATURE_xkbcommon +qt_internal_extend_target(QWaylandXdgShellIntegrationPlugin CONDITION QT_FEATURE_xkbcommon LIBRARIES XKB::XKB ) diff --git a/src/tools/qtwaylandscanner/.prev_CMakeLists.txt b/src/tools/qtwaylandscanner/.prev_CMakeLists.txt index baa16eaebf7..c4c3c5a8a8a 100644 --- a/src/tools/qtwaylandscanner/.prev_CMakeLists.txt +++ b/src/tools/qtwaylandscanner/.prev_CMakeLists.txt @@ -5,7 +5,7 @@ ##################################################################### qt_get_tool_target_name(target_name qtwaylandscanner) -qt_add_tool(${target_name} +qt_internal_add_tool(${target_name} SOURCES qtwaylandscanner.cpp PUBLIC_LIBRARIES diff --git a/src/tools/qtwaylandscanner/CMakeLists.txt b/src/tools/qtwaylandscanner/CMakeLists.txt index 74acf3419d0..0d16bc85850 100644 --- a/src/tools/qtwaylandscanner/CMakeLists.txt +++ b/src/tools/qtwaylandscanner/CMakeLists.txt @@ -5,7 +5,7 @@ ##################################################################### qt_get_tool_target_name(target_name qtwaylandscanner) -qt_add_tool(${target_name} +qt_internal_add_tool(${target_name} TOOLS_TARGET WaylandScanner # special case SOURCES qtwaylandscanner.cpp diff --git a/tests/auto/wayland/client/.prev_CMakeLists.txt b/tests/auto/wayland/client/.prev_CMakeLists.txt index c52ab320b98..ece394fcc0d 100644 --- a/tests/auto/wayland/client/.prev_CMakeLists.txt +++ b/tests/auto/wayland/client/.prev_CMakeLists.txt @@ -4,7 +4,7 @@ ## tst_client Test: ##################################################################### -qt_add_test(tst_client +qt_internal_add_test(tst_client SOURCES ../shared_old/mockcompositor.cpp ../shared_old/mockcompositor.h ../shared_old/mockfullscreenshellv1.cpp ../shared_old/mockfullscreenshellv1.h diff --git a/tests/auto/wayland/client/CMakeLists.txt b/tests/auto/wayland/client/CMakeLists.txt index f7e317c772e..919bf064d78 100644 --- a/tests/auto/wayland/client/CMakeLists.txt +++ b/tests/auto/wayland/client/CMakeLists.txt @@ -4,7 +4,7 @@ ## tst_client Test: ##################################################################### -qt_add_test(tst_client +qt_internal_add_test(tst_client SOURCES ../shared_old/mockcompositor.cpp ../shared_old/mockcompositor.h ../shared_old/mockfullscreenshellv1.cpp ../shared_old/mockfullscreenshellv1.h diff --git a/tests/auto/wayland/datadevicev1/.prev_CMakeLists.txt b/tests/auto/wayland/datadevicev1/.prev_CMakeLists.txt index e835f09d9f1..6a1060b3816 100644 --- a/tests/auto/wayland/datadevicev1/.prev_CMakeLists.txt +++ b/tests/auto/wayland/datadevicev1/.prev_CMakeLists.txt @@ -4,7 +4,7 @@ ## tst_datadevicev1 Test: ##################################################################### -qt_add_test(tst_datadevicev1 +qt_internal_add_test(tst_datadevicev1 SOURCES ../shared/corecompositor.cpp ../shared/corecompositor.h ../shared/coreprotocol.cpp ../shared/coreprotocol.h diff --git a/tests/auto/wayland/datadevicev1/CMakeLists.txt b/tests/auto/wayland/datadevicev1/CMakeLists.txt index 06a56ccfdad..b2da63977f9 100644 --- a/tests/auto/wayland/datadevicev1/CMakeLists.txt +++ b/tests/auto/wayland/datadevicev1/CMakeLists.txt @@ -4,7 +4,7 @@ ## tst_datadevicev1 Test: ##################################################################### -qt_add_test(tst_datadevicev1 +qt_internal_add_test(tst_datadevicev1 SOURCES ../shared/corecompositor.cpp ../shared/corecompositor.h ../shared/coreprotocol.cpp ../shared/coreprotocol.h diff --git a/tests/auto/wayland/fullscreenshellv1/.prev_CMakeLists.txt b/tests/auto/wayland/fullscreenshellv1/.prev_CMakeLists.txt index c9e5eae13a8..7cf9624c009 100644 --- a/tests/auto/wayland/fullscreenshellv1/.prev_CMakeLists.txt +++ b/tests/auto/wayland/fullscreenshellv1/.prev_CMakeLists.txt @@ -4,7 +4,7 @@ ## tst_client_fullscreenshellv1 Test: ##################################################################### -qt_add_test(tst_client_fullscreenshellv1 +qt_internal_add_test(tst_client_fullscreenshellv1 SOURCES ../shared_old/mockcompositor.cpp ../shared_old/mockcompositor.h ../shared_old/mockfullscreenshellv1.cpp ../shared_old/mockfullscreenshellv1.h diff --git a/tests/auto/wayland/fullscreenshellv1/CMakeLists.txt b/tests/auto/wayland/fullscreenshellv1/CMakeLists.txt index 73d92ead8ee..7a5a72c2415 100644 --- a/tests/auto/wayland/fullscreenshellv1/CMakeLists.txt +++ b/tests/auto/wayland/fullscreenshellv1/CMakeLists.txt @@ -4,7 +4,7 @@ ## tst_client_fullscreenshellv1 Test: ##################################################################### -qt_add_test(tst_client_fullscreenshellv1 +qt_internal_add_test(tst_client_fullscreenshellv1 SOURCES ../shared_old/mockcompositor.cpp ../shared_old/mockcompositor.h ../shared_old/mockfullscreenshellv1.cpp ../shared_old/mockfullscreenshellv1.h diff --git a/tests/auto/wayland/inputcontext/.prev_CMakeLists.txt b/tests/auto/wayland/inputcontext/.prev_CMakeLists.txt index c32f2e93094..2d2783926b2 100644 --- a/tests/auto/wayland/inputcontext/.prev_CMakeLists.txt +++ b/tests/auto/wayland/inputcontext/.prev_CMakeLists.txt @@ -4,7 +4,7 @@ ## tst_inputcontext Test: ##################################################################### -qt_add_test(tst_inputcontext +qt_internal_add_test(tst_inputcontext SOURCES ../shared/corecompositor.cpp ../shared/corecompositor.h ../shared/coreprotocol.cpp ../shared/coreprotocol.h diff --git a/tests/auto/wayland/inputcontext/CMakeLists.txt b/tests/auto/wayland/inputcontext/CMakeLists.txt index 5eb73b11c20..1423c790c72 100644 --- a/tests/auto/wayland/inputcontext/CMakeLists.txt +++ b/tests/auto/wayland/inputcontext/CMakeLists.txt @@ -4,7 +4,7 @@ ## tst_inputcontext Test: ##################################################################### -qt_add_test(tst_inputcontext +qt_internal_add_test(tst_inputcontext SOURCES ../shared/corecompositor.cpp ../shared/corecompositor.h ../shared/coreprotocol.cpp ../shared/coreprotocol.h diff --git a/tests/auto/wayland/iviapplication/.prev_CMakeLists.txt b/tests/auto/wayland/iviapplication/.prev_CMakeLists.txt index 0453aad8190..2aaed6bab05 100644 --- a/tests/auto/wayland/iviapplication/.prev_CMakeLists.txt +++ b/tests/auto/wayland/iviapplication/.prev_CMakeLists.txt @@ -4,7 +4,7 @@ ## tst_client_iviapplication Test: ##################################################################### -qt_add_test(tst_client_iviapplication +qt_internal_add_test(tst_client_iviapplication SOURCES ../shared_old/mockcompositor.cpp ../shared_old/mockcompositor.h ../shared_old/mockfullscreenshellv1.cpp ../shared_old/mockfullscreenshellv1.h diff --git a/tests/auto/wayland/nooutput/.prev_CMakeLists.txt b/tests/auto/wayland/nooutput/.prev_CMakeLists.txt index 61b43b0f669..18479bdfc49 100644 --- a/tests/auto/wayland/nooutput/.prev_CMakeLists.txt +++ b/tests/auto/wayland/nooutput/.prev_CMakeLists.txt @@ -4,7 +4,7 @@ ## tst_nooutput Test: ##################################################################### -qt_add_test(tst_nooutput +qt_internal_add_test(tst_nooutput SOURCES ../shared/corecompositor.cpp ../shared/corecompositor.h ../shared/coreprotocol.cpp ../shared/coreprotocol.h diff --git a/tests/auto/wayland/nooutput/CMakeLists.txt b/tests/auto/wayland/nooutput/CMakeLists.txt index f7e9dfec1f5..b353d32466a 100644 --- a/tests/auto/wayland/nooutput/CMakeLists.txt +++ b/tests/auto/wayland/nooutput/CMakeLists.txt @@ -4,7 +4,7 @@ ## tst_nooutput Test: ##################################################################### -qt_add_test(tst_nooutput +qt_internal_add_test(tst_nooutput SOURCES ../shared/corecompositor.cpp ../shared/corecompositor.h ../shared/coreprotocol.cpp ../shared/coreprotocol.h diff --git a/tests/auto/wayland/output/.prev_CMakeLists.txt b/tests/auto/wayland/output/.prev_CMakeLists.txt index 7e8e882c575..4103d7a8bb4 100644 --- a/tests/auto/wayland/output/.prev_CMakeLists.txt +++ b/tests/auto/wayland/output/.prev_CMakeLists.txt @@ -4,7 +4,7 @@ ## tst_output Test: ##################################################################### -qt_add_test(tst_output +qt_internal_add_test(tst_output SOURCES ../shared/corecompositor.cpp ../shared/corecompositor.h ../shared/coreprotocol.cpp ../shared/coreprotocol.h diff --git a/tests/auto/wayland/output/CMakeLists.txt b/tests/auto/wayland/output/CMakeLists.txt index e4267fadb21..acb1d53ebed 100644 --- a/tests/auto/wayland/output/CMakeLists.txt +++ b/tests/auto/wayland/output/CMakeLists.txt @@ -4,7 +4,7 @@ ## tst_output Test: ##################################################################### -qt_add_test(tst_output +qt_internal_add_test(tst_output SOURCES ../shared/corecompositor.cpp ../shared/corecompositor.h ../shared/coreprotocol.cpp ../shared/coreprotocol.h diff --git a/tests/auto/wayland/primaryselectionv1/.prev_CMakeLists.txt b/tests/auto/wayland/primaryselectionv1/.prev_CMakeLists.txt index 3d23b446a90..9c207adc1cc 100644 --- a/tests/auto/wayland/primaryselectionv1/.prev_CMakeLists.txt +++ b/tests/auto/wayland/primaryselectionv1/.prev_CMakeLists.txt @@ -4,7 +4,7 @@ ## tst_primaryselectionv1 Test: ##################################################################### -qt_add_test(tst_primaryselectionv1 +qt_internal_add_test(tst_primaryselectionv1 SOURCES ../shared/corecompositor.cpp ../shared/corecompositor.h ../shared/coreprotocol.cpp ../shared/coreprotocol.h diff --git a/tests/auto/wayland/primaryselectionv1/CMakeLists.txt b/tests/auto/wayland/primaryselectionv1/CMakeLists.txt index a8f9ae1315d..f3e592cac0e 100644 --- a/tests/auto/wayland/primaryselectionv1/CMakeLists.txt +++ b/tests/auto/wayland/primaryselectionv1/CMakeLists.txt @@ -4,7 +4,7 @@ ## tst_primaryselectionv1 Test: ##################################################################### -qt_add_test(tst_primaryselectionv1 +qt_internal_add_test(tst_primaryselectionv1 SOURCES ../shared/corecompositor.cpp ../shared/corecompositor.h ../shared/coreprotocol.cpp ../shared/coreprotocol.h diff --git a/tests/auto/wayland/seatv4/.prev_CMakeLists.txt b/tests/auto/wayland/seatv4/.prev_CMakeLists.txt index d37de1da8ae..16eed042e42 100644 --- a/tests/auto/wayland/seatv4/.prev_CMakeLists.txt +++ b/tests/auto/wayland/seatv4/.prev_CMakeLists.txt @@ -4,7 +4,7 @@ ## tst_seatv4 Test: ##################################################################### -qt_add_test(tst_seatv4 +qt_internal_add_test(tst_seatv4 SOURCES ../shared/corecompositor.cpp ../shared/corecompositor.h ../shared/coreprotocol.cpp ../shared/coreprotocol.h @@ -34,7 +34,7 @@ qt6_generate_wayland_protocol_server_sources(tst_seatv4 ## Scopes: ##################################################################### -qt_extend_target(tst_seatv4 CONDITION QT_FEATURE_cursor +qt_internal_extend_target(tst_seatv4 CONDITION QT_FEATURE_cursor PUBLIC_LIBRARIES Qt::GuiPrivate Wayland::Cursor diff --git a/tests/auto/wayland/seatv4/CMakeLists.txt b/tests/auto/wayland/seatv4/CMakeLists.txt index 5496bd59f27..f4eb28b843f 100644 --- a/tests/auto/wayland/seatv4/CMakeLists.txt +++ b/tests/auto/wayland/seatv4/CMakeLists.txt @@ -4,7 +4,7 @@ ## tst_seatv4 Test: ##################################################################### -qt_add_test(tst_seatv4 +qt_internal_add_test(tst_seatv4 SOURCES ../shared/corecompositor.cpp ../shared/corecompositor.h ../shared/coreprotocol.cpp ../shared/coreprotocol.h @@ -35,7 +35,7 @@ qt6_generate_wayland_protocol_server_sources(tst_seatv4 ## Scopes: ##################################################################### -qt_extend_target(tst_seatv4 CONDITION QT_FEATURE_cursor +qt_internal_extend_target(tst_seatv4 CONDITION QT_FEATURE_cursor PUBLIC_LIBRARIES Qt::GuiPrivate Wayland::Cursor diff --git a/tests/auto/wayland/seatv5/.prev_CMakeLists.txt b/tests/auto/wayland/seatv5/.prev_CMakeLists.txt index fa9e5a4eb48..f30c0c76619 100644 --- a/tests/auto/wayland/seatv5/.prev_CMakeLists.txt +++ b/tests/auto/wayland/seatv5/.prev_CMakeLists.txt @@ -4,7 +4,7 @@ ## tst_seatv5 Test: ##################################################################### -qt_add_test(tst_seatv5 +qt_internal_add_test(tst_seatv5 SOURCES ../shared/corecompositor.cpp ../shared/corecompositor.h ../shared/coreprotocol.cpp ../shared/coreprotocol.h diff --git a/tests/auto/wayland/seatv5/CMakeLists.txt b/tests/auto/wayland/seatv5/CMakeLists.txt index 67bfc65354a..7545d769efc 100644 --- a/tests/auto/wayland/seatv5/CMakeLists.txt +++ b/tests/auto/wayland/seatv5/CMakeLists.txt @@ -4,7 +4,7 @@ ## tst_seatv5 Test: ##################################################################### -qt_add_test(tst_seatv5 +qt_internal_add_test(tst_seatv5 SOURCES ../shared/corecompositor.cpp ../shared/corecompositor.h ../shared/coreprotocol.cpp ../shared/coreprotocol.h diff --git a/tests/auto/wayland/surface/.prev_CMakeLists.txt b/tests/auto/wayland/surface/.prev_CMakeLists.txt index a8eb58dac27..ed900c8d1a4 100644 --- a/tests/auto/wayland/surface/.prev_CMakeLists.txt +++ b/tests/auto/wayland/surface/.prev_CMakeLists.txt @@ -4,7 +4,7 @@ ## tst_surface Test: ##################################################################### -qt_add_test(tst_surface +qt_internal_add_test(tst_surface SOURCES ../shared/corecompositor.cpp ../shared/corecompositor.h ../shared/coreprotocol.cpp ../shared/coreprotocol.h diff --git a/tests/auto/wayland/surface/CMakeLists.txt b/tests/auto/wayland/surface/CMakeLists.txt index a3962ddaf3a..0674f7de781 100644 --- a/tests/auto/wayland/surface/CMakeLists.txt +++ b/tests/auto/wayland/surface/CMakeLists.txt @@ -4,7 +4,7 @@ ## tst_surface Test: ##################################################################### -qt_add_test(tst_surface +qt_internal_add_test(tst_surface SOURCES ../shared/corecompositor.cpp ../shared/corecompositor.h ../shared/coreprotocol.cpp ../shared/coreprotocol.h diff --git a/tests/auto/wayland/tabletv2/.prev_CMakeLists.txt b/tests/auto/wayland/tabletv2/.prev_CMakeLists.txt index 5fecee50ac2..96b32d24b25 100644 --- a/tests/auto/wayland/tabletv2/.prev_CMakeLists.txt +++ b/tests/auto/wayland/tabletv2/.prev_CMakeLists.txt @@ -4,7 +4,7 @@ ## tst_tabletv2 Test: ##################################################################### -qt_add_test(tst_tabletv2 +qt_internal_add_test(tst_tabletv2 SOURCES ../shared/corecompositor.cpp ../shared/corecompositor.h ../shared/coreprotocol.cpp ../shared/coreprotocol.h diff --git a/tests/auto/wayland/tabletv2/CMakeLists.txt b/tests/auto/wayland/tabletv2/CMakeLists.txt index d039e30dde3..6d75072603e 100644 --- a/tests/auto/wayland/tabletv2/CMakeLists.txt +++ b/tests/auto/wayland/tabletv2/CMakeLists.txt @@ -4,7 +4,7 @@ ## tst_tabletv2 Test: ##################################################################### -qt_add_test(tst_tabletv2 +qt_internal_add_test(tst_tabletv2 SOURCES ../shared/corecompositor.cpp ../shared/corecompositor.h ../shared/coreprotocol.cpp ../shared/coreprotocol.h diff --git a/tests/auto/wayland/wl_connect/CMakeLists.txt b/tests/auto/wayland/wl_connect/CMakeLists.txt index 5a01bedd069..0c7140ac652 100644 --- a/tests/auto/wayland/wl_connect/CMakeLists.txt +++ b/tests/auto/wayland/wl_connect/CMakeLists.txt @@ -4,7 +4,7 @@ ## tst_wlconnect Test: ##################################################################### -qt_add_test(tst_wlconnect +qt_internal_add_test(tst_wlconnect SOURCES tst_wlconnect.cpp PUBLIC_LIBRARIES diff --git a/tests/auto/wayland/xdgdecorationv1/.prev_CMakeLists.txt b/tests/auto/wayland/xdgdecorationv1/.prev_CMakeLists.txt index 228ad83e00c..31588782ec1 100644 --- a/tests/auto/wayland/xdgdecorationv1/.prev_CMakeLists.txt +++ b/tests/auto/wayland/xdgdecorationv1/.prev_CMakeLists.txt @@ -4,7 +4,7 @@ ## tst_xdgdecorationv1 Test: ##################################################################### -qt_add_test(tst_xdgdecorationv1 +qt_internal_add_test(tst_xdgdecorationv1 SOURCES ../shared/corecompositor.cpp ../shared/corecompositor.h ../shared/coreprotocol.cpp ../shared/coreprotocol.h diff --git a/tests/auto/wayland/xdgdecorationv1/CMakeLists.txt b/tests/auto/wayland/xdgdecorationv1/CMakeLists.txt index fb0fd06addf..8959be9820f 100644 --- a/tests/auto/wayland/xdgdecorationv1/CMakeLists.txt +++ b/tests/auto/wayland/xdgdecorationv1/CMakeLists.txt @@ -4,7 +4,7 @@ ## tst_xdgdecorationv1 Test: ##################################################################### -qt_add_test(tst_xdgdecorationv1 +qt_internal_add_test(tst_xdgdecorationv1 SOURCES ../shared/corecompositor.cpp ../shared/corecompositor.h ../shared/coreprotocol.cpp ../shared/coreprotocol.h diff --git a/tests/auto/wayland/xdgoutput/.prev_CMakeLists.txt b/tests/auto/wayland/xdgoutput/.prev_CMakeLists.txt index 3fc5aa77250..33357ffdce2 100644 --- a/tests/auto/wayland/xdgoutput/.prev_CMakeLists.txt +++ b/tests/auto/wayland/xdgoutput/.prev_CMakeLists.txt @@ -4,7 +4,7 @@ ## tst_xdgoutput Test: ##################################################################### -qt_add_test(tst_xdgoutput +qt_internal_add_test(tst_xdgoutput SOURCES ../shared/corecompositor.cpp ../shared/corecompositor.h ../shared/coreprotocol.cpp ../shared/coreprotocol.h diff --git a/tests/auto/wayland/xdgoutput/CMakeLists.txt b/tests/auto/wayland/xdgoutput/CMakeLists.txt index 341624e4aee..37dee4e4697 100644 --- a/tests/auto/wayland/xdgoutput/CMakeLists.txt +++ b/tests/auto/wayland/xdgoutput/CMakeLists.txt @@ -4,7 +4,7 @@ ## tst_xdgoutput Test: ##################################################################### -qt_add_test(tst_xdgoutput +qt_internal_add_test(tst_xdgoutput SOURCES ../shared/corecompositor.cpp ../shared/corecompositor.h ../shared/coreprotocol.cpp ../shared/coreprotocol.h diff --git a/tests/auto/wayland/xdgshell/.prev_CMakeLists.txt b/tests/auto/wayland/xdgshell/.prev_CMakeLists.txt index 4faa14f3db4..a3872d72607 100644 --- a/tests/auto/wayland/xdgshell/.prev_CMakeLists.txt +++ b/tests/auto/wayland/xdgshell/.prev_CMakeLists.txt @@ -4,7 +4,7 @@ ## tst_xdgshell Test: ##################################################################### -qt_add_test(tst_xdgshell +qt_internal_add_test(tst_xdgshell SOURCES ../shared/corecompositor.cpp ../shared/corecompositor.h ../shared/coreprotocol.cpp ../shared/coreprotocol.h diff --git a/tests/auto/wayland/xdgshell/CMakeLists.txt b/tests/auto/wayland/xdgshell/CMakeLists.txt index a680575caac..3b5cdfe83b6 100644 --- a/tests/auto/wayland/xdgshell/CMakeLists.txt +++ b/tests/auto/wayland/xdgshell/CMakeLists.txt @@ -4,7 +4,7 @@ ## tst_xdgshell Test: ##################################################################### -qt_add_test(tst_xdgshell +qt_internal_add_test(tst_xdgshell SOURCES ../shared/corecompositor.cpp ../shared/corecompositor.h ../shared/coreprotocol.cpp ../shared/coreprotocol.h diff --git a/tests/auto/wayland/xdgshellv6/.prev_CMakeLists.txt b/tests/auto/wayland/xdgshellv6/.prev_CMakeLists.txt index 8fb87235bde..12f3ee19022 100644 --- a/tests/auto/wayland/xdgshellv6/.prev_CMakeLists.txt +++ b/tests/auto/wayland/xdgshellv6/.prev_CMakeLists.txt @@ -4,7 +4,7 @@ ## tst_client_xdgshellv6 Test: ##################################################################### -qt_add_test(tst_client_xdgshellv6 +qt_internal_add_test(tst_client_xdgshellv6 SOURCES ../shared_old/mockcompositor.cpp ../shared_old/mockcompositor.h ../shared_old/mockfullscreenshellv1.cpp ../shared_old/mockfullscreenshellv1.h diff --git a/tests/auto/wayland/xdgshellv6/CMakeLists.txt b/tests/auto/wayland/xdgshellv6/CMakeLists.txt index 03acb48150a..cc8b154b4b4 100644 --- a/tests/auto/wayland/xdgshellv6/CMakeLists.txt +++ b/tests/auto/wayland/xdgshellv6/CMakeLists.txt @@ -4,7 +4,7 @@ ## tst_client_xdgshellv6 Test: ##################################################################### -qt_add_test(tst_client_xdgshellv6 +qt_internal_add_test(tst_client_xdgshellv6 SOURCES ../shared_old/mockcompositor.cpp ../shared_old/mockcompositor.h ../shared_old/mockfullscreenshellv1.cpp ../shared_old/mockfullscreenshellv1.h From 40206410dab1bf5a6abeb265632211a083e65c4c Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Thu, 1 Oct 2020 12:09:27 +0200 Subject: [PATCH 0895/1507] Re-enable tst_nooutput The dependencies update has gone through, so the test should now pass again. Fixes: QTBUG-86698 Change-Id: I23babc4a5c3cae0bff5ba371e9703c976536f4ec Reviewed-by: David Edmundson --- tests/auto/wayland/nooutput/tst_nooutput.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/auto/wayland/nooutput/tst_nooutput.cpp b/tests/auto/wayland/nooutput/tst_nooutput.cpp index 7f491c84009..098d88d9908 100644 --- a/tests/auto/wayland/nooutput/tst_nooutput.cpp +++ b/tests/auto/wayland/nooutput/tst_nooutput.cpp @@ -56,7 +56,6 @@ private slots: void tst_nooutput::noScreens() { - QSKIP("QTBUG-86698 - Temporarily skipped for dependency update"); QRasterWindow window; window.resize(16, 16); window.show(); From e800b14c8cbfeb9035d0273041fb5d64594b42af Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Sat, 25 Apr 2020 13:46:09 +0200 Subject: [PATCH 0896/1507] Fix race condition on frame callback If the frame listener callback is moved to a different queue while the frame event is being processed, the event will not get delivered. (It will not even show up in the WAYLAND_DEBUG output.) This will cause waitForFrameSync() to hang until it times out. To avoid this, perform the move just after the callback has been created. This exposed an issue with single-threaded rendering, where a new update would be started from inside the callback, resetting mWaitingForFrameCallback before waitForFrameSync could react to it. This caused all rendering to freeze. To avoid that problem, do not deliver update requests directly from the frame callback. With the callback always on a separate queue, we then have to make sure that queue is also dispatched during the main event loop, otherwise the events may not be processed. To do this, we need a mutex lock. But it turns out that we no longer need a global mutex lock as long as the frame events are being dispatched on their own queues, but can manage with per-window locks instead. A final thing needed is to make sure the frame callback does not request additional updates while we are already waiting for the main thread to process the last one. This is to avoid flooding the main event loop with events, when the main thread is processing them at a slower pace than the frame rate. Fixes: QTBUG-83263 Pick-to: 5.15 Done-with: Eskil Abrahamsen Blomfeldt Change-Id: I0db9da64fc8ced147177391c2a7999c4cc7a0d58 Reviewed-by: Eskil Abrahamsen Blomfeldt Reviewed-by: David Edmundson Reviewed-by: Paul Olav Tvete --- .../platforms/wayland/qwaylanddisplay.cpp | 32 +++++++++++++ .../platforms/wayland/qwaylanddisplay_p.h | 12 +++++ .../platforms/wayland/qwaylandwindow.cpp | 48 ++++++++++--------- .../platforms/wayland/qwaylandwindow_p.h | 5 +- tests/auto/wayland/surface/tst_surface.cpp | 2 - 5 files changed, 72 insertions(+), 27 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index e39f912809b..e759c5d64f4 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -225,6 +225,17 @@ void QWaylandDisplay::flushRequests() if (wl_display_dispatch_pending(mDisplay) < 0) checkError(); + { + QReadLocker locker(&m_frameQueueLock); + for (const FrameQueue &q : mExternalQueues) { + QMutexLocker locker(q.mutex); + while (wl_display_prepare_read_queue(mDisplay, q.queue) != 0) + wl_display_dispatch_queue_pending(mDisplay, q.queue); + wl_display_read_events(mDisplay); + wl_display_dispatch_queue_pending(mDisplay, q.queue); + } + } + wl_display_flush(mDisplay); } @@ -234,6 +245,27 @@ void QWaylandDisplay::blockingReadEvents() checkError(); } +void QWaylandDisplay::destroyFrameQueue(const QWaylandDisplay::FrameQueue &q) +{ + QWriteLocker locker(&m_frameQueueLock); + auto it = std::find_if(mExternalQueues.begin(), + mExternalQueues.end(), + [&q] (const QWaylandDisplay::FrameQueue &other){ return other.queue == q.queue; }); + Q_ASSERT(it != mExternalQueues.end()); + mExternalQueues.erase(it); + if (q.queue != nullptr) + wl_event_queue_destroy(q.queue); + delete q.mutex; +} + +QWaylandDisplay::FrameQueue QWaylandDisplay::createFrameQueue() +{ + QWriteLocker locker(&m_frameQueueLock); + FrameQueue q{createEventQueue()}; + mExternalQueues.append(q); + return q; +} + wl_event_queue *QWaylandDisplay::createEventQueue() { return wl_display_create_queue(mDisplay); diff --git a/src/plugins/platforms/wayland/qwaylanddisplay_p.h b/src/plugins/platforms/wayland/qwaylanddisplay_p.h index 68d72812f52..86e3b729f5a 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay_p.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay_p.h @@ -55,6 +55,8 @@ #include #include #include +#include +#include #include #include @@ -119,6 +121,12 @@ class Q_WAYLAND_CLIENT_EXPORT QWaylandDisplay : public QObject, public QtWayland Q_OBJECT public: + struct FrameQueue { + FrameQueue(wl_event_queue *q = nullptr) : queue(q), mutex(new QMutex) {} + wl_event_queue *queue; + QMutex *mutex; + }; + QWaylandDisplay(QWaylandIntegration *waylandIntegration); ~QWaylandDisplay(void) override; @@ -207,6 +215,8 @@ public: void handleWindowDestroyed(QWaylandWindow *window); wl_event_queue *createEventQueue(); + FrameQueue createFrameQueue(); + void destroyFrameQueue(const FrameQueue &q); void dispatchQueueWhile(wl_event_queue *queue, std::function condition, int timeout = -1); public slots: @@ -284,8 +294,10 @@ private: QPointer mLastInputWindow; QPointer mLastKeyboardFocus; QList mActiveWindows; + QList mExternalQueues; struct wl_callback *mSyncCallback = nullptr; static const wl_callback_listener syncCallbackListener; + QReadWriteLock m_frameQueueLock; bool mClientSideInputContextRequested = !QPlatformInputContextFactory::requested().isNull(); bool mUsingInputContextFromCompositor = false; diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 382c258f356..76f9e9f7a8f 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -76,7 +76,7 @@ QWaylandWindow *QWaylandWindow::mMouseGrab = nullptr; QWaylandWindow::QWaylandWindow(QWindow *window, QWaylandDisplay *display) : QPlatformWindow(window) , mDisplay(display) - , mFrameQueue(mDisplay->createEventQueue()) + , mFrameQueue(mDisplay->createFrameQueue()) , mResizeAfterSwap(qEnvironmentVariableIsSet("QT_WAYLAND_RESIZE_AFTER_SWAP")) { { @@ -95,6 +95,7 @@ QWaylandWindow::QWaylandWindow(QWindow *window, QWaylandDisplay *display) QWaylandWindow::~QWaylandWindow() { + mDisplay->destroyFrameQueue(mFrameQueue); mDisplay->handleWindowDestroyed(this); delete mWindowDecoration; @@ -624,33 +625,29 @@ void QWaylandWindow::handleFrameCallback() mFrameCallbackElapsedTimer.invalidate(); // The rest can wait until we can run it on the correct thread - auto doHandleExpose = [this]() { - bool wasExposed = isExposed(); - mFrameCallbackTimedOut = false; - if (!wasExposed && isExposed()) // Did setting mFrameCallbackTimedOut make the window exposed? - sendExposeEvent(QRect(QPoint(), geometry().size())); - if (wasExposed && hasPendingUpdateRequest()) - deliverUpdateRequest(); - }; + if (!mWaitingForUpdateDelivery) { + auto doHandleExpose = [this]() { + bool wasExposed = isExposed(); + mFrameCallbackTimedOut = false; + if (!wasExposed && isExposed()) // Did setting mFrameCallbackTimedOut make the window exposed? + sendExposeEvent(QRect(QPoint(), geometry().size())); + if (wasExposed && hasPendingUpdateRequest()) + deliverUpdateRequest(); - if (thread() != QThread::currentThread()) { - QMetaObject::invokeMethod(this, doHandleExpose); - } else { - doHandleExpose(); + mWaitingForUpdateDelivery = false; + }; + + // Queued connection, to make sure we don't call handleUpdate() from inside waitForFrameSync() + // in the single-threaded case. + mWaitingForUpdateDelivery = true; + QMetaObject::invokeMethod(this, doHandleExpose, Qt::QueuedConnection); } } -QMutex QWaylandWindow::mFrameSyncMutex; - bool QWaylandWindow::waitForFrameSync(int timeout) { - if (!mWaitingForFrameCallback) - return true; - - QMutexLocker locker(&mFrameSyncMutex); - - wl_proxy_set_queue(reinterpret_cast(mFrameCallback), mFrameQueue); - mDisplay->dispatchQueueWhile(mFrameQueue, [&]() { return mWaitingForFrameCallback; }, timeout); + QMutexLocker locker(mFrameQueue.mutex); + mDisplay->dispatchQueueWhile(mFrameQueue.queue, [&]() { return mWaitingForFrameCallback; }, timeout); if (mWaitingForFrameCallback) { qCDebug(lcWaylandBackingstore) << "Didn't receive frame callback in time, window should now be inexposed"; @@ -1124,6 +1121,7 @@ void QWaylandWindow::timerEvent(QTimerEvent *event) } if (mFrameCallbackElapsedTimer.isValid() && callbackTimerExpired) { mFrameCallbackElapsedTimer.invalidate(); + qCDebug(lcWaylandBackingstore) << "Didn't receive frame callback in time, window should now be inexposed"; mFrameCallbackTimedOut = true; mWaitingForUpdate = false; @@ -1172,7 +1170,11 @@ void QWaylandWindow::handleUpdate() mFrameCallback = nullptr; } - mFrameCallback = mSurface->frame(); + QMutexLocker locker(mFrameQueue.mutex); + struct ::wl_surface *wrappedSurface = reinterpret_cast(wl_proxy_create_wrapper(mSurface->object())); + wl_proxy_set_queue(reinterpret_cast(wrappedSurface), mFrameQueue.queue); + mFrameCallback = wl_surface_frame(wrappedSurface); + wl_proxy_wrapper_destroy(wrappedSurface); wl_callback_add_listener(mFrameCallback, &QWaylandWindow::callbackListener, this); mWaitingForFrameCallback = true; mWaitingForUpdate = false; diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index 9272d368019..8b9a11e7ff5 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -63,6 +63,7 @@ #include #include +#include #include struct wl_egl_window; @@ -226,10 +227,11 @@ protected: WId mWindowId; bool mWaitingForFrameCallback = false; bool mFrameCallbackTimedOut = false; // Whether the frame callback has timed out + bool mWaitingForUpdateDelivery = false; int mFrameCallbackCheckIntervalTimerId = -1; QElapsedTimer mFrameCallbackElapsedTimer; struct ::wl_callback *mFrameCallback = nullptr; - struct ::wl_event_queue *mFrameQueue = nullptr; + QWaylandDisplay::FrameQueue mFrameQueue; QWaitCondition mFrameSyncWait; // True when we have called deliverRequestUpdate, but the client has not yet attached a new buffer @@ -280,7 +282,6 @@ private: static const wl_callback_listener callbackListener; void handleFrameCallback(); - static QMutex mFrameSyncMutex; static QWaylandWindow *mMouseGrab; QReadWriteLock mSurfaceLock; diff --git a/tests/auto/wayland/surface/tst_surface.cpp b/tests/auto/wayland/surface/tst_surface.cpp index 289fbd62153..c7b02e2cc80 100644 --- a/tests/auto/wayland/surface/tst_surface.cpp +++ b/tests/auto/wayland/surface/tst_surface.cpp @@ -64,7 +64,6 @@ void tst_surface::createDestroySurface() void tst_surface::waitForFrameCallbackRaster() { - QSKIP("TODO: This currently fails, needs a fix"); class TestWindow : public QRasterWindow { public: explicit TestWindow() { resize(40, 40); } @@ -100,7 +99,6 @@ void tst_surface::waitForFrameCallbackRaster() #if QT_CONFIG(opengl) void tst_surface::waitForFrameCallbackGl() { - QSKIP("TODO: This currently fails, needs a fix"); class TestWindow : public QOpenGLWindow { public: explicit TestWindow() From 5c4f0dea27e58b98b3a1ece38dca7b1ce2b9b9dd Mon Sep 17 00:00:00 2001 From: Aleix Pol Date: Mon, 5 Oct 2020 19:29:29 +0200 Subject: [PATCH 0897/1507] Implement MockRegion If we don't mock regions, we get a crash every time that a client calls createRegion. So far regions are untested. Pick-to: 5.15 Change-Id: I83f20b879ece5cefcf2039d369034516df6a6a62 Reviewed-by: David Edmundson --- .../auto/wayland/client/.prev_CMakeLists.txt | 1 + tests/auto/wayland/client/CMakeLists.txt | 1 + .../fullscreenshellv1/.prev_CMakeLists.txt | 1 + .../wayland/fullscreenshellv1/CMakeLists.txt | 1 + .../iviapplication/.prev_CMakeLists.txt | 1 + .../wayland/shared_old/mockcompositor.cpp | 6 +- .../auto/wayland/shared_old/mockcompositor.h | 18 ++++++ tests/auto/wayland/shared_old/mockregion.cpp | 51 +++++++++++++++ tests/auto/wayland/shared_old/mockregion.h | 62 +++++++++++++++++++ tests/auto/wayland/shared_old/shared_old.pri | 2 + .../wayland/xdgshellv6/.prev_CMakeLists.txt | 1 + tests/auto/wayland/xdgshellv6/CMakeLists.txt | 1 + 12 files changed, 143 insertions(+), 3 deletions(-) create mode 100644 tests/auto/wayland/shared_old/mockregion.cpp create mode 100644 tests/auto/wayland/shared_old/mockregion.h diff --git a/tests/auto/wayland/client/.prev_CMakeLists.txt b/tests/auto/wayland/client/.prev_CMakeLists.txt index ece394fcc0d..cdcae2ff158 100644 --- a/tests/auto/wayland/client/.prev_CMakeLists.txt +++ b/tests/auto/wayland/client/.prev_CMakeLists.txt @@ -11,6 +11,7 @@ qt_internal_add_test(tst_client ../shared_old/mockinput.cpp ../shared_old/mockinput.h ../shared_old/mockiviapplication.cpp ../shared_old/mockiviapplication.h ../shared_old/mockoutput.cpp ../shared_old/mockoutput.h + ../shared_old/mockregion.cpp ../shared_old/mockregion.h ../shared_old/mocksurface.cpp ../shared_old/mocksurface.h ../shared_old/mockwlshell.cpp ../shared_old/mockwlshell.h ../shared_old/mockxdgshellv6.cpp ../shared_old/mockxdgshellv6.h diff --git a/tests/auto/wayland/client/CMakeLists.txt b/tests/auto/wayland/client/CMakeLists.txt index 919bf064d78..86eb420e5ca 100644 --- a/tests/auto/wayland/client/CMakeLists.txt +++ b/tests/auto/wayland/client/CMakeLists.txt @@ -11,6 +11,7 @@ qt_internal_add_test(tst_client ../shared_old/mockinput.cpp ../shared_old/mockinput.h ../shared_old/mockiviapplication.cpp ../shared_old/mockiviapplication.h ../shared_old/mockoutput.cpp ../shared_old/mockoutput.h + ../shared_old/mockregion.cpp ../shared_old/mockregion.h ../shared_old/mocksurface.cpp ../shared_old/mocksurface.h ../shared_old/mockwlshell.cpp ../shared_old/mockwlshell.h ../shared_old/mockxdgshellv6.cpp ../shared_old/mockxdgshellv6.h diff --git a/tests/auto/wayland/fullscreenshellv1/.prev_CMakeLists.txt b/tests/auto/wayland/fullscreenshellv1/.prev_CMakeLists.txt index 7cf9624c009..c3e375c0f19 100644 --- a/tests/auto/wayland/fullscreenshellv1/.prev_CMakeLists.txt +++ b/tests/auto/wayland/fullscreenshellv1/.prev_CMakeLists.txt @@ -11,6 +11,7 @@ qt_internal_add_test(tst_client_fullscreenshellv1 ../shared_old/mockinput.cpp ../shared_old/mockinput.h ../shared_old/mockiviapplication.cpp ../shared_old/mockiviapplication.h ../shared_old/mockoutput.cpp ../shared_old/mockoutput.h + ../shared_old/mockregion.cpp ../shared_old/mockregion.h ../shared_old/mocksurface.cpp ../shared_old/mocksurface.h ../shared_old/mockwlshell.cpp ../shared_old/mockwlshell.h ../shared_old/mockxdgshellv6.cpp ../shared_old/mockxdgshellv6.h diff --git a/tests/auto/wayland/fullscreenshellv1/CMakeLists.txt b/tests/auto/wayland/fullscreenshellv1/CMakeLists.txt index 7a5a72c2415..42d328a6481 100644 --- a/tests/auto/wayland/fullscreenshellv1/CMakeLists.txt +++ b/tests/auto/wayland/fullscreenshellv1/CMakeLists.txt @@ -11,6 +11,7 @@ qt_internal_add_test(tst_client_fullscreenshellv1 ../shared_old/mockinput.cpp ../shared_old/mockinput.h ../shared_old/mockiviapplication.cpp ../shared_old/mockiviapplication.h ../shared_old/mockoutput.cpp ../shared_old/mockoutput.h + ../shared_old/mockregion.cpp ../shared_old/mockregion.h ../shared_old/mocksurface.cpp ../shared_old/mocksurface.h ../shared_old/mockwlshell.cpp ../shared_old/mockwlshell.h ../shared_old/mockxdgshellv6.cpp ../shared_old/mockxdgshellv6.h diff --git a/tests/auto/wayland/iviapplication/.prev_CMakeLists.txt b/tests/auto/wayland/iviapplication/.prev_CMakeLists.txt index 2aaed6bab05..ce9c8fd9122 100644 --- a/tests/auto/wayland/iviapplication/.prev_CMakeLists.txt +++ b/tests/auto/wayland/iviapplication/.prev_CMakeLists.txt @@ -11,6 +11,7 @@ qt_internal_add_test(tst_client_iviapplication ../shared_old/mockinput.cpp ../shared_old/mockinput.h ../shared_old/mockiviapplication.cpp ../shared_old/mockiviapplication.h ../shared_old/mockoutput.cpp ../shared_old/mockoutput.h + ../shared_old/mockregion.cpp ../shared_old/mockregion.h ../shared_old/mocksurface.cpp ../shared_old/mocksurface.h ../shared_old/mockwlshell.cpp ../shared_old/mockwlshell.h ../shared_old/mockxdgshellv6.cpp ../shared_old/mockxdgshellv6.h diff --git a/tests/auto/wayland/shared_old/mockcompositor.cpp b/tests/auto/wayland/shared_old/mockcompositor.cpp index 61494cbb5f1..6fd2ec6bb73 100644 --- a/tests/auto/wayland/shared_old/mockcompositor.cpp +++ b/tests/auto/wayland/shared_old/mockcompositor.cpp @@ -382,9 +382,9 @@ static void compositor_create_surface(wl_client *client, wl_resource *compositor static void compositor_create_region(wl_client *client, wl_resource *compositorResource, uint32_t id) { - Q_UNUSED(client); - Q_UNUSED(compositorResource); - Q_UNUSED(id); + Compositor *compositor = + static_cast(wl_resource_get_user_data(compositorResource)); + new Region(client, id, wl_resource_get_version(compositorResource), compositor); } void Compositor::bindCompositor(wl_client *client, void *compositorData, uint32_t version, uint32_t id) diff --git a/tests/auto/wayland/shared_old/mockcompositor.h b/tests/auto/wayland/shared_old/mockcompositor.h index 3238039960a..cbcf34cbd65 100644 --- a/tests/auto/wayland/shared_old/mockcompositor.h +++ b/tests/auto/wayland/shared_old/mockcompositor.h @@ -32,12 +32,14 @@ #include "mockxdgshellv6.h" #include "mockiviapplication.h" #include "mockfullscreenshellv1.h" +#include "mockregion.h" #include #include #include #include +#include #include #include #include @@ -61,6 +63,7 @@ class Output; class IviApplication; class WlShell; class XdgShellV6; +class Region; class Compositor { @@ -159,6 +162,21 @@ private: Q_DECLARE_METATYPE(QSharedPointer) +class MockRegion +{ +public: + Impl::Region *handle() const { return m_region; } + +private: + MockRegion(Impl::Region *region); + friend class Impl::Compositor; + friend class Impl::Region; + + Impl::Region *m_region = nullptr; +}; + +Q_DECLARE_METATYPE(QSharedPointer) + class MockIviSurface { public: diff --git a/tests/auto/wayland/shared_old/mockregion.cpp b/tests/auto/wayland/shared_old/mockregion.cpp new file mode 100644 index 00000000000..78b457fae49 --- /dev/null +++ b/tests/auto/wayland/shared_old/mockregion.cpp @@ -0,0 +1,51 @@ +/**************************************************************************** +** +** Copyright (C) 2020 Aleix Pol Gonzalez +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "mockregion.h" +#include "mockcompositor.h" + +namespace Impl { + +Region::Region(wl_client *client, uint32_t id, int v, Compositor *compositor) + : QtWaylandServer::wl_region(client, id, v), + m_compositor(compositor), + m_mockRegion(new MockRegion(this)) +{ +} + +Region::~Region() = default; + +void Region::region_destroy_resource(Resource *resource) +{ + Q_UNUSED(resource) + delete this; +} + +} + +MockRegion::MockRegion(Impl::Region *region) : m_region(region) { } diff --git a/tests/auto/wayland/shared_old/mockregion.h b/tests/auto/wayland/shared_old/mockregion.h new file mode 100644 index 00000000000..f98a25fbb07 --- /dev/null +++ b/tests/auto/wayland/shared_old/mockregion.h @@ -0,0 +1,62 @@ +/**************************************************************************** +** +** Copyright (C) 2020 Aleix Pol Gonzalez +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef MOCKREGION_H +#define MOCKREGION_H + +#include +#include + +#include "qwayland-server-wayland.h" + +class MockRegion; + +namespace Impl { + +class Compositor; + +class Region : public QtWaylandServer::wl_region +{ +public: + Region(wl_client *client, uint32_t id, int v, Compositor *compositor); + ~Region(); + + Compositor *compositor() const { return m_compositor; } + static Region *fromResource(struct ::wl_resource *resource); + +protected: + void region_destroy_resource(Resource *resource) override; + +private: + Compositor *m_compositor = nullptr; + QSharedPointer m_mockRegion; +}; + +} + +#endif // MOCKREGION_H diff --git a/tests/auto/wayland/shared_old/shared_old.pri b/tests/auto/wayland/shared_old/shared_old.pri index 6989e613e6c..899e6b30902 100644 --- a/tests/auto/wayland/shared_old/shared_old.pri +++ b/tests/auto/wayland/shared_old/shared_old.pri @@ -21,6 +21,7 @@ SOURCES += \ ../shared_old/mockwlshell.cpp \ ../shared_old/mockxdgshellv6.cpp \ ../shared_old/mocksurface.cpp \ + ../shared_old/mockregion.cpp \ ../shared_old/mockoutput.cpp HEADERS += \ @@ -31,4 +32,5 @@ HEADERS += \ ../shared_old/mockwlshell.h \ ../shared_old/mockxdgshellv6.h \ ../shared_old/mocksurface.h \ + ../shared_old/mockregion.h \ ../shared_old/mockoutput.h diff --git a/tests/auto/wayland/xdgshellv6/.prev_CMakeLists.txt b/tests/auto/wayland/xdgshellv6/.prev_CMakeLists.txt index 12f3ee19022..dc40fd637a0 100644 --- a/tests/auto/wayland/xdgshellv6/.prev_CMakeLists.txt +++ b/tests/auto/wayland/xdgshellv6/.prev_CMakeLists.txt @@ -11,6 +11,7 @@ qt_internal_add_test(tst_client_xdgshellv6 ../shared_old/mockinput.cpp ../shared_old/mockinput.h ../shared_old/mockiviapplication.cpp ../shared_old/mockiviapplication.h ../shared_old/mockoutput.cpp ../shared_old/mockoutput.h + ../shared_old/mockregion.cpp ../shared_old/mockregion.h ../shared_old/mocksurface.cpp ../shared_old/mocksurface.h ../shared_old/mockwlshell.cpp ../shared_old/mockwlshell.h ../shared_old/mockxdgshellv6.cpp ../shared_old/mockxdgshellv6.h diff --git a/tests/auto/wayland/xdgshellv6/CMakeLists.txt b/tests/auto/wayland/xdgshellv6/CMakeLists.txt index cc8b154b4b4..0e1704ea4a8 100644 --- a/tests/auto/wayland/xdgshellv6/CMakeLists.txt +++ b/tests/auto/wayland/xdgshellv6/CMakeLists.txt @@ -11,6 +11,7 @@ qt_internal_add_test(tst_client_xdgshellv6 ../shared_old/mockinput.cpp ../shared_old/mockinput.h ../shared_old/mockiviapplication.cpp ../shared_old/mockiviapplication.h ../shared_old/mockoutput.cpp ../shared_old/mockoutput.h + ../shared_old/mockregion.cpp ../shared_old/mockregion.h ../shared_old/mocksurface.cpp ../shared_old/mocksurface.h ../shared_old/mockwlshell.cpp ../shared_old/mockwlshell.h ../shared_old/mockxdgshellv6.cpp ../shared_old/mockxdgshellv6.h From e956efdcfa0d453fbbd40493c3e84d144cedd250 Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Sat, 10 Oct 2020 22:04:03 +0300 Subject: [PATCH 0898/1507] Scanner: Generate code that cleans up m_resource The object that owns the resource will not be necessarily destroyed in the destroy_resource() function. One such case may arise if the compositor wants to animate the disappearing of a window, in that case we want to keep client buffer data around even after the wl_buffer resource has been destroyed. If the compositor accidentally accesses the destroyed resource, it'll most likely crash because of SIGSEGV. Speaking from my experience, such crashes are far from being fun to debug. With this change, qtwaylandscanner will generate code that cleans up m_resource when the associated resource has been destroyed. It can be useful for the purpose of preventing accessing already destroyed data. Note that we want m_resource to be valid when the destroy_resource() func is called because the compositor may need it in order to properly perform cleanup, for example send a wl_pointer::leave() event, etc. Pick-to: 5.15 Change-Id: I82dab3b7eae8c282fdbad689af49622350b6c867 Reviewed-by: David Edmundson --- src/tools/qtwaylandscanner/qtwaylandscanner.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp index e984b8684ee..5b569411931 100644 --- a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp +++ b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp @@ -810,6 +810,8 @@ bool Scanner::process() printf(" %s *that = resource->%s_object;\n", interfaceName, interfaceNameStripped); printf(" that->m_resource_map.remove(resource->client(), resource);\n"); printf(" that->%s_destroy_resource(resource);\n", interfaceNameStripped); + printf(" if (that->m_resource == resource)\n"); + printf(" that->m_resource = nullptr;\n"); printf(" delete resource;\n"); printf(" }\n"); printf("\n"); From 7bf4c434a4d9814b7c8424118d4cd5e47811dd05 Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Fri, 11 Sep 2020 17:42:06 +0300 Subject: [PATCH 0899/1507] Scanner: Generate code that destroys inert resources In rare cases, the compositor may need to destroy its private data associated with a wl_resource object. For example, one such case may arise when an output has been disconnected and the corresponding QWaylandXdgOutputV1 object needs to be destroyed. Another case is where some resource has become inert. If the QWaylandXdgOutputV1 object has been destroyed and there are still wl_resource objects associated with it, the compositor will crash due to a segfault when somebody calls xdg_output::destroy(). With this change, qtwaylandscanner will generate code that handles destruction of inert resources behind the scenes. Pick-to: 5.15 Change-Id: I0532f783ae53cc7861e0f08433dc2407aa9c7953 Reviewed-by: David Edmundson --- .../qtwaylandscanner/qtwaylandscanner.cpp | 20 ++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp index 5b569411931..1a1f8bf16df 100644 --- a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp +++ b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp @@ -719,7 +719,10 @@ bool Scanner::process() printf(" %s::~%s()\n", interfaceName, interfaceName); printf(" {\n"); printf(" for (auto resource : qAsConst(m_resource_map))\n"); - printf(" wl_resource_set_implementation(resource->handle, nullptr, nullptr, nullptr);\n"); + printf(" resource->%s_object = nullptr;\n", interfaceNameStripped); + printf("\n"); + printf(" if (m_resource)\n"); + printf(" m_resource->%s_object = nullptr;\n", interfaceNameStripped); printf("\n"); printf(" if (m_global) {\n"); printf(" wl_global_destroy(m_global);\n"); @@ -808,10 +811,12 @@ bool Scanner::process() printf(" Resource *resource = Resource::fromResource(client_resource);\n"); printf(" Q_ASSERT(resource);\n"); printf(" %s *that = resource->%s_object;\n", interfaceName, interfaceNameStripped); - printf(" that->m_resource_map.remove(resource->client(), resource);\n"); - printf(" that->%s_destroy_resource(resource);\n", interfaceNameStripped); - printf(" if (that->m_resource == resource)\n"); - printf(" that->m_resource = nullptr;\n"); + printf(" if (Q_LIKELY(that)) {\n"); + printf(" that->m_resource_map.remove(resource->client(), resource);\n"); + printf(" that->%s_destroy_resource(resource);\n", interfaceNameStripped); + printf(" if (that->m_resource == resource)\n"); + printf(" that->m_resource = nullptr;\n"); + printf(" }\n"); printf(" delete resource;\n"); printf(" }\n"); printf("\n"); @@ -885,6 +890,11 @@ bool Scanner::process() printf(" {\n"); printf(" Q_UNUSED(client);\n"); printf(" Resource *r = Resource::fromResource(resource);\n"); + printf(" if (Q_UNLIKELY(!r->%s_object)) {\n", interfaceNameStripped); + if (e.type == "destructor") + printf(" wl_resource_destroy(resource);\n"); + printf(" return;\n"); + printf(" }\n"); printf(" static_cast<%s *>(r->%s_object)->%s_%s(\n", interfaceName, interfaceNameStripped, interfaceNameStripped, e.name.constData()); printf(" r"); for (const WaylandArgument &a : e.arguments) { From 19483db52c21029665f6e09df9f53735ede480cc Mon Sep 17 00:00:00 2001 From: Aleix Pol Date: Tue, 13 Oct 2020 01:31:54 +0200 Subject: [PATCH 0900/1507] Implement CoreProtocol::compositor_create_region Otherwise tests using it crash. Pick-to: 5.15 Change-Id: Id2ce98ed7c975144728be7566e20b6ea08fa9150 Reviewed-by: David Edmundson --- tests/auto/wayland/shared/coreprotocol.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/tests/auto/wayland/shared/coreprotocol.h b/tests/auto/wayland/shared/coreprotocol.h index 3670dc641ea..45f93ec55a8 100644 --- a/tests/auto/wayland/shared/coreprotocol.h +++ b/tests/auto/wayland/shared/coreprotocol.h @@ -139,6 +139,21 @@ protected: void surface_frame(Resource *resource, uint32_t callback) override; }; +class Region : public QtWaylandServer::wl_region +{ +public: + explicit Region(wl_client *client, int id, int version) + : QtWaylandServer::wl_region(client, id, version) + { + } + + void region_destroy_resource(Resource *resource) override + { + Q_UNUSED(resource); + delete this; + } +}; + class WlCompositor : public Global, public QtWaylandServer::wl_compositor { Q_OBJECT @@ -162,6 +177,12 @@ protected: m_surfaces.append(surface); emit surfaceCreated(surface); } + + static void compositor_create_region(wl_client *client, wl_resource *compositorResource, + uint32_t id) + { + new Region(client, id, wl_resource_get_version(compositorResource)); + } }; class Subsurface : public QObject, public QtWaylandServer::wl_subsurface From 5b3bda7f0ad27ac2d5b655cce037872c0ecc60a2 Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Fri, 16 Oct 2020 11:38:25 +0100 Subject: [PATCH 0901/1507] Client: Advertise all supported mime types Qt has some internal mime types that can be translated to known types. For example the mime type application/x-qt-image Qt can convert to any supported image format. The data_source_send method already converts (via QWaylandMimeHelper::getByteArray) However we previously only advertised the list of mimetypes explicitly set by the application. This brings us in line with the X11 QPA. Fixes: QTBUG-87657 Pick-to: 5.15 Change-Id: Ia09c0cbc1f0997552bd253e79d6715ebcafee0a1 Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/plugins/platforms/wayland/qwaylanddatasource.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylanddatasource.cpp b/src/plugins/platforms/wayland/qwaylanddatasource.cpp index ea76943a734..f45122fb9b6 100644 --- a/src/plugins/platforms/wayland/qwaylanddatasource.cpp +++ b/src/plugins/platforms/wayland/qwaylanddatasource.cpp @@ -60,7 +60,7 @@ QWaylandDataSource::QWaylandDataSource(QWaylandDataDeviceManager *dataDeviceMana { if (!mimeData) return; - const auto formats = mimeData->formats(); + const auto formats = QInternalMimeData::formatsHelper(mimeData); for (const QString &format : formats) { offer(format); } From a0a17c1886a02310219340284ab15b5370359fb4 Mon Sep 17 00:00:00 2001 From: Aleix Pol Date: Mon, 19 Oct 2020 14:41:01 +0200 Subject: [PATCH 0902/1507] Address WlCompositor::compositor_create_region in tests It was not properly marked as override and would not get called. Pick-to: 5.15 Change-Id: Ib80c916c65534ddff918ac06bbe52d88e19d9ff4 Reviewed-by: David Edmundson --- tests/auto/wayland/shared/coreprotocol.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tests/auto/wayland/shared/coreprotocol.h b/tests/auto/wayland/shared/coreprotocol.h index 45f93ec55a8..17eeca27fd1 100644 --- a/tests/auto/wayland/shared/coreprotocol.h +++ b/tests/auto/wayland/shared/coreprotocol.h @@ -178,10 +178,9 @@ protected: emit surfaceCreated(surface); } - static void compositor_create_region(wl_client *client, wl_resource *compositorResource, - uint32_t id) + void compositor_create_region(Resource *resource, uint32_t id) override { - new Region(client, id, wl_resource_get_version(compositorResource)); + new Region(resource->client(), id, resource->version()); } }; From 108be7810d4a5816d14579b0df3587e2aaf2d86a Mon Sep 17 00:00:00 2001 From: Aleix Pol Date: Wed, 30 Sep 2020 13:37:12 +0200 Subject: [PATCH 0903/1507] Issue set_opaque_region on opaque surfaces The application will tell Qt whether the background is transparent through either Qt::WA_TranslucentBackground or QQuickWindow::setColor. These will set a QSurfaceFormat. This change checks the QSurfaceFormat and issues the opacity information so we can properly implement culling optimizations in the compositor. Pick-to: 5.15 Change-Id: I4f7562467449eac7931f3011d4b835934212adad Reviewed-by: David Edmundson --- .../platforms/wayland/qwaylandwindow.cpp | 26 +++++++++++++++++++ .../platforms/wayland/qwaylandwindow_p.h | 3 +++ 2 files changed, 29 insertions(+) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 76f9e9f7a8f..130dbab361f 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -362,6 +362,9 @@ void QWaylandWindow::setGeometry(const QRect &rect) if (mShellSurface) mShellSurface->setWindowGeometry(windowContentGeometry()); + + if (isOpaque() && mMask.isEmpty()) + setOpaqueArea(rect); } void QWaylandWindow::resizeFromApplyConfigure(const QSize &sizeWithMargins, const QPoint &offset) @@ -461,10 +464,16 @@ void QWaylandWindow::setMask(const QRegion &mask) if (mMask.isEmpty()) { mSurface->set_input_region(nullptr); + + if (isOpaque()) + setOpaqueArea(QRect(QPoint(0, 0), geometry().size())); } else { struct ::wl_region *region = mDisplay->createRegion(mMask); mSurface->set_input_region(region); wl_region_destroy(region); + + if (isOpaque()) + setOpaqueArea(mMask); } mSurface->commit(); @@ -1223,6 +1232,23 @@ bool QtWaylandClient::QWaylandWindow::startSystemMove() return false; } +bool QWaylandWindow::isOpaque() const +{ + return window()->requestedFormat().alphaBufferSize() <= 0; +} + +void QWaylandWindow::setOpaqueArea(const QRegion &opaqueArea) +{ + if (opaqueArea == mOpaqueArea || !mSurface) + return; + + mOpaqueArea = opaqueArea; + + struct ::wl_region *region = mDisplay->createRegion(opaqueArea); + mSurface->set_opaque_region(region); + wl_region_destroy(region); +} + } QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index 8b9a11e7ff5..93e92458072 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -254,6 +254,7 @@ protected: Qt::WindowFlags mFlags; QRegion mMask; + QRegion mOpaqueArea; Qt::WindowStates mLastReportedWindowStates = Qt::WindowNoState; QWaylandShmBackingStore *mBackingStore = nullptr; @@ -270,6 +271,8 @@ private: void sendExposeEvent(const QRect &rect); static void closePopups(QWaylandWindow *parent); QPlatformScreen *calculateScreenFromSurfaceEvents() const; + void setOpaqueArea(const QRegion &opaqueArea); + bool isOpaque() const; void handleMouseEventWithDecoration(QWaylandInputDevice *inputDevice, const QWaylandPointerEvent &e); void handleScreensChanged(); From e48005a356df1683b839ddb1745409ad37a92ef6 Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Mon, 26 Oct 2020 11:45:45 +0100 Subject: [PATCH 0904/1507] CMake: Make qtwaylandscanner depend on QtCore only It doesn't use any Gui classes at the moment. It also ensures a target dependency cycle is not created on the default_qpa_plugins custom target when the QT_QPA_DEFAULT_PLATFORM cache var is set to 'wayland'. Change-Id: I8958e5b993ad40294abf49f633d1ef31b6c633bb Reviewed-by: David Edmundson --- src/tools/qtwaylandscanner/.prev_CMakeLists.txt | 2 -- src/tools/qtwaylandscanner/CMakeLists.txt | 2 -- src/tools/qtwaylandscanner/qtwaylandscanner.pro | 1 + 3 files changed, 1 insertion(+), 4 deletions(-) diff --git a/src/tools/qtwaylandscanner/.prev_CMakeLists.txt b/src/tools/qtwaylandscanner/.prev_CMakeLists.txt index c4c3c5a8a8a..156ef030ead 100644 --- a/src/tools/qtwaylandscanner/.prev_CMakeLists.txt +++ b/src/tools/qtwaylandscanner/.prev_CMakeLists.txt @@ -8,8 +8,6 @@ qt_get_tool_target_name(target_name qtwaylandscanner) qt_internal_add_tool(${target_name} SOURCES qtwaylandscanner.cpp - PUBLIC_LIBRARIES - Qt::Gui ) #### Keys ignored in scope 1:.:.:qtwaylandscanner.pro:: diff --git a/src/tools/qtwaylandscanner/CMakeLists.txt b/src/tools/qtwaylandscanner/CMakeLists.txt index 0d16bc85850..d18710b4232 100644 --- a/src/tools/qtwaylandscanner/CMakeLists.txt +++ b/src/tools/qtwaylandscanner/CMakeLists.txt @@ -9,8 +9,6 @@ qt_internal_add_tool(${target_name} TOOLS_TARGET WaylandScanner # special case SOURCES qtwaylandscanner.cpp - PUBLIC_LIBRARIES - Qt::Gui ) #### Keys ignored in scope 1:.:.:qtwaylandscanner.pro:: diff --git a/src/tools/qtwaylandscanner/qtwaylandscanner.pro b/src/tools/qtwaylandscanner/qtwaylandscanner.pro index ac2d07b7657..cad7bbfb6a1 100644 --- a/src/tools/qtwaylandscanner/qtwaylandscanner.pro +++ b/src/tools/qtwaylandscanner/qtwaylandscanner.pro @@ -1,6 +1,7 @@ option(host_build) SOURCES += qtwaylandscanner.cpp +QT = core load(qt_tool) From afe107fb1300c34d5282ecc26dfe65aa85dc1d22 Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Mon, 26 Oct 2020 12:08:12 +0100 Subject: [PATCH 0905/1507] CMake: Add versionless function names Task-number: QTBUG-86827 Change-Id: I4b1931ca63c3d589c8167d04a1cd3712f8ba30d6 Reviewed-by: Joerg Bornemann --- src/tools/qtwaylandscanner/Qt6WaylandClientMacros.cmake | 5 +++++ src/tools/qtwaylandscanner/Qt6WaylandCompositorMacros.cmake | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/src/tools/qtwaylandscanner/Qt6WaylandClientMacros.cmake b/src/tools/qtwaylandscanner/Qt6WaylandClientMacros.cmake index eb566f63a38..89430b2427e 100644 --- a/src/tools/qtwaylandscanner/Qt6WaylandClientMacros.cmake +++ b/src/tools/qtwaylandscanner/Qt6WaylandClientMacros.cmake @@ -69,3 +69,8 @@ function(qt6_generate_wayland_protocol_client_sources target) target_include_directories(${target} PRIVATE ${target_binary_dir}) endfunction() +if(NOT QT_NO_CREATE_VERSIONLESS_FUNCTIONS) + function(qt_generate_wayland_protocol_client_sources) + qt6_generate_wayland_protocol_client_sources(${ARGV}) + endfunction() +endif() diff --git a/src/tools/qtwaylandscanner/Qt6WaylandCompositorMacros.cmake b/src/tools/qtwaylandscanner/Qt6WaylandCompositorMacros.cmake index 0350efdda32..4e25916d469 100644 --- a/src/tools/qtwaylandscanner/Qt6WaylandCompositorMacros.cmake +++ b/src/tools/qtwaylandscanner/Qt6WaylandCompositorMacros.cmake @@ -56,3 +56,8 @@ function(qt6_generate_wayland_protocol_server_sources target) target_include_directories(${target} PRIVATE ${target_binary_dir}) endfunction() +if(NOT QT_NO_CREATE_VERSIONLESS_FUNCTIONS) + function(qt_generate_wayland_protocol_server_sources) + qt6_generate_wayland_protocol_server_sources(${ARGV}) + endfunction() +endif() From edbc9697b6a0dbaebff9bd70e6016668b670ca63 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Fri, 30 Oct 2020 07:42:17 +0100 Subject: [PATCH 0906/1507] Stop depending on private API in user-facing cmake code The qt_parse_all_arguments() macro is not available as part of the public API, but it was used to generate code for extensions, which users need to be able to do. The result was that top-level builds would work because they could access the functions, but when our examples were built as stand-alone, it failed to find the function. The fix is just to copy-paste the contents of the macro. Fixes: QTBUG-87445 Fixes: QTBUG-87446 Change-Id: Id5a583358be4163d3cdab72d7c23804f66f45500 Reviewed-by: Alexandru Croitor --- src/tools/qtwaylandscanner/Qt6WaylandClientMacros.cmake | 6 +++++- src/tools/qtwaylandscanner/Qt6WaylandCompositorMacros.cmake | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/tools/qtwaylandscanner/Qt6WaylandClientMacros.cmake b/src/tools/qtwaylandscanner/Qt6WaylandClientMacros.cmake index 89430b2427e..408cf237965 100644 --- a/src/tools/qtwaylandscanner/Qt6WaylandClientMacros.cmake +++ b/src/tools/qtwaylandscanner/Qt6WaylandClientMacros.cmake @@ -1,5 +1,9 @@ function(qt6_generate_wayland_protocol_client_sources target) - qt_parse_all_arguments(arg "qt6_generate_wayland_protocol_client_sources" "" "" "FILES" ${ARGN}) + cmake_parse_arguments(arg "" "" "FILES" ${ARGN}) + if(DEFINED arg_UNPARSED_ARGUMENTS) + message(FATAL_ERROR "Unknown arguments were passed to qt6_generate_wayland_protocol_client_sources: (${arg_UNPARSED_ARGUMENTS}).") + endif() + get_target_property(target_binary_dir ${target} BINARY_DIR) if(NOT TARGET Wayland::Scanner) diff --git a/src/tools/qtwaylandscanner/Qt6WaylandCompositorMacros.cmake b/src/tools/qtwaylandscanner/Qt6WaylandCompositorMacros.cmake index 4e25916d469..51edbb319cd 100644 --- a/src/tools/qtwaylandscanner/Qt6WaylandCompositorMacros.cmake +++ b/src/tools/qtwaylandscanner/Qt6WaylandCompositorMacros.cmake @@ -1,5 +1,9 @@ function(qt6_generate_wayland_protocol_server_sources target) - qt_parse_all_arguments(arg "qt6_generate_wayland_protocol_server_sources" "" "" "FILES" ${ARGN}) + cmake_parse_arguments(arg "" "" "FILES" ${ARGN}) + if(DEFINED arg_UNPARSED_ARGUMENTS) + message(FATAL_ERROR "Unknown arguments were passed to qt6_generate_wayland_protocol_server_sources: (${arg_UNPARSED_ARGUMENTS}).") + endif() + get_target_property(target_binary_dir ${target} BINARY_DIR) if(NOT TARGET Wayland::Scanner) From 19281f9c3ba64adf1b6ffce88bd8da3da28beb1c Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Mon, 7 Sep 2020 14:17:53 +0100 Subject: [PATCH 0907/1507] Client: Drop XdgShellV5 and XdgShellV6 Both of these are deprecated given this is now formalised as the final xdg-wm-base. This final release has been out for several years and all main compositors (kwin, sway, mutter) have dropped or are dropping legacy support. tst_nooutput is moved to stable XdgShell. Change-Id: I46a011502dfec6d4a215c3b22d03e8ceebed46c3 Reviewed-by: Eskil Abrahamsen Blomfeldt --- .../wayland/protocols/qt_attribution.json | 2 +- .../protocols/xdg-shell-unstable-v5.xml | 623 --------- src/plugins/platforms/wayland/configure.cmake | 8 - src/plugins/platforms/wayland/configure.json | 12 - .../plugins/shellintegration/CMakeLists.txt | 6 - .../shellintegration/shellintegration.pro | 2 - .../wl-shell/qwaylandwlshellintegration.cpp | 2 +- .../xdg-shell-v5/CMakeLists.txt | 38 - .../shellintegration/xdg-shell-v5/main.cpp | 69 - .../pregenerated/3rdparty/.gitignore | 3 - .../qwayland-xdg-shell-unstable-v5.cpp | 399 ------ .../qwayland-xdg-shell-unstable-v5_p.h | 200 --- ...-xdg-shell-unstable-v5-client-protocol_p.h | 1119 ----------------- .../wayland-xdg-shell-unstable-v5-protocol.c | 126 -- .../pregenerated/xdg-shell-v5.pri | 12 - .../xdg-shell-v5/qwaylandxdgpopupv5.cpp | 72 -- .../xdg-shell-v5/qwaylandxdgpopupv5_p.h | 88 -- .../xdg-shell-v5/qwaylandxdgshellv5.cpp | 104 -- .../xdg-shell-v5/qwaylandxdgshellv5_p.h | 93 -- .../qwaylandxdgshellv5integration.cpp | 97 -- .../qwaylandxdgshellv5integration_p.h | 80 -- .../xdg-shell-v5/qwaylandxdgsurfacev5.cpp | 246 ---- .../xdg-shell-v5/qwaylandxdgsurfacev5_p.h | 131 -- .../xdg-shell-v5/xdg-shell-v5.json | 3 - .../xdg-shell-v5/xdg-shell-v5.pro | 29 - .../xdg-shell-v6/CMakeLists.txt | 36 - .../shellintegration/xdg-shell-v6/main.cpp | 68 - .../xdg-shell-v6/qwaylandxdgshellv6.cpp | 441 ------- .../xdg-shell-v6/qwaylandxdgshellv6_p.h | 173 --- .../qwaylandxdgshellv6integration.cpp | 87 -- .../qwaylandxdgshellv6integration_p.h | 78 -- .../xdg-shell-v6/xdg-shell-v6.json | 3 - .../xdg-shell-v6/xdg-shell-v6.pro | 25 - .../platforms/wayland/qwaylandintegration.cpp | 7 - tests/auto/wayland/CMakeLists.txt | 1 - tests/auto/wayland/client.pro | 3 +- .../auto/wayland/client/.prev_CMakeLists.txt | 3 +- tests/auto/wayland/client/CMakeLists.txt | 3 +- .../wayland/client/run-with-all-shells.sh | 1 - tests/auto/wayland/client/tst_client.cpp | 4 - .../fullscreenshellv1/.prev_CMakeLists.txt | 3 +- .../wayland/fullscreenshellv1/CMakeLists.txt | 3 +- .../iviapplication/.prev_CMakeLists.txt | 3 +- tests/auto/wayland/nooutput/tst_nooutput.cpp | 13 +- .../wayland/shared_old/mockcompositor.cpp | 36 - .../auto/wayland/shared_old/mockcompositor.h | 35 - tests/auto/wayland/shared_old/mocksurface.cpp | 14 +- tests/auto/wayland/shared_old/mocksurface.h | 5 - .../wayland/shared_old/mockxdgshellv6.cpp | 145 --- .../auto/wayland/shared_old/mockxdgshellv6.h | 114 -- tests/auto/wayland/shared_old/shared_old.pri | 4 +- .../wayland/xdgshellv6/.prev_CMakeLists.txt | 37 - tests/auto/wayland/xdgshellv6/CMakeLists.txt | 38 - .../wayland/xdgshellv6/tst_xdgshellv6.cpp | 445 ------- tests/auto/wayland/xdgshellv6/xdgshellv6.pro | 5 - 55 files changed, 21 insertions(+), 5376 deletions(-) delete mode 100644 src/3rdparty/wayland/protocols/xdg-shell-unstable-v5.xml delete mode 100644 src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/CMakeLists.txt delete mode 100644 src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/main.cpp delete mode 100644 src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/pregenerated/3rdparty/.gitignore delete mode 100644 src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/pregenerated/3rdparty/qwayland-xdg-shell-unstable-v5.cpp delete mode 100644 src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/pregenerated/3rdparty/qwayland-xdg-shell-unstable-v5_p.h delete mode 100644 src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/pregenerated/3rdparty/wayland-xdg-shell-unstable-v5-client-protocol_p.h delete mode 100644 src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/pregenerated/3rdparty/wayland-xdg-shell-unstable-v5-protocol.c delete mode 100644 src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/pregenerated/xdg-shell-v5.pri delete mode 100644 src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgpopupv5.cpp delete mode 100644 src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgpopupv5_p.h delete mode 100644 src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshellv5.cpp delete mode 100644 src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshellv5_p.h delete mode 100644 src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshellv5integration.cpp delete mode 100644 src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshellv5integration_p.h delete mode 100644 src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgsurfacev5.cpp delete mode 100644 src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgsurfacev5_p.h delete mode 100644 src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/xdg-shell-v5.json delete mode 100644 src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/xdg-shell-v5.pro delete mode 100644 src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/CMakeLists.txt delete mode 100644 src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/main.cpp delete mode 100644 src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp delete mode 100644 src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6_p.h delete mode 100644 src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6integration.cpp delete mode 100644 src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6integration_p.h delete mode 100644 src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/xdg-shell-v6.json delete mode 100644 src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/xdg-shell-v6.pro delete mode 100644 tests/auto/wayland/shared_old/mockxdgshellv6.cpp delete mode 100644 tests/auto/wayland/shared_old/mockxdgshellv6.h delete mode 100644 tests/auto/wayland/xdgshellv6/.prev_CMakeLists.txt delete mode 100644 tests/auto/wayland/xdgshellv6/CMakeLists.txt delete mode 100644 tests/auto/wayland/xdgshellv6/tst_xdgshellv6.cpp delete mode 100644 tests/auto/wayland/xdgshellv6/xdgshellv6.pro diff --git a/src/3rdparty/wayland/protocols/qt_attribution.json b/src/3rdparty/wayland/protocols/qt_attribution.json index c5d2058d083..df48fa4e4e6 100644 --- a/src/3rdparty/wayland/protocols/qt_attribution.json +++ b/src/3rdparty/wayland/protocols/qt_attribution.json @@ -157,7 +157,7 @@ "Name": "Wayland XDG Shell Protocol", "QDocModule": "qtwaylandcompositor", "QtUsage": "Used in the Qt Wayland Compositor, and the Qt Wayland platform plugin.", - "Files": " xdg-shell-unstable-v5.xml xdg-shell-unstable-v6.xml xdg-shell.xml ../../plugins/shellintegration/xdg-shell-v5/pregenerated/3rdparty/qwayland-xdg-shell-unstable-v5.cpp ../../plugins/shellintegration/xdg-shell-v5/pregenerated/3rdparty/qwayland-xdg-shell-unstable-v5_p.h ../../plugins/shellintegration/xdg-shell-v5/pregenerated/3rdparty/wayland-xdg-shell-unstable-v5-client-protocol_p.h ../../plugins/shellintegration/xdg-shell-v5/pregenerated/3rdparty/wayland-xdg-shell-unstable-v5-protocol.c", + "Files": "xdg-shell.xml", "Description": "The XDG-Shell protocol is an extended way to manage surfaces under Wayland compositors.", "Homepage": "https://gitlab.freedesktop.org/wayland/wayland-protocols/", diff --git a/src/3rdparty/wayland/protocols/xdg-shell-unstable-v5.xml b/src/3rdparty/wayland/protocols/xdg-shell-unstable-v5.xml deleted file mode 100644 index ef0180d0107..00000000000 --- a/src/3rdparty/wayland/protocols/xdg-shell-unstable-v5.xml +++ /dev/null @@ -1,623 +0,0 @@ - - - - - Copyright © 2008-2013 Kristian Høgsberg - Copyright © 2013 Rafael Antognolli - Copyright © 2013 Jasper St. Pierre - Copyright © 2010-2013 Intel Corporation - - 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. - - - - - xdg_shell allows clients to turn a wl_surface into a "real window" - which can be dragged, resized, stacked, and moved around by the - user. Everything about this interface is suited towards traditional - desktop environments. - - - - - The 'current' member of this enum gives the version of the - protocol. Implementations can compare this to the version - they implement using static_assert to ensure the protocol and - implementation versions match. - - - - - - - - - - - - - - Destroy this xdg_shell object. - - Destroying a bound xdg_shell object while there are surfaces - still alive created by this xdg_shell object instance is illegal - and will result in a protocol error. - - - - - - Negotiate the unstable version of the interface. This - mechanism is in place to ensure client and server agree on the - unstable versions of the protocol that they speak or exit - cleanly if they don't agree. This request will go away once - the xdg-shell protocol is stable. - - - - - - - This creates an xdg_surface for the given surface and gives it the - xdg_surface role. A wl_surface can only be given an xdg_surface role - once. If get_xdg_surface is called with a wl_surface that already has - an active xdg_surface associated with it, or if it had any other role, - an error is raised. - - See the documentation of xdg_surface for more details about what an - xdg_surface is and how it is used. - - - - - - - - This creates an xdg_popup for the given surface and gives it the - xdg_popup role. A wl_surface can only be given an xdg_popup role - once. If get_xdg_popup is called with a wl_surface that already has - an active xdg_popup associated with it, or if it had any other role, - an error is raised. - - This request must be used in response to some sort of user action - like a button press, key press, or touch down event. - - See the documentation of xdg_popup for more details about what an - xdg_popup is and how it is used. - - - - - - - - - - - - - The ping event asks the client if it's still alive. Pass the - serial specified in the event back to the compositor by sending - a "pong" request back with the specified serial. - - Compositors can use this to determine if the client is still - alive. It's unspecified what will happen if the client doesn't - respond to the ping request, or in what timeframe. Clients should - try to respond in a reasonable amount of time. - - A compositor is free to ping in any way it wants, but a client must - always respond to any xdg_shell object it created. - - - - - - - A client must respond to a ping event with a pong request or - the client may be deemed unresponsive. - - - - - - - - An interface that may be implemented by a wl_surface, for - implementations that provide a desktop-style user interface. - - It provides requests to treat surfaces like windows, allowing to set - properties like maximized, fullscreen, minimized, and to move and resize - them, and associate metadata like title and app id. - - The client must call wl_surface.commit on the corresponding wl_surface - for the xdg_surface state to take effect. Prior to committing the new - state, it can set up initial configuration, such as maximizing or setting - a window geometry. - - Even without attaching a buffer the compositor must respond to initial - committed configuration, for instance sending a configure event with - expected window geometry if the client maximized its surface during - initialization. - - For a surface to be mapped by the compositor the client must have - committed both an xdg_surface state and a buffer. - - - - - Unmap and destroy the window. The window will be effectively - hidden from the user's point of view, and all state like - maximization, fullscreen, and so on, will be lost. - - - - - - Set the "parent" of this surface. This window should be stacked - above a parent. The parent surface must be mapped as long as this - surface is mapped. - - Parent windows should be set on dialogs, toolboxes, or other - "auxiliary" surfaces, so that the parent is raised when the dialog - is raised. - - - - - - - Set a short title for the surface. - - This string may be used to identify the surface in a task bar, - window list, or other user interface elements provided by the - compositor. - - The string must be encoded in UTF-8. - - - - - - - Set an application identifier for the surface. - - The app ID identifies the general class of applications to which - the surface belongs. The compositor can use this to group multiple - surfaces together, or to determine how to launch a new application. - - For D-Bus activatable applications, the app ID is used as the D-Bus - service name. - - The compositor shell will try to group application surfaces together - by their app ID. As a best practice, it is suggested to select app - ID's that match the basename of the application's .desktop file. - For example, "org.freedesktop.FooViewer" where the .desktop file is - "org.freedesktop.FooViewer.desktop". - - See the desktop-entry specification [0] for more details on - application identifiers and how they relate to well-known D-Bus - names and .desktop files. - - [0] http://standards.freedesktop.org/desktop-entry-spec/ - - - - - - - Clients implementing client-side decorations might want to show - a context menu when right-clicking on the decorations, giving the - user a menu that they can use to maximize or minimize the window. - - This request asks the compositor to pop up such a window menu at - the given position, relative to the local surface coordinates of - the parent surface. There are no guarantees as to what menu items - the window menu contains. - - This request must be used in response to some sort of user action - like a button press, key press, or touch down event. - - - - - - - - - - Start an interactive, user-driven move of the surface. - - This request must be used in response to some sort of user action - like a button press, key press, or touch down event. The passed - serial is used to determine the type of interactive move (touch, - pointer, etc). - - The server may ignore move requests depending on the state of - the surface (e.g. fullscreen or maximized), or if the passed serial - is no longer valid. - - If triggered, the surface will lose the focus of the device - (wl_pointer, wl_touch, etc) used for the move. It is up to the - compositor to visually indicate that the move is taking place, such as - updating a pointer cursor, during the move. There is no guarantee - that the device focus will return when the move is completed. - - - - - - - - These values are used to indicate which edge of a surface - is being dragged in a resize operation. - - - - - - - - - - - - - - - Start a user-driven, interactive resize of the surface. - - This request must be used in response to some sort of user action - like a button press, key press, or touch down event. The passed - serial is used to determine the type of interactive resize (touch, - pointer, etc). - - The server may ignore resize requests depending on the state of - the surface (e.g. fullscreen or maximized). - - If triggered, the client will receive configure events with the - "resize" state enum value and the expected sizes. See the "resize" - enum value for more details about what is required. The client - must also acknowledge configure events using "ack_configure". After - the resize is completed, the client will receive another "configure" - event without the resize state. - - If triggered, the surface also will lose the focus of the device - (wl_pointer, wl_touch, etc) used for the resize. It is up to the - compositor to visually indicate that the resize is taking place, - such as updating a pointer cursor, during the resize. There is no - guarantee that the device focus will return when the resize is - completed. - - The edges parameter specifies how the surface should be resized, - and is one of the values of the resize_edge enum. The compositor - may use this information to update the surface position for - example when dragging the top left corner. The compositor may also - use this information to adapt its behavior, e.g. choose an - appropriate cursor image. - - - - - - - - - The different state values used on the surface. This is designed for - state values like maximized, fullscreen. It is paired with the - configure event to ensure that both the client and the compositor - setting the state can be synchronized. - - States set in this way are double-buffered. They will get applied on - the next commit. - - Desktop environments may extend this enum by taking up a range of - values and documenting the range they chose in this description. - They are not required to document the values for the range that they - chose. Ideally, any good extensions from a desktop environment should - make its way into standardization into this enum. - - The current reserved ranges are: - - 0x0000 - 0x0FFF: xdg-shell core values, documented below. - 0x1000 - 0x1FFF: GNOME - 0x2000 - 0x2FFF: EFL - - - - The surface is maximized. The window geometry specified in the configure - event must be obeyed by the client. - - - - - The surface is fullscreen. The window geometry specified in the configure - event must be obeyed by the client. - - - - - The surface is being resized. The window geometry specified in the - configure event is a maximum; the client cannot resize beyond it. - Clients that have aspect ratio or cell sizing configuration can use - a smaller size, however. - - - - - Client window decorations should be painted as if the window is - active. Do not assume this means that the window actually has - keyboard or pointer focus. - - - - - - - The configure event asks the client to resize its surface or to - change its state. - - The width and height arguments specify a hint to the window - about how its surface should be resized in window geometry - coordinates. See set_window_geometry. - - If the width or height arguments are zero, it means the client - should decide its own window dimension. This may happen when the - compositor need to configure the state of the surface but doesn't - have any information about any previous or expected dimension. - - The states listed in the event specify how the width/height - arguments should be interpreted, and possibly how it should be - drawn. - - Clients should arrange their surface for the new size and - states, and then send a ack_configure request with the serial - sent in this configure event at some point before committing - the new surface. - - If the client receives multiple configure events before it - can respond to one, it is free to discard all but the last - event it received. - - - - - - - - - - When a configure event is received, if a client commits the - surface in response to the configure event, then the client - must make an ack_configure request sometime before the commit - request, passing along the serial of the configure event. - - For instance, the compositor might use this information to move - a surface to the top left only when the client has drawn itself - for the maximized or fullscreen state. - - If the client receives multiple configure events before it - can respond to one, it only has to ack the last configure event. - - A client is not required to commit immediately after sending - an ack_configure request - it may even ack_configure several times - before its next surface commit. - - The compositor expects that the most recently received - ack_configure request at the time of a commit indicates which - configure event the client is responding to. - - - - - - - The window geometry of a window is its "visible bounds" from the - user's perspective. Client-side decorations often have invisible - portions like drop-shadows which should be ignored for the - purposes of aligning, placing and constraining windows. - - The window geometry is double buffered, and will be applied at the - time wl_surface.commit of the corresponding wl_surface is called. - - Once the window geometry of the surface is set once, it is not - possible to unset it, and it will remain the same until - set_window_geometry is called again, even if a new subsurface or - buffer is attached. - - If never set, the value is the full bounds of the surface, - including any subsurfaces. This updates dynamically on every - commit. This unset mode is meant for extremely simple clients. - - If responding to a configure event, the window geometry in here - must respect the sizing negotiations specified by the states in - the configure event. - - The arguments are given in the surface local coordinate space of - the wl_surface associated with this xdg_surface. - - The width and height must be greater than zero. - - - - - - - - - - Maximize the surface. - - After requesting that the surface should be maximized, the compositor - will respond by emitting a configure event with the "maximized" state - and the required window geometry. The client should then update its - content, drawing it in a maximized state, i.e. without shadow or other - decoration outside of the window geometry. The client must also - acknowledge the configure when committing the new content (see - ack_configure). - - It is up to the compositor to decide how and where to maximize the - surface, for example which output and what region of the screen should - be used. - - If the surface was already maximized, the compositor will still emit - a configure event with the "maximized" state. - - - - - - Unmaximize the surface. - - After requesting that the surface should be unmaximized, the compositor - will respond by emitting a configure event without the "maximized" - state. If available, the compositor will include the window geometry - dimensions the window had prior to being maximized in the configure - request. The client must then update its content, drawing it in a - regular state, i.e. potentially with shadow, etc. The client must also - acknowledge the configure when committing the new content (see - ack_configure). - - It is up to the compositor to position the surface after it was - unmaximized; usually the position the surface had before maximizing, if - applicable. - - If the surface was already not maximized, the compositor will still - emit a configure event without the "maximized" state. - - - - - - Make the surface fullscreen. - - You can specify an output that you would prefer to be fullscreen. - If this value is NULL, it's up to the compositor to choose which - display will be used to map this surface. - - If the surface doesn't cover the whole output, the compositor will - position the surface in the center of the output and compensate with - black borders filling the rest of the output. - - - - - - - - Request that the compositor minimize your surface. There is no - way to know if the surface is currently minimized, nor is there - any way to unset minimization on this surface. - - If you are looking to throttle redrawing when minimized, please - instead use the wl_surface.frame event for this, as this will - also work with live previews on windows in Alt-Tab, Expose or - similar compositor features. - - - - - - The close event is sent by the compositor when the user - wants the surface to be closed. This should be equivalent to - the user clicking the close button in client-side decorations, - if your application has any... - - This is only a request that the user intends to close your - window. The client may choose to ignore this request, or show - a dialog to ask the user to save their data... - - - - - - - A popup surface is a short-lived, temporary surface that can be - used to implement menus. It takes an explicit grab on the surface - that will be dismissed when the user dismisses the popup. This can - be done by the user clicking outside the surface, using the keyboard, - or even locking the screen through closing the lid or a timeout. - - When the popup is dismissed, a popup_done event will be sent out, - and at the same time the surface will be unmapped. The xdg_popup - object is now inert and cannot be reactivated, so clients should - destroy it. Explicitly destroying the xdg_popup object will also - dismiss the popup and unmap the surface. - - Clients will receive events for all their surfaces during this - grab (which is an "owner-events" grab in X11 parlance). This is - done so that users can navigate through submenus and other - "nested" popup windows without having to dismiss the topmost - popup. - - Clients that want to dismiss the popup when another surface of - their own is clicked should dismiss the popup using the destroy - request. - - The parent surface must have either an xdg_surface or xdg_popup - role. - - Specifying an xdg_popup for the parent means that the popups are - nested, with this popup now being the topmost popup. Nested - popups must be destroyed in the reverse order they were created - in, e.g. the only popup you are allowed to destroy at all times - is the topmost one. - - If there is an existing popup when creating a new popup, the - parent must be the current topmost popup. - - A parent surface must be mapped before the new popup is mapped. - - When compositors choose to dismiss a popup, they will likely - dismiss every nested popup as well. When a compositor dismisses - popups, it will follow the same dismissing order as required - from the client. - - The x and y arguments passed when creating the popup object specify - where the top left of the popup should be placed, relative to the - local surface coordinates of the parent surface. See - xdg_shell.get_xdg_popup. - - The client must call wl_surface.commit on the corresponding wl_surface - for the xdg_popup state to take effect. - - For a surface to be mapped by the compositor the client must have - committed both the xdg_popup state and a buffer. - - - - - This destroys the popup. Explicitly destroying the xdg_popup - object will also dismiss the popup, and unmap the surface. - - If this xdg_popup is not the "topmost" popup, a protocol error - will be sent. - - - - - - The popup_done event is sent out when a popup is dismissed by the - compositor. The client should destroy the xdg_popup object at this - point. - - - - - diff --git a/src/plugins/platforms/wayland/configure.cmake b/src/plugins/platforms/wayland/configure.cmake index 201f5d46290..ba87484be6e 100644 --- a/src/plugins/platforms/wayland/configure.cmake +++ b/src/plugins/platforms/wayland/configure.cmake @@ -182,14 +182,6 @@ qt_feature("wayland-client-xdg-shell" PRIVATE LABEL "xdg-shell" CONDITION QT_FEATURE_wayland_client ) -qt_feature("wayland-client-xdg-shell-v5" PRIVATE - LABEL "xdg-shell unstable v5 (deprecated)" - CONDITION QT_FEATURE_wayland_client -) -qt_feature("wayland-client-xdg-shell-v6" PRIVATE - LABEL "xdg-shell unstable v6" - CONDITION QT_FEATURE_wayland_client -) qt_feature("egl-extension-platform-wayland" PRIVATE LABEL "EGL wayland platform extension" CONDITION QT_FEATURE_wayland_client AND QT_FEATURE_opengl AND QT_FEATURE_egl AND TEST_egl_1_5_wayland diff --git a/src/plugins/platforms/wayland/configure.json b/src/plugins/platforms/wayland/configure.json index e4ac68f46b9..0aa44eda6c7 100644 --- a/src/plugins/platforms/wayland/configure.json +++ b/src/plugins/platforms/wayland/configure.json @@ -207,16 +207,6 @@ "condition": "features.wayland-client", "output": [ "privateFeature" ] }, - "wayland-client-xdg-shell-v5": { - "label": "xdg-shell unstable v5 (deprecated)", - "condition": "features.wayland-client", - "output": [ "privateFeature" ] - }, - "wayland-client-xdg-shell-v6": { - "label": "xdg-shell unstable v6", - "condition": "features.wayland-client", - "output": [ "privateFeature" ] - }, "egl-extension-platform-wayland": { "label": "EGL wayland platform extension", "condition": "features.wayland-client && features.opengl && features.egl && tests.egl_1_5-wayland", @@ -298,8 +288,6 @@ "condition": "features.wayland-client", "entries": [ "wayland-client-xdg-shell", - "wayland-client-xdg-shell-v5", - "wayland-client-xdg-shell-v6", "wayland-client-ivi-shell", "wayland-client-wl-shell" ] diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/shellintegration/CMakeLists.txt index 03364328c25..fef15fe798e 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/CMakeLists.txt +++ b/src/plugins/platforms/wayland/plugins/shellintegration/CMakeLists.txt @@ -12,9 +12,3 @@ endif() if(QT_FEATURE_wayland_client_xdg_shell) add_subdirectory(xdg-shell) endif() -if(QT_FEATURE_wayland_client_xdg_shell_v5) - add_subdirectory(xdg-shell-v5) -endif() -if(QT_FEATURE_wayland_client_xdg_shell_v6) - add_subdirectory(xdg-shell-v6) -endif() diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/shellintegration.pro b/src/plugins/platforms/wayland/plugins/shellintegration/shellintegration.pro index 39c57940aff..8cfad2d4f81 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/shellintegration.pro +++ b/src/plugins/platforms/wayland/plugins/shellintegration/shellintegration.pro @@ -5,5 +5,3 @@ qtConfig(wayland-client-fullscreen-shell-v1): SUBDIRS += fullscreen-shell-v1 qtConfig(wayland-client-ivi-shell): SUBDIRS += ivi-shell qtConfig(wayland-client-wl-shell): SUBDIRS += wl-shell qtConfig(wayland-client-xdg-shell): SUBDIRS += xdg-shell -qtConfig(wayland-client-xdg-shell-v5): SUBDIRS += xdg-shell-v5 -qtConfig(wayland-client-xdg-shell-v6): SUBDIRS += xdg-shell-v6 diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellintegration.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellintegration.cpp index ab809806241..354ee19b886 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellintegration.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellintegration.cpp @@ -63,7 +63,7 @@ bool QWaylandWlShellIntegration::initialize(QWaylandDisplay *display) } qCWarning(lcQpaWayland) << "\"wl-shell\" is a deprecated shell extension, prefer using" - << "\"xdg-shell-v6\" or \"xdg-shell\" if supported by the compositor" + << "\"xdg-shell\" if supported by the compositor" << "by setting the environment variable QT_WAYLAND_SHELL_INTEGRATION"; return QWaylandShellIntegration::initialize(display); diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/CMakeLists.txt deleted file mode 100644 index 25bd0ca7210..00000000000 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/CMakeLists.txt +++ /dev/null @@ -1,38 +0,0 @@ -# Generated from xdg-shell-v5.pro. - -##################################################################### -## QWaylandXdgShellV5IntegrationPlugin Plugin: -##################################################################### - -qt_internal_add_plugin(QWaylandXdgShellV5IntegrationPlugin - OUTPUT_NAME xdg-shell-v5 - TYPE wayland-shell-integration - SOURCES - main.cpp - pregenerated/3rdparty/qwayland-xdg-shell-unstable-v5.cpp pregenerated/3rdparty/qwayland-xdg-shell-unstable-v5_p.h - pregenerated/3rdparty/wayland-xdg-shell-unstable-v5-client-protocol_p.h - pregenerated/3rdparty/wayland-xdg-shell-unstable-v5-protocol.c - qwaylandxdgpopupv5.cpp qwaylandxdgpopupv5_p.h - qwaylandxdgshellv5.cpp qwaylandxdgshellv5_p.h - qwaylandxdgshellv5integration.cpp qwaylandxdgshellv5integration_p.h - qwaylandxdgsurfacev5.cpp qwaylandxdgsurfacev5_p.h - INCLUDE_DIRECTORIES - pregenerated/3rdparty - PUBLIC_LIBRARIES - Qt::Core - Qt::Gui - Qt::GuiPrivate - Qt::WaylandClientPrivate - Wayland::Client -) - -#### Keys ignored in scope 1:.:.:xdg-shell-v5.pro:: -# OTHER_FILES = "xdg-shell-v5.json" - -## Scopes: -##################################################################### - -qt_internal_extend_target(QWaylandXdgShellV5IntegrationPlugin CONDITION QT_FEATURE_xkbcommon - PUBLIC_LIBRARIES - XKB::XKB -) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/main.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/main.cpp deleted file mode 100644 index d365f682d08..00000000000 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/main.cpp +++ /dev/null @@ -1,69 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2018 The Qt Company Ltd. -** Copyright (C) 2017 ITAGE Corporation, author: -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qwaylandxdgshellv5integration_p.h" - -#include - -QT_BEGIN_NAMESPACE - -namespace QtWaylandClient { - -class QWaylandXdgShellV5IntegrationPlugin : public QWaylandShellIntegrationPlugin -{ - Q_OBJECT - Q_PLUGIN_METADATA(IID QWaylandShellIntegrationFactoryInterface_iid FILE "xdg-shell-v5.json") - -public: - QWaylandShellIntegration *create(const QString &key, const QStringList ¶mList) override; -}; - -QWaylandShellIntegration *QWaylandXdgShellV5IntegrationPlugin::create(const QString &key, const QStringList ¶mList) -{ - Q_UNUSED(key); - Q_UNUSED(paramList); - return new QWaylandXdgShellV5Integration(); -} - -} - -QT_END_NAMESPACE - -#include "main.moc" diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/pregenerated/3rdparty/.gitignore b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/pregenerated/3rdparty/.gitignore deleted file mode 100644 index 6a2d3c20777..00000000000 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/pregenerated/3rdparty/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -!qwayland-*.cpp -!qwayland-*.h -!wayland-*-protocol.c diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/pregenerated/3rdparty/qwayland-xdg-shell-unstable-v5.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/pregenerated/3rdparty/qwayland-xdg-shell-unstable-v5.cpp deleted file mode 100644 index 51979acf77c..00000000000 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/pregenerated/3rdparty/qwayland-xdg-shell-unstable-v5.cpp +++ /dev/null @@ -1,399 +0,0 @@ -// Hand-edited to resolve conflicts with xdg-shell stable -/* - * Copyright © 2008-2013 Kristian Høgsberg - * Copyright © 2013 Rafael Antognolli - * Copyright © 2013 Jasper St. Pierre - * Copyright © 2010-2013 Intel Corporation - * - * 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 "qwayland-xdg-shell-unstable-v5_p.h" -#include - -QT_BEGIN_NAMESPACE -QT_WARNING_PUSH -QT_WARNING_DISABLE_GCC("-Wmissing-field-initializers") - -namespace QtWayland { - xdg_shell_v5::xdg_shell_v5(struct ::wl_registry *registry, int id, int version) - { - init(registry, id, version); - } - - xdg_shell_v5::xdg_shell_v5(struct ::xdg_shell_v5 *obj) - : m_xdg_shell(obj) - { - init_listener(); - } - - xdg_shell_v5::xdg_shell_v5() - : m_xdg_shell(nullptr) - { - } - - xdg_shell_v5::~xdg_shell_v5() - { - } - - void xdg_shell_v5::init(struct ::wl_registry *registry, int id, int version) - { - m_xdg_shell = static_cast(wl_registry_bind(registry, id, &xdg_shell_v5_interface, version)); - init_listener(); - } - - void xdg_shell_v5::init(struct ::xdg_shell_v5 *obj) - { - m_xdg_shell = obj; - init_listener(); - } - - bool xdg_shell_v5::isInitialized() const - { - return m_xdg_shell != nullptr; - } - - const struct wl_interface *xdg_shell_v5::interface() - { - return &::xdg_shell_v5_interface; - } - - void xdg_shell_v5::destroy() - { - xdg_shell_destroy( - m_xdg_shell); - m_xdg_shell = nullptr; - } - - void xdg_shell_v5::use_unstable_version(int32_t version) - { - xdg_shell_use_unstable_version( - m_xdg_shell, - version); - } - - struct ::xdg_surface_v5 *xdg_shell_v5::get_xdg_surface(struct ::wl_surface *surface) - { - return xdg_shell_get_xdg_surface( - m_xdg_shell, - surface); - } - - struct ::xdg_popup_v5 *xdg_shell_v5::get_xdg_popup(struct ::wl_surface *surface, struct ::wl_surface *parent, struct ::wl_seat *seat, uint32_t serial, int32_t x, int32_t y) - { - return xdg_shell_get_xdg_popup( - m_xdg_shell, - surface, - parent, - seat, - serial, - x, - y); - } - - void xdg_shell_v5::pong(uint32_t serial) - { - xdg_shell_pong( - m_xdg_shell, - serial); - } - - void xdg_shell_v5::xdg_shell_ping(uint32_t ) - { - } - - void xdg_shell_v5::handle_ping( - void *data, - struct ::xdg_shell_v5 *object, - uint32_t serial) - { - Q_UNUSED(object); - static_cast(data)->xdg_shell_ping( - serial); - } - - const struct xdg_shell_listener xdg_shell_v5::m_xdg_shell_listener = { - xdg_shell_v5::handle_ping - }; - - void xdg_shell_v5::init_listener() - { - xdg_shell_add_listener(m_xdg_shell, &m_xdg_shell_listener, this); - } - - xdg_surface_v5::xdg_surface_v5(struct ::wl_registry *registry, int id, int version) - { - init(registry, id, version); - } - - xdg_surface_v5::xdg_surface_v5(struct ::xdg_surface_v5 *obj) - : m_xdg_surface(obj) - { - init_listener(); - } - - xdg_surface_v5::xdg_surface_v5() - : m_xdg_surface(nullptr) - { - } - - xdg_surface_v5::~xdg_surface_v5() - { - } - - void xdg_surface_v5::init(struct ::wl_registry *registry, int id, int version) - { - m_xdg_surface = static_cast(wl_registry_bind(registry, id, &xdg_surface_v5_interface, version)); - init_listener(); - } - - void xdg_surface_v5::init(struct ::xdg_surface_v5 *obj) - { - m_xdg_surface = obj; - init_listener(); - } - - bool xdg_surface_v5::isInitialized() const - { - return m_xdg_surface != nullptr; - } - - const struct wl_interface *xdg_surface_v5::interface() - { - return &::xdg_surface_v5_interface; - } - - void xdg_surface_v5::destroy() - { - xdg_surface_destroy( - m_xdg_surface); - m_xdg_surface = nullptr; - } - - void xdg_surface_v5::set_parent(struct ::xdg_surface_v5 *parent) - { - xdg_surface_set_parent( - m_xdg_surface, - parent); - } - - void xdg_surface_v5::set_title(const QString &title) - { - xdg_surface_set_title( - m_xdg_surface, - title.toUtf8().constData()); - } - - void xdg_surface_v5::set_app_id(const QString &app_id) - { - xdg_surface_set_app_id( - m_xdg_surface, - app_id.toUtf8().constData()); - } - - void xdg_surface_v5::show_window_menu(struct ::wl_seat *seat, uint32_t serial, int32_t x, int32_t y) - { - xdg_surface_show_window_menu( - m_xdg_surface, - seat, - serial, - x, - y); - } - - void xdg_surface_v5::move(struct ::wl_seat *seat, uint32_t serial) - { - xdg_surface_move( - m_xdg_surface, - seat, - serial); - } - - void xdg_surface_v5::resize(struct ::wl_seat *seat, uint32_t serial, uint32_t edges) - { - xdg_surface_resize( - m_xdg_surface, - seat, - serial, - edges); - } - - void xdg_surface_v5::ack_configure(uint32_t serial) - { - xdg_surface_ack_configure( - m_xdg_surface, - serial); - } - - void xdg_surface_v5::set_window_geometry(int32_t x, int32_t y, int32_t width, int32_t height) - { - xdg_surface_set_window_geometry( - m_xdg_surface, - x, - y, - width, - height); - } - - void xdg_surface_v5::set_maximized() - { - xdg_surface_set_maximized( - m_xdg_surface); - } - - void xdg_surface_v5::unset_maximized() - { - xdg_surface_unset_maximized( - m_xdg_surface); - } - - void xdg_surface_v5::set_fullscreen(struct ::wl_output *output) - { - xdg_surface_set_fullscreen( - m_xdg_surface, - output); - } - - void xdg_surface_v5::unset_fullscreen() - { - xdg_surface_unset_fullscreen( - m_xdg_surface); - } - - void xdg_surface_v5::set_minimized() - { - xdg_surface_set_minimized( - m_xdg_surface); - } - - void xdg_surface_v5::xdg_surface_configure(int32_t , int32_t , wl_array *, uint32_t ) - { - } - - void xdg_surface_v5::handle_configure( - void *data, - struct ::xdg_surface_v5 *object, - int32_t width, - int32_t height, - wl_array *states, - uint32_t serial) - { - Q_UNUSED(object); - static_cast(data)->xdg_surface_configure( - width, - height, - states, - serial); - } - - void xdg_surface_v5::xdg_surface_close() - { - } - - void xdg_surface_v5::handle_close( - void *data, - struct ::xdg_surface_v5 *object) - { - Q_UNUSED(object); - static_cast(data)->xdg_surface_close(); - } - - const struct xdg_surface_listener xdg_surface_v5::m_xdg_surface_listener = { - xdg_surface_v5::handle_configure, - xdg_surface_v5::handle_close - }; - - void xdg_surface_v5::init_listener() - { - xdg_surface_add_listener(m_xdg_surface, &m_xdg_surface_listener, this); - } - - xdg_popup_v5::xdg_popup_v5(struct ::wl_registry *registry, int id, int version) - { - init(registry, id, version); - } - - xdg_popup_v5::xdg_popup_v5(struct ::xdg_popup_v5 *obj) - : m_xdg_popup(obj) - { - init_listener(); - } - - xdg_popup_v5::xdg_popup_v5() - : m_xdg_popup(nullptr) - { - } - - xdg_popup_v5::~xdg_popup_v5() - { - } - - void xdg_popup_v5::init(struct ::wl_registry *registry, int id, int version) - { - m_xdg_popup = static_cast(wl_registry_bind(registry, id, &xdg_popup_v5_interface, version)); - init_listener(); - } - - void xdg_popup_v5::init(struct ::xdg_popup_v5 *obj) - { - m_xdg_popup = obj; - init_listener(); - } - - bool xdg_popup_v5::isInitialized() const - { - return m_xdg_popup != nullptr; - } - - const struct wl_interface *xdg_popup_v5::interface() - { - return &::xdg_popup_v5_interface; - } - - void xdg_popup_v5::destroy() - { - xdg_popup_destroy( - m_xdg_popup); - m_xdg_popup = nullptr; - } - - void xdg_popup_v5::xdg_popup_popup_done() - { - } - - void xdg_popup_v5::handle_popup_done( - void *data, - struct ::xdg_popup_v5 *object) - { - Q_UNUSED(object); - static_cast(data)->xdg_popup_popup_done(); - } - - const struct xdg_popup_listener xdg_popup_v5::m_xdg_popup_listener = { - xdg_popup_v5::handle_popup_done - }; - - void xdg_popup_v5::init_listener() - { - xdg_popup_add_listener(m_xdg_popup, &m_xdg_popup_listener, this); - } -} - -QT_WARNING_POP -QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/pregenerated/3rdparty/qwayland-xdg-shell-unstable-v5_p.h b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/pregenerated/3rdparty/qwayland-xdg-shell-unstable-v5_p.h deleted file mode 100644 index 8fb1ea7b86a..00000000000 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/pregenerated/3rdparty/qwayland-xdg-shell-unstable-v5_p.h +++ /dev/null @@ -1,200 +0,0 @@ -// Hand-edited to resolve conflicts with xdg-shell stable -/* - * Copyright © 2008-2013 Kristian Høgsberg - * Copyright © 2013 Rafael Antognolli - * Copyright © 2013 Jasper St. Pierre - * Copyright © 2010-2013 Intel Corporation - * - * 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. - */ -#ifndef QT_WAYLAND_XDG_SHELL_UNSTABLE_V5 -#define QT_WAYLAND_XDG_SHELL_UNSTABLE_V5 - -#include "wayland-xdg-shell-unstable-v5-client-protocol_p.h" -#include -#include - -struct wl_registry; - -QT_BEGIN_NAMESPACE -QT_WARNING_PUSH -QT_WARNING_DISABLE_GCC("-Wmissing-field-initializers") - -namespace QtWayland { - class xdg_shell_v5 - { - public: - xdg_shell_v5(struct ::wl_registry *registry, int id, int version); - xdg_shell_v5(struct ::xdg_shell_v5 *object); - xdg_shell_v5(); - - virtual ~xdg_shell_v5(); - - void init(struct ::wl_registry *registry, int id, int version); - void init(struct ::xdg_shell_v5 *object); - - struct ::xdg_shell_v5 *object() { return m_xdg_shell; } - const struct ::xdg_shell_v5 *object() const { return m_xdg_shell; } - - bool isInitialized() const; - - static const struct ::wl_interface *interface(); - - enum version { - version_current = 5 // Always the latest version - }; - - enum error { - error_role = 0, // given wl_surface has another role - error_defunct_surfaces = 1, // xdg_shell was destroyed before children - error_not_the_topmost_popup = 2, // the client tried to map or destroy a non-topmost popup - error_invalid_popup_parent = 3 // the client specified an invalid popup parent surface - }; - - void destroy(); - void use_unstable_version(int32_t version); - struct ::xdg_surface_v5 *get_xdg_surface(struct ::wl_surface *surface); - struct ::xdg_popup_v5 *get_xdg_popup(struct ::wl_surface *surface, struct ::wl_surface *parent, struct ::wl_seat *seat, uint32_t serial, int32_t x, int32_t y); - void pong(uint32_t serial); - - protected: - virtual void xdg_shell_ping(uint32_t serial); - - private: - void init_listener(); - static const struct xdg_shell_listener m_xdg_shell_listener; - static void handle_ping( - void *data, - struct ::xdg_shell_v5 *object, - uint32_t serial); - struct ::xdg_shell_v5 *m_xdg_shell; - }; - - class xdg_surface_v5 - { - public: - xdg_surface_v5(struct ::wl_registry *registry, int id, int version); - xdg_surface_v5(struct ::xdg_surface_v5 *object); - xdg_surface_v5(); - - virtual ~xdg_surface_v5(); - - void init(struct ::wl_registry *registry, int id, int version); - void init(struct ::xdg_surface_v5 *object); - - struct ::xdg_surface_v5 *object() { return m_xdg_surface; } - const struct ::xdg_surface_v5 *object() const { return m_xdg_surface; } - - bool isInitialized() const; - - static const struct ::wl_interface *interface(); - - enum resize_edge { - resize_edge_none = 0, - resize_edge_top = 1, - resize_edge_bottom = 2, - resize_edge_left = 4, - resize_edge_top_left = 5, - resize_edge_bottom_left = 6, - resize_edge_right = 8, - resize_edge_top_right = 9, - resize_edge_bottom_right = 10 - }; - - enum state { - state_maximized = 1, // the surface is maximized - state_fullscreen = 2, // the surface is fullscreen - state_resizing = 3, - state_activated = 4 - }; - - void destroy(); - void set_parent(struct ::xdg_surface_v5 *parent); - void set_title(const QString &title); - void set_app_id(const QString &app_id); - void show_window_menu(struct ::wl_seat *seat, uint32_t serial, int32_t x, int32_t y); - void move(struct ::wl_seat *seat, uint32_t serial); - void resize(struct ::wl_seat *seat, uint32_t serial, uint32_t edges); - void ack_configure(uint32_t serial); - void set_window_geometry(int32_t x, int32_t y, int32_t width, int32_t height); - void set_maximized(); - void unset_maximized(); - void set_fullscreen(struct ::wl_output *output); - void unset_fullscreen(); - void set_minimized(); - - protected: - virtual void xdg_surface_configure(int32_t width, int32_t height, wl_array *states, uint32_t serial); - virtual void xdg_surface_close(); - - private: - void init_listener(); - static const struct xdg_surface_listener m_xdg_surface_listener; - static void handle_configure( - void *data, - struct ::xdg_surface_v5 *object, - int32_t width, - int32_t height, - wl_array *states, - uint32_t serial); - static void handle_close( - void *data, - struct ::xdg_surface_v5 *object); - struct ::xdg_surface_v5 *m_xdg_surface; - }; - - class xdg_popup_v5 - { - public: - xdg_popup_v5(struct ::wl_registry *registry, int id, int version); - xdg_popup_v5(struct ::xdg_popup_v5 *object); - xdg_popup_v5(); - - virtual ~xdg_popup_v5(); - - void init(struct ::wl_registry *registry, int id, int version); - void init(struct ::xdg_popup_v5 *object); - - struct ::xdg_popup_v5 *object() { return m_xdg_popup; } - const struct ::xdg_popup_v5 *object() const { return m_xdg_popup; } - - bool isInitialized() const; - - static const struct ::wl_interface *interface(); - - void destroy(); - - protected: - virtual void xdg_popup_popup_done(); - - private: - void init_listener(); - static const struct xdg_popup_listener m_xdg_popup_listener; - static void handle_popup_done( - void *data, - struct ::xdg_popup_v5 *object); - struct ::xdg_popup_v5 *m_xdg_popup; - }; -} - -QT_WARNING_POP -QT_END_NAMESPACE - -#endif diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/pregenerated/3rdparty/wayland-xdg-shell-unstable-v5-client-protocol_p.h b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/pregenerated/3rdparty/wayland-xdg-shell-unstable-v5-client-protocol_p.h deleted file mode 100644 index 8877e8830c3..00000000000 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/pregenerated/3rdparty/wayland-xdg-shell-unstable-v5-client-protocol_p.h +++ /dev/null @@ -1,1119 +0,0 @@ -/* Generated by wayland-scanner 1.13.0 */ -// Hand-edited to resolve conflicts with xdg-shell stable -// And make it build with libwayland < 1.10 - -#ifndef XDG_SHELL_UNSTABLE_V5_CLIENT_PROTOCOL_H -#define XDG_SHELL_UNSTABLE_V5_CLIENT_PROTOCOL_H - -#include -#include -#include "wayland-client-core.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @page page_xdg_shell_unstable_v5 The xdg_shell_unstable_v5 protocol - * @section page_ifaces_xdg_shell_unstable_v5 Interfaces - * - @subpage page_iface_xdg_shell_v5 - create desktop-style surfaces - * - @subpage page_iface_xdg_surface_v5 - A desktop window - * - @subpage page_iface_xdg_popup_v5 - short-lived, popup surfaces for menus - * @section page_copyright_xdg_shell_unstable_v5 Copyright - *
- *
- * Copyright © 2008-2013 Kristian Høgsberg
- * Copyright © 2013      Rafael Antognolli
- * Copyright © 2013      Jasper St. Pierre
- * Copyright © 2010-2013 Intel Corporation
- *
- * 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.
- * 
- */ -struct wl_output; -struct wl_seat; -struct wl_surface; -struct xdg_popup_v5; -struct xdg_shell_v5; -struct xdg_surface_v5; - -/** - * @page page_iface_xdg_shell_v5 xdg_shell - * @section page_iface_xdg_shell_desc Description - * - * xdg_shell_v5 allows clients to turn a wl_surface into a "real window" - * which can be dragged, resized, stacked, and moved around by the - * user. Everything about this interface is suited towards traditional - * desktop environments. - * @section page_iface_xdg_shell_api API - * See @ref iface_xdg_shell. - */ -/** - * @defgroup iface_xdg_shell_v5 The xdg_shell_v5 interface - * - * xdg_shell_v5 allows clients to turn a wl_surface into a "real window" - * which can be dragged, resized, stacked, and moved around by the - * user. Everything about this interface is suited towards traditional - * desktop environments. - */ -extern const struct wl_interface xdg_shell_v5_interface; -/** - * @page page_iface_xdg_surface_v5 xdg_surface - * @section page_iface_xdg_surface_desc Description - * - * An interface that may be implemented by a wl_surface, for - * implementations that provide a desktop-style user interface. - * - * It provides requests to treat surfaces like windows, allowing to set - * properties like maximized, fullscreen, minimized, and to move and resize - * them, and associate metadata like title and app id. - * - * The client must call wl_surface.commit on the corresponding wl_surface - * for the xdg_surface_v5 state to take effect. Prior to committing the new - * state, it can set up initial configuration, such as maximizing or setting - * a window geometry. - * - * Even without attaching a buffer the compositor must respond to initial - * committed configuration, for instance sending a configure event with - * expected window geometry if the client maximized its surface during - * initialization. - * - * For a surface to be mapped by the compositor the client must have - * committed both an xdg_surface_v5 state and a buffer. - * @section page_iface_xdg_surface_api API - * See @ref iface_xdg_surface. - */ -/** - * @defgroup iface_xdg_surface_v5 The xdg_surface_v5 interface - * - * An interface that may be implemented by a wl_surface, for - * implementations that provide a desktop-style user interface. - * - * It provides requests to treat surfaces like windows, allowing to set - * properties like maximized, fullscreen, minimized, and to move and resize - * them, and associate metadata like title and app id. - * - * The client must call wl_surface.commit on the corresponding wl_surface - * for the xdg_surface_v5 state to take effect. Prior to committing the new - * state, it can set up initial configuration, such as maximizing or setting - * a window geometry. - * - * Even without attaching a buffer the compositor must respond to initial - * committed configuration, for instance sending a configure event with - * expected window geometry if the client maximized its surface during - * initialization. - * - * For a surface to be mapped by the compositor the client must have - * committed both an xdg_surface_v5 state and a buffer. - */ -extern const struct wl_interface xdg_surface_v5_interface; -/** - * @page page_iface_xdg_popup_v5 xdg_popup - * @section page_iface_xdg_popup_desc Description - * - * A popup surface is a short-lived, temporary surface that can be - * used to implement menus. It takes an explicit grab on the surface - * that will be dismissed when the user dismisses the popup. This can - * be done by the user clicking outside the surface, using the keyboard, - * or even locking the screen through closing the lid or a timeout. - * - * When the popup is dismissed, a popup_done event will be sent out, - * and at the same time the surface will be unmapped. The xdg_popup - * object is now inert and cannot be reactivated, so clients should - * destroy it. Explicitly destroying the xdg_popup_v5 object will also - * dismiss the popup and unmap the surface. - * - * Clients will receive events for all their surfaces during this - * grab (which is an "owner-events" grab in X11 parlance). This is - * done so that users can navigate through submenus and other - * "nested" popup windows without having to dismiss the topmost - * popup. - * - * Clients that want to dismiss the popup when another surface of - * their own is clicked should dismiss the popup using the destroy - * request. - * - * The parent surface must have either an xdg_surface_v5 or xdg_popup - * role. - * - * Specifying an xdg_popup_v5 for the parent means that the popups are - * nested, with this popup now being the topmost popup. Nested - * popups must be destroyed in the reverse order they were created - * in, e.g. the only popup you are allowed to destroy at all times - * is the topmost one. - * - * If there is an existing popup when creating a new popup, the - * parent must be the current topmost popup. - * - * A parent surface must be mapped before the new popup is mapped. - * - * When compositors choose to dismiss a popup, they will likely - * dismiss every nested popup as well. When a compositor dismisses - * popups, it will follow the same dismissing order as required - * from the client. - * - * The x and y arguments passed when creating the popup object specify - * where the top left of the popup should be placed, relative to the - * local surface coordinates of the parent surface. See - * xdg_shell.get_xdg_popup. - * - * The client must call wl_surface.commit on the corresponding wl_surface - * for the xdg_popup_v5 state to take effect. - * - * For a surface to be mapped by the compositor the client must have - * committed both the xdg_popup_v5 state and a buffer. - * @section page_iface_xdg_popup_api API - * See @ref iface_xdg_popup. - */ -/** - * @defgroup iface_xdg_popup_v5 The xdg_popup_v5 interface - * - * A popup surface is a short-lived, temporary surface that can be - * used to implement menus. It takes an explicit grab on the surface - * that will be dismissed when the user dismisses the popup. This can - * be done by the user clicking outside the surface, using the keyboard, - * or even locking the screen through closing the lid or a timeout. - * - * When the popup is dismissed, a popup_done event will be sent out, - * and at the same time the surface will be unmapped. The xdg_popup - * object is now inert and cannot be reactivated, so clients should - * destroy it. Explicitly destroying the xdg_popup_v5 object will also - * dismiss the popup and unmap the surface. - * - * Clients will receive events for all their surfaces during this - * grab (which is an "owner-events" grab in X11 parlance). This is - * done so that users can navigate through submenus and other - * "nested" popup windows without having to dismiss the topmost - * popup. - * - * Clients that want to dismiss the popup when another surface of - * their own is clicked should dismiss the popup using the destroy - * request. - * - * The parent surface must have either an xdg_surface_v5 or xdg_popup - * role. - * - * Specifying an xdg_popup_v5 for the parent means that the popups are - * nested, with this popup now being the topmost popup. Nested - * popups must be destroyed in the reverse order they were created - * in, e.g. the only popup you are allowed to destroy at all times - * is the topmost one. - * - * If there is an existing popup when creating a new popup, the - * parent must be the current topmost popup. - * - * A parent surface must be mapped before the new popup is mapped. - * - * When compositors choose to dismiss a popup, they will likely - * dismiss every nested popup as well. When a compositor dismisses - * popups, it will follow the same dismissing order as required - * from the client. - * - * The x and y arguments passed when creating the popup object specify - * where the top left of the popup should be placed, relative to the - * local surface coordinates of the parent surface. See - * xdg_shell.get_xdg_popup. - * - * The client must call wl_surface.commit on the corresponding wl_surface - * for the xdg_popup_v5 state to take effect. - * - * For a surface to be mapped by the compositor the client must have - * committed both the xdg_popup_v5 state and a buffer. - */ -extern const struct wl_interface xdg_popup_v5_interface; - -#ifndef XDG_SHELL_VERSION_ENUM -#define XDG_SHELL_VERSION_ENUM -/** - * @ingroup iface_xdg_shell - * latest protocol version - * - * The 'current' member of this enum gives the version of the - * protocol. Implementations can compare this to the version - * they implement using static_assert to ensure the protocol and - * implementation versions match. - */ -enum xdg_shell_version { - /** - * Always the latest version - */ - XDG_SHELL_VERSION_CURRENT = 5, -}; -#endif /* XDG_SHELL_VERSION_ENUM */ - -#ifndef XDG_SHELL_ERROR_ENUM -#define XDG_SHELL_ERROR_ENUM -enum xdg_shell_error { - /** - * given wl_surface has another role - */ - XDG_SHELL_ERROR_ROLE = 0, - /** - * xdg_shell_v5 was destroyed before children - */ - XDG_SHELL_ERROR_DEFUNCT_SURFACES = 1, - /** - * the client tried to map or destroy a non-topmost popup - */ - XDG_SHELL_ERROR_NOT_THE_TOPMOST_POPUP = 2, - /** - * the client specified an invalid popup parent surface - */ - XDG_SHELL_ERROR_INVALID_POPUP_PARENT = 3, -}; -#endif /* XDG_SHELL_ERROR_ENUM */ - -/** - * @ingroup iface_xdg_shell - * @struct xdg_shell_listener - */ -struct xdg_shell_listener { - /** - * check if the client is alive - * - * The ping event asks the client if it's still alive. Pass the - * serial specified in the event back to the compositor by sending - * a "pong" request back with the specified serial. - * - * Compositors can use this to determine if the client is still - * alive. It's unspecified what will happen if the client doesn't - * respond to the ping request, or in what timeframe. Clients - * should try to respond in a reasonable amount of time. - * - * A compositor is free to ping in any way it wants, but a client - * must always respond to any xdg_shell_v5 object it created. - * @param serial pass this to the pong request - */ - void (*ping)(void *data, - struct xdg_shell_v5 *xdg_shell_v5, - uint32_t serial); -}; - -/** - * @ingroup iface_xdg_shell - */ -static inline int -xdg_shell_add_listener(struct xdg_shell_v5 *xdg_shell, - const struct xdg_shell_listener *listener, void *data) -{ - return wl_proxy_add_listener((struct wl_proxy *) xdg_shell, - (void (**)(void)) listener, data); -} - -#define XDG_SHELL_DESTROY 0 -#define XDG_SHELL_USE_UNSTABLE_VERSION 1 -#define XDG_SHELL_GET_XDG_SURFACE 2 -#define XDG_SHELL_GET_XDG_POPUP 3 -#define XDG_SHELL_PONG 4 - -/** - * @ingroup iface_xdg_shell - */ -#define XDG_SHELL_PING_SINCE_VERSION 1 - -/** - * @ingroup iface_xdg_shell - */ -#define XDG_SHELL_DESTROY_SINCE_VERSION 1 -/** - * @ingroup iface_xdg_shell - */ -#define XDG_SHELL_USE_UNSTABLE_VERSION_SINCE_VERSION 1 -/** - * @ingroup iface_xdg_shell - */ -#define XDG_SHELL_GET_XDG_SURFACE_SINCE_VERSION 1 -/** - * @ingroup iface_xdg_shell - */ -#define XDG_SHELL_GET_XDG_POPUP_SINCE_VERSION 1 -/** - * @ingroup iface_xdg_shell - */ -#define XDG_SHELL_PONG_SINCE_VERSION 1 - -/** @ingroup iface_xdg_shell_v5 */ -static inline void -xdg_shell_set_user_data(struct xdg_shell_v5 *xdg_shell, void *user_data) -{ - wl_proxy_set_user_data((struct wl_proxy *) xdg_shell, user_data); -} - -/** @ingroup iface_xdg_shell_v5 */ -static inline void * -xdg_shell_get_user_data(struct xdg_shell_v5 *xdg_shell) -{ - return wl_proxy_get_user_data((struct wl_proxy *) xdg_shell); -} - -#if WAYLAND_VERSION_MAJOR > 1 || WAYLAND_VERSION_MINOR >= 10 -static inline uint32_t -xdg_shell_get_version(struct xdg_shell_v5 *xdg_shell) -{ - return wl_proxy_get_version((struct wl_proxy *) xdg_shell); -} -#endif - -/** - * @ingroup iface_xdg_shell - * - * Destroy this xdg_shell_v5 object. - * - * Destroying a bound xdg_shell_v5 object while there are surfaces - * still alive created by this xdg_shell_v5 object instance is illegal - * and will result in a protocol error. - */ -static inline void -xdg_shell_destroy(struct xdg_shell_v5 *xdg_shell) -{ - wl_proxy_marshal((struct wl_proxy *) xdg_shell, - XDG_SHELL_DESTROY); - - wl_proxy_destroy((struct wl_proxy *) xdg_shell); -} - -/** - * @ingroup iface_xdg_shell - * - * Negotiate the unstable version of the interface. This - * mechanism is in place to ensure client and server agree on the - * unstable versions of the protocol that they speak or exit - * cleanly if they don't agree. This request will go away once - * the xdg-shell protocol is stable. - */ -static inline void -xdg_shell_use_unstable_version(struct xdg_shell_v5 *xdg_shell, int32_t version) -{ - wl_proxy_marshal((struct wl_proxy *) xdg_shell, - XDG_SHELL_USE_UNSTABLE_VERSION, version); -} - -/** - * @ingroup iface_xdg_shell - * - * This creates an xdg_surface_v5 for the given surface and gives it the - * xdg_surface_v5 role. A wl_surface can only be given an xdg_surface_v5 role - * once. If get_xdg_surface_v5 is called with a wl_surface that already has - * an active xdg_surface_v5 associated with it, or if it had any other role, - * an error is raised. - * - * See the documentation of xdg_surface_v5 for more details about what an - * xdg_surface_v5 is and how it is used. - */ -static inline struct xdg_surface_v5 * -xdg_shell_get_xdg_surface(struct xdg_shell_v5 *xdg_shell, struct wl_surface *surface) -{ - struct wl_proxy *id; - - id = wl_proxy_marshal_constructor((struct wl_proxy *) xdg_shell, - XDG_SHELL_GET_XDG_SURFACE, &xdg_surface_v5_interface, NULL, surface); - - return (struct xdg_surface_v5 *) id; -} - -/** - * @ingroup iface_xdg_shell - * - * This creates an xdg_popup_v5 for the given surface and gives it the - * xdg_popup_v5 role. A wl_surface can only be given an xdg_popup_v5 role - * once. If get_xdg_popup_v5 is called with a wl_surface that already has - * an active xdg_popup_v5 associated with it, or if it had any other role, - * an error is raised. - * - * This request must be used in response to some sort of user action - * like a button press, key press, or touch down event. - * - * See the documentation of xdg_popup_v5 for more details about what an - * xdg_popup_v5 is and how it is used. - */ -static inline struct xdg_popup_v5 * -xdg_shell_get_xdg_popup(struct xdg_shell_v5 *xdg_shell, struct wl_surface *surface, struct wl_surface *parent, struct wl_seat *seat, uint32_t serial, int32_t x, int32_t y) -{ - struct wl_proxy *id; - - id = wl_proxy_marshal_constructor((struct wl_proxy *) xdg_shell, - XDG_SHELL_GET_XDG_POPUP, &xdg_popup_v5_interface, NULL, surface, parent, seat, serial, x, y); - - return (struct xdg_popup_v5 *) id; -} - -/** - * @ingroup iface_xdg_shell - * - * A client must respond to a ping event with a pong request or - * the client may be deemed unresponsive. - */ -static inline void -xdg_shell_pong(struct xdg_shell_v5 *xdg_shell, uint32_t serial) -{ - wl_proxy_marshal((struct wl_proxy *) xdg_shell, - XDG_SHELL_PONG, serial); -} - -#ifndef XDG_SURFACE_RESIZE_EDGE_ENUM -#define XDG_SURFACE_RESIZE_EDGE_ENUM -/** - * @ingroup iface_xdg_surface - * edge values for resizing - * - * These values are used to indicate which edge of a surface - * is being dragged in a resize operation. - */ -enum xdg_surface_resize_edge { - XDG_SURFACE_RESIZE_EDGE_NONE = 0, - XDG_SURFACE_RESIZE_EDGE_TOP = 1, - XDG_SURFACE_RESIZE_EDGE_BOTTOM = 2, - XDG_SURFACE_RESIZE_EDGE_LEFT = 4, - XDG_SURFACE_RESIZE_EDGE_TOP_LEFT = 5, - XDG_SURFACE_RESIZE_EDGE_BOTTOM_LEFT = 6, - XDG_SURFACE_RESIZE_EDGE_RIGHT = 8, - XDG_SURFACE_RESIZE_EDGE_TOP_RIGHT = 9, - XDG_SURFACE_RESIZE_EDGE_BOTTOM_RIGHT = 10, -}; -#endif /* XDG_SURFACE_RESIZE_EDGE_ENUM */ - -#ifndef XDG_SURFACE_STATE_ENUM -#define XDG_SURFACE_STATE_ENUM -/** - * @ingroup iface_xdg_surface - * types of state on the surface - * - * The different state values used on the surface. This is designed for - * state values like maximized, fullscreen. It is paired with the - * configure event to ensure that both the client and the compositor - * setting the state can be synchronized. - * - * States set in this way are double-buffered. They will get applied on - * the next commit. - * - * Desktop environments may extend this enum by taking up a range of - * values and documenting the range they chose in this description. - * They are not required to document the values for the range that they - * chose. Ideally, any good extensions from a desktop environment should - * make its way into standardization into this enum. - * - * The current reserved ranges are: - * - * 0x0000 - 0x0FFF: xdg-shell core values, documented below. - * 0x1000 - 0x1FFF: GNOME - */ -enum xdg_surface_state { - /** - * the surface is maximized - */ - XDG_SURFACE_STATE_MAXIMIZED = 1, - /** - * the surface is fullscreen - */ - XDG_SURFACE_STATE_FULLSCREEN = 2, - XDG_SURFACE_STATE_RESIZING = 3, - XDG_SURFACE_STATE_ACTIVATED = 4, -}; -#endif /* XDG_SURFACE_STATE_ENUM */ - -/** - * @ingroup iface_xdg_surface - * @struct xdg_surface_listener - */ -struct xdg_surface_listener { - /** - * suggest a surface change - * - * The configure event asks the client to resize its surface or - * to change its state. - * - * The width and height arguments specify a hint to the window - * about how its surface should be resized in window geometry - * coordinates. See set_window_geometry. - * - * If the width or height arguments are zero, it means the client - * should decide its own window dimension. This may happen when the - * compositor need to configure the state of the surface but - * doesn't have any information about any previous or expected - * dimension. - * - * The states listed in the event specify how the width/height - * arguments should be interpreted, and possibly how it should be - * drawn. - * - * Clients should arrange their surface for the new size and - * states, and then send a ack_configure request with the serial - * sent in this configure event at some point before committing the - * new surface. - * - * If the client receives multiple configure events before it can - * respond to one, it is free to discard all but the last event it - * received. - */ - void (*configure)(void *data, - struct xdg_surface_v5 *xdg_surface_v5, - int32_t width, - int32_t height, - struct wl_array *states, - uint32_t serial); - /** - * surface wants to be closed - * - * The close event is sent by the compositor when the user wants - * the surface to be closed. This should be equivalent to the user - * clicking the close button in client-side decorations, if your - * application has any... - * - * This is only a request that the user intends to close your - * window. The client may choose to ignore this request, or show a - * dialog to ask the user to save their data... - */ - void (*close)(void *data, - struct xdg_surface_v5 *xdg_surface_v5); -}; - -/** - * @ingroup iface_xdg_surface - */ -static inline int -xdg_surface_add_listener(struct xdg_surface_v5 *xdg_surface, - const struct xdg_surface_listener *listener, void *data) -{ - return wl_proxy_add_listener((struct wl_proxy *) xdg_surface, - (void (**)(void)) listener, data); -} - -#define XDG_SURFACE_DESTROY 0 -#define XDG_SURFACE_SET_PARENT 1 -#define XDG_SURFACE_SET_TITLE 2 -#define XDG_SURFACE_SET_APP_ID 3 -#define XDG_SURFACE_SHOW_WINDOW_MENU 4 -#define XDG_SURFACE_MOVE 5 -#define XDG_SURFACE_RESIZE 6 -#define XDG_SURFACE_ACK_CONFIGURE 7 -#define XDG_SURFACE_SET_WINDOW_GEOMETRY 8 -#define XDG_SURFACE_SET_MAXIMIZED 9 -#define XDG_SURFACE_UNSET_MAXIMIZED 10 -#define XDG_SURFACE_SET_FULLSCREEN 11 -#define XDG_SURFACE_UNSET_FULLSCREEN 12 -#define XDG_SURFACE_SET_MINIMIZED 13 - -/** - * @ingroup iface_xdg_surface - */ -#define XDG_SURFACE_CONFIGURE_SINCE_VERSION 1 -/** - * @ingroup iface_xdg_surface - */ -#define XDG_SURFACE_CLOSE_SINCE_VERSION 1 - -/** - * @ingroup iface_xdg_surface - */ -#define XDG_SURFACE_DESTROY_SINCE_VERSION 1 -/** - * @ingroup iface_xdg_surface - */ -#define XDG_SURFACE_SET_PARENT_SINCE_VERSION 1 -/** - * @ingroup iface_xdg_surface - */ -#define XDG_SURFACE_SET_TITLE_SINCE_VERSION 1 -/** - * @ingroup iface_xdg_surface - */ -#define XDG_SURFACE_SET_APP_ID_SINCE_VERSION 1 -/** - * @ingroup iface_xdg_surface - */ -#define XDG_SURFACE_SHOW_WINDOW_MENU_SINCE_VERSION 1 -/** - * @ingroup iface_xdg_surface - */ -#define XDG_SURFACE_MOVE_SINCE_VERSION 1 -/** - * @ingroup iface_xdg_surface - */ -#define XDG_SURFACE_RESIZE_SINCE_VERSION 1 -/** - * @ingroup iface_xdg_surface - */ -#define XDG_SURFACE_ACK_CONFIGURE_SINCE_VERSION 1 -/** - * @ingroup iface_xdg_surface - */ -#define XDG_SURFACE_SET_WINDOW_GEOMETRY_SINCE_VERSION 1 -/** - * @ingroup iface_xdg_surface - */ -#define XDG_SURFACE_SET_MAXIMIZED_SINCE_VERSION 1 -/** - * @ingroup iface_xdg_surface - */ -#define XDG_SURFACE_UNSET_MAXIMIZED_SINCE_VERSION 1 -/** - * @ingroup iface_xdg_surface - */ -#define XDG_SURFACE_SET_FULLSCREEN_SINCE_VERSION 1 -/** - * @ingroup iface_xdg_surface - */ -#define XDG_SURFACE_UNSET_FULLSCREEN_SINCE_VERSION 1 -/** - * @ingroup iface_xdg_surface - */ -#define XDG_SURFACE_SET_MINIMIZED_SINCE_VERSION 1 - -/** @ingroup iface_xdg_surface_v5 */ -static inline void -xdg_surface_set_user_data(struct xdg_surface_v5 *xdg_surface, void *user_data) -{ - wl_proxy_set_user_data((struct wl_proxy *) xdg_surface, user_data); -} - -/** @ingroup iface_xdg_surface_v5 */ -static inline void * -xdg_surface_get_user_data(struct xdg_surface_v5 *xdg_surface) -{ - return wl_proxy_get_user_data((struct wl_proxy *) xdg_surface); -} - -#if WAYLAND_VERSION_MAJOR > 1 || WAYLAND_VERSION_MINOR >= 10 -static inline uint32_t -xdg_surface_get_version(struct xdg_surface_v5 *xdg_surface) -{ - return wl_proxy_get_version((struct wl_proxy *) xdg_surface); -} -#endif - -/** - * @ingroup iface_xdg_surface - * - * Unmap and destroy the window. The window will be effectively - * hidden from the user's point of view, and all state like - * maximization, fullscreen, and so on, will be lost. - */ -static inline void -xdg_surface_destroy(struct xdg_surface_v5 *xdg_surface) -{ - wl_proxy_marshal((struct wl_proxy *) xdg_surface, - XDG_SURFACE_DESTROY); - - wl_proxy_destroy((struct wl_proxy *) xdg_surface); -} - -/** - * @ingroup iface_xdg_surface - * - * Set the "parent" of this surface. This window should be stacked - * above a parent. The parent surface must be mapped as long as this - * surface is mapped. - * - * Parent windows should be set on dialogs, toolboxes, or other - * "auxiliary" surfaces, so that the parent is raised when the dialog - * is raised. - */ -static inline void -xdg_surface_set_parent(struct xdg_surface_v5 *xdg_surface, struct xdg_surface_v5 *parent) -{ - wl_proxy_marshal((struct wl_proxy *) xdg_surface, - XDG_SURFACE_SET_PARENT, parent); -} - -/** - * @ingroup iface_xdg_surface - * - * Set a short title for the surface. - * - * This string may be used to identify the surface in a task bar, - * window list, or other user interface elements provided by the - * compositor. - * - * The string must be encoded in UTF-8. - */ -static inline void -xdg_surface_set_title(struct xdg_surface_v5 *xdg_surface, const char *title) -{ - wl_proxy_marshal((struct wl_proxy *) xdg_surface, - XDG_SURFACE_SET_TITLE, title); -} - -/** - * @ingroup iface_xdg_surface - * - * Set an application identifier for the surface. - * - * The app ID identifies the general class of applications to which - * the surface belongs. The compositor can use this to group multiple - * surfaces together, or to determine how to launch a new application. - * - * For D-Bus activatable applications, the app ID is used as the D-Bus - * service name. - * - * The compositor shell will try to group application surfaces together - * by their app ID. As a best practice, it is suggested to select app - * ID's that match the basename of the application's .desktop file. - * For example, "org.freedesktop.FooViewer" where the .desktop file is - * "org.freedesktop.FooViewer.desktop". - * - * See the desktop-entry specification [0] for more details on - * application identifiers and how they relate to well-known D-Bus - * names and .desktop files. - * - * [0] http://standards.freedesktop.org/desktop-entry-spec/ - */ -static inline void -xdg_surface_set_app_id(struct xdg_surface_v5 *xdg_surface, const char *app_id) -{ - wl_proxy_marshal((struct wl_proxy *) xdg_surface, - XDG_SURFACE_SET_APP_ID, app_id); -} - -/** - * @ingroup iface_xdg_surface - * - * Clients implementing client-side decorations might want to show - * a context menu when right-clicking on the decorations, giving the - * user a menu that they can use to maximize or minimize the window. - * - * This request asks the compositor to pop up such a window menu at - * the given position, relative to the local surface coordinates of - * the parent surface. There are no guarantees as to what menu items - * the window menu contains. - * - * This request must be used in response to some sort of user action - * like a button press, key press, or touch down event. - */ -static inline void -xdg_surface_show_window_menu(struct xdg_surface_v5 *xdg_surface, struct wl_seat *seat, uint32_t serial, int32_t x, int32_t y) -{ - wl_proxy_marshal((struct wl_proxy *) xdg_surface, - XDG_SURFACE_SHOW_WINDOW_MENU, seat, serial, x, y); -} - -/** - * @ingroup iface_xdg_surface - * - * Start an interactive, user-driven move of the surface. - * - * This request must be used in response to some sort of user action - * like a button press, key press, or touch down event. The passed - * serial is used to determine the type of interactive move (touch, - * pointer, etc). - * - * The server may ignore move requests depending on the state of - * the surface (e.g. fullscreen or maximized), or if the passed serial - * is no longer valid. - * - * If triggered, the surface will lose the focus of the device - * (wl_pointer, wl_touch, etc) used for the move. It is up to the - * compositor to visually indicate that the move is taking place, such as - * updating a pointer cursor, during the move. There is no guarantee - * that the device focus will return when the move is completed. - */ -static inline void -xdg_surface_move(struct xdg_surface_v5 *xdg_surface, struct wl_seat *seat, uint32_t serial) -{ - wl_proxy_marshal((struct wl_proxy *) xdg_surface, - XDG_SURFACE_MOVE, seat, serial); -} - -/** - * @ingroup iface_xdg_surface - * - * Start a user-driven, interactive resize of the surface. - * - * This request must be used in response to some sort of user action - * like a button press, key press, or touch down event. The passed - * serial is used to determine the type of interactive resize (touch, - * pointer, etc). - * - * The server may ignore resize requests depending on the state of - * the surface (e.g. fullscreen or maximized). - * - * If triggered, the client will receive configure events with the - * "resize" state enum value and the expected sizes. See the "resize" - * enum value for more details about what is required. The client - * must also acknowledge configure events using "ack_configure". After - * the resize is completed, the client will receive another "configure" - * event without the resize state. - * - * If triggered, the surface also will lose the focus of the device - * (wl_pointer, wl_touch, etc) used for the resize. It is up to the - * compositor to visually indicate that the resize is taking place, - * such as updating a pointer cursor, during the resize. There is no - * guarantee that the device focus will return when the resize is - * completed. - * - * The edges parameter specifies how the surface should be resized, - * and is one of the values of the resize_edge enum. The compositor - * may use this information to update the surface position for - * example when dragging the top left corner. The compositor may also - * use this information to adapt its behavior, e.g. choose an - * appropriate cursor image. - */ -static inline void -xdg_surface_resize(struct xdg_surface_v5 *xdg_surface, struct wl_seat *seat, uint32_t serial, uint32_t edges) -{ - wl_proxy_marshal((struct wl_proxy *) xdg_surface, - XDG_SURFACE_RESIZE, seat, serial, edges); -} - -/** - * @ingroup iface_xdg_surface - * - * When a configure event is received, if a client commits the - * surface in response to the configure event, then the client - * must make a ack_configure request before the commit request, - * passing along the serial of the configure event. - * - * For instance, the compositor might use this information to move - * a surface to the top left only when the client has drawn itself - * for the maximized or fullscreen state. - * - * If the client receives multiple configure events before it - * can respond to one, it only has to ack the last configure event. - */ -static inline void -xdg_surface_ack_configure(struct xdg_surface_v5 *xdg_surface, uint32_t serial) -{ - wl_proxy_marshal((struct wl_proxy *) xdg_surface, - XDG_SURFACE_ACK_CONFIGURE, serial); -} - -/** - * @ingroup iface_xdg_surface - * - * The window geometry of a window is its "visible bounds" from the - * user's perspective. Client-side decorations often have invisible - * portions like drop-shadows which should be ignored for the - * purposes of aligning, placing and constraining windows. - * - * The window geometry is double buffered, and will be applied at the - * time wl_surface.commit of the corresponding wl_surface is called. - * - * Once the window geometry of the surface is set once, it is not - * possible to unset it, and it will remain the same until - * set_window_geometry is called again, even if a new subsurface or - * buffer is attached. - * - * If never set, the value is the full bounds of the surface, - * including any subsurfaces. This updates dynamically on every - * commit. This unset mode is meant for extremely simple clients. - * - * If responding to a configure event, the window geometry in here - * must respect the sizing negotiations specified by the states in - * the configure event. - * - * The arguments are given in the surface local coordinate space of - * the wl_surface associated with this xdg_surface. - * - * The width and height must be greater than zero. - */ -static inline void -xdg_surface_set_window_geometry(struct xdg_surface_v5 *xdg_surface, int32_t x, int32_t y, int32_t width, int32_t height) -{ - wl_proxy_marshal((struct wl_proxy *) xdg_surface, - XDG_SURFACE_SET_WINDOW_GEOMETRY, x, y, width, height); -} - -/** - * @ingroup iface_xdg_surface - * - * Maximize the surface. - * - * After requesting that the surface should be maximized, the compositor - * will respond by emitting a configure event with the "maximized" state - * and the required window geometry. The client should then update its - * content, drawing it in a maximized state, i.e. without shadow or other - * decoration outside of the window geometry. The client must also - * acknowledge the configure when committing the new content (see - * ack_configure). - * - * It is up to the compositor to decide how and where to maximize the - * surface, for example which output and what region of the screen should - * be used. - * - * If the surface was already maximized, the compositor will still emit - * a configure event with the "maximized" state. - */ -static inline void -xdg_surface_set_maximized(struct xdg_surface_v5 *xdg_surface) -{ - wl_proxy_marshal((struct wl_proxy *) xdg_surface, - XDG_SURFACE_SET_MAXIMIZED); -} - -/** - * @ingroup iface_xdg_surface - * - * Unmaximize the surface. - * - * After requesting that the surface should be unmaximized, the compositor - * will respond by emitting a configure event without the "maximized" - * state. If available, the compositor will include the window geometry - * dimensions the window had prior to being maximized in the configure - * request. The client must then update its content, drawing it in a - * regular state, i.e. potentially with shadow, etc. The client must also - * acknowledge the configure when committing the new content (see - * ack_configure). - * - * It is up to the compositor to position the surface after it was - * unmaximized; usually the position the surface had before maximizing, if - * applicable. - * - * If the surface was already not maximized, the compositor will still - * emit a configure event without the "maximized" state. - */ -static inline void -xdg_surface_unset_maximized(struct xdg_surface_v5 *xdg_surface) -{ - wl_proxy_marshal((struct wl_proxy *) xdg_surface, - XDG_SURFACE_UNSET_MAXIMIZED); -} - -/** - * @ingroup iface_xdg_surface - * - * Make the surface fullscreen. - * - * You can specify an output that you would prefer to be fullscreen. - * If this value is NULL, it's up to the compositor to choose which - * display will be used to map this surface. - * - * If the surface doesn't cover the whole output, the compositor will - * position the surface in the center of the output and compensate with - * black borders filling the rest of the output. - */ -static inline void -xdg_surface_set_fullscreen(struct xdg_surface_v5 *xdg_surface, struct wl_output *output) -{ - wl_proxy_marshal((struct wl_proxy *) xdg_surface, - XDG_SURFACE_SET_FULLSCREEN, output); -} - -/** - * @ingroup iface_xdg_surface - */ -static inline void -xdg_surface_unset_fullscreen(struct xdg_surface_v5 *xdg_surface) -{ - wl_proxy_marshal((struct wl_proxy *) xdg_surface, - XDG_SURFACE_UNSET_FULLSCREEN); -} - -/** - * @ingroup iface_xdg_surface - * - * Request that the compositor minimize your surface. There is no - * way to know if the surface is currently minimized, nor is there - * any way to unset minimization on this surface. - * - * If you are looking to throttle redrawing when minimized, please - * instead use the wl_surface.frame event for this, as this will - * also work with live previews on windows in Alt-Tab, Expose or - * similar compositor features. - */ -static inline void -xdg_surface_set_minimized(struct xdg_surface_v5 *xdg_surface) -{ - wl_proxy_marshal((struct wl_proxy *) xdg_surface, - XDG_SURFACE_SET_MINIMIZED); -} - -/** - * @ingroup iface_xdg_popup - * @struct xdg_popup_listener - */ -struct xdg_popup_listener { - /** - * popup interaction is done - * - * The popup_done event is sent out when a popup is dismissed by - * the compositor. The client should destroy the xdg_popup_v5 object - * at this point. - */ - void (*popup_done)(void *data, - struct xdg_popup_v5 *xdg_popup_v5); -}; - -/** - * @ingroup iface_xdg_popup - */ -static inline int -xdg_popup_add_listener(struct xdg_popup_v5 *xdg_popup, - const struct xdg_popup_listener *listener, void *data) -{ - return wl_proxy_add_listener((struct wl_proxy *) xdg_popup, - (void (**)(void)) listener, data); -} - -#define XDG_POPUP_DESTROY 0 - -/** - * @ingroup iface_xdg_popup - */ -#define XDG_POPUP_POPUP_DONE_SINCE_VERSION 1 - -/** - * @ingroup iface_xdg_popup - */ -#define XDG_POPUP_DESTROY_SINCE_VERSION 1 - -/** @ingroup iface_xdg_popup_v5 */ -static inline void -xdg_popup_set_user_data(struct xdg_popup_v5 *xdg_popup, void *user_data) -{ - wl_proxy_set_user_data((struct wl_proxy *) xdg_popup, user_data); -} - -/** @ingroup iface_xdg_popup_v5 */ -static inline void * -xdg_popup_get_user_data(struct xdg_popup_v5 *xdg_popup) -{ - return wl_proxy_get_user_data((struct wl_proxy *) xdg_popup); -} - -#if WAYLAND_VERSION_MAJOR > 1 || WAYLAND_VERSION_MINOR >= 10 -static inline uint32_t -xdg_popup_get_version(struct xdg_popup_v5 *xdg_popup) -{ - return wl_proxy_get_version((struct wl_proxy *) xdg_popup); -} -#endif - -/** - * @ingroup iface_xdg_popup - * - * This destroys the popup. Explicitly destroying the xdg_popup - * object will also dismiss the popup, and unmap the surface. - * - * If this xdg_popup_v5 is not the "topmost" popup, a protocol error - * will be sent. - */ -static inline void -xdg_popup_destroy(struct xdg_popup_v5 *xdg_popup) -{ - wl_proxy_marshal((struct wl_proxy *) xdg_popup, - XDG_POPUP_DESTROY); - - wl_proxy_destroy((struct wl_proxy *) xdg_popup); -} - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/pregenerated/3rdparty/wayland-xdg-shell-unstable-v5-protocol.c b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/pregenerated/3rdparty/wayland-xdg-shell-unstable-v5-protocol.c deleted file mode 100644 index 50a42437cf5..00000000000 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/pregenerated/3rdparty/wayland-xdg-shell-unstable-v5-protocol.c +++ /dev/null @@ -1,126 +0,0 @@ -/* Generated by wayland-scanner 1.13.0 */ -// Hand-edited to resolve conflicts with xdg-shell stable - -/* - * Copyright © 2008-2013 Kristian Høgsberg - * Copyright © 2013 Rafael Antognolli - * Copyright © 2013 Jasper St. Pierre - * Copyright © 2010-2013 Intel Corporation - * - * 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 -#include -#include "wayland-util.h" - -extern const struct wl_interface wl_output_interface; -extern const struct wl_interface wl_seat_interface; -extern const struct wl_interface wl_surface_interface; -extern const struct wl_interface xdg_popup_v5_interface; -extern const struct wl_interface xdg_surface_v5_interface; - -static const struct wl_interface *types[] = { - NULL, - NULL, - NULL, - NULL, - &xdg_surface_v5_interface, - &wl_surface_interface, - &xdg_popup_v5_interface, - &wl_surface_interface, - &wl_surface_interface, - &wl_seat_interface, - NULL, - NULL, - NULL, - &xdg_surface_v5_interface, - &wl_seat_interface, - NULL, - NULL, - NULL, - &wl_seat_interface, - NULL, - &wl_seat_interface, - NULL, - NULL, - &wl_output_interface, -}; - -static const struct wl_message xdg_shell_requests[] = { - { "destroy", "", types + 0 }, - { "use_unstable_version", "i", types + 0 }, - { "get_xdg_surface", "no", types + 4 }, - { "get_xdg_popup", "nooouii", types + 6 }, - { "pong", "u", types + 0 }, -}; - -static const struct wl_message xdg_shell_events[] = { - { "ping", "u", types + 0 }, -}; - -WL_EXPORT const struct wl_interface xdg_shell_v5_interface = { - "xdg_shell", 1, - 5, xdg_shell_requests, - 1, xdg_shell_events, -}; - -static const struct wl_message xdg_surface_requests[] = { - { "destroy", "", types + 0 }, - { "set_parent", "?o", types + 13 }, - { "set_title", "s", types + 0 }, - { "set_app_id", "s", types + 0 }, - { "show_window_menu", "ouii", types + 14 }, - { "move", "ou", types + 18 }, - { "resize", "ouu", types + 20 }, - { "ack_configure", "u", types + 0 }, - { "set_window_geometry", "iiii", types + 0 }, - { "set_maximized", "", types + 0 }, - { "unset_maximized", "", types + 0 }, - { "set_fullscreen", "?o", types + 23 }, - { "unset_fullscreen", "", types + 0 }, - { "set_minimized", "", types + 0 }, -}; - -static const struct wl_message xdg_surface_events[] = { - { "configure", "iiau", types + 0 }, - { "close", "", types + 0 }, -}; - -WL_EXPORT const struct wl_interface xdg_surface_v5_interface = { - "xdg_surface", 1, - 14, xdg_surface_requests, - 2, xdg_surface_events, -}; - -static const struct wl_message xdg_popup_requests[] = { - { "destroy", "", types + 0 }, -}; - -static const struct wl_message xdg_popup_events[] = { - { "popup_done", "", types + 0 }, -}; - -WL_EXPORT const struct wl_interface xdg_popup_v5_interface = { - "xdg_popup", 1, - 1, xdg_popup_requests, - 1, xdg_popup_events, -}; - diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/pregenerated/xdg-shell-v5.pri b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/pregenerated/xdg-shell-v5.pri deleted file mode 100644 index 2990fd0f669..00000000000 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/pregenerated/xdg-shell-v5.pri +++ /dev/null @@ -1,12 +0,0 @@ -# Putting pregenerated files in a 3rdparty directory to avoid -# qtqa's license checking failing. - -HEADERS += \ - $$PWD/3rdparty/qwayland-xdg-shell-unstable-v5_p.h \ - $$PWD/3rdparty/wayland-xdg-shell-unstable-v5-client-protocol_p.h - -SOURCES += \ - $$PWD/3rdparty/qwayland-xdg-shell-unstable-v5.cpp \ - $$PWD/3rdparty/wayland-xdg-shell-unstable-v5-protocol.c - -INCLUDEPATH += $$PWD/3rdparty diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgpopupv5.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgpopupv5.cpp deleted file mode 100644 index 85d25e3c07a..00000000000 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgpopupv5.cpp +++ /dev/null @@ -1,72 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qwaylandxdgpopupv5_p.h" - -#include -#include -#include - -QT_BEGIN_NAMESPACE - -namespace QtWaylandClient { - -QWaylandXdgPopupV5::QWaylandXdgPopupV5(struct ::xdg_popup_v5 *popup, QWaylandWindow *window) - : QWaylandShellSurface(window) - , QtWayland::xdg_popup_v5(popup) - , m_window(window) -{ - if (window->display()->windowExtension()) - m_extendedWindow = new QWaylandExtendedSurface(window); -} - -QWaylandXdgPopupV5::~QWaylandXdgPopupV5() -{ - xdg_popup_destroy(object()); - delete m_extendedWindow; -} - -void QWaylandXdgPopupV5::xdg_popup_popup_done() -{ - m_window->window()->close(); -} - -} - -QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgpopupv5_p.h b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgpopupv5_p.h deleted file mode 100644 index 7494f6a67ea..00000000000 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgpopupv5_p.h +++ /dev/null @@ -1,88 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the config.tests of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QWAYLANDXDGPOPUPV5_P_H -#define QWAYLANDXDGPOPUPV5_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include "qwayland-xdg-shell-unstable-v5_p.h" - -#include -#include - -QT_BEGIN_NAMESPACE - -class QWindow; - -namespace QtWaylandClient { - -class QWaylandWindow; -class QWaylandExtendedSurface; - -class Q_WAYLAND_CLIENT_EXPORT QWaylandXdgPopupV5 : public QWaylandShellSurface - , public QtWayland::xdg_popup_v5 -{ - Q_OBJECT -public: - QWaylandXdgPopupV5(struct ::xdg_popup_v5 *popup, QWaylandWindow *window); - ~QWaylandXdgPopupV5() override; - -protected: - void xdg_popup_popup_done() override; - -private: - QWaylandExtendedSurface *m_extendedWindow = nullptr; - QWaylandWindow *m_window = nullptr; -}; - -QT_END_NAMESPACE - -} - -#endif // QWAYLANDXDGPOPUPV5_P_H diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshellv5.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshellv5.cpp deleted file mode 100644 index 7e242c4a532..00000000000 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshellv5.cpp +++ /dev/null @@ -1,104 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Eurogiciel, author: -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the config.tests of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qwaylandxdgshellv5_p.h" -#include "qwaylandxdgpopupv5_p.h" -#include "qwaylandxdgsurfacev5_p.h" - -#include - -#include -#include -#include -#include - -QT_BEGIN_NAMESPACE - -namespace QtWaylandClient { - -QWaylandXdgShellV5::QWaylandXdgShellV5(struct ::wl_registry *registry, uint32_t id) - : QtWayland::xdg_shell_v5(registry, id, 1) -{ - use_unstable_version(QtWayland::xdg_shell_v5::version_current); -} - -QWaylandXdgShellV5::~QWaylandXdgShellV5() -{ - xdg_shell_destroy(object()); -} - -QWaylandXdgSurfaceV5 *QWaylandXdgShellV5::createXdgSurface(QWaylandWindow *window) -{ - return new QWaylandXdgSurfaceV5(this, window); -} - -QWaylandXdgPopupV5 *QWaylandXdgShellV5::createXdgPopup(QWaylandWindow *window, QWaylandInputDevice *inputDevice) -{ - QWaylandWindow *parentWindow = m_popups.empty() ? window->transientParent() : m_popups.last(); - if (!parentWindow) - return nullptr; - - ::wl_surface *parentSurface = parentWindow->wlSurface(); - - if (m_popupSerial == 0) - m_popupSerial = inputDevice->serial(); - ::wl_seat *seat = inputDevice->wl_seat(); - - QPoint position = window->geometry().topLeft() - parentWindow->geometry().topLeft(); - int x = position.x() + parentWindow->frameMargins().left(); - int y = position.y() + parentWindow->frameMargins().top(); - - auto popup = new QWaylandXdgPopupV5(get_xdg_popup(window->wlSurface(), parentSurface, seat, m_popupSerial, x, y), window); - m_popups.append(window); - QObject::connect(popup, &QWaylandXdgPopupV5::destroyed, [this, window](){ - m_popups.removeOne(window); - if (m_popups.empty()) - m_popupSerial = 0; - }); - return popup; -} - -void QWaylandXdgShellV5::xdg_shell_ping(uint32_t serial) -{ - pong(serial); -} - -} - -QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshellv5_p.h b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshellv5_p.h deleted file mode 100644 index d0bdc8bc688..00000000000 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshellv5_p.h +++ /dev/null @@ -1,93 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Eurogiciel, author: -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the config.tests of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QWAYLANDXDGSHELLV5_H -#define QWAYLANDXDGSHELLV5_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include "qwayland-xdg-shell-unstable-v5_p.h" - -#include -#include - -#include -#include - -QT_BEGIN_NAMESPACE - -class QWindow; - -namespace QtWaylandClient { - -class QWaylandWindow; -class QWaylandInputDevice; -class QWaylandXdgSurfaceV5; -class QWaylandXdgPopupV5; - -class Q_WAYLAND_CLIENT_EXPORT QWaylandXdgShellV5 : public QtWayland::xdg_shell_v5 -{ -public: - QWaylandXdgShellV5(struct ::wl_registry *registry, uint32_t id); - ~QWaylandXdgShellV5() override; - - QWaylandXdgSurfaceV5 *createXdgSurface(QWaylandWindow *window); - QWaylandXdgPopupV5 *createXdgPopup(QWaylandWindow *window, QWaylandInputDevice *inputDevice); - -private: - void xdg_shell_ping(uint32_t serial) override; - - QList m_popups; - uint m_popupSerial = 0; -}; - -QT_END_NAMESPACE - -} - -#endif // QWAYLANDXDGSHELLV5_H diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshellv5integration.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshellv5integration.cpp deleted file mode 100644 index 4e25949fa30..00000000000 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshellv5integration.cpp +++ /dev/null @@ -1,97 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qwaylandxdgshellv5integration_p.h" -#include "qwaylandxdgsurfacev5_p.h" -#include "qwaylandxdgpopupv5_p.h" -#include "qwaylandxdgshellv5_p.h" - -#include -#include - -QT_BEGIN_NAMESPACE - -namespace QtWaylandClient { - -bool QWaylandXdgShellV5Integration::initialize(QWaylandDisplay *display) -{ - const auto globals = display->globals(); - for (QWaylandDisplay::RegistryGlobal global : globals) { - if (global.interface == QLatin1String("xdg_shell")) { - m_xdgShell.reset(new QWaylandXdgShellV5(display->wl_registry(), global.id)); - break; - } - } - - if (!m_xdgShell) { - qWarning() << "Couldn't find global xdg_shell for xdg-shell unstable v5"; - return false; - } - - qCWarning(lcQpaWayland) << "\"xdg-shell-v5\" is a deprecated shell extension, prefer using" - << "\"xdg-shell-v6\" or \"xdg-shell\" if supported by the compositor" - << "by setting the environment variable QT_WAYLAND_SHELL_INTEGRATION"; - - return QWaylandShellIntegration::initialize(display); -} - -QWaylandShellSurface *QWaylandXdgShellV5Integration::createShellSurface(QWaylandWindow *window) -{ - QWaylandInputDevice *inputDevice = window->display()->lastInputDevice(); - if (window->window()->type() == Qt::WindowType::Popup && inputDevice) { - if (auto *popup = m_xdgShell->createXdgPopup(window, inputDevice)) - return popup; - - qWarning(lcQpaWayland) << "Failed to create xdg-popup v5 for window" << window->window() - << "falling back to creating an xdg-surface"; - } - - return m_xdgShell->createXdgSurface(window); -} - -void QWaylandXdgShellV5Integration::handleKeyboardFocusChanged(QWaylandWindow *newFocus, QWaylandWindow *oldFocus) { - if (newFocus && qobject_cast(newFocus->shellSurface())) - m_display->handleWindowActivated(newFocus); - if (oldFocus && qobject_cast(oldFocus->shellSurface())) - m_display->handleWindowDeactivated(oldFocus); -} - -} - -QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshellv5integration_p.h b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshellv5integration_p.h deleted file mode 100644 index ce6bdb9eebf..00000000000 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshellv5integration_p.h +++ /dev/null @@ -1,80 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QWAYLANDXDGSHELLV5INTEGRATION_P_H -#define QWAYLANDXDGSHELLV5INTEGRATION_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include "qwaylandxdgshellv5_p.h" - -#include - -QT_BEGIN_NAMESPACE - -namespace QtWaylandClient { - -class QWaylandXdgShellV5; - -class Q_WAYLAND_CLIENT_EXPORT QWaylandXdgShellV5Integration : public QWaylandShellIntegration -{ -public: - QWaylandXdgShellV5Integration() {} - bool initialize(QWaylandDisplay *display) override; - QWaylandShellSurface *createShellSurface(QWaylandWindow *window) override; - void handleKeyboardFocusChanged(QWaylandWindow *newFocus, QWaylandWindow *oldFocus) override; - -private: - QScopedPointer m_xdgShell; -}; - -} - -QT_END_NAMESPACE - -#endif // QWAYLANDXDGSHELLV5INTEGRATION_P_H diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgsurfacev5.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgsurfacev5.cpp deleted file mode 100644 index 770fad7e853..00000000000 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgsurfacev5.cpp +++ /dev/null @@ -1,246 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2018 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the config.tests of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qwaylandxdgsurfacev5_p.h" -#include "qwaylandxdgshellv5_p.h" - -#include -#include -#include -#include -#include -#include -#include - -QT_BEGIN_NAMESPACE - -namespace QtWaylandClient { - -QWaylandXdgSurfaceV5::QWaylandXdgSurfaceV5(QWaylandXdgShellV5 *shell, QWaylandWindow *window) - : QWaylandShellSurface(window) - , QtWayland::xdg_surface_v5(shell->get_xdg_surface(window->wlSurface())) - , m_window(window) - , m_shell(shell) -{ - if (window->display()->windowExtension()) - m_extendedWindow = new QWaylandExtendedSurface(window); - - updateTransientParent(window->transientParent()); -} - -QWaylandXdgSurfaceV5::~QWaylandXdgSurfaceV5() -{ - if (m_acked.states & Qt::WindowActive) - window()->display()->handleWindowDeactivated(m_window); - - xdg_surface_destroy(object()); - delete m_extendedWindow; -} - -QtWayland::xdg_surface_v5::resize_edge QWaylandXdgSurfaceV5::convertToResizeEdges(Qt::Edges edges) -{ - return static_cast( - ((edges & Qt::TopEdge) ? resize_edge_top : 0) - | ((edges & Qt::BottomEdge) ? resize_edge_bottom : 0) - | ((edges & Qt::LeftEdge) ? resize_edge_left : 0) - | ((edges & Qt::RightEdge) ? resize_edge_right : 0)); -} - -bool QWaylandXdgSurfaceV5::resize(QWaylandInputDevice *inputDevice, Qt::Edges edges) -{ - resize_edge resizeEdges = convertToResizeEdges(edges); - resize(inputDevice->wl_seat(), inputDevice->serial(), resizeEdges); - return true; -} - -bool QWaylandXdgSurfaceV5::move(QWaylandInputDevice *inputDevice) -{ - move(inputDevice->wl_seat(), - inputDevice->serial()); - return true; -} - -bool QWaylandXdgSurfaceV5::showWindowMenu(QWaylandInputDevice *seat) -{ - QPoint position = seat->pointerSurfacePosition().toPoint(); - show_window_menu(seat->wl_seat(), seat->serial(), position.x(), position.y()); - return true; -} - -void QWaylandXdgSurfaceV5::updateTransientParent(QWaylandWindow *parent) -{ - if (!parent) - return; - auto parentXdgSurface = qobject_cast(parent->shellSurface()); - Q_ASSERT(parentXdgSurface); - set_parent(parentXdgSurface->object()); -} - -void QWaylandXdgSurfaceV5::setTitle(const QString & title) -{ - return QtWayland::xdg_surface_v5::set_title(title); -} - -void QWaylandXdgSurfaceV5::setAppId(const QString & appId) -{ - return QtWayland::xdg_surface_v5::set_app_id(appId); -} - -void QWaylandXdgSurfaceV5::raise() -{ - if (m_extendedWindow) - m_extendedWindow->raise(); -} - -void QWaylandXdgSurfaceV5::lower() -{ - if (m_extendedWindow) - m_extendedWindow->lower(); -} - -void QWaylandXdgSurfaceV5::setContentOrientationMask(Qt::ScreenOrientations orientation) -{ - if (m_extendedWindow) - m_extendedWindow->setContentOrientationMask(orientation); -} - -void QWaylandXdgSurfaceV5::setWindowFlags(Qt::WindowFlags flags) -{ - if (m_extendedWindow) - m_extendedWindow->setWindowFlags(flags); -} - -void QWaylandXdgSurfaceV5::sendProperty(const QString &name, const QVariant &value) -{ - if (m_extendedWindow) - m_extendedWindow->updateGenericProperty(name, value); -} - -void QWaylandXdgSurfaceV5::applyConfigure() -{ - if (m_pending.isResizing) - m_normalSize = m_pending.size; - else if (!(m_acked.states & (Qt::WindowMaximized|Qt::WindowFullScreen))) - m_normalSize = m_window->window()->frameGeometry().size(); - - if ((m_pending.states & Qt::WindowActive) && !(m_acked.states & Qt::WindowActive)) - m_window->display()->handleWindowActivated(m_window); - - if (!(m_pending.states & Qt::WindowActive) && (m_acked.states & Qt::WindowActive)) - m_window->display()->handleWindowDeactivated(m_window); - - // TODO: none of the other plugins send WindowActive either, but is it on purpose? - Qt::WindowStates statesWithoutActive = m_pending.states & ~Qt::WindowActive; - - m_window->handleWindowStatesChanged(statesWithoutActive); - if (!m_pending.size.isEmpty()) - m_window->resizeFromApplyConfigure(m_pending.size); - else if (!m_normalSize.isEmpty()) - m_window->resizeFromApplyConfigure(m_normalSize); - ack_configure(m_pending.serial); - m_acked = m_pending; -} - -void QWaylandXdgSurfaceV5::requestWindowStates(Qt::WindowStates states) -{ - Qt::WindowStates changedStates = m_acked.states ^ states; - - if (changedStates & Qt::WindowMaximized) { - if (states & Qt::WindowMaximized) - set_maximized(); - else - unset_maximized(); - } - - if (changedStates & Qt::WindowFullScreen) { - if (states & Qt::WindowFullScreen) - set_fullscreen(nullptr); - else - unset_fullscreen(); - } - - // Minimized state is not reported by the protocol, so always send it - if (states & Qt::WindowMinimized) { - set_minimized(); - window()->handleWindowStatesChanged(states & ~Qt::WindowMinimized); - } -} - -bool QWaylandXdgSurfaceV5::wantsDecorations() const -{ - return !(m_pending.states & Qt::WindowFullScreen); -} - -void QWaylandXdgSurfaceV5::xdg_surface_configure(int32_t width, int32_t height, struct wl_array *states,uint32_t serial) -{ - uint32_t *xdgStates = reinterpret_cast(states->data); - size_t numStates = states->size / sizeof(uint32_t); - m_pending.serial = serial; - m_pending.size = QSize(width, height); - m_pending.isResizing = false; - m_pending.states = Qt::WindowNoState; - for (size_t i = 0; i < numStates; i++) { - switch (xdgStates[i]) { - case XDG_SURFACE_STATE_MAXIMIZED: - m_pending.states |= Qt::WindowMaximized; - break; - case XDG_SURFACE_STATE_FULLSCREEN: - m_pending.states |= Qt::WindowFullScreen; - break; - case XDG_SURFACE_STATE_RESIZING: - m_pending.isResizing = true; - break; - case XDG_SURFACE_STATE_ACTIVATED: - m_pending.states |= Qt::WindowActive; - break; - default: - break; - } - } - m_window->applyConfigureWhenPossible(); -} - -void QWaylandXdgSurfaceV5::xdg_surface_close() -{ - m_window->window()->close(); -} - -} - -QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgsurfacev5_p.h b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgsurfacev5_p.h deleted file mode 100644 index bf221079e99..00000000000 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgsurfacev5_p.h +++ /dev/null @@ -1,131 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the config.tests of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QWAYLANDXDGSURFACEV5_P_H -#define QWAYLANDXDGSURFACEV5_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include "qwayland-xdg-shell-unstable-v5_p.h" - -#include -#include - -#include -#include - -QT_BEGIN_NAMESPACE - -class QWindow; - -namespace QtWaylandClient { - -class QWaylandWindow; -class QWaylandInputDevice; -class QWaylandExtendedSurface; -class QWaylandXdgShellV5; - -class Q_WAYLAND_CLIENT_EXPORT QWaylandXdgSurfaceV5 : public QWaylandShellSurface - , public QtWayland::xdg_surface_v5 -{ - Q_OBJECT -public: - QWaylandXdgSurfaceV5(QWaylandXdgShellV5 *shell, QWaylandWindow *window); - ~QWaylandXdgSurfaceV5() override; - - using QtWayland::xdg_surface_v5::resize; - static resize_edge convertToResizeEdges(Qt::Edges edges); - bool resize(QWaylandInputDevice *inputDevice, Qt::Edges edges) override; - - using QtWayland::xdg_surface_v5::move; - bool move(QWaylandInputDevice *inputDevice) override; - bool showWindowMenu(QWaylandInputDevice *seat) override; - - void setTitle(const QString &title) override; - void setAppId(const QString &appId) override; - - void raise() override; - void lower() override; - void setContentOrientationMask(Qt::ScreenOrientations orientation) override; - void setWindowFlags(Qt::WindowFlags flags) override; - void sendProperty(const QString &name, const QVariant &value) override; - - void applyConfigure() override; - void requestWindowStates(Qt::WindowStates states) override; - bool wantsDecorations() const override; - -private: - void updateTransientParent(QWaylandWindow *parent); - -private: - QWaylandWindow *m_window = nullptr; - QWaylandXdgShellV5* m_shell = nullptr; - struct { - Qt::WindowStates states = Qt::WindowNoState; - bool isResizing = false; - QSize size = {0, 0}; - uint serial = 0; - } m_acked, m_pending; - QSize m_normalSize; - QMargins m_margins; - QWaylandExtendedSurface *m_extendedWindow = nullptr; - - void xdg_surface_configure(int32_t width, - int32_t height, - struct wl_array *states, - uint32_t serial) override; - void xdg_surface_close() override; - - friend class QWaylandWindow; -}; - -QT_END_NAMESPACE - -} - -#endif // QWAYLANDXDGSURFACEV5_P_H diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/xdg-shell-v5.json b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/xdg-shell-v5.json deleted file mode 100644 index ba1ed448920..00000000000 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/xdg-shell-v5.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "Keys":[ "xdg-shell-v5" ] -} diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/xdg-shell-v5.pro b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/xdg-shell-v5.pro deleted file mode 100644 index 4f6dde9bcf6..00000000000 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/xdg-shell-v5.pro +++ /dev/null @@ -1,29 +0,0 @@ -QT += gui-private waylandclient-private -CONFIG += wayland-scanner - -QMAKE_USE += wayland-client - -qtConfig(xkbcommon): \ - QMAKE_USE += xkbcommon - -HEADERS += \ - qwaylandxdgpopupv5_p.h \ - qwaylandxdgshellv5_p.h \ - qwaylandxdgshellv5integration_p.h \ - qwaylandxdgsurfacev5_p.h \ - -SOURCES += \ - main.cpp \ - qwaylandxdgpopupv5.cpp \ - qwaylandxdgshellv5.cpp \ - qwaylandxdgshellv5integration.cpp \ - qwaylandxdgsurfacev5.cpp \ - -include (pregenerated/xdg-shell-v5.pri) - -OTHER_FILES += \ - xdg-shell-v5.json - -PLUGIN_TYPE = wayland-shell-integration -PLUGIN_CLASS_NAME = QWaylandXdgShellV5IntegrationPlugin -load(qt_plugin) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/CMakeLists.txt deleted file mode 100644 index 4ea237f6a69..00000000000 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/CMakeLists.txt +++ /dev/null @@ -1,36 +0,0 @@ -# Generated from xdg-shell-v6.pro. - -##################################################################### -## QWaylandXdgShellV6IntegrationPlugin Plugin: -##################################################################### - -qt_internal_add_plugin(QWaylandXdgShellV6IntegrationPlugin - OUTPUT_NAME xdg-shell-v6 - TYPE wayland-shell-integration - SOURCES - main.cpp - qwaylandxdgshellv6.cpp qwaylandxdgshellv6_p.h - qwaylandxdgshellv6integration.cpp qwaylandxdgshellv6integration_p.h - PUBLIC_LIBRARIES - Qt::Core - Qt::Gui - Qt::GuiPrivate - Qt::WaylandClientPrivate - Wayland::Client -) - -qt6_generate_wayland_protocol_client_sources(QWaylandXdgShellV6IntegrationPlugin - FILES - ${CMAKE_CURRENT_SOURCE_DIR}/../../../3rdparty/protocol/xdg-shell-unstable-v6.xml -) - -#### Keys ignored in scope 1:.:.:xdg-shell-v6.pro:: -# OTHER_FILES = "xdg-shell-v6.json" - -## Scopes: -##################################################################### - -qt_internal_extend_target(QWaylandXdgShellV6IntegrationPlugin CONDITION QT_FEATURE_xkbcommon - LIBRARIES - XKB::XKB -) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/main.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/main.cpp deleted file mode 100644 index 8cd302f328a..00000000000 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/main.cpp +++ /dev/null @@ -1,68 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2018 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qwaylandxdgshellv6integration_p.h" - -#include - -QT_BEGIN_NAMESPACE - -namespace QtWaylandClient { - -class QWaylandXdgShellV6IntegrationPlugin : public QWaylandShellIntegrationPlugin -{ - Q_OBJECT - Q_PLUGIN_METADATA(IID QWaylandShellIntegrationFactoryInterface_iid FILE "xdg-shell-v6.json") - -public: - QWaylandShellIntegration *create(const QString &key, const QStringList ¶mList) override; -}; - -QWaylandShellIntegration *QWaylandXdgShellV6IntegrationPlugin::create(const QString &key, const QStringList ¶mList) -{ - Q_UNUSED(key); - Q_UNUSED(paramList); - return new QWaylandXdgShellV6Integration(); -} - -} - -QT_END_NAMESPACE - -#include "main.moc" diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp deleted file mode 100644 index c137b308bc0..00000000000 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp +++ /dev/null @@ -1,441 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Copyright (C) 2017 Eurogiciel, author: -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the config.tests of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qwaylandxdgshellv6_p.h" - -#include -#include -#include -#include -#include - -#include - -QT_BEGIN_NAMESPACE - -namespace QtWaylandClient { - -QWaylandXdgSurfaceV6::Toplevel::Toplevel(QWaylandXdgSurfaceV6 *xdgSurface) - : QtWayland::zxdg_toplevel_v6(xdgSurface->get_toplevel()) - , m_xdgSurface(xdgSurface) -{ - requestWindowStates(xdgSurface->window()->window()->windowStates()); -} - -QWaylandXdgSurfaceV6::Toplevel::~Toplevel() -{ - if (m_applied.states & Qt::WindowActive) { - QWaylandWindow *window = m_xdgSurface->window(); - window->display()->handleWindowDeactivated(window); - } - if (isInitialized()) - destroy(); -} - -void QWaylandXdgSurfaceV6::Toplevel::applyConfigure() -{ - if (!(m_applied.states & (Qt::WindowMaximized|Qt::WindowFullScreen))) - m_normalSize = m_xdgSurface->m_window->window()->frameGeometry().size(); - - if ((m_pending.states & Qt::WindowActive) && !(m_applied.states & Qt::WindowActive)) - m_xdgSurface->m_window->display()->handleWindowActivated(m_xdgSurface->m_window); - - if (!(m_pending.states & Qt::WindowActive) && (m_applied.states & Qt::WindowActive)) - m_xdgSurface->m_window->display()->handleWindowDeactivated(m_xdgSurface->m_window); - - // TODO: none of the other plugins send WindowActive either, but is it on purpose? - Qt::WindowStates statesWithoutActive = m_pending.states & ~Qt::WindowActive; - - m_xdgSurface->m_window->handleWindowStatesChanged(statesWithoutActive); - - if (m_pending.size.isEmpty()) { - // An empty size in the configure means it's up to the client to choose the size - bool normalPending = !(m_pending.states & (Qt::WindowMaximized|Qt::WindowFullScreen)); - if (normalPending && !m_normalSize.isEmpty()) - m_xdgSurface->m_window->resizeFromApplyConfigure(m_normalSize); - } else { - m_xdgSurface->m_window->resizeFromApplyConfigure(m_pending.size); - } - - m_xdgSurface->setSizeHints(); - - m_applied = m_pending; - qCDebug(lcQpaWayland) << "Applied pending zxdg_toplevel_v6 configure event:" << m_applied.size << m_applied.states; -} - -void QWaylandXdgSurfaceV6::Toplevel::zxdg_toplevel_v6_configure(int32_t width, int32_t height, wl_array *states) -{ - m_pending.size = QSize(width, height); - - auto *xdgStates = static_cast(states->data); - size_t numStates = states->size / sizeof(uint32_t); - - m_pending.states = Qt::WindowNoState; - - for (size_t i = 0; i < numStates; i++) { - switch (xdgStates[i]) { - case ZXDG_TOPLEVEL_V6_STATE_ACTIVATED: - m_pending.states |= Qt::WindowActive; - break; - case ZXDG_TOPLEVEL_V6_STATE_MAXIMIZED: - m_pending.states |= Qt::WindowMaximized; - break; - case ZXDG_TOPLEVEL_V6_STATE_FULLSCREEN: - m_pending.states |= Qt::WindowFullScreen; - break; - default: - break; - } - } - qCDebug(lcQpaWayland) << "Received zxdg_toplevel_v6.configure with" << m_pending.size - << "and" << m_pending.states; -} - -void QWaylandXdgSurfaceV6::Toplevel::zxdg_toplevel_v6_close() -{ - m_xdgSurface->m_window->window()->close(); -} - -void QWaylandXdgSurfaceV6::Toplevel::requestWindowStates(Qt::WindowStates states) -{ - // Re-send what's different from the applied state - Qt::WindowStates changedStates = m_applied.states ^ states; - - if (changedStates & Qt::WindowMaximized) { - if (states & Qt::WindowMaximized) - set_maximized(); - else - unset_maximized(); - } - - if (changedStates & Qt::WindowFullScreen) { - if (states & Qt::WindowFullScreen) - set_fullscreen(nullptr); - else - unset_fullscreen(); - } - - // Minimized state is not reported by the protocol, so always send it - if (states & Qt::WindowMinimized) { - set_minimized(); - m_xdgSurface->window()->handleWindowStatesChanged(states & ~Qt::WindowMinimized); - } -} - -QtWayland::zxdg_toplevel_v6::resize_edge QWaylandXdgSurfaceV6::Toplevel::convertToResizeEdges(Qt::Edges edges) -{ - return static_cast( - ((edges & Qt::TopEdge) ? resize_edge_top : 0) - | ((edges & Qt::BottomEdge) ? resize_edge_bottom : 0) - | ((edges & Qt::LeftEdge) ? resize_edge_left : 0) - | ((edges & Qt::RightEdge) ? resize_edge_right : 0)); -} - -QWaylandXdgSurfaceV6::Popup::Popup(QWaylandXdgSurfaceV6 *xdgSurface, QWaylandXdgSurfaceV6 *parent, - QtWayland::zxdg_positioner_v6 *positioner) - : zxdg_popup_v6(xdgSurface->get_popup(parent->object(), positioner->object())) - , m_xdgSurface(xdgSurface) - , m_parent(parent) -{ -} - -QWaylandXdgSurfaceV6::Popup::~Popup() -{ - if (isInitialized()) - destroy(); - - if (m_grabbing) { - auto *shell = m_xdgSurface->m_shell; - Q_ASSERT(shell->m_topmostGrabbingPopup == this); - shell->m_topmostGrabbingPopup = m_parent->m_popup; - } -} - -void QWaylandXdgSurfaceV6::Popup::grab(QWaylandInputDevice *seat, uint serial) -{ - m_xdgSurface->m_shell->m_topmostGrabbingPopup = this; - zxdg_popup_v6::grab(seat->wl_seat(), serial); - m_grabbing = true; -} - -void QWaylandXdgSurfaceV6::Popup::zxdg_popup_v6_popup_done() -{ - m_xdgSurface->m_window->window()->close(); -} - -QWaylandXdgSurfaceV6::QWaylandXdgSurfaceV6(QWaylandXdgShellV6 *shell, ::zxdg_surface_v6 *surface, QWaylandWindow *window) - : QWaylandShellSurface(window) - , zxdg_surface_v6(surface) - , m_shell(shell) - , m_window(window) -{ - QWaylandDisplay *display = window->display(); - Qt::WindowType type = window->window()->type(); - auto *transientParent = window->transientParent(); - - if (type == Qt::ToolTip && transientParent) { - setPopup(transientParent); - } else if (type == Qt::Popup && transientParent && display->lastInputDevice()) { - setGrabPopup(transientParent, display->lastInputDevice(), display->lastInputSerial()); - } else { - setToplevel(); - if (transientParent) { - auto parentXdgSurface = static_cast(transientParent->shellSurface()); - if (parentXdgSurface) - m_toplevel->set_parent(parentXdgSurface->m_toplevel->object()); - } - } -} - -QWaylandXdgSurfaceV6::~QWaylandXdgSurfaceV6() -{ - if (m_toplevel) { - delete m_toplevel; - m_toplevel = nullptr; - } - if (m_popup) { - delete m_popup; - m_popup = nullptr; - } - destroy(); -} - -bool QWaylandXdgSurfaceV6::resize(QWaylandInputDevice *inputDevice, Qt::Edges edges) -{ - if (!m_toplevel || !m_toplevel->isInitialized()) - return false; - - auto resizeEdges = Toplevel::convertToResizeEdges(edges); - m_toplevel->resize(inputDevice->wl_seat(), inputDevice->serial(), resizeEdges); - return true; -} - -bool QWaylandXdgSurfaceV6::move(QWaylandInputDevice *inputDevice) -{ - if (m_toplevel && m_toplevel->isInitialized()) { - m_toplevel->move(inputDevice->wl_seat(), inputDevice->serial()); - return true; - } - return false; -} - -bool QWaylandXdgSurfaceV6::showWindowMenu(QWaylandInputDevice *seat) -{ - if (m_toplevel && m_toplevel->isInitialized()) { - QPoint position = seat->pointerSurfacePosition().toPoint(); - m_toplevel->show_window_menu(seat->wl_seat(), seat->serial(), position.x(), position.y()); - return true; - } - return false; -} - -void QWaylandXdgSurfaceV6::setTitle(const QString &title) -{ - if (m_toplevel) - m_toplevel->set_title(title); -} - -void QWaylandXdgSurfaceV6::setAppId(const QString &appId) -{ - if (m_toplevel) - m_toplevel->set_app_id(appId); -} - -bool QWaylandXdgSurfaceV6::isExposed() const -{ - return m_configured || m_pendingConfigureSerial; -} - -bool QWaylandXdgSurfaceV6::handleExpose(const QRegion ®ion) -{ - if (!isExposed() && !region.isEmpty()) { - m_exposeRegion = region; - return true; - } - return false; -} - -void QWaylandXdgSurfaceV6::applyConfigure() -{ - Q_ASSERT(m_pendingConfigureSerial != 0); - - if (m_toplevel) - m_toplevel->applyConfigure(); - - m_configured = true; - ack_configure(m_pendingConfigureSerial); - - m_pendingConfigureSerial = 0; -} - -bool QWaylandXdgSurfaceV6::wantsDecorations() const -{ - return m_toplevel && !(m_toplevel->m_pending.states & Qt::WindowFullScreen); -} - -void QWaylandXdgSurfaceV6::propagateSizeHints() -{ - setSizeHints(); - - if (m_toplevel && m_window) - m_window->commit(); -} - -void QWaylandXdgSurfaceV6::setWindowGeometry(const QRect &rect) -{ - set_window_geometry(rect.x(), rect.y(), rect.width(), rect.height()); -} - -void QWaylandXdgSurfaceV6::setSizeHints() -{ - if (m_toplevel && m_window) { - const int minWidth = qMax(0, m_window->windowMinimumSize().width()); - const int minHeight = qMax(0, m_window->windowMinimumSize().height()); - m_toplevel->set_min_size(minWidth, minHeight); - - int maxWidth = qMax(0, m_window->windowMaximumSize().width()); - if (maxWidth == QWINDOWSIZE_MAX) - maxWidth = 0; - int maxHeight = qMax(0, m_window->windowMaximumSize().height()); - if (maxHeight == QWINDOWSIZE_MAX) - maxHeight = 0; - m_toplevel->set_max_size(maxWidth, maxHeight); - } -} - -void QWaylandXdgSurfaceV6::requestWindowStates(Qt::WindowStates states) -{ - if (m_toplevel) - m_toplevel->requestWindowStates(states); - else - qCDebug(lcQpaWayland) << "Ignoring window states requested by non-toplevel."; -} - -void QWaylandXdgSurfaceV6::setToplevel() -{ - Q_ASSERT(!m_toplevel && !m_popup); - m_toplevel = new Toplevel(this); -} - -void QWaylandXdgSurfaceV6::setPopup(QWaylandWindow *parent) -{ - Q_ASSERT(!m_toplevel && !m_popup); - - auto parentXdgSurface = static_cast(parent->shellSurface()); - - auto positioner = new QtWayland::zxdg_positioner_v6(m_shell->create_positioner()); - // set_popup expects a position relative to the parent - QPoint transientPos = m_window->geometry().topLeft(); // this is absolute - transientPos -= parent->geometry().topLeft(); - if (parent->decoration()) { - transientPos.setX(transientPos.x() + parent->decoration()->margins().left()); - transientPos.setY(transientPos.y() + parent->decoration()->margins().top()); - } - positioner->set_anchor_rect(transientPos.x(), transientPos.y(), 1, 1); - positioner->set_anchor(QtWayland::zxdg_positioner_v6::anchor_top | QtWayland::zxdg_positioner_v6::anchor_left); - positioner->set_gravity(QtWayland::zxdg_positioner_v6::gravity_bottom | QtWayland::zxdg_positioner_v6::gravity_right); - positioner->set_size(m_window->geometry().width(), m_window->geometry().height()); - m_popup = new Popup(this, parentXdgSurface, positioner); - positioner->destroy(); - delete positioner; -} - -void QWaylandXdgSurfaceV6::setGrabPopup(QWaylandWindow *parent, QWaylandInputDevice *device, int serial) -{ - auto parentXdgSurface = static_cast(parent->shellSurface()); - auto *top = m_shell->m_topmostGrabbingPopup; - - if (top && top->m_xdgSurface != parentXdgSurface) { - qCWarning(lcQpaWayland) << "setGrabPopup called with a parent," << parentXdgSurface - << "which does not match the current topmost grabbing popup," - << top->m_xdgSurface << "According to the xdg-shell-v6 protocol, this" - << "is not allowed. The wayland QPA plugin is currently handling" - << "it by setting the parent to the topmost grabbing popup." - << "Note, however, that this may cause positioning errors and" - << "popups closing unxpectedly because xdg-shell-v6 mandate that child" - << "popups close before parents"; - parent = top->m_xdgSurface->m_window; - } - setPopup(parent); - m_popup->grab(device, serial); -} - -void QWaylandXdgSurfaceV6::zxdg_surface_v6_configure(uint32_t serial) -{ - m_pendingConfigureSerial = serial; - if (!m_configured) { - // We have to do the initial applyConfigure() immediately, since that is the expose. - applyConfigure(); - m_exposeRegion = QRegion(QRect(QPoint(), m_window->geometry().size())); - } else { - // Later configures are probably resizes, so we have to queue them up for a time when we - // are not painting to the window. - m_window->applyConfigureWhenPossible(); - } - - if (!m_exposeRegion.isEmpty()) { - m_window->handleExpose(m_exposeRegion); - m_exposeRegion = QRegion(); - } -} - -QWaylandXdgShellV6::QWaylandXdgShellV6(struct ::wl_registry *registry, uint32_t id, uint32_t availableVersion) - : QtWayland::zxdg_shell_v6(registry, id, qMin(availableVersion, 1u)) -{ -} - -QWaylandXdgShellV6::~QWaylandXdgShellV6() -{ - destroy(); -} - -QWaylandXdgSurfaceV6 *QWaylandXdgShellV6::getXdgSurface(QWaylandWindow *window) -{ - return new QWaylandXdgSurfaceV6(this, get_xdg_surface(window->wlSurface()), window); -} - -void QWaylandXdgShellV6::zxdg_shell_v6_ping(uint32_t serial) -{ - pong(serial); -} - -} - -QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6_p.h b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6_p.h deleted file mode 100644 index 757b982b9db..00000000000 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6_p.h +++ /dev/null @@ -1,173 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Copyright (C) 2017 Eurogiciel, author: -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the config.tests of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QWAYLANDXDGSHELLV6_H -#define QWAYLANDXDGSHELLV6_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include "qwayland-xdg-shell-unstable-v6.h" - -#include -#include - -#include -#include - -QT_BEGIN_NAMESPACE - -class QWindow; - -namespace QtWaylandClient { - -class QWaylandWindow; -class QWaylandInputDevice; -class QWaylandXdgShellV6; - -class Q_WAYLAND_CLIENT_EXPORT QWaylandXdgSurfaceV6 : public QWaylandShellSurface, public QtWayland::zxdg_surface_v6 -{ - Q_OBJECT -public: - QWaylandXdgSurfaceV6(QWaylandXdgShellV6 *shell, ::zxdg_surface_v6 *surface, QWaylandWindow *window); - ~QWaylandXdgSurfaceV6() override; - - bool resize(QWaylandInputDevice *inputDevice, Qt::Edges edges) override; - bool move(QWaylandInputDevice *inputDevice) override; - bool showWindowMenu(QWaylandInputDevice *seat) override; - void setTitle(const QString &title) override; - void setAppId(const QString &appId) override; - - bool isExposed() const override; - bool handleExpose(const QRegion &) override; - bool handlesActiveState() const { return m_toplevel; } - void applyConfigure() override; - bool wantsDecorations() const override; - void propagateSizeHints() override; - void setWindowGeometry(const QRect &rect) override; - - void setSizeHints(); - -protected: - void requestWindowStates(Qt::WindowStates states) override; - void zxdg_surface_v6_configure(uint32_t serial) override; - -private: - class Toplevel: public QtWayland::zxdg_toplevel_v6 - { - public: - Toplevel(QWaylandXdgSurfaceV6 *xdgSurface); - ~Toplevel() override; - - void applyConfigure(); - - void zxdg_toplevel_v6_configure(int32_t width, int32_t height, wl_array *states) override; - void zxdg_toplevel_v6_close() override; - - void requestWindowStates(Qt::WindowStates states); - - static resize_edge convertToResizeEdges(Qt::Edges edges); - - struct { - QSize size = {0, 0}; - Qt::WindowStates states = Qt::WindowNoState; - } m_pending, m_applied; - QSize m_normalSize; - - QWaylandXdgSurfaceV6 *m_xdgSurface = nullptr; - }; - - class Popup : public QtWayland::zxdg_popup_v6 { - public: - Popup(QWaylandXdgSurfaceV6 *xdgSurface, QWaylandXdgSurfaceV6 *parent, QtWayland::zxdg_positioner_v6 *positioner); - ~Popup() override; - - void grab(QWaylandInputDevice *seat, uint serial); - void zxdg_popup_v6_popup_done() override; - - QWaylandXdgSurfaceV6 *m_xdgSurface = nullptr; - QWaylandXdgSurfaceV6 *m_parent = nullptr; - bool m_grabbing = false; - }; - - void setToplevel(); - void setPopup(QWaylandWindow *parent); - void setGrabPopup(QWaylandWindow *parent, QWaylandInputDevice *device, int serial); - - QWaylandXdgShellV6 *m_shell = nullptr; - QWaylandWindow *m_window = nullptr; - Toplevel *m_toplevel = nullptr; - Popup *m_popup = nullptr; - bool m_configured = false; - QRegion m_exposeRegion; - uint m_pendingConfigureSerial = 0; - - friend class QWaylandXdgShellV6; -}; - -class Q_WAYLAND_CLIENT_EXPORT QWaylandXdgShellV6 : public QtWayland::zxdg_shell_v6 -{ -public: - QWaylandXdgShellV6(struct ::wl_registry *registry, uint32_t id, uint32_t availableVersion); - - QWaylandXdgSurfaceV6 *getXdgSurface(QWaylandWindow *window); - - ~QWaylandXdgShellV6() override; - -private: - void zxdg_shell_v6_ping(uint32_t serial) override; - QWaylandXdgSurfaceV6::Popup *m_topmostGrabbingPopup = nullptr; - - friend class QWaylandXdgSurfaceV6; -}; - -QT_END_NAMESPACE - -} - -#endif // QWAYLANDXDGSHELLV6_H diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6integration.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6integration.cpp deleted file mode 100644 index 03164316514..00000000000 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6integration.cpp +++ /dev/null @@ -1,87 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qwaylandxdgshellv6integration_p.h" - -#include -#include - -QT_BEGIN_NAMESPACE - -namespace QtWaylandClient { - -bool QWaylandXdgShellV6Integration::initialize(QWaylandDisplay *display) -{ - for (QWaylandDisplay::RegistryGlobal global : display->globals()) { - if (global.interface == QLatin1String("zxdg_shell_v6")) { - m_xdgShell.reset(new QWaylandXdgShellV6(display->wl_registry(), global.id, global.version)); - break; - } - } - - if (!m_xdgShell) { - qCDebug(lcQpaWayland) << "Couldn't find global zxdg_shell_v6 for xdg-shell unstable v6"; - return false; - } - - return QWaylandShellIntegration::initialize(display); -} - -QWaylandShellSurface *QWaylandXdgShellV6Integration::createShellSurface(QWaylandWindow *window) -{ - return m_xdgShell->getXdgSurface(window); -} - -void QWaylandXdgShellV6Integration::handleKeyboardFocusChanged(QWaylandWindow *newFocus, QWaylandWindow *oldFocus) -{ - if (newFocus) { - auto *xdgSurface = qobject_cast(newFocus->shellSurface()); - if (xdgSurface && !xdgSurface->handlesActiveState()) - m_display->handleWindowActivated(newFocus); - } - if (oldFocus && qobject_cast(oldFocus->shellSurface())) { - auto *xdgSurface = qobject_cast(oldFocus->shellSurface()); - if (xdgSurface && !xdgSurface->handlesActiveState()) - m_display->handleWindowDeactivated(oldFocus); - } -} - -} - -QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6integration_p.h b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6integration_p.h deleted file mode 100644 index 261f8cbb4f3..00000000000 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6integration_p.h +++ /dev/null @@ -1,78 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QWAYLANDXDGSHELLV6INTEGRATION_P_H -#define QWAYLANDXDGSHELLV6INTEGRATION_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include "qwaylandxdgshellv6_p.h" - -#include - -QT_BEGIN_NAMESPACE - -namespace QtWaylandClient { - -class Q_WAYLAND_CLIENT_EXPORT QWaylandXdgShellV6Integration : public QWaylandShellIntegration -{ -public: - QWaylandXdgShellV6Integration() {} - bool initialize(QWaylandDisplay *display) override; - QWaylandShellSurface *createShellSurface(QWaylandWindow *window) override; - void handleKeyboardFocusChanged(QWaylandWindow *newFocus, QWaylandWindow *oldFocus) override; - -private: - QScopedPointer m_xdgShell; -}; - -} - -QT_END_NAMESPACE - -#endif // QWAYLANDXDGSHELLV6INTEGRATION_P_H diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/xdg-shell-v6.json b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/xdg-shell-v6.json deleted file mode 100644 index b1b8db31b4f..00000000000 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/xdg-shell-v6.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "Keys":[ "xdg-shell-v6" ] -} diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/xdg-shell-v6.pro b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/xdg-shell-v6.pro deleted file mode 100644 index 3c1aaee818e..00000000000 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v6/xdg-shell-v6.pro +++ /dev/null @@ -1,25 +0,0 @@ -QT += gui-private waylandclient-private -CONFIG += wayland-scanner - -QMAKE_USE += wayland-client -qtConfig(xkbcommon): \ - QMAKE_USE_PRIVATE += xkbcommon - -WAYLANDCLIENTSOURCES += \ - ../../../3rdparty/protocol/xdg-shell-unstable-v6.xml - -HEADERS += \ - qwaylandxdgshellv6_p.h \ - qwaylandxdgshellv6integration_p.h \ - -SOURCES += \ - main.cpp \ - qwaylandxdgshellv6.cpp \ - qwaylandxdgshellv6integration.cpp \ - -OTHER_FILES += \ - xdg-shell-v6.json - -PLUGIN_TYPE = wayland-shell-integration -PLUGIN_CLASS_NAME = QWaylandXdgShellV6IntegrationPlugin -load(qt_plugin) diff --git a/src/plugins/platforms/wayland/qwaylandintegration.cpp b/src/plugins/platforms/wayland/qwaylandintegration.cpp index 764acc2d919..868cdd61548 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandintegration.cpp @@ -399,13 +399,6 @@ void QWaylandIntegration::initializeShellIntegration() preferredShells = targetKeys.split(QLatin1Char(';')); } else { preferredShells << QLatin1String("xdg-shell"); - preferredShells << QLatin1String("xdg-shell-v6"); - QString useXdgShell = QString::fromLocal8Bit(qgetenv("QT_WAYLAND_USE_XDG_SHELL")); - if (!useXdgShell.isEmpty() && useXdgShell != QLatin1String("0")) { - qWarning() << "QT_WAYLAND_USE_XDG_SHELL is deprecated, " - "please specify the shell using QT_WAYLAND_SHELL_INTEGRATION instead"; - preferredShells << QLatin1String("xdg-shell-v5"); - } preferredShells << QLatin1String("wl-shell") << QLatin1String("ivi-shell"); } diff --git a/tests/auto/wayland/CMakeLists.txt b/tests/auto/wayland/CMakeLists.txt index 5939853ccd4..783546045da 100644 --- a/tests/auto/wayland/CMakeLists.txt +++ b/tests/auto/wayland/CMakeLists.txt @@ -15,7 +15,6 @@ add_subdirectory(wl_connect) add_subdirectory(xdgdecorationv1) add_subdirectory(xdgoutput) add_subdirectory(xdgshell) -add_subdirectory(xdgshellv6) if(QT_FEATURE_im) add_subdirectory(inputcontext) endif() diff --git a/tests/auto/wayland/client.pro b/tests/auto/wayland/client.pro index 46a3aa42ec0..7f5ffc0f7bd 100644 --- a/tests/auto/wayland/client.pro +++ b/tests/auto/wayland/client.pro @@ -15,7 +15,6 @@ SUBDIRS += \ wl_connect \ xdgdecorationv1 \ xdgoutput \ - xdgshell \ - xdgshellv6 + xdgshell qtConfig(im): SUBDIRS += inputcontext diff --git a/tests/auto/wayland/client/.prev_CMakeLists.txt b/tests/auto/wayland/client/.prev_CMakeLists.txt index cdcae2ff158..0aeb3f27f0c 100644 --- a/tests/auto/wayland/client/.prev_CMakeLists.txt +++ b/tests/auto/wayland/client/.prev_CMakeLists.txt @@ -14,7 +14,6 @@ qt_internal_add_test(tst_client ../shared_old/mockregion.cpp ../shared_old/mockregion.h ../shared_old/mocksurface.cpp ../shared_old/mocksurface.h ../shared_old/mockwlshell.cpp ../shared_old/mockwlshell.h - ../shared_old/mockxdgshellv6.cpp ../shared_old/mockxdgshellv6.h tst_client.cpp INCLUDE_DIRECTORIES ../shared_old @@ -33,7 +32,7 @@ qt6_generate_wayland_protocol_server_sources(tst_client ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/fullscreen-shell-unstable-v1.xml ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/ivi-application.xml ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/wayland.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/xdg-shell-unstable-v6.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/xdg-shell.xml ) #### Keys ignored in scope 1:.:.:client.pro:: diff --git a/tests/auto/wayland/client/CMakeLists.txt b/tests/auto/wayland/client/CMakeLists.txt index 86eb420e5ca..2b6df4a3d36 100644 --- a/tests/auto/wayland/client/CMakeLists.txt +++ b/tests/auto/wayland/client/CMakeLists.txt @@ -14,7 +14,6 @@ qt_internal_add_test(tst_client ../shared_old/mockregion.cpp ../shared_old/mockregion.h ../shared_old/mocksurface.cpp ../shared_old/mocksurface.h ../shared_old/mockwlshell.cpp ../shared_old/mockwlshell.h - ../shared_old/mockxdgshellv6.cpp ../shared_old/mockxdgshellv6.h tst_client.cpp INCLUDE_DIRECTORIES ../shared_old @@ -34,7 +33,7 @@ qt6_generate_wayland_protocol_server_sources(tst_client ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/fullscreen-shell-unstable-v1.xml ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/ivi-application.xml ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/wayland.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/xdg-shell-unstable-v6.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/xdg-shell.xml ) #### Keys ignored in scope 1:.:.:client.pro:: diff --git a/tests/auto/wayland/client/run-with-all-shells.sh b/tests/auto/wayland/client/run-with-all-shells.sh index 41f383900ea..5acd85a4644 100755 --- a/tests/auto/wayland/client/run-with-all-shells.sh +++ b/tests/auto/wayland/client/run-with-all-shells.sh @@ -3,4 +3,3 @@ set -ex $@ env QT_WAYLAND_SHELL_INTEGRATION=wl-shell $@ env QT_WAYLAND_SHELL_INTEGRATION=ivi-shell $@ -env QT_WAYLAND_SHELL_INTEGRATION=xdg-shell-v6 $@ diff --git a/tests/auto/wayland/client/tst_client.cpp b/tests/auto/wayland/client/tst_client.cpp index ad63eca0a7d..9c99220d0f8 100644 --- a/tests/auto/wayland/client/tst_client.cpp +++ b/tests/auto/wayland/client/tst_client.cpp @@ -167,7 +167,6 @@ public slots: // and don't show up as false positives in the next test QTRY_VERIFY(!compositor->surface()); QTRY_VERIFY(!compositor->iviSurface()); - QTRY_VERIFY(!compositor->xdgToplevelV6()); } private slots: @@ -212,9 +211,6 @@ void tst_WaylandClient::activeWindowFollowsKeyboardFocus() QTRY_VERIFY(window.isExposed()); - if (compositor->xdgToplevelV6()) - QSKIP("On xdg-shell v6 focus is handled by configure events"); - QCOMPARE(window.focusInEventCount, 0); compositor->setKeyboardFocus(surface); QTRY_COMPARE(window.focusInEventCount, 1); diff --git a/tests/auto/wayland/fullscreenshellv1/.prev_CMakeLists.txt b/tests/auto/wayland/fullscreenshellv1/.prev_CMakeLists.txt index c3e375c0f19..ca850796223 100644 --- a/tests/auto/wayland/fullscreenshellv1/.prev_CMakeLists.txt +++ b/tests/auto/wayland/fullscreenshellv1/.prev_CMakeLists.txt @@ -14,7 +14,6 @@ qt_internal_add_test(tst_client_fullscreenshellv1 ../shared_old/mockregion.cpp ../shared_old/mockregion.h ../shared_old/mocksurface.cpp ../shared_old/mocksurface.h ../shared_old/mockwlshell.cpp ../shared_old/mockwlshell.h - ../shared_old/mockxdgshellv6.cpp ../shared_old/mockxdgshellv6.h tst_fullscreenshellv1.cpp INCLUDE_DIRECTORIES ../shared_old @@ -33,5 +32,5 @@ qt6_generate_wayland_protocol_server_sources(tst_client_fullscreenshellv1 ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/fullscreen-shell-unstable-v1.xml ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/ivi-application.xml ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/wayland.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/xdg-shell-unstable-v6.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/xdg-shell.xml ) diff --git a/tests/auto/wayland/fullscreenshellv1/CMakeLists.txt b/tests/auto/wayland/fullscreenshellv1/CMakeLists.txt index 42d328a6481..4a64b9e2872 100644 --- a/tests/auto/wayland/fullscreenshellv1/CMakeLists.txt +++ b/tests/auto/wayland/fullscreenshellv1/CMakeLists.txt @@ -14,7 +14,6 @@ qt_internal_add_test(tst_client_fullscreenshellv1 ../shared_old/mockregion.cpp ../shared_old/mockregion.h ../shared_old/mocksurface.cpp ../shared_old/mocksurface.h ../shared_old/mockwlshell.cpp ../shared_old/mockwlshell.h - ../shared_old/mockxdgshellv6.cpp ../shared_old/mockxdgshellv6.h tst_fullscreenshellv1.cpp INCLUDE_DIRECTORIES ../shared_old @@ -34,5 +33,5 @@ qt6_generate_wayland_protocol_server_sources(tst_client_fullscreenshellv1 ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/fullscreen-shell-unstable-v1.xml ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/ivi-application.xml ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/wayland.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/xdg-shell-unstable-v6.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/xdg-shell.xml ) diff --git a/tests/auto/wayland/iviapplication/.prev_CMakeLists.txt b/tests/auto/wayland/iviapplication/.prev_CMakeLists.txt index ce9c8fd9122..a545e55f72f 100644 --- a/tests/auto/wayland/iviapplication/.prev_CMakeLists.txt +++ b/tests/auto/wayland/iviapplication/.prev_CMakeLists.txt @@ -14,7 +14,6 @@ qt_internal_add_test(tst_client_iviapplication ../shared_old/mockregion.cpp ../shared_old/mockregion.h ../shared_old/mocksurface.cpp ../shared_old/mocksurface.h ../shared_old/mockwlshell.cpp ../shared_old/mockwlshell.h - ../shared_old/mockxdgshellv6.cpp ../shared_old/mockxdgshellv6.h tst_iviapplication.cpp INCLUDE_DIRECTORIES ../shared_old @@ -33,5 +32,5 @@ qt6_generate_wayland_protocol_server_sources(tst_client_iviapplication ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/fullscreen-shell-unstable-v1.xml ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/ivi-application.xml ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/wayland.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/xdg-shell-unstable-v6.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/xdg-shell.xml ) diff --git a/tests/auto/wayland/nooutput/tst_nooutput.cpp b/tests/auto/wayland/nooutput/tst_nooutput.cpp index 098d88d9908..b80a8178033 100644 --- a/tests/auto/wayland/nooutput/tst_nooutput.cpp +++ b/tests/auto/wayland/nooutput/tst_nooutput.cpp @@ -60,8 +60,17 @@ void tst_nooutput::noScreens() window.resize(16, 16); window.show(); - // We have to handle showing a window when there are no real outputs - QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial); + QCOMPOSITOR_TRY_VERIFY(xdgToplevel()); + + QTRY_VERIFY(window.isVisible()); + // The window should not be exposed before the first xdg_surface configure event + QTRY_VERIFY(!window.isExposed()); + + exec([=] { + xdgToplevel()->sendConfigure({0, 0}, {}); // Let the window decide the size + }); + + QTRY_VERIFY(window.isExposed()); } QCOMPOSITOR_TEST_MAIN(tst_nooutput) diff --git a/tests/auto/wayland/shared_old/mockcompositor.cpp b/tests/auto/wayland/shared_old/mockcompositor.cpp index 6fd2ec6bb73..9353d894c38 100644 --- a/tests/auto/wayland/shared_old/mockcompositor.cpp +++ b/tests/auto/wayland/shared_old/mockcompositor.cpp @@ -31,11 +31,8 @@ #include "mockoutput.h" #include "mocksurface.h" #include "mockwlshell.h" -#include "mockxdgshellv6.h" #include "mockiviapplication.h" -#include - #include MockCompositor::MockCompositor() { @@ -199,17 +196,6 @@ void MockCompositor::sendIviSurfaceConfigure(const QSharedPointer toplevel, const QSize &size, const QList &states) -{ - Command command = makeCommand(Impl::Compositor::sendXdgToplevelV6Configure, m_compositor); - command.parameters << QVariant::fromValue(toplevel); - command.parameters << QVariant::fromValue(size); - QByteArray statesBytes(reinterpret_cast(states.data()), - states.size() * static_cast(sizeof(uint))); - command.parameters << statesBytes; - processCommand(command); -} - void MockCompositor::waitForStartDrag() { Command command = makeCommand(Impl::Compositor::waitForStartDrag, m_compositor); @@ -254,16 +240,6 @@ QSharedPointer MockCompositor::iviSurface(int index) return result; } -QSharedPointer MockCompositor::xdgToplevelV6(int index) -{ - QSharedPointer result; - lock(); - if (Impl::XdgToplevelV6 *toplevel = m_compositor->xdgShellV6()->toplevels().value(index, nullptr)) - result = toplevel->mockToplevel(); - unlock(); - return result; -} - QSharedPointer MockCompositor::fullScreenShellV1Surface(int index) { QSharedPointer result; @@ -356,7 +332,6 @@ Compositor::Compositor(MockCompositor *mockCompositor) m_outputs.append(new Output(m_display, QSize(1920, 1080), QPoint(0, 0))); m_iviApplication.reset(new IviApplication(m_display)); m_wlShell.reset(new WlShell(m_display)); - m_xdgShellV6.reset(new XdgShellV6(m_display)); m_fullScreenShellV1.reset(new FullScreenShellV1(m_display)); m_loop = wl_display_get_event_loop(m_display); @@ -430,11 +405,6 @@ IviApplication *Compositor::iviApplication() const return m_iviApplication.data(); } -XdgShellV6 *Compositor::xdgShellV6() const -{ - return m_xdgShellV6.data(); -} - FullScreenShellV1 *Compositor::fullScreenShellV1() const { return m_fullScreenShellV1.data(); @@ -480,10 +450,4 @@ IviSurface *Compositor::resolveIviSurface(const QVariant &v) return mockIviSurface ? mockIviSurface->handle() : nullptr; } -XdgToplevelV6 *Compositor::resolveToplevel(const QVariant &v) -{ - QSharedPointer mockToplevel = v.value>(); - return mockToplevel ? mockToplevel->handle() : nullptr; -} - } diff --git a/tests/auto/wayland/shared_old/mockcompositor.h b/tests/auto/wayland/shared_old/mockcompositor.h index cbcf34cbd65..40fedf7dc90 100644 --- a/tests/auto/wayland/shared_old/mockcompositor.h +++ b/tests/auto/wayland/shared_old/mockcompositor.h @@ -29,7 +29,6 @@ #ifndef MOCKCOMPOSITOR_H #define MOCKCOMPOSITOR_H -#include "mockxdgshellv6.h" #include "mockiviapplication.h" #include "mockfullscreenshellv1.h" #include "mockregion.h" @@ -62,7 +61,6 @@ class Surface; class Output; class IviApplication; class WlShell; -class XdgShellV6; class Region; class Compositor @@ -81,7 +79,6 @@ public: QList outputs() const; IviApplication *iviApplication() const; - XdgShellV6 *xdgShellV6() const; FullScreenShellV1 *fullScreenShellV1() const; void addSurface(Surface *surface); @@ -105,7 +102,6 @@ public: static void setOutputMode(void *compositor, const QList ¶meters); static void sendShellSurfaceConfigure(void *data, const QList ¶meters); static void sendIviSurfaceConfigure(void *data, const QList ¶meters); - static void sendXdgToplevelV6Configure(void *data, const QList ¶meters); public: bool m_startDragSeen = false; @@ -115,7 +111,6 @@ private: static Surface *resolveSurface(const QVariant &v); static Output *resolveOutput(const QVariant &v); static IviSurface *resolveIviSurface(const QVariant &v); - static XdgToplevelV6 *resolveToplevel(const QVariant &v); void initShm(); @@ -137,7 +132,6 @@ private: QList m_outputs; QScopedPointer m_iviApplication; QScopedPointer m_wlShell; - QScopedPointer m_xdgShellV6; QScopedPointer m_fullScreenShellV1; }; @@ -193,32 +187,6 @@ private: Q_DECLARE_METATYPE(QSharedPointer) -class MockXdgToplevelV6 : public QObject -{ - Q_OBJECT -public: - Impl::XdgToplevelV6 *handle() const { return m_toplevel; } - - void sendConfigure(const QSharedPointer toplevel); - -signals: - uint setMinimizedRequested(); - uint setMaximizedRequested(); - uint unsetMaximizedRequested(); - uint setFullscreenRequested(); - uint unsetFullscreenRequested(); - void windowGeometryRequested(QRect geometry); // NOTE: This is really an xdg surface event - -private: - MockXdgToplevelV6(Impl::XdgToplevelV6 *toplevel) : m_toplevel(toplevel) {} - friend class Impl::Compositor; - friend class Impl::XdgToplevelV6; - - Impl::XdgToplevelV6 *m_toplevel; -}; - -Q_DECLARE_METATYPE(QSharedPointer) - class MockOutput { public: Impl::Output *handle() const { return m_output; } @@ -259,14 +227,11 @@ public: void sendSurfaceLeave(const QSharedPointer &surface, QSharedPointer &output); void sendShellSurfaceConfigure(const QSharedPointer surface, const QSize &size = QSize(0, 0)); void sendIviSurfaceConfigure(const QSharedPointer iviSurface, const QSize &size); - void sendXdgToplevelV6Configure(const QSharedPointer toplevel, const QSize &size = QSize(0, 0), - const QList &states = { ZXDG_TOPLEVEL_V6_STATE_ACTIVATED }); void waitForStartDrag(); QSharedPointer surface(); QSharedPointer output(int index = 0); QSharedPointer iviSurface(int index = 0); - QSharedPointer xdgToplevelV6(int index = 0); QSharedPointer fullScreenShellV1Surface(int index = 0); void lock(); diff --git a/tests/auto/wayland/shared_old/mocksurface.cpp b/tests/auto/wayland/shared_old/mocksurface.cpp index 23e088d3133..de162b07898 100644 --- a/tests/auto/wayland/shared_old/mocksurface.cpp +++ b/tests/auto/wayland/shared_old/mocksurface.cpp @@ -41,13 +41,7 @@ void Compositor::sendShellSurfaceConfigure(void *data, const QList &pa Surface *surface = resolveSurface(parameters.at(0)); QSize size = parameters.at(1).toSize(); Q_ASSERT(size.isValid()); - if (auto toplevel = surface->xdgToplevelV6()) { - QList states = { ZXDG_TOPLEVEL_V6_STATE_ACTIVATED }; - auto statesBytes = QByteArray::fromRawData(reinterpret_cast(states.data()), - states.size() * static_cast(sizeof(uint))); - toplevel->send_configure(size.width(), size.height(), statesBytes); - toplevel->xdgSurface()->sendConfigure(compositor->nextSerial()); - } else if (auto wlShellSurface = surface->wlShellSurface()) { + if (auto wlShellSurface = surface->wlShellSurface()) { const uint edges = 0; wlShellSurface->send_configure(edges, size.width(), size.height()); } else { @@ -95,17 +89,11 @@ void Surface::surface_destroy(Resource *resource) if (m_wlShellSurface) // on wl-shell the shell surface is automatically destroyed with the surface wl_resource_destroy(m_wlShellSurface->resource()->handle); Q_ASSERT(!m_wlShellSurface); - Q_ASSERT(!m_xdgSurfaceV6); wl_resource_destroy(resource->handle); } void Surface::surface_attach(Resource *resource, struct wl_resource *buffer, int x, int y) { - if (m_xdgSurfaceV6) { - // It's a protocol error to attach a buffer to an xdgSurface that's not configured - Q_ASSERT(xdgSurfaceV6()->configureSent()); - } - Q_UNUSED(resource); Q_UNUSED(x); Q_UNUSED(y); diff --git a/tests/auto/wayland/shared_old/mocksurface.h b/tests/auto/wayland/shared_old/mocksurface.h index d176837e73b..4b6462309ab 100644 --- a/tests/auto/wayland/shared_old/mocksurface.h +++ b/tests/auto/wayland/shared_old/mocksurface.h @@ -37,7 +37,6 @@ namespace Impl { -class XdgToplevelV6; class WlShellSurface; class Surface : public QtWaylandServer::wl_surface @@ -50,8 +49,6 @@ public: static Surface *fromResource(struct ::wl_resource *resource); void map(); bool isMapped() const; - XdgSurfaceV6 *xdgSurfaceV6() const { return m_xdgSurfaceV6; } - XdgToplevelV6 *xdgToplevelV6() const { return m_xdgSurfaceV6 ? m_xdgSurfaceV6->toplevel() : nullptr; } WlShellSurface *wlShellSurface() const { return m_wlShellSurface; } QSharedPointer mockSurface() const { return m_mockSurface; } @@ -72,7 +69,6 @@ protected: void surface_commit(Resource *resource) override; private: wl_resource *m_buffer = nullptr; - XdgSurfaceV6 *m_xdgSurfaceV6 = nullptr; WlShellSurface *m_wlShellSurface = nullptr; Compositor *m_compositor = nullptr; @@ -80,7 +76,6 @@ private: QList m_frameCallbackList; bool m_mapped = false; - friend class XdgSurfaceV6; friend class WlShellSurface; }; diff --git a/tests/auto/wayland/shared_old/mockxdgshellv6.cpp b/tests/auto/wayland/shared_old/mockxdgshellv6.cpp deleted file mode 100644 index 05eff74ad68..00000000000 --- a/tests/auto/wayland/shared_old/mockxdgshellv6.cpp +++ /dev/null @@ -1,145 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "mockxdgshellv6.h" -#include "mocksurface.h" -#include "mockcompositor.h" - -namespace Impl { - -void Compositor::sendXdgToplevelV6Configure(void *data, const QList ¶meters) -{ - Compositor *compositor = static_cast(data); - XdgToplevelV6 *toplevel = resolveToplevel(parameters.at(0)); - Q_ASSERT(toplevel && toplevel->resource()); - QSize size = parameters.at(1).toSize(); - Q_ASSERT(size.isValid()); - auto statesBytes = parameters.at(2).toByteArray(); - toplevel->send_configure(size.width(), size.height(), statesBytes); - toplevel->xdgSurface()->send_configure(compositor->nextSerial()); -} - -XdgSurfaceV6::XdgSurfaceV6(XdgShellV6 *shell, Surface *surface, wl_client *client, uint32_t id) - : QtWaylandServer::zxdg_surface_v6(client, id, 1) - , m_surface(surface) - , m_shell(shell) -{ - m_surface->m_xdgSurfaceV6 = this; -} - -XdgSurfaceV6::~XdgSurfaceV6() -{ - m_surface->m_xdgSurfaceV6 = nullptr; -} - -void XdgSurfaceV6::sendConfigure(uint32_t serial) -{ - send_configure(serial); - m_configureSent = true; -} - -void XdgSurfaceV6::zxdg_surface_v6_get_toplevel(QtWaylandServer::zxdg_surface_v6::Resource *resource, uint32_t id) -{ - int version = wl_resource_get_version(resource->handle); - m_toplevel = new XdgToplevelV6(this, resource->client(), id, version); -} - -void XdgSurfaceV6::zxdg_surface_v6_set_window_geometry(QtWaylandServer::zxdg_surface_v6::Resource *resource, int32_t x, int32_t y, int32_t width, int32_t height) -{ - Q_UNUSED(resource); - if (m_toplevel) { - QRect geometry(x, y, width, height); - emit m_toplevel->mockToplevel()->windowGeometryRequested(geometry); - } -} - -void XdgSurfaceV6::zxdg_surface_v6_destroy(QtWaylandServer::zxdg_surface_v6::Resource *resource) -{ - Q_ASSERT(!m_toplevel); - wl_resource_destroy(resource->handle); -} - -XdgToplevelV6::XdgToplevelV6(XdgSurfaceV6 *xdgSurface, wl_client *client, uint32_t id, int version) - : QtWaylandServer::zxdg_toplevel_v6(client, id, version) - , m_xdgSurface(xdgSurface) - , m_mockToplevel(new MockXdgToplevelV6(this)) -{ - auto *surface = m_xdgSurface->surface(); - m_xdgSurface->shell()->addToplevel(this); - surface->map(); -} - -XdgToplevelV6::~XdgToplevelV6() -{ - m_xdgSurface->shell()->removeToplevel(this); - m_mockToplevel->m_toplevel = nullptr; -} - -void XdgToplevelV6::zxdg_toplevel_v6_destroy(QtWaylandServer::zxdg_toplevel_v6::Resource *resource) -{ - m_xdgSurface->m_toplevel = nullptr; - wl_resource_destroy(resource->handle); -} - -void XdgToplevelV6::zxdg_toplevel_v6_set_minimized(QtWaylandServer::zxdg_toplevel_v6::Resource *resource) -{ - Q_UNUSED(resource); - emit m_mockToplevel->setMinimizedRequested(); -} - -void XdgToplevelV6::zxdg_toplevel_v6_set_maximized(QtWaylandServer::zxdg_toplevel_v6::Resource *resource) -{ - Q_UNUSED(resource); - emit m_mockToplevel->setMaximizedRequested(); -} - -void XdgToplevelV6::zxdg_toplevel_v6_unset_maximized(QtWaylandServer::zxdg_toplevel_v6::Resource *resource) -{ - Q_UNUSED(resource); - emit m_mockToplevel->unsetMaximizedRequested(); -} - -void XdgToplevelV6::zxdg_toplevel_v6_set_fullscreen(QtWaylandServer::zxdg_toplevel_v6::Resource *resource, wl_resource *output) -{ - Q_UNUSED(resource); - Q_UNUSED(output); - emit m_mockToplevel->setFullscreenRequested(); -} - -void XdgToplevelV6::zxdg_toplevel_v6_unset_fullscreen(QtWaylandServer::zxdg_toplevel_v6::Resource *resource) -{ - Q_UNUSED(resource); - emit m_mockToplevel->unsetFullscreenRequested(); -} - -void Impl::XdgShellV6::zxdg_shell_v6_get_xdg_surface(QtWaylandServer::zxdg_shell_v6::Resource *resource, uint32_t id, wl_resource *surface) -{ - new XdgSurfaceV6(this, Surface::fromResource(surface), resource->client(), id); -} - -} // namespace Impl diff --git a/tests/auto/wayland/shared_old/mockxdgshellv6.h b/tests/auto/wayland/shared_old/mockxdgshellv6.h deleted file mode 100644 index 4528dd1b4f8..00000000000 --- a/tests/auto/wayland/shared_old/mockxdgshellv6.h +++ /dev/null @@ -1,114 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2018 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include - -#include -#include - -#ifndef MOCKXDGSHELLV6_H -#define MOCKXDGSHELLV6_H - -class MockXdgToplevelV6; - -namespace Impl { - -class XdgToplevelV6; -class XdgShellV6; -class Surface; - -class XdgSurfaceV6 : public QtWaylandServer::zxdg_surface_v6 -{ -public: - XdgSurfaceV6(XdgShellV6 *shell, Surface *surface, wl_client *client, uint32_t id); - ~XdgSurfaceV6() override; - XdgShellV6 *shell() const { return m_shell; } - Surface *surface() const { return m_surface; } - XdgToplevelV6 *toplevel() const { return m_toplevel; } - - void sendConfigure(uint32_t serial); - bool configureSent() const { return m_configureSent; } - -protected: - void zxdg_surface_v6_destroy_resource(Resource *) override { delete this; } - void zxdg_surface_v6_get_toplevel(Resource *resource, uint32_t id) override; - void zxdg_surface_v6_set_window_geometry(Resource *resource, int32_t x, int32_t y, int32_t width, int32_t height) override; - void zxdg_surface_v6_destroy(Resource *resource) override; - -private: - Surface *m_surface = nullptr; - XdgToplevelV6 *m_toplevel = nullptr; - XdgShellV6 *m_shell = nullptr; - bool m_configureSent = false; - - friend class XdgToplevelV6; -}; - -class XdgToplevelV6 : public QtWaylandServer::zxdg_toplevel_v6 -{ -public: - XdgToplevelV6(XdgSurfaceV6 *xdgSurface, wl_client *client, uint32_t id, int version); - ~XdgToplevelV6() override; - XdgSurfaceV6 *xdgSurface() const { return m_xdgSurface; } - - QSharedPointer mockToplevel() const { return m_mockToplevel; } - -protected: - void zxdg_toplevel_v6_destroy_resource(Resource *) override { delete this; } - void zxdg_toplevel_v6_destroy(Resource *resource) override; - void zxdg_toplevel_v6_set_minimized(Resource *resource) override; - void zxdg_toplevel_v6_set_maximized(Resource *resource) override; - void zxdg_toplevel_v6_unset_maximized(Resource *resource) override; - void zxdg_toplevel_v6_set_fullscreen(Resource *resource, struct ::wl_resource *output) override; - void zxdg_toplevel_v6_unset_fullscreen(Resource *resource) override; - -private: - XdgSurfaceV6 *m_xdgSurface = nullptr; - QSharedPointer m_mockToplevel; -}; - -class XdgShellV6 : public QtWaylandServer::zxdg_shell_v6 -{ -public: - explicit XdgShellV6(::wl_display *display) : zxdg_shell_v6(display, 1) {} - QList toplevels() const { return m_toplevels; } - -protected: - void zxdg_shell_v6_get_xdg_surface(Resource *resource, uint32_t id, ::wl_resource *surface) override; - -private: - void addToplevel(XdgToplevelV6 *toplevel) { m_toplevels.append(toplevel); } - void removeToplevel(XdgToplevelV6 *toplevel) { m_toplevels.removeOne(toplevel); } - QList m_toplevels; - - friend class XdgToplevelV6; -}; - -} // namespace Impl - -#endif // MOCKXDGSHELLV6_H diff --git a/tests/auto/wayland/shared_old/shared_old.pri b/tests/auto/wayland/shared_old/shared_old.pri index 899e6b30902..7b22c77610e 100644 --- a/tests/auto/wayland/shared_old/shared_old.pri +++ b/tests/auto/wayland/shared_old/shared_old.pri @@ -8,7 +8,7 @@ CONFIG += wayland-scanner WAYLANDSERVERSOURCES += \ ../../../../src/3rdparty/protocol/ivi-application.xml \ ../../../../src/3rdparty/protocol/wayland.xml \ - ../../../../src/3rdparty/protocol/xdg-shell-unstable-v6.xml \ + ../../../../src/3rdparty/protocol/xdg-shell.xml \ ../../../../src/3rdparty/protocol/fullscreen-shell-unstable-v1.xml INCLUDEPATH += ../shared_old @@ -19,7 +19,6 @@ SOURCES += \ ../shared_old/mockinput.cpp \ ../shared_old/mockiviapplication.cpp \ ../shared_old/mockwlshell.cpp \ - ../shared_old/mockxdgshellv6.cpp \ ../shared_old/mocksurface.cpp \ ../shared_old/mockregion.cpp \ ../shared_old/mockoutput.cpp @@ -30,7 +29,6 @@ HEADERS += \ ../shared_old/mockinput.h \ ../shared_old/mockiviapplication.h \ ../shared_old/mockwlshell.h \ - ../shared_old/mockxdgshellv6.h \ ../shared_old/mocksurface.h \ ../shared_old/mockregion.h \ ../shared_old/mockoutput.h diff --git a/tests/auto/wayland/xdgshellv6/.prev_CMakeLists.txt b/tests/auto/wayland/xdgshellv6/.prev_CMakeLists.txt deleted file mode 100644 index dc40fd637a0..00000000000 --- a/tests/auto/wayland/xdgshellv6/.prev_CMakeLists.txt +++ /dev/null @@ -1,37 +0,0 @@ -# Generated from xdgshellv6.pro. - -##################################################################### -## tst_client_xdgshellv6 Test: -##################################################################### - -qt_internal_add_test(tst_client_xdgshellv6 - SOURCES - ../shared_old/mockcompositor.cpp ../shared_old/mockcompositor.h - ../shared_old/mockfullscreenshellv1.cpp ../shared_old/mockfullscreenshellv1.h - ../shared_old/mockinput.cpp ../shared_old/mockinput.h - ../shared_old/mockiviapplication.cpp ../shared_old/mockiviapplication.h - ../shared_old/mockoutput.cpp ../shared_old/mockoutput.h - ../shared_old/mockregion.cpp ../shared_old/mockregion.h - ../shared_old/mocksurface.cpp ../shared_old/mocksurface.h - ../shared_old/mockwlshell.cpp ../shared_old/mockwlshell.h - ../shared_old/mockxdgshellv6.cpp ../shared_old/mockxdgshellv6.h - tst_xdgshellv6.cpp - INCLUDE_DIRECTORIES - ../shared_old - PUBLIC_LIBRARIES - Qt::CorePrivate - Qt::Gui - Qt::GuiPrivate - Qt::OpenGL - Qt::WaylandClientPrivate - Wayland::Client - Wayland::Server -) - -qt6_generate_wayland_protocol_server_sources(tst_client_xdgshellv6 - FILES - ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/fullscreen-shell-unstable-v1.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/ivi-application.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/wayland.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/xdg-shell-unstable-v6.xml -) diff --git a/tests/auto/wayland/xdgshellv6/CMakeLists.txt b/tests/auto/wayland/xdgshellv6/CMakeLists.txt deleted file mode 100644 index 0e1704ea4a8..00000000000 --- a/tests/auto/wayland/xdgshellv6/CMakeLists.txt +++ /dev/null @@ -1,38 +0,0 @@ -# Generated from xdgshellv6.pro. - -##################################################################### -## tst_client_xdgshellv6 Test: -##################################################################### - -qt_internal_add_test(tst_client_xdgshellv6 - SOURCES - ../shared_old/mockcompositor.cpp ../shared_old/mockcompositor.h - ../shared_old/mockfullscreenshellv1.cpp ../shared_old/mockfullscreenshellv1.h - ../shared_old/mockinput.cpp ../shared_old/mockinput.h - ../shared_old/mockiviapplication.cpp ../shared_old/mockiviapplication.h - ../shared_old/mockoutput.cpp ../shared_old/mockoutput.h - ../shared_old/mockregion.cpp ../shared_old/mockregion.h - ../shared_old/mocksurface.cpp ../shared_old/mocksurface.h - ../shared_old/mockwlshell.cpp ../shared_old/mockwlshell.h - ../shared_old/mockxdgshellv6.cpp ../shared_old/mockxdgshellv6.h - tst_xdgshellv6.cpp - INCLUDE_DIRECTORIES - ../shared_old - PUBLIC_LIBRARIES - Qt::CorePrivate - Qt::Gui - Qt::GuiPrivate - Qt::OpenGL - Qt::WaylandClientPrivate - Wayland::Client - Wayland::Server - Threads::Threads # special case -) - -qt6_generate_wayland_protocol_server_sources(tst_client_xdgshellv6 - FILES - ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/fullscreen-shell-unstable-v1.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/ivi-application.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/wayland.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/xdg-shell-unstable-v6.xml -) diff --git a/tests/auto/wayland/xdgshellv6/tst_xdgshellv6.cpp b/tests/auto/wayland/xdgshellv6/tst_xdgshellv6.cpp deleted file mode 100644 index 76df6eb58dd..00000000000 --- a/tests/auto/wayland/xdgshellv6/tst_xdgshellv6.cpp +++ /dev/null @@ -1,445 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "mockcompositor.h" - -#include -#include -#include -#include -#include -#include -#include - -#include - -static const QSize screenSize(1600, 1200); - -class TestWindow : public QWindow -{ - Q_OBJECT -public: - TestWindow() - { - setSurfaceType(QSurface::RasterSurface); - setGeometry(0, 0, 32, 32); - create(); - } - - bool event(QEvent *event) override - { - if (event->type() == QEvent::WindowStateChange) - emit windowStateChangeEventReceived(static_cast(event)->oldState()); - return QWindow::event(event); - } - - void exposeEvent(QExposeEvent *event) override - { - ++exposeEventCount; - QWindow::exposeEvent(event); - } - - int exposeEventCount = 0; - -signals: - void windowStateChangeEventReceived(uint oldState); -}; - -class tst_WaylandClientXdgShellV6 : public QObject -{ - Q_OBJECT -public: - tst_WaylandClientXdgShellV6(MockCompositor *c) - : m_compositor(c) - { - qRegisterMetaType(); - QSocketNotifier *notifier = new QSocketNotifier(m_compositor->waylandFileDescriptor(), QSocketNotifier::Read, this); - connect(notifier, &QSocketNotifier::activated, this, &tst_WaylandClientXdgShellV6::processWaylandEvents); - // connect to the event dispatcher to make sure to flush out the outgoing message queue - connect(QCoreApplication::eventDispatcher(), &QAbstractEventDispatcher::awake, this, &tst_WaylandClientXdgShellV6::processWaylandEvents); - connect(QCoreApplication::eventDispatcher(), &QAbstractEventDispatcher::aboutToBlock, this, &tst_WaylandClientXdgShellV6::processWaylandEvents); - } - -public slots: - void processWaylandEvents() - { - m_compositor->processWaylandEvents(); - } - - void cleanup() - { - // make sure the surfaces from the last test are properly cleaned up - // and don't show up as false positives in the next test - QTRY_VERIFY(!m_compositor->surface()); - QTRY_VERIFY(!m_compositor->xdgToplevelV6()); - } - -private slots: - void createDestroyWindow(); - void configure(); - void showMinimized(); - void setMinimized(); - void unsetMaximized(); - void focusWindowFollowsConfigure(); - void windowStateChangedEvents(); - void windowGeometrySimple(); - void windowGeometryFixed(); - void flushUnconfiguredXdgSurface(); - void dontSpamExposeEvents(); - -private: - MockCompositor *m_compositor = nullptr; -}; - -void tst_WaylandClientXdgShellV6::createDestroyWindow() -{ - TestWindow window; - window.show(); - - QTRY_VERIFY(m_compositor->surface()); - - window.destroy(); - QTRY_VERIFY(!m_compositor->surface()); -} - -void tst_WaylandClientXdgShellV6::configure() -{ - QSharedPointer output; - QTRY_VERIFY(output = m_compositor->output()); - - TestWindow window; - window.show(); - - QSharedPointer surface; - QTRY_VERIFY(surface = m_compositor->surface()); - - m_compositor->processWaylandEvents(); - QTRY_VERIFY(window.isVisible()); - QTRY_VERIFY(!window.isExposed()); //Window should not be exposed before the first configure event - - //TODO: according to xdg-shell protocol, a buffer should not be attached to a the surface - //until it's configured. Ensure this in the test! - - QSharedPointer toplevel; - QTRY_VERIFY(toplevel = m_compositor->xdgToplevelV6()); - - const QSize newSize(123, 456); - m_compositor->sendXdgToplevelV6Configure(toplevel, newSize); - QTRY_VERIFY(window.isExposed()); - QTRY_COMPARE(window.visibility(), QWindow::Windowed); - QTRY_COMPARE(window.windowStates(), Qt::WindowNoState); - QTRY_COMPARE(window.frameGeometry(), QRect(QPoint(), newSize)); - - m_compositor->sendXdgToplevelV6Configure(toplevel, screenSize, { ZXDG_TOPLEVEL_V6_STATE_ACTIVATED, ZXDG_TOPLEVEL_V6_STATE_MAXIMIZED }); - QTRY_COMPARE(window.visibility(), QWindow::Maximized); - QTRY_COMPARE(window.windowStates(), Qt::WindowMaximized); - QTRY_COMPARE(window.frameGeometry(), QRect(QPoint(), screenSize)); - - m_compositor->sendXdgToplevelV6Configure(toplevel, screenSize, { ZXDG_TOPLEVEL_V6_STATE_ACTIVATED, ZXDG_TOPLEVEL_V6_STATE_FULLSCREEN }); - QTRY_COMPARE(window.visibility(), QWindow::FullScreen); - QTRY_COMPARE(window.windowStates(), Qt::WindowFullScreen); - QTRY_COMPARE(window.frameGeometry(), QRect(QPoint(), screenSize)); - - //The window should remember it's original size - m_compositor->sendXdgToplevelV6Configure(toplevel, QSize(0, 0), { ZXDG_TOPLEVEL_V6_STATE_ACTIVATED }); - QTRY_COMPARE(window.visibility(), QWindow::Windowed); - QTRY_COMPARE(window.windowStates(), Qt::WindowNoState); - QTRY_COMPARE(window.frameGeometry(), QRect(QPoint(), newSize)); -} - -void tst_WaylandClientXdgShellV6::showMinimized() -{ - // On xdg-shell v6 there's really no way for the compositor to tell the window if it's minimized - // There are wl_surface.enter events and so on, but there's really no way to differentiate - // between a window preview and an unminimized window. - TestWindow window; - window.showMinimized(); - QCOMPARE(window.windowStates(), Qt::WindowMinimized); // should return minimized until - QTRY_COMPARE(window.windowStates(), Qt::WindowNoState); // rejected by handleWindowStateChanged - - // Make sure the window on the compositor side is/was created here, and not after the test - // finishes, as that may mess up for later tests. - QTRY_VERIFY(m_compositor->xdgToplevelV6()); -} - -void tst_WaylandClientXdgShellV6::setMinimized() -{ - TestWindow window; - window.show(); - - QSharedPointer toplevel; - QTRY_VERIFY(toplevel = m_compositor->xdgToplevelV6()); - - m_compositor->sendXdgToplevelV6Configure(toplevel); - QTRY_COMPARE(window.visibility(), QWindow::Windowed); - QTRY_COMPARE(window.windowStates(), Qt::WindowNoState); - - QSignalSpy setMinimizedSpy(toplevel.data(), SIGNAL(setMinimizedRequested())); - QSignalSpy windowStateChangeSpy(&window, SIGNAL(windowStateChangeEventReceived(uint))); - - window.setVisibility(QWindow::Minimized); - QCOMPARE(window.visibility(), QWindow::Minimized); - QCOMPARE(window.windowStates(), Qt::WindowMinimized); - QTRY_COMPARE(setMinimizedSpy.count(), 1); - { - QTRY_VERIFY(windowStateChangeSpy.count() > 0); - Qt::WindowStates oldStates(windowStateChangeSpy.takeFirst().at(0).toUInt()); - QCOMPARE(oldStates, Qt::WindowNoState); - } - - // In the meantime the compositor may minimize, do nothing or reshow the window without - // telling us. - - QTRY_COMPARE(window.visibility(), QWindow::Windowed); // verify that we don't know anything - QTRY_COMPARE(window.windowStates(), Qt::WindowNoState); - { - QTRY_COMPARE(windowStateChangeSpy.count(), 1); - Qt::WindowStates oldStates(windowStateChangeSpy.takeFirst().at(0).toUInt()); - QCOMPARE(oldStates, Qt::WindowNoState); // because the window never was minimized - } - - // Setting visibility again should send another set_minimized request - window.setVisibility(QWindow::Minimized); - QTRY_COMPARE(setMinimizedSpy.count(), 2); -} - -void tst_WaylandClientXdgShellV6::unsetMaximized() -{ - TestWindow window; - window.show(); - - QSharedPointer toplevel; - QTRY_VERIFY(toplevel = m_compositor->xdgToplevelV6()); - - QSignalSpy unsetMaximizedSpy(toplevel.data(), SIGNAL(unsetMaximizedRequested())); - - QSignalSpy windowStateChangedSpy(&window, SIGNAL(windowStateChanged(Qt::WindowState))); - - m_compositor->sendXdgToplevelV6Configure(toplevel, screenSize, { ZXDG_TOPLEVEL_V6_STATE_MAXIMIZED }); - - QTRY_COMPARE(windowStateChangedSpy.count(), 1); - QCOMPARE(windowStateChangedSpy.takeFirst().at(0).toUInt(), Qt::WindowMaximized); - - window.setWindowStates(Qt::WindowNoState); - - QTRY_COMPARE(unsetMaximizedSpy.count(), 1); - QTRY_COMPARE(windowStateChangedSpy.count(), 1); - QCOMPARE(windowStateChangedSpy.takeFirst().at(0).toUInt(), Qt::WindowNoState); - - m_compositor->sendXdgToplevelV6Configure(toplevel, QSize(0, 0), {}); - - QTRY_COMPARE(windowStateChangedSpy.count(), 1); - QCOMPARE(windowStateChangedSpy.takeFirst().at(0).toUInt(), Qt::WindowNoState); -} - -void tst_WaylandClientXdgShellV6::focusWindowFollowsConfigure() -{ - TestWindow window; - window.show(); - - QSharedPointer toplevel; - QTRY_VERIFY(toplevel = m_compositor->xdgToplevelV6()); - QTRY_VERIFY(!window.isActive()); - - QSignalSpy windowStateChangeSpy(&window, SIGNAL(windowStateChangeEventReceived(uint))); - - m_compositor->sendXdgToplevelV6Configure(toplevel, QSize(0, 0), { ZXDG_TOPLEVEL_V6_STATE_ACTIVATED }); - QTRY_VERIFY(window.isActive()); - - m_compositor->sendXdgToplevelV6Configure(toplevel, QSize(0, 0), {}); - QTRY_VERIFY(!window.isActive()); -} - -void tst_WaylandClientXdgShellV6::windowStateChangedEvents() -{ - TestWindow window; - window.show(); - - QSharedPointer toplevel; - QTRY_VERIFY(toplevel = m_compositor->xdgToplevelV6()); - - QSignalSpy eventSpy(&window, SIGNAL(windowStateChangeEventReceived(uint))); - QSignalSpy signalSpy(&window, SIGNAL(windowStateChanged(Qt::WindowState))); - - m_compositor->sendXdgToplevelV6Configure(toplevel, screenSize, { ZXDG_TOPLEVEL_V6_STATE_MAXIMIZED }); - - QTRY_COMPARE(window.windowStates(), Qt::WindowMaximized); - QTRY_COMPARE(window.windowState(), Qt::WindowMaximized); - { - QTRY_COMPARE(eventSpy.count(), 1); - Qt::WindowStates oldStates(eventSpy.takeFirst().at(0).toUInt()); - QCOMPARE(oldStates, Qt::WindowNoState); - - QTRY_COMPARE(signalSpy.count(), 1); - uint newState = signalSpy.takeFirst().at(0).toUInt(); - QCOMPARE(newState, Qt::WindowMaximized); - } - - m_compositor->sendXdgToplevelV6Configure(toplevel, screenSize, { ZXDG_TOPLEVEL_V6_STATE_FULLSCREEN }); - - QTRY_COMPARE(window.windowStates(), Qt::WindowFullScreen); - QTRY_COMPARE(window.windowState(), Qt::WindowFullScreen); - { - QTRY_COMPARE(eventSpy.count(), 1); - Qt::WindowStates oldStates(eventSpy.takeFirst().at(0).toUInt()); - QCOMPARE(oldStates, Qt::WindowMaximized); - - QTRY_COMPARE(signalSpy.count(), 1); - uint newState = signalSpy.takeFirst().at(0).toUInt(); - QCOMPARE(newState, Qt::WindowFullScreen); - } - - m_compositor->sendXdgToplevelV6Configure(toplevel, QSize(0, 0), {}); - - QTRY_COMPARE(window.windowStates(), Qt::WindowNoState); - QTRY_COMPARE(window.windowState(), Qt::WindowNoState); - { - QTRY_COMPARE(eventSpy.count(), 1); - Qt::WindowStates oldStates(eventSpy.takeFirst().at(0).toUInt()); - QCOMPARE(oldStates, Qt::WindowFullScreen); - - QTRY_COMPARE(signalSpy.count(), 1); - uint newState = signalSpy.takeFirst().at(0).toUInt(); - QCOMPARE(newState, Qt::WindowNoState); - } -} - -void tst_WaylandClientXdgShellV6::windowGeometrySimple() -{ - QSKIP("TODO: This test is flaky, figure out why."); - QWindow window; - window.show(); - - QSharedPointer toplevel; - QTRY_VERIFY(toplevel = m_compositor->xdgToplevelV6()); - QSignalSpy geometrySpy(toplevel.data(), SIGNAL(windowGeometryRequested(QRect))); - - m_compositor->sendXdgToplevelV6Configure(toplevel); - QTRY_COMPARE(geometrySpy.count(), 1); - QCOMPARE(geometrySpy.takeFirst().at(0).toRect().size(), window.frameGeometry().size()); - - m_compositor->sendXdgToplevelV6Configure(toplevel, QSize(123, 456)); - QTRY_COMPARE(geometrySpy.count(), 1); - QCOMPARE(geometrySpy.takeFirst().at(0).toRect().size(), QSize(123, 456)); -} - -void tst_WaylandClientXdgShellV6::windowGeometryFixed() -{ - QSKIP("TODO: This test is flaky, figure out why."); - QWindow window; - window.resize(QSize(1337, 137)); - window.setMaximumSize(window.size()); - window.setMinimumSize(window.size()); - window.show(); - - QSharedPointer toplevel; - QTRY_VERIFY(toplevel = m_compositor->xdgToplevelV6()); - QSignalSpy geometrySpy(toplevel.data(), SIGNAL(windowGeometryRequested(QRect))); - - m_compositor->sendXdgToplevelV6Configure(toplevel); - QTRY_COMPARE(geometrySpy.count(), 1); - QRect initialWindowGeometry = geometrySpy.takeFirst().at(0).toRect(); - QCOMPARE(initialWindowGeometry.size(), window.frameGeometry().size()); - - m_compositor->sendXdgToplevelV6Configure(toplevel, QSize(123, 456)); - QTRY_COMPARE(geometrySpy.count(), 1); - // Configuring the window should not change the window geometry - QCOMPARE(geometrySpy.takeFirst().at(0).toRect().size(), initialWindowGeometry.size()); -} - -void tst_WaylandClientXdgShellV6::flushUnconfiguredXdgSurface() -{ - TestWindow window; - window.show(); - - QSharedPointer surface; - QTRY_VERIFY(surface = m_compositor->surface()); - - // Paint and flush some magenta - QBackingStore backingStore(&window); - QRect rect(QPoint(), window.size()); - backingStore.resize(rect.size()); - backingStore.beginPaint(rect); - QColor color = Qt::magenta; - QPainter p(backingStore.paintDevice()); - p.fillRect(rect, color); - p.end(); - backingStore.endPaint(); - backingStore.flush(rect); - - // We're not allowed to send buffer on this surface since it isn't yet configured. - // So, from the compositor's point of view there should be no buffer data yet. - m_compositor->processWaylandEvents(); - QVERIFY(surface->image.isNull()); - QVERIFY(!window.isExposed()); - - // Finally sending the configure should trigger an attach and commit with the - // right buffer. - m_compositor->sendShellSurfaceConfigure(surface); - QTRY_COMPARE(surface->image.size(), window.frameGeometry().size()); - QTRY_COMPARE(surface->image.pixel(window.frameMargins().left(), window.frameMargins().top()), color.rgba()); - QTRY_VERIFY(window.isExposed()); -} - -void tst_WaylandClientXdgShellV6::dontSpamExposeEvents() -{ - TestWindow window; - window.show(); - - QSharedPointer surface; - QTRY_VERIFY(surface = m_compositor->surface()); - QTRY_COMPARE(window.exposeEventCount, 0); - - m_compositor->sendShellSurfaceConfigure(surface); - QTRY_VERIFY(window.isExposed()); - QTRY_COMPARE(window.exposeEventCount, 1); -} - -int main(int argc, char **argv) -{ - QTemporaryDir tmpRuntimeDir; - setenv("XDG_RUNTIME_DIR", tmpRuntimeDir.path().toLocal8Bit(), 1); - setenv("QT_QPA_PLATFORM", "wayland", 1); // force QGuiApplication to use wayland plugin - setenv("QT_WAYLAND_SHELL_INTEGRATION", "xdg-shell-v6", 1); - - // wayland-egl hangs in the test setup when we try to initialize. Until it gets - // figured out, avoid clientBufferIntegration() from being called in - // QWaylandWindow::createDecorations(). - setenv("QT_WAYLAND_DISABLE_WINDOWDECORATION", "1", 1); - - MockCompositor compositor; - compositor.setOutputMode(screenSize); - - QGuiApplication app(argc, argv); - compositor.applicationInitialized(); - - tst_WaylandClientXdgShellV6 tc(&compositor); - return QTest::qExec(&tc, argc, argv); -} - -#include diff --git a/tests/auto/wayland/xdgshellv6/xdgshellv6.pro b/tests/auto/wayland/xdgshellv6/xdgshellv6.pro deleted file mode 100644 index cc8a22d83e0..00000000000 --- a/tests/auto/wayland/xdgshellv6/xdgshellv6.pro +++ /dev/null @@ -1,5 +0,0 @@ -include (../shared_old/shared_old.pri) - -TARGET = tst_client_xdgshellv6 -SOURCES += tst_xdgshellv6.cpp - From f73b8a94f4a65f7e9750ba40573e4243b9cff950 Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Fri, 30 Oct 2020 16:55:30 +0200 Subject: [PATCH 0908/1507] Scanner: Avoid accessing dangling pointers in destroy_func() Usually, the object associated with the resource gets destroyed in the destroy_resource() function. Therefore, we need to double-check that the object is still alive before trying to reset its m_resource. Pick-to: 5.15 Change-Id: I26408228f58919db17eb29584a1cbd4a9427d25c Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/tools/qtwaylandscanner/qtwaylandscanner.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp index 1a1f8bf16df..450ef519d9e 100644 --- a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp +++ b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp @@ -814,7 +814,9 @@ bool Scanner::process() printf(" if (Q_LIKELY(that)) {\n"); printf(" that->m_resource_map.remove(resource->client(), resource);\n"); printf(" that->%s_destroy_resource(resource);\n", interfaceNameStripped); - printf(" if (that->m_resource == resource)\n"); + printf("\n"); + printf(" that = resource->%s_object;\n", interfaceNameStripped); + printf(" if (that && that->m_resource == resource)\n"); printf(" that->m_resource = nullptr;\n"); printf(" }\n"); printf(" delete resource;\n"); From b18aba6a428a6304c06c465ca5a2969b3cf9e31c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Fri, 13 Nov 2020 11:21:50 +0100 Subject: [PATCH 0909/1507] Make setting QT_SCALE_FACTOR work on Wayland QWindow geometry accessors return geometry in device independent pixels. Normally this coordinate system is equivalent to the Wayland native coordinate system, but this is not the case when QT_SCALE_FACTOR is set. Replace QWindow geometry calls with the helpers from QPlatformWindow which return geometry in the native coordinate system: QWindow::geometry() -> QPlatformWindow::windowGeometry() QWindow::frameGeometry() -> QPlatformWindow::windowFrameGeometry() Task-number: QTBUG-87762 Fixes: QTBUG-88064 Change-Id: I8c96237b49c754bb978f1739d090962be770c271 Reviewed-by: Eskil Abrahamsen Blomfeldt --- .../shellintegration/wl-shell/qwaylandwlshellsurface.cpp | 2 +- .../shellintegration/xdg-shell/qwaylandxdgshell.cpp | 2 +- src/plugins/platforms/wayland/qwaylandwindow.cpp | 7 ++++--- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellsurface.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellsurface.cpp index 245fec19670..8f41118d88d 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellsurface.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellsurface.cpp @@ -134,7 +134,7 @@ void QWaylandWlShellSurface::applyConfigure() { if ((m_pending.states & (Qt::WindowMaximized|Qt::WindowFullScreen)) && !(m_applied.states & (Qt::WindowMaximized|Qt::WindowFullScreen))) { - m_normalSize = m_window->window()->frameGeometry().size(); + m_normalSize = m_window->windowFrameGeometry().size(); } if (m_pending.states != m_applied.states) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp index 43360ede3a2..b7253de2bed 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp @@ -83,7 +83,7 @@ QWaylandXdgSurface::Toplevel::~Toplevel() void QWaylandXdgSurface::Toplevel::applyConfigure() { if (!(m_applied.states & (Qt::WindowMaximized|Qt::WindowFullScreen))) - m_normalSize = m_xdgSurface->m_window->window()->frameGeometry().size(); + m_normalSize = m_xdgSurface->m_window->windowFrameGeometry().size(); if ((m_pending.states & Qt::WindowActive) && !(m_applied.states & Qt::WindowActive)) m_xdgSurface->m_window->display()->handleWindowActivated(m_xdgSurface->m_window); diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 130dbab361f..c7e715b6574 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -192,10 +192,11 @@ void QWaylandWindow::initWindow() mSurface->set_buffer_scale(scale()); setWindowFlags(window()->flags()); - if (window()->geometry().isEmpty()) + QRect geometry = windowGeometry(); + if (geometry.isEmpty()) setGeometry_helper(QRect(QPoint(), QSize(500,500))); else - setGeometry_helper(window()->geometry()); + setGeometry_helper(geometry); setMask(window()->mask()); if (mShellSurface) mShellSurface->requestWindowStates(window()->windowStates()); @@ -427,7 +428,7 @@ void QWaylandWindow::setVisible(bool visible) initWindow(); mDisplay->flushRequests(); - setGeometry(window()->geometry()); + setGeometry(windowGeometry()); // Don't flush the events here, or else the newly visible window may start drawing, but since // there was no frame before it will be stuck at the waitForFrameSync() in // QWaylandShmBackingStore::beginPaint(). From f2bc2a7c1970cc36199ddbe302e437eb9726aa62 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Tue, 27 Oct 2020 14:36:38 +0100 Subject: [PATCH 0910/1507] Fix some compile warnings QTouchEvent::touchPoints() is deprecated and replaced by just points(), and there is a new value in Qt::TouchPointState. normalizedPos() is replaced by normalizedPosition(). And QVariant::type() is deprecated. Change-Id: I4a4eea2775030f67ad12488df25d4859099c1783 Reviewed-by: Shawn Rutledge --- tests/auto/wayland/seatv5/tst_seatv5.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/auto/wayland/seatv5/tst_seatv5.cpp b/tests/auto/wayland/seatv5/tst_seatv5.cpp index 0c4dcfe0699..69c52ed5a84 100644 --- a/tests/auto/wayland/seatv5/tst_seatv5.cpp +++ b/tests/auto/wayland/seatv5/tst_seatv5.cpp @@ -421,7 +421,7 @@ public: explicit Event(const QTouchEvent *event) : type(event->type()) , touchPointStates(event->touchPointStates()) - , touchPoints(event->touchPoints()) + , touchPoints(event->points()) { } QEvent::Type type{}; @@ -506,7 +506,7 @@ void tst_seatv5::multiTouch() t->sendDown(xdgToplevel()->surface(), {48, 48}, 1); t->sendFrame(c); - // Compositor event order should not change the order of the QTouchEvent::touchPoints() + // Compositor event order should not change the order of the QTouchEvent::points() // See QTBUG-77014 t->sendMotion(c, {49, 48}, 1); t->sendMotion(c, {33, 32}, 0); From 4db304cc9e3424e1e3ac8912a3546d63452682f0 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Tue, 17 Nov 2020 08:11:20 +0100 Subject: [PATCH 0911/1507] Fix compilation after QFileInfo changes The QFileInfo constructors were made explicit in 784a290c4b08e84d895a62dada5420a3b47dde48, breaking compilation where the implicit construction was used. Fixes: QTBUG-88565 Change-Id: Icc4c335ea5cbbd21f8a9027beb57823e233b253d Reviewed-by: Volker Hilsheimer --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index c7e715b6574..328e4f3ce24 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -162,7 +162,7 @@ void QWaylandWindow::initWindow() name.chop(8); mShellSurface->setAppId(name); } else { - QFileInfo fi = QCoreApplication::instance()->applicationFilePath(); + QFileInfo fi = QFileInfo(QCoreApplication::instance()->applicationFilePath()); QStringList domainName = QCoreApplication::instance()->organizationDomain().split(QLatin1Char('.'), Qt::SkipEmptyParts); From ad466182a7013fa049379c4527c77a1699414fdc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Mon, 16 Nov 2020 19:37:33 +0100 Subject: [PATCH 0912/1507] Make setting QT_SCALE_FACTOR work on Wayland Follow-up to b18aba6a428a6304c06c465ca5a2969b3cf9e31c, fixes one additional case (Use of minimum/maximum size). Fixes: QTBUG-87762 Pick-to: 5.15 Change-Id: I73e0df2529b0cadf25ad50ea7459cdbb92caf424 Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 328e4f3ce24..82018a5eb0a 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -331,9 +331,11 @@ void QWaylandWindow::setWindowIcon(const QIcon &icon) void QWaylandWindow::setGeometry_helper(const QRect &rect) { + QSize minimum = windowMinimumSize(); + QSize maximum = windowMaximumSize(); QPlatformWindow::setGeometry(QRect(rect.x(), rect.y(), - qBound(window()->minimumWidth(), rect.width(), window()->maximumWidth()), - qBound(window()->minimumHeight(), rect.height(), window()->maximumHeight()))); + qBound(minimum.width(), rect.width(), maximum.width()), + qBound(minimum.height(), rect.height(), maximum.height()))); if (mSubSurfaceWindow) { QMargins m = QPlatformWindow::parent()->frameMargins(); From e1c5ff6e70b05ec90212a5c1b74da5de80614019 Mon Sep 17 00:00:00 2001 From: Roman Genkhel Date: Thu, 12 Nov 2020 12:21:51 +0300 Subject: [PATCH 0913/1507] Check pointer for null before use in ASSERT Task-number: QTBUG-85195 Change-Id: I331e54f6e58aa9d536351a55223610c60b3cb414 Reviewed-by: David Edmundson --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 82018a5eb0a..04c2dbd48f4 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -547,8 +547,8 @@ void QWaylandWindow::sendRecursiveExposeEvent() void QWaylandWindow::attach(QWaylandBuffer *buffer, int x, int y) { - Q_ASSERT(!buffer->committed()); if (buffer) { + Q_ASSERT(!buffer->committed()); handleUpdate(); buffer->setBusy(); From 0936d81b79c6a15844d806c1ebb90d327eadc08a Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Thu, 19 Nov 2020 08:12:37 +0100 Subject: [PATCH 0914/1507] Fix compilation after removing QEvent copy ctor In 19f9b0d5f54379151eb71e98555b203ad6756276 in qtbase, the copy constructors for QEvents were removed, so code using this has to be updated. Change-Id: I5798b240d79f78c47374d60947b1bc66598ff3b5 Reviewed-by: Volker Hilsheimer --- .../platforms/wayland/qwaylandinputcontext.cpp | 10 ++++++---- .../shared/qwaylandinputmethodeventbuilder.cpp | 12 ++++++------ .../shared/qwaylandinputmethodeventbuilder_p.h | 4 ++-- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandinputcontext.cpp b/src/plugins/platforms/wayland/qwaylandinputcontext.cpp index e9afe05ed92..6c586960ea9 100644 --- a/src/plugins/platforms/wayland/qwaylandinputcontext.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputcontext.cpp @@ -269,12 +269,13 @@ void QWaylandTextInput::zwp_text_input_v2_preedit_string(const QString &text, co if (!QGuiApplication::focusObject()) return; - QInputMethodEvent event = m_builder.buildPreedit(text); + QInputMethodEvent *event = m_builder.buildPreedit(text); m_builder.reset(); m_preeditCommit = commit; - QCoreApplication::sendEvent(QGuiApplication::focusObject(), &event); + QCoreApplication::sendEvent(QGuiApplication::focusObject(), event); + delete event; } void QWaylandTextInput::zwp_text_input_v2_preedit_styling(uint32_t index, uint32_t length, uint32_t style) @@ -298,11 +299,12 @@ void QWaylandTextInput::zwp_text_input_v2_commit_string(const QString &text) if (!QGuiApplication::focusObject()) return; - QInputMethodEvent event = m_builder.buildCommit(text); + QInputMethodEvent *event = m_builder.buildCommit(text); m_builder.reset(); - QCoreApplication::sendEvent(QGuiApplication::focusObject(), &event); + QCoreApplication::sendEvent(QGuiApplication::focusObject(), event); + delete event; } void QWaylandTextInput::zwp_text_input_v2_cursor_position(int32_t index, int32_t anchor) diff --git a/src/plugins/platforms/wayland/shared/qwaylandinputmethodeventbuilder.cpp b/src/plugins/platforms/wayland/shared/qwaylandinputmethodeventbuilder.cpp index 5f3c8a55df5..00e3ae14e42 100644 --- a/src/plugins/platforms/wayland/shared/qwaylandinputmethodeventbuilder.cpp +++ b/src/plugins/platforms/wayland/shared/qwaylandinputmethodeventbuilder.cpp @@ -117,7 +117,7 @@ void QWaylandInputMethodEventBuilder::setPreeditCursor(int32_t index) m_preeditCursor = index; } -QInputMethodEvent QWaylandInputMethodEventBuilder::buildCommit(const QString &text) +QInputMethodEvent *QWaylandInputMethodEventBuilder::buildCommit(const QString &text) { QList attributes; @@ -141,13 +141,13 @@ QInputMethodEvent QWaylandInputMethodEventBuilder::buildCommit(const QString &te QVariant())); } - QInputMethodEvent event(QString(), attributes); - event.setCommitString(text, replacement.first, replacement.second); + QInputMethodEvent *event = new QInputMethodEvent(QString(), attributes); + event->setCommitString(text, replacement.first, replacement.second); return event; } -QInputMethodEvent QWaylandInputMethodEventBuilder::buildPreedit(const QString &text) +QInputMethodEvent *QWaylandInputMethodEventBuilder::buildPreedit(const QString &text) { QList attributes; @@ -163,10 +163,10 @@ QInputMethodEvent QWaylandInputMethodEventBuilder::buildPreedit(const QString &t attributes.append(QInputMethodEvent::Attribute(attr.type, start, length, attr.value)); } - QInputMethodEvent event(text, attributes); + QInputMethodEvent *event = new QInputMethodEvent(text, attributes); const QPair replacement = replacementForDeleteSurrounding(); - event.setCommitString(QString(), replacement.first, replacement.second); + event->setCommitString(QString(), replacement.first, replacement.second); return event; } diff --git a/src/plugins/platforms/wayland/shared/qwaylandinputmethodeventbuilder_p.h b/src/plugins/platforms/wayland/shared/qwaylandinputmethodeventbuilder_p.h index a234cf44be8..2499a563f45 100644 --- a/src/plugins/platforms/wayland/shared/qwaylandinputmethodeventbuilder_p.h +++ b/src/plugins/platforms/wayland/shared/qwaylandinputmethodeventbuilder_p.h @@ -58,8 +58,8 @@ public: void addPreeditStyling(uint32_t index, uint32_t length, uint32_t style); void setPreeditCursor(int32_t index); - QInputMethodEvent buildCommit(const QString &text); - QInputMethodEvent buildPreedit(const QString &text); + QInputMethodEvent *buildCommit(const QString &text); + QInputMethodEvent *buildPreedit(const QString &text); static int indexFromWayland(const QString &text, int length, int base = 0); static int indexToWayland(const QString &text, int length, int base = 0); From aa793867b0561d599fd94b3effcd079fa34db31c Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Mon, 14 Dec 2020 12:39:39 +0100 Subject: [PATCH 0915/1507] Remove some dead code The waitForScreens() function has not been used for a while, so to avoid confusion around the different entry points to event processing, we remove it. Change-Id: I3a801492ab87b4835e0e1b3c9e264c29c1688c06 Reviewed-by: David Edmundson --- .../platforms/wayland/qwaylanddisplay.cpp | 19 ------------------- .../platforms/wayland/qwaylanddisplay_p.h | 1 - 2 files changed, 20 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index e759c5d64f4..d39b25697cc 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -322,25 +322,6 @@ void QWaylandDisplay::handleScreenInitialized(QWaylandScreen *screen) } } -void QWaylandDisplay::waitForScreens() -{ - flushRequests(); - - while (true) { - bool screensReady = !mScreens.isEmpty(); - - for (int ii = 0; screensReady && ii < mScreens.count(); ++ii) { - if (mScreens.at(ii)->geometry() == QRect(0, 0, 0, 0)) - screensReady = false; - } - - if (!screensReady) - blockingReadEvents(); - else - return; - } -} - void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uint32_t version) { struct ::wl_registry *registry = object(); diff --git a/src/plugins/platforms/wayland/qwaylanddisplay_p.h b/src/plugins/platforms/wayland/qwaylanddisplay_p.h index 86e3b729f5a..e5cdbee9a48 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay_p.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay_p.h @@ -224,7 +224,6 @@ public slots: void flushRequests(); private: - void waitForScreens(); void checkError() const; void handleWaylandSync(); From 9fd8a5cfb03cd13b6796516a8ea49ce83e2d106d Mon Sep 17 00:00:00 2001 From: Ville Voutilainen Date: Mon, 18 Jan 2021 12:31:31 +0200 Subject: [PATCH 0916/1507] Build fixes for GCC 11 Task-number: QTBUG-89977 Change-Id: I7e3d0964087865e8062f539f851a61f3df017dae Reviewed-by: David Edmundson --- tests/auto/wayland/shared/corecompositor.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/auto/wayland/shared/corecompositor.cpp b/tests/auto/wayland/shared/corecompositor.cpp index 5c6c83baa88..fa9b7662a06 100644 --- a/tests/auto/wayland/shared/corecompositor.cpp +++ b/tests/auto/wayland/shared/corecompositor.cpp @@ -27,6 +27,7 @@ ****************************************************************************/ #include "corecompositor.h" +#include namespace MockCompositor { From a79dbb835960eef469928b6895bca7f68440456a Mon Sep 17 00:00:00 2001 From: Zhang Liang Date: Mon, 1 Feb 2021 19:29:43 +0800 Subject: [PATCH 0917/1507] Fix: remove listener Add the operation for removing the listener form listener list Change-Id: Ief2ff1303b607eee499543303fe80e51f8f10cc5 Reviewed-by: David Edmundson --- src/plugins/platforms/wayland/qwaylanddisplay.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index d39b25697cc..82dcc63e029 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -447,9 +447,10 @@ void QWaylandDisplay::addRegistryListener(RegistryListener listener, void *data) void QWaylandDisplay::removeListener(RegistryListener listener, void *data) { - std::remove_if(mRegistryListeners.begin(), mRegistryListeners.end(), [=](Listener l){ + auto iter = std::remove_if(mRegistryListeners.begin(), mRegistryListeners.end(), [=](Listener l){ return (l.listener == listener && l.data == data); }); + mRegistryListeners.erase(iter, mRegistryListeners.end()); } uint32_t QWaylandDisplay::currentTimeMillisec() From 929f5fc2e81f9e5d44c8199581b3502ee49c53a6 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Tue, 9 Feb 2021 17:09:48 +0100 Subject: [PATCH 0918/1507] Remove QMake project files This includes removal of the corresponding .prev_CMakeLists.txt files. Pick-to: 6.1 Task-number: QTBUG-88742 Change-Id: I57922bff138258f5b35d484caa4b00d84e924a06 Reviewed-by: Qt CI Bot Reviewed-by: Oliver Wolff --- .../platforms/wayland/.prev_CMakeLists.txt | 131 --------------- src/plugins/platforms/wayland/client.pro | 149 ------------------ .../plugins/decorations/bradient/bradient.pro | 12 -- .../plugins/decorations/decorations.pro | 3 - .../hardwareintegration/brcm-egl/brcm-egl.pro | 12 -- .../plugins/hardwareintegration/client.pro | 22 --- .../dmabuf-server/dmabuf-server.pro | 15 -- .../drm-egl-server/drm-egl-server.pro | 15 -- .../libhybris-egl-server.pro | 12 -- .../shm-emulation-server.pro | 15 -- .../vulkan-server/vulkan-server.pro | 15 -- .../wayland-egl/.prev_CMakeLists.txt | 30 ---- .../wayland-egl/wayland-egl.pro | 14 -- .../xcomposite-egl/.prev_CMakeLists.txt | 36 ----- .../xcomposite-egl/xcomposite-egl.pro | 15 -- .../xcomposite-glx/xcomposite-glx.pro | 12 -- .../fullscreen-shell-v1.pro | 23 --- .../shellintegration/shellintegration.pro | 7 - .../shellintegration/wl-shell/wl-shell.pro | 25 --- .../shellintegration/xdg-shell/xdg-shell.pro | 28 ---- .../qtwaylandscanner/.prev_CMakeLists.txt | 14 -- .../qtwaylandscanner/qtwaylandscanner.pro | 7 - tests/auto/wayland/client.pro | 20 --- .../auto/wayland/client/.prev_CMakeLists.txt | 39 ----- tests/auto/wayland/client/client.pro | 6 - .../wayland/datadevicev1/.prev_CMakeLists.txt | 32 ---- .../wayland/datadevicev1/datadevicev1.pro | 4 - .../fullscreenshellv1/.prev_CMakeLists.txt | 36 ----- .../fullscreenshellv1/fullscreenshellv1.pro | 4 - .../wayland/inputcontext/.prev_CMakeLists.txt | 32 ---- .../wayland/inputcontext/inputcontext.pro | 4 - .../iviapplication/.prev_CMakeLists.txt | 36 ----- .../wayland/iviapplication/iviapplication.pro | 5 - .../wayland/nooutput/.prev_CMakeLists.txt | 32 ---- tests/auto/wayland/nooutput/nooutput.pro | 5 - .../auto/wayland/output/.prev_CMakeLists.txt | 32 ---- tests/auto/wayland/output/output.pro | 5 - .../primaryselectionv1/.prev_CMakeLists.txt | 33 ---- .../primaryselectionv1/primaryselectionv1.pro | 7 - .../auto/wayland/seatv4/.prev_CMakeLists.txt | 41 ----- tests/auto/wayland/seatv4/seatv4.pro | 9 -- .../auto/wayland/seatv5/.prev_CMakeLists.txt | 32 ---- tests/auto/wayland/seatv5/seatv5.pro | 4 - .../auto/wayland/surface/.prev_CMakeLists.txt | 32 ---- tests/auto/wayland/surface/surface.pro | 5 - .../wayland/tabletv2/.prev_CMakeLists.txt | 33 ---- tests/auto/wayland/tabletv2/tabletv2.pro | 7 - tests/auto/wayland/wl_connect/wl_connect.pro | 5 - .../xdgdecorationv1/.prev_CMakeLists.txt | 33 ---- .../xdgdecorationv1/xdgdecorationv1.pro | 7 - .../wayland/xdgoutput/.prev_CMakeLists.txt | 32 ---- tests/auto/wayland/xdgoutput/xdgoutput.pro | 5 - .../wayland/xdgshell/.prev_CMakeLists.txt | 32 ---- tests/auto/wayland/xdgshell/xdgshell.pro | 5 - 54 files changed, 1226 deletions(-) delete mode 100644 src/plugins/platforms/wayland/.prev_CMakeLists.txt delete mode 100644 src/plugins/platforms/wayland/client.pro delete mode 100644 src/plugins/platforms/wayland/plugins/decorations/bradient/bradient.pro delete mode 100644 src/plugins/platforms/wayland/plugins/decorations/decorations.pro delete mode 100644 src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/brcm-egl.pro delete mode 100644 src/plugins/platforms/wayland/plugins/hardwareintegration/client.pro delete mode 100644 src/plugins/platforms/wayland/plugins/hardwareintegration/dmabuf-server/dmabuf-server.pro delete mode 100644 src/plugins/platforms/wayland/plugins/hardwareintegration/drm-egl-server/drm-egl-server.pro delete mode 100644 src/plugins/platforms/wayland/plugins/hardwareintegration/libhybris-egl-server/libhybris-egl-server.pro delete mode 100644 src/plugins/platforms/wayland/plugins/hardwareintegration/shm-emulation-server/shm-emulation-server.pro delete mode 100644 src/plugins/platforms/wayland/plugins/hardwareintegration/vulkan-server/vulkan-server.pro delete mode 100644 src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/.prev_CMakeLists.txt delete mode 100644 src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/wayland-egl.pro delete mode 100644 src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-egl/.prev_CMakeLists.txt delete mode 100644 src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-egl/xcomposite-egl.pro delete mode 100644 src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-glx/xcomposite-glx.pro delete mode 100644 src/plugins/platforms/wayland/plugins/shellintegration/fullscreen-shell-v1/fullscreen-shell-v1.pro delete mode 100644 src/plugins/platforms/wayland/plugins/shellintegration/shellintegration.pro delete mode 100644 src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/wl-shell.pro delete mode 100644 src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/xdg-shell.pro delete mode 100644 src/tools/qtwaylandscanner/.prev_CMakeLists.txt delete mode 100644 src/tools/qtwaylandscanner/qtwaylandscanner.pro delete mode 100644 tests/auto/wayland/client.pro delete mode 100644 tests/auto/wayland/client/.prev_CMakeLists.txt delete mode 100644 tests/auto/wayland/client/client.pro delete mode 100644 tests/auto/wayland/datadevicev1/.prev_CMakeLists.txt delete mode 100644 tests/auto/wayland/datadevicev1/datadevicev1.pro delete mode 100644 tests/auto/wayland/fullscreenshellv1/.prev_CMakeLists.txt delete mode 100644 tests/auto/wayland/fullscreenshellv1/fullscreenshellv1.pro delete mode 100644 tests/auto/wayland/inputcontext/.prev_CMakeLists.txt delete mode 100644 tests/auto/wayland/inputcontext/inputcontext.pro delete mode 100644 tests/auto/wayland/iviapplication/.prev_CMakeLists.txt delete mode 100644 tests/auto/wayland/iviapplication/iviapplication.pro delete mode 100644 tests/auto/wayland/nooutput/.prev_CMakeLists.txt delete mode 100644 tests/auto/wayland/nooutput/nooutput.pro delete mode 100644 tests/auto/wayland/output/.prev_CMakeLists.txt delete mode 100644 tests/auto/wayland/output/output.pro delete mode 100644 tests/auto/wayland/primaryselectionv1/.prev_CMakeLists.txt delete mode 100644 tests/auto/wayland/primaryselectionv1/primaryselectionv1.pro delete mode 100644 tests/auto/wayland/seatv4/.prev_CMakeLists.txt delete mode 100644 tests/auto/wayland/seatv4/seatv4.pro delete mode 100644 tests/auto/wayland/seatv5/.prev_CMakeLists.txt delete mode 100644 tests/auto/wayland/seatv5/seatv5.pro delete mode 100644 tests/auto/wayland/surface/.prev_CMakeLists.txt delete mode 100644 tests/auto/wayland/surface/surface.pro delete mode 100644 tests/auto/wayland/tabletv2/.prev_CMakeLists.txt delete mode 100644 tests/auto/wayland/tabletv2/tabletv2.pro delete mode 100644 tests/auto/wayland/wl_connect/wl_connect.pro delete mode 100644 tests/auto/wayland/xdgdecorationv1/.prev_CMakeLists.txt delete mode 100644 tests/auto/wayland/xdgdecorationv1/xdgdecorationv1.pro delete mode 100644 tests/auto/wayland/xdgoutput/.prev_CMakeLists.txt delete mode 100644 tests/auto/wayland/xdgoutput/xdgoutput.pro delete mode 100644 tests/auto/wayland/xdgshell/.prev_CMakeLists.txt delete mode 100644 tests/auto/wayland/xdgshell/xdgshell.pro diff --git a/src/plugins/platforms/wayland/.prev_CMakeLists.txt b/src/plugins/platforms/wayland/.prev_CMakeLists.txt deleted file mode 100644 index ede73a07ca0..00000000000 --- a/src/plugins/platforms/wayland/.prev_CMakeLists.txt +++ /dev/null @@ -1,131 +0,0 @@ -# Generated from client.pro. - -##################################################################### -## WaylandClient Module: -##################################################################### - -qt_internal_add_module(WaylandClient - PLUGIN_TYPES wayland-graphics-integration-client wayland-inputdevice-integration wayland-decoration-client wayland-shell-integration - SOURCES - ../shared/qwaylandinputmethodeventbuilder.cpp ../shared/qwaylandinputmethodeventbuilder_p.h - ../shared/qwaylandmimehelper.cpp ../shared/qwaylandmimehelper_p.h - ../shared/qwaylandsharedmemoryformathelper_p.h - global/qwaylandclientextension.cpp global/qwaylandclientextension.h global/qwaylandclientextension_p.h - hardwareintegration/qwaylandclientbufferintegration.cpp hardwareintegration/qwaylandclientbufferintegration_p.h - hardwareintegration/qwaylandclientbufferintegrationfactory.cpp hardwareintegration/qwaylandclientbufferintegrationfactory_p.h - hardwareintegration/qwaylandclientbufferintegrationplugin.cpp hardwareintegration/qwaylandclientbufferintegrationplugin_p.h - hardwareintegration/qwaylandhardwareintegration.cpp hardwareintegration/qwaylandhardwareintegration_p.h - hardwareintegration/qwaylandserverbufferintegration.cpp hardwareintegration/qwaylandserverbufferintegration_p.h - hardwareintegration/qwaylandserverbufferintegrationfactory.cpp hardwareintegration/qwaylandserverbufferintegrationfactory_p.h - hardwareintegration/qwaylandserverbufferintegrationplugin.cpp hardwareintegration/qwaylandserverbufferintegrationplugin_p.h - inputdeviceintegration/qwaylandinputdeviceintegration_p.h - inputdeviceintegration/qwaylandinputdeviceintegrationfactory.cpp inputdeviceintegration/qwaylandinputdeviceintegrationfactory_p.h - inputdeviceintegration/qwaylandinputdeviceintegrationplugin.cpp inputdeviceintegration/qwaylandinputdeviceintegrationplugin_p.h - qtwaylandclientglobal.h qtwaylandclientglobal_p.h - qwaylandabstractdecoration.cpp qwaylandabstractdecoration_p.h - qwaylandbuffer.cpp qwaylandbuffer_p.h - qwaylanddecorationfactory.cpp qwaylanddecorationfactory_p.h - qwaylanddecorationplugin.cpp qwaylanddecorationplugin_p.h - qwaylanddisplay.cpp qwaylanddisplay_p.h - qwaylandextendedsurface.cpp qwaylandextendedsurface_p.h - qwaylandinputcontext.cpp qwaylandinputcontext_p.h - qwaylandinputdevice.cpp qwaylandinputdevice_p.h - qwaylandinputmethodcontext.cpp qwaylandinputmethodcontext_p.h - qwaylandintegration.cpp qwaylandintegration_p.h - qwaylandnativeinterface.cpp qwaylandnativeinterface_p.h - qwaylandqtkey.cpp qwaylandqtkey_p.h - qwaylandscreen.cpp qwaylandscreen_p.h - qwaylandshellsurface.cpp qwaylandshellsurface_p.h - qwaylandshm.cpp qwaylandshm_p.h - qwaylandshmbackingstore.cpp qwaylandshmbackingstore_p.h - qwaylandshmwindow.cpp qwaylandshmwindow_p.h - qwaylandsubsurface.cpp qwaylandsubsurface_p.h - qwaylandsurface.cpp qwaylandsurface_p.h - qwaylandtabletv2.cpp qwaylandtabletv2_p.h - qwaylandtouch.cpp qwaylandtouch_p.h - qwaylandwindow.cpp qwaylandwindow_p.h - qwaylandwindowmanagerintegration.cpp qwaylandwindowmanagerintegration_p.h - shellintegration/qwaylandshellintegration_p.h - shellintegration/qwaylandshellintegrationfactory.cpp shellintegration/qwaylandshellintegrationfactory_p.h - shellintegration/qwaylandshellintegrationplugin.cpp shellintegration/qwaylandshellintegrationplugin_p.h - INCLUDE_DIRECTORIES - ../shared - global - hardwareintegration - inputdeviceintegration - shellintegration - LIBRARIES - Qt::CorePrivate - Qt::GuiPrivate - PUBLIC_LIBRARIES - Qt::Core - Qt::Gui - Wayland::Client - PRIVATE_MODULE_INTERFACE - Qt::CorePrivate - Qt::GuiPrivate -) - -qt6_generate_wayland_protocol_client_sources(WaylandClient - FILES - ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/tablet-unstable-v2.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/text-input-unstable-v2.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/wayland.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/wp-primary-selection-unstable-v1.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/xdg-output-unstable-v1.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../extensions/qt-key-unstable-v1.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../extensions/qt-text-input-method-unstable-v1.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../extensions/qt-windowmanager.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../extensions/surface-extension.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../extensions/touch-extension.xml - ${CMAKE_CURRENT_SOURCE_DIR}/hardwareintegration/../../extensions/hardware-integration.xml - ${CMAKE_CURRENT_SOURCE_DIR}/hardwareintegration/../../extensions/server-buffer-extension.xml -) - -#### Keys ignored in scope 1:.:.:client.pro:: -# MODULE = "waylandclient" -# QMAKE_CXXFLAGS_WARN_ON = "--Wcast-qual" - -## Scopes: -##################################################################### - -qt_internal_extend_target(WaylandClient CONDITION QT_FEATURE_xkbcommon - PUBLIC_LIBRARIES - XKB::XKB -) - -qt_internal_extend_target(WaylandClient CONDITION QT_FEATURE_clipboard - SOURCES - qwaylandclipboard.cpp qwaylandclipboard_p.h -) - -qt_internal_extend_target(WaylandClient CONDITION QT_FEATURE_vulkan - SOURCES - qwaylandvulkaninstance.cpp qwaylandvulkaninstance_p.h - qwaylandvulkanwindow.cpp qwaylandvulkanwindow_p.h -) - -qt_internal_extend_target(WaylandClient CONDITION QT_FEATURE_cursor - SOURCES - qwaylandcursor.cpp qwaylandcursor_p.h - PUBLIC_LIBRARIES - Wayland::Cursor -) - -qt_internal_extend_target(WaylandClient CONDITION QT_FEATURE_wayland_datadevice - SOURCES - qwaylanddatadevice.cpp qwaylanddatadevice_p.h - qwaylanddatadevicemanager.cpp qwaylanddatadevicemanager_p.h - qwaylanddataoffer.cpp qwaylanddataoffer_p.h - qwaylanddatasource.cpp qwaylanddatasource_p.h -) - -qt_internal_extend_target(WaylandClient CONDITION QT_FEATURE_wayland_client_primary_selection - SOURCES - qwaylandprimaryselectionv1.cpp qwaylandprimaryselectionv1_p.h -) - -qt_internal_extend_target(WaylandClient CONDITION QT_FEATURE_draganddrop - SOURCES - qwaylanddnd.cpp qwaylanddnd_p.h -) diff --git a/src/plugins/platforms/wayland/client.pro b/src/plugins/platforms/wayland/client.pro deleted file mode 100644 index 5a071d9ed93..00000000000 --- a/src/plugins/platforms/wayland/client.pro +++ /dev/null @@ -1,149 +0,0 @@ -TARGET = QtWaylandClient -MODULE = waylandclient - -QT += core-private gui-private - -# We have a bunch of C code with casts, so we can't have this option -QMAKE_CXXFLAGS_WARN_ON -= -Wcast-qual - -# Prevent gold linker from crashing. -# This started happening when QtPlatformSupport was modularized. -use_gold_linker: CONFIG += no_linker_version_script - -CONFIG -= precompile_header -CONFIG += link_pkgconfig wayland-scanner - -QMAKE_USE += wayland-client -qtConfig(xkbcommon): \ - QMAKE_USE += xkbcommon - -INCLUDEPATH += $$PWD/../shared - -WAYLANDCLIENTSOURCES += \ - ../extensions/surface-extension.xml \ - ../extensions/touch-extension.xml \ - ../extensions/qt-key-unstable-v1.xml \ - ../extensions/qt-windowmanager.xml \ - ../extensions/qt-text-input-method-unstable-v1.xml \ - ../3rdparty/protocol/wp-primary-selection-unstable-v1.xml \ - ../3rdparty/protocol/tablet-unstable-v2.xml \ - ../3rdparty/protocol/text-input-unstable-v2.xml \ - ../3rdparty/protocol/xdg-output-unstable-v1.xml \ - ../3rdparty/protocol/wayland.xml - -SOURCES += qwaylandintegration.cpp \ - qwaylandnativeinterface.cpp \ - qwaylandshmbackingstore.cpp \ - qwaylandinputdevice.cpp \ - qwaylanddisplay.cpp \ - qwaylandwindow.cpp \ - qwaylandscreen.cpp \ - qwaylandshmwindow.cpp \ - qwaylandshellsurface.cpp \ - qwaylandextendedsurface.cpp \ - qwaylandsubsurface.cpp \ - qwaylandsurface.cpp \ - qwaylandtabletv2.cpp \ - qwaylandtouch.cpp \ - qwaylandqtkey.cpp \ - ../shared/qwaylandmimehelper.cpp \ - ../shared/qwaylandinputmethodeventbuilder.cpp \ - qwaylandabstractdecoration.cpp \ - qwaylanddecorationfactory.cpp \ - qwaylanddecorationplugin.cpp \ - qwaylandwindowmanagerintegration.cpp \ - qwaylandinputcontext.cpp \ - qwaylandinputmethodcontext.cpp \ - qwaylandshm.cpp \ - qwaylandbuffer.cpp \ - -HEADERS += qwaylandintegration_p.h \ - qwaylandnativeinterface_p.h \ - qwaylanddisplay_p.h \ - qwaylandwindow_p.h \ - qwaylandscreen_p.h \ - qwaylandshmbackingstore_p.h \ - qwaylandinputdevice_p.h \ - qwaylandbuffer_p.h \ - qwaylandshmwindow_p.h \ - qwaylandshellsurface_p.h \ - qwaylandextendedsurface_p.h \ - qwaylandsubsurface_p.h \ - qwaylandsurface_p.h \ - qwaylandtabletv2_p.h \ - qwaylandtouch_p.h \ - qwaylandqtkey_p.h \ - qwaylandabstractdecoration_p.h \ - qwaylanddecorationfactory_p.h \ - qwaylanddecorationplugin_p.h \ - qwaylandwindowmanagerintegration_p.h \ - qwaylandinputcontext_p.h \ - qwaylandinputmethodcontext_p.h \ - qwaylandshm_p.h \ - qtwaylandclientglobal.h \ - qtwaylandclientglobal_p.h \ - ../shared/qwaylandinputmethodeventbuilder_p.h \ - ../shared/qwaylandmimehelper_p.h \ - ../shared/qwaylandsharedmemoryformathelper_p.h \ - -qtConfig(clipboard) { - HEADERS += qwaylandclipboard_p.h - SOURCES += qwaylandclipboard.cpp -} - -include(hardwareintegration/hardwareintegration.pri) -include(shellintegration/shellintegration.pri) -include(inputdeviceintegration/inputdeviceintegration.pri) -include(global/global.pri) - -qtConfig(vulkan) { - HEADERS += \ - qwaylandvulkaninstance_p.h \ - qwaylandvulkanwindow_p.h - - SOURCES += \ - qwaylandvulkaninstance.cpp \ - qwaylandvulkanwindow.cpp -} - -qtConfig(cursor) { - QMAKE_USE += wayland-cursor - - HEADERS += \ - qwaylandcursor_p.h - SOURCES += \ - qwaylandcursor.cpp -} - -qtConfig(wayland-datadevice) { - HEADERS += \ - qwaylanddatadevice_p.h \ - qwaylanddatadevicemanager_p.h \ - qwaylanddataoffer_p.h \ - qwaylanddatasource_p.h - SOURCES += \ - qwaylanddatadevice.cpp \ - qwaylanddatadevicemanager.cpp \ - qwaylanddataoffer.cpp \ - qwaylanddatasource.cpp -} - -qtConfig(wayland-client-primary-selection) { - HEADERS += qwaylandprimaryselectionv1_p.h - SOURCES += qwaylandprimaryselectionv1.cpp -} - -qtConfig(draganddrop) { - HEADERS += \ - qwaylanddnd_p.h - SOURCES += \ - qwaylanddnd.cpp -} - -CONFIG += generated_privates -MODULE_PLUGIN_TYPES = \ - wayland-graphics-integration-client \ - wayland-inputdevice-integration \ - wayland-decoration-client \ - wayland-shell-integration -load(qt_module) diff --git a/src/plugins/platforms/wayland/plugins/decorations/bradient/bradient.pro b/src/plugins/platforms/wayland/plugins/decorations/bradient/bradient.pro deleted file mode 100644 index e31576783b6..00000000000 --- a/src/plugins/platforms/wayland/plugins/decorations/bradient/bradient.pro +++ /dev/null @@ -1,12 +0,0 @@ -QT += waylandclient-private - -OTHER_FILES += \ - bradient.json - -SOURCES += main.cpp - -QMAKE_USE += wayland-client - -PLUGIN_TYPE = wayland-decoration-client -PLUGIN_CLASS_NAME = QWaylandBradientDecorationPlugin -load(qt_plugin) diff --git a/src/plugins/platforms/wayland/plugins/decorations/decorations.pro b/src/plugins/platforms/wayland/plugins/decorations/decorations.pro deleted file mode 100644 index 6d51a450fb2..00000000000 --- a/src/plugins/platforms/wayland/plugins/decorations/decorations.pro +++ /dev/null @@ -1,3 +0,0 @@ -TEMPLATE = subdirs -SUBDIRS += \ - bradient diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/brcm-egl.pro b/src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/brcm-egl.pro deleted file mode 100644 index c2e9ad4ffb9..00000000000 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/brcm-egl.pro +++ /dev/null @@ -1,12 +0,0 @@ -QT += waylandclient-private - -include(../../../../hardwareintegration/client/brcm-egl/brcm-egl.pri) - -OTHER_FILES += \ - brcm-egl.json - -SOURCES += main.cpp - -PLUGIN_TYPE = wayland-graphics-integration-client -PLUGIN_CLASS_NAME = QWaylandBrcmEglClientBufferPlugin -load(qt_plugin) diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/client.pro b/src/plugins/platforms/wayland/plugins/hardwareintegration/client.pro deleted file mode 100644 index 7b7e8a49af8..00000000000 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/client.pro +++ /dev/null @@ -1,22 +0,0 @@ -TEMPLATE=subdirs -QT_FOR_CONFIG += waylandclient-private - -qtConfig(wayland-egl): \ - SUBDIRS += wayland-egl -qtConfig(wayland-brcm): \ - SUBDIRS += brcm-egl -qtConfig(xcomposite-egl): \ - SUBDIRS += xcomposite-egl -qtConfig(xcomposite-glx): \ - SUBDIRS += xcomposite-glx - -qtConfig(wayland-drm-egl-server-buffer): \ - SUBDIRS += drm-egl-server -qtConfig(wayland-libhybris-egl-server-buffer): \ - SUBDIRS += libhybris-egl-server -qtConfig(wayland-shm-emulation-server-buffer): \ - SUBDIRS += shm-emulation-server -qtConfig(wayland-dmabuf-server-buffer): \ - SUBDIRS += dmabuf-server -qtConfig(wayland-vulkan-server-buffer): \ - SUBDIRS += vulkan-server diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/dmabuf-server/dmabuf-server.pro b/src/plugins/platforms/wayland/plugins/hardwareintegration/dmabuf-server/dmabuf-server.pro deleted file mode 100644 index 3c91b2ecf0a..00000000000 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/dmabuf-server/dmabuf-server.pro +++ /dev/null @@ -1,15 +0,0 @@ -# We have a bunch of C code with casts, so we can't have this option -QMAKE_CXXFLAGS_WARN_ON -= -Wcast-qual - -QT += waylandclient-private opengl - -include(../../../../hardwareintegration/client/dmabuf-server/dmabuf-server.pri) - -OTHER_FILES += \ - dmabuf-server.json - -SOURCES += main.cpp - -PLUGIN_TYPE = wayland-graphics-integration-client -PLUGIN_CLASS_NAME = DmaBufServerBufferPlugin -load(qt_plugin) diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/drm-egl-server/drm-egl-server.pro b/src/plugins/platforms/wayland/plugins/hardwareintegration/drm-egl-server/drm-egl-server.pro deleted file mode 100644 index 390278b1c7d..00000000000 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/drm-egl-server/drm-egl-server.pro +++ /dev/null @@ -1,15 +0,0 @@ -# We have a bunch of C code with casts, so we can't have this option -QMAKE_CXXFLAGS_WARN_ON -= -Wcast-qual - -QT += waylandclient-private opengl - -include(../../../../hardwareintegration/client/drm-egl-server/drm-egl-server.pri) - -OTHER_FILES += \ - drm-egl-server.json - -SOURCES += main.cpp - -PLUGIN_TYPE = wayland-graphics-integration-client -PLUGIN_CLASS_NAME = DrmEglServerBufferPlugin -load(qt_plugin) diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/libhybris-egl-server/libhybris-egl-server.pro b/src/plugins/platforms/wayland/plugins/hardwareintegration/libhybris-egl-server/libhybris-egl-server.pro deleted file mode 100644 index 3193b8f6877..00000000000 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/libhybris-egl-server/libhybris-egl-server.pro +++ /dev/null @@ -1,12 +0,0 @@ -QT += waylandclient-private - -include(../../../../hardwareintegration/client/libhybris-egl-server/libhybris-egl-server.pri) - -OTHER_FILES += \ - libhybris-egl-server.json - -SOURCES += main.cpp - -PLUGIN_TYPE = wayland-graphics-integration-client -PLUGIN_CLASS_NAME = LibHybrisEglServerBufferPlugin -load(qt_plugin) diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/shm-emulation-server/shm-emulation-server.pro b/src/plugins/platforms/wayland/plugins/hardwareintegration/shm-emulation-server/shm-emulation-server.pro deleted file mode 100644 index 9e9319d2535..00000000000 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/shm-emulation-server/shm-emulation-server.pro +++ /dev/null @@ -1,15 +0,0 @@ -# We have a bunch of C code with casts, so we can't have this option -QMAKE_CXXFLAGS_WARN_ON -= -Wcast-qual - -QT += waylandclient-private opengl - -include(../../../../hardwareintegration/client/shm-emulation-server/shm-emulation-server.pri) - -OTHER_FILES += \ - shm-emulation-server.json - -SOURCES += main.cpp - -PLUGIN_TYPE = wayland-graphics-integration-client -PLUGIN_CLASS_NAME = ShmServerBufferPlugin -load(qt_plugin) diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/vulkan-server/vulkan-server.pro b/src/plugins/platforms/wayland/plugins/hardwareintegration/vulkan-server/vulkan-server.pro deleted file mode 100644 index 13cb2ab90e6..00000000000 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/vulkan-server/vulkan-server.pro +++ /dev/null @@ -1,15 +0,0 @@ -# We have a bunch of C code with casts, so we can't have this option -QMAKE_CXXFLAGS_WARN_ON -= -Wcast-qual - -QT += waylandclient-private opengl - -include(../../../../hardwareintegration/client/vulkan-server/vulkan-server.pri) - -OTHER_FILES += \ - vulkan-server.json - -SOURCES += main.cpp - -PLUGIN_TYPE = wayland-graphics-integration-client -PLUGIN_CLASS_NAME = VulkanServerBufferPlugin -load(qt_plugin) diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/.prev_CMakeLists.txt b/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/.prev_CMakeLists.txt deleted file mode 100644 index b1732b014b4..00000000000 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/.prev_CMakeLists.txt +++ /dev/null @@ -1,30 +0,0 @@ -# Generated from wayland-egl.pro. - -##################################################################### -## QWaylandEglClientBufferPlugin Plugin: -##################################################################### - -qt_internal_add_plugin(QWaylandEglClientBufferPlugin - OUTPUT_NAME qt-plugin-wayland-egl - TYPE wayland-graphics-integration-client - SOURCES - ../../../../hardwareintegration/client/wayland-egl/qwaylandeglclientbufferintegration.cpp ../../../../hardwareintegration/client/wayland-egl/qwaylandeglclientbufferintegration.h - ../../../../hardwareintegration/client/wayland-egl/qwaylandeglinclude.h - ../../../../hardwareintegration/client/wayland-egl/qwaylandeglwindow.cpp ../../../../hardwareintegration/client/wayland-egl/qwaylandeglwindow.h - ../../../../hardwareintegration/client/wayland-egl/qwaylandglcontext.cpp ../../../../hardwareintegration/client/wayland-egl/qwaylandglcontext.h - main.cpp - INCLUDE_DIRECTORIES - ../../../../hardwareintegration/client/wayland-egl - PUBLIC_LIBRARIES - ${CMAKE_DL_LIBS} - EGL::EGL - Qt::Core - Qt::Gui - Qt::OpenGLPrivate - Qt::WaylandClientPrivate - Wayland::Client - Wayland::Egl -) - -#### Keys ignored in scope 1:.:.:wayland-egl.pro:: -# OTHER_FILES = "wayland-egl.json" diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/wayland-egl.pro b/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/wayland-egl.pro deleted file mode 100644 index 409cd37d7c7..00000000000 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/wayland-egl.pro +++ /dev/null @@ -1,14 +0,0 @@ -QT += waylandclient-private - -include(../../../../hardwareintegration/client/wayland-egl/wayland-egl.pri) - -OTHER_FILES += \ - wayland-egl.json - -SOURCES += main.cpp - -TARGET = qt-plugin-wayland-egl - -PLUGIN_TYPE = wayland-graphics-integration-client -PLUGIN_CLASS_NAME = QWaylandEglClientBufferPlugin -load(qt_plugin) diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-egl/.prev_CMakeLists.txt b/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-egl/.prev_CMakeLists.txt deleted file mode 100644 index f575d44e935..00000000000 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-egl/.prev_CMakeLists.txt +++ /dev/null @@ -1,36 +0,0 @@ -# Generated from xcomposite-egl.pro. - -##################################################################### -## QWaylandXCompositeEglClientBufferPlugin Plugin: -##################################################################### - -qt_internal_add_plugin(QWaylandXCompositeEglClientBufferPlugin - OUTPUT_NAME xcomposite-egl - TYPE wayland-graphics-integration-client - SOURCES - ../../../../hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglclientbufferintegration.cpp ../../../../hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglclientbufferintegration.h - ../../../../hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglcontext.cpp ../../../../hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglcontext.h - ../../../../hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglwindow.cpp ../../../../hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglwindow.h - ../../../../hardwareintegration/client/xcomposite_share/qwaylandxcompositebuffer.cpp ../../../../hardwareintegration/client/xcomposite_share/qwaylandxcompositebuffer.h - main.cpp - INCLUDE_DIRECTORIES - ../../../../hardwareintegration/client/xcomposite-egl - ../../../../hardwareintegration/client/xcomposite_share - PUBLIC_LIBRARIES - EGL::EGL - PkgConfig::XComposite - Qt::Core - Qt::Gui - Qt::WaylandClientPrivate - Wayland::Client - X11::X11 -) - -qt6_generate_wayland_protocol_client_sources(QWaylandXCompositeEglClientBufferPlugin - FILES - ${CMAKE_CURRENT_SOURCE_DIR}/../../../../hardwareintegration/client/xcomposite_share/../../../extensions/xcomposite.xml -) - -#### Keys ignored in scope 1:.:.:xcomposite-egl.pro:: -# OTHER_FILES = "xcomposite-egl.json" -# QMAKE_CXXFLAGS_WARN_ON = "--Wcast-qual" diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-egl/xcomposite-egl.pro b/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-egl/xcomposite-egl.pro deleted file mode 100644 index 83bd4fe8d84..00000000000 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-egl/xcomposite-egl.pro +++ /dev/null @@ -1,15 +0,0 @@ -# We have a bunch of C code with casts, so we can't have this option -QMAKE_CXXFLAGS_WARN_ON -= -Wcast-qual - -QT += waylandclient-private - -include(../../../../hardwareintegration/client/xcomposite-egl/xcomposite-egl.pri) - -OTHER_FILES += xcomposite-egl.json - -SOURCES += \ - main.cpp - -PLUGIN_TYPE = wayland-graphics-integration-client -PLUGIN_CLASS_NAME = QWaylandXCompositeEglClientBufferPlugin -load(qt_plugin) diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-glx/xcomposite-glx.pro b/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-glx/xcomposite-glx.pro deleted file mode 100644 index 804ca386197..00000000000 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-glx/xcomposite-glx.pro +++ /dev/null @@ -1,12 +0,0 @@ -QT += waylandclient-private - -include(../../../../hardwareintegration/client/xcomposite-glx/xcomposite-glx.pri) - -OTHER_FILES += xcomposite-glx.json - -SOURCES += \ - main.cpp - -PLUGIN_TYPE = wayland-graphics-integration-client -PLUGIN_CLASS_NAME = QWaylandXCompositeGlxClientBufferPlugin -load(qt_plugin) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/fullscreen-shell-v1/fullscreen-shell-v1.pro b/src/plugins/platforms/wayland/plugins/shellintegration/fullscreen-shell-v1/fullscreen-shell-v1.pro deleted file mode 100644 index a522f87a8d3..00000000000 --- a/src/plugins/platforms/wayland/plugins/shellintegration/fullscreen-shell-v1/fullscreen-shell-v1.pro +++ /dev/null @@ -1,23 +0,0 @@ -QT += gui-private waylandclient-private -CONFIG += wayland-scanner - -QMAKE_USE += wayland-client - -WAYLANDCLIENTSOURCES += \ - ../../../3rdparty/protocol/fullscreen-shell-unstable-v1.xml - -HEADERS += \ - qwaylandfullscreenshellv1integration.h \ - qwaylandfullscreenshellv1surface.h - -SOURCES += \ - main.cpp \ - qwaylandfullscreenshellv1integration.cpp \ - qwaylandfullscreenshellv1surface.cpp - -OTHER_FILES += \ - fullscreen-shell-v1.json - -PLUGIN_TYPE = wayland-shell-integration -PLUGIN_CLASS_NAME = QWaylandFullScreenShellV1IntegrationPlugin -load(qt_plugin) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/shellintegration.pro b/src/plugins/platforms/wayland/plugins/shellintegration/shellintegration.pro deleted file mode 100644 index 8cfad2d4f81..00000000000 --- a/src/plugins/platforms/wayland/plugins/shellintegration/shellintegration.pro +++ /dev/null @@ -1,7 +0,0 @@ -TEMPLATE = subdirs -QT_FOR_CONFIG += waylandclient-private - -qtConfig(wayland-client-fullscreen-shell-v1): SUBDIRS += fullscreen-shell-v1 -qtConfig(wayland-client-ivi-shell): SUBDIRS += ivi-shell -qtConfig(wayland-client-wl-shell): SUBDIRS += wl-shell -qtConfig(wayland-client-xdg-shell): SUBDIRS += xdg-shell diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/wl-shell.pro b/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/wl-shell.pro deleted file mode 100644 index bb2c1829afe..00000000000 --- a/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/wl-shell.pro +++ /dev/null @@ -1,25 +0,0 @@ -QT += gui-private waylandclient-private -CONFIG += wayland-scanner - -QMAKE_USE += wayland-client -qtConfig(xkbcommon): \ - QMAKE_USE_PRIVATE += xkbcommon - -WAYLANDCLIENTSOURCES += \ - ../../../3rdparty/protocol/wayland.xml - -HEADERS += \ - qwaylandwlshellintegration_p.h \ - qwaylandwlshellsurface_p.h \ - -SOURCES += \ - main.cpp \ - qwaylandwlshellintegration.cpp \ - qwaylandwlshellsurface.cpp \ - -OTHER_FILES += \ - wl-shell.json - -PLUGIN_TYPE = wayland-shell-integration -PLUGIN_CLASS_NAME = QWaylandWlShellIntegrationPlugin -load(qt_plugin) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/xdg-shell.pro b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/xdg-shell.pro deleted file mode 100644 index 261715845c8..00000000000 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/xdg-shell.pro +++ /dev/null @@ -1,28 +0,0 @@ -QT += gui-private waylandclient-private -CONFIG += wayland-scanner - -QMAKE_USE += wayland-client -qtConfig(xkbcommon): \ - QMAKE_USE_PRIVATE += xkbcommon - -WAYLANDCLIENTSOURCES += \ - ../../../3rdparty/protocol/xdg-decoration-unstable-v1.xml \ - ../../../3rdparty/protocol/xdg-shell.xml - -HEADERS += \ - qwaylandxdgdecorationv1_p.h \ - qwaylandxdgshell_p.h \ - qwaylandxdgshellintegration_p.h \ - -SOURCES += \ - main.cpp \ - qwaylandxdgdecorationv1.cpp \ - qwaylandxdgshell.cpp \ - qwaylandxdgshellintegration.cpp \ - -OTHER_FILES += \ - xdg-shell.json - -PLUGIN_TYPE = wayland-shell-integration -PLUGIN_CLASS_NAME = QWaylandXdgShellIntegrationPlugin -load(qt_plugin) diff --git a/src/tools/qtwaylandscanner/.prev_CMakeLists.txt b/src/tools/qtwaylandscanner/.prev_CMakeLists.txt deleted file mode 100644 index 156ef030ead..00000000000 --- a/src/tools/qtwaylandscanner/.prev_CMakeLists.txt +++ /dev/null @@ -1,14 +0,0 @@ -# Generated from qtwaylandscanner.pro. - -##################################################################### -## qtwaylandscanner Tool: -##################################################################### - -qt_get_tool_target_name(target_name qtwaylandscanner) -qt_internal_add_tool(${target_name} - SOURCES - qtwaylandscanner.cpp -) - -#### Keys ignored in scope 1:.:.:qtwaylandscanner.pro:: -# _OPTION = "host_build" diff --git a/src/tools/qtwaylandscanner/qtwaylandscanner.pro b/src/tools/qtwaylandscanner/qtwaylandscanner.pro deleted file mode 100644 index cad7bbfb6a1..00000000000 --- a/src/tools/qtwaylandscanner/qtwaylandscanner.pro +++ /dev/null @@ -1,7 +0,0 @@ -option(host_build) - -SOURCES += qtwaylandscanner.cpp -QT = core - -load(qt_tool) - diff --git a/tests/auto/wayland/client.pro b/tests/auto/wayland/client.pro deleted file mode 100644 index 7f5ffc0f7bd..00000000000 --- a/tests/auto/wayland/client.pro +++ /dev/null @@ -1,20 +0,0 @@ -TEMPLATE=subdirs - -SUBDIRS += \ - client \ - datadevicev1 \ - fullscreenshellv1 \ - iviapplication \ - nooutput \ - output \ - primaryselectionv1 \ - seatv4 \ - seatv5 \ - surface \ - tabletv2 \ - wl_connect \ - xdgdecorationv1 \ - xdgoutput \ - xdgshell - -qtConfig(im): SUBDIRS += inputcontext diff --git a/tests/auto/wayland/client/.prev_CMakeLists.txt b/tests/auto/wayland/client/.prev_CMakeLists.txt deleted file mode 100644 index 0aeb3f27f0c..00000000000 --- a/tests/auto/wayland/client/.prev_CMakeLists.txt +++ /dev/null @@ -1,39 +0,0 @@ -# Generated from client.pro. - -##################################################################### -## tst_client Test: -##################################################################### - -qt_internal_add_test(tst_client - SOURCES - ../shared_old/mockcompositor.cpp ../shared_old/mockcompositor.h - ../shared_old/mockfullscreenshellv1.cpp ../shared_old/mockfullscreenshellv1.h - ../shared_old/mockinput.cpp ../shared_old/mockinput.h - ../shared_old/mockiviapplication.cpp ../shared_old/mockiviapplication.h - ../shared_old/mockoutput.cpp ../shared_old/mockoutput.h - ../shared_old/mockregion.cpp ../shared_old/mockregion.h - ../shared_old/mocksurface.cpp ../shared_old/mocksurface.h - ../shared_old/mockwlshell.cpp ../shared_old/mockwlshell.h - tst_client.cpp - INCLUDE_DIRECTORIES - ../shared_old - PUBLIC_LIBRARIES - Qt::CorePrivate - Qt::Gui - Qt::GuiPrivate - Qt::OpenGL - Qt::WaylandClientPrivate - Wayland::Client - Wayland::Server -) - -qt6_generate_wayland_protocol_server_sources(tst_client - FILES - ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/fullscreen-shell-unstable-v1.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/ivi-application.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/wayland.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/xdg-shell.xml -) - -#### Keys ignored in scope 1:.:.:client.pro:: -# check.commands = "$(TESTRUNNER)" "$${PWD}/run-with-all-shells.sh" "$(TESTARGS)" diff --git a/tests/auto/wayland/client/client.pro b/tests/auto/wayland/client/client.pro deleted file mode 100644 index 7c3a934d067..00000000000 --- a/tests/auto/wayland/client/client.pro +++ /dev/null @@ -1,6 +0,0 @@ -include (../shared_old/shared_old.pri) - -TARGET = tst_client -SOURCES += tst_client.cpp - -check.commands = $(TESTRUNNER) $${PWD}/run-with-all-shells.sh $(TESTARGS) diff --git a/tests/auto/wayland/datadevicev1/.prev_CMakeLists.txt b/tests/auto/wayland/datadevicev1/.prev_CMakeLists.txt deleted file mode 100644 index 6a1060b3816..00000000000 --- a/tests/auto/wayland/datadevicev1/.prev_CMakeLists.txt +++ /dev/null @@ -1,32 +0,0 @@ -# Generated from datadevicev1.pro. - -##################################################################### -## tst_datadevicev1 Test: -##################################################################### - -qt_internal_add_test(tst_datadevicev1 - SOURCES - ../shared/corecompositor.cpp ../shared/corecompositor.h - ../shared/coreprotocol.cpp ../shared/coreprotocol.h - ../shared/datadevice.cpp ../shared/datadevice.h - ../shared/mockcompositor.cpp ../shared/mockcompositor.h - ../shared/textinput.cpp ../shared/textinput.h - ../shared/xdgoutputv1.cpp ../shared/xdgoutputv1.h - ../shared/xdgshell.cpp ../shared/xdgshell.h - tst_datadevicev1.cpp - INCLUDE_DIRECTORIES - ../shared - PUBLIC_LIBRARIES - Qt::Gui - Qt::OpenGL - Qt::WaylandClientPrivate - Wayland::Server -) - -qt6_generate_wayland_protocol_server_sources(tst_datadevicev1 - FILES - ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/text-input-unstable-v2.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/wayland.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-output-unstable-v1.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-shell.xml -) diff --git a/tests/auto/wayland/datadevicev1/datadevicev1.pro b/tests/auto/wayland/datadevicev1/datadevicev1.pro deleted file mode 100644 index b3c687c4dff..00000000000 --- a/tests/auto/wayland/datadevicev1/datadevicev1.pro +++ /dev/null @@ -1,4 +0,0 @@ -include (../shared/shared.pri) - -TARGET = tst_datadevicev1 -SOURCES += tst_datadevicev1.cpp diff --git a/tests/auto/wayland/fullscreenshellv1/.prev_CMakeLists.txt b/tests/auto/wayland/fullscreenshellv1/.prev_CMakeLists.txt deleted file mode 100644 index ca850796223..00000000000 --- a/tests/auto/wayland/fullscreenshellv1/.prev_CMakeLists.txt +++ /dev/null @@ -1,36 +0,0 @@ -# Generated from fullscreenshellv1.pro. - -##################################################################### -## tst_client_fullscreenshellv1 Test: -##################################################################### - -qt_internal_add_test(tst_client_fullscreenshellv1 - SOURCES - ../shared_old/mockcompositor.cpp ../shared_old/mockcompositor.h - ../shared_old/mockfullscreenshellv1.cpp ../shared_old/mockfullscreenshellv1.h - ../shared_old/mockinput.cpp ../shared_old/mockinput.h - ../shared_old/mockiviapplication.cpp ../shared_old/mockiviapplication.h - ../shared_old/mockoutput.cpp ../shared_old/mockoutput.h - ../shared_old/mockregion.cpp ../shared_old/mockregion.h - ../shared_old/mocksurface.cpp ../shared_old/mocksurface.h - ../shared_old/mockwlshell.cpp ../shared_old/mockwlshell.h - tst_fullscreenshellv1.cpp - INCLUDE_DIRECTORIES - ../shared_old - PUBLIC_LIBRARIES - Qt::CorePrivate - Qt::Gui - Qt::GuiPrivate - Qt::OpenGL - Qt::WaylandClientPrivate - Wayland::Client - Wayland::Server -) - -qt6_generate_wayland_protocol_server_sources(tst_client_fullscreenshellv1 - FILES - ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/fullscreen-shell-unstable-v1.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/ivi-application.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/wayland.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/xdg-shell.xml -) diff --git a/tests/auto/wayland/fullscreenshellv1/fullscreenshellv1.pro b/tests/auto/wayland/fullscreenshellv1/fullscreenshellv1.pro deleted file mode 100644 index c4006cdd870..00000000000 --- a/tests/auto/wayland/fullscreenshellv1/fullscreenshellv1.pro +++ /dev/null @@ -1,4 +0,0 @@ -include (../shared_old/shared_old.pri) - -TARGET = tst_client_fullscreenshellv1 -SOURCES += tst_fullscreenshellv1.cpp diff --git a/tests/auto/wayland/inputcontext/.prev_CMakeLists.txt b/tests/auto/wayland/inputcontext/.prev_CMakeLists.txt deleted file mode 100644 index 2d2783926b2..00000000000 --- a/tests/auto/wayland/inputcontext/.prev_CMakeLists.txt +++ /dev/null @@ -1,32 +0,0 @@ -# Generated from inputcontext.pro. - -##################################################################### -## tst_inputcontext Test: -##################################################################### - -qt_internal_add_test(tst_inputcontext - SOURCES - ../shared/corecompositor.cpp ../shared/corecompositor.h - ../shared/coreprotocol.cpp ../shared/coreprotocol.h - ../shared/datadevice.cpp ../shared/datadevice.h - ../shared/mockcompositor.cpp ../shared/mockcompositor.h - ../shared/textinput.cpp ../shared/textinput.h - ../shared/xdgoutputv1.cpp ../shared/xdgoutputv1.h - ../shared/xdgshell.cpp ../shared/xdgshell.h - tst_inputcontext.cpp - INCLUDE_DIRECTORIES - ../shared - PUBLIC_LIBRARIES - Qt::Gui - Qt::OpenGL - Qt::WaylandClientPrivate - Wayland::Server -) - -qt6_generate_wayland_protocol_server_sources(tst_inputcontext - FILES - ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/text-input-unstable-v2.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/wayland.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-output-unstable-v1.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-shell.xml -) diff --git a/tests/auto/wayland/inputcontext/inputcontext.pro b/tests/auto/wayland/inputcontext/inputcontext.pro deleted file mode 100644 index 1971d455ead..00000000000 --- a/tests/auto/wayland/inputcontext/inputcontext.pro +++ /dev/null @@ -1,4 +0,0 @@ -include (../shared/shared.pri) - -TARGET = tst_inputcontext -SOURCES += tst_inputcontext.cpp diff --git a/tests/auto/wayland/iviapplication/.prev_CMakeLists.txt b/tests/auto/wayland/iviapplication/.prev_CMakeLists.txt deleted file mode 100644 index a545e55f72f..00000000000 --- a/tests/auto/wayland/iviapplication/.prev_CMakeLists.txt +++ /dev/null @@ -1,36 +0,0 @@ -# Generated from iviapplication.pro. - -##################################################################### -## tst_client_iviapplication Test: -##################################################################### - -qt_internal_add_test(tst_client_iviapplication - SOURCES - ../shared_old/mockcompositor.cpp ../shared_old/mockcompositor.h - ../shared_old/mockfullscreenshellv1.cpp ../shared_old/mockfullscreenshellv1.h - ../shared_old/mockinput.cpp ../shared_old/mockinput.h - ../shared_old/mockiviapplication.cpp ../shared_old/mockiviapplication.h - ../shared_old/mockoutput.cpp ../shared_old/mockoutput.h - ../shared_old/mockregion.cpp ../shared_old/mockregion.h - ../shared_old/mocksurface.cpp ../shared_old/mocksurface.h - ../shared_old/mockwlshell.cpp ../shared_old/mockwlshell.h - tst_iviapplication.cpp - INCLUDE_DIRECTORIES - ../shared_old - PUBLIC_LIBRARIES - Qt::CorePrivate - Qt::Gui - Qt::GuiPrivate - Qt::OpenGL - Qt::WaylandClientPrivate - Wayland::Client - Wayland::Server -) - -qt6_generate_wayland_protocol_server_sources(tst_client_iviapplication - FILES - ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/fullscreen-shell-unstable-v1.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/ivi-application.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/wayland.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/xdg-shell.xml -) diff --git a/tests/auto/wayland/iviapplication/iviapplication.pro b/tests/auto/wayland/iviapplication/iviapplication.pro deleted file mode 100644 index f2d596e6c93..00000000000 --- a/tests/auto/wayland/iviapplication/iviapplication.pro +++ /dev/null @@ -1,5 +0,0 @@ -include (../shared_old/shared_old.pri) - -TARGET = tst_client_iviapplication -SOURCES += tst_iviapplication.cpp - diff --git a/tests/auto/wayland/nooutput/.prev_CMakeLists.txt b/tests/auto/wayland/nooutput/.prev_CMakeLists.txt deleted file mode 100644 index 18479bdfc49..00000000000 --- a/tests/auto/wayland/nooutput/.prev_CMakeLists.txt +++ /dev/null @@ -1,32 +0,0 @@ -# Generated from nooutput.pro. - -##################################################################### -## tst_nooutput Test: -##################################################################### - -qt_internal_add_test(tst_nooutput - SOURCES - ../shared/corecompositor.cpp ../shared/corecompositor.h - ../shared/coreprotocol.cpp ../shared/coreprotocol.h - ../shared/datadevice.cpp ../shared/datadevice.h - ../shared/mockcompositor.cpp ../shared/mockcompositor.h - ../shared/textinput.cpp ../shared/textinput.h - ../shared/xdgoutputv1.cpp ../shared/xdgoutputv1.h - ../shared/xdgshell.cpp ../shared/xdgshell.h - tst_nooutput.cpp - INCLUDE_DIRECTORIES - ../shared - PUBLIC_LIBRARIES - Qt::Gui - Qt::OpenGL - Qt::WaylandClientPrivate - Wayland::Server -) - -qt6_generate_wayland_protocol_server_sources(tst_nooutput - FILES - ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/text-input-unstable-v2.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/wayland.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-output-unstable-v1.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-shell.xml -) diff --git a/tests/auto/wayland/nooutput/nooutput.pro b/tests/auto/wayland/nooutput/nooutput.pro deleted file mode 100644 index 1d8dc562663..00000000000 --- a/tests/auto/wayland/nooutput/nooutput.pro +++ /dev/null @@ -1,5 +0,0 @@ -include (../shared/shared.pri) - -TARGET = tst_nooutput -SOURCES += tst_nooutput.cpp - diff --git a/tests/auto/wayland/output/.prev_CMakeLists.txt b/tests/auto/wayland/output/.prev_CMakeLists.txt deleted file mode 100644 index 4103d7a8bb4..00000000000 --- a/tests/auto/wayland/output/.prev_CMakeLists.txt +++ /dev/null @@ -1,32 +0,0 @@ -# Generated from output.pro. - -##################################################################### -## tst_output Test: -##################################################################### - -qt_internal_add_test(tst_output - SOURCES - ../shared/corecompositor.cpp ../shared/corecompositor.h - ../shared/coreprotocol.cpp ../shared/coreprotocol.h - ../shared/datadevice.cpp ../shared/datadevice.h - ../shared/mockcompositor.cpp ../shared/mockcompositor.h - ../shared/textinput.cpp ../shared/textinput.h - ../shared/xdgoutputv1.cpp ../shared/xdgoutputv1.h - ../shared/xdgshell.cpp ../shared/xdgshell.h - tst_output.cpp - INCLUDE_DIRECTORIES - ../shared - PUBLIC_LIBRARIES - Qt::Gui - Qt::OpenGL - Qt::WaylandClientPrivate - Wayland::Server -) - -qt6_generate_wayland_protocol_server_sources(tst_output - FILES - ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/text-input-unstable-v2.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/wayland.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-output-unstable-v1.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-shell.xml -) diff --git a/tests/auto/wayland/output/output.pro b/tests/auto/wayland/output/output.pro deleted file mode 100644 index d1dc672f060..00000000000 --- a/tests/auto/wayland/output/output.pro +++ /dev/null @@ -1,5 +0,0 @@ -include (../shared/shared.pri) - -TARGET = tst_output -SOURCES += tst_output.cpp - diff --git a/tests/auto/wayland/primaryselectionv1/.prev_CMakeLists.txt b/tests/auto/wayland/primaryselectionv1/.prev_CMakeLists.txt deleted file mode 100644 index 9c207adc1cc..00000000000 --- a/tests/auto/wayland/primaryselectionv1/.prev_CMakeLists.txt +++ /dev/null @@ -1,33 +0,0 @@ -# Generated from primaryselectionv1.pro. - -##################################################################### -## tst_primaryselectionv1 Test: -##################################################################### - -qt_internal_add_test(tst_primaryselectionv1 - SOURCES - ../shared/corecompositor.cpp ../shared/corecompositor.h - ../shared/coreprotocol.cpp ../shared/coreprotocol.h - ../shared/datadevice.cpp ../shared/datadevice.h - ../shared/mockcompositor.cpp ../shared/mockcompositor.h - ../shared/textinput.cpp ../shared/textinput.h - ../shared/xdgoutputv1.cpp ../shared/xdgoutputv1.h - ../shared/xdgshell.cpp ../shared/xdgshell.h - tst_primaryselectionv1.cpp - INCLUDE_DIRECTORIES - ../shared - PUBLIC_LIBRARIES - Qt::Gui - Qt::OpenGL - Qt::WaylandClientPrivate - Wayland::Server -) - -qt6_generate_wayland_protocol_server_sources(tst_primaryselectionv1 - FILES - ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/wp-primary-selection-unstable-v1.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/text-input-unstable-v2.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/wayland.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-output-unstable-v1.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-shell.xml -) diff --git a/tests/auto/wayland/primaryselectionv1/primaryselectionv1.pro b/tests/auto/wayland/primaryselectionv1/primaryselectionv1.pro deleted file mode 100644 index 9d00562df81..00000000000 --- a/tests/auto/wayland/primaryselectionv1/primaryselectionv1.pro +++ /dev/null @@ -1,7 +0,0 @@ -include (../shared/shared.pri) - -WAYLANDSERVERSOURCES += \ - $$PWD/../../../../src/3rdparty/protocol/wp-primary-selection-unstable-v1.xml - -TARGET = tst_primaryselectionv1 -SOURCES += tst_primaryselectionv1.cpp diff --git a/tests/auto/wayland/seatv4/.prev_CMakeLists.txt b/tests/auto/wayland/seatv4/.prev_CMakeLists.txt deleted file mode 100644 index 16eed042e42..00000000000 --- a/tests/auto/wayland/seatv4/.prev_CMakeLists.txt +++ /dev/null @@ -1,41 +0,0 @@ -# Generated from seatv4.pro. - -##################################################################### -## tst_seatv4 Test: -##################################################################### - -qt_internal_add_test(tst_seatv4 - SOURCES - ../shared/corecompositor.cpp ../shared/corecompositor.h - ../shared/coreprotocol.cpp ../shared/coreprotocol.h - ../shared/datadevice.cpp ../shared/datadevice.h - ../shared/mockcompositor.cpp ../shared/mockcompositor.h - ../shared/textinput.cpp ../shared/textinput.h - ../shared/xdgoutputv1.cpp ../shared/xdgoutputv1.h - ../shared/xdgshell.cpp ../shared/xdgshell.h - tst_seatv4.cpp - INCLUDE_DIRECTORIES - ../shared - PUBLIC_LIBRARIES - Qt::Gui - Qt::OpenGL - Qt::WaylandClientPrivate - Wayland::Server -) - -qt6_generate_wayland_protocol_server_sources(tst_seatv4 - FILES - ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/text-input-unstable-v2.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/wayland.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-output-unstable-v1.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-shell.xml -) - -## Scopes: -##################################################################### - -qt_internal_extend_target(tst_seatv4 CONDITION QT_FEATURE_cursor - PUBLIC_LIBRARIES - Qt::GuiPrivate - Wayland::Cursor -) diff --git a/tests/auto/wayland/seatv4/seatv4.pro b/tests/auto/wayland/seatv4/seatv4.pro deleted file mode 100644 index 7a86cbf0390..00000000000 --- a/tests/auto/wayland/seatv4/seatv4.pro +++ /dev/null @@ -1,9 +0,0 @@ -include (../shared/shared.pri) - -qtConfig(cursor) { - QMAKE_USE += wayland-cursor - QT += gui-private -} - -TARGET = tst_seatv4 -SOURCES += tst_seatv4.cpp diff --git a/tests/auto/wayland/seatv5/.prev_CMakeLists.txt b/tests/auto/wayland/seatv5/.prev_CMakeLists.txt deleted file mode 100644 index f30c0c76619..00000000000 --- a/tests/auto/wayland/seatv5/.prev_CMakeLists.txt +++ /dev/null @@ -1,32 +0,0 @@ -# Generated from seatv5.pro. - -##################################################################### -## tst_seatv5 Test: -##################################################################### - -qt_internal_add_test(tst_seatv5 - SOURCES - ../shared/corecompositor.cpp ../shared/corecompositor.h - ../shared/coreprotocol.cpp ../shared/coreprotocol.h - ../shared/datadevice.cpp ../shared/datadevice.h - ../shared/mockcompositor.cpp ../shared/mockcompositor.h - ../shared/textinput.cpp ../shared/textinput.h - ../shared/xdgoutputv1.cpp ../shared/xdgoutputv1.h - ../shared/xdgshell.cpp ../shared/xdgshell.h - tst_seatv5.cpp - INCLUDE_DIRECTORIES - ../shared - PUBLIC_LIBRARIES - Qt::Gui - Qt::OpenGL - Qt::WaylandClientPrivate - Wayland::Server -) - -qt6_generate_wayland_protocol_server_sources(tst_seatv5 - FILES - ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/text-input-unstable-v2.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/wayland.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-output-unstable-v1.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-shell.xml -) diff --git a/tests/auto/wayland/seatv5/seatv5.pro b/tests/auto/wayland/seatv5/seatv5.pro deleted file mode 100644 index 2081845efa8..00000000000 --- a/tests/auto/wayland/seatv5/seatv5.pro +++ /dev/null @@ -1,4 +0,0 @@ -include (../shared/shared.pri) - -TARGET = tst_seatv5 -SOURCES += tst_seatv5.cpp diff --git a/tests/auto/wayland/surface/.prev_CMakeLists.txt b/tests/auto/wayland/surface/.prev_CMakeLists.txt deleted file mode 100644 index ed900c8d1a4..00000000000 --- a/tests/auto/wayland/surface/.prev_CMakeLists.txt +++ /dev/null @@ -1,32 +0,0 @@ -# Generated from surface.pro. - -##################################################################### -## tst_surface Test: -##################################################################### - -qt_internal_add_test(tst_surface - SOURCES - ../shared/corecompositor.cpp ../shared/corecompositor.h - ../shared/coreprotocol.cpp ../shared/coreprotocol.h - ../shared/datadevice.cpp ../shared/datadevice.h - ../shared/mockcompositor.cpp ../shared/mockcompositor.h - ../shared/textinput.cpp ../shared/textinput.h - ../shared/xdgoutputv1.cpp ../shared/xdgoutputv1.h - ../shared/xdgshell.cpp ../shared/xdgshell.h - tst_surface.cpp - INCLUDE_DIRECTORIES - ../shared - PUBLIC_LIBRARIES - Qt::Gui - Qt::OpenGL - Qt::WaylandClientPrivate - Wayland::Server -) - -qt6_generate_wayland_protocol_server_sources(tst_surface - FILES - ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/text-input-unstable-v2.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/wayland.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-output-unstable-v1.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-shell.xml -) diff --git a/tests/auto/wayland/surface/surface.pro b/tests/auto/wayland/surface/surface.pro deleted file mode 100644 index 36882aa2df2..00000000000 --- a/tests/auto/wayland/surface/surface.pro +++ /dev/null @@ -1,5 +0,0 @@ -include (../shared/shared.pri) - -TARGET = tst_surface -SOURCES += tst_surface.cpp - diff --git a/tests/auto/wayland/tabletv2/.prev_CMakeLists.txt b/tests/auto/wayland/tabletv2/.prev_CMakeLists.txt deleted file mode 100644 index 96b32d24b25..00000000000 --- a/tests/auto/wayland/tabletv2/.prev_CMakeLists.txt +++ /dev/null @@ -1,33 +0,0 @@ -# Generated from tabletv2.pro. - -##################################################################### -## tst_tabletv2 Test: -##################################################################### - -qt_internal_add_test(tst_tabletv2 - SOURCES - ../shared/corecompositor.cpp ../shared/corecompositor.h - ../shared/coreprotocol.cpp ../shared/coreprotocol.h - ../shared/datadevice.cpp ../shared/datadevice.h - ../shared/mockcompositor.cpp ../shared/mockcompositor.h - ../shared/textinput.cpp ../shared/textinput.h - ../shared/xdgoutputv1.cpp ../shared/xdgoutputv1.h - ../shared/xdgshell.cpp ../shared/xdgshell.h - tst_tabletv2.cpp - INCLUDE_DIRECTORIES - ../shared - PUBLIC_LIBRARIES - Qt::Gui - Qt::OpenGL - Qt::WaylandClientPrivate - Wayland::Server -) - -qt6_generate_wayland_protocol_server_sources(tst_tabletv2 - FILES - ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/tablet-unstable-v2.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/text-input-unstable-v2.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/wayland.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-output-unstable-v1.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-shell.xml -) diff --git a/tests/auto/wayland/tabletv2/tabletv2.pro b/tests/auto/wayland/tabletv2/tabletv2.pro deleted file mode 100644 index 9dc9636e910..00000000000 --- a/tests/auto/wayland/tabletv2/tabletv2.pro +++ /dev/null @@ -1,7 +0,0 @@ -include (../shared/shared.pri) - -WAYLANDSERVERSOURCES += \ - $$PWD/../../../../src/3rdparty/protocol/tablet-unstable-v2.xml - -TARGET = tst_tabletv2 -SOURCES += tst_tabletv2.cpp diff --git a/tests/auto/wayland/wl_connect/wl_connect.pro b/tests/auto/wayland/wl_connect/wl_connect.pro deleted file mode 100644 index 28723beee9b..00000000000 --- a/tests/auto/wayland/wl_connect/wl_connect.pro +++ /dev/null @@ -1,5 +0,0 @@ -CONFIG += testcase -QT += gui-private testlib - -SOURCES += tst_wlconnect.cpp -TARGET = tst_wlconnect diff --git a/tests/auto/wayland/xdgdecorationv1/.prev_CMakeLists.txt b/tests/auto/wayland/xdgdecorationv1/.prev_CMakeLists.txt deleted file mode 100644 index 31588782ec1..00000000000 --- a/tests/auto/wayland/xdgdecorationv1/.prev_CMakeLists.txt +++ /dev/null @@ -1,33 +0,0 @@ -# Generated from xdgdecorationv1.pro. - -##################################################################### -## tst_xdgdecorationv1 Test: -##################################################################### - -qt_internal_add_test(tst_xdgdecorationv1 - SOURCES - ../shared/corecompositor.cpp ../shared/corecompositor.h - ../shared/coreprotocol.cpp ../shared/coreprotocol.h - ../shared/datadevice.cpp ../shared/datadevice.h - ../shared/mockcompositor.cpp ../shared/mockcompositor.h - ../shared/textinput.cpp ../shared/textinput.h - ../shared/xdgoutputv1.cpp ../shared/xdgoutputv1.h - ../shared/xdgshell.cpp ../shared/xdgshell.h - tst_xdgdecorationv1.cpp - INCLUDE_DIRECTORIES - ../shared - PUBLIC_LIBRARIES - Qt::Gui - Qt::OpenGL - Qt::WaylandClientPrivate - Wayland::Server -) - -qt6_generate_wayland_protocol_server_sources(tst_xdgdecorationv1 - FILES - ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/xdg-decoration-unstable-v1.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/text-input-unstable-v2.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/wayland.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-output-unstable-v1.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-shell.xml -) diff --git a/tests/auto/wayland/xdgdecorationv1/xdgdecorationv1.pro b/tests/auto/wayland/xdgdecorationv1/xdgdecorationv1.pro deleted file mode 100644 index 0b553720582..00000000000 --- a/tests/auto/wayland/xdgdecorationv1/xdgdecorationv1.pro +++ /dev/null @@ -1,7 +0,0 @@ -include (../shared/shared.pri) - -WAYLANDSERVERSOURCES += \ - $$PWD/../../../../src/3rdparty/protocol/xdg-decoration-unstable-v1.xml - -TARGET = tst_xdgdecorationv1 -SOURCES += tst_xdgdecorationv1.cpp diff --git a/tests/auto/wayland/xdgoutput/.prev_CMakeLists.txt b/tests/auto/wayland/xdgoutput/.prev_CMakeLists.txt deleted file mode 100644 index 33357ffdce2..00000000000 --- a/tests/auto/wayland/xdgoutput/.prev_CMakeLists.txt +++ /dev/null @@ -1,32 +0,0 @@ -# Generated from xdgoutput.pro. - -##################################################################### -## tst_xdgoutput Test: -##################################################################### - -qt_internal_add_test(tst_xdgoutput - SOURCES - ../shared/corecompositor.cpp ../shared/corecompositor.h - ../shared/coreprotocol.cpp ../shared/coreprotocol.h - ../shared/datadevice.cpp ../shared/datadevice.h - ../shared/mockcompositor.cpp ../shared/mockcompositor.h - ../shared/textinput.cpp ../shared/textinput.h - ../shared/xdgoutputv1.cpp ../shared/xdgoutputv1.h - ../shared/xdgshell.cpp ../shared/xdgshell.h - tst_xdgoutput.cpp - INCLUDE_DIRECTORIES - ../shared - PUBLIC_LIBRARIES - Qt::Gui - Qt::OpenGL - Qt::WaylandClientPrivate - Wayland::Server -) - -qt6_generate_wayland_protocol_server_sources(tst_xdgoutput - FILES - ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/text-input-unstable-v2.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/wayland.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-output-unstable-v1.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-shell.xml -) diff --git a/tests/auto/wayland/xdgoutput/xdgoutput.pro b/tests/auto/wayland/xdgoutput/xdgoutput.pro deleted file mode 100644 index f65327546c2..00000000000 --- a/tests/auto/wayland/xdgoutput/xdgoutput.pro +++ /dev/null @@ -1,5 +0,0 @@ -include (../shared/shared.pri) - -TARGET = tst_xdgoutput -SOURCES += tst_xdgoutput.cpp - diff --git a/tests/auto/wayland/xdgshell/.prev_CMakeLists.txt b/tests/auto/wayland/xdgshell/.prev_CMakeLists.txt deleted file mode 100644 index a3872d72607..00000000000 --- a/tests/auto/wayland/xdgshell/.prev_CMakeLists.txt +++ /dev/null @@ -1,32 +0,0 @@ -# Generated from xdgshell.pro. - -##################################################################### -## tst_xdgshell Test: -##################################################################### - -qt_internal_add_test(tst_xdgshell - SOURCES - ../shared/corecompositor.cpp ../shared/corecompositor.h - ../shared/coreprotocol.cpp ../shared/coreprotocol.h - ../shared/datadevice.cpp ../shared/datadevice.h - ../shared/mockcompositor.cpp ../shared/mockcompositor.h - ../shared/textinput.cpp ../shared/textinput.h - ../shared/xdgoutputv1.cpp ../shared/xdgoutputv1.h - ../shared/xdgshell.cpp ../shared/xdgshell.h - tst_xdgshell.cpp - INCLUDE_DIRECTORIES - ../shared - PUBLIC_LIBRARIES - Qt::Gui - Qt::OpenGL - Qt::WaylandClientPrivate - Wayland::Server -) - -qt6_generate_wayland_protocol_server_sources(tst_xdgshell - FILES - ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/text-input-unstable-v2.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/wayland.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-output-unstable-v1.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-shell.xml -) diff --git a/tests/auto/wayland/xdgshell/xdgshell.pro b/tests/auto/wayland/xdgshell/xdgshell.pro deleted file mode 100644 index d7c3f9df658..00000000000 --- a/tests/auto/wayland/xdgshell/xdgshell.pro +++ /dev/null @@ -1,5 +0,0 @@ -include (../shared/shared.pri) - -TARGET = tst_xdgshell -SOURCES += tst_xdgshell.cpp - From 9e9e338679f66a07f78c4f85b4b65e86fa7d92d1 Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Mon, 16 Nov 2020 14:57:36 +0000 Subject: [PATCH 0919/1507] Client: Send set_window_geometry only once configured The geometry only makes sense when a buffer exists, our currently send value is somewhat meaningless, but till now harmless. A specification clarification implies that it is an error if the calculated effective window geometry is null, rather than just checking the sent value. This is the case if set_window_geometry is sent before a buffer is attached. On our first configure call we enter resizeFromApplyConfigure which will hit this path and send the initial state. Pick-to: 5.15 Pick-to: 6.1 Pick-to: 6.0 Change-Id: Ib57ebe8b64210eae86e79dfdd6b5cb8a986b020b Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 04c2dbd48f4..435628ada33 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -363,7 +363,7 @@ void QWaylandWindow::setGeometry(const QRect &rect) if (isExposed() && !mInResizeFromApplyConfigure && exposeGeometry != mLastExposeGeometry) sendExposeEvent(exposeGeometry); - if (mShellSurface) + if (mShellSurface && isExposed()) mShellSurface->setWindowGeometry(windowContentGeometry()); if (isOpaque() && mMask.isEmpty()) From 487d305d2b3936228cfaecd5ffcc41fcf16c82fa Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Tue, 9 Feb 2021 16:09:21 +0000 Subject: [PATCH 0920/1507] Client: Connect drags being accepted to updating the source drag icon Currently in a multi-process drag and drop when the other client accepts a given mimetype for dropping it calls accept, which is received by the client, but the drag cursor is never updated. Instead the drag cursor was updated in the data_device_enter events which only works if we are operating within one process. The code existed to handle this existed but both the targetChanged signal and the dragSourceTargetChanged were unused. Change-Id: I443f31f1b2ef72d4b5eadaf7115f97544dac883a Reviewed-by: Vlad Zahorodnii Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/plugins/platforms/wayland/qwaylanddatadevice.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/plugins/platforms/wayland/qwaylanddatadevice.cpp b/src/plugins/platforms/wayland/qwaylanddatadevice.cpp index 19944a349e6..54a69c3c792 100644 --- a/src/plugins/platforms/wayland/qwaylanddatadevice.cpp +++ b/src/plugins/platforms/wayland/qwaylanddatadevice.cpp @@ -124,6 +124,7 @@ bool QWaylandDataDevice::startDrag(QMimeData *mimeData, QWaylandWindow *icon) m_dragSource.reset(new QWaylandDataSource(m_display->dndSelectionHandler(), mimeData)); connect(m_dragSource.data(), &QWaylandDataSource::cancelled, this, &QWaylandDataDevice::dragSourceCancelled); + connect(m_dragSource.data(), &QWaylandDataSource::targetChanged, this, &QWaylandDataDevice::dragSourceTargetChanged); start_drag(m_dragSource->object(), origin->wlSurface(), icon->wlSurface(), m_display->currentInputDevice()->serial()); return true; From 1a1c264b0babd6b9a9785fcc6c4e84002b8c70c9 Mon Sep 17 00:00:00 2001 From: Elvis Lee Date: Mon, 28 Dec 2020 16:08:24 +0900 Subject: [PATCH 0921/1507] Support platform specific implementation QtWaylandClient can be inherited to support platform specific implementaton. Change-Id: Ie0f4aa28dbb2dcd6b1245cb14e23f3b45e687400 Reviewed-by: Elvis Lee Reviewed-by: Eskil Abrahamsen Blomfeldt --- .../platforms/wayland/qwaylandcursor_p.h | 4 +- .../platforms/wayland/qwaylanddisplay.cpp | 4 +- .../platforms/wayland/qwaylandinputdevice_p.h | 2 +- .../platforms/wayland/qwaylandintegration.cpp | 45 ++++++++++++++----- .../platforms/wayland/qwaylandintegration_p.h | 14 ++++-- .../platforms/wayland/qwaylandscreen_p.h | 6 +-- .../platforms/wayland/qwaylandwindow_p.h | 3 +- 7 files changed, 53 insertions(+), 25 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandcursor_p.h b/src/plugins/platforms/wayland/qwaylandcursor_p.h index de96c22b233..7ccdd71c86c 100644 --- a/src/plugins/platforms/wayland/qwaylandcursor_p.h +++ b/src/plugins/platforms/wayland/qwaylandcursor_p.h @@ -79,7 +79,7 @@ public: ~QWaylandCursorTheme(); ::wl_cursor *cursor(Qt::CursorShape shape); -private: +protected: enum WaylandCursor { ArrowCursor = Qt::ArrowCursor, UpArrowCursor, @@ -134,7 +134,7 @@ public: static QSharedPointer cursorBitmapBuffer(QWaylandDisplay *display, const QCursor *cursor); -private: +protected: QWaylandDisplay *mDisplay = nullptr; QPoint mLastPos; }; diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index 82dcc63e029..a3bd27ff2ed 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -327,7 +327,7 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin struct ::wl_registry *registry = object(); if (interface == QStringLiteral("wl_output")) { - mWaitingScreens << new QWaylandScreen(this, version, id); + mWaitingScreens << mWaylandIntegration->createPlatformScreen(this, version, id); } else if (interface == QStringLiteral("wl_compositor")) { mCompositorVersion = qMin((int)version, 4); mCompositor.init(registry, id, mCompositorVersion); @@ -627,7 +627,7 @@ QWaylandInputDevice *QWaylandDisplay::defaultInputDevice() const QWaylandCursor *QWaylandDisplay::waylandCursor() { if (!mCursor) - mCursor.reset(new QWaylandCursor(this)); + mCursor.reset(mWaylandIntegration->createPlatformCursor(this)); return mCursor.data(); } diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h index 53691e68254..303c9bb31fc 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h +++ b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h @@ -160,7 +160,7 @@ public: Pointer *pointer() const; Touch *touch() const; -private: +protected: QWaylandDisplay *mQDisplay = nullptr; struct wl_display *mDisplay = nullptr; diff --git a/src/plugins/platforms/wayland/qwaylandintegration.cpp b/src/plugins/platforms/wayland/qwaylandintegration.cpp index 868cdd61548..f2f9174f17a 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandintegration.cpp @@ -52,6 +52,7 @@ #include "qwaylanddnd_p.h" #include "qwaylandwindowmanagerintegration_p.h" #include "qwaylandscreen_p.h" +#include "qwaylandcursor_p.h" #if defined(Q_OS_MACOS) # include @@ -112,22 +113,12 @@ QWaylandIntegration::QWaylandIntegration() #else : mFontDb(new QGenericUnixFontDatabase()) #endif - , mNativeInterface(new QWaylandNativeInterface(this)) { - initializeInputDeviceIntegration(); mDisplay.reset(new QWaylandDisplay(this)); if (!mDisplay->isInitialized()) { mFailed = true; return; } -#if QT_CONFIG(clipboard) - mClipboard.reset(new QWaylandClipboard(mDisplay.data())); -#endif -#if QT_CONFIG(draganddrop) - mDrag.reset(new QWaylandDrag(mDisplay.data())); -#endif - - reconfigureInputContext(); } QWaylandIntegration::~QWaylandIntegration() @@ -193,8 +184,30 @@ QAbstractEventDispatcher *QWaylandIntegration::createEventDispatcher() const return createUnixEventDispatcher(); } +QPlatformNativeInterface *QWaylandIntegration::createPlatformNativeInterface() +{ + return new QWaylandNativeInterface(this); +} + +void QWaylandIntegration::initializePlatform() +{ + mNativeInterface.reset(createPlatformNativeInterface()); + initializeInputDeviceIntegration(); +#if QT_CONFIG(clipboard) + mClipboard.reset(new QWaylandClipboard(mDisplay.data())); +#endif +#if QT_CONFIG(draganddrop) + mDrag.reset(new QWaylandDrag(mDisplay.data())); +#endif + + reconfigureInputContext(); +} + void QWaylandIntegration::initialize() { + // Support platform specicif initialization + initializePlatform(); + QAbstractEventDispatcher *dispatcher = QGuiApplicationPrivate::eventDispatcher; QObject::connect(dispatcher, SIGNAL(aboutToBlock()), mDisplay.data(), SLOT(flushRequests())); QObject::connect(dispatcher, SIGNAL(awake()), mDisplay.data(), SLOT(flushRequests())); @@ -282,6 +295,16 @@ QPlatformTheme *QWaylandIntegration::createPlatformTheme(const QString &name) co return QGenericUnixTheme::createUnixTheme(name); } +QWaylandScreen *QWaylandIntegration::createPlatformScreen(QWaylandDisplay *waylandDisplay, int version, uint32_t id) const +{ + return new QWaylandScreen(waylandDisplay, version, id); +} + +QWaylandCursor *QWaylandIntegration::createPlatformCursor(QWaylandDisplay *display) const +{ + return new QWaylandCursor(display); +} + #if QT_CONFIG(vulkan) QPlatformVulkanInstance *QWaylandIntegration::createPlatformVulkanInstance(QVulkanInstance *instance) const { @@ -418,7 +441,7 @@ void QWaylandIntegration::initializeShellIntegration() QWindowSystemInterfacePrivate::TabletEvent::setPlatformSynthesizesMouse(false); } -QWaylandInputDevice *QWaylandIntegration::createInputDevice(QWaylandDisplay *display, int version, uint32_t id) +QWaylandInputDevice *QWaylandIntegration::createInputDevice(QWaylandDisplay *display, int version, uint32_t id) const { if (mInputDeviceIntegration) { return mInputDeviceIntegration->createInputDevice(display, version, id); diff --git a/src/plugins/platforms/wayland/qwaylandintegration_p.h b/src/plugins/platforms/wayland/qwaylandintegration_p.h index ff70ae25dba..e687e0c6728 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration_p.h +++ b/src/plugins/platforms/wayland/qwaylandintegration_p.h @@ -67,6 +67,8 @@ class QWaylandServerBufferIntegration; class QWaylandShellIntegration; class QWaylandInputDeviceIntegration; class QWaylandInputDevice; +class QWaylandScreen; +class QWaylandCursor; class Q_WAYLAND_CLIENT_EXPORT QWaylandIntegration : public QPlatformIntegration { @@ -117,7 +119,9 @@ public: QPlatformVulkanInstance *createPlatformVulkanInstance(QVulkanInstance *instance) const override; #endif - QWaylandInputDevice *createInputDevice(QWaylandDisplay *display, int version, uint32_t id); + virtual QWaylandInputDevice *createInputDevice(QWaylandDisplay *display, int version, uint32_t id) const; + virtual QWaylandScreen *createPlatformScreen(QWaylandDisplay *waylandDisplay, int version, uint32_t id) const; + virtual QWaylandCursor *createPlatformCursor(QWaylandDisplay *display) const; virtual QWaylandClientBufferIntegration *clientBufferIntegration() const; virtual QWaylandServerBufferIntegration *serverBufferIntegration() const; @@ -125,19 +129,24 @@ public: void reconfigureInputContext(); -private: +protected: // NOTE: mDisplay *must* be destructed after mDrag and mClientBufferIntegration // and mShellIntegration. // Do not move this definition into the private section at the bottom. QScopedPointer mDisplay; protected: + virtual QPlatformNativeInterface *createPlatformNativeInterface(); + QScopedPointer mClientBufferIntegration; QScopedPointer mServerBufferIntegration; QScopedPointer mShellIntegration; QScopedPointer mInputDeviceIntegration; + QScopedPointer mInputContext; + private: + void initializePlatform(); void initializeClientBufferIntegration(); void initializeServerBufferIntegration(); void initializeShellIntegration(); @@ -152,7 +161,6 @@ private: QScopedPointer mDrag; #endif QScopedPointer mNativeInterface; - QScopedPointer mInputContext; #if QT_CONFIG(accessibility) mutable QScopedPointer mAccessibility; #endif diff --git a/src/plugins/platforms/wayland/qwaylandscreen_p.h b/src/plugins/platforms/wayland/qwaylandscreen_p.h index 404d0f1ecbf..5553208ee4d 100644 --- a/src/plugins/platforms/wayland/qwaylandscreen_p.h +++ b/src/plugins/platforms/wayland/qwaylandscreen_p.h @@ -113,7 +113,7 @@ public: static QWaylandScreen *waylandScreenFromWindow(QWindow *window); static QWaylandScreen *fromWlOutput(::wl_output *output); -private: +protected: void output_mode(uint32_t flags, int width, int height, int refresh) override; void output_geometry(int32_t x, int32_t y, int32_t width, int32_t height, @@ -149,10 +149,6 @@ private: bool mOutputDone = false; bool mXdgOutputDone = false; bool mInitialized = false; - -#if QT_CONFIG(cursor) - QScopedPointer mWaylandCursor; -#endif }; } diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index 93e92458072..35850b8858a 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -214,6 +214,8 @@ signals: void wlSurfaceDestroyed(); protected: + void sendExposeEvent(const QRect &rect); + QWaylandDisplay *mDisplay = nullptr; QScopedPointer mSurface; QWaylandShellSurface *mShellSurface = nullptr; @@ -268,7 +270,6 @@ private: bool shouldCreateShellSurface() const; bool shouldCreateSubSurface() const; void reset(); - void sendExposeEvent(const QRect &rect); static void closePopups(QWaylandWindow *parent); QPlatformScreen *calculateScreenFromSurfaceEvents() const; void setOpaqueArea(const QRegion &opaqueArea); From d56e534dba353fd7be1da4544f7e14bb091eb377 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Fri, 19 Feb 2021 07:46:43 +0100 Subject: [PATCH 0922/1507] Fix sending input hints with new text input protocol Using input method hints to request things like digits-only etc. did not work with the specialized Qt input method for two reasons: First of all the full state of the editor needs to be sent to the keyboard when the focus object is set. But even fixing this, it turned out that the recipient was not actually registering the input methods hints, but just overwriting the function argument with itself. Fixes: QTBUG-91206 Pick-to: 6.0 6.1 Change-Id: I1b8a3e92cc912bc06b6a2a60f8ea280393cd226e Reviewed-by: Aleix Pol Gonzalez Reviewed-by: David Edmundson --- src/plugins/platforms/wayland/qwaylandinputmethodcontext.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/plugins/platforms/wayland/qwaylandinputmethodcontext.cpp b/src/plugins/platforms/wayland/qwaylandinputmethodcontext.cpp index e6ab1da4ff1..4e81e1cd973 100644 --- a/src/plugins/platforms/wayland/qwaylandinputmethodcontext.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputmethodcontext.cpp @@ -408,6 +408,8 @@ void QWaylandInputMethodContext::setFocusObject(QObject *) m_currentWindow = window; } } + + update(Qt::ImQueryAll); } } From 9227c5d18d43523c1d59c5b08226e29f677bf1f4 Mon Sep 17 00:00:00 2001 From: Jan Grulich Date: Wed, 10 Feb 2021 17:11:27 +0100 Subject: [PATCH 0923/1507] Translate opaque area with frame margins The opaque area doesn't take window decorations into account, which may result into possible graphical artefacts. Pick-to: 5.15 6.0 6.1 Change-Id: I1606e8256e7e204dad927931eb1221b576e227fd Reviewed-by: David Edmundson --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 435628ada33..b19c518d364 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -1242,12 +1242,14 @@ bool QWaylandWindow::isOpaque() const void QWaylandWindow::setOpaqueArea(const QRegion &opaqueArea) { - if (opaqueArea == mOpaqueArea || !mSurface) + const QRegion translatedOpaqueArea = opaqueArea.translated(frameMargins().left(), frameMargins().top()); + + if (translatedOpaqueArea == mOpaqueArea || !mSurface) return; - mOpaqueArea = opaqueArea; + mOpaqueArea = translatedOpaqueArea; - struct ::wl_region *region = mDisplay->createRegion(opaqueArea); + struct ::wl_region *region = mDisplay->createRegion(translatedOpaqueArea); mSurface->set_opaque_region(region); wl_region_destroy(region); } From 51b6fa425e7c0962051f5863973a686329f664f8 Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Tue, 9 Feb 2021 22:05:30 +0000 Subject: [PATCH 0924/1507] Client: Generate method to expose used version of a given proxy Relying on the compositor version only works for the core protocols. Using the version of our relevant object is more extensible and relies on less caching. Pick-to: 6.1 Change-Id: I1044e43a1e24a25359db95988c9956f4f1b5d35f Reviewed-by: Eskil Abrahamsen Blomfeldt --- .../platforms/wayland/qwaylanddisplay.cpp | 3 +-- .../platforms/wayland/qwaylanddisplay_p.h | 2 -- .../platforms/wayland/qwaylandinputdevice.cpp | 22 ++++++++----------- .../platforms/wayland/qwaylandinputdevice_p.h | 1 - .../platforms/wayland/qwaylandscreen.cpp | 1 - .../platforms/wayland/qwaylandscreen_p.h | 3 --- .../platforms/wayland/qwaylandwindow.cpp | 10 ++++----- .../qtwaylandscanner/qtwaylandscanner.cpp | 8 +++++++ 8 files changed, 23 insertions(+), 27 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index a3bd27ff2ed..6c226a350db 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -329,8 +329,7 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin if (interface == QStringLiteral("wl_output")) { mWaitingScreens << mWaylandIntegration->createPlatformScreen(this, version, id); } else if (interface == QStringLiteral("wl_compositor")) { - mCompositorVersion = qMin((int)version, 4); - mCompositor.init(registry, id, mCompositorVersion); + mCompositor.init(registry, id, qMin((int)version, 4)); } else if (interface == QStringLiteral("wl_shm")) { mShm.reset(new QWaylandShm(this, version, id)); } else if (interface == QStringLiteral("wl_seat")) { diff --git a/src/plugins/platforms/wayland/qwaylanddisplay_p.h b/src/plugins/platforms/wayland/qwaylanddisplay_p.h index e5cdbee9a48..38bc35ff178 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay_p.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay_p.h @@ -158,7 +158,6 @@ public: const struct wl_compositor *wl_compositor() const { return mCompositor.object(); } QtWayland::wl_compositor *compositor() { return &mCompositor; } - int compositorVersion() const { return mCompositorVersion; } QList inputDevices() const { return mInputDevices; } QWaylandInputDevice *defaultInputDevice() const; @@ -287,7 +286,6 @@ private: int mFd = -1; int mWritableNotificationFd = -1; QList mGlobals; - int mCompositorVersion = -1; uint32_t mLastInputSerial = 0; QWaylandInputDevice *mLastInputDevice = nullptr; QPointer mLastInputWindow; diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index 5be49993a46..fb9c63d8fec 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -132,7 +132,7 @@ QWaylandInputDevice::Keyboard::~Keyboard() { if (mFocus) QWindowSystemInterface::handleWindowActivated(nullptr); - if (mParent->mVersion >= 3) + if (version() >= 3) wl_keyboard_release(object()); else wl_keyboard_destroy(object()); @@ -156,7 +156,7 @@ QWaylandInputDevice::Pointer::Pointer(QWaylandInputDevice *seat) QWaylandInputDevice::Pointer::~Pointer() { - if (mParent->mVersion >= 3) + if (version() >= 3) wl_pointer_release(object()); else wl_pointer_destroy(object()); @@ -197,8 +197,6 @@ public: : QWaylandSurface(display) , m_pointer(pointer) { - //TODO: When we upgrade to libwayland 1.10, use wl_surface_get_version instead. - m_version = display->compositorVersion(); connect(this, &QWaylandSurface::screensChanged, m_pointer, &QWaylandInputDevice::Pointer::updateCursor); } @@ -215,7 +213,7 @@ public: void update(wl_buffer *buffer, const QPoint &hotspot, const QSize &size, int bufferScale, bool animated = false) { // Calling code needs to ensure buffer scale is supported if != 1 - Q_ASSERT(bufferScale == 1 || m_version >= 3); + Q_ASSERT(bufferScale == 1 || version() >= 3); auto enterSerial = m_pointer->mEnterSerial; if (m_setSerial < enterSerial || m_hotspot != hotspot) { @@ -224,7 +222,7 @@ public: m_hotspot = hotspot; } - if (m_version >= 3) + if (version() >= 3) set_buffer_scale(bufferScale); attach(buffer, 0, 0); @@ -250,7 +248,6 @@ public: private: QScopedPointer m_frameCallback; QWaylandInputDevice::Pointer *m_pointer = nullptr; - uint m_version = 0; uint m_setSerial = 0; QPoint m_hotspot; }; @@ -270,9 +267,9 @@ int QWaylandInputDevice::Pointer::cursorSize() const int QWaylandInputDevice::Pointer::idealCursorScale() const { - // set_buffer_scale is not supported on earlier versions - if (seat()->mQDisplay->compositorVersion() < 3) + if (seat()->mQDisplay->compositor()->version() < 3) { return 1; + } if (auto *s = mCursor.surface.data()) { if (s->outputScale() > 0) @@ -394,7 +391,7 @@ QWaylandInputDevice::Touch::Touch(QWaylandInputDevice *p) QWaylandInputDevice::Touch::~Touch() { - if (mParent->mVersion >= 3) + if (version() >= 3) wl_touch_release(object()); else wl_touch_destroy(object()); @@ -404,7 +401,6 @@ QWaylandInputDevice::QWaylandInputDevice(QWaylandDisplay *display, int version, : QtWayland::wl_seat(display->wl_registry(), id, qMin(version, 5)) , mQDisplay(display) , mDisplay(display->wl_display()) - , mVersion(qMin(version, 5)) { #if QT_CONFIG(wayland_datadevice) if (mQDisplay->dndSelectionHandler()) { @@ -901,7 +897,7 @@ void QWaylandInputDevice::Pointer::pointer_axis(uint32_t time, uint32_t axis, in mParent->mTime = time; - if (mParent->mVersion < WL_POINTER_FRAME_SINCE_VERSION) { + if (version() < WL_POINTER_FRAME_SINCE_VERSION) { qCDebug(lcQpaWaylandInput) << "Flushing new event; no frame event in this version"; flushFrameEvent(); } @@ -1000,7 +996,7 @@ void QWaylandInputDevice::Pointer::setFrameEvent(QWaylandPointerEvent *event) mFrameData.event = event; - if (mParent->mVersion < WL_POINTER_FRAME_SINCE_VERSION) { + if (version() < WL_POINTER_FRAME_SINCE_VERSION) { qCDebug(lcQpaWaylandInput) << "Flushing new event; no frame event in this version"; flushFrameEvent(); } diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h index 303c9bb31fc..b23de1f422c 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h +++ b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h @@ -164,7 +164,6 @@ protected: QWaylandDisplay *mQDisplay = nullptr; struct wl_display *mDisplay = nullptr; - int mVersion; uint32_t mCaps = 0; #if QT_CONFIG(cursor) diff --git a/src/plugins/platforms/wayland/qwaylandscreen.cpp b/src/plugins/platforms/wayland/qwaylandscreen.cpp index 854f3b08212..40a49d88459 100644 --- a/src/plugins/platforms/wayland/qwaylandscreen.cpp +++ b/src/plugins/platforms/wayland/qwaylandscreen.cpp @@ -55,7 +55,6 @@ namespace QtWaylandClient { QWaylandXdgOutputManagerV1::QWaylandXdgOutputManagerV1(QWaylandDisplay* display, uint id, uint version) : QtWayland::zxdg_output_manager_v1(display->wl_registry(), id, qMin(3u, version)) - , m_version(qMin(3u, version)) { } diff --git a/src/plugins/platforms/wayland/qwaylandscreen_p.h b/src/plugins/platforms/wayland/qwaylandscreen_p.h index 5553208ee4d..fc30a482a05 100644 --- a/src/plugins/platforms/wayland/qwaylandscreen_p.h +++ b/src/plugins/platforms/wayland/qwaylandscreen_p.h @@ -67,9 +67,6 @@ class QWaylandCursor; class Q_WAYLAND_CLIENT_EXPORT QWaylandXdgOutputManagerV1 : public QtWayland::zxdg_output_manager_v1 { public: QWaylandXdgOutputManagerV1(QWaylandDisplay *display, uint id, uint version); - uint version() const { return m_version; } -private: - uint m_version = 1; // TODO: remove when we upgrade minimum libwayland requriement to 1.10 }; class Q_WAYLAND_CLIENT_EXPORT QWaylandScreen : public QPlatformScreen, QtWayland::wl_output, QtWayland::zxdg_output_v1 diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index b19c518d364..243f16a7895 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -188,7 +188,7 @@ void QWaylandWindow::initWindow() // Enable high-dpi rendering. Scale() returns the screen scale factor and will // typically be integer 1 (normal-dpi) or 2 (high-dpi). Call set_buffer_scale() // to inform the compositor that high-resolution buffers will be provided. - if (mDisplay->compositorVersion() >= 3) + if (mSurface->version() >= 3) mSurface->set_buffer_scale(scale()); setWindowFlags(window()->flags()); @@ -567,7 +567,7 @@ void QWaylandWindow::attachOffset(QWaylandBuffer *buffer) void QWaylandWindow::damage(const QRect &rect) { const int s = scale(); - if (mDisplay->compositorVersion() >= 4) + if (mSurface->version() >= 4) mSurface->damage_buffer(s * rect.x(), s * rect.y(), s * rect.width(), s * rect.height()); else mSurface->damage(rect.x(), rect.y(), rect.width(), rect.height()); @@ -604,7 +604,7 @@ void QWaylandWindow::commit(QWaylandBuffer *buffer, const QRegion &damage) return; attachOffset(buffer); - if (mDisplay->compositorVersion() >= 4) { + if (mSurface->version() >= 4) { const int s = scale(); for (const QRect &rect: damage) mSurface->damage_buffer(s * rect.x(), s * rect.y(), s * rect.width(), s * rect.height()); @@ -734,7 +734,7 @@ QWaylandScreen *QWaylandWindow::waylandScreen() const void QWaylandWindow::handleContentOrientationChange(Qt::ScreenOrientation orientation) { - if (mDisplay->compositorVersion() < 2) + if (mSurface->version() < 2) return; wl_output_transform transform; @@ -1014,7 +1014,7 @@ void QWaylandWindow::handleScreensChanged() int scale = newScreen->isPlaceholder() ? 1 : static_cast(newScreen)->scale(); if (scale != mScale) { mScale = scale; - if (mSurface && mDisplay->compositorVersion() >= 3) + if (mSurface && mSurface->version() >= 3) mSurface->set_buffer_scale(mScale); ensureSize(); } diff --git a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp index 450ef519d9e..6da02152eea 100644 --- a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp +++ b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp @@ -1045,6 +1045,8 @@ bool Scanner::process() printf("\n"); printf(" bool isInitialized() const;\n"); printf("\n"); + printf(" uint32_t version() const;"); + printf("\n"); printf(" static const struct ::wl_interface *interface();\n"); printEnums(interface.enums); @@ -1198,6 +1200,12 @@ bool Scanner::process() printf(" }\n"); printf("\n"); + printf(" uint32_t %s::version() const\n", interfaceName); + printf(" {\n"); + printf(" return wl_proxy_get_version(reinterpret_cast(m_%s));\n", interfaceName); + printf(" }\n"); + printf("\n"); + printf(" const struct wl_interface *%s::interface()\n", interfaceName); printf(" {\n"); printf(" return &::%s_interface;\n", interfaceName); From d92e26205e15834cde1c4eb87920cb57d6f6fae6 Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Mon, 14 Sep 2020 17:08:39 +0100 Subject: [PATCH 0925/1507] Client: Send exposeEvent to parent on subsurface position changes When a subsurface is moved, we need the parent window to commit to apply that move. Ideally we want this in sync with any potential rendering on the parent window. Currently the code calls requestUpdate() which acts more like a frame callback; it will only do something if the main QWindow considers itself dirty. We want to force a repaint, which is semantically more similar to an ExposeEvent. Fixes: QTBUG-86177 Pick-to: 5.15 Change-Id: I30bdfa357beee860ce2b00a256eaea6d040dd55c Reviewed-by: Eskil Abrahamsen Blomfeldt --- .../platforms/wayland/qwaylandwindow.cpp | 7 +++- tests/auto/wayland/surface/tst_surface.cpp | 35 +++++++++++++++---- 2 files changed, 35 insertions(+), 7 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 243f16a7895..9b9d30a6fde 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -340,7 +340,12 @@ void QWaylandWindow::setGeometry_helper(const QRect &rect) if (mSubSurfaceWindow) { QMargins m = QPlatformWindow::parent()->frameMargins(); mSubSurfaceWindow->set_position(rect.x() + m.left(), rect.y() + m.top()); - mSubSurfaceWindow->parent()->window()->requestUpdate(); + + QWaylandWindow *parentWindow = mSubSurfaceWindow->parent(); + if (parentWindow && parentWindow->isExposed()) { + QRect parentExposeGeometry(QPoint(), parentWindow->geometry().size()); + parentWindow->sendExposeEvent(parentExposeGeometry); + } } } diff --git a/tests/auto/wayland/surface/tst_surface.cpp b/tests/auto/wayland/surface/tst_surface.cpp index c7b02e2cc80..60d8913247c 100644 --- a/tests/auto/wayland/surface/tst_surface.cpp +++ b/tests/auto/wayland/surface/tst_surface.cpp @@ -165,17 +165,40 @@ void tst_surface::negotiateShmFormat() void tst_surface::createSubsurface() { QRasterWindow window; - window.resize(64, 64); + window.setObjectName("main"); + window.resize(200, 200); + + QRasterWindow subWindow; + subWindow.setObjectName("subwindow"); + subWindow.setParent(&window); + subWindow.resize(64, 64); + window.show(); + subWindow.show(); + + QCOMPOSITOR_TRY_VERIFY(subSurface()); QCOMPOSITOR_TRY_VERIFY(xdgToplevel()); exec([=] { xdgToplevel()->sendCompleteConfigure(); }); QCOMPOSITOR_TRY_VERIFY(xdgSurface()->m_committedConfigureSerial); - QRasterWindow subWindow; - subWindow.setParent(&window); - subWindow.resize(64, 64); - subWindow.show(); - QCOMPOSITOR_TRY_VERIFY(subSurface()); + const Surface *mainSurface = exec([=] {return surface(0);}); + const Surface *childSurface = exec([=] {return surface(1);}); + QSignalSpy mainSurfaceCommitSpy(mainSurface, &Surface::commit); + QSignalSpy childSurfaceCommitSpy(childSurface, &Surface::commit); + + // Move subsurface. The parent should redraw and commit + subWindow.setGeometry(100, 100, 64, 64); + // the toplevel should commit to indicate the subsurface moved + QCOMPOSITOR_TRY_COMPARE(mainSurfaceCommitSpy.count(), 1); + mainSurfaceCommitSpy.clear(); + childSurfaceCommitSpy.clear(); + + // Move and resize the subSurface. The parent should redraw and commit + // The child should also redraw + subWindow.setGeometry(50, 50, 80, 80); + QCOMPOSITOR_TRY_COMPARE(mainSurfaceCommitSpy.count(), 1); + QCOMPOSITOR_TRY_COMPARE(childSurfaceCommitSpy.count(), 1); + } // Used to cause a crash in libwayland (QTBUG-79674) From 37f04028ca7e4234ca5d2fd4ecf63a4aef5e8b8e Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Tue, 9 Feb 2021 22:03:22 +0000 Subject: [PATCH 0926/1507] Client: Rebuild generated files when source or QtWaylandScanner changes Right now if one changes QtWaylandScanner you need to do a clean build to see the changes. Change-Id: I3fc9f37a25550880328363b07b1bb5713c8df2e6 Reviewed-by: Eskil Abrahamsen Blomfeldt Reviewed-by: David Edmundson --- src/tools/qtwaylandscanner/Qt6WaylandClientMacros.cmake | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/tools/qtwaylandscanner/Qt6WaylandClientMacros.cmake b/src/tools/qtwaylandscanner/Qt6WaylandClientMacros.cmake index 408cf237965..5eab19d896f 100644 --- a/src/tools/qtwaylandscanner/Qt6WaylandClientMacros.cmake +++ b/src/tools/qtwaylandscanner/Qt6WaylandClientMacros.cmake @@ -44,6 +44,7 @@ function(qt6_generate_wayland_protocol_client_sources target) add_custom_command( OUTPUT "${qtwaylandscanner_header_output}" COMMAND Qt6::qtwaylandscanner client-header "${protocol_file}" "${wayland_include_dir}" > "${qtwaylandscanner_header_output}" + DEPENDS ${protocol_file} Qt6::qtwaylandscanner ) # TODO: We need this hack in order to get the xcomposite plugins to build... @@ -61,6 +62,7 @@ function(qt6_generate_wayland_protocol_client_sources target) add_custom_command( OUTPUT "${qtwaylandscanner_code_output}" COMMAND Qt6::qtwaylandscanner client-code "${protocol_file}" --header-path='${wayland_include_dir}' --add-include='${qtwaylandscanner_code_include}' > "${qtwaylandscanner_code_output}" + DEPENDS ${protocol_file} Qt6::qtwaylandscanner ) target_sources(${target} PRIVATE From 4d666cd62e2bdb6f7e43e71d3b3d53bef51c04b2 Mon Sep 17 00:00:00 2001 From: Jan Grulich Date: Thu, 11 Feb 2021 15:12:32 +0100 Subject: [PATCH 0927/1507] Get correct decoration margins region Size we use to calculate margins region already contains size including margins. This resulted into bigger region and not properly damaging region we need to update. Pick-to: 5.15 6.0 6.1 Change-Id: Id1b7f4cd2a7b894b82db09c5af2b2d1f1f43fa2a Reviewed-by: David Edmundson --- .../platforms/wayland/qwaylandabstractdecoration.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandabstractdecoration.cpp b/src/plugins/platforms/wayland/qwaylandabstractdecoration.cpp index 87dd6cea0d1..b6ee43c93a3 100644 --- a/src/plugins/platforms/wayland/qwaylandabstractdecoration.cpp +++ b/src/plugins/platforms/wayland/qwaylandabstractdecoration.cpp @@ -108,11 +108,11 @@ void QWaylandAbstractDecoration::setWaylandWindow(QWaylandWindow *window) static QRegion marginsRegion(const QSize &size, const QMargins &margins) { QRegion r; - const int widthWithMargins = margins.left() + size.width() + margins.right(); - r += QRect(0, 0, widthWithMargins, margins.top()); // top - r += QRect(0, size.height()+margins.top(), widthWithMargins, margins.bottom()); //bottom + + r += QRect(0, 0, size.width(), margins.top()); // top + r += QRect(0, size.height()-margins.bottom(), size.width(), margins.bottom()); //bottom r += QRect(0, margins.top(), margins.left(), size.height()); //left - r += QRect(size.width()+margins.left(), margins.top(), margins.right(), size.height()); // right + r += QRect(size.width()-margins.left(), margins.top(), margins.right(), size.height()-margins.top()); // right return r; } From e101ffce1d9260fd3481f1c7c4dacf07218b3078 Mon Sep 17 00:00:00 2001 From: Jan Grulich Date: Tue, 23 Feb 2021 08:30:04 +0100 Subject: [PATCH 0928/1507] Decorations: add new argument to margins() to allow exclude shadows We can already have shadows to be part of decoration margins, but we need a way to also get size of shadow margins itself, because they should be ignored for the purposes of aligning, placing and constraining windows. This change breaks API/ABI compatibility of QWaylandAbstractDecoration plugin, however, as stated in the header file, it is a subject of change and its API is not meant to be stable. Alternatively we can make this a separate method. Change-Id: Ib2c9982e16c4acb13a83757e6371022c0a89b74e Reviewed-by: David Edmundson Reviewed-by: Eskil Abrahamsen Blomfeldt --- .../wayland/plugins/decorations/bradient/main.cpp | 7 +++++-- .../platforms/wayland/qwaylandabstractdecoration_p.h | 9 ++++++++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp b/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp index daae9fcb3b5..b273a58ff41 100644 --- a/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp +++ b/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp @@ -73,7 +73,7 @@ class Q_WAYLAND_CLIENT_EXPORT QWaylandBradientDecoration : public QWaylandAbstra public: QWaylandBradientDecoration(); protected: - QMargins margins() const override; + QMargins margins(MarginsType marginsType = Full) const override; void paint(QPaintDevice *device) override; bool handleMouse(QWaylandInputDevice *inputDevice, const QPointF &local, const QPointF &global,Qt::MouseButtons b,Qt::KeyboardModifiers mods) override; bool handleTouch(QWaylandInputDevice *inputDevice, const QPointF &local, const QPointF &global, Qt::TouchPointState state, Qt::KeyboardModifiers mods) override; @@ -130,8 +130,11 @@ QRectF QWaylandBradientDecoration::minimizeButtonRect() const (margins().top() - BUTTON_WIDTH) / 2, BUTTON_WIDTH, BUTTON_WIDTH); } -QMargins QWaylandBradientDecoration::margins() const +QMargins QWaylandBradientDecoration::margins(MarginsType marginsType) const { + if (marginsType == ShadowsOnly) + return QMargins(); + return QMargins(3, 30, 3, 3); } diff --git a/src/plugins/platforms/wayland/qwaylandabstractdecoration_p.h b/src/plugins/platforms/wayland/qwaylandabstractdecoration_p.h index 81c8e1771cb..61cbde77e90 100644 --- a/src/plugins/platforms/wayland/qwaylandabstractdecoration_p.h +++ b/src/plugins/platforms/wayland/qwaylandabstractdecoration_p.h @@ -82,6 +82,12 @@ class Q_WAYLAND_CLIENT_EXPORT QWaylandAbstractDecoration : public QObject Q_OBJECT Q_DECLARE_PRIVATE(QWaylandAbstractDecoration) public: + enum MarginsType { + Full, + ShadowsExcluded, + ShadowsOnly + }; + QWaylandAbstractDecoration(); ~QWaylandAbstractDecoration() override; @@ -91,7 +97,8 @@ public: void update(); bool isDirty() const; - virtual QMargins margins() const = 0; + virtual QMargins margins(MarginsType marginsType = Full) const = 0; + QWindow *window() const; const QImage &contentImage(); From a02c408afc1ec3713d26f133277cbba2d207f102 Mon Sep 17 00:00:00 2001 From: Jan Grulich Date: Tue, 23 Feb 2021 08:42:16 +0100 Subject: [PATCH 0929/1507] Client: get correct window content geometry Window content geometry should not include invisible portions of the decorations, like shadows. This is stated in xdg-shell specificification and in the description for this method. Change-Id: I444fe9e28f0f175d2051be5c704efa7658bd45fb Reviewed-by: David Edmundson --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 9b9d30a6fde..0f1752d6db6 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -369,7 +369,7 @@ void QWaylandWindow::setGeometry(const QRect &rect) sendExposeEvent(exposeGeometry); if (mShellSurface && isExposed()) - mShellSurface->setWindowGeometry(windowContentGeometry()); + mShellSurface->setWindowGeometry(QRect(QPoint(), surfaceSize())); if (isOpaque() && mMask.isEmpty()) setOpaqueArea(rect); @@ -697,7 +697,12 @@ QSize QWaylandWindow::surfaceSize() const */ QRect QWaylandWindow::windowContentGeometry() const { - return QRect(QPoint(), surfaceSize()); + QMargins shadowMargins; + + if (mWindowDecoration) + shadowMargins = mWindowDecoration->margins(QWaylandAbstractDecoration::ShadowsOnly); + + return QRect(QPoint(shadowMargins.left(), shadowMargins.right()), surfaceSize().shrunkBy(shadowMargins)); } /*! From 8e336efb2d2fc2d6e64be52956b47b663383c161 Mon Sep 17 00:00:00 2001 From: Elvis Lee Date: Thu, 18 Feb 2021 15:45:49 +0900 Subject: [PATCH 0930/1507] Handle registry_global out of constructor Factory functions in QWaylandDisplay::registry_global() can be overridden. Later, other classes instantiated in the registry_global can support platform specific implementation with inheritance and some factory function. Change-Id: I92ce574e049b8c91587687cc7c30611f3dfdbe56 Reviewed-by: Eskil Abrahamsen Blomfeldt --- .../platforms/wayland/qwaylanddisplay.cpp | 19 ++++++++++++------- .../platforms/wayland/qwaylanddisplay_p.h | 2 ++ .../platforms/wayland/qwaylandintegration.cpp | 9 ++++++--- 3 files changed, 20 insertions(+), 10 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index 6c226a350db..a3a562bef24 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -162,13 +162,6 @@ QWaylandDisplay::QWaylandDisplay(QWaylandIntegration *waylandIntegration) if (!mXkbContext) qCWarning(lcQpaWayland, "failed to create xkb context"); #endif - - forceRoundTrip(); - - if (!mWaitingScreens.isEmpty()) { - // Give wl_output.done and zxdg_output_v1.done events a chance to arrive - forceRoundTrip(); - } } QWaylandDisplay::~QWaylandDisplay(void) @@ -193,6 +186,18 @@ QWaylandDisplay::~QWaylandDisplay(void) wl_display_disconnect(mDisplay); } +// Steps which is called just after constructor. This separates registry_global() out of the constructor +// so that factory functions in integration can be overridden. +void QWaylandDisplay::initialize() +{ + forceRoundTrip(); + + if (!mWaitingScreens.isEmpty()) { + // Give wl_output.done and zxdg_output_v1.done events a chance to arrive + forceRoundTrip(); + } +} + void QWaylandDisplay::ensureScreen() { if (!mScreens.empty() || mPlaceholderScreen) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay_p.h b/src/plugins/platforms/wayland/qwaylanddisplay_p.h index 38bc35ff178..6443cff2b85 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay_p.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay_p.h @@ -130,6 +130,8 @@ public: QWaylandDisplay(QWaylandIntegration *waylandIntegration); ~QWaylandDisplay(void) override; + void initialize(); + #if QT_CONFIG(xkbcommon) struct xkb_context *xkbContext() const { return mXkbContext.get(); } #endif diff --git a/src/plugins/platforms/wayland/qwaylandintegration.cpp b/src/plugins/platforms/wayland/qwaylandintegration.cpp index f2f9174f17a..7e7567aa84f 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandintegration.cpp @@ -189,8 +189,11 @@ QPlatformNativeInterface *QWaylandIntegration::createPlatformNativeInterface() return new QWaylandNativeInterface(this); } +// Support platform specific initialization void QWaylandIntegration::initializePlatform() { + mDisplay->initialize(); + mNativeInterface.reset(createPlatformNativeInterface()); initializeInputDeviceIntegration(); #if QT_CONFIG(clipboard) @@ -205,9 +208,6 @@ void QWaylandIntegration::initializePlatform() void QWaylandIntegration::initialize() { - // Support platform specicif initialization - initializePlatform(); - QAbstractEventDispatcher *dispatcher = QGuiApplicationPrivate::eventDispatcher; QObject::connect(dispatcher, SIGNAL(aboutToBlock()), mDisplay.data(), SLOT(flushRequests())); QObject::connect(dispatcher, SIGNAL(awake()), mDisplay.data(), SLOT(flushRequests())); @@ -216,6 +216,9 @@ void QWaylandIntegration::initialize() QSocketNotifier *sn = new QSocketNotifier(fd, QSocketNotifier::Read, mDisplay.data()); QObject::connect(sn, SIGNAL(activated(QSocketDescriptor)), mDisplay.data(), SLOT(flushRequests())); + // Call after eventDispatcher is fully connected, for QWaylandDisplay::forceRoundTrip() + initializePlatform(); + // Qt does not support running with no screens mDisplay->ensureScreen(); } From f0435ab1a49473fccf8f7e2e86fb5f41ade9f101 Mon Sep 17 00:00:00 2001 From: Jungi Byun Date: Tue, 23 Feb 2021 13:20:20 +0900 Subject: [PATCH 0931/1507] Support handleFrameCallback to derived classes The lambda expression doHandleExpose() is used in handleFrameCallback() to deal with exposure. In order to support platform specific implementation for frame callback, make the method doHandleExpose() into a virtual protected member doHandleFrameCallback() in QWaylandWindow. Change-Id: I8b22d4a552c72db1620d606929005917588c680d Reviewed-by: Eskil Abrahamsen Blomfeldt --- .../platforms/wayland/qwaylandwindow.cpp | 25 ++++++++++--------- .../platforms/wayland/qwaylandwindow_p.h | 1 + 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 0f1752d6db6..330c84a4a6b 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -643,24 +643,25 @@ void QWaylandWindow::handleFrameCallback() // The rest can wait until we can run it on the correct thread if (!mWaitingForUpdateDelivery) { - auto doHandleExpose = [this]() { - bool wasExposed = isExposed(); - mFrameCallbackTimedOut = false; - if (!wasExposed && isExposed()) // Did setting mFrameCallbackTimedOut make the window exposed? - sendExposeEvent(QRect(QPoint(), geometry().size())); - if (wasExposed && hasPendingUpdateRequest()) - deliverUpdateRequest(); - - mWaitingForUpdateDelivery = false; - }; - // Queued connection, to make sure we don't call handleUpdate() from inside waitForFrameSync() // in the single-threaded case. mWaitingForUpdateDelivery = true; - QMetaObject::invokeMethod(this, doHandleExpose, Qt::QueuedConnection); + QMetaObject::invokeMethod(this, &QWaylandWindow::doHandleFrameCallback, Qt::QueuedConnection); } } +void QWaylandWindow::doHandleFrameCallback() +{ + bool wasExposed = isExposed(); + mFrameCallbackTimedOut = false; + if (!wasExposed && isExposed()) // Did setting mFrameCallbackTimedOut make the window exposed? + sendExposeEvent(QRect(QPoint(), geometry().size())); + if (wasExposed && hasPendingUpdateRequest()) + deliverUpdateRequest(); + + mWaitingForUpdateDelivery = false; +} + bool QWaylandWindow::waitForFrameSync(int timeout) { QMutexLocker locker(mFrameQueue.mutex); diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index 35850b8858a..c323618bdf2 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -214,6 +214,7 @@ signals: void wlSurfaceDestroyed(); protected: + virtual void doHandleFrameCallback(); void sendExposeEvent(const QRect &rect); QWaylandDisplay *mDisplay = nullptr; From 597278685a7539df705c3383799477feaa78f477 Mon Sep 17 00:00:00 2001 From: Jungi Byun Date: Wed, 27 Jan 2021 08:24:23 +0900 Subject: [PATCH 0932/1507] Replace scale with devicePixelRatio for non-integer scaling The 'scale' event from wayland cannot support non-integer scaling which was originally supported in Qt. As default, devicePixelRatio follows the 'scale' so that the high DPI still works as the mechanism in Wayland. But if non-integer scaling factor such as 150% is needed, it can be supported to override the devicePixelRatio. Change-Id: I63a04db27bd521264b6d0904e1ddd05a572dc970 Reviewed-by: Elvis Lee Reviewed-by: Jungi Byun Reviewed-by: Eskil Abrahamsen Blomfeldt --- .../wayland/qwaylandabstractdecoration.cpp | 2 +- .../wayland/qwaylandshmbackingstore.cpp | 6 +++--- .../wayland/qwaylandshmbackingstore_p.h | 2 +- src/plugins/platforms/wayland/qwaylandwindow.cpp | 16 ++++++++-------- src/plugins/platforms/wayland/qwaylandwindow_p.h | 2 +- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandabstractdecoration.cpp b/src/plugins/platforms/wayland/qwaylandabstractdecoration.cpp index b6ee43c93a3..be0a31df6d9 100644 --- a/src/plugins/platforms/wayland/qwaylandabstractdecoration.cpp +++ b/src/plugins/platforms/wayland/qwaylandabstractdecoration.cpp @@ -122,7 +122,7 @@ const QImage &QWaylandAbstractDecoration::contentImage() if (d->m_isDirty) { // Update the decoration backingstore - const int bufferScale = waylandWindow()->scale(); + const qreal bufferScale = waylandWindow()->scale(); const QSize imageSize = waylandWindow()->surfaceSize() * bufferScale; d->m_decorationContentImage = QImage(imageSize, QImage::Format_ARGB32_Premultiplied); // Only scale by buffer scale, not QT_SCALE_FACTOR etc. diff --git a/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp b/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp index dc7ff67086f..7e1e9bb93bd 100644 --- a/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp +++ b/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp @@ -68,7 +68,7 @@ QT_BEGIN_NAMESPACE namespace QtWaylandClient { QWaylandShmBuffer::QWaylandShmBuffer(QWaylandDisplay *display, - const QSize &size, QImage::Format format, int scale) + const QSize &size, QImage::Format format, qreal scale) { int stride = size.width() * 4; int alloc = stride * size.height(); @@ -108,7 +108,7 @@ QWaylandShmBuffer::QWaylandShmBuffer(QWaylandDisplay *display, QWaylandShm* shm = display->shm(); wl_shm_format wl_format = shm->formatFrom(format); mImage = QImage(data, size.width(), size.height(), stride, format); - mImage.setDevicePixelRatio(qreal(scale)); + mImage.setDevicePixelRatio(scale); mShmPool = wl_shm_create_pool(shm->object(), fd, alloc); init(wl_shm_pool_create_buffer(mShmPool,0, size.width(), size.height(), @@ -271,7 +271,7 @@ QWaylandShmBuffer *QWaylandShmBackingStore::getBuffer(const QSize &size) void QWaylandShmBackingStore::resize(const QSize &size) { QMargins margins = windowDecorationMargins(); - int scale = waylandWindow()->scale(); + qreal scale = waylandWindow()->scale(); QSize sizeWithMargins = (size + QSize(margins.left()+margins.right(),margins.top()+margins.bottom())) * scale; // We look for a free buffer to draw into. If the buffer is not the last buffer we used, diff --git a/src/plugins/platforms/wayland/qwaylandshmbackingstore_p.h b/src/plugins/platforms/wayland/qwaylandshmbackingstore_p.h index e01632daf75..f3fae438016 100644 --- a/src/plugins/platforms/wayland/qwaylandshmbackingstore_p.h +++ b/src/plugins/platforms/wayland/qwaylandshmbackingstore_p.h @@ -71,7 +71,7 @@ class QWaylandWindow; class Q_WAYLAND_CLIENT_EXPORT QWaylandShmBuffer : public QWaylandBuffer { public: QWaylandShmBuffer(QWaylandDisplay *display, - const QSize &size, QImage::Format format, int scale = 1); + const QSize &size, QImage::Format format, qreal scale = 1); ~QWaylandShmBuffer() override; QSize size() const override { return mImage.size(); } int scale() const override { return int(mImage.devicePixelRatio()); } diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 330c84a4a6b..f5dbd02af23 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -189,7 +189,7 @@ void QWaylandWindow::initWindow() // typically be integer 1 (normal-dpi) or 2 (high-dpi). Call set_buffer_scale() // to inform the compositor that high-resolution buffers will be provided. if (mSurface->version() >= 3) - mSurface->set_buffer_scale(scale()); + mSurface->set_buffer_scale(mScale); setWindowFlags(window()->flags()); QRect geometry = windowGeometry(); @@ -571,9 +571,9 @@ void QWaylandWindow::attachOffset(QWaylandBuffer *buffer) void QWaylandWindow::damage(const QRect &rect) { - const int s = scale(); + const qreal s = scale(); if (mSurface->version() >= 4) - mSurface->damage_buffer(s * rect.x(), s * rect.y(), s * rect.width(), s * rect.height()); + mSurface->damage_buffer(qFloor(s * rect.x()), qFloor(s * rect.y()), qCeil(s * rect.width()), qCeil(s * rect.height())); else mSurface->damage(rect.x(), rect.y(), rect.width(), rect.height()); } @@ -610,9 +610,9 @@ void QWaylandWindow::commit(QWaylandBuffer *buffer, const QRegion &damage) attachOffset(buffer); if (mSurface->version() >= 4) { - const int s = scale(); + const qreal s = scale(); for (const QRect &rect: damage) - mSurface->damage_buffer(s * rect.x(), s * rect.y(), s * rect.width(), s * rect.height()); + mSurface->damage_buffer(qFloor(s * rect.x()), qFloor(s * rect.y()), qCeil(s * rect.width()), qCeil(s * rect.height())); } else { for (const QRect &rect: damage) mSurface->damage(rect.x(), rect.y(), rect.width(), rect.height()); @@ -1071,14 +1071,14 @@ bool QWaylandWindow::isActive() const return mDisplay->isWindowActivated(this); } -int QWaylandWindow::scale() const +qreal QWaylandWindow::scale() const { - return mScale; + return devicePixelRatio(); } qreal QWaylandWindow::devicePixelRatio() const { - return mScale; + return qreal(mScale); } bool QWaylandWindow::setMouseGrabEnabled(bool grab) diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index c323618bdf2..b82bbe99f21 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -154,7 +154,7 @@ public: void setMask(const QRegion ®ion) override; - int scale() const; + qreal scale() const; qreal devicePixelRatio() const override; void requestActivateWindow() override; From 8e16ebe3fbf3990cee0ebe3c73c19e3d74c92e91 Mon Sep 17 00:00:00 2001 From: Aleix Pol Date: Mon, 23 Nov 2020 20:07:02 +0100 Subject: [PATCH 0933/1507] xdgshell: Tell the compositor the screen we're expecting to fill The xdgshell protocol allows us to tell the output to fill. This makes it possible to use fullscreen confidently on systems with multiple screens knowing that our windows won't be overlapping one another by calling setScreen accordingly before QWindow::showFullScreen. Pick-to: 6.1 6.0 5.15 Change-Id: I757854c3698639472f3a25ef298ddcca031e1ed5 Reviewed-by: David Edmundson --- .../shellintegration/xdg-shell/qwaylandxdgshell.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp index b7253de2bed..af8bd926451 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp @@ -178,9 +178,12 @@ void QWaylandXdgSurface::Toplevel::requestWindowStates(Qt::WindowStates states) } if (changedStates & Qt::WindowFullScreen) { - if (states & Qt::WindowFullScreen) - set_fullscreen(nullptr); - else + if (states & Qt::WindowFullScreen) { + auto screen = m_xdgSurface->window()->waylandScreen(); + if (screen) { + set_fullscreen(screen->output()); + } + } else unset_fullscreen(); } From 515282115df3f39241969945933c69f3ecc88340 Mon Sep 17 00:00:00 2001 From: David Redondo Date: Wed, 27 Jan 2021 15:35:41 +0100 Subject: [PATCH 0934/1507] Make addRegistryListener protected Enables leaf classes that want to bind immediately to call it without waiting for an event loop Change-Id: I4a885959ef54ba12a2c46f3f1a668e8c0cf1d967 Reviewed-by: David Edmundson --- .../platforms/wayland/global/qwaylandclientextension.cpp | 9 ++++++--- .../platforms/wayland/global/qwaylandclientextension.h | 4 ++-- .../platforms/wayland/global/qwaylandclientextension_p.h | 1 + 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/plugins/platforms/wayland/global/qwaylandclientextension.cpp b/src/plugins/platforms/wayland/global/qwaylandclientextension.cpp index 125b1e19d94..a0d35a15fb3 100644 --- a/src/plugins/platforms/wayland/global/qwaylandclientextension.cpp +++ b/src/plugins/platforms/wayland/global/qwaylandclientextension.cpp @@ -71,10 +71,13 @@ void QWaylandClientExtensionPrivate::handleRegistryGlobal(void *data, ::wl_regis } } -void QWaylandClientExtension::addRegistryListener() +void QWaylandClientExtension::initialize() { Q_D(QWaylandClientExtension); - d->waylandIntegration->display()->addRegistryListener(&QWaylandClientExtensionPrivate::handleRegistryGlobal, this); + if (!d->registered) { + d->waylandIntegration->display()->addRegistryListener(&QWaylandClientExtensionPrivate::handleRegistryGlobal, this); + d->registered = true; + } } QWaylandClientExtension::QWaylandClientExtension(const int ver) @@ -85,7 +88,7 @@ QWaylandClientExtension::QWaylandClientExtension(const int ver) // The registry listener uses virtual functions and we don't want it to be called from // the constructor. - QMetaObject::invokeMethod(this, "addRegistryListener", Qt::QueuedConnection); + QMetaObject::invokeMethod(this, "initialize", Qt::QueuedConnection); } QtWaylandClient::QWaylandIntegration *QWaylandClientExtension::integration() const diff --git a/src/plugins/platforms/wayland/global/qwaylandclientextension.h b/src/plugins/platforms/wayland/global/qwaylandclientextension.h index 98272e5710e..014edce1d69 100644 --- a/src/plugins/platforms/wayland/global/qwaylandclientextension.h +++ b/src/plugins/platforms/wayland/global/qwaylandclientextension.h @@ -76,8 +76,8 @@ Q_SIGNALS: void versionChanged(); void activeChanged(); -private Q_SLOTS: - void addRegistryListener(); +protected Q_SLOTS: + void initialize(); }; template diff --git a/src/plugins/platforms/wayland/global/qwaylandclientextension_p.h b/src/plugins/platforms/wayland/global/qwaylandclientextension_p.h index 69cc46a0a48..9091efbe558 100644 --- a/src/plugins/platforms/wayland/global/qwaylandclientextension_p.h +++ b/src/plugins/platforms/wayland/global/qwaylandclientextension_p.h @@ -68,6 +68,7 @@ public: QtWaylandClient::QWaylandIntegration *waylandIntegration = nullptr; int version = -1; bool active = false; + bool registered = false; }; class Q_WAYLAND_CLIENT_EXPORT QWaylandClientExtensionTemplatePrivate : public QWaylandClientExtensionPrivate From c0f9fef33ec4eaa9cc60493927c1be0de4cc29b4 Mon Sep 17 00:00:00 2001 From: Weng Xuetian Date: Tue, 9 Mar 2021 10:43:59 -0800 Subject: [PATCH 0935/1507] Use qWarning and _exit() instead of qFatal for wayland error This type of error is likely to happen upon system logout. qFatal would trigger sigabrt and leave unnecessary coredump on the system. Using qWarning here would make it consistent with xcb's io error. Pick-to: 5.15 6.0 6.1 Change-Id: I571ba007bf2453486b81837cccdbefa5f181b63d Reviewed-by: David Edmundson --- src/plugins/platforms/wayland/qwaylanddisplay.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index a3a562bef24..94381992c03 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -215,10 +215,11 @@ void QWaylandDisplay::checkError() const int ecode = wl_display_get_error(mDisplay); if ((ecode == EPIPE || ecode == ECONNRESET)) { // special case this to provide a nicer error - qFatal("The Wayland connection broke. Did the Wayland compositor die?"); + qWarning("The Wayland connection broke. Did the Wayland compositor die?"); } else { - qFatal("The Wayland connection experienced a fatal error: %s", strerror(ecode)); + qWarning("The Wayland connection experienced a fatal error: %s", strerror(ecode)); } + _exit(1); } void QWaylandDisplay::flushRequests() From 7fa0a2e375197d3580d24bfca8b232522d5fd21d Mon Sep 17 00:00:00 2001 From: Hyunkook Khang Date: Wed, 29 Apr 2020 11:13:55 +0900 Subject: [PATCH 0936/1507] Fix touch being ignored when down and up are in the same frame The Wayland protocol gives no guarantees about which events are part of a frame, so handle the case where we receive wl_touch.down and wl_touch.up within the same frame. Fixes: QTBUG-89680 Change-Id: Ie0b9d2fb950fb0d9a6af8dd8ad2fa55a5efa71e6 Pick-to: 5.15 6.1 6.0 Reviewed-by: Volker Hilsheimer Reviewed-by: Shawn Rutledge --- src/plugins/platforms/wayland/qwaylandinputdevice.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index fb9c63d8fec..420194733b9 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -1419,6 +1419,14 @@ void QWaylandInputDevice::handleTouchPoint(int id, Qt::TouchPointState state, co it = mTouch->mPendingTouchPoints.insert(end, QWindowSystemInterface::TouchPoint()); it->id = id; } + // If the touch points were up and down in same frame, send out frame right away + else if ((it->state == QEventPoint::Pressed && state == QEventPoint::Released) + || (it->state == QEventPoint::Released && state == QEventPoint::Pressed)) { + mTouch->touch_frame(); + it = mTouch->mPendingTouchPoints.insert(mTouch->mPendingTouchPoints.end(), QWindowSystemInterface::TouchPoint()); + it->id = id; + } + QWindowSystemInterface::TouchPoint &tp = *it; // Only moved and pressed needs to update/set position From 98c921c0e2250ce85ab3de05ea58e98587102ae3 Mon Sep 17 00:00:00 2001 From: Aleix Pol Date: Wed, 10 Mar 2021 01:09:13 +0100 Subject: [PATCH 0937/1507] client: Allow QWaylandInputContext to accept composed key combinations At the moment, we are forcing user to choose to either compose or use the text-input channel. This patch brings some of the QComposeInputContext functionality in order to let applications understand dead key combinations like they are supposed to. Having it in QWaylandInputContext rather than in QWaylandInputDevice should solve the problems 9a782df3e7f6f937a1bae3fa5e964a29fbe5980b had with dd13698a730594d9f40baa367dcfe05bc23f1016, because we are doing it in the input context rather than before. This way, if the user is overriding the input method (e.g. by setting QT_IM_MODULE), all the key strokes will still be properly forwarded to the module to use. This in turn allows us to solve https://bugs.kde.org/show_bug.cgi?id=411729 and https://bugs.kde.org/show_bug.cgi?id=405388 since we don't need to choose anymore between physical and virual keyboards anymore. Pick-to: 5.15 Change-Id: I8601f5d7ae21edf4b3a1191fa75877286e505588 Reviewed-by: David Edmundson --- .../platforms/wayland/qwaylanddisplay_p.h | 3 - .../wayland/qwaylandinputcontext.cpp | 95 ++++++++++++++++++- .../wayland/qwaylandinputcontext_p.h | 21 ++++ .../platforms/wayland/qwaylandinputdevice.cpp | 2 +- .../platforms/wayland/qwaylandintegration.cpp | 8 +- 5 files changed, 119 insertions(+), 10 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay_p.h b/src/plugins/platforms/wayland/qwaylanddisplay_p.h index 6443cff2b85..91715a14458 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay_p.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay_p.h @@ -178,8 +178,6 @@ public: QWaylandHardwareIntegration *hardwareIntegration() const { return mHardwareIntegration.data(); } QWaylandXdgOutputManagerV1 *xdgOutputManager() const { return mXdgOutputManager.data(); } - bool usingInputContextFromCompositor() const { return mUsingInputContextFromCompositor; } - struct RegistryGlobal { uint32_t id; QString interface; @@ -299,7 +297,6 @@ private: QReadWriteLock m_frameQueueLock; bool mClientSideInputContextRequested = !QPlatformInputContextFactory::requested().isNull(); - bool mUsingInputContextFromCompositor = false; void registry_global(uint32_t id, const QString &interface, uint32_t version) override; void registry_global_remove(uint32_t id) override; diff --git a/src/plugins/platforms/wayland/qwaylandinputcontext.cpp b/src/plugins/platforms/wayland/qwaylandinputcontext.cpp index 6c586960ea9..16e03ea170c 100644 --- a/src/plugins/platforms/wayland/qwaylandinputcontext.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputcontext.cpp @@ -408,6 +408,8 @@ bool QWaylandInputContext::isValid() const void QWaylandInputContext::reset() { qCDebug(qLcQpaInputMethods) << Q_FUNC_INFO; + if (m_composeState) + xkb_compose_state_reset(m_composeState); QPlatformInputContext::reset(); @@ -528,9 +530,14 @@ Qt::LayoutDirection QWaylandInputContext::inputDirection() const return textInput()->inputDirection(); } -void QWaylandInputContext::setFocusObject(QObject *) +void QWaylandInputContext::setFocusObject(QObject *object) { qCDebug(qLcQpaInputMethods) << Q_FUNC_INFO; +#if QT_CONFIG(xkbcommon) + m_focusObject = object; +#else + Q_UNUSED(object); +#endif if (!textInput()) return; @@ -563,6 +570,92 @@ QWaylandTextInput *QWaylandInputContext::textInput() const return mDisplay->defaultInputDevice()->textInput(); } +#if QT_CONFIG(xkbcommon) + +void QWaylandInputContext::ensureInitialized() +{ + if (m_initialized) + return; + + if (!m_XkbContext) { + qCWarning(qLcQpaInputMethods) << "error: xkb context has not been set on" << metaObject()->className(); + return; + } + + m_initialized = true; + const char *locale = setlocale(LC_CTYPE, ""); + if (!locale) + locale = setlocale(LC_CTYPE, nullptr); + qCDebug(qLcQpaInputMethods) << "detected locale (LC_CTYPE):" << locale; + + m_composeTable = xkb_compose_table_new_from_locale(m_XkbContext, locale, XKB_COMPOSE_COMPILE_NO_FLAGS); + if (m_composeTable) + m_composeState = xkb_compose_state_new(m_composeTable, XKB_COMPOSE_STATE_NO_FLAGS); + + if (!m_composeTable) { + qCWarning(qLcQpaInputMethods, "failed to create compose table"); + return; + } + if (!m_composeState) { + qCWarning(qLcQpaInputMethods, "failed to create compose state"); + return; + } +} + +bool QWaylandInputContext::filterEvent(const QEvent *event) +{ + auto keyEvent = static_cast(event); + if (keyEvent->type() != QEvent::KeyPress) + return false; + + if (!inputMethodAccepted()) + return false; + + // lazy initialization - we don't want to do this on an app startup + ensureInitialized(); + + if (!m_composeTable || !m_composeState) + return false; + + xkb_compose_state_feed(m_composeState, keyEvent->nativeVirtualKey()); + + switch (xkb_compose_state_get_status(m_composeState)) { + case XKB_COMPOSE_COMPOSING: + return true; + case XKB_COMPOSE_CANCELLED: + reset(); + return false; + case XKB_COMPOSE_COMPOSED: + { + const int size = xkb_compose_state_get_utf8(m_composeState, nullptr, 0); + QVarLengthArray buffer(size + 1); + xkb_compose_state_get_utf8(m_composeState, buffer.data(), buffer.size()); + QString composedText = QString::fromUtf8(buffer.constData()); + + QInputMethodEvent event; + event.setCommitString(composedText); + + if (!m_focusObject && qApp) + m_focusObject = qApp->focusObject(); + + if (m_focusObject) + QCoreApplication::sendEvent(m_focusObject, &event); + else + qCWarning(qLcQpaInputMethods, "no focus object"); + + reset(); + return true; + } + case XKB_COMPOSE_NOTHING: + return false; + default: + Q_UNREACHABLE(); + return false; + } +} + +#endif + } QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandinputcontext_p.h b/src/plugins/platforms/wayland/qwaylandinputcontext_p.h index df91856c460..912c68ad400 100644 --- a/src/plugins/platforms/wayland/qwaylandinputcontext_p.h +++ b/src/plugins/platforms/wayland/qwaylandinputcontext_p.h @@ -62,6 +62,10 @@ #include #include +#include +#if QT_CONFIG(xkbcommon) +#include +#endif struct wl_callback; struct wl_callback_listener; @@ -156,11 +160,28 @@ public: void setFocusObject(QObject *object) override; +#if QT_CONFIG(xkbcommon) + bool filterEvent(const QEvent *event) override; + + // This invokable is called from QXkbCommon::setXkbContext(). + Q_INVOKABLE void setXkbContext(struct xkb_context *context) { m_XkbContext = context; } +#endif + private: QWaylandTextInput *textInput() const; QWaylandDisplay *mDisplay = nullptr; QPointer mCurrentWindow; + +#if QT_CONFIG(xkbcommon) + void ensureInitialized(); + + bool m_initialized = false; + QObject *m_focusObject = nullptr; + xkb_compose_table *m_composeTable = nullptr; + xkb_compose_state *m_composeState = nullptr; + struct xkb_context *m_XkbContext = nullptr; +#endif }; } diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index 420194733b9..4a046a134ee 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -1213,7 +1213,7 @@ void QWaylandInputDevice::Keyboard::handleKey(ulong timestamp, QEvent::Type type QPlatformInputContext *inputContext = QGuiApplicationPrivate::platformIntegration()->inputContext(); bool filtered = false; - if (inputContext && !mParent->mQDisplay->usingInputContextFromCompositor()) { + if (inputContext) { QKeyEvent event(type, key, modifiers, nativeScanCode, nativeVirtualKey, nativeModifiers, text, autorepeat, count); event.setTimestamp(timestamp); diff --git a/src/plugins/platforms/wayland/qwaylandintegration.cpp b/src/plugins/platforms/wayland/qwaylandintegration.cpp index 7e7567aa84f..09de7dddd7f 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandintegration.cpp @@ -500,13 +500,11 @@ void QWaylandIntegration::reconfigureInputContext() #if QT_CONFIG(xkbcommon) QXkbCommon::setXkbContext(mInputContext.data(), mDisplay->xkbContext()); + if (QWaylandInputContext* waylandInput = qobject_cast(mInputContext.get())) { + waylandInput->setXkbContext(mDisplay->xkbContext()); + } #endif - // Even if compositor-side input context handling has been requested, we fallback to - // client-side handling if compositor does not provide the text-input extension. This - // is why we need to check here which input context actually is being used. - mDisplay->mUsingInputContextFromCompositor = qobject_cast(mInputContext.data()); - qCDebug(lcQpaWayland) << "using input method:" << inputContext()->metaObject()->className(); } From bffa397f68724773088ddba4dc127ed864bf236d Mon Sep 17 00:00:00 2001 From: Jaeyoon Jung Date: Thu, 25 Mar 2021 07:50:25 +0900 Subject: [PATCH 0938/1507] Client: Allow inheritance of key translation Use a virtual method keysymToQtKey for Qt key code translation, so that it can be customized by a descendant class if needed. Change-Id: I3b48346a63e2c6f134230fe15279faa95abe11a0 Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/plugins/platforms/wayland/qwaylandinputdevice.cpp | 2 +- src/plugins/platforms/wayland/qwaylandinputdevice_p.h | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index 4a046a134ee..3304b9118b6 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -1268,7 +1268,7 @@ void QWaylandInputDevice::Keyboard::keyboard_key(uint32_t serial, uint32_t time, Qt::KeyboardModifiers modifiers = mParent->modifiers(); - int qtkey = QXkbCommon::keysymToQtKey(sym, modifiers, mXkbState.get(), code); + int qtkey = keysymToQtKey(sym, modifiers, mXkbState.get(), code); QString text = QXkbCommon::lookupString(mXkbState.get(), code); QEvent::Type type = isDown ? QEvent::KeyPress : QEvent::KeyRelease; diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h index b23de1f422c..4a216bc4344 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h +++ b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h @@ -263,6 +263,12 @@ public: struct ::wl_keyboard *wl_keyboard() { return QtWayland::wl_keyboard::object(); } +#if QT_CONFIG(xkbcommon) + virtual int keysymToQtKey(xkb_keysym_t keysym, Qt::KeyboardModifiers modifiers, xkb_state *state, xkb_keycode_t code) { + return QXkbCommon::keysymToQtKey(keysym, modifiers, state, code); + } +#endif + private slots: void handleFocusDestroyed(); void handleFocusLost(); From 0ccd3105ff43055ec75f05cade7996a047d6af31 Mon Sep 17 00:00:00 2001 From: Elvis Lee Date: Wed, 17 Mar 2021 16:31:10 +0900 Subject: [PATCH 0939/1507] Connect flushRequest after forceRoundTrip If flushRequest is connected with aboutToBlock, the flushRequest may consumes all events so that processEvents might be blocked in forceRoundTrip. Change-Id: I12b2c506e8442bf0e75f6ab6e418d3e1eea6d68c Reviewed-by: Eskil Abrahamsen Blomfeldt --- .../platforms/wayland/qwaylandintegration.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandintegration.cpp b/src/plugins/platforms/wayland/qwaylandintegration.cpp index 09de7dddd7f..41e6c50f86e 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandintegration.cpp @@ -208,17 +208,20 @@ void QWaylandIntegration::initializePlatform() void QWaylandIntegration::initialize() { - QAbstractEventDispatcher *dispatcher = QGuiApplicationPrivate::eventDispatcher; - QObject::connect(dispatcher, SIGNAL(aboutToBlock()), mDisplay.data(), SLOT(flushRequests())); - QObject::connect(dispatcher, SIGNAL(awake()), mDisplay.data(), SLOT(flushRequests())); - int fd = wl_display_get_fd(mDisplay->wl_display()); QSocketNotifier *sn = new QSocketNotifier(fd, QSocketNotifier::Read, mDisplay.data()); QObject::connect(sn, SIGNAL(activated(QSocketDescriptor)), mDisplay.data(), SLOT(flushRequests())); - // Call after eventDispatcher is fully connected, for QWaylandDisplay::forceRoundTrip() + // Call this after eventDispatcher is connected with QSocketNotifier for QWaylandDisplay::forceRoundTrip() initializePlatform(); + // But the aboutToBlock() and awake() should be connected after initializePlatform(). + // Otherwise the connected flushRequests() may consumes up all events before processEvents starts to wait, + // so that processEvents(QEventLoop::WaitForMoreEvents) may be blocked in the forceRoundTrip(). + QAbstractEventDispatcher *dispatcher = QGuiApplicationPrivate::eventDispatcher; + QObject::connect(dispatcher, SIGNAL(aboutToBlock()), mDisplay.data(), SLOT(flushRequests())); + QObject::connect(dispatcher, SIGNAL(awake()), mDisplay.data(), SLOT(flushRequests())); + // Qt does not support running with no screens mDisplay->ensureScreen(); } From 1f2c1062c63b099c1e5ab8a7da8144ce1abf68de Mon Sep 17 00:00:00 2001 From: Youngjin Kim Date: Fri, 19 Mar 2021 15:46:08 +0900 Subject: [PATCH 0940/1507] Fix inconsistent window geometry on null window Add virtual QtWaylandClient::QWaylandWindow::defaultGeometry(). So this method allows a client to set the desired default geometry. Otherwise, if the geometry of the window is null, the window with the hard-coded geometry size will be displayed for a while when starting a client application. Change-Id: I18c50f8f390c2b8e1a2c3d8e4641b896df4d6c3f Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 7 ++++++- src/plugins/platforms/wayland/qwaylandwindow_p.h | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index f5dbd02af23..4d59a2b7802 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -194,7 +194,7 @@ void QWaylandWindow::initWindow() setWindowFlags(window()->flags()); QRect geometry = windowGeometry(); if (geometry.isEmpty()) - setGeometry_helper(QRect(QPoint(), QSize(500,500))); + setGeometry_helper(defaultGeometry()); else setGeometry_helper(geometry); setMask(window()->mask()); @@ -329,6 +329,11 @@ void QWaylandWindow::setWindowIcon(const QIcon &icon) mWindowDecoration->update(); } +QRect QWaylandWindow::defaultGeometry() const +{ + return QRect(QPoint(), QSize(500,500)); +} + void QWaylandWindow::setGeometry_helper(const QRect &rect) { QSize minimum = windowMinimumSize(); diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index b82bbe99f21..5f134568b39 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -215,6 +215,7 @@ signals: protected: virtual void doHandleFrameCallback(); + virtual QRect defaultGeometry() const; void sendExposeEvent(const QRect &rect); QWaylandDisplay *mDisplay = nullptr; From 5a8e8618075b014f9cd7fd062e19573d69b36ec1 Mon Sep 17 00:00:00 2001 From: Jan Grulich Date: Wed, 17 Mar 2021 15:45:54 +0100 Subject: [PATCH 0941/1507] Client: get correct window content geometry We have to apply geometry where we don't include shadows, because we need them to be ignored in some scenarios. Also, with geometry being already shrunk by the size of shadow margins, we have to avoid doing it again, otherwise we can accidentally make our window smaller every time we update its size or state. Change-Id: I0e26ee1be8d918913125ee7f7c97de56ccc797cf Reviewed-by: David Edmundson --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 4d59a2b7802..27a9e562825 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -374,7 +374,7 @@ void QWaylandWindow::setGeometry(const QRect &rect) sendExposeEvent(exposeGeometry); if (mShellSurface && isExposed()) - mShellSurface->setWindowGeometry(QRect(QPoint(), surfaceSize())); + mShellSurface->setWindowGeometry(windowContentGeometry()); if (isOpaque() && mMask.isEmpty()) setOpaqueArea(rect); @@ -383,6 +383,16 @@ void QWaylandWindow::setGeometry(const QRect &rect) void QWaylandWindow::resizeFromApplyConfigure(const QSize &sizeWithMargins, const QPoint &offset) { QMargins margins = frameMargins(); + + // Exclude shadows from margins once they are excluded from window geometry + // 1) First resizeFromApplyConfigure() call will have sizeWithMargins equal to surfaceSize() + // which has full margins (shadows included). + // 2) Following resizeFromApplyConfigure() calls should have sizeWithMargins equal to + // windowContentGeometry() which excludes shadows, therefore in this case we have to + // exclude them too in order not to accidentally apply smaller size to the window. + if (mWindowDecoration && (sizeWithMargins != surfaceSize())) + margins = mWindowDecoration->margins(QWaylandAbstractDecoration::ShadowsExcluded); + int widthWithoutMargins = qMax(sizeWithMargins.width() - (margins.left() + margins.right()), 1); int heightWithoutMargins = qMax(sizeWithMargins.height() - (margins.top() + margins.bottom()), 1); QRect geometry(windowGeometry().topLeft(), QSize(widthWithoutMargins, heightWithoutMargins)); @@ -708,7 +718,7 @@ QRect QWaylandWindow::windowContentGeometry() const if (mWindowDecoration) shadowMargins = mWindowDecoration->margins(QWaylandAbstractDecoration::ShadowsOnly); - return QRect(QPoint(shadowMargins.left(), shadowMargins.right()), surfaceSize().shrunkBy(shadowMargins)); + return QRect(QPoint(shadowMargins.left(), shadowMargins.top()), surfaceSize().shrunkBy(shadowMargins)); } /*! From 218a99d7bc0d18c9fe32bcf1a1272a2ab40fafc4 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Wed, 14 Apr 2021 11:24:20 +0200 Subject: [PATCH 0942/1507] Remove bogus warning about missing wayland-egl For some reason, we always print a confusing message that the wayland-egl backend is not built when configure is run. The warning is incorrect, and since it is not worth the trouble to find out why it isn't working, we just remove it. Fixes: QTBUG-92925 Change-Id: I01e35f21180249c1ae0db73dc3541365fb2eff41 Reviewed-by: Paul Olav Tvete --- src/plugins/platforms/wayland/configure.cmake | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/plugins/platforms/wayland/configure.cmake b/src/plugins/platforms/wayland/configure.cmake index ba87484be6e..11612d11fec 100644 --- a/src/plugins/platforms/wayland/configure.cmake +++ b/src/plugins/platforms/wayland/configure.cmake @@ -241,8 +241,3 @@ qt_configure_add_summary_entry(ARGS "wayland-client-ivi-shell") qt_configure_add_summary_entry(ARGS "wayland-client-wl-shell") qt_configure_end_summary_section() # end of "Qt Wayland Client Shell Integrations" section qt_configure_add_summary_entry(ARGS "wayland-client") -qt_configure_add_report_entry( - TYPE NOTE - MESSAGE "No wayland-egl support detected. Cross-toolkit compatibility disabled." - CONDITION NOT Wayland_FOUND -) From 24f8a92cbc832b46f506f6afa3435f08e3d6ce25 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Mon, 19 Apr 2021 08:41:22 +0200 Subject: [PATCH 0943/1507] client: Fix frame callback leak when window unexposed If we get a new update while already waiting for a frame callback and the window is unexposed, we would previously destroy the callback and issue a new one. But if the window is unexposed, the compositor may accumulate these and answer all the callbacks when the window is shown again. This may cause overflows and the client to be killed by the compositor in some cases where the number of pending updates is too high. To avoid this, we skip requesting new callbacks if there is already one pending and the window is unexposed. When the window is re-exposed, the existing pending callback will be triggered anyway, and until then there is no need to repeatedly verify that we still cannot render. One risk is that there may be compositors which never issues a response to the callbacks requested while the window was unexposed. But that would probably be in conflict with the specification and possibly cause other issues as well. The patch was tested with Weston and Mutter, and seems to improve behavior in both of these at least. [ChangeLog][Client] Fixed a bug where Wayland clients would continuously request frame callbacks while unexposed, which potentially caused crashes on some compositors. Fixes: QTBUG-81504 Change-Id: I16dbe51cc5a9acf1f49b4070af91e7f2c8996122 Reviewed-by: Aleix Pol Gonzalez Reviewed-by: Paul Olav Tvete --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 27a9e562825..c35ccab15b7 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -1204,6 +1204,9 @@ void QWaylandWindow::handleUpdate() return; if (mFrameCallback) { + if (!isExposed()) + return; + wl_callback_destroy(mFrameCallback); mFrameCallback = nullptr; } From 3d3a5afc68a50c261e6fa355e05a73915da52153 Mon Sep 17 00:00:00 2001 From: Samuli Piippo Date: Thu, 22 Apr 2021 15:29:56 +0300 Subject: [PATCH 0944/1507] Add missing define guards Ammend 98c921c0e2250ce85ab3de05ea58e98587102ae3 to use m_composeState only if xcbcommon is available. Pick-to: 5.15 Change-Id: I48332b15def3282c5bda3e1c7c393ea7e9849cbe Reviewed-by: Aleix Pol Gonzalez --- src/plugins/platforms/wayland/qwaylandinputcontext.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/plugins/platforms/wayland/qwaylandinputcontext.cpp b/src/plugins/platforms/wayland/qwaylandinputcontext.cpp index 16e03ea170c..cbf63cde82c 100644 --- a/src/plugins/platforms/wayland/qwaylandinputcontext.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputcontext.cpp @@ -408,8 +408,10 @@ bool QWaylandInputContext::isValid() const void QWaylandInputContext::reset() { qCDebug(qLcQpaInputMethods) << Q_FUNC_INFO; +#if QT_CONFIG(xkbcommon) if (m_composeState) xkb_compose_state_reset(m_composeState); +#endif QPlatformInputContext::reset(); From 2fca2ca03a26db5fe06ae51b5fddad179e11dcf9 Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Wed, 24 Feb 2021 20:30:14 +0200 Subject: [PATCH 0945/1507] Scanner: Remove global version check libwayland-server ensures that the requested version is less than or equal to the global version. This change removes the global version check to simplify the generated code and reduce memory usage footprint, however the latter shouldn't be that noticeable. Change-Id: Idd76098e588f3f4ca1be960d20a16994726702af Reviewed-by: David Edmundson --- src/tools/qtwaylandscanner/qtwaylandscanner.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp index 6da02152eea..93f4b68ff64 100644 --- a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp +++ b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp @@ -637,7 +637,6 @@ bool Scanner::process() printf(" QMultiMap m_resource_map;\n"); printf(" Resource *m_resource;\n"); printf(" struct ::wl_global *m_global;\n"); - printf(" uint32_t m_globalVersion;\n"); printf(" struct DisplayDestroyedListener : ::wl_listener {\n"); printf(" %s *parent;\n", interfaceName); printf(" };\n"); @@ -762,7 +761,6 @@ bool Scanner::process() printf(" void %s::init(struct ::wl_display *display, int version)\n", interfaceName); printf(" {\n"); printf(" m_global = wl_global_create(display, &::%s_interface, version, this, bind_func);\n", interfaceName); - printf(" m_globalVersion = version;\n"); printf(" m_displayDestroyedListener.notify = %s::display_destroy_func;\n", interfaceName); printf(" m_displayDestroyedListener.parent = this;\n"); printf(" wl_display_add_destroy_listener(display, &m_displayDestroyedListener);\n"); @@ -794,7 +792,7 @@ bool Scanner::process() printf(" void %s::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id)\n", interfaceName); printf(" {\n"); printf(" %s *that = static_cast<%s *>(data);\n", interfaceName, interfaceName); - printf(" that->add(client, id, qMin(that->m_globalVersion, version));\n"); + printf(" that->add(client, id, version);\n"); printf(" }\n"); printf("\n"); From 5beb9d4e0d6df6ba0f50dcae9b3d4252e4dfb2da Mon Sep 17 00:00:00 2001 From: Elvis Lee Date: Wed, 30 Dec 2020 16:56:33 +0900 Subject: [PATCH 0946/1507] Export wayland-egl client hwintegration Support wayland-egl client hwintegration as a module for external build. Change-Id: I3e82838d0cc89d4bb1435b835dc1e9b592319ddf Reviewed-by: Elvis Lee Reviewed-by: Jaeyoon Jung Reviewed-by: Eskil Abrahamsen Blomfeldt Reviewed-by: Joerg Bornemann --- src/platformsupport/wayland/CMakeLists.txt | 1 + .../hardwareintegration/wayland-egl/CMakeLists.txt | 12 +----------- .../plugins/hardwareintegration/wayland-egl/main.cpp | 2 +- 3 files changed, 3 insertions(+), 12 deletions(-) diff --git a/src/platformsupport/wayland/CMakeLists.txt b/src/platformsupport/wayland/CMakeLists.txt index 8e60f0ba8f5..d970fcf5250 100644 --- a/src/platformsupport/wayland/CMakeLists.txt +++ b/src/platformsupport/wayland/CMakeLists.txt @@ -52,6 +52,7 @@ if (QT_FEATURE_wayland_server) endif() if (QT_FEATURE_wayland_server OR QT_FEATURE_wayland_client) + add_subdirectory(hardwareintegration) add_subdirectory(plugins) add_subdirectory(imports) endif() diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/CMakeLists.txt index 1742f1173a8..5baeb7168a4 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/CMakeLists.txt +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/CMakeLists.txt @@ -9,22 +9,12 @@ qt_internal_add_plugin(QWaylandEglClientBufferPlugin OUTPUT_NAME qt-plugin-wayland-egl TYPE wayland-graphics-integration-client SOURCES - ../../../../hardwareintegration/client/wayland-egl/qwaylandeglclientbufferintegration.cpp ../../../../hardwareintegration/client/wayland-egl/qwaylandeglclientbufferintegration.h - ../../../../hardwareintegration/client/wayland-egl/qwaylandeglinclude.h - ../../../../hardwareintegration/client/wayland-egl/qwaylandeglwindow.cpp ../../../../hardwareintegration/client/wayland-egl/qwaylandeglwindow.h - ../../../../hardwareintegration/client/wayland-egl/qwaylandglcontext.cpp ../../../../hardwareintegration/client/wayland-egl/qwaylandglcontext.h main.cpp - INCLUDE_DIRECTORIES - ../../../../hardwareintegration/client/wayland-egl PUBLIC_LIBRARIES - ${CMAKE_DL_LIBS} - EGL::EGL Qt::Core Qt::Gui - Qt::OpenGLPrivate Qt::WaylandClientPrivate - Wayland::Client - Wayland::Egl + Qt::WaylandEglClientHwIntegrationPrivate ) #### Keys ignored in scope 1:.:.:wayland-egl.pro:: diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/main.cpp b/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/main.cpp index 0890635536f..11bf5806324 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/main.cpp +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/main.cpp @@ -38,7 +38,7 @@ ****************************************************************************/ #include -#include "qwaylandeglclientbufferintegration.h" +#include QT_BEGIN_NAMESPACE From b9a1fb393d47c828318c6a1ca24f45e7a3d72c7c Mon Sep 17 00:00:00 2001 From: Elvis Lee Date: Thu, 31 Dec 2020 13:49:10 +0900 Subject: [PATCH 0947/1507] Export wl-shell integration Support wl-shell integration as a module for external build Change-Id: I6cd5e5c35ff1162943ffdcbe7ff834f30783e5a8 Reviewed-by: Eskil Abrahamsen Blomfeldt --- .../shellintegration/wl-shell/CMakeLists.txt | 36 +++++++++++++------ 1 file changed, 25 insertions(+), 11 deletions(-) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/CMakeLists.txt index 56cc5b85393..e87bc5c4015 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/CMakeLists.txt +++ b/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/CMakeLists.txt @@ -1,36 +1,50 @@ # Generated from wl-shell.pro. ##################################################################### -## QWaylandWlShellIntegrationPlugin Plugin: +## WlShellIntegration Module: ##################################################################### -qt_internal_add_plugin(QWaylandWlShellIntegrationPlugin - OUTPUT_NAME wl-shell - TYPE wayland-shell-integration +qt_internal_add_module(WlShellIntegration + CONFIG_MODULE_NAME wl_shell_integration + INTERNAL_MODULE SOURCES - main.cpp qwaylandwlshellintegration.cpp qwaylandwlshellintegration_p.h qwaylandwlshellsurface.cpp qwaylandwlshellsurface_p.h PUBLIC_LIBRARIES - Qt::Core - Qt::Gui Qt::GuiPrivate Qt::WaylandClientPrivate Wayland::Client ) -qt6_generate_wayland_protocol_client_sources(QWaylandWlShellIntegrationPlugin +qt6_generate_wayland_protocol_client_sources(WlShellIntegration FILES ${CMAKE_CURRENT_SOURCE_DIR}/../../../3rdparty/protocol/wayland.xml ) -#### Keys ignored in scope 1:.:.:wl-shell.pro:: -# OTHER_FILES = "wl-shell.json" +#### Keys ignored in scope 2:.:.:wl-shell-integration.pro:: +# MODULE = "wl_shell_integration" ## Scopes: ##################################################################### -qt_internal_extend_target(QWaylandWlShellIntegrationPlugin CONDITION QT_FEATURE_xkbcommon +qt_internal_extend_target(WlShellIntegration CONDITION QT_FEATURE_xkbcommon LIBRARIES XKB::XKB ) +##################################################################### +## QWaylandWlShellIntegrationPlugin Plugin: +##################################################################### + +qt_internal_add_plugin(QWaylandWlShellIntegrationPlugin + OUTPUT_NAME wl-shell-plugin + TYPE wayland-shell-integration + SOURCES + main.cpp + PUBLIC_LIBRARIES + Qt::GuiPrivate + Qt::WaylandClientPrivate + Qt::WlShellIntegrationPrivate +) + +#### Keys ignored in scope 4:.:.:wl-shell-plugin.pro:: +# OTHER_FILES = "wl-shell.json" From 3e502ff8d9aac2d5caf67293151bd710da07d0fc Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Mon, 10 May 2021 00:02:44 +0100 Subject: [PATCH 0948/1507] Client: Make tst_nooutput more robust We had auto configure on, but also manually configured half of the configure event by hand. This patch changes it to all be manual Change-Id: Id130d71585c0d8a94107702e470de201fe1a189c Reviewed-by: Qt CI Bot Reviewed-by: Eskil Abrahamsen Blomfeldt --- tests/auto/wayland/nooutput/tst_nooutput.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/auto/wayland/nooutput/tst_nooutput.cpp b/tests/auto/wayland/nooutput/tst_nooutput.cpp index b80a8178033..788c1e8d915 100644 --- a/tests/auto/wayland/nooutput/tst_nooutput.cpp +++ b/tests/auto/wayland/nooutput/tst_nooutput.cpp @@ -37,7 +37,7 @@ public: NoOutputCompositor() { exec([this] { removeAll(); }); - m_config.autoConfigure = true; + m_config.autoConfigure = false; } }; @@ -68,6 +68,7 @@ void tst_nooutput::noScreens() exec([=] { xdgToplevel()->sendConfigure({0, 0}, {}); // Let the window decide the size + xdgSurface()->sendConfigure(nextSerial()); }); QTRY_VERIFY(window.isExposed()); From f3fcdc6bfdeb9fed7898722078bab7c31c344478 Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Wed, 5 May 2021 06:54:19 +0100 Subject: [PATCH 0949/1507] Simplify test cmake In each test we were recompiling the shared mock compositor. This led to a lot of difficult to maintain boiler plate as well as slowing down the build. This patch turns the shared component into an object library Change-Id: I2460d3fec312a348fe633ac271f994dd36d564c4 Reviewed-by: David Edmundson --- tests/auto/wayland/CMakeLists.txt | 2 + .../auto/wayland/datadevicev1/CMakeLists.txt | 23 +---------- .../auto/wayland/inputcontext/CMakeLists.txt | 23 +---------- tests/auto/wayland/nooutput/CMakeLists.txt | 23 +---------- tests/auto/wayland/output/CMakeLists.txt | 23 +---------- .../wayland/primaryselectionv1/CMakeLists.txt | 24 +----------- tests/auto/wayland/seatv4/CMakeLists.txt | 23 +---------- tests/auto/wayland/seatv5/CMakeLists.txt | 23 +---------- tests/auto/wayland/shared/CMakeLists.txt | 38 +++++++++++++++++++ tests/auto/wayland/surface/CMakeLists.txt | 23 +---------- tests/auto/wayland/tabletv2/CMakeLists.txt | 24 +----------- .../wayland/xdgdecorationv1/CMakeLists.txt | 24 +----------- tests/auto/wayland/xdgoutput/CMakeLists.txt | 23 +---------- tests/auto/wayland/xdgshell/CMakeLists.txt | 23 +---------- 14 files changed, 52 insertions(+), 267 deletions(-) create mode 100644 tests/auto/wayland/shared/CMakeLists.txt diff --git a/tests/auto/wayland/CMakeLists.txt b/tests/auto/wayland/CMakeLists.txt index 783546045da..ea6c4c1b215 100644 --- a/tests/auto/wayland/CMakeLists.txt +++ b/tests/auto/wayland/CMakeLists.txt @@ -1,5 +1,7 @@ # Generated from client.pro. +add_subdirectory(shared) + add_subdirectory(client) add_subdirectory(datadevicev1) add_subdirectory(fullscreenshellv1) diff --git a/tests/auto/wayland/datadevicev1/CMakeLists.txt b/tests/auto/wayland/datadevicev1/CMakeLists.txt index b2da63977f9..9f87eb99641 100644 --- a/tests/auto/wayland/datadevicev1/CMakeLists.txt +++ b/tests/auto/wayland/datadevicev1/CMakeLists.txt @@ -6,28 +6,7 @@ qt_internal_add_test(tst_datadevicev1 SOURCES - ../shared/corecompositor.cpp ../shared/corecompositor.h - ../shared/coreprotocol.cpp ../shared/coreprotocol.h - ../shared/datadevice.cpp ../shared/datadevice.h - ../shared/mockcompositor.cpp ../shared/mockcompositor.h - ../shared/textinput.cpp ../shared/textinput.h - ../shared/xdgoutputv1.cpp ../shared/xdgoutputv1.h - ../shared/xdgshell.cpp ../shared/xdgshell.h tst_datadevicev1.cpp - INCLUDE_DIRECTORIES - ../shared PUBLIC_LIBRARIES - Qt::Gui - Qt::OpenGL - Qt::WaylandClientPrivate - Wayland::Server - Threads::Threads # special case -) - -qt6_generate_wayland_protocol_server_sources(tst_datadevicev1 - FILES - ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/text-input-unstable-v2.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/wayland.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-output-unstable-v1.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-shell.xml + SharedClientTest ) diff --git a/tests/auto/wayland/inputcontext/CMakeLists.txt b/tests/auto/wayland/inputcontext/CMakeLists.txt index 1423c790c72..06ea08e019e 100644 --- a/tests/auto/wayland/inputcontext/CMakeLists.txt +++ b/tests/auto/wayland/inputcontext/CMakeLists.txt @@ -6,28 +6,7 @@ qt_internal_add_test(tst_inputcontext SOURCES - ../shared/corecompositor.cpp ../shared/corecompositor.h - ../shared/coreprotocol.cpp ../shared/coreprotocol.h - ../shared/datadevice.cpp ../shared/datadevice.h - ../shared/mockcompositor.cpp ../shared/mockcompositor.h - ../shared/textinput.cpp ../shared/textinput.h - ../shared/xdgoutputv1.cpp ../shared/xdgoutputv1.h - ../shared/xdgshell.cpp ../shared/xdgshell.h tst_inputcontext.cpp - INCLUDE_DIRECTORIES - ../shared PUBLIC_LIBRARIES - Qt::Gui - Qt::OpenGL - Qt::WaylandClientPrivate - Wayland::Server - Threads::Threads # special case -) - -qt6_generate_wayland_protocol_server_sources(tst_inputcontext - FILES - ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/text-input-unstable-v2.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/wayland.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-output-unstable-v1.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-shell.xml + SharedClientTest ) diff --git a/tests/auto/wayland/nooutput/CMakeLists.txt b/tests/auto/wayland/nooutput/CMakeLists.txt index b353d32466a..ab9dd3a6d22 100644 --- a/tests/auto/wayland/nooutput/CMakeLists.txt +++ b/tests/auto/wayland/nooutput/CMakeLists.txt @@ -6,28 +6,7 @@ qt_internal_add_test(tst_nooutput SOURCES - ../shared/corecompositor.cpp ../shared/corecompositor.h - ../shared/coreprotocol.cpp ../shared/coreprotocol.h - ../shared/datadevice.cpp ../shared/datadevice.h - ../shared/mockcompositor.cpp ../shared/mockcompositor.h - ../shared/textinput.cpp ../shared/textinput.h - ../shared/xdgoutputv1.cpp ../shared/xdgoutputv1.h - ../shared/xdgshell.cpp ../shared/xdgshell.h tst_nooutput.cpp - INCLUDE_DIRECTORIES - ../shared PUBLIC_LIBRARIES - Qt::Gui - Qt::OpenGL - Qt::WaylandClientPrivate - Wayland::Server - Threads::Threads # special case -) - -qt6_generate_wayland_protocol_server_sources(tst_nooutput - FILES - ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/text-input-unstable-v2.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/wayland.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-output-unstable-v1.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-shell.xml + SharedClientTest ) diff --git a/tests/auto/wayland/output/CMakeLists.txt b/tests/auto/wayland/output/CMakeLists.txt index acb1d53ebed..45b6be4fb67 100644 --- a/tests/auto/wayland/output/CMakeLists.txt +++ b/tests/auto/wayland/output/CMakeLists.txt @@ -6,28 +6,7 @@ qt_internal_add_test(tst_output SOURCES - ../shared/corecompositor.cpp ../shared/corecompositor.h - ../shared/coreprotocol.cpp ../shared/coreprotocol.h - ../shared/datadevice.cpp ../shared/datadevice.h - ../shared/mockcompositor.cpp ../shared/mockcompositor.h - ../shared/textinput.cpp ../shared/textinput.h - ../shared/xdgoutputv1.cpp ../shared/xdgoutputv1.h - ../shared/xdgshell.cpp ../shared/xdgshell.h tst_output.cpp - INCLUDE_DIRECTORIES - ../shared PUBLIC_LIBRARIES - Qt::Gui - Qt::OpenGL - Qt::WaylandClientPrivate - Wayland::Server - Threads::Threads # special case -) - -qt6_generate_wayland_protocol_server_sources(tst_output - FILES - ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/text-input-unstable-v2.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/wayland.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-output-unstable-v1.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-shell.xml + SharedClientTest ) diff --git a/tests/auto/wayland/primaryselectionv1/CMakeLists.txt b/tests/auto/wayland/primaryselectionv1/CMakeLists.txt index f3e592cac0e..c95a7fb1875 100644 --- a/tests/auto/wayland/primaryselectionv1/CMakeLists.txt +++ b/tests/auto/wayland/primaryselectionv1/CMakeLists.txt @@ -6,29 +6,7 @@ qt_internal_add_test(tst_primaryselectionv1 SOURCES - ../shared/corecompositor.cpp ../shared/corecompositor.h - ../shared/coreprotocol.cpp ../shared/coreprotocol.h - ../shared/datadevice.cpp ../shared/datadevice.h - ../shared/mockcompositor.cpp ../shared/mockcompositor.h - ../shared/textinput.cpp ../shared/textinput.h - ../shared/xdgoutputv1.cpp ../shared/xdgoutputv1.h - ../shared/xdgshell.cpp ../shared/xdgshell.h tst_primaryselectionv1.cpp - INCLUDE_DIRECTORIES - ../shared PUBLIC_LIBRARIES - Qt::Gui - Qt::OpenGL - Qt::WaylandClientPrivate - Wayland::Server - Threads::Threads # special case -) - -qt6_generate_wayland_protocol_server_sources(tst_primaryselectionv1 - FILES - ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/wp-primary-selection-unstable-v1.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/text-input-unstable-v2.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/wayland.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-output-unstable-v1.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-shell.xml + SharedClientTest ) diff --git a/tests/auto/wayland/seatv4/CMakeLists.txt b/tests/auto/wayland/seatv4/CMakeLists.txt index f4eb28b843f..31ea86b7ee1 100644 --- a/tests/auto/wayland/seatv4/CMakeLists.txt +++ b/tests/auto/wayland/seatv4/CMakeLists.txt @@ -6,30 +6,9 @@ qt_internal_add_test(tst_seatv4 SOURCES - ../shared/corecompositor.cpp ../shared/corecompositor.h - ../shared/coreprotocol.cpp ../shared/coreprotocol.h - ../shared/datadevice.cpp ../shared/datadevice.h - ../shared/mockcompositor.cpp ../shared/mockcompositor.h - ../shared/textinput.cpp ../shared/textinput.h - ../shared/xdgoutputv1.cpp ../shared/xdgoutputv1.h - ../shared/xdgshell.cpp ../shared/xdgshell.h tst_seatv4.cpp - INCLUDE_DIRECTORIES - ../shared PUBLIC_LIBRARIES - Qt::Gui - Qt::OpenGL - Qt::WaylandClientPrivate - Wayland::Server - Threads::Threads # special case -) - -qt6_generate_wayland_protocol_server_sources(tst_seatv4 - FILES - ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/text-input-unstable-v2.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/wayland.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-output-unstable-v1.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-shell.xml + SharedClientTest ) ## Scopes: diff --git a/tests/auto/wayland/seatv5/CMakeLists.txt b/tests/auto/wayland/seatv5/CMakeLists.txt index 7545d769efc..f48d8613787 100644 --- a/tests/auto/wayland/seatv5/CMakeLists.txt +++ b/tests/auto/wayland/seatv5/CMakeLists.txt @@ -6,28 +6,7 @@ qt_internal_add_test(tst_seatv5 SOURCES - ../shared/corecompositor.cpp ../shared/corecompositor.h - ../shared/coreprotocol.cpp ../shared/coreprotocol.h - ../shared/datadevice.cpp ../shared/datadevice.h - ../shared/mockcompositor.cpp ../shared/mockcompositor.h - ../shared/textinput.cpp ../shared/textinput.h - ../shared/xdgoutputv1.cpp ../shared/xdgoutputv1.h - ../shared/xdgshell.cpp ../shared/xdgshell.h tst_seatv5.cpp - INCLUDE_DIRECTORIES - ../shared PUBLIC_LIBRARIES - Qt::Gui - Qt::OpenGL - Qt::WaylandClientPrivate - Wayland::Server - Threads::Threads # special case -) - -qt6_generate_wayland_protocol_server_sources(tst_seatv5 - FILES - ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/text-input-unstable-v2.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/wayland.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-output-unstable-v1.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-shell.xml + SharedClientTest ) diff --git a/tests/auto/wayland/shared/CMakeLists.txt b/tests/auto/wayland/shared/CMakeLists.txt new file mode 100644 index 00000000000..c465ea1b559 --- /dev/null +++ b/tests/auto/wayland/shared/CMakeLists.txt @@ -0,0 +1,38 @@ +##################################################################### +##Client test shared components: +##################################################################### + +add_library(SharedClientTest + OBJECT + corecompositor.cpp corecompositor.h + coreprotocol.cpp coreprotocol.h + datadevice.cpp datadevice.h + mockcompositor.cpp mockcompositor.h + textinput.cpp textinput.h + xdgoutputv1.cpp xdgoutputv1.h + xdgshell.cpp xdgshell.h +) + +set_property(TARGET SharedClientTest PROPERTY AUTOMOC ON) + +qt6_generate_wayland_protocol_server_sources(SharedClientTest + FILES + ${PROJECT_SOURCE_DIR}/src/3rdparty/protocol/wp-primary-selection-unstable-v1.xml + ${PROJECT_SOURCE_DIR}/src/3rdparty/protocol/tablet-unstable-v2.xml + ${PROJECT_SOURCE_DIR}/src/3rdparty/protocol/text-input-unstable-v2.xml + ${PROJECT_SOURCE_DIR}/src/3rdparty/protocol/wayland.xml + ${PROJECT_SOURCE_DIR}/src/3rdparty/protocol/xdg-decoration-unstable-v1.xml + ${PROJECT_SOURCE_DIR}/src/3rdparty/protocol/xdg-output-unstable-v1.xml + ${PROJECT_SOURCE_DIR}/src/3rdparty/protocol/xdg-shell.xml +) + +target_link_libraries(SharedClientTest + PUBLIC + Qt::Gui + Qt::OpenGL + Qt::WaylandClientPrivate + Wayland::Server + Threads::Threads # special case +) + +target_include_directories(SharedClientTest PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}) diff --git a/tests/auto/wayland/surface/CMakeLists.txt b/tests/auto/wayland/surface/CMakeLists.txt index 0674f7de781..93cfb2fb0d2 100644 --- a/tests/auto/wayland/surface/CMakeLists.txt +++ b/tests/auto/wayland/surface/CMakeLists.txt @@ -6,28 +6,7 @@ qt_internal_add_test(tst_surface SOURCES - ../shared/corecompositor.cpp ../shared/corecompositor.h - ../shared/coreprotocol.cpp ../shared/coreprotocol.h - ../shared/datadevice.cpp ../shared/datadevice.h - ../shared/mockcompositor.cpp ../shared/mockcompositor.h - ../shared/textinput.cpp ../shared/textinput.h - ../shared/xdgoutputv1.cpp ../shared/xdgoutputv1.h - ../shared/xdgshell.cpp ../shared/xdgshell.h tst_surface.cpp - INCLUDE_DIRECTORIES - ../shared PUBLIC_LIBRARIES - Qt::Gui - Qt::OpenGL - Qt::WaylandClientPrivate - Wayland::Server - Threads::Threads # special case -) - -qt6_generate_wayland_protocol_server_sources(tst_surface - FILES - ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/text-input-unstable-v2.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/wayland.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-output-unstable-v1.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-shell.xml + SharedClientTest ) diff --git a/tests/auto/wayland/tabletv2/CMakeLists.txt b/tests/auto/wayland/tabletv2/CMakeLists.txt index 6d75072603e..5334b7a1e13 100644 --- a/tests/auto/wayland/tabletv2/CMakeLists.txt +++ b/tests/auto/wayland/tabletv2/CMakeLists.txt @@ -6,29 +6,7 @@ qt_internal_add_test(tst_tabletv2 SOURCES - ../shared/corecompositor.cpp ../shared/corecompositor.h - ../shared/coreprotocol.cpp ../shared/coreprotocol.h - ../shared/datadevice.cpp ../shared/datadevice.h - ../shared/mockcompositor.cpp ../shared/mockcompositor.h - ../shared/textinput.cpp ../shared/textinput.h - ../shared/xdgoutputv1.cpp ../shared/xdgoutputv1.h - ../shared/xdgshell.cpp ../shared/xdgshell.h tst_tabletv2.cpp - INCLUDE_DIRECTORIES - ../shared PUBLIC_LIBRARIES - Qt::Gui - Qt::OpenGL - Qt::WaylandClientPrivate - Wayland::Server - Threads::Threads # special case -) - -qt6_generate_wayland_protocol_server_sources(tst_tabletv2 - FILES - ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/tablet-unstable-v2.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/text-input-unstable-v2.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/wayland.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-output-unstable-v1.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-shell.xml + SharedClientTest ) diff --git a/tests/auto/wayland/xdgdecorationv1/CMakeLists.txt b/tests/auto/wayland/xdgdecorationv1/CMakeLists.txt index 8959be9820f..1fe7bc44d2d 100644 --- a/tests/auto/wayland/xdgdecorationv1/CMakeLists.txt +++ b/tests/auto/wayland/xdgdecorationv1/CMakeLists.txt @@ -6,29 +6,7 @@ qt_internal_add_test(tst_xdgdecorationv1 SOURCES - ../shared/corecompositor.cpp ../shared/corecompositor.h - ../shared/coreprotocol.cpp ../shared/coreprotocol.h - ../shared/datadevice.cpp ../shared/datadevice.h - ../shared/mockcompositor.cpp ../shared/mockcompositor.h - ../shared/textinput.cpp ../shared/textinput.h - ../shared/xdgoutputv1.cpp ../shared/xdgoutputv1.h - ../shared/xdgshell.cpp ../shared/xdgshell.h tst_xdgdecorationv1.cpp - INCLUDE_DIRECTORIES - ../shared PUBLIC_LIBRARIES - Qt::Gui - Qt::OpenGL - Qt::WaylandClientPrivate - Wayland::Server - Threads::Threads # special case -) - -qt6_generate_wayland_protocol_server_sources(tst_xdgdecorationv1 - FILES - ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/xdg-decoration-unstable-v1.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/text-input-unstable-v2.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/wayland.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-output-unstable-v1.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-shell.xml + SharedClientTest ) diff --git a/tests/auto/wayland/xdgoutput/CMakeLists.txt b/tests/auto/wayland/xdgoutput/CMakeLists.txt index 37dee4e4697..baaf226b7a4 100644 --- a/tests/auto/wayland/xdgoutput/CMakeLists.txt +++ b/tests/auto/wayland/xdgoutput/CMakeLists.txt @@ -6,28 +6,7 @@ qt_internal_add_test(tst_xdgoutput SOURCES - ../shared/corecompositor.cpp ../shared/corecompositor.h - ../shared/coreprotocol.cpp ../shared/coreprotocol.h - ../shared/datadevice.cpp ../shared/datadevice.h - ../shared/mockcompositor.cpp ../shared/mockcompositor.h - ../shared/textinput.cpp ../shared/textinput.h - ../shared/xdgoutputv1.cpp ../shared/xdgoutputv1.h - ../shared/xdgshell.cpp ../shared/xdgshell.h tst_xdgoutput.cpp - INCLUDE_DIRECTORIES - ../shared PUBLIC_LIBRARIES - Qt::Gui - Qt::OpenGL - Qt::WaylandClientPrivate - Wayland::Server - Threads::Threads # special case -) - -qt6_generate_wayland_protocol_server_sources(tst_xdgoutput - FILES - ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/text-input-unstable-v2.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/wayland.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-output-unstable-v1.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-shell.xml + SharedClientTest ) diff --git a/tests/auto/wayland/xdgshell/CMakeLists.txt b/tests/auto/wayland/xdgshell/CMakeLists.txt index 3b5cdfe83b6..ea34539d3f0 100644 --- a/tests/auto/wayland/xdgshell/CMakeLists.txt +++ b/tests/auto/wayland/xdgshell/CMakeLists.txt @@ -6,28 +6,7 @@ qt_internal_add_test(tst_xdgshell SOURCES - ../shared/corecompositor.cpp ../shared/corecompositor.h - ../shared/coreprotocol.cpp ../shared/coreprotocol.h - ../shared/datadevice.cpp ../shared/datadevice.h - ../shared/mockcompositor.cpp ../shared/mockcompositor.h - ../shared/textinput.cpp ../shared/textinput.h - ../shared/xdgoutputv1.cpp ../shared/xdgoutputv1.h - ../shared/xdgshell.cpp ../shared/xdgshell.h tst_xdgshell.cpp - INCLUDE_DIRECTORIES - ../shared PUBLIC_LIBRARIES - Qt::Gui - Qt::OpenGL - Qt::WaylandClientPrivate - Wayland::Server - Threads::Threads # special case -) - -qt6_generate_wayland_protocol_server_sources(tst_xdgshell - FILES - ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/text-input-unstable-v2.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/wayland.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-output-unstable-v1.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../shared/../../../../src/3rdparty/protocol/xdg-shell.xml + SharedClientTest ) From 09886401842c41db02cf45d5c3e27c6bff22128d Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Mon, 3 May 2021 23:01:53 +0100 Subject: [PATCH 0950/1507] Client: Set XdgShell size hints before the first commit propagateSizeHints is only called in QWindow we have platform window and minimumSizeHint is then sent. We also need to send existing hints when we create the shell window. Sending them when we apply configure is too late, we need these hints available for the compositor to correctly configure the window. Change-Id: I6cbb294b11db06ecd87535fa4816bb8ad34a29c6 Reviewed-by: Vlad Zahorodnii Reviewed-by: Aleix Pol Gonzalez --- .../plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp | 3 +-- tests/auto/wayland/xdgshell/tst_xdgshell.cpp | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp index af8bd926451..965bc261d9d 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp @@ -105,8 +105,6 @@ void QWaylandXdgSurface::Toplevel::applyConfigure() m_xdgSurface->m_window->resizeFromApplyConfigure(m_pending.size); } - m_xdgSurface->setSizeHints(); - m_applied = m_pending; qCDebug(lcQpaWayland) << "Applied pending xdg_toplevel configure event:" << m_applied.size << m_applied.states; } @@ -257,6 +255,7 @@ QWaylandXdgSurface::QWaylandXdgSurface(QWaylandXdgShell *shell, ::xdg_surface *s m_toplevel->set_parent(parentXdgSurface->m_toplevel->object()); } } + setSizeHints(); } QWaylandXdgSurface::~QWaylandXdgSurface() diff --git a/tests/auto/wayland/xdgshell/tst_xdgshell.cpp b/tests/auto/wayland/xdgshell/tst_xdgshell.cpp index 891bc0b28e3..7c6c3a5fa47 100644 --- a/tests/auto/wayland/xdgshell/tst_xdgshell.cpp +++ b/tests/auto/wayland/xdgshell/tst_xdgshell.cpp @@ -506,7 +506,7 @@ void tst_xdgshell::minMaxSize() window.show(); QCOMPOSITOR_TRY_VERIFY(xdgToplevel()); - exec([=] { xdgToplevel()->sendCompleteConfigure(); }); + // we don't roundtrip with our configuration the initial commit should be correct QCOMPOSITOR_TRY_COMPARE(xdgToplevel()->m_committed.minSize, QSize(100, 100)); QCOMPOSITOR_TRY_COMPARE(xdgToplevel()->m_committed.maxSize, QSize(1000, 1000)); From dd6ca292da2a4b9e09b1f35711eee8692a91c563 Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Thu, 6 May 2021 10:27:23 +0100 Subject: [PATCH 0951/1507] Port fullscreen shell autotest away from shared_old Change-Id: Ic6ef3b46fe6d6abf0f028389174fe4ac09dff60a Reviewed-by: Eskil Abrahamsen Blomfeldt --- .../wayland/fullscreenshellv1/CMakeLists.txt | 27 +-------- .../tst_fullscreenshellv1.cpp | 60 ++++--------------- tests/auto/wayland/shared/CMakeLists.txt | 2 + .../auto/wayland/shared/fullscreenshellv1.cpp | 47 +++++++++++++++ tests/auto/wayland/shared/fullscreenshellv1.h | 59 ++++++++++++++++++ tests/auto/wayland/shared/mockcompositor.cpp | 1 + tests/auto/wayland/shared/mockcompositor.h | 2 + 7 files changed, 123 insertions(+), 75 deletions(-) create mode 100644 tests/auto/wayland/shared/fullscreenshellv1.cpp create mode 100644 tests/auto/wayland/shared/fullscreenshellv1.h diff --git a/tests/auto/wayland/fullscreenshellv1/CMakeLists.txt b/tests/auto/wayland/fullscreenshellv1/CMakeLists.txt index 4a64b9e2872..4c9a9940613 100644 --- a/tests/auto/wayland/fullscreenshellv1/CMakeLists.txt +++ b/tests/auto/wayland/fullscreenshellv1/CMakeLists.txt @@ -6,32 +6,7 @@ qt_internal_add_test(tst_client_fullscreenshellv1 SOURCES - ../shared_old/mockcompositor.cpp ../shared_old/mockcompositor.h - ../shared_old/mockfullscreenshellv1.cpp ../shared_old/mockfullscreenshellv1.h - ../shared_old/mockinput.cpp ../shared_old/mockinput.h - ../shared_old/mockiviapplication.cpp ../shared_old/mockiviapplication.h - ../shared_old/mockoutput.cpp ../shared_old/mockoutput.h - ../shared_old/mockregion.cpp ../shared_old/mockregion.h - ../shared_old/mocksurface.cpp ../shared_old/mocksurface.h - ../shared_old/mockwlshell.cpp ../shared_old/mockwlshell.h tst_fullscreenshellv1.cpp - INCLUDE_DIRECTORIES - ../shared_old PUBLIC_LIBRARIES - Qt::CorePrivate - Qt::Gui - Qt::GuiPrivate - Qt::OpenGL - Qt::WaylandClientPrivate - Wayland::Client - Wayland::Server - Threads::Threads # special case -) - -qt6_generate_wayland_protocol_server_sources(tst_client_fullscreenshellv1 - FILES - ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/fullscreen-shell-unstable-v1.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/ivi-application.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/wayland.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/xdg-shell.xml + SharedClientTest ) diff --git a/tests/auto/wayland/fullscreenshellv1/tst_fullscreenshellv1.cpp b/tests/auto/wayland/fullscreenshellv1/tst_fullscreenshellv1.cpp index 55158474c3e..427287f1256 100644 --- a/tests/auto/wayland/fullscreenshellv1/tst_fullscreenshellv1.cpp +++ b/tests/auto/wayland/fullscreenshellv1/tst_fullscreenshellv1.cpp @@ -1,5 +1,6 @@ /**************************************************************************** ** +** Copyright (C) 2021 David Edmundson ** Copyright (C) 2018 Pier Luigi Fiorini ** Copyright (C) 2017 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ @@ -29,66 +30,31 @@ #include "mockcompositor.h" -#include +#include #include -static const QSize screenSize(1600, 1200); +using namespace MockCompositor; -class TestWindow : public QWindow -{ -public: - TestWindow() - { - setSurfaceType(QSurface::RasterSurface); - setGeometry(0, 0, 800, 600); - create(); - } -}; - -class tst_WaylandClientFullScreenShellV1 : public QObject +class tst_WaylandClientFullScreenShellV1 : public QObject, private DefaultCompositor { Q_OBJECT -public: - tst_WaylandClientFullScreenShellV1(MockCompositor *c) - : m_compositor(c) - { - QSocketNotifier *notifier = new QSocketNotifier(m_compositor->waylandFileDescriptor(), QSocketNotifier::Read, this); - connect(notifier, &QSocketNotifier::activated, this, &tst_WaylandClientFullScreenShellV1::processWaylandEvents); - // connect to the event dispatcher to make sure to flush out the outgoing message queue - connect(QCoreApplication::eventDispatcher(), &QAbstractEventDispatcher::awake, this, &tst_WaylandClientFullScreenShellV1::processWaylandEvents); - connect(QCoreApplication::eventDispatcher(), &QAbstractEventDispatcher::aboutToBlock, this, &tst_WaylandClientFullScreenShellV1::processWaylandEvents); - } - -public slots: - void processWaylandEvents() - { - m_compositor->processWaylandEvents(); - } - - void cleanup() - { - // make sure the surfaces from the last test are properly cleaned up - // and don't show up as false positives in the next test - QTRY_VERIFY(!m_compositor->fullScreenShellV1Surface()); - } private slots: void createDestroyWindow(); - -private: - MockCompositor *m_compositor = nullptr; }; void tst_WaylandClientFullScreenShellV1::createDestroyWindow() { - TestWindow window; + QRasterWindow window; + window.resize(800, 600); window.show(); - QTRY_VERIFY(m_compositor->fullScreenShellV1Surface()); + QCOMPOSITOR_TRY_VERIFY(fullScreenShellV1()->surfaces().count() == 1); + QCOMPOSITOR_VERIFY(surface(0)); window.destroy(); - QTRY_VERIFY(!m_compositor->fullScreenShellV1Surface()); + QCOMPOSITOR_TRY_VERIFY(!surface(0)); } int main(int argc, char **argv) @@ -99,13 +65,9 @@ int main(int argc, char **argv) setenv("QT_WAYLAND_SHELL_INTEGRATION", "fullscreen-shell-v1", 1); setenv("QT_WAYLAND_DISABLE_WINDOWDECORATION", "1", 1); // window decorations don't make much sense here - MockCompositor compositor; - compositor.setOutputMode(screenSize); - + tst_WaylandClientFullScreenShellV1 tc; QGuiApplication app(argc, argv); - compositor.applicationInitialized(); - - tst_WaylandClientFullScreenShellV1 tc(&compositor); + QTEST_SET_MAIN_SOURCE_PATH return QTest::qExec(&tc, argc, argv); } diff --git a/tests/auto/wayland/shared/CMakeLists.txt b/tests/auto/wayland/shared/CMakeLists.txt index c465ea1b559..530acf26425 100644 --- a/tests/auto/wayland/shared/CMakeLists.txt +++ b/tests/auto/wayland/shared/CMakeLists.txt @@ -7,6 +7,7 @@ add_library(SharedClientTest corecompositor.cpp corecompositor.h coreprotocol.cpp coreprotocol.h datadevice.cpp datadevice.h + fullscreenshellv1.cpp fullscreenshellv1.h mockcompositor.cpp mockcompositor.h textinput.cpp textinput.h xdgoutputv1.cpp xdgoutputv1.h @@ -17,6 +18,7 @@ set_property(TARGET SharedClientTest PROPERTY AUTOMOC ON) qt6_generate_wayland_protocol_server_sources(SharedClientTest FILES + ${PROJECT_SOURCE_DIR}/src/3rdparty/protocol/fullscreen-shell-unstable-v1.xml ${PROJECT_SOURCE_DIR}/src/3rdparty/protocol/wp-primary-selection-unstable-v1.xml ${PROJECT_SOURCE_DIR}/src/3rdparty/protocol/tablet-unstable-v2.xml ${PROJECT_SOURCE_DIR}/src/3rdparty/protocol/text-input-unstable-v2.xml diff --git a/tests/auto/wayland/shared/fullscreenshellv1.cpp b/tests/auto/wayland/shared/fullscreenshellv1.cpp new file mode 100644 index 00000000000..f97088d508d --- /dev/null +++ b/tests/auto/wayland/shared/fullscreenshellv1.cpp @@ -0,0 +1,47 @@ +/**************************************************************************** +** +** Copyright (C) 2021 David Edmundson +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "fullscreenshellv1.h" + +namespace MockCompositor { + +FullScreenShellV1::FullScreenShellV1(CoreCompositor *compositor) +{ + init(compositor->m_display, 1); +} + +void FullScreenShellV1::zwp_fullscreen_shell_v1_present_surface(Resource *resource, struct ::wl_resource *surface, uint32_t method, struct ::wl_resource *output) +{ + Q_UNUSED(resource); + Q_UNUSED(method); + Q_UNUSED(output); + + m_surfaces.append(fromResource(surface)); +} + +} // namespace MockCompositor diff --git a/tests/auto/wayland/shared/fullscreenshellv1.h b/tests/auto/wayland/shared/fullscreenshellv1.h new file mode 100644 index 00000000000..f5bdc8c74c4 --- /dev/null +++ b/tests/auto/wayland/shared/fullscreenshellv1.h @@ -0,0 +1,59 @@ +/**************************************************************************** +** +** Copyright (C) 2021 David Edmundson +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef MOCKCOMPOSITOR_FULLSCREENSHELLV1_H +#define MOCKCOMPOSITOR_FULLSCREENSHELLV1_H + +#include "coreprotocol.h" +#include + +#include + +namespace MockCompositor { + +class Surface; +class FullScreenShellV1; + +class FullScreenShellV1 : public Global, public QtWaylandServer::zwp_fullscreen_shell_v1 +{ + Q_OBJECT +public: + explicit FullScreenShellV1(CoreCompositor *compositor); + + QList surfaces() const { return m_surfaces; } + +protected: + void zwp_fullscreen_shell_v1_present_surface(Resource *resource, struct ::wl_resource *surface, uint32_t method, struct ::wl_resource *output) override; + +private: + QList m_surfaces; +}; + +} // namespace MockCompositor + +#endif // MOCKCOMPOSITOR_FULLSCREENSHELLV1_H diff --git a/tests/auto/wayland/shared/mockcompositor.cpp b/tests/auto/wayland/shared/mockcompositor.cpp index dca9dac49ae..c958e6e8182 100644 --- a/tests/auto/wayland/shared/mockcompositor.cpp +++ b/tests/auto/wayland/shared/mockcompositor.cpp @@ -44,6 +44,7 @@ DefaultCompositor::DefaultCompositor() add(Seat::capability_pointer | Seat::capability_keyboard | Seat::capability_touch); add(); add(); + add(); // TODO: other shells, viewporter, xdgoutput etc QObject::connect(get(), &WlCompositor::surfaceCreated, [&] (Surface *surface){ diff --git a/tests/auto/wayland/shared/mockcompositor.h b/tests/auto/wayland/shared/mockcompositor.h index 485816178f9..878560a243f 100644 --- a/tests/auto/wayland/shared/mockcompositor.h +++ b/tests/auto/wayland/shared/mockcompositor.h @@ -33,6 +33,7 @@ #include "coreprotocol.h" #include "datadevice.h" #include "xdgshell.h" +#include "fullscreenshellv1.h" #include @@ -64,6 +65,7 @@ public: Touch *touch() { auto *seat = get(); Q_ASSERT(seat); return seat->m_touch; } Surface *cursorSurface() { auto *p = pointer(); return p ? p->cursorSurface() : nullptr; } Keyboard *keyboard() { auto *seat = get(); Q_ASSERT(seat); return seat->m_keyboard; } + FullScreenShellV1 *fullScreenShellV1() {return get();}; uint sendXdgShellPing(); void xdgPingAndWaitForPong(); // Things that can be changed run-time without confusing the client (i.e. don't require separate tests) From 6a244c5e13a4962d0cc95b47bcb85553cb877ea2 Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Wed, 5 May 2021 23:45:03 +0100 Subject: [PATCH 0952/1507] Port IVI Application test from shared_old Change-Id: I65fbe66fe75fe4372852deadefea796576860d67 Reviewed-by: Eskil Abrahamsen Blomfeldt --- tests/auto/wayland/shared/CMakeLists.txt | 2 ++ tests/auto/wayland/shared/mockcompositor.cpp | 3 +++ tests/auto/wayland/shared/mockcompositor.h | 5 ++++- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/tests/auto/wayland/shared/CMakeLists.txt b/tests/auto/wayland/shared/CMakeLists.txt index 530acf26425..6116688c36e 100644 --- a/tests/auto/wayland/shared/CMakeLists.txt +++ b/tests/auto/wayland/shared/CMakeLists.txt @@ -8,6 +8,7 @@ add_library(SharedClientTest coreprotocol.cpp coreprotocol.h datadevice.cpp datadevice.h fullscreenshellv1.cpp fullscreenshellv1.h + iviapplication.cpp iviapplication.h mockcompositor.cpp mockcompositor.h textinput.cpp textinput.h xdgoutputv1.cpp xdgoutputv1.h @@ -19,6 +20,7 @@ set_property(TARGET SharedClientTest PROPERTY AUTOMOC ON) qt6_generate_wayland_protocol_server_sources(SharedClientTest FILES ${PROJECT_SOURCE_DIR}/src/3rdparty/protocol/fullscreen-shell-unstable-v1.xml + ${PROJECT_SOURCE_DIR}/src/3rdparty/protocol/ivi-application.xml ${PROJECT_SOURCE_DIR}/src/3rdparty/protocol/wp-primary-selection-unstable-v1.xml ${PROJECT_SOURCE_DIR}/src/3rdparty/protocol/tablet-unstable-v2.xml ${PROJECT_SOURCE_DIR}/src/3rdparty/protocol/text-input-unstable-v2.xml diff --git a/tests/auto/wayland/shared/mockcompositor.cpp b/tests/auto/wayland/shared/mockcompositor.cpp index c958e6e8182..62fa44f0e8b 100644 --- a/tests/auto/wayland/shared/mockcompositor.cpp +++ b/tests/auto/wayland/shared/mockcompositor.cpp @@ -1,5 +1,6 @@ /**************************************************************************** ** +** Copyright (C) 2021 David Edmundson ** Copyright (C) 2018 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** @@ -45,6 +46,8 @@ DefaultCompositor::DefaultCompositor() add(); add(); add(); + add(); + // TODO: other shells, viewporter, xdgoutput etc QObject::connect(get(), &WlCompositor::surfaceCreated, [&] (Surface *surface){ diff --git a/tests/auto/wayland/shared/mockcompositor.h b/tests/auto/wayland/shared/mockcompositor.h index 878560a243f..44952a0857c 100644 --- a/tests/auto/wayland/shared/mockcompositor.h +++ b/tests/auto/wayland/shared/mockcompositor.h @@ -1,5 +1,6 @@ /**************************************************************************** ** +** Copyright (C) 2021 David Edmundson ** Copyright (C) 2018 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** @@ -32,8 +33,9 @@ #include "corecompositor.h" #include "coreprotocol.h" #include "datadevice.h" -#include "xdgshell.h" #include "fullscreenshellv1.h" +#include "iviapplication.h" +#include "xdgshell.h" #include @@ -66,6 +68,7 @@ public: Surface *cursorSurface() { auto *p = pointer(); return p ? p->cursorSurface() : nullptr; } Keyboard *keyboard() { auto *seat = get(); Q_ASSERT(seat); return seat->m_keyboard; } FullScreenShellV1 *fullScreenShellV1() {return get();}; + IviSurface *iviSurface(int i = 0) { return get()->m_iviSurfaces.value(i, nullptr); } uint sendXdgShellPing(); void xdgPingAndWaitForPong(); // Things that can be changed run-time without confusing the client (i.e. don't require separate tests) From 703af489cf429a73d4a1ad05d547ca86cae3e92a Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Wed, 5 May 2021 20:49:26 +0300 Subject: [PATCH 0953/1507] Client: Announce an output after receiving more complete state Output initialization is not atomic, meaning that the compositor may process a wl_output bind request in one event loop cycle, and the xdg_output_manager.get_xdg_output in another event loop cycle. This means that xdg_output properties may arrive in another wl_output done frame. Prior to xdg-output v3, that wasn't an issue because the compositor is required to send an xdg_output.done event after sending xdg_output properties. Starting with v3, the compositor may choose not to send an xdg_output.done event after sending xdg_output properties. Therefore, as is, QtWayland may announce an output with bad logical geometry or even worse without name assigned by the compositor. Unfortunately, that breaks applications such as plasmashell. Plasma uses output names as a criterion to determine what kind of contents should be displayed on a particular output. In order to fix the initialization sequence, this change makes every QWaylandScreen track processed events. After all required events have been received, the screen can be announced to the rest of Qt. Change-Id: If5da747edd7af277ec1364cbea105c6994f47402 Reviewed-by: David Edmundson --- .../platforms/wayland/qwaylandscreen.cpp | 32 +++++++++++++------ .../platforms/wayland/qwaylandscreen_p.h | 10 ++++-- 2 files changed, 31 insertions(+), 11 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandscreen.cpp b/src/plugins/platforms/wayland/qwaylandscreen.cpp index 40a49d88459..293e8e800a2 100644 --- a/src/plugins/platforms/wayland/qwaylandscreen.cpp +++ b/src/plugins/platforms/wayland/qwaylandscreen.cpp @@ -71,7 +71,7 @@ QWaylandScreen::QWaylandScreen(QWaylandDisplay *waylandDisplay, int version, uin qCWarning(lcQpaWayland) << "wl_output done event not supported by compositor," << "QScreen may not work correctly"; mWaylandDisplay->forceRoundTrip(); // Give the compositor a chance to send geometry etc. - mOutputDone = true; // Fake the done event + mProcessedEvents |= OutputDoneEvent; // Fake the done event maybeInitialize(); } } @@ -82,14 +82,25 @@ QWaylandScreen::~QWaylandScreen() zxdg_output_v1::destroy(); } +uint QWaylandScreen::requiredEvents() const +{ + uint ret = OutputDoneEvent; + + if (mWaylandDisplay->xdgOutputManager()) { + ret |= XdgOutputNameEvent; + + if (mWaylandDisplay->xdgOutputManager()->version() < 3) + ret |= XdgOutputDoneEvent; + } + return ret; +} + void QWaylandScreen::maybeInitialize() { Q_ASSERT(!mInitialized); - if (!mOutputDone) - return; - - if (mWaylandDisplay->xdgOutputManager() && !mXdgOutputDone) + const uint requiredEvents = this->requiredEvents(); + if ((mProcessedEvents & requiredEvents) != requiredEvents) return; mInitialized = true; @@ -265,9 +276,8 @@ void QWaylandScreen::output_scale(int32_t factor) void QWaylandScreen::output_done() { - mOutputDone = true; - if (zxdg_output_v1::isInitialized() && mWaylandDisplay->xdgOutputManager()->version() >= 3) - mXdgOutputDone = true; + mProcessedEvents |= OutputDoneEvent; + if (mInitialized) { updateOutputProperties(); if (zxdg_output_v1::isInitialized()) @@ -328,7 +338,7 @@ void QWaylandScreen::zxdg_output_v1_done() if (Q_UNLIKELY(mWaylandDisplay->xdgOutputManager()->version() >= 3)) qWarning(lcQpaWayland) << "zxdg_output_v1.done received on version 3 or newer, this is most likely a bug in the compositor"; - mXdgOutputDone = true; + mProcessedEvents |= XdgOutputDoneEvent; if (mInitialized) updateXdgOutputProperties(); else @@ -337,7 +347,11 @@ void QWaylandScreen::zxdg_output_v1_done() void QWaylandScreen::zxdg_output_v1_name(const QString &name) { + if (Q_UNLIKELY(mInitialized)) + qWarning(lcQpaWayland) << "zxdg_output_v1.name received after output has been initialized, this is most likely a bug in the compositor"; + mOutputName = name; + mProcessedEvents |= XdgOutputNameEvent; } void QWaylandScreen::updateXdgOutputProperties() diff --git a/src/plugins/platforms/wayland/qwaylandscreen_p.h b/src/plugins/platforms/wayland/qwaylandscreen_p.h index fc30a482a05..edd8f3a7a83 100644 --- a/src/plugins/platforms/wayland/qwaylandscreen_p.h +++ b/src/plugins/platforms/wayland/qwaylandscreen_p.h @@ -111,6 +111,13 @@ public: static QWaylandScreen *fromWlOutput(::wl_output *output); protected: + enum Event : uint { + XdgOutputDoneEvent = 0x1, + OutputDoneEvent = 0x2, + XdgOutputNameEvent = 0x4, + }; + uint requiredEvents() const; + void output_mode(uint32_t flags, int width, int height, int refresh) override; void output_geometry(int32_t x, int32_t y, int32_t width, int32_t height, @@ -143,8 +150,7 @@ protected: QSize mPhysicalSize; QString mOutputName; Qt::ScreenOrientation m_orientation = Qt::PrimaryOrientation; - bool mOutputDone = false; - bool mXdgOutputDone = false; + uint mProcessedEvents = 0; bool mInitialized = false; }; From fdd4f1c92fb12e6f93004656716f226719d88972 Mon Sep 17 00:00:00 2001 From: Albert Astals Cid Date: Mon, 10 May 2021 14:38:49 +0200 Subject: [PATCH 0954/1507] Include locale.h for setlocale/LC_CTYPE Pick-to: 5.15 Change-Id: Iced32a31a63cec71008549c1e0961d59ffc45a37 Reviewed-by: Aleix Pol Gonzalez --- src/plugins/platforms/wayland/qwaylandinputcontext.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/plugins/platforms/wayland/qwaylandinputcontext.cpp b/src/plugins/platforms/wayland/qwaylandinputcontext.cpp index cbf63cde82c..7262a6a4b14 100644 --- a/src/plugins/platforms/wayland/qwaylandinputcontext.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputcontext.cpp @@ -51,6 +51,10 @@ #include "qwaylandinputmethodeventbuilder_p.h" #include "qwaylandwindow_p.h" +#if QT_CONFIG(xkbcommon) +#include +#endif + QT_BEGIN_NAMESPACE Q_LOGGING_CATEGORY(qLcQpaInputMethods, "qt.qpa.input.methods") From ae254180abe28a070d2042f3a887c66594e8988c Mon Sep 17 00:00:00 2001 From: Jan Grulich Date: Tue, 23 Mar 2021 16:03:22 +0100 Subject: [PATCH 0955/1507] Client: expose toplevel window state QWaylandWindow has only basic information about window state, like if it's active or maximized, but it has no information about tiling, which can be useful for client-side decorations. We also need to bump version of xdg-shell protocol we support, because additional states are not in the version currently supported by QtWayland. It shouldn't be a problem to increase the version as the new version adds just these additional window states. Change-Id: I4c46516d9c7296c69ea51a022b3bdb4ca06bef8d Reviewed-by: David Edmundson --- .../xdg-shell/qwaylandxdgshell.cpp | 16 +++++++++++++++- .../xdg-shell/qwaylandxdgshell_p.h | 3 ++- src/plugins/platforms/wayland/qwaylandwindow.cpp | 15 +++++++++++++++ src/plugins/platforms/wayland/qwaylandwindow_p.h | 16 ++++++++++++++++ 4 files changed, 48 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp index 965bc261d9d..5d9a21f81b2 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp @@ -94,6 +94,7 @@ void QWaylandXdgSurface::Toplevel::applyConfigure() // TODO: none of the other plugins send WindowActive either, but is it on purpose? Qt::WindowStates statesWithoutActive = m_pending.states & ~Qt::WindowActive; + m_xdgSurface->m_window->handleToplevelWindowTilingStatesChanged(m_toplevelStates); m_xdgSurface->m_window->handleWindowStatesChanged(statesWithoutActive); if (m_pending.size.isEmpty()) { @@ -126,6 +127,7 @@ void QWaylandXdgSurface::Toplevel::xdg_toplevel_configure(int32_t width, int32_t size_t numStates = states->size / sizeof(uint32_t); m_pending.states = Qt::WindowNoState; + m_toplevelStates = QWaylandWindow::WindowNoState; for (size_t i = 0; i < numStates; i++) { switch (xdgStates[i]) { @@ -138,6 +140,18 @@ void QWaylandXdgSurface::Toplevel::xdg_toplevel_configure(int32_t width, int32_t case XDG_TOPLEVEL_STATE_FULLSCREEN: m_pending.states |= Qt::WindowFullScreen; break; + case XDG_TOPLEVEL_STATE_TILED_LEFT: + m_toplevelStates |= QWaylandWindow::WindowTiledLeft; + break; + case XDG_TOPLEVEL_STATE_TILED_RIGHT: + m_toplevelStates |= QWaylandWindow::WindowTiledRight; + break; + case XDG_TOPLEVEL_STATE_TILED_TOP: + m_toplevelStates |= QWaylandWindow::WindowTiledTop; + break; + case XDG_TOPLEVEL_STATE_TILED_BOTTOM: + m_toplevelStates |= QWaylandWindow::WindowTiledBottom; + break; default: break; } @@ -469,7 +483,7 @@ void QWaylandXdgSurface::xdg_surface_configure(uint32_t serial) } QWaylandXdgShell::QWaylandXdgShell(QWaylandDisplay *display, uint32_t id, uint32_t availableVersion) - : QtWayland::xdg_wm_base(display->wl_registry(), id, qMin(availableVersion, 1u)) + : QtWayland::xdg_wm_base(display->wl_registry(), id, qMin(availableVersion, 2u)) , m_display(display) { display->addRegistryListener(&QWaylandXdgShell::handleRegistryGlobal, this); diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h index 5aeec2eb910..e3a90c547e9 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h @@ -58,6 +58,7 @@ #include #include +#include #include #include @@ -69,7 +70,6 @@ class QWindow; namespace QtWaylandClient { class QWaylandDisplay; -class QWaylandWindow; class QWaylandInputDevice; class QWaylandXdgShell; @@ -125,6 +125,7 @@ private: QSize size = {0, 0}; Qt::WindowStates states = Qt::WindowNoState; } m_pending, m_applied; + QWaylandWindow::ToplevelWindowTilingStates m_toplevelStates = QWaylandWindow::WindowNoState; QSize m_normalSize; QWaylandXdgSurface *m_xdgSurface = nullptr; diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index c35ccab15b7..65a91497639 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -1107,6 +1107,21 @@ bool QWaylandWindow::setMouseGrabEnabled(bool grab) return true; } +QWaylandWindow::ToplevelWindowTilingStates QWaylandWindow::toplevelWindowTilingStates() const +{ + return mLastReportedToplevelWindowTilingStates; +} + +void QWaylandWindow::handleToplevelWindowTilingStatesChanged(ToplevelWindowTilingStates states) +{ + mLastReportedToplevelWindowTilingStates = states; +} + +Qt::WindowStates QWaylandWindow::windowStates() const +{ + return mLastReportedWindowStates; +} + void QWaylandWindow::handleWindowStatesChanged(Qt::WindowStates states) { createDecoration(); diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index 5f134568b39..1d743f4e4a3 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -95,6 +95,15 @@ public: Vulkan }; + enum ToplevelWindowTilingState { + WindowNoState = 0, + WindowTiledLeft = 1, + WindowTiledRight = 2, + WindowTiledTop = 4, + WindowTiledBottom = 8 + }; + Q_DECLARE_FLAGS(ToplevelWindowTilingStates, ToplevelWindowTilingState) + QWaylandWindow(QWindow *window, QWaylandDisplay *display); ~QWaylandWindow() override; @@ -145,6 +154,10 @@ public: void handleContentOrientationChange(Qt::ScreenOrientation orientation) override; void setOrientationMask(Qt::ScreenOrientations mask); + ToplevelWindowTilingStates toplevelWindowTilingStates() const; + void handleToplevelWindowTilingStatesChanged(ToplevelWindowTilingStates states); + + Qt::WindowStates windowStates() const; void setWindowState(Qt::WindowStates states) override; void setWindowFlags(Qt::WindowFlags flags) override; void handleWindowStatesChanged(Qt::WindowStates states); @@ -260,6 +273,7 @@ protected: QRegion mMask; QRegion mOpaqueArea; Qt::WindowStates mLastReportedWindowStates = Qt::WindowNoState; + ToplevelWindowTilingStates mLastReportedToplevelWindowTilingStates = WindowNoState; QWaylandShmBackingStore *mBackingStore = nullptr; QWaylandBuffer *mQueuedBuffer = nullptr; @@ -295,6 +309,8 @@ private: friend class QWaylandSubSurface; }; +Q_DECLARE_OPERATORS_FOR_FLAGS(QWaylandWindow::ToplevelWindowTilingStates) + inline QIcon QWaylandWindow::windowIcon() const { return mWindowIcon; From 5e1bff9b9953a50c522c2cb2268728f2009b536c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kai=20K=C3=B6hne?= Date: Tue, 30 Mar 2021 14:04:35 +0200 Subject: [PATCH 0956/1507] Move qtwaylandscanner to libexec This requires 7c7fda3a7e61f23 from qtbase Fixes: QTBUG-93776 Task-number: QTBUG-88791 Change-Id: Ic7e0be2273739555593ada53d2c855fd4c37fa38 Reviewed-by: Joerg Bornemann --- src/tools/qtwaylandscanner/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/src/tools/qtwaylandscanner/CMakeLists.txt b/src/tools/qtwaylandscanner/CMakeLists.txt index d18710b4232..c7b10c2b3e5 100644 --- a/src/tools/qtwaylandscanner/CMakeLists.txt +++ b/src/tools/qtwaylandscanner/CMakeLists.txt @@ -7,6 +7,7 @@ qt_get_tool_target_name(target_name qtwaylandscanner) qt_internal_add_tool(${target_name} TOOLS_TARGET WaylandScanner # special case + INSTALL_DIR "${INSTALL_LIBEXECDIR}" SOURCES qtwaylandscanner.cpp ) From 0ff3bf30d6aefaef83148440e2c4c350c9e6ed7a Mon Sep 17 00:00:00 2001 From: Qt Submodule Update Bot Date: Thu, 13 May 2021 00:13:35 +0300 Subject: [PATCH 0957/1507] Update dependencies on 'dev' in qt/qtwayland Change-Id: I445985530db8653f4dca46b59eea06b01bfd2878 Reviewed-by: Qt Submodule Update Bot From dbcc603faf6784b4b21f9d0e0d0fa3d69e3d524c Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Fri, 14 May 2021 13:23:24 +0100 Subject: [PATCH 0958/1507] Client: Disconnect registry listener on destruction If a display outlives a QWaylandClientExtension and a new global is announced we end up delivering an event to a now deleted extension which will crash. Change-Id: Idc0de40be61a2f7627ab4963e1fe29b22fbf3f04 Reviewed-by: Aleix Pol Gonzalez --- .../platforms/wayland/global/qwaylandclientextension.cpp | 7 +++++++ .../platforms/wayland/global/qwaylandclientextension.h | 1 + 2 files changed, 8 insertions(+) diff --git a/src/plugins/platforms/wayland/global/qwaylandclientextension.cpp b/src/plugins/platforms/wayland/global/qwaylandclientextension.cpp index a0d35a15fb3..f0bc950ce17 100644 --- a/src/plugins/platforms/wayland/global/qwaylandclientextension.cpp +++ b/src/plugins/platforms/wayland/global/qwaylandclientextension.cpp @@ -91,6 +91,13 @@ QWaylandClientExtension::QWaylandClientExtension(const int ver) QMetaObject::invokeMethod(this, "initialize", Qt::QueuedConnection); } +QWaylandClientExtension::~QWaylandClientExtension() +{ + Q_D(QWaylandClientExtension); + if (d->registered && !QCoreApplication::closingDown()) + d->waylandIntegration->display()->removeListener(&QWaylandClientExtensionPrivate::handleRegistryGlobal, this); +} + QtWaylandClient::QWaylandIntegration *QWaylandClientExtension::integration() const { Q_D(const QWaylandClientExtension); diff --git a/src/plugins/platforms/wayland/global/qwaylandclientextension.h b/src/plugins/platforms/wayland/global/qwaylandclientextension.h index 014edce1d69..350e32a42f3 100644 --- a/src/plugins/platforms/wayland/global/qwaylandclientextension.h +++ b/src/plugins/platforms/wayland/global/qwaylandclientextension.h @@ -63,6 +63,7 @@ class Q_WAYLAND_CLIENT_EXPORT QWaylandClientExtension : public QObject Q_PROPERTY(bool active READ isActive NOTIFY activeChanged) public: QWaylandClientExtension(const int version); + ~QWaylandClientExtension(); QtWaylandClient::QWaylandIntegration *integration() const; int version() const; From 06906e0d1163ed84bbdf5b9d67509e19e0fbfa01 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Thu, 22 Apr 2021 08:42:33 +0200 Subject: [PATCH 0959/1507] client: Gracefully handle shutdown and window hiding When a window is hidden or destroyed, the render thread may already be rendering. We need to properly read-lock the surface pointer when it is in use and exit when it becomes null. Note that there is also a potential crash in the Mesa GL driver where it keeps a proxy to the wl_surface, so if we delete this while we are still rendering, it can crash inside the driver. This is not addressed by this patch, and has not been reproduced on any other drivers so far. [ChangeLog][Client] Fixed a crash that could happen when hiding or closing windows while Qt Quick was actively rendering on a different thread. Pick-to: 6.0 6.1 5.15 Fixes: QTBUG-91264 Fixes: QTBUG-90037 Task-number: QTBUG-92249 Change-Id: I029b123b83c58740321e8b90a463ced748d8bcf4 Reviewed-by: Laszlo Agocs Reviewed-by: David Edmundson --- .../platforms/wayland/qwaylandwindow.cpp | 20 +++++++++++++++++-- .../platforms/wayland/qwaylandwindow_p.h | 2 +- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 65a91497639..62690fc6f9b 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -429,6 +429,7 @@ void QWaylandWindow::closePopups(QWaylandWindow *parent) QPlatformScreen *QWaylandWindow::calculateScreenFromSurfaceEvents() const { + QReadLocker lock(&mSurfaceLock); if (mSurface) { if (auto *screen = mSurface->oldestEnteredScreen()) return screen; @@ -482,6 +483,7 @@ void QWaylandWindow::setMask(const QRegion &mask) mMask = mask; + QReadLocker locker(&mSurfaceLock); if (!mSurface) return; @@ -567,6 +569,10 @@ void QWaylandWindow::sendRecursiveExposeEvent() void QWaylandWindow::attach(QWaylandBuffer *buffer, int x, int y) { + QReadLocker locker(&mSurfaceLock); + if (mSurface == nullptr) + return; + if (buffer) { Q_ASSERT(!buffer->committed()); handleUpdate(); @@ -586,6 +592,10 @@ void QWaylandWindow::attachOffset(QWaylandBuffer *buffer) void QWaylandWindow::damage(const QRect &rect) { + QReadLocker locker(&mSurfaceLock); + if (mSurface == nullptr) + return; + const qreal s = scale(); if (mSurface->version() >= 4) mSurface->damage_buffer(qFloor(s * rect.x()), qFloor(s * rect.y()), qCeil(s * rect.width()), qCeil(s * rect.height())); @@ -620,6 +630,8 @@ void QWaylandWindow::commit(QWaylandBuffer *buffer, const QRegion &damage) qCDebug(lcWaylandBackingstore) << "Buffer already committed, ignoring."; return; } + + QReadLocker locker(&mSurfaceLock); if (!mSurface) return; @@ -639,7 +651,9 @@ void QWaylandWindow::commit(QWaylandBuffer *buffer, const QRegion &damage) void QWaylandWindow::commit() { - mSurface->commit(); + QReadLocker locker(&mSurfaceLock); + if (mSurface != nullptr) + mSurface->commit(); } const wl_callback_listener QWaylandWindow::callbackListener = { @@ -736,6 +750,7 @@ QPointF QWaylandWindow::mapFromWlSurface(const QPointF &surfacePosition) const wl_surface *QWaylandWindow::wlSurface() { + QReadLocker locker(&mSurfaceLock); return mSurface ? mSurface->object() : nullptr; } @@ -760,7 +775,8 @@ QWaylandScreen *QWaylandWindow::waylandScreen() const void QWaylandWindow::handleContentOrientationChange(Qt::ScreenOrientation orientation) { - if (mSurface->version() < 2) + QReadLocker locker(&mSurfaceLock); + if (mSurface == nullptr || mSurface->version() < 2) return; wl_output_transform transform; diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index 1d743f4e4a3..314294fcfc6 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -304,7 +304,7 @@ private: static QWaylandWindow *mMouseGrab; - QReadWriteLock mSurfaceLock; + mutable QReadWriteLock mSurfaceLock; friend class QWaylandSubSurface; }; From ac704a5b90a40b2fa9eed6cf4f7c5fd3e88f0dee Mon Sep 17 00:00:00 2001 From: Povilas Kanapickas Date: Mon, 18 Jan 2021 15:58:49 +0200 Subject: [PATCH 0960/1507] Add protocol for pointer-gestures-unstable-v1 Task-number: QTBUG-92098 Change-Id: I3a46fcbe463f19521e6a3b0fc2d6c30e3ac93112 Reviewed-by: Shawn Rutledge --- .../pointer-gestures-unstable-v1.xml | 186 ++++++++++++++++++ .../wayland/protocols/qt_attribution.json | 17 ++ src/plugins/platforms/wayland/CMakeLists.txt | 1 + 3 files changed, 204 insertions(+) create mode 100644 src/3rdparty/wayland/protocols/pointer-gestures-unstable-v1.xml diff --git a/src/3rdparty/wayland/protocols/pointer-gestures-unstable-v1.xml b/src/3rdparty/wayland/protocols/pointer-gestures-unstable-v1.xml new file mode 100644 index 00000000000..59502ac1161 --- /dev/null +++ b/src/3rdparty/wayland/protocols/pointer-gestures-unstable-v1.xml @@ -0,0 +1,186 @@ + + + + + + A global interface to provide semantic touchpad gestures for a given + pointer. + + Two gestures are currently supported: swipe and zoom/rotate. + All gestures follow a three-stage cycle: begin, update, end and + are identified by a unique id. + + Warning! The protocol described in this file is experimental and + backward incompatible changes may be made. Backward compatible changes + may be added together with the corresponding interface version bump. + Backward incompatible changes are done by bumping the version number in + the protocol and interface names and resetting the interface version. + Once the protocol is to be declared stable, the 'z' prefix and the + version number in the protocol and interface names are removed and the + interface version number is reset. + + + + + Create a swipe gesture object. See the + wl_pointer_gesture_swipe interface for details. + + + + + + + + Create a pinch gesture object. See the + wl_pointer_gesture_pinch interface for details. + + + + + + + + + + Destroy the pointer gesture object. Swipe and pinch objects created via this + gesture object remain valid. + + + + + + + A swipe gesture object notifies a client about a multi-finger swipe + gesture detected on an indirect input device such as a touchpad. + The gesture is usually initiated by multiple fingers moving in the + same direction but once initiated the direction may change. + The precise conditions of when such a gesture is detected are + implementation-dependent. + + A gesture consists of three stages: begin, update (optional) and end. + There cannot be multiple simultaneous pinch or swipe gestures on a + same pointer/seat, how compositors prevent these situations is + implementation-dependent. + + A gesture may be cancelled by the compositor or the hardware. + Clients should not consider performing permanent or irreversible + actions until the end of a gesture has been received. + + + + + + + + + This event is sent when a multi-finger swipe gesture is detected + on the device. + + + + + + + + + + This event is sent when a multi-finger swipe gesture changes the + position of the logical center. + + The dx and dy coordinates are relative coordinates of the logical + center of the gesture compared to the previous event. + + + + + + + + + This event is sent when a multi-finger swipe gesture ceases to + be valid. This may happen when one or more fingers are lifted or + the gesture is cancelled. + + When a gesture is cancelled, the client should undo state changes + caused by this gesture. What causes a gesture to be cancelled is + implementation-dependent. + + + + + + + + + + A pinch gesture object notifies a client about a multi-finger pinch + gesture detected on an indirect input device such as a touchpad. + The gesture is usually initiated by multiple fingers moving towards + each other or away from each other, or by two or more fingers rotating + around a logical center of gravity. The precise conditions of when + such a gesture is detected are implementation-dependent. + + A gesture consists of three stages: begin, update (optional) and end. + There cannot be multiple simultaneous pinch or swipe gestures on a + same pointer/seat, how compositors prevent these situations is + implementation-dependent. + + A gesture may be cancelled by the compositor or the hardware. + Clients should not consider performing permanent or irreversible + actions until the end of a gesture has been received. + + + + + + + + + This event is sent when a multi-finger pinch gesture is detected + on the device. + + + + + + + + + + This event is sent when a multi-finger pinch gesture changes the + position of the logical center, the rotation or the relative scale. + + The dx and dy coordinates are relative coordinates in the + surface coordinate space of the logical center of the gesture. + + The scale factor is an absolute scale compared to the + pointer_gesture_pinch.begin event, e.g. a scale of 2 means the fingers + are now twice as far apart as on pointer_gesture_pinch.begin. + + The rotation is the relative angle in degrees clockwise compared to the previous + pointer_gesture_pinch.begin or pointer_gesture_pinch.update event. + + + + + + + + + + + This event is sent when a multi-finger pinch gesture ceases to + be valid. This may happen when one or more fingers are lifted or + the gesture is cancelled. + + When a gesture is cancelled, the client should undo state changes + caused by this gesture. What causes a gesture to be cancelled is + implementation-dependent. + + + + + + + + diff --git a/src/3rdparty/wayland/protocols/qt_attribution.json b/src/3rdparty/wayland/protocols/qt_attribution.json index df48fa4e4e6..9b565a5a7b5 100644 --- a/src/3rdparty/wayland/protocols/qt_attribution.json +++ b/src/3rdparty/wayland/protocols/qt_attribution.json @@ -50,6 +50,23 @@ "Copyright": "Copyright (C) 2013 DENSO CORPORATION\nCopyright (c) 2013 BMW Car IT GmbH" }, + { + "Id": "wayland-pointer-gestures-protocol", + "Name": "Wayland Pointer Gestures Protocol", + "QDocModule": "qtwaylandcompositor", + "QtUsage": "Used in the Qt Wayland platform plugin", + "Files": "pointer-gestures-unstable-v1.xml", + + "Description": "", + "Homepage": "https://wayland.freedesktop.org", + "Version": "unstable v1, version 2", + "DownloadLocation": "https://cgit.freedesktop.org/wayland/wayland-protocols/plain/unstable/pointer-gestures/pointer-gestures-unstable-v1.xml", + "LicenseId": "MIT", + "License": "MIT License", + "LicenseFile": "MIT_LICENSE.txt", + "Copyright": "Copyright © 2015, 2016 Red Hat" + }, + { "Id": "wayland-primary-selection-protocol", "Name": "Wayland Primary Selection Protocol", diff --git a/src/plugins/platforms/wayland/CMakeLists.txt b/src/plugins/platforms/wayland/CMakeLists.txt index 61bf7159876..f317d531635 100644 --- a/src/plugins/platforms/wayland/CMakeLists.txt +++ b/src/plugins/platforms/wayland/CMakeLists.txt @@ -68,6 +68,7 @@ qt_internal_add_module(WaylandClient qt6_generate_wayland_protocol_client_sources(WaylandClient FILES + ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/pointer-gestures-unstable-v1.xml ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/tablet-unstable-v2.xml ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/text-input-unstable-v2.xml ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/wayland.xml From 2679eeaac9fc487cae1287d73daf95f246c7e2d5 Mon Sep 17 00:00:00 2001 From: Povilas Kanapickas Date: Mon, 18 Jan 2021 15:58:50 +0200 Subject: [PATCH 0961/1507] Implement support for pointer gestures v1 Change-Id: Ie9ee615de123e6deab5b7a5081ca9bcf53399df7 Reviewed-by: Shawn Rutledge --- src/plugins/platforms/wayland/CMakeLists.txt | 1 + .../platforms/wayland/qwaylanddisplay.cpp | 3 + .../platforms/wayland/qwaylanddisplay_p.h | 3 + .../platforms/wayland/qwaylandinputdevice.cpp | 38 ++- .../platforms/wayland/qwaylandinputdevice_p.h | 71 ++++++ .../wayland/qwaylandpointergestures.cpp | 222 ++++++++++++++++++ .../wayland/qwaylandpointergestures_p.h | 150 ++++++++++++ .../platforms/wayland/qwaylandwindow.cpp | 127 ++++++++++ .../platforms/wayland/qwaylandwindow_p.h | 25 ++ 9 files changed, 638 insertions(+), 2 deletions(-) create mode 100644 src/plugins/platforms/wayland/qwaylandpointergestures.cpp create mode 100644 src/plugins/platforms/wayland/qwaylandpointergestures_p.h diff --git a/src/plugins/platforms/wayland/CMakeLists.txt b/src/plugins/platforms/wayland/CMakeLists.txt index f317d531635..1e1b83893db 100644 --- a/src/plugins/platforms/wayland/CMakeLists.txt +++ b/src/plugins/platforms/wayland/CMakeLists.txt @@ -33,6 +33,7 @@ qt_internal_add_module(WaylandClient qwaylandinputmethodcontext.cpp qwaylandinputmethodcontext_p.h qwaylandintegration.cpp qwaylandintegration_p.h qwaylandnativeinterface.cpp qwaylandnativeinterface_p.h + qwaylandpointergestures.cpp qwaylandpointergestures_p.h qwaylandqtkey.cpp qwaylandqtkey_p.h qwaylandscreen.cpp qwaylandscreen_p.h qwaylandshellsurface.cpp qwaylandshellsurface_p.h diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index 94381992c03..8806773d51a 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -68,6 +68,7 @@ #include "qwaylandclientbufferintegration_p.h" #include "qwaylandextendedsurface_p.h" +#include "qwaylandpointergestures_p.h" #include "qwaylandsubsurface_p.h" #include "qwaylandtouch_p.h" #include "qwaylandtabletv2_p.h" @@ -355,6 +356,8 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin mQtKeyExtension.reset(new QWaylandQtKeyExtension(this, id)); } else if (interface == QStringLiteral("zwp_tablet_manager_v2")) { mTabletManager.reset(new QWaylandTabletManagerV2(this, id, qMin(1, int(version)))); + } else if (interface == QStringLiteral("zwp_pointer_gestures_v1")) { + mPointerGestures.reset(new QWaylandPointerGestures(this, id, 1)); #if QT_CONFIG(wayland_client_primary_selection) } else if (interface == QStringLiteral("zwp_primary_selection_device_manager_v1")) { mPrimarySelectionManager.reset(new QWaylandPrimarySelectionDeviceManagerV1(this, id, 1)); diff --git a/src/plugins/platforms/wayland/qwaylanddisplay_p.h b/src/plugins/platforms/wayland/qwaylanddisplay_p.h index 91715a14458..ae80cd33c77 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay_p.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay_p.h @@ -101,6 +101,7 @@ class QWaylandDataDeviceManager; class QWaylandPrimarySelectionDeviceManagerV1; #endif class QWaylandTabletManagerV2; +class QWaylandPointerGestures; class QWaylandTouchExtension; class QWaylandQtKeyExtension; class QWaylandWindow; @@ -172,6 +173,7 @@ public: #endif QtWayland::qt_surface_extension *windowExtension() const { return mWindowExtension.data(); } QWaylandTabletManagerV2 *tabletManager() const { return mTabletManager.data(); } + QWaylandPointerGestures *pointerGestures() const { return mPointerGestures.data(); } QWaylandTouchExtension *touchExtension() const { return mTouchExtension.data(); } QtWayland::qt_text_input_method_manager_v1 *textInputMethodManager() const { return mTextInputMethodManager.data(); } QtWayland::zwp_text_input_manager_v2 *textInputManager() const { return mTextInputManager.data(); } @@ -275,6 +277,7 @@ private: QScopedPointer mQtKeyExtension; QScopedPointer mWindowManagerIntegration; QScopedPointer mTabletManager; + QScopedPointer mPointerGestures; #if QT_CONFIG(wayland_client_primary_selection) QScopedPointer mPrimarySelectionManager; #endif diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index 3304b9118b6..6fe89cfcc3b 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -51,6 +51,7 @@ #include "qwaylandprimaryselectionv1_p.h" #endif #include "qwaylandtabletv2_p.h" +#include "qwaylandpointergestures_p.h" #include "qwaylandtouch_p.h" #include "qwaylandscreen_p.h" #include "qwaylandcursor_p.h" @@ -82,6 +83,10 @@ namespace QtWaylandClient { Q_LOGGING_CATEGORY(lcQpaWaylandInput, "qt.qpa.wayland.input"); +// The maximum number of concurrent touchpoints is not exposed in wayland, so we assume a +// reasonable number of them. As of 2021 most touchscreen panels support 10 concurrent touchpoints. +static const int MaxTouchPoints = 10; + QWaylandInputDevice::Keyboard::Keyboard(QWaylandInputDevice *p) : mParent(p) { @@ -446,9 +451,28 @@ void QWaylandInputDevice::seat_capabilities(uint32_t caps) if (caps & WL_SEAT_CAPABILITY_POINTER && !mPointer) { mPointer = createPointer(this); mPointer->init(get_pointer()); + + auto *pointerGestures = mQDisplay->pointerGestures(); + if (pointerGestures) { + // NOTE: The name of the device and its system ID are not exposed on Wayland. + mTouchPadDevice = new QPointingDevice(QLatin1String("touchpad"), 0, + QInputDevice::DeviceType::TouchPad, + QPointingDevice::PointerType::Finger, + QInputDevice::Capability::Position, + MaxTouchPoints, 0); + QWindowSystemInterface::registerInputDevice(mTouchPadDevice); + mPointerGesturePinch = pointerGestures->createPointerGesturePinch(this); + mPointerGesturePinch->init(pointerGestures->get_pinch_gesture(get_pointer())); + mPointerGestureSwipe = pointerGestures->createPointerGestureSwipe(this); + mPointerGestureSwipe->init(pointerGestures->get_swipe_gesture(get_pointer())); + } } else if (!(caps & WL_SEAT_CAPABILITY_POINTER) && mPointer) { delete mPointer; mPointer = nullptr; + delete mPointerGesturePinch; + mPointerGesturePinch = nullptr; + delete mPointerGestureSwipe; + mPointerGestureSwipe = nullptr; } if (caps & WL_SEAT_CAPABILITY_TOUCH && !mTouch) { @@ -458,8 +482,8 @@ void QWaylandInputDevice::seat_capabilities(uint32_t caps) if (!mTouchDevice) { // TODO number of touchpoints, actual name and ID mTouchDevice = new QPointingDevice(QLatin1String("some touchscreen"), 0, - QInputDevice::DeviceType::TouchScreen, QPointingDevice::PointerType::Finger, - QInputDevice::Capability::Position, 10, 0); + QInputDevice::DeviceType::TouchScreen, QPointingDevice::PointerType::Finger, + QInputDevice::Capability::Position, MaxTouchPoints, 0); QWindowSystemInterface::registerInputDevice(mTouchDevice); } } else if (!(caps & WL_SEAT_CAPABILITY_TOUCH) && mTouch) { @@ -493,6 +517,16 @@ QWaylandInputDevice::Pointer *QWaylandInputDevice::pointer() const return mPointer; } +QWaylandPointerGestureSwipe *QWaylandInputDevice::pointerGestureSwipe() const +{ + return mPointerGestureSwipe; +} + +QWaylandPointerGesturePinch *QWaylandInputDevice::pointerGesturePinch() const +{ + return mPointerGesturePinch; +} + QWaylandInputDevice::Touch *QWaylandInputDevice::touch() const { return mTouch; diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h index 4a216bc4344..0d408d36b33 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h +++ b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h @@ -63,6 +63,7 @@ #include #include +#include #if QT_CONFIG(xkbcommon) #include @@ -90,6 +91,9 @@ class QWaylandDisplay; class QWaylandPrimarySelectionDeviceV1; #endif class QWaylandTabletSeatV2; +class QWaylandPointerGestures; +class QWaylandPointerGestureSwipe; +class QWaylandPointerGesturePinch; class QWaylandTextInput; class QWaylandTextInputMethod; #if QT_CONFIG(cursor) @@ -97,6 +101,8 @@ class QWaylandCursorTheme; class CursorSurface; #endif +Q_DECLARE_LOGGING_CATEGORY(lcQpaWaylandInput); + class Q_WAYLAND_CLIENT_EXPORT QWaylandInputDevice : public QObject , public QtWayland::wl_seat @@ -158,6 +164,8 @@ public: Keyboard *keyboard() const; Pointer *pointer() const; + QWaylandPointerGestureSwipe *pointerGestureSwipe() const; + QWaylandPointerGesturePinch *pointerGesturePinch() const; Touch *touch() const; protected: @@ -187,6 +195,8 @@ protected: Keyboard *mKeyboard = nullptr; Pointer *mPointer = nullptr; + QWaylandPointerGestureSwipe *mPointerGestureSwipe = nullptr; + QWaylandPointerGesturePinch *mPointerGesturePinch = nullptr; Touch *mTouch = nullptr; QScopedPointer mTextInput; @@ -200,9 +210,13 @@ protected: void handleTouchPoint(int id, Qt::TouchPointState state, const QPointF &surfacePosition = QPoint()); QPointingDevice *mTouchDevice = nullptr; + QPointingDevice *mTouchPadDevice = nullptr; friend class QWaylandTouchExtension; friend class QWaylandQtKeyExtension; + friend class QWaylandPointerGestureSwipe; + friend class QWaylandPointerGesturePinch; + friend class QWaylandWindow; }; inline uint32_t QWaylandInputDevice::serial() const @@ -461,6 +475,63 @@ public: QPointer surface; }; +#ifndef QT_NO_GESTURES +class QWaylandPointerGestureSwipeEvent +{ + Q_GADGET +public: + inline QWaylandPointerGestureSwipeEvent(QWaylandWindow *surface, Qt::GestureState state, + ulong timestamp, const QPointF &local, + const QPointF &global, uint fingers, const QPointF& delta) + : surface(surface) + , state(state) + , timestamp(timestamp) + , local(local) + , global(global) + , fingers(fingers) + , delta(delta) + {} + + QPointer surface; + Qt::GestureState state = Qt::GestureState::NoGesture; + ulong timestamp = 0; + QPointF local; + QPointF global; + uint fingers = 0; + QPointF delta; +}; + +class QWaylandPointerGesturePinchEvent +{ + Q_GADGET +public: + inline QWaylandPointerGesturePinchEvent(QWaylandWindow *surface, Qt::GestureState state, + ulong timestamp, const QPointF &local, + const QPointF &global, uint fingers, const QPointF& delta, + qreal scale_delta, qreal rotation_delta) + : surface(surface) + , state(state) + , timestamp(timestamp) + , local(local) + , global(global) + , fingers(fingers) + , delta(delta) + , scale_delta(scale_delta) + , rotation_delta(rotation_delta) + {} + + QPointer surface; + Qt::GestureState state = Qt::GestureState::NoGesture; + ulong timestamp = 0; + QPointF local; + QPointF global; + uint fingers = 0; + QPointF delta; + qreal scale_delta = 0; + qreal rotation_delta = 0; +}; +#endif // #ifndef QT_NO_GESTURES + } QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandpointergestures.cpp b/src/plugins/platforms/wayland/qwaylandpointergestures.cpp new file mode 100644 index 00000000000..c22ed2eb579 --- /dev/null +++ b/src/plugins/platforms/wayland/qwaylandpointergestures.cpp @@ -0,0 +1,222 @@ +/**************************************************************************** +** +** Copyright (C) 2021 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qwaylandpointergestures_p.h" +#include "qwaylanddisplay_p.h" +#include "qwaylandinputdevice_p.h" + +QT_BEGIN_NAMESPACE + +namespace QtWaylandClient { + +QWaylandPointerGestures::QWaylandPointerGestures(QWaylandDisplay *display, uint id, uint version) + : zwp_pointer_gestures_v1(display->wl_registry(), id, qMin(version, uint(1))) +{ +} + +QWaylandPointerGestureSwipe * + QWaylandPointerGestures::createPointerGestureSwipe(QWaylandInputDevice *device) +{ + return new QWaylandPointerGestureSwipe(device); +} + +QWaylandPointerGesturePinch * + QWaylandPointerGestures::createPointerGesturePinch(QWaylandInputDevice *device) +{ + return new QWaylandPointerGesturePinch(device); +} + +QWaylandPointerGestureSwipe::QWaylandPointerGestureSwipe(QWaylandInputDevice *p) + : mParent(p) +{ +} + +QWaylandPointerGestureSwipe::~QWaylandPointerGestureSwipe() +{ + destroy(); +} + +void QWaylandPointerGestureSwipe::zwp_pointer_gesture_swipe_v1_begin(uint32_t serial, uint32_t time, + struct ::wl_surface *surface, + uint32_t fingers) +{ +#ifndef QT_NO_GESTURES + mParent->mSerial = serial; + mFocus = QWaylandWindow::fromWlSurface(surface); + mFingers = fingers; + + const auto* pointer = mParent->pointer(); + + qCDebug(lcQpaWaylandInput) << "zwp_pointer_gesture_swipe_v1_begin @ " + << pointer->mSurfacePos << "fingers" << fingers; + + auto e = QWaylandPointerGestureSwipeEvent(mFocus, Qt::GestureStarted, time, + pointer->mSurfacePos, pointer->mGlobalPos, mFingers, + QPointF()); + + mFocus->handleSwipeGesture(mParent, e); +#endif +} + +void QWaylandPointerGestureSwipe::zwp_pointer_gesture_swipe_v1_update(uint32_t time, + wl_fixed_t dx, wl_fixed_t dy) +{ +#ifndef QT_NO_GESTURES + const auto* pointer = mParent->pointer(); + + const QPointF delta = QPointF(wl_fixed_to_double(dx), wl_fixed_to_double(dy)); + qCDebug(lcQpaWaylandInput) << "zwp_pointer_gesture_swipe_v1_update @ " + << pointer->mSurfacePos << "delta" << delta; + + auto e = QWaylandPointerGestureSwipeEvent(mFocus, Qt::GestureUpdated, time, + pointer->mSurfacePos, pointer->mGlobalPos, mFingers, delta); + + mFocus->handleSwipeGesture(mParent, e); +#endif +} + +void QWaylandPointerGestureSwipe::zwp_pointer_gesture_swipe_v1_end(uint32_t serial, uint32_t time, + int32_t cancelled) +{ +#ifndef QT_NO_GESTURES + mParent->mSerial = serial; + const auto* pointer = mParent->pointer(); + + qCDebug(lcQpaWaylandInput) << "zwp_pointer_gesture_swipe_v1_end @ " + << pointer->mSurfacePos << (cancelled ? "CANCELED" : ""); + + auto gestureType = cancelled ? Qt::GestureFinished : Qt::GestureCanceled; + + auto e = QWaylandPointerGestureSwipeEvent(mFocus, gestureType, time, + pointer->mSurfacePos, pointer->mGlobalPos, mFingers, + QPointF()); + + mFocus->handleSwipeGesture(mParent, e); + + mFocus.clear(); + mFingers = 0; +#endif +} + +QWaylandPointerGesturePinch::QWaylandPointerGesturePinch(QWaylandInputDevice *p) + : mParent(p) +{ +} + +QWaylandPointerGesturePinch::~QWaylandPointerGesturePinch() +{ + destroy(); +} + +void QWaylandPointerGesturePinch::zwp_pointer_gesture_pinch_v1_begin(uint32_t serial, uint32_t time, + struct ::wl_surface *surface, + uint32_t fingers) +{ +#ifndef QT_NO_GESTURES + mParent->mSerial = serial; + mFocus = QWaylandWindow::fromWlSurface(surface); + mFingers = fingers; + mLastScale = 1; + + const auto* pointer = mParent->pointer(); + + qCDebug(lcQpaWaylandInput) << "zwp_pointer_gesture_pinch_v1_begin @ " + << pointer->mSurfacePos << "fingers" << fingers; + + auto e = QWaylandPointerGesturePinchEvent(mFocus, Qt::GestureStarted, time, + pointer->mSurfacePos, pointer->mGlobalPos, mFingers, + QPointF(), 0, 0); + + mFocus->handlePinchGesture(mParent, e); +#endif +} + +void QWaylandPointerGesturePinch::zwp_pointer_gesture_pinch_v1_update(uint32_t time, + wl_fixed_t dx, wl_fixed_t dy, + wl_fixed_t scale, + wl_fixed_t rotation) +{ +#ifndef QT_NO_GESTURES + const auto* pointer = mParent->pointer(); + + const qreal rscale = wl_fixed_to_double(scale); + const qreal rot = wl_fixed_to_double(rotation); + const QPointF delta = QPointF(wl_fixed_to_double(dx), wl_fixed_to_double(dy)); + qCDebug(lcQpaWaylandInput) << "zwp_pointer_gesture_pinch_v1_update @ " + << pointer->mSurfacePos << "delta" << delta + << "scale" << mLastScale << "->" << rscale + << "delta" << rscale - mLastScale << "rot" << rot; + + auto e = QWaylandPointerGesturePinchEvent(mFocus, Qt::GestureUpdated, time, + pointer->mSurfacePos, pointer->mGlobalPos, mFingers, + delta, rscale - mLastScale, rot); + + mFocus->handlePinchGesture(mParent, e); + + mLastScale = rscale; +#endif +} + +void QWaylandPointerGesturePinch::zwp_pointer_gesture_pinch_v1_end(uint32_t serial, uint32_t time, + int32_t cancelled) +{ +#ifndef QT_NO_GESTURES + mParent->mSerial = serial; + const auto* pointer = mParent->pointer(); + + qCDebug(lcQpaWaylandInput) << "zwp_pointer_gesture_swipe_v1_end @ " + << pointer->mSurfacePos << (cancelled ? "CANCELED" : ""); + + auto gestureType = cancelled ? Qt::GestureFinished : Qt::GestureCanceled; + + auto e = QWaylandPointerGesturePinchEvent(mFocus, gestureType, time, + pointer->mSurfacePos, pointer->mGlobalPos, mFingers, + QPointF(), 0, 0); + + mFocus->handlePinchGesture(mParent, e); + + mFocus.clear(); + mFingers = 0; + mLastScale = 1; +#endif +} + +} // namespace QtWaylandClient + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandpointergestures_p.h b/src/plugins/platforms/wayland/qwaylandpointergestures_p.h new file mode 100644 index 00000000000..c9aa3ac35ec --- /dev/null +++ b/src/plugins/platforms/wayland/qwaylandpointergestures_p.h @@ -0,0 +1,150 @@ +/**************************************************************************** +** +** Copyright (C) 2021 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWAYLANDPOINTERGESTURES_P_H +#define QWAYLANDPOINTERGESTURES_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include + +#include + +#include +#include + +QT_BEGIN_NAMESPACE + +namespace QtWaylandClient { + +class QWaylandDisplay; +class QWaylandWindow; +class QWaylandInputDevice; +class QWaylandPointerGestureSwipe; +class QWaylandPointerGesturePinch; + +class Q_WAYLAND_CLIENT_EXPORT QWaylandPointerGestures : public QtWayland::zwp_pointer_gestures_v1 +{ +public: + explicit QWaylandPointerGestures(QWaylandDisplay *display, uint id, uint version); + + QWaylandPointerGestureSwipe *createPointerGestureSwipe(QWaylandInputDevice *device); + QWaylandPointerGesturePinch *createPointerGesturePinch(QWaylandInputDevice *device); +}; + +class Q_WAYLAND_CLIENT_EXPORT QWaylandPointerGestureSwipe : + public QtWayland::zwp_pointer_gesture_swipe_v1 +{ +public: + QWaylandPointerGestureSwipe(QWaylandInputDevice *p); + ~QWaylandPointerGestureSwipe() override; + + void zwp_pointer_gesture_swipe_v1_begin(uint32_t serial, + uint32_t time, + struct ::wl_surface *surface, + uint32_t fingers) override; + + void zwp_pointer_gesture_swipe_v1_update(uint32_t time, + wl_fixed_t dx, + wl_fixed_t dy) override; + + void zwp_pointer_gesture_swipe_v1_end(uint32_t serial, + uint32_t time, + int32_t cancelled) override; + + struct ::zwp_pointer_gesture_swipe_v1 *zwp_pointer_gesture_swipe_v1() + { + return QtWayland::zwp_pointer_gesture_swipe_v1::object(); + } + + QWaylandInputDevice *mParent = nullptr; + QPointer mFocus; + uint mFingers = 0; +}; + +class Q_WAYLAND_CLIENT_EXPORT QWaylandPointerGesturePinch : + public QtWayland::zwp_pointer_gesture_pinch_v1 +{ +public: + QWaylandPointerGesturePinch(QWaylandInputDevice *p); + ~QWaylandPointerGesturePinch() override; + + void zwp_pointer_gesture_pinch_v1_begin(uint32_t serial, + uint32_t time, + struct ::wl_surface *surface, + uint32_t fingers) override; + + void zwp_pointer_gesture_pinch_v1_update(uint32_t time, + wl_fixed_t dx, + wl_fixed_t dy, + wl_fixed_t scale, + wl_fixed_t rotation) override; + + void zwp_pointer_gesture_pinch_v1_end(uint32_t serial, + uint32_t time, + int32_t cancelled) override; + + struct ::zwp_pointer_gesture_pinch_v1 *zwp_pointer_gesture_pinch_v1() + { + return QtWayland::zwp_pointer_gesture_pinch_v1::object(); + } + + QWaylandInputDevice *mParent = nullptr; + QPointer mFocus; + uint mFingers = 0; + + // We need to convert between absolute scale provided by wayland/libinput and zoom deltas + // that Qt expects. This stores the scale of the last pinch event or 1.0 if there was none. + qreal mLastScale = 1; +}; + +} // namespace QtWaylandClient + +QT_END_NAMESPACE + +#endif // QWAYLANDPOINTERGESTURES_P_H diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 62690fc6f9b..5a5d18a93cb 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -978,6 +978,133 @@ void QWaylandWindow::handleMouse(QWaylandInputDevice *inputDevice, const QWaylan #endif } +#ifndef QT_NO_GESTURES +void QWaylandWindow::handleSwipeGesture(QWaylandInputDevice *inputDevice, + const QWaylandPointerGestureSwipeEvent &e) +{ + switch (e.state) { + case Qt::GestureStarted: + if (mGestureState != GestureNotActive) + qCWarning(lcQpaWaylandInput) << "Unexpected gesture state. Gestures will act weird."; + + if (mWindowDecoration && !mMouseEventsInContentArea) { + // whole gesture sequence will be ignored + mGestureState = GestureActiveInDecoration; + return; + } + + mGestureState = GestureActiveInContentArea; + QWindowSystemInterface::handleGestureEvent(window(), e.timestamp, + inputDevice->mTouchPadDevice, + Qt::BeginNativeGesture, + e.local, e.global, e.fingers); + break; + case Qt::GestureUpdated: + if (mGestureState != GestureActiveInContentArea) + return; + + if (!e.delta.isNull()) { + QWindowSystemInterface::handleGestureEventWithValueAndDeltas( + window(), e.timestamp, inputDevice->mTouchPadDevice, + Qt::PanNativeGesture, + 0, QVector2D(e.delta), e.local, e.global, e.fingers); + } + break; + case Qt::GestureFinished: + case Qt::GestureCanceled: + if (mGestureState == GestureActiveInDecoration) { + mGestureState = GestureNotActive; + return; + } + + if (mGestureState != GestureActiveInContentArea) + qCWarning(lcQpaWaylandInput) << "Unexpected gesture state. Gestures will act weird."; + + mGestureState = GestureNotActive; + + // There's currently no way to expose cancelled gestures to the rest of Qt, so + // this part of information is lost. + QWindowSystemInterface::handleGestureEvent(window(), e.timestamp, + inputDevice->mTouchPadDevice, + Qt::EndNativeGesture, + e.local, e.global, e.fingers); + break; + default: + break; + } +} + +void QWaylandWindow::handlePinchGesture(QWaylandInputDevice *inputDevice, + const QWaylandPointerGesturePinchEvent &e) +{ + switch (e.state) { + case Qt::GestureStarted: + if (mGestureState != GestureNotActive) + qCWarning(lcQpaWaylandInput) << "Unexpected gesture state. Gestures will act weird."; + + if (mWindowDecoration && !mMouseEventsInContentArea) { + // whole gesture sequence will be ignored + mGestureState = GestureActiveInDecoration; + return; + } + + mGestureState = GestureActiveInContentArea; + QWindowSystemInterface::handleGestureEvent(window(), e.timestamp, + inputDevice->mTouchPadDevice, + Qt::BeginNativeGesture, + e.local, e.global, e.fingers); + break; + case Qt::GestureUpdated: + if (mGestureState != GestureActiveInContentArea) + return; + + if (!e.delta.isNull()) { + QWindowSystemInterface::handleGestureEventWithValueAndDeltas( + window(), e.timestamp, inputDevice->mTouchPadDevice, + Qt::PanNativeGesture, + 0, QVector2D(e.delta), e.local, e.global, e.fingers); + } + if (e.rotation_delta != 0) { + QWindowSystemInterface::handleGestureEventWithRealValue(window(), e.timestamp, + inputDevice->mTouchPadDevice, + Qt::RotateNativeGesture, + e.rotation_delta, + e.local, e.global, e.fingers); + } + if (e.scale_delta != 0) { + QWindowSystemInterface::handleGestureEventWithRealValue(window(), e.timestamp, + inputDevice->mTouchPadDevice, + Qt::ZoomNativeGesture, + e.scale_delta, + e.local, e.global, e.fingers); + } + break; + case Qt::GestureFinished: + case Qt::GestureCanceled: + if (mGestureState == GestureActiveInDecoration) { + mGestureState = GestureNotActive; + return; + } + + if (mGestureState != GestureActiveInContentArea) + qCWarning(lcQpaWaylandInput) << "Unexpected gesture state. Gestures will act weird."; + + mGestureState = GestureNotActive; + + // There's currently no way to expose cancelled gestures to the rest of Qt, so + // this part of information is lost. + QWindowSystemInterface::handleGestureEvent(window(), e.timestamp, + inputDevice->mTouchPadDevice, + Qt::EndNativeGesture, + e.local, e.global, e.fingers); + break; + default: + break; + } +} +#endif // #ifndef QT_NO_GESTURES + + bool QWaylandWindow::touchDragDecoration(QWaylandInputDevice *inputDevice, const QPointF &local, const QPointF &global, Qt::TouchPointState state, Qt::KeyboardModifiers mods) { if (!mWindowDecoration) diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index 314294fcfc6..09411792e9b 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -83,6 +83,8 @@ class QWaylandInputDevice; class QWaylandScreen; class QWaylandShmBackingStore; class QWaylandPointerEvent; +class QWaylandPointerGestureSwipeEvent; +class QWaylandPointerGesturePinchEvent; class QWaylandSurface; class Q_WAYLAND_CLIENT_EXPORT QWaylandWindow : public QObject, public QPlatformWindow @@ -177,6 +179,12 @@ public: QWaylandAbstractDecoration *decoration() const; void handleMouse(QWaylandInputDevice *inputDevice, const QWaylandPointerEvent &e); +#ifndef QT_NO_GESTURES + void handleSwipeGesture(QWaylandInputDevice *inputDevice, + const QWaylandPointerGestureSwipeEvent &e); + void handlePinchGesture(QWaylandInputDevice *inputDevice, + const QWaylandPointerGesturePinchEvent &e); +#endif bool touchDragDecoration(QWaylandInputDevice *inputDevice, const QPointF &local, const QPointF &global, Qt::TouchPointState state, Qt::KeyboardModifiers mods); @@ -241,6 +249,23 @@ protected: bool mMouseEventsInContentArea = false; Qt::MouseButtons mMousePressedInContentArea = Qt::NoButton; +#ifndef QT_NO_GESTURES + enum GestureState { + GestureNotActive, + GestureActiveInContentArea, + GestureActiveInDecoration + }; + + // We want gestures started in the decoration area to be completely ignored even if the mouse + // pointer is later moved to content area. Likewise, gestures started in the content area should + // keep sending events even if the mouse pointer is moved over the decoration (consider that + // the events for that gesture will be sent to us even if it's moved outside the window). + // So we track the gesture state and accept or ignore events based on that. Note that + // concurrent gestures of different types are not allowed in the protocol, so single state is + // enough + GestureState mGestureState = GestureNotActive; +#endif + WId mWindowId; bool mWaitingForFrameCallback = false; bool mFrameCallbackTimedOut = false; // Whether the frame callback has timed out From e970b7487a2d4a08dd805e70e55cfb9bc314092f Mon Sep 17 00:00:00 2001 From: Alexey Edelev Date: Fri, 28 May 2021 17:36:50 +0200 Subject: [PATCH 0962/1507] Replace AUTOMOC by qt_manual_moc in tests AUTOMOC can not be used in Qt internal testing, since Qt::moc target is not available at configure phase. Replace it by the qt_manual_moc call. Fixes: QTBUG-94085 Change-Id: I793091357d536612ae2a81032606be68dee3a6d2 Reviewed-by: Shawn Rutledge --- tests/auto/wayland/shared/CMakeLists.txt | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/tests/auto/wayland/shared/CMakeLists.txt b/tests/auto/wayland/shared/CMakeLists.txt index 6116688c36e..2ce9c23a3b0 100644 --- a/tests/auto/wayland/shared/CMakeLists.txt +++ b/tests/auto/wayland/shared/CMakeLists.txt @@ -2,6 +2,18 @@ ##Client test shared components: ##################################################################### +qt_manual_moc(moc_files + mockcompositor.h + coreprotocol.h + corecompositor.h + datadevice.h + fullscreenshellv1.h + iviapplication.h + textinput.h + xdgoutputv1.h + xdgshell.h +) + add_library(SharedClientTest OBJECT corecompositor.cpp corecompositor.h @@ -13,10 +25,9 @@ add_library(SharedClientTest textinput.cpp textinput.h xdgoutputv1.cpp xdgoutputv1.h xdgshell.cpp xdgshell.h + ${moc_files} ) -set_property(TARGET SharedClientTest PROPERTY AUTOMOC ON) - qt6_generate_wayland_protocol_server_sources(SharedClientTest FILES ${PROJECT_SOURCE_DIR}/src/3rdparty/protocol/fullscreen-shell-unstable-v1.xml From 3126be72311559ab1e2145ebaff5d81579a52c95 Mon Sep 17 00:00:00 2001 From: Alexey Edelev Date: Wed, 19 May 2021 17:09:43 +0200 Subject: [PATCH 0963/1507] Add the 'Private' suffix to the internal module names Rename internal modules to adjust their names to the internal module policy. Change-Id: Ib9604c0b0dbd2a216d48df3797e912983f7e3c8f Reviewed-by: Alexandru Croitor --- .../plugins/shellintegration/wl-shell/CMakeLists.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/CMakeLists.txt index e87bc5c4015..0a0a83d1bd0 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/CMakeLists.txt +++ b/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/CMakeLists.txt @@ -1,10 +1,10 @@ # Generated from wl-shell.pro. ##################################################################### -## WlShellIntegration Module: +## WlShellIntegrationPrivate Module: ##################################################################### -qt_internal_add_module(WlShellIntegration +qt_internal_add_module(WlShellIntegrationPrivate CONFIG_MODULE_NAME wl_shell_integration INTERNAL_MODULE SOURCES @@ -16,7 +16,7 @@ qt_internal_add_module(WlShellIntegration Wayland::Client ) -qt6_generate_wayland_protocol_client_sources(WlShellIntegration +qt6_generate_wayland_protocol_client_sources(WlShellIntegrationPrivate FILES ${CMAKE_CURRENT_SOURCE_DIR}/../../../3rdparty/protocol/wayland.xml ) @@ -27,7 +27,7 @@ qt6_generate_wayland_protocol_client_sources(WlShellIntegration ## Scopes: ##################################################################### -qt_internal_extend_target(WlShellIntegration CONDITION QT_FEATURE_xkbcommon +qt_internal_extend_target(WlShellIntegrationPrivate CONDITION QT_FEATURE_xkbcommon LIBRARIES XKB::XKB ) From c0138b02a24a4bc11405c09b0dbc59ab0b9164da Mon Sep 17 00:00:00 2001 From: JiDe Zhang Date: Tue, 25 May 2021 13:09:58 +0800 Subject: [PATCH 0964/1507] Add BlankCursor for cursor names map BlankCursor => "blank" Pick-to: 6.1 6.0 5.15 Change-Id: I9337f0615f84bb82bc722d24416e97799309b3e5 Reviewed-by: Liang Qi --- src/plugins/platforms/wayland/qwaylandcursor.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/plugins/platforms/wayland/qwaylandcursor.cpp b/src/plugins/platforms/wayland/qwaylandcursor.cpp index 56caf05e2f1..92cdfd65539 100644 --- a/src/plugins/platforms/wayland/qwaylandcursor.cpp +++ b/src/plugins/platforms/wayland/qwaylandcursor.cpp @@ -120,6 +120,8 @@ wl_cursor *QWaylandCursorTheme::requestCursor(WaylandCursor shape) {SizeAllCursor, "size_all"}, + {BlankCursor, "blank"}, + {SplitVCursor, "split_v"}, {SplitVCursor, "row-resize"}, {SplitVCursor, "sb_v_double_arrow"}, From 19ca1a7a95a0cc44c0ead294ea30660fd751114b Mon Sep 17 00:00:00 2001 From: David Redondo Date: Wed, 26 May 2021 14:49:40 +0200 Subject: [PATCH 0965/1507] Hook up queryKeyboardModifers Can be useful when upon enter a modifiers event is received but no key event so no QKeyEvent is generated. Fixes: QTBUG-62786 Change-Id: I30b57fc78ce6d54d8f644ca95ba40e7e26eb24ed Reviewed-by: Marco Martin Reviewed-by: David Edmundson --- src/plugins/platforms/wayland/qwaylandintegration.cpp | 8 ++++++++ src/plugins/platforms/wayland/qwaylandintegration_p.h | 2 ++ 2 files changed, 10 insertions(+) diff --git a/src/plugins/platforms/wayland/qwaylandintegration.cpp b/src/plugins/platforms/wayland/qwaylandintegration.cpp index 41e6c50f86e..d54dff5ce56 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandintegration.cpp @@ -284,6 +284,14 @@ QWaylandDisplay *QWaylandIntegration::display() const return mDisplay.data(); } +Qt::KeyboardModifiers QWaylandIntegration::queryKeyboardModifiers() const +{ + if (auto *seat = mDisplay->currentInputDevice()) { + return seat->modifiers(); + } + return Qt::NoModifier; +} + QList QWaylandIntegration::possibleKeys(const QKeyEvent *event) const { if (auto *seat = mDisplay->currentInputDevice()) diff --git a/src/plugins/platforms/wayland/qwaylandintegration_p.h b/src/plugins/platforms/wayland/qwaylandintegration_p.h index e687e0c6728..d44c923120b 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration_p.h +++ b/src/plugins/platforms/wayland/qwaylandintegration_p.h @@ -109,6 +109,8 @@ public: QWaylandDisplay *display() const; + Qt::KeyboardModifiers queryKeyboardModifiers() const override; + QList possibleKeys(const QKeyEvent *event) const override; QStringList themeNames() const override; From 7958ad1029b7879171cd0484426667347198ba15 Mon Sep 17 00:00:00 2001 From: Robert Griebl Date: Mon, 14 Jun 2021 19:18:24 +0200 Subject: [PATCH 0966/1507] cmake: create Wayland extension headers in the correct module path This was hardcoded to QtWaylandCompositor for cmake, while $$MODULE_INCNAME was used in the old qmake world. Pick-to: 6.2 Change-Id: I513423bbffb80a0f548c6145c5bf37f3930d7169 Reviewed-by: Alexandru Croitor --- src/tools/qtwaylandscanner/Qt6WaylandCompositorMacros.cmake | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/tools/qtwaylandscanner/Qt6WaylandCompositorMacros.cmake b/src/tools/qtwaylandscanner/Qt6WaylandCompositorMacros.cmake index 51edbb319cd..b8771b95487 100644 --- a/src/tools/qtwaylandscanner/Qt6WaylandCompositorMacros.cmake +++ b/src/tools/qtwaylandscanner/Qt6WaylandCompositorMacros.cmake @@ -34,9 +34,11 @@ function(qt6_generate_wayland_protocol_server_sources target) # TODO: make this less hacky set(wayland_include_dir "") - #get_target_property(qt_module "${target}" QT_MODULE) + get_target_property(qt_module ${target} _qt_module_interface_name) get_target_property(is_for_module "${target}" INTERFACE_MODULE_HAS_HEADERS) - if (is_for_module) + if (qt_module) + set(wayland_include_dir "Qt${qt_module}/private") + elseif (is_for_module) set(wayland_include_dir "QtWaylandCompositor/private") endif() From 90e5639701ba8b79d576bedda1146fec86edf104 Mon Sep 17 00:00:00 2001 From: Robert Griebl Date: Wed, 16 Jun 2021 03:44:22 +0200 Subject: [PATCH 0967/1507] cmake: be more flexible when creating Wayland client and server extension headers This was hardcoded to QtWaylandClient/QtWaylandServer for cmake, while $$MODULE_INCNAME was used in the old qmake world. (this is an update to the previous commit, fixing the client side of things, plus adding an override for both) The header location will now default to the current Qt modules private include dir (as it was in qmake times), but we now also have the ability to override this default via WAYLAND_INCLUDE_DIR to deal with special cases like the WlShellExtension (which is an own Qt private module itself) Pick-to: 6.2 Change-Id: I4e96578a9a00598c236fcd22a460aeca4984baeb Reviewed-by: Dominik Holland Reviewed-by: Alexandru Croitor --- .../shellintegration/wl-shell/CMakeLists.txt | 2 ++ .../Qt6WaylandClientMacros.cmake | 16 +++++++++++----- .../Qt6WaylandCompositorMacros.cmake | 19 +++++++++++-------- 3 files changed, 24 insertions(+), 13 deletions(-) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/CMakeLists.txt index 0a0a83d1bd0..d7c052fa438 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/CMakeLists.txt +++ b/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/CMakeLists.txt @@ -17,6 +17,8 @@ qt_internal_add_module(WlShellIntegrationPrivate ) qt6_generate_wayland_protocol_client_sources(WlShellIntegrationPrivate + # this is just a helper module and still part of the QtWaylandClient build + WAYLAND_INCLUDE_DIR QtWaylandClient/private FILES ${CMAKE_CURRENT_SOURCE_DIR}/../../../3rdparty/protocol/wayland.xml ) diff --git a/src/tools/qtwaylandscanner/Qt6WaylandClientMacros.cmake b/src/tools/qtwaylandscanner/Qt6WaylandClientMacros.cmake index 5eab19d896f..6bda08e70fc 100644 --- a/src/tools/qtwaylandscanner/Qt6WaylandClientMacros.cmake +++ b/src/tools/qtwaylandscanner/Qt6WaylandClientMacros.cmake @@ -1,5 +1,5 @@ function(qt6_generate_wayland_protocol_client_sources target) - cmake_parse_arguments(arg "" "" "FILES" ${ARGN}) + cmake_parse_arguments(arg "" "WAYLAND_INCLUDE_DIR" "FILES" ${ARGN}) if(DEFINED arg_UNPARSED_ARGUMENTS) message(FATAL_ERROR "Unknown arguments were passed to qt6_generate_wayland_protocol_client_sources: (${arg_UNPARSED_ARGUMENTS}).") endif() @@ -34,11 +34,17 @@ function(qt6_generate_wayland_protocol_client_sources target) COMMAND Wayland::Scanner --strict --include-core-only public-code < "${protocol_file}" > "${waylandscanner_code_output}" ) - # TODO: Make this less hacky set(wayland_include_dir "") - get_target_property(is_for_module "${target}" INTERFACE_MODULE_HAS_HEADERS) - if (is_for_module) - set(wayland_include_dir "QtWaylandClient/private") + if(arg_WAYLAND_INCLUDE_DIR) + set(wayland_include_dir "${arg_WAYLAND_INCLUDE_DIR}") + else() + get_target_property(qt_module ${target} _qt_module_interface_name) + get_target_property(is_for_module "${target}" INTERFACE_MODULE_HAS_HEADERS) + if (qt_module) + set(wayland_include_dir "Qt${qt_module}/private") + elseif (is_for_module) + set(wayland_include_dir "QtWaylandClient/private") + endif() endif() add_custom_command( diff --git a/src/tools/qtwaylandscanner/Qt6WaylandCompositorMacros.cmake b/src/tools/qtwaylandscanner/Qt6WaylandCompositorMacros.cmake index b8771b95487..3fb08b3a743 100644 --- a/src/tools/qtwaylandscanner/Qt6WaylandCompositorMacros.cmake +++ b/src/tools/qtwaylandscanner/Qt6WaylandCompositorMacros.cmake @@ -1,5 +1,5 @@ function(qt6_generate_wayland_protocol_server_sources target) - cmake_parse_arguments(arg "" "" "FILES" ${ARGN}) + cmake_parse_arguments(arg "" "WAYLAND_INCLUDE_DIR" "FILES" ${ARGN}) if(DEFINED arg_UNPARSED_ARGUMENTS) message(FATAL_ERROR "Unknown arguments were passed to qt6_generate_wayland_protocol_server_sources: (${arg_UNPARSED_ARGUMENTS}).") endif() @@ -32,14 +32,17 @@ function(qt6_generate_wayland_protocol_server_sources target) COMMAND Wayland::Scanner --strict --include-core-only public-code < "${protocol_file}" > "${waylandscanner_code_output}" ) - # TODO: make this less hacky set(wayland_include_dir "") - get_target_property(qt_module ${target} _qt_module_interface_name) - get_target_property(is_for_module "${target}" INTERFACE_MODULE_HAS_HEADERS) - if (qt_module) - set(wayland_include_dir "Qt${qt_module}/private") - elseif (is_for_module) - set(wayland_include_dir "QtWaylandCompositor/private") + if(arg_WAYLAND_INCLUDE_DIR) + set(wayland_include_dir "${arg_WAYLAND_INCLUDE_DIR}") + else() + get_target_property(qt_module ${target} _qt_module_interface_name) + get_target_property(is_for_module "${target}" INTERFACE_MODULE_HAS_HEADERS) + if (qt_module) + set(wayland_include_dir "Qt${qt_module}/private") + elseif (is_for_module) + set(wayland_include_dir "QtWaylandCompositor/private") + endif() endif() add_custom_command( From 60433781d8fb2d68e1604708ab0011af55d8ddbb Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Wed, 16 Jun 2021 11:18:37 +0200 Subject: [PATCH 0968/1507] Remove old configure-related files Remove the configure.json and configure.pri files that were used for the qmake-based configure. Remove the .prev_*.cmake files that were a by-product of configurejson2cmake.py. Pick-to: 6.2 Task-number: QTBUG-89536 Change-Id: Ib9271b7f359af276b2df92ef4b5bc8f6bff21511 Reviewed-by: Alexandru Croitor --- src/plugins/platforms/wayland/configure.json | 297 ------------------- 1 file changed, 297 deletions(-) delete mode 100644 src/plugins/platforms/wayland/configure.json diff --git a/src/plugins/platforms/wayland/configure.json b/src/plugins/platforms/wayland/configure.json deleted file mode 100644 index 0aa44eda6c7..00000000000 --- a/src/plugins/platforms/wayland/configure.json +++ /dev/null @@ -1,297 +0,0 @@ -{ - "module": "waylandclient", - "condition": "module.gui", - "depends": [ - "gui-private" - ], - "testDir": "../../config.tests", - - "libraries": { - "wayland-client": { - "label": "Wayland client library", - "headers": "wayland-version.h", - "test": { - "main": [ - "#if WAYLAND_VERSION_MAJOR < 1", - "# error Wayland 1.15.0 or higher required", - "#endif", - "#if WAYLAND_VERSION_MAJOR == 1", - "# if WAYLAND_VERSION_MINOR < 15", - "# error Wayland 1.15.0 or higher required", - "# endif", - "# if WAYLAND_VERSION_MINOR == 15", - "# if WAYLAND_VERSION_MICRO < 0", - "# error Wayland 1.15.0 or higher required", - "# endif", - "# endif", - "#endif" - ] - }, - "sources": [ - { "type": "pkgConfig", "args": "wayland-client" }, - "-lwayland-client" - ] - }, - "wayland-cursor": { - "label": "Wayland cursor library", - "headers": "wayland-cursor.h", - "test": { - "main": "struct wl_cursor_image *image = 0;" - }, - "use": "wayland-client", - "sources": [ - { "type": "pkgConfig", "args": "wayland-cursor" }, - "-lwayland-cursor" - ] - }, - "wayland-egl": { - "label": "Wayland EGL library", - "headers": "wayland-egl.h", - "test": { - "main": "struct wl_egl_window *window = wl_egl_window_create(0, 100, 100);" - }, - "sources": [ - { "type": "pkgConfig", "args": "wayland-egl" }, - "-lwayland-egl", - "-lEGL" - ] - }, - "xcomposite": { - "label": "XComposite", - "headers": "X11/extensions/Xcomposite.h", - "test": { - "main": "XCompositeRedirectWindow((Display *)0,(Window) 0, CompositeRedirectManual);" - - }, - "sources": [ - { "type": "pkgConfig", "args": "xcomposite" }, - "-lxcomposite" - ] - } - }, - - "tests": { - "wayland-scanner": { - "label": "wayland-scanner", - "type": "compile", - "test": "wayland_scanner", - "use": "wayland-client" - }, - "drm-egl-server": { - "label": "DRM EGL Server", - "type": "compile", - "test": { - "include": [ - "EGL/egl.h", - "EGL/eglext.h" - ], - "main": [ - "#ifdef EGL_MESA_drm_image", - "return 0;", - "#else", - "#error Requires EGL_MESA_drm_image to be defined", - "return 1;", - "#endif" - ] - }, - "use": "egl" - }, - "libhybris-egl-server": { - "label": "libhybris EGL Server", - "type": "compile", - "test": { - "include": [ - "EGL/egl.h", - "EGL/eglext.h", - "hybris/eglplatformcommon/hybris_nativebufferext.h" - ], - "main": [ - "#ifdef EGL_HYBRIS_native_buffer", - "return 0;", - "#else", - "#error Requires EGL_HYBRIS_native_buffer to be defined", - "return 1;", - "#endif" - ] - }, - "use": "egl" - }, - "dmabuf-server-buffer": { - "label": "Linux dma-buf Buffer Sharing", - "type": "compile", - "test": { - "include": [ - "EGL/egl.h", - "EGL/eglext.h", - "drm_fourcc.h" - ], - "main": [ - "#ifdef EGL_LINUX_DMA_BUF_EXT", - "return 0;", - "#else", - "#error Requires EGL_LINUX_DMA_BUF_EXT", - "return 1;", - "#endif" - ] - }, - "libs": "-ldrm", - "use": "egl" - }, - "vulkan-server-buffer": { - "label": "Vulkan Buffer Sharing", - "type": "compile", - "test": { - "head": [ - "#define VK_USE_PLATFORM_WAYLAND_KHR 1" - ], - "include": [ - "vulkan/vulkan.h" - ], - "main": [ - "VkExportMemoryAllocateInfoKHR exportAllocInfo = {};", - "exportAllocInfo.sType = VK_STRUCTURE_TYPE_EXPORT_MEMORY_ALLOCATE_INFO_KHR;", - "exportAllocInfo.handleTypes = VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT_KHR;", - "return 0;" - ] - } - }, - "egl_1_5-wayland": { - "label": "EGL 1.5 with Wayland Platform", - "type": "compile", - "test": { - "include": [ - "EGL/egl.h", - "EGL/eglext.h", - "wayland-client.h" - ], - "main": [ - "eglGetPlatformDisplay(EGL_PLATFORM_WAYLAND_EXT, (struct wl_display *)(nullptr), nullptr);" - ] - }, - "use": "egl" - } - }, - - "features": { - "wayland-client": { - "label": "Qt Wayland Client", - "condition": "!config.win32 && libs.wayland-client && libs.wayland-cursor && tests.wayland-scanner", - "output": [ "privateFeature" ] - }, - "wayland-datadevice": { - "condition": "features.draganddrop || features.clipboard", - "output": [ "privateFeature" ] - }, - "wayland-client-primary-selection": { - "label": "primary-selection clipboard", - "condition": "features.clipboard", - "output": [ "privateFeature" ] - }, - "wayland-client-fullscreen-shell-v1": { - "label": "fullscreen-shell-v1", - "condition": "features.wayland-client", - "output": [ "privateFeature" ] - }, - "wayland-client-ivi-shell": { - "label": "ivi-shell", - "condition": "features.wayland-client", - "output": [ "privateFeature" ] - }, - "wayland-client-wl-shell": { - "label": "wl-shell (deprecated)", - "condition": "features.wayland-client", - "output": [ "privateFeature" ] - }, - "wayland-client-xdg-shell": { - "label": "xdg-shell", - "condition": "features.wayland-client", - "output": [ "privateFeature" ] - }, - "egl-extension-platform-wayland": { - "label": "EGL wayland platform extension", - "condition": "features.wayland-client && features.opengl && features.egl && tests.egl_1_5-wayland", - "output": [ "privateFeature" ] - }, - "wayland-egl": { - "label": "EGL", - "condition": "features.wayland-client && features.opengl && features.egl && libs.wayland-egl && (!config.qnx || features.egl-extension-platform-wayland)", - "output": [ "privateFeature" ] - }, - "wayland-brcm": { - "label": "Raspberry Pi", - "condition": "features.wayland-client && features.eglfs_brcm", - "output": [ "privateFeature" ] - }, - "xcomposite-egl": { - "label": "XComposite EGL", - "condition": "features.wayland-client && features.opengl && features.egl && features.xlib && libs.xcomposite && features.egl_x11", - "output": [ "privateFeature" ] - }, - "xcomposite-glx": { - "label": "XComposite GLX", - "condition": "features.wayland-client && features.opengl && !features.opengles2 && features.xlib && libs.xcomposite", - "output": [ "privateFeature" ] - }, - "wayland-drm-egl-server-buffer": { - "label": "DRM EGL", - "condition": "features.wayland-client && features.opengl && features.egl && tests.drm-egl-server && (!config.qnx || features.egl-extension-platform-wayland)", - "output": [ "privateFeature" ] - }, - "wayland-libhybris-egl-server-buffer": { - "label": "libhybris EGL", - "condition": "features.wayland-client && features.opengl && features.egl && tests.libhybris-egl-server", - "output": [ "privateFeature" ] - }, - "wayland-dmabuf-server-buffer": { - "label": "Linux dma-buf server buffer integration", - "condition": "features.wayland-client && features.opengl && features.egl && tests.dmabuf-server-buffer", - "output": [ "privateFeature" ] - }, - "wayland-vulkan-server-buffer": { - "label": "Vulkan-based server buffer integration", - "condition": "features.wayland-client && features.vulkan && features.opengl && features.egl && tests.vulkan-server-buffer", - "output": [ "privateFeature" ] - }, - "wayland-shm-emulation-server-buffer": { - "label": "Shm emulation server buffer integration", - "condition": "features.wayland-client && features.opengl", - "output": [ "privateFeature" ] - } - }, - - "report": [ - { - "type": "note", - "condition": "!libs.wayland-egl", - "message": "No wayland-egl support detected. Cross-toolkit compatibility disabled." - } - ], - - "summary": [ - { - "section": "Qt Wayland Drivers", - "condition": "features.wayland-client", - "entries": [ - "wayland-egl", - "wayland-brcm", - "xcomposite-egl", - "xcomposite-glx", - "wayland-drm-egl-server-buffer", - "wayland-libhybris-egl-server-buffer", - "wayland-dmabuf-server-buffer", - "wayland-vulkan-server-buffer", - "wayland-shm-emulation-server-buffer" - ] - }, - { - "section": "Qt Wayland Client Shell Integrations", - "condition": "features.wayland-client", - "entries": [ - "wayland-client-xdg-shell", - "wayland-client-ivi-shell", - "wayland-client-wl-shell" - ] - }, - "wayland-client" - ] -} From 778d4a7d652b9cb322715bd5a120da55cbad9003 Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Wed, 23 Jun 2021 16:49:57 +0100 Subject: [PATCH 0969/1507] Client: Drop use of hardcoded strings in interface comparison Strings can have typos and is a point to introduce errors. By using GeneratedClass::interface()->name we get some safety. Behavior should not be changed by this patch. Change-Id: Ic898178a6ee26ea601e905dabfe48f3bc90ed6a6 Reviewed-by: Pier Luigi Fiorini Reviewed-by: Eskil Abrahamsen Blomfeldt --- .../platforms/wayland/qwaylanddisplay.cpp | 38 +++++++++---------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index 8806773d51a..aeb5f4b8702 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -333,46 +333,46 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin { struct ::wl_registry *registry = object(); - if (interface == QStringLiteral("wl_output")) { + if (interface == QLatin1String(QtWayland::wl_output::interface()->name)) { mWaitingScreens << mWaylandIntegration->createPlatformScreen(this, version, id); - } else if (interface == QStringLiteral("wl_compositor")) { + } else if (interface == QLatin1String(QtWayland::wl_compositor::interface()->name)) { mCompositor.init(registry, id, qMin((int)version, 4)); - } else if (interface == QStringLiteral("wl_shm")) { + } else if (interface == QLatin1String(QWaylandShm::interface()->name)) { mShm.reset(new QWaylandShm(this, version, id)); - } else if (interface == QStringLiteral("wl_seat")) { + } else if (interface == QLatin1String(QWaylandInputDevice::interface()->name)) { QWaylandInputDevice *inputDevice = mWaylandIntegration->createInputDevice(this, version, id); mInputDevices.append(inputDevice); #if QT_CONFIG(wayland_datadevice) - } else if (interface == QStringLiteral("wl_data_device_manager")) { + } else if (interface == QLatin1String(QWaylandDataDeviceManager::interface()->name)) { mDndSelectionHandler.reset(new QWaylandDataDeviceManager(this, id)); #endif - } else if (interface == QStringLiteral("qt_surface_extension")) { + } else if (interface == QLatin1String(QtWayland::qt_surface_extension::interface()->name)) { mWindowExtension.reset(new QtWayland::qt_surface_extension(registry, id, 1)); - } else if (interface == QStringLiteral("wl_subcompositor")) { + } else if (interface == QLatin1String(QtWayland::wl_subcompositor::interface()->name)) { mSubCompositor.reset(new QtWayland::wl_subcompositor(registry, id, 1)); - } else if (interface == QStringLiteral("qt_touch_extension")) { + } else if (interface == QLatin1String(QWaylandTouchExtension::interface()->name)) { mTouchExtension.reset(new QWaylandTouchExtension(this, id)); - } else if (interface == QStringLiteral("zqt_key_v1")) { + } else if (interface == QLatin1String(QWaylandQtKeyExtension::interface()->name)) { mQtKeyExtension.reset(new QWaylandQtKeyExtension(this, id)); - } else if (interface == QStringLiteral("zwp_tablet_manager_v2")) { + } else if (interface == QLatin1String(QWaylandTabletManagerV2::interface()->name)) { mTabletManager.reset(new QWaylandTabletManagerV2(this, id, qMin(1, int(version)))); - } else if (interface == QStringLiteral("zwp_pointer_gestures_v1")) { + } else if (interface == QLatin1String(QWaylandPointerGestures::interface()->name)) { mPointerGestures.reset(new QWaylandPointerGestures(this, id, 1)); #if QT_CONFIG(wayland_client_primary_selection) - } else if (interface == QStringLiteral("zwp_primary_selection_device_manager_v1")) { + } else if (interface == QLatin1String(QWaylandPrimarySelectionDeviceManagerV1::interface()->name)) { mPrimarySelectionManager.reset(new QWaylandPrimarySelectionDeviceManagerV1(this, id, 1)); #endif - } else if (interface == QStringLiteral("qt_text_input_method_manager_v1") && !mClientSideInputContextRequested) { + } else if (interface == QLatin1String(QtWayland::qt_text_input_method_manager_v1::interface()->name) && !mClientSideInputContextRequested) { mTextInputMethodManager.reset(new QtWayland::qt_text_input_method_manager_v1(registry, id, 1)); for (QWaylandInputDevice *inputDevice : qAsConst(mInputDevices)) inputDevice->setTextInputMethod(new QWaylandTextInputMethod(this, mTextInputMethodManager->get_text_input_method(inputDevice->wl_seat()))); mWaylandIntegration->reconfigureInputContext(); - } else if (interface == QStringLiteral("zwp_text_input_manager_v2") && !mClientSideInputContextRequested) { + } else if (interface == QLatin1String(QtWayland::zwp_text_input_manager_v2::interface()->name) && !mClientSideInputContextRequested) { mTextInputManager.reset(new QtWayland::zwp_text_input_manager_v2(registry, id, 1)); for (QWaylandInputDevice *inputDevice : qAsConst(mInputDevices)) inputDevice->setTextInput(new QWaylandTextInput(this, mTextInputManager->get_text_input(inputDevice->wl_seat()))); mWaylandIntegration->reconfigureInputContext(); - } else if (interface == QStringLiteral("qt_hardware_integration")) { + } else if (interface == QLatin1String(QWaylandHardwareIntegration::interface()->name)) { bool disableHardwareIntegration = qEnvironmentVariableIntValue("QT_WAYLAND_DISABLE_HW_INTEGRATION"); if (!disableHardwareIntegration) { mHardwareIntegration.reset(new QWaylandHardwareIntegration(registry, id)); @@ -380,7 +380,7 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin // qt_hardware_integration before creating windows forceRoundTrip(); } - } else if (interface == QLatin1String("zxdg_output_manager_v1")) { + } else if (interface == QLatin1String(QWaylandXdgOutputManagerV1::interface()->name)) { mXdgOutputManager.reset(new QWaylandXdgOutputManagerV1(this, id, version)); for (auto *screen : qAsConst(mWaitingScreens)) screen->initXdgOutput(xdgOutputManager()); @@ -399,7 +399,7 @@ void QWaylandDisplay::registry_global_remove(uint32_t id) for (int i = 0, ie = mGlobals.count(); i != ie; ++i) { RegistryGlobal &global = mGlobals[i]; if (global.id == id) { - if (global.interface == QStringLiteral("wl_output")) { + if (global.interface == QLatin1String(QtWayland::wl_output::interface()->name)) { for (auto *screen : mWaitingScreens) { if (screen->outputId() == id) { mWaitingScreens.removeOne(screen); @@ -418,13 +418,13 @@ void QWaylandDisplay::registry_global_remove(uint32_t id) } } } - if (global.interface == QStringLiteral("zwp_text_input_manager_v2")) { + if (global.interface == QLatin1String(QtWayland::zwp_text_input_manager_v2::interface()->name)) { mTextInputManager.reset(); for (QWaylandInputDevice *inputDevice : qAsConst(mInputDevices)) inputDevice->setTextInput(nullptr); mWaylandIntegration->reconfigureInputContext(); } - if (global.interface == QStringLiteral("qt_text_input_method_manager_v1")) { + if (global.interface == QLatin1String(QtWayland::qt_text_input_method_manager_v1::interface()->name)) { mTextInputMethodManager.reset(); for (QWaylandInputDevice *inputDevice : qAsConst(mInputDevices)) inputDevice->setTextInputMethod(nullptr); From 698bea8e9a4bb0e10684834a940e5632870c668e Mon Sep 17 00:00:00 2001 From: JiDe Zhang Date: Wed, 26 May 2021 10:05:14 +0800 Subject: [PATCH 0970/1507] Use QEventPoint::State instead of Qt::TouchPointState Also fix compile warnings about -Wenum-compare. Pick-to: 6.2 6.1 6.0 5.15 Change-Id: I5e94fc028c727b155d5db4c7def35d518c497c5c Reviewed-by: Liang Qi Reviewed-by: Shawn Rutledge --- .../plugins/decorations/bradient/main.cpp | 6 +-- .../wayland/qwaylandabstractdecoration_p.h | 3 +- .../platforms/wayland/qwaylandinputdevice.cpp | 12 +++--- .../platforms/wayland/qwaylandinputdevice_p.h | 2 +- .../platforms/wayland/qwaylandtouch.cpp | 4 +- .../platforms/wayland/qwaylandwindow.cpp | 2 +- .../platforms/wayland/qwaylandwindow_p.h | 3 +- tests/auto/wayland/seatv5/tst_seatv5.cpp | 43 ++++++++++--------- 8 files changed, 39 insertions(+), 36 deletions(-) diff --git a/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp b/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp index b273a58ff41..5aa9ad4a412 100644 --- a/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp +++ b/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp @@ -76,7 +76,7 @@ protected: QMargins margins(MarginsType marginsType = Full) const override; void paint(QPaintDevice *device) override; bool handleMouse(QWaylandInputDevice *inputDevice, const QPointF &local, const QPointF &global,Qt::MouseButtons b,Qt::KeyboardModifiers mods) override; - bool handleTouch(QWaylandInputDevice *inputDevice, const QPointF &local, const QPointF &global, Qt::TouchPointState state, Qt::KeyboardModifiers mods) override; + bool handleTouch(QWaylandInputDevice *inputDevice, const QPointF &local, const QPointF &global, QEventPoint::State state, Qt::KeyboardModifiers mods) override; private: void processMouseTop(QWaylandInputDevice *inputDevice, const QPointF &local, Qt::MouseButtons b,Qt::KeyboardModifiers mods); void processMouseBottom(QWaylandInputDevice *inputDevice, const QPointF &local, Qt::MouseButtons b,Qt::KeyboardModifiers mods); @@ -293,12 +293,12 @@ bool QWaylandBradientDecoration::handleMouse(QWaylandInputDevice *inputDevice, c return true; } -bool QWaylandBradientDecoration::handleTouch(QWaylandInputDevice *inputDevice, const QPointF &local, const QPointF &global, Qt::TouchPointState state, Qt::KeyboardModifiers mods) +bool QWaylandBradientDecoration::handleTouch(QWaylandInputDevice *inputDevice, const QPointF &local, const QPointF &global, QEventPoint::State state, Qt::KeyboardModifiers mods) { Q_UNUSED(inputDevice); Q_UNUSED(global); Q_UNUSED(mods); - bool handled = state == Qt::TouchPointPressed; + bool handled = state == QEventPoint::Pressed; if (handled) { if (closeButtonRect().contains(local)) QWindowSystemInterface::handleCloseEvent(window()); diff --git a/src/plugins/platforms/wayland/qwaylandabstractdecoration_p.h b/src/plugins/platforms/wayland/qwaylandabstractdecoration_p.h index 61cbde77e90..e9fbf8461e8 100644 --- a/src/plugins/platforms/wayland/qwaylandabstractdecoration_p.h +++ b/src/plugins/platforms/wayland/qwaylandabstractdecoration_p.h @@ -59,6 +59,7 @@ #include #include #include +#include #include #include @@ -103,7 +104,7 @@ public: const QImage &contentImage(); virtual bool handleMouse(QWaylandInputDevice *inputDevice, const QPointF &local, const QPointF &global,Qt::MouseButtons b,Qt::KeyboardModifiers mods) = 0; - virtual bool handleTouch(QWaylandInputDevice *inputDevice, const QPointF &local, const QPointF &global, Qt::TouchPointState state, Qt::KeyboardModifiers mods) = 0; + virtual bool handleTouch(QWaylandInputDevice *inputDevice, const QPointF &local, const QPointF &global, QEventPoint::State state, Qt::KeyboardModifiers mods) = 0; protected: virtual void paint(QPaintDevice *device) = 0; diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index 6fe89cfcc3b..b71ffc5a5e9 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -1404,14 +1404,14 @@ void QWaylandInputDevice::Touch::touch_down(uint32_t serial, mFocus = window; mParent->mQDisplay->setLastInputDevice(mParent, serial, mFocus); QPointF position(wl_fixed_to_double(x), wl_fixed_to_double(y)); - mParent->handleTouchPoint(id, Qt::TouchPointPressed, position); + mParent->handleTouchPoint(id, QEventPoint::Pressed, position); } void QWaylandInputDevice::Touch::touch_up(uint32_t serial, uint32_t time, int32_t id) { Q_UNUSED(serial); Q_UNUSED(time); - mParent->handleTouchPoint(id, Qt::TouchPointReleased); + mParent->handleTouchPoint(id, QEventPoint::Released); if (allTouchPointsReleased()) { mFocus = nullptr; @@ -1431,7 +1431,7 @@ void QWaylandInputDevice::Touch::touch_motion(uint32_t time, int32_t id, wl_fixe { Q_UNUSED(time); QPointF position(wl_fixed_to_double(x), wl_fixed_to_double(y)); - mParent->handleTouchPoint(id, Qt::TouchPointMoved, position); + mParent->handleTouchPoint(id, QEventPoint::Updated, position); } void QWaylandInputDevice::Touch::touch_cancel() @@ -1445,7 +1445,7 @@ void QWaylandInputDevice::Touch::touch_cancel() QWindowSystemInterface::handleTouchCancelEvent(nullptr, mParent->mTouchDevice); } -void QWaylandInputDevice::handleTouchPoint(int id, Qt::TouchPointState state, const QPointF &surfacePosition) +void QWaylandInputDevice::handleTouchPoint(int id, QEventPoint::State state, const QPointF &surfacePosition) { auto end = mTouch->mPendingTouchPoints.end(); auto it = std::find_if(mTouch->mPendingTouchPoints.begin(), end, [id](const QWindowSystemInterface::TouchPoint &tp){ return tp.id == id; }); @@ -1464,7 +1464,7 @@ void QWaylandInputDevice::handleTouchPoint(int id, Qt::TouchPointState state, co QWindowSystemInterface::TouchPoint &tp = *it; // Only moved and pressed needs to update/set position - if (state == Qt::TouchPointMoved || state == Qt::TouchPointPressed) { + if (state == QEventPoint::Updated || state == QEventPoint::Pressed) { // We need a global (screen) position. QWaylandWindow *win = mTouch->mFocus; @@ -1525,7 +1525,7 @@ void QWaylandInputDevice::Touch::touch_frame() QMargins margins = window->frameMargins(); QPoint p = tp.area.center().toPoint(); QPointF localPos(window->mapFromGlobal(QPoint(p.x() + margins.left(), p.y() + margins.top()))); - if (mFocus->touchDragDecoration(mParent, localPos, tp.area.center(), Qt::TouchPointState(tp.state), mParent->modifiers())) + if (mFocus->touchDragDecoration(mParent, localPos, tp.area.center(), tp.state, mParent->modifiers())) return; } diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h index 0d408d36b33..3e648431455 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h +++ b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h @@ -207,7 +207,7 @@ protected: uint32_t mSerial = 0; void seat_capabilities(uint32_t caps) override; - void handleTouchPoint(int id, Qt::TouchPointState state, const QPointF &surfacePosition = QPoint()); + void handleTouchPoint(int id, QEventPoint::State state, const QPointF &surfacePosition = QPoint()); QPointingDevice *mTouchDevice = nullptr; QPointingDevice *mTouchPadDevice = nullptr; diff --git a/src/plugins/platforms/wayland/qwaylandtouch.cpp b/src/plugins/platforms/wayland/qwaylandtouch.cpp index 6c723903451..dea271938b5 100644 --- a/src/plugins/platforms/wayland/qwaylandtouch.cpp +++ b/src/plugins/platforms/wayland/qwaylandtouch.cpp @@ -172,7 +172,7 @@ void QWaylandTouchExtension::sendTouchEvent() states |= mTouchPoints.at(i).state; if (mFlags & QT_TOUCH_EXTENSION_FLAGS_MOUSE_FROM_TOUCH) { - const bool firstPress = states == Qt::TouchPointPressed; + const bool firstPress = states == QEventPoint::Pressed; if (firstPress) mMouseSourceId = mTouchPoints.first().id; for (int i = 0; i < mTouchPoints.count(); ++i) { @@ -199,7 +199,7 @@ void QWaylandTouchExtension::sendTouchEvent() mPrevTouchPoints = mTouchPoints; mTouchPoints.clear(); - if (states == Qt::TouchPointReleased) + if (states == QEventPoint::Released) mPrevTouchPoints.clear(); } diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 5a5d18a93cb..557d58c94d6 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -1105,7 +1105,7 @@ void QWaylandWindow::handlePinchGesture(QWaylandInputDevice *inputDevice, #endif // #ifndef QT_NO_GESTURES -bool QWaylandWindow::touchDragDecoration(QWaylandInputDevice *inputDevice, const QPointF &local, const QPointF &global, Qt::TouchPointState state, Qt::KeyboardModifiers mods) +bool QWaylandWindow::touchDragDecoration(QWaylandInputDevice *inputDevice, const QPointF &local, const QPointF &global, QEventPoint::State state, Qt::KeyboardModifiers mods) { if (!mWindowDecoration) return false; diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index 09411792e9b..a041dc40fae 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -56,6 +56,7 @@ #include #include +#include #include #include #include @@ -187,7 +188,7 @@ public: #endif bool touchDragDecoration(QWaylandInputDevice *inputDevice, const QPointF &local, const QPointF &global, - Qt::TouchPointState state, Qt::KeyboardModifiers mods); + QEventPoint::State state, Qt::KeyboardModifiers mods); bool createDecoration(); diff --git a/tests/auto/wayland/seatv5/tst_seatv5.cpp b/tests/auto/wayland/seatv5/tst_seatv5.cpp index 69c52ed5a84..7e59dbddd9f 100644 --- a/tests/auto/wayland/seatv5/tst_seatv5.cpp +++ b/tests/auto/wayland/seatv5/tst_seatv5.cpp @@ -29,6 +29,7 @@ #include "mockcompositor.h" #include #include +#include using namespace MockCompositor; @@ -449,14 +450,14 @@ void tst_seatv5::singleTap() { auto e = window.m_events.takeFirst(); QCOMPARE(e.type, QEvent::TouchBegin); - QCOMPARE(e.touchPointStates, Qt::TouchPointState::TouchPointPressed); + QCOMPARE(e.touchPointStates, QEventPoint::State::Pressed); QCOMPARE(e.touchPoints.length(), 1); QCOMPARE(e.touchPoints.first().position(), QPointF(32-window.frameMargins().left(), 32-window.frameMargins().top())); } { auto e = window.m_events.takeFirst(); QCOMPARE(e.type, QEvent::TouchEnd); - QCOMPARE(e.touchPointStates, Qt::TouchPointState::TouchPointReleased); + QCOMPARE(e.touchPointStates, QEventPoint::State::Released); QCOMPARE(e.touchPoints.length(), 1); QCOMPARE(e.touchPoints.first().position(), QPointF(32-window.frameMargins().left(), 32-window.frameMargins().top())); } @@ -480,14 +481,14 @@ void tst_seatv5::singleTapFloat() { auto e = window.m_events.takeFirst(); QCOMPARE(e.type, QEvent::TouchBegin); - QCOMPARE(e.touchPointStates, Qt::TouchPointState::TouchPointPressed); + QCOMPARE(e.touchPointStates, QEventPoint::State::Pressed); QCOMPARE(e.touchPoints.length(), 1); QCOMPARE(e.touchPoints.first().position(), QPointF(32.75-window.frameMargins().left(), 32.25-window.frameMargins().top())); } { auto e = window.m_events.takeFirst(); QCOMPARE(e.type, QEvent::TouchEnd); - QCOMPARE(e.touchPointStates, Qt::TouchPointState::TouchPointReleased); + QCOMPARE(e.touchPointStates, QEventPoint::State::Released); QCOMPARE(e.touchPoints.length(), 1); QCOMPARE(e.touchPoints.first().position(), QPointF(32.75-window.frameMargins().left(), 32.25-window.frameMargins().top())); } @@ -523,13 +524,13 @@ void tst_seatv5::multiTouch() { auto e = window.m_events.takeFirst(); QCOMPARE(e.type, QEvent::TouchBegin); - QCOMPARE(e.touchPointStates, Qt::TouchPointState::TouchPointPressed); + QCOMPARE(e.touchPointStates, QEventPoint::State::Pressed); QCOMPARE(e.touchPoints.length(), 2); - QCOMPARE(e.touchPoints[0].state(), Qt::TouchPointState::TouchPointPressed); + QCOMPARE(e.touchPoints[0].state(), QEventPoint::State::Pressed); QCOMPARE(e.touchPoints[0].position(), QPointF(32-window.frameMargins().left(), 32-window.frameMargins().top())); - QCOMPARE(e.touchPoints[1].state(), Qt::TouchPointState::TouchPointPressed); + QCOMPARE(e.touchPoints[1].state(), QEventPoint::State::Pressed); QCOMPARE(e.touchPoints[1].position(), QPointF(48-window.frameMargins().left(), 48-window.frameMargins().top())); } { @@ -537,30 +538,30 @@ void tst_seatv5::multiTouch() QCOMPARE(e.type, QEvent::TouchUpdate); QCOMPARE(e.touchPoints.length(), 2); - QCOMPARE(e.touchPoints[0].state(), Qt::TouchPointState::TouchPointMoved); + QCOMPARE(e.touchPoints[0].state(), QEventPoint::State::Updated); QCOMPARE(e.touchPoints[0].position(), QPointF(33-window.frameMargins().left(), 32-window.frameMargins().top())); - QCOMPARE(e.touchPoints[1].state(), Qt::TouchPointState::TouchPointMoved); + QCOMPARE(e.touchPoints[1].state(), QEventPoint::State::Updated); QCOMPARE(e.touchPoints[1].position(), QPointF(49-window.frameMargins().left(), 48-window.frameMargins().top())); } { auto e = window.m_events.takeFirst(); QCOMPARE(e.type, QEvent::TouchUpdate); - QCOMPARE(e.touchPointStates, Qt::TouchPointState::TouchPointReleased | Qt::TouchPointState::TouchPointStationary); + QCOMPARE(e.touchPointStates, QEventPoint::State::Released | QEventPoint::State::Stationary); QCOMPARE(e.touchPoints.length(), 2); - QCOMPARE(e.touchPoints[0].state(), Qt::TouchPointState::TouchPointReleased); + QCOMPARE(e.touchPoints[0].state(), QEventPoint::State::Released); QCOMPARE(e.touchPoints[0].position(), QPointF(33-window.frameMargins().left(), 32-window.frameMargins().top())); - QCOMPARE(e.touchPoints[1].state(), Qt::TouchPointState::TouchPointStationary); + QCOMPARE(e.touchPoints[1].state(), QEventPoint::State::Stationary); QCOMPARE(e.touchPoints[1].position(), QPointF(49-window.frameMargins().left(), 48-window.frameMargins().top())); } { auto e = window.m_events.takeFirst(); QCOMPARE(e.type, QEvent::TouchEnd); - QCOMPARE(e.touchPointStates, Qt::TouchPointState::TouchPointReleased); + QCOMPARE(e.touchPointStates, QEventPoint::State::Released); QCOMPARE(e.touchPoints.length(), 1); - QCOMPARE(e.touchPoints[0].state(), Qt::TouchPointState::TouchPointReleased); + QCOMPARE(e.touchPoints[0].state(), QEventPoint::State::Released); QCOMPARE(e.touchPoints[0].position(), QPointF(49-window.frameMargins().left(), 48-window.frameMargins().top())); } } @@ -595,21 +596,21 @@ void tst_seatv5::multiTouchUpAndMotionFrame() { auto e = window.m_events.takeFirst(); QCOMPARE(e.type, QEvent::TouchBegin); - QCOMPARE(e.touchPoints[0].state(), Qt::TouchPointState::TouchPointPressed); - QCOMPARE(e.touchPoints[1].state(), Qt::TouchPointState::TouchPointPressed); + QCOMPARE(e.touchPoints[0].state(), QEventPoint::State::Pressed); + QCOMPARE(e.touchPoints[1].state(), QEventPoint::State::Pressed); } { auto e = window.m_events.takeFirst(); QCOMPARE(e.type, QEvent::TouchUpdate); QCOMPARE(e.touchPoints.length(), 2); - QCOMPARE(e.touchPoints[0].state(), Qt::TouchPointState::TouchPointReleased); - QCOMPARE(e.touchPoints[1].state(), Qt::TouchPointState::TouchPointMoved); + QCOMPARE(e.touchPoints[0].state(), QEventPoint::State::Released); + QCOMPARE(e.touchPoints[1].state(), QEventPoint::State::Updated); } { auto e = window.m_events.takeFirst(); QCOMPARE(e.type, QEvent::TouchEnd); QCOMPARE(e.touchPoints.length(), 1); - QCOMPARE(e.touchPoints[0].state(), Qt::TouchPointState::TouchPointReleased); + QCOMPARE(e.touchPoints[0].state(), QEventPoint::State::Released); } QVERIFY(window.m_events.empty()); } @@ -637,13 +638,13 @@ void tst_seatv5::tapAndMoveInSameFrame() auto e = window.m_events.takeFirst(); QCOMPARE(e.type, QEvent::TouchBegin); QCOMPARE(e.touchPoints.size(), 1); - QCOMPARE(e.touchPoints[0].state(), Qt::TouchPointState::TouchPointPressed); + QCOMPARE(e.touchPoints[0].state(), QEventPoint::State::Pressed); // Position isn't that important, we just want to make sure we actually get the pressed event } // Make sure we eventually release QTRY_VERIFY(!window.m_events.empty()); - QTRY_COMPARE(window.m_events.last().touchPoints.first().state(), Qt::TouchPointState::TouchPointReleased); + QTRY_COMPARE(window.m_events.last().touchPoints.first().state(), QEventPoint::State::Released); } QCOMPOSITOR_TEST_MAIN(tst_seatv5) From 46641fddcde3e658676a94f09d9cb4bd4e7289fb Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Fri, 18 Jun 2021 17:07:44 +0200 Subject: [PATCH 0971/1507] Restructure configure features Create a new module WaylandGlobalPrivate that is merely a collection of build features that are shared by client, compositor and plugins of qtwayland. Move the features wayland-client and wayland-server to WaylandGlobalPrivate to be able to access both features in src/CMakeLists.txt. This removes the need for explicitly including the configure.cmake files of client and compositor, which fixes QTBUG-88261. Move the features that are defined in both, client and compositor, to WaylandGlobalPrivate. The module is defined in src/CMakeLists.txt to ensure that the targets created by the qt_find_package calls in src/configure.cmake are accessible in subdirectories below src/. We need the (nearly) empty src/global directory to satisfy syncqt. We cannot pass NO_SYNC_QT to qt_internal_add_module, because that prevents the creation of qtwaylandglobal-config_p.h. Fixes: QTBUG-88261 Fixes: QTBUG-91705 Change-Id: I776632a86ffe96886dc12f1f675f9ab56a2faf2a Reviewed-by: Qt CI Bot Reviewed-by: Alexandru Croitor Reviewed-by: Alexey Edelev --- src/platformsupport/wayland/CMakeLists.txt | 26 +- src/platformsupport/wayland/configure.cmake | 249 ++++++++++++++++++ src/plugins/platforms/wayland/CMakeLists.txt | 2 + src/plugins/platforms/wayland/configure.cmake | 200 -------------- .../platforms/wayland/globalprivate/README | 9 + .../wayland/qtwaylandclientglobal_p.h | 2 +- 6 files changed, 263 insertions(+), 225 deletions(-) create mode 100644 src/platformsupport/wayland/configure.cmake create mode 100644 src/plugins/platforms/wayland/globalprivate/README diff --git a/src/platformsupport/wayland/CMakeLists.txt b/src/platformsupport/wayland/CMakeLists.txt index d970fcf5250..6787e9cbceb 100644 --- a/src/platformsupport/wayland/CMakeLists.txt +++ b/src/platformsupport/wayland/CMakeLists.txt @@ -11,30 +11,8 @@ configure the module on targets that are missing dependencies.") return() endif() -# We conditionally add_subdirectory(client) based on a feature that is defined -# in client/configure.cmake, so we need this hack to make sure the feature is -# defined on this level as well. -# TODO: when we remove configure.json support and stop generating -# configure.cmake, we should move the features up one level and deduplicate the -# features shared with the compositor. -qt_feature_module_begin( - NO_MODULE - PUBLIC_FILE "qtwayland-client-config.h" - PRIVATE_FILE "qtwayland-client-config_p.h" -) -include("${CMAKE_CURRENT_SOURCE_DIR}/client/configure.cmake") -qt_feature_module_end(NO_MODULE) - -# Similar hack as above, but for the compositor -qt_feature_module_begin( - NO_MODULE - PUBLIC_FILE "qtwayland-compositor-config.h" - PRIVATE_FILE "qtwayland-compositor-config_p.h" -) -include("${CMAKE_CURRENT_SOURCE_DIR}/compositor/configure.cmake") -qt_feature_module_end(NO_MODULE) -# special case end - +# See global/README for a description of the following module. +qt_internal_add_module(WaylandGlobalPrivate INTERNAL_MODULE HEADER_MODULE) add_subdirectory(qtwaylandscanner) # special case begin diff --git a/src/platformsupport/wayland/configure.cmake b/src/platformsupport/wayland/configure.cmake new file mode 100644 index 00000000000..6939fbe9495 --- /dev/null +++ b/src/platformsupport/wayland/configure.cmake @@ -0,0 +1,249 @@ +# configure.cmake for the QtWaylandGlobalPrivate module + +#### Inputs + + + +#### Libraries + +if(LINUX OR QT_FIND_ALL_PACKAGES_ALWAYS) + # waylandclient libraries + qt_find_package(Wayland + PROVIDED_TARGETS Wayland::Client + MODULE_NAME waylandclient + QMAKE_LIB wayland-client) + qt_find_package(Wayland + PROVIDED_TARGETS Wayland::Cursor + MODULE_NAME waylandclient + QMAKE_LIB wayland-cursor) + qt_add_qmake_lib_dependency(wayland-cursor wayland-client) + qt_find_package(Wayland + PROVIDED_TARGETS Wayland::Egl + MODULE_NAME waylandclient + QMAKE_LIB wayland-egl) + qt_find_package(XComposite + PROVIDED_TARGETS PkgConfig::XComposite + MODULE_NAME waylandclient QMAKE_LIB xcomposite) + + # waylandcompositor libraries + qt_find_package(Wayland + PROVIDED_TARGETS Wayland::Server + MODULE_NAME waylandcompositor + QMAKE_LIB wayland-server) + qt_find_package(Wayland + PROVIDED_TARGETS Wayland::Egl + MODULE_NAME waylandcompositor + QMAKE_LIB wayland-egl) + qt_find_package(XComposite + PROVIDED_TARGETS PkgConfig::XComposite + MODULE_NAME waylandcompositor QMAKE_LIB xcomposite) + + # X11 is not a public dependency of QtGui anymore, so we need to find it manually in a shared build. + # In a static build the dependency is still propagated, so check for the target existence to prevent + # the 'Attempt to promote imported target "X11::X11" to global scope' issue. + if(NOT TARGET X11::X11) + qt_find_package(X11 PROVIDED_TARGETS X11::X11 MODULE_NAME gui QMAKE_LIB xlib) + endif() + # Same for XKB. + if(NOT TARGET XKB::XKB) + qt_find_package(XKB 0.5.0 PROVIDED_TARGETS XKB::XKB MODULE_NAME gui QMAKE_LIB xkbcommon MARK_OPTIONAL) + endif() +endif() + + +#### Tests + +# drm-egl-server +qt_config_compile_test(drm_egl_server + LABEL "DRM EGL Server" + LIBRARIES + EGL::EGL + CODE + " +#include +#include + +int main(int argc, char **argv) +{ + (void)argc; (void)argv; + /* BEGIN TEST: */ +#ifdef EGL_MESA_drm_image +return 0; +#else +#error Requires EGL_MESA_drm_image to be defined +return 1; +#endif + /* END TEST: */ + return 0; +} +") + +# libhybris-egl-server +qt_config_compile_test(libhybris_egl_server + LABEL "libhybris EGL Server" + LIBRARIES + EGL::EGL + CODE + " +#include +#include +#include + +int main(int argc, char **argv) +{ + (void)argc; (void)argv; + /* BEGIN TEST: */ +#ifdef EGL_HYBRIS_native_buffer +return 0; +#else +#error Requires EGL_HYBRIS_native_buffer to be defined +return 1; +#endif + /* END TEST: */ + return 0; +} +") + +# dmabuf-server-buffer +qt_config_compile_test(dmabuf_server_buffer + LABEL "Linux dma-buf Buffer Sharing" + LIBRARIES + EGL::EGL + Libdrm::Libdrm + CODE + " +#include +#include +#include + +int main(int argc, char **argv) +{ + (void)argc; (void)argv; + /* BEGIN TEST: */ +#ifdef EGL_LINUX_DMA_BUF_EXT +return 0; +#else +#error Requires EGL_LINUX_DMA_BUF_EXT +return 1; +#endif + /* END TEST: */ + return 0; +} +") + +# vulkan-server-buffer +qt_config_compile_test(vulkan_server_buffer + LABEL "Vulkan Buffer Sharing" + CODE + "#define VK_USE_PLATFORM_WAYLAND_KHR 1 +#include + +int main(int argc, char **argv) +{ + (void)argc; (void)argv; + /* BEGIN TEST: */ +VkExportMemoryAllocateInfoKHR exportAllocInfo = {}; +exportAllocInfo.sType = VK_STRUCTURE_TYPE_EXPORT_MEMORY_ALLOCATE_INFO_KHR; +exportAllocInfo.handleTypes = VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT_KHR; +return 0; + /* END TEST: */ + return 0; +} +") + +# egl_1_5-wayland +qt_config_compile_test(egl_1_5_wayland + LABEL "EGL 1.5 with Wayland Platform" + LIBRARIES + EGL::EGL + CODE + " +#include +#include +#include + +int main(int argc, char **argv) +{ + (void)argc; (void)argv; + /* BEGIN TEST: */ +eglGetPlatformDisplay(EGL_PLATFORM_WAYLAND_EXT, (struct wl_display *)(nullptr), nullptr); + /* END TEST: */ + return 0; +} +") + + +#### Features + +qt_feature("wayland-client" PRIVATE + LABEL "Qt Wayland Client" + CONDITION NOT WIN32 AND Wayland_FOUND AND WaylandScanner_FOUND +) +qt_feature("wayland-server" PRIVATE + LABEL "Qt Wayland Compositor" + CONDITION NOT WIN32 AND Wayland_FOUND AND WaylandScanner_FOUND +) +qt_feature("wayland-egl" PRIVATE + LABEL "EGL" + CONDITION (QT_FEATURE_wayland_client OR QT_FEATURE_wayland_server) + AND QT_FEATURE_opengl AND QT_FEATURE_egl + AND (NOT QNX OR QT_FEATURE_egl_extension_platform_wayland) +) +qt_feature("wayland-brcm" PRIVATE + LABEL "Raspberry Pi" + CONDITION (QT_FEATURE_wayland_client OR QT_FEATURE_wayland_server) AND QT_FEATURE_eglfs_brcm +) +qt_feature("wayland-drm-egl-server-buffer" PRIVATE + LABEL "DRM EGL" + CONDITION (QT_FEATURE_wayland_client OR QT_FEATURE_wayland_server) AND QT_FEATURE_opengl + AND QT_FEATURE_egl AND TEST_drm_egl_server + AND (NOT QNX OR QT_FEATURE_egl_extension_platform_wayland) +) +qt_feature("wayland-libhybris-egl-server-buffer" PRIVATE + LABEL "libhybris EGL" + CONDITION (QT_FEATURE_wayland_client OR QT_FEATURE_wayland_server) AND QT_FEATURE_opengl + AND QT_FEATURE_egl AND TEST_libhybris_egl_server +) +qt_feature("wayland-dmabuf-server-buffer" PRIVATE + LABEL "Linux dma-buf server buffer integration" + CONDITION (QT_FEATURE_wayland_client OR QT_FEATURE_wayland_server) AND QT_FEATURE_opengl + AND QT_FEATURE_egl AND TEST_dmabuf_server_buffer +) +qt_feature("wayland-shm-emulation-server-buffer" PRIVATE + LABEL "Shm emulation server buffer integration" + CONDITION (QT_FEATURE_wayland_client OR QT_FEATURE_wayland_server) AND QT_FEATURE_opengl +) +qt_feature("wayland-vulkan-server-buffer" PRIVATE + LABEL "Vulkan-based server buffer integration" + CONDITION (QT_FEATURE_wayland_client OR QT_FEATURE_wayland_server) AND QT_FEATURE_vulkan + AND QT_FEATURE_opengl AND QT_FEATURE_egl AND TEST_vulkan_server_buffer +) +qt_feature("wayland-datadevice" PRIVATE + CONDITION QT_FEATURE_draganddrop OR QT_FEATURE_clipboard +) +qt_feature("xcomposite-egl" PRIVATE + LABEL "XComposite EGL" + CONDITION (QT_FEATURE_wayland_client OR QT_FEATURE_wayland_server) + AND QT_FEATURE_opengl AND QT_FEATURE_egl AND QT_FEATURE_xlib + AND XComposite_FOUND AND QT_FEATURE_egl_x11 +) +qt_feature("xcomposite-glx" PRIVATE + LABEL "XComposite GLX" + CONDITION (QT_FEATURE_wayland_client OR QT_FEATURE_wayland_server) + AND QT_FEATURE_opengl AND NOT QT_FEATURE_opengles2 + AND QT_FEATURE_xlib AND XComposite_FOUND +) + +qt_configure_add_summary_entry(ARGS "wayland-client") +qt_configure_add_summary_entry(ARGS "wayland-server") +qt_configure_add_summary_section(NAME "Qt Wayland Drivers") +qt_configure_add_summary_entry(ARGS "wayland-egl") +qt_configure_add_summary_entry(ARGS "wayland-brcm") +qt_configure_add_summary_entry(ARGS "wayland-drm-egl-server-buffer") +qt_configure_add_summary_entry(ARGS "wayland-libhybris-egl-server-buffer") +qt_configure_add_summary_entry(ARGS "wayland-dmabuf-server-buffer") +qt_configure_add_summary_entry(ARGS "wayland-shm-emulation-server-buffer") +qt_configure_add_summary_entry(ARGS "wayland-vulkan-server-buffer") +qt_configure_add_summary_entry(ARGS "xcomposite-egl") +qt_configure_add_summary_entry(ARGS "xcomposite-glx") +qt_configure_end_summary_section() # end of "Qt Wayland Drivers" section diff --git a/src/plugins/platforms/wayland/CMakeLists.txt b/src/plugins/platforms/wayland/CMakeLists.txt index 1e1b83893db..c4656286471 100644 --- a/src/plugins/platforms/wayland/CMakeLists.txt +++ b/src/plugins/platforms/wayland/CMakeLists.txt @@ -58,6 +58,7 @@ qt_internal_add_module(WaylandClient LIBRARIES Qt::CorePrivate Qt::GuiPrivate + Qt::WaylandGlobalPrivate PUBLIC_LIBRARIES Qt::Core Qt::Gui @@ -65,6 +66,7 @@ qt_internal_add_module(WaylandClient PRIVATE_MODULE_INTERFACE Qt::CorePrivate Qt::GuiPrivate + Qt::WaylandGlobalPrivate ) qt6_generate_wayland_protocol_client_sources(WaylandClient diff --git a/src/plugins/platforms/wayland/configure.cmake b/src/plugins/platforms/wayland/configure.cmake index 11612d11fec..c90204d0ec4 100644 --- a/src/plugins/platforms/wayland/configure.cmake +++ b/src/plugins/platforms/wayland/configure.cmake @@ -1,167 +1,15 @@ - - #### Inputs #### Libraries -if((LINUX) OR QT_FIND_ALL_PACKAGES_ALWAYS) - qt_find_package(Wayland PROVIDED_TARGETS Wayland::Client MODULE_NAME waylandclient QMAKE_LIB wayland-client) -endif() -if((LINUX) OR QT_FIND_ALL_PACKAGES_ALWAYS) - qt_find_package(Wayland PROVIDED_TARGETS Wayland::Cursor MODULE_NAME waylandclient QMAKE_LIB wayland-cursor) -endif() -qt_add_qmake_lib_dependency(wayland-cursor wayland-client) -if((LINUX) OR QT_FIND_ALL_PACKAGES_ALWAYS) - qt_find_package(Wayland PROVIDED_TARGETS Wayland::Egl MODULE_NAME waylandclient QMAKE_LIB wayland-egl) -endif() -qt_find_package(XComposite PROVIDED_TARGETS PkgConfig::XComposite MODULE_NAME waylandclient QMAKE_LIB xcomposite) -# special case begin -# X11 is not a public dependency of QtGui anymore, so we need to find it manually in a shared build. -# In a static build the dependency is still propagated, so check for the target existence to prevent -# the 'Attempt to promote imported target "X11::X11" to global scope' issue. -if(NOT TARGET X11::X11) - qt_find_package(X11 PROVIDED_TARGETS X11::X11 MODULE_NAME gui QMAKE_LIB xlib) -endif() -# Same for XKB. -if(NOT TARGET XKB::XKB) - qt_find_package(XKB 0.5.0 PROVIDED_TARGETS XKB::XKB MODULE_NAME gui QMAKE_LIB xkbcommon MARK_OPTIONAL) -endif() -# special case end #### Tests -# drm-egl-server -qt_config_compile_test(drm_egl_server - LABEL "DRM EGL Server" - LIBRARIES - EGL::EGL - CODE -" -#include -#include - -int main(int argc, char **argv) -{ - (void)argc; (void)argv; - /* BEGIN TEST: */ -#ifdef EGL_MESA_drm_image -return 0; -#else -#error Requires EGL_MESA_drm_image to be defined -return 1; -#endif - /* END TEST: */ - return 0; -} -") - -# libhybris-egl-server -qt_config_compile_test(libhybris_egl_server - LABEL "libhybris EGL Server" - LIBRARIES - EGL::EGL - CODE -" -#include -#include -#include - -int main(int argc, char **argv) -{ - (void)argc; (void)argv; - /* BEGIN TEST: */ -#ifdef EGL_HYBRIS_native_buffer -return 0; -#else -#error Requires EGL_HYBRIS_native_buffer to be defined -return 1; -#endif - /* END TEST: */ - return 0; -} -") - -# dmabuf-server-buffer -qt_config_compile_test(dmabuf_server_buffer - LABEL "Linux dma-buf Buffer Sharing" - LIBRARIES - EGL::EGL - Libdrm::Libdrm - CODE -" -#include -#include -#include - -int main(int argc, char **argv) -{ - (void)argc; (void)argv; - /* BEGIN TEST: */ -#ifdef EGL_LINUX_DMA_BUF_EXT -return 0; -#else -#error Requires EGL_LINUX_DMA_BUF_EXT -return 1; -#endif - /* END TEST: */ - return 0; -} -") - -# vulkan-server-buffer -qt_config_compile_test(vulkan_server_buffer - LABEL "Vulkan Buffer Sharing" - CODE -"#define VK_USE_PLATFORM_WAYLAND_KHR 1 -#include - -int main(int argc, char **argv) -{ - (void)argc; (void)argv; - /* BEGIN TEST: */ -VkExportMemoryAllocateInfoKHR exportAllocInfo = {}; -exportAllocInfo.sType = VK_STRUCTURE_TYPE_EXPORT_MEMORY_ALLOCATE_INFO_KHR; -exportAllocInfo.handleTypes = VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT_KHR; -return 0; - /* END TEST: */ - return 0; -} -") - -# egl_1_5-wayland -qt_config_compile_test(egl_1_5_wayland - LABEL "EGL 1.5 with Wayland Platform" - LIBRARIES - EGL::EGL - CODE -" -#include -#include -#include - -int main(int argc, char **argv) -{ - (void)argc; (void)argv; - /* BEGIN TEST: */ -eglGetPlatformDisplay(EGL_PLATFORM_WAYLAND_EXT, (struct wl_display *)(nullptr), nullptr); - /* END TEST: */ - return 0; -} -") - - #### Features -qt_feature("wayland-client" PRIVATE - LABEL "Qt Wayland Client" - CONDITION NOT WIN32 AND Wayland_FOUND AND Wayland_FOUND AND WaylandScanner_FOUND -) -qt_feature("wayland-datadevice" PRIVATE - CONDITION QT_FEATURE_draganddrop OR QT_FEATURE_clipboard -) qt_feature("wayland-client-primary-selection" PRIVATE LABEL "primary-selection clipboard" CONDITION QT_FEATURE_clipboard @@ -186,53 +34,6 @@ qt_feature("egl-extension-platform-wayland" PRIVATE LABEL "EGL wayland platform extension" CONDITION QT_FEATURE_wayland_client AND QT_FEATURE_opengl AND QT_FEATURE_egl AND TEST_egl_1_5_wayland ) -qt_feature("wayland-egl" PRIVATE - LABEL "EGL" - CONDITION QT_FEATURE_wayland_client AND QT_FEATURE_opengl AND QT_FEATURE_egl AND Wayland_FOUND AND ( NOT QNX OR QT_FEATURE_egl_extension_platform_wayland ) -) -qt_feature("wayland-brcm" PRIVATE - LABEL "Raspberry Pi" - CONDITION QT_FEATURE_wayland_client AND QT_FEATURE_eglfs_brcm -) -qt_feature("xcomposite-egl" PRIVATE - LABEL "XComposite EGL" - CONDITION QT_FEATURE_wayland_client AND QT_FEATURE_opengl AND QT_FEATURE_egl AND QT_FEATURE_xlib AND XComposite_FOUND AND QT_FEATURE_egl_x11 -) -qt_feature("xcomposite-glx" PRIVATE - LABEL "XComposite GLX" - CONDITION QT_FEATURE_wayland_client AND QT_FEATURE_opengl AND NOT QT_FEATURE_opengles2 AND QT_FEATURE_xlib AND XComposite_FOUND -) -qt_feature("wayland-drm-egl-server-buffer" PRIVATE - LABEL "DRM EGL" - CONDITION QT_FEATURE_wayland_client AND QT_FEATURE_opengl AND QT_FEATURE_egl AND TEST_drm_egl_server AND ( NOT QNX OR QT_FEATURE_egl_extension_platform_wayland ) -) -qt_feature("wayland-libhybris-egl-server-buffer" PRIVATE - LABEL "libhybris EGL" - CONDITION QT_FEATURE_wayland_client AND QT_FEATURE_opengl AND QT_FEATURE_egl AND TEST_libhybris_egl_server -) -qt_feature("wayland-dmabuf-server-buffer" PRIVATE - LABEL "Linux dma-buf server buffer integration" - CONDITION QT_FEATURE_wayland_client AND QT_FEATURE_opengl AND QT_FEATURE_egl AND TEST_dmabuf_server_buffer -) -qt_feature("wayland-vulkan-server-buffer" PRIVATE - LABEL "Vulkan-based server buffer integration" - CONDITION QT_FEATURE_wayland_client AND QT_FEATURE_vulkan AND QT_FEATURE_opengl AND QT_FEATURE_egl AND TEST_vulkan_server_buffer -) -qt_feature("wayland-shm-emulation-server-buffer" PRIVATE - LABEL "Shm emulation server buffer integration" - CONDITION QT_FEATURE_wayland_client AND QT_FEATURE_opengl -) -qt_configure_add_summary_section(NAME "Qt Wayland Drivers") -qt_configure_add_summary_entry(ARGS "wayland-egl") -qt_configure_add_summary_entry(ARGS "wayland-brcm") -qt_configure_add_summary_entry(ARGS "xcomposite-egl") -qt_configure_add_summary_entry(ARGS "xcomposite-glx") -qt_configure_add_summary_entry(ARGS "wayland-drm-egl-server-buffer") -qt_configure_add_summary_entry(ARGS "wayland-libhybris-egl-server-buffer") -qt_configure_add_summary_entry(ARGS "wayland-dmabuf-server-buffer") -qt_configure_add_summary_entry(ARGS "wayland-vulkan-server-buffer") -qt_configure_add_summary_entry(ARGS "wayland-shm-emulation-server-buffer") -qt_configure_end_summary_section() # end of "Qt Wayland Drivers" section qt_configure_add_summary_section(NAME "Qt Wayland Client Shell Integrations") qt_configure_add_summary_entry(ARGS "wayland-client-xdg-shell") qt_configure_add_summary_entry(ARGS "wayland-client-xdg-shell-v5") @@ -240,4 +41,3 @@ qt_configure_add_summary_entry(ARGS "wayland-client-xdg-shell-v6") qt_configure_add_summary_entry(ARGS "wayland-client-ivi-shell") qt_configure_add_summary_entry(ARGS "wayland-client-wl-shell") qt_configure_end_summary_section() # end of "Qt Wayland Client Shell Integrations" section -qt_configure_add_summary_entry(ARGS "wayland-client") diff --git a/src/plugins/platforms/wayland/globalprivate/README b/src/plugins/platforms/wayland/globalprivate/README new file mode 100644 index 00000000000..9b045d4d2e0 --- /dev/null +++ b/src/plugins/platforms/wayland/globalprivate/README @@ -0,0 +1,9 @@ +The WaylandGlobalPrivate module is a module that contains configure +features, shared by the modules of the qtwayland repository. + +The actual definition of this module is in src/CMakeLists.txt, +because we need to have the qt_find_package calls in a directory scope +above src/client and src/compositor. + +This file here mostly exists to make the otherwise empty src/global +directory known to git. diff --git a/src/plugins/platforms/wayland/qtwaylandclientglobal_p.h b/src/plugins/platforms/wayland/qtwaylandclientglobal_p.h index f2106d0b875..1a0840b6e76 100644 --- a/src/plugins/platforms/wayland/qtwaylandclientglobal_p.h +++ b/src/plugins/platforms/wayland/qtwaylandclientglobal_p.h @@ -51,9 +51,9 @@ // We mean it. // +#include #include #include #include #endif //QWAYLANDCLIENTGLOBAL_P_H - From 80c336554d3673840cb17091549db77fab11e343 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Tue, 6 Jul 2021 18:24:11 +0200 Subject: [PATCH 0972/1507] CMake: Don't give plugins PUBLIC usage requirements The pro2cmake.py conversion script faithfully reproduced the .pro files for the plugins, which specified the libraries as public. But in CMake, the implications of this are that public usage requirements should then be propagated to consumers. We don't expect any consumers, since a plugin is created as a MODULE library in CMake, so for Windows we don't even have an import library to link with. The only exception to this is for static builds where plugins are created as STATIC libraries instead, but only in certain controlled situations do we then link to plugins. Even then, usage requirements are not expected to propagate to the consumers, so these relationships should always be specified as private. Pick-to: 6.2 Task-number: QTBUG-90819 Change-Id: Ia7a8f27d4eecf067055511577ec664ad857905cd Reviewed-by: Qt CI Bot Reviewed-by: Alexandru Croitor --- .../wayland/plugins/decorations/bradient/CMakeLists.txt | 2 +- .../plugins/hardwareintegration/dmabuf-server/CMakeLists.txt | 2 +- .../plugins/hardwareintegration/drm-egl-server/CMakeLists.txt | 2 +- .../hardwareintegration/shm-emulation-server/CMakeLists.txt | 2 +- .../plugins/hardwareintegration/vulkan-server/CMakeLists.txt | 2 +- .../plugins/hardwareintegration/wayland-egl/CMakeLists.txt | 2 +- .../plugins/hardwareintegration/xcomposite-egl/CMakeLists.txt | 2 +- .../plugins/hardwareintegration/xcomposite-glx/CMakeLists.txt | 2 +- .../shellintegration/fullscreen-shell-v1/CMakeLists.txt | 2 +- .../wayland/plugins/shellintegration/wl-shell/CMakeLists.txt | 4 ++-- .../wayland/plugins/shellintegration/xdg-shell/CMakeLists.txt | 2 +- 11 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/plugins/platforms/wayland/plugins/decorations/bradient/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/decorations/bradient/CMakeLists.txt index 0384eefcd8b..a914ea3c959 100644 --- a/src/plugins/platforms/wayland/plugins/decorations/bradient/CMakeLists.txt +++ b/src/plugins/platforms/wayland/plugins/decorations/bradient/CMakeLists.txt @@ -9,7 +9,7 @@ qt_internal_add_plugin(QWaylandBradientDecorationPlugin TYPE wayland-decoration-client SOURCES main.cpp - PUBLIC_LIBRARIES + LIBRARIES Qt::Core Qt::Gui Qt::WaylandClientPrivate diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/dmabuf-server/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/hardwareintegration/dmabuf-server/CMakeLists.txt index bda31db01b0..8476ef7b714 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/dmabuf-server/CMakeLists.txt +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/dmabuf-server/CMakeLists.txt @@ -12,7 +12,7 @@ qt_internal_add_plugin(DmaBufServerBufferPlugin main.cpp INCLUDE_DIRECTORIES ../../../../hardwareintegration/client/dmabuf-server - PUBLIC_LIBRARIES + LIBRARIES EGL::EGL Qt::Core Qt::Gui diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/drm-egl-server/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/hardwareintegration/drm-egl-server/CMakeLists.txt index b2eabcf447f..5e0b08d0a79 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/drm-egl-server/CMakeLists.txt +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/drm-egl-server/CMakeLists.txt @@ -12,7 +12,7 @@ qt_internal_add_plugin(DrmEglServerBufferPlugin main.cpp INCLUDE_DIRECTORIES ../../../../hardwareintegration/client/drm-egl-server - PUBLIC_LIBRARIES + LIBRARIES EGL::EGL Qt::Core Qt::Gui diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/shm-emulation-server/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/hardwareintegration/shm-emulation-server/CMakeLists.txt index 6b68ab8eb74..326dd82549e 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/shm-emulation-server/CMakeLists.txt +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/shm-emulation-server/CMakeLists.txt @@ -12,7 +12,7 @@ qt_internal_add_plugin(ShmServerBufferPlugin main.cpp INCLUDE_DIRECTORIES ../../../../hardwareintegration/client/shm-emulation-server - PUBLIC_LIBRARIES + LIBRARIES Qt::Core Qt::Gui Qt::OpenGL diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/vulkan-server/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/hardwareintegration/vulkan-server/CMakeLists.txt index 3cfde46805d..bda421edadf 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/vulkan-server/CMakeLists.txt +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/vulkan-server/CMakeLists.txt @@ -12,7 +12,7 @@ qt_internal_add_plugin(VulkanServerBufferPlugin main.cpp INCLUDE_DIRECTORIES ../../../../hardwareintegration/client/vulkan-server - PUBLIC_LIBRARIES + LIBRARIES Qt::Core Qt::Gui Qt::OpenGL diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/CMakeLists.txt index 5baeb7168a4..a3062eec08c 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/CMakeLists.txt +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/CMakeLists.txt @@ -10,7 +10,7 @@ qt_internal_add_plugin(QWaylandEglClientBufferPlugin TYPE wayland-graphics-integration-client SOURCES main.cpp - PUBLIC_LIBRARIES + LIBRARIES Qt::Core Qt::Gui Qt::WaylandClientPrivate diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-egl/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-egl/CMakeLists.txt index 9b7324ccd74..fa61db72fba 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-egl/CMakeLists.txt +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-egl/CMakeLists.txt @@ -17,7 +17,7 @@ qt_internal_add_plugin(QWaylandXCompositeEglClientBufferPlugin INCLUDE_DIRECTORIES ../../../../hardwareintegration/client/xcomposite-egl ../../../../hardwareintegration/client/xcomposite_share - PUBLIC_LIBRARIES + LIBRARIES EGL::EGL PkgConfig::XComposite Qt::Core diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-glx/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-glx/CMakeLists.txt index 0f0ea0733b2..819f10eb743 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-glx/CMakeLists.txt +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-glx/CMakeLists.txt @@ -16,7 +16,7 @@ qt_internal_add_plugin(QWaylandXCompositeGlxClientBufferPlugin INCLUDE_DIRECTORIES ../../../../hardwareintegration/client/xcomposite-glx ../../../../hardwareintegration/client/xcomposite_share - PUBLIC_LIBRARIES + LIBRARIES ${CMAKE_DL_LIBS} PkgConfig::XComposite Qt::Core diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/fullscreen-shell-v1/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/shellintegration/fullscreen-shell-v1/CMakeLists.txt index 686cfbcb6b9..b4b73cdc2b5 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/fullscreen-shell-v1/CMakeLists.txt +++ b/src/plugins/platforms/wayland/plugins/shellintegration/fullscreen-shell-v1/CMakeLists.txt @@ -11,7 +11,7 @@ qt_internal_add_plugin(QWaylandFullScreenShellV1IntegrationPlugin main.cpp qwaylandfullscreenshellv1integration.cpp qwaylandfullscreenshellv1integration.h qwaylandfullscreenshellv1surface.cpp qwaylandfullscreenshellv1surface.h - PUBLIC_LIBRARIES + LIBRARIES Qt::Core Qt::Gui Qt::GuiPrivate diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/CMakeLists.txt index d7c052fa438..85ed7b0aa12 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/CMakeLists.txt +++ b/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/CMakeLists.txt @@ -10,7 +10,7 @@ qt_internal_add_module(WlShellIntegrationPrivate SOURCES qwaylandwlshellintegration.cpp qwaylandwlshellintegration_p.h qwaylandwlshellsurface.cpp qwaylandwlshellsurface_p.h - PUBLIC_LIBRARIES + LIBRARIES Qt::GuiPrivate Qt::WaylandClientPrivate Wayland::Client @@ -42,7 +42,7 @@ qt_internal_add_plugin(QWaylandWlShellIntegrationPlugin TYPE wayland-shell-integration SOURCES main.cpp - PUBLIC_LIBRARIES + LIBRARIES Qt::GuiPrivate Qt::WaylandClientPrivate Qt::WlShellIntegrationPrivate diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/CMakeLists.txt index 88a78df7f35..81db88a9cf0 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/CMakeLists.txt +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/CMakeLists.txt @@ -12,7 +12,7 @@ qt_internal_add_plugin(QWaylandXdgShellIntegrationPlugin qwaylandxdgdecorationv1.cpp qwaylandxdgdecorationv1_p.h qwaylandxdgshell.cpp qwaylandxdgshell_p.h qwaylandxdgshellintegration.cpp qwaylandxdgshellintegration_p.h - PUBLIC_LIBRARIES + LIBRARIES Qt::Core Qt::Gui Qt::GuiPrivate From c4b1dbfc069172bc08c7ff36f385b91bf43e2ae6 Mon Sep 17 00:00:00 2001 From: Aleix Pol Date: Tue, 13 Jul 2021 13:32:15 +0200 Subject: [PATCH 0973/1507] Do not update the mask if we do not have a surface mMask serves as a cache to remember what we've sent, the source of truth for the value is window()->mask(). No need to store values that we are going to discard, because it will confuse the state of newly created windows. Change-Id: I6aa3da82c7f09c7ef90d0f7060f292fb042730f0 Pick-to: 5.15 6.2 Reviewed-by: David Edmundson --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 557d58c94d6..2a0fdaf6b0b 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -478,15 +478,15 @@ void QWaylandWindow::lower() void QWaylandWindow::setMask(const QRegion &mask) { + QReadLocker locker(&mSurfaceLock); + if (!mSurface) + return; + if (mMask == mask) return; mMask = mask; - QReadLocker locker(&mSurfaceLock); - if (!mSurface) - return; - if (mMask.isEmpty()) { mSurface->set_input_region(nullptr); From cd995a7adffbd08c6668f5ae598773c3ff1d438a Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Fri, 28 May 2021 13:39:18 +0200 Subject: [PATCH 0974/1507] Improve categorized logging output Change-Id: I8e4b48af21fe41bc76f83baa89e79a0e0fe8037c Reviewed-by: Povilas Kanapickas Reviewed-by: Volker Hilsheimer --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 2a0fdaf6b0b..5ad4d754971 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -985,7 +985,7 @@ void QWaylandWindow::handleSwipeGesture(QWaylandInputDevice *inputDevice, switch (e.state) { case Qt::GestureStarted: if (mGestureState != GestureNotActive) - qCWarning(lcQpaWaylandInput) << "Unexpected gesture state. Gestures will act weird."; + qCWarning(lcQpaWaylandInput) << "Unexpected GestureStarted while already active"; if (mWindowDecoration && !mMouseEventsInContentArea) { // whole gesture sequence will be ignored @@ -1018,7 +1018,7 @@ void QWaylandWindow::handleSwipeGesture(QWaylandInputDevice *inputDevice, } if (mGestureState != GestureActiveInContentArea) - qCWarning(lcQpaWaylandInput) << "Unexpected gesture state. Gestures will act weird."; + qCWarning(lcQpaWaylandInput) << "Unexpected" << (e.state == Qt::GestureFinished ? "GestureFinished" : "GestureCanceled"); mGestureState = GestureNotActive; @@ -1040,7 +1040,7 @@ void QWaylandWindow::handlePinchGesture(QWaylandInputDevice *inputDevice, switch (e.state) { case Qt::GestureStarted: if (mGestureState != GestureNotActive) - qCWarning(lcQpaWaylandInput) << "Unexpected gesture state. Gestures will act weird."; + qCWarning(lcQpaWaylandInput) << "Unexpected GestureStarted while already active"; if (mWindowDecoration && !mMouseEventsInContentArea) { // whole gesture sequence will be ignored @@ -1087,7 +1087,7 @@ void QWaylandWindow::handlePinchGesture(QWaylandInputDevice *inputDevice, } if (mGestureState != GestureActiveInContentArea) - qCWarning(lcQpaWaylandInput) << "Unexpected gesture state. Gestures will act weird."; + qCWarning(lcQpaWaylandInput) << "Unexpected" << (e.state == Qt::GestureFinished ? "GestureFinished" : "GestureCanceled"); mGestureState = GestureNotActive; From a43bf3fc73daea82ab3790bf07882e0d078a2fd8 Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Tue, 13 Jul 2021 12:33:01 +0200 Subject: [PATCH 0975/1507] Use QPointF for native gesture delta values Needed after qtbase e3aa45006dc883adb92b4c94a0108d3b75012dce and de540c283d96630c189df9c9be37f68ad8285056. Pick-to: 6.2 Change-Id: Ieb199eca9d550d9e8e4963458508a91ec9db1728 Reviewed-by: Volker Hilsheimer --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 5ad4d754971..2ca45259f72 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -1004,10 +1004,10 @@ void QWaylandWindow::handleSwipeGesture(QWaylandInputDevice *inputDevice, return; if (!e.delta.isNull()) { - QWindowSystemInterface::handleGestureEventWithValueAndDeltas( + QWindowSystemInterface::handleGestureEventWithValueAndDelta( window(), e.timestamp, inputDevice->mTouchPadDevice, Qt::PanNativeGesture, - 0, QVector2D(e.delta), e.local, e.global, e.fingers); + 0, e.delta, e.local, e.global, e.fingers); } break; case Qt::GestureFinished: @@ -1059,10 +1059,10 @@ void QWaylandWindow::handlePinchGesture(QWaylandInputDevice *inputDevice, return; if (!e.delta.isNull()) { - QWindowSystemInterface::handleGestureEventWithValueAndDeltas( + QWindowSystemInterface::handleGestureEventWithValueAndDelta( window(), e.timestamp, inputDevice->mTouchPadDevice, Qt::PanNativeGesture, - 0, QVector2D(e.delta), e.local, e.global, e.fingers); + 0, e.delta, e.local, e.global, e.fingers); } if (e.rotation_delta != 0) { QWindowSystemInterface::handleGestureEventWithRealValue(window(), e.timestamp, From 1b0445156d38c4a2ee1f4769ce4ac6941605df22 Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Wed, 14 Jul 2021 12:06:20 +0100 Subject: [PATCH 0976/1507] Client: Drop unused member variable Change-Id: I9b3f1d1a2ff2e9658604778e1ab4b8b7c030e1ac Reviewed-by: Paul Olav Tvete --- src/plugins/platforms/wayland/qwaylanddisplay_p.h | 1 - 1 file changed, 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay_p.h b/src/plugins/platforms/wayland/qwaylanddisplay_p.h index ae80cd33c77..a027eb8955a 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay_p.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay_p.h @@ -285,7 +285,6 @@ private: QScopedPointer mTextInputManager; QScopedPointer mHardwareIntegration; QScopedPointer mXdgOutputManager; - QSocketNotifier *mReadNotifier = nullptr; int mFd = -1; int mWritableNotificationFd = -1; QList mGlobals; From 9ec8d463aad27371e7e6e4d5642d5559d31278f4 Mon Sep 17 00:00:00 2001 From: Alexey Edelev Date: Fri, 30 Jul 2021 15:21:50 +0200 Subject: [PATCH 0977/1507] Adjust INTERFACE_MODULE_HAS_HEADERS property name After introducing the _qt_module_has_headers target property, it's better to replace the INTERFACE_MODULE_HAS_HEADERS use by _qt_module_has_headers since properties duplicate each other. Pick-to: 6.2 Change-Id: Ia1b35cc21bf31fce593c374d196aa450e6fd7e08 Reviewed-by: Alexandru Croitor --- src/tools/qtwaylandscanner/Qt6WaylandClientMacros.cmake | 2 +- src/tools/qtwaylandscanner/Qt6WaylandCompositorMacros.cmake | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/tools/qtwaylandscanner/Qt6WaylandClientMacros.cmake b/src/tools/qtwaylandscanner/Qt6WaylandClientMacros.cmake index 6bda08e70fc..879841a075a 100644 --- a/src/tools/qtwaylandscanner/Qt6WaylandClientMacros.cmake +++ b/src/tools/qtwaylandscanner/Qt6WaylandClientMacros.cmake @@ -39,7 +39,7 @@ function(qt6_generate_wayland_protocol_client_sources target) set(wayland_include_dir "${arg_WAYLAND_INCLUDE_DIR}") else() get_target_property(qt_module ${target} _qt_module_interface_name) - get_target_property(is_for_module "${target}" INTERFACE_MODULE_HAS_HEADERS) + get_target_property(is_for_module "${target}" _qt_module_has_headers) if (qt_module) set(wayland_include_dir "Qt${qt_module}/private") elseif (is_for_module) diff --git a/src/tools/qtwaylandscanner/Qt6WaylandCompositorMacros.cmake b/src/tools/qtwaylandscanner/Qt6WaylandCompositorMacros.cmake index 3fb08b3a743..a9e79ce45c2 100644 --- a/src/tools/qtwaylandscanner/Qt6WaylandCompositorMacros.cmake +++ b/src/tools/qtwaylandscanner/Qt6WaylandCompositorMacros.cmake @@ -37,7 +37,7 @@ function(qt6_generate_wayland_protocol_server_sources target) set(wayland_include_dir "${arg_WAYLAND_INCLUDE_DIR}") else() get_target_property(qt_module ${target} _qt_module_interface_name) - get_target_property(is_for_module "${target}" INTERFACE_MODULE_HAS_HEADERS) + get_target_property(is_for_module "${target}" _qt_module_has_headers) if (qt_module) set(wayland_include_dir "Qt${qt_module}/private") elseif (is_for_module) From 6e14376d6d3d65354d396b86ae82e421252718d8 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Tue, 3 Aug 2021 15:36:29 +0200 Subject: [PATCH 0978/1507] Fix building standalone examples with CMake Building standalone examples with CMake failed with The following imported targets are referenced, but are missing: Qt6::WaylandGlobalPrivate Fix this by recording the extra package dependency for WaylandClient and WaylandCompositor. This amends commit 46641fddcde3e658676a94f09d9cb4bd4e7289fb. Fixes: QTBUG-95388 Change-Id: If6e1f3673dc59b1c50f25077677a21f7ff4f0cb7 Reviewed-by: Alexandru Croitor --- src/plugins/platforms/wayland/CMakeLists.txt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/plugins/platforms/wayland/CMakeLists.txt b/src/plugins/platforms/wayland/CMakeLists.txt index c4656286471..2f13911316e 100644 --- a/src/plugins/platforms/wayland/CMakeLists.txt +++ b/src/plugins/platforms/wayland/CMakeLists.txt @@ -139,6 +139,5 @@ qt_internal_extend_target(WaylandClient CONDITION QT_FEATURE_draganddrop qwaylanddnd.cpp qwaylanddnd_p.h ) -# special case begin qt_record_extra_qt_main_tools_package_dependency(WaylandClient WaylandScannerTools "${PROJECT_VERSION}") -# special case end +qt_record_extra_qt_package_dependency(WaylandClient WaylandGlobalPrivate "${PROJECT_VERSION}") From 8c657f5819404623cef38e3fddf8b1767ee62152 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Wed, 4 Aug 2021 10:34:42 +0200 Subject: [PATCH 0979/1507] CMake: Make WAYLAND_INCLUDE_DIR argument internal As discussed in QTBUG-95177, this argument of qt6_generate_wayland_protocol_{client|server}_sources is for internal use only and should not be exposed publicly. Rename this argument to __QT_INTERNAL_WAYLAND_INCLUDE_DIR. Fixes: QTBUG-95177 Change-Id: I1437007b4bfd398372a932ec09a5eba0daa9af69 Reviewed-by: Alexandru Croitor --- .../plugins/shellintegration/wl-shell/CMakeLists.txt | 2 +- src/tools/qtwaylandscanner/Qt6WaylandClientMacros.cmake | 6 +++--- src/tools/qtwaylandscanner/Qt6WaylandCompositorMacros.cmake | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/CMakeLists.txt index 85ed7b0aa12..38033e03131 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/CMakeLists.txt +++ b/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/CMakeLists.txt @@ -18,7 +18,7 @@ qt_internal_add_module(WlShellIntegrationPrivate qt6_generate_wayland_protocol_client_sources(WlShellIntegrationPrivate # this is just a helper module and still part of the QtWaylandClient build - WAYLAND_INCLUDE_DIR QtWaylandClient/private + __QT_INTERNAL_WAYLAND_INCLUDE_DIR QtWaylandClient/private FILES ${CMAKE_CURRENT_SOURCE_DIR}/../../../3rdparty/protocol/wayland.xml ) diff --git a/src/tools/qtwaylandscanner/Qt6WaylandClientMacros.cmake b/src/tools/qtwaylandscanner/Qt6WaylandClientMacros.cmake index 879841a075a..c810325955e 100644 --- a/src/tools/qtwaylandscanner/Qt6WaylandClientMacros.cmake +++ b/src/tools/qtwaylandscanner/Qt6WaylandClientMacros.cmake @@ -1,5 +1,5 @@ function(qt6_generate_wayland_protocol_client_sources target) - cmake_parse_arguments(arg "" "WAYLAND_INCLUDE_DIR" "FILES" ${ARGN}) + cmake_parse_arguments(arg "" "__QT_INTERNAL_WAYLAND_INCLUDE_DIR" "FILES" ${ARGN}) if(DEFINED arg_UNPARSED_ARGUMENTS) message(FATAL_ERROR "Unknown arguments were passed to qt6_generate_wayland_protocol_client_sources: (${arg_UNPARSED_ARGUMENTS}).") endif() @@ -35,8 +35,8 @@ function(qt6_generate_wayland_protocol_client_sources target) ) set(wayland_include_dir "") - if(arg_WAYLAND_INCLUDE_DIR) - set(wayland_include_dir "${arg_WAYLAND_INCLUDE_DIR}") + if(arg___QT_INTERNAL_WAYLAND_INCLUDE_DIR) + set(wayland_include_dir "${arg___QT_INTERNAL_WAYLAND_INCLUDE_DIR}") else() get_target_property(qt_module ${target} _qt_module_interface_name) get_target_property(is_for_module "${target}" _qt_module_has_headers) diff --git a/src/tools/qtwaylandscanner/Qt6WaylandCompositorMacros.cmake b/src/tools/qtwaylandscanner/Qt6WaylandCompositorMacros.cmake index a9e79ce45c2..92ad04696b4 100644 --- a/src/tools/qtwaylandscanner/Qt6WaylandCompositorMacros.cmake +++ b/src/tools/qtwaylandscanner/Qt6WaylandCompositorMacros.cmake @@ -1,5 +1,5 @@ function(qt6_generate_wayland_protocol_server_sources target) - cmake_parse_arguments(arg "" "WAYLAND_INCLUDE_DIR" "FILES" ${ARGN}) + cmake_parse_arguments(arg "" "__QT_INTERNAL_WAYLAND_INCLUDE_DIR" "FILES" ${ARGN}) if(DEFINED arg_UNPARSED_ARGUMENTS) message(FATAL_ERROR "Unknown arguments were passed to qt6_generate_wayland_protocol_server_sources: (${arg_UNPARSED_ARGUMENTS}).") endif() @@ -33,8 +33,8 @@ function(qt6_generate_wayland_protocol_server_sources target) ) set(wayland_include_dir "") - if(arg_WAYLAND_INCLUDE_DIR) - set(wayland_include_dir "${arg_WAYLAND_INCLUDE_DIR}") + if(arg___QT_INTERNAL_WAYLAND_INCLUDE_DIR) + set(wayland_include_dir "${arg___QT_INTERNAL_WAYLAND_INCLUDE_DIR}") else() get_target_property(qt_module ${target} _qt_module_interface_name) get_target_property(is_for_module "${target}" _qt_module_has_headers) From 2a966bcd13a276407bddeb659630131a9ea7ca62 Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Thu, 5 Aug 2021 13:04:07 +0200 Subject: [PATCH 0980/1507] CMake: Use renamed qt6_add_plugin PLUGIN_TYPE option Task-number: QTBUG-95170 Pick-to: 6.2 Change-Id: I60fd4ef84fb4887294bde766790b279d12f1288a Reviewed-by: Kai Koehne --- .../wayland/plugins/decorations/bradient/CMakeLists.txt | 2 +- .../wayland/plugins/hardwareintegration/brcm-egl/CMakeLists.txt | 2 +- .../plugins/hardwareintegration/dmabuf-server/CMakeLists.txt | 2 +- .../plugins/hardwareintegration/drm-egl-server/CMakeLists.txt | 2 +- .../hardwareintegration/libhybris-egl-server/CMakeLists.txt | 2 +- .../hardwareintegration/shm-emulation-server/CMakeLists.txt | 2 +- .../plugins/hardwareintegration/vulkan-server/CMakeLists.txt | 2 +- .../plugins/hardwareintegration/wayland-egl/CMakeLists.txt | 2 +- .../plugins/hardwareintegration/xcomposite-egl/CMakeLists.txt | 2 +- .../plugins/hardwareintegration/xcomposite-glx/CMakeLists.txt | 2 +- .../plugins/shellintegration/fullscreen-shell-v1/CMakeLists.txt | 2 +- .../wayland/plugins/shellintegration/wl-shell/CMakeLists.txt | 2 +- .../wayland/plugins/shellintegration/xdg-shell/CMakeLists.txt | 2 +- 13 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/plugins/platforms/wayland/plugins/decorations/bradient/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/decorations/bradient/CMakeLists.txt index a914ea3c959..6f36d506c71 100644 --- a/src/plugins/platforms/wayland/plugins/decorations/bradient/CMakeLists.txt +++ b/src/plugins/platforms/wayland/plugins/decorations/bradient/CMakeLists.txt @@ -6,7 +6,7 @@ qt_internal_add_plugin(QWaylandBradientDecorationPlugin OUTPUT_NAME bradient - TYPE wayland-decoration-client + PLUGIN_TYPE wayland-decoration-client SOURCES main.cpp LIBRARIES diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/CMakeLists.txt index 5cf358b006c..b1304c7f7d8 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/CMakeLists.txt +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/CMakeLists.txt @@ -6,7 +6,7 @@ qt_internal_add_plugin(QWaylandBrcmEglClientBufferPlugin OUTPUT_NAME brcm-egl - TYPE wayland-graphics-integration-client + PLUGIN_TYPE wayland-graphics-integration-client SOURCES ../../../../hardwareintegration/client/brcm-egl/qwaylandbrcmeglintegration.cpp ../../../../hardwareintegration/client/brcm-egl/qwaylandbrcmeglintegration.h ../../../../hardwareintegration/client/brcm-egl/qwaylandbrcmeglwindow.cpp ../../../../hardwareintegration/client/brcm-egl/qwaylandbrcmeglwindow.h diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/dmabuf-server/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/hardwareintegration/dmabuf-server/CMakeLists.txt index 8476ef7b714..9104dbc75e7 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/dmabuf-server/CMakeLists.txt +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/dmabuf-server/CMakeLists.txt @@ -6,7 +6,7 @@ qt_internal_add_plugin(DmaBufServerBufferPlugin OUTPUT_NAME dmabuf-server - TYPE wayland-graphics-integration-client + PLUGIN_TYPE wayland-graphics-integration-client SOURCES ../../../../hardwareintegration/client/dmabuf-server/dmabufserverbufferintegration.cpp ../../../../hardwareintegration/client/dmabuf-server/dmabufserverbufferintegration.h main.cpp diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/drm-egl-server/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/hardwareintegration/drm-egl-server/CMakeLists.txt index 5e0b08d0a79..1c91dd74b75 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/drm-egl-server/CMakeLists.txt +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/drm-egl-server/CMakeLists.txt @@ -6,7 +6,7 @@ qt_internal_add_plugin(DrmEglServerBufferPlugin OUTPUT_NAME drm-egl-server - TYPE wayland-graphics-integration-client + PLUGIN_TYPE wayland-graphics-integration-client SOURCES ../../../../hardwareintegration/client/drm-egl-server/drmeglserverbufferintegration.cpp ../../../../hardwareintegration/client/drm-egl-server/drmeglserverbufferintegration.h main.cpp diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/libhybris-egl-server/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/hardwareintegration/libhybris-egl-server/CMakeLists.txt index ed3c4c98fbe..32c6f6d7ee2 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/libhybris-egl-server/CMakeLists.txt +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/libhybris-egl-server/CMakeLists.txt @@ -6,7 +6,7 @@ qt_internal_add_plugin(LibHybrisEglServerBufferPlugin OUTPUT_NAME libhybris-egl-server - TYPE wayland-graphics-integration-client + PLUGIN_TYPE wayland-graphics-integration-client SOURCES ../../../../hardwareintegration/client/libhybris-egl-server/libhybriseglserverbufferintegration.cpp ../../../../hardwareintegration/client/libhybris-egl-server/libhybriseglserverbufferintegration.h main.cpp diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/shm-emulation-server/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/hardwareintegration/shm-emulation-server/CMakeLists.txt index 326dd82549e..679039e132f 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/shm-emulation-server/CMakeLists.txt +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/shm-emulation-server/CMakeLists.txt @@ -6,7 +6,7 @@ qt_internal_add_plugin(ShmServerBufferPlugin OUTPUT_NAME shm-emulation-server - TYPE wayland-graphics-integration-client + PLUGIN_TYPE wayland-graphics-integration-client SOURCES ../../../../hardwareintegration/client/shm-emulation-server/shmserverbufferintegration.cpp ../../../../hardwareintegration/client/shm-emulation-server/shmserverbufferintegration.h main.cpp diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/vulkan-server/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/hardwareintegration/vulkan-server/CMakeLists.txt index bda421edadf..c6beea9b2a5 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/vulkan-server/CMakeLists.txt +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/vulkan-server/CMakeLists.txt @@ -6,7 +6,7 @@ qt_internal_add_plugin(VulkanServerBufferPlugin OUTPUT_NAME vulkan-server - TYPE wayland-graphics-integration-client + PLUGIN_TYPE wayland-graphics-integration-client SOURCES ../../../../hardwareintegration/client/vulkan-server/vulkanserverbufferintegration.cpp ../../../../hardwareintegration/client/vulkan-server/vulkanserverbufferintegration.h main.cpp diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/CMakeLists.txt index a3062eec08c..39f05ca12f3 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/CMakeLists.txt +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/CMakeLists.txt @@ -7,7 +7,7 @@ qt_find_package(EGL) # special case qt_internal_add_plugin(QWaylandEglClientBufferPlugin OUTPUT_NAME qt-plugin-wayland-egl - TYPE wayland-graphics-integration-client + PLUGIN_TYPE wayland-graphics-integration-client SOURCES main.cpp LIBRARIES diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-egl/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-egl/CMakeLists.txt index fa61db72fba..fe546d7d12e 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-egl/CMakeLists.txt +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-egl/CMakeLists.txt @@ -7,7 +7,7 @@ qt_find_package(EGL) # special case qt_internal_add_plugin(QWaylandXCompositeEglClientBufferPlugin OUTPUT_NAME xcomposite-egl - TYPE wayland-graphics-integration-client + PLUGIN_TYPE wayland-graphics-integration-client SOURCES ../../../../hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglclientbufferintegration.cpp ../../../../hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglclientbufferintegration.h ../../../../hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglcontext.cpp ../../../../hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglcontext.h diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-glx/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-glx/CMakeLists.txt index 819f10eb743..b4d7340b8a3 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-glx/CMakeLists.txt +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-glx/CMakeLists.txt @@ -6,7 +6,7 @@ qt_internal_add_plugin(QWaylandXCompositeGlxClientBufferPlugin OUTPUT_NAME xcomposite-glx - TYPE wayland-graphics-integration-client + PLUGIN_TYPE wayland-graphics-integration-client SOURCES ../../../../hardwareintegration/client/xcomposite-glx/qwaylandxcompositeglxcontext.cpp ../../../../hardwareintegration/client/xcomposite-glx/qwaylandxcompositeglxcontext.h ../../../../hardwareintegration/client/xcomposite-glx/qwaylandxcompositeglxintegration.cpp ../../../../hardwareintegration/client/xcomposite-glx/qwaylandxcompositeglxintegration.h diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/fullscreen-shell-v1/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/shellintegration/fullscreen-shell-v1/CMakeLists.txt index b4b73cdc2b5..ee02e1ebf67 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/fullscreen-shell-v1/CMakeLists.txt +++ b/src/plugins/platforms/wayland/plugins/shellintegration/fullscreen-shell-v1/CMakeLists.txt @@ -6,7 +6,7 @@ qt_internal_add_plugin(QWaylandFullScreenShellV1IntegrationPlugin OUTPUT_NAME fullscreen-shell-v1 - TYPE wayland-shell-integration + PLUGIN_TYPE wayland-shell-integration SOURCES main.cpp qwaylandfullscreenshellv1integration.cpp qwaylandfullscreenshellv1integration.h diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/CMakeLists.txt index 38033e03131..6b9ff55fe6b 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/CMakeLists.txt +++ b/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/CMakeLists.txt @@ -39,7 +39,7 @@ qt_internal_extend_target(WlShellIntegrationPrivate CONDITION QT_FEATURE_xkbcomm qt_internal_add_plugin(QWaylandWlShellIntegrationPlugin OUTPUT_NAME wl-shell-plugin - TYPE wayland-shell-integration + PLUGIN_TYPE wayland-shell-integration SOURCES main.cpp LIBRARIES diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/CMakeLists.txt index 81db88a9cf0..62e3952bd9e 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/CMakeLists.txt +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/CMakeLists.txt @@ -6,7 +6,7 @@ qt_internal_add_plugin(QWaylandXdgShellIntegrationPlugin OUTPUT_NAME xdg-shell - TYPE wayland-shell-integration + PLUGIN_TYPE wayland-shell-integration SOURCES main.cpp qwaylandxdgdecorationv1.cpp qwaylandxdgdecorationv1_p.h From fba81e2346dd4e7eed6a666ec7afd58c9e9e097a Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Tue, 17 Aug 2021 13:54:01 +0200 Subject: [PATCH 0981/1507] Avoid memory leaks in QWaylandInputDevice Use QScopedPointer and QObject-parenting to get rid of the allocated objects. Change-Id: I8a0ce2d1bae6a69b458a01731489813ef2aa8044 Reviewed-by: Shawn Rutledge Reviewed-by: David Edmundson Reviewed-by: Pier Luigi Fiorini --- .../platforms/wayland/qwaylanddatadevice.cpp | 3 +- .../platforms/wayland/qwaylandinputdevice.cpp | 59 ++++++++----------- .../platforms/wayland/qwaylandinputdevice_p.h | 10 ++-- 3 files changed, 32 insertions(+), 40 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylanddatadevice.cpp b/src/plugins/platforms/wayland/qwaylanddatadevice.cpp index 54a69c3c792..d63838f7b95 100644 --- a/src/plugins/platforms/wayland/qwaylanddatadevice.cpp +++ b/src/plugins/platforms/wayland/qwaylanddatadevice.cpp @@ -64,7 +64,8 @@ QT_BEGIN_NAMESPACE namespace QtWaylandClient { QWaylandDataDevice::QWaylandDataDevice(QWaylandDataDeviceManager *manager, QWaylandInputDevice *inputDevice) - : QtWayland::wl_data_device(manager->get_data_device(inputDevice->wl_seat())) + : QObject(inputDevice) + , QtWayland::wl_data_device(manager->get_data_device(inputDevice->wl_seat())) , m_display(manager->display()) , m_inputDevice(inputDevice) { diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index b71ffc5a5e9..46b84f4570b 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -429,66 +429,57 @@ QWaylandInputDevice::QWaylandInputDevice(QWaylandDisplay *display, int version, mTabletSeat.reset(new QWaylandTabletSeatV2(tm, this)); } -QWaylandInputDevice::~QWaylandInputDevice() -{ - delete mPointer; - delete mKeyboard; - delete mTouch; -} +// Can't be in header because dtors for scoped pointers aren't known there. +QWaylandInputDevice::~QWaylandInputDevice() = default; void QWaylandInputDevice::seat_capabilities(uint32_t caps) { mCaps = caps; if (caps & WL_SEAT_CAPABILITY_KEYBOARD && !mKeyboard) { - mKeyboard = createKeyboard(this); + mKeyboard.reset(createKeyboard(this)); mKeyboard->init(get_keyboard()); } else if (!(caps & WL_SEAT_CAPABILITY_KEYBOARD) && mKeyboard) { - delete mKeyboard; - mKeyboard = nullptr; + mKeyboard.reset(); } if (caps & WL_SEAT_CAPABILITY_POINTER && !mPointer) { - mPointer = createPointer(this); + mPointer.reset(createPointer(this)); mPointer->init(get_pointer()); auto *pointerGestures = mQDisplay->pointerGestures(); if (pointerGestures) { // NOTE: The name of the device and its system ID are not exposed on Wayland. - mTouchPadDevice = new QPointingDevice(QLatin1String("touchpad"), 0, - QInputDevice::DeviceType::TouchPad, - QPointingDevice::PointerType::Finger, - QInputDevice::Capability::Position, - MaxTouchPoints, 0); + mTouchPadDevice = new QPointingDevice( + QLatin1String("touchpad"), 0, QInputDevice::DeviceType::TouchPad, + QPointingDevice::PointerType::Finger, QInputDevice::Capability::Position, + MaxTouchPoints, 0, QString(), QPointingDeviceUniqueId(), this); QWindowSystemInterface::registerInputDevice(mTouchPadDevice); - mPointerGesturePinch = pointerGestures->createPointerGesturePinch(this); + mPointerGesturePinch.reset(pointerGestures->createPointerGesturePinch(this)); mPointerGesturePinch->init(pointerGestures->get_pinch_gesture(get_pointer())); - mPointerGestureSwipe = pointerGestures->createPointerGestureSwipe(this); + mPointerGestureSwipe.reset(pointerGestures->createPointerGestureSwipe(this)); mPointerGestureSwipe->init(pointerGestures->get_swipe_gesture(get_pointer())); } } else if (!(caps & WL_SEAT_CAPABILITY_POINTER) && mPointer) { - delete mPointer; - mPointer = nullptr; - delete mPointerGesturePinch; - mPointerGesturePinch = nullptr; - delete mPointerGestureSwipe; - mPointerGestureSwipe = nullptr; + mPointer.reset(); + mPointerGesturePinch.reset(); + mPointerGestureSwipe.reset(); } if (caps & WL_SEAT_CAPABILITY_TOUCH && !mTouch) { - mTouch = createTouch(this); + mTouch.reset(createTouch(this)); mTouch->init(get_touch()); if (!mTouchDevice) { // TODO number of touchpoints, actual name and ID - mTouchDevice = new QPointingDevice(QLatin1String("some touchscreen"), 0, - QInputDevice::DeviceType::TouchScreen, QPointingDevice::PointerType::Finger, - QInputDevice::Capability::Position, MaxTouchPoints, 0); + mTouchDevice = new QPointingDevice( + QLatin1String("some touchscreen"), 0, QInputDevice::DeviceType::TouchScreen, + QPointingDevice::PointerType::Finger, QInputDevice::Capability::Position, + MaxTouchPoints, 0,QString(), QPointingDeviceUniqueId(), this); QWindowSystemInterface::registerInputDevice(mTouchDevice); } } else if (!(caps & WL_SEAT_CAPABILITY_TOUCH) && mTouch) { - delete mTouch; - mTouch = nullptr; + mTouch.reset(); } } @@ -509,27 +500,27 @@ QWaylandInputDevice::Touch *QWaylandInputDevice::createTouch(QWaylandInputDevice QWaylandInputDevice::Keyboard *QWaylandInputDevice::keyboard() const { - return mKeyboard; + return mKeyboard.data(); } QWaylandInputDevice::Pointer *QWaylandInputDevice::pointer() const { - return mPointer; + return mPointer.data(); } QWaylandPointerGestureSwipe *QWaylandInputDevice::pointerGestureSwipe() const { - return mPointerGestureSwipe; + return mPointerGestureSwipe.data(); } QWaylandPointerGesturePinch *QWaylandInputDevice::pointerGesturePinch() const { - return mPointerGesturePinch; + return mPointerGesturePinch.data(); } QWaylandInputDevice::Touch *QWaylandInputDevice::touch() const { - return mTouch; + return mTouch.data(); } void QWaylandInputDevice::handleEndDrag() diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h index 3e648431455..b9d7451b529 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h +++ b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h @@ -193,11 +193,11 @@ protected: QScopedPointer mPrimarySelectionDevice; #endif - Keyboard *mKeyboard = nullptr; - Pointer *mPointer = nullptr; - QWaylandPointerGestureSwipe *mPointerGestureSwipe = nullptr; - QWaylandPointerGesturePinch *mPointerGesturePinch = nullptr; - Touch *mTouch = nullptr; + QScopedPointer mKeyboard; + QScopedPointer mPointer; + QScopedPointer mPointerGestureSwipe; + QScopedPointer mPointerGesturePinch; + QScopedPointer mTouch; QScopedPointer mTextInput; QScopedPointer mTextInputMethod; From 16d383ce6806f24b78cea7c4243a4c8d88a22a36 Mon Sep 17 00:00:00 2001 From: Jan Blackquill Date: Tue, 24 Aug 2021 14:36:34 -0400 Subject: [PATCH 0982/1507] Correctly detect if image format is supported by QImageWriter The code queries potential image formats by stripping a mimetype of its 'image/' prefix and making the rest of the mimetype capitalised, such as 'image/png' -> 'PNG'. The problem is that this is then searched for in QImageWriter::supportedImageFormats() by simple equality. The method returns a list of lowercase byte arrays, not uppercase. As the codepath can never match due to checking for an uppercase word in an array of lowercase words, this means that images are effectively always sent as BMP format, even if they should be sent in other formats, such as PNG or JPEG. A simple inspection with GDB (or a qDebug) reveals this: ``` (gdb) p QImageWriter::supportedImageFormats() $31 = {"bmp" = {...}, "bw" = {...}, "cur" = {...}, "eps" = {...}, "epsf" = {...}, "epsi" = {...}, "icns" = {...}, "ico" = {...}, "jp2" = {...}, "jpeg" = {...}, "jpg" = {...}, "pbm" = {...}, "pcx" = {...}, "pgm" = {...}, "pic" = {...}, "png" = {...}, "ppm" = {...}, "rgb" = {...}, "rgba" = {...}, "sgi" = {...}, "tga" = {...}, "tif" = {...}, "tiff" = {...}, "wbmp" = {...}, "webp" = {...}, "xbm" = {...}, "xpm" = {...}} ``` ``` (gdb) p QImageWriter::supportedImageFormats().contains("PNG") $32 = false ``` ``` (gdb) p QImageWriter::supportedImageFormats().contains("png") $33 = true ``` The fix for this is simple: lowercase the remainder of the mimetype, instead of uppercasing it, and we can start hitting the codepath that's supposed to write non-BMP formats. Change-Id: Id3e9b730b7edcabcb2f1b04d8ef0a4c1fb9c9159 Reviewed-by: David Edmundson Reviewed-by: Qt CI Bot --- src/plugins/platforms/wayland/shared/qwaylandmimehelper.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/shared/qwaylandmimehelper.cpp b/src/plugins/platforms/wayland/shared/qwaylandmimehelper.cpp index a5fdd34dec4..051a91dcfb6 100644 --- a/src/plugins/platforms/wayland/shared/qwaylandmimehelper.cpp +++ b/src/plugins/platforms/wayland/shared/qwaylandmimehelper.cpp @@ -60,7 +60,7 @@ QByteArray QWaylandMimeHelper::getByteArray(QMimeData *mimeData, const QString & buf.open(QIODevice::ReadWrite); QByteArray fmt = "BMP"; if (mimeType.startsWith(QLatin1String("image/"))) { - QByteArray imgFmt = mimeType.mid(6).toUpper().toLatin1(); + QByteArray imgFmt = mimeType.mid(6).toLower().toLatin1(); if (QImageWriter::supportedImageFormats().contains(imgFmt)) fmt = imgFmt; } From 0402f082db34577c4ef38b8d4a7ae0ac2436568e Mon Sep 17 00:00:00 2001 From: Craig Scott Date: Wed, 1 Sep 2021 14:35:15 +1000 Subject: [PATCH 0983/1507] Ensure versionless wrappers do not introduce a new variable scope Using function instead of macro prevented the wrappers from being able to pass back any variables set by the wrapped function in the calling scope. Prefer macros to avoid future changes which might do this from silently swallowing such variable setting. Task-number: QTBUG-96121 Pick-to: 6.2 Change-Id: I293999c8054c2572e9145974a9ffac661f70bf35 Reviewed-by: Joerg Bornemann --- src/tools/qtwaylandscanner/Qt6WaylandClientMacros.cmake | 4 ++-- src/tools/qtwaylandscanner/Qt6WaylandCompositorMacros.cmake | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/tools/qtwaylandscanner/Qt6WaylandClientMacros.cmake b/src/tools/qtwaylandscanner/Qt6WaylandClientMacros.cmake index c810325955e..f618f3ddcfd 100644 --- a/src/tools/qtwaylandscanner/Qt6WaylandClientMacros.cmake +++ b/src/tools/qtwaylandscanner/Qt6WaylandClientMacros.cmake @@ -82,7 +82,7 @@ function(qt6_generate_wayland_protocol_client_sources target) endfunction() if(NOT QT_NO_CREATE_VERSIONLESS_FUNCTIONS) - function(qt_generate_wayland_protocol_client_sources) + macro(qt_generate_wayland_protocol_client_sources) qt6_generate_wayland_protocol_client_sources(${ARGV}) - endfunction() + endmacro() endif() diff --git a/src/tools/qtwaylandscanner/Qt6WaylandCompositorMacros.cmake b/src/tools/qtwaylandscanner/Qt6WaylandCompositorMacros.cmake index 92ad04696b4..6953be7de55 100644 --- a/src/tools/qtwaylandscanner/Qt6WaylandCompositorMacros.cmake +++ b/src/tools/qtwaylandscanner/Qt6WaylandCompositorMacros.cmake @@ -66,7 +66,7 @@ function(qt6_generate_wayland_protocol_server_sources target) endfunction() if(NOT QT_NO_CREATE_VERSIONLESS_FUNCTIONS) - function(qt_generate_wayland_protocol_server_sources) + macro(qt_generate_wayland_protocol_server_sources) qt6_generate_wayland_protocol_server_sources(${ARGV}) - endfunction() + endmacro() endif() From 66cbac0b30bd25a91caee1a38e9f946e90bfc007 Mon Sep 17 00:00:00 2001 From: Craig Scott Date: Wed, 1 Sep 2021 14:35:15 +1000 Subject: [PATCH 0984/1507] Revert "Ensure versionless wrappers do not introduce a new variable scope" This reverts commit 0402f082db34577c4ef38b8d4a7ae0ac2436568e. Macros add another level of escaping that functions do not. The conversion of the versionless wrappers to macros may alter the behavior, so revert that change. Task-number: QTBUG-96219 Pick-to: 6.2 Change-Id: I75d7223477894fd28c261ffb8476ab64f5b7d9be Reviewed-by: Joerg Bornemann --- src/tools/qtwaylandscanner/Qt6WaylandClientMacros.cmake | 4 ++-- src/tools/qtwaylandscanner/Qt6WaylandCompositorMacros.cmake | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/tools/qtwaylandscanner/Qt6WaylandClientMacros.cmake b/src/tools/qtwaylandscanner/Qt6WaylandClientMacros.cmake index f618f3ddcfd..c810325955e 100644 --- a/src/tools/qtwaylandscanner/Qt6WaylandClientMacros.cmake +++ b/src/tools/qtwaylandscanner/Qt6WaylandClientMacros.cmake @@ -82,7 +82,7 @@ function(qt6_generate_wayland_protocol_client_sources target) endfunction() if(NOT QT_NO_CREATE_VERSIONLESS_FUNCTIONS) - macro(qt_generate_wayland_protocol_client_sources) + function(qt_generate_wayland_protocol_client_sources) qt6_generate_wayland_protocol_client_sources(${ARGV}) - endmacro() + endfunction() endif() diff --git a/src/tools/qtwaylandscanner/Qt6WaylandCompositorMacros.cmake b/src/tools/qtwaylandscanner/Qt6WaylandCompositorMacros.cmake index 6953be7de55..92ad04696b4 100644 --- a/src/tools/qtwaylandscanner/Qt6WaylandCompositorMacros.cmake +++ b/src/tools/qtwaylandscanner/Qt6WaylandCompositorMacros.cmake @@ -66,7 +66,7 @@ function(qt6_generate_wayland_protocol_server_sources target) endfunction() if(NOT QT_NO_CREATE_VERSIONLESS_FUNCTIONS) - macro(qt_generate_wayland_protocol_server_sources) + function(qt_generate_wayland_protocol_server_sources) qt6_generate_wayland_protocol_server_sources(${ARGV}) - endmacro() + endfunction() endif() From 60fb809a7954240e63a9df82eadc2d6325945d4e Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Tue, 7 Sep 2021 11:28:19 +0100 Subject: [PATCH 0985/1507] Client: map keyboard mapping privately We are never going to write back changes into the compositor's keymap, so there is no reason to have support for writing back to the compositor. V7 of the spec says: "From version 7 onwards, the fd must be mapped with MAP_PRIVATE by the recipient, as MAP_SHARED may fail." Whilst we don't support v7 yet it is harmless to change this early. Task-number: QTBUG-96259 Change-Id: I16afcae4aa89ff24955981e714096359d0a54792 Reviewed-by: Qt CI Bot Reviewed-by: Allan Sandfeld Jensen --- src/plugins/platforms/wayland/qwaylandinputdevice.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index 46b84f4570b..78e75d7b139 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -1165,7 +1165,7 @@ void QWaylandInputDevice::Keyboard::keyboard_keymap(uint32_t format, int32_t fd, return; } - char *map_str = static_cast(mmap(nullptr, size, PROT_READ, MAP_SHARED, fd, 0)); + char *map_str = static_cast(mmap(nullptr, size, PROT_READ, MAP_PRIVATE, fd, 0)); if (map_str == MAP_FAILED) { close(fd); return; From 42ab2bfa617a4474fb4b5e2455da7d0ace97485a Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Wed, 22 Sep 2021 13:19:34 +0200 Subject: [PATCH 0986/1507] Unskip tst_xdgshell::showMinimized() This passes now, so re-enable it. Change-Id: I2e0c40d5d2f3b6bb84f71f4ad192384f88e8e34e Reviewed-by: David Edmundson Reviewed-by: Qt CI Bot --- tests/auto/wayland/xdgshell/tst_xdgshell.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/auto/wayland/xdgshell/tst_xdgshell.cpp b/tests/auto/wayland/xdgshell/tst_xdgshell.cpp index 7c6c3a5fa47..1d2a2014c51 100644 --- a/tests/auto/wayland/xdgshell/tst_xdgshell.cpp +++ b/tests/auto/wayland/xdgshell/tst_xdgshell.cpp @@ -56,7 +56,6 @@ private slots: void tst_xdgshell::showMinimized() { - QSKIP("TODO: This currently fails, needs a fix"); // On xdg-shell there's really no way for the compositor to tell the window if it's minimized // There are wl_surface.enter events and so on, but there's really no way to differentiate // between a window preview and an unminimized window. From 03ff403826001dcba462ea44c1fadf7e33ecbd88 Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Wed, 22 Sep 2021 16:23:03 +0200 Subject: [PATCH 0987/1507] CMake: Bump almost all cmake_minimum_required calls to 3.16 Needed for subsequent change that will check and error out if the version is lower than 3.16. We do that to ensure all policies introduced by CMake up to version 3.16 have their behavior set to NEW. Pick-to: 6.2 Task-number: QTBUG-95018 Change-Id: I43575e48cb4ddb70b80f09e0432a2f88b01bec86 Reviewed-by: Qt CI Bot Reviewed-by: Kai Koehne --- tests/auto/cmake/test_waylandclient/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/cmake/test_waylandclient/CMakeLists.txt b/tests/auto/cmake/test_waylandclient/CMakeLists.txt index 3788a4927bd..d3dacc0f5bd 100644 --- a/tests/auto/cmake/test_waylandclient/CMakeLists.txt +++ b/tests/auto/cmake/test_waylandclient/CMakeLists.txt @@ -1,6 +1,6 @@ project(test_plugins) -cmake_minimum_required(VERSION 2.8) +cmake_minimum_required(VERSION 3.16) cmake_policy(SET CMP0056 NEW) find_package(Qt5WaylandClient REQUIRED) From 8bedacb8d3de8c6cee1d016b2ba8f2fa1bf29ebd Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Tue, 14 Sep 2021 11:56:23 +0200 Subject: [PATCH 0988/1507] Wayland client: Fix crash when windows are shown/hidden during drag Fixes: QTBUG-87624 Pick-to: 6.2 5.15 Change-Id: I1b9443df091878abcd4fbe9c55927cb819aebd59 Reviewed-by: David Edmundson --- src/plugins/platforms/wayland/qwaylanddatadevice.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylanddatadevice.cpp b/src/plugins/platforms/wayland/qwaylanddatadevice.cpp index d63838f7b95..8f1ba579587 100644 --- a/src/plugins/platforms/wayland/qwaylanddatadevice.cpp +++ b/src/plugins/platforms/wayland/qwaylanddatadevice.cpp @@ -170,7 +170,7 @@ void QWaylandDataDevice::data_device_drop() void QWaylandDataDevice::data_device_enter(uint32_t serial, wl_surface *surface, wl_fixed_t x, wl_fixed_t y, wl_data_offer *id) { - auto *dragWaylandWindow = QWaylandWindow::fromWlSurface(surface); + auto *dragWaylandWindow = surface ? QWaylandWindow::fromWlSurface(surface) : nullptr; if (!dragWaylandWindow) return; // Ignore foreign surfaces From 430ab36bb48ec6c16bd7a42baa82a124ae0d02e9 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Thu, 23 Sep 2021 14:13:26 +0200 Subject: [PATCH 0989/1507] Wayland client: Don't applyConfigure for destroyed surface If a window is rapidly hidden and re-shown multiple times, the configure for a deleted wl_surface may be invoked after a new surface has been created. This change makes sure we always reset mWaitingToApplyConfigure before a new wl_surface is created. The superfluous applyConfigure invocation will then be safely ignored. Fixes: QTBUG-96464 Pick-to: 6.2 Change-Id: Ie2d718f77dc8de93674c6b86b5128c4f50414df1 Reviewed-by: Vlad Zahorodnii Reviewed-by: David Edmundson --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 2ca45259f72..a708afcedc0 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -261,6 +261,7 @@ void QWaylandWindow::reset() mFrameCallbackElapsedTimer.invalidate(); mWaitingForFrameCallback = false; mFrameCallbackTimedOut = false; + mWaitingToApplyConfigure = false; mMask = QRegion(); mQueuedBuffer = nullptr; From d2a37a747c3fc48de083b6f0dc733ea80c98b2c0 Mon Sep 17 00:00:00 2001 From: Georges Basile Stavracas Neto Date: Thu, 27 May 2021 19:55:04 -0300 Subject: [PATCH 0990/1507] Client: Don't always recreate frame callbacks The main QWaylandWindow method that is executed when handling updates is QWaylandWindow::handleUpdate(). This method always, unconditionally queues a frame callback, regardless of whether any other one is already queued. On some circumstances, e.g. when a window is hidden or completely obscured by other windows, it stops receiving frame callbacks from the compositor. However, QWaylandWindow would continue to request for them, which eventually fills up the Wayland socket, and causes the application to crash. This can be avoided by checking if the platform window is already waiting for a frame callback, before queueing another one. In QWaylandWindow::handleUpdate(), check if mWaitingForFrameCallback is true before queueing frame callbacks, and early return if that's the case. The XDG-shell test needed to be updated for this: The mock compositor is not responding to any frame callbacks, so the window will be unexposed, no longer get paint events and therefore not trigger any commit. This worked by accident before because we were issuing updates quickly enough to reset the timer before it had a chance to unexpose the window. The easiest fix is just to disable the dependency on frame callbacks in this test, since that is clearly not what it's testing. Task-number: QTBUG-81504 Change-Id: Ieacb05c7d5a5fcf662243d9177ebcc308cb9ca84 Reviewed-by: Qt CI Bot Reviewed-by: Georges Basile Stavracas Neto Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 4 ++++ tests/auto/wayland/xdgshell/tst_xdgshell.cpp | 2 ++ 2 files changed, 6 insertions(+) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index a708afcedc0..d83d516957e 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -1357,6 +1357,10 @@ void QWaylandWindow::requestUpdate() void QWaylandWindow::handleUpdate() { qCDebug(lcWaylandBackingstore) << "handleUpdate" << QThread::currentThread(); + + if (mWaitingForFrameCallback) + return; + // TODO: Should sync subsurfaces avoid requesting frame callbacks? QReadLocker lock(&mSurfaceLock); if (!mSurface) diff --git a/tests/auto/wayland/xdgshell/tst_xdgshell.cpp b/tests/auto/wayland/xdgshell/tst_xdgshell.cpp index 1d2a2014c51..962093c75c1 100644 --- a/tests/auto/wayland/xdgshell/tst_xdgshell.cpp +++ b/tests/auto/wayland/xdgshell/tst_xdgshell.cpp @@ -138,6 +138,7 @@ void tst_xdgshell::configureSize() void tst_xdgshell::configureStates() { + QVERIFY(qputenv("QT_WAYLAND_FRAME_CALLBACK_TIMEOUT", "0")); QRasterWindow window; window.resize(64, 48); window.show(); @@ -186,6 +187,7 @@ void tst_xdgshell::configureStates() QCOMPARE(window.windowStates(), Qt::WindowNoState); QCOMPARE(window.frameGeometry().size(), windowedSize); // QCOMPARE(window.frameGeometry().topLeft(), QPoint()); // TODO: this doesn't currently work when window decorations are enabled + QVERIFY(qunsetenv("QT_WAYLAND_FRAME_CALLBACK_TIMEOUT")); } void tst_xdgshell::popup() From 0a80b46583e727a5d4018db1a2847fa3cb0a9457 Mon Sep 17 00:00:00 2001 From: Georges Basile Stavracas Neto Date: Thu, 27 May 2021 20:02:53 -0300 Subject: [PATCH 0991/1507] Client: Always destroy frame callback in the actual callback It's good hygiene to destroy all frame callbacks. Destroy the frame callback and cleanup the mFrameCallback class member in the callback itself. The callback destruction happens before calling handleFrameCallback() to avoid the theoretical case where another frame callback is queued by handleFrameCallback(), and then immediately destroyed in the callback handler. Change-Id: Ide6dc95e3402932c58bfc088a9d471fda821e9a1 Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index d83d516957e..5561f58f74c 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -659,9 +659,13 @@ void QWaylandWindow::commit() const wl_callback_listener QWaylandWindow::callbackListener = { [](void *data, wl_callback *callback, uint32_t time) { - Q_UNUSED(callback); Q_UNUSED(time); auto *window = static_cast(data); + + Q_ASSERT(callback == window->mFrameCallback); + wl_callback_destroy(callback); + window->mFrameCallback = nullptr; + window->handleFrameCallback(); } }; @@ -1366,14 +1370,6 @@ void QWaylandWindow::handleUpdate() if (!mSurface) return; - if (mFrameCallback) { - if (!isExposed()) - return; - - wl_callback_destroy(mFrameCallback); - mFrameCallback = nullptr; - } - QMutexLocker locker(mFrameQueue.mutex); struct ::wl_surface *wrappedSurface = reinterpret_cast(wl_proxy_create_wrapper(mSurface->object())); wl_proxy_set_queue(reinterpret_cast(wrappedSurface), mFrameQueue.queue); From 55d2590abf823f0529ab844ee26f60d0371a95d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A9ven=20Car?= Date: Wed, 18 Aug 2021 18:28:20 +0200 Subject: [PATCH 0992/1507] Wayland client: use wl_keyboard to determine active state Commit d4d47f2a043f3e7548ba10c69fb54637511ba563 made QWaylandDisplay use the xdgshell's active state for QWindow::isActive(), instead of using wl_keyboard activate/deactivate events. That seems to have been a misunderstanding, since xdgshell activation is only supposed to be used to determine visual appearance, and there is an explicit warning not to assume it means focus. This commit reverts this logic back to listening to wl_keyboard. It adds a fallback when there is no wl_keyboard available to handle activated/deactivated events through xdg-shell, in order to fix QTBUG-53702. windowStates is handled so that we're not using the Xdg hint for anything with QWindowSystemInterface::handleWindowStateChanged or anything where we need to track only having one active. We are still exposing it for decorations, which is the only reason to use the Xdghint over keyboard focus - so you can keep the toplevel active whilst you show a popup. Change-Id: I4343d2ed9fb5b066cde95628ed0b4ccc84a424db Reviewed-by: Eskil Abrahamsen Blomfeldt --- .../xdg-shell/qwaylandxdgshell.cpp | 16 +++++----------- .../xdg-shell/qwaylandxdgshellintegration.cpp | 14 -------------- .../xdg-shell/qwaylandxdgshellintegration_p.h | 1 - .../platforms/wayland/qwaylanddisplay.cpp | 19 +++++++++++-------- .../platforms/wayland/qwaylanddisplay_p.h | 1 + .../platforms/wayland/qwaylandwindow.cpp | 8 ++++++-- .../qwaylandshellintegration_p.h | 6 ------ tests/auto/wayland/xdgshell/tst_xdgshell.cpp | 10 +++++++--- 8 files changed, 30 insertions(+), 45 deletions(-) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp index 5d9a21f81b2..afb2e3b27a3 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp @@ -67,11 +67,6 @@ QWaylandXdgSurface::Toplevel::Toplevel(QWaylandXdgSurface *xdgSurface) QWaylandXdgSurface::Toplevel::~Toplevel() { - if (m_applied.states & Qt::WindowActive) { - QWaylandWindow *window = m_xdgSurface->window(); - window->display()->handleWindowDeactivated(window); - } - // The protocol spec requires that the decoration object is deleted before xdg_toplevel. delete m_decoration; m_decoration = nullptr; @@ -85,17 +80,16 @@ void QWaylandXdgSurface::Toplevel::applyConfigure() if (!(m_applied.states & (Qt::WindowMaximized|Qt::WindowFullScreen))) m_normalSize = m_xdgSurface->m_window->windowFrameGeometry().size(); - if ((m_pending.states & Qt::WindowActive) && !(m_applied.states & Qt::WindowActive)) + if ((m_pending.states & Qt::WindowActive) && !(m_applied.states & Qt::WindowActive) + && !m_xdgSurface->m_window->display()->isKeyboardAvailable()) m_xdgSurface->m_window->display()->handleWindowActivated(m_xdgSurface->m_window); - if (!(m_pending.states & Qt::WindowActive) && (m_applied.states & Qt::WindowActive)) + if (!(m_pending.states & Qt::WindowActive) && (m_applied.states & Qt::WindowActive) + && !m_xdgSurface->m_window->display()->isKeyboardAvailable()) m_xdgSurface->m_window->display()->handleWindowDeactivated(m_xdgSurface->m_window); - // TODO: none of the other plugins send WindowActive either, but is it on purpose? - Qt::WindowStates statesWithoutActive = m_pending.states & ~Qt::WindowActive; - m_xdgSurface->m_window->handleToplevelWindowTilingStatesChanged(m_toplevelStates); - m_xdgSurface->m_window->handleWindowStatesChanged(statesWithoutActive); + m_xdgSurface->m_window->handleWindowStatesChanged(m_pending.states); if (m_pending.size.isEmpty()) { // An empty size in the configure means it's up to the client to choose the size diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshellintegration.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshellintegration.cpp index b259a301016..fcdd435c6b7 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshellintegration.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshellintegration.cpp @@ -69,20 +69,6 @@ QWaylandShellSurface *QWaylandXdgShellIntegration::createShellSurface(QWaylandWi return m_xdgShell->getXdgSurface(window); } -void QWaylandXdgShellIntegration::handleKeyboardFocusChanged(QWaylandWindow *newFocus, QWaylandWindow *oldFocus) -{ - if (newFocus) { - auto *xdgSurface = qobject_cast(newFocus->shellSurface()); - if (xdgSurface && !xdgSurface->handlesActiveState()) - m_display->handleWindowActivated(newFocus); - } - if (oldFocus && qobject_cast(oldFocus->shellSurface())) { - auto *xdgSurface = qobject_cast(oldFocus->shellSurface()); - if (xdgSurface && !xdgSurface->handlesActiveState()) - m_display->handleWindowDeactivated(oldFocus); - } -} - void *QWaylandXdgShellIntegration::nativeResourceForWindow(const QByteArray &resource, QWindow *window) { if (auto waylandWindow = static_cast(window->handle())) { diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshellintegration_p.h b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshellintegration_p.h index ceca0335db0..fced9eb07c2 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshellintegration_p.h +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshellintegration_p.h @@ -65,7 +65,6 @@ public: QWaylandXdgShellIntegration() {} bool initialize(QWaylandDisplay *display) override; QWaylandShellSurface *createShellSurface(QWaylandWindow *window) override; - void handleKeyboardFocusChanged(QWaylandWindow *newFocus, QWaylandWindow *oldFocus) override; void *nativeResourceForWindow(const QByteArray &resource, QWindow *window) override; private: diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index aeb5f4b8702..d624fab33f5 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -578,14 +578,10 @@ void QWaylandDisplay::handleKeyboardFocusChanged(QWaylandInputDevice *inputDevic if (mLastKeyboardFocus == keyboardFocus) return; - if (mWaylandIntegration->mShellIntegration) { - mWaylandIntegration->mShellIntegration->handleKeyboardFocusChanged(keyboardFocus, mLastKeyboardFocus); - } else { - if (keyboardFocus) - handleWindowActivated(keyboardFocus); - if (mLastKeyboardFocus) - handleWindowDeactivated(mLastKeyboardFocus); - } + if (keyboardFocus) + handleWindowActivated(keyboardFocus); + if (mLastKeyboardFocus) + handleWindowDeactivated(mLastKeyboardFocus); mLastKeyboardFocus = keyboardFocus; } @@ -630,6 +626,13 @@ QWaylandInputDevice *QWaylandDisplay::defaultInputDevice() const return mInputDevices.isEmpty() ? 0 : mInputDevices.first(); } +bool QWaylandDisplay::isKeyboardAvailable() const +{ + return std::any_of( + mInputDevices.constBegin(), mInputDevices.constEnd(), + [this](const QWaylandInputDevice *device) { return device->keyboard() != nullptr; }); +} + #if QT_CONFIG(cursor) QWaylandCursor *QWaylandDisplay::waylandCursor() diff --git a/src/plugins/platforms/wayland/qwaylanddisplay_p.h b/src/plugins/platforms/wayland/qwaylanddisplay_p.h index a027eb8955a..5fc7aec32f4 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay_p.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay_p.h @@ -220,6 +220,7 @@ public: void destroyFrameQueue(const FrameQueue &q); void dispatchQueueWhile(wl_event_queue *queue, std::function condition, int timeout = -1); + bool isKeyboardAvailable() const; public slots: void blockingReadEvents(); void flushRequests(); diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 5561f58f74c..7f4088aa0a8 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -96,7 +96,6 @@ QWaylandWindow::QWaylandWindow(QWindow *window, QWaylandDisplay *display) QWaylandWindow::~QWaylandWindow() { mDisplay->destroyFrameQueue(mFrameQueue); - mDisplay->handleWindowDestroyed(this); delete mWindowDecoration; @@ -265,6 +264,8 @@ void QWaylandWindow::reset() mMask = QRegion(); mQueuedBuffer = nullptr; + + mDisplay->handleWindowDestroyed(this); } QWaylandWindow *QWaylandWindow::fromWlSurface(::wl_surface *surface) @@ -1273,7 +1274,10 @@ Qt::WindowStates QWaylandWindow::windowStates() const void QWaylandWindow::handleWindowStatesChanged(Qt::WindowStates states) { createDecoration(); - QWindowSystemInterface::handleWindowStateChanged(window(), states, mLastReportedWindowStates); + Qt::WindowStates statesWithoutActive = states & ~Qt::WindowActive; + Qt::WindowStates lastStatesWithoutActive = mLastReportedWindowStates & ~Qt::WindowActive; + QWindowSystemInterface::handleWindowStateChanged(window(), statesWithoutActive, + lastStatesWithoutActive); mLastReportedWindowStates = states; } diff --git a/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegration_p.h b/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegration_p.h index ccad0048192..b308ffe25ee 100644 --- a/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegration_p.h +++ b/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegration_p.h @@ -73,12 +73,6 @@ public: return true; } virtual QWaylandShellSurface *createShellSurface(QWaylandWindow *window) = 0; - virtual void handleKeyboardFocusChanged(QWaylandWindow *newFocus, QWaylandWindow *oldFocus) { - if (newFocus) - m_display->handleWindowActivated(newFocus); - if (oldFocus) - m_display->handleWindowDeactivated(oldFocus); - } virtual void *nativeResourceForWindow(const QByteArray &resource, QWindow *window) { Q_UNUSED(resource); Q_UNUSED(window); diff --git a/tests/auto/wayland/xdgshell/tst_xdgshell.cpp b/tests/auto/wayland/xdgshell/tst_xdgshell.cpp index 962093c75c1..b8b41d1e150 100644 --- a/tests/auto/wayland/xdgshell/tst_xdgshell.cpp +++ b/tests/auto/wayland/xdgshell/tst_xdgshell.cpp @@ -31,6 +31,7 @@ #include #include #include +#include using namespace MockCompositor; @@ -155,9 +156,12 @@ void tst_xdgshell::configureStates() // Toplevel windows don't know their position on xdg-shell // QCOMPARE(window.frameGeometry().topLeft(), QPoint()); // TODO: this doesn't currently work when window decorations are enabled -// QEXPECT_FAIL("", "configure has already been acked, we shouldn't have to wait for isActive", Continue); -// QVERIFY(window.isActive()); - QTRY_VERIFY(window.isActive()); // Just make sure it eventually get's set correctly + // window.windowstate() is driven by keyboard focus, however for decorations we want to follow + // XDGShell this is internal to QtWayland so it is queried directly + auto waylandWindow = static_cast(window.handle()); + Q_ASSERT(waylandWindow); + QTRY_VERIFY(waylandWindow->windowStates().testFlag( + Qt::WindowActive)); // Just make sure it eventually get's set correctly const QSize screenSize(640, 480); const uint maximizedSerial = exec([=] { From 4be0cbb5b35ed3c1dcc912a919bfdb1e414e84fd Mon Sep 17 00:00:00 2001 From: Dominik Holland Date: Tue, 5 Oct 2021 10:57:18 +0200 Subject: [PATCH 0993/1507] Add explicit dependency to Libdrm::Libdrm for the client as well Similar to the compositor, we can't rely that qtbase always has a dependency to it. Pick-to: 6.2 Fixes: QTBUG-96845 Change-Id: I2b5535c3cb57c8f2193800aac09e097d2b729ce2 Reviewed-by: Joerg Bornemann --- src/plugins/platforms/wayland/configure.cmake | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/plugins/platforms/wayland/configure.cmake b/src/plugins/platforms/wayland/configure.cmake index c90204d0ec4..cb3cbbda3cf 100644 --- a/src/plugins/platforms/wayland/configure.cmake +++ b/src/plugins/platforms/wayland/configure.cmake @@ -5,6 +5,13 @@ #### Libraries +# Even if libdrm is already found by qtbase we still need to list it as dependency for some of our +# plugins +if(TARGET Libdrm::Libdrm) + qt_internal_disable_find_package_global_promotion(Libdrm::Libdrm) +endif() +qt_find_package(Libdrm PROVIDED_TARGETS Libdrm::Libdrm MODULE_NAME gui QMAKE_LIB drm MARK_OPTIONAL) + #### Tests From 5c9a38e768156fa9b4fd88bb0d5d269ab32846e8 Mon Sep 17 00:00:00 2001 From: Jan Grulich Date: Fri, 16 Jul 2021 13:00:03 +0200 Subject: [PATCH 0994/1507] Client: do not empty clipboard when a new popup/window is opened If we open a new popup or a window within the same app we have to avoid invalidating selection offer when losing focus, because it's still the same client who has the focus and we might not get a new selection offer by the compositor and therefore we would lose clipboard content. Fixes: QTBUG-93474 Change-Id: Ia2ef826c2967b1daf1cdeb085e8dae66d090dbcf Reviewed-by: Qt CI Bot Reviewed-by: David Edmundson --- src/plugins/platforms/wayland/qwaylanddisplay.cpp | 13 +++++++++++++ .../platforms/wayland/qwaylandinputdevice.cpp | 8 -------- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index d624fab33f5..6b1d7fa40e2 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -600,6 +600,19 @@ void QWaylandDisplay::handleWaylandSync() QWindow *activeWindow = mActiveWindows.empty() ? nullptr : mActiveWindows.last()->window(); if (activeWindow != QGuiApplication::focusWindow()) QWindowSystemInterface::handleWindowActivated(activeWindow); + + if (!activeWindow) { + if (lastInputDevice()) { +#if QT_CONFIG(clipboard) + if (auto *dataDevice = lastInputDevice()->dataDevice()) + dataDevice->invalidateSelectionOffer(); +#endif +#if QT_CONFIG(wayland_client_primary_selection) + if (auto *device = lastInputDevice()->primarySelectionDevice()) + device->invalidateSelectionOffer(); +#endif + } + } } const wl_callback_listener QWaylandDisplay::syncCallbackListener = { diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index 78e75d7b139..07f37d4381c 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -1337,14 +1337,6 @@ void QWaylandInputDevice::Keyboard::handleFocusDestroyed() void QWaylandInputDevice::Keyboard::handleFocusLost() { mFocus = nullptr; -#if QT_CONFIG(clipboard) - if (auto *dataDevice = mParent->dataDevice()) - dataDevice->invalidateSelectionOffer(); -#endif -#if QT_CONFIG(wayland_client_primary_selection) - if (auto *device = mParent->primarySelectionDevice()) - device->invalidateSelectionOffer(); -#endif mParent->mQDisplay->handleKeyboardFocusChanged(mParent); mRepeatTimer.stop(); } From 4767e91f7bd32ee6ffc7701035f430e453b99784 Mon Sep 17 00:00:00 2001 From: Liang Qi Date: Wed, 29 Sep 2021 16:42:30 +0200 Subject: [PATCH 0995/1507] tests: port tst_client to use shared folder instead of shared_old Task-number: QTBUG-96440 Change-Id: I1f9e04841b432937e47ed337b05fe96b2e0662fc Reviewed-by: Qt CI Bot Reviewed-by: Eskil Abrahamsen Blomfeldt --- tests/auto/wayland/client/CMakeLists.txt | 27 +- tests/auto/wayland/client/tst_client.cpp | 328 +++++++----- tests/auto/wayland/shared/corecompositor.cpp | 8 +- tests/auto/wayland/shared/corecompositor.h | 11 +- tests/auto/wayland/shared/coreprotocol.cpp | 146 +++++- tests/auto/wayland/shared/coreprotocol.h | 54 +- tests/auto/wayland/shared/datadevice.cpp | 35 ++ tests/auto/wayland/shared/datadevice.h | 32 +- tests/auto/wayland/shared/mockcompositor.cpp | 33 +- tests/auto/wayland/shared/mockcompositor.h | 10 +- .../wayland/shared_old/mockcompositor.cpp | 453 ----------------- .../auto/wayland/shared_old/mockcompositor.h | 268 ---------- .../shared_old/mockfullscreenshellv1.cpp | 43 -- .../shared_old/mockfullscreenshellv1.h | 58 --- tests/auto/wayland/shared_old/mockinput.cpp | 474 ------------------ tests/auto/wayland/shared_old/mockinput.h | 172 ------- .../wayland/shared_old/mockiviapplication.cpp | 72 --- .../wayland/shared_old/mockiviapplication.h | 85 ---- tests/auto/wayland/shared_old/mockoutput.cpp | 93 ---- tests/auto/wayland/shared_old/mockoutput.h | 62 --- tests/auto/wayland/shared_old/mockregion.cpp | 51 -- tests/auto/wayland/shared_old/mockregion.h | 62 --- tests/auto/wayland/shared_old/mocksurface.cpp | 160 ------ tests/auto/wayland/shared_old/mocksurface.h | 84 ---- tests/auto/wayland/shared_old/mockwlshell.cpp | 52 -- tests/auto/wayland/shared_old/mockwlshell.h | 58 --- tests/auto/wayland/shared_old/shared_old.pri | 34 -- 27 files changed, 503 insertions(+), 2462 deletions(-) delete mode 100644 tests/auto/wayland/shared_old/mockcompositor.cpp delete mode 100644 tests/auto/wayland/shared_old/mockcompositor.h delete mode 100644 tests/auto/wayland/shared_old/mockfullscreenshellv1.cpp delete mode 100644 tests/auto/wayland/shared_old/mockfullscreenshellv1.h delete mode 100644 tests/auto/wayland/shared_old/mockinput.cpp delete mode 100644 tests/auto/wayland/shared_old/mockinput.h delete mode 100644 tests/auto/wayland/shared_old/mockiviapplication.cpp delete mode 100644 tests/auto/wayland/shared_old/mockiviapplication.h delete mode 100644 tests/auto/wayland/shared_old/mockoutput.cpp delete mode 100644 tests/auto/wayland/shared_old/mockoutput.h delete mode 100644 tests/auto/wayland/shared_old/mockregion.cpp delete mode 100644 tests/auto/wayland/shared_old/mockregion.h delete mode 100644 tests/auto/wayland/shared_old/mocksurface.cpp delete mode 100644 tests/auto/wayland/shared_old/mocksurface.h delete mode 100644 tests/auto/wayland/shared_old/mockwlshell.cpp delete mode 100644 tests/auto/wayland/shared_old/mockwlshell.h delete mode 100644 tests/auto/wayland/shared_old/shared_old.pri diff --git a/tests/auto/wayland/client/CMakeLists.txt b/tests/auto/wayland/client/CMakeLists.txt index 2b6df4a3d36..9373b982668 100644 --- a/tests/auto/wayland/client/CMakeLists.txt +++ b/tests/auto/wayland/client/CMakeLists.txt @@ -6,34 +6,9 @@ qt_internal_add_test(tst_client SOURCES - ../shared_old/mockcompositor.cpp ../shared_old/mockcompositor.h - ../shared_old/mockfullscreenshellv1.cpp ../shared_old/mockfullscreenshellv1.h - ../shared_old/mockinput.cpp ../shared_old/mockinput.h - ../shared_old/mockiviapplication.cpp ../shared_old/mockiviapplication.h - ../shared_old/mockoutput.cpp ../shared_old/mockoutput.h - ../shared_old/mockregion.cpp ../shared_old/mockregion.h - ../shared_old/mocksurface.cpp ../shared_old/mocksurface.h - ../shared_old/mockwlshell.cpp ../shared_old/mockwlshell.h tst_client.cpp - INCLUDE_DIRECTORIES - ../shared_old PUBLIC_LIBRARIES - Qt::CorePrivate - Qt::Gui - Qt::GuiPrivate - Qt::OpenGL - Qt::WaylandClientPrivate - Wayland::Client - Wayland::Server - Threads::Threads # special case -) - -qt6_generate_wayland_protocol_server_sources(tst_client - FILES - ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/fullscreen-shell-unstable-v1.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/ivi-application.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/wayland.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/xdg-shell.xml + SharedClientTest ) #### Keys ignored in scope 1:.:.:client.pro:: diff --git a/tests/auto/wayland/client/tst_client.cpp b/tests/auto/wayland/client/tst_client.cpp index 9c99220d0f8..b16dffbe95c 100644 --- a/tests/auto/wayland/client/tst_client.cpp +++ b/tests/auto/wayland/client/tst_client.cpp @@ -44,8 +44,24 @@ #include #include +using namespace MockCompositor; + static const QSize screenSize(1600, 1200); +constexpr int dataDeviceVersion = 1; + +class TestCompositor : public WlShellCompositor { +public: + explicit TestCompositor() + { + exec([this] { + m_config.autoConfigure = true; + add(dataDeviceVersion); + }); + } + DataDevice *dataDevice() { return get()->deviceFor(get()); } +}; + class TestWindow : public QWindow { public: @@ -141,35 +157,14 @@ void TestGlWindow::paintGL() } #endif // QT_CONFIG(opengl) -class tst_WaylandClient : public QObject +class tst_WaylandClient : public QObject, private TestCompositor { Q_OBJECT -public: - tst_WaylandClient(MockCompositor *c) - : compositor(c) - { - QSocketNotifier *notifier = new QSocketNotifier(compositor->waylandFileDescriptor(), QSocketNotifier::Read, this); - connect(notifier, SIGNAL(activated(QSocketDescriptor)), this, SLOT(processWaylandEvents())); - // connect to the event dispatcher to make sure to flush out the outgoing message queue - connect(QCoreApplication::eventDispatcher(), &QAbstractEventDispatcher::awake, this, &tst_WaylandClient::processWaylandEvents); - connect(QCoreApplication::eventDispatcher(), &QAbstractEventDispatcher::aboutToBlock, this, &tst_WaylandClient::processWaylandEvents); - } - -public slots: - void processWaylandEvents() - { - compositor->processWaylandEvents(); - } - - void cleanup() - { - // make sure the surfaces from the last test are properly cleaned up - // and don't show up as false positives in the next test - QTRY_VERIFY(!compositor->surface()); - QTRY_VERIFY(!compositor->iviSurface()); - } private slots: + void cleanup() { + QTRY_VERIFY2(isClean(), qPrintable(dirtyMessage())); + } void createDestroyWindow(); void activeWindowFollowsKeyboardFocus(); void events(); @@ -184,9 +179,6 @@ private slots: #endif // QT_CONFIG(opengl) void longWindowTitle(); void longWindowTitleWithUtf16Characters(); - -private: - MockCompositor *compositor = nullptr; }; void tst_WaylandClient::createDestroyWindow() @@ -194,10 +186,10 @@ void tst_WaylandClient::createDestroyWindow() TestWindow window; window.show(); - QTRY_VERIFY(compositor->surface()); + QCOMPOSITOR_TRY_VERIFY(wlSurface(0)); window.destroy(); - QTRY_VERIFY(!compositor->surface()); + QCOMPOSITOR_TRY_VERIFY(!wlSurface(0)); } void tst_WaylandClient::activeWindowFollowsKeyboardFocus() @@ -205,21 +197,26 @@ void tst_WaylandClient::activeWindowFollowsKeyboardFocus() TestWindow window; window.show(); - QSharedPointer surface; - QTRY_VERIFY(surface = compositor->surface()); - compositor->sendShellSurfaceConfigure(surface); + Surface *s = nullptr; + QCOMPOSITOR_TRY_VERIFY(s = wlSurface(0)); + WlShellSurface *ss = s->wlShellSurface(); + ss->sendConfigure(0, 0, 0); - QTRY_VERIFY(window.isExposed()); + QCOMPOSITOR_TRY_VERIFY(window.isExposed()); QCOMPARE(window.focusInEventCount, 0); - compositor->setKeyboardFocus(surface); + exec([=] { + keyboard()->sendEnter(s); + }); QTRY_COMPARE(window.focusInEventCount, 1); - QTRY_COMPARE(QGuiApplication::focusWindow(), &window); + QCOMPARE(QGuiApplication::focusWindow(), &window); QCOMPARE(window.focusOutEventCount, 0); - compositor->setKeyboardFocus(QSharedPointer(nullptr)); + exec([=] { + keyboard()->sendLeave(s); // or implement setFocus in Keyboard + }); QTRY_COMPARE(window.focusOutEventCount, 1); - QTRY_COMPARE(QGuiApplication::focusWindow(), static_cast(nullptr)); + QCOMPARE(QGuiApplication::focusWindow(), static_cast(nullptr)); } void tst_WaylandClient::events() @@ -227,46 +224,77 @@ void tst_WaylandClient::events() TestWindow window; window.show(); - QSharedPointer surface; - QTRY_VERIFY(surface = compositor->surface()); - compositor->sendShellSurfaceConfigure(surface); + Surface *s = nullptr; + QCOMPOSITOR_TRY_VERIFY(s = wlSurface(0)); + WlShellSurface *ss = s->wlShellSurface(); + ss->sendConfigure(0, 0, 0); - QTRY_VERIFY(window.isExposed()); + QCOMPOSITOR_TRY_VERIFY(window.isExposed()); - compositor->setKeyboardFocus(surface); + QCOMPARE(window.focusInEventCount, 0); + + exec([=] { + keyboard()->sendEnter(s); + }); QTRY_COMPARE(window.focusInEventCount, 1); - QTRY_COMPARE(QGuiApplication::focusWindow(), &window); + QCOMPARE(QGuiApplication::focusWindow(), &window); + // See also https://wayland.app/protocols/wayland#wl_keyboard:enum:keymap_format + // wl_keyboard::keymap_format + // keymap_format { no_keymap, xkb_v1 } + // Argument Value Description + // no_keymap 0 no keymap; client must understand how to interpret the raw keycode + // xkb_v1 1 libxkbcommon compatible; to determine the xkb keycode, clients must add 8 to the key event keycode uint keyCode = 80; // arbitrarily chosen QCOMPARE(window.keyPressEventCount, 0); - compositor->sendKeyPress(surface, keyCode); + exec([=] { + keyboard()->sendKey(client(), keyCode - 8, Keyboard::key_state_pressed); // related with native scan code + }); QTRY_COMPARE(window.keyPressEventCount, 1); - QTRY_COMPARE(window.keyCode, keyCode); + QCOMPARE(window.keyCode, keyCode); QCOMPARE(window.keyReleaseEventCount, 0); - compositor->sendKeyRelease(surface, keyCode); + exec([=] { + keyboard()->sendKey(client(), keyCode - 8, Keyboard::key_state_released); // related with native scan code + }); QTRY_COMPARE(window.keyReleaseEventCount, 1); QCOMPARE(window.keyCode, keyCode); const int touchId = 0; - compositor->sendTouchDown(surface, window.frameOffset() + QPoint(10, 10), touchId); + exec([&] { + touch()->sendDown(s, window.frameOffset() + QPoint(10, 10), touchId); + }); // Note: wl_touch.frame should not be the last event in a test until QTBUG-66563 is fixed. // See also: QTBUG-66537 - compositor->sendTouchFrame(surface); + exec([=] { + touch()->sendFrame(client()); + }); QTRY_COMPARE(window.touchEventCount, 1); - compositor->sendTouchUp(surface, touchId); - compositor->sendTouchFrame(surface); + exec([=] { + touch()->sendUp(client(), touchId); + touch()->sendFrame(client()); + }); QTRY_COMPARE(window.touchEventCount, 2); QPoint mousePressPos(16, 16); QCOMPARE(window.mousePressEventCount, 0); - compositor->sendMousePress(surface, window.frameOffset() + mousePressPos); + exec([&] { + pointer()->sendEnter(s, window.frameOffset() + mousePressPos); + pointer()->sendFrame(client()); + pointer()->sendMotion(client(), window.frameOffset() + mousePressPos); + pointer()->sendFrame(client()); + pointer()->sendButton(client(), BTN_LEFT, Pointer::button_state_pressed); + pointer()->sendFrame(client()); + }); QTRY_COMPARE(window.mousePressEventCount, 1); QTRY_COMPARE(window.mousePressPos, mousePressPos); QCOMPARE(window.mouseReleaseEventCount, 0); - compositor->sendMouseRelease(surface); + exec([=] { + pointer()->sendButton(client(), BTN_LEFT, Pointer::button_state_released); + pointer()->sendFrame(client()); + }); QTRY_COMPARE(window.mouseReleaseEventCount, 1); } @@ -275,9 +303,10 @@ void tst_WaylandClient::backingStore() TestWindow window; window.show(); - QSharedPointer surface; - QTRY_VERIFY(surface = compositor->surface()); - compositor->sendShellSurfaceConfigure(surface); + Surface *s = nullptr; + QCOMPOSITOR_TRY_VERIFY(s = wlSurface(0)); + WlShellSurface *ss = s->wlShellSurface(); + ss->sendConfigure(0, 0, 0); QRect rect(QPoint(), window.size()); @@ -294,17 +323,17 @@ void tst_WaylandClient::backingStore() backingStore.endPaint(); - QVERIFY(surface->image.isNull()); + QVERIFY(s->m_image.isNull()); backingStore.flush(rect); - QTRY_COMPARE(surface->image.size(), window.frameGeometry().size()); - QTRY_COMPARE(surface->image.pixel(window.frameMargins().left(), window.frameMargins().top()), color.rgba()); + QTRY_COMPARE(s->m_image.size(), window.frameGeometry().size()); + QTRY_COMPARE(s->m_image.pixel(window.frameMargins().left(), window.frameMargins().top()), color.rgba()); window.hide(); // hiding the window should destroy the surface - QTRY_VERIFY(!compositor->surface()); + QCOMPOSITOR_TRY_VERIFY(!wlSurface(0)); } class DndWindow : public QWindow @@ -343,29 +372,75 @@ private: QPixmap m_dragIcon; }; +class DNDTest : public QObject +{ + Q_OBJECT + +public: + DNDTest(QObject *parent = nullptr) + : QObject(parent) {} + + Surface *m_surface = nullptr; + TestCompositor *m_compositor = nullptr; + QPoint m_frameOffset; + +public slots: + void finishMouseDrag(); + void touchDrag(); +}; + +void DNDTest::finishMouseDrag() +{ + m_compositor->exec([&] { + m_compositor->dataDevice()->sendDrop(m_surface); + m_compositor->dataDevice()->sendLeave(m_surface); + }); +} + +void DNDTest::touchDrag() +{ + m_compositor->exec([&] { + m_compositor->dataDevice()->sendDataOffer(m_surface->resource()->client()); + m_compositor->dataDevice()->sendEnter(m_surface, m_frameOffset + QPoint(20, 20)); + m_compositor->dataDevice()->sendMotion(m_surface, m_frameOffset + QPoint(21, 21)); + m_compositor->dataDevice()->sendDrop(m_surface); + m_compositor->dataDevice()->sendLeave(m_surface); + }); +} + void tst_WaylandClient::touchDrag() { DndWindow window; window.show(); - QSharedPointer surface; - QTRY_VERIFY(surface = compositor->surface()); - compositor->sendShellSurfaceConfigure(surface); + Surface *s = nullptr; + QCOMPOSITOR_TRY_VERIFY(s = wlSurface(0)); + WlShellSurface *ss = s->wlShellSurface(); + ss->sendConfigure(0, 0, 0); - compositor->setKeyboardFocus(surface); + DNDTest test; + test.m_surface = s; + test.m_compositor = this; + test.m_frameOffset = window.frameOffset(); + + exec([&] { + QObject::connect(dataDevice(), &DataDevice::dragStarted, + &test, &DNDTest::touchDrag); + }); + + exec([=] { + keyboard()->sendEnter(s); + }); QTRY_COMPARE(QGuiApplication::focusWindow(), &window); - const int id = 0; - compositor->sendTouchDown(surface, window.frameOffset() + QPoint(10, 10), id); - compositor->sendTouchFrame(surface); - compositor->sendTouchMotion(surface, window.frameOffset() + QPoint(20, 20), id); - compositor->sendTouchFrame(surface); - compositor->waitForStartDrag(); - compositor->sendDataDeviceDataOffer(surface); - compositor->sendDataDeviceEnter(surface, window.frameOffset() + QPoint(20, 20)); - compositor->sendDataDeviceMotion(window.frameOffset() + QPoint(21, 21)); - compositor->sendDataDeviceDrop(surface); - compositor->sendDataDeviceLeave(surface); + const int touchId = 0; + exec([&] { + touch()->sendDown(s, window.frameOffset() + QPoint(10, 10), touchId); + touch()->sendFrame(client()); + touch()->sendMotion(client(), window.frameOffset() + QPoint(20, 20), touchId); + touch()->sendFrame(client()); + }); + QTRY_VERIFY(window.dragStarted); } @@ -374,20 +449,39 @@ void tst_WaylandClient::mouseDrag() DndWindow window; window.show(); - QSharedPointer surface; - QTRY_VERIFY(surface = compositor->surface()); - compositor->sendShellSurfaceConfigure(surface); + Surface *s = nullptr; + QCOMPOSITOR_TRY_VERIFY(s = wlSurface(0)); + WlShellSurface *ss = s->wlShellSurface(); + ss->sendConfigure(0, 0, 0); - compositor->setKeyboardFocus(surface); + DNDTest test; + test.m_surface = s; + test.m_compositor = this; + + exec([&] { + QObject::connect(dataDevice(), &DataDevice::dragStarted, + &test, &DNDTest::finishMouseDrag); + }); + + exec([=] { + keyboard()->sendEnter(s); + }); QTRY_COMPARE(QGuiApplication::focusWindow(), &window); - compositor->sendMousePress(surface, window.frameOffset() + QPoint(10, 10)); - compositor->sendDataDeviceDataOffer(surface); - compositor->sendDataDeviceEnter(surface, window.frameOffset() + QPoint(20, 20)); - compositor->sendDataDeviceMotion(window.frameOffset() + QPoint(21, 21)); - compositor->waitForStartDrag(); - compositor->sendDataDeviceDrop(surface); - compositor->sendDataDeviceLeave(surface); + QPoint mousePressPos(16, 16); + exec([&] { + pointer()->sendEnter(s, window.frameOffset() + mousePressPos); + pointer()->sendFrame(client()); + pointer()->sendMotion(client(), window.frameOffset() + mousePressPos); + pointer()->sendFrame(client()); + pointer()->sendButton(client(), BTN_LEFT, Pointer::button_state_pressed); + pointer()->sendFrame(client()); + + dataDevice()->sendDataOffer(s->resource()->client()); + dataDevice()->sendEnter(s, window.frameOffset() + QPoint(20, 20)); + dataDevice()->sendMotion(s, window.frameOffset() + QPoint(21, 21)); + }); + QTRY_VERIFY(window.dragStarted); } @@ -412,10 +506,11 @@ void tst_WaylandClient::dontCrashOnMultipleCommits() backingStore.flush(rect); backingStore.flush(rect); - compositor->processWaylandEvents(); + QCOMPOSITOR_TRY_VERIFY(wlSurface(0)); } delete window; + QCOMPOSITOR_TRY_VERIFY(!wlSurface(0)); } void tst_WaylandClient::hiddenTransientParent() @@ -426,15 +521,14 @@ void tst_WaylandClient::hiddenTransientParent() transient.setTransientParent(&parent); parent.show(); - QTRY_VERIFY(compositor->surface()); + QCOMPOSITOR_TRY_VERIFY(wlSurface(0)); parent.hide(); - QTRY_VERIFY(!compositor->surface()); + QCOMPOSITOR_TRY_VERIFY(!wlSurface(0)); transient.show(); - QTRY_VERIFY(compositor->surface()); + QCOMPOSITOR_TRY_VERIFY(wlSurface(0)); } - void tst_WaylandClient::hiddenPopupParent() { TestWindow toplevel; @@ -442,12 +536,22 @@ void tst_WaylandClient::hiddenPopupParent() // wl_shell relies on a mouse event in order to send a serial and seat // with the set_popup request. - QSharedPointer surface; - QTRY_VERIFY(surface = compositor->surface()); - compositor->sendShellSurfaceConfigure(surface); + Surface *s = nullptr; + QCOMPOSITOR_TRY_VERIFY(s = wlSurface(0)); + WlShellSurface *ss = s->wlShellSurface(); + ss->sendConfigure(0, 0, 0); + QCOMPOSITOR_TRY_VERIFY(toplevel.isExposed()); + QPoint mousePressPos(16, 16); QCOMPARE(toplevel.mousePressEventCount, 0); - compositor->sendMousePress(surface, toplevel.frameOffset() + mousePressPos); + exec([&] { + pointer()->sendEnter(s, toplevel.frameOffset() + mousePressPos); + pointer()->sendFrame(client()); + pointer()->sendMotion(client(), toplevel.frameOffset() + mousePressPos); + pointer()->sendFrame(client()); + pointer()->sendButton(client(), BTN_LEFT, Pointer::button_state_pressed); + pointer()->sendFrame(client()); + }); QTRY_COMPARE(toplevel.mousePressEventCount, 1); QWindow popup; @@ -455,10 +559,10 @@ void tst_WaylandClient::hiddenPopupParent() popup.setFlag(Qt::Popup, true); toplevel.hide(); - QTRY_VERIFY(!compositor->surface()); + QCOMPOSITOR_TRY_VERIFY(!wlSurface(0)); popup.show(); - QTRY_VERIFY(compositor->surface()); + QCOMPOSITOR_TRY_VERIFY(wlSurface(0)); } #if QT_CONFIG(opengl) @@ -468,9 +572,10 @@ void tst_WaylandClient::glWindow() QScopedPointer testWindow(new TestGlWindow); testWindow->show(); - QSharedPointer surface; - QTRY_VERIFY(surface = compositor->surface()); - compositor->sendShellSurfaceConfigure(surface); + Surface *s = nullptr; + QCOMPOSITOR_TRY_VERIFY(s = wlSurface(0)); + WlShellSurface *ss = s->wlShellSurface(); + ss->sendConfigure(0, 0, 0); QTRY_COMPARE(testWindow->paintGLCalled, 1); @@ -485,7 +590,7 @@ void tst_WaylandClient::glWindow() //confirm we don't crash when we delete an already hidden GL window //QTBUG-65553 testWindow->setVisible(false); - QTRY_VERIFY(!compositor->surface()); + QCOMPOSITOR_TRY_VERIFY(!wlSurface(0)); } #endif // QT_CONFIG(opengl) @@ -496,7 +601,7 @@ void tst_WaylandClient::longWindowTitle() QString absurdlyLongTitle(10000, QLatin1Char('z')); window.setTitle(absurdlyLongTitle); window.show(); - QTRY_VERIFY(compositor->surface()); + QCOMPOSITOR_TRY_VERIFY(wlSurface(0)); } void tst_WaylandClient::longWindowTitleWithUtf16Characters() @@ -506,7 +611,7 @@ void tst_WaylandClient::longWindowTitleWithUtf16Characters() Q_ASSERT(absurdlyLongTitle.length() == 10000); // just making sure the test isn't broken window.setTitle(absurdlyLongTitle); window.show(); - QTRY_VERIFY(compositor->surface()); + QCOMPOSITOR_TRY_VERIFY(wlSurface(0)); } int main(int argc, char **argv) @@ -514,22 +619,13 @@ int main(int argc, char **argv) QTemporaryDir tmpRuntimeDir; setenv("XDG_RUNTIME_DIR", tmpRuntimeDir.path().toLocal8Bit(), 1); setenv("QT_QPA_PLATFORM", "wayland", 1); // force QGuiApplication to use wayland plugin + setenv("QT_WAYLAND_SHELL_INTEGRATION", "wl-shell", 1); - MockCompositor compositor; - compositor.setOutputMode(screenSize); - + tst_WaylandClient tc; QGuiApplication app(argc, argv); - - // Initializing some client buffer integrations (i.e. eglInitialize) may block while waiting - // for a wayland sync. So we call clientBufferIntegration prior to applicationInitialized - // (while the compositor processes events without waiting) in order to avoid hanging later. - auto *waylandIntegration = static_cast(QGuiApplicationPrivate::platformIntegration()); - waylandIntegration->clientBufferIntegration(); - - compositor.applicationInitialized(); - - tst_WaylandClient tc(&compositor); + QTEST_SET_MAIN_SOURCE_PATH return QTest::qExec(&tc, argc, argv); } #include + diff --git a/tests/auto/wayland/shared/corecompositor.cpp b/tests/auto/wayland/shared/corecompositor.cpp index fa9b7662a06..e9984f7d627 100644 --- a/tests/auto/wayland/shared/corecompositor.cpp +++ b/tests/auto/wayland/shared/corecompositor.cpp @@ -31,8 +31,9 @@ namespace MockCompositor { -CoreCompositor::CoreCompositor() - : m_display(wl_display_create()) +CoreCompositor::CoreCompositor(CompositorType t) + : m_type(t) + , m_display(wl_display_create()) , m_socketName(wl_display_add_socket_auto(m_display)) , m_eventLoop(wl_display_get_event_loop(m_display)) @@ -77,11 +78,10 @@ QString CoreCompositor::dirtyMessage() return messages.join(", "); } -void CoreCompositor::dispatch() +void CoreCompositor::dispatch(int timeout) { Lock lock(this); wl_display_flush_clients(m_display); - constexpr int timeout = 0; // immediate return wl_event_loop_dispatch(m_eventLoop, timeout); } diff --git a/tests/auto/wayland/shared/corecompositor.h b/tests/auto/wayland/shared/corecompositor.h index 1b43fd70360..5f847106fd0 100644 --- a/tests/auto/wayland/shared/corecompositor.h +++ b/tests/auto/wayland/shared/corecompositor.h @@ -48,11 +48,17 @@ public: class CoreCompositor { public: - explicit CoreCompositor(); + enum CompositorType { + Default, + Legacy // wl-shell + }; + + CompositorType m_type = Default; + explicit CoreCompositor(CompositorType t = Default); ~CoreCompositor(); bool isClean(); QString dirtyMessage(); - void dispatch(); + void dispatch(int timeout = 0); template auto exec(function_type func, arg_types&&... args) -> decltype(func()) @@ -164,6 +170,7 @@ public: public: // Only use this carefully from the test thread (i.e. lock first) wl_display *m_display = nullptr; + protected: class Lock { public: diff --git a/tests/auto/wayland/shared/coreprotocol.cpp b/tests/auto/wayland/shared/coreprotocol.cpp index c4181cb9445..1a9676b2e74 100644 --- a/tests/auto/wayland/shared/coreprotocol.cpp +++ b/tests/auto/wayland/shared/coreprotocol.cpp @@ -31,6 +31,21 @@ namespace MockCompositor { +Surface::Surface(WlCompositor *wlCompositor, wl_client *client, int id, int version) + : QtWaylandServer::wl_surface(client, id, version) + , m_wlCompositor(wlCompositor) + , m_wlshell(wlCompositor->m_compositor->m_type == CoreCompositor::CompositorType::Legacy) +{ +} + +Surface::~Surface() +{ + // TODO: maybe make sure buffers are released? + qDeleteAll(m_commits); + if (m_wlShellSurface) + m_wlShellSurface->m_surface = nullptr; +} + void Surface::sendFrameCallbacks() { uint time = m_wlCompositor->m_compositor->currentTimeMilliseconds(); @@ -55,6 +70,11 @@ void Surface::sendLeave(Output *output) wl_surface::send_leave(resource()->handle, outputResource->handle); } +void Surface::map() +{ + m_mapped = true; +} + void Surface::surface_destroy_resource(Resource *resource) { Q_UNUSED(resource); @@ -65,14 +85,29 @@ void Surface::surface_destroy_resource(Resource *resource) delete this; } +void Surface::surface_destroy(Resource *resource) +{ + if (m_wlShellSurface) // on wl-shell the shell surface is automatically destroyed with the surface + wl_resource_destroy(m_wlShellSurface->resource()->handle); + Q_ASSERT(!m_wlShellSurface); + wl_resource_destroy(resource->handle); +} + void Surface::surface_attach(Resource *resource, wl_resource *buffer, int32_t x, int32_t y) { Q_UNUSED(resource); - QPoint offset(x, y); - m_pending.buffer = fromResource(buffer); - m_pending.commitSpecific.attachOffset = offset; - m_pending.commitSpecific.attached = true; - emit attach(buffer, offset); + if (m_wlshell) { + m_buffer = buffer; + if (!buffer) + m_image = QImage(); + } else { + QPoint offset(x, y); + m_pending.buffer = fromResource(buffer); + m_pending.commitSpecific.attachOffset = offset; + m_pending.commitSpecific.attached = true; + + emit attach(buffer, offset); + } } void Surface::surface_set_buffer_scale(QtWaylandServer::wl_surface::Resource *resource, int32_t scale) @@ -84,32 +119,63 @@ void Surface::surface_set_buffer_scale(QtWaylandServer::wl_surface::Resource *re void Surface::surface_commit(Resource *resource) { Q_UNUSED(resource); - m_committed = m_pending; - m_commits.append(new DoubleBufferedState(m_committed)); - if (auto *frame = m_pending.commitSpecific.frame) - m_waitingFrameCallbacks.append(frame); + if (m_wlshell) { + if (m_buffer) { + struct ::wl_shm_buffer *shm_buffer = wl_shm_buffer_get(m_buffer); + if (shm_buffer) { + int stride = wl_shm_buffer_get_stride(shm_buffer); + uint format = wl_shm_buffer_get_format(shm_buffer); + Q_UNUSED(format); + void *data = wl_shm_buffer_get_data(shm_buffer); + const uchar *char_data = static_cast(data); + QImage img(char_data, wl_shm_buffer_get_width(shm_buffer), wl_shm_buffer_get_height(shm_buffer), stride, QImage::Format_ARGB32_Premultiplied); + m_image = img; + } + } - m_pending.commitSpecific = PerCommitData(); - emit commit(); - if (m_committed.commitSpecific.attached) - emit bufferCommitted(); + for (wl_resource *frameCallback : qExchange(m_frameCallbackList, {})) { + auto time = m_wlCompositor->m_compositor->currentTimeMilliseconds(); + wl_callback_send_done(frameCallback, time); + wl_resource_destroy(frameCallback); + } + } else { + m_committed = m_pending; + m_commits.append(new DoubleBufferedState(m_committed)); + + if (auto *frame = m_pending.commitSpecific.frame) + m_waitingFrameCallbacks.append(frame); + + m_pending.commitSpecific = PerCommitData(); + emit commit(); + if (m_committed.commitSpecific.attached) + emit bufferCommitted(); + } } void Surface::surface_frame(Resource *resource, uint32_t callback) { - // Although valid, there is really no point having multiple frame requests in the same commit. - // Make sure we don't do it - QCOMPARE(m_pending.commitSpecific.frame, nullptr); + if (m_wlshell) { + wl_resource *frameCallback = wl_resource_create(resource->client(), &wl_callback_interface, 1, callback); + m_frameCallbackList << frameCallback; + } else { + // Although valid, there is really no point having multiple frame requests in the same commit. + // Make sure we don't do it + QCOMPARE(m_pending.commitSpecific.frame, nullptr); - auto *frame = new Callback(resource->client(), callback, 1); - m_pending.commitSpecific.frame = frame; + auto *frame = new Callback(resource->client(), callback, 1); + m_pending.commitSpecific.frame = frame; + } } bool WlCompositor::isClean() { for (auto *surface : qAsConst(m_surfaces)) { - if (!CursorRole::fromSurface(surface)) - return false; + if (!CursorRole::fromSurface(surface)) { + if (m_compositor->m_type != CoreCompositor::CompositorType::Legacy) + return false; + if (surface->isMapped()) + return false; + } } return true; } @@ -299,8 +365,9 @@ uint Pointer::sendEnter(Surface *surface, const QPointF &position) wl_client *client = surface->resource()->client(); const auto pointerResources = resourceMap().values(client); - for (auto *r : pointerResources) + for (auto *r : pointerResources) { wl_pointer::send_enter(r->handle, serial, surface->resource()->handle, x ,y); + } return serial; } @@ -479,8 +546,9 @@ uint Keyboard::sendKey(wl_client *client, uint key, uint state) auto time = m_seat->m_compositor->currentTimeMilliseconds(); uint serial = m_seat->m_compositor->nextSerial(); const auto pointerResources = resourceMap().values(client); - for (auto *r : pointerResources) + for (auto *r : pointerResources) { send_key(r->handle, serial, time, key, state); + } return serial; } @@ -534,4 +602,38 @@ void ShmPool::shm_pool_destroy_resource(Resource *resource) delete this; } +WlShell::WlShell(CoreCompositor *compositor, int version) + : QtWaylandServer::wl_shell(compositor->m_display, version) + , m_compositor(compositor) +{ +} + +void WlShell::shell_get_shell_surface(Resource *resource, uint32_t id, wl_resource *surface) +{ + auto *s = fromResource(surface); + auto *wlShellSurface = new WlShellSurface(this, resource->client(), id, s); + m_wlShellSurfaces << wlShellSurface; + emit wlShellSurfaceCreated(wlShellSurface); +} + +WlShellSurface::WlShellSurface(WlShell *wlShell, wl_client *client, int id, Surface *surface) + : QtWaylandServer::wl_shell_surface(client, id, 1) + , m_wlShell(wlShell) + , m_surface(surface) +{ + surface->m_wlShellSurface = this; + surface->map(); +} + +WlShellSurface::~WlShellSurface() +{ + if (m_surface) + m_surface->m_wlShellSurface = nullptr; +} + +void WlShellSurface::sendConfigure(uint32_t edges, int32_t width, int32_t height) +{ + wl_shell_surface::send_configure(edges, width, height); +} + } // namespace MockCompositor diff --git a/tests/auto/wayland/shared/coreprotocol.h b/tests/auto/wayland/shared/coreprotocol.h index 17eeca27fd1..e575444cb44 100644 --- a/tests/auto/wayland/shared/coreprotocol.h +++ b/tests/auto/wayland/shared/coreprotocol.h @@ -36,6 +36,8 @@ namespace MockCompositor { class WlCompositor; +class WlShell; +class WlShellSurface; class Output; class Pointer; class Touch; @@ -96,18 +98,18 @@ class Surface : public QObject, public QtWaylandServer::wl_surface { Q_OBJECT public: - explicit Surface(WlCompositor *wlCompositor, wl_client *client, int id, int version) - : QtWaylandServer::wl_surface(client, id, version) - , m_wlCompositor(wlCompositor) - { - } - ~Surface() override { qDeleteAll(m_commits); } // TODO: maybe make sure buffers are released? + explicit Surface(WlCompositor *wlCompositor, wl_client *client, int id, int version); + ~Surface() override; void sendFrameCallbacks(); void sendEnter(Output *output); void send_enter(::wl_resource *output) = delete; void sendLeave(Output *output); void send_leave(::wl_resource *output) = delete; + void map(); + bool isMapped() const { return m_mapped; } + WlShellSurface *wlShellSurface() const { return m_wlShellSurface; } + WlCompositor *m_wlCompositor; struct PerCommitData { Callback *frame = nullptr; @@ -125,6 +127,14 @@ public: QList m_outputs; SurfaceRole *m_role = nullptr; + WlShellSurface *m_wlShellSurface = nullptr; + bool m_mapped = false; + QList m_frameCallbackList; + + wl_resource *m_buffer = nullptr; + QImage m_image; // checking backingStore + bool m_wlshell = false; + signals: void attach(void *buffer, QPoint offset); void commit(); @@ -132,7 +142,7 @@ signals: protected: void surface_destroy_resource(Resource *resource) override; - void surface_destroy(Resource *resource) override { wl_resource_destroy(resource->handle); } + void surface_destroy(Resource *resource) override; void surface_attach(Resource *resource, wl_resource *buffer, int32_t x, int32_t y) override; void surface_set_buffer_scale(Resource *resource, int32_t scale) override; void surface_commit(Resource *resource) override; @@ -184,6 +194,36 @@ protected: } }; +class WlShell : public Global, public QtWaylandServer::wl_shell +{ + Q_OBJECT +public: + explicit WlShell(CoreCompositor *compositor, int version = 1); + QList m_wlShellSurfaces; + CoreCompositor *m_compositor = nullptr; + +signals: + void wlShellSurfaceCreated(WlShellSurface *wlShellSurface); + +protected: + void shell_get_shell_surface(Resource *resource, uint32_t id, ::wl_resource *surface) override; +}; + +class WlShellSurface : public QObject, public QtWaylandServer::wl_shell_surface +{ + Q_OBJECT +public: + explicit WlShellSurface(WlShell *wlShell, wl_client *client, int id, Surface *surface); + ~WlShellSurface() override; + void sendConfigure(uint32_t edges, int32_t width, int32_t height); + void send_configure(uint32_t edges, int32_t width, int32_t height) = delete; + + void shell_surface_destroy_resource(Resource *) override { delete this; } + + WlShell *m_wlShell = nullptr; + Surface *m_surface = nullptr; +}; + class Subsurface : public QObject, public QtWaylandServer::wl_subsurface { Q_OBJECT diff --git a/tests/auto/wayland/shared/datadevice.cpp b/tests/auto/wayland/shared/datadevice.cpp index dfa18952c35..4249563506e 100644 --- a/tests/auto/wayland/shared/datadevice.cpp +++ b/tests/auto/wayland/shared/datadevice.cpp @@ -60,6 +60,11 @@ void DataDeviceManager::data_device_manager_get_data_device(Resource *resource, device->add(resource->client(), id, resource->version()); } +void DataDeviceManager::data_device_manager_create_data_source(Resource *resource, uint32_t id) +{ + new QtWaylandServer::wl_data_source(resource->client(), id, 1); +} + DataDevice::~DataDevice() { // If the client(s) hasn't deleted the wayland object, just ignore subsequent events @@ -71,6 +76,7 @@ DataOffer *DataDevice::sendDataOffer(wl_client *client, const QStringList &mimeT { Q_ASSERT(client); auto *offer = new DataOffer(this, client, m_manager->m_version); + m_offers << offer; for (auto *resource : resourceMap().values(client)) wl_data_device::send_data_offer(resource->handle, offer->resource()->handle); for (const auto &mimeType : mimeTypes) @@ -86,6 +92,33 @@ void DataDevice::sendSelection(DataOffer *offer) m_sentSelectionOffers << offer; } +void DataDevice::sendEnter(Surface *surface, const QPoint &position) +{ + uint serial = m_manager->m_compositor->nextSerial(); + Resource *resource = resourceMap().value(surface->resource()->client()); + for (DataOffer *offer: m_offers) + wl_data_device::send_enter(resource->handle, serial, surface->resource()->handle, position.x(), position.y(), offer->resource()->handle); +} + +void DataDevice::sendMotion(Surface *surface, const QPoint &position) +{ + uint32_t time = m_manager->m_compositor->nextSerial(); + Resource *resource = resourceMap().value(surface->resource()->client()); + wl_data_device::send_motion(resource->handle, time, position.x(), position.y()); +} + +void DataDevice::sendDrop(Surface *surface) +{ + Resource *resource = resourceMap().value(surface->resource()->client()); + wl_data_device::send_drop(resource->handle); +} + +void DataDevice::sendLeave(Surface *surface) +{ + Resource *resource = resourceMap().value(surface->resource()->client()); + wl_data_device::send_leave(resource->handle); +} + void DataOffer::data_offer_destroy_resource(Resource *resource) { Q_UNUSED(resource); @@ -101,6 +134,8 @@ void DataOffer::data_offer_receive(Resource *resource, const QString &mime_type, void DataOffer::data_offer_destroy(QtWaylandServer::wl_data_offer::Resource *resource) { bool removed = m_dataDevice->m_sentSelectionOffers.removeOne(this); + if (!removed) + removed = m_dataDevice->m_offers.removeOne(this); QVERIFY(removed); wl_resource_destroy(resource->handle); } diff --git a/tests/auto/wayland/shared/datadevice.h b/tests/auto/wayland/shared/datadevice.h index a8c30f8f2d9..a0d97e64622 100644 --- a/tests/auto/wayland/shared/datadevice.h +++ b/tests/auto/wayland/shared/datadevice.h @@ -43,6 +43,7 @@ public: explicit DataDeviceManager(CoreCompositor *compositor, int version = 1) : QtWaylandServer::wl_data_device_manager(compositor->m_display, version) , m_version(version) + , m_compositor(compositor) {} ~DataDeviceManager() override { qDeleteAll(m_dataDevices); } bool isClean() override; @@ -50,13 +51,16 @@ public: int m_version = 1; // TODO: remove on libwayland upgrade QMap m_dataDevices; + CoreCompositor *m_compositor; protected: void data_device_manager_get_data_device(Resource *resource, uint32_t id, ::wl_resource *seatResource) override; + void data_device_manager_create_data_source(Resource *resource, uint32_t id) override; }; -class DataDevice : public QtWaylandServer::wl_data_device +class DataDevice : public QObject, public QtWaylandServer::wl_data_device { + Q_OBJECT public: explicit DataDevice(DataDeviceManager *manager, Seat *seat) : m_manager(manager) @@ -69,11 +73,37 @@ public: void send_selection(::wl_resource *resource) = delete; void sendSelection(DataOffer *offer); + void send_enter(uint32_t serial, ::wl_resource *surface, wl_fixed_t x, wl_fixed_t y, ::wl_resource *id) = delete; + void sendEnter(Surface *surface, const QPoint& position); + + void send_motion(uint32_t time, wl_fixed_t x, wl_fixed_t y) = delete; + void sendMotion(Surface *surface, const QPoint &position); + + void send_drop(::wl_resource *resource) = delete; + void sendDrop(Surface *surface); + + void send_leave(::wl_resource *resource) = delete; + void sendLeave(Surface *surface); + DataDeviceManager *m_manager = nullptr; Seat *m_seat = nullptr; QList m_sentSelectionOffers; + QList m_offers; + +signals: + void dragStarted(); protected: + void data_device_start_drag(Resource *resource, ::wl_resource *source, ::wl_resource *origin, ::wl_resource *icon, uint32_t serial) override + { + Q_UNUSED(resource); + Q_UNUSED(source); + Q_UNUSED(origin); + Q_UNUSED(icon); + Q_UNUSED(serial); + emit dragStarted(); + } + void data_device_release(Resource *resource) override { int removed = m_manager->m_dataDevices.remove(m_seat); diff --git a/tests/auto/wayland/shared/mockcompositor.cpp b/tests/auto/wayland/shared/mockcompositor.cpp index 62fa44f0e8b..63134db55ea 100644 --- a/tests/auto/wayland/shared/mockcompositor.cpp +++ b/tests/auto/wayland/shared/mockcompositor.cpp @@ -31,7 +31,8 @@ namespace MockCompositor { -DefaultCompositor::DefaultCompositor() +DefaultCompositor::DefaultCompositor(CompositorType t) + : CoreCompositor(t) { { Lock l(this); @@ -43,8 +44,16 @@ DefaultCompositor::DefaultCompositor() auto *output = add(); output->m_data.physicalSize = output->m_data.mode.physicalSizeForDpi(96); add(Seat::capability_pointer | Seat::capability_keyboard | Seat::capability_touch); + add(); add(); - add(); + switch (m_type) { + case CompositorType::Default: + add(); + break; + case CompositorType::Legacy: + wl_display_init_shm(m_display); + break; + } add(); add(); @@ -89,4 +98,24 @@ void DefaultCompositor::xdgPingAndWaitForPong() QTRY_COMPARE(pongSpy.first().at(0).toUInt(), serial); } +WlShellCompositor::WlShellCompositor(CompositorType t) + : DefaultCompositor(t) +{ +} + +Surface *DefaultCompositor::wlSurface(int i) +{ + QList surfaces, msurfaces; + msurfaces = get()->m_surfaces; + for (Surface *surface : msurfaces) { + if (surface->isMapped()) + surfaces << surface; + } + + if (i >=0 && i < surfaces.size()) + return surfaces[i]; + + return nullptr; +} + } // namespace MockCompositor diff --git a/tests/auto/wayland/shared/mockcompositor.h b/tests/auto/wayland/shared/mockcompositor.h index 44952a0857c..7f3c0e31028 100644 --- a/tests/auto/wayland/shared/mockcompositor.h +++ b/tests/auto/wayland/shared/mockcompositor.h @@ -55,11 +55,13 @@ namespace MockCompositor { class DefaultCompositor : public CoreCompositor { public: - explicit DefaultCompositor(); + explicit DefaultCompositor(CompositorType t = CompositorType::Default); // Convenience functions Output *output(int i = 0) { return getAll().value(i, nullptr); } Surface *surface(int i = 0) { return get()->m_surfaces.value(i, nullptr); } Subsurface *subSurface(int i = 0) { return get()->m_subsurfaces.value(i, nullptr); } + WlShellSurface *wlShellSurface(int i = 0) { return get()->m_wlShellSurfaces.value(i, nullptr); } + Surface *wlSurface(int i = 0); XdgSurface *xdgSurface(int i = 0) { return get()->m_xdgSurfaces.value(i, nullptr); } XdgToplevel *xdgToplevel(int i = 0) { return get()->toplevel(i); } XdgPopup *xdgPopup(int i = 0) { return get()->popup(i); } @@ -80,6 +82,12 @@ public: void resetConfig() { exec([&] { m_config = Config{}; }); } }; +class WlShellCompositor : public DefaultCompositor +{ +public: + explicit WlShellCompositor(CompositorType t = CompositorType::Legacy); +}; + } // namespace MockCompositor #define QCOMPOSITOR_VERIFY(expr) QVERIFY(exec([&]{ return expr; })) diff --git a/tests/auto/wayland/shared_old/mockcompositor.cpp b/tests/auto/wayland/shared_old/mockcompositor.cpp deleted file mode 100644 index 9353d894c38..00000000000 --- a/tests/auto/wayland/shared_old/mockcompositor.cpp +++ /dev/null @@ -1,453 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "mockcompositor.h" -#include "mockinput.h" -#include "mockoutput.h" -#include "mocksurface.h" -#include "mockwlshell.h" -#include "mockiviapplication.h" - -#include -MockCompositor::MockCompositor() -{ - pthread_create(&m_thread, 0, run, this); - - m_mutex.lock(); - m_waitCondition.wait(&m_mutex); - m_mutex.unlock(); -} - -MockCompositor::~MockCompositor() -{ - m_alive = false; - m_waitCondition.wakeOne(); - pthread_join(m_thread, 0); -} - -void MockCompositor::lock() -{ - m_mutex.lock(); -} - -void MockCompositor::unlock() -{ - m_mutex.unlock(); -} - -void MockCompositor::applicationInitialized() -{ - m_ready = true; -} - -int MockCompositor::waylandFileDescriptor() const -{ - return m_compositor->fileDescriptor(); -} - -void MockCompositor::processWaylandEvents() -{ - m_waitCondition.wakeOne(); -} - -void MockCompositor::setOutputMode(const QSize &size) -{ - Command command = makeCommand(Impl::Compositor::setOutputMode, m_compositor); - command.parameters << size; - processCommand(command); -} - -void MockCompositor::setKeyboardFocus(const QSharedPointer &surface) -{ - Command command = makeCommand(Impl::Compositor::setKeyboardFocus, m_compositor); - command.parameters << QVariant::fromValue(surface); - processCommand(command); -} - -void MockCompositor::sendMousePress(const QSharedPointer &surface, const QPoint &pos) -{ - Command command = makeCommand(Impl::Compositor::sendMousePress, m_compositor); - command.parameters << QVariant::fromValue(surface) << pos; - processCommand(command); -} - -void MockCompositor::sendMouseRelease(const QSharedPointer &surface) -{ - Command command = makeCommand(Impl::Compositor::sendMouseRelease, m_compositor); - command.parameters << QVariant::fromValue(surface); - processCommand(command); -} - -void MockCompositor::sendKeyPress(const QSharedPointer &surface, uint code) -{ - Command command = makeCommand(Impl::Compositor::sendKeyPress, m_compositor); - command.parameters << QVariant::fromValue(surface) << code; - processCommand(command); -} - -void MockCompositor::sendKeyRelease(const QSharedPointer &surface, uint code) -{ - Command command = makeCommand(Impl::Compositor::sendKeyRelease, m_compositor); - command.parameters << QVariant::fromValue(surface) << code; - processCommand(command); -} - -void MockCompositor::sendTouchDown(const QSharedPointer &surface, const QPoint &position, int id) -{ - Command command = makeCommand(Impl::Compositor::sendTouchDown, m_compositor); - command.parameters << QVariant::fromValue(surface) << position << id; - processCommand(command); -} - -void MockCompositor::sendTouchMotion(const QSharedPointer &surface, const QPoint &position, int id) -{ - Command command = makeCommand(Impl::Compositor::sendTouchMotion, m_compositor); - command.parameters << QVariant::fromValue(surface) << position << id; - processCommand(command); -} - -void MockCompositor::sendTouchUp(const QSharedPointer &surface, int id) -{ - Command command = makeCommand(Impl::Compositor::sendTouchUp, m_compositor); - command.parameters << QVariant::fromValue(surface) << id; - processCommand(command); -} - -void MockCompositor::sendTouchFrame(const QSharedPointer &surface) -{ - Command command = makeCommand(Impl::Compositor::sendTouchFrame, m_compositor); - command.parameters << QVariant::fromValue(surface); - processCommand(command); -} - -void MockCompositor::sendDataDeviceDataOffer(const QSharedPointer &surface) -{ - Command command = makeCommand(Impl::Compositor::sendDataDeviceDataOffer, m_compositor); - command.parameters << QVariant::fromValue(surface); - processCommand(command); -} - -void MockCompositor::sendDataDeviceEnter(const QSharedPointer &surface, const QPoint& position) -{ - Command command = makeCommand(Impl::Compositor::sendDataDeviceEnter, m_compositor); - command.parameters << QVariant::fromValue(surface) << QVariant::fromValue(position); - processCommand(command); -} - -void MockCompositor::sendDataDeviceMotion(const QPoint &position) -{ - Command command = makeCommand(Impl::Compositor::sendDataDeviceMotion, m_compositor); - command.parameters << QVariant::fromValue(position); - processCommand(command); -} - -void MockCompositor::sendDataDeviceDrop(const QSharedPointer &surface) -{ - Command command = makeCommand(Impl::Compositor::sendDataDeviceDrop, m_compositor); - command.parameters << QVariant::fromValue(surface); - processCommand(command); -} - -void MockCompositor::sendDataDeviceLeave(const QSharedPointer &surface) -{ - Command command = makeCommand(Impl::Compositor::sendDataDeviceLeave, m_compositor); - command.parameters << QVariant::fromValue(surface); - processCommand(command); -} - -void MockCompositor::sendShellSurfaceConfigure(const QSharedPointer surface, const QSize &size) -{ - Command command = makeCommand(Impl::Compositor::sendShellSurfaceConfigure, m_compositor); - command.parameters << QVariant::fromValue(surface); - command.parameters << QVariant::fromValue(size); - processCommand(command); -} - -void MockCompositor::sendIviSurfaceConfigure(const QSharedPointer iviSurface, const QSize &size) -{ - Command command = makeCommand(Impl::Compositor::sendIviSurfaceConfigure, m_compositor); - command.parameters << QVariant::fromValue(iviSurface); - command.parameters << QVariant::fromValue(size); - processCommand(command); -} - -void MockCompositor::waitForStartDrag() -{ - Command command = makeCommand(Impl::Compositor::waitForStartDrag, m_compositor); - processCommand(command); -} - -QSharedPointer MockCompositor::surface() -{ - QSharedPointer result; - lock(); - { - const QList surfaces = m_compositor->surfaces(); - for (Impl::Surface *surface : surfaces) { - // we don't want to mistake the cursor surface for a window surface - if (surface->isMapped()) { - result = surface->mockSurface(); - break; - } - } - } - unlock(); - return result; -} - -QSharedPointer MockCompositor::output(int index) -{ - QSharedPointer result; - lock(); - if (Impl::Output *output = m_compositor->outputs().value(index, nullptr)) - result = output->mockOutput(); - unlock(); - return result; -} - -QSharedPointer MockCompositor::iviSurface(int index) -{ - QSharedPointer result; - lock(); - if (Impl::IviSurface *toplevel = m_compositor->iviApplication()->iviSurfaces().value(index, nullptr)) - result = toplevel->mockIviSurface(); - unlock(); - return result; -} - -QSharedPointer MockCompositor::fullScreenShellV1Surface(int index) -{ - QSharedPointer result; - lock(); - if (Impl::Surface *surface = m_compositor->fullScreenShellV1()->surfaces().value(index, nullptr)) - result = surface->mockSurface(); - unlock(); - return result; -} - -MockCompositor::Command MockCompositor::makeCommand(Command::Callback callback, void *target) -{ - Command command; - command.callback = callback; - command.target = target; - return command; -} - -void MockCompositor::processCommand(const Command &command) -{ - lock(); - m_commandQueue << command; - unlock(); - - m_waitCondition.wakeOne(); -} - -void MockCompositor::dispatchCommands() -{ - lock(); - int count = m_commandQueue.length(); - unlock(); - - for (int i = 0; i < count; ++i) { - lock(); - const Command command = m_commandQueue.takeFirst(); - unlock(); - command.callback(command.target, command.parameters); - } -} - -void *MockCompositor::run(void *data) -{ - MockCompositor *controller = static_cast(data); - - Impl::Compositor compositor(controller); - - controller->m_compositor = &compositor; - - while (!controller->m_ready) { - controller->m_waitCondition.wakeOne(); - controller->dispatchCommands(); - compositor.dispatchEvents(20); - } - - while (controller->m_alive) { - { - QMutexLocker locker(&controller->m_mutex); - if (controller->m_commandQueue.isEmpty()) - controller->m_waitCondition.wait(&controller->m_mutex); - } - controller->dispatchCommands(); - compositor.dispatchEvents(20); - } - - return 0; -} - -namespace Impl { - -Compositor::Compositor(MockCompositor *mockCompositor) - : m_mockCompositor(mockCompositor), m_display(wl_display_create()) -{ - if (wl_display_add_socket(m_display, 0)) { - fprintf(stderr, "Fatal: Failed to open server socket\n"); - exit(EXIT_FAILURE); - } - - wl_global_create(m_display, &wl_compositor_interface, 4, this, bindCompositor); - - m_data_device_manager.reset(new DataDeviceManager(this, m_display)); - - wl_display_init_shm(m_display); - - m_seat.reset(new Seat(this, m_display)); - m_pointer = m_seat->pointer(); - m_keyboard = m_seat->keyboard(); - m_touch = m_seat->touch(); - - m_outputs.append(new Output(m_display, QSize(1920, 1080), QPoint(0, 0))); - m_iviApplication.reset(new IviApplication(m_display)); - m_wlShell.reset(new WlShell(m_display)); - m_fullScreenShellV1.reset(new FullScreenShellV1(m_display)); - - m_loop = wl_display_get_event_loop(m_display); - m_fd = wl_event_loop_get_fd(m_loop); -} - -Compositor::~Compositor() -{ - wl_display_destroy(m_display); -} - -void Compositor::dispatchEvents(int timeout) -{ - wl_display_flush_clients(m_display); - wl_event_loop_dispatch(m_loop, timeout); -} - -static void compositor_create_surface(wl_client *client, wl_resource *compositorResource, uint32_t id) -{ - Compositor *compositor = static_cast(wl_resource_get_user_data(compositorResource)); - compositor->addSurface(new Surface(client, id, wl_resource_get_version(compositorResource), compositor)); -} - -static void compositor_create_region(wl_client *client, wl_resource *compositorResource, uint32_t id) -{ - Compositor *compositor = - static_cast(wl_resource_get_user_data(compositorResource)); - new Region(client, id, wl_resource_get_version(compositorResource), compositor); -} - -void Compositor::bindCompositor(wl_client *client, void *compositorData, uint32_t version, uint32_t id) -{ - static const struct wl_compositor_interface compositorInterface = { - compositor_create_surface, - compositor_create_region - }; - - wl_resource *resource = wl_resource_create(client, &wl_compositor_interface, static_cast(version), id); - wl_resource_set_implementation(resource, &compositorInterface, compositorData, nullptr); -} - -static void unregisterResourceCallback(wl_listener *listener, void *data) -{ - struct wl_resource *resource = reinterpret_cast(data); - wl_list_remove(wl_resource_get_link(resource)); - delete listener; -} - -void registerResource(wl_list *list, wl_resource *resource) -{ - wl_list_insert(list, wl_resource_get_link(resource)); - - wl_listener *listener = new wl_listener; - listener->notify = unregisterResourceCallback; - - wl_resource_add_destroy_listener(resource, listener); -} - -QList Compositor::surfaces() const -{ - return m_surfaces; -} - -QList Compositor::outputs() const -{ - return m_outputs; -} - -IviApplication *Compositor::iviApplication() const -{ - return m_iviApplication.data(); -} - -FullScreenShellV1 *Compositor::fullScreenShellV1() const -{ - return m_fullScreenShellV1.data(); -} - -uint32_t Compositor::nextSerial() -{ - return wl_display_next_serial(m_display); -} - -void Compositor::addSurface(Surface *surface) -{ - m_mockCompositor->lock(); - m_surfaces << surface; - m_mockCompositor->unlock(); -} - -void Compositor::removeSurface(Surface *surface) -{ - m_mockCompositor->lock(); - m_surfaces.removeOne(surface); - m_keyboard->handleSurfaceDestroyed(surface); - m_pointer->handleSurfaceDestroyed(surface); - m_fullScreenShellV1->removeSurface(surface); - m_mockCompositor->unlock(); -} - -Surface *Compositor::resolveSurface(const QVariant &v) -{ - QSharedPointer mockSurface = v.value >(); - return mockSurface ? mockSurface->handle() : nullptr; -} - -Output *Compositor::resolveOutput(const QVariant &v) -{ - QSharedPointer mockOutput = v.value >(); - return mockOutput ? mockOutput->handle() : nullptr; -} - -IviSurface *Compositor::resolveIviSurface(const QVariant &v) -{ - QSharedPointer mockIviSurface = v.value>(); - return mockIviSurface ? mockIviSurface->handle() : nullptr; -} - -} diff --git a/tests/auto/wayland/shared_old/mockcompositor.h b/tests/auto/wayland/shared_old/mockcompositor.h deleted file mode 100644 index 40fedf7dc90..00000000000 --- a/tests/auto/wayland/shared_old/mockcompositor.h +++ /dev/null @@ -1,268 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef MOCKCOMPOSITOR_H -#define MOCKCOMPOSITOR_H - -#include "mockiviapplication.h" -#include "mockfullscreenshellv1.h" -#include "mockregion.h" - -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -class MockCompositor; - -namespace Impl { - -typedef void (**Implementation)(void); - -class Keyboard; -class Pointer; -class Touch; -class Seat; -class DataDeviceManager; -class Surface; -class Output; -class IviApplication; -class WlShell; -class Region; - -class Compositor -{ -public: - Compositor(MockCompositor *mockCompositor); - ~Compositor(); - - int fileDescriptor() const { return m_fd; } - void dispatchEvents(int timeout = 0); - - uint32_t nextSerial(); - uint32_t time() { return ++m_time; } - - QList surfaces() const; - QList outputs() const; - - IviApplication *iviApplication() const; - FullScreenShellV1 *fullScreenShellV1() const; - - void addSurface(Surface *surface); - void removeSurface(Surface *surface); - - static void setKeyboardFocus(void *data, const QList ¶meters); - static void sendMousePress(void *data, const QList ¶meters); - static void sendMouseRelease(void *data, const QList ¶meters); - static void sendKeyPress(void *data, const QList ¶meters); - static void sendKeyRelease(void *data, const QList ¶meters); - static void sendTouchDown(void *data, const QList ¶meters); - static void sendTouchUp(void *data, const QList ¶meters); - static void sendTouchMotion(void *data, const QList ¶meters); - static void sendTouchFrame(void *data, const QList ¶meters); - static void sendDataDeviceDataOffer(void *data, const QList ¶meters); - static void sendDataDeviceEnter(void *data, const QList ¶meters); - static void sendDataDeviceMotion(void *data, const QList ¶meters); - static void sendDataDeviceDrop(void *data, const QList ¶meters); - static void sendDataDeviceLeave(void *data, const QList ¶meters); - static void waitForStartDrag(void *data, const QList ¶meters); - static void setOutputMode(void *compositor, const QList ¶meters); - static void sendShellSurfaceConfigure(void *data, const QList ¶meters); - static void sendIviSurfaceConfigure(void *data, const QList ¶meters); - -public: - bool m_startDragSeen = false; - -private: - static void bindCompositor(wl_client *client, void *data, uint32_t version, uint32_t id); - static Surface *resolveSurface(const QVariant &v); - static Output *resolveOutput(const QVariant &v); - static IviSurface *resolveIviSurface(const QVariant &v); - - void initShm(); - - MockCompositor *m_mockCompositor = nullptr; - QRect m_outputGeometry; - - wl_display *m_display = nullptr; - wl_event_loop *m_loop = nullptr; - int m_fd = -1; - - uint32_t m_time = 0; - - QScopedPointer m_seat; - Pointer *m_pointer = nullptr; - Keyboard *m_keyboard = nullptr; - Touch *m_touch = nullptr; - QScopedPointer m_data_device_manager; - QList m_surfaces; - QList m_outputs; - QScopedPointer m_iviApplication; - QScopedPointer m_wlShell; - QScopedPointer m_fullScreenShellV1; -}; - -void registerResource(wl_list *list, wl_resource *resource); - -} - -class MockSurface -{ -public: - Impl::Surface *handle() const { return m_surface; } - - QImage image; - -private: - MockSurface(Impl::Surface *surface); - friend class Impl::Compositor; - friend class Impl::Surface; - - Impl::Surface *m_surface = nullptr; -}; - -Q_DECLARE_METATYPE(QSharedPointer) - -class MockRegion -{ -public: - Impl::Region *handle() const { return m_region; } - -private: - MockRegion(Impl::Region *region); - friend class Impl::Compositor; - friend class Impl::Region; - - Impl::Region *m_region = nullptr; -}; - -Q_DECLARE_METATYPE(QSharedPointer) - -class MockIviSurface -{ -public: - Impl::IviSurface *handle() const { return m_iviSurface; } - const uint iviId; - -private: - MockIviSurface(Impl::IviSurface *iviSurface) : iviId(iviSurface->iviId()), m_iviSurface(iviSurface) {} - friend class Impl::Compositor; - friend class Impl::IviSurface; - - Impl::IviSurface *m_iviSurface; -}; - -Q_DECLARE_METATYPE(QSharedPointer) - -class MockOutput { -public: - Impl::Output *handle() const { return m_output; } - MockOutput(Impl::Output *output); -private: - Impl::Output *m_output = nullptr; -}; - -Q_DECLARE_METATYPE(QSharedPointer) - -class MockCompositor -{ -public: - MockCompositor(); - ~MockCompositor(); - - void applicationInitialized(); - - int waylandFileDescriptor() const; - void processWaylandEvents(); - - void setOutputMode(const QSize &size); - void setKeyboardFocus(const QSharedPointer &surface); - void sendMousePress(const QSharedPointer &surface, const QPoint &pos); - void sendMouseRelease(const QSharedPointer &surface); - void sendKeyPress(const QSharedPointer &surface, uint code); - void sendKeyRelease(const QSharedPointer &surface, uint code); - void sendTouchDown(const QSharedPointer &surface, const QPoint &position, int id); - void sendTouchMotion(const QSharedPointer &surface, const QPoint &position, int id); - void sendTouchUp(const QSharedPointer &surface, int id); - void sendTouchFrame(const QSharedPointer &surface); - void sendDataDeviceDataOffer(const QSharedPointer &surface); - void sendDataDeviceEnter(const QSharedPointer &surface, const QPoint &position); - void sendDataDeviceMotion(const QPoint &position); - void sendDataDeviceDrop(const QSharedPointer &surface); - void sendDataDeviceLeave(const QSharedPointer &surface); - void sendSurfaceEnter(const QSharedPointer &surface, QSharedPointer &output); - void sendSurfaceLeave(const QSharedPointer &surface, QSharedPointer &output); - void sendShellSurfaceConfigure(const QSharedPointer surface, const QSize &size = QSize(0, 0)); - void sendIviSurfaceConfigure(const QSharedPointer iviSurface, const QSize &size); - void waitForStartDrag(); - - QSharedPointer surface(); - QSharedPointer output(int index = 0); - QSharedPointer iviSurface(int index = 0); - QSharedPointer fullScreenShellV1Surface(int index = 0); - - void lock(); - void unlock(); - -private: - struct Command - { - typedef void (*Callback)(void *target, const QList ¶meters); - - Callback callback; - void *target = nullptr; - QList parameters; - }; - - static Command makeCommand(Command::Callback callback, void *target); - - void processCommand(const Command &command); - void dispatchCommands(); - - static void *run(void *data); - - bool m_alive = true; - bool m_ready = false; - pthread_t m_thread; - QMutex m_mutex; - QWaitCondition m_waitCondition; - - Impl::Compositor *m_compositor = nullptr; - - QList m_commandQueue; -}; - -#endif diff --git a/tests/auto/wayland/shared_old/mockfullscreenshellv1.cpp b/tests/auto/wayland/shared_old/mockfullscreenshellv1.cpp deleted file mode 100644 index 7463d23f672..00000000000 --- a/tests/auto/wayland/shared_old/mockfullscreenshellv1.cpp +++ /dev/null @@ -1,43 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2018 Pier Luigi Fiorini -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "mockfullscreenshellv1.h" -#include "mocksurface.h" - -namespace Impl { - -void FullScreenShellV1::zwp_fullscreen_shell_v1_present_surface(Resource *resource, struct ::wl_resource *surface, uint32_t method, struct ::wl_resource *output) -{ - Q_UNUSED(resource); - Q_UNUSED(method); - Q_UNUSED(output); - - m_surfaces.append(Surface::fromResource(surface)); -} - -} // namespace Impl diff --git a/tests/auto/wayland/shared_old/mockfullscreenshellv1.h b/tests/auto/wayland/shared_old/mockfullscreenshellv1.h deleted file mode 100644 index c932d4f4d90..00000000000 --- a/tests/auto/wayland/shared_old/mockfullscreenshellv1.h +++ /dev/null @@ -1,58 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2018 Pier Luigi Fiorini -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef MOCKFULLSCREENSHELLV1_H -#define MOCKFULLSCREENSHELLV1_H - -#include - -#include - -namespace Impl { - -class Surface; -class FullScreenShellV1; - -class FullScreenShellV1 : public QtWaylandServer::zwp_fullscreen_shell_v1 -{ -public: - explicit FullScreenShellV1(::wl_display *display) : zwp_fullscreen_shell_v1(display, 1) {} - - QList surfaces() const { return m_surfaces; } - void removeSurface(Surface *surface) { m_surfaces.removeOne(surface); } - -protected: - void zwp_fullscreen_shell_v1_present_surface(Resource *resource, struct ::wl_resource *surface, uint32_t method, struct ::wl_resource *output) override; - -private: - QList m_surfaces; -}; - -} // namespace Impl - -#endif // MOCKFULLSCREENSHELLV1_H diff --git a/tests/auto/wayland/shared_old/mockinput.cpp b/tests/auto/wayland/shared_old/mockinput.cpp deleted file mode 100644 index 8b7592824d7..00000000000 --- a/tests/auto/wayland/shared_old/mockinput.cpp +++ /dev/null @@ -1,474 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "mockcompositor.h" -#include "mockinput.h" -#include "mocksurface.h" - -namespace Impl { - -void Compositor::setKeyboardFocus(void *data, const QList ¶meters) -{ - Compositor *compositor = static_cast(data); - compositor->m_keyboard->setFocus(resolveSurface(parameters.first())); -} - -void Compositor::sendMousePress(void *data, const QList ¶meters) -{ - Compositor *compositor = static_cast(data); - Surface *surface = resolveSurface(parameters.first()); - if (!surface) - return; - - QPoint pos = parameters.last().toPoint(); - compositor->m_pointer->setFocus(surface, pos); - compositor->m_pointer->sendMotion(pos); - compositor->m_pointer->sendButton(0x110, 1); -} - -void Compositor::sendMouseRelease(void *data, const QList ¶meters) -{ - Compositor *compositor = static_cast(data); - Surface *surface = resolveSurface(parameters.first()); - if (!surface) - return; - - compositor->m_pointer->sendButton(0x110, 0); -} - -void Compositor::sendKeyPress(void *data, const QList ¶meters) -{ - Compositor *compositor = static_cast(data); - Surface *surface = resolveSurface(parameters.first()); - if (!surface) - return; - - compositor->m_keyboard->sendKey(parameters.last().toUInt() - 8, 1); -} - -void Compositor::sendKeyRelease(void *data, const QList ¶meters) -{ - Compositor *compositor = static_cast(data); - Surface *surface = resolveSurface(parameters.first()); - if (!surface) - return; - - compositor->m_keyboard->sendKey(parameters.last().toUInt() - 8, 0); -} - -void Compositor::sendTouchDown(void *data, const QList ¶meters) -{ - Compositor *compositor = static_cast(data); - Surface *surface = resolveSurface(parameters.first()); - - Q_ASSERT(compositor); - Q_ASSERT(surface); - - QPoint position = parameters.at(1).toPoint(); - int id = parameters.at(2).toInt(); - - compositor->m_touch->sendDown(surface, position, id); -} - -void Compositor::sendTouchUp(void *data, const QList ¶meters) -{ - Compositor *compositor = static_cast(data); - Surface *surface = resolveSurface(parameters.first()); - - Q_ASSERT(compositor); - Q_ASSERT(surface); - - int id = parameters.at(1).toInt(); - - compositor->m_touch->sendUp(surface, id); -} - -void Compositor::sendTouchMotion(void *data, const QList ¶meters) -{ - Compositor *compositor = static_cast(data); - Surface *surface = resolveSurface(parameters.first()); - - Q_ASSERT(compositor); - Q_ASSERT(surface); - - QPoint position = parameters.at(1).toPoint(); - int id = parameters.at(2).toInt(); - - compositor->m_touch->sendMotion(surface, position, id); -} - -void Compositor::sendTouchFrame(void *data, const QList ¶meters) -{ - Compositor *compositor = static_cast(data); - Surface *surface = resolveSurface(parameters.first()); - - Q_ASSERT(compositor); - Q_ASSERT(surface); - - compositor->m_touch->sendFrame(surface); -} - -void Compositor::sendDataDeviceDataOffer(void *data, const QList ¶meters) -{ - Compositor *compositor = static_cast(data); - Surface *surface = resolveSurface(parameters.first()); - - Q_ASSERT(compositor); - Q_ASSERT(surface); - - compositor->m_data_device_manager->dataDevice()->sendDataOffer(surface->resource()->client()); -} - -void Compositor::sendDataDeviceEnter(void *data, const QList ¶meters) -{ - Compositor *compositor = static_cast(data); - Surface *surface = resolveSurface(parameters.first()); - QPoint position = parameters.at(1).toPoint(); - - Q_ASSERT(compositor); - Q_ASSERT(surface); - - compositor->m_data_device_manager->dataDevice()->sendEnter(surface, position); -} - -void Compositor::sendDataDeviceMotion(void *data, const QList ¶meters) -{ - Compositor *compositor = static_cast(data); - Q_ASSERT(compositor); - QPoint position = parameters.first().toPoint(); - compositor->m_data_device_manager->dataDevice()->sendMotion(position); -} - -void Compositor::sendDataDeviceDrop(void *data, const QList ¶meters) -{ - Compositor *compositor = static_cast(data); - Surface *surface = resolveSurface(parameters.first()); - - Q_ASSERT(compositor); - Q_ASSERT(surface); - - compositor->m_data_device_manager->dataDevice()->sendDrop(surface); -} - -void Compositor::sendDataDeviceLeave(void *data, const QList ¶meters) -{ - Compositor *compositor = static_cast(data); - Surface *surface = resolveSurface(parameters.first()); - - Q_ASSERT(compositor); - Q_ASSERT(surface); - - compositor->m_data_device_manager->dataDevice()->sendLeave(surface); -} - -void Compositor::waitForStartDrag(void *data, const QList ¶meters) -{ - Q_UNUSED(parameters); - Compositor *compositor = static_cast(data); - Q_ASSERT(compositor); - while (!compositor->m_startDragSeen) { - wl_display_flush_clients(compositor->m_display); - wl_event_loop_dispatch(compositor->m_loop, 100); - } - compositor->m_startDragSeen = false; -} - -Seat::Seat(Compositor *compositor, struct ::wl_display *display) - : wl_seat(display, 2) - , m_compositor(compositor) - , m_keyboard(new Keyboard(compositor)) - , m_pointer(new Pointer(compositor)) - , m_touch(new Touch(compositor)) -{ -} - -Seat::~Seat() -{ -} - -void Seat::seat_bind_resource(Resource *resource) -{ - send_capabilities(resource->handle, capability_keyboard | capability_pointer | capability_touch); -} - -void Seat::seat_get_keyboard(Resource *resource, uint32_t id) -{ - m_keyboard->add(resource->client(), id, resource->version()); -} - -void Seat::seat_get_pointer(Resource *resource, uint32_t id) -{ - m_pointer->add(resource->client(), id, resource->version()); -} - -void Seat::seat_get_touch(Resource *resource, uint32_t id) -{ - m_touch->add(resource->client(), id, resource->version()); -} - -Keyboard::Keyboard(Compositor *compositor) - : m_compositor(compositor) -{ -} - -Keyboard::~Keyboard() -{ -} - -void Keyboard::setFocus(Surface *surface) -{ - if (m_focusResource && m_focus != surface) { - uint32_t serial = m_compositor->nextSerial(); - send_leave(m_focusResource->handle, serial, m_focus->resource()->handle); - } - - Resource *resource = surface ? resourceMap().value(surface->resource()->client()) : 0; - - if (resource && (m_focus != surface || m_focusResource != resource)) { - uint32_t serial = m_compositor->nextSerial(); - send_modifiers(resource->handle, serial, 0, 0, 0, 0); - send_enter(resource->handle, serial, surface->resource()->handle, QByteArray()); - } - - m_focusResource = resource; - m_focus = surface; -} - -void Keyboard::handleSurfaceDestroyed(Surface *surface) -{ - if (surface == m_focus) { - m_focusResource = nullptr; - m_focus = nullptr; - } -} - -void Keyboard::sendKey(uint32_t key, uint32_t state) -{ - if (m_focusResource) { - uint32_t serial = m_compositor->nextSerial(); - send_key(m_focusResource->handle, serial, m_compositor->time(), key, state); - } -} - - -void Keyboard::keyboard_destroy_resource(wl_keyboard::Resource *resource) -{ - if (m_focusResource == resource) - m_focusResource = 0; -} - -Pointer::Pointer(Compositor *compositor) - : m_compositor(compositor) -{ -} - -Pointer::~Pointer() -{ - -} - -void Pointer::setFocus(Surface *surface, const QPoint &pos) -{ - if (m_focusResource && m_focus != surface) { - uint32_t serial = m_compositor->nextSerial(); - send_leave(m_focusResource->handle, serial, m_focus->resource()->handle); - } - - Resource *resource = surface ? resourceMap().value(surface->resource()->client()) : 0; - - if (resource && (m_focus != surface || resource != m_focusResource)) { - uint32_t serial = m_compositor->nextSerial(); - send_enter(resource->handle, serial, surface->resource()->handle, - wl_fixed_from_int(pos.x()), wl_fixed_from_int(pos.y())); - } - - m_focusResource = resource; - m_focus = surface; -} - -void Pointer::handleSurfaceDestroyed(Surface *surface) -{ - if (m_focus == surface) { - m_focus = nullptr; - m_focusResource = nullptr; - } -} - -void Pointer::sendMotion(const QPoint &pos) -{ - if (m_focusResource) - send_motion(m_focusResource->handle, m_compositor->time(), - wl_fixed_from_int(pos.x()), wl_fixed_from_int(pos.y())); -} - -void Pointer::sendButton(uint32_t button, uint32_t state) -{ - if (m_focusResource) { - uint32_t serial = m_compositor->nextSerial(); - send_button(m_focusResource->handle, serial, m_compositor->time(), - button, state); - } -} - -void Pointer::pointer_destroy_resource(wl_pointer::Resource *resource) -{ - if (m_focusResource == resource) - m_focusResource = 0; -} - -Touch::Touch(Compositor *compositor) - : wl_touch() - , m_compositor(compositor) -{ -} - -void Touch::sendDown(Surface *surface, const QPoint &position, int id) -{ - uint32_t serial = m_compositor->nextSerial(); - uint32_t time = m_compositor->time(); - Q_ASSERT(surface); - Resource *resource = resourceMap().value(surface->resource()->client()); - Q_ASSERT(resource); - auto x = wl_fixed_from_int(position.x()); - auto y = wl_fixed_from_int(position.y()); - wl_touch_send_down(resource->handle, serial, time, surface->resource()->handle, id, x, y); -} - -void Touch::sendUp(Surface *surface, int id) -{ - Resource *resource = resourceMap().value(surface->resource()->client()); - wl_touch_send_up(resource->handle, m_compositor->nextSerial(), m_compositor->time(), id); -} - -void Touch::sendMotion(Surface *surface, const QPoint &position, int id) -{ - Resource *resource = resourceMap().value(surface->resource()->client()); - uint32_t time = m_compositor->time(); - auto x = wl_fixed_from_int(position.x()); - auto y = wl_fixed_from_int(position.y()); - wl_touch_send_motion(resource->handle, time, id, x, y); -} - -void Touch::sendFrame(Surface *surface) -{ - Resource *resource = resourceMap().value(surface->resource()->client()); - wl_touch_send_frame(resource->handle); -} - -DataOffer::DataOffer() - : wl_data_offer() -{ - -} - -DataDevice::DataDevice(Compositor *compositor) - : m_compositor(compositor) -{ - -} - -void DataDevice::sendDataOffer(wl_client *client) -{ - m_dataOffer = new QtWaylandServer::wl_data_offer(client, 0, 1); - Resource *resource = resourceMap().value(client); - send_data_offer(resource->handle, m_dataOffer->resource()->handle); -} - -void DataDevice::sendEnter(Surface *surface, const QPoint& position) -{ - uint serial = m_compositor->nextSerial(); - m_focus = surface; - Resource *resource = resourceMap().value(surface->resource()->client()); - send_enter(resource->handle, serial, surface->resource()->handle, position.x(), position.y(), m_dataOffer->resource()->handle); -} - -void DataDevice::sendMotion(const QPoint &position) -{ - uint32_t time = m_compositor->time(); - Resource *resource = resourceMap().value(m_focus->resource()->client()); - send_motion(resource->handle, time, position.x(), position.y()); -} - -void DataDevice::sendDrop(Surface *surface) -{ - Resource *resource = resourceMap().value(surface->resource()->client()); - send_drop(resource->handle); -} - -void DataDevice::sendLeave(Surface *surface) -{ - Resource *resource = resourceMap().value(surface->resource()->client()); - send_leave(resource->handle); -} - -DataDevice::~DataDevice() -{ - -} - -void DataDevice::data_device_start_drag(QtWaylandServer::wl_data_device::Resource *resource, wl_resource *source, wl_resource *origin, wl_resource *icon, uint32_t serial) -{ - Q_UNUSED(resource); - Q_UNUSED(source); - Q_UNUSED(origin); - Q_UNUSED(icon); - Q_UNUSED(serial); - m_compositor->m_startDragSeen = true; -} - -DataDeviceManager::DataDeviceManager(Compositor *compositor, wl_display *display) - : wl_data_device_manager(display, 1) - , m_compositor(compositor) -{ - -} - -DataDeviceManager::~DataDeviceManager() -{ - -} - -DataDevice *DataDeviceManager::dataDevice() const -{ - return m_data_device.data(); -} - -void DataDeviceManager::data_device_manager_get_data_device(Resource *resource, uint32_t id, struct ::wl_resource *seat) -{ - Q_UNUSED(seat); - if (!m_data_device) - m_data_device.reset(new DataDevice(m_compositor)); - m_data_device->add(resource->client(), id, 1); -} - -void DataDeviceManager::data_device_manager_create_data_source(QtWaylandServer::wl_data_device_manager::Resource *resource, uint32_t id) -{ - new QtWaylandServer::wl_data_source(resource->client(), id, 1); -} - -} diff --git a/tests/auto/wayland/shared_old/mockinput.h b/tests/auto/wayland/shared_old/mockinput.h deleted file mode 100644 index d9adb3621f2..00000000000 --- a/tests/auto/wayland/shared_old/mockinput.h +++ /dev/null @@ -1,172 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Copyright (C) 2016 Klarälvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef MOCKINPUT_H -#define MOCKINPUT_H - -#include - -#include "qwayland-server-wayland.h" - -#include "mockcompositor.h" - -namespace Impl { - -class Keyboard; -class Pointer; - -class Seat : public QtWaylandServer::wl_seat -{ -public: - Seat(Compositor *compositor, struct ::wl_display *display); - ~Seat(); - - Compositor *compositor() const { return m_compositor; } - - Keyboard *keyboard() const { return m_keyboard.data(); } - Pointer *pointer() const { return m_pointer.data(); } - Touch *touch() const { return m_touch.data(); } - -protected: - void seat_bind_resource(Resource *resource) override; - void seat_get_keyboard(Resource *resource, uint32_t id) override; - void seat_get_pointer(Resource *resource, uint32_t id) override; - void seat_get_touch(Resource *resource, uint32_t id) override; - -private: - Compositor *m_compositor = nullptr; - - QScopedPointer m_keyboard; - QScopedPointer m_pointer; - QScopedPointer m_touch; -}; - -class Keyboard : public QtWaylandServer::wl_keyboard -{ -public: - Keyboard(Compositor *compositor); - ~Keyboard(); - - Surface *focus() const { return m_focus; } - void setFocus(Surface *surface); - void handleSurfaceDestroyed(Surface *surface); - - void sendKey(uint32_t key, uint32_t state); - -protected: - void keyboard_destroy_resource(wl_keyboard::Resource *resource) override; - -private: - Compositor *m_compositor = nullptr; - - Resource *m_focusResource = nullptr; - Surface *m_focus = nullptr; -}; - -class Pointer : public QtWaylandServer::wl_pointer -{ -public: - Pointer(Compositor *compositor); - ~Pointer(); - - Surface *focus() const { return m_focus; } - - void setFocus(Surface *surface, const QPoint &pos); - void handleSurfaceDestroyed(Surface *surface); - void sendMotion(const QPoint &pos); - void sendButton(uint32_t button, uint32_t state); - -protected: - void pointer_destroy_resource(wl_pointer::Resource *resource) override; - -private: - Compositor *m_compositor = nullptr; - - Resource *m_focusResource = nullptr; - Surface *m_focus = nullptr; -}; - -class Touch : public QtWaylandServer::wl_touch -{ -public: - Touch(Compositor *compositor); - void sendDown(Surface *surface, const QPoint &position, int id); - void sendUp(Surface *surface, int id); - void sendMotion(Surface *surface, const QPoint &position, int id); - void sendFrame(Surface *surface); -private: - Compositor *m_compositor = nullptr; -}; - -class DataOffer : public QtWaylandServer::wl_data_offer -{ -public: - DataOffer(); -}; - -class DataDevice : public QtWaylandServer::wl_data_device -{ -public: - DataDevice(Compositor *compositor); - void sendDataOffer(wl_client *client); - void sendEnter(Surface *surface, const QPoint &position); - void sendMotion(const QPoint &position); - void sendDrop(Surface *surface); - void sendLeave(Surface *surface); - ~DataDevice(); - -protected: - void data_device_start_drag(Resource *resource, struct ::wl_resource *source, struct ::wl_resource *origin, struct ::wl_resource *icon, uint32_t serial) override; - -private: - Compositor *m_compositor = nullptr; - QtWaylandServer::wl_data_offer *m_dataOffer = nullptr; - Surface* m_focus = nullptr; -}; - -class DataDeviceManager : public QtWaylandServer::wl_data_device_manager -{ -public: - DataDeviceManager(Compositor *compositor, struct ::wl_display *display); - ~DataDeviceManager(); - DataDevice *dataDevice() const; - -protected: - void data_device_manager_get_data_device(Resource *resource, uint32_t id, struct ::wl_resource *seat) override; - void data_device_manager_create_data_source(Resource *resource, uint32_t id) override; - -private: - Compositor *m_compositor = nullptr; - - QScopedPointer m_data_device; -}; - -} - -#endif // MOCKINPUT_H diff --git a/tests/auto/wayland/shared_old/mockiviapplication.cpp b/tests/auto/wayland/shared_old/mockiviapplication.cpp deleted file mode 100644 index 29a3089931e..00000000000 --- a/tests/auto/wayland/shared_old/mockiviapplication.cpp +++ /dev/null @@ -1,72 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "mockiviapplication.h" -#include "mocksurface.h" -#include "mockcompositor.h" - -namespace Impl { - -void Compositor::sendIviSurfaceConfigure(void *data, const QList ¶meters) -{ - Q_UNUSED(data); - IviSurface *iviSurface = resolveIviSurface(parameters.at(0)); - Q_ASSERT(iviSurface && iviSurface->resource()); - QSize size = parameters.at(1).toSize(); - Q_ASSERT(!size.isEmpty()); - iviSurface->send_configure(size.width(), size.height()); -} - -IviSurface::IviSurface(IviApplication *iviApplication, Surface *surface, uint iviId, wl_client *client, uint32_t id) - : QtWaylandServer::ivi_surface(client, id, 1) - , m_surface(surface) - , m_iviApplication(iviApplication) - , m_iviId(iviId) - , m_mockIviSurface(new MockIviSurface(this)) -{ - iviApplication->addIviSurface(this); - surface->map(); -} - -IviSurface::~IviSurface() -{ - m_iviApplication->removeIviSurface(this); - m_mockIviSurface->m_iviSurface = nullptr; -} - -void IviSurface::ivi_surface_destroy(Resource *resource) -{ - wl_resource_destroy(resource->handle); -} - -void IviApplication::ivi_application_surface_create(Resource *resource, uint32_t ivi_id, ::wl_resource *surface, uint32_t id) -{ - new IviSurface(this, Surface::fromResource(surface), ivi_id, resource->client(), id); -} - -} // namespace Impl diff --git a/tests/auto/wayland/shared_old/mockiviapplication.h b/tests/auto/wayland/shared_old/mockiviapplication.h deleted file mode 100644 index e2e3cb46563..00000000000 --- a/tests/auto/wayland/shared_old/mockiviapplication.h +++ /dev/null @@ -1,85 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2018 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef MOCKIVIAPPLICATION_H -#define MOCKIVIAPPLICATION_H - -#include - -#include -#include - -class MockIviSurface; - -namespace Impl { - -class Surface; -class IviApplication; - -class IviSurface : public QtWaylandServer::ivi_surface -{ -public: - IviSurface(IviApplication *iviApplication, Surface *surface, uint iviId, wl_client *client, uint32_t id); - ~IviSurface() override; - IviApplication *iviApplication() const { return m_iviApplication; } - Surface *surface() const { return m_surface; } - uint iviId() const { return m_iviId; } - - QSharedPointer mockIviSurface() const { return m_mockIviSurface; } - -protected: - void ivi_surface_destroy_resource(Resource *) override { delete this; } - void ivi_surface_destroy(Resource *resource) override; - -private: - Surface *m_surface = nullptr; - IviApplication *m_iviApplication = nullptr; - const uint m_iviId = 0; - QSharedPointer m_mockIviSurface; -}; - -class IviApplication : public QtWaylandServer::ivi_application -{ -public: - explicit IviApplication(::wl_display *display) : ivi_application(display, 1) {} - QList iviSurfaces() const { return m_iviSurfaces; } - -protected: - void ivi_application_surface_create(Resource *resource, uint32_t ivi_id, ::wl_resource *surface, uint32_t id) override; - -private: - void addIviSurface(IviSurface *iviSurface) { m_iviSurfaces.append(iviSurface); } - void removeIviSurface(IviSurface *iviSurface) { m_iviSurfaces.removeOne(iviSurface); } - QList m_iviSurfaces; - - friend class IviSurface; -}; - -} // namespace Impl - -#endif // MOCKIVIAPPLICATION_H diff --git a/tests/auto/wayland/shared_old/mockoutput.cpp b/tests/auto/wayland/shared_old/mockoutput.cpp deleted file mode 100644 index cb7285959f2..00000000000 --- a/tests/auto/wayland/shared_old/mockoutput.cpp +++ /dev/null @@ -1,93 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "mockcompositor.h" -#include "mockoutput.h" - -#include - -namespace Impl { - -void Compositor::setOutputMode(void *data, const QList ¶meters) -{ - Compositor *compositor = static_cast(data); - QSize size = parameters.first().toSize(); - Output *output = compositor->m_outputs.first(); - Q_ASSERT(output); - output->setCurrentMode(size); -} - -Output::Output(wl_display *display, const QSize &resolution, const QPoint &position) - : wl_output(display, 2) - , m_size(resolution) - , m_position(position) - , m_physicalSize(520, 320) - , m_mockOutput(new MockOutput(this)) -{ -} - -void Output::setCurrentMode(const QSize &size) -{ - m_size = size; - for (Resource *resource : resourceMap()) { - sendCurrentMode(resource); - send_done(resource->handle); - } -} - -void Output::output_bind_resource(QtWaylandServer::wl_output::Resource *resource) -{ - sendGeometry(resource); - sendCurrentMode(resource); - send_done(resource->handle); -} - -void Output::sendGeometry(Resource *resource) -{ - const int subPixel = 0; - const int transform = 0; - - send_geometry(resource->handle, - m_position.x(), m_position.y(), - m_physicalSize.width(), m_physicalSize.height(), - subPixel, "", "", transform ); -} - -void Output::sendCurrentMode(Resource *resource) -{ - send_mode(resource->handle, - WL_OUTPUT_MODE_CURRENT | WL_OUTPUT_MODE_PREFERRED, - m_size.width(), m_size.height(), 60000); -} - -} // Impl - -MockOutput::MockOutput(Impl::Output *output) - : m_output(output) -{ -} diff --git a/tests/auto/wayland/shared_old/mockoutput.h b/tests/auto/wayland/shared_old/mockoutput.h deleted file mode 100644 index d5a2bb56b6e..00000000000 --- a/tests/auto/wayland/shared_old/mockoutput.h +++ /dev/null @@ -1,62 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef MOCKOUTPUT_H -#define MOCKOUTPUT_H - -#include - -#include "qwayland-server-wayland.h" - -#include "mockcompositor.h" - -namespace Impl { - -class Output : public QtWaylandServer::wl_output -{ -public: - Output(::wl_display *display, const QSize &resolution, const QPoint &position); - - QSharedPointer mockOutput() const { return m_mockOutput; } - void setCurrentMode(const QSize &size); - -protected: - void output_bind_resource(Resource *resource) override; - -private: - void sendGeometry(Resource *resource); - void sendCurrentMode(Resource *resource); - QSize m_size; - QPoint m_position; - const QSize m_physicalSize; - QSharedPointer m_mockOutput; -}; - -} - -#endif // MOCKOUTPUT_H diff --git a/tests/auto/wayland/shared_old/mockregion.cpp b/tests/auto/wayland/shared_old/mockregion.cpp deleted file mode 100644 index 78b457fae49..00000000000 --- a/tests/auto/wayland/shared_old/mockregion.cpp +++ /dev/null @@ -1,51 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2020 Aleix Pol Gonzalez -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "mockregion.h" -#include "mockcompositor.h" - -namespace Impl { - -Region::Region(wl_client *client, uint32_t id, int v, Compositor *compositor) - : QtWaylandServer::wl_region(client, id, v), - m_compositor(compositor), - m_mockRegion(new MockRegion(this)) -{ -} - -Region::~Region() = default; - -void Region::region_destroy_resource(Resource *resource) -{ - Q_UNUSED(resource) - delete this; -} - -} - -MockRegion::MockRegion(Impl::Region *region) : m_region(region) { } diff --git a/tests/auto/wayland/shared_old/mockregion.h b/tests/auto/wayland/shared_old/mockregion.h deleted file mode 100644 index f98a25fbb07..00000000000 --- a/tests/auto/wayland/shared_old/mockregion.h +++ /dev/null @@ -1,62 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2020 Aleix Pol Gonzalez -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef MOCKREGION_H -#define MOCKREGION_H - -#include -#include - -#include "qwayland-server-wayland.h" - -class MockRegion; - -namespace Impl { - -class Compositor; - -class Region : public QtWaylandServer::wl_region -{ -public: - Region(wl_client *client, uint32_t id, int v, Compositor *compositor); - ~Region(); - - Compositor *compositor() const { return m_compositor; } - static Region *fromResource(struct ::wl_resource *resource); - -protected: - void region_destroy_resource(Resource *resource) override; - -private: - Compositor *m_compositor = nullptr; - QSharedPointer m_mockRegion; -}; - -} - -#endif // MOCKREGION_H diff --git a/tests/auto/wayland/shared_old/mocksurface.cpp b/tests/auto/wayland/shared_old/mocksurface.cpp deleted file mode 100644 index de162b07898..00000000000 --- a/tests/auto/wayland/shared_old/mocksurface.cpp +++ /dev/null @@ -1,160 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "mocksurface.h" -#include "mockoutput.h" -#include "mockcompositor.h" -#include "mockwlshell.h" - -#include - -namespace Impl { - -void Compositor::sendShellSurfaceConfigure(void *data, const QList ¶meters) -{ - Compositor *compositor = static_cast(data); - Surface *surface = resolveSurface(parameters.at(0)); - QSize size = parameters.at(1).toSize(); - Q_ASSERT(size.isValid()); - if (auto wlShellSurface = surface->wlShellSurface()) { - const uint edges = 0; - wlShellSurface->send_configure(edges, size.width(), size.height()); - } else { - qWarning() << "The mocking framework doesn't know how to send a configure event for this surface"; - } -} - -Surface::Surface(wl_client *client, uint32_t id, int v, Compositor *compositor) - : QtWaylandServer::wl_surface(client, id, v) - , m_compositor(compositor) - , m_mockSurface(new MockSurface(this)) -{ -} - -Surface::~Surface() -{ - m_mockSurface->m_surface = 0; -} - -void Surface::map() -{ - m_mapped = true; -} - -bool Surface::isMapped() const -{ - return m_mapped; -} - -Surface *Surface::fromResource(struct ::wl_resource *resource) -{ - if (auto *r = Resource::fromResource(resource)) - return static_cast(r->surface_object); - return nullptr; -} - -void Surface::surface_destroy_resource(Resource *) -{ - compositor()->removeSurface(this); - delete this; -} - -void Surface::surface_destroy(Resource *resource) -{ - if (m_wlShellSurface) // on wl-shell the shell surface is automatically destroyed with the surface - wl_resource_destroy(m_wlShellSurface->resource()->handle); - Q_ASSERT(!m_wlShellSurface); - wl_resource_destroy(resource->handle); -} - -void Surface::surface_attach(Resource *resource, struct wl_resource *buffer, int x, int y) -{ - Q_UNUSED(resource); - Q_UNUSED(x); - Q_UNUSED(y); - m_buffer = buffer; - - if (!buffer) - m_mockSurface->image = QImage(); -} - -void Surface::surface_damage(Resource *resource, - int32_t x, int32_t y, int32_t width, int32_t height) -{ - Q_UNUSED(resource); - Q_UNUSED(x); - Q_UNUSED(y); - Q_UNUSED(width); - Q_UNUSED(height); -} - -void Surface::surface_damage_buffer(Resource *resource, - int32_t x, int32_t y, int32_t width, int32_t height) -{ - Q_UNUSED(resource); - Q_UNUSED(x); - Q_UNUSED(y); - Q_UNUSED(width); - Q_UNUSED(height); -} - -void Surface::surface_frame(Resource *resource, - uint32_t callback) -{ - wl_resource *frameCallback = wl_resource_create(resource->client(), &wl_callback_interface, 1, callback); - m_frameCallbackList << frameCallback; -} - -void Surface::surface_commit(Resource *resource) -{ - Q_UNUSED(resource); - - if (m_buffer) { - struct ::wl_shm_buffer *shm_buffer = wl_shm_buffer_get(m_buffer); - if (shm_buffer) { - int stride = wl_shm_buffer_get_stride(shm_buffer); - uint format = wl_shm_buffer_get_format(shm_buffer); - Q_UNUSED(format); - void *data = wl_shm_buffer_get_data(shm_buffer); - const uchar *char_data = static_cast(data); - QImage img(char_data, wl_shm_buffer_get_width(shm_buffer), wl_shm_buffer_get_height(shm_buffer), stride, QImage::Format_ARGB32_Premultiplied); - m_mockSurface->image = img; - } - } - - for (wl_resource *frameCallback : qExchange(m_frameCallbackList, {})) { - wl_callback_send_done(frameCallback, m_compositor->time()); - wl_resource_destroy(frameCallback); - } -} - -} -MockSurface::MockSurface(Impl::Surface *surface) - : m_surface(surface) -{ -} diff --git a/tests/auto/wayland/shared_old/mocksurface.h b/tests/auto/wayland/shared_old/mocksurface.h deleted file mode 100644 index 4b6462309ab..00000000000 --- a/tests/auto/wayland/shared_old/mocksurface.h +++ /dev/null @@ -1,84 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef MOCKSURFACE_H -#define MOCKSURFACE_H - -#include - -#include "qwayland-server-wayland.h" - -#include "mockcompositor.h" - -namespace Impl { - -class WlShellSurface; - -class Surface : public QtWaylandServer::wl_surface -{ -public: - Surface(wl_client *client, uint32_t id, int v, Compositor *compositor); - ~Surface(); - - Compositor *compositor() const { return m_compositor; } - static Surface *fromResource(struct ::wl_resource *resource); - void map(); - bool isMapped() const; - WlShellSurface *wlShellSurface() const { return m_wlShellSurface; } - - QSharedPointer mockSurface() const { return m_mockSurface; } - -protected: - - void surface_destroy_resource(Resource *resource) override; - - void surface_destroy(Resource *resource) override; - void surface_attach(Resource *resource, - struct wl_resource *buffer, int x, int y) override; - void surface_damage(Resource *resource, - int32_t x, int32_t y, int32_t width, int32_t height) override; - void surface_damage_buffer(Resource *resource, - int32_t x, int32_t y, int32_t width, int32_t height) override; - void surface_frame(Resource *resource, - uint32_t callback) override; - void surface_commit(Resource *resource) override; -private: - wl_resource *m_buffer = nullptr; - WlShellSurface *m_wlShellSurface = nullptr; - - Compositor *m_compositor = nullptr; - QSharedPointer m_mockSurface; - QList m_frameCallbackList; - bool m_mapped = false; - - friend class WlShellSurface; -}; - -} - -#endif // MOCKSURFACE_H diff --git a/tests/auto/wayland/shared_old/mockwlshell.cpp b/tests/auto/wayland/shared_old/mockwlshell.cpp deleted file mode 100644 index 50e539932f8..00000000000 --- a/tests/auto/wayland/shared_old/mockwlshell.cpp +++ /dev/null @@ -1,52 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2018 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "mockwlshell.h" -#include "mocksurface.h" - -namespace Impl { - -WlShellSurface::WlShellSurface(wl_client *client, int id, Surface *surface) - : QtWaylandServer::wl_shell_surface(client, id, 1) - , m_surface(surface) -{ - surface->m_wlShellSurface = this; - surface->map(); -} - -WlShellSurface::~WlShellSurface() -{ - m_surface->m_wlShellSurface = nullptr; -} - -void WlShell::shell_get_shell_surface(QtWaylandServer::wl_shell::Resource *resource, uint32_t id, wl_resource *surface) -{ - new WlShellSurface(resource->client(), id, Surface::fromResource(surface)); -} - -} // namespace Impl diff --git a/tests/auto/wayland/shared_old/mockwlshell.h b/tests/auto/wayland/shared_old/mockwlshell.h deleted file mode 100644 index 3da586ca88f..00000000000 --- a/tests/auto/wayland/shared_old/mockwlshell.h +++ /dev/null @@ -1,58 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2018 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include - -#ifndef MOCKWLSHELL_H -#define MOCKWLSHELL_H - -namespace Impl { - -class Surface; - -class WlShellSurface : public QtWaylandServer::wl_shell_surface -{ -public: - explicit WlShellSurface(::wl_client *client, int id, Surface *surface); - ~WlShellSurface() override; - void shell_surface_destroy_resource(Resource *) override { delete this; } - -private: - Surface *m_surface = nullptr; -}; - -class WlShell : public QtWaylandServer::wl_shell -{ -public: - explicit WlShell(::wl_display *display) : wl_shell(display, 1) {} - void shell_get_shell_surface(Resource *resource, uint32_t id, ::wl_resource *surface) override; -}; - -} // namespace Impl - -#endif // MOCKWLSHELL_H diff --git a/tests/auto/wayland/shared_old/shared_old.pri b/tests/auto/wayland/shared_old/shared_old.pri deleted file mode 100644 index 7b22c77610e..00000000000 --- a/tests/auto/wayland/shared_old/shared_old.pri +++ /dev/null @@ -1,34 +0,0 @@ -CONFIG += testcase link_pkgconfig -QT += testlib -QT += core-private gui-private waylandclient-private opengl - -QMAKE_USE += wayland-client wayland-server - -CONFIG += wayland-scanner -WAYLANDSERVERSOURCES += \ - ../../../../src/3rdparty/protocol/ivi-application.xml \ - ../../../../src/3rdparty/protocol/wayland.xml \ - ../../../../src/3rdparty/protocol/xdg-shell.xml \ - ../../../../src/3rdparty/protocol/fullscreen-shell-unstable-v1.xml - -INCLUDEPATH += ../shared_old - -SOURCES += \ - ../shared_old/mockcompositor.cpp \ - ../shared_old/mockfullscreenshellv1.cpp \ - ../shared_old/mockinput.cpp \ - ../shared_old/mockiviapplication.cpp \ - ../shared_old/mockwlshell.cpp \ - ../shared_old/mocksurface.cpp \ - ../shared_old/mockregion.cpp \ - ../shared_old/mockoutput.cpp - -HEADERS += \ - ../shared_old/mockcompositor.h \ - ../shared_old/mockfullscreenshellv1.h \ - ../shared_old/mockinput.h \ - ../shared_old/mockiviapplication.h \ - ../shared_old/mockwlshell.h \ - ../shared_old/mocksurface.h \ - ../shared_old/mockregion.h \ - ../shared_old/mockoutput.h From 227ea40b804c9093e9cfdc88c6acdab730b7d878 Mon Sep 17 00:00:00 2001 From: Liang Qi Date: Wed, 8 Sep 2021 15:45:50 +0200 Subject: [PATCH 0996/1507] Support different text input protocols from clients and one compositor at same time. For compositor side, just need to have TextInputManager and QtTextInputMethodManager together. For client side, set QT_WAYLAND_TEXT_INPUT_PROTOCOL env to choose: * If the env is unset(empty) or invalid, it will search qt_text_input_method_v1 and zwp_text_input_v2 in order * Set as "qt_text_input_method_v1" or "zwp_text_input_v2" if compositor supports * Set as "zwp_text_input_v2;qt_text_input_method_v1" Change-Id: Ieec293ff412bf2d3e5ca9c69a951bfe1899cc808 Reviewed-by: Qt CI Bot Reviewed-by: Eskil Abrahamsen Blomfeldt --- .../platforms/wayland/qwaylanddisplay.cpp | 81 ++++++++++++++++--- .../platforms/wayland/qwaylanddisplay_p.h | 4 + 2 files changed, 75 insertions(+), 10 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index 6b1d7fa40e2..9ae6abd90a3 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -307,6 +307,75 @@ void QWaylandDisplay::dispatchQueueWhile(wl_event_queue *queue, std::functionname) + << QLatin1String(QtWayland::zwp_text_input_v2::interface()->name); + timps << QLatin1String(QtWayland::qt_text_input_method_manager_v1::interface()->name) + << QLatin1String(QtWayland::zwp_text_input_manager_v2::interface()->name); + + bool found = false; + QString tiProtocols = QString::fromLocal8Bit(qgetenv("QT_WAYLAND_TEXT_INPUT_PROTOCOL")); + qCDebug(lcQpaWayland) << "QT_WAYLAND_TEXT_INPUT_PROTOCOL=" << tiProtocols; + if (!tiProtocols.isEmpty()) { + QStringList keys = tiProtocols.split(QLatin1Char(';')); + for (const QString &k : keys) { + int index = tips.indexOf(k); + if (index >= 0 && hasRegistryGlobal(timps[index]) && registerTextInputManager(timps, index)) + found = true; + } + } + + if (!found) { + for (int i = 0; i < timps.size(); i++) { + if (hasRegistryGlobal(timps[i]) && registerTextInputManager(timps, i)) + found = true; + } + } + + if (!found) + qCDebug(lcQpaWayland) << "Didn't find any supported text input protocol."; +} + +bool QWaylandDisplay::registerTextInputManager(const QStringList &protocols, int index) +{ + if (protocols.size() > 2 || index < 0 || index >= 2) + return false; + + QString p = protocols.at(index); + if (index == 0) { + for (const RegistryGlobal &global : mGlobals) { + if (global.interface == p) { + mTextInputMethodManager.reset(new QtWayland::qt_text_input_method_manager_v1(global.registry, global.id, 1)); + for (QWaylandInputDevice *inputDevice : qAsConst(mInputDevices)) + inputDevice->setTextInputMethod(new QWaylandTextInputMethod(this, mTextInputMethodManager->get_text_input_method(inputDevice->wl_seat()))); + mWaylandIntegration->reconfigureInputContext(); + return true; + } + } + } + + if (index == 1) { + for (const RegistryGlobal &global : mGlobals) { + if (global.interface == p) { + mTextInputManager.reset(new QtWayland::zwp_text_input_manager_v2(global.registry, global.id, 1)); + for (QWaylandInputDevice *inputDevice : qAsConst(mInputDevices)) + inputDevice->setTextInput(new QWaylandTextInput(this, mTextInputManager->get_text_input(inputDevice->wl_seat()))); + mWaylandIntegration->reconfigureInputContext(); + return true; + } + } + } + + return false; +} + QWaylandScreen *QWaylandDisplay::screenForOutput(struct wl_output *output) const { for (auto screen : qAsConst(mScreens)) { @@ -362,16 +431,6 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin } else if (interface == QLatin1String(QWaylandPrimarySelectionDeviceManagerV1::interface()->name)) { mPrimarySelectionManager.reset(new QWaylandPrimarySelectionDeviceManagerV1(this, id, 1)); #endif - } else if (interface == QLatin1String(QtWayland::qt_text_input_method_manager_v1::interface()->name) && !mClientSideInputContextRequested) { - mTextInputMethodManager.reset(new QtWayland::qt_text_input_method_manager_v1(registry, id, 1)); - for (QWaylandInputDevice *inputDevice : qAsConst(mInputDevices)) - inputDevice->setTextInputMethod(new QWaylandTextInputMethod(this, mTextInputMethodManager->get_text_input_method(inputDevice->wl_seat()))); - mWaylandIntegration->reconfigureInputContext(); - } else if (interface == QLatin1String(QtWayland::zwp_text_input_manager_v2::interface()->name) && !mClientSideInputContextRequested) { - mTextInputManager.reset(new QtWayland::zwp_text_input_manager_v2(registry, id, 1)); - for (QWaylandInputDevice *inputDevice : qAsConst(mInputDevices)) - inputDevice->setTextInput(new QWaylandTextInput(this, mTextInputManager->get_text_input(inputDevice->wl_seat()))); - mWaylandIntegration->reconfigureInputContext(); } else if (interface == QLatin1String(QWaylandHardwareIntegration::interface()->name)) { bool disableHardwareIntegration = qEnvironmentVariableIntValue("QT_WAYLAND_DISABLE_HW_INTEGRATION"); if (!disableHardwareIntegration) { @@ -392,6 +451,8 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin const auto copy = mRegistryListeners; // be prepared for listeners unregistering on notification for (Listener l : copy) (*l.listener)(l.data, registry, id, interface, version); + + checkTextInputProtocol(); } void QWaylandDisplay::registry_global_remove(uint32_t id) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay_p.h b/src/plugins/platforms/wayland/qwaylanddisplay_p.h index 5fc7aec32f4..fc928ff3bd5 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay_p.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay_p.h @@ -221,6 +221,7 @@ public: void dispatchQueueWhile(wl_event_queue *queue, std::function condition, int timeout = -1); bool isKeyboardAvailable() const; + public slots: void blockingReadEvents(); void flushRequests(); @@ -231,6 +232,9 @@ private: void handleWaylandSync(); void requestWaylandSync(); + void checkTextInputProtocol(); + bool registerTextInputManager(const QStringList &protocols, int index); + struct Listener { Listener() = default; Listener(RegistryListener incomingListener, From 36f4cf39006067d27bce663b2bed601e2734bcec Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Mon, 27 Sep 2021 13:37:11 +0200 Subject: [PATCH 0997/1507] Skip unnecessary commands when cross-building tools Call qt_internal_return_unless_building_tools() directly after qt_internal_add_tool() to avoid having to special-case code for when this function only creates imported targets in cross-builds. Task-number: QTBUG-85084 Change-Id: I1830d4e2b9006d1f789ec4889a01bbb66f63ff11 Reviewed-by: Alexandru Croitor Reviewed-by: Qt CI Bot --- src/tools/qtwaylandscanner/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/src/tools/qtwaylandscanner/CMakeLists.txt b/src/tools/qtwaylandscanner/CMakeLists.txt index c7b10c2b3e5..20a570bd6cc 100644 --- a/src/tools/qtwaylandscanner/CMakeLists.txt +++ b/src/tools/qtwaylandscanner/CMakeLists.txt @@ -11,6 +11,7 @@ qt_internal_add_tool(${target_name} SOURCES qtwaylandscanner.cpp ) +qt_internal_return_unless_building_tools() #### Keys ignored in scope 1:.:.:qtwaylandscanner.pro:: # _OPTION = "host_build" From 201af1b56b85a593e97ad8734a84cf6231e89dc7 Mon Sep 17 00:00:00 2001 From: Rodney Dawes Date: Mon, 4 Oct 2021 16:31:30 -0400 Subject: [PATCH 0998/1507] Fix the logic for decoding modifiers map in Wayland text input protocol Correctly check for the flags in the modifiers map when we get it from the compositor, instead of modifying the map in the for loop conditional. [ChangeLog][QWaylandInputContext] Fix modifiers map decoding logic when receiving the map from the compositor. Fixes: QTBUG-97094 Pick-to: 6.2 5.15 5.12 Change-Id: Idad19f7b1f4560d40abbb5b31032360cfe915261 Reviewed-by: Paul Olav Tvete --- src/plugins/platforms/wayland/qwaylandinputcontext.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandinputcontext.cpp b/src/plugins/platforms/wayland/qwaylandinputcontext.cpp index 7262a6a4b14..645fd56a108 100644 --- a/src/plugins/platforms/wayland/qwaylandinputcontext.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputcontext.cpp @@ -389,8 +389,10 @@ void QWaylandTextInput::zwp_text_input_v2_input_method_changed(uint32_t serial, Qt::KeyboardModifiers QWaylandTextInput::modifiersToQtModifiers(uint32_t modifiers) { Qt::KeyboardModifiers ret = Qt::NoModifier; - for (int i = 0; modifiers >>= 1; ++i) { - ret |= m_modifiersMap[i]; + for (int i = 0; i < m_modifiersMap.size(); ++i) { + if (modifiers & (1 << i)) { + ret |= m_modifiersMap[i]; + } } return ret; } From 468ac1fefb2f8996359df8f74f05f59c7b4a6fdf Mon Sep 17 00:00:00 2001 From: Giulio Camuffo Date: Mon, 16 Mar 2020 10:22:36 +0100 Subject: [PATCH 0999/1507] Move the wayland socket polling to a separate event thread New event threads is introduced which calls poll() on the wayland fd, instead of relying on the event dispatcher by using the QSocketNotifier. This allows to call in the proper order the wl_display_prepare_read(), poll() and wl_display_read_events() functions. One thread is responsible for the default queue; when needed, it emit a signal so that the main thread can dispatch the queue. Another thread is responsible for the dedicated queue for frame callbacks; this thread will dispatch events on the thread itself. QWaylandWindow is updated to, instead of each window's dedicated event queue, use this queue for frame callbacks. Co-authored-by: Ratchanan Srirattanamet Task-number: QTBUG-66075 Change-Id: Ibb33ad7f4193b866d1b8d7a0405a94d59dcad5eb Reviewed-by: Qt CI Bot Reviewed-by: Eskil Abrahamsen Blomfeldt --- .../platforms/wayland/qwaylanddisplay.cpp | 303 +++++++++++++----- .../platforms/wayland/qwaylanddisplay_p.h | 20 +- .../platforms/wayland/qwaylandintegration.cpp | 6 +- .../platforms/wayland/qwaylandwindow.cpp | 34 +- .../platforms/wayland/qwaylandwindow_p.h | 2 +- tests/auto/wayland/CMakeLists.txt | 1 + .../auto/wayland/multithreaded/CMakeLists.txt | 12 + .../multithreaded/tst_multithreaded.cpp | 165 ++++++++++ 8 files changed, 429 insertions(+), 114 deletions(-) create mode 100644 tests/auto/wayland/multithreaded/CMakeLists.txt create mode 100644 tests/auto/wayland/multithreaded/tst_multithreaded.cpp diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index 9ae6abd90a3..c56351caab4 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -90,10 +90,201 @@ #include // for std::tie +static void checkWaylandError(struct wl_display *display) +{ + int ecode = wl_display_get_error(display); + if ((ecode == EPIPE || ecode == ECONNRESET)) { + // special case this to provide a nicer error + qWarning("The Wayland connection broke. Did the Wayland compositor die?"); + } else { + qWarning("The Wayland connection experienced a fatal error: %s", strerror(ecode)); + } + _exit(1); +} + QT_BEGIN_NAMESPACE namespace QtWaylandClient { +class EventThread : public QThread +{ + Q_OBJECT +public: + enum OperatingMode { + EmitToDispatch, // Emit the signal, allow dispatching in a differnt thread. + SelfDispatch, // Dispatch the events inside this thread. + }; + + EventThread(struct wl_display * wl, struct wl_event_queue * ev_queue, + OperatingMode mode) + : m_fd(wl_display_get_fd(wl)) + , m_pipefd{ -1, -1 } + , m_wldisplay(wl) + , m_wlevqueue(ev_queue) + , m_mode(mode) + , m_reading(true) + , m_quitting(false) + { + setObjectName(QStringLiteral("WaylandEventThread")); + } + + void readAndDispatchEvents() + { + /* + * Dispatch pending events and flush the requests at least once. If the event thread + * is not reading, try to call _prepare_read() to allow the event thread to poll(). + * If that fails, re-try dispatch & flush again until _prepare_read() is successful. + * + * This allow any call to readAndDispatchEvents() to start event thread's polling, + * not only the one issued from event thread's waitForReading(), which means functions + * called from dispatch_pending() can safely spin an event loop. + */ + for (;;) { + if (dispatchQueuePending() < 0) { + checkWaylandError(m_wldisplay); + return; + } + + wl_display_flush(m_wldisplay); + + // We have to check if event thread is reading every time we dispatch + // something, as that may recursively call this function. + if (m_reading.loadAcquire()) + break; + + if (prepareReadQueue() == 0) { + QMutexLocker l(&m_mutex); + m_reading.storeRelease(true); + m_cond.wakeOne(); + break; + } + } + } + + void stop() + { + // We have to both write to the pipe and set the flag, as the thread may be + // either in the poll() or waiting for _prepare_read(). + if (m_pipefd[1] != -1 && write(m_pipefd[1], "\0", 1) == -1) + qWarning("Failed to write to the pipe: %s.", strerror(errno)); + + { + QMutexLocker l(&m_mutex); + m_quitting = true; + m_cond.wakeOne(); + } + + wait(); + } + +Q_SIGNALS: + void needReadAndDispatch(); + +protected: + void run() override + { + // we use this pipe to make the loop exit otherwise if we simply used a flag on the loop condition, if stop() gets + // called while poll() is blocking the thread will never quit since there are no wayland messages coming anymore. + struct Pipe + { + Pipe(int *fds) + : fds(fds) + { + if (qt_safe_pipe(fds) != 0) + qWarning("Pipe creation failed. Quitting may hang."); + } + ~Pipe() + { + if (fds[0] != -1) { + close(fds[0]); + close(fds[1]); + } + } + + int *fds; + } pipe(m_pipefd); + + // Make the main thread call wl_prepare_read(), dispatch the pending messages and flush the + // outbound ones. Wait until it's done before proceeding, unless we're told to quit. + while (waitForReading()) { + pollfd fds[2] = { { m_fd, POLLIN, 0 }, { m_pipefd[0], POLLIN, 0 } }; + poll(fds, 2, -1); + + if (fds[1].revents & POLLIN) { + // we don't really care to read the byte that was written here since we're closing down + wl_display_cancel_read(m_wldisplay); + break; + } + + if (fds[0].revents & POLLIN) + wl_display_read_events(m_wldisplay); + // The polll was succesfull and the event thread did the wl_display_read_events(). On the next iteration of the loop + // the event sent to the main thread will cause it to dispatch the messages just read, unless the loop exits in which + // case we don't care anymore about them. + else + wl_display_cancel_read(m_wldisplay); + } + } + +private: + bool waitForReading() + { + Q_ASSERT(QThread::currentThread() == this); + + m_reading.storeRelease(false); + + if (m_mode == SelfDispatch) { + readAndDispatchEvents(); + } else { + Q_EMIT needReadAndDispatch(); + + QMutexLocker lock(&m_mutex); + // m_reading might be set from our emit or some other invocation of + // readAndDispatchEvents(). + while (!m_reading.loadRelaxed() && !m_quitting) + m_cond.wait(&m_mutex); + } + + return !m_quitting; + } + + int dispatchQueuePending() + { + if (m_wlevqueue) + return wl_display_dispatch_queue_pending(m_wldisplay, m_wlevqueue); + else + return wl_display_dispatch_pending(m_wldisplay); + } + + int prepareReadQueue() + { + if (m_wlevqueue) + return wl_display_prepare_read_queue(m_wldisplay, m_wlevqueue); + else + return wl_display_prepare_read(m_wldisplay); + } + + int m_fd; + int m_pipefd[2]; + wl_display *m_wldisplay; + wl_event_queue *m_wlevqueue; + OperatingMode m_mode; + + /* Concurrency note when operating in EmitToDispatch mode: + * m_reading is set to false inside event thread's waitForReading(), and is + * set to true inside main thread's readAndDispatchEvents(). + * The lock is not taken when setting m_reading to false, as the main thread + * is not actively waiting for it to turn false. However, the lock is taken + * inside readAndDispatchEvents() before setting m_reading to true, + * as the event thread is actively waiting for it under the wait condition. + */ + + QAtomicInteger m_reading; + bool m_quitting; + QMutex m_mutex; + QWaitCondition m_cond; +}; + Q_LOGGING_CATEGORY(lcQpaWayland, "qt.qpa.wayland"); // for general (uncategorized) Wayland platform logging struct wl_surface *QWaylandDisplay::createSurface(void *handle) @@ -167,6 +358,12 @@ QWaylandDisplay::QWaylandDisplay(QWaylandIntegration *waylandIntegration) QWaylandDisplay::~QWaylandDisplay(void) { + if (m_eventThread) + m_eventThread->stop(); + + if (m_frameEventQueueThread) + m_frameEventQueueThread->stop(); + if (mSyncCallback) wl_callback_destroy(mSyncCallback); @@ -211,100 +408,34 @@ void QWaylandDisplay::ensureScreen() Q_ASSERT(!QGuiApplication::screens().empty()); } -void QWaylandDisplay::checkError() const -{ - int ecode = wl_display_get_error(mDisplay); - if ((ecode == EPIPE || ecode == ECONNRESET)) { - // special case this to provide a nicer error - qWarning("The Wayland connection broke. Did the Wayland compositor die?"); - } else { - qWarning("The Wayland connection experienced a fatal error: %s", strerror(ecode)); - } - _exit(1); -} - +// Called in main thread, either from queued signal or directly. void QWaylandDisplay::flushRequests() { - if (wl_display_prepare_read(mDisplay) == 0) { - wl_display_read_events(mDisplay); - } + m_eventThread->readAndDispatchEvents(); +} - if (wl_display_dispatch_pending(mDisplay) < 0) - checkError(); +// We have to wait until we have an eventDispatcher before creating the eventThread, +// otherwise forceRoundTrip() may block inside _events_read() because eventThread is +// polling. +void QWaylandDisplay::initEventThread() +{ + m_eventThread.reset( + new EventThread(mDisplay, /* default queue */ nullptr, EventThread::EmitToDispatch)); + connect(m_eventThread.get(), &EventThread::needReadAndDispatch, this, + &QWaylandDisplay::flushRequests, Qt::QueuedConnection); + m_eventThread->start(); - { - QReadLocker locker(&m_frameQueueLock); - for (const FrameQueue &q : mExternalQueues) { - QMutexLocker locker(q.mutex); - while (wl_display_prepare_read_queue(mDisplay, q.queue) != 0) - wl_display_dispatch_queue_pending(mDisplay, q.queue); - wl_display_read_events(mDisplay); - wl_display_dispatch_queue_pending(mDisplay, q.queue); - } - } - - wl_display_flush(mDisplay); + // wl_display_disconnect() free this. + m_frameEventQueue = wl_display_create_queue(mDisplay); + m_frameEventQueueThread.reset( + new EventThread(mDisplay, m_frameEventQueue, EventThread::SelfDispatch)); + m_frameEventQueueThread->start(); } void QWaylandDisplay::blockingReadEvents() { if (wl_display_dispatch(mDisplay) < 0) - checkError(); -} - -void QWaylandDisplay::destroyFrameQueue(const QWaylandDisplay::FrameQueue &q) -{ - QWriteLocker locker(&m_frameQueueLock); - auto it = std::find_if(mExternalQueues.begin(), - mExternalQueues.end(), - [&q] (const QWaylandDisplay::FrameQueue &other){ return other.queue == q.queue; }); - Q_ASSERT(it != mExternalQueues.end()); - mExternalQueues.erase(it); - if (q.queue != nullptr) - wl_event_queue_destroy(q.queue); - delete q.mutex; -} - -QWaylandDisplay::FrameQueue QWaylandDisplay::createFrameQueue() -{ - QWriteLocker locker(&m_frameQueueLock); - FrameQueue q{createEventQueue()}; - mExternalQueues.append(q); - return q; -} - -wl_event_queue *QWaylandDisplay::createEventQueue() -{ - return wl_display_create_queue(mDisplay); -} - -void QWaylandDisplay::dispatchQueueWhile(wl_event_queue *queue, std::function condition, int timeout) -{ - if (!condition()) - return; - - QElapsedTimer timer; - timer.start(); - struct pollfd pFd = qt_make_pollfd(wl_display_get_fd(mDisplay), POLLIN); - while (timeout == -1 || timer.elapsed() < timeout) { - while (wl_display_prepare_read_queue(mDisplay, queue) != 0) - wl_display_dispatch_queue_pending(mDisplay, queue); - - wl_display_flush(mDisplay); - - const int remaining = qMax(timeout - timer.elapsed(), 0ll); - const int pollTimeout = timeout == -1 ? -1 : remaining; - if (qt_poll_msecs(&pFd, 1, pollTimeout) > 0) - wl_display_read_events(mDisplay); - else - wl_display_cancel_read(mDisplay); - - if (wl_display_dispatch_queue_pending(mDisplay, queue) < 0) - checkError(); - - if (!condition()) - break; - } + checkWaylandError(mDisplay); } void QWaylandDisplay::checkTextInputProtocol() @@ -748,4 +879,6 @@ QWaylandCursorTheme *QWaylandDisplay::loadCursorTheme(const QString &name, int p } // namespace QtWaylandClient +#include "qwaylanddisplay.moc" + QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylanddisplay_p.h b/src/plugins/platforms/wayland/qwaylanddisplay_p.h index fc928ff3bd5..6d655a66b23 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay_p.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay_p.h @@ -111,6 +111,7 @@ class QWaylandSurface; class QWaylandShellIntegration; class QWaylandCursor; class QWaylandCursorTheme; +class EventThread; typedef void (*RegistryListener)(void *data, struct wl_registry *registry, @@ -122,12 +123,6 @@ class Q_WAYLAND_CLIENT_EXPORT QWaylandDisplay : public QObject, public QtWayland Q_OBJECT public: - struct FrameQueue { - FrameQueue(wl_event_queue *q = nullptr) : queue(q), mutex(new QMutex) {} - wl_event_queue *queue; - QMutex *mutex; - }; - QWaylandDisplay(QWaylandIntegration *waylandIntegration); ~QWaylandDisplay(void) override; @@ -215,20 +210,16 @@ public: void handleKeyboardFocusChanged(QWaylandInputDevice *inputDevice); void handleWindowDestroyed(QWaylandWindow *window); - wl_event_queue *createEventQueue(); - FrameQueue createFrameQueue(); - void destroyFrameQueue(const FrameQueue &q); - void dispatchQueueWhile(wl_event_queue *queue, std::function condition, int timeout = -1); + wl_event_queue *frameEventQueue() { return m_frameEventQueue; }; bool isKeyboardAvailable() const; + void initEventThread(); public slots: void blockingReadEvents(); void flushRequests(); private: - void checkError() const; - void handleWaylandSync(); void requestWaylandSync(); @@ -246,6 +237,9 @@ private: }; struct wl_display *mDisplay = nullptr; + QScopedPointer m_eventThread; + wl_event_queue *m_frameEventQueue = nullptr; + QScopedPointer m_frameEventQueueThread; QtWayland::wl_compositor mCompositor; QScopedPointer mShm; QList mWaitingScreens; @@ -298,10 +292,8 @@ private: QPointer mLastInputWindow; QPointer mLastKeyboardFocus; QList mActiveWindows; - QList mExternalQueues; struct wl_callback *mSyncCallback = nullptr; static const wl_callback_listener syncCallbackListener; - QReadWriteLock m_frameQueueLock; bool mClientSideInputContextRequested = !QPlatformInputContextFactory::requested().isNull(); diff --git a/src/plugins/platforms/wayland/qwaylandintegration.cpp b/src/plugins/platforms/wayland/qwaylandintegration.cpp index d54dff5ce56..5b712cab970 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandintegration.cpp @@ -208,11 +208,9 @@ void QWaylandIntegration::initializePlatform() void QWaylandIntegration::initialize() { - int fd = wl_display_get_fd(mDisplay->wl_display()); - QSocketNotifier *sn = new QSocketNotifier(fd, QSocketNotifier::Read, mDisplay.data()); - QObject::connect(sn, SIGNAL(activated(QSocketDescriptor)), mDisplay.data(), SLOT(flushRequests())); + mDisplay->initEventThread(); - // Call this after eventDispatcher is connected with QSocketNotifier for QWaylandDisplay::forceRoundTrip() + // Call this after initializing event thread for QWaylandDisplay::forceRoundTrip() initializePlatform(); // But the aboutToBlock() and awake() should be connected after initializePlatform(). diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 7f4088aa0a8..61537c166d7 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -76,7 +76,6 @@ QWaylandWindow *QWaylandWindow::mMouseGrab = nullptr; QWaylandWindow::QWaylandWindow(QWindow *window, QWaylandDisplay *display) : QPlatformWindow(window) , mDisplay(display) - , mFrameQueue(mDisplay->createFrameQueue()) , mResizeAfterSwap(qEnvironmentVariableIsSet("QT_WAYLAND_RESIZE_AFTER_SWAP")) { { @@ -95,8 +94,6 @@ QWaylandWindow::QWaylandWindow(QWindow *window, QWaylandDisplay *display) QWaylandWindow::~QWaylandWindow() { - mDisplay->destroyFrameQueue(mFrameQueue); - delete mWindowDecoration; if (mSurface) @@ -673,6 +670,8 @@ const wl_callback_listener QWaylandWindow::callbackListener = { void QWaylandWindow::handleFrameCallback() { + QMutexLocker locker(&mFrameSyncMutex); + mWaitingForFrameCallback = false; mFrameCallbackElapsedTimer.invalidate(); @@ -683,6 +682,8 @@ void QWaylandWindow::handleFrameCallback() mWaitingForUpdateDelivery = true; QMetaObject::invokeMethod(this, &QWaylandWindow::doHandleFrameCallback, Qt::QueuedConnection); } + + mFrameSyncWait.notify_all(); } void QWaylandWindow::doHandleFrameCallback() @@ -699,8 +700,10 @@ void QWaylandWindow::doHandleFrameCallback() bool QWaylandWindow::waitForFrameSync(int timeout) { - QMutexLocker locker(mFrameQueue.mutex); - mDisplay->dispatchQueueWhile(mFrameQueue.queue, [&]() { return mWaitingForFrameCallback; }, timeout); + QMutexLocker locker(&mFrameSyncMutex); + + QDeadlineTimer deadline(timeout); + while (mWaitingForFrameCallback && mFrameSyncWait.wait(&mFrameSyncMutex, deadline)) { } if (mWaitingForFrameCallback) { qCDebug(lcWaylandBackingstore) << "Didn't receive frame callback in time, window should now be inexposed"; @@ -1340,8 +1343,11 @@ void QWaylandWindow::requestUpdate() Q_ASSERT(hasPendingUpdateRequest()); // should be set by QPA // If we have a frame callback all is good and will be taken care of there - if (mWaitingForFrameCallback) - return; + { + QMutexLocker locker(&mFrameSyncMutex); + if (mWaitingForFrameCallback) + return; + } // If we've already called deliverUpdateRequest(), but haven't seen any attach+commit/swap yet // This is a somewhat redundant behavior and might indicate a bug in the calling code, so log @@ -1354,7 +1360,12 @@ void QWaylandWindow::requestUpdate() // so use invokeMethod to delay the delivery a bit. QMetaObject::invokeMethod(this, [this] { // Things might have changed in the meantime - if (hasPendingUpdateRequest() && !mWaitingForFrameCallback) + { + QMutexLocker locker(&mFrameSyncMutex); + if (mWaitingForFrameCallback) + return; + } + if (hasPendingUpdateRequest()) deliverUpdateRequest(); }, Qt::QueuedConnection); } @@ -1374,9 +1385,10 @@ void QWaylandWindow::handleUpdate() if (!mSurface) return; - QMutexLocker locker(mFrameQueue.mutex); + QMutexLocker locker(&mFrameSyncMutex); + struct ::wl_surface *wrappedSurface = reinterpret_cast(wl_proxy_create_wrapper(mSurface->object())); - wl_proxy_set_queue(reinterpret_cast(wrappedSurface), mFrameQueue.queue); + wl_proxy_set_queue(reinterpret_cast(wrappedSurface), mDisplay->frameEventQueue()); mFrameCallback = wl_surface_frame(wrappedSurface); wl_proxy_wrapper_destroy(wrappedSurface); wl_callback_add_listener(mFrameCallback, &QWaylandWindow::callbackListener, this); @@ -1386,6 +1398,8 @@ void QWaylandWindow::handleUpdate() // Start a timer for handling the case when the compositor stops sending frame callbacks. if (mFrameCallbackTimeout > 0) { QMetaObject::invokeMethod(this, [this] { + QMutexLocker locker(&mFrameSyncMutex); + if (mWaitingForFrameCallback) { if (mFrameCallbackCheckIntervalTimerId < 0) mFrameCallbackCheckIntervalTimerId = startTimer(mFrameCallbackTimeout); diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index a041dc40fae..17ed9fdca13 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -274,7 +274,7 @@ protected: int mFrameCallbackCheckIntervalTimerId = -1; QElapsedTimer mFrameCallbackElapsedTimer; struct ::wl_callback *mFrameCallback = nullptr; - QWaylandDisplay::FrameQueue mFrameQueue; + QMutex mFrameSyncMutex; QWaitCondition mFrameSyncWait; // True when we have called deliverRequestUpdate, but the client has not yet attached a new buffer diff --git a/tests/auto/wayland/CMakeLists.txt b/tests/auto/wayland/CMakeLists.txt index ea6c4c1b215..167cc6070c5 100644 --- a/tests/auto/wayland/CMakeLists.txt +++ b/tests/auto/wayland/CMakeLists.txt @@ -6,6 +6,7 @@ add_subdirectory(client) add_subdirectory(datadevicev1) add_subdirectory(fullscreenshellv1) add_subdirectory(iviapplication) +add_subdirectory(multithreaded) add_subdirectory(nooutput) add_subdirectory(output) add_subdirectory(primaryselectionv1) diff --git a/tests/auto/wayland/multithreaded/CMakeLists.txt b/tests/auto/wayland/multithreaded/CMakeLists.txt new file mode 100644 index 00000000000..49d93297f5b --- /dev/null +++ b/tests/auto/wayland/multithreaded/CMakeLists.txt @@ -0,0 +1,12 @@ +# Generated from multithreaded.pro. + +##################################################################### +## tst_multithreaded Test: +##################################################################### + +qt_internal_add_test(tst_multithreaded + SOURCES + tst_multithreaded.cpp + PUBLIC_LIBRARIES + SharedClientTest +) diff --git a/tests/auto/wayland/multithreaded/tst_multithreaded.cpp b/tests/auto/wayland/multithreaded/tst_multithreaded.cpp new file mode 100644 index 00000000000..ce88a72fd53 --- /dev/null +++ b/tests/auto/wayland/multithreaded/tst_multithreaded.cpp @@ -0,0 +1,165 @@ +/**************************************************************************** +** +** Copyright (C) 2018 The Qt Company Ltd. +** Copyright (C) 2020 UBports Foundataion. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include + +#include + +#include +#include +#include + +#include "mockcompositor.h" + +using namespace MockCompositor; + +/* + * This class simulate a thread from another library which use poll() to wait + * for data from Wayland compositor. + */ + +class ExternalWaylandReaderThread : public QThread +{ +public: + ExternalWaylandReaderThread(struct wl_display *disp) + : QThread() + , m_disp(disp) + { + setObjectName(QStringLiteral("ExternalWaylandReader")); + } + + ~ExternalWaylandReaderThread() + { + if (m_pipefd[1] != -1 && write(m_pipefd[1], "q", 1) == -1) + qWarning("Failed to write to the pipe: %s.", strerror(errno)); + + wait(); + } + +protected: + void run() override + { + // we use this pipe to make the loop exit otherwise if we simply used a flag on the loop condition, if stop() gets + // called while poll() is blocking the thread will never quit since there are no wayland messages coming anymore. + struct Pipe + { + Pipe(int *fds) + : fds(fds) + { + if (::pipe(fds) != 0) + qWarning("Pipe creation failed. Quitting may hang."); + } + ~Pipe() + { + if (fds[0] != -1) { + close(fds[0]); + close(fds[1]); + } + } + + int *fds; + } pipe(m_pipefd); + + struct wl_event_queue *a_queue = wl_display_create_queue(m_disp); + struct pollfd fds[2] = { { wl_display_get_fd(m_disp), POLLIN, 0 }, + { m_pipefd[0], POLLIN, 0 } }; + + while (true) { + // No wl_proxy is assigned to this queue, thus guaranteed to be always empty. + Q_ASSERT(wl_display_prepare_read_queue(m_disp, a_queue) == 0); + wl_display_flush(m_disp); + + // Wakeup every 10 seconds so that if Qt blocks in _read_events(), + // it won't last forever. + poll(fds, /* nfds */ 2, 10000); + + if (fds[0].revents & POLLIN) { + wl_display_read_events(m_disp); + } else { + wl_display_cancel_read(m_disp); + } + + if (fds[1].revents & POLLIN) { + char pipeIn; + read(m_pipefd[0], &pipeIn, 1); + if (pipeIn == 'q') + break; + } + } + + wl_event_queue_destroy(a_queue); + } + +private: + struct wl_display *m_disp; + int m_pipefd[2] = { -1, -1 }; +}; + +class tst_multithreaded : public QObject, private DefaultCompositor +{ + Q_OBJECT +private slots: + void initTestCase() + { + m_config.autoConfigure = true; + m_config.autoEnter = false; + } + void init() + { + // a test case is given new simulated thread. + QPlatformNativeInterface *native = QGuiApplication::platformNativeInterface(); + struct wl_display *wl_dpy = + (struct wl_display *)native->nativeResourceForWindow("display", NULL); + + m_extThread.reset(new ExternalWaylandReaderThread(wl_dpy)); + m_extThread->start(); + } + void cleanup() + { + QTRY_VERIFY2(isClean(), qPrintable(dirtyMessage())); + } + + void mainThreadIsNotBlocked(); + +public: + QScopedPointer m_extThread; +}; + +void tst_multithreaded::mainThreadIsNotBlocked() +{ + QElapsedTimer timer; + timer.start(); + + QTest::qWait(100); + QVERIFY(timer.elapsed() < 200); +} + +QCOMPOSITOR_TEST_MAIN(tst_multithreaded) +#include "tst_multithreaded.moc" From c98bbc549557b1e0e7c972687ac2760204dff2a5 Mon Sep 17 00:00:00 2001 From: Liang Qi Date: Thu, 7 Oct 2021 18:01:59 +0200 Subject: [PATCH 1000/1507] tests: support ivi-shell again in tst_client This amends 4767e91f7bd32ee6ffc7701035f430e453b99784. QT_WAYLAND_SHELL_INTEGRATION=ivi-shell ./tst_client Task-number: QTBUG-96440 Change-Id: I3c6d06e978c9aab3a2a61797fe359e0b1e90df17 Reviewed-by: Eskil Abrahamsen Blomfeldt --- tests/auto/wayland/client/tst_client.cpp | 79 +++++++++++--------- tests/auto/wayland/shared/mockcompositor.cpp | 38 ++++++++++ tests/auto/wayland/shared/mockcompositor.h | 6 +- 3 files changed, 87 insertions(+), 36 deletions(-) diff --git a/tests/auto/wayland/client/tst_client.cpp b/tests/auto/wayland/client/tst_client.cpp index b16dffbe95c..8ae79f347da 100644 --- a/tests/auto/wayland/client/tst_client.cpp +++ b/tests/auto/wayland/client/tst_client.cpp @@ -186,10 +186,10 @@ void tst_WaylandClient::createDestroyWindow() TestWindow window; window.show(); - QCOMPOSITOR_TRY_VERIFY(wlSurface(0)); + QCOMPOSITOR_TRY_VERIFY(surface()); window.destroy(); - QCOMPOSITOR_TRY_VERIFY(!wlSurface(0)); + QCOMPOSITOR_TRY_VERIFY(!surface()); } void tst_WaylandClient::activeWindowFollowsKeyboardFocus() @@ -198,9 +198,10 @@ void tst_WaylandClient::activeWindowFollowsKeyboardFocus() window.show(); Surface *s = nullptr; - QCOMPOSITOR_TRY_VERIFY(s = wlSurface(0)); - WlShellSurface *ss = s->wlShellSurface(); - ss->sendConfigure(0, 0, 0); + QCOMPOSITOR_TRY_VERIFY(s = surface()); + exec([=] { + sendShellSurfaceConfigure(s); + }); QCOMPOSITOR_TRY_VERIFY(window.isExposed()); @@ -225,9 +226,10 @@ void tst_WaylandClient::events() window.show(); Surface *s = nullptr; - QCOMPOSITOR_TRY_VERIFY(s = wlSurface(0)); - WlShellSurface *ss = s->wlShellSurface(); - ss->sendConfigure(0, 0, 0); + QCOMPOSITOR_TRY_VERIFY(s = surface()); + exec([=] { + sendShellSurfaceConfigure(s); + }); QCOMPOSITOR_TRY_VERIFY(window.isExposed()); @@ -304,9 +306,10 @@ void tst_WaylandClient::backingStore() window.show(); Surface *s = nullptr; - QCOMPOSITOR_TRY_VERIFY(s = wlSurface(0)); - WlShellSurface *ss = s->wlShellSurface(); - ss->sendConfigure(0, 0, 0); + QCOMPOSITOR_TRY_VERIFY(s = surface()); + exec([=] { + sendShellSurfaceConfigure(s); + }); QRect rect(QPoint(), window.size()); @@ -333,7 +336,7 @@ void tst_WaylandClient::backingStore() window.hide(); // hiding the window should destroy the surface - QCOMPOSITOR_TRY_VERIFY(!wlSurface(0)); + QCOMPOSITOR_TRY_VERIFY(!surface()); } class DndWindow : public QWindow @@ -414,9 +417,10 @@ void tst_WaylandClient::touchDrag() window.show(); Surface *s = nullptr; - QCOMPOSITOR_TRY_VERIFY(s = wlSurface(0)); - WlShellSurface *ss = s->wlShellSurface(); - ss->sendConfigure(0, 0, 0); + QCOMPOSITOR_TRY_VERIFY(s = surface()); + exec([=] { + sendShellSurfaceConfigure(s); + }); DNDTest test; test.m_surface = s; @@ -450,9 +454,10 @@ void tst_WaylandClient::mouseDrag() window.show(); Surface *s = nullptr; - QCOMPOSITOR_TRY_VERIFY(s = wlSurface(0)); - WlShellSurface *ss = s->wlShellSurface(); - ss->sendConfigure(0, 0, 0); + QCOMPOSITOR_TRY_VERIFY(s = surface()); + exec([=] { + sendShellSurfaceConfigure(s); + }); DNDTest test; test.m_surface = s; @@ -506,11 +511,11 @@ void tst_WaylandClient::dontCrashOnMultipleCommits() backingStore.flush(rect); backingStore.flush(rect); - QCOMPOSITOR_TRY_VERIFY(wlSurface(0)); + QCOMPOSITOR_TRY_VERIFY(surface()); } delete window; - QCOMPOSITOR_TRY_VERIFY(!wlSurface(0)); + QCOMPOSITOR_TRY_VERIFY(!surface()); } void tst_WaylandClient::hiddenTransientParent() @@ -521,13 +526,13 @@ void tst_WaylandClient::hiddenTransientParent() transient.setTransientParent(&parent); parent.show(); - QCOMPOSITOR_TRY_VERIFY(wlSurface(0)); + QCOMPOSITOR_TRY_VERIFY(surface()); parent.hide(); - QCOMPOSITOR_TRY_VERIFY(!wlSurface(0)); + QCOMPOSITOR_TRY_VERIFY(!surface()); transient.show(); - QCOMPOSITOR_TRY_VERIFY(wlSurface(0)); + QCOMPOSITOR_TRY_VERIFY(surface()); } void tst_WaylandClient::hiddenPopupParent() { @@ -537,9 +542,10 @@ void tst_WaylandClient::hiddenPopupParent() // wl_shell relies on a mouse event in order to send a serial and seat // with the set_popup request. Surface *s = nullptr; - QCOMPOSITOR_TRY_VERIFY(s = wlSurface(0)); - WlShellSurface *ss = s->wlShellSurface(); - ss->sendConfigure(0, 0, 0); + QCOMPOSITOR_TRY_VERIFY(s = surface()); + exec([=] { + sendShellSurfaceConfigure(s); + }); QCOMPOSITOR_TRY_VERIFY(toplevel.isExposed()); QPoint mousePressPos(16, 16); @@ -559,10 +565,10 @@ void tst_WaylandClient::hiddenPopupParent() popup.setFlag(Qt::Popup, true); toplevel.hide(); - QCOMPOSITOR_TRY_VERIFY(!wlSurface(0)); + QCOMPOSITOR_TRY_VERIFY(!surface()); popup.show(); - QCOMPOSITOR_TRY_VERIFY(wlSurface(0)); + QCOMPOSITOR_TRY_VERIFY(surface()); } #if QT_CONFIG(opengl) @@ -573,9 +579,10 @@ void tst_WaylandClient::glWindow() QScopedPointer testWindow(new TestGlWindow); testWindow->show(); Surface *s = nullptr; - QCOMPOSITOR_TRY_VERIFY(s = wlSurface(0)); - WlShellSurface *ss = s->wlShellSurface(); - ss->sendConfigure(0, 0, 0); + QCOMPOSITOR_TRY_VERIFY(s = surface()); + exec([=] { + sendShellSurfaceConfigure(s); + }); QTRY_COMPARE(testWindow->paintGLCalled, 1); @@ -590,7 +597,7 @@ void tst_WaylandClient::glWindow() //confirm we don't crash when we delete an already hidden GL window //QTBUG-65553 testWindow->setVisible(false); - QCOMPOSITOR_TRY_VERIFY(!wlSurface(0)); + QCOMPOSITOR_TRY_VERIFY(!surface()); } #endif // QT_CONFIG(opengl) @@ -601,7 +608,7 @@ void tst_WaylandClient::longWindowTitle() QString absurdlyLongTitle(10000, QLatin1Char('z')); window.setTitle(absurdlyLongTitle); window.show(); - QCOMPOSITOR_TRY_VERIFY(wlSurface(0)); + QCOMPOSITOR_TRY_VERIFY(surface()); } void tst_WaylandClient::longWindowTitleWithUtf16Characters() @@ -611,7 +618,7 @@ void tst_WaylandClient::longWindowTitleWithUtf16Characters() Q_ASSERT(absurdlyLongTitle.length() == 10000); // just making sure the test isn't broken window.setTitle(absurdlyLongTitle); window.show(); - QCOMPOSITOR_TRY_VERIFY(wlSurface(0)); + QCOMPOSITOR_TRY_VERIFY(surface()); } int main(int argc, char **argv) @@ -619,7 +626,9 @@ int main(int argc, char **argv) QTemporaryDir tmpRuntimeDir; setenv("XDG_RUNTIME_DIR", tmpRuntimeDir.path().toLocal8Bit(), 1); setenv("QT_QPA_PLATFORM", "wayland", 1); // force QGuiApplication to use wayland plugin - setenv("QT_WAYLAND_SHELL_INTEGRATION", "wl-shell", 1); + QString shell = QString::fromLocal8Bit(qgetenv("QT_WAYLAND_SHELL_INTEGRATION")); + if (shell.isEmpty()) + setenv("QT_WAYLAND_SHELL_INTEGRATION", "wl-shell", 1); tst_WaylandClient tc; QGuiApplication app(argc, argv); diff --git a/tests/auto/wayland/shared/mockcompositor.cpp b/tests/auto/wayland/shared/mockcompositor.cpp index 63134db55ea..d3742e0947b 100644 --- a/tests/auto/wayland/shared/mockcompositor.cpp +++ b/tests/auto/wayland/shared/mockcompositor.cpp @@ -79,6 +79,27 @@ DefaultCompositor::DefaultCompositor(CompositorType t) Q_ASSERT(isClean()); } +Surface *DefaultCompositor::surface(int i) +{ + Surface *result = nullptr; + switch (m_type) { + case CompositorType::Default: + result = get()->m_surfaces.value(i, nullptr); + break; + case CompositorType::Legacy: { + QList surfaces = get()->m_surfaces; + for (Surface *surface : surfaces) { + if (surface->isMapped()) { + result = surface; + break; + } + } + } + break; + } + return result; +} + uint DefaultCompositor::sendXdgShellPing() { warnIfNotLockedByThread(Q_FUNC_INFO); @@ -98,6 +119,23 @@ void DefaultCompositor::xdgPingAndWaitForPong() QTRY_COMPARE(pongSpy.first().at(0).toUInt(), serial); } +void DefaultCompositor::sendShellSurfaceConfigure(Surface *surface) +{ + switch (m_type) { + case CompositorType::Default: + break; + case CompositorType::Legacy: { + if (auto wlShellSurface = surface->wlShellSurface()) { + wlShellSurface->sendConfigure(0, 0, 0); + return; + } + break; + } + } + + qWarning() << "The mocking framework doesn't know how to send a configure event for this surface"; +} + WlShellCompositor::WlShellCompositor(CompositorType t) : DefaultCompositor(t) { diff --git a/tests/auto/wayland/shared/mockcompositor.h b/tests/auto/wayland/shared/mockcompositor.h index 7f3c0e31028..89074b3a542 100644 --- a/tests/auto/wayland/shared/mockcompositor.h +++ b/tests/auto/wayland/shared/mockcompositor.h @@ -58,7 +58,7 @@ public: explicit DefaultCompositor(CompositorType t = CompositorType::Default); // Convenience functions Output *output(int i = 0) { return getAll().value(i, nullptr); } - Surface *surface(int i = 0) { return get()->m_surfaces.value(i, nullptr); } + Surface *surface(int i = 0); Subsurface *subSurface(int i = 0) { return get()->m_subsurfaces.value(i, nullptr); } WlShellSurface *wlShellSurface(int i = 0) { return get()->m_wlShellSurfaces.value(i, nullptr); } Surface *wlSurface(int i = 0); @@ -71,8 +71,12 @@ public: Keyboard *keyboard() { auto *seat = get(); Q_ASSERT(seat); return seat->m_keyboard; } FullScreenShellV1 *fullScreenShellV1() {return get();}; IviSurface *iviSurface(int i = 0) { return get()->m_iviSurfaces.value(i, nullptr); } + uint sendXdgShellPing(); void xdgPingAndWaitForPong(); + + void sendShellSurfaceConfigure(Surface *surface); + // Things that can be changed run-time without confusing the client (i.e. don't require separate tests) struct Config { bool autoEnter = true; From dcac8ed7df11c293a558d51af54b0c3c0068fe8e Mon Sep 17 00:00:00 2001 From: Liang Qi Date: Wed, 20 Oct 2021 08:51:47 +0200 Subject: [PATCH 1001/1507] Support different text input protocols - update This amends 227ea40b804c9093e9cfdc88c6acdab730b7d878. Only update text input when needed. And try to unregister the ones which are not needed. For client side, when QT_WAYLAND_TEXT_INPUT_PROTOCOL contains multiple valid ones, the order doesn't matter now. Fixes: QTBUG-97394 Task-number: QTBUG-96414 Change-Id: Ibe174056a4d4a4f2026e488d2ea99ec875b11ccc Reviewed-by: Inho Lee --- .../platforms/wayland/qwaylanddisplay.cpp | 79 +++++++++++++++---- .../platforms/wayland/qwaylanddisplay_p.h | 2 + .../platforms/wayland/qwaylandintegration.cpp | 2 +- 3 files changed, 65 insertions(+), 18 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index c56351caab4..199f5ad3584 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -335,6 +335,7 @@ QWaylandWindowManagerIntegration *QWaylandDisplay::windowManagerIntegration() co QWaylandDisplay::QWaylandDisplay(QWaylandIntegration *waylandIntegration) : mWaylandIntegration(waylandIntegration) + , textInputProtocolChecked(true) { qRegisterMetaType("uint32_t"); @@ -440,6 +441,11 @@ void QWaylandDisplay::blockingReadEvents() void QWaylandDisplay::checkTextInputProtocol() { + if (textInputProtocolChecked) + return; + + textInputProtocolChecked = true; + if (mClientSideInputContextRequested) { qCDebug(lcQpaWayland) << "mClientSideInputContextRequested is false, no need for text input."; return; @@ -454,19 +460,29 @@ void QWaylandDisplay::checkTextInputProtocol() bool found = false; QString tiProtocols = QString::fromLocal8Bit(qgetenv("QT_WAYLAND_TEXT_INPUT_PROTOCOL")); qCDebug(lcQpaWayland) << "QT_WAYLAND_TEXT_INPUT_PROTOCOL=" << tiProtocols; + QStringList keys; if (!tiProtocols.isEmpty()) { - QStringList keys = tiProtocols.split(QLatin1Char(';')); - for (const QString &k : keys) { - int index = tips.indexOf(k); - if (index >= 0 && hasRegistryGlobal(timps[index]) && registerTextInputManager(timps, index)) - found = true; + keys = tiProtocols.split(QLatin1Char(';')); + QList::iterator it = keys.begin(); + while (it != keys.end()) { + if (!tips.contains(*it)) { + qCDebug(lcQpaWayland) << "text input: unknown protocol - " << *it; + it = keys.erase(it); + } else { + ++it; + } } } + if (keys.isEmpty()) + keys = tips; // fallback - if (!found) { - for (int i = 0; i < timps.size(); i++) { - if (hasRegistryGlobal(timps[i]) && registerTextInputManager(timps, i)) + for (int k = 0; k < tips.size(); ++k) { + if (keys.contains(tips[k])) { + if (hasRegistryGlobal(timps[k]) && registerTextInputManager(timps, k)) found = true; + } else { + if (hasRegistryGlobal(timps[k])) + unregisterTextInputManager(timps, k); } } @@ -480,21 +496,18 @@ bool QWaylandDisplay::registerTextInputManager(const QStringList &protocols, int return false; QString p = protocols.at(index); - if (index == 0) { - for (const RegistryGlobal &global : mGlobals) { - if (global.interface == p) { + for (const RegistryGlobal &global : mGlobals) { + if (global.interface == p) { + if (index == 0) { + qCDebug(lcQpaWayland) << "text input: register qt_text_input_method_manager_v1"; mTextInputMethodManager.reset(new QtWayland::qt_text_input_method_manager_v1(global.registry, global.id, 1)); for (QWaylandInputDevice *inputDevice : qAsConst(mInputDevices)) inputDevice->setTextInputMethod(new QWaylandTextInputMethod(this, mTextInputMethodManager->get_text_input_method(inputDevice->wl_seat()))); mWaylandIntegration->reconfigureInputContext(); return true; } - } - } - - if (index == 1) { - for (const RegistryGlobal &global : mGlobals) { - if (global.interface == p) { + if (index == 1) { + qCDebug(lcQpaWayland) << "text input: register zwp_text_input_manager_v2"; mTextInputManager.reset(new QtWayland::zwp_text_input_manager_v2(global.registry, global.id, 1)); for (QWaylandInputDevice *inputDevice : qAsConst(mInputDevices)) inputDevice->setTextInput(new QWaylandTextInput(this, mTextInputManager->get_text_input(inputDevice->wl_seat()))); @@ -507,6 +520,34 @@ bool QWaylandDisplay::registerTextInputManager(const QStringList &protocols, int return false; } +void QWaylandDisplay::unregisterTextInputManager(const QStringList &protocols, int index) +{ + if (protocols.size() > 2 || index < 0 || index >= 2) + return; + + QString p = protocols.at(index); + for (const RegistryGlobal &global : mGlobals) { + if (global.interface == p) { + if (index == 0) { + qCDebug(lcQpaWayland) << "text input: unregister qt_text_input_method_manager_v1"; + mTextInputMethodManager.reset(); + for (QWaylandInputDevice *inputDevice : qAsConst(mInputDevices)) + inputDevice->setTextInputMethod(nullptr); + mWaylandIntegration->reconfigureInputContext(); + return; + } + if (index == 1) { + qCDebug(lcQpaWayland) << "text input: unregister zwp_text_input_manager_v2"; + mTextInputManager.reset(); + for (QWaylandInputDevice *inputDevice : qAsConst(mInputDevices)) + inputDevice->setTextInput(nullptr); + mWaylandIntegration->reconfigureInputContext(); + return; + } + } + } +} + QWaylandScreen *QWaylandDisplay::screenForOutput(struct wl_output *output) const { for (auto screen : qAsConst(mScreens)) { @@ -562,6 +603,10 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin } else if (interface == QLatin1String(QWaylandPrimarySelectionDeviceManagerV1::interface()->name)) { mPrimarySelectionManager.reset(new QWaylandPrimarySelectionDeviceManagerV1(this, id, 1)); #endif + } else if (interface == QLatin1String(QtWayland::qt_text_input_method_manager_v1::interface()->name) && !mClientSideInputContextRequested) { + textInputProtocolChecked = false; + } else if (interface == QLatin1String(QtWayland::zwp_text_input_manager_v2::interface()->name) && !mClientSideInputContextRequested) { + textInputProtocolChecked = false; } else if (interface == QLatin1String(QWaylandHardwareIntegration::interface()->name)) { bool disableHardwareIntegration = qEnvironmentVariableIntValue("QT_WAYLAND_DISABLE_HW_INTEGRATION"); if (!disableHardwareIntegration) { diff --git a/src/plugins/platforms/wayland/qwaylanddisplay_p.h b/src/plugins/platforms/wayland/qwaylanddisplay_p.h index 6d655a66b23..2104fa9b72f 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay_p.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay_p.h @@ -225,6 +225,7 @@ private: void checkTextInputProtocol(); bool registerTextInputManager(const QStringList &protocols, int index); + void unregisterTextInputManager(const QStringList &protocols, int index); struct Listener { Listener() = default; @@ -296,6 +297,7 @@ private: static const wl_callback_listener syncCallbackListener; bool mClientSideInputContextRequested = !QPlatformInputContextFactory::requested().isNull(); + bool textInputProtocolChecked; void registry_global(uint32_t id, const QString &interface, uint32_t version) override; void registry_global_remove(uint32_t id) override; diff --git a/src/plugins/platforms/wayland/qwaylandintegration.cpp b/src/plugins/platforms/wayland/qwaylandintegration.cpp index 5b712cab970..67af87cb2f2 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandintegration.cpp @@ -497,7 +497,7 @@ void QWaylandIntegration::reconfigureInputContext() if (requested.isNull()) { if (mDisplay->textInputMethodManager() != nullptr) mInputContext.reset(new QWaylandInputMethodContext(mDisplay.data())); - else + else if (mDisplay->textInputManager() != nullptr) mInputContext.reset(new QWaylandInputContext(mDisplay.data())); } else { mInputContext.reset(QPlatformInputContextFactory::create(requested)); From eeaf852d48158351dc06f8ca52dd115ce7473979 Mon Sep 17 00:00:00 2001 From: Liang Qi Date: Thu, 28 Oct 2021 13:13:58 +0200 Subject: [PATCH 1002/1507] client: emit QInputMethod::visibleChanged() for qt_text_input_method_v1 Also emit keyboardRectangleChanged() when necessary. This amends 6578795ab5de18d1a39c3a31c619a4414eca7453 . Pick-to: 6.2 Fixes: QTBUG-96298 Done-With: Paul Olav Tvete Change-Id: I5095f9b921f85851c7525d45fe6f8fe219c963fb Reviewed-by: Inho Lee Reviewed-by: David Edmundson Reviewed-by: Qt CI Bot --- .../wayland/qwaylandinputmethodcontext.cpp | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandinputmethodcontext.cpp b/src/plugins/platforms/wayland/qwaylandinputmethodcontext.cpp index 4e81e1cd973..f8c91411587 100644 --- a/src/plugins/platforms/wayland/qwaylandinputmethodcontext.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputmethodcontext.cpp @@ -43,6 +43,7 @@ #include #include +#include QT_BEGIN_NAMESPACE @@ -64,7 +65,10 @@ QWaylandTextInputMethod::~QWaylandTextInputMethod() void QWaylandTextInputMethod::text_input_method_v1_visible_changed(int32_t visible) { - m_isVisible = visible; + if (m_isVisible != visible) { + m_isVisible = visible; + QGuiApplicationPrivate::platformIntegration()->inputContext()->emitInputPanelVisibleChanged(); + } } void QWaylandTextInputMethod::text_input_method_v1_locale_changed(const QString &localeName) @@ -79,10 +83,14 @@ void QWaylandTextInputMethod::text_input_method_v1_input_direction_changed(int32 void QWaylandTextInputMethod::text_input_method_v1_keyboard_rectangle_changed(wl_fixed_t x, wl_fixed_t y, wl_fixed_t width, wl_fixed_t height) { - m_keyboardRect = QRectF(wl_fixed_to_double(x), - wl_fixed_to_double(y), - wl_fixed_to_double(width), - wl_fixed_to_double(height)); + const QRectF keyboardRectangle(wl_fixed_to_double(x), + wl_fixed_to_double(y), + wl_fixed_to_double(width), + wl_fixed_to_double(height)); + if (m_keyboardRect != keyboardRectangle) { + m_keyboardRect = keyboardRectangle; + QGuiApplicationPrivate::platformIntegration()->inputContext()->emitKeyboardRectChanged(); + } } void QWaylandTextInputMethod::text_input_method_v1_start_input_method_event(uint32_t serial, int32_t surrounding_text_offset) From b2b710ba7a1625fd6904f6d5555adff15ccce980 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 27 Oct 2021 09:45:14 -0700 Subject: [PATCH 1003/1507] CMake: remove results for tests not tested This amends 19281f9c3ba64adf1b6ffce88bd8da3da28beb1c. Pick-to: 6.2 Change-Id: Ice04365c72984d07a64dfffd16b1f0fe50e083f1 Reviewed-by: Liang Qi --- src/plugins/platforms/wayland/configure.cmake | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/plugins/platforms/wayland/configure.cmake b/src/plugins/platforms/wayland/configure.cmake index cb3cbbda3cf..e0d0205b8a4 100644 --- a/src/plugins/platforms/wayland/configure.cmake +++ b/src/plugins/platforms/wayland/configure.cmake @@ -43,8 +43,6 @@ qt_feature("egl-extension-platform-wayland" PRIVATE ) qt_configure_add_summary_section(NAME "Qt Wayland Client Shell Integrations") qt_configure_add_summary_entry(ARGS "wayland-client-xdg-shell") -qt_configure_add_summary_entry(ARGS "wayland-client-xdg-shell-v5") -qt_configure_add_summary_entry(ARGS "wayland-client-xdg-shell-v6") qt_configure_add_summary_entry(ARGS "wayland-client-ivi-shell") qt_configure_add_summary_entry(ARGS "wayland-client-wl-shell") qt_configure_end_summary_section() # end of "Qt Wayland Client Shell Integrations" section From 0c434b353767a21aac694fea731b9d5c25da5dc1 Mon Sep 17 00:00:00 2001 From: Inho Lee Date: Tue, 15 Jun 2021 10:54:00 +0200 Subject: [PATCH 1004/1507] add abstract class QWaylandTextInputInterface in client side There are several protocols for text-input and it will be an abstract class for them. It is not related with qt_text_input_method_v1. It will help to implement zwp_text_input_* protocols. Change-Id: I2207887d84d416469217cff7d011648402a53664 Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/plugins/platforms/wayland/CMakeLists.txt | 2 + .../platforms/wayland/qwaylanddisplay.cpp | 3 +- .../wayland/qwaylandinputcontext.cpp | 358 +--------------- .../wayland/qwaylandinputcontext_p.h | 68 +-- .../platforms/wayland/qwaylandinputdevice.cpp | 8 +- .../platforms/wayland/qwaylandinputdevice_p.h | 8 +- .../wayland/qwaylandtextinputinterface.cpp | 44 ++ .../wayland/qwaylandtextinputinterface_p.h | 95 +++++ .../platforms/wayland/qwaylandtextinputv2.cpp | 403 ++++++++++++++++++ .../platforms/wayland/qwaylandtextinputv2_p.h | 146 +++++++ 10 files changed, 713 insertions(+), 422 deletions(-) create mode 100644 src/plugins/platforms/wayland/qwaylandtextinputinterface.cpp create mode 100644 src/plugins/platforms/wayland/qwaylandtextinputinterface_p.h create mode 100644 src/plugins/platforms/wayland/qwaylandtextinputv2.cpp create mode 100644 src/plugins/platforms/wayland/qwaylandtextinputv2_p.h diff --git a/src/plugins/platforms/wayland/CMakeLists.txt b/src/plugins/platforms/wayland/CMakeLists.txt index 2f13911316e..79a070332fa 100644 --- a/src/plugins/platforms/wayland/CMakeLists.txt +++ b/src/plugins/platforms/wayland/CMakeLists.txt @@ -29,6 +29,8 @@ qt_internal_add_module(WaylandClient qwaylanddisplay.cpp qwaylanddisplay_p.h qwaylandextendedsurface.cpp qwaylandextendedsurface_p.h qwaylandinputcontext.cpp qwaylandinputcontext_p.h + qwaylandtextinputv2.cpp qwaylandtextinputv2_p.h + qwaylandtextinputinterface.cpp qwaylandtextinputinterface_p.h qwaylandinputdevice.cpp qwaylandinputdevice_p.h qwaylandinputmethodcontext.cpp qwaylandinputmethodcontext_p.h qwaylandintegration.cpp qwaylandintegration_p.h diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index 199f5ad3584..8426000dc75 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -60,6 +60,7 @@ #include #endif #include "qwaylandhardwareintegration_p.h" +#include "qwaylandtextinputv2_p.h" #include "qwaylandinputcontext_p.h" #include "qwaylandinputmethodcontext_p.h" @@ -510,7 +511,7 @@ bool QWaylandDisplay::registerTextInputManager(const QStringList &protocols, int qCDebug(lcQpaWayland) << "text input: register zwp_text_input_manager_v2"; mTextInputManager.reset(new QtWayland::zwp_text_input_manager_v2(global.registry, global.id, 1)); for (QWaylandInputDevice *inputDevice : qAsConst(mInputDevices)) - inputDevice->setTextInput(new QWaylandTextInput(this, mTextInputManager->get_text_input(inputDevice->wl_seat()))); + inputDevice->setTextInput(new QWaylandTextInputv2(this, mTextInputManager->get_text_input(inputDevice->wl_seat()))); mWaylandIntegration->reconfigureInputContext(); return true; } diff --git a/src/plugins/platforms/wayland/qwaylandinputcontext.cpp b/src/plugins/platforms/wayland/qwaylandinputcontext.cpp index 645fd56a108..9ac1c3df67c 100644 --- a/src/plugins/platforms/wayland/qwaylandinputcontext.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputcontext.cpp @@ -40,15 +40,13 @@ #include "qwaylandinputcontext_p.h" +#include #include #include #include -#include -#include #include "qwaylanddisplay_p.h" #include "qwaylandinputdevice_p.h" -#include "qwaylandinputmethodeventbuilder_p.h" #include "qwaylandwindow_p.h" #if QT_CONFIG(xkbcommon) @@ -61,342 +59,6 @@ Q_LOGGING_CATEGORY(qLcQpaInputMethods, "qt.qpa.input.methods") namespace QtWaylandClient { -namespace { -const Qt::InputMethodQueries supportedQueries = Qt::ImEnabled | - Qt::ImSurroundingText | - Qt::ImCursorPosition | - Qt::ImAnchorPosition | - Qt::ImHints | - Qt::ImCursorRectangle | - Qt::ImPreferredLanguage; -} - -QWaylandTextInput::QWaylandTextInput(QWaylandDisplay *display, struct ::zwp_text_input_v2 *text_input) - : QtWayland::zwp_text_input_v2(text_input) - , m_display(display) -{ -} - -QWaylandTextInput::~QWaylandTextInput() -{ - if (m_resetCallback) - wl_callback_destroy(m_resetCallback); -} - -void QWaylandTextInput::reset() -{ - m_builder.reset(); - m_preeditCommit = QString(); - updateState(Qt::ImQueryAll, update_state_reset); -} - -void QWaylandTextInput::commit() -{ - if (QObject *o = QGuiApplication::focusObject()) { - QInputMethodEvent event; - event.setCommitString(m_preeditCommit); - QCoreApplication::sendEvent(o, &event); - } - - reset(); -} - -const wl_callback_listener QWaylandTextInput::callbackListener = { - QWaylandTextInput::resetCallback -}; - -void QWaylandTextInput::resetCallback(void *data, wl_callback *, uint32_t) -{ - QWaylandTextInput *self = static_cast(data); - - if (self->m_resetCallback) { - wl_callback_destroy(self->m_resetCallback); - self->m_resetCallback = nullptr; - } -} - -void QWaylandTextInput::updateState(Qt::InputMethodQueries queries, uint32_t flags) -{ - if (!QGuiApplication::focusObject()) - return; - - if (!QGuiApplication::focusWindow() || !QGuiApplication::focusWindow()->handle()) - return; - - auto *window = static_cast(QGuiApplication::focusWindow()->handle()); - auto *surface = window->wlSurface(); - if (!surface || (surface != m_surface)) - return; - - queries &= supportedQueries; - - // Surrounding text, cursor and anchor positions are transferred together - if ((queries & Qt::ImSurroundingText) || (queries & Qt::ImCursorPosition) || (queries & Qt::ImAnchorPosition)) - queries |= Qt::ImSurroundingText | Qt::ImCursorPosition | Qt::ImAnchorPosition; - - QInputMethodQueryEvent event(queries); - QCoreApplication::sendEvent(QGuiApplication::focusObject(), &event); - - if ((queries & Qt::ImSurroundingText) || (queries & Qt::ImCursorPosition) || (queries & Qt::ImAnchorPosition)) { - QString text = event.value(Qt::ImSurroundingText).toString(); - int cursor = event.value(Qt::ImCursorPosition).toInt(); - int anchor = event.value(Qt::ImAnchorPosition).toInt(); - - // Make sure text is not too big - if (text.toUtf8().size() > 2048) { - int c = qAbs(cursor - anchor) <= 512 ? qMin(cursor, anchor) + qAbs(cursor - anchor) / 2: cursor; - - const int offset = c - qBound(0, c, 512 - qMin(text.size() - c, 256)); - text = text.mid(offset + c - 256, 512); - cursor -= offset; - anchor -= offset; - } - - set_surrounding_text(text, QWaylandInputMethodEventBuilder::indexToWayland(text, cursor), QWaylandInputMethodEventBuilder::indexToWayland(text, anchor)); - } - - if (queries & Qt::ImHints) { - QWaylandInputMethodContentType contentType = QWaylandInputMethodContentType::convert(static_cast(event.value(Qt::ImHints).toInt())); - set_content_type(contentType.hint, contentType.purpose); - } - - if (queries & Qt::ImCursorRectangle) { - const QRect &cRect = event.value(Qt::ImCursorRectangle).toRect(); - const QRect &windowRect = QGuiApplication::inputMethod()->inputItemTransform().mapRect(cRect); - const QMargins margins = window->frameMargins(); - const QRect &surfaceRect = windowRect.translated(margins.left(), margins.top()); - set_cursor_rectangle(surfaceRect.x(), surfaceRect.y(), surfaceRect.width(), surfaceRect.height()); - } - - if (queries & Qt::ImPreferredLanguage) { - const QString &language = event.value(Qt::ImPreferredLanguage).toString(); - set_preferred_language(language); - } - - update_state(m_serial, flags); - if (flags != update_state_change) { - if (m_resetCallback) - wl_callback_destroy(m_resetCallback); - m_resetCallback = wl_display_sync(m_display->wl_display()); - wl_callback_add_listener(m_resetCallback, &QWaylandTextInput::callbackListener, this); - } -} - -void QWaylandTextInput::setCursorInsidePreedit(int) -{ - // Not supported yet -} - -bool QWaylandTextInput::isInputPanelVisible() const -{ - return m_inputPanelVisible; -} - -QRectF QWaylandTextInput::keyboardRect() const -{ - return m_keyboardRectangle; -} - -QLocale QWaylandTextInput::locale() const -{ - return m_locale; -} - -Qt::LayoutDirection QWaylandTextInput::inputDirection() const -{ - return m_inputDirection; -} - -void QWaylandTextInput::zwp_text_input_v2_enter(uint32_t serial, ::wl_surface *surface) -{ - m_serial = serial; - m_surface = surface; - - updateState(Qt::ImQueryAll, update_state_enter); -} - -void QWaylandTextInput::zwp_text_input_v2_leave(uint32_t serial, ::wl_surface *surface) -{ - m_serial = serial; - - if (m_surface != surface) { - qCDebug(qLcQpaInputMethods()) << Q_FUNC_INFO << "Got leave event for surface" << surface << "focused surface" << m_surface; - } - - m_surface = nullptr; -} - -void QWaylandTextInput::zwp_text_input_v2_modifiers_map(wl_array *map) -{ - const QList modifiersMap = QByteArray::fromRawData(static_cast(map->data), map->size).split('\0'); - - m_modifiersMap.clear(); - - for (const QByteArray &modifier : modifiersMap) { - if (modifier == "Shift") - m_modifiersMap.append(Qt::ShiftModifier); - else if (modifier == "Control") - m_modifiersMap.append(Qt::ControlModifier); - else if (modifier == "Alt") - m_modifiersMap.append(Qt::AltModifier); - else if (modifier == "Mod1") - m_modifiersMap.append(Qt::AltModifier); - else if (modifier == "Mod4") - m_modifiersMap.append(Qt::MetaModifier); - else - m_modifiersMap.append(Qt::NoModifier); - } -} - -void QWaylandTextInput::zwp_text_input_v2_input_panel_state(uint32_t visible, int32_t x, int32_t y, int32_t width, int32_t height) -{ - const bool inputPanelVisible = (visible == input_panel_visibility_visible); - if (m_inputPanelVisible != inputPanelVisible) { - m_inputPanelVisible = inputPanelVisible; - QGuiApplicationPrivate::platformIntegration()->inputContext()->emitInputPanelVisibleChanged(); - } - const QRectF keyboardRectangle(x, y, width, height); - if (m_keyboardRectangle != keyboardRectangle) { - m_keyboardRectangle = keyboardRectangle; - QGuiApplicationPrivate::platformIntegration()->inputContext()->emitKeyboardRectChanged(); - } -} - -void QWaylandTextInput::zwp_text_input_v2_preedit_string(const QString &text, const QString &commit) -{ - if (m_resetCallback) { - qCDebug(qLcQpaInputMethods()) << "discard preedit_string: reset not confirmed"; - m_builder.reset(); - return; - } - - if (!QGuiApplication::focusObject()) - return; - - QInputMethodEvent *event = m_builder.buildPreedit(text); - - m_builder.reset(); - m_preeditCommit = commit; - - QCoreApplication::sendEvent(QGuiApplication::focusObject(), event); - delete event; -} - -void QWaylandTextInput::zwp_text_input_v2_preedit_styling(uint32_t index, uint32_t length, uint32_t style) -{ - m_builder.addPreeditStyling(index, length, style); -} - -void QWaylandTextInput::zwp_text_input_v2_preedit_cursor(int32_t index) -{ - m_builder.setPreeditCursor(index); -} - -void QWaylandTextInput::zwp_text_input_v2_commit_string(const QString &text) -{ - if (m_resetCallback) { - qCDebug(qLcQpaInputMethods()) << "discard commit_string: reset not confirmed"; - m_builder.reset(); - return; - } - - if (!QGuiApplication::focusObject()) - return; - - QInputMethodEvent *event = m_builder.buildCommit(text); - - m_builder.reset(); - - QCoreApplication::sendEvent(QGuiApplication::focusObject(), event); - delete event; -} - -void QWaylandTextInput::zwp_text_input_v2_cursor_position(int32_t index, int32_t anchor) -{ - m_builder.setCursorPosition(index, anchor); -} - -void QWaylandTextInput::zwp_text_input_v2_delete_surrounding_text(uint32_t before_length, uint32_t after_length) -{ - m_builder.setDeleteSurroundingText(before_length, after_length); -} - -void QWaylandTextInput::zwp_text_input_v2_keysym(uint32_t time, uint32_t sym, uint32_t state, uint32_t modifiers) -{ -#if QT_CONFIG(xkbcommon) - if (m_resetCallback) { - qCDebug(qLcQpaInputMethods()) << "discard keysym: reset not confirmed"; - return; - } - - if (!QGuiApplication::focusWindow()) - return; - - Qt::KeyboardModifiers qtModifiers = modifiersToQtModifiers(modifiers); - - QEvent::Type type = state == WL_KEYBOARD_KEY_STATE_PRESSED ? QEvent::KeyPress : QEvent::KeyRelease; - QString text = QXkbCommon::lookupStringNoKeysymTransformations(sym); - int qtkey = QXkbCommon::keysymToQtKey(sym, qtModifiers); - - QWindowSystemInterface::handleKeyEvent(QGuiApplication::focusWindow(), - time, type, qtkey, qtModifiers, text); -#else - Q_UNUSED(time); - Q_UNUSED(sym); - Q_UNUSED(state); - Q_UNUSED(modifiers); -#endif -} - -void QWaylandTextInput::zwp_text_input_v2_language(const QString &language) -{ - if (m_resetCallback) { - qCDebug(qLcQpaInputMethods()) << "discard language: reset not confirmed"; - return; - } - - const QLocale locale(language); - if (m_locale != locale) { - m_locale = locale; - QGuiApplicationPrivate::platformIntegration()->inputContext()->emitLocaleChanged(); - } -} - -void QWaylandTextInput::zwp_text_input_v2_text_direction(uint32_t direction) -{ - if (m_resetCallback) { - qCDebug(qLcQpaInputMethods()) << "discard text_direction: reset not confirmed"; - return; - } - - const Qt::LayoutDirection inputDirection = (direction == text_direction_auto) ? Qt::LayoutDirectionAuto : - (direction == text_direction_ltr) ? Qt::LeftToRight : - (direction == text_direction_rtl) ? Qt::RightToLeft : Qt::LayoutDirectionAuto; - if (m_inputDirection != inputDirection) { - m_inputDirection = inputDirection; - QGuiApplicationPrivate::platformIntegration()->inputContext()->emitInputDirectionChanged(m_inputDirection); - } -} - -void QWaylandTextInput::zwp_text_input_v2_input_method_changed(uint32_t serial, uint32_t flags) -{ - Q_UNUSED(flags); - - m_serial = serial; - updateState(Qt::ImQueryAll, update_state_full); -} - -Qt::KeyboardModifiers QWaylandTextInput::modifiersToQtModifiers(uint32_t modifiers) -{ - Qt::KeyboardModifiers ret = Qt::NoModifier; - for (int i = 0; i < m_modifiersMap.size(); ++i) { - if (modifiers & (1 << i)) { - ret |= m_modifiersMap[i]; - } - } - return ret; -} - QWaylandInputContext::QWaylandInputContext(QWaylandDisplay *display) : mDisplay(display) { @@ -456,17 +118,17 @@ void QWaylandInputContext::update(Qt::InputMethodQueries queries) auto *currentSurface = surfaceForWindow(mCurrentWindow); if (currentSurface && !inputMethodAccepted()) { - textInput()->disable(currentSurface); + textInput()->disableSurface(currentSurface); mCurrentWindow.clear(); } else if (!currentSurface && inputMethodAccepted()) { QWindow *window = QGuiApplication::focusWindow(); if (auto *focusSurface = surfaceForWindow(window)) { - textInput()->enable(focusSurface); + textInput()->enableSurface(focusSurface); mCurrentWindow = window; } } - textInput()->updateState(queries, QtWayland::zwp_text_input_v2::update_state_change); + textInput()->updateState(queries, QWaylandTextInputInterface::update_state_change); } void QWaylandInputContext::invokeAction(QInputMethod::Action action, int cursorPostion) @@ -485,7 +147,7 @@ void QWaylandInputContext::showInputPanel() if (!textInput()) return; - textInput()->show_input_panel(); + textInput()->showInputPanel(); } void QWaylandInputContext::hideInputPanel() @@ -495,7 +157,7 @@ void QWaylandInputContext::hideInputPanel() if (!textInput()) return; - textInput()->hide_input_panel(); + textInput()->hideInputPanel(); } bool QWaylandInputContext::isInputPanelVisible() const @@ -556,7 +218,7 @@ void QWaylandInputContext::setFocusObject(QObject *object) if (mCurrentWindow.data() != window || !inputMethodAccepted()) { auto *surface = static_cast(mCurrentWindow->handle())->wlSurface(); if (surface) - textInput()->disable(surface); + textInput()->disableSurface(surface); mCurrentWindow.clear(); } } @@ -565,15 +227,15 @@ void QWaylandInputContext::setFocusObject(QObject *object) if (mCurrentWindow.data() != window) { auto *surface = static_cast(window->handle())->wlSurface(); if (surface) { - textInput()->enable(surface); + textInput()->enableSurface(surface); mCurrentWindow = window; } } - textInput()->updateState(Qt::ImQueryAll, QtWayland::zwp_text_input_v2::update_state_enter); + textInput()->updateState(Qt::ImQueryAll, QWaylandTextInputInterface::update_state_enter); } } -QWaylandTextInput *QWaylandInputContext::textInput() const +QWaylandTextInputInterface *QWaylandInputContext::textInput() const { return mDisplay->defaultInputDevice()->textInput(); } diff --git a/src/plugins/platforms/wayland/qwaylandinputcontext_p.h b/src/plugins/platforms/wayland/qwaylandinputcontext_p.h index 912c68ad400..f63bde20f8f 100644 --- a/src/plugins/platforms/wayland/qwaylandinputcontext_p.h +++ b/src/plugins/platforms/wayland/qwaylandinputcontext_p.h @@ -54,14 +54,9 @@ #include -#include -#include #include -#include -#include -#include -#include +#include "qwaylandtextinputinterface_p.h" #include #if QT_CONFIG(xkbcommon) #include @@ -72,69 +67,10 @@ struct wl_callback_listener; QT_BEGIN_NAMESPACE -Q_DECLARE_LOGGING_CATEGORY(qLcQpaInputMethods) - namespace QtWaylandClient { class QWaylandDisplay; -class QWaylandTextInput : public QtWayland::zwp_text_input_v2 -{ -public: - QWaylandTextInput(QWaylandDisplay *display, struct ::zwp_text_input_v2 *text_input); - ~QWaylandTextInput() override; - - void reset(); - void commit(); - void updateState(Qt::InputMethodQueries queries, uint32_t flags); - - void setCursorInsidePreedit(int cursor); - - bool isInputPanelVisible() const; - QRectF keyboardRect() const; - - QLocale locale() const; - Qt::LayoutDirection inputDirection() const; - -protected: - void zwp_text_input_v2_enter(uint32_t serial, struct ::wl_surface *surface) override; - void zwp_text_input_v2_leave(uint32_t serial, struct ::wl_surface *surface) override; - void zwp_text_input_v2_modifiers_map(wl_array *map) override; - void zwp_text_input_v2_input_panel_state(uint32_t state, int32_t x, int32_t y, int32_t width, int32_t height) override; - void zwp_text_input_v2_preedit_string(const QString &text, const QString &commit) override; - void zwp_text_input_v2_preedit_styling(uint32_t index, uint32_t length, uint32_t style) override; - void zwp_text_input_v2_preedit_cursor(int32_t index) override; - void zwp_text_input_v2_commit_string(const QString &text) override; - void zwp_text_input_v2_cursor_position(int32_t index, int32_t anchor) override; - void zwp_text_input_v2_delete_surrounding_text(uint32_t before_length, uint32_t after_length) override; - void zwp_text_input_v2_keysym(uint32_t time, uint32_t sym, uint32_t state, uint32_t modifiers) override; - void zwp_text_input_v2_language(const QString &language) override; - void zwp_text_input_v2_text_direction(uint32_t direction) override; - void zwp_text_input_v2_input_method_changed(uint32_t serial, uint32_t flags) override; - -private: - Qt::KeyboardModifiers modifiersToQtModifiers(uint32_t modifiers); - - QWaylandDisplay *m_display = nullptr; - QWaylandInputMethodEventBuilder m_builder; - - QList m_modifiersMap; - - uint32_t m_serial = 0; - struct ::wl_surface *m_surface = nullptr; - - QString m_preeditCommit; - - bool m_inputPanelVisible = false; - QRectF m_keyboardRectangle; - QLocale m_locale; - Qt::LayoutDirection m_inputDirection = Qt::LayoutDirectionAuto; - - struct ::wl_callback *m_resetCallback = nullptr; - static const wl_callback_listener callbackListener; - static void resetCallback(void *data, struct wl_callback *wl_callback, uint32_t time); -}; - class QWaylandInputContext : public QPlatformInputContext { Q_OBJECT @@ -168,7 +104,7 @@ public: #endif private: - QWaylandTextInput *textInput() const; + QWaylandTextInputInterface *textInput() const; QWaylandDisplay *mDisplay = nullptr; QPointer mCurrentWindow; diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index 07f37d4381c..5fbdd24188c 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -57,6 +57,8 @@ #include "qwaylandcursor_p.h" #include "qwaylanddisplay_p.h" #include "qwaylandshmbackingstore_p.h" +#include "qwaylandtextinputv2_p.h" +#include "qwaylandtextinputinterface_p.h" #include "qwaylandinputcontext_p.h" #include "qwaylandinputmethodcontext_p.h" @@ -420,7 +422,7 @@ QWaylandInputDevice::QWaylandInputDevice(QWaylandDisplay *display, int version, #endif if (mQDisplay->textInputManager()) - mTextInput.reset(new QWaylandTextInput(mQDisplay, mQDisplay->textInputManager()->get_text_input(wl_seat()))); + mTextInput.reset(new QWaylandTextInputv2(mQDisplay, mQDisplay->textInputManager()->get_text_input(wl_seat()))); if (mQDisplay->textInputMethodManager()) mTextInputMethod.reset(new QWaylandTextInputMethod(mQDisplay, mQDisplay->textInputMethodManager()->get_text_input_method(wl_seat()))); @@ -555,7 +557,7 @@ QWaylandPrimarySelectionDeviceV1 *QWaylandInputDevice::primarySelectionDevice() } #endif -void QWaylandInputDevice::setTextInput(QWaylandTextInput *textInput) +void QWaylandInputDevice::setTextInput(QWaylandTextInputInterface *textInput) { mTextInput.reset(textInput); } @@ -565,7 +567,7 @@ void QWaylandInputDevice::setTextInputMethod(QWaylandTextInputMethod *textInputM mTextInputMethod.reset(textInputMethod); } -QWaylandTextInput *QWaylandInputDevice::textInput() const +QWaylandTextInputInterface *QWaylandInputDevice::textInput() const { return mTextInput.data(); } diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h index b9d7451b529..ef9143922d7 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h +++ b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h @@ -94,7 +94,7 @@ class QWaylandTabletSeatV2; class QWaylandPointerGestures; class QWaylandPointerGestureSwipe; class QWaylandPointerGesturePinch; -class QWaylandTextInput; +class QWaylandTextInputInterface; class QWaylandTextInputMethod; #if QT_CONFIG(cursor) class QWaylandCursorTheme; @@ -138,8 +138,8 @@ public: void setTabletSeat(QWaylandTabletSeatV2 *tabletSeat); QWaylandTabletSeatV2* tabletSeat() const; - void setTextInput(QWaylandTextInput *textInput); - QWaylandTextInput *textInput() const; + void setTextInput(QWaylandTextInputInterface *textInput); + QWaylandTextInputInterface *textInput() const; void setTextInputMethod(QWaylandTextInputMethod *textInputMethod); QWaylandTextInputMethod *textInputMethod() const; @@ -199,7 +199,7 @@ protected: QScopedPointer mPointerGesturePinch; QScopedPointer mTouch; - QScopedPointer mTextInput; + QScopedPointer mTextInput; QScopedPointer mTextInputMethod; QScopedPointer mTabletSeat; diff --git a/src/plugins/platforms/wayland/qwaylandtextinputinterface.cpp b/src/plugins/platforms/wayland/qwaylandtextinputinterface.cpp new file mode 100644 index 00000000000..4334dd3e871 --- /dev/null +++ b/src/plugins/platforms/wayland/qwaylandtextinputinterface.cpp @@ -0,0 +1,44 @@ +/**************************************************************************** +** +** Copyright (C) 2021 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qwaylandtextinputinterface_p.h" + +QT_BEGIN_NAMESPACE + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandtextinputinterface_p.h b/src/plugins/platforms/wayland/qwaylandtextinputinterface_p.h new file mode 100644 index 00000000000..d918f08352e --- /dev/null +++ b/src/plugins/platforms/wayland/qwaylandtextinputinterface_p.h @@ -0,0 +1,95 @@ +/**************************************************************************** +** +** Copyright (C) 2021 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWAYLANDTEXTINPUTINTERFACE_P_H +#define QWAYLANDTEXTINPUTINTERFACE_P_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include +#include + +struct wl_surface; + +QT_BEGIN_NAMESPACE + +namespace QtWaylandClient { + +class QWaylandTextInputInterface +{ +public: + virtual ~QWaylandTextInputInterface() {} + virtual void reset() = 0; + virtual void commit() = 0; + virtual void disableSurface(::wl_surface *surface) = 0; + virtual void enableSurface(::wl_surface *surface) = 0; + virtual void updateState(Qt::InputMethodQueries queries, uint32_t flags) = 0; + virtual void showInputPanel() = 0; + virtual void hideInputPanel() = 0; + virtual bool isInputPanelVisible() const = 0; + virtual QRectF keyboardRect() const = 0; + virtual QLocale locale() const = 0; + virtual Qt::LayoutDirection inputDirection() const = 0; + virtual void setCursorInsidePreedit(int cursor) = 0; + + // This enum should be compatible with update_state of text-input-unstable-v2. + // Higher versions of text-input-* protocol may not use it directly + // but QtWaylandClient can determine clients' states based on the values + enum TextInputState { + update_state_change = 0, // updated state because it changed + update_state_full = 1, // full state after enter or input_method_changed event + update_state_reset = 2, // full state after reset + update_state_enter = 3, // full state after switching focus to a different widget on client side + }; +}; + +} + +QT_END_NAMESPACE + +#endif // QWAYLANDTEXTINPUTINTERFACE_P_H + diff --git a/src/plugins/platforms/wayland/qwaylandtextinputv2.cpp b/src/plugins/platforms/wayland/qwaylandtextinputv2.cpp new file mode 100644 index 00000000000..547ff056da7 --- /dev/null +++ b/src/plugins/platforms/wayland/qwaylandtextinputv2.cpp @@ -0,0 +1,403 @@ +/**************************************************************************** +** +** Copyright (C) 2016 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the QtWaylandClient module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include + +#include "qwaylandtextinputv2_p.h" + +#include "qwaylandwindow_p.h" +#include "qwaylandinputmethodeventbuilder_p.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +QT_BEGIN_NAMESPACE + +Q_DECLARE_LOGGING_CATEGORY(qLcQpaInputMethods) + +namespace QtWaylandClient { + +namespace { + +const Qt::InputMethodQueries supportedQueries = Qt::ImEnabled | + Qt::ImSurroundingText | + Qt::ImCursorPosition | + Qt::ImAnchorPosition | + Qt::ImHints | + Qt::ImCursorRectangle | + Qt::ImPreferredLanguage; +} + +QWaylandTextInputv2::QWaylandTextInputv2(QWaylandDisplay *display, struct ::zwp_text_input_v2 *text_input) + : QtWayland::zwp_text_input_v2(text_input) + , m_display(display) +{ +} + +QWaylandTextInputv2::~QWaylandTextInputv2() +{ + if (m_resetCallback) + wl_callback_destroy(m_resetCallback); +} + +void QWaylandTextInputv2::reset() +{ + m_builder.reset(); + m_preeditCommit = QString(); + updateState(Qt::ImQueryAll, QtWayland::zwp_text_input_v2::update_state_reset); +} + +void QWaylandTextInputv2::commit() +{ + if (QObject *o = QGuiApplication::focusObject()) { + QInputMethodEvent event; + event.setCommitString(m_preeditCommit); + QCoreApplication::sendEvent(o, &event); + } + + reset(); +} + +const wl_callback_listener QWaylandTextInputv2::callbackListener = { + QWaylandTextInputv2::resetCallback +}; + +void QWaylandTextInputv2::resetCallback(void *data, wl_callback *, uint32_t) +{ + QWaylandTextInputv2 *self = static_cast(data); + + if (self->m_resetCallback) { + wl_callback_destroy(self->m_resetCallback); + self->m_resetCallback = nullptr; + } +} + +void QWaylandTextInputv2::updateState(Qt::InputMethodQueries queries, uint32_t flags) +{ + if (!QGuiApplication::focusObject()) + return; + + if (!QGuiApplication::focusWindow() || !QGuiApplication::focusWindow()->handle()) + return; + + auto *window = static_cast(QGuiApplication::focusWindow()->handle()); + auto *surface = window->wlSurface(); + if (!surface || (surface != m_surface)) + return; + + queries &= supportedQueries; + + // Surrounding text, cursor and anchor positions are transferred together + if ((queries & Qt::ImSurroundingText) || (queries & Qt::ImCursorPosition) || (queries & Qt::ImAnchorPosition)) + queries |= Qt::ImSurroundingText | Qt::ImCursorPosition | Qt::ImAnchorPosition; + + QInputMethodQueryEvent event(queries); + QCoreApplication::sendEvent(QGuiApplication::focusObject(), &event); + + if ((queries & Qt::ImSurroundingText) || (queries & Qt::ImCursorPosition) || (queries & Qt::ImAnchorPosition)) { + QString text = event.value(Qt::ImSurroundingText).toString(); + int cursor = event.value(Qt::ImCursorPosition).toInt(); + int anchor = event.value(Qt::ImAnchorPosition).toInt(); + + // Make sure text is not too big + if (text.toUtf8().size() > 2048) { + int c = qAbs(cursor - anchor) <= 512 ? qMin(cursor, anchor) + qAbs(cursor - anchor) / 2: cursor; + + const int offset = c - qBound(0, c, 512 - qMin(text.size() - c, 256)); + text = text.mid(offset + c - 256, 512); + cursor -= offset; + anchor -= offset; + } + + set_surrounding_text(text, QWaylandInputMethodEventBuilder::indexToWayland(text, cursor), QWaylandInputMethodEventBuilder::indexToWayland(text, anchor)); + } + + if (queries & Qt::ImHints) { + QWaylandInputMethodContentType contentType = QWaylandInputMethodContentType::convert(static_cast(event.value(Qt::ImHints).toInt())); + set_content_type(contentType.hint, contentType.purpose); + } + + if (queries & Qt::ImCursorRectangle) { + const QRect &cRect = event.value(Qt::ImCursorRectangle).toRect(); + const QRect &windowRect = QGuiApplication::inputMethod()->inputItemTransform().mapRect(cRect); + const QMargins margins = window->frameMargins(); + const QRect &surfaceRect = windowRect.translated(margins.left(), margins.top()); + set_cursor_rectangle(surfaceRect.x(), surfaceRect.y(), surfaceRect.width(), surfaceRect.height()); + } + + if (queries & Qt::ImPreferredLanguage) { + const QString &language = event.value(Qt::ImPreferredLanguage).toString(); + set_preferred_language(language); + } + + update_state(m_serial, flags); + if (flags != QtWayland::zwp_text_input_v2::update_state_change) { + if (m_resetCallback) + wl_callback_destroy(m_resetCallback); + m_resetCallback = wl_display_sync(m_display->wl_display()); + wl_callback_add_listener(m_resetCallback, &QWaylandTextInputv2::callbackListener, this); + } +} + +void QWaylandTextInputv2::setCursorInsidePreedit(int) +{ + // Not supported yet +} + +bool QWaylandTextInputv2::isInputPanelVisible() const +{ + return m_inputPanelVisible; +} + +QRectF QWaylandTextInputv2::keyboardRect() const +{ + return m_keyboardRectangle; +} + +QLocale QWaylandTextInputv2::locale() const +{ + return m_locale; +} + +Qt::LayoutDirection QWaylandTextInputv2::inputDirection() const +{ + return m_inputDirection; +} + +void QWaylandTextInputv2::zwp_text_input_v2_enter(uint32_t serial, ::wl_surface *surface) +{ + m_serial = serial; + m_surface = surface; + + updateState(Qt::ImQueryAll, QtWayland::zwp_text_input_v2::update_state_enter); +} + +void QWaylandTextInputv2::zwp_text_input_v2_leave(uint32_t serial, ::wl_surface *surface) +{ + m_serial = serial; + + if (m_surface != surface) { + qCDebug(qLcQpaInputMethods()) << Q_FUNC_INFO << "Got leave event for surface" << surface << "focused surface" << m_surface; + } + + m_surface = nullptr; +} + +void QWaylandTextInputv2::zwp_text_input_v2_modifiers_map(wl_array *map) +{ + const QList modifiersMap = QByteArray::fromRawData(static_cast(map->data), map->size).split('\0'); + + m_modifiersMap.clear(); + + for (const QByteArray &modifier : modifiersMap) { + if (modifier == "Shift") + m_modifiersMap.append(Qt::ShiftModifier); + else if (modifier == "Control") + m_modifiersMap.append(Qt::ControlModifier); + else if (modifier == "Alt") + m_modifiersMap.append(Qt::AltModifier); + else if (modifier == "Mod1") + m_modifiersMap.append(Qt::AltModifier); + else if (modifier == "Mod4") + m_modifiersMap.append(Qt::MetaModifier); + else + m_modifiersMap.append(Qt::NoModifier); + } +} + +void QWaylandTextInputv2::zwp_text_input_v2_input_panel_state(uint32_t visible, int32_t x, int32_t y, int32_t width, int32_t height) +{ + const bool inputPanelVisible = (visible == input_panel_visibility_visible); + if (m_inputPanelVisible != inputPanelVisible) { + m_inputPanelVisible = inputPanelVisible; + QGuiApplicationPrivate::platformIntegration()->inputContext()->emitInputPanelVisibleChanged(); + } + const QRectF keyboardRectangle(x, y, width, height); + if (m_keyboardRectangle != keyboardRectangle) { + m_keyboardRectangle = keyboardRectangle; + QGuiApplicationPrivate::platformIntegration()->inputContext()->emitKeyboardRectChanged(); + } +} + +void QWaylandTextInputv2::zwp_text_input_v2_preedit_string(const QString &text, const QString &commit) +{ + if (m_resetCallback) { + qCDebug(qLcQpaInputMethods()) << "discard preedit_string: reset not confirmed"; + m_builder.reset(); + return; + } + + if (!QGuiApplication::focusObject()) + return; + + QInputMethodEvent *event = m_builder.buildPreedit(text); + + m_builder.reset(); + m_preeditCommit = commit; + + QCoreApplication::sendEvent(QGuiApplication::focusObject(), event); + delete event; +} + +void QWaylandTextInputv2::zwp_text_input_v2_preedit_styling(uint32_t index, uint32_t length, uint32_t style) +{ + m_builder.addPreeditStyling(index, length, style); +} + +void QWaylandTextInputv2::zwp_text_input_v2_preedit_cursor(int32_t index) +{ + m_builder.setPreeditCursor(index); +} + +void QWaylandTextInputv2::zwp_text_input_v2_commit_string(const QString &text) +{ + if (m_resetCallback) { + qCDebug(qLcQpaInputMethods()) << "discard commit_string: reset not confirmed"; + m_builder.reset(); + return; + } + + if (!QGuiApplication::focusObject()) + return; + + QInputMethodEvent *event = m_builder.buildCommit(text); + + m_builder.reset(); + + QCoreApplication::sendEvent(QGuiApplication::focusObject(), event); + delete event; +} + +void QWaylandTextInputv2::zwp_text_input_v2_cursor_position(int32_t index, int32_t anchor) +{ + m_builder.setCursorPosition(index, anchor); +} + +void QWaylandTextInputv2::zwp_text_input_v2_delete_surrounding_text(uint32_t before_length, uint32_t after_length) +{ + m_builder.setDeleteSurroundingText(before_length, after_length); +} + +void QWaylandTextInputv2::zwp_text_input_v2_keysym(uint32_t time, uint32_t sym, uint32_t state, uint32_t modifiers) +{ +#if QT_CONFIG(xkbcommon) + if (m_resetCallback) { + qCDebug(qLcQpaInputMethods()) << "discard keysym: reset not confirmed"; + return; + } + + if (!QGuiApplication::focusWindow()) + return; + + Qt::KeyboardModifiers qtModifiers = modifiersToQtModifiers(modifiers); + + QEvent::Type type = state == WL_KEYBOARD_KEY_STATE_PRESSED ? QEvent::KeyPress : QEvent::KeyRelease; + QString text = QXkbCommon::lookupStringNoKeysymTransformations(sym); + int qtkey = QXkbCommon::keysymToQtKey(sym, qtModifiers); + + QWindowSystemInterface::handleKeyEvent(QGuiApplication::focusWindow(), + time, type, qtkey, qtModifiers, text); +#else + Q_UNUSED(time); + Q_UNUSED(sym); + Q_UNUSED(state); + Q_UNUSED(modifiers); +#endif +} + +void QWaylandTextInputv2::zwp_text_input_v2_language(const QString &language) +{ + if (m_resetCallback) { + qCDebug(qLcQpaInputMethods()) << "discard language: reset not confirmed"; + return; + } + + const QLocale locale(language); + if (m_locale != locale) { + m_locale = locale; + QGuiApplicationPrivate::platformIntegration()->inputContext()->emitLocaleChanged(); + } +} + +void QWaylandTextInputv2::zwp_text_input_v2_text_direction(uint32_t direction) +{ + if (m_resetCallback) { + qCDebug(qLcQpaInputMethods()) << "discard text_direction: reset not confirmed"; + return; + } + + const Qt::LayoutDirection inputDirection = (direction == text_direction_auto) ? Qt::LayoutDirectionAuto : + (direction == text_direction_ltr) ? Qt::LeftToRight : + (direction == text_direction_rtl) ? Qt::RightToLeft : Qt::LayoutDirectionAuto; + if (m_inputDirection != inputDirection) { + m_inputDirection = inputDirection; + QGuiApplicationPrivate::platformIntegration()->inputContext()->emitInputDirectionChanged(m_inputDirection); + } +} + +void QWaylandTextInputv2::zwp_text_input_v2_input_method_changed(uint32_t serial, uint32_t flags) +{ + Q_UNUSED(flags); + + m_serial = serial; + updateState(Qt::ImQueryAll, QtWayland::zwp_text_input_v2::update_state_full); +} + +Qt::KeyboardModifiers QWaylandTextInputv2::modifiersToQtModifiers(uint32_t modifiers) +{ + Qt::KeyboardModifiers ret = Qt::NoModifier; + for (int i = 0; i < m_modifiersMap.size(); ++i) { + if (modifiers & (1 << i)) { + ret |= m_modifiersMap[i]; + } + } + return ret; +} + +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandtextinputv2_p.h b/src/plugins/platforms/wayland/qwaylandtextinputv2_p.h new file mode 100644 index 00000000000..84dd3f37cb8 --- /dev/null +++ b/src/plugins/platforms/wayland/qwaylandtextinputv2_p.h @@ -0,0 +1,146 @@ +/**************************************************************************** +** +** Copyright (C) 2016 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the QtWaylandClient module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + + +#ifndef QWAYLANDINPUTV2_P_H +#define QWAYLANDINPUTV2_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include "qwaylandtextinputinterface_p.h" +#include +#include + +struct wl_callback; +struct wl_callback_listener; + +QT_BEGIN_NAMESPACE + +namespace QtWaylandClient { + +class QWaylandDisplay; + +class QWaylandTextInputv2 : public QtWayland::zwp_text_input_v2, public QWaylandTextInputInterface +{ +public: + QWaylandTextInputv2(QWaylandDisplay *display, struct ::zwp_text_input_v2 *text_input); + ~QWaylandTextInputv2() override; + + void reset() override; + void commit() override; + void updateState(Qt::InputMethodQueries queries, uint32_t flags) override; + + void setCursorInsidePreedit(int cursor) override; + + bool isInputPanelVisible() const override; + QRectF keyboardRect() const override; + + QLocale locale() const override; + Qt::LayoutDirection inputDirection() const override; + + void showInputPanel() override + { + show_input_panel(); + } + void hideInputPanel() override + { + hide_input_panel(); + } + void enableSurface(::wl_surface *surface) override + { + enable(surface); + } + void disableSurface(::wl_surface *surface) override + { + disable(surface); + } + +protected: + void zwp_text_input_v2_enter(uint32_t serial, struct ::wl_surface *surface) override; + void zwp_text_input_v2_leave(uint32_t serial, struct ::wl_surface *surface) override; + void zwp_text_input_v2_modifiers_map(wl_array *map) override; + void zwp_text_input_v2_input_panel_state(uint32_t state, int32_t x, int32_t y, int32_t width, int32_t height) override; + void zwp_text_input_v2_preedit_string(const QString &text, const QString &commit) override; + void zwp_text_input_v2_preedit_styling(uint32_t index, uint32_t length, uint32_t style) override; + void zwp_text_input_v2_preedit_cursor(int32_t index) override; + void zwp_text_input_v2_commit_string(const QString &text) override; + void zwp_text_input_v2_cursor_position(int32_t index, int32_t anchor) override; + void zwp_text_input_v2_delete_surrounding_text(uint32_t before_length, uint32_t after_length) override; + void zwp_text_input_v2_keysym(uint32_t time, uint32_t sym, uint32_t state, uint32_t modifiers) override; + void zwp_text_input_v2_language(const QString &language) override; + void zwp_text_input_v2_text_direction(uint32_t direction) override; + void zwp_text_input_v2_input_method_changed(uint32_t serial, uint32_t flags) override; + +private: + Qt::KeyboardModifiers modifiersToQtModifiers(uint32_t modifiers); + + QWaylandDisplay *m_display = nullptr; + QWaylandInputMethodEventBuilder m_builder; + + QList m_modifiersMap; + + uint32_t m_serial = 0; + struct ::wl_surface *m_surface = nullptr; + + QString m_preeditCommit; + + bool m_inputPanelVisible = false; + QRectF m_keyboardRectangle; + QLocale m_locale; + Qt::LayoutDirection m_inputDirection = Qt::LayoutDirectionAuto; + + struct ::wl_callback *m_resetCallback = nullptr; + static const wl_callback_listener callbackListener; + static void resetCallback(void *data, struct wl_callback *wl_callback, uint32_t time); +}; + +} + +QT_END_NAMESPACE + +#endif // QWAYLANDTEXTINPUTV2_P_H From 81fa930ca1bf4c756f041821b2bdd9ef692ae2dc Mon Sep 17 00:00:00 2001 From: Inho Lee Date: Thu, 21 Oct 2021 00:15:13 +0200 Subject: [PATCH 1005/1507] Refactor QT_WAYLAND_TEXT_INPUT_PROTOCOL Redundant logics are moved from registry_global. QT_WAYLAND_TEXT_INPUT_PROTOCOL works with priority. If QT_WAYLAND_TEXT_INPUT_PROTOCOL is empty or invalid, the order of priority is qt_text_input_method_v1;zwp_text_input_v2 Task-number: QTBUG-96414 Change-Id: I1601091782ee63a57cbc678604b604d0ea287ccd Reviewed-by: Liang Qi --- .../platforms/wayland/qwaylanddisplay.cpp | 134 +++++------------- .../platforms/wayland/qwaylanddisplay_p.h | 5 +- 2 files changed, 40 insertions(+), 99 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index 8426000dc75..523de1f3cf2 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -336,7 +336,6 @@ QWaylandWindowManagerIntegration *QWaylandDisplay::windowManagerIntegration() co QWaylandDisplay::QWaylandDisplay(QWaylandIntegration *waylandIntegration) : mWaylandIntegration(waylandIntegration) - , textInputProtocolChecked(true) { qRegisterMetaType("uint32_t"); @@ -356,6 +355,8 @@ QWaylandDisplay::QWaylandDisplay(QWaylandIntegration *waylandIntegration) if (!mXkbContext) qCWarning(lcQpaWayland, "failed to create xkb context"); #endif + if (!mClientSideInputContextRequested) + checkTextInputProtocol(); } QWaylandDisplay::~QWaylandDisplay(void) @@ -396,6 +397,8 @@ void QWaylandDisplay::initialize() // Give wl_output.done and zxdg_output_v1.done events a chance to arrive forceRoundTrip(); } + if (!mClientSideInputContextRequested) + mTextInputManagerIndex = INT_MAX; } void QWaylandDisplay::ensureScreen() @@ -442,23 +445,12 @@ void QWaylandDisplay::blockingReadEvents() void QWaylandDisplay::checkTextInputProtocol() { - if (textInputProtocolChecked) - return; - - textInputProtocolChecked = true; - - if (mClientSideInputContextRequested) { - qCDebug(lcQpaWayland) << "mClientSideInputContextRequested is false, no need for text input."; - return; - } - QStringList tips, timps; // for text input protocols and text input manager protocols tips << QLatin1String(QtWayland::qt_text_input_method_v1::interface()->name) << QLatin1String(QtWayland::zwp_text_input_v2::interface()->name); timps << QLatin1String(QtWayland::qt_text_input_method_manager_v1::interface()->name) << QLatin1String(QtWayland::zwp_text_input_manager_v2::interface()->name); - bool found = false; QString tiProtocols = QString::fromLocal8Bit(qgetenv("QT_WAYLAND_TEXT_INPUT_PROTOCOL")); qCDebug(lcQpaWayland) << "QT_WAYLAND_TEXT_INPUT_PROTOCOL=" << tiProtocols; QStringList keys; @@ -466,87 +458,15 @@ void QWaylandDisplay::checkTextInputProtocol() keys = tiProtocols.split(QLatin1Char(';')); QList::iterator it = keys.begin(); while (it != keys.end()) { - if (!tips.contains(*it)) { + if (tips.contains(*it)) + mTextInputManagerList.append(timps.at(tips.indexOf(*it))); + else qCDebug(lcQpaWayland) << "text input: unknown protocol - " << *it; - it = keys.erase(it); - } else { - ++it; - } - } - } - if (keys.isEmpty()) - keys = tips; // fallback - - for (int k = 0; k < tips.size(); ++k) { - if (keys.contains(tips[k])) { - if (hasRegistryGlobal(timps[k]) && registerTextInputManager(timps, k)) - found = true; - } else { - if (hasRegistryGlobal(timps[k])) - unregisterTextInputManager(timps, k); - } - } - - if (!found) - qCDebug(lcQpaWayland) << "Didn't find any supported text input protocol."; -} - -bool QWaylandDisplay::registerTextInputManager(const QStringList &protocols, int index) -{ - if (protocols.size() > 2 || index < 0 || index >= 2) - return false; - - QString p = protocols.at(index); - for (const RegistryGlobal &global : mGlobals) { - if (global.interface == p) { - if (index == 0) { - qCDebug(lcQpaWayland) << "text input: register qt_text_input_method_manager_v1"; - mTextInputMethodManager.reset(new QtWayland::qt_text_input_method_manager_v1(global.registry, global.id, 1)); - for (QWaylandInputDevice *inputDevice : qAsConst(mInputDevices)) - inputDevice->setTextInputMethod(new QWaylandTextInputMethod(this, mTextInputMethodManager->get_text_input_method(inputDevice->wl_seat()))); - mWaylandIntegration->reconfigureInputContext(); - return true; - } - if (index == 1) { - qCDebug(lcQpaWayland) << "text input: register zwp_text_input_manager_v2"; - mTextInputManager.reset(new QtWayland::zwp_text_input_manager_v2(global.registry, global.id, 1)); - for (QWaylandInputDevice *inputDevice : qAsConst(mInputDevices)) - inputDevice->setTextInput(new QWaylandTextInputv2(this, mTextInputManager->get_text_input(inputDevice->wl_seat()))); - mWaylandIntegration->reconfigureInputContext(); - return true; - } - } - } - - return false; -} - -void QWaylandDisplay::unregisterTextInputManager(const QStringList &protocols, int index) -{ - if (protocols.size() > 2 || index < 0 || index >= 2) - return; - - QString p = protocols.at(index); - for (const RegistryGlobal &global : mGlobals) { - if (global.interface == p) { - if (index == 0) { - qCDebug(lcQpaWayland) << "text input: unregister qt_text_input_method_manager_v1"; - mTextInputMethodManager.reset(); - for (QWaylandInputDevice *inputDevice : qAsConst(mInputDevices)) - inputDevice->setTextInputMethod(nullptr); - mWaylandIntegration->reconfigureInputContext(); - return; - } - if (index == 1) { - qCDebug(lcQpaWayland) << "text input: unregister zwp_text_input_manager_v2"; - mTextInputManager.reset(); - for (QWaylandInputDevice *inputDevice : qAsConst(mInputDevices)) - inputDevice->setTextInput(nullptr); - mWaylandIntegration->reconfigureInputContext(); - return; - } + ++it; } } + if (mTextInputManagerList.isEmpty()) // fallback + mTextInputManagerList = timps; } QWaylandScreen *QWaylandDisplay::screenForOutput(struct wl_output *output) const @@ -604,10 +524,34 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin } else if (interface == QLatin1String(QWaylandPrimarySelectionDeviceManagerV1::interface()->name)) { mPrimarySelectionManager.reset(new QWaylandPrimarySelectionDeviceManagerV1(this, id, 1)); #endif - } else if (interface == QLatin1String(QtWayland::qt_text_input_method_manager_v1::interface()->name) && !mClientSideInputContextRequested) { - textInputProtocolChecked = false; - } else if (interface == QLatin1String(QtWayland::zwp_text_input_manager_v2::interface()->name) && !mClientSideInputContextRequested) { - textInputProtocolChecked = false; + } else if (interface == QLatin1String(QtWayland::qt_text_input_method_manager_v1::interface()->name) + && (mTextInputManagerList.contains(interface) && mTextInputManagerList.indexOf(interface) < mTextInputManagerIndex)) { + qCDebug(lcQpaWayland) << "text input: register qt_text_input_method_manager_v1"; + if (mTextInputManagerIndex < INT_MAX) { + mTextInputManager.reset(); + for (QWaylandInputDevice *inputDevice : qAsConst(mInputDevices)) + inputDevice->setTextInput(nullptr); + } + + mTextInputMethodManager.reset(new QtWayland::qt_text_input_method_manager_v1(registry, id, 1)); + for (QWaylandInputDevice *inputDevice : qAsConst(mInputDevices)) + inputDevice->setTextInputMethod(new QWaylandTextInputMethod(this, mTextInputMethodManager->get_text_input_method(inputDevice->wl_seat()))); + mWaylandIntegration->reconfigureInputContext(); + mTextInputManagerIndex = mTextInputManagerList.indexOf(interface); + } else if (interface == QLatin1String(QtWayland::zwp_text_input_manager_v2::interface()->name) + && (mTextInputManagerList.contains(interface) && mTextInputManagerList.indexOf(interface) < mTextInputManagerIndex)) { + qCDebug(lcQpaWayland) << "text input: register zwp_text_input_v2"; + if (mTextInputManagerIndex < INT_MAX) { + mTextInputMethodManager.reset(); + for (QWaylandInputDevice *inputDevice : qAsConst(mInputDevices)) + inputDevice->setTextInputMethod(nullptr); + } + + mTextInputManager.reset(new QtWayland::zwp_text_input_manager_v2(registry, id, 1)); + for (QWaylandInputDevice *inputDevice : qAsConst(mInputDevices)) + inputDevice->setTextInput(new QWaylandTextInputv2(this, mTextInputManager->get_text_input(inputDevice->wl_seat()))); + mWaylandIntegration->reconfigureInputContext(); + mTextInputManagerIndex = mTextInputManagerList.indexOf(interface); } else if (interface == QLatin1String(QWaylandHardwareIntegration::interface()->name)) { bool disableHardwareIntegration = qEnvironmentVariableIntValue("QT_WAYLAND_DISABLE_HW_INTEGRATION"); if (!disableHardwareIntegration) { @@ -628,8 +572,6 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin const auto copy = mRegistryListeners; // be prepared for listeners unregistering on notification for (Listener l : copy) (*l.listener)(l.data, registry, id, interface, version); - - checkTextInputProtocol(); } void QWaylandDisplay::registry_global_remove(uint32_t id) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay_p.h b/src/plugins/platforms/wayland/qwaylanddisplay_p.h index 2104fa9b72f..b58099ee85a 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay_p.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay_p.h @@ -224,8 +224,6 @@ private: void requestWaylandSync(); void checkTextInputProtocol(); - bool registerTextInputManager(const QStringList &protocols, int index); - void unregisterTextInputManager(const QStringList &protocols, int index); struct Listener { Listener() = default; @@ -297,7 +295,8 @@ private: static const wl_callback_listener syncCallbackListener; bool mClientSideInputContextRequested = !QPlatformInputContextFactory::requested().isNull(); - bool textInputProtocolChecked; + QStringList mTextInputManagerList; + int mTextInputManagerIndex = INT_MAX; void registry_global(uint32_t id, const QString &interface, uint32_t version) override; void registry_global_remove(uint32_t id) override; From 636d52abb37abd400407a564ec8ab1f355cf9766 Mon Sep 17 00:00:00 2001 From: Liang Qi Date: Thu, 21 Oct 2021 14:10:33 +0200 Subject: [PATCH 1006/1507] tests: add test for multiple text input Change-Id: Ief343ebf9d0d6d00533eb3c698c416f4205bbfac Reviewed-by: Inho Lee --- .../wayland/qwaylandinputmethodcontext_p.h | 1 + .../platforms/wayland/qwaylandintegration.cpp | 9 +- .../wayland/inputcontext/tst_inputcontext.cpp | 137 +++++++++++++----- tests/auto/wayland/shared/CMakeLists.txt | 3 + tests/auto/wayland/shared/qttextinput.cpp | 45 ++++++ tests/auto/wayland/shared/qttextinput.h | 51 +++++++ 6 files changed, 211 insertions(+), 35 deletions(-) create mode 100644 tests/auto/wayland/shared/qttextinput.cpp create mode 100644 tests/auto/wayland/shared/qttextinput.h diff --git a/src/plugins/platforms/wayland/qwaylandinputmethodcontext_p.h b/src/plugins/platforms/wayland/qwaylandinputmethodcontext_p.h index 8be65f447b3..6fd0d284bc7 100644 --- a/src/plugins/platforms/wayland/qwaylandinputmethodcontext_p.h +++ b/src/plugins/platforms/wayland/qwaylandinputmethodcontext_p.h @@ -119,6 +119,7 @@ private: class QWaylandInputMethodContext : public QPlatformInputContext { + Q_OBJECT public: QWaylandInputMethodContext(QWaylandDisplay *display); ~QWaylandInputMethodContext() override; diff --git a/src/plugins/platforms/wayland/qwaylandintegration.cpp b/src/plugins/platforms/wayland/qwaylandintegration.cpp index 67af87cb2f2..dc96572c2a8 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandintegration.cpp @@ -495,12 +495,16 @@ void QWaylandIntegration::reconfigureInputContext() " use QT_IM_MODULE=qtvirtualkeyboard at compositor-side."; if (requested.isNull()) { - if (mDisplay->textInputMethodManager() != nullptr) + if (mDisplay->textInputMethodManager() != nullptr) { mInputContext.reset(new QWaylandInputMethodContext(mDisplay.data())); - else if (mDisplay->textInputManager() != nullptr) + qDebug() << "create QWaylandInputMethodContext" << inputContext(); + } else if (mDisplay->textInputManager() != nullptr) { mInputContext.reset(new QWaylandInputContext(mDisplay.data())); + qDebug() << "create QWaylandInputContext" << inputContext(); + } } else { mInputContext.reset(QPlatformInputContextFactory::create(requested)); + qDebug() << "create QPlatformInputContextFactory::create" << inputContext(); } const QString defaultInputContext(QStringLiteral("compose")); @@ -514,6 +518,7 @@ void QWaylandIntegration::reconfigureInputContext() } #endif + qDebug() << "mInputContext " << inputContext(); qCDebug(lcQpaWayland) << "using input method:" << inputContext()->metaObject()->className(); } diff --git a/tests/auto/wayland/inputcontext/tst_inputcontext.cpp b/tests/auto/wayland/inputcontext/tst_inputcontext.cpp index d421b0d2202..02beb6af5d4 100644 --- a/tests/auto/wayland/inputcontext/tst_inputcontext.cpp +++ b/tests/auto/wayland/inputcontext/tst_inputcontext.cpp @@ -28,6 +28,7 @@ #include "mockcompositor.h" #include "textinput.h" +#include "qttextinput.h" #include #include @@ -48,16 +49,41 @@ private slots: void initTestCase(); void selectingInputContext_data(); void selectingInputContext(); + void selectingTextInputProtocol_data(); + void selectingTextInputProtocol(); void inputContextReconfigurationWhenTogglingTextInputExtension(); private: QByteArray inputContextName() const; - void ensureTextInputPresentOnCompositor(); - void ensureTextInputNotPresentOnCompositor(); + + template + void ensurePresentOnCompositor() + { + exec([&] { + QList extensions = getAll(); + if (extensions.length() > 1) + QFAIL("Requested type is a singleton, hence there should not be more then one object returned"); + if (extensions.length() == 0) + add(); + }); + } + + template + void ensureNotPresentOnCompositor() + { + exec([&] { + QList extensions = getAll(); + if (extensions.length() > 1) + QFAIL("Requested type is a singleton, hence there should not be more then one object returned"); + if (extensions.length() == 1) + remove(extensions.first()); + }); + } QByteArray mComposeModule = QByteArray("QComposeInputContext"); // default input context QByteArray mIbusModule = QByteArray("QIBusPlatformInputContext"); - QByteArray mWaylandModule = QByteArray("QtWaylandClient::QWaylandInputContext"); + QByteArray mTextInputModule = QByteArray("QtWaylandClient::QWaylandInputContext"); + QByteArray mQtTextInputModule = QByteArray("QtWaylandClient::QWaylandInputMethodContext"); }; void tst_inputcontext::initTestCase() @@ -82,28 +108,6 @@ QByteArray tst_inputcontext::inputContextName() const return QByteArray(""); } -void tst_inputcontext::ensureTextInputPresentOnCompositor() -{ - exec([&] { - QList extensions = getAll(); - if (extensions.length() > 1) - QFAIL("TextInputManager is a singleton, hence there should not be more then one object returned"); - if (extensions.length() == 0) - add(); - }); -} - -void tst_inputcontext::ensureTextInputNotPresentOnCompositor() -{ - exec([&] { - QList extensions = getAll(); - if (extensions.length() > 1) - QFAIL("TextInputManager is a singleton, hence there should not be more then one object returned"); - if (extensions.length() == 1) - remove(extensions.first()); - }); -} - void tst_inputcontext::selectingInputContext_data() { QTest::addColumn("requestedModule"); @@ -120,7 +124,7 @@ void tst_inputcontext::selectingInputContext_data() QTest::newRow("ibus:text-input") << QByteArray("ibus") << mIbusModule; QTest::newRow("compose:text-input") << QByteArray("compose") << mComposeModule; QTest::newRow("empty:text-input") << QByteArray("") << mComposeModule; - QTest::newRow("null:text-input") << QByteArray() << mWaylandModule; + QTest::newRow("null:text-input") << QByteArray() << mTextInputModule; QTest::newRow("fake:text-input") << QByteArray("fake") << mComposeModule; } @@ -137,9 +141,76 @@ void tst_inputcontext::selectingInputContext() const bool withTextInputAtCompositorSide = QByteArray(QTest::currentDataTag()).endsWith(":text-input"); if (withTextInputAtCompositorSide) - ensureTextInputPresentOnCompositor(); + ensurePresentOnCompositor(); else - ensureTextInputNotPresentOnCompositor(); + ensureNotPresentOnCompositor(); + + int argc = 0; + QGuiApplication app(argc, nullptr); // loads the platform plugin + + QCOMPARE(inputContextName(), expectedModule); +} + +void tst_inputcontext::selectingTextInputProtocol_data() +{ + QTest::addColumn("requestQtTextInput"); + QTest::addColumn("requestTextInput"); + QTest::addColumn("clientProtocol"); + QTest::addColumn("expectedModule"); + + QTest::newRow("1-1") << true << true << QByteArray() << mQtTextInputModule; + QTest::newRow("1-2") << true << false << QByteArray() << mQtTextInputModule; + QTest::newRow("1-3") << false << true << QByteArray() << mTextInputModule; + QTest::newRow("1-4") << false << false << QByteArray() << mComposeModule; + + QTest::newRow("2-1") << true << true << QByteArray("zwp_text_input_v2") << mTextInputModule; + QTest::newRow("2-2") << true << false << QByteArray("zwp_text_input_v2") << mComposeModule; + QTest::newRow("2-3") << false << true << QByteArray("zwp_text_input_v2") << mTextInputModule; + QTest::newRow("2-4") << false << false << QByteArray("zwp_text_input_v2") << mComposeModule; + + QTest::newRow("3-1") << true << true << QByteArray("qt_text_input_method_v1") << mQtTextInputModule; + QTest::newRow("3-2") << true << false << QByteArray("qt_text_input_method_v1") << mQtTextInputModule; + QTest::newRow("3-3") << false << true << QByteArray("qt_text_input_method_v1") << mComposeModule; + QTest::newRow("3-4") << false << false << QByteArray("qt_text_input_method_v1") << mComposeModule; + + QTest::newRow("4-1") << true << true << QByteArray("qt_text_input_method_v1;zwp_text_input_v2") << mQtTextInputModule; + QTest::newRow("4-2") << true << false << QByteArray("qt_text_input_method_v1;zwp_text_input_v2") << mQtTextInputModule; + QTest::newRow("4-3") << false << true << QByteArray("qt_text_input_method_v1;zwp_text_input_v2") << mTextInputModule; + QTest::newRow("4-4") << false << false << QByteArray("qt_text_input_method_v1;zwp_text_input_v2") << mComposeModule; + + QTest::newRow("5-1") << true << true << QByteArray("zwp_text_input_v2;qt_text_input_method_v1") << mTextInputModule; + QTest::newRow("5-2") << true << false << QByteArray("zwp_text_input_v2;qt_text_input_method_v1") << mQtTextInputModule; + QTest::newRow("5-3") << false << true << QByteArray("zwp_text_input_v2;qt_text_input_method_v1") << mTextInputModule; + QTest::newRow("5-4") << false << false << QByteArray("zwp_text_input_v2;qt_text_input_method_v1") << mComposeModule; +} + +void tst_inputcontext::selectingTextInputProtocol() +{ + QFETCH(bool, requestQtTextInput); + QFETCH(bool, requestTextInput); + QFETCH(QByteArray, clientProtocol); + QFETCH(QByteArray, expectedModule); + + exec([this] { + qputenv("QT_IM_MODULE", "qtvirtualkeyboard"); + }); + + qunsetenv("QT_IM_MODULE"); + + if (clientProtocol.isNull()) + qunsetenv("QT_WAYLAND_TEXT_INPUT_PROTOCOL"); + else + qputenv("QT_WAYLAND_TEXT_INPUT_PROTOCOL", clientProtocol); + + if (requestTextInput) + ensurePresentOnCompositor(); + else + ensureNotPresentOnCompositor(); + + if (requestQtTextInput) + ensurePresentOnCompositor(); + else + ensureNotPresentOnCompositor(); int argc = 0; QGuiApplication app(argc, nullptr); // loads the platform plugin @@ -151,22 +222,22 @@ void tst_inputcontext::inputContextReconfigurationWhenTogglingTextInputExtension { qunsetenv("QT_IM_MODULE"); - ensureTextInputPresentOnCompositor(); + ensurePresentOnCompositor(); int argc = 0; QGuiApplication app(argc, nullptr); // loads the platform plugin - QCOMPARE(inputContextName(), mWaylandModule); + QCOMPARE(inputContextName(), mTextInputModule); // remove text input extension after the platform plugin has been loaded - ensureTextInputNotPresentOnCompositor(); + ensureNotPresentOnCompositor(); // QTRY_* because we need to spin the event loop for wayland QPA plugin // to handle registry_global_remove() QTRY_COMPARE(inputContextName(), mComposeModule); // add text input extension after the platform plugin has been loaded - ensureTextInputPresentOnCompositor(); + ensurePresentOnCompositor(); // QTRY_* because we need to spin the event loop for wayland QPA plugin // to handle registry_global() - QTRY_COMPARE(inputContextName(), mWaylandModule); + QTRY_COMPARE(inputContextName(), mTextInputModule); } int main(int argc, char *argv[]) diff --git a/tests/auto/wayland/shared/CMakeLists.txt b/tests/auto/wayland/shared/CMakeLists.txt index 2ce9c23a3b0..b028dff162c 100644 --- a/tests/auto/wayland/shared/CMakeLists.txt +++ b/tests/auto/wayland/shared/CMakeLists.txt @@ -10,6 +10,7 @@ qt_manual_moc(moc_files fullscreenshellv1.h iviapplication.h textinput.h + qttextinput.h xdgoutputv1.h xdgshell.h ) @@ -23,6 +24,7 @@ add_library(SharedClientTest iviapplication.cpp iviapplication.h mockcompositor.cpp mockcompositor.h textinput.cpp textinput.h + qttextinput.cpp qttextinput.h xdgoutputv1.cpp xdgoutputv1.h xdgshell.cpp xdgshell.h ${moc_files} @@ -35,6 +37,7 @@ qt6_generate_wayland_protocol_server_sources(SharedClientTest ${PROJECT_SOURCE_DIR}/src/3rdparty/protocol/wp-primary-selection-unstable-v1.xml ${PROJECT_SOURCE_DIR}/src/3rdparty/protocol/tablet-unstable-v2.xml ${PROJECT_SOURCE_DIR}/src/3rdparty/protocol/text-input-unstable-v2.xml + ${PROJECT_SOURCE_DIR}/src/extensions/qt-text-input-method-unstable-v1.xml ${PROJECT_SOURCE_DIR}/src/3rdparty/protocol/wayland.xml ${PROJECT_SOURCE_DIR}/src/3rdparty/protocol/xdg-decoration-unstable-v1.xml ${PROJECT_SOURCE_DIR}/src/3rdparty/protocol/xdg-output-unstable-v1.xml diff --git a/tests/auto/wayland/shared/qttextinput.cpp b/tests/auto/wayland/shared/qttextinput.cpp new file mode 100644 index 00000000000..5cd9a6b61b7 --- /dev/null +++ b/tests/auto/wayland/shared/qttextinput.cpp @@ -0,0 +1,45 @@ +/**************************************************************************** +** +** Copyright (C) 2021 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qttextinput.h" + +namespace MockCompositor { + +QtTextInputManager::QtTextInputManager(CoreCompositor *compositor) +{ + init(compositor->m_display, 1); +} + +void QtTextInputManager::text_input_method_manager_v1_get_text_input_method(Resource *resource, uint32_t id, wl_resource *seatResource) +{ + Q_UNUSED(resource); + Q_UNUSED(id); + Q_UNUSED(seatResource); +} + +} // namespace MockCompositor diff --git a/tests/auto/wayland/shared/qttextinput.h b/tests/auto/wayland/shared/qttextinput.h new file mode 100644 index 00000000000..525711cce4c --- /dev/null +++ b/tests/auto/wayland/shared/qttextinput.h @@ -0,0 +1,51 @@ +/**************************************************************************** +** +** Copyright (C) 2021 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef MOCKCOMPOSITOR_QTTEXTINPUT_H +#define MOCKCOMPOSITOR_QTTEXTINPUT_H + +#include "coreprotocol.h" +#include + +#include + +namespace MockCompositor { + +class QtTextInputManager : public Global, public QtWaylandServer::qt_text_input_method_manager_v1 +{ + Q_OBJECT +public: + QtTextInputManager(CoreCompositor *compositor); + +protected: + void text_input_method_manager_v1_get_text_input_method(Resource *resource, uint32_t id, struct ::wl_resource *seatResource) override; +}; + +} // namespace MockCompositor + +#endif // MOCKCOMPOSITOR_QTTEXTINPUT_H From bc6f4467386afd71a48d0e9273c98f2a3c06e0db Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Tue, 9 Nov 2021 13:36:30 +0100 Subject: [PATCH 1007/1507] Don't build XComposite buffer integration by default Both xcomposite-egl and xcomposite-glx have rendering issues, and they do not work with the latest Nvidia driver versions. These plugins were created to allow testing/debugging of QtWayland-based compositors on desktops that did not support Wayland natively. At this time, Wayland is much more widely supported on the desktop, and [ChangeLog][Extensions][The xcomposite-egl and xcomposite-glx shell extension protocols are no longer built by default.] Task-number: QTBUG-92074 Task-number: QTBUG-97985 Pick-to: 6.2 Change-Id: Ifded68b92e91e2d98aa44b8cfc624a4072b30451 Reviewed-by: Liang Qi Reviewed-by: Eskil Abrahamsen Blomfeldt Reviewed-by: Aleix Pol Gonzalez --- src/platformsupport/wayland/configure.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/platformsupport/wayland/configure.cmake b/src/platformsupport/wayland/configure.cmake index 6939fbe9495..aaa426e194b 100644 --- a/src/platformsupport/wayland/configure.cmake +++ b/src/platformsupport/wayland/configure.cmake @@ -223,13 +223,13 @@ qt_feature("wayland-datadevice" PRIVATE ) qt_feature("xcomposite-egl" PRIVATE LABEL "XComposite EGL" - CONDITION (QT_FEATURE_wayland_client OR QT_FEATURE_wayland_server) + CONDITION FALSE AND (QT_FEATURE_wayland_client OR QT_FEATURE_wayland_server) AND QT_FEATURE_opengl AND QT_FEATURE_egl AND QT_FEATURE_xlib AND XComposite_FOUND AND QT_FEATURE_egl_x11 ) qt_feature("xcomposite-glx" PRIVATE LABEL "XComposite GLX" - CONDITION (QT_FEATURE_wayland_client OR QT_FEATURE_wayland_server) + CONDITION FALSE AND (QT_FEATURE_wayland_client OR QT_FEATURE_wayland_server) AND QT_FEATURE_opengl AND NOT QT_FEATURE_opengles2 AND QT_FEATURE_xlib AND XComposite_FOUND ) From 80600c9f3d1b7df8ad434a6e296070d306bde00b Mon Sep 17 00:00:00 2001 From: Liang Qi Date: Thu, 11 Nov 2021 12:35:50 +0100 Subject: [PATCH 1008/1507] Clean up some qDebug() which are not intended This amends 636d52abb37abd400407a564ec8ab1f355cf9766. Change-Id: I7dbd06b75d994d4957f0fbafed2f708f900a949d Reviewed-by: David Edmundson Reviewed-by: Inho Lee Reviewed-by: Qt CI Bot --- src/plugins/platforms/wayland/qwaylandintegration.cpp | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandintegration.cpp b/src/plugins/platforms/wayland/qwaylandintegration.cpp index dc96572c2a8..67af87cb2f2 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandintegration.cpp @@ -495,16 +495,12 @@ void QWaylandIntegration::reconfigureInputContext() " use QT_IM_MODULE=qtvirtualkeyboard at compositor-side."; if (requested.isNull()) { - if (mDisplay->textInputMethodManager() != nullptr) { + if (mDisplay->textInputMethodManager() != nullptr) mInputContext.reset(new QWaylandInputMethodContext(mDisplay.data())); - qDebug() << "create QWaylandInputMethodContext" << inputContext(); - } else if (mDisplay->textInputManager() != nullptr) { + else if (mDisplay->textInputManager() != nullptr) mInputContext.reset(new QWaylandInputContext(mDisplay.data())); - qDebug() << "create QWaylandInputContext" << inputContext(); - } } else { mInputContext.reset(QPlatformInputContextFactory::create(requested)); - qDebug() << "create QPlatformInputContextFactory::create" << inputContext(); } const QString defaultInputContext(QStringLiteral("compose")); @@ -518,7 +514,6 @@ void QWaylandIntegration::reconfigureInputContext() } #endif - qDebug() << "mInputContext " << inputContext(); qCDebug(lcQpaWayland) << "using input method:" << inputContext()->metaObject()->className(); } From 0e198e55a761d1a7c3414c8eece198c11803de98 Mon Sep 17 00:00:00 2001 From: Inho Lee Date: Mon, 1 Nov 2021 14:23:58 +0100 Subject: [PATCH 1009/1507] Do not create decorations when the shellSurface is not ready A cases reported that client windows try to make decorations when their shell surfaces are null. Since the surfaces' requests for decorations should be applied, those case will be failed to create decorations. This patch was modified by Paul Tvete's advice. (paul.tvete@qt.io) Pick-to: 6.2 5.15 Task-number: QTBUG-97608 Change-Id: I2563dbd73b730f81cc411857af07da99ceb2d063 Reviewed-by: Paul Olav Tvete --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 61537c166d7..0cc185522b2 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -859,7 +859,7 @@ bool QWaylandWindow::createDecoration() decoration = false; if (mSubSurfaceWindow) decoration = false; - if (mShellSurface && !mShellSurface->wantsDecorations()) + if (!mShellSurface || !mShellSurface->wantsDecorations()) decoration = false; bool hadDecoration = mWindowDecoration; From 46e42b89b826cc9b0bbb85ed2547c4a224490444 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Tue, 16 Nov 2021 17:53:00 +0100 Subject: [PATCH 1010/1507] tst_seatv4: fix deprecated implicit capture of this by [=] Since exec() is a synchronous call, we can just take everything by reference instead. Pick-to: 6.2 5.15 Change-Id: Ic1588db69ed6bb0d8dd39ff0439ad0fc97dd957f Reviewed-by: David Edmundson --- tests/auto/wayland/seatv4/tst_seatv4.cpp | 44 ++++++++++++------------ 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/tests/auto/wayland/seatv4/tst_seatv4.cpp b/tests/auto/wayland/seatv4/tst_seatv4.cpp index b6394652baa..e23ed37d1a4 100644 --- a/tests/auto/wayland/seatv4/tst_seatv4.cpp +++ b/tests/auto/wayland/seatv4/tst_seatv4.cpp @@ -135,19 +135,19 @@ void tst_seatv4::setsCursorOnEnter() window.show(); QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial); - exec([=] { pointer()->sendEnter(xdgSurface()->m_surface, {32, 32}); }); + exec([&] { pointer()->sendEnter(xdgSurface()->m_surface, {32, 32}); }); QCOMPOSITOR_TRY_VERIFY(cursorSurface()); } void tst_seatv4::usesEnterSerial() { - QSignalSpy setCursorSpy(exec([=] { return pointer(); }), &Pointer::setCursor); + QSignalSpy setCursorSpy(exec([&] { return pointer(); }), &Pointer::setCursor); QRasterWindow window; window.resize(64, 64); window.show(); QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial); - uint enterSerial = exec([=] { + uint enterSerial = exec([&] { return pointer()->sendEnter(xdgSurface()->m_surface, {32, 32}); }); QCOMPOSITOR_TRY_VERIFY(cursorSurface()); @@ -158,7 +158,7 @@ void tst_seatv4::usesEnterSerial() void tst_seatv4::focusDestruction() { - QSignalSpy setCursorSpy(exec([=] { return pointer(); }), &Pointer::setCursor); + QSignalSpy setCursorSpy(exec([&] { return pointer(); }), &Pointer::setCursor); QRasterWindow window; window.resize(64, 64); window.show(); @@ -166,7 +166,7 @@ void tst_seatv4::focusDestruction() // Setting a cursor now is not allowed since there has been no enter event QCOMPARE(setCursorSpy.count(), 0); - uint enterSerial = exec([=] { + uint enterSerial = exec([&] { return pointer()->sendEnter(xdgSurface()->m_surface, {32, 32}); }); QCOMPOSITOR_TRY_VERIFY(cursorSurface()); @@ -298,7 +298,7 @@ void tst_seatv4::simpleAxis() WheelWindow window; QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial); - exec([=] { + exec([&] { Surface *surface = xdgSurface()->m_surface; pointer()->sendEnter(surface, {32, 32}); wl_client *client = surface->resource()->client(); @@ -322,7 +322,7 @@ void tst_seatv4::invalidPointerEvents() window.show(); QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial); - exec([=] { + exec([&] { auto *p = pointer(); auto *c = client(); // Purposefully send events without a wl_pointer.enter @@ -355,7 +355,7 @@ static bool supportsCursorSizes(const QList &sizes) { auto *waylandIntegration = static_cast(QGuiApplicationPrivate::platformIntegration()); wl_shm *shm = waylandIntegration->display()->shm()->object(); - return std::all_of(sizes.begin(), sizes.end(), [=](uint size) { + return std::all_of(sizes.begin(), sizes.end(), [&](uint size) { return supportsCursorSize(size, shm); }); } @@ -384,15 +384,15 @@ void tst_seatv4::scaledCursor() window.show(); QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial); - exec([=] { pointer()->sendEnter(xdgSurface()->m_surface, {32, 32}); }); + exec([&] { pointer()->sendEnter(xdgSurface()->m_surface, {32, 32}); }); QCOMPOSITOR_TRY_VERIFY(cursorSurface()); QCOMPOSITOR_TRY_VERIFY(cursorSurface()->m_committed.buffer); QCOMPOSITOR_TRY_COMPARE(cursorSurface()->m_committed.bufferScale, 1); - QSize unscaledPixelSize = exec([=] { + QSize unscaledPixelSize = exec([&] { return cursorSurface()->m_committed.buffer->size(); }); - exec([=] { + exec([&] { auto *surface = cursorSurface(); surface->sendEnter(getAll()[1]); surface->sendLeave(getAll()[0]); @@ -412,7 +412,7 @@ void tst_seatv4::unscaledFallbackCursor() const int screens = 4; // with scales 1, 2, 4, 8 - exec([=] { + exec([&] { for (int i = 1; i < screens; ++i) { OutputData d; d.scale = int(qPow(2, i)); @@ -425,11 +425,11 @@ void tst_seatv4::unscaledFallbackCursor() window.resize(64, 64); window.show(); QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial); - exec([=] { pointer()->sendEnter(xdgSurface()->m_surface, {32, 32}); }); + exec([&] { pointer()->sendEnter(xdgSurface()->m_surface, {32, 32}); }); QCOMPOSITOR_TRY_VERIFY(cursorSurface()); QCOMPOSITOR_TRY_VERIFY(cursorSurface()->m_committed.buffer); QCOMPOSITOR_TRY_COMPARE(cursorSurface()->m_committed.bufferScale, 1); - QSize unscaledPixelSize = exec([=] { + QSize unscaledPixelSize = exec([&] { return cursorSurface()->m_committed.buffer->size(); }); @@ -437,7 +437,7 @@ void tst_seatv4::unscaledFallbackCursor() QCOMPARE(unscaledPixelSize.height(), int(defaultSize)); for (int i = 1; i < screens; ++i) { - exec([=] { + exec([&] { auto *surface = cursorSurface(); surface->sendEnter(getAll()[i]); surface->sendLeave(getAll()[i-1]); @@ -475,14 +475,14 @@ void tst_seatv4::bitmapCursor() window.show(); QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial); - exec([=] { pointer()->sendEnter(xdgSurface()->m_surface, {32, 32}); }); + exec([&] { pointer()->sendEnter(xdgSurface()->m_surface, {32, 32}); }); QCOMPOSITOR_TRY_VERIFY(cursorSurface()); QCOMPOSITOR_TRY_VERIFY(cursorSurface()->m_committed.buffer); QCOMPOSITOR_COMPARE(cursorSurface()->m_committed.buffer->size(), QSize(24, 24)); QCOMPOSITOR_COMPARE(cursorSurface()->m_committed.bufferScale, 1); QCOMPOSITOR_COMPARE(pointer()->m_hotspot, QPoint(12, 12)); - exec([=] { + exec([&] { auto *surface = cursorSurface(); surface->sendEnter(getAll()[1]); surface->sendLeave(getAll()[0]); @@ -521,14 +521,14 @@ void tst_seatv4::hidpiBitmapCursor() window.show(); QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial); - exec([=] { pointer()->sendEnter(xdgSurface()->m_surface, {32, 32}); }); + exec([&] { pointer()->sendEnter(xdgSurface()->m_surface, {32, 32}); }); QCOMPOSITOR_TRY_VERIFY(cursorSurface()); QCOMPOSITOR_TRY_VERIFY(cursorSurface()->m_committed.buffer); QCOMPOSITOR_COMPARE(cursorSurface()->m_committed.buffer->size(), QSize(48, 48)); QCOMPOSITOR_COMPARE(cursorSurface()->m_committed.bufferScale, 2); QCOMPOSITOR_COMPARE(pointer()->m_hotspot, QPoint(12, 12)); - exec([=] { + exec([&] { auto *surface = cursorSurface(); surface->sendEnter(getAll()[1]); surface->sendLeave(getAll()[0]); @@ -558,7 +558,7 @@ void tst_seatv4::hidpiBitmapCursorNonInt() window.show(); QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial); - exec([=] { pointer()->sendEnter(xdgSurface()->m_surface, {32, 32}); }); + exec([&] { pointer()->sendEnter(xdgSurface()->m_surface, {32, 32}); }); QCOMPOSITOR_TRY_VERIFY(cursorSurface()); QCOMPOSITOR_TRY_VERIFY(cursorSurface()->m_committed.buffer); QCOMPOSITOR_COMPARE(cursorSurface()->m_committed.buffer->size(), QSize(100, 100)); @@ -576,12 +576,12 @@ void tst_seatv4::animatedCursor() window.show(); QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial); - exec([=] { pointer()->sendEnter(xdgSurface()->m_surface, {32, 32}); }); + exec([&] { pointer()->sendEnter(xdgSurface()->m_surface, {32, 32}); }); QCOMPOSITOR_TRY_VERIFY(cursorSurface()); // We should get the first buffer without waiting for a frame callback QCOMPOSITOR_TRY_VERIFY(cursorSurface()->m_committed.buffer); - QSignalSpy bufferSpy(exec([=] { return cursorSurface(); }), &Surface::bufferCommitted); + QSignalSpy bufferSpy(exec([&] { return cursorSurface(); }), &Surface::bufferCommitted); exec([&] { // Make sure no extra buffers have arrived From a420bc6a63ee5e61494b0a5ac1ffb73bb8a2c7d9 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Tue, 16 Nov 2021 18:01:41 +0100 Subject: [PATCH 1011/1507] tst_seatv4: fix compilation with GCC/C++20 Explicitly defaulting the default ctor suppresses aggregate initialization. It's also a pointless thing to do, so don't do it. Pick-to: 6.2 5.15 Change-Id: I8ec14f22ae1ead2dd6db643a6462f719fda344b8 Reviewed-by: David Edmundson --- tests/auto/wayland/seatv4/tst_seatv4.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/auto/wayland/seatv4/tst_seatv4.cpp b/tests/auto/wayland/seatv4/tst_seatv4.cpp index e23ed37d1a4..2f5d8f718f4 100644 --- a/tests/auto/wayland/seatv4/tst_seatv4.cpp +++ b/tests/auto/wayland/seatv4/tst_seatv4.cpp @@ -287,8 +287,6 @@ void tst_seatv4::simpleAxis() } struct Event // Because I didn't find a convenient way to copy it entirely { - Event() = default; - QPoint pixelDelta; QPoint angleDelta; // eights of a degree, positive is upwards, left }; From ef140369baafabf378e41587b2270713c0a99017 Mon Sep 17 00:00:00 2001 From: Inho Lee Date: Sat, 19 Jun 2021 06:27:22 +0200 Subject: [PATCH 1012/1507] Support text-input-unstable-v4-wip This feature can be enabled by -feature-wayland-text-input-v4-wip. It is disabled by default. TextInputManagerV4 is available in a compositor. zwp_text_input_v4 is available for QT_WAYLAND_TEXT_INPUT_PROTOCOL in a client It supports Hangul(Korean) with a qtvirtualkeyboard patchset (refs/changes/02/357902/3) It includes some workarounds for ibus because each ibus module has its own policy for focus-in/focus-out. enter/leave will synchronize with enable/disable and they will happen whenever focus-in/focus-out happen. Cursor/anchor positions are byte offsets. Surrounding text will be trimmed when it is over 4000 byte. For debugging, uses "qt.waylandcompositor.textinput" in a compositor side uses "qt.qpa.wayland.textinput" in a client side Tested on qtvirtualkeyboard and ibus TODO : * QTBUG-97248 - event:preedit_commit_mode is not implemented yet. Current preedit_commit_mode is 'commit'. * request:set_text_change_cause is not implemented. Task-number: QTBUG-94327 Change-Id: I72644893f40f30c4b03cd6a7d05483d12bde1070 Reviewed-by: Eskil Abrahamsen Blomfeldt --- .../wayland/protocols/qt_attribution.json | 15 + .../protocols/text-input-unstable-v4-wip.xml | 467 ++++++++++++++++++ src/platformsupport/wayland/configure.cmake | 6 + src/plugins/platforms/wayland/CMakeLists.txt | 8 + .../platforms/wayland/qwaylanddisplay.cpp | 47 +- .../platforms/wayland/qwaylanddisplay_p.h | 7 +- .../wayland/qwaylandinputcontext.cpp | 6 +- .../platforms/wayland/qwaylandinputdevice.cpp | 12 +- .../platforms/wayland/qwaylandintegration.cpp | 6 +- .../wayland/qwaylandtextinputinterface_p.h | 5 +- .../platforms/wayland/qwaylandtextinputv4.cpp | 409 +++++++++++++++ .../platforms/wayland/qwaylandtextinputv4_p.h | 139 ++++++ .../qwaylandinputmethodeventbuilder.cpp | 163 ++++-- .../qwaylandinputmethodeventbuilder_p.h | 7 +- 14 files changed, 1240 insertions(+), 57 deletions(-) create mode 100644 src/3rdparty/wayland/protocols/text-input-unstable-v4-wip.xml create mode 100644 src/plugins/platforms/wayland/qwaylandtextinputv4.cpp create mode 100644 src/plugins/platforms/wayland/qwaylandtextinputv4_p.h diff --git a/src/3rdparty/wayland/protocols/qt_attribution.json b/src/3rdparty/wayland/protocols/qt_attribution.json index 9b565a5a7b5..745fafe5e5c 100644 --- a/src/3rdparty/wayland/protocols/qt_attribution.json +++ b/src/3rdparty/wayland/protocols/qt_attribution.json @@ -118,6 +118,21 @@ "Copyright": "Copyright 2014 © Stephen \"Lyude\" Chandler Paul\nCopyright 2015-2016 © Red Hat, Inc." }, + { + "Id": "wayland-text-input-unstable-v4-wip", + "Name": "Wayland Text Input Protocol", + "QDocModule": "qtwaylandcompositor", + "QtUsage": "Used in the Qt Wayland Compositor, and the Qt Wayland platform plugin.", + "Files": "text-input-unstable-v4-wip.xml", + "Description": "Adds support for compositors to act as input methods and send text to applications.", + "Homepage": "https://wayland.freedesktop.org", + "Version": "unstable v4, WIP", + "LicenseId": "HPND", + "License": "HPND License", + "LicenseFile": "HPND_LICENSE.txt", + "Copyright": "Copyright © 2012, 2013 Intel Corporation\nCopyright © 2015, 2016 Jan Arne Petersen\nCopyright © 2017, 2018 Red Hat, Inc.\nCopyright © 2018 Purism SPC" + }, + { "Id": "wayland-viewporter-protocol", "Name": "Wayland Viewporter Protocol", diff --git a/src/3rdparty/wayland/protocols/text-input-unstable-v4-wip.xml b/src/3rdparty/wayland/protocols/text-input-unstable-v4-wip.xml new file mode 100644 index 00000000000..1041e6f74a1 --- /dev/null +++ b/src/3rdparty/wayland/protocols/text-input-unstable-v4-wip.xml @@ -0,0 +1,467 @@ + + + + + Copyright © 2012, 2013 Intel Corporation + Copyright © 2015, 2016 Jan Arne Petersen + Copyright © 2017, 2018 Red Hat, Inc. + Copyright © 2018 Purism SPC + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that copyright notice and this permission + notice appear in supporting documentation, and that the name of + the copyright holders not be used in advertising or publicity + pertaining to distribution of the software without specific, + written prior permission. The copyright holders make no + representations about the suitability of this software for any + purpose. It is provided "as is" without express or implied + warranty. + + THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS + SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND + FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY + SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN + AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF + THIS SOFTWARE. + + + + This protocol allows compositors to act as input methods and to send text + to applications. A text input object is used to manage state of what are + typically text entry fields in the application. + + This document adheres to the RFC 2119 when using words like "must", + "should", "may", etc. + + Warning! The protocol described in this file is experimental and + backward incompatible changes may be made. Backward compatible changes + may be added together with the corresponding interface version bump. + Backward incompatible changes are done by bumping the version number in + the protocol and interface names and resetting the interface version. + Once the protocol is to be declared stable, the 'z' prefix and the + version number in the protocol and interface names are removed and the + interface version number is reset. + + + + + The zwp_text_input_v4 interface represents text input and input methods + associated with a seat. It provides enter/leave events to follow the + text input focus for a seat. + + Requests are used to enable/disable the text-input object and set + state information like surrounding and selected text or the content type. + The information about the entered text is sent to the text-input object + via the preedit_string and commit_string events. + + Text is valid UTF-8 encoded, indices and lengths are in bytes. Indices + must not point to middle bytes inside a code point: they must either + point to the first byte of a code point or to the end of the buffer. + Lengths must be measured between two valid indices. + + Focus moving throughout surfaces will result in the emission of + zwp_text_input_v4.enter and zwp_text_input_v4.leave events. The focused + surface must commit zwp_text_input_v4.enable and + zwp_text_input_v4.disable requests as the keyboard focus moves across + editable and non-editable elements of the UI. Those two requests are not + expected to be paired with each other, the compositor must be able to + handle consecutive series of the same request. + + State is sent by the state requests (set_surrounding_text, + set_content_type and set_cursor_rectangle) and a commit request. After an + enter event or disable request all state information is invalidated and + needs to be resent by the client. + + + + + Destroy the wp_text_input object. Also disables all surfaces enabled + through this wp_text_input object. + + + + + + Requests text input on the surface previously obtained from the enter + event. + + This request must be issued every time the active text input changes + to a new one, including within the current surface. Use + zwp_text_input_v4.disable when there is no longer any input focus on + the current surface. + + This request resets all state associated with previous enable, disable, + set_surrounding_text, set_text_change_cause, set_content_type, and + set_cursor_rectangle requests, as well as the state associated with + preedit_string, commit_string, and delete_surrounding_text events. + + The set_surrounding_text, set_content_type and set_cursor_rectangle + requests must follow if the text input supports the necessary + functionality. + + State set with this request is double-buffered. It will get applied on + the next zwp_text_input_v4.commit request, and stay valid until the + next committed enable or disable request. + + The changes must be applied by the compositor after issuing a + zwp_text_input_v4.commit request. + + + + + + Explicitly disable text input on the current surface (typically when + there is no focus on any text entry inside the surface). + + State set with this request is double-buffered. It will get applied on + the next zwp_text_input_v4.commit request. + + + + + + Sets the surrounding plain text around the input, excluding the preedit + text. + + The client should notify the compositor of any changes in any of the + values carried with this request, including changes caused by handling + incoming text-input events as well as changes caused by other + mechanisms like keyboard typing. + + If the client is unaware of the text around the cursor, it should not + issue this request, to signify lack of support to the compositor. + + Text is UTF-8 encoded, and should include the cursor position, the + complete selection and additional characters before and after them. + There is a maximum length of wayland messages, so text can not be + longer than 4000 bytes. + + Cursor is the byte offset of the cursor within text buffer. + + Anchor is the byte offset of the selection anchor within text buffer. + If there is no selected text, anchor is the same as cursor. + + If any preedit text is present, it is replaced with a cursor for the + purpose of this event. + + Values set with this request are double-buffered. They will get applied + on the next zwp_text_input_v4.commit request, and stay valid until the + next committed enable or disable request. + + The initial state for affected fields is empty, meaning that the text + input does not support sending surrounding text. If the empty values + get applied, subsequent attempts to change them may have no effect. + + + + + + + + + Reason for the change of surrounding text or cursor posision. + + + + + + + + Tells the compositor why the text surrounding the cursor changed. + + Whenever the client detects an external change in text, cursor, or + anchor posision, it must issue this request to the compositor. This + request is intended to give the input method a chance to update the + preedit text in an appropriate way, e.g. by removing it when the user + starts typing with a keyboard. + + cause describes the source of the change. + + The value set with this request is double-buffered. It must be applied + and reset to initial at the next zwp_text_input_v4.commit request. + + The initial value of cause is input_method. + + + + + + + Content hint is a bitmask to allow to modify the behavior of the text + input. + + + + + + + + + + + + + + + + + The content purpose allows to specify the primary purpose of a text + input. + + This allows an input method to show special purpose input panels with + extra characters or to disallow some characters. + + + + + + + + + + + + + + + + + + + + Sets the content purpose and content hint. While the purpose is the + basic purpose of an input field, the hint flags allow to modify some of + the behavior. + + Values set with this request are double-buffered. They will get applied + on the next zwp_text_input_v4.commit request. + Subsequent attempts to update them may have no effect. The values + remain valid until the next committed enable or disable request. + + The initial value for hint is none, and the initial value for purpose + is normal. + + + + + + + + Marks an area around the cursor as a x, y, width, height rectangle in + surface local coordinates. + + Allows the compositor to put a window with word suggestions near the + cursor, without obstructing the text being input. + + If the client is unaware of the position of edited text, it should not + issue this request, to signify lack of support to the compositor. + + Values set with this request are double-buffered. They will get applied + on the next zwp_text_input_v4.commit request, and stay valid until the + next committed enable or disable request. + + The initial values describing a cursor rectangle are empty. That means + the text input does not support describing the cursor area. If the + empty values get applied, subsequent attempts to change them may have + no effect. + + + + + + + + + + Atomically applies state changes recently sent to the compositor. + + The commit request establishes and updates the state of the client, and + must be issued after any changes to apply them. + + Text input state (enabled status, content purpose, content hint, + surrounding text and change cause, cursor rectangle) is conceptually + double-buffered within the context of a text input, i.e. between a + committed enable request and the following committed enable or disable + request. + + Protocol requests modify the pending state, as opposed to the current + state in use by the input method. A commit request atomically applies + all pending state, replacing the current state. After commit, the new + pending state is as documented for each related request. + + Requests are applied in the order of arrival. + + Neither current nor pending state are modified unless noted otherwise. + + The compositor must count the number of commit requests coming from + each zwp_text_input_v4 object and use the count as the serial in done + events. + + + + + + Notification that this seat's text-input focus is on a certain surface. + + When the seat has the keyboard capability the text-input focus follows + the keyboard focus. This event sets the current surface for the + text-input object. + + + + + + + Notification that this seat's text-input focus is no longer on a + certain surface. The client should reset any preedit string previously + set. + + The leave notification clears the current surface. It is sent before + the enter notification for the new focus. + + When the seat has the keyboard capability the text-input focus follows + the keyboard focus. + + + + + + + Notify when a new composing text (pre-edit) should be set at the + current cursor position. Any previously set composing text must be + removed. Any previously existing selected text must be removed. + + The argument text contains the pre-edit string buffer. + + The parameters cursor_begin and cursor_end are counted in bytes + relative to the beginning of the submitted text buffer. Cursor should + be hidden when both are equal to -1. + + They could be represented by the client as a line if both values are + the same, or as a text highlight otherwise. + + Values set with this event are double-buffered. They must be applied + and reset to initial on the next zwp_text_input_v4.done event. + + The initial value of text is an empty string, and cursor_begin, + cursor_end and cursor_hidden are all 0. + + + + + + + + + Notify when text should be inserted into the editor widget. The text to + commit could be either just a single character after a key press or the + result of some composing (pre-edit). + + Values set with this event are double-buffered. They must be applied + and reset to initial on the next zwp_text_input_v4.done event. + + The initial value of text is an empty string. + + + + + + + Notify when the text around the current cursor position should be + deleted. + + Before_length and after_length are the number of bytes before and after + the current cursor index (excluding the selection) to delete. + + If a preedit text is present, in effect before_length is counted from + the beginning of it, and after_length from its end (see done event + sequence). + + Values set with this event are double-buffered. They must be applied + and reset to initial on the next zwp_text_input_v4.done event. + + The initial values of both before_length and after_length are 0. + + + + + + + + Instruct the application to apply changes to state requested by the + preedit_string, commit_string and delete_surrounding_text events. The + state relating to these events is double-buffered, and each one + modifies the pending state. This event replaces the current state with + the pending state. + + The application must proceed by evaluating the changes in the following + order: + + 1. Replace existing preedit string with the cursor. + 2. Delete requested surrounding text. + 3. Insert commit string with the cursor at its end. + 4. Calculate surrounding text to send. + 5. Insert new preedit text in cursor position. + 6. Place cursor inside preedit text. + + The serial number reflects the last state of the zwp_text_input_v4 + object known to the compositor. The value of the serial argument must + be equal to the number of commit requests already issued on that object. + When the client receives a done event with a serial different than the + number of past commit requests, it must proceed as normal, except it + should not change the current state of the zwp_text_input_v4 object. + + + + + + + Pre-edit commit mode when the focus widget or the cursor position + is changed. + + + + + + + + Specify how the visible preedit should be handled + when switching the focus widget or changing the cursor position, + whether to commit the preedit text or clear the preedit text. + + This is usually used together with the preedit_string event. + + The commit behavior is the same for focus switch and + cursor position change. + + The parameter mode selects the desired behavior and + its value is one from the commit mode enum. + + + + + + + + A factory for text-input objects. This object is a global singleton. + + + + + Destroy the wp_text_input_manager object. + + + + + + Creates a new text-input object for a given seat. + + + + + + diff --git a/src/platformsupport/wayland/configure.cmake b/src/platformsupport/wayland/configure.cmake index aaa426e194b..ce7fcf59187 100644 --- a/src/platformsupport/wayland/configure.cmake +++ b/src/platformsupport/wayland/configure.cmake @@ -1,6 +1,7 @@ # configure.cmake for the QtWaylandGlobalPrivate module #### Inputs +set(INPUT_wayland_text_input_v4_wip OFF CACHE BOOL "") @@ -233,7 +234,12 @@ qt_feature("xcomposite-glx" PRIVATE AND QT_FEATURE_opengl AND NOT QT_FEATURE_opengles2 AND QT_FEATURE_xlib AND XComposite_FOUND ) +qt_feature("wayland-text-input-v4-wip" PRIVATE + LABEL "Qt Wayland TextInput Protocol V4(WIP)" + PURPOSE "Enables wayland_text_input_unstable_v4(wip)" +) +qt_configure_add_summary_entry(ARGS "wayland-text-input-v4-wip") qt_configure_add_summary_entry(ARGS "wayland-client") qt_configure_add_summary_entry(ARGS "wayland-server") qt_configure_add_summary_section(NAME "Qt Wayland Drivers") diff --git a/src/plugins/platforms/wayland/CMakeLists.txt b/src/plugins/platforms/wayland/CMakeLists.txt index 79a070332fa..c7264d6774f 100644 --- a/src/plugins/platforms/wayland/CMakeLists.txt +++ b/src/plugins/platforms/wayland/CMakeLists.txt @@ -76,6 +76,7 @@ qt6_generate_wayland_protocol_client_sources(WaylandClient ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/pointer-gestures-unstable-v1.xml ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/tablet-unstable-v2.xml ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/text-input-unstable-v2.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/text-input-unstable-v4-wip.xml ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/wayland.xml ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/wp-primary-selection-unstable-v1.xml ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/xdg-output-unstable-v1.xml @@ -105,6 +106,13 @@ qt6_generate_wayland_protocol_client_sources(WaylandClient # ) # special case end +qt_internal_extend_target(WaylandClient CONDITION QT_FEATURE_wayland_text_input_v4_wip + SOURCES + qwaylandtextinputv4.cpp qwaylandtextinputv4_p.h + DEFINES + QT_WAYLAND_TEXT_INPUT_V4_WIP=1 +) + qt_internal_extend_target(WaylandClient CONDITION QT_FEATURE_clipboard SOURCES qwaylandclipboard.cpp qwaylandclipboard_p.h diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index 523de1f3cf2..8043115af59 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -61,6 +61,9 @@ #endif #include "qwaylandhardwareintegration_p.h" #include "qwaylandtextinputv2_p.h" +#if QT_WAYLAND_TEXT_INPUT_V4_WIP +#include "qwaylandtextinputv4_p.h" +#endif // QT_WAYLAND_TEXT_INPUT_V4_WIP #include "qwaylandinputcontext_p.h" #include "qwaylandinputmethodcontext_p.h" @@ -76,6 +79,7 @@ #include "qwaylandqtkey_p.h" #include +#include #include #include @@ -450,6 +454,10 @@ void QWaylandDisplay::checkTextInputProtocol() << QLatin1String(QtWayland::zwp_text_input_v2::interface()->name); timps << QLatin1String(QtWayland::qt_text_input_method_manager_v1::interface()->name) << QLatin1String(QtWayland::zwp_text_input_manager_v2::interface()->name); +#if QT_WAYLAND_TEXT_INPUT_V4_WIP + tips << QLatin1String(QtWayland::zwp_text_input_v4::interface()->name); + timps << QLatin1String(QtWayland::zwp_text_input_manager_v4::interface()->name); +#endif // QT_WAYLAND_TEXT_INPUT_V4_WIP QString tiProtocols = QString::fromLocal8Bit(qgetenv("QT_WAYLAND_TEXT_INPUT_PROTOCOL")); qCDebug(lcQpaWayland) << "QT_WAYLAND_TEXT_INPUT_PROTOCOL=" << tiProtocols; @@ -528,7 +536,10 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin && (mTextInputManagerList.contains(interface) && mTextInputManagerList.indexOf(interface) < mTextInputManagerIndex)) { qCDebug(lcQpaWayland) << "text input: register qt_text_input_method_manager_v1"; if (mTextInputManagerIndex < INT_MAX) { - mTextInputManager.reset(); + mTextInputManagerv2.reset(); +#if QT_WAYLAND_TEXT_INPUT_V4_WIP + mTextInputManagerv4.reset(); +#endif // QT_WAYLAND_TEXT_INPUT_V4_WIP for (QWaylandInputDevice *inputDevice : qAsConst(mInputDevices)) inputDevice->setTextInput(nullptr); } @@ -543,15 +554,35 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin qCDebug(lcQpaWayland) << "text input: register zwp_text_input_v2"; if (mTextInputManagerIndex < INT_MAX) { mTextInputMethodManager.reset(); +#if QT_WAYLAND_TEXT_INPUT_V4_WIP + mTextInputManagerv4.reset(); +#endif // QT_WAYLAND_TEXT_INPUT_V4_WIP for (QWaylandInputDevice *inputDevice : qAsConst(mInputDevices)) inputDevice->setTextInputMethod(nullptr); } - mTextInputManager.reset(new QtWayland::zwp_text_input_manager_v2(registry, id, 1)); + mTextInputManagerv2.reset(new QtWayland::zwp_text_input_manager_v2(registry, id, 1)); for (QWaylandInputDevice *inputDevice : qAsConst(mInputDevices)) - inputDevice->setTextInput(new QWaylandTextInputv2(this, mTextInputManager->get_text_input(inputDevice->wl_seat()))); + inputDevice->setTextInput(new QWaylandTextInputv2(this, mTextInputManagerv2->get_text_input(inputDevice->wl_seat()))); mWaylandIntegration->reconfigureInputContext(); mTextInputManagerIndex = mTextInputManagerList.indexOf(interface); +#if QT_WAYLAND_TEXT_INPUT_V4_WIP + } else if (interface == QLatin1String(QtWayland::zwp_text_input_manager_v4::interface()->name) + && (mTextInputManagerList.contains(interface) && mTextInputManagerList.indexOf(interface) < mTextInputManagerIndex)) { + qCDebug(lcQpaWayland) << "text input: register zwp_text_input_v4"; + if (mTextInputManagerIndex < INT_MAX) { + mTextInputMethodManager.reset(); + mTextInputManagerv2.reset(); + for (QWaylandInputDevice *inputDevice : qAsConst(mInputDevices)) + inputDevice->setTextInputMethod(nullptr); + } + + mTextInputManagerv4.reset(new QtWayland::zwp_text_input_manager_v4(registry, id, 1)); + for (QWaylandInputDevice *inputDevice : qAsConst(mInputDevices)) + inputDevice->setTextInput(new QWaylandTextInputv4(this, mTextInputManagerv4->get_text_input(inputDevice->wl_seat()))); + mWaylandIntegration->reconfigureInputContext(); + mTextInputManagerIndex = mTextInputManagerList.indexOf(interface); +#endif // QT_WAYLAND_TEXT_INPUT_V4_WIP } else if (interface == QLatin1String(QWaylandHardwareIntegration::interface()->name)) { bool disableHardwareIntegration = qEnvironmentVariableIntValue("QT_WAYLAND_DISABLE_HW_INTEGRATION"); if (!disableHardwareIntegration) { @@ -599,11 +630,19 @@ void QWaylandDisplay::registry_global_remove(uint32_t id) } } if (global.interface == QLatin1String(QtWayland::zwp_text_input_manager_v2::interface()->name)) { - mTextInputManager.reset(); + mTextInputManagerv2.reset(); for (QWaylandInputDevice *inputDevice : qAsConst(mInputDevices)) inputDevice->setTextInput(nullptr); mWaylandIntegration->reconfigureInputContext(); } +#if QT_WAYLAND_TEXT_INPUT_V4_WIP + if (global.interface == QLatin1String(QtWayland::zwp_text_input_manager_v4::interface()->name)) { + mTextInputManagerv4.reset(); + for (QWaylandInputDevice *inputDevice : qAsConst(mInputDevices)) + inputDevice->setTextInput(nullptr); + mWaylandIntegration->reconfigureInputContext(); + } +#endif // QT_WAYLAND_TEXT_INPUT_V4_WIP if (global.interface == QLatin1String(QtWayland::qt_text_input_method_manager_v1::interface()->name)) { mTextInputMethodManager.reset(); for (QWaylandInputDevice *inputDevice : qAsConst(mInputDevices)) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay_p.h b/src/plugins/platforms/wayland/qwaylanddisplay_p.h index b58099ee85a..8be911188cf 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay_p.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay_p.h @@ -83,6 +83,7 @@ class QPlatformPlaceholderScreen; namespace QtWayland { class qt_surface_extension; class zwp_text_input_manager_v2; + class zwp_text_input_manager_v4; class qt_text_input_method_manager_v1; } @@ -171,7 +172,8 @@ public: QWaylandPointerGestures *pointerGestures() const { return mPointerGestures.data(); } QWaylandTouchExtension *touchExtension() const { return mTouchExtension.data(); } QtWayland::qt_text_input_method_manager_v1 *textInputMethodManager() const { return mTextInputMethodManager.data(); } - QtWayland::zwp_text_input_manager_v2 *textInputManager() const { return mTextInputManager.data(); } + QtWayland::zwp_text_input_manager_v2 *textInputManagerv2() const { return mTextInputManagerv2.data(); } + QtWayland::zwp_text_input_manager_v4 *textInputManagerv4() const { return mTextInputManagerv4.data(); } QWaylandHardwareIntegration *hardwareIntegration() const { return mHardwareIntegration.data(); } QWaylandXdgOutputManagerV1 *xdgOutputManager() const { return mXdgOutputManager.data(); } @@ -280,7 +282,8 @@ private: QScopedPointer mPrimarySelectionManager; #endif QScopedPointer mTextInputMethodManager; - QScopedPointer mTextInputManager; + QScopedPointer mTextInputManagerv2; + QScopedPointer mTextInputManagerv4; QScopedPointer mHardwareIntegration; QScopedPointer mXdgOutputManager; int mFd = -1; diff --git a/src/plugins/platforms/wayland/qwaylandinputcontext.cpp b/src/plugins/platforms/wayland/qwaylandinputcontext.cpp index 9ac1c3df67c..c594852777a 100644 --- a/src/plugins/platforms/wayland/qwaylandinputcontext.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputcontext.cpp @@ -70,7 +70,11 @@ QWaylandInputContext::~QWaylandInputContext() bool QWaylandInputContext::isValid() const { - return mDisplay->textInputManager() != nullptr; +#if QT_WAYLAND_TEXT_INPUT_V4_WIP + return mDisplay->textInputManagerv2() != nullptr || mDisplay->textInputManagerv4() != nullptr; +#else // QT_WAYLAND_TEXT_INPUT_V4_WIP + return mDisplay->textInputManagerv2() != nullptr; +#endif // QT_WAYLAND_TEXT_INPUT_V4_WIP } void QWaylandInputContext::reset() diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index 5fbdd24188c..7f503ee1e24 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -58,6 +58,9 @@ #include "qwaylanddisplay_p.h" #include "qwaylandshmbackingstore_p.h" #include "qwaylandtextinputv2_p.h" +#if QT_WAYLAND_TEXT_INPUT_V4_WIP +#include "qwaylandtextinputv4_p.h" +#endif // QT_WAYLAND_TEXT_INPUT_V4_WIP #include "qwaylandtextinputinterface_p.h" #include "qwaylandinputcontext_p.h" #include "qwaylandinputmethodcontext_p.h" @@ -421,8 +424,13 @@ QWaylandInputDevice::QWaylandInputDevice(QWaylandDisplay *display, int version, setPrimarySelectionDevice(psm->createDevice(this)); #endif - if (mQDisplay->textInputManager()) - mTextInput.reset(new QWaylandTextInputv2(mQDisplay, mQDisplay->textInputManager()->get_text_input(wl_seat()))); + if (mQDisplay->textInputManagerv2()) + mTextInput.reset(new QWaylandTextInputv2(mQDisplay, mQDisplay->textInputManagerv2()->get_text_input(wl_seat()))); + +#if QT_WAYLAND_TEXT_INPUT_V4_WIP + if (mQDisplay->textInputManagerv4()) + mTextInput.reset(new QWaylandTextInputv4(mQDisplay, mQDisplay->textInputManagerv4()->get_text_input(wl_seat()))); +#endif // QT_WAYLAND_TEXT_INPUT_V4_WIP if (mQDisplay->textInputMethodManager()) mTextInputMethod.reset(new QWaylandTextInputMethod(mQDisplay, mQDisplay->textInputMethodManager()->get_text_input_method(wl_seat()))); diff --git a/src/plugins/platforms/wayland/qwaylandintegration.cpp b/src/plugins/platforms/wayland/qwaylandintegration.cpp index 67af87cb2f2..a1da5ccff8f 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandintegration.cpp @@ -497,7 +497,11 @@ void QWaylandIntegration::reconfigureInputContext() if (requested.isNull()) { if (mDisplay->textInputMethodManager() != nullptr) mInputContext.reset(new QWaylandInputMethodContext(mDisplay.data())); - else if (mDisplay->textInputManager() != nullptr) +#if QT_WAYLAND_TEXT_INPUT_V4_WIP + else if (mDisplay->textInputManagerv2() != nullptr || mDisplay->textInputManagerv4() != nullptr) +#else // QT_WAYLAND_TEXT_INPUT_V4_WIP + else if (mDisplay->textInputManagerv2() != nullptr) +#endif // QT_WAYLAND_TEXT_INPUT_V4_WIP mInputContext.reset(new QWaylandInputContext(mDisplay.data())); } else { mInputContext.reset(QPlatformInputContextFactory::create(requested)); diff --git a/src/plugins/platforms/wayland/qwaylandtextinputinterface_p.h b/src/plugins/platforms/wayland/qwaylandtextinputinterface_p.h index d918f08352e..2b0f381b482 100644 --- a/src/plugins/platforms/wayland/qwaylandtextinputinterface_p.h +++ b/src/plugins/platforms/wayland/qwaylandtextinputinterface_p.h @@ -39,6 +39,7 @@ #ifndef QWAYLANDTEXTINPUTINTERFACE_P_H #define QWAYLANDTEXTINPUTINTERFACE_P_H + // // W A R N I N G // ------------- @@ -68,8 +69,8 @@ public: virtual void disableSurface(::wl_surface *surface) = 0; virtual void enableSurface(::wl_surface *surface) = 0; virtual void updateState(Qt::InputMethodQueries queries, uint32_t flags) = 0; - virtual void showInputPanel() = 0; - virtual void hideInputPanel() = 0; + virtual void showInputPanel() {} + virtual void hideInputPanel() {} virtual bool isInputPanelVisible() const = 0; virtual QRectF keyboardRect() const = 0; virtual QLocale locale() const = 0; diff --git a/src/plugins/platforms/wayland/qwaylandtextinputv4.cpp b/src/plugins/platforms/wayland/qwaylandtextinputv4.cpp new file mode 100644 index 00000000000..5cecaf7a48a --- /dev/null +++ b/src/plugins/platforms/wayland/qwaylandtextinputv4.cpp @@ -0,0 +1,409 @@ +/**************************************************************************** +** +** Copyright (C) 2021 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qwaylandtextinputv4_p.h" + +#include "qwaylandwindow_p.h" +#include "qwaylandinputmethodeventbuilder_p.h" + +#include +#include +#include +#include +#include + +QT_BEGIN_NAMESPACE + +Q_LOGGING_CATEGORY(qLcQpaWaylandTextInput, "qt.qpa.wayland.textinput") + +namespace QtWaylandClient { + +QWaylandTextInputv4::QWaylandTextInputv4(QWaylandDisplay *display, + struct ::zwp_text_input_v4 *text_input) + : QtWayland::zwp_text_input_v4(text_input) + , m_display(display) +{ + +} + +QWaylandTextInputv4::~QWaylandTextInputv4() +{ +} + +namespace { +const Qt::InputMethodQueries supportedQueries = Qt::ImEnabled | + Qt::ImSurroundingText | + Qt::ImCursorPosition | + Qt::ImAnchorPosition | + Qt::ImHints | + Qt::ImCursorRectangle; +} + +void QWaylandTextInputv4::zwp_text_input_v4_enter(struct ::wl_surface *surface) +{ + qCDebug(qLcQpaWaylandTextInput) << Q_FUNC_INFO; + + m_surface = surface; + + m_pendingPreeditString.clear(); + m_pendingCommitString.clear(); + m_pendingDeleteBeforeText = 0; + m_pendingDeleteAfterText = 0; + + enable(); + updateState(supportedQueries, update_state_enter); +} + +void QWaylandTextInputv4::zwp_text_input_v4_leave(struct ::wl_surface *surface) +{ + qCDebug(qLcQpaWaylandTextInput) << Q_FUNC_INFO; + + if (m_surface != surface) { + qCWarning(qLcQpaWaylandTextInput()) << Q_FUNC_INFO << "Got leave event for surface" << surface << "focused surface" << m_surface; + return; + } + + // QTBUG-97248: check commit_mode + // Currently text-input-unstable-v4-wip is implemented with preedit_commit_mode + // 'commit' + + m_currentPreeditString.clear(); + + m_surface = nullptr; + m_currentSerial = 0U; + + disable(); + qCDebug(qLcQpaWaylandTextInput) << Q_FUNC_INFO << "Done"; +} + +void QWaylandTextInputv4::zwp_text_input_v4_preedit_string(const QString &text, int32_t cursorBegin, int32_t cursorEnd) +{ + qCDebug(qLcQpaWaylandTextInput) << Q_FUNC_INFO << text << cursorBegin << cursorEnd; + + if (!QGuiApplication::focusObject()) + return; + + m_pendingPreeditString.text = text; + m_pendingPreeditString.cursorBegin = cursorBegin; + m_pendingPreeditString.cursorEnd = cursorEnd; +} + +void QWaylandTextInputv4::zwp_text_input_v4_commit_string(const QString &text) +{ + qCDebug(qLcQpaWaylandTextInput) << Q_FUNC_INFO << text; + + if (!QGuiApplication::focusObject()) + return; + + m_pendingCommitString = text; +} + +void QWaylandTextInputv4::zwp_text_input_v4_delete_surrounding_text(uint32_t beforeText, uint32_t afterText) +{ + qCDebug(qLcQpaWaylandTextInput) << Q_FUNC_INFO << beforeText << afterText; + + if (!QGuiApplication::focusObject()) + return; + + m_pendingDeleteBeforeText = QWaylandInputMethodEventBuilder::indexFromWayland(m_surroundingText, beforeText); + m_pendingDeleteAfterText = QWaylandInputMethodEventBuilder::indexFromWayland(m_surroundingText, afterText); +} + +void QWaylandTextInputv4::zwp_text_input_v4_done(uint32_t serial) +{ + qCDebug(qLcQpaWaylandTextInput) << Q_FUNC_INFO << "with serial" << serial << m_currentSerial; + + // This is a case of double click. + // text_input_v4 will ignore this done signal and just keep the selection of the clicked word. + if (m_cursorPos != m_anchorPos && (m_pendingDeleteBeforeText != 0 || m_pendingDeleteAfterText != 0)) { + qCDebug(qLcQpaWaylandTextInput) << Q_FUNC_INFO << "Ignore done"; + m_pendingDeleteBeforeText = 0; + m_pendingDeleteAfterText = 0; + m_pendingPreeditString.clear(); + m_pendingCommitString.clear(); + return; + } + + QObject *focusObject = QGuiApplication::focusObject(); + if (!focusObject) + return; + + if (!m_surface) { + qCWarning(qLcQpaWaylandTextInput) << Q_FUNC_INFO << serial << "Surface is not enabled yet"; + return; + } + + qCDebug(qLcQpaWaylandTextInput) << Q_FUNC_INFO << "PREEDIT" << m_pendingPreeditString.text << m_pendingPreeditString.cursorBegin; + + QList attributes; + { + if (m_pendingPreeditString.cursorBegin != -1 || + m_pendingPreeditString.cursorEnd != -1) { + // Current supported cursor shape is just line. + // It means, cursorEnd and cursorBegin are the same. + QInputMethodEvent::Attribute attribute1(QInputMethodEvent::Cursor, + m_pendingPreeditString.text.length(), + 1); + attributes.append(attribute1); + } + + // only use single underline style for now + QTextCharFormat format; + format.setFontUnderline(true); + format.setUnderlineStyle(QTextCharFormat::SingleUnderline); + QInputMethodEvent::Attribute attribute2(QInputMethodEvent::TextFormat, + 0, + m_pendingPreeditString.text.length(), format); + attributes.append(attribute2); + } + QInputMethodEvent event(m_pendingPreeditString.text, attributes); + + qCDebug(qLcQpaWaylandTextInput) << Q_FUNC_INFO << "DELETE" << m_pendingDeleteBeforeText << m_pendingDeleteAfterText; + qCDebug(qLcQpaWaylandTextInput) << Q_FUNC_INFO << "COMMIT" << m_pendingCommitString; + + // A workaround for reselection + // It will disable redundant commit after reselection + if (m_pendingDeleteBeforeText != 0 || m_pendingDeleteAfterText != 0) + m_condReselection = true; + + event.setCommitString(m_pendingCommitString, + -m_pendingDeleteBeforeText, + m_pendingDeleteBeforeText + m_pendingDeleteAfterText); + m_currentPreeditString = m_pendingPreeditString; + m_pendingPreeditString.clear(); + m_pendingCommitString.clear(); + m_pendingDeleteBeforeText = 0; + m_pendingDeleteAfterText = 0; + QCoreApplication::sendEvent(focusObject, &event); + + if (serial == m_currentSerial) + updateState(supportedQueries, update_state_full); +} + +void QWaylandTextInputv4::reset() +{ + qCDebug(qLcQpaWaylandTextInput) << Q_FUNC_INFO; + + m_pendingPreeditString.clear(); +} + +void QWaylandTextInputv4::enableSurface(::wl_surface *) +{ + qCDebug(qLcQpaWaylandTextInput) << Q_FUNC_INFO; +} + +void QWaylandTextInputv4::disableSurface(::wl_surface *surface) +{ + qCDebug(qLcQpaWaylandTextInput) << Q_FUNC_INFO; + + if (m_surface != surface) { + qCWarning(qLcQpaWaylandTextInput()) << Q_FUNC_INFO << "for surface" << surface << "focused surface" << m_surface; + return; + } +} + +void QWaylandTextInputv4::commit() +{ + m_currentSerial = (m_currentSerial < UINT_MAX) ? m_currentSerial + 1U: 0U; + + qCDebug(qLcQpaWaylandTextInput) << Q_FUNC_INFO << "with serial" << m_currentSerial; + QtWayland::zwp_text_input_v4::commit(); +} + +void QWaylandTextInputv4::updateState(Qt::InputMethodQueries queries, uint32_t flags) +{ + qCDebug(qLcQpaWaylandTextInput) << Q_FUNC_INFO << queries << flags; + + if (!QGuiApplication::focusObject()) + return; + + if (!QGuiApplication::focusWindow() || !QGuiApplication::focusWindow()->handle()) + return; + + auto *window = static_cast(QGuiApplication::focusWindow()->handle()); + auto *surface = window->wlSurface(); + if (!surface || (surface != m_surface)) + return; + + queries &= supportedQueries; + bool needsCommit = false; + + QInputMethodQueryEvent event(queries); + QCoreApplication::sendEvent(QGuiApplication::focusObject(), &event); + + // For some reason, a query for Qt::ImSurroundingText gives an empty string even though it is not. + if (!(queries & Qt::ImSurroundingText) && event.value(Qt::ImSurroundingText).toString().isEmpty()) { + return; + } + + if (queries & Qt::ImCursorRectangle) { + const QRect &cRect = event.value(Qt::ImCursorRectangle).toRect(); + const QRect &windowRect = QGuiApplication::inputMethod()->inputItemTransform().mapRect(cRect); + const QMargins margins = window->frameMargins(); + const QRect &surfaceRect = windowRect.translated(margins.left(), margins.top()); + if (surfaceRect != m_cursorRect) { + set_cursor_rectangle(surfaceRect.x(), surfaceRect.y(), surfaceRect.width(), surfaceRect.height()); + m_cursorRect = surfaceRect; + needsCommit = true; + } + } + + if ((queries & Qt::ImSurroundingText) || (queries & Qt::ImCursorPosition) || (queries & Qt::ImAnchorPosition)) { + QString text = event.value(Qt::ImSurroundingText).toString(); + int cursor = event.value(Qt::ImCursorPosition).toInt(); + int anchor = event.value(Qt::ImAnchorPosition).toInt(); + + qCDebug(qLcQpaWaylandTextInput) << "Orginal surrounding_text from InputMethodQuery: " << text << cursor << anchor; + + // Make sure text is not too big + // surround_text cannot exceed 4000byte in wayland protocol + // The worst case will be supposed here. + const int MAX_MESSAGE_SIZE = 4000; + + if (text.toUtf8().size() > MAX_MESSAGE_SIZE) { + const int selectionStart = QWaylandInputMethodEventBuilder::indexToWayland(text, qMin(cursor, anchor)); + const int selectionEnd = QWaylandInputMethodEventBuilder::indexToWayland(text, qMax(cursor, anchor)); + const int selectionLength = selectionEnd - selectionStart; + // If selection is bigger than 4000 byte, it is fixed to 4000 byte. + // anchor will be moved in the 4000 byte boundary. + if (selectionLength > MAX_MESSAGE_SIZE) { + if (anchor > cursor) { + const int length = MAX_MESSAGE_SIZE; + anchor = QWaylandInputMethodEventBuilder::trimmedIndexFromWayland(text, length, cursor); + anchor -= cursor; + text = text.mid(cursor, anchor); + cursor = 0; + } else { + const int length = -MAX_MESSAGE_SIZE; + anchor = QWaylandInputMethodEventBuilder::trimmedIndexFromWayland(text, length, cursor); + cursor -= anchor; + text = text.mid(anchor, cursor); + anchor = 0; + } + } else { + const int offset = (MAX_MESSAGE_SIZE - selectionLength) / 2; + + int textStart = QWaylandInputMethodEventBuilder::trimmedIndexFromWayland(text, -offset, qMin(cursor, anchor)); + int textEnd = QWaylandInputMethodEventBuilder::trimmedIndexFromWayland(text, MAX_MESSAGE_SIZE, textStart); + + anchor -= textStart; + cursor -= textStart; + text = text.mid(textStart, textEnd - textStart); + } + } + qCDebug(qLcQpaWaylandTextInput) << "Modified surrounding_text: " << text << cursor << anchor; + + const int cursorPos = QWaylandInputMethodEventBuilder::indexToWayland(text, cursor); + const int anchorPos = QWaylandInputMethodEventBuilder::indexToWayland(text, anchor); + + if (m_surroundingText != text || m_cursorPos != cursorPos || m_anchorPos != anchorPos) { + qCDebug(qLcQpaWaylandTextInput) << "Current surrounding_text: " << m_surroundingText << m_cursorPos << m_anchorPos; + qCDebug(qLcQpaWaylandTextInput) << "New surrounding_text: " << text << cursorPos << anchorPos; + + set_surrounding_text(text, cursorPos, anchorPos); + + // A workaround in the case of reselection + // It will work when re-clicking a preedit text + if (m_condReselection) { + qCDebug(qLcQpaWaylandTextInput) << "\"commit\" is disabled when Reselection by changing focus"; + m_condReselection = false; + needsCommit = false; + + } + + m_surroundingText = text; + m_cursorPos = cursorPos; + m_anchorPos = anchorPos; + m_cursor = cursor; + } + } + + if (queries & Qt::ImHints) { + QWaylandInputMethodContentType contentType = QWaylandInputMethodContentType::convertV4(static_cast(event.value(Qt::ImHints).toInt())); + qCDebug(qLcQpaWaylandTextInput) << m_contentHint << contentType.hint; + qCDebug(qLcQpaWaylandTextInput) << m_contentPurpose << contentType.purpose; + + if (m_contentHint != contentType.hint || m_contentPurpose != contentType.purpose) { + qCDebug(qLcQpaWaylandTextInput) << "set_content_type: " << contentType.hint << contentType.purpose; + set_content_type(contentType.hint, contentType.purpose); + + m_contentHint = contentType.hint; + m_contentPurpose = contentType.purpose; + needsCommit = true; + } + } + + if (needsCommit + && (flags == update_state_change || flags == update_state_enter)) + commit(); +} + +void QWaylandTextInputv4::setCursorInsidePreedit(int cursor) +{ + Q_UNUSED(cursor); + qCWarning(qLcQpaWaylandTextInput) << "QWaylandTextInputV4: Input protocol \"text-input-unstable-v4-wip\" does not support setting cursor inside preedit. Use qt-text-input-method-unstable-v1 instead for full support of Qt input method events."; +} + +bool QWaylandTextInputv4::isInputPanelVisible() const +{ + qCWarning(qLcQpaWaylandTextInput) << "QWaylandTextInputV4: Input protocol \"text-input-unstable-v4-wip\" does not support querying input method visibility. Use qt-text-input-method-unstable-v1 instead for full support of Qt input method events."; + return false; +} + +QRectF QWaylandTextInputv4::keyboardRect() const +{ + qCDebug(qLcQpaWaylandTextInput) << Q_FUNC_INFO; + return m_cursorRect; +} + +QLocale QWaylandTextInputv4::locale() const +{ + qCWarning(qLcQpaWaylandTextInput) << "QWaylandTextInputV4: Input protocol \"text-input-unstable-v4-wip\" does not support querying input language. Use qt-text-input-method-unstable-v1 instead for full support of Qt input method events."; + return QLocale(); +} + +Qt::LayoutDirection QWaylandTextInputv4::inputDirection() const +{ + qCWarning(qLcQpaWaylandTextInput) << "QWaylandTextInputV4: Input protocol \"text-input-unstable-v4-wip\" does not support querying input direction. Use qt-text-input-method-unstable-v1 instead for full support of Qt input method events."; + return Qt::LeftToRight; +} + +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandtextinputv4_p.h b/src/plugins/platforms/wayland/qwaylandtextinputv4_p.h new file mode 100644 index 00000000000..d273cef277f --- /dev/null +++ b/src/plugins/platforms/wayland/qwaylandtextinputv4_p.h @@ -0,0 +1,139 @@ +/**************************************************************************** +** +** Copyright (C) 2021 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWAYLANDTEXTINPUTV4_P_H +#define QWAYLANDTEXTINPUTV4_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include "qwaylandtextinputinterface_p.h" +#include +#include + +struct wl_callback; +struct wl_callback_listener; + +QT_BEGIN_NAMESPACE + +Q_DECLARE_LOGGING_CATEGORY(qLcQpaWaylandTextInput) + +namespace QtWaylandClient { + +class QWaylandDisplay; + +class QWaylandTextInputv4 : public QtWayland::zwp_text_input_v4, public QWaylandTextInputInterface +{ +public: + QWaylandTextInputv4(QWaylandDisplay *display, struct ::zwp_text_input_v4 *text_input); + ~QWaylandTextInputv4() override; + + void reset() override; + void commit() override; + void updateState(Qt::InputMethodQueries queries, uint32_t flags) override; + // TODO: not supported yet + void setCursorInsidePreedit(int cursor) override; + + bool isInputPanelVisible() const override; + QRectF keyboardRect() const override; + + QLocale locale() const override; + Qt::LayoutDirection inputDirection() const override; + + void enableSurface(::wl_surface *surface) override; + void disableSurface(::wl_surface *surface) override; + +protected: + void zwp_text_input_v4_enter(struct ::wl_surface *surface) override; + void zwp_text_input_v4_leave(struct ::wl_surface *surface) override; + void zwp_text_input_v4_preedit_string(const QString &text, int32_t cursor_begin, int32_t cursor_end) override; + void zwp_text_input_v4_commit_string(const QString &text) override; + void zwp_text_input_v4_delete_surrounding_text(uint32_t before_length, uint32_t after_length) override; + void zwp_text_input_v4_done(uint32_t serial) override; + +private: + QWaylandDisplay *m_display; + QWaylandInputMethodEventBuilder m_builder; + + ::wl_surface *m_surface = nullptr; // ### Here for debugging purposes + + struct PreeditInfo { + QString text; + int cursorBegin = 0; + int cursorEnd = 0; + + void clear() { + text.clear(); + cursorBegin = 0; + cursorEnd = 0; + } + }; + + PreeditInfo m_pendingPreeditString; + PreeditInfo m_currentPreeditString; + QString m_pendingCommitString; + uint m_pendingDeleteBeforeText = 0; + uint m_pendingDeleteAfterText = 0; + + QString m_surroundingText; + int m_cursor; // cursor position in QString + int m_cursorPos; // cursor position in wayland index + int m_anchorPos; // anchor position in wayland index + uint32_t m_contentHint = 0; + uint32_t m_contentPurpose = 0; + QRect m_cursorRect; + + uint m_currentSerial = 0; + + bool m_condReselection = false; +}; + +} + +QT_END_NAMESPACE + +#endif // QWAYLANDTEXTINPUTV4_P_H diff --git a/src/plugins/platforms/wayland/shared/qwaylandinputmethodeventbuilder.cpp b/src/plugins/platforms/wayland/shared/qwaylandinputmethodeventbuilder.cpp index 00e3ae14e42..cfc4a99f810 100644 --- a/src/plugins/platforms/wayland/shared/qwaylandinputmethodeventbuilder.cpp +++ b/src/plugins/platforms/wayland/shared/qwaylandinputmethodeventbuilder.cpp @@ -44,8 +44,10 @@ #ifdef QT_BUILD_WAYLANDCOMPOSITOR_LIB #include +#include #else #include +#include #endif QT_BEGIN_NAMESPACE @@ -194,68 +196,105 @@ QWaylandInputMethodContentType QWaylandInputMethodContentType::convert(Qt::Input uint32_t hint = ZWP_TEXT_INPUT_V2_CONTENT_HINT_NONE; uint32_t purpose = ZWP_TEXT_INPUT_V2_CONTENT_PURPOSE_NORMAL; - if (hints & Qt::ImhHiddenText) { + if (hints & Qt::ImhHiddenText) hint |= ZWP_TEXT_INPUT_V2_CONTENT_HINT_HIDDEN_TEXT; - } - if (hints & Qt::ImhSensitiveData) { + if (hints & Qt::ImhSensitiveData) hint |= ZWP_TEXT_INPUT_V2_CONTENT_HINT_SENSITIVE_DATA; - } - if ((hints & Qt::ImhNoAutoUppercase) == 0) { + if ((hints & Qt::ImhNoAutoUppercase) == 0) hint |= ZWP_TEXT_INPUT_V2_CONTENT_HINT_AUTO_CAPITALIZATION; - } if (hints & Qt::ImhPreferNumbers) { // Nothing yet } - if (hints & Qt::ImhPreferUppercase) { + if (hints & Qt::ImhPreferUppercase) hint |= ZWP_TEXT_INPUT_V2_CONTENT_HINT_UPPERCASE; - } - if (hints & Qt::ImhPreferLowercase) { + if (hints & Qt::ImhPreferLowercase) hint |= ZWP_TEXT_INPUT_V2_CONTENT_HINT_LOWERCASE; - } if ((hints & Qt::ImhNoPredictiveText) == 0) { - hint |= ZWP_TEXT_INPUT_V2_CONTENT_HINT_AUTO_COMPLETION | ZWP_TEXT_INPUT_V2_CONTENT_HINT_AUTO_CORRECTION; + hint |= (ZWP_TEXT_INPUT_V2_CONTENT_HINT_AUTO_COMPLETION + | ZWP_TEXT_INPUT_V2_CONTENT_HINT_AUTO_CORRECTION); } - if ((hints & Qt::ImhDate) && (hints & Qt::ImhTime) == 0) { + if ((hints & Qt::ImhDate) && (hints & Qt::ImhTime) == 0) purpose = ZWP_TEXT_INPUT_V2_CONTENT_PURPOSE_DATE; - } else if ((hints & Qt::ImhDate) && (hints & Qt::ImhTime)) { + else if ((hints & Qt::ImhDate) && (hints & Qt::ImhTime)) purpose = ZWP_TEXT_INPUT_V2_CONTENT_PURPOSE_DATETIME; - } else if ((hints & Qt::ImhDate) == 0 && (hints & Qt::ImhTime)) { + else if ((hints & Qt::ImhDate) == 0 && (hints & Qt::ImhTime)) purpose = ZWP_TEXT_INPUT_V2_CONTENT_PURPOSE_TIME; - } - if (hints & Qt::ImhPreferLatin) { + if (hints & Qt::ImhPreferLatin) hint |= ZWP_TEXT_INPUT_V2_CONTENT_HINT_LATIN; - } - - if (hints & Qt::ImhMultiLine) { + if (hints & Qt::ImhMultiLine) hint |= ZWP_TEXT_INPUT_V2_CONTENT_HINT_MULTILINE; + if (hints & Qt::ImhDigitsOnly) + purpose = ZWP_TEXT_INPUT_V2_CONTENT_PURPOSE_DIGITS; + if (hints & Qt::ImhFormattedNumbersOnly) + purpose = ZWP_TEXT_INPUT_V2_CONTENT_PURPOSE_NUMBER; + if (hints & Qt::ImhUppercaseOnly) + hint |= ZWP_TEXT_INPUT_V2_CONTENT_HINT_UPPERCASE; + if (hints & Qt::ImhLowercaseOnly) + hint |= ZWP_TEXT_INPUT_V2_CONTENT_HINT_LOWERCASE; + if (hints & Qt::ImhDialableCharactersOnly) + purpose = ZWP_TEXT_INPUT_V2_CONTENT_PURPOSE_PHONE; + if (hints & Qt::ImhEmailCharactersOnly) + purpose = ZWP_TEXT_INPUT_V2_CONTENT_PURPOSE_EMAIL; + if (hints & Qt::ImhUrlCharactersOnly) + purpose = ZWP_TEXT_INPUT_V2_CONTENT_PURPOSE_URL; + if (hints & Qt::ImhLatinOnly) + hint |= ZWP_TEXT_INPUT_V2_CONTENT_HINT_LATIN; + + return QWaylandInputMethodContentType{hint, purpose}; +} + +QWaylandInputMethodContentType QWaylandInputMethodContentType::convertV4(Qt::InputMethodHints hints) +{ + uint32_t hint = ZWP_TEXT_INPUT_V4_CONTENT_HINT_NONE; + uint32_t purpose = ZWP_TEXT_INPUT_V4_CONTENT_PURPOSE_NORMAL; + + if (hints & Qt::ImhHiddenText) + hint |= ZWP_TEXT_INPUT_V4_CONTENT_HINT_HIDDEN_TEXT; + if (hints & Qt::ImhSensitiveData) + hint |= ZWP_TEXT_INPUT_V4_CONTENT_HINT_SENSITIVE_DATA; + if ((hints & Qt::ImhNoAutoUppercase) == 0) + hint |= ZWP_TEXT_INPUT_V4_CONTENT_HINT_AUTO_CAPITALIZATION; + if (hints & Qt::ImhPreferNumbers) { + // Nothing yet + } + if (hints & Qt::ImhPreferUppercase) + hint |= ZWP_TEXT_INPUT_V4_CONTENT_HINT_UPPERCASE; + if (hints & Qt::ImhPreferLowercase) + hint |= ZWP_TEXT_INPUT_V4_CONTENT_HINT_LOWERCASE; + if ((hints & Qt::ImhNoPredictiveText) == 0) { + hint |= (ZWP_TEXT_INPUT_V4_CONTENT_HINT_COMPLETION + | ZWP_TEXT_INPUT_V4_CONTENT_HINT_SPELLCHECK); } - if (hints & Qt::ImhDigitsOnly) { - purpose = ZWP_TEXT_INPUT_V2_CONTENT_PURPOSE_DIGITS; - } - if (hints & Qt::ImhFormattedNumbersOnly) { - purpose = ZWP_TEXT_INPUT_V2_CONTENT_PURPOSE_NUMBER; - } - if (hints & Qt::ImhUppercaseOnly) { - hint |= ZWP_TEXT_INPUT_V2_CONTENT_HINT_UPPERCASE; - } - if (hints & Qt::ImhLowercaseOnly) { - hint |= ZWP_TEXT_INPUT_V2_CONTENT_HINT_LOWERCASE; - } - if (hints & Qt::ImhDialableCharactersOnly) { - purpose = ZWP_TEXT_INPUT_V2_CONTENT_PURPOSE_PHONE; - } - if (hints & Qt::ImhEmailCharactersOnly) { - purpose = ZWP_TEXT_INPUT_V2_CONTENT_PURPOSE_EMAIL; - } - if (hints & Qt::ImhUrlCharactersOnly) { - purpose = ZWP_TEXT_INPUT_V2_CONTENT_PURPOSE_URL; - } - if (hints & Qt::ImhLatinOnly) { - hint |= ZWP_TEXT_INPUT_V2_CONTENT_HINT_LATIN; - } + if ((hints & Qt::ImhDate) && (hints & Qt::ImhTime) == 0) + purpose = ZWP_TEXT_INPUT_V4_CONTENT_PURPOSE_DATE; + else if ((hints & Qt::ImhDate) && (hints & Qt::ImhTime)) + purpose = ZWP_TEXT_INPUT_V4_CONTENT_PURPOSE_DATETIME; + else if ((hints & Qt::ImhDate) == 0 && (hints & Qt::ImhTime)) + purpose = ZWP_TEXT_INPUT_V4_CONTENT_PURPOSE_TIME; + if (hints & Qt::ImhPreferLatin) + hint |= ZWP_TEXT_INPUT_V4_CONTENT_HINT_LATIN; + if (hints & Qt::ImhMultiLine) + hint |= ZWP_TEXT_INPUT_V4_CONTENT_HINT_MULTILINE; + if (hints & Qt::ImhDigitsOnly) + purpose = ZWP_TEXT_INPUT_V4_CONTENT_PURPOSE_DIGITS; + if (hints & Qt::ImhFormattedNumbersOnly) + purpose = ZWP_TEXT_INPUT_V4_CONTENT_PURPOSE_NUMBER; + if (hints & Qt::ImhUppercaseOnly) + hint |= ZWP_TEXT_INPUT_V4_CONTENT_HINT_UPPERCASE; + if (hints & Qt::ImhLowercaseOnly) + hint |= ZWP_TEXT_INPUT_V4_CONTENT_HINT_LOWERCASE; + if (hints & Qt::ImhDialableCharactersOnly) + purpose = ZWP_TEXT_INPUT_V4_CONTENT_PURPOSE_PHONE; + if (hints & Qt::ImhEmailCharactersOnly) + purpose = ZWP_TEXT_INPUT_V4_CONTENT_PURPOSE_EMAIL; + if (hints & Qt::ImhUrlCharactersOnly) + purpose = ZWP_TEXT_INPUT_V4_CONTENT_PURPOSE_URL; + if (hints & Qt::ImhLatinOnly) + hint |= ZWP_TEXT_INPUT_V4_CONTENT_HINT_LATIN; + return QWaylandInputMethodContentType{hint, purpose}; } @@ -273,6 +312,44 @@ int QWaylandInputMethodEventBuilder::indexFromWayland(const QString &text, int l } } +int QWaylandInputMethodEventBuilder::trimmedIndexFromWayland(const QString &text, int length, int base) +{ + if (length == 0) + return base; + + if (length < 0) { + const QByteArray &utf8 = QStringView{text}.left(base).toUtf8(); + const int len = utf8.size(); + const int start = len + length; + if (start <= 0) + return 0; + + for (int i = 0; i < 4; i++) { + if (start + i >= len) + return base; + + const unsigned char ch = utf8.at(start + i); + // check if current character is a utf8's initial character. + if (ch < 0x80 || ch > 0xbf) + return QString::fromUtf8(utf8.left(start + i)).length(); + } + } else { + const QByteArray &utf8 = QStringView{text}.mid(base).toUtf8(); + const int len = utf8.size(); + const int start = length; + if (start >= len) + return base + QString::fromUtf8(utf8).length(); + + for (int i = 0; i < 4; i++) { + const unsigned char ch = utf8.at(start - i); + // check if current character is a utf8's initial character. + if (ch < 0x80 || ch > 0xbf) + return base + QString::fromUtf8(utf8.left(start - i)).length(); + } + } + return -1; +} + int QWaylandInputMethodEventBuilder::indexToWayland(const QString &text, int length, int base) { return QStringView{text}.mid(base, length).toUtf8().size(); diff --git a/src/plugins/platforms/wayland/shared/qwaylandinputmethodeventbuilder_p.h b/src/plugins/platforms/wayland/shared/qwaylandinputmethodeventbuilder_p.h index 2499a563f45..f362562fa1b 100644 --- a/src/plugins/platforms/wayland/shared/qwaylandinputmethodeventbuilder_p.h +++ b/src/plugins/platforms/wayland/shared/qwaylandinputmethodeventbuilder_p.h @@ -63,6 +63,8 @@ public: static int indexFromWayland(const QString &text, int length, int base = 0); static int indexToWayland(const QString &text, int length, int base = 0); + + static int trimmedIndexFromWayland(const QString &text, int length, int base = 0); private: QPair replacementForDeleteSurrounding(); @@ -76,10 +78,11 @@ private: }; struct QWaylandInputMethodContentType { - uint32_t hint; - uint32_t purpose; + uint32_t hint = 0; + uint32_t purpose = 0; static QWaylandInputMethodContentType convert(Qt::InputMethodHints hints); + static QWaylandInputMethodContentType convertV4(Qt::InputMethodHints hints); }; From 0a8d63ea67b31a6355e6221d1281cd673df5e8ae Mon Sep 17 00:00:00 2001 From: David Redondo Date: Mon, 11 Oct 2021 09:59:55 +0200 Subject: [PATCH 1013/1507] Only return modifiers if we have focus If we don't have focus, we can't infer anything about the state of keys. Change-Id: I773a3d7768abe6d595f0ffbc279d61a47c27ea24 Reviewed-by: David Edmundson --- src/plugins/platforms/wayland/qwaylandintegration.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandintegration.cpp b/src/plugins/platforms/wayland/qwaylandintegration.cpp index a1da5ccff8f..73e4222fffb 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandintegration.cpp @@ -284,7 +284,7 @@ QWaylandDisplay *QWaylandIntegration::display() const Qt::KeyboardModifiers QWaylandIntegration::queryKeyboardModifiers() const { - if (auto *seat = mDisplay->currentInputDevice()) { + if (auto *seat = mDisplay->currentInputDevice(); seat && seat->keyboardFocus()) { return seat->modifiers(); } return Qt::NoModifier; From a7bb7210ac76a397b4aec8d8f32d902dc932d855 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Mon, 18 Oct 2021 16:41:12 +0200 Subject: [PATCH 1014/1507] Introduce new qt-shell and an API for custom shells Adds a new API for writing custom shell extensions. This API is supported, but semi-public. Binary compatibility is not guaranteed. Also adds qt-shell, a new shell that maps directly to the QWindow API, and provides functionality that Qt provides on other window systems, such as absolute window positions and window activation. This shell is not intended for use on the desktop. This is a squashed commit of a development branch consisting of approximately 60 changes. Contributors: Eskil Abrahamsen Blomfeldt Paul Olav Tvete Task-number: QTBUG-94330 Task-number: QTBUG-91542 Change-Id: I419b6bd8179fe03e4da47d328c7ff4b4795b8a91 Reviewed-by: Eskil Abrahamsen Blomfeldt Reviewed-by: David Edmundson Reviewed-by: Paul Olav Tvete --- src/plugins/platforms/wayland/CMakeLists.txt | 3 +- src/plugins/platforms/wayland/configure.cmake | 5 ++ .../plugins/shellintegration/CMakeLists.txt | 4 ++ .../qwaylandfullscreenshellv1integration.cpp | 21 ++++--- .../qwaylandfullscreenshellv1integration.h | 3 +- .../wl-shell/qwaylandwlshellintegration.cpp | 19 +++--- .../wl-shell/qwaylandwlshellintegration_p.h | 2 +- .../xdg-shell/qwaylandxdgshellintegration.cpp | 20 +++---- .../xdg-shell/qwaylandxdgshellintegration_p.h | 2 +- .../platforms/wayland/qtwaylandclientglobal.h | 11 ---- .../platforms/wayland/qwaylanddisplay_p.h | 1 + .../platforms/wayland/qwaylandintegration.cpp | 16 +++++ .../wayland/qwaylandshellsurface.cpp | 44 ++++++++++++++ .../wayland/qwaylandshellsurface_p.h | 25 ++++++-- .../platforms/wayland/qwaylandwindow.cpp | 60 +++++++++++++++---- .../platforms/wayland/qwaylandwindow_p.h | 3 + .../qwaylandclientshellapi_p.h | 60 +++++++++++++++++++ .../qwaylandshellintegration.cpp | 57 ++++++++++++++++++ .../qwaylandshellintegration_p.h | 57 +++++++++++++++++- 19 files changed, 350 insertions(+), 63 deletions(-) create mode 100644 src/plugins/platforms/wayland/shellintegration/qwaylandclientshellapi_p.h create mode 100644 src/plugins/platforms/wayland/shellintegration/qwaylandshellintegration.cpp diff --git a/src/plugins/platforms/wayland/CMakeLists.txt b/src/plugins/platforms/wayland/CMakeLists.txt index c7264d6774f..696a8b3d284 100644 --- a/src/plugins/platforms/wayland/CMakeLists.txt +++ b/src/plugins/platforms/wayland/CMakeLists.txt @@ -48,7 +48,8 @@ qt_internal_add_module(WaylandClient qwaylandtouch.cpp qwaylandtouch_p.h qwaylandwindow.cpp qwaylandwindow_p.h qwaylandwindowmanagerintegration.cpp qwaylandwindowmanagerintegration_p.h - shellintegration/qwaylandshellintegration_p.h + shellintegration/qwaylandclientshellapi_p.h + shellintegration/qwaylandshellintegration_p.h shellintegration/qwaylandshellintegration.cpp shellintegration/qwaylandshellintegrationfactory.cpp shellintegration/qwaylandshellintegrationfactory_p.h shellintegration/qwaylandshellintegrationplugin.cpp shellintegration/qwaylandshellintegrationplugin_p.h INCLUDE_DIRECTORIES diff --git a/src/plugins/platforms/wayland/configure.cmake b/src/plugins/platforms/wayland/configure.cmake index e0d0205b8a4..a8184fc1c38 100644 --- a/src/plugins/platforms/wayland/configure.cmake +++ b/src/plugins/platforms/wayland/configure.cmake @@ -37,6 +37,10 @@ qt_feature("wayland-client-xdg-shell" PRIVATE LABEL "xdg-shell" CONDITION QT_FEATURE_wayland_client ) +qt_feature("wayland-client-qt-shell" PRIVATE + LABEL "qt-shell" + CONDITION QT_FEATURE_wayland_client +) qt_feature("egl-extension-platform-wayland" PRIVATE LABEL "EGL wayland platform extension" CONDITION QT_FEATURE_wayland_client AND QT_FEATURE_opengl AND QT_FEATURE_egl AND TEST_egl_1_5_wayland @@ -45,4 +49,5 @@ qt_configure_add_summary_section(NAME "Qt Wayland Client Shell Integrations") qt_configure_add_summary_entry(ARGS "wayland-client-xdg-shell") qt_configure_add_summary_entry(ARGS "wayland-client-ivi-shell") qt_configure_add_summary_entry(ARGS "wayland-client-wl-shell") +qt_configure_add_summary_entry(ARGS "wayland-client-qt-shell") qt_configure_end_summary_section() # end of "Qt Wayland Client Shell Integrations" section diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/shellintegration/CMakeLists.txt index fef15fe798e..eefa0227d4a 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/CMakeLists.txt +++ b/src/plugins/platforms/wayland/plugins/shellintegration/CMakeLists.txt @@ -12,3 +12,7 @@ endif() if(QT_FEATURE_wayland_client_xdg_shell) add_subdirectory(xdg-shell) endif() + +if(QT_FEATURE_wayland_client_qt_shell) + add_subdirectory(qt-shell) +endif() diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/fullscreen-shell-v1/qwaylandfullscreenshellv1integration.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/fullscreen-shell-v1/qwaylandfullscreenshellv1integration.cpp index 0cd2cb1e893..033cbf6ec02 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/fullscreen-shell-v1/qwaylandfullscreenshellv1integration.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/fullscreen-shell-v1/qwaylandfullscreenshellv1integration.cpp @@ -44,23 +44,22 @@ QT_BEGIN_NAMESPACE namespace QtWaylandClient { -bool QWaylandFullScreenShellV1Integration::initialize(QWaylandDisplay *display) +bool QWaylandFullScreenShellV1Integration::initialize() { - for (const QWaylandDisplay::RegistryGlobal &global : display->globals()) { - if (global.interface == QLatin1String("zwp_fullscreen_shell_v1") && !m_shell) { - m_shell.reset(new QtWayland::zwp_fullscreen_shell_v1(display->wl_registry(), global.id, global.version)); - break; - } - } - + if (m_shell) + return true; + wl_registry *registry; + uint32_t id; + uint32_t version; + bool found = findGlobal(QLatin1String("zwp_fullscreen_shell_v1"), ®istry, &id, &version); + if (found) + m_shell.reset(new QtWayland::zwp_fullscreen_shell_v1(registry, id, version)); if (!m_shell) { qCDebug(lcQpaWayland) << "Couldn't find global zwp_fullscreen_shell_v1 for fullscreen-shell"; return false; } - - return QWaylandShellIntegration::initialize(display); + return true; } - QWaylandShellSurface *QWaylandFullScreenShellV1Integration::createShellSurface(QWaylandWindow *window) { return new QWaylandFullScreenShellV1Surface(m_shell.data(), window); diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/fullscreen-shell-v1/qwaylandfullscreenshellv1integration.h b/src/plugins/platforms/wayland/plugins/shellintegration/fullscreen-shell-v1/qwaylandfullscreenshellv1integration.h index 131f9e72097..da99f6c4e0e 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/fullscreen-shell-v1/qwaylandfullscreenshellv1integration.h +++ b/src/plugins/platforms/wayland/plugins/shellintegration/fullscreen-shell-v1/qwaylandfullscreenshellv1integration.h @@ -43,6 +43,7 @@ #include #include #include +#include #include "qwayland-fullscreen-shell-unstable-v1.h" @@ -53,7 +54,7 @@ namespace QtWaylandClient { class Q_WAYLAND_CLIENT_EXPORT QWaylandFullScreenShellV1Integration : public QWaylandShellIntegration { public: - bool initialize(QWaylandDisplay *display) override; + bool initialize() override; QWaylandShellSurface *createShellSurface(QWaylandWindow *window) override; private: diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellintegration.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellintegration.cpp index 354ee19b886..7353cb1f968 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellintegration.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellintegration.cpp @@ -47,15 +47,16 @@ QT_BEGIN_NAMESPACE namespace QtWaylandClient { -bool QWaylandWlShellIntegration::initialize(QWaylandDisplay *display) +bool QWaylandWlShellIntegration::initialize() { - const auto globals = display->globals(); - for (QWaylandDisplay::RegistryGlobal global : globals) { - if (global.interface == QLatin1String("wl_shell")) { - m_wlShell = new QtWayland::wl_shell(display->wl_registry(), global.id, 1); - break; - } - } + if (m_wlShell) + return true; + wl_registry *registry; + uint32_t id; + uint32_t version; + bool found = findGlobal(QLatin1String("wl_shell"), ®istry, &id, &version); + if (found) + m_wlShell = new QtWayland::wl_shell(registry, id, 1); if (!m_wlShell) { qCDebug(lcQpaWayland) << "Couldn't find global wl_shell"; @@ -66,7 +67,7 @@ bool QWaylandWlShellIntegration::initialize(QWaylandDisplay *display) << "\"xdg-shell\" if supported by the compositor" << "by setting the environment variable QT_WAYLAND_SHELL_INTEGRATION"; - return QWaylandShellIntegration::initialize(display); + return true; } QWaylandShellSurface *QWaylandWlShellIntegration::createShellSurface(QWaylandWindow *window) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellintegration_p.h b/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellintegration_p.h index 3d76cc31073..47815d54a18 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellintegration_p.h +++ b/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellintegration_p.h @@ -63,7 +63,7 @@ class Q_WAYLAND_CLIENT_EXPORT QWaylandWlShellIntegration : public QWaylandShellI { public: QWaylandWlShellIntegration() {} - bool initialize(QWaylandDisplay *) override; + bool initialize() override; QWaylandShellSurface *createShellSurface(QWaylandWindow *window) override; void *nativeResourceForWindow(const QByteArray &resource, QWindow *window) override; diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshellintegration.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshellintegration.cpp index fcdd435c6b7..8390d76f68e 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshellintegration.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshellintegration.cpp @@ -47,21 +47,21 @@ QT_BEGIN_NAMESPACE namespace QtWaylandClient { -bool QWaylandXdgShellIntegration::initialize(QWaylandDisplay *display) +bool QWaylandXdgShellIntegration::initialize() { - for (QWaylandDisplay::RegistryGlobal global : display->globals()) { - if (global.interface == QLatin1String("xdg_wm_base")) { - m_xdgShell.reset(new QWaylandXdgShell(display, global.id, global.version)); - break; - } - } - + if (m_xdgShell) + return true; + wl_registry *registry; + uint32_t id; + uint32_t version; + bool found = findGlobal(QLatin1String("xdg_wm_base"), ®istry, &id, &version); + if (found) + m_xdgShell.reset(new QWaylandXdgShell(m_display, id, version)); if (!m_xdgShell) { qCDebug(lcQpaWayland) << "Couldn't find global xdg_wm_base for xdg-shell stable"; return false; } - - return QWaylandShellIntegration::initialize(display); + return true; } QWaylandShellSurface *QWaylandXdgShellIntegration::createShellSurface(QWaylandWindow *window) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshellintegration_p.h b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshellintegration_p.h index fced9eb07c2..cd54dd489d3 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshellintegration_p.h +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshellintegration_p.h @@ -63,7 +63,7 @@ class Q_WAYLAND_CLIENT_EXPORT QWaylandXdgShellIntegration : public QWaylandShell { public: QWaylandXdgShellIntegration() {} - bool initialize(QWaylandDisplay *display) override; + bool initialize() override; QWaylandShellSurface *createShellSurface(QWaylandWindow *window) override; void *nativeResourceForWindow(const QByteArray &resource, QWindow *window) override; diff --git a/src/plugins/platforms/wayland/qtwaylandclientglobal.h b/src/plugins/platforms/wayland/qtwaylandclientglobal.h index 5f474f378b9..42f8ec8aac4 100644 --- a/src/plugins/platforms/wayland/qtwaylandclientglobal.h +++ b/src/plugins/platforms/wayland/qtwaylandclientglobal.h @@ -40,17 +40,6 @@ #ifndef QWAYLANDCLIENTGLOBAL_H #define QWAYLANDCLIENTGLOBAL_H -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - #include #include diff --git a/src/plugins/platforms/wayland/qwaylanddisplay_p.h b/src/plugins/platforms/wayland/qwaylanddisplay_p.h index 8be911188cf..cb345d7a049 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay_p.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay_p.h @@ -217,6 +217,7 @@ public: bool isKeyboardAvailable() const; void initEventThread(); + public slots: void blockingReadEvents(); void flushRequests(); diff --git a/src/plugins/platforms/wayland/qwaylandintegration.cpp b/src/plugins/platforms/wayland/qwaylandintegration.cpp index 73e4222fffb..274ae9a9df7 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandintegration.cpp @@ -83,12 +83,14 @@ #include "qwaylandserverbufferintegration_p.h" #include "qwaylandserverbufferintegrationfactory_p.h" +#include "qwaylandshellsurface_p.h" #include "qwaylandshellintegration_p.h" #include "qwaylandshellintegrationfactory_p.h" #include "qwaylandinputdeviceintegration_p.h" #include "qwaylandinputdeviceintegrationfactory_p.h" +#include "qwaylandwindow_p.h" #if QT_CONFIG(accessibility_atspi_bridge) #include @@ -119,6 +121,19 @@ QWaylandIntegration::QWaylandIntegration() mFailed = true; return; } + + // ### Not ideal... + // We don't want to use QPlatformWindow::requestActivate here, since that gives a warning + // for most shells. Also, we don't want to put this into the specific shells that can use + // it, since we want to support more than one shell in one client. + // In addition, this will send a new requestActivate when the focus object changes, even if + // the focus window stays the same. + QObject::connect(qApp, &QGuiApplication::focusObjectChanged, qApp, [](){ + QWindow *fw = QGuiApplication::focusWindow(); + auto *w = fw ? static_cast(fw->handle()) : nullptr; + if (w && w->shellSurface()) + w->shellSurface()->requestActivate(); + }); } QWaylandIntegration::~QWaylandIntegration() @@ -435,6 +450,7 @@ void QWaylandIntegration::initializeShellIntegration() } else { preferredShells << QLatin1String("xdg-shell"); preferredShells << QLatin1String("wl-shell") << QLatin1String("ivi-shell"); + preferredShells << QLatin1String("qt-shell"); } for (const QString &preferredShell : qAsConst(preferredShells)) { diff --git a/src/plugins/platforms/wayland/qwaylandshellsurface.cpp b/src/plugins/platforms/wayland/qwaylandshellsurface.cpp index 1dfdfd5e007..81e05a444e8 100644 --- a/src/plugins/platforms/wayland/qwaylandshellsurface.cpp +++ b/src/plugins/platforms/wayland/qwaylandshellsurface.cpp @@ -40,6 +40,7 @@ #include "qwaylandshellsurface_p.h" #include "qwaylandwindow_p.h" #include "qwaylandextendedsurface_p.h" +#include "qwaylandinputdevice_p.h" QT_BEGIN_NAMESPACE @@ -61,6 +62,49 @@ void QWaylandShellSurface::sendProperty(const QString &name, const QVariant &val Q_UNUSED(value); } +QPlatformWindow *QWaylandShellSurface::platformWindow() +{ + return m_window; +} + +wl_surface *QWaylandShellSurface::wlSurface() +{ + return m_window ? m_window->wlSurface() : nullptr; +} + +void QWaylandShellSurface::resizeFromApplyConfigure(const QSize &sizeWithMargins, const QPoint &offset) +{ + m_window->resizeFromApplyConfigure(sizeWithMargins, offset); +} + +void QWaylandShellSurface::repositionFromApplyConfigure(const QPoint &position) +{ + m_window->repositionFromApplyConfigure(position); +} + +void QWaylandShellSurface::setGeometryFromApplyConfigure(const QPoint &globalPosition, const QSize &sizeWithMargins) +{ + m_window->setGeometryFromApplyConfigure(globalPosition, sizeWithMargins); +} + +void QWaylandShellSurface::applyConfigureWhenPossible() +{ + m_window->applyConfigureWhenPossible(); +} + +void QWaylandShellSurface::handleActivationChanged(bool activated) +{ + if (activated) + m_window->display()->handleWindowActivated(m_window); + else + m_window->display()->handleWindowDeactivated(m_window); +} + +uint32_t QWaylandShellSurface::getSerial(QWaylandInputDevice *inputDevice) +{ + return inputDevice->serial(); +} + } QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandshellsurface_p.h b/src/plugins/platforms/wayland/qwaylandshellsurface_p.h index 080d13851bc..cdf1abdbc71 100644 --- a/src/plugins/platforms/wayland/qwaylandshellsurface_p.h +++ b/src/plugins/platforms/wayland/qwaylandshellsurface_p.h @@ -53,14 +53,16 @@ #include #include - -#include +#include #include +struct wl_surface; + QT_BEGIN_NAMESPACE class QVariant; class QWindow; +class QPlatformWindow; namespace QtWaylandClient { @@ -90,15 +92,30 @@ public: virtual void sendProperty(const QString &name, const QVariant &value); - inline QWaylandWindow *window() { return m_window; } - virtual void applyConfigure() {} virtual void requestWindowStates(Qt::WindowStates states) {Q_UNUSED(states);} virtual bool wantsDecorations() const { return false; } + virtual QMargins serverSideFrameMargins() const { return QMargins(); } virtual void propagateSizeHints() {} virtual void setWindowGeometry(const QRect &rect) { Q_UNUSED(rect); } + virtual void setWindowPosition(const QPoint &position) { Q_UNUSED(position); } + + virtual bool requestActivate() { return false; } + + inline QWaylandWindow *window() { return m_window; } + QPlatformWindow *platformWindow(); + struct wl_surface *wlSurface(); + +protected: + void resizeFromApplyConfigure(const QSize &sizeWithMargins, const QPoint &offset = {0, 0}); + void repositionFromApplyConfigure(const QPoint &position); + void setGeometryFromApplyConfigure(const QPoint &globalPosition, const QSize &sizeWithMargins); + void applyConfigureWhenPossible(); + void handleActivationChanged(bool activated); + + static uint32_t getSerial(QWaylandInputDevice *inputDevice); private: QWaylandWindow *m_window = nullptr; diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 0cc185522b2..635c92a085e 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -342,7 +342,7 @@ void QWaylandWindow::setGeometry_helper(const QRect &rect) qBound(minimum.height(), rect.height(), maximum.height()))); if (mSubSurfaceWindow) { - QMargins m = QPlatformWindow::parent()->frameMargins(); + QMargins m = static_cast(QPlatformWindow::parent())->clientSideMargins(); mSubSurfaceWindow->set_position(rect.x() + m.left(), rect.y() + m.top()); QWaylandWindow *parentWindow = mSubSurfaceWindow->parent(); @@ -372,16 +372,45 @@ void QWaylandWindow::setGeometry(const QRect &rect) if (isExposed() && !mInResizeFromApplyConfigure && exposeGeometry != mLastExposeGeometry) sendExposeEvent(exposeGeometry); - if (mShellSurface && isExposed()) + if (mShellSurface && isExposed()) { mShellSurface->setWindowGeometry(windowContentGeometry()); + if (!qt_window_private(window())->positionAutomatic) + mShellSurface->setWindowPosition(windowGeometry().topLeft()); + } if (isOpaque() && mMask.isEmpty()) setOpaqueArea(rect); } +void QWaylandWindow::setGeometryFromApplyConfigure(const QPoint &globalPosition, const QSize &sizeWithMargins) +{ + QMargins margins = clientSideMargins(); + + QPoint positionWithoutMargins = globalPosition + QPoint(margins.left(), margins.top()); + int widthWithoutMargins = qMax(sizeWithMargins.width() - (margins.left() + margins.right()), 1); + int heightWithoutMargins = qMax(sizeWithMargins.height() - (margins.top() + margins.bottom()), 1); + + QRect geometry(positionWithoutMargins, QSize(widthWithoutMargins, heightWithoutMargins)); + + mInResizeFromApplyConfigure = true; + setGeometry(geometry); + mInResizeFromApplyConfigure = false; +} + +void QWaylandWindow::repositionFromApplyConfigure(const QPoint &globalPosition) +{ + QMargins margins = clientSideMargins(); + QPoint positionWithoutMargins = globalPosition + QPoint(margins.left(), margins.top()); + + QRect geometry(positionWithoutMargins, windowGeometry().size()); + mInResizeFromApplyConfigure = true; + setGeometry(geometry); + mInResizeFromApplyConfigure = false; +} + void QWaylandWindow::resizeFromApplyConfigure(const QSize &sizeWithMargins, const QPoint &offset) { - QMargins margins = frameMargins(); + QMargins margins = clientSideMargins(); // Exclude shadows from margins once they are excluded from window geometry // 1) First resizeFromApplyConfigure() call will have sizeWithMargins equal to surfaceSize() @@ -394,7 +423,8 @@ void QWaylandWindow::resizeFromApplyConfigure(const QSize &sizeWithMargins, cons int widthWithoutMargins = qMax(sizeWithMargins.width() - (margins.left() + margins.right()), 1); int heightWithoutMargins = qMax(sizeWithMargins.height() - (margins.top() + margins.bottom()), 1); - QRect geometry(windowGeometry().topLeft(), QSize(widthWithoutMargins, heightWithoutMargins)); + QRect geometry(windowGeometry().topLeft() + QPoint(margins.left(), margins.top()), + QSize(widthWithoutMargins, heightWithoutMargins)); mOffset += offset; mInResizeFromApplyConfigure = true; @@ -411,7 +441,6 @@ void QWaylandWindow::sendExposeEvent(const QRect &rect) mLastExposeGeometry = rect; } - static QList> activePopups; void QWaylandWindow::closePopups(QWaylandWindow *parent) @@ -719,7 +748,15 @@ QMargins QWaylandWindow::frameMargins() const { if (mWindowDecoration) return mWindowDecoration->margins(); - return QPlatformWindow::frameMargins(); + else if (mShellSurface) + return mShellSurface->serverSideFrameMargins(); + else + return QPlatformWindow::frameMargins(); +} + +QMargins QWaylandWindow::clientSideMargins() const +{ + return mWindowDecoration ? mWindowDecoration->margins() : QMargins{}; } /*! @@ -727,7 +764,7 @@ QMargins QWaylandWindow::frameMargins() const */ QSize QWaylandWindow::surfaceSize() const { - return geometry().marginsAdded(frameMargins()).size(); + return geometry().marginsAdded(clientSideMargins()).size(); } /*! @@ -753,7 +790,7 @@ QRect QWaylandWindow::windowContentGeometry() const */ QPointF QWaylandWindow::mapFromWlSurface(const QPointF &surfacePosition) const { - const QMargins margins = frameMargins(); + const QMargins margins = clientSideMargins(); return QPointF(surfacePosition.x() - margins.left(), surfacePosition.y() - margins.top()); } @@ -980,7 +1017,7 @@ void QWaylandWindow::handleMouse(QWaylandInputDevice *inputDevice, const QWaylan #if QT_CONFIG(cursor) if (e.type == QEvent::Enter) { - QRect contentGeometry = windowContentGeometry().marginsRemoved(frameMargins()); + QRect contentGeometry = windowContentGeometry().marginsRemoved(clientSideMargins()); if (contentGeometry.contains(e.local.toPoint())) restoreMouseCursor(inputDevice); } @@ -1213,7 +1250,8 @@ void QWaylandWindow::restoreMouseCursor(QWaylandInputDevice *device) void QWaylandWindow::requestActivateWindow() { - qCWarning(lcQpaWayland) << "Wayland does not support QWindow::requestActivate()"; + if (mShellSurface == nullptr || !mShellSurface->requestActivate()) + qCWarning(lcQpaWayland) << "Wayland does not support QWindow::requestActivate()"; } bool QWaylandWindow::isExposed() const @@ -1448,7 +1486,7 @@ bool QWaylandWindow::isOpaque() const void QWaylandWindow::setOpaqueArea(const QRegion &opaqueArea) { - const QRegion translatedOpaqueArea = opaqueArea.translated(frameMargins().left(), frameMargins().top()); + const QRegion translatedOpaqueArea = opaqueArea.translated(clientSideMargins().left(), clientSideMargins().top()); if (translatedOpaqueArea == mOpaqueArea || !mSurface) return; diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index 17ed9fdca13..f2dbe337fc7 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -123,6 +123,8 @@ public: void setGeometry(const QRect &rect) override; void resizeFromApplyConfigure(const QSize &sizeWithMargins, const QPoint &offset = {0, 0}); + void repositionFromApplyConfigure(const QPoint &position); + void setGeometryFromApplyConfigure(const QPoint &globalPosition, const QSize &sizeWithMargins); void applyConfigureWhenPossible(); //rename to possible? @@ -239,6 +241,7 @@ protected: virtual void doHandleFrameCallback(); virtual QRect defaultGeometry() const; void sendExposeEvent(const QRect &rect); + QMargins clientSideMargins() const; QWaylandDisplay *mDisplay = nullptr; QScopedPointer mSurface; diff --git a/src/plugins/platforms/wayland/shellintegration/qwaylandclientshellapi_p.h b/src/plugins/platforms/wayland/shellintegration/qwaylandclientshellapi_p.h new file mode 100644 index 00000000000..a8863e7d3ed --- /dev/null +++ b/src/plugins/platforms/wayland/shellintegration/qwaylandclientshellapi_p.h @@ -0,0 +1,60 @@ +/**************************************************************************** +** +** Copyright (C) 2021 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the QtWaylandClient module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:GPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 or (at your option) any later version +** approved by the KDE Free Qt Foundation. The licenses are as published by +** the Free Software Foundation and appearing in the file LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWAYLANDCLIENTSHELLAPI_P_H +#define QWAYLANDCLIENTSHELLAPI_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +// N O T E +// ------- +// This file provides a supported API for creating client-side shell +// extensions. Source compatibility will be preserved, but we may break +// forward and backward binary compatibility, even in patch releases. +// +// The supported API contains these classes: +// +// QtWaylandClient::QWaylandShellSurface +// QtWaylandClient::QWaylandShellIntegration +// QtWaylandClient::QWaylandShellIntegrationPlugin + +#include "QtWaylandClient/private/qwaylandshellsurface_p.h" +#include "QtWaylandClient/private/qwaylandshellintegration_p.h" +#include "QtWaylandClient/private/qwaylandshellintegrationplugin_p.h" + +#endif // QWAYLANDCLIENTSHELLAPI_P_H diff --git a/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegration.cpp b/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegration.cpp new file mode 100644 index 00000000000..7bc37792f8c --- /dev/null +++ b/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegration.cpp @@ -0,0 +1,57 @@ +/**************************************************************************** +** +** Copyright (C) 2021 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the QtWaylandClient module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:GPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 or (at your option) any later version +** approved by the KDE Free Qt Foundation. The licenses are as published by +** the Free Software Foundation and appearing in the file LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#include "qwaylandshellintegration_p.h" +#include +#include + +QT_BEGIN_NAMESPACE + +namespace QtWaylandClient { + +wl_surface *QWaylandShellIntegration::wlSurfaceForWindow(QWaylandWindow *window) +{ + return window->wlSurface(); +} + +bool QWaylandShellIntegration::findGlobal(const QString &interface, wl_registry **registry, uint32_t *id, uint32_t *version) +{ + for (QWaylandDisplay::RegistryGlobal &global : m_display->globals()) { + if (global.interface == interface) { + *registry = m_display->wl_registry(); + *id = global.id; + *version = global.version; + return true; + } + } + return false; +} + +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegration_p.h b/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegration_p.h index b308ffe25ee..4de19e7860c 100644 --- a/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegration_p.h +++ b/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegration_p.h @@ -52,10 +52,19 @@ // #include -#include +#include + + + +#include + +struct wl_surface; +struct wl_registry; QT_BEGIN_NAMESPACE +class QWindow; + namespace QtWaylandClient { class QWaylandWindow; @@ -68,9 +77,12 @@ public: QWaylandShellIntegration() {} virtual ~QWaylandShellIntegration() {} - virtual bool initialize(QWaylandDisplay *display) { + bool initialize(QWaylandDisplay *display) { m_display = display; - return true; + return initialize(); + } + virtual bool initialize() { + return false; } virtual QWaylandShellSurface *createShellSurface(QWaylandWindow *window) = 0; virtual void *nativeResourceForWindow(const QByteArray &resource, QWindow *window) { @@ -79,10 +91,49 @@ public: return nullptr; } + static wl_surface *wlSurfaceForWindow(QWaylandWindow *window); + bool findGlobal(const QString &interface, wl_registry **registry, uint32_t *id, uint32_t *version); + protected: QWaylandDisplay *m_display = nullptr; }; +template +class Q_WAYLAND_CLIENT_EXPORT QWaylandShellIntegrationTemplate : public QWaylandShellIntegration, public QWaylandClientExtension +{ +public: + QWaylandShellIntegrationTemplate(const int ver) : + QWaylandClientExtension(ver) + { + } + + bool initialize() override + { + QWaylandClientExtension::initialize(); + return isActive(); + } + + const struct wl_interface *extensionInterface() const override + { + return T::interface(); + } + + void bind(struct ::wl_registry *registry, int id, int ver) override + { + T* instance = static_cast(this); + // Make sure lowest version is used of the supplied version from the + // developer and the version specified in the protocol and also the + // compositor version. + if (this->version() > T::interface()->version) { + qWarning("Supplied protocol version to QWaylandClientExtensionTemplate is higher than the version of the protocol, using protocol version instead."); + } + int minVersion = qMin(ver, qMin(T::interface()->version, this->version())); + setVersion(minVersion); + instance->init(registry, id, minVersion); + } +}; + + } QT_END_NAMESPACE From 37e3c0ff45a812b4a34a20c1fd083643742156be Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Mon, 15 Nov 2021 14:04:05 +0000 Subject: [PATCH 1015/1507] Update wayland.xml to version 1.19.0 This updates only the protocol definition, implementations will need additional commits to opt into using them. Change-Id: I67d6b011e6192ae99f526a16325150eb26cc9236 Reviewed-by: Paul Olav Tvete Reviewed-by: David Redondo Reviewed-by: Qt CI Bot --- src/3rdparty/wayland/protocols/wayland.xml | 190 +++++++++++++++++---- 1 file changed, 158 insertions(+), 32 deletions(-) diff --git a/src/3rdparty/wayland/protocols/wayland.xml b/src/3rdparty/wayland/protocols/wayland.xml index 141038b7a71..471daf668e3 100644 --- a/src/3rdparty/wayland/protocols/wayland.xml +++ b/src/3rdparty/wayland/protocols/wayland.xml @@ -91,18 +91,20 @@ + summary="method doesn't exist on the specified interface or malformed request"/> + This event is used internally by the object ID management - logic. When a client deletes an object, the server will send - this event to acknowledge that it has seen the delete request. - When the client receives this event, it will know that it can - safely reuse the object ID. + logic. When a client deletes an object that it had created, + the server will send this event to acknowledge that it has + seen the delete request. When the client receives this event, + it will know that it can safely reuse the object ID. @@ -291,10 +293,12 @@ formats are optional and may not be supported by the particular renderer in use. - The drm format codes match the macros defined in drm_fourcc.h. - The formats actually supported by the compositor will be - reported by the format event. + The drm format codes match the macros defined in drm_fourcc.h, except + argb8888 and xrgb8888. The formats actually supported by the compositor + will be reported by the format event. + @@ -353,6 +357,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -507,6 +557,9 @@ this request after a NULL mime type has been set in wl_data_offer.accept or no action was received through wl_data_offer.action. + + If wl_data_offer.finish request is received for a non drag and drop + operation, the invalid_finish protocol error is raised. @@ -523,7 +576,7 @@ This request determines the final result of the drag-and-drop operation. If the end result is that no action is accepted, - the drag source will receive wl_drag_source.cancelled. + the drag source will receive wl_data_source.cancelled. The dnd_actions argument must contain only values expressed in the wl_data_device_manager.dnd_actions enum, and the preferred_action @@ -544,8 +597,10 @@ This request can only be made on drag-and-drop offers, a protocol error will be raised otherwise. - - + +
@@ -554,7 +609,8 @@ will be sent right after wl_data_device.enter, or anytime the source side changes its offered actions through wl_data_source.set_actions. - + @@ -595,7 +651,8 @@ final wl_data_offer.set_actions and wl_data_offer.accept requests must happen before the call to wl_data_offer.finish. - +
@@ -692,7 +749,8 @@ wl_data_device.start_drag. Attempting to use the source other than for drag-and-drop will raise a protocol error. - + @@ -748,7 +806,8 @@ Clients can trigger cursor surface changes from this point, so they reflect the current action. - +
@@ -774,7 +833,8 @@ for the eventual data transfer. If source is NULL, enter, leave and motion events are sent only to the client that initiated the drag and the client is expected to handle the data passing - internally. + internally. If source is destroyed, the drag-and-drop session will be + cancelled. The origin surface is the surface where the drag originates and the client must have an active implicit grab that matches the @@ -1274,8 +1334,10 @@ - A surface is a rectangular area that is displayed on the screen. - It has a location, size and pixel contents. + A surface is a rectangular area that may be displayed on zero + or more outputs, and shown any number of times at the compositor's + discretion. They can present wl_buffers, receive user input, and + define a local coordinate system. The size of a surface (and relative positions on it) is described in surface-local coordinates, which may differ from the buffer @@ -1321,6 +1383,7 @@ + @@ -1335,8 +1398,9 @@ The new size of the surface is calculated based on the buffer size transformed by the inverse buffer_transform and the - inverse buffer_scale. This means that the supplied buffer - must be an integer multiple of the buffer_scale. + inverse buffer_scale. This means that at commit time the supplied + buffer size must be an integer multiple of the buffer_scale. If + that's not the case, an invalid_size error is sent. The x and y arguments specify the location of the new pending buffer's upper left corner, relative to the current buffer's upper @@ -1363,6 +1427,12 @@ will not receive a release event, and is not used by the compositor. + If a pending wl_buffer has been committed to more than one wl_surface, + the delivery of wl_buffer.release events becomes undefined. A well + behaved client should not rely on wl_buffer.release events in this + case. Alternatively, a client could create multiple wl_buffer objects + from the same backing storage or use wp_linux_buffer_release. + Destroying the wl_buffer after wl_buffer.release does not change the surface contents. However, if the client destroys the wl_buffer before receiving the wl_buffer.release event, the surface @@ -1397,9 +1467,9 @@ and clears pending damage. The server will clear the current damage as it repaints the surface. - Alternatively, damage can be posted with wl_surface.damage_buffer - which uses buffer coordinates instead of surface coordinates, - and is probably the preferred and intuitive way of doing this. + Note! New clients should not use this request. Instead damage can be + posted with wl_surface.damage_buffer which uses buffer coordinates + instead of surface coordinates. @@ -1543,6 +1613,12 @@ This is emitted whenever a surface's creation, movement, or resizing results in it no longer having any part of it within the scanout region of an output. + + Clients should not use the number of outputs the surface is on for frame + throttling purposes. The surface might be hidden even if no leave event + has been sent, and the compositor might expect new surface content + updates even if no enter event has been sent. The frame event should be + used instead. @@ -1660,7 +1736,7 @@ - + A seat is a group of keyboards, pointer and touch devices. This object is published as a global during start up, or when such a @@ -1678,6 +1754,14 @@ + + + These errors can be emitted in response to wl_seat requests. + + + + This is emitted whenever a seat gains or loses the pointer, @@ -1716,7 +1800,8 @@ This request only takes effect if the seat has the pointer capability, or has had the pointer capability in the past. It is a protocol violation to issue this request on a seat that has - never had the pointer capability. + never had the pointer capability. The missing_capability error will + be sent in this case. @@ -1729,7 +1814,8 @@ This request only takes effect if the seat has the keyboard capability, or has had the keyboard capability in the past. It is a protocol violation to issue this request on a seat that has - never had the keyboard capability. + never had the keyboard capability. The missing_capability error will + be sent in this case. @@ -1742,7 +1828,8 @@ This request only takes effect if the seat has the touch capability, or has had the touch capability in the past. It is a protocol violation to issue this request on a seat that has - never had the touch capability. + never had the touch capability. The missing_capability error will + be sent in this case. @@ -1769,7 +1856,7 @@ - + The wl_pointer interface represents one or more input devices, such as mice, which control the pointer location and pointer_focus @@ -2092,7 +2179,7 @@ - + The wl_keyboard interface represents one or more keyboards associated with a seat. @@ -2113,6 +2200,9 @@ This event provides a file descriptor to the client which can be memory-mapped to provide a keyboard mapping description. + + From version 7 onwards, the fd must be mapped with MAP_PRIVATE by + the recipient, as MAP_SHARED may fail. @@ -2123,6 +2213,9 @@ Notification that this seat's keyboard focus is on a certain surface. + + The compositor must send the wl_keyboard.modifiers event after this + event. @@ -2136,6 +2229,9 @@ The leave notification is sent before the enter notification for the new focus. + + After this event client must assume that all keys, including modifiers, + are lifted and also it must stop key repeating if there's some going on. @@ -2154,6 +2250,12 @@ A key was pressed or released. The time argument is a timestamp with millisecond granularity, with an undefined base. + + The key is a platform-specific key code that can be interpreted + by feeding it to the keyboard mapping (see the keymap event). + + If this event produces a change in modifiers, then the resulting + wl_keyboard.modifiers event must be sent after this event. @@ -2203,7 +2305,7 @@ - + The wl_touch interface represents a touchscreen associated with a seat. @@ -2402,6 +2504,13 @@ The physical size can be set to zero if it doesn't make sense for this output (e.g. for projectors or virtual outputs). + + Note: wl_output only advertises partial information about the output + position and identification. Some compositors, for instance those not + implementing a desktop-style output layout or those exposing virtual + outputs, might fake this information. Instead of using x and y, clients + should use xdg_output.logical_position. Instead of using make and model, + clients should use xdg_output.name and xdg_output.description. @@ -2442,11 +2551,28 @@ current. In other words, the current mode is always the last mode that was received with the current flag set. + Non-current modes are deprecated. A compositor can decide to only + advertise the current mode and never send other modes. Clients + should not rely on non-current modes. + The size of a mode is given in physical hardware units of the output device. This is not necessarily the same as the output size in the global compositor space. For instance, the output may be scaled, as described in wl_output.scale, - or transformed, as described in wl_output.transform. + or transformed, as described in wl_output.transform. Clients + willing to retrieve the output size in the global compositor + space should use xdg_output.logical_size instead. + + The vertical refresh rate can be set to zero if it doesn't make + sense for this output (e.g. for virtual outputs). + + Clients should not use the refresh rate to schedule frames. Instead, + they should use the wl_surface.frame event or the presentation-time + protocol. + + Note: this information is not always meaningful for all outputs. Some + compositors, such as those exposing virtual outputs, might fake the + refresh rate or the size. @@ -2621,7 +2747,7 @@ wl_surface state directly. A sub-surface is initially in the synchronized mode. - Sub-surfaces have also other kind of state, which is managed by + Sub-surfaces also have another kind of state, which is managed by wl_subsurface requests, as opposed to wl_surface requests. This state includes the sub-surface position relative to the parent surface (wl_subsurface.set_position), and the stacking order of From fbba12d7db7185e7d6f9710712e4a9822773591e Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Sun, 14 Nov 2021 13:54:19 +0000 Subject: [PATCH 1016/1507] Client: Avoid processing of events when showing windows The only time we want to dispatch events from the wayland socket is when the application is waiting for external events. Doing so at any other time will cause unpredictable behavior in client code. This caused a crash downstream where we had outputs get altered whilst itterating through outputs, which shouldn't happen. There is no benefit to flushing here, it won't make anything appear faster as we haven't attached the buffer yet. Change-Id: Ie13eae4012dab96a93d8810f468d1343402b8c28 Reviewed-by: Qt CI Bot Reviewed-by: Aleix Pol Gonzalez --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 635c92a085e..b0d1c0d1c0f 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -477,7 +477,6 @@ void QWaylandWindow::setVisible(bool visible) if (window()->type() == Qt::Popup || window()->type() == Qt::ToolTip) activePopups << this; initWindow(); - mDisplay->flushRequests(); setGeometry(windowGeometry()); // Don't flush the events here, or else the newly visible window may start drawing, but since From 715a39f0262f9a7be0917ee540873773142ede70 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 4 Nov 2021 20:26:36 -0700 Subject: [PATCH 1017/1507] Q*FActory: remove unused path arguments Cargo-culted from somewhere but not used in any of these classes. This just made the code bigger for no reason. Also take the opportunity to make it work with !QT_CONFIG(library), which apparently no one bothered to try because it clearly didn't compile. Not that I have tried either... Task-number: QTBUG-97950 Pick-to: 6.2 Change-Id: Ice04365c72984d07a64dfffd16b48632888ed664 Reviewed-by: Shawn Rutledge Reviewed-by: Paul Olav Tvete --- ...qwaylandclientbufferintegrationfactory.cpp | 40 ++---------------- ...qwaylandclientbufferintegrationfactory_p.h | 4 +- ...qwaylandserverbufferintegrationfactory.cpp | 40 ++---------------- ...qwaylandserverbufferintegrationfactory_p.h | 4 +- .../qwaylandinputdeviceintegrationfactory.cpp | 40 ++---------------- .../qwaylandinputdeviceintegrationfactory_p.h | 4 +- .../wayland/qwaylanddecorationfactory.cpp | 41 ++----------------- .../wayland/qwaylanddecorationfactory_p.h | 4 +- .../qwaylandshellintegrationfactory.cpp | 39 ++---------------- .../qwaylandshellintegrationfactory_p.h | 4 +- 10 files changed, 30 insertions(+), 190 deletions(-) diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationfactory.cpp b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationfactory.cpp index 02bed461a85..115bae10461 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationfactory.cpp +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationfactory.cpp @@ -48,49 +48,17 @@ QT_BEGIN_NAMESPACE namespace QtWaylandClient { -#if QT_CONFIG(library) Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader, (QWaylandClientBufferIntegrationFactoryInterface_iid, QLatin1String("/wayland-graphics-integration-client"), Qt::CaseInsensitive)) -Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, directLoader, - (QWaylandClientBufferIntegrationFactoryInterface_iid, QLatin1String(""), Qt::CaseInsensitive)) -#endif -QStringList QWaylandClientBufferIntegrationFactory::keys(const QString &pluginPath) +QStringList QWaylandClientBufferIntegrationFactory::keys() { -#if QT_CONFIG(library) - QStringList list; - if (!pluginPath.isEmpty()) { - QCoreApplication::addLibraryPath(pluginPath); - list = directLoader()->keyMap().values(); - if (!list.isEmpty()) { - const QString postFix = QStringLiteral(" (from ") - + QDir::toNativeSeparators(pluginPath) - + QLatin1Char(')'); - const QStringList::iterator end = list.end(); - for (QStringList::iterator it = list.begin(); it != end; ++it) - (*it).append(postFix); - } - } - list.append(loader()->keyMap().values()); - return list; -#else - return QStringList(); -#endif + return loader->keyMap().values(); } -QWaylandClientBufferIntegration *QWaylandClientBufferIntegrationFactory::create(const QString &name, const QStringList &args, const QString &pluginPath) +QWaylandClientBufferIntegration *QWaylandClientBufferIntegrationFactory::create(const QString &name, const QStringList &args) { -#if QT_CONFIG(library) - // Try loading the plugin from platformPluginPath first: - if (!pluginPath.isEmpty()) { - QCoreApplication::addLibraryPath(pluginPath); - if (QWaylandClientBufferIntegration *ret = qLoadPlugin(directLoader(), name, args)) - return ret; - } - if (QWaylandClientBufferIntegration *ret = qLoadPlugin(loader(), name, args)) - return ret; -#endif - return nullptr; + return qLoadPlugin(loader(), name, args); } } diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationfactory_p.h b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationfactory_p.h index 7eaeed16cc1..29b00f44871 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationfactory_p.h +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationfactory_p.h @@ -63,8 +63,8 @@ class QWaylandClientBufferIntegration; class Q_WAYLAND_CLIENT_EXPORT QWaylandClientBufferIntegrationFactory { public: - static QStringList keys(const QString &pluginPath = QString()); - static QWaylandClientBufferIntegration *create(const QString &name, const QStringList &args, const QString &pluginPath = QString()); + static QStringList keys(); + static QWaylandClientBufferIntegration *create(const QString &name, const QStringList &args); }; } diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationfactory.cpp b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationfactory.cpp index 39d65f88dbd..65563974122 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationfactory.cpp +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationfactory.cpp @@ -48,49 +48,17 @@ QT_BEGIN_NAMESPACE namespace QtWaylandClient { -#if QT_CONFIG(library) Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader, (QWaylandServerBufferIntegrationFactoryInterface_iid, QLatin1String("/wayland-graphics-integration-client"), Qt::CaseInsensitive)) -Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, directLoader, - (QWaylandServerBufferIntegrationFactoryInterface_iid, QLatin1String(""), Qt::CaseInsensitive)) -#endif -QStringList QWaylandServerBufferIntegrationFactory::keys(const QString &pluginPath) +QStringList QWaylandServerBufferIntegrationFactory::keys() { -#if QT_CONFIG(library) - QStringList list; - if (!pluginPath.isEmpty()) { - QCoreApplication::addLibraryPath(pluginPath); - list = directLoader()->keyMap().values(); - if (!list.isEmpty()) { - const QString postFix = QStringLiteral(" (from ") - + QDir::toNativeSeparators(pluginPath) - + QLatin1Char(')'); - const QStringList::iterator end = list.end(); - for (QStringList::iterator it = list.begin(); it != end; ++it) - (*it).append(postFix); - } - } - list.append(loader()->keyMap().values()); - return list; -#else - return QStringList(); -#endif + return loader->keyMap().values(); } -QWaylandServerBufferIntegration *QWaylandServerBufferIntegrationFactory::create(const QString &name, const QStringList &args, const QString &pluginPath) +QWaylandServerBufferIntegration *QWaylandServerBufferIntegrationFactory::create(const QString &name, const QStringList &args) { -#if QT_CONFIG(library) - // Try loading the plugin from platformPluginPath first: - if (!pluginPath.isEmpty()) { - QCoreApplication::addLibraryPath(pluginPath); - if (QWaylandServerBufferIntegration *ret = qLoadPlugin(directLoader(), name, args)) - return ret; - } - if (QWaylandServerBufferIntegration *ret = qLoadPlugin(loader(), name, args)) - return ret; -#endif - return nullptr; + return qLoadPlugin(loader(), name, args); } } diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationfactory_p.h b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationfactory_p.h index 600c24c9bc3..f2e5820cc24 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationfactory_p.h +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationfactory_p.h @@ -63,8 +63,8 @@ class QWaylandServerBufferIntegration; class Q_WAYLAND_CLIENT_EXPORT QWaylandServerBufferIntegrationFactory { public: - static QStringList keys(const QString &pluginPath = QString()); - static QWaylandServerBufferIntegration *create(const QString &name, const QStringList &args, const QString &pluginPath = QString()); + static QStringList keys(); + static QWaylandServerBufferIntegration *create(const QString &name, const QStringList &args); }; } diff --git a/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationfactory.cpp b/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationfactory.cpp index 8f573064ef1..91ed0726bcc 100644 --- a/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationfactory.cpp +++ b/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationfactory.cpp @@ -48,49 +48,17 @@ QT_BEGIN_NAMESPACE namespace QtWaylandClient { -#if QT_CONFIG(library) Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader, (QWaylandInputDeviceIntegrationFactoryInterface_iid, QLatin1String("/wayland-inputdevice-integration"), Qt::CaseInsensitive)) -Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, directLoader, - (QWaylandInputDeviceIntegrationFactoryInterface_iid, QLatin1String(""), Qt::CaseInsensitive)) -#endif -QStringList QWaylandInputDeviceIntegrationFactory::keys(const QString &pluginPath) +QStringList QWaylandInputDeviceIntegrationFactory::keys() { -#if QT_CONFIG(library) - QStringList list; - if (!pluginPath.isEmpty()) { - QCoreApplication::addLibraryPath(pluginPath); - list = directLoader()->keyMap().values(); - if (!list.isEmpty()) { - const QString postFix = QStringLiteral(" (from ") - + QDir::toNativeSeparators(pluginPath) - + QLatin1Char(')'); - const QStringList::iterator end = list.end(); - for (QStringList::iterator it = list.begin(); it != end; ++it) - (*it).append(postFix); - } - } - list.append(loader()->keyMap().values()); - return list; -#else - return QStringList(); -#endif + return loader->keyMap().values(); } -QWaylandInputDeviceIntegration *QWaylandInputDeviceIntegrationFactory::create(const QString &name, const QStringList &args, const QString &pluginPath) +QWaylandInputDeviceIntegration *QWaylandInputDeviceIntegrationFactory::create(const QString &name, const QStringList &args) { -#if QT_CONFIG(library) - // Try loading the plugin from platformPluginPath first: - if (!pluginPath.isEmpty()) { - QCoreApplication::addLibraryPath(pluginPath); - if (QWaylandInputDeviceIntegration *ret = qLoadPlugin(directLoader(), name, args)) - return ret; - } - if (QWaylandInputDeviceIntegration *ret = qLoadPlugin(loader(), name, args)) - return ret; -#endif - return nullptr; + return qLoadPlugin(loader(), name, args); } } diff --git a/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationfactory_p.h b/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationfactory_p.h index 80096e7900f..776fcf3ee2d 100644 --- a/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationfactory_p.h +++ b/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationfactory_p.h @@ -63,8 +63,8 @@ class QWaylandInputDeviceIntegration; class Q_WAYLAND_CLIENT_EXPORT QWaylandInputDeviceIntegrationFactory { public: - static QStringList keys(const QString &pluginPath = QString()); - static QWaylandInputDeviceIntegration *create(const QString &name, const QStringList &args, const QString &pluginPath = QString()); + static QStringList keys(); + static QWaylandInputDeviceIntegration *create(const QString &name, const QStringList &args); }; } diff --git a/src/plugins/platforms/wayland/qwaylanddecorationfactory.cpp b/src/plugins/platforms/wayland/qwaylanddecorationfactory.cpp index 32db96e581c..49051d53b87 100644 --- a/src/plugins/platforms/wayland/qwaylanddecorationfactory.cpp +++ b/src/plugins/platforms/wayland/qwaylanddecorationfactory.cpp @@ -48,50 +48,17 @@ QT_BEGIN_NAMESPACE namespace QtWaylandClient { -#if QT_CONFIG(library) Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader, (QWaylandDecorationFactoryInterface_iid, QLatin1String("/wayland-decoration-client"), Qt::CaseInsensitive)) -Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, directLoader, - (QWaylandDecorationFactoryInterface_iid, QLatin1String(""), Qt::CaseInsensitive)) -#endif -QStringList QWaylandDecorationFactory::keys(const QString &pluginPath) +QStringList QWaylandDecorationFactory::keys() { -#if QT_CONFIG(library) - QStringList list; - if (!pluginPath.isEmpty()) { - QCoreApplication::addLibraryPath(pluginPath); - list = directLoader()->keyMap().values(); - if (!list.isEmpty()) { - const QString postFix = QStringLiteral(" (from ") - + QDir::toNativeSeparators(pluginPath) - + QLatin1Char(')'); - const QStringList::iterator end = list.end(); - for (QStringList::iterator it = list.begin(); it != end; ++it) - (*it).append(postFix); - } - } - list.append(loader()->keyMap().values()); - return list; -#else - return QStringList(); -#endif + return loader->keyMap().values(); } -QWaylandAbstractDecoration *QWaylandDecorationFactory::create(const QString &name, const QStringList &args, const QString &pluginPath) +QWaylandAbstractDecoration *QWaylandDecorationFactory::create(const QString &name, const QStringList &args) { -#if QT_CONFIG(library) - // Try loading the plugin from platformPluginPath first: - if (!pluginPath.isEmpty()) { - QCoreApplication::addLibraryPath(pluginPath); - if (QWaylandAbstractDecoration *ret = qLoadPlugin(directLoader(), name, args)) - return ret; - } - if (QWaylandAbstractDecoration *ret = qLoadPlugin(loader(), name, args)) - return ret; -#endif - - return nullptr; + return qLoadPlugin(loader(), name, args); } } diff --git a/src/plugins/platforms/wayland/qwaylanddecorationfactory_p.h b/src/plugins/platforms/wayland/qwaylanddecorationfactory_p.h index 606d9b89c2f..98473d48ded 100644 --- a/src/plugins/platforms/wayland/qwaylanddecorationfactory_p.h +++ b/src/plugins/platforms/wayland/qwaylanddecorationfactory_p.h @@ -63,8 +63,8 @@ class QWaylandAbstractDecoration; class Q_WAYLAND_CLIENT_EXPORT QWaylandDecorationFactory { public: - static QStringList keys(const QString &pluginPath = QString()); - static QWaylandAbstractDecoration *create(const QString &name, const QStringList &args, const QString &pluginPath = QString()); + static QStringList keys(); + static QWaylandAbstractDecoration *create(const QString &name, const QStringList &args); }; } diff --git a/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationfactory.cpp b/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationfactory.cpp index 48fda14d41b..e3a9aeb377b 100644 --- a/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationfactory.cpp +++ b/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationfactory.cpp @@ -48,49 +48,18 @@ QT_BEGIN_NAMESPACE namespace QtWaylandClient { -#if QT_CONFIG(library) Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader, (QWaylandShellIntegrationFactoryInterface_iid, QLatin1String("/wayland-shell-integration"), Qt::CaseInsensitive)) -Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, directLoader, - (QWaylandShellIntegrationFactoryInterface_iid, QLatin1String(""), Qt::CaseInsensitive)) -#endif -QStringList QWaylandShellIntegrationFactory::keys(const QString &pluginPath) +QStringList QWaylandShellIntegrationFactory::keys() { -#if QT_CONFIG(library) - QStringList list; - if (!pluginPath.isEmpty()) { - QCoreApplication::addLibraryPath(pluginPath); - list = directLoader()->keyMap().values(); - if (!list.isEmpty()) { - const QString postFix = QStringLiteral(" (from ") - + QDir::toNativeSeparators(pluginPath) - + QLatin1Char(')'); - const QStringList::iterator end = list.end(); - for (QStringList::iterator it = list.begin(); it != end; ++it) - (*it).append(postFix); - } - } - list.append(loader()->keyMap().values()); - return list; -#else - return QStringList(); -#endif + return loader->keyMap().values(); } -QWaylandShellIntegration *QWaylandShellIntegrationFactory::create(const QString &name, QWaylandDisplay *display, const QStringList &args, const QString &pluginPath) +QWaylandShellIntegration *QWaylandShellIntegrationFactory::create(const QString &name, QWaylandDisplay *display, const QStringList &args) { -#if QT_CONFIG(library) QScopedPointer integration; - - // Try loading the plugin from platformPluginPath first: - if (!pluginPath.isEmpty()) { - QCoreApplication::addLibraryPath(pluginPath); - integration.reset(qLoadPlugin(directLoader(), name, args)); - } - if (!integration) - integration.reset(qLoadPlugin(loader(), name, args)); -#endif + integration.reset(qLoadPlugin(loader(), name, args)); if (integration && !integration->initialize(display)) return nullptr; diff --git a/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationfactory_p.h b/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationfactory_p.h index 515a18e1f1c..0268dba48bc 100644 --- a/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationfactory_p.h +++ b/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationfactory_p.h @@ -66,8 +66,8 @@ class QWaylandShellIntegration; class Q_WAYLAND_CLIENT_EXPORT QWaylandShellIntegrationFactory { public: - static QStringList keys(const QString &pluginPath = QString()); - static QWaylandShellIntegration *create(const QString &name, QWaylandDisplay *display, const QStringList &args = QStringList(), const QString &pluginPath = QString()); + static QStringList keys(); + static QWaylandShellIntegration *create(const QString &name, QWaylandDisplay *display, const QStringList &args = QStringList()); }; } From 06f069bed8fb97aacf86fea0a2881935e6740570 Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Sat, 11 Sep 2021 16:02:43 +0100 Subject: [PATCH 1018/1507] Client: Upgrade Seat support to v7 - Finish implementing support for axis_wheel_tilt. Some code existed already, hence only debug and unit test are changed - The unit test is renamed to seat as the only change is new events. There is nothing deprecated and therefore no need to test backwards compatibility. - Set our supported version number to 7 No version bumps of libwayland are needed, our current minimum version includes wl_seat v7. Task-number: QTBUG-96258 Change-Id: Ief18bc5cef3fcbd0699dd52ccad513d47c6c010b Reviewed-by: Paul Olav Tvete Reviewed-by: Qt CI Bot --- .../platforms/wayland/qwaylandinputdevice.cpp | 4 +- tests/auto/wayland/CMakeLists.txt | 2 +- .../wayland/datadevicev1/tst_datadevicev1.cpp | 3 - .../tst_primaryselectionv1.cpp | 3 - .../wayland/{seatv5 => seat}/CMakeLists.txt | 4 +- .../tst_seatv5.cpp => seat/tst_seat.cpp} | 63 +++++++++++-------- tests/auto/wayland/shared/coreprotocol.h | 2 +- 7 files changed, 44 insertions(+), 37 deletions(-) rename tests/auto/wayland/{seatv5 => seat}/CMakeLists.txt (82%) rename tests/auto/wayland/{seatv5/tst_seatv5.cpp => seat/tst_seat.cpp} (95%) diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index 7f503ee1e24..3e59899de92 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -408,7 +408,7 @@ QWaylandInputDevice::Touch::~Touch() } QWaylandInputDevice::QWaylandInputDevice(QWaylandDisplay *display, int version, uint32_t id) - : QtWayland::wl_seat(display->wl_registry(), id, qMin(version, 5)) + : QtWayland::wl_seat(display->wl_registry(), id, qMin(version, 7)) , mQDisplay(display) , mDisplay(display->wl_display()) { @@ -955,6 +955,8 @@ void QWaylandInputDevice::Pointer::pointer_axis_source(uint32_t source) case axis_source_continuous: qCDebug(lcQpaWaylandInput) << "Axis source continuous"; break; + case axis_source_wheel_tilt: + qCDebug(lcQpaWaylandInput) << "Axis source wheel tilt"; } mFrameData.axisSource = axis_source(source); } diff --git a/tests/auto/wayland/CMakeLists.txt b/tests/auto/wayland/CMakeLists.txt index 167cc6070c5..accac45fa2c 100644 --- a/tests/auto/wayland/CMakeLists.txt +++ b/tests/auto/wayland/CMakeLists.txt @@ -11,7 +11,7 @@ add_subdirectory(nooutput) add_subdirectory(output) add_subdirectory(primaryselectionv1) add_subdirectory(seatv4) -add_subdirectory(seatv5) +add_subdirectory(seat) add_subdirectory(surface) add_subdirectory(tabletv2) add_subdirectory(wl_connect) diff --git a/tests/auto/wayland/datadevicev1/tst_datadevicev1.cpp b/tests/auto/wayland/datadevicev1/tst_datadevicev1.cpp index 91a479e28d3..4dbeb7db4a6 100644 --- a/tests/auto/wayland/datadevicev1/tst_datadevicev1.cpp +++ b/tests/auto/wayland/datadevicev1/tst_datadevicev1.cpp @@ -66,9 +66,6 @@ private slots: void tst_datadevicev1::initTestCase() { QCOMPOSITOR_TRY_VERIFY(pointer()); - QCOMPOSITOR_TRY_VERIFY(!pointer()->resourceMap().empty()); - QCOMPOSITOR_TRY_COMPARE(pointer()->resourceMap().first()->version(), 5); - QCOMPOSITOR_TRY_VERIFY(keyboard()); QCOMPOSITOR_TRY_VERIFY(dataDevice()); diff --git a/tests/auto/wayland/primaryselectionv1/tst_primaryselectionv1.cpp b/tests/auto/wayland/primaryselectionv1/tst_primaryselectionv1.cpp index f7a63d13ec6..0f0c16102f1 100644 --- a/tests/auto/wayland/primaryselectionv1/tst_primaryselectionv1.cpp +++ b/tests/auto/wayland/primaryselectionv1/tst_primaryselectionv1.cpp @@ -268,9 +268,6 @@ private slots: void tst_primaryselectionv1::initTestCase() { QCOMPOSITOR_TRY_VERIFY(pointer()); - QCOMPOSITOR_TRY_VERIFY(!pointer()->resourceMap().empty()); - QCOMPOSITOR_TRY_COMPARE(pointer()->resourceMap().first()->version(), 5); - QCOMPOSITOR_TRY_VERIFY(keyboard()); } diff --git a/tests/auto/wayland/seatv5/CMakeLists.txt b/tests/auto/wayland/seat/CMakeLists.txt similarity index 82% rename from tests/auto/wayland/seatv5/CMakeLists.txt rename to tests/auto/wayland/seat/CMakeLists.txt index f48d8613787..fe59acee068 100644 --- a/tests/auto/wayland/seatv5/CMakeLists.txt +++ b/tests/auto/wayland/seat/CMakeLists.txt @@ -4,9 +4,9 @@ ## tst_seatv5 Test: ##################################################################### -qt_internal_add_test(tst_seatv5 +qt_internal_add_test(tst_seat SOURCES - tst_seatv5.cpp + tst_seat.cpp PUBLIC_LIBRARIES SharedClientTest ) diff --git a/tests/auto/wayland/seatv5/tst_seatv5.cpp b/tests/auto/wayland/seat/tst_seat.cpp similarity index 95% rename from tests/auto/wayland/seatv5/tst_seatv5.cpp rename to tests/auto/wayland/seat/tst_seat.cpp index 7e59dbddd9f..b8405eb6f58 100644 --- a/tests/auto/wayland/seatv5/tst_seatv5.cpp +++ b/tests/auto/wayland/seat/tst_seat.cpp @@ -33,9 +33,9 @@ using namespace MockCompositor; -class SeatV5Compositor : public DefaultCompositor { +class SeatCompositor : public DefaultCompositor { public: - explicit SeatV5Compositor() + explicit SeatCompositor() { exec([this] { m_config.autoConfigure = true; @@ -43,13 +43,13 @@ public: removeAll(); uint capabilities = MockCompositor::Seat::capability_pointer | MockCompositor::Seat::capability_touch; - int version = 5; + int version = 7; add(capabilities, version); }); } }; -class tst_seatv5 : public QObject, private SeatV5Compositor +class tst_seat : public QObject, private SeatCompositor { Q_OBJECT private slots: @@ -65,6 +65,7 @@ private slots: void fingerScroll(); void fingerScrollSlow(); void continuousScroll(); + void wheelDiscreteScroll_data(); void wheelDiscreteScroll(); // Touch tests @@ -76,19 +77,19 @@ private slots: void tapAndMoveInSameFrame(); }; -void tst_seatv5::bindsToSeat() +void tst_seat::bindsToSeat() { QCOMPOSITOR_COMPARE(get()->resourceMap().size(), 1); - QCOMPOSITOR_COMPARE(get()->resourceMap().first()->version(), 5); + QCOMPOSITOR_COMPARE(get()->resourceMap().first()->version(), 7); } -void tst_seatv5::createsPointer() +void tst_seat::createsPointer() { QCOMPOSITOR_TRY_COMPARE(pointer()->resourceMap().size(), 1); - QCOMPOSITOR_TRY_COMPARE(pointer()->resourceMap().first()->version(), 5); + QCOMPOSITOR_TRY_COMPARE(pointer()->resourceMap().first()->version(), 7); } -void tst_seatv5::setsCursorOnEnter() +void tst_seat::setsCursorOnEnter() { QRasterWindow window; window.resize(64, 64); @@ -104,7 +105,7 @@ void tst_seatv5::setsCursorOnEnter() QCOMPOSITOR_TRY_VERIFY(pointer()->cursorSurface()); } -void tst_seatv5::usesEnterSerial() +void tst_seat::usesEnterSerial() { QSignalSpy setCursorSpy(exec([=] { return pointer(); }), &Pointer::setCursor); QRasterWindow window; @@ -166,7 +167,7 @@ public: QList m_events; }; -void tst_seatv5::simpleAxis_data() +void tst_seat::simpleAxis_data() { QTest::addColumn("axis"); QTest::addColumn("value"); @@ -180,7 +181,7 @@ void tst_seatv5::simpleAxis_data() QTest::newRow("up big") << uint(Pointer::axis_vertical_scroll) << -10.0 << QPoint{0, 120}; } -void tst_seatv5::simpleAxis() +void tst_seat::simpleAxis() { QFETCH(uint, axis); QFETCH(qreal, value); @@ -216,7 +217,7 @@ void tst_seatv5::simpleAxis() // Sending axis_stop is not mandatory when axis source != finger } -void tst_seatv5::fingerScroll() +void tst_seat::fingerScroll() { WheelWindow window; QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial); @@ -313,7 +314,7 @@ void tst_seatv5::fingerScroll() } -void tst_seatv5::fingerScrollSlow() +void tst_seat::fingerScrollSlow() { WheelWindow window; QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial); @@ -342,17 +343,27 @@ void tst_seatv5::fingerScrollSlow() } QCOMPARE(accumulated.y(), -1); } -void tst_seatv5::wheelDiscreteScroll() + +void tst_seat::wheelDiscreteScroll_data() +{ + QTest::addColumn("source"); + QTest::newRow("wheel") << uint(Pointer::axis_source_wheel); + QTest::newRow("wheel tilt") << uint(Pointer::axis_source_wheel_tilt); +} + +void tst_seat::wheelDiscreteScroll() { WheelWindow window; QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial); + QFETCH(uint, source); + exec([=] { auto *p = pointer(); auto *c = client(); p->sendEnter(xdgToplevel()->surface(), {32, 32}); p->sendFrame(c); - p->sendAxisSource(c, Pointer::axis_source_wheel); + p->sendAxisSource(c, Pointer::axis_source(source)); p->sendAxisDiscrete(c, Pointer::axis_vertical_scroll, 1); // 1 click downwards p->sendAxis(c, Pointer::axis_vertical_scroll, 1.0); p->sendFrame(c); @@ -372,7 +383,7 @@ void tst_seatv5::wheelDiscreteScroll() } } -void tst_seatv5::continuousScroll() +void tst_seat::continuousScroll() { WheelWindow window; QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial); @@ -398,10 +409,10 @@ void tst_seatv5::continuousScroll() // Sending axis_stop is not mandatory when axis source != finger } -void tst_seatv5::createsTouch() +void tst_seat::createsTouch() { QCOMPOSITOR_TRY_COMPARE(touch()->resourceMap().size(), 1); - QCOMPOSITOR_TRY_COMPARE(touch()->resourceMap().first()->version(), 5); + QCOMPOSITOR_TRY_COMPARE(touch()->resourceMap().first()->version(), 7); } class TouchWindow : public QRasterWindow { @@ -432,7 +443,7 @@ public: QList m_events; }; -void tst_seatv5::singleTap() +void tst_seat::singleTap() { TouchWindow window; QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial); @@ -463,7 +474,7 @@ void tst_seatv5::singleTap() } } -void tst_seatv5::singleTapFloat() +void tst_seat::singleTapFloat() { TouchWindow window; QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial); @@ -494,7 +505,7 @@ void tst_seatv5::singleTapFloat() } } -void tst_seatv5::multiTouch() +void tst_seat::multiTouch() { TouchWindow window; QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial); @@ -566,7 +577,7 @@ void tst_seatv5::multiTouch() } } -void tst_seatv5::multiTouchUpAndMotionFrame() +void tst_seat::multiTouchUpAndMotionFrame() { TouchWindow window; QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial); @@ -615,7 +626,7 @@ void tst_seatv5::multiTouchUpAndMotionFrame() QVERIFY(window.m_events.empty()); } -void tst_seatv5::tapAndMoveInSameFrame() +void tst_seat::tapAndMoveInSameFrame() { TouchWindow window; QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial); @@ -647,5 +658,5 @@ void tst_seatv5::tapAndMoveInSameFrame() QTRY_COMPARE(window.m_events.last().touchPoints.first().state(), QEventPoint::State::Released); } -QCOMPOSITOR_TEST_MAIN(tst_seatv5) -#include "tst_seatv5.moc" +QCOMPOSITOR_TEST_MAIN(tst_seat) +#include "tst_seat.moc" diff --git a/tests/auto/wayland/shared/coreprotocol.h b/tests/auto/wayland/shared/coreprotocol.h index e575444cb44..94481b41f54 100644 --- a/tests/auto/wayland/shared/coreprotocol.h +++ b/tests/auto/wayland/shared/coreprotocol.h @@ -321,7 +321,7 @@ class Seat : public Global, public QtWaylandServer::wl_seat { Q_OBJECT public: - explicit Seat(CoreCompositor *compositor, uint capabilities = Seat::capability_pointer | Seat::capability_keyboard | Seat::capability_touch, int version = 5); + explicit Seat(CoreCompositor *compositor, uint capabilities = Seat::capability_pointer | Seat::capability_keyboard | Seat::capability_touch, int version = 7); ~Seat() override; void send_capabilities(Resource *resource, uint capabilities) = delete; // Use wrapper instead void send_capabilities(uint capabilities) = delete; // Use wrapper instead From caded7fb858392dc1347fac05bc3f8e0999ef334 Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Thu, 2 Dec 2021 20:21:46 +0200 Subject: [PATCH 1019/1507] Client: Make xdg_output.name required only if it's supported The xdg_output.name property is available only since version 2. Fixes: QTBUG-98010 Pick-to: 6.2 Change-Id: I1051b8e9d99fe27f0170ea202deac9cdad9818ae Reviewed-by: Liang Qi Reviewed-by: David Edmundson --- src/plugins/platforms/wayland/qwaylandscreen.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandscreen.cpp b/src/plugins/platforms/wayland/qwaylandscreen.cpp index 293e8e800a2..eba74fad3ef 100644 --- a/src/plugins/platforms/wayland/qwaylandscreen.cpp +++ b/src/plugins/platforms/wayland/qwaylandscreen.cpp @@ -87,7 +87,8 @@ uint QWaylandScreen::requiredEvents() const uint ret = OutputDoneEvent; if (mWaylandDisplay->xdgOutputManager()) { - ret |= XdgOutputNameEvent; + if (mWaylandDisplay->xdgOutputManager()->version() >= 2) + ret |= XdgOutputNameEvent; if (mWaylandDisplay->xdgOutputManager()->version() < 3) ret |= XdgOutputDoneEvent; From 2bd5d5f2bedbcf396e9fc2fb524f494cc1af4d26 Mon Sep 17 00:00:00 2001 From: Inho Lee Date: Thu, 23 Sep 2021 19:59:08 +0200 Subject: [PATCH 1020/1507] Use a correct serial for xdg_surface.ack_configure Previous pendingConfigureSerial can be overwritten regardless of the current configuration. With this patch, the client surface can use correct serial for xdg_surface.ack_configure. Fixes: QTBUG-95962 Pick-to: 6.2 6.1 6.0 5.15 Change-Id: I849d2daf4acc8ef6e7f8528af9c5a57f671f43e6 Reviewed-by: Eskil Abrahamsen Blomfeldt --- .../shellintegration/xdg-shell/qwaylandxdgshell.cpp | 9 +++++---- .../shellintegration/xdg-shell/qwaylandxdgshell_p.h | 1 + 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp index afb2e3b27a3..8378cf9f293 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp @@ -342,15 +342,16 @@ bool QWaylandXdgSurface::handleExpose(const QRegion ®ion) void QWaylandXdgSurface::applyConfigure() { - Q_ASSERT(m_pendingConfigureSerial != 0); + // It is a redundant ack_configure, so skipped. + if (m_pendingConfigureSerial == m_appliedConfigureSerial) + return; if (m_toplevel) m_toplevel->applyConfigure(); + m_appliedConfigureSerial = m_pendingConfigureSerial; m_configured = true; - ack_configure(m_pendingConfigureSerial); - - m_pendingConfigureSerial = 0; + ack_configure(m_appliedConfigureSerial); } bool QWaylandXdgSurface::wantsDecorations() const diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h index e3a90c547e9..b504a24d871 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h @@ -156,6 +156,7 @@ private: bool m_configured = false; QRegion m_exposeRegion; uint m_pendingConfigureSerial = 0; + uint m_appliedConfigureSerial = 0; friend class QWaylandXdgShell; }; From d89d826bb2fab47a899635fca1231731a21fd682 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Tue, 9 Nov 2021 14:34:06 +0100 Subject: [PATCH 1021/1507] Remove the XComposite buffer sharing extension These extensions were disabled because they did not work properly and they are no longer very useful. It does not make sense to keep non-functional code around when it is unlikely to be fixed. [ChangeLog][Extensions][The xcomposite-egl and xcomposite-glx shell extension protocols have been removed.] Task-number: QTBUG-97985 Change-Id: I0ad37bd2b35551d7b2b1e5e7d4e77a51037864ad Reviewed-by: Eskil Abrahamsen Blomfeldt --- .../wayland/extensions/xcomposite.xml | 61 ----------------- src/platformsupport/wayland/configure.cmake | 20 ------ .../hardwareintegration/CMakeLists.txt | 6 -- .../xcomposite-egl/CMakeLists.txt | 37 ----------- .../xcomposite-egl/main.cpp | 66 ------------------- .../xcomposite-egl/xcomposite-egl.json | 3 - .../xcomposite-glx/CMakeLists.txt | 35 ---------- .../xcomposite-glx/main.cpp | 66 ------------------- .../xcomposite-glx/xcomposite-glx.json | 3 - .../Qt6WaylandClientMacros.cmake | 9 +-- 10 files changed, 1 insertion(+), 305 deletions(-) delete mode 100644 src/3rdparty/wayland/extensions/xcomposite.xml delete mode 100644 src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-egl/CMakeLists.txt delete mode 100644 src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-egl/main.cpp delete mode 100644 src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-egl/xcomposite-egl.json delete mode 100644 src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-glx/CMakeLists.txt delete mode 100644 src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-glx/main.cpp delete mode 100644 src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-glx/xcomposite-glx.json diff --git a/src/3rdparty/wayland/extensions/xcomposite.xml b/src/3rdparty/wayland/extensions/xcomposite.xml deleted file mode 100644 index 44ecdd27c8c..00000000000 --- a/src/3rdparty/wayland/extensions/xcomposite.xml +++ /dev/null @@ -1,61 +0,0 @@ - - - - - Copyright (C) 2015 The Qt Company Ltd. - Contact: http://www.qt.io/licensing/ - - This file is part of the plugins of the Qt Toolkit. - - $QT_BEGIN_LICENSE:BSD$ - You may use this file under the terms of the BSD license as follows: - - "Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are - met: - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in - the documentation and/or other materials provided with the - distribution. - * Neither the name of The Qt Company Ltd nor the names of its - contributors may be used to endorse or promote products derived - from this software without specific prior written permission. - - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." - - $QT_END_LICENSE$ - - - - - - - - - - - - - - - - - - - - diff --git a/src/platformsupport/wayland/configure.cmake b/src/platformsupport/wayland/configure.cmake index ce7fcf59187..1c1cf1e883f 100644 --- a/src/platformsupport/wayland/configure.cmake +++ b/src/platformsupport/wayland/configure.cmake @@ -22,9 +22,6 @@ if(LINUX OR QT_FIND_ALL_PACKAGES_ALWAYS) PROVIDED_TARGETS Wayland::Egl MODULE_NAME waylandclient QMAKE_LIB wayland-egl) - qt_find_package(XComposite - PROVIDED_TARGETS PkgConfig::XComposite - MODULE_NAME waylandclient QMAKE_LIB xcomposite) # waylandcompositor libraries qt_find_package(Wayland @@ -35,9 +32,6 @@ if(LINUX OR QT_FIND_ALL_PACKAGES_ALWAYS) PROVIDED_TARGETS Wayland::Egl MODULE_NAME waylandcompositor QMAKE_LIB wayland-egl) - qt_find_package(XComposite - PROVIDED_TARGETS PkgConfig::XComposite - MODULE_NAME waylandcompositor QMAKE_LIB xcomposite) # X11 is not a public dependency of QtGui anymore, so we need to find it manually in a shared build. # In a static build the dependency is still propagated, so check for the target existence to prevent @@ -222,18 +216,6 @@ qt_feature("wayland-vulkan-server-buffer" PRIVATE qt_feature("wayland-datadevice" PRIVATE CONDITION QT_FEATURE_draganddrop OR QT_FEATURE_clipboard ) -qt_feature("xcomposite-egl" PRIVATE - LABEL "XComposite EGL" - CONDITION FALSE AND (QT_FEATURE_wayland_client OR QT_FEATURE_wayland_server) - AND QT_FEATURE_opengl AND QT_FEATURE_egl AND QT_FEATURE_xlib - AND XComposite_FOUND AND QT_FEATURE_egl_x11 -) -qt_feature("xcomposite-glx" PRIVATE - LABEL "XComposite GLX" - CONDITION FALSE AND (QT_FEATURE_wayland_client OR QT_FEATURE_wayland_server) - AND QT_FEATURE_opengl AND NOT QT_FEATURE_opengles2 - AND QT_FEATURE_xlib AND XComposite_FOUND -) qt_feature("wayland-text-input-v4-wip" PRIVATE LABEL "Qt Wayland TextInput Protocol V4(WIP)" PURPOSE "Enables wayland_text_input_unstable_v4(wip)" @@ -250,6 +232,4 @@ qt_configure_add_summary_entry(ARGS "wayland-libhybris-egl-server-buffer") qt_configure_add_summary_entry(ARGS "wayland-dmabuf-server-buffer") qt_configure_add_summary_entry(ARGS "wayland-shm-emulation-server-buffer") qt_configure_add_summary_entry(ARGS "wayland-vulkan-server-buffer") -qt_configure_add_summary_entry(ARGS "xcomposite-egl") -qt_configure_add_summary_entry(ARGS "xcomposite-glx") qt_configure_end_summary_section() # end of "Qt Wayland Drivers" section diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/hardwareintegration/CMakeLists.txt index 32493e4bcb4..e86b6460d1f 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/CMakeLists.txt +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/CMakeLists.txt @@ -6,12 +6,6 @@ endif() if(QT_FEATURE_wayland_brcm) add_subdirectory(brcm-egl) endif() -if(QT_FEATURE_xcomposite_egl) - add_subdirectory(xcomposite-egl) -endif() -if(QT_FEATURE_xcomposite_glx) - add_subdirectory(xcomposite-glx) -endif() if(QT_FEATURE_wayland_drm_egl_server_buffer) add_subdirectory(drm-egl-server) endif() diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-egl/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-egl/CMakeLists.txt deleted file mode 100644 index fe546d7d12e..00000000000 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-egl/CMakeLists.txt +++ /dev/null @@ -1,37 +0,0 @@ -# Generated from xcomposite-egl.pro. - -##################################################################### -## QWaylandXCompositeEglClientBufferPlugin Plugin: -##################################################################### -qt_find_package(EGL) # special case - -qt_internal_add_plugin(QWaylandXCompositeEglClientBufferPlugin - OUTPUT_NAME xcomposite-egl - PLUGIN_TYPE wayland-graphics-integration-client - SOURCES - ../../../../hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglclientbufferintegration.cpp ../../../../hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglclientbufferintegration.h - ../../../../hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglcontext.cpp ../../../../hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglcontext.h - ../../../../hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglwindow.cpp ../../../../hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglwindow.h - ../../../../hardwareintegration/client/xcomposite_share/qwaylandxcompositebuffer.cpp ../../../../hardwareintegration/client/xcomposite_share/qwaylandxcompositebuffer.h - main.cpp - INCLUDE_DIRECTORIES - ../../../../hardwareintegration/client/xcomposite-egl - ../../../../hardwareintegration/client/xcomposite_share - LIBRARIES - EGL::EGL - PkgConfig::XComposite - Qt::Core - Qt::Gui - Qt::WaylandClientPrivate - Wayland::Client - X11::X11 -) - -qt6_generate_wayland_protocol_client_sources(QWaylandXCompositeEglClientBufferPlugin - FILES - ${CMAKE_CURRENT_SOURCE_DIR}/../../../../hardwareintegration/client/xcomposite_share/../../../extensions/xcomposite.xml -) - -#### Keys ignored in scope 1:.:.:xcomposite-egl.pro:: -# OTHER_FILES = "xcomposite-egl.json" -# QMAKE_CXXFLAGS_WARN_ON = "--Wcast-qual" diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-egl/main.cpp b/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-egl/main.cpp deleted file mode 100644 index 585285fae05..00000000000 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-egl/main.cpp +++ /dev/null @@ -1,66 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include "qwaylandxcompositeeglclientbufferintegration.h" - -QT_BEGIN_NAMESPACE - -namespace QtWaylandClient { - -class QWaylandXCompositeEglClientBufferPlugin : public QWaylandClientBufferIntegrationPlugin -{ - Q_OBJECT - Q_PLUGIN_METADATA(IID QWaylandClientBufferIntegrationFactoryInterface_iid FILE "xcomposite-egl.json") -public: - QWaylandClientBufferIntegration *create(const QString&, const QStringList&) override; -}; - -QWaylandClientBufferIntegration *QWaylandXCompositeEglClientBufferPlugin::create(const QString& system, const QStringList& paramList) -{ - Q_UNUSED(paramList); - Q_UNUSED(system); - return new QWaylandXCompositeEGLClientBufferIntegration(); -} - -} - -QT_END_NAMESPACE - -#include "main.moc" diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-egl/xcomposite-egl.json b/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-egl/xcomposite-egl.json deleted file mode 100644 index 0d119ff852a..00000000000 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-egl/xcomposite-egl.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "Keys": [ "xcomposite-egl" ] -} diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-glx/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-glx/CMakeLists.txt deleted file mode 100644 index b4d7340b8a3..00000000000 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-glx/CMakeLists.txt +++ /dev/null @@ -1,35 +0,0 @@ -# Generated from xcomposite-glx.pro. - -##################################################################### -## QWaylandXCompositeGlxClientBufferPlugin Plugin: -##################################################################### - -qt_internal_add_plugin(QWaylandXCompositeGlxClientBufferPlugin - OUTPUT_NAME xcomposite-glx - PLUGIN_TYPE wayland-graphics-integration-client - SOURCES - ../../../../hardwareintegration/client/xcomposite-glx/qwaylandxcompositeglxcontext.cpp ../../../../hardwareintegration/client/xcomposite-glx/qwaylandxcompositeglxcontext.h - ../../../../hardwareintegration/client/xcomposite-glx/qwaylandxcompositeglxintegration.cpp ../../../../hardwareintegration/client/xcomposite-glx/qwaylandxcompositeglxintegration.h - ../../../../hardwareintegration/client/xcomposite-glx/qwaylandxcompositeglxwindow.cpp ../../../../hardwareintegration/client/xcomposite-glx/qwaylandxcompositeglxwindow.h - ../../../../hardwareintegration/client/xcomposite_share/qwaylandxcompositebuffer.cpp ../../../../hardwareintegration/client/xcomposite_share/qwaylandxcompositebuffer.h - main.cpp - INCLUDE_DIRECTORIES - ../../../../hardwareintegration/client/xcomposite-glx - ../../../../hardwareintegration/client/xcomposite_share - LIBRARIES - ${CMAKE_DL_LIBS} - PkgConfig::XComposite - Qt::Core - Qt::Gui - Qt::WaylandClientPrivate - Wayland::Client - X11::X11 -) - -qt6_generate_wayland_protocol_client_sources(QWaylandXCompositeGlxClientBufferPlugin - FILES - ${CMAKE_CURRENT_SOURCE_DIR}/../../../../hardwareintegration/client/xcomposite_share/../../../extensions/xcomposite.xml -) - -#### Keys ignored in scope 1:.:.:xcomposite-glx.pro:: -# OTHER_FILES = "xcomposite-glx.json" diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-glx/main.cpp b/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-glx/main.cpp deleted file mode 100644 index f7b878d96c2..00000000000 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-glx/main.cpp +++ /dev/null @@ -1,66 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include "qwaylandxcompositeglxintegration.h" - -QT_BEGIN_NAMESPACE - -namespace QtWaylandClient { - -class QWaylandXCompositeGlxClientBufferPlugin : public QWaylandClientBufferIntegrationPlugin -{ - Q_OBJECT - Q_PLUGIN_METADATA(IID QWaylandClientBufferIntegrationFactoryInterface_iid FILE "xcomposite-glx.json") -public: - QWaylandClientBufferIntegration *create(const QString&, const QStringList&) override; -}; - -QWaylandClientBufferIntegration *QWaylandXCompositeGlxClientBufferPlugin::create(const QString& system, const QStringList& paramList) -{ - Q_UNUSED(paramList); - Q_UNUSED(system); - return new QWaylandXCompositeGLXIntegration(); -} - -} - -QT_END_NAMESPACE - -#include "main.moc" diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-glx/xcomposite-glx.json b/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-glx/xcomposite-glx.json deleted file mode 100644 index e2c4cecd6af..00000000000 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/xcomposite-glx/xcomposite-glx.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "Keys": [ "xcomposite-glx" ] -} diff --git a/src/tools/qtwaylandscanner/Qt6WaylandClientMacros.cmake b/src/tools/qtwaylandscanner/Qt6WaylandClientMacros.cmake index c810325955e..568c33494b8 100644 --- a/src/tools/qtwaylandscanner/Qt6WaylandClientMacros.cmake +++ b/src/tools/qtwaylandscanner/Qt6WaylandClientMacros.cmake @@ -53,15 +53,8 @@ function(qt6_generate_wayland_protocol_client_sources target) DEPENDS ${protocol_file} Qt6::qtwaylandscanner ) - # TODO: We need this hack in order to get the xcomposite plugins to build... - # unfortunately, it's not going to work outside QtWayland because we're using waylandclient-private includes set(qtwaylandscanner_code_include "") - set (targets_that_need_include - "QWaylandXCompositeEglClientBufferPlugin" - "QWaylandXCompositeGlxClientBufferPlugin" - "QWaylandXCompositeEglPlatformIntegrationPlugin" - "QWaylandXCompositeGlxPlatformIntegrationPlugin") - if ("${target}" IN_LIST targets_that_need_include OR is_for_module) + if (is_for_module) set(qtwaylandscanner_code_include "") endif() From 30fecf220d1188e5b7227ba13802eb98946a4b78 Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Tue, 16 Feb 2021 09:51:47 +0000 Subject: [PATCH 1022/1507] Client: Implement DataDeviceV3 DataDeviceV2 fixes a leak of DataDevice resources. DataDeviceV3 brings multiple improvements: Action negotiation. The source announces which actions are supported, the target then announces which subset of those action the target supports and a preferred action. After negotiation both the source and target are notified of which action is to be performed. Drag sources are now notified when contents are dropped and when a client has finished with the drag and drop operation. A good test is the draggableicons example in QtBase. Change-Id: I55e9759ca5a2e4218d02d863144a64ade53ef764 Reviewed-by: Eskil Abrahamsen Blomfeldt --- .../platforms/wayland/qwaylanddatadevice.cpp | 84 ++++++++++++++----- .../platforms/wayland/qwaylanddatadevice_p.h | 8 +- .../wayland/qwaylanddatadevicemanager.cpp | 4 +- .../wayland/qwaylanddatadevicemanager_p.h | 2 +- .../platforms/wayland/qwaylanddataoffer.cpp | 25 ++++++ .../platforms/wayland/qwaylanddataoffer_p.h | 4 + .../platforms/wayland/qwaylanddatasource.cpp | 27 +++++- .../platforms/wayland/qwaylanddatasource_p.h | 10 ++- .../platforms/wayland/qwaylanddisplay.cpp | 2 +- src/plugins/platforms/wayland/qwaylanddnd.cpp | 24 +++--- src/plugins/platforms/wayland/qwaylanddnd_p.h | 7 +- .../wayland/datadevicev1/tst_datadevicev1.cpp | 2 +- 12 files changed, 153 insertions(+), 46 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylanddatadevice.cpp b/src/plugins/platforms/wayland/qwaylanddatadevice.cpp index 8f1ba579587..7b90284ce01 100644 --- a/src/plugins/platforms/wayland/qwaylanddatadevice.cpp +++ b/src/plugins/platforms/wayland/qwaylanddatadevice.cpp @@ -73,6 +73,8 @@ QWaylandDataDevice::QWaylandDataDevice(QWaylandDataDeviceManager *manager, QWayl QWaylandDataDevice::~QWaylandDataDevice() { + if (version() >= WL_DATA_DEVICE_RELEASE_SINCE_VERSION) + release(); } QWaylandDataOffer *QWaylandDataDevice::selectionOffer() const @@ -111,7 +113,7 @@ QWaylandDataOffer *QWaylandDataDevice::dragOffer() const return m_dragOffer.data(); } -bool QWaylandDataDevice::startDrag(QMimeData *mimeData, QWaylandWindow *icon) +bool QWaylandDataDevice::startDrag(QMimeData *mimeData, Qt::DropActions supportedActions, QWaylandWindow *icon) { auto *seat = m_display->currentInputDevice(); auto *origin = seat->pointerFocus(); @@ -124,8 +126,28 @@ bool QWaylandDataDevice::startDrag(QMimeData *mimeData, QWaylandWindow *icon) } m_dragSource.reset(new QWaylandDataSource(m_display->dndSelectionHandler(), mimeData)); + + if (version() >= 3) + m_dragSource->set_actions(dropActionsToWl(supportedActions)); + connect(m_dragSource.data(), &QWaylandDataSource::cancelled, this, &QWaylandDataDevice::dragSourceCancelled); - connect(m_dragSource.data(), &QWaylandDataSource::targetChanged, this, &QWaylandDataDevice::dragSourceTargetChanged); + connect(m_dragSource.data(), &QWaylandDataSource::dndResponseUpdated, this, [this](bool accepted, Qt::DropAction action) { + auto drag = static_cast(QGuiApplicationPrivate::platformIntegration()->drag()); + // in old versions drop action is not set, so we guess + if (m_dragSource->version() < 3) { + drag->setResponse(accepted); + } else { + QPlatformDropQtResponse response(accepted, action); + drag->setResponse(response); + } + }); + connect(m_dragSource.data(), &QWaylandDataSource::dndDropped, this, [](bool accepted, Qt::DropAction action) { + QPlatformDropQtResponse response(accepted, action); + static_cast(QGuiApplicationPrivate::platformIntegration()->drag())->setDropResponse(response); + }); + connect(m_dragSource.data(), &QWaylandDataSource::finished, this, []() { + static_cast(QGuiApplicationPrivate::platformIntegration()->drag())->finishDrag(); + }); start_drag(m_dragSource->object(), origin->wlSurface(), icon->wlSurface(), m_display->currentInputDevice()->serial()); return true; @@ -154,7 +176,7 @@ void QWaylandDataDevice::data_device_drop() supportedActions = drag->supportedActions(); } else if (m_dragOffer) { dragData = m_dragOffer->mimeData(); - supportedActions = Qt::CopyAction | Qt::MoveAction | Qt::LinkAction; + supportedActions = m_dragOffer->supportedActions(); } else { return; } @@ -164,7 +186,11 @@ void QWaylandDataDevice::data_device_drop() QGuiApplication::keyboardModifiers()); if (drag) { - static_cast(QGuiApplicationPrivate::platformIntegration()->drag())->finishDrag(response); + auto drag = static_cast(QGuiApplicationPrivate::platformIntegration()->drag()); + drag->setDropResponse(response); + drag->finishDrag(); + } else if (m_dragOffer) { + m_dragOffer->finish(); } } @@ -188,7 +214,7 @@ void QWaylandDataDevice::data_device_enter(uint32_t serial, wl_surface *surface, supportedActions = drag->supportedActions(); } else if (m_dragOffer) { dragData = m_dragOffer->mimeData(); - supportedActions = Qt::CopyAction | Qt::MoveAction | Qt::LinkAction; + supportedActions = m_dragOffer->supportedActions(); } const QPlatformDragQtResponse &response = QWindowSystemInterface::handleDrag(m_dragWindow, dragData, m_dragPoint, supportedActions, @@ -199,11 +225,7 @@ void QWaylandDataDevice::data_device_enter(uint32_t serial, wl_surface *surface, static_cast(QGuiApplicationPrivate::platformIntegration()->drag())->setResponse(response); } - if (response.isAccepted()) { - wl_data_offer_accept(m_dragOffer->object(), m_enterSerial, m_dragOffer->firstFormat().toUtf8().constData()); - } else { - wl_data_offer_accept(m_dragOffer->object(), m_enterSerial, nullptr); - } + sendResponse(supportedActions, response); } void QWaylandDataDevice::data_device_leave() @@ -237,10 +259,10 @@ void QWaylandDataDevice::data_device_motion(uint32_t time, wl_fixed_t x, wl_fixe supportedActions = drag->supportedActions(); } else { dragData = m_dragOffer->mimeData(); - supportedActions = Qt::CopyAction | Qt::MoveAction | Qt::LinkAction; + supportedActions = m_dragOffer->supportedActions(); } - QPlatformDragQtResponse response = QWindowSystemInterface::handleDrag(m_dragWindow, dragData, m_dragPoint, supportedActions, + const QPlatformDragQtResponse response = QWindowSystemInterface::handleDrag(m_dragWindow, dragData, m_dragPoint, supportedActions, QGuiApplication::mouseButtons(), QGuiApplication::keyboardModifiers()); @@ -248,11 +270,7 @@ void QWaylandDataDevice::data_device_motion(uint32_t time, wl_fixed_t x, wl_fixe static_cast(QGuiApplicationPrivate::platformIntegration()->drag())->setResponse(response); } - if (response.isAccepted()) { - wl_data_offer_accept(m_dragOffer->object(), m_enterSerial, m_dragOffer->firstFormat().toUtf8().constData()); - } else { - wl_data_offer_accept(m_dragOffer->object(), m_enterSerial, nullptr); - } + sendResponse(supportedActions, response); } #endif // QT_CONFIG(draganddrop) @@ -282,11 +300,6 @@ void QWaylandDataDevice::dragSourceCancelled() m_dragSource.reset(); } -void QWaylandDataDevice::dragSourceTargetChanged(const QString &mimeType) -{ - static_cast(QGuiApplicationPrivate::platformIntegration()->drag())->updateTarget(mimeType); -} - QPoint QWaylandDataDevice::calculateDragPosition(int x, int y, QWindow *wnd) const { QPoint pnt(wl_fixed_to_int(x), wl_fixed_to_int(y)); @@ -299,6 +312,33 @@ QPoint QWaylandDataDevice::calculateDragPosition(int x, int y, QWindow *wnd) con } return pnt; } + +void QWaylandDataDevice::sendResponse(Qt::DropActions supportedActions, const QPlatformDragQtResponse &response) +{ + if (response.isAccepted()) { + if (version() >= 3) + m_dragOffer->set_actions(dropActionsToWl(supportedActions), dropActionsToWl(response.acceptedAction())); + + m_dragOffer->accept(m_enterSerial, m_dragOffer->firstFormat()); + } else { + m_dragOffer->accept(m_enterSerial, QString()); + } +} + +int QWaylandDataDevice::dropActionsToWl(Qt::DropActions actions) +{ + + int wlActions = WL_DATA_DEVICE_MANAGER_DND_ACTION_NONE; + if (actions & Qt::CopyAction) + wlActions |= WL_DATA_DEVICE_MANAGER_DND_ACTION_COPY; + if (actions & (Qt::MoveAction | Qt::TargetMoveAction)) + wlActions |= WL_DATA_DEVICE_MANAGER_DND_ACTION_MOVE; + + // wayland does not support LinkAction at the time of writing + return wlActions; +} + + #endif // QT_CONFIG(draganddrop) } diff --git a/src/plugins/platforms/wayland/qwaylanddatadevice_p.h b/src/plugins/platforms/wayland/qwaylanddatadevice_p.h index 16c3ad28e44..801dcc2c182 100644 --- a/src/plugins/platforms/wayland/qwaylanddatadevice_p.h +++ b/src/plugins/platforms/wayland/qwaylanddatadevice_p.h @@ -64,6 +64,7 @@ QT_REQUIRE_CONFIG(wayland_datadevice); QT_BEGIN_NAMESPACE class QMimeData; +class QPlatformDragQtResponse; class QWindow; namespace QtWaylandClient { @@ -89,7 +90,7 @@ public: #if QT_CONFIG(draganddrop) QWaylandDataOffer *dragOffer() const; - bool startDrag(QMimeData *mimeData, QWaylandWindow *icon); + bool startDrag(QMimeData *mimeData, Qt::DropActions supportedActions, QWaylandWindow *icon); void cancelDrag(); #endif @@ -109,13 +110,16 @@ private Q_SLOTS: #if QT_CONFIG(draganddrop) void dragSourceCancelled(); - void dragSourceTargetChanged(const QString &mimeType); #endif private: #if QT_CONFIG(draganddrop) QPoint calculateDragPosition(int x, int y, QWindow *wnd) const; #endif + void sendResponse(Qt::DropActions supportedActions, const QPlatformDragQtResponse &response); + + static int dropActionsToWl(Qt::DropActions dropActions); + QWaylandDisplay *m_display = nullptr; QWaylandInputDevice *m_inputDevice = nullptr; diff --git a/src/plugins/platforms/wayland/qwaylanddatadevicemanager.cpp b/src/plugins/platforms/wayland/qwaylanddatadevicemanager.cpp index 35d67307fc3..6dc4f77f58f 100644 --- a/src/plugins/platforms/wayland/qwaylanddatadevicemanager.cpp +++ b/src/plugins/platforms/wayland/qwaylanddatadevicemanager.cpp @@ -50,8 +50,8 @@ QT_BEGIN_NAMESPACE namespace QtWaylandClient { -QWaylandDataDeviceManager::QWaylandDataDeviceManager(QWaylandDisplay *display, uint32_t id) - : wl_data_device_manager(display->wl_registry(), id, 1) +QWaylandDataDeviceManager::QWaylandDataDeviceManager(QWaylandDisplay *display, int version, uint32_t id) + : wl_data_device_manager(display->wl_registry(), id, qMin(version, 3)) , m_display(display) { // Create transfer devices for all input devices. diff --git a/src/plugins/platforms/wayland/qwaylanddatadevicemanager_p.h b/src/plugins/platforms/wayland/qwaylanddatadevicemanager_p.h index bd05c0fbb49..510d9be48c3 100644 --- a/src/plugins/platforms/wayland/qwaylanddatadevicemanager_p.h +++ b/src/plugins/platforms/wayland/qwaylanddatadevicemanager_p.h @@ -68,7 +68,7 @@ class QWaylandInputDevice; class Q_WAYLAND_CLIENT_EXPORT QWaylandDataDeviceManager : public QtWayland::wl_data_device_manager { public: - QWaylandDataDeviceManager(QWaylandDisplay *display, uint32_t id); + QWaylandDataDeviceManager(QWaylandDisplay *display, int version, uint32_t id); ~QWaylandDataDeviceManager() override; QWaylandDataDevice *getDataDevice(QWaylandInputDevice *inputDevice); diff --git a/src/plugins/platforms/wayland/qwaylanddataoffer.cpp b/src/plugins/platforms/wayland/qwaylanddataoffer.cpp index 5d0a8d472f7..6271f0fa878 100644 --- a/src/plugins/platforms/wayland/qwaylanddataoffer.cpp +++ b/src/plugins/platforms/wayland/qwaylanddataoffer.cpp @@ -82,6 +82,15 @@ QMimeData *QWaylandDataOffer::mimeData() return m_mimeData.data(); } +Qt::DropActions QWaylandDataOffer::supportedActions() const +{ + if (version() < 3) { + return Qt::MoveAction | Qt::CopyAction; + } + + return m_supportedActions; +} + void QWaylandDataOffer::startReceiving(const QString &mimeType, int fd) { receive(mimeType, fd); @@ -93,6 +102,22 @@ void QWaylandDataOffer::data_offer_offer(const QString &mime_type) m_mimeData->appendFormat(mime_type); } +void QWaylandDataOffer::data_offer_action(uint32_t dnd_action) +{ + Q_UNUSED(dnd_action); + // This is the compositor telling the drag target what action it should perform + // It does not map nicely into Qt final drop semantics, other than pretending there is only one supported action? +} + +void QWaylandDataOffer::data_offer_source_actions(uint32_t source_actions) +{ + m_supportedActions = Qt::DropActions(); + if (source_actions & WL_DATA_DEVICE_MANAGER_DND_ACTION_MOVE) + m_supportedActions |= Qt::MoveAction; + if (source_actions & WL_DATA_DEVICE_MANAGER_DND_ACTION_COPY) + m_supportedActions |= Qt::CopyAction; +} + QWaylandMimeData::QWaylandMimeData(QWaylandAbstractDataOffer *dataOffer) : m_dataOffer(dataOffer) { diff --git a/src/plugins/platforms/wayland/qwaylanddataoffer_p.h b/src/plugins/platforms/wayland/qwaylanddataoffer_p.h index 50c05732bd4..c641ad3068a 100644 --- a/src/plugins/platforms/wayland/qwaylanddataoffer_p.h +++ b/src/plugins/platforms/wayland/qwaylanddataoffer_p.h @@ -82,6 +82,7 @@ public: explicit QWaylandDataOffer(QWaylandDisplay *display, struct ::wl_data_offer *offer); ~QWaylandDataOffer() override; QMimeData *mimeData() override; + Qt::DropActions supportedActions() const; QString firstFormat() const; @@ -89,10 +90,13 @@ public: protected: void data_offer_offer(const QString &mime_type) override; + void data_offer_source_actions(uint32_t source_actions) override; + void data_offer_action(uint32_t dnd_action) override; private: QWaylandDisplay *m_display = nullptr; QScopedPointer m_mimeData; + Qt::DropActions m_supportedActions; }; diff --git a/src/plugins/platforms/wayland/qwaylanddatasource.cpp b/src/plugins/platforms/wayland/qwaylanddatasource.cpp index f45122fb9b6..5599cbd471c 100644 --- a/src/plugins/platforms/wayland/qwaylanddatasource.cpp +++ b/src/plugins/platforms/wayland/qwaylanddatasource.cpp @@ -101,7 +101,32 @@ void QWaylandDataSource::data_source_send(const QString &mime_type, int32_t fd) void QWaylandDataSource::data_source_target(const QString &mime_type) { - Q_EMIT targetChanged(mime_type); + m_accepted = !mime_type.isEmpty(); + Q_EMIT dndResponseUpdated(m_accepted, m_dropAction); +} + +void QWaylandDataSource::data_source_action(uint32_t action) +{ + Qt::DropAction qtAction = Qt::IgnoreAction; + + if (action == WL_DATA_DEVICE_MANAGER_DND_ACTION_MOVE) + qtAction = Qt::MoveAction; + else if (action == WL_DATA_DEVICE_MANAGER_DND_ACTION_COPY) + qtAction = Qt::CopyAction; + + m_dropAction = qtAction; + Q_EMIT dndResponseUpdated(m_accepted, m_dropAction); +} + +void QWaylandDataSource::data_source_dnd_finished() +{ + Q_EMIT finished(); +} + +void QWaylandDataSource::data_source_dnd_drop_performed() +{ + + Q_EMIT dndDropped(m_accepted, m_dropAction); } } diff --git a/src/plugins/platforms/wayland/qwaylanddatasource_p.h b/src/plugins/platforms/wayland/qwaylanddatasource_p.h index 25afff79c5a..96f07bc3788 100644 --- a/src/plugins/platforms/wayland/qwaylanddatasource_p.h +++ b/src/plugins/platforms/wayland/qwaylanddatasource_p.h @@ -77,17 +77,25 @@ public: QMimeData *mimeData() const; Q_SIGNALS: - void targetChanged(const QString &mime_type); void cancelled(); + void finished(); + + void dndResponseUpdated(bool accepted, Qt::DropAction action); + void dndDropped(bool accepted, Qt::DropAction action); protected: void data_source_cancelled() override; void data_source_send(const QString &mime_type, int32_t fd) override; void data_source_target(const QString &mime_type) override; + void data_source_dnd_drop_performed() override; + void data_source_dnd_finished() override; + void data_source_action(uint32_t action) override; private: QWaylandDisplay *m_display = nullptr; QMimeData *m_mime_data = nullptr; + bool m_accepted = false; + Qt::DropAction m_dropAction = Qt::IgnoreAction; }; } diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index 8043115af59..e198774294d 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -514,7 +514,7 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin mInputDevices.append(inputDevice); #if QT_CONFIG(wayland_datadevice) } else if (interface == QLatin1String(QWaylandDataDeviceManager::interface()->name)) { - mDndSelectionHandler.reset(new QWaylandDataDeviceManager(this, id)); + mDndSelectionHandler.reset(new QWaylandDataDeviceManager(this, version, id)); #endif } else if (interface == QLatin1String(QtWayland::qt_surface_extension::interface()->name)) { mWindowExtension.reset(new QtWayland::qt_surface_extension(registry, id, 1)); diff --git a/src/plugins/platforms/wayland/qwaylanddnd.cpp b/src/plugins/platforms/wayland/qwaylanddnd.cpp index 6535aa16be1..97ee5b2ed56 100644 --- a/src/plugins/platforms/wayland/qwaylanddnd.cpp +++ b/src/plugins/platforms/wayland/qwaylanddnd.cpp @@ -66,7 +66,7 @@ void QWaylandDrag::startDrag() { QBasicDrag::startDrag(); QWaylandWindow *icon = static_cast(shapedPixmapWindow()->handle()); - if (m_display->currentInputDevice()->dataDevice()->startDrag(drag()->mimeData(), icon)) { + if (m_display->currentInputDevice()->dataDevice()->startDrag(drag()->mimeData(), drag()->supportedActions(), icon)) { icon->addAttachOffset(-drag()->hotSpot()); } else { // Cancelling immediately does not work, since the event loop for QDrag::exec is started @@ -103,31 +103,31 @@ void QWaylandDrag::endDrag() m_display->currentInputDevice()->handleEndDrag(); } -void QWaylandDrag::updateTarget(const QString &mimeType) +void QWaylandDrag::setResponse(bool accepted) { - setCanDrop(!mimeType.isEmpty()); - - if (canDrop()) { - updateCursor(defaultAction(drag()->supportedActions(), m_display->currentInputDevice()->modifiers())); - } else { - updateCursor(Qt::IgnoreAction); - } + // This method is used for old DataDevices where the drag action is not communicated + Qt::DropAction action = defaultAction(drag()->supportedActions(), m_display->currentInputDevice()->modifiers()); + setResponse(QPlatformDropQtResponse(accepted, action)); } -void QWaylandDrag::setResponse(const QPlatformDragQtResponse &response) +void QWaylandDrag::setResponse(const QPlatformDropQtResponse &response) { setCanDrop(response.isAccepted()); if (canDrop()) { - updateCursor(defaultAction(drag()->supportedActions(), m_display->currentInputDevice()->modifiers())); + updateCursor(response.acceptedAction()); } else { updateCursor(Qt::IgnoreAction); } } -void QWaylandDrag::finishDrag(const QPlatformDropQtResponse &response) +void QWaylandDrag::setDropResponse(const QPlatformDropQtResponse &response) { setExecutedDropAction(response.acceptedAction()); +} + +void QWaylandDrag::finishDrag() +{ QKeyEvent event(QEvent::KeyPress, Qt::Key_Escape, Qt::NoModifier); eventFilter(shapedPixmapWindow(), &event); } diff --git a/src/plugins/platforms/wayland/qwaylanddnd_p.h b/src/plugins/platforms/wayland/qwaylanddnd_p.h index 474fe2ab105..747f0190bd1 100644 --- a/src/plugins/platforms/wayland/qwaylanddnd_p.h +++ b/src/plugins/platforms/wayland/qwaylanddnd_p.h @@ -71,9 +71,10 @@ public: QWaylandDrag(QWaylandDisplay *display); ~QWaylandDrag() override; - void updateTarget(const QString &mimeType); - void setResponse(const QPlatformDragQtResponse &response); - void finishDrag(const QPlatformDropQtResponse &response); + void setResponse(bool accepted); + void setResponse(const QPlatformDropQtResponse &response); + void setDropResponse(const QPlatformDropQtResponse &response); + void finishDrag(); protected: void startDrag() override; diff --git a/tests/auto/wayland/datadevicev1/tst_datadevicev1.cpp b/tests/auto/wayland/datadevicev1/tst_datadevicev1.cpp index 4dbeb7db4a6..0c5e8872817 100644 --- a/tests/auto/wayland/datadevicev1/tst_datadevicev1.cpp +++ b/tests/auto/wayland/datadevicev1/tst_datadevicev1.cpp @@ -35,7 +35,7 @@ using namespace MockCompositor; -constexpr int dataDeviceVersion = 1; +constexpr int dataDeviceVersion = 3; class DataDeviceCompositor : public DefaultCompositor { public: From 3bf9a581ee13cac988cdfadc7f22d472c1562214 Mon Sep 17 00:00:00 2001 From: Aleix Pol Date: Tue, 10 Nov 2020 19:06:48 +0100 Subject: [PATCH 1023/1507] Implement xdg_activation_v1 protocol Change-Id: Ib5c8d0c6a209308c2c1a7f5e45d8866ba0127d81 Reviewed-by: Qt CI Bot Reviewed-by: Eskil Abrahamsen Blomfeldt --- .../wayland/protocols/xdg-activation-v1.xml | 186 ++++++++++++++++++ .../shellintegration/xdg-shell/CMakeLists.txt | 2 + .../xdg-shell/qwaylandxdgactivationv1.cpp | 83 ++++++++ .../xdg-shell/qwaylandxdgactivationv1_p.h | 93 +++++++++ .../xdg-shell/qwaylandxdgshell.cpp | 39 ++++ .../xdg-shell/qwaylandxdgshell_p.h | 8 + .../wayland/qwaylandshellsurface.cpp | 11 ++ .../wayland/qwaylandshellsurface_p.h | 2 + .../platforms/wayland/qwaylandwindow.cpp | 13 +- .../platforms/wayland/qwaylandwindow_p.h | 4 + 10 files changed, 439 insertions(+), 2 deletions(-) create mode 100644 src/3rdparty/wayland/protocols/xdg-activation-v1.xml create mode 100644 src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgactivationv1.cpp create mode 100644 src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgactivationv1_p.h diff --git a/src/3rdparty/wayland/protocols/xdg-activation-v1.xml b/src/3rdparty/wayland/protocols/xdg-activation-v1.xml new file mode 100644 index 00000000000..d87e633745b --- /dev/null +++ b/src/3rdparty/wayland/protocols/xdg-activation-v1.xml @@ -0,0 +1,186 @@ + + + + + Copyright © 2020 Aleix Pol Gonzalez <aleixpol@kde.org> + Copyright © 2020 Carlos Garnacho <carlosg@gnome.org> + + 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. + + + + The way for a client to pass focus to another toplevel is as follows. + + The client that intends to activate another toplevel uses the + xdg_activation_v1.get_activation_token request to get an activation token. + This token is then passed to the client to be activated through a separate + band of communication. The client to be activated will then pass the token + it received to the xdg_activation_v1.activate request. The compositor can + then use this token to decide how to react to the activation request. + + The token the activating client gets may be ineffective either already at + the time it receives it, for example if it was not focused, for focus + stealing prevention. The activating client will have no way to discover + the validity of the token, and may still forward it to the to be activated + client. + + The created activation token may optionally get information attached to it + that can be used by the compositor to identify the application that we + intend to activate. This can for example be used to display a visual hint + about what application is being started. + + Warning! The protocol described in this file is currently in the testing + phase. Backward compatible changes may be added together with the + corresponding interface version bump. Backward incompatible changes can + only be done by creating a new major version of the extension. + + + + + A global interface used for informing the compositor about applications + being activated or started, or for applications to request to be + activated. + + + + + Notify the compositor that the xdg_activation object will no longer be + used. + + The child objects created via this interface are unaffected and should + be destroyed separately. + + + + + + Creates an xdg_activation_token_v1 object that will provide + the initiating client with a unique token for this activation. This + token should be offered to the clients to be activated. + + + + + + + + Requests surface activation. It's up to the compositor to display + this information as desired, for example by placing the surface above + the rest. + + The compositor may know who requested this by checking the activation + token and might decide not to follow through with the activation if it's + considered unwanted. + + Compositors can ignore unknown presentation tokens when an invalid + token is passed. + + + + + + + + + An object for setting up a token and receiving a token handle that can + be passed as an activation token to another client. + + The object is created using the xdg_activation_v1.get_activation_token + request. This object should then be populated with the app_id, surface + and serial information and committed. The compositor shall then issue a + done event with the token. In case the request's parameters are invalid, + the compositor will provide an invalid token. + + + + + + + + + Provides information about the seat and serial event that requested the + token. + + Must be sent before commit. This information is optional. + + + + + + + + The requesting client can specify an app_id to associate the token + being created with it. + + Must be sent before commit. This information is optional. + + + + + + + The requesting client can specify a surface to associate the token + being created with it. + + Must be triggered before commit. This information is optional. + + + + + + + Requests an activation token based on the different parameters that + have been offered through set_serial, set_surface and set_app_id. + + + + + + The 'done' event contains the unique token of this activation request + and notifies that the provider is done. + + Applications will typically receive the token through the + XDG_ACTIVATION_TOKEN environment variable as set by its launcher, and + should unset the environment variable right after this request, in + order to avoid propagating it to child processes. + + Applications implementing the D-Bus interface org.freedesktop.Application + should get their token under XDG_ACTIVATION_TOKEN on their platform_data. + + Presentation tokens may be transferred across clients through means not + described in this protocol. + + + + + + + Notify the compositor that the xdg_activation_token_v1 object will no + longer be used. + + + + diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/CMakeLists.txt index 62e3952bd9e..f840e293b63 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/CMakeLists.txt +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/CMakeLists.txt @@ -10,6 +10,7 @@ qt_internal_add_plugin(QWaylandXdgShellIntegrationPlugin SOURCES main.cpp qwaylandxdgdecorationv1.cpp qwaylandxdgdecorationv1_p.h + qwaylandxdgactivationv1.cpp qwaylandxdgactivationv1_p.h qwaylandxdgshell.cpp qwaylandxdgshell_p.h qwaylandxdgshellintegration.cpp qwaylandxdgshellintegration_p.h LIBRARIES @@ -24,6 +25,7 @@ qt6_generate_wayland_protocol_client_sources(QWaylandXdgShellIntegrationPlugin FILES ${CMAKE_CURRENT_SOURCE_DIR}/../../../3rdparty/protocol/xdg-decoration-unstable-v1.xml ${CMAKE_CURRENT_SOURCE_DIR}/../../../3rdparty/protocol/xdg-shell.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../../../3rdparty/protocol/xdg-activation-v1.xml ) #### Keys ignored in scope 1:.:.:xdg-shell.pro:: diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgactivationv1.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgactivationv1.cpp new file mode 100644 index 00000000000..9b5a1cb3bbf --- /dev/null +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgactivationv1.cpp @@ -0,0 +1,83 @@ +/**************************************************************************** +** +** Copyright (C) 2020 Aleix Pol Gonzalez +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the config.tests of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qwaylandxdgactivationv1_p.h" +#include +#include + +QT_BEGIN_NAMESPACE + +namespace QtWaylandClient { + +QWaylandXdgActivationV1::QWaylandXdgActivationV1(wl_registry *registry, uint32_t id, + uint32_t availableVersion) + : QtWayland::xdg_activation_v1(registry, id, qMin(availableVersion, 1u)) +{ +} + +QWaylandXdgActivationV1::~QWaylandXdgActivationV1() +{ + Q_ASSERT(isInitialized()); + destroy(); +} + +QWaylandXdgActivationTokenV1 * +QWaylandXdgActivationV1::requestXdgActivationToken(QWaylandDisplay *display, + struct ::wl_surface *surface, uint32_t serial, + const QString &app_id) +{ + auto wl = get_activation_token(); + auto provider = new QWaylandXdgActivationTokenV1; + provider->init(wl); + + if (surface) + provider->set_surface(surface); + + if (!app_id.isEmpty()) + provider->set_app_id(app_id); + + if (display->lastInputDevice()) + provider->set_serial(serial, display->lastInputDevice()->wl_seat()); + provider->commit(); + return provider; +} + +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgactivationv1_p.h b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgactivationv1_p.h new file mode 100644 index 00000000000..11ffe7d1eab --- /dev/null +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgactivationv1_p.h @@ -0,0 +1,93 @@ +/**************************************************************************** +** +** Copyright (C) 2020 Aleix Pol Gonzalez +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the config.tests of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWAYLANDXDGACTIVATIONV1_P_H +#define QWAYLANDXDGACTIVATIONV1_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include +#include "qwayland-xdg-activation-v1.h" + +#include + +QT_BEGIN_NAMESPACE + +namespace QtWaylandClient { + +class QWaylandDisplay; +class QWaylandSurface; + +class Q_WAYLAND_CLIENT_EXPORT QWaylandXdgActivationTokenV1 + : public QObject, + public QtWayland::xdg_activation_token_v1 +{ + Q_OBJECT +public: + void xdg_activation_token_v1_done(const QString &token) override { Q_EMIT done(token); } + +Q_SIGNALS: + void done(const QString &token); +}; + +class Q_WAYLAND_CLIENT_EXPORT QWaylandXdgActivationV1 : public QtWayland::xdg_activation_v1 +{ +public: + QWaylandXdgActivationV1(struct ::wl_registry *registry, uint32_t id, uint32_t availableVersion); + ~QWaylandXdgActivationV1() override; + + QWaylandXdgActivationTokenV1 *requestXdgActivationToken(QWaylandDisplay *display, + struct ::wl_surface *surface, + uint32_t serial, const QString &app_id); +}; + +QT_END_NAMESPACE + +} + +#endif // QWAYLANDXDGACTIVATIONV1_P_H diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp index 8378cf9f293..ad533606613 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp @@ -318,6 +318,8 @@ void QWaylandXdgSurface::setAppId(const QString &appId) { if (m_toplevel) m_toplevel->set_app_id(appId); + + m_appId = appId; } void QWaylandXdgSurface::setWindowFlags(Qt::WindowFlags flags) @@ -477,6 +479,39 @@ void QWaylandXdgSurface::xdg_surface_configure(uint32_t serial) } } +bool QWaylandXdgSurface::requestActivate() +{ + if (auto *activation = m_shell->activation()) { + activation->activate(m_activationToken, window()->wlSurface()); + return true; + } + return false; +} + +void QWaylandXdgSurface::requestXdgActivationToken(quint32 serial) +{ + if (auto *activation = m_shell->activation()) { + auto tokenProvider = activation->requestXdgActivationToken( + m_shell->m_display, m_window->wlSurface(), serial, m_appId); + connect(tokenProvider, &QWaylandXdgActivationTokenV1::done, this, + [this, tokenProvider](const QString &token) { + Q_EMIT m_window->xdgActivationTokenCreated(token); + tokenProvider->deleteLater(); + }); + } else { + QWaylandShellSurface::requestXdgActivationToken(serial); + } +} + +void QWaylandXdgSurface::setXdgActivationToken(const QString &token) +{ + if (auto *activation = m_shell->activation()) { + m_activationToken = token; + } else { + qCWarning(lcQpaWayland) << "zxdg_activation_v1 not available"; + } +} + QWaylandXdgShell::QWaylandXdgShell(QWaylandDisplay *display, uint32_t id, uint32_t availableVersion) : QtWayland::xdg_wm_base(display->wl_registry(), id, qMin(availableVersion, 2u)) , m_display(display) @@ -506,6 +541,10 @@ void QWaylandXdgShell::handleRegistryGlobal(void *data, wl_registry *registry, u QWaylandXdgShell *xdgShell = static_cast(data); if (interface == QLatin1String(QWaylandXdgDecorationManagerV1::interface()->name)) xdgShell->m_xdgDecorationManager.reset(new QWaylandXdgDecorationManagerV1(registry, id, version)); + + if (interface == QLatin1String(QWaylandXdgActivationV1::interface()->name)) { + xdgShell->m_xdgActivation.reset(new QWaylandXdgActivationV1(registry, id, version)); + } } } diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h index b504a24d871..8630fcab957 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h @@ -55,6 +55,7 @@ #include "qwayland-xdg-shell.h" #include "qwaylandxdgdecorationv1_p.h" +#include "qwaylandxdgactivationv1_p.h" #include #include @@ -94,6 +95,9 @@ public: bool wantsDecorations() const override; void propagateSizeHints() override; void setWindowGeometry(const QRect &rect) override; + bool requestActivate() override; + void setXdgActivationToken(const QString &token) override; + void requestXdgActivationToken(quint32 serial) override; void setSizeHints(); @@ -157,6 +161,8 @@ private: QRegion m_exposeRegion; uint m_pendingConfigureSerial = 0; uint m_appliedConfigureSerial = 0; + QString m_activationToken; + QString m_appId; friend class QWaylandXdgShell; }; @@ -168,6 +174,7 @@ public: ~QWaylandXdgShell() override; QWaylandXdgDecorationManagerV1 *decorationManager() { return m_xdgDecorationManager.data(); } + QWaylandXdgActivationV1 *activation() const { return m_xdgActivation.data(); } QWaylandXdgSurface *getXdgSurface(QWaylandWindow *window); protected: @@ -179,6 +186,7 @@ private: QWaylandDisplay *m_display = nullptr; QScopedPointer m_xdgDecorationManager; + QScopedPointer m_xdgActivation; QWaylandXdgSurface::Popup *m_topmostGrabbingPopup = nullptr; friend class QWaylandXdgSurface; diff --git a/src/plugins/platforms/wayland/qwaylandshellsurface.cpp b/src/plugins/platforms/wayland/qwaylandshellsurface.cpp index 81e05a444e8..f87e5962437 100644 --- a/src/plugins/platforms/wayland/qwaylandshellsurface.cpp +++ b/src/plugins/platforms/wayland/qwaylandshellsurface.cpp @@ -105,6 +105,17 @@ uint32_t QWaylandShellSurface::getSerial(QWaylandInputDevice *inputDevice) return inputDevice->serial(); } +void QWaylandShellSurface::setXdgActivationToken(const QString &token) +{ + Q_UNUSED(token); + qCWarning(lcQpaWayland) << "setXdgActivationToken not implemented" << token; +} + +void QWaylandShellSurface::requestXdgActivationToken(quint32 serial) +{ + Q_UNUSED(serial); + Q_EMIT m_window->xdgActivationTokenCreated({}); +} } QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandshellsurface_p.h b/src/plugins/platforms/wayland/qwaylandshellsurface_p.h index cdf1abdbc71..4779eebbae3 100644 --- a/src/plugins/platforms/wayland/qwaylandshellsurface_p.h +++ b/src/plugins/platforms/wayland/qwaylandshellsurface_p.h @@ -103,6 +103,8 @@ public: virtual void setWindowPosition(const QPoint &position) { Q_UNUSED(position); } virtual bool requestActivate() { return false; } + virtual void setXdgActivationToken(const QString &token); + virtual void requestXdgActivationToken(quint32 serial); inline QWaylandWindow *window() { return m_window; } QPlatformWindow *platformWindow(); diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index b0d1c0d1c0f..3481a8fa2ae 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -1249,8 +1249,8 @@ void QWaylandWindow::restoreMouseCursor(QWaylandInputDevice *device) void QWaylandWindow::requestActivateWindow() { - if (mShellSurface == nullptr || !mShellSurface->requestActivate()) - qCWarning(lcQpaWayland) << "Wayland does not support QWindow::requestActivate()"; + if (mShellSurface) + mShellSurface->requestActivate(); } bool QWaylandWindow::isExposed() const @@ -1497,6 +1497,15 @@ void QWaylandWindow::setOpaqueArea(const QRegion &opaqueArea) wl_region_destroy(region); } +void QWaylandWindow::requestXdgActivationToken(uint serial) +{ + mShellSurface->requestXdgActivationToken(serial); +} + +void QWaylandWindow::setXdgActivationToken(const QString &token) +{ + mShellSurface->setXdgActivationToken(token); +} } QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index f2dbe337fc7..4eecdd861c2 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -230,12 +230,16 @@ public: void handleUpdate(); void deliverUpdateRequest() override; + void setXdgActivationToken(const QString &token); + void requestXdgActivationToken(uint serial); + public slots: void applyConfigure(); signals: void wlSurfaceCreated(); void wlSurfaceDestroyed(); + void xdgActivationTokenCreated(const QString &token); protected: virtual void doHandleFrameCallback(); From 18df9604993305789d813fa298a947387ea709b1 Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Thu, 18 Nov 2021 13:05:30 +0100 Subject: [PATCH 1024/1507] Client: Delay deletion of QDrag object until after we're done with it In certain cases, most notably when performing drag and drop operations with touch, the QDrag object gets deleted before data_source_send is executed. This then tries to access a deleted data_source, crashing the client. To avoid this, we indicate we want the QDrag object to stay around and then delete it in QWaylandDrag::finishDrag, which with data_device v3 is guaranteed to be called after everyone is done with the data source. Change-Id: I6a2f5a219f58d1b721a9fec33c57d26d2c522ec9 Reviewed-by: David Edmundson --- src/plugins/platforms/wayland/qwaylanddnd.cpp | 11 +++++++++++ src/plugins/platforms/wayland/qwaylanddnd_p.h | 1 + 2 files changed, 12 insertions(+) diff --git a/src/plugins/platforms/wayland/qwaylanddnd.cpp b/src/plugins/platforms/wayland/qwaylanddnd.cpp index 97ee5b2ed56..7c53f5faac1 100644 --- a/src/plugins/platforms/wayland/qwaylanddnd.cpp +++ b/src/plugins/platforms/wayland/qwaylanddnd.cpp @@ -80,6 +80,9 @@ void QWaylandDrag::cancel() QBasicDrag::cancel(); m_display->currentInputDevice()->dataDevice()->cancelDrag(); + + if (drag()) + drag()->deleteLater(); } void QWaylandDrag::move(const QPoint &globalPos, Qt::MouseButtons b, Qt::KeyboardModifiers mods) @@ -130,6 +133,14 @@ void QWaylandDrag::finishDrag() { QKeyEvent event(QEvent::KeyPress, Qt::Key_Escape, Qt::NoModifier); eventFilter(shapedPixmapWindow(), &event); + + if (drag()) + drag()->deleteLater(); +} + +bool QWaylandDrag::ownsDragObject() const +{ + return true; } } diff --git a/src/plugins/platforms/wayland/qwaylanddnd_p.h b/src/plugins/platforms/wayland/qwaylanddnd_p.h index 747f0190bd1..46f629ace19 100644 --- a/src/plugins/platforms/wayland/qwaylanddnd_p.h +++ b/src/plugins/platforms/wayland/qwaylanddnd_p.h @@ -83,6 +83,7 @@ protected: void drop(const QPoint &globalPos, Qt::MouseButtons b, Qt::KeyboardModifiers mods) override; void endDrag() override; + bool ownsDragObject() const override; private: QWaylandDisplay *m_display = nullptr; From c31a609bbd60ac4ad0b9cb5dbe42179628b07bf1 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Thu, 2 Dec 2021 09:59:09 +0100 Subject: [PATCH 1025/1507] Remove QWaylandShellIntegration::findGlobal This is no longer necessary now that the recommended way of creating custom shells is to use QWaylandShellIntegrationTemplate. This also restores the old internal API in use by existing shells. Task-number: QTBUG-94330 Change-Id: I0fa0ba0d928baa2edf5d68e879558081026436c8 Reviewed-by: Vlad Zahorodnii Reviewed-by: Eskil Abrahamsen Blomfeldt Reviewed-by: David Edmundson --- .../qwaylandfullscreenshellv1integration.cpp | 19 ++++++++++--------- .../qwaylandfullscreenshellv1integration.h | 3 +-- .../wl-shell/qwaylandwlshellintegration.cpp | 17 ++++++++--------- .../wl-shell/qwaylandwlshellintegration_p.h | 2 +- .../xdg-shell/qwaylandxdgshellintegration.cpp | 18 +++++++++--------- .../xdg-shell/qwaylandxdgshellintegration_p.h | 2 +- .../qwaylandshellintegration.cpp | 13 ------------- .../qwaylandshellintegration_p.h | 13 ++----------- 8 files changed, 32 insertions(+), 55 deletions(-) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/fullscreen-shell-v1/qwaylandfullscreenshellv1integration.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/fullscreen-shell-v1/qwaylandfullscreenshellv1integration.cpp index 033cbf6ec02..418c7d3b373 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/fullscreen-shell-v1/qwaylandfullscreenshellv1integration.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/fullscreen-shell-v1/qwaylandfullscreenshellv1integration.cpp @@ -44,22 +44,23 @@ QT_BEGIN_NAMESPACE namespace QtWaylandClient { -bool QWaylandFullScreenShellV1Integration::initialize() +bool QWaylandFullScreenShellV1Integration::initialize(QWaylandDisplay *display) { - if (m_shell) - return true; - wl_registry *registry; - uint32_t id; - uint32_t version; - bool found = findGlobal(QLatin1String("zwp_fullscreen_shell_v1"), ®istry, &id, &version); - if (found) - m_shell.reset(new QtWayland::zwp_fullscreen_shell_v1(registry, id, version)); + for (const QWaylandDisplay::RegistryGlobal &global : display->globals()) { + if (global.interface == QLatin1String("zwp_fullscreen_shell_v1") && !m_shell) { + m_shell.reset(new QtWayland::zwp_fullscreen_shell_v1(display->wl_registry(), global.id, global.version)); + break; + } + } + if (!m_shell) { qCDebug(lcQpaWayland) << "Couldn't find global zwp_fullscreen_shell_v1 for fullscreen-shell"; return false; } + return true; } + QWaylandShellSurface *QWaylandFullScreenShellV1Integration::createShellSurface(QWaylandWindow *window) { return new QWaylandFullScreenShellV1Surface(m_shell.data(), window); diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/fullscreen-shell-v1/qwaylandfullscreenshellv1integration.h b/src/plugins/platforms/wayland/plugins/shellintegration/fullscreen-shell-v1/qwaylandfullscreenshellv1integration.h index da99f6c4e0e..131f9e72097 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/fullscreen-shell-v1/qwaylandfullscreenshellv1integration.h +++ b/src/plugins/platforms/wayland/plugins/shellintegration/fullscreen-shell-v1/qwaylandfullscreenshellv1integration.h @@ -43,7 +43,6 @@ #include #include #include -#include #include "qwayland-fullscreen-shell-unstable-v1.h" @@ -54,7 +53,7 @@ namespace QtWaylandClient { class Q_WAYLAND_CLIENT_EXPORT QWaylandFullScreenShellV1Integration : public QWaylandShellIntegration { public: - bool initialize() override; + bool initialize(QWaylandDisplay *display) override; QWaylandShellSurface *createShellSurface(QWaylandWindow *window) override; private: diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellintegration.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellintegration.cpp index 7353cb1f968..262410f392e 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellintegration.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellintegration.cpp @@ -47,16 +47,15 @@ QT_BEGIN_NAMESPACE namespace QtWaylandClient { -bool QWaylandWlShellIntegration::initialize() +bool QWaylandWlShellIntegration::initialize(QWaylandDisplay *display) { - if (m_wlShell) - return true; - wl_registry *registry; - uint32_t id; - uint32_t version; - bool found = findGlobal(QLatin1String("wl_shell"), ®istry, &id, &version); - if (found) - m_wlShell = new QtWayland::wl_shell(registry, id, 1); + const auto globals = display->globals(); + for (QWaylandDisplay::RegistryGlobal global : globals) { + if (global.interface == QLatin1String("wl_shell")) { + m_wlShell = new QtWayland::wl_shell(display->wl_registry(), global.id, 1); + break; + } + } if (!m_wlShell) { qCDebug(lcQpaWayland) << "Couldn't find global wl_shell"; diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellintegration_p.h b/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellintegration_p.h index 47815d54a18..3d76cc31073 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellintegration_p.h +++ b/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellintegration_p.h @@ -63,7 +63,7 @@ class Q_WAYLAND_CLIENT_EXPORT QWaylandWlShellIntegration : public QWaylandShellI { public: QWaylandWlShellIntegration() {} - bool initialize() override; + bool initialize(QWaylandDisplay *) override; QWaylandShellSurface *createShellSurface(QWaylandWindow *window) override; void *nativeResourceForWindow(const QByteArray &resource, QWindow *window) override; diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshellintegration.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshellintegration.cpp index 8390d76f68e..0c9a2f2b299 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshellintegration.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshellintegration.cpp @@ -47,20 +47,20 @@ QT_BEGIN_NAMESPACE namespace QtWaylandClient { -bool QWaylandXdgShellIntegration::initialize() +bool QWaylandXdgShellIntegration::initialize(QWaylandDisplay *display) { - if (m_xdgShell) - return true; - wl_registry *registry; - uint32_t id; - uint32_t version; - bool found = findGlobal(QLatin1String("xdg_wm_base"), ®istry, &id, &version); - if (found) - m_xdgShell.reset(new QWaylandXdgShell(m_display, id, version)); + for (QWaylandDisplay::RegistryGlobal global : display->globals()) { + if (global.interface == QLatin1String("xdg_wm_base")) { + m_xdgShell.reset(new QWaylandXdgShell(display, global.id, global.version)); + break; + } + } + if (!m_xdgShell) { qCDebug(lcQpaWayland) << "Couldn't find global xdg_wm_base for xdg-shell stable"; return false; } + return true; } diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshellintegration_p.h b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshellintegration_p.h index cd54dd489d3..fced9eb07c2 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshellintegration_p.h +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshellintegration_p.h @@ -63,7 +63,7 @@ class Q_WAYLAND_CLIENT_EXPORT QWaylandXdgShellIntegration : public QWaylandShell { public: QWaylandXdgShellIntegration() {} - bool initialize() override; + bool initialize(QWaylandDisplay *display) override; QWaylandShellSurface *createShellSurface(QWaylandWindow *window) override; void *nativeResourceForWindow(const QByteArray &resource, QWindow *window) override; diff --git a/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegration.cpp b/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegration.cpp index 7bc37792f8c..5bb617034fa 100644 --- a/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegration.cpp +++ b/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegration.cpp @@ -39,19 +39,6 @@ wl_surface *QWaylandShellIntegration::wlSurfaceForWindow(QWaylandWindow *window) return window->wlSurface(); } -bool QWaylandShellIntegration::findGlobal(const QString &interface, wl_registry **registry, uint32_t *id, uint32_t *version) -{ - for (QWaylandDisplay::RegistryGlobal &global : m_display->globals()) { - if (global.interface == interface) { - *registry = m_display->wl_registry(); - *id = global.id; - *version = global.version; - return true; - } - } - return false; -} - } QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegration_p.h b/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegration_p.h index 4de19e7860c..8acbf967044 100644 --- a/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegration_p.h +++ b/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegration_p.h @@ -77,13 +77,7 @@ public: QWaylandShellIntegration() {} virtual ~QWaylandShellIntegration() {} - bool initialize(QWaylandDisplay *display) { - m_display = display; - return initialize(); - } - virtual bool initialize() { - return false; - } + virtual bool initialize(QWaylandDisplay *display) = 0; virtual QWaylandShellSurface *createShellSurface(QWaylandWindow *window) = 0; virtual void *nativeResourceForWindow(const QByteArray &resource, QWindow *window) { Q_UNUSED(resource); @@ -92,10 +86,7 @@ public: } static wl_surface *wlSurfaceForWindow(QWaylandWindow *window); - bool findGlobal(const QString &interface, wl_registry **registry, uint32_t *id, uint32_t *version); -protected: - QWaylandDisplay *m_display = nullptr; }; template @@ -107,7 +98,7 @@ public: { } - bool initialize() override + bool initialize(QWaylandDisplay *) override { QWaylandClientExtension::initialize(); return isActive(); From ea49c2e19db60dc41ce8e7525f6473b84fec48f6 Mon Sep 17 00:00:00 2001 From: David Redondo Date: Wed, 8 Dec 2021 11:53:00 +0100 Subject: [PATCH 1026/1507] Handle the transientParent of a window having another kind of surface Useful for the current work of allowing multiple shells in one process. Change-Id: I68424687df9069fd4339f2764649db1df70a6c9a Reviewed-by: David Edmundson --- .../plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp index ad533606613..547631fd57e 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp @@ -258,7 +258,7 @@ QWaylandXdgSurface::QWaylandXdgSurface(QWaylandXdgShell *shell, ::xdg_surface *s } else { setToplevel(); if (transientParent) { - auto parentXdgSurface = static_cast(transientParent->shellSurface()); + auto parentXdgSurface = qobject_cast(transientParent->shellSurface()); if (parentXdgSurface) m_toplevel->set_parent(parentXdgSurface->m_toplevel->object()); } From 39388b160c6854fff8973737bc0f7ea3b193ad64 Mon Sep 17 00:00:00 2001 From: Elvis Lee Date: Thu, 26 Aug 2021 17:32:09 +0900 Subject: [PATCH 1027/1507] Support presentation-time protocol With the protocol, client knows accurate presentation timing which can support vsync-based rendering for smooth video playback with video/audio synchronization. Also, the protocol provides metrics from client to on-screen for optimizing frame latency. Tested with weston-presentation-shm client which also requires xdg shell. Change-Id: I3b286420e7221aa1c9b81bf7ae9ae70d3cbe6eb6 Reviewed-by: Eskil Abrahamsen Blomfeldt --- .../wayland/protocols/presentation-time.xml | 266 ++++++++++++++++++ .../wayland/protocols/qt_attribution.json | 17 ++ 2 files changed, 283 insertions(+) create mode 100644 src/3rdparty/wayland/protocols/presentation-time.xml diff --git a/src/3rdparty/wayland/protocols/presentation-time.xml b/src/3rdparty/wayland/protocols/presentation-time.xml new file mode 100644 index 00000000000..d1731f0369c --- /dev/null +++ b/src/3rdparty/wayland/protocols/presentation-time.xml @@ -0,0 +1,266 @@ + + + + + + Copyright © 2013-2014 Collabora, Ltd. + + 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. + + + + + + + + The main feature of this interface is accurate presentation + timing feedback to ensure smooth video playback while maintaining + audio/video synchronization. Some features use the concept of a + presentation clock, which is defined in the + presentation.clock_id event. + + A content update for a wl_surface is submitted by a + wl_surface.commit request. Request 'feedback' associates with + the wl_surface.commit and provides feedback on the content + update, particularly the final realized presentation time. + + + + When the final realized presentation time is available, e.g. + after a framebuffer flip completes, the requested + presentation_feedback.presented events are sent. The final + presentation time can differ from the compositor's predicted + display update time and the update's target time, especially + when the compositor misses its target vertical blanking period. + + + + + These fatal protocol errors may be emitted in response to + illegal presentation requests. + + + + + + + + Informs the server that the client will no longer be using + this protocol object. Existing objects created by this object + are not affected. + + + + + + Request presentation feedback for the current content submission + on the given surface. This creates a new presentation_feedback + object, which will deliver the feedback information once. If + multiple presentation_feedback objects are created for the same + submission, they will all deliver the same information. + + For details on what information is returned, see the + presentation_feedback interface. + + + + + + + + This event tells the client in which clock domain the + compositor interprets the timestamps used by the presentation + extension. This clock is called the presentation clock. + + The compositor sends this event when the client binds to the + presentation interface. The presentation clock does not change + during the lifetime of the client connection. + + The clock identifier is platform dependent. On Linux/glibc, + the identifier value is one of the clockid_t values accepted + by clock_gettime(). clock_gettime() is defined by + POSIX.1-2001. + + Timestamps in this clock domain are expressed as tv_sec_hi, + tv_sec_lo, tv_nsec triples, each component being an unsigned + 32-bit value. Whole seconds are in tv_sec which is a 64-bit + value combined from tv_sec_hi and tv_sec_lo, and the + additional fractional part in tv_nsec as nanoseconds. Hence, + for valid timestamps tv_nsec must be in [0, 999999999]. + + Note that clock_id applies only to the presentation clock, + and implies nothing about e.g. the timestamps used in the + Wayland core protocol input events. + + Compositors should prefer a clock which does not jump and is + not slewed e.g. by NTP. The absolute value of the clock is + irrelevant. Precision of one millisecond or better is + recommended. Clients must be able to query the current clock + value directly, not by asking the compositor. + + + + + + + + + A presentation_feedback object returns an indication that a + wl_surface content update has become visible to the user. + One object corresponds to one content update submission + (wl_surface.commit). There are two possible outcomes: the + content update is presented to the user, and a presentation + timestamp delivered; or, the user did not see the content + update because it was superseded or its surface destroyed, + and the content update is discarded. + + Once a presentation_feedback object has delivered a 'presented' + or 'discarded' event it is automatically destroyed. + + + + + As presentation can be synchronized to only one output at a + time, this event tells which output it was. This event is only + sent prior to the presented event. + + As clients may bind to the same global wl_output multiple + times, this event is sent for each bound instance that matches + the synchronized output. If a client has not bound to the + right wl_output global at all, this event is not sent. + + + + + + + These flags provide information about how the presentation of + the related content update was done. The intent is to help + clients assess the reliability of the feedback and the visual + quality with respect to possible tearing and timings. The + flags are: + + VSYNC: + The presentation was synchronized to the "vertical retrace" by + the display hardware such that tearing does not happen. + Relying on user space scheduling is not acceptable for this + flag. If presentation is done by a copy to the active + frontbuffer, then it must guarantee that tearing cannot + happen. + + HW_CLOCK: + The display hardware provided measurements that the hardware + driver converted into a presentation timestamp. Sampling a + clock in user space is not acceptable for this flag. + + HW_COMPLETION: + The display hardware signalled that it started using the new + image content. The opposite of this is e.g. a timer being used + to guess when the display hardware has switched to the new + image content. + + ZERO_COPY: + The presentation of this update was done zero-copy. This means + the buffer from the client was given to display hardware as + is, without copying it. Compositing with OpenGL counts as + copying, even if textured directly from the client buffer. + Possible zero-copy cases include direct scanout of a + fullscreen surface and a surface on a hardware overlay. + + + + + + + + + + The associated content update was displayed to the user at the + indicated time (tv_sec_hi/lo, tv_nsec). For the interpretation of + the timestamp, see presentation.clock_id event. + + The timestamp corresponds to the time when the content update + turned into light the first time on the surface's main output. + Compositors may approximate this from the framebuffer flip + completion events from the system, and the latency of the + physical display path if known. + + This event is preceded by all related sync_output events + telling which output's refresh cycle the feedback corresponds + to, i.e. the main output for the surface. Compositors are + recommended to choose the output containing the largest part + of the wl_surface, or keeping the output they previously + chose. Having a stable presentation output association helps + clients predict future output refreshes (vblank). + + The 'refresh' argument gives the compositor's prediction of how + many nanoseconds after tv_sec, tv_nsec the very next output + refresh may occur. This is to further aid clients in + predicting future refreshes, i.e., estimating the timestamps + targeting the next few vblanks. If such prediction cannot + usefully be done, the argument is zero. + + If the output does not have a constant refresh rate, explicit + video mode switches excluded, then the refresh argument must + be zero. + + The 64-bit value combined from seq_hi and seq_lo is the value + of the output's vertical retrace counter when the content + update was first scanned out to the display. This value must + be compatible with the definition of MSC in + GLX_OML_sync_control specification. Note, that if the display + path has a non-zero latency, the time instant specified by + this counter may differ from the timestamp's. + + If the output does not have a concept of vertical retrace or a + refresh cycle, or the output device is self-refreshing without + a way to query the refresh count, then the arguments seq_hi + and seq_lo must be zero. + + + + + + + + + + + + + The content update was never displayed to the user. + + + + + diff --git a/src/3rdparty/wayland/protocols/qt_attribution.json b/src/3rdparty/wayland/protocols/qt_attribution.json index 745fafe5e5c..e5aaabcb185 100644 --- a/src/3rdparty/wayland/protocols/qt_attribution.json +++ b/src/3rdparty/wayland/protocols/qt_attribution.json @@ -249,5 +249,22 @@ "License": "MIT License", "LicenseFile": "MIT_LICENSE.txt", "Copyright": "Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved." + }, + + { + "Id": "presentation-time.xml", + "Name": "Presentation Time Protocol", + "QDocModule": "qtwaylandcompositor", + "QtUsage": "Used in the Qt Wayland Compositor", + "Files": "presentation-time.xml", + + "Description": "The presentaton time protocol is a way to get presentation timing feedback.", + "Homepage": "https://wayland.freedesktop.org", + "Version": "1", + "DownloadLocation": "https://gitlab.freedesktop.org/wayland/wayland-protocols/raw/1.18/stable/presentation-time/presentation-time.xml", + "LicenseId": "MIT", + "License": "MIT License", + "LicenseFile": "MIT_LICENSE.txt", + "Copyright": "Copyright © 2013, 2014 Collabora, Ltd." } ] From 1616b042bb428d0d31c0cead311c4b45ef4af41a Mon Sep 17 00:00:00 2001 From: Liang Qi Date: Mon, 13 Dec 2021 13:01:59 +0100 Subject: [PATCH 1028/1507] Client: support high-dpi mode for window icon MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes: QTBUG-90530 Pick-to: 6.3 6.2 5.15 Change-Id: Ib1f36e1cb89352dfac8a385a7b097cfc0226e813 Reviewed-by: David Edmundson Reviewed-by: Tor Arne Vestbø --- .../wayland/plugins/decorations/bradient/main.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp b/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp index 5aa9ad4a412..2a32df3442f 100644 --- a/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp +++ b/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp @@ -168,13 +168,10 @@ void QWaylandBradientDecoration::paint(QPaintDevice *device) // Window icon QIcon icon = waylandWindow()->windowIcon(); if (!icon.isNull()) { - QPixmap pixmap = icon.pixmap(QSize(128, 128)); - QPixmap scaled = pixmap.scaled(22, 22, Qt::IgnoreAspectRatio, Qt::SmoothTransformation); - QRectF iconRect(0, 0, 22, 22); - p.drawPixmap(iconRect.adjusted(margins().left() + BUTTON_SPACING, 4, - margins().left() + BUTTON_SPACING, 4), - scaled, iconRect); + iconRect.adjust(margins().left() + BUTTON_SPACING, 4, + margins().left() + BUTTON_SPACING, 4), + icon.paint(&p, iconRect.toRect()); } // Window title From 8b3de53ee666c8ea16c735180a7305df2494b16a Mon Sep 17 00:00:00 2001 From: Weng Xuetian Date: Sat, 18 Dec 2021 23:42:49 -0800 Subject: [PATCH 1029/1507] Set preedit cursor when cursor equals to 0 Pick-to: 6.3 6.2 5.15 Change-Id: I832fbb22d973b36ac4ab51570fc53bc2e4c3ed58 Reviewed-by: Liang Qi --- .../wayland/shared/qwaylandinputmethodeventbuilder.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/shared/qwaylandinputmethodeventbuilder.cpp b/src/plugins/platforms/wayland/shared/qwaylandinputmethodeventbuilder.cpp index cfc4a99f810..b52543fcb40 100644 --- a/src/plugins/platforms/wayland/shared/qwaylandinputmethodeventbuilder.cpp +++ b/src/plugins/platforms/wayland/shared/qwaylandinputmethodeventbuilder.cpp @@ -153,7 +153,7 @@ QInputMethodEvent *QWaylandInputMethodEventBuilder::buildPreedit(const QString & { QList attributes; - if (m_preeditCursor < 0) { + if (m_preeditCursor <= 0) { attributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::Cursor, 0, 0, QVariant())); } else if (m_preeditCursor > 0) { attributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::Cursor, indexFromWayland(text, m_preeditCursor), 1, QVariant())); From 46991c54c830b8c639b10d19ee9cd44930d696eb Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Wed, 10 Nov 2021 13:18:30 +0100 Subject: [PATCH 1030/1507] client: Fix crash on shutdown on Mesa driver On Wayland, then the mesa driver is in use, calling eglDestroySurface() while OpenGL commands are being executed may crash. While this means the driver does not operate by the specs in this case, the driver is so popular that it makes sense to work around it. To work around this, we read-lock the surface while rendering and wait for a write-lock before we destroy the EGL surface. [ChangeLog][QtWaylandClient] Fixed a crash on shutdown that could happen with some graphics-heavy applications when running on Mesa drivers. Pick-to: 6.3 Fixes: QTBUG-92249 Change-Id: I8b8461066cc9f948dc44ddeeddaa6e7d92b76f04 Reviewed-by: Liang Qi --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 13 ++++++++++++- src/plugins/platforms/wayland/qwaylandwindow_p.h | 3 +++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 3481a8fa2ae..0b4347a88e8 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -77,6 +77,7 @@ QWaylandWindow::QWaylandWindow(QWindow *window, QWaylandDisplay *display) : QPlatformWindow(window) , mDisplay(display) , mResizeAfterSwap(qEnvironmentVariableIsSet("QT_WAYLAND_RESIZE_AFTER_SWAP")) + , mSurfaceLock(QReadWriteLock::Recursive) { { bool ok; @@ -235,6 +236,16 @@ bool QWaylandWindow::shouldCreateSubSurface() const return QPlatformWindow::parent() != nullptr; } +void QWaylandWindow::beginFrame() +{ + mSurfaceLock.lockForRead(); +} + +void QWaylandWindow::endFrame() +{ + mSurfaceLock.unlock(); +} + void QWaylandWindow::reset() { delete mShellSurface; @@ -242,10 +253,10 @@ void QWaylandWindow::reset() delete mSubSurfaceWindow; mSubSurfaceWindow = nullptr; - invalidateSurface(); if (mSurface) { emit wlSurfaceDestroyed(); QWriteLocker lock(&mSurfaceLock); + invalidateSurface(); mSurface.reset(); } diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index 4eecdd861c2..d64c80c4157 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -233,6 +233,9 @@ public: void setXdgActivationToken(const QString &token); void requestXdgActivationToken(uint serial); + void beginFrame(); + void endFrame(); + public slots: void applyConfigure(); From 1a2e499e0e05a03460f4335d5266be485f97d3fa Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Tue, 9 Nov 2021 13:23:41 +0100 Subject: [PATCH 1031/1507] Fix missing update when toggling client-side decorations When CSD is toggled while a window is showing, it would change the size and recreate the buffers, but since the widget area remained the same size, we would not trigger a redraw. The result was that when you got any update to the window, it would redraw the widgets that had changed, and the rest would be transparent. Since this is a fairly specialized case, we fix it the simple way, by just issuing an extra update when it happens. This also required an update to the surface test, since there is an additional buffer commit in the beginning of the sequence now. Pick-to: 5.15 6.2 6.3 Fixes: QTBUG-95032 Change-Id: Ic4bdb9c66a2ea76546926dd622f2d2dac5dce10c Reviewed-by: Qt CI Bot Reviewed-by: Liang Qi --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 7 +++++++ tests/auto/wayland/surface/tst_surface.cpp | 4 ++++ 2 files changed, 11 insertions(+) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 0b4347a88e8..812373a2821 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -953,6 +953,13 @@ bool QWaylandWindow::createDecoration() subsurf->set_position(pos.x() + m.left(), pos.y() + m.top()); } sendExposeEvent(QRect(QPoint(), geometry().size())); + + // This is a special case where the buffer is recreated, but since + // the content rect remains the same, the widgets remain the same + // size and are not redrawn, leaving the new buffer empty. As a simple + // work-around, we trigger a full extra update whenever the client-side + // window decorations are toggled while the window is showing. + window()->requestUpdate(); } return mWindowDecoration; diff --git a/tests/auto/wayland/surface/tst_surface.cpp b/tests/auto/wayland/surface/tst_surface.cpp index 60d8913247c..f65ff08b7af 100644 --- a/tests/auto/wayland/surface/tst_surface.cpp +++ b/tests/auto/wayland/surface/tst_surface.cpp @@ -127,6 +127,10 @@ void tst_surface::waitForFrameCallbackGl() // Make sure we follow frame callbacks for some frames for (int i = 0; i < 5; ++i) { xdgPingAndWaitForPong(); // Make sure things have happened on the client + if (!qEnvironmentVariableIntValue("QT_WAYLAND_DISABLE_WINDOWDECORATION") && i == 0) { + QCOMPARE(bufferSpy.count(), 1); + bufferSpy.removeFirst(); + } exec([&] { QVERIFY(bufferSpy.empty()); // Make sure no extra buffers have arrived QVERIFY(!xdgToplevel()->surface()->m_waitingFrameCallbacks.empty()); From 05fefdbf57817aa0c6dd840813f52ed2c49fceef Mon Sep 17 00:00:00 2001 From: Cathy Park Date: Fri, 15 Oct 2021 17:35:26 +0900 Subject: [PATCH 1032/1507] client: Add waitForFrameSync for Vulkan Frames are processed by mFrameQueue in Qtwayand. However, in vulkan backend, frames are sent by handleUpdate() but waitForFrameSync() is not called which should handle frames in mFrameQueue. For the current vulkan backend, frames are only handled by drivers like mesa. So in the current vulkan backend, some particular animations don't run or are slow because frames sent by qtwayland are not being handled. Fixes: QTBUG-96222 Change-Id: Ifbab385ca619ef9461104eb8bd778f17093a56b5 Reviewed-by: Eskil Abrahamsen Blomfeldt Reviewed-by: YoungSun Park --- .../platforms/wayland/qwaylandvulkaninstance.cpp | 10 ++++++++++ .../platforms/wayland/qwaylandvulkaninstance_p.h | 1 + 2 files changed, 11 insertions(+) diff --git a/src/plugins/platforms/wayland/qwaylandvulkaninstance.cpp b/src/plugins/platforms/wayland/qwaylandvulkaninstance.cpp index 5edbd4757d6..51802257490 100644 --- a/src/plugins/platforms/wayland/qwaylandvulkaninstance.cpp +++ b/src/plugins/platforms/wayland/qwaylandvulkaninstance.cpp @@ -124,6 +124,16 @@ void QWaylandVulkanInstance::presentAboutToBeQueued(QWindow *window) qWarning() << "Attempted to call presentAboutToBeQueued() without a valid platform window"; return; } + + bool ok; + int frameCallbackTimeout = qEnvironmentVariableIntValue("QT_WAYLAND_FRAME_CALLBACK_TIMEOUT", &ok); + + if (ok) + mFrameCallbackTimeout = frameCallbackTimeout; + + if (w->format().swapInterval() > 0) + w->waitForFrameSync(mFrameCallbackTimeout); + w->handleUpdate(); } diff --git a/src/plugins/platforms/wayland/qwaylandvulkaninstance_p.h b/src/plugins/platforms/wayland/qwaylandvulkaninstance_p.h index 08246c4dcc7..f46ba3f7569 100644 --- a/src/plugins/platforms/wayland/qwaylandvulkaninstance_p.h +++ b/src/plugins/platforms/wayland/qwaylandvulkaninstance_p.h @@ -82,6 +82,7 @@ private: QVulkanInstance *m_instance = nullptr; PFN_vkGetPhysicalDeviceWaylandPresentationSupportKHR m_getPhysDevPresSupport = nullptr; PFN_vkCreateWaylandSurfaceKHR m_createSurface = nullptr; + int mFrameCallbackTimeout = 100; }; } // namespace QtWaylandClient From 1df3c996e84223fd2d0be689285b8b17e4d89f2f Mon Sep 17 00:00:00 2001 From: Tang Haixiang Date: Thu, 13 Jan 2022 15:09:46 +0800 Subject: [PATCH 1033/1507] wayland touch event to add key modifier Add touch event keyboard modifier for wayland, which is done in qpa xcb, which is very convenient on tablets with keyboards. Change-Id: I4e6ed369f3444da41d06f9a9a83addf7de0a4e91 Reviewed-by: Povilas Kanapickas Reviewed-by: David Edmundson --- src/plugins/platforms/wayland/qwaylandinputdevice.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index 3e59899de92..444b98ec336 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -1524,7 +1524,7 @@ void QWaylandInputDevice::Touch::touch_frame() return; } - QWindowSystemInterface::handleTouchEvent(window, mParent->mTouchDevice, mPendingTouchPoints); + QWindowSystemInterface::handleTouchEvent(window, mParent->mTouchDevice, mPendingTouchPoints, mParent->modifiers()); // Prepare state for next frame const auto prevTouchPoints = mPendingTouchPoints; From 92bbd0921efcd7ba1197da15b49ac72b155bbb1c Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Fri, 21 Jan 2022 10:36:12 +0100 Subject: [PATCH 1034/1507] CMake: Ensure qt_cmdline.cmake files exist for each configure.cmake Otherwise the configure script won't understand command line options like -no-feature-egl-extension-platform-wayland because the subdirectory configure.cmake files are only loaded by the configure script when there are accompanying qt_cmdline.cmake files. Pick-to: 6.2 6.3 Fixes: QTBUG-99802 Change-Id: Ifd6ea6f366ac5fe09a9eafe3be7d889044caa52f Reviewed-by: Joerg Bornemann --- src/plugins/platforms/wayland/qt_cmdline.cmake | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 src/plugins/platforms/wayland/qt_cmdline.cmake diff --git a/src/plugins/platforms/wayland/qt_cmdline.cmake b/src/plugins/platforms/wayland/qt_cmdline.cmake new file mode 100644 index 00000000000..e69de29bb2d From 199b82b5cf6bdf813ae1d4f9adb2004b41095c20 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 12 Jan 2022 09:20:56 -0800 Subject: [PATCH 1035/1507] XDG shell: fix warnings about unused variable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit qwaylandxdgshell.cpp:508:15: warning: unused variable ‘activation’ Pick-to: 6.3 Change-Id: I0e5f6bec596a4a78bd3bfffd16c995a0b7feef5c Reviewed-by: Eskil Abrahamsen Blomfeldt Reviewed-by: Aleix Pol Gonzalez --- .../plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp index 547631fd57e..2ca6eb9d341 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp @@ -505,7 +505,7 @@ void QWaylandXdgSurface::requestXdgActivationToken(quint32 serial) void QWaylandXdgSurface::setXdgActivationToken(const QString &token) { - if (auto *activation = m_shell->activation()) { + if (m_shell->activation()) { m_activationToken = token; } else { qCWarning(lcQpaWayland) << "zxdg_activation_v1 not available"; From 3047afe05f65997f67a052ae447b78d0135d3436 Mon Sep 17 00:00:00 2001 From: Seokha Ko Date: Mon, 24 Jan 2022 15:48:58 +0900 Subject: [PATCH 1036/1507] Fix wayland touch event to use time stamp from wayland compositor Touch events may be ignored if we set time stamp in handleTouchEvent() when handling touch events queued in wayland socket in main thread. So use time stamp from wayland compositor. Task-number: QTBUG-100150 Pick-to: 6.2 6.3 Change-Id: I14fd3791b4d29177c71662d1cf26c0eed0abb767 Reviewed-by: Shawn Rutledge Reviewed-by: Seokha Ko Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/plugins/platforms/wayland/qwaylandinputdevice.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index 444b98ec336..7d8726b4f9a 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -1405,7 +1405,7 @@ void QWaylandInputDevice::Touch::touch_down(uint32_t serial, void QWaylandInputDevice::Touch::touch_up(uint32_t serial, uint32_t time, int32_t id) { Q_UNUSED(serial); - Q_UNUSED(time); + mParent->mTime = time; mParent->handleTouchPoint(id, QEventPoint::Released); if (allTouchPointsReleased()) { @@ -1424,8 +1424,8 @@ void QWaylandInputDevice::Touch::touch_up(uint32_t serial, uint32_t time, int32_ void QWaylandInputDevice::Touch::touch_motion(uint32_t time, int32_t id, wl_fixed_t x, wl_fixed_t y) { - Q_UNUSED(time); QPointF position(wl_fixed_to_double(x), wl_fixed_to_double(y)); + mParent->mTime = time; mParent->handleTouchPoint(id, QEventPoint::Updated, position); } @@ -1524,7 +1524,7 @@ void QWaylandInputDevice::Touch::touch_frame() return; } - QWindowSystemInterface::handleTouchEvent(window, mParent->mTouchDevice, mPendingTouchPoints, mParent->modifiers()); + QWindowSystemInterface::handleTouchEvent(window, mParent->mTime, mParent->mTouchDevice, mPendingTouchPoints, mParent->modifiers()); // Prepare state for next frame const auto prevTouchPoints = mPendingTouchPoints; From 290f345d8451b32a28c42ba30a19b84e73e2abac Mon Sep 17 00:00:00 2001 From: Liang Qi Date: Tue, 25 Jan 2022 15:36:33 +0100 Subject: [PATCH 1037/1507] Fix build with -no-feature-tabletevent Pick-to: 6.2 6.3 5.15 Fixes: QTBUG-99965 Change-Id: Ib7fcf92973b4e559713ae27ad0c7f843f9122daf Reviewed-by: Eskil Abrahamsen Blomfeldt Reviewed-by: Alexandru Croitor --- src/plugins/platforms/wayland/CMakeLists.txt | 6 +++++- src/plugins/platforms/wayland/qwaylanddisplay.cpp | 4 ++++ src/plugins/platforms/wayland/qwaylanddisplay_p.h | 6 ++++++ src/plugins/platforms/wayland/qwaylandinputdevice.cpp | 4 ++++ src/plugins/platforms/wayland/qwaylandinputdevice_p.h | 6 ++++++ 5 files changed, 25 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/CMakeLists.txt b/src/plugins/platforms/wayland/CMakeLists.txt index 696a8b3d284..7bcb65c868b 100644 --- a/src/plugins/platforms/wayland/CMakeLists.txt +++ b/src/plugins/platforms/wayland/CMakeLists.txt @@ -44,7 +44,6 @@ qt_internal_add_module(WaylandClient qwaylandshmwindow.cpp qwaylandshmwindow_p.h qwaylandsubsurface.cpp qwaylandsubsurface_p.h qwaylandsurface.cpp qwaylandsurface_p.h - qwaylandtabletv2.cpp qwaylandtabletv2_p.h qwaylandtouch.cpp qwaylandtouch_p.h qwaylandwindow.cpp qwaylandwindow_p.h qwaylandwindowmanagerintegration.cpp qwaylandwindowmanagerintegration_p.h @@ -107,6 +106,11 @@ qt6_generate_wayland_protocol_client_sources(WaylandClient # ) # special case end +qt_internal_extend_target(WaylandClient CONDITION QT_FEATURE_tabletevent + SOURCES + qwaylandtabletv2.cpp qwaylandtabletv2_p.h +) + qt_internal_extend_target(WaylandClient CONDITION QT_FEATURE_wayland_text_input_v4_wip SOURCES qwaylandtextinputv4.cpp qwaylandtextinputv4_p.h diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index e198774294d..4e0a90b7a0c 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -75,7 +75,9 @@ #include "qwaylandpointergestures_p.h" #include "qwaylandsubsurface_p.h" #include "qwaylandtouch_p.h" +#if QT_CONFIG(tabletevent) #include "qwaylandtabletv2_p.h" +#endif #include "qwaylandqtkey_p.h" #include @@ -524,8 +526,10 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin mTouchExtension.reset(new QWaylandTouchExtension(this, id)); } else if (interface == QLatin1String(QWaylandQtKeyExtension::interface()->name)) { mQtKeyExtension.reset(new QWaylandQtKeyExtension(this, id)); +#if QT_CONFIG(tabletevent) } else if (interface == QLatin1String(QWaylandTabletManagerV2::interface()->name)) { mTabletManager.reset(new QWaylandTabletManagerV2(this, id, qMin(1, int(version)))); +#endif } else if (interface == QLatin1String(QWaylandPointerGestures::interface()->name)) { mPointerGestures.reset(new QWaylandPointerGestures(this, id, 1)); #if QT_CONFIG(wayland_client_primary_selection) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay_p.h b/src/plugins/platforms/wayland/qwaylanddisplay_p.h index cb345d7a049..8d8000d2a3c 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay_p.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay_p.h @@ -101,7 +101,9 @@ class QWaylandDataDeviceManager; #if QT_CONFIG(wayland_client_primary_selection) class QWaylandPrimarySelectionDeviceManagerV1; #endif +#if QT_CONFIG(tabletevent) class QWaylandTabletManagerV2; +#endif class QWaylandPointerGestures; class QWaylandTouchExtension; class QWaylandQtKeyExtension; @@ -168,7 +170,9 @@ public: QWaylandPrimarySelectionDeviceManagerV1 *primarySelectionManager() const { return mPrimarySelectionManager.data(); } #endif QtWayland::qt_surface_extension *windowExtension() const { return mWindowExtension.data(); } +#if QT_CONFIG(tabletevent) QWaylandTabletManagerV2 *tabletManager() const { return mTabletManager.data(); } +#endif QWaylandPointerGestures *pointerGestures() const { return mPointerGestures.data(); } QWaylandTouchExtension *touchExtension() const { return mTouchExtension.data(); } QtWayland::qt_text_input_method_manager_v1 *textInputMethodManager() const { return mTextInputMethodManager.data(); } @@ -277,7 +281,9 @@ private: QScopedPointer mTouchExtension; QScopedPointer mQtKeyExtension; QScopedPointer mWindowManagerIntegration; +#if QT_CONFIG(tabletevent) QScopedPointer mTabletManager; +#endif QScopedPointer mPointerGestures; #if QT_CONFIG(wayland_client_primary_selection) QScopedPointer mPrimarySelectionManager; diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index 7d8726b4f9a..4c32a534d48 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -50,7 +50,9 @@ #if QT_CONFIG(wayland_client_primary_selection) #include "qwaylandprimaryselectionv1_p.h" #endif +#if QT_CONFIG(tabletevent) #include "qwaylandtabletv2_p.h" +#endif #include "qwaylandpointergestures_p.h" #include "qwaylandtouch_p.h" #include "qwaylandscreen_p.h" @@ -435,8 +437,10 @@ QWaylandInputDevice::QWaylandInputDevice(QWaylandDisplay *display, int version, if (mQDisplay->textInputMethodManager()) mTextInputMethod.reset(new QWaylandTextInputMethod(mQDisplay, mQDisplay->textInputMethodManager()->get_text_input_method(wl_seat()))); +#if QT_CONFIG(tabletevent) if (auto *tm = mQDisplay->tabletManager()) mTabletSeat.reset(new QWaylandTabletSeatV2(tm, this)); +#endif } // Can't be in header because dtors for scoped pointers aren't known there. diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h index ef9143922d7..a6b69c989e5 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h +++ b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h @@ -90,7 +90,9 @@ class QWaylandDisplay; #if QT_CONFIG(wayland_client_primary_selection) class QWaylandPrimarySelectionDeviceV1; #endif +#if QT_CONFIG(tabletevent) class QWaylandTabletSeatV2; +#endif class QWaylandPointerGestures; class QWaylandPointerGestureSwipe; class QWaylandPointerGesturePinch; @@ -135,8 +137,10 @@ public: QWaylandPrimarySelectionDeviceV1 *primarySelectionDevice() const; #endif +#if QT_CONFIG(tabletevent) void setTabletSeat(QWaylandTabletSeatV2 *tabletSeat); QWaylandTabletSeatV2* tabletSeat() const; +#endif void setTextInput(QWaylandTextInputInterface *textInput); QWaylandTextInputInterface *textInput() const; @@ -201,7 +205,9 @@ protected: QScopedPointer mTextInput; QScopedPointer mTextInputMethod; +#if QT_CONFIG(tabletevent) QScopedPointer mTabletSeat; +#endif uint32_t mTime = 0; uint32_t mSerial = 0; From 2e6aed4ffd106b34f0505047a687284c3f8ce8c2 Mon Sep 17 00:00:00 2001 From: Youngjin Kim Date: Thu, 2 Sep 2021 10:14:32 +0900 Subject: [PATCH 1038/1507] Use scope resolution operator for request If the combination of the name of the protocol interface and the name of its request is same as another interface name, it can cause problem in calling the constructor instead of method generated by wayland-scanner when calling request. For example, if you have an interface named "foo" and its request named "bar", it might conflict with another interface named "foo_bar". A real example for this is presentation_time protocol which has a request "feedback" in the interface "wp_presentation" while it also has another interface named as "wp_presentation_feedback". Pick-to: 6.3 Change-Id: I7c007978d4aa404d10441643d5461372f33954e5 Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/tools/qtwaylandscanner/qtwaylandscanner.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp index 93f4b68ff64..f84673d461a 100644 --- a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp +++ b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp @@ -1236,7 +1236,7 @@ bool Scanner::process() printf("\n"); } int actualArgumentCount = new_id ? int(e.arguments.size()) - 1 : int(e.arguments.size()); - printf(" %s%s_%s(\n", new_id ? "return " : "", interfaceName, e.name.constData()); + printf(" %s::%s_%s(\n", new_id ? "return " : "", interfaceName, e.name.constData()); printf(" m_%s%s", interfaceName, actualArgumentCount > 0 ? "," : ""); bool needsComma = false; for (const WaylandArgument &a : e.arguments) { From a0b4d3e947f12310468080ca92647cddafa4e08e Mon Sep 17 00:00:00 2001 From: Dominik Holland Date: Wed, 19 Jan 2022 11:17:19 +0100 Subject: [PATCH 1039/1507] Add client support for the text-input-unstable-v1 protocol This is used by weston for forwarding virtualkeyboard related event from keyboard applications to a Qt client. Right now Qt only supports text-input-unstable-v2, v4 and the special qt-input-method protocol, while weston only supports text-input-unstable-v1. Without this, a virtual-keyboard application can't be used with a Qt client within weston. Change-Id: I9a34a87100854bb0b0f76762ced56419e70c297e Reviewed-by: Inho Lee Reviewed-by: Eskil Abrahamsen Blomfeldt --- .../protocols/text-input-unstable-v1.xml | 385 +++++++++++++++++ src/plugins/platforms/wayland/CMakeLists.txt | 2 + .../platforms/wayland/qwaylanddisplay.cpp | 38 +- .../platforms/wayland/qwaylanddisplay_p.h | 3 + .../wayland/qwaylandinputcontext.cpp | 4 +- .../platforms/wayland/qwaylandinputdevice.cpp | 7 + .../platforms/wayland/qwaylandintegration.cpp | 4 +- .../platforms/wayland/qwaylandtextinputv1.cpp | 395 ++++++++++++++++++ .../platforms/wayland/qwaylandtextinputv1_p.h | 149 +++++++ 9 files changed, 981 insertions(+), 6 deletions(-) create mode 100644 src/3rdparty/wayland/protocols/text-input-unstable-v1.xml create mode 100644 src/plugins/platforms/wayland/qwaylandtextinputv1.cpp create mode 100644 src/plugins/platforms/wayland/qwaylandtextinputv1_p.h diff --git a/src/3rdparty/wayland/protocols/text-input-unstable-v1.xml b/src/3rdparty/wayland/protocols/text-input-unstable-v1.xml new file mode 100644 index 00000000000..6ee266522a5 --- /dev/null +++ b/src/3rdparty/wayland/protocols/text-input-unstable-v1.xml @@ -0,0 +1,385 @@ + + + + + Copyright © 2012, 2013 Intel Corporation + + 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. + + + + + An object used for text input. Adds support for text input and input + methods to applications. A text_input object is created from a + wl_text_input_manager and corresponds typically to a text entry in an + application. + + Requests are used to activate/deactivate the text_input object and set + state information like surrounding and selected text or the content type. + The information about entered text is sent to the text_input object via + the pre-edit and commit events. Using this interface removes the need + for applications to directly process hardware key events and compose text + out of them. + + Text is generally UTF-8 encoded, indices and lengths are in bytes. + + Serials are used to synchronize the state between the text input and + an input method. New serials are sent by the text input in the + commit_state request and are used by the input method to indicate + the known text input state in events like preedit_string, commit_string, + and keysym. The text input can then ignore events from the input method + which are based on an outdated state (for example after a reset). + + Warning! The protocol described in this file is experimental and + backward incompatible changes may be made. Backward compatible changes + may be added together with the corresponding interface version bump. + Backward incompatible changes are done by bumping the version number in + the protocol and interface names and resetting the interface version. + Once the protocol is to be declared stable, the 'z' prefix and the + version number in the protocol and interface names are removed and the + interface version number is reset. + + + + + Requests the text_input object to be activated (typically when the + text entry gets focus). + + The seat argument is a wl_seat which maintains the focus for this + activation. The surface argument is a wl_surface assigned to the + text_input object and tracked for focus lost. The enter event + is emitted on successful activation. + + + + + + + + Requests the text_input object to be deactivated (typically when the + text entry lost focus). The seat argument is a wl_seat which was used + for activation. + + + + + + + Requests input panels (virtual keyboard) to show. + + + + + + Requests input panels (virtual keyboard) to hide. + + + + + + Should be called by an editor widget when the input state should be + reset, for example after the text was changed outside of the normal + input method flow. + + + + + + Sets the plain surrounding text around the input position. Text is + UTF-8 encoded. Cursor is the byte offset within the + surrounding text. Anchor is the byte offset of the + selection anchor within the surrounding text. If there is no selected + text anchor, then it is the same as cursor. + + + + + + + + + Content hint is a bitmask to allow to modify the behavior of the text + input. + + + + + + + + + + + + + + + + + + + The content purpose allows to specify the primary purpose of a text + input. + + This allows an input method to show special purpose input panels with + extra characters or to disallow some characters. + + + + + + + + + + + + + + + + + + + Sets the content purpose and content hint. While the purpose is the + basic purpose of an input field, the hint flags allow to modify some + of the behavior. + + When no content type is explicitly set, a normal content purpose with + default hints (auto completion, auto correction, auto capitalization) + should be assumed. + + + + + + + + + + + + + + + Sets a specific language. This allows for example a virtual keyboard to + show a language specific layout. The "language" argument is an RFC-3066 + format language tag. + + It could be used for example in a word processor to indicate the + language of the currently edited document or in an instant message + application which tracks languages of contacts. + + + + + + + + + + + + + + + + Notify the text_input object when it received focus. Typically in + response to an activate request. + + + + + + + Notify the text_input object when it lost focus. Either in response + to a deactivate request or when the assigned surface lost focus or was + destroyed. + + + + + + Transfer an array of 0-terminated modifier names. The position in + the array is the index of the modifier as used in the modifiers + bitmask in the keysym event. + + + + + + + Notify when the visibility state of the input panel changed. + + + + + + + Notify when a new composing text (pre-edit) should be set around the + current cursor position. Any previously set composing text should + be removed. + + The commit text can be used to replace the preedit text on reset + (for example on unfocus). + + The text input should also handle all preedit_style and preedit_cursor + events occurring directly before preedit_string. + + + + + + + + + + + + + + + + + + + + Sets styling information on composing text. The style is applied for + length bytes from index relative to the beginning of the composing + text (as byte offset). Multiple styles can + be applied to a composing text by sending multiple preedit_styling + events. + + This event is handled as part of a following preedit_string event. + + + + + + + + + Sets the cursor position inside the composing text (as byte + offset) relative to the start of the composing text. When index is a + negative number no cursor is shown. + + This event is handled as part of a following preedit_string event. + + + + + + + Notify when text should be inserted into the editor widget. The text to + commit could be either just a single character after a key press or the + result of some composing (pre-edit). It could also be an empty text + when some text should be removed (see delete_surrounding_text) or when + the input cursor should be moved (see cursor_position). + + Any previously set composing text should be removed. + + + + + + + + Notify when the cursor or anchor position should be modified. + + This event should be handled as part of a following commit_string + event. + + + + + + + + Notify when the text around the current cursor position should be + deleted. + + Index is relative to the current cursor (in bytes). + Length is the length of deleted text (in bytes). + + This event should be handled as part of a following commit_string + event. + + + + + + + + Notify when a key event was sent. Key events should not be used + for normal text input operations, which should be done with + commit_string, delete_surrounding_text, etc. The key event follows + the wl_keyboard key event convention. Sym is an XKB keysym, state a + wl_keyboard key_state. Modifiers are a mask for effective modifiers + (where the modifier indices are set by the modifiers_map event) + + + + + + + + + + + Sets the language of the input text. The "language" argument is an + RFC-3066 format language tag. + + + + + + + + + + + + + + Sets the text direction of input text. + + It is mainly needed for showing an input cursor on the correct side of + the editor when there is no input done yet and making sure neutral + direction text is laid out properly. + + + + + + + + + A factory for text_input objects. This object is a global singleton. + + + + + Creates a new text_input object. + + + + + + diff --git a/src/plugins/platforms/wayland/CMakeLists.txt b/src/plugins/platforms/wayland/CMakeLists.txt index 7bcb65c868b..1041f31e15c 100644 --- a/src/plugins/platforms/wayland/CMakeLists.txt +++ b/src/plugins/platforms/wayland/CMakeLists.txt @@ -29,6 +29,7 @@ qt_internal_add_module(WaylandClient qwaylanddisplay.cpp qwaylanddisplay_p.h qwaylandextendedsurface.cpp qwaylandextendedsurface_p.h qwaylandinputcontext.cpp qwaylandinputcontext_p.h + qwaylandtextinputv1.cpp qwaylandtextinputv1_p.h qwaylandtextinputv2.cpp qwaylandtextinputv2_p.h qwaylandtextinputinterface.cpp qwaylandtextinputinterface_p.h qwaylandinputdevice.cpp qwaylandinputdevice_p.h @@ -75,6 +76,7 @@ qt6_generate_wayland_protocol_client_sources(WaylandClient FILES ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/pointer-gestures-unstable-v1.xml ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/tablet-unstable-v2.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/text-input-unstable-v1.xml ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/text-input-unstable-v2.xml ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/text-input-unstable-v4-wip.xml ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/wayland.xml diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index 4e0a90b7a0c..5937172f052 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -60,6 +60,7 @@ #include #endif #include "qwaylandhardwareintegration_p.h" +#include "qwaylandtextinputv1_p.h" #include "qwaylandtextinputv2_p.h" #if QT_WAYLAND_TEXT_INPUT_V4_WIP #include "qwaylandtextinputv4_p.h" @@ -80,6 +81,7 @@ #endif #include "qwaylandqtkey_p.h" +#include #include #include #include @@ -453,9 +455,11 @@ void QWaylandDisplay::checkTextInputProtocol() { QStringList tips, timps; // for text input protocols and text input manager protocols tips << QLatin1String(QtWayland::qt_text_input_method_v1::interface()->name) - << QLatin1String(QtWayland::zwp_text_input_v2::interface()->name); + << QLatin1String(QtWayland::zwp_text_input_v2::interface()->name) + << QLatin1String(QtWayland::zwp_text_input_v1::interface()->name); timps << QLatin1String(QtWayland::qt_text_input_method_manager_v1::interface()->name) - << QLatin1String(QtWayland::zwp_text_input_manager_v2::interface()->name); + << QLatin1String(QtWayland::zwp_text_input_manager_v2::interface()->name) + << QLatin1String(QtWayland::zwp_text_input_manager_v1::interface()->name); #if QT_WAYLAND_TEXT_INPUT_V4_WIP tips << QLatin1String(QtWayland::zwp_text_input_v4::interface()->name); timps << QLatin1String(QtWayland::zwp_text_input_manager_v4::interface()->name); @@ -540,6 +544,7 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin && (mTextInputManagerList.contains(interface) && mTextInputManagerList.indexOf(interface) < mTextInputManagerIndex)) { qCDebug(lcQpaWayland) << "text input: register qt_text_input_method_manager_v1"; if (mTextInputManagerIndex < INT_MAX) { + mTextInputManagerv1.reset(); mTextInputManagerv2.reset(); #if QT_WAYLAND_TEXT_INPUT_V4_WIP mTextInputManagerv4.reset(); @@ -553,11 +558,34 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin inputDevice->setTextInputMethod(new QWaylandTextInputMethod(this, mTextInputMethodManager->get_text_input_method(inputDevice->wl_seat()))); mWaylandIntegration->reconfigureInputContext(); mTextInputManagerIndex = mTextInputManagerList.indexOf(interface); + } else if (interface == QLatin1String(QtWayland::zwp_text_input_manager_v1::interface()->name) + && (mTextInputManagerList.contains(interface) && mTextInputManagerList.indexOf(interface) < mTextInputManagerIndex)) { + qCDebug(lcQpaWayland) << "text input: register zwp_text_input_v1"; + if (mTextInputManagerIndex < INT_MAX) { + mTextInputMethodManager.reset(); + mTextInputManagerv2.reset(); +#if QT_WAYLAND_TEXT_INPUT_V4_WIP + mTextInputManagerv4.reset(); +#endif // QT_WAYLAND_TEXT_INPUT_V4_WIP + for (QWaylandInputDevice *inputDevice : qAsConst(mInputDevices)) + inputDevice->setTextInputMethod(nullptr); + } + + mTextInputManagerv1.reset(new QtWayland::zwp_text_input_manager_v1(registry, id, 1)); + for (QWaylandInputDevice *inputDevice : qAsConst(mInputDevices)) { + auto textInput = new QWaylandTextInputv1(this, mTextInputManagerv1->create_text_input()); + textInput->setSeat(inputDevice->wl_seat()); + inputDevice->setTextInput(textInput); + } + + mWaylandIntegration->reconfigureInputContext(); + mTextInputManagerIndex = mTextInputManagerList.indexOf(interface); } else if (interface == QLatin1String(QtWayland::zwp_text_input_manager_v2::interface()->name) && (mTextInputManagerList.contains(interface) && mTextInputManagerList.indexOf(interface) < mTextInputManagerIndex)) { qCDebug(lcQpaWayland) << "text input: register zwp_text_input_v2"; if (mTextInputManagerIndex < INT_MAX) { mTextInputMethodManager.reset(); + mTextInputManagerv1.reset(); #if QT_WAYLAND_TEXT_INPUT_V4_WIP mTextInputManagerv4.reset(); #endif // QT_WAYLAND_TEXT_INPUT_V4_WIP @@ -633,6 +661,12 @@ void QWaylandDisplay::registry_global_remove(uint32_t id) } } } + if (global.interface == QLatin1String(QtWayland::zwp_text_input_manager_v1::interface()->name)) { + mTextInputManagerv1.reset(); + for (QWaylandInputDevice *inputDevice : qAsConst(mInputDevices)) + inputDevice->setTextInput(nullptr); + mWaylandIntegration->reconfigureInputContext(); + } if (global.interface == QLatin1String(QtWayland::zwp_text_input_manager_v2::interface()->name)) { mTextInputManagerv2.reset(); for (QWaylandInputDevice *inputDevice : qAsConst(mInputDevices)) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay_p.h b/src/plugins/platforms/wayland/qwaylanddisplay_p.h index 8d8000d2a3c..cf123cba3b2 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay_p.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay_p.h @@ -82,6 +82,7 @@ class QPlatformPlaceholderScreen; namespace QtWayland { class qt_surface_extension; + class zwp_text_input_manager_v1; class zwp_text_input_manager_v2; class zwp_text_input_manager_v4; class qt_text_input_method_manager_v1; @@ -176,6 +177,7 @@ public: QWaylandPointerGestures *pointerGestures() const { return mPointerGestures.data(); } QWaylandTouchExtension *touchExtension() const { return mTouchExtension.data(); } QtWayland::qt_text_input_method_manager_v1 *textInputMethodManager() const { return mTextInputMethodManager.data(); } + QtWayland::zwp_text_input_manager_v1 *textInputManagerv1() const { return mTextInputManagerv1.data(); } QtWayland::zwp_text_input_manager_v2 *textInputManagerv2() const { return mTextInputManagerv2.data(); } QtWayland::zwp_text_input_manager_v4 *textInputManagerv4() const { return mTextInputManagerv4.data(); } QWaylandHardwareIntegration *hardwareIntegration() const { return mHardwareIntegration.data(); } @@ -289,6 +291,7 @@ private: QScopedPointer mPrimarySelectionManager; #endif QScopedPointer mTextInputMethodManager; + QScopedPointer mTextInputManagerv1; QScopedPointer mTextInputManagerv2; QScopedPointer mTextInputManagerv4; QScopedPointer mHardwareIntegration; diff --git a/src/plugins/platforms/wayland/qwaylandinputcontext.cpp b/src/plugins/platforms/wayland/qwaylandinputcontext.cpp index c594852777a..32433cdc02e 100644 --- a/src/plugins/platforms/wayland/qwaylandinputcontext.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputcontext.cpp @@ -71,9 +71,9 @@ QWaylandInputContext::~QWaylandInputContext() bool QWaylandInputContext::isValid() const { #if QT_WAYLAND_TEXT_INPUT_V4_WIP - return mDisplay->textInputManagerv2() != nullptr || mDisplay->textInputManagerv4() != nullptr; + return mDisplay->textInputManagerv2() != nullptr || mDisplay->textInputManagerv1() != nullptr || mDisplay->textInputManagerv4() != nullptr; #else // QT_WAYLAND_TEXT_INPUT_V4_WIP - return mDisplay->textInputManagerv2() != nullptr; + return mDisplay->textInputManagerv2() != nullptr || mDisplay->textInputManagerv1() != nullptr; #endif // QT_WAYLAND_TEXT_INPUT_V4_WIP } diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index 4c32a534d48..34ca328a62b 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -59,6 +59,7 @@ #include "qwaylandcursor_p.h" #include "qwaylanddisplay_p.h" #include "qwaylandshmbackingstore_p.h" +#include "qwaylandtextinputv1_p.h" #include "qwaylandtextinputv2_p.h" #if QT_WAYLAND_TEXT_INPUT_V4_WIP #include "qwaylandtextinputv4_p.h" @@ -426,6 +427,12 @@ QWaylandInputDevice::QWaylandInputDevice(QWaylandDisplay *display, int version, setPrimarySelectionDevice(psm->createDevice(this)); #endif + if (mQDisplay->textInputManagerv1()) { + auto textInput = new QWaylandTextInputv1(mQDisplay, mQDisplay->textInputManagerv1()->create_text_input()); + textInput->setSeat(wl_seat()); + mTextInput.reset(textInput); + } + if (mQDisplay->textInputManagerv2()) mTextInput.reset(new QWaylandTextInputv2(mQDisplay, mQDisplay->textInputManagerv2()->get_text_input(wl_seat()))); diff --git a/src/plugins/platforms/wayland/qwaylandintegration.cpp b/src/plugins/platforms/wayland/qwaylandintegration.cpp index 274ae9a9df7..721af8347d6 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandintegration.cpp @@ -514,9 +514,9 @@ void QWaylandIntegration::reconfigureInputContext() if (mDisplay->textInputMethodManager() != nullptr) mInputContext.reset(new QWaylandInputMethodContext(mDisplay.data())); #if QT_WAYLAND_TEXT_INPUT_V4_WIP - else if (mDisplay->textInputManagerv2() != nullptr || mDisplay->textInputManagerv4() != nullptr) + else if (mDisplay->textInputManagerv1() != nullptr || mDisplay->textInputManagerv2() != nullptr || mDisplay->textInputManagerv4() != nullptr) #else // QT_WAYLAND_TEXT_INPUT_V4_WIP - else if (mDisplay->textInputManagerv2() != nullptr) + else if (mDisplay->textInputManagerv1() != nullptr || mDisplay->textInputManagerv2() != nullptr) #endif // QT_WAYLAND_TEXT_INPUT_V4_WIP mInputContext.reset(new QWaylandInputContext(mDisplay.data())); } else { diff --git a/src/plugins/platforms/wayland/qwaylandtextinputv1.cpp b/src/plugins/platforms/wayland/qwaylandtextinputv1.cpp new file mode 100644 index 00000000000..5e204a7ffba --- /dev/null +++ b/src/plugins/platforms/wayland/qwaylandtextinputv1.cpp @@ -0,0 +1,395 @@ +/**************************************************************************** +** +** Copyright (C) 2021 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the QtWaylandClient module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#include + +#include "qwaylandtextinputv1_p.h" + +#include "qwaylandwindow_p.h" +#include "qwaylandinputmethodeventbuilder_p.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +QT_BEGIN_NAMESPACE + +Q_DECLARE_LOGGING_CATEGORY(qLcQpaInputMethods) + +namespace QtWaylandClient { + +namespace { + +const Qt::InputMethodQueries supportedQueries = Qt::ImEnabled | + Qt::ImSurroundingText | + Qt::ImCursorPosition | + Qt::ImAnchorPosition | + Qt::ImHints | + Qt::ImCursorRectangle | + Qt::ImPreferredLanguage; +} + +QWaylandTextInputv1::QWaylandTextInputv1(QWaylandDisplay *display, struct ::zwp_text_input_v1 *text_input) + : QtWayland::zwp_text_input_v1(text_input) + , m_display(display) +{ +} + +QWaylandTextInputv1::~QWaylandTextInputv1() +{ + if (m_resetCallback) + wl_callback_destroy(m_resetCallback); +} + +void QWaylandTextInputv1::reset() +{ + m_builder.reset(); + m_preeditCommit = QString(); + updateState(Qt::ImQueryAll, QWaylandTextInputInterface::update_state_reset); +} + +void QWaylandTextInputv1::commit() +{ + if (QObject *o = QGuiApplication::focusObject()) { + QInputMethodEvent event; + event.setCommitString(m_preeditCommit); + QCoreApplication::sendEvent(o, &event); + } + + reset(); +} + +const wl_callback_listener QWaylandTextInputv1::callbackListener = { + QWaylandTextInputv1::resetCallback +}; + +void QWaylandTextInputv1::resetCallback(void *data, wl_callback *, uint32_t) +{ + QWaylandTextInputv1 *self = static_cast(data); + + if (self->m_resetCallback) { + wl_callback_destroy(self->m_resetCallback); + self->m_resetCallback = nullptr; + } +} + +void QWaylandTextInputv1::updateState(Qt::InputMethodQueries queries, uint32_t flags) +{ + if (!QGuiApplication::focusObject()) + return; + + if (!QGuiApplication::focusWindow() || !QGuiApplication::focusWindow()->handle()) + return; + + auto *window = static_cast(QGuiApplication::focusWindow()->handle()); + auto *surface = window->wlSurface(); + if (!surface || (surface != m_surface)) + return; + + queries &= supportedQueries; + + // Surrounding text, cursor and anchor positions are transferred together + if ((queries & Qt::ImSurroundingText) || (queries & Qt::ImCursorPosition) || (queries & Qt::ImAnchorPosition)) + queries |= Qt::ImSurroundingText | Qt::ImCursorPosition | Qt::ImAnchorPosition; + + QInputMethodQueryEvent event(queries); + QCoreApplication::sendEvent(QGuiApplication::focusObject(), &event); + + if ((queries & Qt::ImSurroundingText) || (queries & Qt::ImCursorPosition) || (queries & Qt::ImAnchorPosition)) { + QString text = event.value(Qt::ImSurroundingText).toString(); + int cursor = event.value(Qt::ImCursorPosition).toInt(); + int anchor = event.value(Qt::ImAnchorPosition).toInt(); + + // Make sure text is not too big + if (text.toUtf8().size() > 2048) { + int c = qAbs(cursor - anchor) <= 512 ? qMin(cursor, anchor) + qAbs(cursor - anchor) / 2: cursor; + + const int offset = c - qBound(0, c, 512 - qMin(text.size() - c, 256)); + text = text.mid(offset + c - 256, 512); + cursor -= offset; + anchor -= offset; + } + + set_surrounding_text(text, QWaylandInputMethodEventBuilder::indexToWayland(text, cursor), QWaylandInputMethodEventBuilder::indexToWayland(text, anchor)); + } + + if (queries & Qt::ImHints) { + QWaylandInputMethodContentType contentType = QWaylandInputMethodContentType::convert(static_cast(event.value(Qt::ImHints).toInt())); + set_content_type(contentType.hint, contentType.purpose); + } + + if (queries & Qt::ImCursorRectangle) { + const QRect &cRect = event.value(Qt::ImCursorRectangle).toRect(); + const QRect &windowRect = QGuiApplication::inputMethod()->inputItemTransform().mapRect(cRect); + const QMargins margins = window->frameMargins(); + const QRect &surfaceRect = windowRect.translated(margins.left(), margins.top()); + set_cursor_rectangle(surfaceRect.x(), surfaceRect.y(), surfaceRect.width(), surfaceRect.height()); + } + + if (queries & Qt::ImPreferredLanguage) { + const QString &language = event.value(Qt::ImPreferredLanguage).toString(); + set_preferred_language(language); + } + + if (flags == QWaylandTextInputInterface::update_state_reset) + QtWayland::zwp_text_input_v1::reset(); + else + commit_state(m_serial); +} + +void QWaylandTextInputv1::setCursorInsidePreedit(int) +{ + // Not supported yet +} + +bool QWaylandTextInputv1::isInputPanelVisible() const +{ + return m_inputPanelVisible; +} + +QRectF QWaylandTextInputv1::keyboardRect() const +{ + return m_keyboardRectangle; +} + +QLocale QWaylandTextInputv1::locale() const +{ + return m_locale; +} + +Qt::LayoutDirection QWaylandTextInputv1::inputDirection() const +{ + return m_inputDirection; +} + +void QWaylandTextInputv1::zwp_text_input_v1_enter(::wl_surface *surface) +{ + m_surface = surface; + + updateState(Qt::ImQueryAll, QWaylandTextInputInterface::update_state_reset); +} + +void QWaylandTextInputv1::zwp_text_input_v1_leave() +{ + m_surface = nullptr; +} + +void QWaylandTextInputv1::zwp_text_input_v1_modifiers_map(wl_array *map) +{ + const QList modifiersMap = QByteArray::fromRawData(static_cast(map->data), map->size).split('\0'); + + m_modifiersMap.clear(); + + for (const QByteArray &modifier : modifiersMap) { + if (modifier == "Shift") + m_modifiersMap.append(Qt::ShiftModifier); + else if (modifier == "Control") + m_modifiersMap.append(Qt::ControlModifier); + else if (modifier == "Alt") + m_modifiersMap.append(Qt::AltModifier); + else if (modifier == "Mod1") + m_modifiersMap.append(Qt::AltModifier); + else if (modifier == "Mod4") + m_modifiersMap.append(Qt::MetaModifier); + else + m_modifiersMap.append(Qt::NoModifier); + } +} + +void QWaylandTextInputv1::zwp_text_input_v1_input_panel_state(uint32_t visible) +{ + const bool inputPanelVisible = (visible == 1); + if (m_inputPanelVisible != inputPanelVisible) { + m_inputPanelVisible = inputPanelVisible; + QGuiApplicationPrivate::platformIntegration()->inputContext()->emitInputPanelVisibleChanged(); + } +} + +void QWaylandTextInputv1::zwp_text_input_v1_preedit_string(uint32_t serial, const QString &text, const QString &commit) +{ + m_serial = serial; + + if (m_resetCallback) { + qCDebug(qLcQpaInputMethods()) << "discard preedit_string: reset not confirmed"; + m_builder.reset(); + return; + } + + if (!QGuiApplication::focusObject()) + return; + + QInputMethodEvent *event = m_builder.buildPreedit(text); + + m_builder.reset(); + m_preeditCommit = commit; + + QCoreApplication::sendEvent(QGuiApplication::focusObject(), event); + delete event; +} + +void QWaylandTextInputv1::zwp_text_input_v1_preedit_styling(uint32_t index, uint32_t length, uint32_t style) +{ + m_builder.addPreeditStyling(index, length, style); +} + +void QWaylandTextInputv1::zwp_text_input_v1_preedit_cursor(int32_t index) +{ + m_builder.setPreeditCursor(index); +} + +void QWaylandTextInputv1::zwp_text_input_v1_commit_string(uint32_t serial, const QString &text) +{ + m_serial = serial; + + if (m_resetCallback) { + qCDebug(qLcQpaInputMethods()) << "discard commit_string: reset not confirmed"; + m_builder.reset(); + return; + } + + if (!QGuiApplication::focusObject()) + return; + + // When committing the text, the preeditString needs to be reset, to prevent it to be + // send again in the commit() function + m_preeditCommit.clear(); + + QInputMethodEvent *event = m_builder.buildCommit(text); + + m_builder.reset(); + + QCoreApplication::sendEvent(QGuiApplication::focusObject(), event); + delete event; +} + +void QWaylandTextInputv1::zwp_text_input_v1_cursor_position(int32_t index, int32_t anchor) +{ + m_builder.setCursorPosition(index, anchor); +} + +void QWaylandTextInputv1::zwp_text_input_v1_delete_surrounding_text(int32_t before_length, uint32_t after_length) +{ + //before_length is negative, but the builder expects it to be positive + m_builder.setDeleteSurroundingText(-before_length, after_length); +} + +void QWaylandTextInputv1::zwp_text_input_v1_keysym(uint32_t serial, uint32_t time, uint32_t sym, uint32_t state, uint32_t modifiers) +{ + m_serial = serial; + +#if QT_CONFIG(xkbcommon) + if (m_resetCallback) { + qCDebug(qLcQpaInputMethods()) << "discard keysym: reset not confirmed"; + return; + } + + if (!QGuiApplication::focusWindow()) + return; + + Qt::KeyboardModifiers qtModifiers = modifiersToQtModifiers(modifiers); + + QEvent::Type type = state == WL_KEYBOARD_KEY_STATE_PRESSED ? QEvent::KeyPress : QEvent::KeyRelease; + QString text = QXkbCommon::lookupStringNoKeysymTransformations(sym); + int qtkey = QXkbCommon::keysymToQtKey(sym, qtModifiers); + + QWindowSystemInterface::handleKeyEvent(QGuiApplication::focusWindow(), + time, type, qtkey, qtModifiers, text); +#else + Q_UNUSED(time); + Q_UNUSED(sym); + Q_UNUSED(state); + Q_UNUSED(modifiers); +#endif +} + +void QWaylandTextInputv1::zwp_text_input_v1_language(uint32_t serial, const QString &language) +{ + m_serial = serial; + + if (m_resetCallback) { + qCDebug(qLcQpaInputMethods()) << "discard language: reset not confirmed"; + return; + } + + const QLocale locale(language); + if (m_locale != locale) { + m_locale = locale; + QGuiApplicationPrivate::platformIntegration()->inputContext()->emitLocaleChanged(); + } +} + +void QWaylandTextInputv1::zwp_text_input_v1_text_direction(uint32_t serial, uint32_t direction) +{ + m_serial = serial; + + if (m_resetCallback) { + qCDebug(qLcQpaInputMethods()) << "discard text_direction: reset not confirmed"; + return; + } + + const Qt::LayoutDirection inputDirection = (direction == text_direction_auto) ? Qt::LayoutDirectionAuto : + (direction == text_direction_ltr) ? Qt::LeftToRight : + (direction == text_direction_rtl) ? Qt::RightToLeft : Qt::LayoutDirectionAuto; + if (m_inputDirection != inputDirection) { + m_inputDirection = inputDirection; + QGuiApplicationPrivate::platformIntegration()->inputContext()->emitInputDirectionChanged(m_inputDirection); + } +} + +Qt::KeyboardModifiers QWaylandTextInputv1::modifiersToQtModifiers(uint32_t modifiers) +{ + Qt::KeyboardModifiers ret = Qt::NoModifier; + for (int i = 0; i < m_modifiersMap.size(); ++i) { + if (modifiers & (1 << i)) { + ret |= m_modifiersMap[i]; + } + } + return ret; +} + +} + +QT_END_NAMESPACE + diff --git a/src/plugins/platforms/wayland/qwaylandtextinputv1_p.h b/src/plugins/platforms/wayland/qwaylandtextinputv1_p.h new file mode 100644 index 00000000000..238db0b8af8 --- /dev/null +++ b/src/plugins/platforms/wayland/qwaylandtextinputv1_p.h @@ -0,0 +1,149 @@ +/**************************************************************************** +** +** Copyright (C) 2021 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the QtWaylandClient module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + + +#ifndef QWAYLANDTEXTINPUTV1_H +#define QWAYLANDTEXTINPUTV1_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include "qwaylandtextinputinterface_p.h" +#include +#include + +struct wl_callback; +struct wl_callback_listener; + +QT_BEGIN_NAMESPACE + +namespace QtWaylandClient { + +class QWaylandDisplay; + +class QWaylandTextInputv1 : public QtWayland::zwp_text_input_v1, public QWaylandTextInputInterface +{ +public: + QWaylandTextInputv1(QWaylandDisplay *display, struct ::zwp_text_input_v1 *text_input); + ~QWaylandTextInputv1() override; + + void setSeat(struct ::wl_seat *seat) { m_seat = seat; } + + void reset() override; + void commit() override; + void updateState(Qt::InputMethodQueries queries, uint32_t flags) override; + + void setCursorInsidePreedit(int cursor) override; + + bool isInputPanelVisible() const override; + QRectF keyboardRect() const override; + + QLocale locale() const override; + Qt::LayoutDirection inputDirection() const override; + + void showInputPanel() override + { + show_input_panel(); + } + void hideInputPanel() override + { + hide_input_panel(); + } + void enableSurface(::wl_surface *surface) override + { + activate(m_seat, surface); + } + void disableSurface(::wl_surface *surface) override + { + Q_UNUSED(surface); + deactivate(m_seat); + } + +protected: + void zwp_text_input_v1_enter(struct ::wl_surface *surface) override; + void zwp_text_input_v1_leave() override; + void zwp_text_input_v1_modifiers_map(wl_array *map) override; + void zwp_text_input_v1_input_panel_state(uint32_t state) override; + void zwp_text_input_v1_preedit_string(uint32_t serial, const QString &text, const QString &commit) override; + void zwp_text_input_v1_preedit_styling(uint32_t index, uint32_t length, uint32_t style) override; + void zwp_text_input_v1_preedit_cursor(int32_t index) override; + void zwp_text_input_v1_commit_string(uint32_t serial, const QString &text) override; + void zwp_text_input_v1_cursor_position(int32_t index, int32_t anchor) override; + void zwp_text_input_v1_delete_surrounding_text(int32_t before_length, uint32_t after_length) override; + void zwp_text_input_v1_keysym(uint32_t serial, uint32_t time, uint32_t sym, uint32_t state, uint32_t modifiers) override; + void zwp_text_input_v1_language(uint32_t serial, const QString &language) override; + void zwp_text_input_v1_text_direction(uint32_t serial, uint32_t direction) override; + +private: + Qt::KeyboardModifiers modifiersToQtModifiers(uint32_t modifiers); + + QWaylandDisplay *m_display = nullptr; + QWaylandInputMethodEventBuilder m_builder; + + QList m_modifiersMap; + + uint32_t m_serial = 0; + struct ::wl_surface *m_surface = nullptr; + struct ::wl_seat *m_seat = nullptr; + + QString m_preeditCommit; + + bool m_inputPanelVisible = false; + QRectF m_keyboardRectangle; + QLocale m_locale; + Qt::LayoutDirection m_inputDirection = Qt::LayoutDirectionAuto; + + struct ::wl_callback *m_resetCallback = nullptr; + static const wl_callback_listener callbackListener; + static void resetCallback(void *data, struct wl_callback *wl_callback, uint32_t time); +}; + +} + +QT_END_NAMESPACE +#endif // QWAYLANDTEXTINPUTV1_H + From cdc1b7ab941ab98516f99d799363d39358fc968f Mon Sep 17 00:00:00 2001 From: Joni Poikelin Date: Thu, 3 Feb 2022 14:01:50 +0200 Subject: [PATCH 1040/1507] Fix crash if no input method module could be loaded Pick-to: 6.2 6.3 5.15 Change-Id: I8f346def616606a6c5540856bd08a84ee7ed5ca2 Reviewed-by: David Edmundson --- src/plugins/platforms/wayland/qwaylandintegration.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandintegration.cpp b/src/plugins/platforms/wayland/qwaylandintegration.cpp index 721af8347d6..3e08b2d008d 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandintegration.cpp @@ -534,7 +534,7 @@ void QWaylandIntegration::reconfigureInputContext() } #endif - qCDebug(lcQpaWayland) << "using input method:" << inputContext()->metaObject()->className(); + qCDebug(lcQpaWayland) << "using input method:" << (inputContext() ? inputContext()->metaObject()->className() : ""); } QWaylandShellIntegration *QWaylandIntegration::createShellIntegration(const QString &integrationName) From fcf3fc37a495435e3e12d32b92d0b0691509f688 Mon Sep 17 00:00:00 2001 From: Christophe Giboudeaux Date: Fri, 4 Feb 2022 13:08:01 +0100 Subject: [PATCH 1041/1507] CMake: Fix qtwayland feature detection The dmabuf_server_buffer test links to EGL and libdrm and the vulkan_server_buffer one needs to link to wayland-client Fixes: QTBUG-100475 Pick-to: 6.3 6.2 Change-Id: Idbcef88bba0a9d5ef7bfeaa55668c94caee6ab83 Reviewed-by: Alexandru Croitor --- src/platformsupport/wayland/configure.cmake | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/platformsupport/wayland/configure.cmake b/src/platformsupport/wayland/configure.cmake index 1c1cf1e883f..3fd7f93e08b 100644 --- a/src/platformsupport/wayland/configure.cmake +++ b/src/platformsupport/wayland/configure.cmake @@ -43,6 +43,18 @@ if(LINUX OR QT_FIND_ALL_PACKAGES_ALWAYS) if(NOT TARGET XKB::XKB) qt_find_package(XKB 0.5.0 PROVIDED_TARGETS XKB::XKB MODULE_NAME gui QMAKE_LIB xkbcommon MARK_OPTIONAL) endif() + # EGL + if(NOT TARGET EGL::EGL) + qt_find_package(EGL PROVIDED_TARGETS EGL::EGL MODULE_NAME gui QMAKE_LIB egl MARK_OPTIONAL) + endif() + # and Libdrm + if(NOT TARGET Libdrm::Libdrm) + qt_find_package(Libdrm + PROVIDED_TARGETS Libdrm::Libdrm + MODULE_NAME gui + QMAKE_LIB drm + MARK_OPTIONAL) + endif() endif() @@ -129,6 +141,8 @@ return 1; # vulkan-server-buffer qt_config_compile_test(vulkan_server_buffer LABEL "Vulkan Buffer Sharing" + LIBRARIES + Wayland::Client CODE "#define VK_USE_PLATFORM_WAYLAND_KHR 1 #include @@ -151,6 +165,7 @@ qt_config_compile_test(egl_1_5_wayland LABEL "EGL 1.5 with Wayland Platform" LIBRARIES EGL::EGL + Wayland::Client CODE " #include From e625089f40ab5b2f3220a9ffc3e047d1c3fc2740 Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Tue, 1 Feb 2022 13:05:36 +0200 Subject: [PATCH 1042/1507] Client: Remove mWaitingForUpdateDelivery Currently, mWaitingForUpdateDelivery is shared between the main thread (doHandleFrameCallback()) and the frame callback event thread (handleFrameCallback()), however the access to it is not synchronized between both threads. On the other hand, QWaylandWindow already ensures not to create a frame callback if there's already one pending. This change removes mWaitingForUpdateDelivery flag because it should be already covered by mWaitingForFrameCallback and to remove unsynchronized shared state between threads. Change-Id: I0e5a25d18d1e66c4d7683e7e972330c4d7cbbf38 Reviewed-by: David Edmundson --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 11 +++-------- src/plugins/platforms/wayland/qwaylandwindow_p.h | 1 - 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 812373a2821..29e6ef6719f 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -715,12 +715,9 @@ void QWaylandWindow::handleFrameCallback() mFrameCallbackElapsedTimer.invalidate(); // The rest can wait until we can run it on the correct thread - if (!mWaitingForUpdateDelivery) { - // Queued connection, to make sure we don't call handleUpdate() from inside waitForFrameSync() - // in the single-threaded case. - mWaitingForUpdateDelivery = true; - QMetaObject::invokeMethod(this, &QWaylandWindow::doHandleFrameCallback, Qt::QueuedConnection); - } + // Queued connection, to make sure we don't call handleUpdate() from inside waitForFrameSync() + // in the single-threaded case. + QMetaObject::invokeMethod(this, &QWaylandWindow::doHandleFrameCallback, Qt::QueuedConnection); mFrameSyncWait.notify_all(); } @@ -733,8 +730,6 @@ void QWaylandWindow::doHandleFrameCallback() sendExposeEvent(QRect(QPoint(), geometry().size())); if (wasExposed && hasPendingUpdateRequest()) deliverUpdateRequest(); - - mWaitingForUpdateDelivery = false; } bool QWaylandWindow::waitForFrameSync(int timeout) diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index d64c80c4157..6eb8053bf3c 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -280,7 +280,6 @@ protected: WId mWindowId; bool mWaitingForFrameCallback = false; bool mFrameCallbackTimedOut = false; // Whether the frame callback has timed out - bool mWaitingForUpdateDelivery = false; int mFrameCallbackCheckIntervalTimerId = -1; QElapsedTimer mFrameCallbackElapsedTimer; struct ::wl_callback *mFrameCallback = nullptr; From 699770b7c7f0a3466f01971151a3b333443a2a2d Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Tue, 8 Feb 2022 20:14:51 +0100 Subject: [PATCH 1043/1507] Fix unused warnings Unused lambda capture and private variables that clang complains about. Pick-to: 6.2 6.3 Task-number: QTBUG-100249 Change-Id: I204eea8d4fc0c22542224d94bae113fa66870d15 Reviewed-by: Liang Qi --- src/plugins/platforms/wayland/qwaylanddisplay.cpp | 2 +- src/plugins/platforms/wayland/qwaylandinputmethodcontext.cpp | 2 +- src/plugins/platforms/wayland/qwaylandinputmethodcontext_p.h | 2 -- src/plugins/platforms/wayland/qwaylandtextinputv1.cpp | 2 +- src/plugins/platforms/wayland/qwaylandtextinputv1_p.h | 1 - 5 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index 5937172f052..c97e71a9b5f 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -900,7 +900,7 @@ bool QWaylandDisplay::isKeyboardAvailable() const { return std::any_of( mInputDevices.constBegin(), mInputDevices.constEnd(), - [this](const QWaylandInputDevice *device) { return device->keyboard() != nullptr; }); + [](const QWaylandInputDevice *device) { return device->keyboard() != nullptr; }); } #if QT_CONFIG(cursor) diff --git a/src/plugins/platforms/wayland/qwaylandinputmethodcontext.cpp b/src/plugins/platforms/wayland/qwaylandinputmethodcontext.cpp index f8c91411587..033c89c879e 100644 --- a/src/plugins/platforms/wayland/qwaylandinputmethodcontext.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputmethodcontext.cpp @@ -55,8 +55,8 @@ static constexpr int maxStringSize = 1000; // actual max is 4096/3 QWaylandTextInputMethod::QWaylandTextInputMethod(QWaylandDisplay *display, struct ::qt_text_input_method_v1 *textInputMethod) : QtWayland::qt_text_input_method_v1(textInputMethod) - , m_display(display) { + Q_UNUSED(display); } QWaylandTextInputMethod::~QWaylandTextInputMethod() diff --git a/src/plugins/platforms/wayland/qwaylandinputmethodcontext_p.h b/src/plugins/platforms/wayland/qwaylandinputmethodcontext_p.h index 6fd0d284bc7..7fe64f2dade 100644 --- a/src/plugins/platforms/wayland/qwaylandinputmethodcontext_p.h +++ b/src/plugins/platforms/wayland/qwaylandinputmethodcontext_p.h @@ -103,8 +103,6 @@ public: void sendInputState(QInputMethodQueryEvent *state, Qt::InputMethodQueries queries = Qt::ImQueryInput); private: - QWaylandDisplay *m_display; - QHash > m_pendingInputMethodEvents; QHash m_offsetFromCompositor; diff --git a/src/plugins/platforms/wayland/qwaylandtextinputv1.cpp b/src/plugins/platforms/wayland/qwaylandtextinputv1.cpp index 5e204a7ffba..a2c06a5ba47 100644 --- a/src/plugins/platforms/wayland/qwaylandtextinputv1.cpp +++ b/src/plugins/platforms/wayland/qwaylandtextinputv1.cpp @@ -73,8 +73,8 @@ const Qt::InputMethodQueries supportedQueries = Qt::ImEnabled | QWaylandTextInputv1::QWaylandTextInputv1(QWaylandDisplay *display, struct ::zwp_text_input_v1 *text_input) : QtWayland::zwp_text_input_v1(text_input) - , m_display(display) { + Q_UNUSED(display); } QWaylandTextInputv1::~QWaylandTextInputv1() diff --git a/src/plugins/platforms/wayland/qwaylandtextinputv1_p.h b/src/plugins/platforms/wayland/qwaylandtextinputv1_p.h index 238db0b8af8..068987cd12d 100644 --- a/src/plugins/platforms/wayland/qwaylandtextinputv1_p.h +++ b/src/plugins/platforms/wayland/qwaylandtextinputv1_p.h @@ -121,7 +121,6 @@ protected: private: Qt::KeyboardModifiers modifiersToQtModifiers(uint32_t modifiers); - QWaylandDisplay *m_display = nullptr; QWaylandInputMethodEventBuilder m_builder; QList m_modifiersMap; From 0bbff7ff60b3c96915b73394b5290a017cead290 Mon Sep 17 00:00:00 2001 From: Inho Lee Date: Mon, 20 Sep 2021 20:00:49 +0200 Subject: [PATCH 1044/1507] Do not delete window decorations before next update When window decorations are turned on/off, a timing issue might happen with accessing deleted decorations. A boolean value, mWindowDecorationEnabled, will be used instead of mWindowDecoration. Pick-to: 6.3 6.2 Fixes: QTBUG-59627 Change-Id: I5514a408d89340fdbf481721ea2dc4bf62078852 Reviewed-by: Qt CI Bot Reviewed-by: Eskil Abrahamsen Blomfeldt --- .../platforms/wayland/qwaylandwindow.cpp | 41 +++++++++++-------- .../platforms/wayland/qwaylandwindow_p.h | 1 + 2 files changed, 24 insertions(+), 18 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 29e6ef6719f..e1c645e157b 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -327,7 +327,7 @@ void QWaylandWindow::setWindowTitle(const QString &title) mShellSurface->setTitle(truncated.toString()); } - if (mWindowDecoration && window()->isVisible()) + if (mWindowDecorationEnabled && window()->isVisible()) mWindowDecoration->update(); } @@ -335,7 +335,7 @@ void QWaylandWindow::setWindowIcon(const QIcon &icon) { mWindowIcon = icon; - if (mWindowDecoration && window()->isVisible()) + if (mWindowDecorationEnabled && window()->isVisible()) mWindowDecoration->update(); } @@ -369,7 +369,7 @@ void QWaylandWindow::setGeometry(const QRect &rect) setGeometry_helper(rect); if (window()->isVisible() && rect.isValid()) { - if (mWindowDecoration) + if (mWindowDecorationEnabled) mWindowDecoration->update(); if (mResizeAfterSwap && windowType() == Egl && mSentInitialResize) @@ -429,7 +429,7 @@ void QWaylandWindow::resizeFromApplyConfigure(const QSize &sizeWithMargins, cons // 2) Following resizeFromApplyConfigure() calls should have sizeWithMargins equal to // windowContentGeometry() which excludes shadows, therefore in this case we have to // exclude them too in order not to accidentally apply smaller size to the window. - if (mWindowDecoration && (sizeWithMargins != surfaceSize())) + if (mWindowDecorationEnabled && (sizeWithMargins != surfaceSize())) margins = mWindowDecoration->margins(QWaylandAbstractDecoration::ShadowsExcluded); int widthWithoutMargins = qMax(sizeWithMargins.width() - (margins.left() + margins.right()), 1); @@ -751,7 +751,7 @@ bool QWaylandWindow::waitForFrameSync(int timeout) QMargins QWaylandWindow::frameMargins() const { - if (mWindowDecoration) + if (mWindowDecorationEnabled) return mWindowDecoration->margins(); else if (mShellSurface) return mShellSurface->serverSideFrameMargins(); @@ -761,7 +761,7 @@ QMargins QWaylandWindow::frameMargins() const QMargins QWaylandWindow::clientSideMargins() const { - return mWindowDecoration ? mWindowDecoration->margins() : QMargins{}; + return mWindowDecorationEnabled ? mWindowDecoration->margins() : QMargins{}; } /*! @@ -780,7 +780,7 @@ QRect QWaylandWindow::windowContentGeometry() const { QMargins shadowMargins; - if (mWindowDecoration) + if (mWindowDecorationEnabled) shadowMargins = mWindowDecoration->margins(QWaylandAbstractDecoration::ShadowsOnly); return QRect(QPoint(shadowMargins.left(), shadowMargins.top()), surfaceSize().shrunkBy(shadowMargins)); @@ -904,9 +904,14 @@ bool QWaylandWindow::createDecoration() if (!mShellSurface || !mShellSurface->wantsDecorations()) decoration = false; - bool hadDecoration = mWindowDecoration; + bool hadDecoration = mWindowDecorationEnabled; if (decoration && !decorationPluginFailed) { - if (!mWindowDecoration) { + if (!mWindowDecorationEnabled) { + if (mWindowDecoration) { + delete mWindowDecoration; + mWindowDecoration = nullptr; + } + QStringList decorations = QWaylandDecorationFactory::keys(); if (decorations.empty()) { qWarning() << "No decoration plugins available. Running with no decorations."; @@ -935,13 +940,13 @@ bool QWaylandWindow::createDecoration() return false; } mWindowDecoration->setWaylandWindow(this); + mWindowDecorationEnabled = true; } } else { - delete mWindowDecoration; - mWindowDecoration = nullptr; + mWindowDecorationEnabled = false; } - if (hadDecoration != (bool)mWindowDecoration) { + if (hadDecoration != mWindowDecorationEnabled) { for (QWaylandSubSurface *subsurf : qAsConst(mChildren)) { QPoint pos = subsurf->window()->geometry().topLeft(); QMargins m = frameMargins(); @@ -962,7 +967,7 @@ bool QWaylandWindow::createDecoration() QWaylandAbstractDecoration *QWaylandWindow::decoration() const { - return mWindowDecoration; + return mWindowDecorationEnabled ? mWindowDecoration : nullptr; } static QWaylandWindow *closestShellSurfaceWindow(QWindow *window) @@ -993,7 +998,7 @@ QWaylandWindow *QWaylandWindow::transientParent() const void QWaylandWindow::handleMouse(QWaylandInputDevice *inputDevice, const QWaylandPointerEvent &e) { if (e.type == QEvent::Leave) { - if (mWindowDecoration) { + if (mWindowDecorationEnabled) { if (mMouseEventsInContentArea) QWindowSystemInterface::handleLeaveEvent(window()); } else { @@ -1005,7 +1010,7 @@ void QWaylandWindow::handleMouse(QWaylandInputDevice *inputDevice, const QWaylan return; } - if (mWindowDecoration) { + if (mWindowDecorationEnabled) { handleMouseEventWithDecoration(inputDevice, e); } else { switch (e.type) { @@ -1045,7 +1050,7 @@ void QWaylandWindow::handleSwipeGesture(QWaylandInputDevice *inputDevice, if (mGestureState != GestureNotActive) qCWarning(lcQpaWaylandInput) << "Unexpected GestureStarted while already active"; - if (mWindowDecoration && !mMouseEventsInContentArea) { + if (mWindowDecorationEnabled && !mMouseEventsInContentArea) { // whole gesture sequence will be ignored mGestureState = GestureActiveInDecoration; return; @@ -1100,7 +1105,7 @@ void QWaylandWindow::handlePinchGesture(QWaylandInputDevice *inputDevice, if (mGestureState != GestureNotActive) qCWarning(lcQpaWaylandInput) << "Unexpected GestureStarted while already active"; - if (mWindowDecoration && !mMouseEventsInContentArea) { + if (mWindowDecorationEnabled && !mMouseEventsInContentArea) { // whole gesture sequence will be ignored mGestureState = GestureActiveInDecoration; return; @@ -1165,7 +1170,7 @@ void QWaylandWindow::handlePinchGesture(QWaylandInputDevice *inputDevice, bool QWaylandWindow::touchDragDecoration(QWaylandInputDevice *inputDevice, const QPointF &local, const QPointF &global, QEventPoint::State state, Qt::KeyboardModifiers mods) { - if (!mWindowDecoration) + if (!mWindowDecorationEnabled) return false; return mWindowDecoration->handleTouch(inputDevice, local, global, state, mods); } diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index 6eb8053bf3c..70d878f44cb 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -257,6 +257,7 @@ protected: QList mChildren; QWaylandAbstractDecoration *mWindowDecoration = nullptr; + bool mWindowDecorationEnabled = false; bool mMouseEventsInContentArea = false; Qt::MouseButtons mMousePressedInContentArea = Qt::NoButton; From f9f086e8cbd256db33af3c20411265af0aebc986 Mon Sep 17 00:00:00 2001 From: Inho Lee Date: Fri, 4 Feb 2022 10:32:29 +0100 Subject: [PATCH 1045/1507] Update the window geometry when changing decorations Windows' geometries should be updated when changing decorations. Fixes: QTBUG-100467 Pick-to: 6.3 6.2 5.15 Change-Id: I5ec9968aa48422776d184a8fa2f5d86ecc3ca5c3 Reviewed-by: Eskil Abrahamsen Blomfeldt Reviewed-by: Liang Qi --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index e1c645e157b..a86d5d85c55 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -952,7 +952,7 @@ bool QWaylandWindow::createDecoration() QMargins m = frameMargins(); subsurf->set_position(pos.x() + m.left(), pos.y() + m.top()); } - sendExposeEvent(QRect(QPoint(), geometry().size())); + setGeometry(geometry()); // This is a special case where the buffer is recreated, but since // the content rect remains the same, the widgets remain the same From 40051c338801e4ef769d2d160d07bc9498065a49 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Fri, 11 Feb 2022 18:24:16 +0100 Subject: [PATCH 1046/1507] tst_inputcontext: fix warning about unused lambda capture MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Says Clang 10: tst_inputcontext.cpp:194:11: warning: lambda capture 'this' is not used [-Wunused-lambda-capture] exec([this] { ^~~~ Code was added for 6.3, so only: Pick-to: 6.3 Change-Id: I3818d1707e917c2c804d4ab0349e48667cf4a126 Reviewed-by: Mårten Nordheim --- tests/auto/wayland/inputcontext/tst_inputcontext.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/wayland/inputcontext/tst_inputcontext.cpp b/tests/auto/wayland/inputcontext/tst_inputcontext.cpp index 02beb6af5d4..e006f755379 100644 --- a/tests/auto/wayland/inputcontext/tst_inputcontext.cpp +++ b/tests/auto/wayland/inputcontext/tst_inputcontext.cpp @@ -191,7 +191,7 @@ void tst_inputcontext::selectingTextInputProtocol() QFETCH(QByteArray, clientProtocol); QFETCH(QByteArray, expectedModule); - exec([this] { + exec([] { qputenv("QT_IM_MODULE", "qtvirtualkeyboard"); }); From 0f2af270457461348cec398610e83bbae2ef9b39 Mon Sep 17 00:00:00 2001 From: Weng Xuetian Date: Tue, 8 Feb 2022 07:11:25 -0800 Subject: [PATCH 1047/1507] Cursor position == 0 should still show the cursor Otherwise the cursor would be hidden even if preedit is empty. Amends 8b3de53ee666c8ea16c735180a7305df2494b16a Pick-to: 5.15 6.2 6.3 Change-Id: I320733b917779b7b51aa4a28eaea411fdb10a318 Reviewed-by: Liang Qi --- .../wayland/shared/qwaylandinputmethodeventbuilder.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/wayland/shared/qwaylandinputmethodeventbuilder.cpp b/src/plugins/platforms/wayland/shared/qwaylandinputmethodeventbuilder.cpp index b52543fcb40..9b2d7a1ccbe 100644 --- a/src/plugins/platforms/wayland/shared/qwaylandinputmethodeventbuilder.cpp +++ b/src/plugins/platforms/wayland/shared/qwaylandinputmethodeventbuilder.cpp @@ -153,9 +153,9 @@ QInputMethodEvent *QWaylandInputMethodEventBuilder::buildPreedit(const QString & { QList attributes; - if (m_preeditCursor <= 0) { + if (m_preeditCursor < 0) { attributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::Cursor, 0, 0, QVariant())); - } else if (m_preeditCursor > 0) { + } else { attributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::Cursor, indexFromWayland(text, m_preeditCursor), 1, QVariant())); } From 651d6dcfe388952ce53868ecb119f37b1c42569c Mon Sep 17 00:00:00 2001 From: Weng Xuetian Date: Wed, 22 Dec 2021 10:42:38 -0800 Subject: [PATCH 1048/1507] Update the preedit styling mapping - None mapping to no style. - Default/Underline mapping to underline. - Highlight/Selection mapping to background color/text color with highlight/highlight text with underline. - Active/Inactive mapping to bold text with underline. - Incorrect mapping to red wave underline. Pick-to: 5.15 6.2 6.3 Change-Id: Iab51d671b8f83aece8596f7f7610de19343fcceb Reviewed-by: Aleix Pol Gonzalez --- .../qwaylandinputmethodeventbuilder.cpp | 31 ++++++++++++------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/src/plugins/platforms/wayland/shared/qwaylandinputmethodeventbuilder.cpp b/src/plugins/platforms/wayland/shared/qwaylandinputmethodeventbuilder.cpp index 9b2d7a1ccbe..e0a3e7987dd 100644 --- a/src/plugins/platforms/wayland/shared/qwaylandinputmethodeventbuilder.cpp +++ b/src/plugins/platforms/wayland/shared/qwaylandinputmethodeventbuilder.cpp @@ -39,7 +39,10 @@ #include "qwaylandinputmethodeventbuilder_p.h" +#include +#include #include +#include #include #ifdef QT_BUILD_WAYLANDCOMPOSITOR_LIB @@ -83,32 +86,38 @@ void QWaylandInputMethodEventBuilder::addPreeditStyling(uint32_t index, uint32_t QTextCharFormat format; switch (style) { - case 0: - case 1: + case ZWP_TEXT_INPUT_V2_PREEDIT_STYLE_NONE: + break; + case ZWP_TEXT_INPUT_V2_PREEDIT_STYLE_DEFAULT: + case ZWP_TEXT_INPUT_V2_PREEDIT_STYLE_UNDERLINE: format.setFontUnderline(true); format.setUnderlineStyle(QTextCharFormat::SingleUnderline); m_preeditStyles.append(QInputMethodEvent::Attribute(QInputMethodEvent::TextFormat, index, length, format)); break; - case 2: - case 3: + case ZWP_TEXT_INPUT_V2_PREEDIT_STYLE_ACTIVE: + case ZWP_TEXT_INPUT_V2_PREEDIT_STYLE_INACTIVE: format.setFontWeight(QFont::Bold); format.setFontUnderline(true); format.setUnderlineStyle(QTextCharFormat::SingleUnderline); m_preeditStyles.append(QInputMethodEvent::Attribute(QInputMethodEvent::TextFormat, index, length, format)); break; - case 4: - format.setFontUnderline(true); - format.setUnderlineStyle(QTextCharFormat::SingleUnderline); - m_preeditStyles.append(QInputMethodEvent::Attribute(QInputMethodEvent::TextFormat, index, length, format)); + case ZWP_TEXT_INPUT_V2_PREEDIT_STYLE_HIGHLIGHT: + case ZWP_TEXT_INPUT_V2_PREEDIT_STYLE_SELECTION: + { + format.setFontUnderline(true); + format.setUnderlineStyle(QTextCharFormat::SingleUnderline); + QPalette palette = qApp->palette(); + format.setBackground(QBrush(palette.color(QPalette::Active, QPalette::Highlight))); + format.setForeground(QBrush(palette.color(QPalette::Active, QPalette::HighlightedText))); + m_preeditStyles.append(QInputMethodEvent::Attribute(QInputMethodEvent::TextFormat, index, length, format)); + } break; - case 5: + case ZWP_TEXT_INPUT_V2_PREEDIT_STYLE_INCORRECT: format.setFontUnderline(true); format.setUnderlineStyle(QTextCharFormat::WaveUnderline); format.setUnderlineColor(QColor(Qt::red)); m_preeditStyles.append(QInputMethodEvent::Attribute(QInputMethodEvent::TextFormat, index, length, format)); break; -// case QtWayland::wl_text_input::preedit_style_selection: -// case QtWayland::wl_text_input::preedit_style_none: default: break; } From 610e084250a3934f0ef77e384eaf78b5ed7829d3 Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Wed, 9 Feb 2022 17:20:48 +0000 Subject: [PATCH 1049/1507] client: Simplify round trip behavior The custom event queue was removed in d49cd790d8525071f6613066caf5e8dd2f5ca980 (2015) so the comment about not being able to use the inbuilt round trip method no longer applies. This fixes a real world problem. Use of a blocking round trip should not process non wayland events. Doing so can lead to misbehaviour client side as things happen out of order. The move to the event thread created several regressions as we now get events before the QGuiApplication is fully constructed. Change-Id: I650481f49a47ed1a9778c7e1bc3c48db6e8f0031 Reviewed-by: Vlad Zahorodnii Reviewed-by: Eskil Abrahamsen Blomfeldt --- .../platforms/wayland/qwaylanddisplay.cpp | 43 +------------------ 1 file changed, 1 insertion(+), 42 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index c97e71a9b5f..489a834d7c4 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -728,50 +728,9 @@ uint32_t QWaylandDisplay::currentTimeMillisec() return 0; } -static void -sync_callback(void *data, struct wl_callback *callback, uint32_t serial) -{ - Q_UNUSED(serial); - bool *done = static_cast(data); - - *done = true; - - // If the wl_callback done event is received after the condition check in the while loop in - // forceRoundTrip(), but before the call to processEvents, the call to processEvents may block - // forever if no more events are posted (eventhough the callback is handled in response to the - // aboutToBlock signal). Hence, we wake up the event dispatcher so forceRoundTrip may return. - // (QTBUG-64696) - if (auto *dispatcher = QThread::currentThread()->eventDispatcher()) - dispatcher->wakeUp(); - - wl_callback_destroy(callback); -} - -static const struct wl_callback_listener sync_listener = { - sync_callback -}; - void QWaylandDisplay::forceRoundTrip() { - // wl_display_roundtrip() works on the main queue only, - // but we use a separate one, so basically reimplement it here - int ret = 0; - bool done = false; - wl_callback *callback = wl_display_sync(mDisplay); - wl_callback_add_listener(callback, &sync_listener, &done); - flushRequests(); - if (QThread::currentThread()->eventDispatcher()) { - while (!done && ret >= 0) { - QThread::currentThread()->eventDispatcher()->processEvents(QEventLoop::WaitForMoreEvents); - ret = wl_display_dispatch_pending(mDisplay); - } - } else { - while (!done && ret >= 0) - ret = wl_display_dispatch(mDisplay); - } - - if (ret == -1 && !done) - wl_callback_destroy(callback); + wl_display_roundtrip(mDisplay); } bool QWaylandDisplay::supportsWindowDecoration() const From a4647c1f15e77b1dcf6b5b4a92ad1e5cce839b37 Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Sat, 19 Feb 2022 17:01:04 +0200 Subject: [PATCH 1050/1507] Client: Fix opaque region setter The rect is in the global coordinate system, while the opaque region must be in the surface local coordinate system. Change-Id: I75042b4d779dfd4dfe610aad1f0387879f11b048 Reviewed-by: Aleix Pol Gonzalez --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index a86d5d85c55..9217d19be80 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -390,7 +390,7 @@ void QWaylandWindow::setGeometry(const QRect &rect) } if (isOpaque() && mMask.isEmpty()) - setOpaqueArea(rect); + setOpaqueArea(QRect(QPoint(0, 0), rect.size())); } void QWaylandWindow::setGeometryFromApplyConfigure(const QPoint &globalPosition, const QSize &sizeWithMargins) From a1a671eb952ccedb8588c1e39fcdce85c176d887 Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Tue, 22 Feb 2022 12:31:08 +0100 Subject: [PATCH 1051/1507] Reduce memory leakage We need to clean up the event queue when we're done. Change-Id: I13a9eb77e978f4eab227a3a28dab8ebc8de94405 Reviewed-by: David Edmundson --- src/plugins/platforms/wayland/qwaylanddisplay.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index 489a834d7c4..f8cb75e953b 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -393,6 +393,9 @@ QWaylandDisplay::~QWaylandDisplay(void) #endif if (mDisplay) wl_display_disconnect(mDisplay); + + if (m_frameEventQueue) + wl_event_queue_destroy(m_frameEventQueue); } // Steps which is called just after constructor. This separates registry_global() out of the constructor From 4878afdd37e002c0c93a128f622882004d0c3a4a Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Wed, 23 Feb 2022 07:44:40 +0100 Subject: [PATCH 1052/1507] Update 3rdparty attributions The XDG activation protocol was added with no attribution and the Wayland protocol version was updated without updating the version in the XML. Pick-to: 6.3 Fixes: QTBUG-100901 Change-Id: Ifaaf69b7d498ea7106d4bfd6ada978475447d296 Reviewed-by: Aleix Pol Gonzalez --- .../wayland/protocols/qt_attribution.json | 22 +++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/src/3rdparty/wayland/protocols/qt_attribution.json b/src/3rdparty/wayland/protocols/qt_attribution.json index e5aaabcb185..11a6f70c267 100644 --- a/src/3rdparty/wayland/protocols/qt_attribution.json +++ b/src/3rdparty/wayland/protocols/qt_attribution.json @@ -25,8 +25,8 @@ "Description": "Wayland is a protocol for a compositor to talk to its clients.", "Homepage": "https://wayland.freedesktop.org", - "Version": "1.16.0", - "DownloadLocation": "https://gitlab.freedesktop.org/wayland/wayland/raw/1.16.0/protocol/wayland.xml", + "Version": "1.19.0", + "DownloadLocation": "https://gitlab.freedesktop.org/wayland/wayland/raw/1.19.0/protocol/wayland.xml", "LicenseId": "MIT", "License": "MIT License", "LicenseFile": "MIT_LICENSE.txt", @@ -150,6 +150,24 @@ "Copyright": "Copyright © 2013-2016 Collabora, Ltd." }, + { + "Id": "wayland-xdg-activation", + "Name": "Wayland xdg-activation Protocol", + "QDocModule": "qtwaylandcompositor", + "QtUsage": "Used in the Qt Wayland platform plugin", + "File": "xdg-activation-v1.xml", + + "Description": "The xdg-activation protocol provides a way for one client to pass focus to another.", + "Homepage": "https://wayland.freedesktop.org", + "Version": "unstable v1, version 1", + "DownloadLocation": "https://gitlab.freedesktop.org/wayland/wayland-protocols/-/blob/main/staging/xdg-activation/xdg-activation-v1.xml", + "LicenseId": "MIT", + "License": "MIT LIcense", + "License file": "MIT_LICENSE.txt", + "Copyright": "Copyright © 2020 Aleix Pol Gonzalez <aleixpol@kde.org>\nCopyright © 2020 Carlos Garnacho <carlosg@gnome.org>" + + }, + { "Id": "wayland-xdg-decoration-protocol", "Name": "Wayland xdg-decoration Protocol", From 3345c04e248507d0002f4749c0234fa044c67fb4 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Wed, 23 Feb 2022 07:55:37 +0100 Subject: [PATCH 1053/1507] Add attribution for text-input v1 protocol This was not added together with the protocol. This change also disambiguates v1 and v2 as two separate entries, since the licenses are different. Change-Id: I2309aced67ae69bc2d8117688e5d7b1074e8bf8f Reviewed-by: Dominik Holland --- .../wayland/protocols/qt_attribution.json | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/src/3rdparty/wayland/protocols/qt_attribution.json b/src/3rdparty/wayland/protocols/qt_attribution.json index 11a6f70c267..89ffb6ed9b6 100644 --- a/src/3rdparty/wayland/protocols/qt_attribution.json +++ b/src/3rdparty/wayland/protocols/qt_attribution.json @@ -220,8 +220,25 @@ }, { - "Id": "wayland-text-input-unstable", - "Name": "Wayland Text Input Protocol", + "Id": "wayland-text-input-unstable-v1", + "Name": "Wayland Text Input Protocol v1", + "QDocModule": "qtwaylandcompositor", + "QtUsage": "Used in the Qt Wayland platform plugin", + "File": "text-input-unstable-v1.xml", + + "Description": "Adds support for text input and input methods to applications running on Wayland servers that only support text-input-unstable-v1.", + "Homepage": "https://wayland.freedesktop.org", + "Version": "unstable v1", + "DownloadLocation": "https://gitlab.freedesktop.org/wayland/wayland-protocols/-/blob/main/unstable/text-input/text-input-unstable-v1.xml", + "LicenseId": "MIT", + "License": "MIT LIcense", + "License file": "MIT_LICENSE.txt", + "Copyright": "Copyright © 2012, 2013 Intel Corporation" + }, + + { + "Id": "wayland-text-input-unstable-v2", + "Name": "Wayland Text Input Protocol v2", "QDocModule": "qtwaylandcompositor", "QtUsage": "Used in the Qt Wayland Compositor, and the Qt Wayland platform plugin.", "Files": "text-input-unstable-v2.xml", From 9acb30b2245fb6a9c25a0a2ed7eda159b8d494e9 Mon Sep 17 00:00:00 2001 From: David Redondo Date: Wed, 8 Dec 2021 11:31:01 +0100 Subject: [PATCH 1054/1507] Allow creating popups from non xdg-shell parents It's possible to create xdg-popups with a null parent and set a parent via some other protocol. This will be useful for the work of allowing multiple shells in one process. Change-Id: I1fb9035be4b3999ff284bcc5c60eb4142cee1294 Reviewed-by: Eskil Abrahamsen Blomfeldt --- .../shellintegration/xdg-shell/qwaylandxdgshell.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp index 2ca6eb9d341..55771ec6d73 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp @@ -211,7 +211,7 @@ QtWayland::xdg_toplevel::resize_edge QWaylandXdgSurface::Toplevel::convertToResi QWaylandXdgSurface::Popup::Popup(QWaylandXdgSurface *xdgSurface, QWaylandXdgSurface *parent, QtWayland::xdg_positioner *positioner) - : xdg_popup(xdgSurface->get_popup(parent->object(), positioner->object())) + : xdg_popup(xdgSurface->get_popup(parent ? parent->object() : nullptr, positioner->object())) , m_xdgSurface(xdgSurface) , m_parent(parent) { @@ -225,7 +225,7 @@ QWaylandXdgSurface::Popup::~Popup() if (m_grabbing) { auto *shell = m_xdgSurface->m_shell; Q_ASSERT(shell->m_topmostGrabbingPopup == this); - shell->m_topmostGrabbingPopup = m_parent->m_popup; + shell->m_topmostGrabbingPopup = m_parent ? m_parent->m_popup : nullptr; } } @@ -421,7 +421,7 @@ void QWaylandXdgSurface::setPopup(QWaylandWindow *parent) { Q_ASSERT(!m_toplevel && !m_popup); - auto parentXdgSurface = static_cast(parent->shellSurface()); + auto parentXdgSurface = qobject_cast(parent->shellSurface()); auto positioner = new QtWayland::xdg_positioner(m_shell->create_positioner()); // set_popup expects a position relative to the parent @@ -442,7 +442,7 @@ void QWaylandXdgSurface::setPopup(QWaylandWindow *parent) void QWaylandXdgSurface::setGrabPopup(QWaylandWindow *parent, QWaylandInputDevice *device, int serial) { - auto parentXdgSurface = static_cast(parent->shellSurface()); + auto parentXdgSurface = qobject_cast(parent->shellSurface()); auto *top = m_shell->m_topmostGrabbingPopup; if (top && top->m_xdgSurface != parentXdgSurface) { From 6d1d6ebb60ce3f239f83c3459f4465746fcba65c Mon Sep 17 00:00:00 2001 From: Liang Qi Date: Tue, 4 Jan 2022 12:30:36 +0100 Subject: [PATCH 1055/1507] client: set_constraint_adjustment() for popups in xdg See also https://cgit.freedesktop.org/wayland/wayland-protocols/tree/stable/xdg-shell/xdg-shell.xml#n234 . Kudos to Greg V for his original patch in jira. Fixes: QTBUG-87303 Pick-to: 5.15 6.2 6.3 Done-with: Greg V Change-Id: I57df9aedea7cc6f0b6fa142a6fc6c3bdc98324c8 Reviewed-by: David Edmundson --- .../plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp index 55771ec6d73..aaeeb7c4080 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp @@ -435,6 +435,10 @@ void QWaylandXdgSurface::setPopup(QWaylandWindow *parent) positioner->set_anchor(QtWayland::xdg_positioner::anchor_top_left); positioner->set_gravity(QtWayland::xdg_positioner::gravity_bottom_right); positioner->set_size(m_window->geometry().width(), m_window->geometry().height()); + positioner->set_constraint_adjustment(QtWayland::xdg_positioner::constraint_adjustment_slide_x + | QtWayland::xdg_positioner::constraint_adjustment_slide_y + | QtWayland::xdg_positioner::constraint_adjustment_flip_x + | QtWayland::xdg_positioner::constraint_adjustment_flip_y); m_popup = new Popup(this, parentXdgSurface, positioner); positioner->destroy(); delete positioner; From 2ddd1eca36562970af237b4f74687e5fdd0466a0 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 11 Feb 2022 11:34:22 -0800 Subject: [PATCH 1056/1507] Make sure all private headers include at least one other See script in qtbase/util/includeprivate for the rules. Since these files are being touched anyway, I also ran the updatecopyright.pl script too. Change-Id: Ib056b47dde3341ef9a52ffff13ef677e471674b6 Reviewed-by: Lars Knoll --- .../hardwareintegration/qwaylandclientbufferintegration_p.h | 2 +- .../qwaylandclientbufferintegrationfactory_p.h | 1 + .../qwaylandclientbufferintegrationplugin_p.h | 3 ++- .../hardwareintegration/qwaylandhardwareintegration_p.h | 1 + .../hardwareintegration/qwaylandserverbufferintegration_p.h | 3 ++- .../qwaylandserverbufferintegrationfactory_p.h | 1 + .../qwaylandserverbufferintegrationplugin_p.h | 3 ++- .../qwaylandinputdeviceintegration_p.h | 2 +- .../qwaylandinputdeviceintegrationfactory_p.h | 1 + .../qwaylandinputdeviceintegrationplugin_p.h | 1 + src/plugins/platforms/wayland/qwaylandabstractdecoration_p.h | 5 +++-- src/plugins/platforms/wayland/qwaylandbuffer_p.h | 3 ++- src/plugins/platforms/wayland/qwaylandclipboard_p.h | 3 ++- src/plugins/platforms/wayland/qwaylandcursor_p.h | 3 ++- src/plugins/platforms/wayland/qwaylanddecorationfactory_p.h | 1 + src/plugins/platforms/wayland/qwaylanddecorationplugin_p.h | 1 + src/plugins/platforms/wayland/qwaylandextendedsurface_p.h | 3 ++- src/plugins/platforms/wayland/qwaylandinputmethodcontext_p.h | 3 ++- src/plugins/platforms/wayland/qwaylandintegration_p.h | 3 ++- src/plugins/platforms/wayland/qwaylandnativeinterface_p.h | 3 ++- src/plugins/platforms/wayland/qwaylandqtkey_p.h | 3 ++- src/plugins/platforms/wayland/qwaylandscreen_p.h | 3 ++- src/plugins/platforms/wayland/qwaylandshellsurface_p.h | 3 ++- src/plugins/platforms/wayland/qwaylandshm_p.h | 1 + src/plugins/platforms/wayland/qwaylandsubsurface_p.h | 4 ++-- src/plugins/platforms/wayland/qwaylandsurface_p.h | 1 + src/plugins/platforms/wayland/qwaylandtextinputinterface_p.h | 1 + src/plugins/platforms/wayland/qwaylandtouch_p.h | 3 ++- .../wayland/shared/qwaylandinputmethodeventbuilder_p.h | 1 + src/plugins/platforms/wayland/shared/qwaylandmimehelper_p.h | 1 + .../wayland/shared/qwaylandsharedmemoryformathelper_p.h | 3 ++- .../wayland/shellintegration/qwaylandshellintegration_p.h | 1 + .../shellintegration/qwaylandshellintegrationplugin_p.h | 1 + 33 files changed, 51 insertions(+), 21 deletions(-) diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegration_p.h b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegration_p.h index 7776c61582f..4bd78944206 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegration_p.h +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegration_p.h @@ -51,7 +51,7 @@ // We mean it. // -#include +#include #include QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationfactory_p.h b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationfactory_p.h index 29b00f44871..0a616b0daa7 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationfactory_p.h +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationfactory_p.h @@ -53,6 +53,7 @@ #include #include +#include QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationplugin_p.h b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationplugin_p.h index e66021916ba..640b92c2cae 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationplugin_p.h +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationplugin_p.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2018 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. @@ -56,6 +56,7 @@ #include #include #include +#include QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandhardwareintegration_p.h b/src/plugins/platforms/wayland/hardwareintegration/qwaylandhardwareintegration_p.h index 31b4209dc0d..ee0d1ea192d 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandhardwareintegration_p.h +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandhardwareintegration_p.h @@ -53,6 +53,7 @@ #include #include +#include QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegration_p.h b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegration_p.h index 6833efd0c28..b55ba982a38 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegration_p.h +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegration_p.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2019 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. @@ -56,6 +56,7 @@ #include #include +#include QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationfactory_p.h b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationfactory_p.h index f2e5820cc24..984f4f431f5 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationfactory_p.h +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationfactory_p.h @@ -53,6 +53,7 @@ #include #include +#include QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationplugin_p.h b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationplugin_p.h index b5e7ede4781..a34ea87653b 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationplugin_p.h +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationplugin_p.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2018 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. @@ -56,6 +56,7 @@ #include #include #include +#include QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegration_p.h b/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegration_p.h index 1fa0fd6de72..40df80b0c41 100644 --- a/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegration_p.h +++ b/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegration_p.h @@ -51,7 +51,7 @@ // We mean it. // -#include +#include #include #include diff --git a/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationfactory_p.h b/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationfactory_p.h index 776fcf3ee2d..ef7d12ab7e9 100644 --- a/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationfactory_p.h +++ b/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationfactory_p.h @@ -53,6 +53,7 @@ #include #include +#include QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationplugin_p.h b/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationplugin_p.h index bae6e216694..4c6b6d4e232 100644 --- a/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationplugin_p.h +++ b/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationplugin_p.h @@ -56,6 +56,7 @@ #include #include #include +#include QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandabstractdecoration_p.h b/src/plugins/platforms/wayland/qwaylandabstractdecoration_p.h index e9fbf8461e8..5e92f6935cc 100644 --- a/src/plugins/platforms/wayland/qwaylandabstractdecoration_p.h +++ b/src/plugins/platforms/wayland/qwaylandabstractdecoration_p.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2016 Robin Burchell -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2017 Robin Burchell +** Copyright (C) 2019 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. @@ -63,6 +63,7 @@ #include #include +#include QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandbuffer_p.h b/src/plugins/platforms/wayland/qwaylandbuffer_p.h index 945f1279af4..4cfcdfbedea 100644 --- a/src/plugins/platforms/wayland/qwaylandbuffer_p.h +++ b/src/plugins/platforms/wayland/qwaylandbuffer_p.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2018 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. @@ -57,6 +57,7 @@ #include #include +#include QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandclipboard_p.h b/src/plugins/platforms/wayland/qwaylandclipboard_p.h index ce14e1240e4..1dec2110550 100644 --- a/src/plugins/platforms/wayland/qwaylandclipboard_p.h +++ b/src/plugins/platforms/wayland/qwaylandclipboard_p.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2018 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. @@ -56,6 +56,7 @@ #include #include +#include QT_REQUIRE_CONFIG(clipboard); diff --git a/src/plugins/platforms/wayland/qwaylandcursor_p.h b/src/plugins/platforms/wayland/qwaylandcursor_p.h index 7ccdd71c86c..411e6a3472e 100644 --- a/src/plugins/platforms/wayland/qwaylandcursor_p.h +++ b/src/plugins/platforms/wayland/qwaylandcursor_p.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2019 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. @@ -54,6 +54,7 @@ #include #include #include +#include #if QT_CONFIG(cursor) diff --git a/src/plugins/platforms/wayland/qwaylanddecorationfactory_p.h b/src/plugins/platforms/wayland/qwaylanddecorationfactory_p.h index 98473d48ded..6afa2d74a58 100644 --- a/src/plugins/platforms/wayland/qwaylanddecorationfactory_p.h +++ b/src/plugins/platforms/wayland/qwaylanddecorationfactory_p.h @@ -53,6 +53,7 @@ #include #include +#include QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylanddecorationplugin_p.h b/src/plugins/platforms/wayland/qwaylanddecorationplugin_p.h index 41daaea05e3..6bda51e8131 100644 --- a/src/plugins/platforms/wayland/qwaylanddecorationplugin_p.h +++ b/src/plugins/platforms/wayland/qwaylanddecorationplugin_p.h @@ -56,6 +56,7 @@ #include #include #include +#include QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandextendedsurface_p.h b/src/plugins/platforms/wayland/qwaylandextendedsurface_p.h index d71ac6be9db..97458d8d49a 100644 --- a/src/plugins/platforms/wayland/qwaylandextendedsurface_p.h +++ b/src/plugins/platforms/wayland/qwaylandextendedsurface_p.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2018 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. @@ -57,6 +57,7 @@ #include #include +#include QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandinputmethodcontext_p.h b/src/plugins/platforms/wayland/qwaylandinputmethodcontext_p.h index 7fe64f2dade..6ce3ba71ea9 100644 --- a/src/plugins/platforms/wayland/qwaylandinputmethodcontext_p.h +++ b/src/plugins/platforms/wayland/qwaylandinputmethodcontext_p.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2020 The Qt Company Ltd. +** Copyright (C) 2022 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. @@ -57,6 +57,7 @@ #include #include +#include QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandintegration_p.h b/src/plugins/platforms/wayland/qwaylandintegration_p.h index d44c923120b..750440a9c34 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration_p.h +++ b/src/plugins/platforms/wayland/qwaylandintegration_p.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2019 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. @@ -55,6 +55,7 @@ #include #include #include +#include QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandnativeinterface_p.h b/src/plugins/platforms/wayland/qwaylandnativeinterface_p.h index 0edbdc9e697..89ea132d303 100644 --- a/src/plugins/platforms/wayland/qwaylandnativeinterface_p.h +++ b/src/plugins/platforms/wayland/qwaylandnativeinterface_p.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2020 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. @@ -55,6 +55,7 @@ #include #include +#include QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandqtkey_p.h b/src/plugins/platforms/wayland/qwaylandqtkey_p.h index 117c44a6d2e..8c8d959266b 100644 --- a/src/plugins/platforms/wayland/qwaylandqtkey_p.h +++ b/src/plugins/platforms/wayland/qwaylandqtkey_p.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2018 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. @@ -55,6 +55,7 @@ #include #include +#include QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandscreen_p.h b/src/plugins/platforms/wayland/qwaylandscreen_p.h index edd8f3a7a83..c4bf724da33 100644 --- a/src/plugins/platforms/wayland/qwaylandscreen_p.h +++ b/src/plugins/platforms/wayland/qwaylandscreen_p.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2020 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. @@ -56,6 +56,7 @@ #include #include +#include QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandshellsurface_p.h b/src/plugins/platforms/wayland/qwaylandshellsurface_p.h index 4779eebbae3..e7d2ed31920 100644 --- a/src/plugins/platforms/wayland/qwaylandshellsurface_p.h +++ b/src/plugins/platforms/wayland/qwaylandshellsurface_p.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2021 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the config.tests of the Qt Toolkit. @@ -55,6 +55,7 @@ #include #include #include +#include struct wl_surface; diff --git a/src/plugins/platforms/wayland/qwaylandshm_p.h b/src/plugins/platforms/wayland/qwaylandshm_p.h index bf2bbce4ecf..b6c45420563 100644 --- a/src/plugins/platforms/wayland/qwaylandshm_p.h +++ b/src/plugins/platforms/wayland/qwaylandshm_p.h @@ -56,6 +56,7 @@ #include #include +#include QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandsubsurface_p.h b/src/plugins/platforms/wayland/qwaylandsubsurface_p.h index 76da10b2459..1399f16e080 100644 --- a/src/plugins/platforms/wayland/qwaylandsubsurface_p.h +++ b/src/plugins/platforms/wayland/qwaylandsubsurface_p.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2018 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. @@ -51,7 +51,7 @@ // We mean it. // -#include +#include #include #include diff --git a/src/plugins/platforms/wayland/qwaylandsurface_p.h b/src/plugins/platforms/wayland/qwaylandsurface_p.h index 930a137ac84..d8fb7305bb6 100644 --- a/src/plugins/platforms/wayland/qwaylandsurface_p.h +++ b/src/plugins/platforms/wayland/qwaylandsurface_p.h @@ -54,6 +54,7 @@ #include #include +#include QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandtextinputinterface_p.h b/src/plugins/platforms/wayland/qwaylandtextinputinterface_p.h index 2b0f381b482..7825bc58c0b 100644 --- a/src/plugins/platforms/wayland/qwaylandtextinputinterface_p.h +++ b/src/plugins/platforms/wayland/qwaylandtextinputinterface_p.h @@ -53,6 +53,7 @@ #include #include +#include struct wl_surface; diff --git a/src/plugins/platforms/wayland/qwaylandtouch_p.h b/src/plugins/platforms/wayland/qwaylandtouch_p.h index 444e63facae..53cc43d80c2 100644 --- a/src/plugins/platforms/wayland/qwaylandtouch_p.h +++ b/src/plugins/platforms/wayland/qwaylandtouch_p.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2020 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. @@ -55,6 +55,7 @@ #include #include +#include QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/wayland/shared/qwaylandinputmethodeventbuilder_p.h b/src/plugins/platforms/wayland/shared/qwaylandinputmethodeventbuilder_p.h index f362562fa1b..77d65619df8 100644 --- a/src/plugins/platforms/wayland/shared/qwaylandinputmethodeventbuilder_p.h +++ b/src/plugins/platforms/wayland/shared/qwaylandinputmethodeventbuilder_p.h @@ -41,6 +41,7 @@ #define QWAYLANDINPUTMETHODEVENTBUILDER_H #include +#include QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/wayland/shared/qwaylandmimehelper_p.h b/src/plugins/platforms/wayland/shared/qwaylandmimehelper_p.h index 8048770502b..58ecbac00ab 100644 --- a/src/plugins/platforms/wayland/shared/qwaylandmimehelper_p.h +++ b/src/plugins/platforms/wayland/shared/qwaylandmimehelper_p.h @@ -43,6 +43,7 @@ #include #include #include +#include QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/wayland/shared/qwaylandsharedmemoryformathelper_p.h b/src/plugins/platforms/wayland/shared/qwaylandsharedmemoryformathelper_p.h index 6feaff3f9a7..e7cbafe579b 100644 --- a/src/plugins/platforms/wayland/shared/qwaylandsharedmemoryformathelper_p.h +++ b/src/plugins/platforms/wayland/shared/qwaylandsharedmemoryformathelper_p.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2020 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. @@ -41,6 +41,7 @@ #define QWAYLANDSHAREDMEMORYFORMATHELPER_H #include +#include //the correct protocol header for the wayland server or wayland client has to be //included before this file is included diff --git a/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegration_p.h b/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegration_p.h index 8acbf967044..68b90cda562 100644 --- a/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegration_p.h +++ b/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegration_p.h @@ -57,6 +57,7 @@ #include +#include struct wl_surface; struct wl_registry; diff --git a/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationplugin_p.h b/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationplugin_p.h index d6067569074..7c5a9e74ceb 100644 --- a/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationplugin_p.h +++ b/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationplugin_p.h @@ -56,6 +56,7 @@ #include #include #include +#include QT_BEGIN_NAMESPACE From b285a1d8af8952ff17d731e28a02f21533b3c1fd Mon Sep 17 00:00:00 2001 From: David Redondo Date: Mon, 24 Jan 2022 11:46:07 +0100 Subject: [PATCH 1057/1507] Add globalRemove to QWaylandClientExtension Adds support for handling of removal of the relevant global to QtWaylandClientExtension. The user is responsible for destroying the object once it becomes inactive to match the behavior on destruction. Two signals for globals and their removal are added to QWaylandDisplay to make it a bit nicer to use in a more "Qt-way". The addRregistryListener function is kept for now until other places are ported. Change-Id: I4ccbaa32e18a5ae15871aa23639e2b4a372cc34e Reviewed-by: David Edmundson --- .../global/qwaylandclientextension.cpp | 53 ++++-- .../global/qwaylandclientextension_p.h | 9 +- .../platforms/wayland/qwaylanddisplay.cpp | 3 +- .../platforms/wayland/qwaylanddisplay_p.h | 4 + tests/auto/wayland/CMakeLists.txt | 1 + .../wayland/clientextension/CMakeLists.txt | 14 ++ tests/auto/wayland/clientextension/test.xml | 6 + .../clientextension/tst_clientextension.cpp | 152 ++++++++++++++++++ 8 files changed, 221 insertions(+), 21 deletions(-) create mode 100644 tests/auto/wayland/clientextension/CMakeLists.txt create mode 100644 tests/auto/wayland/clientextension/test.xml create mode 100644 tests/auto/wayland/clientextension/tst_clientextension.cpp diff --git a/src/plugins/platforms/wayland/global/qwaylandclientextension.cpp b/src/plugins/platforms/wayland/global/qwaylandclientextension.cpp index f0bc950ce17..200dad072ed 100644 --- a/src/plugins/platforms/wayland/global/qwaylandclientextension.cpp +++ b/src/plugins/platforms/wayland/global/qwaylandclientextension.cpp @@ -1,6 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2017 Erik Larsson. +** Copyright (C) 2021 David Redondo ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the QtWaylandCompositor module of the Qt Toolkit. @@ -48,6 +49,8 @@ QT_BEGIN_NAMESPACE +using RegistryGlobal = QtWaylandClient::QWaylandDisplay::RegistryGlobal; + QWaylandClientExtensionPrivate::QWaylandClientExtensionPrivate() { // Keep the possibility to use a custom waylandIntegration as a plugin, @@ -60,23 +63,41 @@ QWaylandClientExtensionPrivate::QWaylandClientExtensionPrivate() qWarning() << "This application requires a Wayland platform plugin"; } -void QWaylandClientExtensionPrivate::handleRegistryGlobal(void *data, ::wl_registry *registry, uint32_t id, - const QString &interface, uint32_t version) +void QWaylandClientExtensionPrivate::globalAdded(const RegistryGlobal &global) { - QWaylandClientExtension *extension = static_cast(data); - if (interface == QLatin1String(extension->extensionInterface()->name) && !extension->d_func()->active) { - extension->bind(registry, id, version); - extension->d_func()->active = true; - emit extension->activeChanged(); + Q_Q(QWaylandClientExtension); + if (!active && global.interface == QLatin1String(q->extensionInterface()->name)) { + q->bind(global.registry, global.id, global.version); + active = true; + emit q->activeChanged(); + } +} + +void QWaylandClientExtensionPrivate::globalRemoved(const RegistryGlobal &global) +{ + Q_Q(QWaylandClientExtension); + if (active && global.interface == QLatin1String(q->extensionInterface()->name)) { + active = false; + emit q->activeChanged(); } } void QWaylandClientExtension::initialize() { Q_D(QWaylandClientExtension); - if (!d->registered) { - d->waylandIntegration->display()->addRegistryListener(&QWaylandClientExtensionPrivate::handleRegistryGlobal, this); - d->registered = true; + if (d->active) { + return; + } + const QtWaylandClient::QWaylandDisplay *display = d->waylandIntegration->display(); + const auto globals = display->globals(); + auto global = + std::find_if(globals.cbegin(), globals.cend(), [this](const RegistryGlobal &global) { + return global.interface == QLatin1String(extensionInterface()->name); + }); + if (global != globals.cend()) { + bind(global->registry, global->id, global->version); + d->active = true; + emit activeChanged(); } } @@ -85,17 +106,17 @@ QWaylandClientExtension::QWaylandClientExtension(const int ver) { Q_D(QWaylandClientExtension); d->version = ver; - - // The registry listener uses virtual functions and we don't want it to be called from - // the constructor. + auto display = d->waylandIntegration->display(); + QObjectPrivate::connect(display, &QtWaylandClient::QWaylandDisplay::globalAdded, d, + &QWaylandClientExtensionPrivate::globalAdded); + QObjectPrivate::connect(display, &QtWaylandClient::QWaylandDisplay::globalRemoved, d, + &QWaylandClientExtensionPrivate::globalRemoved); + // This function uses virtual functions and we don't want it to be called from the constructor. QMetaObject::invokeMethod(this, "initialize", Qt::QueuedConnection); } QWaylandClientExtension::~QWaylandClientExtension() { - Q_D(QWaylandClientExtension); - if (d->registered && !QCoreApplication::closingDown()) - d->waylandIntegration->display()->removeListener(&QWaylandClientExtensionPrivate::handleRegistryGlobal, this); } QtWaylandClient::QWaylandIntegration *QWaylandClientExtension::integration() const diff --git a/src/plugins/platforms/wayland/global/qwaylandclientextension_p.h b/src/plugins/platforms/wayland/global/qwaylandclientextension_p.h index 9091efbe558..621c14b7767 100644 --- a/src/plugins/platforms/wayland/global/qwaylandclientextension_p.h +++ b/src/plugins/platforms/wayland/global/qwaylandclientextension_p.h @@ -53,22 +53,23 @@ #include #include +#include #include QT_BEGIN_NAMESPACE class Q_WAYLAND_CLIENT_EXPORT QWaylandClientExtensionPrivate : public QObjectPrivate { - Q_DECLARE_PUBLIC(QWaylandClientExtension) public: + Q_DECLARE_PUBLIC(QWaylandClientExtension) QWaylandClientExtensionPrivate(); - static void handleRegistryGlobal(void *data, ::wl_registry *registry, uint32_t id, - const QString &interface, uint32_t version); + + void globalAdded(const QtWaylandClient::QWaylandDisplay::RegistryGlobal &global); + void globalRemoved(const QtWaylandClient::QWaylandDisplay::RegistryGlobal &global); QtWaylandClient::QWaylandIntegration *waylandIntegration = nullptr; int version = -1; bool active = false; - bool registered = false; }; class Q_WAYLAND_CLIENT_EXPORT QWaylandClientExtensionTemplatePrivate : public QWaylandClientExtensionPrivate diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index f8cb75e953b..79c68a93201 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -634,6 +634,7 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin } mGlobals.append(RegistryGlobal(id, interface, version, registry)); + emit globalAdded(mGlobals.back()); const auto copy = mRegistryListeners; // be prepared for listeners unregistering on notification for (Listener l : copy) @@ -690,7 +691,7 @@ void QWaylandDisplay::registry_global_remove(uint32_t id) inputDevice->setTextInputMethod(nullptr); mWaylandIntegration->reconfigureInputContext(); } - mGlobals.removeAt(i); + emit globalRemoved(mGlobals.takeAt(i)); break; } } diff --git a/src/plugins/platforms/wayland/qwaylanddisplay_p.h b/src/plugins/platforms/wayland/qwaylanddisplay_p.h index cf123cba3b2..5a83c3241ba 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay_p.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay_p.h @@ -228,6 +228,10 @@ public slots: void blockingReadEvents(); void flushRequests(); +signals: + void globalAdded(const RegistryGlobal &global); + void globalRemoved(const RegistryGlobal &global); + private: void handleWaylandSync(); void requestWaylandSync(); diff --git a/tests/auto/wayland/CMakeLists.txt b/tests/auto/wayland/CMakeLists.txt index accac45fa2c..e187d1daf07 100644 --- a/tests/auto/wayland/CMakeLists.txt +++ b/tests/auto/wayland/CMakeLists.txt @@ -3,6 +3,7 @@ add_subdirectory(shared) add_subdirectory(client) +add_subdirectory(clientextension) add_subdirectory(datadevicev1) add_subdirectory(fullscreenshellv1) add_subdirectory(iviapplication) diff --git a/tests/auto/wayland/clientextension/CMakeLists.txt b/tests/auto/wayland/clientextension/CMakeLists.txt new file mode 100644 index 00000000000..efcd575d29f --- /dev/null +++ b/tests/auto/wayland/clientextension/CMakeLists.txt @@ -0,0 +1,14 @@ +qt_internal_add_test(tst_clientextension + SOURCES + tst_clientextension.cpp + PUBLIC_LIBRARIES + SharedClientTest +) + +qt6_generate_wayland_protocol_client_sources(tst_clientextension + FILES ${CMAKE_CURRENT_SOURCE_DIR}/test.xml +) + +qt6_generate_wayland_protocol_server_sources(tst_clientextension + FILES ${CMAKE_CURRENT_SOURCE_DIR}/test.xml +) diff --git a/tests/auto/wayland/clientextension/test.xml b/tests/auto/wayland/clientextension/test.xml new file mode 100644 index 00000000000..f8d5b4eac4e --- /dev/null +++ b/tests/auto/wayland/clientextension/test.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/tests/auto/wayland/clientextension/tst_clientextension.cpp b/tests/auto/wayland/clientextension/tst_clientextension.cpp new file mode 100644 index 00000000000..ea7ef361b8f --- /dev/null +++ b/tests/auto/wayland/clientextension/tst_clientextension.cpp @@ -0,0 +1,152 @@ +/**************************************************************************** +** +** Copyright (C) 2021 David Redondo +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include "mockcompositor.h" +#include "coreprotocol.h" + +using namespace MockCompositor; + +class TestExtension : public QWaylandClientExtensionTemplate, + public QtWayland::test_interface +{ +public: + TestExtension() : QWaylandClientExtensionTemplate(1) { } + ~TestExtension() + { + if (object()) { + release(); + } + } + void initialize() { QWaylandClientExtension::initialize(); } +}; + +class TestGlobal : public Global, public QtWaylandServer::test_interface +{ + Q_OBJECT +public: + explicit TestGlobal(CoreCompositor *compositor) + : QtWaylandServer::test_interface(compositor->m_display, 1) + { + } +}; + +class tst_clientextension : public QObject, private CoreCompositor +{ + Q_OBJECT +private: + QtWaylandClient::QWaylandDisplay *display() + { + return static_cast( + QGuiApplicationPrivate::platformIntegration()) + ->display(); + } +private slots: + void cleanup() + { + display()->flushRequests(); + dispatch(); + exec([this] { removeAll(); }); + QTRY_COMPARE(display()->globals().size(), 0); + } + void createWithoutGlobal(); + void createWithGlobalAutomatic(); + void createWithGlobalManual(); + void globalBecomesAvailable(); + void globalRemoved(); +}; + +void tst_clientextension::createWithoutGlobal() +{ + TestExtension extension; + QSignalSpy spy(&extension, &QWaylandClientExtension::activeChanged); + QVERIFY(spy.isValid()); + QVERIFY(!extension.isActive()); + QCOMPARE(spy.count(), 0); + extension.initialize(); + QVERIFY(!extension.isActive()); + QCOMPARE(spy.count(), 0); +} + +void tst_clientextension::createWithGlobalAutomatic() +{ + exec([this] { add(); }); + QTRY_COMPARE(display()->globals().size(), 1); + TestExtension extension; + QSignalSpy spy(&extension, &QWaylandClientExtension::activeChanged); + QVERIFY(spy.isValid()); + QTRY_VERIFY(extension.isActive()); + QCOMPARE(spy.count(), 1); +} + +void tst_clientextension::createWithGlobalManual() +{ + exec([this] { add(); }); + QTRY_COMPARE(display()->globals().size(), 1); + // Wait for the display to have the global + TestExtension extension; + QSignalSpy spy(&extension, &QWaylandClientExtension::activeChanged); + QVERIFY(spy.isValid()); + extension.initialize(); + QVERIFY(extension.isActive()); + QCOMPARE(spy.count(), 1); +} + +void tst_clientextension::globalBecomesAvailable() +{ + TestExtension extension; + QSignalSpy spy(&extension, &QWaylandClientExtension::activeChanged); + QVERIFY(spy.isValid()); + exec([this] { add(); }); + QTRY_VERIFY(extension.isActive()); + QCOMPARE(spy.count(), 1); +} + +void tst_clientextension::globalRemoved() +{ + exec([this] { add(); }); + TestExtension extension; + QTRY_VERIFY(extension.isActive()); + QSignalSpy spy(&extension, &QWaylandClientExtension::activeChanged); + QVERIFY(spy.isValid()); + QCOMPOSITOR_TRY_COMPARE(get()->resourceMap().size(), 1); + + exec([this] { removeAll(); }); + QTRY_VERIFY(!extension.isActive()); + QCOMPARE(spy.count(), 1); +} + +QCOMPOSITOR_TEST_MAIN(tst_clientextension) +#include "tst_clientextension.moc" From 945ffa2fd7fad88d338281f612bd5cfbfc332e4a Mon Sep 17 00:00:00 2001 From: Liang Qi Date: Wed, 9 Mar 2022 10:47:42 +0100 Subject: [PATCH 1058/1507] client: update button state and etc in pointer_leave() The cleanup work needs to be done even the surface is null, for example, a window was closed in mouse press handler, then will not get a mouse release. Fixes: QTBUG-100942 Pick-to: 5.15 6.2 6.3 Change-Id: I637a6744909ddbe62bdeba6b21494e5a6ae7fa9f Reviewed-by: Tang Haixiang Reviewed-by: David Edmundson --- src/plugins/platforms/wayland/qwaylandinputdevice.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index 34ca328a62b..0cd42c1df8e 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -743,6 +743,11 @@ public: void QWaylandInputDevice::Pointer::pointer_leave(uint32_t time, struct wl_surface *surface) { + invalidateFocus(); + mButtons = Qt::NoButton; + + mParent->mTime = time; + // The event may arrive after destroying the window, indicated by // a null surface. if (!surface) @@ -754,11 +759,6 @@ void QWaylandInputDevice::Pointer::pointer_leave(uint32_t time, struct wl_surfac if (!QWaylandWindow::mouseGrab()) setFrameEvent(new LeaveEvent(window, mSurfacePos, mGlobalPos)); - - invalidateFocus(); - mButtons = Qt::NoButton; - - mParent->mTime = time; } class MotionEvent : public QWaylandPointerEvent From d9c88ebb911fa209799c9177ea1c6d2ac1dd458b Mon Sep 17 00:00:00 2001 From: Fabian Kosmale Date: Fri, 11 Mar 2022 11:14:01 +0100 Subject: [PATCH 1059/1507] wayland: do not rely on transitive includes Change-Id: I149e04d31ef3e897e25a91450427237069af4c34 Reviewed-by: Liang Qi --- src/plugins/platforms/wayland/qwaylanddataoffer_p.h | 3 +++ src/plugins/platforms/wayland/qwaylandextendedsurface_p.h | 1 + src/plugins/platforms/wayland/qwaylandinputcontext.cpp | 1 + src/plugins/platforms/wayland/qwaylandinputmethodcontext_p.h | 2 ++ src/plugins/platforms/wayland/qwaylandnativeinterface_p.h | 1 + src/plugins/platforms/wayland/qwaylandwindow_p.h | 2 ++ 6 files changed, 10 insertions(+) diff --git a/src/plugins/platforms/wayland/qwaylanddataoffer_p.h b/src/plugins/platforms/wayland/qwaylanddataoffer_p.h index c641ad3068a..bf100193d03 100644 --- a/src/plugins/platforms/wayland/qwaylanddataoffer_p.h +++ b/src/plugins/platforms/wayland/qwaylanddataoffer_p.h @@ -51,6 +51,9 @@ // We mean it. // +#include +#include + #include #include diff --git a/src/plugins/platforms/wayland/qwaylandextendedsurface_p.h b/src/plugins/platforms/wayland/qwaylandextendedsurface_p.h index 97458d8d49a..7748feb7aea 100644 --- a/src/plugins/platforms/wayland/qwaylandextendedsurface_p.h +++ b/src/plugins/platforms/wayland/qwaylandextendedsurface_p.h @@ -53,6 +53,7 @@ #include #include +#include // for QVariantMap #include diff --git a/src/plugins/platforms/wayland/qwaylandinputcontext.cpp b/src/plugins/platforms/wayland/qwaylandinputcontext.cpp index 32433cdc02e..b70f70f2872 100644 --- a/src/plugins/platforms/wayland/qwaylandinputcontext.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputcontext.cpp @@ -44,6 +44,7 @@ #include #include #include +#include #include "qwaylanddisplay_p.h" #include "qwaylandinputdevice_p.h" diff --git a/src/plugins/platforms/wayland/qwaylandinputmethodcontext_p.h b/src/plugins/platforms/wayland/qwaylandinputmethodcontext_p.h index 6ce3ba71ea9..cae6fc9b16b 100644 --- a/src/plugins/platforms/wayland/qwaylandinputmethodcontext_p.h +++ b/src/plugins/platforms/wayland/qwaylandinputmethodcontext_p.h @@ -55,6 +55,8 @@ #include #include #include +#include +#include #include #include diff --git a/src/plugins/platforms/wayland/qwaylandnativeinterface_p.h b/src/plugins/platforms/wayland/qwaylandnativeinterface_p.h index 89ea132d303..a2d26ef7644 100644 --- a/src/plugins/platforms/wayland/qwaylandnativeinterface_p.h +++ b/src/plugins/platforms/wayland/qwaylandnativeinterface_p.h @@ -56,6 +56,7 @@ #include #include +#include QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index 70d878f44cb..4bbcc93c3c0 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -60,6 +60,8 @@ #include #include #include +#include +#include // for QVariantMap #include From 077df2acef32be7592fd101a032cd5ed7627ba7f Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Thu, 3 Feb 2022 19:42:33 +0000 Subject: [PATCH 1060/1507] Guard mResizeDirty by the correctMutex mResizeDirty is used in the GUI thread in setCanResize which can be called from the GUI thread. It is queried and set whilst the resizeLock is held. We need to guard our usage. Change-Id: I5f8dcf8aa2cb2c4bb6274103df1da9e3e268605a Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 9217d19be80..1ede3827590 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -372,11 +372,12 @@ void QWaylandWindow::setGeometry(const QRect &rect) if (mWindowDecorationEnabled) mWindowDecoration->update(); - if (mResizeAfterSwap && windowType() == Egl && mSentInitialResize) + if (mResizeAfterSwap && windowType() == Egl && mSentInitialResize) { + QMutexLocker lock(&mResizeLock); mResizeDirty = true; - else + } else { QWindowSystemInterface::handleGeometryChange(window(), geometry()); - + } mSentInitialResize = true; } QRect exposeGeometry(QPoint(), geometry().size()); From eddb08768fd896c70785ea5f9e91c5e7cdd57a63 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Tue, 15 Mar 2022 15:59:15 +0100 Subject: [PATCH 1061/1507] Revert "Client: Remove mWaitingForUpdateDelivery" The reverted commit introduces a severe performance regression when a client window is resized while a QtQuick renderthread animation is running. This reverts commit e625089f40ab5b2f3220a9ffc3e047d1c3fc2740. Fixes: QTBUG-101726 Change-Id: Ib5b52ce06efec8c86fada1623c2af82099e57fc6 Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 11 ++++++++--- src/plugins/platforms/wayland/qwaylandwindow_p.h | 1 + 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 1ede3827590..05e7160be23 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -716,9 +716,12 @@ void QWaylandWindow::handleFrameCallback() mFrameCallbackElapsedTimer.invalidate(); // The rest can wait until we can run it on the correct thread - // Queued connection, to make sure we don't call handleUpdate() from inside waitForFrameSync() - // in the single-threaded case. - QMetaObject::invokeMethod(this, &QWaylandWindow::doHandleFrameCallback, Qt::QueuedConnection); + if (!mWaitingForUpdateDelivery) { + // Queued connection, to make sure we don't call handleUpdate() from inside waitForFrameSync() + // in the single-threaded case. + mWaitingForUpdateDelivery = true; + QMetaObject::invokeMethod(this, &QWaylandWindow::doHandleFrameCallback, Qt::QueuedConnection); + } mFrameSyncWait.notify_all(); } @@ -731,6 +734,8 @@ void QWaylandWindow::doHandleFrameCallback() sendExposeEvent(QRect(QPoint(), geometry().size())); if (wasExposed && hasPendingUpdateRequest()) deliverUpdateRequest(); + + mWaitingForUpdateDelivery = false; } bool QWaylandWindow::waitForFrameSync(int timeout) diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index 4bbcc93c3c0..d8eebb738aa 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -283,6 +283,7 @@ protected: WId mWindowId; bool mWaitingForFrameCallback = false; bool mFrameCallbackTimedOut = false; // Whether the frame callback has timed out + bool mWaitingForUpdateDelivery = false; int mFrameCallbackCheckIntervalTimerId = -1; QElapsedTimer mFrameCallbackElapsedTimer; struct ::wl_callback *mFrameCallback = nullptr; From b41a7e47ee42060c7a5ab805d368f7ba15e5c742 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Tue, 15 Mar 2022 16:53:04 +0100 Subject: [PATCH 1062/1507] Fix race condition on mWaitingForUpdateDelivery Change-Id: I0e91bda73722468b9339fc434fe04420b5e7d3da Reviewed-by: David Edmundson --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 6 ++---- src/plugins/platforms/wayland/qwaylandwindow_p.h | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 05e7160be23..23e7366088e 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -716,18 +716,17 @@ void QWaylandWindow::handleFrameCallback() mFrameCallbackElapsedTimer.invalidate(); // The rest can wait until we can run it on the correct thread - if (!mWaitingForUpdateDelivery) { + if (mWaitingForUpdateDelivery.testAndSetAcquire(false, true)) { // Queued connection, to make sure we don't call handleUpdate() from inside waitForFrameSync() // in the single-threaded case. - mWaitingForUpdateDelivery = true; QMetaObject::invokeMethod(this, &QWaylandWindow::doHandleFrameCallback, Qt::QueuedConnection); } - mFrameSyncWait.notify_all(); } void QWaylandWindow::doHandleFrameCallback() { + mWaitingForUpdateDelivery.storeRelease(false); bool wasExposed = isExposed(); mFrameCallbackTimedOut = false; if (!wasExposed && isExposed()) // Did setting mFrameCallbackTimedOut make the window exposed? @@ -735,7 +734,6 @@ void QWaylandWindow::doHandleFrameCallback() if (wasExposed && hasPendingUpdateRequest()) deliverUpdateRequest(); - mWaitingForUpdateDelivery = false; } bool QWaylandWindow::waitForFrameSync(int timeout) diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index d8eebb738aa..8fcbc4dccb6 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -283,7 +283,7 @@ protected: WId mWindowId; bool mWaitingForFrameCallback = false; bool mFrameCallbackTimedOut = false; // Whether the frame callback has timed out - bool mWaitingForUpdateDelivery = false; + QAtomicInt mWaitingForUpdateDelivery = false; int mFrameCallbackCheckIntervalTimerId = -1; QElapsedTimer mFrameCallbackElapsedTimer; struct ::wl_callback *mFrameCallback = nullptr; From b72632e01e81ab1317f11d93b3ba25f483e1a77e Mon Sep 17 00:00:00 2001 From: Liang Qi Date: Thu, 10 Mar 2022 12:44:59 +0100 Subject: [PATCH 1063/1507] tests: fix DefaultCompositor::surface() when index > 0 This amends c98bbc549557b1e0e7c972687ac2760204dff2a5. Pick-to: 6.3 Change-Id: Id0759ebab699d762c134246d0ec9f72b03923bac Reviewed-by: Eskil Abrahamsen Blomfeldt --- tests/auto/wayland/shared/mockcompositor.cpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/tests/auto/wayland/shared/mockcompositor.cpp b/tests/auto/wayland/shared/mockcompositor.cpp index d3742e0947b..c62ddfab4a3 100644 --- a/tests/auto/wayland/shared/mockcompositor.cpp +++ b/tests/auto/wayland/shared/mockcompositor.cpp @@ -81,23 +81,25 @@ DefaultCompositor::DefaultCompositor(CompositorType t) Surface *DefaultCompositor::surface(int i) { - Surface *result = nullptr; + QList surfaces; switch (m_type) { case CompositorType::Default: - result = get()->m_surfaces.value(i, nullptr); - break; + return get()->m_surfaces.value(i, nullptr); case CompositorType::Legacy: { - QList surfaces = get()->m_surfaces; - for (Surface *surface : surfaces) { + QList msurfaces = get()->m_surfaces; + for (Surface *surface : msurfaces) { if (surface->isMapped()) { - result = surface; - break; + surfaces << surface; } } } break; } - return result; + + if (i >= 0 && i < surfaces.size()) + return surfaces[i]; + + return nullptr; } uint DefaultCompositor::sendXdgShellPing() From fe472ee0f45c29bd7cfdde9a12631b972d28401f Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Thu, 3 Feb 2022 14:27:56 +0000 Subject: [PATCH 1064/1507] Client: Fix up thread usage for mSurface It didn't make sense that mSurface was protected, but the mutex was not. Also try to improve documentation. Change-Id: I2f59557cccbb2d6f0b2772ce3c8a2dab01167a6c Reviewed-by: David Edmundson --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 2 +- src/plugins/platforms/wayland/qwaylandwindow_p.h | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 23e7366088e..dce6590a8ec 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -76,8 +76,8 @@ QWaylandWindow *QWaylandWindow::mMouseGrab = nullptr; QWaylandWindow::QWaylandWindow(QWindow *window, QWaylandDisplay *display) : QPlatformWindow(window) , mDisplay(display) - , mResizeAfterSwap(qEnvironmentVariableIsSet("QT_WAYLAND_RESIZE_AFTER_SWAP")) , mSurfaceLock(QReadWriteLock::Recursive) + , mResizeAfterSwap(qEnvironmentVariableIsSet("QT_WAYLAND_RESIZE_AFTER_SWAP")) { { bool ok; diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index 8fcbc4dccb6..102db1b43c1 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -253,7 +253,11 @@ protected: QMargins clientSideMargins() const; QWaylandDisplay *mDisplay = nullptr; + + // mSurface can be written by the main thread. Other threads should claim a read lock for access + mutable QReadWriteLock mSurfaceLock; QScopedPointer mSurface; + QWaylandShellSurface *mShellSurface = nullptr; QWaylandSubSurface *mSubSurfaceWindow = nullptr; QList mChildren; @@ -343,8 +347,6 @@ private: static QWaylandWindow *mMouseGrab; - mutable QReadWriteLock mSurfaceLock; - friend class QWaylandSubSurface; }; From e2281491420edb35fb8f203b8af7b18fb2e94658 Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Wed, 9 Feb 2022 13:22:15 +0000 Subject: [PATCH 1065/1507] client: Avoid trying to read/cancel read if wl_display_read_events failed wl_display_prepare_read and wl_display_read_events/wl_display_cancel_read must come as matching pairs. Otherwise we set libwayland's internal read count to a negative number and causes all types of deadlocks. If prepareReadQueue fails but we haven't explicitly quit waitForReading returns a success statement but we haven't opened anything. Pragmatically most times wl_display_prepare_read fails it's because of a wayland error which is handled by exiting anyway, but it is better to err on the side of safety. Change-Id: Ia29c3217622d97594404be3daf4c50338a1d3fb0 Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/plugins/platforms/wayland/qwaylanddisplay.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index 79c68a93201..2c275a92e22 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -216,6 +216,9 @@ protected: // Make the main thread call wl_prepare_read(), dispatch the pending messages and flush the // outbound ones. Wait until it's done before proceeding, unless we're told to quit. while (waitForReading()) { + if (!m_reading.loadRelaxed()) + break; + pollfd fds[2] = { { m_fd, POLLIN, 0 }, { m_pipefd[0], POLLIN, 0 } }; poll(fds, 2, -1); From b3395051bfc231eba990c62470fa8380c34f6235 Mon Sep 17 00:00:00 2001 From: Liang Qi Date: Tue, 8 Mar 2022 15:41:38 +0100 Subject: [PATCH 1066/1507] client: add ScreenWindowGrabbing capability MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On Wayland, there is no protocol to do it yet. Task-number: QTBUG-100792 Task-number: QTBUG-101145 Change-Id: I4bfef2920547babf0ccc00a27062d0db77ae5b7f Reviewed-by: Tor Arne Vestbø --- src/plugins/platforms/wayland/qwaylandintegration.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/plugins/platforms/wayland/qwaylandintegration.cpp b/src/plugins/platforms/wayland/qwaylandintegration.cpp index 3e08b2d008d..255aea3ee99 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandintegration.cpp @@ -162,6 +162,8 @@ bool QWaylandIntegration::hasCapability(QPlatformIntegration::Capability cap) co return true; case WindowActivation: return false; + case ScreenWindowGrabbing: // whether QScreen::grabWindow() is supported + return false; default: return QPlatformIntegration::hasCapability(cap); } } From dd83a27fec48b6b1814dd620e5cb5d548b7475f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kai=20K=C3=B6hne?= Date: Wed, 30 Mar 2022 12:29:32 +0200 Subject: [PATCH 1067/1507] Fix format of qt_attribution.json files Also fix a typo in the license name. Amends db3df0b3b439a Pick-to: 6.3.0 6.3 Fixes: QTBUG-102148 Change-Id: Ic231a4b744864c19190d428a9a2fc5101ffa77f0 Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/3rdparty/wayland/protocols/qt_attribution.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/3rdparty/wayland/protocols/qt_attribution.json b/src/3rdparty/wayland/protocols/qt_attribution.json index 89ffb6ed9b6..f51599de08a 100644 --- a/src/3rdparty/wayland/protocols/qt_attribution.json +++ b/src/3rdparty/wayland/protocols/qt_attribution.json @@ -155,15 +155,15 @@ "Name": "Wayland xdg-activation Protocol", "QDocModule": "qtwaylandcompositor", "QtUsage": "Used in the Qt Wayland platform plugin", - "File": "xdg-activation-v1.xml", + "Files": "xdg-activation-v1.xml", "Description": "The xdg-activation protocol provides a way for one client to pass focus to another.", "Homepage": "https://wayland.freedesktop.org", "Version": "unstable v1, version 1", "DownloadLocation": "https://gitlab.freedesktop.org/wayland/wayland-protocols/-/blob/main/staging/xdg-activation/xdg-activation-v1.xml", "LicenseId": "MIT", - "License": "MIT LIcense", - "License file": "MIT_LICENSE.txt", + "License": "MIT License", + "LicenseFile": "MIT_LICENSE.txt", "Copyright": "Copyright © 2020 Aleix Pol Gonzalez <aleixpol@kde.org>\nCopyright © 2020 Carlos Garnacho <carlosg@gnome.org>" }, From 179d0d34fa6b7d8d90ea766ac146c4b6485f3803 Mon Sep 17 00:00:00 2001 From: Liang Qi Date: Fri, 11 Mar 2022 09:17:25 +0100 Subject: [PATCH 1068/1507] client: Synthesize enter/leave event for popup in xdg-shell MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes: QTBUG-100148 Pick-to: 6.3 6.2 5.15 Change-Id: I45e3156d7942cff9968674c0b253d15be7235921 Reviewed-by: Tang Haixiang Reviewed-by: Qt CI Bot Reviewed-by: Tor Arne Vestbø --- .../xdg-shell/qwaylandxdgshell.cpp | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp index aaeeb7c4080..4603ec11d05 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp @@ -226,6 +226,16 @@ QWaylandXdgSurface::Popup::~Popup() auto *shell = m_xdgSurface->m_shell; Q_ASSERT(shell->m_topmostGrabbingPopup == this); shell->m_topmostGrabbingPopup = m_parent ? m_parent->m_popup : nullptr; + m_grabbing = false; + + // Synthesize Qt enter/leave events for popup + QWindow *leave = nullptr; + if (m_xdgSurface && m_xdgSurface->window()) + leave = m_xdgSurface->window()->window(); + QWindowSystemInterface::handleLeaveEvent(leave); + + if (QWindow *enter = QGuiApplication::topLevelAt(QCursor::pos())) + QWindowSystemInterface::handleEnterEvent(enter, enter->mapFromGlobal(QCursor::pos()), QCursor::pos()); } } @@ -462,6 +472,23 @@ void QWaylandXdgSurface::setGrabPopup(QWaylandWindow *parent, QWaylandInputDevic } setPopup(parent); m_popup->grab(device, serial); + + // Synthesize Qt enter/leave events for popup + if (!parent) + return; + QWindow *current = QGuiApplication::topLevelAt(QCursor::pos()); + QWindow *leave = parent->window(); + if (current != leave) + return; + + QWindowSystemInterface::handleLeaveEvent(leave); + + QWindow *enter = nullptr; + if (m_popup && m_popup->m_xdgSurface && m_popup->m_xdgSurface->window()) + enter = m_popup->m_xdgSurface->window()->window(); + + if (enter) + QWindowSystemInterface::handleEnterEvent(enter, enter->mapFromGlobal(QCursor::pos()), QCursor::pos()); } void QWaylandXdgSurface::xdg_surface_configure(uint32_t serial) From bb2788d9f7d69155ef32c228894ad6424cec8c72 Mon Sep 17 00:00:00 2001 From: Kenneth Topp Date: Mon, 4 Apr 2022 09:36:21 -0400 Subject: [PATCH 1069/1507] use poll(2) when reading from clipboard change clipboard read away from select(2) call which can fail when an application has large number of open files Change-Id: I6d98c6bb11cdd5b6171b01cfeb0044dd41cf9fb5 Reviewed-by: Thiago Macieira --- .../platforms/wayland/qwaylanddataoffer.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylanddataoffer.cpp b/src/plugins/platforms/wayland/qwaylanddataoffer.cpp index 6271f0fa878..a339ade35a2 100644 --- a/src/plugins/platforms/wayland/qwaylanddataoffer.cpp +++ b/src/plugins/platforms/wayland/qwaylanddataoffer.cpp @@ -188,17 +188,18 @@ QVariant QWaylandMimeData::retrieveData_sys(const QString &mimeType, QMetaType t int QWaylandMimeData::readData(int fd, QByteArray &data) const { - fd_set readset; - FD_ZERO(&readset); - FD_SET(fd, &readset); - struct timeval timeout; + struct pollfd readset; + readset.fd = fd; + readset.events = POLLIN; + struct timespec timeout; timeout.tv_sec = 1; - timeout.tv_usec = 0; + timeout.tv_nsec = 0; + Q_FOREVER { - int ready = select(FD_SETSIZE, &readset, nullptr, nullptr, &timeout); + int ready = qt_safe_poll(&readset, 1, &timeout); if (ready < 0) { - qWarning() << "QWaylandDataOffer: select() failed"; + qWarning() << "QWaylandDataOffer: qt_safe_poll() failed"; return -1; } else if (ready == 0) { qWarning("QWaylandDataOffer: timeout reading from pipe"); From 27c6c16743df79c354fa5639c901a5600ee92962 Mon Sep 17 00:00:00 2001 From: Tang Haixiang Date: Fri, 15 Apr 2022 13:32:21 +0800 Subject: [PATCH 1070/1507] Use QPlatformWindow's API as much as possible in QPA MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When using highdpi, window->geometry != platformwindow->geometry. In QPA we should use QPlatformWindow's API. Fixes: QTBUG-102601 Change-Id: Ib4ff2edbc045cf441cd2d594d502875417eb4917 Reviewed-by: Tor Arne Vestbø Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/plugins/platforms/wayland/qwaylandinputdevice.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index 0cd42c1df8e..9566965bed9 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -717,7 +717,7 @@ void QWaylandInputDevice::Pointer::pointer_enter(uint32_t serial, struct wl_surf connect(mFocus.data(), &QObject::destroyed, this, &Pointer::handleFocusDestroyed); mSurfacePos = QPointF(wl_fixed_to_double(sx), wl_fixed_to_double(sy)); - mGlobalPos = window->window()->mapToGlobal(mSurfacePos.toPoint()); + mGlobalPos = window->mapToGlobal(mSurfacePos.toPoint()); mParent->mSerial = serial; mEnterSerial = serial; @@ -783,7 +783,7 @@ void QWaylandInputDevice::Pointer::pointer_motion(uint32_t time, wl_fixed_t surf QPointF pos(wl_fixed_to_double(surface_x), wl_fixed_to_double(surface_y)); QPointF delta = pos - pos.toPoint(); - QPointF global = window->window()->mapToGlobal(pos.toPoint()); + QPointF global = window->mapToGlobal(pos.toPoint()); global += delta; mSurfacePos = pos; @@ -795,7 +795,7 @@ void QWaylandInputDevice::Pointer::pointer_motion(uint32_t time, wl_fixed_t surf // We can't know the true position since we're getting events for another surface, // so we just set it outside of the window boundaries. pos = QPointF(-1, -1); - global = grab->window()->mapToGlobal(pos.toPoint()); + global = grab->mapToGlobal(pos.toPoint()); window = grab; } setFrameEvent(new MotionEvent(window, time, pos, global, mButtons, mParent->modifiers())); @@ -875,7 +875,7 @@ void QWaylandInputDevice::Pointer::pointer_button(uint32_t serial, uint32_t time QPointF global = mGlobalPos; if (grab && grab != focusWindow()) { pos = QPointF(-1, -1); - global = grab->window()->mapToGlobal(pos.toPoint()); + global = grab->mapToGlobal(pos.toPoint()); window = grab; } @@ -1487,7 +1487,7 @@ void QWaylandInputDevice::handleTouchPoint(int id, QEventPoint::State state, con // TODO: This doesn't account for high dpi scaling for the delta, but at least it matches // what we have for mouse input. QPointF delta = localPosition - localPosition.toPoint(); - QPointF globalPosition = win->window()->mapToGlobal(localPosition.toPoint()) + delta; + QPointF globalPosition = win->mapToGlobal(localPosition.toPoint()) + delta; tp.area.moveCenter(globalPosition); } From 66217476bbe9d61588d36dc95ba31fbad2e1a620 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 22 Apr 2022 13:54:11 -0700 Subject: [PATCH 1071/1507] QtWaylandClient: use the CMake exports.h support The one in qtwaylandglobal.h was wrong. It just happened to work on Linux because the lack of import wasn't an error... until GCC 12 with -mno-direct-extern-access. Pick-to: 6.3 Change-Id: If05aeeb7176e4f13af9afffd16e8535b469f9158 Reviewed-by: Qt CI Bot Reviewed-by: Alexandru Croitor Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/plugins/platforms/wayland/CMakeLists.txt | 1 + .../platforms/wayland/global/qwaylandclientextension.h | 4 ++-- .../wayland/global/qwaylandclientextension_p.h | 4 ++-- .../qwaylandclientbufferintegration_p.h | 2 +- .../qwaylandclientbufferintegrationfactory_p.h | 2 +- .../qwaylandclientbufferintegrationplugin_p.h | 2 +- .../qwaylandhardwareintegration_p.h | 2 +- .../qwaylandserverbufferintegration_p.h | 4 ++-- .../qwaylandserverbufferintegrationfactory_p.h | 2 +- .../qwaylandserverbufferintegrationplugin_p.h | 2 +- .../qwaylandinputdeviceintegration_p.h | 2 +- .../qwaylandinputdeviceintegrationfactory_p.h | 2 +- .../qwaylandinputdeviceintegrationplugin_p.h | 2 +- .../wayland/plugins/decorations/bradient/main.cpp | 2 +- .../qwaylandfullscreenshellv1integration.h | 2 +- .../qwaylandfullscreenshellv1surface.h | 2 +- .../wl-shell/qwaylandwlshellintegration_p.h | 2 +- .../wl-shell/qwaylandwlshellsurface_p.h | 2 +- .../xdg-shell/qwaylandxdgactivationv1_p.h | 4 ++-- .../xdg-shell/qwaylandxdgdecorationv1_p.h | 4 ++-- .../shellintegration/xdg-shell/qwaylandxdgshell_p.h | 4 ++-- .../xdg-shell/qwaylandxdgshellintegration_p.h | 2 +- src/plugins/platforms/wayland/qtwaylandclientglobal.h | 9 +-------- .../platforms/wayland/qwaylandabstractdecoration_p.h | 2 +- src/plugins/platforms/wayland/qwaylandbuffer_p.h | 2 +- src/plugins/platforms/wayland/qwaylandclipboard_p.h | 2 +- src/plugins/platforms/wayland/qwaylandcursor_p.h | 4 ++-- .../platforms/wayland/qwaylanddatadevicemanager_p.h | 2 +- src/plugins/platforms/wayland/qwaylanddataoffer_p.h | 2 +- src/plugins/platforms/wayland/qwaylanddatasource_p.h | 2 +- .../platforms/wayland/qwaylanddecorationfactory_p.h | 2 +- .../platforms/wayland/qwaylanddecorationplugin_p.h | 2 +- src/plugins/platforms/wayland/qwaylanddisplay_p.h | 4 ++-- src/plugins/platforms/wayland/qwaylanddnd_p.h | 2 +- .../platforms/wayland/qwaylandextendedsurface_p.h | 2 +- src/plugins/platforms/wayland/qwaylandinputdevice_p.h | 8 ++++---- src/plugins/platforms/wayland/qwaylandintegration_p.h | 2 +- .../platforms/wayland/qwaylandnativeinterface_p.h | 2 +- .../platforms/wayland/qwaylandpointergestures_p.h | 6 +++--- .../platforms/wayland/qwaylandprimaryselectionv1_p.h | 2 +- src/plugins/platforms/wayland/qwaylandqtkey_p.h | 2 +- src/plugins/platforms/wayland/qwaylandscreen_p.h | 4 ++-- src/plugins/platforms/wayland/qwaylandshellsurface_p.h | 2 +- src/plugins/platforms/wayland/qwaylandshm_p.h | 2 +- .../platforms/wayland/qwaylandshmbackingstore_p.h | 4 ++-- src/plugins/platforms/wayland/qwaylandshmwindow_p.h | 2 +- src/plugins/platforms/wayland/qwaylandsubsurface_p.h | 2 +- src/plugins/platforms/wayland/qwaylandtabletv2_p.h | 10 +++++----- src/plugins/platforms/wayland/qwaylandtouch_p.h | 2 +- src/plugins/platforms/wayland/qwaylandwindow_p.h | 2 +- .../wayland/qwaylandwindowmanagerintegration_p.h | 2 +- .../shellintegration/qwaylandshellintegration_p.h | 4 ++-- .../qwaylandshellintegrationfactory_p.h | 2 +- .../qwaylandshellintegrationplugin_p.h | 2 +- 54 files changed, 74 insertions(+), 80 deletions(-) diff --git a/src/plugins/platforms/wayland/CMakeLists.txt b/src/plugins/platforms/wayland/CMakeLists.txt index 1041f31e15c..be6065c1449 100644 --- a/src/plugins/platforms/wayland/CMakeLists.txt +++ b/src/plugins/platforms/wayland/CMakeLists.txt @@ -6,6 +6,7 @@ qt_internal_add_module(WaylandClient PLUGIN_TYPES wayland-graphics-integration-client wayland-inputdevice-integration wayland-decoration-client wayland-shell-integration + GENERATE_CPP_EXPORTS SOURCES ../shared/qwaylandinputmethodeventbuilder.cpp ../shared/qwaylandinputmethodeventbuilder_p.h ../shared/qwaylandmimehelper.cpp ../shared/qwaylandmimehelper_p.h diff --git a/src/plugins/platforms/wayland/global/qwaylandclientextension.h b/src/plugins/platforms/wayland/global/qwaylandclientextension.h index 350e32a42f3..f9e5fe2a721 100644 --- a/src/plugins/platforms/wayland/global/qwaylandclientextension.h +++ b/src/plugins/platforms/wayland/global/qwaylandclientextension.h @@ -55,7 +55,7 @@ class QWaylandIntegration; class QWaylandClientExtensionPrivate; class QWaylandClientExtensionTemplatePrivate; -class Q_WAYLAND_CLIENT_EXPORT QWaylandClientExtension : public QObject +class Q_WAYLANDCLIENT_EXPORT QWaylandClientExtension : public QObject { Q_OBJECT Q_DECLARE_PRIVATE(QWaylandClientExtension) @@ -82,7 +82,7 @@ protected Q_SLOTS: }; template -class Q_WAYLAND_CLIENT_EXPORT QWaylandClientExtensionTemplate : public QWaylandClientExtension +class Q_WAYLANDCLIENT_EXPORT QWaylandClientExtensionTemplate : public QWaylandClientExtension { Q_DECLARE_PRIVATE(QWaylandClientExtensionTemplate) public: diff --git a/src/plugins/platforms/wayland/global/qwaylandclientextension_p.h b/src/plugins/platforms/wayland/global/qwaylandclientextension_p.h index 621c14b7767..b57d28f1e1c 100644 --- a/src/plugins/platforms/wayland/global/qwaylandclientextension_p.h +++ b/src/plugins/platforms/wayland/global/qwaylandclientextension_p.h @@ -58,7 +58,7 @@ QT_BEGIN_NAMESPACE -class Q_WAYLAND_CLIENT_EXPORT QWaylandClientExtensionPrivate : public QObjectPrivate +class Q_WAYLANDCLIENT_EXPORT QWaylandClientExtensionPrivate : public QObjectPrivate { public: Q_DECLARE_PUBLIC(QWaylandClientExtension) @@ -72,7 +72,7 @@ public: bool active = false; }; -class Q_WAYLAND_CLIENT_EXPORT QWaylandClientExtensionTemplatePrivate : public QWaylandClientExtensionPrivate +class Q_WAYLANDCLIENT_EXPORT QWaylandClientExtensionTemplatePrivate : public QWaylandClientExtensionPrivate { public: QWaylandClientExtensionTemplatePrivate() diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegration_p.h b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegration_p.h index 4bd78944206..0aa8cd91b87 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegration_p.h +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegration_p.h @@ -65,7 +65,7 @@ namespace QtWaylandClient { class QWaylandWindow; class QWaylandDisplay; -class Q_WAYLAND_CLIENT_EXPORT QWaylandClientBufferIntegration +class Q_WAYLANDCLIENT_EXPORT QWaylandClientBufferIntegration { public: QWaylandClientBufferIntegration(); diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationfactory_p.h b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationfactory_p.h index 0a616b0daa7..f471dcf8d0f 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationfactory_p.h +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationfactory_p.h @@ -61,7 +61,7 @@ namespace QtWaylandClient { class QWaylandClientBufferIntegration; -class Q_WAYLAND_CLIENT_EXPORT QWaylandClientBufferIntegrationFactory +class Q_WAYLANDCLIENT_EXPORT QWaylandClientBufferIntegrationFactory { public: static QStringList keys(); diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationplugin_p.h b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationplugin_p.h index 640b92c2cae..e63bca41a22 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationplugin_p.h +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationplugin_p.h @@ -66,7 +66,7 @@ class QWaylandClientBufferIntegration; #define QWaylandClientBufferIntegrationFactoryInterface_iid "org.qt-project.Qt.WaylandClient.QWaylandClientBufferIntegrationFactoryInterface.5.3" -class Q_WAYLAND_CLIENT_EXPORT QWaylandClientBufferIntegrationPlugin : public QObject +class Q_WAYLANDCLIENT_EXPORT QWaylandClientBufferIntegrationPlugin : public QObject { Q_OBJECT public: diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandhardwareintegration_p.h b/src/plugins/platforms/wayland/hardwareintegration/qwaylandhardwareintegration_p.h index ee0d1ea192d..aa72d5905f3 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandhardwareintegration_p.h +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandhardwareintegration_p.h @@ -61,7 +61,7 @@ namespace QtWaylandClient { class QWaylandDisplay; -class Q_WAYLAND_CLIENT_EXPORT QWaylandHardwareIntegration : public QtWayland::qt_hardware_integration +class Q_WAYLANDCLIENT_EXPORT QWaylandHardwareIntegration : public QtWayland::qt_hardware_integration { public: QWaylandHardwareIntegration(struct ::wl_registry *registry, int id); diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegration_p.h b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegration_p.h index b55ba982a38..2fbe3b4010b 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegration_p.h +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegration_p.h @@ -66,7 +66,7 @@ namespace QtWaylandClient { class QWaylandDisplay; -class Q_WAYLAND_CLIENT_EXPORT QWaylandServerBuffer +class Q_WAYLANDCLIENT_EXPORT QWaylandServerBuffer { public: enum Format { @@ -94,7 +94,7 @@ private: void *m_user_data = nullptr; }; -class Q_WAYLAND_CLIENT_EXPORT QWaylandServerBufferIntegration +class Q_WAYLANDCLIENT_EXPORT QWaylandServerBufferIntegration { public: QWaylandServerBufferIntegration(); diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationfactory_p.h b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationfactory_p.h index 984f4f431f5..f41099895d9 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationfactory_p.h +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationfactory_p.h @@ -61,7 +61,7 @@ namespace QtWaylandClient { class QWaylandServerBufferIntegration; -class Q_WAYLAND_CLIENT_EXPORT QWaylandServerBufferIntegrationFactory +class Q_WAYLANDCLIENT_EXPORT QWaylandServerBufferIntegrationFactory { public: static QStringList keys(); diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationplugin_p.h b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationplugin_p.h index a34ea87653b..b82b487f15e 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationplugin_p.h +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationplugin_p.h @@ -66,7 +66,7 @@ class QWaylandServerBufferIntegration; #define QWaylandServerBufferIntegrationFactoryInterface_iid "org.qt-project.Qt.WaylandClient.QWaylandServerBufferIntegrationFactoryInterface.5.3" -class Q_WAYLAND_CLIENT_EXPORT QWaylandServerBufferIntegrationPlugin : public QObject +class Q_WAYLANDCLIENT_EXPORT QWaylandServerBufferIntegrationPlugin : public QObject { Q_OBJECT public: diff --git a/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegration_p.h b/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegration_p.h index 40df80b0c41..f034abc1c4f 100644 --- a/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegration_p.h +++ b/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegration_p.h @@ -63,7 +63,7 @@ namespace QtWaylandClient { class QWaylandDisplay; class QWaylandInputDevice; -class Q_WAYLAND_CLIENT_EXPORT QWaylandInputDeviceIntegration +class Q_WAYLANDCLIENT_EXPORT QWaylandInputDeviceIntegration { public: QWaylandInputDeviceIntegration() {} diff --git a/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationfactory_p.h b/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationfactory_p.h index ef7d12ab7e9..ac4fd713a2c 100644 --- a/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationfactory_p.h +++ b/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationfactory_p.h @@ -61,7 +61,7 @@ namespace QtWaylandClient { class QWaylandInputDeviceIntegration; -class Q_WAYLAND_CLIENT_EXPORT QWaylandInputDeviceIntegrationFactory +class Q_WAYLANDCLIENT_EXPORT QWaylandInputDeviceIntegrationFactory { public: static QStringList keys(); diff --git a/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationplugin_p.h b/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationplugin_p.h index 4c6b6d4e232..374411a70dc 100644 --- a/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationplugin_p.h +++ b/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationplugin_p.h @@ -66,7 +66,7 @@ class QWaylandInputDeviceIntegration; #define QWaylandInputDeviceIntegrationFactoryInterface_iid "org.qt-project.Qt.WaylandClient.QWaylandInputDeviceIntegrationFactoryInterface.5.3" -class Q_WAYLAND_CLIENT_EXPORT QWaylandInputDeviceIntegrationPlugin : public QObject +class Q_WAYLANDCLIENT_EXPORT QWaylandInputDeviceIntegrationPlugin : public QObject { Q_OBJECT public: diff --git a/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp b/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp index 2a32df3442f..1a48247738c 100644 --- a/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp +++ b/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp @@ -68,7 +68,7 @@ enum Button Minimize }; -class Q_WAYLAND_CLIENT_EXPORT QWaylandBradientDecoration : public QWaylandAbstractDecoration +class Q_WAYLANDCLIENT_EXPORT QWaylandBradientDecoration : public QWaylandAbstractDecoration { public: QWaylandBradientDecoration(); diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/fullscreen-shell-v1/qwaylandfullscreenshellv1integration.h b/src/plugins/platforms/wayland/plugins/shellintegration/fullscreen-shell-v1/qwaylandfullscreenshellv1integration.h index 131f9e72097..387a57f31b6 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/fullscreen-shell-v1/qwaylandfullscreenshellv1integration.h +++ b/src/plugins/platforms/wayland/plugins/shellintegration/fullscreen-shell-v1/qwaylandfullscreenshellv1integration.h @@ -50,7 +50,7 @@ QT_BEGIN_NAMESPACE namespace QtWaylandClient { -class Q_WAYLAND_CLIENT_EXPORT QWaylandFullScreenShellV1Integration : public QWaylandShellIntegration +class Q_WAYLANDCLIENT_EXPORT QWaylandFullScreenShellV1Integration : public QWaylandShellIntegration { public: bool initialize(QWaylandDisplay *display) override; diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/fullscreen-shell-v1/qwaylandfullscreenshellv1surface.h b/src/plugins/platforms/wayland/plugins/shellintegration/fullscreen-shell-v1/qwaylandfullscreenshellv1surface.h index 718e1e861a7..8e4baf32bb7 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/fullscreen-shell-v1/qwaylandfullscreenshellv1surface.h +++ b/src/plugins/platforms/wayland/plugins/shellintegration/fullscreen-shell-v1/qwaylandfullscreenshellv1surface.h @@ -50,7 +50,7 @@ QT_BEGIN_NAMESPACE namespace QtWaylandClient { -class Q_WAYLAND_CLIENT_EXPORT QWaylandFullScreenShellV1Surface : public QWaylandShellSurface +class Q_WAYLANDCLIENT_EXPORT QWaylandFullScreenShellV1Surface : public QWaylandShellSurface { public: QWaylandFullScreenShellV1Surface(QtWayland::zwp_fullscreen_shell_v1 *shell, QWaylandWindow *window); diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellintegration_p.h b/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellintegration_p.h index 3d76cc31073..974382af37e 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellintegration_p.h +++ b/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellintegration_p.h @@ -59,7 +59,7 @@ QT_BEGIN_NAMESPACE namespace QtWaylandClient { -class Q_WAYLAND_CLIENT_EXPORT QWaylandWlShellIntegration : public QWaylandShellIntegration +class Q_WAYLANDCLIENT_EXPORT QWaylandWlShellIntegration : public QWaylandShellIntegration { public: QWaylandWlShellIntegration() {} diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellsurface_p.h b/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellsurface_p.h index ca7ba602c73..ef938a5560c 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellsurface_p.h +++ b/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellsurface_p.h @@ -67,7 +67,7 @@ class QWaylandWindow; class QWaylandInputDevice; class QWaylandExtendedSurface; -class Q_WAYLAND_CLIENT_EXPORT QWaylandWlShellSurface : public QWaylandShellSurface +class Q_WAYLANDCLIENT_EXPORT QWaylandWlShellSurface : public QWaylandShellSurface , public QtWayland::wl_shell_surface { Q_OBJECT diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgactivationv1_p.h b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgactivationv1_p.h index 11ffe7d1eab..2d461f49601 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgactivationv1_p.h +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgactivationv1_p.h @@ -63,7 +63,7 @@ namespace QtWaylandClient { class QWaylandDisplay; class QWaylandSurface; -class Q_WAYLAND_CLIENT_EXPORT QWaylandXdgActivationTokenV1 +class Q_WAYLANDCLIENT_EXPORT QWaylandXdgActivationTokenV1 : public QObject, public QtWayland::xdg_activation_token_v1 { @@ -75,7 +75,7 @@ Q_SIGNALS: void done(const QString &token); }; -class Q_WAYLAND_CLIENT_EXPORT QWaylandXdgActivationV1 : public QtWayland::xdg_activation_v1 +class Q_WAYLANDCLIENT_EXPORT QWaylandXdgActivationV1 : public QtWayland::xdg_activation_v1 { public: QWaylandXdgActivationV1(struct ::wl_registry *registry, uint32_t id, uint32_t availableVersion); diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgdecorationv1_p.h b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgdecorationv1_p.h index c3a13ce3291..8a334fc80cc 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgdecorationv1_p.h +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgdecorationv1_p.h @@ -64,7 +64,7 @@ namespace QtWaylandClient { class QWaylandXdgToplevel; class QWaylandXdgToplevelDecorationV1; -class Q_WAYLAND_CLIENT_EXPORT QWaylandXdgDecorationManagerV1 : public QtWayland::zxdg_decoration_manager_v1 +class Q_WAYLANDCLIENT_EXPORT QWaylandXdgDecorationManagerV1 : public QtWayland::zxdg_decoration_manager_v1 { public: QWaylandXdgDecorationManagerV1(struct ::wl_registry *registry, uint32_t id, uint32_t availableVersion); @@ -72,7 +72,7 @@ public: QWaylandXdgToplevelDecorationV1 *createToplevelDecoration(::xdg_toplevel *toplevel); }; -class Q_WAYLAND_CLIENT_EXPORT QWaylandXdgToplevelDecorationV1 : public QtWayland::zxdg_toplevel_decoration_v1 +class Q_WAYLANDCLIENT_EXPORT QWaylandXdgToplevelDecorationV1 : public QtWayland::zxdg_toplevel_decoration_v1 { public: QWaylandXdgToplevelDecorationV1(::zxdg_toplevel_decoration_v1 *decoration); diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h index 8630fcab957..22a3049251e 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h @@ -74,7 +74,7 @@ class QWaylandDisplay; class QWaylandInputDevice; class QWaylandXdgShell; -class Q_WAYLAND_CLIENT_EXPORT QWaylandXdgSurface : public QWaylandShellSurface, public QtWayland::xdg_surface +class Q_WAYLANDCLIENT_EXPORT QWaylandXdgSurface : public QWaylandShellSurface, public QtWayland::xdg_surface { Q_OBJECT public: @@ -167,7 +167,7 @@ private: friend class QWaylandXdgShell; }; -class Q_WAYLAND_CLIENT_EXPORT QWaylandXdgShell : public QtWayland::xdg_wm_base +class Q_WAYLANDCLIENT_EXPORT QWaylandXdgShell : public QtWayland::xdg_wm_base { public: QWaylandXdgShell(QWaylandDisplay *display, uint32_t id, uint32_t availableVersion); diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshellintegration_p.h b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshellintegration_p.h index fced9eb07c2..91a69342873 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshellintegration_p.h +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshellintegration_p.h @@ -59,7 +59,7 @@ QT_BEGIN_NAMESPACE namespace QtWaylandClient { -class Q_WAYLAND_CLIENT_EXPORT QWaylandXdgShellIntegration : public QWaylandShellIntegration +class Q_WAYLANDCLIENT_EXPORT QWaylandXdgShellIntegration : public QWaylandShellIntegration { public: QWaylandXdgShellIntegration() {} diff --git a/src/plugins/platforms/wayland/qtwaylandclientglobal.h b/src/plugins/platforms/wayland/qtwaylandclientglobal.h index 42f8ec8aac4..32a421f9f1b 100644 --- a/src/plugins/platforms/wayland/qtwaylandclientglobal.h +++ b/src/plugins/platforms/wayland/qtwaylandclientglobal.h @@ -42,17 +42,10 @@ #include #include +#include QT_BEGIN_NAMESPACE -#if !defined(Q_WAYLAND_CLIENT_EXPORT) -# if defined(QT_SHARED) -# define Q_WAYLAND_CLIENT_EXPORT Q_DECL_EXPORT -# else -# define Q_WAYLAND_CLIENT_EXPORT -# endif -#endif - QT_END_NAMESPACE #endif //QWAYLANDCLIENTGLOBAL_H diff --git a/src/plugins/platforms/wayland/qwaylandabstractdecoration_p.h b/src/plugins/platforms/wayland/qwaylandabstractdecoration_p.h index 5e92f6935cc..a99ac558b4a 100644 --- a/src/plugins/platforms/wayland/qwaylandabstractdecoration_p.h +++ b/src/plugins/platforms/wayland/qwaylandabstractdecoration_p.h @@ -79,7 +79,7 @@ class QWaylandWindow; class QWaylandInputDevice; class QWaylandAbstractDecorationPrivate; -class Q_WAYLAND_CLIENT_EXPORT QWaylandAbstractDecoration : public QObject +class Q_WAYLANDCLIENT_EXPORT QWaylandAbstractDecoration : public QObject { Q_OBJECT Q_DECLARE_PRIVATE(QWaylandAbstractDecoration) diff --git a/src/plugins/platforms/wayland/qwaylandbuffer_p.h b/src/plugins/platforms/wayland/qwaylandbuffer_p.h index 4cfcdfbedea..53acbf7269d 100644 --- a/src/plugins/platforms/wayland/qwaylandbuffer_p.h +++ b/src/plugins/platforms/wayland/qwaylandbuffer_p.h @@ -63,7 +63,7 @@ QT_BEGIN_NAMESPACE namespace QtWaylandClient { -class Q_WAYLAND_CLIENT_EXPORT QWaylandBuffer { +class Q_WAYLANDCLIENT_EXPORT QWaylandBuffer { public: QWaylandBuffer(); virtual ~QWaylandBuffer(); diff --git a/src/plugins/platforms/wayland/qwaylandclipboard_p.h b/src/plugins/platforms/wayland/qwaylandclipboard_p.h index 1dec2110550..a8f77a1f985 100644 --- a/src/plugins/platforms/wayland/qwaylandclipboard_p.h +++ b/src/plugins/platforms/wayland/qwaylandclipboard_p.h @@ -66,7 +66,7 @@ namespace QtWaylandClient { class QWaylandDisplay; -class Q_WAYLAND_CLIENT_EXPORT QWaylandClipboard : public QPlatformClipboard +class Q_WAYLANDCLIENT_EXPORT QWaylandClipboard : public QPlatformClipboard { public: QWaylandClipboard(QWaylandDisplay *display); diff --git a/src/plugins/platforms/wayland/qwaylandcursor_p.h b/src/plugins/platforms/wayland/qwaylandcursor_p.h index 411e6a3472e..6b08082b81c 100644 --- a/src/plugins/platforms/wayland/qwaylandcursor_p.h +++ b/src/plugins/platforms/wayland/qwaylandcursor_p.h @@ -73,7 +73,7 @@ class QWaylandDisplay; class QWaylandScreen; class QWaylandShm; -class Q_WAYLAND_CLIENT_EXPORT QWaylandCursorTheme +class Q_WAYLANDCLIENT_EXPORT QWaylandCursorTheme { public: static std::unique_ptr create(QWaylandShm *shm, int size, const QString &themeName); @@ -123,7 +123,7 @@ protected: wl_cursor *m_cursors[NumWaylandCursors] = {}; }; -class Q_WAYLAND_CLIENT_EXPORT QWaylandCursor : public QPlatformCursor +class Q_WAYLANDCLIENT_EXPORT QWaylandCursor : public QPlatformCursor { public: explicit QWaylandCursor(QWaylandDisplay *display); diff --git a/src/plugins/platforms/wayland/qwaylanddatadevicemanager_p.h b/src/plugins/platforms/wayland/qwaylanddatadevicemanager_p.h index 510d9be48c3..3eb67e5b642 100644 --- a/src/plugins/platforms/wayland/qwaylanddatadevicemanager_p.h +++ b/src/plugins/platforms/wayland/qwaylanddatadevicemanager_p.h @@ -65,7 +65,7 @@ class QWaylandDataDevice; class QWaylandDataSource; class QWaylandInputDevice; -class Q_WAYLAND_CLIENT_EXPORT QWaylandDataDeviceManager : public QtWayland::wl_data_device_manager +class Q_WAYLANDCLIENT_EXPORT QWaylandDataDeviceManager : public QtWayland::wl_data_device_manager { public: QWaylandDataDeviceManager(QWaylandDisplay *display, int version, uint32_t id); diff --git a/src/plugins/platforms/wayland/qwaylanddataoffer_p.h b/src/plugins/platforms/wayland/qwaylanddataoffer_p.h index bf100193d03..e2f0b4684c7 100644 --- a/src/plugins/platforms/wayland/qwaylanddataoffer_p.h +++ b/src/plugins/platforms/wayland/qwaylanddataoffer_p.h @@ -77,7 +77,7 @@ public: virtual ~QWaylandAbstractDataOffer() = default; }; -class Q_WAYLAND_CLIENT_EXPORT QWaylandDataOffer +class Q_WAYLANDCLIENT_EXPORT QWaylandDataOffer : public QtWayland::wl_data_offer // needs to be the first because we do static casts from the user pointer to the wrapper , public QWaylandAbstractDataOffer { diff --git a/src/plugins/platforms/wayland/qwaylanddatasource_p.h b/src/plugins/platforms/wayland/qwaylanddatasource_p.h index 96f07bc3788..4a773e3cd46 100644 --- a/src/plugins/platforms/wayland/qwaylanddatasource_p.h +++ b/src/plugins/platforms/wayland/qwaylanddatasource_p.h @@ -67,7 +67,7 @@ namespace QtWaylandClient { class QWaylandDataDeviceManager; class QWaylandDisplay; -class Q_WAYLAND_CLIENT_EXPORT QWaylandDataSource : public QObject, public QtWayland::wl_data_source +class Q_WAYLANDCLIENT_EXPORT QWaylandDataSource : public QObject, public QtWayland::wl_data_source { Q_OBJECT public: diff --git a/src/plugins/platforms/wayland/qwaylanddecorationfactory_p.h b/src/plugins/platforms/wayland/qwaylanddecorationfactory_p.h index 6afa2d74a58..a71f7d35ef2 100644 --- a/src/plugins/platforms/wayland/qwaylanddecorationfactory_p.h +++ b/src/plugins/platforms/wayland/qwaylanddecorationfactory_p.h @@ -61,7 +61,7 @@ namespace QtWaylandClient { class QWaylandAbstractDecoration; -class Q_WAYLAND_CLIENT_EXPORT QWaylandDecorationFactory +class Q_WAYLANDCLIENT_EXPORT QWaylandDecorationFactory { public: static QStringList keys(); diff --git a/src/plugins/platforms/wayland/qwaylanddecorationplugin_p.h b/src/plugins/platforms/wayland/qwaylanddecorationplugin_p.h index 6bda51e8131..9d6cf2a4bb9 100644 --- a/src/plugins/platforms/wayland/qwaylanddecorationplugin_p.h +++ b/src/plugins/platforms/wayland/qwaylanddecorationplugin_p.h @@ -66,7 +66,7 @@ class QWaylandAbstractDecoration; #define QWaylandDecorationFactoryInterface_iid "org.qt-project.Qt.WaylandClient.QWaylandDecorationFactoryInterface.5.4" -class Q_WAYLAND_CLIENT_EXPORT QWaylandDecorationPlugin : public QObject +class Q_WAYLANDCLIENT_EXPORT QWaylandDecorationPlugin : public QObject { Q_OBJECT public: diff --git a/src/plugins/platforms/wayland/qwaylanddisplay_p.h b/src/plugins/platforms/wayland/qwaylanddisplay_p.h index 5a83c3241ba..daef31e522c 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay_p.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay_p.h @@ -90,7 +90,7 @@ namespace QtWayland { namespace QtWaylandClient { -Q_WAYLAND_CLIENT_EXPORT Q_DECLARE_LOGGING_CATEGORY(lcQpaWayland); +Q_WAYLANDCLIENT_EXPORT Q_DECLARE_LOGGING_CATEGORY(lcQpaWayland); class QWaylandInputDevice; class QWaylandBuffer; @@ -123,7 +123,7 @@ typedef void (*RegistryListener)(void *data, const QString &interface, uint32_t version); -class Q_WAYLAND_CLIENT_EXPORT QWaylandDisplay : public QObject, public QtWayland::wl_registry { +class Q_WAYLANDCLIENT_EXPORT QWaylandDisplay : public QObject, public QtWayland::wl_registry { Q_OBJECT public: diff --git a/src/plugins/platforms/wayland/qwaylanddnd_p.h b/src/plugins/platforms/wayland/qwaylanddnd_p.h index 46f629ace19..4605b1a8e8d 100644 --- a/src/plugins/platforms/wayland/qwaylanddnd_p.h +++ b/src/plugins/platforms/wayland/qwaylanddnd_p.h @@ -65,7 +65,7 @@ namespace QtWaylandClient { class QWaylandDisplay; #if QT_CONFIG(draganddrop) -class Q_WAYLAND_CLIENT_EXPORT QWaylandDrag : public QBasicDrag +class Q_WAYLANDCLIENT_EXPORT QWaylandDrag : public QBasicDrag { public: QWaylandDrag(QWaylandDisplay *display); diff --git a/src/plugins/platforms/wayland/qwaylandextendedsurface_p.h b/src/plugins/platforms/wayland/qwaylandextendedsurface_p.h index 7748feb7aea..f80e79759e9 100644 --- a/src/plugins/platforms/wayland/qwaylandextendedsurface_p.h +++ b/src/plugins/platforms/wayland/qwaylandextendedsurface_p.h @@ -67,7 +67,7 @@ namespace QtWaylandClient { class QWaylandDisplay; class QWaylandWindow; -class Q_WAYLAND_CLIENT_EXPORT QWaylandExtendedSurface : public QtWayland::qt_extended_surface +class Q_WAYLANDCLIENT_EXPORT QWaylandExtendedSurface : public QtWayland::qt_extended_surface { public: QWaylandExtendedSurface(QWaylandWindow *window); diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h index a6b69c989e5..b27fc09a460 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h +++ b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h @@ -105,7 +105,7 @@ class CursorSurface; Q_DECLARE_LOGGING_CATEGORY(lcQpaWaylandInput); -class Q_WAYLAND_CLIENT_EXPORT QWaylandInputDevice +class Q_WAYLANDCLIENT_EXPORT QWaylandInputDevice : public QObject , public QtWayland::wl_seat { @@ -231,7 +231,7 @@ inline uint32_t QWaylandInputDevice::serial() const } -class Q_WAYLAND_CLIENT_EXPORT QWaylandInputDevice::Keyboard : public QObject, public QtWayland::wl_keyboard +class Q_WAYLANDCLIENT_EXPORT QWaylandInputDevice::Keyboard : public QObject, public QtWayland::wl_keyboard { Q_OBJECT @@ -308,7 +308,7 @@ private: friend class QWaylandInputDevice; }; -class Q_WAYLAND_CLIENT_EXPORT QWaylandInputDevice::Pointer : public QObject, public QtWayland::wl_pointer +class Q_WAYLANDCLIENT_EXPORT QWaylandInputDevice::Pointer : public QObject, public QtWayland::wl_pointer { Q_OBJECT public: @@ -400,7 +400,7 @@ private: //TODO: should other methods be private as well? bool isDefinitelyTerminated(axis_source source) const; }; -class Q_WAYLAND_CLIENT_EXPORT QWaylandInputDevice::Touch : public QtWayland::wl_touch +class Q_WAYLANDCLIENT_EXPORT QWaylandInputDevice::Touch : public QtWayland::wl_touch { public: Touch(QWaylandInputDevice *p); diff --git a/src/plugins/platforms/wayland/qwaylandintegration_p.h b/src/plugins/platforms/wayland/qwaylandintegration_p.h index 750440a9c34..33b78012c42 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration_p.h +++ b/src/plugins/platforms/wayland/qwaylandintegration_p.h @@ -71,7 +71,7 @@ class QWaylandInputDevice; class QWaylandScreen; class QWaylandCursor; -class Q_WAYLAND_CLIENT_EXPORT QWaylandIntegration : public QPlatformIntegration +class Q_WAYLANDCLIENT_EXPORT QWaylandIntegration : public QPlatformIntegration { public: QWaylandIntegration(); diff --git a/src/plugins/platforms/wayland/qwaylandnativeinterface_p.h b/src/plugins/platforms/wayland/qwaylandnativeinterface_p.h index a2d26ef7644..a070de40998 100644 --- a/src/plugins/platforms/wayland/qwaylandnativeinterface_p.h +++ b/src/plugins/platforms/wayland/qwaylandnativeinterface_p.h @@ -65,7 +65,7 @@ namespace QtWaylandClient { class QWaylandIntegration; class QWaylandScreen; -class Q_WAYLAND_CLIENT_EXPORT QWaylandNativeInterface : public QPlatformNativeInterface +class Q_WAYLANDCLIENT_EXPORT QWaylandNativeInterface : public QPlatformNativeInterface { public: QWaylandNativeInterface(QWaylandIntegration *integration); diff --git a/src/plugins/platforms/wayland/qwaylandpointergestures_p.h b/src/plugins/platforms/wayland/qwaylandpointergestures_p.h index c9aa3ac35ec..8a906741a77 100644 --- a/src/plugins/platforms/wayland/qwaylandpointergestures_p.h +++ b/src/plugins/platforms/wayland/qwaylandpointergestures_p.h @@ -68,7 +68,7 @@ class QWaylandInputDevice; class QWaylandPointerGestureSwipe; class QWaylandPointerGesturePinch; -class Q_WAYLAND_CLIENT_EXPORT QWaylandPointerGestures : public QtWayland::zwp_pointer_gestures_v1 +class Q_WAYLANDCLIENT_EXPORT QWaylandPointerGestures : public QtWayland::zwp_pointer_gestures_v1 { public: explicit QWaylandPointerGestures(QWaylandDisplay *display, uint id, uint version); @@ -77,7 +77,7 @@ public: QWaylandPointerGesturePinch *createPointerGesturePinch(QWaylandInputDevice *device); }; -class Q_WAYLAND_CLIENT_EXPORT QWaylandPointerGestureSwipe : +class Q_WAYLANDCLIENT_EXPORT QWaylandPointerGestureSwipe : public QtWayland::zwp_pointer_gesture_swipe_v1 { public: @@ -107,7 +107,7 @@ public: uint mFingers = 0; }; -class Q_WAYLAND_CLIENT_EXPORT QWaylandPointerGesturePinch : +class Q_WAYLANDCLIENT_EXPORT QWaylandPointerGesturePinch : public QtWayland::zwp_pointer_gesture_pinch_v1 { public: diff --git a/src/plugins/platforms/wayland/qwaylandprimaryselectionv1_p.h b/src/plugins/platforms/wayland/qwaylandprimaryselectionv1_p.h index 3f0a42a6702..16906fd2fa7 100644 --- a/src/plugins/platforms/wayland/qwaylandprimaryselectionv1_p.h +++ b/src/plugins/platforms/wayland/qwaylandprimaryselectionv1_p.h @@ -96,7 +96,7 @@ private: QScopedPointer m_mimeData; }; -class Q_WAYLAND_CLIENT_EXPORT QWaylandPrimarySelectionSourceV1 : public QObject, public QtWayland::zwp_primary_selection_source_v1 +class Q_WAYLANDCLIENT_EXPORT QWaylandPrimarySelectionSourceV1 : public QObject, public QtWayland::zwp_primary_selection_source_v1 { Q_OBJECT public: diff --git a/src/plugins/platforms/wayland/qwaylandqtkey_p.h b/src/plugins/platforms/wayland/qwaylandqtkey_p.h index 8c8d959266b..1355f3f338f 100644 --- a/src/plugins/platforms/wayland/qwaylandqtkey_p.h +++ b/src/plugins/platforms/wayland/qwaylandqtkey_p.h @@ -63,7 +63,7 @@ namespace QtWaylandClient { class QWaylandDisplay; -class Q_WAYLAND_CLIENT_EXPORT QWaylandQtKeyExtension : public QtWayland::zqt_key_v1 +class Q_WAYLANDCLIENT_EXPORT QWaylandQtKeyExtension : public QtWayland::zqt_key_v1 { public: QWaylandQtKeyExtension(QWaylandDisplay *display, uint32_t id); diff --git a/src/plugins/platforms/wayland/qwaylandscreen_p.h b/src/plugins/platforms/wayland/qwaylandscreen_p.h index c4bf724da33..1cece249fa9 100644 --- a/src/plugins/platforms/wayland/qwaylandscreen_p.h +++ b/src/plugins/platforms/wayland/qwaylandscreen_p.h @@ -65,12 +65,12 @@ namespace QtWaylandClient { class QWaylandDisplay; class QWaylandCursor; -class Q_WAYLAND_CLIENT_EXPORT QWaylandXdgOutputManagerV1 : public QtWayland::zxdg_output_manager_v1 { +class Q_WAYLANDCLIENT_EXPORT QWaylandXdgOutputManagerV1 : public QtWayland::zxdg_output_manager_v1 { public: QWaylandXdgOutputManagerV1(QWaylandDisplay *display, uint id, uint version); }; -class Q_WAYLAND_CLIENT_EXPORT QWaylandScreen : public QPlatformScreen, QtWayland::wl_output, QtWayland::zxdg_output_v1 +class Q_WAYLANDCLIENT_EXPORT QWaylandScreen : public QPlatformScreen, QtWayland::wl_output, QtWayland::zxdg_output_v1 { public: QWaylandScreen(QWaylandDisplay *waylandDisplay, int version, uint32_t id); diff --git a/src/plugins/platforms/wayland/qwaylandshellsurface_p.h b/src/plugins/platforms/wayland/qwaylandshellsurface_p.h index e7d2ed31920..0cd24036d62 100644 --- a/src/plugins/platforms/wayland/qwaylandshellsurface_p.h +++ b/src/plugins/platforms/wayland/qwaylandshellsurface_p.h @@ -70,7 +70,7 @@ namespace QtWaylandClient { class QWaylandWindow; class QWaylandInputDevice; -class Q_WAYLAND_CLIENT_EXPORT QWaylandShellSurface : public QObject +class Q_WAYLANDCLIENT_EXPORT QWaylandShellSurface : public QObject { Q_OBJECT public: diff --git a/src/plugins/platforms/wayland/qwaylandshm_p.h b/src/plugins/platforms/wayland/qwaylandshm_p.h index b6c45420563..45c1fedf001 100644 --- a/src/plugins/platforms/wayland/qwaylandshm_p.h +++ b/src/plugins/platforms/wayland/qwaylandshm_p.h @@ -64,7 +64,7 @@ namespace QtWaylandClient { class QWaylandDisplay; -class Q_WAYLAND_CLIENT_EXPORT QWaylandShm : public QtWayland::wl_shm +class Q_WAYLANDCLIENT_EXPORT QWaylandShm : public QtWayland::wl_shm { public: diff --git a/src/plugins/platforms/wayland/qwaylandshmbackingstore_p.h b/src/plugins/platforms/wayland/qwaylandshmbackingstore_p.h index f3fae438016..993a394a50b 100644 --- a/src/plugins/platforms/wayland/qwaylandshmbackingstore_p.h +++ b/src/plugins/platforms/wayland/qwaylandshmbackingstore_p.h @@ -68,7 +68,7 @@ class QWaylandDisplay; class QWaylandAbstractDecoration; class QWaylandWindow; -class Q_WAYLAND_CLIENT_EXPORT QWaylandShmBuffer : public QWaylandBuffer { +class Q_WAYLANDCLIENT_EXPORT QWaylandShmBuffer : public QWaylandBuffer { public: QWaylandShmBuffer(QWaylandDisplay *display, const QSize &size, QImage::Format format, qreal scale = 1); @@ -85,7 +85,7 @@ private: QImage *mMarginsImage = nullptr; }; -class Q_WAYLAND_CLIENT_EXPORT QWaylandShmBackingStore : public QPlatformBackingStore +class Q_WAYLANDCLIENT_EXPORT QWaylandShmBackingStore : public QPlatformBackingStore { public: QWaylandShmBackingStore(QWindow *window, QWaylandDisplay *display); diff --git a/src/plugins/platforms/wayland/qwaylandshmwindow_p.h b/src/plugins/platforms/wayland/qwaylandshmwindow_p.h index 81251b3aa96..eebff94c64a 100644 --- a/src/plugins/platforms/wayland/qwaylandshmwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandshmwindow_p.h @@ -58,7 +58,7 @@ QT_BEGIN_NAMESPACE namespace QtWaylandClient { -class Q_WAYLAND_CLIENT_EXPORT QWaylandShmWindow : public QWaylandWindow +class Q_WAYLANDCLIENT_EXPORT QWaylandShmWindow : public QWaylandWindow { public: QWaylandShmWindow(QWindow *window, QWaylandDisplay *display); diff --git a/src/plugins/platforms/wayland/qwaylandsubsurface_p.h b/src/plugins/platforms/wayland/qwaylandsubsurface_p.h index 1399f16e080..a6b25f90231 100644 --- a/src/plugins/platforms/wayland/qwaylandsubsurface_p.h +++ b/src/plugins/platforms/wayland/qwaylandsubsurface_p.h @@ -64,7 +64,7 @@ namespace QtWaylandClient { class QWaylandDisplay; class QWaylandWindow; -class Q_WAYLAND_CLIENT_EXPORT QWaylandSubSurface : public QtWayland::wl_subsurface +class Q_WAYLANDCLIENT_EXPORT QWaylandSubSurface : public QtWayland::wl_subsurface { public: QWaylandSubSurface(QWaylandWindow *window, QWaylandWindow *parent, ::wl_subsurface *subsurface); diff --git a/src/plugins/platforms/wayland/qwaylandtabletv2_p.h b/src/plugins/platforms/wayland/qwaylandtabletv2_p.h index bf3c78f0522..870d236d699 100644 --- a/src/plugins/platforms/wayland/qwaylandtabletv2_p.h +++ b/src/plugins/platforms/wayland/qwaylandtabletv2_p.h @@ -74,14 +74,14 @@ class QWaylandTabletV2; class QWaylandTabletToolV2; class QWaylandTabletPadV2; -class Q_WAYLAND_CLIENT_EXPORT QWaylandTabletManagerV2 : public QtWayland::zwp_tablet_manager_v2 +class Q_WAYLANDCLIENT_EXPORT QWaylandTabletManagerV2 : public QtWayland::zwp_tablet_manager_v2 { public: explicit QWaylandTabletManagerV2(QWaylandDisplay *display, uint id, uint version); QWaylandTabletSeatV2 *createTabletSeat(QWaylandInputDevice *seat); }; -class Q_WAYLAND_CLIENT_EXPORT QWaylandTabletSeatV2 : public QObject, public QtWayland::zwp_tablet_seat_v2 +class Q_WAYLANDCLIENT_EXPORT QWaylandTabletSeatV2 : public QObject, public QtWayland::zwp_tablet_seat_v2 { Q_OBJECT public: @@ -99,7 +99,7 @@ private: QList m_pads; }; -class Q_WAYLAND_CLIENT_EXPORT QWaylandTabletV2 : public QObject, public QtWayland::zwp_tablet_v2 +class Q_WAYLANDCLIENT_EXPORT QWaylandTabletV2 : public QObject, public QtWayland::zwp_tablet_v2 { Q_OBJECT public: @@ -113,7 +113,7 @@ protected: void zwp_tablet_v2_removed() override; }; -class Q_WAYLAND_CLIENT_EXPORT QWaylandTabletToolV2 : public QObject, public QtWayland::zwp_tablet_tool_v2 +class Q_WAYLANDCLIENT_EXPORT QWaylandTabletToolV2 : public QObject, public QtWayland::zwp_tablet_tool_v2 { Q_OBJECT public: @@ -168,7 +168,7 @@ private: }; // We don't actually use this, but need to handle the "removed" event to comply with the protocol -class Q_WAYLAND_CLIENT_EXPORT QWaylandTabletPadV2 : public QObject, public QtWayland::zwp_tablet_pad_v2 +class Q_WAYLANDCLIENT_EXPORT QWaylandTabletPadV2 : public QObject, public QtWayland::zwp_tablet_pad_v2 { Q_OBJECT public: diff --git a/src/plugins/platforms/wayland/qwaylandtouch_p.h b/src/plugins/platforms/wayland/qwaylandtouch_p.h index 53cc43d80c2..b23c4c1faab 100644 --- a/src/plugins/platforms/wayland/qwaylandtouch_p.h +++ b/src/plugins/platforms/wayland/qwaylandtouch_p.h @@ -64,7 +64,7 @@ namespace QtWaylandClient { class QWaylandDisplay; class QWaylandInputDevice; -class Q_WAYLAND_CLIENT_EXPORT QWaylandTouchExtension : public QtWayland::qt_touch_extension +class Q_WAYLANDCLIENT_EXPORT QWaylandTouchExtension : public QtWayland::qt_touch_extension { public: QWaylandTouchExtension(QWaylandDisplay *display, uint32_t id); diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index 102db1b43c1..5f51743d96d 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -90,7 +90,7 @@ class QWaylandPointerGestureSwipeEvent; class QWaylandPointerGesturePinchEvent; class QWaylandSurface; -class Q_WAYLAND_CLIENT_EXPORT QWaylandWindow : public QObject, public QPlatformWindow +class Q_WAYLANDCLIENT_EXPORT QWaylandWindow : public QObject, public QPlatformWindow { Q_OBJECT public: diff --git a/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration_p.h b/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration_p.h index 1c36f67bb18..c3c01352c34 100644 --- a/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration_p.h @@ -68,7 +68,7 @@ class QWaylandDisplay; class QWaylandWindowManagerIntegrationPrivate; -class Q_WAYLAND_CLIENT_EXPORT QWaylandWindowManagerIntegration : public QObject, public QGenericUnixServices, public QtWayland::qt_windowmanager +class Q_WAYLANDCLIENT_EXPORT QWaylandWindowManagerIntegration : public QObject, public QGenericUnixServices, public QtWayland::qt_windowmanager { Q_OBJECT Q_DECLARE_PRIVATE(QWaylandWindowManagerIntegration) diff --git a/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegration_p.h b/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegration_p.h index 68b90cda562..06abcb7e5e4 100644 --- a/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegration_p.h +++ b/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegration_p.h @@ -72,7 +72,7 @@ class QWaylandWindow; class QWaylandDisplay; class QWaylandShellSurface; -class Q_WAYLAND_CLIENT_EXPORT QWaylandShellIntegration +class Q_WAYLANDCLIENT_EXPORT QWaylandShellIntegration { public: QWaylandShellIntegration() {} @@ -91,7 +91,7 @@ public: }; template -class Q_WAYLAND_CLIENT_EXPORT QWaylandShellIntegrationTemplate : public QWaylandShellIntegration, public QWaylandClientExtension +class Q_WAYLANDCLIENT_EXPORT QWaylandShellIntegrationTemplate : public QWaylandShellIntegration, public QWaylandClientExtension { public: QWaylandShellIntegrationTemplate(const int ver) : diff --git a/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationfactory_p.h b/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationfactory_p.h index 0268dba48bc..dd9dd788fc2 100644 --- a/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationfactory_p.h +++ b/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationfactory_p.h @@ -63,7 +63,7 @@ namespace QtWaylandClient { class QWaylandShellIntegration; -class Q_WAYLAND_CLIENT_EXPORT QWaylandShellIntegrationFactory +class Q_WAYLANDCLIENT_EXPORT QWaylandShellIntegrationFactory { public: static QStringList keys(); diff --git a/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationplugin_p.h b/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationplugin_p.h index 7c5a9e74ceb..6f116085826 100644 --- a/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationplugin_p.h +++ b/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationplugin_p.h @@ -66,7 +66,7 @@ class QWaylandShellIntegration; #define QWaylandShellIntegrationFactoryInterface_iid "org.qt-project.Qt.WaylandClient.QWaylandShellIntegrationFactoryInterface.5.3" -class Q_WAYLAND_CLIENT_EXPORT QWaylandShellIntegrationPlugin : public QObject +class Q_WAYLANDCLIENT_EXPORT QWaylandShellIntegrationPlugin : public QObject { Q_OBJECT public: From aedb14b2320bf0ca850c226fcea89d8c61012fd1 Mon Sep 17 00:00:00 2001 From: Janne Juntunen Date: Wed, 11 May 2022 13:49:46 +0300 Subject: [PATCH 1072/1507] client: Mark return values as unused to suppress compiler warnings Return values of two write() functions were ignored, causing warnings which were treated as errors on webOS emulator build. Fixes: QTBUG-103378 Pick-to: 6.3 Change-Id: Ifc2e944dee376973b69220b7f75dc346c0a71e71 Reviewed-by: David Edmundson --- src/plugins/platforms/wayland/qwaylanddatasource.cpp | 3 ++- src/plugins/platforms/wayland/qwaylandprimaryselectionv1.cpp | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylanddatasource.cpp b/src/plugins/platforms/wayland/qwaylanddatasource.cpp index 5599cbd471c..95e83595f78 100644 --- a/src/plugins/platforms/wayland/qwaylanddatasource.cpp +++ b/src/plugins/platforms/wayland/qwaylanddatasource.cpp @@ -93,7 +93,8 @@ void QWaylandDataSource::data_source_send(const QString &mime_type, int32_t fd) action.sa_flags = 0; sigaction(SIGPIPE, &action, &oldAction); - write(fd, content.constData(), content.size()); + ssize_t unused = write(fd, content.constData(), content.size()); + Q_UNUSED(unused); sigaction(SIGPIPE, &oldAction, nullptr); } close(fd); diff --git a/src/plugins/platforms/wayland/qwaylandprimaryselectionv1.cpp b/src/plugins/platforms/wayland/qwaylandprimaryselectionv1.cpp index 832f967804a..5cee3299f73 100644 --- a/src/plugins/platforms/wayland/qwaylandprimaryselectionv1.cpp +++ b/src/plugins/platforms/wayland/qwaylandprimaryselectionv1.cpp @@ -160,7 +160,8 @@ void QWaylandPrimarySelectionSourceV1::zwp_primary_selection_source_v1_send(cons action.sa_flags = 0; sigaction(SIGPIPE, &action, &oldAction); - write(fd, content.constData(), size_t(content.size())); + ssize_t unused = write(fd, content.constData(), size_t(content.size())); + Q_UNUSED(unused); sigaction(SIGPIPE, &oldAction, nullptr); } close(fd); From 38d6f09d30acd82de5654b6b5ca8bdc0f200b53d Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 26 Apr 2022 09:44:25 -0700 Subject: [PATCH 1073/1507] Replace QScopedPointer with std::unique_ptr MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit As the warning asked. qwaylandshellintegrationfactory.cpp:67:28: warning: ‘T* QScopedPointer::take() [with T = QtWaylandClient::QWaylandShellIntegration; Cleanup = QScopedPointerDeleter]’ is deprecated: Use std::unique_ptr instead, and call release(). [-Wdeprecated-declarations] As a drive-by, change *foo.get() to *foo. Pick-to: 6.3 6.2 Change-Id: I7fb65b80b7844c8d8f26fffd16e97fe161d6a67a Reviewed-by: Marc Mutz Reviewed-by: Qt CI Bot --- src/plugins/platforms/wayland/qwaylanddisplay.cpp | 2 +- src/plugins/platforms/wayland/qwaylanddisplay_p.h | 4 ++-- .../shellintegration/qwaylandshellintegrationfactory.cpp | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index 2c275a92e22..80af2ca4995 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -389,7 +389,7 @@ QWaylandDisplay::~QWaylandDisplay(void) qDeleteAll(mWaitingScreens); #if QT_CONFIG(wayland_datadevice) - delete mDndSelectionHandler.take(); + mDndSelectionHandler.reset(); #endif #if QT_CONFIG(cursor) mCursorThemes.clear(); diff --git a/src/plugins/platforms/wayland/qwaylanddisplay_p.h b/src/plugins/platforms/wayland/qwaylanddisplay_p.h index daef31e522c..c81b09ce0a1 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay_p.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay_p.h @@ -165,7 +165,7 @@ public: QWaylandInputDevice *defaultInputDevice() const; QWaylandInputDevice *currentInputDevice() const { return defaultInputDevice(); } #if QT_CONFIG(wayland_datadevice) - QWaylandDataDeviceManager *dndSelectionHandler() const { return mDndSelectionHandler.data(); } + QWaylandDataDeviceManager *dndSelectionHandler() const { return mDndSelectionHandler.get(); } #endif #if QT_CONFIG(wayland_client_primary_selection) QWaylandPrimarySelectionDeviceManagerV1 *primarySelectionManager() const { return mPrimarySelectionManager.data(); } @@ -249,7 +249,7 @@ private: }; struct wl_display *mDisplay = nullptr; - QScopedPointer m_eventThread; + std::unique_ptr m_eventThread; wl_event_queue *m_frameEventQueue = nullptr; QScopedPointer m_frameEventQueueThread; QtWayland::wl_compositor mCompositor; diff --git a/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationfactory.cpp b/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationfactory.cpp index e3a9aeb377b..ade2b4e3c1f 100644 --- a/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationfactory.cpp +++ b/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationfactory.cpp @@ -58,13 +58,13 @@ QStringList QWaylandShellIntegrationFactory::keys() QWaylandShellIntegration *QWaylandShellIntegrationFactory::create(const QString &name, QWaylandDisplay *display, const QStringList &args) { - QScopedPointer integration; + std::unique_ptr integration; integration.reset(qLoadPlugin(loader(), name, args)); if (integration && !integration->initialize(display)) return nullptr; - return integration.take(); + return integration.release(); } } From 949b3f731c9c8c4cfd1fb5dfb4c58ffdda2e6182 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 22 Apr 2022 14:44:58 -0700 Subject: [PATCH 1074/1507] qtwaylandscanner: add a way to use an build macro in the generated code Change-Id: If05aeeb7176e4f13af9afffd16e85611ff7c42f2 Reviewed-by: Alexandru Croitor Reviewed-by: Eskil Abrahamsen Blomfeldt --- .../qtwaylandscanner/qtwaylandscanner.cpp | 49 ++++++++++--------- 1 file changed, 27 insertions(+), 22 deletions(-) diff --git a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp index f84673d461a..c3768a63490 100644 --- a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp +++ b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp @@ -123,6 +123,7 @@ private: QByteArray m_scannerName; QByteArray m_headerPath; QByteArray m_prefix; + QByteArray m_buildMacro; QList m_includes; QXmlStreamReader *m_xml = nullptr; }; @@ -156,6 +157,8 @@ bool Scanner::parseArguments(int argc, char **argv) m_headerPath = option.mid(14); } else if (option.startsWith("--prefix=")) { m_prefix = option.mid(10); + } else if (option.startsWith("--build-macro=")) { + m_buildMacro = option.mid(14); } else if (option.startsWith("--add-include=")) { auto include = option.mid(14); if (!include.isEmpty()) @@ -473,6 +476,26 @@ bool Scanner::process() for (auto b : qAsConst(m_includes)) printf("#include %s\n", b.constData()); + auto printExportMacro = [this](const char *prefix, const QByteArray &preProcessorProtocolName) { + QByteArray exportMacro = prefix + preProcessorProtocolName + "_EXPORT"; + printf("#if !defined(%s)\n", exportMacro.constData()); + printf("# if defined(QT_SHARED) && !defined(QT_STATIC)\n"); + if (m_buildMacro.isEmpty()) { + printf("# define %s Q_DECL_EXPORT\n", exportMacro.constData()); + } else { + printf("# if defined(%s)\n", m_buildMacro.constData()); + printf("# define %s Q_DECL_EXPORT\n", exportMacro.constData()); + printf("# else\n"); + printf("# define %s Q_DECL_IMPORT\n", exportMacro.constData()); + printf("# endif\n"); + } + printf("# else\n"); + printf("# define %s\n", exportMacro.constData()); + printf("# endif\n"); + printf("#endif\n"); + return exportMacro; + }; + if (m_option == ServerHeader) { QByteArray inclusionGuard = QByteArray("QT_WAYLAND_SERVER_") + preProcessorProtocolName.constData(); printf("#ifndef %s\n", inclusionGuard.constData()); @@ -501,17 +524,8 @@ bool Scanner::process() printf("QT_WARNING_DISABLE_GCC(\"-Wmissing-field-initializers\")\n"); printf("QT_WARNING_DISABLE_CLANG(\"-Wmissing-field-initializers\")\n"); QByteArray serverExport; - if (m_headerPath.size()) { - serverExport = QByteArray("Q_WAYLAND_SERVER_") + preProcessorProtocolName + "_EXPORT"; - printf("\n"); - printf("#if !defined(%s)\n", serverExport.constData()); - printf("# if defined(QT_SHARED)\n"); - printf("# define %s Q_DECL_EXPORT\n", serverExport.constData()); - printf("# else\n"); - printf("# define %s\n", serverExport.constData()); - printf("# endif\n"); - printf("#endif\n"); - } + if (m_headerPath.size()) + serverExport = printExportMacro("Q_WAYLAND_SERVER_", preProcessorProtocolName); printf("\n"); printf("namespace QtWaylandServer {\n"); @@ -996,18 +1010,9 @@ bool Scanner::process() printf("QT_WARNING_DISABLE_GCC(\"-Wmissing-field-initializers\")\n"); QByteArray clientExport; + if (m_headerPath.size()) + clientExport = printExportMacro("Q_WAYLAND_CLIENT_", preProcessorProtocolName); - if (m_headerPath.size()) { - clientExport = QByteArray("Q_WAYLAND_CLIENT_") + preProcessorProtocolName + "_EXPORT"; - printf("\n"); - printf("#if !defined(%s)\n", clientExport.constData()); - printf("# if defined(QT_SHARED)\n"); - printf("# define %s Q_DECL_EXPORT\n", clientExport.constData()); - printf("# else\n"); - printf("# define %s\n", clientExport.constData()); - printf("# endif\n"); - printf("#endif\n"); - } printf("\n"); printf("namespace QtWayland {\n"); From 737c940ebb6d6466e34b139e2b23d81ba7e8f109 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 22 Apr 2022 14:59:35 -0700 Subject: [PATCH 1075/1507] CMake: use the --build-macro option to qtwaylandscanner So we get correct exports different from imports, which are required for GCC 12 with -mno-direct-extern-access and protected visibility. Change-Id: If05aeeb7176e4f13af9afffd16e856de1f4f68d6 Reviewed-by: Qt CI Bot Reviewed-by: Alexandru Croitor --- .../Qt6WaylandClientMacros.cmake | 18 ++++++++++++++++-- .../Qt6WaylandCompositorMacros.cmake | 17 +++++++++++++++-- 2 files changed, 31 insertions(+), 4 deletions(-) diff --git a/src/tools/qtwaylandscanner/Qt6WaylandClientMacros.cmake b/src/tools/qtwaylandscanner/Qt6WaylandClientMacros.cmake index 568c33494b8..1f2dd272d66 100644 --- a/src/tools/qtwaylandscanner/Qt6WaylandClientMacros.cmake +++ b/src/tools/qtwaylandscanner/Qt6WaylandClientMacros.cmake @@ -14,6 +14,11 @@ function(qt6_generate_wayland_protocol_client_sources target) message(FATAL_ERROR "qtwaylandscanner executable not found. Most likely there is an issue with your Qt installation.") endif() + string(TOUPPER "${target}" module_define_infix) + string(REPLACE "-" "_" module_define_infix "${module_define_infix}") + string(REPLACE "." "_" module_define_infix "${module_define_infix}") + set(build_macro "QT_BUILD_${module_define_infix}_LIB") + foreach(protocol_file IN LISTS arg_FILES) get_filename_component(protocol_name "${protocol_file}" NAME_WLE) @@ -49,7 +54,11 @@ function(qt6_generate_wayland_protocol_client_sources target) add_custom_command( OUTPUT "${qtwaylandscanner_header_output}" - COMMAND Qt6::qtwaylandscanner client-header "${protocol_file}" "${wayland_include_dir}" > "${qtwaylandscanner_header_output}" + COMMAND Qt6::qtwaylandscanner client-header + "${protocol_file}" + --build-macro=${build_macro} + --header-path="${wayland_include_dir}" + > "${qtwaylandscanner_header_output}" DEPENDS ${protocol_file} Qt6::qtwaylandscanner ) @@ -60,7 +69,12 @@ function(qt6_generate_wayland_protocol_client_sources target) add_custom_command( OUTPUT "${qtwaylandscanner_code_output}" - COMMAND Qt6::qtwaylandscanner client-code "${protocol_file}" --header-path='${wayland_include_dir}' --add-include='${qtwaylandscanner_code_include}' > "${qtwaylandscanner_code_output}" + COMMAND Qt6::qtwaylandscanner client-code + "${protocol_file}" + --build-macro=${build_macro} + --header-path='${wayland_include_dir}' + --add-include='${qtwaylandscanner_code_include}' + > "${qtwaylandscanner_code_output}" DEPENDS ${protocol_file} Qt6::qtwaylandscanner ) diff --git a/src/tools/qtwaylandscanner/Qt6WaylandCompositorMacros.cmake b/src/tools/qtwaylandscanner/Qt6WaylandCompositorMacros.cmake index 92ad04696b4..91d0d283012 100644 --- a/src/tools/qtwaylandscanner/Qt6WaylandCompositorMacros.cmake +++ b/src/tools/qtwaylandscanner/Qt6WaylandCompositorMacros.cmake @@ -14,6 +14,11 @@ function(qt6_generate_wayland_protocol_server_sources target) message(FATAL_ERROR "qtwaylandscanner executable not found. Most likely there is an issue with your Qt installation.") endif() + string(TOUPPER "${target}" module_define_infix) + string(REPLACE "-" "_" module_define_infix "${module_define_infix}") + string(REPLACE "." "_" module_define_infix "${module_define_infix}") + set(build_macro "QT_BUILD_${module_define_infix}_LIB") + foreach(protocol_file IN LISTS arg_FILES) get_filename_component(protocol_name "${protocol_file}" NAME_WLE) @@ -47,12 +52,20 @@ function(qt6_generate_wayland_protocol_server_sources target) add_custom_command( OUTPUT "${qtwaylandscanner_header_output}" - COMMAND Qt6::qtwaylandscanner server-header "${protocol_file}" "${wayland_include_dir}" > "${qtwaylandscanner_header_output}" + COMMAND Qt6::qtwaylandscanner server-header + "${protocol_file}" + --build-macro=${build_macro} + --header-path='${wayland_include_dir}' + > "${qtwaylandscanner_header_output}" ) add_custom_command( OUTPUT "${qtwaylandscanner_code_output}" - COMMAND Qt6::qtwaylandscanner server-code "${protocol_file}" "${wayland_include_dir}" > "${qtwaylandscanner_code_output}" + COMMAND Qt6::qtwaylandscanner server-code + "${protocol_file}" + --build-macro=${build_macro} + --header-path='${wayland_include_dir}' + > "${qtwaylandscanner_code_output}" ) target_sources(${target} PRIVATE From d112d4ec8effb3e922566ac3f635e6a8545c4cb4 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Mon, 23 May 2022 09:47:24 +0200 Subject: [PATCH 1076/1507] client: Avoid protocol error with invalid min/max size If the application sets an invalid minimum and maximum size (where the minimum is higher than the maximum), then we would blindly send this over the protocol, which is a protocol error according to the spec. Qt compositors will warn about this and ignore the size, but mainly because "but there's no matching error defined" according to the comment. Other compositors may close the connection when this happens. To avoid crashing the app based on bogus min/max size, we make sure we never send a maximum size which is less than the minimum size. This corresponds to the behavior of compositors which accept the size without raising an error: the minimum size takes precedence. Note that 0 means "no maximum size" in the protocol, so we cap the value before applying this logic. [ChangeLog][Client] Fixed an issue where setting an invalid minimum and maximum size on a window would cause some compositors to raise a protocol error. Pick-to: 6.2 6.3 Fixes: QTBUG-102626 Fixes: QTBUG-103391 Change-Id: I4004a4550a9fe3dae6a27169b4d1a9a616e21841 Reviewed-by: David Edmundson --- .../plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp index 4603ec11d05..c07373f69eb 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp @@ -391,10 +391,10 @@ void QWaylandXdgSurface::setSizeHints() const int minHeight = qMax(0, m_window->windowMinimumSize().height()); m_toplevel->set_min_size(minWidth, minHeight); - int maxWidth = qMax(0, m_window->windowMaximumSize().width()); + int maxWidth = qMax(minWidth, m_window->windowMaximumSize().width()); if (maxWidth == QWINDOWSIZE_MAX) maxWidth = 0; - int maxHeight = qMax(0, m_window->windowMaximumSize().height()); + int maxHeight = qMax(minHeight, m_window->windowMaximumSize().height()); if (maxHeight == QWINDOWSIZE_MAX) maxHeight = 0; m_toplevel->set_max_size(maxWidth, maxHeight); From bb3eeb085c49306efd8a53cd687f8837efb8725c Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Tue, 12 Apr 2022 05:46:20 +0400 Subject: [PATCH 1077/1507] Client: fix mouse cursor restoring check when cursor enters the content area In a02c408afc1ec3713d26f133277cbba2d207f102, windowContentGeometry was changed by adding shadow margins, but the check ensures that the point inside the content area rather than the decoration and windowContentGeometry is smaller than the decoration geometry now as it excludes the shadow. Creating the geometry from surfaceSize fixes it. Pick-to: 6.3 6.2 Change-Id: If20a387b6864c1bc961352654f827a45cee77bd1 Reviewed-by: Jan Grulich Reviewed-by: Aleix Pol Gonzalez --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index dce6590a8ec..87baeff506b 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -1038,7 +1038,7 @@ void QWaylandWindow::handleMouse(QWaylandInputDevice *inputDevice, const QWaylan #if QT_CONFIG(cursor) if (e.type == QEvent::Enter) { - QRect contentGeometry = windowContentGeometry().marginsRemoved(clientSideMargins()); + QRect contentGeometry = QRect(QPoint(), surfaceSize()).marginsRemoved(clientSideMargins()); if (contentGeometry.contains(e.local.toPoint())) restoreMouseCursor(inputDevice); } From aa2de8df9f9d8b5869c000a01cf0e9aa577f1ff1 Mon Sep 17 00:00:00 2001 From: Liang Qi Date: Tue, 31 May 2022 20:26:31 +0200 Subject: [PATCH 1078/1507] QtWlShellIntegrationPrivate: includemocs Pick-to: 6.3 6.2 5.15 Task-number: QTBUG-103295 Change-Id: I000dd8b5fa13747acfa8c12df4203dfdaa48b9c4 Reviewed-by: Marc Mutz --- .../shellintegration/wl-shell/qwaylandwlshellsurface.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellsurface.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellsurface.cpp index 8f41118d88d..688255cab3f 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellsurface.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellsurface.cpp @@ -288,3 +288,5 @@ void QWaylandWlShellSurface::shell_surface_popup_done() } QT_END_NAMESPACE + +#include "moc_qwaylandwlshellsurface_p.cpp" From 60e835a410dfe5822e4cae226ba7186cc93a7367 Mon Sep 17 00:00:00 2001 From: Liang Qi Date: Wed, 1 Jun 2022 09:20:53 +0200 Subject: [PATCH 1079/1507] QWaylandXdgShellIntegrationPlugin: includemocs Pick-to: 6.3 6.2 5.15 Task-number: QTBUG-103295 Change-Id: I974dbcd67bc4a45cf18d0fdf197bcaeb12c633b4 Reviewed-by: Marc Mutz --- .../plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp index c07373f69eb..363555a8494 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp @@ -581,3 +581,5 @@ void QWaylandXdgShell::handleRegistryGlobal(void *data, wl_registry *registry, u } QT_END_NAMESPACE + +#include "moc_qwaylandxdgshell_p.cpp" From cef1e8f7f0462e43902635b2177b4823d44b52e4 Mon Sep 17 00:00:00 2001 From: Liang Qi Date: Wed, 1 Jun 2022 09:21:27 +0200 Subject: [PATCH 1080/1507] QWaylandXdgShellIntegrationPlugin: includemocs - qt6 Pick-to: 6.3 6.2 Task-number: QTBUG-103295 Change-Id: Iff8a76926a8a0b581a0290b5b6ab44453ac774ec Reviewed-by: Marc Mutz --- .../shellintegration/xdg-shell/qwaylandxdgactivationv1.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgactivationv1.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgactivationv1.cpp index 9b5a1cb3bbf..f668ff700d4 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgactivationv1.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgactivationv1.cpp @@ -81,3 +81,5 @@ QWaylandXdgActivationV1::requestXdgActivationToken(QWaylandDisplay *display, } QT_END_NAMESPACE + +#include "moc_qwaylandxdgactivationv1_p.cpp" From 4a57ddd3ba0551a3b144cc53c4b48d9b454e96a0 Mon Sep 17 00:00:00 2001 From: Liang Qi Date: Wed, 1 Jun 2022 09:30:02 +0200 Subject: [PATCH 1081/1507] QtWaylandClient: includemocs Pick-to: 6.3 6.2 5.15 Task-number: QTBUG-103295 Change-Id: Ibac5e794c7d7f35d51d8d48110892c33a0b67c7a Reviewed-by: Marc Mutz --- .../platforms/wayland/global/qwaylandclientextension.cpp | 2 ++ .../qwaylandclientbufferintegrationplugin.cpp | 2 ++ .../qwaylandserverbufferintegrationplugin.cpp | 2 ++ .../qwaylandinputdeviceintegrationplugin.cpp | 2 ++ src/plugins/platforms/wayland/qwaylandabstractdecoration.cpp | 2 ++ src/plugins/platforms/wayland/qwaylanddatadevice.cpp | 2 ++ src/plugins/platforms/wayland/qwaylanddatasource.cpp | 2 ++ src/plugins/platforms/wayland/qwaylanddecorationplugin.cpp | 2 ++ src/plugins/platforms/wayland/qwaylanddisplay.cpp | 2 ++ src/plugins/platforms/wayland/qwaylandinputcontext.cpp | 2 ++ src/plugins/platforms/wayland/qwaylandinputdevice.cpp | 2 ++ src/plugins/platforms/wayland/qwaylandprimaryselectionv1.cpp | 2 ++ src/plugins/platforms/wayland/qwaylandshellsurface.cpp | 2 ++ src/plugins/platforms/wayland/qwaylandsurface.cpp | 2 ++ src/plugins/platforms/wayland/qwaylandtabletv2.cpp | 2 ++ src/plugins/platforms/wayland/qwaylandwindow.cpp | 2 ++ .../platforms/wayland/qwaylandwindowmanagerintegration.cpp | 2 ++ .../wayland/shellintegration/qwaylandshellintegrationplugin.cpp | 2 ++ 18 files changed, 36 insertions(+) diff --git a/src/plugins/platforms/wayland/global/qwaylandclientextension.cpp b/src/plugins/platforms/wayland/global/qwaylandclientextension.cpp index 200dad072ed..55d6e48a7fc 100644 --- a/src/plugins/platforms/wayland/global/qwaylandclientextension.cpp +++ b/src/plugins/platforms/wayland/global/qwaylandclientextension.cpp @@ -147,3 +147,5 @@ bool QWaylandClientExtension::isActive() const } QT_END_NAMESPACE + +#include "moc_qwaylandclientextension.cpp" diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationplugin.cpp b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationplugin.cpp index 7aae1d0c418..e9f78ecd43e 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationplugin.cpp +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationplugin.cpp @@ -55,3 +55,5 @@ QWaylandClientBufferIntegrationPlugin::~QWaylandClientBufferIntegrationPlugin() } QT_END_NAMESPACE + +#include "moc_qwaylandclientbufferintegrationplugin_p.cpp" diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationplugin.cpp b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationplugin.cpp index cff72e7a349..3c802dd01b7 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationplugin.cpp +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationplugin.cpp @@ -54,3 +54,5 @@ QWaylandServerBufferIntegrationPlugin::~QWaylandServerBufferIntegrationPlugin() } QT_END_NAMESPACE + +#include "moc_qwaylandserverbufferintegrationplugin_p.cpp" diff --git a/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationplugin.cpp b/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationplugin.cpp index 57909576721..044c2892642 100644 --- a/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationplugin.cpp +++ b/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationplugin.cpp @@ -55,3 +55,5 @@ QWaylandInputDeviceIntegrationPlugin::~QWaylandInputDeviceIntegrationPlugin() } QT_END_NAMESPACE + +#include "moc_qwaylandinputdeviceintegrationplugin_p.cpp" diff --git a/src/plugins/platforms/wayland/qwaylandabstractdecoration.cpp b/src/plugins/platforms/wayland/qwaylandabstractdecoration.cpp index be0a31df6d9..d15a7f9fe69 100644 --- a/src/plugins/platforms/wayland/qwaylandabstractdecoration.cpp +++ b/src/plugins/platforms/wayland/qwaylandabstractdecoration.cpp @@ -216,3 +216,5 @@ QWaylandWindow *QWaylandAbstractDecoration::waylandWindow() const } QT_END_NAMESPACE + +#include "moc_qwaylandabstractdecoration_p.cpp" diff --git a/src/plugins/platforms/wayland/qwaylanddatadevice.cpp b/src/plugins/platforms/wayland/qwaylanddatadevice.cpp index 7b90284ce01..421cf167d19 100644 --- a/src/plugins/platforms/wayland/qwaylanddatadevice.cpp +++ b/src/plugins/platforms/wayland/qwaylanddatadevice.cpp @@ -344,3 +344,5 @@ int QWaylandDataDevice::dropActionsToWl(Qt::DropActions actions) } QT_END_NAMESPACE + +#include "moc_qwaylanddatadevice_p.cpp" diff --git a/src/plugins/platforms/wayland/qwaylanddatasource.cpp b/src/plugins/platforms/wayland/qwaylanddatasource.cpp index 95e83595f78..767d002c155 100644 --- a/src/plugins/platforms/wayland/qwaylanddatasource.cpp +++ b/src/plugins/platforms/wayland/qwaylanddatasource.cpp @@ -133,3 +133,5 @@ void QWaylandDataSource::data_source_dnd_drop_performed() } QT_END_NAMESPACE + +#include "moc_qwaylanddatasource_p.cpp" diff --git a/src/plugins/platforms/wayland/qwaylanddecorationplugin.cpp b/src/plugins/platforms/wayland/qwaylanddecorationplugin.cpp index 15d907de940..2f8045d6008 100644 --- a/src/plugins/platforms/wayland/qwaylanddecorationplugin.cpp +++ b/src/plugins/platforms/wayland/qwaylanddecorationplugin.cpp @@ -54,3 +54,5 @@ QWaylandDecorationPlugin::~QWaylandDecorationPlugin() } QT_END_NAMESPACE + +#include "moc_qwaylanddecorationplugin_p.cpp" diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index 80af2ca4995..5dff2c6a1bb 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -913,3 +913,5 @@ QWaylandCursorTheme *QWaylandDisplay::loadCursorTheme(const QString &name, int p #include "qwaylanddisplay.moc" QT_END_NAMESPACE + +#include "moc_qwaylanddisplay_p.cpp" diff --git a/src/plugins/platforms/wayland/qwaylandinputcontext.cpp b/src/plugins/platforms/wayland/qwaylandinputcontext.cpp index b70f70f2872..4672dda1560 100644 --- a/src/plugins/platforms/wayland/qwaylandinputcontext.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputcontext.cpp @@ -334,3 +334,5 @@ bool QWaylandInputContext::filterEvent(const QEvent *event) } QT_END_NAMESPACE + +#include "moc_qwaylandinputcontext_p.cpp" diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index 9566965bed9..2463a0ee298 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -1554,3 +1554,5 @@ void QWaylandInputDevice::Touch::touch_frame() } QT_END_NAMESPACE + +#include "moc_qwaylandinputdevice_p.cpp" diff --git a/src/plugins/platforms/wayland/qwaylandprimaryselectionv1.cpp b/src/plugins/platforms/wayland/qwaylandprimaryselectionv1.cpp index 5cee3299f73..7805dd7346a 100644 --- a/src/plugins/platforms/wayland/qwaylandprimaryselectionv1.cpp +++ b/src/plugins/platforms/wayland/qwaylandprimaryselectionv1.cpp @@ -170,3 +170,5 @@ void QWaylandPrimarySelectionSourceV1::zwp_primary_selection_source_v1_send(cons } // namespace QtWaylandClient QT_END_NAMESPACE + +#include "moc_qwaylandprimaryselectionv1_p.cpp" diff --git a/src/plugins/platforms/wayland/qwaylandshellsurface.cpp b/src/plugins/platforms/wayland/qwaylandshellsurface.cpp index f87e5962437..0e1617e63bf 100644 --- a/src/plugins/platforms/wayland/qwaylandshellsurface.cpp +++ b/src/plugins/platforms/wayland/qwaylandshellsurface.cpp @@ -119,3 +119,5 @@ void QWaylandShellSurface::requestXdgActivationToken(quint32 serial) } QT_END_NAMESPACE + +#include "moc_qwaylandshellsurface_p.cpp" diff --git a/src/plugins/platforms/wayland/qwaylandsurface.cpp b/src/plugins/platforms/wayland/qwaylandsurface.cpp index 21e70ce4fe8..983cef71971 100644 --- a/src/plugins/platforms/wayland/qwaylandsurface.cpp +++ b/src/plugins/platforms/wayland/qwaylandsurface.cpp @@ -124,3 +124,5 @@ void QWaylandSurface::surface_leave(wl_output *output) } // namespace QtWaylandClient QT_END_NAMESPACE + +#include "moc_qwaylandsurface_p.cpp" diff --git a/src/plugins/platforms/wayland/qwaylandtabletv2.cpp b/src/plugins/platforms/wayland/qwaylandtabletv2.cpp index 0f55aba9e00..b1b37d19d6e 100644 --- a/src/plugins/platforms/wayland/qwaylandtabletv2.cpp +++ b/src/plugins/platforms/wayland/qwaylandtabletv2.cpp @@ -330,3 +330,5 @@ void QWaylandTabletPadV2::zwp_tablet_pad_v2_removed() } // namespace QtWaylandClient QT_END_NAMESPACE + +#include "moc_qwaylandtabletv2_p.cpp" diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 87baeff506b..31219abc89c 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -1531,3 +1531,5 @@ void QWaylandWindow::setXdgActivationToken(const QString &token) } QT_END_NAMESPACE + +#include "moc_qwaylandwindow_p.cpp" diff --git a/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration.cpp b/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration.cpp index dd1acaf7215..5d60624a683 100644 --- a/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration.cpp @@ -145,3 +145,5 @@ bool QWaylandWindowManagerIntegration::openDocument(const QUrl &url) } QT_END_NAMESPACE + +#include "moc_qwaylandwindowmanagerintegration_p.cpp" diff --git a/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationplugin.cpp b/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationplugin.cpp index d89e61fb1d4..f0833251e88 100644 --- a/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationplugin.cpp +++ b/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationplugin.cpp @@ -55,3 +55,5 @@ QWaylandShellIntegrationPlugin::~QWaylandShellIntegrationPlugin() } QT_END_NAMESPACE + +#include "moc_qwaylandshellintegrationplugin_p.cpp" From 953d7696777da9000062ea3dcaadd2ae123b4236 Mon Sep 17 00:00:00 2001 From: Liang Qi Date: Wed, 1 Jun 2022 09:30:23 +0200 Subject: [PATCH 1082/1507] QtWaylandClient: includemocs - qt6 Pick-to: 6.3 6.2 Task-number: QTBUG-103295 Change-Id: Ia4cb0df840b27e70f162e28d13bedd992c27cd83 Reviewed-by: Marc Mutz --- src/plugins/platforms/wayland/qwaylandinputmethodcontext.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/plugins/platforms/wayland/qwaylandinputmethodcontext.cpp b/src/plugins/platforms/wayland/qwaylandinputmethodcontext.cpp index 033c89c879e..e547739c6a2 100644 --- a/src/plugins/platforms/wayland/qwaylandinputmethodcontext.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputmethodcontext.cpp @@ -429,3 +429,5 @@ QWaylandTextInputMethod *QWaylandInputMethodContext::textInputMethod() const } // QtWaylandClient QT_END_NAMESPACE + +#include "moc_qwaylandinputmethodcontext_p.cpp" From 1c2113afbd15da1c6558fd5f612b01f822cd1658 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Mon, 11 Apr 2022 01:07:10 +0400 Subject: [PATCH 1083/1507] Client: Expose default input device's serial through integration Default input device is not so useful without serial for calls like xdg_toplevel_show_window_menu This is done in the same way as apptime/appusertime/gettimestamp in xcb's native interface. Pick-to: 6.4 Change-Id: I20e7dee19cf20e819a557e23c539066945cecb46 Reviewed-by: David Edmundson --- src/plugins/platforms/wayland/qwaylandnativeinterface.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp b/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp index 2c9ba899fb9..f8ae07aa625 100644 --- a/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp +++ b/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp @@ -98,6 +98,8 @@ void *QWaylandNativeInterface::nativeResourceForIntegration(const QByteArray &re return touch->wl_touch(); return nullptr; } + if (lowerCaseResource == "serial") + return reinterpret_cast(quintptr(m_integration->display()->defaultInputDevice()->serial())); return nullptr; } From f16eb3fef00a4f02ef350390b94685bbf392ed19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucie=20G=C3=A9rard?= Date: Fri, 10 Jun 2022 15:07:09 +0200 Subject: [PATCH 1084/1507] Use SPDX license identifiers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replace the current license disclaimer in files by a SPDX-License-Identifier. License files are organized under LICENSES directory. Pick-to: 6.4 Task-number: QTBUG-67283 Change-Id: I106d3a5d1a7b96250380b6f51a48f3b19d10e4d9 Reviewed-by: Jörg Bornemann --- src/3rdparty/wayland/extensions/brcm.xml | 35 +--------------- .../extensions/drm-egl-server-buffer.xml | 35 +--------------- .../extensions/hardware-integration.xml | 35 +--------------- .../libhybris-egl-server-buffer.xml | 35 +--------------- .../extensions/qt-dmabuf-server-buffer.xml | 35 +--------------- .../wayland/extensions/qt-key-unstable-v1.xml | 35 +--------------- .../qt-texture-sharing-unstable-v1.xml | 35 +--------------- .../qt-vulkan-server-buffer-unstable-v1.xml | 35 +--------------- .../wayland/extensions/qt-windowmanager.xml | 35 +--------------- .../extensions/server-buffer-extension.xml | 35 +--------------- .../shm-emulation-server-buffer.xml | 35 +--------------- .../wayland/extensions/surface-extension.xml | 35 +--------------- .../wayland/extensions/touch-extension.xml | 35 +--------------- .../global/qwaylandclientextension.cpp | 42 ++----------------- .../wayland/global/qwaylandclientextension.h | 40 +----------------- .../global/qwaylandclientextension_p.h | 40 +----------------- .../qwaylandclientbufferintegration.cpp | 40 +----------------- .../qwaylandclientbufferintegration_p.h | 40 +----------------- ...qwaylandclientbufferintegrationfactory.cpp | 40 +----------------- ...qwaylandclientbufferintegrationfactory_p.h | 40 +----------------- .../qwaylandclientbufferintegrationplugin.cpp | 40 +----------------- .../qwaylandclientbufferintegrationplugin_p.h | 40 +----------------- .../qwaylandhardwareintegration.cpp | 40 +----------------- .../qwaylandhardwareintegration_p.h | 40 +----------------- .../qwaylandserverbufferintegration.cpp | 40 +----------------- .../qwaylandserverbufferintegration_p.h | 40 +----------------- ...qwaylandserverbufferintegrationfactory.cpp | 40 +----------------- ...qwaylandserverbufferintegrationfactory_p.h | 40 +----------------- .../qwaylandserverbufferintegrationplugin.cpp | 40 +----------------- .../qwaylandserverbufferintegrationplugin_p.h | 40 +----------------- .../qwaylandinputdeviceintegration_p.h | 40 +----------------- .../qwaylandinputdeviceintegrationfactory.cpp | 40 +----------------- .../qwaylandinputdeviceintegrationfactory_p.h | 40 +----------------- .../qwaylandinputdeviceintegrationplugin.cpp | 40 +----------------- .../qwaylandinputdeviceintegrationplugin_p.h | 40 +----------------- .../plugins/decorations/bradient/main.cpp | 42 ++----------------- .../hardwareintegration/brcm-egl/main.cpp | 40 +----------------- .../dmabuf-server/main.cpp | 40 +----------------- .../drm-egl-server/main.cpp | 40 +----------------- .../libhybris-egl-server/main.cpp | 40 +----------------- .../shm-emulation-server/main.cpp | 40 +----------------- .../vulkan-server/main.cpp | 40 +----------------- .../hardwareintegration/wayland-egl/main.cpp | 40 +----------------- .../fullscreen-shell-v1/main.cpp | 40 +----------------- .../qwaylandfullscreenshellv1integration.cpp | 40 +----------------- .../qwaylandfullscreenshellv1integration.h | 40 +----------------- .../qwaylandfullscreenshellv1surface.cpp | 40 +----------------- .../qwaylandfullscreenshellv1surface.h | 40 +----------------- .../shellintegration/wl-shell/main.cpp | 42 ++----------------- .../wl-shell/qwaylandwlshellintegration.cpp | 40 +----------------- .../wl-shell/qwaylandwlshellintegration_p.h | 40 +----------------- .../wl-shell/qwaylandwlshellsurface.cpp | 40 +----------------- .../wl-shell/qwaylandwlshellsurface_p.h | 40 +----------------- .../shellintegration/xdg-shell/main.cpp | 40 +----------------- .../xdg-shell/qwaylandxdgactivationv1.cpp | 40 +----------------- .../xdg-shell/qwaylandxdgactivationv1_p.h | 40 +----------------- .../xdg-shell/qwaylandxdgdecorationv1.cpp | 40 +----------------- .../xdg-shell/qwaylandxdgdecorationv1_p.h | 40 +----------------- .../xdg-shell/qwaylandxdgshell.cpp | 42 ++----------------- .../xdg-shell/qwaylandxdgshell_p.h | 42 ++----------------- .../xdg-shell/qwaylandxdgshellintegration.cpp | 40 +----------------- .../xdg-shell/qwaylandxdgshellintegration_p.h | 40 +----------------- .../platforms/wayland/qtwaylandclientglobal.h | 40 +----------------- .../wayland/qtwaylandclientglobal_p.h | 40 +----------------- .../wayland/qwaylandabstractdecoration.cpp | 42 ++----------------- .../wayland/qwaylandabstractdecoration_p.h | 42 ++----------------- .../platforms/wayland/qwaylandbuffer.cpp | 42 ++----------------- .../platforms/wayland/qwaylandbuffer_p.h | 40 +----------------- .../platforms/wayland/qwaylandclipboard.cpp | 40 +----------------- .../platforms/wayland/qwaylandclipboard_p.h | 40 +----------------- .../platforms/wayland/qwaylandcursor.cpp | 40 +----------------- .../platforms/wayland/qwaylandcursor_p.h | 40 +----------------- .../platforms/wayland/qwaylanddatadevice.cpp | 40 +----------------- .../platforms/wayland/qwaylanddatadevice_p.h | 40 +----------------- .../wayland/qwaylanddatadevicemanager.cpp | 40 +----------------- .../wayland/qwaylanddatadevicemanager_p.h | 40 +----------------- .../platforms/wayland/qwaylanddataoffer.cpp | 40 +----------------- .../platforms/wayland/qwaylanddataoffer_p.h | 40 +----------------- .../platforms/wayland/qwaylanddatasource.cpp | 40 +----------------- .../platforms/wayland/qwaylanddatasource_p.h | 40 +----------------- .../wayland/qwaylanddecorationfactory.cpp | 40 +----------------- .../wayland/qwaylanddecorationfactory_p.h | 40 +----------------- .../wayland/qwaylanddecorationplugin.cpp | 40 +----------------- .../wayland/qwaylanddecorationplugin_p.h | 40 +----------------- .../platforms/wayland/qwaylanddisplay.cpp | 40 +----------------- .../platforms/wayland/qwaylanddisplay_p.h | 40 +----------------- src/plugins/platforms/wayland/qwaylanddnd.cpp | 40 +----------------- src/plugins/platforms/wayland/qwaylanddnd_p.h | 40 +----------------- .../wayland/qwaylandextendedsurface.cpp | 40 +----------------- .../wayland/qwaylandextendedsurface_p.h | 40 +----------------- .../wayland/qwaylandinputcontext.cpp | 40 +----------------- .../wayland/qwaylandinputcontext_p.h | 40 +----------------- .../platforms/wayland/qwaylandinputdevice.cpp | 40 +----------------- .../platforms/wayland/qwaylandinputdevice_p.h | 40 +----------------- .../wayland/qwaylandinputmethodcontext.cpp | 40 +----------------- .../wayland/qwaylandinputmethodcontext_p.h | 40 +----------------- .../platforms/wayland/qwaylandintegration.cpp | 40 +----------------- .../platforms/wayland/qwaylandintegration_p.h | 40 +----------------- .../wayland/qwaylandnativeinterface.cpp | 40 +----------------- .../wayland/qwaylandnativeinterface_p.h | 40 +----------------- .../wayland/qwaylandpointergestures.cpp | 40 +----------------- .../wayland/qwaylandpointergestures_p.h | 40 +----------------- .../wayland/qwaylandprimaryselectionv1.cpp | 40 +----------------- .../wayland/qwaylandprimaryselectionv1_p.h | 40 +----------------- .../platforms/wayland/qwaylandqtkey.cpp | 40 +----------------- .../platforms/wayland/qwaylandqtkey_p.h | 40 +----------------- .../platforms/wayland/qwaylandscreen.cpp | 40 +----------------- .../platforms/wayland/qwaylandscreen_p.h | 40 +----------------- .../wayland/qwaylandshellsurface.cpp | 40 +----------------- .../wayland/qwaylandshellsurface_p.h | 40 +----------------- src/plugins/platforms/wayland/qwaylandshm.cpp | 40 +----------------- src/plugins/platforms/wayland/qwaylandshm_p.h | 40 +----------------- .../wayland/qwaylandshmbackingstore.cpp | 40 +----------------- .../wayland/qwaylandshmbackingstore_p.h | 40 +----------------- .../platforms/wayland/qwaylandshmwindow.cpp | 40 +----------------- .../platforms/wayland/qwaylandshmwindow_p.h | 40 +----------------- .../platforms/wayland/qwaylandsubsurface.cpp | 40 +----------------- .../platforms/wayland/qwaylandsubsurface_p.h | 40 +----------------- .../platforms/wayland/qwaylandsurface.cpp | 40 +----------------- .../platforms/wayland/qwaylandsurface_p.h | 40 +----------------- .../platforms/wayland/qwaylandtabletv2.cpp | 40 +----------------- .../platforms/wayland/qwaylandtabletv2_p.h | 40 +----------------- .../wayland/qwaylandtextinputinterface.cpp | 40 +----------------- .../wayland/qwaylandtextinputinterface_p.h | 40 +----------------- .../platforms/wayland/qwaylandtextinputv1.cpp | 40 +----------------- .../platforms/wayland/qwaylandtextinputv1_p.h | 40 +----------------- .../platforms/wayland/qwaylandtextinputv2.cpp | 40 +----------------- .../platforms/wayland/qwaylandtextinputv2_p.h | 40 +----------------- .../platforms/wayland/qwaylandtextinputv4.cpp | 40 +----------------- .../platforms/wayland/qwaylandtextinputv4_p.h | 40 +----------------- .../platforms/wayland/qwaylandtouch.cpp | 40 +----------------- .../platforms/wayland/qwaylandtouch_p.h | 40 +----------------- .../wayland/qwaylandvulkaninstance.cpp | 40 +----------------- .../wayland/qwaylandvulkaninstance_p.h | 40 +----------------- .../wayland/qwaylandvulkanwindow.cpp | 40 +----------------- .../wayland/qwaylandvulkanwindow_p.h | 40 +----------------- .../platforms/wayland/qwaylandwindow.cpp | 40 +----------------- .../platforms/wayland/qwaylandwindow_p.h | 40 +----------------- .../qwaylandwindowmanagerintegration.cpp | 40 +----------------- .../qwaylandwindowmanagerintegration_p.h | 40 +----------------- .../qwaylandinputmethodeventbuilder.cpp | 40 +----------------- .../qwaylandinputmethodeventbuilder_p.h | 40 +----------------- .../wayland/shared/qwaylandmimehelper.cpp | 40 +----------------- .../wayland/shared/qwaylandmimehelper_p.h | 40 +----------------- .../qwaylandsharedmemoryformathelper_p.h | 40 +----------------- .../qwaylandclientshellapi_p.h | 30 +------------ .../qwaylandshellintegration.cpp | 30 +------------ .../qwaylandshellintegration_p.h | 40 +----------------- .../qwaylandshellintegrationfactory.cpp | 40 +----------------- .../qwaylandshellintegrationfactory_p.h | 40 +----------------- .../qwaylandshellintegrationplugin.cpp | 40 +----------------- .../qwaylandshellintegrationplugin_p.h | 40 +----------------- .../qtwaylandscanner/qtwaylandscanner.cpp | 40 +----------------- tests/auto/wayland/client/tst_client.cpp | 29 +------------ .../clientextension/tst_clientextension.cpp | 29 +------------ .../wayland/datadevicev1/tst_datadevicev1.cpp | 29 +------------ .../tst_fullscreenshellv1.cpp | 33 ++------------- .../wayland/inputcontext/tst_inputcontext.cpp | 29 +------------ .../multithreaded/tst_multithreaded.cpp | 31 ++------------ tests/auto/wayland/nooutput/tst_nooutput.cpp | 29 +------------ tests/auto/wayland/output/tst_output.cpp | 29 +------------ .../tst_primaryselectionv1.cpp | 29 +------------ tests/auto/wayland/seat/tst_seat.cpp | 29 +------------ tests/auto/wayland/seatv4/tst_seatv4.cpp | 29 +------------ tests/auto/wayland/shared/corecompositor.cpp | 29 +------------ tests/auto/wayland/shared/corecompositor.h | 29 +------------ tests/auto/wayland/shared/coreprotocol.cpp | 29 +------------ tests/auto/wayland/shared/coreprotocol.h | 29 +------------ tests/auto/wayland/shared/datadevice.cpp | 29 +------------ tests/auto/wayland/shared/datadevice.h | 29 +------------ .../auto/wayland/shared/fullscreenshellv1.cpp | 29 +------------ tests/auto/wayland/shared/fullscreenshellv1.h | 29 +------------ tests/auto/wayland/shared/mockcompositor.cpp | 31 ++------------ tests/auto/wayland/shared/mockcompositor.h | 31 ++------------ tests/auto/wayland/shared/qttextinput.cpp | 29 +------------ tests/auto/wayland/shared/qttextinput.h | 29 +------------ tests/auto/wayland/shared/textinput.cpp | 29 +------------ tests/auto/wayland/shared/textinput.h | 29 +------------ tests/auto/wayland/shared/xdgoutputv1.cpp | 29 +------------ tests/auto/wayland/shared/xdgoutputv1.h | 29 +------------ tests/auto/wayland/shared/xdgshell.cpp | 29 +------------ tests/auto/wayland/shared/xdgshell.h | 29 +------------ tests/auto/wayland/surface/tst_surface.cpp | 29 +------------ tests/auto/wayland/tabletv2/tst_tabletv2.cpp | 29 +------------ .../auto/wayland/wl_connect/tst_wlconnect.cpp | 29 +------------ .../xdgdecorationv1/tst_xdgdecorationv1.cpp | 29 +------------ .../auto/wayland/xdgoutput/tst_xdgoutput.cpp | 29 +------------ tests/auto/wayland/xdgshell/tst_xdgshell.cpp | 29 +------------ 188 files changed, 376 insertions(+), 6700 deletions(-) diff --git a/src/3rdparty/wayland/extensions/brcm.xml b/src/3rdparty/wayland/extensions/brcm.xml index 9ac678f972c..39e059604c1 100644 --- a/src/3rdparty/wayland/extensions/brcm.xml +++ b/src/3rdparty/wayland/extensions/brcm.xml @@ -4,40 +4,7 @@ the server and published using the display's global event. --> Copyright (C) 2015 The Qt Company Ltd. - Contact: http://www.qt.io/licensing/ - - This file is part of the plugins of the Qt Toolkit. - - $QT_BEGIN_LICENSE:BSD$ - You may use this file under the terms of the BSD license as follows: - - "Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are - met: - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in - the documentation and/or other materials provided with the - distribution. - * Neither the name of The Qt Company Ltd nor the names of its - contributors may be used to endorse or promote products derived - from this software without specific prior written permission. - - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." - - $QT_END_LICENSE$ + SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause diff --git a/src/3rdparty/wayland/extensions/drm-egl-server-buffer.xml b/src/3rdparty/wayland/extensions/drm-egl-server-buffer.xml index 375b0044acc..9fc9dd908f7 100644 --- a/src/3rdparty/wayland/extensions/drm-egl-server-buffer.xml +++ b/src/3rdparty/wayland/extensions/drm-egl-server-buffer.xml @@ -2,40 +2,7 @@ Copyright (C) 2015 The Qt Company Ltd. - Contact: http://www.qt.io/licensing/ - - This file is part of the plugins of the Qt Toolkit. - - $QT_BEGIN_LICENSE:BSD$ - You may use this file under the terms of the BSD license as follows: - - "Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are - met: - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in - the documentation and/or other materials provided with the - distribution. - * Neither the name of The Qt Company Ltd nor the names of its - contributors may be used to endorse or promote products derived - from this software without specific prior written permission. - - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." - - $QT_END_LICENSE$ + SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause diff --git a/src/3rdparty/wayland/extensions/hardware-integration.xml b/src/3rdparty/wayland/extensions/hardware-integration.xml index d2040b3bf0b..19e6f0c5192 100644 --- a/src/3rdparty/wayland/extensions/hardware-integration.xml +++ b/src/3rdparty/wayland/extensions/hardware-integration.xml @@ -2,40 +2,7 @@ Copyright (C) 2015 The Qt Company Ltd. - Contact: http://www.qt.io/licensing/ - - This file is part of the plugins of the Qt Toolkit. - - $QT_BEGIN_LICENSE:BSD$ - You may use this file under the terms of the BSD license as follows: - - "Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are - met: - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in - the documentation and/or other materials provided with the - distribution. - * Neither the name of The Qt Company Ltd nor the names of its - contributors may be used to endorse or promote products derived - from this software without specific prior written permission. - - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." - - $QT_END_LICENSE$ + SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause diff --git a/src/3rdparty/wayland/extensions/libhybris-egl-server-buffer.xml b/src/3rdparty/wayland/extensions/libhybris-egl-server-buffer.xml index 0d3a4cee78a..605ec65d447 100644 --- a/src/3rdparty/wayland/extensions/libhybris-egl-server-buffer.xml +++ b/src/3rdparty/wayland/extensions/libhybris-egl-server-buffer.xml @@ -2,40 +2,7 @@ Copyright (C) 2014 Jolla Ltd - Contact: http://www.qt.io/licensing/ - - This file is part of the plugins of the Qt Toolkit. - - $QT_BEGIN_LICENSE:BSD$ - You may use this file under the terms of the BSD license as follows: - - "Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are - met: - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in - the documentation and/or other materials provided with the - distribution. - * Neither the name of The Qt Company Ltd nor the names of its - contributors may be used to endorse or promote products derived - from this software without specific prior written permission. - - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." - - $QT_END_LICENSE$ + SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause diff --git a/src/3rdparty/wayland/extensions/qt-dmabuf-server-buffer.xml b/src/3rdparty/wayland/extensions/qt-dmabuf-server-buffer.xml index 6b1d426fc07..c8c142f51a0 100644 --- a/src/3rdparty/wayland/extensions/qt-dmabuf-server-buffer.xml +++ b/src/3rdparty/wayland/extensions/qt-dmabuf-server-buffer.xml @@ -2,40 +2,7 @@ Copyright (C) 2018 The Qt Company Ltd. - Contact: http://www.qt.io/licensing/ - - This file is part of the plugins of the Qt Toolkit. - - $QT_BEGIN_LICENSE:BSD$ - You may use this file under the terms of the BSD license as follows: - - "Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are - met: - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in - the documentation and/or other materials provided with the - distribution. - * Neither the name of The Qt Company Ltd nor the names of its - contributors may be used to endorse or promote products derived - from this software without specific prior written permission. - - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." - - $QT_END_LICENSE$ + SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause diff --git a/src/3rdparty/wayland/extensions/qt-key-unstable-v1.xml b/src/3rdparty/wayland/extensions/qt-key-unstable-v1.xml index 0f8d8284c7b..23b04648ba0 100644 --- a/src/3rdparty/wayland/extensions/qt-key-unstable-v1.xml +++ b/src/3rdparty/wayland/extensions/qt-key-unstable-v1.xml @@ -2,40 +2,7 @@ Copyright (C) 2018 The Qt Company Ltd. - Contact: http://www.qt.io/licensing/ - - This file is part of the plugins of the Qt Toolkit. - - $QT_BEGIN_LICENSE:BSD$ - You may use this file under the terms of the BSD license as follows: - - "Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are - met: - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in - the documentation and/or other materials provided with the - distribution. - * Neither the name of The Qt Company Ltd nor the names of its - contributors may be used to endorse or promote products derived - from this software without specific prior written permission. - - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." - - $QT_END_LICENSE$ + SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause diff --git a/src/3rdparty/wayland/extensions/qt-texture-sharing-unstable-v1.xml b/src/3rdparty/wayland/extensions/qt-texture-sharing-unstable-v1.xml index 262ae487c22..ae3ab9ea970 100644 --- a/src/3rdparty/wayland/extensions/qt-texture-sharing-unstable-v1.xml +++ b/src/3rdparty/wayland/extensions/qt-texture-sharing-unstable-v1.xml @@ -2,40 +2,7 @@ Copyright (C) 2019 The Qt Company Ltd. - Contact: http://www.qt.io/licensing/ - - This file is part of the plugins of the Qt Toolkit. - - $QT_BEGIN_LICENSE:BSD$ - You may use this file under the terms of the BSD license as follows: - - "Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are - met: - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in - the documentation and/or other materials provided with the - distribution. - * Neither the name of The Qt Company Ltd nor the names of its - contributors may be used to endorse or promote products derived - from this software without specific prior written permission. - - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." - - $QT_END_LICENSE$ + SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause diff --git a/src/3rdparty/wayland/extensions/qt-vulkan-server-buffer-unstable-v1.xml b/src/3rdparty/wayland/extensions/qt-vulkan-server-buffer-unstable-v1.xml index 211d0a7c730..08a27e5d303 100644 --- a/src/3rdparty/wayland/extensions/qt-vulkan-server-buffer-unstable-v1.xml +++ b/src/3rdparty/wayland/extensions/qt-vulkan-server-buffer-unstable-v1.xml @@ -2,40 +2,7 @@ Copyright (C) 2019 The Qt Company Ltd. - Contact: http://www.qt.io/licensing/ - - This file is part of the plugins of the Qt Toolkit. - - $QT_BEGIN_LICENSE:BSD$ - You may use this file under the terms of the BSD license as follows: - - "Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are - met: - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in - the documentation and/or other materials provided with the - distribution. - * Neither the name of The Qt Company Ltd nor the names of its - contributors may be used to endorse or promote products derived - from this software without specific prior written permission. - - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." - - $QT_END_LICENSE$ + SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause diff --git a/src/3rdparty/wayland/extensions/qt-windowmanager.xml b/src/3rdparty/wayland/extensions/qt-windowmanager.xml index 86ddff72ec5..bd6e88f74db 100644 --- a/src/3rdparty/wayland/extensions/qt-windowmanager.xml +++ b/src/3rdparty/wayland/extensions/qt-windowmanager.xml @@ -2,40 +2,7 @@ Copyright (C) 2015 The Qt Company Ltd. - Contact: http://www.qt.io/licensing/ - - This file is part of the plugins of the Qt Toolkit. - - $QT_BEGIN_LICENSE:BSD$ - You may use this file under the terms of the BSD license as follows: - - "Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are - met: - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in - the documentation and/or other materials provided with the - distribution. - * Neither the name of The Qt Company Ltd nor the names of its - contributors may be used to endorse or promote products derived - from this software without specific prior written permission. - - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." - - $QT_END_LICENSE$ + SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause diff --git a/src/3rdparty/wayland/extensions/server-buffer-extension.xml b/src/3rdparty/wayland/extensions/server-buffer-extension.xml index 732e7b7e7a0..75c7f624d50 100644 --- a/src/3rdparty/wayland/extensions/server-buffer-extension.xml +++ b/src/3rdparty/wayland/extensions/server-buffer-extension.xml @@ -2,40 +2,7 @@ Copyright (C) 2015 The Qt Company Ltd. - Contact: http://www.qt.io/licensing/ - - This file is part of the plugins of the Qt Toolkit. - - $QT_BEGIN_LICENSE:BSD$ - You may use this file under the terms of the BSD license as follows: - - "Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are - met: - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in - the documentation and/or other materials provided with the - distribution. - * Neither the name of The Qt Company Ltd nor the names of its - contributors may be used to endorse or promote products derived - from this software without specific prior written permission. - - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." - - $QT_END_LICENSE$ + SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause diff --git a/src/3rdparty/wayland/extensions/shm-emulation-server-buffer.xml b/src/3rdparty/wayland/extensions/shm-emulation-server-buffer.xml index 7fb7069f2e7..9850f915035 100644 --- a/src/3rdparty/wayland/extensions/shm-emulation-server-buffer.xml +++ b/src/3rdparty/wayland/extensions/shm-emulation-server-buffer.xml @@ -2,40 +2,7 @@ Copyright (C) 2017 The Qt Company Ltd. - Contact: http://www.qt.io/licensing/ - - This file is part of the plugins of the Qt Toolkit. - - $QT_BEGIN_LICENSE:BSD$ - You may use this file under the terms of the BSD license as follows: - - "Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are - met: - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in - the documentation and/or other materials provided with the - distribution. - * Neither the name of The Qt Company Ltd nor the names of its - contributors may be used to endorse or promote products derived - from this software without specific prior written permission. - - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." - - $QT_END_LICENSE$ + SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause diff --git a/src/3rdparty/wayland/extensions/surface-extension.xml b/src/3rdparty/wayland/extensions/surface-extension.xml index 1abba7d43a0..231db0b35b2 100644 --- a/src/3rdparty/wayland/extensions/surface-extension.xml +++ b/src/3rdparty/wayland/extensions/surface-extension.xml @@ -2,40 +2,7 @@ Copyright (C) 2015 The Qt Company Ltd. - Contact: http://www.qt.io/licensing/ - - This file is part of the plugins of the Qt Toolkit. - - $QT_BEGIN_LICENSE:BSD$ - You may use this file under the terms of the BSD license as follows: - - "Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are - met: - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in - the documentation and/or other materials provided with the - distribution. - * Neither the name of The Qt Company Ltd nor the names of its - contributors may be used to endorse or promote products derived - from this software without specific prior written permission. - - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." - - $QT_END_LICENSE$ + SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause diff --git a/src/3rdparty/wayland/extensions/touch-extension.xml b/src/3rdparty/wayland/extensions/touch-extension.xml index 300caf26d28..429dadfd9c7 100644 --- a/src/3rdparty/wayland/extensions/touch-extension.xml +++ b/src/3rdparty/wayland/extensions/touch-extension.xml @@ -2,40 +2,7 @@ Copyright (C) 2015 The Qt Company Ltd. - Contact: http://www.qt.io/licensing/ - - This file is part of the plugins of the Qt Toolkit. - - $QT_BEGIN_LICENSE:BSD$ - You may use this file under the terms of the BSD license as follows: - - "Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are - met: - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in - the documentation and/or other materials provided with the - distribution. - * Neither the name of The Qt Company Ltd nor the names of its - contributors may be used to endorse or promote products derived - from this software without specific prior written permission. - - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." - - $QT_END_LICENSE$ + SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause diff --git a/src/plugins/platforms/wayland/global/qwaylandclientextension.cpp b/src/plugins/platforms/wayland/global/qwaylandclientextension.cpp index 55d6e48a7fc..ca0954f7865 100644 --- a/src/plugins/platforms/wayland/global/qwaylandclientextension.cpp +++ b/src/plugins/platforms/wayland/global/qwaylandclientextension.cpp @@ -1,42 +1,6 @@ -/**************************************************************************** -** -** Copyright (C) 2017 Erik Larsson. -** Copyright (C) 2021 David Redondo -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWaylandCompositor module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2017 Erik Larsson. +// Copyright (C) 2021 David Redondo +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "qwaylandclientextension.h" #include "qwaylandclientextension_p.h" diff --git a/src/plugins/platforms/wayland/global/qwaylandclientextension.h b/src/plugins/platforms/wayland/global/qwaylandclientextension.h index f9e5fe2a721..b7c4a3239ea 100644 --- a/src/plugins/platforms/wayland/global/qwaylandclientextension.h +++ b/src/plugins/platforms/wayland/global/qwaylandclientextension.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2017 Erik Larsson. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWaylandCompositor module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2017 Erik Larsson. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QWAYLANDCLIENTEXTENSION_H #define QWAYLANDCLIENTEXTENSION_H diff --git a/src/plugins/platforms/wayland/global/qwaylandclientextension_p.h b/src/plugins/platforms/wayland/global/qwaylandclientextension_p.h index b57d28f1e1c..b3ef87a5d8e 100644 --- a/src/plugins/platforms/wayland/global/qwaylandclientextension_p.h +++ b/src/plugins/platforms/wayland/global/qwaylandclientextension_p.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2017 Erik Larsson. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWaylandCompositor module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2017 Erik Larsson. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QWAYLANDCLIENTEXTENSION_P_H #define QWAYLANDCLIENTEXTENSION_P_H diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegration.cpp b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegration.cpp index 61a2c1cdbea..b521521b887 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegration.cpp +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegration.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "qwaylandclientbufferintegration_p.h" diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegration_p.h b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegration_p.h index 0aa8cd91b87..e8b78c52b67 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegration_p.h +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegration_p.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QWAYLANDCLIENTBUFFERINTEGRATION_H #define QWAYLANDCLIENTBUFFERINTEGRATION_H diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationfactory.cpp b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationfactory.cpp index 115bae10461..48310589ed9 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationfactory.cpp +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationfactory.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "qwaylandclientbufferintegrationfactory_p.h" #include "qwaylandclientbufferintegrationplugin_p.h" diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationfactory_p.h b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationfactory_p.h index f471dcf8d0f..2344df59c73 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationfactory_p.h +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationfactory_p.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QWAYLANDCLIENTBUFFERINTEGRATIONFACTORY_H #define QWAYLANDCLIENTBUFFERINTEGRATIONFACTORY_H diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationplugin.cpp b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationplugin.cpp index e9f78ecd43e..0335a9219d7 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationplugin.cpp +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationplugin.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "qwaylandclientbufferintegrationplugin_p.h" diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationplugin_p.h b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationplugin_p.h index e63bca41a22..0cedabff3d3 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationplugin_p.h +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationplugin_p.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2018 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2018 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QWAYLANDCLIENTBUFFERINTEGRATIONPLUGIN_H #define QWAYLANDCLIENTBUFFERINTEGRATIONPLUGIN_H diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandhardwareintegration.cpp b/src/plugins/platforms/wayland/hardwareintegration/qwaylandhardwareintegration.cpp index 04340da140d..a8f59a7a571 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandhardwareintegration.cpp +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandhardwareintegration.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "qwaylandhardwareintegration_p.h" diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandhardwareintegration_p.h b/src/plugins/platforms/wayland/hardwareintegration/qwaylandhardwareintegration_p.h index aa72d5905f3..d82253f9283 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandhardwareintegration_p.h +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandhardwareintegration_p.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QWAYLANDHARDWAREINTEGRATION_H #define QWAYLANDHARDWAREINTEGRATION_H diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegration.cpp b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegration.cpp index d966a1919d2..64fd7686be2 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegration.cpp +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegration.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "qwaylandserverbufferintegration_p.h" diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegration_p.h b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegration_p.h index 2fbe3b4010b..92236a7ff6e 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegration_p.h +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegration_p.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2019 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2019 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QWAYLANDSERVERBUFFERINTEGRATION_H #define QWAYLANDSERVERBUFFERINTEGRATION_H diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationfactory.cpp b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationfactory.cpp index 65563974122..a8b0c1d87a3 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationfactory.cpp +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationfactory.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "qwaylandserverbufferintegrationfactory_p.h" #include "qwaylandserverbufferintegrationplugin_p.h" diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationfactory_p.h b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationfactory_p.h index f41099895d9..bce4c45d0a3 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationfactory_p.h +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationfactory_p.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QWAYLANDSERVERBUFFERINTEGRATIONFACTORY_H #define QWAYLANDSERVERBUFFERINTEGRATIONFACTORY_H diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationplugin.cpp b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationplugin.cpp index 3c802dd01b7..1a01ca04d5b 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationplugin.cpp +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationplugin.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "qwaylandserverbufferintegrationplugin_p.h" diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationplugin_p.h b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationplugin_p.h index b82b487f15e..6be8ca8bf51 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationplugin_p.h +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationplugin_p.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2018 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2018 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QWAYLANDSERVERBUFFERINTEGRATIONPLUGIN_H #define QWAYLANDSERVERBUFFERINTEGRATIONPLUGIN_H diff --git a/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegration_p.h b/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegration_p.h index f034abc1c4f..9a6c8df0b48 100644 --- a/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegration_p.h +++ b/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegration_p.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 LG Electronics Ltd -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 LG Electronics Ltd +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QWAYLANDINPUTDEVICEINTEGRATION_H #define QWAYLANDINPUTDEVICEINTEGRATION_H diff --git a/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationfactory.cpp b/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationfactory.cpp index 91ed0726bcc..d53a91f059f 100644 --- a/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationfactory.cpp +++ b/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationfactory.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 LG Electronics Ltd -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 LG Electronics Ltd +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "qwaylandinputdeviceintegrationfactory_p.h" #include "qwaylandinputdeviceintegrationplugin_p.h" diff --git a/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationfactory_p.h b/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationfactory_p.h index ac4fd713a2c..087c963e186 100644 --- a/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationfactory_p.h +++ b/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationfactory_p.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 LG Electronics Ltd -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 LG Electronics Ltd +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QWAYLANDINPUTDEVICEINTEGRATIONFACTORY_H #define QWAYLANDINPUTDEVICEINTEGRATIONFACTORY_H diff --git a/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationplugin.cpp b/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationplugin.cpp index 044c2892642..424b44d3fae 100644 --- a/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationplugin.cpp +++ b/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationplugin.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 LG Electronics Ltd -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 LG Electronics Ltd +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "qwaylandinputdeviceintegrationplugin_p.h" diff --git a/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationplugin_p.h b/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationplugin_p.h index 374411a70dc..e43ce1bd10c 100644 --- a/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationplugin_p.h +++ b/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationplugin_p.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 LG Electronics Ltd -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 LG Electronics Ltd +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QWAYLANDINPUTDEVICEINTEGRATIONPLUGIN_H #define QWAYLANDINPUTDEVICEINTEGRATIONPLUGIN_H diff --git a/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp b/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp index 1a48247738c..8669405bf1c 100644 --- a/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp +++ b/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp @@ -1,42 +1,6 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Robin Burchell -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 Robin Burchell +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include #include diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/main.cpp b/src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/main.cpp index 4f5a2ae3c39..2df6fcc5821 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/main.cpp +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/main.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include #include "qwaylandbrcmeglintegration.h" diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/dmabuf-server/main.cpp b/src/plugins/platforms/wayland/plugins/hardwareintegration/dmabuf-server/main.cpp index d4955d458f1..c1c1225264d 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/dmabuf-server/main.cpp +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/dmabuf-server/main.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2018 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2018 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include #include "dmabufserverbufferintegration.h" diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/drm-egl-server/main.cpp b/src/plugins/platforms/wayland/plugins/hardwareintegration/drm-egl-server/main.cpp index 70c9e300a44..008d2ebd147 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/drm-egl-server/main.cpp +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/drm-egl-server/main.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include #include "drmeglserverbufferintegration.h" diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/libhybris-egl-server/main.cpp b/src/plugins/platforms/wayland/plugins/hardwareintegration/libhybris-egl-server/main.cpp index 417597c368d..fa36e1a1da9 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/libhybris-egl-server/main.cpp +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/libhybris-egl-server/main.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Jolla Ltd, author: -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 Jolla Ltd, author: +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include #include "libhybriseglserverbufferintegration.h" diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/shm-emulation-server/main.cpp b/src/plugins/platforms/wayland/plugins/hardwareintegration/shm-emulation-server/main.cpp index 8c3ba842053..89673e8463a 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/shm-emulation-server/main.cpp +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/shm-emulation-server/main.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2017 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include #include "shmserverbufferintegration.h" diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/vulkan-server/main.cpp b/src/plugins/platforms/wayland/plugins/hardwareintegration/vulkan-server/main.cpp index b8f64bf225e..0490707e08e 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/vulkan-server/main.cpp +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/vulkan-server/main.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2019 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2019 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include #include "vulkanserverbufferintegration.h" diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/main.cpp b/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/main.cpp index 11bf5806324..9d4fd95edd3 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/main.cpp +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/main.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include #include diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/fullscreen-shell-v1/main.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/fullscreen-shell-v1/main.cpp index dfcd997da38..70efb71b21c 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/fullscreen-shell-v1/main.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/fullscreen-shell-v1/main.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2018 Pier Luigi Fiorini -** Contact: http://www.qt-project.org/legal -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2018 Pier Luigi Fiorini +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/fullscreen-shell-v1/qwaylandfullscreenshellv1integration.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/fullscreen-shell-v1/qwaylandfullscreenshellv1integration.cpp index 418c7d3b373..ddac7d29505 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/fullscreen-shell-v1/qwaylandfullscreenshellv1integration.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/fullscreen-shell-v1/qwaylandfullscreenshellv1integration.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2018 Pier Luigi Fiorini -** Contact: http://www.qt-project.org/legal -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2018 Pier Luigi Fiorini +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "qwaylandfullscreenshellv1integration.h" #include "qwaylandfullscreenshellv1surface.h" diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/fullscreen-shell-v1/qwaylandfullscreenshellv1integration.h b/src/plugins/platforms/wayland/plugins/shellintegration/fullscreen-shell-v1/qwaylandfullscreenshellv1integration.h index 387a57f31b6..48cb80c7355 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/fullscreen-shell-v1/qwaylandfullscreenshellv1integration.h +++ b/src/plugins/platforms/wayland/plugins/shellintegration/fullscreen-shell-v1/qwaylandfullscreenshellv1integration.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2018 Pier Luigi Fiorini -** Contact: http://www.qt-project.org/legal -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2018 Pier Luigi Fiorini +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QWAYLANDFULLSCREENSHELLV1INTEGRATION_H #define QWAYLANDFULLSCREENSHELLV1INTEGRATION_H diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/fullscreen-shell-v1/qwaylandfullscreenshellv1surface.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/fullscreen-shell-v1/qwaylandfullscreenshellv1surface.cpp index 636ef08074b..8874c0bf216 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/fullscreen-shell-v1/qwaylandfullscreenshellv1surface.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/fullscreen-shell-v1/qwaylandfullscreenshellv1surface.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2018 Pier Luigi Fiorini -** Contact: http://www.qt-project.org/legal -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2018 Pier Luigi Fiorini +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/fullscreen-shell-v1/qwaylandfullscreenshellv1surface.h b/src/plugins/platforms/wayland/plugins/shellintegration/fullscreen-shell-v1/qwaylandfullscreenshellv1surface.h index 8e4baf32bb7..8affdfd66e5 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/fullscreen-shell-v1/qwaylandfullscreenshellv1surface.h +++ b/src/plugins/platforms/wayland/plugins/shellintegration/fullscreen-shell-v1/qwaylandfullscreenshellv1surface.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2018 Pier Luigi Fiorini -** Contact: http://www.qt-project.org/legal -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2018 Pier Luigi Fiorini +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QWAYLANDFULLSCREENSHELLV1SURFACE_H #define QWAYLANDFULLSCREENSHELLV1SURFACE_H diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/main.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/main.cpp index 9b033b5f33a..9d578c58b81 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/main.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/main.cpp @@ -1,42 +1,6 @@ -/**************************************************************************** -** -** Copyright (C) 2018 The Qt Company Ltd. -** Copyright (C) 2017 ITAGE Corporation, author: -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2018 The Qt Company Ltd. +// Copyright (C) 2017 ITAGE Corporation, author: +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "qwaylandwlshellintegration_p.h" diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellintegration.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellintegration.cpp index 262410f392e..f0e38a331c4 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellintegration.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellintegration.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2017 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "qwaylandwlshellintegration_p.h" #include "qwaylandwlshellsurface_p.h" diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellintegration_p.h b/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellintegration_p.h index 974382af37e..51dac4bcd27 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellintegration_p.h +++ b/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellintegration_p.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2017 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QWAYLANDWLSHELLINTEGRATION_P_H #define QWAYLANDWLSHELLINTEGRATION_P_H diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellsurface.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellsurface.cpp index 688255cab3f..4dc93cd988b 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellsurface.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellsurface.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the config.tests of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "qwaylandwlshellsurface_p.h" diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellsurface_p.h b/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellsurface_p.h index ef938a5560c..d3996f43bc1 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellsurface_p.h +++ b/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellsurface_p.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the config.tests of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QWAYLANDWLSHELLSURFACE_H #define QWAYLANDWLSHELLSURFACE_H diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/main.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/main.cpp index a9ea4bc1e02..bb40a564e5c 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/main.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/main.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2018 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2018 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "qwaylandxdgshellintegration_p.h" diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgactivationv1.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgactivationv1.cpp index f668ff700d4..e921ca46139 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgactivationv1.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgactivationv1.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2020 Aleix Pol Gonzalez -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the config.tests of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2020 Aleix Pol Gonzalez +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "qwaylandxdgactivationv1_p.h" #include diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgactivationv1_p.h b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgactivationv1_p.h index 2d461f49601..d5d18459c8a 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgactivationv1_p.h +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgactivationv1_p.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2020 Aleix Pol Gonzalez -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the config.tests of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2020 Aleix Pol Gonzalez +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QWAYLANDXDGACTIVATIONV1_P_H #define QWAYLANDXDGACTIVATIONV1_P_H diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgdecorationv1.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgdecorationv1.cpp index c6e1afabc5e..23b846439af 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgdecorationv1.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgdecorationv1.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2018 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the config.tests of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2018 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "qwaylandxdgdecorationv1_p.h" #include "qwaylandxdgshell_p.h" diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgdecorationv1_p.h b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgdecorationv1_p.h index 8a334fc80cc..8a0cc9e79a7 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgdecorationv1_p.h +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgdecorationv1_p.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2018 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the config.tests of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2018 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QWAYLANDXDGDECORATIONV1_P_H #define QWAYLANDXDGDECORATIONV1_P_H diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp index 363555a8494..3d2fc61d3da 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp @@ -1,42 +1,6 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Copyright (C) 2017 Eurogiciel, author: -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the config.tests of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2017 The Qt Company Ltd. +// Copyright (C) 2017 Eurogiciel, author: +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "qwaylandxdgshell_p.h" diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h index 22a3049251e..30366168cc0 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h @@ -1,42 +1,6 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Copyright (C) 2017 Eurogiciel, author: -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the config.tests of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2017 The Qt Company Ltd. +// Copyright (C) 2017 Eurogiciel, author: +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QWAYLANDXDGSHELL_H #define QWAYLANDXDGSHELL_H diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshellintegration.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshellintegration.cpp index 0c9a2f2b299..8d648b6285d 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshellintegration.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshellintegration.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2017 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "qwaylandxdgshellintegration_p.h" #include "qwaylandxdgdecorationv1_p.h" diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshellintegration_p.h b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshellintegration_p.h index 91a69342873..2caa3a6e873 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshellintegration_p.h +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshellintegration_p.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2017 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QWAYLANDXDGSHELLINTEGRATION_P_H #define QWAYLANDXDGSHELLINTEGRATION_P_H diff --git a/src/plugins/platforms/wayland/qtwaylandclientglobal.h b/src/plugins/platforms/wayland/qtwaylandclientglobal.h index 32a421f9f1b..0e54752947e 100644 --- a/src/plugins/platforms/wayland/qtwaylandclientglobal.h +++ b/src/plugins/platforms/wayland/qtwaylandclientglobal.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QWAYLANDCLIENTGLOBAL_H #define QWAYLANDCLIENTGLOBAL_H diff --git a/src/plugins/platforms/wayland/qtwaylandclientglobal_p.h b/src/plugins/platforms/wayland/qtwaylandclientglobal_p.h index 1a0840b6e76..f98d143d2d0 100644 --- a/src/plugins/platforms/wayland/qtwaylandclientglobal_p.h +++ b/src/plugins/platforms/wayland/qtwaylandclientglobal_p.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QWAYLANDCLIENTGLOBAL_P_H #define QWAYLANDCLIENTGLOBAL_P_H diff --git a/src/plugins/platforms/wayland/qwaylandabstractdecoration.cpp b/src/plugins/platforms/wayland/qwaylandabstractdecoration.cpp index d15a7f9fe69..699618f684b 100644 --- a/src/plugins/platforms/wayland/qwaylandabstractdecoration.cpp +++ b/src/plugins/platforms/wayland/qwaylandabstractdecoration.cpp @@ -1,42 +1,6 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Robin Burchell -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 Robin Burchell +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "qwaylandabstractdecoration_p.h" diff --git a/src/plugins/platforms/wayland/qwaylandabstractdecoration_p.h b/src/plugins/platforms/wayland/qwaylandabstractdecoration_p.h index a99ac558b4a..3334e00c10e 100644 --- a/src/plugins/platforms/wayland/qwaylandabstractdecoration_p.h +++ b/src/plugins/platforms/wayland/qwaylandabstractdecoration_p.h @@ -1,42 +1,6 @@ -/**************************************************************************** -** -** Copyright (C) 2017 Robin Burchell -** Copyright (C) 2019 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2017 Robin Burchell +// Copyright (C) 2019 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QWAYLANDABSTRACTDECORATION_H #define QWAYLANDABSTRACTDECORATION_H diff --git a/src/plugins/platforms/wayland/qwaylandbuffer.cpp b/src/plugins/platforms/wayland/qwaylandbuffer.cpp index 12df9cc4fb2..1907d586487 100644 --- a/src/plugins/platforms/wayland/qwaylandbuffer.cpp +++ b/src/plugins/platforms/wayland/qwaylandbuffer.cpp @@ -1,42 +1,6 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Copyright (C) 2017 Giulio Camuffo. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2017 The Qt Company Ltd. +// Copyright (C) 2017 Giulio Camuffo. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "qwaylandbuffer_p.h" diff --git a/src/plugins/platforms/wayland/qwaylandbuffer_p.h b/src/plugins/platforms/wayland/qwaylandbuffer_p.h index 53acbf7269d..381debc8140 100644 --- a/src/plugins/platforms/wayland/qwaylandbuffer_p.h +++ b/src/plugins/platforms/wayland/qwaylandbuffer_p.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2018 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2018 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QWAYLANDBUFFER_H #define QWAYLANDBUFFER_H diff --git a/src/plugins/platforms/wayland/qwaylandclipboard.cpp b/src/plugins/platforms/wayland/qwaylandclipboard.cpp index 81f48e05ee3..d3566244b21 100644 --- a/src/plugins/platforms/wayland/qwaylandclipboard.cpp +++ b/src/plugins/platforms/wayland/qwaylandclipboard.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "qwaylandclipboard_p.h" #include "qwaylanddisplay_p.h" diff --git a/src/plugins/platforms/wayland/qwaylandclipboard_p.h b/src/plugins/platforms/wayland/qwaylandclipboard_p.h index a8f77a1f985..655620bdad4 100644 --- a/src/plugins/platforms/wayland/qwaylandclipboard_p.h +++ b/src/plugins/platforms/wayland/qwaylandclipboard_p.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2018 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2018 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QWAYLANDCLIPBOARD_H #define QWAYLANDCLIPBOARD_H diff --git a/src/plugins/platforms/wayland/qwaylandcursor.cpp b/src/plugins/platforms/wayland/qwaylandcursor.cpp index 92cdfd65539..67a846df638 100644 --- a/src/plugins/platforms/wayland/qwaylandcursor.cpp +++ b/src/plugins/platforms/wayland/qwaylandcursor.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "qwaylandcursor_p.h" diff --git a/src/plugins/platforms/wayland/qwaylandcursor_p.h b/src/plugins/platforms/wayland/qwaylandcursor_p.h index 6b08082b81c..2334c88d902 100644 --- a/src/plugins/platforms/wayland/qwaylandcursor_p.h +++ b/src/plugins/platforms/wayland/qwaylandcursor_p.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2019 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2019 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QWAYLANDCURSOR_H #define QWAYLANDCURSOR_H diff --git a/src/plugins/platforms/wayland/qwaylanddatadevice.cpp b/src/plugins/platforms/wayland/qwaylanddatadevice.cpp index 421cf167d19..6034cd60ed8 100644 --- a/src/plugins/platforms/wayland/qwaylanddatadevice.cpp +++ b/src/plugins/platforms/wayland/qwaylanddatadevice.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Klarälvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWaylandClient module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 Klarälvdalens Datakonsult AB (KDAB). +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "qwaylanddatadevice_p.h" diff --git a/src/plugins/platforms/wayland/qwaylanddatadevice_p.h b/src/plugins/platforms/wayland/qwaylanddatadevice_p.h index 801dcc2c182..76c8965f906 100644 --- a/src/plugins/platforms/wayland/qwaylanddatadevice_p.h +++ b/src/plugins/platforms/wayland/qwaylanddatadevice_p.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Klarälvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWaylandClient module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 Klarälvdalens Datakonsult AB (KDAB). +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QWAYLANDDATADEVICE_H diff --git a/src/plugins/platforms/wayland/qwaylanddatadevicemanager.cpp b/src/plugins/platforms/wayland/qwaylanddatadevicemanager.cpp index 6dc4f77f58f..961d055ea6d 100644 --- a/src/plugins/platforms/wayland/qwaylanddatadevicemanager.cpp +++ b/src/plugins/platforms/wayland/qwaylanddatadevicemanager.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "qwaylanddatadevicemanager_p.h" diff --git a/src/plugins/platforms/wayland/qwaylanddatadevicemanager_p.h b/src/plugins/platforms/wayland/qwaylanddatadevicemanager_p.h index 3eb67e5b642..7e1cb1e456f 100644 --- a/src/plugins/platforms/wayland/qwaylanddatadevicemanager_p.h +++ b/src/plugins/platforms/wayland/qwaylanddatadevicemanager_p.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QWAYLANDDATADEVICEMANAGER_H #define QWAYLANDDATADEVICEMANAGER_H diff --git a/src/plugins/platforms/wayland/qwaylanddataoffer.cpp b/src/plugins/platforms/wayland/qwaylanddataoffer.cpp index a339ade35a2..533c0023a9f 100644 --- a/src/plugins/platforms/wayland/qwaylanddataoffer.cpp +++ b/src/plugins/platforms/wayland/qwaylanddataoffer.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "qwaylanddataoffer_p.h" #include "qwaylanddatadevicemanager_p.h" diff --git a/src/plugins/platforms/wayland/qwaylanddataoffer_p.h b/src/plugins/platforms/wayland/qwaylanddataoffer_p.h index e2f0b4684c7..1c99147d233 100644 --- a/src/plugins/platforms/wayland/qwaylanddataoffer_p.h +++ b/src/plugins/platforms/wayland/qwaylanddataoffer_p.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QWAYLANDDATAOFFER_H #define QWAYLANDDATAOFFER_H diff --git a/src/plugins/platforms/wayland/qwaylanddatasource.cpp b/src/plugins/platforms/wayland/qwaylanddatasource.cpp index 767d002c155..ef1d14d397a 100644 --- a/src/plugins/platforms/wayland/qwaylanddatasource.cpp +++ b/src/plugins/platforms/wayland/qwaylanddatasource.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "qwaylanddatasource_p.h" #include "qwaylanddataoffer_p.h" diff --git a/src/plugins/platforms/wayland/qwaylanddatasource_p.h b/src/plugins/platforms/wayland/qwaylanddatasource_p.h index 4a773e3cd46..6e5befc0eaa 100644 --- a/src/plugins/platforms/wayland/qwaylanddatasource_p.h +++ b/src/plugins/platforms/wayland/qwaylanddatasource_p.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QWAYLANDDATASOURCE_H #define QWAYLANDDATASOURCE_H diff --git a/src/plugins/platforms/wayland/qwaylanddecorationfactory.cpp b/src/plugins/platforms/wayland/qwaylanddecorationfactory.cpp index 49051d53b87..e2f1af2f12e 100644 --- a/src/plugins/platforms/wayland/qwaylanddecorationfactory.cpp +++ b/src/plugins/platforms/wayland/qwaylanddecorationfactory.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Robin Burchell -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 Robin Burchell +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "qwaylanddecorationfactory_p.h" #include "qwaylanddecorationplugin_p.h" diff --git a/src/plugins/platforms/wayland/qwaylanddecorationfactory_p.h b/src/plugins/platforms/wayland/qwaylanddecorationfactory_p.h index a71f7d35ef2..bd0998631c4 100644 --- a/src/plugins/platforms/wayland/qwaylanddecorationfactory_p.h +++ b/src/plugins/platforms/wayland/qwaylanddecorationfactory_p.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Robin Burchell -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 Robin Burchell +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QWAYLANDDECORATIONFACTORY_H #define QWAYLANDDECORATIONFACTORY_H diff --git a/src/plugins/platforms/wayland/qwaylanddecorationplugin.cpp b/src/plugins/platforms/wayland/qwaylanddecorationplugin.cpp index 2f8045d6008..f642119960e 100644 --- a/src/plugins/platforms/wayland/qwaylanddecorationplugin.cpp +++ b/src/plugins/platforms/wayland/qwaylanddecorationplugin.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Robin Burchell -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 Robin Burchell +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "qwaylanddecorationplugin_p.h" diff --git a/src/plugins/platforms/wayland/qwaylanddecorationplugin_p.h b/src/plugins/platforms/wayland/qwaylanddecorationplugin_p.h index 9d6cf2a4bb9..e09d99702d6 100644 --- a/src/plugins/platforms/wayland/qwaylanddecorationplugin_p.h +++ b/src/plugins/platforms/wayland/qwaylanddecorationplugin_p.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Robin Burchell -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 Robin Burchell +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QWAYLANDDECORATIONPLUGIN_H #define QWAYLANDDECORATIONPLUGIN_H diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index 5dff2c6a1bb..c75ede732c8 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "qwaylanddisplay_p.h" diff --git a/src/plugins/platforms/wayland/qwaylanddisplay_p.h b/src/plugins/platforms/wayland/qwaylanddisplay_p.h index c81b09ce0a1..3809de1eaaa 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay_p.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay_p.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QWAYLANDDISPLAY_H #define QWAYLANDDISPLAY_H diff --git a/src/plugins/platforms/wayland/qwaylanddnd.cpp b/src/plugins/platforms/wayland/qwaylanddnd.cpp index 7c53f5faac1..ff89069fcc1 100644 --- a/src/plugins/platforms/wayland/qwaylanddnd.cpp +++ b/src/plugins/platforms/wayland/qwaylanddnd.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "qwaylanddnd_p.h" diff --git a/src/plugins/platforms/wayland/qwaylanddnd_p.h b/src/plugins/platforms/wayland/qwaylanddnd_p.h index 4605b1a8e8d..4952c6d3d39 100644 --- a/src/plugins/platforms/wayland/qwaylanddnd_p.h +++ b/src/plugins/platforms/wayland/qwaylanddnd_p.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QWAYLANDDND_H #define QWAYLANDDND_H diff --git a/src/plugins/platforms/wayland/qwaylandextendedsurface.cpp b/src/plugins/platforms/wayland/qwaylandextendedsurface.cpp index a7836e292ec..a61612ce873 100644 --- a/src/plugins/platforms/wayland/qwaylandextendedsurface.cpp +++ b/src/plugins/platforms/wayland/qwaylandextendedsurface.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "qwaylandextendedsurface_p.h" diff --git a/src/plugins/platforms/wayland/qwaylandextendedsurface_p.h b/src/plugins/platforms/wayland/qwaylandextendedsurface_p.h index f80e79759e9..0a7c6e5adc4 100644 --- a/src/plugins/platforms/wayland/qwaylandextendedsurface_p.h +++ b/src/plugins/platforms/wayland/qwaylandextendedsurface_p.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2018 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2018 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QWAYLANDEXTENDEDSURFACE_H #define QWAYLANDEXTENDEDSURFACE_H diff --git a/src/plugins/platforms/wayland/qwaylandinputcontext.cpp b/src/plugins/platforms/wayland/qwaylandinputcontext.cpp index 4672dda1560..cb94005b3d8 100644 --- a/src/plugins/platforms/wayland/qwaylandinputcontext.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputcontext.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWaylandClient module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "qwaylandinputcontext_p.h" diff --git a/src/plugins/platforms/wayland/qwaylandinputcontext_p.h b/src/plugins/platforms/wayland/qwaylandinputcontext_p.h index f63bde20f8f..e6ce21d3414 100644 --- a/src/plugins/platforms/wayland/qwaylandinputcontext_p.h +++ b/src/plugins/platforms/wayland/qwaylandinputcontext_p.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWaylandClient module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QWAYLANDINPUTCONTEXT_H diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index 2463a0ee298..c531699a604 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "qwaylandinputdevice_p.h" diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h index b27fc09a460..b9c69ee14cd 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h +++ b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QWAYLANDINPUTDEVICE_H #define QWAYLANDINPUTDEVICE_H diff --git a/src/plugins/platforms/wayland/qwaylandinputmethodcontext.cpp b/src/plugins/platforms/wayland/qwaylandinputmethodcontext.cpp index e547739c6a2..383725d1fb9 100644 --- a/src/plugins/platforms/wayland/qwaylandinputmethodcontext.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputmethodcontext.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2020 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2020 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "qwaylandinputmethodcontext_p.h" #include "qwaylanddisplay_p.h" diff --git a/src/plugins/platforms/wayland/qwaylandinputmethodcontext_p.h b/src/plugins/platforms/wayland/qwaylandinputmethodcontext_p.h index cae6fc9b16b..85ef656018c 100644 --- a/src/plugins/platforms/wayland/qwaylandinputmethodcontext_p.h +++ b/src/plugins/platforms/wayland/qwaylandinputmethodcontext_p.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2022 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2022 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QWAYLANDINPUTMETHODCONTEXT_P_H #define QWAYLANDINPUTMETHODCONTEXT_P_H diff --git a/src/plugins/platforms/wayland/qwaylandintegration.cpp b/src/plugins/platforms/wayland/qwaylandintegration.cpp index 255aea3ee99..33d47e4ca6c 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandintegration.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the config.tests of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "qwaylandintegration_p.h" diff --git a/src/plugins/platforms/wayland/qwaylandintegration_p.h b/src/plugins/platforms/wayland/qwaylandintegration_p.h index 33b78012c42..6221e6893b3 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration_p.h +++ b/src/plugins/platforms/wayland/qwaylandintegration_p.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2019 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2019 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QPLATFORMINTEGRATION_WAYLAND_H #define QPLATFORMINTEGRATION_WAYLAND_H diff --git a/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp b/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp index f8ae07aa625..6d858348007 100644 --- a/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp +++ b/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "qwaylandnativeinterface_p.h" #include "qwaylanddisplay_p.h" diff --git a/src/plugins/platforms/wayland/qwaylandnativeinterface_p.h b/src/plugins/platforms/wayland/qwaylandnativeinterface_p.h index a070de40998..d05d7c38f02 100644 --- a/src/plugins/platforms/wayland/qwaylandnativeinterface_p.h +++ b/src/plugins/platforms/wayland/qwaylandnativeinterface_p.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2020 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2020 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QWAYLANDNATIVEINTERFACE_H #define QWAYLANDNATIVEINTERFACE_H diff --git a/src/plugins/platforms/wayland/qwaylandpointergestures.cpp b/src/plugins/platforms/wayland/qwaylandpointergestures.cpp index c22ed2eb579..df43c31e907 100644 --- a/src/plugins/platforms/wayland/qwaylandpointergestures.cpp +++ b/src/plugins/platforms/wayland/qwaylandpointergestures.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2021 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2021 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "qwaylandpointergestures_p.h" #include "qwaylanddisplay_p.h" diff --git a/src/plugins/platforms/wayland/qwaylandpointergestures_p.h b/src/plugins/platforms/wayland/qwaylandpointergestures_p.h index 8a906741a77..7e5a7e06f2a 100644 --- a/src/plugins/platforms/wayland/qwaylandpointergestures_p.h +++ b/src/plugins/platforms/wayland/qwaylandpointergestures_p.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2021 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2021 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QWAYLANDPOINTERGESTURES_P_H #define QWAYLANDPOINTERGESTURES_P_H diff --git a/src/plugins/platforms/wayland/qwaylandprimaryselectionv1.cpp b/src/plugins/platforms/wayland/qwaylandprimaryselectionv1.cpp index 7805dd7346a..1eb1fcff3e1 100644 --- a/src/plugins/platforms/wayland/qwaylandprimaryselectionv1.cpp +++ b/src/plugins/platforms/wayland/qwaylandprimaryselectionv1.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2019 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2019 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "qwaylandprimaryselectionv1_p.h" #include "qwaylandinputdevice_p.h" diff --git a/src/plugins/platforms/wayland/qwaylandprimaryselectionv1_p.h b/src/plugins/platforms/wayland/qwaylandprimaryselectionv1_p.h index 16906fd2fa7..d29cc979414 100644 --- a/src/plugins/platforms/wayland/qwaylandprimaryselectionv1_p.h +++ b/src/plugins/platforms/wayland/qwaylandprimaryselectionv1_p.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2019 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2019 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QWAYLANDPRIMARYSELECTIONV1_P_H #define QWAYLANDPRIMARYSELECTIONV1_P_H diff --git a/src/plugins/platforms/wayland/qwaylandqtkey.cpp b/src/plugins/platforms/wayland/qwaylandqtkey.cpp index 19261973853..f6bda97d8be 100644 --- a/src/plugins/platforms/wayland/qwaylandqtkey.cpp +++ b/src/plugins/platforms/wayland/qwaylandqtkey.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "qwaylandqtkey_p.h" #include "qwaylandinputdevice_p.h" diff --git a/src/plugins/platforms/wayland/qwaylandqtkey_p.h b/src/plugins/platforms/wayland/qwaylandqtkey_p.h index 1355f3f338f..223b050263e 100644 --- a/src/plugins/platforms/wayland/qwaylandqtkey_p.h +++ b/src/plugins/platforms/wayland/qwaylandqtkey_p.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2018 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2018 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QWAYLANDQTKEY_H #define QWAYLANDQTKEY_H diff --git a/src/plugins/platforms/wayland/qwaylandscreen.cpp b/src/plugins/platforms/wayland/qwaylandscreen.cpp index eba74fad3ef..57bccde3805 100644 --- a/src/plugins/platforms/wayland/qwaylandscreen.cpp +++ b/src/plugins/platforms/wayland/qwaylandscreen.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "qwaylandscreen_p.h" diff --git a/src/plugins/platforms/wayland/qwaylandscreen_p.h b/src/plugins/platforms/wayland/qwaylandscreen_p.h index 1cece249fa9..836dd0392d0 100644 --- a/src/plugins/platforms/wayland/qwaylandscreen_p.h +++ b/src/plugins/platforms/wayland/qwaylandscreen_p.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2020 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2020 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QWAYLANDSCREEN_H #define QWAYLANDSCREEN_H diff --git a/src/plugins/platforms/wayland/qwaylandshellsurface.cpp b/src/plugins/platforms/wayland/qwaylandshellsurface.cpp index 0e1617e63bf..77d6b97a9d8 100644 --- a/src/plugins/platforms/wayland/qwaylandshellsurface.cpp +++ b/src/plugins/platforms/wayland/qwaylandshellsurface.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the config.tests of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "qwaylandshellsurface_p.h" #include "qwaylandwindow_p.h" diff --git a/src/plugins/platforms/wayland/qwaylandshellsurface_p.h b/src/plugins/platforms/wayland/qwaylandshellsurface_p.h index 0cd24036d62..c133269a099 100644 --- a/src/plugins/platforms/wayland/qwaylandshellsurface_p.h +++ b/src/plugins/platforms/wayland/qwaylandshellsurface_p.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2021 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the config.tests of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2021 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QWAYLANDSHELLSURFACE_H #define QWAYLANDSHELLSURFACE_H diff --git a/src/plugins/platforms/wayland/qwaylandshm.cpp b/src/plugins/platforms/wayland/qwaylandshm.cpp index e94357bb586..7c0bc4ddb75 100644 --- a/src/plugins/platforms/wayland/qwaylandshm.cpp +++ b/src/plugins/platforms/wayland/qwaylandshm.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 LG Electronics Inc, author: -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 LG Electronics Inc, author: +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include #include diff --git a/src/plugins/platforms/wayland/qwaylandshm_p.h b/src/plugins/platforms/wayland/qwaylandshm_p.h index 45c1fedf001..eb4a90c12db 100644 --- a/src/plugins/platforms/wayland/qwaylandshm_p.h +++ b/src/plugins/platforms/wayland/qwaylandshm_p.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 LG Electronics Inc, author: -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 LG Electronics Inc, author: +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QWAYLANDSHM_H #define QWAYLANDSHM_H diff --git a/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp b/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp index 7e1e9bb93bd..a8e59637a1f 100644 --- a/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp +++ b/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "qwaylandshmbackingstore_p.h" #include "qwaylandwindow_p.h" #include "qwaylandsubsurface_p.h" diff --git a/src/plugins/platforms/wayland/qwaylandshmbackingstore_p.h b/src/plugins/platforms/wayland/qwaylandshmbackingstore_p.h index 993a394a50b..8a63b3c1423 100644 --- a/src/plugins/platforms/wayland/qwaylandshmbackingstore_p.h +++ b/src/plugins/platforms/wayland/qwaylandshmbackingstore_p.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QWAYLANDSHMBACKINGSTORE_H #define QWAYLANDSHMBACKINGSTORE_H diff --git a/src/plugins/platforms/wayland/qwaylandshmwindow.cpp b/src/plugins/platforms/wayland/qwaylandshmwindow.cpp index 9214665e47d..8fecad178bd 100644 --- a/src/plugins/platforms/wayland/qwaylandshmwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandshmwindow.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the config.tests of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "qwaylandshmwindow_p.h" diff --git a/src/plugins/platforms/wayland/qwaylandshmwindow_p.h b/src/plugins/platforms/wayland/qwaylandshmwindow_p.h index eebff94c64a..f11df5e4767 100644 --- a/src/plugins/platforms/wayland/qwaylandshmwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandshmwindow_p.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the config.tests of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QWAYLANDSHMWINDOW_H #define QWAYLANDSHMWINDOW_H diff --git a/src/plugins/platforms/wayland/qwaylandsubsurface.cpp b/src/plugins/platforms/wayland/qwaylandsubsurface.cpp index 2ff966cbc66..a0afd06ed29 100644 --- a/src/plugins/platforms/wayland/qwaylandsubsurface.cpp +++ b/src/plugins/platforms/wayland/qwaylandsubsurface.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "qwaylandsubsurface_p.h" diff --git a/src/plugins/platforms/wayland/qwaylandsubsurface_p.h b/src/plugins/platforms/wayland/qwaylandsubsurface_p.h index a6b25f90231..7600c580704 100644 --- a/src/plugins/platforms/wayland/qwaylandsubsurface_p.h +++ b/src/plugins/platforms/wayland/qwaylandsubsurface_p.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2018 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2018 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QWAYLANDSUBSURFACE_H #define QWAYLANDSUBSURFACE_H diff --git a/src/plugins/platforms/wayland/qwaylandsurface.cpp b/src/plugins/platforms/wayland/qwaylandsurface.cpp index 983cef71971..cd1a561ba98 100644 --- a/src/plugins/platforms/wayland/qwaylandsurface.cpp +++ b/src/plugins/platforms/wayland/qwaylandsurface.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2019 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the config.tests of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2019 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "qwaylandsurface_p.h" #include "qwaylanddisplay_p.h" diff --git a/src/plugins/platforms/wayland/qwaylandsurface_p.h b/src/plugins/platforms/wayland/qwaylandsurface_p.h index d8fb7305bb6..027c6ca4d4f 100644 --- a/src/plugins/platforms/wayland/qwaylandsurface_p.h +++ b/src/plugins/platforms/wayland/qwaylandsurface_p.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2019 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the config.tests of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2019 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QWAYLANDSURFACE_P_H #define QWAYLANDSURFACE_P_H diff --git a/src/plugins/platforms/wayland/qwaylandtabletv2.cpp b/src/plugins/platforms/wayland/qwaylandtabletv2.cpp index b1b37d19d6e..8a0544aeb94 100644 --- a/src/plugins/platforms/wayland/qwaylandtabletv2.cpp +++ b/src/plugins/platforms/wayland/qwaylandtabletv2.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2019 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2019 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "qwaylandtabletv2_p.h" #include "qwaylandinputdevice_p.h" diff --git a/src/plugins/platforms/wayland/qwaylandtabletv2_p.h b/src/plugins/platforms/wayland/qwaylandtabletv2_p.h index 870d236d699..7ddf02e6748 100644 --- a/src/plugins/platforms/wayland/qwaylandtabletv2_p.h +++ b/src/plugins/platforms/wayland/qwaylandtabletv2_p.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2019 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2019 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QWAYLANDTABLETV2_P_H #define QWAYLANDTABLETV2_P_H diff --git a/src/plugins/platforms/wayland/qwaylandtextinputinterface.cpp b/src/plugins/platforms/wayland/qwaylandtextinputinterface.cpp index 4334dd3e871..7943964755a 100644 --- a/src/plugins/platforms/wayland/qwaylandtextinputinterface.cpp +++ b/src/plugins/platforms/wayland/qwaylandtextinputinterface.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2021 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2021 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "qwaylandtextinputinterface_p.h" diff --git a/src/plugins/platforms/wayland/qwaylandtextinputinterface_p.h b/src/plugins/platforms/wayland/qwaylandtextinputinterface_p.h index 7825bc58c0b..6f695575fb0 100644 --- a/src/plugins/platforms/wayland/qwaylandtextinputinterface_p.h +++ b/src/plugins/platforms/wayland/qwaylandtextinputinterface_p.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2021 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2021 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QWAYLANDTEXTINPUTINTERFACE_P_H #define QWAYLANDTEXTINPUTINTERFACE_P_H diff --git a/src/plugins/platforms/wayland/qwaylandtextinputv1.cpp b/src/plugins/platforms/wayland/qwaylandtextinputv1.cpp index a2c06a5ba47..52a3a13c051 100644 --- a/src/plugins/platforms/wayland/qwaylandtextinputv1.cpp +++ b/src/plugins/platforms/wayland/qwaylandtextinputv1.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2021 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWaylandClient module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2021 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include #include "qwaylandtextinputv1_p.h" diff --git a/src/plugins/platforms/wayland/qwaylandtextinputv1_p.h b/src/plugins/platforms/wayland/qwaylandtextinputv1_p.h index 068987cd12d..dc591cdb1e1 100644 --- a/src/plugins/platforms/wayland/qwaylandtextinputv1_p.h +++ b/src/plugins/platforms/wayland/qwaylandtextinputv1_p.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2021 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWaylandClient module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2021 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QWAYLANDTEXTINPUTV1_H diff --git a/src/plugins/platforms/wayland/qwaylandtextinputv2.cpp b/src/plugins/platforms/wayland/qwaylandtextinputv2.cpp index 547ff056da7..402f5b557e4 100644 --- a/src/plugins/platforms/wayland/qwaylandtextinputv2.cpp +++ b/src/plugins/platforms/wayland/qwaylandtextinputv2.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWaylandClient module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include diff --git a/src/plugins/platforms/wayland/qwaylandtextinputv2_p.h b/src/plugins/platforms/wayland/qwaylandtextinputv2_p.h index 84dd3f37cb8..94b0408a9c6 100644 --- a/src/plugins/platforms/wayland/qwaylandtextinputv2_p.h +++ b/src/plugins/platforms/wayland/qwaylandtextinputv2_p.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWaylandClient module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QWAYLANDINPUTV2_P_H diff --git a/src/plugins/platforms/wayland/qwaylandtextinputv4.cpp b/src/plugins/platforms/wayland/qwaylandtextinputv4.cpp index 5cecaf7a48a..4b3e6eb5f2c 100644 --- a/src/plugins/platforms/wayland/qwaylandtextinputv4.cpp +++ b/src/plugins/platforms/wayland/qwaylandtextinputv4.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2021 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2021 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "qwaylandtextinputv4_p.h" diff --git a/src/plugins/platforms/wayland/qwaylandtextinputv4_p.h b/src/plugins/platforms/wayland/qwaylandtextinputv4_p.h index d273cef277f..cad6d6c32f5 100644 --- a/src/plugins/platforms/wayland/qwaylandtextinputv4_p.h +++ b/src/plugins/platforms/wayland/qwaylandtextinputv4_p.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2021 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2021 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QWAYLANDTEXTINPUTV4_P_H #define QWAYLANDTEXTINPUTV4_P_H diff --git a/src/plugins/platforms/wayland/qwaylandtouch.cpp b/src/plugins/platforms/wayland/qwaylandtouch.cpp index dea271938b5..41dfd085539 100644 --- a/src/plugins/platforms/wayland/qwaylandtouch.cpp +++ b/src/plugins/platforms/wayland/qwaylandtouch.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "qwaylandtouch_p.h" #include "qwaylandinputdevice_p.h" diff --git a/src/plugins/platforms/wayland/qwaylandtouch_p.h b/src/plugins/platforms/wayland/qwaylandtouch_p.h index b23c4c1faab..8927f4e7e10 100644 --- a/src/plugins/platforms/wayland/qwaylandtouch_p.h +++ b/src/plugins/platforms/wayland/qwaylandtouch_p.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2020 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2020 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QWAYLANDTOUCH_H #define QWAYLANDTOUCH_H diff --git a/src/plugins/platforms/wayland/qwaylandvulkaninstance.cpp b/src/plugins/platforms/wayland/qwaylandvulkaninstance.cpp index 51802257490..2f95ff3077a 100644 --- a/src/plugins/platforms/wayland/qwaylandvulkaninstance.cpp +++ b/src/plugins/platforms/wayland/qwaylandvulkaninstance.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2019 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2019 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "qwaylandvulkaninstance_p.h" #include "qwaylandwindow_p.h" diff --git a/src/plugins/platforms/wayland/qwaylandvulkaninstance_p.h b/src/plugins/platforms/wayland/qwaylandvulkaninstance_p.h index f46ba3f7569..abeca95db1c 100644 --- a/src/plugins/platforms/wayland/qwaylandvulkaninstance_p.h +++ b/src/plugins/platforms/wayland/qwaylandvulkaninstance_p.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2019 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2019 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QWAYLANDVULKANINSTANCE_P_H #define QWAYLANDVULKANINSTANCE_P_H diff --git a/src/plugins/platforms/wayland/qwaylandvulkanwindow.cpp b/src/plugins/platforms/wayland/qwaylandvulkanwindow.cpp index eb341529aeb..228bf5ced27 100644 --- a/src/plugins/platforms/wayland/qwaylandvulkanwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandvulkanwindow.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2019 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2019 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "qwaylandvulkanwindow_p.h" diff --git a/src/plugins/platforms/wayland/qwaylandvulkanwindow_p.h b/src/plugins/platforms/wayland/qwaylandvulkanwindow_p.h index 442b6769043..d71fb277ca3 100644 --- a/src/plugins/platforms/wayland/qwaylandvulkanwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandvulkanwindow_p.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2019 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2019 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QWAYLANDVULKANWINDOW_P_H #define QWAYLANDVULKANWINDOW_P_H diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 31219abc89c..888c4639970 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the config.tests of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "qwaylandwindow_p.h" diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index 5f51743d96d..e3f59a1d256 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the config.tests of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QWAYLANDWINDOW_H #define QWAYLANDWINDOW_H diff --git a/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration.cpp b/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration.cpp index 5d60624a683..b394d69b84f 100644 --- a/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "qwaylandwindowmanagerintegration_p.h" #include "qwaylandscreen_p.h" diff --git a/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration_p.h b/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration_p.h index c3c01352c34..ea57911f4e1 100644 --- a/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration_p.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QWAYLANDWINDOWMANAGERINTEGRATION_H #define QWAYLANDWINDOWMANAGERINTEGRATION_H diff --git a/src/plugins/platforms/wayland/shared/qwaylandinputmethodeventbuilder.cpp b/src/plugins/platforms/wayland/shared/qwaylandinputmethodeventbuilder.cpp index e0a3e7987dd..256a0c4230d 100644 --- a/src/plugins/platforms/wayland/shared/qwaylandinputmethodeventbuilder.cpp +++ b/src/plugins/platforms/wayland/shared/qwaylandinputmethodeventbuilder.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com -** Contact: http://www.qt-project.org/legal -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "qwaylandinputmethodeventbuilder_p.h" diff --git a/src/plugins/platforms/wayland/shared/qwaylandinputmethodeventbuilder_p.h b/src/plugins/platforms/wayland/shared/qwaylandinputmethodeventbuilder_p.h index 77d65619df8..1ccfa11a26b 100644 --- a/src/plugins/platforms/wayland/shared/qwaylandinputmethodeventbuilder_p.h +++ b/src/plugins/platforms/wayland/shared/qwaylandinputmethodeventbuilder_p.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com -** Contact: http://www.qt-project.org/legal -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QWAYLANDINPUTMETHODEVENTBUILDER_H #define QWAYLANDINPUTMETHODEVENTBUILDER_H diff --git a/src/plugins/platforms/wayland/shared/qwaylandmimehelper.cpp b/src/plugins/platforms/wayland/shared/qwaylandmimehelper.cpp index 051a91dcfb6..86d50b02a58 100644 --- a/src/plugins/platforms/wayland/shared/qwaylandmimehelper.cpp +++ b/src/plugins/platforms/wayland/shared/qwaylandmimehelper.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "qwaylandmimehelper_p.h" #include diff --git a/src/plugins/platforms/wayland/shared/qwaylandmimehelper_p.h b/src/plugins/platforms/wayland/shared/qwaylandmimehelper_p.h index 58ecbac00ab..c982a86843c 100644 --- a/src/plugins/platforms/wayland/shared/qwaylandmimehelper_p.h +++ b/src/plugins/platforms/wayland/shared/qwaylandmimehelper_p.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QWAYLANDMIMEHELPER_H #define QWAYLANDMIMEHELPER_H diff --git a/src/plugins/platforms/wayland/shared/qwaylandsharedmemoryformathelper_p.h b/src/plugins/platforms/wayland/shared/qwaylandsharedmemoryformathelper_p.h index e7cbafe579b..55bcfc41ccf 100644 --- a/src/plugins/platforms/wayland/shared/qwaylandsharedmemoryformathelper_p.h +++ b/src/plugins/platforms/wayland/shared/qwaylandsharedmemoryformathelper_p.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2020 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2020 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QWAYLANDSHAREDMEMORYFORMATHELPER_H #define QWAYLANDSHAREDMEMORYFORMATHELPER_H diff --git a/src/plugins/platforms/wayland/shellintegration/qwaylandclientshellapi_p.h b/src/plugins/platforms/wayland/shellintegration/qwaylandclientshellapi_p.h index a8863e7d3ed..653d09a2cef 100644 --- a/src/plugins/platforms/wayland/shellintegration/qwaylandclientshellapi_p.h +++ b/src/plugins/platforms/wayland/shellintegration/qwaylandclientshellapi_p.h @@ -1,31 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2021 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWaylandClient module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2021 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #ifndef QWAYLANDCLIENTSHELLAPI_P_H #define QWAYLANDCLIENTSHELLAPI_P_H diff --git a/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegration.cpp b/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegration.cpp index 5bb617034fa..c364ee2cc15 100644 --- a/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegration.cpp +++ b/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegration.cpp @@ -1,31 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2021 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWaylandClient module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2021 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include "qwaylandshellintegration_p.h" #include #include diff --git a/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegration_p.h b/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegration_p.h index 06abcb7e5e4..791a940435f 100644 --- a/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegration_p.h +++ b/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegration_p.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Jolla Ltd -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 Jolla Ltd +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QWAYLANDSHELLINTEGRATION_H #define QWAYLANDSHELLINTEGRATION_H diff --git a/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationfactory.cpp b/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationfactory.cpp index ade2b4e3c1f..c8d29e27c6e 100644 --- a/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationfactory.cpp +++ b/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationfactory.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Jolla Ltd -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 Jolla Ltd +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "qwaylandshellintegrationfactory_p.h" #include "qwaylandshellintegrationplugin_p.h" diff --git a/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationfactory_p.h b/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationfactory_p.h index dd9dd788fc2..edc0e70c77e 100644 --- a/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationfactory_p.h +++ b/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationfactory_p.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Jolla Ltd -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 Jolla Ltd +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QWAYLANDSHELLINTEGRATIONFACTORY_H #define QWAYLANDSHELLINTEGRATIONFACTORY_H diff --git a/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationplugin.cpp b/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationplugin.cpp index f0833251e88..0e233828275 100644 --- a/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationplugin.cpp +++ b/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationplugin.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Jolla Ltd -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 Jolla Ltd +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "qwaylandshellintegrationplugin_p.h" diff --git a/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationplugin_p.h b/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationplugin_p.h index 6f116085826..85339e1e7f9 100644 --- a/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationplugin_p.h +++ b/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationplugin_p.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Jolla Ltd -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 Jolla Ltd +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QWAYLANDSHELLINTEGRATIONPLUGIN_H #define QWAYLANDSHELLINTEGRATIONPLUGIN_H diff --git a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp index c3768a63490..0e9eb0e5c62 100644 --- a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp +++ b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include #include diff --git a/tests/auto/wayland/client/tst_client.cpp b/tests/auto/wayland/client/tst_client.cpp index 8ae79f347da..1c28832490a 100644 --- a/tests/auto/wayland/client/tst_client.cpp +++ b/tests/auto/wayland/client/tst_client.cpp @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #include "mockcompositor.h" diff --git a/tests/auto/wayland/clientextension/tst_clientextension.cpp b/tests/auto/wayland/clientextension/tst_clientextension.cpp index ea7ef361b8f..209afa822c5 100644 --- a/tests/auto/wayland/clientextension/tst_clientextension.cpp +++ b/tests/auto/wayland/clientextension/tst_clientextension.cpp @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2021 David Redondo -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2021 David Redondo +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #include #include diff --git a/tests/auto/wayland/datadevicev1/tst_datadevicev1.cpp b/tests/auto/wayland/datadevicev1/tst_datadevicev1.cpp index 0c5e8872817..d4dfa2da046 100644 --- a/tests/auto/wayland/datadevicev1/tst_datadevicev1.cpp +++ b/tests/auto/wayland/datadevicev1/tst_datadevicev1.cpp @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2018 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2018 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #include "mockcompositor.h" diff --git a/tests/auto/wayland/fullscreenshellv1/tst_fullscreenshellv1.cpp b/tests/auto/wayland/fullscreenshellv1/tst_fullscreenshellv1.cpp index 427287f1256..c48e5532b84 100644 --- a/tests/auto/wayland/fullscreenshellv1/tst_fullscreenshellv1.cpp +++ b/tests/auto/wayland/fullscreenshellv1/tst_fullscreenshellv1.cpp @@ -1,32 +1,7 @@ -/**************************************************************************** -** -** Copyright (C) 2021 David Edmundson -** Copyright (C) 2018 Pier Luigi Fiorini -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2021 David Edmundson +// Copyright (C) 2018 Pier Luigi Fiorini +// Copyright (C) 2017 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #include "mockcompositor.h" diff --git a/tests/auto/wayland/inputcontext/tst_inputcontext.cpp b/tests/auto/wayland/inputcontext/tst_inputcontext.cpp index e006f755379..9e3d75e0f2c 100644 --- a/tests/auto/wayland/inputcontext/tst_inputcontext.cpp +++ b/tests/auto/wayland/inputcontext/tst_inputcontext.cpp @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2019 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2019 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #include "mockcompositor.h" #include "textinput.h" diff --git a/tests/auto/wayland/multithreaded/tst_multithreaded.cpp b/tests/auto/wayland/multithreaded/tst_multithreaded.cpp index ce88a72fd53..562d9b38807 100644 --- a/tests/auto/wayland/multithreaded/tst_multithreaded.cpp +++ b/tests/auto/wayland/multithreaded/tst_multithreaded.cpp @@ -1,31 +1,6 @@ -/**************************************************************************** -** -** Copyright (C) 2018 The Qt Company Ltd. -** Copyright (C) 2020 UBports Foundataion. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2018 The Qt Company Ltd. +// Copyright (C) 2020 UBports Foundataion. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #include #include diff --git a/tests/auto/wayland/nooutput/tst_nooutput.cpp b/tests/auto/wayland/nooutput/tst_nooutput.cpp index 788c1e8d915..35b4e0e95da 100644 --- a/tests/auto/wayland/nooutput/tst_nooutput.cpp +++ b/tests/auto/wayland/nooutput/tst_nooutput.cpp @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2019 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2019 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #include "mockcompositor.h" #include diff --git a/tests/auto/wayland/output/tst_output.cpp b/tests/auto/wayland/output/tst_output.cpp index e9944f8157f..3509a777113 100644 --- a/tests/auto/wayland/output/tst_output.cpp +++ b/tests/auto/wayland/output/tst_output.cpp @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2019 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2019 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #include "mockcompositor.h" #include diff --git a/tests/auto/wayland/primaryselectionv1/tst_primaryselectionv1.cpp b/tests/auto/wayland/primaryselectionv1/tst_primaryselectionv1.cpp index 0f0c16102f1..d947d30064e 100644 --- a/tests/auto/wayland/primaryselectionv1/tst_primaryselectionv1.cpp +++ b/tests/auto/wayland/primaryselectionv1/tst_primaryselectionv1.cpp @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2018 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2018 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #include "mockcompositor.h" diff --git a/tests/auto/wayland/seat/tst_seat.cpp b/tests/auto/wayland/seat/tst_seat.cpp index b8405eb6f58..dd52789b4da 100644 --- a/tests/auto/wayland/seat/tst_seat.cpp +++ b/tests/auto/wayland/seat/tst_seat.cpp @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2018 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2018 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #include "mockcompositor.h" #include diff --git a/tests/auto/wayland/seatv4/tst_seatv4.cpp b/tests/auto/wayland/seatv4/tst_seatv4.cpp index 2f5d8f718f4..3a5a479fbd8 100644 --- a/tests/auto/wayland/seatv4/tst_seatv4.cpp +++ b/tests/auto/wayland/seatv4/tst_seatv4.cpp @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2018 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2018 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #include "mockcompositor.h" diff --git a/tests/auto/wayland/shared/corecompositor.cpp b/tests/auto/wayland/shared/corecompositor.cpp index e9984f7d627..38930c540c9 100644 --- a/tests/auto/wayland/shared/corecompositor.cpp +++ b/tests/auto/wayland/shared/corecompositor.cpp @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2018 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2018 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #include "corecompositor.h" #include diff --git a/tests/auto/wayland/shared/corecompositor.h b/tests/auto/wayland/shared/corecompositor.h index 5f847106fd0..2edb7f3fc8e 100644 --- a/tests/auto/wayland/shared/corecompositor.h +++ b/tests/auto/wayland/shared/corecompositor.h @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2018 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2018 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #ifndef MOCKCOMPOSITOR_CORECOMPOSITOR_H #define MOCKCOMPOSITOR_CORECOMPOSITOR_H diff --git a/tests/auto/wayland/shared/coreprotocol.cpp b/tests/auto/wayland/shared/coreprotocol.cpp index 1a9676b2e74..5a59938de10 100644 --- a/tests/auto/wayland/shared/coreprotocol.cpp +++ b/tests/auto/wayland/shared/coreprotocol.cpp @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2018 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2018 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #include "coreprotocol.h" #include "datadevice.h" diff --git a/tests/auto/wayland/shared/coreprotocol.h b/tests/auto/wayland/shared/coreprotocol.h index 94481b41f54..e43451cea79 100644 --- a/tests/auto/wayland/shared/coreprotocol.h +++ b/tests/auto/wayland/shared/coreprotocol.h @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2018 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2018 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #ifndef MOCKCOMPOSITOR_COREPROTOCOL_H #define MOCKCOMPOSITOR_COREPROTOCOL_H diff --git a/tests/auto/wayland/shared/datadevice.cpp b/tests/auto/wayland/shared/datadevice.cpp index 4249563506e..100f937d355 100644 --- a/tests/auto/wayland/shared/datadevice.cpp +++ b/tests/auto/wayland/shared/datadevice.cpp @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2018 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2018 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #include "datadevice.h" diff --git a/tests/auto/wayland/shared/datadevice.h b/tests/auto/wayland/shared/datadevice.h index a0d97e64622..ee1e57d655d 100644 --- a/tests/auto/wayland/shared/datadevice.h +++ b/tests/auto/wayland/shared/datadevice.h @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2018 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2018 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #ifndef MOCKCOMPOSITOR_DATADEVICE_H #define MOCKCOMPOSITOR_DATADEVICE_H diff --git a/tests/auto/wayland/shared/fullscreenshellv1.cpp b/tests/auto/wayland/shared/fullscreenshellv1.cpp index f97088d508d..105557fb5af 100644 --- a/tests/auto/wayland/shared/fullscreenshellv1.cpp +++ b/tests/auto/wayland/shared/fullscreenshellv1.cpp @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2021 David Edmundson -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2021 David Edmundson +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #include "fullscreenshellv1.h" diff --git a/tests/auto/wayland/shared/fullscreenshellv1.h b/tests/auto/wayland/shared/fullscreenshellv1.h index f5bdc8c74c4..fb0b3f8d6df 100644 --- a/tests/auto/wayland/shared/fullscreenshellv1.h +++ b/tests/auto/wayland/shared/fullscreenshellv1.h @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2021 David Edmundson -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2021 David Edmundson +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #ifndef MOCKCOMPOSITOR_FULLSCREENSHELLV1_H #define MOCKCOMPOSITOR_FULLSCREENSHELLV1_H diff --git a/tests/auto/wayland/shared/mockcompositor.cpp b/tests/auto/wayland/shared/mockcompositor.cpp index c62ddfab4a3..03d0ffb6c57 100644 --- a/tests/auto/wayland/shared/mockcompositor.cpp +++ b/tests/auto/wayland/shared/mockcompositor.cpp @@ -1,31 +1,6 @@ -/**************************************************************************** -** -** Copyright (C) 2021 David Edmundson -** Copyright (C) 2018 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2021 David Edmundson +// Copyright (C) 2018 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #include "mockcompositor.h" diff --git a/tests/auto/wayland/shared/mockcompositor.h b/tests/auto/wayland/shared/mockcompositor.h index 89074b3a542..3b70a430eaa 100644 --- a/tests/auto/wayland/shared/mockcompositor.h +++ b/tests/auto/wayland/shared/mockcompositor.h @@ -1,31 +1,6 @@ -/**************************************************************************** -** -** Copyright (C) 2021 David Edmundson -** Copyright (C) 2018 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2021 David Edmundson +// Copyright (C) 2018 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #ifndef MOCKCOMPOSITOR_H #define MOCKCOMPOSITOR_H diff --git a/tests/auto/wayland/shared/qttextinput.cpp b/tests/auto/wayland/shared/qttextinput.cpp index 5cd9a6b61b7..30cc2afd475 100644 --- a/tests/auto/wayland/shared/qttextinput.cpp +++ b/tests/auto/wayland/shared/qttextinput.cpp @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2021 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2021 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #include "qttextinput.h" diff --git a/tests/auto/wayland/shared/qttextinput.h b/tests/auto/wayland/shared/qttextinput.h index 525711cce4c..a3eb31270fe 100644 --- a/tests/auto/wayland/shared/qttextinput.h +++ b/tests/auto/wayland/shared/qttextinput.h @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2021 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2021 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #ifndef MOCKCOMPOSITOR_QTTEXTINPUT_H #define MOCKCOMPOSITOR_QTTEXTINPUT_H diff --git a/tests/auto/wayland/shared/textinput.cpp b/tests/auto/wayland/shared/textinput.cpp index f9fd287bb22..05889687c00 100644 --- a/tests/auto/wayland/shared/textinput.cpp +++ b/tests/auto/wayland/shared/textinput.cpp @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2019 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2019 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #include "textinput.h" diff --git a/tests/auto/wayland/shared/textinput.h b/tests/auto/wayland/shared/textinput.h index 85072e74beb..2aedf550b72 100644 --- a/tests/auto/wayland/shared/textinput.h +++ b/tests/auto/wayland/shared/textinput.h @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2019 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2019 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #ifndef MOCKCOMPOSITOR_TEXTINPUT_H #define MOCKCOMPOSITOR_TEXTINPUT_H diff --git a/tests/auto/wayland/shared/xdgoutputv1.cpp b/tests/auto/wayland/shared/xdgoutputv1.cpp index 2b491d2ee76..f40a2b60b4b 100644 --- a/tests/auto/wayland/shared/xdgoutputv1.cpp +++ b/tests/auto/wayland/shared/xdgoutputv1.cpp @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2020 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2020 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #include "xdgoutputv1.h" diff --git a/tests/auto/wayland/shared/xdgoutputv1.h b/tests/auto/wayland/shared/xdgoutputv1.h index 85b134500a0..164171d408b 100644 --- a/tests/auto/wayland/shared/xdgoutputv1.h +++ b/tests/auto/wayland/shared/xdgoutputv1.h @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2020 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2020 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #ifndef MOCKCOMPOSITOR_XDGOUTPUTV1_H #define MOCKCOMPOSITOR_XDGOUTPUTV1_H diff --git a/tests/auto/wayland/shared/xdgshell.cpp b/tests/auto/wayland/shared/xdgshell.cpp index 79d5ea382ab..b50f36e7d05 100644 --- a/tests/auto/wayland/shared/xdgshell.cpp +++ b/tests/auto/wayland/shared/xdgshell.cpp @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2018 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2018 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #include "xdgshell.h" diff --git a/tests/auto/wayland/shared/xdgshell.h b/tests/auto/wayland/shared/xdgshell.h index 485da9d9f10..4c1cd6cdb13 100644 --- a/tests/auto/wayland/shared/xdgshell.h +++ b/tests/auto/wayland/shared/xdgshell.h @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2018 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2018 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #ifndef MOCKCOMPOSITOR_XDGSHELL_H #define MOCKCOMPOSITOR_XDGSHELL_H diff --git a/tests/auto/wayland/surface/tst_surface.cpp b/tests/auto/wayland/surface/tst_surface.cpp index f65ff08b7af..e834508615f 100644 --- a/tests/auto/wayland/surface/tst_surface.cpp +++ b/tests/auto/wayland/surface/tst_surface.cpp @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2018 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2018 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #include "mockcompositor.h" #include diff --git a/tests/auto/wayland/tabletv2/tst_tabletv2.cpp b/tests/auto/wayland/tabletv2/tst_tabletv2.cpp index 3e68e5d1e00..2e06e6631d8 100644 --- a/tests/auto/wayland/tabletv2/tst_tabletv2.cpp +++ b/tests/auto/wayland/tabletv2/tst_tabletv2.cpp @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2019 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2019 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #include "mockcompositor.h" diff --git a/tests/auto/wayland/wl_connect/tst_wlconnect.cpp b/tests/auto/wayland/wl_connect/tst_wlconnect.cpp index 661f7ad6278..cd29eeb9968 100644 --- a/tests/auto/wayland/wl_connect/tst_wlconnect.cpp +++ b/tests/auto/wayland/wl_connect/tst_wlconnect.cpp @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2018 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2018 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #include #include diff --git a/tests/auto/wayland/xdgdecorationv1/tst_xdgdecorationv1.cpp b/tests/auto/wayland/xdgdecorationv1/tst_xdgdecorationv1.cpp index 98c0e044668..8adc9dd0e7d 100644 --- a/tests/auto/wayland/xdgdecorationv1/tst_xdgdecorationv1.cpp +++ b/tests/auto/wayland/xdgdecorationv1/tst_xdgdecorationv1.cpp @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2018 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2018 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #include "mockcompositor.h" diff --git a/tests/auto/wayland/xdgoutput/tst_xdgoutput.cpp b/tests/auto/wayland/xdgoutput/tst_xdgoutput.cpp index 0e5b2c878cb..b1dcde43e61 100644 --- a/tests/auto/wayland/xdgoutput/tst_xdgoutput.cpp +++ b/tests/auto/wayland/xdgoutput/tst_xdgoutput.cpp @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2018 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2018 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #include "xdgoutputv1.h" #include "mockcompositor.h" diff --git a/tests/auto/wayland/xdgshell/tst_xdgshell.cpp b/tests/auto/wayland/xdgshell/tst_xdgshell.cpp index b8b41d1e150..80ac3a23f33 100644 --- a/tests/auto/wayland/xdgshell/tst_xdgshell.cpp +++ b/tests/auto/wayland/xdgshell/tst_xdgshell.cpp @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2018 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2018 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #include "mockcompositor.h" #include From 64be7816a8d6630fe77c7eb4797cdeefe0c03922 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Mon, 20 Jun 2022 20:57:07 -0700 Subject: [PATCH 1085/1507] Client: fix license in two files This amends a7bb7210ac76a397b4aec8d8f32d902dc932d855. The client library is LGPL. Probably a copy & paste error. Pick-to: 6.3 6.4 Change-Id: I6d3880c7d99d4fc494c8fffd16fa869e524d5ac2 Reviewed-by: Shawn Rutledge Reviewed-by: Volker Hilsheimer --- .../wayland/shellintegration/qwaylandclientshellapi_p.h | 2 +- .../wayland/shellintegration/qwaylandshellintegration.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/wayland/shellintegration/qwaylandclientshellapi_p.h b/src/plugins/platforms/wayland/shellintegration/qwaylandclientshellapi_p.h index 653d09a2cef..984435aa932 100644 --- a/src/plugins/platforms/wayland/shellintegration/qwaylandclientshellapi_p.h +++ b/src/plugins/platforms/wayland/shellintegration/qwaylandclientshellapi_p.h @@ -1,5 +1,5 @@ // Copyright (C) 2021 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QWAYLANDCLIENTSHELLAPI_P_H #define QWAYLANDCLIENTSHELLAPI_P_H diff --git a/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegration.cpp b/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegration.cpp index c364ee2cc15..3d2f21c777a 100644 --- a/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegration.cpp +++ b/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegration.cpp @@ -1,5 +1,5 @@ // Copyright (C) 2021 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "qwaylandshellintegration_p.h" #include #include From 0d46bfd4755a223182e64cf112ab7d8abf9f2175 Mon Sep 17 00:00:00 2001 From: David Redondo Date: Wed, 8 Jun 2022 11:25:59 +0200 Subject: [PATCH 1086/1507] Keep toplevel windows in the top left corner of the screen We can't know the actual position of a window on the screen. This causes an issue when Widgets try to position a popup/menu absolutely and keep it on the screen when the screen geometry doesn't include (0,0). Instead report their positions always as the top left corner of the screen that they are on. This new behavior can be disabled for qt-shell or via an environment variable by users that rely on the old behavior. Fixes: QTBUG-85297 Change-Id: Iacb91cb03a0df87af950115760d2f41124ac06a3 Reviewed-by: Qt CI Bot Reviewed-by: David Edmundson Reviewed-by: Aleix Pol Gonzalez --- .../platforms/wayland/qwaylandintegration.cpp | 3 +++ src/plugins/platforms/wayland/qwaylandwindow.cpp | 14 +++++++++++++- src/plugins/platforms/wayland/qwaylandwindow_p.h | 3 +++ 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandintegration.cpp b/src/plugins/platforms/wayland/qwaylandintegration.cpp index 33d47e4ca6c..a874c55a3ca 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandintegration.cpp @@ -86,6 +86,9 @@ QWaylandIntegration::QWaylandIntegration() return; } + QWaylandWindow::fixedToplevelPositions = + !qEnvironmentVariableIsSet("QT_WAYLAND_DISABLE_FIXED_POSITIONS"); + // ### Not ideal... // We don't want to use QPlatformWindow::requestActivate here, since that gives a warning // for most shells. Also, we don't want to put this into the specific shells that can use diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 888c4639970..85266422d42 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -328,8 +328,13 @@ void QWaylandWindow::setGeometry_helper(const QRect &rect) } } -void QWaylandWindow::setGeometry(const QRect &rect) +void QWaylandWindow::setGeometry(const QRect &r) { + auto rect = r; + if (fixedToplevelPositions && !QPlatformWindow::parent() && window()->type() != Qt::Popup + && window()->type() != Qt::ToolTip) { + rect.moveTo(screen()->geometry().topLeft()); + } setGeometry_helper(rect); if (window()->isVisible() && rect.isValid()) { @@ -1210,6 +1215,13 @@ void QWaylandWindow::handleScreensChanged() QWindowSystemInterface::handleWindowScreenChanged(window(), newScreen->QPlatformScreen::screen()); mLastReportedScreen = newScreen; + if (fixedToplevelPositions && !QPlatformWindow::parent() && window()->type() != Qt::Popup + && window()->type() != Qt::ToolTip + && geometry().topLeft() != newScreen->geometry().topLeft()) { + auto geometry = this->geometry(); + geometry.moveTo(newScreen->geometry().topLeft()); + setGeometry(geometry); + } int scale = newScreen->isPlaceholder() ? 1 : static_cast(newScreen)->scale(); if (scale != mScale) { diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index e3f59a1d256..66d5bdade88 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -76,6 +76,9 @@ public: QWaylandWindow(QWindow *window, QWaylandDisplay *display); ~QWaylandWindow() override; + // Keep Toplevels position on the top left corner of their screen + static inline bool fixedToplevelPositions = true; + virtual WindowType windowType() const = 0; virtual void ensureSize(); WId winId() const override; From 495fd5153171c937754d1cffc3d8cd208eb02686 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Tue, 28 Jun 2022 08:02:36 +0200 Subject: [PATCH 1087/1507] Remove unused variables They appear to have been around and unused forever, but I've started getting warnings (-are-errors) about this. Pick-to: 6.4 6.3 6.2 5.15 Change-Id: I2f3006aa47de24927d7edd2d7f43cff78f965f87 Reviewed-by: David Edmundson --- src/plugins/platforms/wayland/qwaylanddatasource_p.h | 1 - src/plugins/platforms/wayland/qwaylandprimaryselectionv1_p.h | 1 - 2 files changed, 2 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylanddatasource_p.h b/src/plugins/platforms/wayland/qwaylanddatasource_p.h index 6e5befc0eaa..0ce09a409ca 100644 --- a/src/plugins/platforms/wayland/qwaylanddatasource_p.h +++ b/src/plugins/platforms/wayland/qwaylanddatasource_p.h @@ -56,7 +56,6 @@ protected: void data_source_action(uint32_t action) override; private: - QWaylandDisplay *m_display = nullptr; QMimeData *m_mime_data = nullptr; bool m_accepted = false; Qt::DropAction m_dropAction = Qt::IgnoreAction; diff --git a/src/plugins/platforms/wayland/qwaylandprimaryselectionv1_p.h b/src/plugins/platforms/wayland/qwaylandprimaryselectionv1_p.h index d29cc979414..59bb62116a9 100644 --- a/src/plugins/platforms/wayland/qwaylandprimaryselectionv1_p.h +++ b/src/plugins/platforms/wayland/qwaylandprimaryselectionv1_p.h @@ -77,7 +77,6 @@ protected: void zwp_primary_selection_source_v1_cancelled() override { emit cancelled(); } private: - QWaylandDisplay *m_display = nullptr; QMimeData *m_mimeData = nullptr; }; From 79cc2f159c6211dbdb1aebd326b58d82e452b53c Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Thu, 30 Jun 2022 08:07:44 +0200 Subject: [PATCH 1088/1507] client: Respect initial size when only one component is set We would ignore the initial size of the window if only either the width or height were set and the other was left at 0. Instead of using isEmpty() for checking if the geometry is valid, we check the width and height individually. Pick-to: 6.4 Task-number: QTBUG-66818 Change-Id: Ib2a22443fd6b88175599da08651fa72c921ea485 Reviewed-by: David Edmundson --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 85266422d42..a740559b774 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -154,10 +154,13 @@ void QWaylandWindow::initWindow() setWindowFlags(window()->flags()); QRect geometry = windowGeometry(); - if (geometry.isEmpty()) - setGeometry_helper(defaultGeometry()); - else - setGeometry_helper(geometry); + QRect defaultGeometry = this->defaultGeometry(); + if (geometry.width() <= 0) + geometry.setWidth(defaultGeometry.width()); + if (geometry.height() <= 0) + geometry.setHeight(defaultGeometry.height()); + + setGeometry_helper(geometry); setMask(window()->mask()); if (mShellSurface) mShellSurface->requestWindowStates(window()->windowStates()); From 425893491d4872c5fc17a7c79c12ffe66cc5375b Mon Sep 17 00:00:00 2001 From: JiDe Zhang Date: Mon, 4 Jul 2022 17:05:36 +0800 Subject: [PATCH 1089/1507] Fix some build warnings Pick-to: 6.2 6.3 6.4 Change-Id: I61edd5ab0f4383930ad37916e4cec4ab714274d4 Reviewed-by: David Edmundson --- tests/auto/wayland/tabletv2/tst_tabletv2.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/auto/wayland/tabletv2/tst_tabletv2.cpp b/tests/auto/wayland/tabletv2/tst_tabletv2.cpp index 2e06e6631d8..b4d0162890b 100644 --- a/tests/auto/wayland/tabletv2/tst_tabletv2.cpp +++ b/tests/auto/wayland/tabletv2/tst_tabletv2.cpp @@ -191,7 +191,7 @@ public: QList m_padsWaitingForDestroy; protected: - void zwp_tablet_seat_v2_bind_resource(Resource *resource) + void zwp_tablet_seat_v2_bind_resource(Resource *resource) override { for (auto *tablet : m_tablets) sendTabletAdded(resource, tablet); @@ -701,12 +701,12 @@ void tst_tabletv2::pointerType() void tst_tabletv2::hardwareSerial() { ProximityFilter filter; - const qint64 uid = 0xbaba15dead15f00d; + const QPointingDeviceUniqueId uid = QPointingDeviceUniqueId::fromNumericId(0xbaba15dead15f00d); QCOMPOSITOR_TRY_VERIFY(tabletSeat()); exec([&] { tabletSeat()->addTablet(); - tabletSeat()->addTool(ToolType::type_pen, uid); + tabletSeat()->addTool(ToolType::type_pen, uid.numericId()); }); TabletWindow window; @@ -726,11 +726,11 @@ void tst_tabletv2::hardwareSerial() QTRY_COMPARE(filter.numEvents(), 1); QTabletEvent *event = filter.popEvent(); - QCOMPARE(event->uniqueId(), uid); + QCOMPARE(event->pointingDevice()->uniqueId(), uid); QTRY_VERIFY(window.numEvents()); event = window.popEvent(); - QCOMPARE(event->uniqueId(), uid); + QCOMPARE(event->pointingDevice()->uniqueId(), uid); exec([&] { tabletTool()->sendProximityOut(); @@ -739,7 +739,7 @@ void tst_tabletv2::hardwareSerial() QTRY_VERIFY(filter.numEvents()); event = filter.popEvent(); - QCOMPARE(event->uniqueId(), uid); + QCOMPARE(event->pointingDevice()->uniqueId(), uid); } // As defined in linux/input-event-codes.h From 2720ecf2eeb4c17313ba6ade84bb91e8eae4e48e Mon Sep 17 00:00:00 2001 From: JiDe Zhang Date: Sat, 2 Jul 2022 13:08:21 +0800 Subject: [PATCH 1090/1507] Use QColor::fromString instead of some deprecated functions It's a follow-up of a series changes from 78b6876974d2cea087cb229257097052dad5fcf7 in qtbase. Pick-to: 6.4 Change-Id: I4ad19b07489630a4648b5d6ca4a8c074ed88827b Reviewed-by: Liang Qi --- src/plugins/platforms/wayland/qwaylandinputmethodcontext.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandinputmethodcontext.cpp b/src/plugins/platforms/wayland/qwaylandinputmethodcontext.cpp index 383725d1fb9..85cd427146b 100644 --- a/src/plugins/platforms/wayland/qwaylandinputmethodcontext.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputmethodcontext.cpp @@ -110,7 +110,7 @@ void QWaylandTextInputMethod::text_input_method_v1_input_method_event_attribute( attributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::AttributeType(type), startMapped, length)); break; case QInputMethodEvent::Cursor: - attributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::AttributeType(type), start, length, QColor(value))); + attributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::AttributeType(type), start, length, QColor::fromString(value))); break; case QInputMethodEvent::TextFormat: { From c1187f4daaf2a033ddf94c80204858e70f73e35f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucie=20G=C3=A9rard?= Date: Tue, 5 Jul 2022 15:09:48 +0200 Subject: [PATCH 1091/1507] Add license headers to cmake files MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit CMakeLists.txt and .cmake files of significant size (more than 2 lines according to our check in tst_license.pl) now have the copyright and license header. Existing copyright statements remain intact Task-number: QTBUG-88621 Change-Id: Ib014757184540728f40df71cd580f01e85fbbb56 Reviewed-by: Jörg Bornemann --- src/platformsupport/wayland/CMakeLists.txt | 3 +++ src/platformsupport/wayland/configure.cmake | 3 +++ src/plugins/platforms/wayland/CMakeLists.txt | 3 +++ src/plugins/platforms/wayland/configure.cmake | 3 +++ src/plugins/platforms/wayland/plugins/CMakeLists.txt | 3 +++ .../platforms/wayland/plugins/decorations/CMakeLists.txt | 3 +++ .../wayland/plugins/decorations/bradient/CMakeLists.txt | 3 +++ .../wayland/plugins/hardwareintegration/CMakeLists.txt | 3 +++ .../plugins/hardwareintegration/brcm-egl/CMakeLists.txt | 3 +++ .../plugins/hardwareintegration/dmabuf-server/CMakeLists.txt | 3 +++ .../plugins/hardwareintegration/drm-egl-server/CMakeLists.txt | 3 +++ .../hardwareintegration/libhybris-egl-server/CMakeLists.txt | 3 +++ .../hardwareintegration/shm-emulation-server/CMakeLists.txt | 3 +++ .../plugins/hardwareintegration/vulkan-server/CMakeLists.txt | 3 +++ .../plugins/hardwareintegration/wayland-egl/CMakeLists.txt | 3 +++ .../platforms/wayland/plugins/shellintegration/CMakeLists.txt | 3 +++ .../shellintegration/fullscreen-shell-v1/CMakeLists.txt | 3 +++ .../wayland/plugins/shellintegration/wl-shell/CMakeLists.txt | 3 +++ .../wayland/plugins/shellintegration/xdg-shell/CMakeLists.txt | 3 +++ src/tools/qtwaylandscanner/CMakeLists.txt | 3 +++ src/tools/qtwaylandscanner/Qt6WaylandClientMacros.cmake | 3 +++ src/tools/qtwaylandscanner/Qt6WaylandCompositorMacros.cmake | 3 +++ tests/auto/cmake/test_waylandclient/CMakeLists.txt | 3 +++ tests/auto/wayland/CMakeLists.txt | 3 +++ tests/auto/wayland/client/CMakeLists.txt | 3 +++ tests/auto/wayland/clientextension/CMakeLists.txt | 3 +++ tests/auto/wayland/datadevicev1/CMakeLists.txt | 3 +++ tests/auto/wayland/fullscreenshellv1/CMakeLists.txt | 3 +++ tests/auto/wayland/inputcontext/CMakeLists.txt | 3 +++ tests/auto/wayland/multithreaded/CMakeLists.txt | 3 +++ tests/auto/wayland/nooutput/CMakeLists.txt | 3 +++ tests/auto/wayland/output/CMakeLists.txt | 3 +++ tests/auto/wayland/primaryselectionv1/CMakeLists.txt | 3 +++ tests/auto/wayland/seat/CMakeLists.txt | 3 +++ tests/auto/wayland/seatv4/CMakeLists.txt | 3 +++ tests/auto/wayland/shared/CMakeLists.txt | 3 +++ tests/auto/wayland/surface/CMakeLists.txt | 3 +++ tests/auto/wayland/tabletv2/CMakeLists.txt | 3 +++ tests/auto/wayland/wl_connect/CMakeLists.txt | 3 +++ tests/auto/wayland/xdgdecorationv1/CMakeLists.txt | 3 +++ tests/auto/wayland/xdgoutput/CMakeLists.txt | 3 +++ tests/auto/wayland/xdgshell/CMakeLists.txt | 3 +++ 42 files changed, 126 insertions(+) diff --git a/src/platformsupport/wayland/CMakeLists.txt b/src/platformsupport/wayland/CMakeLists.txt index 6787e9cbceb..8acff45b680 100644 --- a/src/platformsupport/wayland/CMakeLists.txt +++ b/src/platformsupport/wayland/CMakeLists.txt @@ -1,3 +1,6 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 + # Generated from src.pro. # special case begin qt_find_package(WaylandScanner PROVIDED_TARGETS Wayland::Scanner) diff --git a/src/platformsupport/wayland/configure.cmake b/src/platformsupport/wayland/configure.cmake index 3fd7f93e08b..5dcf03b620a 100644 --- a/src/platformsupport/wayland/configure.cmake +++ b/src/platformsupport/wayland/configure.cmake @@ -1,3 +1,6 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 + # configure.cmake for the QtWaylandGlobalPrivate module #### Inputs diff --git a/src/plugins/platforms/wayland/CMakeLists.txt b/src/plugins/platforms/wayland/CMakeLists.txt index be6065c1449..0ac1584d3dc 100644 --- a/src/plugins/platforms/wayland/CMakeLists.txt +++ b/src/plugins/platforms/wayland/CMakeLists.txt @@ -1,3 +1,6 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 + # Generated from client.pro. ##################################################################### diff --git a/src/plugins/platforms/wayland/configure.cmake b/src/plugins/platforms/wayland/configure.cmake index a8184fc1c38..216006927d7 100644 --- a/src/plugins/platforms/wayland/configure.cmake +++ b/src/plugins/platforms/wayland/configure.cmake @@ -1,3 +1,6 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 + #### Inputs diff --git a/src/plugins/platforms/wayland/plugins/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/CMakeLists.txt index ef58376aede..a76cebd5393 100644 --- a/src/plugins/platforms/wayland/plugins/CMakeLists.txt +++ b/src/plugins/platforms/wayland/plugins/CMakeLists.txt @@ -1,3 +1,6 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 + # Generated from plugins.pro. add_subdirectory(hardwareintegration) diff --git a/src/plugins/platforms/wayland/plugins/decorations/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/decorations/CMakeLists.txt index fd7fbeb2034..5e8252844bf 100644 --- a/src/plugins/platforms/wayland/plugins/decorations/CMakeLists.txt +++ b/src/plugins/platforms/wayland/plugins/decorations/CMakeLists.txt @@ -1,3 +1,6 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 + # Generated from decorations.pro. add_subdirectory(bradient) diff --git a/src/plugins/platforms/wayland/plugins/decorations/bradient/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/decorations/bradient/CMakeLists.txt index 6f36d506c71..0797705ea45 100644 --- a/src/plugins/platforms/wayland/plugins/decorations/bradient/CMakeLists.txt +++ b/src/plugins/platforms/wayland/plugins/decorations/bradient/CMakeLists.txt @@ -1,3 +1,6 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 + # Generated from bradient.pro. ##################################################################### diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/hardwareintegration/CMakeLists.txt index e86b6460d1f..504a8bd08e9 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/CMakeLists.txt +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/CMakeLists.txt @@ -1,3 +1,6 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 + # Generated from client.pro. if(QT_FEATURE_wayland_egl) diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/CMakeLists.txt index b1304c7f7d8..acc61c3d45a 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/CMakeLists.txt +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/CMakeLists.txt @@ -1,3 +1,6 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 + # Generated from brcm-egl.pro. ##################################################################### diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/dmabuf-server/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/hardwareintegration/dmabuf-server/CMakeLists.txt index 9104dbc75e7..b77cb8acd6c 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/dmabuf-server/CMakeLists.txt +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/dmabuf-server/CMakeLists.txt @@ -1,3 +1,6 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 + # Generated from dmabuf-server.pro. ##################################################################### diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/drm-egl-server/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/hardwareintegration/drm-egl-server/CMakeLists.txt index 1c91dd74b75..0a744b37fd9 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/drm-egl-server/CMakeLists.txt +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/drm-egl-server/CMakeLists.txt @@ -1,3 +1,6 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 + # Generated from drm-egl-server.pro. ##################################################################### diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/libhybris-egl-server/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/hardwareintegration/libhybris-egl-server/CMakeLists.txt index 32c6f6d7ee2..c4bb350043b 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/libhybris-egl-server/CMakeLists.txt +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/libhybris-egl-server/CMakeLists.txt @@ -1,3 +1,6 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 + # Generated from libhybris-egl-server.pro. ##################################################################### diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/shm-emulation-server/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/hardwareintegration/shm-emulation-server/CMakeLists.txt index 679039e132f..5c5ca784eee 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/shm-emulation-server/CMakeLists.txt +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/shm-emulation-server/CMakeLists.txt @@ -1,3 +1,6 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 + # Generated from shm-emulation-server.pro. ##################################################################### diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/vulkan-server/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/hardwareintegration/vulkan-server/CMakeLists.txt index c6beea9b2a5..25faabd7a45 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/vulkan-server/CMakeLists.txt +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/vulkan-server/CMakeLists.txt @@ -1,3 +1,6 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 + # Generated from vulkan-server.pro. ##################################################################### diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/CMakeLists.txt index 39f05ca12f3..81bca4ea48a 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/CMakeLists.txt +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/CMakeLists.txt @@ -1,3 +1,6 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 + # Generated from wayland-egl.pro. ##################################################################### diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/shellintegration/CMakeLists.txt index eefa0227d4a..7a32cee8f36 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/CMakeLists.txt +++ b/src/plugins/platforms/wayland/plugins/shellintegration/CMakeLists.txt @@ -1,3 +1,6 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 + # Generated from shellintegration.pro. if(QT_FEATURE_wayland_client_fullscreen_shell_v1) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/fullscreen-shell-v1/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/shellintegration/fullscreen-shell-v1/CMakeLists.txt index ee02e1ebf67..a127c90782b 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/fullscreen-shell-v1/CMakeLists.txt +++ b/src/plugins/platforms/wayland/plugins/shellintegration/fullscreen-shell-v1/CMakeLists.txt @@ -1,3 +1,6 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 + # Generated from fullscreen-shell-v1.pro. ##################################################################### diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/CMakeLists.txt index 6b9ff55fe6b..64d69c57867 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/CMakeLists.txt +++ b/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/CMakeLists.txt @@ -1,3 +1,6 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 + # Generated from wl-shell.pro. ##################################################################### diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/CMakeLists.txt index f840e293b63..1ae0d5ff9af 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/CMakeLists.txt +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/CMakeLists.txt @@ -1,3 +1,6 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 + # Generated from xdg-shell.pro. ##################################################################### diff --git a/src/tools/qtwaylandscanner/CMakeLists.txt b/src/tools/qtwaylandscanner/CMakeLists.txt index 20a570bd6cc..1882145095e 100644 --- a/src/tools/qtwaylandscanner/CMakeLists.txt +++ b/src/tools/qtwaylandscanner/CMakeLists.txt @@ -1,3 +1,6 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 + # Generated from qtwaylandscanner.pro. ##################################################################### diff --git a/src/tools/qtwaylandscanner/Qt6WaylandClientMacros.cmake b/src/tools/qtwaylandscanner/Qt6WaylandClientMacros.cmake index 1f2dd272d66..1bb47200095 100644 --- a/src/tools/qtwaylandscanner/Qt6WaylandClientMacros.cmake +++ b/src/tools/qtwaylandscanner/Qt6WaylandClientMacros.cmake @@ -1,3 +1,6 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 + function(qt6_generate_wayland_protocol_client_sources target) cmake_parse_arguments(arg "" "__QT_INTERNAL_WAYLAND_INCLUDE_DIR" "FILES" ${ARGN}) if(DEFINED arg_UNPARSED_ARGUMENTS) diff --git a/src/tools/qtwaylandscanner/Qt6WaylandCompositorMacros.cmake b/src/tools/qtwaylandscanner/Qt6WaylandCompositorMacros.cmake index 91d0d283012..d6d44c1c4bf 100644 --- a/src/tools/qtwaylandscanner/Qt6WaylandCompositorMacros.cmake +++ b/src/tools/qtwaylandscanner/Qt6WaylandCompositorMacros.cmake @@ -1,3 +1,6 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 + function(qt6_generate_wayland_protocol_server_sources target) cmake_parse_arguments(arg "" "__QT_INTERNAL_WAYLAND_INCLUDE_DIR" "FILES" ${ARGN}) if(DEFINED arg_UNPARSED_ARGUMENTS) diff --git a/tests/auto/cmake/test_waylandclient/CMakeLists.txt b/tests/auto/cmake/test_waylandclient/CMakeLists.txt index d3dacc0f5bd..785f9e17d5f 100644 --- a/tests/auto/cmake/test_waylandclient/CMakeLists.txt +++ b/tests/auto/cmake/test_waylandclient/CMakeLists.txt @@ -1,3 +1,6 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 + project(test_plugins) cmake_minimum_required(VERSION 3.16) diff --git a/tests/auto/wayland/CMakeLists.txt b/tests/auto/wayland/CMakeLists.txt index e187d1daf07..d23d58a5181 100644 --- a/tests/auto/wayland/CMakeLists.txt +++ b/tests/auto/wayland/CMakeLists.txt @@ -1,3 +1,6 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 + # Generated from client.pro. add_subdirectory(shared) diff --git a/tests/auto/wayland/client/CMakeLists.txt b/tests/auto/wayland/client/CMakeLists.txt index 9373b982668..49573e35a68 100644 --- a/tests/auto/wayland/client/CMakeLists.txt +++ b/tests/auto/wayland/client/CMakeLists.txt @@ -1,3 +1,6 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 + # Generated from client.pro. ##################################################################### diff --git a/tests/auto/wayland/clientextension/CMakeLists.txt b/tests/auto/wayland/clientextension/CMakeLists.txt index efcd575d29f..15739a5fd89 100644 --- a/tests/auto/wayland/clientextension/CMakeLists.txt +++ b/tests/auto/wayland/clientextension/CMakeLists.txt @@ -1,3 +1,6 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 + qt_internal_add_test(tst_clientextension SOURCES tst_clientextension.cpp diff --git a/tests/auto/wayland/datadevicev1/CMakeLists.txt b/tests/auto/wayland/datadevicev1/CMakeLists.txt index 9f87eb99641..02495d19525 100644 --- a/tests/auto/wayland/datadevicev1/CMakeLists.txt +++ b/tests/auto/wayland/datadevicev1/CMakeLists.txt @@ -1,3 +1,6 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 + # Generated from datadevicev1.pro. ##################################################################### diff --git a/tests/auto/wayland/fullscreenshellv1/CMakeLists.txt b/tests/auto/wayland/fullscreenshellv1/CMakeLists.txt index 4c9a9940613..8b889324a23 100644 --- a/tests/auto/wayland/fullscreenshellv1/CMakeLists.txt +++ b/tests/auto/wayland/fullscreenshellv1/CMakeLists.txt @@ -1,3 +1,6 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 + # Generated from fullscreenshellv1.pro. ##################################################################### diff --git a/tests/auto/wayland/inputcontext/CMakeLists.txt b/tests/auto/wayland/inputcontext/CMakeLists.txt index 06ea08e019e..2acdee2676e 100644 --- a/tests/auto/wayland/inputcontext/CMakeLists.txt +++ b/tests/auto/wayland/inputcontext/CMakeLists.txt @@ -1,3 +1,6 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 + # Generated from inputcontext.pro. ##################################################################### diff --git a/tests/auto/wayland/multithreaded/CMakeLists.txt b/tests/auto/wayland/multithreaded/CMakeLists.txt index 49d93297f5b..95130c03dab 100644 --- a/tests/auto/wayland/multithreaded/CMakeLists.txt +++ b/tests/auto/wayland/multithreaded/CMakeLists.txt @@ -1,3 +1,6 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 + # Generated from multithreaded.pro. ##################################################################### diff --git a/tests/auto/wayland/nooutput/CMakeLists.txt b/tests/auto/wayland/nooutput/CMakeLists.txt index ab9dd3a6d22..c6b3712a723 100644 --- a/tests/auto/wayland/nooutput/CMakeLists.txt +++ b/tests/auto/wayland/nooutput/CMakeLists.txt @@ -1,3 +1,6 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 + # Generated from nooutput.pro. ##################################################################### diff --git a/tests/auto/wayland/output/CMakeLists.txt b/tests/auto/wayland/output/CMakeLists.txt index 45b6be4fb67..f22ed32073d 100644 --- a/tests/auto/wayland/output/CMakeLists.txt +++ b/tests/auto/wayland/output/CMakeLists.txt @@ -1,3 +1,6 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 + # Generated from output.pro. ##################################################################### diff --git a/tests/auto/wayland/primaryselectionv1/CMakeLists.txt b/tests/auto/wayland/primaryselectionv1/CMakeLists.txt index c95a7fb1875..b0947c0e239 100644 --- a/tests/auto/wayland/primaryselectionv1/CMakeLists.txt +++ b/tests/auto/wayland/primaryselectionv1/CMakeLists.txt @@ -1,3 +1,6 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 + # Generated from primaryselectionv1.pro. ##################################################################### diff --git a/tests/auto/wayland/seat/CMakeLists.txt b/tests/auto/wayland/seat/CMakeLists.txt index fe59acee068..e3d809f4a26 100644 --- a/tests/auto/wayland/seat/CMakeLists.txt +++ b/tests/auto/wayland/seat/CMakeLists.txt @@ -1,3 +1,6 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 + # Generated from seatv5.pro. ##################################################################### diff --git a/tests/auto/wayland/seatv4/CMakeLists.txt b/tests/auto/wayland/seatv4/CMakeLists.txt index 31ea86b7ee1..8838ea0027e 100644 --- a/tests/auto/wayland/seatv4/CMakeLists.txt +++ b/tests/auto/wayland/seatv4/CMakeLists.txt @@ -1,3 +1,6 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 + # Generated from seatv4.pro. ##################################################################### diff --git a/tests/auto/wayland/shared/CMakeLists.txt b/tests/auto/wayland/shared/CMakeLists.txt index b028dff162c..458b4f5e486 100644 --- a/tests/auto/wayland/shared/CMakeLists.txt +++ b/tests/auto/wayland/shared/CMakeLists.txt @@ -1,3 +1,6 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 + ##################################################################### ##Client test shared components: ##################################################################### diff --git a/tests/auto/wayland/surface/CMakeLists.txt b/tests/auto/wayland/surface/CMakeLists.txt index 93cfb2fb0d2..066ac12bb31 100644 --- a/tests/auto/wayland/surface/CMakeLists.txt +++ b/tests/auto/wayland/surface/CMakeLists.txt @@ -1,3 +1,6 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 + # Generated from surface.pro. ##################################################################### diff --git a/tests/auto/wayland/tabletv2/CMakeLists.txt b/tests/auto/wayland/tabletv2/CMakeLists.txt index 5334b7a1e13..7a07735cf1e 100644 --- a/tests/auto/wayland/tabletv2/CMakeLists.txt +++ b/tests/auto/wayland/tabletv2/CMakeLists.txt @@ -1,3 +1,6 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 + # Generated from tabletv2.pro. ##################################################################### diff --git a/tests/auto/wayland/wl_connect/CMakeLists.txt b/tests/auto/wayland/wl_connect/CMakeLists.txt index 0c7140ac652..b18a30e0dd0 100644 --- a/tests/auto/wayland/wl_connect/CMakeLists.txt +++ b/tests/auto/wayland/wl_connect/CMakeLists.txt @@ -1,3 +1,6 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 + # Generated from wl_connect.pro. ##################################################################### diff --git a/tests/auto/wayland/xdgdecorationv1/CMakeLists.txt b/tests/auto/wayland/xdgdecorationv1/CMakeLists.txt index 1fe7bc44d2d..5f5e624c937 100644 --- a/tests/auto/wayland/xdgdecorationv1/CMakeLists.txt +++ b/tests/auto/wayland/xdgdecorationv1/CMakeLists.txt @@ -1,3 +1,6 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 + # Generated from xdgdecorationv1.pro. ##################################################################### diff --git a/tests/auto/wayland/xdgoutput/CMakeLists.txt b/tests/auto/wayland/xdgoutput/CMakeLists.txt index baaf226b7a4..70eb597b2b0 100644 --- a/tests/auto/wayland/xdgoutput/CMakeLists.txt +++ b/tests/auto/wayland/xdgoutput/CMakeLists.txt @@ -1,3 +1,6 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 + # Generated from xdgoutput.pro. ##################################################################### diff --git a/tests/auto/wayland/xdgshell/CMakeLists.txt b/tests/auto/wayland/xdgshell/CMakeLists.txt index ea34539d3f0..7270d88471b 100644 --- a/tests/auto/wayland/xdgshell/CMakeLists.txt +++ b/tests/auto/wayland/xdgshell/CMakeLists.txt @@ -1,3 +1,6 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 + # Generated from xdgshell.pro. ##################################################################### From b5160ae1182aa0a76f02c7ff836fb51d2c45d097 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Wed, 22 Jun 2022 19:02:59 +0400 Subject: [PATCH 1092/1507] Client: get activation token automatically whenever possible This allows the application to change focus between its own windows without any code change whenever possbile I.e. if application already has a focused window or the token is specified in XDG_ACTIVATION_TOKEN environment variable Pick-to: 6.4 6.3 Change-Id: I6f54d12197ac0c10bfda2a517aa11bc291e3b471 Reviewed-by: Qt CI Bot Reviewed-by: Aleix Pol Gonzalez --- .../xdg-shell/qwaylandxdgshell.cpp | 26 +++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp index 3d2fc61d3da..e227971ba95 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp @@ -10,6 +10,7 @@ #include #include +#include #include QT_BEGIN_NAMESPACE @@ -477,8 +478,29 @@ void QWaylandXdgSurface::xdg_surface_configure(uint32_t serial) bool QWaylandXdgSurface::requestActivate() { if (auto *activation = m_shell->activation()) { - activation->activate(m_activationToken, window()->wlSurface()); - return true; + if (!m_activationToken.isEmpty()) { + activation->activate(m_activationToken, window()->wlSurface()); + m_activationToken = {}; + return true; + } else if (const auto token = qEnvironmentVariable("XDG_ACTIVATION_TOKEN"); !token.isEmpty()) { + activation->activate(token, window()->wlSurface()); + qunsetenv("XDG_ACTIVATION_TOKEN"); + return true; + } else if (const auto focusWindow = QGuiApplication::focusWindow()) { + const auto wlWindow = static_cast(focusWindow->handle()); + if (const auto xdgSurface = qobject_cast(wlWindow->shellSurface())) { + if (const auto seat = wlWindow->display()->lastInputDevice()) { + const auto tokenProvider = activation->requestXdgActivationToken( + wlWindow->display(), wlWindow->wlSurface(), seat->serial(), xdgSurface->m_appId); + connect(tokenProvider, &QWaylandXdgActivationTokenV1::done, this, + [this, tokenProvider](const QString &token) { + m_shell->activation()->activate(token, window()->wlSurface()); + tokenProvider->deleteLater(); + }); + return true; + } + } + } } return false; } From e43b382fb336b13a4b25c176412152a0501b7b94 Mon Sep 17 00:00:00 2001 From: Weng Xuetian Date: Thu, 16 Jun 2022 19:46:59 -0700 Subject: [PATCH 1093/1507] Also use text-input if QT_IM_MODULE is empty or "wayland" Previously, text input can only be used when only when QT_IM_MODULE is unset, it is counter-intuitive when empty and null has different meaning. Additionally making "wayland" to use text input to make it easier to enforce wayland context. Gtk's relevant value is also "wayland" so it will be more consistent. Pick-to: 6.4 6.3 6.2 Change-Id: I39b8c899b0ab7965d4b17ca29ed9eadc14f17e88 Reviewed-by: Qt CI Bot Reviewed-by: Eskil Abrahamsen Blomfeldt Reviewed-by: Aleix Pol Gonzalez --- src/plugins/platforms/wayland/qwaylanddisplay.cpp | 4 ++++ src/plugins/platforms/wayland/qwaylanddisplay_p.h | 6 +++++- src/plugins/platforms/wayland/qwaylandintegration.cpp | 2 +- tests/auto/wayland/inputcontext/tst_inputcontext.cpp | 3 ++- 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index c75ede732c8..5504331153e 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -833,6 +833,10 @@ bool QWaylandDisplay::isKeyboardAvailable() const [](const QWaylandInputDevice *device) { return device->keyboard() != nullptr; }); } +bool QWaylandDisplay::isClientSideInputContextRequested() const { + return mClientSideInputContextRequested; +} + #if QT_CONFIG(cursor) QWaylandCursor *QWaylandDisplay::waylandCursor() diff --git a/src/plugins/platforms/wayland/qwaylanddisplay_p.h b/src/plugins/platforms/wayland/qwaylanddisplay_p.h index 3809de1eaaa..473016f1e60 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay_p.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay_p.h @@ -185,6 +185,7 @@ public: wl_event_queue *frameEventQueue() { return m_frameEventQueue; }; bool isKeyboardAvailable() const; + bool isClientSideInputContextRequested() const; void initEventThread(); @@ -275,7 +276,10 @@ private: struct wl_callback *mSyncCallback = nullptr; static const wl_callback_listener syncCallbackListener; - bool mClientSideInputContextRequested = !QPlatformInputContextFactory::requested().isNull(); + bool mClientSideInputContextRequested = [] () { + const QString& requested = QPlatformInputContextFactory::requested(); + return !requested.isEmpty() && requested != QLatin1String("wayland"); + }(); QStringList mTextInputManagerList; int mTextInputManagerIndex = INT_MAX; diff --git a/src/plugins/platforms/wayland/qwaylandintegration.cpp b/src/plugins/platforms/wayland/qwaylandintegration.cpp index a874c55a3ca..6d74de13b5c 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandintegration.cpp @@ -479,7 +479,7 @@ void QWaylandIntegration::reconfigureInputContext() qCWarning(lcQpaWayland) << "qtvirtualkeyboard currently is not supported at client-side," " use QT_IM_MODULE=qtvirtualkeyboard at compositor-side."; - if (requested.isNull()) { + if (!mDisplay->isClientSideInputContextRequested()) { if (mDisplay->textInputMethodManager() != nullptr) mInputContext.reset(new QWaylandInputMethodContext(mDisplay.data())); #if QT_WAYLAND_TEXT_INPUT_V4_WIP diff --git a/tests/auto/wayland/inputcontext/tst_inputcontext.cpp b/tests/auto/wayland/inputcontext/tst_inputcontext.cpp index 9e3d75e0f2c..9bcfa9e776c 100644 --- a/tests/auto/wayland/inputcontext/tst_inputcontext.cpp +++ b/tests/auto/wayland/inputcontext/tst_inputcontext.cpp @@ -98,8 +98,9 @@ void tst_inputcontext::selectingInputContext_data() // Test compositor with Text Input extension QTest::newRow("ibus:text-input") << QByteArray("ibus") << mIbusModule; QTest::newRow("compose:text-input") << QByteArray("compose") << mComposeModule; - QTest::newRow("empty:text-input") << QByteArray("") << mComposeModule; + QTest::newRow("empty:text-input") << QByteArray("") << mTextInputModule; QTest::newRow("null:text-input") << QByteArray() << mTextInputModule; + QTest::newRow("wayland:text-input") << QByteArray("wayland") << mTextInputModule; QTest::newRow("fake:text-input") << QByteArray("fake") << mComposeModule; } From 6939f5298448887e124383684b9d860cf2a096e2 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Tue, 12 Apr 2022 08:48:34 +0400 Subject: [PATCH 1094/1507] Client: Expose a way to set window margins via native interface The lack of such API is a big hassle to me since a long time. All that time I was forced to have my own fork of the xdg-shell plugin in the application code in order to have shadows on Wayland with custom client-side decorations. I hope I won't have to maintain the fork anymore. Pick-to: 6.4 Change-Id: Iaf498469843b5cac5c458049164065c4ef15877d Reviewed-by: David Edmundson --- .../wayland/qwaylandnativeinterface.cpp | 17 +++++++++++++++++ .../wayland/qwaylandnativeinterface_p.h | 5 +++++ .../platforms/wayland/qwaylandwindow.cpp | 17 +++++++++++++++-- .../platforms/wayland/qwaylandwindow_p.h | 3 +++ 4 files changed, 40 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp b/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp index 6d858348007..f2620fc43f7 100644 --- a/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp +++ b/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp @@ -129,6 +129,17 @@ void *QWaylandNativeInterface::nativeResourceForContext(const QByteArray &resour } #endif // opengl +QPlatformNativeInterface::NativeResourceForWindowFunction QWaylandNativeInterface::nativeResourceFunctionForWindow(const QByteArray &resource) +{ + QByteArray lowerCaseResource = resource.toLower(); + + if (lowerCaseResource == "setmargins") { + return NativeResourceForWindowFunction(reinterpret_cast(setWindowMargins)); + } + + return nullptr; +} + QVariantMap QWaylandNativeInterface::windowProperties(QPlatformWindow *window) const { QWaylandWindow *waylandWindow = static_cast(window); @@ -158,6 +169,12 @@ void QWaylandNativeInterface::emitWindowPropertyChanged(QPlatformWindow *window, emit windowPropertyChanged(window,name); } +void QWaylandNativeInterface::setWindowMargins(QWindow *window, const QMargins &margins) +{ + QWaylandWindow *wlWindow = static_cast(window->handle()); + wlWindow->setCustomMargins(margins); +} + } QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandnativeinterface_p.h b/src/plugins/platforms/wayland/qwaylandnativeinterface_p.h index d05d7c38f02..b39d9952656 100644 --- a/src/plugins/platforms/wayland/qwaylandnativeinterface_p.h +++ b/src/plugins/platforms/wayland/qwaylandnativeinterface_p.h @@ -24,6 +24,8 @@ QT_BEGIN_NAMESPACE +class QMargins; + namespace QtWaylandClient { class QWaylandIntegration; @@ -41,6 +43,7 @@ public: #if QT_CONFIG(opengl) void *nativeResourceForContext(const QByteArray &resource, QOpenGLContext *context) override; #endif + NativeResourceForWindowFunction nativeResourceFunctionForWindow(const QByteArray &resource) override; QVariantMap windowProperties(QPlatformWindow *window) const override; QVariant windowProperty(QPlatformWindow *window, const QString &name) const override; QVariant windowProperty(QPlatformWindow *window, const QString &name, const QVariant &defaultValue) const override; @@ -49,6 +52,8 @@ public: void emitWindowPropertyChanged(QPlatformWindow *window, const QString &name); private: + static void setWindowMargins(QWindow *window, const QMargins &margins); + QWaylandIntegration *m_integration = nullptr; QHash m_windowProperties; }; diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index a740559b774..d669e839906 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -402,8 +402,12 @@ void QWaylandWindow::resizeFromApplyConfigure(const QSize &sizeWithMargins, cons // 2) Following resizeFromApplyConfigure() calls should have sizeWithMargins equal to // windowContentGeometry() which excludes shadows, therefore in this case we have to // exclude them too in order not to accidentally apply smaller size to the window. - if (mWindowDecorationEnabled && (sizeWithMargins != surfaceSize())) - margins = mWindowDecoration->margins(QWaylandAbstractDecoration::ShadowsExcluded); + if (sizeWithMargins != surfaceSize()) { + if (mWindowDecorationEnabled) + margins = mWindowDecoration->margins(QWaylandAbstractDecoration::ShadowsExcluded); + if (!mCustomMargins.isNull()) + margins -= mCustomMargins; + } int widthWithoutMargins = qMax(sizeWithMargins.width() - (margins.left() + margins.right()), 1); int heightWithoutMargins = qMax(sizeWithMargins.height() - (margins.top() + margins.bottom()), 1); @@ -740,6 +744,12 @@ QMargins QWaylandWindow::clientSideMargins() const return mWindowDecorationEnabled ? mWindowDecoration->margins() : QMargins{}; } +void QWaylandWindow::setCustomMargins(const QMargins &margins) { + const QMargins oldMargins = mCustomMargins; + mCustomMargins = margins; + setGeometry(geometry().marginsRemoved(oldMargins).marginsAdded(margins)); +} + /*! * Size, with decorations (including including eventual shadows) in wl_surface coordinates */ @@ -759,6 +769,9 @@ QRect QWaylandWindow::windowContentGeometry() const if (mWindowDecorationEnabled) shadowMargins = mWindowDecoration->margins(QWaylandAbstractDecoration::ShadowsOnly); + if (!mCustomMargins.isNull()) + shadowMargins += mCustomMargins; + return QRect(QPoint(shadowMargins.left(), shadowMargins.top()), surfaceSize().shrunkBy(shadowMargins)); } diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index 66d5bdade88..d2d4d659fb8 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -112,6 +112,7 @@ public: bool waitForFrameSync(int timeout); QMargins frameMargins() const override; + void setCustomMargins(const QMargins &margins); QSize surfaceSize() const; QRect windowContentGeometry() const; QPointF mapFromWlSurface(const QPointF &surfacePosition) const; @@ -289,6 +290,8 @@ protected: QWaylandBuffer *mQueuedBuffer = nullptr; QRegion mQueuedBufferDamage; + QMargins mCustomMargins; + private: void setGeometry_helper(const QRect &rect); void initWindow(); From 959134c4ded20a016b692b01c94836b36f6b6283 Mon Sep 17 00:00:00 2001 From: Weng Xuetian Date: Wed, 20 Jul 2022 15:57:40 -0700 Subject: [PATCH 1095/1507] Only close popup in the the hierchary Imagine following event sequences: 1. a tooltip is shown. activePopups = {tooltip} 2. user click menu bar to show the menu, QMenu::setVisible is called. now activePopups(tooltip, menu} 3. tooltip visibility changed to false. 4. closePopups() close both tooltip and menu. This is a common pattern under wayland that menu is shown as a invisible state. This patch tries to memorize the surface hierchary used to create the popup role. And only close those popups whose ancesotor is hidden. Pick-to: 6.4 Change-Id: I78aa0b4e32a5812603e003e756d8bcd202e94af4 Reviewed-by: David Edmundson --- .../xdg-shell/qwaylandxdgshell.cpp | 22 +++-- .../xdg-shell/qwaylandxdgshell_p.h | 5 +- .../platforms/wayland/qwaylandwindow.cpp | 33 ++++--- .../platforms/wayland/qwaylandwindow_p.h | 6 ++ tests/auto/wayland/xdgshell/tst_xdgshell.cpp | 87 +++++++++++++++++++ 5 files changed, 127 insertions(+), 26 deletions(-) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp index e227971ba95..e3dee445c5c 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp @@ -174,12 +174,17 @@ QtWayland::xdg_toplevel::resize_edge QWaylandXdgSurface::Toplevel::convertToResi | ((edges & Qt::RightEdge) ? resize_edge_right : 0)); } -QWaylandXdgSurface::Popup::Popup(QWaylandXdgSurface *xdgSurface, QWaylandXdgSurface *parent, +QWaylandXdgSurface::Popup::Popup(QWaylandXdgSurface *xdgSurface, QWaylandWindow *parent, QtWayland::xdg_positioner *positioner) - : xdg_popup(xdgSurface->get_popup(parent ? parent->object() : nullptr, positioner->object())) - , m_xdgSurface(xdgSurface) + : m_xdgSurface(xdgSurface) + , m_parentXdgSurface(qobject_cast(parent->shellSurface())) , m_parent(parent) { + + init(xdgSurface->get_popup(m_parentXdgSurface ? m_parentXdgSurface->object() : nullptr, positioner->object())); + if (m_parent) { + m_parent->addChildPopup(m_xdgSurface->window()); + } } QWaylandXdgSurface::Popup::~Popup() @@ -187,10 +192,14 @@ QWaylandXdgSurface::Popup::~Popup() if (isInitialized()) destroy(); + if (m_parent) { + m_parent->removeChildPopup(m_xdgSurface->window()); + } + if (m_grabbing) { auto *shell = m_xdgSurface->m_shell; Q_ASSERT(shell->m_topmostGrabbingPopup == this); - shell->m_topmostGrabbingPopup = m_parent ? m_parent->m_popup : nullptr; + shell->m_topmostGrabbingPopup = m_parentXdgSurface ? m_parentXdgSurface->m_popup : nullptr; m_grabbing = false; // Synthesize Qt enter/leave events for popup @@ -396,8 +405,6 @@ void QWaylandXdgSurface::setPopup(QWaylandWindow *parent) { Q_ASSERT(!m_toplevel && !m_popup); - auto parentXdgSurface = qobject_cast(parent->shellSurface()); - auto positioner = new QtWayland::xdg_positioner(m_shell->create_positioner()); // set_popup expects a position relative to the parent QPoint transientPos = m_window->geometry().topLeft(); // this is absolute @@ -414,8 +421,9 @@ void QWaylandXdgSurface::setPopup(QWaylandWindow *parent) | QtWayland::xdg_positioner::constraint_adjustment_slide_y | QtWayland::xdg_positioner::constraint_adjustment_flip_x | QtWayland::xdg_positioner::constraint_adjustment_flip_y); - m_popup = new Popup(this, parentXdgSurface, positioner); + m_popup = new Popup(this, parent, positioner); positioner->destroy(); + delete positioner; } diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h index 30366168cc0..8410253c953 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h @@ -102,14 +102,15 @@ private: class Popup : public QtWayland::xdg_popup { public: - Popup(QWaylandXdgSurface *xdgSurface, QWaylandXdgSurface *parent, QtWayland::xdg_positioner *positioner); + Popup(QWaylandXdgSurface *xdgSurface, QWaylandWindow *parent, QtWayland::xdg_positioner *positioner); ~Popup() override; void grab(QWaylandInputDevice *seat, uint serial); void xdg_popup_popup_done() override; QWaylandXdgSurface *m_xdgSurface = nullptr; - QWaylandXdgSurface *m_parent = nullptr; + QWaylandXdgSurface *m_parentXdgSurface = nullptr; + QWaylandWindow *m_parent = nullptr; bool m_grabbing = false; }; diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index d669e839906..27572185df8 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -215,6 +215,7 @@ void QWaylandWindow::endFrame() void QWaylandWindow::reset() { + closeChildPopups(); delete mShellSurface; mShellSurface = nullptr; delete mSubSurfaceWindow; @@ -429,20 +430,6 @@ void QWaylandWindow::sendExposeEvent(const QRect &rect) mLastExposeGeometry = rect; } -static QList> activePopups; - -void QWaylandWindow::closePopups(QWaylandWindow *parent) -{ - while (!activePopups.isEmpty()) { - auto popup = activePopups.takeLast(); - if (popup.isNull()) - continue; - if (popup.data() == parent) - return; - popup->reset(); - } -} - QPlatformScreen *QWaylandWindow::calculateScreenFromSurfaceEvents() const { QReadLocker lock(&mSurfaceLock); @@ -462,8 +449,6 @@ void QWaylandWindow::setVisible(bool visible) lastVisible = visible; if (visible) { - if (window()->type() == Qt::Popup || window()->type() == Qt::ToolTip) - activePopups << this; initWindow(); setGeometry(windowGeometry()); @@ -472,7 +457,6 @@ void QWaylandWindow::setVisible(bool visible) // QWaylandShmBackingStore::beginPaint(). } else { sendExposeEvent(QRect()); - closePopups(this); reset(); } } @@ -1520,6 +1504,21 @@ void QWaylandWindow::setXdgActivationToken(const QString &token) { mShellSurface->setXdgActivationToken(token); } + +void QWaylandWindow::addChildPopup(QWaylandWindow *surface) { + mChildPopups.append(surface); +} + +void QWaylandWindow::removeChildPopup(QWaylandWindow *surface) { + mChildPopups.removeAll(surface); +} + +void QWaylandWindow::closeChildPopups() { + while (!mChildPopups.isEmpty()) { + auto popup = mChildPopups.takeLast(); + popup->reset(); + } +} } QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index d2d4d659fb8..ea30d9b800e 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -206,6 +206,10 @@ public: void beginFrame(); void endFrame(); + void addChildPopup(QWaylandWindow* child); + void removeChildPopup(QWaylandWindow* child); + void closeChildPopups(); + public slots: void applyConfigure(); @@ -292,6 +296,8 @@ protected: QMargins mCustomMargins; + QList> mChildPopups; + private: void setGeometry_helper(const QRect &rect); void initWindow(); diff --git a/tests/auto/wayland/xdgshell/tst_xdgshell.cpp b/tests/auto/wayland/xdgshell/tst_xdgshell.cpp index 80ac3a23f33..8d275e1ebcb 100644 --- a/tests/auto/wayland/xdgshell/tst_xdgshell.cpp +++ b/tests/auto/wayland/xdgshell/tst_xdgshell.cpp @@ -21,6 +21,7 @@ private slots: void configureStates(); void popup(); void tooltipOnPopup(); + void tooltipAndSiblingPopup(); void switchPopups(); void hidePopupParent(); void pongs(); @@ -321,6 +322,92 @@ void tst_xdgshell::tooltipOnPopup() QCOMPOSITOR_TRY_COMPARE(xdgPopup(0), nullptr); } +void tst_xdgshell::tooltipAndSiblingPopup() +{ + class ToolTip : public QRasterWindow { + public: + explicit ToolTip(QWindow *parent) { + setTransientParent(parent); + setFlags(Qt::ToolTip); + resize(100, 100); + show(); + } + void mousePressEvent(QMouseEvent *event) override { + QRasterWindow::mousePressEvent(event); + m_popup = new QRasterWindow; + m_popup->setTransientParent(transientParent()); + m_popup->setFlags(Qt::Popup); + m_popup->resize(100, 100); + m_popup->show(); + } + + QRasterWindow *m_popup = nullptr; + }; + + class Window : public QRasterWindow { + public: + void mousePressEvent(QMouseEvent *event) override { + QRasterWindow::mousePressEvent(event); + m_tooltip = new ToolTip(this); + } + ToolTip *m_tooltip = nullptr; + }; + + Window window; + window.resize(200, 200); + window.show(); + + QCOMPOSITOR_TRY_VERIFY(xdgToplevel()); + exec([=] { xdgToplevel()->sendCompleteConfigure(); }); + QCOMPOSITOR_TRY_VERIFY(xdgToplevel()->m_xdgSurface->m_committedConfigureSerial); + + exec([=] { + auto *surface = xdgToplevel()->surface(); + auto *p = pointer(); + auto *c = client(); + p->sendEnter(surface, {100, 100}); + p->sendFrame(c); + p->sendButton(client(), BTN_LEFT, Pointer::button_state_pressed); + p->sendButton(client(), BTN_LEFT, Pointer::button_state_released); + p->sendFrame(c); + p->sendLeave(surface); + p->sendFrame(c); + }); + + QCOMPOSITOR_TRY_VERIFY(xdgPopup()); + exec([=] { xdgPopup()->sendCompleteConfigure(QRect(100, 100, 100, 100)); }); + QCOMPOSITOR_TRY_VERIFY(xdgPopup()->m_xdgSurface->m_committedConfigureSerial); + QCOMPOSITOR_TRY_VERIFY(!xdgPopup()->m_grabbed); + + exec([=] { + auto *surface = xdgPopup()->surface(); + auto *p = pointer(); + auto *c = client(); + p->sendEnter(surface, {100, 100}); + p->sendFrame(c); + p->sendButton(client(), BTN_LEFT, Pointer::button_state_pressed); + p->sendButton(client(), BTN_LEFT, Pointer::button_state_released); + p->sendFrame(c); + }); + + QCOMPOSITOR_TRY_VERIFY(xdgPopup(1)); + exec([=] { xdgPopup(1)->sendCompleteConfigure(QRect(100, 100, 100, 100)); }); + QCOMPOSITOR_TRY_VERIFY(xdgPopup(1)->m_xdgSurface->m_committedConfigureSerial); + QCOMPOSITOR_TRY_VERIFY(xdgPopup(1)->m_grabbed); + + // Close the middle tooltip (it should not close the sibling popup) + window.m_tooltip->close(); + + QCOMPOSITOR_TRY_COMPARE(xdgPopup(1), nullptr); + // Verify the remaining xdg surface is a grab popup.. + QCOMPOSITOR_TRY_VERIFY(xdgPopup(0)); + QCOMPOSITOR_TRY_VERIFY(xdgPopup(0)->m_grabbed); + + window.m_tooltip->m_popup->close(); + QCOMPOSITOR_TRY_COMPARE(xdgPopup(1), nullptr); + QCOMPOSITOR_TRY_COMPARE(xdgPopup(0), nullptr); +} + // QTBUG-65680 void tst_xdgshell::switchPopups() { From 8ec60005f4d58e934aa886e8da79137a26243156 Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Thu, 28 Jul 2022 09:52:36 +0200 Subject: [PATCH 1096/1507] CMake: Don't use PUBLIC_LIBRARIES for tests and test helpers Change-Id: I95f27e29fdee60acecba4fbba9b1b77c1680cee5 Reviewed-by: Alexey Edelev --- tests/auto/wayland/client/CMakeLists.txt | 2 +- tests/auto/wayland/clientextension/CMakeLists.txt | 2 +- tests/auto/wayland/datadevicev1/CMakeLists.txt | 2 +- tests/auto/wayland/fullscreenshellv1/CMakeLists.txt | 2 +- tests/auto/wayland/inputcontext/CMakeLists.txt | 2 +- tests/auto/wayland/multithreaded/CMakeLists.txt | 2 +- tests/auto/wayland/nooutput/CMakeLists.txt | 2 +- tests/auto/wayland/output/CMakeLists.txt | 2 +- tests/auto/wayland/primaryselectionv1/CMakeLists.txt | 2 +- tests/auto/wayland/seat/CMakeLists.txt | 2 +- tests/auto/wayland/seatv4/CMakeLists.txt | 4 ++-- tests/auto/wayland/surface/CMakeLists.txt | 2 +- tests/auto/wayland/tabletv2/CMakeLists.txt | 2 +- tests/auto/wayland/wl_connect/CMakeLists.txt | 2 +- tests/auto/wayland/xdgdecorationv1/CMakeLists.txt | 2 +- tests/auto/wayland/xdgoutput/CMakeLists.txt | 2 +- tests/auto/wayland/xdgshell/CMakeLists.txt | 2 +- 17 files changed, 18 insertions(+), 18 deletions(-) diff --git a/tests/auto/wayland/client/CMakeLists.txt b/tests/auto/wayland/client/CMakeLists.txt index 49573e35a68..e32b3b7b231 100644 --- a/tests/auto/wayland/client/CMakeLists.txt +++ b/tests/auto/wayland/client/CMakeLists.txt @@ -10,7 +10,7 @@ qt_internal_add_test(tst_client SOURCES tst_client.cpp - PUBLIC_LIBRARIES + LIBRARIES SharedClientTest ) diff --git a/tests/auto/wayland/clientextension/CMakeLists.txt b/tests/auto/wayland/clientextension/CMakeLists.txt index 15739a5fd89..462130ad126 100644 --- a/tests/auto/wayland/clientextension/CMakeLists.txt +++ b/tests/auto/wayland/clientextension/CMakeLists.txt @@ -4,7 +4,7 @@ qt_internal_add_test(tst_clientextension SOURCES tst_clientextension.cpp - PUBLIC_LIBRARIES + LIBRARIES SharedClientTest ) diff --git a/tests/auto/wayland/datadevicev1/CMakeLists.txt b/tests/auto/wayland/datadevicev1/CMakeLists.txt index 02495d19525..500048fd238 100644 --- a/tests/auto/wayland/datadevicev1/CMakeLists.txt +++ b/tests/auto/wayland/datadevicev1/CMakeLists.txt @@ -10,6 +10,6 @@ qt_internal_add_test(tst_datadevicev1 SOURCES tst_datadevicev1.cpp - PUBLIC_LIBRARIES + LIBRARIES SharedClientTest ) diff --git a/tests/auto/wayland/fullscreenshellv1/CMakeLists.txt b/tests/auto/wayland/fullscreenshellv1/CMakeLists.txt index 8b889324a23..882e426d535 100644 --- a/tests/auto/wayland/fullscreenshellv1/CMakeLists.txt +++ b/tests/auto/wayland/fullscreenshellv1/CMakeLists.txt @@ -10,6 +10,6 @@ qt_internal_add_test(tst_client_fullscreenshellv1 SOURCES tst_fullscreenshellv1.cpp - PUBLIC_LIBRARIES + LIBRARIES SharedClientTest ) diff --git a/tests/auto/wayland/inputcontext/CMakeLists.txt b/tests/auto/wayland/inputcontext/CMakeLists.txt index 2acdee2676e..c18159bbb88 100644 --- a/tests/auto/wayland/inputcontext/CMakeLists.txt +++ b/tests/auto/wayland/inputcontext/CMakeLists.txt @@ -10,6 +10,6 @@ qt_internal_add_test(tst_inputcontext SOURCES tst_inputcontext.cpp - PUBLIC_LIBRARIES + LIBRARIES SharedClientTest ) diff --git a/tests/auto/wayland/multithreaded/CMakeLists.txt b/tests/auto/wayland/multithreaded/CMakeLists.txt index 95130c03dab..0c2ee2047b1 100644 --- a/tests/auto/wayland/multithreaded/CMakeLists.txt +++ b/tests/auto/wayland/multithreaded/CMakeLists.txt @@ -10,6 +10,6 @@ qt_internal_add_test(tst_multithreaded SOURCES tst_multithreaded.cpp - PUBLIC_LIBRARIES + LIBRARIES SharedClientTest ) diff --git a/tests/auto/wayland/nooutput/CMakeLists.txt b/tests/auto/wayland/nooutput/CMakeLists.txt index c6b3712a723..53459539ac6 100644 --- a/tests/auto/wayland/nooutput/CMakeLists.txt +++ b/tests/auto/wayland/nooutput/CMakeLists.txt @@ -10,6 +10,6 @@ qt_internal_add_test(tst_nooutput SOURCES tst_nooutput.cpp - PUBLIC_LIBRARIES + LIBRARIES SharedClientTest ) diff --git a/tests/auto/wayland/output/CMakeLists.txt b/tests/auto/wayland/output/CMakeLists.txt index f22ed32073d..905b05a68b7 100644 --- a/tests/auto/wayland/output/CMakeLists.txt +++ b/tests/auto/wayland/output/CMakeLists.txt @@ -10,6 +10,6 @@ qt_internal_add_test(tst_output SOURCES tst_output.cpp - PUBLIC_LIBRARIES + LIBRARIES SharedClientTest ) diff --git a/tests/auto/wayland/primaryselectionv1/CMakeLists.txt b/tests/auto/wayland/primaryselectionv1/CMakeLists.txt index b0947c0e239..83982dc5544 100644 --- a/tests/auto/wayland/primaryselectionv1/CMakeLists.txt +++ b/tests/auto/wayland/primaryselectionv1/CMakeLists.txt @@ -10,6 +10,6 @@ qt_internal_add_test(tst_primaryselectionv1 SOURCES tst_primaryselectionv1.cpp - PUBLIC_LIBRARIES + LIBRARIES SharedClientTest ) diff --git a/tests/auto/wayland/seat/CMakeLists.txt b/tests/auto/wayland/seat/CMakeLists.txt index e3d809f4a26..82bc107e802 100644 --- a/tests/auto/wayland/seat/CMakeLists.txt +++ b/tests/auto/wayland/seat/CMakeLists.txt @@ -10,6 +10,6 @@ qt_internal_add_test(tst_seat SOURCES tst_seat.cpp - PUBLIC_LIBRARIES + LIBRARIES SharedClientTest ) diff --git a/tests/auto/wayland/seatv4/CMakeLists.txt b/tests/auto/wayland/seatv4/CMakeLists.txt index 8838ea0027e..6a3327f295f 100644 --- a/tests/auto/wayland/seatv4/CMakeLists.txt +++ b/tests/auto/wayland/seatv4/CMakeLists.txt @@ -10,7 +10,7 @@ qt_internal_add_test(tst_seatv4 SOURCES tst_seatv4.cpp - PUBLIC_LIBRARIES + LIBRARIES SharedClientTest ) @@ -18,7 +18,7 @@ qt_internal_add_test(tst_seatv4 ##################################################################### qt_internal_extend_target(tst_seatv4 CONDITION QT_FEATURE_cursor - PUBLIC_LIBRARIES + LIBRARIES Qt::GuiPrivate Wayland::Cursor ) diff --git a/tests/auto/wayland/surface/CMakeLists.txt b/tests/auto/wayland/surface/CMakeLists.txt index 066ac12bb31..b38b5abe5bf 100644 --- a/tests/auto/wayland/surface/CMakeLists.txt +++ b/tests/auto/wayland/surface/CMakeLists.txt @@ -10,6 +10,6 @@ qt_internal_add_test(tst_surface SOURCES tst_surface.cpp - PUBLIC_LIBRARIES + LIBRARIES SharedClientTest ) diff --git a/tests/auto/wayland/tabletv2/CMakeLists.txt b/tests/auto/wayland/tabletv2/CMakeLists.txt index 7a07735cf1e..c884a376896 100644 --- a/tests/auto/wayland/tabletv2/CMakeLists.txt +++ b/tests/auto/wayland/tabletv2/CMakeLists.txt @@ -10,6 +10,6 @@ qt_internal_add_test(tst_tabletv2 SOURCES tst_tabletv2.cpp - PUBLIC_LIBRARIES + LIBRARIES SharedClientTest ) diff --git a/tests/auto/wayland/wl_connect/CMakeLists.txt b/tests/auto/wayland/wl_connect/CMakeLists.txt index b18a30e0dd0..9c7a106869b 100644 --- a/tests/auto/wayland/wl_connect/CMakeLists.txt +++ b/tests/auto/wayland/wl_connect/CMakeLists.txt @@ -10,7 +10,7 @@ qt_internal_add_test(tst_wlconnect SOURCES tst_wlconnect.cpp - PUBLIC_LIBRARIES + LIBRARIES Qt::Gui Qt::GuiPrivate ) diff --git a/tests/auto/wayland/xdgdecorationv1/CMakeLists.txt b/tests/auto/wayland/xdgdecorationv1/CMakeLists.txt index 5f5e624c937..eb4c3ca1bd6 100644 --- a/tests/auto/wayland/xdgdecorationv1/CMakeLists.txt +++ b/tests/auto/wayland/xdgdecorationv1/CMakeLists.txt @@ -10,6 +10,6 @@ qt_internal_add_test(tst_xdgdecorationv1 SOURCES tst_xdgdecorationv1.cpp - PUBLIC_LIBRARIES + LIBRARIES SharedClientTest ) diff --git a/tests/auto/wayland/xdgoutput/CMakeLists.txt b/tests/auto/wayland/xdgoutput/CMakeLists.txt index 70eb597b2b0..1d27be86454 100644 --- a/tests/auto/wayland/xdgoutput/CMakeLists.txt +++ b/tests/auto/wayland/xdgoutput/CMakeLists.txt @@ -10,6 +10,6 @@ qt_internal_add_test(tst_xdgoutput SOURCES tst_xdgoutput.cpp - PUBLIC_LIBRARIES + LIBRARIES SharedClientTest ) diff --git a/tests/auto/wayland/xdgshell/CMakeLists.txt b/tests/auto/wayland/xdgshell/CMakeLists.txt index 7270d88471b..08efc9dca71 100644 --- a/tests/auto/wayland/xdgshell/CMakeLists.txt +++ b/tests/auto/wayland/xdgshell/CMakeLists.txt @@ -10,6 +10,6 @@ qt_internal_add_test(tst_xdgshell SOURCES tst_xdgshell.cpp - PUBLIC_LIBRARIES + LIBRARIES SharedClientTest ) From 7aae0a115b45a134910b5349014aa4678c811f78 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 27 Jul 2022 17:10:39 -0700 Subject: [PATCH 1097/1507] Fix several more improperly placed #include moc Like commit qtbase/638893bea083b619b73b33a7dd5589fb2c4c4242. Script to find them: git grep -l '#include.*moc' \*.cpp \*.mm | \ xargs awk '/QT_BEGIN_NAMESPACE/ { i=1 } /QT_END_NAMESPACE/ { i=0 } /#include.*moc/ && i { print ARGV[ARGIND], $0 }' Pick-to: 6.4 Change-Id: I6f936da6f6e84d649f70fffd17058fd05cfc5c6d Reviewed-by: Qt CI Bot Reviewed-by: Volker Hilsheimer --- src/plugins/platforms/wayland/qwaylanddisplay.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index 5504331153e..2d82f447ac4 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -878,8 +878,7 @@ QWaylandCursorTheme *QWaylandDisplay::loadCursorTheme(const QString &name, int p } // namespace QtWaylandClient -#include "qwaylanddisplay.moc" - QT_END_NAMESPACE +#include "qwaylanddisplay.moc" #include "moc_qwaylanddisplay_p.cpp" From 95edea11f18c78f758b2414b69087a7a3d44f18d Mon Sep 17 00:00:00 2001 From: Jan Grulich Date: Fri, 29 Jul 2022 11:47:02 +0200 Subject: [PATCH 1098/1507] Client: do not take decoration shadows into account when placing popups The anchor rectangle is relative to the window geometry, which according to xdg-shell specs shouldn't include invisible portions like shadows. This causes all popups be wrongly positioned when drop-shadows are used. Pick-to: 6.4 6.3 6.2 Change-Id: Iac30ab264599f9898f3ddecd7f0c5f2aca824ad6 Reviewed-by: David Edmundson --- .../plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp index e3dee445c5c..c4b1942b0cc 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp @@ -410,8 +410,8 @@ void QWaylandXdgSurface::setPopup(QWaylandWindow *parent) QPoint transientPos = m_window->geometry().topLeft(); // this is absolute transientPos -= parent->geometry().topLeft(); if (parent->decoration()) { - transientPos.setX(transientPos.x() + parent->decoration()->margins().left()); - transientPos.setY(transientPos.y() + parent->decoration()->margins().top()); + transientPos.setX(transientPos.x() + parent->decoration()->margins(QWaylandAbstractDecoration::ShadowsExcluded).left()); + transientPos.setY(transientPos.y() + parent->decoration()->margins(QWaylandAbstractDecoration::ShadowsExcluded).top()); } positioner->set_anchor_rect(transientPos.x(), transientPos.y(), 1, 1); positioner->set_anchor(QtWayland::xdg_positioner::anchor_top_left); From 4132a63f14f513c9b49c1dbda1ec4f2742b86e10 Mon Sep 17 00:00:00 2001 From: David Redondo Date: Tue, 22 Feb 2022 16:11:22 +0100 Subject: [PATCH 1099/1507] Provide a handle for desktop portal via xdg-exporter Change-Id: I6b2034c1833ae497ef05af7c377e4bfd3747b6fe Reviewed-by: David Edmundson --- .../wayland/protocols/qt_attribution.json | 19 +- .../protocols/xdg-foreign-unstable-v2.xml | 200 ++++++++++++++++++ .../shellintegration/xdg-shell/CMakeLists.txt | 2 + .../xdg-shell/qwaylandxdgexporterv2.cpp | 47 ++++ .../xdg-shell/qwaylandxdgexporterv2_p.h | 50 +++++ .../xdg-shell/qwaylandxdgshell.cpp | 19 ++ .../xdg-shell/qwaylandxdgshell_p.h | 8 + .../wayland/qwaylandshellsurface_p.h | 2 + .../qwaylandwindowmanagerintegration.cpp | 12 ++ .../qwaylandwindowmanagerintegration_p.h | 1 + 10 files changed, 359 insertions(+), 1 deletion(-) create mode 100644 src/3rdparty/wayland/protocols/xdg-foreign-unstable-v2.xml create mode 100644 src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgexporterv2.cpp create mode 100644 src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgexporterv2_p.h diff --git a/src/3rdparty/wayland/protocols/qt_attribution.json b/src/3rdparty/wayland/protocols/qt_attribution.json index f51599de08a..76d8d3f0407 100644 --- a/src/3rdparty/wayland/protocols/qt_attribution.json +++ b/src/3rdparty/wayland/protocols/qt_attribution.json @@ -301,5 +301,22 @@ "License": "MIT License", "LicenseFile": "MIT_LICENSE.txt", "Copyright": "Copyright © 2013, 2014 Collabora, Ltd." - } + }, + + { + "Id": "xdg-foreign-unstable-v2", + "Name": "Wayland XDG Foreign Protocol", + "QDocModule": "qtwaylandcompositor", + "QtUsage": "Used in the Qt Wayland platform plugin", + "Files": "xdg-foreign-unstable-v2.xml", + + "Description": "Allows referencing surfaces of different clients", + "Homepage": "https://wayland.freedesktop.org", + "Version": "1", + "DownloadLocation": "https://gitlab.freedesktop.org/wayland/wayland-protocols/-/raw/1.25/unstable/xdg-foreign/xdg-foreign-unstable-v2.xml", + "LicenseId": "MIT", + "License": "MIT License", + "LicenseFile": "MIT_LICENSE.txt", + "Copyright": "Copyright © 2015-2016 Red Hat Inc." + }, ] diff --git a/src/3rdparty/wayland/protocols/xdg-foreign-unstable-v2.xml b/src/3rdparty/wayland/protocols/xdg-foreign-unstable-v2.xml new file mode 100644 index 00000000000..cc3271dca4d --- /dev/null +++ b/src/3rdparty/wayland/protocols/xdg-foreign-unstable-v2.xml @@ -0,0 +1,200 @@ + + + + + Copyright © 2015-2016 Red Hat Inc. + + 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. + + + + This protocol specifies a way for making it possible to reference a surface + of a different client. With such a reference, a client can, by using the + interfaces provided by this protocol, manipulate the relationship between + its own surfaces and the surface of some other client. For example, stack + some of its own surface above the other clients surface. + + In order for a client A to get a reference of a surface of client B, client + B must first export its surface using xdg_exporter.export_toplevel. Upon + doing this, client B will receive a handle (a unique string) that it may + share with client A in some way (for example D-Bus). After client A has + received the handle from client B, it may use xdg_importer.import_toplevel + to create a reference to the surface client B just exported. See the + corresponding requests for details. + + A possible use case for this is out-of-process dialogs. For example when a + sandboxed client without file system access needs the user to select a file + on the file system, given sandbox environment support, it can export its + surface, passing the exported surface handle to an unsandboxed process that + can show a file browser dialog and stack it above the sandboxed client's + surface. + + Warning! The protocol described in this file is experimental and backward + incompatible changes may be made. Backward compatible changes may be added + together with the corresponding interface version bump. Backward + incompatible changes are done by bumping the version number in the protocol + and interface names and resetting the interface version. Once the protocol + is to be declared stable, the 'z' prefix and the version number in the + protocol and interface names are removed and the interface version number is + reset. + + + + + A global interface used for exporting surfaces that can later be imported + using xdg_importer. + + + + + Notify the compositor that the xdg_exporter object will no longer be + used. + + + + + + These errors can be emitted in response to invalid xdg_exporter + requests. + + + + + + + The export_toplevel request exports the passed surface so that it can later be + imported via xdg_importer. When called, a new xdg_exported object will + be created and xdg_exported.handle will be sent immediately. See the + corresponding interface and event for details. + + A surface may be exported multiple times, and each exported handle may + be used to create an xdg_imported multiple times. Only xdg_toplevel + equivalent surfaces may be exported, otherwise an invalid_surface + protocol error is sent. + + + + + + + + + A global interface used for importing surfaces exported by xdg_exporter. + With this interface, a client can create a reference to a surface of + another client. + + + + + Notify the compositor that the xdg_importer object will no longer be + used. + + + + + + The import_toplevel request imports a surface from any client given a handle + retrieved by exporting said surface using xdg_exporter.export_toplevel. + When called, a new xdg_imported object will be created. This new object + represents the imported surface, and the importing client can + manipulate its relationship using it. See xdg_imported for details. + + + + + + + + + An xdg_exported object represents an exported reference to a surface. The + exported surface may be referenced as long as the xdg_exported object not + destroyed. Destroying the xdg_exported invalidates any relationship the + importer may have established using xdg_imported. + + + + + Revoke the previously exported surface. This invalidates any + relationship the importer may have set up using the xdg_imported created + given the handle sent via xdg_exported.handle. + + + + + + The handle event contains the unique handle of this exported surface + reference. It may be shared with any client, which then can use it to + import the surface by calling xdg_importer.import_toplevel. A handle + may be used to import the surface multiple times. + + + + + + + + An xdg_imported object represents an imported reference to surface exported + by some client. A client can use this interface to manipulate + relationships between its own surfaces and the imported surface. + + + + + These errors can be emitted in response to invalid xdg_imported + requests. + + + + + + + Notify the compositor that it will no longer use the xdg_imported + object. Any relationship that may have been set up will at this point + be invalidated. + + + + + + Set the imported surface as the parent of some surface of the client. + The passed surface must be an xdg_toplevel equivalent, otherwise an + invalid_surface protocol error is sent. Calling this function sets up + a surface to surface relation with the same stacking and positioning + semantics as xdg_toplevel.set_parent. + + + + + + + The imported surface handle has been destroyed and any relationship set + up has been invalidated. This may happen for various reasons, for + example if the exported surface or the exported surface handle has been + destroyed, if the handle used for importing was invalid. + + + + + diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/CMakeLists.txt index 1ae0d5ff9af..df691d55006 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/CMakeLists.txt +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/CMakeLists.txt @@ -16,6 +16,7 @@ qt_internal_add_plugin(QWaylandXdgShellIntegrationPlugin qwaylandxdgactivationv1.cpp qwaylandxdgactivationv1_p.h qwaylandxdgshell.cpp qwaylandxdgshell_p.h qwaylandxdgshellintegration.cpp qwaylandxdgshellintegration_p.h + qwaylandxdgexporterv2.cpp qwaylandxdgexporterv2_p.h LIBRARIES Qt::Core Qt::Gui @@ -29,6 +30,7 @@ qt6_generate_wayland_protocol_client_sources(QWaylandXdgShellIntegrationPlugin ${CMAKE_CURRENT_SOURCE_DIR}/../../../3rdparty/protocol/xdg-decoration-unstable-v1.xml ${CMAKE_CURRENT_SOURCE_DIR}/../../../3rdparty/protocol/xdg-shell.xml ${CMAKE_CURRENT_SOURCE_DIR}/../../../3rdparty/protocol/xdg-activation-v1.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../../../3rdparty/protocol/xdg-foreign-unstable-v2.xml ) #### Keys ignored in scope 1:.:.:xdg-shell.pro:: diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgexporterv2.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgexporterv2.cpp new file mode 100644 index 00000000000..58baad02412 --- /dev/null +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgexporterv2.cpp @@ -0,0 +1,47 @@ +// Copyright (C) 2022 David Reondo +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#include "qwaylandxdgexporterv2_p.h" + +QT_BEGIN_NAMESPACE + +namespace QtWaylandClient { + +QWaylandXdgExportedV2::QWaylandXdgExportedV2(::zxdg_exported_v2 *object) + : QtWayland::zxdg_exported_v2(object) +{ +} + +QWaylandXdgExportedV2::~QWaylandXdgExportedV2() +{ + destroy(); +} + +void QWaylandXdgExportedV2::zxdg_exported_v2_handle(const QString &handle) +{ + mHandle = handle; +} + +QString QWaylandXdgExportedV2::handle() const +{ + return mHandle; +} + +QWaylandXdgExporterV2::QWaylandXdgExporterV2(wl_registry *registry, uint32_t id, int version) + : QtWayland::zxdg_exporter_v2(registry, id, qMin(version, 1)) +{ +} + +QWaylandXdgExporterV2::~QWaylandXdgExporterV2() +{ + destroy(); +} + +QtWaylandClient::QWaylandXdgExportedV2 *QWaylandXdgExporterV2::exportToplevel(wl_surface *surface) +{ + return new QWaylandXdgExportedV2(export_toplevel(surface)); +} + +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgexporterv2_p.h b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgexporterv2_p.h new file mode 100644 index 00000000000..b260dbacbac --- /dev/null +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgexporterv2_p.h @@ -0,0 +1,50 @@ +// Copyright (C) 2022 David Reondo +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QWAYLANDXDGEXPORTERV2_H +#define QWAYLANDXDGEXPORTERV2_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include + +#include + +QT_BEGIN_NAMESPACE + +namespace QtWaylandClient { + +class QWaylandXdgExportedV2 : public QtWayland::zxdg_exported_v2 +{ +public: + explicit QWaylandXdgExportedV2(::zxdg_exported_v2 *object); + ~QWaylandXdgExportedV2() override; + QString handle() const; + +private: + void zxdg_exported_v2_handle(const QString &handle) override; + QString mHandle; +}; + +class QWaylandXdgExporterV2 : public QtWayland::zxdg_exporter_v2 +{ +public: + QWaylandXdgExporterV2(wl_registry *registry, uint32_t id, int version); + ~QWaylandXdgExporterV2() override; + QWaylandXdgExportedV2 *exportToplevel(wl_surface *surface); +}; + +} + +QT_END_NAMESPACE + +#endif // QWAYLANDXDGEXPORTERV2_H diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp index c4b1942b0cc..87152fbdaf1 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp @@ -4,6 +4,8 @@ #include "qwaylandxdgshell_p.h" +#include "qwaylandxdgexporterv2_p.h" + #include #include #include @@ -537,6 +539,19 @@ void QWaylandXdgSurface::setXdgActivationToken(const QString &token) } } +QString QWaylandXdgSurface::externWindowHandle() +{ + if (!m_toplevel || !m_shell->exporter()) { + return QString(); + } + if (!m_toplevel->m_exported) { + m_toplevel->m_exported.reset(m_shell->exporter()->exportToplevel(m_window->wlSurface())); + // handle events is sent immediately + m_shell->display()->forceRoundTrip(); + } + return m_toplevel->m_exported->handle(); +} + QWaylandXdgShell::QWaylandXdgShell(QWaylandDisplay *display, uint32_t id, uint32_t availableVersion) : QtWayland::xdg_wm_base(display->wl_registry(), id, qMin(availableVersion, 2u)) , m_display(display) @@ -570,6 +585,10 @@ void QWaylandXdgShell::handleRegistryGlobal(void *data, wl_registry *registry, u if (interface == QLatin1String(QWaylandXdgActivationV1::interface()->name)) { xdgShell->m_xdgActivation.reset(new QWaylandXdgActivationV1(registry, id, version)); } + + if (interface == QLatin1String(QWaylandXdgExporterV2::interface()->name)) { + xdgShell->m_xdgExporter.reset(new QWaylandXdgExporterV2(registry, id, version)); + } } } diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h index 8410253c953..d3cdb9d4e9e 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h @@ -37,6 +37,8 @@ namespace QtWaylandClient { class QWaylandDisplay; class QWaylandInputDevice; class QWaylandXdgShell; +class QWaylandXdgExportedV2; +class QWaylandXdgExporterV2; class Q_WAYLANDCLIENT_EXPORT QWaylandXdgSurface : public QWaylandShellSurface, public QtWayland::xdg_surface { @@ -62,6 +64,7 @@ public: bool requestActivate() override; void setXdgActivationToken(const QString &token) override; void requestXdgActivationToken(quint32 serial) override; + QString externWindowHandle() override; void setSizeHints(); @@ -98,6 +101,7 @@ private: QWaylandXdgSurface *m_xdgSurface = nullptr; QWaylandXdgToplevelDecorationV1 *m_decoration = nullptr; + QScopedPointer m_exported; }; class Popup : public QtWayland::xdg_popup { @@ -138,8 +142,11 @@ public: QWaylandXdgShell(QWaylandDisplay *display, uint32_t id, uint32_t availableVersion); ~QWaylandXdgShell() override; + QWaylandDisplay *display() const { return m_display; } + QWaylandXdgDecorationManagerV1 *decorationManager() { return m_xdgDecorationManager.data(); } QWaylandXdgActivationV1 *activation() const { return m_xdgActivation.data(); } + QWaylandXdgExporterV2 *exporter() const { return m_xdgExporter.data(); } QWaylandXdgSurface *getXdgSurface(QWaylandWindow *window); protected: @@ -152,6 +159,7 @@ private: QWaylandDisplay *m_display = nullptr; QScopedPointer m_xdgDecorationManager; QScopedPointer m_xdgActivation; + QScopedPointer m_xdgExporter; QWaylandXdgSurface::Popup *m_topmostGrabbingPopup = nullptr; friend class QWaylandXdgSurface; diff --git a/src/plugins/platforms/wayland/qwaylandshellsurface_p.h b/src/plugins/platforms/wayland/qwaylandshellsurface_p.h index c133269a099..5e26951096f 100644 --- a/src/plugins/platforms/wayland/qwaylandshellsurface_p.h +++ b/src/plugins/platforms/wayland/qwaylandshellsurface_p.h @@ -71,6 +71,8 @@ public: virtual void setXdgActivationToken(const QString &token); virtual void requestXdgActivationToken(quint32 serial); + virtual QString externWindowHandle() { return QString(); } + inline QWaylandWindow *window() { return m_window; } QPlatformWindow *platformWindow(); struct wl_surface *wlSurface(); diff --git a/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration.cpp b/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration.cpp index b394d69b84f..dababe7c93e 100644 --- a/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration.cpp @@ -5,6 +5,7 @@ #include "qwaylandscreen_p.h" #include "qwaylandwindow_p.h" #include "qwaylanddisplay_p.h" +#include "qwaylandshellsurface_p.h" #include #include @@ -106,6 +107,17 @@ bool QWaylandWindowManagerIntegration::openDocument(const QUrl &url) return QGenericUnixServices::openDocument(url); } +QString QWaylandWindowManagerIntegration::portalWindowIdentifier(QWindow *window) +{ + if (window && window->handle()) { + auto shellSurface = static_cast(window->handle())->shellSurface(); + if (shellSurface) { + const QString handle = shellSurface->externWindowHandle(); + return QLatin1String("wayland:") + handle; + } + } + return QString(); +} } QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration_p.h b/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration_p.h index ea57911f4e1..18eb171b63c 100644 --- a/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration_p.h @@ -42,6 +42,7 @@ public: bool openUrl(const QUrl &url) override; bool openDocument(const QUrl &url) override; + QString portalWindowIdentifier(QWindow *window) override; bool showIsFullScreen() const; From 6f8b1bd725633d458653c06dfc782a5fc5cd24df Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Mon, 8 Aug 2022 12:14:01 +0200 Subject: [PATCH 1100/1507] Avoid calling requestUpdate from wrong thread In certain circumstances, we can get to createDecoration() from the render thread (from QWaylandGLContext::makeCurrent) Calling requestUpdate() from this secondary thread would cause an assert, so we queue the call on the appropriate thread instead. This amends 1a2e499e0e05a03460f4335d5266be485f97d3fa. Pick-to: 5.15 6.2 6.3 6.3.2 6.4 Fixes: QTBUG-105308 Change-Id: I4805265f39e24eb1464897532be2025bc3c27728 Reviewed-by: Inho Lee --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 27572185df8..53ebbe75c8c 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -932,7 +932,11 @@ bool QWaylandWindow::createDecoration() // size and are not redrawn, leaving the new buffer empty. As a simple // work-around, we trigger a full extra update whenever the client-side // window decorations are toggled while the window is showing. - window()->requestUpdate(); + // Note: createDecoration() is sometimes called from the render thread + // of Qt Quick. This is essentially wrong and could potentially cause problems, + // but until the underlying issue has been fixed, we have to use invokeMethod() + // here to avoid asserts. + QMetaObject::invokeMethod(window(), &QWindow::requestUpdate); } return mWindowDecoration; From 877b1430190ebd354c4c597f4a9423b199ce2b11 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Mon, 8 Aug 2022 03:56:07 +0400 Subject: [PATCH 1101/1507] Client: add custom margins support to xdg popups xdg_positioner operates in window content geometry (i.e. without shadows), so it's necessary to remove popup's and parent's shadow from position and size calculations. Pick-to: 6.4 Change-Id: I997ba2c45ae341a09a8284226629e8107800e894 Reviewed-by: David Edmundson --- .../shellintegration/xdg-shell/qwaylandxdgshell.cpp | 8 +++++--- src/plugins/platforms/wayland/qwaylandwindow.cpp | 5 +++++ src/plugins/platforms/wayland/qwaylandwindow_p.h | 1 + 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp index 87152fbdaf1..bd5e3fe50d0 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp @@ -409,8 +409,10 @@ void QWaylandXdgSurface::setPopup(QWaylandWindow *parent) auto positioner = new QtWayland::xdg_positioner(m_shell->create_positioner()); // set_popup expects a position relative to the parent - QPoint transientPos = m_window->geometry().topLeft(); // this is absolute - transientPos -= parent->geometry().topLeft(); + QPoint topLeftMargins = QPoint(m_window->customMargins().left(), m_window->customMargins().top()); + QPoint parentMargins = QPoint(parent->customMargins().left(), parent->customMargins().top()); + QPoint transientPos = m_window->geometry().topLeft() + topLeftMargins; // this is absolute + transientPos -= parent->geometry().topLeft() + parentMargins; if (parent->decoration()) { transientPos.setX(transientPos.x() + parent->decoration()->margins(QWaylandAbstractDecoration::ShadowsExcluded).left()); transientPos.setY(transientPos.y() + parent->decoration()->margins(QWaylandAbstractDecoration::ShadowsExcluded).top()); @@ -418,7 +420,7 @@ void QWaylandXdgSurface::setPopup(QWaylandWindow *parent) positioner->set_anchor_rect(transientPos.x(), transientPos.y(), 1, 1); positioner->set_anchor(QtWayland::xdg_positioner::anchor_top_left); positioner->set_gravity(QtWayland::xdg_positioner::gravity_bottom_right); - positioner->set_size(m_window->geometry().width(), m_window->geometry().height()); + positioner->set_size(m_window->windowContentGeometry().width(), m_window->windowContentGeometry().height()); positioner->set_constraint_adjustment(QtWayland::xdg_positioner::constraint_adjustment_slide_x | QtWayland::xdg_positioner::constraint_adjustment_slide_y | QtWayland::xdg_positioner::constraint_adjustment_flip_x diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 53ebbe75c8c..9c6ce91a825 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -728,6 +728,11 @@ QMargins QWaylandWindow::clientSideMargins() const return mWindowDecorationEnabled ? mWindowDecoration->margins() : QMargins{}; } +QMargins QWaylandWindow::customMargins() const +{ + return mCustomMargins; +} + void QWaylandWindow::setCustomMargins(const QMargins &margins) { const QMargins oldMargins = mCustomMargins; mCustomMargins = margins; diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index ea30d9b800e..298f3f2df43 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -112,6 +112,7 @@ public: bool waitForFrameSync(int timeout); QMargins frameMargins() const override; + QMargins customMargins() const; void setCustomMargins(const QMargins &margins); QSize surfaceSize() const; QRect windowContentGeometry() const; From 42b9e035d51564370d9c04bb95e8e7e73ea52b35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucie=20G=C3=A9rard?= Date: Mon, 22 Aug 2022 15:34:45 +0200 Subject: [PATCH 1102/1507] Change the license of all CMakeLists.txt and *.cmake files to BSD MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Task-number: QTBUG-105718 Change-Id: Icb25ea4e07a38eea81f55ed59c6d3b9d37602626 Reviewed-by: Qt CI Bot Reviewed-by: Jörg Bornemann --- src/platformsupport/wayland/CMakeLists.txt | 2 +- src/platformsupport/wayland/configure.cmake | 2 +- src/plugins/platforms/wayland/CMakeLists.txt | 2 +- src/plugins/platforms/wayland/configure.cmake | 2 +- src/plugins/platforms/wayland/plugins/CMakeLists.txt | 2 +- .../platforms/wayland/plugins/decorations/CMakeLists.txt | 2 +- .../wayland/plugins/decorations/bradient/CMakeLists.txt | 2 +- .../wayland/plugins/hardwareintegration/CMakeLists.txt | 2 +- .../wayland/plugins/hardwareintegration/brcm-egl/CMakeLists.txt | 2 +- .../plugins/hardwareintegration/dmabuf-server/CMakeLists.txt | 2 +- .../plugins/hardwareintegration/drm-egl-server/CMakeLists.txt | 2 +- .../hardwareintegration/libhybris-egl-server/CMakeLists.txt | 2 +- .../hardwareintegration/shm-emulation-server/CMakeLists.txt | 2 +- .../plugins/hardwareintegration/vulkan-server/CMakeLists.txt | 2 +- .../plugins/hardwareintegration/wayland-egl/CMakeLists.txt | 2 +- .../platforms/wayland/plugins/shellintegration/CMakeLists.txt | 2 +- .../plugins/shellintegration/fullscreen-shell-v1/CMakeLists.txt | 2 +- .../wayland/plugins/shellintegration/wl-shell/CMakeLists.txt | 2 +- .../wayland/plugins/shellintegration/xdg-shell/CMakeLists.txt | 2 +- src/tools/qtwaylandscanner/CMakeLists.txt | 2 +- src/tools/qtwaylandscanner/Qt6WaylandClientMacros.cmake | 2 +- src/tools/qtwaylandscanner/Qt6WaylandCompositorMacros.cmake | 2 +- tests/auto/cmake/test_waylandclient/CMakeLists.txt | 2 +- tests/auto/wayland/CMakeLists.txt | 2 +- tests/auto/wayland/client/CMakeLists.txt | 2 +- tests/auto/wayland/clientextension/CMakeLists.txt | 2 +- tests/auto/wayland/datadevicev1/CMakeLists.txt | 2 +- tests/auto/wayland/fullscreenshellv1/CMakeLists.txt | 2 +- tests/auto/wayland/inputcontext/CMakeLists.txt | 2 +- tests/auto/wayland/multithreaded/CMakeLists.txt | 2 +- tests/auto/wayland/nooutput/CMakeLists.txt | 2 +- tests/auto/wayland/output/CMakeLists.txt | 2 +- tests/auto/wayland/primaryselectionv1/CMakeLists.txt | 2 +- tests/auto/wayland/seat/CMakeLists.txt | 2 +- tests/auto/wayland/seatv4/CMakeLists.txt | 2 +- tests/auto/wayland/shared/CMakeLists.txt | 2 +- tests/auto/wayland/surface/CMakeLists.txt | 2 +- tests/auto/wayland/tabletv2/CMakeLists.txt | 2 +- tests/auto/wayland/wl_connect/CMakeLists.txt | 2 +- tests/auto/wayland/xdgdecorationv1/CMakeLists.txt | 2 +- tests/auto/wayland/xdgoutput/CMakeLists.txt | 2 +- tests/auto/wayland/xdgshell/CMakeLists.txt | 2 +- 42 files changed, 42 insertions(+), 42 deletions(-) diff --git a/src/platformsupport/wayland/CMakeLists.txt b/src/platformsupport/wayland/CMakeLists.txt index 8acff45b680..0ac09b52faa 100644 --- a/src/platformsupport/wayland/CMakeLists.txt +++ b/src/platformsupport/wayland/CMakeLists.txt @@ -1,5 +1,5 @@ # Copyright (C) 2022 The Qt Company Ltd. -# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +# SPDX-License-Identifier: BSD-3-Clause # Generated from src.pro. # special case begin diff --git a/src/platformsupport/wayland/configure.cmake b/src/platformsupport/wayland/configure.cmake index 5dcf03b620a..9954ea6269e 100644 --- a/src/platformsupport/wayland/configure.cmake +++ b/src/platformsupport/wayland/configure.cmake @@ -1,5 +1,5 @@ # Copyright (C) 2022 The Qt Company Ltd. -# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +# SPDX-License-Identifier: BSD-3-Clause # configure.cmake for the QtWaylandGlobalPrivate module diff --git a/src/plugins/platforms/wayland/CMakeLists.txt b/src/plugins/platforms/wayland/CMakeLists.txt index 0ac1584d3dc..d38befdbcf5 100644 --- a/src/plugins/platforms/wayland/CMakeLists.txt +++ b/src/plugins/platforms/wayland/CMakeLists.txt @@ -1,5 +1,5 @@ # Copyright (C) 2022 The Qt Company Ltd. -# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +# SPDX-License-Identifier: BSD-3-Clause # Generated from client.pro. diff --git a/src/plugins/platforms/wayland/configure.cmake b/src/plugins/platforms/wayland/configure.cmake index 216006927d7..5ed7995efbc 100644 --- a/src/plugins/platforms/wayland/configure.cmake +++ b/src/plugins/platforms/wayland/configure.cmake @@ -1,5 +1,5 @@ # Copyright (C) 2022 The Qt Company Ltd. -# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +# SPDX-License-Identifier: BSD-3-Clause #### Inputs diff --git a/src/plugins/platforms/wayland/plugins/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/CMakeLists.txt index a76cebd5393..e0c91c5e46e 100644 --- a/src/plugins/platforms/wayland/plugins/CMakeLists.txt +++ b/src/plugins/platforms/wayland/plugins/CMakeLists.txt @@ -1,5 +1,5 @@ # Copyright (C) 2022 The Qt Company Ltd. -# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +# SPDX-License-Identifier: BSD-3-Clause # Generated from plugins.pro. diff --git a/src/plugins/platforms/wayland/plugins/decorations/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/decorations/CMakeLists.txt index 5e8252844bf..73c59e4a547 100644 --- a/src/plugins/platforms/wayland/plugins/decorations/CMakeLists.txt +++ b/src/plugins/platforms/wayland/plugins/decorations/CMakeLists.txt @@ -1,5 +1,5 @@ # Copyright (C) 2022 The Qt Company Ltd. -# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +# SPDX-License-Identifier: BSD-3-Clause # Generated from decorations.pro. diff --git a/src/plugins/platforms/wayland/plugins/decorations/bradient/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/decorations/bradient/CMakeLists.txt index 0797705ea45..065d0f18c55 100644 --- a/src/plugins/platforms/wayland/plugins/decorations/bradient/CMakeLists.txt +++ b/src/plugins/platforms/wayland/plugins/decorations/bradient/CMakeLists.txt @@ -1,5 +1,5 @@ # Copyright (C) 2022 The Qt Company Ltd. -# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +# SPDX-License-Identifier: BSD-3-Clause # Generated from bradient.pro. diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/hardwareintegration/CMakeLists.txt index 504a8bd08e9..362697197ec 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/CMakeLists.txt +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/CMakeLists.txt @@ -1,5 +1,5 @@ # Copyright (C) 2022 The Qt Company Ltd. -# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +# SPDX-License-Identifier: BSD-3-Clause # Generated from client.pro. diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/CMakeLists.txt index acc61c3d45a..90df10d8bdc 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/CMakeLists.txt +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/CMakeLists.txt @@ -1,5 +1,5 @@ # Copyright (C) 2022 The Qt Company Ltd. -# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +# SPDX-License-Identifier: BSD-3-Clause # Generated from brcm-egl.pro. diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/dmabuf-server/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/hardwareintegration/dmabuf-server/CMakeLists.txt index b77cb8acd6c..e20820e3b4f 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/dmabuf-server/CMakeLists.txt +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/dmabuf-server/CMakeLists.txt @@ -1,5 +1,5 @@ # Copyright (C) 2022 The Qt Company Ltd. -# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +# SPDX-License-Identifier: BSD-3-Clause # Generated from dmabuf-server.pro. diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/drm-egl-server/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/hardwareintegration/drm-egl-server/CMakeLists.txt index 0a744b37fd9..124c7202686 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/drm-egl-server/CMakeLists.txt +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/drm-egl-server/CMakeLists.txt @@ -1,5 +1,5 @@ # Copyright (C) 2022 The Qt Company Ltd. -# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +# SPDX-License-Identifier: BSD-3-Clause # Generated from drm-egl-server.pro. diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/libhybris-egl-server/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/hardwareintegration/libhybris-egl-server/CMakeLists.txt index c4bb350043b..6bf74c1461f 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/libhybris-egl-server/CMakeLists.txt +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/libhybris-egl-server/CMakeLists.txt @@ -1,5 +1,5 @@ # Copyright (C) 2022 The Qt Company Ltd. -# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +# SPDX-License-Identifier: BSD-3-Clause # Generated from libhybris-egl-server.pro. diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/shm-emulation-server/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/hardwareintegration/shm-emulation-server/CMakeLists.txt index 5c5ca784eee..81ff77bab6f 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/shm-emulation-server/CMakeLists.txt +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/shm-emulation-server/CMakeLists.txt @@ -1,5 +1,5 @@ # Copyright (C) 2022 The Qt Company Ltd. -# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +# SPDX-License-Identifier: BSD-3-Clause # Generated from shm-emulation-server.pro. diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/vulkan-server/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/hardwareintegration/vulkan-server/CMakeLists.txt index 25faabd7a45..825b85adbe5 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/vulkan-server/CMakeLists.txt +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/vulkan-server/CMakeLists.txt @@ -1,5 +1,5 @@ # Copyright (C) 2022 The Qt Company Ltd. -# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +# SPDX-License-Identifier: BSD-3-Clause # Generated from vulkan-server.pro. diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/CMakeLists.txt index 81bca4ea48a..61ee4ea9f8a 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/CMakeLists.txt +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/CMakeLists.txt @@ -1,5 +1,5 @@ # Copyright (C) 2022 The Qt Company Ltd. -# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +# SPDX-License-Identifier: BSD-3-Clause # Generated from wayland-egl.pro. diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/shellintegration/CMakeLists.txt index 7a32cee8f36..35967baf167 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/CMakeLists.txt +++ b/src/plugins/platforms/wayland/plugins/shellintegration/CMakeLists.txt @@ -1,5 +1,5 @@ # Copyright (C) 2022 The Qt Company Ltd. -# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +# SPDX-License-Identifier: BSD-3-Clause # Generated from shellintegration.pro. diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/fullscreen-shell-v1/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/shellintegration/fullscreen-shell-v1/CMakeLists.txt index a127c90782b..7413bcdf547 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/fullscreen-shell-v1/CMakeLists.txt +++ b/src/plugins/platforms/wayland/plugins/shellintegration/fullscreen-shell-v1/CMakeLists.txt @@ -1,5 +1,5 @@ # Copyright (C) 2022 The Qt Company Ltd. -# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +# SPDX-License-Identifier: BSD-3-Clause # Generated from fullscreen-shell-v1.pro. diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/CMakeLists.txt index 64d69c57867..5bb4144b512 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/CMakeLists.txt +++ b/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/CMakeLists.txt @@ -1,5 +1,5 @@ # Copyright (C) 2022 The Qt Company Ltd. -# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +# SPDX-License-Identifier: BSD-3-Clause # Generated from wl-shell.pro. diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/CMakeLists.txt index df691d55006..a33a28a7e2a 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/CMakeLists.txt +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/CMakeLists.txt @@ -1,5 +1,5 @@ # Copyright (C) 2022 The Qt Company Ltd. -# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +# SPDX-License-Identifier: BSD-3-Clause # Generated from xdg-shell.pro. diff --git a/src/tools/qtwaylandscanner/CMakeLists.txt b/src/tools/qtwaylandscanner/CMakeLists.txt index 1882145095e..0bd91387ed4 100644 --- a/src/tools/qtwaylandscanner/CMakeLists.txt +++ b/src/tools/qtwaylandscanner/CMakeLists.txt @@ -1,5 +1,5 @@ # Copyright (C) 2022 The Qt Company Ltd. -# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +# SPDX-License-Identifier: BSD-3-Clause # Generated from qtwaylandscanner.pro. diff --git a/src/tools/qtwaylandscanner/Qt6WaylandClientMacros.cmake b/src/tools/qtwaylandscanner/Qt6WaylandClientMacros.cmake index 1bb47200095..f8cdc67fad7 100644 --- a/src/tools/qtwaylandscanner/Qt6WaylandClientMacros.cmake +++ b/src/tools/qtwaylandscanner/Qt6WaylandClientMacros.cmake @@ -1,5 +1,5 @@ # Copyright (C) 2022 The Qt Company Ltd. -# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +# SPDX-License-Identifier: BSD-3-Clause function(qt6_generate_wayland_protocol_client_sources target) cmake_parse_arguments(arg "" "__QT_INTERNAL_WAYLAND_INCLUDE_DIR" "FILES" ${ARGN}) diff --git a/src/tools/qtwaylandscanner/Qt6WaylandCompositorMacros.cmake b/src/tools/qtwaylandscanner/Qt6WaylandCompositorMacros.cmake index d6d44c1c4bf..cce2073ca1c 100644 --- a/src/tools/qtwaylandscanner/Qt6WaylandCompositorMacros.cmake +++ b/src/tools/qtwaylandscanner/Qt6WaylandCompositorMacros.cmake @@ -1,5 +1,5 @@ # Copyright (C) 2022 The Qt Company Ltd. -# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +# SPDX-License-Identifier: BSD-3-Clause function(qt6_generate_wayland_protocol_server_sources target) cmake_parse_arguments(arg "" "__QT_INTERNAL_WAYLAND_INCLUDE_DIR" "FILES" ${ARGN}) diff --git a/tests/auto/cmake/test_waylandclient/CMakeLists.txt b/tests/auto/cmake/test_waylandclient/CMakeLists.txt index 785f9e17d5f..78fd6e3a292 100644 --- a/tests/auto/cmake/test_waylandclient/CMakeLists.txt +++ b/tests/auto/cmake/test_waylandclient/CMakeLists.txt @@ -1,5 +1,5 @@ # Copyright (C) 2022 The Qt Company Ltd. -# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +# SPDX-License-Identifier: BSD-3-Clause project(test_plugins) diff --git a/tests/auto/wayland/CMakeLists.txt b/tests/auto/wayland/CMakeLists.txt index d23d58a5181..320cec64c72 100644 --- a/tests/auto/wayland/CMakeLists.txt +++ b/tests/auto/wayland/CMakeLists.txt @@ -1,5 +1,5 @@ # Copyright (C) 2022 The Qt Company Ltd. -# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +# SPDX-License-Identifier: BSD-3-Clause # Generated from client.pro. diff --git a/tests/auto/wayland/client/CMakeLists.txt b/tests/auto/wayland/client/CMakeLists.txt index e32b3b7b231..c6495eb6bb7 100644 --- a/tests/auto/wayland/client/CMakeLists.txt +++ b/tests/auto/wayland/client/CMakeLists.txt @@ -1,5 +1,5 @@ # Copyright (C) 2022 The Qt Company Ltd. -# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +# SPDX-License-Identifier: BSD-3-Clause # Generated from client.pro. diff --git a/tests/auto/wayland/clientextension/CMakeLists.txt b/tests/auto/wayland/clientextension/CMakeLists.txt index 462130ad126..4997b7d7732 100644 --- a/tests/auto/wayland/clientextension/CMakeLists.txt +++ b/tests/auto/wayland/clientextension/CMakeLists.txt @@ -1,5 +1,5 @@ # Copyright (C) 2022 The Qt Company Ltd. -# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +# SPDX-License-Identifier: BSD-3-Clause qt_internal_add_test(tst_clientextension SOURCES diff --git a/tests/auto/wayland/datadevicev1/CMakeLists.txt b/tests/auto/wayland/datadevicev1/CMakeLists.txt index 500048fd238..cfc2f5beb91 100644 --- a/tests/auto/wayland/datadevicev1/CMakeLists.txt +++ b/tests/auto/wayland/datadevicev1/CMakeLists.txt @@ -1,5 +1,5 @@ # Copyright (C) 2022 The Qt Company Ltd. -# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +# SPDX-License-Identifier: BSD-3-Clause # Generated from datadevicev1.pro. diff --git a/tests/auto/wayland/fullscreenshellv1/CMakeLists.txt b/tests/auto/wayland/fullscreenshellv1/CMakeLists.txt index 882e426d535..7bc14c50d04 100644 --- a/tests/auto/wayland/fullscreenshellv1/CMakeLists.txt +++ b/tests/auto/wayland/fullscreenshellv1/CMakeLists.txt @@ -1,5 +1,5 @@ # Copyright (C) 2022 The Qt Company Ltd. -# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +# SPDX-License-Identifier: BSD-3-Clause # Generated from fullscreenshellv1.pro. diff --git a/tests/auto/wayland/inputcontext/CMakeLists.txt b/tests/auto/wayland/inputcontext/CMakeLists.txt index c18159bbb88..66e5ca825fc 100644 --- a/tests/auto/wayland/inputcontext/CMakeLists.txt +++ b/tests/auto/wayland/inputcontext/CMakeLists.txt @@ -1,5 +1,5 @@ # Copyright (C) 2022 The Qt Company Ltd. -# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +# SPDX-License-Identifier: BSD-3-Clause # Generated from inputcontext.pro. diff --git a/tests/auto/wayland/multithreaded/CMakeLists.txt b/tests/auto/wayland/multithreaded/CMakeLists.txt index 0c2ee2047b1..62d93590517 100644 --- a/tests/auto/wayland/multithreaded/CMakeLists.txt +++ b/tests/auto/wayland/multithreaded/CMakeLists.txt @@ -1,5 +1,5 @@ # Copyright (C) 2022 The Qt Company Ltd. -# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +# SPDX-License-Identifier: BSD-3-Clause # Generated from multithreaded.pro. diff --git a/tests/auto/wayland/nooutput/CMakeLists.txt b/tests/auto/wayland/nooutput/CMakeLists.txt index 53459539ac6..eeee5790953 100644 --- a/tests/auto/wayland/nooutput/CMakeLists.txt +++ b/tests/auto/wayland/nooutput/CMakeLists.txt @@ -1,5 +1,5 @@ # Copyright (C) 2022 The Qt Company Ltd. -# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +# SPDX-License-Identifier: BSD-3-Clause # Generated from nooutput.pro. diff --git a/tests/auto/wayland/output/CMakeLists.txt b/tests/auto/wayland/output/CMakeLists.txt index 905b05a68b7..a9c5cea3c74 100644 --- a/tests/auto/wayland/output/CMakeLists.txt +++ b/tests/auto/wayland/output/CMakeLists.txt @@ -1,5 +1,5 @@ # Copyright (C) 2022 The Qt Company Ltd. -# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +# SPDX-License-Identifier: BSD-3-Clause # Generated from output.pro. diff --git a/tests/auto/wayland/primaryselectionv1/CMakeLists.txt b/tests/auto/wayland/primaryselectionv1/CMakeLists.txt index 83982dc5544..0235ae33ef5 100644 --- a/tests/auto/wayland/primaryselectionv1/CMakeLists.txt +++ b/tests/auto/wayland/primaryselectionv1/CMakeLists.txt @@ -1,5 +1,5 @@ # Copyright (C) 2022 The Qt Company Ltd. -# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +# SPDX-License-Identifier: BSD-3-Clause # Generated from primaryselectionv1.pro. diff --git a/tests/auto/wayland/seat/CMakeLists.txt b/tests/auto/wayland/seat/CMakeLists.txt index 82bc107e802..0ac9ec49f9d 100644 --- a/tests/auto/wayland/seat/CMakeLists.txt +++ b/tests/auto/wayland/seat/CMakeLists.txt @@ -1,5 +1,5 @@ # Copyright (C) 2022 The Qt Company Ltd. -# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +# SPDX-License-Identifier: BSD-3-Clause # Generated from seatv5.pro. diff --git a/tests/auto/wayland/seatv4/CMakeLists.txt b/tests/auto/wayland/seatv4/CMakeLists.txt index 6a3327f295f..c4e3ecba1eb 100644 --- a/tests/auto/wayland/seatv4/CMakeLists.txt +++ b/tests/auto/wayland/seatv4/CMakeLists.txt @@ -1,5 +1,5 @@ # Copyright (C) 2022 The Qt Company Ltd. -# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +# SPDX-License-Identifier: BSD-3-Clause # Generated from seatv4.pro. diff --git a/tests/auto/wayland/shared/CMakeLists.txt b/tests/auto/wayland/shared/CMakeLists.txt index 458b4f5e486..653927f050e 100644 --- a/tests/auto/wayland/shared/CMakeLists.txt +++ b/tests/auto/wayland/shared/CMakeLists.txt @@ -1,5 +1,5 @@ # Copyright (C) 2022 The Qt Company Ltd. -# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +# SPDX-License-Identifier: BSD-3-Clause ##################################################################### ##Client test shared components: diff --git a/tests/auto/wayland/surface/CMakeLists.txt b/tests/auto/wayland/surface/CMakeLists.txt index b38b5abe5bf..b175a5331e9 100644 --- a/tests/auto/wayland/surface/CMakeLists.txt +++ b/tests/auto/wayland/surface/CMakeLists.txt @@ -1,5 +1,5 @@ # Copyright (C) 2022 The Qt Company Ltd. -# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +# SPDX-License-Identifier: BSD-3-Clause # Generated from surface.pro. diff --git a/tests/auto/wayland/tabletv2/CMakeLists.txt b/tests/auto/wayland/tabletv2/CMakeLists.txt index c884a376896..1400a511a96 100644 --- a/tests/auto/wayland/tabletv2/CMakeLists.txt +++ b/tests/auto/wayland/tabletv2/CMakeLists.txt @@ -1,5 +1,5 @@ # Copyright (C) 2022 The Qt Company Ltd. -# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +# SPDX-License-Identifier: BSD-3-Clause # Generated from tabletv2.pro. diff --git a/tests/auto/wayland/wl_connect/CMakeLists.txt b/tests/auto/wayland/wl_connect/CMakeLists.txt index 9c7a106869b..fff3835bbaa 100644 --- a/tests/auto/wayland/wl_connect/CMakeLists.txt +++ b/tests/auto/wayland/wl_connect/CMakeLists.txt @@ -1,5 +1,5 @@ # Copyright (C) 2022 The Qt Company Ltd. -# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +# SPDX-License-Identifier: BSD-3-Clause # Generated from wl_connect.pro. diff --git a/tests/auto/wayland/xdgdecorationv1/CMakeLists.txt b/tests/auto/wayland/xdgdecorationv1/CMakeLists.txt index eb4c3ca1bd6..0f727aaca27 100644 --- a/tests/auto/wayland/xdgdecorationv1/CMakeLists.txt +++ b/tests/auto/wayland/xdgdecorationv1/CMakeLists.txt @@ -1,5 +1,5 @@ # Copyright (C) 2022 The Qt Company Ltd. -# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +# SPDX-License-Identifier: BSD-3-Clause # Generated from xdgdecorationv1.pro. diff --git a/tests/auto/wayland/xdgoutput/CMakeLists.txt b/tests/auto/wayland/xdgoutput/CMakeLists.txt index 1d27be86454..123a78f8e51 100644 --- a/tests/auto/wayland/xdgoutput/CMakeLists.txt +++ b/tests/auto/wayland/xdgoutput/CMakeLists.txt @@ -1,5 +1,5 @@ # Copyright (C) 2022 The Qt Company Ltd. -# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +# SPDX-License-Identifier: BSD-3-Clause # Generated from xdgoutput.pro. diff --git a/tests/auto/wayland/xdgshell/CMakeLists.txt b/tests/auto/wayland/xdgshell/CMakeLists.txt index 08efc9dca71..fa759024954 100644 --- a/tests/auto/wayland/xdgshell/CMakeLists.txt +++ b/tests/auto/wayland/xdgshell/CMakeLists.txt @@ -1,5 +1,5 @@ # Copyright (C) 2022 The Qt Company Ltd. -# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +# SPDX-License-Identifier: BSD-3-Clause # Generated from xdgshell.pro. From 9631d9f27a7bc3091300a65a7fb49da725d9c488 Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Fri, 5 Aug 2022 15:00:31 +0100 Subject: [PATCH 1103/1507] Client: clear focus on touch cancel When we get a touch_cancel event all touches should be treated as lifted. The next frame call focus is set, with no pending touch points but without having gone through touch_up. We call mPendingTouchPoints.last() without guards even though it is potentially now empty. Change-Id: I3719f9507c5d397d8641692271d878076b7c23b8 Reviewed-by: Shawn Rutledge Reviewed-by: Liang Qi Reviewed-by: Eskil Abrahamsen Blomfeldt --- .../platforms/wayland/qwaylandinputdevice.cpp | 1 + tests/auto/wayland/seat/tst_seat.cpp | 30 +++++++++++++++++++ tests/auto/wayland/shared/coreprotocol.cpp | 7 +++++ tests/auto/wayland/shared/coreprotocol.h | 1 + 4 files changed, 39 insertions(+) diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index c531699a604..9ff63b3b56a 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -1412,6 +1412,7 @@ void QWaylandInputDevice::Touch::touch_cancel() if (touchExt) touchExt->touchCanceled(); + mFocus = nullptr; QWindowSystemInterface::handleTouchCancelEvent(nullptr, mParent->mTouchDevice); } diff --git a/tests/auto/wayland/seat/tst_seat.cpp b/tests/auto/wayland/seat/tst_seat.cpp index dd52789b4da..0b1e1b2a2cb 100644 --- a/tests/auto/wayland/seat/tst_seat.cpp +++ b/tests/auto/wayland/seat/tst_seat.cpp @@ -50,6 +50,7 @@ private slots: void multiTouch(); void multiTouchUpAndMotionFrame(); void tapAndMoveInSameFrame(); + void cancelTouch(); }; void tst_seat::bindsToSeat() @@ -633,5 +634,34 @@ void tst_seat::tapAndMoveInSameFrame() QTRY_COMPARE(window.m_events.last().touchPoints.first().state(), QEventPoint::State::Released); } +void tst_seat::cancelTouch() +{ + TouchWindow window; + QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial); + + exec([=] { + auto *t = touch(); + auto *c = client(); + t->sendDown(xdgToplevel()->surface(), {32, 32}, 1); + t->sendFrame(c); + t->sendCancel(c); + t->sendFrame(c); + }); + + QTRY_VERIFY(!window.m_events.empty()); + { + auto e = window.m_events.takeFirst(); + QCOMPARE(e.type, QEvent::TouchBegin); + QCOMPARE(e.touchPointStates, QEventPoint::State::Pressed); + QCOMPARE(e.touchPoints.length(), 1); + QCOMPARE(e.touchPoints.first().position(), QPointF(32-window.frameMargins().left(), 32-window.frameMargins().top())); + } + { + auto e = window.m_events.takeFirst(); + QCOMPARE(e.type, QEvent::TouchCancel); + QCOMPARE(e.touchPoints.length(), 0); + } +} + QCOMPOSITOR_TEST_MAIN(tst_seat) #include "tst_seat.moc" diff --git a/tests/auto/wayland/shared/coreprotocol.cpp b/tests/auto/wayland/shared/coreprotocol.cpp index 5a59938de10..88b8cb59830 100644 --- a/tests/auto/wayland/shared/coreprotocol.cpp +++ b/tests/auto/wayland/shared/coreprotocol.cpp @@ -493,6 +493,13 @@ void Touch::sendFrame(wl_client *client) send_frame(r->handle); } +void Touch::sendCancel(wl_client *client) +{ + const auto touchResources = resourceMap().values(client); + for (auto *r : touchResources) + send_cancel(r->handle); +} + uint Keyboard::sendEnter(Surface *surface) { auto serial = m_seat->m_compositor->nextSerial(); diff --git a/tests/auto/wayland/shared/coreprotocol.h b/tests/auto/wayland/shared/coreprotocol.h index e43451cea79..77ef3cd465f 100644 --- a/tests/auto/wayland/shared/coreprotocol.h +++ b/tests/auto/wayland/shared/coreprotocol.h @@ -379,6 +379,7 @@ public: uint sendUp(wl_client *client, int id); void sendMotion(wl_client *client, const QPointF &position, int id); void sendFrame(wl_client *client); + void sendCancel(wl_client *client); Seat *m_seat = nullptr; }; From ae732f333d58b1d47e7bb1e1f874557826062df8 Mon Sep 17 00:00:00 2001 From: Alexandros Frantzis Date: Wed, 11 May 2022 17:12:52 +0300 Subject: [PATCH 1104/1507] Use CRLF line delimiter for text/uri-list data According to RFC 2483, which describes text/uri-list, the line delimiter must be CRLF (instead of the currently used LF). Some applications strictly expect the CRLF delimiter and fail to properly parse the uri-list otherwise (e.g., WineX11/XWayland). https://datatracker.ietf.org/doc/html/rfc2483 5. The text/uri-list Internet Media Type The format of text/uri-list resources is: 3) As for all text/* formats, lines are terminated with a CRLF pair. Pick-to: 6.4 6.3 6.2 5.15 Change-Id: I7c062224a9060028ab6293fdf172692ade28cca5 Reviewed-by: David Edmundson --- src/plugins/platforms/wayland/shared/qwaylandmimehelper.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/shared/qwaylandmimehelper.cpp b/src/plugins/platforms/wayland/shared/qwaylandmimehelper.cpp index 86d50b02a58..f589666c1ec 100644 --- a/src/plugins/platforms/wayland/shared/qwaylandmimehelper.cpp +++ b/src/plugins/platforms/wayland/shared/qwaylandmimehelper.cpp @@ -38,7 +38,7 @@ QByteArray QWaylandMimeHelper::getByteArray(QMimeData *mimeData, const QString & QList urls = mimeData->urls(); for (int i = 0; i < urls.count(); ++i) { content.append(urls.at(i).toEncoded()); - content.append('\n'); + content.append("\r\n"); } } else { content = mimeData->data(mimeType); From 2653ed97616a95f607e6327ef505de0129fdc734 Mon Sep 17 00:00:00 2001 From: Janne Juntunen Date: Thu, 15 Sep 2022 12:36:47 +0300 Subject: [PATCH 1105/1507] Client: skip building tests which cannot be run on webOS WebOS developers have informed us via QTBUG-106114 that opening multiple (consecutive) windows from single webOS-QtWayland client is not supported and majority of our test cases try to do exactly that, causing a segmentation fault. Therefore we need to skip these tests. Fixes: QTBUG-106638 Pick-to: 6.4 Change-Id: Ifbdb2cfb663f8eccd3d68e30445e2a0f39b11355 Reviewed-by: Alexandru Croitor --- tests/auto/wayland/CMakeLists.txt | 36 +++++++++++++++++-------------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/tests/auto/wayland/CMakeLists.txt b/tests/auto/wayland/CMakeLists.txt index 320cec64c72..dd5c6e5bd30 100644 --- a/tests/auto/wayland/CMakeLists.txt +++ b/tests/auto/wayland/CMakeLists.txt @@ -5,23 +5,27 @@ add_subdirectory(shared) -add_subdirectory(client) -add_subdirectory(clientextension) -add_subdirectory(datadevicev1) -add_subdirectory(fullscreenshellv1) -add_subdirectory(iviapplication) +# webOS has a modified version of QtWayland and does not support e.g. multiple window creation +# in a single client, attempting to do so will cause a segmentation fault +if (NOT WEBOS) + add_subdirectory(client) + add_subdirectory(clientextension) + add_subdirectory(datadevicev1) + add_subdirectory(fullscreenshellv1) + add_subdirectory(iviapplication) + add_subdirectory(nooutput) + add_subdirectory(output) + add_subdirectory(primaryselectionv1) + add_subdirectory(seatv4) + add_subdirectory(seat) + add_subdirectory(surface) + add_subdirectory(tabletv2) + add_subdirectory(wl_connect) + add_subdirectory(xdgdecorationv1) + add_subdirectory(xdgoutput) + add_subdirectory(xdgshell) +endif() add_subdirectory(multithreaded) -add_subdirectory(nooutput) -add_subdirectory(output) -add_subdirectory(primaryselectionv1) -add_subdirectory(seatv4) -add_subdirectory(seat) -add_subdirectory(surface) -add_subdirectory(tabletv2) -add_subdirectory(wl_connect) -add_subdirectory(xdgdecorationv1) -add_subdirectory(xdgoutput) -add_subdirectory(xdgshell) if(QT_FEATURE_im) add_subdirectory(inputcontext) endif() From 0b0788c824f1c0404a28d5cbccfbb05b0286eb36 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Mon, 8 Aug 2022 03:41:59 +0400 Subject: [PATCH 1106/1507] Client: fix enlargening window position by margins size In a7bb7210ac76a397b4aec8d8f32d902dc932d855 it was changed to sum the current geometry with the margins. This makes Qt thinking that the window is moving on every configure request and makes the previous fix (b25af2c7687b5802b48076ba1a885cc986084629) actually no-op I'm not sure why it was changed as the commit is squashed, but I hope the intention wasn't to make Qt think the window is endlessly moving (exactly that happened though) Pick-to: 6.4 6.3 Change-Id: I7cde12ea5548d59810e2631be2a0085f86d5c4b9 Reviewed-by: David Edmundson --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 9c6ce91a825..001f99d02ae 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -412,8 +412,7 @@ void QWaylandWindow::resizeFromApplyConfigure(const QSize &sizeWithMargins, cons int widthWithoutMargins = qMax(sizeWithMargins.width() - (margins.left() + margins.right()), 1); int heightWithoutMargins = qMax(sizeWithMargins.height() - (margins.top() + margins.bottom()), 1); - QRect geometry(windowGeometry().topLeft() + QPoint(margins.left(), margins.top()), - QSize(widthWithoutMargins, heightWithoutMargins)); + QRect geometry(windowGeometry().topLeft(), QSize(widthWithoutMargins, heightWithoutMargins)); mOffset += offset; mInResizeFromApplyConfigure = true; From a0dd7d52b941a0e544a1e823415a166150265fbf Mon Sep 17 00:00:00 2001 From: Fushan Wen Date: Sun, 18 Sep 2022 18:17:18 +0800 Subject: [PATCH 1107/1507] Call `finishDrag()` in `QWaylandDataDevice::dragSourceCancelled()` Drags can either get finished or cancelled. If a drag is finished successfully we call finish on the QBasicDrag instance, which quits the nested event loop. This patch adds the connection for cancelled drags. See also: https://bugs.kde.org/show_bug.cgi?id=446111 Pick-to: 6.4 6.2 5.15 Change-Id: Ib93040648da88a433d647c87adcb7a7fabcaef6c Reviewed-by: Liang Qi --- src/plugins/platforms/wayland/qwaylanddatadevice.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/plugins/platforms/wayland/qwaylanddatadevice.cpp b/src/plugins/platforms/wayland/qwaylanddatadevice.cpp index 6034cd60ed8..a7014f7a1a5 100644 --- a/src/plugins/platforms/wayland/qwaylanddatadevice.cpp +++ b/src/plugins/platforms/wayland/qwaylanddatadevice.cpp @@ -261,6 +261,7 @@ void QWaylandDataDevice::selectionSourceCancelled() #if QT_CONFIG(draganddrop) void QWaylandDataDevice::dragSourceCancelled() { + static_cast(QGuiApplicationPrivate::platformIntegration()->drag())->finishDrag(); m_dragSource.reset(); } From ece18f7ce26fe60b8b65ea5c334efe40a9747759 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kai=20K=C3=B6hne?= Date: Tue, 27 Sep 2022 15:44:36 +0200 Subject: [PATCH 1108/1507] Fix qt_attribution.json file Fixes File ./qtwayland/src/3rdparty/protocol/qt_attribution.json: Unknown key File. File ./qtwayland/src/3rdparty/protocol/qt_attribution.json: Unknown key License file. Could not parse file ./qtwayland/src/3rdparty/protocol/qt_attribution.json: object is missing after a comma Pick-to: 6.4.0 6.4 Change-Id: I145f9bcc40f175f5d909f7f947c2a20333b70c0c Reviewed-by: Jani Heikkinen --- src/3rdparty/wayland/protocols/qt_attribution.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/3rdparty/wayland/protocols/qt_attribution.json b/src/3rdparty/wayland/protocols/qt_attribution.json index 76d8d3f0407..7b81d551592 100644 --- a/src/3rdparty/wayland/protocols/qt_attribution.json +++ b/src/3rdparty/wayland/protocols/qt_attribution.json @@ -224,15 +224,15 @@ "Name": "Wayland Text Input Protocol v1", "QDocModule": "qtwaylandcompositor", "QtUsage": "Used in the Qt Wayland platform plugin", - "File": "text-input-unstable-v1.xml", + "Files": "text-input-unstable-v1.xml", "Description": "Adds support for text input and input methods to applications running on Wayland servers that only support text-input-unstable-v1.", "Homepage": "https://wayland.freedesktop.org", "Version": "unstable v1", "DownloadLocation": "https://gitlab.freedesktop.org/wayland/wayland-protocols/-/blob/main/unstable/text-input/text-input-unstable-v1.xml", "LicenseId": "MIT", - "License": "MIT LIcense", - "License file": "MIT_LICENSE.txt", + "License": "MIT License", + "LicenseFile": "MIT_LICENSE.txt", "Copyright": "Copyright © 2012, 2013 Intel Corporation" }, @@ -318,5 +318,5 @@ "License": "MIT License", "LicenseFile": "MIT_LICENSE.txt", "Copyright": "Copyright © 2015-2016 Red Hat Inc." - }, + } ] From bebf43bcc8d4cda22fb0354af432acf7f57edf45 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Thu, 6 Oct 2022 07:07:55 +0200 Subject: [PATCH 1109/1507] Replace qExchange with std::exchange None of these users require C++20 constexpr or C++23 noexcept, the only remaining difference between std::exchange and qExchange. Task-number: QTBUG-99313 Change-Id: Ic5a0bd36d715af2cbc5f9936fdff665ee6eeea4e Reviewed-by: Fabian Kosmale Reviewed-by: David Edmundson --- src/plugins/platforms/wayland/qwaylanddisplay.cpp | 4 ++-- tests/auto/wayland/shared/coreprotocol.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index 2d82f447ac4..275a4a1441f 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -345,9 +345,9 @@ QWaylandDisplay::~QWaylandDisplay(void) if (mSyncCallback) wl_callback_destroy(mSyncCallback); - qDeleteAll(qExchange(mInputDevices, {})); + qDeleteAll(std::exchange(mInputDevices, {})); - for (QWaylandScreen *screen : qExchange(mScreens, {})) { + for (QWaylandScreen *screen : std::exchange(mScreens, {})) { QWindowSystemInterface::handleScreenRemoved(screen); } qDeleteAll(mWaitingScreens); diff --git a/tests/auto/wayland/shared/coreprotocol.cpp b/tests/auto/wayland/shared/coreprotocol.cpp index 88b8cb59830..559ddbd7dca 100644 --- a/tests/auto/wayland/shared/coreprotocol.cpp +++ b/tests/auto/wayland/shared/coreprotocol.cpp @@ -109,7 +109,7 @@ void Surface::surface_commit(Resource *resource) } } - for (wl_resource *frameCallback : qExchange(m_frameCallbackList, {})) { + for (wl_resource *frameCallback : std::exchange(m_frameCallbackList, {})) { auto time = m_wlCompositor->m_compositor->currentTimeMilliseconds(); wl_callback_send_done(frameCallback, time); wl_resource_destroy(frameCallback); From b32c8dd49ebb0e759d64b83a456124be32d22e5d Mon Sep 17 00:00:00 2001 From: Luca Di Sera Date: Mon, 10 Oct 2022 08:11:34 +0200 Subject: [PATCH 1110/1507] Fix syncqt warnings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I739eb81ec78a071baa85d24f26bb45b184b9068c Reviewed-by: Topi Reiniö Reviewed-by: David Edmundson --- src/plugins/platforms/wayland/global/qwaylandclientextension.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/global/qwaylandclientextension.h b/src/plugins/platforms/wayland/global/qwaylandclientextension.h index b7c4a3239ea..8fe74e37902 100644 --- a/src/plugins/platforms/wayland/global/qwaylandclientextension.h +++ b/src/plugins/platforms/wayland/global/qwaylandclientextension.h @@ -4,7 +4,7 @@ #ifndef QWAYLANDCLIENTEXTENSION_H #define QWAYLANDCLIENTEXTENSION_H -#include +#include #include struct wl_interface; From 6c4ec81e6ebcae0f60a5f33d60b80edcc6bbdc5b Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Wed, 5 Oct 2022 08:20:36 +0200 Subject: [PATCH 1111/1507] Port from container::count() and length() to size() This is a semantic patch using ClangTidyTransformator as in qtbase/df9d882d41b741fef7c5beeddb0abe9d904443d8: auto QtContainerClass = anyOf( expr(hasType(cxxRecordDecl(isSameOrDerivedFrom(hasAnyName(classes))))).bind(o), expr(hasType(namedDecl(hasAnyName()))).bind(o)); makeRule(cxxMemberCallExpr(on(QtContainerClass), callee(cxxMethodDecl(hasAnyName({"count", "length"), parameterCountIs(0))))), changeTo(cat(access(o, cat("size"), "()"))), cat("use 'size()' instead of 'count()/length()'")) a.k.a qt-port-to-std-compatible-api with config Scope: 'Container', with the extended set of container classes recognized. Change-Id: I574208abc90a8042b500b3f96e3862b0ff339eb6 Reviewed-by: Qt CI Bot Reviewed-by: Ivan Solovev --- .../platforms/wayland/qwaylanddisplay.cpp | 4 +-- .../platforms/wayland/qwaylandscreen.cpp | 2 +- .../platforms/wayland/qwaylandtouch.cpp | 8 +++--- .../platforms/wayland/qwaylandwindow.cpp | 6 ++--- .../qwaylandinputmethodeventbuilder.cpp | 12 ++++----- .../wayland/shared/qwaylandmimehelper.cpp | 2 +- tests/auto/wayland/client/tst_client.cpp | 2 +- .../clientextension/tst_clientextension.cpp | 12 ++++----- .../wayland/datadevicev1/tst_datadevicev1.cpp | 2 +- .../tst_fullscreenshellv1.cpp | 2 +- .../wayland/inputcontext/tst_inputcontext.cpp | 8 +++--- .../tst_primaryselectionv1.cpp | 2 +- tests/auto/wayland/seat/tst_seat.cpp | 26 +++++++++---------- tests/auto/wayland/seatv4/tst_seatv4.cpp | 10 +++---- tests/auto/wayland/shared/mockcompositor.cpp | 2 +- tests/auto/wayland/surface/tst_surface.cpp | 16 ++++++------ tests/auto/wayland/xdgshell/tst_xdgshell.cpp | 12 ++++----- 17 files changed, 64 insertions(+), 64 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index 275a4a1441f..48331c5a4d0 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -610,7 +610,7 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin void QWaylandDisplay::registry_global_remove(uint32_t id) { - for (int i = 0, ie = mGlobals.count(); i != ie; ++i) { + for (int i = 0, ie = mGlobals.size(); i != ie; ++i) { RegistryGlobal &global = mGlobals[i]; if (global.id == id) { if (global.interface == QLatin1String(QtWayland::wl_output::interface()->name)) { @@ -677,7 +677,7 @@ void QWaylandDisplay::addRegistryListener(RegistryListener listener, void *data) { Listener l = { listener, data }; mRegistryListeners.append(l); - for (int i = 0, ie = mGlobals.count(); i != ie; ++i) + for (int i = 0, ie = mGlobals.size(); i != ie; ++i) (*l.listener)(l.data, mGlobals[i].registry, mGlobals[i].id, mGlobals[i].interface, mGlobals[i].version); } diff --git a/src/plugins/platforms/wayland/qwaylandscreen.cpp b/src/plugins/platforms/wayland/qwaylandscreen.cpp index 57bccde3805..fd56a252b93 100644 --- a/src/plugins/platforms/wayland/qwaylandscreen.cpp +++ b/src/plugins/platforms/wayland/qwaylandscreen.cpp @@ -148,7 +148,7 @@ QList QWaylandScreen::virtualSiblings() const const QList screens = mWaylandDisplay->screens(); auto *placeholder = mWaylandDisplay->placeholderScreen(); - list.reserve(screens.count() + (placeholder ? 1 : 0)); + list.reserve(screens.size() + (placeholder ? 1 : 0)); for (QWaylandScreen *screen : qAsConst(screens)) { if (screen->screen()) diff --git a/src/plugins/platforms/wayland/qwaylandtouch.cpp b/src/plugins/platforms/wayland/qwaylandtouch.cpp index 41dfd085539..a88947e07dd 100644 --- a/src/plugins/platforms/wayland/qwaylandtouch.cpp +++ b/src/plugins/platforms/wayland/qwaylandtouch.cpp @@ -107,12 +107,12 @@ void QWaylandTouchExtension::touch_extension_touch(uint32_t time, void QWaylandTouchExtension::sendTouchEvent() { // Copy all points, that are in the previous but not in the current list, as stationary. - for (int i = 0; i < mPrevTouchPoints.count(); ++i) { + for (int i = 0; i < mPrevTouchPoints.size(); ++i) { const QWindowSystemInterface::TouchPoint &prevPoint(mPrevTouchPoints.at(i)); if (prevPoint.state == QEventPoint::Released) continue; bool found = false; - for (int j = 0; j < mTouchPoints.count(); ++j) + for (int j = 0; j < mTouchPoints.size(); ++j) if (mTouchPoints.at(j).id == prevPoint.id) { found = true; break; @@ -132,14 +132,14 @@ void QWaylandTouchExtension::sendTouchEvent() QWindowSystemInterface::handleTouchEvent(mTargetWindow, mTimestamp, mTouchDevice, mTouchPoints); QEventPoint::States states = {}; - for (int i = 0; i < mTouchPoints.count(); ++i) + for (int i = 0; i < mTouchPoints.size(); ++i) states |= mTouchPoints.at(i).state; if (mFlags & QT_TOUCH_EXTENSION_FLAGS_MOUSE_FROM_TOUCH) { const bool firstPress = states == QEventPoint::Pressed; if (firstPress) mMouseSourceId = mTouchPoints.first().id; - for (int i = 0; i < mTouchPoints.count(); ++i) { + for (int i = 0; i < mTouchPoints.size(); ++i) { const QWindowSystemInterface::TouchPoint &tp(mTouchPoints.at(i)); if (tp.id == mMouseSourceId) { const bool released = tp.state == QEventPoint::Released; diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 001f99d02ae..73a14b89766 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -132,7 +132,7 @@ void QWaylandWindow::initWindow() mShellSurface->setAppId(fi.baseName()); } else { QString appId; - for (int i = 0; i < domainName.count(); ++i) + for (int i = 0; i < domainName.size(); ++i) appId.prepend(QLatin1Char('.')).prepend(domainName.at(i)); appId.append(fi.baseName()); mShellSurface->setAppId(appId); @@ -288,9 +288,9 @@ void QWaylandWindow::setWindowTitle(const QString &title) const int maxLength = libwaylandMaxBufferSize / 3 - 100; auto truncated = QStringView{formatted}.left(maxLength); - if (truncated.length() < formatted.length()) { + if (truncated.size() < formatted.size()) { qCWarning(lcQpaWayland) << "Window titles longer than" << maxLength << "characters are not supported." - << "Truncating window title (from" << formatted.length() << "chars)"; + << "Truncating window title (from" << formatted.size() << "chars)"; } mShellSurface->setTitle(truncated.toString()); } diff --git a/src/plugins/platforms/wayland/shared/qwaylandinputmethodeventbuilder.cpp b/src/plugins/platforms/wayland/shared/qwaylandinputmethodeventbuilder.cpp index 256a0c4230d..cfde26c76df 100644 --- a/src/plugins/platforms/wayland/shared/qwaylandinputmethodeventbuilder.cpp +++ b/src/plugins/platforms/wayland/shared/qwaylandinputmethodeventbuilder.cpp @@ -106,7 +106,7 @@ QInputMethodEvent *QWaylandInputMethodEventBuilder::buildCommit(const QString &t const int absoluteOffset = absoluteCursor - cursor; - const int cursorAfterCommit = qMin(anchor, cursor) + replacement.first + text.length(); + const int cursorAfterCommit = qMin(anchor, cursor) + replacement.first + text.size(); surrounding.replace(qMin(anchor, cursor) + replacement.first, qAbs(anchor - cursor) + replacement.second, text); @@ -278,10 +278,10 @@ int QWaylandInputMethodEventBuilder::indexFromWayland(const QString &text, int l if (length < 0) { const QByteArray &utf8 = QStringView{text}.left(base).toUtf8(); - return QString::fromUtf8(utf8.left(qMax(utf8.length() + length, 0))).length(); + return QString::fromUtf8(utf8.left(qMax(utf8.size() + length, 0))).size(); } else { const QByteArray &utf8 = QStringView{text}.mid(base).toUtf8(); - return QString::fromUtf8(utf8.left(length)).length() + base; + return QString::fromUtf8(utf8.left(length)).size() + base; } } @@ -304,20 +304,20 @@ int QWaylandInputMethodEventBuilder::trimmedIndexFromWayland(const QString &text const unsigned char ch = utf8.at(start + i); // check if current character is a utf8's initial character. if (ch < 0x80 || ch > 0xbf) - return QString::fromUtf8(utf8.left(start + i)).length(); + return QString::fromUtf8(utf8.left(start + i)).size(); } } else { const QByteArray &utf8 = QStringView{text}.mid(base).toUtf8(); const int len = utf8.size(); const int start = length; if (start >= len) - return base + QString::fromUtf8(utf8).length(); + return base + QString::fromUtf8(utf8).size(); for (int i = 0; i < 4; i++) { const unsigned char ch = utf8.at(start - i); // check if current character is a utf8's initial character. if (ch < 0x80 || ch > 0xbf) - return base + QString::fromUtf8(utf8.left(start - i)).length(); + return base + QString::fromUtf8(utf8.left(start - i)).size(); } } return -1; diff --git a/src/plugins/platforms/wayland/shared/qwaylandmimehelper.cpp b/src/plugins/platforms/wayland/shared/qwaylandmimehelper.cpp index f589666c1ec..3bbbad97b0b 100644 --- a/src/plugins/platforms/wayland/shared/qwaylandmimehelper.cpp +++ b/src/plugins/platforms/wayland/shared/qwaylandmimehelper.cpp @@ -36,7 +36,7 @@ QByteArray QWaylandMimeHelper::getByteArray(QMimeData *mimeData, const QString & content = qvariant_cast(mimeData->colorData()).name().toLatin1(); } else if (mimeType == QLatin1String("text/uri-list")) { QList urls = mimeData->urls(); - for (int i = 0; i < urls.count(); ++i) { + for (int i = 0; i < urls.size(); ++i) { content.append(urls.at(i).toEncoded()); content.append("\r\n"); } diff --git a/tests/auto/wayland/client/tst_client.cpp b/tests/auto/wayland/client/tst_client.cpp index 1c28832490a..db4eb77e451 100644 --- a/tests/auto/wayland/client/tst_client.cpp +++ b/tests/auto/wayland/client/tst_client.cpp @@ -590,7 +590,7 @@ void tst_WaylandClient::longWindowTitleWithUtf16Characters() { QWindow window; QString absurdlyLongTitle = QString("三").repeated(10000); - Q_ASSERT(absurdlyLongTitle.length() == 10000); // just making sure the test isn't broken + Q_ASSERT(absurdlyLongTitle.size() == 10000); // just making sure the test isn't broken window.setTitle(absurdlyLongTitle); window.show(); QCOMPOSITOR_TRY_VERIFY(surface()); diff --git a/tests/auto/wayland/clientextension/tst_clientextension.cpp b/tests/auto/wayland/clientextension/tst_clientextension.cpp index 209afa822c5..a6e79bd2ca2 100644 --- a/tests/auto/wayland/clientextension/tst_clientextension.cpp +++ b/tests/auto/wayland/clientextension/tst_clientextension.cpp @@ -69,10 +69,10 @@ void tst_clientextension::createWithoutGlobal() QSignalSpy spy(&extension, &QWaylandClientExtension::activeChanged); QVERIFY(spy.isValid()); QVERIFY(!extension.isActive()); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); extension.initialize(); QVERIFY(!extension.isActive()); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); } void tst_clientextension::createWithGlobalAutomatic() @@ -83,7 +83,7 @@ void tst_clientextension::createWithGlobalAutomatic() QSignalSpy spy(&extension, &QWaylandClientExtension::activeChanged); QVERIFY(spy.isValid()); QTRY_VERIFY(extension.isActive()); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); } void tst_clientextension::createWithGlobalManual() @@ -96,7 +96,7 @@ void tst_clientextension::createWithGlobalManual() QVERIFY(spy.isValid()); extension.initialize(); QVERIFY(extension.isActive()); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); } void tst_clientextension::globalBecomesAvailable() @@ -106,7 +106,7 @@ void tst_clientextension::globalBecomesAvailable() QVERIFY(spy.isValid()); exec([this] { add(); }); QTRY_VERIFY(extension.isActive()); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); } void tst_clientextension::globalRemoved() @@ -120,7 +120,7 @@ void tst_clientextension::globalRemoved() exec([this] { removeAll(); }); QTRY_VERIFY(!extension.isActive()); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); } QCOMPOSITOR_TEST_MAIN(tst_clientextension) diff --git a/tests/auto/wayland/datadevicev1/tst_datadevicev1.cpp b/tests/auto/wayland/datadevicev1/tst_datadevicev1.cpp index d4dfa2da046..d78255e9fc8 100644 --- a/tests/auto/wayland/datadevicev1/tst_datadevicev1.cpp +++ b/tests/auto/wayland/datadevicev1/tst_datadevicev1.cpp @@ -213,7 +213,7 @@ void tst_datadevicev1::destroysSelectionOnLeave() keyboard()->sendLeave(surface); }); - QTRY_COMPARE(dataChangedSpy.count(), 1); + QTRY_COMPARE(dataChangedSpy.size(), 1); QVERIFY(!QGuiApplication::clipboard()->mimeData(QClipboard::Clipboard)->hasText()); } diff --git a/tests/auto/wayland/fullscreenshellv1/tst_fullscreenshellv1.cpp b/tests/auto/wayland/fullscreenshellv1/tst_fullscreenshellv1.cpp index c48e5532b84..15613bc0485 100644 --- a/tests/auto/wayland/fullscreenshellv1/tst_fullscreenshellv1.cpp +++ b/tests/auto/wayland/fullscreenshellv1/tst_fullscreenshellv1.cpp @@ -25,7 +25,7 @@ void tst_WaylandClientFullScreenShellV1::createDestroyWindow() window.resize(800, 600); window.show(); - QCOMPOSITOR_TRY_VERIFY(fullScreenShellV1()->surfaces().count() == 1); + QCOMPOSITOR_TRY_VERIFY(fullScreenShellV1()->surfaces().size() == 1); QCOMPOSITOR_VERIFY(surface(0)); window.destroy(); diff --git a/tests/auto/wayland/inputcontext/tst_inputcontext.cpp b/tests/auto/wayland/inputcontext/tst_inputcontext.cpp index 9bcfa9e776c..328dc1fb217 100644 --- a/tests/auto/wayland/inputcontext/tst_inputcontext.cpp +++ b/tests/auto/wayland/inputcontext/tst_inputcontext.cpp @@ -36,9 +36,9 @@ private: { exec([&] { QList extensions = getAll(); - if (extensions.length() > 1) + if (extensions.size() > 1) QFAIL("Requested type is a singleton, hence there should not be more then one object returned"); - if (extensions.length() == 0) + if (extensions.size() == 0) add(); }); } @@ -48,9 +48,9 @@ private: { exec([&] { QList extensions = getAll(); - if (extensions.length() > 1) + if (extensions.size() > 1) QFAIL("Requested type is a singleton, hence there should not be more then one object returned"); - if (extensions.length() == 1) + if (extensions.size() == 1) remove(extensions.first()); }); } diff --git a/tests/auto/wayland/primaryselectionv1/tst_primaryselectionv1.cpp b/tests/auto/wayland/primaryselectionv1/tst_primaryselectionv1.cpp index d947d30064e..5ec046d1757 100644 --- a/tests/auto/wayland/primaryselectionv1/tst_primaryselectionv1.cpp +++ b/tests/auto/wayland/primaryselectionv1/tst_primaryselectionv1.cpp @@ -409,7 +409,7 @@ void tst_primaryselectionv1::destroysSelectionOnLeave() keyboard()->sendLeave(surface); }); - QTRY_COMPARE(selectionChangedSpy.count(), 1); + QTRY_COMPARE(selectionChangedSpy.size(), 1); QVERIFY(!QGuiApplication::clipboard()->mimeData(QClipboard::Selection)->hasText()); } diff --git a/tests/auto/wayland/seat/tst_seat.cpp b/tests/auto/wayland/seat/tst_seat.cpp index 0b1e1b2a2cb..68749486b43 100644 --- a/tests/auto/wayland/seat/tst_seat.cpp +++ b/tests/auto/wayland/seat/tst_seat.cpp @@ -94,7 +94,7 @@ void tst_seat::usesEnterSerial() }); QCOMPOSITOR_TRY_VERIFY(pointer()->cursorSurface()); - QTRY_COMPARE(setCursorSpy.count(), 1); + QTRY_COMPARE(setCursorSpy.size(), 1); QCOMPARE(setCursorSpy.takeFirst().at(0).toUInt(), enterSerial); } @@ -438,14 +438,14 @@ void tst_seat::singleTap() auto e = window.m_events.takeFirst(); QCOMPARE(e.type, QEvent::TouchBegin); QCOMPARE(e.touchPointStates, QEventPoint::State::Pressed); - QCOMPARE(e.touchPoints.length(), 1); + QCOMPARE(e.touchPoints.size(), 1); QCOMPARE(e.touchPoints.first().position(), QPointF(32-window.frameMargins().left(), 32-window.frameMargins().top())); } { auto e = window.m_events.takeFirst(); QCOMPARE(e.type, QEvent::TouchEnd); QCOMPARE(e.touchPointStates, QEventPoint::State::Released); - QCOMPARE(e.touchPoints.length(), 1); + QCOMPARE(e.touchPoints.size(), 1); QCOMPARE(e.touchPoints.first().position(), QPointF(32-window.frameMargins().left(), 32-window.frameMargins().top())); } } @@ -469,14 +469,14 @@ void tst_seat::singleTapFloat() auto e = window.m_events.takeFirst(); QCOMPARE(e.type, QEvent::TouchBegin); QCOMPARE(e.touchPointStates, QEventPoint::State::Pressed); - QCOMPARE(e.touchPoints.length(), 1); + QCOMPARE(e.touchPoints.size(), 1); QCOMPARE(e.touchPoints.first().position(), QPointF(32.75-window.frameMargins().left(), 32.25-window.frameMargins().top())); } { auto e = window.m_events.takeFirst(); QCOMPARE(e.type, QEvent::TouchEnd); QCOMPARE(e.touchPointStates, QEventPoint::State::Released); - QCOMPARE(e.touchPoints.length(), 1); + QCOMPARE(e.touchPoints.size(), 1); QCOMPARE(e.touchPoints.first().position(), QPointF(32.75-window.frameMargins().left(), 32.25-window.frameMargins().top())); } } @@ -512,7 +512,7 @@ void tst_seat::multiTouch() auto e = window.m_events.takeFirst(); QCOMPARE(e.type, QEvent::TouchBegin); QCOMPARE(e.touchPointStates, QEventPoint::State::Pressed); - QCOMPARE(e.touchPoints.length(), 2); + QCOMPARE(e.touchPoints.size(), 2); QCOMPARE(e.touchPoints[0].state(), QEventPoint::State::Pressed); QCOMPARE(e.touchPoints[0].position(), QPointF(32-window.frameMargins().left(), 32-window.frameMargins().top())); @@ -523,7 +523,7 @@ void tst_seat::multiTouch() { auto e = window.m_events.takeFirst(); QCOMPARE(e.type, QEvent::TouchUpdate); - QCOMPARE(e.touchPoints.length(), 2); + QCOMPARE(e.touchPoints.size(), 2); QCOMPARE(e.touchPoints[0].state(), QEventPoint::State::Updated); QCOMPARE(e.touchPoints[0].position(), QPointF(33-window.frameMargins().left(), 32-window.frameMargins().top())); @@ -535,7 +535,7 @@ void tst_seat::multiTouch() auto e = window.m_events.takeFirst(); QCOMPARE(e.type, QEvent::TouchUpdate); QCOMPARE(e.touchPointStates, QEventPoint::State::Released | QEventPoint::State::Stationary); - QCOMPARE(e.touchPoints.length(), 2); + QCOMPARE(e.touchPoints.size(), 2); QCOMPARE(e.touchPoints[0].state(), QEventPoint::State::Released); QCOMPARE(e.touchPoints[0].position(), QPointF(33-window.frameMargins().left(), 32-window.frameMargins().top())); @@ -547,7 +547,7 @@ void tst_seat::multiTouch() auto e = window.m_events.takeFirst(); QCOMPARE(e.type, QEvent::TouchEnd); QCOMPARE(e.touchPointStates, QEventPoint::State::Released); - QCOMPARE(e.touchPoints.length(), 1); + QCOMPARE(e.touchPoints.size(), 1); QCOMPARE(e.touchPoints[0].state(), QEventPoint::State::Released); QCOMPARE(e.touchPoints[0].position(), QPointF(49-window.frameMargins().left(), 48-window.frameMargins().top())); } @@ -589,14 +589,14 @@ void tst_seat::multiTouchUpAndMotionFrame() { auto e = window.m_events.takeFirst(); QCOMPARE(e.type, QEvent::TouchUpdate); - QCOMPARE(e.touchPoints.length(), 2); + QCOMPARE(e.touchPoints.size(), 2); QCOMPARE(e.touchPoints[0].state(), QEventPoint::State::Released); QCOMPARE(e.touchPoints[1].state(), QEventPoint::State::Updated); } { auto e = window.m_events.takeFirst(); QCOMPARE(e.type, QEvent::TouchEnd); - QCOMPARE(e.touchPoints.length(), 1); + QCOMPARE(e.touchPoints.size(), 1); QCOMPARE(e.touchPoints[0].state(), QEventPoint::State::Released); } QVERIFY(window.m_events.empty()); @@ -653,13 +653,13 @@ void tst_seat::cancelTouch() auto e = window.m_events.takeFirst(); QCOMPARE(e.type, QEvent::TouchBegin); QCOMPARE(e.touchPointStates, QEventPoint::State::Pressed); - QCOMPARE(e.touchPoints.length(), 1); + QCOMPARE(e.touchPoints.size(), 1); QCOMPARE(e.touchPoints.first().position(), QPointF(32-window.frameMargins().left(), 32-window.frameMargins().top())); } { auto e = window.m_events.takeFirst(); QCOMPARE(e.type, QEvent::TouchCancel); - QCOMPARE(e.touchPoints.length(), 0); + QCOMPARE(e.touchPoints.size(), 0); } } diff --git a/tests/auto/wayland/seatv4/tst_seatv4.cpp b/tests/auto/wayland/seatv4/tst_seatv4.cpp index 3a5a479fbd8..873b0ff6101 100644 --- a/tests/auto/wayland/seatv4/tst_seatv4.cpp +++ b/tests/auto/wayland/seatv4/tst_seatv4.cpp @@ -127,7 +127,7 @@ void tst_seatv4::usesEnterSerial() }); QCOMPOSITOR_TRY_VERIFY(cursorSurface()); - QTRY_COMPARE(setCursorSpy.count(), 1); + QTRY_COMPARE(setCursorSpy.size(), 1); QCOMPARE(setCursorSpy.takeFirst().at(0).toUInt(), enterSerial); } @@ -139,13 +139,13 @@ void tst_seatv4::focusDestruction() window.show(); QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial); // Setting a cursor now is not allowed since there has been no enter event - QCOMPARE(setCursorSpy.count(), 0); + QCOMPARE(setCursorSpy.size(), 0); uint enterSerial = exec([&] { return pointer()->sendEnter(xdgSurface()->m_surface, {32, 32}); }); QCOMPOSITOR_TRY_VERIFY(cursorSurface()); - QTRY_COMPARE(setCursorSpy.count(), 1); + QTRY_COMPARE(setCursorSpy.size(), 1); QCOMPARE(setCursorSpy.takeFirst().at(0).toUInt(), enterSerial); // Destroy the focus @@ -159,7 +159,7 @@ void tst_seatv4::focusDestruction() // Setting a cursor now is not allowed since there has been no enter event xdgPingAndWaitForPong(); - QCOMPARE(setCursorSpy.count(), 0); + QCOMPARE(setCursorSpy.size(), 0); } void tst_seatv4::mousePress() @@ -568,7 +568,7 @@ void tst_seatv4::animatedCursor() }); // Verify that we get a new cursor buffer - QTRY_COMPARE(bufferSpy.count(), 1); + QTRY_COMPARE(bufferSpy.size(), 1); } #endif // QT_CONFIG(cursor) diff --git a/tests/auto/wayland/shared/mockcompositor.cpp b/tests/auto/wayland/shared/mockcompositor.cpp index 03d0ffb6c57..1266f7762b2 100644 --- a/tests/auto/wayland/shared/mockcompositor.cpp +++ b/tests/auto/wayland/shared/mockcompositor.cpp @@ -92,7 +92,7 @@ void DefaultCompositor::xdgPingAndWaitForPong() { QSignalSpy pongSpy(exec([=] { return get(); }), &XdgWmBase::pong); uint serial = exec([=] { return sendXdgShellPing(); }); - QTRY_COMPARE(pongSpy.count(), 1); + QTRY_COMPARE(pongSpy.size(), 1); QTRY_COMPARE(pongSpy.first().at(0).toUInt(), serial); } diff --git a/tests/auto/wayland/surface/tst_surface.cpp b/tests/auto/wayland/surface/tst_surface.cpp index e834508615f..083bc4faa90 100644 --- a/tests/auto/wayland/surface/tst_surface.cpp +++ b/tests/auto/wayland/surface/tst_surface.cpp @@ -55,7 +55,7 @@ void tst_surface::waitForFrameCallbackRaster() exec([=] { xdgToplevel()->sendCompleteConfigure(); }); // We should get the first buffer without waiting for a frame callback - QTRY_COMPARE(bufferSpy.count(), 1); + QTRY_COMPARE(bufferSpy.size(), 1); bufferSpy.removeFirst(); // Make sure we follow frame callbacks for some frames @@ -66,7 +66,7 @@ void tst_surface::waitForFrameCallbackRaster() QVERIFY(!xdgToplevel()->surface()->m_waitingFrameCallbacks.empty()); xdgToplevel()->surface()->sendFrameCallbacks(); }); - QTRY_COMPARE(bufferSpy.count(), 1); + QTRY_COMPARE(bufferSpy.size(), 1); bufferSpy.removeFirst(); } } @@ -96,14 +96,14 @@ void tst_surface::waitForFrameCallbackGl() exec([=] { xdgToplevel()->sendCompleteConfigure(); }); // We should get the first buffer without waiting for a frame callback - QTRY_COMPARE(bufferSpy.count(), 1); + QTRY_COMPARE(bufferSpy.size(), 1); bufferSpy.removeFirst(); // Make sure we follow frame callbacks for some frames for (int i = 0; i < 5; ++i) { xdgPingAndWaitForPong(); // Make sure things have happened on the client if (!qEnvironmentVariableIntValue("QT_WAYLAND_DISABLE_WINDOWDECORATION") && i == 0) { - QCOMPARE(bufferSpy.count(), 1); + QCOMPARE(bufferSpy.size(), 1); bufferSpy.removeFirst(); } exec([&] { @@ -111,7 +111,7 @@ void tst_surface::waitForFrameCallbackGl() QVERIFY(!xdgToplevel()->surface()->m_waitingFrameCallbacks.empty()); xdgToplevel()->surface()->sendFrameCallbacks(); }); - QTRY_COMPARE(bufferSpy.count(), 1); + QTRY_COMPARE(bufferSpy.size(), 1); bufferSpy.removeFirst(); } } @@ -168,15 +168,15 @@ void tst_surface::createSubsurface() // Move subsurface. The parent should redraw and commit subWindow.setGeometry(100, 100, 64, 64); // the toplevel should commit to indicate the subsurface moved - QCOMPOSITOR_TRY_COMPARE(mainSurfaceCommitSpy.count(), 1); + QCOMPOSITOR_TRY_COMPARE(mainSurfaceCommitSpy.size(), 1); mainSurfaceCommitSpy.clear(); childSurfaceCommitSpy.clear(); // Move and resize the subSurface. The parent should redraw and commit // The child should also redraw subWindow.setGeometry(50, 50, 80, 80); - QCOMPOSITOR_TRY_COMPARE(mainSurfaceCommitSpy.count(), 1); - QCOMPOSITOR_TRY_COMPARE(childSurfaceCommitSpy.count(), 1); + QCOMPOSITOR_TRY_COMPARE(mainSurfaceCommitSpy.size(), 1); + QCOMPOSITOR_TRY_COMPARE(childSurfaceCommitSpy.size(), 1); } diff --git a/tests/auto/wayland/xdgshell/tst_xdgshell.cpp b/tests/auto/wayland/xdgshell/tst_xdgshell.cpp index 8d275e1ebcb..e560784e954 100644 --- a/tests/auto/wayland/xdgshell/tst_xdgshell.cpp +++ b/tests/auto/wayland/xdgshell/tst_xdgshell.cpp @@ -78,7 +78,7 @@ void tst_xdgshell::basicConfigure() QTRY_VERIFY(window.isExposed()); // The client is now going to ack the configure - QTRY_COMPARE(configureSpy.count(), 1); + QTRY_COMPARE(configureSpy.size(), 1); QCOMPARE(configureSpy.takeFirst().at(0).toUInt(), serial); // And attach a buffer @@ -104,7 +104,7 @@ void tst_xdgshell::configureSize() xdgToplevel()->sendCompleteConfigure(configureSize); }); - QTRY_COMPARE(configureSpy.count(), 1); + QTRY_COMPARE(configureSpy.size(), 1); exec([=] { Buffer *buffer = xdgToplevel()->surface()->m_committed.buffer; @@ -192,7 +192,7 @@ void tst_xdgshell::popup() QCOMPOSITOR_TRY_VERIFY(xdgToplevel()); QSignalSpy toplevelConfigureSpy(exec([=] { return xdgSurface(); }), &XdgSurface::configureCommitted); exec([=] { xdgToplevel()->sendCompleteConfigure(); }); - QTRY_COMPARE(toplevelConfigureSpy.count(), 1); + QTRY_COMPARE(toplevelConfigureSpy.size(), 1); uint clickSerial = exec([=] { auto *surface = xdgToplevel()->surface(); @@ -230,7 +230,7 @@ void tst_xdgshell::popup() QTRY_VERIFY(popup->isExposed()); // The client is now going to ack the configure - QTRY_COMPARE(popupConfigureSpy.count(), 1); + QTRY_COMPARE(popupConfigureSpy.size(), 1); QCOMPARE(popupConfigureSpy.takeFirst().at(0).toUInt(), configureSerial); // And attach a buffer @@ -560,7 +560,7 @@ void tst_xdgshell::pongs() wl_resource *resource = base->resourceMap().first()->handle; base->send_ping(resource, serial); }); - QTRY_COMPARE(pongSpy.count(), 1); + QTRY_COMPARE(pongSpy.size(), 1); QCOMPARE(pongSpy.first().at(0).toUInt(), serial); } @@ -626,7 +626,7 @@ void tst_xdgshell::foreignSurface() // the pointer events above are handled. QSignalSpy spy(exec([=] { return surface(newSurfaceIndex); }), &Surface::commit); wl_surface_commit(foreignSurface); - QTRY_COMPARE(spy.count(), 1); + QTRY_COMPARE(spy.size(), 1); wl_surface_destroy(foreignSurface); } From 0cf983165786a4937bad476a94359e33f1160018 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Thu, 6 Oct 2022 11:44:06 +0200 Subject: [PATCH 1112/1507] Port from qAsConst() to std::as_const() We've been requiring C++17 since Qt 6.0, and our qAsConst use finally starts to bother us (QTBUG-99313), so time to port away from it now. Since qAsConst has exactly the same semantics as std::as_const (down to rvalue treatment, constexpr'ness and noexcept'ness), there's really nothing more to it than a global search-and-replace. Task-number: QTBUG-99313 Change-Id: Ia64c6615ee81f7ad5d0658449b0ee347c3db8c29 Reviewed-by: David Edmundson --- .../platforms/wayland/qwaylanddisplay.cpp | 30 +++++++++---------- .../platforms/wayland/qwaylandinputdevice.cpp | 2 +- .../platforms/wayland/qwaylandintegration.cpp | 2 +- .../platforms/wayland/qwaylandscreen.cpp | 2 +- .../platforms/wayland/qwaylandwindow.cpp | 4 +-- .../qwaylandinputmethodeventbuilder.cpp | 2 +- .../qtwaylandscanner/qtwaylandscanner.cpp | 4 +-- .../tst_primaryselectionv1.cpp | 2 +- tests/auto/wayland/shared/corecompositor.cpp | 4 +-- tests/auto/wayland/shared/corecompositor.h | 6 ++-- tests/auto/wayland/shared/coreprotocol.cpp | 6 ++-- tests/auto/wayland/shared/coreprotocol.h | 2 +- tests/auto/wayland/shared/datadevice.cpp | 2 +- tests/auto/wayland/shared/xdgshell.cpp | 4 +-- 14 files changed, 36 insertions(+), 36 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index 48331c5a4d0..ca5669ad7b4 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -455,7 +455,7 @@ void QWaylandDisplay::checkTextInputProtocol() QWaylandScreen *QWaylandDisplay::screenForOutput(struct wl_output *output) const { - for (auto screen : qAsConst(mScreens)) { + for (auto screen : std::as_const(mScreens)) { if (screen->output() == output) return screen; } @@ -519,12 +519,12 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin #if QT_WAYLAND_TEXT_INPUT_V4_WIP mTextInputManagerv4.reset(); #endif // QT_WAYLAND_TEXT_INPUT_V4_WIP - for (QWaylandInputDevice *inputDevice : qAsConst(mInputDevices)) + for (QWaylandInputDevice *inputDevice : std::as_const(mInputDevices)) inputDevice->setTextInput(nullptr); } mTextInputMethodManager.reset(new QtWayland::qt_text_input_method_manager_v1(registry, id, 1)); - for (QWaylandInputDevice *inputDevice : qAsConst(mInputDevices)) + for (QWaylandInputDevice *inputDevice : std::as_const(mInputDevices)) inputDevice->setTextInputMethod(new QWaylandTextInputMethod(this, mTextInputMethodManager->get_text_input_method(inputDevice->wl_seat()))); mWaylandIntegration->reconfigureInputContext(); mTextInputManagerIndex = mTextInputManagerList.indexOf(interface); @@ -537,12 +537,12 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin #if QT_WAYLAND_TEXT_INPUT_V4_WIP mTextInputManagerv4.reset(); #endif // QT_WAYLAND_TEXT_INPUT_V4_WIP - for (QWaylandInputDevice *inputDevice : qAsConst(mInputDevices)) + for (QWaylandInputDevice *inputDevice : std::as_const(mInputDevices)) inputDevice->setTextInputMethod(nullptr); } mTextInputManagerv1.reset(new QtWayland::zwp_text_input_manager_v1(registry, id, 1)); - for (QWaylandInputDevice *inputDevice : qAsConst(mInputDevices)) { + for (QWaylandInputDevice *inputDevice : std::as_const(mInputDevices)) { auto textInput = new QWaylandTextInputv1(this, mTextInputManagerv1->create_text_input()); textInput->setSeat(inputDevice->wl_seat()); inputDevice->setTextInput(textInput); @@ -559,12 +559,12 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin #if QT_WAYLAND_TEXT_INPUT_V4_WIP mTextInputManagerv4.reset(); #endif // QT_WAYLAND_TEXT_INPUT_V4_WIP - for (QWaylandInputDevice *inputDevice : qAsConst(mInputDevices)) + for (QWaylandInputDevice *inputDevice : std::as_const(mInputDevices)) inputDevice->setTextInputMethod(nullptr); } mTextInputManagerv2.reset(new QtWayland::zwp_text_input_manager_v2(registry, id, 1)); - for (QWaylandInputDevice *inputDevice : qAsConst(mInputDevices)) + for (QWaylandInputDevice *inputDevice : std::as_const(mInputDevices)) inputDevice->setTextInput(new QWaylandTextInputv2(this, mTextInputManagerv2->get_text_input(inputDevice->wl_seat()))); mWaylandIntegration->reconfigureInputContext(); mTextInputManagerIndex = mTextInputManagerList.indexOf(interface); @@ -575,12 +575,12 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin if (mTextInputManagerIndex < INT_MAX) { mTextInputMethodManager.reset(); mTextInputManagerv2.reset(); - for (QWaylandInputDevice *inputDevice : qAsConst(mInputDevices)) + for (QWaylandInputDevice *inputDevice : std::as_const(mInputDevices)) inputDevice->setTextInputMethod(nullptr); } mTextInputManagerv4.reset(new QtWayland::zwp_text_input_manager_v4(registry, id, 1)); - for (QWaylandInputDevice *inputDevice : qAsConst(mInputDevices)) + for (QWaylandInputDevice *inputDevice : std::as_const(mInputDevices)) inputDevice->setTextInput(new QWaylandTextInputv4(this, mTextInputManagerv4->get_text_input(inputDevice->wl_seat()))); mWaylandIntegration->reconfigureInputContext(); mTextInputManagerIndex = mTextInputManagerList.indexOf(interface); @@ -595,7 +595,7 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin } } else if (interface == QLatin1String(QWaylandXdgOutputManagerV1::interface()->name)) { mXdgOutputManager.reset(new QWaylandXdgOutputManagerV1(this, id, version)); - for (auto *screen : qAsConst(mWaitingScreens)) + for (auto *screen : std::as_const(mWaitingScreens)) screen->initXdgOutput(xdgOutputManager()); forceRoundTrip(); } @@ -622,7 +622,7 @@ void QWaylandDisplay::registry_global_remove(uint32_t id) } } - for (QWaylandScreen *screen : qAsConst(mScreens)) { + for (QWaylandScreen *screen : std::as_const(mScreens)) { if (screen->outputId() == id) { mScreens.removeOne(screen); // If this is the last screen, we have to add a fake screen, or Qt will break. @@ -634,27 +634,27 @@ void QWaylandDisplay::registry_global_remove(uint32_t id) } if (global.interface == QLatin1String(QtWayland::zwp_text_input_manager_v1::interface()->name)) { mTextInputManagerv1.reset(); - for (QWaylandInputDevice *inputDevice : qAsConst(mInputDevices)) + for (QWaylandInputDevice *inputDevice : std::as_const(mInputDevices)) inputDevice->setTextInput(nullptr); mWaylandIntegration->reconfigureInputContext(); } if (global.interface == QLatin1String(QtWayland::zwp_text_input_manager_v2::interface()->name)) { mTextInputManagerv2.reset(); - for (QWaylandInputDevice *inputDevice : qAsConst(mInputDevices)) + for (QWaylandInputDevice *inputDevice : std::as_const(mInputDevices)) inputDevice->setTextInput(nullptr); mWaylandIntegration->reconfigureInputContext(); } #if QT_WAYLAND_TEXT_INPUT_V4_WIP if (global.interface == QLatin1String(QtWayland::zwp_text_input_manager_v4::interface()->name)) { mTextInputManagerv4.reset(); - for (QWaylandInputDevice *inputDevice : qAsConst(mInputDevices)) + for (QWaylandInputDevice *inputDevice : std::as_const(mInputDevices)) inputDevice->setTextInput(nullptr); mWaylandIntegration->reconfigureInputContext(); } #endif // QT_WAYLAND_TEXT_INPUT_V4_WIP if (global.interface == QLatin1String(QtWayland::qt_text_input_method_manager_v1::interface()->name)) { mTextInputMethodManager.reset(); - for (QWaylandInputDevice *inputDevice : qAsConst(mInputDevices)) + for (QWaylandInputDevice *inputDevice : std::as_const(mInputDevices)) inputDevice->setTextInputMethod(nullptr); mWaylandIntegration->reconfigureInputContext(); } diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index 9ff63b3b56a..56c89688677 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -1465,7 +1465,7 @@ void QWaylandInputDevice::handleTouchPoint(int id, QEventPoint::State state, con bool QWaylandInputDevice::Touch::allTouchPointsReleased() { - for (const auto &tp : qAsConst(mPendingTouchPoints)) { + for (const auto &tp : std::as_const(mPendingTouchPoints)) { if (tp.state != QEventPoint::Released) return false; } diff --git a/src/plugins/platforms/wayland/qwaylandintegration.cpp b/src/plugins/platforms/wayland/qwaylandintegration.cpp index 6d74de13b5c..9ee3811806f 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandintegration.cpp @@ -422,7 +422,7 @@ void QWaylandIntegration::initializeShellIntegration() preferredShells << QLatin1String("qt-shell"); } - for (const QString &preferredShell : qAsConst(preferredShells)) { + for (const QString &preferredShell : std::as_const(preferredShells)) { mShellIntegration.reset(createShellIntegration(preferredShell)); if (mShellIntegration) { qCDebug(lcQpaWayland, "Using the '%s' shell integration", qPrintable(preferredShell)); diff --git a/src/plugins/platforms/wayland/qwaylandscreen.cpp b/src/plugins/platforms/wayland/qwaylandscreen.cpp index fd56a252b93..4f75d205ab1 100644 --- a/src/plugins/platforms/wayland/qwaylandscreen.cpp +++ b/src/plugins/platforms/wayland/qwaylandscreen.cpp @@ -150,7 +150,7 @@ QList QWaylandScreen::virtualSiblings() const list.reserve(screens.size() + (placeholder ? 1 : 0)); - for (QWaylandScreen *screen : qAsConst(screens)) { + for (QWaylandScreen *screen : std::as_const(screens)) { if (screen->screen()) list << screen; } diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 73a14b89766..4fd012de211 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -559,7 +559,7 @@ void QWaylandWindow::sendRecursiveExposeEvent() return; sendExposeEvent(QRect(QPoint(), geometry().size())); - for (QWaylandSubSurface *subSurface : qAsConst(mChildren)) { + for (QWaylandSubSurface *subSurface : std::as_const(mChildren)) { auto subWindow = subSurface->window(); subWindow->sendRecursiveExposeEvent(); } @@ -924,7 +924,7 @@ bool QWaylandWindow::createDecoration() } if (hadDecoration != mWindowDecorationEnabled) { - for (QWaylandSubSurface *subsurf : qAsConst(mChildren)) { + for (QWaylandSubSurface *subsurf : std::as_const(mChildren)) { QPoint pos = subsurf->window()->geometry().topLeft(); QMargins m = frameMargins(); subsurf->set_position(pos.x() + m.left(), pos.y() + m.top()); diff --git a/src/plugins/platforms/wayland/shared/qwaylandinputmethodeventbuilder.cpp b/src/plugins/platforms/wayland/shared/qwaylandinputmethodeventbuilder.cpp index cfde26c76df..f0758bf7037 100644 --- a/src/plugins/platforms/wayland/shared/qwaylandinputmethodeventbuilder.cpp +++ b/src/plugins/platforms/wayland/shared/qwaylandinputmethodeventbuilder.cpp @@ -132,7 +132,7 @@ QInputMethodEvent *QWaylandInputMethodEventBuilder::buildPreedit(const QString & attributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::Cursor, indexFromWayland(text, m_preeditCursor), 1, QVariant())); } - for (const QInputMethodEvent::Attribute &attr : qAsConst(m_preeditStyles)) { + for (const QInputMethodEvent::Attribute &attr : std::as_const(m_preeditStyles)) { int start = indexFromWayland(text, attr.start); int length = indexFromWayland(text, attr.start + attr.length) - start; attributes.append(QInputMethodEvent::Attribute(attr.type, start, length, attr.value)); diff --git a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp index 0e9eb0e5c62..f80795099f5 100644 --- a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp +++ b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp @@ -437,7 +437,7 @@ bool Scanner::process() printf("// This file was generated by qtwaylandscanner\n"); printf("// source file is %s\n\n", qPrintable(m_protocolFilePath)); - for (auto b : qAsConst(m_includes)) + for (auto b : std::as_const(m_includes)) printf("#include %s\n", b.constData()); auto printExportMacro = [this](const char *prefix, const QByteArray &preProcessorProtocolName) { @@ -695,7 +695,7 @@ bool Scanner::process() printf(" %s::~%s()\n", interfaceName, interfaceName); printf(" {\n"); - printf(" for (auto resource : qAsConst(m_resource_map))\n"); + printf(" for (auto resource : std::as_const(m_resource_map))\n"); printf(" resource->%s_object = nullptr;\n", interfaceNameStripped); printf("\n"); printf(" if (m_resource)\n"); diff --git a/tests/auto/wayland/primaryselectionv1/tst_primaryselectionv1.cpp b/tests/auto/wayland/primaryselectionv1/tst_primaryselectionv1.cpp index 5ec046d1757..558e4676b3e 100644 --- a/tests/auto/wayland/primaryselectionv1/tst_primaryselectionv1.cpp +++ b/tests/auto/wayland/primaryselectionv1/tst_primaryselectionv1.cpp @@ -147,7 +147,7 @@ public: {} bool isClean() override { - for (auto *device : qAsConst(m_devices)) { + for (auto *device : std::as_const(m_devices)) { // The client should not leak selection offers, i.e. if this fails, there is a missing // zwp_primary_selection_offer_v1.destroy request if (!device->m_sentSelectionOffers.empty()) diff --git a/tests/auto/wayland/shared/corecompositor.cpp b/tests/auto/wayland/shared/corecompositor.cpp index 38930c540c9..dd7311e41ce 100644 --- a/tests/auto/wayland/shared/corecompositor.cpp +++ b/tests/auto/wayland/shared/corecompositor.cpp @@ -35,7 +35,7 @@ CoreCompositor::~CoreCompositor() bool CoreCompositor::isClean() { Lock lock(this); - for (auto *global : qAsConst(m_globals)) { + for (auto *global : std::as_const(m_globals)) { if (!global->isClean()) return false; } @@ -46,7 +46,7 @@ QString CoreCompositor::dirtyMessage() { Lock lock(this); QStringList messages; - for (auto *global : qAsConst(m_globals)) { + for (auto *global : std::as_const(m_globals)) { if (!global->isClean()) messages << (global->metaObject()->className() % QLatin1String(": ") % global->dirtyMessage()); } diff --git a/tests/auto/wayland/shared/corecompositor.h b/tests/auto/wayland/shared/corecompositor.h index 2edb7f3fc8e..b7d1de78d79 100644 --- a/tests/auto/wayland/shared/corecompositor.h +++ b/tests/auto/wayland/shared/corecompositor.h @@ -98,7 +98,7 @@ public: global_type *get() { warnIfNotLockedByThread(Q_FUNC_INFO); - for (auto *global : qAsConst(m_globals)) { + for (auto *global : std::as_const(m_globals)) { if (auto *casted = qobject_cast(global)) return casted; } @@ -112,7 +112,7 @@ public: global_type *get(int index) { warnIfNotLockedByThread(Q_FUNC_INFO); - for (auto *global : qAsConst(m_globals)) { + for (auto *global : std::as_const(m_globals)) { if (auto *casted = qobject_cast(global)) { if (index--) continue; @@ -130,7 +130,7 @@ public: { warnIfNotLockedByThread(Q_FUNC_INFO); QList matching; - for (auto *global : qAsConst(m_globals)) { + for (auto *global : std::as_const(m_globals)) { if (auto *casted = qobject_cast(global)) matching.append(casted); } diff --git a/tests/auto/wayland/shared/coreprotocol.cpp b/tests/auto/wayland/shared/coreprotocol.cpp index 559ddbd7dca..005151f74f6 100644 --- a/tests/auto/wayland/shared/coreprotocol.cpp +++ b/tests/auto/wayland/shared/coreprotocol.cpp @@ -144,7 +144,7 @@ void Surface::surface_frame(Resource *resource, uint32_t callback) } bool WlCompositor::isClean() { - for (auto *surface : qAsConst(m_surfaces)) { + for (auto *surface : std::as_const(m_surfaces)) { if (!CursorRole::fromSurface(surface)) { if (m_compositor->m_type != CoreCompositor::CompositorType::Legacy) return false; @@ -160,7 +160,7 @@ QString WlCompositor::dirtyMessage() if (isClean()) return "clean"; QStringList messages; - for (auto *s : qAsConst(m_surfaces)) { + for (auto *s : std::as_const(m_surfaces)) { QString role = s->m_role ? s->m_role->staticMetaObject.className(): "none/unknown"; messages << "Surface with role: " + role; } @@ -547,7 +547,7 @@ Shm::Shm(CoreCompositor *compositor, QList formats, int version) bool Shm::isClean() { -// for (ShmPool *pool : qAsConst(m_pools)) { +// for (ShmPool *pool : std::as_const(m_pools)) { // //TODO: return false if not cursor buffer // if (pool->m_buffers.isEmpty()) { // return false; diff --git a/tests/auto/wayland/shared/coreprotocol.h b/tests/auto/wayland/shared/coreprotocol.h index 77ef3cd465f..370b8cd84bb 100644 --- a/tests/auto/wayland/shared/coreprotocol.h +++ b/tests/auto/wayland/shared/coreprotocol.h @@ -411,7 +411,7 @@ protected: void shm_create_pool(Resource *resource, uint32_t id, int32_t fd, int32_t size) override; void shm_bind_resource(Resource *resource) override { - for (auto format : qAsConst(m_formats)) + for (auto format : std::as_const(m_formats)) send_format(resource->handle, format); } }; diff --git a/tests/auto/wayland/shared/datadevice.cpp b/tests/auto/wayland/shared/datadevice.cpp index 100f937d355..26ebec6bd2e 100644 --- a/tests/auto/wayland/shared/datadevice.cpp +++ b/tests/auto/wayland/shared/datadevice.cpp @@ -7,7 +7,7 @@ namespace MockCompositor { bool DataDeviceManager::isClean() { - for (auto *device : qAsConst(m_dataDevices)) { + for (auto *device : std::as_const(m_dataDevices)) { // The client should not leak selection offers, i.e. if this fails, there is a missing // data_offer.destroy request if (!device->m_sentSelectionOffers.empty()) diff --git a/tests/auto/wayland/shared/xdgshell.cpp b/tests/auto/wayland/shared/xdgshell.cpp index b50f36e7d05..eb9a1e87afd 100644 --- a/tests/auto/wayland/shared/xdgshell.cpp +++ b/tests/auto/wayland/shared/xdgshell.cpp @@ -14,7 +14,7 @@ XdgWmBase::XdgWmBase(CoreCompositor *compositor, int version) XdgToplevel *XdgWmBase::toplevel(int i) { int j = 0; - for (auto *xdgSurface : qAsConst(m_xdgSurfaces)) { + for (auto *xdgSurface : std::as_const(m_xdgSurfaces)) { if (auto *toplevel = xdgSurface->m_toplevel) { if (j == i) return toplevel; @@ -27,7 +27,7 @@ XdgToplevel *XdgWmBase::toplevel(int i) XdgPopup *XdgWmBase::popup(int i) { int j = 0; - for (auto *xdgSurface : qAsConst(m_xdgSurfaces)) { + for (auto *xdgSurface : std::as_const(m_xdgSurfaces)) { if (auto *popup = xdgSurface->m_popup) { if (j == i) return popup; From fb8e5fddca22a07bff582266108ab7cb00fb5ab6 Mon Sep 17 00:00:00 2001 From: Alexey Edelev Date: Wed, 13 Jul 2022 17:57:43 +0200 Subject: [PATCH 1113/1507] Add private header filters to the qt_interal_add_module calls This is required to filter the generated wayland files when syncing headers. Task-number: QTBUG-103196 Change-Id: I86d440bf8b56802dff2fa75ba621c37a8daa8bbf Reviewed-by: Alexandru Croitor Reviewed-by: Qt CI Bot --- src/plugins/platforms/wayland/CMakeLists.txt | 2 ++ .../wayland/plugins/shellintegration/wl-shell/CMakeLists.txt | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/plugins/platforms/wayland/CMakeLists.txt b/src/plugins/platforms/wayland/CMakeLists.txt index d38befdbcf5..820c9eadad9 100644 --- a/src/plugins/platforms/wayland/CMakeLists.txt +++ b/src/plugins/platforms/wayland/CMakeLists.txt @@ -74,6 +74,8 @@ qt_internal_add_module(WaylandClient Qt::CorePrivate Qt::GuiPrivate Qt::WaylandGlobalPrivate + PRIVATE_HEADER_FILTERS + "^qwayland-.*\.h|^wayland-.*-protocol\.h" ) qt6_generate_wayland_protocol_client_sources(WaylandClient diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/CMakeLists.txt index 5bb4144b512..142bd21aaaa 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/CMakeLists.txt +++ b/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/CMakeLists.txt @@ -17,6 +17,8 @@ qt_internal_add_module(WlShellIntegrationPrivate Qt::GuiPrivate Qt::WaylandClientPrivate Wayland::Client + PRIVATE_HEADER_FILTERS + "^qwayland-.*\.h|^wayland-.*-protocol\.h" ) qt6_generate_wayland_protocol_client_sources(WlShellIntegrationPrivate From e2d3b915be9b547bbd397b7b282197aff98f5dd2 Mon Sep 17 00:00:00 2001 From: Alexey Edelev Date: Fri, 15 Jul 2022 11:42:23 +0200 Subject: [PATCH 1114/1507] Adapt module to work with the new syncqt Add dependencies to WaylandCompositor_sync_headers for the qml plugin targets. Add deprecation macros. Fix syncqt warnings. Task-number: QTBUG-87480 Change-Id: I0e169344c9a8186484fbb36f5ec1e03cd38ea19b Reviewed-by: Alexandru Croitor --- src/plugins/platforms/wayland/qtwaylandclientglobal.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/plugins/platforms/wayland/qtwaylandclientglobal.h b/src/plugins/platforms/wayland/qtwaylandclientglobal.h index 0e54752947e..1582176eaa0 100644 --- a/src/plugins/platforms/wayland/qtwaylandclientglobal.h +++ b/src/plugins/platforms/wayland/qtwaylandclientglobal.h @@ -4,6 +4,10 @@ #ifndef QWAYLANDCLIENTGLOBAL_H #define QWAYLANDCLIENTGLOBAL_H +#if 0 +#pragma qt_deprecates(qwaylandclientexport.h) +#endif + #include #include #include From a34a3ff75e5f73efd0b5b6a8067cbe849fbdcba6 Mon Sep 17 00:00:00 2001 From: Volker Krause Date: Tue, 11 Oct 2022 18:12:40 +0200 Subject: [PATCH 1115/1507] Allow to run wayland-scanner without --include-core-only There are Wayland protocols for which using this option doesn't result in compilable code. Examples are input-method-unstable-v1 and linux-dmabuf-v1. Pick-to: 6.4 Change-Id: I06dea12dea1058fb6bd99522aa4278c36d271d4e Reviewed-by: Vlad Zahorodnii Reviewed-by: David Edmundson --- src/tools/qtwaylandscanner/Qt6WaylandClientMacros.cmake | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/tools/qtwaylandscanner/Qt6WaylandClientMacros.cmake b/src/tools/qtwaylandscanner/Qt6WaylandClientMacros.cmake index f8cdc67fad7..ea0ac323f8e 100644 --- a/src/tools/qtwaylandscanner/Qt6WaylandClientMacros.cmake +++ b/src/tools/qtwaylandscanner/Qt6WaylandClientMacros.cmake @@ -2,7 +2,7 @@ # SPDX-License-Identifier: BSD-3-Clause function(qt6_generate_wayland_protocol_client_sources target) - cmake_parse_arguments(arg "" "__QT_INTERNAL_WAYLAND_INCLUDE_DIR" "FILES" ${ARGN}) + cmake_parse_arguments(arg "NO_INCLUDE_CORE_ONLY" "__QT_INTERNAL_WAYLAND_INCLUDE_DIR" "FILES" ${ARGN}) if(DEFINED arg_UNPARSED_ARGUMENTS) message(FATAL_ERROR "Unknown arguments were passed to qt6_generate_wayland_protocol_client_sources: (${arg_UNPARSED_ARGUMENTS}).") endif() @@ -31,15 +31,18 @@ function(qt6_generate_wayland_protocol_client_sources target) set(qtwaylandscanner_header_output "${target_binary_dir}/qwayland-${protocol_name}.h") set(qtwaylandscanner_code_output "${target_binary_dir}/qwayland-${protocol_name}.cpp") + if (NOT arg_NO_INCLUDE_CORE_ONLY) + set(waylandscanner_extra_args "--include-core-only") + endif() add_custom_command( OUTPUT "${waylandscanner_header_output}" #TODO: Maybe put the files in ${CMAKE_CURRENT_BINARY_DIR/wayland_generated instead? - COMMAND Wayland::Scanner --strict --include-core-only client-header < "${protocol_file}" > "${waylandscanner_header_output}" + COMMAND Wayland::Scanner --strict ${waylandscanner_extra_args} client-header < "${protocol_file}" > "${waylandscanner_header_output}" ) add_custom_command( OUTPUT "${waylandscanner_code_output}" - COMMAND Wayland::Scanner --strict --include-core-only public-code < "${protocol_file}" > "${waylandscanner_code_output}" + COMMAND Wayland::Scanner --strict ${waylandscanner_extra_args} public-code < "${protocol_file}" > "${waylandscanner_code_output}" ) set(wayland_include_dir "") From 2b63b8eb2a3bcfa56a5a3d81ae522c3f55599060 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Thu, 13 Oct 2022 23:18:06 +0200 Subject: [PATCH 1116/1507] Port to new Q_UNREACHABLE_RETURN() This is a semantic patch using ClangTidyTransformator to convert sequences of Q_UNREACHABLE() + return into Q_UNREACHABLE_RETURN(), newly added to qtbase. const std::string unr = "unr", val = "val", ret = "ret"; auto makeUnreachableReturn = cat("Q_UNREACHABLE_RETURN(", ifBound(val, cat(node(val)), cat("")), ")"); auto ignoringSwitchCases = [](auto stmt) { return anyOf(stmt, switchCase(subStmt(stmt))); }; makeRule(stmt(ignoringSwitchCases(stmt(isExpandedFromMacro("Q_UNREACHABLE")).bind(unr)), nextStmt(returnStmt(optionally(hasReturnValue(expr().bind(val)))).bind(ret))), {changeTo(node(unr), cat(makeUnreachableReturn, ";")), // TODO: why is the ; lost w/o this? changeTo(node(ret), cat(""))}, cat("use ", makeUnreachableReturn)); a.k.a qt-use-unreachable-return. subStmt() and nextStmt() are non-standard matchers. Change-Id: I3855b2dc8523db1ea860f72ad9818738162495c6 Reviewed-by: Marc Mutz Reviewed-by: Ivan Solovev --- src/plugins/platforms/wayland/qwaylandinputcontext.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandinputcontext.cpp b/src/plugins/platforms/wayland/qwaylandinputcontext.cpp index cb94005b3d8..e67311a1602 100644 --- a/src/plugins/platforms/wayland/qwaylandinputcontext.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputcontext.cpp @@ -288,8 +288,7 @@ bool QWaylandInputContext::filterEvent(const QEvent *event) case XKB_COMPOSE_NOTHING: return false; default: - Q_UNREACHABLE(); - return false; + Q_UNREACHABLE_RETURN(false); } } From 425cceca836cbfa6c996a5adcb42fcb0ee43f8f9 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Sun, 23 Oct 2022 00:01:33 +0400 Subject: [PATCH 1117/1507] Implement window alert with xdg-activation This is implemented by not specifying serial, as mentioned in https://gitlab.freedesktop.org/wayland/wayland-protocols/-/merge_requests/9#note_854977 Tested on KDE Plasma Change-Id: I4ef0975040bbce581b615b0318f90601e080235c Reviewed-by: David Edmundson --- .../xdg-shell/qwaylandxdgactivationv1.cpp | 7 +++--- .../xdg-shell/qwaylandxdgactivationv1_p.h | 3 ++- .../xdg-shell/qwaylandxdgshell.cpp | 23 +++++++++++++++++++ .../xdg-shell/qwaylandxdgshell_p.h | 3 +++ .../wayland/qwaylandshellsurface_p.h | 3 +++ .../platforms/wayland/qwaylandwindow.cpp | 14 +++++++++++ .../platforms/wayland/qwaylandwindow_p.h | 3 +++ 7 files changed, 52 insertions(+), 4 deletions(-) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgactivationv1.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgactivationv1.cpp index e921ca46139..8efc040863c 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgactivationv1.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgactivationv1.cpp @@ -23,7 +23,8 @@ QWaylandXdgActivationV1::~QWaylandXdgActivationV1() QWaylandXdgActivationTokenV1 * QWaylandXdgActivationV1::requestXdgActivationToken(QWaylandDisplay *display, - struct ::wl_surface *surface, uint32_t serial, + struct ::wl_surface *surface, + std::optional serial, const QString &app_id) { auto wl = get_activation_token(); @@ -36,8 +37,8 @@ QWaylandXdgActivationV1::requestXdgActivationToken(QWaylandDisplay *display, if (!app_id.isEmpty()) provider->set_app_id(app_id); - if (display->lastInputDevice()) - provider->set_serial(serial, display->lastInputDevice()->wl_seat()); + if (serial && display->lastInputDevice()) + provider->set_serial(*serial, display->lastInputDevice()->wl_seat()); provider->commit(); return provider; } diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgactivationv1_p.h b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgactivationv1_p.h index d5d18459c8a..2f42d9258b0 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgactivationv1_p.h +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgactivationv1_p.h @@ -47,7 +47,8 @@ public: QWaylandXdgActivationTokenV1 *requestXdgActivationToken(QWaylandDisplay *display, struct ::wl_surface *surface, - uint32_t serial, const QString &app_id); + std::optional serial, + const QString &app_id); }; QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp index bd5e3fe50d0..fad8b5817c4 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp @@ -541,6 +541,29 @@ void QWaylandXdgSurface::setXdgActivationToken(const QString &token) } } +void QWaylandXdgSurface::setAlertState(bool enabled) +{ + if (m_alertState == enabled) + return; + + m_alertState = enabled; + + if (!m_alertState) + return; + + auto *activation = m_shell->activation(); + if (!activation) + return; + + const auto tokenProvider = activation->requestXdgActivationToken( + m_shell->m_display, m_window->wlSurface(), std::nullopt, m_appId); + connect(tokenProvider, &QWaylandXdgActivationTokenV1::done, this, + [this, tokenProvider](const QString &token) { + m_shell->activation()->activate(token, m_window->wlSurface()); + tokenProvider->deleteLater(); + }); +} + QString QWaylandXdgSurface::externWindowHandle() { if (!m_toplevel || !m_shell->exporter()) { diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h index d3cdb9d4e9e..dfd61105abc 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h @@ -64,6 +64,8 @@ public: bool requestActivate() override; void setXdgActivationToken(const QString &token) override; void requestXdgActivationToken(quint32 serial) override; + void setAlertState(bool enabled) override; + bool isAlertState() const override { return m_alertState; } QString externWindowHandle() override; void setSizeHints(); @@ -132,6 +134,7 @@ private: uint m_appliedConfigureSerial = 0; QString m_activationToken; QString m_appId; + bool m_alertState = false; friend class QWaylandXdgShell; }; diff --git a/src/plugins/platforms/wayland/qwaylandshellsurface_p.h b/src/plugins/platforms/wayland/qwaylandshellsurface_p.h index 5e26951096f..8f176e281eb 100644 --- a/src/plugins/platforms/wayland/qwaylandshellsurface_p.h +++ b/src/plugins/platforms/wayland/qwaylandshellsurface_p.h @@ -71,6 +71,9 @@ public: virtual void setXdgActivationToken(const QString &token); virtual void requestXdgActivationToken(quint32 serial); + virtual void setAlertState(bool enabled) { Q_UNUSED(enabled); } + virtual bool isAlertState() const { return false; } + virtual QString externWindowHandle() { return QString(); } inline QWaylandWindow *window() { return m_window; } diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 4fd012de211..c8d5121f6d1 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -502,6 +502,20 @@ void QWaylandWindow::setMask(const QRegion &mask) mSurface->commit(); } +void QWaylandWindow::setAlertState(bool enabled) +{ + if (mShellSurface) + mShellSurface->setAlertState(enabled); +} + +bool QWaylandWindow::isAlertState() const +{ + if (mShellSurface) + return mShellSurface->isAlertState(); + + return false; +} + void QWaylandWindow::applyConfigureWhenPossible() { QMutexLocker resizeLocker(&mResizeLock); diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index 298f3f2df43..2e68cc2e4c5 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -143,6 +143,9 @@ public: void setMask(const QRegion ®ion) override; + void setAlertState(bool enabled) override; + bool isAlertState() const override; + qreal scale() const; qreal devicePixelRatio() const override; From 165b770fc5e907005fa322fd53ec0a2eb491b69c Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Mon, 24 Oct 2022 22:13:33 +0300 Subject: [PATCH 1118/1507] Client: Add support for high-resolution scrolling With wl_pointer version 8, the axis_discrete event is replaced with the axis_value120 event. The main difference between axis_discrete and axis_value120 is that the latter carries scroll deltas that can be fractions of 120, e.g. 30, etc. See also https://gitlab.freedesktop.org/wayland/wayland/-/merge_requests/72 Change-Id: I4f724ead7ba146dde6d8975fa4edfcfca761769d Reviewed-by: David Edmundson Reviewed-by: Qt CI Bot Reviewed-by: Shawn Rutledge --- src/3rdparty/wayland/protocols/wayland.xml | 224 +++++++++++++++--- .../platforms/wayland/qwaylandinputdevice.cpp | 37 ++- .../platforms/wayland/qwaylandinputdevice_p.h | 3 +- tests/auto/wayland/CMakeLists.txt | 1 + tests/auto/wayland/seat/tst_seat.cpp | 52 ++-- tests/auto/wayland/seatv7/CMakeLists.txt | 13 + tests/auto/wayland/seatv7/tst_seatv7.cpp | 130 ++++++++++ tests/auto/wayland/shared/coreprotocol.cpp | 7 + tests/auto/wayland/shared/coreprotocol.h | 3 +- 9 files changed, 409 insertions(+), 61 deletions(-) create mode 100644 tests/auto/wayland/seatv7/CMakeLists.txt create mode 100644 tests/auto/wayland/seatv7/tst_seatv7.cpp diff --git a/src/3rdparty/wayland/protocols/wayland.xml b/src/3rdparty/wayland/protocols/wayland.xml index 471daf668e3..01bc267a7cb 100644 --- a/src/3rdparty/wayland/protocols/wayland.xml +++ b/src/3rdparty/wayland/protocols/wayland.xml @@ -187,7 +187,7 @@ - + A compositor. This object is a singleton global. The compositor is in charge of combining the contents of multiple @@ -258,6 +258,12 @@ for the pool from the file descriptor passed when the pool was created, but using the new size. This request can only be used to make the pool bigger. + + This request only changes the amount of bytes that are mmapped + by the server and does not touch the file corresponding to the + file descriptor passed at creation time. It is the client's + responsibility to ensure that the file is at least as big as + the new pool size. @@ -271,8 +277,8 @@ Clients can create wl_shm_pool objects using the create_pool request. - At connection setup time, the wl_shm object emits one or more - format events to inform clients about the valid pixel formats + On binding the wl_shm object one or more format events + are emitted to inform clients about the valid pixel formats that can be used for buffers. @@ -296,6 +302,9 @@ The drm format codes match the macros defined in drm_fourcc.h, except argb8888 and xrgb8888. The formats actually supported by the compositor will be reported by the format event. + + For all wl_shm formats and unless specified in another protocol + extension, pre-multiplied alpha is used for pixel values. @@ -403,6 +412,10 @@ + + + + @@ -431,10 +444,15 @@ A buffer provides the content for a wl_surface. Buffers are - created through factory interfaces such as wl_drm, wl_shm or - similar. It has a width and a height and can be attached to a - wl_surface, but the mechanism by which a client provides and - updates the contents is defined by the buffer factory interface. + created through factory interfaces such as wl_shm, wp_linux_buffer_params + (from the linux-dmabuf protocol extension) or similar. It has a width and + a height and can be attached to a wl_surface, but the mechanism by which a + client provides and updates the contents is defined by the buffer factory + interface. + + If the buffer uses a format that has an alpha channel, the alpha channel + is assumed to be premultiplied in the color channels unless otherwise + specified. @@ -878,7 +896,7 @@ which will subsequently be used in either the data_device.enter event (for drag-and-drop) or the data_device.selection event (for selections). Immediately - following the data_device_data_offer event, the new data_offer + following the data_device.data_offer event, the new data_offer object will send out data_offer.offer events to describe the mime types it offers. @@ -948,9 +966,10 @@ immediately before receiving keyboard focus and when a new selection is set while the client has keyboard focus. The data_offer is valid until a new data_offer or NULL is received - or until the client loses keyboard focus. The client must - destroy the previous selection data_offer, if any, upon receiving - this event. + or until the client loses keyboard focus. Switching surface with + keyboard focus within the same client doesn't mean a new selection + will be sent. The client must destroy the previous selection + data_offer, if any, upon receiving this event. @@ -1038,7 +1057,8 @@ a basic surface. Note! This protocol is deprecated and not intended for production use. - For desktop-style user interfaces, use xdg_shell. + For desktop-style user interfaces, use xdg_shell. Compositors and clients + should not implement this interface. @@ -1332,7 +1352,7 @@ - + A surface is a rectangular area that may be displayed on zero or more outputs, and shown any number of times at the compositor's @@ -1384,6 +1404,7 @@ + @@ -1406,7 +1427,14 @@ buffer's upper left corner, relative to the current buffer's upper left corner, in surface-local coordinates. In other words, the x and y, combined with the new surface size define in which - directions the surface's size changes. + directions the surface's size changes. Setting anything other than 0 + as x and y arguments is discouraged, and should instead be replaced + with using the separate wl_surface.offset request. + + When the bound wl_surface version is 5 or higher, passing any + non-zero x or y is a protocol violation, and will result in an + 'invalid_offset' error being raised. To achieve equivalent semantics, + use wl_surface.offset. Surface contents are double-buffered state, see wl_surface.commit. @@ -1434,9 +1462,12 @@ from the same backing storage or use wp_linux_buffer_release. Destroying the wl_buffer after wl_buffer.release does not change - the surface contents. However, if the client destroys the - wl_buffer before receiving the wl_buffer.release event, the surface - contents become undefined immediately. + the surface contents. Destroying the wl_buffer before wl_buffer.release + is allowed as long as the underlying buffer storage isn't re-used (this + can happen e.g. on client process termination). However, if the client + destroys the wl_buffer before receiving the wl_buffer.release event and + mutates the underlying buffer storage, the surface contents become + undefined immediately. If wl_surface.attach is sent with a NULL wl_buffer, the following wl_surface.commit will remove the surface content. @@ -1734,9 +1765,30 @@ + + + + + + The x and y arguments specify the location of the new pending + buffer's upper left corner, relative to the current buffer's upper + left corner, in surface-local coordinates. In other words, the + x and y, combined with the new surface size define in which + directions the surface's size changes. + + Surface location offset is double-buffered state, see + wl_surface.commit. + + This request is semantically equivalent to and the replaces the x and y + arguments in the wl_surface.attach request in wl_surface versions prior + to 5. See wl_surface.attach for details. + + + + - + A seat is a group of keyboards, pointer and touch devices. This object is published as a global during start up, or when such a @@ -1838,9 +1890,22 @@ - In a multiseat configuration this can be used by the client to help - identify which physical devices the seat represents. Based on - the seat configuration used by the compositor. + In a multi-seat configuration the seat name can be used by clients to + help identify which physical devices the seat represents. + + The seat name is a UTF-8 string with no convention defined for its + contents. Each name is unique among all wl_seat globals. The name is + only guaranteed to be unique for the current compositor instance. + + The same seat names are used for all clients. Thus, the name can be + shared across processes to refer to a specific wl_seat global. + + The name event is sent after binding to the seat global. This event is + only sent once per seat object, and the name does not change over the + lifetime of the wl_seat global. + + Compositors may re-use the same seat name if the wl_seat global is + destroyed and re-created later. @@ -1856,7 +1921,7 @@ - + The wl_pointer interface represents one or more input devices, such as mice, which control the pointer location and pointer_focus @@ -1905,6 +1970,10 @@ wl_surface is no longer used as the cursor. When the use as a cursor ends, the current and pending input regions become undefined, and the wl_surface is unmapped. + + The serial parameter must match the latest wl_pointer.enter + serial number sent to the client. Otherwise the request will be + ignored. + + + + Discrete high-resolution scroll information. + + This event carries high-resolution wheel scroll information, + with each multiple of 120 representing one logical scroll step + (a wheel detent). For example, an axis_value120 of 30 is one quarter of + a logical scroll step in the positive direction, a value120 of + -240 are two logical scroll steps in the negative direction within the + same hardware event. + Clients that rely on discrete scrolling should accumulate the + value120 to multiples of 120 before processing the event. + + The value120 must not be zero. + + This event replaces the wl_pointer.axis_discrete event in clients + supporting wl_pointer version 8 or later. + + Where a wl_pointer.axis_source event occurs in the same + wl_pointer.frame, the axis source applies to this event. + + The order of wl_pointer.axis_value120 and wl_pointer.axis_source is + not guaranteed. + + + + - + The wl_keyboard interface represents one or more keyboards associated with a seat. @@ -2193,13 +2294,14 @@ + summary="libxkbcommon compatible, null-terminated string; to determine the xkb keycode, clients must add 8 to the key event keycode"/> This event provides a file descriptor to the client which can be - memory-mapped to provide a keyboard mapping description. + memory-mapped in read-only mode to provide a keyboard mapping + description. From version 7 onwards, the fd must be mapped with MAP_PRIVATE by the recipient, as MAP_SHARED may fail. @@ -2305,7 +2407,7 @@ - + The wl_touch interface represents a touchscreen associated with a seat. @@ -2449,7 +2551,7 @@ - + An output describes part of the compositor geometry. The compositor works in the 'compositor coordinate system' and an @@ -2505,12 +2607,15 @@ The physical size can be set to zero if it doesn't make sense for this output (e.g. for projectors or virtual outputs). + The geometry event will be followed by a done event (starting from + version 2). + Note: wl_output only advertises partial information about the output position and identification. Some compositors, for instance those not implementing a desktop-style output layout or those exposing virtual outputs, might fake this information. Instead of using x and y, clients should use xdg_output.logical_position. Instead of using make and model, - clients should use xdg_output.name and xdg_output.description. + clients should use name and description. @@ -2566,6 +2671,9 @@ The vertical refresh rate can be set to zero if it doesn't make sense for this output (e.g. for virtual outputs). + The mode event will be followed by a done event (starting from + version 2). + Clients should not use the refresh rate to schedule frames. Instead, they should use the wl_surface.frame event or the presentation-time protocol. @@ -2612,6 +2720,8 @@ the scale of the output. That way the compositor can avoid scaling the surface, and the client can supply a higher detail image. + + The scale event will be followed by a done event. @@ -2624,6 +2734,62 @@ use the output object anymore. + + + + + + Many compositors will assign user-friendly names to their outputs, show + them to the user, allow the user to refer to an output, etc. The client + may wish to know this name as well to offer the user similar behaviors. + + The name is a UTF-8 string with no convention defined for its contents. + Each name is unique among all wl_output globals. The name is only + guaranteed to be unique for the compositor instance. + + The same output name is used for all clients for a given wl_output + global. Thus, the name can be shared across processes to refer to a + specific wl_output global. + + The name is not guaranteed to be persistent across sessions, thus cannot + be used to reliably identify an output in e.g. configuration files. + + Examples of names include 'HDMI-A-1', 'WL-1', 'X11-1', etc. However, do + not assume that the name is a reflection of an underlying DRM connector, + X11 connection, etc. + + The name event is sent after binding the output object. This event is + only sent once per output object, and the name does not change over the + lifetime of the wl_output global. + + Compositors may re-use the same output name if the wl_output global is + destroyed and re-created later. Compositors should avoid re-using the + same name if possible. + + The name event will be followed by a done event. + + + + + + + Many compositors can produce human-readable descriptions of their + outputs. The client may wish to know this description as well, e.g. for + output selection purposes. + + The description is a UTF-8 string with no convention defined for its + contents. The description is not guaranteed to be unique among all + wl_output globals. Examples might include 'Foocorp 11" Display' or + 'Virtual X11 output via :1'. + + The description event is sent after binding the output object and + whenever the description changes. The description is optional, and may + not be sent at all. + + The description event will be followed by a done event. + + + diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index 56c89688677..4b4e54bd86e 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -375,7 +375,7 @@ QWaylandInputDevice::Touch::~Touch() } QWaylandInputDevice::QWaylandInputDevice(QWaylandDisplay *display, int version, uint32_t id) - : QtWayland::wl_seat(display->wl_registry(), id, qMin(version, 7)) + : QtWayland::wl_seat(display->wl_registry(), id, qMin(version, 8)) , mQDisplay(display) , mDisplay(display->wl_display()) { @@ -982,14 +982,16 @@ void QWaylandInputDevice::Pointer::pointer_axis_discrete(uint32_t axis, int32_t if (!focusWindow()) return; + const int32_t delta120 = value * 15 * 8; + switch (axis) { case axis_vertical_scroll: qCDebug(lcQpaWaylandInput) << "wl_pointer.axis_discrete vertical:" << value; - mFrameData.discreteDelta.ry() += value; + mFrameData.delta120.ry() += delta120; break; case axis_horizontal_scroll: qCDebug(lcQpaWaylandInput) << "wl_pointer.axis_discrete horizontal:" << value; - mFrameData.discreteDelta.rx() += value; + mFrameData.delta120.rx() += delta120; break; default: //TODO: is this really needed? @@ -998,6 +1000,26 @@ void QWaylandInputDevice::Pointer::pointer_axis_discrete(uint32_t axis, int32_t } } +void QWaylandInputDevice::Pointer::pointer_axis_value120(uint32_t axis, int32_t value) +{ + if (!focusWindow()) + return; + + switch (axis) { + case axis_vertical_scroll: + qCDebug(lcQpaWaylandInput) << "wl_pointer.axis_value120 vertical:" << value; + mFrameData.delta120.ry() += value; + break; + case axis_horizontal_scroll: + qCDebug(lcQpaWaylandInput) << "wl_pointer.axis_value120 horizontal:" << value; + mFrameData.delta120.rx() += value; + break; + default: + qCWarning(lcQpaWaylandInput) << "wl_pointer.axis_value120: Unknown axis:" << axis; + return; + } +} + void QWaylandInputDevice::Pointer::setFrameEvent(QWaylandPointerEvent *event) { qCDebug(lcQpaWaylandInput) << "Setting frame event " << event->type; @@ -1016,7 +1038,7 @@ void QWaylandInputDevice::Pointer::setFrameEvent(QWaylandPointerEvent *event) void QWaylandInputDevice::Pointer::FrameData::resetScrollData() { - discreteDelta = QPoint(); + delta120 = QPoint(); delta = QPointF(); axisSource = axis_source_wheel; } @@ -1060,15 +1082,16 @@ QPoint QWaylandInputDevice::Pointer::FrameData::pixelDeltaAndError(QPointF *accu QPoint QWaylandInputDevice::Pointer::FrameData::angleDelta() const { - if (discreteDelta.isNull()) { + if (delta120.isNull()) { // If we didn't get any discrete events, then we need to fall back to // the continuous information. return (delta * -12).toPoint(); //TODO: why multiply by 12? } // The angle delta is in eights of degrees, and our docs says most mice have - // 1 click = 15 degrees. It's also in the opposite direction of surface space. - return -discreteDelta * 15 * 8; + // 1 click = 15 degrees, i.e. 120 is one click. It's also in the opposite + // direction of surface space. + return -delta120; } Qt::MouseEventSource QWaylandInputDevice::Pointer::FrameData::wheelEventSource() const diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h index b9c69ee14cd..fbc260082cf 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h +++ b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h @@ -308,6 +308,7 @@ protected: void pointer_axis_stop(uint32_t time, uint32_t axis) override; void pointer_axis_discrete(uint32_t axis, int32_t value) override; void pointer_frame() override; + void pointer_axis_value120(uint32_t axis, int32_t value120) override; private slots: void handleFocusDestroyed() { invalidateFocus(); } @@ -343,7 +344,7 @@ public: QWaylandPointerEvent *event = nullptr; QPointF delta; - QPoint discreteDelta; + QPoint delta120; axis_source axisSource = axis_source_wheel; void resetScrollData(); diff --git a/tests/auto/wayland/CMakeLists.txt b/tests/auto/wayland/CMakeLists.txt index dd5c6e5bd30..749e6b83bee 100644 --- a/tests/auto/wayland/CMakeLists.txt +++ b/tests/auto/wayland/CMakeLists.txt @@ -17,6 +17,7 @@ if (NOT WEBOS) add_subdirectory(output) add_subdirectory(primaryselectionv1) add_subdirectory(seatv4) + add_subdirectory(seatv7) add_subdirectory(seat) add_subdirectory(surface) add_subdirectory(tabletv2) diff --git a/tests/auto/wayland/seat/tst_seat.cpp b/tests/auto/wayland/seat/tst_seat.cpp index 68749486b43..8a9375d6872 100644 --- a/tests/auto/wayland/seat/tst_seat.cpp +++ b/tests/auto/wayland/seat/tst_seat.cpp @@ -18,7 +18,7 @@ public: removeAll(); uint capabilities = MockCompositor::Seat::capability_pointer | MockCompositor::Seat::capability_touch; - int version = 7; + int version = 8; add(capabilities, version); }); } @@ -40,8 +40,7 @@ private slots: void fingerScroll(); void fingerScrollSlow(); void continuousScroll(); - void wheelDiscreteScroll_data(); - void wheelDiscreteScroll(); + void highResolutionScroll(); // Touch tests void createsTouch(); @@ -56,13 +55,13 @@ private slots: void tst_seat::bindsToSeat() { QCOMPOSITOR_COMPARE(get()->resourceMap().size(), 1); - QCOMPOSITOR_COMPARE(get()->resourceMap().first()->version(), 7); + QCOMPOSITOR_COMPARE(get()->resourceMap().first()->version(), 8); } void tst_seat::createsPointer() { QCOMPOSITOR_TRY_COMPARE(pointer()->resourceMap().size(), 1); - QCOMPOSITOR_TRY_COMPARE(pointer()->resourceMap().first()->version(), 7); + QCOMPOSITOR_TRY_COMPARE(pointer()->resourceMap().first()->version(), 8); } void tst_seat::setsCursorOnEnter() @@ -320,28 +319,19 @@ void tst_seat::fingerScrollSlow() QCOMPARE(accumulated.y(), -1); } -void tst_seat::wheelDiscreteScroll_data() -{ - QTest::addColumn("source"); - QTest::newRow("wheel") << uint(Pointer::axis_source_wheel); - QTest::newRow("wheel tilt") << uint(Pointer::axis_source_wheel_tilt); -} - -void tst_seat::wheelDiscreteScroll() +void tst_seat::highResolutionScroll() { WheelWindow window; QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial); - QFETCH(uint, source); - exec([=] { auto *p = pointer(); auto *c = client(); p->sendEnter(xdgToplevel()->surface(), {32, 32}); p->sendFrame(c); - p->sendAxisSource(c, Pointer::axis_source(source)); - p->sendAxisDiscrete(c, Pointer::axis_vertical_scroll, 1); // 1 click downwards - p->sendAxis(c, Pointer::axis_vertical_scroll, 1.0); + p->sendAxisSource(c, Pointer::axis_source_wheel); + p->sendAxisValue120(c, Pointer::axis_vertical_scroll, 30); // quarter of a click + p->sendAxis(c, Pointer::axis_vertical_scroll, 3.75); p->sendFrame(c); }); @@ -350,10 +340,26 @@ void tst_seat::wheelDiscreteScroll() auto e = window.m_events.takeFirst(); QCOMPARE(e.phase, Qt::NoScrollPhase); QVERIFY(qAbs(e.angleDelta.x()) <= qAbs(e.angleDelta.y())); // Vertical scroll - // According to the docs the angle delta is in eights of a degree and most mice have - // 1 click = 15 degrees. The angle delta should therefore be: - // 15 degrees / (1/8 eights per degrees) = 120 eights of degrees. - QCOMPARE(e.angleDelta, QPoint(0, -120)); + QCOMPARE(e.angleDelta, QPoint(0, -30)); + // Click scrolls are not continuous and should not have a pixel delta + QCOMPARE(e.pixelDelta, QPoint(0, 0)); + } + + exec([=] { + auto *p = pointer(); + auto *c = client(); + p->sendAxisSource(c, Pointer::axis_source_wheel); + p->sendAxisValue120(c, Pointer::axis_vertical_scroll, 90); // complete the click + p->sendAxis(c, Pointer::axis_vertical_scroll, 11.25); + p->sendFrame(c); + }); + + QTRY_VERIFY(!window.m_events.empty()); + { + auto e = window.m_events.takeFirst(); + QCOMPARE(e.phase, Qt::NoScrollPhase); + QVERIFY(qAbs(e.angleDelta.x()) <= qAbs(e.angleDelta.y())); // Vertical scroll + QCOMPARE(e.angleDelta, QPoint(0, -90)); // Click scrolls are not continuous and should not have a pixel delta QCOMPARE(e.pixelDelta, QPoint(0, 0)); } @@ -388,7 +394,7 @@ void tst_seat::continuousScroll() void tst_seat::createsTouch() { QCOMPOSITOR_TRY_COMPARE(touch()->resourceMap().size(), 1); - QCOMPOSITOR_TRY_COMPARE(touch()->resourceMap().first()->version(), 7); + QCOMPOSITOR_TRY_COMPARE(touch()->resourceMap().first()->version(), 8); } class TouchWindow : public QRasterWindow { diff --git a/tests/auto/wayland/seatv7/CMakeLists.txt b/tests/auto/wayland/seatv7/CMakeLists.txt new file mode 100644 index 00000000000..cf3ade8c723 --- /dev/null +++ b/tests/auto/wayland/seatv7/CMakeLists.txt @@ -0,0 +1,13 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause + +##################################################################### +## tst_seatv7 Test: +##################################################################### + +qt_internal_add_test(tst_seatv7 + SOURCES + tst_seatv7.cpp + LIBRARIES + SharedClientTest +) diff --git a/tests/auto/wayland/seatv7/tst_seatv7.cpp b/tests/auto/wayland/seatv7/tst_seatv7.cpp new file mode 100644 index 00000000000..c341ec96740 --- /dev/null +++ b/tests/auto/wayland/seatv7/tst_seatv7.cpp @@ -0,0 +1,130 @@ +// Copyright (C) 2018 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 + +#include "mockcompositor.h" +#include +#include +#include + +using namespace MockCompositor; + +class SeatCompositor : public DefaultCompositor { +public: + explicit SeatCompositor() + { + exec([this] { + m_config.autoConfigure = true; + + removeAll(); + + uint capabilities = MockCompositor::Seat::capability_pointer | MockCompositor::Seat::capability_touch; + int version = 7; + add(capabilities, version); + }); + } +}; + +class tst_seatv7 : public QObject, private SeatCompositor +{ + Q_OBJECT +private slots: + void cleanup() { QTRY_VERIFY2(isClean(), qPrintable(dirtyMessage())); } + void bindsToSeat(); + + // Pointer tests + void wheelDiscreteScroll_data(); + void wheelDiscreteScroll(); +}; + +void tst_seatv7::bindsToSeat() +{ + QCOMPOSITOR_COMPARE(get()->resourceMap().size(), 1); + QCOMPOSITOR_COMPARE(get()->resourceMap().first()->version(), 7); +} + +class WheelWindow : QRasterWindow { +public: + WheelWindow() + { + resize(64, 64); + show(); + } + void wheelEvent(QWheelEvent *event) override + { + QRasterWindow::wheelEvent(event); +// qDebug() << event << "angleDelta" << event->angleDelta() << "pixelDelta" << event->pixelDelta(); + + if (event->phase() != Qt::ScrollUpdate && event->phase() != Qt::NoScrollPhase) { + // Shouldn't have deltas in the these phases + QCOMPARE(event->angleDelta(), QPoint(0, 0)); + QCOMPARE(event->pixelDelta(), QPoint(0, 0)); + } + + // The axis vector of the event is already in surface space, so there is now way to tell + // whether it is inverted or not. + QCOMPARE(event->inverted(), false); + + // We didn't press any buttons + QCOMPARE(event->buttons(), Qt::NoButton); + + m_events.append(Event{event}); + } + struct Event // Because I didn't find a convenient way to copy it entirely + { + explicit Event() = default; + explicit Event(const QWheelEvent *event) + : phase(event->phase()) + , pixelDelta(event->pixelDelta()) + , angleDelta(event->angleDelta()) + , source(event->source()) + { + } + Qt::ScrollPhase phase{}; + QPoint pixelDelta; + QPoint angleDelta; // eights of a degree, positive is upwards, left + Qt::MouseEventSource source{}; + }; + QList m_events; +}; + +void tst_seatv7::wheelDiscreteScroll_data() +{ + QTest::addColumn("source"); + QTest::newRow("wheel") << uint(Pointer::axis_source_wheel); + QTest::newRow("wheel tilt") << uint(Pointer::axis_source_wheel_tilt); +} + +void tst_seatv7::wheelDiscreteScroll() +{ + WheelWindow window; + QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial); + + QFETCH(uint, source); + + exec([=] { + auto *p = pointer(); + auto *c = client(); + p->sendEnter(xdgToplevel()->surface(), {32, 32}); + p->sendFrame(c); + p->sendAxisSource(c, Pointer::axis_source(source)); + p->sendAxisDiscrete(c, Pointer::axis_vertical_scroll, 1); // 1 click downwards + p->sendAxis(c, Pointer::axis_vertical_scroll, 1.0); + p->sendFrame(c); + }); + + QTRY_VERIFY(!window.m_events.empty()); + { + auto e = window.m_events.takeFirst(); + QCOMPARE(e.phase, Qt::NoScrollPhase); + QVERIFY(qAbs(e.angleDelta.x()) <= qAbs(e.angleDelta.y())); // Vertical scroll + // According to the docs the angle delta is in eights of a degree and most mice have + // 1 click = 15 degrees. The angle delta should therefore be: + // 15 degrees / (1/8 eights per degrees) = 120 eights of degrees. + QCOMPARE(e.angleDelta, QPoint(0, -120)); + // Click scrolls are not continuous and should not have a pixel delta + QCOMPARE(e.pixelDelta, QPoint(0, 0)); + } +} + +QCOMPOSITOR_TEST_MAIN(tst_seatv7) +#include "tst_seatv7.moc" diff --git a/tests/auto/wayland/shared/coreprotocol.cpp b/tests/auto/wayland/shared/coreprotocol.cpp index 005151f74f6..4f3d21d8eb9 100644 --- a/tests/auto/wayland/shared/coreprotocol.cpp +++ b/tests/auto/wayland/shared/coreprotocol.cpp @@ -423,6 +423,13 @@ void Pointer::sendFrame(wl_client *client) send_frame(r->handle); } +void Pointer::sendAxisValue120(wl_client *client, QtWaylandServer::wl_pointer::axis axis, int value120) +{ + const auto pointerResources = resourceMap().values(client); + for (auto *r : pointerResources) + send_axis_value120(r->handle, axis, value120); +} + void Pointer::pointer_set_cursor(Resource *resource, uint32_t serial, wl_resource *surface, int32_t hotspot_x, int32_t hotspot_y) { Q_UNUSED(resource); diff --git a/tests/auto/wayland/shared/coreprotocol.h b/tests/auto/wayland/shared/coreprotocol.h index 370b8cd84bb..74f07afbf44 100644 --- a/tests/auto/wayland/shared/coreprotocol.h +++ b/tests/auto/wayland/shared/coreprotocol.h @@ -296,7 +296,7 @@ class Seat : public Global, public QtWaylandServer::wl_seat { Q_OBJECT public: - explicit Seat(CoreCompositor *compositor, uint capabilities = Seat::capability_pointer | Seat::capability_keyboard | Seat::capability_touch, int version = 7); + explicit Seat(CoreCompositor *compositor, uint capabilities = Seat::capability_pointer | Seat::capability_keyboard | Seat::capability_touch, int version = 8); ~Seat() override; void send_capabilities(Resource *resource, uint capabilities) = delete; // Use wrapper instead void send_capabilities(uint capabilities) = delete; // Use wrapper instead @@ -346,6 +346,7 @@ public: void sendAxisSource(wl_client *client, axis_source source); void sendAxisStop(wl_client *client, axis axis); void sendFrame(wl_client *client); + void sendAxisValue120(wl_client *client, axis axis, int value120); Seat *m_seat = nullptr; QList m_enterSerials; From 9dd6cc178866eef142f6ab2bbfb9ef44a97af272 Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Wed, 19 Jan 2022 12:33:19 +0200 Subject: [PATCH 1119/1507] Client: Add support for xdg_toplevel.configure_bounds Currently, QtWayland doesn't know about work area size, which can create a problem where some windows don't fit into the screen area or work area. With the xdg_toplevel.configure_bounds event, the compositor can indicate the client the recommended maximum window geometry size. https://gitlab.freedesktop.org/wayland/wayland-protocols/-/merge_requests/41 Change-Id: I5214aba9f144d091a2afe639de94b8d717c42fdc Reviewed-by: David Edmundson --- src/3rdparty/wayland/protocols/xdg-shell.xml | 167 ++++++++++++++++-- .../xdg-shell/qwaylandxdgshell.cpp | 15 +- .../xdg-shell/qwaylandxdgshell_p.h | 2 + 3 files changed, 162 insertions(+), 22 deletions(-) diff --git a/src/3rdparty/wayland/protocols/xdg-shell.xml b/src/3rdparty/wayland/protocols/xdg-shell.xml index 3a87a9ed6ed..9b5279ead9e 100644 --- a/src/3rdparty/wayland/protocols/xdg-shell.xml +++ b/src/3rdparty/wayland/protocols/xdg-shell.xml @@ -29,7 +29,7 @@ DEALINGS IN THE SOFTWARE. - + The xdg_wm_base interface is exposed as a global object enabling clients to turn their wl_surfaces into windows in a desktop environment. It @@ -75,7 +75,9 @@ This creates an xdg_surface for the given surface. While xdg_surface itself is not a role, the corresponding surface may only be assigned - a role extending xdg_surface, such as xdg_toplevel or xdg_popup. + a role extending xdg_surface, such as xdg_toplevel or xdg_popup. It is + illegal to create an xdg_surface for a wl_surface which already has an + assigned role and this will result in a protocol error. This creates an xdg_surface for the given surface. An xdg_surface is used as basis to define a role to a given surface, such as xdg_toplevel @@ -115,7 +117,7 @@ - + The xdg_positioner provides a collection of rules for the placement of a child surface relative to a parent surface. Rules can be defined to ensure @@ -357,9 +359,49 @@ + + + + + + When set reactive, the surface is reconstrained if the conditions used + for constraining changed, e.g. the parent window moved. + + If the conditions changed and the popup was reconstrained, an + xdg_popup.configure event is sent with updated geometry, followed by an + xdg_surface.configure event. + + + + + + Set the parent window geometry the compositor should use when + positioning the popup. The compositor may use this information to + determine the future state the popup should be constrained using. If + this doesn't match the dimension of the parent the popup is eventually + positioned against, the behavior is undefined. + + The arguments are given in the surface-local coordinate space. + + + + + + + + Set the serial of an xdg_surface.configure event this positioner will be + used in response to. The compositor may use this information together + with set_parent_size to determine what future state the popup should be + constrained using. + + + - + An interface that may be implemented by a wl_surface, for implementations that provide a desktop-style user interface. @@ -386,6 +428,11 @@ manipulate a buffer prior to the first xdg_surface.configure call must also be treated as errors. + After creating a role-specific object and setting it up, the client must + perform an initial commit without any buffer attached. The compositor + will reply with an xdg_surface.configure event. The client must + acknowledge it and is then allowed to attach a buffer to map the surface. + Mapping an xdg_surface-based role surface is defined as making it possible for the surface to be shown by the compositor. Note that a mapped surface is not guaranteed to be visible once it is mapped. @@ -399,7 +446,8 @@ A newly-unmapped surface is considered to have met condition (1) out of the 3 required conditions for mapping a surface if its role surface - has not been destroyed. + has not been destroyed, i.e. the client must perform the initial commit + again before attaching a buffer. @@ -526,9 +574,10 @@ + - + This interface defines an xdg_surface role which allows a surface to, among other things, set window-like properties such as maximize, @@ -540,7 +589,11 @@ by the compositor until it is explicitly mapped again. All active operations (e.g., move, resize) are canceled and all attributes (e.g. title, state, stacking, ...) are discarded for - an xdg_toplevel surface when it is unmapped. + an xdg_toplevel surface when it is unmapped. The xdg_toplevel returns to + the state it had right after xdg_surface.get_toplevel. The client + can re-map the toplevel by perfoming a commit without any buffer + attached, waiting for a configure event and handling it as usual (see + xdg_surface description). Attaching a null buffer to a toplevel unmaps the surface. @@ -710,7 +763,7 @@ - + @@ -757,25 +810,25 @@ - + The window is currently in a tiled layout and the left edge is considered to be adjacent to another part of the tiling grid. - + The window is currently in a tiled layout and the right edge is considered to be adjacent to another part of the tiling grid. - + The window is currently in a tiled layout and the top edge is considered to be adjacent to another part of the tiling grid. - + The window is currently in a tiled layout and the bottom edge is considered to be adjacent to another part of the tiling grid. @@ -1017,9 +1070,33 @@ a dialog to ask the user to save their data, etc. + + + + + + The configure_bounds event may be sent prior to a xdg_toplevel.configure + event to communicate the bounds a window geometry size is recommended + to constrain to. + + The passed width and height are in surface coordinate space. If width + and height are 0, it means bounds is unknown and equivalent to as if no + configure_bounds event was ever sent for this surface. + + The bounds can for example correspond to the size of a monitor excluding + any panels or other shell components, so that a surface isn't created in + a way that it cannot fit. + + The bounds may change at any point, and in such a case, a new + xdg_toplevel.configure_bounds will be sent, followed by + xdg_toplevel.configure and xdg_surface.configure. + + + + - + A popup surface is a short-lived, temporary surface. It can be used to implement for example menus, popovers, tooltips and other similar user @@ -1043,12 +1120,6 @@ The parent of an xdg_popup must be mapped (see the xdg_surface description) before the xdg_popup itself. - The x and y arguments passed when creating the popup object specify - where the top left of the popup should be placed, relative to the - local surface coordinates of the parent surface. See - xdg_surface.get_popup. An xdg_popup must intersect with or be at least - partially adjacent to its parent surface. - The client must call wl_surface.commit on the corresponding wl_surface for the xdg_popup state to take effect. @@ -1126,6 +1197,11 @@ The x and y arguments represent the position the popup was placed at given the xdg_positioner rule, relative to the upper left corner of the window geometry of the parent surface. + + For version 2 or older, the configure event for an xdg_popup is only + ever sent once for the initial configuration. Starting with version 3, + it may be sent again if the popup is setup with an xdg_positioner with + set_reactive requested, or in response to xdg_popup.reposition requests. @@ -1143,5 +1219,58 @@ + + + + + Reposition an already-mapped popup. The popup will be placed given the + details in the passed xdg_positioner object, and a + xdg_popup.repositioned followed by xdg_popup.configure and + xdg_surface.configure will be emitted in response. Any parameters set + by the previous positioner will be discarded. + + The passed token will be sent in the corresponding + xdg_popup.repositioned event. The new popup position will not take + effect until the corresponding configure event is acknowledged by the + client. See xdg_popup.repositioned for details. The token itself is + opaque, and has no other special meaning. + + If multiple reposition requests are sent, the compositor may skip all + but the last one. + + If the popup is repositioned in response to a configure event for its + parent, the client should send an xdg_positioner.set_parent_configure + and possibly an xdg_positioner.set_parent_size request to allow the + compositor to properly constrain the popup. + + If the popup is repositioned together with a parent that is being + resized, but not in response to a configure event, the client should + send an xdg_positioner.set_parent_size request. + + + + + + + + The repositioned event is sent as part of a popup configuration + sequence, together with xdg_popup.configure and lastly + xdg_surface.configure to notify the completion of a reposition request. + + The repositioned event is to notify about the completion of a + xdg_popup.reposition request. The token argument is the token passed + in the xdg_popup.reposition request. + + Immediately after this event is emitted, xdg_popup.configure and + xdg_surface.configure will be sent with the updated size and position, + as well as a new configure serial. + + The client should optionally update the content of the popup, but must + acknowledge the new popup configuration for the new position to take + effect. See xdg_surface.ack_configure for details. + + + + diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp index fad8b5817c4..c0d7a7d46ba 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp @@ -61,8 +61,12 @@ void QWaylandXdgSurface::Toplevel::applyConfigure() if (m_pending.size.isEmpty()) { // An empty size in the configure means it's up to the client to choose the size bool normalPending = !(m_pending.states & (Qt::WindowMaximized|Qt::WindowFullScreen)); - if (normalPending && !m_normalSize.isEmpty()) - m_xdgSurface->m_window->resizeFromApplyConfigure(m_normalSize); + if (normalPending && !m_normalSize.isEmpty()) { + QSize size = m_normalSize; + if (!m_pending.bounds.isEmpty()) + size = size.boundedTo(m_pending.bounds); + m_xdgSurface->m_window->resizeFromApplyConfigure(size); + } } else { m_xdgSurface->m_window->resizeFromApplyConfigure(m_pending.size); } @@ -80,6 +84,11 @@ bool QWaylandXdgSurface::Toplevel::wantsDecorations() return !(m_pending.states & Qt::WindowFullScreen); } +void QWaylandXdgSurface::Toplevel::xdg_toplevel_configure_bounds(int32_t width, int32_t height) +{ + m_pending.bounds = QSize(width, height); +} + void QWaylandXdgSurface::Toplevel::xdg_toplevel_configure(int32_t width, int32_t height, wl_array *states) { m_pending.size = QSize(width, height); @@ -578,7 +587,7 @@ QString QWaylandXdgSurface::externWindowHandle() } QWaylandXdgShell::QWaylandXdgShell(QWaylandDisplay *display, uint32_t id, uint32_t availableVersion) - : QtWayland::xdg_wm_base(display->wl_registry(), id, qMin(availableVersion, 2u)) + : QtWayland::xdg_wm_base(display->wl_registry(), id, qMin(availableVersion, 4u)) , m_display(display) { display->addRegistryListener(&QWaylandXdgShell::handleRegistryGlobal, this); diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h index dfd61105abc..abfd0db3baf 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h @@ -88,6 +88,7 @@ private: void xdg_toplevel_configure(int32_t width, int32_t height, wl_array *states) override; void xdg_toplevel_close() override; + void xdg_toplevel_configure_bounds(int32_t width, int32_t height) override; void requestWindowFlags(Qt::WindowFlags flags); void requestWindowStates(Qt::WindowStates states); @@ -95,6 +96,7 @@ private: static resize_edge convertToResizeEdges(Qt::Edges edges); struct { + QSize bounds = {0, 0}; QSize size = {0, 0}; Qt::WindowStates states = Qt::WindowNoState; } m_pending, m_applied; From efdd7b575506970cda31312f41cfec297c47e7d7 Mon Sep 17 00:00:00 2001 From: David Redondo Date: Thu, 28 Jul 2022 10:09:57 +0200 Subject: [PATCH 1120/1507] Implement QNativeInterface::QWaylandApplication Task-number: QTBUG-94729 Change-Id: I84f080719c6364137368bdd1759947a6d6ef2e5b Reviewed-by: Qt CI Bot Reviewed-by: David Edmundson --- .../wayland/qwaylandnativeinterface.cpp | 55 +++++++++++++++++++ .../wayland/qwaylandnativeinterface_p.h | 20 +++++-- 2 files changed, 71 insertions(+), 4 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp b/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp index f2620fc43f7..b76b1f08b82 100644 --- a/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp +++ b/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp @@ -12,6 +12,7 @@ #include "qwaylandwindowmanagerintegration_p.h" #include "qwaylandscreen_p.h" #include "qwaylandinputdevice_p.h" +#include #include #include #include @@ -68,6 +69,60 @@ void *QWaylandNativeInterface::nativeResourceForIntegration(const QByteArray &re return nullptr; } +wl_display *QtWaylandClient::QWaylandNativeInterface::display() const +{ + return m_integration->display()->wl_display(); +} + +wl_compositor *QtWaylandClient::QWaylandNativeInterface::compositor() const +{ + return const_cast(m_integration->display()->wl_compositor()); +} + +wl_seat *QtWaylandClient::QWaylandNativeInterface::seat() const +{ + if (auto inputDevice = m_integration->display()->defaultInputDevice()) { + return inputDevice->wl_seat(); + } + return nullptr; +} + +wl_keyboard *QtWaylandClient::QWaylandNativeInterface::keyboard() const +{ + if (auto inputDevice = m_integration->display()->defaultInputDevice()) + if (auto keyboard = inputDevice->keyboard()) + return keyboard->wl_keyboard(); + return nullptr; +} + +wl_pointer *QtWaylandClient::QWaylandNativeInterface::pointer() const +{ + if (auto inputDevice = m_integration->display()->defaultInputDevice()) + if (auto pointer = inputDevice->pointer()) + return pointer->wl_pointer(); + return nullptr; +} + +wl_touch *QtWaylandClient::QWaylandNativeInterface::touch() const +{ + if (auto inputDevice = m_integration->display()->defaultInputDevice()) + if (auto touch = inputDevice->touch()) + return touch->wl_touch(); + return nullptr; +} + +uint QtWaylandClient::QWaylandNativeInterface::lastInputSerial() const +{ + return m_integration->display()->lastInputSerial(); +} + +wl_seat *QtWaylandClient::QWaylandNativeInterface::lastInputSeat() const +{ + if (auto inputDevice = m_integration->display()->lastInputDevice()) + return inputDevice->wl_seat(); + return nullptr; +} + void *QWaylandNativeInterface::nativeResourceForWindow(const QByteArray &resourceString, QWindow *window) { QByteArray lowerCaseResource = resourceString.toLower(); diff --git a/src/plugins/platforms/wayland/qwaylandnativeinterface_p.h b/src/plugins/platforms/wayland/qwaylandnativeinterface_p.h index b39d9952656..ce8c6bec3fd 100644 --- a/src/plugins/platforms/wayland/qwaylandnativeinterface_p.h +++ b/src/plugins/platforms/wayland/qwaylandnativeinterface_p.h @@ -1,8 +1,8 @@ // Copyright (C) 2020 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only -#ifndef QWAYLANDNATIVEINTERFACE_H -#define QWAYLANDNATIVEINTERFACE_H +#ifndef QWAYLANDNATIVEINTERFACE_P_H +#define QWAYLANDNATIVEINTERFACE_P_H // // W A R N I N G @@ -21,6 +21,7 @@ #include #include #include +#include QT_BEGIN_NAMESPACE @@ -31,7 +32,8 @@ namespace QtWaylandClient { class QWaylandIntegration; class QWaylandScreen; -class Q_WAYLANDCLIENT_EXPORT QWaylandNativeInterface : public QPlatformNativeInterface +class Q_WAYLANDCLIENT_EXPORT QWaylandNativeInterface : public QPlatformNativeInterface, + public QNativeInterface::QWaylandApplication { public: QWaylandNativeInterface(QWaylandIntegration *integration); @@ -51,6 +53,16 @@ public: void emitWindowPropertyChanged(QPlatformWindow *window, const QString &name); + // QWaylandApplication interface + wl_display *display() const override; + wl_compositor *compositor() const override; + wl_seat *seat() const override; + wl_keyboard *keyboard() const override; + wl_pointer *pointer() const override; + wl_touch *touch() const override; + uint lastInputSerial() const override; + wl_seat *lastInputSeat() const override; + private: static void setWindowMargins(QWindow *window, const QMargins &margins); @@ -62,4 +74,4 @@ private: QT_END_NAMESPACE -#endif // QWAYLANDNATIVEINTERFACE_H +#endif // QWAYLANDNATIVEINTERFACE_P_H From 50dbfe3970a8852ec5e5daad99d8b4f7751391e1 Mon Sep 17 00:00:00 2001 From: Jonas Karlsson Date: Fri, 28 Oct 2022 03:08:48 +0200 Subject: [PATCH 1121/1507] Disable/fix warnings missing-field-initializers and unused variable Change-Id: I1a5ceaf53ec706786c73eecab0c002fa9153b962 Reviewed-by: Qt CI Bot Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/tools/qtwaylandscanner/qtwaylandscanner.cpp | 3 +++ tests/auto/wayland/client/tst_client.cpp | 2 -- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp index f80795099f5..1b0a4a149ca 100644 --- a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp +++ b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp @@ -639,6 +639,7 @@ bool Scanner::process() printf("QT_BEGIN_NAMESPACE\n"); printf("QT_WARNING_PUSH\n"); printf("QT_WARNING_DISABLE_GCC(\"-Wmissing-field-initializers\")\n"); + printf("QT_WARNING_DISABLE_CLANG(\"-Wmissing-field-initializers\")\n"); printf("\n"); printf("namespace QtWaylandServer {\n"); @@ -972,6 +973,7 @@ bool Scanner::process() printf("QT_BEGIN_NAMESPACE\n"); printf("QT_WARNING_PUSH\n"); printf("QT_WARNING_DISABLE_GCC(\"-Wmissing-field-initializers\")\n"); + printf("QT_WARNING_DISABLE_CLANG(\"-Wmissing-field-initializers\")\n"); QByteArray clientExport; if (m_headerPath.size()) @@ -1079,6 +1081,7 @@ bool Scanner::process() printf("QT_BEGIN_NAMESPACE\n"); printf("QT_WARNING_PUSH\n"); printf("QT_WARNING_DISABLE_GCC(\"-Wmissing-field-initializers\")\n"); + printf("QT_WARNING_DISABLE_CLANG(\"-Wmissing-field-initializers\")\n"); printf("\n"); printf("namespace QtWayland {\n"); printf("\n"); diff --git a/tests/auto/wayland/client/tst_client.cpp b/tests/auto/wayland/client/tst_client.cpp index db4eb77e451..54d5865972e 100644 --- a/tests/auto/wayland/client/tst_client.cpp +++ b/tests/auto/wayland/client/tst_client.cpp @@ -21,8 +21,6 @@ using namespace MockCompositor; -static const QSize screenSize(1600, 1200); - constexpr int dataDeviceVersion = 1; class TestCompositor : public WlShellCompositor { From ea5bad90316b21b7ba577b6f5f9fb6551e11149c Mon Sep 17 00:00:00 2001 From: Inho Lee Date: Thu, 6 Oct 2022 19:46:56 +0200 Subject: [PATCH 1122/1507] Always use blocking write for data_source.send QtWaylandClient assumes that data_source's fd is BLOCKING, but some compositors (e.g. mutter) pass an fd with O_NONBLOCK set. In this case, 'write' is not guaranteed to process all of the passed data in one call. Instead of dealing with such partial writes, remove O_NONBLOCK. Fixes: QTBUG-107076 Pick-to: 6.4 6.2 5.15 Change-Id: Ieb446da9fdfbaaa55100f573b396ee449cadc463 Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/plugins/platforms/wayland/qwaylanddatasource.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/plugins/platforms/wayland/qwaylanddatasource.cpp b/src/plugins/platforms/wayland/qwaylanddatasource.cpp index ef1d14d397a..093c40f2fd5 100644 --- a/src/plugins/platforms/wayland/qwaylanddatasource.cpp +++ b/src/plugins/platforms/wayland/qwaylanddatasource.cpp @@ -13,6 +13,7 @@ #include #include +#include QT_BEGIN_NAMESPACE @@ -57,6 +58,13 @@ void QWaylandDataSource::data_source_send(const QString &mime_type, int32_t fd) action.sa_flags = 0; sigaction(SIGPIPE, &action, &oldAction); + // Some compositors (e.g., mutter) make fd with O_NONBLOCK. + // Since wl_data_source.send describes that fd is closed here, + // it should be done in a loop and don't have any advantage. + // Blocking operation will be used. + // According to fcntl(2), FSETFL ignores O_WRONLY. So this + // call will just remove O_NONBLOCK. + fcntl(fd, F_SETFL, O_WRONLY); ssize_t unused = write(fd, content.constData(), content.size()); Q_UNUSED(unused); sigaction(SIGPIPE, &oldAction, nullptr); From 9c5b09ee8d48ed16584c40c7069ec6c9957d7c55 Mon Sep 17 00:00:00 2001 From: David Redondo Date: Wed, 12 Oct 2022 09:01:07 +0200 Subject: [PATCH 1123/1507] Implement QNativeInterface::Private::QWaylandScreen MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I2f5cc638f33fe0d884146342516efa7ce8474478 Task-number: QTBUG-94729 Reviewed-by: Tor Arne Vestbø --- src/plugins/platforms/wayland/qwaylandscreen_p.h | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandscreen_p.h b/src/plugins/platforms/wayland/qwaylandscreen_p.h index 836dd0392d0..4499f0eef14 100644 --- a/src/plugins/platforms/wayland/qwaylandscreen_p.h +++ b/src/plugins/platforms/wayland/qwaylandscreen_p.h @@ -16,6 +16,7 @@ // #include +#include #include #include @@ -34,7 +35,10 @@ public: QWaylandXdgOutputManagerV1(QWaylandDisplay *display, uint id, uint version); }; -class Q_WAYLANDCLIENT_EXPORT QWaylandScreen : public QPlatformScreen, QtWayland::wl_output, QtWayland::zxdg_output_v1 +class Q_WAYLANDCLIENT_EXPORT QWaylandScreen : public QPlatformScreen, + QtWayland::wl_output, + QtWayland::zxdg_output_v1, + public QNativeInterface::Private::QWaylandScreen { public: QWaylandScreen(QWaylandDisplay *waylandDisplay, int version, uint32_t id); @@ -70,7 +74,10 @@ public: #endif uint32_t outputId() const { return m_outputId; } - ::wl_output *output() { return QtWayland::wl_output::object(); } + ::wl_output *output() const override + { + return const_cast<::wl_output *>(QtWayland::wl_output::object()); + } static QWaylandScreen *waylandScreenFromWindow(QWindow *window); static QWaylandScreen *fromWlOutput(::wl_output *output); From 8826dbb61348ea2dfa8bfe7dac0e2b82d47a5698 Mon Sep 17 00:00:00 2001 From: Inho Lee Date: Thu, 3 Nov 2022 13:12:45 +0100 Subject: [PATCH 1124/1507] Add dependencies of wayland protocols Some macros are missing DEPENDS for add_custom_commands Fixes: QTBUG-108142 Change-Id: Ifacb2ea9bf3003c10dd407a8c77fc06b893b6a65 Reviewed-by: David Edmundson --- src/tools/qtwaylandscanner/Qt6WaylandClientMacros.cmake | 2 ++ src/tools/qtwaylandscanner/Qt6WaylandCompositorMacros.cmake | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/src/tools/qtwaylandscanner/Qt6WaylandClientMacros.cmake b/src/tools/qtwaylandscanner/Qt6WaylandClientMacros.cmake index ea0ac323f8e..9fcec57d230 100644 --- a/src/tools/qtwaylandscanner/Qt6WaylandClientMacros.cmake +++ b/src/tools/qtwaylandscanner/Qt6WaylandClientMacros.cmake @@ -38,11 +38,13 @@ function(qt6_generate_wayland_protocol_client_sources target) OUTPUT "${waylandscanner_header_output}" #TODO: Maybe put the files in ${CMAKE_CURRENT_BINARY_DIR/wayland_generated instead? COMMAND Wayland::Scanner --strict ${waylandscanner_extra_args} client-header < "${protocol_file}" > "${waylandscanner_header_output}" + DEPENDS ${protocol_file} Wayland::Scanner ) add_custom_command( OUTPUT "${waylandscanner_code_output}" COMMAND Wayland::Scanner --strict ${waylandscanner_extra_args} public-code < "${protocol_file}" > "${waylandscanner_code_output}" + DEPENDS ${protocol_file} Wayland::Scanner ) set(wayland_include_dir "") diff --git a/src/tools/qtwaylandscanner/Qt6WaylandCompositorMacros.cmake b/src/tools/qtwaylandscanner/Qt6WaylandCompositorMacros.cmake index cce2073ca1c..3221f815b72 100644 --- a/src/tools/qtwaylandscanner/Qt6WaylandCompositorMacros.cmake +++ b/src/tools/qtwaylandscanner/Qt6WaylandCompositorMacros.cmake @@ -34,10 +34,12 @@ function(qt6_generate_wayland_protocol_server_sources target) OUTPUT "${waylandscanner_header_output}" #TODO: Maybe put the files in ${CMAKE_CURRENT_BINARY_DIR/wayland_generated instead? COMMAND Wayland::Scanner --strict --include-core-only server-header < "${protocol_file}" > "${waylandscanner_header_output}" + DEPENDS ${protocol_file} Wayland::Scanner ) add_custom_command( OUTPUT "${waylandscanner_code_output}" COMMAND Wayland::Scanner --strict --include-core-only public-code < "${protocol_file}" > "${waylandscanner_code_output}" + DEPENDS ${protocol_file} Wayland::Scanner ) set(wayland_include_dir "") @@ -60,6 +62,7 @@ function(qt6_generate_wayland_protocol_server_sources target) --build-macro=${build_macro} --header-path='${wayland_include_dir}' > "${qtwaylandscanner_header_output}" + DEPENDS ${protocol_file} Qt6::qtwaylandscanner ) add_custom_command( @@ -69,6 +72,7 @@ function(qt6_generate_wayland_protocol_server_sources target) --build-macro=${build_macro} --header-path='${wayland_include_dir}' > "${qtwaylandscanner_code_output}" + DEPENDS ${protocol_file} Qt6::qtwaylandscanner ) target_sources(${target} PRIVATE From e0c53e4f6d11d70ddc47950f8d6d7b335732dd85 Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Tue, 12 Oct 2021 13:21:10 +0100 Subject: [PATCH 1125/1507] Remove uneeded forceRoundTrip on XdgOutputManager In the first rountrip we will get all wl_outputs and the xdg_output_manager. Therefore we know we will have called wl_output.bind and xdg_output_manager_get_output by the time we hit the second roundtrip on startup. Change-Id: I69f911c13f9bcdfb59b04eceea4bcca778e7755c Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/plugins/platforms/wayland/qwaylanddisplay.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index ca5669ad7b4..18eb71c36b5 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -597,7 +597,6 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin mXdgOutputManager.reset(new QWaylandXdgOutputManagerV1(this, id, version)); for (auto *screen : std::as_const(mWaitingScreens)) screen->initXdgOutput(xdgOutputManager()); - forceRoundTrip(); } mGlobals.append(RegistryGlobal(id, interface, version, registry)); From f733811432aa31a7c680fadd7aee7fd3c03262f5 Mon Sep 17 00:00:00 2001 From: Liang Qi Date: Wed, 2 Nov 2022 13:15:27 +0100 Subject: [PATCH 1126/1507] tests: fix tst_seatv4 to use 24 as default cursor size Also set default cursor size to 24 for client, which is correct both on KDE and GNOME at least. Fixes: QTBUG-104259 Pick-to: 6.4 6.2 5.15 Change-Id: Ie4ba27695974025b093a86d8c96fb23d25ad23f7 Reviewed-by: Inho Lee Reviewed-by: David Edmundson Reviewed-by: Qt CI Bot --- src/plugins/platforms/wayland/qwaylandinputdevice.cpp | 2 +- tests/auto/wayland/seatv4/tst_seatv4.cpp | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index 4b4e54bd86e..724243cc3b1 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -237,7 +237,7 @@ QString QWaylandInputDevice::Pointer::cursorThemeName() const int QWaylandInputDevice::Pointer::cursorSize() const { - constexpr int defaultCursorSize = 32; + constexpr int defaultCursorSize = 24; static const int xCursorSize = qEnvironmentVariableIntValue("XCURSOR_SIZE"); return xCursorSize > 0 ? xCursorSize : defaultCursorSize; } diff --git a/tests/auto/wayland/seatv4/tst_seatv4.cpp b/tests/auto/wayland/seatv4/tst_seatv4.cpp index 873b0ff6101..314569a1c49 100644 --- a/tests/auto/wayland/seatv4/tst_seatv4.cpp +++ b/tests/auto/wayland/seatv4/tst_seatv4.cpp @@ -38,6 +38,7 @@ class tst_seatv4 : public QObject, private SeatV4Compositor { Q_OBJECT private slots: + void init(); void cleanup(); void bindsToSeat(); void keyboardKeyPress(); @@ -60,6 +61,12 @@ private slots: #endif }; +void tst_seatv4::init() +{ + // Remove the extra outputs to clean up for the next test + exec([&] { while (auto *o = output(1)) remove(o); }); +} + void tst_seatv4::cleanup() { QTRY_VERIFY2(isClean(), qPrintable(dirtyMessage())); @@ -110,7 +117,7 @@ void tst_seatv4::setsCursorOnEnter() window.show(); QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial); - exec([&] { pointer()->sendEnter(xdgSurface()->m_surface, {32, 32}); }); + exec([&] { pointer()->sendEnter(xdgSurface()->m_surface, {24, 24}); }); QCOMPOSITOR_TRY_VERIFY(cursorSurface()); } @@ -335,7 +342,7 @@ static bool supportsCursorSizes(const QList &sizes) static uint defaultCursorSize() { const int xCursorSize = qEnvironmentVariableIntValue("XCURSOR_SIZE"); - return xCursorSize > 0 ? uint(xCursorSize) : 32; + return xCursorSize > 0 ? uint(xCursorSize) : 24; } void tst_seatv4::scaledCursor() From b2c0a783d0d554b39d21b4daaf9143311b9f96f3 Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Thu, 17 Nov 2022 15:25:37 +0200 Subject: [PATCH 1127/1507] Client: Add F_SEAL_SHRINK seal to shm backing file This lets libwayland-server avoid installing a SIGBUS handler when it wants to mmap() the backing file and access the contents of shared memory client buffers. Change-Id: Id0b17f729799535d73e8700c5a99c32fd88a068a Reviewed-by: Qt CI Bot Reviewed-by: David Edmundson --- src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp b/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp index a8e59637a1f..2e0c2491fe4 100644 --- a/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp +++ b/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp @@ -16,6 +16,7 @@ #include +#include #include #include @@ -25,6 +26,9 @@ # ifndef MFD_CLOEXEC # define MFD_CLOEXEC 0x0001U # endif +# ifndef MFD_ALLOW_SEALING +# define MFD_ALLOW_SEALING 0x0002U +# endif #endif QT_BEGIN_NAMESPACE @@ -39,7 +43,9 @@ QWaylandShmBuffer::QWaylandShmBuffer(QWaylandDisplay *display, int fd = -1; #ifdef SYS_memfd_create - fd = syscall(SYS_memfd_create, "wayland-shm", MFD_CLOEXEC); + fd = syscall(SYS_memfd_create, "wayland-shm", MFD_CLOEXEC | MFD_ALLOW_SEALING); + if (fd >= 0) + fcntl(fd, F_ADD_SEALS, F_SEAL_SHRINK | F_SEAL_SEAL); #endif QScopedPointer filePointer; From f2f98a11819abc62d44b622279b7c6cc3f117566 Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Mon, 21 Nov 2022 18:39:40 +0200 Subject: [PATCH 1128/1507] Client: Call wl_output_release() upon QWaylandScreen destruction It ensures that the proxy gets destroyed. Change-Id: I915cc8814e33dd3b0405b2bf82bd12ce6b5f785b Reviewed-by: David Edmundson --- src/plugins/platforms/wayland/qwaylandscreen.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/plugins/platforms/wayland/qwaylandscreen.cpp b/src/plugins/platforms/wayland/qwaylandscreen.cpp index 4f75d205ab1..7239f869a2d 100644 --- a/src/plugins/platforms/wayland/qwaylandscreen.cpp +++ b/src/plugins/platforms/wayland/qwaylandscreen.cpp @@ -44,6 +44,8 @@ QWaylandScreen::~QWaylandScreen() { if (zxdg_output_v1::isInitialized()) zxdg_output_v1::destroy(); + if (wl_output::isInitialized() && wl_output::version() >= WL_OUTPUT_RELEASE_SINCE_VERSION) + wl_output::release(); } uint QWaylandScreen::requiredEvents() const From 6ec226dbd10a8bfbee8947c563f9e817ac5ad0dc Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Tue, 22 Nov 2022 12:33:41 +0200 Subject: [PATCH 1129/1507] Client: Bump wl_output version wl_output_release is available starting with wl_output v3. Change-Id: I21822b26728ffb9318f1f8b4bd82ef7329682838 Reviewed-by: David Edmundson --- src/plugins/platforms/wayland/qwaylandscreen.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandscreen.cpp b/src/plugins/platforms/wayland/qwaylandscreen.cpp index 7239f869a2d..7c4f1bdf2c7 100644 --- a/src/plugins/platforms/wayland/qwaylandscreen.cpp +++ b/src/plugins/platforms/wayland/qwaylandscreen.cpp @@ -23,7 +23,7 @@ QWaylandXdgOutputManagerV1::QWaylandXdgOutputManagerV1(QWaylandDisplay* display, } QWaylandScreen::QWaylandScreen(QWaylandDisplay *waylandDisplay, int version, uint32_t id) - : QtWayland::wl_output(waylandDisplay->wl_registry(), id, qMin(version, 2)) + : QtWayland::wl_output(waylandDisplay->wl_registry(), id, qMin(version, 3)) , m_outputId(id) , mWaylandDisplay(waylandDisplay) , mOutputName(QStringLiteral("Screen%1").arg(id)) From 27e59681acfb42e77c507ec0ba142c5d4a0df030 Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Tue, 22 Nov 2022 20:58:22 +0200 Subject: [PATCH 1130/1507] Client: Honor QGuiApplication::overrideCursor() If there's a QGuiApplication::overrideCursor(), QWindow::cursor() can still return a different cursor. This can result in a wrong cursor when the pointer enters a window. Pick-to: 6.4 6.2 5.15 Fixes: QTBUG-75919 Change-Id: I015117b4b6d252b421ab14bd8f2a8f582f7cae52 Reviewed-by: Liang Qi --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index c8d5121f6d1..dcd80f372de 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -1263,7 +1263,10 @@ void QWaylandWindow::setMouseCursor(QWaylandInputDevice *device, const QCursor & void QWaylandWindow::restoreMouseCursor(QWaylandInputDevice *device) { - setMouseCursor(device, window()->cursor()); + if (const QCursor *overrideCursor = QGuiApplication::overrideCursor()) + setMouseCursor(device, *overrideCursor); + else + setMouseCursor(device, window()->cursor()); } #endif From 2b49cf04a6220e4b21728fc9d9cc23b85ed3ae7c Mon Sep 17 00:00:00 2001 From: Weng Xuetian Date: Sun, 27 Nov 2022 12:44:40 -0800 Subject: [PATCH 1131/1507] Fix frame sync related to unprotected multithread access There is a few crashes happens in real life that frame callback is double-free'd and hit an assertion in wayland-client. e.g. https://bugs.kde.org/show_bug.cgi?id=450003 This is due to the WaylandEventThread and calls to QWaylandWindow::reset may free and unset the mFrameCallback at the same time. mFrameSyncMutex should be used to protect such access. Pick-to: 6.4 Change-Id: Ie01d08d07a2f10f70606ed1935caac09cb4f0382 Reviewed-by: David Edmundson --- .../platforms/wayland/qwaylandwindow.cpp | 64 +++++++++++-------- .../platforms/wayland/qwaylandwindow_p.h | 11 ++-- 2 files changed, 43 insertions(+), 32 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index dcd80f372de..f4d49c84d6c 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -228,13 +228,16 @@ void QWaylandWindow::reset() mSurface.reset(); } - if (mFrameCallback) { - wl_callback_destroy(mFrameCallback); - mFrameCallback = nullptr; - } + { + QMutexLocker lock(&mFrameSyncMutex); + if (mFrameCallback) { + wl_callback_destroy(mFrameCallback); + mFrameCallback = nullptr; + } - mFrameCallbackElapsedTimer.invalidate(); - mWaitingForFrameCallback = false; + mFrameCallbackElapsedTimer.invalidate(); + mWaitingForFrameCallback = false; + } mFrameCallbackTimedOut = false; mWaitingToApplyConfigure = false; @@ -672,18 +675,21 @@ const wl_callback_listener QWaylandWindow::callbackListener = { [](void *data, wl_callback *callback, uint32_t time) { Q_UNUSED(time); auto *window = static_cast(data); - - Q_ASSERT(callback == window->mFrameCallback); - wl_callback_destroy(callback); - window->mFrameCallback = nullptr; - - window->handleFrameCallback(); + window->handleFrameCallback(callback); } }; -void QWaylandWindow::handleFrameCallback() +void QWaylandWindow::handleFrameCallback(wl_callback* callback) { QMutexLocker locker(&mFrameSyncMutex); + if (!mFrameCallback) { + // This means the callback is already unset by QWaylandWindow::reset. + // The wl_callback object will be destroyed there too. + return; + } + Q_ASSERT(callback == mFrameCallback); + wl_callback_destroy(callback); + mFrameCallback = nullptr; mWaitingForFrameCallback = false; mFrameCallbackElapsedTimer.invalidate(); @@ -1382,19 +1388,24 @@ void QWaylandWindow::timerEvent(QTimerEvent *event) if (event->timerId() != mFrameCallbackCheckIntervalTimerId) return; - bool callbackTimerExpired = mFrameCallbackElapsedTimer.hasExpired(mFrameCallbackTimeout); - if (!mFrameCallbackElapsedTimer.isValid() || callbackTimerExpired ) { - killTimer(mFrameCallbackCheckIntervalTimerId); - mFrameCallbackCheckIntervalTimerId = -1; - } - if (mFrameCallbackElapsedTimer.isValid() && callbackTimerExpired) { - mFrameCallbackElapsedTimer.invalidate(); + { + QMutexLocker lock(&mFrameSyncMutex); - qCDebug(lcWaylandBackingstore) << "Didn't receive frame callback in time, window should now be inexposed"; - mFrameCallbackTimedOut = true; - mWaitingForUpdate = false; - sendExposeEvent(QRect()); + bool callbackTimerExpired = mFrameCallbackElapsedTimer.hasExpired(mFrameCallbackTimeout); + if (!mFrameCallbackElapsedTimer.isValid() || callbackTimerExpired ) { + killTimer(mFrameCallbackCheckIntervalTimerId); + mFrameCallbackCheckIntervalTimerId = -1; + } + if (!mFrameCallbackElapsedTimer.isValid() || !callbackTimerExpired) { + return; + } + mFrameCallbackElapsedTimer.invalidate(); } + + qCDebug(lcWaylandBackingstore) << "Didn't receive frame callback in time, window should now be inexposed"; + mFrameCallbackTimedOut = true; + mWaitingForUpdate = false; + sendExposeEvent(QRect()); } void QWaylandWindow::requestUpdate() @@ -1437,15 +1448,14 @@ void QWaylandWindow::handleUpdate() { qCDebug(lcWaylandBackingstore) << "handleUpdate" << QThread::currentThread(); - if (mWaitingForFrameCallback) - return; - // TODO: Should sync subsurfaces avoid requesting frame callbacks? QReadLocker lock(&mSurfaceLock); if (!mSurface) return; QMutexLocker locker(&mFrameSyncMutex); + if (mWaitingForFrameCallback) + return; struct ::wl_surface *wrappedSurface = reinterpret_cast(wl_proxy_create_wrapper(mSurface->object())); wl_proxy_set_queue(reinterpret_cast(wrappedSurface), mDisplay->frameEventQueue()); diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index 2e68cc2e4c5..0f8c5515111 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -261,12 +261,13 @@ protected: #endif WId mWindowId; - bool mWaitingForFrameCallback = false; bool mFrameCallbackTimedOut = false; // Whether the frame callback has timed out - QAtomicInt mWaitingForUpdateDelivery = false; int mFrameCallbackCheckIntervalTimerId = -1; - QElapsedTimer mFrameCallbackElapsedTimer; - struct ::wl_callback *mFrameCallback = nullptr; + QAtomicInt mWaitingForUpdateDelivery = false; + + bool mWaitingForFrameCallback = false; // Protected by mFrameSyncMutex + QElapsedTimer mFrameCallbackElapsedTimer; // Protected by mFrameSyncMutex + struct ::wl_callback *mFrameCallback = nullptr; // Protected by mFrameSyncMutex QMutex mFrameSyncMutex; QWaitCondition mFrameSyncWait; @@ -323,7 +324,7 @@ private: QRect mLastExposeGeometry; static const wl_callback_listener callbackListener; - void handleFrameCallback(); + void handleFrameCallback(struct ::wl_callback* callback); static QWaylandWindow *mMouseGrab; From 389f01d835f1b4a16fa38381e100088eddaac1fa Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Fri, 25 Nov 2022 09:18:56 +0100 Subject: [PATCH 1132/1507] client: Allow resizing with touch input on client-side decorations The touch input for client-side decorations had its own handling which only processed button clicks and moves. This meant that it was impossible to resize windows using touch events. This generalizes the mouse input code path and uses it for touch as well. We need to take care not to update any mouse state in the case of touch, since we only care about touch press events, so we pass in a PointerType and disable parts of the code path when the input is from a touch device. [ChangeLog][QtWaylandClient] Enable resizing windows using client-side decorations with touch input as well as mouse input. Task-number: QTBUG-108690 Change-Id: I761ebb0c7c4844c52f793caa74e8606d1593757f Reviewed-by: David Edmundson --- .../plugins/decorations/bradient/main.cpp | 117 ++++++++++++------ 1 file changed, 80 insertions(+), 37 deletions(-) diff --git a/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp b/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp index 8669405bf1c..5da0e85f4cc 100644 --- a/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp +++ b/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp @@ -42,10 +42,15 @@ protected: bool handleMouse(QWaylandInputDevice *inputDevice, const QPointF &local, const QPointF &global,Qt::MouseButtons b,Qt::KeyboardModifiers mods) override; bool handleTouch(QWaylandInputDevice *inputDevice, const QPointF &local, const QPointF &global, QEventPoint::State state, Qt::KeyboardModifiers mods) override; private: - void processMouseTop(QWaylandInputDevice *inputDevice, const QPointF &local, Qt::MouseButtons b,Qt::KeyboardModifiers mods); - void processMouseBottom(QWaylandInputDevice *inputDevice, const QPointF &local, Qt::MouseButtons b,Qt::KeyboardModifiers mods); - void processMouseLeft(QWaylandInputDevice *inputDevice, const QPointF &local, Qt::MouseButtons b,Qt::KeyboardModifiers mods); - void processMouseRight(QWaylandInputDevice *inputDevice, const QPointF &local, Qt::MouseButtons b,Qt::KeyboardModifiers mods); + enum class PointerType { + Mouse, + Touch + }; + + void processPointerTop(QWaylandInputDevice *inputDevice, const QPointF &local, Qt::MouseButtons b,Qt::KeyboardModifiers mods, PointerType type); + void processPointerBottom(QWaylandInputDevice *inputDevice, const QPointF &local, Qt::MouseButtons b,Qt::KeyboardModifiers mods, PointerType type); + void processPointerLeft(QWaylandInputDevice *inputDevice, const QPointF &local, Qt::MouseButtons b,Qt::KeyboardModifiers mods, PointerType type); + void processPointerRight(QWaylandInputDevice *inputDevice, const QPointF &local, Qt::MouseButtons b,Qt::KeyboardModifiers mods, PointerType type); bool clickButton(Qt::MouseButtons b, Button btn); QRectF closeButtonRect() const; @@ -235,13 +240,13 @@ bool QWaylandBradientDecoration::handleMouse(QWaylandInputDevice *inputDevice, c // Figure out what area mouse is in QRect wg = waylandWindow()->windowContentGeometry(); if (local.y() <= wg.top() + margins().top()) { - processMouseTop(inputDevice,local,b,mods); + processPointerTop(inputDevice, local, b, mods, PointerType::Mouse); } else if (local.y() > wg.bottom() - margins().bottom()) { - processMouseBottom(inputDevice,local,b,mods); + processPointerBottom(inputDevice, local, b, mods, PointerType::Mouse); } else if (local.x() <= wg.left() + margins().left()) { - processMouseLeft(inputDevice,local,b,mods); + processPointerLeft(inputDevice, local, b, mods, PointerType::Mouse); } else if (local.x() > wg.right() - margins().right()) { - processMouseRight(inputDevice,local,b,mods); + processPointerRight(inputDevice, local, b, mods, PointerType::Mouse); } else { #if QT_CONFIG(cursor) waylandWindow()->restoreMouseCursor(inputDevice); @@ -256,113 +261,151 @@ bool QWaylandBradientDecoration::handleMouse(QWaylandInputDevice *inputDevice, c bool QWaylandBradientDecoration::handleTouch(QWaylandInputDevice *inputDevice, const QPointF &local, const QPointF &global, QEventPoint::State state, Qt::KeyboardModifiers mods) { - Q_UNUSED(inputDevice); Q_UNUSED(global); - Q_UNUSED(mods); + QRect wg = waylandWindow()->windowContentGeometry(); + bool handled = state == QEventPoint::Pressed; if (handled) { - if (closeButtonRect().contains(local)) - QWindowSystemInterface::handleCloseEvent(window()); - else if (maximizeButtonRect().contains(local)) - window()->setWindowStates(window()->windowStates() ^ Qt::WindowMaximized); - else if (minimizeButtonRect().contains(local)) - window()->setWindowState(Qt::WindowMinimized); - else if (local.y() <= margins().top()) - waylandWindow()->shellSurface()->move(inputDevice); - else + if (local.y() <= wg.top() + margins().top()) { + processPointerTop(inputDevice, local, Qt::LeftButton, mods, PointerType::Touch); + } else if (local.y() > wg.bottom() - margins().bottom()) { + processPointerBottom(inputDevice, local, Qt::LeftButton, mods, PointerType::Touch); + } else if (local.x() <= wg.left() + margins().left()) { + processPointerLeft(inputDevice, local, Qt::LeftButton, mods, PointerType::Touch); + } else if (local.x() > wg.right() - margins().right()) { + processPointerRight(inputDevice, local, Qt::LeftButton, mods, PointerType::Touch); + } else { handled = false; + } } return handled; } -void QWaylandBradientDecoration::processMouseTop(QWaylandInputDevice *inputDevice, const QPointF &local, Qt::MouseButtons b, Qt::KeyboardModifiers mods) +void QWaylandBradientDecoration::processPointerTop(QWaylandInputDevice *inputDevice, + const QPointF &local, + Qt::MouseButtons b, + Qt::KeyboardModifiers mods, + PointerType type) { +#if !QT_CONFIG(cursor) + Q_UNUSED(type); +#endif + QRect wg = waylandWindow()->windowContentGeometry(); Q_UNUSED(mods); if (local.y() <= wg.top() + margins().bottom()) { if (local.x() <= margins().left()) { //top left bit #if QT_CONFIG(cursor) - waylandWindow()->setMouseCursor(inputDevice, Qt::SizeFDiagCursor); + if (type == PointerType::Mouse) + waylandWindow()->setMouseCursor(inputDevice, Qt::SizeFDiagCursor); #endif startResize(inputDevice, Qt::TopEdge | Qt::LeftEdge, b); } else if (local.x() > wg.right() - margins().right()) { //top right bit #if QT_CONFIG(cursor) - waylandWindow()->setMouseCursor(inputDevice, Qt::SizeBDiagCursor); + if (type == PointerType::Mouse) + waylandWindow()->setMouseCursor(inputDevice, Qt::SizeBDiagCursor); #endif startResize(inputDevice, Qt::TopEdge | Qt::RightEdge, b); } else { //top resize bit #if QT_CONFIG(cursor) - waylandWindow()->setMouseCursor(inputDevice, Qt::SplitVCursor); + if (type == PointerType::Mouse) + waylandWindow()->setMouseCursor(inputDevice, Qt::SplitVCursor); #endif startResize(inputDevice, Qt::TopEdge, b); } } else if (local.x() <= wg.left() + margins().left()) { - processMouseLeft(inputDevice, local, b, mods); + processPointerLeft(inputDevice, local, b, mods, type); } else if (local.x() > wg.right() - margins().right()) { - processMouseRight(inputDevice, local, b, mods); + processPointerRight(inputDevice, local, b, mods, type); } else if (isRightClicked(b)) { showWindowMenu(inputDevice); } else if (closeButtonRect().contains(local)) { - if (clickButton(b, Close)) + if (type == PointerType::Touch || clickButton(b, Close)) QWindowSystemInterface::handleCloseEvent(window()); } else if (maximizeButtonRect().contains(local)) { - if (clickButton(b, Maximize)) + if (type == PointerType::Touch || clickButton(b, Maximize)) window()->setWindowStates(window()->windowStates() ^ Qt::WindowMaximized); } else if (minimizeButtonRect().contains(local)) { - if (clickButton(b, Minimize)) + if (type == PointerType::Touch || clickButton(b, Minimize)) window()->setWindowState(Qt::WindowMinimized); } else { #if QT_CONFIG(cursor) - waylandWindow()->restoreMouseCursor(inputDevice); + if (type == PointerType::Mouse) + waylandWindow()->restoreMouseCursor(inputDevice); #endif startMove(inputDevice,b); } } -void QWaylandBradientDecoration::processMouseBottom(QWaylandInputDevice *inputDevice, const QPointF &local, Qt::MouseButtons b, Qt::KeyboardModifiers mods) +void QWaylandBradientDecoration::processPointerBottom(QWaylandInputDevice *inputDevice, + const QPointF &local, + Qt::MouseButtons b, + Qt::KeyboardModifiers mods, + PointerType type) { Q_UNUSED(mods); +#if !QT_CONFIG(cursor) + Q_UNUSED(type); +#endif + if (local.x() <= margins().left()) { //bottom left bit #if QT_CONFIG(cursor) - waylandWindow()->setMouseCursor(inputDevice, Qt::SizeBDiagCursor); + if (type == PointerType::Mouse) + waylandWindow()->setMouseCursor(inputDevice, Qt::SizeBDiagCursor); #endif startResize(inputDevice, Qt::BottomEdge | Qt::LeftEdge, b); } else if (local.x() > window()->width() + margins().left()) { //bottom right bit #if QT_CONFIG(cursor) - waylandWindow()->setMouseCursor(inputDevice, Qt::SizeFDiagCursor); + if (type == PointerType::Mouse) + waylandWindow()->setMouseCursor(inputDevice, Qt::SizeFDiagCursor); #endif startResize(inputDevice, Qt::BottomEdge | Qt::RightEdge, b); } else { //bottom bit #if QT_CONFIG(cursor) - waylandWindow()->setMouseCursor(inputDevice, Qt::SplitVCursor); + if (type == PointerType::Mouse) + waylandWindow()->setMouseCursor(inputDevice, Qt::SplitVCursor); #endif startResize(inputDevice, Qt::BottomEdge, b); } } -void QWaylandBradientDecoration::processMouseLeft(QWaylandInputDevice *inputDevice, const QPointF &local, Qt::MouseButtons b, Qt::KeyboardModifiers mods) +void QWaylandBradientDecoration::processPointerLeft(QWaylandInputDevice *inputDevice, + const QPointF &local, + Qt::MouseButtons b, + Qt::KeyboardModifiers mods, + PointerType type) { Q_UNUSED(local); Q_UNUSED(mods); #if QT_CONFIG(cursor) - waylandWindow()->setMouseCursor(inputDevice, Qt::SplitHCursor); + if (type == PointerType::Mouse) + waylandWindow()->setMouseCursor(inputDevice, Qt::SplitHCursor); +#else + Q_UNUSED(type); #endif startResize(inputDevice, Qt::LeftEdge, b); } -void QWaylandBradientDecoration::processMouseRight(QWaylandInputDevice *inputDevice, const QPointF &local, Qt::MouseButtons b, Qt::KeyboardModifiers mods) +void QWaylandBradientDecoration::processPointerRight(QWaylandInputDevice *inputDevice, + const QPointF &local, + Qt::MouseButtons b, + Qt::KeyboardModifiers mods, + PointerType type) { Q_UNUSED(local); Q_UNUSED(mods); #if QT_CONFIG(cursor) - waylandWindow()->setMouseCursor(inputDevice, Qt::SplitHCursor); + if (type == PointerType::Mouse) + waylandWindow()->setMouseCursor(inputDevice, Qt::SplitHCursor); +#else + Q_UNUSED(type); #endif startResize(inputDevice, Qt::RightEdge, b); } From f45244946c50024a9e7883c11b26e6a49b7a0454 Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Fri, 21 Oct 2022 12:35:15 +0300 Subject: [PATCH 1133/1507] Client: Improve handling of 0xH and Wx0 xdg_toplevel configure events The compositor can send a configure event with 0xH and Wx0 when it wants the window to have some concrete size along one dimension but wants the client to pick the size along the other dimension. Change-Id: I2e72017d4a71b19a930da24fa5c58b6ce672fb94 Reviewed-by: David Edmundson --- .../xdg-shell/qwaylandxdgshell.cpp | 39 ++++++++++++++----- tests/auto/wayland/shared/xdgshell.cpp | 5 +++ tests/auto/wayland/shared/xdgshell.h | 3 +- tests/auto/wayland/xdgshell/tst_xdgshell.cpp | 25 ++++++++++++ 4 files changed, 61 insertions(+), 11 deletions(-) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp index c0d7a7d46ba..9bd5209f042 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp @@ -58,19 +58,38 @@ void QWaylandXdgSurface::Toplevel::applyConfigure() m_xdgSurface->m_window->handleToplevelWindowTilingStatesChanged(m_toplevelStates); m_xdgSurface->m_window->handleWindowStatesChanged(m_pending.states); - if (m_pending.size.isEmpty()) { - // An empty size in the configure means it's up to the client to choose the size - bool normalPending = !(m_pending.states & (Qt::WindowMaximized|Qt::WindowFullScreen)); - if (normalPending && !m_normalSize.isEmpty()) { - QSize size = m_normalSize; - if (!m_pending.bounds.isEmpty()) - size = size.boundedTo(m_pending.bounds); - m_xdgSurface->m_window->resizeFromApplyConfigure(size); - } + // If the width or height is zero, the client should decide the size on its own. + QSize surfaceSize; + + if (m_pending.size.width() > 0) { + surfaceSize.setWidth(m_pending.size.width()); } else { - m_xdgSurface->m_window->resizeFromApplyConfigure(m_pending.size); + if (Q_UNLIKELY(m_pending.states & (Qt::WindowMaximized | Qt::WindowFullScreen))) { + qCWarning(lcQpaWayland) << "Configure event with maximized or fullscreen state contains invalid width:" << m_pending.size.width(); + } else { + int width = m_normalSize.width(); + if (!m_pending.bounds.isEmpty()) + width = std::min(width, m_pending.bounds.width()); + surfaceSize.setWidth(width); + } } + if (m_pending.size.height() > 0) { + surfaceSize.setHeight(m_pending.size.height()); + } else { + if (Q_UNLIKELY(m_pending.states & (Qt::WindowMaximized | Qt::WindowFullScreen))) { + qCWarning(lcQpaWayland) << "Configure event with maximized or fullscreen state contains invalid height:" << m_pending.size.height(); + } else { + int height = m_normalSize.height(); + if (!m_pending.bounds.isEmpty()) + height = std::min(height, m_pending.bounds.height()); + surfaceSize.setHeight(height); + } + } + + if (!surfaceSize.isEmpty()) + m_xdgSurface->m_window->resizeFromApplyConfigure(surfaceSize); + m_applied = m_pending; qCDebug(lcQpaWayland) << "Applied pending xdg_toplevel configure event:" << m_applied.size << m_applied.states; } diff --git a/tests/auto/wayland/shared/xdgshell.cpp b/tests/auto/wayland/shared/xdgshell.cpp index eb9a1e87afd..4e4de4d11f1 100644 --- a/tests/auto/wayland/shared/xdgshell.cpp +++ b/tests/auto/wayland/shared/xdgshell.cpp @@ -143,6 +143,11 @@ XdgToplevel::XdgToplevel(XdgSurface *xdgSurface, int id, int version) connect(surface(), &Surface::commit, this, [this] { m_committed = m_pending; }); } +void XdgToplevel::sendConfigureBounds(const QSize &size) +{ + send_configure_bounds(size.width(), size.height()); +} + void XdgToplevel::sendConfigure(const QSize &size, const QList &states) { send_configure(size.width(), size.height(), toByteArray(states)); diff --git a/tests/auto/wayland/shared/xdgshell.h b/tests/auto/wayland/shared/xdgshell.h index 4c1cd6cdb13..a68ace0ee62 100644 --- a/tests/auto/wayland/shared/xdgshell.h +++ b/tests/auto/wayland/shared/xdgshell.h @@ -18,7 +18,7 @@ class XdgWmBase : public Global, public QtWaylandServer::xdg_wm_base { Q_OBJECT public: - explicit XdgWmBase(CoreCompositor *compositor, int version = 1); + explicit XdgWmBase(CoreCompositor *compositor, int version = 4); using QtWaylandServer::xdg_wm_base::send_ping; void send_ping(uint32_t) = delete; // It's a global, use resource specific instead bool isClean() override { return m_xdgSurfaces.empty(); } @@ -90,6 +90,7 @@ class XdgToplevel : public QObject, public QtWaylandServer::xdg_toplevel Q_OBJECT public: explicit XdgToplevel(XdgSurface *xdgSurface, int id, int version = 1); + void sendConfigureBounds(const QSize &size); void sendConfigure(const QSize &size = {0, 0}, const QList &states = {}); uint sendCompleteConfigure(const QSize &size = {0, 0}, const QList &states = {}); Surface *surface() { return m_xdgSurface->m_surface; } diff --git a/tests/auto/wayland/xdgshell/tst_xdgshell.cpp b/tests/auto/wayland/xdgshell/tst_xdgshell.cpp index e560784e954..efaa6a8f160 100644 --- a/tests/auto/wayland/xdgshell/tst_xdgshell.cpp +++ b/tests/auto/wayland/xdgshell/tst_xdgshell.cpp @@ -19,6 +19,7 @@ private slots: void basicConfigure(); void configureSize(); void configureStates(); + void configureBounds(); void popup(); void tooltipOnPopup(); void tooltipAndSiblingPopup(); @@ -170,6 +171,30 @@ void tst_xdgshell::configureStates() QVERIFY(qunsetenv("QT_WAYLAND_FRAME_CALLBACK_TIMEOUT")); } +void tst_xdgshell::configureBounds() +{ + QRasterWindow window; + window.resize(1280, 1024); + window.show(); + QCOMPOSITOR_TRY_VERIFY(xdgToplevel()); + + // Take xdg_toplevel.configure_bounds into account only if the configure event has 0x0 size. + const uint serial1 = exec([=] { + xdgToplevel()->sendConfigureBounds(QSize(800, 600)); + return xdgToplevel()->sendCompleteConfigure(QSize(0, 0), { XdgToplevel::state_activated }); + }); + QCOMPOSITOR_TRY_COMPARE(xdgSurface()->m_committedConfigureSerial, serial1); + QCOMPARE(window.frameGeometry().size(), QSize(800, 600)); + + // Window size in xdg_toplevel configure events takes precedence over the configure bounds. + const uint serial2 = exec([=] { + xdgToplevel()->sendConfigureBounds(QSize(800, 600)); + return xdgToplevel()->sendCompleteConfigure(QSize(1600, 900), { XdgToplevel::state_activated }); + }); + QCOMPOSITOR_TRY_COMPARE(xdgSurface()->m_committedConfigureSerial, serial2); + QCOMPARE(window.frameGeometry().size(), QSize(1600, 900)); +} + void tst_xdgshell::popup() { class Window : public QRasterWindow { From d62c5761e8bf1b5744345de81c51a801d3a2cfc9 Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Wed, 23 Mar 2022 15:35:50 +0000 Subject: [PATCH 1134/1507] Implement fractional_scale_v1 and wp_viewport This allows compositors to hint a non-integer scale to use on a window which we can hook to Qt's existing fractional scaling support. The viewport is used to communicate the relationship between buffer size and logical size to the compositor. It is a non-integer alternative to wl_buffer_scale Change-Id: I1a850f1bcd40e8d04e241e18a538b11f18bc671c Reviewed-by: Qt CI Bot Reviewed-by: David Edmundson --- .../wayland/protocols/fractional-scale-v1.xml | 102 +++++++++++++ .../wayland/protocols/qt_attribution.json | 17 +++ src/plugins/platforms/wayland/CMakeLists.txt | 4 + .../platforms/wayland/qwaylanddisplay.cpp | 17 +++ .../platforms/wayland/qwaylanddisplay_p.h | 8 ++ .../wayland/qwaylandfractionalscale.cpp | 36 +++++ .../wayland/qwaylandfractionalscale_p.h | 50 +++++++ .../platforms/wayland/qwaylandviewport.cpp | 35 +++++ .../platforms/wayland/qwaylandviewport_p.h | 42 ++++++ .../platforms/wayland/qwaylandwindow.cpp | 61 +++++++- .../platforms/wayland/qwaylandwindow_p.h | 7 +- tests/auto/wayland/CMakeLists.txt | 2 + tests/auto/wayland/scaling/CMakeLists.txt | 10 ++ tests/auto/wayland/scaling/tst_scaling.cpp | 135 ++++++++++++++++++ tests/auto/wayland/shared/CMakeLists.txt | 6 + .../auto/wayland/shared/fractionalscalev1.cpp | 40 ++++++ tests/auto/wayland/shared/fractionalscalev1.h | 39 +++++ tests/auto/wayland/shared/mockcompositor.cpp | 3 + tests/auto/wayland/shared/mockcompositor.h | 4 + tests/auto/wayland/shared/viewport.cpp | 58 ++++++++ tests/auto/wayland/shared/viewport.h | 50 +++++++ 21 files changed, 719 insertions(+), 7 deletions(-) create mode 100644 src/3rdparty/wayland/protocols/fractional-scale-v1.xml create mode 100644 src/plugins/platforms/wayland/qwaylandfractionalscale.cpp create mode 100644 src/plugins/platforms/wayland/qwaylandfractionalscale_p.h create mode 100644 src/plugins/platforms/wayland/qwaylandviewport.cpp create mode 100644 src/plugins/platforms/wayland/qwaylandviewport_p.h create mode 100644 tests/auto/wayland/scaling/CMakeLists.txt create mode 100644 tests/auto/wayland/scaling/tst_scaling.cpp create mode 100644 tests/auto/wayland/shared/fractionalscalev1.cpp create mode 100644 tests/auto/wayland/shared/fractionalscalev1.h create mode 100644 tests/auto/wayland/shared/viewport.cpp create mode 100644 tests/auto/wayland/shared/viewport.h diff --git a/src/3rdparty/wayland/protocols/fractional-scale-v1.xml b/src/3rdparty/wayland/protocols/fractional-scale-v1.xml new file mode 100644 index 00000000000..350bfc01eaf --- /dev/null +++ b/src/3rdparty/wayland/protocols/fractional-scale-v1.xml @@ -0,0 +1,102 @@ + + + + Copyright © 2022 Kenny Levinsen + + 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. + + + + This protocol allows a compositor to suggest for surfaces to render at + fractional scales. + + A client can submit scaled content by utilizing wp_viewport. This is done by + creating a wp_viewport object for the surface and setting the destination + rectangle to the surface size before the scale factor is applied. + + The buffer size is calculated by multiplying the surface size by the + intended scale. + + The wl_surface buffer scale should remain set to 1. + + If a surface has a surface-local size of 100 px by 50 px and wishes to + submit buffers with a scale of 1.5, then a buffer of 150px by 75 px should + be used and the wp_viewport destination rectangle should be 100 px by 50 px. + + For toplevel surfaces, the size is rounded halfway away from zero. The + rounding algorithm for subsurface position and size is not defined. + + + + + A global interface for requesting surfaces to use fractional scales. + + + + + Informs the server that the client will not be using this protocol + object anymore. This does not affect any other objects, + wp_fractional_scale_v1 objects included. + + + + + + + + + + Create an add-on object for the the wl_surface to let the compositor + request fractional scales. If the given wl_surface already has a + wp_fractional_scale_v1 object associated, the fractional_scale_exists + protocol error is raised. + + + + + + + + + An additional interface to a wl_surface object which allows the compositor + to inform the client of the preferred scale. + + + + + Destroy the fractional scale object. When this object is destroyed, + preferred_scale events will no longer be sent. + + + + + + Notification of a new preferred scale for this surface that the + compositor suggests that the client should use. + + The sent scale is the numerator of a fraction with a denominator of 120. + + + + + diff --git a/src/3rdparty/wayland/protocols/qt_attribution.json b/src/3rdparty/wayland/protocols/qt_attribution.json index 7b81d551592..e30cb1b69c9 100644 --- a/src/3rdparty/wayland/protocols/qt_attribution.json +++ b/src/3rdparty/wayland/protocols/qt_attribution.json @@ -318,5 +318,22 @@ "License": "MIT License", "LicenseFile": "MIT_LICENSE.txt", "Copyright": "Copyright © 2015-2016 Red Hat Inc." + }, + + { + "Id": "fractional-scale-v1", + "Name": "Wayland Fractional Scale Protocol", + "QDocModule": "qtwaylandcompositor", + "QtUsage": "Used in the Qt Wayland platform plugin", + "Files": "fractional-scale-v1.xml", + + "Description": "Send a preferred scale to different clients", + "Homepage": "https://wayland.freedesktop.org", + "Version": "1", + "DownloadLocation": "https://gitlab.freedesktop.org/wayland/wayland-protocols/-/raw/1.31/unstable/fractional-scale/fractional-scale-v1.xml", + "LicenseId": "MIT", + "License": "MIT License", + "LicenseFile": "MIT_LICENSE.txt", + "Copyright": "Copyright © 2022 Kenny Levinsen" } ] diff --git a/src/plugins/platforms/wayland/CMakeLists.txt b/src/plugins/platforms/wayland/CMakeLists.txt index 820c9eadad9..47312010fed 100644 --- a/src/plugins/platforms/wayland/CMakeLists.txt +++ b/src/plugins/platforms/wayland/CMakeLists.txt @@ -32,6 +32,7 @@ qt_internal_add_module(WaylandClient qwaylanddecorationplugin.cpp qwaylanddecorationplugin_p.h qwaylanddisplay.cpp qwaylanddisplay_p.h qwaylandextendedsurface.cpp qwaylandextendedsurface_p.h + qwaylandfractionalscale.cpp qwaylandfractionalscale_p.h qwaylandinputcontext.cpp qwaylandinputcontext_p.h qwaylandtextinputv1.cpp qwaylandtextinputv1_p.h qwaylandtextinputv2.cpp qwaylandtextinputv2_p.h @@ -50,6 +51,7 @@ qt_internal_add_module(WaylandClient qwaylandsubsurface.cpp qwaylandsubsurface_p.h qwaylandsurface.cpp qwaylandsurface_p.h qwaylandtouch.cpp qwaylandtouch_p.h + qwaylandviewport.cpp qwaylandviewport_p.h qwaylandwindow.cpp qwaylandwindow_p.h qwaylandwindowmanagerintegration.cpp qwaylandwindowmanagerintegration_p.h shellintegration/qwaylandclientshellapi_p.h @@ -88,6 +90,8 @@ qt6_generate_wayland_protocol_client_sources(WaylandClient ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/wayland.xml ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/wp-primary-selection-unstable-v1.xml ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/xdg-output-unstable-v1.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/fractional-scale-v1.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/viewporter.xml ${CMAKE_CURRENT_SOURCE_DIR}/../extensions/qt-key-unstable-v1.xml ${CMAKE_CURRENT_SOURCE_DIR}/../extensions/qt-text-input-method-unstable-v1.xml ${CMAKE_CURRENT_SOURCE_DIR}/../extensions/qt-windowmanager.xml diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index 18eb71c36b5..52ea64929de 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -50,6 +50,8 @@ #include #include #include +#include +#include #include @@ -294,6 +296,17 @@ struct ::wl_region *QWaylandDisplay::createRegion(const QRegion &qregion) return mSubCompositor->get_subsurface(window->wlSurface(), parent->wlSurface()); } +::wp_viewport *QWaylandDisplay::createViewport(QWaylandWindow *window) +{ + if (!mViewporter) { + qCWarning(lcQpaWayland) << "Can't create wp_viewport, not supported by the compositor."; + return nullptr; + } + + Q_ASSERT(window->wlSurface()); + return mViewporter->get_viewport(window->wlSurface()); +} + QWaylandShellIntegration *QWaylandDisplay::shellIntegration() const { return mWaylandIntegration->shellIntegration(); @@ -597,6 +610,10 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin mXdgOutputManager.reset(new QWaylandXdgOutputManagerV1(this, id, version)); for (auto *screen : std::as_const(mWaitingScreens)) screen->initXdgOutput(xdgOutputManager()); + } else if (interface == QLatin1String(QtWayland::wp_fractional_scale_manager_v1::interface()->name)) { + mFractionalScaleManager.reset(new QtWayland::wp_fractional_scale_manager_v1(registry, id, 1)); + } else if (interface == QLatin1String("wp_viewporter")) { + mViewporter.reset(new QtWayland::wp_viewporter(registry, id, qMin(1u, version))); } mGlobals.append(RegistryGlobal(id, interface, version, registry)); diff --git a/src/plugins/platforms/wayland/qwaylanddisplay_p.h b/src/plugins/platforms/wayland/qwaylanddisplay_p.h index 473016f1e60..640f33b8e57 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay_p.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay_p.h @@ -36,6 +36,7 @@ #endif struct wl_cursor_image; +struct wp_viewport; QT_BEGIN_NAMESPACE @@ -50,6 +51,8 @@ namespace QtWayland { class zwp_text_input_manager_v2; class zwp_text_input_manager_v4; class qt_text_input_method_manager_v1; + class wp_viewporter; + class wp_fractional_scale_manager_v1; } namespace QtWaylandClient { @@ -110,6 +113,7 @@ public: struct wl_surface *createSurface(void *handle); struct ::wl_region *createRegion(const QRegion &qregion); struct ::wl_subsurface *createSubSurface(QWaylandWindow *window, QWaylandWindow *parent); + struct ::wp_viewport *createViewport(QWaylandWindow *window); QWaylandShellIntegration *shellIntegration() const; QWaylandClientBufferIntegration *clientBufferIntegration() const; @@ -146,6 +150,8 @@ public: QtWayland::zwp_text_input_manager_v4 *textInputManagerv4() const { return mTextInputManagerv4.data(); } QWaylandHardwareIntegration *hardwareIntegration() const { return mHardwareIntegration.data(); } QWaylandXdgOutputManagerV1 *xdgOutputManager() const { return mXdgOutputManager.data(); } + QtWayland::wp_fractional_scale_manager_v1 *fractionalScaleManager() const { return mFractionalScaleManager.data(); } + QtWayland::wp_viewporter *viewporter() const { return mViewporter.data(); } struct RegistryGlobal { uint32_t id; @@ -265,6 +271,8 @@ private: QScopedPointer mTextInputManagerv4; QScopedPointer mHardwareIntegration; QScopedPointer mXdgOutputManager; + QScopedPointer mViewporter; + QScopedPointer mFractionalScaleManager; int mFd = -1; int mWritableNotificationFd = -1; QList mGlobals; diff --git a/src/plugins/platforms/wayland/qwaylandfractionalscale.cpp b/src/plugins/platforms/wayland/qwaylandfractionalscale.cpp new file mode 100644 index 00000000000..324a0b7299e --- /dev/null +++ b/src/plugins/platforms/wayland/qwaylandfractionalscale.cpp @@ -0,0 +1,36 @@ +// Copyright (C) 2022 David Edmundson +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#include "qwaylandfractionalscale_p.h" + +QT_BEGIN_NAMESPACE + +namespace QtWaylandClient { + +QWaylandFractionalScale::QWaylandFractionalScale(struct ::wp_fractional_scale_v1 *object) + : QtWayland::wp_fractional_scale_v1(object) +{} + + +QWaylandFractionalScale::~QWaylandFractionalScale() +{ + destroy(); +} + +qreal QWaylandFractionalScale::preferredScale() const +{ + return mPreferredScale; +} + +void QWaylandFractionalScale::wp_fractional_scale_v1_preferred_scale(uint scale) +{ + qreal preferredScale = scale / 120.0; // hardcoded denominator determined in the spec + if (preferredScale != mPreferredScale) { + mPreferredScale = preferredScale; + Q_EMIT preferredScaleChanged(); + } +} + +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandfractionalscale_p.h b/src/plugins/platforms/wayland/qwaylandfractionalscale_p.h new file mode 100644 index 00000000000..0483eb338a4 --- /dev/null +++ b/src/plugins/platforms/wayland/qwaylandfractionalscale_p.h @@ -0,0 +1,50 @@ +// Copyright (C) 2022 David Edmundson +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QWAYLANDFRACTIONALSCALE_P_H +#define QWAYLANDFRACTIONALSCALE_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include +#include + +#include + +QT_BEGIN_NAMESPACE + +namespace QtWaylandClient { + +class QWaylandFractionalScale : public QObject, public QtWayland::wp_fractional_scale_v1 +{ + Q_OBJECT +public: + explicit QWaylandFractionalScale(struct ::wp_fractional_scale_v1 *object); + ~QWaylandFractionalScale(); + + qreal preferredScale() const; + +Q_SIGNALS: + void preferredScaleChanged(); + +protected: + void wp_fractional_scale_v1_preferred_scale(uint scale) override; + +private: + qreal mPreferredScale = 1.0; +}; + +} + +QT_END_NAMESPACE + +#endif diff --git a/src/plugins/platforms/wayland/qwaylandviewport.cpp b/src/plugins/platforms/wayland/qwaylandviewport.cpp new file mode 100644 index 00000000000..3252718c054 --- /dev/null +++ b/src/plugins/platforms/wayland/qwaylandviewport.cpp @@ -0,0 +1,35 @@ +// Copyright (C) 2022 David Edmundson +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#include "qwaylandviewport_p.h" + +QT_BEGIN_NAMESPACE + +namespace QtWaylandClient { + +QWaylandViewport::QWaylandViewport(::wp_viewport *viewport) + : QtWayland::wp_viewport(viewport) +{ +} + +QWaylandViewport::~QWaylandViewport() +{ + destroy(); +} + +void QWaylandViewport::setSource(const QRectF &source) +{ + set_source(wl_fixed_from_double(source.x()), + wl_fixed_from_double(source.y()), + wl_fixed_from_double(source.width()), + wl_fixed_from_double(source.height())); +} + +void QWaylandViewport::setDestination(const QSize &destination) +{ + set_destination(destination.width(), destination.height()); +} + +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandviewport_p.h b/src/plugins/platforms/wayland/qwaylandviewport_p.h new file mode 100644 index 00000000000..e1dfeb3a73e --- /dev/null +++ b/src/plugins/platforms/wayland/qwaylandviewport_p.h @@ -0,0 +1,42 @@ +// Copyright (C) 2022 David Edmundson +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QWAYLANDVIEWPORT_P_H +#define QWAYLANDVIEWPORT_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include +#include + +#include + +QT_BEGIN_NAMESPACE + +namespace QtWaylandClient { + +class QWaylandViewport : public QtWayland::wp_viewport +{ +public: + explicit QWaylandViewport(::wp_viewport *viewport); + ~QWaylandViewport() override; + + void setSource(const QRectF &source); + void setDestination(const QSize &destination); + +}; + +} + +QT_END_NAMESPACE + +#endif // QWAYLANDVIEWPORT_P_H diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index f4d49c84d6c..56b9af282e9 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -7,6 +7,7 @@ #include "qwaylanddisplay_p.h" #include "qwaylandsurface_p.h" #include "qwaylandinputdevice_p.h" +#include "qwaylandfractionalscale_p.h" #include "qwaylandscreen_p.h" #include "qwaylandshellsurface_p.h" #include "qwaylandsubsurface_p.h" @@ -16,6 +17,7 @@ #include "qwaylanddecorationfactory_p.h" #include "qwaylandshmbackingstore_p.h" #include "qwaylandshellintegration_p.h" +#include "qwaylandviewport_p.h" #include #include @@ -29,6 +31,8 @@ #include #include +#include + QT_BEGIN_NAMESPACE namespace QtWaylandClient { @@ -91,6 +95,26 @@ void QWaylandWindow::initWindow() initializeWlSurface(); } + if (mDisplay->fractionalScaleManager() && qApp->highDpiScaleFactorRoundingPolicy() == Qt::HighDpiScaleFactorRoundingPolicy::PassThrough) { + mFractionalScale.reset(new QWaylandFractionalScale(mDisplay->fractionalScaleManager()->get_fractional_scale(mSurface->object()))); + + mScale = mFractionalScale->preferredScale(); + connect(mFractionalScale.data(), &QWaylandFractionalScale::preferredScaleChanged, this, [this]() { + if (mScale == mFractionalScale->preferredScale()) { + return; + } + mScale = mFractionalScale->preferredScale(); + ensureSize(); + if (mViewport) + updateViewport(); + if (isExposed()) { + // redraw at the new DPR + window()->requestUpdate(); + sendExposeEvent(QRect(QPoint(), geometry().size())); + } + }); + } + if (shouldCreateSubSurface()) { Q_ASSERT(!mSubSurfaceWindow); @@ -146,11 +170,17 @@ void QWaylandWindow::initWindow() } } + if (display()->viewporter() && !window()->flags().testFlag(Qt::BypassWindowManagerHint)) { + mViewport.reset(new QWaylandViewport(display()->createViewport(this))); + } + // Enable high-dpi rendering. Scale() returns the screen scale factor and will // typically be integer 1 (normal-dpi) or 2 (high-dpi). Call set_buffer_scale() // to inform the compositor that high-resolution buffers will be provided. - if (mSurface->version() >= 3) - mSurface->set_buffer_scale(mScale); + if (mViewport) + updateViewport(); + else if (mSurface->version() >= 3) + mSurface->set_buffer_scale(std::ceil(scale())); setWindowFlags(window()->flags()); QRect geometry = windowGeometry(); @@ -220,6 +250,8 @@ void QWaylandWindow::reset() mShellSurface = nullptr; delete mSubSurfaceWindow; mSubSurfaceWindow = nullptr; + mViewport.reset(); + mFractionalScale.reset(); if (mSurface) { emit wlSurfaceDestroyed(); @@ -322,6 +354,8 @@ void QWaylandWindow::setGeometry_helper(const QRect &rect) QPlatformWindow::setGeometry(QRect(rect.x(), rect.y(), qBound(minimum.width(), rect.width(), maximum.width()), qBound(minimum.height(), rect.height(), maximum.height()))); + if (mViewport) + updateViewport(); if (mSubSurfaceWindow) { QMargins m = static_cast(QPlatformWindow::parent())->clientSideMargins(); @@ -370,6 +404,12 @@ void QWaylandWindow::setGeometry(const QRect &r) setOpaqueArea(QRect(QPoint(0, 0), rect.size())); } +void QWaylandWindow::updateViewport() +{ + if (!surfaceSize().isEmpty()) + mViewport->setDestination(surfaceSize()); +} + void QWaylandWindow::setGeometryFromApplyConfigure(const QPoint &globalPosition, const QSize &sizeWithMargins) { QMargins margins = clientSideMargins(); @@ -1242,6 +1282,7 @@ void QWaylandWindow::handleScreensChanged() return; QWindowSystemInterface::handleWindowScreenChanged(window(), newScreen->QPlatformScreen::screen()); + mLastReportedScreen = newScreen; if (fixedToplevelPositions && !QPlatformWindow::parent() && window()->type() != Qt::Popup && window()->type() != Qt::ToolTip @@ -1251,11 +1292,19 @@ void QWaylandWindow::handleScreensChanged() setGeometry(geometry); } - int scale = newScreen->isPlaceholder() ? 1 : static_cast(newScreen)->scale(); + if (mFractionalScale) + return; + + int scale = mLastReportedScreen->isPlaceholder() ? 1 : static_cast(mLastReportedScreen)->scale(); + if (scale != mScale) { mScale = scale; - if (mSurface && mSurface->version() >= 3) - mSurface->set_buffer_scale(mScale); + if (mSurface) { + if (mViewport) + updateViewport(); + else if (mSurface->version() >= 3) + mSurface->set_buffer_scale(std::ceil(mScale)); + } ensureSize(); } } @@ -1558,4 +1607,4 @@ void QWaylandWindow::closeChildPopups() { QT_END_NAMESPACE -#include "moc_qwaylandwindow_p.cpp" +#include "qwaylandwindow.moc" diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index 0f8c5515111..6531606a743 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -53,6 +53,8 @@ class QWaylandPointerEvent; class QWaylandPointerGestureSwipeEvent; class QWaylandPointerGesturePinchEvent; class QWaylandSurface; +class QWaylandFractionalScale; +class QWaylandViewport; class Q_WAYLANDCLIENT_EXPORT QWaylandWindow : public QObject, public QPlatformWindow { @@ -233,6 +235,8 @@ protected: // mSurface can be written by the main thread. Other threads should claim a read lock for access mutable QReadWriteLock mSurfaceLock; QScopedPointer mSurface; + QScopedPointer mFractionalScale; + QScopedPointer mViewport; QWaylandShellSurface *mShellSurface = nullptr; QWaylandSubSurface *mSubSurfaceWindow = nullptr; @@ -284,7 +288,7 @@ protected: bool mSentInitialResize = false; QPoint mOffset; - int mScale = 1; + qreal mScale = 1; QPlatformScreen *mLastReportedScreen = nullptr; QIcon mWindowIcon; @@ -314,6 +318,7 @@ private: QPlatformScreen *calculateScreenFromSurfaceEvents() const; void setOpaqueArea(const QRegion &opaqueArea); bool isOpaque() const; + void updateViewport(); void handleMouseEventWithDecoration(QWaylandInputDevice *inputDevice, const QWaylandPointerEvent &e); void handleScreensChanged(); diff --git a/tests/auto/wayland/CMakeLists.txt b/tests/auto/wayland/CMakeLists.txt index 749e6b83bee..44cf32714cb 100644 --- a/tests/auto/wayland/CMakeLists.txt +++ b/tests/auto/wayland/CMakeLists.txt @@ -25,8 +25,10 @@ if (NOT WEBOS) add_subdirectory(xdgdecorationv1) add_subdirectory(xdgoutput) add_subdirectory(xdgshell) + add_subdirectory(scaling) endif() add_subdirectory(multithreaded) + if(QT_FEATURE_im) add_subdirectory(inputcontext) endif() diff --git a/tests/auto/wayland/scaling/CMakeLists.txt b/tests/auto/wayland/scaling/CMakeLists.txt new file mode 100644 index 00000000000..a93f0c57464 --- /dev/null +++ b/tests/auto/wayland/scaling/CMakeLists.txt @@ -0,0 +1,10 @@ +##################################################################### +## tst_scaling Test: +##################################################################### + +qt_internal_add_test(tst_scaling + SOURCES + tst_scaling.cpp + PUBLIC_LIBRARIES + SharedClientTest +) diff --git a/tests/auto/wayland/scaling/tst_scaling.cpp b/tests/auto/wayland/scaling/tst_scaling.cpp new file mode 100644 index 00000000000..bceea92d49b --- /dev/null +++ b/tests/auto/wayland/scaling/tst_scaling.cpp @@ -0,0 +1,135 @@ +// Copyright (C) 2022 David Edmundson +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#include "mockcompositor.h" +#include +#include +#include +#include +#include + +using namespace MockCompositor; + +class tst_scaling : public QObject, private DefaultCompositor +{ + Q_OBJECT +private slots: + void init(); + void cleanup() { QTRY_VERIFY2(isClean(), qPrintable(dirtyMessage())); } + void scaledWindow(); + void roundingPolicy_data(); + void roundingPolicy(); + +}; + +void tst_scaling::init() +{ + setenv("QT_WAYLAND_DISABLE_WINDOWDECORATION", "1", 1); +} + +void tst_scaling::scaledWindow() +{ + QRasterWindow window; + window.resize(100, 100); + window.show(); + QCOMPOSITOR_TRY_VERIFY(xdgToplevel()); + + QSignalSpy configureSpy(exec([=] { return xdgSurface(); }), &XdgSurface::configureCommitted); + QSignalSpy surfaceCommitSpy(exec([=] { return surface(); }), &Surface::commit); + + const QSize configureSize(100, 100); + + exec([=] { + QVERIFY(fractionalScale()); + fractionalScale()->send_preferred_scale(1.5 * 120); + xdgToplevel()->sendCompleteConfigure(configureSize); + }); + + QTRY_COMPARE(configureSpy.count(), 1); + QCOMPARE(window.devicePixelRatio(), 1.5); + + exec([=] { + Buffer *buffer = xdgToplevel()->surface()->m_committed.buffer; + QVERIFY(buffer); + QCOMPARE(buffer->size(), QSize(150, 150)); + Viewport *vp = viewport(); + QVERIFY(vp); + QCOMPARE(vp->m_destination, QSize(100, 100)); + }); + + // resize the window + window.resize(200,200); + QCOMPARE(window.size(), QSize(200,200)); + + QVERIFY(surfaceCommitSpy.wait()); + exec([=] { + Buffer *buffer = xdgToplevel()->surface()->m_committed.buffer; + QVERIFY(buffer); + QCOMPARE(buffer->size(), QSize(300, 300)); + Viewport *vp = viewport(); + QVERIFY(vp); + QCOMPARE(vp->m_destination, QSize(200, 200)); + }); + + // dynamic scale change + exec([=] { + QVERIFY(fractionalScale()); + fractionalScale()->send_preferred_scale(2.5 * 120); + }); + QTRY_COMPARE(window.devicePixelRatio(), 2.5); + QCOMPARE(window.size(), QSize(200,200)); + + QVERIFY(surfaceCommitSpy.wait()); + exec([=] { + Buffer *buffer = xdgToplevel()->surface()->m_committed.buffer; + QVERIFY(buffer); + QCOMPARE(buffer->size(), QSize(500, 500)); + Viewport *vp = viewport(); + QVERIFY(vp); + QCOMPARE(vp->m_destination, QSize(200, 200)); + }); +} + +void tst_scaling::roundingPolicy_data() +{ + QTest::addColumn("windowSize"); + QTest::addColumn("scale"); + QTest::addColumn("expectedBufferSize"); + + QTest::newRow("1.125 - round down") << QSize(10, 10) << 1.125 << QSize(11,11); + QTest::newRow("1.25 - round up") << QSize(10, 10) << 1.25 << QSize(13,13); + QTest::newRow("1.5 - don't round") << QSize(10, 10) << 1.5 << QSize(15,15); +} + +void tst_scaling::roundingPolicy() +{ + QFETCH(QSize, windowSize); + QFETCH(qreal, scale); + QFETCH(QSize, expectedBufferSize); + + + QRasterWindow window; + window.resize(windowSize); + window.show(); + QCOMPOSITOR_TRY_VERIFY(xdgToplevel()); + + QSignalSpy surfaceCommitSpy(exec([=] { return surface(); }), &Surface::commit); + + exec([=] { + QVERIFY(fractionalScale()); + fractionalScale()->send_preferred_scale(scale * 120); + xdgToplevel()->sendCompleteConfigure(); + }); + + QVERIFY(surfaceCommitSpy.wait()); + + exec([=] { + Buffer *buffer = xdgToplevel()->surface()->m_committed.buffer; + QVERIFY(buffer); + QCOMPARE(buffer->size(), expectedBufferSize); + }); +} + + +QCOMPOSITOR_TEST_MAIN(tst_scaling) +#include "tst_scaling.moc" diff --git a/tests/auto/wayland/shared/CMakeLists.txt b/tests/auto/wayland/shared/CMakeLists.txt index 653927f050e..8112ffb7120 100644 --- a/tests/auto/wayland/shared/CMakeLists.txt +++ b/tests/auto/wayland/shared/CMakeLists.txt @@ -11,9 +11,11 @@ qt_manual_moc(moc_files corecompositor.h datadevice.h fullscreenshellv1.h + fractionalscalev1.h iviapplication.h textinput.h qttextinput.h + viewport.h xdgoutputv1.h xdgshell.h ) @@ -24,12 +26,14 @@ add_library(SharedClientTest coreprotocol.cpp coreprotocol.h datadevice.cpp datadevice.h fullscreenshellv1.cpp fullscreenshellv1.h + fractionalscalev1.cpp fractionalscalev1.h iviapplication.cpp iviapplication.h mockcompositor.cpp mockcompositor.h textinput.cpp textinput.h qttextinput.cpp qttextinput.h xdgoutputv1.cpp xdgoutputv1.h xdgshell.cpp xdgshell.h + viewport.cpp viewport.h ${moc_files} ) @@ -41,6 +45,8 @@ qt6_generate_wayland_protocol_server_sources(SharedClientTest ${PROJECT_SOURCE_DIR}/src/3rdparty/protocol/tablet-unstable-v2.xml ${PROJECT_SOURCE_DIR}/src/3rdparty/protocol/text-input-unstable-v2.xml ${PROJECT_SOURCE_DIR}/src/extensions/qt-text-input-method-unstable-v1.xml + ${PROJECT_SOURCE_DIR}/src/3rdparty/protocol/fractional-scale-v1.xml + ${PROJECT_SOURCE_DIR}/src/3rdparty/protocol/viewporter.xml ${PROJECT_SOURCE_DIR}/src/3rdparty/protocol/wayland.xml ${PROJECT_SOURCE_DIR}/src/3rdparty/protocol/xdg-decoration-unstable-v1.xml ${PROJECT_SOURCE_DIR}/src/3rdparty/protocol/xdg-output-unstable-v1.xml diff --git a/tests/auto/wayland/shared/fractionalscalev1.cpp b/tests/auto/wayland/shared/fractionalscalev1.cpp new file mode 100644 index 00000000000..5548c3d674b --- /dev/null +++ b/tests/auto/wayland/shared/fractionalscalev1.cpp @@ -0,0 +1,40 @@ +// Copyright (C) 2022 David Edmundson +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#include "fractionalscalev1.h" + +namespace MockCompositor { + +FractionalScaleManager::FractionalScaleManager(CoreCompositor *compositor, int version) + : QtWaylandServer::wp_fractional_scale_manager_v1(compositor->m_display, version) +{ +} + +void FractionalScaleManager::wp_fractional_scale_manager_v1_get_fractional_scale(Resource *resource, uint32_t id, wl_resource *surface) +{ + auto *s = fromResource(surface); + auto *scaler = new FractionalScale(s, resource->client(), id, resource->version()); + connect(scaler, &QObject::destroyed, this, [this, scaler]() { + m_fractionalScales.removeOne(scaler); + }); + m_fractionalScales << scaler; +} + +FractionalScale::FractionalScale(Surface *surface, wl_client *client, int id, int version) + : QtWaylandServer::wp_fractional_scale_v1(client, id, version) + , m_surface(surface) +{ +} + +void FractionalScale::wp_fractional_scale_v1_destroy_resource(Resource *resource) +{ + Q_UNUSED(resource) + delete this; +} + +void FractionalScale::wp_fractional_scale_v1_destroy(Resource *resource) +{ + wl_resource_destroy(resource->handle); +} + +} diff --git a/tests/auto/wayland/shared/fractionalscalev1.h b/tests/auto/wayland/shared/fractionalscalev1.h new file mode 100644 index 00000000000..fd5483e93ca --- /dev/null +++ b/tests/auto/wayland/shared/fractionalscalev1.h @@ -0,0 +1,39 @@ +// Copyright (C) 2022 David Edmundson +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 + +#ifndef MOCKCOMPOSITOR_FRACTIONALSCALE_H +#define MOCKCOMPOSITOR_FRACTIONALSCALE_H + +#include "coreprotocol.h" +#include + +namespace MockCompositor { + +class FractionalScale; + +class FractionalScaleManager : public Global, public QtWaylandServer::wp_fractional_scale_manager_v1 +{ + Q_OBJECT +public: + explicit FractionalScaleManager(CoreCompositor *compositor, int version = 1); + QList m_fractionalScales; + +protected: + void wp_fractional_scale_manager_v1_get_fractional_scale(Resource *resource, uint32_t id, wl_resource *surface) override; +}; + +class FractionalScale : public QObject, public QtWaylandServer::wp_fractional_scale_v1 +{ + Q_OBJECT +public: + explicit FractionalScale(Surface *surface, wl_client *client, int id, int version); + Surface *m_surface; + +protected: + void wp_fractional_scale_v1_destroy_resource(Resource *resource) override; + void wp_fractional_scale_v1_destroy(Resource *resource) override; +}; + +} + +#endif diff --git a/tests/auto/wayland/shared/mockcompositor.cpp b/tests/auto/wayland/shared/mockcompositor.cpp index 1266f7762b2..71f3775a5ae 100644 --- a/tests/auto/wayland/shared/mockcompositor.cpp +++ b/tests/auto/wayland/shared/mockcompositor.cpp @@ -21,6 +21,9 @@ DefaultCompositor::DefaultCompositor(CompositorType t) add(Seat::capability_pointer | Seat::capability_keyboard | Seat::capability_touch); add(); add(); + add(); + add(); + switch (m_type) { case CompositorType::Default: add(); diff --git a/tests/auto/wayland/shared/mockcompositor.h b/tests/auto/wayland/shared/mockcompositor.h index 3b70a430eaa..6803a646c5e 100644 --- a/tests/auto/wayland/shared/mockcompositor.h +++ b/tests/auto/wayland/shared/mockcompositor.h @@ -11,6 +11,8 @@ #include "fullscreenshellv1.h" #include "iviapplication.h" #include "xdgshell.h" +#include "viewport.h" +#include "fractionalscalev1.h" #include @@ -46,6 +48,8 @@ public: Keyboard *keyboard() { auto *seat = get(); Q_ASSERT(seat); return seat->m_keyboard; } FullScreenShellV1 *fullScreenShellV1() {return get();}; IviSurface *iviSurface(int i = 0) { return get()->m_iviSurfaces.value(i, nullptr); } + FractionalScale *fractionalScale(int i = 0) {return get()->m_fractionalScales.value(i, nullptr); } + Viewport *viewport(int i = 0) {return get()->m_viewports.value(i, nullptr); } uint sendXdgShellPing(); void xdgPingAndWaitForPong(); diff --git a/tests/auto/wayland/shared/viewport.cpp b/tests/auto/wayland/shared/viewport.cpp new file mode 100644 index 00000000000..c1e763fec30 --- /dev/null +++ b/tests/auto/wayland/shared/viewport.cpp @@ -0,0 +1,58 @@ +// Copyright (C) 2022 David Edmundson +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#include "viewport.h" + +namespace MockCompositor { + +Viewporter::Viewporter(CoreCompositor *compositor, int version) + : QtWaylandServer::wp_viewporter(compositor->m_display, version) +{ +} + +void Viewporter::wp_viewporter_get_viewport(Resource *resource, uint32_t id, wl_resource *surface) +{ + auto *s = fromResource(surface); + auto *viewport = new Viewport(s, resource->client(), id, resource->version()); + connect(viewport, &QObject::destroyed, this, [this, viewport]() { + m_viewports.removeOne(viewport); + }); + m_viewports << viewport; +} + +Viewport::Viewport(Surface *surface, wl_client *client, int id, int version) + : QtWaylandServer::wp_viewport(client, id, version) + , m_surface(surface) +{ +} + +void Viewport::wp_viewport_set_source(Resource *resource, wl_fixed_t x, wl_fixed_t y, wl_fixed_t width, wl_fixed_t height) +{ + Q_UNUSED(resource) + m_source = QRectF(wl_fixed_to_double(x), + wl_fixed_to_double(y), + wl_fixed_to_double(width), + wl_fixed_to_double(height)); + Q_EMIT sourceChanged(); +} + +void Viewport::wp_viewport_set_destination(Resource *resource, int32_t width, int32_t height) +{ + Q_UNUSED(resource) + + m_destination = QSize(width, height); + Q_EMIT destinationChanged(); +} + +void Viewport::wp_viewport_destroy_resource(Resource *resource) +{ + Q_UNUSED(resource) + delete this; +} + +void Viewport::wp_viewport_destroy(Resource *resource) +{ + wl_resource_destroy(resource->handle); +} + +} diff --git a/tests/auto/wayland/shared/viewport.h b/tests/auto/wayland/shared/viewport.h new file mode 100644 index 00000000000..018e28e10e0 --- /dev/null +++ b/tests/auto/wayland/shared/viewport.h @@ -0,0 +1,50 @@ +// Copyright (C) 2022 David Edmundson +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 + +#ifndef MOCKCOMPOSITOR_VIEWPORT_H +#define MOCKCOMPOSITOR_VIEWPORT_H + +#include "coreprotocol.h" +#include + +namespace MockCompositor { + +class Viewport; + +class Viewporter : public Global, public QtWaylandServer::wp_viewporter +{ + Q_OBJECT +public: + explicit Viewporter(CoreCompositor *compositor, int version = 1); + QList m_viewports; + +protected: + void wp_viewporter_get_viewport(Resource *resource, uint32_t id, wl_resource *surface) override; +}; + +class Viewport : public QObject, public QtWaylandServer::wp_viewport +{ + Q_OBJECT +public: + explicit Viewport(Surface *surface, wl_client *client, int id, int version); + + QRectF m_source; + QSize m_destination; + + Surface* m_surface; + +Q_SIGNALS: + void sourceChanged(); + void destinationChanged(); + +protected: + void wp_viewport_set_source(Resource *resource, wl_fixed_t x, wl_fixed_t y, wl_fixed_t width, wl_fixed_t height) override; + void wp_viewport_set_destination(Resource *resource, int32_t width, int32_t height) override; + + void wp_viewport_destroy_resource(Resource *resource) override; + void wp_viewport_destroy(Resource *resource) override; +}; + +} + +#endif From 9e23cbc94c9d738485b2138be8504ad64bc5a71a Mon Sep 17 00:00:00 2001 From: David Redondo Date: Wed, 12 Oct 2022 09:01:07 +0200 Subject: [PATCH 1135/1507] client: Implement QNativeInterface::Private::QWaylandWindow Task-number: QTBUG-94729 Change-Id: Ib79f3199a4518700aa032c5ca4760a2b53c401e5 Reviewed-by: Qt CI Bot Reviewed-by: David Edmundson --- .../qwaylandfullscreenshellv1surface.h | 1 + .../wl-shell/qwaylandwlshellsurface_p.h | 2 ++ .../xdg-shell/qwaylandxdgshell.cpp | 9 +++++++++ .../xdg-shell/qwaylandxdgshell_p.h | 2 ++ .../platforms/wayland/qwaylandnativeinterface.cpp | 2 +- .../platforms/wayland/qwaylandshellsurface_p.h | 4 ++++ .../platforms/wayland/qwaylandvulkanwindow.cpp | 2 +- .../platforms/wayland/qwaylandvulkanwindow_p.h | 2 +- src/plugins/platforms/wayland/qwaylandwindow.cpp | 14 ++++++++++++++ src/plugins/platforms/wayland/qwaylandwindow_p.h | 15 +++++++++++---- 10 files changed, 46 insertions(+), 7 deletions(-) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/fullscreen-shell-v1/qwaylandfullscreenshellv1surface.h b/src/plugins/platforms/wayland/plugins/shellintegration/fullscreen-shell-v1/qwaylandfullscreenshellv1surface.h index 8affdfd66e5..0a82e5eee2a 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/fullscreen-shell-v1/qwaylandfullscreenshellv1surface.h +++ b/src/plugins/platforms/wayland/plugins/shellintegration/fullscreen-shell-v1/qwaylandfullscreenshellv1surface.h @@ -18,6 +18,7 @@ class Q_WAYLANDCLIENT_EXPORT QWaylandFullScreenShellV1Surface : public QWaylandS { public: QWaylandFullScreenShellV1Surface(QtWayland::zwp_fullscreen_shell_v1 *shell, QWaylandWindow *window); + std::any surfaceRole() const override { return m_shell->object(); } private: QtWayland::zwp_fullscreen_shell_v1 *m_shell = nullptr; diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellsurface_p.h b/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellsurface_p.h index d3996f43bc1..24600302895 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellsurface_p.h +++ b/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellsurface_p.h @@ -57,6 +57,8 @@ public: void applyConfigure() override; bool wantsDecorations() const override; + std::any surfaceRole() const override { return object(); }; + protected: void requestWindowStates(Qt::WindowStates states) override; diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp index 9bd5209f042..c1462e07d7f 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp @@ -417,6 +417,15 @@ void *QWaylandXdgSurface::nativeResource(const QByteArray &resource) return nullptr; } +std::any QWaylandXdgSurface::surfaceRole() const +{ + if (m_toplevel) + return m_toplevel->object(); + if (m_popup) + return m_popup->object(); + return {}; +} + void QWaylandXdgSurface::requestWindowStates(Qt::WindowStates states) { if (m_toplevel) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h index abfd0db3baf..58860269780 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h @@ -72,6 +72,8 @@ public: void *nativeResource(const QByteArray &resource); + std::any surfaceRole() const override; + protected: void requestWindowStates(Qt::WindowStates states) override; void xdg_surface_configure(uint32_t serial) override; diff --git a/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp b/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp index b76b1f08b82..ea3da8b4881 100644 --- a/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp +++ b/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp @@ -143,7 +143,7 @@ void *QWaylandNativeInterface::nativeResourceForWindow(const QByteArray &resourc if (lowerCaseResource == "vksurface") { if (window->surfaceType() == QSurface::VulkanSurface && window->handle()) { // return a pointer to the VkSurfaceKHR value, not the value itself - return static_cast(window->handle())->surface(); + return static_cast(window->handle())->vkSurface(); } } #endif diff --git a/src/plugins/platforms/wayland/qwaylandshellsurface_p.h b/src/plugins/platforms/wayland/qwaylandshellsurface_p.h index 8f176e281eb..51116c52a62 100644 --- a/src/plugins/platforms/wayland/qwaylandshellsurface_p.h +++ b/src/plugins/platforms/wayland/qwaylandshellsurface_p.h @@ -21,6 +21,8 @@ #include #include +#include + struct wl_surface; QT_BEGIN_NAMESPACE @@ -80,6 +82,8 @@ public: QPlatformWindow *platformWindow(); struct wl_surface *wlSurface(); + virtual std::any surfaceRole() const { return std::any(); }; + protected: void resizeFromApplyConfigure(const QSize &sizeWithMargins, const QPoint &offset = {0, 0}); void repositionFromApplyConfigure(const QPoint &position); diff --git a/src/plugins/platforms/wayland/qwaylandvulkanwindow.cpp b/src/plugins/platforms/wayland/qwaylandvulkanwindow.cpp index 228bf5ced27..db25a27155a 100644 --- a/src/plugins/platforms/wayland/qwaylandvulkanwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandvulkanwindow.cpp @@ -26,7 +26,7 @@ QWaylandWindow::WindowType QWaylandVulkanWindow::windowType() const return QWaylandWindow::Vulkan; } -VkSurfaceKHR *QWaylandVulkanWindow::surface() +VkSurfaceKHR *QWaylandVulkanWindow::vkSurface() { if (m_surface) return &m_surface; diff --git a/src/plugins/platforms/wayland/qwaylandvulkanwindow_p.h b/src/plugins/platforms/wayland/qwaylandvulkanwindow_p.h index d71fb277ca3..df24e5dbda9 100644 --- a/src/plugins/platforms/wayland/qwaylandvulkanwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandvulkanwindow_p.h @@ -30,7 +30,7 @@ public: WindowType windowType() const override; - VkSurfaceKHR *surface(); + VkSurfaceKHR *vkSurface(); private: VkSurfaceKHR m_surface = VK_NULL_HANDLE; diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 56b9af282e9..4e254dee973 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -59,6 +59,11 @@ QWaylandWindow::QWaylandWindow(QWindow *window, QWaylandDisplay *display) static WId id = 1; mWindowId = id++; initializeWlSurface(); + + connect(this, &QWaylandWindow::wlSurfaceCreated, this, + &QNativeInterface::Private::QWaylandWindow::surfaceCreated); + connect(this, &QWaylandWindow::wlSurfaceDestroyed, this, + &QNativeInterface::Private::QWaylandWindow::surfaceDestroyed); } QWaylandWindow::~QWaylandWindow() @@ -847,6 +852,15 @@ QWaylandShellSurface *QWaylandWindow::shellSurface() const return mShellSurface; } +std::any QWaylandWindow::_surfaceRole() const +{ + if (mSubSurfaceWindow) + return mSubSurfaceWindow->object(); + if (mShellSurface) + return mShellSurface->surfaceRole(); + return {}; +} + QWaylandSubSurface *QWaylandWindow::subSurfaceWindow() const { return mSubSurfaceWindow; diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index 6531606a743..2eb6b64cec2 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -28,10 +28,12 @@ #include // for QVariantMap #include +#include #include #include #include +#include struct wl_egl_window; @@ -56,7 +58,8 @@ class QWaylandSurface; class QWaylandFractionalScale; class QWaylandViewport; -class Q_WAYLANDCLIENT_EXPORT QWaylandWindow : public QObject, public QPlatformWindow +class Q_WAYLANDCLIENT_EXPORT QWaylandWindow : public QNativeInterface::Private::QWaylandWindow, + public QPlatformWindow { Q_OBJECT public: @@ -115,17 +118,22 @@ public: QMargins frameMargins() const override; QMargins customMargins() const; - void setCustomMargins(const QMargins &margins); + void setCustomMargins(const QMargins &margins) override; QSize surfaceSize() const; QRect windowContentGeometry() const; QPointF mapFromWlSurface(const QPointF &surfacePosition) const; QWaylandSurface *waylandSurface() const { return mSurface.data(); } ::wl_surface *wlSurface(); + ::wl_surface *surface() const override + { + return const_cast(this)->wlSurface(); + } static QWaylandWindow *fromWlSurface(::wl_surface *surface); QWaylandDisplay *display() const { return mDisplay; } QWaylandShellSurface *shellSurface() const; + std::any _surfaceRole() const override; QWaylandSubSurface *subSurfaceWindow() const; QWaylandScreen *waylandScreen() const; @@ -207,7 +215,7 @@ public: void deliverUpdateRequest() override; void setXdgActivationToken(const QString &token); - void requestXdgActivationToken(uint serial); + void requestXdgActivationToken(uint serial) override; void beginFrame(); void endFrame(); @@ -222,7 +230,6 @@ public slots: signals: void wlSurfaceCreated(); void wlSurfaceDestroyed(); - void xdgActivationTokenCreated(const QString &token); protected: virtual void doHandleFrameCallback(); From 0052d0ed13eebb7e884d4796726b6f33df28dde9 Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Wed, 16 Nov 2022 15:13:17 +0200 Subject: [PATCH 1136/1507] Client: Provide support for custom shells Currently, an application can use only one shell surface protocol at a time. However, there are applications that need to use more than one shell surface protocol, e.g. xdg-shell + layer-shell. layer-shell can be used for the desktop background window, and xdg-shell for popups, etc. This change introduces an API in QWaylandWindow that allows specifying the shell integration per window. Custom shell code needs to call QWaylandWindow::setShellIntegration() while the window is unmapped. By default, QWaylandWindow will use QWaylandDisplay's shell integration plugin. This change should be source compatible with existing shell integration plugins deployed in the wild. If the custom shell wants to track additional state for the window, it should do it using its own means. Perhaps we could improve this in the future releases of Qt. [ChangeLog][QtWaylandClient] It is possible to run Qt applications using more than one shell surface protocol, e.g. xdg-shell + layer-shell. Change-Id: Id0458b32af623f114c06d51d0d21ad06efd69328 Reviewed-by: David Edmundson Reviewed-by: Eskil Abrahamsen Blomfeldt --- .../wayland/qwaylandnativeinterface.cpp | 5 +++-- .../platforms/wayland/qwaylandwindow.cpp | 17 ++++++++++++++--- .../platforms/wayland/qwaylandwindow_p.h | 5 +++++ 3 files changed, 22 insertions(+), 5 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp b/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp index ea3da8b4881..2c1cdb98b09 100644 --- a/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp +++ b/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp @@ -148,8 +148,9 @@ void *QWaylandNativeInterface::nativeResourceForWindow(const QByteArray &resourc } #endif - if (auto shellIntegration = m_integration->shellIntegration()) - return shellIntegration->nativeResourceForWindow(resourceString, window); + QWaylandWindow *platformWindow = static_cast(window->handle()); + if (platformWindow && platformWindow->shellIntegration()) + return platformWindow->shellIntegration()->nativeResourceForWindow(resourceString, window); return nullptr; } diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 4e254dee973..f5327c05c6c 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -45,6 +45,7 @@ QWaylandWindow::QWaylandWindow(QWindow *window, QWaylandDisplay *display) : QPlatformWindow(window) , mDisplay(display) , mSurfaceLock(QReadWriteLock::Recursive) + , mShellIntegration(display->shellIntegration()) , mResizeAfterSwap(qEnvironmentVariableIsSet("QT_WAYLAND_RESIZE_AFTER_SWAP")) { { @@ -130,9 +131,9 @@ void QWaylandWindow::initWindow() } } else if (shouldCreateShellSurface()) { Q_ASSERT(!mShellSurface); - Q_ASSERT(mDisplay->shellIntegration()); + Q_ASSERT(mShellIntegration); - mShellSurface = mDisplay->shellIntegration()->createShellSurface(this); + mShellSurface = mShellIntegration->createShellSurface(this); if (mShellSurface) { // Set initial surface title setWindowTitle(window()->title()); @@ -216,9 +217,19 @@ void QWaylandWindow::initializeWlSurface() emit wlSurfaceCreated(); } +void QWaylandWindow::setShellIntegration(QWaylandShellIntegration *shellIntegration) +{ + Q_ASSERT(shellIntegration); + if (mShellSurface) { + qCWarning(lcQpaWayland) << "Cannot set shell integration while there's already a shell surface created"; + return; + } + mShellIntegration = shellIntegration; +} + bool QWaylandWindow::shouldCreateShellSurface() const { - if (!mDisplay->shellIntegration()) + if (!shellIntegration()) return false; if (shouldCreateSubSurface()) diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index 2eb6b64cec2..185de69a96a 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -50,6 +50,7 @@ class QWaylandSubSurface; class QWaylandAbstractDecoration; class QWaylandInputDevice; class QWaylandScreen; +class QWaylandShellIntegration; class QWaylandShmBackingStore; class QWaylandPointerEvent; class QWaylandPointerGestureSwipeEvent; @@ -202,6 +203,9 @@ public: void setBackingStore(QWaylandShmBackingStore *backingStore) { mBackingStore = backingStore; } QWaylandShmBackingStore *backingStore() const { return mBackingStore; } + void setShellIntegration(QWaylandShellIntegration *shellIntegration); + QWaylandShellIntegration *shellIntegration() const { return mShellIntegration; } + bool setKeyboardGrabEnabled(bool) override { return false; } void propagateSizeHints() override; void addAttachOffset(const QPoint point); @@ -245,6 +249,7 @@ protected: QScopedPointer mFractionalScale; QScopedPointer mViewport; + QWaylandShellIntegration *mShellIntegration = nullptr; QWaylandShellSurface *mShellSurface = nullptr; QWaylandSubSurface *mSubSurfaceWindow = nullptr; QList mChildren; From 77442e107f74e0d1c488bf0f4b22d63eeb90aee6 Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Tue, 27 Sep 2022 22:05:07 +0300 Subject: [PATCH 1137/1507] Client: Handle zwp_primary_selection_device_manager_v1 global removal The zwp_primary_selection_device_manager_v1 global can be withdrawn if the compositor disables the primary selection, i.e. middle click to paste selected text. QtWayland needs to handle that; otherwise the app can crash. Pick-to: 6.5 Change-Id: Idbb4db18b605f85a5951fa12c1bdf61898b0d123 Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/plugins/platforms/wayland/qwaylanddisplay.cpp | 9 +++++++++ .../platforms/wayland/qwaylandprimaryselectionv1.cpp | 5 ----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index 52ea64929de..2bf09331c74 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -522,6 +522,8 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin #if QT_CONFIG(wayland_client_primary_selection) } else if (interface == QLatin1String(QWaylandPrimarySelectionDeviceManagerV1::interface()->name)) { mPrimarySelectionManager.reset(new QWaylandPrimarySelectionDeviceManagerV1(this, id, 1)); + for (QWaylandInputDevice *inputDevice : std::as_const(mInputDevices)) + inputDevice->setPrimarySelectionDevice(mPrimarySelectionManager->createDevice(inputDevice)); #endif } else if (interface == QLatin1String(QtWayland::qt_text_input_method_manager_v1::interface()->name) && (mTextInputManagerList.contains(interface) && mTextInputManagerList.indexOf(interface) < mTextInputManagerIndex)) { @@ -674,6 +676,13 @@ void QWaylandDisplay::registry_global_remove(uint32_t id) inputDevice->setTextInputMethod(nullptr); mWaylandIntegration->reconfigureInputContext(); } +#if QT_CONFIG(wayland_client_primary_selection) + if (global.interface == QLatin1String(QtWayland::zwp_primary_selection_device_manager_v1::interface()->name)) { + mPrimarySelectionManager.reset(); + for (QWaylandInputDevice *inputDevice : std::as_const(mInputDevices)) + inputDevice->setPrimarySelectionDevice(nullptr); + } +#endif emit globalRemoved(mGlobals.takeAt(i)); break; } diff --git a/src/plugins/platforms/wayland/qwaylandprimaryselectionv1.cpp b/src/plugins/platforms/wayland/qwaylandprimaryselectionv1.cpp index 1eb1fcff3e1..999aba97018 100644 --- a/src/plugins/platforms/wayland/qwaylandprimaryselectionv1.cpp +++ b/src/plugins/platforms/wayland/qwaylandprimaryselectionv1.cpp @@ -18,11 +18,6 @@ QWaylandPrimarySelectionDeviceManagerV1::QWaylandPrimarySelectionDeviceManagerV1 : zwp_primary_selection_device_manager_v1(display->wl_registry(), id, qMin(version, uint(1))) , m_display(display) { - // Create devices for all seats. - // This only works if we get the global before all devices - const auto seats = m_display->inputDevices(); - for (auto *seat : seats) - seat->setPrimarySelectionDevice(createDevice(seat)); } QWaylandPrimarySelectionDeviceV1 *QWaylandPrimarySelectionDeviceManagerV1::createDevice(QWaylandInputDevice *seat) From 7ababb0dfbaab877e1bad2d083fdd74864135428 Mon Sep 17 00:00:00 2001 From: Thomas Senyk Date: Tue, 13 Dec 2022 11:19:58 +0100 Subject: [PATCH 1138/1507] Add WL_SHM_FORMAT_RGB888 to supported shm formats In addition a new entry in QWaylandCompositor::ShmFormat allows compositors to enable that format at runtime Pick-to: 6.5 Change-Id: I0f894adb3f688458a65713e343127fbcb26f8b65 Reviewed-by: Eskil Abrahamsen Blomfeldt Reviewed-by: Volker Hilsheimer --- .../wayland/shared/qwaylandsharedmemoryformathelper_p.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/shared/qwaylandsharedmemoryformathelper_p.h b/src/plugins/platforms/wayland/shared/qwaylandsharedmemoryformathelper_p.h index 55bcfc41ccf..c8a9c286515 100644 --- a/src/plugins/platforms/wayland/shared/qwaylandsharedmemoryformathelper_p.h +++ b/src/plugins/platforms/wayland/shared/qwaylandsharedmemoryformathelper_p.h @@ -24,6 +24,7 @@ public: case WL_SHM_FORMAT_RGB565: return QImage::Format_RGB16; case WL_SHM_FORMAT_XRGB1555: return QImage::Format_RGB555; case WL_SHM_FORMAT_RGB888: return QImage::Format_RGB888; + case WL_SHM_FORMAT_BGR888: return QImage::Format_BGR888; case WL_SHM_FORMAT_XRGB4444: return QImage::Format_RGB444; case WL_SHM_FORMAT_ARGB4444: return QImage::Format_ARGB4444_Premultiplied; case WL_SHM_FORMAT_XBGR8888: return QImage::Format_RGBX8888; @@ -76,7 +77,13 @@ private: WL_SHM_FORMAT_XRGB2101010, //Format_RGB30, WL_SHM_FORMAT_ARGB2101010, //Format_A2RGB30_Premultiplied, WL_SHM_FORMAT_C8, //Format_Alpha8, - WL_SHM_FORMAT_C8 //Format_Grayscale8, + WL_SHM_FORMAT_C8, //Format_Grayscale8, + wl_shm_format(INT_MIN), //Format_RGBX64, + wl_shm_format(INT_MIN), //Format_RGBA64, + wl_shm_format(INT_MIN), //Format_RGBA64_Premultiplied, + wl_shm_format(INT_MIN), //Format_Grayscale16, + WL_SHM_FORMAT_BGR888, //Format_BGR888 + }; const size_t size = sizeof(formats_array) / sizeof(*formats_array); return Array(size, formats_array); From 19f6aae5f2dff03fdcaf8dc3f2de99eaddbe6456 Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Fri, 23 Dec 2022 15:30:22 +0200 Subject: [PATCH 1139/1507] Client: Port to QPlatformTheme::{MouseCursorTheme,MouseCursorSize} It allows the platform theme to specify the preferred cursor theme and cursor size without resorting to hacks such as setting XCURSOR_THEME and XCURSOR_SIZE environment variables. Pick-to: 6.5 Change-Id: I9e44f9c6dddbb5d730f8ac092f2c11fdbccf8d27 Reviewed-by: Liang Qi --- .../platforms/wayland/qwaylandinputdevice.cpp | 33 ++++++++++--------- .../platforms/wayland/qwaylandinputdevice_p.h | 2 -- 2 files changed, 17 insertions(+), 18 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index 724243cc3b1..30f197571fc 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -36,6 +36,7 @@ #include #include #include +#include #include #include @@ -229,19 +230,6 @@ private: QPoint m_hotspot; }; -QString QWaylandInputDevice::Pointer::cursorThemeName() const -{ - static QString themeName = qEnvironmentVariable("XCURSOR_THEME", QStringLiteral("default")); - return themeName; -} - -int QWaylandInputDevice::Pointer::cursorSize() const -{ - constexpr int defaultCursorSize = 24; - static const int xCursorSize = qEnvironmentVariableIntValue("XCURSOR_SIZE"); - return xCursorSize > 0 ? xCursorSize : defaultCursorSize; -} - int QWaylandInputDevice::Pointer::idealCursorScale() const { if (seat()->mQDisplay->compositor()->version() < 3) { @@ -258,17 +246,30 @@ int QWaylandInputDevice::Pointer::idealCursorScale() const void QWaylandInputDevice::Pointer::updateCursorTheme() { + QString cursorThemeName; + QSize cursorSize; + + if (const QPlatformTheme *platformTheme = QGuiApplicationPrivate::platformTheme()) { + cursorThemeName = platformTheme->themeHint(QPlatformTheme::MouseCursorTheme).toString(); + cursorSize = platformTheme->themeHint(QPlatformTheme::MouseCursorSize).toSize(); + } + + if (cursorThemeName.isEmpty()) + cursorThemeName = QStringLiteral("default"); + if (cursorSize.isEmpty()) + cursorSize = QSize(24, 24); + int scale = idealCursorScale(); - int pixelSize = cursorSize() * scale; + int pixelSize = cursorSize.width() * scale; auto *display = seat()->mQDisplay; - mCursor.theme = display->loadCursorTheme(cursorThemeName(), pixelSize); + mCursor.theme = display->loadCursorTheme(cursorThemeName, pixelSize); if (!mCursor.theme) return; // A warning has already been printed in loadCursorTheme if (auto *arrow = mCursor.theme->cursor(Qt::ArrowCursor)) { int arrowPixelSize = qMax(arrow->images[0]->width, arrow->images[0]->height); // Not all cursor themes are square - while (scale > 1 && arrowPixelSize / scale < cursorSize()) + while (scale > 1 && arrowPixelSize / scale < cursorSize.width()) --scale; } else { qCWarning(lcQpaWayland) << "Cursor theme does not support the arrow cursor"; diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h index fbc260082cf..17f01f4904a 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h +++ b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h @@ -280,8 +280,6 @@ public: ~Pointer() override; QWaylandWindow *focusWindow() const; #if QT_CONFIG(cursor) - QString cursorThemeName() const; - int cursorSize() const; // in surface coordinates int idealCursorScale() const; void updateCursorTheme(); void updateCursor(); From 051b3ce2ee588338d3057e255b1051c97881259f Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Tue, 22 Nov 2022 23:27:34 +0200 Subject: [PATCH 1140/1507] Client: Fix handling of Qt::BlankCursor The cursor may not be properly set when a window has Qt::BlankCursor and it's shown. In that case, the cursor surface may not be present and wl_pointer.set_cursor won't be called. On the other hand, wl_pointer.set_cursor must be always called when wl_pointer.enter is received. Pick-to: 6.5 Change-Id: I8540e7a02df1579b3380a1a1d4cfab42c1ab3104 Reviewed-by: David Edmundson Reviewed-by: Qt CI Bot --- src/plugins/platforms/wayland/qwaylandinputdevice.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index 30f197571fc..00e9e09fa67 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -285,8 +285,7 @@ void QWaylandInputDevice::Pointer::updateCursor() auto shape = seat()->mCursor.shape; if (shape == Qt::BlankCursor) { - if (mCursor.surface) - mCursor.surface->hide(); + getOrCreateCursorSurface()->hide(); return; } From 5925c3110df258e78e6086e3bf526b8f6f779039 Mon Sep 17 00:00:00 2001 From: Tang Haixiang Date: Thu, 22 Dec 2022 15:19:53 +0800 Subject: [PATCH 1141/1507] Client: Manage QMimeData lifecycle QMimeData is created by user, it is not taken care of in qtwayland, which will cause memory leak. It is now handled in qtwayland that when a new QMimeData is set, the previous QMimeData is freed. Change-Id: Ic502021fe700c7ee10454d94f0d1868901809af7 Reviewed-by: David Edmundson Reviewed-by: Qt CI Bot --- .../platforms/wayland/qwaylandclipboard.cpp | 27 ++++++++++++++----- .../platforms/wayland/qwaylandclipboard_p.h | 1 + .../platforms/wayland/qwaylanddatasource.cpp | 5 ---- .../platforms/wayland/qwaylanddatasource_p.h | 2 -- 4 files changed, 22 insertions(+), 13 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandclipboard.cpp b/src/plugins/platforms/wayland/qwaylandclipboard.cpp index d3566244b21..df6cf5d2b0c 100644 --- a/src/plugins/platforms/wayland/qwaylandclipboard.cpp +++ b/src/plugins/platforms/wayland/qwaylandclipboard.cpp @@ -18,10 +18,15 @@ namespace QtWaylandClient { QWaylandClipboard::QWaylandClipboard(QWaylandDisplay *display) : mDisplay(display) { + m_clientClipboard[QClipboard::Clipboard] = nullptr; + m_clientClipboard[QClipboard::Selection] = nullptr; } QWaylandClipboard::~QWaylandClipboard() { + if (m_clientClipboard[QClipboard::Clipboard] != m_clientClipboard[QClipboard::Selection]) + delete m_clientClipboard[QClipboard::Clipboard]; + delete m_clientClipboard[QClipboard::Selection]; } QMimeData *QWaylandClipboard::mimeData(QClipboard::Mode mode) @@ -33,8 +38,8 @@ QMimeData *QWaylandClipboard::mimeData(QClipboard::Mode mode) switch (mode) { case QClipboard::Clipboard: if (auto *dataDevice = seat->dataDevice()) { - if (auto *source = dataDevice->selectionSource()) - return source->mimeData(); + if (dataDevice->selectionSource()) + return m_clientClipboard[QClipboard::Clipboard]; if (auto *offer = dataDevice->selectionOffer()) return offer->mimeData(); } @@ -42,8 +47,8 @@ QMimeData *QWaylandClipboard::mimeData(QClipboard::Mode mode) case QClipboard::Selection: #if QT_CONFIG(wayland_client_primary_selection) if (auto *selectionDevice = seat->primarySelectionDevice()) { - if (auto *source = selectionDevice->selectionSource()) - return source->mimeData(); + if (selectionDevice->selectionSource()) + return m_clientClipboard[QClipboard::Selection]; if (auto *offer = selectionDevice->selectionOffer()) return offer->mimeData(); } @@ -68,17 +73,27 @@ void QWaylandClipboard::setMimeData(QMimeData *data, QClipboard::Mode mode) if (data && data->hasFormat(plain) && !data->hasFormat(utf8)) data->setData(utf8, data->data(plain)); + if (m_clientClipboard[mode]) { + if (m_clientClipboard[QClipboard::Clipboard] != m_clientClipboard[QClipboard::Selection]) + delete m_clientClipboard[mode]; + m_clientClipboard[mode] = nullptr; + } + + m_clientClipboard[mode] = data; + switch (mode) { case QClipboard::Clipboard: if (auto *dataDevice = seat->dataDevice()) { - dataDevice->setSelectionSource(data ? new QWaylandDataSource(mDisplay->dndSelectionHandler(), data) : nullptr); + dataDevice->setSelectionSource(data ? new QWaylandDataSource(mDisplay->dndSelectionHandler(), + m_clientClipboard[QClipboard::Clipboard]) : nullptr); emitChanged(mode); } break; case QClipboard::Selection: #if QT_CONFIG(wayland_client_primary_selection) if (auto *selectionDevice = seat->primarySelectionDevice()) { - selectionDevice->setSelectionSource(data ? new QWaylandPrimarySelectionSourceV1(mDisplay->primarySelectionManager(), data) : nullptr); + selectionDevice->setSelectionSource(data ? new QWaylandPrimarySelectionSourceV1(mDisplay->primarySelectionManager(), + m_clientClipboard[QClipboard::Selection]) : nullptr); emitChanged(mode); } #endif diff --git a/src/plugins/platforms/wayland/qwaylandclipboard_p.h b/src/plugins/platforms/wayland/qwaylandclipboard_p.h index 655620bdad4..414e3dc716b 100644 --- a/src/plugins/platforms/wayland/qwaylandclipboard_p.h +++ b/src/plugins/platforms/wayland/qwaylandclipboard_p.h @@ -45,6 +45,7 @@ public: private: QWaylandDisplay *mDisplay = nullptr; QMimeData m_emptyData; + QMimeData *m_clientClipboard[2]; }; } diff --git a/src/plugins/platforms/wayland/qwaylanddatasource.cpp b/src/plugins/platforms/wayland/qwaylanddatasource.cpp index 093c40f2fd5..966d5ef7f1d 100644 --- a/src/plugins/platforms/wayland/qwaylanddatasource.cpp +++ b/src/plugins/platforms/wayland/qwaylanddatasource.cpp @@ -36,11 +36,6 @@ QWaylandDataSource::~QWaylandDataSource() destroy(); } -QMimeData * QWaylandDataSource::mimeData() const -{ - return m_mime_data; -} - void QWaylandDataSource::data_source_cancelled() { Q_EMIT cancelled(); diff --git a/src/plugins/platforms/wayland/qwaylanddatasource_p.h b/src/plugins/platforms/wayland/qwaylanddatasource_p.h index 0ce09a409ca..a4b317c2626 100644 --- a/src/plugins/platforms/wayland/qwaylanddatasource_p.h +++ b/src/plugins/platforms/wayland/qwaylanddatasource_p.h @@ -38,8 +38,6 @@ public: QWaylandDataSource(QWaylandDataDeviceManager *dataDeviceManager, QMimeData *mimeData); ~QWaylandDataSource() override; - QMimeData *mimeData() const; - Q_SIGNALS: void cancelled(); void finished(); From bc44aa66075b592ab7a84ea1cd33ec69fd953252 Mon Sep 17 00:00:00 2001 From: Aleix Pol Date: Tue, 24 Jan 2023 02:45:51 +0100 Subject: [PATCH 1142/1507] QWaylandDataOffer: Save double look-up Only look up the value on the QHash once. Change-Id: I7c7c2f72bb1aa8fad0d374d5ea84c093ea5a2f01 Reviewed-by: David Edmundson --- src/plugins/platforms/wayland/qwaylanddataoffer.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylanddataoffer.cpp b/src/plugins/platforms/wayland/qwaylanddataoffer.cpp index 533c0023a9f..046385e9134 100644 --- a/src/plugins/platforms/wayland/qwaylanddataoffer.cpp +++ b/src/plugins/platforms/wayland/qwaylanddataoffer.cpp @@ -117,8 +117,9 @@ QVariant QWaylandMimeData::retrieveData_sys(const QString &mimeType, QMetaType t { Q_UNUSED(type); - if (m_data.contains(mimeType)) - return m_data.value(mimeType); + auto it = m_data.constFind(mimeType); + if (it != m_data.constEnd()) + return *it; QString mime = mimeType; From 9c35dc2284fbadf0c697dc364fb5882867e91eb6 Mon Sep 17 00:00:00 2001 From: Aleix Pol Date: Tue, 24 Jan 2023 02:49:49 +0100 Subject: [PATCH 1143/1507] QWaylandTabletSeatV2: Do not leak tablet information Clean up after the information we allocated, this way address sanitizer doesn't complain about it leaking. Change-Id: Ib7ade93d6585b8c6be6a71d0497801d9cfe75d2f Reviewed-by: David Edmundson --- src/plugins/platforms/wayland/qwaylandtabletv2.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/plugins/platforms/wayland/qwaylandtabletv2.cpp b/src/plugins/platforms/wayland/qwaylandtabletv2.cpp index 8a0544aeb94..5e1cc8fe482 100644 --- a/src/plugins/platforms/wayland/qwaylandtabletv2.cpp +++ b/src/plugins/platforms/wayland/qwaylandtabletv2.cpp @@ -38,6 +38,9 @@ QWaylandTabletSeatV2::~QWaylandTabletSeatV2() tool->destroy(); for (auto *pad : m_pads) pad->destroy(); + qDeleteAll(m_tablets); + qDeleteAll(m_tools); + qDeleteAll(m_pads); destroy(); } From 41a9ffeb0c7309e9e2b84c3b3666a423dedce317 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Fri, 13 Jan 2023 07:47:24 +0400 Subject: [PATCH 1144/1507] client: Attempt to request activate even if there's no focus window The compositor is likely to display some indication even if the activation fails, so it's helpful to always do the request. Pick-to: 6.5 6.4 Change-Id: Ia3a8075e471d5a4b619f420ee166e7146f1229b8 Reviewed-by: Aleix Pol Gonzalez --- .../shellintegration/xdg-shell/qwaylandxdgshell.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp index c1462e07d7f..d339bb56b5f 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp @@ -535,8 +535,12 @@ bool QWaylandXdgSurface::requestActivate() activation->activate(token, window()->wlSurface()); qunsetenv("XDG_ACTIVATION_TOKEN"); return true; - } else if (const auto focusWindow = QGuiApplication::focusWindow()) { - const auto wlWindow = static_cast(focusWindow->handle()); + } else { + const auto focusWindow = QGuiApplication::focusWindow(); + // At least GNOME requires to request the token in order to get the + // focus stealing prevention indication, so requestXdgActivationToken call + // is still necessary in that case. + const auto wlWindow = focusWindow ? static_cast(focusWindow->handle()) : m_window; if (const auto xdgSurface = qobject_cast(wlWindow->shellSurface())) { if (const auto seat = wlWindow->display()->lastInputDevice()) { const auto tokenProvider = activation->requestXdgActivationToken( From 0c96282e97f4d6c24ed7bc92cafa9880c163349c Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Wed, 25 Jan 2023 17:07:07 +0400 Subject: [PATCH 1145/1507] Don't change process locale while initializing QWaylandInputContext This was overriding the locale previously set in QCoreApplicationPrivate::initLocale and can switch the process to non-UTF8 codepage Pick-to: 6.5 6.4 6.2 Change-Id: I5cd6664d1a7c315019d6c798b33b9deb33982a59 Reviewed-by: Thiago Macieira --- src/plugins/platforms/wayland/qwaylandinputcontext.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandinputcontext.cpp b/src/plugins/platforms/wayland/qwaylandinputcontext.cpp index e67311a1602..3af55bccbfb 100644 --- a/src/plugins/platforms/wayland/qwaylandinputcontext.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputcontext.cpp @@ -222,9 +222,7 @@ void QWaylandInputContext::ensureInitialized() } m_initialized = true; - const char *locale = setlocale(LC_CTYPE, ""); - if (!locale) - locale = setlocale(LC_CTYPE, nullptr); + const char *const locale = setlocale(LC_CTYPE, nullptr); qCDebug(qLcQpaInputMethods) << "detected locale (LC_CTYPE):" << locale; m_composeTable = xkb_compose_table_new_from_locale(m_XkbContext, locale, XKB_COMPOSE_COMPILE_NO_FLAGS); From f821878cd74c566b966b0194ccb999854c93452a Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Thu, 12 Jan 2023 14:56:18 +0100 Subject: [PATCH 1146/1507] client: Fix infinite recursion with text-input-v2 It was possible to get into an infinite recursion when double-clicking an entry in an item view to edit it. What would happen is that the editor takes focus, and we call commit on the input method commit in case the previous focused widget has pending input that needs to be committed. The subsequent method event then causes the QAbstractItemView to set focus, and since we have not yet updated the focus in the previous call, we end up in an infinite recursion, eventually crashing when the stack overflows. As a guard for this, we only send an input method event when there is actually pre-edit text to commit, and we reset the pre-edit text immediately so that any subsequent call will just exit. [ChangeLog][QtWaylandClient] Fixed a possible crash when editing a field in an item view. Pick-to: 5.15 6.2 6.4 6.5 Fixes: QTBUG-109302 Change-Id: I45237c80e53b1386705279899e19319180d78fa1 Reviewed-by: Liang Qi Reviewed-by: Paul Olav Tvete Reviewed-by: Inho Lee --- src/plugins/platforms/wayland/qwaylandtextinputv2.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandtextinputv2.cpp b/src/plugins/platforms/wayland/qwaylandtextinputv2.cpp index 402f5b557e4..4dec15d56ae 100644 --- a/src/plugins/platforms/wayland/qwaylandtextinputv2.cpp +++ b/src/plugins/platforms/wayland/qwaylandtextinputv2.cpp @@ -58,9 +58,14 @@ void QWaylandTextInputv2::reset() void QWaylandTextInputv2::commit() { if (QObject *o = QGuiApplication::focusObject()) { - QInputMethodEvent event; - event.setCommitString(m_preeditCommit); - QCoreApplication::sendEvent(o, &event); + if (!m_preeditCommit.isEmpty()) { + + QInputMethodEvent event; + event.setCommitString(m_preeditCommit); + m_preeditCommit = QString(); + + QCoreApplication::sendEvent(o, &event); + } } reset(); From 25d387c614554b568d37d8b4964dee7af23e3059 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 1 Feb 2023 14:23:52 +0100 Subject: [PATCH 1147/1507] Disambiguate static variables They cause clashes in CMake Unity (Jumbo) builds. Pick-to: 6.5 Task-number: QTBUG-109394 Change-Id: Ia6e293fa30d788f8abd52bf675f11d7d0151259f Reviewed-by: Eskil Abrahamsen Blomfeldt --- .../qwaylandclientbufferintegrationfactory.cpp | 6 +++--- .../qwaylandserverbufferintegrationfactory.cpp | 6 +++--- .../qwaylandinputdeviceintegrationfactory.cpp | 6 +++--- src/plugins/platforms/wayland/qwaylanddecorationfactory.cpp | 6 +++--- .../shellintegration/qwaylandshellintegrationfactory.cpp | 6 +++--- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationfactory.cpp b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationfactory.cpp index 48310589ed9..65c7a450dbf 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationfactory.cpp +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationfactory.cpp @@ -12,17 +12,17 @@ QT_BEGIN_NAMESPACE namespace QtWaylandClient { -Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader, +Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, qwcbifLoader, (QWaylandClientBufferIntegrationFactoryInterface_iid, QLatin1String("/wayland-graphics-integration-client"), Qt::CaseInsensitive)) QStringList QWaylandClientBufferIntegrationFactory::keys() { - return loader->keyMap().values(); + return qwcbifLoader->keyMap().values(); } QWaylandClientBufferIntegration *QWaylandClientBufferIntegrationFactory::create(const QString &name, const QStringList &args) { - return qLoadPlugin(loader(), name, args); + return qLoadPlugin(qwcbifLoader(), name, args); } } diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationfactory.cpp b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationfactory.cpp index a8b0c1d87a3..e30bb4dc0ca 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationfactory.cpp +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationfactory.cpp @@ -12,17 +12,17 @@ QT_BEGIN_NAMESPACE namespace QtWaylandClient { -Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader, +Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, qwsbifLoader, (QWaylandServerBufferIntegrationFactoryInterface_iid, QLatin1String("/wayland-graphics-integration-client"), Qt::CaseInsensitive)) QStringList QWaylandServerBufferIntegrationFactory::keys() { - return loader->keyMap().values(); + return qwsbifLoader->keyMap().values(); } QWaylandServerBufferIntegration *QWaylandServerBufferIntegrationFactory::create(const QString &name, const QStringList &args) { - return qLoadPlugin(loader(), name, args); + return qLoadPlugin(qwsbifLoader(), name, args); } } diff --git a/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationfactory.cpp b/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationfactory.cpp index d53a91f059f..1c8eb213d14 100644 --- a/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationfactory.cpp +++ b/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationfactory.cpp @@ -12,17 +12,17 @@ QT_BEGIN_NAMESPACE namespace QtWaylandClient { -Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader, +Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, qwidfiLoader, (QWaylandInputDeviceIntegrationFactoryInterface_iid, QLatin1String("/wayland-inputdevice-integration"), Qt::CaseInsensitive)) QStringList QWaylandInputDeviceIntegrationFactory::keys() { - return loader->keyMap().values(); + return qwidfiLoader->keyMap().values(); } QWaylandInputDeviceIntegration *QWaylandInputDeviceIntegrationFactory::create(const QString &name, const QStringList &args) { - return qLoadPlugin(loader(), name, args); + return qLoadPlugin(qwidfiLoader(), name, args); } } diff --git a/src/plugins/platforms/wayland/qwaylanddecorationfactory.cpp b/src/plugins/platforms/wayland/qwaylanddecorationfactory.cpp index e2f1af2f12e..b716a4aeea5 100644 --- a/src/plugins/platforms/wayland/qwaylanddecorationfactory.cpp +++ b/src/plugins/platforms/wayland/qwaylanddecorationfactory.cpp @@ -12,17 +12,17 @@ QT_BEGIN_NAMESPACE namespace QtWaylandClient { -Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader, +Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, qwdfiLoader, (QWaylandDecorationFactoryInterface_iid, QLatin1String("/wayland-decoration-client"), Qt::CaseInsensitive)) QStringList QWaylandDecorationFactory::keys() { - return loader->keyMap().values(); + return qwdfiLoader->keyMap().values(); } QWaylandAbstractDecoration *QWaylandDecorationFactory::create(const QString &name, const QStringList &args) { - return qLoadPlugin(loader(), name, args); + return qLoadPlugin(qwdfiLoader(), name, args); } } diff --git a/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationfactory.cpp b/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationfactory.cpp index c8d29e27c6e..feedb27c516 100644 --- a/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationfactory.cpp +++ b/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationfactory.cpp @@ -12,18 +12,18 @@ QT_BEGIN_NAMESPACE namespace QtWaylandClient { -Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader, +Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, qwsifLoader, (QWaylandShellIntegrationFactoryInterface_iid, QLatin1String("/wayland-shell-integration"), Qt::CaseInsensitive)) QStringList QWaylandShellIntegrationFactory::keys() { - return loader->keyMap().values(); + return qwsifLoader->keyMap().values(); } QWaylandShellIntegration *QWaylandShellIntegrationFactory::create(const QString &name, QWaylandDisplay *display, const QStringList &args) { std::unique_ptr integration; - integration.reset(qLoadPlugin(loader(), name, args)); + integration.reset(qLoadPlugin(qwsifLoader(), name, args)); if (integration && !integration->initialize(display)) return nullptr; From e8a052bc8f265a60d8e788b1ce3384de0f155809 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 1 Feb 2023 14:35:30 +0100 Subject: [PATCH 1148/1507] Disambiguate input method constants They cause clashes in CMake Unity (Jumbo) builds. Pick-to: 6.5 Task-number: QTBUG-109394 Change-Id: I13b33c894818d8aebce763eaf6c961d806961a63 Reviewed-by: Eskil Abrahamsen Blomfeldt Reviewed-by: Amir Masoud Abdol --- src/plugins/platforms/wayland/qwaylandtextinputv1.cpp | 4 ++-- src/plugins/platforms/wayland/qwaylandtextinputv2.cpp | 4 ++-- src/plugins/platforms/wayland/qwaylandtextinputv4.cpp | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandtextinputv1.cpp b/src/plugins/platforms/wayland/qwaylandtextinputv1.cpp index 52a3a13c051..da8bbae71b8 100644 --- a/src/plugins/platforms/wayland/qwaylandtextinputv1.cpp +++ b/src/plugins/platforms/wayland/qwaylandtextinputv1.cpp @@ -26,7 +26,7 @@ namespace QtWaylandClient { namespace { -const Qt::InputMethodQueries supportedQueries = Qt::ImEnabled | +const Qt::InputMethodQueries supportedQueries1 = Qt::ImEnabled | Qt::ImSurroundingText | Qt::ImCursorPosition | Qt::ImAnchorPosition | @@ -92,7 +92,7 @@ void QWaylandTextInputv1::updateState(Qt::InputMethodQueries queries, uint32_t f if (!surface || (surface != m_surface)) return; - queries &= supportedQueries; + queries &= supportedQueries1; // Surrounding text, cursor and anchor positions are transferred together if ((queries & Qt::ImSurroundingText) || (queries & Qt::ImCursorPosition) || (queries & Qt::ImAnchorPosition)) diff --git a/src/plugins/platforms/wayland/qwaylandtextinputv2.cpp b/src/plugins/platforms/wayland/qwaylandtextinputv2.cpp index 4dec15d56ae..a799793e5b8 100644 --- a/src/plugins/platforms/wayland/qwaylandtextinputv2.cpp +++ b/src/plugins/platforms/wayland/qwaylandtextinputv2.cpp @@ -27,7 +27,7 @@ namespace QtWaylandClient { namespace { -const Qt::InputMethodQueries supportedQueries = Qt::ImEnabled | +const Qt::InputMethodQueries supportedQueries2 = Qt::ImEnabled | Qt::ImSurroundingText | Qt::ImCursorPosition | Qt::ImAnchorPosition | @@ -98,7 +98,7 @@ void QWaylandTextInputv2::updateState(Qt::InputMethodQueries queries, uint32_t f if (!surface || (surface != m_surface)) return; - queries &= supportedQueries; + queries &= supportedQueries2; // Surrounding text, cursor and anchor positions are transferred together if ((queries & Qt::ImSurroundingText) || (queries & Qt::ImCursorPosition) || (queries & Qt::ImAnchorPosition)) diff --git a/src/plugins/platforms/wayland/qwaylandtextinputv4.cpp b/src/plugins/platforms/wayland/qwaylandtextinputv4.cpp index 4b3e6eb5f2c..6cf01613f13 100644 --- a/src/plugins/platforms/wayland/qwaylandtextinputv4.cpp +++ b/src/plugins/platforms/wayland/qwaylandtextinputv4.cpp @@ -31,7 +31,7 @@ QWaylandTextInputv4::~QWaylandTextInputv4() } namespace { -const Qt::InputMethodQueries supportedQueries = Qt::ImEnabled | +const Qt::InputMethodQueries supportedQueries4 = Qt::ImEnabled | Qt::ImSurroundingText | Qt::ImCursorPosition | Qt::ImAnchorPosition | @@ -51,7 +51,7 @@ void QWaylandTextInputv4::zwp_text_input_v4_enter(struct ::wl_surface *surface) m_pendingDeleteAfterText = 0; enable(); - updateState(supportedQueries, update_state_enter); + updateState(supportedQueries4, update_state_enter); } void QWaylandTextInputv4::zwp_text_input_v4_leave(struct ::wl_surface *surface) @@ -177,7 +177,7 @@ void QWaylandTextInputv4::zwp_text_input_v4_done(uint32_t serial) QCoreApplication::sendEvent(focusObject, &event); if (serial == m_currentSerial) - updateState(supportedQueries, update_state_full); + updateState(supportedQueries4, update_state_full); } void QWaylandTextInputv4::reset() @@ -225,7 +225,7 @@ void QWaylandTextInputv4::updateState(Qt::InputMethodQueries queries, uint32_t f if (!surface || (surface != m_surface)) return; - queries &= supportedQueries; + queries &= supportedQueries4; bool needsCommit = false; QInputMethodQueryEvent event(queries); From 43a99beccdd0ee18e14a3c2763af2c4d605f92f4 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 8 Feb 2023 15:11:07 +0100 Subject: [PATCH 1149/1507] Exclude sources generated by the scanner from CMake Unity (Jumbo) builds The generated helper function wlRegistryBind() clashes. Pick-to: 6.5 Task-number: QTBUG-109394 Change-Id: Ib814d4576c7565b0413ca16bc0bf5e95caa92c33 Reviewed-by: Eskil Abrahamsen Blomfeldt --- .../qtwaylandscanner/Qt6WaylandClientMacros.cmake | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/tools/qtwaylandscanner/Qt6WaylandClientMacros.cmake b/src/tools/qtwaylandscanner/Qt6WaylandClientMacros.cmake index 9fcec57d230..c7ac085242c 100644 --- a/src/tools/qtwaylandscanner/Qt6WaylandClientMacros.cmake +++ b/src/tools/qtwaylandscanner/Qt6WaylandClientMacros.cmake @@ -86,12 +86,14 @@ function(qt6_generate_wayland_protocol_client_sources target) DEPENDS ${protocol_file} Qt6::qtwaylandscanner ) - target_sources(${target} PRIVATE - "${waylandscanner_header_output}" + set(sources "${waylandscanner_header_output}" "${waylandscanner_code_output}" "${qtwaylandscanner_header_output}" - "${qtwaylandscanner_code_output}" - ) + "${qtwaylandscanner_code_output}") + + target_sources(${target} PRIVATE ${sources}) + + set_source_files_properties(${sources} PROPERTIES SKIP_UNITY_BUILD_INCLUSION ON) endforeach() target_include_directories(${target} PRIVATE ${target_binary_dir}) endfunction() From f9180f6cd6fe2cdb8faf68a268822aa80c19f558 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A5rten=20Nordheim?= Date: Sun, 19 Feb 2023 20:42:35 +0100 Subject: [PATCH 1150/1507] Fix automoc warning regarding include There's no Q_OBJECT etc. in the .cpp file, so likely it was removed, or it was intended to include the moc file for the sake of the header. But moc-file for the header has another naming scheme. Pick-to: 6.5 Change-Id: If1202537a40d746e263fd6e6f67e316a2cdb109e Reviewed-by: David Edmundson --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index f5327c05c6c..a109126d4f7 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -1632,4 +1632,4 @@ void QWaylandWindow::closeChildPopups() { QT_END_NAMESPACE -#include "qwaylandwindow.moc" +#include "moc_qwaylandwindow_p.cpp" From fb79f4c3bdc21ee35d5af820b558230ab1c0b742 Mon Sep 17 00:00:00 2001 From: Michael Weghorn Date: Mon, 20 Feb 2023 14:02:23 +0100 Subject: [PATCH 1151/1507] Convert cursor bitmap to supported format The 1-bit image formats QImage::Format_Mono and QImage::Format_MonoLSB used by cursor bitmaps don't have a corresponding wl_shm_format. Therefore, convert to a supported image format as necessary to make such bitmap cursors work on Wayland as well. Fixes: QTBUG-95434 Change-Id: I402fd870b301ddc01075251b66f2cf7cc1923133 Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/plugins/platforms/wayland/qwaylandcursor.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandcursor.cpp b/src/plugins/platforms/wayland/qwaylandcursor.cpp index 67a846df638..ec17ed21813 100644 --- a/src/plugins/platforms/wayland/qwaylandcursor.cpp +++ b/src/plugins/platforms/wayland/qwaylandcursor.cpp @@ -214,7 +214,21 @@ QWaylandCursor::QWaylandCursor(QWaylandDisplay *display) QSharedPointer QWaylandCursor::cursorBitmapBuffer(QWaylandDisplay *display, const QCursor *cursor) { Q_ASSERT(cursor->shape() == Qt::BitmapCursor); - const QImage &img = cursor->pixmap().toImage(); + QImage img = !cursor->pixmap().isNull() ? cursor->pixmap().toImage() : cursor->bitmap().toImage(); + + // convert to supported format if necessary + if (!display->shm()->formatSupported(img.format())) { + if (cursor->mask().isNull()) { + img.convertTo(QImage::Format_RGB32); + } else { + // preserve mask + img.convertTo(QImage::Format_ARGB32); + QPixmap pixmap = QPixmap::fromImage(img); + pixmap.setMask(cursor->mask()); + img = pixmap.toImage(); + } + } + QSharedPointer buffer(new QWaylandShmBuffer(display, img.size(), img.format())); memcpy(buffer->image()->bits(), img.bits(), size_t(img.sizeInBytes())); return buffer; From cbab88861b629cec0fc683caccdd6c41edec62d0 Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Tue, 21 Feb 2023 18:41:11 +0200 Subject: [PATCH 1152/1507] Client: Stop requesting activation on every focus object change Currently, windows with xdg-toplevel surface role request window activation every time the focus object changes. It conflicts with the compositor's activation and stacking order policies. For example, when a window is minimized, the compositor will start an animation and move focus to the next window. If that window activates itself, it can be raised in the stack and start covering the minimized window, thus making it look as if no animation is played at all. This activation logic was introduced as part of qt-shell activation model in a7bb7210ac76a397b4aec8d8f32d902dc932d855. On the other hand, with the introduction of the xdg-activation-v1 protocol, there is a better way to pass input focus, so drop the qt-shell hack in favor of that. Fixes: QTBUG-111377 Pick-to: 6.5 Change-Id: I8ed19f1be17f49fa9748b1cb5fdd0070791d2ecd Reviewed-by: Eskil Abrahamsen Blomfeldt --- .../platforms/wayland/qwaylandintegration.cpp | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandintegration.cpp b/src/plugins/platforms/wayland/qwaylandintegration.cpp index 9ee3811806f..13bacc9be72 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandintegration.cpp @@ -88,19 +88,6 @@ QWaylandIntegration::QWaylandIntegration() QWaylandWindow::fixedToplevelPositions = !qEnvironmentVariableIsSet("QT_WAYLAND_DISABLE_FIXED_POSITIONS"); - - // ### Not ideal... - // We don't want to use QPlatformWindow::requestActivate here, since that gives a warning - // for most shells. Also, we don't want to put this into the specific shells that can use - // it, since we want to support more than one shell in one client. - // In addition, this will send a new requestActivate when the focus object changes, even if - // the focus window stays the same. - QObject::connect(qApp, &QGuiApplication::focusObjectChanged, qApp, [](){ - QWindow *fw = QGuiApplication::focusWindow(); - auto *w = fw ? static_cast(fw->handle()) : nullptr; - if (w && w->shellSurface()) - w->shellSurface()->requestActivate(); - }); } QWaylandIntegration::~QWaylandIntegration() From ba604ed7863b6838e3871557e93871c7d5b03472 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Fri, 24 Feb 2023 09:07:40 +0400 Subject: [PATCH 1153/1507] Fix build on CentOS 7 Have the following errors while attempting to build qtwayland v6.5.0-beta3: /usr/src/Libraries/qt_6.5.0/qtwayland/src/client/qwaylandshmbackingstore.cpp:48:19: error: 'F_ADD_SEALS' was not declared in this scope 48 | fcntl(fd, F_ADD_SEALS, F_SEAL_SHRINK | F_SEAL_SEAL); | ^~~~~~~~~~~ /usr/src/Libraries/qt_6.5.0/qtwayland/src/client/qwaylandshmbackingstore.cpp:48:32: error: 'F_SEAL_SHRINK' was not declared in this scope 48 | fcntl(fd, F_ADD_SEALS, F_SEAL_SHRINK | F_SEAL_SEAL); | ^~~~~~~~~~~~~ /usr/src/Libraries/qt_6.5.0/qtwayland/src/client/qwaylandshmbackingstore.cpp:48:48: error: 'F_SEAL_SEAL' was not declared in this scope 48 | fcntl(fd, F_ADD_SEALS, F_SEAL_SHRINK | F_SEAL_SEAL); | ^~~~~~~~~~~ Pick-to: 6.5 Change-Id: I4b9b3a13ac47483594f454ba36dc5d720cb592a5 Reviewed-by: Vlad Zahorodnii Reviewed-by: David Edmundson --- .../platforms/wayland/qwaylandshmbackingstore.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp b/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp index 2e0c2491fe4..b9bfc9c81f1 100644 --- a/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp +++ b/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp @@ -29,6 +29,16 @@ # ifndef MFD_ALLOW_SEALING # define MFD_ALLOW_SEALING 0x0002U # endif +// from bits/fcntl-linux.h +# ifndef F_ADD_SEALS +# define F_ADD_SEALS 1033 +# endif +# ifndef F_SEAL_SEAL +# define F_SEAL_SEAL 0x0001 +# endif +# ifndef F_SEAL_SHRINK +# define F_SEAL_SHRINK 0x0002 +# endif #endif QT_BEGIN_NAMESPACE From 6e7de758bebd1082a2c1bf83ae1935a43671c518 Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Fri, 24 Feb 2023 17:40:48 +0100 Subject: [PATCH 1154/1507] client: Force a roundtrip when an XdgOutput is not ready yet Is possible that the server sends a surface_enter before all the information of the XdgOutput have been processed by the client. in this case the associated QScreen doesn't exist yet, causing a QWindow::SetScreen(nullptr), which will fall back to QGuiApplication::primaryScreen(), having the QWindow being assigned the wrong screen Change-Id: I923d5d3a35484deafa6f0572f79c16c27b1f87f0 Reviewed-by: David Edmundson --- .../platforms/wayland/qwaylandwindow.cpp | 2 ++ tests/auto/wayland/shared/coreprotocol.cpp | 2 ++ tests/auto/wayland/shared/coreprotocol.h | 3 ++ .../auto/wayland/xdgoutput/tst_xdgoutput.cpp | 35 +++++++++++++++++++ 4 files changed, 42 insertions(+) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index a109126d4f7..954d6df315b 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -1306,6 +1306,8 @@ void QWaylandWindow::handleScreensChanged() if (newScreen == mLastReportedScreen) return; + if (!newScreen->isPlaceholder() && !newScreen->QPlatformScreen::screen()) + mDisplay->forceRoundTrip(); QWindowSystemInterface::handleWindowScreenChanged(window(), newScreen->QPlatformScreen::screen()); mLastReportedScreen = newScreen; diff --git a/tests/auto/wayland/shared/coreprotocol.cpp b/tests/auto/wayland/shared/coreprotocol.cpp index 4f3d21d8eb9..8e64adadae3 100644 --- a/tests/auto/wayland/shared/coreprotocol.cpp +++ b/tests/auto/wayland/shared/coreprotocol.cpp @@ -226,6 +226,8 @@ void Output::output_bind_resource(QtWaylandServer::wl_output::Resource *resource if (m_version >= WL_OUTPUT_DONE_SINCE_VERSION) wl_output::send_done(resource->handle); + + Q_EMIT outputBound(resource); } // Seat stuff diff --git a/tests/auto/wayland/shared/coreprotocol.h b/tests/auto/wayland/shared/coreprotocol.h index 74f07afbf44..8703fe1d308 100644 --- a/tests/auto/wayland/shared/coreprotocol.h +++ b/tests/auto/wayland/shared/coreprotocol.h @@ -288,6 +288,9 @@ public: OutputData m_data; int m_version = 1; // TODO: remove on libwayland upgrade +Q_SIGNALS: + void outputBound(Resource *resource); + protected: void output_bind_resource(Resource *resource) override; }; diff --git a/tests/auto/wayland/xdgoutput/tst_xdgoutput.cpp b/tests/auto/wayland/xdgoutput/tst_xdgoutput.cpp index b1dcde43e61..ea8719f13d3 100644 --- a/tests/auto/wayland/xdgoutput/tst_xdgoutput.cpp +++ b/tests/auto/wayland/xdgoutput/tst_xdgoutput.cpp @@ -30,6 +30,7 @@ private slots: void primaryScreen(); void overrideGeometry(); void changeGeometry(); + void outputCreateEnterRace(); }; void tst_xdgoutput::cleanup() @@ -109,5 +110,39 @@ void tst_xdgoutput::changeGeometry() exec([=] { remove(output(1)); }); } +void tst_xdgoutput::outputCreateEnterRace() +{ + m_config.autoConfigure = true; + m_config.autoEnter = false; + QRasterWindow window; + QSignalSpy screenChanged(&window, &QWindow::screenChanged); + window.resize(400, 320); + window.show(); + QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial); + exec([=] { xdgToplevel()->surface()->sendEnter(output(0));}); + + QTRY_COMPARE(QGuiApplication::screens().size(), 1); + QScreen *primaryScreen = QGuiApplication::screens().first(); + QCOMPARE(window.screen(), primaryScreen); + + auto *out = exec([=] { + return add(); + }); + + // In Compositor Thread + connect(out, &Output::outputBound, this, [this](QtWaylandServer::wl_output::Resource *resource){ + auto surface = xdgToplevel()->surface(); + surface->sendLeave(output(0)); + surface->QtWaylandServer::wl_surface::send_enter(surface->resource()->handle, resource->handle); + }, Qt::DirectConnection); + + QTRY_COMPARE(QGuiApplication::screens().size(), 2); + QTRY_COMPARE(window.screen(), QGuiApplication::screens()[1]); + + exec([=] { remove(out); }); + m_config.autoConfigure = false; + m_config.autoEnter = true; +} + QCOMPOSITOR_TEST_MAIN(tst_xdgoutput) #include "tst_xdgoutput.moc" From c2cd7eb609fc00a3a3fa2144c683c5df8653ca2e Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Mon, 13 Feb 2023 22:59:52 +0000 Subject: [PATCH 1155/1507] client: Utilize new handleWindowDevicePixelRatioChanged MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Rather than assuming window scale should match the screen scale use an explicit notification system. This fixes issues caused by drift between the two: Task-number: QTBUG-101656 Task-number: QTBUG-93380 Change-Id: I9edb5fd95b8ceeca8073db1f56d81a31bbc9c549 Reviewed-by: Vlad Zahorodnii Reviewed-by: Morten Johan Sørvig --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 954d6df315b..6aa2c6abdb4 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -104,12 +104,17 @@ void QWaylandWindow::initWindow() if (mDisplay->fractionalScaleManager() && qApp->highDpiScaleFactorRoundingPolicy() == Qt::HighDpiScaleFactorRoundingPolicy::PassThrough) { mFractionalScale.reset(new QWaylandFractionalScale(mDisplay->fractionalScaleManager()->get_fractional_scale(mSurface->object()))); - mScale = mFractionalScale->preferredScale(); + if (mScale != mFractionalScale->preferredScale()) { + mScale = mFractionalScale->preferredScale(); + QWindowSystemInterface::handleWindowDevicePixelRatioChanged(window()); + } + connect(mFractionalScale.data(), &QWaylandFractionalScale::preferredScaleChanged, this, [this]() { if (mScale == mFractionalScale->preferredScale()) { return; } mScale = mFractionalScale->preferredScale(); + QWindowSystemInterface::handleWindowDevicePixelRatioChanged(window()); ensureSize(); if (mViewport) updateViewport(); @@ -1326,6 +1331,7 @@ void QWaylandWindow::handleScreensChanged() if (scale != mScale) { mScale = scale; + QWindowSystemInterface::handleWindowDevicePixelRatioChanged(window()); if (mSurface) { if (mViewport) updateViewport(); From 8a6ef48e39ae21108586475a5726f03af5d105a1 Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Mon, 20 Feb 2023 15:26:45 +0200 Subject: [PATCH 1156/1507] Client: Update last input device on tablet tool tap When user uses tablet exclusively to navigate in an app, the last tracked input device will be null. As the result, any popup that requires a popup grab will be backed by an xdg-toplevel rather than an xdg-popup. Fixes: QTBUG-111130 Change-Id: Ib87e732603bbe111c584361357727171825f8c68 Reviewed-by: David Edmundson Reviewed-by: Eskil Abrahamsen Blomfeldt --- .../platforms/wayland/qwaylandinputdevice_p.h | 1 + src/plugins/platforms/wayland/qwaylandtabletv2.cpp | 14 +++++++++++--- src/plugins/platforms/wayland/qwaylandtabletv2_p.h | 6 +++++- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h index 17f01f4904a..115b39a8896 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h +++ b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h @@ -84,6 +84,7 @@ public: uint32_t capabilities() const { return mCaps; } + QWaylandDisplay *display() const { return mQDisplay; } struct ::wl_seat *wl_seat() { return QtWayland::wl_seat::object(); } #if QT_CONFIG(cursor) diff --git a/src/plugins/platforms/wayland/qwaylandtabletv2.cpp b/src/plugins/platforms/wayland/qwaylandtabletv2.cpp index 5e1cc8fe482..a7c3458f71d 100644 --- a/src/plugins/platforms/wayland/qwaylandtabletv2.cpp +++ b/src/plugins/platforms/wayland/qwaylandtabletv2.cpp @@ -27,6 +27,7 @@ QWaylandTabletSeatV2 *QWaylandTabletManagerV2::createTabletSeat(QWaylandInputDev QWaylandTabletSeatV2::QWaylandTabletSeatV2(QWaylandTabletManagerV2 *manager, QWaylandInputDevice *seat) : QtWayland::zwp_tablet_seat_v2(manager->get_tablet_seat(seat->wl_seat())) + , m_seat(seat) { } @@ -53,7 +54,7 @@ void QWaylandTabletSeatV2::zwp_tablet_seat_v2_tablet_added(zwp_tablet_v2 *id) void QWaylandTabletSeatV2::zwp_tablet_seat_v2_tool_added(zwp_tablet_tool_v2 *id) { - auto *tool = new QWaylandTabletToolV2(id); + auto *tool = new QWaylandTabletToolV2(this, id); m_tools.push_back(tool); connect(tool, &QWaylandTabletToolV2::destroyed, this, [this, tool] { m_tools.removeOne(tool); }); } @@ -76,8 +77,9 @@ void QWaylandTabletV2::zwp_tablet_v2_removed() delete this; } -QWaylandTabletToolV2::QWaylandTabletToolV2(::zwp_tablet_tool_v2 *tool) +QWaylandTabletToolV2::QWaylandTabletToolV2(QWaylandTabletSeatV2 *tabletSeat, ::zwp_tablet_tool_v2 *tool) : QtWayland::zwp_tablet_tool_v2(tool) + , m_tabletSeat(tabletSeat) { } @@ -163,8 +165,14 @@ void QWaylandTabletToolV2::zwp_tablet_tool_v2_proximity_out() void QWaylandTabletToolV2::zwp_tablet_tool_v2_down(uint32_t serial) { - Q_UNUSED(serial); m_pending.down = true; + + if (m_pending.proximitySurface) { + if (QWaylandWindow *window = m_pending.proximitySurface->waylandWindow()) { + QWaylandInputDevice *seat = m_tabletSeat->seat(); + seat->display()->setLastInputDevice(seat, serial, window); + } + } } void QWaylandTabletToolV2::zwp_tablet_tool_v2_up() diff --git a/src/plugins/platforms/wayland/qwaylandtabletv2_p.h b/src/plugins/platforms/wayland/qwaylandtabletv2_p.h index 7ddf02e6748..3e0f4372b96 100644 --- a/src/plugins/platforms/wayland/qwaylandtabletv2_p.h +++ b/src/plugins/platforms/wayland/qwaylandtabletv2_p.h @@ -52,12 +52,15 @@ public: explicit QWaylandTabletSeatV2(QWaylandTabletManagerV2 *manager, QWaylandInputDevice *seat); ~QWaylandTabletSeatV2() override; + QWaylandInputDevice *seat() const { return m_seat; } + protected: void zwp_tablet_seat_v2_tablet_added(struct ::zwp_tablet_v2 *id) override; void zwp_tablet_seat_v2_tool_added(struct ::zwp_tablet_tool_v2 *id) override; void zwp_tablet_seat_v2_pad_added(struct ::zwp_tablet_pad_v2 *id) override; private: + QWaylandInputDevice *m_seat; QList m_tablets; QList m_tools; QList m_pads; @@ -81,7 +84,7 @@ class Q_WAYLANDCLIENT_EXPORT QWaylandTabletToolV2 : public QObject, public QtWay { Q_OBJECT public: - explicit QWaylandTabletToolV2(::zwp_tablet_tool_v2 *tool); + QWaylandTabletToolV2(QWaylandTabletSeatV2 *tabletSeat, ::zwp_tablet_tool_v2 *tool); protected: void zwp_tablet_tool_v2_type(uint32_t tool_type) override; @@ -105,6 +108,7 @@ protected: void zwp_tablet_tool_v2_frame(uint32_t time) override; private: + QWaylandTabletSeatV2 *m_tabletSeat; // Static state (sent before done event) QPointingDevice::PointerType m_pointerType = QPointingDevice::PointerType::Unknown; From af8732f3eff392b39e992ac7fb5c72bfc5824c2d Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Thu, 12 Jan 2023 14:49:25 +0200 Subject: [PATCH 1157/1507] Client: Remove flip popup constraints xdg_positioner doesn't have good anchor rect and other needed information so the compositor can properly flip popups. In some windows I see that some popups are flipped in such a way that the popups look "detached" from the parent window. With the information that QtWayland provides so far only slide constraint adjustments can produce somewhat expected results. Although there will be still some issues near screen edges. Pick-to: 6.5 6.4 6.2 5.15 Task-number: QTBUG-87303 Change-Id: I4021f497b78e62651fe606c4be21a387a92edd6c Reviewed-by: Liang Qi --- .../plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp index d339bb56b5f..6a4acf8616d 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp @@ -459,9 +459,7 @@ void QWaylandXdgSurface::setPopup(QWaylandWindow *parent) positioner->set_gravity(QtWayland::xdg_positioner::gravity_bottom_right); positioner->set_size(m_window->windowContentGeometry().width(), m_window->windowContentGeometry().height()); positioner->set_constraint_adjustment(QtWayland::xdg_positioner::constraint_adjustment_slide_x - | QtWayland::xdg_positioner::constraint_adjustment_slide_y - | QtWayland::xdg_positioner::constraint_adjustment_flip_x - | QtWayland::xdg_positioner::constraint_adjustment_flip_y); + | QtWayland::xdg_positioner::constraint_adjustment_slide_y); m_popup = new Popup(this, parent, positioner); positioner->destroy(); From 763229e8c01556b28975e5aef306374f308ae224 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Wed, 22 Feb 2023 22:20:06 +0400 Subject: [PATCH 1158/1507] client: Unify margins handling Currently all the shell integrations except of xdg-shell pass full surface size to resizeFromApplyConfigure. xdg-shell behavior is not even consistent between the first and the consequent calls to resizeFromApplyConfigure. This replaces QWaylandWindow::customMargins with QWaylandWindow::windowContentMargins in order to being able to retrieve set_window_geometry margins separately from the geometry itself and makes xdg-shell passing the geometry consistently as full surface size removing the need in special casing. This also makes QWaylandWindow::clientSizeMargins public so e.g. xdg-shell can compute out absolute position for window content geometry without special casing decorations Pick-to: 6.5 Change-Id: I1b98afc8b5c867ecb7cc586267b13f7ec4b1a88c Reviewed-by: David Edmundson --- .../xdg-shell/qwaylandxdgshell.cpp | 21 +++++------ .../platforms/wayland/qwaylandwindow.cpp | 37 ++++++------------- .../platforms/wayland/qwaylandwindow_p.h | 4 +- 3 files changed, 24 insertions(+), 38 deletions(-) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp index 6a4acf8616d..6303fbc9c24 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp @@ -45,7 +45,7 @@ QWaylandXdgSurface::Toplevel::~Toplevel() void QWaylandXdgSurface::Toplevel::applyConfigure() { if (!(m_applied.states & (Qt::WindowMaximized|Qt::WindowFullScreen))) - m_normalSize = m_xdgSurface->m_window->windowFrameGeometry().size(); + m_normalSize = m_xdgSurface->m_window->windowContentGeometry().size(); if ((m_pending.states & Qt::WindowActive) && !(m_applied.states & Qt::WindowActive) && !m_xdgSurface->m_window->display()->isKeyboardAvailable()) @@ -88,7 +88,7 @@ void QWaylandXdgSurface::Toplevel::applyConfigure() } if (!surfaceSize.isEmpty()) - m_xdgSurface->m_window->resizeFromApplyConfigure(surfaceSize); + m_xdgSurface->m_window->resizeFromApplyConfigure(surfaceSize.grownBy(m_xdgSurface->m_window->windowContentMargins())); m_applied = m_pending; qCDebug(lcQpaWayland) << "Applied pending xdg_toplevel configure event:" << m_applied.size << m_applied.states; @@ -446,18 +446,17 @@ void QWaylandXdgSurface::setPopup(QWaylandWindow *parent) auto positioner = new QtWayland::xdg_positioner(m_shell->create_positioner()); // set_popup expects a position relative to the parent - QPoint topLeftMargins = QPoint(m_window->customMargins().left(), m_window->customMargins().top()); - QPoint parentMargins = QPoint(parent->customMargins().left(), parent->customMargins().top()); - QPoint transientPos = m_window->geometry().topLeft() + topLeftMargins; // this is absolute - transientPos -= parent->geometry().topLeft() + parentMargins; - if (parent->decoration()) { - transientPos.setX(transientPos.x() + parent->decoration()->margins(QWaylandAbstractDecoration::ShadowsExcluded).left()); - transientPos.setY(transientPos.y() + parent->decoration()->margins(QWaylandAbstractDecoration::ShadowsExcluded).top()); - } + QRect windowGeometry = m_window->windowContentGeometry(); + QMargins windowMargins = m_window->windowContentMargins() - m_window->clientSideMargins(); + QMargins parentMargins = parent->windowContentMargins() - parent->clientSideMargins(); + QPoint transientPos = m_window->geometry().topLeft(); // this is absolute + transientPos += QPoint(windowMargins.left(), windowMargins.top()); + transientPos -= parent->geometry().topLeft(); + transientPos -= QPoint(parentMargins.left(), parentMargins.top()); positioner->set_anchor_rect(transientPos.x(), transientPos.y(), 1, 1); positioner->set_anchor(QtWayland::xdg_positioner::anchor_top_left); positioner->set_gravity(QtWayland::xdg_positioner::gravity_bottom_right); - positioner->set_size(m_window->windowContentGeometry().width(), m_window->windowContentGeometry().height()); + positioner->set_size(windowGeometry.width(), windowGeometry.height()); positioner->set_constraint_adjustment(QtWayland::xdg_positioner::constraint_adjustment_slide_x | QtWayland::xdg_positioner::constraint_adjustment_slide_y); m_popup = new Popup(this, parent, positioner); diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 6aa2c6abdb4..a77cce5ae8c 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -460,20 +460,6 @@ void QWaylandWindow::repositionFromApplyConfigure(const QPoint &globalPosition) void QWaylandWindow::resizeFromApplyConfigure(const QSize &sizeWithMargins, const QPoint &offset) { QMargins margins = clientSideMargins(); - - // Exclude shadows from margins once they are excluded from window geometry - // 1) First resizeFromApplyConfigure() call will have sizeWithMargins equal to surfaceSize() - // which has full margins (shadows included). - // 2) Following resizeFromApplyConfigure() calls should have sizeWithMargins equal to - // windowContentGeometry() which excludes shadows, therefore in this case we have to - // exclude them too in order not to accidentally apply smaller size to the window. - if (sizeWithMargins != surfaceSize()) { - if (mWindowDecorationEnabled) - margins = mWindowDecoration->margins(QWaylandAbstractDecoration::ShadowsExcluded); - if (!mCustomMargins.isNull()) - margins -= mCustomMargins; - } - int widthWithoutMargins = qMax(sizeWithMargins.width() - (margins.left() + margins.right()), 1); int heightWithoutMargins = qMax(sizeWithMargins.height() - (margins.top() + margins.bottom()), 1); QRect geometry(windowGeometry().topLeft(), QSize(widthWithoutMargins, heightWithoutMargins)); @@ -808,11 +794,6 @@ QMargins QWaylandWindow::clientSideMargins() const return mWindowDecorationEnabled ? mWindowDecoration->margins() : QMargins{}; } -QMargins QWaylandWindow::customMargins() const -{ - return mCustomMargins; -} - void QWaylandWindow::setCustomMargins(const QMargins &margins) { const QMargins oldMargins = mCustomMargins; mCustomMargins = margins; @@ -827,11 +808,7 @@ QSize QWaylandWindow::surfaceSize() const return geometry().marginsAdded(clientSideMargins()).size(); } -/*! - * Window geometry as defined by the xdg-shell spec (in wl_surface coordinates) - * topLeft is where the shadow stops and the decorations border start. - */ -QRect QWaylandWindow::windowContentGeometry() const +QMargins QWaylandWindow::windowContentMargins() const { QMargins shadowMargins; @@ -841,7 +818,17 @@ QRect QWaylandWindow::windowContentGeometry() const if (!mCustomMargins.isNull()) shadowMargins += mCustomMargins; - return QRect(QPoint(shadowMargins.left(), shadowMargins.top()), surfaceSize().shrunkBy(shadowMargins)); + return shadowMargins; +} + +/*! + * Window geometry as defined by the xdg-shell spec (in wl_surface coordinates) + * topLeft is where the shadow stops and the decorations border start. + */ +QRect QWaylandWindow::windowContentGeometry() const +{ + const QMargins margins = windowContentMargins(); + return QRect(QPoint(margins.left(), margins.top()), surfaceSize().shrunkBy(margins)); } /*! diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index 185de69a96a..22b42a9a0e3 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -118,9 +118,10 @@ public: bool waitForFrameSync(int timeout); QMargins frameMargins() const override; - QMargins customMargins() const; + QMargins clientSideMargins() const; void setCustomMargins(const QMargins &margins) override; QSize surfaceSize() const; + QMargins windowContentMargins() const; QRect windowContentGeometry() const; QPointF mapFromWlSurface(const QPointF &surfacePosition) const; @@ -239,7 +240,6 @@ protected: virtual void doHandleFrameCallback(); virtual QRect defaultGeometry() const; void sendExposeEvent(const QRect &rect); - QMargins clientSideMargins() const; QWaylandDisplay *mDisplay = nullptr; From 621a2d94aee3bd0d93bb26090ebf28a4c9ed1a82 Mon Sep 17 00:00:00 2001 From: David Redondo Date: Thu, 23 Feb 2023 10:21:53 +0100 Subject: [PATCH 1159/1507] Port fullscreenshell integration to QWaylandShellIntegrationTemplate Change-Id: Ia3271a312d857d7e864444ad77e8e18a4a3858bf Reviewed-by: David Edmundson --- .../qwaylandfullscreenshellv1integration.cpp | 22 +++++++------------ .../qwaylandfullscreenshellv1integration.h | 10 ++++----- 2 files changed, 13 insertions(+), 19 deletions(-) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/fullscreen-shell-v1/qwaylandfullscreenshellv1integration.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/fullscreen-shell-v1/qwaylandfullscreenshellv1integration.cpp index ddac7d29505..7dcdd6e5997 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/fullscreen-shell-v1/qwaylandfullscreenshellv1integration.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/fullscreen-shell-v1/qwaylandfullscreenshellv1integration.cpp @@ -8,26 +8,20 @@ QT_BEGIN_NAMESPACE namespace QtWaylandClient { -bool QWaylandFullScreenShellV1Integration::initialize(QWaylandDisplay *display) +QWaylandFullScreenShellV1Integration::QWaylandFullScreenShellV1Integration() + : QWaylandShellIntegrationTemplate(1) { - for (const QWaylandDisplay::RegistryGlobal &global : display->globals()) { - if (global.interface == QLatin1String("zwp_fullscreen_shell_v1") && !m_shell) { - m_shell.reset(new QtWayland::zwp_fullscreen_shell_v1(display->wl_registry(), global.id, global.version)); - break; - } - } +} - if (!m_shell) { - qCDebug(lcQpaWayland) << "Couldn't find global zwp_fullscreen_shell_v1 for fullscreen-shell"; - return false; - } - - return true; +QWaylandFullScreenShellV1Integration::~QWaylandFullScreenShellV1Integration() +{ + if (isActive()) + release(); } QWaylandShellSurface *QWaylandFullScreenShellV1Integration::createShellSurface(QWaylandWindow *window) { - return new QWaylandFullScreenShellV1Surface(m_shell.data(), window); + return new QWaylandFullScreenShellV1Surface(this, window); } } // namespace QtWaylandClient diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/fullscreen-shell-v1/qwaylandfullscreenshellv1integration.h b/src/plugins/platforms/wayland/plugins/shellintegration/fullscreen-shell-v1/qwaylandfullscreenshellv1integration.h index 48cb80c7355..c01af37074a 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/fullscreen-shell-v1/qwaylandfullscreenshellv1integration.h +++ b/src/plugins/platforms/wayland/plugins/shellintegration/fullscreen-shell-v1/qwaylandfullscreenshellv1integration.h @@ -14,14 +14,14 @@ QT_BEGIN_NAMESPACE namespace QtWaylandClient { -class Q_WAYLANDCLIENT_EXPORT QWaylandFullScreenShellV1Integration : public QWaylandShellIntegration +class Q_WAYLANDCLIENT_EXPORT QWaylandFullScreenShellV1Integration + : public QWaylandShellIntegrationTemplate, + public QtWayland::zwp_fullscreen_shell_v1 { public: - bool initialize(QWaylandDisplay *display) override; + QWaylandFullScreenShellV1Integration(); + ~QWaylandFullScreenShellV1Integration() override; QWaylandShellSurface *createShellSurface(QWaylandWindow *window) override; - -private: - QScopedPointer m_shell; }; } // namespace QtWaylandClient From 0badceeb6d36a51b8975796fe92f7e2801af7b0d Mon Sep 17 00:00:00 2001 From: David Redondo Date: Thu, 23 Feb 2023 10:39:01 +0100 Subject: [PATCH 1160/1507] Port wlshell integration to QWaylandShellIntegrationTemplate Change-Id: Ib05a4645f930f41819447f6e1d562753a36e5710 Reviewed-by: David Edmundson --- .../wl-shell/qwaylandwlshellintegration.cpp | 19 ++----------------- .../wl-shell/qwaylandwlshellintegration_p.h | 8 ++++---- 2 files changed, 6 insertions(+), 21 deletions(-) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellintegration.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellintegration.cpp index f0e38a331c4..3a3e8b00b35 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellintegration.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellintegration.cpp @@ -11,31 +11,16 @@ QT_BEGIN_NAMESPACE namespace QtWaylandClient { -bool QWaylandWlShellIntegration::initialize(QWaylandDisplay *display) +QWaylandWlShellIntegration::QWaylandWlShellIntegration() : QWaylandShellIntegrationTemplate(1) { - const auto globals = display->globals(); - for (QWaylandDisplay::RegistryGlobal global : globals) { - if (global.interface == QLatin1String("wl_shell")) { - m_wlShell = new QtWayland::wl_shell(display->wl_registry(), global.id, 1); - break; - } - } - - if (!m_wlShell) { - qCDebug(lcQpaWayland) << "Couldn't find global wl_shell"; - return false; - } - qCWarning(lcQpaWayland) << "\"wl-shell\" is a deprecated shell extension, prefer using" << "\"xdg-shell\" if supported by the compositor" << "by setting the environment variable QT_WAYLAND_SHELL_INTEGRATION"; - - return true; } QWaylandShellSurface *QWaylandWlShellIntegration::createShellSurface(QWaylandWindow *window) { - return new QWaylandWlShellSurface(m_wlShell->get_shell_surface(window->wlSurface()), window); + return new QWaylandWlShellSurface(get_shell_surface(window->wlSurface()), window); } void *QWaylandWlShellIntegration::nativeResourceForWindow(const QByteArray &resource, QWindow *window) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellintegration_p.h b/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellintegration_p.h index 51dac4bcd27..fd3cb87f0e8 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellintegration_p.h +++ b/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellintegration_p.h @@ -23,16 +23,16 @@ QT_BEGIN_NAMESPACE namespace QtWaylandClient { -class Q_WAYLANDCLIENT_EXPORT QWaylandWlShellIntegration : public QWaylandShellIntegration +class Q_WAYLANDCLIENT_EXPORT QWaylandWlShellIntegration + : public QWaylandShellIntegrationTemplate, + public QtWayland::wl_shell { public: - QWaylandWlShellIntegration() {} - bool initialize(QWaylandDisplay *) override; + QWaylandWlShellIntegration(); QWaylandShellSurface *createShellSurface(QWaylandWindow *window) override; void *nativeResourceForWindow(const QByteArray &resource, QWindow *window) override; private: - QtWayland::wl_shell *m_wlShell = nullptr; }; } From cb71234bc9964c9e3d12bcc4534d21b6be197a60 Mon Sep 17 00:00:00 2001 From: David Redondo Date: Wed, 22 Feb 2023 14:33:22 +0100 Subject: [PATCH 1161/1507] Port xdg shell plugin towards QWaylandShellIntegrationTemplate Ports manual initialization to the automatic handling of the template. For now the integration QWaylandXdgShellIntegration and QWaylandXdgShell are still separate but could be merged in a future step. Change-Id: I73bb9674e62f24f403349784e1b1e52a39aa8e9f Reviewed-by: Qt CI Bot Reviewed-by: David Edmundson --- .../xdg-shell/qwaylandxdgshell.cpp | 18 ++------- .../xdg-shell/qwaylandxdgshell_p.h | 10 ++--- .../xdg-shell/qwaylandxdgshellintegration.cpp | 39 ++++++++++++------- .../xdg-shell/qwaylandxdgshellintegration_p.h | 19 ++++++--- 4 files changed, 47 insertions(+), 39 deletions(-) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp index 6303fbc9c24..ee53341acb3 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp @@ -444,7 +444,7 @@ void QWaylandXdgSurface::setPopup(QWaylandWindow *parent) { Q_ASSERT(!m_toplevel && !m_popup); - auto positioner = new QtWayland::xdg_positioner(m_shell->create_positioner()); + auto positioner = new QtWayland::xdg_positioner(m_shell->m_xdgWmBase->create_positioner()); // set_popup expects a position relative to the parent QRect windowGeometry = m_window->windowContentGeometry(); QMargins windowMargins = m_window->windowContentMargins() - m_window->clientSideMargins(); @@ -615,9 +615,8 @@ QString QWaylandXdgSurface::externWindowHandle() return m_toplevel->m_exported->handle(); } -QWaylandXdgShell::QWaylandXdgShell(QWaylandDisplay *display, uint32_t id, uint32_t availableVersion) - : QtWayland::xdg_wm_base(display->wl_registry(), id, qMin(availableVersion, 4u)) - , m_display(display) +QWaylandXdgShell::QWaylandXdgShell(QWaylandDisplay *display, QtWayland::xdg_wm_base *xdgWmBase) + : m_display(display), m_xdgWmBase(xdgWmBase) { display->addRegistryListener(&QWaylandXdgShell::handleRegistryGlobal, this); } @@ -625,17 +624,6 @@ QWaylandXdgShell::QWaylandXdgShell(QWaylandDisplay *display, uint32_t id, uint32 QWaylandXdgShell::~QWaylandXdgShell() { m_display->removeListener(&QWaylandXdgShell::handleRegistryGlobal, this); - destroy(); -} - -QWaylandXdgSurface *QWaylandXdgShell::getXdgSurface(QWaylandWindow *window) -{ - return new QWaylandXdgSurface(this, get_xdg_surface(window->wlSurface()), window); -} - -void QWaylandXdgShell::xdg_wm_base_ping(uint32_t serial) -{ - pong(serial); } void QWaylandXdgShell::handleRegistryGlobal(void *data, wl_registry *registry, uint id, diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h index 58860269780..bf51888eda7 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h @@ -143,11 +143,11 @@ private: friend class QWaylandXdgShell; }; -class Q_WAYLANDCLIENT_EXPORT QWaylandXdgShell : public QtWayland::xdg_wm_base +class Q_WAYLANDCLIENT_EXPORT QWaylandXdgShell { public: - QWaylandXdgShell(QWaylandDisplay *display, uint32_t id, uint32_t availableVersion); - ~QWaylandXdgShell() override; + QWaylandXdgShell(QWaylandDisplay *display, QtWayland::xdg_wm_base *xdg_wm_base); + ~QWaylandXdgShell(); QWaylandDisplay *display() const { return m_display; } @@ -156,14 +156,12 @@ public: QWaylandXdgExporterV2 *exporter() const { return m_xdgExporter.data(); } QWaylandXdgSurface *getXdgSurface(QWaylandWindow *window); -protected: - void xdg_wm_base_ping(uint32_t serial) override; - private: static void handleRegistryGlobal(void *data, ::wl_registry *registry, uint id, const QString &interface, uint version); QWaylandDisplay *m_display = nullptr; + QtWayland::xdg_wm_base *m_xdgWmBase = nullptr; QScopedPointer m_xdgDecorationManager; QScopedPointer m_xdgActivation; QScopedPointer m_xdgExporter; diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshellintegration.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshellintegration.cpp index 8d648b6285d..c7b757dd4ca 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshellintegration.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshellintegration.cpp @@ -1,6 +1,7 @@ // Copyright (C) 2017 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +#include "qwaylandxdgshell_p.h" #include "qwaylandxdgshellintegration_p.h" #include "qwaylandxdgdecorationv1_p.h" @@ -11,26 +12,38 @@ QT_BEGIN_NAMESPACE namespace QtWaylandClient { +QWaylandXdgShellIntegration::QWaylandXdgShellIntegration() : QWaylandShellIntegrationTemplate(4) +{ + connect(this, &QWaylandShellIntegrationTemplate::activeChanged, this, [this] { + if (isActive()) { + mXdgShell.reset(new QWaylandXdgShell(mDisplay, this)); + } else { + mXdgShell.reset(nullptr); + destroy(); + } + }); +} + +QWaylandXdgShellIntegration::~QWaylandXdgShellIntegration() +{ + if (isActive()) + destroy(); +} + bool QWaylandXdgShellIntegration::initialize(QWaylandDisplay *display) { - for (QWaylandDisplay::RegistryGlobal global : display->globals()) { - if (global.interface == QLatin1String("xdg_wm_base")) { - m_xdgShell.reset(new QWaylandXdgShell(display, global.id, global.version)); - break; - } - } + mDisplay = display; + return QWaylandShellIntegrationTemplate::initialize(display); +} - if (!m_xdgShell) { - qCDebug(lcQpaWayland) << "Couldn't find global xdg_wm_base for xdg-shell stable"; - return false; - } - - return true; +void QWaylandXdgShellIntegration::xdg_wm_base_ping(uint32_t serial) +{ + pong(serial); } QWaylandShellSurface *QWaylandXdgShellIntegration::createShellSurface(QWaylandWindow *window) { - return m_xdgShell->getXdgSurface(window); + return new QWaylandXdgSurface(mXdgShell.get(), get_xdg_surface(window->wlSurface()), window); } void *QWaylandXdgShellIntegration::nativeResourceForWindow(const QByteArray &resource, QWindow *window) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshellintegration_p.h b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshellintegration_p.h index 2caa3a6e873..b7627d80462 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshellintegration_p.h +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshellintegration_p.h @@ -15,7 +15,7 @@ // We mean it. // -#include "qwaylandxdgshell_p.h" +#include "qwayland-xdg-shell.h" #include @@ -23,16 +23,25 @@ QT_BEGIN_NAMESPACE namespace QtWaylandClient { -class Q_WAYLANDCLIENT_EXPORT QWaylandXdgShellIntegration : public QWaylandShellIntegration +class QWaylandXdgShell; + +class Q_WAYLANDCLIENT_EXPORT QWaylandXdgShellIntegration + : public QWaylandShellIntegrationTemplate, + public QtWayland::xdg_wm_base { public: - QWaylandXdgShellIntegration() {} - bool initialize(QWaylandDisplay *display) override; + QWaylandXdgShellIntegration(); + ~QWaylandXdgShellIntegration() override; QWaylandShellSurface *createShellSurface(QWaylandWindow *window) override; void *nativeResourceForWindow(const QByteArray &resource, QWindow *window) override; + bool initialize(QWaylandDisplay *display) override; + +protected: + void xdg_wm_base_ping(uint32_t serial) override; private: - QScopedPointer m_xdgShell; + QWaylandDisplay *mDisplay; + QScopedPointer mXdgShell; }; } From be98a978e003272f2892e928abe7dcfdb23fd914 Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Wed, 7 Dec 2022 11:50:37 +0000 Subject: [PATCH 1162/1507] Client: Allow runtime disabling of interfaces for debugging purposes When running it's useful to confirm things work correctly in various configurations. In particular testing how things behave without server side decorations is important on all changes. It's easier to make the client pretend the compositor didn't send anything than change the compositor every time. This also potentially makes unit tests simpler than having to change the mock compositor setup. Change-Id: Ide897d918384389009aa38c7030d5ac30fc837a6 Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/plugins/platforms/wayland/qwaylanddisplay.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index 2bf09331c74..46c85a6a3f2 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -492,6 +492,11 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin { struct ::wl_registry *registry = object(); + static QByteArrayList interfaceBlacklist = qgetenv("QT_WAYLAND_DISABLED_INTERFACES").split(','); + if (interfaceBlacklist.contains(interface)) { + return; + } + if (interface == QLatin1String(QtWayland::wl_output::interface()->name)) { mWaitingScreens << mWaylandIntegration->createPlatformScreen(this, version, id); } else if (interface == QLatin1String(QtWayland::wl_compositor::interface()->name)) { From a20ee861d673bb3475a9b5c94743c448a9ac8d52 Mon Sep 17 00:00:00 2001 From: Aleix Pol Date: Mon, 6 Mar 2023 01:11:45 +0100 Subject: [PATCH 1163/1507] client: Do not cast placeholder screens to QWaylandScreen It's wrong to C-cast an object to a class that isn't theirs. Check if it is a placeholder first. Pick-to: 5.15 6.2 6.5 Change-Id: I45d3c423422ae6638a033fb0f4cfefc7cd4460f0 Reviewed-by: Eskil Abrahamsen Blomfeldt Reviewed-by: David Edmundson --- src/plugins/platforms/wayland/qwaylandnativeinterface.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp b/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp index 2c1cdb98b09..65272f3c228 100644 --- a/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp +++ b/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp @@ -159,7 +159,7 @@ void *QWaylandNativeInterface::nativeResourceForScreen(const QByteArray &resourc { QByteArray lowerCaseResource = resourceString.toLower(); - if (lowerCaseResource == "output") + if (lowerCaseResource == "output" && !screen->handle()->isPlaceholder()) return ((QWaylandScreen *) screen->handle())->output(); return nullptr; From 0042b8040f3d3a3a531810bed8180e0fcd4d4f96 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Mon, 6 Mar 2023 14:37:17 +0100 Subject: [PATCH 1164/1507] Compile with -no-opengl A few of the tests were including Qt OpenGL for no good reason, and the link step should be optional. Pick-to: 6.2 6.5 6.5.0 Fixes: QTBUG-110420 Change-Id: Icb78c15e49070c6938bf9bb75abfed677af6785b Reviewed-by: Inho Lee Reviewed-by: David Edmundson --- tests/auto/wayland/datadevicev1/tst_datadevicev1.cpp | 1 - .../wayland/primaryselectionv1/tst_primaryselectionv1.cpp | 1 - tests/auto/wayland/scaling/tst_scaling.cpp | 1 - tests/auto/wayland/seat/tst_seat.cpp | 1 - tests/auto/wayland/seatv4/tst_seatv4.cpp | 1 - tests/auto/wayland/seatv7/tst_seatv7.cpp | 1 - tests/auto/wayland/shared/CMakeLists.txt | 6 +++++- tests/auto/wayland/xdgdecorationv1/tst_xdgdecorationv1.cpp | 1 - tests/auto/wayland/xdgoutput/tst_xdgoutput.cpp | 1 - tests/auto/wayland/xdgshell/tst_xdgshell.cpp | 1 - 10 files changed, 5 insertions(+), 10 deletions(-) diff --git a/tests/auto/wayland/datadevicev1/tst_datadevicev1.cpp b/tests/auto/wayland/datadevicev1/tst_datadevicev1.cpp index d78255e9fc8..cdbf7379a2a 100644 --- a/tests/auto/wayland/datadevicev1/tst_datadevicev1.cpp +++ b/tests/auto/wayland/datadevicev1/tst_datadevicev1.cpp @@ -3,7 +3,6 @@ #include "mockcompositor.h" -#include #include #include #include diff --git a/tests/auto/wayland/primaryselectionv1/tst_primaryselectionv1.cpp b/tests/auto/wayland/primaryselectionv1/tst_primaryselectionv1.cpp index 558e4676b3e..b9e12873052 100644 --- a/tests/auto/wayland/primaryselectionv1/tst_primaryselectionv1.cpp +++ b/tests/auto/wayland/primaryselectionv1/tst_primaryselectionv1.cpp @@ -5,7 +5,6 @@ #include -#include #include #include #include diff --git a/tests/auto/wayland/scaling/tst_scaling.cpp b/tests/auto/wayland/scaling/tst_scaling.cpp index bceea92d49b..f94c37cc99b 100644 --- a/tests/auto/wayland/scaling/tst_scaling.cpp +++ b/tests/auto/wayland/scaling/tst_scaling.cpp @@ -2,7 +2,6 @@ // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "mockcompositor.h" -#include #include #include #include diff --git a/tests/auto/wayland/seat/tst_seat.cpp b/tests/auto/wayland/seat/tst_seat.cpp index 8a9375d6872..9db10d552db 100644 --- a/tests/auto/wayland/seat/tst_seat.cpp +++ b/tests/auto/wayland/seat/tst_seat.cpp @@ -2,7 +2,6 @@ // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #include "mockcompositor.h" -#include #include #include diff --git a/tests/auto/wayland/seatv4/tst_seatv4.cpp b/tests/auto/wayland/seatv4/tst_seatv4.cpp index 314569a1c49..8d78c2b3643 100644 --- a/tests/auto/wayland/seatv4/tst_seatv4.cpp +++ b/tests/auto/wayland/seatv4/tst_seatv4.cpp @@ -3,7 +3,6 @@ #include "mockcompositor.h" -#include #include #if QT_CONFIG(cursor) #include diff --git a/tests/auto/wayland/seatv7/tst_seatv7.cpp b/tests/auto/wayland/seatv7/tst_seatv7.cpp index c341ec96740..e423456c5b5 100644 --- a/tests/auto/wayland/seatv7/tst_seatv7.cpp +++ b/tests/auto/wayland/seatv7/tst_seatv7.cpp @@ -2,7 +2,6 @@ // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #include "mockcompositor.h" -#include #include #include diff --git a/tests/auto/wayland/shared/CMakeLists.txt b/tests/auto/wayland/shared/CMakeLists.txt index 8112ffb7120..a1f150c2245 100644 --- a/tests/auto/wayland/shared/CMakeLists.txt +++ b/tests/auto/wayland/shared/CMakeLists.txt @@ -53,10 +53,14 @@ qt6_generate_wayland_protocol_server_sources(SharedClientTest ${PROJECT_SOURCE_DIR}/src/3rdparty/protocol/xdg-shell.xml ) +if(QT_FEATURE_opengl) + set(optional_libraries Qt::OpenGL) +endif() + target_link_libraries(SharedClientTest PUBLIC Qt::Gui - Qt::OpenGL + ${optional_libraries} Qt::WaylandClientPrivate Wayland::Server Threads::Threads # special case diff --git a/tests/auto/wayland/xdgdecorationv1/tst_xdgdecorationv1.cpp b/tests/auto/wayland/xdgdecorationv1/tst_xdgdecorationv1.cpp index 8adc9dd0e7d..ba91514d20b 100644 --- a/tests/auto/wayland/xdgdecorationv1/tst_xdgdecorationv1.cpp +++ b/tests/auto/wayland/xdgdecorationv1/tst_xdgdecorationv1.cpp @@ -5,7 +5,6 @@ #include -#include #include #include #include diff --git a/tests/auto/wayland/xdgoutput/tst_xdgoutput.cpp b/tests/auto/wayland/xdgoutput/tst_xdgoutput.cpp index ea8719f13d3..bb104dd59c9 100644 --- a/tests/auto/wayland/xdgoutput/tst_xdgoutput.cpp +++ b/tests/auto/wayland/xdgoutput/tst_xdgoutput.cpp @@ -4,7 +4,6 @@ #include "xdgoutputv1.h" #include "mockcompositor.h" -#include #include #include diff --git a/tests/auto/wayland/xdgshell/tst_xdgshell.cpp b/tests/auto/wayland/xdgshell/tst_xdgshell.cpp index efaa6a8f160..101baecc714 100644 --- a/tests/auto/wayland/xdgshell/tst_xdgshell.cpp +++ b/tests/auto/wayland/xdgshell/tst_xdgshell.cpp @@ -2,7 +2,6 @@ // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #include "mockcompositor.h" -#include #include #include #include From 358655d8db5958b1797bfd61e0850d2b7014a982 Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Fri, 28 Jan 2022 16:24:32 +0000 Subject: [PATCH 1165/1507] Introduce path for surviving compositor restarts This patch introduces an optional mechanism for clients to survive a crash and reconnect seemingly seamlessly. In the event of a disconnect from the compositor socket we simply try to reconnect again and replay any data needed so that we maintain a consistent state to where we left off. From an application point-of-view any open popups will be dismissed and we we potentially get a new framecallback, but it will be almost entirely transparent. Users of custom QWaylandClientExtensions will be notified via the activeChanged signal and rebuild as though the compositor had withdrawn and re-announced the global. OpenGL contexts will be marked as invalid, and handled the same way as a GPU reset. On the next frame RHI will notice these are invalid and recreate them, only now against a new wl_display and new EGLDisplay. Users of low level EGL/native objects might be affected, but the alternative at this point is being closed anyway. The entire codepath is only activated via an environment variable. Change-Id: I6c4acc885540e14cead7640794df86dd974fef4f Reviewed-by: Qt CI Bot Reviewed-by: Eskil Abrahamsen Blomfeldt --- .../platforms/wayland/qwaylanddisplay.cpp | 161 ++++++++++++-- .../platforms/wayland/qwaylanddisplay_p.h | 5 + .../platforms/wayland/qwaylandintegration.cpp | 11 + .../platforms/wayland/qwaylandintegration_p.h | 1 + .../wayland/qwaylandshmbackingstore.cpp | 13 +- .../platforms/wayland/qwaylandwindow.cpp | 20 ++ .../platforms/wayland/qwaylandwindow_p.h | 5 +- tests/auto/wayland/CMakeLists.txt | 1 + tests/auto/wayland/reconnect/CMakeLists.txt | 11 + .../auto/wayland/reconnect/tst_reconnect.cpp | 210 ++++++++++++++++++ tests/auto/wayland/reconnect/wl-socket.c | 166 ++++++++++++++ tests/auto/wayland/reconnect/wl-socket.h | 34 +++ tests/auto/wayland/shared/corecompositor.cpp | 12 +- tests/auto/wayland/shared/corecompositor.h | 4 +- tests/auto/wayland/shared/mockcompositor.cpp | 4 +- tests/auto/wayland/shared/mockcompositor.h | 2 +- 16 files changed, 631 insertions(+), 29 deletions(-) create mode 100644 tests/auto/wayland/reconnect/CMakeLists.txt create mode 100644 tests/auto/wayland/reconnect/tst_reconnect.cpp create mode 100644 tests/auto/wayland/reconnect/wl-socket.c create mode 100644 tests/auto/wayland/reconnect/wl-socket.h diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index 46c85a6a3f2..5c3431a05ae 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -65,18 +65,6 @@ #include // for std::tie -static void checkWaylandError(struct wl_display *display) -{ - int ecode = wl_display_get_error(display); - if ((ecode == EPIPE || ecode == ECONNRESET)) { - // special case this to provide a nicer error - qWarning("The Wayland connection broke. Did the Wayland compositor die?"); - } else { - qWarning("The Wayland connection experienced a fatal error: %s", strerror(ecode)); - } - _exit(1); -} - QT_BEGIN_NAMESPACE namespace QtWaylandClient { @@ -114,9 +102,13 @@ public: * not only the one issued from event thread's waitForReading(), which means functions * called from dispatch_pending() can safely spin an event loop. */ + if (m_quitting) + return; + for (;;) { if (dispatchQueuePending() < 0) { - checkWaylandError(m_wldisplay); + Q_EMIT waylandError(); + m_quitting = true; return; } @@ -154,6 +146,7 @@ public: Q_SIGNALS: void needReadAndDispatch(); + void waylandError(); protected: void run() override @@ -328,11 +321,17 @@ QWaylandDisplay::QWaylandDisplay(QWaylandIntegration *waylandIntegration) qRegisterMetaType("uint32_t"); mDisplay = wl_display_connect(nullptr); - if (!mDisplay) { + if (mDisplay) { + setupConnection(); + } else { qErrnoWarning(errno, "Failed to create wl_display"); - return; } + mWaylandTryReconnect = qEnvironmentVariableIsSet("QT_WAYLAND_RECONNECT"); +} + +void QWaylandDisplay::setupConnection() +{ struct ::wl_registry *registry = wl_display_get_registry(mDisplay); init(registry); @@ -404,7 +403,110 @@ void QWaylandDisplay::ensureScreen() Q_ASSERT(!QGuiApplication::screens().empty()); } -// Called in main thread, either from queued signal or directly. +void QWaylandDisplay::reconnect() +{ + qCWarning(lcQpaWayland) << "Attempting wayland reconnect"; + m_eventThread->stop(); + m_frameEventQueueThread->stop(); + m_eventThread->wait(); + m_frameEventQueueThread->wait(); + + qDeleteAll(mWaitingScreens); + mWaitingScreens.clear(); + + // mCompositor + mShm.reset(); + mCursorThemes.clear(); + mCursor.reset(); + mDndSelectionHandler.reset(); + mWindowExtension.reset(); + mSubCompositor.reset(); + mTouchExtension.reset(); + mQtKeyExtension.reset(); + mWindowManagerIntegration.reset(); + mTabletManager.reset(); + mPointerGestures.reset(); +#if QT_CONFIG(wayland_client_primary_selection) + mPrimarySelectionManager.reset(); +#endif + mTextInputMethodManager.reset(); + mTextInputManagerv1.reset(); + mTextInputManagerv2.reset(); + mTextInputManagerv4.reset(); + mHardwareIntegration.reset(); + mXdgOutputManager.reset(); + mViewporter.reset(); + mFractionalScaleManager.reset(); + + mWaylandIntegration->reset(); + + qDeleteAll(std::exchange(mInputDevices, {})); + mLastInputDevice = nullptr; + + auto screens = mScreens; + mScreens.clear(); + + for (const RegistryGlobal &global : mGlobals) { + emit globalRemoved(global); + } + mGlobals.clear(); + + mLastInputSerial = 0; + mLastInputWindow.clear(); + mLastKeyboardFocus.clear(); + mActiveWindows.clear(); + + const auto windows = QGuiApplication::allWindows(); + for (auto window : windows) { + if (auto waylandWindow = dynamic_cast(window->handle())) + waylandWindow->closeChildPopups(); + } + // Remove windows that do not need to be recreated and now closed popups + QList recreateWindows; + for (auto window : std::as_const(windows)) { + auto waylandWindow = dynamic_cast((window)->handle()); + if (waylandWindow && waylandWindow->wlSurface()) { + waylandWindow->reset(); + recreateWindows.push_back(waylandWindow); + } + } + + if (mSyncCallback) { + wl_callback_destroy(mSyncCallback); + mSyncCallback = nullptr; + } + + mDisplay = wl_display_connect(nullptr); + if (!mDisplay) + _exit(1); + + setupConnection(); + initialize(); + + if (m_frameEventQueue) + wl_event_queue_destroy(m_frameEventQueue); + initEventThread(); + + emit reconnected(); + + auto needsRecreate = [](QPlatformWindow *window) { + return window && !static_cast(window)->wlSurface(); + }; + auto window = recreateWindows.begin(); + while (!recreateWindows.isEmpty()) { + if (!needsRecreate((*window)->QPlatformWindow::parent()) && !needsRecreate((*window)->transientParent())) { + (*window)->reinit(); + window = recreateWindows.erase(window); + } else { + ++window; + } + if (window == recreateWindows.end()) + window = recreateWindows.begin(); + } + + mWaylandIntegration->reconfigureInputContext(); +} + void QWaylandDisplay::flushRequests() { m_eventThread->readAndDispatchEvents(); @@ -419,6 +521,8 @@ void QWaylandDisplay::initEventThread() new EventThread(mDisplay, /* default queue */ nullptr, EventThread::EmitToDispatch)); connect(m_eventThread.get(), &EventThread::needReadAndDispatch, this, &QWaylandDisplay::flushRequests, Qt::QueuedConnection); + connect(m_eventThread.get(), &EventThread::waylandError, this, + &QWaylandDisplay::checkWaylandError, Qt::QueuedConnection); m_eventThread->start(); // wl_display_disconnect() free this. @@ -428,10 +532,31 @@ void QWaylandDisplay::initEventThread() m_frameEventQueueThread->start(); } +void QWaylandDisplay::checkWaylandError() +{ + int ecode = wl_display_get_error(mDisplay); + if ((ecode == EPIPE || ecode == ECONNRESET)) { + qWarning("The Wayland connection broke. Did the Wayland compositor die?"); + if (mWaylandTryReconnect) { + reconnect(); + return; + } + } else { + qWarning("The Wayland connection experienced a fatal error: %s", strerror(ecode)); + } + _exit(-1); +} + void QWaylandDisplay::blockingReadEvents() { - if (wl_display_dispatch(mDisplay) < 0) - checkWaylandError(mDisplay); + if (wl_display_dispatch(mDisplay) < 0) { + int ecode = wl_display_get_error(mDisplay); + if ((ecode == EPIPE || ecode == ECONNRESET)) + qWarning("The Wayland connection broke during blocking read event. Did the Wayland compositor die?"); + else + qWarning("The Wayland connection experienced a fatal error during blocking read event: %s", strerror(ecode)); + _exit(-1); + } } void QWaylandDisplay::checkTextInputProtocol() diff --git a/src/plugins/platforms/wayland/qwaylanddisplay_p.h b/src/plugins/platforms/wayland/qwaylanddisplay_p.h index 640f33b8e57..f5c1bcbbd51 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay_p.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay_p.h @@ -200,10 +200,14 @@ public slots: void flushRequests(); signals: + void reconnected(); void globalAdded(const RegistryGlobal &global); void globalRemoved(const RegistryGlobal &global); private: + void checkWaylandError(); + void reconnect(); + void setupConnection(); void handleWaylandSync(); void requestWaylandSync(); @@ -283,6 +287,7 @@ private: QList mActiveWindows; struct wl_callback *mSyncCallback = nullptr; static const wl_callback_listener syncCallbackListener; + bool mWaylandTryReconnect = false; bool mClientSideInputContextRequested = [] () { const QString& requested = QPlatformInputContextFactory::requested(); diff --git a/src/plugins/platforms/wayland/qwaylandintegration.cpp b/src/plugins/platforms/wayland/qwaylandintegration.cpp index 13bacc9be72..45a247f9b10 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandintegration.cpp @@ -503,6 +503,17 @@ QWaylandShellIntegration *QWaylandIntegration::createShellIntegration(const QStr } } +void QWaylandIntegration::reset() +{ + mServerBufferIntegration.reset(); + mServerBufferIntegrationInitialized = false; + + mInputDeviceIntegration.reset(); + + mClientBufferIntegration.reset(); + mClientBufferIntegrationInitialized = false; +} + } QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandintegration_p.h b/src/plugins/platforms/wayland/qwaylandintegration_p.h index 6221e6893b3..1ba7a63390f 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration_p.h +++ b/src/plugins/platforms/wayland/qwaylandintegration_p.h @@ -103,6 +103,7 @@ protected: QScopedPointer mDisplay; protected: + void reset(); virtual QPlatformNativeInterface *createPlatformNativeInterface(); QScopedPointer mClientBufferIntegration; diff --git a/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp b/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp index b9bfc9c81f1..779ee45c7bc 100644 --- a/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp +++ b/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp @@ -136,7 +136,18 @@ QWaylandShmBackingStore::QWaylandShmBackingStore(QWindow *window, QWaylandDispla : QPlatformBackingStore(window) , mDisplay(display) { - + QObject::connect(mDisplay, &QWaylandDisplay::reconnected, window, [this]() { + auto copy = mBuffers; + // clear available buffers so we create new ones + // actual deletion is deferred till after resize call so we can copy + // contents from the back buffer + mBuffers.clear(); + mFrontBuffer = nullptr; + // resize always resets mBackBuffer + if (mRequestedSize.isValid() && waylandWindow()) + resize(mRequestedSize); + qDeleteAll(copy); + }); } QWaylandShmBackingStore::~QWaylandShmBackingStore() diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index a77cce5ae8c..90f4c609af5 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -291,11 +291,21 @@ void QWaylandWindow::reset() mFrameCallbackElapsedTimer.invalidate(); mWaitingForFrameCallback = false; } + if (mFrameCallbackCheckIntervalTimerId != -1) { + killTimer(mFrameCallbackCheckIntervalTimerId); + mFrameCallbackCheckIntervalTimerId = -1; + } + mFrameCallbackTimedOut = false; mWaitingToApplyConfigure = false; + mCanResize = true; + mResizeDirty = false; + mOpaqueArea = QRegion(); mMask = QRegion(); + mQueuedBuffer = nullptr; + mQueuedBufferDamage = QRegion(); mDisplay->handleWindowDestroyed(this); } @@ -1623,6 +1633,16 @@ void QWaylandWindow::closeChildPopups() { popup->reset(); } } + +void QWaylandWindow::reinit() +{ + if (window()->isVisible()) { + initWindow(); + if (hasPendingUpdateRequest()) + deliverUpdateRequest(); + } +} + } QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index 22b42a9a0e3..d0640e7eb2f 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -229,6 +229,9 @@ public: void removeChildPopup(QWaylandWindow* child); void closeChildPopups(); + virtual void reinit(); + void reset(); + public slots: void applyConfigure(); @@ -325,8 +328,6 @@ private: void initializeWlSurface(); bool shouldCreateShellSurface() const; bool shouldCreateSubSurface() const; - void reset(); - static void closePopups(QWaylandWindow *parent); QPlatformScreen *calculateScreenFromSurfaceEvents() const; void setOpaqueArea(const QRegion &opaqueArea); bool isOpaque() const; diff --git a/tests/auto/wayland/CMakeLists.txt b/tests/auto/wayland/CMakeLists.txt index 44cf32714cb..5ae005eaafe 100644 --- a/tests/auto/wayland/CMakeLists.txt +++ b/tests/auto/wayland/CMakeLists.txt @@ -16,6 +16,7 @@ if (NOT WEBOS) add_subdirectory(nooutput) add_subdirectory(output) add_subdirectory(primaryselectionv1) + add_subdirectory(reconnect) add_subdirectory(seatv4) add_subdirectory(seatv7) add_subdirectory(seat) diff --git a/tests/auto/wayland/reconnect/CMakeLists.txt b/tests/auto/wayland/reconnect/CMakeLists.txt new file mode 100644 index 00000000000..21ce68fd501 --- /dev/null +++ b/tests/auto/wayland/reconnect/CMakeLists.txt @@ -0,0 +1,11 @@ +##################################################################### +## tst_client Test: +##################################################################### + +qt_internal_add_test(tst_reconnect + SOURCES + wl-socket.c + tst_reconnect.cpp + PUBLIC_LIBRARIES + SharedClientTest + ) diff --git a/tests/auto/wayland/reconnect/tst_reconnect.cpp b/tests/auto/wayland/reconnect/tst_reconnect.cpp new file mode 100644 index 00000000000..93007d4cc9b --- /dev/null +++ b/tests/auto/wayland/reconnect/tst_reconnect.cpp @@ -0,0 +1,210 @@ +// Copyright (C) 2023 David Edmundson +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 + +#include "mockcompositor.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#if QT_CONFIG(opengl) +#include +#endif +#include + +#include +#include +#include + +#include "wl-socket.h" + +using namespace MockCompositor; + +class TestWindow : public QRasterWindow +{ +public: + TestWindow() + { + } + + void focusInEvent(QFocusEvent *) override + { + ++focusInEventCount; + } + + void focusOutEvent(QFocusEvent *) override + { + ++focusOutEventCount; + } + + void keyPressEvent(QKeyEvent *event) override + { + ++keyPressEventCount; + keyCode = event->nativeScanCode(); + } + + void keyReleaseEvent(QKeyEvent *event) override + { + ++keyReleaseEventCount; + keyCode = event->nativeScanCode(); + } + + void mousePressEvent(QMouseEvent *event) override + { + ++mousePressEventCount; + mousePressPos = event->position().toPoint(); + } + + void mouseReleaseEvent(QMouseEvent *) override + { + ++mouseReleaseEventCount; + } + + void touchEvent(QTouchEvent *event) override + { + Q_UNUSED(event); + ++touchEventCount; + } + + QPoint frameOffset() const { return QPoint(frameMargins().left(), frameMargins().top()); } + + int focusInEventCount = 0; + int focusOutEventCount = 0; + int keyPressEventCount = 0; + int keyReleaseEventCount = 0; + int mousePressEventCount = 0; + int mouseReleaseEventCount = 0; + int touchEventCount = 0; + + uint keyCode = 0; + QPoint mousePressPos; +}; + +class tst_WaylandReconnect : public QObject +{ + Q_OBJECT +public: + tst_WaylandReconnect(); + void triggerReconnect(); + + template + auto exec(function_type func, arg_types&&... args) -> decltype(func()) + { + return m_comp->exec(func, std::forward(args)...); + } + +private Q_SLOTS: +//core + void cleanup() { QTRY_VERIFY2(m_comp->isClean(), qPrintable(m_comp->dirtyMessage())); } + void basicWindow(); + +//input + void keyFocus(); + +private: + void configureWindow(); + QScopedPointer m_comp; + wl_socket *m_socket; +}; + +tst_WaylandReconnect::tst_WaylandReconnect() +{ + m_socket = wl_socket_create(); + QVERIFY(m_socket); + const int socketFd = wl_socket_get_fd(m_socket); + const QByteArray socketName = wl_socket_get_display_name(m_socket); + qputenv("WAYLAND_DISPLAY", socketName); + + m_comp.reset(new DefaultCompositor(CoreCompositor::Default, dup(socketFd))); +} + +void tst_WaylandReconnect::triggerReconnect() +{ + const int socketFd = wl_socket_get_fd(m_socket); + m_comp.reset(new DefaultCompositor(CoreCompositor::Default, dup(socketFd))); + QTest::qWait(50); //we need to spin the main loop to actually reconnect +} + +void tst_WaylandReconnect::basicWindow() +{ + QRasterWindow window; + window.resize(64, 48); + window.show(); + QCOMPOSITOR_TRY_VERIFY(m_comp->xdgToplevel()); + + triggerReconnect(); + + QCOMPOSITOR_TRY_VERIFY(m_comp->xdgToplevel()); +} + +void tst_WaylandReconnect::keyFocus() +{ + TestWindow window; + window.resize(64, 48); + window.show(); + + configureWindow(); + QTRY_VERIFY(window.isExposed()); + exec([=] { + m_comp->keyboard()->sendEnter(m_comp->surface()); + }); + QTRY_COMPARE(window.focusInEventCount, 1); + + uint keyCode = 80; + QCOMPARE(window.keyPressEventCount, 0); + exec([=] { + m_comp->keyboard()->sendKey(m_comp->client(), keyCode - 8, Keyboard::key_state_pressed); + }); + QTRY_COMPARE(window.keyPressEventCount, 1); + QCOMPARE(QGuiApplication::focusWindow(), &window); + + triggerReconnect(); + configureWindow(); + + // on reconnect our knowledge of focus is reset to a clean slate + QCOMPARE(QGuiApplication::focusWindow(), nullptr); + QTRY_COMPARE(window.focusOutEventCount, 1); + + // fake the user explicitly focussing this window afterwards + exec([=] { + m_comp->keyboard()->sendEnter(m_comp->surface()); + }); + exec([=] { + m_comp->keyboard()->sendKey(m_comp->client(), keyCode - 8, Keyboard::key_state_pressed); + }); + QTRY_COMPARE(window.focusInEventCount, 2); + QTRY_COMPARE(window.keyPressEventCount, 2); +} + + +void tst_WaylandReconnect::configureWindow() +{ + QCOMPOSITOR_TRY_VERIFY(m_comp->xdgToplevel()); + m_comp->exec([=] { + m_comp->xdgToplevel()->sendConfigure({0, 0}, {}); + const uint serial = m_comp->nextSerial(); // Let the window decide the size + m_comp->xdgSurface()->sendConfigure(serial); + }); +} + +int main(int argc, char **argv) +{ + // Note when debugging that a failing reconnect will exit this + // test rather than fail. Making sure it finishes is important! + + QTemporaryDir tmpRuntimeDir; + setenv("QT_QPA_PLATFORM", "wayland", 1); // force QGuiApplication to use wayland plugin + setenv("QT_WAYLAND_RECONNECT", "1", 1); + setenv("XDG_CURRENT_DESKTOP", "qtwaylandtests", 1); + + tst_WaylandReconnect tc; + QGuiApplication app(argc, argv); + QTEST_SET_MAIN_SOURCE_PATH + return QTest::qExec(&tc, argc, argv); +} + +#include "tst_reconnect.moc" diff --git a/tests/auto/wayland/reconnect/wl-socket.c b/tests/auto/wayland/reconnect/wl-socket.c new file mode 100644 index 00000000000..f96de8c73bf --- /dev/null +++ b/tests/auto/wayland/reconnect/wl-socket.c @@ -0,0 +1,166 @@ +// Copyright (C) 2023 David Edmundson +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 + +#define _DEFAULT_SOURCE +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* This is the size of the char array in struct sock_addr_un. + * No Wayland socket can be created with a path longer than this, + * including the null terminator. + */ +#ifndef UNIX_PATH_MAX +#define UNIX_PATH_MAX 108 +#endif + +#define LOCK_SUFFIX ".lock" +#define LOCK_SUFFIXLEN 5 + +struct wl_socket { + int fd; + int fd_lock; + struct sockaddr_un addr; + char lock_addr[UNIX_PATH_MAX + LOCK_SUFFIXLEN]; + char display_name[16]; +}; + +static struct wl_socket *wl_socket_alloc(void) +{ + struct wl_socket *s; + + s = malloc(sizeof *s); + if (!s) + return NULL; + + s->fd = -1; + s->fd_lock = -1; + + return s; +} + +static int wl_socket_lock(struct wl_socket *socket) +{ + struct stat socket_stat; + + snprintf(socket->lock_addr, sizeof socket->lock_addr, "%s%s", socket->addr.sun_path, LOCK_SUFFIX); + + // differening from kwin, we're back to setting CLOEXEC as we're all in process + socket->fd_lock = open(socket->lock_addr, O_CREAT | O_RDWR | O_CLOEXEC, (S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP)); + + if (socket->fd_lock < 0) { + printf("unable to open lockfile %s check permissions\n", socket->lock_addr); + goto err; + } + + if (flock(socket->fd_lock, LOCK_EX | LOCK_NB) < 0) { + printf("unable to lock lockfile %s, maybe another compositor is running\n", socket->lock_addr); + goto err_fd; + } + + if (lstat(socket->addr.sun_path, &socket_stat) < 0) { + if (errno != ENOENT) { + printf("did not manage to stat file %s\n", socket->addr.sun_path); + goto err_fd; + } + } else if (socket_stat.st_mode & S_IWUSR || socket_stat.st_mode & S_IWGRP) { + unlink(socket->addr.sun_path); + } + + return 0; +err_fd: + close(socket->fd_lock); + socket->fd_lock = -1; +err: + *socket->lock_addr = 0; + /* we did not set this value here, but without lock the + * socket won't be created anyway. This prevents the + * wl_socket_destroy from unlinking already existing socket + * created by other compositor */ + *socket->addr.sun_path = 0; + + return -1; +} + +void wl_socket_destroy(struct wl_socket *s) +{ + if (s->addr.sun_path[0]) + unlink(s->addr.sun_path); + if (s->fd >= 0) + close(s->fd); + if (s->lock_addr[0]) + unlink(s->lock_addr); + if (s->fd_lock >= 0) + close(s->fd_lock); + + free(s); +} + +const char *wl_socket_get_display_name(struct wl_socket *s) +{ + return s->display_name; +} + +int wl_socket_get_fd(struct wl_socket *s) +{ + return s->fd; +} + +struct wl_socket *wl_socket_create() +{ + struct wl_socket *s; + int displayno = 0; + int name_size; + + /* A reasonable number of maximum default sockets. If + * you need more than this, use the explicit add_socket API. */ + const int MAX_DISPLAYNO = 32; + const char *runtime_dir = getenv("XDG_RUNTIME_DIR"); + if (!runtime_dir) { + printf("XDG_RUNTIME_DIR not set"); + return NULL; + } + + s = wl_socket_alloc(); + if (s == NULL) + return NULL; + + do { + snprintf(s->display_name, sizeof s->display_name, "wayland-%d", displayno); + s->addr.sun_family = AF_LOCAL; + name_size = snprintf(s->addr.sun_path, sizeof s->addr.sun_path, "%s/%s", runtime_dir, s->display_name) + 1; + assert(name_size > 0); + + if (name_size > (int)sizeof s->addr.sun_path) { + goto fail; + } + + if (wl_socket_lock(s) < 0) + continue; + + s->fd = socket(PF_LOCAL, SOCK_STREAM, 0); + + int size = SUN_LEN(&s->addr); + int ret = bind(s->fd, (struct sockaddr*)&s->addr, size); + if (ret < 0) { + goto fail; + } + ret = listen(s->fd, 128); + if (ret < 0) { + goto fail; + } + return s; + } while (displayno++ < MAX_DISPLAYNO); + +fail: + wl_socket_destroy(s); + return NULL; +} diff --git a/tests/auto/wayland/reconnect/wl-socket.h b/tests/auto/wayland/reconnect/wl-socket.h new file mode 100644 index 00000000000..285870e0179 --- /dev/null +++ b/tests/auto/wayland/reconnect/wl-socket.h @@ -0,0 +1,34 @@ +// Copyright (C) 2023 David Edmundson +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 + +#pragma once + +#ifdef __cplusplus +extern "C" { +#endif + + +/** + * Allocate and create a socket + * It is bound and accepted + */ +struct wl_socket *wl_socket_create(); + +/** + * Returns the file descriptor for the socket + */ +int wl_socket_get_fd(struct wl_socket *); + +/** + * Returns the name of the socket, i.e "wayland-0" + */ +char *wl_socket_get_display_name(struct wl_socket *); + +/** + * Cleanup resources and close the FD + */ +void wl_socket_destroy(struct wl_socket *socket); + +#ifdef __cplusplus +} +#endif diff --git a/tests/auto/wayland/shared/corecompositor.cpp b/tests/auto/wayland/shared/corecompositor.cpp index dd7311e41ce..9b2c7deae1d 100644 --- a/tests/auto/wayland/shared/corecompositor.cpp +++ b/tests/auto/wayland/shared/corecompositor.cpp @@ -6,10 +6,9 @@ namespace MockCompositor { -CoreCompositor::CoreCompositor(CompositorType t) +CoreCompositor::CoreCompositor(CompositorType t, int socketFd) : m_type(t) , m_display(wl_display_create()) - , m_socketName(wl_display_add_socket_auto(m_display)) , m_eventLoop(wl_display_get_event_loop(m_display)) // Start dispatching @@ -20,7 +19,12 @@ CoreCompositor::CoreCompositor(CompositorType t) } }) { - qputenv("WAYLAND_DISPLAY", m_socketName); + if (socketFd == -1) { + QByteArray socketName = wl_display_add_socket_auto(m_display); + qputenv("WAYLAND_DISPLAY", socketName); + } else { + wl_display_add_socket_fd(m_display, socketFd); + } m_timer.start(); Q_ASSERT(isClean()); } @@ -29,7 +33,9 @@ CoreCompositor::~CoreCompositor() { m_running = false; m_dispatchThread.join(); + wl_display_destroy_clients(m_display); wl_display_destroy(m_display); + qDebug() << "cleanup"; } bool CoreCompositor::isClean() diff --git a/tests/auto/wayland/shared/corecompositor.h b/tests/auto/wayland/shared/corecompositor.h index b7d1de78d79..6fd14371c3e 100644 --- a/tests/auto/wayland/shared/corecompositor.h +++ b/tests/auto/wayland/shared/corecompositor.h @@ -29,7 +29,8 @@ public: }; CompositorType m_type = Default; - explicit CoreCompositor(CompositorType t = Default); + explicit CoreCompositor(CompositorType t = Default, int socketFd = -1); + ~CoreCompositor(); bool isClean(); QString dirtyMessage(); @@ -178,7 +179,6 @@ protected: CoreCompositor *m_compositor = nullptr; std::thread::id m_threadId; }; - QByteArray m_socketName; wl_event_loop *m_eventLoop = nullptr; bool m_running = true; QList m_globals; diff --git a/tests/auto/wayland/shared/mockcompositor.cpp b/tests/auto/wayland/shared/mockcompositor.cpp index 71f3775a5ae..43d417ff8bf 100644 --- a/tests/auto/wayland/shared/mockcompositor.cpp +++ b/tests/auto/wayland/shared/mockcompositor.cpp @@ -6,8 +6,8 @@ namespace MockCompositor { -DefaultCompositor::DefaultCompositor(CompositorType t) - : CoreCompositor(t) +DefaultCompositor::DefaultCompositor(CompositorType t, int socketFd) + : CoreCompositor(t, socketFd) { { Lock l(this); diff --git a/tests/auto/wayland/shared/mockcompositor.h b/tests/auto/wayland/shared/mockcompositor.h index 6803a646c5e..8d26361a4f9 100644 --- a/tests/auto/wayland/shared/mockcompositor.h +++ b/tests/auto/wayland/shared/mockcompositor.h @@ -32,7 +32,7 @@ namespace MockCompositor { class DefaultCompositor : public CoreCompositor { public: - explicit DefaultCompositor(CompositorType t = CompositorType::Default); + explicit DefaultCompositor(CompositorType t = CompositorType::Default, int socketFd = -1); // Convenience functions Output *output(int i = 0) { return getAll().value(i, nullptr); } Surface *surface(int i = 0); From 0db6b5d6c5ea17b739fe4c6e7502a1a89469f695 Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Thu, 9 Mar 2023 12:31:32 +0100 Subject: [PATCH 1166/1507] Rename tst_reconnect to avoid clash with qtremoteobjects Name is too generic, but I'll leave this module's maintainers to work out what to do about that. Left the source file with the old name. Change-Id: I0429f03ef06feeae95c2f72ac76cc75397051d9e Reviewed-by: David Edmundson --- tests/auto/wayland/reconnect/CMakeLists.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/auto/wayland/reconnect/CMakeLists.txt b/tests/auto/wayland/reconnect/CMakeLists.txt index 21ce68fd501..aaf8c902d40 100644 --- a/tests/auto/wayland/reconnect/CMakeLists.txt +++ b/tests/auto/wayland/reconnect/CMakeLists.txt @@ -1,11 +1,11 @@ ##################################################################### -## tst_client Test: +## tst_wl_reconnect Test: ##################################################################### -qt_internal_add_test(tst_reconnect +qt_internal_add_test(tst_wl_reconnect SOURCES wl-socket.c tst_reconnect.cpp PUBLIC_LIBRARIES SharedClientTest - ) +) From 33a371758b08498c997f3ad4b7004075da29f014 Mon Sep 17 00:00:00 2001 From: Liang Qi Date: Wed, 22 Feb 2023 12:15:50 +0100 Subject: [PATCH 1167/1507] client: Add support for xdg_popup_configure This amends 6d1d6ebb60ce3f239f83c3459f4465746fcba65c. Since set_constraint_adjustment() was supported, popup should reposition itself from configure. Need to find a way to test clientSideMargins() and etc in the future. Fixes: QTBUG-110623 Task-number: QTBUG-87303 Pick-to: 5.15 6.2 6.4 6.5 Done-with: Ilya Fedin Change-Id: I734acfcde3ba5a35b6f4222358bc93e49fa43f7c Reviewed-by: Qt CI Bot Reviewed-by: David Edmundson --- .../xdg-shell/qwaylandxdgshell.cpp | 23 +++++++++++++++++++ .../xdg-shell/qwaylandxdgshell_p.h | 6 +++++ tests/auto/wayland/xdgshell/tst_xdgshell.cpp | 22 ++++++++++++++++-- 3 files changed, 49 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp index ee53341acb3..cd6e835f8e6 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp @@ -243,6 +243,22 @@ QWaylandXdgSurface::Popup::~Popup() } } +void QWaylandXdgSurface::Popup::applyConfigure() +{ + if (m_pendingGeometry.isValid()) { + QRect geometryWithMargins = m_pendingGeometry.marginsAdded(m_xdgSurface->m_window->windowContentMargins()); + QMargins parentMargins = m_parent->windowContentMargins() - m_parent->clientSideMargins(); + QRect globalGeometry = geometryWithMargins.translated(m_parent->geometry().topLeft() + QPoint(parentMargins.left(), parentMargins.top())); + m_xdgSurface->setGeometryFromApplyConfigure(globalGeometry.topLeft(), globalGeometry.size()); + } + resetConfiguration(); +} + +void QWaylandXdgSurface::Popup::resetConfiguration() +{ + m_pendingGeometry = QRect(); +} + void QWaylandXdgSurface::Popup::grab(QWaylandInputDevice *seat, uint serial) { m_xdgSurface->m_shell->m_topmostGrabbingPopup = this; @@ -250,6 +266,11 @@ void QWaylandXdgSurface::Popup::grab(QWaylandInputDevice *seat, uint serial) m_grabbing = true; } +void QWaylandXdgSurface::Popup::xdg_popup_configure(int32_t x, int32_t y, int32_t width, int32_t height) +{ + m_pendingGeometry = QRect(x, y, width, height); +} + void QWaylandXdgSurface::Popup::xdg_popup_popup_done() { m_xdgSurface->m_window->window()->close(); @@ -364,6 +385,8 @@ void QWaylandXdgSurface::applyConfigure() if (m_toplevel) m_toplevel->applyConfigure(); + if (m_popup) + m_popup->applyConfigure(); m_appliedConfigureSerial = m_pendingConfigureSerial; m_configured = true; diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h index bf51888eda7..951e8234f66 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h @@ -115,13 +115,19 @@ private: Popup(QWaylandXdgSurface *xdgSurface, QWaylandWindow *parent, QtWayland::xdg_positioner *positioner); ~Popup() override; + void applyConfigure(); + void resetConfiguration(); + void grab(QWaylandInputDevice *seat, uint serial); + void xdg_popup_configure(int32_t x, int32_t y, int32_t width, int32_t height) override; void xdg_popup_popup_done() override; QWaylandXdgSurface *m_xdgSurface = nullptr; QWaylandXdgSurface *m_parentXdgSurface = nullptr; QWaylandWindow *m_parent = nullptr; bool m_grabbing = false; + + QRect m_pendingGeometry; }; void setToplevel(); diff --git a/tests/auto/wayland/xdgshell/tst_xdgshell.cpp b/tests/auto/wayland/xdgshell/tst_xdgshell.cpp index 101baecc714..82fb50e32e7 100644 --- a/tests/auto/wayland/xdgshell/tst_xdgshell.cpp +++ b/tests/auto/wayland/xdgshell/tst_xdgshell.cpp @@ -13,6 +13,7 @@ class tst_xdgshell : public QObject, private DefaultCompositor { Q_OBJECT private slots: + void init(); void cleanup() { QTRY_VERIFY2(isClean(), qPrintable(dirtyMessage())); } void showMinimized(); void basicConfigure(); @@ -31,6 +32,11 @@ private slots: void nativeResources(); }; +void tst_xdgshell::init() +{ + setenv("QT_WAYLAND_DISABLE_WINDOWDECORATION", "1", 1); +} + void tst_xdgshell::showMinimized() { // On xdg-shell there's really no way for the compositor to tell the window if it's minimized @@ -239,8 +245,8 @@ void tst_xdgshell::popup() QRasterWindow *popup = window.m_popup.get(); QVERIFY(!popup->isExposed()); // wait for configure - //TODO: Verify it works with a different configure window geometry - exec([=] { xdgPopup()->sendConfigure(QRect(100, 100, 100, 100)); }); + QRect rect1 = QRect(100, 100, 100, 100); + exec([=] { xdgPopup()->sendConfigure(rect1); }); // Nothing should happen before the *xdg_surface* configure QTRY_VERIFY(!popup->isExposed()); // Popup shouldn't be exposed before the first configure event @@ -256,6 +262,18 @@ void tst_xdgshell::popup() // The client is now going to ack the configure QTRY_COMPARE(popupConfigureSpy.size(), 1); QCOMPARE(popupConfigureSpy.takeFirst().at(0).toUInt(), configureSerial); + QCOMPARE(popup->geometry(), rect1); + + QRect rect2 = QRect(50, 50, 150, 150); + exec([=] { xdgPopup()->sendConfigure(rect2); }); + + const uint configureSerial2 = exec([=] { + return xdgPopup()->m_xdgSurface->sendConfigure(); + }); + + QTRY_COMPARE(popupConfigureSpy.size(), 1); + QCOMPARE(popupConfigureSpy.takeFirst().at(0).toUInt(), configureSerial2); + QCOMPARE(popup->geometry(), rect2); // And attach a buffer exec([&] { From b3a99905322672d04525041432007aa5413d3bf4 Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Sat, 18 Mar 2023 22:20:36 +0200 Subject: [PATCH 1168/1507] Client: Fix wl_surface destruction order The main thread can attempt to close the window while the QtQuick render thread is still busy. If that happens, ensure that QtQuick render thread has finished rendering and presented the last frame before destroying the wp_viewport and any other associated surface extensions so the window destruction looks more reasonable. Pick-to: 6.5 Change-Id: I8d2a3372fe6de51f357eed513baaa34a148470e3 Reviewed-by: David Edmundson --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 90f4c609af5..1111582e402 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -267,18 +267,18 @@ void QWaylandWindow::endFrame() void QWaylandWindow::reset() { closeChildPopups(); - delete mShellSurface; - mShellSurface = nullptr; - delete mSubSurfaceWindow; - mSubSurfaceWindow = nullptr; - mViewport.reset(); - mFractionalScale.reset(); if (mSurface) { emit wlSurfaceDestroyed(); QWriteLocker lock(&mSurfaceLock); invalidateSurface(); + delete mShellSurface; + mShellSurface = nullptr; + delete mSubSurfaceWindow; + mSubSurfaceWindow = nullptr; mSurface.reset(); + mViewport.reset(); + mFractionalScale.reset(); } { From e786b30e235b0baabcfaf7b92d3d42ab0844d5fc Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Sun, 19 Mar 2023 10:20:11 +0400 Subject: [PATCH 1169/1507] Client: Fix the mouse being stuck in pressed state after DnD I can still reproduce the problem using QtWidgets applications on KDE Plasma 5.27. Both Windows and macOS QPA have a similar quirk and they both send a MouseButtonRelease event rather than a MouseMove event. Amends 8d291193ab93acfd23d2e82fe0a3d827d17d7bae Task-number: QTBUG-97037 Pick-to: 6.5 6.2 5.15 Change-Id: I864a1cb68b3660d858623f943b3958f7cafbf955 Reviewed-by: David Edmundson --- src/plugins/platforms/wayland/qwaylandinputdevice.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index 00e9e09fa67..b307fb43bdb 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -864,7 +864,7 @@ void QWaylandInputDevice::Pointer::releaseButtons() mButtons = Qt::NoButton; if (auto *window = focusWindow()) { - MotionEvent e(focusWindow(), mParent->mTime, mSurfacePos, mGlobalPos, mButtons, mParent->modifiers()); + ReleaseEvent e(focusWindow(), mParent->mTime, mSurfacePos, mGlobalPos, mButtons, Qt::NoButton, mParent->modifiers()); window->handleMouse(mParent, e); } } From eabe2a039b7982e192f1ff9cc78c8d04e39d7bb4 Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Thu, 30 Mar 2023 22:06:46 +0100 Subject: [PATCH 1170/1507] Client: Cleanup vulkan surfaces on hide Otherwise a hide/show combination will result in use of wl_surface after it has been destroyed by QWaylandWindow. This closely matches what the pattern we use for QWaylandEGLWindow. Pick-to: 6.5 Change-Id: Ic23f947046ce521125dfa8a3c22f5529dfcbece2 Reviewed-by: Eskil Abrahamsen Blomfeldt --- .../platforms/wayland/qwaylandvulkanwindow.cpp | 17 ++++++++++++----- .../platforms/wayland/qwaylandvulkanwindow_p.h | 1 + 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandvulkanwindow.cpp b/src/plugins/platforms/wayland/qwaylandvulkanwindow.cpp index db25a27155a..6a2846585dd 100644 --- a/src/plugins/platforms/wayland/qwaylandvulkanwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandvulkanwindow.cpp @@ -14,11 +14,7 @@ QWaylandVulkanWindow::QWaylandVulkanWindow(QWindow *window, QWaylandDisplay *dis QWaylandVulkanWindow::~QWaylandVulkanWindow() { - if (m_surface) { - QVulkanInstance *inst = window()->vulkanInstance(); - if (inst) - static_cast(inst->handle())->destroySurface(m_surface); - } + invalidateSurface(); } QWaylandWindow::WindowType QWaylandVulkanWindow::windowType() const @@ -26,6 +22,17 @@ QWaylandWindow::WindowType QWaylandVulkanWindow::windowType() const return QWaylandWindow::Vulkan; } +void QWaylandVulkanWindow::invalidateSurface() +{ + if (m_surface) { + QVulkanInstance *inst = window()->vulkanInstance(); + if (inst) + static_cast(inst->handle())->destroySurface(m_surface); + } + m_surface = nullptr; + QWaylandWindow::invalidateSurface(); +} + VkSurfaceKHR *QWaylandVulkanWindow::vkSurface() { if (m_surface) diff --git a/src/plugins/platforms/wayland/qwaylandvulkanwindow_p.h b/src/plugins/platforms/wayland/qwaylandvulkanwindow_p.h index df24e5dbda9..c5692bc7f84 100644 --- a/src/plugins/platforms/wayland/qwaylandvulkanwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandvulkanwindow_p.h @@ -29,6 +29,7 @@ public: ~QWaylandVulkanWindow() override; WindowType windowType() const override; + void invalidateSurface() override; VkSurfaceKHR *vkSurface(); From e1ef4a7f89d49e8f2b56323a742ff4971a74da0b Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Mon, 27 Mar 2023 14:27:21 +0300 Subject: [PATCH 1171/1507] Client: Track parent-popup relationship in QWaylandWindow This reduces the amount of boilerplate code that goes in shell integration plugins providing popups. The main motivation behind this change though is to ensure that QWaylandWindow::addChildPopup() gets called outside the QWaylandShellSurface constructor so one could use the popup's shell surface object to customize parent-child relationship. mShellSurface = mShellIntegration->createShellSurface(this); when this code executes, addChildPopup() will be called before the return value of createShellSurface() is assigned to mShellSurface. Change-Id: I9ccfb21f46febb451bdd7b4aa7851a99f3a03655 Reviewed-by: David Edmundson --- .../xdg-shell/qwaylandxdgshell.cpp | 10 ++------ .../platforms/wayland/qwaylandwindow.cpp | 24 +++++++++++++++---- .../platforms/wayland/qwaylandwindow_p.h | 7 ++++-- 3 files changed, 27 insertions(+), 14 deletions(-) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp index cd6e835f8e6..bf6eb2d0313 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp @@ -211,10 +211,8 @@ QWaylandXdgSurface::Popup::Popup(QWaylandXdgSurface *xdgSurface, QWaylandWindow , m_parent(parent) { - init(xdgSurface->get_popup(m_parentXdgSurface ? m_parentXdgSurface->object() : nullptr, positioner->object())); - if (m_parent) { - m_parent->addChildPopup(m_xdgSurface->window()); - } + init(xdgSurface->get_popup(m_parentXdgSurface ? m_parentXdgSurface->object() : nullptr, + positioner->object())); } QWaylandXdgSurface::Popup::~Popup() @@ -222,10 +220,6 @@ QWaylandXdgSurface::Popup::~Popup() if (isInitialized()) destroy(); - if (m_parent) { - m_parent->removeChildPopup(m_xdgSurface->window()); - } - if (m_grabbing) { auto *shell = m_xdgSurface->m_shell; Q_ASSERT(shell->m_topmostGrabbingPopup == this); diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 1111582e402..74db519f804 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -137,9 +137,15 @@ void QWaylandWindow::initWindow() } else if (shouldCreateShellSurface()) { Q_ASSERT(!mShellSurface); Q_ASSERT(mShellIntegration); + mTransientParent = closestTransientParent(); mShellSurface = mShellIntegration->createShellSurface(this); if (mShellSurface) { + if (mTransientParent) { + if (window()->type() == Qt::ToolTip || window()->type() == Qt::Popup) + mTransientParent->addChildPopup(this); + } + // Set initial surface title setWindowTitle(window()->title()); @@ -272,10 +278,13 @@ void QWaylandWindow::reset() emit wlSurfaceDestroyed(); QWriteLocker lock(&mSurfaceLock); invalidateSurface(); + if (mTransientParent) + mTransientParent->removeChildPopup(this); delete mShellSurface; mShellSurface = nullptr; delete mSubSurfaceWindow; mSubSurfaceWindow = nullptr; + mTransientParent = nullptr; mSurface.reset(); mViewport.reset(); mFractionalScale.reset(); @@ -1050,6 +1059,11 @@ static QWaylandWindow *closestShellSurfaceWindow(QWindow *window) } QWaylandWindow *QWaylandWindow::transientParent() const +{ + return mTransientParent; +} + +QWaylandWindow *QWaylandWindow::closestTransientParent() const { // Take the closest window with a shell surface, since the transient parent may be a // QWidgetWindow or some other window without a shell surface, which is then not able to @@ -1619,12 +1633,14 @@ void QWaylandWindow::setXdgActivationToken(const QString &token) mShellSurface->setXdgActivationToken(token); } -void QWaylandWindow::addChildPopup(QWaylandWindow *surface) { - mChildPopups.append(surface); +void QWaylandWindow::addChildPopup(QWaylandWindow *child) +{ + mChildPopups.append(child); } -void QWaylandWindow::removeChildPopup(QWaylandWindow *surface) { - mChildPopups.removeAll(surface); +void QWaylandWindow::removeChildPopup(QWaylandWindow *child) +{ + mChildPopups.removeAll(child); } void QWaylandWindow::closeChildPopups() { diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index d0640e7eb2f..636cd179690 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -225,8 +225,6 @@ public: void beginFrame(); void endFrame(); - void addChildPopup(QWaylandWindow* child); - void removeChildPopup(QWaylandWindow* child); void closeChildPopups(); virtual void reinit(); @@ -320,6 +318,7 @@ protected: QMargins mCustomMargins; + QPointer mTransientParent; QList> mChildPopups; private: @@ -337,6 +336,10 @@ private: void handleScreensChanged(); void sendRecursiveExposeEvent(); + QWaylandWindow *closestTransientParent() const; + void addChildPopup(QWaylandWindow *child); + void removeChildPopup(QWaylandWindow *child); + bool mInResizeFromApplyConfigure = false; bool lastVisible = false; QRect mLastExposeGeometry; From 25e7d1ed115c8d8f7ee5fcb9618d980836e22d91 Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Mon, 27 Mar 2023 14:33:31 +0300 Subject: [PATCH 1172/1507] Client: Provide hooks for parent windows to attach popups to them The xdg-shell protocol allows to attach xdg_popups to parent surfaces that are not xdg_surfaces. For example, in order to attach an xdg_popup to a layer_surface, you would need to initialize the popup as follows xdg_popup popup = xdg_surface.get_popup(nil, positioner) zwlr_layer_surface_v1.get_popup(popup) QWaylandShellSurface::attachPopup() provides a way to perform parent-specific initialization, i.e. call zwlr_layer_surface_v1.get_popup. QWaylandShellSurface::detachPopup() was added mostly for futureproofing. The xdg-shell doesn't say exactly how the parent surface must be attached. In the example provided above, a request is used to associate the popup with its parent layer surface. But one could also create an object to represent the relationship between the two. The detachPopup() hook can be used to call the destructor request for that object. Change-Id: I43b10e77bd70751d8b4c3a0b5e1d294690bc471a Reviewed-by: David Edmundson --- src/plugins/platforms/wayland/qwaylandshellsurface_p.h | 3 +++ src/plugins/platforms/wayland/qwaylandwindow.cpp | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/src/plugins/platforms/wayland/qwaylandshellsurface_p.h b/src/plugins/platforms/wayland/qwaylandshellsurface_p.h index 51116c52a62..6499a2bb009 100644 --- a/src/plugins/platforms/wayland/qwaylandshellsurface_p.h +++ b/src/plugins/platforms/wayland/qwaylandshellsurface_p.h @@ -84,6 +84,9 @@ public: virtual std::any surfaceRole() const { return std::any(); }; + virtual void attachPopup(QWaylandShellSurface *popup) { Q_UNUSED(popup); } + virtual void detachPopup(QWaylandShellSurface *popup) { Q_UNUSED(popup); } + protected: void resizeFromApplyConfigure(const QSize &sizeWithMargins, const QPoint &offset = {0, 0}); void repositionFromApplyConfigure(const QPoint &position); diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 74db519f804..c48c9ddd00c 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -1635,11 +1635,15 @@ void QWaylandWindow::setXdgActivationToken(const QString &token) void QWaylandWindow::addChildPopup(QWaylandWindow *child) { + if (mShellSurface) + mShellSurface->attachPopup(child->shellSurface()); mChildPopups.append(child); } void QWaylandWindow::removeChildPopup(QWaylandWindow *child) { + if (mShellSurface) + mShellSurface->detachPopup(child->shellSurface()); mChildPopups.removeAll(child); } From d6d416b05e18b3a935f568da0a16abe9a366de5b Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Wed, 29 Mar 2023 21:22:46 +0400 Subject: [PATCH 1173/1507] Client: let QWaylandClientExtension work before platform integration is assigned Task-number: QTBUG-102457 Pick-to: 6.5 Change-Id: Ia47478a4fbf45ba96fd73c6a1a53c2b844aa41b4 Reviewed-by: David Edmundson --- .../platforms/wayland/global/qwaylandclientextension.cpp | 9 +-------- src/plugins/platforms/wayland/qwaylandintegration.cpp | 5 +++++ src/plugins/platforms/wayland/qwaylandintegration_p.h | 4 ++++ 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/plugins/platforms/wayland/global/qwaylandclientextension.cpp b/src/plugins/platforms/wayland/global/qwaylandclientextension.cpp index ca0954f7865..b2783088bf3 100644 --- a/src/plugins/platforms/wayland/global/qwaylandclientextension.cpp +++ b/src/plugins/platforms/wayland/global/qwaylandclientextension.cpp @@ -6,10 +6,6 @@ #include "qwaylandclientextension_p.h" #include #include -#include -#include -#include -#include QT_BEGIN_NAMESPACE @@ -19,12 +15,9 @@ QWaylandClientExtensionPrivate::QWaylandClientExtensionPrivate() { // Keep the possibility to use a custom waylandIntegration as a plugin, // but also add the possibility to run it as a QML component. - waylandIntegration = static_cast(QGuiApplicationPrivate::platformIntegration()); + waylandIntegration = QtWaylandClient::QWaylandIntegration::instance(); if (!waylandIntegration) waylandIntegration = new QtWaylandClient::QWaylandIntegration(); - - if (!waylandIntegration->nativeInterface()->nativeResourceForIntegration("wl_display")) - qWarning() << "This application requires a Wayland platform plugin"; } void QWaylandClientExtensionPrivate::globalAdded(const RegistryGlobal &global) diff --git a/src/plugins/platforms/wayland/qwaylandintegration.cpp b/src/plugins/platforms/wayland/qwaylandintegration.cpp index 45a247f9b10..d4724545f16 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandintegration.cpp @@ -73,6 +73,8 @@ QT_BEGIN_NAMESPACE namespace QtWaylandClient { +QWaylandIntegration *QWaylandIntegration::sInstance = nullptr; + QWaylandIntegration::QWaylandIntegration() #if defined(Q_OS_MACOS) : mFontDb(new QCoreTextFontDatabaseEngineFactory) @@ -88,10 +90,13 @@ QWaylandIntegration::QWaylandIntegration() QWaylandWindow::fixedToplevelPositions = !qEnvironmentVariableIsSet("QT_WAYLAND_DISABLE_FIXED_POSITIONS"); + + sInstance = this; } QWaylandIntegration::~QWaylandIntegration() { + sInstance = nullptr; } QPlatformNativeInterface * QWaylandIntegration::nativeInterface() const diff --git a/src/plugins/platforms/wayland/qwaylandintegration_p.h b/src/plugins/platforms/wayland/qwaylandintegration_p.h index 1ba7a63390f..2ddd9389426 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration_p.h +++ b/src/plugins/platforms/wayland/qwaylandintegration_p.h @@ -41,6 +41,8 @@ public: QWaylandIntegration(); ~QWaylandIntegration() override; + static QWaylandIntegration *instance() { return sInstance; } + bool hasFailed() { return mFailed; } bool hasCapability(QPlatformIntegration::Capability cap) const override; @@ -138,6 +140,8 @@ private: bool mServerBufferIntegrationInitialized = false; bool mShellIntegrationInitialized = false; + static QWaylandIntegration *sInstance; + friend class QWaylandDisplay; }; From 5e864b671e99750cb7d321c756a36cb91b48e371 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Tue, 28 Mar 2023 01:16:56 +0400 Subject: [PATCH 1174/1507] Client: Check for shell integration when initializing platform plugin This makes QWaylandDisplay::initialize return a boolean and moves the QWaylandIntegration's failure check out of constructor as QWaylandIntegration::shellIntegration is a virtual method, this also removes the out-of-date comments about processEvents as it's no more used in QWaylandDisplay::forceRoundTrip. Fixes: QTBUG-102457 Pick-to: 6.5 Change-Id: I3c8f1d9fd195326b587b45318443c2beee1ebfc2 Reviewed-by: Qt CI Bot Reviewed-by: David Edmundson --- .../platforms/wayland/qwaylanddisplay.cpp | 7 ++++++- .../platforms/wayland/qwaylanddisplay_p.h | 2 +- .../platforms/wayland/qwaylandintegration.cpp | 18 +++++++----------- .../platforms/wayland/qwaylandintegration_p.h | 3 +-- .../clientextension/tst_clientextension.cpp | 14 +++++++++++++- 5 files changed, 28 insertions(+), 16 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index 5c3431a05ae..3fe4cb50def 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -379,8 +379,11 @@ QWaylandDisplay::~QWaylandDisplay(void) // Steps which is called just after constructor. This separates registry_global() out of the constructor // so that factory functions in integration can be overridden. -void QWaylandDisplay::initialize() +bool QWaylandDisplay::initialize() { + if (!isInitialized()) + return false; + forceRoundTrip(); if (!mWaitingScreens.isEmpty()) { @@ -389,6 +392,8 @@ void QWaylandDisplay::initialize() } if (!mClientSideInputContextRequested) mTextInputManagerIndex = INT_MAX; + + return qEnvironmentVariableIntValue("QT_WAYLAND_DONT_CHECK_SHELL_INTEGRATION") || shellIntegration(); } void QWaylandDisplay::ensureScreen() diff --git a/src/plugins/platforms/wayland/qwaylanddisplay_p.h b/src/plugins/platforms/wayland/qwaylanddisplay_p.h index f5c1bcbbd51..93d4b1d90dc 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay_p.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay_p.h @@ -97,7 +97,7 @@ public: QWaylandDisplay(QWaylandIntegration *waylandIntegration); ~QWaylandDisplay(void) override; - void initialize(); + bool initialize(); #if QT_CONFIG(xkbcommon) struct xkb_context *xkbContext() const { return mXkbContext.get(); } diff --git a/src/plugins/platforms/wayland/qwaylandintegration.cpp b/src/plugins/platforms/wayland/qwaylandintegration.cpp index d4724545f16..5d21e1c7908 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandintegration.cpp @@ -83,10 +83,6 @@ QWaylandIntegration::QWaylandIntegration() #endif { mDisplay.reset(new QWaylandDisplay(this)); - if (!mDisplay->isInitialized()) { - mFailed = true; - return; - } QWaylandWindow::fixedToplevelPositions = !qEnvironmentVariableIsSet("QT_WAYLAND_DISABLE_FIXED_POSITIONS"); @@ -99,6 +95,11 @@ QWaylandIntegration::~QWaylandIntegration() sInstance = nullptr; } +bool QWaylandIntegration::init() +{ + return mDisplay->initialize(); +} + QPlatformNativeInterface * QWaylandIntegration::nativeInterface() const { return mNativeInterface.data(); @@ -168,7 +169,7 @@ QPlatformNativeInterface *QWaylandIntegration::createPlatformNativeInterface() // Support platform specific initialization void QWaylandIntegration::initializePlatform() { - mDisplay->initialize(); + mDisplay->initEventThread(); mNativeInterface.reset(createPlatformNativeInterface()); initializeInputDeviceIntegration(); @@ -184,14 +185,9 @@ void QWaylandIntegration::initializePlatform() void QWaylandIntegration::initialize() { - mDisplay->initEventThread(); - - // Call this after initializing event thread for QWaylandDisplay::forceRoundTrip() initializePlatform(); - // But the aboutToBlock() and awake() should be connected after initializePlatform(). - // Otherwise the connected flushRequests() may consumes up all events before processEvents starts to wait, - // so that processEvents(QEventLoop::WaitForMoreEvents) may be blocked in the forceRoundTrip(). + // Call this after initializing event thread for QWaylandDisplay::flushRequests() QAbstractEventDispatcher *dispatcher = QGuiApplicationPrivate::eventDispatcher; QObject::connect(dispatcher, SIGNAL(aboutToBlock()), mDisplay.data(), SLOT(flushRequests())); QObject::connect(dispatcher, SIGNAL(awake()), mDisplay.data(), SLOT(flushRequests())); diff --git a/src/plugins/platforms/wayland/qwaylandintegration_p.h b/src/plugins/platforms/wayland/qwaylandintegration_p.h index 2ddd9389426..23403c220c0 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration_p.h +++ b/src/plugins/platforms/wayland/qwaylandintegration_p.h @@ -43,7 +43,7 @@ public: static QWaylandIntegration *instance() { return sInstance; } - bool hasFailed() { return mFailed; } + bool init(); bool hasCapability(QPlatformIntegration::Capability cap) const override; QPlatformWindow *createPlatformWindow(QWindow *window) const override; @@ -134,7 +134,6 @@ private: #if QT_CONFIG(accessibility) mutable QScopedPointer mAccessibility; #endif - bool mFailed = false; QMutex mClientBufferInitLock; bool mClientBufferIntegrationInitialized = false; bool mServerBufferIntegrationInitialized = false; diff --git a/tests/auto/wayland/clientextension/tst_clientextension.cpp b/tests/auto/wayland/clientextension/tst_clientextension.cpp index a6e79bd2ca2..91b02e3b249 100644 --- a/tests/auto/wayland/clientextension/tst_clientextension.cpp +++ b/tests/auto/wayland/clientextension/tst_clientextension.cpp @@ -123,5 +123,17 @@ void tst_clientextension::globalRemoved() QCOMPARE(spy.size(), 1); } -QCOMPOSITOR_TEST_MAIN(tst_clientextension) +int main(int argc, char **argv) +{ + QTemporaryDir tmpRuntimeDir; + setenv("XDG_RUNTIME_DIR", tmpRuntimeDir.path().toLocal8Bit(), 1); + setenv("QT_QPA_PLATFORM", "wayland", 1); + setenv("QT_WAYLAND_DONT_CHECK_SHELL_INTEGRATION", "1", 1); + + tst_clientextension tc; + QGuiApplication app(argc, argv); + QTEST_SET_MAIN_SOURCE_PATH + return QTest::qExec(&tc, argc, argv); +} + #include "tst_clientextension.moc" From f820a71a5023278bc084ba422a82f6f212d6048c Mon Sep 17 00:00:00 2001 From: David Redondo Date: Tue, 22 Mar 2022 09:27:07 +0100 Subject: [PATCH 1175/1507] QWaylandClientExtension: Allow specifying destructor for wayland objects While the template takes care of creating proxies automatically, destroying them is harder since an interface can have 0 to multiple destructors. However in the most common case there is only one or always calling one is sufficient. An additional template parameter is introduced that allows user code to specify a callable taking a pointer to the scanner generated class that should be called when the wayland object is to be be destroyed. This is done when the global is removed or upon destruction of the C++ object itself. The clientextension test is changed how it can be used. Since it works via a non-type template parameter a pointer to a (member) function can be passed or when compiled in c++20 mode a lambda or for example a function object. This new functionality is opt-in and the default behavior is unchanged. The default value is nullptr used as a tag to do not enable the new behavior. Change-Id: I8043f7106fec0cd6f2a79682e5872cfa8da3d11b Reviewed-by: David Edmundson --- .../wayland/global/qwaylandclientextension.h | 23 ++++++++++++++++--- .../clientextension/tst_clientextension.cpp | 13 ++++------- 2 files changed, 24 insertions(+), 12 deletions(-) diff --git a/src/plugins/platforms/wayland/global/qwaylandclientextension.h b/src/plugins/platforms/wayland/global/qwaylandclientextension.h index 8fe74e37902..c57549c34a8 100644 --- a/src/plugins/platforms/wayland/global/qwaylandclientextension.h +++ b/src/plugins/platforms/wayland/global/qwaylandclientextension.h @@ -45,14 +45,31 @@ protected Q_SLOTS: void initialize(); }; -template + +template class Q_WAYLANDCLIENT_EXPORT QWaylandClientExtensionTemplate : public QWaylandClientExtension { Q_DECLARE_PRIVATE(QWaylandClientExtensionTemplate) + public: - QWaylandClientExtensionTemplate(const int ver) : - QWaylandClientExtension(ver) + QWaylandClientExtensionTemplate(const int ver) : QWaylandClientExtension(ver) { + if constexpr (destruct != nullptr) { + connect(this, &QWaylandClientExtensionTemplate::activeChanged, this, [this] { + if (!isActive()) { + std::invoke(destruct, static_cast(this)); + } + }); + } + } + + ~QWaylandClientExtensionTemplate() + { + if constexpr (destruct != nullptr) { + if (isActive()) { + std::invoke(destruct, static_cast(this)); + } + } } const struct wl_interface *extensionInterface() const override diff --git a/tests/auto/wayland/clientextension/tst_clientextension.cpp b/tests/auto/wayland/clientextension/tst_clientextension.cpp index 91b02e3b249..c1cd1cb1fa3 100644 --- a/tests/auto/wayland/clientextension/tst_clientextension.cpp +++ b/tests/auto/wayland/clientextension/tst_clientextension.cpp @@ -14,17 +14,12 @@ using namespace MockCompositor; -class TestExtension : public QWaylandClientExtensionTemplate, - public QtWayland::test_interface +class TestExtension + : public QWaylandClientExtensionTemplate, + public QtWayland::test_interface { public: - TestExtension() : QWaylandClientExtensionTemplate(1) { } - ~TestExtension() - { - if (object()) { - release(); - } - } + TestExtension() : QWaylandClientExtensionTemplate(1){}; void initialize() { QWaylandClientExtension::initialize(); } }; From 531ac86e95aab949d86125cc12418149687030f9 Mon Sep 17 00:00:00 2001 From: David Redondo Date: Tue, 11 Apr 2023 14:27:27 +0200 Subject: [PATCH 1176/1507] Destroy frame queue before display wl_event_queue_destroy accesses the display. Found by running a test under valgrind. Pick-to: 6.5 Change-Id: Ic89cbd3b6e98b4fc9561b0e63b5fab4886a1ec50 Reviewed-by: David Edmundson --- src/plugins/platforms/wayland/qwaylanddisplay.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index 3fe4cb50def..71d5025c209 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -370,11 +370,12 @@ QWaylandDisplay::~QWaylandDisplay(void) #if QT_CONFIG(cursor) mCursorThemes.clear(); #endif - if (mDisplay) - wl_display_disconnect(mDisplay); if (m_frameEventQueue) wl_event_queue_destroy(m_frameEventQueue); + + if (mDisplay) + wl_display_disconnect(mDisplay); } // Steps which is called just after constructor. This separates registry_global() out of the constructor From 684367c462f7ce3d3261ba60517e193bc5a7ba0f Mon Sep 17 00:00:00 2001 From: Carl Schwan Date: Mon, 3 Apr 2023 19:34:15 +0200 Subject: [PATCH 1177/1507] Implement setBadgeNumber for wayland backend This is based on qtbase/ac973cb74fecdaedf31922dfd48ea522a7af8f51 Change-Id: Ifef0d36cef01fb673731f276d51100115678e749 Reviewed-by: David Edmundson --- src/plugins/platforms/wayland/qwaylandintegration.cpp | 5 +++++ src/plugins/platforms/wayland/qwaylandintegration_p.h | 2 ++ 2 files changed, 7 insertions(+) diff --git a/src/plugins/platforms/wayland/qwaylandintegration.cpp b/src/plugins/platforms/wayland/qwaylandintegration.cpp index 5d21e1c7908..88a2fa7e1ac 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandintegration.cpp @@ -515,6 +515,11 @@ void QWaylandIntegration::reset() mClientBufferIntegrationInitialized = false; } +void QWaylandIntegration::setApplicationBadge(qint64 number) +{ + auto unixServices = mDisplay->windowManagerIntegration(); + unixServices->setApplicationBadge(number); +} } QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandintegration_p.h b/src/plugins/platforms/wayland/qwaylandintegration_p.h index 23403c220c0..81d1ae6d2b7 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration_p.h +++ b/src/plugins/platforms/wayland/qwaylandintegration_p.h @@ -88,6 +88,8 @@ public: QPlatformVulkanInstance *createPlatformVulkanInstance(QVulkanInstance *instance) const override; #endif + void setApplicationBadge(qint64 number) override; + virtual QWaylandInputDevice *createInputDevice(QWaylandDisplay *display, int version, uint32_t id) const; virtual QWaylandScreen *createPlatformScreen(QWaylandDisplay *waylandDisplay, int version, uint32_t id) const; virtual QWaylandCursor *createPlatformCursor(QWaylandDisplay *display) const; From 446508bea73fca7d042afdcb2fb9a7518bd408b3 Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Thu, 13 Apr 2023 09:00:45 +0100 Subject: [PATCH 1178/1507] Client: Use correct type in vulkan window for null VkSurfaceKHR is not a pointer, nullptr is not always the same size. Pick-to: 6.5 Task-number: QTBUG-112808 Change-Id: I12e5f61b67b9aa331f7e42a952413e922d09eb8d Reviewed-by: Eskil Abrahamsen Blomfeldt Reviewed-by: Axel Spoerl --- src/plugins/platforms/wayland/qwaylandvulkanwindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandvulkanwindow.cpp b/src/plugins/platforms/wayland/qwaylandvulkanwindow.cpp index 6a2846585dd..2bc52829d60 100644 --- a/src/plugins/platforms/wayland/qwaylandvulkanwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandvulkanwindow.cpp @@ -29,7 +29,7 @@ void QWaylandVulkanWindow::invalidateSurface() if (inst) static_cast(inst->handle())->destroySurface(m_surface); } - m_surface = nullptr; + m_surface = VK_NULL_HANDLE; QWaylandWindow::invalidateSurface(); } From d66e8f148f4b02a0fdb3d3df8dc9d0e9ae8aac3b Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Tue, 11 Apr 2023 14:48:25 +0200 Subject: [PATCH 1179/1507] Make sure doApplyConfigure() is called from main thread Task-number: QTBUG-101948 Change-Id: I867365384c43ccddf5b7a8600a3db84aa99aca6d Reviewed-by: Eskil Abrahamsen Blomfeldt --- .../platforms/wayland/qwaylandwindow.cpp | 22 +++++++++++++++++-- .../platforms/wayland/qwaylandwindow_p.h | 3 +++ 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index c48c9ddd00c..2b7f199c05f 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -30,6 +30,7 @@ #include #include +#include #include @@ -599,12 +600,24 @@ void QWaylandWindow::doApplyConfigure() if (!mWaitingToApplyConfigure) return; + Q_ASSERT_X(QThread::currentThreadId() == QThreadData::get2(thread())->threadId.loadRelaxed(), + "QWaylandWindow::doApplyConfigure", "not called from main thread"); + if (mShellSurface) mShellSurface->applyConfigure(); mWaitingToApplyConfigure = false; } +void QWaylandWindow::doApplyConfigureFromOtherThread() +{ + QMutexLocker lock(&mResizeLock); + if (!mCanResize || !mWaitingToApplyConfigure) + return; + doApplyConfigure(); + sendExposeEvent(QRect(QPoint(), geometry().size())); +} + void QWaylandWindow::setCanResize(bool canResize) { QMutexLocker lock(&mResizeLock); @@ -615,8 +628,13 @@ void QWaylandWindow::setCanResize(bool canResize) QWindowSystemInterface::handleGeometryChange(window(), geometry()); } if (mWaitingToApplyConfigure) { - doApplyConfigure(); - sendExposeEvent(QRect(QPoint(), geometry().size())); + bool inGuiThread = QThread::currentThreadId() == QThreadData::get2(thread())->threadId.loadRelaxed(); + if (inGuiThread) { + doApplyConfigure(); + sendExposeEvent(QRect(QPoint(), geometry().size())); + } else { + QMetaObject::invokeMethod(this, &QWaylandWindow::doApplyConfigureFromOtherThread, Qt::QueuedConnection); + } } else if (mResizeDirty) { mResizeDirty = false; sendExposeEvent(QRect(QPoint(), geometry().size())); diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index 636cd179690..042ea56603b 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -321,6 +321,9 @@ protected: QPointer mTransientParent; QList> mChildPopups; +private slots: + void doApplyConfigureFromOtherThread(); + private: void setGeometry_helper(const QRect &rect); void initWindow(); From 4f8399d3070ad70c297175a848a7a20e3ae5468f Mon Sep 17 00:00:00 2001 From: David Rosca Date: Mon, 17 Apr 2023 13:37:47 +0200 Subject: [PATCH 1180/1507] QWaylandWindow: Init parent wl_surface when creating subsurface Fixes recreating subsurfaces after hiding and then again showing the window. Pick-to: 6.5 Change-Id: I2e3e7ceb42ec6b25cb64db260dfb74f6ebb10d27 Reviewed-by: David Edmundson --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 2 ++ tests/auto/wayland/surface/tst_surface.cpp | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 2b7f199c05f..7634aedd6e9 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -131,6 +131,8 @@ void QWaylandWindow::initWindow() Q_ASSERT(!mSubSurfaceWindow); auto *parent = static_cast(QPlatformWindow::parent()); + if (!parent->mSurface) + parent->initializeWlSurface(); if (parent->wlSurface()) { if (::wl_subsurface *subsurface = mDisplay->createSubSurface(this, parent)) mSubSurfaceWindow = new QWaylandSubSurface(this, parent, subsurface); diff --git a/tests/auto/wayland/surface/tst_surface.cpp b/tests/auto/wayland/surface/tst_surface.cpp index 083bc4faa90..b583390f024 100644 --- a/tests/auto/wayland/surface/tst_surface.cpp +++ b/tests/auto/wayland/surface/tst_surface.cpp @@ -199,6 +199,10 @@ void tst_surface::createSubsurfaceForHiddenParent() // Make sure the client doesn't quit before it has a chance to crash xdgPingAndWaitForPong(); + + // Make sure the subsurface was actually created + const Subsurface *subsurface = exec([=] {return subSurface(0);}); + QVERIFY(subsurface); } QCOMPOSITOR_TEST_MAIN(tst_surface) From a6275b00bdcb28ec188e132307de7857c2c3e80d Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 2 May 2023 08:12:57 -0700 Subject: [PATCH 1181/1507] QWaylandDisplay: suppress warning about mixing QByteArray & QString MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit src/client/qwaylanddisplay.cpp:627:36: required from here qlist.h:907:20: warning: ‘bool QByteArray::operator==(const QString&) const’ is deprecated: Use fromUtf8, QStringLiteral, or QLatin1StringView [-Wdeprecated-declarations] Pick-to: 6.5 Change-Id: Ieab617d69f3b4b54ab30fffd175b5c4e76fdda4d Reviewed-by: David Edmundson --- src/plugins/platforms/wayland/qwaylanddisplay.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index 71d5025c209..b7e212ab014 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -623,7 +623,7 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin { struct ::wl_registry *registry = object(); - static QByteArrayList interfaceBlacklist = qgetenv("QT_WAYLAND_DISABLED_INTERFACES").split(','); + static QStringList interfaceBlacklist = qEnvironmentVariable("QT_WAYLAND_DISABLED_INTERFACES").split(u','); if (interfaceBlacklist.contains(interface)) { return; } From a3c665b65aa241c3ca56f3311e9380e8e434a6f2 Mon Sep 17 00:00:00 2001 From: Inho Lee Date: Tue, 9 May 2023 10:58:13 +0200 Subject: [PATCH 1182/1507] Apply only valid min/max sizes When setting min/max sizes, the minimum size can be larger than the maximum size. In that case, the size hint won't be applied to the geometry. Setting size hint will be pending until the min/max pair is valid and the actual geometry will not be changed with the invalid size hint. Fixes: QTBUG-113233 Pick-to: 6.5 6.5.1 6.2 Change-Id: Ia05944e8342e7f8d794aee7883e0637a4c711c9d Reviewed-by: David Edmundson --- .../shellintegration/xdg-shell/qwaylandxdgshell.cpp | 12 ++++++++---- src/plugins/platforms/wayland/qwaylandwindow.cpp | 12 +++++++++--- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp index bf6eb2d0313..a16fd8cc770 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp @@ -410,14 +410,18 @@ void QWaylandXdgSurface::setSizeHints() if (m_toplevel && m_window) { const int minWidth = qMax(0, m_window->windowMinimumSize().width()); const int minHeight = qMax(0, m_window->windowMinimumSize().height()); - m_toplevel->set_min_size(minWidth, minHeight); - - int maxWidth = qMax(minWidth, m_window->windowMaximumSize().width()); + int maxWidth = qMax(0, m_window->windowMaximumSize().width()); + int maxHeight = qMax(0, m_window->windowMaximumSize().height()); if (maxWidth == QWINDOWSIZE_MAX) maxWidth = 0; - int maxHeight = qMax(minHeight, m_window->windowMaximumSize().height()); if (maxHeight == QWINDOWSIZE_MAX) maxHeight = 0; + + // It will not change min/max sizes if invalid. + if (minWidth > maxHeight || minHeight > maxHeight) + return; + + m_toplevel->set_min_size(minWidth, minHeight); m_toplevel->set_max_size(maxWidth, maxHeight); } } diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 7634aedd6e9..4ca2d8e6ffc 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -394,9 +394,15 @@ void QWaylandWindow::setGeometry_helper(const QRect &rect) { QSize minimum = windowMinimumSize(); QSize maximum = windowMaximumSize(); - QPlatformWindow::setGeometry(QRect(rect.x(), rect.y(), - qBound(minimum.width(), rect.width(), maximum.width()), - qBound(minimum.height(), rect.height(), maximum.height()))); + int width = windowGeometry().width(); + int height = windowGeometry().height(); + if (minimum.width() <= maximum.width() + && minimum.height() <= maximum.height()) { + width = qBound(minimum.width(), rect.width(), maximum.width()); + height = qBound(minimum.height(), rect.height(), maximum.height()); + } + + QPlatformWindow::setGeometry(QRect(rect.x(), rect.y(), width, height)); if (mViewport) updateViewport(); From f2344f7d714f11bc897279cf6ad3825aa80e6307 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Mon, 15 May 2023 10:29:46 +0400 Subject: [PATCH 1183/1507] Client: fix a typo in minimum window size handling Amends a3c665b65aa241c3ca56f3311e9380e8e434a6f2 Pick-to: 6.5 6.5.1 6.2 Change-Id: I3919b913aa7b09f9d0863344d72e9f6e14a8634a Reviewed-by: David Edmundson --- .../plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp index a16fd8cc770..80e44adb78b 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp @@ -418,7 +418,7 @@ void QWaylandXdgSurface::setSizeHints() maxHeight = 0; // It will not change min/max sizes if invalid. - if (minWidth > maxHeight || minHeight > maxHeight) + if (minWidth > maxWidth || minHeight > maxHeight) return; m_toplevel->set_min_size(minWidth, minHeight); From 117f8dedccc52026848b3789a89ee77ce0678e66 Mon Sep 17 00:00:00 2001 From: David Redondo Date: Thu, 27 Apr 2023 15:22:26 +0200 Subject: [PATCH 1184/1507] Properly clean up screens during reconnect Otherwise the old screens are left dangling. Also create a placeholder screen so the windows get assigned a valid screen upon reconnect. Change-Id: Iea5d1da6f32be5e87464412447ae1449d91d8e75 Reviewed-by: David Edmundson --- .../platforms/wayland/qwaylanddisplay.cpp | 9 ++++--- .../auto/wayland/reconnect/tst_reconnect.cpp | 25 +++++++++++++++++++ 2 files changed, 31 insertions(+), 3 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index b7e212ab014..911004f8b35 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -420,6 +420,12 @@ void QWaylandDisplay::reconnect() qDeleteAll(mWaitingScreens); mWaitingScreens.clear(); + const auto screens = std::exchange(mScreens, {}); + ensureScreen(); + for (QWaylandScreen *screen : screens) { + QWindowSystemInterface::handleScreenRemoved(screen); + } + // mCompositor mShm.reset(); mCursorThemes.clear(); @@ -449,9 +455,6 @@ void QWaylandDisplay::reconnect() qDeleteAll(std::exchange(mInputDevices, {})); mLastInputDevice = nullptr; - auto screens = mScreens; - mScreens.clear(); - for (const RegistryGlobal &global : mGlobals) { emit globalRemoved(global); } diff --git a/tests/auto/wayland/reconnect/tst_reconnect.cpp b/tests/auto/wayland/reconnect/tst_reconnect.cpp index 93007d4cc9b..2b6c7558fd6 100644 --- a/tests/auto/wayland/reconnect/tst_reconnect.cpp +++ b/tests/auto/wayland/reconnect/tst_reconnect.cpp @@ -101,6 +101,7 @@ private Q_SLOTS: //core void cleanup() { QTRY_VERIFY2(m_comp->isClean(), qPrintable(m_comp->dirtyMessage())); } void basicWindow(); + void screens(); //input void keyFocus(); @@ -141,6 +142,30 @@ void tst_WaylandReconnect::basicWindow() QCOMPOSITOR_TRY_VERIFY(m_comp->xdgToplevel()); } +void tst_WaylandReconnect::screens() +{ + QRasterWindow window; + window.resize(64, 48); + window.show(); + QCOMPOSITOR_TRY_VERIFY(m_comp->xdgToplevel()); + + auto originalScreens = QGuiApplication::screens(); + + QSignalSpy screenRemovedSpy(qGuiApp, &QGuiApplication::screenRemoved); + QVERIFY(screenRemovedSpy.isValid()); + + triggerReconnect(); + + // All screens plus temporary placeholder screen removed + QCOMPARE(screenRemovedSpy.count(), originalScreens.count() + 1); + for (const auto &screen : std::as_const(screenRemovedSpy)) { + originalScreens.removeOne(screen[0].value()); + } + QVERIFY(originalScreens.isEmpty()); + QVERIFY(window.screen()); + QVERIFY(QGuiApplication::screens().contains(window.screen())); +} + void tst_WaylandReconnect::keyFocus() { TestWindow window; From 573486001f594ececfcd5797692ff6c48ceb493c Mon Sep 17 00:00:00 2001 From: Alexey Edelev Date: Mon, 15 May 2023 18:26:40 +0200 Subject: [PATCH 1185/1507] Avoid promoting Wayland targets to global if they already exist Disable promotion to global for all Wayland targets that are already promoted by another find_package calls. Fixes: QTBUG-113560 Pick-to: 6.5 Change-Id: I7c6984ed15daf996dd87db13290c98ee2c4cbeb6 Reviewed-by: Joerg Bornemann --- src/platformsupport/wayland/CMakeLists.txt | 6 ++++++ src/platformsupport/wayland/configure.cmake | 14 ++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/src/platformsupport/wayland/CMakeLists.txt b/src/platformsupport/wayland/CMakeLists.txt index 0ac09b52faa..b804531aeff 100644 --- a/src/platformsupport/wayland/CMakeLists.txt +++ b/src/platformsupport/wayland/CMakeLists.txt @@ -4,6 +4,12 @@ # Generated from src.pro. # special case begin qt_find_package(WaylandScanner PROVIDED_TARGETS Wayland::Scanner) +if(TARGET Wayland::Client) + qt_internal_disable_find_package_global_promotion(Wayland::Client) +endif() +if(TARGET Wayland::Server) + qt_internal_disable_find_package_global_promotion(Wayland::Server) +endif() qt_find_package(Wayland 1.15 PROVIDED_TARGETS Wayland::Client Wayland::Server) if (NOT WaylandScanner_FOUND OR NOT Wayland_FOUND) diff --git a/src/platformsupport/wayland/configure.cmake b/src/platformsupport/wayland/configure.cmake index 9954ea6269e..4270e819628 100644 --- a/src/platformsupport/wayland/configure.cmake +++ b/src/platformsupport/wayland/configure.cmake @@ -12,21 +12,35 @@ set(INPUT_wayland_text_input_v4_wip OFF CACHE BOOL "") if(LINUX OR QT_FIND_ALL_PACKAGES_ALWAYS) # waylandclient libraries + if(TARGET Wayland::Client) + qt_internal_disable_find_package_global_promotion(Wayland::Client) + endif() qt_find_package(Wayland PROVIDED_TARGETS Wayland::Client MODULE_NAME waylandclient QMAKE_LIB wayland-client) + + if(TARGET Wayland::Cursor) + qt_internal_disable_find_package_global_promotion(Wayland::Cursor) + endif() qt_find_package(Wayland PROVIDED_TARGETS Wayland::Cursor MODULE_NAME waylandclient QMAKE_LIB wayland-cursor) qt_add_qmake_lib_dependency(wayland-cursor wayland-client) + + if(TARGET Wayland::Egl) + qt_internal_disable_find_package_global_promotion(Wayland::Egl) + endif() qt_find_package(Wayland PROVIDED_TARGETS Wayland::Egl MODULE_NAME waylandclient QMAKE_LIB wayland-egl) # waylandcompositor libraries + if(TARGET Wayland::Server) + qt_internal_disable_find_package_global_promotion(Wayland::Server) + endif() qt_find_package(Wayland PROVIDED_TARGETS Wayland::Server MODULE_NAME waylandcompositor From 5921924fbae7dcdb0890a61b14007d957b0f1472 Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Thu, 18 May 2023 13:36:27 +0300 Subject: [PATCH 1186/1507] tests: Cleanup cursor role objects They should have the same lifetime as the underlying surface Change-Id: I35ad0377a506a4e18e7d4f37691189f636ae54bf Reviewed-by: Eskil Abrahamsen Blomfeldt --- tests/auto/wayland/shared/coreprotocol.cpp | 2 +- tests/auto/wayland/shared/coreprotocol.h | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/auto/wayland/shared/coreprotocol.cpp b/tests/auto/wayland/shared/coreprotocol.cpp index 8e64adadae3..15be62ccb9f 100644 --- a/tests/auto/wayland/shared/coreprotocol.cpp +++ b/tests/auto/wayland/shared/coreprotocol.cpp @@ -338,7 +338,7 @@ uint Pointer::sendEnter(Surface *surface, const QPointF &position) uint serial = m_seat->m_compositor->nextSerial(); m_enterSerials << serial; - m_cursorRole = nullptr; // According to the protocol, the pointer image is undefined after enter + m_cursorRole.clear(); // According to the protocol, the pointer image is undefined after enter wl_client *client = surface->resource()->client(); const auto pointerResources = resourceMap().values(client); diff --git a/tests/auto/wayland/shared/coreprotocol.h b/tests/auto/wayland/shared/coreprotocol.h index 8703fe1d308..e41c719e87a 100644 --- a/tests/auto/wayland/shared/coreprotocol.h +++ b/tests/auto/wayland/shared/coreprotocol.h @@ -337,7 +337,7 @@ class Pointer : public QObject, public QtWaylandServer::wl_pointer public: explicit Pointer(Seat *seat) : m_seat(seat) {} Surface *cursorSurface(); - CursorRole* m_cursorRole = nullptr; //TODO: cleanup + QPointer m_cursorRole; void send_enter() = delete; uint sendEnter(Surface *surface, const QPointF &position); void send_leave() = delete; @@ -369,6 +369,7 @@ public: explicit CursorRole(Surface *surface) // TODO: needs some more args : m_surface(surface) { + connect(m_surface, &QObject::destroyed, this, &QObject::deleteLater); } static CursorRole *fromSurface(Surface *surface) { return qobject_cast(surface->m_role); } Surface *m_surface = nullptr; From 005c2aad5e57ab58c22e72f74e9b5117f593f5e9 Mon Sep 17 00:00:00 2001 From: Alexey Edelev Date: Wed, 24 May 2023 13:29:59 +0200 Subject: [PATCH 1187/1507] Make sure that all wayland targets are found in source tree We look for wayland targets at feature evaluation step. Meanwhile recent changes related to the static Qt build disable promoting those targets to global because they might be already promoted by QtGui from wayland plugins. This adds the lookup of all required Wayland targets at src level, so we make sure they are accessible and valid for targets that link them. Amends 573486001f594ececfcd5797692ff6c48ceb493c Task-number: QTBUG-113560 Pick-to: 6.5 Change-Id: Id719f86c41c694278773720dd76260835645bfa6 Reviewed-by: Paul Wicking Reviewed-by: Qt CI Bot --- src/platformsupport/wayland/CMakeLists.txt | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/src/platformsupport/wayland/CMakeLists.txt b/src/platformsupport/wayland/CMakeLists.txt index b804531aeff..c3219f9d293 100644 --- a/src/platformsupport/wayland/CMakeLists.txt +++ b/src/platformsupport/wayland/CMakeLists.txt @@ -4,13 +4,21 @@ # Generated from src.pro. # special case begin qt_find_package(WaylandScanner PROVIDED_TARGETS Wayland::Scanner) -if(TARGET Wayland::Client) - qt_internal_disable_find_package_global_promotion(Wayland::Client) -endif() -if(TARGET Wayland::Server) - qt_internal_disable_find_package_global_promotion(Wayland::Server) -endif() -qt_find_package(Wayland 1.15 PROVIDED_TARGETS Wayland::Client Wayland::Server) + +set(wayland_libs + Wayland::Client + Wayland::Server + Wayland::Cursor + Wayland::Egl +) + +foreach(lib IN LISTS wayland_libs) + if(TARGET ${lib}) + qt_internal_disable_find_package_global_promotion(${lib}) + endif() +endforeach() + +qt_find_package(Wayland 1.15 PROVIDED_TARGETS ${wayland_libs}) if (NOT WaylandScanner_FOUND OR NOT Wayland_FOUND) message(WARNING "QtWayland is missing required dependencies, nothing will be built. \ From 36ea56dae84390eb390de1fc4ab92724205859c5 Mon Sep 17 00:00:00 2001 From: Phan Quang Minh Date: Sun, 28 May 2023 22:07:47 +0700 Subject: [PATCH 1188/1507] Don't floor device scale in `QWaylandShmBuffer::imageInsideMargins` The offset of the drawing target returned from QWaylandShmBackingStore::contentSurface() is incorrectly calculated due to `mImage.devicePixelRatio()` being casted to `int` inside `imageInsideMargins`, which causes the scale to be rounded down in case of fractional scaled displays. This causes the window contents to be incorrectly positioned on CSD-requiring compositors (e.g. GNOME), eventually resulting in graphics corruption due to mismatched damage and opaque regions. Fix this by removing the incorrect `int` cast. Pick-to: 6.5 Change-Id: I436d24522d23888b641cb21403f773e8ea113b8d Reviewed-by: David Edmundson --- src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp b/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp index 779ee45c7bc..bc300595e4d 100644 --- a/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp +++ b/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp @@ -106,7 +106,7 @@ QWaylandShmBuffer::~QWaylandShmBuffer(void) QImage *QWaylandShmBuffer::imageInsideMargins(const QMargins &marginsIn) { - QMargins margins = marginsIn * int(mImage.devicePixelRatio()); + QMargins margins = marginsIn * mImage.devicePixelRatio(); if (!margins.isNull() && margins != mMargins) { if (mMarginsImage) { From 5b2524c57d249bc5e6f6ffe3108ef909667060be Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Mon, 15 May 2023 12:30:26 +0300 Subject: [PATCH 1189/1507] Client: Don't sanitize desktop file name MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This doesn't work well if the app id ends with ".desktop". Pick-to: 6.5 Change-Id: I33d7c92f87595251f0da90277d12b2a2bb286a30 Reviewed-by: Eskil Abrahamsen Blomfeldt Reviewed-by: Tor Arne Vestbø --- .../platforms/wayland/qwaylandwindow.cpp | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 4ca2d8e6ffc..e3070c9363a 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -153,19 +153,15 @@ void QWaylandWindow::initWindow() setWindowTitle(window()->title()); // The appId is the desktop entry identifier that should follow the - // reverse DNS convention (see http://standards.freedesktop.org/desktop-entry-spec/latest/ar01s02.html). - // According to xdg-shell the appId is only the name, without - // the .desktop suffix. + // reverse DNS convention (see + // http://standards.freedesktop.org/desktop-entry-spec/latest/ar01s02.html). According + // to xdg-shell the appId is only the name, without the .desktop suffix. // - // If the application specifies the desktop file name use that - // removing the ".desktop" suffix, otherwise fall back to the - // executable name and prepend the reversed organization domain - // when available. + // If the application specifies the desktop file name use that, + // otherwise fall back to the executable name and prepend the + // reversed organization domain when available. if (!QGuiApplication::desktopFileName().isEmpty()) { - QString name = QGuiApplication::desktopFileName(); - if (name.endsWith(QLatin1String(".desktop"))) - name.chop(8); - mShellSurface->setAppId(name); + mShellSurface->setAppId(QGuiApplication::desktopFileName()); } else { QFileInfo fi = QFileInfo(QCoreApplication::instance()->applicationFilePath()); QStringList domainName = From 6d1b95ac8ba2dcea8e1819614a5503f3ff339958 Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Thu, 11 May 2023 10:55:47 +0300 Subject: [PATCH 1190/1507] client: Move device initialization to device constructor The typical pattern throughout QtWayland is for wrapping clients to be entirely responsible for the lifespan of underlying proxy objects. InputDevices previously had a subtly different pattern with proxy object initialization being called externally. Change-Id: I2e018bff38628b636d0f485d810521f8e00291f3 Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/plugins/platforms/wayland/qwaylandinputdevice.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index b307fb43bdb..24c86a0cf70 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -63,6 +63,7 @@ static const int MaxTouchPoints = 10; QWaylandInputDevice::Keyboard::Keyboard(QWaylandInputDevice *p) : mParent(p) { + init(p->get_keyboard()); mRepeatTimer.callOnTimeout([&]() { if (!focusWindow()) { // We destroyed the keyboard focus surface, but the server didn't get the message yet... @@ -124,6 +125,7 @@ QWaylandWindow *QWaylandInputDevice::Keyboard::focusWindow() const QWaylandInputDevice::Pointer::Pointer(QWaylandInputDevice *seat) : mParent(seat) { + init(seat->get_pointer()); #if QT_CONFIG(cursor) mCursor.frameTimer.setSingleShot(true); mCursor.frameTimer.callOnTimeout([&]() { @@ -364,6 +366,7 @@ void QWaylandInputDevice::Pointer::cursorFrameCallback() QWaylandInputDevice::Touch::Touch(QWaylandInputDevice *p) : mParent(p) { + init(p->get_touch()); } QWaylandInputDevice::Touch::~Touch() @@ -423,14 +426,12 @@ void QWaylandInputDevice::seat_capabilities(uint32_t caps) if (caps & WL_SEAT_CAPABILITY_KEYBOARD && !mKeyboard) { mKeyboard.reset(createKeyboard(this)); - mKeyboard->init(get_keyboard()); } else if (!(caps & WL_SEAT_CAPABILITY_KEYBOARD) && mKeyboard) { mKeyboard.reset(); } if (caps & WL_SEAT_CAPABILITY_POINTER && !mPointer) { mPointer.reset(createPointer(this)); - mPointer->init(get_pointer()); auto *pointerGestures = mQDisplay->pointerGestures(); if (pointerGestures) { @@ -453,7 +454,6 @@ void QWaylandInputDevice::seat_capabilities(uint32_t caps) if (caps & WL_SEAT_CAPABILITY_TOUCH && !mTouch) { mTouch.reset(createTouch(this)); - mTouch->init(get_touch()); if (!mTouchDevice) { // TODO number of touchpoints, actual name and ID From 6ef8bfd8912063d5fd31787724355f22f6526553 Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Wed, 31 May 2023 12:41:42 +0100 Subject: [PATCH 1191/1507] Update wayland protocol XML to version 1.22.0 This updates only the protocol definition, implementations will need additional commits to opt into using them. The upstream XML specification changed in a way that requires newer libwayland to generate without warnings in strict mode. To support older setups the strict argument to wayland-scanner has been removed. Change-Id: I265a9e208bbf107895b493b952d65f6178ac76e7 Reviewed-by: Eskil Abrahamsen Blomfeldt Reviewed-by: Qt CI Bot --- src/3rdparty/wayland/protocols/wayland.xml | 159 ++++++++++++++---- .../Qt6WaylandClientMacros.cmake | 4 +- .../Qt6WaylandCompositorMacros.cmake | 4 +- 3 files changed, 130 insertions(+), 37 deletions(-) diff --git a/src/3rdparty/wayland/protocols/wayland.xml b/src/3rdparty/wayland/protocols/wayland.xml index 01bc267a7cb..10e039d6ecc 100644 --- a/src/3rdparty/wayland/protocols/wayland.xml +++ b/src/3rdparty/wayland/protocols/wayland.xml @@ -177,9 +177,12 @@ Clients can handle the 'done' event to get notified when the related request is done. + + Note, because wl_callback objects are created from multiple independent + factory interfaces, the wl_callback interface is frozen at version 1. - + Notify the client when the related request is done. @@ -187,7 +190,7 @@ - + A compositor. This object is a singleton global. The compositor is in charge of combining the contents of multiple @@ -453,6 +456,9 @@ If the buffer uses a format that has an alpha channel, the alpha channel is assumed to be premultiplied in the color channels unless otherwise specified. + + Note, because wl_buffer objects are created from multiple independent + factory interfaces, the wl_buffer interface is frozen at version 1. @@ -624,8 +630,9 @@ This event indicates the actions offered by the data source. It - will be sent right after wl_data_device.enter, or anytime the source - side changes its offered actions through wl_data_source.set_actions. + will be sent immediately after creating the wl_data_offer object, + or anytime the source side changes its offered actions through + wl_data_source.set_actions. @@ -867,11 +874,8 @@ a drag-and-drop icon. If the icon surface already has another role, it raises a protocol error. - The current and pending input regions of the icon wl_surface are - cleared, and wl_surface.set_input_region is ignored until the - wl_surface is no longer used as the icon surface. When the use - as an icon ends, the current and pending input regions become - undefined, and the wl_surface is unmapped. + The input region is ignored for wl_surfaces with the role of a + drag-and-drop icon. @@ -1352,7 +1356,7 @@ - + A surface is a rectangular area that may be displayed on zero or more outputs, and shown any number of times at the compositor's @@ -1384,8 +1388,9 @@ that this request gives a role to a wl_surface. Often, this request also creates a new protocol object that represents the role and adds additional functionality to wl_surface. When a - client wants to destroy a wl_surface, they must destroy this 'role - object' before the wl_surface. + client wants to destroy a wl_surface, they must destroy this role + object before the wl_surface, otherwise a defunct_role_object error is + sent. Destroying the role object does not remove the role from the wl_surface, but it may stop the wl_surface from "playing the role". @@ -1405,6 +1410,8 @@ + @@ -1433,8 +1440,9 @@ When the bound wl_surface version is 5 or higher, passing any non-zero x or y is a protocol violation, and will result in an - 'invalid_offset' error being raised. To achieve equivalent semantics, - use wl_surface.offset. + 'invalid_offset' error being raised. The x and y arguments are ignored + and do not change the pending state. To achieve equivalent semantics, + use wl_surface.offset. Surface contents are double-buffered state, see wl_surface.commit. @@ -1786,9 +1794,37 @@ + + + + + + This event indicates the preferred buffer scale for this surface. It is + sent whenever the compositor's preference changes. + + It is intended that scaling aware clients use this event to scale their + content and use wl_surface.set_buffer_scale to indicate the scale they + have rendered with. This allows clients to supply a higher detail + buffer. + + + + + + + This event indicates the preferred buffer transform for this surface. + It is sent whenever the compositor's preference changes. + + It is intended that transform aware clients use this event to apply the + transform to their content and use wl_surface.set_buffer_transform to + indicate the transform they have rendered with. + + + - + A seat is a group of keyboards, pointer and touch devices. This object is published as a global during start up, or when such a @@ -1921,7 +1957,7 @@ - + The wl_pointer interface represents one or more input devices, such as mice, which control the pointer location and pointer_focus @@ -1965,11 +2001,9 @@ pointer surface to this request with new values for hotspot_x and hotspot_y. - The current and pending input regions of the wl_surface are - cleared, and wl_surface.set_input_region is ignored until the - wl_surface is no longer used as the cursor. When the use as a - cursor ends, the current and pending input regions become - undefined, and the wl_surface is unmapped. + The input region is ignored for wl_surfaces with the role of + a cursor. When the use as a cursor ends, the wl_surface is + unmapped. The serial parameter must match the latest wl_pointer.enter serial number sent to the client. Otherwise the request will be @@ -2278,9 +2312,65 @@ + + + + + + This specifies the direction of the physical motion that caused a + wl_pointer.axis event, relative to the wl_pointer.axis direction. + + + + + + + + Relative directional information of the entity causing the axis + motion. + + For a wl_pointer.axis event, the wl_pointer.axis_relative_direction + event specifies the movement direction of the entity causing the + wl_pointer.axis event. For example: + - if a user's fingers on a touchpad move down and this + causes a wl_pointer.axis vertical_scroll down event, the physical + direction is 'identical' + - if a user's fingers on a touchpad move down and this causes a + wl_pointer.axis vertical_scroll up scroll up event ('natural + scrolling'), the physical direction is 'inverted'. + + A client may use this information to adjust scroll motion of + components. Specifically, enabling natural scrolling causes the + content to change direction compared to traditional scrolling. + Some widgets like volume control sliders should usually match the + physical direction regardless of whether natural scrolling is + active. This event enables clients to match the scroll direction of + a widget to the physical direction. + + This event does not occur on its own, it is coupled with a + wl_pointer.axis event that represents this axis value. + The protocol guarantees that each axis_relative_direction event is + always followed by exactly one axis event with the same + axis number within the same wl_pointer.frame. Note that the protocol + allows for other events to occur between the axis_relative_direction + and its coupled axis event. + + The axis number is identical to the axis number in the associated + axis event. + + The order of wl_pointer.axis_relative_direction, + wl_pointer.axis_discrete and wl_pointer.axis_source is not + guaranteed. + + + + - + The wl_keyboard interface represents one or more keyboards associated with a seat. @@ -2407,7 +2497,7 @@ - + The wl_touch interface represents a touchscreen associated with a seat. @@ -2861,6 +2951,8 @@ + @@ -2870,14 +2962,18 @@ plain wl_surface into a sub-surface. The to-be sub-surface must not already have another role, and it - must not have an existing wl_subsurface object. Otherwise a protocol - error is raised. + must not have an existing wl_subsurface object. Otherwise the + bad_surface protocol error is raised. Adding sub-surfaces to a parent is a double-buffered operation on the parent (see wl_surface.commit). The effect of adding a sub-surface becomes visible on the next time the state of the parent surface is applied. + The parent surface must not be one of the child surface's descendants, + and the parent must be different from the child surface, otherwise the + bad_parent protocol error is raised. + This request modifies the behaviour of wl_surface.commit request on the sub-surface, see the documentation on wl_subsurface interface. @@ -2932,12 +3028,10 @@ synchronized mode, and then assume that all its child and grand-child sub-surfaces are synchronized, too, without explicitly setting them. - If the wl_surface associated with the wl_subsurface is destroyed, the - wl_subsurface object becomes inert. Note, that destroying either object - takes effect immediately. If you need to synchronize the removal - of a sub-surface to the parent surface update, unmap the sub-surface - first by attaching a NULL wl_buffer, update parent, and then destroy - the sub-surface. + Destroying a sub-surface takes effect immediately. If you need to + synchronize the removal of a sub-surface to the parent surface update, + unmap the sub-surface first by attaching a NULL wl_buffer, update parent, + and then destroy the sub-surface. If the parent wl_surface object is destroyed, the sub-surface is unmapped. @@ -2948,8 +3042,7 @@ The sub-surface interface is removed from the wl_surface object that was turned into a sub-surface with a wl_subcompositor.get_subsurface request. The wl_surface's association - to the parent is deleted, and the wl_surface loses its role as - a sub-surface. The wl_surface is unmapped immediately. + to the parent is deleted. The wl_surface is unmapped immediately. diff --git a/src/tools/qtwaylandscanner/Qt6WaylandClientMacros.cmake b/src/tools/qtwaylandscanner/Qt6WaylandClientMacros.cmake index c7ac085242c..485322e6ae9 100644 --- a/src/tools/qtwaylandscanner/Qt6WaylandClientMacros.cmake +++ b/src/tools/qtwaylandscanner/Qt6WaylandClientMacros.cmake @@ -37,13 +37,13 @@ function(qt6_generate_wayland_protocol_client_sources target) add_custom_command( OUTPUT "${waylandscanner_header_output}" #TODO: Maybe put the files in ${CMAKE_CURRENT_BINARY_DIR/wayland_generated instead? - COMMAND Wayland::Scanner --strict ${waylandscanner_extra_args} client-header < "${protocol_file}" > "${waylandscanner_header_output}" + COMMAND Wayland::Scanner ${waylandscanner_extra_args} client-header < "${protocol_file}" > "${waylandscanner_header_output}" DEPENDS ${protocol_file} Wayland::Scanner ) add_custom_command( OUTPUT "${waylandscanner_code_output}" - COMMAND Wayland::Scanner --strict ${waylandscanner_extra_args} public-code < "${protocol_file}" > "${waylandscanner_code_output}" + COMMAND Wayland::Scanner ${waylandscanner_extra_args} public-code < "${protocol_file}" > "${waylandscanner_code_output}" DEPENDS ${protocol_file} Wayland::Scanner ) diff --git a/src/tools/qtwaylandscanner/Qt6WaylandCompositorMacros.cmake b/src/tools/qtwaylandscanner/Qt6WaylandCompositorMacros.cmake index 3221f815b72..05d16af6cb0 100644 --- a/src/tools/qtwaylandscanner/Qt6WaylandCompositorMacros.cmake +++ b/src/tools/qtwaylandscanner/Qt6WaylandCompositorMacros.cmake @@ -33,12 +33,12 @@ function(qt6_generate_wayland_protocol_server_sources target) add_custom_command( OUTPUT "${waylandscanner_header_output}" #TODO: Maybe put the files in ${CMAKE_CURRENT_BINARY_DIR/wayland_generated instead? - COMMAND Wayland::Scanner --strict --include-core-only server-header < "${protocol_file}" > "${waylandscanner_header_output}" + COMMAND Wayland::Scanner --include-core-only server-header < "${protocol_file}" > "${waylandscanner_header_output}" DEPENDS ${protocol_file} Wayland::Scanner ) add_custom_command( OUTPUT "${waylandscanner_code_output}" - COMMAND Wayland::Scanner --strict --include-core-only public-code < "${protocol_file}" > "${waylandscanner_code_output}" + COMMAND Wayland::Scanner --include-core-only public-code < "${protocol_file}" > "${waylandscanner_code_output}" DEPENDS ${protocol_file} Wayland::Scanner ) From 7238199c8455b42bd52369c04b6496f242dc581c Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Wed, 12 Apr 2023 22:55:32 +0100 Subject: [PATCH 1192/1507] Client: Remove check for BypassWindowManagerHint when setting viewport This check was put in initially to leave a code path for clients to opt-out of Qt controlled viewport management. In practice, many X11 applications have this flag set for other purposes and this does more harm than good. Given this was never a documented feature, and it won't have been used in practice given fractional scaling is not heavily deployed outside a few linux desktops it is safe to remove. The highDpiScaleFactorRoundingPolicy remains a way to opt-out. Pick-to: 6.5 Change-Id: I2d111a76695dec27e9ee1a2a233252b70379a329 Reviewed-by: Eskil Abrahamsen Blomfeldt Reviewed-by: Vlad Zahorodnii --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index e3070c9363a..d4a499cce11 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -186,7 +186,7 @@ void QWaylandWindow::initWindow() } } - if (display()->viewporter() && !window()->flags().testFlag(Qt::BypassWindowManagerHint)) { + if (display()->viewporter()) { mViewport.reset(new QWaylandViewport(display()->createViewport(this))); } From 5043973b14e9cc77bd8f4a199c25f36c5f951b8e Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Thu, 18 May 2023 13:45:13 +0300 Subject: [PATCH 1193/1507] client: Clamp fractional scaling to be >= 1.0 Whilst the fractional scaling protocol supports values less than 100%, Qt does not. In this case we should continue using 100% and let the compositor take care of making it smaller. Change-Id: Iaec32adc80aa37f441be37b39e3e0afcbf29136b Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index d4a499cce11..505836296c4 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -105,16 +105,18 @@ void QWaylandWindow::initWindow() if (mDisplay->fractionalScaleManager() && qApp->highDpiScaleFactorRoundingPolicy() == Qt::HighDpiScaleFactorRoundingPolicy::PassThrough) { mFractionalScale.reset(new QWaylandFractionalScale(mDisplay->fractionalScaleManager()->get_fractional_scale(mSurface->object()))); - if (mScale != mFractionalScale->preferredScale()) { - mScale = mFractionalScale->preferredScale(); + qreal preferredScale = std::max(1.0, mFractionalScale->preferredScale()); + if (mScale != preferredScale) { + mScale = preferredScale; QWindowSystemInterface::handleWindowDevicePixelRatioChanged(window()); } connect(mFractionalScale.data(), &QWaylandFractionalScale::preferredScaleChanged, this, [this]() { - if (mScale == mFractionalScale->preferredScale()) { + qreal preferredScale = std::max(1.0, mFractionalScale->preferredScale()); + if (mScale == preferredScale) { return; } - mScale = mFractionalScale->preferredScale(); + mScale = preferredScale; QWindowSystemInterface::handleWindowDevicePixelRatioChanged(window()); ensureSize(); if (mViewport) From 4cfd0da3d914822c76824d0bde4953b40794cb2a Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Fri, 31 Mar 2023 10:15:08 +0100 Subject: [PATCH 1194/1507] Client: Guard our surface from being destroyed whilst rendering from Vulkan Change-Id: Ibac173b769186b49251bad9b94c71b9ccea26a7e Reviewed-by: Eskil Abrahamsen Blomfeldt Reviewed-by: Qt CI Bot --- .../wayland/qwaylandvulkaninstance.cpp | 20 +++++++++++++++++++ .../wayland/qwaylandvulkaninstance_p.h | 3 +++ 2 files changed, 23 insertions(+) diff --git a/src/plugins/platforms/wayland/qwaylandvulkaninstance.cpp b/src/plugins/platforms/wayland/qwaylandvulkaninstance.cpp index 2f95ff3077a..be55130a422 100644 --- a/src/plugins/platforms/wayland/qwaylandvulkaninstance.cpp +++ b/src/plugins/platforms/wayland/qwaylandvulkaninstance.cpp @@ -101,6 +101,26 @@ void QWaylandVulkanInstance::presentAboutToBeQueued(QWindow *window) w->handleUpdate(); } +void QWaylandVulkanInstance::beginFrame(QWindow *window) +{ + auto *w = static_cast(window->handle()); + if (!w) { + qWarning() << "Attempted to call beginFrame() without a valid platform window"; + return; + } + w->beginFrame(); +} + +void QWaylandVulkanInstance::endFrame(QWindow *window) +{ + auto *w = static_cast(window->handle()); + if (!w) { + qWarning() << "Attempted to call endFrame() without a valid platform window"; + return; + } + w->endFrame(); +} + } // namespace QtWaylandClient QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandvulkaninstance_p.h b/src/plugins/platforms/wayland/qwaylandvulkaninstance_p.h index abeca95db1c..7683ce5664e 100644 --- a/src/plugins/platforms/wayland/qwaylandvulkaninstance_p.h +++ b/src/plugins/platforms/wayland/qwaylandvulkaninstance_p.h @@ -42,6 +42,9 @@ public: VkSurfaceKHR createSurface(QWaylandWindow *window); + void beginFrame(QWindow *window) override; + void endFrame(QWindow *window) override; + private: QVulkanInstance *m_instance = nullptr; PFN_vkGetPhysicalDeviceWaylandPresentationSupportKHR m_getPhysDevPresSupport = nullptr; From 883cfa228332465b6aa1023f0787927187c828e6 Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Thu, 11 May 2023 12:26:15 +0300 Subject: [PATCH 1195/1507] client: Implement cursor_shape_v1 A new wayland protocol allows clients to specify the cursor being used rather than load themes and attach buffers. Short term this has better behavior for scaling. Long term when this has universal compositor support we can drop the theme loading code. Change-Id: I119e1ca44d351e7b13b8ec56f2218d94b7da0705 Reviewed-by: Vlad Zahorodnii Reviewed-by: Eskil Abrahamsen Blomfeldt --- .../wayland/protocols/cursor-shape-v1.xml | 146 ++++++++++++++++++ src/plugins/platforms/wayland/CMakeLists.txt | 1 + .../platforms/wayland/qwaylandcursor.cpp | 72 +++++++++ .../platforms/wayland/qwaylandcursor_p.h | 9 ++ .../platforms/wayland/qwaylanddisplay.cpp | 3 + .../platforms/wayland/qwaylanddisplay_p.h | 5 +- .../platforms/wayland/qwaylandinputdevice.cpp | 9 ++ .../platforms/wayland/qwaylandinputdevice_p.h | 2 + tests/auto/wayland/CMakeLists.txt | 1 + tests/auto/wayland/cursor/CMakeLists.txt | 11 ++ tests/auto/wayland/cursor/cursorshapev1.cpp | 47 ++++++ tests/auto/wayland/cursor/cursorshapev1.h | 44 ++++++ tests/auto/wayland/cursor/tst_cursor.cpp | 89 +++++++++++ tests/auto/wayland/shared/CMakeLists.txt | 1 + tests/auto/wayland/shared/coreprotocol.cpp | 18 ++- 15 files changed, 450 insertions(+), 8 deletions(-) create mode 100644 src/3rdparty/wayland/protocols/cursor-shape-v1.xml create mode 100644 tests/auto/wayland/cursor/CMakeLists.txt create mode 100644 tests/auto/wayland/cursor/cursorshapev1.cpp create mode 100644 tests/auto/wayland/cursor/cursorshapev1.h create mode 100644 tests/auto/wayland/cursor/tst_cursor.cpp diff --git a/src/3rdparty/wayland/protocols/cursor-shape-v1.xml b/src/3rdparty/wayland/protocols/cursor-shape-v1.xml new file mode 100644 index 00000000000..b6fbe08b78f --- /dev/null +++ b/src/3rdparty/wayland/protocols/cursor-shape-v1.xml @@ -0,0 +1,146 @@ + + + + Copyright 2018 The Chromium Authors + Copyright 2023 Simon Ser + + 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. + + + + + This global allows clients to set cursor images by name instead of + creating and attaching buffers. + + Warning! The protocol described in this file is currently in the testing + phase. Backward compatible changes may be added together with the + corresponding interface version bump. Backward incompatible changes can + only be done by creating a new major version of the extension. + + + + + Destroy the cursor shape manager. + + + + + + Obtain a wp_cursor_shape_device_v1 for a wl_pointer object. + + + + + + + + Obtain a wp_cursor_shape_device_v1 for a zwp_tablet_tool_v2 object. + + + + + + + + + This interface advertises the list of supported cursor shapes for a + device, and allows clients to set the cursor shape. + + + + + This enum describes cursor shapes. + + The names are taken from the CSS W3C specification: + https://w3c.github.io/csswg-drafts/css-ui/#cursor + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Destroy the cursor shape device. + + The device cursor shape remains unchanged. + + + + + + Sets the device cursor to the specified shape. The compositor will + change the cursor image based on the specified shape. + + The cursor actually changes only if the input device focus is one of + the requesting client's surfaces. If any, the previous cursor image + (surface or shape) is replaced. + + The "shape" argument must be a valid enum entry, otherwise the + invalid_shape protocol error is raised. + + This is similar to the wl_pointer.set_cursor and + zwp_tablet_tool_v2.set_cursor requests, but this request accepts a + shape instead of contents in the form of a surface. Clients can mix + set_cursor and set_shape requests. + + The serial parameter must match the latest wl_pointer.enter or + zwp_tablet_tool_v2.proximity_in serial number sent to the client. + Otherwise the request will be ignored. + + + + + + diff --git a/src/plugins/platforms/wayland/CMakeLists.txt b/src/plugins/platforms/wayland/CMakeLists.txt index 47312010fed..d42259fc0c0 100644 --- a/src/plugins/platforms/wayland/CMakeLists.txt +++ b/src/plugins/platforms/wayland/CMakeLists.txt @@ -82,6 +82,7 @@ qt_internal_add_module(WaylandClient qt6_generate_wayland_protocol_client_sources(WaylandClient FILES + ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/cursor-shape-v1.xml ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/pointer-gestures-unstable-v1.xml ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/tablet-unstable-v2.xml ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/text-input-unstable-v1.xml diff --git a/src/plugins/platforms/wayland/qwaylandcursor.cpp b/src/plugins/platforms/wayland/qwaylandcursor.cpp index ec17ed21813..83b240ce5c7 100644 --- a/src/plugins/platforms/wayland/qwaylandcursor.cpp +++ b/src/plugins/platforms/wayland/qwaylandcursor.cpp @@ -1,4 +1,5 @@ // Copyright (C) 2016 The Qt Company Ltd. +// Copyright (C) 2023 David Edmundson // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "qwaylandcursor_p.h" @@ -206,6 +207,77 @@ wl_cursor *QWaylandCursorTheme::requestCursor(WaylandCursor shape) return waylandCursor; } +QWaylandCursorShape::QWaylandCursorShape(::wp_cursor_shape_device_v1 *object) + : QtWayland::wp_cursor_shape_device_v1(object) +{} + +QWaylandCursorShape::~QWaylandCursorShape() +{ + destroy(); +} + +static QtWayland::wp_cursor_shape_device_v1::shape qtCursorShapeToWaylandShape(Qt::CursorShape cursorShape) +{ + using QtWayland::wp_cursor_shape_device_v1; + + switch (cursorShape) { + case Qt::BlankCursor: + case Qt::CustomCursor: + case Qt::BitmapCursor: + // these should have been handled separately before using the shape protocol + Q_ASSERT(false); + break; + case Qt::ArrowCursor: + return wp_cursor_shape_device_v1::shape_default; + case Qt::SizeVerCursor: + return wp_cursor_shape_device_v1::shape_ns_resize; + case Qt::UpArrowCursor: + return wp_cursor_shape_device_v1::shape_n_resize; + case Qt::SizeHorCursor: + return wp_cursor_shape_device_v1::shape_ew_resize; + case Qt::CrossCursor: + return wp_cursor_shape_device_v1::shape_crosshair; + case Qt::SizeBDiagCursor: + return wp_cursor_shape_device_v1::shape_nesw_resize; + case Qt::IBeamCursor: + return wp_cursor_shape_device_v1::shape_text; + case Qt::SizeFDiagCursor: + return wp_cursor_shape_device_v1::shape_nwse_resize; + case Qt::WaitCursor: + return wp_cursor_shape_device_v1::shape_progress; + case Qt::SizeAllCursor: + return wp_cursor_shape_device_v1::shape_all_scroll; + case Qt::BusyCursor: + return wp_cursor_shape_device_v1::shape_wait; + case Qt::SplitVCursor: + return wp_cursor_shape_device_v1::shape_row_resize; + case Qt::ForbiddenCursor: + return wp_cursor_shape_device_v1::shape_not_allowed; + case Qt::SplitHCursor: + return wp_cursor_shape_device_v1::shape_col_resize; + case Qt::PointingHandCursor: + return wp_cursor_shape_device_v1::shape_pointer; + case Qt::OpenHandCursor: + return wp_cursor_shape_device_v1::shape_grab; + case Qt::WhatsThisCursor: + return wp_cursor_shape_device_v1::shape_help; + case Qt::ClosedHandCursor: + return wp_cursor_shape_device_v1::shape_grabbing; + case Qt::DragMoveCursor: + case Qt::DragCopyCursor: + case Qt::DragLinkCursor: + // drags on wayland are different, the compositor knows + // the drag type and can do something custom + return wp_cursor_shape_device_v1::shape_grab; + } + return wp_cursor_shape_device_v1::shape_default; +} + +void QWaylandCursorShape::setShape(uint32_t serial, Qt::CursorShape shape) +{ + set_shape(serial, qtCursorShapeToWaylandShape(shape)); +} + QWaylandCursor::QWaylandCursor(QWaylandDisplay *display) : mDisplay(display) { diff --git a/src/plugins/platforms/wayland/qwaylandcursor_p.h b/src/plugins/platforms/wayland/qwaylandcursor_p.h index 2334c88d902..8f4a5b7e570 100644 --- a/src/plugins/platforms/wayland/qwaylandcursor_p.h +++ b/src/plugins/platforms/wayland/qwaylandcursor_p.h @@ -18,6 +18,7 @@ #include #include #include +#include #include #if QT_CONFIG(cursor) @@ -87,6 +88,14 @@ protected: wl_cursor *m_cursors[NumWaylandCursors] = {}; }; +class Q_WAYLANDCLIENT_EXPORT QWaylandCursorShape : public QtWayland::wp_cursor_shape_device_v1 +{ +public: + QWaylandCursorShape(struct ::wp_cursor_shape_device_v1 *object); + ~QWaylandCursorShape(); + void setShape(uint32_t serial, Qt::CursorShape shape); +}; + class Q_WAYLANDCLIENT_EXPORT QWaylandCursor : public QPlatformCursor { public: diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index 911004f8b35..c49cb428a4f 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -52,6 +52,7 @@ #include #include #include +#include #include @@ -755,6 +756,8 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin mFractionalScaleManager.reset(new QtWayland::wp_fractional_scale_manager_v1(registry, id, 1)); } else if (interface == QLatin1String("wp_viewporter")) { mViewporter.reset(new QtWayland::wp_viewporter(registry, id, qMin(1u, version))); + } else if (interface == QLatin1String(QtWayland::wp_cursor_shape_manager_v1::interface()->name)) { + mCursorShapeManager.reset(new QtWayland::wp_cursor_shape_manager_v1(registry, id, std::min(1u, version))); } mGlobals.append(RegistryGlobal(id, interface, version, registry)); diff --git a/src/plugins/platforms/wayland/qwaylanddisplay_p.h b/src/plugins/platforms/wayland/qwaylanddisplay_p.h index 93d4b1d90dc..877ff9692a5 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay_p.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay_p.h @@ -51,8 +51,9 @@ namespace QtWayland { class zwp_text_input_manager_v2; class zwp_text_input_manager_v4; class qt_text_input_method_manager_v1; - class wp_viewporter; + class wp_cursor_shape_manager_v1; class wp_fractional_scale_manager_v1; + class wp_viewporter; } namespace QtWaylandClient { @@ -152,6 +153,7 @@ public: QWaylandXdgOutputManagerV1 *xdgOutputManager() const { return mXdgOutputManager.data(); } QtWayland::wp_fractional_scale_manager_v1 *fractionalScaleManager() const { return mFractionalScaleManager.data(); } QtWayland::wp_viewporter *viewporter() const { return mViewporter.data(); } + QtWayland::wp_cursor_shape_manager_v1 *cursorShapeManager() const { return mCursorShapeManager.data();} struct RegistryGlobal { uint32_t id; @@ -277,6 +279,7 @@ private: QScopedPointer mXdgOutputManager; QScopedPointer mViewporter; QScopedPointer mFractionalScaleManager; + QScopedPointer mCursorShapeManager; int mFd = -1; int mWritableNotificationFd = -1; QList mGlobals; diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index 24c86a0cf70..b39e3a9755d 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -127,6 +127,10 @@ QWaylandInputDevice::Pointer::Pointer(QWaylandInputDevice *seat) { init(seat->get_pointer()); #if QT_CONFIG(cursor) + if (auto cursorShapeManager = seat->mQDisplay->cursorShapeManager()) { + mCursor.shape.reset(new QWaylandCursorShape(cursorShapeManager->get_pointer(object()))); + } + mCursor.frameTimer.setSingleShot(true); mCursor.frameTimer.callOnTimeout([&]() { cursorTimerCallback(); @@ -303,6 +307,11 @@ void QWaylandInputDevice::Pointer::updateCursor() return; } + if (mCursor.shape) { + mCursor.shape->setShape(mEnterSerial, shape); + return; + } + if (!mCursor.theme || idealCursorScale() != mCursor.themeBufferScale) updateCursorTheme(); diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h index 115b39a8896..d41d885f3d5 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h +++ b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h @@ -64,6 +64,7 @@ class QWaylandTextInputInterface; class QWaylandTextInputMethod; #if QT_CONFIG(cursor) class QWaylandCursorTheme; +class QWaylandCursorShape; class CursorSurface; #endif @@ -323,6 +324,7 @@ public: uint32_t mEnterSerial = 0; #if QT_CONFIG(cursor) struct { + QScopedPointer shape; QWaylandCursorTheme *theme = nullptr; int themeBufferScale = 0; QScopedPointer surface; diff --git a/tests/auto/wayland/CMakeLists.txt b/tests/auto/wayland/CMakeLists.txt index 5ae005eaafe..79bcd442e4a 100644 --- a/tests/auto/wayland/CMakeLists.txt +++ b/tests/auto/wayland/CMakeLists.txt @@ -10,6 +10,7 @@ add_subdirectory(shared) if (NOT WEBOS) add_subdirectory(client) add_subdirectory(clientextension) + add_subdirectory(cursor) add_subdirectory(datadevicev1) add_subdirectory(fullscreenshellv1) add_subdirectory(iviapplication) diff --git a/tests/auto/wayland/cursor/CMakeLists.txt b/tests/auto/wayland/cursor/CMakeLists.txt new file mode 100644 index 00000000000..93783994e77 --- /dev/null +++ b/tests/auto/wayland/cursor/CMakeLists.txt @@ -0,0 +1,11 @@ +##################################################################### +## tst_cursor Test: +##################################################################### + +qt_internal_add_test(tst_cursor + SOURCES + tst_cursor.cpp + cursorshapev1.cpp + LIBRARIES + SharedClientTest +) diff --git a/tests/auto/wayland/cursor/cursorshapev1.cpp b/tests/auto/wayland/cursor/cursorshapev1.cpp new file mode 100644 index 00000000000..7fd93ed1d3b --- /dev/null +++ b/tests/auto/wayland/cursor/cursorshapev1.cpp @@ -0,0 +1,47 @@ +// Copyright (C) 2023 David Edmundson +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#include "cursorshapev1.h" + +namespace MockCompositor { + +CursorShapeManager::CursorShapeManager(CoreCompositor *compositor, int version) + : QtWaylandServer::wp_cursor_shape_manager_v1(compositor->m_display, version) +{ +} + +void CursorShapeManager::wp_cursor_shape_manager_v1_get_pointer(Resource *resource, uint32_t id, wl_resource *pointer) +{ + auto *p = fromResource(pointer); + auto *cursorShape = new CursorShapeDevice(p, resource->client(), id, resource->version()); + connect(cursorShape, &QObject::destroyed, this, [this, cursorShape]() { + m_cursorDevices.removeOne(cursorShape); + }); + m_cursorDevices << cursorShape; +} + +CursorShapeDevice::CursorShapeDevice(Pointer *pointer, wl_client *client, int id, int version) + : QtWaylandServer::wp_cursor_shape_device_v1(client, id, version) + , m_pointer(pointer) +{ +} + +void CursorShapeDevice::wp_cursor_shape_device_v1_destroy_resource(Resource *resource) +{ + Q_UNUSED(resource) + delete this; +} + +void CursorShapeDevice::wp_cursor_shape_device_v1_destroy(Resource *resource) +{ + wl_resource_destroy(resource->handle); +} + +void CursorShapeDevice::wp_cursor_shape_device_v1_set_shape(Resource *resource, uint32_t serial, uint32_t shape) +{ + Q_UNUSED(resource); + m_currentShape = static_cast(shape); + emit setCursor(serial); +} + +} diff --git a/tests/auto/wayland/cursor/cursorshapev1.h b/tests/auto/wayland/cursor/cursorshapev1.h new file mode 100644 index 00000000000..a8c2376aee7 --- /dev/null +++ b/tests/auto/wayland/cursor/cursorshapev1.h @@ -0,0 +1,44 @@ +// Copyright (C) 2023 David Edmundson +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 + +#ifndef MOCKCOMPOSITOR_CURSORSHAPE_H +#define MOCKCOMPOSITOR_CURSORSHAPE_H + +#include "coreprotocol.h" +#include + +namespace MockCompositor { + +class CursorShapeDevice; + +class CursorShapeManager : public Global, public QtWaylandServer::wp_cursor_shape_manager_v1 +{ + Q_OBJECT +public: + explicit CursorShapeManager(CoreCompositor *compositor, int version = 1); + QList m_cursorDevices; + +protected: + void wp_cursor_shape_manager_v1_get_pointer(Resource *resource, uint32_t id, wl_resource *pointer) override; +}; + +class CursorShapeDevice : public QObject, public QtWaylandServer::wp_cursor_shape_device_v1 +{ + Q_OBJECT +public: + explicit CursorShapeDevice(Pointer *pointer, wl_client *client, int id, int version); + Pointer *m_pointer; + shape m_currentShape = shape_default; + +Q_SIGNALS: + void setCursor(uint serial); + +protected: + void wp_cursor_shape_device_v1_destroy_resource(Resource *resource) override; + void wp_cursor_shape_device_v1_destroy(Resource *resource) override; + void wp_cursor_shape_device_v1_set_shape(Resource *resource, uint32_t serial, uint32_t shape) override; +}; + +} + +#endif diff --git a/tests/auto/wayland/cursor/tst_cursor.cpp b/tests/auto/wayland/cursor/tst_cursor.cpp new file mode 100644 index 00000000000..65bafb23eca --- /dev/null +++ b/tests/auto/wayland/cursor/tst_cursor.cpp @@ -0,0 +1,89 @@ +// Copyright (C) 2023 David Edmundson +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#include "mockcompositor.h" +#include +#include +#include +#include + +#include "cursorshapev1.h" + +using namespace MockCompositor; + +class tst_cursor : public QObject, private DefaultCompositor +{ + Q_OBJECT +public: + tst_cursor(); + CursorShapeDevice* cursorShape(); +private slots: + void init(); + void cleanup() { QTRY_VERIFY2(isClean(), qPrintable(dirtyMessage())); } + void setCursor(); +}; + +tst_cursor::tst_cursor() +{ + exec([this] { + m_config.autoConfigure = true; + add(1); + }); +} + +CursorShapeDevice* tst_cursor::cursorShape() +{ + auto manager = get(); + if (!manager->m_cursorDevices.count()) + return nullptr; + return manager->m_cursorDevices[0]; +} + +void tst_cursor::init() +{ + setenv("QT_WAYLAND_DISABLE_WINDOWDECORATION", "1", 1); +} + +void tst_cursor::setCursor() +{ + QCOMPOSITOR_TRY_VERIFY(cursorShape()); + QSignalSpy setCursorSpy(exec([&] { return pointer(); }), &Pointer::setCursor); + QSignalSpy setCursorShapeSpy(exec([&] { return cursorShape(); }), &CursorShapeDevice::setCursor); + + QRasterWindow window; + window.resize(64, 64); + window.show(); + QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial); + + uint enterSerial = exec([&] { + return pointer()->sendEnter(xdgSurface()->m_surface, {32, 32}); + }); + setCursorShapeSpy.wait(); + // verify we got given a cursor on enter + QCOMPOSITOR_COMPARE(cursorShape()->m_currentShape, CursorShapeDevice::shape_default); + QVERIFY(setCursorSpy.isEmpty()); + QCOMPARE(setCursorShapeSpy.takeFirst().at(0).toUInt(), enterSerial); + + // client sets a different shape + window.setCursor(QCursor(Qt::BusyCursor)); + QCOMPOSITOR_TRY_COMPARE(cursorShape()->m_currentShape, CursorShapeDevice::shape_wait); + + setCursorShapeSpy.clear(); + + // client hides the cursor + // CursorShape will not be used, instead, it uses the old path + window.setCursor(QCursor(Qt::BlankCursor)); + QVERIFY(setCursorSpy.wait()); + QVERIFY(setCursorShapeSpy.isEmpty()); + QCOMPOSITOR_VERIFY(!pointer()->cursorSurface()); + + // same for bitmaps + QPixmap myCustomPixmap(10, 10); + myCustomPixmap.fill(Qt::red); + window.setCursor(QCursor(myCustomPixmap)); + QVERIFY(setCursorSpy.wait()); + QVERIFY(setCursorShapeSpy.isEmpty()); +} + +QCOMPOSITOR_TEST_MAIN(tst_cursor) +#include "tst_cursor.moc" diff --git a/tests/auto/wayland/shared/CMakeLists.txt b/tests/auto/wayland/shared/CMakeLists.txt index a1f150c2245..ee81b4d6866 100644 --- a/tests/auto/wayland/shared/CMakeLists.txt +++ b/tests/auto/wayland/shared/CMakeLists.txt @@ -39,6 +39,7 @@ add_library(SharedClientTest qt6_generate_wayland_protocol_server_sources(SharedClientTest FILES + ${PROJECT_SOURCE_DIR}/src/3rdparty/protocol/cursor-shape-v1.xml ${PROJECT_SOURCE_DIR}/src/3rdparty/protocol/fullscreen-shell-unstable-v1.xml ${PROJECT_SOURCE_DIR}/src/3rdparty/protocol/ivi-application.xml ${PROJECT_SOURCE_DIR}/src/3rdparty/protocol/wp-primary-selection-unstable-v1.xml diff --git a/tests/auto/wayland/shared/coreprotocol.cpp b/tests/auto/wayland/shared/coreprotocol.cpp index 15be62ccb9f..64586d413de 100644 --- a/tests/auto/wayland/shared/coreprotocol.cpp +++ b/tests/auto/wayland/shared/coreprotocol.cpp @@ -435,15 +435,19 @@ void Pointer::sendAxisValue120(wl_client *client, QtWaylandServer::wl_pointer::a void Pointer::pointer_set_cursor(Resource *resource, uint32_t serial, wl_resource *surface, int32_t hotspot_x, int32_t hotspot_y) { Q_UNUSED(resource); - auto *s = fromResource(surface); - QVERIFY(s); - if (s->m_role) { - m_cursorRole = CursorRole::fromSurface(s); - QVERIFY(m_cursorRole); + if (!surface) { + m_cursorRole = nullptr; } else { - m_cursorRole = new CursorRole(s); //TODO: make sure we don't leak CursorRole - s->m_role = m_cursorRole; + auto *s = fromResource(surface); + QVERIFY(s); + if (s->m_role) { + m_cursorRole = CursorRole::fromSurface(s); + QVERIFY(m_cursorRole); + } else { + m_cursorRole = new CursorRole(s); //TODO: make sure we don't leak CursorRole + s->m_role = m_cursorRole; + } } // Directly checking the last serial would be racy, we may just have sent leaves/enters which From c6d402e02d124ac9629de33e7345eab5bd7706b4 Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Fri, 2 Jun 2023 09:19:10 +0200 Subject: [PATCH 1196/1507] Rename the tst_cursor CMake target It clashes with another tst_cursor in QtGui. Change-Id: I55118393a22a2323691f634f194558b1df33d2be Reviewed-by: David Edmundson --- tests/auto/wayland/cursor/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/wayland/cursor/CMakeLists.txt b/tests/auto/wayland/cursor/CMakeLists.txt index 93783994e77..a7814a2c2b9 100644 --- a/tests/auto/wayland/cursor/CMakeLists.txt +++ b/tests/auto/wayland/cursor/CMakeLists.txt @@ -2,7 +2,7 @@ ## tst_cursor Test: ##################################################################### -qt_internal_add_test(tst_cursor +qt_internal_add_test(tst_wayland_cursor SOURCES tst_cursor.cpp cursorshapev1.cpp From 8a48175f26038541dfc1186d938dc46edb6048ab Mon Sep 17 00:00:00 2001 From: David Redondo Date: Fri, 10 Mar 2023 16:47:19 +0100 Subject: [PATCH 1197/1507] client: Implement qt-toplevel-drag-v1 This protocol for tabs toolbars and dock widgets to be dragged in and out of a main window using an extended version of the drag and drop protocol. Application code in QtBase use a special internal mimedata to specify a window that should be associated with a drag. This is 1:1 match with the pending upstream proposal xdg-toplevel-drag, and can be switched when that lands. Change-Id: Idf0afb71cd98d45938b4641ce861484fffac911c Reviewed-by: David Edmundson --- .../wayland/protocols/qt-toplevel-drag-v1.xml | 83 +++++++++++++++++++ src/plugins/platforms/wayland/CMakeLists.txt | 2 + .../platforms/wayland/qwaylanddatadevice.cpp | 60 +++++++++++--- .../platforms/wayland/qwaylanddatadevice_p.h | 6 +- .../platforms/wayland/qwaylanddisplay.cpp | 4 + .../platforms/wayland/qwaylanddisplay_p.h | 3 + 6 files changed, 146 insertions(+), 12 deletions(-) create mode 100644 src/3rdparty/wayland/protocols/qt-toplevel-drag-v1.xml diff --git a/src/3rdparty/wayland/protocols/qt-toplevel-drag-v1.xml b/src/3rdparty/wayland/protocols/qt-toplevel-drag-v1.xml new file mode 100644 index 00000000000..72a22cbbde1 --- /dev/null +++ b/src/3rdparty/wayland/protocols/qt-toplevel-drag-v1.xml @@ -0,0 +1,83 @@ + + + + + Copyright 2022 David Redondo <kde@david-redondo.de> + + 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. + + + + + This protocol enhances normal drag and drop with the ability to move a + window at the same time. This allows having detachable windows that + can also be reattached when dragged back to another window or some special + zone. + + Warning! The protocol described in this file is currently in the testing + phase. Backward compatible changes may be added together with the + corresponding interface version bump. Backward incompatible changes can + only be done by creating a new major version of the extension. + + + + + Create an qt_toplevel_drag for a drag and drop operation that is going + to be started with data_source. + This request can only be made on sources used in drag-and-drop, so it + must be performed before wl_data_device.start_drag. Attempting to use + the source other than for drag-and-drop will raise an invalid_source error. + + + + + + + + + + + + + + + + + + + Request that the window will be moved with the cursor during the drag operation. The offset + describes how the toplevel will be positioned relative to the cursor hotspot + in surface local coordinates. + Issuing this request after the drag has ended will result in a drag_ended protocol error. + + + + + + + + + + + + + + + diff --git a/src/plugins/platforms/wayland/CMakeLists.txt b/src/plugins/platforms/wayland/CMakeLists.txt index d42259fc0c0..4fab5b3198d 100644 --- a/src/plugins/platforms/wayland/CMakeLists.txt +++ b/src/plugins/platforms/wayland/CMakeLists.txt @@ -93,6 +93,8 @@ qt6_generate_wayland_protocol_client_sources(WaylandClient ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/xdg-output-unstable-v1.xml ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/fractional-scale-v1.xml ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/viewporter.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/qt-toplevel-drag-v1.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/xdg-shell.xml ${CMAKE_CURRENT_SOURCE_DIR}/../extensions/qt-key-unstable-v1.xml ${CMAKE_CURRENT_SOURCE_DIR}/../extensions/qt-text-input-method-unstable-v1.xml ${CMAKE_CURRENT_SOURCE_DIR}/../extensions/qt-windowmanager.xml diff --git a/src/plugins/platforms/wayland/qwaylanddatadevice.cpp b/src/plugins/platforms/wayland/qwaylanddatadevice.cpp index a7014f7a1a5..e9d82100fad 100644 --- a/src/plugins/platforms/wayland/qwaylanddatadevice.cpp +++ b/src/plugins/platforms/wayland/qwaylanddatadevice.cpp @@ -13,6 +13,8 @@ #include "qwaylandabstractdecoration_p.h" #include "qwaylandsurface_p.h" +#include + #include #include #include @@ -27,6 +29,8 @@ QT_BEGIN_NAMESPACE namespace QtWaylandClient { +using namespace Qt::StringLiterals; + QWaylandDataDevice::QWaylandDataDevice(QWaylandDataDeviceManager *manager, QWaylandInputDevice *inputDevice) : QObject(inputDevice) , QtWayland::wl_data_device(manager->get_data_device(inputDevice->wl_seat())) @@ -105,14 +109,47 @@ bool QWaylandDataDevice::startDrag(QMimeData *mimeData, Qt::DropActions supporte drag->setResponse(response); } }); - connect(m_dragSource.data(), &QWaylandDataSource::dndDropped, this, [](bool accepted, Qt::DropAction action) { - QPlatformDropQtResponse response(accepted, action); - static_cast(QGuiApplicationPrivate::platformIntegration()->drag())->setDropResponse(response); - }); - connect(m_dragSource.data(), &QWaylandDataSource::finished, this, []() { + connect(m_dragSource.data(), &QWaylandDataSource::dndDropped, this, + [this](bool accepted, Qt::DropAction action) { + QPlatformDropQtResponse response(accepted, action); + if (m_toplevelDrag) { + // If the widget was dropped but the drag not accepted it + // should be its own window in the future. To distinguish + // from canceling mid-drag the drag is accepted here as the + // we know if the widget is over a zone where it can be + // incorporated or not + response = { accepted, Qt::MoveAction }; + } + static_cast(QGuiApplicationPrivate::platformIntegration()->drag()) + ->setDropResponse(response); + }); + connect(m_dragSource.data(), &QWaylandDataSource::finished, this, [this]() { static_cast(QGuiApplicationPrivate::platformIntegration()->drag())->finishDrag(); + if (m_toplevelDrag) { + m_toplevelDrag->destroy(); + m_toplevelDrag = nullptr; + } }); + if (mimeData->hasFormat("application/x-qt-mainwindowdrag-window"_L1) + && m_display->xdgToplevelDragManager()) { + qintptr dockWindowPtr; + QPoint offset; + QDataStream windowStream(mimeData->data("application/x-qt-mainwindowdrag-window"_L1)); + windowStream >> dockWindowPtr; + QWindow *dockWindow = reinterpret_cast(dockWindowPtr); + QDataStream offsetStream(mimeData->data("application/x-qt-mainwindowdrag-position"_L1)); + offsetStream >> offset; + if (auto waylandWindow = static_cast(dockWindow->handle())) { + if (auto toplevel = waylandWindow->surfaceRole()) { + m_toplevelDrag = new QtWayland::qt_toplevel_drag_v1( + m_display->xdgToplevelDragManager()->get_qt_toplevel_drag( + m_dragSource->object())); + m_toplevelDrag->attach(toplevel, offset.x(), offset.y()); + } + } + } + start_drag(m_dragSource->object(), origin->wlSurface(), icon->wlSurface(), m_display->currentInputDevice()->serial()); return true; } @@ -148,7 +185,6 @@ void QWaylandDataDevice::data_device_drop() QPlatformDropQtResponse response = QWindowSystemInterface::handleDrop(m_dragWindow, dragData, m_dragPoint, supportedActions, QGuiApplication::mouseButtons(), QGuiApplication::keyboardModifiers()); - if (drag) { auto drag = static_cast(QGuiApplicationPrivate::platformIntegration()->drag()); drag->setDropResponse(response); @@ -175,16 +211,14 @@ void QWaylandDataDevice::data_device_enter(uint32_t serial, wl_surface *surface, QDrag *drag = static_cast(QGuiApplicationPrivate::platformIntegration()->drag())->currentDrag(); if (drag) { dragData = drag->mimeData(); - supportedActions = drag->supportedActions(); } else if (m_dragOffer) { dragData = m_dragOffer->mimeData(); supportedActions = m_dragOffer->supportedActions(); } - const QPlatformDragQtResponse &response = QWindowSystemInterface::handleDrag(m_dragWindow, dragData, m_dragPoint, supportedActions, - QGuiApplication::mouseButtons(), - QGuiApplication::keyboardModifiers()); - + const QPlatformDragQtResponse &response = QWindowSystemInterface::handleDrag( + m_dragWindow, dragData, m_dragPoint, supportedActions, QGuiApplication::mouseButtons(), + QGuiApplication::keyboardModifiers()); if (drag) { static_cast(QGuiApplicationPrivate::platformIntegration()->drag())->setResponse(response); } @@ -263,6 +297,10 @@ void QWaylandDataDevice::dragSourceCancelled() { static_cast(QGuiApplicationPrivate::platformIntegration()->drag())->finishDrag(); m_dragSource.reset(); + if (m_toplevelDrag) { + m_toplevelDrag->destroy(); + m_toplevelDrag = nullptr; + } } QPoint QWaylandDataDevice::calculateDragPosition(int x, int y, QWindow *wnd) const diff --git a/src/plugins/platforms/wayland/qwaylanddatadevice_p.h b/src/plugins/platforms/wayland/qwaylanddatadevice_p.h index 76c8965f906..b924aa7efe5 100644 --- a/src/plugins/platforms/wayland/qwaylanddatadevice_p.h +++ b/src/plugins/platforms/wayland/qwaylanddatadevice_p.h @@ -31,6 +31,10 @@ class QMimeData; class QPlatformDragQtResponse; class QWindow; +namespace QtWayland { +class qt_toplevel_drag_v1; +} + namespace QtWaylandClient { class QWaylandDisplay; @@ -93,8 +97,8 @@ private: QScopedPointer m_dragOffer; QScopedPointer m_selectionOffer; QScopedPointer m_selectionSource; - QScopedPointer m_dragSource; + QtWayland::qt_toplevel_drag_v1 *m_toplevelDrag = nullptr; }; } diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index c49cb428a4f..ae066becad8 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -53,6 +53,7 @@ #include #include #include +#include #include @@ -758,6 +759,9 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin mViewporter.reset(new QtWayland::wp_viewporter(registry, id, qMin(1u, version))); } else if (interface == QLatin1String(QtWayland::wp_cursor_shape_manager_v1::interface()->name)) { mCursorShapeManager.reset(new QtWayland::wp_cursor_shape_manager_v1(registry, id, std::min(1u, version))); + } else if ( + interface == QLatin1String(QtWayland::qt_toplevel_drag_manager_v1::interface()->name)) { + mXdgToplevelDragManager.reset(new QtWayland::qt_toplevel_drag_manager_v1(registry, id, 1)); } mGlobals.append(RegistryGlobal(id, interface, version, registry)); diff --git a/src/plugins/platforms/wayland/qwaylanddisplay_p.h b/src/plugins/platforms/wayland/qwaylanddisplay_p.h index 877ff9692a5..7a64749ef9e 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay_p.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay_p.h @@ -54,6 +54,7 @@ namespace QtWayland { class wp_cursor_shape_manager_v1; class wp_fractional_scale_manager_v1; class wp_viewporter; + class qt_toplevel_drag_manager_v1; } namespace QtWaylandClient { @@ -154,6 +155,7 @@ public: QtWayland::wp_fractional_scale_manager_v1 *fractionalScaleManager() const { return mFractionalScaleManager.data(); } QtWayland::wp_viewporter *viewporter() const { return mViewporter.data(); } QtWayland::wp_cursor_shape_manager_v1 *cursorShapeManager() const { return mCursorShapeManager.data();} + QtWayland::qt_toplevel_drag_manager_v1 *xdgToplevelDragManager() const { return mXdgToplevelDragManager.data();} struct RegistryGlobal { uint32_t id; @@ -280,6 +282,7 @@ private: QScopedPointer mViewporter; QScopedPointer mFractionalScaleManager; QScopedPointer mCursorShapeManager; + QScopedPointer mXdgToplevelDragManager; int mFd = -1; int mWritableNotificationFd = -1; QList mGlobals; From 2aa8de5524cc769daf0b6ec6d29363311b8a441e Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Sun, 19 Mar 2023 10:24:59 +0400 Subject: [PATCH 1198/1507] Client: Send release button event on pointer leave Fixes: QTBUG-97037 Pick-to: 6.6 6.5 6.2 5.15 Change-Id: I151239b276ab5aefe166f5615baf43dab428ce0c Reviewed-by: David Edmundson --- src/plugins/platforms/wayland/qwaylandinputdevice.cpp | 9 +++++++-- src/plugins/platforms/wayland/qwaylandinputdevice_p.h | 1 + 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index b39e3a9755d..24dc93612d2 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -716,8 +716,8 @@ public: void QWaylandInputDevice::Pointer::pointer_leave(uint32_t time, struct wl_surface *surface) { + releaseButtons(); invalidateFocus(); - mButtons = Qt::NoButton; mParent->mTime = time; @@ -832,6 +832,8 @@ void QWaylandInputDevice::Pointer::pointer_button(uint32_t serial, uint32_t time default: return; // invalid button number (as far as Qt is concerned) } + mLastButton = qt_button; + if (state) mButtons |= qt_button; else @@ -870,10 +872,13 @@ void QWaylandInputDevice::Pointer::invalidateFocus() void QWaylandInputDevice::Pointer::releaseButtons() { + if (mButtons == Qt::NoButton) + return; + mButtons = Qt::NoButton; if (auto *window = focusWindow()) { - ReleaseEvent e(focusWindow(), mParent->mTime, mSurfacePos, mGlobalPos, mButtons, Qt::NoButton, mParent->modifiers()); + ReleaseEvent e(focusWindow(), mParent->mTime, mSurfacePos, mGlobalPos, mButtons, mLastButton, mParent->modifiers()); window->handleMouse(mParent, e); } } diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h index d41d885f3d5..fce6e74cf8c 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h +++ b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h @@ -336,6 +336,7 @@ public: QPointF mSurfacePos; QPointF mGlobalPos; Qt::MouseButtons mButtons = Qt::NoButton; + Qt::MouseButton mLastButton = Qt::NoButton; #if QT_CONFIG(cursor) wl_buffer *mCursorBuffer = nullptr; Qt::CursorShape mCursorShape = Qt::BitmapCursor; From 388e6659a7a00a659456ac8f36c0523096a27684 Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Mon, 5 Jun 2023 15:57:49 +0100 Subject: [PATCH 1199/1507] client: Guard against client destruction in gestures Client code can delete a window at any point. Any gesture events, including a "begin" event can be already in flight before the compositor is aware of the window destruction. It's up to the client code to handle either the focus not being initially found or the QPointer resetting and no-op. Task-number: QTBUG-113145 Pick-to: 6.6 6.5 Change-Id: Ie2c01799bd38c6f295159876a1bcd018abe60188 Reviewed-by: Eskil Abrahamsen Blomfeldt --- .../wayland/qwaylandpointergestures.cpp | 23 ++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandpointergestures.cpp b/src/plugins/platforms/wayland/qwaylandpointergestures.cpp index df43c31e907..1cdd97edde0 100644 --- a/src/plugins/platforms/wayland/qwaylandpointergestures.cpp +++ b/src/plugins/platforms/wayland/qwaylandpointergestures.cpp @@ -41,8 +41,11 @@ void QWaylandPointerGestureSwipe::zwp_pointer_gesture_swipe_v1_begin(uint32_t se uint32_t fingers) { #ifndef QT_NO_GESTURES - mParent->mSerial = serial; mFocus = QWaylandWindow::fromWlSurface(surface); + if (!mFocus) { + return; + } + mParent->mSerial = serial; mFingers = fingers; const auto* pointer = mParent->pointer(); @@ -62,6 +65,9 @@ void QWaylandPointerGestureSwipe::zwp_pointer_gesture_swipe_v1_update(uint32_t t wl_fixed_t dx, wl_fixed_t dy) { #ifndef QT_NO_GESTURES + if (!mFocus) { + return; + } const auto* pointer = mParent->pointer(); const QPointF delta = QPointF(wl_fixed_to_double(dx), wl_fixed_to_double(dy)); @@ -79,6 +85,9 @@ void QWaylandPointerGestureSwipe::zwp_pointer_gesture_swipe_v1_end(uint32_t seri int32_t cancelled) { #ifndef QT_NO_GESTURES + if (!mFocus) { + return; + } mParent->mSerial = serial; const auto* pointer = mParent->pointer(); @@ -113,11 +122,13 @@ void QWaylandPointerGesturePinch::zwp_pointer_gesture_pinch_v1_begin(uint32_t se uint32_t fingers) { #ifndef QT_NO_GESTURES - mParent->mSerial = serial; mFocus = QWaylandWindow::fromWlSurface(surface); + if (!mFocus) { + return; + } + mParent->mSerial = serial; mFingers = fingers; mLastScale = 1; - const auto* pointer = mParent->pointer(); qCDebug(lcQpaWaylandInput) << "zwp_pointer_gesture_pinch_v1_begin @ " @@ -137,6 +148,9 @@ void QWaylandPointerGesturePinch::zwp_pointer_gesture_pinch_v1_update(uint32_t t wl_fixed_t rotation) { #ifndef QT_NO_GESTURES + if (!mFocus) { + return; + } const auto* pointer = mParent->pointer(); const qreal rscale = wl_fixed_to_double(scale); @@ -161,6 +175,9 @@ void QWaylandPointerGesturePinch::zwp_pointer_gesture_pinch_v1_end(uint32_t seri int32_t cancelled) { #ifndef QT_NO_GESTURES + if (!mFocus) { + return; + } mParent->mSerial = serial; const auto* pointer = mParent->pointer(); From a7aced5707393c95d0745a8b6e1e7c5f671b3c9f Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Tue, 6 Jun 2023 08:33:42 +0200 Subject: [PATCH 1200/1507] Fix compilation with -feature-wayland_text_input_v4_wip Someone changed something so this is no longer implicitly included, so we need to add it explicitly. Pick-to: 6.5 6.6 Change-Id: Ie4b5c5194e32d4b192444c931da56b7ec9009cd2 Reviewed-by: David Edmundson --- src/plugins/platforms/wayland/qwaylandtextinputv4_p.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/plugins/platforms/wayland/qwaylandtextinputv4_p.h b/src/plugins/platforms/wayland/qwaylandtextinputv4_p.h index cad6d6c32f5..2f4263ebaf4 100644 --- a/src/plugins/platforms/wayland/qwaylandtextinputv4_p.h +++ b/src/plugins/platforms/wayland/qwaylandtextinputv4_p.h @@ -18,6 +18,7 @@ #include "qwaylandtextinputinterface_p.h" #include #include +#include struct wl_callback; struct wl_callback_listener; From 7a93643df7d3aca7061558a4b83cfa87d21f62cc Mon Sep 17 00:00:00 2001 From: David Redondo Date: Tue, 6 Jun 2023 11:54:18 +0200 Subject: [PATCH 1201/1507] Add missing globals to reset on reconnect These were recently added and not reset on reconnect. Pick-to: 6.6 Change-Id: I3b030154447662c9b9fde9b44cbea994333d464c Reviewed-by: David Edmundson --- src/plugins/platforms/wayland/qwaylanddisplay.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index ae066becad8..d7bfb543b4d 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -451,6 +451,8 @@ void QWaylandDisplay::reconnect() mXdgOutputManager.reset(); mViewporter.reset(); mFractionalScaleManager.reset(); + mCursorShapeManager.reset(); + mXdgToplevelDragManager.reset(); mWaylandIntegration->reset(); From ad0e53866446173624f3d2f6b73a64d2375bbb26 Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Wed, 7 Jun 2023 17:30:30 +0100 Subject: [PATCH 1202/1507] client: initialize key repeat information We can end up checking mRepeatKey.code before getting a key press is recorded when the values are uninitialized. This can happen if we get a key up for a previously held key or if key repeats are disabled. It's relatively harmless as it just stops a timer, but it can show up in valgrind logs. Change-Id: Ib7fe58b1976e9c89550c5a6252a34d66f83e2481 Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/plugins/platforms/wayland/qwaylandinputdevice_p.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h index fce6e74cf8c..3f19f2b2151 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h +++ b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h @@ -230,13 +230,13 @@ public: uint32_t mNativeModifiers = 0; struct repeatKey { - int key; - uint32_t code; - uint32_t time; + int key = 0; + uint32_t code = 0; + uint32_t time = 0 ; QString text; Qt::KeyboardModifiers modifiers; - uint32_t nativeVirtualKey; - uint32_t nativeModifiers; + uint32_t nativeVirtualKey = 0; + uint32_t nativeModifiers = 0; } mRepeatKey; QTimer mRepeatTimer; From 9a8033ba5a63404dd583096464dd1395f6c4e512 Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Wed, 7 Jun 2023 22:12:15 +0100 Subject: [PATCH 1203/1507] client: Fix crash on dnd updates after client facing drag ends A platform drag and a application-facing drag have two different lifespans. The platform drag lasts until all mimedata is transferred and the client receiving the drops marks it as finished. The application facing QDrag lasts until the client deletes it. We can get a crash if we get updates during this time. The drop event is guarded, but not the action negotiation. Pick-to: 6.6 Change-Id: Ib9c047f04d65883105d4cd3f169637d0e038a63f Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/plugins/platforms/wayland/qwaylanddatadevice.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/plugins/platforms/wayland/qwaylanddatadevice.cpp b/src/plugins/platforms/wayland/qwaylanddatadevice.cpp index e9d82100fad..80a9a773915 100644 --- a/src/plugins/platforms/wayland/qwaylanddatadevice.cpp +++ b/src/plugins/platforms/wayland/qwaylanddatadevice.cpp @@ -101,6 +101,9 @@ bool QWaylandDataDevice::startDrag(QMimeData *mimeData, Qt::DropActions supporte connect(m_dragSource.data(), &QWaylandDataSource::cancelled, this, &QWaylandDataDevice::dragSourceCancelled); connect(m_dragSource.data(), &QWaylandDataSource::dndResponseUpdated, this, [this](bool accepted, Qt::DropAction action) { auto drag = static_cast(QGuiApplicationPrivate::platformIntegration()->drag()); + if (!drag->currentDrag()) { + return; + } // in old versions drop action is not set, so we guess if (m_dragSource->version() < 3) { drag->setResponse(accepted); From 5abc59af2a0d64589452416e0a4ce8f3a95824b1 Mon Sep 17 00:00:00 2001 From: David Redondo Date: Tue, 6 Jun 2023 16:07:56 +0200 Subject: [PATCH 1204/1507] client: Move wayland globals into a holding struct This way all globals get automatically reset by reassigning a default constructed value to the holder. This way a newly added global will not be missed in the future. Change-Id: Id3a62e30427cec9980ea076366e30b419ce1c2c6 Reviewed-by: David Edmundson --- .../platforms/wayland/qwaylanddisplay.cpp | 142 +++++++++--------- .../platforms/wayland/qwaylanddisplay_p.h | 137 ++++++++++++----- 2 files changed, 166 insertions(+), 113 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index d7bfb543b4d..16ca69e07ce 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -279,7 +279,7 @@ struct ::wl_region *QWaylandDisplay::createRegion(const QRegion &qregion) ::wl_subsurface *QWaylandDisplay::createSubSurface(QWaylandWindow *window, QWaylandWindow *parent) { - if (!mSubCompositor) { + if (!mGlobals.subCompositor) { qCWarning(lcQpaWayland) << "Can't create subsurface, not supported by the compositor."; return nullptr; } @@ -288,18 +288,18 @@ struct ::wl_region *QWaylandDisplay::createRegion(const QRegion &qregion) Q_ASSERT(parent->wlSurface()); Q_ASSERT(window->wlSurface()); - return mSubCompositor->get_subsurface(window->wlSurface(), parent->wlSurface()); + return mGlobals.subCompositor->get_subsurface(window->wlSurface(), parent->wlSurface()); } ::wp_viewport *QWaylandDisplay::createViewport(QWaylandWindow *window) { - if (!mViewporter) { + if (!mGlobals.viewporter) { qCWarning(lcQpaWayland) << "Can't create wp_viewport, not supported by the compositor."; return nullptr; } Q_ASSERT(window->wlSurface()); - return mViewporter->get_viewport(window->wlSurface()); + return mGlobals.viewporter->get_viewport(window->wlSurface()); } QWaylandShellIntegration *QWaylandDisplay::shellIntegration() const @@ -366,9 +366,6 @@ QWaylandDisplay::~QWaylandDisplay(void) } qDeleteAll(mWaitingScreens); -#if QT_CONFIG(wayland_datadevice) - mDndSelectionHandler.reset(); -#endif #if QT_CONFIG(cursor) mCursorThemes.clear(); #endif @@ -376,6 +373,8 @@ QWaylandDisplay::~QWaylandDisplay(void) if (m_frameEventQueue) wl_event_queue_destroy(m_frameEventQueue); + mGlobals = {}; + if (mDisplay) wl_display_disconnect(mDisplay); } @@ -432,37 +431,18 @@ void QWaylandDisplay::reconnect() mShm.reset(); mCursorThemes.clear(); mCursor.reset(); - mDndSelectionHandler.reset(); - mWindowExtension.reset(); - mSubCompositor.reset(); - mTouchExtension.reset(); - mQtKeyExtension.reset(); - mWindowManagerIntegration.reset(); - mTabletManager.reset(); - mPointerGestures.reset(); -#if QT_CONFIG(wayland_client_primary_selection) - mPrimarySelectionManager.reset(); -#endif - mTextInputMethodManager.reset(); - mTextInputManagerv1.reset(); - mTextInputManagerv2.reset(); - mTextInputManagerv4.reset(); - mHardwareIntegration.reset(); - mXdgOutputManager.reset(); - mViewporter.reset(); - mFractionalScaleManager.reset(); - mCursorShapeManager.reset(); - mXdgToplevelDragManager.reset(); + + mGlobals = GlobalHolder(); mWaylandIntegration->reset(); qDeleteAll(std::exchange(mInputDevices, {})); mLastInputDevice = nullptr; - for (const RegistryGlobal &global : mGlobals) { + for (const RegistryGlobal &global : mRegistryGlobals) { emit globalRemoved(global); } - mGlobals.clear(); + mRegistryGlobals.clear(); mLastInputSerial = 0; mLastInputWindow.clear(); @@ -646,34 +626,36 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin mInputDevices.append(inputDevice); #if QT_CONFIG(wayland_datadevice) } else if (interface == QLatin1String(QWaylandDataDeviceManager::interface()->name)) { - mDndSelectionHandler.reset(new QWaylandDataDeviceManager(this, version, id)); + mGlobals.dndSelectionHandler.reset(new QWaylandDataDeviceManager(this, version, id)); #endif } else if (interface == QLatin1String(QtWayland::qt_surface_extension::interface()->name)) { - mWindowExtension.reset(new QtWayland::qt_surface_extension(registry, id, 1)); + mGlobals.surfaceExtension.reset(new QtWayland::qt_surface_extension(registry, id, 1)); } else if (interface == QLatin1String(QtWayland::wl_subcompositor::interface()->name)) { - mSubCompositor.reset(new QtWayland::wl_subcompositor(registry, id, 1)); + mGlobals.subCompositor.reset(new QtWayland::wl_subcompositor(registry, id, 1)); } else if (interface == QLatin1String(QWaylandTouchExtension::interface()->name)) { - mTouchExtension.reset(new QWaylandTouchExtension(this, id)); + mGlobals.touchExtension.reset(new QWaylandTouchExtension(this, id)); } else if (interface == QLatin1String(QWaylandQtKeyExtension::interface()->name)) { - mQtKeyExtension.reset(new QWaylandQtKeyExtension(this, id)); + mGlobals.qtKeyExtension.reset(new QWaylandQtKeyExtension(this, id)); #if QT_CONFIG(tabletevent) } else if (interface == QLatin1String(QWaylandTabletManagerV2::interface()->name)) { - mTabletManager.reset(new QWaylandTabletManagerV2(this, id, qMin(1, int(version)))); + mGlobals.tabletManager.reset(new QWaylandTabletManagerV2(this, id, qMin(1, int(version)))); #endif } else if (interface == QLatin1String(QWaylandPointerGestures::interface()->name)) { - mPointerGestures.reset(new QWaylandPointerGestures(this, id, 1)); + mGlobals.pointerGestures.reset(new QWaylandPointerGestures(this, id, 1)); #if QT_CONFIG(wayland_client_primary_selection) } else if (interface == QLatin1String(QWaylandPrimarySelectionDeviceManagerV1::interface()->name)) { - mPrimarySelectionManager.reset(new QWaylandPrimarySelectionDeviceManagerV1(this, id, 1)); + mGlobals.primarySelectionManager.reset( + new QWaylandPrimarySelectionDeviceManagerV1(this, id, 1)); for (QWaylandInputDevice *inputDevice : std::as_const(mInputDevices)) - inputDevice->setPrimarySelectionDevice(mPrimarySelectionManager->createDevice(inputDevice)); + inputDevice->setPrimarySelectionDevice( + mGlobals.primarySelectionManager->createDevice(inputDevice)); #endif } else if (interface == QLatin1String(QtWayland::qt_text_input_method_manager_v1::interface()->name) && (mTextInputManagerList.contains(interface) && mTextInputManagerList.indexOf(interface) < mTextInputManagerIndex)) { qCDebug(lcQpaWayland) << "text input: register qt_text_input_method_manager_v1"; if (mTextInputManagerIndex < INT_MAX) { - mTextInputManagerv1.reset(); - mTextInputManagerv2.reset(); + mGlobals.textInputManagerv1.reset(); + mGlobals.mTextInputManagerv2.reset(); #if QT_WAYLAND_TEXT_INPUT_V4_WIP mTextInputManagerv4.reset(); #endif // QT_WAYLAND_TEXT_INPUT_V4_WIP @@ -681,17 +663,21 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin inputDevice->setTextInput(nullptr); } - mTextInputMethodManager.reset(new QtWayland::qt_text_input_method_manager_v1(registry, id, 1)); + mGlobals.textInputMethodManager.reset( + new QtWayland::qt_text_input_method_manager_v1(registry, id, 1)); for (QWaylandInputDevice *inputDevice : std::as_const(mInputDevices)) - inputDevice->setTextInputMethod(new QWaylandTextInputMethod(this, mTextInputMethodManager->get_text_input_method(inputDevice->wl_seat()))); + inputDevice->setTextInputMethod(new QWaylandTextInputMethod( + this, + mGlobals.textInputMethodManager->get_text_input_method( + inputDevice->wl_seat()))); mWaylandIntegration->reconfigureInputContext(); mTextInputManagerIndex = mTextInputManagerList.indexOf(interface); } else if (interface == QLatin1String(QtWayland::zwp_text_input_manager_v1::interface()->name) && (mTextInputManagerList.contains(interface) && mTextInputManagerList.indexOf(interface) < mTextInputManagerIndex)) { qCDebug(lcQpaWayland) << "text input: register zwp_text_input_v1"; if (mTextInputManagerIndex < INT_MAX) { - mTextInputMethodManager.reset(); - mTextInputManagerv2.reset(); + mGlobals.textInputMethodManager.reset(); + mGlobals.mTextInputManagerv2.reset(); #if QT_WAYLAND_TEXT_INPUT_V4_WIP mTextInputManagerv4.reset(); #endif // QT_WAYLAND_TEXT_INPUT_V4_WIP @@ -699,9 +685,11 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin inputDevice->setTextInputMethod(nullptr); } - mTextInputManagerv1.reset(new QtWayland::zwp_text_input_manager_v1(registry, id, 1)); + mGlobals.textInputManagerv1.reset( + new QtWayland::zwp_text_input_manager_v1(registry, id, 1)); for (QWaylandInputDevice *inputDevice : std::as_const(mInputDevices)) { - auto textInput = new QWaylandTextInputv1(this, mTextInputManagerv1->create_text_input()); + auto textInput = + new QWaylandTextInputv1(this, mGlobals.textInputManagerv1->create_text_input()); textInput->setSeat(inputDevice->wl_seat()); inputDevice->setTextInput(textInput); } @@ -712,8 +700,8 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin && (mTextInputManagerList.contains(interface) && mTextInputManagerList.indexOf(interface) < mTextInputManagerIndex)) { qCDebug(lcQpaWayland) << "text input: register zwp_text_input_v2"; if (mTextInputManagerIndex < INT_MAX) { - mTextInputMethodManager.reset(); - mTextInputManagerv1.reset(); + mGlobals.textInputMethodManager.reset(); + mGlobals.textInputManagerv1.reset(); #if QT_WAYLAND_TEXT_INPUT_V4_WIP mTextInputManagerv4.reset(); #endif // QT_WAYLAND_TEXT_INPUT_V4_WIP @@ -721,9 +709,11 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin inputDevice->setTextInputMethod(nullptr); } - mTextInputManagerv2.reset(new QtWayland::zwp_text_input_manager_v2(registry, id, 1)); + mGlobals.mTextInputManagerv2.reset( + new QtWayland::zwp_text_input_manager_v2(registry, id, 1)); for (QWaylandInputDevice *inputDevice : std::as_const(mInputDevices)) - inputDevice->setTextInput(new QWaylandTextInputv2(this, mTextInputManagerv2->get_text_input(inputDevice->wl_seat()))); + inputDevice->setTextInput(new QWaylandTextInputv2( + this, mGlobals.mTextInputManagerv2->get_text_input(inputDevice->wl_seat()))); mWaylandIntegration->reconfigureInputContext(); mTextInputManagerIndex = mTextInputManagerList.indexOf(interface); #if QT_WAYLAND_TEXT_INPUT_V4_WIP @@ -731,43 +721,48 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin && (mTextInputManagerList.contains(interface) && mTextInputManagerList.indexOf(interface) < mTextInputManagerIndex)) { qCDebug(lcQpaWayland) << "text input: register zwp_text_input_v4"; if (mTextInputManagerIndex < INT_MAX) { - mTextInputMethodManager.reset(); - mTextInputManagerv2.reset(); + mGlobals.textInputMethodManager.reset(); + mGlobals.textInputManagerv2.reset(); for (QWaylandInputDevice *inputDevice : std::as_const(mInputDevices)) inputDevice->setTextInputMethod(nullptr); } - mTextInputManagerv4.reset(new QtWayland::zwp_text_input_manager_v4(registry, id, 1)); + mGlobals.textInputManagerv4.reset( + new QtWayland::zwp_text_input_manager_v4(registry, id, 1)); for (QWaylandInputDevice *inputDevice : std::as_const(mInputDevices)) - inputDevice->setTextInput(new QWaylandTextInputv4(this, mTextInputManagerv4->get_text_input(inputDevice->wl_seat()))); + inputDevice->setTextInput(new QWaylandTextInputv4( + this, mGlobals.textInputManagerv4->get_text_input(inputDevice->wl_seat()))); mWaylandIntegration->reconfigureInputContext(); mTextInputManagerIndex = mTextInputManagerList.indexOf(interface); #endif // QT_WAYLAND_TEXT_INPUT_V4_WIP } else if (interface == QLatin1String(QWaylandHardwareIntegration::interface()->name)) { bool disableHardwareIntegration = qEnvironmentVariableIntValue("QT_WAYLAND_DISABLE_HW_INTEGRATION"); if (!disableHardwareIntegration) { - mHardwareIntegration.reset(new QWaylandHardwareIntegration(registry, id)); + mGlobals.hardwareIntegration.reset(new QWaylandHardwareIntegration(registry, id)); // make a roundtrip here since we need to receive the events sent by // qt_hardware_integration before creating windows forceRoundTrip(); } } else if (interface == QLatin1String(QWaylandXdgOutputManagerV1::interface()->name)) { - mXdgOutputManager.reset(new QWaylandXdgOutputManagerV1(this, id, version)); + mGlobals.xdgOutputManager.reset(new QWaylandXdgOutputManagerV1(this, id, version)); for (auto *screen : std::as_const(mWaitingScreens)) screen->initXdgOutput(xdgOutputManager()); } else if (interface == QLatin1String(QtWayland::wp_fractional_scale_manager_v1::interface()->name)) { - mFractionalScaleManager.reset(new QtWayland::wp_fractional_scale_manager_v1(registry, id, 1)); + mGlobals.fractionalScaleManager.reset( + new QtWayland::wp_fractional_scale_manager_v1(registry, id, 1)); } else if (interface == QLatin1String("wp_viewporter")) { - mViewporter.reset(new QtWayland::wp_viewporter(registry, id, qMin(1u, version))); + mGlobals.viewporter.reset(new QtWayland::wp_viewporter(registry, id, qMin(1u, version))); } else if (interface == QLatin1String(QtWayland::wp_cursor_shape_manager_v1::interface()->name)) { - mCursorShapeManager.reset(new QtWayland::wp_cursor_shape_manager_v1(registry, id, std::min(1u, version))); + mGlobals.cursorShapeManager.reset( + new QtWayland::wp_cursor_shape_manager_v1(registry, id, std::min(1u, version))); } else if ( interface == QLatin1String(QtWayland::qt_toplevel_drag_manager_v1::interface()->name)) { - mXdgToplevelDragManager.reset(new QtWayland::qt_toplevel_drag_manager_v1(registry, id, 1)); + mGlobals.xdgToplevelDragManager.reset( + new QtWayland::qt_toplevel_drag_manager_v1(registry, id, 1)); } - mGlobals.append(RegistryGlobal(id, interface, version, registry)); - emit globalAdded(mGlobals.back()); + mRegistryGlobals.append(RegistryGlobal(id, interface, version, registry)); + emit globalAdded(mRegistryGlobals.back()); const auto copy = mRegistryListeners; // be prepared for listeners unregistering on notification for (Listener l : copy) @@ -776,8 +771,8 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin void QWaylandDisplay::registry_global_remove(uint32_t id) { - for (int i = 0, ie = mGlobals.size(); i != ie; ++i) { - RegistryGlobal &global = mGlobals[i]; + for (int i = 0, ie = mRegistryGlobals.size(); i != ie; ++i) { + RegistryGlobal &global = mRegistryGlobals[i]; if (global.id == id) { if (global.interface == QLatin1String(QtWayland::wl_output::interface()->name)) { for (auto *screen : mWaitingScreens) { @@ -799,13 +794,13 @@ void QWaylandDisplay::registry_global_remove(uint32_t id) } } if (global.interface == QLatin1String(QtWayland::zwp_text_input_manager_v1::interface()->name)) { - mTextInputManagerv1.reset(); + mGlobals.textInputManagerv1.reset(); for (QWaylandInputDevice *inputDevice : std::as_const(mInputDevices)) inputDevice->setTextInput(nullptr); mWaylandIntegration->reconfigureInputContext(); } if (global.interface == QLatin1String(QtWayland::zwp_text_input_manager_v2::interface()->name)) { - mTextInputManagerv2.reset(); + mGlobals.mTextInputManagerv2.reset(); for (QWaylandInputDevice *inputDevice : std::as_const(mInputDevices)) inputDevice->setTextInput(nullptr); mWaylandIntegration->reconfigureInputContext(); @@ -819,19 +814,19 @@ void QWaylandDisplay::registry_global_remove(uint32_t id) } #endif // QT_WAYLAND_TEXT_INPUT_V4_WIP if (global.interface == QLatin1String(QtWayland::qt_text_input_method_manager_v1::interface()->name)) { - mTextInputMethodManager.reset(); + mGlobals.textInputMethodManager.reset(); for (QWaylandInputDevice *inputDevice : std::as_const(mInputDevices)) inputDevice->setTextInputMethod(nullptr); mWaylandIntegration->reconfigureInputContext(); } #if QT_CONFIG(wayland_client_primary_selection) if (global.interface == QLatin1String(QtWayland::zwp_primary_selection_device_manager_v1::interface()->name)) { - mPrimarySelectionManager.reset(); + mGlobals.primarySelectionManager.reset(); for (QWaylandInputDevice *inputDevice : std::as_const(mInputDevices)) inputDevice->setPrimarySelectionDevice(nullptr); } #endif - emit globalRemoved(mGlobals.takeAt(i)); + emit globalRemoved(mRegistryGlobals.takeAt(i)); break; } } @@ -839,7 +834,7 @@ void QWaylandDisplay::registry_global_remove(uint32_t id) bool QWaylandDisplay::hasRegistryGlobal(QStringView interfaceName) const { - for (const RegistryGlobal &global : mGlobals) + for (const RegistryGlobal &global : mRegistryGlobals) if (global.interface == interfaceName) return true; @@ -850,8 +845,9 @@ void QWaylandDisplay::addRegistryListener(RegistryListener listener, void *data) { Listener l = { listener, data }; mRegistryListeners.append(l); - for (int i = 0, ie = mGlobals.size(); i != ie; ++i) - (*l.listener)(l.data, mGlobals[i].registry, mGlobals[i].id, mGlobals[i].interface, mGlobals[i].version); + for (int i = 0, ie = mRegistryGlobals.size(); i != ie; ++i) + (*l.listener)(l.data, mRegistryGlobals[i].registry, mRegistryGlobals[i].id, + mRegistryGlobals[i].interface, mRegistryGlobals[i].version); } void QWaylandDisplay::removeListener(RegistryListener listener, void *data) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay_p.h b/src/plugins/platforms/wayland/qwaylanddisplay_p.h index 7a64749ef9e..630c6946402 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay_p.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay_p.h @@ -135,27 +135,75 @@ public: QWaylandInputDevice *defaultInputDevice() const; QWaylandInputDevice *currentInputDevice() const { return defaultInputDevice(); } #if QT_CONFIG(wayland_datadevice) - QWaylandDataDeviceManager *dndSelectionHandler() const { return mDndSelectionHandler.get(); } + QWaylandDataDeviceManager *dndSelectionHandler() const + { + return mGlobals.dndSelectionHandler.get(); + } #endif #if QT_CONFIG(wayland_client_primary_selection) - QWaylandPrimarySelectionDeviceManagerV1 *primarySelectionManager() const { return mPrimarySelectionManager.data(); } + QWaylandPrimarySelectionDeviceManagerV1 *primarySelectionManager() const + { + return mGlobals.primarySelectionManager.get(); + } #endif - QtWayland::qt_surface_extension *windowExtension() const { return mWindowExtension.data(); } + QtWayland::qt_surface_extension *windowExtension() const + { + return mGlobals.surfaceExtension.get(); + } #if QT_CONFIG(tabletevent) - QWaylandTabletManagerV2 *tabletManager() const { return mTabletManager.data(); } + QWaylandTabletManagerV2 *tabletManager() const + { + return mGlobals.tabletManager.get(); + } #endif - QWaylandPointerGestures *pointerGestures() const { return mPointerGestures.data(); } - QWaylandTouchExtension *touchExtension() const { return mTouchExtension.data(); } - QtWayland::qt_text_input_method_manager_v1 *textInputMethodManager() const { return mTextInputMethodManager.data(); } - QtWayland::zwp_text_input_manager_v1 *textInputManagerv1() const { return mTextInputManagerv1.data(); } - QtWayland::zwp_text_input_manager_v2 *textInputManagerv2() const { return mTextInputManagerv2.data(); } - QtWayland::zwp_text_input_manager_v4 *textInputManagerv4() const { return mTextInputManagerv4.data(); } - QWaylandHardwareIntegration *hardwareIntegration() const { return mHardwareIntegration.data(); } - QWaylandXdgOutputManagerV1 *xdgOutputManager() const { return mXdgOutputManager.data(); } - QtWayland::wp_fractional_scale_manager_v1 *fractionalScaleManager() const { return mFractionalScaleManager.data(); } - QtWayland::wp_viewporter *viewporter() const { return mViewporter.data(); } - QtWayland::wp_cursor_shape_manager_v1 *cursorShapeManager() const { return mCursorShapeManager.data();} - QtWayland::qt_toplevel_drag_manager_v1 *xdgToplevelDragManager() const { return mXdgToplevelDragManager.data();} + QWaylandPointerGestures *pointerGestures() const + { + return mGlobals.pointerGestures.get(); + } + QWaylandTouchExtension *touchExtension() const + { + return mGlobals.touchExtension.get(); + } + QtWayland::qt_text_input_method_manager_v1 *textInputMethodManager() const + { + return mGlobals.textInputMethodManager.get(); + } + QtWayland::zwp_text_input_manager_v1 *textInputManagerv1() const + { + return mGlobals.textInputManagerv1.get(); + } + QtWayland::zwp_text_input_manager_v2 *textInputManagerv2() const + { + return mGlobals.mTextInputManagerv2.get(); + } + QtWayland::zwp_text_input_manager_v4 *textInputManagerv4() const + { + return mGlobals.textInputManagerv4.get(); + } + QWaylandHardwareIntegration *hardwareIntegration() const + { + return mGlobals.hardwareIntegration.get(); + } + QWaylandXdgOutputManagerV1 *xdgOutputManager() const + { + return mGlobals.xdgOutputManager.get(); + } + QtWayland::wp_fractional_scale_manager_v1 *fractionalScaleManager() const + { + return mGlobals.fractionalScaleManager.get(); + } + QtWayland::wp_viewporter *viewporter() const + { + return mGlobals.viewporter.get(); + } + QtWayland::wp_cursor_shape_manager_v1 *cursorShapeManager() const + { + return mGlobals.cursorShapeManager.get(); + } + QtWayland::qt_toplevel_drag_manager_v1 *xdgToplevelDragManager() const + { + return mGlobals.xdgToplevelDragManager.get(); + } struct RegistryGlobal { uint32_t id; @@ -165,7 +213,10 @@ public: RegistryGlobal(uint32_t id_, const QString &interface_, uint32_t version_, struct ::wl_registry *registry_) : id(id_), interface(interface_), version(version_), registry(registry_) { } }; - QList globals() const { return mGlobals; } + QList globals() const + { + return mRegistryGlobals; + } bool hasRegistryGlobal(QStringView interfaceName) const; /* wl_registry_add_listener does not add but rather sets a listener, so this function is used @@ -254,38 +305,44 @@ private: QWaylandCursorTheme *theme() const noexcept { return found ? position->theme.get() : nullptr; } }; - FindExistingCursorThemeResult findExistingCursorTheme(const QString &name, int pixelSize) const noexcept; - + FindExistingCursorThemeResult findExistingCursorTheme(const QString &name, + int pixelSize) const noexcept; QScopedPointer mCursor; #endif -#if QT_CONFIG(wayland_datadevice) - QScopedPointer mDndSelectionHandler; -#endif - QScopedPointer mWindowExtension; - QScopedPointer mSubCompositor; - QScopedPointer mTouchExtension; - QScopedPointer mQtKeyExtension; + QScopedPointer mWindowManagerIntegration; + + struct GlobalHolder + { +#if QT_CONFIG(wayland_datadevice) + std::unique_ptr dndSelectionHandler; +#endif + std::unique_ptr surfaceExtension; + std::unique_ptr subCompositor; + std::unique_ptr touchExtension; + std::unique_ptr qtKeyExtension; #if QT_CONFIG(tabletevent) - QScopedPointer mTabletManager; + std::unique_ptr tabletManager; #endif - QScopedPointer mPointerGestures; + std::unique_ptr pointerGestures; #if QT_CONFIG(wayland_client_primary_selection) - QScopedPointer mPrimarySelectionManager; + std::unique_ptr primarySelectionManager; #endif - QScopedPointer mTextInputMethodManager; - QScopedPointer mTextInputManagerv1; - QScopedPointer mTextInputManagerv2; - QScopedPointer mTextInputManagerv4; - QScopedPointer mHardwareIntegration; - QScopedPointer mXdgOutputManager; - QScopedPointer mViewporter; - QScopedPointer mFractionalScaleManager; - QScopedPointer mCursorShapeManager; - QScopedPointer mXdgToplevelDragManager; + std::unique_ptr textInputMethodManager; + std::unique_ptr textInputManagerv1; + std::unique_ptr mTextInputManagerv2; + std::unique_ptr textInputManagerv4; + std::unique_ptr hardwareIntegration; + std::unique_ptr xdgOutputManager; + std::unique_ptr viewporter; + std::unique_ptr fractionalScaleManager; + std::unique_ptr cursorShapeManager; + std::unique_ptr xdgToplevelDragManager; + } mGlobals; + int mFd = -1; int mWritableNotificationFd = -1; - QList mGlobals; + QList mRegistryGlobals; uint32_t mLastInputSerial = 0; QWaylandInputDevice *mLastInputDevice = nullptr; QPointer mLastInputWindow; From be0dfe986e5f21cd249233c7fa94b1588e622686 Mon Sep 17 00:00:00 2001 From: Liang Qi Date: Tue, 27 Jun 2023 11:45:27 +0200 Subject: [PATCH 1205/1507] client: Use nullptr instead of 0 in QWaylandDisplay Pick-to: 6.6 6.5 6.2 Change-Id: I7c1f3a24e55d1825fd6c941cd55b51cf195836da Reviewed-by: David Edmundson --- src/plugins/platforms/wayland/qwaylanddisplay.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index 16ca69e07ce..ae6193febd0 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -992,7 +992,7 @@ void QWaylandDisplay::requestWaylandSync() QWaylandInputDevice *QWaylandDisplay::defaultInputDevice() const { - return mInputDevices.isEmpty() ? 0 : mInputDevices.first(); + return mInputDevices.isEmpty() ? nullptr : mInputDevices.first(); } bool QWaylandDisplay::isKeyboardAvailable() const From f3919e94486bb4673de3ef7412591848d6770ac2 Mon Sep 17 00:00:00 2001 From: Liang Qi Date: Tue, 27 Jun 2023 13:21:04 +0200 Subject: [PATCH 1206/1507] client: check nullptr before usage in QWaylandInputContext::textInput() and QWaylandInputMethodContext::textInputMethod() Fixes: QTBUG-114671 Pick-to: 6.6 6.5 6.2 Change-Id: I10e55f6f817a4b4d78a0262f87580d2fa2743f7b Reviewed-by: David Edmundson --- src/plugins/platforms/wayland/qwaylandinputcontext.cpp | 2 +- src/plugins/platforms/wayland/qwaylandinputmethodcontext.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandinputcontext.cpp b/src/plugins/platforms/wayland/qwaylandinputcontext.cpp index 3af55bccbfb..369a4e5c281 100644 --- a/src/plugins/platforms/wayland/qwaylandinputcontext.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputcontext.cpp @@ -206,7 +206,7 @@ void QWaylandInputContext::setFocusObject(QObject *object) QWaylandTextInputInterface *QWaylandInputContext::textInput() const { - return mDisplay->defaultInputDevice()->textInput(); + return mDisplay->defaultInputDevice() ? mDisplay->defaultInputDevice()->textInput() : nullptr; } #if QT_CONFIG(xkbcommon) diff --git a/src/plugins/platforms/wayland/qwaylandinputmethodcontext.cpp b/src/plugins/platforms/wayland/qwaylandinputmethodcontext.cpp index 85cd427146b..f03d8fb748d 100644 --- a/src/plugins/platforms/wayland/qwaylandinputmethodcontext.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputmethodcontext.cpp @@ -387,7 +387,7 @@ void QWaylandInputMethodContext::setFocusObject(QObject *) QWaylandTextInputMethod *QWaylandInputMethodContext::textInputMethod() const { - return m_display->defaultInputDevice()->textInputMethod(); + return m_display->defaultInputDevice() ? m_display->defaultInputDevice()->textInputMethod() : nullptr; } } // QtWaylandClient From 44a9d21c654f3b2e85b1a0b80442099d91461374 Mon Sep 17 00:00:00 2001 From: Inho Lee Date: Fri, 23 Jun 2023 12:26:48 +0200 Subject: [PATCH 1207/1507] client: Fix variable names for QWaylandDisplay::GlobalHolder After 5abc59a, wayland-text-input-v4-wip was broken. In addition, mTextInputManagerv2 will be changed to textInputManagerv2 as other protocols. Change-Id: I5476a1bba579ef1d915959b3c3881cf80a56587d Reviewed-by: David Edmundson --- .../platforms/wayland/qwaylanddisplay.cpp | 18 +++++++++--------- .../platforms/wayland/qwaylanddisplay_p.h | 4 ++-- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index ae6193febd0..1b6b81f1a8a 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -655,9 +655,9 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin qCDebug(lcQpaWayland) << "text input: register qt_text_input_method_manager_v1"; if (mTextInputManagerIndex < INT_MAX) { mGlobals.textInputManagerv1.reset(); - mGlobals.mTextInputManagerv2.reset(); + mGlobals.textInputManagerv2.reset(); #if QT_WAYLAND_TEXT_INPUT_V4_WIP - mTextInputManagerv4.reset(); + mGlobals.textInputManagerv4.reset(); #endif // QT_WAYLAND_TEXT_INPUT_V4_WIP for (QWaylandInputDevice *inputDevice : std::as_const(mInputDevices)) inputDevice->setTextInput(nullptr); @@ -677,9 +677,9 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin qCDebug(lcQpaWayland) << "text input: register zwp_text_input_v1"; if (mTextInputManagerIndex < INT_MAX) { mGlobals.textInputMethodManager.reset(); - mGlobals.mTextInputManagerv2.reset(); + mGlobals.textInputManagerv2.reset(); #if QT_WAYLAND_TEXT_INPUT_V4_WIP - mTextInputManagerv4.reset(); + mGlobals.textInputManagerv4.reset(); #endif // QT_WAYLAND_TEXT_INPUT_V4_WIP for (QWaylandInputDevice *inputDevice : std::as_const(mInputDevices)) inputDevice->setTextInputMethod(nullptr); @@ -703,17 +703,17 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin mGlobals.textInputMethodManager.reset(); mGlobals.textInputManagerv1.reset(); #if QT_WAYLAND_TEXT_INPUT_V4_WIP - mTextInputManagerv4.reset(); + mGlobals.textInputManagerv4.reset(); #endif // QT_WAYLAND_TEXT_INPUT_V4_WIP for (QWaylandInputDevice *inputDevice : std::as_const(mInputDevices)) inputDevice->setTextInputMethod(nullptr); } - mGlobals.mTextInputManagerv2.reset( + mGlobals.textInputManagerv2.reset( new QtWayland::zwp_text_input_manager_v2(registry, id, 1)); for (QWaylandInputDevice *inputDevice : std::as_const(mInputDevices)) inputDevice->setTextInput(new QWaylandTextInputv2( - this, mGlobals.mTextInputManagerv2->get_text_input(inputDevice->wl_seat()))); + this, mGlobals.textInputManagerv2->get_text_input(inputDevice->wl_seat()))); mWaylandIntegration->reconfigureInputContext(); mTextInputManagerIndex = mTextInputManagerList.indexOf(interface); #if QT_WAYLAND_TEXT_INPUT_V4_WIP @@ -800,14 +800,14 @@ void QWaylandDisplay::registry_global_remove(uint32_t id) mWaylandIntegration->reconfigureInputContext(); } if (global.interface == QLatin1String(QtWayland::zwp_text_input_manager_v2::interface()->name)) { - mGlobals.mTextInputManagerv2.reset(); + mGlobals.textInputManagerv2.reset(); for (QWaylandInputDevice *inputDevice : std::as_const(mInputDevices)) inputDevice->setTextInput(nullptr); mWaylandIntegration->reconfigureInputContext(); } #if QT_WAYLAND_TEXT_INPUT_V4_WIP if (global.interface == QLatin1String(QtWayland::zwp_text_input_manager_v4::interface()->name)) { - mTextInputManagerv4.reset(); + mGlobals.textInputManagerv4.reset(); for (QWaylandInputDevice *inputDevice : std::as_const(mInputDevices)) inputDevice->setTextInput(nullptr); mWaylandIntegration->reconfigureInputContext(); diff --git a/src/plugins/platforms/wayland/qwaylanddisplay_p.h b/src/plugins/platforms/wayland/qwaylanddisplay_p.h index 630c6946402..951a6421794 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay_p.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay_p.h @@ -174,7 +174,7 @@ public: } QtWayland::zwp_text_input_manager_v2 *textInputManagerv2() const { - return mGlobals.mTextInputManagerv2.get(); + return mGlobals.textInputManagerv2.get(); } QtWayland::zwp_text_input_manager_v4 *textInputManagerv4() const { @@ -330,7 +330,7 @@ private: #endif std::unique_ptr textInputMethodManager; std::unique_ptr textInputManagerv1; - std::unique_ptr mTextInputManagerv2; + std::unique_ptr textInputManagerv2; std::unique_ptr textInputManagerv4; std::unique_ptr hardwareIntegration; std::unique_ptr xdgOutputManager; From 7d12b0e8301b67831d53355c79281d2fff49ccb2 Mon Sep 17 00:00:00 2001 From: Liang Qi Date: Fri, 30 Jun 2023 14:30:51 +0200 Subject: [PATCH 1208/1507] client: no need to update decoration when shutting down Fixes: QTBUG-114995 Pick-to: 6.6 6.5 6.2 Change-Id: If7eaefc8cc0778246f13604809740426bcffa9f8 Reviewed-by: Liang Qi --- src/plugins/platforms/wayland/qwaylanddisplay.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index 1b6b81f1a8a..03ec75a6036 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -923,6 +923,9 @@ void QWaylandDisplay::handleWindowDeactivated(QWaylandWindow *window) mActiveWindows.removeOne(window); + if (QCoreApplication::closingDown()) + return; + if (auto *decoration = window->decoration()) decoration->update(); } From 27681c790619563d6aef06c7c1e0a99a7c35c90f Mon Sep 17 00:00:00 2001 From: Alexey Edelev Date: Thu, 6 Jul 2023 12:37:28 +0200 Subject: [PATCH 1209/1507] Do not generate the deprecated 'QtWaylandClient/qwaylandclientexport.h' Task-number: QTBUG-115029 Change-Id: Ief42a0eeb6360df7d12f367f023579106cc9db34 Reviewed-by: David Edmundson --- src/plugins/platforms/wayland/qtwaylandclientglobal.h | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/plugins/platforms/wayland/qtwaylandclientglobal.h b/src/plugins/platforms/wayland/qtwaylandclientglobal.h index 1582176eaa0..0e54752947e 100644 --- a/src/plugins/platforms/wayland/qtwaylandclientglobal.h +++ b/src/plugins/platforms/wayland/qtwaylandclientglobal.h @@ -4,10 +4,6 @@ #ifndef QWAYLANDCLIENTGLOBAL_H #define QWAYLANDCLIENTGLOBAL_H -#if 0 -#pragma qt_deprecates(qwaylandclientexport.h) -#endif - #include #include #include From 9c3896c140efcd67a77908a0f155f7e768d2caf9 Mon Sep 17 00:00:00 2001 From: Alexey Edelev Date: Thu, 6 Jul 2023 19:34:23 +0200 Subject: [PATCH 1210/1507] Ensure that WaylandGlobalPrivate_sync_headers is running Work around QTBUG-115101. Task-number: QTBUG-115101 Pick-to: 6.6 Change-Id: Icb195e0547b8faafea73d204650a1ee7bede4a7f Reviewed-by: Alexandru Croitor --- src/platformsupport/wayland/CMakeLists.txt | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/platformsupport/wayland/CMakeLists.txt b/src/platformsupport/wayland/CMakeLists.txt index c3219f9d293..b2804ea2ef2 100644 --- a/src/platformsupport/wayland/CMakeLists.txt +++ b/src/platformsupport/wayland/CMakeLists.txt @@ -30,6 +30,15 @@ endif() # See global/README for a description of the following module. qt_internal_add_module(WaylandGlobalPrivate INTERNAL_MODULE HEADER_MODULE) + +# Work around 115101. +# If nothing depends on the WaylandGlobalPrivate target it doesn't run custom commands that the +# target depends on. WaylandGlobalPrivate_ensure_sync_headers makes sure that 'all' depends on +# WaylandGlobalPrivate_sync_headers. +# TODO: This needs to be removed once the fix for QTBUG-115101 is merged in qtbase. +add_custom_target(WaylandGlobalPrivate_ensure_sync_headers ALL) +add_dependencies(WaylandGlobalPrivate_ensure_sync_headers WaylandGlobalPrivate_sync_headers) + add_subdirectory(qtwaylandscanner) # special case begin From 63e2f90266d9374e79eff79401f5570e24ac8900 Mon Sep 17 00:00:00 2001 From: David Redondo Date: Fri, 28 Jul 2023 15:44:55 +0200 Subject: [PATCH 1211/1507] client: Make sure screens stay virtual siblings during reconnect The virtual siblings of QWaylandScreen are constructed from the list of screens in QWaylandDisplay. It is important that when a window changes screens due to handleScreenRemoved that the screens are siblings otherwise the platformwindow is destroyed and window becomes hidden. Pick-to: 6.6 Change-Id: I7ceeee4e18fbdfa936fe987441d35b8a5cb1eefd Reviewed-by: David Edmundson --- .../platforms/wayland/qwaylanddisplay.cpp | 6 ++-- .../auto/wayland/reconnect/tst_reconnect.cpp | 34 ++++++++++++++----- 2 files changed, 29 insertions(+), 11 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index 03ec75a6036..1c399765ec9 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -421,9 +421,9 @@ void QWaylandDisplay::reconnect() qDeleteAll(mWaitingScreens); mWaitingScreens.clear(); - const auto screens = std::exchange(mScreens, {}); - ensureScreen(); - for (QWaylandScreen *screen : screens) { + while (!mScreens.isEmpty()) { + auto screen = mScreens.takeLast(); + ensureScreen(); QWindowSystemInterface::handleScreenRemoved(screen); } diff --git a/tests/auto/wayland/reconnect/tst_reconnect.cpp b/tests/auto/wayland/reconnect/tst_reconnect.cpp index 2b6c7558fd6..f0090d1f40a 100644 --- a/tests/auto/wayland/reconnect/tst_reconnect.cpp +++ b/tests/auto/wayland/reconnect/tst_reconnect.cpp @@ -101,7 +101,7 @@ private Q_SLOTS: //core void cleanup() { QTRY_VERIFY2(m_comp->isClean(), qPrintable(m_comp->dirtyMessage())); } void basicWindow(); - void screens(); + void multipleScreens(); //input void keyFocus(); @@ -142,12 +142,25 @@ void tst_WaylandReconnect::basicWindow() QCOMPOSITOR_TRY_VERIFY(m_comp->xdgToplevel()); } -void tst_WaylandReconnect::screens() +void tst_WaylandReconnect::multipleScreens() { - QRasterWindow window; - window.resize(64, 48); - window.show(); - QCOMPOSITOR_TRY_VERIFY(m_comp->xdgToplevel()); + + exec([this] { m_comp->add(); }); + QRasterWindow window1; + window1.resize(64, 48); + window1.show(); + QRasterWindow window2; + window2.resize(64, 48); + window2.show(); + QCOMPOSITOR_TRY_VERIFY(m_comp->xdgToplevel(0)); + QCOMPOSITOR_TRY_VERIFY(m_comp->xdgToplevel(1)); + + // ensure they are on different outputs + exec([this] { + m_comp->surface(0)->sendEnter(m_comp->output(0)); + m_comp->surface(1)->sendEnter(m_comp->output(1)); + }); + QTRY_VERIFY(window1.screen() != window2.screen()); auto originalScreens = QGuiApplication::screens(); @@ -162,8 +175,13 @@ void tst_WaylandReconnect::screens() originalScreens.removeOne(screen[0].value()); } QVERIFY(originalScreens.isEmpty()); - QVERIFY(window.screen()); - QVERIFY(QGuiApplication::screens().contains(window.screen())); + + QCOMPOSITOR_TRY_VERIFY(m_comp->xdgToplevel(0)); + QCOMPOSITOR_TRY_VERIFY(m_comp->xdgToplevel(1)); + QVERIFY(window1.screen()); + QVERIFY(window2.screen()); + QVERIFY(QGuiApplication::screens().contains(window1.screen())); + QVERIFY(QGuiApplication::screens().contains(window2.screen())); } void tst_WaylandReconnect::keyFocus() From d8f03969619f3f23528f7771eb963698a84d84a9 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Wed, 2 Aug 2023 09:02:27 +0200 Subject: [PATCH 1212/1507] Fix C++20 deprecated capture of *this in [=] The exec() function is synchronous, so we can just replace [=] with [&]. Pick-to: 6.6 6.5 6.2 5.15 Change-Id: I1b672b0ef456977fa0b898dff9c88f48765a3e41 Reviewed-by: David Edmundson Reviewed-by: Qt CI Bot --- tests/auto/wayland/client/tst_client.cpp | 34 +++---- tests/auto/wayland/nooutput/tst_nooutput.cpp | 2 +- tests/auto/wayland/output/tst_output.cpp | 28 +++--- .../tst_primaryselectionv1.cpp | 2 +- .../auto/wayland/reconnect/tst_reconnect.cpp | 10 +-- tests/auto/wayland/scaling/tst_scaling.cpp | 20 ++--- tests/auto/wayland/seat/tst_seat.cpp | 36 ++++---- tests/auto/wayland/seatv7/tst_seatv7.cpp | 2 +- tests/auto/wayland/shared/mockcompositor.cpp | 4 +- tests/auto/wayland/surface/tst_surface.cpp | 22 ++--- .../xdgdecorationv1/tst_xdgdecorationv1.cpp | 6 +- .../auto/wayland/xdgoutput/tst_xdgoutput.cpp | 24 ++--- tests/auto/wayland/xdgshell/tst_xdgshell.cpp | 90 +++++++++---------- 13 files changed, 140 insertions(+), 140 deletions(-) diff --git a/tests/auto/wayland/client/tst_client.cpp b/tests/auto/wayland/client/tst_client.cpp index 54d5865972e..c64862f0945 100644 --- a/tests/auto/wayland/client/tst_client.cpp +++ b/tests/auto/wayland/client/tst_client.cpp @@ -172,21 +172,21 @@ void tst_WaylandClient::activeWindowFollowsKeyboardFocus() Surface *s = nullptr; QCOMPOSITOR_TRY_VERIFY(s = surface()); - exec([=] { + exec([&] { sendShellSurfaceConfigure(s); }); QCOMPOSITOR_TRY_VERIFY(window.isExposed()); QCOMPARE(window.focusInEventCount, 0); - exec([=] { + exec([&] { keyboard()->sendEnter(s); }); QTRY_COMPARE(window.focusInEventCount, 1); QCOMPARE(QGuiApplication::focusWindow(), &window); QCOMPARE(window.focusOutEventCount, 0); - exec([=] { + exec([&] { keyboard()->sendLeave(s); // or implement setFocus in Keyboard }); QTRY_COMPARE(window.focusOutEventCount, 1); @@ -200,7 +200,7 @@ void tst_WaylandClient::events() Surface *s = nullptr; QCOMPOSITOR_TRY_VERIFY(s = surface()); - exec([=] { + exec([&] { sendShellSurfaceConfigure(s); }); @@ -208,7 +208,7 @@ void tst_WaylandClient::events() QCOMPARE(window.focusInEventCount, 0); - exec([=] { + exec([&] { keyboard()->sendEnter(s); }); QTRY_COMPARE(window.focusInEventCount, 1); @@ -222,14 +222,14 @@ void tst_WaylandClient::events() // xkb_v1 1 libxkbcommon compatible; to determine the xkb keycode, clients must add 8 to the key event keycode uint keyCode = 80; // arbitrarily chosen QCOMPARE(window.keyPressEventCount, 0); - exec([=] { + exec([&] { keyboard()->sendKey(client(), keyCode - 8, Keyboard::key_state_pressed); // related with native scan code }); QTRY_COMPARE(window.keyPressEventCount, 1); QCOMPARE(window.keyCode, keyCode); QCOMPARE(window.keyReleaseEventCount, 0); - exec([=] { + exec([&] { keyboard()->sendKey(client(), keyCode - 8, Keyboard::key_state_released); // related with native scan code }); QTRY_COMPARE(window.keyReleaseEventCount, 1); @@ -241,12 +241,12 @@ void tst_WaylandClient::events() }); // Note: wl_touch.frame should not be the last event in a test until QTBUG-66563 is fixed. // See also: QTBUG-66537 - exec([=] { + exec([&] { touch()->sendFrame(client()); }); QTRY_COMPARE(window.touchEventCount, 1); - exec([=] { + exec([&] { touch()->sendUp(client(), touchId); touch()->sendFrame(client()); }); @@ -266,7 +266,7 @@ void tst_WaylandClient::events() QTRY_COMPARE(window.mousePressPos, mousePressPos); QCOMPARE(window.mouseReleaseEventCount, 0); - exec([=] { + exec([&] { pointer()->sendButton(client(), BTN_LEFT, Pointer::button_state_released); pointer()->sendFrame(client()); }); @@ -280,7 +280,7 @@ void tst_WaylandClient::backingStore() Surface *s = nullptr; QCOMPOSITOR_TRY_VERIFY(s = surface()); - exec([=] { + exec([&] { sendShellSurfaceConfigure(s); }); @@ -391,7 +391,7 @@ void tst_WaylandClient::touchDrag() Surface *s = nullptr; QCOMPOSITOR_TRY_VERIFY(s = surface()); - exec([=] { + exec([&] { sendShellSurfaceConfigure(s); }); @@ -405,7 +405,7 @@ void tst_WaylandClient::touchDrag() &test, &DNDTest::touchDrag); }); - exec([=] { + exec([&] { keyboard()->sendEnter(s); }); QTRY_COMPARE(QGuiApplication::focusWindow(), &window); @@ -428,7 +428,7 @@ void tst_WaylandClient::mouseDrag() Surface *s = nullptr; QCOMPOSITOR_TRY_VERIFY(s = surface()); - exec([=] { + exec([&] { sendShellSurfaceConfigure(s); }); @@ -441,7 +441,7 @@ void tst_WaylandClient::mouseDrag() &test, &DNDTest::finishMouseDrag); }); - exec([=] { + exec([&] { keyboard()->sendEnter(s); }); QTRY_COMPARE(QGuiApplication::focusWindow(), &window); @@ -516,7 +516,7 @@ void tst_WaylandClient::hiddenPopupParent() // with the set_popup request. Surface *s = nullptr; QCOMPOSITOR_TRY_VERIFY(s = surface()); - exec([=] { + exec([&] { sendShellSurfaceConfigure(s); }); QCOMPOSITOR_TRY_VERIFY(toplevel.isExposed()); @@ -553,7 +553,7 @@ void tst_WaylandClient::glWindow() testWindow->show(); Surface *s = nullptr; QCOMPOSITOR_TRY_VERIFY(s = surface()); - exec([=] { + exec([&] { sendShellSurfaceConfigure(s); }); diff --git a/tests/auto/wayland/nooutput/tst_nooutput.cpp b/tests/auto/wayland/nooutput/tst_nooutput.cpp index 35b4e0e95da..81903045574 100644 --- a/tests/auto/wayland/nooutput/tst_nooutput.cpp +++ b/tests/auto/wayland/nooutput/tst_nooutput.cpp @@ -41,7 +41,7 @@ void tst_nooutput::noScreens() // The window should not be exposed before the first xdg_surface configure event QTRY_VERIFY(!window.isExposed()); - exec([=] { + exec([&] { xdgToplevel()->sendConfigure({0, 0}, {}); // Let the window decide the size xdgSurface()->sendConfigure(nextSerial()); }); diff --git a/tests/auto/wayland/output/tst_output.cpp b/tests/auto/wayland/output/tst_output.cpp index 3509a777113..f43c7a44ee3 100644 --- a/tests/auto/wayland/output/tst_output.cpp +++ b/tests/auto/wayland/output/tst_output.cpp @@ -48,7 +48,7 @@ void tst_output::primaryScreen() void tst_output::secondaryHiDpiScreen() { - exec([=] { + exec([&] { OutputData d; d.position = {1920, 0}; // in global compositor space (not pixels) d.mode.resolution = {800, 640}; @@ -74,15 +74,15 @@ void tst_output::secondaryHiDpiScreen() QCOMPARE(screen->geometry(), QRect(QPoint(1920, 0), QSize(400, 320))); QCOMPARE(screen->virtualGeometry(), QRect(QPoint(0, 0), QSize(1920 + 800 / 2, 1080))); - exec([=] { remove(output(1)); }); + exec([&] { remove(output(1)); }); } // QTBUG-62044 void tst_output::addScreenWithGeometryChange() { - const QPoint initialPosition = exec([=] { return output(0)->m_data.position; }); + const QPoint initialPosition = exec([&] { return output(0)->m_data.position; }); - exec([=] { + exec([&] { auto *oldOutput = output(0); auto *newOutput = add(); newOutput->m_data.mode.resolution = {1280, 720}; @@ -98,7 +98,7 @@ void tst_output::addScreenWithGeometryChange() QTRY_COMPARE(QGuiApplication::primaryScreen()->geometry(), QRect(QPoint(1280, 0), QSize(1920, 1080))); // Remove the extra output and move the old one back - exec([=] { + exec([&] { remove(output(1)); output()->m_data.position = initialPosition; output()->sendGeometry(); @@ -119,7 +119,7 @@ void tst_output::windowScreens() QScreen *primaryScreen = QGuiApplication::screens().first(); QCOMPARE(window.screen(), primaryScreen); - exec([=] { add(); }); + exec([&] { add(); }); QTRY_COMPARE(QGuiApplication::screens().size(), 2); QScreen *secondaryScreen = QGuiApplication::screens().at(1); @@ -128,19 +128,19 @@ void tst_output::windowScreens() window.setScreen(secondaryScreen); QCOMPARE(window.screen(), secondaryScreen); - exec([=] { + exec([&] { xdgToplevel()->surface()->sendEnter(output(0)); xdgToplevel()->surface()->sendEnter(output(1)); }); QTRY_COMPARE(window.screen(), primaryScreen); - exec([=] { + exec([&] { xdgToplevel()->surface()->sendLeave(output(0)); }); QTRY_COMPARE(window.screen(), secondaryScreen); - exec([=] { + exec([&] { remove(output(1)); }); QTRY_COMPARE(QGuiApplication::screens().size(), 1); @@ -186,7 +186,7 @@ void tst_output::removePrimaryScreen() // QTBUG-72828 void tst_output::screenOrder() { - exec([=] { + exec([&] { add()->m_data.model = "Screen 1"; add()->m_data.model = "Screen 2"; }); @@ -197,7 +197,7 @@ void tst_output::screenOrder() QCOMPARE(screens[1]->model(), "Screen 1"); QCOMPARE(screens[2]->model(), "Screen 2"); - exec([=] { + exec([&] { remove(output(2)); remove(output(1)); }); @@ -215,8 +215,8 @@ void tst_output::removeAllScreens() const QString wlOutputPrimaryScreenModel = QGuiApplication::primaryScreen()->model(); // Get screen info so we can restore it after - auto screenInfo = exec([=] { return output()->m_data; }); - exec([=] { remove(output()); }); + auto screenInfo = exec([&] { return output()->m_data; }); + exec([&] { remove(output()); }); // Make sure the wl_output is actually removed before we continue QTRY_VERIFY(!QGuiApplication::primaryScreen() || QGuiApplication::primaryScreen()->model() != wlOutputPrimaryScreenModel); @@ -226,7 +226,7 @@ void tst_output::removeAllScreens() window2.resize(400, 320); window2.show(); - exec([=] { add(screenInfo); }); + exec([&] { add(screenInfo); }); // Things should be back to normal QTRY_VERIFY(QGuiApplication::primaryScreen()); diff --git a/tests/auto/wayland/primaryselectionv1/tst_primaryselectionv1.cpp b/tests/auto/wayland/primaryselectionv1/tst_primaryselectionv1.cpp index b9e12873052..9e85acca635 100644 --- a/tests/auto/wayland/primaryselectionv1/tst_primaryselectionv1.cpp +++ b/tests/auto/wayland/primaryselectionv1/tst_primaryselectionv1.cpp @@ -261,7 +261,7 @@ void tst_primaryselectionv1::createsPrimaryDevice() void tst_primaryselectionv1::createsPrimaryDeviceForNewSeats() { - exec([=] { add(); }); + exec([&] { add(); }); QCOMPOSITOR_TRY_VERIFY(primarySelectionDevice(1)); } diff --git a/tests/auto/wayland/reconnect/tst_reconnect.cpp b/tests/auto/wayland/reconnect/tst_reconnect.cpp index f0090d1f40a..c7f7d8f8936 100644 --- a/tests/auto/wayland/reconnect/tst_reconnect.cpp +++ b/tests/auto/wayland/reconnect/tst_reconnect.cpp @@ -192,14 +192,14 @@ void tst_WaylandReconnect::keyFocus() configureWindow(); QTRY_VERIFY(window.isExposed()); - exec([=] { + exec([&] { m_comp->keyboard()->sendEnter(m_comp->surface()); }); QTRY_COMPARE(window.focusInEventCount, 1); uint keyCode = 80; QCOMPARE(window.keyPressEventCount, 0); - exec([=] { + exec([&] { m_comp->keyboard()->sendKey(m_comp->client(), keyCode - 8, Keyboard::key_state_pressed); }); QTRY_COMPARE(window.keyPressEventCount, 1); @@ -213,10 +213,10 @@ void tst_WaylandReconnect::keyFocus() QTRY_COMPARE(window.focusOutEventCount, 1); // fake the user explicitly focussing this window afterwards - exec([=] { + exec([&] { m_comp->keyboard()->sendEnter(m_comp->surface()); }); - exec([=] { + exec([&] { m_comp->keyboard()->sendKey(m_comp->client(), keyCode - 8, Keyboard::key_state_pressed); }); QTRY_COMPARE(window.focusInEventCount, 2); @@ -227,7 +227,7 @@ void tst_WaylandReconnect::keyFocus() void tst_WaylandReconnect::configureWindow() { QCOMPOSITOR_TRY_VERIFY(m_comp->xdgToplevel()); - m_comp->exec([=] { + m_comp->exec([&] { m_comp->xdgToplevel()->sendConfigure({0, 0}, {}); const uint serial = m_comp->nextSerial(); // Let the window decide the size m_comp->xdgSurface()->sendConfigure(serial); diff --git a/tests/auto/wayland/scaling/tst_scaling.cpp b/tests/auto/wayland/scaling/tst_scaling.cpp index f94c37cc99b..9d8283d6e84 100644 --- a/tests/auto/wayland/scaling/tst_scaling.cpp +++ b/tests/auto/wayland/scaling/tst_scaling.cpp @@ -33,12 +33,12 @@ void tst_scaling::scaledWindow() window.show(); QCOMPOSITOR_TRY_VERIFY(xdgToplevel()); - QSignalSpy configureSpy(exec([=] { return xdgSurface(); }), &XdgSurface::configureCommitted); - QSignalSpy surfaceCommitSpy(exec([=] { return surface(); }), &Surface::commit); + QSignalSpy configureSpy(exec([&] { return xdgSurface(); }), &XdgSurface::configureCommitted); + QSignalSpy surfaceCommitSpy(exec([&] { return surface(); }), &Surface::commit); const QSize configureSize(100, 100); - exec([=] { + exec([&] { QVERIFY(fractionalScale()); fractionalScale()->send_preferred_scale(1.5 * 120); xdgToplevel()->sendCompleteConfigure(configureSize); @@ -47,7 +47,7 @@ void tst_scaling::scaledWindow() QTRY_COMPARE(configureSpy.count(), 1); QCOMPARE(window.devicePixelRatio(), 1.5); - exec([=] { + exec([&] { Buffer *buffer = xdgToplevel()->surface()->m_committed.buffer; QVERIFY(buffer); QCOMPARE(buffer->size(), QSize(150, 150)); @@ -61,7 +61,7 @@ void tst_scaling::scaledWindow() QCOMPARE(window.size(), QSize(200,200)); QVERIFY(surfaceCommitSpy.wait()); - exec([=] { + exec([&] { Buffer *buffer = xdgToplevel()->surface()->m_committed.buffer; QVERIFY(buffer); QCOMPARE(buffer->size(), QSize(300, 300)); @@ -71,7 +71,7 @@ void tst_scaling::scaledWindow() }); // dynamic scale change - exec([=] { + exec([&] { QVERIFY(fractionalScale()); fractionalScale()->send_preferred_scale(2.5 * 120); }); @@ -79,7 +79,7 @@ void tst_scaling::scaledWindow() QCOMPARE(window.size(), QSize(200,200)); QVERIFY(surfaceCommitSpy.wait()); - exec([=] { + exec([&] { Buffer *buffer = xdgToplevel()->surface()->m_committed.buffer; QVERIFY(buffer); QCOMPARE(buffer->size(), QSize(500, 500)); @@ -112,9 +112,9 @@ void tst_scaling::roundingPolicy() window.show(); QCOMPOSITOR_TRY_VERIFY(xdgToplevel()); - QSignalSpy surfaceCommitSpy(exec([=] { return surface(); }), &Surface::commit); + QSignalSpy surfaceCommitSpy(exec([&] { return surface(); }), &Surface::commit); - exec([=] { + exec([&] { QVERIFY(fractionalScale()); fractionalScale()->send_preferred_scale(scale * 120); xdgToplevel()->sendCompleteConfigure(); @@ -122,7 +122,7 @@ void tst_scaling::roundingPolicy() QVERIFY(surfaceCommitSpy.wait()); - exec([=] { + exec([&] { Buffer *buffer = xdgToplevel()->surface()->m_committed.buffer; QVERIFY(buffer); QCOMPARE(buffer->size(), expectedBufferSize); diff --git a/tests/auto/wayland/seat/tst_seat.cpp b/tests/auto/wayland/seat/tst_seat.cpp index 9db10d552db..34409c2ca06 100644 --- a/tests/auto/wayland/seat/tst_seat.cpp +++ b/tests/auto/wayland/seat/tst_seat.cpp @@ -70,7 +70,7 @@ void tst_seat::setsCursorOnEnter() window.show(); QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial); - exec([=] { + exec([&] { auto *surface = xdgSurface()->m_surface; pointer()->sendEnter(surface, {0, 0}); pointer()->sendFrame(surface->resource()->client()); @@ -81,13 +81,13 @@ void tst_seat::setsCursorOnEnter() void tst_seat::usesEnterSerial() { - QSignalSpy setCursorSpy(exec([=] { return pointer(); }), &Pointer::setCursor); + QSignalSpy setCursorSpy(exec([&] { return pointer(); }), &Pointer::setCursor); QRasterWindow window; window.resize(64, 64); window.show(); QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial); - uint enterSerial = exec([=] { + uint enterSerial = exec([&] { return pointer()->sendEnter(xdgSurface()->m_surface, {0, 0}); }); QCOMPOSITOR_TRY_VERIFY(pointer()->cursorSurface()); @@ -164,7 +164,7 @@ void tst_seat::simpleAxis() WheelWindow window; QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial); - exec([=] { + exec([&] { auto *p = pointer(); p->sendEnter(xdgToplevel()->surface(), {32, 32}); p->sendFrame(client()); @@ -196,7 +196,7 @@ void tst_seat::fingerScroll() WheelWindow window; QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial); - exec([=] { + exec([&] { auto *p = pointer(); auto *c = client(); p->sendEnter(xdgToplevel()->surface(), {32, 32}); @@ -236,7 +236,7 @@ void tst_seat::fingerScroll() QTRY_VERIFY(window.m_events.empty()); // Scroll horizontally as well - exec([=] { + exec([&] { pointer()->sendAxisSource(client(), Pointer::axis_source_finger); pointer()->sendAxis(client(), Pointer::axis_horizontal_scroll, 10); pointer()->sendFrame(client()); @@ -251,7 +251,7 @@ void tst_seat::fingerScroll() } // Scroll diagonally - exec([=] { + exec([&] { pointer()->sendAxisSource(client(), Pointer::axis_source_finger); pointer()->sendAxis(client(), Pointer::axis_horizontal_scroll, 10); pointer()->sendAxis(client(), Pointer::axis_vertical_scroll, 10); @@ -275,7 +275,7 @@ void tst_seat::fingerScroll() QVERIFY(window.m_events.empty()); // Sending axis_stop is mandatory when axis source == finger - exec([=] { + exec([&] { pointer()->sendAxisStop(client(), Pointer::axis_vertical_scroll); pointer()->sendFrame(client()); }); @@ -293,7 +293,7 @@ void tst_seat::fingerScrollSlow() WheelWindow window; QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial); - exec([=] { + exec([&] { auto *p = pointer(); auto *c = client(); p->sendEnter(xdgToplevel()->surface(), {32, 32}); @@ -323,7 +323,7 @@ void tst_seat::highResolutionScroll() WheelWindow window; QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial); - exec([=] { + exec([&] { auto *p = pointer(); auto *c = client(); p->sendEnter(xdgToplevel()->surface(), {32, 32}); @@ -344,7 +344,7 @@ void tst_seat::highResolutionScroll() QCOMPARE(e.pixelDelta, QPoint(0, 0)); } - exec([=] { + exec([&] { auto *p = pointer(); auto *c = client(); p->sendAxisSource(c, Pointer::axis_source_wheel); @@ -369,7 +369,7 @@ void tst_seat::continuousScroll() WheelWindow window; QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial); - exec([=] { + exec([&] { auto *p = pointer(); auto *c = client(); p->sendEnter(xdgToplevel()->surface(), {32, 32}); @@ -429,7 +429,7 @@ void tst_seat::singleTap() TouchWindow window; QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial); - exec([=] { + exec([&] { auto *t = touch(); auto *c = client(); t->sendDown(xdgToplevel()->surface(), {32, 32}, 1); @@ -460,7 +460,7 @@ void tst_seat::singleTapFloat() TouchWindow window; QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial); - exec([=] { + exec([&] { auto *t = touch(); auto *c = client(); t->sendDown(xdgToplevel()->surface(), {32.75, 32.25}, 1); @@ -491,7 +491,7 @@ void tst_seat::multiTouch() TouchWindow window; QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial); - exec([=] { + exec([&] { auto *t = touch(); auto *c = client(); @@ -563,7 +563,7 @@ void tst_seat::multiTouchUpAndMotionFrame() TouchWindow window; QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial); - exec([=] { + exec([&] { auto *t = touch(); auto *c = client(); @@ -612,7 +612,7 @@ void tst_seat::tapAndMoveInSameFrame() TouchWindow window; QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial); - exec([=] { + exec([&] { auto *t = touch(); auto *c = client(); @@ -644,7 +644,7 @@ void tst_seat::cancelTouch() TouchWindow window; QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial); - exec([=] { + exec([&] { auto *t = touch(); auto *c = client(); t->sendDown(xdgToplevel()->surface(), {32, 32}, 1); diff --git a/tests/auto/wayland/seatv7/tst_seatv7.cpp b/tests/auto/wayland/seatv7/tst_seatv7.cpp index e423456c5b5..0af22718465 100644 --- a/tests/auto/wayland/seatv7/tst_seatv7.cpp +++ b/tests/auto/wayland/seatv7/tst_seatv7.cpp @@ -100,7 +100,7 @@ void tst_seatv7::wheelDiscreteScroll() QFETCH(uint, source); - exec([=] { + exec([&] { auto *p = pointer(); auto *c = client(); p->sendEnter(xdgToplevel()->surface(), {32, 32}); diff --git a/tests/auto/wayland/shared/mockcompositor.cpp b/tests/auto/wayland/shared/mockcompositor.cpp index 43d417ff8bf..946e87ed6a7 100644 --- a/tests/auto/wayland/shared/mockcompositor.cpp +++ b/tests/auto/wayland/shared/mockcompositor.cpp @@ -93,8 +93,8 @@ uint DefaultCompositor::sendXdgShellPing() void DefaultCompositor::xdgPingAndWaitForPong() { - QSignalSpy pongSpy(exec([=] { return get(); }), &XdgWmBase::pong); - uint serial = exec([=] { return sendXdgShellPing(); }); + QSignalSpy pongSpy(exec([&] { return get(); }), &XdgWmBase::pong); + uint serial = exec([&] { return sendXdgShellPing(); }); QTRY_COMPARE(pongSpy.size(), 1); QTRY_COMPARE(pongSpy.first().at(0).toUInt(), serial); } diff --git a/tests/auto/wayland/surface/tst_surface.cpp b/tests/auto/wayland/surface/tst_surface.cpp index b583390f024..ad7af036a14 100644 --- a/tests/auto/wayland/surface/tst_surface.cpp +++ b/tests/auto/wayland/surface/tst_surface.cpp @@ -51,8 +51,8 @@ void tst_surface::waitForFrameCallbackRaster() TestWindow window; window.show(); QCOMPOSITOR_TRY_VERIFY(xdgToplevel()); - QSignalSpy bufferSpy(exec([=] { return xdgSurface()->m_surface; }), &Surface::bufferCommitted); - exec([=] { xdgToplevel()->sendCompleteConfigure(); }); + QSignalSpy bufferSpy(exec([&] { return xdgSurface()->m_surface; }), &Surface::bufferCommitted); + exec([&] { xdgToplevel()->sendCompleteConfigure(); }); // We should get the first buffer without waiting for a frame callback QTRY_COMPARE(bufferSpy.size(), 1); @@ -92,8 +92,8 @@ void tst_surface::waitForFrameCallbackGl() TestWindow window; window.show(); QCOMPOSITOR_TRY_VERIFY(xdgToplevel()); - QSignalSpy bufferSpy(exec([=] { return xdgSurface()->m_surface; }), &Surface::bufferCommitted); - exec([=] { xdgToplevel()->sendCompleteConfigure(); }); + QSignalSpy bufferSpy(exec([&] { return xdgSurface()->m_surface; }), &Surface::bufferCommitted); + exec([&] { xdgToplevel()->sendCompleteConfigure(); }); // We should get the first buffer without waiting for a frame callback QTRY_COMPARE(bufferSpy.size(), 1); @@ -128,8 +128,8 @@ void tst_surface::negotiateShmFormat() window.resize(64, 48); window.show(); QCOMPOSITOR_TRY_VERIFY(xdgToplevel()); - QSignalSpy bufferSpy(exec([=] { return xdgSurface()->m_surface; }), &Surface::bufferCommitted); - const uint serial = exec([=] { return xdgToplevel()->sendCompleteConfigure(); }); + QSignalSpy bufferSpy(exec([&] { return xdgSurface()->m_surface; }), &Surface::bufferCommitted); + const uint serial = exec([&] { return xdgToplevel()->sendCompleteConfigure(); }); QCOMPOSITOR_TRY_COMPARE(xdgSurface()->m_committedConfigureSerial, serial); exec([&] { Buffer *buffer = xdgToplevel()->surface()->m_committed.buffer; @@ -157,11 +157,11 @@ void tst_surface::createSubsurface() QCOMPOSITOR_TRY_VERIFY(subSurface()); QCOMPOSITOR_TRY_VERIFY(xdgToplevel()); - exec([=] { xdgToplevel()->sendCompleteConfigure(); }); + exec([&] { xdgToplevel()->sendCompleteConfigure(); }); QCOMPOSITOR_TRY_VERIFY(xdgSurface()->m_committedConfigureSerial); - const Surface *mainSurface = exec([=] {return surface(0);}); - const Surface *childSurface = exec([=] {return surface(1);}); + const Surface *mainSurface = exec([&] {return surface(0);}); + const Surface *childSurface = exec([&] {return surface(1);}); QSignalSpy mainSurfaceCommitSpy(mainSurface, &Surface::commit); QSignalSpy childSurfaceCommitSpy(childSurface, &Surface::commit); @@ -187,7 +187,7 @@ void tst_surface::createSubsurfaceForHiddenParent() window.resize(64, 64); window.show(); QCOMPOSITOR_TRY_VERIFY(xdgToplevel()); - exec([=] { xdgToplevel()->sendCompleteConfigure(); }); + exec([&] { xdgToplevel()->sendCompleteConfigure(); }); QCOMPOSITOR_TRY_VERIFY(xdgSurface()->m_committedConfigureSerial); window.hide(); @@ -201,7 +201,7 @@ void tst_surface::createSubsurfaceForHiddenParent() xdgPingAndWaitForPong(); // Make sure the subsurface was actually created - const Subsurface *subsurface = exec([=] {return subSurface(0);}); + const Subsurface *subsurface = exec([&] {return subSurface(0);}); QVERIFY(subsurface); } diff --git a/tests/auto/wayland/xdgdecorationv1/tst_xdgdecorationv1.cpp b/tests/auto/wayland/xdgdecorationv1/tst_xdgdecorationv1.cpp index ba91514d20b..121680cdb97 100644 --- a/tests/auto/wayland/xdgdecorationv1/tst_xdgdecorationv1.cpp +++ b/tests/auto/wayland/xdgdecorationv1/tst_xdgdecorationv1.cpp @@ -151,7 +151,7 @@ void tst_xdgdecorationv1::clientSidePreferredByCompositor() QCOMPOSITOR_TRY_VERIFY(xdgToplevel()); QCOMPOSITOR_TRY_VERIFY(toplevelDecoration()->m_unsetModeRequested); QVERIFY(window.frameMargins().isNull()); // We're still waiting for a configure - exec([=] { + exec([&] { toplevelDecoration()->sendConfigure(XdgToplevelDecorationV1::mode_client_side); xdgToplevel()->sendCompleteConfigure(); }); @@ -165,7 +165,7 @@ void tst_xdgdecorationv1::initialFramelessWindowHint() window.show(); QCOMPOSITOR_TRY_COMPARE(get()->resourceMap().size(), 1); QCOMPOSITOR_TRY_VERIFY(xdgToplevel()); - exec([=]{ + exec([&]{ xdgToplevel()->sendCompleteConfigure(); }); QCOMPOSITOR_TRY_VERIFY(xdgSurface()->m_committedConfigureSerial); @@ -181,7 +181,7 @@ void tst_xdgdecorationv1::delayedFramelessWindowHint() window.show(); QCOMPOSITOR_TRY_COMPARE(get()->resourceMap().size(), 1); QCOMPOSITOR_TRY_VERIFY(xdgToplevel()); - exec([=]{ + exec([&]{ xdgToplevel()->sendCompleteConfigure(); }); QCOMPOSITOR_TRY_VERIFY(xdgSurface()->m_committedConfigureSerial); diff --git a/tests/auto/wayland/xdgoutput/tst_xdgoutput.cpp b/tests/auto/wayland/xdgoutput/tst_xdgoutput.cpp index bb104dd59c9..5e1ebd8842f 100644 --- a/tests/auto/wayland/xdgoutput/tst_xdgoutput.cpp +++ b/tests/auto/wayland/xdgoutput/tst_xdgoutput.cpp @@ -43,7 +43,7 @@ void tst_xdgoutput::primaryScreen() { // Verify that the client has bound to the global QCOMPOSITOR_TRY_COMPARE(get()->resourceMap().size(), 1); - exec([=] { + exec([&] { auto *resource = xdgOutput()->resourceMap().value(client()); QCOMPARE(resource->version(), 3); QCOMPARE(xdgOutput()->m_logicalGeometry.size(), QSize(1920, 1080)); @@ -56,7 +56,7 @@ void tst_xdgoutput::primaryScreen() void tst_xdgoutput::overrideGeometry() { - exec([=] { + exec([&] { auto *output = add(); auto *xdgOutput = get()->getXdgOutput(output); xdgOutput->m_logicalGeometry = QRect(10, 20, 800, 1200); @@ -68,12 +68,12 @@ void tst_xdgoutput::overrideGeometry() QTRY_COMPARE(s->size(), QSize(800, 1200)); QTRY_COMPARE(s->geometry().topLeft(), QPoint(10, 20)); - exec([=] { remove(output(1)); }); + exec([&] { remove(output(1)); }); } void tst_xdgoutput::changeGeometry() { - auto *xdgOutput = exec([=] { + auto *xdgOutput = exec([&] { auto *output = add(); auto *xdgOutput = get()->getXdgOutput(output); xdgOutput->m_logicalGeometry = QRect(10, 20, 800, 1200); @@ -84,7 +84,7 @@ void tst_xdgoutput::changeGeometry() auto *screen = QGuiApplication::screens()[1]; QTRY_COMPARE(screen->size(), QSize(800, 1200)); - exec([=] { + exec([&] { xdgOutput->sendLogicalSize(QSize(1024, 768)); }); @@ -92,21 +92,21 @@ void tst_xdgoutput::changeGeometry() // done event. If we TRY_COMPARE immediately, we risk that the client just hasn't handled the // logical_size request yet, so we add a screen and verify it on the client side just to give // the client a chance to mess up. - exec([=] { add(); }); + exec([&] { add(); }); QTRY_COMPARE(QGuiApplication::screens().size(), 3); - exec([=] { remove(output(2)); }); + exec([&] { remove(output(2)); }); // The logical_size event should have been handled by now, but state should not have been applied yet. QTRY_COMPARE(screen->size(), QSize(800, 1200)); - exec([=] { + exec([&] { xdgOutput->m_output->sendDone(); }); // Finally, the size should change QTRY_COMPARE(screen->size(), QSize(1024, 768)); - exec([=] { remove(output(1)); }); + exec([&] { remove(output(1)); }); } void tst_xdgoutput::outputCreateEnterRace() @@ -118,13 +118,13 @@ void tst_xdgoutput::outputCreateEnterRace() window.resize(400, 320); window.show(); QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial); - exec([=] { xdgToplevel()->surface()->sendEnter(output(0));}); + exec([&] { xdgToplevel()->surface()->sendEnter(output(0));}); QTRY_COMPARE(QGuiApplication::screens().size(), 1); QScreen *primaryScreen = QGuiApplication::screens().first(); QCOMPARE(window.screen(), primaryScreen); - auto *out = exec([=] { + auto *out = exec([&] { return add(); }); @@ -138,7 +138,7 @@ void tst_xdgoutput::outputCreateEnterRace() QTRY_COMPARE(QGuiApplication::screens().size(), 2); QTRY_COMPARE(window.screen(), QGuiApplication::screens()[1]); - exec([=] { remove(out); }); + exec([&] { remove(out); }); m_config.autoConfigure = false; m_config.autoEnter = true; } diff --git a/tests/auto/wayland/xdgshell/tst_xdgshell.cpp b/tests/auto/wayland/xdgshell/tst_xdgshell.cpp index 82fb50e32e7..ba4027be1c5 100644 --- a/tests/auto/wayland/xdgshell/tst_xdgshell.cpp +++ b/tests/auto/wayland/xdgshell/tst_xdgshell.cpp @@ -60,13 +60,13 @@ void tst_xdgshell::basicConfigure() window.show(); QCOMPOSITOR_TRY_VERIFY(xdgToplevel()); - QSignalSpy configureSpy(exec([=] { return xdgSurface(); }), &XdgSurface::configureCommitted); + QSignalSpy configureSpy(exec([&] { return xdgSurface(); }), &XdgSurface::configureCommitted); QTRY_VERIFY(window.isVisible()); // The window should not be exposed before the first xdg_surface configure event QTRY_VERIFY(!window.isExposed()); - exec([=] { + exec([&] { xdgToplevel()->sendConfigure({0, 0}, {}); // Let the window decide the size }); @@ -74,9 +74,9 @@ void tst_xdgshell::basicConfigure() QTRY_VERIFY(!window.isExposed()); //Window should not be exposed before the first configure event QVERIFY(configureSpy.isEmpty()); - const uint serial = exec([=] { return nextSerial(); }); + const uint serial = exec([&] { return nextSerial(); }); - exec([=] { + exec([&] { xdgSurface()->sendConfigure(serial); }); @@ -102,17 +102,17 @@ void tst_xdgshell::configureSize() window.show(); QCOMPOSITOR_TRY_VERIFY(xdgToplevel()); - QSignalSpy configureSpy(exec([=] { return xdgSurface(); }), &XdgSurface::configureCommitted); + QSignalSpy configureSpy(exec([&] { return xdgSurface(); }), &XdgSurface::configureCommitted); const QSize configureSize(60, 40); - exec([=] { + exec([&] { xdgToplevel()->sendCompleteConfigure(configureSize); }); QTRY_COMPARE(configureSpy.size(), 1); - exec([=] { + exec([&] { Buffer *buffer = xdgToplevel()->surface()->m_committed.buffer; QVERIFY(buffer); QCOMPARE(buffer->size(), configureSize); @@ -128,7 +128,7 @@ void tst_xdgshell::configureStates() QCOMPOSITOR_TRY_VERIFY(xdgToplevel()); const QSize windowedSize(320, 240); - const uint windowedSerial = exec([=] { + const uint windowedSerial = exec([&] { return xdgToplevel()->sendCompleteConfigure(windowedSize, { XdgToplevel::state_activated }); }); QCOMPOSITOR_TRY_COMPARE(xdgSurface()->m_committedConfigureSerial, windowedSerial); @@ -146,7 +146,7 @@ void tst_xdgshell::configureStates() Qt::WindowActive)); // Just make sure it eventually get's set correctly const QSize screenSize(640, 480); - const uint maximizedSerial = exec([=] { + const uint maximizedSerial = exec([&] { return xdgToplevel()->sendCompleteConfigure(screenSize, { XdgToplevel::state_activated, XdgToplevel::state_maximized }); }); QCOMPOSITOR_TRY_COMPARE(xdgSurface()->m_committedConfigureSerial, maximizedSerial); @@ -155,7 +155,7 @@ void tst_xdgshell::configureStates() QCOMPARE(window.frameGeometry().size(), screenSize); // QCOMPARE(window.frameGeometry().topLeft(), QPoint()); // TODO: this doesn't currently work when window decorations are enabled - const uint fullscreenSerial = exec([=] { + const uint fullscreenSerial = exec([&] { return xdgToplevel()->sendCompleteConfigure(screenSize, { XdgToplevel::state_activated, XdgToplevel::state_fullscreen }); }); QCOMPOSITOR_TRY_COMPARE(xdgSurface()->m_committedConfigureSerial, fullscreenSerial); @@ -165,7 +165,7 @@ void tst_xdgshell::configureStates() // QCOMPARE(window.frameGeometry().topLeft(), QPoint()); // TODO: this doesn't currently work when window decorations are enabled // The window should remember its original size - const uint restoreSerial = exec([=] { + const uint restoreSerial = exec([&] { return xdgToplevel()->sendCompleteConfigure({0, 0}, { XdgToplevel::state_activated }); }); QCOMPOSITOR_TRY_COMPARE(xdgSurface()->m_committedConfigureSerial, restoreSerial); @@ -184,7 +184,7 @@ void tst_xdgshell::configureBounds() QCOMPOSITOR_TRY_VERIFY(xdgToplevel()); // Take xdg_toplevel.configure_bounds into account only if the configure event has 0x0 size. - const uint serial1 = exec([=] { + const uint serial1 = exec([&] { xdgToplevel()->sendConfigureBounds(QSize(800, 600)); return xdgToplevel()->sendCompleteConfigure(QSize(0, 0), { XdgToplevel::state_activated }); }); @@ -192,7 +192,7 @@ void tst_xdgshell::configureBounds() QCOMPARE(window.frameGeometry().size(), QSize(800, 600)); // Window size in xdg_toplevel configure events takes precedence over the configure bounds. - const uint serial2 = exec([=] { + const uint serial2 = exec([&] { xdgToplevel()->sendConfigureBounds(QSize(800, 600)); return xdgToplevel()->sendCompleteConfigure(QSize(1600, 900), { XdgToplevel::state_activated }); }); @@ -220,11 +220,11 @@ void tst_xdgshell::popup() window.show(); QCOMPOSITOR_TRY_VERIFY(xdgToplevel()); - QSignalSpy toplevelConfigureSpy(exec([=] { return xdgSurface(); }), &XdgSurface::configureCommitted); - exec([=] { xdgToplevel()->sendCompleteConfigure(); }); + QSignalSpy toplevelConfigureSpy(exec([&] { return xdgSurface(); }), &XdgSurface::configureCommitted); + exec([&] { xdgToplevel()->sendCompleteConfigure(); }); QTRY_COMPARE(toplevelConfigureSpy.size(), 1); - uint clickSerial = exec([=] { + uint clickSerial = exec([&] { auto *surface = xdgToplevel()->surface(); auto *p = pointer(); auto *c = client(); @@ -238,7 +238,7 @@ void tst_xdgshell::popup() QTRY_VERIFY(window.m_popup); QCOMPOSITOR_TRY_VERIFY(xdgPopup()); - QSignalSpy popupConfigureSpy(exec([=] { return xdgPopup()->m_xdgSurface; }), &XdgSurface::configureCommitted); + QSignalSpy popupConfigureSpy(exec([&] { return xdgPopup()->m_xdgSurface; }), &XdgSurface::configureCommitted); QCOMPOSITOR_TRY_VERIFY(xdgPopup()->m_grabbed); QCOMPOSITOR_TRY_COMPARE(xdgPopup()->m_grabSerial, clickSerial); @@ -246,13 +246,13 @@ void tst_xdgshell::popup() QVERIFY(!popup->isExposed()); // wait for configure QRect rect1 = QRect(100, 100, 100, 100); - exec([=] { xdgPopup()->sendConfigure(rect1); }); + exec([&] { xdgPopup()->sendConfigure(rect1); }); // Nothing should happen before the *xdg_surface* configure QTRY_VERIFY(!popup->isExposed()); // Popup shouldn't be exposed before the first configure event QVERIFY(popupConfigureSpy.isEmpty()); - const uint configureSerial = exec([=] { + const uint configureSerial = exec([&] { return xdgPopup()->m_xdgSurface->sendConfigure(); }); @@ -265,9 +265,9 @@ void tst_xdgshell::popup() QCOMPARE(popup->geometry(), rect1); QRect rect2 = QRect(50, 50, 150, 150); - exec([=] { xdgPopup()->sendConfigure(rect2); }); + exec([&] { xdgPopup()->sendConfigure(rect2); }); - const uint configureSerial2 = exec([=] { + const uint configureSerial2 = exec([&] { return xdgPopup()->m_xdgSurface->sendConfigure(); }); @@ -318,10 +318,10 @@ void tst_xdgshell::tooltipOnPopup() window.show(); QCOMPOSITOR_TRY_VERIFY(xdgToplevel()); - exec([=] { xdgToplevel()->sendCompleteConfigure(); }); + exec([&] { xdgToplevel()->sendCompleteConfigure(); }); QCOMPOSITOR_TRY_VERIFY(xdgToplevel()->m_xdgSurface->m_committedConfigureSerial); - exec([=] { + exec([&] { auto *surface = xdgToplevel()->surface(); auto *p = pointer(); auto *c = client(); @@ -335,11 +335,11 @@ void tst_xdgshell::tooltipOnPopup() }); QCOMPOSITOR_TRY_VERIFY(xdgPopup()); - exec([=] { xdgPopup()->sendCompleteConfigure(QRect(100, 100, 100, 100)); }); + exec([&] { xdgPopup()->sendCompleteConfigure(QRect(100, 100, 100, 100)); }); QCOMPOSITOR_TRY_VERIFY(xdgPopup()->m_xdgSurface->m_committedConfigureSerial); QCOMPOSITOR_TRY_VERIFY(xdgPopup()->m_grabbed); - exec([=] { + exec([&] { auto *surface = xdgPopup()->surface(); auto *p = pointer(); auto *c = client(); @@ -351,7 +351,7 @@ void tst_xdgshell::tooltipOnPopup() }); QCOMPOSITOR_TRY_VERIFY(xdgPopup(1)); - exec([=] { xdgPopup(1)->sendCompleteConfigure(QRect(100, 100, 100, 100)); }); + exec([&] { xdgPopup(1)->sendCompleteConfigure(QRect(100, 100, 100, 100)); }); QCOMPOSITOR_TRY_VERIFY(xdgPopup(1)->m_xdgSurface->m_committedConfigureSerial); QCOMPOSITOR_TRY_VERIFY(!xdgPopup(1)->m_grabbed); @@ -400,10 +400,10 @@ void tst_xdgshell::tooltipAndSiblingPopup() window.show(); QCOMPOSITOR_TRY_VERIFY(xdgToplevel()); - exec([=] { xdgToplevel()->sendCompleteConfigure(); }); + exec([&] { xdgToplevel()->sendCompleteConfigure(); }); QCOMPOSITOR_TRY_VERIFY(xdgToplevel()->m_xdgSurface->m_committedConfigureSerial); - exec([=] { + exec([&] { auto *surface = xdgToplevel()->surface(); auto *p = pointer(); auto *c = client(); @@ -417,11 +417,11 @@ void tst_xdgshell::tooltipAndSiblingPopup() }); QCOMPOSITOR_TRY_VERIFY(xdgPopup()); - exec([=] { xdgPopup()->sendCompleteConfigure(QRect(100, 100, 100, 100)); }); + exec([&] { xdgPopup()->sendCompleteConfigure(QRect(100, 100, 100, 100)); }); QCOMPOSITOR_TRY_VERIFY(xdgPopup()->m_xdgSurface->m_committedConfigureSerial); QCOMPOSITOR_TRY_VERIFY(!xdgPopup()->m_grabbed); - exec([=] { + exec([&] { auto *surface = xdgPopup()->surface(); auto *p = pointer(); auto *c = client(); @@ -433,7 +433,7 @@ void tst_xdgshell::tooltipAndSiblingPopup() }); QCOMPOSITOR_TRY_VERIFY(xdgPopup(1)); - exec([=] { xdgPopup(1)->sendCompleteConfigure(QRect(100, 100, 100, 100)); }); + exec([&] { xdgPopup(1)->sendCompleteConfigure(QRect(100, 100, 100, 100)); }); QCOMPOSITOR_TRY_VERIFY(xdgPopup(1)->m_xdgSurface->m_committedConfigureSerial); QCOMPOSITOR_TRY_VERIFY(xdgPopup(1)->m_grabbed); @@ -488,10 +488,10 @@ void tst_xdgshell::switchPopups() window.show(); QCOMPOSITOR_TRY_VERIFY(xdgToplevel()); - exec([=] { xdgToplevel()->sendCompleteConfigure(); }); + exec([&] { xdgToplevel()->sendCompleteConfigure(); }); QCOMPOSITOR_TRY_VERIFY(xdgToplevel()->m_xdgSurface->m_committedConfigureSerial); - exec([=] { + exec([&] { auto *surface = xdgToplevel()->surface(); auto *p = pointer(); auto *c = client(); @@ -505,13 +505,13 @@ void tst_xdgshell::switchPopups() }); QCOMPOSITOR_TRY_VERIFY(xdgPopup()); - exec([=] { xdgPopup()->sendCompleteConfigure(QRect(100, 100, 100, 100)); }); + exec([&] { xdgPopup()->sendCompleteConfigure(QRect(100, 100, 100, 100)); }); QCOMPOSITOR_TRY_VERIFY(xdgPopup()->m_xdgSurface->m_committedConfigureSerial); QCOMPOSITOR_TRY_VERIFY(xdgPopup()->m_grabbed); - QSignalSpy firstDestroyed(exec([=] { return xdgPopup(); }), &XdgPopup::destroyRequested); + QSignalSpy firstDestroyed(exec([&] { return xdgPopup(); }), &XdgPopup::destroyRequested); - exec([=] { + exec([&] { auto *surface = xdgToplevel()->surface(); auto *p = pointer(); auto *c = client(); @@ -536,7 +536,7 @@ void tst_xdgshell::switchPopups() QCOMPOSITOR_TRY_VERIFY(xdgPopup()->m_parentXdgSurface == xdgToplevel()->m_xdgSurface); // For good measure just check that configuring works as usual - exec([=] { xdgPopup()->sendCompleteConfigure(QRect(100, 100, 100, 100)); }); + exec([&] { xdgPopup()->sendCompleteConfigure(QRect(100, 100, 100, 100)); }); QCOMPOSITOR_TRY_VERIFY(xdgPopup()->m_xdgSurface->m_committedConfigureSerial); } @@ -560,10 +560,10 @@ void tst_xdgshell::hidePopupParent() window.show(); QCOMPOSITOR_TRY_VERIFY(xdgToplevel()); - exec([=] { xdgToplevel()->sendCompleteConfigure(); }); + exec([&] { xdgToplevel()->sendCompleteConfigure(); }); QCOMPOSITOR_TRY_VERIFY(xdgToplevel()->m_xdgSurface->m_committedConfigureSerial); - exec([=] { + exec([&] { auto *surface = xdgToplevel()->surface(); auto *p = pointer(); auto *c = client(); @@ -574,7 +574,7 @@ void tst_xdgshell::hidePopupParent() p->sendFrame(c); }); QCOMPOSITOR_TRY_VERIFY(xdgPopup()); - exec([=] { + exec([&] { xdgPopup()->sendConfigure(QRect(100, 100, 100, 100)); xdgPopup()->m_xdgSurface->sendConfigure(); }); @@ -595,9 +595,9 @@ void tst_xdgshell::pongs() // Verify that the client has bound to the global QCOMPOSITOR_TRY_COMPARE(get()->resourceMap().size(), 1); - QSignalSpy pongSpy(exec([=] { return get(); }), &XdgWmBase::pong); - const uint serial = exec([=] { return nextSerial(); }); - exec([=] { + QSignalSpy pongSpy(exec([&] { return get(); }), &XdgWmBase::pong); + const uint serial = exec([&] { return nextSerial(); }); + exec([&] { auto *base = get(); wl_resource *resource = base->resourceMap().first()->handle; base->send_ping(resource, serial); @@ -634,7 +634,7 @@ void tst_xdgshell::windowGeometry() window.show(); QCOMPOSITOR_TRY_VERIFY(xdgToplevel()); - exec([=] { xdgToplevel()->sendCompleteConfigure(); }); + exec([&] { xdgToplevel()->sendCompleteConfigure(); }); QSize marginsSize; marginsSize.setWidth(window.frameMargins().left() + window.frameMargins().right()); @@ -666,7 +666,7 @@ void tst_xdgshell::foreignSurface() // Just do something to make sure we don't destroy the surface before // the pointer events above are handled. - QSignalSpy spy(exec([=] { return surface(newSurfaceIndex); }), &Surface::commit); + QSignalSpy spy(exec([&] { return surface(newSurfaceIndex); }), &Surface::commit); wl_surface_commit(foreignSurface); QTRY_COMPARE(spy.size(), 1); From 369a5296a99b4a731747d183ba81333253846997 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Wed, 2 Aug 2023 08:28:52 +0200 Subject: [PATCH 1213/1507] QWaylandWindow: adapt to QPlatformWindow::setBackingStore() addition When qtbase/a4ca9e80658bca7dad1529f03c1b59173a6ecf62 added a virtual QPlatformWindow::setBackingStore(), this was hidden by the existing QWaylandWindow::setBackingStore(), causing a FTBFS on -developer-builds. Fix by using the newly-added detection macro to turn the existing function into an overrider. Pick-to: 6.6 Fixes: QTBUG-115691 Task-number: QTBUG-97482 Change-Id: If1d8c4443fe50030addb23331a50b7b9e1274626 Reviewed-by: Axel Spoerl Reviewed-by: David Edmundson --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 7 +++++++ src/plugins/platforms/wayland/qwaylandwindow_p.h | 4 ++++ 2 files changed, 11 insertions(+) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 505836296c4..d7bb6c6529a 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -1500,6 +1500,13 @@ QVariant QWaylandWindow::property(const QString &name, const QVariant &defaultVa return m_properties.value(name, defaultValue); } +#ifdef QT_PLATFORM_WINDOW_HAS_VIRTUAL_SET_BACKING_STORE +void QWaylandWindow::setBackingStore(QPlatformBackingStore *store) +{ + mBackingStore = dynamic_cast(store); +} +#endif + void QWaylandWindow::timerEvent(QTimerEvent *event) { if (event->timerId() != mFrameCallbackCheckIntervalTimerId) diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index 042ea56603b..17140c52e9f 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -201,7 +201,11 @@ public: QVariant property(const QString &name); QVariant property(const QString &name, const QVariant &defaultValue); +#ifdef QT_PLATFORM_WINDOW_HAS_VIRTUAL_SET_BACKING_STORE + void setBackingStore(QPlatformBackingStore *store) override; +#else void setBackingStore(QWaylandShmBackingStore *backingStore) { mBackingStore = backingStore; } +#endif QWaylandShmBackingStore *backingStore() const { return mBackingStore; } void setShellIntegration(QWaylandShellIntegration *shellIntegration); From 816f41c00d22ca157eed273183f0711d9f1b41c7 Mon Sep 17 00:00:00 2001 From: David Redondo Date: Wed, 2 Aug 2023 16:43:29 +0200 Subject: [PATCH 1214/1507] client: Set queued buffer busy From the outside it doesn't matter if the buffer was really committed or queued, it still in use. If it is not marked busy QWaylandShmBackingStore will delete when it is resized which can happen when the surface changes screens or receives a new fractional scale resulting in a use after free producing a crash or protocol error. Pick-to: 6.6 Change-Id: I8abc4edbd8990af5114aa0b36c8ecedb37a4f0f6 Reviewed-by: David Edmundson Reviewed-by: Kai Uwe Broulik --- src/plugins/platforms/wayland/qwaylandbuffer_p.h | 2 +- src/plugins/platforms/wayland/qwaylandwindow.cpp | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandbuffer_p.h b/src/plugins/platforms/wayland/qwaylandbuffer_p.h index 381debc8140..3798ef3ebbf 100644 --- a/src/plugins/platforms/wayland/qwaylandbuffer_p.h +++ b/src/plugins/platforms/wayland/qwaylandbuffer_p.h @@ -37,7 +37,7 @@ public: virtual QSize size() const = 0; virtual int scale() const { return 1; } - void setBusy() { mBusy = true; } + void setBusy(bool busy) { mBusy = busy; } bool busy() const { return mBusy; } void setCommitted() { mCommitted = true; } diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index d7bb6c6529a..c5316542e02 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -681,7 +681,7 @@ void QWaylandWindow::attach(QWaylandBuffer *buffer, int x, int y) if (buffer) { Q_ASSERT(!buffer->committed()); handleUpdate(); - buffer->setBusy(); + buffer->setBusy(true); mSurface->attach(buffer->buffer(), x, y); } else { @@ -713,7 +713,11 @@ void QWaylandWindow::safeCommit(QWaylandBuffer *buffer, const QRegion &damage) if (isExposed()) { commit(buffer, damage); } else { + if (mQueuedBuffer) { + mQueuedBuffer->setBusy(false); + } mQueuedBuffer = buffer; + mQueuedBuffer->setBusy(true); mQueuedBufferDamage = damage; } } From f195fed91afe0a92bc7163309853f66e597c225a Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Thu, 3 Aug 2023 12:28:44 +0300 Subject: [PATCH 1215/1507] Client: Fix buffer damage If the specified damage rectangle has fractional coordinates in the buffer local coordinate space, the buffer damage needs to be expanded, i.e. - bufferRect.left = floor(rect.left * scale) - bufferRect.right = ceil(rect.right * scale) = ceil((rect.x + rect.width) * scale) Flooring the coordinates and ceiling the size is not enough. It can produce incorrect results. For example, consider that a rectangle with logical coordinates of QRect(0, 23, 179, 46) has been damaged in a window with scale 1.5. When flooring the coordinates and ceiling the size, the following buffer damage rect will be produced: QRect(0, 34, 269, 69). Its height is off by 1, the expected height is 70 (ceil((23 + 46) * 1.5) - floor(23 * 1.5) = ceil(103.5) - floor(34.5) = 104 - 34 = 70). Pick-to: 5.15 6.5 6.6 Change-Id: I927e75a2224bb58b4634125011d1305dbdfbb3aa Reviewed-by: David Edmundson --- .../platforms/wayland/qwaylandwindow.cpp | 20 ++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index c5316542e02..acc698f079e 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -702,10 +702,15 @@ void QWaylandWindow::damage(const QRect &rect) return; const qreal s = scale(); - if (mSurface->version() >= 4) - mSurface->damage_buffer(qFloor(s * rect.x()), qFloor(s * rect.y()), qCeil(s * rect.width()), qCeil(s * rect.height())); - else + if (mSurface->version() >= 4) { + const QRect bufferRect = + QRectF(s * rect.x(), s * rect.y(), s * rect.width(), s * rect.height()) + .toAlignedRect(); + mSurface->damage_buffer(bufferRect.x(), bufferRect.y(), bufferRect.width(), + bufferRect.height()); + } else { mSurface->damage(rect.x(), rect.y(), rect.width(), rect.height()); + } } void QWaylandWindow::safeCommit(QWaylandBuffer *buffer, const QRegion &damage) @@ -747,8 +752,13 @@ void QWaylandWindow::commit(QWaylandBuffer *buffer, const QRegion &damage) attachOffset(buffer); if (mSurface->version() >= 4) { const qreal s = scale(); - for (const QRect &rect: damage) - mSurface->damage_buffer(qFloor(s * rect.x()), qFloor(s * rect.y()), qCeil(s * rect.width()), qCeil(s * rect.height())); + for (const QRect &rect : damage) { + const QRect bufferRect = + QRectF(s * rect.x(), s * rect.y(), s * rect.width(), s * rect.height()) + .toAlignedRect(); + mSurface->damage_buffer(bufferRect.x(), bufferRect.y(), bufferRect.width(), + bufferRect.height()); + } } else { for (const QRect &rect: damage) mSurface->damage(rect.x(), rect.y(), rect.width(), rect.height()); From 75249a77b62bd472e598d890c171d50337c236c8 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Wed, 2 Aug 2023 09:12:47 +0200 Subject: [PATCH 1216/1507] DefaultCompositor: use explcit lambda captures C++20 deprecates the capture of *this in [=], and using [&] in a connect() statement is a smell ("are we capturing local variables?"), so just be explicit about what variables we capture (it's mostly [this], anyway). Amends f6dd4ab120f2f3822a19233233e791d4449e134a. Pick-to: 6.6 6.5 6.2 5.15 Change-Id: Ia594ffd5c0b9e82c54aa67c74b0d59684aa92840 Reviewed-by: Ivan Solovev --- tests/auto/wayland/shared/mockcompositor.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/auto/wayland/shared/mockcompositor.cpp b/tests/auto/wayland/shared/mockcompositor.cpp index 946e87ed6a7..5748c51ae57 100644 --- a/tests/auto/wayland/shared/mockcompositor.cpp +++ b/tests/auto/wayland/shared/mockcompositor.cpp @@ -37,8 +37,8 @@ DefaultCompositor::DefaultCompositor(CompositorType t, int socketFd) // TODO: other shells, viewporter, xdgoutput etc - QObject::connect(get(), &WlCompositor::surfaceCreated, [&] (Surface *surface){ - QObject::connect(surface, &Surface::bufferCommitted, [=] { + QObject::connect(get(), &WlCompositor::surfaceCreated, [this] (Surface *surface){ + QObject::connect(surface, &Surface::bufferCommitted, [this, surface] { if (m_config.autoRelease) { // Pretend we made a copy of the buffer and just release it immediately surface->m_committed.buffer->send_release(); @@ -49,7 +49,7 @@ DefaultCompositor::DefaultCompositor(CompositorType t, int socketFd) }); }); - QObject::connect(get(), &XdgWmBase::toplevelCreated, get(), [&] (XdgToplevel *toplevel) { + QObject::connect(get(), &XdgWmBase::toplevelCreated, get(), [this] (XdgToplevel *toplevel) { if (m_config.autoConfigure) toplevel->sendCompleteConfigure(); }, Qt::DirectConnection); From 349cb9eb7d324407ba24f19765e7f04089acc676 Mon Sep 17 00:00:00 2001 From: Kai Uwe Broulik Date: Fri, 4 Aug 2023 13:40:46 +0200 Subject: [PATCH 1217/1507] QWaylandWindow: Support Qt::WindowTransparentForInput This is achieved by setting an explicitly empty input region (as opposed to a "null" region) on the window. Unlike set_opaque_region, where a null region means an empty region, in set_input_region it means an infinite region. Pick-to: 6.6 Change-Id: I018d53196bc816b5eaea7dd3b24626a9738c9f47 Reviewed-by: David Edmundson --- .../platforms/wayland/qwaylandwindow.cpp | 42 +++++++++++++++---- .../platforms/wayland/qwaylandwindow_p.h | 6 +++ 2 files changed, 39 insertions(+), 9 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index acc698f079e..aea2cfff920 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -451,6 +451,32 @@ void QWaylandWindow::setGeometry(const QRect &r) setOpaqueArea(QRect(QPoint(0, 0), rect.size())); } +void QWaylandWindow::updateInputRegion() +{ + if (!mSurface) + return; + + const bool transparentInputRegion = mFlags.testFlag(Qt::WindowTransparentForInput); + + QRegion inputRegion; + if (!transparentInputRegion) + inputRegion = mMask; + + if (mInputRegion == inputRegion && mTransparentInputRegion == transparentInputRegion) + return; + + mInputRegion = inputRegion; + mTransparentInputRegion = transparentInputRegion; + + if (mInputRegion.isEmpty() && !mTransparentInputRegion) { + mSurface->set_input_region(nullptr); + } else { + struct ::wl_region *region = mDisplay->createRegion(mInputRegion); + mSurface->set_input_region(region); + wl_region_destroy(region); + } +} + void QWaylandWindow::updateViewport() { if (!surfaceSize().isEmpty()) @@ -561,17 +587,12 @@ void QWaylandWindow::setMask(const QRegion &mask) mMask = mask; - if (mMask.isEmpty()) { - mSurface->set_input_region(nullptr); + updateInputRegion(); - if (isOpaque()) + if (isOpaque()) { + if (mMask.isEmpty()) setOpaqueArea(QRect(QPoint(0, 0), geometry().size())); - } else { - struct ::wl_region *region = mDisplay->createRegion(mMask); - mSurface->set_input_region(region); - wl_region_destroy(region); - - if (isOpaque()) + } else { setOpaqueArea(mMask); } @@ -986,6 +1007,9 @@ void QWaylandWindow::setWindowFlags(Qt::WindowFlags flags) mFlags = flags; createDecoration(); + + QReadLocker locker(&mSurfaceLock); + updateInputRegion(); } bool QWaylandWindow::createDecoration() diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index 17140c52e9f..fbf629066e3 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -312,6 +312,11 @@ protected: Qt::WindowFlags mFlags; QRegion mMask; + + // Empty QRegion maps to "infinite" input region, needs a dedicated "deliberately empty" state. + QRegion mInputRegion; + bool mTransparentInputRegion = false; + QRegion mOpaqueArea; Qt::WindowStates mLastReportedWindowStates = Qt::WindowNoState; ToplevelWindowTilingStates mLastReportedToplevelWindowTilingStates = WindowNoState; @@ -337,6 +342,7 @@ private: QPlatformScreen *calculateScreenFromSurfaceEvents() const; void setOpaqueArea(const QRegion &opaqueArea); bool isOpaque() const; + void updateInputRegion(); void updateViewport(); void handleMouseEventWithDecoration(QWaylandInputDevice *inputDevice, const QWaylandPointerEvent &e); From 9c1cd44144fb5c8cce3073ae9fb53a09e733b83d Mon Sep 17 00:00:00 2001 From: Kai Uwe Broulik Date: Sat, 5 Aug 2023 16:48:37 +0200 Subject: [PATCH 1218/1507] client: Convert text/x-moz-urls to text/uri-list Similar to how it's done in the XCB QPA. This format is used by both Firefox and Chrome for exchanging URLs. Change-Id: Icd4406ff6297ea2800f4e1389ffc2878ee1ccb65 Reviewed-by: David Edmundson --- .../platforms/wayland/qwaylanddataoffer.cpp | 49 +++++++++++++++++++ .../wayland/datadevicev1/tst_datadevicev1.cpp | 44 +++++++++++++++++ 2 files changed, 93 insertions(+) diff --git a/src/plugins/platforms/wayland/qwaylanddataoffer.cpp b/src/plugins/platforms/wayland/qwaylanddataoffer.cpp index 046385e9134..b2288749554 100644 --- a/src/plugins/platforms/wayland/qwaylanddataoffer.cpp +++ b/src/plugins/platforms/wayland/qwaylanddataoffer.cpp @@ -20,6 +20,47 @@ static QString utf8Text() return QStringLiteral("text/plain;charset=utf-8"); } +static QString uriList() +{ + return QStringLiteral("text/uri-list"); +} + +static QString mozUrl() +{ + return QStringLiteral("text/x-moz-url"); +} + +static QByteArray convertData(const QString &originalMime, const QString &newMime, const QByteArray &data) +{ + if (originalMime == newMime) + return data; + + // Convert text/x-moz-url, which is an UTF-16 string of + // URL and page title pairs, all separated by line breaks, to text/uri-list. + // see also qtbase/src/plugins/platforms/xcb/qxcbmime.cpp + if (originalMime == uriList() && newMime == mozUrl()) { + if (data.size() > 1) { + const QString str = QString::fromUtf16( + reinterpret_cast(data.constData()), data.size() / 2); + if (!str.isNull()) { + QByteArray converted; + const auto urls = QStringView{str}.split(u'\n'); + // Only the URL is interesting, skip the page title. + for (int i = 0; i < urls.size(); i += 2) { + const QUrl url(urls.at(i).trimmed().toString()); + if (url.isValid()) { + converted += url.toEncoded(); + converted += "\r\n"; + } + } + return converted; + } + } + } + + return data; +} + QWaylandDataOffer::QWaylandDataOffer(QWaylandDisplay *display, struct ::wl_data_offer *offer) : QtWayland::wl_data_offer(offer) , m_display(display) @@ -105,6 +146,9 @@ bool QWaylandMimeData::hasFormat_sys(const QString &mimeType) const if (mimeType == QStringLiteral("text/plain") && m_types.contains(utf8Text())) return true; + if (mimeType == uriList() && m_types.contains(mozUrl())) + return true; + return false; } @@ -126,6 +170,8 @@ QVariant QWaylandMimeData::retrieveData_sys(const QString &mimeType, QMetaType t if (!m_types.contains(mimeType)) { if (mimeType == QStringLiteral("text/plain") && m_types.contains(utf8Text())) mime = utf8Text(); + else if (mimeType == uriList() && m_types.contains(mozUrl())) + mime = mozUrl(); else return QVariant(); } @@ -147,6 +193,9 @@ QVariant QWaylandMimeData::retrieveData_sys(const QString &mimeType, QMetaType t } close(pipefd[0]); + + content = convertData(mimeType, mime, content); + m_data.insert(mimeType, content); return content; } diff --git a/tests/auto/wayland/datadevicev1/tst_datadevicev1.cpp b/tests/auto/wayland/datadevicev1/tst_datadevicev1.cpp index cdbf7379a2a..bb831564af0 100644 --- a/tests/auto/wayland/datadevicev1/tst_datadevicev1.cpp +++ b/tests/auto/wayland/datadevicev1/tst_datadevicev1.cpp @@ -31,6 +31,7 @@ private slots: void initTestCase(); void pasteAscii(); void pasteUtf8(); + void pasteMozUrl(); void destroysPreviousSelection(); void destroysSelectionWithSurface(); void destroysSelectionOnLeave(); @@ -123,6 +124,49 @@ void tst_datadevicev1::pasteUtf8() QTRY_COMPARE(window.m_text, "face with tears of joy: 😂"); } +void tst_datadevicev1::pasteMozUrl() +{ + class Window : public QRasterWindow { + public: + void mousePressEvent(QMouseEvent *) override { m_urls = QGuiApplication::clipboard()->mimeData()->urls(); } + QList m_urls; + }; + + Window window; + window.resize(64, 64); + window.show(); + + QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial); + exec([&] { + auto *client = xdgSurface()->resource()->client(); + auto *offer = dataDevice()->sendDataOffer(client, {"text/x-moz-url"}); + connect(offer, &DataOffer::receive, [](QString mimeType, int fd) { + QFile file; + file.open(fd, QIODevice::WriteOnly, QFile::FileHandleFlag::AutoCloseHandle); + QCOMPARE(mimeType, "text/x-moz-url"); + const QString content("https://www.qt.io/\nQt\nhttps://www.example.com/\nExample Website"); + // Need UTF-16. + file.write(reinterpret_cast(content.data()), content.size() * 2); + file.close(); + }); + dataDevice()->sendSelection(offer); + + auto *surface = xdgSurface()->m_surface; + keyboard()->sendEnter(surface); // Need to set keyboard focus according to protocol + + pointer()->sendEnter(surface, {32, 32}); + pointer()->sendFrame(client); + pointer()->sendButton(client, BTN_LEFT, 1); + pointer()->sendFrame(client); + pointer()->sendButton(client, BTN_LEFT, 0); + pointer()->sendFrame(client); + }); + + QTRY_COMPARE(window.m_urls.count(), 2); + QCOMPARE(window.m_urls.at(0), QUrl("https://www.qt.io/")); + QCOMPARE(window.m_urls.at(1), QUrl("https://www.example.com/")); +} + void tst_datadevicev1::destroysPreviousSelection() { QRasterWindow window; From 5ca00097c8ead440f2ae8efb42287b4f47251fbe Mon Sep 17 00:00:00 2001 From: Kai Uwe Broulik Date: Tue, 15 Aug 2023 17:52:54 +0200 Subject: [PATCH 1219/1507] QWaylandDrag: Call into super class QBasicDrag::drop It's where, among other things, the override mouse cursor is reset. Otherwise the cursor stays a dragging hand indefinitely. Pick-to: 6.6 Change-Id: I9e7a44e09d5806cd64e66ba7a7c96f2d24ec97fc Reviewed-by: David Edmundson --- src/plugins/platforms/wayland/qwaylanddnd.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylanddnd.cpp b/src/plugins/platforms/wayland/qwaylanddnd.cpp index ff89069fcc1..5ea1e0d3376 100644 --- a/src/plugins/platforms/wayland/qwaylanddnd.cpp +++ b/src/plugins/platforms/wayland/qwaylanddnd.cpp @@ -59,10 +59,7 @@ void QWaylandDrag::move(const QPoint &globalPos, Qt::MouseButtons b, Qt::Keyboar void QWaylandDrag::drop(const QPoint &globalPos, Qt::MouseButtons b, Qt::KeyboardModifiers mods) { - Q_UNUSED(globalPos); - Q_UNUSED(b); - Q_UNUSED(mods); - // Do nothing + QBasicDrag::drop(globalPos, b, mods); } void QWaylandDrag::endDrag() From 4a7e459dc75a8e2473d89abc870babd1e47dbd74 Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Wed, 16 Aug 2023 09:16:15 +0300 Subject: [PATCH 1220/1507] Client: Fix keyboard focus when closing a popup 325a2338976c3cca6278436af03e7bd4e4378d7c changed the order in which the shell surface and the QWaylandWindow::wlSurfaceDestroyed signal are ordered. Unfortunately, it broke popups with some compositors. When the wlSurfaceDestroyed signal is emitted, QWaylandInputDevice::Keyboard is going to reset its focused surface and call QWaylandDisplay::handleKeyboardFocusChanged(). QWaylandDisplay::handleKeyboardFocusChanged() is going to call QWaylandDisplay::handleWindowDeactivated(), it will make an async roundtrip to determine the current focused window. This is to batch leave and enter events. Since the wlSurfaceDestroyed signal is emitted before destroying the shell surface and the wl_surface, the compositor has no reason to change keyboard focus, so qtwayland will think that the app lost focus for good and close all popups. This change restores the old behavior by making QWaylandInputDevice::Keyboard connect to QWaylandSurface::destroyed signal, which is emitted after the window's wl_surface is gone. It also makes QWaylandInputDevice::Keyboard consistent with QWaylandInputDevice::Pointer. Pick-to: 6.5 6.6 Fixes: QTBUG-116051 Change-Id: If866f94a0cec1659c27ffeb2d263a2480ca8fdf1 Reviewed-by: David Edmundson --- .../platforms/wayland/qwaylandinputdevice.cpp | 25 +++++++++++-------- .../platforms/wayland/qwaylandinputdevice_p.h | 2 +- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index 24dc93612d2..a5d3eb8f244 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -119,7 +119,7 @@ QWaylandInputDevice::Keyboard::~Keyboard() QWaylandWindow *QWaylandInputDevice::Keyboard::focusWindow() const { - return mFocus ? QWaylandWindow::fromWlSurface(mFocus) : nullptr; + return mFocus ? mFocus->waylandWindow() : nullptr; } QWaylandInputDevice::Pointer::Pointer(QWaylandInputDevice *seat) @@ -1224,13 +1224,17 @@ void QWaylandInputDevice::Keyboard::keyboard_enter(uint32_t time, struct wl_surf return; } + QWaylandWindow *window = QWaylandWindow::fromWlSurface(surface); + if (!window) + return; + if (mFocus) { qCWarning(lcQpaWayland()) << "Unexpected wl_keyboard.enter event. Keyboard already has focus"; - disconnect(focusWindow(), &QWaylandWindow::wlSurfaceDestroyed, this, &Keyboard::handleFocusDestroyed); + disconnect(mFocus, &QWaylandSurface::destroyed, this, &Keyboard::handleFocusDestroyed); } - mFocus = surface; - connect(focusWindow(), &QWaylandWindow::wlSurfaceDestroyed, this, &Keyboard::handleFocusDestroyed); + mFocus = window->waylandSurface(); + connect(mFocus, &QWaylandSurface::destroyed, this, &Keyboard::handleFocusDestroyed); mParent->mQDisplay->handleKeyboardFocusChanged(mParent); } @@ -1244,13 +1248,17 @@ void QWaylandInputDevice::Keyboard::keyboard_leave(uint32_t time, struct wl_surf return; } - if (surface != mFocus) { + QWaylandWindow *window = QWaylandWindow::fromWlSurface(surface); + if (!window) + return; + + if (window->waylandSurface() != mFocus) { qCWarning(lcQpaWayland) << "Ignoring unexpected wl_keyboard.leave event." << "wl_surface argument does not match the current focus" << "This is most likely a compositor bug"; return; } - disconnect(focusWindow(), &QWaylandWindow::wlSurfaceDestroyed, this, &Keyboard::handleFocusDestroyed); + disconnect(mFocus, &QWaylandSurface::destroyed, this, &Keyboard::handleFocusDestroyed); handleFocusLost(); } @@ -1350,11 +1358,6 @@ void QWaylandInputDevice::Keyboard::keyboard_key(uint32_t serial, uint32_t time, void QWaylandInputDevice::Keyboard::handleFocusDestroyed() { - // The signal is emitted by QWaylandWindow, which is not necessarily destroyed along with the - // surface, so we still need to disconnect the signal - auto *window = qobject_cast(sender()); - disconnect(window, &QWaylandWindow::wlSurfaceDestroyed, this, &Keyboard::handleFocusDestroyed); - Q_ASSERT(window->wlSurface() == mFocus); handleFocusLost(); } diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h index 3f19f2b2151..dbdc89bde82 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h +++ b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h @@ -225,7 +225,7 @@ public: void keyboard_repeat_info(int32_t rate, int32_t delay) override; QWaylandInputDevice *mParent = nullptr; - ::wl_surface *mFocus = nullptr; + QPointer mFocus; uint32_t mNativeModifiers = 0; From 5e47af01b4b3cd7a8dd50b06f752867517f10db6 Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Thu, 15 Jun 2023 15:07:32 +0100 Subject: [PATCH 1221/1507] tests: Send frame callbacks by default Currently we have special handling for wl-shell to automatically respond to frame callbacks in the mock compositor. With the framecallback timer this results in flaky tests as the window becomes unexposed. Pick-to: 6.6 Change-Id: I2add44d59ba26368c031a381849891f49764bfb5 Reviewed-by: David Edmundson --- tests/auto/wayland/seatv4/tst_seatv4.cpp | 1 + tests/auto/wayland/shared/mockcompositor.cpp | 3 +++ tests/auto/wayland/shared/mockcompositor.h | 1 + tests/auto/wayland/surface/tst_surface.cpp | 7 +++++++ 4 files changed, 12 insertions(+) diff --git a/tests/auto/wayland/seatv4/tst_seatv4.cpp b/tests/auto/wayland/seatv4/tst_seatv4.cpp index 8d78c2b3643..7b80c02f508 100644 --- a/tests/auto/wayland/seatv4/tst_seatv4.cpp +++ b/tests/auto/wayland/seatv4/tst_seatv4.cpp @@ -23,6 +23,7 @@ public: { exec([this] { m_config.autoConfigure = true; + m_config.autoFrameCallback = false; // for cursor animation test removeAll(); diff --git a/tests/auto/wayland/shared/mockcompositor.cpp b/tests/auto/wayland/shared/mockcompositor.cpp index 5748c51ae57..571117d6b4b 100644 --- a/tests/auto/wayland/shared/mockcompositor.cpp +++ b/tests/auto/wayland/shared/mockcompositor.cpp @@ -43,6 +43,9 @@ DefaultCompositor::DefaultCompositor(CompositorType t, int socketFd) // Pretend we made a copy of the buffer and just release it immediately surface->m_committed.buffer->send_release(); } + if (m_config.autoFrameCallback) { + surface->sendFrameCallbacks(); + } if (m_config.autoEnter && get() && surface->m_outputs.empty()) surface->sendEnter(get()); wl_display_flush_clients(m_display); diff --git a/tests/auto/wayland/shared/mockcompositor.h b/tests/auto/wayland/shared/mockcompositor.h index 8d26361a4f9..268f77680df 100644 --- a/tests/auto/wayland/shared/mockcompositor.h +++ b/tests/auto/wayland/shared/mockcompositor.h @@ -61,6 +61,7 @@ public: bool autoEnter = true; bool autoRelease = true; bool autoConfigure = false; + bool autoFrameCallback = true; } m_config; void resetConfig() { exec([&] { m_config = Config{}; }); } }; diff --git a/tests/auto/wayland/surface/tst_surface.cpp b/tests/auto/wayland/surface/tst_surface.cpp index ad7af036a14..75a83e23023 100644 --- a/tests/auto/wayland/surface/tst_surface.cpp +++ b/tests/auto/wayland/surface/tst_surface.cpp @@ -12,6 +12,8 @@ using namespace MockCompositor; class tst_surface : public QObject, private DefaultCompositor { Q_OBJECT +public: + explicit tst_surface(); private slots: void cleanup() { QTRY_VERIFY2(isClean(), qPrintable(dirtyMessage())); } void createDestroySurface(); @@ -26,6 +28,11 @@ private slots: void createSubsurfaceForHiddenParent(); }; +tst_surface::tst_surface() +{ + m_config.autoFrameCallback = false; +} + void tst_surface::createDestroySurface() { QWindow window; From f7e04622f415118a292f75c544a11db3896c7ca9 Mon Sep 17 00:00:00 2001 From: Kai Uwe Broulik Date: Wed, 23 Aug 2023 19:23:24 +0200 Subject: [PATCH 1222/1507] client: Wait for the compositor to send a fractional scale Don't assume it's 1.0 initially. Pick-to: 6.6 6.5 Change-Id: I443cb40a0f3421e6d7bdeba550cc8fc94c646319 Reviewed-by: David Edmundson --- .../platforms/wayland/qwaylandfractionalscale.cpp | 7 +------ .../platforms/wayland/qwaylandfractionalscale_p.h | 8 ++++---- src/plugins/platforms/wayland/qwaylandwindow.cpp | 10 ++-------- 3 files changed, 7 insertions(+), 18 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandfractionalscale.cpp b/src/plugins/platforms/wayland/qwaylandfractionalscale.cpp index 324a0b7299e..34169670f6b 100644 --- a/src/plugins/platforms/wayland/qwaylandfractionalscale.cpp +++ b/src/plugins/platforms/wayland/qwaylandfractionalscale.cpp @@ -17,17 +17,12 @@ QWaylandFractionalScale::~QWaylandFractionalScale() destroy(); } -qreal QWaylandFractionalScale::preferredScale() const -{ - return mPreferredScale; -} - void QWaylandFractionalScale::wp_fractional_scale_v1_preferred_scale(uint scale) { qreal preferredScale = scale / 120.0; // hardcoded denominator determined in the spec if (preferredScale != mPreferredScale) { mPreferredScale = preferredScale; - Q_EMIT preferredScaleChanged(); + Q_EMIT preferredScaleChanged(preferredScale); } } diff --git a/src/plugins/platforms/wayland/qwaylandfractionalscale_p.h b/src/plugins/platforms/wayland/qwaylandfractionalscale_p.h index 0483eb338a4..c030e60dde4 100644 --- a/src/plugins/platforms/wayland/qwaylandfractionalscale_p.h +++ b/src/plugins/platforms/wayland/qwaylandfractionalscale_p.h @@ -20,6 +20,8 @@ #include +#include + QT_BEGIN_NAMESPACE namespace QtWaylandClient { @@ -31,16 +33,14 @@ public: explicit QWaylandFractionalScale(struct ::wp_fractional_scale_v1 *object); ~QWaylandFractionalScale(); - qreal preferredScale() const; - Q_SIGNALS: - void preferredScaleChanged(); + void preferredScaleChanged(qreal preferredScale); protected: void wp_fractional_scale_v1_preferred_scale(uint scale) override; private: - qreal mPreferredScale = 1.0; + std::optional mPreferredScale; }; } diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index aea2cfff920..cbf1c2a81f6 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -105,14 +105,8 @@ void QWaylandWindow::initWindow() if (mDisplay->fractionalScaleManager() && qApp->highDpiScaleFactorRoundingPolicy() == Qt::HighDpiScaleFactorRoundingPolicy::PassThrough) { mFractionalScale.reset(new QWaylandFractionalScale(mDisplay->fractionalScaleManager()->get_fractional_scale(mSurface->object()))); - qreal preferredScale = std::max(1.0, mFractionalScale->preferredScale()); - if (mScale != preferredScale) { - mScale = preferredScale; - QWindowSystemInterface::handleWindowDevicePixelRatioChanged(window()); - } - - connect(mFractionalScale.data(), &QWaylandFractionalScale::preferredScaleChanged, this, [this]() { - qreal preferredScale = std::max(1.0, mFractionalScale->preferredScale()); + connect(mFractionalScale.data(), &QWaylandFractionalScale::preferredScaleChanged, this, [this](qreal preferredScale) { + preferredScale = std::max(1.0, preferredScale); if (mScale == preferredScale) { return; } From 5ff2599d51c02a54f1841859d627b6a9d1ace339 Mon Sep 17 00:00:00 2001 From: Kai Uwe Broulik Date: Thu, 24 Aug 2023 13:12:38 +0200 Subject: [PATCH 1223/1507] QWaylandInputDevice: Reset cursor surface state when using shape cursor CursorSurface::update only calls set_cursor if the hotspot or serial has changed. Reset its state when using a shape cursor to ensure switching back to a cursor surface (e.g. when switching from a shape to a bitmap cursor) works as expected. Pick-to: 6.6 Change-Id: Ia04dff468c251030a75e9f1eac642ed764879125 Reviewed-by: David Edmundson --- .../platforms/wayland/qwaylandinputdevice.cpp | 11 ++++++++++- tests/auto/wayland/cursor/tst_cursor.cpp | 16 +++++++++++++++- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index a5d3eb8f244..2a5cf900360 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -185,12 +185,18 @@ public: m_pointer, &QWaylandInputDevice::Pointer::updateCursor); } + void reset() + { + m_setSerial = 0; + m_hotspot = QPoint(); + } + void hide() { uint serial = m_pointer->mEnterSerial; Q_ASSERT(serial); m_pointer->set_cursor(serial, nullptr, 0, 0); - m_setSerial = 0; + reset(); } // Size and hotspot are in surface coordinates @@ -308,6 +314,9 @@ void QWaylandInputDevice::Pointer::updateCursor() } if (mCursor.shape) { + if (mCursor.surface) { + mCursor.surface->reset(); + } mCursor.shape->setShape(mEnterSerial, shape); return; } diff --git a/tests/auto/wayland/cursor/tst_cursor.cpp b/tests/auto/wayland/cursor/tst_cursor.cpp index 65bafb23eca..c86392b9563 100644 --- a/tests/auto/wayland/cursor/tst_cursor.cpp +++ b/tests/auto/wayland/cursor/tst_cursor.cpp @@ -66,7 +66,8 @@ void tst_cursor::setCursor() // client sets a different shape window.setCursor(QCursor(Qt::BusyCursor)); - QCOMPOSITOR_TRY_COMPARE(cursorShape()->m_currentShape, CursorShapeDevice::shape_wait); + QVERIFY(setCursorShapeSpy.wait()); + QCOMPOSITOR_COMPARE(cursorShape()->m_currentShape, CursorShapeDevice::shape_wait); setCursorShapeSpy.clear(); @@ -83,6 +84,19 @@ void tst_cursor::setCursor() window.setCursor(QCursor(myCustomPixmap)); QVERIFY(setCursorSpy.wait()); QVERIFY(setCursorShapeSpy.isEmpty()); + + // set a shape again + window.setCursor(QCursor(Qt::BusyCursor)); + QVERIFY(setCursorShapeSpy.wait()); + QCOMPOSITOR_COMPARE(cursorShape()->m_currentShape, CursorShapeDevice::shape_wait); + + setCursorShapeSpy.clear(); + + // set the same bitmap again, make sure switching from new to old path works + // even if the bitmap cursor's properties haven't changed + window.setCursor(QCursor(myCustomPixmap)); + QVERIFY(setCursorSpy.wait()); + QVERIFY(setCursorShapeSpy.isEmpty()); } QCOMPOSITOR_TEST_MAIN(tst_cursor) From 3e65306ec31f43870703350c2187fcbd063b34cd Mon Sep 17 00:00:00 2001 From: Kai Uwe Broulik Date: Sun, 27 Aug 2023 21:10:54 +0200 Subject: [PATCH 1224/1507] QWaylandInputDevice: Don't create cursor surface just for hiding it Just call set_cursor(null) directly. Pick-to: 6.6 Change-Id: Id10b7d41775a41c805962d77fba2d7d2b19956d0 Reviewed-by: Vlad Zahorodnii Reviewed-by: David Edmundson --- .../platforms/wayland/qwaylandinputdevice.cpp | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index 2a5cf900360..4eba3c5897c 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -191,14 +191,6 @@ public: m_hotspot = QPoint(); } - void hide() - { - uint serial = m_pointer->mEnterSerial; - Q_ASSERT(serial); - m_pointer->set_cursor(serial, nullptr, 0, 0); - reset(); - } - // Size and hotspot are in surface coordinates void update(wl_buffer *buffer, const QPoint &hotspot, const QSize &size, int bufferScale, bool animated = false) { @@ -297,7 +289,9 @@ void QWaylandInputDevice::Pointer::updateCursor() auto shape = seat()->mCursor.shape; if (shape == Qt::BlankCursor) { - getOrCreateCursorSurface()->hide(); + if (mCursor.surface) + mCursor.surface->reset(); + set_cursor(mEnterSerial, nullptr, 0, 0); return; } From 9f23e0756be6ad8b14e83308d50cfc0a8bedf082 Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Fri, 25 Aug 2023 10:32:01 +0300 Subject: [PATCH 1225/1507] Client: Fix coding style in QWaylandWindow::setMask() The relevant code can be reformatted as follows if (isOpaque()) { if (mMask.isEmpty()) setOpaqueArea(QRect(QPoint(0, 0), geometry().size())); } else { setOpaqueArea(mMask); } which doesn't fully make sense. Pick-to: 6.5 6.6 Change-Id: If78270273bff4eec9ad58666b6f31c5f10139caf Reviewed-by: David Edmundson --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index cbf1c2a81f6..f7c70048a09 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -586,7 +586,7 @@ void QWaylandWindow::setMask(const QRegion &mask) if (isOpaque()) { if (mMask.isEmpty()) setOpaqueArea(QRect(QPoint(0, 0), geometry().size())); - } else { + else setOpaqueArea(mMask); } From b3c663d0f8c012bcc30ba889ae442ca03397a4c9 Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Fri, 25 Aug 2023 10:19:07 +0300 Subject: [PATCH 1226/1507] Client: Commit the initial surface state explicitly QWaylandWindow lacks an explicit step to finish initializing the shell surface by committing the surface. So far it used to work because of hidden surface commits in QWaylandWindow::handleContentOrientationChange(), QWaylandWindow::setMask() and so on. This change adds an explicit step to commit the initial surface state to make the shell surface initialization robust. Change-Id: Ibc38a4e0dbea689a727451c25a61af0270c7e548 Reviewed-by: David Edmundson --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index f7c70048a09..d8d67859a95 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -208,6 +208,8 @@ void QWaylandWindow::initWindow() mShellSurface->requestWindowStates(window()->windowStates()); handleContentOrientationChange(window()->contentOrientation()); mFlags = window()->flags(); + + mSurface->commit(); } void QWaylandWindow::initializeWlSurface() From 61f72fc6b614de71703a056ba557463126fdbb0b Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Fri, 25 Aug 2023 10:15:29 +0300 Subject: [PATCH 1227/1507] Client: Remove some surface commits The buffer transform, input and opaque regions are double buffered state. They will be applied on the next surface commit. But the issue with them is that the relevant code makes surface commits too. It's undesired as it can lead to qtwayland committing partial state, for example it can break xdg surface window geometry. This change removes hidden surface commits. The relevant properties will be applied on the next frame. Change-Id: I1c40c9a5430fb6b91d7643b20d628f8a9a9d501a Reviewed-by: David Edmundson --- .../plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp | 3 --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 4 ---- tests/auto/wayland/xdgshell/tst_xdgshell.cpp | 2 ++ 3 files changed, 2 insertions(+), 7 deletions(-) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp index 80e44adb78b..a161c75810e 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp @@ -395,9 +395,6 @@ bool QWaylandXdgSurface::wantsDecorations() const void QWaylandXdgSurface::propagateSizeHints() { setSizeHints(); - - if (m_toplevel && m_window) - m_window->commit(); } void QWaylandXdgSurface::setWindowGeometry(const QRect &rect) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index d8d67859a95..15044d66075 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -591,8 +591,6 @@ void QWaylandWindow::setMask(const QRegion &mask) else setOpaqueArea(mMask); } - - mSurface->commit(); } void QWaylandWindow::setAlertState(bool enabled) @@ -980,8 +978,6 @@ void QWaylandWindow::handleContentOrientationChange(Qt::ScreenOrientation orient Q_UNREACHABLE(); } mSurface->set_buffer_transform(transform); - // set_buffer_transform is double buffered, we need to commit. - mSurface->commit(); } void QWaylandWindow::setOrientationMask(Qt::ScreenOrientations mask) diff --git a/tests/auto/wayland/xdgshell/tst_xdgshell.cpp b/tests/auto/wayland/xdgshell/tst_xdgshell.cpp index ba4027be1c5..8a172356a37 100644 --- a/tests/auto/wayland/xdgshell/tst_xdgshell.cpp +++ b/tests/auto/wayland/xdgshell/tst_xdgshell.cpp @@ -615,6 +615,8 @@ void tst_xdgshell::minMaxSize() window.show(); QCOMPOSITOR_TRY_VERIFY(xdgToplevel()); + exec([&] { xdgToplevel()->sendCompleteConfigure(); }); + // we don't roundtrip with our configuration the initial commit should be correct QCOMPOSITOR_TRY_COMPARE(xdgToplevel()->m_committed.minSize, QSize(100, 100)); From be38fbd3f40ade27616db0d034b65be820dc723a Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Thu, 18 May 2023 13:17:25 +0300 Subject: [PATCH 1228/1507] client: Drop unused member variables Change-Id: Id7cca9d5cb620dadb356e9cfcc68ca1203a0db98 Reviewed-by: Eskil Abrahamsen Blomfeldt Reviewed-by: David Redondo --- src/plugins/platforms/wayland/qwaylandinputdevice_p.h | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h index dbdc89bde82..ea4b463c8b8 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h +++ b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h @@ -337,10 +337,6 @@ public: QPointF mGlobalPos; Qt::MouseButtons mButtons = Qt::NoButton; Qt::MouseButton mLastButton = Qt::NoButton; -#if QT_CONFIG(cursor) - wl_buffer *mCursorBuffer = nullptr; - Qt::CursorShape mCursorShape = Qt::BitmapCursor; -#endif struct FrameData { QWaylandPointerEvent *event = nullptr; From 37afa0cbaaa01be0c8469f65616b437f83c37fe0 Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Thu, 15 Jun 2023 12:14:45 +0100 Subject: [PATCH 1229/1507] client: Simplify toplevel exposure tracking m_exposeRegion was originally there to track the expose updates requested from the client in situations where the shell integration is filtering those events, i.e when we're waiting for the first configure event. The fix at e6d55239c454d454978edb7d8b17f6c993e7ba07 explicitly sends an expose event to the whole window when we get the actual first configure event, at which point caching the expose region at the time of the handleExpose check is unnecessary. Motivation for cleanup is a pending change to support xdg_toplevel.suspended where we need to unexpose at a shell level. Change-Id: I56c3bab91453956046c1d7f92a4395c951c48fb3 Reviewed-by: Vlad Zahorodnii Reviewed-by: Eskil Abrahamsen Blomfeldt --- .../shellintegration/xdg-shell/qwaylandxdgshell.cpp | 9 ++------- .../shellintegration/xdg-shell/qwaylandxdgshell_p.h | 1 - 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp index a161c75810e..c9d1865c340 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp @@ -365,7 +365,6 @@ bool QWaylandXdgSurface::isExposed() const bool QWaylandXdgSurface::handleExpose(const QRegion ®ion) { if (!isExposed() && !region.isEmpty()) { - m_exposeRegion = region; return true; } return false; @@ -526,17 +525,13 @@ void QWaylandXdgSurface::xdg_surface_configure(uint32_t serial) if (!m_configured) { // We have to do the initial applyConfigure() immediately, since that is the expose. applyConfigure(); - m_exposeRegion = QRegion(QRect(QPoint(), m_window->geometry().size())); + QRegion exposeRegion = QRegion(QRect(QPoint(), m_window->geometry().size())); + m_window->handleExpose(exposeRegion); } else { // Later configures are probably resizes, so we have to queue them up for a time when we // are not painting to the window. m_window->applyConfigureWhenPossible(); } - - if (!m_exposeRegion.isEmpty()) { - m_window->handleExpose(m_exposeRegion); - m_exposeRegion = QRegion(); - } } bool QWaylandXdgSurface::requestActivate() diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h index 951e8234f66..ddfea2116f9 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h @@ -139,7 +139,6 @@ private: Toplevel *m_toplevel = nullptr; Popup *m_popup = nullptr; bool m_configured = false; - QRegion m_exposeRegion; uint m_pendingConfigureSerial = 0; uint m_appliedConfigureSerial = 0; QString m_activationToken; From 46d98302f55af664ccaafb720c52651e80aa038b Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Wed, 31 May 2023 13:16:34 +0100 Subject: [PATCH 1230/1507] client: Add path to manipulate popup positioning via hidden properties API Whilst long-term we want public API, we don't have anything available. This patch provides a non-official override using properties without us committing to any API promises moving forward. Pick-to: 6.6 Change-Id: I46afbe9be7005d35305155643a1d158cf5bd509a Reviewed-by: Eskil Abrahamsen Blomfeldt --- .../xdg-shell/qwaylandxdgshell.cpp | 99 +++++++++++++++++-- 1 file changed, 90 insertions(+), 9 deletions(-) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp index c9d1865c340..acc72f50eda 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp @@ -466,16 +466,97 @@ void QWaylandXdgSurface::setPopup(QWaylandWindow *parent) QRect windowGeometry = m_window->windowContentGeometry(); QMargins windowMargins = m_window->windowContentMargins() - m_window->clientSideMargins(); QMargins parentMargins = parent->windowContentMargins() - parent->clientSideMargins(); - QPoint transientPos = m_window->geometry().topLeft(); // this is absolute - transientPos += QPoint(windowMargins.left(), windowMargins.top()); - transientPos -= parent->geometry().topLeft(); - transientPos -= QPoint(parentMargins.left(), parentMargins.top()); - positioner->set_anchor_rect(transientPos.x(), transientPos.y(), 1, 1); - positioner->set_anchor(QtWayland::xdg_positioner::anchor_top_left); - positioner->set_gravity(QtWayland::xdg_positioner::gravity_bottom_right); + + // These property overrides may be removed when public API becomes available + QRect placementAnchor = m_window->window()->property("_q_waylandPopupAnchorRect").toRect(); + if (!placementAnchor.isValid()) { + placementAnchor = QRect(m_window->geometry().topLeft() - parent->geometry().topLeft(), QSize(1,1)); + } + placementAnchor.translate(windowMargins.left(), windowMargins.top()); + placementAnchor.translate(-parentMargins.left(), -parentMargins.top()); + + uint32_t anchor = QtWayland::xdg_positioner::anchor_top_right; + const QVariant anchorVariant = m_window->window()->property("_q_waylandPopupAnchor"); + if (anchorVariant.isValid()) { + switch (anchorVariant.value()) { + case Qt::Edges(): + anchor = QtWayland::xdg_positioner::anchor_none; + break; + case Qt::TopEdge: + anchor = QtWayland::xdg_positioner::anchor_top; + break; + case Qt::TopEdge | Qt::RightEdge: + anchor = QtWayland::xdg_positioner::anchor_top_right; + break; + case Qt::RightEdge: + anchor = QtWayland::xdg_positioner::anchor_right; + break; + case Qt::BottomEdge | Qt::RightEdge: + anchor = QtWayland::xdg_positioner::anchor_bottom_right; + break; + case Qt::BottomEdge: + anchor = QtWayland::xdg_positioner::anchor_bottom; + break; + case Qt::BottomEdge | Qt::LeftEdge: + anchor = QtWayland::xdg_positioner::anchor_bottom_left; + break; + case Qt::LeftEdge: + anchor = QtWayland::xdg_positioner::anchor_left; + break; + case Qt::TopEdge | Qt::LeftEdge: + anchor = QtWayland::xdg_positioner::anchor_top_left; + break; + } + } + + uint32_t gravity = QtWayland::xdg_positioner::gravity_bottom_right; + const QVariant popupGravityVariant = m_window->window()->property("_q_waylandPopupGravity"); + if (popupGravityVariant.isValid()) { + switch (popupGravityVariant.value()) { + case Qt::Edges(): + gravity = QtWayland::xdg_positioner::gravity_none; + break; + case Qt::TopEdge: + gravity = QtWayland::xdg_positioner::gravity_top; + break; + case Qt::TopEdge | Qt::RightEdge: + gravity = QtWayland::xdg_positioner::gravity_top_right; + break; + case Qt::RightEdge: + gravity = QtWayland::xdg_positioner::gravity_right; + break; + case Qt::BottomEdge | Qt::RightEdge: + gravity = QtWayland::xdg_positioner::gravity_bottom_right; + break; + case Qt::BottomEdge: + gravity = QtWayland::xdg_positioner::gravity_bottom; + break; + case Qt::BottomEdge | Qt::LeftEdge: + gravity = QtWayland::xdg_positioner::gravity_bottom_left; + break; + case Qt::LeftEdge: + gravity = QtWayland::xdg_positioner::gravity_left; + break; + case Qt::TopEdge | Qt::LeftEdge: + gravity = QtWayland::xdg_positioner::gravity_top_left; + break; + } + } + + uint32_t constraintAdjustment = QtWayland::xdg_positioner::constraint_adjustment_slide_x | QtWayland::xdg_positioner::constraint_adjustment_slide_y; + const QVariant constraintAdjustmentVariant = m_window->window()->property("_q_waylandPopupConstraintAdjustment"); + if (constraintAdjustmentVariant.isValid()) { + constraintAdjustment = constraintAdjustmentVariant.toUInt(); + } + + positioner->set_anchor_rect(placementAnchor.x(), + placementAnchor.y(), + placementAnchor.width(), + placementAnchor.height()); + positioner->set_anchor(anchor); + positioner->set_gravity(gravity); positioner->set_size(windowGeometry.width(), windowGeometry.height()); - positioner->set_constraint_adjustment(QtWayland::xdg_positioner::constraint_adjustment_slide_x - | QtWayland::xdg_positioner::constraint_adjustment_slide_y); + positioner->set_constraint_adjustment(constraintAdjustment); m_popup = new Popup(this, parent, positioner); positioner->destroy(); From 40720551fdd55bf246766d4f74b90828b1620b1c Mon Sep 17 00:00:00 2001 From: Liang Qi Date: Wed, 6 Sep 2023 11:04:02 +0200 Subject: [PATCH 1231/1507] Revert "Client: Send release button event on pointer leave" This reverts commit 2aa8de5524cc769daf0b6ec6d29363311b8a441e. It makes tests/manual/examples/widgets/draganddrop/puzzle not work, which does drag and drop in same app. Pick-to: 6.6 6.5 6.2 5.15 Fixes: QTBUG-115757 Task-number: QTBUG-97037 Change-Id: I738769fde96f7da91f5bc4dc7a70ed49596dcd61 Reviewed-by: Liang Qi --- src/plugins/platforms/wayland/qwaylandinputdevice.cpp | 9 ++------- src/plugins/platforms/wayland/qwaylandinputdevice_p.h | 1 - 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index 4eba3c5897c..dc59a237697 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -719,8 +719,8 @@ public: void QWaylandInputDevice::Pointer::pointer_leave(uint32_t time, struct wl_surface *surface) { - releaseButtons(); invalidateFocus(); + mButtons = Qt::NoButton; mParent->mTime = time; @@ -835,8 +835,6 @@ void QWaylandInputDevice::Pointer::pointer_button(uint32_t serial, uint32_t time default: return; // invalid button number (as far as Qt is concerned) } - mLastButton = qt_button; - if (state) mButtons |= qt_button; else @@ -875,13 +873,10 @@ void QWaylandInputDevice::Pointer::invalidateFocus() void QWaylandInputDevice::Pointer::releaseButtons() { - if (mButtons == Qt::NoButton) - return; - mButtons = Qt::NoButton; if (auto *window = focusWindow()) { - ReleaseEvent e(focusWindow(), mParent->mTime, mSurfacePos, mGlobalPos, mButtons, mLastButton, mParent->modifiers()); + ReleaseEvent e(focusWindow(), mParent->mTime, mSurfacePos, mGlobalPos, mButtons, Qt::NoButton, mParent->modifiers()); window->handleMouse(mParent, e); } } diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h index ea4b463c8b8..31ce50f6830 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h +++ b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h @@ -336,7 +336,6 @@ public: QPointF mSurfacePos; QPointF mGlobalPos; Qt::MouseButtons mButtons = Qt::NoButton; - Qt::MouseButton mLastButton = Qt::NoButton; struct FrameData { QWaylandPointerEvent *event = nullptr; From ea30d389f8943b140bb8b3631bcc40b313005a16 Mon Sep 17 00:00:00 2001 From: Liang Qi Date: Wed, 6 Sep 2023 14:37:33 +0200 Subject: [PATCH 1232/1507] client: make drag and drop in same control works again This amends 8a48175f26038541dfc1186d938dc46edb6048ab. examples/widgets/draganddrop/draggabletext in qtbase now is fine. Pick-to: 6.6 Fixes: QTBUG-116344 Change-Id: Ie930586fa7c6468c0e859786d968ad2343057e4d Reviewed-by: David Redondo Reviewed-by: Liang Qi --- src/plugins/platforms/wayland/qwaylanddatadevice.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/plugins/platforms/wayland/qwaylanddatadevice.cpp b/src/plugins/platforms/wayland/qwaylanddatadevice.cpp index 80a9a773915..fe8e91235ff 100644 --- a/src/plugins/platforms/wayland/qwaylanddatadevice.cpp +++ b/src/plugins/platforms/wayland/qwaylanddatadevice.cpp @@ -214,6 +214,7 @@ void QWaylandDataDevice::data_device_enter(uint32_t serial, wl_surface *surface, QDrag *drag = static_cast(QGuiApplicationPrivate::platformIntegration()->drag())->currentDrag(); if (drag) { dragData = drag->mimeData(); + supportedActions = drag->supportedActions(); } else if (m_dragOffer) { dragData = m_dragOffer->mimeData(); supportedActions = m_dragOffer->supportedActions(); From 3783016b7208493fe02ef1d0199b1a2a35149d1a Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Mon, 10 Jul 2023 22:24:28 +0100 Subject: [PATCH 1233/1507] client: Port QWaylandInputDevice to support QT_NO_CONTEXTLESS_CONNECT There were two existing usages of the 3-arg connect, but the timer is always scoped to be shorter than the receiver so it was previously safe. Change-Id: I0bb5a38fed997cbb68e49defc51972894f5239ee Reviewed-by: Eskil Abrahamsen Blomfeldt Reviewed-by: Ahmad Samir --- src/plugins/platforms/wayland/qwaylandinputdevice.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index dc59a237697..c4629905743 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -64,7 +64,7 @@ QWaylandInputDevice::Keyboard::Keyboard(QWaylandInputDevice *p) : mParent(p) { init(p->get_keyboard()); - mRepeatTimer.callOnTimeout([&]() { + mRepeatTimer.callOnTimeout(this, [&]() { if (!focusWindow()) { // We destroyed the keyboard focus surface, but the server didn't get the message yet... // or the server didn't send an enter event first. @@ -132,7 +132,7 @@ QWaylandInputDevice::Pointer::Pointer(QWaylandInputDevice *seat) } mCursor.frameTimer.setSingleShot(true); - mCursor.frameTimer.callOnTimeout([&]() { + mCursor.frameTimer.callOnTimeout(this, [&]() { cursorTimerCallback(); }); #endif From b59d243ce20440e397fd82032aef182dada5f0ab Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Wed, 30 Aug 2023 09:49:41 +0300 Subject: [PATCH 1234/1507] Client: Avoid locking resizing in QWaylandShmBackingStore QWaylandWindow::setCanResize(false) will block applying configure events. QWaylandWindow::setCanResize(true) will unblock configure events and potentially apply a scheduled configure event if there's one. QWaylandWindow::setCanResize(true) has to be called **after** committing the surface to ensure that the xdg window geometry matches the buffer. We don't want the xdg window geometry change when painting. Unfortunately, setCanResize(true) can be called before the surface is committed when using a RasterSurface, for example - QWaylandShmBackingStore::beginPaint(): calls setCanResize(false) - QWaylandShmBackingStore::endPaint(): calls setCanResize(true) - QWaylandWindow::setCanResize(true): applies pending configure event - QWaylandShmBackingStore::flush(): commits the surface, but the xdg window geometry is wrong now As is, beginPaint() and endPaint() are not entirely correct functions where configure events can be blocked. We need functions that wrap both painting and flushing, which are not feasible with the current backing store design. On the other hand, it's worth noting that blocking configure events in the backing store is not necessary because painting happens on the main thread unlike OpenGL or Vulkan code paths. Given the lack of synchronization points and the fact that rendering happens on the main thread, this change removes blocking configure events in QWaylandShmBackingStore. It fixes dolphin and various other applications that use QtWidgets jumping while being interactively resized. Change-Id: I156e4fd5e04a6bba7e8d48171510d5ab0ec89713 Reviewed-by: David Edmundson --- src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp b/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp index bc300595e4d..02d830ad860 100644 --- a/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp +++ b/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp @@ -171,8 +171,6 @@ void QWaylandShmBackingStore::beginPaint(const QRegion ®ion) mPainting = true; ensureSize(); - waylandWindow()->setCanResize(false); - if (mBackBuffer->image()->hasAlphaChannel()) { QPainter p(paintDevice()); p.setCompositionMode(QPainter::CompositionMode_Source); @@ -187,7 +185,6 @@ void QWaylandShmBackingStore::endPaint() mPainting = false; if (mPendingFlush) flush(window(), mPendingRegion, QPoint()); - waylandWindow()->setCanResize(true); } void QWaylandShmBackingStore::ensureSize() From 486dcfc0102abd02e9c61ebe81b5d961cc2406a6 Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Mon, 28 Aug 2023 17:10:27 +0300 Subject: [PATCH 1235/1507] Client: Fix QT_WAYLAND_RESIZE_AFTER_SWAP mResizeLock can be locked several times by the same thread in the following scenario QWaylandWindow::setGeometry() at qwaylandwindow.cpp:429:43 QWaylandEglWindow::setGeometry() at qwaylandeglwindow.cpp:58:32 QWaylandWindow::resizeFromApplyConfigure() at qwaylandwindow.cpp:517:16 QWaylandXdgSurface::Toplevel::applyConfigure() at qwaylandxdgshell.cpp:91:57 QWaylandXdgSurface::applyConfigure() at qwaylandxdgshell.cpp:381:35 QWaylandWindow::doApplyConfigure() at qwaylandwindow.cpp:628:38 QWaylandWindow::applyConfigure() at qwaylandwindow.cpp:671:25 Since mResizeLock is not a recursive mutex, the main thread just blocks in QWaylandWindow::setGeometry(). To prevent that, this patch changes the type of mResizeLock from QMutex to QRecursiveMutex. Change-Id: I362f4909bfdfc2d91b7cf902f27d35c742ac5091 Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/plugins/platforms/wayland/qwaylandwindow_p.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index fbf629066e3..445a05b7f43 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -187,7 +187,6 @@ public: QWaylandWindow *transientParent() const; - QMutex *resizeMutex() { return &mResizeLock; } void doApplyConfigure(); void setCanResize(bool canResize); @@ -295,7 +294,7 @@ protected: // True when we have called deliverRequestUpdate, but the client has not yet attached a new buffer bool mWaitingForUpdate = false; - QMutex mResizeLock; + QRecursiveMutex mResizeLock; bool mWaitingToApplyConfigure = false; bool mCanResize = true; bool mResizeDirty = false; From 379235e6ac3124a4975a75472693ade03a1fb170 Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Fri, 15 Sep 2023 10:06:32 +0300 Subject: [PATCH 1236/1507] tests: Fix tst_xdgshell::minMaxSize() Amends 61f72fc6b614de71703a056ba557463126fdbb0b. The new size hints will be committed when the surface is committed. Change-Id: I94e944fee7dac63d5e9ac86fb348b5d24d54abfc Reviewed-by: Eskil Abrahamsen Blomfeldt --- tests/auto/wayland/xdgshell/tst_xdgshell.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/auto/wayland/xdgshell/tst_xdgshell.cpp b/tests/auto/wayland/xdgshell/tst_xdgshell.cpp index 8a172356a37..3268964fcc9 100644 --- a/tests/auto/wayland/xdgshell/tst_xdgshell.cpp +++ b/tests/auto/wayland/xdgshell/tst_xdgshell.cpp @@ -623,9 +623,11 @@ void tst_xdgshell::minMaxSize() QCOMPOSITOR_TRY_COMPARE(xdgToplevel()->m_committed.maxSize, QSize(1000, 1000)); window.setMaximumSize(QSize(500, 400)); + window.update(); QCOMPOSITOR_TRY_COMPARE(xdgToplevel()->m_committed.maxSize, QSize(500, 400)); window.setMinimumSize(QSize(50, 40)); + window.update(); QCOMPOSITOR_TRY_COMPARE(xdgToplevel()->m_committed.minSize, QSize(50, 40)); } From fa891548077553afe68a0aecd0c3963425365319 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Mon, 18 Sep 2023 12:06:16 +0200 Subject: [PATCH 1237/1507] Fix use-after-free with animated cursors In WlCallback::callback_done(), m_fn() can cause the callback object to be deleted, so it should not be referenced after that. Since m_autoDelete is never set to true, the rest of callback_done() is dead code and can be removed. Fixes: QTBUG-117067 Pick-to: 6.6 6.5 Change-Id: I0b1a1fcb8204cba789272f3861be4c2e2d0789b4 Reviewed-by: Eskil Abrahamsen Blomfeldt Reviewed-by: Vlad Zahorodnii --- src/plugins/platforms/wayland/qwaylandinputdevice.cpp | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index c4629905743..c898fcf08b9 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -155,23 +155,16 @@ QWaylandWindow *QWaylandInputDevice::Pointer::focusWindow() const class WlCallback : public QtWayland::wl_callback { public: - explicit WlCallback(::wl_callback *callback, std::function fn, bool autoDelete = false) + explicit WlCallback(::wl_callback *callback, std::function fn) : QtWayland::wl_callback(callback) , m_fn(fn) - , m_autoDelete(autoDelete) {} ~WlCallback() override { wl_callback_destroy(object()); } - bool done() const { return m_done; } void callback_done(uint32_t callback_data) override { - m_done = true; m_fn(callback_data); - if (m_autoDelete) - delete this; } private: - bool m_done = false; std::function m_fn; - bool m_autoDelete = false; }; class CursorSurface : public QWaylandSurface From 1110b2c3e4e9c8543aee794b647615977e1c53d8 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Fri, 15 Sep 2023 16:54:04 +0200 Subject: [PATCH 1238/1507] Fix use-after-free error in autotest zwp_primary_selection_device_v1::destroy_func() uses the object after calling zwp_primary_selection_device_v1_destroy_resource(). This means that we cannot do "delete this" at that point. Instead delete all the devices in the destructor of PrimarySelectionDeviceManagerV1, which conveniently already has a list of selection devices. Fixes: QTBUG-117068 Change-Id: I7012f801ef11283d5b66cefbf5481e9f1394f1b8 Reviewed-by: Vlad Zahorodnii Reviewed-by: David Edmundson --- .../primaryselectionv1/tst_primaryselectionv1.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/tests/auto/wayland/primaryselectionv1/tst_primaryselectionv1.cpp b/tests/auto/wayland/primaryselectionv1/tst_primaryselectionv1.cpp index 9e85acca635..d9e4ff295b6 100644 --- a/tests/auto/wayland/primaryselectionv1/tst_primaryselectionv1.cpp +++ b/tests/auto/wayland/primaryselectionv1/tst_primaryselectionv1.cpp @@ -129,11 +129,6 @@ protected: { wl_resource_destroy(resource->handle); } - void zwp_primary_selection_device_v1_destroy_resource(Resource *resource) override - { - Q_UNUSED(resource); - delete this; - } }; class PrimarySelectionDeviceManagerV1 : public Global, public QtWaylandServer::zwp_primary_selection_device_manager_v1 @@ -144,6 +139,10 @@ public: : QtWaylandServer::zwp_primary_selection_device_manager_v1(compositor->m_display, version) , m_version(version) {} + ~PrimarySelectionDeviceManagerV1() override + { + qDeleteAll(m_devices); + } bool isClean() override { for (auto *device : std::as_const(m_devices)) { From 0b82d95632e37ed790db303a580cd39320378434 Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Thu, 15 Jun 2023 14:22:30 +0100 Subject: [PATCH 1239/1507] client: support Xdg Shell not_shown state This state is to indicate that a toplevel is not visible, either minimised on another desktop. This maps to QWindow::isExposed. In addition to XdgShell changes. QWaylandWindow is adjusted to check exposure state before sendingExposureEvents. Subsurfaces are un-exposed and re-exposed when the toplevel changes. Change-Id: I76932c2c58681f832c1c2efde3cfde1c32cd3e05 Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/3rdparty/wayland/protocols/xdg-shell.xml | 196 +++++++++++++----- .../xdg-shell/qwaylandxdgshell.cpp | 15 +- .../xdg-shell/qwaylandxdgshell_p.h | 1 + .../xdg-shell/qwaylandxdgshellintegration.cpp | 2 +- .../platforms/wayland/qwaylandwindow.cpp | 13 +- tests/auto/wayland/xdgshell/tst_xdgshell.cpp | 33 +++ 6 files changed, 199 insertions(+), 61 deletions(-) diff --git a/src/3rdparty/wayland/protocols/xdg-shell.xml b/src/3rdparty/wayland/protocols/xdg-shell.xml index 9b5279ead9e..777eaa7499a 100644 --- a/src/3rdparty/wayland/protocols/xdg-shell.xml +++ b/src/3rdparty/wayland/protocols/xdg-shell.xml @@ -29,7 +29,7 @@ DEALINGS IN THE SOFTWARE. - + The xdg_wm_base interface is exposed as a global object enabling clients to turn their wl_surfaces into windows in a desktop environment. It @@ -50,6 +50,8 @@ summary="the client provided an invalid surface state"/> + @@ -58,7 +60,7 @@ Destroying a bound xdg_wm_base object while there are surfaces still alive created by this xdg_wm_base object instance is illegal - and will result in a protocol error. + and will result in a defunct_surfaces error. @@ -77,7 +79,7 @@ itself is not a role, the corresponding surface may only be assigned a role extending xdg_surface, such as xdg_toplevel or xdg_popup. It is illegal to create an xdg_surface for a wl_surface which already has an - assigned role and this will result in a protocol error. + assigned role and this will result in a role error. This creates an xdg_surface for the given surface. An xdg_surface is used as basis to define a role to a given surface, such as xdg_toplevel @@ -94,7 +96,8 @@ A client must respond to a ping event with a pong request or - the client may be deemed unresponsive. See xdg_wm_base.ping. + the client may be deemed unresponsive. See xdg_wm_base.ping + and xdg_wm_base.error.unresponsive. @@ -108,7 +111,9 @@ Compositors can use this to determine if the client is still alive. It's unspecified what will happen if the client doesn't respond to the ping request, or in what timeframe. Clients should - try to respond in a reasonable amount of time. + try to respond in a reasonable amount of time. The “unresponsive” + error is provided for compositors that wish to disconnect unresponsive + clients. A compositor is free to ping in any way it wants, but a client must always respond to any xdg_wm_base object it created. @@ -117,7 +122,7 @@ - + The xdg_positioner provides a collection of rules for the placement of a child surface relative to a parent surface. Rules can be defined to ensure @@ -137,7 +142,7 @@ For an xdg_positioner object to be considered complete, it must have a non-zero size set by set_size, and a non-zero anchor rectangle set by set_anchor_rect. Passing an incomplete xdg_positioner object when - positioning a surface raises an error. + positioning a surface raises an invalid_positioner error. @@ -225,7 +230,8 @@ specified (e.g. 'bottom_right' or 'top_left'), then the child surface will be placed towards the specified gravity; otherwise, the child surface will be centered over the anchor point on any axis that had no - gravity specified. + gravity specified. If the gravity is not in the ‘gravity’ enum, an + invalid_input error is raised. @@ -401,7 +407,7 @@ - + An interface that may be implemented by a wl_surface, for implementations that provide a desktop-style user interface. @@ -430,8 +436,10 @@ After creating a role-specific object and setting it up, the client must perform an initial commit without any buffer attached. The compositor - will reply with an xdg_surface.configure event. The client must - acknowledge it and is then allowed to attach a buffer to map the surface. + will reply with initial wl_surface state such as + wl_surface.preferred_buffer_scale followed by an xdg_surface.configure + event. The client must acknowledge it and is then allowed to attach a + buffer to map the surface. Mapping an xdg_surface-based role surface is defined as making it possible for the surface to be shown by the compositor. Note that @@ -451,15 +459,25 @@ - - - + + + + + + Destroy the xdg_surface object. An xdg_surface must only be destroyed - after its role object has been destroyed. + after its role object has been destroyed, otherwise + a defunct_role_object error is raised. @@ -514,13 +532,22 @@ commit. This unset is meant for extremely simple clients. The arguments are given in the surface-local coordinate space of - the wl_surface associated with this xdg_surface. + the wl_surface associated with this xdg_surface, and may extend outside + of the wl_surface itself to mark parts of the subsurface tree as part of + the window geometry. - The width and height must be greater than zero. Setting an invalid size - will raise an error. When applied, the effective window geometry will be - the set window geometry clamped to the bounding rectangle of the - combined geometry of the surface of the xdg_surface and the associated + When applied, the effective window geometry will be the set window + geometry clamped to the bounding rectangle of the combined + geometry of the surface of the xdg_surface and the associated subsurfaces. + + The effective geometry will not be recalculated unless a new call to + set_window_geometry is done and the new pending surface state is + subsequently applied. + + The width and height of the effective window geometry must be + greater than zero. Setting an invalid size will raise an + invalid_size error. @@ -541,6 +568,8 @@ If the client receives multiple configure events before it can respond to one, it only has to ack the last configure event. + Acking a configure event that was never sent raises an invalid_serial + error. A client is not required to commit immediately after sending an ack_configure request - it may even ack_configure several times @@ -549,6 +578,17 @@ A client may send multiple ack_configure requests before committing, but only the last request sent before a commit indicates which configure event the client really is responding to. + + Sending an ack_configure request consumes the serial number sent with + the request, as well as serial numbers sent by all configure events + sent on this xdg_surface prior to the configure event referenced by + the committed serial. + + It is an error to issue multiple ack_configure requests referencing a + serial from the same configure event, or to issue an ack_configure + request referencing a serial from a configure event issued before the + event identified by the last ack_configure request for the same + xdg_surface. Doing so will raise an invalid_serial error. @@ -577,7 +617,7 @@ - + This interface defines an xdg_surface role which allows a surface to, among other things, set window-like properties such as maximize, @@ -605,24 +645,37 @@ + + + + + + Set the "parent" of this surface. This surface should be stacked above the parent surface and all other ancestor surfaces. - Parent windows should be set on dialogs, toolboxes, or other + Parent surfaces should be set on dialogs, toolboxes, or other "auxiliary" surfaces, so that the parent is raised when the dialog is raised. - Setting a null parent for a child window removes any parent-child - relationship for the child. Setting a null parent for a window which - currently has no parent is a no-op. + Setting a null parent for a child surface unsets its parent. Setting + a null parent for a surface which currently has no parent is a no-op. - If the parent is unmapped then its children are managed as - though the parent of the now-unmapped parent has become the - parent of this surface. If no parent exists for the now-unmapped - parent then the children are managed as though they have no - parent surface. + Only mapped surfaces can have child surfaces. Setting a parent which + is not mapped is equivalent to setting a null parent. If a surface + becomes unmapped, its children's parent is set to the parent of + the now-unmapped surface. If the now-unmapped surface has no parent, + its children's parent is unset. If the now-unmapped surface becomes + mapped again, its parent-child relationship is not restored. + + The parent toplevel must not be one of the child toplevel's + descendants, and the parent must be different from the child toplevel, + otherwise the invalid_parent protocol error is raised. @@ -664,7 +717,7 @@ application identifiers and how they relate to well-known D-Bus names and .desktop files. - [0] http://standards.freedesktop.org/desktop-entry-spec/ + [0] https://standards.freedesktop.org/desktop-entry-spec/ @@ -678,7 +731,8 @@ This request asks the compositor to pop up such a window menu at the given position, relative to the local surface coordinates of the parent surface. There are no guarantees as to what menu items - the window menu contains. + the window menu contains, or even if a window menu will be drawn + at all. This request must be used in response to some sort of user action like a button press, key press, or touch down event. @@ -754,12 +808,13 @@ guarantee that the device focus will return when the resize is completed. - The edges parameter specifies how the surface should be resized, - and is one of the values of the resize_edge enum. The compositor - may use this information to update the surface position for - example when dragging the top left corner. The compositor may also - use this information to adapt its behavior, e.g. choose an - appropriate cursor image. + The edges parameter specifies how the surface should be resized, and + is one of the values of the resize_edge enum. Values not matching + a variant of the enum will cause the invalid_resize_edge protocol error. + The compositor may use this information to update the surface position + for example when dragging the top left corner. The compositor may also + use this information to adapt its behavior, e.g. choose an appropriate + cursor image. @@ -779,7 +834,8 @@ The surface is maximized. The window geometry specified in the configure - event must be obeyed by the client. + event must be obeyed by the client, or the xdg_wm_base.invalid_surface_state + error is raised. The client should draw without shadow or other decoration outside of the window geometry. @@ -833,6 +889,13 @@ considered to be adjacent to another part of the tiling grid. + + + The surface is currently not ordinarily being repainted; for + example because its content is occluded by another window, or its + outputs are switched off due to screen locking. + + @@ -866,11 +929,11 @@ request. Requesting a maximum size to be smaller than the minimum size of - a surface is illegal and will result in a protocol error. + a surface is illegal and will result in an invalid_size error. The width and height must be greater than or equal to zero. Using - strictly negative values for width and height will result in a - protocol error. + strictly negative values for width or height will result in a + invalid_size error. @@ -907,11 +970,11 @@ request. Requesting a minimum size to be larger than the maximum size of - a surface is illegal and will result in a protocol error. + a surface is illegal and will result in an invalid_size error. The width and height must be greater than or equal to zero. Using strictly negative values for width and height will result in a - protocol error. + invalid_size error. @@ -1094,9 +1157,44 @@ + + + + + + + + + + + + + This event advertises the capabilities supported by the compositor. If + a capability isn't supported, clients should hide or disable the UI + elements that expose this functionality. For instance, if the + compositor doesn't advertise support for minimized toplevels, a button + triggering the set_minimized request should not be displayed. + + The compositor will ignore requests it doesn't support. For instance, + a compositor which doesn't advertise support for minimized will ignore + set_minimized requests. + + Compositors must send this event once before the first + xdg_surface.configure event. When the capabilities change, compositors + must send this event again and then send an xdg_surface.configure + event. + + The configured state should not be applied immediately. See + xdg_surface.configure for details. + + The capabilities are sent as an array of 32-bit unsigned integers in + native endianness. + + + - + A popup surface is a short-lived, temporary surface. It can be used to implement for example menus, popovers, tooltips and other similar user @@ -1134,8 +1232,8 @@ This destroys the popup. Explicitly destroying the xdg_popup object will also dismiss the popup, and unmap the surface. - If this xdg_popup is not the "topmost" popup, a protocol error - will be sent. + If this xdg_popup is not the "topmost" popup, the + xdg_wm_base.not_the_topmost_popup protocol error will be sent. @@ -1167,10 +1265,6 @@ nested grabbing popup as well. When a compositor dismisses popups, it will follow the same dismissing order as required from the client. - The parent of a grabbing popup must either be another xdg_popup with an - active explicit grab, or an xdg_popup or xdg_toplevel, if there are no - explicit grabs already taken. - If the topmost grabbing popup is destroyed, the grab will be returned to the parent of the popup, if that parent previously had an explicit grab. diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp index acc72f50eda..454fa243b9b 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp @@ -1,5 +1,6 @@ // Copyright (C) 2017 The Qt Company Ltd. // Copyright (C) 2017 Eurogiciel, author: +// Copyright (C) 2023 David Edmundson // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "qwaylandxdgshell_p.h" @@ -87,10 +88,11 @@ void QWaylandXdgSurface::Toplevel::applyConfigure() } } + m_applied = m_pending; + if (!surfaceSize.isEmpty()) m_xdgSurface->m_window->resizeFromApplyConfigure(surfaceSize.grownBy(m_xdgSurface->m_window->windowContentMargins())); - m_applied = m_pending; qCDebug(lcQpaWayland) << "Applied pending xdg_toplevel configure event:" << m_applied.size << m_applied.states; } @@ -115,6 +117,7 @@ void QWaylandXdgSurface::Toplevel::xdg_toplevel_configure(int32_t width, int32_t auto *xdgStates = static_cast(states->data); size_t numStates = states->size / sizeof(uint32_t); + m_pending.suspended = false; m_pending.states = Qt::WindowNoState; m_toplevelStates = QWaylandWindow::WindowNoState; @@ -141,6 +144,9 @@ void QWaylandXdgSurface::Toplevel::xdg_toplevel_configure(int32_t width, int32_t case XDG_TOPLEVEL_STATE_TILED_BOTTOM: m_toplevelStates |= QWaylandWindow::WindowTiledBottom; break; + case XDG_TOPLEVEL_STATE_SUSPENDED: + m_pending.suspended = true; + break; default: break; } @@ -359,6 +365,9 @@ void QWaylandXdgSurface::setWindowFlags(Qt::WindowFlags flags) bool QWaylandXdgSurface::isExposed() const { + if (m_toplevel && m_toplevel->m_applied.suspended) + return false; + return m_configured || m_pendingConfigureSerial; } @@ -606,8 +615,8 @@ void QWaylandXdgSurface::xdg_surface_configure(uint32_t serial) if (!m_configured) { // We have to do the initial applyConfigure() immediately, since that is the expose. applyConfigure(); - QRegion exposeRegion = QRegion(QRect(QPoint(), m_window->geometry().size())); - m_window->handleExpose(exposeRegion); + if (isExposed()) + m_window->handleExpose(QRect(QPoint(), m_window->geometry().size())); } else { // Later configures are probably resizes, so we have to queue them up for a time when we // are not painting to the window. diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h index ddfea2116f9..c5e6a98960e 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h @@ -101,6 +101,7 @@ private: QSize bounds = {0, 0}; QSize size = {0, 0}; Qt::WindowStates states = Qt::WindowNoState; + bool suspended = false; } m_pending, m_applied; QWaylandWindow::ToplevelWindowTilingStates m_toplevelStates = QWaylandWindow::WindowNoState; QSize m_normalSize; diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshellintegration.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshellintegration.cpp index c7b757dd4ca..f1bb8bee478 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshellintegration.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshellintegration.cpp @@ -12,7 +12,7 @@ QT_BEGIN_NAMESPACE namespace QtWaylandClient { -QWaylandXdgShellIntegration::QWaylandXdgShellIntegration() : QWaylandShellIntegrationTemplate(4) +QWaylandXdgShellIntegration::QWaylandXdgShellIntegration() : QWaylandShellIntegrationTemplate(6) { connect(this, &QWaylandShellIntegrationTemplate::activeChanged, this, [this] { if (isActive()) { diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 15044d66075..0ae2985b539 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -636,7 +636,7 @@ void QWaylandWindow::doApplyConfigureFromOtherThread() if (!mCanResize || !mWaitingToApplyConfigure) return; doApplyConfigure(); - sendExposeEvent(QRect(QPoint(), geometry().size())); + sendRecursiveExposeEvent(); } void QWaylandWindow::setCanResize(bool canResize) @@ -652,7 +652,7 @@ void QWaylandWindow::setCanResize(bool canResize) bool inGuiThread = QThread::currentThreadId() == QThreadData::get2(thread())->threadId.loadRelaxed(); if (inGuiThread) { doApplyConfigure(); - sendExposeEvent(QRect(QPoint(), geometry().size())); + sendRecursiveExposeEvent(); } else { QMetaObject::invokeMethod(this, &QWaylandWindow::doApplyConfigureFromOtherThread, Qt::QueuedConnection); } @@ -677,9 +677,10 @@ void QWaylandWindow::applyConfigure() void QWaylandWindow::sendRecursiveExposeEvent() { - if (!window()->isVisible()) - return; - sendExposeEvent(QRect(QPoint(), geometry().size())); + if (!isExposed()) + sendExposeEvent(QRect()); + else + sendExposeEvent(QRect(QPoint(), geometry().size())); for (QWaylandSubSurface *subSurface : std::as_const(mChildren)) { auto subWindow = subSurface->window(); @@ -745,7 +746,7 @@ void QWaylandWindow::safeCommit(QWaylandBuffer *buffer, const QRegion &damage) void QWaylandWindow::handleExpose(const QRegion ®ion) { QWindowSystemInterface::handleExposeEvent(window(), region); - if (mQueuedBuffer) { + if (mQueuedBuffer && !region.isEmpty()) { commit(mQueuedBuffer, mQueuedBufferDamage); mQueuedBuffer = nullptr; mQueuedBufferDamage = QRegion(); diff --git a/tests/auto/wayland/xdgshell/tst_xdgshell.cpp b/tests/auto/wayland/xdgshell/tst_xdgshell.cpp index 3268964fcc9..edc1c0fea3a 100644 --- a/tests/auto/wayland/xdgshell/tst_xdgshell.cpp +++ b/tests/auto/wayland/xdgshell/tst_xdgshell.cpp @@ -1,4 +1,5 @@ // Copyright (C) 2018 The Qt Company Ltd. +// Copyright (C) 2023 David Edmundson // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #include "mockcompositor.h" @@ -30,6 +31,8 @@ private slots: void windowGeometry(); void foreignSurface(); void nativeResources(); + void suspended(); + void initiallySuspended(); }; void tst_xdgshell::init() @@ -695,5 +698,35 @@ void tst_xdgshell::nativeResources() QCOMPARE(xdg_popup_proxy, nullptr); } +void tst_xdgshell::suspended() +{ + QRasterWindow window; + window.resize(400, 320); + window.show(); + QVERIFY(!window.isExposed()); // not exposed until we're configured + QCOMPOSITOR_TRY_VERIFY(xdgToplevel()); + + exec([=] { xdgToplevel()->sendCompleteConfigure(); }); + QCOMPOSITOR_TRY_VERIFY(xdgToplevel()->m_xdgSurface->m_committedConfigureSerial); + QTRY_VERIFY(window.isExposed()); + + exec([=] { xdgToplevel()->sendCompleteConfigure(QSize(), {XdgToplevel::state_suspended}); }); + QTRY_VERIFY(!window.isExposed()); + + exec([=] { xdgToplevel()->sendCompleteConfigure(QSize(), {}); }); + QTRY_VERIFY(window.isExposed()); +} + +void tst_xdgshell::initiallySuspended() +{ + QRasterWindow window; + window.resize(400, 320); + window.show(); + QVERIFY(!window.isExposed()); + QCOMPOSITOR_TRY_VERIFY(xdgToplevel()); + exec([=] { xdgToplevel()->sendCompleteConfigure(QSize(), {XdgToplevel::state_suspended}); }); + QVERIFY(!window.isExposed()); +} + QCOMPOSITOR_TEST_MAIN(tst_xdgshell) #include "tst_xdgshell.moc" From 646bca0c7423a8f2c9111121ae04276cc228c153 Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Wed, 18 Jan 2023 13:44:46 +0000 Subject: [PATCH 1240/1507] client: Implement QWheelEvent::inverted "Natural scrolling" is a setting that makes trackpads act in the inverse; moving up moves content down to mimic behavior of touchscreens. However not all scroll events are used for scrolling, so it can be useful to know the real direction. This was exposed in QWheelEvent it just needs plumbing. Change-Id: I050b8b3e55796beff33badb7c073c0b93589294e Reviewed-by: Shawn Rutledge Reviewed-by: Eskil Abrahamsen Blomfeldt Reviewed-by: Vlad Zahorodnii --- .../platforms/wayland/qwaylandinputdevice.cpp | 36 +++++++++++++---- .../platforms/wayland/qwaylandinputdevice_p.h | 7 +++- .../platforms/wayland/qwaylandwindow.cpp | 4 +- tests/auto/wayland/seat/tst_seat.cpp | 39 ++++++++++++------- tests/auto/wayland/shared/coreprotocol.cpp | 7 ++++ tests/auto/wayland/shared/coreprotocol.h | 3 +- 6 files changed, 72 insertions(+), 24 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index c898fcf08b9..0cffb8811f8 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -383,7 +383,7 @@ QWaylandInputDevice::Touch::~Touch() } QWaylandInputDevice::QWaylandInputDevice(QWaylandDisplay *display, int version, uint32_t id) - : QtWayland::wl_seat(display->wl_registry(), id, qMin(version, 8)) + : QtWayland::wl_seat(display->wl_registry(), id, qMin(version, 9)) , mQDisplay(display) , mDisplay(display->wl_display()) { @@ -879,9 +879,9 @@ class WheelEvent : public QWaylandPointerEvent public: WheelEvent(QWaylandWindow *surface, Qt::ScrollPhase phase, ulong timestamp, const QPointF &local, const QPointF &global, const QPoint &pixelDelta, const QPoint &angleDelta, - Qt::MouseEventSource source, Qt::KeyboardModifiers modifiers) + Qt::MouseEventSource source, Qt::KeyboardModifiers modifiers, bool inverted) : QWaylandPointerEvent(QEvent::Wheel, phase, surface, timestamp, - local, global, pixelDelta, angleDelta, source, modifiers) + local, global, pixelDelta, angleDelta, source, modifiers, inverted) { } }; @@ -975,8 +975,9 @@ void QWaylandInputDevice::Pointer::pointer_axis_stop(uint32_t time, uint32_t axi if (!target) target = focusWindow(); Qt::KeyboardModifiers mods = mParent->modifiers(); + const bool inverted = mFrameData.verticalAxisInverted || mFrameData.horizontalAxisInverted; WheelEvent wheelEvent(focusWindow(), Qt::ScrollEnd, mParent->mTime, mSurfacePos, mGlobalPos, - QPoint(), QPoint(), Qt::MouseEventNotSynthesized, mods); + QPoint(), QPoint(), Qt::MouseEventNotSynthesized, mods, inverted); target->handleMouse(mParent, wheelEvent); mScrollBeginSent = false; mScrollDeltaRemainder = QPointF(); @@ -1025,6 +1026,21 @@ void QWaylandInputDevice::Pointer::pointer_axis_value120(uint32_t axis, int32_t } } +void QWaylandInputDevice::Pointer::pointer_axis_relative_direction(uint32_t axis, uint32_t direction) +{ + const bool inverted = direction == axis_relative_direction_inverted; + switch (axis) { + case axis_vertical_scroll: + mFrameData.verticalAxisInverted = inverted; + break; + case axis_horizontal_scroll: + mFrameData.horizontalAxisInverted = inverted; + break; + default: + qCWarning(lcQpaWaylandInput) << "wl_pointer.axis_relative_direction: Unknown axis:" << axis; + } +} + void QWaylandInputDevice::Pointer::setFrameEvent(QWaylandPointerEvent *event) { qCDebug(lcQpaWaylandInput) << "Setting frame event " << event->type; @@ -1046,6 +1062,8 @@ void QWaylandInputDevice::Pointer::FrameData::resetScrollData() delta120 = QPoint(); delta = QPointF(); axisSource = axis_source_wheel; + horizontalAxisInverted = false; + verticalAxisInverted = false; } bool QWaylandInputDevice::Pointer::FrameData::hasPixelDelta() const @@ -1127,7 +1145,7 @@ void QWaylandInputDevice::Pointer::flushScrollEvent() target->handleMouse(mParent, WheelEvent(focusWindow(), Qt::ScrollBegin, mParent->mTime, mSurfacePos, mGlobalPos, QPoint(), QPoint(), Qt::MouseEventNotSynthesized, - mParent->modifiers())); + mParent->modifiers(), false)); mScrollBeginSent = true; mScrollDeltaRemainder = QPointF(); } @@ -1136,11 +1154,15 @@ void QWaylandInputDevice::Pointer::flushScrollEvent() QPoint pixelDelta = mFrameData.pixelDeltaAndError(&mScrollDeltaRemainder); Qt::MouseEventSource source = mFrameData.wheelEventSource(); + + // The wayland protocol has separate horizontal and vertical axes, Qt has just the one inverted flag + // Pragmatically it should't come up + const bool inverted = mFrameData.verticalAxisInverted || mFrameData.horizontalAxisInverted; + qCDebug(lcQpaWaylandInput) << "Flushing scroll event" << phase << pixelDelta << angleDelta; target->handleMouse(mParent, WheelEvent(focusWindow(), phase, mParent->mTime, mSurfacePos, mGlobalPos, - pixelDelta, angleDelta, source, mParent->modifiers())); + pixelDelta, angleDelta, source, mParent->modifiers(), inverted)); } - mFrameData.resetScrollData(); } diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h index 31ce50f6830..ddd23ad98d7 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h +++ b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h @@ -309,6 +309,7 @@ protected: void pointer_axis_discrete(uint32_t axis, int32_t value) override; void pointer_frame() override; void pointer_axis_value120(uint32_t axis, int32_t value120) override; + void pointer_axis_relative_direction(uint32_t axis, uint32_t direction) override; private slots: void handleFocusDestroyed() { invalidateFocus(); } @@ -343,6 +344,8 @@ public: QPointF delta; QPoint delta120; axis_source axisSource = axis_source_wheel; + bool verticalAxisInverted = false; + bool horizontalAxisInverted = false; void resetScrollData(); bool hasPixelDelta() const; @@ -416,7 +419,7 @@ public: ulong timestamp, const QPointF &local, const QPointF &global, const QPoint &pixelDelta, const QPoint &angleDelta, Qt::MouseEventSource source, - Qt::KeyboardModifiers modifiers) + Qt::KeyboardModifiers modifiers, bool inverted) : type(type) , phase(phase) , timestamp(timestamp) @@ -427,6 +430,7 @@ public: , angleDelta(angleDelta) , source(source) , surface(surface) + , inverted(inverted) {} QEvent::Type type = QEvent::None; @@ -441,6 +445,7 @@ public: QPoint angleDelta; Qt::MouseEventSource source = Qt::MouseEventNotSynthesized; QPointer surface; + bool inverted = false; }; #ifndef QT_NO_GESTURES diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 0ae2985b539..5171a8bb053 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -1162,7 +1162,7 @@ void QWaylandWindow::handleMouse(QWaylandInputDevice *inputDevice, const QWaylan case QEvent::Wheel: QWindowSystemInterface::handleWheelEvent(window(), e.timestamp, e.local, e.global, e.pixelDelta, e.angleDelta, e.modifiers, - e.phase, e.source, false); + e.phase, e.source, e.inverted); break; default: Q_UNREACHABLE(); @@ -1353,7 +1353,7 @@ void QWaylandWindow::handleMouseEventWithDecoration(QWaylandInputDevice *inputDe QWindowSystemInterface::handleWheelEvent(window(), e.timestamp, localTranslated, globalTranslated, e.pixelDelta, e.angleDelta, e.modifiers, - e.phase, e.source, false); + e.phase, e.source, e.inverted); break; } default: diff --git a/tests/auto/wayland/seat/tst_seat.cpp b/tests/auto/wayland/seat/tst_seat.cpp index 34409c2ca06..d3bc1eda3bc 100644 --- a/tests/auto/wayland/seat/tst_seat.cpp +++ b/tests/auto/wayland/seat/tst_seat.cpp @@ -17,7 +17,7 @@ public: removeAll(); uint capabilities = MockCompositor::Seat::capability_pointer | MockCompositor::Seat::capability_touch; - int version = 8; + int version = 9; add(capabilities, version); }); } @@ -54,13 +54,13 @@ private slots: void tst_seat::bindsToSeat() { QCOMPOSITOR_COMPARE(get()->resourceMap().size(), 1); - QCOMPOSITOR_COMPARE(get()->resourceMap().first()->version(), 8); + QCOMPOSITOR_COMPARE(get()->resourceMap().first()->version(), 9); } void tst_seat::createsPointer() { QCOMPOSITOR_TRY_COMPARE(pointer()->resourceMap().size(), 1); - QCOMPOSITOR_TRY_COMPARE(pointer()->resourceMap().first()->version(), 8); + QCOMPOSITOR_TRY_COMPARE(pointer()->resourceMap().first()->version(), 9); } void tst_seat::setsCursorOnEnter() @@ -114,10 +114,6 @@ public: QCOMPARE(event->pixelDelta(), QPoint(0, 0)); } - // The axis vector of the event is already in surface space, so there is now way to tell - // whether it is inverted or not. - QCOMPARE(event->inverted(), false); - // We didn't press any buttons QCOMPARE(event->buttons(), Qt::NoButton); @@ -131,12 +127,14 @@ public: , pixelDelta(event->pixelDelta()) , angleDelta(event->angleDelta()) , source(event->source()) + , inverted(event->inverted()) { } Qt::ScrollPhase phase{}; QPoint pixelDelta; QPoint angleDelta; // eights of a degree, positive is upwards, left Qt::MouseEventSource source{}; + bool inverted = false; }; QList m_events; }; @@ -146,13 +144,21 @@ void tst_seat::simpleAxis_data() QTest::addColumn("axis"); QTest::addColumn("value"); QTest::addColumn("angleDelta"); + QTest::addColumn("inverted"); // Directions in regular windows/linux terms (no "natural" scrolling) - QTest::newRow("down") << uint(Pointer::axis_vertical_scroll) << 1.0 << QPoint{0, -12}; - QTest::newRow("up") << uint(Pointer::axis_vertical_scroll) << -1.0 << QPoint{0, 12}; - QTest::newRow("left") << uint(Pointer::axis_horizontal_scroll) << 1.0 << QPoint{-12, 0}; - QTest::newRow("right") << uint(Pointer::axis_horizontal_scroll) << -1.0 << QPoint{12, 0}; - QTest::newRow("up big") << uint(Pointer::axis_vertical_scroll) << -10.0 << QPoint{0, 120}; + QTest::newRow("down") << uint(Pointer::axis_vertical_scroll) << 1.0 << QPoint{0, -12} << false; + QTest::newRow("up") << uint(Pointer::axis_vertical_scroll) << -1.0 << QPoint{0, 12} << false; + QTest::newRow("left") << uint(Pointer::axis_horizontal_scroll) << 1.0 << QPoint{-12, 0} << false; + QTest::newRow("right") << uint(Pointer::axis_horizontal_scroll) << -1.0 << QPoint{12, 0} << false; + QTest::newRow("up big") << uint(Pointer::axis_vertical_scroll) << -10.0 << QPoint{0, 120} << false; + + // (natural) scrolling + QTest::newRow("down inverted") << uint(Pointer::axis_vertical_scroll) << 1.0 << QPoint{0, -12} << true; + QTest::newRow("up inverted") << uint(Pointer::axis_vertical_scroll) << -1.0 << QPoint{0, 12} << true; + QTest::newRow("left inverted") << uint(Pointer::axis_horizontal_scroll) << 1.0 << QPoint{-12, 0} << true; + QTest::newRow("right inverted") << uint(Pointer::axis_horizontal_scroll) << -1.0 << QPoint{12, 0} << true; + QTest::newRow("up big inverted") << uint(Pointer::axis_vertical_scroll) << -10.0 << QPoint{0, 120} << true; } void tst_seat::simpleAxis() @@ -160,6 +166,7 @@ void tst_seat::simpleAxis() QFETCH(uint, axis); QFETCH(qreal, value); QFETCH(QPoint, angleDelta); + QFETCH(bool, inverted); WheelWindow window; QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial); @@ -173,6 +180,8 @@ void tst_seat::simpleAxis() Pointer::axis(axis), value // Length of vector in surface-local space. i.e. positive is downwards ); + auto direction = inverted ? Pointer::axis_relative_direction_inverted : Pointer::axis_relative_direction_identical; + p->sendAxisRelativeDirection(client(), Pointer::axis(axis), direction); p->sendFrame(client()); }); @@ -186,6 +195,8 @@ void tst_seat::simpleAxis() // Documentation says not synthesized is appropriate in such cases QCOMPARE(e.source, Qt::MouseEventNotSynthesized); QCOMPARE(e.angleDelta, angleDelta); + + QCOMPARE(e.inverted, inverted); } // Sending axis_stop is not mandatory when axis source != finger @@ -386,6 +397,8 @@ void tst_seat::continuousScroll() QCOMPARE(e.phase, Qt::NoScrollPhase); QCOMPARE(e.pixelDelta, QPoint(5, -10)); QCOMPARE(e.source, Qt::MouseEventSynthesizedBySystem); // touchpads are not wheels + QCOMPARE(e.inverted, false); + } // Sending axis_stop is not mandatory when axis source != finger } @@ -393,7 +406,7 @@ void tst_seat::continuousScroll() void tst_seat::createsTouch() { QCOMPOSITOR_TRY_COMPARE(touch()->resourceMap().size(), 1); - QCOMPOSITOR_TRY_COMPARE(touch()->resourceMap().first()->version(), 8); + QCOMPOSITOR_TRY_COMPARE(touch()->resourceMap().first()->version(), 9); } class TouchWindow : public QRasterWindow { diff --git a/tests/auto/wayland/shared/coreprotocol.cpp b/tests/auto/wayland/shared/coreprotocol.cpp index 64586d413de..915b0f914cb 100644 --- a/tests/auto/wayland/shared/coreprotocol.cpp +++ b/tests/auto/wayland/shared/coreprotocol.cpp @@ -432,6 +432,13 @@ void Pointer::sendAxisValue120(wl_client *client, QtWaylandServer::wl_pointer::a send_axis_value120(r->handle, axis, value120); } +void Pointer::sendAxisRelativeDirection(wl_client *client, QtWaylandServer::wl_pointer::axis axis, QtWaylandServer::wl_pointer::axis_relative_direction direction) +{ + const auto pointerResources = resourceMap().values(client); + for (auto *r : pointerResources) + send_axis_relative_direction(r->handle, axis, direction); +} + void Pointer::pointer_set_cursor(Resource *resource, uint32_t serial, wl_resource *surface, int32_t hotspot_x, int32_t hotspot_y) { Q_UNUSED(resource); diff --git a/tests/auto/wayland/shared/coreprotocol.h b/tests/auto/wayland/shared/coreprotocol.h index e41c719e87a..20a3f2122b5 100644 --- a/tests/auto/wayland/shared/coreprotocol.h +++ b/tests/auto/wayland/shared/coreprotocol.h @@ -299,7 +299,7 @@ class Seat : public Global, public QtWaylandServer::wl_seat { Q_OBJECT public: - explicit Seat(CoreCompositor *compositor, uint capabilities = Seat::capability_pointer | Seat::capability_keyboard | Seat::capability_touch, int version = 8); + explicit Seat(CoreCompositor *compositor, uint capabilities = Seat::capability_pointer | Seat::capability_keyboard | Seat::capability_touch, int version = 9); ~Seat() override; void send_capabilities(Resource *resource, uint capabilities) = delete; // Use wrapper instead void send_capabilities(uint capabilities) = delete; // Use wrapper instead @@ -350,6 +350,7 @@ public: void sendAxisStop(wl_client *client, axis axis); void sendFrame(wl_client *client); void sendAxisValue120(wl_client *client, axis axis, int value120); + void sendAxisRelativeDirection(wl_client *client, axis axis, axis_relative_direction direction); Seat *m_seat = nullptr; QList m_enterSerials; From ad3bc01d3547e09d39ad542870ff76b8c299cc41 Mon Sep 17 00:00:00 2001 From: JiDe Zhang Date: Wed, 20 Sep 2023 17:15:25 +0800 Subject: [PATCH 1241/1507] QWaylandWindow: add QWaylandWindow::setScale The logic for update window's scale is scattered in multiple places, we should unify their behavior. Change-Id: Ic8ba20fdbc44942aed9b4bd0b0b12dad7bee1719 Reviewed-by: Liang Qi --- .../platforms/wayland/qwaylandwindow.cpp | 46 +++++++++---------- .../platforms/wayland/qwaylandwindow_p.h | 1 + 2 files changed, 24 insertions(+), 23 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 5171a8bb053..9991ade4ffe 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -107,19 +107,8 @@ void QWaylandWindow::initWindow() connect(mFractionalScale.data(), &QWaylandFractionalScale::preferredScaleChanged, this, [this](qreal preferredScale) { preferredScale = std::max(1.0, preferredScale); - if (mScale == preferredScale) { - return; - } - mScale = preferredScale; - QWindowSystemInterface::handleWindowDevicePixelRatioChanged(window()); - ensureSize(); - if (mViewport) - updateViewport(); - if (isExposed()) { - // redraw at the new DPR - window()->requestUpdate(); - sendExposeEvent(QRect(QPoint(), geometry().size())); - } + Q_ASSERT(mViewport); + setScale(preferredScale); }); } @@ -1394,17 +1383,28 @@ void QWaylandWindow::handleScreensChanged() return; int scale = mLastReportedScreen->isPlaceholder() ? 1 : static_cast(mLastReportedScreen)->scale(); + setScale(scale); +} - if (scale != mScale) { - mScale = scale; - QWindowSystemInterface::handleWindowDevicePixelRatioChanged(window()); - if (mSurface) { - if (mViewport) - updateViewport(); - else if (mSurface->version() >= 3) - mSurface->set_buffer_scale(std::ceil(mScale)); - } - ensureSize(); +void QWaylandWindow::setScale(qreal newScale) +{ + if (qFuzzyCompare(mScale, newScale)) + return; + mScale = newScale; + + QWindowSystemInterface::handleWindowDevicePixelRatioChanged(window()); + if (mSurface) { + if (mViewport) + updateViewport(); + else if (mSurface->version() >= 3) + mSurface->set_buffer_scale(std::ceil(mScale)); + } + ensureSize(); + + if (isExposed()) { + // redraw at the new DPR + window()->requestUpdate(); + sendExposeEvent(QRect(QPoint(), geometry().size())); } } diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index 445a05b7f43..5e064a642f3 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -346,6 +346,7 @@ private: void handleMouseEventWithDecoration(QWaylandInputDevice *inputDevice, const QWaylandPointerEvent &e); void handleScreensChanged(); + void setScale(qreal newScale); void sendRecursiveExposeEvent(); QWaylandWindow *closestTransientParent() const; From e258b7345c77f63a6f3f2e2c3bcd89245154203f Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Fri, 13 Oct 2023 12:26:25 +0200 Subject: [PATCH 1242/1507] Include what you need: All these TUs relied on transitive includes of qpointer.h, maybe to a large extent via qevent.h, though, given that qevent.h is more or less the only public QtBase header that includes qpointer.h, something else seems to be at play here. Said qevent.h actually needs QPointer in-name-only, so a forward declaration would suffice. Prepare for qevent.h dropping the include. The algorithm I used was: If the TU mentions 'passiveGrabbers', the name of the QEvent function that returns QPointers, and the TU doesn't have qpointer.h included explicitly, include it. That may produce False Positives, but better safe than sorry. Otherwise, in src/, add an include to all source and header files which mention QPointer. Exception: if foo.h of a foo.cpp already includes it, don't include again. Task-number: QTBUG-117670 Change-Id: I8eb00fbd2df16300b0cbfc4157612a45c72ac12c Reviewed-by: Fabian Kosmale --- src/plugins/platforms/wayland/qwaylandwindow_p.h | 2 ++ tests/auto/wayland/shared/coreprotocol.h | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index 5e064a642f3..7e0d3c57cdb 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -35,6 +35,8 @@ #include #include +#include + struct wl_egl_window; QT_BEGIN_NAMESPACE diff --git a/tests/auto/wayland/shared/coreprotocol.h b/tests/auto/wayland/shared/coreprotocol.h index 20a3f2122b5..15ade2bcadb 100644 --- a/tests/auto/wayland/shared/coreprotocol.h +++ b/tests/auto/wayland/shared/coreprotocol.h @@ -6,6 +6,8 @@ #include "corecompositor.h" +#include + #include namespace MockCompositor { From c16f6d40518fce6576c311c658956e21f7d52372 Mon Sep 17 00:00:00 2001 From: Lu YaNing Date: Wed, 11 Oct 2023 19:47:32 +0800 Subject: [PATCH 1243/1507] client: Provide seatname for multi-seat In a multi-seat configuration the seat name can be used by clients to help identify which physical devices the seat represents. Change-Id: Id704ad289fe861c2170380f1575d298e8db03964 Reviewed-by: David Edmundson --- src/plugins/platforms/wayland/qwaylandinputdevice.cpp | 5 +++++ src/plugins/platforms/wayland/qwaylandinputdevice_p.h | 3 +++ 2 files changed, 8 insertions(+) diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index 0cffb8811f8..f26595708ea 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -473,6 +473,11 @@ void QWaylandInputDevice::seat_capabilities(uint32_t caps) } } +void QWaylandInputDevice::seat_name(const QString &name) +{ + mSeatName = name; +} + QWaylandInputDevice::Keyboard *QWaylandInputDevice::createKeyboard(QWaylandInputDevice *device) { return new Keyboard(device); diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h index ddd23ad98d7..4051cf898c9 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h +++ b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h @@ -84,6 +84,7 @@ public: ~QWaylandInputDevice() override; uint32_t capabilities() const { return mCaps; } + QString seatname() const { return mSeatName; } QWaylandDisplay *display() const { return mQDisplay; } struct ::wl_seat *wl_seat() { return QtWayland::wl_seat::object(); } @@ -143,6 +144,7 @@ protected: struct wl_display *mDisplay = nullptr; uint32_t mCaps = 0; + QString mSeatName; #if QT_CONFIG(cursor) struct CursorState { @@ -179,6 +181,7 @@ protected: uint32_t mSerial = 0; void seat_capabilities(uint32_t caps) override; + void seat_name(const QString &name) override; void handleTouchPoint(int id, QEventPoint::State state, const QPointF &surfacePosition = QPoint()); QPointingDevice *mTouchDevice = nullptr; From d76ce4732eae3eb449a6b20bc4f5b2f7f914cca0 Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Wed, 17 May 2023 09:06:03 +0300 Subject: [PATCH 1244/1507] Client: Always populate mimedata in drags It's possible for clients to perform a drag and drop operation within their own client without any mimeData. A user can directly access the original drag. On wayland without any mimedata it's impossible for a client to accept a drag as the mechansim involved is to either select a given mimedata entry or an empty string. Within Qt we always accept the first format if we accept a drag. When dragging within our own window we also start a wayland drag so will receive a cancel event from the compositor if the compositor doesn't believe the client has accepted the drag. This patch provides a dummy mimedata entry so that something can be accepted. Fixes: QTBUG-112161 Pick-to: 6.6 6.5 6.2 5.15 Change-Id: I6309d82e20545e10ebdb9dafde7e13a5e3be5ff2 Reviewed-by: Liang Qi --- src/plugins/platforms/wayland/qwaylanddatadevice.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/plugins/platforms/wayland/qwaylanddatadevice.cpp b/src/plugins/platforms/wayland/qwaylanddatadevice.cpp index fe8e91235ff..3344d3806ed 100644 --- a/src/plugins/platforms/wayland/qwaylanddatadevice.cpp +++ b/src/plugins/platforms/wayland/qwaylanddatadevice.cpp @@ -93,6 +93,12 @@ bool QWaylandDataDevice::startDrag(QMimeData *mimeData, Qt::DropActions supporte return false; } + // dragging data without mimetypes is a legal operation in Qt terms + // but Wayland uses a mimetype to determine if a drag is accepted or not + // In this rare case, insert a placeholder + if (mimeData->formats().isEmpty()) + mimeData->setData("application/x-qt-avoid-empty-placeholder"_L1, QByteArray("1")); + m_dragSource.reset(new QWaylandDataSource(m_display->dndSelectionHandler(), mimeData)); if (version() >= 3) From 7666f93b3b643506176ba925e6d61f2dd73bd044 Mon Sep 17 00:00:00 2001 From: Ahmad Samir Date: Wed, 25 Oct 2023 14:32:56 +0300 Subject: [PATCH 1245/1507] QWaylandMimeData: adapt to qt_safe_poll changes from qtbase It's private API in qtbase and has been changed recently. Change-Id: I763918a035bce67c06a6120e9d7dfb542ca023b8 Reviewed-by: Volker Hilsheimer --- src/plugins/platforms/wayland/qwaylanddataoffer.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylanddataoffer.cpp b/src/plugins/platforms/wayland/qwaylanddataoffer.cpp index b2288749554..c21113a80c9 100644 --- a/src/plugins/platforms/wayland/qwaylanddataoffer.cpp +++ b/src/plugins/platforms/wayland/qwaylanddataoffer.cpp @@ -11,6 +11,8 @@ #include +using namespace std::chrono; + QT_BEGIN_NAMESPACE namespace QtWaylandClient { @@ -205,13 +207,9 @@ int QWaylandMimeData::readData(int fd, QByteArray &data) const struct pollfd readset; readset.fd = fd; readset.events = POLLIN; - struct timespec timeout; - timeout.tv_sec = 1; - timeout.tv_nsec = 0; - Q_FOREVER { - int ready = qt_safe_poll(&readset, 1, &timeout); + int ready = qt_safe_poll(&readset, 1, QDeadlineTimer(1s)); if (ready < 0) { qWarning() << "QWaylandDataOffer: qt_safe_poll() failed"; return -1; From e73979a94fc431cabdff11cde7c0d2392c542419 Mon Sep 17 00:00:00 2001 From: JiDe Zhang Date: Wed, 20 Sep 2023 16:59:57 +0800 Subject: [PATCH 1246/1507] QWaylandSurface: client support wl_surface version 6 Add QWaylandWindow::updateScale() function to update the window's scale from QWaylandFractionalScale or QWaylandSurface::preferredBufferScale or QWaylandScreen::scale or QWaylandSurface::preferredBufferScale. Add QWaylandWindow::updateBufferTransform() function to update the window's buffer transform from QScreen::primaryOrientation or QWaylandSurface::preferredBufferTransform. Change-Id: I2742701e92c7403a89df97b7fa06b5b0de6917a7 Reviewed-by: Qt CI Bot Reviewed-by: David Edmundson --- .../platforms/wayland/qwaylanddisplay.cpp | 2 +- .../wayland/qwaylandfractionalscale.cpp | 2 +- .../wayland/qwaylandfractionalscale_p.h | 4 +- .../platforms/wayland/qwaylandscreen.cpp | 55 +++++++----- .../platforms/wayland/qwaylandscreen_p.h | 3 + .../platforms/wayland/qwaylandsurface.cpp | 16 ++++ .../platforms/wayland/qwaylandsurface_p.h | 8 ++ .../platforms/wayland/qwaylandwindow.cpp | 87 +++++++++++++------ .../platforms/wayland/qwaylandwindow_p.h | 4 + 9 files changed, 131 insertions(+), 50 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index 1c399765ec9..e5a1ed64706 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -618,7 +618,7 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin if (interface == QLatin1String(QtWayland::wl_output::interface()->name)) { mWaitingScreens << mWaylandIntegration->createPlatformScreen(this, version, id); } else if (interface == QLatin1String(QtWayland::wl_compositor::interface()->name)) { - mCompositor.init(registry, id, qMin((int)version, 4)); + mCompositor.init(registry, id, qMin((int)version, 6)); } else if (interface == QLatin1String(QWaylandShm::interface()->name)) { mShm.reset(new QWaylandShm(this, version, id)); } else if (interface == QLatin1String(QWaylandInputDevice::interface()->name)) { diff --git a/src/plugins/platforms/wayland/qwaylandfractionalscale.cpp b/src/plugins/platforms/wayland/qwaylandfractionalscale.cpp index 34169670f6b..6cd933f4707 100644 --- a/src/plugins/platforms/wayland/qwaylandfractionalscale.cpp +++ b/src/plugins/platforms/wayland/qwaylandfractionalscale.cpp @@ -22,7 +22,7 @@ void QWaylandFractionalScale::wp_fractional_scale_v1_preferred_scale(uint scale) qreal preferredScale = scale / 120.0; // hardcoded denominator determined in the spec if (preferredScale != mPreferredScale) { mPreferredScale = preferredScale; - Q_EMIT preferredScaleChanged(preferredScale); + Q_EMIT preferredScaleChanged(); } } diff --git a/src/plugins/platforms/wayland/qwaylandfractionalscale_p.h b/src/plugins/platforms/wayland/qwaylandfractionalscale_p.h index c030e60dde4..48e1fb4877e 100644 --- a/src/plugins/platforms/wayland/qwaylandfractionalscale_p.h +++ b/src/plugins/platforms/wayland/qwaylandfractionalscale_p.h @@ -33,8 +33,10 @@ public: explicit QWaylandFractionalScale(struct ::wp_fractional_scale_v1 *object); ~QWaylandFractionalScale(); + std::optional preferredScale() const { return mPreferredScale; } + Q_SIGNALS: - void preferredScaleChanged(qreal preferredScale); + void preferredScaleChanged(); protected: void wp_fractional_scale_v1_preferred_scale(uint scale) override; diff --git a/src/plugins/platforms/wayland/qwaylandscreen.cpp b/src/plugins/platforms/wayland/qwaylandscreen.cpp index 7c4f1bdf2c7..64fd55c0cb5 100644 --- a/src/plugins/platforms/wayland/qwaylandscreen.cpp +++ b/src/plugins/platforms/wayland/qwaylandscreen.cpp @@ -205,6 +205,35 @@ QWaylandScreen *QWaylandScreen::fromWlOutput(::wl_output *output) return nullptr; } +Qt::ScreenOrientation QWaylandScreen::toScreenOrientation(int wlTransform, + Qt::ScreenOrientation fallback) const +{ + auto orientation = fallback; + bool isPortrait = mGeometry.height() > mGeometry.width(); + switch (wlTransform) { + case WL_OUTPUT_TRANSFORM_NORMAL: + orientation = isPortrait ? Qt::PortraitOrientation : Qt::LandscapeOrientation; + break; + case WL_OUTPUT_TRANSFORM_90: + orientation = isPortrait ? Qt::InvertedLandscapeOrientation : Qt::PortraitOrientation; + break; + case WL_OUTPUT_TRANSFORM_180: + orientation = isPortrait ? Qt::InvertedPortraitOrientation : Qt::InvertedLandscapeOrientation; + break; + case WL_OUTPUT_TRANSFORM_270: + orientation = isPortrait ? Qt::LandscapeOrientation : Qt::InvertedPortraitOrientation; + break; + // Ignore these ones, at least for now + case WL_OUTPUT_TRANSFORM_FLIPPED: + case WL_OUTPUT_TRANSFORM_FLIPPED_90: + case WL_OUTPUT_TRANSFORM_FLIPPED_180: + case WL_OUTPUT_TRANSFORM_FLIPPED_270: + break; + } + + return orientation; +} + void QWaylandScreen::output_mode(uint32_t flags, int width, int height, int refresh) { if (!(flags & WL_OUTPUT_MODE_CURRENT)) @@ -257,29 +286,11 @@ void QWaylandScreen::output_done() void QWaylandScreen::updateOutputProperties() { if (mTransform >= 0) { - bool isPortrait = mGeometry.height() > mGeometry.width(); - switch (mTransform) { - case WL_OUTPUT_TRANSFORM_NORMAL: - m_orientation = isPortrait ? Qt::PortraitOrientation : Qt::LandscapeOrientation; - break; - case WL_OUTPUT_TRANSFORM_90: - m_orientation = isPortrait ? Qt::InvertedLandscapeOrientation : Qt::PortraitOrientation; - break; - case WL_OUTPUT_TRANSFORM_180: - m_orientation = isPortrait ? Qt::InvertedPortraitOrientation : Qt::InvertedLandscapeOrientation; - break; - case WL_OUTPUT_TRANSFORM_270: - m_orientation = isPortrait ? Qt::LandscapeOrientation : Qt::InvertedPortraitOrientation; - break; - // Ignore these ones, at least for now - case WL_OUTPUT_TRANSFORM_FLIPPED: - case WL_OUTPUT_TRANSFORM_FLIPPED_90: - case WL_OUTPUT_TRANSFORM_FLIPPED_180: - case WL_OUTPUT_TRANSFORM_FLIPPED_270: - break; + auto newOrientation = toScreenOrientation(mTransform, m_orientation); + if (m_orientation != newOrientation) { + m_orientation = newOrientation; + QWindowSystemInterface::handleScreenOrientationChange(screen(), m_orientation); } - - QWindowSystemInterface::handleScreenOrientationChange(screen(), m_orientation); mTransform = -1; } diff --git a/src/plugins/platforms/wayland/qwaylandscreen_p.h b/src/plugins/platforms/wayland/qwaylandscreen_p.h index 4499f0eef14..4bc2531f64d 100644 --- a/src/plugins/platforms/wayland/qwaylandscreen_p.h +++ b/src/plugins/platforms/wayland/qwaylandscreen_p.h @@ -82,6 +82,9 @@ public: static QWaylandScreen *waylandScreenFromWindow(QWindow *window); static QWaylandScreen *fromWlOutput(::wl_output *output); + Qt::ScreenOrientation toScreenOrientation(int wlTransform, + Qt::ScreenOrientation fallback) const; + protected: enum Event : uint { XdgOutputDoneEvent = 0x1, diff --git a/src/plugins/platforms/wayland/qwaylandsurface.cpp b/src/plugins/platforms/wayland/qwaylandsurface.cpp index cd1a561ba98..949d7b1609e 100644 --- a/src/plugins/platforms/wayland/qwaylandsurface.cpp +++ b/src/plugins/platforms/wayland/qwaylandsurface.cpp @@ -85,6 +85,22 @@ void QWaylandSurface::surface_leave(wl_output *output) emit screensChanged(); } +void QWaylandSurface::surface_preferred_buffer_scale(int32_t scale) +{ + if (m_preferredBufferScale == scale) + return; + m_preferredBufferScale = scale; + Q_EMIT preferredBufferScaleChanged(); +} + +void QWaylandSurface::surface_preferred_buffer_transform(uint32_t transform) +{ + if (m_preferredBufferTransform == transform) + return; + m_preferredBufferTransform = static_cast(transform); + Q_EMIT preferredBufferTransformChanged(); +} + } // namespace QtWaylandClient QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandsurface_p.h b/src/plugins/platforms/wayland/qwaylandsurface_p.h index 027c6ca4d4f..657f4ad436e 100644 --- a/src/plugins/platforms/wayland/qwaylandsurface_p.h +++ b/src/plugins/platforms/wayland/qwaylandsurface_p.h @@ -36,11 +36,15 @@ public: ~QWaylandSurface() override; QWaylandScreen *oldestEnteredScreen(); QWaylandWindow *waylandWindow() const { return m_window; } + std::optional preferredBufferScale() const { return m_preferredBufferScale; } + std::optional preferredBufferTransform() const { return m_preferredBufferTransform; } static QWaylandSurface *fromWlSurface(::wl_surface *surface); signals: void screensChanged(); + void preferredBufferScaleChanged(); + void preferredBufferTransformChanged(); private slots: void handleScreenRemoved(QScreen *qScreen); @@ -48,9 +52,13 @@ private slots: protected: void surface_enter(struct ::wl_output *output) override; void surface_leave(struct ::wl_output *output) override; + void surface_preferred_buffer_scale(int32_t scale) override; + void surface_preferred_buffer_transform(uint32_t transform) override; QList m_screens; //As seen by wl_surface.enter/leave events. Chronological order. QWaylandWindow *m_window = nullptr; + std::optional m_preferredBufferScale; + std::optional m_preferredBufferTransform; friend class QWaylandWindow; // TODO: shouldn't need to be friends }; diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 9991ade4ffe..87e75a5ad60 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -105,11 +105,8 @@ void QWaylandWindow::initWindow() if (mDisplay->fractionalScaleManager() && qApp->highDpiScaleFactorRoundingPolicy() == Qt::HighDpiScaleFactorRoundingPolicy::PassThrough) { mFractionalScale.reset(new QWaylandFractionalScale(mDisplay->fractionalScaleManager()->get_fractional_scale(mSurface->object()))); - connect(mFractionalScale.data(), &QWaylandFractionalScale::preferredScaleChanged, this, [this](qreal preferredScale) { - preferredScale = std::max(1.0, preferredScale); - Q_ASSERT(mViewport); - setScale(preferredScale); - }); + connect(mFractionalScale.data(), &QWaylandFractionalScale::preferredScaleChanged, + this, &QWaylandWindow::updateScale); } if (shouldCreateSubSurface()) { @@ -209,6 +206,10 @@ void QWaylandWindow::initializeWlSurface() mSurface.reset(new QWaylandSurface(mDisplay)); connect(mSurface.data(), &QWaylandSurface::screensChanged, this, &QWaylandWindow::handleScreensChanged); + connect(mSurface.data(), &QWaylandSurface::preferredBufferScaleChanged, + this, &QWaylandWindow::updateScale); + connect(mSurface.data(), &QWaylandSurface::preferredBufferTransformChanged, + this, &QWaylandWindow::updateBufferTransform); mSurface->m_window = this; } emit wlSurfaceCreated(); @@ -941,31 +942,49 @@ QWaylandScreen *QWaylandWindow::waylandScreen() const } void QWaylandWindow::handleContentOrientationChange(Qt::ScreenOrientation orientation) +{ + mLastReportedContentOrientation = orientation; + updateBufferTransform(); +} + +void QWaylandWindow::updateBufferTransform() { QReadLocker locker(&mSurfaceLock); if (mSurface == nullptr || mSurface->version() < 2) return; wl_output_transform transform; - bool isPortrait = window()->screen() && window()->screen()->primaryOrientation() == Qt::PortraitOrientation; - switch (orientation) { - case Qt::PrimaryOrientation: - transform = WL_OUTPUT_TRANSFORM_NORMAL; - break; - case Qt::LandscapeOrientation: - transform = isPortrait ? WL_OUTPUT_TRANSFORM_270 : WL_OUTPUT_TRANSFORM_NORMAL; - break; - case Qt::PortraitOrientation: - transform = isPortrait ? WL_OUTPUT_TRANSFORM_NORMAL : WL_OUTPUT_TRANSFORM_90; - break; - case Qt::InvertedLandscapeOrientation: - transform = isPortrait ? WL_OUTPUT_TRANSFORM_90 : WL_OUTPUT_TRANSFORM_180; - break; - case Qt::InvertedPortraitOrientation: - transform = isPortrait ? WL_OUTPUT_TRANSFORM_180 : WL_OUTPUT_TRANSFORM_270; - break; - default: - Q_UNREACHABLE(); + Qt::ScreenOrientation screenOrientation = Qt::PrimaryOrientation; + + if (mSurface->version() >= 6) { + const auto transform = mSurface->preferredBufferTransform().value_or(WL_OUTPUT_TRANSFORM_NORMAL); + if (auto screen = waylandScreen()) + screenOrientation = screen->toScreenOrientation(transform, Qt::PrimaryOrientation); + } else { + if (auto screen = window()->screen()) + screenOrientation = screen->primaryOrientation(); + } + + const bool isPortrait = (screenOrientation == Qt::PortraitOrientation); + + switch (mLastReportedContentOrientation) { + case Qt::PrimaryOrientation: + transform = WL_OUTPUT_TRANSFORM_NORMAL; + break; + case Qt::LandscapeOrientation: + transform = isPortrait ? WL_OUTPUT_TRANSFORM_270 : WL_OUTPUT_TRANSFORM_NORMAL; + break; + case Qt::PortraitOrientation: + transform = isPortrait ? WL_OUTPUT_TRANSFORM_NORMAL : WL_OUTPUT_TRANSFORM_90; + break; + case Qt::InvertedLandscapeOrientation: + transform = isPortrait ? WL_OUTPUT_TRANSFORM_90 : WL_OUTPUT_TRANSFORM_180; + break; + case Qt::InvertedPortraitOrientation: + transform = isPortrait ? WL_OUTPUT_TRANSFORM_180 : WL_OUTPUT_TRANSFORM_270; + break; + default: + Q_UNREACHABLE(); } mSurface->set_buffer_transform(transform); } @@ -1379,8 +1398,26 @@ void QWaylandWindow::handleScreensChanged() setGeometry(geometry); } - if (mFractionalScale) + updateScale(); + updateBufferTransform(); +} + +void QWaylandWindow::updateScale() +{ + if (mFractionalScale) { + auto preferredScale = mFractionalScale->preferredScale().value_or(1.0); + preferredScale = std::max(1.0, preferredScale); + Q_ASSERT(mViewport); + setScale(preferredScale); return; + } + + if (mSurface && mSurface->version() >= 6) { + auto preferredScale = mSurface->preferredBufferScale().value_or(1); + preferredScale = std::max(1, preferredScale); + setScale(preferredScale); + return; + } int scale = mLastReportedScreen->isPlaceholder() ? 1 : static_cast(mLastReportedScreen)->scale(); setScale(scale); diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index 7e0d3c57cdb..2e3f322fb38 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -142,6 +142,7 @@ public: QWaylandScreen *waylandScreen() const; void handleContentOrientationChange(Qt::ScreenOrientation orientation) override; + void updateBufferTransform(); void setOrientationMask(Qt::ScreenOrientations mask); ToplevelWindowTilingStates toplevelWindowTilingStates() const; @@ -331,6 +332,8 @@ protected: QPointer mTransientParent; QList> mChildPopups; + Qt::ScreenOrientation mLastReportedContentOrientation = Qt::PrimaryOrientation; + private slots: void doApplyConfigureFromOtherThread(); @@ -348,6 +351,7 @@ private: void handleMouseEventWithDecoration(QWaylandInputDevice *inputDevice, const QWaylandPointerEvent &e); void handleScreensChanged(); + void updateScale(); void setScale(qreal newScale); void sendRecursiveExposeEvent(); From 792f1915fcb5232118f86644e9c7b06a12000d3b Mon Sep 17 00:00:00 2001 From: Feifei Zhan Date: Thu, 12 Oct 2023 10:52:07 +0800 Subject: [PATCH 1247/1507] Add list is empty judgment,optimize to use constant the last() method of the mPendingTouchPoints list is judged to be empty before it is called, and the last() is optimised to constLast() according to the logic below. Change-Id: I8ec082a22c223d06dbe848bc70622710b6acfa50 Reviewed-by: Feifei Zhan Reviewed-by: David Edmundson --- src/plugins/platforms/wayland/qwaylandinputdevice.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index f26595708ea..aa11823ba3b 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -1548,7 +1548,12 @@ void QWaylandInputDevice::Touch::touch_frame() QWindow *window = mFocus ? mFocus->window() : nullptr; if (mFocus) { - const QWindowSystemInterface::TouchPoint &tp = mPendingTouchPoints.last(); + // Returns a reference to the last item in the list. The list must not be empty. + // If the list can be empty, call isEmpty() before calling this function. + // See: https://doc.qt.io/qt-5.15/qlist.html#last + if (mPendingTouchPoints.empty()) + return; + const QWindowSystemInterface::TouchPoint &tp = mPendingTouchPoints.constLast(); // When the touch event is received, the global pos is calculated with the margins // in mind. Now we need to adjust again to get the correct local pos back. QMargins margins = window->frameMargins(); From fa1658f8bf548c3bcd6fc289bbb94a787a0a4bd9 Mon Sep 17 00:00:00 2001 From: Weng Xuetian Date: Fri, 10 Nov 2023 19:43:37 -0800 Subject: [PATCH 1248/1507] client: Always clear queued buffer busy flag when resetting the window In 816f41c00d22ca157eed273183f0711d9f1b41c7, the queued buffer is always set busy, but it may not be reset correctly if the queued buffer is not ever attached due to hiding the surface when window visibility is being updated at a very fast speed. Fixes: QTBUG-118650 Task-number: QTBUG-118650 Pick-to: 6.6 Change-Id: Id0bdd3caa69c821bb84927f01b4839f46eee8a10 Reviewed-by: David Edmundson Reviewed-by: David Redondo --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 87e75a5ad60..a2af701ddd7 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -300,6 +300,9 @@ void QWaylandWindow::reset() mOpaqueArea = QRegion(); mMask = QRegion(); + if (mQueuedBuffer) { + mQueuedBuffer->setBusy(false); + } mQueuedBuffer = nullptr; mQueuedBufferDamage = QRegion(); From 061340e9c6bc850132381600be18d0dc3dbb17e6 Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Tue, 14 Nov 2023 13:31:28 +0200 Subject: [PATCH 1249/1507] Client: Move topmost grabbing popup tracking to QWaylandWindow If the effective transient parent is different from QWaylandWindow::transientParent(), then the popups may be closed in wrong order and producing an xdg-shell protocol error. This change lifts topmost popup tracking from the xdg-shell plugin to QWaylandWindow so it can guess the correct transient parent and the xdg-shell plugin doesn't have to pick a different parent behind our back. Fixes: QTBUG-119110 Pick-to: 6.6 Change-Id: I7c5f780b7bd4c3362aa7b22762ff336ae908ff70 Reviewed-by: David Edmundson --- .../xdg-shell/qwaylandxdgshell.cpp | 18 --------------- .../xdg-shell/qwaylandxdgshell_p.h | 1 - .../platforms/wayland/qwaylandwindow.cpp | 23 +++++++++++++++++-- .../platforms/wayland/qwaylandwindow_p.h | 3 ++- 4 files changed, 23 insertions(+), 22 deletions(-) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp index 454fa243b9b..e6cade0818f 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp @@ -227,9 +227,6 @@ QWaylandXdgSurface::Popup::~Popup() destroy(); if (m_grabbing) { - auto *shell = m_xdgSurface->m_shell; - Q_ASSERT(shell->m_topmostGrabbingPopup == this); - shell->m_topmostGrabbingPopup = m_parentXdgSurface ? m_parentXdgSurface->m_popup : nullptr; m_grabbing = false; // Synthesize Qt enter/leave events for popup @@ -261,7 +258,6 @@ void QWaylandXdgSurface::Popup::resetConfiguration() void QWaylandXdgSurface::Popup::grab(QWaylandInputDevice *seat, uint serial) { - m_xdgSurface->m_shell->m_topmostGrabbingPopup = this; xdg_popup::grab(seat->wl_seat(), serial); m_grabbing = true; } @@ -574,20 +570,6 @@ void QWaylandXdgSurface::setPopup(QWaylandWindow *parent) void QWaylandXdgSurface::setGrabPopup(QWaylandWindow *parent, QWaylandInputDevice *device, int serial) { - auto parentXdgSurface = qobject_cast(parent->shellSurface()); - auto *top = m_shell->m_topmostGrabbingPopup; - - if (top && top->m_xdgSurface != parentXdgSurface) { - qCWarning(lcQpaWayland) << "setGrabPopup called with a parent," << parentXdgSurface - << "which does not match the current topmost grabbing popup," - << top->m_xdgSurface << "According to the xdg-shell protocol, this" - << "is not allowed. The wayland QPA plugin is currently handling" - << "it by setting the parent to the topmost grabbing popup." - << "Note, however, that this may cause positioning errors and" - << "popups closing unxpectedly because xdg-shell mandate that child" - << "popups close before parents"; - parent = top->m_xdgSurface->m_window; - } setPopup(parent); m_popup->grab(device, serial); diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h index c5e6a98960e..0310706fd94 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h @@ -171,7 +171,6 @@ private: QScopedPointer m_xdgDecorationManager; QScopedPointer m_xdgActivation; QScopedPointer m_xdgExporter; - QWaylandXdgSurface::Popup *m_topmostGrabbingPopup = nullptr; friend class QWaylandXdgSurface; }; diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index a2af701ddd7..b547d056b98 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -41,6 +41,7 @@ namespace QtWaylandClient { Q_LOGGING_CATEGORY(lcWaylandBackingstore, "qt.qpa.wayland.backingstore") QWaylandWindow *QWaylandWindow::mMouseGrab = nullptr; +QWaylandWindow *QWaylandWindow::mTopPopup = nullptr; QWaylandWindow::QWaylandWindow(QWindow *window, QWaylandDisplay *display) : QPlatformWindow(window) @@ -122,7 +123,22 @@ void QWaylandWindow::initWindow() } else if (shouldCreateShellSurface()) { Q_ASSERT(!mShellSurface); Q_ASSERT(mShellIntegration); - mTransientParent = closestTransientParent(); + mTransientParent = guessTransientParent(); + if (mTransientParent) { + if (window()->type() == Qt::Popup) { + if (mTopPopup && mTopPopup != mTransientParent) { + qCWarning(lcQpaWayland) << "Creating a popup with a parent," << mTransientParent->window() + << "which does not match the current topmost grabbing popup," + << mTopPopup->window() << "With some shell surface protocols, this" + << "is not allowed. The wayland QPA plugin is currently handling" + << "it by setting the parent to the topmost grabbing popup." + << "Note, however, that this may cause positioning errors and" + << "popups closing unxpectedly. Please fix the transient parent of the popup."; + mTransientParent = mTopPopup; + } + mTopPopup = this; + } + } mShellSurface = mShellIntegration->createShellSurface(this); if (mShellSurface) { @@ -261,6 +277,9 @@ void QWaylandWindow::reset() { closeChildPopups(); + if (mTopPopup == this) + mTopPopup = mTransientParent && (mTransientParent->window()->type() == Qt::Popup) ? mTransientParent : nullptr; + if (mSurface) { emit wlSurfaceDestroyed(); QWriteLocker lock(&mSurfaceLock); @@ -1129,7 +1148,7 @@ QWaylandWindow *QWaylandWindow::transientParent() const return mTransientParent; } -QWaylandWindow *QWaylandWindow::closestTransientParent() const +QWaylandWindow *QWaylandWindow::guessTransientParent() const { // Take the closest window with a shell surface, since the transient parent may be a // QWidgetWindow or some other window without a shell surface, which is then not able to diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index 2e3f322fb38..aa125e6eab4 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -355,7 +355,7 @@ private: void setScale(qreal newScale); void sendRecursiveExposeEvent(); - QWaylandWindow *closestTransientParent() const; + QWaylandWindow *guessTransientParent() const; void addChildPopup(QWaylandWindow *child); void removeChildPopup(QWaylandWindow *child); @@ -367,6 +367,7 @@ private: void handleFrameCallback(struct ::wl_callback* callback); static QWaylandWindow *mMouseGrab; + static QWaylandWindow *mTopPopup; friend class QWaylandSubSurface; }; From 16ba2fad85104fee757dd62c2fdbead6111c7e48 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Sun, 19 Nov 2023 00:06:28 +0400 Subject: [PATCH 1250/1507] Client: Switch QWaylandXdgSurface::setSizeHints to the window content geometry According to the protocol documentation, set_{min,max}_size work in window content geometry while it currently works in QWindow geometry. Practically this excludes shadows and includes the non-shadow part of client-side decoration. Pick-to: 6.6 6.5 Change-Id: Ib702e4c9036a07645ba254ac3cc0e5704a949fe4 Reviewed-by: David Edmundson --- .../shellintegration/xdg-shell/qwaylandxdgshell.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp index e6cade0818f..39408f94b5b 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp @@ -409,10 +409,13 @@ void QWaylandXdgSurface::setWindowGeometry(const QRect &rect) void QWaylandXdgSurface::setSizeHints() { if (m_toplevel && m_window) { - const int minWidth = qMax(0, m_window->windowMinimumSize().width()); - const int minHeight = qMax(0, m_window->windowMinimumSize().height()); - int maxWidth = qMax(0, m_window->windowMaximumSize().width()); - int maxHeight = qMax(0, m_window->windowMaximumSize().height()); + const QMargins margins = m_window->windowContentMargins() - m_window->clientSideMargins(); + const QSize minSize = m_window->windowMinimumSize().shrunkBy(margins); + const QSize maxSize = m_window->windowMaximumSize().shrunkBy(margins); + const int minWidth = qMax(0, minSize.width()); + const int minHeight = qMax(0, minSize.height()); + int maxWidth = qMax(0, maxSize.width()); + int maxHeight = qMax(0, maxSize.height()); if (maxWidth == QWINDOWSIZE_MAX) maxWidth = 0; if (maxHeight == QWINDOWSIZE_MAX) From 856b4352e2033afc350787bbe151ddea9f5f9eaf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Tue, 21 Nov 2023 18:29:42 +0100 Subject: [PATCH 1251/1507] Follow up handleWindowActivated -> handleFocusWindowChanged rename Change-Id: I75eeae6dfa4af8a17dffaef74f15fc87a58bcf61 Reviewed-by: David Edmundson Reviewed-by: Vlad Zahorodnii --- src/plugins/platforms/wayland/qwaylanddisplay.cpp | 2 +- src/plugins/platforms/wayland/qwaylandinputdevice.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index e5a1ed64706..4294351449d 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -958,7 +958,7 @@ void QWaylandDisplay::handleWaylandSync() // handleWindowActivated() calls immediately. QWindow *activeWindow = mActiveWindows.empty() ? nullptr : mActiveWindows.last()->window(); if (activeWindow != QGuiApplication::focusWindow()) - QWindowSystemInterface::handleWindowActivated(activeWindow); + QWindowSystemInterface::handleFocusWindowChanged(activeWindow); if (!activeWindow) { if (lastInputDevice()) { diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index aa11823ba3b..0446dff49f1 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -110,7 +110,7 @@ bool QWaylandInputDevice::Keyboard::createDefaultKeymap() QWaylandInputDevice::Keyboard::~Keyboard() { if (mFocus) - QWindowSystemInterface::handleWindowActivated(nullptr); + QWindowSystemInterface::handleFocusWindowChanged(nullptr); if (version() >= 3) wl_keyboard_release(object()); else From 669556852d68caf871f6be444a0fb713be9bab06 Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Thu, 16 Nov 2023 21:58:35 +0000 Subject: [PATCH 1252/1507] client: Use correct offset handling features for wl_surface version 5 In version 5 wl_surface_offset was introduced and requires that is used instead of passing the additional arguments to wl_surface_attach Fixes: QTBUG-119177 Change-Id: I04d7a6f89d17991a8fc536f5cca9d5d8d5418940 Reviewed-by: Inho Lee --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index b547d056b98..610cc9e50bc 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -710,8 +710,12 @@ void QWaylandWindow::attach(QWaylandBuffer *buffer, int x, int y) Q_ASSERT(!buffer->committed()); handleUpdate(); buffer->setBusy(true); - - mSurface->attach(buffer->buffer(), x, y); + if (mSurface->version() >= WL_SURFACE_OFFSET_SINCE_VERSION) { + mSurface->offset(x, y); + mSurface->attach(buffer->buffer(), 0, 0); + } else { + mSurface->attach(buffer->buffer(), x, y); + } } else { mSurface->attach(nullptr, 0, 0); } From 9dd62869942be57c6f2623d56b6c1da9a3868d0f Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Tue, 14 Nov 2023 17:46:24 +0100 Subject: [PATCH 1253/1507] CMake: replace PUBLIC_LIBRARIES with plain LIBRARIES This silences a warning from qt_internal_add_test(). Change-Id: Ie1afaa5789a488ad3190061c782a5bfb9f3d103c Reviewed-by: David Edmundson --- tests/auto/wayland/reconnect/CMakeLists.txt | 2 +- tests/auto/wayland/scaling/CMakeLists.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/auto/wayland/reconnect/CMakeLists.txt b/tests/auto/wayland/reconnect/CMakeLists.txt index aaf8c902d40..07d4c714376 100644 --- a/tests/auto/wayland/reconnect/CMakeLists.txt +++ b/tests/auto/wayland/reconnect/CMakeLists.txt @@ -6,6 +6,6 @@ qt_internal_add_test(tst_wl_reconnect SOURCES wl-socket.c tst_reconnect.cpp - PUBLIC_LIBRARIES + LIBRARIES SharedClientTest ) diff --git a/tests/auto/wayland/scaling/CMakeLists.txt b/tests/auto/wayland/scaling/CMakeLists.txt index a93f0c57464..e5898138814 100644 --- a/tests/auto/wayland/scaling/CMakeLists.txt +++ b/tests/auto/wayland/scaling/CMakeLists.txt @@ -5,6 +5,6 @@ qt_internal_add_test(tst_scaling SOURCES tst_scaling.cpp - PUBLIC_LIBRARIES + LIBRARIES SharedClientTest ) From d3fd429f82caca02dff71f77df47240def05edb2 Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Tue, 14 Nov 2023 16:19:26 +0100 Subject: [PATCH 1254/1507] Remove redundant static uint32_t QWaylandDisplay::currentTimeMillisec() Fortunately it was unused. Its 32-bit unsigned return type, measuring time in milliseconds, wraps around every 50 days. If Qt Wayland ever does need to know the current time in milliseconds, I can recommend QDateTime::currentMSecsSinceEpoch(). Change-Id: I03e70e3c7060b1e8fb82fc2e151bb187b6598b96 Reviewed-by: David Edmundson --- src/plugins/platforms/wayland/qwaylanddisplay.cpp | 10 ---------- src/plugins/platforms/wayland/qwaylanddisplay_p.h | 2 -- 2 files changed, 12 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index 4294351449d..c9de9982834 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -858,16 +858,6 @@ void QWaylandDisplay::removeListener(RegistryListener listener, void *data) mRegistryListeners.erase(iter, mRegistryListeners.end()); } -uint32_t QWaylandDisplay::currentTimeMillisec() -{ - //### we throw away the time information - struct timeval tv; - int ret = gettimeofday(&tv, nullptr); - if (ret == 0) - return tv.tv_sec*1000 + tv.tv_usec/1000; - return 0; -} - void QWaylandDisplay::forceRoundTrip() { wl_display_roundtrip(mDisplay); diff --git a/src/plugins/platforms/wayland/qwaylanddisplay_p.h b/src/plugins/platforms/wayland/qwaylanddisplay_p.h index 951a6421794..62ef71bd084 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay_p.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay_p.h @@ -226,8 +226,6 @@ public: QWaylandShm *shm() const { return mShm.data(); } - static uint32_t currentTimeMillisec(); - void forceRoundTrip(); bool supportsWindowDecoration() const; From d4220cf486802624c058fbe9a8e097b949e340d3 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Sun, 3 Dec 2023 19:12:03 +0400 Subject: [PATCH 1255/1507] Client: Fix enter event cursor position with xdg-popup and QHighDpiScaling QWindowSystemInterface::handleEnterEvent accepts device-dependent position while QCursor::pos provides device-independent position. Use QWaylandCursor::pos instead. Pick-to: 6.6 6.5 6.2 5.15 Change-Id: I70d2997610f7a34c6763bd4f10f20a65c3debdbe Reviewed-by: David Edmundson --- .../shellintegration/xdg-shell/qwaylandxdgshell.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp index 39408f94b5b..a2728bd923c 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp @@ -11,6 +11,7 @@ #include #include #include +#include #include #include @@ -235,8 +236,10 @@ QWaylandXdgSurface::Popup::~Popup() leave = m_xdgSurface->window()->window(); QWindowSystemInterface::handleLeaveEvent(leave); - if (QWindow *enter = QGuiApplication::topLevelAt(QCursor::pos())) - QWindowSystemInterface::handleEnterEvent(enter, enter->mapFromGlobal(QCursor::pos()), QCursor::pos()); + if (QWindow *enter = QGuiApplication::topLevelAt(QCursor::pos())) { + const auto pos = m_xdgSurface->window()->display()->waylandCursor()->pos(); + QWindowSystemInterface::handleEnterEvent(enter, enter->handle()->mapFromGlobal(pos), pos); + } } } @@ -590,8 +593,10 @@ void QWaylandXdgSurface::setGrabPopup(QWaylandWindow *parent, QWaylandInputDevic if (m_popup && m_popup->m_xdgSurface && m_popup->m_xdgSurface->window()) enter = m_popup->m_xdgSurface->window()->window(); - if (enter) - QWindowSystemInterface::handleEnterEvent(enter, enter->mapFromGlobal(QCursor::pos()), QCursor::pos()); + if (enter) { + const auto pos = m_popup->m_xdgSurface->window()->display()->waylandCursor()->pos(); + QWindowSystemInterface::handleEnterEvent(enter, enter->handle()->mapFromGlobal(pos), pos); + } } void QWaylandXdgSurface::xdg_surface_configure(uint32_t serial) From 1f060ee0777b496d619f9883b759eda02adfaef3 Mon Sep 17 00:00:00 2001 From: Kai Uwe Broulik Date: Mon, 13 Nov 2023 17:33:12 +0100 Subject: [PATCH 1256/1507] QWaylandMimeData: Check text/x-moz-urls for UTF-16 And fall back to UTF-8 if it's not. When dragging a picture out of Chrome, it sends a simple URL as UTF-8 under text/x-moz-urls. QXcbMime has this fall-back, too but I originally didn't consider it necessary. Pick-to: 6.6 6.5 Change-Id: I52378cfc354de342623e5dd3f7e1d028951e8dab Reviewed-by: David Edmundson --- .../platforms/wayland/qwaylanddataoffer.cpp | 33 ++++++++++----- .../wayland/datadevicev1/tst_datadevicev1.cpp | 42 +++++++++++++++++++ 2 files changed, 65 insertions(+), 10 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylanddataoffer.cpp b/src/plugins/platforms/wayland/qwaylanddataoffer.cpp index c21113a80c9..c2fc9f09513 100644 --- a/src/plugins/platforms/wayland/qwaylanddataoffer.cpp +++ b/src/plugins/platforms/wayland/qwaylanddataoffer.cpp @@ -42,20 +42,33 @@ static QByteArray convertData(const QString &originalMime, const QString &newMim // see also qtbase/src/plugins/platforms/xcb/qxcbmime.cpp if (originalMime == uriList() && newMime == mozUrl()) { if (data.size() > 1) { - const QString str = QString::fromUtf16( - reinterpret_cast(data.constData()), data.size() / 2); - if (!str.isNull()) { + const quint8 byte0 = data.at(0); + const quint8 byte1 = data.at(1); + + if ((byte0 == 0xff && byte1 == 0xfe) || (byte0 == 0xfe && byte1 == 0xff) + || (byte0 != 0 && byte1 == 0) || (byte0 == 0 && byte1 != 0)) { QByteArray converted; - const auto urls = QStringView{str}.split(u'\n'); - // Only the URL is interesting, skip the page title. - for (int i = 0; i < urls.size(); i += 2) { - const QUrl url(urls.at(i).trimmed().toString()); - if (url.isValid()) { - converted += url.toEncoded(); - converted += "\r\n"; + const QString str = QString::fromUtf16( + reinterpret_cast(data.constData()), data.size() / 2); + if (!str.isNull()) { + const auto urls = QStringView{str}.split(u'\n'); + // Only the URL is interesting, skip the page title. + for (int i = 0; i < urls.size(); i += 2) { + const QUrl url(urls.at(i).trimmed().toString()); + if (url.isValid()) { + converted += url.toEncoded(); + converted += "\r\n"; + } } } return converted; + // 8 byte encoding, remove a possible 0 at the end. + } else { + QByteArray converted = data; + if (converted.endsWith('\0')) + converted.chop(1); + converted += "\r\n"; + return converted; } } } diff --git a/tests/auto/wayland/datadevicev1/tst_datadevicev1.cpp b/tests/auto/wayland/datadevicev1/tst_datadevicev1.cpp index bb831564af0..3464d0d7861 100644 --- a/tests/auto/wayland/datadevicev1/tst_datadevicev1.cpp +++ b/tests/auto/wayland/datadevicev1/tst_datadevicev1.cpp @@ -32,6 +32,7 @@ private slots: void pasteAscii(); void pasteUtf8(); void pasteMozUrl(); + void pasteSingleUtf8MozUrl(); void destroysPreviousSelection(); void destroysSelectionWithSurface(); void destroysSelectionOnLeave(); @@ -167,6 +168,47 @@ void tst_datadevicev1::pasteMozUrl() QCOMPARE(window.m_urls.at(1), QUrl("https://www.example.com/")); } +void tst_datadevicev1::pasteSingleUtf8MozUrl() +{ + class Window : public QRasterWindow { + public: + void mousePressEvent(QMouseEvent *) override { m_urls = QGuiApplication::clipboard()->mimeData()->urls(); } + QList m_urls; + }; + + Window window; + window.resize(64, 64); + window.show(); + + QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial); + exec([&] { + auto *client = xdgSurface()->resource()->client(); + auto *offer = dataDevice()->sendDataOffer(client, {"text/x-moz-url"}); + connect(offer, &DataOffer::receive, [](QString mimeType, int fd) { + QFile file; + file.open(fd, QIODevice::WriteOnly, QFile::FileHandleFlag::AutoCloseHandle); + QCOMPARE(mimeType, "text/x-moz-url"); + const QString content("https://www.qt.io/"); + file.write(content.toUtf8()); + file.close(); + }); + dataDevice()->sendSelection(offer); + + auto *surface = xdgSurface()->m_surface; + keyboard()->sendEnter(surface); // Need to set keyboard focus according to protocol + + pointer()->sendEnter(surface, {32, 32}); + pointer()->sendFrame(client); + pointer()->sendButton(client, BTN_LEFT, 1); + pointer()->sendFrame(client); + pointer()->sendButton(client, BTN_LEFT, 0); + pointer()->sendFrame(client); + }); + + QTRY_COMPARE(window.m_urls.count(), 1); + QCOMPARE(window.m_urls.at(0), QUrl("https://www.qt.io/")); +} + void tst_datadevicev1::destroysPreviousSelection() { QRasterWindow window; From baa2104a7a3a8f763a833d3b7f3b9d6720413cce Mon Sep 17 00:00:00 2001 From: Liang Qi Date: Fri, 8 Dec 2023 11:45:30 +0100 Subject: [PATCH 1257/1507] client: implement QWaylandCursor::size() See also 78272c667f008f6afcf5f84e0add525b56c3a558 in qtbase. Fixes: QTBUG-118612 Pick-to: 6.6 6.5 Change-Id: I1cfd0c287b133c21a0ccdc5f283d9997f06fb2ed Reviewed-by: David Edmundson --- src/plugins/platforms/wayland/qwaylandcursor.cpp | 10 ++++++++++ src/plugins/platforms/wayland/qwaylandcursor_p.h | 2 ++ 2 files changed, 12 insertions(+) diff --git a/src/plugins/platforms/wayland/qwaylandcursor.cpp b/src/plugins/platforms/wayland/qwaylandcursor.cpp index 83b240ce5c7..09e2e101078 100644 --- a/src/plugins/platforms/wayland/qwaylandcursor.cpp +++ b/src/plugins/platforms/wayland/qwaylandcursor.cpp @@ -8,6 +8,9 @@ #include "qwaylandinputdevice_p.h" #include "qwaylandshmbackingstore_p.h" +#include +#include + #include #include @@ -336,6 +339,13 @@ void QWaylandCursor::setPos(const QPoint &pos) qCWarning(lcQpaWayland) << "Setting cursor position is not possible on wayland"; } +QSize QWaylandCursor::size() const +{ + if (const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme()) + return theme->themeHint(QPlatformTheme::MouseCursorSize).toSize(); + return QSize(24, 24); +} + } // namespace QtWaylandClient QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandcursor_p.h b/src/plugins/platforms/wayland/qwaylandcursor_p.h index 8f4a5b7e570..1f6d5109ed2 100644 --- a/src/plugins/platforms/wayland/qwaylandcursor_p.h +++ b/src/plugins/platforms/wayland/qwaylandcursor_p.h @@ -106,6 +106,8 @@ public: QPoint pos() const override; void setPos(const QPoint &pos) override; + QSize size() const override; + static QSharedPointer cursorBitmapBuffer(QWaylandDisplay *display, const QCursor *cursor); protected: From ca722d909b26f8284ebf1f8489913a1bd2941ad6 Mon Sep 17 00:00:00 2001 From: David Redondo Date: Wed, 6 Dec 2023 09:39:21 +0100 Subject: [PATCH 1258/1507] Adapt to QWaylandScreen being public Change-Id: I8c260ab7177011fd22db856615c8f72d6a8fabeb Reviewed-by: David Edmundson --- src/plugins/platforms/wayland/qwaylandscreen_p.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandscreen_p.h b/src/plugins/platforms/wayland/qwaylandscreen_p.h index 4bc2531f64d..7409207f331 100644 --- a/src/plugins/platforms/wayland/qwaylandscreen_p.h +++ b/src/plugins/platforms/wayland/qwaylandscreen_p.h @@ -16,7 +16,7 @@ // #include -#include +#include #include #include @@ -38,7 +38,7 @@ public: class Q_WAYLANDCLIENT_EXPORT QWaylandScreen : public QPlatformScreen, QtWayland::wl_output, QtWayland::zxdg_output_v1, - public QNativeInterface::Private::QWaylandScreen + public QNativeInterface::QWaylandScreen { public: QWaylandScreen(QWaylandDisplay *waylandDisplay, int version, uint32_t id); From ea5d6d87483189f9a6800c1df409494a6c863c8a Mon Sep 17 00:00:00 2001 From: David Redondo Date: Wed, 6 Dec 2023 14:47:49 +0100 Subject: [PATCH 1259/1507] Error out early when base was build without our native interfaces Instead of letting people run into compile errors, bail out and explain what's wrong. Change-Id: I2f2067ee07d95238e287e39ce78e73eddbca836c Reviewed-by: David Edmundson --- src/platformsupport/wayland/configure.cmake | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/platformsupport/wayland/configure.cmake b/src/platformsupport/wayland/configure.cmake index 4270e819628..4769441e54c 100644 --- a/src/platformsupport/wayland/configure.cmake +++ b/src/platformsupport/wayland/configure.cmake @@ -265,3 +265,9 @@ qt_configure_add_summary_entry(ARGS "wayland-dmabuf-server-buffer") qt_configure_add_summary_entry(ARGS "wayland-shm-emulation-server-buffer") qt_configure_add_summary_entry(ARGS "wayland-vulkan-server-buffer") qt_configure_end_summary_section() # end of "Qt Wayland Drivers" section + +qt_configure_add_report_entry( + TYPE ERROR + MESSAGE "Qt Wayland Client requires QtGui to be build with support for wayland" + CONDITION NOT QT_FEATURE_wayland AND QT_FEATURE_wayland_client +) From d338d7c9fb6a2e61173fa3e3b158277c71102e0d Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Fri, 8 Dec 2023 14:46:44 +0000 Subject: [PATCH 1260/1507] Handle subsurfaces with async configure With XDG Shell we cannot map a buffer until we get a configure event. To handle this the normal expose events is blocked then sent explicitly when we get this request. This works, but we also need to notify that subsurfaces are now exposed with the parent. Pick-to: 6.7 6.6 6.5 Fixes: QTBUG-119882 Fixes: QTBUG-119883 Change-Id: I0ae69c8da702037e7575cfc0939d3e783b50f323 Reviewed-by: Liang Qi --- .../plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp | 2 +- src/plugins/platforms/wayland/qwaylandwindow_p.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp index a2728bd923c..d1f0a9b08d5 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp @@ -606,7 +606,7 @@ void QWaylandXdgSurface::xdg_surface_configure(uint32_t serial) // We have to do the initial applyConfigure() immediately, since that is the expose. applyConfigure(); if (isExposed()) - m_window->handleExpose(QRect(QPoint(), m_window->geometry().size())); + m_window->sendRecursiveExposeEvent(); } else { // Later configures are probably resizes, so we have to queue them up for a time when we // are not painting to the window. diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index aa125e6eab4..1ed4ce79f9a 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -232,6 +232,7 @@ public: void endFrame(); void closeChildPopups(); + void sendRecursiveExposeEvent(); virtual void reinit(); void reset(); @@ -353,7 +354,6 @@ private: void handleScreensChanged(); void updateScale(); void setScale(qreal newScale); - void sendRecursiveExposeEvent(); QWaylandWindow *guessTransientParent() const; void addChildPopup(QWaylandWindow *child); From 96b9b72016483e2d496d873df8842d503ff87069 Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Thu, 16 Nov 2023 15:01:50 +0000 Subject: [PATCH 1261/1507] client: If the window minimized state is requested do not forward other states In QWindowPrivate::effectiveState if the minimize flag is requested all other states are cleared. This makes sense for the internal representation, but we do not want to send the unset maximised state across the wire. Fixes: QTBUG-119136 Pick-to: 6.7 6.6 Change-Id: I9b758c67ce11420b421a295fe3e65b68bf546027 Reviewed-by: Liang Qi --- .../xdg-shell/qwaylandxdgshell.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp index d1f0a9b08d5..57370f3595b 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp @@ -178,6 +178,15 @@ void QWaylandXdgSurface::Toplevel::requestWindowStates(Qt::WindowStates states) // Re-send what's different from the applied state Qt::WindowStates changedStates = m_applied.states ^ states; + // Minimized state is not reported by the protocol, so always send it + if (states & Qt::WindowMinimized) { + set_minimized(); + m_xdgSurface->window()->handleWindowStatesChanged(states & ~Qt::WindowMinimized); + // The internal window state whilst minimized is not maximised or fullscreen, but we don't want to + // update the compositors cached version of this state + return; + } + if (changedStates & Qt::WindowMaximized) { if (states & Qt::WindowMaximized) set_maximized(); @@ -195,11 +204,7 @@ void QWaylandXdgSurface::Toplevel::requestWindowStates(Qt::WindowStates states) unset_fullscreen(); } - // Minimized state is not reported by the protocol, so always send it - if (states & Qt::WindowMinimized) { - set_minimized(); - m_xdgSurface->window()->handleWindowStatesChanged(states & ~Qt::WindowMinimized); - } + } QtWayland::xdg_toplevel::resize_edge QWaylandXdgSurface::Toplevel::convertToResizeEdges(Qt::Edges edges) From a55d86be87c559ff971975baffe84148cc53e21a Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Thu, 2 Mar 2023 16:05:05 +0000 Subject: [PATCH 1262/1507] tests: Only track one data offer during a drag A drag consists of one data source which in turn will be represented by one data device sent to each client. We don't need to manage a list Change-Id: Icd2aba3ced1d8254d15400b0b687888b0872cc35 Pick-to: 6.7 Reviewed-by: David Edmundson --- tests/auto/wayland/shared/datadevice.cpp | 11 ++++------- tests/auto/wayland/shared/datadevice.h | 2 +- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/tests/auto/wayland/shared/datadevice.cpp b/tests/auto/wayland/shared/datadevice.cpp index 26ebec6bd2e..2a874a77faf 100644 --- a/tests/auto/wayland/shared/datadevice.cpp +++ b/tests/auto/wayland/shared/datadevice.cpp @@ -51,7 +51,7 @@ DataOffer *DataDevice::sendDataOffer(wl_client *client, const QStringList &mimeT { Q_ASSERT(client); auto *offer = new DataOffer(this, client, m_manager->m_version); - m_offers << offer; + m_offer = offer; for (auto *resource : resourceMap().values(client)) wl_data_device::send_data_offer(resource->handle, offer->resource()->handle); for (const auto &mimeType : mimeTypes) @@ -71,8 +71,8 @@ void DataDevice::sendEnter(Surface *surface, const QPoint &position) { uint serial = m_manager->m_compositor->nextSerial(); Resource *resource = resourceMap().value(surface->resource()->client()); - for (DataOffer *offer: m_offers) - wl_data_device::send_enter(resource->handle, serial, surface->resource()->handle, position.x(), position.y(), offer->resource()->handle); + if (m_offer) + wl_data_device::send_enter(resource->handle, serial, surface->resource()->handle, position.x(), position.y(), m_offer->resource()->handle); } void DataDevice::sendMotion(Surface *surface, const QPoint &position) @@ -108,10 +108,7 @@ void DataOffer::data_offer_receive(Resource *resource, const QString &mime_type, void DataOffer::data_offer_destroy(QtWaylandServer::wl_data_offer::Resource *resource) { - bool removed = m_dataDevice->m_sentSelectionOffers.removeOne(this); - if (!removed) - removed = m_dataDevice->m_offers.removeOne(this); - QVERIFY(removed); + m_dataDevice->m_sentSelectionOffers.removeOne(this); wl_resource_destroy(resource->handle); } diff --git a/tests/auto/wayland/shared/datadevice.h b/tests/auto/wayland/shared/datadevice.h index ee1e57d655d..792a3e4bb3a 100644 --- a/tests/auto/wayland/shared/datadevice.h +++ b/tests/auto/wayland/shared/datadevice.h @@ -63,7 +63,7 @@ public: DataDeviceManager *m_manager = nullptr; Seat *m_seat = nullptr; QList m_sentSelectionOffers; - QList m_offers; + QPointer m_offer; signals: void dragStarted(); From 8367c68db98163458b3a8c8b625c85b227b3cf28 Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Tue, 11 Jul 2023 13:13:47 +0100 Subject: [PATCH 1263/1507] Support TextInput V3 over v4-wip Support for v4-wip was not added into any desktop linux compositors, nor was it ever enabled into the default Qt client builds for clients or compositor. TextInputV3 has become the most widely deployed. Whilst changes are needed, they do not need to be breaking changes. A second iteration of V3 can add the features we need. This is now in motion upstream. For cases where QtWaylandCompositor is used, the custom Qt text input method is preferred to work with the Qt virtual keyboard. Pick-to: 6.7 Change-Id: I01e2686c67846804c0069f1495952b530547f91c Reviewed-by: Eskil Abrahamsen Blomfeldt --- .../wayland/protocols/qt_attribution.json | 13 +-- ...-v4-wip.xml => text-input-unstable-v3.xml} | 90 +++++++++---------- src/platformsupport/wayland/configure.cmake | 8 -- src/plugins/platforms/wayland/CMakeLists.txt | 10 +-- .../platforms/wayland/qwaylanddisplay.cpp | 47 ++++------ .../platforms/wayland/qwaylanddisplay_p.h | 10 +-- .../wayland/qwaylandinputcontext.cpp | 6 +- .../platforms/wayland/qwaylandinputdevice.cpp | 10 +-- .../platforms/wayland/qwaylandintegration.cpp | 6 +- ...extinputv4.cpp => qwaylandtextinputv3.cpp} | 68 +++++++------- ...extinputv4_p.h => qwaylandtextinputv3_p.h} | 26 +++--- .../qwaylandinputmethodeventbuilder.cpp | 50 +++++------ .../qwaylandinputmethodeventbuilder_p.h | 2 +- 13 files changed, 147 insertions(+), 199 deletions(-) rename src/3rdparty/wayland/protocols/{text-input-unstable-v4-wip.xml => text-input-unstable-v3.xml} (88%) rename src/plugins/platforms/wayland/{qwaylandtextinputv4.cpp => qwaylandtextinputv3.cpp} (82%) rename src/plugins/platforms/wayland/{qwaylandtextinputv4_p.h => qwaylandtextinputv3_p.h} (78%) diff --git a/src/3rdparty/wayland/protocols/qt_attribution.json b/src/3rdparty/wayland/protocols/qt_attribution.json index e30cb1b69c9..33a4f17c43d 100644 --- a/src/3rdparty/wayland/protocols/qt_attribution.json +++ b/src/3rdparty/wayland/protocols/qt_attribution.json @@ -119,17 +119,18 @@ }, { - "Id": "wayland-text-input-unstable-v4-wip", + "Id": "wayland-text-input-unstable-v3", "Name": "Wayland Text Input Protocol", "QDocModule": "qtwaylandcompositor", "QtUsage": "Used in the Qt Wayland Compositor, and the Qt Wayland platform plugin.", - "Files": "text-input-unstable-v4-wip.xml", + "Files": "text-input-unstable-v3.xml", "Description": "Adds support for compositors to act as input methods and send text to applications.", "Homepage": "https://wayland.freedesktop.org", - "Version": "unstable v4, WIP", - "LicenseId": "HPND", - "License": "HPND License", - "LicenseFile": "HPND_LICENSE.txt", + "Version": "unstable v3", + "DownloadLocation": "https://cgit.freedesktop.org/wayland/wayland-protocols/plain/unstable/text-input/text-input-unstable-v3.xml", + "LicenseId": "MIT", + "License": "MIT License", + "LicenseFile": "MIT_LICENSE.txt", "Copyright": "Copyright © 2012, 2013 Intel Corporation\nCopyright © 2015, 2016 Jan Arne Petersen\nCopyright © 2017, 2018 Red Hat, Inc.\nCopyright © 2018 Purism SPC" }, diff --git a/src/3rdparty/wayland/protocols/text-input-unstable-v4-wip.xml b/src/3rdparty/wayland/protocols/text-input-unstable-v3.xml similarity index 88% rename from src/3rdparty/wayland/protocols/text-input-unstable-v4-wip.xml rename to src/3rdparty/wayland/protocols/text-input-unstable-v3.xml index 1041e6f74a1..1fae54d7ba7 100644 --- a/src/3rdparty/wayland/protocols/text-input-unstable-v4-wip.xml +++ b/src/3rdparty/wayland/protocols/text-input-unstable-v3.xml @@ -1,6 +1,6 @@ - + Copyright © 2012, 2013 Intel Corporation Copyright © 2015, 2016 Jan Arne Petersen @@ -47,9 +47,9 @@ interface version number is reset. - + - The zwp_text_input_v4 interface represents text input and input methods + The zwp_text_input_v3 interface represents text input and input methods associated with a seat. It provides enter/leave events to follow the text input focus for a seat. @@ -64,9 +64,9 @@ Lengths must be measured between two valid indices. Focus moving throughout surfaces will result in the emission of - zwp_text_input_v4.enter and zwp_text_input_v4.leave events. The focused - surface must commit zwp_text_input_v4.enable and - zwp_text_input_v4.disable requests as the keyboard focus moves across + zwp_text_input_v3.enter and zwp_text_input_v3.leave events. The focused + surface must commit zwp_text_input_v3.enable and + zwp_text_input_v3.disable requests as the keyboard focus moves across editable and non-editable elements of the UI. Those two requests are not expected to be paired with each other, the compositor must be able to handle consecutive series of the same request. @@ -91,9 +91,15 @@ This request must be issued every time the active text input changes to a new one, including within the current surface. Use - zwp_text_input_v4.disable when there is no longer any input focus on + zwp_text_input_v3.disable when there is no longer any input focus on the current surface. + Clients must not enable more than one text input on the single seat + and should disable the current text input before enabling the new one. + At most one instance of text input may be in enabled state per instance, + Requests to enable the another text input when some text input is active + must be ignored by compositor. + This request resets all state associated with previous enable, disable, set_surrounding_text, set_text_change_cause, set_content_type, and set_cursor_rectangle requests, as well as the state associated with @@ -104,11 +110,11 @@ functionality. State set with this request is double-buffered. It will get applied on - the next zwp_text_input_v4.commit request, and stay valid until the + the next zwp_text_input_v3.commit request, and stay valid until the next committed enable or disable request. The changes must be applied by the compositor after issuing a - zwp_text_input_v4.commit request. + zwp_text_input_v3.commit request. @@ -118,7 +124,7 @@ there is no focus on any text entry inside the surface). State set with this request is double-buffered. It will get applied on - the next zwp_text_input_v4.commit request. + the next zwp_text_input_v3.commit request. @@ -149,7 +155,7 @@ purpose of this event. Values set with this request are double-buffered. They will get applied - on the next zwp_text_input_v4.commit request, and stay valid until the + on the next zwp_text_input_v3.commit request, and stay valid until the next committed enable or disable request. The initial state for affected fields is empty, meaning that the text @@ -182,7 +188,7 @@ cause describes the source of the change. The value set with this request is double-buffered. It must be applied - and reset to initial at the next zwp_text_input_v4.commit request. + and reset to initial at the next zwp_text_input_v3.commit request. The initial value of cause is input_method. @@ -238,7 +244,7 @@ the behavior. Values set with this request are double-buffered. They will get applied - on the next zwp_text_input_v4.commit request. + on the next zwp_text_input_v3.commit request. Subsequent attempts to update them may have no effect. The values remain valid until the next committed enable or disable request. @@ -261,7 +267,7 @@ issue this request, to signify lack of support to the compositor. Values set with this request are double-buffered. They will get applied - on the next zwp_text_input_v4.commit request, and stay valid until the + on the next zwp_text_input_v3.commit request, and stay valid until the next committed enable or disable request. The initial values describing a cursor rectangle are empty. That means @@ -298,7 +304,7 @@ Neither current nor pending state are modified unless noted otherwise. The compositor must count the number of commit requests coming from - each zwp_text_input_v4 object and use the count as the serial in done + each zwp_text_input_v3 object and use the count as the serial in done events. @@ -307,6 +313,9 @@ Notification that this seat's text-input focus is on a certain surface. + If client has created multiple text input objects, compositor must send + this event to all of them. + When the seat has the keyboard capability the text-input focus follows the keyboard focus. This event sets the current surface for the text-input object. @@ -321,7 +330,9 @@ set. The leave notification clears the current surface. It is sent before - the enter notification for the new focus. + the enter notification for the new focus. After leave event, compositor + must ignore requests from any text input instances until next enter + event. When the seat has the keyboard capability the text-input focus follows the keyboard focus. @@ -345,7 +356,7 @@ the same, or as a text highlight otherwise. Values set with this event are double-buffered. They must be applied - and reset to initial on the next zwp_text_input_v4.done event. + and reset to initial on the next zwp_text_input_v3.done event. The initial value of text is an empty string, and cursor_begin, cursor_end and cursor_hidden are all 0. @@ -362,7 +373,7 @@ result of some composing (pre-edit). Values set with this event are double-buffered. They must be applied - and reset to initial on the next zwp_text_input_v4.done event. + and reset to initial on the next zwp_text_input_v3.done event. The initial value of text is an empty string. @@ -382,7 +393,7 @@ sequence). Values set with this event are double-buffered. They must be applied - and reset to initial on the next zwp_text_input_v4.done event. + and reset to initial on the next zwp_text_input_v3.done event. The initial values of both before_length and after_length are 0. @@ -408,44 +419,23 @@ 5. Insert new preedit text in cursor position. 6. Place cursor inside preedit text. - The serial number reflects the last state of the zwp_text_input_v4 + The serial number reflects the last state of the zwp_text_input_v3 object known to the compositor. The value of the serial argument must be equal to the number of commit requests already issued on that object. + When the client receives a done event with a serial different than the - number of past commit requests, it must proceed as normal, except it - should not change the current state of the zwp_text_input_v4 object. + number of past commit requests, it must proceed with evaluating and + applying the changes as normal, except it should not change the current + state of the zwp_text_input_v3 object. All pending state requests + (set_surrounding_text, set_content_type and set_cursor_rectangle) on + the zwp_text_input_v3 object should be sent and committed after + receiving a zwp_text_input_v3.done event with a matching serial. - - - - Pre-edit commit mode when the focus widget or the cursor position - is changed. - - - - - - - - Specify how the visible preedit should be handled - when switching the focus widget or changing the cursor position, - whether to commit the preedit text or clear the preedit text. - - This is usually used together with the preedit_string event. - - The commit behavior is the same for focus switch and - cursor position change. - - The parameter mode selects the desired behavior and - its value is one from the commit mode enum. - - - - + A factory for text-input objects. This object is a global singleton. @@ -460,7 +450,7 @@ Creates a new text-input object for a given seat. - + diff --git a/src/platformsupport/wayland/configure.cmake b/src/platformsupport/wayland/configure.cmake index 4769441e54c..eda1f085019 100644 --- a/src/platformsupport/wayland/configure.cmake +++ b/src/platformsupport/wayland/configure.cmake @@ -4,9 +4,6 @@ # configure.cmake for the QtWaylandGlobalPrivate module #### Inputs -set(INPUT_wayland_text_input_v4_wip OFF CACHE BOOL "") - - #### Libraries @@ -248,12 +245,7 @@ qt_feature("wayland-vulkan-server-buffer" PRIVATE qt_feature("wayland-datadevice" PRIVATE CONDITION QT_FEATURE_draganddrop OR QT_FEATURE_clipboard ) -qt_feature("wayland-text-input-v4-wip" PRIVATE - LABEL "Qt Wayland TextInput Protocol V4(WIP)" - PURPOSE "Enables wayland_text_input_unstable_v4(wip)" -) -qt_configure_add_summary_entry(ARGS "wayland-text-input-v4-wip") qt_configure_add_summary_entry(ARGS "wayland-client") qt_configure_add_summary_entry(ARGS "wayland-server") qt_configure_add_summary_section(NAME "Qt Wayland Drivers") diff --git a/src/plugins/platforms/wayland/CMakeLists.txt b/src/plugins/platforms/wayland/CMakeLists.txt index 4fab5b3198d..67ee5c8652e 100644 --- a/src/plugins/platforms/wayland/CMakeLists.txt +++ b/src/plugins/platforms/wayland/CMakeLists.txt @@ -36,6 +36,7 @@ qt_internal_add_module(WaylandClient qwaylandinputcontext.cpp qwaylandinputcontext_p.h qwaylandtextinputv1.cpp qwaylandtextinputv1_p.h qwaylandtextinputv2.cpp qwaylandtextinputv2_p.h + qwaylandtextinputv3.cpp qwaylandtextinputv3_p.h qwaylandtextinputinterface.cpp qwaylandtextinputinterface_p.h qwaylandinputdevice.cpp qwaylandinputdevice_p.h qwaylandinputmethodcontext.cpp qwaylandinputmethodcontext_p.h @@ -87,7 +88,7 @@ qt6_generate_wayland_protocol_client_sources(WaylandClient ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/tablet-unstable-v2.xml ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/text-input-unstable-v1.xml ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/text-input-unstable-v2.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/text-input-unstable-v4-wip.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/text-input-unstable-v3.xml ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/wayland.xml ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/wp-primary-selection-unstable-v1.xml ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/xdg-output-unstable-v1.xml @@ -126,13 +127,6 @@ qt_internal_extend_target(WaylandClient CONDITION QT_FEATURE_tabletevent qwaylandtabletv2.cpp qwaylandtabletv2_p.h ) -qt_internal_extend_target(WaylandClient CONDITION QT_FEATURE_wayland_text_input_v4_wip - SOURCES - qwaylandtextinputv4.cpp qwaylandtextinputv4_p.h - DEFINES - QT_WAYLAND_TEXT_INPUT_V4_WIP=1 -) - qt_internal_extend_target(WaylandClient CONDITION QT_FEATURE_clipboard SOURCES qwaylandclipboard.cpp qwaylandclipboard_p.h diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index c9de9982834..0c73fdc3796 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -26,9 +26,7 @@ #include "qwaylandhardwareintegration_p.h" #include "qwaylandtextinputv1_p.h" #include "qwaylandtextinputv2_p.h" -#if QT_WAYLAND_TEXT_INPUT_V4_WIP -#include "qwaylandtextinputv4_p.h" -#endif // QT_WAYLAND_TEXT_INPUT_V4_WIP +#include "qwaylandtextinputv3_p.h" #include "qwaylandinputcontext_p.h" #include "qwaylandinputmethodcontext_p.h" @@ -47,7 +45,7 @@ #include #include -#include +#include #include #include #include @@ -556,15 +554,13 @@ void QWaylandDisplay::checkTextInputProtocol() { QStringList tips, timps; // for text input protocols and text input manager protocols tips << QLatin1String(QtWayland::qt_text_input_method_v1::interface()->name) + << QLatin1String(QtWayland::zwp_text_input_v3::interface()->name) << QLatin1String(QtWayland::zwp_text_input_v2::interface()->name) << QLatin1String(QtWayland::zwp_text_input_v1::interface()->name); timps << QLatin1String(QtWayland::qt_text_input_method_manager_v1::interface()->name) + << QLatin1String(QtWayland::zwp_text_input_manager_v3::interface()->name) << QLatin1String(QtWayland::zwp_text_input_manager_v2::interface()->name) << QLatin1String(QtWayland::zwp_text_input_manager_v1::interface()->name); -#if QT_WAYLAND_TEXT_INPUT_V4_WIP - tips << QLatin1String(QtWayland::zwp_text_input_v4::interface()->name); - timps << QLatin1String(QtWayland::zwp_text_input_manager_v4::interface()->name); -#endif // QT_WAYLAND_TEXT_INPUT_V4_WIP QString tiProtocols = QString::fromLocal8Bit(qgetenv("QT_WAYLAND_TEXT_INPUT_PROTOCOL")); qCDebug(lcQpaWayland) << "QT_WAYLAND_TEXT_INPUT_PROTOCOL=" << tiProtocols; @@ -656,9 +652,7 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin if (mTextInputManagerIndex < INT_MAX) { mGlobals.textInputManagerv1.reset(); mGlobals.textInputManagerv2.reset(); -#if QT_WAYLAND_TEXT_INPUT_V4_WIP - mGlobals.textInputManagerv4.reset(); -#endif // QT_WAYLAND_TEXT_INPUT_V4_WIP + mGlobals.textInputManagerv3.reset(); for (QWaylandInputDevice *inputDevice : std::as_const(mInputDevices)) inputDevice->setTextInput(nullptr); } @@ -678,9 +672,7 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin if (mTextInputManagerIndex < INT_MAX) { mGlobals.textInputMethodManager.reset(); mGlobals.textInputManagerv2.reset(); -#if QT_WAYLAND_TEXT_INPUT_V4_WIP - mGlobals.textInputManagerv4.reset(); -#endif // QT_WAYLAND_TEXT_INPUT_V4_WIP + mGlobals.textInputManagerv3.reset(); for (QWaylandInputDevice *inputDevice : std::as_const(mInputDevices)) inputDevice->setTextInputMethod(nullptr); } @@ -702,9 +694,7 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin if (mTextInputManagerIndex < INT_MAX) { mGlobals.textInputMethodManager.reset(); mGlobals.textInputManagerv1.reset(); -#if QT_WAYLAND_TEXT_INPUT_V4_WIP - mGlobals.textInputManagerv4.reset(); -#endif // QT_WAYLAND_TEXT_INPUT_V4_WIP + mGlobals.textInputManagerv3.reset(); for (QWaylandInputDevice *inputDevice : std::as_const(mInputDevices)) inputDevice->setTextInputMethod(nullptr); } @@ -716,10 +706,9 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin this, mGlobals.textInputManagerv2->get_text_input(inputDevice->wl_seat()))); mWaylandIntegration->reconfigureInputContext(); mTextInputManagerIndex = mTextInputManagerList.indexOf(interface); -#if QT_WAYLAND_TEXT_INPUT_V4_WIP - } else if (interface == QLatin1String(QtWayland::zwp_text_input_manager_v4::interface()->name) + } else if (interface == QLatin1String(QtWayland::zwp_text_input_manager_v3::interface()->name) && (mTextInputManagerList.contains(interface) && mTextInputManagerList.indexOf(interface) < mTextInputManagerIndex)) { - qCDebug(lcQpaWayland) << "text input: register zwp_text_input_v4"; + qCDebug(lcQpaWayland) << "text input: register zwp_text_input_v3"; if (mTextInputManagerIndex < INT_MAX) { mGlobals.textInputMethodManager.reset(); mGlobals.textInputManagerv2.reset(); @@ -727,15 +716,15 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin inputDevice->setTextInputMethod(nullptr); } - mGlobals.textInputManagerv4.reset( - new QtWayland::zwp_text_input_manager_v4(registry, id, 1)); + mGlobals.textInputManagerv3.reset( + new QtWayland::zwp_text_input_manager_v3(registry, id, 1)); for (QWaylandInputDevice *inputDevice : std::as_const(mInputDevices)) - inputDevice->setTextInput(new QWaylandTextInputv4( - this, mGlobals.textInputManagerv4->get_text_input(inputDevice->wl_seat()))); + inputDevice->setTextInput(new QWaylandTextInputv3( + this, mGlobals.textInputManagerv3->get_text_input(inputDevice->wl_seat()))); + mWaylandIntegration->reconfigureInputContext(); mTextInputManagerIndex = mTextInputManagerList.indexOf(interface); -#endif // QT_WAYLAND_TEXT_INPUT_V4_WIP - } else if (interface == QLatin1String(QWaylandHardwareIntegration::interface()->name)) { + }else if (interface == QLatin1String(QWaylandHardwareIntegration::interface()->name)) { bool disableHardwareIntegration = qEnvironmentVariableIntValue("QT_WAYLAND_DISABLE_HW_INTEGRATION"); if (!disableHardwareIntegration) { mGlobals.hardwareIntegration.reset(new QWaylandHardwareIntegration(registry, id)); @@ -805,14 +794,12 @@ void QWaylandDisplay::registry_global_remove(uint32_t id) inputDevice->setTextInput(nullptr); mWaylandIntegration->reconfigureInputContext(); } -#if QT_WAYLAND_TEXT_INPUT_V4_WIP - if (global.interface == QLatin1String(QtWayland::zwp_text_input_manager_v4::interface()->name)) { - mGlobals.textInputManagerv4.reset(); + if (global.interface == QLatin1String(QtWayland::zwp_text_input_manager_v3::interface()->name)) { + mGlobals.textInputManagerv3.reset(); for (QWaylandInputDevice *inputDevice : std::as_const(mInputDevices)) inputDevice->setTextInput(nullptr); mWaylandIntegration->reconfigureInputContext(); } -#endif // QT_WAYLAND_TEXT_INPUT_V4_WIP if (global.interface == QLatin1String(QtWayland::qt_text_input_method_manager_v1::interface()->name)) { mGlobals.textInputMethodManager.reset(); for (QWaylandInputDevice *inputDevice : std::as_const(mInputDevices)) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay_p.h b/src/plugins/platforms/wayland/qwaylanddisplay_p.h index 62ef71bd084..74c9aede4e9 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay_p.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay_p.h @@ -49,7 +49,7 @@ namespace QtWayland { class qt_surface_extension; class zwp_text_input_manager_v1; class zwp_text_input_manager_v2; - class zwp_text_input_manager_v4; + class zwp_text_input_manager_v3; class qt_text_input_method_manager_v1; class wp_cursor_shape_manager_v1; class wp_fractional_scale_manager_v1; @@ -176,9 +176,9 @@ public: { return mGlobals.textInputManagerv2.get(); } - QtWayland::zwp_text_input_manager_v4 *textInputManagerv4() const + QtWayland::zwp_text_input_manager_v3 *textInputManagerv3() const { - return mGlobals.textInputManagerv4.get(); + return mGlobals.textInputManagerv3.get(); } QWaylandHardwareIntegration *hardwareIntegration() const { @@ -205,6 +205,7 @@ public: return mGlobals.xdgToplevelDragManager.get(); } + struct RegistryGlobal { uint32_t id; QString interface; @@ -329,7 +330,7 @@ private: std::unique_ptr textInputMethodManager; std::unique_ptr textInputManagerv1; std::unique_ptr textInputManagerv2; - std::unique_ptr textInputManagerv4; + std::unique_ptr textInputManagerv3; std::unique_ptr hardwareIntegration; std::unique_ptr xdgOutputManager; std::unique_ptr viewporter; @@ -337,7 +338,6 @@ private: std::unique_ptr cursorShapeManager; std::unique_ptr xdgToplevelDragManager; } mGlobals; - int mFd = -1; int mWritableNotificationFd = -1; QList mRegistryGlobals; diff --git a/src/plugins/platforms/wayland/qwaylandinputcontext.cpp b/src/plugins/platforms/wayland/qwaylandinputcontext.cpp index 369a4e5c281..4b6a34c6bf5 100644 --- a/src/plugins/platforms/wayland/qwaylandinputcontext.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputcontext.cpp @@ -35,11 +35,7 @@ QWaylandInputContext::~QWaylandInputContext() bool QWaylandInputContext::isValid() const { -#if QT_WAYLAND_TEXT_INPUT_V4_WIP - return mDisplay->textInputManagerv2() != nullptr || mDisplay->textInputManagerv1() != nullptr || mDisplay->textInputManagerv4() != nullptr; -#else // QT_WAYLAND_TEXT_INPUT_V4_WIP - return mDisplay->textInputManagerv2() != nullptr || mDisplay->textInputManagerv1() != nullptr; -#endif // QT_WAYLAND_TEXT_INPUT_V4_WIP + return mDisplay->textInputManagerv2() != nullptr || mDisplay->textInputManagerv1() != nullptr || mDisplay->textInputManagerv3() != nullptr; } void QWaylandInputContext::reset() diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index 0446dff49f1..f52789fdc0b 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -4,6 +4,7 @@ #include "qwaylandinputdevice_p.h" #include "qwaylandintegration_p.h" +#include "qwaylandtextinputv3_p.h" #include "qwaylandwindow_p.h" #include "qwaylandsurface_p.h" #include "qwaylandbuffer_p.h" @@ -25,9 +26,6 @@ #include "qwaylandshmbackingstore_p.h" #include "qwaylandtextinputv1_p.h" #include "qwaylandtextinputv2_p.h" -#if QT_WAYLAND_TEXT_INPUT_V4_WIP -#include "qwaylandtextinputv4_p.h" -#endif // QT_WAYLAND_TEXT_INPUT_V4_WIP #include "qwaylandtextinputinterface_p.h" #include "qwaylandinputcontext_p.h" #include "qwaylandinputmethodcontext_p.h" @@ -408,10 +406,8 @@ QWaylandInputDevice::QWaylandInputDevice(QWaylandDisplay *display, int version, if (mQDisplay->textInputManagerv2()) mTextInput.reset(new QWaylandTextInputv2(mQDisplay, mQDisplay->textInputManagerv2()->get_text_input(wl_seat()))); -#if QT_WAYLAND_TEXT_INPUT_V4_WIP - if (mQDisplay->textInputManagerv4()) - mTextInput.reset(new QWaylandTextInputv4(mQDisplay, mQDisplay->textInputManagerv4()->get_text_input(wl_seat()))); -#endif // QT_WAYLAND_TEXT_INPUT_V4_WIP + if (mQDisplay->textInputManagerv3()) + mTextInput.reset(new QWaylandTextInputv3(mQDisplay, mQDisplay->textInputManagerv3()->get_text_input(wl_seat()))); if (mQDisplay->textInputMethodManager()) mTextInputMethod.reset(new QWaylandTextInputMethod(mQDisplay, mQDisplay->textInputMethodManager()->get_text_input_method(wl_seat()))); diff --git a/src/plugins/platforms/wayland/qwaylandintegration.cpp b/src/plugins/platforms/wayland/qwaylandintegration.cpp index 88a2fa7e1ac..846556d4eda 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandintegration.cpp @@ -470,11 +470,7 @@ void QWaylandIntegration::reconfigureInputContext() if (!mDisplay->isClientSideInputContextRequested()) { if (mDisplay->textInputMethodManager() != nullptr) mInputContext.reset(new QWaylandInputMethodContext(mDisplay.data())); -#if QT_WAYLAND_TEXT_INPUT_V4_WIP - else if (mDisplay->textInputManagerv1() != nullptr || mDisplay->textInputManagerv2() != nullptr || mDisplay->textInputManagerv4() != nullptr) -#else // QT_WAYLAND_TEXT_INPUT_V4_WIP - else if (mDisplay->textInputManagerv1() != nullptr || mDisplay->textInputManagerv2() != nullptr) -#endif // QT_WAYLAND_TEXT_INPUT_V4_WIP + else if (mDisplay->textInputManagerv1() != nullptr || mDisplay->textInputManagerv2() != nullptr || mDisplay->textInputManagerv3() != nullptr) mInputContext.reset(new QWaylandInputContext(mDisplay.data())); } else { mInputContext.reset(QPlatformInputContextFactory::create(requested)); diff --git a/src/plugins/platforms/wayland/qwaylandtextinputv4.cpp b/src/plugins/platforms/wayland/qwaylandtextinputv3.cpp similarity index 82% rename from src/plugins/platforms/wayland/qwaylandtextinputv4.cpp rename to src/plugins/platforms/wayland/qwaylandtextinputv3.cpp index 6cf01613f13..a369cac67e3 100644 --- a/src/plugins/platforms/wayland/qwaylandtextinputv4.cpp +++ b/src/plugins/platforms/wayland/qwaylandtextinputv3.cpp @@ -1,7 +1,7 @@ // Copyright (C) 2021 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only -#include "qwaylandtextinputv4_p.h" +#include "qwaylandtextinputv3_p.h" #include "qwaylandwindow_p.h" #include "qwaylandinputmethodeventbuilder_p.h" @@ -18,20 +18,20 @@ Q_LOGGING_CATEGORY(qLcQpaWaylandTextInput, "qt.qpa.wayland.textinput") namespace QtWaylandClient { -QWaylandTextInputv4::QWaylandTextInputv4(QWaylandDisplay *display, - struct ::zwp_text_input_v4 *text_input) - : QtWayland::zwp_text_input_v4(text_input) +QWaylandTextInputv3::QWaylandTextInputv3(QWaylandDisplay *display, + struct ::zwp_text_input_v3 *text_input) + : QtWayland::zwp_text_input_v3(text_input) , m_display(display) { } -QWaylandTextInputv4::~QWaylandTextInputv4() +QWaylandTextInputv3::~QWaylandTextInputv3() { } namespace { -const Qt::InputMethodQueries supportedQueries4 = Qt::ImEnabled | +const Qt::InputMethodQueries supportedQueries3 = Qt::ImEnabled | Qt::ImSurroundingText | Qt::ImCursorPosition | Qt::ImAnchorPosition | @@ -39,7 +39,7 @@ const Qt::InputMethodQueries supportedQueries4 = Qt::ImEnabled | Qt::ImCursorRectangle; } -void QWaylandTextInputv4::zwp_text_input_v4_enter(struct ::wl_surface *surface) +void QWaylandTextInputv3::zwp_text_input_v3_enter(struct ::wl_surface *surface) { qCDebug(qLcQpaWaylandTextInput) << Q_FUNC_INFO; @@ -51,10 +51,10 @@ void QWaylandTextInputv4::zwp_text_input_v4_enter(struct ::wl_surface *surface) m_pendingDeleteAfterText = 0; enable(); - updateState(supportedQueries4, update_state_enter); + updateState(supportedQueries3, update_state_enter); } -void QWaylandTextInputv4::zwp_text_input_v4_leave(struct ::wl_surface *surface) +void QWaylandTextInputv3::zwp_text_input_v3_leave(struct ::wl_surface *surface) { qCDebug(qLcQpaWaylandTextInput) << Q_FUNC_INFO; @@ -63,10 +63,6 @@ void QWaylandTextInputv4::zwp_text_input_v4_leave(struct ::wl_surface *surface) return; } - // QTBUG-97248: check commit_mode - // Currently text-input-unstable-v4-wip is implemented with preedit_commit_mode - // 'commit' - m_currentPreeditString.clear(); m_surface = nullptr; @@ -76,7 +72,7 @@ void QWaylandTextInputv4::zwp_text_input_v4_leave(struct ::wl_surface *surface) qCDebug(qLcQpaWaylandTextInput) << Q_FUNC_INFO << "Done"; } -void QWaylandTextInputv4::zwp_text_input_v4_preedit_string(const QString &text, int32_t cursorBegin, int32_t cursorEnd) +void QWaylandTextInputv3::zwp_text_input_v3_preedit_string(const QString &text, int32_t cursorBegin, int32_t cursorEnd) { qCDebug(qLcQpaWaylandTextInput) << Q_FUNC_INFO << text << cursorBegin << cursorEnd; @@ -88,7 +84,7 @@ void QWaylandTextInputv4::zwp_text_input_v4_preedit_string(const QString &text, m_pendingPreeditString.cursorEnd = cursorEnd; } -void QWaylandTextInputv4::zwp_text_input_v4_commit_string(const QString &text) +void QWaylandTextInputv3::zwp_text_input_v3_commit_string(const QString &text) { qCDebug(qLcQpaWaylandTextInput) << Q_FUNC_INFO << text; @@ -98,7 +94,7 @@ void QWaylandTextInputv4::zwp_text_input_v4_commit_string(const QString &text) m_pendingCommitString = text; } -void QWaylandTextInputv4::zwp_text_input_v4_delete_surrounding_text(uint32_t beforeText, uint32_t afterText) +void QWaylandTextInputv3::zwp_text_input_v3_delete_surrounding_text(uint32_t beforeText, uint32_t afterText) { qCDebug(qLcQpaWaylandTextInput) << Q_FUNC_INFO << beforeText << afterText; @@ -109,12 +105,12 @@ void QWaylandTextInputv4::zwp_text_input_v4_delete_surrounding_text(uint32_t bef m_pendingDeleteAfterText = QWaylandInputMethodEventBuilder::indexFromWayland(m_surroundingText, afterText); } -void QWaylandTextInputv4::zwp_text_input_v4_done(uint32_t serial) +void QWaylandTextInputv3::zwp_text_input_v3_done(uint32_t serial) { qCDebug(qLcQpaWaylandTextInput) << Q_FUNC_INFO << "with serial" << serial << m_currentSerial; // This is a case of double click. - // text_input_v4 will ignore this done signal and just keep the selection of the clicked word. + // text_input_v3 will ignore this done signal and just keep the selection of the clicked word. if (m_cursorPos != m_anchorPos && (m_pendingDeleteBeforeText != 0 || m_pendingDeleteAfterText != 0)) { qCDebug(qLcQpaWaylandTextInput) << Q_FUNC_INFO << "Ignore done"; m_pendingDeleteBeforeText = 0; @@ -177,22 +173,22 @@ void QWaylandTextInputv4::zwp_text_input_v4_done(uint32_t serial) QCoreApplication::sendEvent(focusObject, &event); if (serial == m_currentSerial) - updateState(supportedQueries4, update_state_full); + updateState(supportedQueries3, update_state_full); } -void QWaylandTextInputv4::reset() +void QWaylandTextInputv3::reset() { qCDebug(qLcQpaWaylandTextInput) << Q_FUNC_INFO; m_pendingPreeditString.clear(); } -void QWaylandTextInputv4::enableSurface(::wl_surface *) +void QWaylandTextInputv3::enableSurface(::wl_surface *) { qCDebug(qLcQpaWaylandTextInput) << Q_FUNC_INFO; } -void QWaylandTextInputv4::disableSurface(::wl_surface *surface) +void QWaylandTextInputv3::disableSurface(::wl_surface *surface) { qCDebug(qLcQpaWaylandTextInput) << Q_FUNC_INFO; @@ -202,15 +198,15 @@ void QWaylandTextInputv4::disableSurface(::wl_surface *surface) } } -void QWaylandTextInputv4::commit() +void QWaylandTextInputv3::commit() { m_currentSerial = (m_currentSerial < UINT_MAX) ? m_currentSerial + 1U: 0U; qCDebug(qLcQpaWaylandTextInput) << Q_FUNC_INFO << "with serial" << m_currentSerial; - QtWayland::zwp_text_input_v4::commit(); + QtWayland::zwp_text_input_v3::commit(); } -void QWaylandTextInputv4::updateState(Qt::InputMethodQueries queries, uint32_t flags) +void QWaylandTextInputv3::updateState(Qt::InputMethodQueries queries, uint32_t flags) { qCDebug(qLcQpaWaylandTextInput) << Q_FUNC_INFO << queries << flags; @@ -225,7 +221,7 @@ void QWaylandTextInputv4::updateState(Qt::InputMethodQueries queries, uint32_t f if (!surface || (surface != m_surface)) return; - queries &= supportedQueries4; + queries &= supportedQueries3; bool needsCommit = false; QInputMethodQueryEvent event(queries); @@ -319,7 +315,7 @@ void QWaylandTextInputv4::updateState(Qt::InputMethodQueries queries, uint32_t f } if (queries & Qt::ImHints) { - QWaylandInputMethodContentType contentType = QWaylandInputMethodContentType::convertV4(static_cast(event.value(Qt::ImHints).toInt())); + QWaylandInputMethodContentType contentType = QWaylandInputMethodContentType::convertV3(static_cast(event.value(Qt::ImHints).toInt())); qCDebug(qLcQpaWaylandTextInput) << m_contentHint << contentType.hint; qCDebug(qLcQpaWaylandTextInput) << m_contentPurpose << contentType.purpose; @@ -338,33 +334,33 @@ void QWaylandTextInputv4::updateState(Qt::InputMethodQueries queries, uint32_t f commit(); } -void QWaylandTextInputv4::setCursorInsidePreedit(int cursor) +void QWaylandTextInputv3::setCursorInsidePreedit(int cursor) { Q_UNUSED(cursor); - qCWarning(qLcQpaWaylandTextInput) << "QWaylandTextInputV4: Input protocol \"text-input-unstable-v4-wip\" does not support setting cursor inside preedit. Use qt-text-input-method-unstable-v1 instead for full support of Qt input method events."; + qCWarning(qLcQpaWaylandTextInput) << "QWaylandTextInputV3: Input protocol \"text-input-unstable-v3\" does not support setting cursor inside preedit. Use qt-text-input-method-unstable-v1 instead for full support of Qt input method events."; } -bool QWaylandTextInputv4::isInputPanelVisible() const +bool QWaylandTextInputv3::isInputPanelVisible() const { - qCWarning(qLcQpaWaylandTextInput) << "QWaylandTextInputV4: Input protocol \"text-input-unstable-v4-wip\" does not support querying input method visibility. Use qt-text-input-method-unstable-v1 instead for full support of Qt input method events."; + qCWarning(qLcQpaWaylandTextInput) << "QWaylandTextInputV3: Input protocol \"text-input-unstable-v3\" does not support querying input method visibility. Use qt-text-input-method-unstable-v1 instead for full support of Qt input method events."; return false; } -QRectF QWaylandTextInputv4::keyboardRect() const +QRectF QWaylandTextInputv3::keyboardRect() const { qCDebug(qLcQpaWaylandTextInput) << Q_FUNC_INFO; return m_cursorRect; } -QLocale QWaylandTextInputv4::locale() const +QLocale QWaylandTextInputv3::locale() const { - qCWarning(qLcQpaWaylandTextInput) << "QWaylandTextInputV4: Input protocol \"text-input-unstable-v4-wip\" does not support querying input language. Use qt-text-input-method-unstable-v1 instead for full support of Qt input method events."; + qCWarning(qLcQpaWaylandTextInput) << "QWaylandTextInputV3: Input protocol \"text-input-unstable-v3\" does not support querying input language. Use qt-text-input-method-unstable-v1 instead for full support of Qt input method events."; return QLocale(); } -Qt::LayoutDirection QWaylandTextInputv4::inputDirection() const +Qt::LayoutDirection QWaylandTextInputv3::inputDirection() const { - qCWarning(qLcQpaWaylandTextInput) << "QWaylandTextInputV4: Input protocol \"text-input-unstable-v4-wip\" does not support querying input direction. Use qt-text-input-method-unstable-v1 instead for full support of Qt input method events."; + qCWarning(qLcQpaWaylandTextInput) << "QWaylandTextInputV3: Input protocol \"text-input-unstable-v3\" does not support querying input direction. Use qt-text-input-method-unstable-v1 instead for full support of Qt input method events."; return Qt::LeftToRight; } diff --git a/src/plugins/platforms/wayland/qwaylandtextinputv4_p.h b/src/plugins/platforms/wayland/qwaylandtextinputv3_p.h similarity index 78% rename from src/plugins/platforms/wayland/qwaylandtextinputv4_p.h rename to src/plugins/platforms/wayland/qwaylandtextinputv3_p.h index 2f4263ebaf4..8c5b93b9be5 100644 --- a/src/plugins/platforms/wayland/qwaylandtextinputv4_p.h +++ b/src/plugins/platforms/wayland/qwaylandtextinputv3_p.h @@ -1,8 +1,8 @@ // Copyright (C) 2021 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only -#ifndef QWAYLANDTEXTINPUTV4_P_H -#define QWAYLANDTEXTINPUTV4_P_H +#ifndef QWAYLANDTEXTINPUTV3_P_H +#define QWAYLANDTEXTINPUTV3_P_H // // W A R N I N G @@ -16,7 +16,7 @@ // #include "qwaylandtextinputinterface_p.h" -#include +#include #include #include @@ -31,11 +31,11 @@ namespace QtWaylandClient { class QWaylandDisplay; -class QWaylandTextInputv4 : public QtWayland::zwp_text_input_v4, public QWaylandTextInputInterface +class QWaylandTextInputv3 : public QtWayland::zwp_text_input_v3, public QWaylandTextInputInterface { public: - QWaylandTextInputv4(QWaylandDisplay *display, struct ::zwp_text_input_v4 *text_input); - ~QWaylandTextInputv4() override; + QWaylandTextInputv3(QWaylandDisplay *display, struct ::zwp_text_input_v3 *text_input); + ~QWaylandTextInputv3() override; void reset() override; void commit() override; @@ -53,12 +53,12 @@ public: void disableSurface(::wl_surface *surface) override; protected: - void zwp_text_input_v4_enter(struct ::wl_surface *surface) override; - void zwp_text_input_v4_leave(struct ::wl_surface *surface) override; - void zwp_text_input_v4_preedit_string(const QString &text, int32_t cursor_begin, int32_t cursor_end) override; - void zwp_text_input_v4_commit_string(const QString &text) override; - void zwp_text_input_v4_delete_surrounding_text(uint32_t before_length, uint32_t after_length) override; - void zwp_text_input_v4_done(uint32_t serial) override; + void zwp_text_input_v3_enter(struct ::wl_surface *surface) override; + void zwp_text_input_v3_leave(struct ::wl_surface *surface) override; + void zwp_text_input_v3_preedit_string(const QString &text, int32_t cursor_begin, int32_t cursor_end) override; + void zwp_text_input_v3_commit_string(const QString &text) override; + void zwp_text_input_v3_delete_surrounding_text(uint32_t before_length, uint32_t after_length) override; + void zwp_text_input_v3_done(uint32_t serial) override; private: QWaylandDisplay *m_display; @@ -101,4 +101,4 @@ private: QT_END_NAMESPACE -#endif // QWAYLANDTEXTINPUTV4_P_H +#endif // QWAYLANDTEXTINPUTV3_P_H diff --git a/src/plugins/platforms/wayland/shared/qwaylandinputmethodeventbuilder.cpp b/src/plugins/platforms/wayland/shared/qwaylandinputmethodeventbuilder.cpp index f0758bf7037..0f07a69580e 100644 --- a/src/plugins/platforms/wayland/shared/qwaylandinputmethodeventbuilder.cpp +++ b/src/plugins/platforms/wayland/shared/qwaylandinputmethodeventbuilder.cpp @@ -11,10 +11,10 @@ #ifdef QT_BUILD_WAYLANDCOMPOSITOR_LIB #include -#include +#include #else #include -#include +#include #endif QT_BEGIN_NAMESPACE @@ -218,55 +218,55 @@ QWaylandInputMethodContentType QWaylandInputMethodContentType::convert(Qt::Input return QWaylandInputMethodContentType{hint, purpose}; } -QWaylandInputMethodContentType QWaylandInputMethodContentType::convertV4(Qt::InputMethodHints hints) +QWaylandInputMethodContentType QWaylandInputMethodContentType::convertV3(Qt::InputMethodHints hints) { - uint32_t hint = ZWP_TEXT_INPUT_V4_CONTENT_HINT_NONE; - uint32_t purpose = ZWP_TEXT_INPUT_V4_CONTENT_PURPOSE_NORMAL; + uint32_t hint = ZWP_TEXT_INPUT_V3_CONTENT_HINT_NONE; + uint32_t purpose = ZWP_TEXT_INPUT_V3_CONTENT_PURPOSE_NORMAL; if (hints & Qt::ImhHiddenText) - hint |= ZWP_TEXT_INPUT_V4_CONTENT_HINT_HIDDEN_TEXT; + hint |= ZWP_TEXT_INPUT_V3_CONTENT_HINT_HIDDEN_TEXT; if (hints & Qt::ImhSensitiveData) - hint |= ZWP_TEXT_INPUT_V4_CONTENT_HINT_SENSITIVE_DATA; + hint |= ZWP_TEXT_INPUT_V3_CONTENT_HINT_SENSITIVE_DATA; if ((hints & Qt::ImhNoAutoUppercase) == 0) - hint |= ZWP_TEXT_INPUT_V4_CONTENT_HINT_AUTO_CAPITALIZATION; + hint |= ZWP_TEXT_INPUT_V3_CONTENT_HINT_AUTO_CAPITALIZATION; if (hints & Qt::ImhPreferNumbers) { // Nothing yet } if (hints & Qt::ImhPreferUppercase) - hint |= ZWP_TEXT_INPUT_V4_CONTENT_HINT_UPPERCASE; + hint |= ZWP_TEXT_INPUT_V3_CONTENT_HINT_UPPERCASE; if (hints & Qt::ImhPreferLowercase) - hint |= ZWP_TEXT_INPUT_V4_CONTENT_HINT_LOWERCASE; + hint |= ZWP_TEXT_INPUT_V3_CONTENT_HINT_LOWERCASE; if ((hints & Qt::ImhNoPredictiveText) == 0) { - hint |= (ZWP_TEXT_INPUT_V4_CONTENT_HINT_COMPLETION - | ZWP_TEXT_INPUT_V4_CONTENT_HINT_SPELLCHECK); + hint |= (ZWP_TEXT_INPUT_V3_CONTENT_HINT_COMPLETION + | ZWP_TEXT_INPUT_V3_CONTENT_HINT_SPELLCHECK); } if ((hints & Qt::ImhDate) && (hints & Qt::ImhTime) == 0) - purpose = ZWP_TEXT_INPUT_V4_CONTENT_PURPOSE_DATE; + purpose = ZWP_TEXT_INPUT_V3_CONTENT_PURPOSE_DATE; else if ((hints & Qt::ImhDate) && (hints & Qt::ImhTime)) - purpose = ZWP_TEXT_INPUT_V4_CONTENT_PURPOSE_DATETIME; + purpose = ZWP_TEXT_INPUT_V3_CONTENT_PURPOSE_DATETIME; else if ((hints & Qt::ImhDate) == 0 && (hints & Qt::ImhTime)) - purpose = ZWP_TEXT_INPUT_V4_CONTENT_PURPOSE_TIME; + purpose = ZWP_TEXT_INPUT_V3_CONTENT_PURPOSE_TIME; if (hints & Qt::ImhPreferLatin) - hint |= ZWP_TEXT_INPUT_V4_CONTENT_HINT_LATIN; + hint |= ZWP_TEXT_INPUT_V3_CONTENT_HINT_LATIN; if (hints & Qt::ImhMultiLine) - hint |= ZWP_TEXT_INPUT_V4_CONTENT_HINT_MULTILINE; + hint |= ZWP_TEXT_INPUT_V3_CONTENT_HINT_MULTILINE; if (hints & Qt::ImhDigitsOnly) - purpose = ZWP_TEXT_INPUT_V4_CONTENT_PURPOSE_DIGITS; + purpose = ZWP_TEXT_INPUT_V3_CONTENT_PURPOSE_DIGITS; if (hints & Qt::ImhFormattedNumbersOnly) - purpose = ZWP_TEXT_INPUT_V4_CONTENT_PURPOSE_NUMBER; + purpose = ZWP_TEXT_INPUT_V3_CONTENT_PURPOSE_NUMBER; if (hints & Qt::ImhUppercaseOnly) - hint |= ZWP_TEXT_INPUT_V4_CONTENT_HINT_UPPERCASE; + hint |= ZWP_TEXT_INPUT_V3_CONTENT_HINT_UPPERCASE; if (hints & Qt::ImhLowercaseOnly) - hint |= ZWP_TEXT_INPUT_V4_CONTENT_HINT_LOWERCASE; + hint |= ZWP_TEXT_INPUT_V3_CONTENT_HINT_LOWERCASE; if (hints & Qt::ImhDialableCharactersOnly) - purpose = ZWP_TEXT_INPUT_V4_CONTENT_PURPOSE_PHONE; + purpose = ZWP_TEXT_INPUT_V3_CONTENT_PURPOSE_PHONE; if (hints & Qt::ImhEmailCharactersOnly) - purpose = ZWP_TEXT_INPUT_V4_CONTENT_PURPOSE_EMAIL; + purpose = ZWP_TEXT_INPUT_V3_CONTENT_PURPOSE_EMAIL; if (hints & Qt::ImhUrlCharactersOnly) - purpose = ZWP_TEXT_INPUT_V4_CONTENT_PURPOSE_URL; + purpose = ZWP_TEXT_INPUT_V3_CONTENT_PURPOSE_URL; if (hints & Qt::ImhLatinOnly) - hint |= ZWP_TEXT_INPUT_V4_CONTENT_HINT_LATIN; + hint |= ZWP_TEXT_INPUT_V3_CONTENT_HINT_LATIN; return QWaylandInputMethodContentType{hint, purpose}; } diff --git a/src/plugins/platforms/wayland/shared/qwaylandinputmethodeventbuilder_p.h b/src/plugins/platforms/wayland/shared/qwaylandinputmethodeventbuilder_p.h index 1ccfa11a26b..6926dac56c3 100644 --- a/src/plugins/platforms/wayland/shared/qwaylandinputmethodeventbuilder_p.h +++ b/src/plugins/platforms/wayland/shared/qwaylandinputmethodeventbuilder_p.h @@ -47,7 +47,7 @@ struct QWaylandInputMethodContentType { uint32_t purpose = 0; static QWaylandInputMethodContentType convert(Qt::InputMethodHints hints); - static QWaylandInputMethodContentType convertV4(Qt::InputMethodHints hints); + static QWaylandInputMethodContentType convertV3(Qt::InputMethodHints hints); }; From 2136cedfff03fa701afc05439a7e65b0c65ca69c Mon Sep 17 00:00:00 2001 From: Kai Uwe Broulik Date: Thu, 14 Dec 2023 12:49:17 +0100 Subject: [PATCH 1264/1507] QWaylandCursor: Set appropriate shape for drag cursors Even if the compositor is free to do whatever during a drag, the client can still set a proper cursor. The codepath without cursor-shape also doesn't special case them. Pick-to: 6.7 6.6 Change-Id: Ib6b9864d8024ff2919471d6f2d12f9ba8e2e512d Reviewed-by: David Edmundson Reviewed-by: Vlad Zahorodnii --- src/plugins/platforms/wayland/qwaylandcursor.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandcursor.cpp b/src/plugins/platforms/wayland/qwaylandcursor.cpp index 09e2e101078..e7464ed8f9a 100644 --- a/src/plugins/platforms/wayland/qwaylandcursor.cpp +++ b/src/plugins/platforms/wayland/qwaylandcursor.cpp @@ -267,11 +267,11 @@ static QtWayland::wp_cursor_shape_device_v1::shape qtCursorShapeToWaylandShape(Q case Qt::ClosedHandCursor: return wp_cursor_shape_device_v1::shape_grabbing; case Qt::DragMoveCursor: + return wp_cursor_shape_device_v1::shape_move; case Qt::DragCopyCursor: + return wp_cursor_shape_device_v1::shape_copy; case Qt::DragLinkCursor: - // drags on wayland are different, the compositor knows - // the drag type and can do something custom - return wp_cursor_shape_device_v1::shape_grab; + return wp_cursor_shape_device_v1::shape_alias; } return wp_cursor_shape_device_v1::shape_default; } From d3a6c1e9ea03eefeb8ed04cb5790b7bfc0acb8c8 Mon Sep 17 00:00:00 2001 From: Nicolas Fella Date: Sun, 17 Dec 2023 14:14:56 +0100 Subject: [PATCH 1265/1507] Remove inactionable warnings suggesting qt-text-input-method-unstable-v1 These warnings can appear several times during the program execution, spamming the log. They are also inactionable for desktop use cases, since qt-text-input-method-unstable-v1 is not a protocol implemented by any desktop compositor. Fixes: QTBUG-120171 Pick-to: 6.7 Change-Id: Icd5316000b43e4b16e1eaff9efcc0c363458b9af Reviewed-by: Volker Hilsheimer --- src/plugins/platforms/wayland/qwaylandtextinputv3.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandtextinputv3.cpp b/src/plugins/platforms/wayland/qwaylandtextinputv3.cpp index a369cac67e3..a9023a655e1 100644 --- a/src/plugins/platforms/wayland/qwaylandtextinputv3.cpp +++ b/src/plugins/platforms/wayland/qwaylandtextinputv3.cpp @@ -337,12 +337,10 @@ void QWaylandTextInputv3::updateState(Qt::InputMethodQueries queries, uint32_t f void QWaylandTextInputv3::setCursorInsidePreedit(int cursor) { Q_UNUSED(cursor); - qCWarning(qLcQpaWaylandTextInput) << "QWaylandTextInputV3: Input protocol \"text-input-unstable-v3\" does not support setting cursor inside preedit. Use qt-text-input-method-unstable-v1 instead for full support of Qt input method events."; } bool QWaylandTextInputv3::isInputPanelVisible() const { - qCWarning(qLcQpaWaylandTextInput) << "QWaylandTextInputV3: Input protocol \"text-input-unstable-v3\" does not support querying input method visibility. Use qt-text-input-method-unstable-v1 instead for full support of Qt input method events."; return false; } @@ -354,13 +352,11 @@ QRectF QWaylandTextInputv3::keyboardRect() const QLocale QWaylandTextInputv3::locale() const { - qCWarning(qLcQpaWaylandTextInput) << "QWaylandTextInputV3: Input protocol \"text-input-unstable-v3\" does not support querying input language. Use qt-text-input-method-unstable-v1 instead for full support of Qt input method events."; return QLocale(); } Qt::LayoutDirection QWaylandTextInputv3::inputDirection() const { - qCWarning(qLcQpaWaylandTextInput) << "QWaylandTextInputV3: Input protocol \"text-input-unstable-v3\" does not support querying input direction. Use qt-text-input-method-unstable-v1 instead for full support of Qt input method events."; return Qt::LeftToRight; } From c7c22eaacdc79d5e5b76c61a60df5c3cca801bef Mon Sep 17 00:00:00 2001 From: Kai Uwe Broulik Date: Fri, 1 Dec 2023 19:23:00 +0100 Subject: [PATCH 1266/1507] Don't use Qt keywords in headers Unfortunately for many Wayland features applications need to access Qt private headers which will fail if the project is built with QT_NO_KEYWORDS. Ideally, the examples and tests were ported, too, and QT_NO_KEYWORDS enabled in .cmakec.conf. Pick-to: 6.7 Change-Id: I9f988d304bcc8dba4dd84761c41ba3da2473515d Reviewed-by: Volker Hilsheimer --- src/plugins/platforms/wayland/qwaylanddisplay_p.h | 4 ++-- src/plugins/platforms/wayland/qwaylandinputdevice_p.h | 4 ++-- .../platforms/wayland/qwaylandprimaryselectionv1_p.h | 2 +- src/plugins/platforms/wayland/qwaylandsurface_p.h | 4 ++-- src/plugins/platforms/wayland/qwaylandwindow_p.h | 6 +++--- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay_p.h b/src/plugins/platforms/wayland/qwaylanddisplay_p.h index 74c9aede4e9..868811cca3f 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay_p.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay_p.h @@ -249,11 +249,11 @@ public: void initEventThread(); -public slots: +public Q_SLOTS: void blockingReadEvents(); void flushRequests(); -signals: +Q_SIGNALS: void reconnected(); void globalAdded(const RegistryGlobal &global); void globalRemoved(const RegistryGlobal &global); diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h index 4051cf898c9..67bfb9afd85 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h +++ b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h @@ -258,7 +258,7 @@ public: } #endif -private slots: +private Q_SLOTS: void handleFocusDestroyed(); void handleFocusLost(); @@ -314,7 +314,7 @@ protected: void pointer_axis_value120(uint32_t axis, int32_t value120) override; void pointer_axis_relative_direction(uint32_t axis, uint32_t direction) override; -private slots: +private Q_SLOTS: void handleFocusDestroyed() { invalidateFocus(); } private: diff --git a/src/plugins/platforms/wayland/qwaylandprimaryselectionv1_p.h b/src/plugins/platforms/wayland/qwaylandprimaryselectionv1_p.h index 59bb62116a9..3591f0623d7 100644 --- a/src/plugins/platforms/wayland/qwaylandprimaryselectionv1_p.h +++ b/src/plugins/platforms/wayland/qwaylandprimaryselectionv1_p.h @@ -69,7 +69,7 @@ public: QMimeData *mimeData() const { return m_mimeData; } -signals: +Q_SIGNALS: void cancelled(); protected: diff --git a/src/plugins/platforms/wayland/qwaylandsurface_p.h b/src/plugins/platforms/wayland/qwaylandsurface_p.h index 657f4ad436e..41860297e62 100644 --- a/src/plugins/platforms/wayland/qwaylandsurface_p.h +++ b/src/plugins/platforms/wayland/qwaylandsurface_p.h @@ -41,12 +41,12 @@ public: static QWaylandSurface *fromWlSurface(::wl_surface *surface); -signals: +Q_SIGNALS: void screensChanged(); void preferredBufferScaleChanged(); void preferredBufferTransformChanged(); -private slots: +private Q_SLOTS: void handleScreenRemoved(QScreen *qScreen); protected: diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index 1ed4ce79f9a..8957f7aef3a 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -237,10 +237,10 @@ public: virtual void reinit(); void reset(); -public slots: +public Q_SLOTS: void applyConfigure(); -signals: +Q_SIGNALS: void wlSurfaceCreated(); void wlSurfaceDestroyed(); @@ -335,7 +335,7 @@ protected: Qt::ScreenOrientation mLastReportedContentOrientation = Qt::PrimaryOrientation; -private slots: +private Q_SLOTS: void doApplyConfigureFromOtherThread(); private: From 8013130a7bcaba7b6bab61e777c7f2b25afe6492 Mon Sep 17 00:00:00 2001 From: Kai Uwe Broulik Date: Mon, 13 Nov 2023 17:38:38 +0100 Subject: [PATCH 1267/1507] QWaylandMimeData: Skip "DELETE" format This is presumably a left-over from XDND: https://freedesktop.org/wiki/Specifications/XDND/ > In general, XdndActionMove is implemented by first requesting the data > and then the special target DELETE defined in the X Selection > protocol. [...] DELETE should be sent before XdndFinished. Firefox sends this during dragging of files but trying to fetch it will fail, leading to a timeout and potential freeze. Pick-to: 6.7 6.6 6.5 Change-Id: Ic30f5cb23587c63d54859c5eaebb3a054a25ac69 Reviewed-by: Liang Qi --- src/plugins/platforms/wayland/qwaylanddataoffer.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylanddataoffer.cpp b/src/plugins/platforms/wayland/qwaylanddataoffer.cpp index c2fc9f09513..94cd249fa31 100644 --- a/src/plugins/platforms/wayland/qwaylanddataoffer.cpp +++ b/src/plugins/platforms/wayland/qwaylanddataoffer.cpp @@ -149,8 +149,11 @@ QWaylandMimeData::~QWaylandMimeData() void QWaylandMimeData::appendFormat(const QString &mimeType) { - m_types << mimeType; - m_data.remove(mimeType); // Clear previous contents + // "DELETE" is a potential leftover from XdndActionMode sent by e.g. Firefox, ignore it. + if (mimeType != QLatin1String("DELETE")) { + m_types << mimeType; + m_data.remove(mimeType); // Clear previous contents + } } bool QWaylandMimeData::hasFormat_sys(const QString &mimeType) const From d13a29182801fad6398e13c0fcdcabff949c7d6c Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Fri, 15 Dec 2023 08:57:47 +0000 Subject: [PATCH 1268/1507] client: Clean up text input proxy object in textinputv2 This not only cleans up a tiny amount of memory, but also fixes a potential crash if a wayland event were to arrive on the object after the Qt level wrapper is destroyed. Pick-to: 6.5 6.6 6.7 Change-Id: I6fafdd848d61da893304c4467a57b52d3771c508 Reviewed-by: Liang Qi --- src/plugins/platforms/wayland/qwaylandtextinputv2.cpp | 1 + tests/auto/wayland/shared/textinput.cpp | 3 +-- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandtextinputv2.cpp b/src/plugins/platforms/wayland/qwaylandtextinputv2.cpp index a799793e5b8..89a8a6d77d7 100644 --- a/src/plugins/platforms/wayland/qwaylandtextinputv2.cpp +++ b/src/plugins/platforms/wayland/qwaylandtextinputv2.cpp @@ -46,6 +46,7 @@ QWaylandTextInputv2::~QWaylandTextInputv2() { if (m_resetCallback) wl_callback_destroy(m_resetCallback); + destroy(); } void QWaylandTextInputv2::reset() diff --git a/tests/auto/wayland/shared/textinput.cpp b/tests/auto/wayland/shared/textinput.cpp index 05889687c00..ee7e9ff9b29 100644 --- a/tests/auto/wayland/shared/textinput.cpp +++ b/tests/auto/wayland/shared/textinput.cpp @@ -12,9 +12,8 @@ TextInputManager::TextInputManager(CoreCompositor *compositor) void TextInputManager::zwp_text_input_manager_v2_get_text_input(Resource *resource, uint32_t id, wl_resource *seatResource) { - Q_UNUSED(resource); - Q_UNUSED(id); Q_UNUSED(seatResource); + add(resource->client(), id, resource->version()); } } // namespace MockCompositor From 89dff9764a2ae8832503ed34b5e2b5561da1e4cc Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Fri, 15 Dec 2023 08:58:15 +0000 Subject: [PATCH 1269/1507] client: Clean up text input proxy object in textinputv3 This not only cleans up a tiny amount of memory, but also fixes a potential crash if a wayland event were to arrive on the object after the Qt level wrapper is destroyed. Pick-to: 6.7 Change-Id: Id1c768b1f846925579220784e4312cede4efd095 Reviewed-by: Liang Qi Reviewed-by: David Redondo --- src/plugins/platforms/wayland/qwaylandtextinputv3.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/plugins/platforms/wayland/qwaylandtextinputv3.cpp b/src/plugins/platforms/wayland/qwaylandtextinputv3.cpp index a9023a655e1..ad43ff1bc09 100644 --- a/src/plugins/platforms/wayland/qwaylandtextinputv3.cpp +++ b/src/plugins/platforms/wayland/qwaylandtextinputv3.cpp @@ -28,6 +28,7 @@ QWaylandTextInputv3::QWaylandTextInputv3(QWaylandDisplay *display, QWaylandTextInputv3::~QWaylandTextInputv3() { + destroy(); } namespace { From 84aed4465ee951b60c334eee4a58ab1fb28301d7 Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Wed, 13 Dec 2023 09:45:05 +0000 Subject: [PATCH 1270/1507] client: Do not constrain clients to size hints The behavior of constraining requests from the system to the client requested size does not appear to be in other backends. It was added to QWayland before xdg-shell/qt-shell existed with hints that can be supplied to the window manager. This is important as the specification states that maximized windows must follow the geometry requested and there is some movement towards this applying for all tiled states. Task-number: QTBUG-120035 Pick-to: 6.7 Change-Id: I7c203db18e34a8f81a39c504591f6b54df076da8 Reviewed-by: Paul Olav Tvete --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 610cc9e50bc..a03878b570c 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -398,17 +398,7 @@ QRect QWaylandWindow::defaultGeometry() const void QWaylandWindow::setGeometry_helper(const QRect &rect) { - QSize minimum = windowMinimumSize(); - QSize maximum = windowMaximumSize(); - int width = windowGeometry().width(); - int height = windowGeometry().height(); - if (minimum.width() <= maximum.width() - && minimum.height() <= maximum.height()) { - width = qBound(minimum.width(), rect.width(), maximum.width()); - height = qBound(minimum.height(), rect.height(), maximum.height()); - } - - QPlatformWindow::setGeometry(QRect(rect.x(), rect.y(), width, height)); + QPlatformWindow::setGeometry(rect); if (mViewport) updateViewport(); From 5829719cc07361f9237ee21572c888ab8dfcba87 Mon Sep 17 00:00:00 2001 From: Kai Uwe Broulik Date: Thu, 4 Jan 2024 19:13:15 +0100 Subject: [PATCH 1271/1507] bradient: Use "Size" instead of "Split" cursors for resizing SizeVerCursor: "A cursor used for elements that are used to vertically resize top-level windows." SizeHorCursor: "A cursor used for elements that are used to horizontally resize top-level windows." Pick-to: 6.7 6.6 6.5 Change-Id: Ib780269120aa373cd9fcf84826683cccd1dc4f4d Reviewed-by: David Edmundson --- .../platforms/wayland/plugins/decorations/bradient/main.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp b/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp index 5da0e85f4cc..0049c1ed44a 100644 --- a/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp +++ b/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp @@ -370,7 +370,7 @@ void QWaylandBradientDecoration::processPointerBottom(QWaylandInputDevice *input //bottom bit #if QT_CONFIG(cursor) if (type == PointerType::Mouse) - waylandWindow()->setMouseCursor(inputDevice, Qt::SplitVCursor); + waylandWindow()->setMouseCursor(inputDevice, Qt::SizeVerCursor); #endif startResize(inputDevice, Qt::BottomEdge, b); } @@ -386,7 +386,7 @@ void QWaylandBradientDecoration::processPointerLeft(QWaylandInputDevice *inputDe Q_UNUSED(mods); #if QT_CONFIG(cursor) if (type == PointerType::Mouse) - waylandWindow()->setMouseCursor(inputDevice, Qt::SplitHCursor); + waylandWindow()->setMouseCursor(inputDevice, Qt::SizeHorCursor); #else Q_UNUSED(type); #endif @@ -403,7 +403,7 @@ void QWaylandBradientDecoration::processPointerRight(QWaylandInputDevice *inputD Q_UNUSED(mods); #if QT_CONFIG(cursor) if (type == PointerType::Mouse) - waylandWindow()->setMouseCursor(inputDevice, Qt::SplitHCursor); + waylandWindow()->setMouseCursor(inputDevice, Qt::SizeHorCursor); #else Q_UNUSED(type); #endif From de1deab0594c7e6a0a512dd8d8e1e38bc72e0164 Mon Sep 17 00:00:00 2001 From: Rob Hall Date: Sun, 24 Dec 2023 21:46:48 +0000 Subject: [PATCH 1272/1507] client: Fix window margin calculation Don't subtract the size of the window frame margin from the content area. Fixes an issue where an area of the window is unclickable when client-side decorations are in use. Fixes: QTBUG-120392 Pick-to: 6.7 6.6 6.5 Change-Id: I6a89b2d463be084233ea3448cacfbbd09d66b96e Reviewed-by: David Edmundson Reviewed-by: Kai Uwe Broulik --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index a03878b570c..3980f4efe2e 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -1350,8 +1350,8 @@ void QWaylandWindow::handleMouseEventWithDecoration(QWaylandInputDevice *inputDe QMargins marg = frameMargins(); QRect windowRect(0 + marg.left(), 0 + marg.top(), - geometry().size().width() - marg.right(), - geometry().size().height() - marg.bottom()); + geometry().size().width(), + geometry().size().height()); if (windowRect.contains(e.local.toPoint()) || mMousePressedInContentArea != Qt::NoButton) { const QPointF localTranslated = mapFromWlSurface(e.local); QPointF globalTranslated = e.global; From 68ddc184fd47278ddc0632a742339c148c6101ce Mon Sep 17 00:00:00 2001 From: Kai Uwe Broulik Date: Mon, 1 Jan 2024 11:51:45 +0100 Subject: [PATCH 1273/1507] QWaylandWindow: Reset input region on window reset Amends 349cb9eb and fixes the input region (and thus Qt::WindowTransparentForInput) not working on subsequent shows. Pick-to: 6.7 6.6 Change-Id: Ie160aa0b2c13e6858b31ad98866a8689dfbad149 Reviewed-by: David Edmundson --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 3980f4efe2e..323c4e4df72 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -319,6 +319,9 @@ void QWaylandWindow::reset() mOpaqueArea = QRegion(); mMask = QRegion(); + mInputRegion = QRegion(); + mTransparentInputRegion = false; + if (mQueuedBuffer) { mQueuedBuffer->setBusy(false); } From c928425852d5a0d41c869443ad72ca5facbf50d3 Mon Sep 17 00:00:00 2001 From: Kai Uwe Broulik Date: Mon, 1 Jan 2024 18:14:39 +0100 Subject: [PATCH 1274/1507] QWaylandShmBackingStore: Preserve buffer contents between frames Doing a memcpy is quite expensive, particularly when only a small region of the buffer (such as a blinking cursor) actually changed. Instead, keep track of the damaged region and paint only what actually changed into the buffer to be used. Change-Id: Ibd81bbfe20d0750ddb751f41722a316387225ba6 Reviewed-by: David Edmundson --- .../wayland/qwaylandshmbackingstore.cpp | 48 +++++++++++++++++-- .../wayland/qwaylandshmbackingstore_p.h | 4 ++ 2 files changed, 49 insertions(+), 3 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp b/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp index 02d830ad860..ffd17ce89fe 100644 --- a/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp +++ b/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp @@ -47,6 +47,7 @@ namespace QtWaylandClient { QWaylandShmBuffer::QWaylandShmBuffer(QWaylandDisplay *display, const QSize &size, QImage::Format format, qreal scale) + : mDirtyRegion(QRect(QPoint(0, 0), size / scale)) { int stride = size.width() * 4; int alloc = stride * size.height(); @@ -166,11 +167,24 @@ QPaintDevice *QWaylandShmBackingStore::paintDevice() return contentSurface(); } +void QWaylandShmBackingStore::updateDirtyStates(const QRegion ®ion) +{ + // Update dirty state of buffers based on what was painted. The back buffer will + // not be dirty since we already painted on it, while other buffers will become dirty. + for (QWaylandShmBuffer *b : std::as_const(mBuffers)) { + if (b != mBackBuffer) + b->dirtyRegion() += region; + } +} + void QWaylandShmBackingStore::beginPaint(const QRegion ®ion) { mPainting = true; ensureSize(); + const QMargins margins = windowDecorationMargins(); + updateDirtyStates(region.translated(margins.left(), margins.top())); + if (mBackBuffer->image()->hasAlphaChannel()) { QPainter p(paintDevice()); p.setCompositionMode(QPainter::CompositionMode_Source); @@ -263,7 +277,7 @@ void QWaylandShmBackingStore::resize(const QSize &size) QSize sizeWithMargins = (size + QSize(margins.left()+margins.right(),margins.top()+margins.bottom())) * scale; // We look for a free buffer to draw into. If the buffer is not the last buffer we used, - // that is mBackBuffer, and the size is the same we memcpy the old content into the new + // that is mBackBuffer, and the size is the same we copy the damaged content into the new // buffer so that QPainter is happy to find the stuff it had drawn before. If the new // buffer has a different size it needs to be redrawn completely anyway, and if the buffer // is the same the stuff is there already. @@ -282,8 +296,27 @@ void QWaylandShmBackingStore::resize(const QSize &size) qsizetype newSizeInBytes = buffer->image()->sizeInBytes(); // mBackBuffer may have been deleted here but if so it means its size was different so we wouldn't copy it anyway - if (mBackBuffer != buffer && oldSizeInBytes == newSizeInBytes) - memcpy(buffer->image()->bits(), mBackBuffer->image()->constBits(), newSizeInBytes); + if (mBackBuffer != buffer && oldSizeInBytes == newSizeInBytes) { + Q_ASSERT(mBackBuffer); + const QImage *sourceImage = mBackBuffer->image(); + QImage *targetImage = buffer->image(); + + QPainter painter(targetImage); + painter.setCompositionMode(QPainter::CompositionMode_Source); + + // Let painter operate in device pixels, to make it easier to compare coordinates + const qreal sourceDevicePixelRatio = sourceImage->devicePixelRatio(); + const qreal targetDevicePixelRatio = painter.device()->devicePixelRatio(); + painter.scale(1.0 / targetDevicePixelRatio, 1.0 / targetDevicePixelRatio); + + for (const QRect &rect : buffer->dirtyRegion()) { + QRectF sourceRect(QPointF(rect.topLeft()) * sourceDevicePixelRatio, + QSizeF(rect.size()) * sourceDevicePixelRatio); + QRectF targetRect(QPointF(rect.topLeft()) * targetDevicePixelRatio, + QSizeF(rect.size()) * targetDevicePixelRatio); + painter.drawImage(targetRect, *sourceImage, sourceRect); + } + } mBackBuffer = buffer; @@ -296,6 +329,8 @@ void QWaylandShmBackingStore::resize(const QSize &size) if (windowDecoration() && window()->isVisible() && oldSizeInBytes != newSizeInBytes) windowDecoration()->update(); + + buffer->dirtyRegion() = QRegion(); } QImage *QWaylandShmBackingStore::entireSurface() const @@ -320,6 +355,7 @@ void QWaylandShmBackingStore::updateDecorations() QTransform sourceMatrix; sourceMatrix.scale(dp, dp); QRect target; // needs to be in device independent pixels + QRegion dirtyRegion; //Top target.setX(0); @@ -327,16 +363,19 @@ void QWaylandShmBackingStore::updateDecorations() target.setWidth(dpWidth); target.setHeight(windowDecorationMargins().top()); decorationPainter.drawImage(target, sourceImage, sourceMatrix.mapRect(target)); + dirtyRegion += target; //Left target.setWidth(windowDecorationMargins().left()); target.setHeight(dpHeight); decorationPainter.drawImage(target, sourceImage, sourceMatrix.mapRect(target)); + dirtyRegion += target; //Right target.setX(dpWidth - windowDecorationMargins().right()); target.setWidth(windowDecorationMargins().right()); decorationPainter.drawImage(target, sourceImage, sourceMatrix.mapRect(target)); + dirtyRegion += target; //Bottom target.setX(0); @@ -344,6 +383,9 @@ void QWaylandShmBackingStore::updateDecorations() target.setWidth(dpWidth); target.setHeight(windowDecorationMargins().bottom()); decorationPainter.drawImage(target, sourceImage, sourceMatrix.mapRect(target)); + dirtyRegion += target; + + updateDirtyStates(dirtyRegion); } QWaylandAbstractDecoration *QWaylandShmBackingStore::windowDecoration() const diff --git a/src/plugins/platforms/wayland/qwaylandshmbackingstore_p.h b/src/plugins/platforms/wayland/qwaylandshmbackingstore_p.h index 8a63b3c1423..8c7b83dbb48 100644 --- a/src/plugins/platforms/wayland/qwaylandshmbackingstore_p.h +++ b/src/plugins/platforms/wayland/qwaylandshmbackingstore_p.h @@ -42,11 +42,14 @@ public: QImage *image() { return &mImage; } QImage *imageInsideMargins(const QMargins &margins); + + QRegion &dirtyRegion() { return mDirtyRegion; } private: QImage mImage; struct wl_shm_pool *mShmPool = nullptr; QMargins mMargins; QImage *mMarginsImage = nullptr; + QRegion mDirtyRegion; }; class Q_WAYLANDCLIENT_EXPORT QWaylandShmBackingStore : public QPlatformBackingStore @@ -77,6 +80,7 @@ public: #endif private: + void updateDirtyStates(const QRegion ®ion); void updateDecorations(); QWaylandShmBuffer *getBuffer(const QSize &size); From 4e3fc377adb3a769f7df7bdd0bac2bc7a0fb6b39 Mon Sep 17 00:00:00 2001 From: Kai Uwe Broulik Date: Thu, 4 Jan 2024 21:05:27 +0100 Subject: [PATCH 1275/1507] bradient: Don't cache decoration colors Reading them from QPalette on the fly is pretty negligible. Easily ensures that the palette renders with correct colors when the color scheme changes. Pick-to: 6.7 6.6 6.5 Change-Id: I469fa2f32889a7841a3d4c4c8d11e1abf50ae66f Reviewed-by: David Edmundson --- .../plugins/decorations/bradient/main.cpp | 21 ++++++++----------- 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp b/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp index 0049c1ed44a..b11a10af0a3 100644 --- a/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp +++ b/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp @@ -57,9 +57,6 @@ private: QRectF maximizeButtonRect() const; QRectF minimizeButtonRect() const; - QColor m_foregroundColor; - QColor m_foregroundInactiveColor; - QColor m_backgroundColor; QStaticText m_windowTitle; Button m_clicking = None; }; @@ -68,11 +65,6 @@ private: QWaylandBradientDecoration::QWaylandBradientDecoration() { - QPalette palette; - m_foregroundColor = palette.color(QPalette::Active, QPalette::WindowText); - m_backgroundColor = palette.color(QPalette::Active, QPalette::Window); - m_foregroundInactiveColor = palette.color(QPalette::Disabled, QPalette::WindowText); - QTextOption option(Qt::AlignHCenter | Qt::AlignVCenter); option.setWrapMode(QTextOption::NoWrap); m_windowTitle.setTextOption(option); @@ -121,6 +113,11 @@ void QWaylandBradientDecoration::paint(QPaintDevice *device) QRect top = clips[0]; + QPalette palette; + const QColor foregroundColor = palette.color(QPalette::Active, QPalette::WindowText); + const QColor backgroundColor = palette.color(QPalette::Active, QPalette::Window); + const QColor foregroundInactiveColor = palette.color(QPalette::Disabled, QPalette::WindowText); + QPainter p(device); p.setRenderHint(QPainter::Antialiasing); @@ -130,7 +127,7 @@ void QWaylandBradientDecoration::paint(QPaintDevice *device) for (int i = 0; i < 4; ++i) { p.save(); p.setClipRect(clips[i]); - p.fillPath(roundedRect, m_backgroundColor); + p.fillPath(roundedRect, backgroundColor); p.restore(); } @@ -158,7 +155,7 @@ void QWaylandBradientDecoration::paint(QPaintDevice *device) p.save(); p.setClipRect(titleBar); - p.setPen(active ? m_foregroundColor : m_foregroundInactiveColor); + p.setPen(active ? foregroundColor : foregroundInactiveColor); QSizeF size = m_windowTitle.size(); int dx = (top.width() - size.width()) /2; int dy = (top.height()- size.height()) /2; @@ -174,7 +171,7 @@ void QWaylandBradientDecoration::paint(QPaintDevice *device) QRectF rect; // Default pen - QPen pen(active ? m_foregroundColor : m_foregroundInactiveColor); + QPen pen(active ? foregroundColor : foregroundInactiveColor); p.setPen(pen); // Close button @@ -198,7 +195,7 @@ void QWaylandBradientDecoration::paint(QPaintDevice *device) QRectF rect1 = rect.adjusted(inset, 0, 0, -inset); QRectF rect2 = rect.adjusted(0, inset, -inset, 0); p.drawRect(rect1); - p.setBrush(m_backgroundColor); // need to cover up some lines from the other rect + p.setBrush(backgroundColor); // need to cover up some lines from the other rect p.drawRect(rect2); } else { p.drawRect(rect); From 033bb3903a17d77dac9d847e2ebd4c4d1b05d839 Mon Sep 17 00:00:00 2001 From: Kai Uwe Broulik Date: Fri, 20 Oct 2023 14:22:15 +0200 Subject: [PATCH 1276/1507] QWaylandScreen: Implement subpixelAntialiasingTypeHint It isn't really used anywhere yet, since on Unix QFontconfigDatabase doesn't use the screen's information. Pick-to: 6.7 6.6 6.5 Change-Id: Icab81b2bf8df1a23223a74f2d4aee94601e0bea3 Reviewed-by: David Edmundson --- .../platforms/wayland/qwaylandscreen.cpp | 29 +++++++++++++++++-- .../platforms/wayland/qwaylandscreen_p.h | 3 ++ 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandscreen.cpp b/src/plugins/platforms/wayland/qwaylandscreen.cpp index 64fd55c0cb5..ea109c8f5b8 100644 --- a/src/plugins/platforms/wayland/qwaylandscreen.cpp +++ b/src/plugins/platforms/wayland/qwaylandscreen.cpp @@ -190,6 +190,32 @@ QPlatformCursor *QWaylandScreen::cursor() const } #endif // QT_CONFIG(cursor) +QPlatformScreen::SubpixelAntialiasingType QWaylandScreen::subpixelAntialiasingTypeHint() const +{ + QPlatformScreen::SubpixelAntialiasingType type = QPlatformScreen::subpixelAntialiasingTypeHint(); + if (type == QPlatformScreen::Subpixel_None) { + switch (mSubpixel) { + case wl_output::subpixel_unknown: + case wl_output::subpixel_none: + type = QPlatformScreen::Subpixel_None; + break; + case wl_output::subpixel_horizontal_rgb: + type = QPlatformScreen::Subpixel_RGB; + break; + case wl_output::subpixel_horizontal_bgr: + type = QPlatformScreen::Subpixel_BGR; + break; + case wl_output::subpixel_vertical_rgb: + type = QPlatformScreen::Subpixel_VRGB; + break; + case wl_output::subpixel_vertical_bgr: + type = QPlatformScreen::Subpixel_VBGR; + break; + } + } + return type; +} + QWaylandScreen *QWaylandScreen::waylandScreenFromWindow(QWindow *window) { QPlatformScreen *platformScreen = QPlatformScreen::platformScreenForWindow(window); @@ -254,11 +280,10 @@ void QWaylandScreen::output_geometry(int32_t x, int32_t y, const QString &model, int32_t transform) { - Q_UNUSED(subpixel); - mManufacturer = make; mModel = model; + mSubpixel = subpixel; mTransform = transform; mPhysicalSize = QSize(width, height); diff --git a/src/plugins/platforms/wayland/qwaylandscreen_p.h b/src/plugins/platforms/wayland/qwaylandscreen_p.h index 7409207f331..a56e56f1903 100644 --- a/src/plugins/platforms/wayland/qwaylandscreen_p.h +++ b/src/plugins/platforms/wayland/qwaylandscreen_p.h @@ -73,6 +73,8 @@ public: QPlatformCursor *cursor() const override; #endif + SubpixelAntialiasingType subpixelAntialiasingTypeHint() const override; + uint32_t outputId() const { return m_outputId; } ::wl_output *output() const override { @@ -120,6 +122,7 @@ protected: int mScale = 1; int mDepth = 32; int mRefreshRate = 60000; + int mSubpixel = -1; int mTransform = -1; QImage::Format mFormat = QImage::Format_ARGB32_Premultiplied; QSize mPhysicalSize; From b7723f14e65a2e631ade1f0bb73d35a703376b9e Mon Sep 17 00:00:00 2001 From: Kai Uwe Broulik Date: Mon, 8 Jan 2024 18:30:46 +0100 Subject: [PATCH 1277/1507] bradient: Explicitly set Qt::PlainText textFormat Otherwise a window title containing HTML tags can mess up the layout. Pick-to: 6.7 6.6 6.5 Change-Id: I7bd4abd2e0caa92cbb08c0eb46acba737126c913 Reviewed-by: David Edmundson --- .../platforms/wayland/plugins/decorations/bradient/main.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp b/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp index b11a10af0a3..3fcf09ea554 100644 --- a/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp +++ b/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp @@ -68,6 +68,7 @@ QWaylandBradientDecoration::QWaylandBradientDecoration() QTextOption option(Qt::AlignHCenter | Qt::AlignVCenter); option.setWrapMode(QTextOption::NoWrap); m_windowTitle.setTextOption(option); + m_windowTitle.setTextFormat(Qt::PlainText); } QRectF QWaylandBradientDecoration::closeButtonRect() const From cc5d649c983813755f89c98d79556ef0668d7301 Mon Sep 17 00:00:00 2001 From: Kai Uwe Broulik Date: Thu, 4 Jan 2024 20:30:33 +0100 Subject: [PATCH 1278/1507] bradient: Use QWaylandWindow actual window title It may include a suffix containing the application name and is also what's set on the XDG Toplevel, i.e. what the rest of the environment (task switcher, etc) sees. This stores the title in QWaylandWindow and adds a getter to retrieve it. Pick-to: 6.7 Change-Id: I84f41c68b16b680cdbb5cf656c7078d1e41767d4 Reviewed-by: David Edmundson --- .../plugins/decorations/bradient/main.cpp | 2 +- .../platforms/wayland/qwaylandwindow.cpp | 35 +++++++++++-------- .../platforms/wayland/qwaylandwindow_p.h | 2 ++ 3 files changed, 24 insertions(+), 15 deletions(-) diff --git a/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp b/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp index 3fcf09ea554..7f1b78c101d 100644 --- a/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp +++ b/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp @@ -142,7 +142,7 @@ void QWaylandBradientDecoration::paint(QPaintDevice *device) } // Window title - QString windowTitleText = window()->title(); + QString windowTitleText = waylandWindow()->windowTitle(); if (!windowTitleText.isEmpty()) { if (m_windowTitle.text() != windowTitleText) { m_windowTitle.setText(windowTitleText); diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 323c4e4df72..a6c0b97b797 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -362,26 +362,33 @@ void QWaylandWindow::setParent(const QPlatformWindow *parent) } } +QString QWaylandWindow::windowTitle() const +{ + return mWindowTitle; +} + void QWaylandWindow::setWindowTitle(const QString &title) { - if (mShellSurface) { - const QString separator = QString::fromUtf8(" \xe2\x80\x94 "); // unicode character U+2014, EM DASH - const QString formatted = formatWindowTitle(title, separator); + const QString separator = QString::fromUtf8(" \xe2\x80\x94 "); // unicode character U+2014, EM DASH + const QString formatted = formatWindowTitle(title, separator); - const int libwaylandMaxBufferSize = 4096; - // Some parts of the buffer is used for metadata, so subtract 100 to be on the safe side. - // Also, QString is in utf-16, which means that in the worst case each character will be - // three bytes when converted to utf-8 (which is what libwayland uses), so divide by three. - const int maxLength = libwaylandMaxBufferSize / 3 - 100; + const int libwaylandMaxBufferSize = 4096; + // Some parts of the buffer is used for metadata, so subtract 100 to be on the safe side. + // Also, QString is in utf-16, which means that in the worst case each character will be + // three bytes when converted to utf-8 (which is what libwayland uses), so divide by three. + const int maxLength = libwaylandMaxBufferSize / 3 - 100; - auto truncated = QStringView{formatted}.left(maxLength); - if (truncated.size() < formatted.size()) { - qCWarning(lcQpaWayland) << "Window titles longer than" << maxLength << "characters are not supported." - << "Truncating window title (from" << formatted.size() << "chars)"; - } - mShellSurface->setTitle(truncated.toString()); + auto truncated = QStringView{formatted}.left(maxLength); + if (truncated.size() < formatted.size()) { + qCWarning(lcQpaWayland) << "Window titles longer than" << maxLength << "characters are not supported." + << "Truncating window title (from" << formatted.size() << "chars)"; } + mWindowTitle = truncated.toString(); + + if (mShellSurface) + mShellSurface->setTitle(mWindowTitle); + if (mWindowDecorationEnabled && window()->isVisible()) mWindowDecoration->update(); } diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index 8957f7aef3a..2f6d2921bba 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -93,6 +93,7 @@ public: void setVisible(bool visible) override; void setParent(const QPlatformWindow *parent) override; + QString windowTitle() const; void setWindowTitle(const QString &title) override; inline QIcon windowIcon() const; @@ -311,6 +312,7 @@ protected: qreal mScale = 1; QPlatformScreen *mLastReportedScreen = nullptr; + QString mWindowTitle; QIcon mWindowIcon; Qt::WindowFlags mFlags; From f1df592c96f36724a5f18665b480bb82840b67ac Mon Sep 17 00:00:00 2001 From: Kai Uwe Broulik Date: Thu, 4 Jan 2024 21:02:33 +0100 Subject: [PATCH 1279/1507] QWaylandWindow: Update decoration when application palette/font changes Ensures the decoration can redraw to adjust for the new colors/font. Pick-to: 6.7 6.6 6.5 Change-Id: Ib46acde1d14baafda49f379f8279c396bc976bdc Reviewed-by: David Edmundson --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 11 +++++++++++ src/plugins/platforms/wayland/qwaylandwindow_p.h | 2 ++ 2 files changed, 13 insertions(+) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index a6c0b97b797..b34e448b67a 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -1788,6 +1788,17 @@ void QWaylandWindow::reinit() } } +bool QWaylandWindow::windowEvent(QEvent *event) +{ + if (event->type() == QEvent::ApplicationPaletteChange + || event->type() == QEvent::ApplicationFontChange) { + if (mWindowDecorationEnabled && window()->isVisible()) + mWindowDecoration->update(); + } + + return QPlatformWindow::windowEvent(event); +} + } QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index 2f6d2921bba..c2815cb8e55 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -238,6 +238,8 @@ public: virtual void reinit(); void reset(); + bool windowEvent(QEvent *event) override; + public Q_SLOTS: void applyConfigure(); From b19408d0692a9ca426b2014d84a2d568d9f281b2 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Sat, 6 Jan 2024 23:15:05 +0400 Subject: [PATCH 1280/1507] client: Fix text-input set_cursor_rectangle coordinates They should be converted to native ones and shouldn't contain server-side decorations Pick-to: 6.7 6.6 6.5 Change-Id: Ia701edc22b68bec2fa46e95d7a812621142dcde0 Reviewed-by: David Edmundson --- src/plugins/platforms/wayland/qwaylandtextinputv1.cpp | 6 ++++-- src/plugins/platforms/wayland/qwaylandtextinputv2.cpp | 6 ++++-- src/plugins/platforms/wayland/qwaylandtextinputv3.cpp | 6 ++++-- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandtextinputv1.cpp b/src/plugins/platforms/wayland/qwaylandtextinputv1.cpp index da8bbae71b8..3b45322b13e 100644 --- a/src/plugins/platforms/wayland/qwaylandtextinputv1.cpp +++ b/src/plugins/platforms/wayland/qwaylandtextinputv1.cpp @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include @@ -127,8 +128,9 @@ void QWaylandTextInputv1::updateState(Qt::InputMethodQueries queries, uint32_t f if (queries & Qt::ImCursorRectangle) { const QRect &cRect = event.value(Qt::ImCursorRectangle).toRect(); const QRect &windowRect = QGuiApplication::inputMethod()->inputItemTransform().mapRect(cRect); - const QMargins margins = window->frameMargins(); - const QRect &surfaceRect = windowRect.translated(margins.left(), margins.top()); + const QRect &nativeRect = QHighDpi::toNativePixels(windowRect, QGuiApplication::focusWindow()); + const QMargins margins = window->clientSideMargins(); + const QRect &surfaceRect = nativeRect.translated(margins.left(), margins.top()); set_cursor_rectangle(surfaceRect.x(), surfaceRect.y(), surfaceRect.width(), surfaceRect.height()); } diff --git a/src/plugins/platforms/wayland/qwaylandtextinputv2.cpp b/src/plugins/platforms/wayland/qwaylandtextinputv2.cpp index 89a8a6d77d7..9d462f7d60b 100644 --- a/src/plugins/platforms/wayland/qwaylandtextinputv2.cpp +++ b/src/plugins/platforms/wayland/qwaylandtextinputv2.cpp @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include @@ -134,8 +135,9 @@ void QWaylandTextInputv2::updateState(Qt::InputMethodQueries queries, uint32_t f if (queries & Qt::ImCursorRectangle) { const QRect &cRect = event.value(Qt::ImCursorRectangle).toRect(); const QRect &windowRect = QGuiApplication::inputMethod()->inputItemTransform().mapRect(cRect); - const QMargins margins = window->frameMargins(); - const QRect &surfaceRect = windowRect.translated(margins.left(), margins.top()); + const QRect &nativeRect = QHighDpi::toNativePixels(windowRect, QGuiApplication::focusWindow()); + const QMargins margins = window->clientSideMargins(); + const QRect &surfaceRect = nativeRect.translated(margins.left(), margins.top()); set_cursor_rectangle(surfaceRect.x(), surfaceRect.y(), surfaceRect.width(), surfaceRect.height()); } diff --git a/src/plugins/platforms/wayland/qwaylandtextinputv3.cpp b/src/plugins/platforms/wayland/qwaylandtextinputv3.cpp index ad43ff1bc09..4344667a2e3 100644 --- a/src/plugins/platforms/wayland/qwaylandtextinputv3.cpp +++ b/src/plugins/platforms/wayland/qwaylandtextinputv3.cpp @@ -8,6 +8,7 @@ #include #include +#include #include #include #include @@ -236,8 +237,9 @@ void QWaylandTextInputv3::updateState(Qt::InputMethodQueries queries, uint32_t f if (queries & Qt::ImCursorRectangle) { const QRect &cRect = event.value(Qt::ImCursorRectangle).toRect(); const QRect &windowRect = QGuiApplication::inputMethod()->inputItemTransform().mapRect(cRect); - const QMargins margins = window->frameMargins(); - const QRect &surfaceRect = windowRect.translated(margins.left(), margins.top()); + const QRect &nativeRect = QHighDpi::toNativePixels(windowRect, QGuiApplication::focusWindow()); + const QMargins margins = window->clientSideMargins(); + const QRect &surfaceRect = nativeRect.translated(margins.left(), margins.top()); if (surfaceRect != m_cursorRect) { set_cursor_rectangle(surfaceRect.x(), surfaceRect.y(), surfaceRect.width(), surfaceRect.height()); m_cursorRect = surfaceRect; From 7b16ee4ae74d222b9692538e8bda498ba9a10685 Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Wed, 10 Jan 2024 23:00:26 +0000 Subject: [PATCH 1281/1507] client: Avoid creating decorations in the render thread createDecoration is called when on the main thread from when window flags change, implicitly from initWindow, and also every handleWindowStatesChanged which will be called when we get the first configure event in an xdg shell. There is no need to create the decoration in QWaylandGLContext::makeCurrent. Any current call to makeCurrent before the platform window is shown will not create a decoration as there's a check for a shell surface. Any call afterwards will have already been handled by initWindow. Similarly the SHM backend store does not need to handle decorations itself. Fixes: QTBUG-105703 Pick-to: 6.7 Pick-to: 6.6 Change-Id: I644cece28277131cf7a65eaa234ff08c8431d544 Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp | 1 - src/plugins/platforms/wayland/qwaylandwindow.cpp | 8 +++----- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp b/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp index ffd17ce89fe..fc5e7822104 100644 --- a/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp +++ b/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp @@ -204,7 +204,6 @@ void QWaylandShmBackingStore::endPaint() void QWaylandShmBackingStore::ensureSize() { waylandWindow()->setBackingStore(this); - waylandWindow()->createDecoration(); resize(mRequestedSize); } diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index b34e448b67a..672ddc5b169 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -1041,6 +1041,8 @@ void QWaylandWindow::setWindowFlags(Qt::WindowFlags flags) bool QWaylandWindow::createDecoration() { + Q_ASSERT_X(QThread::currentThreadId() == QThreadData::get2(thread())->threadId.loadRelaxed(), + "QWaylandWindow::createDecoration", "not called from main thread"); if (!mDisplay->supportsWindowDecoration()) return false; @@ -1121,11 +1123,7 @@ bool QWaylandWindow::createDecoration() // size and are not redrawn, leaving the new buffer empty. As a simple // work-around, we trigger a full extra update whenever the client-side // window decorations are toggled while the window is showing. - // Note: createDecoration() is sometimes called from the render thread - // of Qt Quick. This is essentially wrong and could potentially cause problems, - // but until the underlying issue has been fixed, we have to use invokeMethod() - // here to avoid asserts. - QMetaObject::invokeMethod(window(), &QWindow::requestUpdate); + window()->requestUpdate(); } return mWindowDecoration; From 564ca2f3071cd59499294caa076f50cb27f0732e Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Wed, 10 Jan 2024 16:48:08 +0100 Subject: [PATCH 1282/1507] Add CMake autotest Task-number: QTBUG-84884 Change-Id: I7be48ae60c1b08dee6e95b042b9c72d809a9f72f Reviewed-by: Alexandru Croitor Reviewed-by: Alexey Edelev Reviewed-by: Qt CI Bot --- tests/auto/cmake/test_waylandclient/CMakeLists.txt | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/tests/auto/cmake/test_waylandclient/CMakeLists.txt b/tests/auto/cmake/test_waylandclient/CMakeLists.txt index 78fd6e3a292..cad8d45d365 100644 --- a/tests/auto/cmake/test_waylandclient/CMakeLists.txt +++ b/tests/auto/cmake/test_waylandclient/CMakeLists.txt @@ -6,10 +6,6 @@ project(test_plugins) cmake_minimum_required(VERSION 3.16) cmake_policy(SET CMP0056 NEW) -find_package(Qt5WaylandClient REQUIRED) - -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Core_EXECUTABLE_COMPILE_FLAGS}") - -include_directories(${Qt5WaylandClient_PRIVATE_INCLUDE_DIRS}) +find_package(Qt6WaylandClient REQUIRED) add_executable(test_waylandclient_exe main.cpp) -target_link_libraries(test_waylandclient_exe Qt5::WaylandClient) +target_link_libraries(test_waylandclient_exe Qt6::WaylandClientPrivate) From 2d4b07753407af18e05f53e7e39431a67dfc9fe9 Mon Sep 17 00:00:00 2001 From: JiDe Zhang Date: Tue, 16 Jan 2024 17:18:19 +0800 Subject: [PATCH 1283/1507] Disable client side decorations on Vulkan window Fixes: QTBUG-120950 Change-Id: I22a78691bd09093432e5d11a72e3abbeadf36cf2 Reviewed-by: David Edmundson --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 672ddc5b169..75942a238f4 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -1043,6 +1043,9 @@ bool QWaylandWindow::createDecoration() { Q_ASSERT_X(QThread::currentThreadId() == QThreadData::get2(thread())->threadId.loadRelaxed(), "QWaylandWindow::createDecoration", "not called from main thread"); + // TODO: client side decorations do not work with Vulkan backend. + if (window()->surfaceType() == QSurface::VulkanSurface) + return false; if (!mDisplay->supportsWindowDecoration()) return false; From c15b219108835b63aabee0f2868ca62dc5a1c063 Mon Sep 17 00:00:00 2001 From: David Redondo Date: Tue, 13 Jun 2023 14:02:59 +0200 Subject: [PATCH 1284/1507] Make sure wayland object destructors are called Always at least call the generated "interface"_destroy method which does destroy the proxy. For not already wrapped classes a small template is introduced to pass a function that is called in the destructor. Fixes: QTBUG-111576 Change-Id: I373463710764958ddea42ef0f7dc010c427b2ce8 Reviewed-by: David Edmundson Reviewed-by: Qt CI Bot --- .../wl-shell/qwaylandwlshellintegration.cpp | 6 ++ .../wl-shell/qwaylandwlshellintegration_p.h | 1 + .../xdg-shell/qwaylandxdgactivationv1.cpp | 4 ++ .../xdg-shell/qwaylandxdgactivationv1_p.h | 1 + .../platforms/wayland/qwaylanddatadevice.cpp | 2 + .../platforms/wayland/qwaylanddisplay.cpp | 62 +++++++++++++------ .../platforms/wayland/qwaylanddisplay_p.h | 15 +++-- .../platforms/wayland/qwaylandinputdevice.cpp | 9 ++- .../wayland/qwaylandinputmethodcontext.cpp | 1 + .../wayland/qwaylandnativeinterface.cpp | 16 +++-- .../wayland/qwaylandpointergestures.cpp | 8 +++ .../wayland/qwaylandpointergestures_p.h | 1 + .../wayland/qwaylandprimaryselectionv1.cpp | 5 ++ .../wayland/qwaylandprimaryselectionv1_p.h | 1 + .../platforms/wayland/qwaylandqtkey.cpp | 5 ++ .../platforms/wayland/qwaylandqtkey_p.h | 1 + .../platforms/wayland/qwaylandscreen.cpp | 9 ++- .../platforms/wayland/qwaylandscreen_p.h | 1 + src/plugins/platforms/wayland/qwaylandshm.cpp | 2 +- .../platforms/wayland/qwaylandtabletv2.cpp | 5 ++ .../platforms/wayland/qwaylandtabletv2_p.h | 1 + .../platforms/wayland/qwaylandtextinputv1.cpp | 1 + .../platforms/wayland/qwaylandtouch.cpp | 5 ++ .../platforms/wayland/qwaylandtouch_p.h | 1 + .../qwaylandwindowmanagerintegration.cpp | 4 +- 25 files changed, 133 insertions(+), 34 deletions(-) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellintegration.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellintegration.cpp index 3a3e8b00b35..2e2076b0a55 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellintegration.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellintegration.cpp @@ -18,6 +18,12 @@ QWaylandWlShellIntegration::QWaylandWlShellIntegration() : QWaylandShellIntegrat << "by setting the environment variable QT_WAYLAND_SHELL_INTEGRATION"; } +QWaylandWlShellIntegration::~QWaylandWlShellIntegration() +{ + if (object()) + wl_shell_destroy(object()); +} + QWaylandShellSurface *QWaylandWlShellIntegration::createShellSurface(QWaylandWindow *window) { return new QWaylandWlShellSurface(get_shell_surface(window->wlSurface()), window); diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellintegration_p.h b/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellintegration_p.h index fd3cb87f0e8..312a1089a5c 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellintegration_p.h +++ b/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellintegration_p.h @@ -29,6 +29,7 @@ class Q_WAYLANDCLIENT_EXPORT QWaylandWlShellIntegration { public: QWaylandWlShellIntegration(); + ~QWaylandWlShellIntegration(); QWaylandShellSurface *createShellSurface(QWaylandWindow *window) override; void *nativeResourceForWindow(const QByteArray &resource, QWindow *window) override; diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgactivationv1.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgactivationv1.cpp index 8efc040863c..8540724d879 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgactivationv1.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgactivationv1.cpp @@ -43,6 +43,10 @@ QWaylandXdgActivationV1::requestXdgActivationToken(QWaylandDisplay *display, return provider; } +QWaylandXdgActivationTokenV1::~QWaylandXdgActivationTokenV1() +{ + destroy(); +} } QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgactivationv1_p.h b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgactivationv1_p.h index 2f42d9258b0..bddb5c614e0 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgactivationv1_p.h +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgactivationv1_p.h @@ -33,6 +33,7 @@ class Q_WAYLANDCLIENT_EXPORT QWaylandXdgActivationTokenV1 { Q_OBJECT public: + ~QWaylandXdgActivationTokenV1() override; void xdg_activation_token_v1_done(const QString &token) override { Q_EMIT done(token); } Q_SIGNALS: diff --git a/src/plugins/platforms/wayland/qwaylanddatadevice.cpp b/src/plugins/platforms/wayland/qwaylanddatadevice.cpp index 3344d3806ed..dd5e62cd002 100644 --- a/src/plugins/platforms/wayland/qwaylanddatadevice.cpp +++ b/src/plugins/platforms/wayland/qwaylanddatadevice.cpp @@ -43,6 +43,8 @@ QWaylandDataDevice::~QWaylandDataDevice() { if (version() >= WL_DATA_DEVICE_RELEASE_SINCE_VERSION) release(); + else + wl_data_device_destroy(object()); } QWaylandDataOffer *QWaylandDataDevice::selectionOffer() const diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index 0c73fdc3796..890fed19920 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -260,14 +260,14 @@ Q_LOGGING_CATEGORY(lcQpaWayland, "qt.qpa.wayland"); // for general (uncategorize struct wl_surface *QWaylandDisplay::createSurface(void *handle) { - struct wl_surface *surface = mCompositor.create_surface(); + struct wl_surface *surface = mGlobals.compositor->create_surface(); wl_surface_set_user_data(surface, handle); return surface; } struct ::wl_region *QWaylandDisplay::createRegion(const QRegion &qregion) { - struct ::wl_region *region = mCompositor.create_region(); + struct ::wl_region *region = mGlobals.compositor->create_region(); for (const QRect &rect : qregion) wl_region_add(region, rect.x(), rect.y(), rect.width(), rect.height()); @@ -371,8 +371,12 @@ QWaylandDisplay::~QWaylandDisplay(void) if (m_frameEventQueue) wl_event_queue_destroy(m_frameEventQueue); + // Reset the globals manually since they need to be destroyed before the wl_display mGlobals = {}; + if (object()) + wl_registry_destroy(object()); + if (mDisplay) wl_display_disconnect(mDisplay); } @@ -425,8 +429,6 @@ void QWaylandDisplay::reconnect() QWindowSystemInterface::handleScreenRemoved(screen); } - // mCompositor - mShm.reset(); mCursorThemes.clear(); mCursor.reset(); @@ -602,6 +604,16 @@ void QWaylandDisplay::handleScreenInitialized(QWaylandScreen *screen) } } +template +struct WithDestructor : public T +{ + using T::T; + ~WithDestructor() + { + f(this->object()); + } +}; + void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uint32_t version) { struct ::wl_registry *registry = object(); @@ -614,9 +626,11 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin if (interface == QLatin1String(QtWayland::wl_output::interface()->name)) { mWaitingScreens << mWaylandIntegration->createPlatformScreen(this, version, id); } else if (interface == QLatin1String(QtWayland::wl_compositor::interface()->name)) { - mCompositor.init(registry, id, qMin((int)version, 6)); + mGlobals.compositor.reset( + new WithDestructor( + registry, id, qMin((int)version, 6))); } else if (interface == QLatin1String(QWaylandShm::interface()->name)) { - mShm.reset(new QWaylandShm(this, version, id)); + mGlobals.shm.reset(new QWaylandShm(this, version, id)); } else if (interface == QLatin1String(QWaylandInputDevice::interface()->name)) { QWaylandInputDevice *inputDevice = mWaylandIntegration->createInputDevice(this, version, id); mInputDevices.append(inputDevice); @@ -625,9 +639,13 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin mGlobals.dndSelectionHandler.reset(new QWaylandDataDeviceManager(this, version, id)); #endif } else if (interface == QLatin1String(QtWayland::qt_surface_extension::interface()->name)) { - mGlobals.surfaceExtension.reset(new QtWayland::qt_surface_extension(registry, id, 1)); + mGlobals.surfaceExtension.reset( + new WithDestructor( + registry, id, 1)); } else if (interface == QLatin1String(QtWayland::wl_subcompositor::interface()->name)) { - mGlobals.subCompositor.reset(new QtWayland::wl_subcompositor(registry, id, 1)); + mGlobals.subCompositor.reset( + new WithDestructor(registry, + id, 1)); } else if (interface == QLatin1String(QWaylandTouchExtension::interface()->name)) { mGlobals.touchExtension.reset(new QWaylandTouchExtension(this, id)); } else if (interface == QLatin1String(QWaylandQtKeyExtension::interface()->name)) { @@ -658,7 +676,8 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin } mGlobals.textInputMethodManager.reset( - new QtWayland::qt_text_input_method_manager_v1(registry, id, 1)); + new WithDestructor(registry, id, 1)); for (QWaylandInputDevice *inputDevice : std::as_const(mInputDevices)) inputDevice->setTextInputMethod(new QWaylandTextInputMethod( this, @@ -678,7 +697,8 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin } mGlobals.textInputManagerv1.reset( - new QtWayland::zwp_text_input_manager_v1(registry, id, 1)); + new WithDestructor(registry, id, 1)); for (QWaylandInputDevice *inputDevice : std::as_const(mInputDevices)) { auto textInput = new QWaylandTextInputv1(this, mGlobals.textInputManagerv1->create_text_input()); @@ -700,7 +720,8 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin } mGlobals.textInputManagerv2.reset( - new QtWayland::zwp_text_input_manager_v2(registry, id, 1)); + new WithDestructor(registry, id, 1)); for (QWaylandInputDevice *inputDevice : std::as_const(mInputDevices)) inputDevice->setTextInput(new QWaylandTextInputv2( this, mGlobals.textInputManagerv2->get_text_input(inputDevice->wl_seat()))); @@ -715,9 +736,9 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin for (QWaylandInputDevice *inputDevice : std::as_const(mInputDevices)) inputDevice->setTextInputMethod(nullptr); } - mGlobals.textInputManagerv3.reset( - new QtWayland::zwp_text_input_manager_v3(registry, id, 1)); + new WithDestructor(registry, id, 1)); for (QWaylandInputDevice *inputDevice : std::as_const(mInputDevices)) inputDevice->setTextInput(new QWaylandTextInputv3( this, mGlobals.textInputManagerv3->get_text_input(inputDevice->wl_seat()))); @@ -738,16 +759,21 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin screen->initXdgOutput(xdgOutputManager()); } else if (interface == QLatin1String(QtWayland::wp_fractional_scale_manager_v1::interface()->name)) { mGlobals.fractionalScaleManager.reset( - new QtWayland::wp_fractional_scale_manager_v1(registry, id, 1)); + new WithDestructor(registry, id, 1)); } else if (interface == QLatin1String("wp_viewporter")) { - mGlobals.viewporter.reset(new QtWayland::wp_viewporter(registry, id, qMin(1u, version))); + mGlobals.viewporter.reset( + new WithDestructor( + registry, id, qMin(1u, version))); } else if (interface == QLatin1String(QtWayland::wp_cursor_shape_manager_v1::interface()->name)) { - mGlobals.cursorShapeManager.reset( - new QtWayland::wp_cursor_shape_manager_v1(registry, id, std::min(1u, version))); + mGlobals.cursorShapeManager.reset(new WithDestructor( + registry, id, std::min(1u, version))); } else if ( interface == QLatin1String(QtWayland::qt_toplevel_drag_manager_v1::interface()->name)) { mGlobals.xdgToplevelDragManager.reset( - new QtWayland::qt_toplevel_drag_manager_v1(registry, id, 1)); + new WithDestructor(registry, id, 1)); } mRegistryGlobals.append(RegistryGlobal(id, interface, version, registry)); diff --git a/src/plugins/platforms/wayland/qwaylanddisplay_p.h b/src/plugins/platforms/wayland/qwaylanddisplay_p.h index 868811cca3f..477a5dbf267 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay_p.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay_p.h @@ -128,8 +128,10 @@ public: struct wl_display *wl_display() const { return mDisplay; } struct ::wl_registry *wl_registry() { return object(); } - const struct wl_compositor *wl_compositor() const { return mCompositor.object(); } - QtWayland::wl_compositor *compositor() { return &mCompositor; } + QtWayland::wl_compositor *compositor() + { + return mGlobals.compositor.get(); + } QList inputDevices() const { return mInputDevices; } QWaylandInputDevice *defaultInputDevice() const; @@ -225,7 +227,10 @@ public: void addRegistryListener(RegistryListener listener, void *data); void removeListener(RegistryListener listener, void *data); - QWaylandShm *shm() const { return mShm.data(); } + QWaylandShm *shm() const + { + return mGlobals.shm.get(); + } void forceRoundTrip(); @@ -281,8 +286,6 @@ private: std::unique_ptr m_eventThread; wl_event_queue *m_frameEventQueue = nullptr; QScopedPointer m_frameEventQueueThread; - QtWayland::wl_compositor mCompositor; - QScopedPointer mShm; QList mWaitingScreens; QList mScreens; QPlatformPlaceholderScreen *mPlaceholderScreen = nullptr; @@ -313,6 +316,8 @@ private: struct GlobalHolder { + std::unique_ptr compositor; + std::unique_ptr shm; #if QT_CONFIG(wayland_datadevice) std::unique_ptr dndSelectionHandler; #endif diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index f52789fdc0b..c552988de40 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -418,8 +418,13 @@ QWaylandInputDevice::QWaylandInputDevice(QWaylandDisplay *display, int version, #endif } -// Can't be in header because dtors for scoped pointers aren't known there. -QWaylandInputDevice::~QWaylandInputDevice() = default; +QWaylandInputDevice::~QWaylandInputDevice() +{ + if (version() >= WL_SEAT_RELEASE_SINCE_VERSION) + release(); + else + wl_seat_destroy(object()); +} void QWaylandInputDevice::seat_capabilities(uint32_t caps) { diff --git a/src/plugins/platforms/wayland/qwaylandinputmethodcontext.cpp b/src/plugins/platforms/wayland/qwaylandinputmethodcontext.cpp index f03d8fb748d..657208efbf1 100644 --- a/src/plugins/platforms/wayland/qwaylandinputmethodcontext.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputmethodcontext.cpp @@ -25,6 +25,7 @@ QWaylandTextInputMethod::QWaylandTextInputMethod(QWaylandDisplay *display, struc QWaylandTextInputMethod::~QWaylandTextInputMethod() { + qt_text_input_method_v1_destroy(object()); } void QWaylandTextInputMethod::text_input_method_v1_visible_changed(int32_t visible) diff --git a/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp b/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp index 65272f3c228..601f833aacc 100644 --- a/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp +++ b/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp @@ -35,8 +35,10 @@ void *QWaylandNativeInterface::nativeResourceForIntegration(const QByteArray &re if (lowerCaseResource == "display" || lowerCaseResource == "wl_display" || lowerCaseResource == "nativedisplay") return m_integration->display()->wl_display(); - if (lowerCaseResource == "compositor") - return const_cast(m_integration->display()->wl_compositor()); + if (lowerCaseResource == "compositor") { + if (auto compositor = m_integration->display()->compositor()) + return compositor->object(); + } if (lowerCaseResource == "server_buffer_integration") return m_integration->serverBufferIntegration(); @@ -76,7 +78,9 @@ wl_display *QtWaylandClient::QWaylandNativeInterface::display() const wl_compositor *QtWaylandClient::QWaylandNativeInterface::compositor() const { - return const_cast(m_integration->display()->wl_compositor()); + if (auto compositor = m_integration->display()->compositor()) + return compositor->object(); + return nullptr; } wl_seat *QtWaylandClient::QWaylandNativeInterface::seat() const @@ -129,8 +133,10 @@ void *QWaylandNativeInterface::nativeResourceForWindow(const QByteArray &resourc if (lowerCaseResource == "display") return m_integration->display()->wl_display(); - if (lowerCaseResource == "compositor") - return const_cast(m_integration->display()->wl_compositor()); + if (lowerCaseResource == "compositor") { + if (auto compositor = m_integration->display()->compositor()) + return compositor->object(); + } if (lowerCaseResource == "surface") { QWaylandWindow *w = static_cast(window->handle()); return w ? w->wlSurface() : nullptr; diff --git a/src/plugins/platforms/wayland/qwaylandpointergestures.cpp b/src/plugins/platforms/wayland/qwaylandpointergestures.cpp index 1cdd97edde0..87079d8009d 100644 --- a/src/plugins/platforms/wayland/qwaylandpointergestures.cpp +++ b/src/plugins/platforms/wayland/qwaylandpointergestures.cpp @@ -14,6 +14,14 @@ QWaylandPointerGestures::QWaylandPointerGestures(QWaylandDisplay *display, uint { } +QWaylandPointerGestures::~QWaylandPointerGestures() noexcept +{ + if (version() >= ZWP_POINTER_GESTURES_V1_RELEASE_SINCE_VERSION) + release(); + else + zwp_pointer_gestures_v1_destroy(object()); +} + QWaylandPointerGestureSwipe * QWaylandPointerGestures::createPointerGestureSwipe(QWaylandInputDevice *device) { diff --git a/src/plugins/platforms/wayland/qwaylandpointergestures_p.h b/src/plugins/platforms/wayland/qwaylandpointergestures_p.h index 7e5a7e06f2a..06ee4a6edda 100644 --- a/src/plugins/platforms/wayland/qwaylandpointergestures_p.h +++ b/src/plugins/platforms/wayland/qwaylandpointergestures_p.h @@ -36,6 +36,7 @@ class Q_WAYLANDCLIENT_EXPORT QWaylandPointerGestures : public QtWayland::zwp_poi { public: explicit QWaylandPointerGestures(QWaylandDisplay *display, uint id, uint version); + ~QWaylandPointerGestures(); QWaylandPointerGestureSwipe *createPointerGestureSwipe(QWaylandInputDevice *device); QWaylandPointerGesturePinch *createPointerGesturePinch(QWaylandInputDevice *device); diff --git a/src/plugins/platforms/wayland/qwaylandprimaryselectionv1.cpp b/src/plugins/platforms/wayland/qwaylandprimaryselectionv1.cpp index 999aba97018..d72b8f74930 100644 --- a/src/plugins/platforms/wayland/qwaylandprimaryselectionv1.cpp +++ b/src/plugins/platforms/wayland/qwaylandprimaryselectionv1.cpp @@ -20,6 +20,11 @@ QWaylandPrimarySelectionDeviceManagerV1::QWaylandPrimarySelectionDeviceManagerV1 { } +QWaylandPrimarySelectionDeviceManagerV1::~QWaylandPrimarySelectionDeviceManagerV1() +{ + destroy(); +} + QWaylandPrimarySelectionDeviceV1 *QWaylandPrimarySelectionDeviceManagerV1::createDevice(QWaylandInputDevice *seat) { return new QWaylandPrimarySelectionDeviceV1(this, seat); diff --git a/src/plugins/platforms/wayland/qwaylandprimaryselectionv1_p.h b/src/plugins/platforms/wayland/qwaylandprimaryselectionv1_p.h index 3591f0623d7..f39aec526b9 100644 --- a/src/plugins/platforms/wayland/qwaylandprimaryselectionv1_p.h +++ b/src/plugins/platforms/wayland/qwaylandprimaryselectionv1_p.h @@ -37,6 +37,7 @@ class QWaylandPrimarySelectionDeviceManagerV1 : public QtWayland::zwp_primary_se { public: explicit QWaylandPrimarySelectionDeviceManagerV1(QWaylandDisplay *display, uint id, uint version); + ~QWaylandPrimarySelectionDeviceManagerV1(); QWaylandPrimarySelectionDeviceV1 *createDevice(QWaylandInputDevice *seat); QWaylandDisplay *display() const { return m_display; } diff --git a/src/plugins/platforms/wayland/qwaylandqtkey.cpp b/src/plugins/platforms/wayland/qwaylandqtkey.cpp index f6bda97d8be..079a03e0ddb 100644 --- a/src/plugins/platforms/wayland/qwaylandqtkey.cpp +++ b/src/plugins/platforms/wayland/qwaylandqtkey.cpp @@ -15,6 +15,11 @@ QWaylandQtKeyExtension::QWaylandQtKeyExtension(QWaylandDisplay *display, uint32_ { } +QWaylandQtKeyExtension::~QWaylandQtKeyExtension() +{ + zqt_key_v1_destroy(object()); +} + void QWaylandQtKeyExtension::zqt_key_v1_key(struct wl_surface *surface, uint32_t time, uint32_t type, diff --git a/src/plugins/platforms/wayland/qwaylandqtkey_p.h b/src/plugins/platforms/wayland/qwaylandqtkey_p.h index 223b050263e..1544a01663d 100644 --- a/src/plugins/platforms/wayland/qwaylandqtkey_p.h +++ b/src/plugins/platforms/wayland/qwaylandqtkey_p.h @@ -31,6 +31,7 @@ class Q_WAYLANDCLIENT_EXPORT QWaylandQtKeyExtension : public QtWayland::zqt_key_ { public: QWaylandQtKeyExtension(QWaylandDisplay *display, uint32_t id); + ~QWaylandQtKeyExtension(); private: QWaylandDisplay *m_display = nullptr; diff --git a/src/plugins/platforms/wayland/qwaylandscreen.cpp b/src/plugins/platforms/wayland/qwaylandscreen.cpp index ea109c8f5b8..3faef3f255d 100644 --- a/src/plugins/platforms/wayland/qwaylandscreen.cpp +++ b/src/plugins/platforms/wayland/qwaylandscreen.cpp @@ -22,6 +22,11 @@ QWaylandXdgOutputManagerV1::QWaylandXdgOutputManagerV1(QWaylandDisplay* display, { } +QWaylandXdgOutputManagerV1::~QWaylandXdgOutputManagerV1() +{ + destroy(); +} + QWaylandScreen::QWaylandScreen(QWaylandDisplay *waylandDisplay, int version, uint32_t id) : QtWayland::wl_output(waylandDisplay->wl_registry(), id, qMin(version, 3)) , m_outputId(id) @@ -44,8 +49,10 @@ QWaylandScreen::~QWaylandScreen() { if (zxdg_output_v1::isInitialized()) zxdg_output_v1::destroy(); - if (wl_output::isInitialized() && wl_output::version() >= WL_OUTPUT_RELEASE_SINCE_VERSION) + if (wl_output::version() >= WL_OUTPUT_RELEASE_SINCE_VERSION) wl_output::release(); + else + wl_output_destroy(wl_output::object()); } uint QWaylandScreen::requiredEvents() const diff --git a/src/plugins/platforms/wayland/qwaylandscreen_p.h b/src/plugins/platforms/wayland/qwaylandscreen_p.h index a56e56f1903..ff3d23217c7 100644 --- a/src/plugins/platforms/wayland/qwaylandscreen_p.h +++ b/src/plugins/platforms/wayland/qwaylandscreen_p.h @@ -33,6 +33,7 @@ class QWaylandCursor; class Q_WAYLANDCLIENT_EXPORT QWaylandXdgOutputManagerV1 : public QtWayland::zxdg_output_manager_v1 { public: QWaylandXdgOutputManagerV1(QWaylandDisplay *display, uint id, uint version); + ~QWaylandXdgOutputManagerV1(); }; class Q_WAYLANDCLIENT_EXPORT QWaylandScreen : public QPlatformScreen, diff --git a/src/plugins/platforms/wayland/qwaylandshm.cpp b/src/plugins/platforms/wayland/qwaylandshm.cpp index 7c0bc4ddb75..9ee7a96bce7 100644 --- a/src/plugins/platforms/wayland/qwaylandshm.cpp +++ b/src/plugins/platforms/wayland/qwaylandshm.cpp @@ -16,7 +16,7 @@ QWaylandShm::QWaylandShm(QWaylandDisplay *display, int version, uint32_t id) QWaylandShm::~QWaylandShm() { - + wl_shm_destroy(object()); } void QWaylandShm::shm_format(uint32_t format) diff --git a/src/plugins/platforms/wayland/qwaylandtabletv2.cpp b/src/plugins/platforms/wayland/qwaylandtabletv2.cpp index a7c3458f71d..73524c1664c 100644 --- a/src/plugins/platforms/wayland/qwaylandtabletv2.cpp +++ b/src/plugins/platforms/wayland/qwaylandtabletv2.cpp @@ -20,6 +20,11 @@ QWaylandTabletManagerV2::QWaylandTabletManagerV2(QWaylandDisplay *display, uint createTabletSeat(seat); } +QWaylandTabletManagerV2::~QWaylandTabletManagerV2() +{ + destroy(); +} + QWaylandTabletSeatV2 *QWaylandTabletManagerV2::createTabletSeat(QWaylandInputDevice *seat) { return new QWaylandTabletSeatV2(this, seat); diff --git a/src/plugins/platforms/wayland/qwaylandtabletv2_p.h b/src/plugins/platforms/wayland/qwaylandtabletv2_p.h index 3e0f4372b96..20a8a4f5a24 100644 --- a/src/plugins/platforms/wayland/qwaylandtabletv2_p.h +++ b/src/plugins/platforms/wayland/qwaylandtabletv2_p.h @@ -42,6 +42,7 @@ class Q_WAYLANDCLIENT_EXPORT QWaylandTabletManagerV2 : public QtWayland::zwp_tab { public: explicit QWaylandTabletManagerV2(QWaylandDisplay *display, uint id, uint version); + ~QWaylandTabletManagerV2() override; QWaylandTabletSeatV2 *createTabletSeat(QWaylandInputDevice *seat); }; diff --git a/src/plugins/platforms/wayland/qwaylandtextinputv1.cpp b/src/plugins/platforms/wayland/qwaylandtextinputv1.cpp index 3b45322b13e..846ed95c87b 100644 --- a/src/plugins/platforms/wayland/qwaylandtextinputv1.cpp +++ b/src/plugins/platforms/wayland/qwaylandtextinputv1.cpp @@ -46,6 +46,7 @@ QWaylandTextInputv1::~QWaylandTextInputv1() { if (m_resetCallback) wl_callback_destroy(m_resetCallback); + zwp_text_input_v1_destroy(object()); } void QWaylandTextInputv1::reset() diff --git a/src/plugins/platforms/wayland/qwaylandtouch.cpp b/src/plugins/platforms/wayland/qwaylandtouch.cpp index a88947e07dd..dfd04d44694 100644 --- a/src/plugins/platforms/wayland/qwaylandtouch.cpp +++ b/src/plugins/platforms/wayland/qwaylandtouch.cpp @@ -23,6 +23,11 @@ QWaylandTouchExtension::QWaylandTouchExtension(QWaylandDisplay *display, uint32_ { } +QWaylandTouchExtension::~QWaylandTouchExtension() +{ + qt_touch_extension_destroy(object()); +} + void QWaylandTouchExtension::registerDevice(int caps) { // TODO number of touchpoints, actual name and ID diff --git a/src/plugins/platforms/wayland/qwaylandtouch_p.h b/src/plugins/platforms/wayland/qwaylandtouch_p.h index 8927f4e7e10..e283f90095c 100644 --- a/src/plugins/platforms/wayland/qwaylandtouch_p.h +++ b/src/plugins/platforms/wayland/qwaylandtouch_p.h @@ -32,6 +32,7 @@ class Q_WAYLANDCLIENT_EXPORT QWaylandTouchExtension : public QtWayland::qt_touch { public: QWaylandTouchExtension(QWaylandDisplay *display, uint32_t id); + ~QWaylandTouchExtension() override; void touchCanceled(); diff --git a/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration.cpp b/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration.cpp index dababe7c93e..149190420c2 100644 --- a/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration.cpp @@ -34,7 +34,6 @@ public: QWaylandWindowManagerIntegrationPrivate::QWaylandWindowManagerIntegrationPrivate(QWaylandDisplay *waylandDisplay) : m_waylandDisplay(waylandDisplay) { - } QWaylandWindowManagerIntegration::QWaylandWindowManagerIntegration(QWaylandDisplay *waylandDisplay) @@ -45,7 +44,8 @@ QWaylandWindowManagerIntegration::QWaylandWindowManagerIntegration(QWaylandDispl QWaylandWindowManagerIntegration::~QWaylandWindowManagerIntegration() { - + if (object()) + qt_windowmanager_destroy(object()); } bool QWaylandWindowManagerIntegration::showIsFullScreen() const From e992607d50ed7a13f4e484dbcd1aaa78b53044e1 Mon Sep 17 00:00:00 2001 From: Inho Lee Date: Wed, 17 Jan 2024 12:03:59 +0100 Subject: [PATCH 1285/1507] TextInputV3: Remove unnecessary enableSurface/disableSurface zwp_text_input_v3's enter/leave events are doing enable/disable the surfaces. enableSurface/disableSurface are called by setFocusObject and it follows enter/leave. These redundant routines are removed in TextInputV3 Fixes: QTBUG-120533 Pick-to: 6.7 Change-Id: I080c67629d7cf9a9029414f5a0ea6735cfe4642a Reviewed-by: David Edmundson --- .../platforms/wayland/qwaylandtextinputv3.cpp | 17 +---------------- .../platforms/wayland/qwaylandtextinputv3_p.h | 6 ++++-- 2 files changed, 5 insertions(+), 18 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandtextinputv3.cpp b/src/plugins/platforms/wayland/qwaylandtextinputv3.cpp index 4344667a2e3..fbd9028012a 100644 --- a/src/plugins/platforms/wayland/qwaylandtextinputv3.cpp +++ b/src/plugins/platforms/wayland/qwaylandtextinputv3.cpp @@ -43,7 +43,7 @@ const Qt::InputMethodQueries supportedQueries3 = Qt::ImEnabled | void QWaylandTextInputv3::zwp_text_input_v3_enter(struct ::wl_surface *surface) { - qCDebug(qLcQpaWaylandTextInput) << Q_FUNC_INFO; + qCDebug(qLcQpaWaylandTextInput) << Q_FUNC_INFO << m_surface << surface; m_surface = surface; @@ -185,21 +185,6 @@ void QWaylandTextInputv3::reset() m_pendingPreeditString.clear(); } -void QWaylandTextInputv3::enableSurface(::wl_surface *) -{ - qCDebug(qLcQpaWaylandTextInput) << Q_FUNC_INFO; -} - -void QWaylandTextInputv3::disableSurface(::wl_surface *surface) -{ - qCDebug(qLcQpaWaylandTextInput) << Q_FUNC_INFO; - - if (m_surface != surface) { - qCWarning(qLcQpaWaylandTextInput()) << Q_FUNC_INFO << "for surface" << surface << "focused surface" << m_surface; - return; - } -} - void QWaylandTextInputv3::commit() { m_currentSerial = (m_currentSerial < UINT_MAX) ? m_currentSerial + 1U: 0U; diff --git a/src/plugins/platforms/wayland/qwaylandtextinputv3_p.h b/src/plugins/platforms/wayland/qwaylandtextinputv3_p.h index 8c5b93b9be5..90b393cc0af 100644 --- a/src/plugins/platforms/wayland/qwaylandtextinputv3_p.h +++ b/src/plugins/platforms/wayland/qwaylandtextinputv3_p.h @@ -49,8 +49,10 @@ public: QLocale locale() const override; Qt::LayoutDirection inputDirection() const override; - void enableSurface(::wl_surface *surface) override; - void disableSurface(::wl_surface *surface) override; + // doing nothing in zwp_text_input_v3. + // enter() and leave() takes the role to enable/disable the surface + void enableSurface(::wl_surface *) override {}; + void disableSurface(::wl_surface *) override {}; protected: void zwp_text_input_v3_enter(struct ::wl_surface *surface) override; From 992aa7e561305f26337e1a730fbae47969d72ece Mon Sep 17 00:00:00 2001 From: David Redondo Date: Wed, 6 Dec 2023 14:51:53 +0100 Subject: [PATCH 1286/1507] Mark QWaylandWindow::wlSurface as const Change-Id: I416fee67bb35a88f55ac6d24d203e607f1ea1f32 Reviewed-by: David Edmundson --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 2 +- src/plugins/platforms/wayland/qwaylandwindow_p.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 75942a238f4..2be24111d2a 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -933,7 +933,7 @@ QPointF QWaylandWindow::mapFromWlSurface(const QPointF &surfacePosition) const return QPointF(surfacePosition.x() - margins.left(), surfacePosition.y() - margins.top()); } -wl_surface *QWaylandWindow::wlSurface() +wl_surface *QWaylandWindow::wlSurface() const { QReadLocker locker(&mSurfaceLock); return mSurface ? mSurface->object() : nullptr; diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index c2815cb8e55..981a26cb944 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -129,10 +129,10 @@ public: QPointF mapFromWlSurface(const QPointF &surfacePosition) const; QWaylandSurface *waylandSurface() const { return mSurface.data(); } - ::wl_surface *wlSurface(); + ::wl_surface *wlSurface() const; ::wl_surface *surface() const override { - return const_cast(this)->wlSurface(); + return wlSurface(); } static QWaylandWindow *fromWlSurface(::wl_surface *surface); From 3d47f834e07a43173d9db1357701259becbdb5f7 Mon Sep 17 00:00:00 2001 From: David Redondo Date: Tue, 23 Jan 2024 09:18:01 +0100 Subject: [PATCH 1287/1507] client: Destroy window manager integration before display Like the globals window manager integration needs the display to be alive. Fixes: QTBUG-121364 Change-Id: I3bf10737f9c1aa6d0b3c34d2268532ea6fc4e957 Reviewed-by: David Edmundson --- src/plugins/platforms/wayland/qwaylanddisplay.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index 890fed19920..43f9443fbec 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -373,6 +373,7 @@ QWaylandDisplay::~QWaylandDisplay(void) // Reset the globals manually since they need to be destroyed before the wl_display mGlobals = {}; + mWindowManagerIntegration.reset(); if (object()) wl_registry_destroy(object()); From 91a261b6edc2cbcb7d3f46284aa6920685b23fb7 Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Tue, 23 Jan 2024 11:57:41 +0000 Subject: [PATCH 1288/1507] Client: Update size hints when updating the decoration Size hints are in wayland's "window geometry". This includes the space for any client side decoration that QtWayland has to add. We need to update the size hints whenever decoration is created or destroyed and these margins change. Fixes: QTBUG-121399 Pick-to: 6.7 Change-Id: Ie8c1898859774e1c8dff93695af15327379ad3b6 Reviewed-by: Liang Qi --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 2be24111d2a..c42bb6526b4 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -1121,6 +1121,9 @@ bool QWaylandWindow::createDecoration() } setGeometry(geometry()); + // creating a decoration changes our margins which in turn change size hints + propagateSizeHints(); + // This is a special case where the buffer is recreated, but since // the content rect remains the same, the widgets remain the same // size and are not redrawn, leaving the new buffer empty. As a simple From 424abe62424a1618f7fbb79f12ac4f771c17f9c6 Mon Sep 17 00:00:00 2001 From: David Redondo Date: Mon, 22 Jan 2024 15:33:59 +0100 Subject: [PATCH 1289/1507] client: Fix deletion of new queued shm buffers during reconnect When reconnecting the cleanup of existing buffers is delayed in order to preserve contents and copy them to buffers belonging to the new connection. Due to the order of events it could happen that a new buffer was deleted along with the old ones but still being referenced by a window. During reconnect all QScreens are removed and new ones added for the wl_outputs on the new connection during the initial roundtrips. When the first new QScreen is added all QWindows move form the placeholder screen to it. This can cause for example QWidgets to repaint. At this point the windows are not reinited yet, and the buffer is queued inside the window. Only afterwards the reconnected signal was emitted which would cause deletion of all existing buffers including the newly queued ones. To fix this the signal is moved after the first roundtrip where all globals are announced and new buffers can be created but no new screens have been announced yet. The signal is renamed to be more fit for its new location. Pick-to: 6.7 Pick-to: 6.6 Change-Id: I06be14d235ac342a4b420176aadad3ccf18178fe Reviewed-by: David Edmundson --- src/plugins/platforms/wayland/qwaylanddisplay.cpp | 4 ++-- src/plugins/platforms/wayland/qwaylanddisplay_p.h | 2 +- src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index 43f9443fbec..1040c3b7ab7 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -391,6 +391,8 @@ bool QWaylandDisplay::initialize() forceRoundTrip(); + emit connected(); + if (!mWaitingScreens.isEmpty()) { // Give wl_output.done and zxdg_output_v1.done events a chance to arrive forceRoundTrip(); @@ -481,8 +483,6 @@ void QWaylandDisplay::reconnect() wl_event_queue_destroy(m_frameEventQueue); initEventThread(); - emit reconnected(); - auto needsRecreate = [](QPlatformWindow *window) { return window && !static_cast(window)->wlSurface(); }; diff --git a/src/plugins/platforms/wayland/qwaylanddisplay_p.h b/src/plugins/platforms/wayland/qwaylanddisplay_p.h index 477a5dbf267..e647f41c035 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay_p.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay_p.h @@ -259,7 +259,7 @@ public Q_SLOTS: void flushRequests(); Q_SIGNALS: - void reconnected(); + void connected(); void globalAdded(const RegistryGlobal &global); void globalRemoved(const RegistryGlobal &global); diff --git a/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp b/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp index fc5e7822104..723b264d518 100644 --- a/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp +++ b/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp @@ -137,7 +137,7 @@ QWaylandShmBackingStore::QWaylandShmBackingStore(QWindow *window, QWaylandDispla : QPlatformBackingStore(window) , mDisplay(display) { - QObject::connect(mDisplay, &QWaylandDisplay::reconnected, window, [this]() { + QObject::connect(mDisplay, &QWaylandDisplay::connected, window, [this]() { auto copy = mBuffers; // clear available buffers so we create new ones // actual deletion is deferred till after resize call so we can copy From f616c5beef40de72a1d51343cb554dd40225bfc8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Tue, 23 Jan 2024 15:24:28 +0100 Subject: [PATCH 1290/1507] Remove QWaylandWindow::handleExpose It was part of xdg-shell-v6 which has since been removed. Pick-to: 6.6 6.7 Change-Id: Iecf5166b4c2710b209f7dfa0951958dcf82618f7 Reviewed-by: David Edmundson --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 10 ---------- src/plugins/platforms/wayland/qwaylandwindow_p.h | 1 - 2 files changed, 11 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index c42bb6526b4..7bc79eb8abd 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -759,16 +759,6 @@ void QWaylandWindow::safeCommit(QWaylandBuffer *buffer, const QRegion &damage) } } -void QWaylandWindow::handleExpose(const QRegion ®ion) -{ - QWindowSystemInterface::handleExposeEvent(window(), region); - if (mQueuedBuffer && !region.isEmpty()) { - commit(mQueuedBuffer, mQueuedBufferDamage); - mQueuedBuffer = nullptr; - mQueuedBufferDamage = QRegion(); - } -} - void QWaylandWindow::commit(QWaylandBuffer *buffer, const QRegion &damage) { Q_ASSERT(isExposed()); diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index 981a26cb944..b78c8ce4ed6 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -113,7 +113,6 @@ public: void damage(const QRect &rect); void safeCommit(QWaylandBuffer *buffer, const QRegion &damage); - void handleExpose(const QRegion ®ion); void commit(QWaylandBuffer *buffer, const QRegion &damage); void commit(); From 21f03c33b0894dbff5267e58cb6269c8866252fd Mon Sep 17 00:00:00 2001 From: Nicolas Fella Date: Wed, 24 Jan 2024 01:39:24 +0100 Subject: [PATCH 1291/1507] Client: Fix Qt::KeypadModifier for key events Use the right QXkbCommon::modifiers overload that can resolve the modifier. f614fdfa5dc522f805c7c061535df6a0dc7409b9 did this for wayland-server, do the same for the client side Pick-to: 6.7 6.6 6.5 Change-Id: Iff0c105cb31201241d4972a7772cf997cede3fc3 Reviewed-by: Liang Qi --- src/plugins/platforms/wayland/qwaylandinputdevice.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index c552988de40..988e37e3085 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -1341,8 +1341,7 @@ void QWaylandInputDevice::Keyboard::keyboard_key(uint32_t serial, uint32_t time, auto code = key + 8; // map to wl_keyboard::keymap_format::keymap_format_xkb_v1 xkb_keysym_t sym = xkb_state_key_get_one_sym(mXkbState.get(), code); - - Qt::KeyboardModifiers modifiers = mParent->modifiers(); + Qt::KeyboardModifiers modifiers = QXkbCommon::modifiers(mXkbState.get(), sym); int qtkey = keysymToQtKey(sym, modifiers, mXkbState.get(), code); QString text = QXkbCommon::lookupString(mXkbState.get(), code); From d01b735d5067b8a37c69664f898fa87afc947c13 Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Wed, 10 Jan 2024 10:59:10 +0000 Subject: [PATCH 1292/1507] client: Remove unused member variable in TextInputV3 Pick-to: 6.7 Change-Id: I717f16d6ff055b2c0221bfd9cae1bdc9fa7f6513 Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/plugins/platforms/wayland/qwaylandtextinputv3.cpp | 3 +-- src/plugins/platforms/wayland/qwaylandtextinputv3_p.h | 1 - 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandtextinputv3.cpp b/src/plugins/platforms/wayland/qwaylandtextinputv3.cpp index fbd9028012a..48f882febbf 100644 --- a/src/plugins/platforms/wayland/qwaylandtextinputv3.cpp +++ b/src/plugins/platforms/wayland/qwaylandtextinputv3.cpp @@ -22,9 +22,8 @@ namespace QtWaylandClient { QWaylandTextInputv3::QWaylandTextInputv3(QWaylandDisplay *display, struct ::zwp_text_input_v3 *text_input) : QtWayland::zwp_text_input_v3(text_input) - , m_display(display) { - + Q_UNUSED(display) } QWaylandTextInputv3::~QWaylandTextInputv3() diff --git a/src/plugins/platforms/wayland/qwaylandtextinputv3_p.h b/src/plugins/platforms/wayland/qwaylandtextinputv3_p.h index 90b393cc0af..e8b7aa02745 100644 --- a/src/plugins/platforms/wayland/qwaylandtextinputv3_p.h +++ b/src/plugins/platforms/wayland/qwaylandtextinputv3_p.h @@ -63,7 +63,6 @@ protected: void zwp_text_input_v3_done(uint32_t serial) override; private: - QWaylandDisplay *m_display; QWaylandInputMethodEventBuilder m_builder; ::wl_surface *m_surface = nullptr; // ### Here for debugging purposes From 9becad7b64a7d22829023489f7cc836dc8f3ca34 Mon Sep 17 00:00:00 2001 From: David Redondo Date: Tue, 23 Jan 2024 14:36:38 +0100 Subject: [PATCH 1293/1507] client: Clean up old registry on reconnect Change-Id: Idcaf1aaef59529f0cb49c552418a434f7d449d7b Reviewed-by: David Edmundson --- src/plugins/platforms/wayland/qwaylanddisplay.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index 1040c3b7ab7..797013970cf 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -472,6 +472,8 @@ void QWaylandDisplay::reconnect() mSyncCallback = nullptr; } + if (object()) + wl_registry_destroy(object()); mDisplay = wl_display_connect(nullptr); if (!mDisplay) _exit(1); From 91d9156e7bfec79b4d201186d41e46a1521e0e26 Mon Sep 17 00:00:00 2001 From: David Redondo Date: Wed, 31 Jan 2024 12:06:16 +0100 Subject: [PATCH 1294/1507] client: Switch qt-toplevel-drag to xdg-toplevel-drag While no released compositor implemented qt-toplevel-drag it was a valuable to step to prove the protocol and the Qt implementation together with development pre-release versions of KWin. Now that the protocol is standardized we can switch to that version which is functionally identical. Pick-to: 6.6 6.7 Change-Id: I3beefe542cbabeddba4468b5d1fa24fcb05a2e5a Reviewed-by: David Edmundson --- .../wayland/protocols/qt-toplevel-drag-v1.xml | 83 ----------- .../protocols/xdg-toplevel-drag-v1.xml | 141 ++++++++++++++++++ src/plugins/platforms/wayland/CMakeLists.txt | 2 +- .../platforms/wayland/qwaylanddatadevice.cpp | 6 +- .../platforms/wayland/qwaylanddatadevice_p.h | 4 +- .../platforms/wayland/qwaylanddisplay.cpp | 8 +- .../platforms/wayland/qwaylanddisplay_p.h | 12 +- 7 files changed, 158 insertions(+), 98 deletions(-) delete mode 100644 src/3rdparty/wayland/protocols/qt-toplevel-drag-v1.xml create mode 100644 src/3rdparty/wayland/protocols/xdg-toplevel-drag-v1.xml diff --git a/src/3rdparty/wayland/protocols/qt-toplevel-drag-v1.xml b/src/3rdparty/wayland/protocols/qt-toplevel-drag-v1.xml deleted file mode 100644 index 72a22cbbde1..00000000000 --- a/src/3rdparty/wayland/protocols/qt-toplevel-drag-v1.xml +++ /dev/null @@ -1,83 +0,0 @@ - - - - - Copyright 2022 David Redondo <kde@david-redondo.de> - - 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. - - - - - This protocol enhances normal drag and drop with the ability to move a - window at the same time. This allows having detachable windows that - can also be reattached when dragged back to another window or some special - zone. - - Warning! The protocol described in this file is currently in the testing - phase. Backward compatible changes may be added together with the - corresponding interface version bump. Backward incompatible changes can - only be done by creating a new major version of the extension. - - - - - Create an qt_toplevel_drag for a drag and drop operation that is going - to be started with data_source. - This request can only be made on sources used in drag-and-drop, so it - must be performed before wl_data_device.start_drag. Attempting to use - the source other than for drag-and-drop will raise an invalid_source error. - - - - - - - - - - - - - - - - - - - Request that the window will be moved with the cursor during the drag operation. The offset - describes how the toplevel will be positioned relative to the cursor hotspot - in surface local coordinates. - Issuing this request after the drag has ended will result in a drag_ended protocol error. - - - - - - - - - - - - - - - diff --git a/src/3rdparty/wayland/protocols/xdg-toplevel-drag-v1.xml b/src/3rdparty/wayland/protocols/xdg-toplevel-drag-v1.xml new file mode 100644 index 00000000000..2fe9645839c --- /dev/null +++ b/src/3rdparty/wayland/protocols/xdg-toplevel-drag-v1.xml @@ -0,0 +1,141 @@ + + + + + Copyright 2023 David Redondo + + 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. + + + + + This protocol enhances normal drag and drop with the ability to move a + window at the same time. This allows having detachable parts of a window + that when dragged out of it become a new window and can be dragged over + an existing window to be reattached. + + A typical workflow would be when the user starts dragging on top of a + detachable part of a window, the client would create a wl_data_source and + a xdg_toplevel_drag_v1 object and start the drag as normal via + wl_data_device.start_drag. Once the client determines that the detachable + window contents should be detached from the originating window, it creates + a new xdg_toplevel with these contents and issues a + xdg_toplevel_drag_v1.attach request before mapping it. From now on the new + window is moved by the compositor during the drag as if the client called + xdg_toplevel.move. + + Dragging an existing window is similar. The client creates a + xdg_toplevel_drag_v1 object and attaches the existing toplevel before + starting the drag. + + Clients use the existing drag and drop mechanism to detect when a window + can be docked or undocked. If the client wants to snap a window into a + parent window it should delete or unmap the dragged top-level. If the + contents should be detached again it attaches a new toplevel as described + above. If a drag operation is cancelled without being dropped, clients + should revert to the previous state, deleting any newly created windows + as appropriate. When a drag operation ends as indicated by + wl_data_source.dnd_drop_performed the dragged toplevel window's final + position is determined as if a xdg_toplevel_move operation ended. + + Warning! The protocol described in this file is currently in the testing + phase. Backward compatible changes may be added together with the + corresponding interface version bump. Backward incompatible changes can + only be done by creating a new major version of the extension. + + + + + + + + + Destroy this xdg_toplevel_drag_manager_v1 object. Other objects, + including xdg_toplevel_drag_v1 objects created by this factory, are not + affected by this request. + + + + + + Create an xdg_toplevel_drag for a drag and drop operation that is going + to be started with data_source. + + This request can only be made on sources used in drag-and-drop, so it + must be performed before wl_data_device.start_drag. Attempting to use + the source other than for drag-and-drop such as in + wl_data_device.set_selection will raise an invalid_source error. + + Destroying data_source while a toplevel is attached to the + xdg_toplevel_drag is undefined. + + + + + + + + + + + + + + + + + + + Destroy this xdg_toplevel_drag_v1 object. This request must only be + called after the underlying wl_data_source drag has ended, as indicated + by the dnd_drop_performed or cancelled events. In any other case an + ongoing_drag error is raised. + + + + + + Request that the window will be moved with the cursor during the drag + operation. The offset is a hint to the compositor how the toplevel + should be positioned relative to the cursor hotspot in surface local + coordinates. For example it might only be used when an unmapped window + is attached. The attached window does not participate in the selection + of the drag target. + + If the toplevel is unmapped while it is attached, it is automatically + detached from the drag. In this case this request has to be called again + if the window should be attached after it is remapped. + + This request can be called multiple times but issuing it while a + toplevel with an active role is attached raises a toplevel_attached + error. + + + + + + + + + + diff --git a/src/plugins/platforms/wayland/CMakeLists.txt b/src/plugins/platforms/wayland/CMakeLists.txt index 67ee5c8652e..6d986ce8b60 100644 --- a/src/plugins/platforms/wayland/CMakeLists.txt +++ b/src/plugins/platforms/wayland/CMakeLists.txt @@ -94,8 +94,8 @@ qt6_generate_wayland_protocol_client_sources(WaylandClient ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/xdg-output-unstable-v1.xml ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/fractional-scale-v1.xml ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/viewporter.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/qt-toplevel-drag-v1.xml ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/xdg-shell.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/xdg-toplevel-drag-v1.xml ${CMAKE_CURRENT_SOURCE_DIR}/../extensions/qt-key-unstable-v1.xml ${CMAKE_CURRENT_SOURCE_DIR}/../extensions/qt-text-input-method-unstable-v1.xml ${CMAKE_CURRENT_SOURCE_DIR}/../extensions/qt-windowmanager.xml diff --git a/src/plugins/platforms/wayland/qwaylanddatadevice.cpp b/src/plugins/platforms/wayland/qwaylanddatadevice.cpp index dd5e62cd002..a59b201f670 100644 --- a/src/plugins/platforms/wayland/qwaylanddatadevice.cpp +++ b/src/plugins/platforms/wayland/qwaylanddatadevice.cpp @@ -13,7 +13,7 @@ #include "qwaylandabstractdecoration_p.h" #include "qwaylandsurface_p.h" -#include +#include #include #include @@ -153,8 +153,8 @@ bool QWaylandDataDevice::startDrag(QMimeData *mimeData, Qt::DropActions supporte offsetStream >> offset; if (auto waylandWindow = static_cast(dockWindow->handle())) { if (auto toplevel = waylandWindow->surfaceRole()) { - m_toplevelDrag = new QtWayland::qt_toplevel_drag_v1( - m_display->xdgToplevelDragManager()->get_qt_toplevel_drag( + m_toplevelDrag = new QtWayland::xdg_toplevel_drag_v1( + m_display->xdgToplevelDragManager()->get_xdg_toplevel_drag( m_dragSource->object())); m_toplevelDrag->attach(toplevel, offset.x(), offset.y()); } diff --git a/src/plugins/platforms/wayland/qwaylanddatadevice_p.h b/src/plugins/platforms/wayland/qwaylanddatadevice_p.h index b924aa7efe5..3dc4fcaf60e 100644 --- a/src/plugins/platforms/wayland/qwaylanddatadevice_p.h +++ b/src/plugins/platforms/wayland/qwaylanddatadevice_p.h @@ -32,7 +32,7 @@ class QPlatformDragQtResponse; class QWindow; namespace QtWayland { -class qt_toplevel_drag_v1; +class xdg_toplevel_drag_v1; } namespace QtWaylandClient { @@ -98,7 +98,7 @@ private: QScopedPointer m_selectionOffer; QScopedPointer m_selectionSource; QScopedPointer m_dragSource; - QtWayland::qt_toplevel_drag_v1 *m_toplevelDrag = nullptr; + QtWayland::xdg_toplevel_drag_v1 *m_toplevelDrag = nullptr; }; } diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index 797013970cf..da29980c702 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -51,7 +51,7 @@ #include #include #include -#include +#include #include @@ -773,10 +773,10 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin wp_cursor_shape_manager_v1_destroy>( registry, id, std::min(1u, version))); } else if ( - interface == QLatin1String(QtWayland::qt_toplevel_drag_manager_v1::interface()->name)) { + interface == QLatin1String(QtWayland::xdg_toplevel_drag_manager_v1::interface()->name)) { mGlobals.xdgToplevelDragManager.reset( - new WithDestructor(registry, id, 1)); + new WithDestructor(registry, id, 1)); } mRegistryGlobals.append(RegistryGlobal(id, interface, version, registry)); diff --git a/src/plugins/platforms/wayland/qwaylanddisplay_p.h b/src/plugins/platforms/wayland/qwaylanddisplay_p.h index e647f41c035..23452492577 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay_p.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay_p.h @@ -54,7 +54,7 @@ namespace QtWayland { class wp_cursor_shape_manager_v1; class wp_fractional_scale_manager_v1; class wp_viewporter; - class qt_toplevel_drag_manager_v1; + class xdg_toplevel_drag_manager_v1; } namespace QtWaylandClient { @@ -125,7 +125,10 @@ public: QWaylandCursor *waylandCursor(); QWaylandCursorTheme *loadCursorTheme(const QString &name, int pixelSize); #endif - struct wl_display *wl_display() const { return mDisplay; } + struct wl_display *wl_display() const + { + return mDisplay; + } struct ::wl_registry *wl_registry() { return object(); } QtWayland::wl_compositor *compositor() @@ -202,7 +205,7 @@ public: { return mGlobals.cursorShapeManager.get(); } - QtWayland::qt_toplevel_drag_manager_v1 *xdgToplevelDragManager() const + QtWayland::xdg_toplevel_drag_manager_v1 *xdgToplevelDragManager() const { return mGlobals.xdgToplevelDragManager.get(); } @@ -281,7 +284,6 @@ private: RegistryListener listener = nullptr; void *data = nullptr; }; - struct wl_display *mDisplay = nullptr; std::unique_ptr m_eventThread; wl_event_queue *m_frameEventQueue = nullptr; @@ -341,7 +343,7 @@ private: std::unique_ptr viewporter; std::unique_ptr fractionalScaleManager; std::unique_ptr cursorShapeManager; - std::unique_ptr xdgToplevelDragManager; + std::unique_ptr xdgToplevelDragManager; } mGlobals; int mFd = -1; int mWritableNotificationFd = -1; From 575448a77a211101e73661179d40a32dd5c823b8 Mon Sep 17 00:00:00 2001 From: Inho Lee Date: Fri, 2 Feb 2024 10:32:17 +0100 Subject: [PATCH 1295/1507] QtTextInputMethod: hide inputPanel when focus leaving When focusObject is changed, hide the input panel if input method is not accepted. Fixes: QTBUG-116600 Pick-to: 6.7 6.6 6.5 Change-Id: I50b5d051eea6f85365d8bc9aeadb46d8d866e362 Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/plugins/platforms/wayland/qwaylandinputmethodcontext.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/plugins/platforms/wayland/qwaylandinputmethodcontext.cpp b/src/plugins/platforms/wayland/qwaylandinputmethodcontext.cpp index 657208efbf1..2733e4f3aab 100644 --- a/src/plugins/platforms/wayland/qwaylandinputmethodcontext.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputmethodcontext.cpp @@ -362,6 +362,9 @@ void QWaylandInputMethodContext::setFocusObject(QObject *) if (inputMethod == nullptr) return; + if (inputMethod->isVisible() && !inputMethodAccepted()) + inputMethod->hide_input_panel(); + QWindow *window = QGuiApplication::focusWindow(); if (m_currentWindow != nullptr && m_currentWindow->handle() != nullptr) { From fc63491355cc262f7e67dd9456ea3241aa3c45db Mon Sep 17 00:00:00 2001 From: Inho Lee Date: Fri, 2 Feb 2024 12:36:08 +0100 Subject: [PATCH 1296/1507] Remove redundant calls, textInput() It is used repeatedly. Normally it can be optimized by a compiler but it might be helpful to see what it is by the name, inputInterface. Pick-to: 6.7 6.6 6.5 Change-Id: I7f4988674d7249c84b1321e69146dfd92189f142 Reviewed-by: David Edmundson --- .../wayland/qwaylandinputcontext.cpp | 63 +++++++++++-------- 1 file changed, 37 insertions(+), 26 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandinputcontext.cpp b/src/plugins/platforms/wayland/qwaylandinputcontext.cpp index 4b6a34c6bf5..a38bb9a0a15 100644 --- a/src/plugins/platforms/wayland/qwaylandinputcontext.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputcontext.cpp @@ -48,20 +48,22 @@ void QWaylandInputContext::reset() QPlatformInputContext::reset(); - if (!textInput()) + QWaylandTextInputInterface *inputInterface = textInput(); + if (!inputInterface) return; - textInput()->reset(); + inputInterface->reset(); } void QWaylandInputContext::commit() { qCDebug(qLcQpaInputMethods) << Q_FUNC_INFO; - if (!textInput()) + QWaylandTextInputInterface *inputInterface = textInput(); + if (!inputInterface) return; - textInput()->commit(); + inputInterface->commit(); } static ::wl_surface *surfaceForWindow(QWindow *window) @@ -77,92 +79,100 @@ void QWaylandInputContext::update(Qt::InputMethodQueries queries) { qCDebug(qLcQpaInputMethods) << Q_FUNC_INFO << queries; - if (!QGuiApplication::focusObject() || !textInput()) + QWaylandTextInputInterface *inputInterface = textInput(); + if (!QGuiApplication::focusObject() || !inputInterface) return; auto *currentSurface = surfaceForWindow(mCurrentWindow); if (currentSurface && !inputMethodAccepted()) { - textInput()->disableSurface(currentSurface); + inputInterface->disableSurface(currentSurface); mCurrentWindow.clear(); } else if (!currentSurface && inputMethodAccepted()) { QWindow *window = QGuiApplication::focusWindow(); if (auto *focusSurface = surfaceForWindow(window)) { - textInput()->enableSurface(focusSurface); + inputInterface->enableSurface(focusSurface); mCurrentWindow = window; } } - textInput()->updateState(queries, QWaylandTextInputInterface::update_state_change); + inputInterface->updateState(queries, QWaylandTextInputInterface::update_state_change); } void QWaylandInputContext::invokeAction(QInputMethod::Action action, int cursorPostion) { - if (!textInput()) + QWaylandTextInputInterface *inputInterface = textInput(); + if (!inputInterface) return; if (action == QInputMethod::Click) - textInput()->setCursorInsidePreedit(cursorPostion); + inputInterface->setCursorInsidePreedit(cursorPostion); } void QWaylandInputContext::showInputPanel() { qCDebug(qLcQpaInputMethods) << Q_FUNC_INFO; - if (!textInput()) + QWaylandTextInputInterface *inputInterface = textInput(); + if (!inputInterface) return; - textInput()->showInputPanel(); + inputInterface->showInputPanel(); } void QWaylandInputContext::hideInputPanel() { qCDebug(qLcQpaInputMethods) << Q_FUNC_INFO; - if (!textInput()) + QWaylandTextInputInterface *inputInterface = textInput(); + if (!inputInterface) return; - textInput()->hideInputPanel(); + inputInterface->hideInputPanel(); } bool QWaylandInputContext::isInputPanelVisible() const { qCDebug(qLcQpaInputMethods) << Q_FUNC_INFO; - if (!textInput()) + QWaylandTextInputInterface *inputInterface = textInput(); + if (!inputInterface) return QPlatformInputContext::isInputPanelVisible(); - return textInput()->isInputPanelVisible(); + return inputInterface->isInputPanelVisible(); } QRectF QWaylandInputContext::keyboardRect() const { qCDebug(qLcQpaInputMethods) << Q_FUNC_INFO; - if (!textInput()) + QWaylandTextInputInterface *inputInterface = textInput(); + if (!inputInterface) return QPlatformInputContext::keyboardRect(); - return textInput()->keyboardRect(); + return inputInterface->keyboardRect(); } QLocale QWaylandInputContext::locale() const { qCDebug(qLcQpaInputMethods) << Q_FUNC_INFO; - if (!textInput()) + QWaylandTextInputInterface *inputInterface = textInput(); + if (!inputInterface) return QPlatformInputContext::locale(); - return textInput()->locale(); + return inputInterface->locale(); } Qt::LayoutDirection QWaylandInputContext::inputDirection() const { qCDebug(qLcQpaInputMethods) << Q_FUNC_INFO; - if (!textInput()) + QWaylandTextInputInterface *inputInterface = textInput(); + if (!inputInterface) return QPlatformInputContext::inputDirection(); - return textInput()->inputDirection(); + return inputInterface->inputDirection(); } void QWaylandInputContext::setFocusObject(QObject *object) @@ -174,7 +184,8 @@ void QWaylandInputContext::setFocusObject(QObject *object) Q_UNUSED(object); #endif - if (!textInput()) + QWaylandTextInputInterface *inputInterface = textInput(); + if (!inputInterface) return; QWindow *window = QGuiApplication::focusWindow(); @@ -183,7 +194,7 @@ void QWaylandInputContext::setFocusObject(QObject *object) if (mCurrentWindow.data() != window || !inputMethodAccepted()) { auto *surface = static_cast(mCurrentWindow->handle())->wlSurface(); if (surface) - textInput()->disableSurface(surface); + inputInterface->disableSurface(surface); mCurrentWindow.clear(); } } @@ -192,11 +203,11 @@ void QWaylandInputContext::setFocusObject(QObject *object) if (mCurrentWindow.data() != window) { auto *surface = static_cast(window->handle())->wlSurface(); if (surface) { - textInput()->enableSurface(surface); + inputInterface->enableSurface(surface); mCurrentWindow = window; } } - textInput()->updateState(Qt::ImQueryAll, QWaylandTextInputInterface::update_state_enter); + inputInterface->updateState(Qt::ImQueryAll, QWaylandTextInputInterface::update_state_enter); } } From 88b3411b87bb34e1e29ead22797bf4e0e87fcebd Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Fri, 2 Feb 2024 13:59:00 +0200 Subject: [PATCH 1297/1507] Client: Map Qt::BusyCursor and Qt::WaitCursor to correct shape names This amends 883cfa228332465b6aa1023f0787927187c828e6. They are mapped vice versa. The wait cursor displays only an hourglass, while the busy cursor usually displays an arrow and an hourglass. Pick-to: 6.7 6.6 Change-Id: I449086f71b00993c061e8a56983c77925246dc37 Reviewed-by: David Edmundson --- src/plugins/platforms/wayland/qwaylandcursor.cpp | 4 ++-- tests/auto/wayland/cursor/tst_cursor.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandcursor.cpp b/src/plugins/platforms/wayland/qwaylandcursor.cpp index e7464ed8f9a..98d51a8425e 100644 --- a/src/plugins/platforms/wayland/qwaylandcursor.cpp +++ b/src/plugins/platforms/wayland/qwaylandcursor.cpp @@ -247,11 +247,11 @@ static QtWayland::wp_cursor_shape_device_v1::shape qtCursorShapeToWaylandShape(Q case Qt::SizeFDiagCursor: return wp_cursor_shape_device_v1::shape_nwse_resize; case Qt::WaitCursor: - return wp_cursor_shape_device_v1::shape_progress; + return wp_cursor_shape_device_v1::shape_wait; case Qt::SizeAllCursor: return wp_cursor_shape_device_v1::shape_all_scroll; case Qt::BusyCursor: - return wp_cursor_shape_device_v1::shape_wait; + return wp_cursor_shape_device_v1::shape_progress; case Qt::SplitVCursor: return wp_cursor_shape_device_v1::shape_row_resize; case Qt::ForbiddenCursor: diff --git a/tests/auto/wayland/cursor/tst_cursor.cpp b/tests/auto/wayland/cursor/tst_cursor.cpp index c86392b9563..8681eff1127 100644 --- a/tests/auto/wayland/cursor/tst_cursor.cpp +++ b/tests/auto/wayland/cursor/tst_cursor.cpp @@ -65,7 +65,7 @@ void tst_cursor::setCursor() QCOMPARE(setCursorShapeSpy.takeFirst().at(0).toUInt(), enterSerial); // client sets a different shape - window.setCursor(QCursor(Qt::BusyCursor)); + window.setCursor(QCursor(Qt::WaitCursor)); QVERIFY(setCursorShapeSpy.wait()); QCOMPOSITOR_COMPARE(cursorShape()->m_currentShape, CursorShapeDevice::shape_wait); @@ -88,7 +88,7 @@ void tst_cursor::setCursor() // set a shape again window.setCursor(QCursor(Qt::BusyCursor)); QVERIFY(setCursorShapeSpy.wait()); - QCOMPOSITOR_COMPARE(cursorShape()->m_currentShape, CursorShapeDevice::shape_wait); + QCOMPOSITOR_COMPARE(cursorShape()->m_currentShape, CursorShapeDevice::shape_progress); setCursorShapeSpy.clear(); From 6529e2386fa05c4366f122c721f3a9727af8e9b9 Mon Sep 17 00:00:00 2001 From: Weng Xuetian Date: Sun, 11 Feb 2024 15:30:42 -0800 Subject: [PATCH 1298/1507] Prefer text-input-v2 over text-input-v3 for now Qt's current text-input-v3 is converted from text-input-v4, but it's current state is poor and does not support the same feature like v2. KWin is the only major party that implements text-input-v2 and many feature e.g. Plasma-mobile would require v2 feature to provide the complete support. Until v3 is as good as v2, prefer v2 over v3 should provide a smoother experience on KWin (for both 5/6) out of box and won't affect other compositor. Pick-to: 6.7 Change-Id: Iebfe20cfd61f4a96018c4d41a9c4c706b18c7199 Reviewed-by: David Edmundson --- src/plugins/platforms/wayland/qwaylanddisplay.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index da29980c702..7bc8d18894e 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -558,13 +558,17 @@ void QWaylandDisplay::blockingReadEvents() void QWaylandDisplay::checkTextInputProtocol() { QStringList tips, timps; // for text input protocols and text input manager protocols + // zwp_text_input_v2 is preferred over zwp_text_input_v3 because: + // - Currently, v3 is not as feature rich as v2. + // - While v2 is not upstreamed, it is well supported by KWin since Plasma 5 and Plasma + // Mobile uses some v2 only. tips << QLatin1String(QtWayland::qt_text_input_method_v1::interface()->name) - << QLatin1String(QtWayland::zwp_text_input_v3::interface()->name) << QLatin1String(QtWayland::zwp_text_input_v2::interface()->name) + << QLatin1String(QtWayland::zwp_text_input_v3::interface()->name) << QLatin1String(QtWayland::zwp_text_input_v1::interface()->name); timps << QLatin1String(QtWayland::qt_text_input_method_manager_v1::interface()->name) - << QLatin1String(QtWayland::zwp_text_input_manager_v3::interface()->name) << QLatin1String(QtWayland::zwp_text_input_manager_v2::interface()->name) + << QLatin1String(QtWayland::zwp_text_input_manager_v3::interface()->name) << QLatin1String(QtWayland::zwp_text_input_manager_v1::interface()->name); QString tiProtocols = QString::fromLocal8Bit(qgetenv("QT_WAYLAND_TEXT_INPUT_PROTOCOL")); From 468e59f478ebcc81109c66db4bc77948e14d3676 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Thu, 8 Feb 2024 08:51:27 +0100 Subject: [PATCH 1299/1507] doc: Add documentation for cmake functions This adds documentation for the cmake functions used to generate binding code for protocol extensions. Since the Wayland Client library did not have any documentation landing page, it also adds that. This currently only links to the cmake function, but it can be extended to include other APIs later if we add them. Pick-to: 6.7 Fixes: QTBUG-114147 Change-Id: I07d8dbe3bc32e5845482fe3e69ec6ba94897331b Reviewed-by: Alexandru Croitor --- src/plugins/platforms/wayland/CMakeLists.txt | 4 ++ .../wayland/doc/qtwaylandclient.qdocconf | 31 +++++++++++++ ...erate_wayland_protocol_client_sources.qdoc | 45 +++++++++++++++++++ .../doc/src/qtwaylandclient-overview.qdoc | 36 +++++++++++++++ 4 files changed, 116 insertions(+) create mode 100644 src/plugins/platforms/wayland/doc/qtwaylandclient.qdocconf create mode 100644 src/plugins/platforms/wayland/doc/src/cmake/qt_generate_wayland_protocol_client_sources.qdoc create mode 100644 src/plugins/platforms/wayland/doc/src/qtwaylandclient-overview.qdoc diff --git a/src/plugins/platforms/wayland/CMakeLists.txt b/src/plugins/platforms/wayland/CMakeLists.txt index 6d986ce8b60..4916af81e08 100644 --- a/src/plugins/platforms/wayland/CMakeLists.txt +++ b/src/plugins/platforms/wayland/CMakeLists.txt @@ -163,5 +163,9 @@ qt_internal_extend_target(WaylandClient CONDITION QT_FEATURE_draganddrop qwaylanddnd.cpp qwaylanddnd_p.h ) +qt_internal_add_docs(WaylandClient + doc/qtwaylandclient.qdocconf +) + qt_record_extra_qt_main_tools_package_dependency(WaylandClient WaylandScannerTools "${PROJECT_VERSION}") qt_record_extra_qt_package_dependency(WaylandClient WaylandGlobalPrivate "${PROJECT_VERSION}") diff --git a/src/plugins/platforms/wayland/doc/qtwaylandclient.qdocconf b/src/plugins/platforms/wayland/doc/qtwaylandclient.qdocconf new file mode 100644 index 00000000000..20ceaef02de --- /dev/null +++ b/src/plugins/platforms/wayland/doc/qtwaylandclient.qdocconf @@ -0,0 +1,31 @@ +include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf) +include($QT_INSTALL_DOCS/config/exampleurl-qtwayland.qdocconf) + +project = QtWaylandClient +description = Qt Wayland Client Reference Documentation +version = $QT_VERSION + +qhp.projects = QtWaylandClient + +qhp.QtWaylandClient.file = qtwaylandclient.qhp +qhp.QtWaylandClient.namespace = org.qt-project.QtWaylandClient.$QT_VERSION_TAG +qhp.QtWaylandClient.virtualFolder = QtWaylandClient +qhp.QtWaylandClient.indexTitle = Qt Wayland Client +qhp.QtWaylandClient.indexRoot = + +depends += qtcore \ + qtqml \ + qtquick \ + qtdoc \ + qtcmake \ + qtwaylandcompositor + +headerdirs += \ + ../ +sourcedirs += \ + ../ + +navigation.landingpage = "Qt Wayland Client" + +# Enforce zero documentation warnings +warninglimit = 0 diff --git a/src/plugins/platforms/wayland/doc/src/cmake/qt_generate_wayland_protocol_client_sources.qdoc b/src/plugins/platforms/wayland/doc/src/cmake/qt_generate_wayland_protocol_client_sources.qdoc new file mode 100644 index 00000000000..97a7f7ed467 --- /dev/null +++ b/src/plugins/platforms/wayland/doc/src/cmake/qt_generate_wayland_protocol_client_sources.qdoc @@ -0,0 +1,45 @@ +// Copyright (C) 2024 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only + +/*! +\page qt-generate-wayland-protocol-client-sources.html +\ingroup cmake-commands-qtwaylandclient + +\title qt_generate_wayland_protocol_client_sources +\keyword qt6_generate_wayland_protocol_client_sources + +\summary {Generates client-side C++ bindings for a Wayland protocol .XML file} + +\cmakecommandsince 6.0 + +The command is defined in the \c WaylandClient component of the \c Qt6 package, which +can be loaded like so: + +\badcode +find_package(Qt6 REQUIRED COMPONENTS WaylandClient) +\endcode + +\section1 Synopsis + +\badcode +qt_generate_wayland_protocol_client_sources(target + FILES file1.xml [file2.xml ...]) +\endcode + +\versionlessCMakeCommandsNote qt6_generate_wayland_protocol_client_sources() + +\section1 Description + +qt_generate_wayland_protocol_client_sources() creates the build steps to run \c{waylandscanner} and +\c{qtwaylandscanner} on one or more Wayland protocol files. The tools will in turn generate binding +code in C and C++ for implementing the protocols, and the resulting files will be built as part +of the \c target. + +qt_generate_wayland_protocol_client_sources() will trigger generation of the files needed to +implement the client side of the protocol. \l{qt_generate_wayland_protocol_server_sources}{qt_generate_wayland_protocol_server_sources()} +is the equivalent function for the compositor. + +See the \l{Custom Shell} or \l{Custom Extension} examples for a demonstration of how to use these +functions. +*/ + diff --git a/src/plugins/platforms/wayland/doc/src/qtwaylandclient-overview.qdoc b/src/plugins/platforms/wayland/doc/src/qtwaylandclient-overview.qdoc new file mode 100644 index 00000000000..a6f5ce56a87 --- /dev/null +++ b/src/plugins/platforms/wayland/doc/src/qtwaylandclient-overview.qdoc @@ -0,0 +1,36 @@ +// Copyright (C) 2024 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only + +/*! + \page qtwaylandclient-index.html + \title Qt Wayland Client + \brief Library to enable connecting to a Wayland compositor as a client + + The Qt Wayland Client library provides the necessary functions for an application to act + as a \l {https://wayland.freedesktop.org/}{Wayland} client and connect to a Wayland compositor. + For most use cases, the library is used automatically through the Wayland QPA plugin, and there is + no need for the application itself to use any functions from the library. + + However, when paired with \l{Qt Wayland Compositor}, the cmake function + \l{qt_generate_wayland_protocol_client_sources}{qt_generate_wayland_protocol_client_sources()} + can be used to create custom protocol extensions. + + \section1 Licenses and Attributions + + Qt Wayland Compositor and the Qt Wayland integration plugin + are available under commercial licenses from \l{The Qt Company}. + + In addition, Qt Wayland Compositor is available under the + \l{GNU General Public License, version 3}, while + the Qt Wayland integration plugin is available under the + \l{GNU Lesser General Public License, version 3} or the + \l{GNU General Public License, version 2}. + + See \l{Qt Licensing} for further details. + + Qt Wayland Compositor and the Qt Wayland integration plugin + use protocol definitions under following permissive licenses: + + \generatelist{groupsbymodule attributions-qtwaylandcompositor} + +*/ From a96b58798e957395a0e5e54f2b160859d9f9c58e Mon Sep 17 00:00:00 2001 From: Kai Uwe Broulik Date: Mon, 8 Jan 2024 14:25:19 +0100 Subject: [PATCH 1300/1507] QWaylandShmBackingStore: Split buffer preparation into dedicated method Drop "resize(QRect)" since it is ambiguous with the resize coming from QPlatformBackingStore. This allows to ensure a back buffer from multiple places, such as the upcoming "scroll" support. Change-Id: I43a5ece2d0e25e64b41335ba59b2b8c4ffcfff74 Reviewed-by: David Edmundson --- .../wayland/qwaylandshmbackingstore.cpp | 17 ++++++----------- .../wayland/qwaylandshmbackingstore_p.h | 3 +-- .../platforms/wayland/qwaylandwindow.cpp | 6 ++++-- 3 files changed, 11 insertions(+), 15 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp b/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp index 723b264d518..a1e9e0e4a34 100644 --- a/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp +++ b/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp @@ -144,9 +144,9 @@ QWaylandShmBackingStore::QWaylandShmBackingStore(QWindow *window, QWaylandDispla // contents from the back buffer mBuffers.clear(); mFrontBuffer = nullptr; - // resize always resets mBackBuffer + // ensureBackBuffer always resets mBackBuffer if (mRequestedSize.isValid() && waylandWindow()) - resize(mRequestedSize); + ensureBackBuffer(); qDeleteAll(copy); }); } @@ -180,7 +180,8 @@ void QWaylandShmBackingStore::updateDirtyStates(const QRegion ®ion) void QWaylandShmBackingStore::beginPaint(const QRegion ®ion) { mPainting = true; - ensureSize(); + waylandWindow()->setBackingStore(this); + ensureBackBuffer(); const QMargins margins = windowDecorationMargins(); updateDirtyStates(region.translated(margins.left(), margins.top())); @@ -201,12 +202,6 @@ void QWaylandShmBackingStore::endPaint() flush(window(), mPendingRegion, QPoint()); } -void QWaylandShmBackingStore::ensureSize() -{ - waylandWindow()->setBackingStore(this); - resize(mRequestedSize); -} - void QWaylandShmBackingStore::flush(QWindow *window, const QRegion ®ion, const QPoint &offset) { // Invoked when the window is of type RasterSurface or when the window is @@ -269,11 +264,11 @@ QWaylandShmBuffer *QWaylandShmBackingStore::getBuffer(const QSize &size) return nullptr; } -void QWaylandShmBackingStore::resize(const QSize &size) +void QWaylandShmBackingStore::ensureBackBuffer() { QMargins margins = windowDecorationMargins(); qreal scale = waylandWindow()->scale(); - QSize sizeWithMargins = (size + QSize(margins.left()+margins.right(),margins.top()+margins.bottom())) * scale; + const QSize sizeWithMargins = (mRequestedSize + QSize(margins.left() + margins.right(), margins.top() + margins.bottom())) * scale; // We look for a free buffer to draw into. If the buffer is not the last buffer we used, // that is mBackBuffer, and the size is the same we copy the damaged content into the new diff --git a/src/plugins/platforms/wayland/qwaylandshmbackingstore_p.h b/src/plugins/platforms/wayland/qwaylandshmbackingstore_p.h index 8c7b83dbb48..78889336010 100644 --- a/src/plugins/platforms/wayland/qwaylandshmbackingstore_p.h +++ b/src/plugins/platforms/wayland/qwaylandshmbackingstore_p.h @@ -61,7 +61,6 @@ public: QPaintDevice *paintDevice() override; void flush(QWindow *window, const QRegion ®ion, const QPoint &offset) override; void resize(const QSize &size, const QRegion &staticContents) override; - void resize(const QSize &size); void beginPaint(const QRegion ®ion) override; void endPaint() override; @@ -70,7 +69,7 @@ public: QMargins windowDecorationMargins() const; QImage *entireSurface() const; QImage *contentSurface() const; - void ensureSize(); + void ensureBackBuffer(); QWaylandWindow *waylandWindow() const; void iterateBuffer(); diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 7bc79eb8abd..bb33a747f6a 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -90,8 +90,10 @@ QWaylandWindow::~QWaylandWindow() void QWaylandWindow::ensureSize() { - if (mBackingStore) - mBackingStore->ensureSize(); + if (mBackingStore) { + setBackingStore(mBackingStore); + mBackingStore->ensureBackBuffer(); + } } void QWaylandWindow::initWindow() From 55d8e220171cd04b02d8a2cd0af045bffdcfcc38 Mon Sep 17 00:00:00 2001 From: Ahmad Samir Date: Tue, 22 Aug 2023 20:04:04 +0300 Subject: [PATCH 1301/1507] Mark the whole repo with QT_NO_CONTEXTLESS_CONNECT By adding it to the default build flags via .cmake.conf. tst_primaryselectionv1 and tst_datadevicev1: the connection type needs to be explicitly set to DirectConnection, otherwise the test fails. The sender and receiver are the same object, so typically would be in the same thread. The docs say: "If the receiver lives in the thread that emits the signal, Qt::DirectConnection is used." I suspect because the code is running inside CoreCompositor::exec() the signaling thread is different from the thread the objects live in, so leaving the type as AutoConnection when sender/receiver are the same object doesn't lead to the type becoming DirectConnection. Task-number: QTBUG-116296 Change-Id: Iad49889134a78fa723973ba6efbc237038f35b82 Reviewed-by: David Edmundson --- .../wayland/datadevicev1/tst_datadevicev1.cpp | 16 ++++++++-------- .../tst_primaryselectionv1.cpp | 10 +++++----- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/tests/auto/wayland/datadevicev1/tst_datadevicev1.cpp b/tests/auto/wayland/datadevicev1/tst_datadevicev1.cpp index 3464d0d7861..ef966b9c9d3 100644 --- a/tests/auto/wayland/datadevicev1/tst_datadevicev1.cpp +++ b/tests/auto/wayland/datadevicev1/tst_datadevicev1.cpp @@ -65,13 +65,13 @@ void tst_datadevicev1::pasteAscii() exec([&] { auto *client = xdgSurface()->resource()->client(); auto *offer = dataDevice()->sendDataOffer(client, {"text/plain"}); - connect(offer, &DataOffer::receive, [](QString mimeType, int fd) { + connect(offer, &DataOffer::receive, offer, [](QString mimeType, int fd) { QFile file; file.open(fd, QIODevice::WriteOnly, QFile::FileHandleFlag::AutoCloseHandle); QCOMPARE(mimeType, "text/plain"); file.write(QByteArray("normal ascii")); file.close(); - }); + }, Qt::DirectConnection); dataDevice()->sendSelection(offer); auto *surface = xdgSurface()->m_surface; @@ -103,13 +103,13 @@ void tst_datadevicev1::pasteUtf8() exec([&] { auto *client = xdgSurface()->resource()->client(); auto *offer = dataDevice()->sendDataOffer(client, {"text/plain", "text/plain;charset=utf-8"}); - connect(offer, &DataOffer::receive, [](QString mimeType, int fd) { + connect(offer, &DataOffer::receive, offer, [](QString mimeType, int fd) { QFile file; file.open(fd, QIODevice::WriteOnly, QFile::FileHandleFlag::AutoCloseHandle); QCOMPARE(mimeType, "text/plain;charset=utf-8"); file.write(QByteArray("face with tears of joy: 😂")); file.close(); - }); + }, Qt::DirectConnection); dataDevice()->sendSelection(offer); auto *surface = xdgSurface()->m_surface; @@ -141,7 +141,7 @@ void tst_datadevicev1::pasteMozUrl() exec([&] { auto *client = xdgSurface()->resource()->client(); auto *offer = dataDevice()->sendDataOffer(client, {"text/x-moz-url"}); - connect(offer, &DataOffer::receive, [](QString mimeType, int fd) { + connect(offer, &DataOffer::receive, offer, [](QString mimeType, int fd) { QFile file; file.open(fd, QIODevice::WriteOnly, QFile::FileHandleFlag::AutoCloseHandle); QCOMPARE(mimeType, "text/x-moz-url"); @@ -149,7 +149,7 @@ void tst_datadevicev1::pasteMozUrl() // Need UTF-16. file.write(reinterpret_cast(content.data()), content.size() * 2); file.close(); - }); + }, Qt::DirectConnection); dataDevice()->sendSelection(offer); auto *surface = xdgSurface()->m_surface; @@ -184,14 +184,14 @@ void tst_datadevicev1::pasteSingleUtf8MozUrl() exec([&] { auto *client = xdgSurface()->resource()->client(); auto *offer = dataDevice()->sendDataOffer(client, {"text/x-moz-url"}); - connect(offer, &DataOffer::receive, [](QString mimeType, int fd) { + connect(offer, &DataOffer::receive, offer, [](QString mimeType, int fd) { QFile file; file.open(fd, QIODevice::WriteOnly, QFile::FileHandleFlag::AutoCloseHandle); QCOMPARE(mimeType, "text/x-moz-url"); const QString content("https://www.qt.io/"); file.write(content.toUtf8()); file.close(); - }); + }, Qt::DirectConnection); dataDevice()->sendSelection(offer); auto *surface = xdgSurface()->m_surface; diff --git a/tests/auto/wayland/primaryselectionv1/tst_primaryselectionv1.cpp b/tests/auto/wayland/primaryselectionv1/tst_primaryselectionv1.cpp index d9e4ff295b6..b5539f1f09e 100644 --- a/tests/auto/wayland/primaryselectionv1/tst_primaryselectionv1.cpp +++ b/tests/auto/wayland/primaryselectionv1/tst_primaryselectionv1.cpp @@ -290,13 +290,13 @@ void tst_primaryselectionv1::pasteAscii() auto *device = primarySelectionDevice(); auto *offer = device->sendDataOffer({"text/plain"}); - connect(offer, &PrimarySelectionOfferV1::receive, [](QString mimeType, int fd) { + connect(offer, &PrimarySelectionOfferV1::receive, offer, [](QString mimeType, int fd) { QFile file; file.open(fd, QIODevice::WriteOnly, QFile::FileHandleFlag::AutoCloseHandle); QCOMPARE(mimeType, "text/plain"); file.write(QByteArray("normal ascii")); file.close(); - }); + }, Qt::DirectConnection); device->sendSelection(offer); pointer()->sendEnter(surface, {32, 32}); @@ -336,13 +336,13 @@ void tst_primaryselectionv1::pasteUtf8() auto *device = primarySelectionDevice(); auto *offer = device->sendDataOffer({"text/plain", "text/plain;charset=utf-8"}); - connect(offer, &PrimarySelectionOfferV1::receive, [](QString mimeType, int fd) { + connect(offer, &PrimarySelectionOfferV1::receive, offer, [](QString mimeType, int fd) { QFile file; file.open(fd, QIODevice::WriteOnly, QFile::FileHandleFlag::AutoCloseHandle); QCOMPARE(mimeType, "text/plain;charset=utf-8"); file.write(QByteArray("face with tears of joy: 😂")); file.close(); - }); + }, Qt::DirectConnection); device->sendSelection(offer); pointer()->sendEnter(surface, {32, 32}); @@ -464,7 +464,7 @@ void tst_primaryselectionv1::copy() pastedBuf.append(buf, n); } }); - }); + }, Qt::DirectConnection); }); QCOMPOSITOR_TRY_VERIFY(pastedBuf.size()); // this assumes we got everything in one read From ef30575d374e8244420a56f3879962146b23b371 Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Wed, 13 Dec 2023 12:43:27 +0000 Subject: [PATCH 1302/1507] client: Fix xdg shell setting only a minimum size hint An unbound maximum size is sent across the protocol as 0. We need to make this change before the check that the minimum size is less than the maximum size. This fixes having only a minimum size set. This bug is currently masked by the platform forcefully applying the minimum size. Pick-to: 6.6 Pick-to: 6.7 Change-Id: Ifca4fa01e4c2ac1c34aeb72db1584e4a868d50bc Reviewed-by: Eskil Abrahamsen Blomfeldt Reviewed-by: Vlad Zahorodnii --- .../xdg-shell/qwaylandxdgshell.cpp | 9 +-- tests/auto/wayland/xdgshell/tst_xdgshell.cpp | 59 ++++++++++++++++--- 2 files changed, 55 insertions(+), 13 deletions(-) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp index 57370f3595b..566a0ff47e9 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp @@ -424,15 +424,16 @@ void QWaylandXdgSurface::setSizeHints() const int minHeight = qMax(0, minSize.height()); int maxWidth = qMax(0, maxSize.width()); int maxHeight = qMax(0, maxSize.height()); - if (maxWidth == QWINDOWSIZE_MAX) - maxWidth = 0; - if (maxHeight == QWINDOWSIZE_MAX) - maxHeight = 0; // It will not change min/max sizes if invalid. if (minWidth > maxWidth || minHeight > maxHeight) return; + if (maxWidth == QWINDOWSIZE_MAX) + maxWidth = 0; + if (maxHeight == QWINDOWSIZE_MAX) + maxHeight = 0; + m_toplevel->set_min_size(minWidth, minHeight); m_toplevel->set_max_size(maxWidth, maxHeight); } diff --git a/tests/auto/wayland/xdgshell/tst_xdgshell.cpp b/tests/auto/wayland/xdgshell/tst_xdgshell.cpp index edc1c0fea3a..a3e96d444d8 100644 --- a/tests/auto/wayland/xdgshell/tst_xdgshell.cpp +++ b/tests/auto/wayland/xdgshell/tst_xdgshell.cpp @@ -27,6 +27,7 @@ private slots: void switchPopups(); void hidePopupParent(); void pongs(); + void minMaxSize_data(); void minMaxSize(); void windowGeometry(); void foreignSurface(); @@ -609,12 +610,47 @@ void tst_xdgshell::pongs() QCOMPARE(pongSpy.first().at(0).toUInt(), serial); } +void tst_xdgshell::minMaxSize_data() +{ + QTest::addColumn("initialMinSize"); + QTest::addColumn("initialMaxSize"); + QTest::addColumn("nextMinSize"); + QTest::addColumn("nextMaxSize"); + QTest::addColumn("expectedInitialMinSize"); + QTest::addColumn("expectedInitialMaxSize"); + QTest::addColumn("expectedNextMinSize"); + QTest::addColumn("expectedNextMaxSize"); + + QTest::newRow("onlyMinSize") << QSize(50, 60) << QSize() << QSize(500, 600) << QSize() + << QSize(50, 60) << QSize(0, 0) << QSize(500, 600) << QSize(0, 0); + + QTest::newRow("onlyMaxSize") << QSize() << QSize(70, 80) << QSize() << QSize(700, 800) + << QSize(0,0 ) << QSize(70, 80) << QSize(0, 0) << QSize(700, 800); + + QTest::newRow("maxIsSentAsZero") << QSize() << QSize(QWINDOWSIZE_MAX, QWINDOWSIZE_MAX) << QSize() << QSize() + << QSize(0,0 ) << QSize(0, 0) << QSize(0, 0) << QSize(0, 0); + + + QTest::newRow("fullHints") << QSize(50, 60) << QSize(700, 800) << QSize(500, 600) << QSize(710, 810) + << QSize(50, 60) << QSize(700, 800) << QSize(500, 600) << QSize(710, 810); + + // setting a minimum above the maximum is not allowed, we should no-op + QTest::newRow("invalidResize") << QSize(50, 60) << QSize(100, 100) << QSize(500, 600) << QSize(100, 100) + << QSize(50, 60) << QSize(100, 100) << QSize(50, 60) << QSize(100, 100);} + void tst_xdgshell::minMaxSize() { + QFETCH(QSize, initialMinSize); + QFETCH(QSize, initialMaxSize); + + QFETCH(QSize, expectedInitialMinSize); + QFETCH(QSize, expectedInitialMaxSize); + QRasterWindow window; - window.setMinimumSize(QSize(100, 100)); - window.setMaximumSize(QSize(1000, 1000)); - window.resize(400, 320); + if (initialMinSize.isValid()) + window.setMinimumSize(initialMinSize); + if (initialMaxSize.isValid()) + window.setMaximumSize(initialMaxSize); window.show(); QCOMPOSITOR_TRY_VERIFY(xdgToplevel()); @@ -622,16 +658,21 @@ void tst_xdgshell::minMaxSize() // we don't roundtrip with our configuration the initial commit should be correct - QCOMPOSITOR_TRY_COMPARE(xdgToplevel()->m_committed.minSize, QSize(100, 100)); - QCOMPOSITOR_TRY_COMPARE(xdgToplevel()->m_committed.maxSize, QSize(1000, 1000)); + QCOMPOSITOR_TRY_COMPARE(xdgToplevel()->m_committed.minSize, expectedInitialMinSize); + QCOMPOSITOR_TRY_COMPARE(xdgToplevel()->m_committed.maxSize, expectedInitialMaxSize); - window.setMaximumSize(QSize(500, 400)); + QFETCH(QSize, nextMinSize); + QFETCH(QSize, expectedNextMinSize); + window.setMinimumSize(nextMinSize); window.update(); - QCOMPOSITOR_TRY_COMPARE(xdgToplevel()->m_committed.maxSize, QSize(500, 400)); + QCOMPOSITOR_TRY_COMPARE(xdgToplevel()->m_committed.minSize, expectedNextMinSize); - window.setMinimumSize(QSize(50, 40)); + QFETCH(QSize, nextMaxSize); + QFETCH(QSize, expectedNextMaxSize); + + window.setMaximumSize(nextMaxSize); window.update(); - QCOMPOSITOR_TRY_COMPARE(xdgToplevel()->m_committed.minSize, QSize(50, 40)); + QCOMPOSITOR_TRY_COMPARE(xdgToplevel()->m_committed.maxSize, expectedNextMaxSize); } void tst_xdgshell::windowGeometry() From 00fc00115dd80bee27a7431831288ef1b4467f7c Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Mon, 30 Oct 2023 16:29:45 +0000 Subject: [PATCH 1303/1507] client: Support Xdg activation across shell surfaces XDG activation operates on wl_surfaces, which can be used on all shell types. For the case of self activation there is was cast to the xdg shellintegration on the focused window in order to populate the appId. Only this part needs to be guarded, not the whole activation. Pick-to: 6.6 Pick-to: 6.7 Change-Id: If44cc800b7cd98141ba05ba5d1cf0812ef777e7a Reviewed-by: Eskil Abrahamsen Blomfeldt Reviewed-by: Marco Martin Reviewed-by: David Redondo --- .../xdg-shell/qwaylandxdgshell.cpp | 25 +++++++++++-------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp index 566a0ff47e9..45714e2fecc 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp @@ -637,17 +637,20 @@ bool QWaylandXdgSurface::requestActivate() // focus stealing prevention indication, so requestXdgActivationToken call // is still necessary in that case. const auto wlWindow = focusWindow ? static_cast(focusWindow->handle()) : m_window; - if (const auto xdgSurface = qobject_cast(wlWindow->shellSurface())) { - if (const auto seat = wlWindow->display()->lastInputDevice()) { - const auto tokenProvider = activation->requestXdgActivationToken( - wlWindow->display(), wlWindow->wlSurface(), seat->serial(), xdgSurface->m_appId); - connect(tokenProvider, &QWaylandXdgActivationTokenV1::done, this, - [this, tokenProvider](const QString &token) { - m_shell->activation()->activate(token, window()->wlSurface()); - tokenProvider->deleteLater(); - }); - return true; - } + + QString appId; + if (const auto xdgSurface = qobject_cast(wlWindow->shellSurface())) + appId = xdgSurface->m_appId; + + if (const auto seat = wlWindow->display()->lastInputDevice()) { + const auto tokenProvider = activation->requestXdgActivationToken( + wlWindow->display(), wlWindow->wlSurface(), seat->serial(), appId); + connect(tokenProvider, &QWaylandXdgActivationTokenV1::done, this, + [this, tokenProvider](const QString &token) { + m_shell->activation()->activate(token, window()->wlSurface()); + tokenProvider->deleteLater(); + }); + return true; } } } From 9d0b3cf0d2b35261058865ea068cc198c53c78cf Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Fri, 19 Jan 2024 13:43:08 +0200 Subject: [PATCH 1304/1507] Client: Emit wlSurfaceDestroyed after actually destroying wl_surface MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit At the moment, the QWaylandWindow::wlSurfaceDestroyed signal is emitted before destroying the wl_surface object. It's the opposite of its name. Furthermore, the client code in Plasma assumes that the wlSurfaceDestroyed signal is emitted after the wl_surface is gone, but it isn't, which is the source of bugs. Technically, it's an API breaking change. But this ordering issue is quite annoying to deal in the client code and the QWaylandWindow native interface api lives in the Private namespace. [ChangeLog][QtWaylandClient][Important Behavior Changes] The QWaylandWindow::surfaceDestroyed() signal is emitted after actually destroying the wl_surface object. Change-Id: I33e27c06795653d3e20e04a36cb39be8c46797ee Reviewed-by: Tor Arne Vestbø --- .../platforms/wayland/qwaylandwindow.cpp | 26 ++++++++++--------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index bb33a747f6a..4c8d2eedc66 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -283,19 +283,21 @@ void QWaylandWindow::reset() mTopPopup = mTransientParent && (mTransientParent->window()->type() == Qt::Popup) ? mTransientParent : nullptr; if (mSurface) { + { + QWriteLocker lock(&mSurfaceLock); + invalidateSurface(); + if (mTransientParent) + mTransientParent->removeChildPopup(this); + delete mShellSurface; + mShellSurface = nullptr; + delete mSubSurfaceWindow; + mSubSurfaceWindow = nullptr; + mTransientParent = nullptr; + mSurface.reset(); + mViewport.reset(); + mFractionalScale.reset(); + } emit wlSurfaceDestroyed(); - QWriteLocker lock(&mSurfaceLock); - invalidateSurface(); - if (mTransientParent) - mTransientParent->removeChildPopup(this); - delete mShellSurface; - mShellSurface = nullptr; - delete mSubSurfaceWindow; - mSubSurfaceWindow = nullptr; - mTransientParent = nullptr; - mSurface.reset(); - mViewport.reset(); - mFractionalScale.reset(); } { From 6b8be3a4a95f3861c6b2c5d62925cc03651a7ddd Mon Sep 17 00:00:00 2001 From: Kai Uwe Broulik Date: Tue, 20 Feb 2024 17:53:19 +0100 Subject: [PATCH 1305/1507] QWaylandDataDevice: Explicitly send null for rejected drag offer qtwaylandscanner sends an empty string for a null QString but `wl_data_offer.accept` uses null for "not accepted". Pick-to: 6.7 6.6 6.5 Change-Id: I793d4315c9775a4bdc63085231318db8df829c8a Reviewed-by: David Edmundson --- src/plugins/platforms/wayland/qwaylanddatadevice.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylanddatadevice.cpp b/src/plugins/platforms/wayland/qwaylanddatadevice.cpp index a59b201f670..a8d1748f268 100644 --- a/src/plugins/platforms/wayland/qwaylanddatadevice.cpp +++ b/src/plugins/platforms/wayland/qwaylanddatadevice.cpp @@ -336,7 +336,8 @@ void QWaylandDataDevice::sendResponse(Qt::DropActions supportedActions, const QP m_dragOffer->accept(m_enterSerial, m_dragOffer->firstFormat()); } else { - m_dragOffer->accept(m_enterSerial, QString()); + // qtwaylandscanner doesn't support null strings yet (sends empty string), call it directly. + ::wl_data_offer_accept(m_dragOffer->object(), m_enterSerial, nullptr); } } From d82cbae72dddca47b03172fb820274aedd91fd46 Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Fri, 16 Feb 2024 11:38:01 +0000 Subject: [PATCH 1306/1507] client: Always call mShellSurface->setWindowGeometry regardless of exposure setWindowGeometry is called to tell shell surfaces when the window tries to request a new size. On XdgShell this should not be called before the window is exposed and we are attaching buffers, this check belongs in XdgShell itself as other shells may be using this for other purposes. Pick-to: 6.7 Change-Id: Iae09e71e1b5071fc8c1f3790ec1a260c3d6462ce Reviewed-by: Vlad Zahorodnii Reviewed-by: Eskil Abrahamsen Blomfeldt --- .../plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp | 3 ++- src/plugins/platforms/wayland/qwaylandwindow.cpp | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp index 45714e2fecc..977657e59f6 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp @@ -411,7 +411,8 @@ void QWaylandXdgSurface::propagateSizeHints() void QWaylandXdgSurface::setWindowGeometry(const QRect &rect) { - set_window_geometry(rect.x(), rect.y(), rect.width(), rect.height()); + if (window()->isExposed()) + set_window_geometry(rect.x(), rect.y(), rect.width(), rect.height()); } void QWaylandXdgSurface::setSizeHints() diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 4c8d2eedc66..f5a9fddb81a 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -453,7 +453,7 @@ void QWaylandWindow::setGeometry(const QRect &r) if (isExposed() && !mInResizeFromApplyConfigure && exposeGeometry != mLastExposeGeometry) sendExposeEvent(exposeGeometry); - if (mShellSurface && isExposed()) { + if (mShellSurface) { mShellSurface->setWindowGeometry(windowContentGeometry()); if (!qt_window_private(window())->positionAutomatic) mShellSurface->setWindowPosition(windowGeometry().topLeft()); From b0129c6af81eece4882774422352ccf99ab9cb34 Mon Sep 17 00:00:00 2001 From: David Redondo Date: Thu, 1 Feb 2024 13:40:27 +0100 Subject: [PATCH 1307/1507] Do not create new wl_pointer objects when creating pointer gestures get_pointer is the method belonging to QtWayland::wl_seat creating new wl_pointer instead of using the already existing one. Since they were tracked nowhere they where also leaked. Pick-to: 6.7 Change-Id: I0b9d1914ea6a9e7b379fad905a319bde5fd7f136 Reviewed-by: Vlad Zahorodnii Reviewed-by: David Edmundson --- src/plugins/platforms/wayland/qwaylandinputdevice.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index 988e37e3085..6f421febde7 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -448,9 +448,9 @@ void QWaylandInputDevice::seat_capabilities(uint32_t caps) MaxTouchPoints, 0, QString(), QPointingDeviceUniqueId(), this); QWindowSystemInterface::registerInputDevice(mTouchPadDevice); mPointerGesturePinch.reset(pointerGestures->createPointerGesturePinch(this)); - mPointerGesturePinch->init(pointerGestures->get_pinch_gesture(get_pointer())); + mPointerGesturePinch->init(pointerGestures->get_pinch_gesture(mPointer->object())); mPointerGestureSwipe.reset(pointerGestures->createPointerGestureSwipe(this)); - mPointerGestureSwipe->init(pointerGestures->get_swipe_gesture(get_pointer())); + mPointerGestureSwipe->init(pointerGestures->get_swipe_gesture(mPointer->object())); } } else if (!(caps & WL_SEAT_CAPABILITY_POINTER) && mPointer) { mPointer.reset(); From 75d324cbb9ad4f1c5781bf8b5f6c178b29030b70 Mon Sep 17 00:00:00 2001 From: Kai Uwe Broulik Date: Tue, 20 Feb 2024 17:03:50 +0100 Subject: [PATCH 1308/1507] qtwaylandscanner: Send null for a null QString with allow-null `toUtf8().constData()` on a null `QString` results in an empty string sent over the wire, which is distinct from `null` when the request has "allow-null" specified. Notably `wl_data_offer.accept` uses a null mime_type for "not accepted". [ChangeLog][Important Behavior Changes][qtwaylandscanner] String arguments in a request will now send null rather than empty string for a null QString if the argument is declared with "allow-null". Change-Id: I4b78246e4da7b60680d7797fd6309755f44d2bb6 Reviewed-by: David Edmundson --- .../qtwaylandscanner/qtwaylandscanner.cpp | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp index 1b0a4a149ca..273a0012e09 100644 --- a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp +++ b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp @@ -196,7 +196,7 @@ Scanner::WaylandEvent Scanner::readEvent(QXmlStreamReader &xml, bool request) .type = byteArrayValue(xml, "type"), .interface = byteArrayValue(xml, "interface"), .summary = byteArrayValue(xml, "summary"), - .allowNull = boolValue(xml, "allowNull"), + .allowNull = boolValue(xml, "allow-null"), }; event.arguments.push_back(std::move(argument)); } @@ -937,9 +937,12 @@ bool Scanner::process() printf(",\n"); QByteArray cType = waylandToCType(a.type, a.interface); QByteArray qtType = waylandToQtType(a.type, a.interface, e.request); - if (a.type == "string") - printf(" %s.toUtf8().constData()", a.name.constData()); - else if (a.type == "array") + if (a.type == "string") { + printf(" "); + if (a.allowNull) + printf("%s.isNull() ? nullptr : ", a.name.constData()); + printf("%s.toUtf8().constData()", a.name.constData()); + } else if (a.type == "array") printf(" &%s_data", a.name.constData()); else if (cType == qtType) printf(" %s", a.name.constData()); @@ -1225,9 +1228,12 @@ bool Scanner::process() } else { QByteArray cType = waylandToCType(a.type, a.interface); QByteArray qtType = waylandToQtType(a.type, a.interface, e.request); - if (a.type == "string") - printf(" %s.toUtf8().constData()", a.name.constData()); - else if (a.type == "array") + if (a.type == "string") { + printf(" "); + if (a.allowNull) + printf("%s.isNull() ? nullptr : ", a.name.constData()); + printf("%s.toUtf8().constData()", a.name.constData()); + } else if (a.type == "array") printf(" &%s_data", a.name.constData()); else if (cType == qtType) printf(" %s", a.name.constData()); From 4b58d6ddceef951725667b910986ee81c3195fbd Mon Sep 17 00:00:00 2001 From: Volker Hilsheimer Date: Wed, 28 Feb 2024 16:54:04 +0100 Subject: [PATCH 1309/1507] De-blacklist tst_seatv4::animatedCursor test The test has no history of BFAIL outcomes for the last 6 months in the dev branch. Fixes: QTBUG-78317 Change-Id: I49742be9f3eac6463b066ede69e2cd143e1b35dd Reviewed-by: Qt CI Bot Reviewed-by: David Edmundson --- tests/auto/wayland/seatv4/BLACKLIST | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 tests/auto/wayland/seatv4/BLACKLIST diff --git a/tests/auto/wayland/seatv4/BLACKLIST b/tests/auto/wayland/seatv4/BLACKLIST deleted file mode 100644 index e3353940624..00000000000 --- a/tests/auto/wayland/seatv4/BLACKLIST +++ /dev/null @@ -1,3 +0,0 @@ -[animatedCursor] -b2qt -sles From 7de67b2db7e1fb6632039828678f0f8e6e92e91f Mon Sep 17 00:00:00 2001 From: Kai Uwe Broulik Date: Sat, 2 Mar 2024 09:25:58 +0000 Subject: [PATCH 1310/1507] Revert "QWaylandDataDevice: Explicitly send null for rejected drag offer" This reverts commit 6b8be3a4a95f3861c6b2c5d62925cc03651a7ddd. Reason for revert: QtWaylandScanner now sends null for a null QString when the argument is declared as allow-null Change-Id: I5b7e23285b300b76dabfd2999ab90e90e7328232 Reviewed-by: David Redondo --- src/plugins/platforms/wayland/qwaylanddatadevice.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylanddatadevice.cpp b/src/plugins/platforms/wayland/qwaylanddatadevice.cpp index a8d1748f268..a59b201f670 100644 --- a/src/plugins/platforms/wayland/qwaylanddatadevice.cpp +++ b/src/plugins/platforms/wayland/qwaylanddatadevice.cpp @@ -336,8 +336,7 @@ void QWaylandDataDevice::sendResponse(Qt::DropActions supportedActions, const QP m_dragOffer->accept(m_enterSerial, m_dragOffer->firstFormat()); } else { - // qtwaylandscanner doesn't support null strings yet (sends empty string), call it directly. - ::wl_data_offer_accept(m_dragOffer->object(), m_enterSerial, nullptr); + m_dragOffer->accept(m_enterSerial, QString()); } } From 5fb45c959079753f7a11cd7bb0fa0e5c1d9598f5 Mon Sep 17 00:00:00 2001 From: Kai Uwe Broulik Date: Mon, 8 Jan 2024 16:48:14 +0100 Subject: [PATCH 1311/1507] QWaylandShmBackingStore: Don't clear new buffers in beginPaint MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit QFile::resize done upon creation of the buffer already ensures the buffer is filled with zeroes, so there is no need to paint it transparent if the buffer had just been created. Change-Id: I73ab297f148987acf52a0e08c7dd1ca57f7255be Reviewed-by: Tor Arne Vestbø --- .../wayland/qwaylandshmbackingstore.cpp | 26 +++++++++++++------ .../wayland/qwaylandshmbackingstore_p.h | 4 +-- .../platforms/wayland/qwaylandwindow.cpp | 2 +- 3 files changed, 21 insertions(+), 11 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp b/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp index a1e9e0e4a34..d77c548a009 100644 --- a/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp +++ b/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp @@ -71,6 +71,7 @@ QWaylandShmBuffer::QWaylandShmBuffer(QWaylandDisplay *display, file->open(fd, QIODevice::ReadWrite | QIODevice::Unbuffered, QFile::AutoCloseHandle); filePointer.reset(file); } + // NOTE beginPaint assumes a new buffer be all zeroes, which QFile::resize does. if (!filePointer->isOpen() || !filePointer->resize(alloc)) { qWarning("QWaylandShmBuffer: failed: %s", qUtf8Printable(filePointer->errorString())); return; @@ -144,9 +145,9 @@ QWaylandShmBackingStore::QWaylandShmBackingStore(QWindow *window, QWaylandDispla // contents from the back buffer mBuffers.clear(); mFrontBuffer = nullptr; - // ensureBackBuffer always resets mBackBuffer + // recreateBackBufferIfNeeded always resets mBackBuffer if (mRequestedSize.isValid() && waylandWindow()) - ensureBackBuffer(); + recreateBackBufferIfNeeded(); qDeleteAll(copy); }); } @@ -181,12 +182,15 @@ void QWaylandShmBackingStore::beginPaint(const QRegion ®ion) { mPainting = true; waylandWindow()->setBackingStore(this); - ensureBackBuffer(); + const bool bufferWasRecreated = recreateBackBufferIfNeeded(); const QMargins margins = windowDecorationMargins(); updateDirtyStates(region.translated(margins.left(), margins.top())); - if (mBackBuffer->image()->hasAlphaChannel()) { + // Although undocumented, QBackingStore::beginPaint expects the painted region + // to be cleared before use if the window has a surface format with an alpha. + // Fresh QWaylandShmBuffer are already cleared, so we don't need to clear those. + if (!bufferWasRecreated && mBackBuffer->image()->hasAlphaChannel()) { QPainter p(paintDevice()); p.setCompositionMode(QPainter::CompositionMode_Source); const QColor blank = Qt::transparent; @@ -238,8 +242,10 @@ void QWaylandShmBackingStore::resize(const QSize &size, const QRegion &) mRequestedSize = size; } -QWaylandShmBuffer *QWaylandShmBackingStore::getBuffer(const QSize &size) +QWaylandShmBuffer *QWaylandShmBackingStore::getBuffer(const QSize &size, bool &bufferWasRecreated) { + bufferWasRecreated = false; + const auto copy = mBuffers; // remove when ported to vector + remove_if for (QWaylandShmBuffer *b : copy) { if (!b->busy()) { @@ -258,14 +264,16 @@ QWaylandShmBuffer *QWaylandShmBackingStore::getBuffer(const QSize &size) if (mBuffers.size() < MAX_BUFFERS) { QImage::Format format = QPlatformScreen::platformScreenForWindow(window())->format(); QWaylandShmBuffer *b = new QWaylandShmBuffer(mDisplay, size, format, waylandWindow()->scale()); + bufferWasRecreated = true; mBuffers.push_front(b); return b; } return nullptr; } -void QWaylandShmBackingStore::ensureBackBuffer() +bool QWaylandShmBackingStore::recreateBackBufferIfNeeded() { + bool bufferWasRecreated = false; QMargins margins = windowDecorationMargins(); qreal scale = waylandWindow()->scale(); const QSize sizeWithMargins = (mRequestedSize + QSize(margins.left() + margins.right(), margins.top() + margins.bottom())) * scale; @@ -278,12 +286,12 @@ void QWaylandShmBackingStore::ensureBackBuffer() // You can exercise the different codepaths with weston, switching between the gl and the // pixman renderer. With the gl renderer release events are sent early so we can effectively // run single buffered, while with the pixman renderer we have to use two. - QWaylandShmBuffer *buffer = getBuffer(sizeWithMargins); + QWaylandShmBuffer *buffer = getBuffer(sizeWithMargins, bufferWasRecreated); while (!buffer) { qCDebug(lcWaylandBackingstore, "QWaylandShmBackingStore: stalling waiting for a buffer to be released from the compositor..."); mDisplay->blockingReadEvents(); - buffer = getBuffer(sizeWithMargins); + buffer = getBuffer(sizeWithMargins, bufferWasRecreated); } qsizetype oldSizeInBytes = mBackBuffer ? mBackBuffer->image()->sizeInBytes() : 0; @@ -325,6 +333,8 @@ void QWaylandShmBackingStore::ensureBackBuffer() windowDecoration()->update(); buffer->dirtyRegion() = QRegion(); + + return bufferWasRecreated; } QImage *QWaylandShmBackingStore::entireSurface() const diff --git a/src/plugins/platforms/wayland/qwaylandshmbackingstore_p.h b/src/plugins/platforms/wayland/qwaylandshmbackingstore_p.h index 78889336010..6d276bf7b30 100644 --- a/src/plugins/platforms/wayland/qwaylandshmbackingstore_p.h +++ b/src/plugins/platforms/wayland/qwaylandshmbackingstore_p.h @@ -69,7 +69,7 @@ public: QMargins windowDecorationMargins() const; QImage *entireSurface() const; QImage *contentSurface() const; - void ensureBackBuffer(); + bool recreateBackBufferIfNeeded(); QWaylandWindow *waylandWindow() const; void iterateBuffer(); @@ -81,7 +81,7 @@ public: private: void updateDirtyStates(const QRegion ®ion); void updateDecorations(); - QWaylandShmBuffer *getBuffer(const QSize &size); + QWaylandShmBuffer *getBuffer(const QSize &size, bool &bufferWasRecreated); QWaylandDisplay *mDisplay = nullptr; std::list mBuffers; diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index f5a9fddb81a..84b73c0a46f 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -92,7 +92,7 @@ void QWaylandWindow::ensureSize() { if (mBackingStore) { setBackingStore(mBackingStore); - mBackingStore->ensureBackBuffer(); + mBackingStore->recreateBackBufferIfNeeded(); } } From d3adcc073abefe3d8bb222a847eb6c77a4daa54d Mon Sep 17 00:00:00 2001 From: JiDe Zhang Date: Tue, 5 Mar 2024 16:08:00 +0000 Subject: [PATCH 1312/1507] Support multi-key for input context plugin MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sync from QPlatformInputContextFactory::requested in 8596998cb025a8338c9403f5ef9db5a23f5cc682 of qtbase to QPlatformInputContextFactory. Fixes: QTBUG-120202 Change-Id: Ib15d8a59c4cb3baaa19355ed5d7c30c87a7a1c16 Reviewed-by: Tor Arne Vestbø --- .../platforms/wayland/qwaylanddisplay.cpp | 8 ++-- .../platforms/wayland/qwaylanddisplay_p.h | 10 +++-- .../platforms/wayland/qwaylandintegration.cpp | 38 ++++++++++++------- 3 files changed, 35 insertions(+), 21 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index 7bc8d18894e..97b04b1dc5d 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -342,7 +342,7 @@ void QWaylandDisplay::setupConnection() if (!mXkbContext) qCWarning(lcQpaWayland, "failed to create xkb context"); #endif - if (!mClientSideInputContextRequested) + if (mWaylandInputContextRequested) checkTextInputProtocol(); } @@ -397,7 +397,7 @@ bool QWaylandDisplay::initialize() // Give wl_output.done and zxdg_output_v1.done events a chance to arrive forceRoundTrip(); } - if (!mClientSideInputContextRequested) + if (mWaylandInputContextRequested) mTextInputManagerIndex = INT_MAX; return qEnvironmentVariableIntValue("QT_WAYLAND_DONT_CHECK_SHELL_INTEGRATION") || shellIntegration(); @@ -1015,8 +1015,8 @@ bool QWaylandDisplay::isKeyboardAvailable() const [](const QWaylandInputDevice *device) { return device->keyboard() != nullptr; }); } -bool QWaylandDisplay::isClientSideInputContextRequested() const { - return mClientSideInputContextRequested; +bool QWaylandDisplay::isWaylandInputContextRequested() const { + return mWaylandInputContextRequested; } #if QT_CONFIG(cursor) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay_p.h b/src/plugins/platforms/wayland/qwaylanddisplay_p.h index 23452492577..5b564c8d796 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay_p.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay_p.h @@ -40,6 +40,8 @@ struct wp_viewport; QT_BEGIN_NAMESPACE +#define WAYLAND_IM_KEY "wayland" + class QAbstractEventDispatcher; class QSocketNotifier; class QPlatformScreen; @@ -253,7 +255,7 @@ public: wl_event_queue *frameEventQueue() { return m_frameEventQueue; }; bool isKeyboardAvailable() const; - bool isClientSideInputContextRequested() const; + bool isWaylandInputContextRequested() const; void initEventThread(); @@ -357,9 +359,9 @@ private: static const wl_callback_listener syncCallbackListener; bool mWaylandTryReconnect = false; - bool mClientSideInputContextRequested = [] () { - const QString& requested = QPlatformInputContextFactory::requested(); - return !requested.isEmpty() && requested != QLatin1String("wayland"); + bool mWaylandInputContextRequested = [] () { + const auto requested = QPlatformInputContextFactory::requested(); + return requested.isEmpty() || requested.contains(QLatin1String(WAYLAND_IM_KEY)); }(); QStringList mTextInputManagerList; int mTextInputManagerIndex = INT_MAX; diff --git a/src/plugins/platforms/wayland/qwaylandintegration.cpp b/src/plugins/platforms/wayland/qwaylandintegration.cpp index 846556d4eda..eb19be45df8 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandintegration.cpp @@ -462,23 +462,35 @@ void QWaylandIntegration::reconfigureInputContext() return; } - const QString &requested = QPlatformInputContextFactory::requested(); - if (requested == QLatin1String("qtvirtualkeyboard")) + auto requested = QPlatformInputContextFactory::requested(); + if (requested.contains(QLatin1String("qtvirtualkeyboard"))) qCWarning(lcQpaWayland) << "qtvirtualkeyboard currently is not supported at client-side," - " use QT_IM_MODULE=qtvirtualkeyboard at compositor-side."; + " use QT_IM_MODULES=qtvirtualkeyboard at compositor-side."; - if (!mDisplay->isClientSideInputContextRequested()) { - if (mDisplay->textInputMethodManager() != nullptr) - mInputContext.reset(new QWaylandInputMethodContext(mDisplay.data())); - else if (mDisplay->textInputManagerv1() != nullptr || mDisplay->textInputManagerv2() != nullptr || mDisplay->textInputManagerv3() != nullptr) - mInputContext.reset(new QWaylandInputContext(mDisplay.data())); - } else { - mInputContext.reset(QPlatformInputContextFactory::create(requested)); - } + if (mDisplay->isWaylandInputContextRequested() + && !requested.contains(QLatin1String(WAYLAND_IM_KEY))) + requested.append(QLatin1String(WAYLAND_IM_KEY)); const QString defaultInputContext(QStringLiteral("compose")); - if ((!mInputContext || !mInputContext->isValid()) && requested != defaultInputContext) - mInputContext.reset(QPlatformInputContextFactory::create(defaultInputContext)); + if (!requested.contains(defaultInputContext)) + requested.append(defaultInputContext); + + for (const QString &imKey : requested) { + if (imKey == QLatin1String(WAYLAND_IM_KEY)) { + Q_ASSERT(mDisplay->isWaylandInputContextRequested()); + if (mDisplay->textInputMethodManager() != nullptr) + mInputContext.reset(new QWaylandInputMethodContext(mDisplay.data())); + else if (mDisplay->textInputManagerv1() != nullptr + || mDisplay->textInputManagerv2() != nullptr + || mDisplay->textInputManagerv3() != nullptr) + mInputContext.reset(new QWaylandInputContext(mDisplay.data())); + } else { + mInputContext.reset(QPlatformInputContextFactory::create(imKey)); + } + + if (mInputContext && mInputContext->isValid()) + break; + } #if QT_CONFIG(xkbcommon) QXkbCommon::setXkbContext(mInputContext.data(), mDisplay->xkbContext()); From 4446f4571a712af0deda574d3d0e1285c9b84a2a Mon Sep 17 00:00:00 2001 From: Liang Qi Date: Fri, 8 Mar 2024 10:20:10 +0100 Subject: [PATCH 1313/1507] client: use current modifiers in repeat keys This amends 97232a3fd8970a072e36ac3d080ce828dd9243fb . Fixes: QTBUG-123007 Pick-to: 6.7 6.6 6.5 6.2 5.15 Change-Id: I3b4e5d4a8304fd57558eec3897562895c294aadd Reviewed-by: David Edmundson --- src/plugins/platforms/wayland/qwaylandinputdevice.cpp | 11 +++++------ src/plugins/platforms/wayland/qwaylandinputdevice_p.h | 2 -- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index 6f421febde7..7406e3469f3 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -69,11 +69,12 @@ QWaylandInputDevice::Keyboard::Keyboard(QWaylandInputDevice *p) return; } mRepeatTimer.setInterval(1000 / mRepeatRate); - handleKey(mRepeatKey.time, QEvent::KeyRelease, mRepeatKey.key, mRepeatKey.modifiers, - mRepeatKey.code, mRepeatKey.nativeVirtualKey, mRepeatKey.nativeModifiers, + Qt::KeyboardModifiers modifiers = this->modifiers(); + handleKey(mRepeatKey.time, QEvent::KeyRelease, mRepeatKey.key, modifiers, + mRepeatKey.code, mRepeatKey.nativeVirtualKey, this->mNativeModifiers, mRepeatKey.text, true); - handleKey(mRepeatKey.time, QEvent::KeyPress, mRepeatKey.key, mRepeatKey.modifiers, - mRepeatKey.code, mRepeatKey.nativeVirtualKey, mRepeatKey.nativeModifiers, + handleKey(mRepeatKey.time, QEvent::KeyPress, mRepeatKey.key, modifiers, + mRepeatKey.code, mRepeatKey.nativeVirtualKey, this->mNativeModifiers, mRepeatKey.text, true); }); } @@ -1354,8 +1355,6 @@ void QWaylandInputDevice::Keyboard::keyboard_key(uint32_t serial, uint32_t time, mRepeatKey.code = code; mRepeatKey.time = time; mRepeatKey.text = text; - mRepeatKey.modifiers = modifiers; - mRepeatKey.nativeModifiers = mNativeModifiers; mRepeatKey.nativeVirtualKey = sym; mRepeatTimer.setInterval(mRepeatDelay); mRepeatTimer.start(); diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h index 67bfb9afd85..cf565cb8502 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h +++ b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h @@ -237,9 +237,7 @@ public: uint32_t code = 0; uint32_t time = 0 ; QString text; - Qt::KeyboardModifiers modifiers; uint32_t nativeVirtualKey = 0; - uint32_t nativeModifiers = 0; } mRepeatKey; QTimer mRepeatTimer; From e30dbe924bea3cba1e0e4164a76a8f56a9e065a9 Mon Sep 17 00:00:00 2001 From: Liang Qi Date: Wed, 13 Mar 2024 11:53:58 +0100 Subject: [PATCH 1314/1507] client: don't cache one type in QWaylandMimeData "application/vnd.portal.filetransfer", which is only valid for one time use. Fixes: QTBUG-107858 Pick-to: 6.7 6.6 6.5 6.2 5.15 Change-Id: I094de22ea0bb9b3577572e6c57ebe42cdc8c7b41 Reviewed-by: David Edmundson --- src/plugins/platforms/wayland/qwaylanddataoffer.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylanddataoffer.cpp b/src/plugins/platforms/wayland/qwaylanddataoffer.cpp index 94cd249fa31..8110ce35fea 100644 --- a/src/plugins/platforms/wayland/qwaylanddataoffer.cpp +++ b/src/plugins/platforms/wayland/qwaylanddataoffer.cpp @@ -32,6 +32,11 @@ static QString mozUrl() return QStringLiteral("text/x-moz-url"); } +static QString portalFileTransfer() +{ + return QStringLiteral("application/vnd.portal.filetransfer"); +} + static QByteArray convertData(const QString &originalMime, const QString &newMime, const QByteArray &data) { if (originalMime == newMime) @@ -214,7 +219,9 @@ QVariant QWaylandMimeData::retrieveData_sys(const QString &mimeType, QMetaType t content = convertData(mimeType, mime, content); - m_data.insert(mimeType, content); + if (mimeType != portalFileTransfer()) + m_data.insert(mimeType, content); + return content; } From 3134fef6e40692070c2b6582fa41d49063da78c1 Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Thu, 14 Mar 2024 09:09:46 +0000 Subject: [PATCH 1315/1507] client: Only use viewport when fractional scaling is in use Either viewport or wl_buffer.set_scale can be used to notify the compositor that the client has scaled it's contents, with viewport being more flexible and a requirement for fractional scaling. Unfortunately Gnome before 36 announces viewport support, but it does not work correctly. This patch workarounds that by only using the viewporter when we're using fractional scaling otherwise continue using the legacy path. Fixes: QTBUG-122412 Pick-to: 6.7 6.6 Change-Id: I9a01d9456ce91735051f8f53fb4b72add6961fcb Reviewed-by: Liang Qi Reviewed-by: David Redondo --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 84b73c0a46f..215193a7bf8 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -186,7 +186,9 @@ void QWaylandWindow::initWindow() } } - if (display()->viewporter()) { + // The fractional scale manager check is needed to work around Gnome < 36 where viewports don't work + // Right now viewports are only necessary when a fractional scale manager is used + if (display()->viewporter() && display()->fractionalScaleManager()) { mViewport.reset(new QWaylandViewport(display()->createViewport(this))); } From dce4d1a351d45e0cac566d085671e8b61cc927c4 Mon Sep 17 00:00:00 2001 From: Inho Lee Date: Wed, 24 Jan 2024 11:33:32 +0100 Subject: [PATCH 1316/1507] TextInputv3: use a serial for each resource Each zwp_text_input_v3 object should have their own serial number and it will not be cleared on the same object. Pick-to: 6.7 Change-Id: I779c2ae07f1dab1ae4a7d87e4e183ce33ec804fe Reviewed-by: Liang Qi Reviewed-by: David Edmundson Reviewed-by: Weng Xuetian --- src/plugins/platforms/wayland/qwaylandtextinputv3.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandtextinputv3.cpp b/src/plugins/platforms/wayland/qwaylandtextinputv3.cpp index 48f882febbf..017456ac249 100644 --- a/src/plugins/platforms/wayland/qwaylandtextinputv3.cpp +++ b/src/plugins/platforms/wayland/qwaylandtextinputv3.cpp @@ -67,7 +67,6 @@ void QWaylandTextInputv3::zwp_text_input_v3_leave(struct ::wl_surface *surface) m_currentPreeditString.clear(); m_surface = nullptr; - m_currentSerial = 0U; disable(); qCDebug(qLcQpaWaylandTextInput) << Q_FUNC_INFO << "Done"; From 610bcae568ca19a468c9ceaf4b8913bc8d4d112c Mon Sep 17 00:00:00 2001 From: Jan Grulich Date: Tue, 12 Dec 2023 10:08:17 +0100 Subject: [PATCH 1317/1507] Add GNOME-like client-side decoration plugin Adds a client-side decoration plugin implementing GNOME's Adwaita style. This is trying to follow GTK4 Adwaita style, using xdg-desktop-portal to get user's configuration in order to get whether a light or dark colors should be used and to get the titlebar button layout. This plugin is now used on GNOME by default, while defaulting to the original behavior for non-GNOME DEs. It depends on QtSvg used to draw titlebar buttons so in case QtSvg is not found, this plugin will not be build. [ChangeLog][QtWaylandClient][Added GNOME-like client-side decoration plugin] Fixes: QTBUG-120070 Change-Id: I0f1777c4e0aa3467dafbbae8004b594cc82f9aa0 Reviewed-by: David Edmundson --- src/platformsupport/wayland/configure.cmake | 8 ++++++++ .../plugins/decorations/CMakeLists.txt | 3 +++ .../platforms/wayland/qwaylandwindow.cpp | 19 +++++++++++++++++++ 3 files changed, 30 insertions(+) diff --git a/src/platformsupport/wayland/configure.cmake b/src/platformsupport/wayland/configure.cmake index eda1f085019..45f94533348 100644 --- a/src/platformsupport/wayland/configure.cmake +++ b/src/platformsupport/wayland/configure.cmake @@ -245,6 +245,11 @@ qt_feature("wayland-vulkan-server-buffer" PRIVATE qt_feature("wayland-datadevice" PRIVATE CONDITION QT_FEATURE_draganddrop OR QT_FEATURE_clipboard ) +qt_feature("wayland-decoration-adwaita" PRIVATE + LABEL "GNOME-like client-side decorations" + CONDITION NOT WIN32 AND QT_FEATURE_wayland_client AND TARGET Qt::DBus AND TARGET Qt::Svg +) + qt_configure_add_summary_entry(ARGS "wayland-client") qt_configure_add_summary_entry(ARGS "wayland-server") @@ -257,6 +262,9 @@ qt_configure_add_summary_entry(ARGS "wayland-dmabuf-server-buffer") qt_configure_add_summary_entry(ARGS "wayland-shm-emulation-server-buffer") qt_configure_add_summary_entry(ARGS "wayland-vulkan-server-buffer") qt_configure_end_summary_section() # end of "Qt Wayland Drivers" section +qt_configure_add_summary_section(NAME "Qt Wayland Decoration Plugins") +qt_configure_add_summary_entry(ARGS "wayland-decoration-adwaita") +qt_configure_end_summary_section() # end of "Qt Wayland Decoration Plugins" section qt_configure_add_report_entry( TYPE ERROR diff --git a/src/plugins/platforms/wayland/plugins/decorations/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/decorations/CMakeLists.txt index 73c59e4a547..abe3c375b88 100644 --- a/src/plugins/platforms/wayland/plugins/decorations/CMakeLists.txt +++ b/src/plugins/platforms/wayland/plugins/decorations/CMakeLists.txt @@ -2,5 +2,8 @@ # SPDX-License-Identifier: BSD-3-Clause # Generated from decorations.pro. +if (QT_FEATURE_wayland_decoration_adwaita) + add_subdirectory(adwaita) +endif() add_subdirectory(bradient) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 215193a7bf8..c0a415725e4 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -26,6 +26,7 @@ #include #include +#include #include #include @@ -36,6 +37,8 @@ QT_BEGIN_NAMESPACE +using namespace Qt::StringLiterals; + namespace QtWaylandClient { Q_LOGGING_CATEGORY(lcWaylandBackingstore, "qt.qpa.wayland.backingstore") @@ -1092,6 +1095,22 @@ bool QWaylandWindow::createDecoration() } } + if (targetKey.isEmpty()) { + auto unixServices = dynamic_cast( + QGuiApplicationPrivate::platformIntegration()->services()); + const QByteArray currentDesktop = unixServices->desktopEnvironment(); + if (currentDesktop == "GNOME") { + if (decorations.contains("adwaita"_L1)) + targetKey = "adwaita"_L1; + else if (decorations.contains("gnome"_L1)) + targetKey = "gnome"_L1; + } else { + // Do not use Adwaita/GNOME decorations on other DEs + decorations.removeAll("adwaita"_L1); + decorations.removeAll("gnome"_L1); + } + } + if (targetKey.isEmpty()) targetKey = decorations.first(); // first come, first served. From 997b12fd56a5b6b4dfd60d6fcf7d5c62e8fabde0 Mon Sep 17 00:00:00 2001 From: David Redondo Date: Wed, 31 Jan 2024 17:03:04 +0100 Subject: [PATCH 1318/1507] client: Roundtrip in an own queue when exporting window instead of default queue This way no other events will be dispatched which could cause calls into user code when delivering events synchronously. Change-Id: I5c195877388d178832067b5aba6b5f5abd26e099 Reviewed-by: David Edmundson --- .../xdg-shell/qwaylandxdgexporterv2.cpp | 6 ------ .../xdg-shell/qwaylandxdgexporterv2_p.h | 1 - .../shellintegration/xdg-shell/qwaylandxdgshell.cpp | 13 +++++++++++-- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgexporterv2.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgexporterv2.cpp index 58baad02412..5cbbecc5396 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgexporterv2.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgexporterv2.cpp @@ -36,12 +36,6 @@ QWaylandXdgExporterV2::~QWaylandXdgExporterV2() { destroy(); } - -QtWaylandClient::QWaylandXdgExportedV2 *QWaylandXdgExporterV2::exportToplevel(wl_surface *surface) -{ - return new QWaylandXdgExportedV2(export_toplevel(surface)); -} - } QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgexporterv2_p.h b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgexporterv2_p.h index b260dbacbac..c993e390a24 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgexporterv2_p.h +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgexporterv2_p.h @@ -40,7 +40,6 @@ class QWaylandXdgExporterV2 : public QtWayland::zxdg_exporter_v2 public: QWaylandXdgExporterV2(wl_registry *registry, uint32_t id, int version); ~QWaylandXdgExporterV2() override; - QWaylandXdgExportedV2 *exportToplevel(wl_surface *surface); }; } diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp index 977657e59f6..498710bebe7 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp @@ -711,9 +711,18 @@ QString QWaylandXdgSurface::externWindowHandle() return QString(); } if (!m_toplevel->m_exported) { - m_toplevel->m_exported.reset(m_shell->exporter()->exportToplevel(m_window->wlSurface())); + auto *exporterWrapper = static_cast( + wl_proxy_create_wrapper(m_shell->exporter()->object())); + auto exportQueue = wl_display_create_queue(m_shell->display()->wl_display()); + wl_proxy_set_queue(reinterpret_cast(exporterWrapper), exportQueue); + m_toplevel->m_exported.reset(new QWaylandXdgExportedV2( + zxdg_exporter_v2_export_toplevel(exporterWrapper, m_window->wlSurface()))); // handle events is sent immediately - m_shell->display()->forceRoundTrip(); + wl_display_roundtrip_queue(m_shell->display()->wl_display(), exportQueue); + + wl_proxy_set_queue(reinterpret_cast(m_toplevel->m_exported->object()), nullptr); + wl_proxy_wrapper_destroy(exporterWrapper); + wl_event_queue_destroy(exportQueue); } return m_toplevel->m_exported->handle(); } From 80662934302f365b32b63a82cd8299d8efc61dc4 Mon Sep 17 00:00:00 2001 From: David Redondo Date: Thu, 8 Feb 2024 09:09:10 +0100 Subject: [PATCH 1319/1507] scanner: Make it work with mismatching protocol and file name The names of the files that wayland-scanner generates are based on the protocol file name not the protocol name that is defined in the xml. When those two mismatch qtwaylandscanner would generate code that fails to build. Pick-to: 6.7 Change-Id: Ieecd7a122177530ab1ff890367ce53809a8bb7b9 Reviewed-by: David Edmundson --- .../qtwaylandscanner/qtwaylandscanner.cpp | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp index 273a0012e09..6bdcb8da5ce 100644 --- a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp +++ b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp @@ -3,6 +3,7 @@ #include #include +#include #include #include @@ -422,6 +423,8 @@ bool Scanner::process() //QByteArray preProcessorProtocolName = QByteArray(m_protocolName).replace('-', '_').toUpper(); QByteArray preProcessorProtocolName = QByteArray(m_protocolName).toUpper(); + const QByteArray fileBaseName = QFileInfo(file).completeBaseName().toLocal8Bit(); + std::vector interfaces; while (m_xml->readNextStartElement()) { @@ -467,9 +470,9 @@ bool Scanner::process() printf("\n"); printf("#include \"wayland-server-core.h\"\n"); if (m_headerPath.isEmpty()) - printf("#include \"wayland-%s-server-protocol.h\"\n", QByteArray(m_protocolName).replace('_', '-').constData()); + printf("#include \"wayland-%s-server-protocol.h\"\n", fileBaseName.constData()); else - printf("#include <%s/wayland-%s-server-protocol.h>\n", m_headerPath.constData(), QByteArray(m_protocolName).replace('_', '-').constData()); + printf("#include <%s/wayland-%s-server-protocol.h>\n", m_headerPath.constData(), fileBaseName.constData()); printf("#include \n"); printf("#include \n"); printf("#include \n"); @@ -632,9 +635,9 @@ bool Scanner::process() if (m_option == ServerCode) { if (m_headerPath.isEmpty()) - printf("#include \"qwayland-server-%s.h\"\n", QByteArray(m_protocolName).replace('_', '-').constData()); + printf("#include \"qwayland-server-%s.h\"\n", fileBaseName.constData()); else - printf("#include <%s/qwayland-server-%s.h>\n", m_headerPath.constData(), QByteArray(m_protocolName).replace('_', '-').constData()); + printf("#include <%s/qwayland-server-%s.h>\n", m_headerPath.constData(), fileBaseName.constData()); printf("\n"); printf("QT_BEGIN_NAMESPACE\n"); printf("QT_WARNING_PUSH\n"); @@ -965,9 +968,9 @@ bool Scanner::process() printf("#define %s\n", inclusionGuard.constData()); printf("\n"); if (m_headerPath.isEmpty()) - printf("#include \"wayland-%s-client-protocol.h\"\n", QByteArray(m_protocolName).replace('_', '-').constData()); + printf("#include \"wayland-%s-client-protocol.h\"\n", fileBaseName.constData()); else - printf("#include <%s/wayland-%s-client-protocol.h>\n", m_headerPath.constData(), QByteArray(m_protocolName).replace('_', '-').constData()); + printf("#include <%s/wayland-%s-client-protocol.h>\n", m_headerPath.constData(), fileBaseName.constData()); printf("#include \n"); printf("#include \n"); printf("\n"); @@ -1077,9 +1080,9 @@ bool Scanner::process() if (m_option == ClientCode) { if (m_headerPath.isEmpty()) - printf("#include \"qwayland-%s.h\"\n", QByteArray(m_protocolName).replace('_', '-').constData()); + printf("#include \"qwayland-%s.h\"\n", fileBaseName.constData()); else - printf("#include <%s/qwayland-%s.h>\n", m_headerPath.constData(), QByteArray(m_protocolName).replace('_', '-').constData()); + printf("#include <%s/qwayland-%s.h>\n", m_headerPath.constData(), fileBaseName.constData()); printf("\n"); printf("QT_BEGIN_NAMESPACE\n"); printf("QT_WARNING_PUSH\n"); From 1d6cecbb4affbecfbfc9bceb73cc47821ec9e83c Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Sun, 19 Mar 2023 10:24:59 +0400 Subject: [PATCH 1320/1507] Client: Fix the mouse being stuck in pressed state after startSystem{Move,Resize} Fixes: QTBUG-97037 Pick-to: 6.7 Change-Id: I812c25b98909f9ff05ffca122e7201665023172e Reviewed-by: David Edmundson --- .../platforms/wayland/qwaylandinputdevice.cpp | 7 ++++++- .../platforms/wayland/qwaylandinputdevice_p.h | 1 + src/plugins/platforms/wayland/qwaylandwindow.cpp | 14 ++++++++++---- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index 7406e3469f3..d8068c1471c 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -835,6 +835,8 @@ void QWaylandInputDevice::Pointer::pointer_button(uint32_t serial, uint32_t time default: return; // invalid button number (as far as Qt is concerned) } + mLastButton = qt_button; + if (state) mButtons |= qt_button; else @@ -873,10 +875,13 @@ void QWaylandInputDevice::Pointer::invalidateFocus() void QWaylandInputDevice::Pointer::releaseButtons() { + if (mButtons == Qt::NoButton) + return; + mButtons = Qt::NoButton; if (auto *window = focusWindow()) { - ReleaseEvent e(focusWindow(), mParent->mTime, mSurfacePos, mGlobalPos, mButtons, Qt::NoButton, mParent->modifiers()); + ReleaseEvent e(focusWindow(), mParent->mTime, mSurfacePos, mGlobalPos, mButtons, mLastButton, mParent->modifiers()); window->handleMouse(mParent, e); } } diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h index cf565cb8502..becd5f9be04 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h +++ b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h @@ -338,6 +338,7 @@ public: QPointF mSurfacePos; QPointF mGlobalPos; Qt::MouseButtons mButtons = Qt::NoButton; + Qt::MouseButton mLastButton = Qt::NoButton; struct FrameData { QWaylandPointerEvent *event = nullptr; diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index c0a415725e4..dcc086420fc 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -1736,15 +1736,21 @@ void QWaylandWindow::propagateSizeHints() bool QWaylandWindow::startSystemResize(Qt::Edges edges) { - if (auto *seat = display()->lastInputDevice()) - return mShellSurface && mShellSurface->resize(seat, edges); + if (auto *seat = display()->lastInputDevice()) { + bool rc = mShellSurface && mShellSurface->resize(seat, edges); + seat->handleEndDrag(); + return rc; + } return false; } bool QtWaylandClient::QWaylandWindow::startSystemMove() { - if (auto seat = display()->lastInputDevice()) - return mShellSurface && mShellSurface->move(seat); + if (auto seat = display()->lastInputDevice()) { + bool rc = mShellSurface && mShellSurface->move(seat); + seat->handleEndDrag(); + return rc; + } return false; } From e89e8bf73fb2c26672220d68eef05f8eaba3ab18 Mon Sep 17 00:00:00 2001 From: Lu YaNing Date: Tue, 19 Mar 2024 09:53:53 +0800 Subject: [PATCH 1321/1507] Use static_cast rather than dynamic_cast To avoid RTTI. When I tried to implement the reconnect function in Plasma5, I found that the application would have a dynamic_cast crash problem. Referring to other usage logic and suggestions in Qt, it is recommended to avoid using dynamic_cast. Change-Id: I4fd41846c3215f60aafc7e38d1542d52ec6759b8 Reviewed-by: David Redondo --- src/plugins/platforms/wayland/qwaylanddisplay.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index 97b04b1dc5d..265f0bb3f19 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -454,13 +454,13 @@ void QWaylandDisplay::reconnect() const auto windows = QGuiApplication::allWindows(); for (auto window : windows) { - if (auto waylandWindow = dynamic_cast(window->handle())) + if (auto waylandWindow = static_cast(window->handle())) waylandWindow->closeChildPopups(); } // Remove windows that do not need to be recreated and now closed popups QList recreateWindows; for (auto window : std::as_const(windows)) { - auto waylandWindow = dynamic_cast((window)->handle()); + auto waylandWindow = static_cast(window->handle()); if (waylandWindow && waylandWindow->wlSurface()) { waylandWindow->reset(); recreateWindows.push_back(waylandWindow); From d5252fff7437d4cfc3edcaaabff9bb4f3d6f52bd Mon Sep 17 00:00:00 2001 From: Alexey Edelev Date: Wed, 29 Nov 2023 13:42:17 +0100 Subject: [PATCH 1322/1507] Use NO_GENERATE_CPP_EXPORTS explicitly Use NO_GENERATE_CPP_EXPORTS explicitly for modules that don't need the autogenerated exports header file. Task-number: QTBUG-90492 Change-Id: I3494ac88e136126265e14ef1a380c5ef26def3ef Reviewed-by: Alexandru Croitor Reviewed-by: Qt CI Bot --- src/platformsupport/wayland/CMakeLists.txt | 6 +++++- .../plugins/shellintegration/wl-shell/CMakeLists.txt | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/platformsupport/wayland/CMakeLists.txt b/src/platformsupport/wayland/CMakeLists.txt index b2804ea2ef2..a38d9551202 100644 --- a/src/platformsupport/wayland/CMakeLists.txt +++ b/src/platformsupport/wayland/CMakeLists.txt @@ -29,7 +29,11 @@ configure the module on targets that are missing dependencies.") endif() # See global/README for a description of the following module. -qt_internal_add_module(WaylandGlobalPrivate INTERNAL_MODULE HEADER_MODULE) +qt_internal_add_module(WaylandGlobalPrivate + INTERNAL_MODULE + HEADER_MODULE + NO_GENERATE_CPP_EXPORTS +) # Work around 115101. # If nothing depends on the WaylandGlobalPrivate target it doesn't run custom commands that the diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/CMakeLists.txt index 142bd21aaaa..09b076d00c3 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/CMakeLists.txt +++ b/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/CMakeLists.txt @@ -19,6 +19,7 @@ qt_internal_add_module(WlShellIntegrationPrivate Wayland::Client PRIVATE_HEADER_FILTERS "^qwayland-.*\.h|^wayland-.*-protocol\.h" + NO_GENERATE_CPP_EXPORTS ) qt6_generate_wayland_protocol_client_sources(WlShellIntegrationPrivate From 298c81ef7d37b213f331557a4ed16c3c98576ef6 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Wed, 8 Mar 2023 18:19:20 +0400 Subject: [PATCH 1323/1507] Bradient: make drawing coordiantes consistent Currently some parts of the decoration use surface size (window icon, window controls) while other parts use window content geometry. As backing store paints it from the start of the surface, use surface size everywhere. This is visible when setting custom margins. Change-Id: I22a84fd35bd6e088c30ea265d8cb4af86f14e1a5 Reviewed-by: David Edmundson --- .../plugins/decorations/bradient/main.cpp | 50 ++++++++++--------- 1 file changed, 26 insertions(+), 24 deletions(-) diff --git a/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp b/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp index 7f1b78c101d..32f2d8db818 100644 --- a/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp +++ b/src/plugins/platforms/wayland/plugins/decorations/bradient/main.cpp @@ -73,21 +73,21 @@ QWaylandBradientDecoration::QWaylandBradientDecoration() QRectF QWaylandBradientDecoration::closeButtonRect() const { - const int windowRight = waylandWindow()->windowContentGeometry().right() + 1; + const int windowRight = waylandWindow()->surfaceSize().width() - margins(ShadowsOnly).right(); return QRectF(windowRight - BUTTON_WIDTH - BUTTON_SPACING * 0 - BUTTONS_RIGHT_MARGIN, (margins().top() - BUTTON_WIDTH) / 2, BUTTON_WIDTH, BUTTON_WIDTH); } QRectF QWaylandBradientDecoration::maximizeButtonRect() const { - const int windowRight = waylandWindow()->windowContentGeometry().right() + 1; + const int windowRight = waylandWindow()->surfaceSize().width() - margins(ShadowsOnly).right(); return QRectF(windowRight - BUTTON_WIDTH * 2 - BUTTON_SPACING * 1 - BUTTONS_RIGHT_MARGIN, (margins().top() - BUTTON_WIDTH) / 2, BUTTON_WIDTH, BUTTON_WIDTH); } QRectF QWaylandBradientDecoration::minimizeButtonRect() const { - const int windowRight = waylandWindow()->windowContentGeometry().right() + 1; + const int windowRight = waylandWindow()->surfaceSize().width() - margins(ShadowsOnly).right(); return QRectF(windowRight - BUTTON_WIDTH * 3 - BUTTON_SPACING * 2 - BUTTONS_RIGHT_MARGIN, (margins().top() - BUTTON_WIDTH) / 2, BUTTON_WIDTH, BUTTON_WIDTH); } @@ -103,13 +103,14 @@ QMargins QWaylandBradientDecoration::margins(MarginsType marginsType) const void QWaylandBradientDecoration::paint(QPaintDevice *device) { bool active = window()->handle()->isActive(); - QRect wg = waylandWindow()->windowContentGeometry(); + QRect wg = QRect(QPoint(), waylandWindow()->surfaceSize()).marginsRemoved(margins(ShadowsOnly)); + QRect cg = wg.marginsRemoved(margins(ShadowsExcluded)); QRect clips[] = { - QRect(wg.left(), wg.top(), wg.width(), margins().top()), - QRect(wg.left(), (wg.bottom() + 1) - margins().bottom(), wg.width(), margins().bottom()), - QRect(wg.left(), margins().top(), margins().left(), wg.height() - margins().top() - margins().bottom()), - QRect((wg.right() + 1) - margins().right(), wg.top() + margins().top(), margins().right(), wg.height() - margins().top() - margins().bottom()) + QRect(wg.left(), wg.top(), wg.width(), margins(ShadowsExcluded).top()), + QRect(wg.left(), cg.bottom() + 1, wg.width(), margins(ShadowsExcluded).bottom()), + QRect(wg.left(), cg.top(), margins(ShadowsExcluded).left(), cg.height()), + QRect(cg.right() + 1, cg.top(), margins(ShadowsExcluded).right(), cg.height()) }; QRect top = clips[0]; @@ -236,14 +237,14 @@ bool QWaylandBradientDecoration::handleMouse(QWaylandInputDevice *inputDevice, c Q_UNUSED(global); // Figure out what area mouse is in - QRect wg = waylandWindow()->windowContentGeometry(); - if (local.y() <= wg.top() + margins().top()) { + QSize ss = waylandWindow()->surfaceSize(); + if (local.y() <= margins().top()) { processPointerTop(inputDevice, local, b, mods, PointerType::Mouse); - } else if (local.y() > wg.bottom() - margins().bottom()) { + } else if (local.y() >= ss.height() - margins().bottom()) { processPointerBottom(inputDevice, local, b, mods, PointerType::Mouse); - } else if (local.x() <= wg.left() + margins().left()) { + } else if (local.x() <= margins().left()) { processPointerLeft(inputDevice, local, b, mods, PointerType::Mouse); - } else if (local.x() > wg.right() - margins().right()) { + } else if (local.x() >= ss.width() - margins().right()) { processPointerRight(inputDevice, local, b, mods, PointerType::Mouse); } else { #if QT_CONFIG(cursor) @@ -260,17 +261,17 @@ bool QWaylandBradientDecoration::handleMouse(QWaylandInputDevice *inputDevice, c bool QWaylandBradientDecoration::handleTouch(QWaylandInputDevice *inputDevice, const QPointF &local, const QPointF &global, QEventPoint::State state, Qt::KeyboardModifiers mods) { Q_UNUSED(global); - QRect wg = waylandWindow()->windowContentGeometry(); + QSize ss = waylandWindow()->surfaceSize(); bool handled = state == QEventPoint::Pressed; if (handled) { - if (local.y() <= wg.top() + margins().top()) { + if (local.y() <= margins().top()) { processPointerTop(inputDevice, local, Qt::LeftButton, mods, PointerType::Touch); - } else if (local.y() > wg.bottom() - margins().bottom()) { + } else if (local.y() >= ss.height() - margins().bottom()) { processPointerBottom(inputDevice, local, Qt::LeftButton, mods, PointerType::Touch); - } else if (local.x() <= wg.left() + margins().left()) { + } else if (local.x() <= margins().left()) { processPointerLeft(inputDevice, local, Qt::LeftButton, mods, PointerType::Touch); - } else if (local.x() > wg.right() - margins().right()) { + } else if (local.x() >= ss.width() - margins().right()) { processPointerRight(inputDevice, local, Qt::LeftButton, mods, PointerType::Touch); } else { handled = false; @@ -290,9 +291,9 @@ void QWaylandBradientDecoration::processPointerTop(QWaylandInputDevice *inputDev Q_UNUSED(type); #endif - QRect wg = waylandWindow()->windowContentGeometry(); + QSize ss = waylandWindow()->surfaceSize(); Q_UNUSED(mods); - if (local.y() <= wg.top() + margins().bottom()) { + if (local.y() <= margins().bottom()) { if (local.x() <= margins().left()) { //top left bit #if QT_CONFIG(cursor) @@ -300,7 +301,7 @@ void QWaylandBradientDecoration::processPointerTop(QWaylandInputDevice *inputDev waylandWindow()->setMouseCursor(inputDevice, Qt::SizeFDiagCursor); #endif startResize(inputDevice, Qt::TopEdge | Qt::LeftEdge, b); - } else if (local.x() > wg.right() - margins().right()) { + } else if (local.x() >= ss.width() - margins().right()) { //top right bit #if QT_CONFIG(cursor) if (type == PointerType::Mouse) @@ -315,9 +316,9 @@ void QWaylandBradientDecoration::processPointerTop(QWaylandInputDevice *inputDev #endif startResize(inputDevice, Qt::TopEdge, b); } - } else if (local.x() <= wg.left() + margins().left()) { + } else if (local.x() <= margins().left()) { processPointerLeft(inputDevice, local, b, mods, type); - } else if (local.x() > wg.right() - margins().right()) { + } else if (local.x() >= ss.width() - margins().right()) { processPointerRight(inputDevice, local, b, mods, type); } else if (isRightClicked(b)) { showWindowMenu(inputDevice); @@ -350,6 +351,7 @@ void QWaylandBradientDecoration::processPointerBottom(QWaylandInputDevice *input Q_UNUSED(type); #endif + QSize ss = waylandWindow()->surfaceSize(); if (local.x() <= margins().left()) { //bottom left bit #if QT_CONFIG(cursor) @@ -357,7 +359,7 @@ void QWaylandBradientDecoration::processPointerBottom(QWaylandInputDevice *input waylandWindow()->setMouseCursor(inputDevice, Qt::SizeBDiagCursor); #endif startResize(inputDevice, Qt::BottomEdge | Qt::LeftEdge, b); - } else if (local.x() > window()->width() + margins().left()) { + } else if (local.x() >= ss.width() - margins().right()) { //bottom right bit #if QT_CONFIG(cursor) if (type == PointerType::Mouse) From de0be2b5dc4813b37acf49717a7227d457a99369 Mon Sep 17 00:00:00 2001 From: David Redondo Date: Mon, 10 Jul 2023 11:25:01 +0200 Subject: [PATCH 1324/1507] client: Implement dialog-v1 protocol Allows to mark windows as modal dialogs. Change-Id: Ie4999552933e02fc473e621e7cc5e3f2928c0adb Reviewed-by: Vlad Zahorodnii Reviewed-by: Qt CI Bot --- .../wayland/protocols/qt_attribution.json | 17 +++ .../wayland/protocols/xdg-dialog-v1.xml | 110 ++++++++++++++++++ .../shellintegration/xdg-shell/CMakeLists.txt | 2 + .../xdg-shell/qwaylandxdgdialogv1.cpp | 33 ++++++ .../xdg-shell/qwaylandxdgdialogv1_p.h | 32 +++++ .../xdg-shell/qwaylandxdgshell.cpp | 20 +++- .../xdg-shell/qwaylandxdgshell_p.h | 4 + tests/auto/wayland/shared/CMakeLists.txt | 3 + tests/auto/wayland/shared/mockcompositor.cpp | 1 + tests/auto/wayland/shared/mockcompositor.h | 2 + tests/auto/wayland/shared/xdgdialog.cpp | 59 ++++++++++ tests/auto/wayland/shared/xdgdialog.h | 49 ++++++++ tests/auto/wayland/xdgshell/tst_xdgshell.cpp | 36 ++++++ 13 files changed, 363 insertions(+), 5 deletions(-) create mode 100644 src/3rdparty/wayland/protocols/xdg-dialog-v1.xml create mode 100644 src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgdialogv1.cpp create mode 100644 src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgdialogv1_p.h create mode 100644 tests/auto/wayland/shared/xdgdialog.cpp create mode 100644 tests/auto/wayland/shared/xdgdialog.h diff --git a/src/3rdparty/wayland/protocols/qt_attribution.json b/src/3rdparty/wayland/protocols/qt_attribution.json index 33a4f17c43d..6ced46a2b6c 100644 --- a/src/3rdparty/wayland/protocols/qt_attribution.json +++ b/src/3rdparty/wayland/protocols/qt_attribution.json @@ -336,5 +336,22 @@ "License": "MIT License", "LicenseFile": "MIT_LICENSE.txt", "Copyright": "Copyright © 2022 Kenny Levinsen" + }, + + { + "Id": "xdg-dialog-v1", + "Name": "Wayland Dialog Protocol", + "QDocModule": "qtwaylandcompositor", + "QtUsage": "Used in the Qt Wayland platform plugin", + "Files": "xdg-dialog-v1.xml", + + "Description": "Register toplevel as dialogs", + "Homepage": "https://wayland.freedesktop.org", + "Version": "1", + "DownloadLocation": "", + "LicenseId": "MIT", + "License": "MIT License", + "LicenseFile": "MIT_LICENSE.txt", + "Copyright": "Copyright © 2023 Carlos Garnacho" } ] diff --git a/src/3rdparty/wayland/protocols/xdg-dialog-v1.xml b/src/3rdparty/wayland/protocols/xdg-dialog-v1.xml new file mode 100644 index 00000000000..ed2141132ba --- /dev/null +++ b/src/3rdparty/wayland/protocols/xdg-dialog-v1.xml @@ -0,0 +1,110 @@ + + + + Copyright © 2023 Carlos Garnacho + + 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. + + + + + The xdg_wm_dialog_v1 interface is exposed as a global object allowing + to register surfaces with a xdg_toplevel role as "dialogs" relative to + another toplevel. + + The compositor may let this relation influence how the surface is + placed, displayed or interacted with. + + Warning! The protocol described in this file is currently in the testing + phase. Backward compatible changes may be added together with the + corresponding interface version bump. Backward incompatible changes can + only be done by creating a new major version of the extension. + + + + + + + + + Destroys the xdg_wm_dialog_v1 object. This does not affect + the xdg_dialog_v1 objects generated through it. + + + + + + Creates a xdg_dialog_v1 object for the given toplevel. See the interface + description for more details. + + Compositors must raise an already_used error if clients attempt to + create multiple xdg_dialog_v1 objects for the same xdg_toplevel. + + + + + + + + + A xdg_dialog_v1 object is an ancillary object tied to a xdg_toplevel. Its + purpose is hinting the compositor that the toplevel is a "dialog" (e.g. a + temporary window) relative to another toplevel (see + xdg_toplevel.set_parent). If the xdg_toplevel is destroyed, the xdg_dialog_v1 + becomes inert. + + Through this object, the client may provide additional hints about + the purpose of the secondary toplevel. This interface has no effect + on toplevels that are not attached to a parent toplevel. + + + + + Destroys the xdg_dialog_v1 object. If this object is destroyed + before the related xdg_toplevel, the compositor should unapply its + effects. + + + + + + Hints that the dialog has "modal" behavior. Modal dialogs typically + require to be fully addressed by the user (i.e. closed) before resuming + interaction with the parent toplevel, and may require a distinct + presentation. + + Clients must implement the logic to filter events in the parent + toplevel on their own. + + Compositors may choose any policy in event delivery to the parent + toplevel, from delivering all events unfiltered to using them for + internal consumption. + + + + + + Drops the hint that this dialog has "modal" behavior. See + xdg_dialog_v1.set_modal for more details. + + + + diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/CMakeLists.txt index a33a28a7e2a..af5a97feecd 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/CMakeLists.txt +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/CMakeLists.txt @@ -17,6 +17,7 @@ qt_internal_add_plugin(QWaylandXdgShellIntegrationPlugin qwaylandxdgshell.cpp qwaylandxdgshell_p.h qwaylandxdgshellintegration.cpp qwaylandxdgshellintegration_p.h qwaylandxdgexporterv2.cpp qwaylandxdgexporterv2_p.h + qwaylandxdgdialogv1.cpp qwaylandxdgdialogv1_p.h LIBRARIES Qt::Core Qt::Gui @@ -31,6 +32,7 @@ qt6_generate_wayland_protocol_client_sources(QWaylandXdgShellIntegrationPlugin ${CMAKE_CURRENT_SOURCE_DIR}/../../../3rdparty/protocol/xdg-shell.xml ${CMAKE_CURRENT_SOURCE_DIR}/../../../3rdparty/protocol/xdg-activation-v1.xml ${CMAKE_CURRENT_SOURCE_DIR}/../../../3rdparty/protocol/xdg-foreign-unstable-v2.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../../../3rdparty/protocol/xdg-dialog-v1.xml ) #### Keys ignored in scope 1:.:.:xdg-shell.pro:: diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgdialogv1.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgdialogv1.cpp new file mode 100644 index 00000000000..abf6746232a --- /dev/null +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgdialogv1.cpp @@ -0,0 +1,33 @@ +// Copyright (C) 2023 David Reondo +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#include "qwaylandxdgdialogv1_p.h" + +QT_BEGIN_NAMESPACE + +namespace QtWaylandClient { + +QWaylandXdgDialogV1::QWaylandXdgDialogV1(::xdg_dialog_v1 *object) : xdg_dialog_v1(object) { } + +QWaylandXdgDialogV1::~QWaylandXdgDialogV1() +{ + xdg_dialog_v1_destroy(object()); +} + +QWaylandXdgDialogWmV1::QWaylandXdgDialogWmV1(wl_registry *registry, uint32_t id, int version) + : xdg_wm_dialog_v1(registry, id, version) +{ +} + +QWaylandXdgDialogWmV1::~QWaylandXdgDialogWmV1() +{ + destroy(); +} +QWaylandXdgDialogV1 *QWaylandXdgDialogWmV1::getDialog(xdg_toplevel *toplevel) +{ + return new QWaylandXdgDialogV1(get_xdg_dialog(toplevel)); +} + +} // namespace QtWaylandClient + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgdialogv1_p.h b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgdialogv1_p.h new file mode 100644 index 00000000000..f5465a63e6f --- /dev/null +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgdialogv1_p.h @@ -0,0 +1,32 @@ +// Copyright (C) 2022 David Reondo +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QWAYLANDDIALOGV1_P_H +#define QWAYLANDDIALOGV1_P_H + +#include + +QT_BEGIN_NAMESPACE + +namespace QtWaylandClient { + +class QWaylandXdgDialogV1 : public QtWayland::xdg_dialog_v1 +{ +public: + QWaylandXdgDialogV1(::xdg_dialog_v1 *object); + ~QWaylandXdgDialogV1() override; +}; + +class QWaylandXdgDialogWmV1 : public QtWayland::xdg_wm_dialog_v1 +{ +public: + QWaylandXdgDialogWmV1(wl_registry *registry, uint32_t id, int version); + ~QWaylandXdgDialogWmV1() override; + QWaylandXdgDialogV1 *getDialog(xdg_toplevel *toplevel); +}; + +} // namespace QtWaylandClient + +QT_END_NAMESPACE + +#endif diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp index 498710bebe7..d338f7475ba 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp @@ -6,6 +6,7 @@ #include "qwaylandxdgshell_p.h" #include "qwaylandxdgexporterv2_p.h" +#include "qwaylandxdgdialogv1_p.h" #include #include @@ -32,6 +33,16 @@ QWaylandXdgSurface::Toplevel::Toplevel(QWaylandXdgSurface *xdgSurface) } requestWindowStates(window->windowStates()); requestWindowFlags(window->flags()); + if (auto transientParent = xdgSurface->window()->transientParent()) { + if (auto parentSurface = + qobject_cast(transientParent->shellSurface())) { + set_parent(parentSurface->m_toplevel->object()); + if (window->modality() != Qt::NonModal && m_xdgSurface->m_shell->m_xdgDialogWm) { + m_xdgDialog.reset(m_xdgSurface->m_shell->m_xdgDialogWm->getDialog(object())); + m_xdgDialog->set_modal(); + } + } + } } QWaylandXdgSurface::Toplevel::~Toplevel() @@ -296,11 +307,6 @@ QWaylandXdgSurface::QWaylandXdgSurface(QWaylandXdgShell *shell, ::xdg_surface *s setGrabPopup(transientParent, display->lastInputDevice(), display->lastInputSerial()); } else { setToplevel(); - if (transientParent) { - auto parentXdgSurface = qobject_cast(transientParent->shellSurface()); - if (parentXdgSurface) - m_toplevel->set_parent(parentXdgSurface->m_toplevel->object()); - } } setSizeHints(); } @@ -752,6 +758,10 @@ void QWaylandXdgShell::handleRegistryGlobal(void *data, wl_registry *registry, u if (interface == QLatin1String(QWaylandXdgExporterV2::interface()->name)) { xdgShell->m_xdgExporter.reset(new QWaylandXdgExporterV2(registry, id, version)); } + + if (interface == QLatin1String(QWaylandXdgDialogWmV1::interface()->name)) { + xdgShell->m_xdgDialogWm.reset(new QWaylandXdgDialogWmV1(registry, id, version)); + } } } diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h index 0310706fd94..22a207a25f7 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h @@ -39,6 +39,8 @@ class QWaylandInputDevice; class QWaylandXdgShell; class QWaylandXdgExportedV2; class QWaylandXdgExporterV2; +class QWaylandXdgDialogWmV1; +class QWaylandXdgDialogV1; class Q_WAYLANDCLIENT_EXPORT QWaylandXdgSurface : public QWaylandShellSurface, public QtWayland::xdg_surface { @@ -109,6 +111,7 @@ private: QWaylandXdgSurface *m_xdgSurface = nullptr; QWaylandXdgToplevelDecorationV1 *m_decoration = nullptr; QScopedPointer m_exported; + QScopedPointer m_xdgDialog; }; class Popup : public QtWayland::xdg_popup { @@ -171,6 +174,7 @@ private: QScopedPointer m_xdgDecorationManager; QScopedPointer m_xdgActivation; QScopedPointer m_xdgExporter; + QScopedPointer m_xdgDialogWm; friend class QWaylandXdgSurface; }; diff --git a/tests/auto/wayland/shared/CMakeLists.txt b/tests/auto/wayland/shared/CMakeLists.txt index ee81b4d6866..1d64f2956e0 100644 --- a/tests/auto/wayland/shared/CMakeLists.txt +++ b/tests/auto/wayland/shared/CMakeLists.txt @@ -16,6 +16,7 @@ qt_manual_moc(moc_files textinput.h qttextinput.h viewport.h + xdgdialog.h xdgoutputv1.h xdgshell.h ) @@ -33,6 +34,7 @@ add_library(SharedClientTest qttextinput.cpp qttextinput.h xdgoutputv1.cpp xdgoutputv1.h xdgshell.cpp xdgshell.h + xdgdialog.cpp xdgdialog.h viewport.cpp viewport.h ${moc_files} ) @@ -50,6 +52,7 @@ qt6_generate_wayland_protocol_server_sources(SharedClientTest ${PROJECT_SOURCE_DIR}/src/3rdparty/protocol/viewporter.xml ${PROJECT_SOURCE_DIR}/src/3rdparty/protocol/wayland.xml ${PROJECT_SOURCE_DIR}/src/3rdparty/protocol/xdg-decoration-unstable-v1.xml + ${PROJECT_SOURCE_DIR}/src/3rdparty/protocol/xdg-dialog-v1.xml ${PROJECT_SOURCE_DIR}/src/3rdparty/protocol/xdg-output-unstable-v1.xml ${PROJECT_SOURCE_DIR}/src/3rdparty/protocol/xdg-shell.xml ) diff --git a/tests/auto/wayland/shared/mockcompositor.cpp b/tests/auto/wayland/shared/mockcompositor.cpp index 571117d6b4b..d6eb560c91b 100644 --- a/tests/auto/wayland/shared/mockcompositor.cpp +++ b/tests/auto/wayland/shared/mockcompositor.cpp @@ -23,6 +23,7 @@ DefaultCompositor::DefaultCompositor(CompositorType t, int socketFd) add(); add(); add(); + add(); switch (m_type) { case CompositorType::Default: diff --git a/tests/auto/wayland/shared/mockcompositor.h b/tests/auto/wayland/shared/mockcompositor.h index 268f77680df..7cde399545a 100644 --- a/tests/auto/wayland/shared/mockcompositor.h +++ b/tests/auto/wayland/shared/mockcompositor.h @@ -13,6 +13,7 @@ #include "xdgshell.h" #include "viewport.h" #include "fractionalscalev1.h" +#include "xdgdialog.h" #include @@ -50,6 +51,7 @@ public: IviSurface *iviSurface(int i = 0) { return get()->m_iviSurfaces.value(i, nullptr); } FractionalScale *fractionalScale(int i = 0) {return get()->m_fractionalScales.value(i, nullptr); } Viewport *viewport(int i = 0) {return get()->m_viewports.value(i, nullptr); } + XdgDialog *xdgDialog(int i = 0) { return get()->m_dialogs.value(i, nullptr); } uint sendXdgShellPing(); void xdgPingAndWaitForPong(); diff --git a/tests/auto/wayland/shared/xdgdialog.cpp b/tests/auto/wayland/shared/xdgdialog.cpp new file mode 100644 index 00000000000..065a0fd3c2e --- /dev/null +++ b/tests/auto/wayland/shared/xdgdialog.cpp @@ -0,0 +1,59 @@ +// Copyright (C) 2024 David Redondo +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +#include "xdgdialog.h" + +#include "xdgshell.h" + +namespace MockCompositor { + +XdgDialog::XdgDialog(XdgWmDialog *wm, XdgToplevel *toplevel, wl_client *client, int id, int version) + : QtWaylandServer::xdg_dialog_v1(client, id, version), + toplevel(toplevel), + modal(false), + m_wm(wm) +{ +} + +void XdgDialog::xdg_dialog_v1_set_modal(Resource *resource) +{ + Q_UNUSED(resource) + modal = true; +} + +void XdgDialog::xdg_dialog_v1_unset_modal(Resource *resource) +{ + Q_UNUSED(resource) + modal = false; +} + +void XdgDialog::xdg_dialog_v1_destroy(Resource *resource) +{ + wl_resource_destroy(resource->handle); +} + +void XdgDialog::xdg_dialog_v1_destroy_resource(Resource *resource) +{ + Q_UNUSED(resource) + m_wm->m_dialogs.removeOne(this); + delete this; +} + +XdgWmDialog::XdgWmDialog(CoreCompositor *compositor, int version) + : QtWaylandServer::xdg_wm_dialog_v1(compositor->m_display, version) +{ +} + +void XdgWmDialog::xdg_wm_dialog_v1_destroy(Resource *resource) +{ + wl_resource_destroy(resource->handle); +} + +void XdgWmDialog::xdg_wm_dialog_v1_get_xdg_dialog(Resource *resource, uint32_t id, + struct ::wl_resource *toplevel) +{ + auto *t = fromResource(toplevel); + auto *dialog = new XdgDialog(this, t, resource->client(), id, resource->version()); + m_dialogs.push_back(dialog); +} + +} // namespace MockCompositor diff --git a/tests/auto/wayland/shared/xdgdialog.h b/tests/auto/wayland/shared/xdgdialog.h new file mode 100644 index 00000000000..6b4ccd0bcbe --- /dev/null +++ b/tests/auto/wayland/shared/xdgdialog.h @@ -0,0 +1,49 @@ +// Copyright (C) 2024 David Redondo +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 + +#ifndef MOCKCOMPOSITOR_XDG_DIALOG_H +#define MOCKCOMPOSITOR_XDG_DIALOG_H + +#include "corecompositor.h" +#include + +namespace MockCompositor { + +class XdgToplevel; +class XdgWmDialog; + +class XdgDialog : public QtWaylandServer::xdg_dialog_v1 +{ +public: + explicit XdgDialog(XdgWmDialog *wm, XdgToplevel *toplevel, wl_client *client, int id, + int version); + XdgToplevel *toplevel; + bool modal; + +protected: + void xdg_dialog_v1_set_modal(Resource *resource) override; + void xdg_dialog_v1_unset_modal(Resource *resource) override; + void xdg_dialog_v1_destroy(Resource *resource) override; + void xdg_dialog_v1_destroy_resource(Resource *resource) override; + +private: + XdgWmDialog *m_wm; +}; + +class XdgWmDialog : public Global, public QtWaylandServer::xdg_wm_dialog_v1 +{ + Q_OBJECT +public: + explicit XdgWmDialog(CoreCompositor *compositor, int version = 1); + ~XdgWmDialog() = default; + QList m_dialogs; + +protected: + void xdg_wm_dialog_v1_destroy(Resource *resource) override; + void xdg_wm_dialog_v1_get_xdg_dialog(Resource *resource, uint32_t id, + struct ::wl_resource *toplevel) override; +}; + +} // namespace MockCompositor + +#endif diff --git a/tests/auto/wayland/xdgshell/tst_xdgshell.cpp b/tests/auto/wayland/xdgshell/tst_xdgshell.cpp index a3e96d444d8..f222165e917 100644 --- a/tests/auto/wayland/xdgshell/tst_xdgshell.cpp +++ b/tests/auto/wayland/xdgshell/tst_xdgshell.cpp @@ -34,6 +34,7 @@ private slots: void nativeResources(); void suspended(); void initiallySuspended(); + void modality(); }; void tst_xdgshell::init() @@ -769,5 +770,40 @@ void tst_xdgshell::initiallySuspended() QVERIFY(!window.isExposed()); } +void tst_xdgshell::modality() +{ + QRasterWindow parent; + parent.resize(400, 320); + parent.show(); + + QRasterWindow child; + child.resize(400, 320); + child.setTransientParent(&parent); + child.show(); + QCOMPOSITOR_TRY_VERIFY(xdgToplevel(1)); + QCOMPOSITOR_VERIFY(!xdgDialog()); + + child.hide(); + child.setModality(Qt::WindowModal); + child.show(); + QCOMPOSITOR_TRY_VERIFY(xdgDialog()); + QCOMPOSITOR_VERIFY(xdgDialog()->modal); + + child.hide(); + QCOMPOSITOR_TRY_VERIFY(!xdgDialog()); + + child.setModality(Qt::ApplicationModal); + child.show(); + QCOMPOSITOR_TRY_VERIFY(xdgDialog()); + QCOMPOSITOR_VERIFY(xdgDialog()->modal); + + child.hide(); + QCOMPOSITOR_TRY_VERIFY(!xdgDialog()); + + child.show(); + child.setModality(Qt::NonModal); + QCOMPOSITOR_TRY_VERIFY(!xdgDialog()); +} + QCOMPOSITOR_TEST_MAIN(tst_xdgshell) #include "tst_xdgshell.moc" From 2ab62833e297e2b900cca57dfc11349a181c43ce Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Sat, 6 Jan 2024 23:18:51 +0400 Subject: [PATCH 1325/1507] Client: Replace a bunch of frameMargins with clientSideMargins Use it wherever window coordinates should be translated to surface coordinates This also fixes the usage of QWindow::mapFromGlobal which is in wrong coordinate space while handling CSD dragging from pending touch points Change-Id: I66b114610f0e44fea10535594adb5d1284196662 Reviewed-by: David Edmundson --- src/plugins/platforms/wayland/qwaylandinputdevice.cpp | 4 ++-- src/plugins/platforms/wayland/qwaylandwindow.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index d8068c1471c..1df7ac4833b 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -1560,9 +1560,9 @@ void QWaylandInputDevice::Touch::touch_frame() const QWindowSystemInterface::TouchPoint &tp = mPendingTouchPoints.constLast(); // When the touch event is received, the global pos is calculated with the margins // in mind. Now we need to adjust again to get the correct local pos back. - QMargins margins = window->frameMargins(); + QMargins margins = mFocus->clientSideMargins(); QPoint p = tp.area.center().toPoint(); - QPointF localPos(window->mapFromGlobal(QPoint(p.x() + margins.left(), p.y() + margins.top()))); + QPointF localPos(mFocus->mapFromGlobal(p) + QPoint(margins.left(), margins.top())); if (mFocus->touchDragDecoration(mParent, localPos, tp.area.center(), tp.state, mParent->modifiers())) return; } diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index dcc086420fc..34250d11342 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -1376,7 +1376,7 @@ void QWaylandWindow::handleMouseEventWithDecoration(QWaylandInputDevice *inputDe return; } - QMargins marg = frameMargins(); + QMargins marg = clientSideMargins(); QRect windowRect(0 + marg.left(), 0 + marg.top(), geometry().size().width(), From aff3a43bf067656d326bb17f31ee097684213c22 Mon Sep 17 00:00:00 2001 From: Kai Uwe Broulik Date: Thu, 11 Jan 2024 20:54:34 +0100 Subject: [PATCH 1326/1507] QWaylandDisplay: Allow software-only deco and don't init GL needlessly Don't initialize the client buffer integration just to check whether it can do a decoration. If we had a GL window, it would have initialized GL already. Also, we can do software-rendered decorations nowadays, only disable them if the integration explicitly says it can't. Change-Id: I396d32796a10ccffd6ef3bb0c5eaa3a1078b8d79 Reviewed-by: Ilya Fedin Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/plugins/platforms/wayland/qwaylanddisplay.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index 265f0bb3f19..07fbe0b4105 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -891,7 +891,12 @@ bool QWaylandDisplay::supportsWindowDecoration() const if (disabled) return false; - static bool integrationSupport = clientBufferIntegration() && clientBufferIntegration()->supportsWindowDecoration(); + // Don't initialize client buffer integration just to check whether it can have a decoration. + if (!mWaylandIntegration->mClientBufferIntegrationInitialized) + return true; + + // We can do software-rendered decorations, only disable them if the integration explicitly says it can't. + static bool integrationSupport = !clientBufferIntegration() || clientBufferIntegration()->supportsWindowDecoration(); return integrationSupport; } From f3418491f2bbeb0f98abea6255c05dbe5ed4a94f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucie=20G=C3=A9rard?= Date: Thu, 28 Mar 2024 13:18:41 +0100 Subject: [PATCH 1327/1507] Correct license for test files MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit According to QUIP-18 [1], all test files should be LicenseRef-Qt-Commercial OR GPL-3.0-only [1]: https://contribute.qt-project.org/quips/18 Task-number: QTBUG-121787 Change-Id: I35b93ca5f2fd27685eda4aafda48c24925c0c56f Reviewed-by: Kai Köhne --- tests/auto/wayland/client/tst_client.cpp | 2 +- tests/auto/wayland/clientextension/tst_clientextension.cpp | 2 +- tests/auto/wayland/cursor/cursorshapev1.cpp | 2 +- tests/auto/wayland/cursor/cursorshapev1.h | 2 +- tests/auto/wayland/cursor/tst_cursor.cpp | 2 +- tests/auto/wayland/datadevicev1/tst_datadevicev1.cpp | 2 +- tests/auto/wayland/fullscreenshellv1/tst_fullscreenshellv1.cpp | 2 +- tests/auto/wayland/inputcontext/tst_inputcontext.cpp | 2 +- tests/auto/wayland/multithreaded/tst_multithreaded.cpp | 2 +- tests/auto/wayland/nooutput/tst_nooutput.cpp | 2 +- tests/auto/wayland/output/tst_output.cpp | 2 +- .../auto/wayland/primaryselectionv1/tst_primaryselectionv1.cpp | 2 +- tests/auto/wayland/reconnect/tst_reconnect.cpp | 2 +- tests/auto/wayland/reconnect/wl-socket.c | 2 +- tests/auto/wayland/reconnect/wl-socket.h | 2 +- tests/auto/wayland/scaling/tst_scaling.cpp | 2 +- tests/auto/wayland/seat/tst_seat.cpp | 2 +- tests/auto/wayland/seatv4/tst_seatv4.cpp | 2 +- tests/auto/wayland/seatv7/tst_seatv7.cpp | 2 +- tests/auto/wayland/shared/corecompositor.cpp | 2 +- tests/auto/wayland/shared/corecompositor.h | 2 +- tests/auto/wayland/shared/coreprotocol.cpp | 2 +- tests/auto/wayland/shared/coreprotocol.h | 2 +- tests/auto/wayland/shared/datadevice.cpp | 2 +- tests/auto/wayland/shared/datadevice.h | 2 +- tests/auto/wayland/shared/fractionalscalev1.cpp | 2 +- tests/auto/wayland/shared/fractionalscalev1.h | 2 +- tests/auto/wayland/shared/fullscreenshellv1.cpp | 2 +- tests/auto/wayland/shared/fullscreenshellv1.h | 2 +- tests/auto/wayland/shared/mockcompositor.cpp | 2 +- tests/auto/wayland/shared/mockcompositor.h | 2 +- tests/auto/wayland/shared/qttextinput.cpp | 2 +- tests/auto/wayland/shared/qttextinput.h | 2 +- tests/auto/wayland/shared/textinput.cpp | 2 +- tests/auto/wayland/shared/textinput.h | 2 +- tests/auto/wayland/shared/viewport.cpp | 2 +- tests/auto/wayland/shared/viewport.h | 2 +- tests/auto/wayland/shared/xdgdialog.cpp | 2 +- tests/auto/wayland/shared/xdgdialog.h | 2 +- tests/auto/wayland/shared/xdgoutputv1.cpp | 2 +- tests/auto/wayland/shared/xdgoutputv1.h | 2 +- tests/auto/wayland/shared/xdgshell.cpp | 2 +- tests/auto/wayland/shared/xdgshell.h | 2 +- tests/auto/wayland/surface/tst_surface.cpp | 2 +- tests/auto/wayland/tabletv2/tst_tabletv2.cpp | 2 +- tests/auto/wayland/wl_connect/tst_wlconnect.cpp | 2 +- tests/auto/wayland/xdgdecorationv1/tst_xdgdecorationv1.cpp | 2 +- tests/auto/wayland/xdgoutput/tst_xdgoutput.cpp | 2 +- tests/auto/wayland/xdgshell/tst_xdgshell.cpp | 2 +- 49 files changed, 49 insertions(+), 49 deletions(-) diff --git a/tests/auto/wayland/client/tst_client.cpp b/tests/auto/wayland/client/tst_client.cpp index c64862f0945..253a98b733d 100644 --- a/tests/auto/wayland/client/tst_client.cpp +++ b/tests/auto/wayland/client/tst_client.cpp @@ -1,5 +1,5 @@ // Copyright (C) 2016 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include "mockcompositor.h" diff --git a/tests/auto/wayland/clientextension/tst_clientextension.cpp b/tests/auto/wayland/clientextension/tst_clientextension.cpp index c1cd1cb1fa3..8dd4e0d98f6 100644 --- a/tests/auto/wayland/clientextension/tst_clientextension.cpp +++ b/tests/auto/wayland/clientextension/tst_clientextension.cpp @@ -1,5 +1,5 @@ // Copyright (C) 2021 David Redondo -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include #include diff --git a/tests/auto/wayland/cursor/cursorshapev1.cpp b/tests/auto/wayland/cursor/cursorshapev1.cpp index 7fd93ed1d3b..93750df9501 100644 --- a/tests/auto/wayland/cursor/cursorshapev1.cpp +++ b/tests/auto/wayland/cursor/cursorshapev1.cpp @@ -1,5 +1,5 @@ // Copyright (C) 2023 David Edmundson -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include "cursorshapev1.h" diff --git a/tests/auto/wayland/cursor/cursorshapev1.h b/tests/auto/wayland/cursor/cursorshapev1.h index a8c2376aee7..0befc322318 100644 --- a/tests/auto/wayland/cursor/cursorshapev1.h +++ b/tests/auto/wayland/cursor/cursorshapev1.h @@ -1,5 +1,5 @@ // Copyright (C) 2023 David Edmundson -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #ifndef MOCKCOMPOSITOR_CURSORSHAPE_H #define MOCKCOMPOSITOR_CURSORSHAPE_H diff --git a/tests/auto/wayland/cursor/tst_cursor.cpp b/tests/auto/wayland/cursor/tst_cursor.cpp index 8681eff1127..070e062f6e3 100644 --- a/tests/auto/wayland/cursor/tst_cursor.cpp +++ b/tests/auto/wayland/cursor/tst_cursor.cpp @@ -1,5 +1,5 @@ // Copyright (C) 2023 David Edmundson -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include "mockcompositor.h" #include diff --git a/tests/auto/wayland/datadevicev1/tst_datadevicev1.cpp b/tests/auto/wayland/datadevicev1/tst_datadevicev1.cpp index ef966b9c9d3..50d78130a52 100644 --- a/tests/auto/wayland/datadevicev1/tst_datadevicev1.cpp +++ b/tests/auto/wayland/datadevicev1/tst_datadevicev1.cpp @@ -1,5 +1,5 @@ // Copyright (C) 2018 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include "mockcompositor.h" diff --git a/tests/auto/wayland/fullscreenshellv1/tst_fullscreenshellv1.cpp b/tests/auto/wayland/fullscreenshellv1/tst_fullscreenshellv1.cpp index 15613bc0485..ba897d53f21 100644 --- a/tests/auto/wayland/fullscreenshellv1/tst_fullscreenshellv1.cpp +++ b/tests/auto/wayland/fullscreenshellv1/tst_fullscreenshellv1.cpp @@ -1,7 +1,7 @@ // Copyright (C) 2021 David Edmundson // Copyright (C) 2018 Pier Luigi Fiorini // Copyright (C) 2017 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include "mockcompositor.h" diff --git a/tests/auto/wayland/inputcontext/tst_inputcontext.cpp b/tests/auto/wayland/inputcontext/tst_inputcontext.cpp index 328dc1fb217..47a453bb5ee 100644 --- a/tests/auto/wayland/inputcontext/tst_inputcontext.cpp +++ b/tests/auto/wayland/inputcontext/tst_inputcontext.cpp @@ -1,5 +1,5 @@ // Copyright (C) 2019 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include "mockcompositor.h" #include "textinput.h" diff --git a/tests/auto/wayland/multithreaded/tst_multithreaded.cpp b/tests/auto/wayland/multithreaded/tst_multithreaded.cpp index 562d9b38807..a1a7d367ef3 100644 --- a/tests/auto/wayland/multithreaded/tst_multithreaded.cpp +++ b/tests/auto/wayland/multithreaded/tst_multithreaded.cpp @@ -1,6 +1,6 @@ // Copyright (C) 2018 The Qt Company Ltd. // Copyright (C) 2020 UBports Foundataion. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include #include diff --git a/tests/auto/wayland/nooutput/tst_nooutput.cpp b/tests/auto/wayland/nooutput/tst_nooutput.cpp index 81903045574..1d8a838f34f 100644 --- a/tests/auto/wayland/nooutput/tst_nooutput.cpp +++ b/tests/auto/wayland/nooutput/tst_nooutput.cpp @@ -1,5 +1,5 @@ // Copyright (C) 2019 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include "mockcompositor.h" #include diff --git a/tests/auto/wayland/output/tst_output.cpp b/tests/auto/wayland/output/tst_output.cpp index f43c7a44ee3..2129e167b50 100644 --- a/tests/auto/wayland/output/tst_output.cpp +++ b/tests/auto/wayland/output/tst_output.cpp @@ -1,5 +1,5 @@ // Copyright (C) 2019 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include "mockcompositor.h" #include diff --git a/tests/auto/wayland/primaryselectionv1/tst_primaryselectionv1.cpp b/tests/auto/wayland/primaryselectionv1/tst_primaryselectionv1.cpp index b5539f1f09e..53a048a3553 100644 --- a/tests/auto/wayland/primaryselectionv1/tst_primaryselectionv1.cpp +++ b/tests/auto/wayland/primaryselectionv1/tst_primaryselectionv1.cpp @@ -1,5 +1,5 @@ // Copyright (C) 2018 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include "mockcompositor.h" diff --git a/tests/auto/wayland/reconnect/tst_reconnect.cpp b/tests/auto/wayland/reconnect/tst_reconnect.cpp index c7f7d8f8936..ff806af6a17 100644 --- a/tests/auto/wayland/reconnect/tst_reconnect.cpp +++ b/tests/auto/wayland/reconnect/tst_reconnect.cpp @@ -1,5 +1,5 @@ // Copyright (C) 2023 David Edmundson -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include "mockcompositor.h" diff --git a/tests/auto/wayland/reconnect/wl-socket.c b/tests/auto/wayland/reconnect/wl-socket.c index f96de8c73bf..3d449162251 100644 --- a/tests/auto/wayland/reconnect/wl-socket.c +++ b/tests/auto/wayland/reconnect/wl-socket.c @@ -1,5 +1,5 @@ // Copyright (C) 2023 David Edmundson -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #define _DEFAULT_SOURCE #include diff --git a/tests/auto/wayland/reconnect/wl-socket.h b/tests/auto/wayland/reconnect/wl-socket.h index 285870e0179..c2e68120ffa 100644 --- a/tests/auto/wayland/reconnect/wl-socket.h +++ b/tests/auto/wayland/reconnect/wl-socket.h @@ -1,5 +1,5 @@ // Copyright (C) 2023 David Edmundson -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #pragma once diff --git a/tests/auto/wayland/scaling/tst_scaling.cpp b/tests/auto/wayland/scaling/tst_scaling.cpp index 9d8283d6e84..b4d2995ea72 100644 --- a/tests/auto/wayland/scaling/tst_scaling.cpp +++ b/tests/auto/wayland/scaling/tst_scaling.cpp @@ -1,5 +1,5 @@ // Copyright (C) 2022 David Edmundson -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include "mockcompositor.h" #include diff --git a/tests/auto/wayland/seat/tst_seat.cpp b/tests/auto/wayland/seat/tst_seat.cpp index d3bc1eda3bc..45ae7251c8b 100644 --- a/tests/auto/wayland/seat/tst_seat.cpp +++ b/tests/auto/wayland/seat/tst_seat.cpp @@ -1,5 +1,5 @@ // Copyright (C) 2018 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include "mockcompositor.h" #include diff --git a/tests/auto/wayland/seatv4/tst_seatv4.cpp b/tests/auto/wayland/seatv4/tst_seatv4.cpp index 7b80c02f508..cc1cf0afd2a 100644 --- a/tests/auto/wayland/seatv4/tst_seatv4.cpp +++ b/tests/auto/wayland/seatv4/tst_seatv4.cpp @@ -1,5 +1,5 @@ // Copyright (C) 2018 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include "mockcompositor.h" diff --git a/tests/auto/wayland/seatv7/tst_seatv7.cpp b/tests/auto/wayland/seatv7/tst_seatv7.cpp index 0af22718465..f82b84b5828 100644 --- a/tests/auto/wayland/seatv7/tst_seatv7.cpp +++ b/tests/auto/wayland/seatv7/tst_seatv7.cpp @@ -1,5 +1,5 @@ // Copyright (C) 2018 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include "mockcompositor.h" #include diff --git a/tests/auto/wayland/shared/corecompositor.cpp b/tests/auto/wayland/shared/corecompositor.cpp index 9b2c7deae1d..d110768ec00 100644 --- a/tests/auto/wayland/shared/corecompositor.cpp +++ b/tests/auto/wayland/shared/corecompositor.cpp @@ -1,5 +1,5 @@ // Copyright (C) 2018 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include "corecompositor.h" #include diff --git a/tests/auto/wayland/shared/corecompositor.h b/tests/auto/wayland/shared/corecompositor.h index 6fd14371c3e..2df1b57589a 100644 --- a/tests/auto/wayland/shared/corecompositor.h +++ b/tests/auto/wayland/shared/corecompositor.h @@ -1,5 +1,5 @@ // Copyright (C) 2018 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #ifndef MOCKCOMPOSITOR_CORECOMPOSITOR_H #define MOCKCOMPOSITOR_CORECOMPOSITOR_H diff --git a/tests/auto/wayland/shared/coreprotocol.cpp b/tests/auto/wayland/shared/coreprotocol.cpp index 915b0f914cb..833ad4b097f 100644 --- a/tests/auto/wayland/shared/coreprotocol.cpp +++ b/tests/auto/wayland/shared/coreprotocol.cpp @@ -1,5 +1,5 @@ // Copyright (C) 2018 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include "coreprotocol.h" #include "datadevice.h" diff --git a/tests/auto/wayland/shared/coreprotocol.h b/tests/auto/wayland/shared/coreprotocol.h index 15ade2bcadb..0f59441a386 100644 --- a/tests/auto/wayland/shared/coreprotocol.h +++ b/tests/auto/wayland/shared/coreprotocol.h @@ -1,5 +1,5 @@ // Copyright (C) 2018 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #ifndef MOCKCOMPOSITOR_COREPROTOCOL_H #define MOCKCOMPOSITOR_COREPROTOCOL_H diff --git a/tests/auto/wayland/shared/datadevice.cpp b/tests/auto/wayland/shared/datadevice.cpp index 2a874a77faf..efb88d0b1f8 100644 --- a/tests/auto/wayland/shared/datadevice.cpp +++ b/tests/auto/wayland/shared/datadevice.cpp @@ -1,5 +1,5 @@ // Copyright (C) 2018 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include "datadevice.h" diff --git a/tests/auto/wayland/shared/datadevice.h b/tests/auto/wayland/shared/datadevice.h index 792a3e4bb3a..356dfa74a3a 100644 --- a/tests/auto/wayland/shared/datadevice.h +++ b/tests/auto/wayland/shared/datadevice.h @@ -1,5 +1,5 @@ // Copyright (C) 2018 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #ifndef MOCKCOMPOSITOR_DATADEVICE_H #define MOCKCOMPOSITOR_DATADEVICE_H diff --git a/tests/auto/wayland/shared/fractionalscalev1.cpp b/tests/auto/wayland/shared/fractionalscalev1.cpp index 5548c3d674b..28c77802523 100644 --- a/tests/auto/wayland/shared/fractionalscalev1.cpp +++ b/tests/auto/wayland/shared/fractionalscalev1.cpp @@ -1,5 +1,5 @@ // Copyright (C) 2022 David Edmundson -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include "fractionalscalev1.h" diff --git a/tests/auto/wayland/shared/fractionalscalev1.h b/tests/auto/wayland/shared/fractionalscalev1.h index fd5483e93ca..1ae2fad1f1f 100644 --- a/tests/auto/wayland/shared/fractionalscalev1.h +++ b/tests/auto/wayland/shared/fractionalscalev1.h @@ -1,5 +1,5 @@ // Copyright (C) 2022 David Edmundson -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #ifndef MOCKCOMPOSITOR_FRACTIONALSCALE_H #define MOCKCOMPOSITOR_FRACTIONALSCALE_H diff --git a/tests/auto/wayland/shared/fullscreenshellv1.cpp b/tests/auto/wayland/shared/fullscreenshellv1.cpp index 105557fb5af..24468e14bf4 100644 --- a/tests/auto/wayland/shared/fullscreenshellv1.cpp +++ b/tests/auto/wayland/shared/fullscreenshellv1.cpp @@ -1,5 +1,5 @@ // Copyright (C) 2021 David Edmundson -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include "fullscreenshellv1.h" diff --git a/tests/auto/wayland/shared/fullscreenshellv1.h b/tests/auto/wayland/shared/fullscreenshellv1.h index fb0b3f8d6df..02ebf1e0cb8 100644 --- a/tests/auto/wayland/shared/fullscreenshellv1.h +++ b/tests/auto/wayland/shared/fullscreenshellv1.h @@ -1,5 +1,5 @@ // Copyright (C) 2021 David Edmundson -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #ifndef MOCKCOMPOSITOR_FULLSCREENSHELLV1_H #define MOCKCOMPOSITOR_FULLSCREENSHELLV1_H diff --git a/tests/auto/wayland/shared/mockcompositor.cpp b/tests/auto/wayland/shared/mockcompositor.cpp index d6eb560c91b..bbf406d64af 100644 --- a/tests/auto/wayland/shared/mockcompositor.cpp +++ b/tests/auto/wayland/shared/mockcompositor.cpp @@ -1,6 +1,6 @@ // Copyright (C) 2021 David Edmundson // Copyright (C) 2018 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include "mockcompositor.h" diff --git a/tests/auto/wayland/shared/mockcompositor.h b/tests/auto/wayland/shared/mockcompositor.h index 7cde399545a..9a2c06a17c9 100644 --- a/tests/auto/wayland/shared/mockcompositor.h +++ b/tests/auto/wayland/shared/mockcompositor.h @@ -1,6 +1,6 @@ // Copyright (C) 2021 David Edmundson // Copyright (C) 2018 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #ifndef MOCKCOMPOSITOR_H #define MOCKCOMPOSITOR_H diff --git a/tests/auto/wayland/shared/qttextinput.cpp b/tests/auto/wayland/shared/qttextinput.cpp index 30cc2afd475..1fb5ef1c4e0 100644 --- a/tests/auto/wayland/shared/qttextinput.cpp +++ b/tests/auto/wayland/shared/qttextinput.cpp @@ -1,5 +1,5 @@ // Copyright (C) 2021 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include "qttextinput.h" diff --git a/tests/auto/wayland/shared/qttextinput.h b/tests/auto/wayland/shared/qttextinput.h index a3eb31270fe..047cec7d395 100644 --- a/tests/auto/wayland/shared/qttextinput.h +++ b/tests/auto/wayland/shared/qttextinput.h @@ -1,5 +1,5 @@ // Copyright (C) 2021 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #ifndef MOCKCOMPOSITOR_QTTEXTINPUT_H #define MOCKCOMPOSITOR_QTTEXTINPUT_H diff --git a/tests/auto/wayland/shared/textinput.cpp b/tests/auto/wayland/shared/textinput.cpp index ee7e9ff9b29..fc4865d710f 100644 --- a/tests/auto/wayland/shared/textinput.cpp +++ b/tests/auto/wayland/shared/textinput.cpp @@ -1,5 +1,5 @@ // Copyright (C) 2019 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include "textinput.h" diff --git a/tests/auto/wayland/shared/textinput.h b/tests/auto/wayland/shared/textinput.h index 2aedf550b72..ca20ddbad63 100644 --- a/tests/auto/wayland/shared/textinput.h +++ b/tests/auto/wayland/shared/textinput.h @@ -1,5 +1,5 @@ // Copyright (C) 2019 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #ifndef MOCKCOMPOSITOR_TEXTINPUT_H #define MOCKCOMPOSITOR_TEXTINPUT_H diff --git a/tests/auto/wayland/shared/viewport.cpp b/tests/auto/wayland/shared/viewport.cpp index c1e763fec30..df6bbb336de 100644 --- a/tests/auto/wayland/shared/viewport.cpp +++ b/tests/auto/wayland/shared/viewport.cpp @@ -1,5 +1,5 @@ // Copyright (C) 2022 David Edmundson -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include "viewport.h" diff --git a/tests/auto/wayland/shared/viewport.h b/tests/auto/wayland/shared/viewport.h index 018e28e10e0..ddc4297db98 100644 --- a/tests/auto/wayland/shared/viewport.h +++ b/tests/auto/wayland/shared/viewport.h @@ -1,5 +1,5 @@ // Copyright (C) 2022 David Edmundson -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #ifndef MOCKCOMPOSITOR_VIEWPORT_H #define MOCKCOMPOSITOR_VIEWPORT_H diff --git a/tests/auto/wayland/shared/xdgdialog.cpp b/tests/auto/wayland/shared/xdgdialog.cpp index 065a0fd3c2e..b973415bd56 100644 --- a/tests/auto/wayland/shared/xdgdialog.cpp +++ b/tests/auto/wayland/shared/xdgdialog.cpp @@ -1,5 +1,5 @@ // Copyright (C) 2024 David Redondo -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include "xdgdialog.h" #include "xdgshell.h" diff --git a/tests/auto/wayland/shared/xdgdialog.h b/tests/auto/wayland/shared/xdgdialog.h index 6b4ccd0bcbe..d9e3de9960e 100644 --- a/tests/auto/wayland/shared/xdgdialog.h +++ b/tests/auto/wayland/shared/xdgdialog.h @@ -1,5 +1,5 @@ // Copyright (C) 2024 David Redondo -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #ifndef MOCKCOMPOSITOR_XDG_DIALOG_H #define MOCKCOMPOSITOR_XDG_DIALOG_H diff --git a/tests/auto/wayland/shared/xdgoutputv1.cpp b/tests/auto/wayland/shared/xdgoutputv1.cpp index f40a2b60b4b..af72ae2eb61 100644 --- a/tests/auto/wayland/shared/xdgoutputv1.cpp +++ b/tests/auto/wayland/shared/xdgoutputv1.cpp @@ -1,5 +1,5 @@ // Copyright (C) 2020 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include "xdgoutputv1.h" diff --git a/tests/auto/wayland/shared/xdgoutputv1.h b/tests/auto/wayland/shared/xdgoutputv1.h index 164171d408b..8c6276741b7 100644 --- a/tests/auto/wayland/shared/xdgoutputv1.h +++ b/tests/auto/wayland/shared/xdgoutputv1.h @@ -1,5 +1,5 @@ // Copyright (C) 2020 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #ifndef MOCKCOMPOSITOR_XDGOUTPUTV1_H #define MOCKCOMPOSITOR_XDGOUTPUTV1_H diff --git a/tests/auto/wayland/shared/xdgshell.cpp b/tests/auto/wayland/shared/xdgshell.cpp index 4e4de4d11f1..2c163985129 100644 --- a/tests/auto/wayland/shared/xdgshell.cpp +++ b/tests/auto/wayland/shared/xdgshell.cpp @@ -1,5 +1,5 @@ // Copyright (C) 2018 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include "xdgshell.h" diff --git a/tests/auto/wayland/shared/xdgshell.h b/tests/auto/wayland/shared/xdgshell.h index a68ace0ee62..3959e0668a8 100644 --- a/tests/auto/wayland/shared/xdgshell.h +++ b/tests/auto/wayland/shared/xdgshell.h @@ -1,5 +1,5 @@ // Copyright (C) 2018 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #ifndef MOCKCOMPOSITOR_XDGSHELL_H #define MOCKCOMPOSITOR_XDGSHELL_H diff --git a/tests/auto/wayland/surface/tst_surface.cpp b/tests/auto/wayland/surface/tst_surface.cpp index 75a83e23023..06e625155f2 100644 --- a/tests/auto/wayland/surface/tst_surface.cpp +++ b/tests/auto/wayland/surface/tst_surface.cpp @@ -1,5 +1,5 @@ // Copyright (C) 2018 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include "mockcompositor.h" #include diff --git a/tests/auto/wayland/tabletv2/tst_tabletv2.cpp b/tests/auto/wayland/tabletv2/tst_tabletv2.cpp index b4d0162890b..85df099f90c 100644 --- a/tests/auto/wayland/tabletv2/tst_tabletv2.cpp +++ b/tests/auto/wayland/tabletv2/tst_tabletv2.cpp @@ -1,5 +1,5 @@ // Copyright (C) 2019 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include "mockcompositor.h" diff --git a/tests/auto/wayland/wl_connect/tst_wlconnect.cpp b/tests/auto/wayland/wl_connect/tst_wlconnect.cpp index cd29eeb9968..d66d0ad6a4a 100644 --- a/tests/auto/wayland/wl_connect/tst_wlconnect.cpp +++ b/tests/auto/wayland/wl_connect/tst_wlconnect.cpp @@ -1,5 +1,5 @@ // Copyright (C) 2018 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include #include diff --git a/tests/auto/wayland/xdgdecorationv1/tst_xdgdecorationv1.cpp b/tests/auto/wayland/xdgdecorationv1/tst_xdgdecorationv1.cpp index 121680cdb97..54b15b3bf65 100644 --- a/tests/auto/wayland/xdgdecorationv1/tst_xdgdecorationv1.cpp +++ b/tests/auto/wayland/xdgdecorationv1/tst_xdgdecorationv1.cpp @@ -1,5 +1,5 @@ // Copyright (C) 2018 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include "mockcompositor.h" diff --git a/tests/auto/wayland/xdgoutput/tst_xdgoutput.cpp b/tests/auto/wayland/xdgoutput/tst_xdgoutput.cpp index 5e1ebd8842f..d021e388316 100644 --- a/tests/auto/wayland/xdgoutput/tst_xdgoutput.cpp +++ b/tests/auto/wayland/xdgoutput/tst_xdgoutput.cpp @@ -1,5 +1,5 @@ // Copyright (C) 2018 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include "xdgoutputv1.h" #include "mockcompositor.h" diff --git a/tests/auto/wayland/xdgshell/tst_xdgshell.cpp b/tests/auto/wayland/xdgshell/tst_xdgshell.cpp index f222165e917..1dc57e28050 100644 --- a/tests/auto/wayland/xdgshell/tst_xdgshell.cpp +++ b/tests/auto/wayland/xdgshell/tst_xdgshell.cpp @@ -1,6 +1,6 @@ // Copyright (C) 2018 The Qt Company Ltd. // Copyright (C) 2023 David Edmundson -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include "mockcompositor.h" #include From c8451104de9d5e92684aa2c545dcca1cc0c01ac4 Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Wed, 3 Apr 2024 23:44:33 +0300 Subject: [PATCH 1328/1507] Client: Use QWindowSystemInterface::handleCloseEvent() to close xdg-toplevel QWindow::close() will close a window regardless whether it's blocked by a modal dialog. On the other hand, QWindowSystemInterface::handleCloseEvent() will do nothing if a close event is sent to an xdg-toplevel window with a modal dialog. Pick-to: 6.7 Change-Id: I5f18d38d4fdbb5748687ee3537035172df916de9 Reviewed-by: Kai Uwe Broulik Reviewed-by: David Redondo --- .../plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp index d338f7475ba..f6428b585e9 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp @@ -169,7 +169,7 @@ void QWaylandXdgSurface::Toplevel::xdg_toplevel_configure(int32_t width, int32_t void QWaylandXdgSurface::Toplevel::xdg_toplevel_close() { - m_xdgSurface->m_window->window()->close(); + QWindowSystemInterface::handleCloseEvent(m_xdgSurface->m_window->window()); } void QWaylandXdgSurface::Toplevel::requestWindowFlags(Qt::WindowFlags flags) From a3f4b0671f0c434a5a84356f16da64530ee2ae59 Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Fri, 5 Apr 2024 12:59:10 +0300 Subject: [PATCH 1329/1507] Client: Close xdg popups using QWSI::handleCloseEvent() This shouldn't matter in practice, the main motivation behind this change is to make window closing code consistent both for xdg-toplevels and xdg-popups. Change-Id: I74ef11ddbaf942cb545bb04baf7b35979adde81c Reviewed-by: David Redondo --- .../plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp index f6428b585e9..eec89eff74a 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp @@ -288,7 +288,7 @@ void QWaylandXdgSurface::Popup::xdg_popup_configure(int32_t x, int32_t y, int32_ void QWaylandXdgSurface::Popup::xdg_popup_popup_done() { - m_xdgSurface->m_window->window()->close(); + QWindowSystemInterface::handleCloseEvent(m_xdgSurface->m_window->window()); } QWaylandXdgSurface::QWaylandXdgSurface(QWaylandXdgShell *shell, ::xdg_surface *surface, QWaylandWindow *window) From ddb35b21ee48ca72808d5bcd865edd4ba64d75e8 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Thu, 11 Apr 2024 09:41:48 +0200 Subject: [PATCH 1330/1507] Revert "QWaylandDisplay: Allow software-only deco and don't init GL needlessly" This reverts commit aff3a43bf067656d326bb17f31ee097684213c22. This optimization causes flakiness in the xdgdecorationv1 test, possibly because it no longer handles the case where the supportsWindowDecoration() function is called before the buffer integration is initialized. So it unfortunately has to be reverted until a better approach can be figured out. Fixes: QTBUG-124259 Change-Id: I05f13a51b22b6779bffba531f08ebfd17a9afb38 Reviewed-by: David Redondo --- src/plugins/platforms/wayland/qwaylanddisplay.cpp | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index 07fbe0b4105..265f0bb3f19 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -891,12 +891,7 @@ bool QWaylandDisplay::supportsWindowDecoration() const if (disabled) return false; - // Don't initialize client buffer integration just to check whether it can have a decoration. - if (!mWaylandIntegration->mClientBufferIntegrationInitialized) - return true; - - // We can do software-rendered decorations, only disable them if the integration explicitly says it can't. - static bool integrationSupport = !clientBufferIntegration() || clientBufferIntegration()->supportsWindowDecoration(); + static bool integrationSupport = clientBufferIntegration() && clientBufferIntegration()->supportsWindowDecoration(); return integrationSupport; } From 2962aa9ed9487bc6aa54810ed4ace114b4f7d723 Mon Sep 17 00:00:00 2001 From: David Redondo Date: Fri, 1 Mar 2024 10:36:58 +0100 Subject: [PATCH 1331/1507] client: Add CMake options to control visibility of generated symbols Using public-code by default is problematic if multiple libraries contain wayland interface definitions generated with public-code which exports the symbols of the interface definitions from the library. If not all libraries are build against the same protocol version and the symbol is resolved to a version generated from an older version of the protocol, then libwayland will detect a protocol error if a request or event from the newer version is used. This introduces two new options PRIVATE_CODE and PUBLIC_CODE to qt6_generate_wayland_protocol_client_sources which correspond to the wayland-scanner options. For backwards compatibility PUBLIC_CODE is the default. Change-Id: Ia30ec4b83419962b768207d7353c495e11b0268e Reviewed-by: Eskil Abrahamsen Blomfeldt --- ...nerate_wayland_protocol_client_sources.qdoc | 7 ++++++- .../Qt6WaylandClientMacros.cmake | 18 ++++++++++++++++-- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/src/plugins/platforms/wayland/doc/src/cmake/qt_generate_wayland_protocol_client_sources.qdoc b/src/plugins/platforms/wayland/doc/src/cmake/qt_generate_wayland_protocol_client_sources.qdoc index 97a7f7ed467..43f448fbd7d 100644 --- a/src/plugins/platforms/wayland/doc/src/cmake/qt_generate_wayland_protocol_client_sources.qdoc +++ b/src/plugins/platforms/wayland/doc/src/cmake/qt_generate_wayland_protocol_client_sources.qdoc @@ -23,6 +23,7 @@ find_package(Qt6 REQUIRED COMPONENTS WaylandClient) \badcode qt_generate_wayland_protocol_client_sources(target + [PUBLIC_CODE | PRIVATE_CODE] FILES file1.xml [file2.xml ...]) \endcode @@ -30,11 +31,15 @@ qt_generate_wayland_protocol_client_sources(target \section1 Description -qt_generate_wayland_protocol_client_sources() creates the build steps to run \c{waylandscanner} and +qt_generate_wayland_protocol_client_sources() creates the build steps to run \c{wayland-scanner} and \c{qtwaylandscanner} on one or more Wayland protocol files. The tools will in turn generate binding code in C and C++ for implementing the protocols, and the resulting files will be built as part of the \c target. +The options \c{PUBLIC_CODE} and \c{PRIVATE_CODE} correspond to the \c{public-code} and +\c{private-code} options of \c{wayland-scanner}. For backwards compatibility \c{PUBLIC_CODE} is the +default but generally \c{PRIVATE_CODE} is strongly recommended. + qt_generate_wayland_protocol_client_sources() will trigger generation of the files needed to implement the client side of the protocol. \l{qt_generate_wayland_protocol_server_sources}{qt_generate_wayland_protocol_server_sources()} is the equivalent function for the compositor. diff --git a/src/tools/qtwaylandscanner/Qt6WaylandClientMacros.cmake b/src/tools/qtwaylandscanner/Qt6WaylandClientMacros.cmake index 485322e6ae9..b4266c5581e 100644 --- a/src/tools/qtwaylandscanner/Qt6WaylandClientMacros.cmake +++ b/src/tools/qtwaylandscanner/Qt6WaylandClientMacros.cmake @@ -1,8 +1,14 @@ + # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: BSD-3-Clause function(qt6_generate_wayland_protocol_client_sources target) - cmake_parse_arguments(arg "NO_INCLUDE_CORE_ONLY" "__QT_INTERNAL_WAYLAND_INCLUDE_DIR" "FILES" ${ARGN}) + cmake_parse_arguments(arg + "NO_INCLUDE_CORE_ONLY;PRIVATE_CODE;PUBLIC_CODE" + "__QT_INTERNAL_WAYLAND_INCLUDE_DIR" + "FILES" + ${ARGN}) + if(DEFINED arg_UNPARSED_ARGUMENTS) message(FATAL_ERROR "Unknown arguments were passed to qt6_generate_wayland_protocol_client_sources: (${arg_UNPARSED_ARGUMENTS}).") endif() @@ -34,6 +40,14 @@ function(qt6_generate_wayland_protocol_client_sources target) if (NOT arg_NO_INCLUDE_CORE_ONLY) set(waylandscanner_extra_args "--include-core-only") endif() + + + if (arg_PRIVATE_CODE) + set(wayland_scanner_code_option "private-code") + else() + set(wayland_scanner_code_option "public-code") + endif() + add_custom_command( OUTPUT "${waylandscanner_header_output}" #TODO: Maybe put the files in ${CMAKE_CURRENT_BINARY_DIR/wayland_generated instead? @@ -43,7 +57,7 @@ function(qt6_generate_wayland_protocol_client_sources target) add_custom_command( OUTPUT "${waylandscanner_code_output}" - COMMAND Wayland::Scanner ${waylandscanner_extra_args} public-code < "${protocol_file}" > "${waylandscanner_code_output}" + COMMAND Wayland::Scanner ${waylandscanner_extra_args} ${wayland_scanner_code_option} < "${protocol_file}" > "${waylandscanner_code_output}" DEPENDS ${protocol_file} Wayland::Scanner ) From 01f102b2f9a92b3de8ac6bc77e8cc71b29cbcfa3 Mon Sep 17 00:00:00 2001 From: Kai Uwe Broulik Date: Fri, 8 Mar 2024 17:15:05 +0100 Subject: [PATCH 1332/1507] Client: Wire up surfaceRoleCreated/Destroyed signals Emit them after creating or destroying the shell surface. Change-Id: Ied54933ca0f0aec25cc288f7cfe191c85b37f543 Reviewed-by: Vlad Zahorodnii --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 34250d11342..7fc9f398b5c 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -184,6 +184,8 @@ void QWaylandWindow::initWindow() // the user may have already set some window properties, so make sure to send them out for (auto it = m_properties.cbegin(); it != m_properties.cend(); ++it) mShellSurface->sendProperty(it.key(), it.value()); + + emit surfaceRoleCreated(); } else { qWarning("Could not create a shell surface object."); } @@ -295,6 +297,7 @@ void QWaylandWindow::reset() mTransientParent->removeChildPopup(this); delete mShellSurface; mShellSurface = nullptr; + emit surfaceRoleDestroyed(); delete mSubSurfaceWindow; mSubSurfaceWindow = nullptr; mTransientParent = nullptr; From d3ea4de4239bada4da0591d78fe9e7bb735080f7 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Thu, 18 Apr 2024 09:05:00 +0200 Subject: [PATCH 1333/1507] Make build error less ambiguous The phrasing of the error message caused some confusion when people thought it indicated that QtGui itself was missing from the build. This tries to make it very explicit that it is the wayland-feature which is missing and not QtGui itself. Pick-to: 6.7 Task-number: QTBUG-123489 Change-Id: I8dcdf8bdbb05a379dea3021cec8bf8e7036d55dc Reviewed-by: David Redondo Reviewed-by: Samuli Piippo --- src/platformsupport/wayland/configure.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/platformsupport/wayland/configure.cmake b/src/platformsupport/wayland/configure.cmake index 45f94533348..00b337786f3 100644 --- a/src/platformsupport/wayland/configure.cmake +++ b/src/platformsupport/wayland/configure.cmake @@ -268,6 +268,6 @@ qt_configure_end_summary_section() # end of "Qt Wayland Decoration Plugins" sect qt_configure_add_report_entry( TYPE ERROR - MESSAGE "Qt Wayland Client requires QtGui to be build with support for wayland" + MESSAGE "Qt Gui has been built without 'wayland' feature. This feature is required for building Qt Wayland Client." CONDITION NOT QT_FEATURE_wayland AND QT_FEATURE_wayland_client ) From f53c249d06760264501dceaf9c7be76a97b30f76 Mon Sep 17 00:00:00 2001 From: Liang Qi Date: Mon, 22 Apr 2024 11:30:17 +0200 Subject: [PATCH 1334/1507] client: Synthesize enter/leave event for popup in xdg-shell - 2 This amends 179d0d34fa6b7d8d90ea766ac146c4b6485f3803. We can't depend on QGuiApplication::topLevelAt(). For security reason, Wayland doesn't provide global position for top level windows in most cases. We just synthesize enter/leave event for popup between it and the parent. Task-number: QTBUG-100148 Task-number: QTBUG-113404 Pick-to: 6.7 6.5 6.2 5.15 Change-Id: I9de1d413cdbc43486c1a110df4517750983e4fda Reviewed-by: David Edmundson --- .../shellintegration/xdg-shell/qwaylandxdgshell.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp index eec89eff74a..d65d4e7223f 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp @@ -252,7 +252,9 @@ QWaylandXdgSurface::Popup::~Popup() leave = m_xdgSurface->window()->window(); QWindowSystemInterface::handleLeaveEvent(leave); - if (QWindow *enter = QGuiApplication::topLevelAt(QCursor::pos())) { + QWindow *enter = nullptr; + if (m_parentXdgSurface && m_parentXdgSurface->window()) { + enter = m_parentXdgSurface->window()->window(); const auto pos = m_xdgSurface->window()->display()->waylandCursor()->pos(); QWindowSystemInterface::handleEnterEvent(enter, enter->handle()->mapFromGlobal(pos), pos); } @@ -595,11 +597,7 @@ void QWaylandXdgSurface::setGrabPopup(QWaylandWindow *parent, QWaylandInputDevic // Synthesize Qt enter/leave events for popup if (!parent) return; - QWindow *current = QGuiApplication::topLevelAt(QCursor::pos()); QWindow *leave = parent->window(); - if (current != leave) - return; - QWindowSystemInterface::handleLeaveEvent(leave); QWindow *enter = nullptr; From 682f7c4b78ce130d621d70b770062d76cd13fa2a Mon Sep 17 00:00:00 2001 From: Liang Qi Date: Fri, 12 Apr 2024 13:29:56 +0200 Subject: [PATCH 1335/1507] client: implement QWaylandScreen::topLevelAt() For security reason, Wayland doesn't provide global position for top level windows in most cases. Task-number: QTBUG-113404 Pick-to: 6.7 6.5 6.2 5.15 Change-Id: I2cd11b641fba6582cf96cfbea16f5e598a473db5 Reviewed-by: David Edmundson --- src/plugins/platforms/wayland/qwaylandscreen.cpp | 10 ++++++++++ src/plugins/platforms/wayland/qwaylandscreen_p.h | 2 ++ 2 files changed, 12 insertions(+) diff --git a/src/plugins/platforms/wayland/qwaylandscreen.cpp b/src/plugins/platforms/wayland/qwaylandscreen.cpp index 3faef3f255d..d51e8c6a0b6 100644 --- a/src/plugins/platforms/wayland/qwaylandscreen.cpp +++ b/src/plugins/platforms/wayland/qwaylandscreen.cpp @@ -170,6 +170,16 @@ QList QWaylandScreen::virtualSiblings() const return list; } +QWindow *QWaylandScreen::topLevelAt(const QPoint & pos) const +{ + if (QWaylandWindow::fixedToplevelPositions) { + Q_UNUSED(pos); + return nullptr; + } + + return QPlatformScreen::topLevelAt(pos); +} + Qt::ScreenOrientation QWaylandScreen::orientation() const { return m_orientation; diff --git a/src/plugins/platforms/wayland/qwaylandscreen_p.h b/src/plugins/platforms/wayland/qwaylandscreen_p.h index ff3d23217c7..ce3df3099ed 100644 --- a/src/plugins/platforms/wayland/qwaylandscreen_p.h +++ b/src/plugins/platforms/wayland/qwaylandscreen_p.h @@ -63,6 +63,8 @@ public: QDpi logicalDpi() const override; QList virtualSiblings() const override; + QWindow *topLevelAt(const QPoint &point) const override; + Qt::ScreenOrientation orientation() const override; int scale() const; qreal devicePixelRatio() const override; From 0fc235c5030ee6fb70dd145b1faad1567cf39788 Mon Sep 17 00:00:00 2001 From: Kai Uwe Broulik Date: Wed, 13 Mar 2024 17:39:41 +0100 Subject: [PATCH 1336/1507] QWaylandWindow: requestActivate on show For simplicitly, a Wayland compositor typically activates a window when it is mapped. However, it does not necessarily have to and might not want to in order to prevent stealing focus. Inttroduce a requestActivateOnShow() on the shell which is called when showing a window and, in case of XDG Shell, will explicitly request activation (unless Qt::WA_ShowWithoutActivating is set) and make use of the existing XDG Activation infrastructure. Change-Id: I69ab5f2cee4540d5baefa5a266f22dbb165e4192 Reviewed-by: David Edmundson --- .../shellintegration/xdg-shell/qwaylandxdgshell.cpp | 12 ++++++++++++ .../shellintegration/xdg-shell/qwaylandxdgshell_p.h | 1 + .../platforms/wayland/qwaylandshellsurface_p.h | 1 + src/plugins/platforms/wayland/qwaylandwindow.cpp | 3 +++ 4 files changed, 17 insertions(+) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp index d65d4e7223f..c7b95e0d05e 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp @@ -662,6 +662,18 @@ bool QWaylandXdgSurface::requestActivate() return false; } +bool QWaylandXdgSurface::requestActivateOnShow() +{ + const Qt::WindowType type = m_window->window()->type(); + if (type == Qt::ToolTip || type == Qt::Popup || type == Qt::SplashScreen) + return false; + + if (m_window->window()->property("_q_showWithoutActivating").toBool()) + return false; + + return requestActivate(); +} + void QWaylandXdgSurface::requestXdgActivationToken(quint32 serial) { if (auto *activation = m_shell->activation()) { diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h index 22a207a25f7..fa33259f744 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h @@ -64,6 +64,7 @@ public: void propagateSizeHints() override; void setWindowGeometry(const QRect &rect) override; bool requestActivate() override; + bool requestActivateOnShow() override; void setXdgActivationToken(const QString &token) override; void requestXdgActivationToken(quint32 serial) override; void setAlertState(bool enabled) override; diff --git a/src/plugins/platforms/wayland/qwaylandshellsurface_p.h b/src/plugins/platforms/wayland/qwaylandshellsurface_p.h index 6499a2bb009..8632efd04de 100644 --- a/src/plugins/platforms/wayland/qwaylandshellsurface_p.h +++ b/src/plugins/platforms/wayland/qwaylandshellsurface_p.h @@ -70,6 +70,7 @@ public: virtual void setWindowPosition(const QPoint &position) { Q_UNUSED(position); } virtual bool requestActivate() { return false; } + virtual bool requestActivateOnShow() { return false; } virtual void setXdgActivationToken(const QString &token); virtual void requestXdgActivationToken(quint32 serial); diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 7fc9f398b5c..081110f8334 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -576,6 +576,9 @@ void QWaylandWindow::setVisible(bool visible) // Don't flush the events here, or else the newly visible window may start drawing, but since // there was no frame before it will be stuck at the waitForFrameSync() in // QWaylandShmBackingStore::beginPaint(). + + if (mShellSurface) + mShellSurface->requestActivateOnShow(); } else { sendExposeEvent(QRect()); reset(); From 54af4f6e8832a9a605df38348df50b435e7adf53 Mon Sep 17 00:00:00 2001 From: Samuli Piippo Date: Wed, 24 Apr 2024 13:28:03 +0000 Subject: [PATCH 1337/1507] qtwaylandscanner: don't track source file location Generate source code without information about original location of the source file. Useful for reproducible builds. Task-number: QTBUG-105926 Task-number: QTBUG-105913 Change-Id: I5f9b3f90e6e85c772a92425e7b796a9d63c3c713 Reviewed-by: Ari Parkkila Reviewed-by: David Edmundson --- src/tools/qtwaylandscanner/qtwaylandscanner.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp index 6bdcb8da5ce..861c655bdf3 100644 --- a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp +++ b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp @@ -438,7 +438,7 @@ bool Scanner::process() return false; printf("// This file was generated by qtwaylandscanner\n"); - printf("// source file is %s\n\n", qPrintable(m_protocolFilePath)); + printf("// source file is %s\n\n", qPrintable(QFileInfo(file).fileName())); for (auto b : std::as_const(m_includes)) printf("#include %s\n", b.constData()); From f6fb0407de740b8b70c047a5cd9d3a556333fb04 Mon Sep 17 00:00:00 2001 From: Inho Lee Date: Tue, 30 Apr 2024 12:05:35 +0200 Subject: [PATCH 1338/1507] Make wheel operations compatible with xcb On xcb, Alt modifier makes wheel operations horizontal. Fixes: QTBUG-124807 Pick-to: 6.7 6.5 Change-Id: I98cfe14b4df91169a5ff4e777ebe954087747e17 Reviewed-by: Vlad Zahorodnii Reviewed-by: Thiago Macieira --- src/plugins/platforms/wayland/qwaylandinputdevice.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index 1df7ac4833b..ce04971ba6f 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -892,8 +892,10 @@ public: WheelEvent(QWaylandWindow *surface, Qt::ScrollPhase phase, ulong timestamp, const QPointF &local, const QPointF &global, const QPoint &pixelDelta, const QPoint &angleDelta, Qt::MouseEventSource source, Qt::KeyboardModifiers modifiers, bool inverted) - : QWaylandPointerEvent(QEvent::Wheel, phase, surface, timestamp, - local, global, pixelDelta, angleDelta, source, modifiers, inverted) + : QWaylandPointerEvent(QEvent::Wheel, phase, surface, timestamp, local, global, + modifiers & Qt::AltModifier ? pixelDelta.transposed() : pixelDelta, + modifiers & Qt::AltModifier ? angleDelta.transposed() : angleDelta, + source, modifiers, inverted) { } }; From 4313de83d6e0705e12e99a1b26b2b3c369667050 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucie=20G=C3=A9rard?= Date: Thu, 4 Apr 2024 17:16:18 +0200 Subject: [PATCH 1339/1507] Change license for tools files MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit According to QUIP-18 [1], all tools files should be LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 [1]: https://contribute.qt-project.org/quips/18 Pick-to: 6.7 Task-number: QTBUG-121787 Change-Id: I9a08423046dd325dd267d2390faf8d2eb0c76315 Reviewed-by: Kai Köhne --- src/tools/qtwaylandscanner/qtwaylandscanner.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp index 861c655bdf3..7f2769fa951 100644 --- a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp +++ b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp @@ -1,5 +1,5 @@ // Copyright (C) 2016 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #include #include From 24cd08a667fbad6a824bdc8f80af0072ba560030 Mon Sep 17 00:00:00 2001 From: David Redondo Date: Thu, 7 Mar 2024 15:18:40 +0100 Subject: [PATCH 1340/1507] client: Disentangle platform services and windowmanagerintegration The current state was a bit messy with the platform services being the potentially no initialised qt window manager extension wayland object. Change-Id: Id1f911b75d34fcf70594ca7257b79bf431f0643f Reviewed-by: David Edmundson --- src/plugins/platforms/wayland/CMakeLists.txt | 1 + .../platforms/wayland/qwaylanddisplay.cpp | 8 +-- .../platforms/wayland/qwaylanddisplay_p.h | 3 +- .../platforms/wayland/qwaylandintegration.cpp | 7 +- .../platforms/wayland/qwaylandintegration_p.h | 2 + .../wayland/qwaylandplatformservices.cpp | 50 +++++++++++++ .../wayland/qwaylandplatformservices_p.h | 48 +++++++++++++ .../platforms/wayland/qwaylandwindow.cpp | 2 +- .../qwaylandwindowmanagerintegration.cpp | 71 +++---------------- .../qwaylandwindowmanagerintegration_p.h | 28 +++----- 10 files changed, 128 insertions(+), 92 deletions(-) create mode 100644 src/plugins/platforms/wayland/qwaylandplatformservices.cpp create mode 100644 src/plugins/platforms/wayland/qwaylandplatformservices_p.h diff --git a/src/plugins/platforms/wayland/CMakeLists.txt b/src/plugins/platforms/wayland/CMakeLists.txt index 4916af81e08..300fd4ffa82 100644 --- a/src/plugins/platforms/wayland/CMakeLists.txt +++ b/src/plugins/platforms/wayland/CMakeLists.txt @@ -42,6 +42,7 @@ qt_internal_add_module(WaylandClient qwaylandinputmethodcontext.cpp qwaylandinputmethodcontext_p.h qwaylandintegration.cpp qwaylandintegration_p.h qwaylandnativeinterface.cpp qwaylandnativeinterface_p.h + qwaylandplatformservices.cpp qwaylandplatformservices_p.h qwaylandpointergestures.cpp qwaylandpointergestures_p.h qwaylandqtkey.cpp qwaylandqtkey_p.h qwaylandscreen.cpp qwaylandscreen_p.h diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index 265f0bb3f19..9bd60e74129 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -312,7 +312,7 @@ QWaylandClientBufferIntegration * QWaylandDisplay::clientBufferIntegration() con QWaylandWindowManagerIntegration *QWaylandDisplay::windowManagerIntegration() const { - return mWindowManagerIntegration.data(); + return mGlobals.windowManagerIntegration.get(); } QWaylandDisplay::QWaylandDisplay(QWaylandIntegration *waylandIntegration) @@ -335,8 +335,6 @@ void QWaylandDisplay::setupConnection() struct ::wl_registry *registry = wl_display_get_registry(mDisplay); init(registry); - mWindowManagerIntegration.reset(new QWaylandWindowManagerIntegration(this)); - #if QT_CONFIG(xkbcommon) mXkbContext.reset(xkb_context_new(XKB_CONTEXT_NO_FLAGS)); if (!mXkbContext) @@ -373,7 +371,6 @@ QWaylandDisplay::~QWaylandDisplay(void) // Reset the globals manually since they need to be destroyed before the wl_display mGlobals = {}; - mWindowManagerIntegration.reset(); if (object()) wl_registry_destroy(object()); @@ -781,6 +778,9 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin mGlobals.xdgToplevelDragManager.reset( new WithDestructor(registry, id, 1)); + } else if (interface == QLatin1String(QtWayland::qt_windowmanager::interface()->name)) { + mGlobals.windowManagerIntegration.reset( + new QWaylandWindowManagerIntegration(this, id, version)); } mRegistryGlobals.append(RegistryGlobal(id, interface, version, registry)); diff --git a/src/plugins/platforms/wayland/qwaylanddisplay_p.h b/src/plugins/platforms/wayland/qwaylanddisplay_p.h index 5b564c8d796..2fd176d8405 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay_p.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay_p.h @@ -316,8 +316,6 @@ private: QScopedPointer mCursor; #endif - QScopedPointer mWindowManagerIntegration; - struct GlobalHolder { std::unique_ptr compositor; @@ -346,6 +344,7 @@ private: std::unique_ptr fractionalScaleManager; std::unique_ptr cursorShapeManager; std::unique_ptr xdgToplevelDragManager; + std::unique_ptr windowManagerIntegration; } mGlobals; int mFd = -1; int mWritableNotificationFd = -1; diff --git a/src/plugins/platforms/wayland/qwaylandintegration.cpp b/src/plugins/platforms/wayland/qwaylandintegration.cpp index eb19be45df8..c5eb1e96ae4 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandintegration.cpp @@ -15,6 +15,7 @@ #endif #include "qwaylanddnd_p.h" #include "qwaylandwindowmanagerintegration_p.h" +#include "qwaylandplatformservices_p.h" #include "qwaylandscreen_p.h" #include "qwaylandcursor_p.h" @@ -83,6 +84,7 @@ QWaylandIntegration::QWaylandIntegration() #endif { mDisplay.reset(new QWaylandDisplay(this)); + mPlatformServices.reset(new QWaylandPlatformServices(mDisplay.data())); QWaylandWindow::fixedToplevelPositions = !qEnvironmentVariableIsSet("QT_WAYLAND_DISABLE_FIXED_POSITIONS"); @@ -246,7 +248,7 @@ QPlatformAccessibility *QWaylandIntegration::accessibility() const QPlatformServices *QWaylandIntegration::services() const { - return mDisplay->windowManagerIntegration(); + return mPlatformServices.data(); } QWaylandDisplay *QWaylandIntegration::display() const @@ -525,8 +527,7 @@ void QWaylandIntegration::reset() void QWaylandIntegration::setApplicationBadge(qint64 number) { - auto unixServices = mDisplay->windowManagerIntegration(); - unixServices->setApplicationBadge(number); + mPlatformServices->setApplicationBadge(number); } } diff --git a/src/plugins/platforms/wayland/qwaylandintegration_p.h b/src/plugins/platforms/wayland/qwaylandintegration_p.h index 81d1ae6d2b7..f26cc3d2916 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration_p.h +++ b/src/plugins/platforms/wayland/qwaylandintegration_p.h @@ -34,6 +34,7 @@ class QWaylandInputDeviceIntegration; class QWaylandInputDevice; class QWaylandScreen; class QWaylandCursor; +class QWaylandPlatformServices; class Q_WAYLANDCLIENT_EXPORT QWaylandIntegration : public QPlatformIntegration { @@ -136,6 +137,7 @@ private: #if QT_CONFIG(accessibility) mutable QScopedPointer mAccessibility; #endif + QScopedPointer mPlatformServices; QMutex mClientBufferInitLock; bool mClientBufferIntegrationInitialized = false; bool mServerBufferIntegrationInitialized = false; diff --git a/src/plugins/platforms/wayland/qwaylandplatformservices.cpp b/src/plugins/platforms/wayland/qwaylandplatformservices.cpp new file mode 100644 index 00000000000..14556d2825f --- /dev/null +++ b/src/plugins/platforms/wayland/qwaylandplatformservices.cpp @@ -0,0 +1,50 @@ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#include "qwaylandplatformservices_p.h" +#include "qwaylandwindow_p.h" +#include "qwaylanddisplay_p.h" +#include "qwaylandshellsurface_p.h" +#include "qwaylandwindowmanagerintegration_p.h" + +QT_BEGIN_NAMESPACE + +namespace QtWaylandClient { + +QWaylandPlatformServices::QWaylandPlatformServices(QWaylandDisplay *display) + : m_display(display) { } + +bool QWaylandPlatformServices::openUrl(const QUrl &url) +{ + if (auto windowManagerIntegration = m_display->windowManagerIntegration()) { + windowManagerIntegration->openUrl(url); + return true; + } + return QGenericUnixServices::openUrl(url); +} + +bool QWaylandPlatformServices::openDocument(const QUrl &url) +{ + if (auto windowManagerIntegration = m_display->windowManagerIntegration()) { + windowManagerIntegration->openUrl(url); + return true; + } + return QGenericUnixServices::openDocument(url); +} + +QString QWaylandPlatformServices::portalWindowIdentifier(QWindow *window) +{ + if (window && window->handle()) { + auto shellSurface = static_cast(window->handle())->shellSurface(); + if (shellSurface) { + const QString handle = shellSurface->externWindowHandle(); + return QLatin1String("wayland:") + handle; + } + } + return QString(); +} +} // namespace QtWaylandClient + +QT_END_NAMESPACE + +#include "moc_qwaylandplatformservices_p.cpp" diff --git a/src/plugins/platforms/wayland/qwaylandplatformservices_p.h b/src/plugins/platforms/wayland/qwaylandplatformservices_p.h new file mode 100644 index 00000000000..6106a901888 --- /dev/null +++ b/src/plugins/platforms/wayland/qwaylandplatformservices_p.h @@ -0,0 +1,48 @@ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QWAYLANDPLATFORMSERVICES_H +#define QWAYLANDPLATFORMSERVICES_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include + +#include + +#include +#include + +QT_BEGIN_NAMESPACE + +namespace QtWaylandClient { + +class QWaylandDisplay; + +class Q_WAYLANDCLIENT_EXPORT QWaylandPlatformServices : public QGenericUnixServices +{ +public: + explicit QWaylandPlatformServices(QWaylandDisplay *waylandDisplay); + + bool openUrl(const QUrl &url) override; + bool openDocument(const QUrl &url) override; + QString portalWindowIdentifier(QWindow *window) override; + +private: + QWaylandDisplay *m_display; +}; + +QT_END_NAMESPACE + +} // namespace QtWaylandClient + +#endif // QWAYLANDPLATFORMSERVICES_H diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 081110f8334..73fb331ebb1 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -12,7 +12,7 @@ #include "qwaylandshellsurface_p.h" #include "qwaylandsubsurface_p.h" #include "qwaylandabstractdecoration_p.h" -#include "qwaylandwindowmanagerintegration_p.h" +#include "qwaylandplatformservices_p.h" #include "qwaylandnativeinterface_p.h" #include "qwaylanddecorationfactory_p.h" #include "qwaylandshmbackingstore_p.h" diff --git a/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration.cpp b/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration.cpp index 149190420c2..c7a5c0d1471 100644 --- a/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration.cpp @@ -22,49 +22,26 @@ QT_BEGIN_NAMESPACE namespace QtWaylandClient { -class QWaylandWindowManagerIntegrationPrivate { -public: - QWaylandWindowManagerIntegrationPrivate(QWaylandDisplay *waylandDisplay); - bool m_blockPropertyUpdates = false; - QWaylandDisplay *m_waylandDisplay = nullptr; - QHash m_queuedProperties; - bool m_showIsFullScreen = false; -}; - -QWaylandWindowManagerIntegrationPrivate::QWaylandWindowManagerIntegrationPrivate(QWaylandDisplay *waylandDisplay) - : m_waylandDisplay(waylandDisplay) +QWaylandWindowManagerIntegration::QWaylandWindowManagerIntegration(QWaylandDisplay *waylandDisplay, + uint id, uint version) + : QtWayland::qt_windowmanager(waylandDisplay->object(), id, version), + m_waylandDisplay(waylandDisplay) { } -QWaylandWindowManagerIntegration::QWaylandWindowManagerIntegration(QWaylandDisplay *waylandDisplay) - : d_ptr(new QWaylandWindowManagerIntegrationPrivate(waylandDisplay)) -{ - waylandDisplay->addRegistryListener(&wlHandleListenerGlobal, this); -} - QWaylandWindowManagerIntegration::~QWaylandWindowManagerIntegration() { - if (object()) - qt_windowmanager_destroy(object()); + qt_windowmanager_destroy(object()); } bool QWaylandWindowManagerIntegration::showIsFullScreen() const { - Q_D(const QWaylandWindowManagerIntegration); - return d->m_showIsFullScreen; -} - -void QWaylandWindowManagerIntegration::wlHandleListenerGlobal(void *data, wl_registry *registry, uint32_t id, const QString &interface, uint32_t version) -{ - Q_UNUSED(version); - if (interface == QStringLiteral("qt_windowmanager")) - static_cast(data)->init(registry, id, 1); + return m_showIsFullScreen; } void QWaylandWindowManagerIntegration::windowmanager_hints(int32_t showIsFullScreen) { - Q_D(QWaylandWindowManagerIntegration); - d->m_showIsFullScreen = showIsFullScreen; + m_showIsFullScreen = showIsFullScreen; } void QWaylandWindowManagerIntegration::windowmanager_quit() @@ -72,11 +49,9 @@ void QWaylandWindowManagerIntegration::windowmanager_quit() QGuiApplication::quit(); } -void QWaylandWindowManagerIntegration::openUrl_helper(const QUrl &url) +void QWaylandWindowManagerIntegration::openUrl(const QUrl &url) { - Q_ASSERT(isInitialized()); QString data = url.toString(); - static const int chunkSize = 128; while (!data.isEmpty()) { QString chunk = data.left(chunkSize); @@ -88,36 +63,6 @@ void QWaylandWindowManagerIntegration::openUrl_helper(const QUrl &url) open_url(!data.isEmpty(), chunk); } } - -bool QWaylandWindowManagerIntegration::openUrl(const QUrl &url) -{ - if (isInitialized()) { - openUrl_helper(url); - return true; - } - return QGenericUnixServices::openUrl(url); -} - -bool QWaylandWindowManagerIntegration::openDocument(const QUrl &url) -{ - if (isInitialized()) { - openUrl_helper(url); - return true; - } - return QGenericUnixServices::openDocument(url); -} - -QString QWaylandWindowManagerIntegration::portalWindowIdentifier(QWindow *window) -{ - if (window && window->handle()) { - auto shellSurface = static_cast(window->handle())->shellSurface(); - if (shellSurface) { - const QString handle = shellSurface->externWindowHandle(); - return QLatin1String("wayland:") + handle; - } - } - return QString(); -} } QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration_p.h b/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration_p.h index 18eb171b63c..76d9b0da045 100644 --- a/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration_p.h @@ -16,9 +16,6 @@ // #include -#include - -#include #include #include @@ -27,35 +24,28 @@ QT_BEGIN_NAMESPACE namespace QtWaylandClient { -class QWaylandWindow; class QWaylandDisplay; class QWaylandWindowManagerIntegrationPrivate; -class Q_WAYLANDCLIENT_EXPORT QWaylandWindowManagerIntegration : public QObject, public QGenericUnixServices, public QtWayland::qt_windowmanager +class Q_WAYLANDCLIENT_EXPORT QWaylandWindowManagerIntegration : public QtWayland::qt_windowmanager { - Q_OBJECT - Q_DECLARE_PRIVATE(QWaylandWindowManagerIntegration) -public: - explicit QWaylandWindowManagerIntegration(QWaylandDisplay *waylandDisplay); - ~QWaylandWindowManagerIntegration() override; - bool openUrl(const QUrl &url) override; - bool openDocument(const QUrl &url) override; - QString portalWindowIdentifier(QWindow *window) override; +public: + explicit QWaylandWindowManagerIntegration(QWaylandDisplay *waylandDisplay, uint id, + uint version); + ~QWaylandWindowManagerIntegration(); + + void openUrl(const QUrl &url); bool showIsFullScreen() const; private: - static void wlHandleListenerGlobal(void *data, wl_registry *registry, uint32_t id, - const QString &interface, uint32_t version); - - QScopedPointer d_ptr; - void windowmanager_hints(int32_t showIsFullScreen) override; void windowmanager_quit() override; - void openUrl_helper(const QUrl &url); + QWaylandDisplay *m_waylandDisplay = nullptr; + bool m_showIsFullScreen = false; }; QT_END_NAMESPACE From 38ac95c03b423a063d095aaa4e3254a43f97c49b Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Tue, 7 May 2024 13:09:08 +0100 Subject: [PATCH 1341/1507] tests: Don't use auto and manual configure together The tests always send an explicit manual configure. This is important because we want to test the client's first buffer is correct and this comes after the first configure event. Having auto configure enabled means it's racey and flakey between the auto response on the compositor thread and the client dispatching a manual repsonse. Change-Id: I92170a2d96c01d01c22983e43ff1f1281b1a48a2 Reviewed-by: David Redondo --- tests/auto/wayland/xdgdecorationv1/tst_xdgdecorationv1.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/wayland/xdgdecorationv1/tst_xdgdecorationv1.cpp b/tests/auto/wayland/xdgdecorationv1/tst_xdgdecorationv1.cpp index 54b15b3bf65..5ee85694406 100644 --- a/tests/auto/wayland/xdgdecorationv1/tst_xdgdecorationv1.cpp +++ b/tests/auto/wayland/xdgdecorationv1/tst_xdgdecorationv1.cpp @@ -111,7 +111,7 @@ public: explicit XdgDecorationCompositor() { exec([this] { - m_config.autoConfigure = true; + m_config.autoConfigure = false; add(xdgDecorationVersion); }); } From b28eed534f5b0ceb9371afb3a21d1f1f88590109 Mon Sep 17 00:00:00 2001 From: Moss Heim Date: Mon, 13 May 2024 10:41:20 +0200 Subject: [PATCH 1342/1507] Remove unused private field This causes a build failure under clang 17. Change-Id: I9e256109ec6e7de146334012bce90912d0d4bb62 Reviewed-by: David Edmundson Reviewed-by: David Redondo --- .../platforms/wayland/qwaylandwindowmanagerintegration.cpp | 3 +-- .../platforms/wayland/qwaylandwindowmanagerintegration_p.h | 1 - 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration.cpp b/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration.cpp index c7a5c0d1471..9668491d2f3 100644 --- a/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration.cpp @@ -24,8 +24,7 @@ namespace QtWaylandClient { QWaylandWindowManagerIntegration::QWaylandWindowManagerIntegration(QWaylandDisplay *waylandDisplay, uint id, uint version) - : QtWayland::qt_windowmanager(waylandDisplay->object(), id, version), - m_waylandDisplay(waylandDisplay) + : QtWayland::qt_windowmanager(waylandDisplay->object(), id, version) { } diff --git a/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration_p.h b/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration_p.h index 76d9b0da045..be06d68ee57 100644 --- a/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindowmanagerintegration_p.h @@ -44,7 +44,6 @@ private: void windowmanager_hints(int32_t showIsFullScreen) override; void windowmanager_quit() override; - QWaylandDisplay *m_waylandDisplay = nullptr; bool m_showIsFullScreen = false; }; From 7cf59cf45592c7b0363c4e9574a64cef7bb51350 Mon Sep 17 00:00:00 2001 From: Kai Uwe Broulik Date: Tue, 14 May 2024 11:11:19 +0000 Subject: [PATCH 1343/1507] Revert "Revert "QWaylandDisplay: Allow software-only deco and don't init GL needlessly"" This reverts commit ddb35b21ee48ca72808d5bcd865edd4ba64d75e8. Reason for revert: Cause for test failure has likely been addressed by 38ac95c03b423a063d095aaa4e3254a43f97c49b Fixes: QTBUG-124284 Fixes: QTBUG-124285 Change-Id: Iedeb1d2800951e549fe4a4846aaaa477cfa497ae Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/plugins/platforms/wayland/qwaylanddisplay.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index 9bd60e74129..e6ed0772fa4 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -891,7 +891,12 @@ bool QWaylandDisplay::supportsWindowDecoration() const if (disabled) return false; - static bool integrationSupport = clientBufferIntegration() && clientBufferIntegration()->supportsWindowDecoration(); + // Don't initialize client buffer integration just to check whether it can have a decoration. + if (!mWaylandIntegration->mClientBufferIntegrationInitialized) + return true; + + // We can do software-rendered decorations, only disable them if the integration explicitly says it can't. + static bool integrationSupport = !clientBufferIntegration() || clientBufferIntegration()->supportsWindowDecoration(); return integrationSupport; } From 4611355d69b2a1a6ebf9943ce9805314beb14104 Mon Sep 17 00:00:00 2001 From: David Redondo Date: Wed, 15 May 2024 13:06:25 +0200 Subject: [PATCH 1344/1507] client: Explain what PUBLIC_CODE does Change-Id: If7d0954561cecddefada49d7f00359a711bb9e29 Reviewed-by: Alexandru Croitor --- .../src/cmake/qt_generate_wayland_protocol_client_sources.qdoc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/doc/src/cmake/qt_generate_wayland_protocol_client_sources.qdoc b/src/plugins/platforms/wayland/doc/src/cmake/qt_generate_wayland_protocol_client_sources.qdoc index 43f448fbd7d..0abd14d4e0f 100644 --- a/src/plugins/platforms/wayland/doc/src/cmake/qt_generate_wayland_protocol_client_sources.qdoc +++ b/src/plugins/platforms/wayland/doc/src/cmake/qt_generate_wayland_protocol_client_sources.qdoc @@ -37,7 +37,8 @@ code in C and C++ for implementing the protocols, and the resulting files will b of the \c target. The options \c{PUBLIC_CODE} and \c{PRIVATE_CODE} correspond to the \c{public-code} and -\c{private-code} options of \c{wayland-scanner}. For backwards compatibility \c{PUBLIC_CODE} is the +\c{private-code} options of \c{wayland-scanner}. \c{PUBLIC_CODE} will cause the symbols in the +code that is generated by \c{wayland-scanner} to be exported. For backwards compatibility \c{PUBLIC_CODE} is the default but generally \c{PRIVATE_CODE} is strongly recommended. qt_generate_wayland_protocol_client_sources() will trigger generation of the files needed to From 76f8559ca67001fcf05295f1c68d45d5bd2bfa30 Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Mon, 20 May 2024 16:12:09 +0300 Subject: [PATCH 1345/1507] Client: Try harder to guess the transient parent window xdg_popup requires a parent surface. On the other hand, Qt is quite permissive, it allows showing a popup window without specifying the transient parent window. Things have been slowly changing and more controls specify the transient parent, but there are still apps that don't do it. For that particular reason, QWaylandWindow has some heuristics to guess the transient parent. Currently, that heuristic works as follows: - If QWindow::transientParent() is set, use that - otherwise use the focus window However, this heuristic doesn't consider that a window can be inactive. For example, user hovers an element in the window while the window has no focus. This change proposes a heuristic that considers the last interacted input device, i.e. - if QWindow::transientParent() is specified, prefer that - if there's a "top" popup, use it - otherwise check the last interacted window With the proposed heuristic, tooltips are less likely to be backed by xdg-toplevel in inactive apps. Pick-to: 6.7 Change-Id: I7e6a607dc38f9e8adce316d3540a9bd9c37cfed4 Reviewed-by: David Edmundson --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 73fb331ebb1..237676921ec 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -1185,8 +1185,13 @@ QWaylandWindow *QWaylandWindow::guessTransientParent() const if (auto transientParent = closestShellSurfaceWindow(window()->transientParent())) return transientParent; - if (QGuiApplication::focusWindow() && (window()->type() == Qt::ToolTip || window()->type() == Qt::Popup)) - return closestShellSurfaceWindow(QGuiApplication::focusWindow()); + if (window()->type() == Qt::Popup) { + if (mTopPopup) + return mTopPopup; + } + + if (window()->type() == Qt::ToolTip || window()->type() == Qt::Popup) + return display()->lastInputWindow(); return nullptr; } From 2c9580bf63cba0d4f470b594536692e2fbb01b1b Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Wed, 22 May 2024 12:13:49 +0300 Subject: [PATCH 1346/1507] Client: Fix initialization of QWaylandWindow::mScale QWaylandWindow initializes mScale to the scale factor of the currently assigned screen when it's constructed. However, it doesn't keep track of subsequent screen changes that may occur afterwards before QWindow::setVisible(true). For example window.setScreen(foo); window.create(); window.setScreen(bar); window.show(); In that case, the value of mScale will correspond to the scale factor of output "foo" when show() is called. A better place to initialize mScale is when the show() function is called. Furthermore, since there's wl_surface.preferred_buffer_scale and fractional_scale_v1.preferred_scale events, QWaylandWindow could stop guessing the scale factor and rely on the compositor telling us that information. However, it's important that the compositor sends the preferred buffer scale before the first configure event arrives. Fixes: QTBUG-124839 Pick-to: 6.7 Change-Id: I842aaa352d9cb1e53158f64f2ec0cd3734f7ecf3 Reviewed-by: Liang Qi Reviewed-by: David Edmundson --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 9 ++++----- src/plugins/platforms/wayland/qwaylandwindow_p.h | 2 +- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 237676921ec..878332ca327 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -60,8 +60,6 @@ QWaylandWindow::QWaylandWindow(QWindow *window, QWaylandDisplay *display) mFrameCallbackTimeout = frameCallbackTimeout; } - mScale = waylandScreen() ? waylandScreen()->scale() : 1; // fallback to 1 if we don't have a real screen - static WId id = 1; mWindowId = id++; initializeWlSurface(); @@ -327,6 +325,7 @@ void QWaylandWindow::reset() mWaitingToApplyConfigure = false; mCanResize = true; mResizeDirty = false; + mScale = std::nullopt; mOpaqueArea = QRegion(); mMask = QRegion(); @@ -1481,7 +1480,7 @@ void QWaylandWindow::updateScale() void QWaylandWindow::setScale(qreal newScale) { - if (qFuzzyCompare(mScale, newScale)) + if (mScale.has_value() && qFuzzyCompare(mScale.value(), newScale)) return; mScale = newScale; @@ -1490,7 +1489,7 @@ void QWaylandWindow::setScale(qreal newScale) if (mViewport) updateViewport(); else if (mSurface->version() >= 3) - mSurface->set_buffer_scale(std::ceil(mScale)); + mSurface->set_buffer_scale(std::ceil(newScale)); } ensureSize(); @@ -1552,7 +1551,7 @@ qreal QWaylandWindow::scale() const qreal QWaylandWindow::devicePixelRatio() const { - return qreal(mScale); + return mScale.value_or(waylandScreen() ? waylandScreen()->scale() : 1); } bool QWaylandWindow::setMouseGrabEnabled(bool grab) diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index b78c8ce4ed6..63b140f0b0f 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -310,7 +310,7 @@ protected: bool mSentInitialResize = false; QPoint mOffset; - qreal mScale = 1; + std::optional mScale = 1; QPlatformScreen *mLastReportedScreen = nullptr; QString mWindowTitle; From 2f7a86fac338dc78259d93b675f1cd131c24c926 Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Thu, 9 May 2024 11:03:57 +0100 Subject: [PATCH 1347/1507] client: Always update the window's screen on changes QWindow::screen can be set by an application programmatically or be updated from the platform. Currently when the QPA handles a screen change we compare against mLastReportedScreen to determine if we need to update anything. This results have a situation where sometimes we use the new value from the platform, sometimes not, depending on which screens happened to be used. To be consistent, always check against the window's current screen. Change-Id: I7ea15aa497a81d0cf46efe274f83f4667304623e Reviewed-by: Vlad Zahorodnii --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 5 ++--- src/plugins/platforms/wayland/qwaylandwindow_p.h | 1 - 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 878332ca327..78244df3d92 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -1437,14 +1437,13 @@ void QWaylandWindow::handleScreensChanged() { QPlatformScreen *newScreen = calculateScreenFromSurfaceEvents(); - if (newScreen == mLastReportedScreen) + if (newScreen->screen() == window()->screen()) return; if (!newScreen->isPlaceholder() && !newScreen->QPlatformScreen::screen()) mDisplay->forceRoundTrip(); QWindowSystemInterface::handleWindowScreenChanged(window(), newScreen->QPlatformScreen::screen()); - mLastReportedScreen = newScreen; if (fixedToplevelPositions && !QPlatformWindow::parent() && window()->type() != Qt::Popup && window()->type() != Qt::ToolTip && geometry().topLeft() != newScreen->geometry().topLeft()) { @@ -1474,7 +1473,7 @@ void QWaylandWindow::updateScale() return; } - int scale = mLastReportedScreen->isPlaceholder() ? 1 : static_cast(mLastReportedScreen)->scale(); + int scale = screen()->isPlaceholder() ? 1 : static_cast(screen())->scale(); setScale(scale); } diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index 63b140f0b0f..3cd5db93544 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -311,7 +311,6 @@ protected: bool mSentInitialResize = false; QPoint mOffset; std::optional mScale = 1; - QPlatformScreen *mLastReportedScreen = nullptr; QString mWindowTitle; QIcon mWindowIcon; From 8457dd76e3a173ab6020df5aac4e4719a8e06048 Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Fri, 9 Feb 2024 13:03:18 +0000 Subject: [PATCH 1348/1507] client: Avoid roundtrip to handle xdgoutput race condition The original bug was that we could get a surface enter event before the xdg output was fully ready, where we had a QPlatformScreen but no QScreen announced. A solution with a roundtrip was added, which works, but roundtrips cause other problems processing messages out of order and inhibts a move to synchronous delivery. As an alternative fix we move the problem from QWaylandWindow to QWaylandSurface and have that filter out not-ready QScreens. The best output is then re-evaluated whenever a screen is added. Change-Id: Iabc78917112aa8c58cad8e128c5bb3030f8c8f65 Reviewed-by: David Redondo --- src/plugins/platforms/wayland/qwaylandsurface.cpp | 10 +++++++++- src/plugins/platforms/wayland/qwaylandwindow.cpp | 3 --- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandsurface.cpp b/src/plugins/platforms/wayland/qwaylandsurface.cpp index 949d7b1609e..274fdda82e5 100644 --- a/src/plugins/platforms/wayland/qwaylandsurface.cpp +++ b/src/plugins/platforms/wayland/qwaylandsurface.cpp @@ -15,6 +15,7 @@ QWaylandSurface::QWaylandSurface(QWaylandDisplay *display) : wl_surface(display->createSurface(this)) { connect(qApp, &QGuiApplication::screenRemoved, this, &QWaylandSurface::handleScreenRemoved); + connect(qApp, &QGuiApplication::screenAdded, this, &QWaylandSurface::screensChanged); } QWaylandSurface::~QWaylandSurface() @@ -24,7 +25,14 @@ QWaylandSurface::~QWaylandSurface() QWaylandScreen *QWaylandSurface::oldestEnteredScreen() { - return m_screens.value(0, nullptr); + for (auto *screen : std::as_const(m_screens)) { + // only report valid screens + // we can have some ouptuts waiting for xdg output information + // that are valid QPlatformScreens, but not valid QScreens + if (screen->screen()) + return screen; + } + return nullptr; } QWaylandSurface *QWaylandSurface::fromWlSurface(::wl_surface *surface) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 78244df3d92..4f765f292c5 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -557,7 +557,6 @@ QPlatformScreen *QWaylandWindow::calculateScreenFromSurfaceEvents() const if (auto *screen = mSurface->oldestEnteredScreen()) return screen; } - return QPlatformWindow::screen(); } @@ -1440,8 +1439,6 @@ void QWaylandWindow::handleScreensChanged() if (newScreen->screen() == window()->screen()) return; - if (!newScreen->isPlaceholder() && !newScreen->QPlatformScreen::screen()) - mDisplay->forceRoundTrip(); QWindowSystemInterface::handleWindowScreenChanged(window(), newScreen->QPlatformScreen::screen()); if (fixedToplevelPositions && !QPlatformWindow::parent() && window()->type() != Qt::Popup From 4580eac41c895d93e2f0cf7d21952fa146628faa Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Mon, 20 May 2024 16:23:26 +0400 Subject: [PATCH 1349/1507] Client: Update size hints on custom margins change As size hints get sent in window content geometry, they have to be updated once window content geometry changes Pick-to: 6.7 6.5 Change-Id: I7c17770d29be8381b0c43ab724202219a9cf7a5f Reviewed-by: David Edmundson --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 4f765f292c5..6b40cd28c40 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -889,6 +889,7 @@ QMargins QWaylandWindow::clientSideMargins() const void QWaylandWindow::setCustomMargins(const QMargins &margins) { const QMargins oldMargins = mCustomMargins; mCustomMargins = margins; + propagateSizeHints(); setGeometry(geometry().marginsRemoved(oldMargins).marginsAdded(margins)); } From 668c086eff3ad6330ffa0133364d0845efdd5947 Mon Sep 17 00:00:00 2001 From: Inho Lee Date: Mon, 22 Jan 2024 13:28:05 +0100 Subject: [PATCH 1350/1507] TextInputv3: fix indices and positions Indices and positions in wayland are byte size But some when qtwayland uses QString the size conversion was incorrect. Task-number: QTBUG-121446 Pick-to: 6.7 Change-Id: I4e25fb437557a2d6556050599d582ffacabcedbc Reviewed-by: Eskil Abrahamsen Blomfeldt --- .../platforms/wayland/qwaylandtextinputv3.cpp | 97 +++++++++++-------- .../platforms/wayland/qwaylandtextinputv3_p.h | 7 +- .../qwaylandinputmethodeventbuilder.cpp | 4 +- 3 files changed, 63 insertions(+), 45 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandtextinputv3.cpp b/src/plugins/platforms/wayland/qwaylandtextinputv3.cpp index 017456ac249..bb449c9d60d 100644 --- a/src/plugins/platforms/wayland/qwaylandtextinputv3.cpp +++ b/src/plugins/platforms/wayland/qwaylandtextinputv3.cpp @@ -80,8 +80,8 @@ void QWaylandTextInputv3::zwp_text_input_v3_preedit_string(const QString &text, return; m_pendingPreeditString.text = text; - m_pendingPreeditString.cursorBegin = cursorBegin; - m_pendingPreeditString.cursorEnd = cursorEnd; + m_pendingPreeditString.cursorBegin = QWaylandInputMethodEventBuilder::indexFromWayland(text, cursorBegin); + m_pendingPreeditString.cursorEnd = QWaylandInputMethodEventBuilder::indexFromWayland(text, cursorEnd); } void QWaylandTextInputv3::zwp_text_input_v3_commit_string(const QString &text) @@ -101,8 +101,8 @@ void QWaylandTextInputv3::zwp_text_input_v3_delete_surrounding_text(uint32_t bef if (!QGuiApplication::focusObject()) return; - m_pendingDeleteBeforeText = QWaylandInputMethodEventBuilder::indexFromWayland(m_surroundingText, beforeText); - m_pendingDeleteAfterText = QWaylandInputMethodEventBuilder::indexFromWayland(m_surroundingText, afterText); + m_pendingDeleteBeforeText = beforeText; + m_pendingDeleteAfterText = afterText; } void QWaylandTextInputv3::zwp_text_input_v3_done(uint32_t serial) @@ -157,14 +157,26 @@ void QWaylandTextInputv3::zwp_text_input_v3_done(uint32_t serial) qCDebug(qLcQpaWaylandTextInput) << Q_FUNC_INFO << "DELETE" << m_pendingDeleteBeforeText << m_pendingDeleteAfterText; qCDebug(qLcQpaWaylandTextInput) << Q_FUNC_INFO << "COMMIT" << m_pendingCommitString; - // A workaround for reselection - // It will disable redundant commit after reselection - if (m_pendingDeleteBeforeText != 0 || m_pendingDeleteAfterText != 0) + int replaceFrom = 0; + int replaceLength = 0; + if (m_pendingDeleteBeforeText != 0 || m_pendingDeleteAfterText != 0) { + // A workaround for reselection + // It will disable redundant commit after reselection m_condReselection = true; + const QByteArray &utf8 = QStringView{m_surroundingText}.toUtf8(); + if (m_cursorPos < int(m_pendingDeleteBeforeText)) { + replaceFrom = -QString::fromUtf8(QByteArrayView{utf8}.first(m_pendingDeleteBeforeText)).size(); + replaceLength = QString::fromUtf8(QByteArrayView{utf8}.first(m_pendingDeleteBeforeText + m_pendingDeleteAfterText)).size(); + } else { + replaceFrom = -QString::fromUtf8(QByteArrayView{utf8}.sliced(m_cursorPos - m_pendingDeleteBeforeText, m_pendingDeleteBeforeText)).size(); + replaceLength = QString::fromUtf8(QByteArrayView{utf8}.sliced(m_cursorPos - m_pendingDeleteBeforeText, m_pendingDeleteBeforeText + m_pendingDeleteAfterText)).size(); + } + } + qCDebug(qLcQpaWaylandTextInput) << Q_FUNC_INFO << "DELETE from " << replaceFrom << " length " << replaceLength; event.setCommitString(m_pendingCommitString, - -m_pendingDeleteBeforeText, - m_pendingDeleteBeforeText + m_pendingDeleteAfterText); + replaceFrom, + replaceLength); m_currentPreeditString = m_pendingPreeditString; m_pendingPreeditString.clear(); m_pendingCommitString.clear(); @@ -235,54 +247,63 @@ void QWaylandTextInputv3::updateState(Qt::InputMethodQueries queries, uint32_t f int cursor = event.value(Qt::ImCursorPosition).toInt(); int anchor = event.value(Qt::ImAnchorPosition).toInt(); - qCDebug(qLcQpaWaylandTextInput) << "Orginal surrounding_text from InputMethodQuery: " << text << cursor << anchor; + qCDebug(qLcQpaWaylandTextInput) << "Original surrounding_text from InputMethodQuery: " << text << cursor << anchor; // Make sure text is not too big // surround_text cannot exceed 4000byte in wayland protocol // The worst case will be supposed here. const int MAX_MESSAGE_SIZE = 4000; - if (text.toUtf8().size() > MAX_MESSAGE_SIZE) { - const int selectionStart = QWaylandInputMethodEventBuilder::indexToWayland(text, qMin(cursor, anchor)); - const int selectionEnd = QWaylandInputMethodEventBuilder::indexToWayland(text, qMax(cursor, anchor)); + const int textSize = text.toUtf8().size(); + if (textSize > MAX_MESSAGE_SIZE) { + qCDebug(qLcQpaWaylandTextInput) << "SurroundText size is over " + << MAX_MESSAGE_SIZE + << " byte, some text will be clipped."; + const int selectionStart = qMin(cursor, anchor); + const int selectionEnd = qMax(cursor, anchor); const int selectionLength = selectionEnd - selectionStart; + const int selectionSize = QStringView{text}.sliced(selectionStart, selectionLength).toUtf8().size(); // If selection is bigger than 4000 byte, it is fixed to 4000 byte. // anchor will be moved in the 4000 byte boundary. - if (selectionLength > MAX_MESSAGE_SIZE) { + if (selectionSize > MAX_MESSAGE_SIZE) { if (anchor > cursor) { - const int length = MAX_MESSAGE_SIZE; - anchor = QWaylandInputMethodEventBuilder::trimmedIndexFromWayland(text, length, cursor); - anchor -= cursor; - text = text.mid(cursor, anchor); cursor = 0; + anchor = MAX_MESSAGE_SIZE; + text = text.sliced(selectionStart, selectionLength); } else { - const int length = -MAX_MESSAGE_SIZE; - anchor = QWaylandInputMethodEventBuilder::trimmedIndexFromWayland(text, length, cursor); - cursor -= anchor; - text = text.mid(anchor, cursor); anchor = 0; + cursor = MAX_MESSAGE_SIZE; + text = text.sliced(selectionEnd - selectionLength, selectionLength); } } else { - const int offset = (MAX_MESSAGE_SIZE - selectionLength) / 2; - - int textStart = QWaylandInputMethodEventBuilder::trimmedIndexFromWayland(text, -offset, qMin(cursor, anchor)); - int textEnd = QWaylandInputMethodEventBuilder::trimmedIndexFromWayland(text, MAX_MESSAGE_SIZE, textStart); - - anchor -= textStart; - cursor -= textStart; - text = text.mid(textStart, textEnd - textStart); + // This is not optimal in some cases. + // For examples, if the cursor position and + // the selectionEnd are close to the end of the surround text, + // the tail of the text might always be clipped. + // However all the cases of over 4000 byte are just exceptions. + int selEndSize = QStringView{text}.first(selectionEnd).toUtf8().size(); + cursor = QWaylandInputMethodEventBuilder::indexToWayland(text, cursor); + anchor = QWaylandInputMethodEventBuilder::indexToWayland(text, anchor); + if (selEndSize < MAX_MESSAGE_SIZE) { + text = QString::fromUtf8(QByteArrayView{text.toUtf8()}.first(MAX_MESSAGE_SIZE)); + } else { + const int startOffset = selEndSize - MAX_MESSAGE_SIZE; + text = QString::fromUtf8(QByteArrayView{text.toUtf8()}.sliced(startOffset, MAX_MESSAGE_SIZE)); + cursor -= startOffset; + anchor -= startOffset; + } } + } else { + cursor = QWaylandInputMethodEventBuilder::indexToWayland(text, cursor); + anchor = QWaylandInputMethodEventBuilder::indexToWayland(text, anchor); } qCDebug(qLcQpaWaylandTextInput) << "Modified surrounding_text: " << text << cursor << anchor; - const int cursorPos = QWaylandInputMethodEventBuilder::indexToWayland(text, cursor); - const int anchorPos = QWaylandInputMethodEventBuilder::indexToWayland(text, anchor); - - if (m_surroundingText != text || m_cursorPos != cursorPos || m_anchorPos != anchorPos) { + if (m_surroundingText != text || m_cursorPos != cursor || m_anchorPos != anchor) { qCDebug(qLcQpaWaylandTextInput) << "Current surrounding_text: " << m_surroundingText << m_cursorPos << m_anchorPos; - qCDebug(qLcQpaWaylandTextInput) << "New surrounding_text: " << text << cursorPos << anchorPos; + qCDebug(qLcQpaWaylandTextInput) << "New surrounding_text: " << text << cursor << anchor; - set_surrounding_text(text, cursorPos, anchorPos); + set_surrounding_text(text, cursor, anchor); // A workaround in the case of reselection // It will work when re-clicking a preedit text @@ -294,8 +315,8 @@ void QWaylandTextInputv3::updateState(Qt::InputMethodQueries queries, uint32_t f } m_surroundingText = text; - m_cursorPos = cursorPos; - m_anchorPos = anchorPos; + m_cursorPos = cursor; + m_anchorPos = anchor; m_cursor = cursor; } } diff --git a/src/plugins/platforms/wayland/qwaylandtextinputv3_p.h b/src/plugins/platforms/wayland/qwaylandtextinputv3_p.h index e8b7aa02745..8e32e514dd8 100644 --- a/src/plugins/platforms/wayland/qwaylandtextinputv3_p.h +++ b/src/plugins/platforms/wayland/qwaylandtextinputv3_p.h @@ -17,7 +17,6 @@ #include "qwaylandtextinputinterface_p.h" #include -#include #include struct wl_callback; @@ -63,8 +62,6 @@ protected: void zwp_text_input_v3_done(uint32_t serial) override; private: - QWaylandInputMethodEventBuilder m_builder; - ::wl_surface *m_surface = nullptr; // ### Here for debugging purposes struct PreeditInfo { @@ -82,8 +79,8 @@ private: PreeditInfo m_pendingPreeditString; PreeditInfo m_currentPreeditString; QString m_pendingCommitString; - uint m_pendingDeleteBeforeText = 0; - uint m_pendingDeleteAfterText = 0; + uint m_pendingDeleteBeforeText = 0; // byte length + uint m_pendingDeleteAfterText = 0; // byte length QString m_surroundingText; int m_cursor; // cursor position in QString diff --git a/src/plugins/platforms/wayland/shared/qwaylandinputmethodeventbuilder.cpp b/src/plugins/platforms/wayland/shared/qwaylandinputmethodeventbuilder.cpp index 0f07a69580e..fc422ef04aa 100644 --- a/src/plugins/platforms/wayland/shared/qwaylandinputmethodeventbuilder.cpp +++ b/src/plugins/platforms/wayland/shared/qwaylandinputmethodeventbuilder.cpp @@ -278,10 +278,10 @@ int QWaylandInputMethodEventBuilder::indexFromWayland(const QString &text, int l if (length < 0) { const QByteArray &utf8 = QStringView{text}.left(base).toUtf8(); - return QString::fromUtf8(utf8.left(qMax(utf8.size() + length, 0))).size(); + return QString::fromUtf8(utf8.first(qMax(utf8.size() + length, 0))).size(); } else { const QByteArray &utf8 = QStringView{text}.mid(base).toUtf8(); - return QString::fromUtf8(utf8.left(length)).size() + base; + return QString::fromUtf8(utf8.first(qMin(length, utf8.size()))).size() + base; } } From afa29091660aa296926c6033774821ff0eb4a301 Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Wed, 31 May 2023 16:12:01 +0100 Subject: [PATCH 1351/1507] client: Support popup repositioning Xdg popups can be repositioned at runtime. An important example is tooltips where the same instance gets re-used between multiple invocations. shellSurface->setWindowPosition is guarded to not run from configure events to avoid a feedback loop. Window exposure is changed in xdgshell to mark the window as exposed when applying the configure, not when it is received. This is needed to ensure geometry is up-to-date. This patch is orthogonal to providing proper semantic positioning. Change-Id: I673957832d34129e9b9fc8fba732ffb2083a4d0b Reviewed-by: Liang Qi Reviewed-by: David Redondo --- .../xdg-shell/qwaylandxdgshell.cpp | 254 +++++++++++------- .../xdg-shell/qwaylandxdgshell_p.h | 13 +- .../platforms/wayland/qwaylandwindow.cpp | 2 +- 3 files changed, 163 insertions(+), 106 deletions(-) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp index c7b95e0d05e..6e5e47da9e7 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp @@ -228,7 +228,7 @@ QtWayland::xdg_toplevel::resize_edge QWaylandXdgSurface::Toplevel::convertToResi } QWaylandXdgSurface::Popup::Popup(QWaylandXdgSurface *xdgSurface, QWaylandWindow *parent, - QtWayland::xdg_positioner *positioner) + Positioner *positioner) : m_xdgSurface(xdgSurface) , m_parentXdgSurface(qobject_cast(parent->shellSurface())) , m_parent(parent) @@ -293,6 +293,12 @@ void QWaylandXdgSurface::Popup::xdg_popup_popup_done() QWindowSystemInterface::handleCloseEvent(m_xdgSurface->m_window->window()); } +void QWaylandXdgSurface::Popup::xdg_popup_repositioned(uint32_t token) +{ + if (token == m_waitingForRepositionSerial) + m_waitingForReposition = false; +} + QWaylandXdgSurface::QWaylandXdgSurface(QWaylandXdgShell *shell, ::xdg_surface *surface, QWaylandWindow *window) : QWaylandShellSurface(window) , xdg_surface(surface) @@ -380,7 +386,13 @@ bool QWaylandXdgSurface::isExposed() const if (m_toplevel && m_toplevel->m_applied.suspended) return false; - return m_configured || m_pendingConfigureSerial; + // the popup repositioning specification is async + // we need to defer commits between our resize request + // and our new popup position being set + if (m_popup && m_popup->m_waitingForReposition) + return false; + + return m_configured; } bool QWaylandXdgSurface::handleExpose(const QRegion ®ion) @@ -388,11 +400,14 @@ bool QWaylandXdgSurface::handleExpose(const QRegion ®ion) if (!isExposed() && !region.isEmpty()) { return true; } + setWindowGeometry(window()->windowContentGeometry()); return false; } void QWaylandXdgSurface::applyConfigure() { + bool wasExposed = isExposed(); + // It is a redundant ack_configure, so skipped. if (m_pendingConfigureSerial == m_appliedConfigureSerial) return; @@ -405,6 +420,9 @@ void QWaylandXdgSurface::applyConfigure() m_configured = true; ack_configure(m_appliedConfigureSerial); + + if (!wasExposed && isExposed()) + m_window->sendRecursiveExposeEvent(); } bool QWaylandXdgSurface::wantsDecorations() const @@ -487,106 +505,8 @@ void QWaylandXdgSurface::setPopup(QWaylandWindow *parent) { Q_ASSERT(!m_toplevel && !m_popup); - auto positioner = new QtWayland::xdg_positioner(m_shell->m_xdgWmBase->create_positioner()); - // set_popup expects a position relative to the parent - QRect windowGeometry = m_window->windowContentGeometry(); - QMargins windowMargins = m_window->windowContentMargins() - m_window->clientSideMargins(); - QMargins parentMargins = parent->windowContentMargins() - parent->clientSideMargins(); - - // These property overrides may be removed when public API becomes available - QRect placementAnchor = m_window->window()->property("_q_waylandPopupAnchorRect").toRect(); - if (!placementAnchor.isValid()) { - placementAnchor = QRect(m_window->geometry().topLeft() - parent->geometry().topLeft(), QSize(1,1)); - } - placementAnchor.translate(windowMargins.left(), windowMargins.top()); - placementAnchor.translate(-parentMargins.left(), -parentMargins.top()); - - uint32_t anchor = QtWayland::xdg_positioner::anchor_top_right; - const QVariant anchorVariant = m_window->window()->property("_q_waylandPopupAnchor"); - if (anchorVariant.isValid()) { - switch (anchorVariant.value()) { - case Qt::Edges(): - anchor = QtWayland::xdg_positioner::anchor_none; - break; - case Qt::TopEdge: - anchor = QtWayland::xdg_positioner::anchor_top; - break; - case Qt::TopEdge | Qt::RightEdge: - anchor = QtWayland::xdg_positioner::anchor_top_right; - break; - case Qt::RightEdge: - anchor = QtWayland::xdg_positioner::anchor_right; - break; - case Qt::BottomEdge | Qt::RightEdge: - anchor = QtWayland::xdg_positioner::anchor_bottom_right; - break; - case Qt::BottomEdge: - anchor = QtWayland::xdg_positioner::anchor_bottom; - break; - case Qt::BottomEdge | Qt::LeftEdge: - anchor = QtWayland::xdg_positioner::anchor_bottom_left; - break; - case Qt::LeftEdge: - anchor = QtWayland::xdg_positioner::anchor_left; - break; - case Qt::TopEdge | Qt::LeftEdge: - anchor = QtWayland::xdg_positioner::anchor_top_left; - break; - } - } - - uint32_t gravity = QtWayland::xdg_positioner::gravity_bottom_right; - const QVariant popupGravityVariant = m_window->window()->property("_q_waylandPopupGravity"); - if (popupGravityVariant.isValid()) { - switch (popupGravityVariant.value()) { - case Qt::Edges(): - gravity = QtWayland::xdg_positioner::gravity_none; - break; - case Qt::TopEdge: - gravity = QtWayland::xdg_positioner::gravity_top; - break; - case Qt::TopEdge | Qt::RightEdge: - gravity = QtWayland::xdg_positioner::gravity_top_right; - break; - case Qt::RightEdge: - gravity = QtWayland::xdg_positioner::gravity_right; - break; - case Qt::BottomEdge | Qt::RightEdge: - gravity = QtWayland::xdg_positioner::gravity_bottom_right; - break; - case Qt::BottomEdge: - gravity = QtWayland::xdg_positioner::gravity_bottom; - break; - case Qt::BottomEdge | Qt::LeftEdge: - gravity = QtWayland::xdg_positioner::gravity_bottom_left; - break; - case Qt::LeftEdge: - gravity = QtWayland::xdg_positioner::gravity_left; - break; - case Qt::TopEdge | Qt::LeftEdge: - gravity = QtWayland::xdg_positioner::gravity_top_left; - break; - } - } - - uint32_t constraintAdjustment = QtWayland::xdg_positioner::constraint_adjustment_slide_x | QtWayland::xdg_positioner::constraint_adjustment_slide_y; - const QVariant constraintAdjustmentVariant = m_window->window()->property("_q_waylandPopupConstraintAdjustment"); - if (constraintAdjustmentVariant.isValid()) { - constraintAdjustment = constraintAdjustmentVariant.toUInt(); - } - - positioner->set_anchor_rect(placementAnchor.x(), - placementAnchor.y(), - placementAnchor.width(), - placementAnchor.height()); - positioner->set_anchor(anchor); - positioner->set_gravity(gravity); - positioner->set_size(windowGeometry.width(), windowGeometry.height()); - positioner->set_constraint_adjustment(constraintAdjustment); - m_popup = new Popup(this, parent, positioner); - positioner->destroy(); - - delete positioner; + std::unique_ptr positioner = createPositioner(parent); + m_popup = new Popup(this, parent, positioner.get()); } void QWaylandXdgSurface::setGrabPopup(QWaylandWindow *parent, QWaylandInputDevice *device, int serial) @@ -616,8 +536,6 @@ void QWaylandXdgSurface::xdg_surface_configure(uint32_t serial) if (!m_configured) { // We have to do the initial applyConfigure() immediately, since that is the expose. applyConfigure(); - if (isExposed()) - m_window->sendRecursiveExposeEvent(); } else { // Later configures are probably resizes, so we have to queue them up for a time when we // are not painting to the window. @@ -743,6 +661,124 @@ QString QWaylandXdgSurface::externWindowHandle() return m_toplevel->m_exported->handle(); } +void QWaylandXdgSurface::setWindowPosition(const QPoint &position) +{ + Q_UNUSED(position); + + if (!m_popup) + return; + + if (m_popup->version() < XDG_POPUP_REPOSITIONED_SINCE_VERSION) + return; + + std::unique_ptr positioner = createPositioner(m_window->transientParent()); + m_popup->m_waitingForRepositionSerial++; + m_popup->reposition(positioner->object(), m_popup->m_waitingForRepositionSerial); + m_popup->m_waitingForReposition = true; +} + +std::unique_ptr QWaylandXdgSurface::createPositioner(QWaylandWindow *parent) +{ + std::unique_ptr positioner(new Positioner(m_shell)); + // set_popup expects a position relative to the parent + QRect windowGeometry = m_window->windowContentGeometry(); + QMargins windowMargins = m_window->windowContentMargins() - m_window->clientSideMargins(); + QMargins parentMargins = parent->windowContentMargins() - parent->clientSideMargins(); + + // These property overrides may be removed when public API becomes available + QRect placementAnchor = m_window->window()->property("_q_waylandPopupAnchorRect").toRect(); + if (!placementAnchor.isValid()) { + placementAnchor = QRect(m_window->geometry().topLeft() - parent->geometry().topLeft(), QSize(1,1)); + } + placementAnchor.translate(windowMargins.left(), windowMargins.top()); + placementAnchor.translate(-parentMargins.left(), -parentMargins.top()); + + uint32_t anchor = QtWayland::xdg_positioner::anchor_top_left; + const QVariant anchorVariant = m_window->window()->property("_q_waylandPopupAnchor"); + if (anchorVariant.isValid()) { + switch (anchorVariant.value()) { + case Qt::Edges(): + anchor = QtWayland::xdg_positioner::anchor_none; + break; + case Qt::TopEdge: + anchor = QtWayland::xdg_positioner::anchor_top; + break; + case Qt::TopEdge | Qt::RightEdge: + anchor = QtWayland::xdg_positioner::anchor_top_right; + break; + case Qt::RightEdge: + anchor = QtWayland::xdg_positioner::anchor_right; + break; + case Qt::BottomEdge | Qt::RightEdge: + anchor = QtWayland::xdg_positioner::anchor_bottom_right; + break; + case Qt::BottomEdge: + anchor = QtWayland::xdg_positioner::anchor_bottom; + break; + case Qt::BottomEdge | Qt::LeftEdge: + anchor = QtWayland::xdg_positioner::anchor_bottom_left; + break; + case Qt::LeftEdge: + anchor = QtWayland::xdg_positioner::anchor_left; + break; + case Qt::TopEdge | Qt::LeftEdge: + anchor = QtWayland::xdg_positioner::anchor_top_left; + break; + } + } + + uint32_t gravity = QtWayland::xdg_positioner::gravity_bottom_right; + const QVariant popupGravityVariant = m_window->window()->property("_q_waylandPopupGravity"); + if (popupGravityVariant.isValid()) { + switch (popupGravityVariant.value()) { + case Qt::Edges(): + gravity = QtWayland::xdg_positioner::gravity_none; + break; + case Qt::TopEdge: + gravity = QtWayland::xdg_positioner::gravity_top; + break; + case Qt::TopEdge | Qt::RightEdge: + gravity = QtWayland::xdg_positioner::gravity_top_right; + break; + case Qt::RightEdge: + gravity = QtWayland::xdg_positioner::gravity_right; + break; + case Qt::BottomEdge | Qt::RightEdge: + gravity = QtWayland::xdg_positioner::gravity_bottom_right; + break; + case Qt::BottomEdge: + gravity = QtWayland::xdg_positioner::gravity_bottom; + break; + case Qt::BottomEdge | Qt::LeftEdge: + gravity = QtWayland::xdg_positioner::gravity_bottom_left; + break; + case Qt::LeftEdge: + gravity = QtWayland::xdg_positioner::gravity_left; + break; + case Qt::TopEdge | Qt::LeftEdge: + gravity = QtWayland::xdg_positioner::gravity_top_left; + break; + } + } + + uint32_t constraintAdjustment = QtWayland::xdg_positioner::constraint_adjustment_slide_x | QtWayland::xdg_positioner::constraint_adjustment_slide_y; + const QVariant constraintAdjustmentVariant = m_window->window()->property("_q_waylandPopupConstraintAdjustment"); + if (constraintAdjustmentVariant.isValid()) { + constraintAdjustment = constraintAdjustmentVariant.toUInt(); + } + + positioner->set_anchor_rect(placementAnchor.x(), + placementAnchor.y(), + placementAnchor.width(), + placementAnchor.height()); + positioner->set_anchor(anchor); + positioner->set_gravity(gravity); + positioner->set_size(windowGeometry.width(), windowGeometry.height()); + positioner->set_constraint_adjustment(constraintAdjustment); + return positioner; +} + + QWaylandXdgShell::QWaylandXdgShell(QWaylandDisplay *display, QtWayland::xdg_wm_base *xdgWmBase) : m_display(display), m_xdgWmBase(xdgWmBase) { @@ -774,6 +810,16 @@ void QWaylandXdgShell::handleRegistryGlobal(void *data, wl_registry *registry, u } } +QWaylandXdgSurface::Positioner::Positioner(QWaylandXdgShell *xdgShell) + : QtWayland::xdg_positioner(xdgShell->m_xdgWmBase->create_positioner()) +{ +} + +QWaylandXdgSurface::Positioner::~Positioner() +{ + destroy(); +} + } QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h index fa33259f744..d18ce4d7278 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h @@ -70,6 +70,7 @@ public: void setAlertState(bool enabled) override; bool isAlertState() const override { return m_alertState; } QString externWindowHandle() override; + void setWindowPosition(const QPoint &position) override; void setSizeHints(); @@ -115,9 +116,15 @@ private: QScopedPointer m_xdgDialog; }; + class Positioner : public QtWayland::xdg_positioner { + public: + Positioner(QWaylandXdgShell *xdgShell); + ~Positioner() override; + }; + class Popup : public QtWayland::xdg_popup { public: - Popup(QWaylandXdgSurface *xdgSurface, QWaylandWindow *parent, QtWayland::xdg_positioner *positioner); + Popup(QWaylandXdgSurface *xdgSurface, QWaylandWindow *parent, Positioner *positioner); ~Popup() override; void applyConfigure(); @@ -126,6 +133,7 @@ private: void grab(QWaylandInputDevice *seat, uint serial); void xdg_popup_configure(int32_t x, int32_t y, int32_t width, int32_t height) override; void xdg_popup_popup_done() override; + void xdg_popup_repositioned(uint32_t token) override; QWaylandXdgSurface *m_xdgSurface = nullptr; QWaylandXdgSurface *m_parentXdgSurface = nullptr; @@ -133,11 +141,14 @@ private: bool m_grabbing = false; QRect m_pendingGeometry; + bool m_waitingForReposition = false; + uint32_t m_waitingForRepositionSerial = 0; }; void setToplevel(); void setPopup(QWaylandWindow *parent); void setGrabPopup(QWaylandWindow *parent, QWaylandInputDevice *device, int serial); + std::unique_ptr createPositioner(QWaylandWindow *parent); QWaylandXdgShell *m_shell = nullptr; QWaylandWindow *m_window = nullptr; diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 6b40cd28c40..e311b2eb430 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -462,7 +462,7 @@ void QWaylandWindow::setGeometry(const QRect &r) if (mShellSurface) { mShellSurface->setWindowGeometry(windowContentGeometry()); - if (!qt_window_private(window())->positionAutomatic) + if (!qt_window_private(window())->positionAutomatic && !mInResizeFromApplyConfigure) mShellSurface->setWindowPosition(windowGeometry().topLeft()); } From 9f3228ca4c38bf625d28629382d8ad27ccd07204 Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Tue, 28 May 2024 19:49:39 +0300 Subject: [PATCH 1352/1507] Client: Fix QWaylandWindow::mScale default initializer Amends 2c9580bf63cba0d4f470b594536692e2fbb01b1b. Fixes: QTBUG-125872 Pick-to: 6.7 Change-Id: Iea58cf4dbd879cb1b443edf8b75f4f6bce4bc1a6 Reviewed-by: David Edmundson --- src/plugins/platforms/wayland/qwaylandwindow_p.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index 3cd5db93544..c1b736c1e95 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -310,7 +310,7 @@ protected: bool mSentInitialResize = false; QPoint mOffset; - std::optional mScale = 1; + std::optional mScale = std::nullopt; QString mWindowTitle; QIcon mWindowIcon; From c4b1a27943149316b1fa76880eec5eb319889c4e Mon Sep 17 00:00:00 2001 From: David Redondo Date: Fri, 24 May 2024 10:10:23 +0200 Subject: [PATCH 1353/1507] client: Add option to automatically delete a buffer upon release This is useful when using with protocols that use buffers that are basically one-shot and managing and reusing multiple buffers is not needed. Change-Id: Id4f6c01b7e873540fd87ab663ceb9069f2de0ca1 Reviewed-by: David Edmundson --- src/plugins/platforms/wayland/qwaylandbuffer.cpp | 7 +++++++ src/plugins/platforms/wayland/qwaylandbuffer_p.h | 3 +++ 2 files changed, 10 insertions(+) diff --git a/src/plugins/platforms/wayland/qwaylandbuffer.cpp b/src/plugins/platforms/wayland/qwaylandbuffer.cpp index 1907d586487..dd99b702bcf 100644 --- a/src/plugins/platforms/wayland/qwaylandbuffer.cpp +++ b/src/plugins/platforms/wayland/qwaylandbuffer.cpp @@ -31,6 +31,13 @@ void QWaylandBuffer::release(void *data, wl_buffer *) QWaylandBuffer *self = static_cast(data); self->mBusy = false; self->mCommitted = false; + if (self->mDeleteOnRelease) + delete self; +} + +void QWaylandBuffer::setDeleteOnRelease(bool deleteOnRelease) +{ + mDeleteOnRelease = deleteOnRelease; } const wl_buffer_listener QWaylandBuffer::listener = { diff --git a/src/plugins/platforms/wayland/qwaylandbuffer_p.h b/src/plugins/platforms/wayland/qwaylandbuffer_p.h index 3798ef3ebbf..c96f213b9e8 100644 --- a/src/plugins/platforms/wayland/qwaylandbuffer_p.h +++ b/src/plugins/platforms/wayland/qwaylandbuffer_p.h @@ -43,12 +43,15 @@ public: void setCommitted() { mCommitted = true; } bool committed() const { return mCommitted; } + void setDeleteOnRelease(bool deleteOnRelease); + protected: struct wl_buffer *mBuffer = nullptr; private: bool mBusy = false; bool mCommitted = false; + bool mDeleteOnRelease = false; static void release(void *data, wl_buffer *); static const wl_buffer_listener listener; From 7fdb0a1c4a8769909bd2449cb8114f0a93224600 Mon Sep 17 00:00:00 2001 From: Alexey Edelev Date: Wed, 29 Nov 2023 13:42:54 +0100 Subject: [PATCH 1354/1507] Remove the use of GENERATE_CPP_EXPORTS argument The behavior that argument was enabling is the default one now. Task-number: QTBUG-90492 Change-Id: I757472613f2c71eed9826c02de6f1cfc6727dc51 Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/plugins/platforms/wayland/CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/src/plugins/platforms/wayland/CMakeLists.txt b/src/plugins/platforms/wayland/CMakeLists.txt index 300fd4ffa82..6bb8a891f40 100644 --- a/src/plugins/platforms/wayland/CMakeLists.txt +++ b/src/plugins/platforms/wayland/CMakeLists.txt @@ -9,7 +9,6 @@ qt_internal_add_module(WaylandClient PLUGIN_TYPES wayland-graphics-integration-client wayland-inputdevice-integration wayland-decoration-client wayland-shell-integration - GENERATE_CPP_EXPORTS SOURCES ../shared/qwaylandinputmethodeventbuilder.cpp ../shared/qwaylandinputmethodeventbuilder_p.h ../shared/qwaylandmimehelper.cpp ../shared/qwaylandmimehelper_p.h From 5ecf0fcdf1e566af0bf041545d506eb7b8f5bf72 Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Thu, 30 May 2024 12:20:01 +0300 Subject: [PATCH 1355/1507] tests: Implement wl_compositor v5 Change-Id: I60ff85d20b545ae97e3bbb49313ebedf1224a3ac Reviewed-by: David Edmundson --- tests/auto/wayland/shared/coreprotocol.cpp | 11 ++++++++++- tests/auto/wayland/shared/coreprotocol.h | 3 ++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/tests/auto/wayland/shared/coreprotocol.cpp b/tests/auto/wayland/shared/coreprotocol.cpp index 833ad4b097f..5d9c4e9a368 100644 --- a/tests/auto/wayland/shared/coreprotocol.cpp +++ b/tests/auto/wayland/shared/coreprotocol.cpp @@ -77,8 +77,10 @@ void Surface::surface_attach(Resource *resource, wl_resource *buffer, int32_t x, m_image = QImage(); } else { QPoint offset(x, y); + if (resource->version() < 5) + m_pending.commitSpecific.attachOffset = offset; + m_pending.buffer = fromResource(buffer); - m_pending.commitSpecific.attachOffset = offset; m_pending.commitSpecific.attached = true; emit attach(buffer, offset); @@ -143,6 +145,13 @@ void Surface::surface_frame(Resource *resource, uint32_t callback) } } +void Surface::surface_offset(Resource *resource, int32_t x, int32_t y) +{ + Q_UNUSED(resource); + QPoint offset(x, y); + m_pending.commitSpecific.attachOffset = offset; +} + bool WlCompositor::isClean() { for (auto *surface : std::as_const(m_surfaces)) { if (!CursorRole::fromSurface(surface)) { diff --git a/tests/auto/wayland/shared/coreprotocol.h b/tests/auto/wayland/shared/coreprotocol.h index 0f59441a386..9699759d030 100644 --- a/tests/auto/wayland/shared/coreprotocol.h +++ b/tests/auto/wayland/shared/coreprotocol.h @@ -124,6 +124,7 @@ protected: void surface_set_buffer_scale(Resource *resource, int32_t scale) override; void surface_commit(Resource *resource) override; void surface_frame(Resource *resource, uint32_t callback) override; + void surface_offset(Resource *resource, int32_t x, int32_t y) override; }; class Region : public QtWaylandServer::wl_region @@ -145,7 +146,7 @@ class WlCompositor : public Global, public QtWaylandServer::wl_compositor { Q_OBJECT public: - explicit WlCompositor(CoreCompositor *compositor, int version = 4) + explicit WlCompositor(CoreCompositor *compositor, int version = 5) : QtWaylandServer::wl_compositor(compositor->m_display, version) , m_compositor(compositor) {} From ea0fbf92ec0ae6b3dc49679ee73f5e3a0b580237 Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Thu, 30 May 2024 12:26:21 +0300 Subject: [PATCH 1356/1507] tests: Bump wl_compositor to v6 Change-Id: I4aa61193460ef9d2c8b4f9d46e10ef5bad4dcc87 Reviewed-by: David Edmundson --- tests/auto/wayland/shared/coreprotocol.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/wayland/shared/coreprotocol.h b/tests/auto/wayland/shared/coreprotocol.h index 9699759d030..bea39dd134d 100644 --- a/tests/auto/wayland/shared/coreprotocol.h +++ b/tests/auto/wayland/shared/coreprotocol.h @@ -146,7 +146,7 @@ class WlCompositor : public Global, public QtWaylandServer::wl_compositor { Q_OBJECT public: - explicit WlCompositor(CoreCompositor *compositor, int version = 5) + explicit WlCompositor(CoreCompositor *compositor, int version = 6) : QtWaylandServer::wl_compositor(compositor->m_display, version) , m_compositor(compositor) {} From 9425194431a00ee0468d50e856d2ee5e491eef55 Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Wed, 14 Jun 2023 11:43:02 +0100 Subject: [PATCH 1357/1507] tests: Re-enable test dontCrashOnMultipleCommits Since the test was disabled, many changes have been made in improving the mock compositor with regards to stability. It appears the need to skip this test have been resolved. Change-Id: Ia01528a29aca20f5ec7434401669672a0c5ac388 Fixes: QTBUG-68756 Reviewed-by: Vlad Zahorodnii --- tests/auto/wayland/client/tst_client.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/auto/wayland/client/tst_client.cpp b/tests/auto/wayland/client/tst_client.cpp index 253a98b733d..fa4a81e195f 100644 --- a/tests/auto/wayland/client/tst_client.cpp +++ b/tests/auto/wayland/client/tst_client.cpp @@ -465,7 +465,6 @@ void tst_WaylandClient::mouseDrag() void tst_WaylandClient::dontCrashOnMultipleCommits() { - QSKIP("This test is flaky. See QTBUG-68756."); auto window = new TestWindow(); window->show(); From c1e0ffd28617d671fef1cb0061bde0c389f096c9 Mon Sep 17 00:00:00 2001 From: Kai Uwe Broulik Date: Thu, 14 Dec 2023 12:51:54 +0100 Subject: [PATCH 1358/1507] QWaylandDataDevice: Use internal input device keyboard modifiers QGuiApplication::keyboardModifiers() is somewhat wonky on Wayland because on Wayland a modifier update is sent after the key event but Qt only updates the modifiers in response to actual key events. While this should also be fixed, using our internal state is an easy way to avoid this and ensure the keyboard modifiers in a drag/drop event are correct. Pick-to: 6.8 6.7 6.6 6.5 Change-Id: I8bf0190663d7d47ea3d261e6daa4f622ea031e82 Reviewed-by: David Edmundson --- src/plugins/platforms/wayland/qwaylanddatadevice.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylanddatadevice.cpp b/src/plugins/platforms/wayland/qwaylanddatadevice.cpp index a59b201f670..30bfb86c571 100644 --- a/src/plugins/platforms/wayland/qwaylanddatadevice.cpp +++ b/src/plugins/platforms/wayland/qwaylanddatadevice.cpp @@ -195,7 +195,7 @@ void QWaylandDataDevice::data_device_drop() QPlatformDropQtResponse response = QWindowSystemInterface::handleDrop(m_dragWindow, dragData, m_dragPoint, supportedActions, QGuiApplication::mouseButtons(), - QGuiApplication::keyboardModifiers()); + m_inputDevice->modifiers()); if (drag) { auto drag = static_cast(QGuiApplicationPrivate::platformIntegration()->drag()); drag->setDropResponse(response); @@ -230,7 +230,7 @@ void QWaylandDataDevice::data_device_enter(uint32_t serial, wl_surface *surface, const QPlatformDragQtResponse &response = QWindowSystemInterface::handleDrag( m_dragWindow, dragData, m_dragPoint, supportedActions, QGuiApplication::mouseButtons(), - QGuiApplication::keyboardModifiers()); + m_inputDevice->modifiers()); if (drag) { static_cast(QGuiApplicationPrivate::platformIntegration()->drag())->setResponse(response); } @@ -243,7 +243,7 @@ void QWaylandDataDevice::data_device_leave() if (m_dragWindow) QWindowSystemInterface::handleDrag(m_dragWindow, nullptr, QPoint(), Qt::IgnoreAction, QGuiApplication::mouseButtons(), - QGuiApplication::keyboardModifiers()); + m_inputDevice->modifiers()); QDrag *drag = static_cast(QGuiApplicationPrivate::platformIntegration()->drag())->currentDrag(); if (!drag) { @@ -274,7 +274,7 @@ void QWaylandDataDevice::data_device_motion(uint32_t time, wl_fixed_t x, wl_fixe const QPlatformDragQtResponse response = QWindowSystemInterface::handleDrag(m_dragWindow, dragData, m_dragPoint, supportedActions, QGuiApplication::mouseButtons(), - QGuiApplication::keyboardModifiers()); + m_inputDevice->modifiers()); if (drag) { static_cast(QGuiApplicationPrivate::platformIntegration()->drag())->setResponse(response); From 56e4b5fa01eda59ee68daeced41f6adf73daa647 Mon Sep 17 00:00:00 2001 From: David Redondo Date: Mon, 13 May 2024 15:30:05 +0200 Subject: [PATCH 1359/1507] client: Remove support for surface extension Qt Wayland Compositor does not implement this anymore. Change-Id: If7a780218991aa35e9a34cd0eda3ae59a99844a2 Reviewed-by: David Edmundson --- .../wayland/extensions/surface-extension.xml | 62 ------------- src/plugins/platforms/wayland/CMakeLists.txt | 2 - .../wl-shell/qwaylandwlshellsurface.cpp | 35 ------- .../wl-shell/qwaylandwlshellsurface_p.h | 6 -- .../platforms/wayland/qwaylanddisplay.cpp | 5 - .../platforms/wayland/qwaylanddisplay_p.h | 6 -- .../wayland/qwaylandextendedsurface.cpp | 92 ------------------- .../wayland/qwaylandextendedsurface_p.h | 59 ------------ .../wayland/qwaylandnativeinterface.cpp | 1 - .../wayland/qwaylandshellsurface.cpp | 1 - 10 files changed, 269 deletions(-) delete mode 100644 src/3rdparty/wayland/extensions/surface-extension.xml delete mode 100644 src/plugins/platforms/wayland/qwaylandextendedsurface.cpp delete mode 100644 src/plugins/platforms/wayland/qwaylandextendedsurface_p.h diff --git a/src/3rdparty/wayland/extensions/surface-extension.xml b/src/3rdparty/wayland/extensions/surface-extension.xml deleted file mode 100644 index 231db0b35b2..00000000000 --- a/src/3rdparty/wayland/extensions/surface-extension.xml +++ /dev/null @@ -1,62 +0,0 @@ - - - - Copyright (C) 2015 The Qt Company Ltd. - SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/plugins/platforms/wayland/CMakeLists.txt b/src/plugins/platforms/wayland/CMakeLists.txt index 6bb8a891f40..4d0a106f658 100644 --- a/src/plugins/platforms/wayland/CMakeLists.txt +++ b/src/plugins/platforms/wayland/CMakeLists.txt @@ -30,7 +30,6 @@ qt_internal_add_module(WaylandClient qwaylanddecorationfactory.cpp qwaylanddecorationfactory_p.h qwaylanddecorationplugin.cpp qwaylanddecorationplugin_p.h qwaylanddisplay.cpp qwaylanddisplay_p.h - qwaylandextendedsurface.cpp qwaylandextendedsurface_p.h qwaylandfractionalscale.cpp qwaylandfractionalscale_p.h qwaylandinputcontext.cpp qwaylandinputcontext_p.h qwaylandtextinputv1.cpp qwaylandtextinputv1_p.h @@ -99,7 +98,6 @@ qt6_generate_wayland_protocol_client_sources(WaylandClient ${CMAKE_CURRENT_SOURCE_DIR}/../extensions/qt-key-unstable-v1.xml ${CMAKE_CURRENT_SOURCE_DIR}/../extensions/qt-text-input-method-unstable-v1.xml ${CMAKE_CURRENT_SOURCE_DIR}/../extensions/qt-windowmanager.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../extensions/surface-extension.xml ${CMAKE_CURRENT_SOURCE_DIR}/../extensions/touch-extension.xml ${CMAKE_CURRENT_SOURCE_DIR}/hardwareintegration/../../extensions/hardware-integration.xml ${CMAKE_CURRENT_SOURCE_DIR}/hardwareintegration/../../extensions/server-buffer-extension.xml diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellsurface.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellsurface.cpp index 4dc93cd988b..7ffa41c91ad 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellsurface.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellsurface.cpp @@ -8,7 +8,6 @@ #include #include #include -#include #include @@ -21,9 +20,6 @@ QWaylandWlShellSurface::QWaylandWlShellSurface(struct ::wl_shell_surface *shell_ , QtWayland::wl_shell_surface(shell_surface) , m_window(window) { - if (window->display()->windowExtension()) - m_extendedWindow = new QWaylandExtendedSurface(window); - Qt::WindowType type = window->window()->type(); auto *transientParent = window->transientParent(); if (type == Qt::Popup && transientParent && transientParent->wlSurface()) @@ -37,7 +33,6 @@ QWaylandWlShellSurface::QWaylandWlShellSurface(struct ::wl_shell_surface *shell_ QWaylandWlShellSurface::~QWaylandWlShellSurface() { wl_shell_surface_destroy(object()); - delete m_extendedWindow; } bool QWaylandWlShellSurface::resize(QWaylandInputDevice *inputDevice, Qt::Edges edges) @@ -64,36 +59,6 @@ void QWaylandWlShellSurface::setAppId(const QString & appId) return QtWayland::wl_shell_surface::set_class(appId); } -void QWaylandWlShellSurface::raise() -{ - if (m_extendedWindow) - m_extendedWindow->raise(); -} - -void QWaylandWlShellSurface::lower() -{ - if (m_extendedWindow) - m_extendedWindow->lower(); -} - -void QWaylandWlShellSurface::setContentOrientationMask(Qt::ScreenOrientations orientation) -{ - if (m_extendedWindow) - m_extendedWindow->setContentOrientationMask(orientation); -} - -void QWaylandWlShellSurface::setWindowFlags(Qt::WindowFlags flags) -{ - if (m_extendedWindow) - m_extendedWindow->setWindowFlags(flags); -} - -void QWaylandWlShellSurface::sendProperty(const QString &name, const QVariant &value) -{ - if (m_extendedWindow) - m_extendedWindow->updateGenericProperty(name, value); -} - void QWaylandWlShellSurface::applyConfigure() { if ((m_pending.states & (Qt::WindowMaximized|Qt::WindowFullScreen)) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellsurface_p.h b/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellsurface_p.h index 24600302895..780f5f3268e 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellsurface_p.h +++ b/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/qwaylandwlshellsurface_p.h @@ -48,12 +48,6 @@ public: void setTitle(const QString & title) override; void setAppId(const QString &appId) override; - void raise() override; - void lower() override; - void setContentOrientationMask(Qt::ScreenOrientations orientation) override; - void setWindowFlags(Qt::WindowFlags flags) override; - void sendProperty(const QString &name, const QVariant &value) override; - void applyConfigure() override; bool wantsDecorations() const override; diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index e6ed0772fa4..f78bf2dd2a0 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -34,7 +34,6 @@ #include "qwaylandshellintegration_p.h" #include "qwaylandclientbufferintegration_p.h" -#include "qwaylandextendedsurface_p.h" #include "qwaylandpointergestures_p.h" #include "qwaylandsubsurface_p.h" #include "qwaylandtouch_p.h" @@ -642,10 +641,6 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin } else if (interface == QLatin1String(QWaylandDataDeviceManager::interface()->name)) { mGlobals.dndSelectionHandler.reset(new QWaylandDataDeviceManager(this, version, id)); #endif - } else if (interface == QLatin1String(QtWayland::qt_surface_extension::interface()->name)) { - mGlobals.surfaceExtension.reset( - new WithDestructor( - registry, id, 1)); } else if (interface == QLatin1String(QtWayland::wl_subcompositor::interface()->name)) { mGlobals.subCompositor.reset( new WithDestructor(registry, diff --git a/src/plugins/platforms/wayland/qwaylanddisplay_p.h b/src/plugins/platforms/wayland/qwaylanddisplay_p.h index 2fd176d8405..b93a2ecc0d2 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay_p.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay_p.h @@ -48,7 +48,6 @@ class QPlatformScreen; class QPlatformPlaceholderScreen; namespace QtWayland { - class qt_surface_extension; class zwp_text_input_manager_v1; class zwp_text_input_manager_v2; class zwp_text_input_manager_v3; @@ -153,10 +152,6 @@ public: return mGlobals.primarySelectionManager.get(); } #endif - QtWayland::qt_surface_extension *windowExtension() const - { - return mGlobals.surfaceExtension.get(); - } #if QT_CONFIG(tabletevent) QWaylandTabletManagerV2 *tabletManager() const { @@ -323,7 +318,6 @@ private: #if QT_CONFIG(wayland_datadevice) std::unique_ptr dndSelectionHandler; #endif - std::unique_ptr surfaceExtension; std::unique_ptr subCompositor; std::unique_ptr touchExtension; std::unique_ptr qtKeyExtension; diff --git a/src/plugins/platforms/wayland/qwaylandextendedsurface.cpp b/src/plugins/platforms/wayland/qwaylandextendedsurface.cpp deleted file mode 100644 index a61612ce873..00000000000 --- a/src/plugins/platforms/wayland/qwaylandextendedsurface.cpp +++ /dev/null @@ -1,92 +0,0 @@ -// Copyright (C) 2016 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only - -#include "qwaylandextendedsurface_p.h" - -#include "qwaylandwindow_p.h" - -#include "qwaylanddisplay_p.h" - -#include "qwaylandnativeinterface_p.h" - -#include -#include -#include - -QT_BEGIN_NAMESPACE - -namespace QtWaylandClient { - -QWaylandExtendedSurface::QWaylandExtendedSurface(QWaylandWindow *window) - : QtWayland::qt_extended_surface(window->display()->windowExtension()->get_extended_surface(window->wlSurface())) - , m_window(window) -{ -} - -QWaylandExtendedSurface::~QWaylandExtendedSurface() -{ - qt_extended_surface_destroy(object()); -} - -void QWaylandExtendedSurface::updateGenericProperty(const QString &name, const QVariant &value) -{ - QByteArray byteValue; - QDataStream ds(&byteValue, QIODevice::WriteOnly); - ds << value; - - update_generic_property(name, byteValue); -} - -void QWaylandExtendedSurface::setContentOrientationMask(Qt::ScreenOrientations mask) -{ - int32_t wlmask = 0; - if (mask & Qt::PrimaryOrientation) - wlmask |= QT_EXTENDED_SURFACE_ORIENTATION_PRIMARYORIENTATION; - if (mask & Qt::PortraitOrientation) - wlmask |= QT_EXTENDED_SURFACE_ORIENTATION_PORTRAITORIENTATION; - if (mask & Qt::LandscapeOrientation) - wlmask |= QT_EXTENDED_SURFACE_ORIENTATION_LANDSCAPEORIENTATION; - if (mask & Qt::InvertedPortraitOrientation) - wlmask |= QT_EXTENDED_SURFACE_ORIENTATION_INVERTEDPORTRAITORIENTATION; - if (mask & Qt::InvertedLandscapeOrientation) - wlmask |= QT_EXTENDED_SURFACE_ORIENTATION_INVERTEDLANDSCAPEORIENTATION; - set_content_orientation_mask(wlmask); -} - -void QWaylandExtendedSurface::extended_surface_onscreen_visibility(int32_t visibility) -{ - m_window->window()->setVisibility(static_cast(visibility)); -} - -void QWaylandExtendedSurface::extended_surface_set_generic_property(const QString &name, wl_array *value) -{ - QByteArray data = QByteArray::fromRawData(static_cast(value->data), value->size); - - QVariant variantValue; - QDataStream ds(data); - ds >> variantValue; - - m_window->setProperty(name, variantValue); -} - -void QWaylandExtendedSurface::extended_surface_close() -{ - QWindowSystemInterface::handleCloseEvent(m_window->window()); -} - -Qt::WindowFlags QWaylandExtendedSurface::setWindowFlags(Qt::WindowFlags flags) -{ - uint wlFlags = 0; - - if (flags & Qt::WindowStaysOnTopHint) wlFlags |= QT_EXTENDED_SURFACE_WINDOWFLAG_STAYSONTOP; - if (flags & Qt::WindowOverridesSystemGestures) wlFlags |= QT_EXTENDED_SURFACE_WINDOWFLAG_OVERRIDESSYSTEMGESTURES; - if (flags & Qt::BypassWindowManagerHint) wlFlags |= QT_EXTENDED_SURFACE_WINDOWFLAG_BYPASSWINDOWMANAGER; - - set_window_flags(wlFlags); - - return flags & (Qt::WindowStaysOnTopHint | Qt::WindowOverridesSystemGestures | Qt::BypassWindowManagerHint); -} - -} - -QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandextendedsurface_p.h b/src/plugins/platforms/wayland/qwaylandextendedsurface_p.h deleted file mode 100644 index 0a7c6e5adc4..00000000000 --- a/src/plugins/platforms/wayland/qwaylandextendedsurface_p.h +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright (C) 2018 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only - -#ifndef QWAYLANDEXTENDEDSURFACE_H -#define QWAYLANDEXTENDEDSURFACE_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include -#include -#include // for QVariantMap - -#include - -#include -#include - -QT_BEGIN_NAMESPACE - -namespace QtWaylandClient { - -class QWaylandDisplay; -class QWaylandWindow; - -class Q_WAYLANDCLIENT_EXPORT QWaylandExtendedSurface : public QtWayland::qt_extended_surface -{ -public: - QWaylandExtendedSurface(QWaylandWindow *window); - ~QWaylandExtendedSurface() override; - - void setContentOrientationMask(Qt::ScreenOrientations mask); - - void updateGenericProperty(const QString &name, const QVariant &value); - - Qt::WindowFlags setWindowFlags(Qt::WindowFlags flags); - -private: - void extended_surface_onscreen_visibility(int32_t visibility) override; - void extended_surface_set_generic_property(const QString &name, wl_array *value) override; - void extended_surface_close() override; - - QWaylandWindow *m_window = nullptr; - QVariantMap m_properties; -}; - -} - -QT_END_NAMESPACE - -#endif // QWAYLANDEXTENDEDSURFACE_H diff --git a/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp b/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp index 601f833aacc..e1586d2446f 100644 --- a/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp +++ b/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp @@ -6,7 +6,6 @@ #include "qwaylandwindow_p.h" #include "qwaylandshellintegration_p.h" #include "qwaylandsubsurface_p.h" -#include "qwaylandextendedsurface_p.h" #include "qwaylandintegration_p.h" #include "qwaylanddisplay_p.h" #include "qwaylandwindowmanagerintegration_p.h" diff --git a/src/plugins/platforms/wayland/qwaylandshellsurface.cpp b/src/plugins/platforms/wayland/qwaylandshellsurface.cpp index 77d6b97a9d8..fde1e1d3fbd 100644 --- a/src/plugins/platforms/wayland/qwaylandshellsurface.cpp +++ b/src/plugins/platforms/wayland/qwaylandshellsurface.cpp @@ -3,7 +3,6 @@ #include "qwaylandshellsurface_p.h" #include "qwaylandwindow_p.h" -#include "qwaylandextendedsurface_p.h" #include "qwaylandinputdevice_p.h" QT_BEGIN_NAMESPACE From ec951588a8f3264df837459f78cdbe0bc12dfa4e Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Thu, 6 Jun 2024 09:26:03 +0200 Subject: [PATCH 1360/1507] Prepare for hiding of logging categories in namespaces We can and should use the new export macro for the client logging categories, but we need to manually define the compositor logging categories now since they are public and we cannot change their symbols. Task-number: QTBUG-67692 Change-Id: If4eb9c390a4851945d308e2b83ef13b12816698a Reviewed-by: David Edmundson --- src/plugins/platforms/wayland/qwaylanddisplay_p.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay_p.h b/src/plugins/platforms/wayland/qwaylanddisplay_p.h index b93a2ecc0d2..1e74c6dd297 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay_p.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay_p.h @@ -60,7 +60,7 @@ namespace QtWayland { namespace QtWaylandClient { -Q_WAYLANDCLIENT_EXPORT Q_DECLARE_LOGGING_CATEGORY(lcQpaWayland); +QT_DECLARE_EXPORTED_QT_LOGGING_CATEGORY(lcQpaWayland, Q_WAYLANDCLIENT_EXPORT); class QWaylandInputDevice; class QWaylandBuffer; From df83f3e568885d6021ddef1f7cc14bac3c379bed Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Thu, 20 Jun 2024 11:25:06 +0300 Subject: [PATCH 1361/1507] Client: Ensure that guessed popup parent has a shell surface The last input window may not have a shell surface if it is a subsurface or that window has been just made invisible. Pick-to: 6.8 6.7 Change-Id: Iad11c68659579429ddc5d9ba0038975b25da8e0d Reviewed-by: David Edmundson --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index e311b2eb430..1f9e9991469 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -1189,8 +1189,10 @@ QWaylandWindow *QWaylandWindow::guessTransientParent() const return mTopPopup; } - if (window()->type() == Qt::ToolTip || window()->type() == Qt::Popup) - return display()->lastInputWindow(); + if (window()->type() == Qt::ToolTip || window()->type() == Qt::Popup) { + if (auto lastInputWindow = display()->lastInputWindow()) + return closestShellSurfaceWindow(lastInputWindow->window()); + } return nullptr; } From 6c836fe5fb3e3b504ef2c35a733c76d548fd54a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niccol=C3=B2=20Venerandi?= Date: Mon, 3 Jun 2024 12:19:59 +0200 Subject: [PATCH 1362/1507] Emit a LeaveEvent on drag and drop start All focused windows will now receive a LeaveEvent when a drag and drop starts. This makes sure that the dragged element does not preserve any hover decoration during the drag and drop, and that other elements that happen to take place of the dragged elements don't become hovered too. Pick-to: 6.7 6.8 Change-Id: I0924fff987f143aff11284c808027dd210b48c2b Reviewed-by: David Edmundson --- src/plugins/platforms/wayland/qwaylanddnd.cpp | 5 +++++ .../platforms/wayland/qwaylandinputdevice.cpp | 14 ++++++++++++++ .../platforms/wayland/qwaylandinputdevice_p.h | 2 ++ 3 files changed, 21 insertions(+) diff --git a/src/plugins/platforms/wayland/qwaylanddnd.cpp b/src/plugins/platforms/wayland/qwaylanddnd.cpp index 5ea1e0d3376..096d7e5b586 100644 --- a/src/plugins/platforms/wayland/qwaylanddnd.cpp +++ b/src/plugins/platforms/wayland/qwaylanddnd.cpp @@ -28,6 +28,11 @@ QWaylandDrag::~QWaylandDrag() void QWaylandDrag::startDrag() { + // Some compositors do not send a pointer leave before starting a drag, some do. + // This is discussed upstream at: https://gitlab.freedesktop.org/wayland/wayland/-/issues/444 + // For consistency between compositors we emit the leave event here, upon drag start. + m_display->currentInputDevice()->handleStartDrag(); + QBasicDrag::startDrag(); QWaylandWindow *icon = static_cast(shapedPixmapWindow()->handle()); if (m_display->currentInputDevice()->dataDevice()->startDrag(drag()->mimeData(), drag()->supportedActions(), icon)) { diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index ce04971ba6f..416894fd439 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -528,6 +528,12 @@ void QWaylandInputDevice::handleEndDrag() mPointer->releaseButtons(); } +void QWaylandInputDevice::handleStartDrag() +{ + if (mPointer) + mPointer->leavePointers(); +} + #if QT_CONFIG(wayland_datadevice) void QWaylandInputDevice::setDataDevice(QWaylandDataDevice *device) { @@ -886,6 +892,14 @@ void QWaylandInputDevice::Pointer::releaseButtons() } } +void QWaylandInputDevice::Pointer::leavePointers() +{ + if (auto *window = focusWindow()) { + LeaveEvent e(focusWindow(), mSurfacePos, mGlobalPos); + window->handleMouse(mParent, e); + } +} + class WheelEvent : public QWaylandPointerEvent { public: diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h index becd5f9be04..91bcf405c53 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h +++ b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h @@ -92,6 +92,7 @@ public: #if QT_CONFIG(cursor) void setCursor(const QCursor *cursor, const QSharedPointer &cachedBuffer = {}, int fallbackOutputScale = 1); #endif + void handleStartDrag(); void handleEndDrag(); #if QT_CONFIG(wayland_datadevice) @@ -320,6 +321,7 @@ private: public: void releaseButtons(); + void leavePointers(); QWaylandInputDevice *mParent = nullptr; QPointer mFocus; From 0b1d950e437bd0e112b7f4f25b42f3318634200a Mon Sep 17 00:00:00 2001 From: Inho Lee Date: Wed, 19 Jun 2024 13:14:14 +0200 Subject: [PATCH 1363/1507] TextInputV3: Prevent a recursive update call MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit While scrollEvent, Qt calls textinput' update with cursorRect and anchorRect. In that case, TextInputV3's update function can make another update calls with saved data from compositor. So, commit will be skipped for cursorRect and anchorRect. Fixes: QTBUG-126275 Pick-to: 6.8 6.7 Change-Id: I9c47c46b20a227e72488e3b9bac3d6fc5e4b9066 Reviewed-by: Eskil Abrahamsen Blomfeldt Reviewed-by: Robert Löhning --- src/plugins/platforms/wayland/qwaylandtextinputv3.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandtextinputv3.cpp b/src/plugins/platforms/wayland/qwaylandtextinputv3.cpp index bb449c9d60d..a4ff7100649 100644 --- a/src/plugins/platforms/wayland/qwaylandtextinputv3.cpp +++ b/src/plugins/platforms/wayland/qwaylandtextinputv3.cpp @@ -238,7 +238,6 @@ void QWaylandTextInputv3::updateState(Qt::InputMethodQueries queries, uint32_t f if (surfaceRect != m_cursorRect) { set_cursor_rectangle(surfaceRect.x(), surfaceRect.y(), surfaceRect.width(), surfaceRect.height()); m_cursorRect = surfaceRect; - needsCommit = true; } } From dba3e364c98f0b2a9da19e9788e2dd4328614040 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Mon, 24 Jun 2024 09:25:15 +0200 Subject: [PATCH 1364/1507] Fix flakiness in tst_surface::createSubsurface() The tst_surface test has disabled automatic frame callbacks in the mock compositor. This means that if the timeout for this (100 ms) happens before the test finishes, all subsequent calls to isExposed() will fail, and commits will not be sent. The automatic frame callback was added for this specific reason, but for some reason it was disabled for tst_surface. This might just be conservative, but in case it could break some condition in the other tests, I have only enabled it for the specific test where it is clearly required. Task-number: QTBUG-126262 Change-Id: I91dbd6d837b5444c5e07659dc0b73fb28ece151d Reviewed-by: David Edmundson --- tests/auto/wayland/surface/tst_surface.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/auto/wayland/surface/tst_surface.cpp b/tests/auto/wayland/surface/tst_surface.cpp index 06e625155f2..9fe4188ef81 100644 --- a/tests/auto/wayland/surface/tst_surface.cpp +++ b/tests/auto/wayland/surface/tst_surface.cpp @@ -150,6 +150,9 @@ void tst_surface::negotiateShmFormat() void tst_surface::createSubsurface() { + m_config.autoFrameCallback = true; + auto autoFrameCallback = qScopeGuard([&] { m_config.autoFrameCallback = false; }); + QRasterWindow window; window.setObjectName("main"); window.resize(200, 200); From 949bcf87125b2b03ec3af8d62a7f4ffcf857ba36 Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Mon, 24 Jun 2024 09:58:54 +0100 Subject: [PATCH 1365/1507] client: Drop the concept of a queued buffer before the first expose Added in 46aece51330b6f9b5b4bfd68a5b3b183dc5b1c38 this was part of a guard to handle clients committing before the window was configured. Since then there has been work in ensuring expose events are delivered to the client correctly only when the window is configured. Including e6d55239c454d454978edb7d8b17f6c993e7ba07. Even if a client does manually explicitly flush a paint before the first expose, we should be able to simply discard the buffer. It's part of the contract that a client should redraw contents when it gets an expose event. This is better as any queued buffer cannot be of the right size and it simplifies the code. Pick-to: 6.8 Fixes: QTBUG-126262 Change-Id: Ia4829ca75a55819b5e8ab366baedcdf83dfc14ec Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 13 +------------ src/plugins/platforms/wayland/qwaylandwindow_p.h | 2 -- 2 files changed, 1 insertion(+), 14 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 1f9e9991469..1ab9dc33791 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -333,12 +333,6 @@ void QWaylandWindow::reset() mInputRegion = QRegion(); mTransparentInputRegion = false; - if (mQueuedBuffer) { - mQueuedBuffer->setBusy(false); - } - mQueuedBuffer = nullptr; - mQueuedBufferDamage = QRegion(); - mDisplay->handleWindowDestroyed(this); } @@ -763,12 +757,7 @@ void QWaylandWindow::safeCommit(QWaylandBuffer *buffer, const QRegion &damage) if (isExposed()) { commit(buffer, damage); } else { - if (mQueuedBuffer) { - mQueuedBuffer->setBusy(false); - } - mQueuedBuffer = buffer; - mQueuedBuffer->setBusy(true); - mQueuedBufferDamage = damage; + buffer->setBusy(false); } } diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index c1b736c1e95..5eec5b5d136 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -327,8 +327,6 @@ protected: ToplevelWindowTilingStates mLastReportedToplevelWindowTilingStates = WindowNoState; QWaylandShmBackingStore *mBackingStore = nullptr; - QWaylandBuffer *mQueuedBuffer = nullptr; - QRegion mQueuedBufferDamage; QMargins mCustomMargins; From 1dc1938cd7d444ec21bfa2215185ecaf3d370758 Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Wed, 29 May 2024 14:47:44 +0300 Subject: [PATCH 1366/1507] Client: Split requests to set window and content geometry Currently, QWaylandShellSurface::setWindowGeometry() serves several purposes. It's used to specify the bounds of the content when using client side decorations (not preferred but the one that's painted) and it's used to tell the compositor the preferred window size. These two use cases are very different in nature. This change introduces QWaylandShellSurface::setContentGeometry() request, which can be used to communicate the bounds of the client side decorated content. The content geometry is specified in the surface-local coordinate system, i.e. 0,0 is the main surface's top left corner. QWaylandShellSurface::setWindowGeometry() takes window geometry in the global coordinate system, excluding the drop shadows. [ChangeLog][QtWaylandClient][Important Behavior Changes] The QWaylandShellSurface::setWindowGeometry() function is no longer suitable for communicating the bounds of client side decorated content. Custom shell implementations should use QWaylandShellSurface::setContentGeometry() instead. Change-Id: I134ce4f0866d3abbe7050ed6769dc586210eac27 Reviewed-by: David Edmundson Reviewed-by: Eskil Abrahamsen Blomfeldt --- .../xdg-shell/qwaylandxdgshell.cpp | 4 ++-- .../xdg-shell/qwaylandxdgshell_p.h | 2 +- .../platforms/wayland/qwaylandshellsurface.cpp | 6 ++++++ .../platforms/wayland/qwaylandshellsurface_p.h | 4 +++- .../platforms/wayland/qwaylandwindow.cpp | 17 ++++++++++++----- 5 files changed, 24 insertions(+), 9 deletions(-) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp index 6e5e47da9e7..6ccda7d265f 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp @@ -400,7 +400,7 @@ bool QWaylandXdgSurface::handleExpose(const QRegion ®ion) if (!isExposed() && !region.isEmpty()) { return true; } - setWindowGeometry(window()->windowContentGeometry()); + setContentGeometry(window()->windowContentGeometry()); return false; } @@ -435,7 +435,7 @@ void QWaylandXdgSurface::propagateSizeHints() setSizeHints(); } -void QWaylandXdgSurface::setWindowGeometry(const QRect &rect) +void QWaylandXdgSurface::setContentGeometry(const QRect &rect) { if (window()->isExposed()) set_window_geometry(rect.x(), rect.y(), rect.width(), rect.height()); diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h index d18ce4d7278..c3a3763a145 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h @@ -62,7 +62,7 @@ public: void applyConfigure() override; bool wantsDecorations() const override; void propagateSizeHints() override; - void setWindowGeometry(const QRect &rect) override; + void setContentGeometry(const QRect &rect) override; bool requestActivate() override; bool requestActivateOnShow() override; void setXdgActivationToken(const QString &token) override; diff --git a/src/plugins/platforms/wayland/qwaylandshellsurface.cpp b/src/plugins/platforms/wayland/qwaylandshellsurface.cpp index fde1e1d3fbd..2dc218c2f75 100644 --- a/src/plugins/platforms/wayland/qwaylandshellsurface.cpp +++ b/src/plugins/platforms/wayland/qwaylandshellsurface.cpp @@ -35,6 +35,12 @@ wl_surface *QWaylandShellSurface::wlSurface() return m_window ? m_window->wlSurface() : nullptr; } +void QWaylandShellSurface::setWindowGeometry(const QRect &rect) +{ + setWindowPosition(rect.topLeft()); + setWindowSize(rect.size()); +} + void QWaylandShellSurface::resizeFromApplyConfigure(const QSize &sizeWithMargins, const QPoint &offset) { m_window->resizeFromApplyConfigure(sizeWithMargins, offset); diff --git a/src/plugins/platforms/wayland/qwaylandshellsurface_p.h b/src/plugins/platforms/wayland/qwaylandshellsurface_p.h index 8632efd04de..07fd82edc50 100644 --- a/src/plugins/platforms/wayland/qwaylandshellsurface_p.h +++ b/src/plugins/platforms/wayland/qwaylandshellsurface_p.h @@ -56,6 +56,7 @@ public: virtual void raise() {} virtual void lower() {} virtual void setContentOrientationMask(Qt::ScreenOrientations orientation) { Q_UNUSED(orientation); } + virtual void setContentGeometry(const QRect &rect) { Q_UNUSED(rect); } virtual void sendProperty(const QString &name, const QVariant &value); @@ -66,8 +67,9 @@ public: virtual void propagateSizeHints() {} - virtual void setWindowGeometry(const QRect &rect) { Q_UNUSED(rect); } + virtual void setWindowGeometry(const QRect &rect); virtual void setWindowPosition(const QPoint &position) { Q_UNUSED(position); } + virtual void setWindowSize(const QSize &size) { Q_UNUSED(size); } virtual bool requestActivate() { return false; } virtual bool requestActivateOnShow() { return false; } diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 1ab9dc33791..4e2163df785 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -431,6 +431,16 @@ void QWaylandWindow::setGeometry_helper(const QRect &rect) void QWaylandWindow::setGeometry(const QRect &r) { + if (mShellSurface) { + if (!mInResizeFromApplyConfigure) { + const QRect frameGeometry = r.marginsAdded(clientSideMargins()).marginsRemoved(windowContentMargins()); + if (qt_window_private(window())->positionAutomatic) + mShellSurface->setWindowSize(frameGeometry.size()); + else + mShellSurface->setWindowGeometry(frameGeometry); + } + } + auto rect = r; if (fixedToplevelPositions && !QPlatformWindow::parent() && window()->type() != Qt::Popup && window()->type() != Qt::ToolTip) { @@ -454,11 +464,8 @@ void QWaylandWindow::setGeometry(const QRect &r) if (isExposed() && !mInResizeFromApplyConfigure && exposeGeometry != mLastExposeGeometry) sendExposeEvent(exposeGeometry); - if (mShellSurface) { - mShellSurface->setWindowGeometry(windowContentGeometry()); - if (!qt_window_private(window())->positionAutomatic && !mInResizeFromApplyConfigure) - mShellSurface->setWindowPosition(windowGeometry().topLeft()); - } + if (mShellSurface) + mShellSurface->setContentGeometry(windowContentGeometry()); if (isOpaque() && mMask.isEmpty()) setOpaqueArea(QRect(QPoint(0, 0), rect.size())); From de63a04367f1c831cfacac994ef21e23a1d5dad6 Mon Sep 17 00:00:00 2001 From: Nicolas Fella Date: Wed, 12 Jun 2024 15:42:09 +0200 Subject: [PATCH 1367/1507] QWaylandTablet: Update input device serial on events Fixes: QTBUG-118640 Pick-to: 6.8 6.7 Change-Id: I46ed31d85f9c80ac27ab9c161c23fcb429f82f43 Reviewed-by: Shawn Rutledge --- src/plugins/platforms/wayland/qwaylandinputdevice_p.h | 1 + src/plugins/platforms/wayland/qwaylandtabletv2.cpp | 9 +++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h index 91bcf405c53..06a9f55d163 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h +++ b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h @@ -193,6 +193,7 @@ protected: friend class QWaylandPointerGestureSwipe; friend class QWaylandPointerGesturePinch; friend class QWaylandWindow; + friend class QWaylandTabletToolV2; }; inline uint32_t QWaylandInputDevice::serial() const diff --git a/src/plugins/platforms/wayland/qwaylandtabletv2.cpp b/src/plugins/platforms/wayland/qwaylandtabletv2.cpp index 73524c1664c..aa942161431 100644 --- a/src/plugins/platforms/wayland/qwaylandtabletv2.cpp +++ b/src/plugins/platforms/wayland/qwaylandtabletv2.cpp @@ -153,7 +153,9 @@ void QWaylandTabletToolV2::zwp_tablet_tool_v2_removed() void QWaylandTabletToolV2::zwp_tablet_tool_v2_proximity_in(uint32_t serial, zwp_tablet_v2 *tablet, wl_surface *surface) { Q_UNUSED(tablet); - Q_UNUSED(serial); + + m_tabletSeat->seat()->mSerial = serial; + if (Q_UNLIKELY(!surface)) { qCDebug(lcQpaWayland) << "Ignoring zwp_tablet_tool_v2_proximity_v2 with no surface"; return; @@ -172,6 +174,8 @@ void QWaylandTabletToolV2::zwp_tablet_tool_v2_down(uint32_t serial) { m_pending.down = true; + m_tabletSeat->seat()->mSerial = serial; + if (m_pending.proximitySurface) { if (QWaylandWindow *window = m_pending.proximitySurface->waylandWindow()) { QWaylandInputDevice *seat = m_tabletSeat->seat(); @@ -230,7 +234,8 @@ static Qt::MouseButton mouseButtonFromTablet(uint button) void QWaylandTabletToolV2::zwp_tablet_tool_v2_button(uint32_t serial, uint32_t button, uint32_t state) { - Q_UNUSED(serial); + m_tabletSeat->seat()->mSerial = serial; + Qt::MouseButton mouseButton = mouseButtonFromTablet(button); if (state == button_state_pressed) m_pending.buttons |= mouseButton; From e349e5529d507ed65d443a1cc1fce95e26901516 Mon Sep 17 00:00:00 2001 From: Nicolas Fella Date: Wed, 12 Jun 2024 15:44:41 +0200 Subject: [PATCH 1368/1507] QWaylandDataDevice: Use lastInputWindow as source Currently we only consider the pointer focus and touch focus window, but not tablet input Pick-to: 6.8 6.7 Change-Id: I62558a9b6362c9d773fbdf8949468529ee83bffe Reviewed-by: Vlad Zahorodnii --- src/plugins/platforms/wayland/qwaylanddatadevice.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylanddatadevice.cpp b/src/plugins/platforms/wayland/qwaylanddatadevice.cpp index 30bfb86c571..095911274dc 100644 --- a/src/plugins/platforms/wayland/qwaylanddatadevice.cpp +++ b/src/plugins/platforms/wayland/qwaylanddatadevice.cpp @@ -85,10 +85,7 @@ QWaylandDataOffer *QWaylandDataDevice::dragOffer() const bool QWaylandDataDevice::startDrag(QMimeData *mimeData, Qt::DropActions supportedActions, QWaylandWindow *icon) { - auto *seat = m_display->currentInputDevice(); - auto *origin = seat->pointerFocus(); - if (!origin) - origin = seat->touchFocus(); + auto *origin = m_display->lastInputWindow(); if (!origin) { qCDebug(lcQpaWayland) << "Couldn't start a drag because the origin window could not be found."; @@ -161,7 +158,7 @@ bool QWaylandDataDevice::startDrag(QMimeData *mimeData, Qt::DropActions supporte } } - start_drag(m_dragSource->object(), origin->wlSurface(), icon->wlSurface(), m_display->currentInputDevice()->serial()); + start_drag(m_dragSource->object(), origin->wlSurface(), icon->wlSurface(), m_display->lastInputSerial()); return true; } From 803f160dc3af942da6b3d5917ea52e1392f0ed93 Mon Sep 17 00:00:00 2001 From: Nicolas Fella Date: Mon, 10 Jun 2024 15:40:31 +0200 Subject: [PATCH 1369/1507] Client: Pass modifiers to tablet event handling So that the resulting QTabletEvent has the modifier information Pick-to: 6.8 6.7 6.5 Change-Id: Ifbd771f59ac41b740ccb65db2986726e7a32a760 Reviewed-by: Shawn Rutledge --- src/plugins/platforms/wayland/qwaylandtabletv2.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandtabletv2.cpp b/src/plugins/platforms/wayland/qwaylandtabletv2.cpp index aa942161431..be8f1977008 100644 --- a/src/plugins/platforms/wayland/qwaylandtabletv2.cpp +++ b/src/plugins/platforms/wayland/qwaylandtabletv2.cpp @@ -272,9 +272,11 @@ void QWaylandTabletToolV2::zwp_tablet_tool_v2_frame(uint32_t time) qreal tangentialPressure = m_pending.slider; qreal rotation = m_pending.rotation; int z = int(m_pending.distance); - QWindowSystemInterface::handleTabletEvent(window, timestamp, localPosition, globalPosition, - int(m_tabletDevice), int(m_pointerType), buttons, pressure, - xTilt, yTilt, tangentialPressure, rotation, z, m_uid); + + QWindowSystemInterface::handleTabletEvent( + window, timestamp, localPosition, globalPosition, int(m_tabletDevice), + int(m_pointerType), buttons, pressure, xTilt, yTilt, tangentialPressure, rotation, + z, m_uid, m_tabletSeat->seat()->modifiers()); } if (!m_pending.proximitySurface && m_applied.enteredSurface) { From 4ad1c345a0e52ba37ff951f7e20a28e7f07efd99 Mon Sep 17 00:00:00 2001 From: Liang Qi Date: Fri, 28 Jun 2024 11:37:25 +0200 Subject: [PATCH 1370/1507] Revert "client: implement QWaylandScreen::topLevelAt()" This reverts commit 682f7c4b78ce130d621d70b770062d76cd13fa2a. QtWidgets depends on the old QApplication::topLevelAt() behavior too much, especially for the single top level window case. It's not easy to be decoupled in this way. Task-number: QTBUG-113404 Fixes: QTBUG-125878 Fixes: QTBUG-126313 Pick-to: 6.8 6.7 6.5 Change-Id: I5804d9c600c77e85f4f83753c87815fbbbc2362e Reviewed-by: David Edmundson --- src/plugins/platforms/wayland/qwaylandscreen.cpp | 10 ---------- src/plugins/platforms/wayland/qwaylandscreen_p.h | 2 -- 2 files changed, 12 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandscreen.cpp b/src/plugins/platforms/wayland/qwaylandscreen.cpp index d51e8c6a0b6..3faef3f255d 100644 --- a/src/plugins/platforms/wayland/qwaylandscreen.cpp +++ b/src/plugins/platforms/wayland/qwaylandscreen.cpp @@ -170,16 +170,6 @@ QList QWaylandScreen::virtualSiblings() const return list; } -QWindow *QWaylandScreen::topLevelAt(const QPoint & pos) const -{ - if (QWaylandWindow::fixedToplevelPositions) { - Q_UNUSED(pos); - return nullptr; - } - - return QPlatformScreen::topLevelAt(pos); -} - Qt::ScreenOrientation QWaylandScreen::orientation() const { return m_orientation; diff --git a/src/plugins/platforms/wayland/qwaylandscreen_p.h b/src/plugins/platforms/wayland/qwaylandscreen_p.h index ce3df3099ed..ff3d23217c7 100644 --- a/src/plugins/platforms/wayland/qwaylandscreen_p.h +++ b/src/plugins/platforms/wayland/qwaylandscreen_p.h @@ -63,8 +63,6 @@ public: QDpi logicalDpi() const override; QList virtualSiblings() const override; - QWindow *topLevelAt(const QPoint &point) const override; - Qt::ScreenOrientation orientation() const override; int scale() const; qreal devicePixelRatio() const override; From 5d77ed0258b7e4125efc37b9649439270fc102f3 Mon Sep 17 00:00:00 2001 From: Nicolas Fella Date: Sun, 7 Jul 2024 18:35:49 +0200 Subject: [PATCH 1371/1507] Client: Properly handle tablet manager being announced after wl_seat When wl_seat is announced we create QWaylandInputDevice and there check whether the tablet manager is available, create the tablet seat, and store it in mTabletSeat. If zwp_tablet_manager_v2 is announced after wl_seat, which happens e.g. on Weston, we created the tablet seat in the QWaylandTabletManagerV2 ctor, but didn't update mTabletSeat. To address this, we move the handling to QWaylandDisplay and pass the manager to QWaylandInputDevice, similar to how we do it e.g. for text-input. Pick-to: 6.8 6.7 Change-Id: I902375ec0085d34ba99cbe59bbbc4051e7d1e802 Reviewed-by: David Edmundson Reviewed-by: Liang Qi Reviewed-by: Shawn Rutledge --- src/plugins/platforms/wayland/qwaylanddisplay.cpp | 3 +++ .../platforms/wayland/qwaylandinputdevice.cpp | 12 ++++++++++++ src/plugins/platforms/wayland/qwaylandtabletv2.cpp | 10 ---------- src/plugins/platforms/wayland/qwaylandtabletv2_p.h | 1 - 4 files changed, 15 insertions(+), 11 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index f78bf2dd2a0..79cec09af93 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -652,6 +652,9 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin #if QT_CONFIG(tabletevent) } else if (interface == QLatin1String(QWaylandTabletManagerV2::interface()->name)) { mGlobals.tabletManager.reset(new QWaylandTabletManagerV2(this, id, qMin(1, int(version)))); + for (QWaylandInputDevice *inputDevice : std::as_const(mInputDevices)) + inputDevice->setTabletSeat( + new QWaylandTabletSeatV2(mGlobals.tabletManager.get(), inputDevice)); #endif } else if (interface == QLatin1String(QWaylandPointerGestures::interface()->name)) { mGlobals.pointerGestures.reset(new QWaylandPointerGestures(this, id, 1)); diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index 416894fd439..c72c2a81452 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -563,6 +563,18 @@ void QWaylandInputDevice::setTextInput(QWaylandTextInputInterface *textInput) mTextInput.reset(textInput); } +#if QT_CONFIG(tabletevent) +void QWaylandInputDevice::setTabletSeat(QWaylandTabletSeatV2 *tabletSeat) +{ + mTabletSeat.reset(tabletSeat); +} + +QWaylandTabletSeatV2 *QWaylandInputDevice::tabletSeat() const +{ + return mTabletSeat.get(); +} +#endif + void QWaylandInputDevice::setTextInputMethod(QWaylandTextInputMethod *textInputMethod) { mTextInputMethod.reset(textInputMethod); diff --git a/src/plugins/platforms/wayland/qwaylandtabletv2.cpp b/src/plugins/platforms/wayland/qwaylandtabletv2.cpp index be8f1977008..e15185f08ef 100644 --- a/src/plugins/platforms/wayland/qwaylandtabletv2.cpp +++ b/src/plugins/platforms/wayland/qwaylandtabletv2.cpp @@ -13,11 +13,6 @@ namespace QtWaylandClient { QWaylandTabletManagerV2::QWaylandTabletManagerV2(QWaylandDisplay *display, uint id, uint version) : zwp_tablet_manager_v2(display->wl_registry(), id, qMin(version, uint(1))) { - // Create tabletSeats for all seats. - // This only works if we get the manager after all seats - const auto seats = display->inputDevices(); - for (auto *seat : seats) - createTabletSeat(seat); } QWaylandTabletManagerV2::~QWaylandTabletManagerV2() @@ -25,11 +20,6 @@ QWaylandTabletManagerV2::~QWaylandTabletManagerV2() destroy(); } -QWaylandTabletSeatV2 *QWaylandTabletManagerV2::createTabletSeat(QWaylandInputDevice *seat) -{ - return new QWaylandTabletSeatV2(this, seat); -} - QWaylandTabletSeatV2::QWaylandTabletSeatV2(QWaylandTabletManagerV2 *manager, QWaylandInputDevice *seat) : QtWayland::zwp_tablet_seat_v2(manager->get_tablet_seat(seat->wl_seat())) , m_seat(seat) diff --git a/src/plugins/platforms/wayland/qwaylandtabletv2_p.h b/src/plugins/platforms/wayland/qwaylandtabletv2_p.h index 20a8a4f5a24..f6f1daa9886 100644 --- a/src/plugins/platforms/wayland/qwaylandtabletv2_p.h +++ b/src/plugins/platforms/wayland/qwaylandtabletv2_p.h @@ -43,7 +43,6 @@ class Q_WAYLANDCLIENT_EXPORT QWaylandTabletManagerV2 : public QtWayland::zwp_tab public: explicit QWaylandTabletManagerV2(QWaylandDisplay *display, uint id, uint version); ~QWaylandTabletManagerV2() override; - QWaylandTabletSeatV2 *createTabletSeat(QWaylandInputDevice *seat); }; class Q_WAYLANDCLIENT_EXPORT QWaylandTabletSeatV2 : public QObject, public QtWayland::zwp_tablet_seat_v2 From d4492782ed03a2ef6fc27f8b22e93b805ce7e092 Mon Sep 17 00:00:00 2001 From: Liang Qi Date: Wed, 3 Jul 2024 15:06:09 +0200 Subject: [PATCH 1372/1507] Update wayland.xml to version 1.23.0 This updates only the protocol definition, implementations will need additional commits to opt into using them. Change-Id: I5999e6dd75dfff7d904981fb1545d58c8b38ceb0 Reviewed-by: David Edmundson --- src/3rdparty/wayland/protocols/wayland.xml | 215 +++++++++++++++------ 1 file changed, 156 insertions(+), 59 deletions(-) diff --git a/src/3rdparty/wayland/protocols/wayland.xml b/src/3rdparty/wayland/protocols/wayland.xml index 10e039d6ecc..9418c62f3f6 100644 --- a/src/3rdparty/wayland/protocols/wayland.xml +++ b/src/3rdparty/wayland/protocols/wayland.xml @@ -46,7 +46,7 @@ compositor after the callback is fired and as such the client must not attempt to use it after that point. - The callback_data passed in the callback is the event serial. + The callback_data passed in the callback is undefined and should be ignored. @@ -212,7 +212,7 @@ - + The wl_shm_pool object encapsulates a piece of memory shared between the compositor and client. Through the wl_shm_pool @@ -262,17 +262,17 @@ created, but using the new size. This request can only be used to make the pool bigger. - This request only changes the amount of bytes that are mmapped - by the server and does not touch the file corresponding to the - file descriptor passed at creation time. It is the client's - responsibility to ensure that the file is at least as big as - the new pool size. + This request only changes the amount of bytes that are mmapped + by the server and does not touch the file corresponding to the + file descriptor passed at creation time. It is the client's + responsibility to ensure that the file is at least as big as + the new pool size. - + A singleton global object that provides support for shared memory. @@ -419,6 +419,21 @@ + + + + + + + + + + + + + + + @@ -442,6 +457,17 @@ + + + + + + Using this request a client can tell the server that it is not going to + use the shm object anymore. + + Objects created via this interface remain unaffected. + + @@ -453,9 +479,11 @@ client provides and updates the contents is defined by the buffer factory interface. - If the buffer uses a format that has an alpha channel, the alpha channel - is assumed to be premultiplied in the color channels unless otherwise - specified. + Color channels are assumed to be electrical rather than optical (in other + words, encoded with a transfer function) unless otherwise specified. If + the buffer uses a format that has an alpha channel, the alpha channel is + assumed to be premultiplied into the electrical color channel values + (after transfer function encoding) unless otherwise specified. Note, because wl_buffer objects are created from multiple independent factory interfaces, the wl_buffer interface is frozen at version 1. @@ -847,6 +875,7 @@ + @@ -868,7 +897,7 @@ The icon surface is an optional (can be NULL) surface that provides an icon to be moved around with the cursor. Initially, the top-left corner of the icon surface is placed at the cursor - hotspot, but subsequent wl_surface.attach request can move the + hotspot, but subsequent wl_surface.offset requests can move the relative position. Attach requests must be confirmed with wl_surface.commit as usual. The icon surface is given the role of a drag-and-drop icon. If the icon surface already has another role, @@ -876,6 +905,10 @@ The input region is ignored for wl_surfaces with the role of a drag-and-drop icon. + + The given source may not be used in any further set_selection or + start_drag requests. Attempting to reuse a previously-used source + may send a used_source error. @@ -889,6 +922,10 @@ to the data from the source on behalf of the client. To unset the selection, set the source to NULL. + + The given source may not be used in any further set_selection or + start_drag requests. Attempting to reuse a previously-used source + may send a used_source error. @@ -1411,7 +1448,7 @@ + summary="surface was destroyed before its role object"/> @@ -1440,9 +1477,9 @@ When the bound wl_surface version is 5 or higher, passing any non-zero x or y is a protocol violation, and will result in an - 'invalid_offset' error being raised. The x and y arguments are ignored - and do not change the pending state. To achieve equivalent semantics, - use wl_surface.offset. + 'invalid_offset' error being raised. The x and y arguments are ignored + and do not change the pending state. To achieve equivalent semantics, + use wl_surface.offset. Surface contents are double-buffered state, see wl_surface.commit. @@ -1479,6 +1516,13 @@ If wl_surface.attach is sent with a NULL wl_buffer, the following wl_surface.commit will remove the surface content. + + If a pending wl_buffer has been destroyed, the result is not specified. + Many compositors are known to remove the surface content on the following + wl_surface.commit, but this behaviour is not universal. Clients seeking to + maximise compatibility should not destroy pending buffers and should + ensure that they explicitly remove content from surfaces, even after + destroying buffers. @@ -1618,16 +1662,18 @@ Surface state (input, opaque, and damage regions, attached buffers, etc.) is double-buffered. Protocol requests modify the pending state, - as opposed to the current state in use by the compositor. A commit - request atomically applies all pending state, replacing the current - state. After commit, the new pending state is as documented for each - related request. + as opposed to the active state in use by the compositor. - On commit, a pending wl_buffer is applied first, and all other state - second. This means that all coordinates in double-buffered state are - relative to the new wl_buffer coming into use, except for - wl_surface.attach itself. If there is no pending wl_buffer, the - coordinates are relative to the current surface contents. + A commit request atomically creates a content update from the pending + state, even if the pending state has not been touched. The content + update is placed in a queue until it becomes active. After commit, the + new pending state is as documented for each related request. + + When the content update is applied, the wl_buffer is applied before all + other state. This means that all coordinates in double-buffered state + are relative to the newly attached wl_buffers, except for + wl_surface.attach itself. If there is no newly attached wl_buffer, the + coordinates are relative to the previous content update. All requests that need a commit to become effective are documented to affect double-buffered state. @@ -1666,10 +1712,12 @@ - This request sets an optional transformation on how the compositor - interprets the contents of the buffer attached to the surface. The - accepted values for the transform parameter are the values for - wl_output.transform. + This request sets the transformation that the client has already applied + to the content of the buffer. The accepted values for the transform + parameter are the values for wl_output.transform. + + The compositor applies the inverse of this transformation whenever it + uses the buffer contents. Buffer transform is double-buffered state, see wl_surface.commit. @@ -1725,11 +1773,11 @@ a buffer that is larger (by a factor of scale in each dimension) than the desired surface size. - If scale is not positive the invalid_scale protocol error is + If scale is not greater than 0 the invalid_scale protocol error is raised. + summary="scale for interpreting buffer contents"/> @@ -1802,10 +1850,15 @@ This event indicates the preferred buffer scale for this surface. It is sent whenever the compositor's preference changes. + Before receiving this event the preferred buffer scale for this surface + is 1. + It is intended that scaling aware clients use this event to scale their content and use wl_surface.set_buffer_scale to indicate the scale they have rendered with. This allows clients to supply a higher detail buffer. + + The compositor shall emit a scale value greater than 0. @@ -1815,9 +1868,12 @@ This event indicates the preferred buffer transform for this surface. It is sent whenever the compositor's preference changes. - It is intended that transform aware clients use this event to apply the - transform to their content and use wl_surface.set_buffer_transform to - indicate the transform they have rendered with. + Before receiving this event the preferred buffer transform for this + surface is normal. + + Applying this transformation to the surface buffer contents and using + wl_surface.set_buffer_transform might allow the compositor to use the + surface buffer more efficiently. @@ -1992,9 +2048,9 @@ where (x, y) are the coordinates of the pointer location, in surface-local coordinates. - On surface.attach requests to the pointer surface, hotspot_x + On wl_surface.offset requests to the pointer surface, hotspot_x and hotspot_y are decremented by the x and y parameters - passed to the request. Attach must be confirmed by + passed to the request. The offset must be applied by wl_surface.commit as usual. The hotspot can also be updated by passing the currently set @@ -2248,7 +2304,7 @@ - + Discrete step information for scroll and other axes. @@ -2374,6 +2430,16 @@ The wl_keyboard interface represents one or more keyboards associated with a seat. + + Each wl_keyboard has the following logical state: + + - an active surface (possibly null), + - the keys currently logically down, + - the active modifiers, + - the active group. + + By default, the active surface is null, the keys currently logically down + are empty, the active modifiers and the active group are 0. @@ -2408,10 +2474,15 @@ The compositor must send the wl_keyboard.modifiers event after this event. + + In the wl_keyboard logical state, this event sets the active surface to + the surface argument and the keys currently logically down to the keys + in the keys argument. The compositor must not send this event if the + wl_keyboard already had an active surface immediately before this event. - + @@ -2422,8 +2493,10 @@ The leave notification is sent before the enter notification for the new focus. - After this event client must assume that all keys, including modifiers, - are lifted and also it must stop key repeating if there's some going on. + In the wl_keyboard logical state, this event resets all values to their + defaults. The compositor must not send this event if the active surface + of the wl_keyboard was not equal to the surface argument immediately + before this event. @@ -2448,6 +2521,15 @@ If this event produces a change in modifiers, then the resulting wl_keyboard.modifiers event must be sent after this event. + + In the wl_keyboard logical state, this event adds the key to the keys + currently logically down (if the state argument is pressed) or removes + the key from the keys currently logically down (if the state argument is + released). The compositor must not send this event if the wl_keyboard + did not have an active surface immediately before this event. The + compositor must not send this event if state is pressed (resp. released) + and the key was already logically down (resp. was not logically down) + immediately before this event. @@ -2459,6 +2541,17 @@ Notifies clients that the modifier and/or group state has changed, and it should update its local state. + + The compositor may send this event without a surface of the client + having keyboard focus, for example to tie modifier information to + pointer focus instead. If a modifier event with pressed modifiers is sent + without a prior enter event, the client can assume the modifier state is + valid until it receives the next wl_keyboard.modifiers event. In order to + reset the modifier state again, the compositor can send a + wl_keyboard.modifiers event with no pressed modifiers. + + In the wl_keyboard logical state, this event updates the modifiers and + group. @@ -2566,6 +2659,8 @@ currently active on this client's surface. The client is responsible for finalizing the touch points, future touch points on this surface may reuse the touch point ID. + + No frame event is required after the cancel event. @@ -2665,10 +2760,9 @@ - - This describes the transform that a compositor will apply to a - surface to compensate for the rotation or mirroring of an - output device. + + This describes transformations that clients and compositors apply to + buffer contents. The flipped values correspond to an initial flip around a vertical axis followed by rotation. @@ -2700,6 +2794,10 @@ The geometry event will be followed by a done event (starting from version 2). + Clients should use wl_surface.preferred_buffer_transform instead of the + transform advertised by this event to find the preferred buffer + transform to use for a surface. + Note: wl_output only advertises partial information about the output position and identification. Some compositors, for instance those not implementing a desktop-style output layout or those exposing virtual @@ -2722,7 +2820,7 @@ + summary="additional transformation applied to buffer contents during presentation"/> @@ -2795,8 +2893,9 @@ This event contains scaling geometry information that is not in the geometry event. It may be sent after binding the output object or if the output scale changes - later. If it is not sent, the client should assume a - scale of 1. + later. The compositor will emit a non-zero, positive + value for scale. If it is not sent, the client should + assume a scale of 1. A scale larger than 1 means that the compositor will automatically scale surface buffers by this amount @@ -2804,12 +2903,9 @@ displays where applications rendering at the native resolution would be too small to be legible. - It is intended that scaling aware clients track the - current output of a surface, and if it is on a scaled - output it should use wl_surface.set_buffer_scale with - the scale of the output. That way the compositor can - avoid scaling the surface, and the client can supply - a higher detail image. + Clients should use wl_surface.preferred_buffer_scale + instead of this event to find the preferred buffer + scale to use for a surface. The scale event will be followed by a done event. @@ -3035,6 +3131,11 @@ If the parent wl_surface object is destroyed, the sub-surface is unmapped. + + A sub-surface never has the keyboard focus of any seat. + + The wl_surface.offset request is ignored: clients must use set_position + instead to move the sub-surface. @@ -3060,9 +3161,7 @@ surface area. Negative values are allowed. The scheduled coordinates will take effect whenever the state of the - parent surface is applied. When this happens depends on whether the - parent surface is in synchronized mode or not. See - wl_subsurface.set_sync and wl_subsurface.set_desync for details. + parent surface is applied. If more than one set_position request is invoked by the client before the commit of the parent surface, the position of a new request always @@ -3085,9 +3184,7 @@ The z-order is double-buffered. Requests are handled in order and applied immediately to a pending state. The final pending state is copied to the active state the next time the state of the parent - surface is applied. When this happens depends on whether the parent - surface is in synchronized mode or not. See wl_subsurface.set_sync and - wl_subsurface.set_desync for details. + surface is applied. A new sub-surface is initially added as the top-most in the stack of its siblings and parent. From 7c4bbcfbf4d6498eab4ffb3d6d3053b807940ceb Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Thu, 11 Jul 2024 18:48:03 +0200 Subject: [PATCH 1373/1507] CMake: doc: Move 'since qt version' below find_package To be in line with other command documentation. Pick-to: 6.8 Task-number: QTBUG-126471 Change-Id: I1cf1078e8c4cd5dd27881294986457c63aa6c956 Reviewed-by: Alexey Edelev --- .../cmake/qt_generate_wayland_protocol_client_sources.qdoc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/wayland/doc/src/cmake/qt_generate_wayland_protocol_client_sources.qdoc b/src/plugins/platforms/wayland/doc/src/cmake/qt_generate_wayland_protocol_client_sources.qdoc index 0abd14d4e0f..d62a5a2b161 100644 --- a/src/plugins/platforms/wayland/doc/src/cmake/qt_generate_wayland_protocol_client_sources.qdoc +++ b/src/plugins/platforms/wayland/doc/src/cmake/qt_generate_wayland_protocol_client_sources.qdoc @@ -10,8 +10,6 @@ \summary {Generates client-side C++ bindings for a Wayland protocol .XML file} -\cmakecommandsince 6.0 - The command is defined in the \c WaylandClient component of the \c Qt6 package, which can be loaded like so: @@ -19,6 +17,8 @@ can be loaded like so: find_package(Qt6 REQUIRED COMPONENTS WaylandClient) \endcode +\cmakecommandsince 6.0 + \section1 Synopsis \badcode From fd42445f06aff1753db37177a1f4e0b690984d94 Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Mon, 17 Jun 2024 16:33:58 +0200 Subject: [PATCH 1374/1507] CMake: Move each wayland protocol into a separate subdirectory MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit So that there is one qt_attribution.json file for each protocol, rather than a single file with a long list. This will simplify maintenance of annotating the targets for SBOM generation when referring to the attribution files, and in general simplifies maintenance of the attribution files. It also makes it clearer if a 3rdparty protocol is missing an attribution file. Currently, the following protocols are missing attribution files: - cursor-shape - idle-inhibit - xdg-toplevel-drag And the following are unused: - xdg-shell-unstable-v6 [ChangeLog][Third-Party Code] Split the single qtwayland 3rd party qt_attribution.json file into multiple ones, per protocol, to ease maintenance. Pick-to: 6.8 Task-number: QTBUG-122899 Change-Id: I412df7f53715f55270280ab91f16a6d40f12a4f0 Reviewed-by: Kai Köhne --- .../{ => cursor-shape}/cursor-shape-v1.xml | 0 .../fractional-scale-v1.xml | 0 .../fractional-scale/qt_attribution.json | 18 + .../fullscreen-shell-unstable-v1.xml | 0 .../fullscreen-shell/qt_attribution.json | 18 + .../idle-inhibit-unstable-v1.xml | 0 .../wayland/protocols/ivi-application.xml | 100 --- .../wayland/protocols/ivi-controller.xml | 603 ------------------ .../linux-dmabuf-unstable-v1.xml | 0 .../linux-dmabuf/qt_attribution.json | 18 + .../pointer-gestures-unstable-v1.xml | 0 .../pointer-gestures/qt_attribution.json | 18 + .../presentation-time.xml | 0 .../presentation-time/qt_attribution.json | 18 + .../wayland/protocols/qt_attribution.json | 357 ----------- .../protocols/scaler/qt_attribution.json | 18 + .../wayland/protocols/{ => scaler}/scaler.xml | 0 .../protocols/tablet/qt_attribution.json | 18 + .../{ => tablet}/tablet-unstable-v2.xml | 0 .../text-input/v1/qt_attribution.json | 18 + .../v1}/text-input-unstable-v1.xml | 0 .../{ => text-input/v2}/HPND_LICENSE.txt | 0 .../text-input/v2/qt_attribution.json | 17 + .../v2}/text-input-unstable-v2.xml | 0 .../text-input/v3/qt_attribution.json | 17 + .../v3}/text-input-unstable-v3.xml | 0 .../protocols/viewporter/qt_attribution.json | 18 + .../protocols/{ => viewporter}/viewporter.xml | 0 .../wayland/protocols/{ => wayland}/README | 0 .../protocols/wayland/qt_attribution.json | 18 + .../protocols/{ => wayland}/wayland.xml | 0 .../wl-eglstream/qt_attribution.json | 18 + .../wl-eglstream-controller.xml | 0 .../wp-primary-selection/qt_attribution.json | 18 + .../wp-primary-selection-unstable-v1.xml | 0 .../xdg-activation/qt_attribution.json | 19 + .../xdg-activation-v1.xml | 0 .../xdg-decoration/qt_attribution.json | 18 + .../xdg-decoration-unstable-v1.xml | 0 .../protocols/xdg-dialog/qt_attribution.json | 18 + .../{ => xdg-dialog}/xdg-dialog-v1.xml | 0 .../protocols/xdg-foreign/qt_attribution.json | 18 + .../xdg-foreign-unstable-v2.xml | 0 .../protocols/xdg-output/qt_attribution.json | 18 + .../xdg-output-unstable-v1.xml | 0 .../protocols/xdg-shell/qt_attribution.json | 18 + .../{ => xdg-shell}/xdg-shell-unstable-v6.xml | 0 .../protocols/{ => xdg-shell}/xdg-shell.xml | 0 .../xdg-toplevel-drag-v1.xml | 0 src/plugins/platforms/wayland/CMakeLists.txt | 26 +- .../fullscreen-shell-v1/CMakeLists.txt | 2 +- .../shellintegration/wl-shell/CMakeLists.txt | 2 +- .../shellintegration/xdg-shell/CMakeLists.txt | 10 +- tests/auto/wayland/shared/CMakeLists.txt | 26 +- tests/auto/wayland/shared/shared.pri | 8 +- 55 files changed, 396 insertions(+), 1097 deletions(-) rename src/3rdparty/wayland/protocols/{ => cursor-shape}/cursor-shape-v1.xml (100%) rename src/3rdparty/wayland/protocols/{ => fractional-scale}/fractional-scale-v1.xml (100%) create mode 100644 src/3rdparty/wayland/protocols/fractional-scale/qt_attribution.json rename src/3rdparty/wayland/protocols/{ => fullscreen-shell}/fullscreen-shell-unstable-v1.xml (100%) create mode 100644 src/3rdparty/wayland/protocols/fullscreen-shell/qt_attribution.json rename src/3rdparty/wayland/protocols/{ => idle-inhibit}/idle-inhibit-unstable-v1.xml (100%) delete mode 100644 src/3rdparty/wayland/protocols/ivi-application.xml delete mode 100644 src/3rdparty/wayland/protocols/ivi-controller.xml rename src/3rdparty/wayland/protocols/{ => linux-dmabuf}/linux-dmabuf-unstable-v1.xml (100%) create mode 100644 src/3rdparty/wayland/protocols/linux-dmabuf/qt_attribution.json rename src/3rdparty/wayland/protocols/{ => pointer-gestures}/pointer-gestures-unstable-v1.xml (100%) create mode 100644 src/3rdparty/wayland/protocols/pointer-gestures/qt_attribution.json rename src/3rdparty/wayland/protocols/{ => presentation-time}/presentation-time.xml (100%) create mode 100644 src/3rdparty/wayland/protocols/presentation-time/qt_attribution.json delete mode 100644 src/3rdparty/wayland/protocols/qt_attribution.json create mode 100644 src/3rdparty/wayland/protocols/scaler/qt_attribution.json rename src/3rdparty/wayland/protocols/{ => scaler}/scaler.xml (100%) create mode 100644 src/3rdparty/wayland/protocols/tablet/qt_attribution.json rename src/3rdparty/wayland/protocols/{ => tablet}/tablet-unstable-v2.xml (100%) create mode 100644 src/3rdparty/wayland/protocols/text-input/v1/qt_attribution.json rename src/3rdparty/wayland/protocols/{ => text-input/v1}/text-input-unstable-v1.xml (100%) rename src/3rdparty/wayland/protocols/{ => text-input/v2}/HPND_LICENSE.txt (100%) create mode 100644 src/3rdparty/wayland/protocols/text-input/v2/qt_attribution.json rename src/3rdparty/wayland/protocols/{ => text-input/v2}/text-input-unstable-v2.xml (100%) create mode 100644 src/3rdparty/wayland/protocols/text-input/v3/qt_attribution.json rename src/3rdparty/wayland/protocols/{ => text-input/v3}/text-input-unstable-v3.xml (100%) create mode 100644 src/3rdparty/wayland/protocols/viewporter/qt_attribution.json rename src/3rdparty/wayland/protocols/{ => viewporter}/viewporter.xml (100%) rename src/3rdparty/wayland/protocols/{ => wayland}/README (100%) create mode 100644 src/3rdparty/wayland/protocols/wayland/qt_attribution.json rename src/3rdparty/wayland/protocols/{ => wayland}/wayland.xml (100%) create mode 100644 src/3rdparty/wayland/protocols/wl-eglstream/qt_attribution.json rename src/3rdparty/wayland/protocols/{ => wl-eglstream}/wl-eglstream-controller.xml (100%) create mode 100644 src/3rdparty/wayland/protocols/wp-primary-selection/qt_attribution.json rename src/3rdparty/wayland/protocols/{ => wp-primary-selection}/wp-primary-selection-unstable-v1.xml (100%) create mode 100644 src/3rdparty/wayland/protocols/xdg-activation/qt_attribution.json rename src/3rdparty/wayland/protocols/{ => xdg-activation}/xdg-activation-v1.xml (100%) create mode 100644 src/3rdparty/wayland/protocols/xdg-decoration/qt_attribution.json rename src/3rdparty/wayland/protocols/{ => xdg-decoration}/xdg-decoration-unstable-v1.xml (100%) create mode 100644 src/3rdparty/wayland/protocols/xdg-dialog/qt_attribution.json rename src/3rdparty/wayland/protocols/{ => xdg-dialog}/xdg-dialog-v1.xml (100%) create mode 100644 src/3rdparty/wayland/protocols/xdg-foreign/qt_attribution.json rename src/3rdparty/wayland/protocols/{ => xdg-foreign}/xdg-foreign-unstable-v2.xml (100%) create mode 100644 src/3rdparty/wayland/protocols/xdg-output/qt_attribution.json rename src/3rdparty/wayland/protocols/{ => xdg-output}/xdg-output-unstable-v1.xml (100%) create mode 100644 src/3rdparty/wayland/protocols/xdg-shell/qt_attribution.json rename src/3rdparty/wayland/protocols/{ => xdg-shell}/xdg-shell-unstable-v6.xml (100%) rename src/3rdparty/wayland/protocols/{ => xdg-shell}/xdg-shell.xml (100%) rename src/3rdparty/wayland/protocols/{ => xdg-toplevel-drag}/xdg-toplevel-drag-v1.xml (100%) diff --git a/src/3rdparty/wayland/protocols/cursor-shape-v1.xml b/src/3rdparty/wayland/protocols/cursor-shape/cursor-shape-v1.xml similarity index 100% rename from src/3rdparty/wayland/protocols/cursor-shape-v1.xml rename to src/3rdparty/wayland/protocols/cursor-shape/cursor-shape-v1.xml diff --git a/src/3rdparty/wayland/protocols/fractional-scale-v1.xml b/src/3rdparty/wayland/protocols/fractional-scale/fractional-scale-v1.xml similarity index 100% rename from src/3rdparty/wayland/protocols/fractional-scale-v1.xml rename to src/3rdparty/wayland/protocols/fractional-scale/fractional-scale-v1.xml diff --git a/src/3rdparty/wayland/protocols/fractional-scale/qt_attribution.json b/src/3rdparty/wayland/protocols/fractional-scale/qt_attribution.json new file mode 100644 index 00000000000..653a8eb0c15 --- /dev/null +++ b/src/3rdparty/wayland/protocols/fractional-scale/qt_attribution.json @@ -0,0 +1,18 @@ +[ + { + "Id": "fractional-scale-v1", + "Name": "Wayland Fractional Scale Protocol", + "QDocModule": "qtwaylandcompositor", + "QtUsage": "Used in the Qt Wayland platform plugin", + "Files": "fractional-scale-v1.xml", + + "Description": "Send a preferred scale to different clients", + "Homepage": "https://wayland.freedesktop.org", + "Version": "1", + "DownloadLocation": "https://gitlab.freedesktop.org/wayland/wayland-protocols/-/raw/1.31/unstable/fractional-scale/fractional-scale-v1.xml", + "LicenseId": "MIT", + "License": "MIT License", + "LicenseFile": "../MIT_LICENSE.txt", + "Copyright": "Copyright © 2022 Kenny Levinsen" + } +] diff --git a/src/3rdparty/wayland/protocols/fullscreen-shell-unstable-v1.xml b/src/3rdparty/wayland/protocols/fullscreen-shell/fullscreen-shell-unstable-v1.xml similarity index 100% rename from src/3rdparty/wayland/protocols/fullscreen-shell-unstable-v1.xml rename to src/3rdparty/wayland/protocols/fullscreen-shell/fullscreen-shell-unstable-v1.xml diff --git a/src/3rdparty/wayland/protocols/fullscreen-shell/qt_attribution.json b/src/3rdparty/wayland/protocols/fullscreen-shell/qt_attribution.json new file mode 100644 index 00000000000..07926f16429 --- /dev/null +++ b/src/3rdparty/wayland/protocols/fullscreen-shell/qt_attribution.json @@ -0,0 +1,18 @@ +[ + { + "Id": "wayland-fullscreen-protocol", + "Name": "Wayland Fullscreen Shell Protocol", + "QDocModule": "qtwaylandcompositor", + "QtUsage": "Used in the Qt Wayland platform plugin.", + "Files": "fullscreen-shell-unstable-v1.xml", + + "Description": "A Wayland shell for displaying a single surface per output", + "Homepage": "https://wayland.freedesktop.org", + "Version": "unstable v1", + "DownloadLocation": "https://gitlab.freedesktop.org/wayland/wayland-protocols/raw/1.18/unstable/fullscreen-shell/fullscreen-shell-unstable-v1.xml", + "LicenseId": "MIT", + "License": "MIT License", + "LicenseFile": "../MIT_LICENSE.txt", + "Copyright": "Copyright © 2016 Yong Bakos\nCopyright © 2015 Jason Ekstrand\nCopyright © 2015 Jonas Ådahl" + } +] diff --git a/src/3rdparty/wayland/protocols/idle-inhibit-unstable-v1.xml b/src/3rdparty/wayland/protocols/idle-inhibit/idle-inhibit-unstable-v1.xml similarity index 100% rename from src/3rdparty/wayland/protocols/idle-inhibit-unstable-v1.xml rename to src/3rdparty/wayland/protocols/idle-inhibit/idle-inhibit-unstable-v1.xml diff --git a/src/3rdparty/wayland/protocols/ivi-application.xml b/src/3rdparty/wayland/protocols/ivi-application.xml deleted file mode 100644 index 8f242268849..00000000000 --- a/src/3rdparty/wayland/protocols/ivi-application.xml +++ /dev/null @@ -1,100 +0,0 @@ - - - - - Copyright (C) 2013 DENSO CORPORATION - Copyright (c) 2013 BMW Car IT 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. - - - - - - - - This removes link from ivi_id to wl_surface and destroys ivi_surface. - The ID, ivi_id, is free and can be used for surface_create again. - - - - - - The configure event asks the client to resize its surface. - - The size is a hint, in the sense that the client is free to - ignore it if it doesn't resize, pick a smaller size (to - satisfy aspect ratio or resize in steps of NxM pixels). - - The client is free to dismiss all but the last configure - event it received. - - The width and height arguments specify the size of the window - in surface local coordinates. - - - - - - - - - This interface is exposed as a global singleton. - This interface is implemented by servers that provide IVI-style user interfaces. - It allows clients to associate a ivi_surface with wl_surface. - - - - - - - - - - This request gives the wl_surface the role of an IVI Surface. Creating more than - one ivi_surface for a wl_surface is not allowed. Note, that this still allows the - following example: - - 1. create a wl_surface - 2. create ivi_surface for the wl_surface - 3. destroy the ivi_surface - 4. create ivi_surface for the wl_surface (with the same or another ivi_id as before) - - surface_create will create a interface:ivi_surface with numeric ID; ivi_id in - ivi compositor. These ivi_ids are defined as unique in the system to identify - it inside of ivi compositor. The ivi compositor implements business logic how to - set properties of the surface with ivi_id according to status of the system. - E.g. a unique ID for Car Navigation application is used for implementing special - logic of the application about where it shall be located. - The server regards following cases as protocol errors and disconnects the client. - - wl_surface already has an nother role. - - ivi_id is already assigned to an another wl_surface. - - If client destroys ivi_surface or wl_surface which is assigne to the ivi_surface, - ivi_id which is assigned to the ivi_surface is free for reuse. - - - - - - - - - diff --git a/src/3rdparty/wayland/protocols/ivi-controller.xml b/src/3rdparty/wayland/protocols/ivi-controller.xml deleted file mode 100644 index 521d62525a8..00000000000 --- a/src/3rdparty/wayland/protocols/ivi-controller.xml +++ /dev/null @@ -1,603 +0,0 @@ - - - - - Copyright (C) 2013 DENSO CORPORATION - Copyright (c) 2013 BMW Car IT 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 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. - - - - - - - - If visibility argument is 0, the surface in the ivi compositor is set to invisible. - If visibility argument is not 0, the surface in the ivi compositor is set to visible. - - - - - - - The valid range for opacity is 0.0 (fully transparent) to 1.0 (fully opaque). - - - - - - - The source rectangle defines the part of the surface content, that is used for - compositing the surface. It can be used, if valid content of the surface is smaller - than the surface. Effectively it can be used to zoom the content of the surface. - x: horizontal start position of scanout area within the surface - y: vertical start position of scanout area within the surface - width: width of scanout area within the surface - height: height of scanout area within the surface - - - - - - - - - - The destination rectangle defines the position and size of a surface on a layer. - The surface will be scaled to this rectangle for rendering. - x: horizontal start position of surface within the layer - y: vertical start position of surface within the layer - width : width of surface within the layer - height: height of surface within the layer - - - - - - - - - - Request the client providing content for this surface, to resize of the buffers - provided as surface content. - - - - - - - - The orientation of a surface in ivi compositor can be rotated in 90 degree steps, - as defined in orientation enum. - - - - - - - Store a screenshot of the surface content in the file provided by argument filename. - - - - - - - The new visibility state is provided in argument visibility. - If visibility is 0, the surface has become invisible. - If visibility is not 0, the surface has become visible. - - - - - - - The new opacity state is provided in argument opacity. - The valid range for opactiy is 0.0 (fully transparent) to 1.0 (fully opaque). - - - - - - - The scanout region of the surface content has changed. - The new values for source rectangle are provided by - x: new horizontal start position of scanout area within the surface - y: new vertical start position of scanout area within the surface - width: new width of scanout area within the surface - height: new height of scanout area within the surface - - - - - - - - - - The new values for source rectangle are provided by - x: new horizontal start position of surface within the layer - y: new vertical start position of surface within the layer - width : new width of surface within the layer - height: new height of surface within the layer - - - - - - - - - - The client providing content for this surface was requested to resize the buffer - provided as surface content. The requested buffer size is provided by arguments - width and height. - - - - - - - - The surfaces in ivi controller can be rotated in 90 degrees steps. - This enum defines all valid orientations for surfaces. - - - - - - - - - - The new orientation status is provided by argument orientation. - - - - - - - Applications can provide buffers as surface content with differernt buffer - properties. This enum defines all supported buffer configurations. - - - - - - - - - - - - - - When client attach buffers as surface content, these buffers have a pixelformat - configuration. If the pixelformat of a newly attached buffer is different from - the previous buffer configuration, this event is raised. - This is also done, when the first buffer is provided by application. - - - - - - - This surface was added to the render order of the layer defined by argument layer. - This is essential for a surface to become visible on screen, since ivi compositors - will only render layers (or more precise all surfaces in the render order of a layer). - - - - - - - These stats contain information required for monitoring, debugging, logging - and tracing. - - - - - - The information contained in this event is essential for monitoring, debugging, - logging and tracing support in IVI systems. - - - - - - - - - - - Request to destroy the ivi_controller_surface. If argument - destroy_scene_object id not 0, the surface will be destroyed in - ivi compositor. If argument is 0, only the proxy object is destroyed. - - - - - - - - - - - This enum defines all possible content states of a surface. This is - required, since surfaces in ivi compositor can exist without applications - providing content for them. - - - - - - - - Surfaces in ivi compositor can exist without any application or controller - referencing it. All surfaces initially have no content. This event indicates - when content state has changed. All possible content states are defined - in enum content_state. - - - - - - - - - - - - If visibility argument is 0, the layer in the ivi compositor is set to invisible. - If visibility argument is not 0, the layer in the ivi compositor is set to visible. - - - - - - - The valid range for opacity is 0.0 (fully transparent) to 1.0 (fully opaque). - - - - - - - The source rectangle defines the part of the layer content, that is used for - compositing the screen. It can be used, if valid content of the layer is smaller - than the layer. Effectively it can be used to zoom the content of the layer. - x: horizontal start position of scanout area within the layer - y: vertical start position of scanout area within the layer - width: width of scanout area within the layer - height: height of scanout area within the layer - - - - - - - - - - The destination rectangle defines the position and size of a layer on a screen. - The layer will be scaled to this rectangle for rendering. - x: horizontal start position of layer within the screen - y: vertical start position of layer within the screen - width : width of surface within the screen - height: height of surface within the screen - - - - - - - - - - Layers are created with an initial size, but they can be resized at runtime. - This request changes the widht and height of a layer. - - - - - - - - The orientation of a layer in ivi compositor can be rotated in 90 degree steps, - as defined in orientation enum. - - - - - - - Store a screenshot of the layer content in the file provided by argument filename. - - - - - - - A layer has no content assigned to itself, it is a container for surfaces. - This request removes all surfaces from the layer render order. - Note: the surfaces are not destroyed, they are just no longer contained by - the layer. - - - - - - A layer has no content assigned to itself, it is a container for surfaces. - This request adds a surface to the topmost position of the layer render order. - The added surface will cover all other surfaces of the layer. - - - - - - - A layer has no content assigned to itself, it is a container for surfaces. - This request removes one surfaces from the layer render order. - Note: the surface is not destroyed, it is just no longer contained by - the layer. - - - - - - - A layer has no content assigned to itself, it is a container for surfaces. - This request removes all surfaces from the layer render order and set a - completely new render order. - - - - - - - The new visibility state is provided in argument visibility. - If visibility is 0, the layer has become invisible. - If visibility is not 0, the layer has become visible. - - - - - - - The new opacity state is provided in argument opacity. - The valid range for opactiy is 0.0 (fully transparent) to 1.0 (fully opaque). - - - - - - - The scanout region of the layer content has changed. - The new values for source rectangle are provided by - x: new horizontal start position of scanout area within the layer - y: new vertical start position of scanout area within the layer - width: new width of scanout area within the layer - height: new height of scanout area within the layer - - - - - - - - - - The new values for source rectangle are provided by - x: new horizontal start position of layer within the screen - y: new vertical start position of layer within the screen - width : new width of layer within the screen - height: new height of layer within the screen - - - - - - - - - - The layer was resized. The new layer size is provided by arguments - width and height. - - - - - - - - The new orientation status is provided by argument orientation. - - - - - - - This layer was added to the render order of the screen defined by argument screen. - This is essential for a layer to become visible on screen, since ivi compositors - will only render screens (or more precise all layers in the render order of a screen). - - - - - - - Request to destroy the ivi_controller_layer. If argument - destroy_scene_object id not 0, the layer will be destroyed in - ivi compositor. If argument is 0, only the proxy object is destroyed. - - - - - - - - - - - - - - - - - - - - A screen has no content assigned to itself, it is a container for layers. - This request removes all layers from the screen render order. - Note: the layers are not destroyed, they are just no longer contained by - the screen. - - - - - - A screen has no content assigned to itself, it is a container for layers. - This request adds a layers to the topmost position of the screen render order. - The added layer will cover all other layers of the screen. - - - - - - - Store a screenshot of the screen content in the file provided by argument filename. - - - - - - - A screen has no content assigned to itself, it is a container for layers. - This request removes all layers from the screen render order and set a - completely new render order. - - - - - - - - - - - - All requests are not applied directly to scene object, so a controller - can set different properties and apply the changes all at once. - Note: there's an exception to this. Creation and destruction of - scene objects is executed immediately. - - - - - - A new screen is announced to the controller. This is typically - the case in two cases: - 1. controller was just started, ivi compositor announces existing screen - 2. a new screen was added to the system at runtime - - - - - - - - layer_create will create a new layer with id_layer in ivi compositor, - if it does not yet exists. If the layer with id_layer already exists in - ivi compositor, a handle to the existing layer is returned and width and - height properties are ignored. - - - - - - - - - - A new layer is announced to the controller. - - - - - - - surface_create will create a new surface with id_surface in ivi compositor, - if it does not yet exists. If the surface with id_surface already exists in - ivi compositor, a handle to the existing surface is returned. - - - - - - - - A new surface is announced to the controller. - - - - - - - This enum defines all scene object available in ivi compositor. - - - - - - - - - These error codes define all possible error codes returned by ivi compositor - on server-side errors. - - - - - - - - The ivi compositor encountered error while processing a request by this - controller. The error is defined by argument error_code and optional - error_text. Additionally the object type and id is contained in the error - event to provide some detailes to handle the error. - If the controller requires to associate this error event to a request, - it can - 1. send request - 2. force display roundtrip - 3. check, if error event was received - but this restricts the controller to have only one open request at a time. - - - - - - - - - - - diff --git a/src/3rdparty/wayland/protocols/linux-dmabuf-unstable-v1.xml b/src/3rdparty/wayland/protocols/linux-dmabuf/linux-dmabuf-unstable-v1.xml similarity index 100% rename from src/3rdparty/wayland/protocols/linux-dmabuf-unstable-v1.xml rename to src/3rdparty/wayland/protocols/linux-dmabuf/linux-dmabuf-unstable-v1.xml diff --git a/src/3rdparty/wayland/protocols/linux-dmabuf/qt_attribution.json b/src/3rdparty/wayland/protocols/linux-dmabuf/qt_attribution.json new file mode 100644 index 00000000000..e93e2e790b1 --- /dev/null +++ b/src/3rdparty/wayland/protocols/linux-dmabuf/qt_attribution.json @@ -0,0 +1,18 @@ +[ + { + "Id": "wayland-linux-dmabuf-unstable-v1", + "Name": "Wayland Linux Dmabuf Unstable V1 Protocol", + "QDocModule": "qtwaylandcompositor", + "QtUsage": "Used in the Qt Wayland Compositor", + "Files": "linux-dmabuf-unstable-v1.xml", + + "Description": "The linux dmabuf protocol is a way to create dmabuf-based wl_buffers", + "Homepage": "https://wayland.freedesktop.org", + "Version": "unstable v1, version 3", + "DownloadLocation": "https://gitlab.freedesktop.org/wayland/wayland-protocols/raw/1.18/unstable/linux-dmabuf/linux-dmabuf-unstable-v1.xml", + "LicenseId": "MIT", + "License": "MIT License", + "LicenseFile": "../MIT_LICENSE.txt", + "Copyright": "Copyright © 2014, 2015 Collabora, Ltd." + } +] diff --git a/src/3rdparty/wayland/protocols/pointer-gestures-unstable-v1.xml b/src/3rdparty/wayland/protocols/pointer-gestures/pointer-gestures-unstable-v1.xml similarity index 100% rename from src/3rdparty/wayland/protocols/pointer-gestures-unstable-v1.xml rename to src/3rdparty/wayland/protocols/pointer-gestures/pointer-gestures-unstable-v1.xml diff --git a/src/3rdparty/wayland/protocols/pointer-gestures/qt_attribution.json b/src/3rdparty/wayland/protocols/pointer-gestures/qt_attribution.json new file mode 100644 index 00000000000..9cd44450e74 --- /dev/null +++ b/src/3rdparty/wayland/protocols/pointer-gestures/qt_attribution.json @@ -0,0 +1,18 @@ +[ + { + "Id": "wayland-pointer-gestures-protocol", + "Name": "Wayland Pointer Gestures Protocol", + "QDocModule": "qtwaylandcompositor", + "QtUsage": "Used in the Qt Wayland platform plugin", + "Files": "pointer-gestures-unstable-v1.xml", + + "Description": "", + "Homepage": "https://wayland.freedesktop.org", + "Version": "unstable v1, version 2", + "DownloadLocation": "https://cgit.freedesktop.org/wayland/wayland-protocols/plain/unstable/pointer-gestures/pointer-gestures-unstable-v1.xml", + "LicenseId": "MIT", + "License": "MIT License", + "LicenseFile": "../MIT_LICENSE.txt", + "Copyright": "Copyright © 2015, 2016 Red Hat" + } +] diff --git a/src/3rdparty/wayland/protocols/presentation-time.xml b/src/3rdparty/wayland/protocols/presentation-time/presentation-time.xml similarity index 100% rename from src/3rdparty/wayland/protocols/presentation-time.xml rename to src/3rdparty/wayland/protocols/presentation-time/presentation-time.xml diff --git a/src/3rdparty/wayland/protocols/presentation-time/qt_attribution.json b/src/3rdparty/wayland/protocols/presentation-time/qt_attribution.json new file mode 100644 index 00000000000..8d54400d334 --- /dev/null +++ b/src/3rdparty/wayland/protocols/presentation-time/qt_attribution.json @@ -0,0 +1,18 @@ +[ + { + "Id": "presentation-time.xml", + "Name": "Presentation Time Protocol", + "QDocModule": "qtwaylandcompositor", + "QtUsage": "Used in the Qt Wayland Compositor", + "Files": "presentation-time.xml", + + "Description": "The presentaton time protocol is a way to get presentation timing feedback.", + "Homepage": "https://wayland.freedesktop.org", + "Version": "1", + "DownloadLocation": "https://gitlab.freedesktop.org/wayland/wayland-protocols/raw/1.18/stable/presentation-time/presentation-time.xml", + "LicenseId": "MIT", + "License": "MIT License", + "LicenseFile": "../MIT_LICENSE.txt", + "Copyright": "Copyright © 2013, 2014 Collabora, Ltd." + } +] diff --git a/src/3rdparty/wayland/protocols/qt_attribution.json b/src/3rdparty/wayland/protocols/qt_attribution.json deleted file mode 100644 index 6ced46a2b6c..00000000000 --- a/src/3rdparty/wayland/protocols/qt_attribution.json +++ /dev/null @@ -1,357 +0,0 @@ -[ - { - "Id": "wayland-fullscreen-protocol", - "Name": "Wayland Fullscreen Shell Protocol", - "QDocModule": "qtwaylandcompositor", - "QtUsage": "Used in the Qt Wayland platform plugin.", - "Files": "fullscreen-shell-unstable-v1.xml", - - "Description": "A Wayland shell for displaying a single surface per output", - "Homepage": "https://wayland.freedesktop.org", - "Version": "unstable v1", - "DownloadLocation": "https://gitlab.freedesktop.org/wayland/wayland-protocols/raw/1.18/unstable/fullscreen-shell/fullscreen-shell-unstable-v1.xml", - "LicenseId": "MIT", - "License": "MIT License", - "LicenseFile": "MIT_LICENSE.txt", - "Copyright": "Copyright © 2016 Yong Bakos\nCopyright © 2015 Jason Ekstrand\nCopyright © 2015 Jonas Ådahl" - }, - - { - "Id": "wayland-protocol", - "Name": "Wayland Protocol", - "QDocModule": "qtwaylandcompositor", - "QtUsage": "Used in the Qt Wayland Compositor, and the Qt Wayland platform plugin.", - "Files": "wayland.xml", - - "Description": "Wayland is a protocol for a compositor to talk to its clients.", - "Homepage": "https://wayland.freedesktop.org", - "Version": "1.19.0", - "DownloadLocation": "https://gitlab.freedesktop.org/wayland/wayland/raw/1.19.0/protocol/wayland.xml", - "LicenseId": "MIT", - "License": "MIT License", - "LicenseFile": "MIT_LICENSE.txt", - "Copyright": "Copyright © 2008-2011 Kristian Høgsberg\nCopyright © 2010-2011 Intel Corporation\nCopyright © 2012-2013 Collabora, Ltd." - }, - - { - "Id": "wayland-ivi-extension-protocol", - "Name": "Wayland IVI Extension Protocol", - "QDocModule": "qtwaylandcompositor", - "QtUsage": "Used in the Qt Wayland Compositor, and the Qt Wayland platform plugin.", - "Files": "ivi-controller.xml ivi-application.xml", - - "Description": "\"Wayland IVI Extension\" is forked from IVI Layer Management to define a common set of APIs by wayland style protocol and provide reference implementation which can be loaded on Weston.", - "Homepage": "https://at.projects.genivi.org/wiki/display/WIE/Wayland+IVI+Extension+Home", - "Version": "1.9.1", - "DownloadLocation": "https://github.com/GENIVI/wayland-ivi-extension/releases/tag/1.9.1", - "LicenseId": "MIT", - "License": "MIT License", - "LicenseFile": "MIT_LICENSE.txt", - "Copyright": "Copyright (C) 2013 DENSO CORPORATION\nCopyright (c) 2013 BMW Car IT GmbH" - }, - - { - "Id": "wayland-pointer-gestures-protocol", - "Name": "Wayland Pointer Gestures Protocol", - "QDocModule": "qtwaylandcompositor", - "QtUsage": "Used in the Qt Wayland platform plugin", - "Files": "pointer-gestures-unstable-v1.xml", - - "Description": "", - "Homepage": "https://wayland.freedesktop.org", - "Version": "unstable v1, version 2", - "DownloadLocation": "https://cgit.freedesktop.org/wayland/wayland-protocols/plain/unstable/pointer-gestures/pointer-gestures-unstable-v1.xml", - "LicenseId": "MIT", - "License": "MIT License", - "LicenseFile": "MIT_LICENSE.txt", - "Copyright": "Copyright © 2015, 2016 Red Hat" - }, - - { - "Id": "wayland-primary-selection-protocol", - "Name": "Wayland Primary Selection Protocol", - "QDocModule": "qtwaylandcompositor", - "QtUsage": "Used in the Qt Wayland platform plugin", - "Files": "wp-primary-selection-unstable-v1.xml", - - "Description": "The primary selection extension allows copying text by selecting it and pasting it with the middle mouse button.", - "Homepage": "https://wayland.freedesktop.org", - "Version": "1", - "DownloadLocation": "https://gitlab.freedesktop.org/wayland/wayland-protocols/raw/1.18/unstable/primary-selection/primary-selection-unstable-v1.xml", - "LicenseId": "MIT", - "License": "MIT License", - "LicenseFile": "MIT_LICENSE.txt", - "Copyright": "Copyright © 2015, 2016 Red Hat" - }, - - { - "Id": "wayland-scaler-protocol", - "Name": "Wayland Scaler Protocol", - "QDocModule": "qtwaylandcompositor", - "QtUsage": "Used in the Qt Wayland Compositor API", - "Files": "scaler.xml", - - "Description": "The Wayland scaler extension allows a client to scale or crop a surface without modifying the buffer", - "Homepage": "https://wayland.freedesktop.org", - "Version": "2", - "DownloadLocation": "https://gitlab.freedesktop.org/wayland/weston/raw/1.11/protocol/scaler.xml", - "LicenseId": "MIT", - "License": "MIT License", - "LicenseFile": "MIT_LICENSE.txt", - "Copyright": "Copyright © 2013-2014 Collabora, Ltd." - }, - - { - "Id": "wayland-tablet-protocol", - "Name": "Wayland Tablet Protocol", - "QDocModule": "qtwaylandcompositor", - "QtUsage": "Used in the Qt Wayland platform plugin", - "Files": "tablet-unstable-v2.xml", - - "Description": "", - "Homepage": "https://wayland.freedesktop.org", - "Version": "unstable v2, version 1", - "DownloadLocation": "https://cgit.freedesktop.org/wayland/wayland-protocols/plain/unstable/tablet/tablet-unstable-v2.xml", - "LicenseId": "MIT", - "License": "MIT License", - "LicenseFile": "MIT_LICENSE.txt", - "Copyright": "Copyright 2014 © Stephen \"Lyude\" Chandler Paul\nCopyright 2015-2016 © Red Hat, Inc." - }, - - { - "Id": "wayland-text-input-unstable-v3", - "Name": "Wayland Text Input Protocol", - "QDocModule": "qtwaylandcompositor", - "QtUsage": "Used in the Qt Wayland Compositor, and the Qt Wayland platform plugin.", - "Files": "text-input-unstable-v3.xml", - "Description": "Adds support for compositors to act as input methods and send text to applications.", - "Homepage": "https://wayland.freedesktop.org", - "Version": "unstable v3", - "DownloadLocation": "https://cgit.freedesktop.org/wayland/wayland-protocols/plain/unstable/text-input/text-input-unstable-v3.xml", - "LicenseId": "MIT", - "License": "MIT License", - "LicenseFile": "MIT_LICENSE.txt", - "Copyright": "Copyright © 2012, 2013 Intel Corporation\nCopyright © 2015, 2016 Jan Arne Petersen\nCopyright © 2017, 2018 Red Hat, Inc.\nCopyright © 2018 Purism SPC" - }, - - { - "Id": "wayland-viewporter-protocol", - "Name": "Wayland Viewporter Protocol", - "QDocModule": "qtwaylandcompositor", - "QtUsage": "Used in the Qt Wayland Compositor API", - "Files": "viewporter.xml", - - "Description": "The Wayland viewporter extension allows a client to scale or crop a surface without modifying the buffer", - "Homepage": "https://wayland.freedesktop.org", - "Version": "1", - "DownloadLocation": "https://gitlab.freedesktop.org/wayland/wayland-protocols/raw/1.18/stable/viewporter/viewporter.xml", - "LicenseId": "MIT", - "License": "MIT License", - "LicenseFile": "MIT_LICENSE.txt", - "Copyright": "Copyright © 2013-2016 Collabora, Ltd." - }, - - { - "Id": "wayland-xdg-activation", - "Name": "Wayland xdg-activation Protocol", - "QDocModule": "qtwaylandcompositor", - "QtUsage": "Used in the Qt Wayland platform plugin", - "Files": "xdg-activation-v1.xml", - - "Description": "The xdg-activation protocol provides a way for one client to pass focus to another.", - "Homepage": "https://wayland.freedesktop.org", - "Version": "unstable v1, version 1", - "DownloadLocation": "https://gitlab.freedesktop.org/wayland/wayland-protocols/-/blob/main/staging/xdg-activation/xdg-activation-v1.xml", - "LicenseId": "MIT", - "License": "MIT License", - "LicenseFile": "MIT_LICENSE.txt", - "Copyright": "Copyright © 2020 Aleix Pol Gonzalez <aleixpol@kde.org>\nCopyright © 2020 Carlos Garnacho <carlosg@gnome.org>" - - }, - - { - "Id": "wayland-xdg-decoration-protocol", - "Name": "Wayland xdg-decoration Protocol", - "QDocModule": "qtwaylandcompositor", - "QtUsage": "Used in the Qt Wayland Compositor API, and the Qt Wayland platform plugin.", - "Files": "xdg-decoration-unstable-v1.xml", - - "Description": "The xdg-decoration protocol allows a compositor to announce support for server-side decorations.", - "Homepage": "https://wayland.freedesktop.org", - "Version": "unstable v1, version 1", - "DownloadLocation": "https://gitlab.freedesktop.org/wayland/wayland-protocols/raw/1.18/unstable/xdg-decoration/xdg-decoration-unstable-v1.xml", - "LicenseId": "MIT", - "License": "MIT License", - "LicenseFile": "MIT_LICENSE.txt", - "Copyright": "Copyright © 2018 Simon Ser" - }, - - { - "Id": "wayland-xdg-output-protocol", - "Name": "Wayland XDG Output Protocol", - "QDocModule": "qtwaylandcompositor", - "QtUsage": "Used in the Qt Wayland Compositor API, and the Qt Wayland platform plugin.", - "Files": "xdg-output-unstable-v1.xml", - - "Description": "The XDG Output protocol is an extended way to describe output regions under Wayland", - "Homepage": "https://wayland.freedesktop.org", - "Version": "unstable v1, version 3", - "DownloadLocation": "https://gitlab.freedesktop.org/wayland/wayland-protocols/raw/1.18/unstable/xdg-output/xdg-output-unstable-v1.xml", - "LicenseId": "MIT", - "License": "MIT License", - "LicenseFile": "MIT_LICENSE.txt", - "Copyright": "Copyright © 2017 Red Hat Inc." - }, - - { - "Id": "wayland-xdg-shell-protocol", - "Name": "Wayland XDG Shell Protocol", - "QDocModule": "qtwaylandcompositor", - "QtUsage": "Used in the Qt Wayland Compositor, and the Qt Wayland platform plugin.", - "Files": "xdg-shell.xml", - - "Description": "The XDG-Shell protocol is an extended way to manage surfaces under Wayland compositors.", - "Homepage": "https://gitlab.freedesktop.org/wayland/wayland-protocols/", - "Version": "1.18", - "DownloadLocation": "https://gitlab.freedesktop.org/wayland/wayland-protocols/tree/1.18/", - "LicenseId": "MIT", - "License": "MIT License", - "LicenseFile": "MIT_LICENSE.txt", - "Copyright": "Copyright © 2008-2013 Kristian Høgsberg\nCopyright © 2013 Rafael Antognolli\nCopyright © 2013 Jasper St. Pierre\nCopyright © 2010-2013 Intel Corporation\nCopyright © 2015-2017 Samsung Electronics Co., Ltd\nCopyright © 2015-2017 Red Hat Inc.\n" - }, - - { - "Id": "wayland-text-input-unstable-v1", - "Name": "Wayland Text Input Protocol v1", - "QDocModule": "qtwaylandcompositor", - "QtUsage": "Used in the Qt Wayland platform plugin", - "Files": "text-input-unstable-v1.xml", - - "Description": "Adds support for text input and input methods to applications running on Wayland servers that only support text-input-unstable-v1.", - "Homepage": "https://wayland.freedesktop.org", - "Version": "unstable v1", - "DownloadLocation": "https://gitlab.freedesktop.org/wayland/wayland-protocols/-/blob/main/unstable/text-input/text-input-unstable-v1.xml", - "LicenseId": "MIT", - "License": "MIT License", - "LicenseFile": "MIT_LICENSE.txt", - "Copyright": "Copyright © 2012, 2013 Intel Corporation" - }, - - { - "Id": "wayland-text-input-unstable-v2", - "Name": "Wayland Text Input Protocol v2", - "QDocModule": "qtwaylandcompositor", - "QtUsage": "Used in the Qt Wayland Compositor, and the Qt Wayland platform plugin.", - "Files": "text-input-unstable-v2.xml", - - "Description": "Adds support for text input and input methods to applications.", - "Homepage": "https://wayland.freedesktop.org", - "Version": "unstable v2", - "LicenseId": "HPND", - "License": "HPND License", - "LicenseFile": "HPND_LICENSE.txt", - "Copyright": "Copyright © 2012, 2013 Intel Corporation\nCopyright © 2015, 2016 Jan Arne Petersen" - }, - - { - "Id": "wayland-linux-dmabuf-unstable-v1", - "Name": "Wayland Linux Dmabuf Unstable V1 Protocol", - "QDocModule": "qtwaylandcompositor", - "QtUsage": "Used in the Qt Wayland Compositor", - "Files": "linux-dmabuf-unstable-v1.xml", - - "Description": "The linux dmabuf protocol is a way to create dmabuf-based wl_buffers", - "Homepage": "https://wayland.freedesktop.org", - "Version": "unstable v1, version 3", - "DownloadLocation": "https://gitlab.freedesktop.org/wayland/wayland-protocols/raw/1.18/unstable/linux-dmabuf/linux-dmabuf-unstable-v1.xml", - "LicenseId": "MIT", - "License": "MIT License", - "LicenseFile": "MIT_LICENSE.txt", - "Copyright": "Copyright © 2014, 2015 Collabora, Ltd." - }, - - { - "Id": "wayland-eglstream-controller", - "Name": "Wayland EGLStream Controller Protocol", - "QDocModule": "qtwaylandcompositor", - "QtUsage": "Used in the Qt Wayland Compositor", - "Files": "wl-eglstream-controller.xml", - - "Description": "Allows clients to request that the compositor creates its EGLStream.", - "Homepage": "https://github.com/NVIDIA/egl-wayland", - "Version": "1.1.1", - "DownloadLocation": "https://raw.githubusercontent.com/NVIDIA/egl-wayland/1.1.1/wayland-eglstream/wayland-eglstream-controller.xml", - "LicenseId": "MIT", - "License": "MIT License", - "LicenseFile": "MIT_LICENSE.txt", - "Copyright": "Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved." - }, - - { - "Id": "presentation-time.xml", - "Name": "Presentation Time Protocol", - "QDocModule": "qtwaylandcompositor", - "QtUsage": "Used in the Qt Wayland Compositor", - "Files": "presentation-time.xml", - - "Description": "The presentaton time protocol is a way to get presentation timing feedback.", - "Homepage": "https://wayland.freedesktop.org", - "Version": "1", - "DownloadLocation": "https://gitlab.freedesktop.org/wayland/wayland-protocols/raw/1.18/stable/presentation-time/presentation-time.xml", - "LicenseId": "MIT", - "License": "MIT License", - "LicenseFile": "MIT_LICENSE.txt", - "Copyright": "Copyright © 2013, 2014 Collabora, Ltd." - }, - - { - "Id": "xdg-foreign-unstable-v2", - "Name": "Wayland XDG Foreign Protocol", - "QDocModule": "qtwaylandcompositor", - "QtUsage": "Used in the Qt Wayland platform plugin", - "Files": "xdg-foreign-unstable-v2.xml", - - "Description": "Allows referencing surfaces of different clients", - "Homepage": "https://wayland.freedesktop.org", - "Version": "1", - "DownloadLocation": "https://gitlab.freedesktop.org/wayland/wayland-protocols/-/raw/1.25/unstable/xdg-foreign/xdg-foreign-unstable-v2.xml", - "LicenseId": "MIT", - "License": "MIT License", - "LicenseFile": "MIT_LICENSE.txt", - "Copyright": "Copyright © 2015-2016 Red Hat Inc." - }, - - { - "Id": "fractional-scale-v1", - "Name": "Wayland Fractional Scale Protocol", - "QDocModule": "qtwaylandcompositor", - "QtUsage": "Used in the Qt Wayland platform plugin", - "Files": "fractional-scale-v1.xml", - - "Description": "Send a preferred scale to different clients", - "Homepage": "https://wayland.freedesktop.org", - "Version": "1", - "DownloadLocation": "https://gitlab.freedesktop.org/wayland/wayland-protocols/-/raw/1.31/unstable/fractional-scale/fractional-scale-v1.xml", - "LicenseId": "MIT", - "License": "MIT License", - "LicenseFile": "MIT_LICENSE.txt", - "Copyright": "Copyright © 2022 Kenny Levinsen" - }, - - { - "Id": "xdg-dialog-v1", - "Name": "Wayland Dialog Protocol", - "QDocModule": "qtwaylandcompositor", - "QtUsage": "Used in the Qt Wayland platform plugin", - "Files": "xdg-dialog-v1.xml", - - "Description": "Register toplevel as dialogs", - "Homepage": "https://wayland.freedesktop.org", - "Version": "1", - "DownloadLocation": "", - "LicenseId": "MIT", - "License": "MIT License", - "LicenseFile": "MIT_LICENSE.txt", - "Copyright": "Copyright © 2023 Carlos Garnacho" - } -] diff --git a/src/3rdparty/wayland/protocols/scaler/qt_attribution.json b/src/3rdparty/wayland/protocols/scaler/qt_attribution.json new file mode 100644 index 00000000000..4b1f7303b8a --- /dev/null +++ b/src/3rdparty/wayland/protocols/scaler/qt_attribution.json @@ -0,0 +1,18 @@ +[ + { + "Id": "wayland-scaler-protocol", + "Name": "Wayland Scaler Protocol", + "QDocModule": "qtwaylandcompositor", + "QtUsage": "Used in the Qt Wayland Compositor API", + "Files": "scaler.xml", + + "Description": "The Wayland scaler extension allows a client to scale or crop a surface without modifying the buffer", + "Homepage": "https://wayland.freedesktop.org", + "Version": "2", + "DownloadLocation": "https://gitlab.freedesktop.org/wayland/weston/raw/1.11/protocol/scaler.xml", + "LicenseId": "MIT", + "License": "MIT License", + "LicenseFile": "../MIT_LICENSE.txt", + "Copyright": "Copyright © 2013-2014 Collabora, Ltd." + } +] diff --git a/src/3rdparty/wayland/protocols/scaler.xml b/src/3rdparty/wayland/protocols/scaler/scaler.xml similarity index 100% rename from src/3rdparty/wayland/protocols/scaler.xml rename to src/3rdparty/wayland/protocols/scaler/scaler.xml diff --git a/src/3rdparty/wayland/protocols/tablet/qt_attribution.json b/src/3rdparty/wayland/protocols/tablet/qt_attribution.json new file mode 100644 index 00000000000..150eb2fbc4c --- /dev/null +++ b/src/3rdparty/wayland/protocols/tablet/qt_attribution.json @@ -0,0 +1,18 @@ +[ + { + "Id": "wayland-tablet-protocol", + "Name": "Wayland Tablet Protocol", + "QDocModule": "qtwaylandcompositor", + "QtUsage": "Used in the Qt Wayland platform plugin", + "Files": "tablet-unstable-v2.xml", + + "Description": "", + "Homepage": "https://wayland.freedesktop.org", + "Version": "unstable v2, version 1", + "DownloadLocation": "https://cgit.freedesktop.org/wayland/wayland-protocols/plain/unstable/tablet/tablet-unstable-v2.xml", + "LicenseId": "MIT", + "License": "MIT License", + "LicenseFile": "../MIT_LICENSE.txt", + "Copyright": "Copyright 2014 © Stephen \"Lyude\" Chandler Paul\nCopyright 2015-2016 © Red Hat, Inc." + } +] diff --git a/src/3rdparty/wayland/protocols/tablet-unstable-v2.xml b/src/3rdparty/wayland/protocols/tablet/tablet-unstable-v2.xml similarity index 100% rename from src/3rdparty/wayland/protocols/tablet-unstable-v2.xml rename to src/3rdparty/wayland/protocols/tablet/tablet-unstable-v2.xml diff --git a/src/3rdparty/wayland/protocols/text-input/v1/qt_attribution.json b/src/3rdparty/wayland/protocols/text-input/v1/qt_attribution.json new file mode 100644 index 00000000000..ea0d59237c2 --- /dev/null +++ b/src/3rdparty/wayland/protocols/text-input/v1/qt_attribution.json @@ -0,0 +1,18 @@ +[ + { + "Id": "wayland-text-input-unstable-v1", + "Name": "Wayland Text Input Protocol v1", + "QDocModule": "qtwaylandcompositor", + "QtUsage": "Used in the Qt Wayland platform plugin", + "Files": "text-input-unstable-v1.xml", + + "Description": "Adds support for text input and input methods to applications running on Wayland servers that only support text-input-unstable-v1.", + "Homepage": "https://wayland.freedesktop.org", + "Version": "unstable v1", + "DownloadLocation": "https://gitlab.freedesktop.org/wayland/wayland-protocols/-/blob/main/unstable/text-input/text-input-unstable-v1.xml", + "LicenseId": "MIT", + "License": "MIT License", + "LicenseFile": "../../MIT_LICENSE.txt", + "Copyright": "Copyright © 2012, 2013 Intel Corporation" + } +] diff --git a/src/3rdparty/wayland/protocols/text-input-unstable-v1.xml b/src/3rdparty/wayland/protocols/text-input/v1/text-input-unstable-v1.xml similarity index 100% rename from src/3rdparty/wayland/protocols/text-input-unstable-v1.xml rename to src/3rdparty/wayland/protocols/text-input/v1/text-input-unstable-v1.xml diff --git a/src/3rdparty/wayland/protocols/HPND_LICENSE.txt b/src/3rdparty/wayland/protocols/text-input/v2/HPND_LICENSE.txt similarity index 100% rename from src/3rdparty/wayland/protocols/HPND_LICENSE.txt rename to src/3rdparty/wayland/protocols/text-input/v2/HPND_LICENSE.txt diff --git a/src/3rdparty/wayland/protocols/text-input/v2/qt_attribution.json b/src/3rdparty/wayland/protocols/text-input/v2/qt_attribution.json new file mode 100644 index 00000000000..f0be562662a --- /dev/null +++ b/src/3rdparty/wayland/protocols/text-input/v2/qt_attribution.json @@ -0,0 +1,17 @@ +[ + { + "Id": "wayland-text-input-unstable-v2", + "Name": "Wayland Text Input Protocol v2", + "QDocModule": "qtwaylandcompositor", + "QtUsage": "Used in the Qt Wayland Compositor, and the Qt Wayland platform plugin.", + "Files": "text-input-unstable-v2.xml", + + "Description": "Adds support for text input and input methods to applications.", + "Homepage": "https://wayland.freedesktop.org", + "Version": "unstable v2", + "LicenseId": "HPND", + "License": "HPND License", + "LicenseFile": "HPND_LICENSE.txt", + "Copyright": "Copyright © 2012, 2013 Intel Corporation\nCopyright © 2015, 2016 Jan Arne Petersen" + } +] diff --git a/src/3rdparty/wayland/protocols/text-input-unstable-v2.xml b/src/3rdparty/wayland/protocols/text-input/v2/text-input-unstable-v2.xml similarity index 100% rename from src/3rdparty/wayland/protocols/text-input-unstable-v2.xml rename to src/3rdparty/wayland/protocols/text-input/v2/text-input-unstable-v2.xml diff --git a/src/3rdparty/wayland/protocols/text-input/v3/qt_attribution.json b/src/3rdparty/wayland/protocols/text-input/v3/qt_attribution.json new file mode 100644 index 00000000000..2a9226e3ea4 --- /dev/null +++ b/src/3rdparty/wayland/protocols/text-input/v3/qt_attribution.json @@ -0,0 +1,17 @@ +[ + { + "Id": "wayland-text-input-unstable-v3", + "Name": "Wayland Text Input Protocol", + "QDocModule": "qtwaylandcompositor", + "QtUsage": "Used in the Qt Wayland Compositor, and the Qt Wayland platform plugin.", + "Files": "text-input-unstable-v3.xml", + "Description": "Adds support for compositors to act as input methods and send text to applications.", + "Homepage": "https://wayland.freedesktop.org", + "Version": "unstable v3", + "DownloadLocation": "https://cgit.freedesktop.org/wayland/wayland-protocols/plain/unstable/text-input/text-input-unstable-v3.xml", + "LicenseId": "MIT", + "License": "MIT License", + "LicenseFile": "../../MIT_LICENSE.txt", + "Copyright": "Copyright © 2012, 2013 Intel Corporation\nCopyright © 2015, 2016 Jan Arne Petersen\nCopyright © 2017, 2018 Red Hat, Inc.\nCopyright © 2018 Purism SPC" + } +] diff --git a/src/3rdparty/wayland/protocols/text-input-unstable-v3.xml b/src/3rdparty/wayland/protocols/text-input/v3/text-input-unstable-v3.xml similarity index 100% rename from src/3rdparty/wayland/protocols/text-input-unstable-v3.xml rename to src/3rdparty/wayland/protocols/text-input/v3/text-input-unstable-v3.xml diff --git a/src/3rdparty/wayland/protocols/viewporter/qt_attribution.json b/src/3rdparty/wayland/protocols/viewporter/qt_attribution.json new file mode 100644 index 00000000000..fbdda2c0294 --- /dev/null +++ b/src/3rdparty/wayland/protocols/viewporter/qt_attribution.json @@ -0,0 +1,18 @@ +[ + { + "Id": "wayland-viewporter-protocol", + "Name": "Wayland Viewporter Protocol", + "QDocModule": "qtwaylandcompositor", + "QtUsage": "Used in the Qt Wayland Compositor API", + "Files": "viewporter.xml", + + "Description": "The Wayland viewporter extension allows a client to scale or crop a surface without modifying the buffer", + "Homepage": "https://wayland.freedesktop.org", + "Version": "1", + "DownloadLocation": "https://gitlab.freedesktop.org/wayland/wayland-protocols/raw/1.18/stable/viewporter/viewporter.xml", + "LicenseId": "MIT", + "License": "MIT License", + "LicenseFile": "../MIT_LICENSE.txt", + "Copyright": "Copyright © 2013-2016 Collabora, Ltd." + } +] diff --git a/src/3rdparty/wayland/protocols/viewporter.xml b/src/3rdparty/wayland/protocols/viewporter/viewporter.xml similarity index 100% rename from src/3rdparty/wayland/protocols/viewporter.xml rename to src/3rdparty/wayland/protocols/viewporter/viewporter.xml diff --git a/src/3rdparty/wayland/protocols/README b/src/3rdparty/wayland/protocols/wayland/README similarity index 100% rename from src/3rdparty/wayland/protocols/README rename to src/3rdparty/wayland/protocols/wayland/README diff --git a/src/3rdparty/wayland/protocols/wayland/qt_attribution.json b/src/3rdparty/wayland/protocols/wayland/qt_attribution.json new file mode 100644 index 00000000000..3624f201288 --- /dev/null +++ b/src/3rdparty/wayland/protocols/wayland/qt_attribution.json @@ -0,0 +1,18 @@ +[ + { + "Id": "wayland-protocol", + "Name": "Wayland Protocol", + "QDocModule": "qtwaylandcompositor", + "QtUsage": "Used in the Qt Wayland Compositor, and the Qt Wayland platform plugin.", + "Files": "wayland.xml", + + "Description": "Wayland is a protocol for a compositor to talk to its clients.", + "Homepage": "https://wayland.freedesktop.org", + "Version": "1.19.0", + "DownloadLocation": "https://gitlab.freedesktop.org/wayland/wayland/raw/1.19.0/protocol/wayland.xml", + "LicenseId": "MIT", + "License": "MIT License", + "LicenseFile": "../MIT_LICENSE.txt", + "Copyright": "Copyright © 2008-2011 Kristian Høgsberg\nCopyright © 2010-2011 Intel Corporation\nCopyright © 2012-2013 Collabora, Ltd." + } +] diff --git a/src/3rdparty/wayland/protocols/wayland.xml b/src/3rdparty/wayland/protocols/wayland/wayland.xml similarity index 100% rename from src/3rdparty/wayland/protocols/wayland.xml rename to src/3rdparty/wayland/protocols/wayland/wayland.xml diff --git a/src/3rdparty/wayland/protocols/wl-eglstream/qt_attribution.json b/src/3rdparty/wayland/protocols/wl-eglstream/qt_attribution.json new file mode 100644 index 00000000000..f11023f2681 --- /dev/null +++ b/src/3rdparty/wayland/protocols/wl-eglstream/qt_attribution.json @@ -0,0 +1,18 @@ +[ + { + "Id": "wayland-eglstream-controller", + "Name": "Wayland EGLStream Controller Protocol", + "QDocModule": "qtwaylandcompositor", + "QtUsage": "Used in the Qt Wayland Compositor", + "Files": "wl-eglstream-controller.xml", + + "Description": "Allows clients to request that the compositor creates its EGLStream.", + "Homepage": "https://github.com/NVIDIA/egl-wayland", + "Version": "1.1.1", + "DownloadLocation": "https://raw.githubusercontent.com/NVIDIA/egl-wayland/1.1.1/wayland-eglstream/wayland-eglstream-controller.xml", + "LicenseId": "MIT", + "License": "MIT License", + "LicenseFile": "../MIT_LICENSE.txt", + "Copyright": "Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved." + } +] diff --git a/src/3rdparty/wayland/protocols/wl-eglstream-controller.xml b/src/3rdparty/wayland/protocols/wl-eglstream/wl-eglstream-controller.xml similarity index 100% rename from src/3rdparty/wayland/protocols/wl-eglstream-controller.xml rename to src/3rdparty/wayland/protocols/wl-eglstream/wl-eglstream-controller.xml diff --git a/src/3rdparty/wayland/protocols/wp-primary-selection/qt_attribution.json b/src/3rdparty/wayland/protocols/wp-primary-selection/qt_attribution.json new file mode 100644 index 00000000000..ab305bb6924 --- /dev/null +++ b/src/3rdparty/wayland/protocols/wp-primary-selection/qt_attribution.json @@ -0,0 +1,18 @@ +[ + { + "Id": "wayland-primary-selection-protocol", + "Name": "Wayland Primary Selection Protocol", + "QDocModule": "qtwaylandcompositor", + "QtUsage": "Used in the Qt Wayland platform plugin", + "Files": "wp-primary-selection-unstable-v1.xml", + + "Description": "The primary selection extension allows copying text by selecting it and pasting it with the middle mouse button.", + "Homepage": "https://wayland.freedesktop.org", + "Version": "1", + "DownloadLocation": "https://gitlab.freedesktop.org/wayland/wayland-protocols/raw/1.18/unstable/primary-selection/primary-selection-unstable-v1.xml", + "LicenseId": "MIT", + "License": "MIT License", + "LicenseFile": "../MIT_LICENSE.txt", + "Copyright": "Copyright © 2015, 2016 Red Hat" + } +] diff --git a/src/3rdparty/wayland/protocols/wp-primary-selection-unstable-v1.xml b/src/3rdparty/wayland/protocols/wp-primary-selection/wp-primary-selection-unstable-v1.xml similarity index 100% rename from src/3rdparty/wayland/protocols/wp-primary-selection-unstable-v1.xml rename to src/3rdparty/wayland/protocols/wp-primary-selection/wp-primary-selection-unstable-v1.xml diff --git a/src/3rdparty/wayland/protocols/xdg-activation/qt_attribution.json b/src/3rdparty/wayland/protocols/xdg-activation/qt_attribution.json new file mode 100644 index 00000000000..1f55ad27b61 --- /dev/null +++ b/src/3rdparty/wayland/protocols/xdg-activation/qt_attribution.json @@ -0,0 +1,19 @@ +[ + { + "Id": "wayland-xdg-activation", + "Name": "Wayland xdg-activation Protocol", + "QDocModule": "qtwaylandcompositor", + "QtUsage": "Used in the Qt Wayland platform plugin", + "Files": "xdg-activation-v1.xml", + + "Description": "The xdg-activation protocol provides a way for one client to pass focus to another.", + "Homepage": "https://wayland.freedesktop.org", + "Version": "unstable v1, version 1", + "DownloadLocation": "https://gitlab.freedesktop.org/wayland/wayland-protocols/-/blob/main/staging/xdg-activation/xdg-activation-v1.xml", + "LicenseId": "MIT", + "License": "MIT License", + "LicenseFile": "../MIT_LICENSE.txt", + "Copyright": "Copyright © 2020 Aleix Pol Gonzalez <aleixpol@kde.org>\nCopyright © 2020 Carlos Garnacho <carlosg@gnome.org>" + + } +] diff --git a/src/3rdparty/wayland/protocols/xdg-activation-v1.xml b/src/3rdparty/wayland/protocols/xdg-activation/xdg-activation-v1.xml similarity index 100% rename from src/3rdparty/wayland/protocols/xdg-activation-v1.xml rename to src/3rdparty/wayland/protocols/xdg-activation/xdg-activation-v1.xml diff --git a/src/3rdparty/wayland/protocols/xdg-decoration/qt_attribution.json b/src/3rdparty/wayland/protocols/xdg-decoration/qt_attribution.json new file mode 100644 index 00000000000..7e551a5d200 --- /dev/null +++ b/src/3rdparty/wayland/protocols/xdg-decoration/qt_attribution.json @@ -0,0 +1,18 @@ +[ + { + "Id": "wayland-xdg-decoration-protocol", + "Name": "Wayland xdg-decoration Protocol", + "QDocModule": "qtwaylandcompositor", + "QtUsage": "Used in the Qt Wayland Compositor API, and the Qt Wayland platform plugin.", + "Files": "xdg-decoration-unstable-v1.xml", + + "Description": "The xdg-decoration protocol allows a compositor to announce support for server-side decorations.", + "Homepage": "https://wayland.freedesktop.org", + "Version": "unstable v1, version 1", + "DownloadLocation": "https://gitlab.freedesktop.org/wayland/wayland-protocols/raw/1.18/unstable/xdg-decoration/xdg-decoration-unstable-v1.xml", + "LicenseId": "MIT", + "License": "MIT License", + "LicenseFile": "../MIT_LICENSE.txt", + "Copyright": "Copyright © 2018 Simon Ser" + } +] diff --git a/src/3rdparty/wayland/protocols/xdg-decoration-unstable-v1.xml b/src/3rdparty/wayland/protocols/xdg-decoration/xdg-decoration-unstable-v1.xml similarity index 100% rename from src/3rdparty/wayland/protocols/xdg-decoration-unstable-v1.xml rename to src/3rdparty/wayland/protocols/xdg-decoration/xdg-decoration-unstable-v1.xml diff --git a/src/3rdparty/wayland/protocols/xdg-dialog/qt_attribution.json b/src/3rdparty/wayland/protocols/xdg-dialog/qt_attribution.json new file mode 100644 index 00000000000..4a6d959e4a1 --- /dev/null +++ b/src/3rdparty/wayland/protocols/xdg-dialog/qt_attribution.json @@ -0,0 +1,18 @@ +[ + { + "Id": "xdg-dialog-v1", + "Name": "Wayland Dialog Protocol", + "QDocModule": "qtwaylandcompositor", + "QtUsage": "Used in the Qt Wayland platform plugin", + "Files": "xdg-dialog-v1.xml", + + "Description": "Register toplevel as dialogs", + "Homepage": "https://wayland.freedesktop.org", + "Version": "1", + "DownloadLocation": "", + "LicenseId": "MIT", + "License": "MIT License", + "LicenseFile": "../MIT_LICENSE.txt", + "Copyright": "Copyright © 2023 Carlos Garnacho" + } +] diff --git a/src/3rdparty/wayland/protocols/xdg-dialog-v1.xml b/src/3rdparty/wayland/protocols/xdg-dialog/xdg-dialog-v1.xml similarity index 100% rename from src/3rdparty/wayland/protocols/xdg-dialog-v1.xml rename to src/3rdparty/wayland/protocols/xdg-dialog/xdg-dialog-v1.xml diff --git a/src/3rdparty/wayland/protocols/xdg-foreign/qt_attribution.json b/src/3rdparty/wayland/protocols/xdg-foreign/qt_attribution.json new file mode 100644 index 00000000000..00daedd5b95 --- /dev/null +++ b/src/3rdparty/wayland/protocols/xdg-foreign/qt_attribution.json @@ -0,0 +1,18 @@ +[ + { + "Id": "xdg-foreign-unstable-v2", + "Name": "Wayland XDG Foreign Protocol", + "QDocModule": "qtwaylandcompositor", + "QtUsage": "Used in the Qt Wayland platform plugin", + "Files": "xdg-foreign-unstable-v2.xml", + + "Description": "Allows referencing surfaces of different clients", + "Homepage": "https://wayland.freedesktop.org", + "Version": "1", + "DownloadLocation": "https://gitlab.freedesktop.org/wayland/wayland-protocols/-/raw/1.25/unstable/xdg-foreign/xdg-foreign-unstable-v2.xml", + "LicenseId": "MIT", + "License": "MIT License", + "LicenseFile": "../MIT_LICENSE.txt", + "Copyright": "Copyright © 2015-2016 Red Hat Inc." + } +] diff --git a/src/3rdparty/wayland/protocols/xdg-foreign-unstable-v2.xml b/src/3rdparty/wayland/protocols/xdg-foreign/xdg-foreign-unstable-v2.xml similarity index 100% rename from src/3rdparty/wayland/protocols/xdg-foreign-unstable-v2.xml rename to src/3rdparty/wayland/protocols/xdg-foreign/xdg-foreign-unstable-v2.xml diff --git a/src/3rdparty/wayland/protocols/xdg-output/qt_attribution.json b/src/3rdparty/wayland/protocols/xdg-output/qt_attribution.json new file mode 100644 index 00000000000..04c6bf482f5 --- /dev/null +++ b/src/3rdparty/wayland/protocols/xdg-output/qt_attribution.json @@ -0,0 +1,18 @@ +[ + { + "Id": "wayland-xdg-output-protocol", + "Name": "Wayland XDG Output Protocol", + "QDocModule": "qtwaylandcompositor", + "QtUsage": "Used in the Qt Wayland Compositor API, and the Qt Wayland platform plugin.", + "Files": "xdg-output-unstable-v1.xml", + + "Description": "The XDG Output protocol is an extended way to describe output regions under Wayland", + "Homepage": "https://wayland.freedesktop.org", + "Version": "unstable v1, version 3", + "DownloadLocation": "https://gitlab.freedesktop.org/wayland/wayland-protocols/raw/1.18/unstable/xdg-output/xdg-output-unstable-v1.xml", + "LicenseId": "MIT", + "License": "MIT License", + "LicenseFile": "../MIT_LICENSE.txt", + "Copyright": "Copyright © 2017 Red Hat Inc." + } +] diff --git a/src/3rdparty/wayland/protocols/xdg-output-unstable-v1.xml b/src/3rdparty/wayland/protocols/xdg-output/xdg-output-unstable-v1.xml similarity index 100% rename from src/3rdparty/wayland/protocols/xdg-output-unstable-v1.xml rename to src/3rdparty/wayland/protocols/xdg-output/xdg-output-unstable-v1.xml diff --git a/src/3rdparty/wayland/protocols/xdg-shell/qt_attribution.json b/src/3rdparty/wayland/protocols/xdg-shell/qt_attribution.json new file mode 100644 index 00000000000..b47679c7148 --- /dev/null +++ b/src/3rdparty/wayland/protocols/xdg-shell/qt_attribution.json @@ -0,0 +1,18 @@ +[ + { + "Id": "wayland-xdg-shell-protocol", + "Name": "Wayland XDG Shell Protocol", + "QDocModule": "qtwaylandcompositor", + "QtUsage": "Used in the Qt Wayland Compositor, and the Qt Wayland platform plugin.", + "Files": "xdg-shell.xml", + + "Description": "The XDG-Shell protocol is an extended way to manage surfaces under Wayland compositors.", + "Homepage": "https://gitlab.freedesktop.org/wayland/wayland-protocols/", + "Version": "1.18", + "DownloadLocation": "https://gitlab.freedesktop.org/wayland/wayland-protocols/tree/1.18/", + "LicenseId": "MIT", + "License": "MIT License", + "LicenseFile": "../MIT_LICENSE.txt", + "Copyright": "Copyright © 2008-2013 Kristian Høgsberg\nCopyright © 2013 Rafael Antognolli\nCopyright © 2013 Jasper St. Pierre\nCopyright © 2010-2013 Intel Corporation\nCopyright © 2015-2017 Samsung Electronics Co., Ltd\nCopyright © 2015-2017 Red Hat Inc.\n" + } +] diff --git a/src/3rdparty/wayland/protocols/xdg-shell-unstable-v6.xml b/src/3rdparty/wayland/protocols/xdg-shell/xdg-shell-unstable-v6.xml similarity index 100% rename from src/3rdparty/wayland/protocols/xdg-shell-unstable-v6.xml rename to src/3rdparty/wayland/protocols/xdg-shell/xdg-shell-unstable-v6.xml diff --git a/src/3rdparty/wayland/protocols/xdg-shell.xml b/src/3rdparty/wayland/protocols/xdg-shell/xdg-shell.xml similarity index 100% rename from src/3rdparty/wayland/protocols/xdg-shell.xml rename to src/3rdparty/wayland/protocols/xdg-shell/xdg-shell.xml diff --git a/src/3rdparty/wayland/protocols/xdg-toplevel-drag-v1.xml b/src/3rdparty/wayland/protocols/xdg-toplevel-drag/xdg-toplevel-drag-v1.xml similarity index 100% rename from src/3rdparty/wayland/protocols/xdg-toplevel-drag-v1.xml rename to src/3rdparty/wayland/protocols/xdg-toplevel-drag/xdg-toplevel-drag-v1.xml diff --git a/src/plugins/platforms/wayland/CMakeLists.txt b/src/plugins/platforms/wayland/CMakeLists.txt index 4d0a106f658..6e6890ea858 100644 --- a/src/plugins/platforms/wayland/CMakeLists.txt +++ b/src/plugins/platforms/wayland/CMakeLists.txt @@ -82,19 +82,19 @@ qt_internal_add_module(WaylandClient qt6_generate_wayland_protocol_client_sources(WaylandClient FILES - ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/cursor-shape-v1.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/pointer-gestures-unstable-v1.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/tablet-unstable-v2.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/text-input-unstable-v1.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/text-input-unstable-v2.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/text-input-unstable-v3.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/wayland.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/wp-primary-selection-unstable-v1.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/xdg-output-unstable-v1.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/fractional-scale-v1.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/viewporter.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/xdg-shell.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/xdg-toplevel-drag-v1.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/cursor-shape/cursor-shape-v1.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/pointer-gestures/pointer-gestures-unstable-v1.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/tablet/tablet-unstable-v2.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/text-input/v1/text-input-unstable-v1.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/text-input/v2/text-input-unstable-v2.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/text-input/v3/text-input-unstable-v3.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/wayland/wayland.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/wp-primary-selection/wp-primary-selection-unstable-v1.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/xdg-output/xdg-output-unstable-v1.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/fractional-scale/fractional-scale-v1.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/viewporter/viewporter.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/xdg-shell/xdg-shell.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/xdg-toplevel-drag/xdg-toplevel-drag-v1.xml ${CMAKE_CURRENT_SOURCE_DIR}/../extensions/qt-key-unstable-v1.xml ${CMAKE_CURRENT_SOURCE_DIR}/../extensions/qt-text-input-method-unstable-v1.xml ${CMAKE_CURRENT_SOURCE_DIR}/../extensions/qt-windowmanager.xml diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/fullscreen-shell-v1/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/shellintegration/fullscreen-shell-v1/CMakeLists.txt index 7413bcdf547..e322b5de5d9 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/fullscreen-shell-v1/CMakeLists.txt +++ b/src/plugins/platforms/wayland/plugins/shellintegration/fullscreen-shell-v1/CMakeLists.txt @@ -24,7 +24,7 @@ qt_internal_add_plugin(QWaylandFullScreenShellV1IntegrationPlugin qt6_generate_wayland_protocol_client_sources(QWaylandFullScreenShellV1IntegrationPlugin FILES - ${CMAKE_CURRENT_SOURCE_DIR}/../../../3rdparty/protocol/fullscreen-shell-unstable-v1.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../../../3rdparty/protocol/fullscreen-shell/fullscreen-shell-unstable-v1.xml ) #### Keys ignored in scope 1:.:.:fullscreen-shell-v1.pro:: diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/CMakeLists.txt index 09b076d00c3..d55b5cf23ee 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/CMakeLists.txt +++ b/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/CMakeLists.txt @@ -26,7 +26,7 @@ qt6_generate_wayland_protocol_client_sources(WlShellIntegrationPrivate # this is just a helper module and still part of the QtWaylandClient build __QT_INTERNAL_WAYLAND_INCLUDE_DIR QtWaylandClient/private FILES - ${CMAKE_CURRENT_SOURCE_DIR}/../../../3rdparty/protocol/wayland.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../../../3rdparty/protocol/wayland/wayland.xml ) #### Keys ignored in scope 2:.:.:wl-shell-integration.pro:: diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/CMakeLists.txt index af5a97feecd..de53030ed46 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/CMakeLists.txt +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/CMakeLists.txt @@ -28,11 +28,11 @@ qt_internal_add_plugin(QWaylandXdgShellIntegrationPlugin qt6_generate_wayland_protocol_client_sources(QWaylandXdgShellIntegrationPlugin FILES - ${CMAKE_CURRENT_SOURCE_DIR}/../../../3rdparty/protocol/xdg-decoration-unstable-v1.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../../../3rdparty/protocol/xdg-shell.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../../../3rdparty/protocol/xdg-activation-v1.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../../../3rdparty/protocol/xdg-foreign-unstable-v2.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../../../3rdparty/protocol/xdg-dialog-v1.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../../../3rdparty/protocol/xdg-decoration/xdg-decoration-unstable-v1.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../../../3rdparty/protocol/xdg-shell/xdg-shell.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../../../3rdparty/protocol/xdg-activation/xdg-activation-v1.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../../../3rdparty/protocol/xdg-foreign/xdg-foreign-unstable-v2.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../../../3rdparty/protocol/xdg-dialog/xdg-dialog-v1.xml ) #### Keys ignored in scope 1:.:.:xdg-shell.pro:: diff --git a/tests/auto/wayland/shared/CMakeLists.txt b/tests/auto/wayland/shared/CMakeLists.txt index 1d64f2956e0..bb0163e6439 100644 --- a/tests/auto/wayland/shared/CMakeLists.txt +++ b/tests/auto/wayland/shared/CMakeLists.txt @@ -41,20 +41,20 @@ add_library(SharedClientTest qt6_generate_wayland_protocol_server_sources(SharedClientTest FILES - ${PROJECT_SOURCE_DIR}/src/3rdparty/protocol/cursor-shape-v1.xml - ${PROJECT_SOURCE_DIR}/src/3rdparty/protocol/fullscreen-shell-unstable-v1.xml - ${PROJECT_SOURCE_DIR}/src/3rdparty/protocol/ivi-application.xml - ${PROJECT_SOURCE_DIR}/src/3rdparty/protocol/wp-primary-selection-unstable-v1.xml - ${PROJECT_SOURCE_DIR}/src/3rdparty/protocol/tablet-unstable-v2.xml - ${PROJECT_SOURCE_DIR}/src/3rdparty/protocol/text-input-unstable-v2.xml + ${PROJECT_SOURCE_DIR}/src/3rdparty/protocol/cursor-shape/cursor-shape-v1.xml + ${PROJECT_SOURCE_DIR}/src/3rdparty/protocol/fullscreen-shell/fullscreen-shell-unstable-v1.xml + ${PROJECT_SOURCE_DIR}/src/3rdparty/protocol/ivi/ivi-application.xml + ${PROJECT_SOURCE_DIR}/src/3rdparty/protocol/wp-primary-selection/wp-primary-selection-unstable-v1.xml + ${PROJECT_SOURCE_DIR}/src/3rdparty/protocol/tablet/tablet-unstable-v2.xml + ${PROJECT_SOURCE_DIR}/src/3rdparty/protocol/text-input/v2/text-input-unstable-v2.xml ${PROJECT_SOURCE_DIR}/src/extensions/qt-text-input-method-unstable-v1.xml - ${PROJECT_SOURCE_DIR}/src/3rdparty/protocol/fractional-scale-v1.xml - ${PROJECT_SOURCE_DIR}/src/3rdparty/protocol/viewporter.xml - ${PROJECT_SOURCE_DIR}/src/3rdparty/protocol/wayland.xml - ${PROJECT_SOURCE_DIR}/src/3rdparty/protocol/xdg-decoration-unstable-v1.xml - ${PROJECT_SOURCE_DIR}/src/3rdparty/protocol/xdg-dialog-v1.xml - ${PROJECT_SOURCE_DIR}/src/3rdparty/protocol/xdg-output-unstable-v1.xml - ${PROJECT_SOURCE_DIR}/src/3rdparty/protocol/xdg-shell.xml + ${PROJECT_SOURCE_DIR}/src/3rdparty/protocol/fractional-scale/fractional-scale-v1.xml + ${PROJECT_SOURCE_DIR}/src/3rdparty/protocol/viewporter/viewporter.xml + ${PROJECT_SOURCE_DIR}/src/3rdparty/protocol/wayland/wayland.xml + ${PROJECT_SOURCE_DIR}/src/3rdparty/protocol/xdg-decoration/xdg-decoration-unstable-v1.xml + ${PROJECT_SOURCE_DIR}/src/3rdparty/protocol/xdg-dialog/xdg-dialog-v1.xml + ${PROJECT_SOURCE_DIR}/src/3rdparty/protocol/xdg-output/xdg-output-unstable-v1.xml + ${PROJECT_SOURCE_DIR}/src/3rdparty/protocol/xdg-shell/xdg-shell.xml ) if(QT_FEATURE_opengl) diff --git a/tests/auto/wayland/shared/shared.pri b/tests/auto/wayland/shared/shared.pri index 97202e78792..e81ad9d4a64 100644 --- a/tests/auto/wayland/shared/shared.pri +++ b/tests/auto/wayland/shared/shared.pri @@ -3,10 +3,10 @@ CONFIG += testcase wayland-scanner QMAKE_USE += wayland-server WAYLANDSERVERSOURCES += \ - $$PWD/../../../../src/3rdparty/protocol/wayland.xml \ - $$PWD/../../../../src/3rdparty/protocol/xdg-output-unstable-v1.xml \ - $$PWD/../../../../src/3rdparty/protocol/xdg-shell.xml \ - $$PWD/../../../../src/3rdparty/protocol/text-input-unstable-v2.xml + $$PWD/../../../../src/3rdparty/protocol/wayland/wayland.xml \ + $$PWD/../../../../src/3rdparty/protocol/xdg-output/xdg-output-unstable-v1.xml \ + $$PWD/../../../../src/3rdparty/protocol/xdg-shell/xdg-shell.xml \ + $$PWD/../../../../src/3rdparty/protocol/text-input/text-input-unstable-v2.xml INCLUDEPATH += ../shared From 18355d9d3713a2393ce861dbac138cc57f4a32b5 Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Mon, 17 Jun 2024 16:04:47 +0200 Subject: [PATCH 1375/1507] CMake: Annotate some targets with SBOM information Pick-to: 6.8 Task-number: QTBUG-122899 Change-Id: I32c1489bbb3e3a48377f6aef94e4cd639257c9a1 Reviewed-by: Lucie Gerard --- src/platformsupport/wayland/CMakeLists.txt | 2 ++ src/plugins/platforms/wayland/CMakeLists.txt | 13 +++++++++++++ .../plugins/decorations/bradient/CMakeLists.txt | 1 + .../hardwareintegration/brcm-egl/CMakeLists.txt | 1 + .../dmabuf-server/CMakeLists.txt | 1 + .../drm-egl-server/CMakeLists.txt | 1 + .../libhybris-egl-server/CMakeLists.txt | 1 + .../shm-emulation-server/CMakeLists.txt | 1 + .../vulkan-server/CMakeLists.txt | 1 + .../hardwareintegration/wayland-egl/CMakeLists.txt | 1 + .../fullscreen-shell-v1/CMakeLists.txt | 3 +++ .../shellintegration/wl-shell/CMakeLists.txt | 3 +++ .../shellintegration/xdg-shell/CMakeLists.txt | 7 +++++++ 13 files changed, 36 insertions(+) diff --git a/src/platformsupport/wayland/CMakeLists.txt b/src/platformsupport/wayland/CMakeLists.txt index a38d9551202..1becbc325ce 100644 --- a/src/platformsupport/wayland/CMakeLists.txt +++ b/src/platformsupport/wayland/CMakeLists.txt @@ -5,6 +5,8 @@ # special case begin qt_find_package(WaylandScanner PROVIDED_TARGETS Wayland::Scanner) +set(QT_SBOM_DEFAULT_QT_LICENSE_ID_LIBRARIES "QT_COMMERCIAL_OR_GPL3") + set(wayland_libs Wayland::Client Wayland::Server diff --git a/src/plugins/platforms/wayland/CMakeLists.txt b/src/plugins/platforms/wayland/CMakeLists.txt index 6e6890ea858..43c6848ea8b 100644 --- a/src/plugins/platforms/wayland/CMakeLists.txt +++ b/src/plugins/platforms/wayland/CMakeLists.txt @@ -78,6 +78,19 @@ qt_internal_add_module(WaylandClient Qt::WaylandGlobalPrivate PRIVATE_HEADER_FILTERS "^qwayland-.*\.h|^wayland-.*-protocol\.h" + QT_LICENSE_ID QT_COMMERCIAL_OR_LGPL3 + ATTRIBUTION_FILE_DIR_PATHS + ../3rdparty/protocol/pointer-gestures + ../3rdparty/protocol/tablet + ../3rdparty/protocol/text-input/v1 + ../3rdparty/protocol/text-input/v2 + ../3rdparty/protocol/text-input/v3 + ../3rdparty/protocol/wayland + ../3rdparty/protocol/wp-primary-selection + ../3rdparty/protocol/xdg-output + ../3rdparty/protocol/fractional-scale + ../3rdparty/protocol/viewporter + ../3rdparty/protocol/xdg-shell ) qt6_generate_wayland_protocol_client_sources(WaylandClient diff --git a/src/plugins/platforms/wayland/plugins/decorations/bradient/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/decorations/bradient/CMakeLists.txt index 065d0f18c55..bc25aeb2d4d 100644 --- a/src/plugins/platforms/wayland/plugins/decorations/bradient/CMakeLists.txt +++ b/src/plugins/platforms/wayland/plugins/decorations/bradient/CMakeLists.txt @@ -17,6 +17,7 @@ qt_internal_add_plugin(QWaylandBradientDecorationPlugin Qt::Gui Qt::WaylandClientPrivate Wayland::Client + QT_LICENSE_ID QT_COMMERCIAL_OR_LGPL3 ) #### Keys ignored in scope 1:.:.:bradient.pro:: diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/CMakeLists.txt index 90df10d8bdc..6a376ddad3f 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/CMakeLists.txt +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/CMakeLists.txt @@ -24,6 +24,7 @@ qt_internal_add_plugin(QWaylandBrcmEglClientBufferPlugin Qt::Gui Qt::WaylandClientPrivate Wayland::Client + QT_LICENSE_ID QT_COMMERCIAL_OR_LGPL3 ) qt6_generate_wayland_protocol_client_sources(QWaylandBrcmEglClientBufferPlugin diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/dmabuf-server/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/hardwareintegration/dmabuf-server/CMakeLists.txt index e20820e3b4f..bc6c29ecfbd 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/dmabuf-server/CMakeLists.txt +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/dmabuf-server/CMakeLists.txt @@ -22,6 +22,7 @@ qt_internal_add_plugin(DmaBufServerBufferPlugin Qt::OpenGL Qt::WaylandClientPrivate Wayland::Client + QT_LICENSE_ID QT_COMMERCIAL_OR_LGPL3 ) qt6_generate_wayland_protocol_client_sources(DmaBufServerBufferPlugin diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/drm-egl-server/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/hardwareintegration/drm-egl-server/CMakeLists.txt index 124c7202686..1b40b7fc041 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/drm-egl-server/CMakeLists.txt +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/drm-egl-server/CMakeLists.txt @@ -22,6 +22,7 @@ qt_internal_add_plugin(DrmEglServerBufferPlugin Qt::OpenGL Qt::WaylandClientPrivate Wayland::Client + QT_LICENSE_ID QT_COMMERCIAL_OR_LGPL3 ) qt6_generate_wayland_protocol_client_sources(DrmEglServerBufferPlugin diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/libhybris-egl-server/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/hardwareintegration/libhybris-egl-server/CMakeLists.txt index 6bf74c1461f..5167cef490b 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/libhybris-egl-server/CMakeLists.txt +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/libhybris-egl-server/CMakeLists.txt @@ -21,6 +21,7 @@ qt_internal_add_plugin(LibHybrisEglServerBufferPlugin Qt::Gui Qt::WaylandClientPrivate Wayland::Client + QT_LICENSE_ID QT_COMMERCIAL_OR_LGPL3 ) qt6_generate_wayland_protocol_client_sources(LibHybrisEglServerBufferPlugin diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/shm-emulation-server/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/hardwareintegration/shm-emulation-server/CMakeLists.txt index 81ff77bab6f..351f7bc8191 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/shm-emulation-server/CMakeLists.txt +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/shm-emulation-server/CMakeLists.txt @@ -21,6 +21,7 @@ qt_internal_add_plugin(ShmServerBufferPlugin Qt::OpenGL Qt::WaylandClientPrivate Wayland::Client + QT_LICENSE_ID QT_COMMERCIAL_OR_LGPL3 ) qt6_generate_wayland_protocol_client_sources(ShmServerBufferPlugin diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/vulkan-server/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/hardwareintegration/vulkan-server/CMakeLists.txt index 825b85adbe5..72f527210b7 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/vulkan-server/CMakeLists.txt +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/vulkan-server/CMakeLists.txt @@ -21,6 +21,7 @@ qt_internal_add_plugin(VulkanServerBufferPlugin Qt::OpenGL Qt::WaylandClientPrivate Wayland::Client + QT_LICENSE_ID QT_COMMERCIAL_OR_LGPL3 ) qt6_generate_wayland_protocol_client_sources(VulkanServerBufferPlugin diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/CMakeLists.txt index 61ee4ea9f8a..e75ce07e530 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/CMakeLists.txt +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/CMakeLists.txt @@ -18,6 +18,7 @@ qt_internal_add_plugin(QWaylandEglClientBufferPlugin Qt::Gui Qt::WaylandClientPrivate Qt::WaylandEglClientHwIntegrationPrivate + QT_LICENSE_ID QT_COMMERCIAL_OR_LGPL3 ) #### Keys ignored in scope 1:.:.:wayland-egl.pro:: diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/fullscreen-shell-v1/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/shellintegration/fullscreen-shell-v1/CMakeLists.txt index e322b5de5d9..693dbde5fe7 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/fullscreen-shell-v1/CMakeLists.txt +++ b/src/plugins/platforms/wayland/plugins/shellintegration/fullscreen-shell-v1/CMakeLists.txt @@ -20,6 +20,9 @@ qt_internal_add_plugin(QWaylandFullScreenShellV1IntegrationPlugin Qt::GuiPrivate Qt::WaylandClientPrivate Wayland::Client + QT_LICENSE_ID QT_COMMERCIAL_OR_LGPL3 + ATTRIBUTION_FILE_DIR_PATHS + ../../../3rdparty/protocol/fullscreen-shell ) qt6_generate_wayland_protocol_client_sources(QWaylandFullScreenShellV1IntegrationPlugin diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/CMakeLists.txt index d55b5cf23ee..b2871c92b14 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/CMakeLists.txt +++ b/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/CMakeLists.txt @@ -20,6 +20,9 @@ qt_internal_add_module(WlShellIntegrationPrivate PRIVATE_HEADER_FILTERS "^qwayland-.*\.h|^wayland-.*-protocol\.h" NO_GENERATE_CPP_EXPORTS + QT_LICENSE_ID QT_COMMERCIAL_OR_LGPL3 + ATTRIBUTION_FILE_DIR_PATHS + ../../../3rdparty/protocol/wayland ) qt6_generate_wayland_protocol_client_sources(WlShellIntegrationPrivate diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/CMakeLists.txt index de53030ed46..74e925f73cc 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/CMakeLists.txt +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/CMakeLists.txt @@ -24,6 +24,13 @@ qt_internal_add_plugin(QWaylandXdgShellIntegrationPlugin Qt::GuiPrivate Qt::WaylandClientPrivate Wayland::Client + QT_LICENSE_ID QT_COMMERCIAL_OR_LGPL3 + ATTRIBUTION_FILE_DIR_PATHS + ../../../3rdparty/protocol/xdg-decoration + ../../../3rdparty/protocol/xdg-shell + ../../../3rdparty/protocol/xdg-activation + ../../../3rdparty/protocol/xdg-foreign + ../../../3rdparty/protocol/xdg-dialog ) qt6_generate_wayland_protocol_client_sources(QWaylandXdgShellIntegrationPlugin From e7050409098fd5f670ab506fd86475b072ba5d13 Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Sun, 26 May 2024 15:08:53 +0300 Subject: [PATCH 1376/1507] client: Cache exposed state and unify sending events Right now we are sending an expose event on every configure event because exposure may have changed. This causes an overhead. The mechanism for sending expose events is also scattered, there are a lot of properties that affect exposure, having everyone track the full state gets messy. This is cleanup work to then be able to land viewport clipping and synchronous event delivery. Change-Id: I192b908cdb6f6adda7d0e33f83961861e09504e8 Reviewed-by: Vlad Zahorodnii --- .../xdg-shell/qwaylandxdgshell.cpp | 5 +- .../platforms/wayland/qwaylandwindow.cpp | 63 +++++++++++-------- .../platforms/wayland/qwaylandwindow_p.h | 10 ++- 3 files changed, 48 insertions(+), 30 deletions(-) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp index 6ccda7d265f..da6a8b73a7c 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp @@ -406,8 +406,6 @@ bool QWaylandXdgSurface::handleExpose(const QRegion ®ion) void QWaylandXdgSurface::applyConfigure() { - bool wasExposed = isExposed(); - // It is a redundant ack_configure, so skipped. if (m_pendingConfigureSerial == m_appliedConfigureSerial) return; @@ -421,8 +419,7 @@ void QWaylandXdgSurface::applyConfigure() m_configured = true; ack_configure(m_appliedConfigureSerial); - if (!wasExposed && isExposed()) - m_window->sendRecursiveExposeEvent(); + window()->updateExposure(); } bool QWaylandXdgSurface::wantsDecorations() const diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 4e2163df785..3aea7bbb35d 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -326,7 +326,7 @@ void QWaylandWindow::reset() mCanResize = true; mResizeDirty = false; mScale = std::nullopt; - + mExposed = false; mOpaqueArea = QRegion(); mMask = QRegion(); @@ -544,11 +544,12 @@ void QWaylandWindow::resizeFromApplyConfigure(const QSize &sizeWithMargins, cons void QWaylandWindow::sendExposeEvent(const QRect &rect) { - if (!(mShellSurface && mShellSurface->handleExpose(rect))) + if (!(mShellSurface && mShellSurface->handleExpose(rect))) { QWindowSystemInterface::handleExposeEvent(window(), rect); + mLastExposeGeometry = rect; + } else qCDebug(lcQpaWayland) << "sendExposeEvent: intercepted by shell extension, not sending"; - mLastExposeGeometry = rect; } QPlatformScreen *QWaylandWindow::calculateScreenFromSurfaceEvents() const @@ -572,6 +573,7 @@ void QWaylandWindow::setVisible(bool visible) initWindow(); setGeometry(windowGeometry()); + updateExposure(); // Don't flush the events here, or else the newly visible window may start drawing, but since // there was no frame before it will be stuck at the waitForFrameSync() in // QWaylandShmBackingStore::beginPaint(). @@ -579,6 +581,8 @@ void QWaylandWindow::setVisible(bool visible) if (mShellSurface) mShellSurface->requestActivateOnShow(); } else { + // make sure isExposed is false during the next event dispatch + mExposed = false; sendExposeEvent(QRect()); reset(); } @@ -654,6 +658,8 @@ void QWaylandWindow::doApplyConfigure() mShellSurface->applyConfigure(); mWaitingToApplyConfigure = false; + + sendExposeEvent(QRect(QPoint(), geometry().size())); } void QWaylandWindow::doApplyConfigureFromOtherThread() @@ -662,7 +668,6 @@ void QWaylandWindow::doApplyConfigureFromOtherThread() if (!mCanResize || !mWaitingToApplyConfigure) return; doApplyConfigure(); - sendRecursiveExposeEvent(); } void QWaylandWindow::setCanResize(bool canResize) @@ -678,13 +683,11 @@ void QWaylandWindow::setCanResize(bool canResize) bool inGuiThread = QThread::currentThreadId() == QThreadData::get2(thread())->threadId.loadRelaxed(); if (inGuiThread) { doApplyConfigure(); - sendRecursiveExposeEvent(); } else { QMetaObject::invokeMethod(this, &QWaylandWindow::doApplyConfigureFromOtherThread, Qt::QueuedConnection); } } else if (mResizeDirty) { mResizeDirty = false; - sendExposeEvent(QRect(QPoint(), geometry().size())); } } } @@ -697,23 +700,9 @@ void QWaylandWindow::applyConfigure() doApplyConfigure(); lock.unlock(); - sendRecursiveExposeEvent(); QWindowSystemInterface::flushWindowSystemEvents(); } -void QWaylandWindow::sendRecursiveExposeEvent() -{ - if (!isExposed()) - sendExposeEvent(QRect()); - else - sendExposeEvent(QRect(QPoint(), geometry().size())); - - for (QWaylandSubSurface *subSurface : std::as_const(mChildren)) { - auto subWindow = subSurface->window(); - subWindow->sendRecursiveExposeEvent(); - } -} - void QWaylandWindow::attach(QWaylandBuffer *buffer, int x, int y) { QReadLocker locker(&mSurfaceLock); @@ -843,8 +832,8 @@ void QWaylandWindow::doHandleFrameCallback() mWaitingForUpdateDelivery.storeRelease(false); bool wasExposed = isExposed(); mFrameCallbackTimedOut = false; - if (!wasExposed && isExposed()) // Did setting mFrameCallbackTimedOut make the window exposed? - sendExposeEvent(QRect(QPoint(), geometry().size())); + // Did setting mFrameCallbackTimedOut make the window exposed? + updateExposure(); if (wasExposed && hasPendingUpdateRequest()) deliverUpdateRequest(); @@ -861,7 +850,7 @@ bool QWaylandWindow::waitForFrameSync(int timeout) qCDebug(lcWaylandBackingstore) << "Didn't receive frame callback in time, window should now be inexposed"; mFrameCallbackTimedOut = true; mWaitingForUpdate = false; - sendExposeEvent(QRect()); + updateExposure(); } return !mWaitingForFrameCallback; @@ -1517,7 +1506,7 @@ void QWaylandWindow::requestActivateWindow() mShellSurface->requestActivate(); } -bool QWaylandWindow::isExposed() const +bool QWaylandWindow::calculateExposure() const { if (!window()->isVisible()) return false; @@ -1534,6 +1523,30 @@ bool QWaylandWindow::isExposed() const return !(shouldCreateShellSurface() || shouldCreateSubSurface()); } +void QWaylandWindow::updateExposure() +{ + bool exposed = calculateExposure(); + if (exposed == mExposed) + return; + + mExposed = exposed; + + if (!exposed) + sendExposeEvent(QRect()); + else + sendExposeEvent(QRect(QPoint(), geometry().size())); + + for (QWaylandSubSurface *subSurface : std::as_const(mChildren)) { + auto subWindow = subSurface->window(); + subWindow->updateExposure(); + } +} + +bool QWaylandWindow::isExposed() const +{ + return mExposed; +} + bool QWaylandWindow::isActive() const { return mDisplay->isWindowActivated(this); @@ -1647,7 +1660,7 @@ void QWaylandWindow::timerEvent(QTimerEvent *event) qCDebug(lcWaylandBackingstore) << "Didn't receive frame callback in time, window should now be inexposed"; mFrameCallbackTimedOut = true; mWaitingForUpdate = false; - sendExposeEvent(QRect()); + updateExposure(); } void QWaylandWindow::requestUpdate() diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index 5eec5b5d136..38423f79b1a 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -232,7 +232,10 @@ public: void endFrame(); void closeChildPopups(); - void sendRecursiveExposeEvent(); + + // should be invoked whenever a property that potentially affects + // exposure changes + void updateExposure(); virtual void reinit(); void reset(); @@ -249,6 +252,9 @@ Q_SIGNALS: protected: virtual void doHandleFrameCallback(); virtual QRect defaultGeometry() const; + + // this should be called directly for buffer size changes only + // use updateExposure for anything affecting the on/off state void sendExposeEvent(const QRect &rect); QWaylandDisplay *mDisplay = nullptr; @@ -299,6 +305,7 @@ protected: // True when we have called deliverRequestUpdate, but the client has not yet attached a new buffer bool mWaitingForUpdate = false; + bool mExposed = false; QRecursiveMutex mResizeLock; bool mWaitingToApplyConfigure = false; @@ -349,6 +356,7 @@ private: bool isOpaque() const; void updateInputRegion(); void updateViewport(); + bool calculateExposure() const; void handleMouseEventWithDecoration(QWaylandInputDevice *inputDevice, const QWaylandPointerEvent &e); void handleScreensChanged(); From 9a5054cb624b4a8471bfbcb2f3f5e510f0eb1355 Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Wed, 10 Jul 2024 09:00:33 +0100 Subject: [PATCH 1377/1507] client: Guard against windows being on a null screen calculateScreenFromSurfaceEvents uses the screen information from our surface enter events. If this is not set yet, or refers to outputs not yet complete we fall back to the QWindow::screen. This was introduced in 2f7a86fac338dc78259d93b675f1cd131c24c926. It was assumed that this would always be a valid value as QtBase keeps it updated, but there are apparently paths for it to still be null. It will be evaluated again when the surface receives a wl_enter event or the output that we have entered is finally initialised and we will then be marked as on the correct screen. Pick-to: 6.8 Pick-to: 6.7 Change-Id: I33b4a5112c3426a8ea523d39a0658ba7ffee5298 Reviewed-by: Aleix Pol Gonzalez Reviewed-by: Vlad Zahorodnii --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 3aea7bbb35d..774de413f62 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -1424,7 +1424,7 @@ void QWaylandWindow::handleScreensChanged() { QPlatformScreen *newScreen = calculateScreenFromSurfaceEvents(); - if (newScreen->screen() == window()->screen()) + if (!newScreen || newScreen->screen() == window()->screen()) return; QWindowSystemInterface::handleWindowScreenChanged(window(), newScreen->QPlatformScreen::screen()); From 6b6d4e4b0b8a6252c98f2942b8299e0be8d889ff Mon Sep 17 00:00:00 2001 From: Volker Hilsheimer Date: Tue, 16 Jul 2024 12:22:53 +0200 Subject: [PATCH 1378/1507] Logging: use qCDebug/Warning/Info for categorized logging When building qt with QT_NO_DEBUG/WARNING/INFO_OUTPUT set, then the qDebug/Warning/Info macros expand to `QMessageLogger::noDebug`. That helper is not defined to take a logging category or category function, so using `qDebug(lcX, ...)` breaks the build. The correct way to emit categorized logging is to use the qCDebug/Warning/Info macros. Task-number: QTBUG-125589 Pick-to: 6.8 6.7 6.5 Change-Id: Ib76a3f2a366a2be27ebc2679be01a883a048347a Reviewed-by: David Edmundson --- src/plugins/platforms/wayland/qwaylandscreen.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandscreen.cpp b/src/plugins/platforms/wayland/qwaylandscreen.cpp index 3faef3f255d..f0ac9fbace6 100644 --- a/src/plugins/platforms/wayland/qwaylandscreen.cpp +++ b/src/plugins/platforms/wayland/qwaylandscreen.cpp @@ -346,7 +346,7 @@ void QWaylandScreen::zxdg_output_v1_logical_size(int32_t width, int32_t height) void QWaylandScreen::zxdg_output_v1_done() { if (Q_UNLIKELY(mWaylandDisplay->xdgOutputManager()->version() >= 3)) - qWarning(lcQpaWayland) << "zxdg_output_v1.done received on version 3 or newer, this is most likely a bug in the compositor"; + qCWarning(lcQpaWayland) << "zxdg_output_v1.done received on version 3 or newer, this is most likely a bug in the compositor"; mProcessedEvents |= XdgOutputDoneEvent; if (mInitialized) @@ -358,7 +358,7 @@ void QWaylandScreen::zxdg_output_v1_done() void QWaylandScreen::zxdg_output_v1_name(const QString &name) { if (Q_UNLIKELY(mInitialized)) - qWarning(lcQpaWayland) << "zxdg_output_v1.name received after output has been initialized, this is most likely a bug in the compositor"; + qCWarning(lcQpaWayland) << "zxdg_output_v1.name received after output has been initialized, this is most likely a bug in the compositor"; mOutputName = name; mProcessedEvents |= XdgOutputNameEvent; From c50ebcd83da11c145a07a3150573ebe456a3c0ab Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Sun, 26 May 2024 15:27:02 +0300 Subject: [PATCH 1379/1507] client: process exposure updates in the main thread This is important for when synchronous delivery is enabled as that should only happen from the main thread. Change-Id: I524443c6d2dd8dee8d36834b6d3032eb8f8c1750 Reviewed-by: Vlad Zahorodnii --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 774de413f62..b9112d81ee1 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -850,7 +850,7 @@ bool QWaylandWindow::waitForFrameSync(int timeout) qCDebug(lcWaylandBackingstore) << "Didn't receive frame callback in time, window should now be inexposed"; mFrameCallbackTimedOut = true; mWaitingForUpdate = false; - updateExposure(); + QMetaObject::invokeMethod(this, &QWaylandWindow::updateExposure, Qt::QueuedConnection); } return !mWaitingForFrameCallback; From 279406aa207584b22d27b4e8c5e5ecdef6c70ee9 Mon Sep 17 00:00:00 2001 From: David Redondo Date: Tue, 16 Jul 2024 11:57:17 +0200 Subject: [PATCH 1380/1507] Client: Use std::unique_ptr to manage window decoration There was a potential crash in the QWaylandWindow destructor. First it deletes the window decoration (but does not unset the pointer!) and then deletes the surface via reset(). This eventually triggers QWaylandDisplay::handleKeyboardFocusChanged which will call decoration->update(). Using std::unique_ptr makes it easier to manage and prevents such errors. Change-Id: I52edcdab0d25c35dc656581fbb5c1c9b5ca481c4 Reviewed-by: Vlad Zahorodnii --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 12 +++++------- src/plugins/platforms/wayland/qwaylandwindow_p.h | 2 +- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index b9112d81ee1..581d353aaf0 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -72,7 +72,7 @@ QWaylandWindow::QWaylandWindow(QWindow *window, QWaylandDisplay *display) QWaylandWindow::~QWaylandWindow() { - delete mWindowDecoration; + mWindowDecoration.reset(); if (mSurface) reset(); @@ -1064,8 +1064,7 @@ bool QWaylandWindow::createDecoration() if (decoration && !decorationPluginFailed) { if (!mWindowDecorationEnabled) { if (mWindowDecoration) { - delete mWindowDecoration; - mWindowDecoration = nullptr; + mWindowDecoration.reset(); } QStringList decorations = QWaylandDecorationFactory::keys(); @@ -1104,8 +1103,7 @@ bool QWaylandWindow::createDecoration() if (targetKey.isEmpty()) targetKey = decorations.first(); // first come, first served. - - mWindowDecoration = QWaylandDecorationFactory::create(targetKey, QStringList()); + mWindowDecoration.reset(QWaylandDecorationFactory::create(targetKey, QStringList())); if (!mWindowDecoration) { qWarning() << "Could not create decoration from factory! Running with no decorations."; decorationPluginFailed = true; @@ -1137,12 +1135,12 @@ bool QWaylandWindow::createDecoration() window()->requestUpdate(); } - return mWindowDecoration; + return mWindowDecoration.get(); } QWaylandAbstractDecoration *QWaylandWindow::decoration() const { - return mWindowDecorationEnabled ? mWindowDecoration : nullptr; + return mWindowDecorationEnabled ? mWindowDecoration.get() : nullptr; } static QWaylandWindow *closestShellSurfaceWindow(QWindow *window) diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index 38423f79b1a..c165125501b 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -270,7 +270,7 @@ protected: QWaylandSubSurface *mSubSurfaceWindow = nullptr; QList mChildren; - QWaylandAbstractDecoration *mWindowDecoration = nullptr; + std::unique_ptr mWindowDecoration; bool mWindowDecorationEnabled = false; bool mMouseEventsInContentArea = false; Qt::MouseButtons mMousePressedInContentArea = Qt::NoButton; From d30ce747c2641e23c87aeca78541db3cdbdab1b9 Mon Sep 17 00:00:00 2001 From: Ahmad Samir Date: Sun, 21 Jul 2024 18:40:24 +0300 Subject: [PATCH 1381/1507] QWaylandClipboard: fix crash when setting the same QMimeData* more than once This also fixes a crash in qtbase's tst_qclipboard, one of the tests there expects that calling setMimeData() on the same QMimeData* won't cause a crash. This matches how QXcbClipboard behaves. Amends 5925c3110df258e78e6086e3bf526b8f6f779039. Pick-to: 6.8 6.7 Change-Id: I057315aa1466857b7cd7181eba92068e92154ef5 Reviewed-by: David Edmundson --- src/plugins/platforms/wayland/qwaylandclipboard.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/plugins/platforms/wayland/qwaylandclipboard.cpp b/src/plugins/platforms/wayland/qwaylandclipboard.cpp index df6cf5d2b0c..c00e4c2eafd 100644 --- a/src/plugins/platforms/wayland/qwaylandclipboard.cpp +++ b/src/plugins/platforms/wayland/qwaylandclipboard.cpp @@ -67,6 +67,9 @@ void QWaylandClipboard::setMimeData(QMimeData *data, QClipboard::Mode mode) return; } + if (data && m_clientClipboard[mode] == data) // Already set before? + return; + static const QString plain = QStringLiteral("text/plain"); static const QString utf8 = QStringLiteral("text/plain;charset=utf-8"); From 37f25aeefb88ee04607866e6c2e5353eb3a363c4 Mon Sep 17 00:00:00 2001 From: Ahmad Samir Date: Mon, 22 Jul 2024 02:47:55 +0300 Subject: [PATCH 1382/1507] QWaylandClipboard: simplify some code Change-Id: I4b87c1be8cb147830a3ad0ba8912134e12d226f5 Reviewed-by: David Edmundson --- src/plugins/platforms/wayland/qwaylandclipboard.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandclipboard.cpp b/src/plugins/platforms/wayland/qwaylandclipboard.cpp index c00e4c2eafd..a1730c77fd7 100644 --- a/src/plugins/platforms/wayland/qwaylandclipboard.cpp +++ b/src/plugins/platforms/wayland/qwaylandclipboard.cpp @@ -76,13 +76,11 @@ void QWaylandClipboard::setMimeData(QMimeData *data, QClipboard::Mode mode) if (data && data->hasFormat(plain) && !data->hasFormat(utf8)) data->setData(utf8, data->data(plain)); - if (m_clientClipboard[mode]) { - if (m_clientClipboard[QClipboard::Clipboard] != m_clientClipboard[QClipboard::Selection]) - delete m_clientClipboard[mode]; - m_clientClipboard[mode] = nullptr; - } - - m_clientClipboard[mode] = data; + auto oldMimeData = std::exchange(m_clientClipboard[mode], data); + const auto otherMode = mode == QClipboard::Clipboard ? QClipboard::Selection + : QClipboard::Clipboard; + if (oldMimeData != m_clientClipboard[otherMode]) + delete oldMimeData; switch (mode) { case QClipboard::Clipboard: From 4bd62f740f2adc0696f24e664225cb3af82832dd Mon Sep 17 00:00:00 2001 From: Liang Qi Date: Tue, 30 Jul 2024 10:39:57 +0200 Subject: [PATCH 1383/1507] QWaylandXdgSurface: add suspended in debug output Pick-to: 6.8 Change-Id: I9318d132d3863f38d7264ebe360aad95de575fc4 Reviewed-by: David Edmundson --- .../shellintegration/xdg-shell/qwaylandxdgshell.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp index da6a8b73a7c..11add2809bc 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp @@ -105,7 +105,9 @@ void QWaylandXdgSurface::Toplevel::applyConfigure() if (!surfaceSize.isEmpty()) m_xdgSurface->m_window->resizeFromApplyConfigure(surfaceSize.grownBy(m_xdgSurface->m_window->windowContentMargins())); - qCDebug(lcQpaWayland) << "Applied pending xdg_toplevel configure event:" << m_applied.size << m_applied.states; + qCDebug(lcQpaWayland) << "Applied pending xdg_toplevel configure event:" << m_applied.size + << "and" << m_applied.states + << ", suspended " << m_applied.suspended; } bool QWaylandXdgSurface::Toplevel::wantsDecorations() @@ -164,7 +166,8 @@ void QWaylandXdgSurface::Toplevel::xdg_toplevel_configure(int32_t width, int32_t } } qCDebug(lcQpaWayland) << "Received xdg_toplevel.configure with" << m_pending.size - << "and" << m_pending.states; + << "and" << m_pending.states + << ", suspended " << m_pending.suspended; } void QWaylandXdgSurface::Toplevel::xdg_toplevel_close() From 8754c9fe83f8151adef46a05b5c6b6c47e9a56f3 Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Tue, 19 Mar 2024 17:06:41 +0000 Subject: [PATCH 1384/1507] client: Workaround Gnome's incorrect xdg-geometry sizes Mutter, depending on the scaling mode, will sometimes send the xdg geometry size in device pixels rather than logical pixels. It is reported as https://gitlab.gnome.org/GNOME/mutter/-/issues/2631 but it is closed upstream so we cannot rely on them fixing it. This patch introduces the same workaround that GTK ships to work around this behavior. If the scale is set, and the xdg geometry matches the output geometry, then we can assume we don't have logical pixels for the xdg geometry and should calculate it manually. Fixes: QTBUG-122197 Change-Id: I7f640bac619be6eb07c84bb6913334a6356524a2 Pick-to: 6.8 6.7 6.5 Reviewed-by: Aleix Pol Gonzalez --- .../platforms/wayland/qwaylandscreen.cpp | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandscreen.cpp b/src/plugins/platforms/wayland/qwaylandscreen.cpp index f0ac9fbace6..ef548925b62 100644 --- a/src/plugins/platforms/wayland/qwaylandscreen.cpp +++ b/src/plugins/platforms/wayland/qwaylandscreen.cpp @@ -112,12 +112,19 @@ QString QWaylandScreen::model() const QRect QWaylandScreen::geometry() const { if (zxdg_output_v1::isInitialized()) { - return mXdgGeometry; - } else { - // Scale geometry for QScreen. This makes window and screen - // geometry be in the same coordinate system. - return QRect(mGeometry.topLeft(), mGeometry.size() / mScale); + + // Workaround for Gnome bug + // https://gitlab.gnome.org/GNOME/mutter/-/issues/2631 + // which sends an incorrect xdg geometry + const bool xdgGeometryIsBogus = mScale > 1 && mXdgGeometry.size() == mGeometry.size(); + + if (!xdgGeometryIsBogus) { + return mXdgGeometry; + } } + // Scale geometry for QScreen. This makes window and screen + // geometry be in the same coordinate system. + return QRect(mGeometry.topLeft(), mGeometry.size() / mScale); } int QWaylandScreen::depth() const From 7062695de7973f0682da181c8b6124bc57afcc6e Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Thu, 8 Aug 2024 11:32:22 +0200 Subject: [PATCH 1385/1507] compositor: Add CMake options to control visibility of generated symbols This exposes the public-code / private-code options for the waylandscanner. It is the server-side version of 2962aa9ed9487bc6aa54810ed4ace114b4f7d723. Task-number: QTBUG-126301 Change-Id: I32490f6cbc9cac876c1f07c3930e8bafbc395e75 Reviewed-by: David Redondo --- .../qtwaylandscanner/Qt6WaylandCompositorMacros.cmake | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/tools/qtwaylandscanner/Qt6WaylandCompositorMacros.cmake b/src/tools/qtwaylandscanner/Qt6WaylandCompositorMacros.cmake index 05d16af6cb0..bf23bb727c0 100644 --- a/src/tools/qtwaylandscanner/Qt6WaylandCompositorMacros.cmake +++ b/src/tools/qtwaylandscanner/Qt6WaylandCompositorMacros.cmake @@ -2,7 +2,7 @@ # SPDX-License-Identifier: BSD-3-Clause function(qt6_generate_wayland_protocol_server_sources target) - cmake_parse_arguments(arg "" "__QT_INTERNAL_WAYLAND_INCLUDE_DIR" "FILES" ${ARGN}) + cmake_parse_arguments(arg "PUBLIC_CODE;PRIVATE_CODE" "__QT_INTERNAL_WAYLAND_INCLUDE_DIR" "FILES" ${ARGN}) if(DEFINED arg_UNPARSED_ARGUMENTS) message(FATAL_ERROR "Unknown arguments were passed to qt6_generate_wayland_protocol_server_sources: (${arg_UNPARSED_ARGUMENTS}).") endif() @@ -22,6 +22,12 @@ function(qt6_generate_wayland_protocol_server_sources target) string(REPLACE "." "_" module_define_infix "${module_define_infix}") set(build_macro "QT_BUILD_${module_define_infix}_LIB") + if (arg_PRIVATE_CODE) + set(wayland_scanner_code_option "private-code") + else() + set(wayland_scanner_code_option "public-code") + endif() + foreach(protocol_file IN LISTS arg_FILES) get_filename_component(protocol_name "${protocol_file}" NAME_WLE) @@ -38,7 +44,7 @@ function(qt6_generate_wayland_protocol_server_sources target) ) add_custom_command( OUTPUT "${waylandscanner_code_output}" - COMMAND Wayland::Scanner --include-core-only public-code < "${protocol_file}" > "${waylandscanner_code_output}" + COMMAND Wayland::Scanner --include-core-only ${wayland_scanner_code_option} < "${protocol_file}" > "${waylandscanner_code_output}" DEPENDS ${protocol_file} Wayland::Scanner ) From c82535143ab38aa0ed39bc2109f86415a6768bf3 Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Thu, 8 Aug 2024 14:12:34 +0100 Subject: [PATCH 1386/1507] client: Correct argument name in input events Input events sometimes carry serials or times, sometimes both, depending on the event. The code has drifted from the spec. In the worst case we are setting a serial as a timestamp which is very wrong. Change-Id: I82397e06a432de79ef71475882673da4568743ca Reviewed-by: David Redondo --- .../platforms/wayland/qwaylandinputdevice.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index c72c2a81452..a3f5d5ab5eb 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -735,12 +735,12 @@ public: {} }; -void QWaylandInputDevice::Pointer::pointer_leave(uint32_t time, struct wl_surface *surface) +void QWaylandInputDevice::Pointer::pointer_leave(uint32_t serial, struct wl_surface *surface) { invalidateFocus(); mButtons = Qt::NoButton; - mParent->mTime = time; + mParent->mSerial = serial; // The event may arrive after destroying the window, indicated by // a null surface. @@ -1266,9 +1266,9 @@ void QWaylandInputDevice::Keyboard::keyboard_keymap(uint32_t format, int32_t fd, #endif } -void QWaylandInputDevice::Keyboard::keyboard_enter(uint32_t time, struct wl_surface *surface, struct wl_array *keys) +void QWaylandInputDevice::Keyboard::keyboard_enter(uint32_t serial, struct wl_surface *surface, struct wl_array *keys) { - Q_UNUSED(time); + Q_UNUSED(serial); Q_UNUSED(keys); if (!surface) { @@ -1292,9 +1292,9 @@ void QWaylandInputDevice::Keyboard::keyboard_enter(uint32_t time, struct wl_surf mParent->mQDisplay->handleKeyboardFocusChanged(mParent); } -void QWaylandInputDevice::Keyboard::keyboard_leave(uint32_t time, struct wl_surface *surface) +void QWaylandInputDevice::Keyboard::keyboard_leave(uint32_t serial, struct wl_surface *surface) { - Q_UNUSED(time); + Q_UNUSED(serial); if (!surface) { // Either a compositor bug, or a race condition with wl_surface.destroy, ignore the event. From b2161c6bad1f18d21378c761954b0db0246ca4fe Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Thu, 25 Jul 2024 16:50:10 +0100 Subject: [PATCH 1387/1507] client: Update internal geometry before notifying shell surfaces Some shell surfaces will query sizes on the window directly. In particular Xdg Shell Popup repositioning. The update is still processed before the expose event, so we have a chance to pause rendering for async geometry changes. Change-Id: I3961b282dbb450c864e3543ef267ddcd7a9c36d7 Reviewed-by: David Edmundson --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 581d353aaf0..23abf529e1f 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -431,6 +431,13 @@ void QWaylandWindow::setGeometry_helper(const QRect &rect) void QWaylandWindow::setGeometry(const QRect &r) { + auto rect = r; + if (fixedToplevelPositions && !QPlatformWindow::parent() && window()->type() != Qt::Popup + && window()->type() != Qt::ToolTip) { + rect.moveTo(screen()->geometry().topLeft()); + } + setGeometry_helper(rect); + if (mShellSurface) { if (!mInResizeFromApplyConfigure) { const QRect frameGeometry = r.marginsAdded(clientSideMargins()).marginsRemoved(windowContentMargins()); @@ -441,13 +448,6 @@ void QWaylandWindow::setGeometry(const QRect &r) } } - auto rect = r; - if (fixedToplevelPositions && !QPlatformWindow::parent() && window()->type() != Qt::Popup - && window()->type() != Qt::ToolTip) { - rect.moveTo(screen()->geometry().topLeft()); - } - setGeometry_helper(rect); - if (window()->isVisible() && rect.isValid()) { if (mWindowDecorationEnabled) mWindowDecoration->update(); From ce176682bcea43b7ffaa14d14062b5a2b4fe8891 Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Mon, 15 Jul 2024 12:59:51 +0100 Subject: [PATCH 1388/1507] Client: Add test that we always respond to configure events Change-Id: I35ca2bb3287efa4c79f1352ebc7f5da872b2d4ce Reviewed-by: Vlad Zahorodnii --- tests/auto/wayland/xdgshell/tst_xdgshell.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/tests/auto/wayland/xdgshell/tst_xdgshell.cpp b/tests/auto/wayland/xdgshell/tst_xdgshell.cpp index 1dc57e28050..a14f103219c 100644 --- a/tests/auto/wayland/xdgshell/tst_xdgshell.cpp +++ b/tests/auto/wayland/xdgshell/tst_xdgshell.cpp @@ -111,11 +111,30 @@ void tst_xdgshell::configureSize() const QSize configureSize(60, 40); + int pendingSerial; exec([&] { xdgToplevel()->sendCompleteConfigure(configureSize); + pendingSerial = xdgSurface()->m_pendingConfigureSerials.last(); }); QTRY_COMPARE(configureSpy.size(), 1); + QCOMPARE(configureSpy.last()[0].toInt(), pendingSerial); + + exec([&] { + Buffer *buffer = xdgToplevel()->surface()->m_committed.buffer; + QVERIFY(buffer); + QCOMPARE(buffer->size(), configureSize); + }); + + // clients should always respond with a new ack configure + commit + // even if nothing changed + exec([&] { + xdgToplevel()->sendCompleteConfigure(configureSize); + pendingSerial = xdgSurface()->m_pendingConfigureSerials.last(); + }); + + QTRY_COMPARE(configureSpy.size(), 2); + QCOMPARE(configureSpy.last()[0].toInt(), pendingSerial); exec([&] { Buffer *buffer = xdgToplevel()->surface()->m_committed.buffer; From af6f5158061b81048f0de0ea8c0e07a08bbb18ae Mon Sep 17 00:00:00 2001 From: Tim Blechmann Date: Tue, 13 Aug 2024 13:06:10 +0800 Subject: [PATCH 1389/1507] Fix compilation with -qreal float Task-number: QTBUG-118877 Pick-to: 6.8 Change-Id: Ie5d4f8b500276e0939da6899306fcd6c87b226df Reviewed-by: David Edmundson --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 23abf529e1f..bdc0f282b7c 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -1442,8 +1442,8 @@ void QWaylandWindow::handleScreensChanged() void QWaylandWindow::updateScale() { if (mFractionalScale) { - auto preferredScale = mFractionalScale->preferredScale().value_or(1.0); - preferredScale = std::max(1.0, preferredScale); + qreal preferredScale = mFractionalScale->preferredScale().value_or(1.0); + preferredScale = std::max(1.0, preferredScale); Q_ASSERT(mViewport); setScale(preferredScale); return; From 458aadde4271b583e7958154a2a12ab7475515c3 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Thu, 15 Aug 2024 08:24:42 +0200 Subject: [PATCH 1390/1507] doc: Add "since"-note about 6.8 additions in cmake API The PUBLIC_CODE/PRIVATE_CODE APIs were added to the cmake functions in Qt 6.8, so this should be mentioned in the docs. Pick-to: 6.8 Change-Id: I0430cbc659ddd2db65401b94811ca0d4c8f12010 Reviewed-by: David Redondo --- .../cmake/qt_generate_wayland_protocol_client_sources.qdoc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/wayland/doc/src/cmake/qt_generate_wayland_protocol_client_sources.qdoc b/src/plugins/platforms/wayland/doc/src/cmake/qt_generate_wayland_protocol_client_sources.qdoc index d62a5a2b161..18621b17e0f 100644 --- a/src/plugins/platforms/wayland/doc/src/cmake/qt_generate_wayland_protocol_client_sources.qdoc +++ b/src/plugins/platforms/wayland/doc/src/cmake/qt_generate_wayland_protocol_client_sources.qdoc @@ -36,8 +36,8 @@ qt_generate_wayland_protocol_client_sources() creates the build steps to run \c{ code in C and C++ for implementing the protocols, and the resulting files will be built as part of the \c target. -The options \c{PUBLIC_CODE} and \c{PRIVATE_CODE} correspond to the \c{public-code} and -\c{private-code} options of \c{wayland-scanner}. \c{PUBLIC_CODE} will cause the symbols in the +The options \c{PUBLIC_CODE} and \c{PRIVATE_CODE} (added in Qt 6.8) correspond to the \c{public-code} +and \c{private-code} options of \c{wayland-scanner}. \c{PUBLIC_CODE} will cause the symbols in the code that is generated by \c{wayland-scanner} to be exported. For backwards compatibility \c{PUBLIC_CODE} is the default but generally \c{PRIVATE_CODE} is strongly recommended. From 92952bd04a0452a45140ed9c9494279683bb80e1 Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Thu, 15 Aug 2024 15:12:54 +0100 Subject: [PATCH 1391/1507] tests: Fix flakey reconnection test testMultiScreen explicitly sets clients on monitors, for this to work we need autoEnter disabled Change-Id: Icb29b743ff8e645b4f22113a87a1ae09683fb044 Reviewed-by: David Redondo --- tests/auto/wayland/reconnect/tst_reconnect.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/auto/wayland/reconnect/tst_reconnect.cpp b/tests/auto/wayland/reconnect/tst_reconnect.cpp index ff806af6a17..c45d63542b9 100644 --- a/tests/auto/wayland/reconnect/tst_reconnect.cpp +++ b/tests/auto/wayland/reconnect/tst_reconnect.cpp @@ -121,6 +121,7 @@ tst_WaylandReconnect::tst_WaylandReconnect() qputenv("WAYLAND_DISPLAY", socketName); m_comp.reset(new DefaultCompositor(CoreCompositor::Default, dup(socketFd))); + m_comp->m_config.autoEnter = false; } void tst_WaylandReconnect::triggerReconnect() @@ -136,6 +137,7 @@ void tst_WaylandReconnect::basicWindow() window.resize(64, 48); window.show(); QCOMPOSITOR_TRY_VERIFY(m_comp->xdgToplevel()); + m_comp->surface(0)->sendEnter(m_comp->output(0)); triggerReconnect(); From 4ef2c11560484f19ad43cfa98b072ef679dc7728 Mon Sep 17 00:00:00 2001 From: Michael Weghorn Date: Fri, 26 Jul 2024 16:43:05 +0200 Subject: [PATCH 1392/1507] Mark QWaylandWindow::windowTitle as overriding base class impl QPlatformWindow::windowTitle is newly introduced in qtbase and matches the semantics that QWaylandWindow::windowTitle already implements, so mark it as overriding the base class implementation. Task-number: QTBUG-127563 Change-Id: Ia43359a494fde41314220c8d57783d114d9b8fa4 Reviewed-by: David Redondo --- src/plugins/platforms/wayland/qwaylandwindow_p.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index c165125501b..b37a9bad812 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -93,7 +93,7 @@ public: void setVisible(bool visible) override; void setParent(const QPlatformWindow *parent) override; - QString windowTitle() const; + QString windowTitle() const override; void setWindowTitle(const QString &title) override; inline QIcon windowIcon() const; From e168e1fc80231c0e2751b4f6f2a736efadff92fa Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Mon, 2 Sep 2024 18:18:04 +0200 Subject: [PATCH 1393/1507] client: Provide seat name to QPointingDevice Followup to c16f6d40518fce6576c311c658956e21f7d52372 Task-number: QTBUG-85272 Task-number: QTBUG-115207 Pick-to: 6.8 Change-Id: Icb6053e76432bb9ef58f1457da073695a674c6f6 Reviewed-by: David Edmundson --- src/plugins/platforms/wayland/qwaylandinputdevice.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index a3f5d5ab5eb..79bfd6d11fd 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -446,7 +446,7 @@ void QWaylandInputDevice::seat_capabilities(uint32_t caps) mTouchPadDevice = new QPointingDevice( QLatin1String("touchpad"), 0, QInputDevice::DeviceType::TouchPad, QPointingDevice::PointerType::Finger, QInputDevice::Capability::Position, - MaxTouchPoints, 0, QString(), QPointingDeviceUniqueId(), this); + MaxTouchPoints, 0, mSeatName, QPointingDeviceUniqueId(), this); QWindowSystemInterface::registerInputDevice(mTouchPadDevice); mPointerGesturePinch.reset(pointerGestures->createPointerGesturePinch(this)); mPointerGesturePinch->init(pointerGestures->get_pinch_gesture(mPointer->object())); @@ -467,7 +467,7 @@ void QWaylandInputDevice::seat_capabilities(uint32_t caps) mTouchDevice = new QPointingDevice( QLatin1String("some touchscreen"), 0, QInputDevice::DeviceType::TouchScreen, QPointingDevice::PointerType::Finger, QInputDevice::Capability::Position, - MaxTouchPoints, 0,QString(), QPointingDeviceUniqueId(), this); + MaxTouchPoints, 0, mSeatName, QPointingDeviceUniqueId(), this); QWindowSystemInterface::registerInputDevice(mTouchDevice); } } else if (!(caps & WL_SEAT_CAPABILITY_TOUCH) && mTouch) { From bb151390240c1f20a6464adbefa497f3559554dd Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Wed, 12 Jul 2023 14:22:44 +0200 Subject: [PATCH 1394/1507] Client: Register QPointingDevices for graphics tablet devices Followup to 4d844d36404597713a63879dc24f051de0ad3e5b Reference material: https://wayland.app/protocols/tablet-unstable-v2 It's not clear how to get the number of buttons on a stylus. QWaylandTabletToolV2::zwp_tablet_tool_v2_removed() is called when a stylus leaves proximity; but we avoid deleting the QWaylandTabletToolV2 instance too soon, because a proximity leave event may be in flight at the same time, carrying a pointer to the stylus device. Instead, each "dead" tool is deleted when another enters. The tablet protocol makes it difficult to retain the same instances indefinitely, as we would otherwise do: the zwp_tablet_tool_v2 is constructed elsewhere, a pointer is given to the QWaylandTabletToolV2 ctor and retained. So a "dead" tool may hold a dangling pointer; and at the time a new QWaylandTabletToolV2 instance is constructed, its details are not yet known, so it would not be possible to look up and reuse an existing matching instance (as we would otherwise probably do). Task-number: QTBUG-72167 Task-number: QTBUG-112432 Task-number: QTBUG-115207 Pick-to: 6.8 Change-Id: I3423a0d0bd2aae5be4e61cc60da8c3362a80d10e Reviewed-by: Liang Qi --- .../platforms/wayland/qwaylandinputdevice.cpp | 1 + .../platforms/wayland/qwaylandinputdevice_p.h | 2 + .../platforms/wayland/qwaylandtabletv2.cpp | 266 +++++++++++++----- .../platforms/wayland/qwaylandtabletv2_p.h | 36 ++- 4 files changed, 219 insertions(+), 86 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index 79bfd6d11fd..a34ea340b81 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -385,6 +385,7 @@ QWaylandInputDevice::QWaylandInputDevice(QWaylandDisplay *display, int version, : QtWayland::wl_seat(display->wl_registry(), id, qMin(version, 9)) , mQDisplay(display) , mDisplay(display->wl_display()) + , mId(id) { #if QT_CONFIG(wayland_datadevice) if (mQDisplay->dndSelectionHandler()) { diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h index 06a9f55d163..88f2d7085a1 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h +++ b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h @@ -83,6 +83,7 @@ public: QWaylandInputDevice(QWaylandDisplay *display, int version, uint32_t id); ~QWaylandInputDevice() override; + uint32_t id() const { return mId; } uint32_t capabilities() const { return mCaps; } QString seatname() const { return mSeatName; } @@ -144,6 +145,7 @@ protected: QWaylandDisplay *mQDisplay = nullptr; struct wl_display *mDisplay = nullptr; + uint32_t mId = -1; uint32_t mCaps = 0; QString mSeatName; diff --git a/src/plugins/platforms/wayland/qwaylandtabletv2.cpp b/src/plugins/platforms/wayland/qwaylandtabletv2.cpp index e15185f08ef..72fe1664d36 100644 --- a/src/plugins/platforms/wayland/qwaylandtabletv2.cpp +++ b/src/plugins/platforms/wayland/qwaylandtabletv2.cpp @@ -5,14 +5,21 @@ #include "qwaylandinputdevice_p.h" #include "qwaylanddisplay_p.h" #include "qwaylandsurface_p.h" +#include QT_BEGIN_NAMESPACE namespace QtWaylandClient { +using namespace Qt::StringLiterals; + +Q_LOGGING_CATEGORY(lcQpaInputDevices, "qt.qpa.input.devices") +Q_DECLARE_LOGGING_CATEGORY(lcQpaWaylandInput) + QWaylandTabletManagerV2::QWaylandTabletManagerV2(QWaylandDisplay *display, uint id, uint version) : zwp_tablet_manager_v2(display->wl_registry(), id, qMin(version, uint(1))) { + qCDebug(lcQpaInputDevices, "new tablet manager: ID %d version %d", id, version); } QWaylandTabletManagerV2::~QWaylandTabletManagerV2() @@ -24,6 +31,7 @@ QWaylandTabletSeatV2::QWaylandTabletSeatV2(QWaylandTabletManagerV2 *manager, QWa : QtWayland::zwp_tablet_seat_v2(manager->get_tablet_seat(seat->wl_seat())) , m_seat(seat) { + qCDebug(lcQpaInputDevices) << "new tablet seat" << seat->seatname() << "id" << seat->id(); } QWaylandTabletSeatV2::~QWaylandTabletSeatV2() @@ -36,108 +44,205 @@ QWaylandTabletSeatV2::~QWaylandTabletSeatV2() pad->destroy(); qDeleteAll(m_tablets); qDeleteAll(m_tools); + qDeleteAll(m_deadTools); qDeleteAll(m_pads); destroy(); } void QWaylandTabletSeatV2::zwp_tablet_seat_v2_tablet_added(zwp_tablet_v2 *id) { - auto *tablet = new QWaylandTabletV2(id); + auto *tablet = new QWaylandTabletV2(id, m_seat->seatname()); + qCDebug(lcQpaInputDevices) << "seat" << this << id << "has tablet" << tablet; + tablet->setParent(this); m_tablets.push_back(tablet); connect(tablet, &QWaylandTabletV2::destroyed, this, [this, tablet] { m_tablets.removeOne(tablet); }); } void QWaylandTabletSeatV2::zwp_tablet_seat_v2_tool_added(zwp_tablet_tool_v2 *id) { + qDeleteAll(m_deadTools); auto *tool = new QWaylandTabletToolV2(this, id); + if (m_tablets.size() == 1) { + tool->setParent(m_tablets.first()); + QPointingDevicePrivate *d = QPointingDevicePrivate::get(tool); + d->name = m_tablets.first()->name() + u" stylus"; + } else { + qCDebug(lcQpaInputDevices) << "seat" << this << "has tool" << tool << "for one of these tablets:" << m_tablets; + // TODO identify which tablet if there are several; then tool->setParent(tablet) + } m_tools.push_back(tool); - connect(tool, &QWaylandTabletToolV2::destroyed, this, [this, tool] { m_tools.removeOne(tool); }); + connect(tool, &QWaylandTabletToolV2::destroyed, this, [this, tool] { + m_tools.removeOne(tool); + m_deadTools.removeOne(tool); + }); } void QWaylandTabletSeatV2::zwp_tablet_seat_v2_pad_added(zwp_tablet_pad_v2 *id) { auto *pad = new QWaylandTabletPadV2(id); + if (m_tablets.size() == 1) { + pad->setParent(m_tablets.first()); + QPointingDevicePrivate *d = QPointingDevicePrivate::get(pad); + d->name = m_tablets.first()->name() + u" touchpad"; + } else { + qCDebug(lcQpaInputDevices) << "seat" << this << "has touchpad" << pad << "for one of these tablets:" << m_tablets; + // TODO identify which tablet if there are several + } m_pads.push_back(pad); connect(pad, &QWaylandTabletPadV2::destroyed, this, [this, pad] { m_pads.removeOne(pad); }); } -QWaylandTabletV2::QWaylandTabletV2(::zwp_tablet_v2 *tablet) - : QtWayland::zwp_tablet_v2(tablet) +QWaylandTabletV2::QWaylandTabletV2(::zwp_tablet_v2 *tablet, const QString &seatName) + : QPointingDevice(u"unknown"_s, -1, DeviceType::Stylus, PointerType::Pen, + Capability::Position | Capability::Hover, + 1, 1) + , QtWayland::zwp_tablet_v2(tablet) { + qCDebug(lcQpaInputDevices) << "new tablet on seat" << seatName; + QPointingDevicePrivate *d = QPointingDevicePrivate::get(this); + d->seatName = seatName; +} + +void QWaylandTabletV2::zwp_tablet_v2_name(const QString &name) +{ + QPointingDevicePrivate *d = QPointingDevicePrivate::get(this); + d->name = name; +} + +void QWaylandTabletV2::zwp_tablet_v2_id(uint32_t vid, uint32_t pid) +{ + QPointingDevicePrivate *d = QPointingDevicePrivate::get(this); + d->systemId = (quint64(vid) << 32) | pid; + qCDebug(lcQpaInputDevices) << "vid" << vid << "pid" << pid << "stored as systemId in" << this; +} + +void QWaylandTabletV2::zwp_tablet_v2_path(const QString &path) +{ + QPointingDevicePrivate *d = QPointingDevicePrivate::get(this); + d->busId = path; +} + +void QWaylandTabletV2::zwp_tablet_v2_done() +{ + QWindowSystemInterface::registerInputDevice(this); +} + +void QWaylandTabletSeatV2::toolRemoved(QWaylandTabletToolV2 *tool) +{ + m_tools.removeOne(tool); + m_deadTools.append(tool); } void QWaylandTabletV2::zwp_tablet_v2_removed() { destroy(); - delete this; + deleteLater(); } QWaylandTabletToolV2::QWaylandTabletToolV2(QWaylandTabletSeatV2 *tabletSeat, ::zwp_tablet_tool_v2 *tool) - : QtWayland::zwp_tablet_tool_v2(tool) + : QPointingDevice(u"tool"_s, -1, DeviceType::Stylus, PointerType::Pen, + Capability::Position | Capability::Hover, + 1, 1) + , QtWayland::zwp_tablet_tool_v2(tool) , m_tabletSeat(tabletSeat) { + // TODO get the number of buttons somehow? } void QWaylandTabletToolV2::zwp_tablet_tool_v2_type(uint32_t tool_type) { - m_toolType = type(tool_type); + QPointingDevicePrivate *d = QPointingDevicePrivate::get(this); + + switch (tool_type) { + case type_airbrush: + case type_brush: + case type_pencil: + case type_pen: + d->pointerType = QPointingDevice::PointerType::Pen; + break; + case type_eraser: + d->pointerType = QPointingDevice::PointerType::Eraser; + break; + case type_mouse: + case type_lens: + d->pointerType = QPointingDevice::PointerType::Cursor; + break; + case type_finger: + d->pointerType = QPointingDevice::PointerType::Unknown; + break; + } + + switch (tool_type) { + case type::type_airbrush: + d->deviceType = QInputDevice::DeviceType::Airbrush; + d->capabilities.setFlag(QInputDevice::Capability::TangentialPressure); + break; + case type::type_brush: + case type::type_pencil: + case type::type_pen: + case type::type_eraser: + d->deviceType = QInputDevice::DeviceType::Stylus; + break; + case type::type_lens: + d->deviceType = QInputDevice::DeviceType::Puck; + break; + case type::type_mouse: + case type::type_finger: + d->deviceType = QInputDevice::DeviceType::Unknown; + break; + } } void QWaylandTabletToolV2::zwp_tablet_tool_v2_hardware_serial(uint32_t hardware_serial_hi, uint32_t hardware_serial_lo) { - m_uid = (quint64(hardware_serial_hi) << 32) + hardware_serial_lo; + QPointingDevicePrivate *d = QPointingDevicePrivate::get(this); + d->uniqueId = QPointingDeviceUniqueId::fromNumericId((quint64(hardware_serial_hi) << 32) + hardware_serial_lo); +} + +void QWaylandTabletToolV2::zwp_tablet_tool_v2_hardware_id_wacom(uint32_t hardware_id_hi, uint32_t hardware_id_lo) +{ + QPointingDevicePrivate *d = QPointingDevicePrivate::get(this); + d->systemId = (quint64(hardware_id_hi) << 32) + hardware_id_lo; } void QWaylandTabletToolV2::zwp_tablet_tool_v2_capability(uint32_t capability) { - if (capability == capability_rotation) - m_hasRotation = true; + QPointingDevicePrivate *d = QPointingDevicePrivate::get(this); + switch (capability) { + case capability_tilt: + // no distinction... we have to assume it has both axes + d->capabilities.setFlag(QInputDevice::Capability::XTilt); + d->capabilities.setFlag(QInputDevice::Capability::YTilt); + break; + case capability_pressure: + d->capabilities.setFlag(QInputDevice::Capability::Pressure); + break; + case capability_distance: + d->capabilities.setFlag(QInputDevice::Capability::ZPosition); + break; + case capability_rotation: + d->capabilities.setFlag(QInputDevice::Capability::Rotation); + break; + case capability_slider: + // nothing to represent that so far + break; + case capability_wheel: + d->capabilities.setFlag(QInputDevice::Capability::Scroll); + d->capabilities.setFlag(QInputDevice::Capability::PixelScroll); + break; + } + qCDebug(lcQpaInputDevices) << capability << "->" << this; } void QWaylandTabletToolV2::zwp_tablet_tool_v2_done() { - switch (m_toolType) { - case type::type_airbrush: - case type::type_brush: - case type::type_pencil: - case type::type_pen: - m_pointerType = QPointingDevice::PointerType::Pen; - break; - case type::type_eraser: - m_pointerType = QPointingDevice::PointerType::Eraser; - break; - case type::type_mouse: - case type::type_lens: - m_pointerType = QPointingDevice::PointerType::Cursor; - break; - case type::type_finger: - m_pointerType = QPointingDevice::PointerType::Unknown; - break; - } - switch (m_toolType) { - case type::type_airbrush: - m_tabletDevice = QInputDevice::DeviceType::Airbrush; - break; - case type::type_brush: - case type::type_pencil: - case type::type_pen: - case type::type_eraser: - m_tabletDevice = QInputDevice::DeviceType::Stylus; - break; - case type::type_lens: - m_tabletDevice = QInputDevice::DeviceType::Puck; - break; - case type::type_mouse: - case type::type_finger: - m_tabletDevice = QInputDevice::DeviceType::Unknown; - break; - } + QWindowSystemInterface::registerInputDevice(this); } void QWaylandTabletToolV2::zwp_tablet_tool_v2_removed() { destroy(); - delete this; + m_tabletSeat->toolRemoved(this); } void QWaylandTabletToolV2::zwp_tablet_tool_v2_proximity_in(uint32_t serial, zwp_tablet_v2 *tablet, wl_surface *surface) @@ -226,27 +331,41 @@ void QWaylandTabletToolV2::zwp_tablet_tool_v2_button(uint32_t serial, uint32_t b { m_tabletSeat->seat()->mSerial = serial; + QPointingDevicePrivate *d = QPointingDevicePrivate::get(this); Qt::MouseButton mouseButton = mouseButtonFromTablet(button); if (state == button_state_pressed) m_pending.buttons |= mouseButton; else m_pending.buttons &= ~mouseButton; + // ideally we'd get button count when the tool is discovered; seems to be a shortcoming in tablet-unstable-v2 + // but if we get events from buttons we didn't know existed, increase it + if (mouseButton == Qt::RightButton) + d->buttonCount = qMax(d->buttonCount, 2); + else if (mouseButton == Qt::MiddleButton) + d->buttonCount = qMax(d->buttonCount, 3); } void QWaylandTabletToolV2::zwp_tablet_tool_v2_frame(uint32_t time) { - if (m_pending.proximitySurface && !m_applied.proximitySurface) { - QWindowSystemInterface::handleTabletEnterProximityEvent(int(m_tabletDevice), int(m_pointerType), m_uid); + if (!m_pending.proximitySurface) { + qCWarning(lcQpaWayland) << "Can't send tablet event with no proximity surface, ignoring"; + if (m_applied.enteredSurface) { + QWindowSystemInterface::handleTabletEnterLeaveProximityEvent(nullptr, this, false); + m_pending = State(); // Don't leave pressure etc. lying around when we enter the next surface + } + return; + } + + QWaylandWindow *waylandWindow = QWaylandWindow::fromWlSurface(m_pending.proximitySurface->object()); + QWindow *window = waylandWindow->window(); + + if (!m_applied.proximitySurface) { + // TODO get position etc. as below + QWindowSystemInterface::handleTabletEnterLeaveProximityEvent(window, this, true); m_applied.proximitySurface = m_pending.proximitySurface; } - if (!(m_pending == m_applied) && m_pending.proximitySurface) { - if (!m_pending.proximitySurface) { - qCWarning(lcQpaWayland) << "Can't send tablet event with no proximity surface, ignoring"; - return; - } - QWaylandWindow *waylandWindow = QWaylandWindow::fromWlSurface(m_pending.proximitySurface->object()); - QWindow *window = waylandWindow->window(); + if (!(m_pending == m_applied)) { ulong timestamp = time; const QPointF localPosition = waylandWindow->mapFromWlSurface(m_pending.surfacePosition); @@ -263,15 +382,10 @@ void QWaylandTabletToolV2::zwp_tablet_tool_v2_frame(uint32_t time) qreal rotation = m_pending.rotation; int z = int(m_pending.distance); - QWindowSystemInterface::handleTabletEvent( - window, timestamp, localPosition, globalPosition, int(m_tabletDevice), - int(m_pointerType), buttons, pressure, xTilt, yTilt, tangentialPressure, rotation, - z, m_uid, m_tabletSeat->seat()->modifiers()); - } - - if (!m_pending.proximitySurface && m_applied.enteredSurface) { - QWindowSystemInterface::handleTabletLeaveProximityEvent(int(m_tabletDevice), int(m_pointerType), m_uid); - m_pending = State(); // Don't leave pressure etc. lying around when we enter the next surface + QWindowSystemInterface::handleTabletEvent(window, timestamp, this, localPosition, globalPosition, + buttons, pressure, + xTilt, yTilt, tangentialPressure, rotation, z, + m_tabletSeat->seat()->modifiers()); } m_applied = m_pending; @@ -294,10 +408,30 @@ bool QWaylandTabletToolV2::State::operator==(const QWaylandTabletToolV2::State & } QWaylandTabletPadV2::QWaylandTabletPadV2(::zwp_tablet_pad_v2 *pad) - : QtWayland::zwp_tablet_pad_v2(pad) + : QPointingDevice(u"tablet touchpad"_s, -1, DeviceType::TouchPad, PointerType::Finger, + Capability::Position, + 1, 1) + , QtWayland::zwp_tablet_pad_v2(pad) { } +void QWaylandTabletPadV2::zwp_tablet_pad_v2_path(const QString &path) +{ + QPointingDevicePrivate *d = QPointingDevicePrivate::get(this); + d->busId = path; +} + +void QWaylandTabletPadV2::zwp_tablet_pad_v2_buttons(uint32_t buttons) +{ + QPointingDevicePrivate *d = QPointingDevicePrivate::get(this); + d->buttonCount = buttons; +} + +void QWaylandTabletPadV2::zwp_tablet_pad_v2_done() +{ + QWindowSystemInterface::registerInputDevice(this); +} + void QWaylandTabletPadV2::zwp_tablet_pad_v2_removed() { destroy(); diff --git a/src/plugins/platforms/wayland/qwaylandtabletv2_p.h b/src/plugins/platforms/wayland/qwaylandtabletv2_p.h index f6f1daa9886..b101826e4ac 100644 --- a/src/plugins/platforms/wayland/qwaylandtabletv2_p.h +++ b/src/plugins/platforms/wayland/qwaylandtabletv2_p.h @@ -54,6 +54,8 @@ public: QWaylandInputDevice *seat() const { return m_seat; } + void toolRemoved(QWaylandTabletToolV2 *tool); + protected: void zwp_tablet_seat_v2_tablet_added(struct ::zwp_tablet_v2 *id) override; void zwp_tablet_seat_v2_tool_added(struct ::zwp_tablet_tool_v2 *id) override; @@ -63,24 +65,26 @@ private: QWaylandInputDevice *m_seat; QList m_tablets; QList m_tools; + QList m_deadTools; QList m_pads; }; -class Q_WAYLANDCLIENT_EXPORT QWaylandTabletV2 : public QObject, public QtWayland::zwp_tablet_v2 +class Q_WAYLANDCLIENT_EXPORT QWaylandTabletV2 : public QPointingDevice, public QtWayland::zwp_tablet_v2 { Q_OBJECT public: - explicit QWaylandTabletV2(::zwp_tablet_v2 *tablet); + explicit QWaylandTabletV2(::zwp_tablet_v2 *tablet, const QString &seatName); protected: -// void zwp_tablet_v2_name(const QString &name) override; -// void zwp_tablet_v2_id(uint32_t vid, uint32_t pid) override; -// void zwp_tablet_v2_path(const QString &path) override; -// void zwp_tablet_v2_done() override; + // callbacks which act as setters + void zwp_tablet_v2_name(const QString &name) override; + void zwp_tablet_v2_id(uint32_t vid, uint32_t pid) override; + void zwp_tablet_v2_path(const QString &path) override; + void zwp_tablet_v2_done() override; void zwp_tablet_v2_removed() override; }; -class Q_WAYLANDCLIENT_EXPORT QWaylandTabletToolV2 : public QObject, public QtWayland::zwp_tablet_tool_v2 +class Q_WAYLANDCLIENT_EXPORT QWaylandTabletToolV2 : public QPointingDevice, public QtWayland::zwp_tablet_tool_v2 { Q_OBJECT public: @@ -89,7 +93,7 @@ public: protected: void zwp_tablet_tool_v2_type(uint32_t tool_type) override; void zwp_tablet_tool_v2_hardware_serial(uint32_t hardware_serial_hi, uint32_t hardware_serial_lo) override; -// void zwp_tablet_tool_v2_hardware_id_wacom(uint32_t hardware_id_hi, uint32_t hardware_id_lo) override; + void zwp_tablet_tool_v2_hardware_id_wacom(uint32_t hardware_id_hi, uint32_t hardware_id_lo) override; void zwp_tablet_tool_v2_capability(uint32_t capability) override; void zwp_tablet_tool_v2_done() override; void zwp_tablet_tool_v2_removed() override; @@ -110,13 +114,6 @@ protected: private: QWaylandTabletSeatV2 *m_tabletSeat; - // Static state (sent before done event) - QPointingDevice::PointerType m_pointerType = QPointingDevice::PointerType::Unknown; - QInputDevice::DeviceType m_tabletDevice = QInputDevice::DeviceType::Unknown; - type m_toolType = type_pen; - bool m_hasRotation = false; - quint64 m_uid = 0; - // Accumulated state (applied on frame event) struct State { bool down = false; @@ -135,8 +132,7 @@ private: } m_pending, m_applied; }; -// We don't actually use this, but need to handle the "removed" event to comply with the protocol -class Q_WAYLANDCLIENT_EXPORT QWaylandTabletPadV2 : public QObject, public QtWayland::zwp_tablet_pad_v2 +class Q_WAYLANDCLIENT_EXPORT QWaylandTabletPadV2 : public QPointingDevice, public QtWayland::zwp_tablet_pad_v2 { Q_OBJECT public: @@ -144,9 +140,9 @@ public: protected: // void zwp_tablet_pad_v2_group(struct ::zwp_tablet_pad_group_v2 *pad_group) override; -// void zwp_tablet_pad_v2_path(const QString &path) override; -// void zwp_tablet_pad_v2_buttons(uint32_t buttons) override; -// void zwp_tablet_pad_v2_done() override; + void zwp_tablet_pad_v2_path(const QString &path) override; + void zwp_tablet_pad_v2_buttons(uint32_t buttons) override; + void zwp_tablet_pad_v2_done() override; // void zwp_tablet_pad_v2_button(uint32_t time, uint32_t button, uint32_t state) override; // void zwp_tablet_pad_v2_enter(uint32_t serial, struct ::zwp_tablet_v2 *tablet, struct ::wl_surface *surface) override; // void zwp_tablet_pad_v2_leave(uint32_t serial, struct ::wl_surface *surface) override; From fcdef0cd5fc2b2d1acec1a3a2c96cc68d2495d13 Mon Sep 17 00:00:00 2001 From: Nicolas Fella Date: Sun, 7 Jul 2024 22:16:35 +0200 Subject: [PATCH 1395/1507] Client: Pass tablet input to decorations Otherwise decoration cannot be interacted with using a stylus. Since there is no reason for the decoration to distinguish between stylus and mouse input reuse the existing mouse handling instead of adding a dedicated tablet input function to the decoration API. Fixes: QTBUG-117920 Pick-to: 6.8 Change-Id: I947e5b4f638fb3c2b15a1ca4ed01c02caf9d4812 Reviewed-by: Shawn Rutledge --- .../platforms/wayland/qwaylandtabletv2.cpp | 17 +++++++++++++---- .../platforms/wayland/qwaylandwindow.cpp | 10 ++++++++++ .../platforms/wayland/qwaylandwindow_p.h | 3 +++ 3 files changed, 26 insertions(+), 4 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandtabletv2.cpp b/src/plugins/platforms/wayland/qwaylandtabletv2.cpp index 72fe1664d36..f4870217e00 100644 --- a/src/plugins/platforms/wayland/qwaylandtabletv2.cpp +++ b/src/plugins/platforms/wayland/qwaylandtabletv2.cpp @@ -382,10 +382,19 @@ void QWaylandTabletToolV2::zwp_tablet_tool_v2_frame(uint32_t time) qreal rotation = m_pending.rotation; int z = int(m_pending.distance); - QWindowSystemInterface::handleTabletEvent(window, timestamp, this, localPosition, globalPosition, - buttons, pressure, - xTilt, yTilt, tangentialPressure, rotation, z, - m_tabletSeat->seat()->modifiers()); + // do not use localPosition here since that is in Qt window coordinates + // but we need surface coordinates to include the decoration + bool decorationHandledEvent = waylandWindow->handleTabletEventDecoration( + m_tabletSeat->seat(), m_pending.surfacePosition, + window->mapToGlobal(m_pending.surfacePosition) + delta, buttons, + m_tabletSeat->seat()->modifiers()); + + if (!decorationHandledEvent) { + QWindowSystemInterface::handleTabletEvent(window, timestamp, this, localPosition, globalPosition, + buttons, pressure, + xTilt, yTilt, tangentialPressure, rotation, z, + m_tabletSeat->seat()->modifiers()); + } } m_applied = m_pending; diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index bdc0f282b7c..ef4dfba743d 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -1360,6 +1360,16 @@ bool QWaylandWindow::touchDragDecoration(QWaylandInputDevice *inputDevice, const return mWindowDecoration->handleTouch(inputDevice, local, global, state, mods); } +bool QWaylandWindow::handleTabletEventDecoration(QWaylandInputDevice *inputDevice, + const QPointF &local, const QPointF &global, + Qt::MouseButtons buttons, + Qt::KeyboardModifiers modifiers) +{ + if (!mWindowDecorationEnabled) + return false; + return mWindowDecoration->handleMouse(inputDevice, local, global, buttons, modifiers); +} + void QWaylandWindow::handleMouseEventWithDecoration(QWaylandInputDevice *inputDevice, const QWaylandPointerEvent &e) { if (mMousePressedInContentArea == Qt::NoButton && diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index b37a9bad812..b3da318e9b5 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -180,6 +180,9 @@ public: bool touchDragDecoration(QWaylandInputDevice *inputDevice, const QPointF &local, const QPointF &global, QEventPoint::State state, Qt::KeyboardModifiers mods); + bool handleTabletEventDecoration(QWaylandInputDevice *inputDevice, const QPointF &local, + const QPointF &global, Qt::MouseButtons buttons, + Qt::KeyboardModifiers modifiers); bool createDecoration(); From 5384317da85d3559b4ed8b02a65a58665f83c50b Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Sat, 7 Sep 2024 12:21:35 +0200 Subject: [PATCH 1396/1507] Move the declaration of the qLcQpaInputMethods category to the header MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Qt 6.8 requires it. qloggingcategory.h:168:67: warning: ‘const QLoggingCategory& qLcQpaInputMethods() [with = void]’ is deprecated: Use Q_STATIC_LOGGING_CATEGORY or add either Q_DECLARE_LOGGING_CATEGORY or QT_DECLARE_EXPORTED_QT_LOGGING_CATEGORY in a header [-Wdeprecated-declarations] Pick-to: 6.8 Change-Id: I41815e1c1bfdd5bab41cfffdd50d4679670398d8 Reviewed-by: Ulf Hermann --- src/plugins/platforms/wayland/qwaylandinputcontext.cpp | 1 - src/plugins/platforms/wayland/qwaylandinputcontext_p.h | 3 +++ src/plugins/platforms/wayland/qwaylandinputmethodcontext.cpp | 3 +-- src/plugins/platforms/wayland/qwaylandtextinputv1.cpp | 3 +-- src/plugins/platforms/wayland/qwaylandtextinputv2.cpp | 3 +-- 5 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandinputcontext.cpp b/src/plugins/platforms/wayland/qwaylandinputcontext.cpp index a38bb9a0a15..4d70f35facc 100644 --- a/src/plugins/platforms/wayland/qwaylandinputcontext.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputcontext.cpp @@ -4,7 +4,6 @@ #include "qwaylandinputcontext_p.h" -#include #include #include #include diff --git a/src/plugins/platforms/wayland/qwaylandinputcontext_p.h b/src/plugins/platforms/wayland/qwaylandinputcontext_p.h index e6ce21d3414..0076f20cd82 100644 --- a/src/plugins/platforms/wayland/qwaylandinputcontext_p.h +++ b/src/plugins/platforms/wayland/qwaylandinputcontext_p.h @@ -18,6 +18,7 @@ #include +#include #include #include "qwaylandtextinputinterface_p.h" @@ -31,6 +32,8 @@ struct wl_callback_listener; QT_BEGIN_NAMESPACE +Q_DECLARE_LOGGING_CATEGORY(qLcQpaInputMethods) + namespace QtWaylandClient { class QWaylandDisplay; diff --git a/src/plugins/platforms/wayland/qwaylandinputmethodcontext.cpp b/src/plugins/platforms/wayland/qwaylandinputmethodcontext.cpp index 2733e4f3aab..b0f55ef570c 100644 --- a/src/plugins/platforms/wayland/qwaylandinputmethodcontext.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputmethodcontext.cpp @@ -2,6 +2,7 @@ // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "qwaylandinputmethodcontext_p.h" +#include "qwaylandinputcontext_p.h" #include "qwaylanddisplay_p.h" #include "qwaylandinputdevice_p.h" @@ -11,8 +12,6 @@ QT_BEGIN_NAMESPACE -Q_DECLARE_LOGGING_CATEGORY(qLcQpaInputMethods) - namespace QtWaylandClient { static constexpr int maxStringSize = 1000; // actual max is 4096/3 diff --git a/src/plugins/platforms/wayland/qwaylandtextinputv1.cpp b/src/plugins/platforms/wayland/qwaylandtextinputv1.cpp index 846ed95c87b..dc999624b76 100644 --- a/src/plugins/platforms/wayland/qwaylandtextinputv1.cpp +++ b/src/plugins/platforms/wayland/qwaylandtextinputv1.cpp @@ -4,6 +4,7 @@ #include "qwaylandtextinputv1_p.h" +#include "qwaylandinputcontext_p.h" #include "qwaylandwindow_p.h" #include "qwaylandinputmethodeventbuilder_p.h" @@ -21,8 +22,6 @@ QT_BEGIN_NAMESPACE -Q_DECLARE_LOGGING_CATEGORY(qLcQpaInputMethods) - namespace QtWaylandClient { namespace { diff --git a/src/plugins/platforms/wayland/qwaylandtextinputv2.cpp b/src/plugins/platforms/wayland/qwaylandtextinputv2.cpp index 9d462f7d60b..9f767eaed00 100644 --- a/src/plugins/platforms/wayland/qwaylandtextinputv2.cpp +++ b/src/plugins/platforms/wayland/qwaylandtextinputv2.cpp @@ -5,6 +5,7 @@ #include "qwaylandtextinputv2_p.h" +#include "qwaylandinputcontext_p.h" #include "qwaylandwindow_p.h" #include "qwaylandinputmethodeventbuilder_p.h" @@ -22,8 +23,6 @@ QT_BEGIN_NAMESPACE -Q_DECLARE_LOGGING_CATEGORY(qLcQpaInputMethods) - namespace QtWaylandClient { namespace { From 555fd6e1e1f9ecdabe0203c093a7b45f75ae9784 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Sat, 7 Sep 2024 06:10:12 +0400 Subject: [PATCH 1397/1507] Client: Fix desktop environment check for decorations XDG_CURRENT_DESKTOP is an array and the current check doesn't work on e.g. Ubuntu Pick-to: 6.8 Change-Id: Iff049ad8dd432191f815c6c079448af02dc7a09a Reviewed-by: David Edmundson --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index ef4dfba743d..e43f8a274d7 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -1087,8 +1087,8 @@ bool QWaylandWindow::createDecoration() if (targetKey.isEmpty()) { auto unixServices = dynamic_cast( QGuiApplicationPrivate::platformIntegration()->services()); - const QByteArray currentDesktop = unixServices->desktopEnvironment(); - if (currentDesktop == "GNOME") { + const QList desktopNames = unixServices->desktopEnvironment().split(':'); + if (desktopNames.contains("GNOME")) { if (decorations.contains("adwaita"_L1)) targetKey = "adwaita"_L1; else if (decorations.contains("gnome"_L1)) From 92af4c8d2b4326b5fe420b40950ddfd96d940f81 Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Wed, 4 Sep 2024 15:09:11 +0200 Subject: [PATCH 1398/1507] client: Reset tablet state on proximity out; quiet the warning If !m_pending.proximitySurface, usually it's because the stylus is leaving proximity. The "no proximity surface" warning (introduced in 4d844d36404597713a63879dc24f051de0ad3e5b) only makes sense if neither applied nor pending state has a proximity service. If we are leaving proximity, reset m_applied state as well as m_pending state, because we don't expect any more tablet events until after the next proximity in event. There was a bug that subsequent proximity in events were not sent, because m_applied.proximitySurface was still set (leftover state). Amends bb151390240c1f20a6464adbefa497f3559554dd Pick-to: 6.8 Change-Id: I019e91eebb1958cd6c17393482cbae4c4ba9308d Reviewed-by: David Edmundson --- src/plugins/platforms/wayland/qwaylandtabletv2.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandtabletv2.cpp b/src/plugins/platforms/wayland/qwaylandtabletv2.cpp index f4870217e00..1a05eb8b963 100644 --- a/src/plugins/platforms/wayland/qwaylandtabletv2.cpp +++ b/src/plugins/platforms/wayland/qwaylandtabletv2.cpp @@ -348,10 +348,13 @@ void QWaylandTabletToolV2::zwp_tablet_tool_v2_button(uint32_t serial, uint32_t b void QWaylandTabletToolV2::zwp_tablet_tool_v2_frame(uint32_t time) { if (!m_pending.proximitySurface) { - qCWarning(lcQpaWayland) << "Can't send tablet event with no proximity surface, ignoring"; if (m_applied.enteredSurface) { + // leaving proximity QWindowSystemInterface::handleTabletEnterLeaveProximityEvent(nullptr, this, false); m_pending = State(); // Don't leave pressure etc. lying around when we enter the next surface + m_applied = State(); + } else { + qCWarning(lcQpaWayland) << "Can't send tablet event with no proximity surface, ignoring"; } return; } From ceebf0d57a0e034b0a5c4cb3894d949f5921b761 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Wed, 11 Sep 2024 15:31:39 +0400 Subject: [PATCH 1399/1507] Client: Ceil cursor's fallback buffer scale This should provide a crisper cursor Change-Id: Iaa3108cc2c6346e9db9755975ca2718875f470b7 Reviewed-by: David Edmundson --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index e43f8a274d7..a23d8093111 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -1495,7 +1495,7 @@ void QWaylandWindow::setScale(qreal newScale) #if QT_CONFIG(cursor) void QWaylandWindow::setMouseCursor(QWaylandInputDevice *device, const QCursor &cursor) { - int fallbackBufferScale = int(devicePixelRatio()); + int fallbackBufferScale = qCeil(devicePixelRatio()); device->setCursor(&cursor, {}, fallbackBufferScale); } From d749871d39dc17858acb621b1501080d63c2a5f4 Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Wed, 11 Sep 2024 20:41:45 +0200 Subject: [PATCH 1400/1507] tests: Send seat name on bind Pick-to: 6.8 Change-Id: I4cec8d6c26076f0213dbeb9ab3d39585936d0c25 Reviewed-by: David Edmundson --- tests/auto/wayland/shared/coreprotocol.cpp | 3 ++- tests/auto/wayland/shared/coreprotocol.h | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/auto/wayland/shared/coreprotocol.cpp b/tests/auto/wayland/shared/coreprotocol.cpp index 5d9c4e9a368..a6f391777c2 100644 --- a/tests/auto/wayland/shared/coreprotocol.cpp +++ b/tests/auto/wayland/shared/coreprotocol.cpp @@ -240,8 +240,9 @@ void Output::output_bind_resource(QtWaylandServer::wl_output::Resource *resource } // Seat stuff -Seat::Seat(CoreCompositor *compositor, uint capabilities, int version) //TODO: check version +Seat::Seat(CoreCompositor *compositor, uint capabilities, int version, const QString &seatName) //TODO: check version : QtWaylandServer::wl_seat(compositor->m_display, version) + , m_seatName(seatName) , m_compositor(compositor) { setCapabilities(capabilities); diff --git a/tests/auto/wayland/shared/coreprotocol.h b/tests/auto/wayland/shared/coreprotocol.h index bea39dd134d..bb469cb121e 100644 --- a/tests/auto/wayland/shared/coreprotocol.h +++ b/tests/auto/wayland/shared/coreprotocol.h @@ -302,12 +302,14 @@ class Seat : public Global, public QtWaylandServer::wl_seat { Q_OBJECT public: - explicit Seat(CoreCompositor *compositor, uint capabilities = Seat::capability_pointer | Seat::capability_keyboard | Seat::capability_touch, int version = 9); + explicit Seat(CoreCompositor *compositor, uint capabilities = Seat::capability_pointer | Seat::capability_keyboard | Seat::capability_touch, int version = 9, const QString &seatName = QLatin1String("seat0")); ~Seat() override; void send_capabilities(Resource *resource, uint capabilities) = delete; // Use wrapper instead void send_capabilities(uint capabilities) = delete; // Use wrapper instead void setCapabilities(uint capabilities); + + QString m_seatName; CoreCompositor *m_compositor = nullptr; Pointer* m_pointer = nullptr; @@ -325,6 +327,7 @@ protected: void seat_bind_resource(Resource *resource) override { wl_seat::send_capabilities(resource->handle, m_capabilities); + wl_seat::send_name(resource->handle, m_seatName); // in any normal world this is would be set before capabilities. Weston does it after } void seat_get_pointer(Resource *resource, uint32_t id) override; From efd45d447e7c0c9ea47f37aafa6d5dd7abc76451 Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Fri, 6 Sep 2024 17:39:05 +0200 Subject: [PATCH 1401/1507] client: Wait to create QPointingDevice; give seat name to ctor Wait until both the seat name and capabilities are known, to avoid depending on the order of messages. On Weston, seat_name() is called after seat_capabilities(), while it's the other way around on others. Pass the seat name along in each place where the QPointingDevice ctor is invoked. This gets us closer to multi-seat support on Wayland: at least qtdecl/examples/quick/pointerhandlers/singlePointHandlerProperties.qml can see the seat name of the device provided with each QTouchEvent or QTabletEvent. Followup to bb151390240c1f20a6464adbefa497f3559554dd and e168e1fc80231c0e2751b4f6f2a736efadff92fa Pick-to: 6.8 Task-number: QTBUG-72167 Task-number: QTBUG-115207 Change-Id: Ife25cfec0307893d949a2a50a9b49a8f560a60e0 Reviewed-by: David Edmundson --- .../platforms/wayland/qwaylandinputdevice.cpp | 43 +++++++++++-------- .../platforms/wayland/qwaylandinputdevice_p.h | 2 + .../platforms/wayland/qwaylandtabletv2.cpp | 4 +- 3 files changed, 30 insertions(+), 19 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index a34ea340b81..9bfa2b0f4af 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -431,56 +431,65 @@ QWaylandInputDevice::~QWaylandInputDevice() void QWaylandInputDevice::seat_capabilities(uint32_t caps) { mCaps = caps; + maybeRegisterInputDevices(); +} - if (caps & WL_SEAT_CAPABILITY_KEYBOARD && !mKeyboard) { +void QWaylandInputDevice::seat_name(const QString &name) +{ + mSeatName = name; + mSeatNameKnown = true; + maybeRegisterInputDevices(); +} + +void QWaylandInputDevice::maybeRegisterInputDevices() +{ + if (!mSeatNameKnown) + return; // too early + + if (mCaps & WL_SEAT_CAPABILITY_KEYBOARD && !mKeyboard) { mKeyboard.reset(createKeyboard(this)); - } else if (!(caps & WL_SEAT_CAPABILITY_KEYBOARD) && mKeyboard) { + } else if (!(mCaps & WL_SEAT_CAPABILITY_KEYBOARD) && mKeyboard) { mKeyboard.reset(); } - if (caps & WL_SEAT_CAPABILITY_POINTER && !mPointer) { + if (mCaps & WL_SEAT_CAPABILITY_POINTER && !mPointer) { mPointer.reset(createPointer(this)); auto *pointerGestures = mQDisplay->pointerGestures(); if (pointerGestures) { // NOTE: The name of the device and its system ID are not exposed on Wayland. mTouchPadDevice = new QPointingDevice( - QLatin1String("touchpad"), 0, QInputDevice::DeviceType::TouchPad, - QPointingDevice::PointerType::Finger, QInputDevice::Capability::Position, - MaxTouchPoints, 0, mSeatName, QPointingDeviceUniqueId(), this); + QLatin1StringView("touchpad"), 0, QInputDevice::DeviceType::TouchPad, + QPointingDevice::PointerType::Finger, QInputDevice::Capability::Position, + MaxTouchPoints, 0, mSeatName, QPointingDeviceUniqueId(), this); QWindowSystemInterface::registerInputDevice(mTouchPadDevice); mPointerGesturePinch.reset(pointerGestures->createPointerGesturePinch(this)); mPointerGesturePinch->init(pointerGestures->get_pinch_gesture(mPointer->object())); mPointerGestureSwipe.reset(pointerGestures->createPointerGestureSwipe(this)); mPointerGestureSwipe->init(pointerGestures->get_swipe_gesture(mPointer->object())); } - } else if (!(caps & WL_SEAT_CAPABILITY_POINTER) && mPointer) { + } else if (!(mCaps & WL_SEAT_CAPABILITY_POINTER) && mPointer) { mPointer.reset(); mPointerGesturePinch.reset(); mPointerGestureSwipe.reset(); } - if (caps & WL_SEAT_CAPABILITY_TOUCH && !mTouch) { + if (mCaps & WL_SEAT_CAPABILITY_TOUCH && !mTouch) { mTouch.reset(createTouch(this)); if (!mTouchDevice) { // TODO number of touchpoints, actual name and ID mTouchDevice = new QPointingDevice( - QLatin1String("some touchscreen"), 0, QInputDevice::DeviceType::TouchScreen, - QPointingDevice::PointerType::Finger, QInputDevice::Capability::Position, - MaxTouchPoints, 0, mSeatName, QPointingDeviceUniqueId(), this); + QLatin1StringView("touchscreen"), 0, QInputDevice::DeviceType::TouchScreen, + QPointingDevice::PointerType::Finger, QInputDevice::Capability::Position, + MaxTouchPoints, 0, mSeatName, QPointingDeviceUniqueId(), this); QWindowSystemInterface::registerInputDevice(mTouchDevice); } - } else if (!(caps & WL_SEAT_CAPABILITY_TOUCH) && mTouch) { + } else if (!(mCaps & WL_SEAT_CAPABILITY_TOUCH) && mTouch) { mTouch.reset(); } } -void QWaylandInputDevice::seat_name(const QString &name) -{ - mSeatName = name; -} - QWaylandInputDevice::Keyboard *QWaylandInputDevice::createKeyboard(QWaylandInputDevice *device) { return new Keyboard(device); diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h index 88f2d7085a1..4e74df1e182 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h +++ b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h @@ -148,6 +148,7 @@ protected: uint32_t mId = -1; uint32_t mCaps = 0; QString mSeatName; + bool mSeatNameKnown = false; #if QT_CONFIG(cursor) struct CursorState { @@ -185,6 +186,7 @@ protected: void seat_capabilities(uint32_t caps) override; void seat_name(const QString &name) override; + void maybeRegisterInputDevices(); void handleTouchPoint(int id, QEventPoint::State state, const QPointF &surfacePosition = QPoint()); QPointingDevice *mTouchDevice = nullptr; diff --git a/src/plugins/platforms/wayland/qwaylandtabletv2.cpp b/src/plugins/platforms/wayland/qwaylandtabletv2.cpp index 1a05eb8b963..627f8746f88 100644 --- a/src/plugins/platforms/wayland/qwaylandtabletv2.cpp +++ b/src/plugins/platforms/wayland/qwaylandtabletv2.cpp @@ -95,7 +95,7 @@ void QWaylandTabletSeatV2::zwp_tablet_seat_v2_pad_added(zwp_tablet_pad_v2 *id) QWaylandTabletV2::QWaylandTabletV2(::zwp_tablet_v2 *tablet, const QString &seatName) : QPointingDevice(u"unknown"_s, -1, DeviceType::Stylus, PointerType::Pen, Capability::Position | Capability::Hover, - 1, 1) + 1, 1, seatName) , QtWayland::zwp_tablet_v2(tablet) { qCDebug(lcQpaInputDevices) << "new tablet on seat" << seatName; @@ -142,7 +142,7 @@ void QWaylandTabletV2::zwp_tablet_v2_removed() QWaylandTabletToolV2::QWaylandTabletToolV2(QWaylandTabletSeatV2 *tabletSeat, ::zwp_tablet_tool_v2 *tool) : QPointingDevice(u"tool"_s, -1, DeviceType::Stylus, PointerType::Pen, Capability::Position | Capability::Hover, - 1, 1) + 1, 1, tabletSeat->seat()->seatname()) , QtWayland::zwp_tablet_tool_v2(tool) , m_tabletSeat(tabletSeat) { From 577d4e22441b1fd9f5a1be1a3c85ae9d7ad40ef3 Mon Sep 17 00:00:00 2001 From: Nicolas Fella Date: Sun, 16 Jun 2024 19:26:08 +0200 Subject: [PATCH 1402/1507] QWaylandTablet: Implement cursor Currently we don't set a cursor for tablet devices, so we get either a generic fallback cursor (KWin) or no cursor at all (GNOME). This makes sure we get the same cursor we get for mouse input. The code is mostly identical to the mouse cursor handling, so refactor things a bit to share Pick-to: 6.8 Fixes: QTBUG-105843 Fixes: QTBUG-123776 Change-Id: Ie626ff978d9b66ec422804a103699eebec85e267 Reviewed-by: Shawn Rutledge --- .../platforms/wayland/qwaylandcallback_p.h | 31 ++++ .../wayland/qwaylandcursorsurface_p.h | 81 ++++++++ .../platforms/wayland/qwaylandinputdevice.cpp | 82 +------- .../platforms/wayland/qwaylandinputdevice_p.h | 5 +- .../platforms/wayland/qwaylandtabletv2.cpp | 175 ++++++++++++++++++ .../platforms/wayland/qwaylandtabletv2_p.h | 44 +++++ 6 files changed, 341 insertions(+), 77 deletions(-) create mode 100644 src/plugins/platforms/wayland/qwaylandcallback_p.h create mode 100644 src/plugins/platforms/wayland/qwaylandcursorsurface_p.h diff --git a/src/plugins/platforms/wayland/qwaylandcallback_p.h b/src/plugins/platforms/wayland/qwaylandcallback_p.h new file mode 100644 index 00000000000..b9afa18c6a0 --- /dev/null +++ b/src/plugins/platforms/wayland/qwaylandcallback_p.h @@ -0,0 +1,31 @@ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QWAYLANDCALLBACK_H +#define QWAYLANDCALLBACK_H + +#include "qwayland-wayland.h" + +QT_BEGIN_NAMESPACE + +namespace QtWaylandClient { + +class WlCallback : public QtWayland::wl_callback +{ +public: + explicit WlCallback(::wl_callback *callback, std::function fn) + : QtWayland::wl_callback(callback), m_fn(fn) + { + } + ~WlCallback() override { wl_callback_destroy(object()); } + void callback_done(uint32_t callback_data) override { m_fn(callback_data); } + +private: + std::function m_fn; +}; + +} // namespace QtWaylandClient + +QT_END_NAMESPACE + +#endif // QWAYLANDCALLBACK_H diff --git a/src/plugins/platforms/wayland/qwaylandcursorsurface_p.h b/src/plugins/platforms/wayland/qwaylandcursorsurface_p.h new file mode 100644 index 00000000000..3e011ead28f --- /dev/null +++ b/src/plugins/platforms/wayland/qwaylandcursorsurface_p.h @@ -0,0 +1,81 @@ +// Copyright (C) 2019 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QWAYLANDCURSORSURFACE_H +#define QWAYLANDCURSORSURFACE_H + +#include "qwaylandsurface_p.h" +#include "qwaylandcallback_p.h" + +QT_BEGIN_NAMESPACE + +namespace QtWaylandClient { + +#if QT_CONFIG(cursor) +template +class CursorSurface : public QWaylandSurface +{ +public: + explicit CursorSurface(InputDevice *pointer, QWaylandDisplay *display) + : QWaylandSurface(display), m_pointer(pointer) + { + connect(this, &QWaylandSurface::screensChanged, m_pointer, &InputDevice::updateCursor); + } + + void reset() + { + m_setSerial = 0; + m_hotspot = QPoint(); + } + + // Size and hotspot are in surface coordinates + void update(wl_buffer *buffer, const QPoint &hotspot, const QSize &size, int bufferScale, + bool animated = false) + { + // Calling code needs to ensure buffer scale is supported if != 1 + Q_ASSERT(bufferScale == 1 || version() >= 3); + + auto enterSerial = m_pointer->mEnterSerial; + if (m_setSerial < enterSerial || m_hotspot != hotspot) { + m_pointer->set_cursor(m_pointer->mEnterSerial, object(), hotspot.x(), hotspot.y()); + m_setSerial = enterSerial; + m_hotspot = hotspot; + } + + if (version() >= 3) + set_buffer_scale(bufferScale); + + attach(buffer, 0, 0); + damage(0, 0, size.width(), size.height()); + m_frameCallback.reset(); + if (animated) { + m_frameCallback.reset(new WlCallback(frame(), [this](uint32_t time) { + Q_UNUSED(time); + m_pointer->cursorFrameCallback(); + })); + } + commit(); + } + + int outputScale() const + { + int scale = 0; + for (auto *screen : m_screens) + scale = qMax(scale, screen->scale()); + return scale; + } + +private: + QScopedPointer m_frameCallback; + InputDevice *m_pointer = nullptr; + uint m_setSerial = 0; + QPoint m_hotspot; +}; + +#endif // QT_CONFIG(cursor) + +} // namespace QtWaylandClient + +QT_END_NAMESPACE + +#endif // QWAYLANDCURSORSURFACE_H diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index 9bfa2b0f4af..e2b788171a0 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -29,6 +29,8 @@ #include "qwaylandtextinputinterface_p.h" #include "qwaylandinputcontext_p.h" #include "qwaylandinputmethodcontext_p.h" +#include "qwaylandcallback_p.h" +#include "qwaylandcursorsurface_p.h" #include #include @@ -152,80 +154,6 @@ QWaylandWindow *QWaylandInputDevice::Pointer::focusWindow() const #if QT_CONFIG(cursor) -class WlCallback : public QtWayland::wl_callback { -public: - explicit WlCallback(::wl_callback *callback, std::function fn) - : QtWayland::wl_callback(callback) - , m_fn(fn) - {} - ~WlCallback() override { wl_callback_destroy(object()); } - void callback_done(uint32_t callback_data) override { - m_fn(callback_data); - } -private: - std::function m_fn; -}; - -class CursorSurface : public QWaylandSurface -{ -public: - explicit CursorSurface(QWaylandInputDevice::Pointer *pointer, QWaylandDisplay *display) - : QWaylandSurface(display) - , m_pointer(pointer) - { - connect(this, &QWaylandSurface::screensChanged, - m_pointer, &QWaylandInputDevice::Pointer::updateCursor); - } - - void reset() - { - m_setSerial = 0; - m_hotspot = QPoint(); - } - - // Size and hotspot are in surface coordinates - void update(wl_buffer *buffer, const QPoint &hotspot, const QSize &size, int bufferScale, bool animated = false) - { - // Calling code needs to ensure buffer scale is supported if != 1 - Q_ASSERT(bufferScale == 1 || version() >= 3); - - auto enterSerial = m_pointer->mEnterSerial; - if (m_setSerial < enterSerial || m_hotspot != hotspot) { - m_pointer->set_cursor(m_pointer->mEnterSerial, object(), hotspot.x(), hotspot.y()); - m_setSerial = enterSerial; - m_hotspot = hotspot; - } - - if (version() >= 3) - set_buffer_scale(bufferScale); - - attach(buffer, 0, 0); - damage(0, 0, size.width(), size.height()); - m_frameCallback.reset(); - if (animated) { - m_frameCallback.reset(new WlCallback(frame(), [this](uint32_t time){ - Q_UNUSED(time); - m_pointer->cursorFrameCallback(); - })); - } - commit(); - } - - int outputScale() const - { - int scale = 0; - for (auto *screen : m_screens) - scale = qMax(scale, screen->scale()); - return scale; - } - -private: - QScopedPointer m_frameCallback; - QWaylandInputDevice::Pointer *m_pointer = nullptr; - uint m_setSerial = 0; - QPoint m_hotspot; -}; - int QWaylandInputDevice::Pointer::idealCursorScale() const { if (seat()->mQDisplay->compositor()->version() < 3) { @@ -342,7 +270,8 @@ void QWaylandInputDevice::Pointer::updateCursor() qCWarning(lcQpaWayland) << "Unable to change to cursor" << shape; } -CursorSurface *QWaylandInputDevice::Pointer::getOrCreateCursorSurface() +CursorSurface * +QWaylandInputDevice::Pointer::getOrCreateCursorSurface() { if (!mCursor.surface) mCursor.surface.reset(new CursorSurface(this, seat()->mQDisplay)); @@ -688,6 +617,9 @@ void QWaylandInputDevice::setCursor(const QCursor *cursor, const QSharedPointer< if (mPointer) mPointer->updateCursor(); + + if (mTabletSeat) + mTabletSeat->updateCursor(); } #endif diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h index 4e74df1e182..0d79ef93376 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h +++ b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h @@ -65,6 +65,7 @@ class QWaylandTextInputMethod; #if QT_CONFIG(cursor) class QWaylandCursorTheme; class QWaylandCursorShape; +template class CursorSurface; #endif @@ -294,7 +295,7 @@ public: void updateCursor(); void cursorTimerCallback(); void cursorFrameCallback(); - CursorSurface *getOrCreateCursorSurface(); + CursorSurface *getOrCreateCursorSurface(); #endif QWaylandInputDevice *seat() const { return mParent; } @@ -336,7 +337,7 @@ public: QScopedPointer shape; QWaylandCursorTheme *theme = nullptr; int themeBufferScale = 0; - QScopedPointer surface; + QScopedPointer> surface; QTimer frameTimer; bool gotFrameCallback = false; bool gotTimerCallback = false; diff --git a/src/plugins/platforms/wayland/qwaylandtabletv2.cpp b/src/plugins/platforms/wayland/qwaylandtabletv2.cpp index 627f8746f88..6a8c84c44a8 100644 --- a/src/plugins/platforms/wayland/qwaylandtabletv2.cpp +++ b/src/plugins/platforms/wayland/qwaylandtabletv2.cpp @@ -5,7 +5,16 @@ #include "qwaylandinputdevice_p.h" #include "qwaylanddisplay_p.h" #include "qwaylandsurface_p.h" +#include "qwaylandscreen_p.h" +#include "qwaylandbuffer_p.h" +#include "qwaylandcursorsurface_p.h" +#include "qwaylandcursor_p.h" + +#include #include +#include + +#include QT_BEGIN_NAMESPACE @@ -16,6 +25,148 @@ using namespace Qt::StringLiterals; Q_LOGGING_CATEGORY(lcQpaInputDevices, "qt.qpa.input.devices") Q_DECLARE_LOGGING_CATEGORY(lcQpaWaylandInput) +#if QT_CONFIG(cursor) +int QWaylandTabletToolV2::idealCursorScale() const +{ + if (m_tabletSeat->seat()->mQDisplay->compositor()->version() < 3) { + return 1; + } + + if (auto *s = mCursor.surface.data()) { + if (s->outputScale() > 0) + return s->outputScale(); + } + + return m_tabletSeat->seat()->mCursor.fallbackOutputScale; +} + +void QWaylandTabletToolV2::updateCursorTheme() +{ + QString cursorThemeName; + QSize cursorSize; + + if (const QPlatformTheme *platformTheme = QGuiApplicationPrivate::platformTheme()) { + cursorThemeName = platformTheme->themeHint(QPlatformTheme::MouseCursorTheme).toString(); + cursorSize = platformTheme->themeHint(QPlatformTheme::MouseCursorSize).toSize(); + } + + if (cursorThemeName.isEmpty()) + cursorThemeName = QStringLiteral("default"); + if (cursorSize.isEmpty()) + cursorSize = QSize(24, 24); + + int scale = idealCursorScale(); + int pixelSize = cursorSize.width() * scale; + auto *display = m_tabletSeat->seat()->mQDisplay; + mCursor.theme = display->loadCursorTheme(cursorThemeName, pixelSize); + + if (!mCursor.theme) + return; // A warning has already been printed in loadCursorTheme + + if (auto *arrow = mCursor.theme->cursor(Qt::ArrowCursor)) { + int arrowPixelSize = qMax(arrow->images[0]->width, + arrow->images[0]->height); // Not all cursor themes are square + while (scale > 1 && arrowPixelSize / scale < cursorSize.width()) + --scale; + } else { + qCWarning(lcQpaWayland) << "Cursor theme does not support the arrow cursor"; + } + mCursor.themeBufferScale = scale; +} + +void QWaylandTabletToolV2::updateCursor() +{ + if (mEnterSerial == 0) + return; + + auto shape = m_tabletSeat->seat()->mCursor.shape; + + if (shape == Qt::BlankCursor) { + if (mCursor.surface) + mCursor.surface->reset(); + set_cursor(mEnterSerial, nullptr, 0, 0); + return; + } + + if (shape == Qt::BitmapCursor) { + auto buffer = m_tabletSeat->seat()->mCursor.bitmapBuffer; + if (!buffer) { + qCWarning(lcQpaWayland) << "No buffer for bitmap cursor, can't set cursor"; + return; + } + auto hotspot = m_tabletSeat->seat()->mCursor.hotspot; + int bufferScale = m_tabletSeat->seat()->mCursor.bitmapScale; + getOrCreateCursorSurface()->update(buffer->buffer(), hotspot, buffer->size(), bufferScale); + return; + } + + if (mCursor.shape) { + if (mCursor.surface) { + mCursor.surface->reset(); + } + mCursor.shape->setShape(mEnterSerial, shape); + return; + } + + if (!mCursor.theme || idealCursorScale() != mCursor.themeBufferScale) + updateCursorTheme(); + + if (!mCursor.theme) + return; + + // Set from shape using theme + uint time = m_tabletSeat->seat()->mCursor.animationTimer.elapsed(); + + if (struct ::wl_cursor *waylandCursor = mCursor.theme->cursor(shape)) { + uint duration = 0; + int frame = wl_cursor_frame_and_duration(waylandCursor, time, &duration); + ::wl_cursor_image *image = waylandCursor->images[frame]; + + struct wl_buffer *buffer = wl_cursor_image_get_buffer(image); + if (!buffer) { + qCWarning(lcQpaWayland) << "Could not find buffer for cursor" << shape; + return; + } + int bufferScale = mCursor.themeBufferScale; + QPoint hotspot = QPoint(image->hotspot_x, image->hotspot_y) / bufferScale; + QSize size = QSize(image->width, image->height) / bufferScale; + bool animated = duration > 0; + if (animated) { + mCursor.gotFrameCallback = false; + mCursor.gotTimerCallback = false; + mCursor.frameTimer.start(duration); + } + getOrCreateCursorSurface()->update(buffer, hotspot, size, bufferScale, animated); + return; + } + + qCWarning(lcQpaWayland) << "Unable to change to cursor" << shape; +} + +CursorSurface *QWaylandTabletToolV2::getOrCreateCursorSurface() +{ + if (!mCursor.surface) + mCursor.surface.reset( + new CursorSurface(this, m_tabletSeat->seat()->mQDisplay)); + return mCursor.surface.get(); +} + +void QWaylandTabletToolV2::cursorTimerCallback() +{ + mCursor.gotTimerCallback = true; + if (mCursor.gotFrameCallback) + updateCursor(); +} + +void QWaylandTabletToolV2::cursorFrameCallback() +{ + mCursor.gotFrameCallback = true; + if (mCursor.gotTimerCallback) + updateCursor(); +} + +#endif // QT_CONFIG(cursor) + QWaylandTabletManagerV2::QWaylandTabletManagerV2(QWaylandDisplay *display, uint id, uint version) : zwp_tablet_manager_v2(display->wl_registry(), id, qMin(version, uint(1))) { @@ -127,6 +278,12 @@ void QWaylandTabletV2::zwp_tablet_v2_done() QWindowSystemInterface::registerInputDevice(this); } +void QWaylandTabletSeatV2::updateCursor() +{ + for (auto tool : m_tools) + tool->updateCursor(); +} + void QWaylandTabletSeatV2::toolRemoved(QWaylandTabletToolV2 *tool) { m_tools.removeOne(tool); @@ -147,8 +304,20 @@ QWaylandTabletToolV2::QWaylandTabletToolV2(QWaylandTabletSeatV2 *tabletSeat, ::z , m_tabletSeat(tabletSeat) { // TODO get the number of buttons somehow? + +#if QT_CONFIG(cursor) + if (auto cursorShapeManager = m_tabletSeat->seat()->mQDisplay->cursorShapeManager()) { + mCursor.shape.reset( + new QWaylandCursorShape(cursorShapeManager->get_tablet_tool_v2(object()))); + } + + mCursor.frameTimer.setSingleShot(true); + mCursor.frameTimer.callOnTimeout(this, [&]() { cursorTimerCallback(); }); +#endif } +QWaylandTabletToolV2::~QWaylandTabletToolV2() = default; + void QWaylandTabletToolV2::zwp_tablet_tool_v2_type(uint32_t tool_type) { QPointingDevicePrivate *d = QPointingDevicePrivate::get(this); @@ -250,6 +419,7 @@ void QWaylandTabletToolV2::zwp_tablet_tool_v2_proximity_in(uint32_t serial, zwp_ Q_UNUSED(tablet); m_tabletSeat->seat()->mSerial = serial; + mEnterSerial = serial; if (Q_UNLIKELY(!surface)) { qCDebug(lcQpaWayland) << "Ignoring zwp_tablet_tool_v2_proximity_v2 with no surface"; @@ -257,6 +427,11 @@ void QWaylandTabletToolV2::zwp_tablet_tool_v2_proximity_in(uint32_t serial, zwp_ } m_pending.enteredSurface = true; m_pending.proximitySurface = QWaylandSurface::fromWlSurface(surface); + +#if QT_CONFIG(cursor) + // Depends on mEnterSerial being updated + updateCursor(); +#endif } void QWaylandTabletToolV2::zwp_tablet_tool_v2_proximity_out() diff --git a/src/plugins/platforms/wayland/qwaylandtabletv2_p.h b/src/plugins/platforms/wayland/qwaylandtabletv2_p.h index b101826e4ac..94b687ee3ea 100644 --- a/src/plugins/platforms/wayland/qwaylandtabletv2_p.h +++ b/src/plugins/platforms/wayland/qwaylandtabletv2_p.h @@ -22,6 +22,7 @@ #include #include #include +#include #include #include @@ -38,6 +39,13 @@ class QWaylandTabletV2; class QWaylandTabletToolV2; class QWaylandTabletPadV2; +#if QT_CONFIG(cursor) +class QWaylandCursorTheme; +class QWaylandCursorShape; +template +class CursorSurface; +#endif + class Q_WAYLANDCLIENT_EXPORT QWaylandTabletManagerV2 : public QtWayland::zwp_tablet_manager_v2 { public: @@ -54,6 +62,7 @@ public: QWaylandInputDevice *seat() const { return m_seat; } + void updateCursor(); void toolRemoved(QWaylandTabletToolV2 *tool); protected: @@ -89,6 +98,9 @@ class Q_WAYLANDCLIENT_EXPORT QWaylandTabletToolV2 : public QPointingDevice, publ Q_OBJECT public: QWaylandTabletToolV2(QWaylandTabletSeatV2 *tabletSeat, ::zwp_tablet_tool_v2 *tool); + ~QWaylandTabletToolV2() override; + + void updateCursor(); protected: void zwp_tablet_tool_v2_type(uint32_t tool_type) override; @@ -112,8 +124,37 @@ protected: void zwp_tablet_tool_v2_frame(uint32_t time) override; private: +#if QT_CONFIG(cursor) + int idealCursorScale() const; + void updateCursorTheme(); + void cursorTimerCallback(); + void cursorFrameCallback(); + CursorSurface *getOrCreateCursorSurface(); +#endif + QWaylandTabletSeatV2 *m_tabletSeat; + // Static state (sent before done event) + QPointingDevice::PointerType m_pointerType = QPointingDevice::PointerType::Unknown; + QInputDevice::DeviceType m_tabletDevice = QInputDevice::DeviceType::Unknown; + zwp_tablet_tool_v2::type m_toolType = type_pen; + bool m_hasRotation = false; + quint64 m_uid = 0; + + uint32_t mEnterSerial = 0; +#if QT_CONFIG(cursor) + struct + { + QScopedPointer shape; + QWaylandCursorTheme *theme = nullptr; + int themeBufferScale = 0; + QScopedPointer> surface; + QTimer frameTimer; + bool gotFrameCallback = false; + bool gotTimerCallback = false; + } mCursor; +#endif + // Accumulated state (applied on frame event) struct State { bool down = false; @@ -130,6 +171,9 @@ private: //auto operator<=>(const Point&) const = default; // TODO: use this when upgrading to C++20 bool operator==(const State &o) const; } m_pending, m_applied; + + template + friend class CursorSurface; }; class Q_WAYLANDCLIENT_EXPORT QWaylandTabletPadV2 : public QPointingDevice, public QtWayland::zwp_tablet_pad_v2 From 8b9b2dec193d3b6a3380c6f69f45a93f00239a72 Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Mon, 16 Sep 2024 14:36:01 +0100 Subject: [PATCH 1403/1507] tests: Make tst_scaling more robust When a fractional scaling value is sent, we expect the client DPR to update, and a new frame sent to the compositor. We can't be sure that our compositor thread won't already have the new frame by the time we call surfaceCommitSpy.wait. Change-Id: Iab7d57f07e854a79e69b97631fe1b6006a061b82 Reviewed-by: Shawn Rutledge Reviewed-by: David Redondo --- tests/auto/wayland/scaling/tst_scaling.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/auto/wayland/scaling/tst_scaling.cpp b/tests/auto/wayland/scaling/tst_scaling.cpp index b4d2995ea72..de36d34aa1d 100644 --- a/tests/auto/wayland/scaling/tst_scaling.cpp +++ b/tests/auto/wayland/scaling/tst_scaling.cpp @@ -70,6 +70,8 @@ void tst_scaling::scaledWindow() QCOMPARE(vp->m_destination, QSize(200, 200)); }); + surfaceCommitSpy.clear(); + // dynamic scale change exec([&] { QVERIFY(fractionalScale()); @@ -77,8 +79,8 @@ void tst_scaling::scaledWindow() }); QTRY_COMPARE(window.devicePixelRatio(), 2.5); QCOMPARE(window.size(), QSize(200,200)); + QTRY_VERIFY(surfaceCommitSpy.count()); - QVERIFY(surfaceCommitSpy.wait()); exec([&] { Buffer *buffer = xdgToplevel()->surface()->m_committed.buffer; QVERIFY(buffer); From 0e64cadb98e8b983abb6f7148e65d911608fcae8 Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Mon, 16 Sep 2024 21:52:12 +0100 Subject: [PATCH 1404/1507] tests: Fix flaky reconnect test testMultiScreen explicitly sets clients on monitors, for this to work we need autoEnter disabled. 92952bd04a0452a45140ed9c9494279683bb80e1 set this on startup, but due to the way we reset the compositor this needs doing multiple times if multiple tests are run. Change-Id: Iaad3058b3ad8a12d01b3bd8272615fcd74ea250d Reviewed-by: David Redondo --- tests/auto/wayland/reconnect/tst_reconnect.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/auto/wayland/reconnect/tst_reconnect.cpp b/tests/auto/wayland/reconnect/tst_reconnect.cpp index c45d63542b9..22892494157 100644 --- a/tests/auto/wayland/reconnect/tst_reconnect.cpp +++ b/tests/auto/wayland/reconnect/tst_reconnect.cpp @@ -128,6 +128,8 @@ void tst_WaylandReconnect::triggerReconnect() { const int socketFd = wl_socket_get_fd(m_socket); m_comp.reset(new DefaultCompositor(CoreCompositor::Default, dup(socketFd))); + m_comp->m_config.autoEnter = false; + QTest::qWait(50); //we need to spin the main loop to actually reconnect } From 538e3f7421d83b0535cc3bd52626a768db51c8f2 Mon Sep 17 00:00:00 2001 From: David Redondo Date: Tue, 16 Jul 2024 14:23:23 +0200 Subject: [PATCH 1405/1507] client: Change default lifespan of wl_surface to match the window This brings it more in-line with other platforms where the underlying backing store has the lifespan of the window, implicitly fixing a teardown issue with Qt Vulkan. With this commit the wl_surface lifetime matches the QPlatformWindow, on show and hide the shell surface is still recreated, with a null buffer attached inbetween to get a blank slate as per the specification. There is still some paths where a wl_surface is reset during the platform window lifetime if the user ever converted a subsurface to a toplevel or vice-versa, also for handling compositing restarts. Task-number: QTBUG-125592 Change-Id: I449ec170a085c7c0fca504687556d702daddf79a Reviewed-by: David Edmundson --- .../platforms/wayland/qwaylandwindow.cpp | 115 ++++++++++-------- .../platforms/wayland/qwaylandwindow_p.h | 1 + tests/auto/wayland/shared/coreprotocol.cpp | 15 ++- tests/auto/wayland/shared/coreprotocol.h | 1 + tests/auto/wayland/shared/mockcompositor.cpp | 2 +- tests/auto/wayland/shared/xdgshell.cpp | 12 +- 6 files changed, 87 insertions(+), 59 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index a23d8093111..45eea327193 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -73,9 +73,7 @@ QWaylandWindow::QWaylandWindow(QWindow *window, QWaylandDisplay *display) QWaylandWindow::~QWaylandWindow() { mWindowDecoration.reset(); - - if (mSurface) - reset(); + reset(); const QWindow *parent = window(); const auto tlw = QGuiApplication::topLevelWindows(); @@ -99,20 +97,19 @@ void QWaylandWindow::ensureSize() void QWaylandWindow::initWindow() { + /** + * Cleanup window state just before showing. + * This is necessary because a render could still have been running and commit + * after the window was last hidden and the last null was attached + * + * When we port to synchronous delivery it should be possible to drop this + */ + mSurface->attach(nullptr, 0, 0); + mSurface->commit(); + if (window()->type() == Qt::Desktop) return; - if (!mSurface) { - initializeWlSurface(); - } - - if (mDisplay->fractionalScaleManager() && qApp->highDpiScaleFactorRoundingPolicy() == Qt::HighDpiScaleFactorRoundingPolicy::PassThrough) { - mFractionalScale.reset(new QWaylandFractionalScale(mDisplay->fractionalScaleManager()->get_fractional_scale(mSurface->object()))); - - connect(mFractionalScale.data(), &QWaylandFractionalScale::preferredScaleChanged, - this, &QWaylandWindow::updateScale); - } - if (shouldCreateSubSurface()) { Q_ASSERT(!mSubSurfaceWindow); @@ -189,12 +186,6 @@ void QWaylandWindow::initWindow() } } - // The fractional scale manager check is needed to work around Gnome < 36 where viewports don't work - // Right now viewports are only necessary when a fractional scale manager is used - if (display()->viewporter() && display()->fractionalScaleManager()) { - mViewport.reset(new QWaylandViewport(display()->createViewport(this))); - } - // Enable high-dpi rendering. Scale() returns the screen scale factor and will // typically be integer 1 (normal-dpi) or 2 (high-dpi). Call set_buffer_scale() // to inform the compositor that high-resolution buffers will be provided. @@ -236,6 +227,18 @@ void QWaylandWindow::initializeWlSurface() mSurface->m_window = this; } emit wlSurfaceCreated(); + + if (mDisplay->fractionalScaleManager() && qApp->highDpiScaleFactorRoundingPolicy() == Qt::HighDpiScaleFactorRoundingPolicy::PassThrough) { + mFractionalScale.reset(new QWaylandFractionalScale(mDisplay->fractionalScaleManager()->get_fractional_scale(mSurface->object()))); + + connect(mFractionalScale.data(), &QWaylandFractionalScale::preferredScaleChanged, + this, &QWaylandWindow::updateScale); + } + // The fractional scale manager check is needed to work around Gnome < 36 where viewports don't work + // Right now viewports are only necessary when a fractional scale manager is used + if (display()->viewporter() && display()->fractionalScaleManager()) { + mViewport.reset(new QWaylandViewport(display()->createViewport(this))); + } } void QWaylandWindow::setShellIntegration(QWaylandShellIntegration *shellIntegration) @@ -282,23 +285,12 @@ void QWaylandWindow::endFrame() void QWaylandWindow::reset() { - closeChildPopups(); - - if (mTopPopup == this) - mTopPopup = mTransientParent && (mTransientParent->window()->type() == Qt::Popup) ? mTransientParent : nullptr; + resetSurfaceRole(); if (mSurface) { { QWriteLocker lock(&mSurfaceLock); invalidateSurface(); - if (mTransientParent) - mTransientParent->removeChildPopup(this); - delete mShellSurface; - mShellSurface = nullptr; - emit surfaceRoleDestroyed(); - delete mSubSurfaceWindow; - mSubSurfaceWindow = nullptr; - mTransientParent = nullptr; mSurface.reset(); mViewport.reset(); mFractionalScale.reset(); @@ -306,27 +298,8 @@ void QWaylandWindow::reset() emit wlSurfaceDestroyed(); } - { - QMutexLocker lock(&mFrameSyncMutex); - if (mFrameCallback) { - wl_callback_destroy(mFrameCallback); - mFrameCallback = nullptr; - } - mFrameCallbackElapsedTimer.invalidate(); - mWaitingForFrameCallback = false; - } - if (mFrameCallbackCheckIntervalTimerId != -1) { - killTimer(mFrameCallbackCheckIntervalTimerId); - mFrameCallbackCheckIntervalTimerId = -1; - } - - mFrameCallbackTimedOut = false; - mWaitingToApplyConfigure = false; - mCanResize = true; - mResizeDirty = false; mScale = std::nullopt; - mExposed = false; mOpaqueArea = QRegion(); mMask = QRegion(); @@ -336,6 +309,39 @@ void QWaylandWindow::reset() mDisplay->handleWindowDestroyed(this); } +void QWaylandWindow::resetSurfaceRole() +{ + // Old Reset + closeChildPopups(); + + if (mTopPopup == this) + mTopPopup = mTransientParent && (mTransientParent->window()->type() == Qt::Popup) ? mTransientParent : nullptr; + if (mTransientParent) + mTransientParent->removeChildPopup(this); + mTransientParent = nullptr; + delete std::exchange(mShellSurface, nullptr); + delete std::exchange(mSubSurfaceWindow, nullptr); + emit surfaceRoleDestroyed(); + { + QMutexLocker lock(&mFrameSyncMutex); + if (mFrameCallback) { + wl_callback_destroy(mFrameCallback); + mFrameCallback = nullptr; + } + mFrameCallbackElapsedTimer.invalidate(); + mWaitingForFrameCallback = false; + } + if (mFrameCallbackCheckIntervalTimerId != -1) { + killTimer(mFrameCallbackCheckIntervalTimerId); + mFrameCallbackCheckIntervalTimerId = -1; + } + mFrameCallbackTimedOut = false; + mWaitingToApplyConfigure = false; + mCanResize = true; + mResizeDirty = false; + mExposed = false; +} + QWaylandWindow *QWaylandWindow::fromWlSurface(::wl_surface *surface) { if (auto *s = QWaylandSurface::fromWlSurface(surface)) @@ -584,7 +590,9 @@ void QWaylandWindow::setVisible(bool visible) // make sure isExposed is false during the next event dispatch mExposed = false; sendExposeEvent(QRect()); - reset(); + resetSurfaceRole(); + mSurface->attach(nullptr, 0, 0); + mSurface->commit(); } } @@ -1826,12 +1834,13 @@ void QWaylandWindow::removeChildPopup(QWaylandWindow *child) void QWaylandWindow::closeChildPopups() { while (!mChildPopups.isEmpty()) { auto popup = mChildPopups.takeLast(); - popup->reset(); + popup->resetSurfaceRole(); } } void QWaylandWindow::reinit() { + initializeWlSurface(); if (window()->isVisible()) { initWindow(); if (hasPendingUpdateRequest()) diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index b3da318e9b5..6227cda4eba 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -354,6 +354,7 @@ private: void initializeWlSurface(); bool shouldCreateShellSurface() const; bool shouldCreateSubSurface() const; + void resetSurfaceRole(); QPlatformScreen *calculateScreenFromSurfaceEvents() const; void setOpaqueArea(const QRegion &opaqueArea); bool isOpaque() const; diff --git a/tests/auto/wayland/shared/coreprotocol.cpp b/tests/auto/wayland/shared/coreprotocol.cpp index a6f391777c2..3152f26148a 100644 --- a/tests/auto/wayland/shared/coreprotocol.cpp +++ b/tests/auto/wayland/shared/coreprotocol.cpp @@ -50,6 +50,11 @@ void Surface::map() m_mapped = true; } +void Surface::unmap() +{ + m_mapped = false; +} + void Surface::surface_destroy_resource(Resource *resource) { Q_UNUSED(resource); @@ -73,8 +78,10 @@ void Surface::surface_attach(Resource *resource, wl_resource *buffer, int32_t x, Q_UNUSED(resource); if (m_wlshell) { m_buffer = buffer; - if (!buffer) + if (!buffer) { m_image = QImage(); + unmap(); + } } else { QPoint offset(x, y); if (resource->version() < 5) @@ -155,8 +162,6 @@ void Surface::surface_offset(Resource *resource, int32_t x, int32_t y) bool WlCompositor::isClean() { for (auto *surface : std::as_const(m_surfaces)) { if (!CursorRole::fromSurface(surface)) { - if (m_compositor->m_type != CoreCompositor::CompositorType::Legacy) - return false; if (surface->isMapped()) return false; } @@ -639,8 +644,10 @@ WlShellSurface::WlShellSurface(WlShell *wlShell, wl_client *client, int id, Surf WlShellSurface::~WlShellSurface() { - if (m_surface) + if (m_surface) { + m_surface->unmap(); m_surface->m_wlShellSurface = nullptr; + } } void WlShellSurface::sendConfigure(uint32_t edges, int32_t width, int32_t height) diff --git a/tests/auto/wayland/shared/coreprotocol.h b/tests/auto/wayland/shared/coreprotocol.h index bb469cb121e..4b06b5b538e 100644 --- a/tests/auto/wayland/shared/coreprotocol.h +++ b/tests/auto/wayland/shared/coreprotocol.h @@ -84,6 +84,7 @@ public: void send_leave(::wl_resource *output) = delete; void map(); + void unmap(); bool isMapped() const { return m_mapped; } WlShellSurface *wlShellSurface() const { return m_wlShellSurface; } diff --git a/tests/auto/wayland/shared/mockcompositor.cpp b/tests/auto/wayland/shared/mockcompositor.cpp index bbf406d64af..dd3c2ac293b 100644 --- a/tests/auto/wayland/shared/mockcompositor.cpp +++ b/tests/auto/wayland/shared/mockcompositor.cpp @@ -40,7 +40,7 @@ DefaultCompositor::DefaultCompositor(CompositorType t, int socketFd) QObject::connect(get(), &WlCompositor::surfaceCreated, [this] (Surface *surface){ QObject::connect(surface, &Surface::bufferCommitted, [this, surface] { - if (m_config.autoRelease) { + if (m_config.autoRelease && surface->m_committed.buffer) { // Pretend we made a copy of the buffer and just release it immediately surface->m_committed.buffer->send_release(); } diff --git a/tests/auto/wayland/shared/xdgshell.cpp b/tests/auto/wayland/shared/xdgshell.cpp index 2c163985129..184522765b2 100644 --- a/tests/auto/wayland/shared/xdgshell.cpp +++ b/tests/auto/wayland/shared/xdgshell.cpp @@ -59,7 +59,10 @@ XdgSurface::XdgSurface(XdgWmBase *xdgWmBase, Surface *surface, wl_client *client QVERIFY(!surface->m_pending.buffer); QVERIFY(!surface->m_committed.buffer); connect(this, &XdgSurface::toplevelCreated, xdgWmBase, &XdgWmBase::toplevelCreated, Qt::DirectConnection); - connect(surface, &Surface::attach, this, &XdgSurface::verifyConfigured); + connect(surface, &Surface::attach, this, [this] (void *buffer) { + if (buffer) + verifyConfigured(); + }); connect(surface, &Surface::commit, this, [this] { m_committed = m_pending; @@ -68,6 +71,13 @@ XdgSurface::XdgSurface(XdgWmBase *xdgWmBase, Surface *surface, wl_client *client emit configureCommitted(m_committedConfigureSerial); } }); + connect(surface, &Surface::bufferCommitted, this, [this] { + if (m_surface->m_committed.buffer && (m_toplevel || m_popup)) { + m_surface->map(); + } else { + m_surface->unmap(); + } + }); } void XdgSurface::sendConfigure(uint serial) From ab9d58cd4200cedfdd80e04d88791d14692bad1c Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Wed, 11 Sep 2024 23:19:17 +0400 Subject: [PATCH 1406/1507] Client: Use QPlatformWindow's DPR for fallback cursor scale and ceil it This should provide a crisper cursor than flooring and QPlatformWindow is a more right choice than QWindow. Change-Id: I4d0a50e7e513b632532f8561fe709428599fab2c Reviewed-by: David Edmundson --- src/plugins/platforms/wayland/qwaylandcursor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandcursor.cpp b/src/plugins/platforms/wayland/qwaylandcursor.cpp index 98d51a8425e..4bdd053e8c8 100644 --- a/src/plugins/platforms/wayland/qwaylandcursor.cpp +++ b/src/plugins/platforms/wayland/qwaylandcursor.cpp @@ -317,7 +317,7 @@ void QWaylandCursor::changeCursor(QCursor *cursor, QWindow *window) if (cursor && cursor->shape() == Qt::BitmapCursor) bitmapBuffer = cursorBitmapBuffer(mDisplay, cursor); - int fallbackOutputScale = int(window->devicePixelRatio()); + int fallbackOutputScale = qCeil(window->handle()->devicePixelRatio()); const auto seats = mDisplay->inputDevices(); for (auto *seat : seats) seat->setCursor(cursor, bitmapBuffer, fallbackOutputScale); From 33dcb1d7ec4c454e4633349c5fd3f941b4dc30d6 Mon Sep 17 00:00:00 2001 From: Xavier BESSON Date: Fri, 5 Jul 2024 12:19:09 +0200 Subject: [PATCH 1407/1507] Return wl_surface* QWaylandWindow::winId() Required when you want to use some of the wayland protocols (For example: Keyboard shortcuts inhibit) Fixes: QTBUG-67919 Fixes: QTBUG-93103 Fixes: QTBUG-94729 Change-Id: I112c4c3eac99187317dce8de59a77ba3b0e70d17 Reviewed-by: David Edmundson --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 4 +--- src/plugins/platforms/wayland/qwaylandwindow_p.h | 1 - 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 45eea327193..8c553c27fb3 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -60,8 +60,6 @@ QWaylandWindow::QWaylandWindow(QWindow *window, QWaylandDisplay *display) mFrameCallbackTimeout = frameCallbackTimeout; } - static WId id = 1; - mWindowId = id++; initializeWlSurface(); connect(this, &QWaylandWindow::wlSurfaceCreated, this, @@ -351,7 +349,7 @@ QWaylandWindow *QWaylandWindow::fromWlSurface(::wl_surface *surface) WId QWaylandWindow::winId() const { - return mWindowId; + return reinterpret_cast(wlSurface()); } void QWaylandWindow::setParent(const QPlatformWindow *parent) diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index 6227cda4eba..bb8c5b18826 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -295,7 +295,6 @@ protected: GestureState mGestureState = GestureNotActive; #endif - WId mWindowId; bool mFrameCallbackTimedOut = false; // Whether the frame callback has timed out int mFrameCallbackCheckIntervalTimerId = -1; QAtomicInt mWaitingForUpdateDelivery = false; From 444e334265735a5866e168ef5d86d34483bb0f01 Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Mon, 30 Sep 2024 16:02:06 +0200 Subject: [PATCH 1408/1507] Client: Send mouse events with QPointingDevice instances We can't distinguish devices so far on Wayland: primaryPointingDevice() is just an assumption. But at least we know which seat sends the event. After this change, for example, the mouse seat name is visible in qtdeclarative/examples/quick/pointerhandlers/singlePointHandlerProperties.qml Task-number: QTBUG-85272 Task-number: QTBUG-115207 Task-number: QTBUG-129087 Pick-to: 6.8 Change-Id: I3822075bf5680c40b55868f413c48adaea1d3fec Reviewed-by: David Edmundson --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 8c553c27fb3..232b6503d9b 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -1188,6 +1188,9 @@ QWaylandWindow *QWaylandWindow::guessTransientParent() const void QWaylandWindow::handleMouse(QWaylandInputDevice *inputDevice, const QWaylandPointerEvent &e) { + // There's currently no way to get info about the actual hardware device in use. + // At least we get the correct seat. + const QPointingDevice *device = QPointingDevice::primaryPointingDevice(inputDevice->seatname()); if (e.type == QEvent::Leave) { if (mWindowDecorationEnabled) { if (mMouseEventsInContentArea) @@ -1211,10 +1214,10 @@ void QWaylandWindow::handleMouse(QWaylandInputDevice *inputDevice, const QWaylan case QEvent::MouseButtonPress: case QEvent::MouseButtonRelease: case QEvent::MouseMove: - QWindowSystemInterface::handleMouseEvent(window(), e.timestamp, e.local, e.global, e.buttons, e.button, e.type, e.modifiers); + QWindowSystemInterface::handleMouseEvent(window(), e.timestamp, device, e.local, e.global, e.buttons, e.button, e.type, e.modifiers); break; case QEvent::Wheel: - QWindowSystemInterface::handleWheelEvent(window(), e.timestamp, e.local, e.global, + QWindowSystemInterface::handleWheelEvent(window(), e.timestamp, device, e.local, e.global, e.pixelDelta, e.angleDelta, e.modifiers, e.phase, e.source, e.inverted); break; @@ -1378,6 +1381,9 @@ bool QWaylandWindow::handleTabletEventDecoration(QWaylandInputDevice *inputDevic void QWaylandWindow::handleMouseEventWithDecoration(QWaylandInputDevice *inputDevice, const QWaylandPointerEvent &e) { + // There's currently no way to get info about the actual hardware device in use. + // At least we get the correct seat. + const QPointingDevice *device = QPointingDevice::primaryPointingDevice(inputDevice->seatname()); if (mMousePressedInContentArea == Qt::NoButton && mWindowDecoration->handleMouse(inputDevice, e.local, e.global, e.buttons, e.modifiers)) { if (mMouseEventsInContentArea) { @@ -1411,10 +1417,10 @@ void QWaylandWindow::handleMouseEventWithDecoration(QWaylandInputDevice *inputDe case QEvent::MouseButtonPress: case QEvent::MouseButtonRelease: case QEvent::MouseMove: - QWindowSystemInterface::handleMouseEvent(window(), e.timestamp, localTranslated, globalTranslated, e.buttons, e.button, e.type, e.modifiers); + QWindowSystemInterface::handleMouseEvent(window(), e.timestamp, device, localTranslated, globalTranslated, e.buttons, e.button, e.type, e.modifiers); break; case QEvent::Wheel: { - QWindowSystemInterface::handleWheelEvent(window(), e.timestamp, + QWindowSystemInterface::handleWheelEvent(window(), e.timestamp, device, localTranslated, globalTranslated, e.pixelDelta, e.angleDelta, e.modifiers, e.phase, e.source, e.inverted); From 41d494860601f00b674f5a98d9482bb56cbd9d7c Mon Sep 17 00:00:00 2001 From: Inho Lee Date: Thu, 3 Oct 2024 09:48:20 +0200 Subject: [PATCH 1409/1507] Revert "TextInputV3: Prevent a recursive update call" This reverts commit 0b1d950e437bd0e112b7f4f25b42f3318634200a. set_cursor_rectangle needs commit for the proper cursor location. Fixes: QTBUG-129584 Reopens: QTBUG-126275 Pick-to: 6.8 6.7 Change-Id: Ibb11cbceab9cf00a4a2fa5ed3efc5e4ddddcd8d7 Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/plugins/platforms/wayland/qwaylandtextinputv3.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/plugins/platforms/wayland/qwaylandtextinputv3.cpp b/src/plugins/platforms/wayland/qwaylandtextinputv3.cpp index a4ff7100649..bb449c9d60d 100644 --- a/src/plugins/platforms/wayland/qwaylandtextinputv3.cpp +++ b/src/plugins/platforms/wayland/qwaylandtextinputv3.cpp @@ -238,6 +238,7 @@ void QWaylandTextInputv3::updateState(Qt::InputMethodQueries queries, uint32_t f if (surfaceRect != m_cursorRect) { set_cursor_rectangle(surfaceRect.x(), surfaceRect.y(), surfaceRect.width(), surfaceRect.height()); m_cursorRect = surfaceRect; + needsCommit = true; } } From 193b7f011f891eed3668e9a9476a61783f77c519 Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Thu, 6 Jul 2023 12:39:52 +0100 Subject: [PATCH 1410/1507] client: Implement xdg_system_bell_v1 This hooks up QGuiApplication::beep to the new wayland protocol [ChangeLog][Third-Party Code] New protocol synced from wayland-protocols Change-Id: I188eeb68fce406a0938011eb844bf9fbdabf5904 Reviewed-by: David Redondo --- .../xdg-system-bell/qt_attribution.json | 18 ++++++ .../xdg-system-bell/xdg-system-bell-v1.xml | 58 +++++++++++++++++++ src/plugins/platforms/wayland/CMakeLists.txt | 1 + .../platforms/wayland/qwaylanddisplay.cpp | 3 + .../platforms/wayland/qwaylanddisplay_p.h | 6 ++ .../platforms/wayland/qwaylandintegration.cpp | 10 ++++ .../platforms/wayland/qwaylandintegration_p.h | 1 + 7 files changed, 97 insertions(+) create mode 100644 src/3rdparty/wayland/protocols/xdg-system-bell/qt_attribution.json create mode 100644 src/3rdparty/wayland/protocols/xdg-system-bell/xdg-system-bell-v1.xml diff --git a/src/3rdparty/wayland/protocols/xdg-system-bell/qt_attribution.json b/src/3rdparty/wayland/protocols/xdg-system-bell/qt_attribution.json new file mode 100644 index 00000000000..cf8b0e5bde8 --- /dev/null +++ b/src/3rdparty/wayland/protocols/xdg-system-bell/qt_attribution.json @@ -0,0 +1,18 @@ +[ + { + "Id": "wayland-xdg-system-bell-protocol", + "Name": "Wayland XDG System Bell Protocol", + "QDocModule": "qtwaylandcompositor", + "QtUsage": "Used in the Qt Wayland Compositor, and the Qt Wayland platform plugin.", + "Files": "xdg-system-bell-v1.xml", + + "Description": "The XDG-System-Bell protocol provides a mechanism for apps to provide visual notification feedback through the compositor.", + "Homepage": "https://gitlab.freedesktop.org/wayland/wayland-protocols/", + "Version": "1.18", + "DownloadLocation": "https://gitlab.freedesktop.org/wayland/wayland-protocols/tree/1.38/", + "LicenseId": "MIT", + "License": "MIT License", + "LicenseFile": "../MIT_LICENSE.txt", + "Copyright": "Copyright © 2016, 2023 Red Hat\n" + } +] diff --git a/src/3rdparty/wayland/protocols/xdg-system-bell/xdg-system-bell-v1.xml b/src/3rdparty/wayland/protocols/xdg-system-bell/xdg-system-bell-v1.xml new file mode 100644 index 00000000000..f00508de850 --- /dev/null +++ b/src/3rdparty/wayland/protocols/xdg-system-bell/xdg-system-bell-v1.xml @@ -0,0 +1,58 @@ + + + + Copyright © 2016, 2023 Red Hat + + 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. + + + + + This global interface enables clients to ring the system bell. + + Warning! The protocol described in this file is currently in the testing + phase. Backward compatible changes may be added together with the + corresponding interface version bump. Backward incompatible changes can + only be done by creating a new major version of the extension. + + + + + Notify that the object will no longer be used. + + + + + + This requests rings the system bell on behalf of a client. How ringing + the bell is implemented is up to the compositor. It may be an audible + sound, a visual feedback of some kind, or any other thing including + nothing. + + The passed surface should correspond to a toplevel like surface role, + or be null, meaning the client doesn't have a particular toplevel it + wants to associate the bell ringing with. See the xdg-shell protocol + extension for a toplevel like surface role. + + + + + diff --git a/src/plugins/platforms/wayland/CMakeLists.txt b/src/plugins/platforms/wayland/CMakeLists.txt index 43c6848ea8b..b90ec57c402 100644 --- a/src/plugins/platforms/wayland/CMakeLists.txt +++ b/src/plugins/platforms/wayland/CMakeLists.txt @@ -107,6 +107,7 @@ qt6_generate_wayland_protocol_client_sources(WaylandClient ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/fractional-scale/fractional-scale-v1.xml ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/viewporter/viewporter.xml ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/xdg-shell/xdg-shell.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/xdg-system-bell/xdg-system-bell-v1.xml ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/xdg-toplevel-drag/xdg-toplevel-drag-v1.xml ${CMAKE_CURRENT_SOURCE_DIR}/../extensions/qt-key-unstable-v1.xml ${CMAKE_CURRENT_SOURCE_DIR}/../extensions/qt-text-input-method-unstable-v1.xml diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index 79cec09af93..edd769b35a8 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -50,6 +50,7 @@ #include #include #include +#include #include #include @@ -779,6 +780,8 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin } else if (interface == QLatin1String(QtWayland::qt_windowmanager::interface()->name)) { mGlobals.windowManagerIntegration.reset( new QWaylandWindowManagerIntegration(this, id, version)); + } else if (interface == QLatin1String(QtWayland::xdg_system_bell_v1::interface()->name)) { + mGlobals.systemBell.reset(new WithDestructor(registry, id, 1)); } mRegistryGlobals.append(RegistryGlobal(id, interface, version, registry)); diff --git a/src/plugins/platforms/wayland/qwaylanddisplay_p.h b/src/plugins/platforms/wayland/qwaylanddisplay_p.h index 1e74c6dd297..be1beb87557 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay_p.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay_p.h @@ -55,6 +55,7 @@ namespace QtWayland { class wp_cursor_shape_manager_v1; class wp_fractional_scale_manager_v1; class wp_viewporter; + class xdg_system_bell_v1; class xdg_toplevel_drag_manager_v1; } @@ -206,6 +207,10 @@ public: { return mGlobals.xdgToplevelDragManager.get(); } + QtWayland::xdg_system_bell_v1 *systemBell() const + { + return mGlobals.systemBell.get(); + } struct RegistryGlobal { @@ -337,6 +342,7 @@ private: std::unique_ptr viewporter; std::unique_ptr fractionalScaleManager; std::unique_ptr cursorShapeManager; + std::unique_ptr systemBell; std::unique_ptr xdgToplevelDragManager; std::unique_ptr windowManagerIntegration; } mGlobals; diff --git a/src/plugins/platforms/wayland/qwaylandintegration.cpp b/src/plugins/platforms/wayland/qwaylandintegration.cpp index c5eb1e96ae4..d505f4844ff 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandintegration.cpp @@ -57,6 +57,8 @@ #include "qwaylandinputdeviceintegrationfactory_p.h" #include "qwaylandwindow_p.h" +#include + #if QT_CONFIG(accessibility_atspi_bridge) #include #endif @@ -529,6 +531,14 @@ void QWaylandIntegration::setApplicationBadge(qint64 number) { mPlatformServices->setApplicationBadge(number); } + +void QWaylandIntegration::beep() const +{ + if (auto bell = mDisplay->systemBell()) { + bell->ring(nullptr); + } +} + } QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandintegration_p.h b/src/plugins/platforms/wayland/qwaylandintegration_p.h index f26cc3d2916..d75fef6194a 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration_p.h +++ b/src/plugins/platforms/wayland/qwaylandintegration_p.h @@ -90,6 +90,7 @@ public: #endif void setApplicationBadge(qint64 number) override; + void beep() const override; virtual QWaylandInputDevice *createInputDevice(QWaylandDisplay *display, int version, uint32_t id) const; virtual QWaylandScreen *createPlatformScreen(QWaylandDisplay *waylandDisplay, int version, uint32_t id) const; From 2d5c66b79c24764e9820b8a34c0767127e5e3881 Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Thu, 29 Aug 2024 09:37:41 +0200 Subject: [PATCH 1411/1507] client: Flush painting on subsurfaces When native widgets are nested in Qt, they act like independent windows with a shared backing store. The toplevel window gets multiple flush events with an argument for the window sub-content. In wayland we need a unique backing store, so this code copies the relevant contents into a new buffer and attaches it to the subsurface. Task-number: QTBUG-128029 Pick-to: 6.8 Change-Id: I865cb271d694d8190a444eb5a98378cd6a30634d Reviewed-by: David Redondo --- .../platforms/wayland/qwaylandshmbackingstore.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp b/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp index d77c548a009..2ef33bc2777 100644 --- a/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp +++ b/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp @@ -208,16 +208,23 @@ void QWaylandShmBackingStore::endPaint() void QWaylandShmBackingStore::flush(QWindow *window, const QRegion ®ion, const QPoint &offset) { + Q_UNUSED(offset) // Invoked when the window is of type RasterSurface or when the window is // RasterGLSurface and there are no child widgets requiring OpenGL composition. // For the case of RasterGLSurface + having to compose, the composeAndFlush() is // called instead. The default implementation from QPlatformBackingStore is sufficient // however so no need to reimplement that. - - - Q_UNUSED(window); - Q_UNUSED(offset); + if (window != this->window()) { + auto waylandWindow = static_cast(window->handle()); + auto newBuffer = new QWaylandShmBuffer(mDisplay, window->size(), mBackBuffer->image()->format(), mBackBuffer->scale()); + newBuffer->setDeleteOnRelease(true); + QRect sourceRect(window->position(), window->size()); + QPainter painter(newBuffer->image()); + painter.drawImage(QPoint(0, 0), *mBackBuffer->image(), sourceRect); + waylandWindow->safeCommit(newBuffer, region); + return; + } if (mPainting) { mPendingRegion |= region; From 8784a01787f72bfea7124ecb2b896ebf644d1824 Mon Sep 17 00:00:00 2001 From: YaoBing Xiao Date: Wed, 16 Oct 2024 13:21:52 +0800 Subject: [PATCH 1412/1507] Client: Implement interface name printing for Wayland protocol Change-Id: I73eb629caedf3c9f78b5d83168549125422092b6 Reviewed-by: David Edmundson --- src/plugins/platforms/wayland/global/qwaylandclientextension.h | 3 ++- .../wayland/shellintegration/qwaylandshellintegration_p.h | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/wayland/global/qwaylandclientextension.h b/src/plugins/platforms/wayland/global/qwaylandclientextension.h index c57549c34a8..774c5ba7750 100644 --- a/src/plugins/platforms/wayland/global/qwaylandclientextension.h +++ b/src/plugins/platforms/wayland/global/qwaylandclientextension.h @@ -84,7 +84,8 @@ public: // developer and the version specified in the protocol and also the // compositor version. if (this->version() > T::interface()->version) { - qWarning("Supplied protocol version to QWaylandClientExtensionTemplate is higher than the version of the protocol, using protocol version instead."); + qWarning("Supplied protocol version to QWaylandClientExtensionTemplate is higher than the version of the protocol, using protocol version instead. interface.name: %s", + T::interface()->name); } int minVersion = qMin(ver, qMin(T::interface()->version, this->version())); setVersion(minVersion); diff --git a/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegration_p.h b/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegration_p.h index 791a940435f..59b3c9e5a13 100644 --- a/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegration_p.h +++ b/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegration_p.h @@ -81,7 +81,8 @@ public: // developer and the version specified in the protocol and also the // compositor version. if (this->version() > T::interface()->version) { - qWarning("Supplied protocol version to QWaylandClientExtensionTemplate is higher than the version of the protocol, using protocol version instead."); + qWarning("Supplied protocol version to QWaylandClientExtensionTemplate is higher than the version of the protocol, using protocol version instead. interface.name: %s", + T::interface()->name); } int minVersion = qMin(ver, qMin(T::interface()->version, this->version())); setVersion(minVersion); From 62f4289cdea6aa6f6e84661ab4889cb361079b53 Mon Sep 17 00:00:00 2001 From: Inho Lee Date: Thu, 3 Oct 2024 09:51:03 +0200 Subject: [PATCH 1413/1507] textInputV3: Prevent recursive update calls If a 'done' which the compositor sends doesn't make any update in the client side, an additional event and updates will be skipped. Fixes: QTBUG-126275 Pick-to: 6.8 Change-Id: I86bebb3cc645f46ec2bfc6ef587ff86b76d44c9e Reviewed-by: David Edmundson Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/plugins/platforms/wayland/qwaylandtextinputv3.cpp | 8 ++++++++ src/plugins/platforms/wayland/qwaylandtextinputv3_p.h | 5 +++++ 2 files changed, 13 insertions(+) diff --git a/src/plugins/platforms/wayland/qwaylandtextinputv3.cpp b/src/plugins/platforms/wayland/qwaylandtextinputv3.cpp index bb449c9d60d..d98a7a5fca9 100644 --- a/src/plugins/platforms/wayland/qwaylandtextinputv3.cpp +++ b/src/plugins/platforms/wayland/qwaylandtextinputv3.cpp @@ -129,6 +129,14 @@ void QWaylandTextInputv3::zwp_text_input_v3_done(uint32_t serial) return; } + if ((m_pendingPreeditString == m_currentPreeditString) + && (m_pendingCommitString.isEmpty() && m_pendingDeleteBeforeText == 0 + && m_pendingDeleteAfterText == 0)) { + // Current done doesn't need additional updates + m_pendingPreeditString.clear(); + return; + } + qCDebug(qLcQpaWaylandTextInput) << Q_FUNC_INFO << "PREEDIT" << m_pendingPreeditString.text << m_pendingPreeditString.cursorBegin; QList attributes; diff --git a/src/plugins/platforms/wayland/qwaylandtextinputv3_p.h b/src/plugins/platforms/wayland/qwaylandtextinputv3_p.h index 8e32e514dd8..4ea82b1f592 100644 --- a/src/plugins/platforms/wayland/qwaylandtextinputv3_p.h +++ b/src/plugins/platforms/wayland/qwaylandtextinputv3_p.h @@ -74,6 +74,11 @@ private: cursorBegin = 0; cursorEnd = 0; } + friend bool operator==(const PreeditInfo& lhs, const PreeditInfo& rhs) { + return (lhs.text == rhs.text) + && (lhs.cursorBegin == rhs.cursorBegin) + && (lhs.cursorEnd == rhs.cursorEnd); + } }; PreeditInfo m_pendingPreeditString; From d335a332f8afe347d02ce3507466578a5bbf97fe Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Tue, 26 Dec 2023 22:43:11 +0000 Subject: [PATCH 1414/1507] client: Make use of floating QWindow::mapToGlobal Wayland input is always surface-local, which we map to a faux global position for Qt usages. Precision of non-integer co-ordinates were either lost or handled in a more complicated way that needed. Change-Id: Ia8101d4903caec42f1087a7b4adeff3a9a097a12 Reviewed-by: Vlad Zahorodnii --- .../platforms/wayland/qwaylandinputdevice.cpp | 17 ++++++----------- .../platforms/wayland/qwaylandtabletv2.cpp | 6 ++---- src/plugins/platforms/wayland/qwaylandtouch.cpp | 3 +-- 3 files changed, 9 insertions(+), 17 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index e2b788171a0..03cb2707330 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -653,7 +653,7 @@ void QWaylandInputDevice::Pointer::pointer_enter(uint32_t serial, struct wl_surf connect(mFocus.data(), &QObject::destroyed, this, &Pointer::handleFocusDestroyed); mSurfacePos = QPointF(wl_fixed_to_double(sx), wl_fixed_to_double(sy)); - mGlobalPos = window->mapToGlobal(mSurfacePos.toPoint()); + mGlobalPos = window->mapToGlobalF(mSurfacePos); mParent->mSerial = serial; mEnterSerial = serial; @@ -718,9 +718,7 @@ void QWaylandInputDevice::Pointer::pointer_motion(uint32_t time, wl_fixed_t surf } QPointF pos(wl_fixed_to_double(surface_x), wl_fixed_to_double(surface_y)); - QPointF delta = pos - pos.toPoint(); - QPointF global = window->mapToGlobal(pos.toPoint()); - global += delta; + QPointF global = window->mapToGlobalF(pos); mSurfacePos = pos; mGlobalPos = global; @@ -731,7 +729,7 @@ void QWaylandInputDevice::Pointer::pointer_motion(uint32_t time, wl_fixed_t surf // We can't know the true position since we're getting events for another surface, // so we just set it outside of the window boundaries. pos = QPointF(-1, -1); - global = grab->mapToGlobal(pos.toPoint()); + global = grab->mapToGlobalF(pos); window = grab; } setFrameEvent(new MotionEvent(window, time, pos, global, mButtons, mParent->modifiers())); @@ -813,7 +811,7 @@ void QWaylandInputDevice::Pointer::pointer_button(uint32_t serial, uint32_t time QPointF global = mGlobalPos; if (grab && grab != focusWindow()) { pos = QPointF(-1, -1); - global = grab->mapToGlobal(pos.toPoint()); + global = grab->mapToGlobalF(pos); window = grab; } @@ -1480,11 +1478,8 @@ void QWaylandInputDevice::handleTouchPoint(int id, QEventPoint::State state, con return; tp.area = QRectF(0, 0, 8, 8); - QPointF localPosition = win->mapFromWlSurface(surfacePosition); - // TODO: This doesn't account for high dpi scaling for the delta, but at least it matches - // what we have for mouse input. - QPointF delta = localPosition - localPosition.toPoint(); - QPointF globalPosition = win->mapToGlobal(localPosition.toPoint()) + delta; + const QPointF localPosition = win->mapFromWlSurface(surfacePosition); + const QPointF globalPosition = win->mapToGlobalF(localPosition); tp.area.moveCenter(globalPosition); } diff --git a/src/plugins/platforms/wayland/qwaylandtabletv2.cpp b/src/plugins/platforms/wayland/qwaylandtabletv2.cpp index 6a8c84c44a8..b29319bc9d6 100644 --- a/src/plugins/platforms/wayland/qwaylandtabletv2.cpp +++ b/src/plugins/platforms/wayland/qwaylandtabletv2.cpp @@ -547,9 +547,7 @@ void QWaylandTabletToolV2::zwp_tablet_tool_v2_frame(uint32_t time) ulong timestamp = time; const QPointF localPosition = waylandWindow->mapFromWlSurface(m_pending.surfacePosition); - QPointF delta = localPosition - localPosition.toPoint(); - QPointF globalPosition = window->mapToGlobal(localPosition.toPoint()); - globalPosition += delta; + const QPointF globalPosition = waylandWindow->mapToGlobalF(localPosition); Qt::MouseButtons buttons = m_pending.down ? Qt::MouseButton::LeftButton : Qt::MouseButton::NoButton; buttons |= m_pending.buttons; @@ -564,7 +562,7 @@ void QWaylandTabletToolV2::zwp_tablet_tool_v2_frame(uint32_t time) // but we need surface coordinates to include the decoration bool decorationHandledEvent = waylandWindow->handleTabletEventDecoration( m_tabletSeat->seat(), m_pending.surfacePosition, - window->mapToGlobal(m_pending.surfacePosition) + delta, buttons, + window->mapToGlobal(m_pending.surfacePosition), buttons, m_tabletSeat->seat()->modifiers()); if (!decorationHandledEvent) { diff --git a/src/plugins/platforms/wayland/qwaylandtouch.cpp b/src/plugins/platforms/wayland/qwaylandtouch.cpp index dfd04d44694..b38c895520a 100644 --- a/src/plugins/platforms/wayland/qwaylandtouch.cpp +++ b/src/plugins/platforms/wayland/qwaylandtouch.cpp @@ -83,8 +83,7 @@ void QWaylandTouchExtension::touch_extension_touch(uint32_t time, tp.area = QRectF(0, 0, fromFixed(width), fromFixed(height)); // Got surface-relative coords but need a (virtual) screen position. QPointF relPos = QPointF(fromFixed(x), fromFixed(y)); - QPointF delta = relPos - relPos.toPoint(); - tp.area.moveCenter(mTargetWindow->mapToGlobal(relPos.toPoint()) + delta); + tp.area.moveCenter(mTargetWindow->mapToGlobal(relPos)); tp.normalPosition.setX(fromFixed(normalized_x)); tp.normalPosition.setY(fromFixed(normalized_y)); From 1dfa712eb534ef0a2a17b90d1e19faff27dd0509 Mon Sep 17 00:00:00 2001 From: David Redondo Date: Mon, 21 Oct 2024 09:22:30 +0200 Subject: [PATCH 1415/1507] client: Run waylandscanner with private-code This is the recommended mode, and failing to use private-code makes libraries expose generated symbols like wl_shm_interface, which may conflict with symbols from libwayland leading to unexpected behavior or aborts. Change-Id: Ifcb701a8670b339d24b13f2812c10493a64ee060 Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/plugins/platforms/wayland/CMakeLists.txt | 1 + .../plugins/hardwareintegration/brcm-egl/CMakeLists.txt | 1 + .../plugins/hardwareintegration/dmabuf-server/CMakeLists.txt | 4 +++- .../hardwareintegration/drm-egl-server/CMakeLists.txt | 4 +++- .../hardwareintegration/libhybris-egl-server/CMakeLists.txt | 1 + .../hardwareintegration/shm-emulation-server/CMakeLists.txt | 4 +++- .../plugins/hardwareintegration/vulkan-server/CMakeLists.txt | 5 ++++- .../shellintegration/fullscreen-shell-v1/CMakeLists.txt | 1 + .../wayland/plugins/shellintegration/wl-shell/CMakeLists.txt | 1 + .../plugins/shellintegration/xdg-shell/CMakeLists.txt | 1 + tests/auto/wayland/clientextension/CMakeLists.txt | 2 ++ 11 files changed, 21 insertions(+), 4 deletions(-) diff --git a/src/plugins/platforms/wayland/CMakeLists.txt b/src/plugins/platforms/wayland/CMakeLists.txt index b90ec57c402..eca51287740 100644 --- a/src/plugins/platforms/wayland/CMakeLists.txt +++ b/src/plugins/platforms/wayland/CMakeLists.txt @@ -94,6 +94,7 @@ qt_internal_add_module(WaylandClient ) qt6_generate_wayland_protocol_client_sources(WaylandClient + PRIVATE_CODE FILES ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/cursor-shape/cursor-shape-v1.xml ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/pointer-gestures/pointer-gestures-unstable-v1.xml diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/CMakeLists.txt index 6a376ddad3f..f706632c0a6 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/CMakeLists.txt +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/CMakeLists.txt @@ -28,6 +28,7 @@ qt_internal_add_plugin(QWaylandBrcmEglClientBufferPlugin ) qt6_generate_wayland_protocol_client_sources(QWaylandBrcmEglClientBufferPlugin + PRIVATE_CODE FILES ${CMAKE_CURRENT_SOURCE_DIR}/../../../../hardwareintegration/client/brcm-egl/../../../extensions/brcm.xml ) diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/dmabuf-server/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/hardwareintegration/dmabuf-server/CMakeLists.txt index bc6c29ecfbd..7329aebc323 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/dmabuf-server/CMakeLists.txt +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/dmabuf-server/CMakeLists.txt @@ -26,8 +26,10 @@ qt_internal_add_plugin(DmaBufServerBufferPlugin ) qt6_generate_wayland_protocol_client_sources(DmaBufServerBufferPlugin + PRIVATE_CODE FILES - ${CMAKE_CURRENT_SOURCE_DIR}/../../../../hardwareintegration/client/dmabuf-server/../../../extensions/qt-dmabuf-server-buffer.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../../../../extensions/qt-dmabuf-server-buffer.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../../../../extensions/server-buffer-extension.xml ) #### Keys ignored in scope 1:.:.:dmabuf-server.pro:: diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/drm-egl-server/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/hardwareintegration/drm-egl-server/CMakeLists.txt index 1b40b7fc041..535b1024f0f 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/drm-egl-server/CMakeLists.txt +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/drm-egl-server/CMakeLists.txt @@ -26,8 +26,10 @@ qt_internal_add_plugin(DrmEglServerBufferPlugin ) qt6_generate_wayland_protocol_client_sources(DrmEglServerBufferPlugin + PRIVATE_CODE FILES - ${CMAKE_CURRENT_SOURCE_DIR}/../../../../hardwareintegration/client/drm-egl-server/../../../extensions/drm-egl-server-buffer.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../../../../extensions/drm-egl-server-buffer.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../../../../extensions/server-buffer-extension.xml ) #### Keys ignored in scope 1:.:.:drm-egl-server.pro:: diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/libhybris-egl-server/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/hardwareintegration/libhybris-egl-server/CMakeLists.txt index 5167cef490b..6b7cd897e19 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/libhybris-egl-server/CMakeLists.txt +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/libhybris-egl-server/CMakeLists.txt @@ -25,6 +25,7 @@ qt_internal_add_plugin(LibHybrisEglServerBufferPlugin ) qt6_generate_wayland_protocol_client_sources(LibHybrisEglServerBufferPlugin + PRIVATE_CODE FILES ${CMAKE_CURRENT_SOURCE_DIR}/../../../../hardwareintegration/client/libhybris-egl-server/../../../extensions/libhybris-egl-server-buffer.xml ) diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/shm-emulation-server/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/hardwareintegration/shm-emulation-server/CMakeLists.txt index 351f7bc8191..b979086d2c7 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/shm-emulation-server/CMakeLists.txt +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/shm-emulation-server/CMakeLists.txt @@ -25,8 +25,10 @@ qt_internal_add_plugin(ShmServerBufferPlugin ) qt6_generate_wayland_protocol_client_sources(ShmServerBufferPlugin + PRIVATE_CODE FILES - ${CMAKE_CURRENT_SOURCE_DIR}/../../../../hardwareintegration/client/shm-emulation-server/../../../extensions/shm-emulation-server-buffer.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../../../../extensions/server-buffer-extension.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../../../../extensions/shm-emulation-server-buffer.xml ) #### Keys ignored in scope 1:.:.:shm-emulation-server.pro:: diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/vulkan-server/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/hardwareintegration/vulkan-server/CMakeLists.txt index 72f527210b7..f0aeabf291a 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/vulkan-server/CMakeLists.txt +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/vulkan-server/CMakeLists.txt @@ -25,8 +25,11 @@ qt_internal_add_plugin(VulkanServerBufferPlugin ) qt6_generate_wayland_protocol_client_sources(VulkanServerBufferPlugin + PRIVATE_CODE FILES - ${CMAKE_CURRENT_SOURCE_DIR}/../../../../hardwareintegration/client/vulkan-server/../../../extensions/qt-vulkan-server-buffer-unstable-v1.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../../../../extensions/qt-vulkan-server-buffer-unstable-v1.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../../../../extensions/server-buffer-extension.xml + ) #### Keys ignored in scope 1:.:.:vulkan-server.pro:: diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/fullscreen-shell-v1/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/shellintegration/fullscreen-shell-v1/CMakeLists.txt index 693dbde5fe7..9f16e82d9f7 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/fullscreen-shell-v1/CMakeLists.txt +++ b/src/plugins/platforms/wayland/plugins/shellintegration/fullscreen-shell-v1/CMakeLists.txt @@ -26,6 +26,7 @@ qt_internal_add_plugin(QWaylandFullScreenShellV1IntegrationPlugin ) qt6_generate_wayland_protocol_client_sources(QWaylandFullScreenShellV1IntegrationPlugin + PRIVATE_CODE FILES ${CMAKE_CURRENT_SOURCE_DIR}/../../../3rdparty/protocol/fullscreen-shell/fullscreen-shell-unstable-v1.xml ) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/CMakeLists.txt index b2871c92b14..6ed139295a2 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/CMakeLists.txt +++ b/src/plugins/platforms/wayland/plugins/shellintegration/wl-shell/CMakeLists.txt @@ -28,6 +28,7 @@ qt_internal_add_module(WlShellIntegrationPrivate qt6_generate_wayland_protocol_client_sources(WlShellIntegrationPrivate # this is just a helper module and still part of the QtWaylandClient build __QT_INTERNAL_WAYLAND_INCLUDE_DIR QtWaylandClient/private + PRIVATE_CODE FILES ${CMAKE_CURRENT_SOURCE_DIR}/../../../3rdparty/protocol/wayland/wayland.xml ) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/CMakeLists.txt index 74e925f73cc..529ea1f6b22 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/CMakeLists.txt +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/CMakeLists.txt @@ -34,6 +34,7 @@ qt_internal_add_plugin(QWaylandXdgShellIntegrationPlugin ) qt6_generate_wayland_protocol_client_sources(QWaylandXdgShellIntegrationPlugin + PRIVATE_CODE FILES ${CMAKE_CURRENT_SOURCE_DIR}/../../../3rdparty/protocol/xdg-decoration/xdg-decoration-unstable-v1.xml ${CMAKE_CURRENT_SOURCE_DIR}/../../../3rdparty/protocol/xdg-shell/xdg-shell.xml diff --git a/tests/auto/wayland/clientextension/CMakeLists.txt b/tests/auto/wayland/clientextension/CMakeLists.txt index 4997b7d7732..063f3f4740b 100644 --- a/tests/auto/wayland/clientextension/CMakeLists.txt +++ b/tests/auto/wayland/clientextension/CMakeLists.txt @@ -9,9 +9,11 @@ qt_internal_add_test(tst_clientextension ) qt6_generate_wayland_protocol_client_sources(tst_clientextension + PRIVATE_CODE FILES ${CMAKE_CURRENT_SOURCE_DIR}/test.xml ) qt6_generate_wayland_protocol_server_sources(tst_clientextension + PRIVATE_CODE FILES ${CMAKE_CURRENT_SOURCE_DIR}/test.xml ) From e00905d94325302600ef73dd5094c5a7f8ba2852 Mon Sep 17 00:00:00 2001 From: Lu YaNing Date: Tue, 22 Oct 2024 17:18:31 +0800 Subject: [PATCH 1416/1507] client: use wl_shm.release if available Change-Id: Ica8a210e988604346cba36b69658bc83fbf21179 Reviewed-by: David Redondo --- src/plugins/platforms/wayland/qwaylandshm.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandshm.cpp b/src/plugins/platforms/wayland/qwaylandshm.cpp index 9ee7a96bce7..7f61027d1db 100644 --- a/src/plugins/platforms/wayland/qwaylandshm.cpp +++ b/src/plugins/platforms/wayland/qwaylandshm.cpp @@ -10,13 +10,17 @@ QT_BEGIN_NAMESPACE namespace QtWaylandClient { QWaylandShm::QWaylandShm(QWaylandDisplay *display, int version, uint32_t id) - : QtWayland::wl_shm(display->wl_registry(), id, qMin(version, 1)) + : QtWayland::wl_shm(display->wl_registry(), id, qMin(version, 2)) { } QWaylandShm::~QWaylandShm() { - wl_shm_destroy(object()); + if (version() < WL_SHM_RELEASE_SINCE_VERSION) { + wl_shm_destroy(object()); + } else { + wl_shm_release(object()); + } } void QWaylandShm::shm_format(uint32_t format) From 885a708e69d57d284343b282c916db507979d7ff Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Wed, 7 Aug 2024 18:38:34 +0100 Subject: [PATCH 1417/1507] client: Notify application code of button release after leave There is a code path to notify application code that mouse buttons are released following a drag. Compositors we will have been sent a leave event in the meantime, making this code inert. Focus window will be null, and mButtons will be empty. We still need to send a release event QWindowSystem event to no window, as we need to update any grabs on the device. Pick-to: 6.8 Change-Id: I2a090561c7d3f4669ab2dbc4eb86c8226fe15d1a Fixes: QTBUG-127821 Reviewed-by: David Redondo --- src/plugins/platforms/wayland/qwaylandinputdevice.cpp | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index 03cb2707330..afbb3879b6d 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -833,15 +833,7 @@ void QWaylandInputDevice::Pointer::invalidateFocus() void QWaylandInputDevice::Pointer::releaseButtons() { - if (mButtons == Qt::NoButton) - return; - - mButtons = Qt::NoButton; - - if (auto *window = focusWindow()) { - ReleaseEvent e(focusWindow(), mParent->mTime, mSurfacePos, mGlobalPos, mButtons, mLastButton, mParent->modifiers()); - window->handleMouse(mParent, e); - } + setFrameEvent(new ReleaseEvent(nullptr, mParent->mTime, mSurfacePos, mGlobalPos, Qt::NoButton, Qt::NoButton, mParent->modifiers())); } void QWaylandInputDevice::Pointer::leavePointers() From dbe589453083037a6e4c0a23e6f342cfd9172877 Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Tue, 17 Sep 2024 22:49:34 +0100 Subject: [PATCH 1418/1507] Client: Use synchronous delivery for geometry events This simplifies the data flow and reduces the paths for some races with threaded rendering. Making all events synchronous does not work due to application logic having nested event loops. The design is all normal wayland events are flushed at the end of each dispatch so that everything remains ordered. When a configure event is received applying that state is queued. When it is applied, all events emitted from this are flushed. Application driven geometry changes are also synchronous. The old code to manage frame synchronization is removed, this attempted to not apply configure events whilst a frame is in flight. It doesn't work properly as the render thread could start on the next frame whilst the main thread processed the resize. It is problematic in this port as the mutexes will cause deadlocks with sync delivery. Task-number: QTBUG-121731 Fixes: QTBUG-117762 Fixes: QTBUG-119112 Change-Id: I5802b4006d307a45468767d68c3ad40078df5703 Reviewed-by: Vlad Zahorodnii --- .../xdg-shell/qwaylandxdgshell.cpp | 9 +- .../platforms/wayland/qwaylanddisplay.cpp | 1 + .../platforms/wayland/qwaylandwindow.cpp | 86 +++++-------------- .../platforms/wayland/qwaylandwindow_p.h | 8 -- tests/auto/wayland/xdgshell/tst_xdgshell.cpp | 1 - 5 files changed, 28 insertions(+), 77 deletions(-) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp index 11add2809bc..ce0ab795732 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp @@ -413,15 +413,16 @@ void QWaylandXdgSurface::applyConfigure() if (m_pendingConfigureSerial == m_appliedConfigureSerial) return; - if (m_toplevel) - m_toplevel->applyConfigure(); - if (m_popup) - m_popup->applyConfigure(); m_appliedConfigureSerial = m_pendingConfigureSerial; m_configured = true; ack_configure(m_appliedConfigureSerial); + if (m_toplevel) + m_toplevel->applyConfigure(); + if (m_popup) + m_popup->applyConfigure(); + window()->updateExposure(); } diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index edd769b35a8..b680c810f99 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -503,6 +503,7 @@ void QWaylandDisplay::reconnect() void QWaylandDisplay::flushRequests() { m_eventThread->readAndDispatchEvents(); + QWindowSystemInterface::flushWindowSystemEvents(); } // We have to wait until we have an eventDispatcher before creating the eventThread, diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 232b6503d9b..81969d16a5d 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -335,7 +335,6 @@ void QWaylandWindow::resetSurfaceRole() } mFrameCallbackTimedOut = false; mWaitingToApplyConfigure = false; - mCanResize = true; mResizeDirty = false; mExposed = false; } @@ -452,27 +451,27 @@ void QWaylandWindow::setGeometry(const QRect &r) } } - if (window()->isVisible() && rect.isValid()) { - if (mWindowDecorationEnabled) - mWindowDecoration->update(); - - if (mResizeAfterSwap && windowType() == Egl && mSentInitialResize) { - QMutexLocker lock(&mResizeLock); - mResizeDirty = true; - } else { - QWindowSystemInterface::handleGeometryChange(window(), geometry()); - } - mSentInitialResize = true; - } - QRect exposeGeometry(QPoint(), geometry().size()); - if (isExposed() && !mInResizeFromApplyConfigure && exposeGeometry != mLastExposeGeometry) - sendExposeEvent(exposeGeometry); - if (mShellSurface) mShellSurface->setContentGeometry(windowContentGeometry()); if (isOpaque() && mMask.isEmpty()) setOpaqueArea(QRect(QPoint(0, 0), rect.size())); + + + if (window()->isVisible() && rect.isValid()) { + ensureSize(); + if (mWindowDecorationEnabled) + mWindowDecoration->update(); + + if (mResizeAfterSwap && windowType() == Egl && mSentInitialResize) { + mResizeDirty = true; + } + QWindowSystemInterface::handleGeometryChange(window(), geometry()); + mSentInitialResize = true; + } + QRect exposeGeometry(QPoint(), geometry().size()); + if (isExposed() && !mInResizeFromApplyConfigure && exposeGeometry != mLastExposeGeometry) + sendExposeEvent(exposeGeometry); } void QWaylandWindow::updateInputRegion() @@ -549,8 +548,8 @@ void QWaylandWindow::resizeFromApplyConfigure(const QSize &sizeWithMargins, cons void QWaylandWindow::sendExposeEvent(const QRect &rect) { if (!(mShellSurface && mShellSurface->handleExpose(rect))) { - QWindowSystemInterface::handleExposeEvent(window(), rect); mLastExposeGeometry = rect; + QWindowSystemInterface::handleExposeEvent(window(), rect); } else qCDebug(lcQpaWayland) << "sendExposeEvent: intercepted by shell extension, not sending"; @@ -645,67 +644,26 @@ bool QWaylandWindow::isAlertState() const void QWaylandWindow::applyConfigureWhenPossible() { - QMutexLocker resizeLocker(&mResizeLock); if (!mWaitingToApplyConfigure) { mWaitingToApplyConfigure = true; QMetaObject::invokeMethod(this, "applyConfigure", Qt::QueuedConnection); } } -void QWaylandWindow::doApplyConfigure() +void QWaylandWindow::applyConfigure() { if (!mWaitingToApplyConfigure) return; Q_ASSERT_X(QThread::currentThreadId() == QThreadData::get2(thread())->threadId.loadRelaxed(), - "QWaylandWindow::doApplyConfigure", "not called from main thread"); + "QWaylandWindow::applyConfigure", "not called from main thread"); if (mShellSurface) mShellSurface->applyConfigure(); mWaitingToApplyConfigure = false; - - sendExposeEvent(QRect(QPoint(), geometry().size())); -} - -void QWaylandWindow::doApplyConfigureFromOtherThread() -{ - QMutexLocker lock(&mResizeLock); - if (!mCanResize || !mWaitingToApplyConfigure) - return; - doApplyConfigure(); -} - -void QWaylandWindow::setCanResize(bool canResize) -{ - QMutexLocker lock(&mResizeLock); - mCanResize = canResize; - - if (canResize) { - if (mResizeDirty) { - QWindowSystemInterface::handleGeometryChange(window(), geometry()); - } - if (mWaitingToApplyConfigure) { - bool inGuiThread = QThread::currentThreadId() == QThreadData::get2(thread())->threadId.loadRelaxed(); - if (inGuiThread) { - doApplyConfigure(); - } else { - QMetaObject::invokeMethod(this, &QWaylandWindow::doApplyConfigureFromOtherThread, Qt::QueuedConnection); - } - } else if (mResizeDirty) { - mResizeDirty = false; - } - } -} - -void QWaylandWindow::applyConfigure() -{ - QMutexLocker lock(&mResizeLock); - - if (mCanResize || !mSentInitialResize) - doApplyConfigure(); - - lock.unlock(); + QRect exposeGeometry(QPoint(), geometry().size()); + sendExposeEvent(exposeGeometry); QWindowSystemInterface::flushWindowSystemEvents(); } @@ -1488,7 +1446,6 @@ void QWaylandWindow::setScale(qreal newScale) return; mScale = newScale; - QWindowSystemInterface::handleWindowDevicePixelRatioChanged(window()); if (mSurface) { if (mViewport) updateViewport(); @@ -1497,6 +1454,7 @@ void QWaylandWindow::setScale(qreal newScale) } ensureSize(); + QWindowSystemInterface::handleWindowDevicePixelRatioChanged(window()); if (isExposed()) { // redraw at the new DPR window()->requestUpdate(); diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index bb8c5b18826..5bb7e2c6e02 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -193,9 +193,6 @@ public: QWaylandWindow *transientParent() const; - void doApplyConfigure(); - void setCanResize(bool canResize); - bool setMouseGrabEnabled(bool grab) override; static QWaylandWindow *mouseGrab() { return mMouseGrab; } @@ -309,9 +306,7 @@ protected: bool mWaitingForUpdate = false; bool mExposed = false; - QRecursiveMutex mResizeLock; bool mWaitingToApplyConfigure = false; - bool mCanResize = true; bool mResizeDirty = false; bool mResizeAfterSwap; int mFrameCallbackTimeout = 100; @@ -344,9 +339,6 @@ protected: Qt::ScreenOrientation mLastReportedContentOrientation = Qt::PrimaryOrientation; -private Q_SLOTS: - void doApplyConfigureFromOtherThread(); - private: void setGeometry_helper(const QRect &rect); void initWindow(); diff --git a/tests/auto/wayland/xdgshell/tst_xdgshell.cpp b/tests/auto/wayland/xdgshell/tst_xdgshell.cpp index a14f103219c..0bb3b3ecf9d 100644 --- a/tests/auto/wayland/xdgshell/tst_xdgshell.cpp +++ b/tests/auto/wayland/xdgshell/tst_xdgshell.cpp @@ -49,7 +49,6 @@ void tst_xdgshell::showMinimized() // between a window preview and an unminimized window. QWindow window; window.showMinimized(); - QCOMPARE(window.windowStates(), Qt::WindowMinimized); // should return minimized until QTRY_COMPARE(window.windowStates(), Qt::WindowNoState); // rejected by handleWindowStateChanged // Make sure the window on the compositor side is/was created here, and not after the test From a49524bf035aa23007c8110a64b29d3b2663bdcf Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Thu, 24 Oct 2024 14:48:40 +0100 Subject: [PATCH 1419/1507] client: Drop outdated QT_WAYLAND_RESIZE_AFTER_SWAP QT_WAYLAND_RESIZE_AFTER_SWAP was added in15f82d0bc40eae635ed1377ae39253a8f515ea4a in 2014 to provide an opt-in-path to support drivers that did not apply an eglWindow resize until after the swap occurred. This is now the default in the EGL specification and fully supported in QtWayland. The environment variable does nothing. Change-Id: I8114d11801db5ba6863f48e2d44cca984bb58de7 Reviewed-by: Vlad Zahorodnii --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 5 ----- src/plugins/platforms/wayland/qwaylandwindow_p.h | 2 -- 2 files changed, 7 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 81969d16a5d..bc97cfd64d8 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -51,7 +51,6 @@ QWaylandWindow::QWaylandWindow(QWindow *window, QWaylandDisplay *display) , mDisplay(display) , mSurfaceLock(QReadWriteLock::Recursive) , mShellIntegration(display->shellIntegration()) - , mResizeAfterSwap(qEnvironmentVariableIsSet("QT_WAYLAND_RESIZE_AFTER_SWAP")) { { bool ok; @@ -335,7 +334,6 @@ void QWaylandWindow::resetSurfaceRole() } mFrameCallbackTimedOut = false; mWaitingToApplyConfigure = false; - mResizeDirty = false; mExposed = false; } @@ -463,9 +461,6 @@ void QWaylandWindow::setGeometry(const QRect &r) if (mWindowDecorationEnabled) mWindowDecoration->update(); - if (mResizeAfterSwap && windowType() == Egl && mSentInitialResize) { - mResizeDirty = true; - } QWindowSystemInterface::handleGeometryChange(window(), geometry()); mSentInitialResize = true; } diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index 5bb7e2c6e02..c0a93189fea 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -307,8 +307,6 @@ protected: bool mExposed = false; bool mWaitingToApplyConfigure = false; - bool mResizeDirty = false; - bool mResizeAfterSwap; int mFrameCallbackTimeout = 100; QVariantMap m_properties; From ac879a0200645b46a5d66c4597edc2999af3374f Mon Sep 17 00:00:00 2001 From: David Redondo Date: Tue, 6 Jun 2023 10:34:50 +0200 Subject: [PATCH 1420/1507] Implement support for attaching dbus menu bar to a window This uses the KDE specific protocol, on other platforms it noops. [ChangeLog][Third-Party Code] Adds the implemented appmenu protocol Change-Id: Ie2dcf062fd8f3279e6e0ce142ee9e7b26cac4e9b Reviewed-by: Vlad Zahorodnii --- .../wayland/protocols/LGPL-2.1-or-later.txt | 468 ++++++++++++++++++ .../wayland/protocols/appmenu/appmenu.xml | 36 ++ .../protocols/appmenu/qt_attribution.json | 16 + src/plugins/platforms/wayland/CMakeLists.txt | 2 + .../platforms/wayland/qwaylandappmenu.cpp | 32 ++ .../platforms/wayland/qwaylandappmenu_p.h | 44 ++ .../platforms/wayland/qwaylanddisplay.cpp | 4 + .../platforms/wayland/qwaylanddisplay_p.h | 8 +- .../wayland/qwaylandplatformservices.cpp | 38 +- .../wayland/qwaylandplatformservices_p.h | 10 +- 10 files changed, 653 insertions(+), 5 deletions(-) create mode 100644 src/3rdparty/wayland/protocols/LGPL-2.1-or-later.txt create mode 100644 src/3rdparty/wayland/protocols/appmenu/appmenu.xml create mode 100644 src/3rdparty/wayland/protocols/appmenu/qt_attribution.json create mode 100644 src/plugins/platforms/wayland/qwaylandappmenu.cpp create mode 100644 src/plugins/platforms/wayland/qwaylandappmenu_p.h diff --git a/src/3rdparty/wayland/protocols/LGPL-2.1-or-later.txt b/src/3rdparty/wayland/protocols/LGPL-2.1-or-later.txt new file mode 100644 index 00000000000..04bb156e77d --- /dev/null +++ b/src/3rdparty/wayland/protocols/LGPL-2.1-or-later.txt @@ -0,0 +1,468 @@ +GNU LESSER GENERAL PUBLIC LICENSE + +Version 2.1, February 1999 + +Copyright (C) 1991, 1999 Free Software Foundation, Inc. + +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +Everyone is permitted to copy and distribute verbatim copies of this license +document, but changing it is not allowed. + +[This is the first released version of the Lesser GPL. It also counts as the +successor of the GNU Library Public License, version 2, hence the version +number 2.1.] + +Preamble + +The licenses for most software are designed to take away your freedom to share +and change it. By contrast, the GNU General Public Licenses are intended to +guarantee your freedom to share and change free software--to make sure the +software is free for all its users. + +This license, the Lesser General Public License, applies to some specially +designated software packages--typically libraries--of the Free Software Foundation +and other authors who decide to use it. You can use it too, but we suggest +you first think carefully about whether this license or the ordinary General +Public License is the better strategy to use in any particular case, based +on the explanations below. + +When we speak of free software, we are referring to freedom of use, not price. +Our General Public Licenses are designed to make sure that you have the freedom +to distribute copies of free software (and charge for this service if you +wish); that you receive source code or can get it if you want it; that you +can change the software and use pieces of it in new free programs; and that +you are informed that you can do these things. + +To protect your rights, we need to make restrictions that forbid distributors +to deny you these rights or to ask you to surrender these rights. These restrictions +translate to certain responsibilities for you if you distribute copies of +the library or if you modify it. + +For example, if you distribute copies of the library, whether gratis or for +a fee, you must give the recipients all the rights that we gave you. You must +make sure that they, too, receive or can get the source code. If you link +other code with the library, you must provide complete object files to the +recipients, so that they can relink them with the library after making changes +to the library and recompiling it. And you must show them these terms so they +know their rights. + +We protect your rights with a two-step method: (1) we copyright the library, +and (2) we offer you this license, which gives you legal permission to copy, +distribute and/or modify the library. + +To protect each distributor, we want to make it very clear that there is no +warranty for the free library. Also, if the library is modified by someone +else and passed on, the recipients should know that what they have is not +the original version, so that the original author's reputation will not be +affected by problems that might be introduced by others. + +Finally, software patents pose a constant threat to the existence of any free +program. We wish to make sure that a company cannot effectively restrict the +users of a free program by obtaining a restrictive license from a patent holder. +Therefore, we insist that any patent license obtained for a version of the +library must be consistent with the full freedom of use specified in this +license. + +Most GNU software, including some libraries, is covered by the ordinary GNU +General Public License. This license, the GNU Lesser General Public License, +applies to certain designated libraries, and is quite different from the ordinary +General Public License. We use this license for certain libraries in order +to permit linking those libraries into non-free programs. + +When a program is linked with a library, whether statically or using a shared +library, the combination of the two is legally speaking a combined work, a +derivative of the original library. The ordinary General Public License therefore +permits such linking only if the entire combination fits its criteria of freedom. +The Lesser General Public License permits more lax criteria for linking other +code with the library. + +We call this license the "Lesser" General Public License because it does Less +to protect the user's freedom than the ordinary General Public License. It +also provides other free software developers Less of an advantage over competing +non-free programs. These disadvantages are the reason we use the ordinary +General Public License for many libraries. However, the Lesser license provides +advantages in certain special circumstances. + +For example, on rare occasions, there may be a special need to encourage the +widest possible use of a certain library, so that it becomes a de-facto standard. +To achieve this, non-free programs must be allowed to use the library. A more +frequent case is that a free library does the same job as widely used non-free +libraries. In this case, there is little to gain by limiting the free library +to free software only, so we use the Lesser General Public License. + +In other cases, permission to use a particular library in non-free programs +enables a greater number of people to use a large body of free software. For +example, permission to use the GNU C Library in non-free programs enables +many more people to use the whole GNU operating system, as well as its variant, +the GNU/Linux operating system. + +Although the Lesser General Public License is Less protective of the users' +freedom, it does ensure that the user of a program that is linked with the +Library has the freedom and the wherewithal to run that program using a modified +version of the Library. + +The precise terms and conditions for copying, distribution and modification +follow. Pay close attention to the difference between a "work based on the +library" and a "work that uses the library". The former contains code derived +from the library, whereas the latter must be combined with the library in +order to run. + +TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + +0. This License Agreement applies to any software library or other program +which contains a notice placed by the copyright holder or other authorized +party saying it may be distributed under the terms of this Lesser General +Public License (also called "this License"). Each licensee is addressed as +"you". + +A "library" means a collection of software functions and/or data prepared +so as to be conveniently linked with application programs (which use some +of those functions and data) to form executables. + +The "Library", below, refers to any such software library or work which has +been distributed under these terms. A "work based on the Library" means either +the Library or any derivative work under copyright law: that is to say, a +work containing the Library or a portion of it, either verbatim or with modifications +and/or translated straightforwardly into another language. (Hereinafter, translation +is included without limitation in the term "modification".) + +"Source code" for a work means the preferred form of the work for making modifications +to it. For a library, complete source code means all the source code for all +modules it contains, plus any associated interface definition files, plus +the scripts used to control compilation and installation of the library. + +Activities other than copying, distribution and modification are not covered +by this License; they are outside its scope. The act of running a program +using the Library is not restricted, and output from such a program is covered +only if its contents constitute a work based on the Library (independent of +the use of the Library in a tool for writing it). Whether that is true depends +on what the Library does and what the program that uses the Library does. + +1. You may copy and distribute verbatim copies of the Library's complete source +code as you receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice and disclaimer +of warranty; keep intact all the notices that refer to this License and to +the absence of any warranty; and distribute a copy of this License along with +the Library. + +You may charge a fee for the physical act of transferring a copy, and you +may at your option offer warranty protection in exchange for a fee. + +2. You may modify your copy or copies of the Library or any portion of it, +thus forming a work based on the Library, and copy and distribute such modifications +or work under the terms of Section 1 above, provided that you also meet all +of these conditions: + + a) The modified work must itself be a software library. + +b) You must cause the files modified to carry prominent notices stating that +you changed the files and the date of any change. + +c) You must cause the whole of the work to be licensed at no charge to all +third parties under the terms of this License. + +d) If a facility in the modified Library refers to a function or a table of +data to be supplied by an application program that uses the facility, other +than as an argument passed when the facility is invoked, then you must make +a good faith effort to ensure that, in the event an application does not supply +such function or table, the facility still operates, and performs whatever +part of its purpose remains meaningful. + +(For example, a function in a library to compute square roots has a purpose +that is entirely well-defined independent of the application. Therefore, Subsection +2d requires that any application-supplied function or table used by this function +must be optional: if the application does not supply it, the square root function +must still compute square roots.) + +These requirements apply to the modified work as a whole. If identifiable +sections of that work are not derived from the Library, and can be reasonably +considered independent and separate works in themselves, then this License, +and its terms, do not apply to those sections when you distribute them as +separate works. But when you distribute the same sections as part of a whole +which is a work based on the Library, the distribution of the whole must be +on the terms of this License, whose permissions for other licensees extend +to the entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest your +rights to work written entirely by you; rather, the intent is to exercise +the right to control the distribution of derivative or collective works based +on the Library. + +In addition, mere aggregation of another work not based on the Library with +the Library (or with a work based on the Library) on a volume of a storage +or distribution medium does not bring the other work under the scope of this +License. + +3. You may opt to apply the terms of the ordinary GNU General Public License +instead of this License to a given copy of the Library. To do this, you must +alter all the notices that refer to this License, so that they refer to the +ordinary GNU General Public License, version 2, instead of to this License. +(If a newer version than version 2 of the ordinary GNU General Public License +has appeared, then you can specify that version instead if you wish.) Do not +make any other change in these notices. + +Once this change is made in a given copy, it is irreversible for that copy, +so the ordinary GNU General Public License applies to all subsequent copies +and derivative works made from that copy. + +This option is useful when you wish to copy part of the code of the Library +into a program that is not a library. + +4. You may copy and distribute the Library (or a portion or derivative of +it, under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you accompany it with the complete corresponding +machine-readable source code, which must be distributed under the terms of +Sections 1 and 2 above on a medium customarily used for software interchange. + +If distribution of object code is made by offering access to copy from a designated +place, then offering equivalent access to copy the source code from the same +place satisfies the requirement to distribute the source code, even though +third parties are not compelled to copy the source along with the object code. + +5. A program that contains no derivative of any portion of the Library, but +is designed to work with the Library by being compiled or linked with it, +is called a "work that uses the Library". Such a work, in isolation, is not +a derivative work of the Library, and therefore falls outside the scope of +this License. + +However, linking a "work that uses the Library" with the Library creates an +executable that is a derivative of the Library (because it contains portions +of the Library), rather than a "work that uses the library". The executable +is therefore covered by this License. Section 6 states terms for distribution +of such executables. + +When a "work that uses the Library" uses material from a header file that +is part of the Library, the object code for the work may be a derivative work +of the Library even though the source code is not. Whether this is true is +especially significant if the work can be linked without the Library, or if +the work is itself a library. The threshold for this to be true is not precisely +defined by law. + +If such an object file uses only numerical parameters, data structure layouts +and accessors, and small macros and small inline functions (ten lines or less +in length), then the use of the object file is unrestricted, regardless of +whether it is legally a derivative work. (Executables containing this object +code plus portions of the Library will still fall under Section 6.) + +Otherwise, if the work is a derivative of the Library, you may distribute +the object code for the work under the terms of Section 6. Any executables +containing that work also fall under Section 6, whether or not they are linked +directly with the Library itself. + +6. As an exception to the Sections above, you may also combine or link a "work +that uses the Library" with the Library to produce a work containing portions +of the Library, and distribute that work under terms of your choice, provided +that the terms permit modification of the work for the customer's own use +and reverse engineering for debugging such modifications. + +You must give prominent notice with each copy of the work that the Library +is used in it and that the Library and its use are covered by this License. +You must supply a copy of this License. If the work during execution displays +copyright notices, you must include the copyright notice for the Library among +them, as well as a reference directing the user to the copy of this License. +Also, you must do one of these things: + +a) Accompany the work with the complete corresponding machine-readable source +code for the Library including whatever changes were used in the work (which +must be distributed under Sections 1 and 2 above); and, if the work is an +executable linked with the Library, with the complete machine-readable "work +that uses the Library", as object code and/or source code, so that the user +can modify the Library and then relink to produce a modified executable containing +the modified Library. (It is understood that the user who changes the contents +of definitions files in the Library will not necessarily be able to recompile +the application to use the modified definitions.) + +b) Use a suitable shared library mechanism for linking with the Library. A +suitable mechanism is one that (1) uses at run time a copy of the library +already present on the user's computer system, rather than copying library +functions into the executable, and (2) will operate properly with a modified +version of the library, if the user installs one, as long as the modified +version is interface-compatible with the version that the work was made with. + +c) Accompany the work with a written offer, valid for at least three years, +to give the same user the materials specified in Subsection 6a, above, for +a charge no more than the cost of performing this distribution. + +d) If distribution of the work is made by offering access to copy from a designated +place, offer equivalent access to copy the above specified materials from +the same place. + +e) Verify that the user has already received a copy of these materials or +that you have already sent this user a copy. + +For an executable, the required form of the "work that uses the Library" must +include any data and utility programs needed for reproducing the executable +from it. However, as a special exception, the materials to be distributed +need not include anything that is normally distributed (in either source or +binary form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component itself +accompanies the executable. + +It may happen that this requirement contradicts the license restrictions of +other proprietary libraries that do not normally accompany the operating system. +Such a contradiction means you cannot use both them and the Library together +in an executable that you distribute. + +7. You may place library facilities that are a work based on the Library side-by-side +in a single library together with other library facilities not covered by +this License, and distribute such a combined library, provided that the separate +distribution of the work based on the Library and of the other library facilities +is otherwise permitted, and provided that you do these two things: + +a) Accompany the combined library with a copy of the same work based on the +Library, uncombined with any other library facilities. This must be distributed +under the terms of the Sections above. + +b) Give prominent notice with the combined library of the fact that part of +it is a work based on the Library, and explaining where to find the accompanying +uncombined form of the same work. + +8. You may not copy, modify, sublicense, link with, or distribute the Library +except as expressly provided under this License. Any attempt otherwise to +copy, modify, sublicense, link with, or distribute the Library is void, and +will automatically terminate your rights under this License. However, parties +who have received copies, or rights, from you under this License will not +have their licenses terminated so long as such parties remain in full compliance. + +9. You are not required to accept this License, since you have not signed +it. However, nothing else grants you permission to modify or distribute the +Library or its derivative works. These actions are prohibited by law if you +do not accept this License. Therefore, by modifying or distributing the Library +(or any work based on the Library), you indicate your acceptance of this License +to do so, and all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + +10. Each time you redistribute the Library (or any work based on the Library), +the recipient automatically receives a license from the original licensor +to copy, distribute, link with or modify the Library subject to these terms +and conditions. You may not impose any further restrictions on the recipients' +exercise of the rights granted herein. You are not responsible for enforcing +compliance by third parties with this License. + +11. If, as a consequence of a court judgment or allegation of patent infringement +or for any other reason (not limited to patent issues), conditions are imposed +on you (whether by court order, agreement or otherwise) that contradict the +conditions of this License, they do not excuse you from the conditions of +this License. If you cannot distribute so as to satisfy simultaneously your +obligations under this License and any other pertinent obligations, then as +a consequence you may not distribute the Library at all. For example, if a +patent license would not permit royalty-free redistribution of the Library +by all those who receive copies directly or indirectly through you, then the +only way you could satisfy both it and this License would be to refrain entirely +from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any patents +or other property right claims or to contest validity of any such claims; +this section has the sole purpose of protecting the integrity of the free +software distribution system which is implemented by public license practices. +Many people have made generous contributions to the wide range of software +distributed through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing to +distribute software through any other system and a licensee cannot impose +that choice. + +This section is intended to make thoroughly clear what is believed to be a +consequence of the rest of this License. + +12. If the distribution and/or use of the Library is restricted in certain +countries either by patents or by copyrighted interfaces, the original copyright +holder who places the Library under this License may add an explicit geographical +distribution limitation excluding those countries, so that distribution is +permitted only in or among countries not thus excluded. In such case, this +License incorporates the limitation as if written in the body of this License. + +13. The Free Software Foundation may publish revised and/or new versions of +the Lesser General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to address +new problems or concerns. + +Each version is given a distinguishing version number. If the Library specifies +a version number of this License which applies to it and "any later version", +you have the option of following the terms and conditions either of that version +or of any later version published by the Free Software Foundation. If the +Library does not specify a license version number, you may choose any version +ever published by the Free Software Foundation. + +14. If you wish to incorporate parts of the Library into other free programs +whose distribution conditions are incompatible with these, write to the author +to ask for permission. For software which is copyrighted by the Free Software +Foundation, write to the Free Software Foundation; we sometimes make exceptions +for this. Our decision will be guided by the two goals of preserving the free +status of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + +15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR +THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE +STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY +"AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, +BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE +OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + +16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE +THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE +OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA +OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES +OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH +HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. +END OF TERMS AND CONDITIONS + +How to Apply These Terms to Your New Libraries + +If you develop a new library, and you want it to be of the greatest possible +use to the public, we recommend making it free software that everyone can +redistribute and change. You can do so by permitting redistribution under +these terms (or, alternatively, under the terms of the ordinary General Public +License). + +To apply these terms, attach the following notices to the library. It is safest +to attach them to the start of each source file to most effectively convey +the exclusion of warranty; and each file should have at least the "copyright" +line and a pointer to where the full notice is found. + + + +Copyright (C) + +This library is free software; you can redistribute it and/or modify it under +the terms of the GNU Lesser General Public License as published by the Free +Software Foundation; either version 2.1 of the License, or (at your option) +any later version. + +This library is distributed in the hope that it will be useful, but WITHOUT +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more +details. + +You should have received a copy of the GNU Lesser General Public License along +with this library; if not, write to the Free Software Foundation, Inc., 51 +Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +Also add information on how to contact you by electronic and paper mail. + +You should also get your employer (if you work as a programmer) or your school, +if any, to sign a "copyright disclaimer" for the library, if necessary. Here +is a sample; alter the names: + +Yoyodyne, Inc., hereby disclaims all copyright interest in + +the library `Frob' (a library for tweaking knobs) written + +by James Random Hacker. + +< signature of Ty Coon > , 1 April 1990 + +Ty Coon, President of Vice + +That's all there is to it! diff --git a/src/3rdparty/wayland/protocols/appmenu/appmenu.xml b/src/3rdparty/wayland/protocols/appmenu/appmenu.xml new file mode 100644 index 00000000000..6e8d33b18dd --- /dev/null +++ b/src/3rdparty/wayland/protocols/appmenu/appmenu.xml @@ -0,0 +1,36 @@ + + + + + + This interface allows a client to link a window (or wl_surface) to an com.canonical.dbusmenu + interface registered on DBus. + + + + + + + + + The DBus service name and object path where the appmenu interface is present + The object should be registered on the session bus before sending this request. + If not applicable, clients should remove this object. + + + + Set or update the service name and object path. + Strings should be formatted in Latin-1 matching the relevant DBus specifications. + + + + + + + + + diff --git a/src/3rdparty/wayland/protocols/appmenu/qt_attribution.json b/src/3rdparty/wayland/protocols/appmenu/qt_attribution.json new file mode 100644 index 00000000000..b174a73a532 --- /dev/null +++ b/src/3rdparty/wayland/protocols/appmenu/qt_attribution.json @@ -0,0 +1,16 @@ +{ + "Id": "appmenu", + "Name": "Wayland KDE DBus Menu Protocol", + "QDocModule": "qtwaylandcompositor", + "QtUsage": "Used in the Qt Wayland platform plugin", + "Files": "appmenu.xml", + + "Description": "Attach a dbus menu to a window", + "Homepage": "https://kde.org", + "Version": "1", + "DownloadLocation": "https://invent.kde.org/libraries/plasma-wayland-protocols/-/blob/v1.14.0/src/protocols/appmenu.xml", + "LicenseId": "LGPL-2.1-or-later", + "License": "GNU Lesser General Public License 2.1 or later", + "LicenseFile": "../LGPL-2.1-or-later.txt", + "Copyright": "Copyright 2017 David Edmundson" +} diff --git a/src/plugins/platforms/wayland/CMakeLists.txt b/src/plugins/platforms/wayland/CMakeLists.txt index eca51287740..4dfc54bfcb5 100644 --- a/src/plugins/platforms/wayland/CMakeLists.txt +++ b/src/plugins/platforms/wayland/CMakeLists.txt @@ -26,6 +26,7 @@ qt_internal_add_module(WaylandClient inputdeviceintegration/qwaylandinputdeviceintegrationplugin.cpp inputdeviceintegration/qwaylandinputdeviceintegrationplugin_p.h qtwaylandclientglobal.h qtwaylandclientglobal_p.h qwaylandabstractdecoration.cpp qwaylandabstractdecoration_p.h + qwaylandappmenu.cpp qwaylandappmenu_p.h qwaylandbuffer.cpp qwaylandbuffer_p.h qwaylanddecorationfactory.cpp qwaylanddecorationfactory_p.h qwaylanddecorationplugin.cpp qwaylanddecorationplugin_p.h @@ -96,6 +97,7 @@ qt_internal_add_module(WaylandClient qt6_generate_wayland_protocol_client_sources(WaylandClient PRIVATE_CODE FILES + ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/appmenu/appmenu.xml ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/cursor-shape/cursor-shape-v1.xml ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/pointer-gestures/pointer-gestures-unstable-v1.xml ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/tablet/tablet-unstable-v2.xml diff --git a/src/plugins/platforms/wayland/qwaylandappmenu.cpp b/src/plugins/platforms/wayland/qwaylandappmenu.cpp new file mode 100644 index 00000000000..3e584e25972 --- /dev/null +++ b/src/plugins/platforms/wayland/qwaylandappmenu.cpp @@ -0,0 +1,32 @@ +// Copyright (C) 2024 David Redondo +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#include "qwaylandappmenu_p.h" + +#include "qwaylandwindow_p.h" + +QT_BEGIN_NAMESPACE + +namespace QtWaylandClient { + +QWaylandAppMenu::QWaylandAppMenu() : org_kde_kwin_appmenu() { } + +QWaylandAppMenu::~QWaylandAppMenu() +{ + if (object()) + release(); +} + +QWaylandAppMenuManager::QWaylandAppMenuManager(wl_registry *registry, quint32 id, int version) + : org_kde_kwin_appmenu_manager(registry, id, version) +{ +} + +QWaylandAppMenuManager::~QWaylandAppMenuManager() +{ + org_kde_kwin_appmenu_manager_destroy(object()); +} + +} // namespace QtWaylandClient + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandappmenu_p.h b/src/plugins/platforms/wayland/qwaylandappmenu_p.h new file mode 100644 index 00000000000..45d6f9d901d --- /dev/null +++ b/src/plugins/platforms/wayland/qwaylandappmenu_p.h @@ -0,0 +1,44 @@ +// Copyright (C) 2024 David Redondo +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QWAYLANDAPPMENU_H +#define QWAYLANDAPPMENU_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include + +#include +#include + +QT_BEGIN_NAMESPACE + +namespace QtWaylandClient { + +class QWaylandAppMenu : public QObject, public QtWayland::org_kde_kwin_appmenu +{ +public: + QWaylandAppMenu(); + ~QWaylandAppMenu(); +}; + +class QWaylandAppMenuManager : public QtWayland::org_kde_kwin_appmenu_manager +{ +public: + QWaylandAppMenuManager(wl_registry *registry, quint32 id, int version); + ~QWaylandAppMenuManager(); +}; + +} // namespace QtWaylandClient +QT_END_NAMESPACE + +#endif diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index b680c810f99..025b30096f6 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -3,6 +3,7 @@ #include "qwaylanddisplay_p.h" +#include "qwaylandappmenu_p.h" #include "qwaylandintegration_p.h" #include "qwaylandwindow_p.h" #include "qwaylandsurface_p.h" @@ -783,6 +784,9 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin new QWaylandWindowManagerIntegration(this, id, version)); } else if (interface == QLatin1String(QtWayland::xdg_system_bell_v1::interface()->name)) { mGlobals.systemBell.reset(new WithDestructor(registry, id, 1)); + } else if ( + interface == QLatin1String(QtWayland::org_kde_kwin_appmenu_manager::interface()->name)) { + mGlobals.appMenuManager.reset(new QWaylandAppMenuManager(registry, id, 1)); } mRegistryGlobals.append(RegistryGlobal(id, interface, version, registry)); diff --git a/src/plugins/platforms/wayland/qwaylanddisplay_p.h b/src/plugins/platforms/wayland/qwaylanddisplay_p.h index be1beb87557..074117a38f2 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay_p.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay_p.h @@ -63,6 +63,7 @@ namespace QtWaylandClient { QT_DECLARE_EXPORTED_QT_LOGGING_CATEGORY(lcQpaWayland, Q_WAYLANDCLIENT_EXPORT); +class QWaylandAppMenuManager; class QWaylandInputDevice; class QWaylandBuffer; class QWaylandScreen; @@ -211,7 +212,10 @@ public: { return mGlobals.systemBell.get(); } - + QWaylandAppMenuManager *appMenuManager() const + { + return mGlobals.appMenuManager.get(); + } struct RegistryGlobal { uint32_t id; @@ -345,7 +349,9 @@ private: std::unique_ptr systemBell; std::unique_ptr xdgToplevelDragManager; std::unique_ptr windowManagerIntegration; + std::unique_ptr appMenuManager; } mGlobals; + int mFd = -1; int mWritableNotificationFd = -1; QList mRegistryGlobals; diff --git a/src/plugins/platforms/wayland/qwaylandplatformservices.cpp b/src/plugins/platforms/wayland/qwaylandplatformservices.cpp index 14556d2825f..e0eb690d792 100644 --- a/src/plugins/platforms/wayland/qwaylandplatformservices.cpp +++ b/src/plugins/platforms/wayland/qwaylandplatformservices.cpp @@ -1,6 +1,7 @@ // Copyright (C) 2016 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +#include "qwaylandappmenu_p.h" #include "qwaylandplatformservices_p.h" #include "qwaylandwindow_p.h" #include "qwaylanddisplay_p.h" @@ -14,6 +15,11 @@ namespace QtWaylandClient { QWaylandPlatformServices::QWaylandPlatformServices(QWaylandDisplay *display) : m_display(display) { } +QWaylandPlatformServices::~QWaylandPlatformServices() +{ + qDeleteAll(m_appMenus); +} + bool QWaylandPlatformServices::openUrl(const QUrl &url) { if (auto windowManagerIntegration = m_display->windowManagerIntegration()) { @@ -43,8 +49,36 @@ QString QWaylandPlatformServices::portalWindowIdentifier(QWindow *window) } return QString(); } + +void QWaylandPlatformServices::registerDBusMenuForWindow(QWindow *window, const QString &service, + const QString &path) +{ + if (!m_display->appMenuManager()) + return; + if (!window) + return; + if (!window->handle()) + window->create(); + auto waylandWindow = static_cast(window->handle()); + auto menu = *m_appMenus.insert(window, new QWaylandAppMenu); + + auto createAppMenu = [waylandWindow, menu, service, path] { + menu->init(waylandWindow->display()->appMenuManager()->create(waylandWindow->wlSurface())); + menu->set_address(service, path); + }; + + if (waylandWindow->wlSurface()) + createAppMenu(); + + QObject::connect(waylandWindow, &QWaylandWindow::wlSurfaceCreated, menu, createAppMenu); + QObject::connect(waylandWindow, &QWaylandWindow::wlSurfaceDestroyed, menu, + [menu] { menu->release(); }); +} + +void QWaylandPlatformServices::unregisterDBusMenuForWindow(QWindow *window) +{ + delete m_appMenus.take(window); +} } // namespace QtWaylandClient QT_END_NAMESPACE - -#include "moc_qwaylandplatformservices_p.cpp" diff --git a/src/plugins/platforms/wayland/qwaylandplatformservices_p.h b/src/plugins/platforms/wayland/qwaylandplatformservices_p.h index 6106a901888..f8b09ccab90 100644 --- a/src/plugins/platforms/wayland/qwaylandplatformservices_p.h +++ b/src/plugins/platforms/wayland/qwaylandplatformservices_p.h @@ -15,8 +15,7 @@ // We mean it. // -#include - +#include #include #include @@ -26,19 +25,26 @@ QT_BEGIN_NAMESPACE namespace QtWaylandClient { +class QWaylandAppMenu; class QWaylandDisplay; +class QWaylandWindow; class Q_WAYLANDCLIENT_EXPORT QWaylandPlatformServices : public QGenericUnixServices { public: explicit QWaylandPlatformServices(QWaylandDisplay *waylandDisplay); + ~QWaylandPlatformServices(); bool openUrl(const QUrl &url) override; bool openDocument(const QUrl &url) override; QString portalWindowIdentifier(QWindow *window) override; + void registerDBusMenuForWindow(QWindow *window, const QString &service, + const QString &path) override; + void unregisterDBusMenuForWindow(QWindow *window) override; private: QWaylandDisplay *m_display; + QMap m_appMenus; }; QT_END_NAMESPACE From 43d385e9495e7a458eeafa4831c5c11fac7a5943 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Wed, 30 Oct 2024 12:49:54 +0100 Subject: [PATCH 1421/1507] Check whether m_toplevel exists before dereferencing it The parent surface could be a popup. In that case m_toplevel would be nullptr. Since xdgshell doesn't allow an xdg_popup to be the parent of an xdg_toplevel, the best we can do is pretend there is no parent in this case. Fixes: QTBUG-130128 Pick-to: 6.8 Change-Id: Ib0367429b71ee96cbd1c3119e77769c511370624 Reviewed-by: Vlad Zahorodnii --- .../plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp index ce0ab795732..148739bdcde 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp @@ -34,8 +34,8 @@ QWaylandXdgSurface::Toplevel::Toplevel(QWaylandXdgSurface *xdgSurface) requestWindowStates(window->windowStates()); requestWindowFlags(window->flags()); if (auto transientParent = xdgSurface->window()->transientParent()) { - if (auto parentSurface = - qobject_cast(transientParent->shellSurface())) { + auto parentSurface = qobject_cast(transientParent->shellSurface()); + if (parentSurface && parentSurface->m_toplevel) { set_parent(parentSurface->m_toplevel->object()); if (window->modality() != Qt::NonModal && m_xdgSurface->m_shell->m_xdgDialogWm) { m_xdgDialog.reset(m_xdgSurface->m_shell->m_xdgDialogWm->getDialog(object())); From 18933039552ea9eff8af03c889ebe1eb273c2278 Mon Sep 17 00:00:00 2001 From: YAMAMOTO Atsushi Date: Thu, 31 Oct 2024 19:33:21 +0900 Subject: [PATCH 1422/1507] Fix typo in comment: 'polll' to 'poll' Corrected a typo in the comment block, changing 'polll' to 'poll'. Change-Id: I8f276d8a7f07114b323bf0c79e797e355dad1547 Reviewed-by: David Edmundson --- src/plugins/platforms/wayland/qwaylanddisplay.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index 025b30096f6..572275057d8 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -190,7 +190,7 @@ protected: if (fds[0].revents & POLLIN) wl_display_read_events(m_wldisplay); - // The polll was succesfull and the event thread did the wl_display_read_events(). On the next iteration of the loop + // The poll was succesfull and the event thread did the wl_display_read_events(). On the next iteration of the loop // the event sent to the main thread will cause it to dispatch the messages just read, unless the loop exits in which // case we don't care anymore about them. else From 207c51371d4b97b76900e9b158f961302bbf2e06 Mon Sep 17 00:00:00 2001 From: David Redondo Date: Wed, 17 Apr 2024 12:51:03 +0200 Subject: [PATCH 1423/1507] Client: implement toplevel icon protocol This allows QWindow::setIcon to work on desktops that support the standards. If an icon name is set, we assume it's from an installed theme and provide the name, otherwise we provide buffers. For SVGs the size hint from the compositor is used, otherwise we supply pixmap data in all the sizes we have available. [ChangeLog][Third-Party Code] New protocol synced from wayland-protocols Change-Id: Iabbd928a3476aafa2d63a81e68299049e59991db Reviewed-by: David Redondo --- .../xdg-toplevel-icon/qt_attribution.json | 18 ++ .../xdg-toplevel-icon-v1.xml | 205 ++++++++++++++++++ .../shellintegration/xdg-shell/CMakeLists.txt | 2 + .../xdg-shell/qwaylandxdgshell.cpp | 13 ++ .../xdg-shell/qwaylandxdgshell_p.h | 6 +- .../xdg-shell/qwaylandxdgtopleveliconv1.cpp | 102 +++++++++ .../xdg-shell/qwaylandxdgtopleveliconv1_p.h | 52 +++++ .../wayland/qwaylandshellsurface_p.h | 2 + .../platforms/wayland/qwaylandwindow.cpp | 5 + 9 files changed, 403 insertions(+), 2 deletions(-) create mode 100644 src/3rdparty/wayland/protocols/xdg-toplevel-icon/qt_attribution.json create mode 100644 src/3rdparty/wayland/protocols/xdg-toplevel-icon/xdg-toplevel-icon-v1.xml create mode 100644 src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgtopleveliconv1.cpp create mode 100644 src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgtopleveliconv1_p.h diff --git a/src/3rdparty/wayland/protocols/xdg-toplevel-icon/qt_attribution.json b/src/3rdparty/wayland/protocols/xdg-toplevel-icon/qt_attribution.json new file mode 100644 index 00000000000..e0a675b93d3 --- /dev/null +++ b/src/3rdparty/wayland/protocols/xdg-toplevel-icon/qt_attribution.json @@ -0,0 +1,18 @@ +[ + { + "Id": "wayland-xdg-toplevel-icon-protocol", + "Name": "Wayland xdg-toplevel-icon Protocol", + "QDocModule": "qtwaylandcompositor", + "QtUsage": "Used in the Qt Wayland Compositor API, and the Qt Wayland platform plugin.", + "Files": "xdg-toplevel-icon-v1.xml", + + "Description": "The xdg-toplevel-icon protocol allows a compositor to announce support for window icons.", + "Homepage": "https://wayland.freedesktop.org", + "Version": "version 1", + "DownloadLocation": "https://gitlab.freedesktop.org/wayland/wayland-protocols/raw/1.37/staging/xdg-toplevel-icon/xdg-toplevel-icon-v1.xml", + "LicenseId": "MIT", + "License": "MIT License", + "LicenseFile": "../MIT_LICENSE.txt", + "Copyright": "Copyright © 2024 Matthias Klumpp 2024 David Edmundson" + } +] diff --git a/src/3rdparty/wayland/protocols/xdg-toplevel-icon/xdg-toplevel-icon-v1.xml b/src/3rdparty/wayland/protocols/xdg-toplevel-icon/xdg-toplevel-icon-v1.xml new file mode 100644 index 00000000000..fc409fef7c6 --- /dev/null +++ b/src/3rdparty/wayland/protocols/xdg-toplevel-icon/xdg-toplevel-icon-v1.xml @@ -0,0 +1,205 @@ + + + + + Copyright © 2023-2024 Matthias Klumpp + Copyright © 2024 David Edmundson + + 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. + + + + This protocol allows clients to set icons for their toplevel surfaces + either via the XDG icon stock (using an icon name), or from pixel data. + + A toplevel icon represents the individual toplevel (unlike the application + or launcher icon, which represents the application as a whole), and may be + shown in window switchers, window overviews and taskbars that list + individual windows. + + This document adheres to RFC 2119 when using words like "must", + "should", "may", etc. + + Warning! The protocol described in this file is currently in the testing + phase. Backward compatible changes may be added together with the + corresponding interface version bump. Backward incompatible changes can + only be done by creating a new major version of the extension. + + + + + This interface allows clients to create toplevel window icons and set + them on toplevel windows to be displayed to the user. + + + + + Destroy the toplevel icon manager. + This does not destroy objects created with the manager. + + + + + + Creates a new icon object. This icon can then be attached to a + xdg_toplevel via the 'set_icon' request. + + + + + + + This request assigns the icon 'icon' to 'toplevel', or clears the + toplevel icon if 'icon' was null. + This state is double-buffered and is applied on the next + wl_surface.commit of the toplevel. + + After making this call, the xdg_toplevel_icon_v1 provided as 'icon' + can be destroyed by the client without 'toplevel' losing its icon. + The xdg_toplevel_icon_v1 is immutable from this point, and any + future attempts to change it must raise the + 'xdg_toplevel_icon_v1.immutable' protocol error. + + The compositor must set the toplevel icon from either the pixel data + the icon provides, or by loading a stock icon using the icon name. + See the description of 'xdg_toplevel_icon_v1' for details. + + If 'icon' is set to null, the icon of the respective toplevel is reset + to its default icon (usually the icon of the application, derived from + its desktop-entry file, or a placeholder icon). + If this request is passed an icon with no pixel buffers or icon name + assigned, the icon must be reset just like if 'icon' was null. + + + + + + + + This event indicates an icon size the compositor prefers to be + available if the client has scalable icons and can render to any size. + + When the 'xdg_toplevel_icon_manager_v1' object is created, the + compositor may send one or more 'icon_size' events to describe the list + of preferred icon sizes. If the compositor has no size preference, it + may not send any 'icon_size' event, and it is up to the client to + decide a suitable icon size. + + A sequence of 'icon_size' events must be finished with a 'done' event. + If the compositor has no size preferences, it must still send the + 'done' event, without any preceding 'icon_size' events. + + + + + + + This event is sent after all 'icon_size' events have been sent. + + + + + + + This interface defines a toplevel icon. + An icon can have a name, and multiple buffers. + In order to be applied, the icon must have either a name, or at least + one buffer assigned. Applying an empty icon (with no buffer or name) to + a toplevel should reset its icon to the default icon. + + It is up to compositor policy whether to prefer using a buffer or loading + an icon via its name. See 'set_name' and 'add_buffer' for details. + + + + + + + + + + + Destroys the 'xdg_toplevel_icon_v1' object. + The icon must still remain set on every toplevel it was assigned to, + until the toplevel icon is reset explicitly. + + + + + + This request assigns an icon name to this icon. + Any previously set name is overridden. + + The compositor must resolve 'icon_name' according to the lookup rules + described in the XDG icon theme specification[1] using the + environment's current icon theme. + + If the compositor does not support icon names or cannot resolve + 'icon_name' according to the XDG icon theme specification it must + fall back to using pixel buffer data instead. + + If this request is made after the icon has been assigned to a toplevel + via 'set_icon', a 'immutable' error must be raised. + + [1]: https://specifications.freedesktop.org/icon-theme-spec/icon-theme-spec-latest.html + + + + + + + This request adds pixel data supplied as wl_buffer to the icon. + + The client should add pixel data for all icon sizes and scales that + it can provide, or which are explicitly requested by the compositor + via 'icon_size' events on xdg_toplevel_icon_manager_v1. + + The wl_buffer supplying pixel data as 'buffer' must be backed by wl_shm + and must be a square (width and height being equal). + If any of these buffer requirements are not fulfilled, a 'invalid_buffer' + error must be raised. + + If this icon instance already has a buffer of the same size and scale + from a previous 'add_buffer' request, data from the last request + overrides the preexisting pixel data. + + The wl_buffer must be kept alive for as long as the xdg_toplevel_icon + it is associated with is not destroyed, otherwise a 'no_buffer' error + is raised. The buffer contents must not be modified after it was + assigned to the icon. As a result, the region of the wl_shm_pool's + backing storage used for the wl_buffer must not be modified after this + request is sent. The wl_buffer.release event is unused. + + If this request is made after the icon has been assigned to a toplevel + via 'set_icon', a 'immutable' error must be raised. + + + + + + diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/CMakeLists.txt index 529ea1f6b22..872554f1c58 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/CMakeLists.txt +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/CMakeLists.txt @@ -18,6 +18,7 @@ qt_internal_add_plugin(QWaylandXdgShellIntegrationPlugin qwaylandxdgshellintegration.cpp qwaylandxdgshellintegration_p.h qwaylandxdgexporterv2.cpp qwaylandxdgexporterv2_p.h qwaylandxdgdialogv1.cpp qwaylandxdgdialogv1_p.h + qwaylandxdgtopleveliconv1.cpp qwaylandxdgtopleveliconv1_p.h LIBRARIES Qt::Core Qt::Gui @@ -41,6 +42,7 @@ qt6_generate_wayland_protocol_client_sources(QWaylandXdgShellIntegrationPlugin ${CMAKE_CURRENT_SOURCE_DIR}/../../../3rdparty/protocol/xdg-activation/xdg-activation-v1.xml ${CMAKE_CURRENT_SOURCE_DIR}/../../../3rdparty/protocol/xdg-foreign/xdg-foreign-unstable-v2.xml ${CMAKE_CURRENT_SOURCE_DIR}/../../../3rdparty/protocol/xdg-dialog/xdg-dialog-v1.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../../../3rdparty/protocol/xdg-toplevel-icon/xdg-toplevel-icon-v1.xml ) #### Keys ignored in scope 1:.:.:xdg-shell.pro:: diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp index 148739bdcde..380c93bc9d1 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp @@ -7,6 +7,7 @@ #include "qwaylandxdgexporterv2_p.h" #include "qwaylandxdgdialogv1_p.h" +#include "qwaylandxdgtopleveliconv1_p.h" #include #include @@ -780,6 +781,14 @@ std::unique_ptr QWaylandXdgSurface::createPositi } +void QWaylandXdgSurface::setIcon(const QIcon &icon) +{ + if (!m_shell->m_topLevelIconManager || !m_toplevel) + return; + + m_shell->m_topLevelIconManager->setIcon(icon, m_toplevel->object()); +} + QWaylandXdgShell::QWaylandXdgShell(QWaylandDisplay *display, QtWayland::xdg_wm_base *xdgWmBase) : m_display(display), m_xdgWmBase(xdgWmBase) { @@ -809,6 +818,10 @@ void QWaylandXdgShell::handleRegistryGlobal(void *data, wl_registry *registry, u if (interface == QLatin1String(QWaylandXdgDialogWmV1::interface()->name)) { xdgShell->m_xdgDialogWm.reset(new QWaylandXdgDialogWmV1(registry, id, version)); } + if (interface == QLatin1String(QtWayland::xdg_toplevel_icon_manager_v1::interface()->name)) { + xdgShell->m_topLevelIconManager.reset( + new QWaylandXdgToplevelIconManagerV1(xdgShell->m_display, registry, id, version)); + } } QWaylandXdgSurface::Positioner::Positioner(QWaylandXdgShell *xdgShell) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h index c3a3763a145..12f52da5ea6 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h @@ -30,17 +30,17 @@ QT_BEGIN_NAMESPACE -class QWindow; - namespace QtWaylandClient { class QWaylandDisplay; class QWaylandInputDevice; class QWaylandXdgShell; class QWaylandXdgExportedV2; +class QWaylandShmBuffer; class QWaylandXdgExporterV2; class QWaylandXdgDialogWmV1; class QWaylandXdgDialogV1; +class QWaylandXdgToplevelIconManagerV1; class Q_WAYLANDCLIENT_EXPORT QWaylandXdgSurface : public QWaylandShellSurface, public QtWayland::xdg_surface { @@ -71,6 +71,7 @@ public: bool isAlertState() const override { return m_alertState; } QString externWindowHandle() override; void setWindowPosition(const QPoint &position) override; + void setIcon(const QIcon &icon) override; void setSizeHints(); @@ -187,6 +188,7 @@ private: QScopedPointer m_xdgActivation; QScopedPointer m_xdgExporter; QScopedPointer m_xdgDialogWm; + QScopedPointer m_topLevelIconManager; friend class QWaylandXdgSurface; }; diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgtopleveliconv1.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgtopleveliconv1.cpp new file mode 100644 index 00000000000..f7774f50009 --- /dev/null +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgtopleveliconv1.cpp @@ -0,0 +1,102 @@ +// Copyright (C) 2024 David Reondo +// Copyright (C) 2024 David Edmundson +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#include "client/qwaylandshmbackingstore_p.h" +#include "qwaylandxdgtopleveliconv1_p.h" + +#include + +#include +#include +#include + +QT_BEGIN_NAMESPACE + +namespace QtWaylandClient { + +class QWaylandXdgToplevelIconV1 : public QtWayland::xdg_toplevel_icon_v1 +{ +public: + QWaylandXdgToplevelIconV1(::xdg_toplevel_icon_v1 *object, QWaylandDisplay *display) + : QtWayland::xdg_toplevel_icon_v1(object), mDisplay(display) + { + } + + ~QWaylandXdgToplevelIconV1() override { + destroy(); + } + + void addPixmap(const QPixmap &pixmap) + { + const QSize squareSize = pixmap.size().expandedTo(pixmap.size().transposed()); + auto buffer = std::make_unique(mDisplay, squareSize, QImage::Format_ARGB32, pixmap.devicePixelRatio()); + QRect targetRect = pixmap.rect(); + targetRect.moveCenter(buffer->image()->rect().center()); + QPainter painter(buffer->image()); + painter.drawPixmap(targetRect, pixmap, pixmap.rect()); + add_buffer(buffer->buffer(), buffer->scale()); + mBuffers.push_back(std::move(buffer)); + } + +private: + QWaylandDisplay *mDisplay; + std::vector> mBuffers; +}; + +QWaylandXdgToplevelIconManagerV1::QWaylandXdgToplevelIconManagerV1(QWaylandDisplay *display, + wl_registry *registry, + uint32_t id, int version) + : QtWayland::xdg_toplevel_icon_manager_v1(registry, id, version), mDisplay(display) +{ +} + +QWaylandXdgToplevelIconManagerV1::~QWaylandXdgToplevelIconManagerV1() +{ + destroy(); +} + +void QWaylandXdgToplevelIconManagerV1::xdg_toplevel_icon_manager_v1_icon_size(int32_t size) +{ + mPreferredSizes.push_back(size); +} + +void QWaylandXdgToplevelIconManagerV1::xdg_toplevel_icon_manager_v1_done() { } + +void QWaylandXdgToplevelIconManagerV1::setIcon(const QIcon &icon, xdg_toplevel *window) +{ + if (icon.isNull()) { + set_icon(window, nullptr); + return; + } + + auto toplevelIcon = std::make_unique(create_icon(), mDisplay); + + if (const QString name = icon.name(); !name.isEmpty() && !QDir::isAbsolutePath(name)) { + toplevelIcon->set_name(name); + } + + QList iconSizes = icon.availableSizes(); + // if icon has no default size (an SVG) + if (iconSizes.isEmpty()) { + iconSizes.resize(mPreferredSizes.size()); + for (int size : std::as_const(mPreferredSizes)) { + iconSizes.append(QSize(size, size)); + } + } + // if the compositor hasn't sent a preferred size + if (iconSizes.isEmpty()) { + iconSizes.append(QSize(64, 64)); + } + + for (const QSize &size : std::as_const(iconSizes)) { + const QPixmap pixmap = icon.pixmap(size, 1.0); + toplevelIcon->addPixmap(pixmap); + } + + set_icon(window, toplevelIcon->object()); +} + +} // namespace QtWaylandClient + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgtopleveliconv1_p.h b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgtopleveliconv1_p.h new file mode 100644 index 00000000000..63e379c4daf --- /dev/null +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgtopleveliconv1_p.h @@ -0,0 +1,52 @@ +// Copyright (C) 2024 David Reondo +// Copyright (C) 2024 David Edmundson +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QWAYLANDTOPLEVELICONV1_P_H +#define QWAYLANDTOPLEVELICONV1_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include "wayland-xdg-shell-client-protocol.h" +#include + +#include + +QT_BEGIN_NAMESPACE + +class QIcon; + +namespace QtWaylandClient { + +class QWaylandDisplay; + +class QWaylandXdgToplevelIconManagerV1 : public QtWayland::xdg_toplevel_icon_manager_v1 +{ +public: + QWaylandXdgToplevelIconManagerV1(QWaylandDisplay *display, wl_registry *registry, uint32_t id, + int version); + ~QWaylandXdgToplevelIconManagerV1() override; + void setIcon(const QIcon &icon, ::xdg_toplevel *window); + +protected: + void xdg_toplevel_icon_manager_v1_icon_size(int32_t size) override; + void xdg_toplevel_icon_manager_v1_done() override; + +private: + QList mPreferredSizes; + QWaylandDisplay *mDisplay; +}; +} // namespace QtWaylandClient + +QT_END_NAMESPACE + +#endif diff --git a/src/plugins/platforms/wayland/qwaylandshellsurface_p.h b/src/plugins/platforms/wayland/qwaylandshellsurface_p.h index 07fd82edc50..71599259977 100644 --- a/src/plugins/platforms/wayland/qwaylandshellsurface_p.h +++ b/src/plugins/platforms/wayland/qwaylandshellsurface_p.h @@ -90,6 +90,8 @@ public: virtual void attachPopup(QWaylandShellSurface *popup) { Q_UNUSED(popup); } virtual void detachPopup(QWaylandShellSurface *popup) { Q_UNUSED(popup); } + virtual void setIcon(const QIcon &icon) { Q_UNUSED(icon); } + protected: void resizeFromApplyConfigure(const QSize &sizeWithMargins, const QPoint &offset = {0, 0}); void repositionFromApplyConfigure(const QPoint &position); diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index bc97cfd64d8..ab6cae5d0ce 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -61,6 +61,8 @@ QWaylandWindow::QWaylandWindow(QWindow *window, QWaylandDisplay *display) initializeWlSurface(); + setWindowIcon(window->icon()); + connect(this, &QWaylandWindow::wlSurfaceCreated, this, &QNativeInterface::Private::QWaylandWindow::surfaceCreated); connect(this, &QWaylandWindow::wlSurfaceDestroyed, this, @@ -146,6 +148,7 @@ void QWaylandWindow::initWindow() // Set initial surface title setWindowTitle(window()->title()); + mShellSurface->setIcon(mWindowIcon); // The appId is the desktop entry identifier that should follow the // reverse DNS convention (see @@ -405,6 +408,8 @@ void QWaylandWindow::setWindowIcon(const QIcon &icon) if (mWindowDecorationEnabled && window()->isVisible()) mWindowDecoration->update(); + if (mShellSurface) + mShellSurface->setIcon(icon); } QRect QWaylandWindow::defaultGeometry() const From 92ec75ba8bfc06896cb50e6484486dc2b8d37f95 Mon Sep 17 00:00:00 2001 From: Jie Liu Date: Tue, 13 Aug 2024 13:39:53 +0800 Subject: [PATCH 1424/1507] Add support for wlr-data-control-unstable-v1 protocol [ChangeLog][Third-Party Code] New protocol synced from wlroots. Change-Id: Ia5f43e62f98e9c95ebd02077ec6dc132e13cf5e0 Reviewed-by: David Edmundson --- .../wlr-data-control/qt_attribution.json | 18 ++ .../wlr-data-control-unstable-v1.xml | 278 ++++++++++++++++++ src/plugins/platforms/wayland/CMakeLists.txt | 3 + .../platforms/wayland/qwaylandclipboard.cpp | 44 ++- .../wayland/qwaylanddatacontrolv1.cpp | 161 ++++++++++ .../wayland/qwaylanddatacontrolv1_p.h | 119 ++++++++ .../platforms/wayland/qwaylanddisplay.cpp | 18 ++ .../platforms/wayland/qwaylanddisplay_p.h | 14 + .../platforms/wayland/qwaylandinputdevice.cpp | 23 ++ .../platforms/wayland/qwaylandinputdevice_p.h | 13 + 10 files changed, 684 insertions(+), 7 deletions(-) create mode 100644 src/3rdparty/wayland/protocols/wlr-data-control/qt_attribution.json create mode 100644 src/3rdparty/wayland/protocols/wlr-data-control/wlr-data-control-unstable-v1.xml create mode 100644 src/plugins/platforms/wayland/qwaylanddatacontrolv1.cpp create mode 100644 src/plugins/platforms/wayland/qwaylanddatacontrolv1_p.h diff --git a/src/3rdparty/wayland/protocols/wlr-data-control/qt_attribution.json b/src/3rdparty/wayland/protocols/wlr-data-control/qt_attribution.json new file mode 100644 index 00000000000..eea2dde6ef6 --- /dev/null +++ b/src/3rdparty/wayland/protocols/wlr-data-control/qt_attribution.json @@ -0,0 +1,18 @@ +[ + { + "Id": "wlr-data-control-unstable-v1-protocol", + "Name": "Wlr Data Control Unstable V1 Protocol", + "QDocModule": "qtwaylandcompositor", + "QtUsage": "Used in the Qt Wayland platform plugin", + "Files": "wlr-data-control-unstable-v1.xml", + + "Description": "This protocol allows a privileged client to control data devices.", + "Homepage": "https://gitlab.freedesktop.org/wlroots/wlr-protocols/", + "Version": "2", + "DownloadLocation": "https://gitlab.freedesktop.org/wlroots/wlr-protocols/-/raw/master/unstable/wlr-data-control-unstable-v1.xml", + "LicenseId": "MIT", + "License": "MIT License", + "LicenseFile": "../MIT_LICENSE.txt", + "Copyright": "Copyright © 2018 Simon Ser\nCopyright © 2019 Ivan Molodetskikht" + } +] \ No newline at end of file diff --git a/src/3rdparty/wayland/protocols/wlr-data-control/wlr-data-control-unstable-v1.xml b/src/3rdparty/wayland/protocols/wlr-data-control/wlr-data-control-unstable-v1.xml new file mode 100644 index 00000000000..75e8671b0de --- /dev/null +++ b/src/3rdparty/wayland/protocols/wlr-data-control/wlr-data-control-unstable-v1.xml @@ -0,0 +1,278 @@ + + + + Copyright © 2018 Simon Ser + Copyright © 2019 Ivan Molodetskikh + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that copyright notice and this permission + notice appear in supporting documentation, and that the name of + the copyright holders not be used in advertising or publicity + pertaining to distribution of the software without specific, + written prior permission. The copyright holders make no + representations about the suitability of this software for any + purpose. It is provided "as is" without express or implied + warranty. + + THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS + SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND + FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY + SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN + AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF + THIS SOFTWARE. + + + + This protocol allows a privileged client to control data devices. In + particular, the client will be able to manage the current selection and take + the role of a clipboard manager. + + Warning! The protocol described in this file is experimental and + backward incompatible changes may be made. Backward compatible changes + may be added together with the corresponding interface version bump. + Backward incompatible changes are done by bumping the version number in + the protocol and interface names and resetting the interface version. + Once the protocol is to be declared stable, the 'z' prefix and the + version number in the protocol and interface names are removed and the + interface version number is reset. + + + + + This interface is a manager that allows creating per-seat data device + controls. + + + + + Create a new data source. + + + + + + + Create a data device that can be used to manage a seat's selection. + + + + + + + + All objects created by the manager will still remain valid, until their + appropriate destroy request has been called. + + + + + + + This interface allows a client to manage a seat's selection. + + When the seat is destroyed, this object becomes inert. + + + + + This request asks the compositor to set the selection to the data from + the source on behalf of the client. + + The given source may not be used in any further set_selection or + set_primary_selection requests. Attempting to use a previously used + source is a protocol error. + + To unset the selection, set the source to NULL. + + + + + + + Destroys the data device object. + + + + + + The data_offer event introduces a new wlr_data_control_offer object, + which will subsequently be used in either the + wlr_data_control_device.selection event (for the regular clipboard + selections) or the wlr_data_control_device.primary_selection event (for + the primary clipboard selections). Immediately following the + wlr_data_control_device.data_offer event, the new data_offer object + will send out wlr_data_control_offer.offer events to describe the MIME + types it offers. + + + + + + + The selection event is sent out to notify the client of a new + wlr_data_control_offer for the selection for this device. The + wlr_data_control_device.data_offer and the wlr_data_control_offer.offer + events are sent out immediately before this event to introduce the data + offer object. The selection event is sent to a client when a new + selection is set. The wlr_data_control_offer is valid until a new + wlr_data_control_offer or NULL is received. The client must destroy the + previous selection wlr_data_control_offer, if any, upon receiving this + event. + + The first selection event is sent upon binding the + wlr_data_control_device object. + + + + + + + This data control object is no longer valid and should be destroyed by + the client. + + + + + + + + The primary_selection event is sent out to notify the client of a new + wlr_data_control_offer for the primary selection for this device. The + wlr_data_control_device.data_offer and the wlr_data_control_offer.offer + events are sent out immediately before this event to introduce the data + offer object. The primary_selection event is sent to a client when a + new primary selection is set. The wlr_data_control_offer is valid until + a new wlr_data_control_offer or NULL is received. The client must + destroy the previous primary selection wlr_data_control_offer, if any, + upon receiving this event. + + If the compositor supports primary selection, the first + primary_selection event is sent upon binding the + wlr_data_control_device object. + + + + + + + This request asks the compositor to set the primary selection to the + data from the source on behalf of the client. + + The given source may not be used in any further set_selection or + set_primary_selection requests. Attempting to use a previously used + source is a protocol error. + + To unset the primary selection, set the source to NULL. + + The compositor will ignore this request if it does not support primary + selection. + + + + + + + + + + + + The wlr_data_control_source object is the source side of a + wlr_data_control_offer. It is created by the source client in a data + transfer and provides a way to describe the offered data and a way to + respond to requests to transfer the data. + + + + + + + + + This request adds a MIME type to the set of MIME types advertised to + targets. Can be called several times to offer multiple types. + + Calling this after wlr_data_control_device.set_selection is a protocol + error. + + + + + + + Destroys the data source object. + + + + + + Request for data from the client. Send the data as the specified MIME + type over the passed file descriptor, then close it. + + + + + + + + This data source is no longer valid. The data source has been replaced + by another data source. + + The client should clean up and destroy this data source. + + + + + + + A wlr_data_control_offer represents a piece of data offered for transfer + by another client (the source client). The offer describes the different + MIME types that the data can be converted to and provides the mechanism + for transferring the data directly from the source client. + + + + + To transfer the offered data, the client issues this request and + indicates the MIME type it wants to receive. The transfer happens + through the passed file descriptor (typically created with the pipe + system call). The source client writes the data in the MIME type + representation requested and then closes the file descriptor. + + The receiving client reads from the read end of the pipe until EOF and + then closes its end, at which point the transfer is complete. + + This request may happen multiple times for different MIME types. + + + + + + + + Destroys the data offer object. + + + + + + Sent immediately after creating the wlr_data_control_offer object. + One event per offered MIME type. + + + + + diff --git a/src/plugins/platforms/wayland/CMakeLists.txt b/src/plugins/platforms/wayland/CMakeLists.txt index 4dfc54bfcb5..90cc673cb3e 100644 --- a/src/plugins/platforms/wayland/CMakeLists.txt +++ b/src/plugins/platforms/wayland/CMakeLists.txt @@ -28,6 +28,7 @@ qt_internal_add_module(WaylandClient qwaylandabstractdecoration.cpp qwaylandabstractdecoration_p.h qwaylandappmenu.cpp qwaylandappmenu_p.h qwaylandbuffer.cpp qwaylandbuffer_p.h + qwaylanddatacontrolv1.cpp qwaylanddatacontrolv1_p.h qwaylanddecorationfactory.cpp qwaylanddecorationfactory_p.h qwaylanddecorationplugin.cpp qwaylanddecorationplugin_p.h qwaylanddisplay.cpp qwaylanddisplay_p.h @@ -92,6 +93,7 @@ qt_internal_add_module(WaylandClient ../3rdparty/protocol/fractional-scale ../3rdparty/protocol/viewporter ../3rdparty/protocol/xdg-shell + ../3rdparty/protocol/wlr-data-control ) qt6_generate_wayland_protocol_client_sources(WaylandClient @@ -109,6 +111,7 @@ qt6_generate_wayland_protocol_client_sources(WaylandClient ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/xdg-output/xdg-output-unstable-v1.xml ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/fractional-scale/fractional-scale-v1.xml ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/viewporter/viewporter.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/wlr-data-control/wlr-data-control-unstable-v1.xml ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/xdg-shell/xdg-shell.xml ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/xdg-system-bell/xdg-system-bell-v1.xml ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/xdg-toplevel-drag/xdg-toplevel-drag-v1.xml diff --git a/src/plugins/platforms/wayland/qwaylandclipboard.cpp b/src/plugins/platforms/wayland/qwaylandclipboard.cpp index a1730c77fd7..a1737ef69eb 100644 --- a/src/plugins/platforms/wayland/qwaylandclipboard.cpp +++ b/src/plugins/platforms/wayland/qwaylandclipboard.cpp @@ -1,9 +1,11 @@ // Copyright (C) 2016 The Qt Company Ltd. +// Copyright (C) 2024 Jie Liu // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "qwaylandclipboard_p.h" #include "qwaylanddisplay_p.h" #include "qwaylandinputdevice_p.h" +#include "qwaylanddatacontrolv1_p.h" #include "qwaylanddataoffer_p.h" #include "qwaylanddatasource_p.h" #include "qwaylanddatadevice_p.h" @@ -37,6 +39,12 @@ QMimeData *QWaylandClipboard::mimeData(QClipboard::Mode mode) switch (mode) { case QClipboard::Clipboard: + if (auto *dataControlDevice = seat->dataControlDevice()) { + if (dataControlDevice->selectionSource()) + return m_clientClipboard[QClipboard::Clipboard]; + if (auto *offer = dataControlDevice->selectionOffer()) + return offer->mimeData(); + } if (auto *dataDevice = seat->dataDevice()) { if (dataDevice->selectionSource()) return m_clientClipboard[QClipboard::Clipboard]; @@ -45,6 +53,12 @@ QMimeData *QWaylandClipboard::mimeData(QClipboard::Mode mode) } return &m_emptyData; case QClipboard::Selection: + if (auto *dataControlDevice = seat->dataControlDevice()) { + if (dataControlDevice->primarySelectionSource()) + return m_clientClipboard[QClipboard::Selection]; + if (auto *offer = dataControlDevice->primarySelectionOffer()) + return offer->mimeData(); + } #if QT_CONFIG(wayland_client_primary_selection) if (auto *selectionDevice = seat->primarySelectionDevice()) { if (selectionDevice->selectionSource()) @@ -84,20 +98,28 @@ void QWaylandClipboard::setMimeData(QMimeData *data, QClipboard::Mode mode) switch (mode) { case QClipboard::Clipboard: - if (auto *dataDevice = seat->dataDevice()) { + if (auto *dataControlDevice = seat->dataControlDevice()) { + dataControlDevice->setSelectionSource(data ? new QWaylandDataControlSourceV1(mDisplay->dataControlManager(), + m_clientClipboard[QClipboard::Clipboard]) : nullptr); + emitChanged(mode); + } else if (auto *dataDevice = seat->dataDevice()) { dataDevice->setSelectionSource(data ? new QWaylandDataSource(mDisplay->dndSelectionHandler(), m_clientClipboard[QClipboard::Clipboard]) : nullptr); emitChanged(mode); } break; case QClipboard::Selection: + if (auto *dataControlDevice = seat->dataControlDevice()) { + dataControlDevice->setPrimarySelectionSource(data ? new QWaylandDataControlSourceV1(mDisplay->dataControlManager(), + m_clientClipboard[QClipboard::Selection]) : nullptr); + emitChanged(mode); #if QT_CONFIG(wayland_client_primary_selection) - if (auto *selectionDevice = seat->primarySelectionDevice()) { + } else if (auto *selectionDevice = seat->primarySelectionDevice()) { selectionDevice->setSelectionSource(data ? new QWaylandPrimarySelectionSourceV1(mDisplay->primarySelectionManager(), m_clientClipboard[QClipboard::Selection]) : nullptr); emitChanged(mode); - } #endif + } break; default: break; @@ -106,12 +128,18 @@ void QWaylandClipboard::setMimeData(QMimeData *data, QClipboard::Mode mode) bool QWaylandClipboard::supportsMode(QClipboard::Mode mode) const { -#if QT_CONFIG(wayland_client_primary_selection) if (mode == QClipboard::Selection) { auto *seat = mDisplay->currentInputDevice(); - return seat && seat->primarySelectionDevice(); - } + if (!seat) + return false; + if (seat->dataControlDevice()) + return true; +#if QT_CONFIG(wayland_client_primary_selection) + if (seat->primarySelectionDevice()) + return true; #endif + return false; + } return mode == QClipboard::Clipboard; } @@ -124,8 +152,10 @@ bool QWaylandClipboard::ownsMode(QClipboard::Mode mode) const switch (mode) { case QClipboard::Clipboard: return seat->dataDevice() && seat->dataDevice()->selectionSource() != nullptr; -#if QT_CONFIG(wayland_client_primary_selection) case QClipboard::Selection: + if (seat->dataControlDevice() && seat->dataControlDevice()->primarySelectionSource() != nullptr) + return true; +#if QT_CONFIG(wayland_client_primary_selection) return seat->primarySelectionDevice() && seat->primarySelectionDevice()->selectionSource() != nullptr; #endif default: diff --git a/src/plugins/platforms/wayland/qwaylanddatacontrolv1.cpp b/src/plugins/platforms/wayland/qwaylanddatacontrolv1.cpp new file mode 100644 index 00000000000..6d2b60b2db8 --- /dev/null +++ b/src/plugins/platforms/wayland/qwaylanddatacontrolv1.cpp @@ -0,0 +1,161 @@ +// Copyright (C) 2024 Jie Liu +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#include "qwaylanddatacontrolv1_p.h" +#include "qwaylandinputdevice_p.h" +#include "qwaylanddisplay_p.h" +#include "qwaylandmimehelper_p.h" + +#include + +#include + +QT_BEGIN_NAMESPACE + +namespace QtWaylandClient { + +QWaylandDataControlManagerV1::QWaylandDataControlManagerV1(QWaylandDisplay *display, uint id, uint version) + : zwlr_data_control_manager_v1(display->wl_registry(), id, qMin(version, uint(2))) + , m_display(display) +{ +} + +QWaylandDataControlDeviceV1 *QWaylandDataControlManagerV1::createDevice(QWaylandInputDevice *seat) +{ + return new QWaylandDataControlDeviceV1(this, seat); +} + +QWaylandDataControlOfferV1::QWaylandDataControlOfferV1(QWaylandDisplay *display, ::zwlr_data_control_offer_v1 *offer) + : zwlr_data_control_offer_v1(offer) + , m_display(display) + , m_mimeData(new QWaylandMimeData(this)) +{} + +void QWaylandDataControlOfferV1::startReceiving(const QString &mimeType, int fd) +{ + receive(mimeType, fd); + wl_display_flush(m_display->wl_display()); +} + +void QWaylandDataControlOfferV1::zwlr_data_control_offer_v1_offer(const QString &mime_type) +{ + m_mimeData->appendFormat(mime_type); +} + +QWaylandDataControlDeviceV1::QWaylandDataControlDeviceV1( + QWaylandDataControlManagerV1 *manager, QWaylandInputDevice *seat) + : QtWayland::zwlr_data_control_device_v1(manager->get_data_device(seat->wl_seat())) + , m_display(manager->display()) + , m_seat(seat) +{ +} + +QWaylandDataControlDeviceV1::~QWaylandDataControlDeviceV1() +{ + destroy(); +} + +void QWaylandDataControlDeviceV1::invalidateSelectionOffer() +{ + if (!m_selectionOffer) + return; + + m_selectionOffer.reset(); + QGuiApplicationPrivate::platformIntegration()->clipboard()->emitChanged(QClipboard::Selection); +} + +void QWaylandDataControlDeviceV1::setSelectionSource(QWaylandDataControlSourceV1 *source) +{ + if (source) { + connect(source, &QWaylandDataControlSourceV1::cancelled, this, [this]() { + m_selectionSource.reset(); + QGuiApplicationPrivate::platformIntegration()->clipboard()->emitChanged(QClipboard::Clipboard); + }); + } + set_selection(source ? source->object() : nullptr); + m_selectionSource.reset(source); +} + +void QWaylandDataControlDeviceV1::setPrimarySelectionSource(QWaylandDataControlSourceV1 *source) +{ + if (source) { + connect(source, &QWaylandDataControlSourceV1::cancelled, this, [this]() { + m_primarySelectionSource.reset(); + QGuiApplicationPrivate::platformIntegration()->clipboard()->emitChanged(QClipboard::Selection); + }); + } + set_primary_selection(source ? source->object() : nullptr); + m_primarySelectionSource.reset(source); +} + +void QWaylandDataControlDeviceV1::zwlr_data_control_device_v1_data_offer(zwlr_data_control_offer_v1 *offer) +{ + new QWaylandDataControlOfferV1(m_display, offer); +} + +void QWaylandDataControlDeviceV1::zwlr_data_control_device_v1_selection(zwlr_data_control_offer_v1 *id) +{ + if (!id) + return; + m_selectionOffer.reset(static_cast(zwlr_data_control_offer_v1_get_user_data(id))); + + // The selection event may be sent before platfrmIntegration is set. + if (auto* integration = QGuiApplicationPrivate::platformIntegration()) + integration->clipboard()->emitChanged(QClipboard::Selection); +} + +void QWaylandDataControlDeviceV1::zwlr_data_control_device_v1_finished() +{ + m_selectionOffer.reset(); + m_primarySelectionOffer.reset(); + QGuiApplicationPrivate::platformIntegration()->clipboard()->emitChanged(QClipboard::Selection); +} + +void QWaylandDataControlDeviceV1::zwlr_data_control_device_v1_primary_selection(struct ::zwlr_data_control_offer_v1 *id) +{ + if (!id) + return; + m_primarySelectionOffer.reset(static_cast(zwlr_data_control_offer_v1_get_user_data(id))); + + // The selection event may be sent before platfrmIntegration is set. + if (auto* integration = QGuiApplicationPrivate::platformIntegration()) + integration->clipboard()->emitChanged(QClipboard::Selection); +} + +QWaylandDataControlSourceV1::QWaylandDataControlSourceV1(QWaylandDataControlManagerV1 *manager, QMimeData *mimeData) + : QtWayland::zwlr_data_control_source_v1(manager->create_data_source()) + , m_mimeData(mimeData) +{ + if (!mimeData) + return; + for (auto &format : mimeData->formats()) + offer(format); +} + +QWaylandDataControlSourceV1::~QWaylandDataControlSourceV1() +{ + destroy(); +} + +void QWaylandDataControlSourceV1::zwlr_data_control_source_v1_send(const QString &mime_type, int32_t fd) +{ + QByteArray content = QWaylandMimeHelper::getByteArray(m_mimeData, mime_type); + if (!content.isEmpty()) { + // Create a sigpipe handler that does nothing, or clients may be forced to terminate + // if the pipe is closed in the other end. + struct sigaction action, oldAction; + action.sa_handler = SIG_IGN; + sigemptyset (&action.sa_mask); + action.sa_flags = 0; + + sigaction(SIGPIPE, &action, &oldAction); + ssize_t unused = write(fd, content.constData(), size_t(content.size())); + Q_UNUSED(unused); + sigaction(SIGPIPE, &oldAction, nullptr); + } + close(fd); +} + +} // namespace QtWaylandClient + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylanddatacontrolv1_p.h b/src/plugins/platforms/wayland/qwaylanddatacontrolv1_p.h new file mode 100644 index 00000000000..79f6378b3f9 --- /dev/null +++ b/src/plugins/platforms/wayland/qwaylanddatacontrolv1_p.h @@ -0,0 +1,119 @@ +// Copyright (C) 2024 Jie Liu +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QWAYLANDDATACONTROLV1_H +#define QWAYLANDDATACONTROLV1_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include + +#include +#include + +#include + +QT_REQUIRE_CONFIG(clipboard); + +QT_BEGIN_NAMESPACE + +class QMimeData; + +namespace QtWaylandClient { + +class QWaylandInputDevice; +class QWaylandDataControlDeviceV1; + +class QWaylandDataControlManagerV1 : public QtWayland::zwlr_data_control_manager_v1 +{ +public: + explicit QWaylandDataControlManagerV1(QWaylandDisplay *display, uint id, uint version); + QWaylandDataControlDeviceV1 *createDevice(QWaylandInputDevice *seat); + QWaylandDisplay *display() const { return m_display; } + +private: + QWaylandDisplay *m_display = nullptr; +}; + +class QWaylandDataControlOfferV1 : public QtWayland::zwlr_data_control_offer_v1, public QWaylandAbstractDataOffer +{ +public: + explicit QWaylandDataControlOfferV1(QWaylandDisplay *display, ::zwlr_data_control_offer_v1 *offer); + ~QWaylandDataControlOfferV1() override { destroy(); } + void startReceiving(const QString &mimeType, int fd) override; + QMimeData *mimeData() override { return m_mimeData.data(); } + +protected: + void zwlr_data_control_offer_v1_offer(const QString &mime_type) override; + +private: + QWaylandDisplay *m_display = nullptr; + QScopedPointer m_mimeData; +}; + +class Q_WAYLANDCLIENT_EXPORT QWaylandDataControlSourceV1 : public QObject, public QtWayland::zwlr_data_control_source_v1 +{ + Q_OBJECT +public: + explicit QWaylandDataControlSourceV1(QWaylandDataControlManagerV1 *manager, QMimeData *mimeData); + ~QWaylandDataControlSourceV1() override; + + QMimeData *mimeData() const { return m_mimeData; } + +Q_SIGNALS: + void cancelled(); + +protected: + void zwlr_data_control_source_v1_send(const QString &mime_type, int32_t fd) override; + void zwlr_data_control_source_v1_cancelled() override { Q_EMIT cancelled(); } + +private: + QWaylandDisplay *m_display = nullptr; + QMimeData *m_mimeData = nullptr; +}; + +class QWaylandDataControlDeviceV1 : public QObject, public QtWayland::zwlr_data_control_device_v1 +{ + Q_OBJECT + QWaylandDataControlDeviceV1(QWaylandDataControlManagerV1 *manager, QWaylandInputDevice *seat); + +public: + ~QWaylandDataControlDeviceV1() override; + QWaylandDataControlOfferV1 *primarySelectionOffer() const { return m_primarySelectionOffer.data(); } + QWaylandDataControlOfferV1 *selectionOffer() const { return m_selectionOffer.data(); } + void invalidateSelectionOffer(); + QWaylandDataControlSourceV1 *selectionSource() const { return m_selectionSource.data(); } + QWaylandDataControlSourceV1 *primarySelectionSource() const { return m_primarySelectionSource.data(); } + void setSelectionSource(QWaylandDataControlSourceV1 *source); + void setPrimarySelectionSource(QWaylandDataControlSourceV1 *source); + +protected: + void zwlr_data_control_device_v1_data_offer(struct ::zwlr_data_control_offer_v1 *id) override; + void zwlr_data_control_device_v1_selection(struct ::zwlr_data_control_offer_v1 *id) override; + void zwlr_data_control_device_v1_finished() override; + void zwlr_data_control_device_v1_primary_selection(struct ::zwlr_data_control_offer_v1 *id) override; + +private: + QWaylandDisplay *m_display = nullptr; + QWaylandInputDevice *m_seat = nullptr; + QScopedPointer m_selectionOffer; + QScopedPointer m_primarySelectionOffer; + QScopedPointer m_selectionSource; + QScopedPointer m_primarySelectionSource; + friend class QWaylandDataControlManagerV1; +}; + +} // namespace QtWaylandClient + +QT_END_NAMESPACE + +#endif // QWAYLANDDATACONTROLV1_H diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index 572275057d8..dfdf88c0b4a 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -1,4 +1,5 @@ // Copyright (C) 2016 The Qt Company Ltd. +// Copyright (C) 2024 Jie Liu // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "qwaylanddisplay_p.h" @@ -13,6 +14,7 @@ #include "qwaylandinputdevice_p.h" #if QT_CONFIG(clipboard) #include "qwaylandclipboard_p.h" +#include "qwaylanddatacontrolv1_p.h" #endif #if QT_CONFIG(wayland_datadevice) #include "qwaylanddatadevicemanager_p.h" @@ -53,6 +55,7 @@ #include #include #include +#include #include @@ -329,6 +332,7 @@ QWaylandDisplay::QWaylandDisplay(QWaylandIntegration *waylandIntegration) } mWaylandTryReconnect = qEnvironmentVariableIsSet("QT_WAYLAND_RECONNECT"); + mPreferWlrDataControl = qEnvironmentVariableIntValue("QT_WAYLAND_USE_DATA_CONTROL") > 0; } void QWaylandDisplay::setupConnection() @@ -787,6 +791,13 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin } else if ( interface == QLatin1String(QtWayland::org_kde_kwin_appmenu_manager::interface()->name)) { mGlobals.appMenuManager.reset(new QWaylandAppMenuManager(registry, id, 1)); +#if QT_CONFIG(clipboard) + } else if (mPreferWlrDataControl && interface == QLatin1String(QWaylandDataControlManagerV1::interface()->name)) { + mGlobals.dataControlManager.reset(new QWaylandDataControlManagerV1(this, id, 2)); + for (QWaylandInputDevice *inputDevice : std::as_const(mInputDevices)) { + inputDevice->setDataControlDevice(mGlobals.dataControlManager->createDevice(inputDevice)); + } +#endif } mRegistryGlobals.append(RegistryGlobal(id, interface, version, registry)); @@ -851,6 +862,13 @@ void QWaylandDisplay::registry_global_remove(uint32_t id) for (QWaylandInputDevice *inputDevice : std::as_const(mInputDevices)) inputDevice->setPrimarySelectionDevice(nullptr); } +#endif +#if QT_CONFIG(clipboard) + if (global.interface == QLatin1String(QtWayland::zwlr_data_control_manager_v1::interface()->name)) { + mGlobals.dataControlManager.reset(); + for (QWaylandInputDevice *inputDevice : std::as_const(mInputDevices)) + inputDevice->setDataControlDevice(nullptr); + } #endif emit globalRemoved(mRegistryGlobals.takeAt(i)); break; diff --git a/src/plugins/platforms/wayland/qwaylanddisplay_p.h b/src/plugins/platforms/wayland/qwaylanddisplay_p.h index 074117a38f2..1a6a5ba8e91 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay_p.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay_p.h @@ -1,4 +1,5 @@ // Copyright (C) 2016 The Qt Company Ltd. +// Copyright (C) 2024 Jie Liu // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QWAYLANDDISPLAY_H @@ -71,6 +72,9 @@ class QWaylandXdgOutputManagerV1; class QWaylandClientBufferIntegration; class QWaylandWindowManagerIntegration; class QWaylandDataDeviceManager; +#if QT_CONFIG(clipboard) +class QWaylandDataControlManagerV1; +#endif #if QT_CONFIG(wayland_client_primary_selection) class QWaylandPrimarySelectionDeviceManagerV1; #endif @@ -148,6 +152,12 @@ public: return mGlobals.dndSelectionHandler.get(); } #endif +#if QT_CONFIG(clipboard) + QWaylandDataControlManagerV1 *dataControlManager() const + { + return mGlobals.dataControlManager.get(); + } +#endif #if QT_CONFIG(wayland_client_primary_selection) QWaylandPrimarySelectionDeviceManagerV1 *primarySelectionManager() const { @@ -334,6 +344,9 @@ private: std::unique_ptr tabletManager; #endif std::unique_ptr pointerGestures; +#if QT_CONFIG(clipboard) + std::unique_ptr dataControlManager; +#endif #if QT_CONFIG(wayland_client_primary_selection) std::unique_ptr primarySelectionManager; #endif @@ -363,6 +376,7 @@ private: struct wl_callback *mSyncCallback = nullptr; static const wl_callback_listener syncCallbackListener; bool mWaylandTryReconnect = false; + bool mPreferWlrDataControl = false; bool mWaylandInputContextRequested = [] () { const auto requested = QPlatformInputContextFactory::requested(); diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index afbb3879b6d..0c4da6fef4a 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -1,4 +1,5 @@ // Copyright (C) 2016 The Qt Company Ltd. +// Copyright (C) 2024 Jie Liu // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "qwaylandinputdevice_p.h" @@ -12,6 +13,9 @@ #include "qwaylanddatadevice_p.h" #include "qwaylanddatadevicemanager_p.h" #endif +#if QT_CONFIG(clipboard) +#include "qwaylanddatacontrolv1_p.h" +#endif #if QT_CONFIG(wayland_client_primary_selection) #include "qwaylandprimaryselectionv1_p.h" #endif @@ -316,6 +320,13 @@ QWaylandInputDevice::QWaylandInputDevice(QWaylandDisplay *display, int version, , mDisplay(display->wl_display()) , mId(id) { + +#if QT_CONFIG(clipboard) + if (auto *dataControlManager = mQDisplay->dataControlManager()) { + setDataControlDevice(dataControlManager->createDevice(this)); + } +#endif + #if QT_CONFIG(wayland_datadevice) if (mQDisplay->dndSelectionHandler()) { mDataDevice = mQDisplay->dndSelectionHandler()->getDataDevice(this); @@ -485,6 +496,18 @@ QWaylandDataDevice *QWaylandInputDevice::dataDevice() const } #endif +#if QT_CONFIG(clipboard) +void QWaylandInputDevice::setDataControlDevice(QWaylandDataControlDeviceV1 *dataControlDevice) +{ + mDataControlDevice.reset(dataControlDevice); +} + +QWaylandDataControlDeviceV1 *QWaylandInputDevice::dataControlDevice() const +{ + return mDataControlDevice.data(); +} +#endif + #if QT_CONFIG(wayland_client_primary_selection) void QWaylandInputDevice::setPrimarySelectionDevice(QWaylandPrimarySelectionDeviceV1 *primarySelectionDevice) { diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h index 0d79ef93376..bcaf025840d 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h +++ b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h @@ -1,4 +1,5 @@ // Copyright (C) 2016 The Qt Company Ltd. +// Copyright (C) 2024 Jie Liu // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QWAYLANDINPUTDEVICE_H @@ -51,6 +52,9 @@ namespace QtWaylandClient { class QWaylandDataDevice; class QWaylandDisplay; +#if QT_CONFIG(clipboard) +class QWaylandDataControlDeviceV1; +#endif #if QT_CONFIG(wayland_client_primary_selection) class QWaylandPrimarySelectionDeviceV1; #endif @@ -102,6 +106,11 @@ public: QWaylandDataDevice *dataDevice() const; #endif +#if QT_CONFIG(clipboard) + void setDataControlDevice(QWaylandDataControlDeviceV1 *dataControlDevice); + QWaylandDataControlDeviceV1 *dataControlDevice() const; +#endif + #if QT_CONFIG(wayland_client_primary_selection) void setPrimarySelectionDevice(QWaylandPrimarySelectionDeviceV1 *primarySelectionDevice); QWaylandPrimarySelectionDeviceV1 *primarySelectionDevice() const; @@ -166,6 +175,10 @@ protected: QWaylandDataDevice *mDataDevice = nullptr; #endif +#if QT_CONFIG(clipboard) + QScopedPointer mDataControlDevice; +#endif + #if QT_CONFIG(wayland_client_primary_selection) QScopedPointer mPrimarySelectionDevice; #endif From 8b86bbe81fa6792a7b9672202718d282b9df4d4b Mon Sep 17 00:00:00 2001 From: David Redondo Date: Wed, 6 Nov 2024 09:52:59 +0100 Subject: [PATCH 1425/1507] client: Fix crash on data_device_motion When a window is closed/destroyed, a motion message can still be received that was send by the compositor before closing the window. Pick-to: 6.8 Change-Id: I49cfdcf9a4143df5c090dfb93f2920879ae43f80 Reviewed-by: David Edmundson --- src/plugins/platforms/wayland/qwaylanddatadevice.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/plugins/platforms/wayland/qwaylanddatadevice.cpp b/src/plugins/platforms/wayland/qwaylanddatadevice.cpp index 095911274dc..7de41da584e 100644 --- a/src/plugins/platforms/wayland/qwaylanddatadevice.cpp +++ b/src/plugins/platforms/wayland/qwaylanddatadevice.cpp @@ -257,6 +257,9 @@ void QWaylandDataDevice::data_device_motion(uint32_t time, wl_fixed_t x, wl_fixe if (!drag && !m_dragOffer) return; + if (!m_dragWindow) + return; + m_dragPoint = calculateDragPosition(x, y, m_dragWindow); QMimeData *dragData = nullptr; From af1f258c11112433176be2e73a916c3a774bc47d Mon Sep 17 00:00:00 2001 From: David Redondo Date: Tue, 29 Oct 2024 17:07:18 +0100 Subject: [PATCH 1426/1507] client: Fix changing to subsurface now that wl_surface is not destroyed In the past isVisible() was equivalent to having a wl_surface - this does not hold anymore. The QWaylandWindow will have a wl_surface for all its life time. Changing parent while the window is hidden would run now into a protocol error. Change-Id: I2aec6217ad495daa9dbb2ee2fee1b73ba00e6937 Reviewed-by: David Edmundson --- .../platforms/wayland/qwaylandwindow.cpp | 15 +++--- .../platforms/wayland/qwaylandwindow_p.h | 1 + tests/auto/wayland/shared/coreprotocol.cpp | 27 ++++++++++ tests/auto/wayland/shared/coreprotocol.h | 51 +++++++++++++------ tests/auto/wayland/shared/xdgshell.cpp | 12 +++++ tests/auto/wayland/shared/xdgshell.h | 10 ++++ tests/auto/wayland/surface/tst_surface.cpp | 28 ++++++++++ 7 files changed, 122 insertions(+), 22 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index ab6cae5d0ce..cb6c07f9799 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -354,21 +354,22 @@ WId QWaylandWindow::winId() const void QWaylandWindow::setParent(const QPlatformWindow *parent) { - if (!window()->isVisible()) - return; - - QWaylandWindow *oldparent = mSubSurfaceWindow ? mSubSurfaceWindow->parent() : nullptr; - if (oldparent == parent) + if (lastParent == parent) return; if (mSubSurfaceWindow && parent) { // new parent, but we were a subsurface already delete mSubSurfaceWindow; QWaylandWindow *p = const_cast(static_cast(parent)); mSubSurfaceWindow = new QWaylandSubSurface(this, p, mDisplay->createSubSurface(this, p)); - } else { // we're changing role, need to make a new wl_surface + } else if ((!lastParent && parent) || (lastParent && !parent)) { + // we're changing role, need to make a new wl_surface reset(); - initWindow(); + initializeWlSurface(); + if (window()->isVisible()) { + initWindow(); + } } + lastParent = parent; } QString QWaylandWindow::windowTitle() const diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index c0a93189fea..e4ce2af700f 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -366,6 +366,7 @@ private: static const wl_callback_listener callbackListener; void handleFrameCallback(struct ::wl_callback* callback); + const QPlatformWindow *lastParent = nullptr; static QWaylandWindow *mMouseGrab; static QWaylandWindow *mTopPopup; diff --git a/tests/auto/wayland/shared/coreprotocol.cpp b/tests/auto/wayland/shared/coreprotocol.cpp index 3152f26148a..aba270f13bc 100644 --- a/tests/auto/wayland/shared/coreprotocol.cpp +++ b/tests/auto/wayland/shared/coreprotocol.cpp @@ -19,6 +19,7 @@ Surface::~Surface() qDeleteAll(m_commits); if (m_wlShellSurface) m_wlShellSurface->m_surface = nullptr; + delete m_role; } void Surface::sendFrameCallbacks() @@ -181,6 +182,25 @@ QString WlCompositor::dirtyMessage() return "Dirty, surfaces left:\n\t" + messages.join("\n\t"); } +void SubCompositor::subcompositor_get_subsurface(Resource *resource, uint32_t id, + ::wl_resource *surfaceResource, + ::wl_resource *parent) +{ + QTRY_VERIFY(parent); + QTRY_VERIFY(surfaceResource); + auto surface = fromResource(surfaceResource); + if (!surface->m_role) { + surface->m_role = new SubSurfaceRole; + } else if (!qobject_cast(surface->m_role)) { + QFAIL(QByteArrayLiteral("surface already has role") + surface->m_role->metaObject()->className()); + return; + } + + auto *subsurface = new Subsurface(this, resource->client(), id, resource->version()); + m_subsurfaces.append(subsurface); + emit subsurfaceCreated(subsurface); +} + void Output::sendGeometry() { const auto resources = resourceMap().values(); @@ -628,6 +648,13 @@ WlShell::WlShell(CoreCompositor *compositor, int version) void WlShell::shell_get_shell_surface(Resource *resource, uint32_t id, wl_resource *surface) { auto *s = fromResource(surface); + if (!s->m_role) { + s->m_role = new WlShellSurfaceRole; + } else if (!qobject_cast(s->m_role)) { + QFAIL(QByteArrayLiteral("surface already has role") + s->m_role->metaObject()->className()); + return; + } + auto *wlShellSurface = new WlShellSurface(this, resource->client(), id, s); m_wlShellSurfaces << wlShellSurface; emit wlShellSurfaceCreated(wlShellSurface); diff --git a/tests/auto/wayland/shared/coreprotocol.h b/tests/auto/wayland/shared/coreprotocol.h index 4b06b5b538e..127ff0964b2 100644 --- a/tests/auto/wayland/shared/coreprotocol.h +++ b/tests/auto/wayland/shared/coreprotocol.h @@ -188,6 +188,11 @@ protected: void shell_get_shell_surface(Resource *resource, uint32_t id, ::wl_resource *surface) override; }; +class WlShellSurfaceRole : public SurfaceRole +{ + Q_OBJECT +}; + class WlShellSurface : public QObject, public QtWaylandServer::wl_shell_surface { Q_OBJECT @@ -203,15 +208,7 @@ public: Surface *m_surface = nullptr; }; -class Subsurface : public QObject, public QtWaylandServer::wl_subsurface -{ - Q_OBJECT -public: - explicit Subsurface(wl_client *client, int id, int version) - : QtWaylandServer::wl_subsurface(client, id, version) - { - } -}; +class Subsurface; class SubCompositor : public Global, public QtWaylandServer::wl_subcompositor { @@ -226,14 +223,38 @@ signals: void subsurfaceCreated(Subsurface *subsurface); protected: - void subcompositor_get_subsurface(Resource *resource, uint32_t id, ::wl_resource *surface, ::wl_resource *parent) override + void subcompositor_get_subsurface(Resource *resource, uint32_t id, + ::wl_resource *surfaceResource, + ::wl_resource *parent) override; +}; + +class SubSurfaceRole : public SurfaceRole +{ + Q_OBJECT +}; + +class Subsurface : public QObject, public QtWaylandServer::wl_subsurface +{ + Q_OBJECT +public: + explicit Subsurface(SubCompositor *subCompositor, wl_client *client, int id, int version) + : QtWaylandServer::wl_subsurface(client, id, version), m_subcompositor(subCompositor) { - QTRY_VERIFY(parent); - QTRY_VERIFY(surface); - auto *subsurface = new Subsurface(resource->client(), id, resource->version()); - m_subsurfaces.append(subsurface); // TODO: clean up? - emit subsurfaceCreated(subsurface); } + ~Subsurface() + { + m_subcompositor->m_subsurfaces.removeOne(this); + qDebug() << m_subcompositor->m_subsurfaces; + } + void subsurface_destroy(Resource *resource) override { wl_resource_destroy(resource->handle); } + void subsurface_destroy_resource(Resource *resource) override + { + Q_UNUSED(resource) + delete this; + } + +private: + SubCompositor *m_subcompositor; }; struct OutputMode { diff --git a/tests/auto/wayland/shared/xdgshell.cpp b/tests/auto/wayland/shared/xdgshell.cpp index 184522765b2..2c9d61ff510 100644 --- a/tests/auto/wayland/shared/xdgshell.cpp +++ b/tests/auto/wayland/shared/xdgshell.cpp @@ -99,6 +99,12 @@ void XdgSurface::xdg_surface_get_toplevel(Resource *resource, uint32_t id) { QVERIFY(!m_toplevel); QVERIFY(!m_popup); + if (!m_surface->m_role) { + m_surface->m_role = new XdgToplevelRole; + } else if (!qobject_cast(m_surface->m_role)) { + QFAIL(QByteArrayLiteral("surface already has role") + m_surface->m_role->metaObject()->className()); + return; + } m_toplevel = new XdgToplevel(this, id, resource->version()); emit toplevelCreated(m_toplevel); } @@ -108,6 +114,12 @@ void XdgSurface::xdg_surface_get_popup(Resource *resource, uint32_t id, wl_resou Q_UNUSED(positioner); QVERIFY(!m_toplevel); QVERIFY(!m_popup); + if (!m_surface->m_role) { + m_surface->m_role = new SubSurfaceRole; + } else if (!qobject_cast(m_surface->m_role)) { + qWarning() << "surface already has role" << m_surface->m_role->metaObject()->className(); + return; + } auto *p = fromResource(parent); m_popup = new XdgPopup(this, p, id, resource->version()); } diff --git a/tests/auto/wayland/shared/xdgshell.h b/tests/auto/wayland/shared/xdgshell.h index 3959e0668a8..7eab8028e80 100644 --- a/tests/auto/wayland/shared/xdgshell.h +++ b/tests/auto/wayland/shared/xdgshell.h @@ -85,6 +85,11 @@ protected: void xdg_surface_ack_configure(Resource *resource, uint32_t serial) override; }; +class XdgToplevelRole : public SurfaceRole +{ + Q_OBJECT +}; + class XdgToplevel : public QObject, public QtWaylandServer::xdg_toplevel { Q_OBJECT @@ -106,6 +111,11 @@ protected: void xdg_toplevel_set_min_size(Resource *resource, int32_t width, int32_t height) override; }; +class XdgPopupRole : public SurfaceRole +{ + Q_OBJECT +}; + class XdgPopup : public QObject, public QtWaylandServer::xdg_popup { Q_OBJECT diff --git a/tests/auto/wayland/surface/tst_surface.cpp b/tests/auto/wayland/surface/tst_surface.cpp index 9fe4188ef81..e5512faad06 100644 --- a/tests/auto/wayland/surface/tst_surface.cpp +++ b/tests/auto/wayland/surface/tst_surface.cpp @@ -26,6 +26,7 @@ private slots: // Subsurfaces void createSubsurface(); void createSubsurfaceForHiddenParent(); + void changeToSubsurface(); }; tst_surface::tst_surface() @@ -215,5 +216,32 @@ void tst_surface::createSubsurfaceForHiddenParent() QVERIFY(subsurface); } +void tst_surface::changeToSubsurface() +{ + QRasterWindow window1; + window1.resize(64, 64); + window1.show(); + + QRasterWindow window2; + window2.resize(64, 64); + window2.show(); + + window2.setParent(&window1); + QCOMPOSITOR_TRY_VERIFY(subSurface()); + + window2.setParent(nullptr); + QCOMPOSITOR_TRY_VERIFY(xdgToplevel(1)); + + window2.hide(); + window2.setParent(&window1); + window2.show(); + QCOMPOSITOR_TRY_VERIFY(subSurface()); + + window2.hide(); + window2.setParent(nullptr); + window2.show(); + QCOMPOSITOR_TRY_VERIFY(xdgToplevel(1)); +} + QCOMPOSITOR_TEST_MAIN(tst_surface) #include "tst_surface.moc" From e7539d2ee8b356169c43f9029035f32d4299afc5 Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Wed, 6 Nov 2024 17:13:17 +0200 Subject: [PATCH 1427/1507] Client: Avoid activating window on show if Qt::WindowDoesNotAcceptFocus is set The Qt::WindowDoesNotAcceptFocus flag provides one more clue regarding what the user intends to achieve. Technically though, the does not accept focus flag doesn't influence a lot in practice as it's not communicated back to the compositor, but it's still suitable for determining whether the window needs to be activated when it's shown. Change-Id: Idf80c1701966870b4bbe422ecb9c7cb33e3a6bc0 Reviewed-by: David Edmundson --- .../plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp index 380c93bc9d1..1fced1af1db 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp @@ -588,6 +588,10 @@ bool QWaylandXdgSurface::requestActivateOnShow() if (type == Qt::ToolTip || type == Qt::Popup || type == Qt::SplashScreen) return false; + const Qt::WindowFlags flags = m_window->window()->flags(); + if (flags & Qt::WindowDoesNotAcceptFocus) + return false; + if (m_window->window()->property("_q_showWithoutActivating").toBool()) return false; From 77aeb195a4adcdc76e1543cf93c3569c7485468b Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Tue, 29 Oct 2024 16:58:46 +0100 Subject: [PATCH 1428/1507] Position grabbing popups correctly when started from hover events If there is no known lastInputDevice, child popups will be randomly positioned. This can happen when a popup is triggered by a hover event. The obvious fix is to call setLastInputDevice from pointer_enter(). However, Weston (and probably other compositors) do not accept enter events as valid grab serials. Calling setLastInputDevice from every pointer_enter would therefore completely disable menu popup on mouse-over for those compositors. The solution is to only call setLastInputDevice when we have not seen one before. This means that the user may have to click once to get hover popups to work. This should be an acceptable price to pay to avoid menus appearing at random positions. Fixes: QTBUG-128937 Change-Id: I446abb2f4bed65cb4c46ec89d08025cd6cd8e5f3 Reviewed-by: David Edmundson Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/plugins/platforms/wayland/qwaylandinputdevice.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index 0c4da6fef4a..ff2b22a613b 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -681,6 +681,10 @@ void QWaylandInputDevice::Pointer::pointer_enter(uint32_t serial, struct wl_surf mParent->mSerial = serial; mEnterSerial = serial; + if (!mParent->mQDisplay->lastInputDevice()) { + mParent->mQDisplay->setLastInputDevice(mParent, serial, window); + } + #if QT_CONFIG(cursor) // Depends on mEnterSerial being updated updateCursor(); From 4781e2a088b5bdbe705397994059153fa88b41d5 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Wed, 6 Nov 2024 17:07:30 +0100 Subject: [PATCH 1429/1507] MockCompositor: Protect against race condition The QList m_fractionalScales was being changed from both the main thread and the dispatch thread. This lead to read-after-free AddressSanitizer errors when running autotests. Using a DirectConnection makes sure that both appending and removal happens in the same thread. This does not fix a theoretical race condition in DefaultCompositor::fractionalScale(). Fixes: QTBUG-130627 Pick-to: 6.8 Change-Id: Ie73f80d08929bcfcbd9940acdb4f86233df013cb Reviewed-by: David Edmundson --- tests/auto/wayland/shared/fractionalscalev1.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/wayland/shared/fractionalscalev1.cpp b/tests/auto/wayland/shared/fractionalscalev1.cpp index 28c77802523..e2ad29897cc 100644 --- a/tests/auto/wayland/shared/fractionalscalev1.cpp +++ b/tests/auto/wayland/shared/fractionalscalev1.cpp @@ -16,7 +16,7 @@ void FractionalScaleManager::wp_fractional_scale_manager_v1_get_fractional_scale auto *scaler = new FractionalScale(s, resource->client(), id, resource->version()); connect(scaler, &QObject::destroyed, this, [this, scaler]() { m_fractionalScales.removeOne(scaler); - }); + }, Qt::DirectConnection); m_fractionalScales << scaler; } From 9fd572be56692d868941e4b59ff9e9e446e060c4 Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Thu, 1 Feb 2024 11:49:23 +0000 Subject: [PATCH 1430/1507] client: Announce platform support for WindowActivation QtWayland has had support for window activation for some time using the xdg-activation-v1 protocol. Activating applications requires some application intervention, but passing focus between windows should work as automatically as any other platform. The flag was still left unset as compositor support was lacking, but this it is now universally supported. Task-number: QTBUG-121732 Change-Id: I1f31bbf9c5c7cc371e058d2637a1ba2b2b411053 Reviewed-by: Paul Olav Tvete Reviewed-by: Liang Qi --- src/plugins/platforms/wayland/qwaylandintegration.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandintegration.cpp b/src/plugins/platforms/wayland/qwaylandintegration.cpp index d505f4844ff..d5da84c2434 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandintegration.cpp @@ -125,7 +125,7 @@ bool QWaylandIntegration::hasCapability(QPlatformIntegration::Capability cap) co case RasterGLSurface: return true; case WindowActivation: - return false; + return true; case ScreenWindowGrabbing: // whether QScreen::grabWindow() is supported return false; default: return QPlatformIntegration::hasCapability(cap); From 9aa5f633d4ec77c7f5ecea2254bcf398ef02bfb9 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Mon, 11 Nov 2024 09:53:00 +0100 Subject: [PATCH 1431/1507] MockCompositor: Fix potential race condition The list m_viewports is being accessed from both the main thread and the dispatch thread. This has not been observed to cause any errors, but is a potential source of test instability. Using a DirectConnection makes sure that both appending and removal happens in the same thread. Task-number: QTBUG-130627 Pick-to: 6.8 Change-Id: Iee6941d8794119e679a485778f0be5c40df27069 Reviewed-by: David Edmundson --- tests/auto/wayland/shared/viewport.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/wayland/shared/viewport.cpp b/tests/auto/wayland/shared/viewport.cpp index df6bbb336de..da00a5b6a0e 100644 --- a/tests/auto/wayland/shared/viewport.cpp +++ b/tests/auto/wayland/shared/viewport.cpp @@ -16,7 +16,7 @@ void Viewporter::wp_viewporter_get_viewport(Resource *resource, uint32_t id, wl_ auto *viewport = new Viewport(s, resource->client(), id, resource->version()); connect(viewport, &QObject::destroyed, this, [this, viewport]() { m_viewports.removeOne(viewport); - }); + }, Qt::DirectConnection); m_viewports << viewport; } From 2753bf6b6b1ed4c0b51bb257559f44d60a3a9497 Mon Sep 17 00:00:00 2001 From: David Redondo Date: Wed, 30 Oct 2024 16:57:55 +0100 Subject: [PATCH 1432/1507] Adapt window recreation to wl_surface as winId and lifetime changes Returning wl_surface as winId broke widget windows after reconnect. When fetching globals from the new connection new screens are added, this results in QWidget being notified of a screen change. It then refreshes its cached winId which at this point in time will be 0 since the window does not have a new window yet. Then when a widget repainting the backing store will never be flushed because it doesnt find a native parent anymore by going up the parent chain and looking for a widget with non-null winId. Fix this by recreating the wl_surface after fetching the globals but before the initital roundtrip. While at it dont recreate role objects for windows that dont need them. With the changes that also now hidden windows have wl_surfaces we would recreate them along with closed popups. Change-Id: Ib7ed27d1f25df84c85cce4802726178586c19d55 Reviewed-by: David Edmundson --- .../platforms/wayland/qwaylanddisplay.cpp | 27 ++++++++++++++----- .../platforms/wayland/qwaylandwindow.cpp | 1 - .../platforms/wayland/qwaylandwindow_p.h | 2 +- 3 files changed, 21 insertions(+), 9 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index dfdf88c0b4a..d585c194bd6 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -455,18 +455,21 @@ void QWaylandDisplay::reconnect() mActiveWindows.clear(); const auto windows = QGuiApplication::allWindows(); + QList allPlatformWindows; for (auto window : windows) { - if (auto waylandWindow = static_cast(window->handle())) + if (auto waylandWindow = static_cast(window->handle())) { waylandWindow->closeChildPopups(); + allPlatformWindows.push_back(waylandWindow); + } } + // Remove windows that do not need to be recreated and now closed popups QList recreateWindows; - for (auto window : std::as_const(windows)) { - auto waylandWindow = static_cast(window->handle()); - if (waylandWindow && waylandWindow->wlSurface()) { - waylandWindow->reset(); - recreateWindows.push_back(waylandWindow); + for (auto window : std::as_const(allPlatformWindows)) { + if (window->subSurfaceWindow() || window->shellSurface()) { + recreateWindows.push_back(window); } + window->reset(); } if (mSyncCallback) { @@ -480,6 +483,15 @@ void QWaylandDisplay::reconnect() if (!mDisplay) _exit(1); + connect( + this, &QWaylandDisplay::connected, this, + [&allPlatformWindows] { + for (auto &window : std::as_const(allPlatformWindows)) { + window->initializeWlSurface(); + } + }, + Qt::SingleShotConnection); + setupConnection(); initialize(); @@ -488,7 +500,8 @@ void QWaylandDisplay::reconnect() initEventThread(); auto needsRecreate = [](QPlatformWindow *window) { - return window && !static_cast(window)->wlSurface(); + auto waylandWindow = static_cast(window); + return waylandWindow && !waylandWindow->subSurfaceWindow() && !waylandWindow->shellSurface(); }; auto window = recreateWindows.begin(); while (!recreateWindows.isEmpty()) { diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index cb6c07f9799..6d4f11e8d83 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -1803,7 +1803,6 @@ void QWaylandWindow::closeChildPopups() { void QWaylandWindow::reinit() { - initializeWlSurface(); if (window()->isVisible()) { initWindow(); if (hasPendingUpdateRequest()) diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index e4ce2af700f..592125c6839 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -239,6 +239,7 @@ public: virtual void reinit(); void reset(); + void initializeWlSurface(); bool windowEvent(QEvent *event) override; @@ -340,7 +341,6 @@ protected: private: void setGeometry_helper(const QRect &rect); void initWindow(); - void initializeWlSurface(); bool shouldCreateShellSurface() const; bool shouldCreateSubSurface() const; void resetSurfaceRole(); From f19309cec51c7fe37de68d16e586c1907195a198 Mon Sep 17 00:00:00 2001 From: Tim Blechmann Date: Wed, 30 Oct 2024 10:42:34 +0800 Subject: [PATCH 1433/1507] client: fix deprecation warning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit use lcQpaInputDevices exported from QtGui Pick-to: 6.8 Change-Id: I8a5c47ce35abdc39fb38a026b870f137f14a7448 Reviewed-by: David Edmundson Reviewed-by: Ulf Hermann Reviewed-by: Tor Arne Vestbø Reviewed-by: Shawn Rutledge --- src/plugins/platforms/wayland/qwaylandtabletv2.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandtabletv2.cpp b/src/plugins/platforms/wayland/qwaylandtabletv2.cpp index b29319bc9d6..f2cdf76bafd 100644 --- a/src/plugins/platforms/wayland/qwaylandtabletv2.cpp +++ b/src/plugins/platforms/wayland/qwaylandtabletv2.cpp @@ -12,7 +12,8 @@ #include #include -#include +#include +#include #include @@ -22,7 +23,6 @@ namespace QtWaylandClient { using namespace Qt::StringLiterals; -Q_LOGGING_CATEGORY(lcQpaInputDevices, "qt.qpa.input.devices") Q_DECLARE_LOGGING_CATEGORY(lcQpaWaylandInput) #if QT_CONFIG(cursor) From b227eb4aa456c44f62ac89730621334d8c649a88 Mon Sep 17 00:00:00 2001 From: Tim Blechmann Date: Wed, 30 Oct 2024 17:34:22 +0800 Subject: [PATCH 1434/1507] Client: remove unused logging category lcQpaWaylandInput is unused in this file and can be removed. Pick-to: 6.8 Change-Id: If56a764b28837fc11b770a1b6739243e57641f68 Reviewed-by: Shawn Rutledge --- src/plugins/platforms/wayland/qwaylandtabletv2.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandtabletv2.cpp b/src/plugins/platforms/wayland/qwaylandtabletv2.cpp index f2cdf76bafd..ffd4abd5878 100644 --- a/src/plugins/platforms/wayland/qwaylandtabletv2.cpp +++ b/src/plugins/platforms/wayland/qwaylandtabletv2.cpp @@ -23,8 +23,6 @@ namespace QtWaylandClient { using namespace Qt::StringLiterals; -Q_DECLARE_LOGGING_CATEGORY(lcQpaWaylandInput) - #if QT_CONFIG(cursor) int QWaylandTabletToolV2::idealCursorScale() const { From 84853a6a7bbc5dcb3a3011f717cdbcd0c5156180 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucie=20G=C3=A9rard?= Date: Wed, 2 Oct 2024 13:44:54 +0200 Subject: [PATCH 1435/1507] Add REUSE.toml files and missing licenses REUSE.toml files are read by reuse to complement or override the copyright and licensing information found in file. The use of REUSE.toml files was introduced in REUSE version 3.1.0a1. This reuse version is compatible with reuse specification version 3.2 [1]. With this commit's files, * The SPDX document generated by reuse spdx conforms to SPDX 2.3, * The reuse lint command reports that the Qt project is reuse compliant. In order to be reuse compliant all the licenses referenced in file or within a REUSE.toml file must be present in the LICENSES directory at the base of the module. The missing licenses are added. [1]: https://reuse.software/spec-3.2/ Task-number: QTBUG-124453 Task-number: QTBUG-125211 Pick-to: 6.8 Change-Id: I902e4e92c8cbe194270de9ac8105adc28a381e88 Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/3rdparty/wayland/extensions/REUSE.toml | 8 +++++++ .../wayland/protocols/cursor-shape/REUSE.toml | 8 +++++++ .../protocols/fractional-scale/REUSE.toml | 7 ++++++ .../protocols/fullscreen-shell/REUSE.toml | 9 ++++++++ .../wayland/protocols/idle-inhibit/REUSE.toml | 7 ++++++ .../wayland/protocols/linux-dmabuf/REUSE.toml | 7 ++++++ .../protocols/pointer-gestures/REUSE.toml | 7 ++++++ .../protocols/presentation-time/REUSE.toml | 7 ++++++ .../wayland/protocols/scaler/REUSE.toml | 7 ++++++ .../wayland/protocols/tablet/REUSE.toml | 8 +++++++ .../protocols/text-input/v1/REUSE.toml | 7 ++++++ .../protocols/text-input/v2/REUSE.toml | 8 +++++++ .../protocols/text-input/v3/REUSE.toml | 10 +++++++++ .../wayland/protocols/viewporter/REUSE.toml | 7 ++++++ .../wayland/protocols/wayland/REUSE.toml | 9 ++++++++ .../wayland/protocols/wl-eglstream/REUSE.toml | 7 ++++++ .../protocols/wlr-data-control/REUSE.toml | 8 +++++++ .../protocols/wp-primary-selection/REUSE.toml | 7 ++++++ .../protocols/xdg-activation/REUSE.toml | 8 +++++++ .../protocols/xdg-decoration/REUSE.toml | 7 ++++++ .../wayland/protocols/xdg-dialog/REUSE.toml | 7 ++++++ .../wayland/protocols/xdg-foreign/REUSE.toml | 7 ++++++ .../wayland/protocols/xdg-output/REUSE.toml | 7 ++++++ .../wayland/protocols/xdg-shell/REUSE.toml | 22 +++++++++++++++++++ .../protocols/xdg-system-bell/REUSE.toml | 7 ++++++ .../protocols/xdg-toplevel-drag/REUSE.toml | 7 ++++++ .../protocols/xdg-toplevel-icon/REUSE.toml | 7 ++++++ 27 files changed, 217 insertions(+) create mode 100644 src/3rdparty/wayland/extensions/REUSE.toml create mode 100644 src/3rdparty/wayland/protocols/cursor-shape/REUSE.toml create mode 100644 src/3rdparty/wayland/protocols/fractional-scale/REUSE.toml create mode 100644 src/3rdparty/wayland/protocols/fullscreen-shell/REUSE.toml create mode 100644 src/3rdparty/wayland/protocols/idle-inhibit/REUSE.toml create mode 100644 src/3rdparty/wayland/protocols/linux-dmabuf/REUSE.toml create mode 100644 src/3rdparty/wayland/protocols/pointer-gestures/REUSE.toml create mode 100644 src/3rdparty/wayland/protocols/presentation-time/REUSE.toml create mode 100644 src/3rdparty/wayland/protocols/scaler/REUSE.toml create mode 100644 src/3rdparty/wayland/protocols/tablet/REUSE.toml create mode 100644 src/3rdparty/wayland/protocols/text-input/v1/REUSE.toml create mode 100644 src/3rdparty/wayland/protocols/text-input/v2/REUSE.toml create mode 100644 src/3rdparty/wayland/protocols/text-input/v3/REUSE.toml create mode 100644 src/3rdparty/wayland/protocols/viewporter/REUSE.toml create mode 100644 src/3rdparty/wayland/protocols/wayland/REUSE.toml create mode 100644 src/3rdparty/wayland/protocols/wl-eglstream/REUSE.toml create mode 100644 src/3rdparty/wayland/protocols/wlr-data-control/REUSE.toml create mode 100644 src/3rdparty/wayland/protocols/wp-primary-selection/REUSE.toml create mode 100644 src/3rdparty/wayland/protocols/xdg-activation/REUSE.toml create mode 100644 src/3rdparty/wayland/protocols/xdg-decoration/REUSE.toml create mode 100644 src/3rdparty/wayland/protocols/xdg-dialog/REUSE.toml create mode 100644 src/3rdparty/wayland/protocols/xdg-foreign/REUSE.toml create mode 100644 src/3rdparty/wayland/protocols/xdg-output/REUSE.toml create mode 100644 src/3rdparty/wayland/protocols/xdg-shell/REUSE.toml create mode 100644 src/3rdparty/wayland/protocols/xdg-system-bell/REUSE.toml create mode 100644 src/3rdparty/wayland/protocols/xdg-toplevel-drag/REUSE.toml create mode 100644 src/3rdparty/wayland/protocols/xdg-toplevel-icon/REUSE.toml diff --git a/src/3rdparty/wayland/extensions/REUSE.toml b/src/3rdparty/wayland/extensions/REUSE.toml new file mode 100644 index 00000000000..7debc4f4e09 --- /dev/null +++ b/src/3rdparty/wayland/extensions/REUSE.toml @@ -0,0 +1,8 @@ +version = 1 + +[[annotations]] +path = "qt-text-input-method-unstable-v1.xml" +precedence = "closest" +comment = "License is in full text in file. Should it be changed?" +SPDX-FileCopyrightText = "Copyright © 2020 The Qt Company Ltd." +SPDX-License-Identifier = "MIT" diff --git a/src/3rdparty/wayland/protocols/cursor-shape/REUSE.toml b/src/3rdparty/wayland/protocols/cursor-shape/REUSE.toml new file mode 100644 index 00000000000..2db8971fb00 --- /dev/null +++ b/src/3rdparty/wayland/protocols/cursor-shape/REUSE.toml @@ -0,0 +1,8 @@ +version = 1 + +[[annotations]] +path = "cursor-shape-v1.xml" +precedence = "closest" +SPDX-FileCopyrightText = ["Copyright 2018 The Chromium Authors", + "Copyright 2023 Simon Ser"] +SPDX-License-Identifier = "MIT" diff --git a/src/3rdparty/wayland/protocols/fractional-scale/REUSE.toml b/src/3rdparty/wayland/protocols/fractional-scale/REUSE.toml new file mode 100644 index 00000000000..6f03d8f64cd --- /dev/null +++ b/src/3rdparty/wayland/protocols/fractional-scale/REUSE.toml @@ -0,0 +1,7 @@ +version = 1 + +[[annotations]] +path = "fractional-scale-v1.xml" +precedence = "closest" +SPDX-FileCopyrightText = "Copyright 2022 Kenny Levinsen" +SPDX-License-Identifier = "MIT" \ No newline at end of file diff --git a/src/3rdparty/wayland/protocols/fullscreen-shell/REUSE.toml b/src/3rdparty/wayland/protocols/fullscreen-shell/REUSE.toml new file mode 100644 index 00000000000..7f939e45153 --- /dev/null +++ b/src/3rdparty/wayland/protocols/fullscreen-shell/REUSE.toml @@ -0,0 +1,9 @@ +version = 1 + +[[annotations]] +path = "fullscreen-shell-unstable-v1.xml" +precedence = "closest" +SPDX-FileCopyrightText = ["Copyright 2016 Yong Bakos", + "Copyright 2015 Jason Ekstrand", + "Copyright 2015 Jonas Ådahl"] +SPDX-License-Identifier = "MIT" diff --git a/src/3rdparty/wayland/protocols/idle-inhibit/REUSE.toml b/src/3rdparty/wayland/protocols/idle-inhibit/REUSE.toml new file mode 100644 index 00000000000..cfc112addff --- /dev/null +++ b/src/3rdparty/wayland/protocols/idle-inhibit/REUSE.toml @@ -0,0 +1,7 @@ +version = 1 + +[[annotations]] +path = "idle-inhibit-unstable-v1.xml" +precedence = "closest" +SPDX-FileCopyrightText = "Copyright 2015 Samsung Electronics Co., Ltd" +SPDX-License-Identifier = "MIT" diff --git a/src/3rdparty/wayland/protocols/linux-dmabuf/REUSE.toml b/src/3rdparty/wayland/protocols/linux-dmabuf/REUSE.toml new file mode 100644 index 00000000000..ca0cba7cd40 --- /dev/null +++ b/src/3rdparty/wayland/protocols/linux-dmabuf/REUSE.toml @@ -0,0 +1,7 @@ +version = 1 + +[[annotations]] +path = "linux-dmabuf-unstable-v1.xml" +precedence = "closest" +SPDX-FileCopyrightText = "Copyright 2014, 2015 Collabora, Ltd." +SPDX-License-Identifier = "MIT" \ No newline at end of file diff --git a/src/3rdparty/wayland/protocols/pointer-gestures/REUSE.toml b/src/3rdparty/wayland/protocols/pointer-gestures/REUSE.toml new file mode 100644 index 00000000000..9eaccd5ee8d --- /dev/null +++ b/src/3rdparty/wayland/protocols/pointer-gestures/REUSE.toml @@ -0,0 +1,7 @@ +version = 1 + +[[annotations]] +path = "pointer-gestures-unstable-v1.xml" +precedence = "closest" +SPDX-FileCopyrightText = "Copyright 2015, 2016 Red Hat" +SPDX-License-Identifier = "MIT" diff --git a/src/3rdparty/wayland/protocols/presentation-time/REUSE.toml b/src/3rdparty/wayland/protocols/presentation-time/REUSE.toml new file mode 100644 index 00000000000..a818443e1fa --- /dev/null +++ b/src/3rdparty/wayland/protocols/presentation-time/REUSE.toml @@ -0,0 +1,7 @@ +version = 1 + +[[annotations]] +path = "presentation-time.xml" +precedence = "closest" +SPDX-FileCopyrightText = "Copyright 2013, 2014 Collabora, Ltd." +SPDX-License-Identifier = "MIT" diff --git a/src/3rdparty/wayland/protocols/scaler/REUSE.toml b/src/3rdparty/wayland/protocols/scaler/REUSE.toml new file mode 100644 index 00000000000..3b85724eada --- /dev/null +++ b/src/3rdparty/wayland/protocols/scaler/REUSE.toml @@ -0,0 +1,7 @@ +version = 1 + +[[annotations]] +path = "scaler.xml" +precedence = "closest" +SPDX-FileCopyrightText = "Copyright 2013-2014 Collabora, Ltd." +SPDX-License-Identifier = "MIT" diff --git a/src/3rdparty/wayland/protocols/tablet/REUSE.toml b/src/3rdparty/wayland/protocols/tablet/REUSE.toml new file mode 100644 index 00000000000..76b350204df --- /dev/null +++ b/src/3rdparty/wayland/protocols/tablet/REUSE.toml @@ -0,0 +1,8 @@ +version = 1 + +[[annotations]] +path = "tablet-unstable-v2.xml" +precedence = "closest" +SPDX-FileCopyrightText = ["Copyright 2014 Stephen \"Lyude\" Chandler Paul", + "Copyright 2015-2016 Red Hat, Inc."] +SPDX-License-Identifier = "MIT" diff --git a/src/3rdparty/wayland/protocols/text-input/v1/REUSE.toml b/src/3rdparty/wayland/protocols/text-input/v1/REUSE.toml new file mode 100644 index 00000000000..cb531189ce9 --- /dev/null +++ b/src/3rdparty/wayland/protocols/text-input/v1/REUSE.toml @@ -0,0 +1,7 @@ +version = 1 + +[[annotations]] +path = "text-input-unstable-v1.xml" +precedence = "closest" +SPDX-FileCopyrightText = "Copyright 2012, 2013 Intel Corporation" +SPDX-License-Identifier = "MIT" \ No newline at end of file diff --git a/src/3rdparty/wayland/protocols/text-input/v2/REUSE.toml b/src/3rdparty/wayland/protocols/text-input/v2/REUSE.toml new file mode 100644 index 00000000000..3b826274165 --- /dev/null +++ b/src/3rdparty/wayland/protocols/text-input/v2/REUSE.toml @@ -0,0 +1,8 @@ +version = 1 + +[[annotations]] +path = "text-input-unstable-v2.xml" +precedence = "closest" +SPDX-FileCopyrightText = ["Copyright © 2012, 2013 Intel Corporation", + "Copyright © 2015, 2016 Jan Arne Petersen"] +SPDX-License-Identifier = "HPND" diff --git a/src/3rdparty/wayland/protocols/text-input/v3/REUSE.toml b/src/3rdparty/wayland/protocols/text-input/v3/REUSE.toml new file mode 100644 index 00000000000..3e243736483 --- /dev/null +++ b/src/3rdparty/wayland/protocols/text-input/v3/REUSE.toml @@ -0,0 +1,10 @@ +version = 1 + +[[annotations]] +path = "text-input-unstable-v3.xml" +precedence = "closest" +SPDX-FileCopyrightText = ["Copyright 2012, 2013 Intel Corporation", + "Copyright 2015, 2016 Jan Arne Petersen", + "Copyright 2017, 2018 Red Hat, Inc.", + "Copyright 2018 Purism SPC"] +SPDX-License-Identifier = "MIT" diff --git a/src/3rdparty/wayland/protocols/viewporter/REUSE.toml b/src/3rdparty/wayland/protocols/viewporter/REUSE.toml new file mode 100644 index 00000000000..692f7dcb045 --- /dev/null +++ b/src/3rdparty/wayland/protocols/viewporter/REUSE.toml @@ -0,0 +1,7 @@ +version = 1 + +[[annotations]] +path = "viewporter.xml" +precedence = "closest" +SPDX-FileCopyrightText = "Copyright 2013-2016 Collabora, Ltd." +SPDX-License-Identifier = "MIT" diff --git a/src/3rdparty/wayland/protocols/wayland/REUSE.toml b/src/3rdparty/wayland/protocols/wayland/REUSE.toml new file mode 100644 index 00000000000..c15f4e8275a --- /dev/null +++ b/src/3rdparty/wayland/protocols/wayland/REUSE.toml @@ -0,0 +1,9 @@ +version = 1 + +[[annotations]] +path = "wayland.xml" +precedence = "closest" +SPDX-FileCopyrightText = ["Copyright © 2008-2011 Kristian Høgsberg", + "Copyright © 2010-2011 Intel Corporation", + "Copyright © 2012-2013 Collabora, Ltd."] +SPDX-License-Identifier = "MIT" diff --git a/src/3rdparty/wayland/protocols/wl-eglstream/REUSE.toml b/src/3rdparty/wayland/protocols/wl-eglstream/REUSE.toml new file mode 100644 index 00000000000..2f1369425bf --- /dev/null +++ b/src/3rdparty/wayland/protocols/wl-eglstream/REUSE.toml @@ -0,0 +1,7 @@ +version = 1 + +[[annotations]] +path = "wl-eglstream-controller.xml" +precedence = "closest" +SPDX-FileCopyrightText = "Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved." +SPDX-License-Identifier = "MIT" diff --git a/src/3rdparty/wayland/protocols/wlr-data-control/REUSE.toml b/src/3rdparty/wayland/protocols/wlr-data-control/REUSE.toml new file mode 100644 index 00000000000..6ddacfa1486 --- /dev/null +++ b/src/3rdparty/wayland/protocols/wlr-data-control/REUSE.toml @@ -0,0 +1,8 @@ +version = 1 + +[[annotations]] +path = "wlr-data-control-unstable-v1.xml" +precedence = "closest" +SPDX-FileCopyrightText = ["Copyright (c) 2018 Simon Ser", + "Copyright (c) 2019 Ivan Molodetskikht"] +SPDX-License-Identifier = "MIT" diff --git a/src/3rdparty/wayland/protocols/wp-primary-selection/REUSE.toml b/src/3rdparty/wayland/protocols/wp-primary-selection/REUSE.toml new file mode 100644 index 00000000000..89a49187677 --- /dev/null +++ b/src/3rdparty/wayland/protocols/wp-primary-selection/REUSE.toml @@ -0,0 +1,7 @@ +version = 1 + +[[annotations]] +path = "wp-primary-selection-unstable-v1.xml" +precedence = "closest" +SPDX-FileCopyrightText = "Copyright 2015, 2016 Red Hat" +SPDX-License-Identifier = "MIT" diff --git a/src/3rdparty/wayland/protocols/xdg-activation/REUSE.toml b/src/3rdparty/wayland/protocols/xdg-activation/REUSE.toml new file mode 100644 index 00000000000..b076dabb7a9 --- /dev/null +++ b/src/3rdparty/wayland/protocols/xdg-activation/REUSE.toml @@ -0,0 +1,8 @@ +version = 1 + +[[annotations]] +path = "xdg-activation-v1.xml" +precedence = "closest" +SPDX-FileCopyrightText = ["Copyright 2020 Aleix Pol Gonzalez", + "Copyright 2020 Carlos Garnacho"] +SPDX-License-Identifier = "MIT" diff --git a/src/3rdparty/wayland/protocols/xdg-decoration/REUSE.toml b/src/3rdparty/wayland/protocols/xdg-decoration/REUSE.toml new file mode 100644 index 00000000000..ecae188cbd7 --- /dev/null +++ b/src/3rdparty/wayland/protocols/xdg-decoration/REUSE.toml @@ -0,0 +1,7 @@ +version = 1 + +[[annotations]] +path = "xdg-decoration-unstable-v1.xml" +precedence = "closest" +SPDX-FileCopyrightText = "Copyright 2018 Simon Ser" +SPDX-License-Identifier = "MIT" diff --git a/src/3rdparty/wayland/protocols/xdg-dialog/REUSE.toml b/src/3rdparty/wayland/protocols/xdg-dialog/REUSE.toml new file mode 100644 index 00000000000..deb7bea6c9d --- /dev/null +++ b/src/3rdparty/wayland/protocols/xdg-dialog/REUSE.toml @@ -0,0 +1,7 @@ +version = 1 + +[[annotations]] +path = "xdg-dialog-v1.xml" +precedence = "closest" +SPDX-FileCopyrightText = "Copyright 2023 Carlos Garnacho" +SPDX-License-Identifier = "MIT" diff --git a/src/3rdparty/wayland/protocols/xdg-foreign/REUSE.toml b/src/3rdparty/wayland/protocols/xdg-foreign/REUSE.toml new file mode 100644 index 00000000000..d5b24d88137 --- /dev/null +++ b/src/3rdparty/wayland/protocols/xdg-foreign/REUSE.toml @@ -0,0 +1,7 @@ +version = 1 + +[[annotations]] +path = "xdg-foreign-unstable-v2.xml" +precedence = "closest" +SPDX-FileCopyrightText = "Copyright 2015-2016 Red Hat Inc." +SPDX-License-Identifier = "MIT" diff --git a/src/3rdparty/wayland/protocols/xdg-output/REUSE.toml b/src/3rdparty/wayland/protocols/xdg-output/REUSE.toml new file mode 100644 index 00000000000..3c42c4aeb09 --- /dev/null +++ b/src/3rdparty/wayland/protocols/xdg-output/REUSE.toml @@ -0,0 +1,7 @@ +version = 1 + +[[annotations]] +path = "xdg-output-unstable-v1.xml" +precedence = "closest" +SPDX-FileCopyrightText = "Copyright 2017 Red Hat Inc." +SPDX-License-Identifier = "MIT" diff --git a/src/3rdparty/wayland/protocols/xdg-shell/REUSE.toml b/src/3rdparty/wayland/protocols/xdg-shell/REUSE.toml new file mode 100644 index 00000000000..f0e5dde4ebe --- /dev/null +++ b/src/3rdparty/wayland/protocols/xdg-shell/REUSE.toml @@ -0,0 +1,22 @@ +version = 1 + +[[annotations]] +path = "xdg-shell.xml" +precedence = "closest" +SPDX-FileCopyrightText = ["Copyright 2008-2013 Kristian Høgsberg", + "Copyright 2013 Rafael Antognolli", + "Copyright 2013 Jasper St. Pierre", + "Copyright 2010-2013 Intel Corporation", + "Copyright 2015-2017 Samsung Electronics Co., Ltd", + "Copyright 2015-2017 Red Hat Inc."] +SPDX-License-Identifier = "MIT" + +[[annotations]] +path = "xdg-shell-unstable-v6.xml" +precedence = "closest" +comment = "missing from qt_atttribution.json" +SPDX-FileCopyrightText = ["Copyright © 2008-2013 Kristian Høgsberg", + "Copyright © 2013 Rafael Antognolli", + "Copyright © 2013 Jasper St. Pierre", + "Copyright © 2010-2013 Intel Corporation"] +SPDX-License-Identifier = "MIT" diff --git a/src/3rdparty/wayland/protocols/xdg-system-bell/REUSE.toml b/src/3rdparty/wayland/protocols/xdg-system-bell/REUSE.toml new file mode 100644 index 00000000000..c8b780621ef --- /dev/null +++ b/src/3rdparty/wayland/protocols/xdg-system-bell/REUSE.toml @@ -0,0 +1,7 @@ +version = 1 + +[[annotations]] +path = ["xdg-system-bell-v1.xml"] +precedence = "closest" +SPDX-FileCopyrightText = "Copyright (C) 2016, 2023 Red Hat" +SPDX-License-Identifier = "MIT" diff --git a/src/3rdparty/wayland/protocols/xdg-toplevel-drag/REUSE.toml b/src/3rdparty/wayland/protocols/xdg-toplevel-drag/REUSE.toml new file mode 100644 index 00000000000..9bc6663ae58 --- /dev/null +++ b/src/3rdparty/wayland/protocols/xdg-toplevel-drag/REUSE.toml @@ -0,0 +1,7 @@ +version = 1 + +[[annotations]] +path = "xdg-toplevel-drag-v1.xml" +precedence = "closest" +SPDX-FileCopyrightText = "Copyright 2023 David Redondo" +SPDX-License-Identifier = "MIT" diff --git a/src/3rdparty/wayland/protocols/xdg-toplevel-icon/REUSE.toml b/src/3rdparty/wayland/protocols/xdg-toplevel-icon/REUSE.toml new file mode 100644 index 00000000000..982f28763a7 --- /dev/null +++ b/src/3rdparty/wayland/protocols/xdg-toplevel-icon/REUSE.toml @@ -0,0 +1,7 @@ +version = 1 + +[[annotations]] +path = "xdg-toplevel-icon-v1.xml" +precedence = "closest" +SPDX-FileCopyrightText = "Copyright (C) 2024 Matthias Klumpp 2024 David Edmundson" +SPDX-License-Identifier = "MIT" From bd2371fc59c4a55c53b9435ef296748437d5e015 Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Thu, 14 Nov 2024 12:46:06 +0000 Subject: [PATCH 1436/1507] client: Avoid additional translations copying backing store contents MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The current code uses QPainter to copy damaged contents into the new back buffer. QPainter operates in logical pixels taking into account the devicePixelRatio transparently. The current code tries to undo this with another translation on top to work in device pixels. With floating point numbers there's a tiny amount of inprecision, each translation adds a tiny amount of error. The end result is pixels can get missed. Making QPainter calls in logical pixels gives us the exact path as the main rendering. Pick-to: 6.8 Change-Id: I2f6bd8a69a7273f21055248973e14e14066b1c67 Reviewed-by: Tor Arne Vestbø Reviewed-by: Vlad Zahorodnii --- src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp b/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp index 2ef33bc2777..7b6bb4c0890 100644 --- a/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp +++ b/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp @@ -313,17 +313,11 @@ bool QWaylandShmBackingStore::recreateBackBufferIfNeeded() QPainter painter(targetImage); painter.setCompositionMode(QPainter::CompositionMode_Source); - // Let painter operate in device pixels, to make it easier to compare coordinates const qreal sourceDevicePixelRatio = sourceImage->devicePixelRatio(); - const qreal targetDevicePixelRatio = painter.device()->devicePixelRatio(); - painter.scale(1.0 / targetDevicePixelRatio, 1.0 / targetDevicePixelRatio); - for (const QRect &rect : buffer->dirtyRegion()) { QRectF sourceRect(QPointF(rect.topLeft()) * sourceDevicePixelRatio, QSizeF(rect.size()) * sourceDevicePixelRatio); - QRectF targetRect(QPointF(rect.topLeft()) * targetDevicePixelRatio, - QSizeF(rect.size()) * targetDevicePixelRatio); - painter.drawImage(targetRect, *sourceImage, sourceRect); + painter.drawImage(rect, *sourceImage, sourceRect); } } From fbefe0eea3bfd36ef46ff4b1e30ab7c4de824322 Mon Sep 17 00:00:00 2001 From: Kai Uwe Broulik Date: Tue, 19 Nov 2024 09:39:25 +0100 Subject: [PATCH 1437/1507] client: Soften wording on fake screen message Don't admit that our software might be crashy. Pick-to: 6.8 Change-Id: I8b216478e2f214af64ae97ec149ebda751a8894f Reviewed-by: David Redondo --- src/plugins/platforms/wayland/qwaylanddisplay.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index d585c194bd6..105877dcfe7 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -410,7 +410,7 @@ void QWaylandDisplay::ensureScreen() if (!mScreens.empty() || mPlaceholderScreen) return; // There are real screens or we already have a fake one - qCInfo(lcQpaWayland) << "Creating a fake screen in order for Qt not to crash"; + qCInfo(lcQpaWayland) << "There are no outputs - creating placeholder screen"; mPlaceholderScreen = new QPlatformPlaceholderScreen(); QWindowSystemInterface::handleScreenAdded(mPlaceholderScreen); From fef73b9baa50a5d83289c0adabbdd769950c12c4 Mon Sep 17 00:00:00 2001 From: David Redondo Date: Fri, 22 Nov 2024 10:56:41 +0100 Subject: [PATCH 1438/1507] client: Redo management of tablet object proxies Since bb151390240c1f20a6464adbefa497f3559554dd tools and pads can sometimes be parented to tablets. When a tablet is unplugged sometimes the remove event for the tablet can be sent before the remove events for the pad. Deleting the tablet will also delete the pad but not the pad proxy, resulting in a crash when the pad remove event is received. This moves destruction of the wayland proxies which makes everything much simpler as not every location that deletes those objects needs to call destroy and fixes the described problem. Pick-to: 6.8 Change-Id: I0aaeda3d3996251e411229b5e97aa1ce0bce43ac Reviewed-by: David Edmundson --- .../platforms/wayland/qwaylandtabletv2.cpp | 24 ++++---- .../platforms/wayland/qwaylandtabletv2_p.h | 4 +- tests/auto/wayland/tabletv2/tst_tabletv2.cpp | 60 +++++++++++++++---- 3 files changed, 67 insertions(+), 21 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandtabletv2.cpp b/src/plugins/platforms/wayland/qwaylandtabletv2.cpp index ffd4abd5878..cca00ca7d35 100644 --- a/src/plugins/platforms/wayland/qwaylandtabletv2.cpp +++ b/src/plugins/platforms/wayland/qwaylandtabletv2.cpp @@ -185,12 +185,6 @@ QWaylandTabletSeatV2::QWaylandTabletSeatV2(QWaylandTabletManagerV2 *manager, QWa QWaylandTabletSeatV2::~QWaylandTabletSeatV2() { - for (auto *tablet : m_tablets) - tablet->destroy(); - for (auto *tool : m_tools) - tool->destroy(); - for (auto *pad : m_pads) - pad->destroy(); qDeleteAll(m_tablets); qDeleteAll(m_tools); qDeleteAll(m_deadTools); @@ -252,6 +246,11 @@ QWaylandTabletV2::QWaylandTabletV2(::zwp_tablet_v2 *tablet, const QString &seatN d->seatName = seatName; } +QWaylandTabletV2::~QWaylandTabletV2() +{ + destroy(); +} + void QWaylandTabletV2::zwp_tablet_v2_name(const QString &name) { QPointingDevicePrivate *d = QPointingDevicePrivate::get(this); @@ -290,7 +289,6 @@ void QWaylandTabletSeatV2::toolRemoved(QWaylandTabletToolV2 *tool) void QWaylandTabletV2::zwp_tablet_v2_removed() { - destroy(); deleteLater(); } @@ -314,7 +312,10 @@ QWaylandTabletToolV2::QWaylandTabletToolV2(QWaylandTabletSeatV2 *tabletSeat, ::z #endif } -QWaylandTabletToolV2::~QWaylandTabletToolV2() = default; +QWaylandTabletToolV2::~QWaylandTabletToolV2() +{ + destroy(); +} void QWaylandTabletToolV2::zwp_tablet_tool_v2_type(uint32_t tool_type) { @@ -408,7 +409,6 @@ void QWaylandTabletToolV2::zwp_tablet_tool_v2_done() void QWaylandTabletToolV2::zwp_tablet_tool_v2_removed() { - destroy(); m_tabletSeat->toolRemoved(this); } @@ -598,6 +598,11 @@ QWaylandTabletPadV2::QWaylandTabletPadV2(::zwp_tablet_pad_v2 *pad) { } +QWaylandTabletPadV2::~QWaylandTabletPadV2() +{ + destroy(); +} + void QWaylandTabletPadV2::zwp_tablet_pad_v2_path(const QString &path) { QPointingDevicePrivate *d = QPointingDevicePrivate::get(this); @@ -617,7 +622,6 @@ void QWaylandTabletPadV2::zwp_tablet_pad_v2_done() void QWaylandTabletPadV2::zwp_tablet_pad_v2_removed() { - destroy(); delete this; } diff --git a/src/plugins/platforms/wayland/qwaylandtabletv2_p.h b/src/plugins/platforms/wayland/qwaylandtabletv2_p.h index 94b687ee3ea..f0d7cd189bb 100644 --- a/src/plugins/platforms/wayland/qwaylandtabletv2_p.h +++ b/src/plugins/platforms/wayland/qwaylandtabletv2_p.h @@ -83,6 +83,7 @@ class Q_WAYLANDCLIENT_EXPORT QWaylandTabletV2 : public QPointingDevice, public Q Q_OBJECT public: explicit QWaylandTabletV2(::zwp_tablet_v2 *tablet, const QString &seatName); + ~QWaylandTabletV2(); protected: // callbacks which act as setters @@ -98,7 +99,7 @@ class Q_WAYLANDCLIENT_EXPORT QWaylandTabletToolV2 : public QPointingDevice, publ Q_OBJECT public: QWaylandTabletToolV2(QWaylandTabletSeatV2 *tabletSeat, ::zwp_tablet_tool_v2 *tool); - ~QWaylandTabletToolV2() override; + ~QWaylandTabletToolV2(); void updateCursor(); @@ -181,6 +182,7 @@ class Q_WAYLANDCLIENT_EXPORT QWaylandTabletPadV2 : public QPointingDevice, publi Q_OBJECT public: explicit QWaylandTabletPadV2(::zwp_tablet_pad_v2 *pad); + ~QWaylandTabletPadV2(); protected: // void zwp_tablet_pad_v2_group(struct ::zwp_tablet_pad_group_v2 *pad_group) override; diff --git a/tests/auto/wayland/tabletv2/tst_tabletv2.cpp b/tests/auto/wayland/tabletv2/tst_tabletv2.cpp index 85df099f90c..d5c2ccb3665 100644 --- a/tests/auto/wayland/tabletv2/tst_tabletv2.cpp +++ b/tests/auto/wayland/tabletv2/tst_tabletv2.cpp @@ -186,9 +186,9 @@ public: QList m_tablets; QList m_tabletsWaitingForDestroy; QList m_tools; - QList m_toolsWaitingForDestroy; + QList m_toolsWaitingForDestroy; QList m_pads; - QList m_padsWaitingForDestroy; + QList m_padsWaitingForDestroy; protected: void zwp_tablet_seat_v2_bind_resource(Resource *resource) override @@ -274,11 +274,12 @@ void TabletV2::zwp_tablet_v2_destroy(QtWaylandServer::zwp_tablet_v2::Resource *r void TabletToolV2::sendRemoved() { - for (auto *resource : resourceMap()) + for (auto *resource : resourceMap()) { zwp_tablet_tool_v2_send_removed(resource->handle); + m_tabletSeat->m_toolsWaitingForDestroy.append(resource); + } bool removed = m_tabletSeat->m_tools.removeOne(this); QVERIFY(removed); - m_tabletSeat->m_toolsWaitingForDestroy.append(this); } uint TabletToolV2::sendProximityIn(TabletV2 *tablet, Surface *surface) @@ -333,26 +334,25 @@ uint TabletToolV2::sendFrame() void TabletToolV2::zwp_tablet_tool_v2_destroy(QtWaylandServer::zwp_tablet_tool_v2::Resource *resource) { if (m_tabletSeat) { - bool removed = m_tabletSeat->m_toolsWaitingForDestroy.removeOne(this); - QVERIFY(removed); + m_tabletSeat->m_toolsWaitingForDestroy.removeOne(resource); } wl_resource_destroy(resource->handle); } void TabletPadV2::sendRemoved() { - for (auto *resource : resourceMap()) + for (auto *resource : resourceMap()) { zwp_tablet_pad_v2_send_removed(resource->handle); + m_tabletSeat->m_padsWaitingForDestroy.append(resource); + } bool removed = m_tabletSeat->m_pads.removeOne(this); QVERIFY(removed); - m_tabletSeat->m_padsWaitingForDestroy.append(this); } void TabletPadV2::zwp_tablet_pad_v2_destroy(QtWaylandServer::zwp_tablet_pad_v2::Resource *resource) { if (m_tabletSeat) { - bool removed = m_tabletSeat->m_padsWaitingForDestroy.removeOne(this); - QVERIFY(removed); + m_tabletSeat->m_padsWaitingForDestroy.removeOne(resource); } wl_resource_destroy(resource->handle); } @@ -405,6 +405,8 @@ private slots: void destroysTablet(); void destroysTool(); void destroysPad(); + void removeTabletBeforeTool(); + void removeTabletBeforePad(); void proximityEvents(); void moveEvent(); void pointerType_data(); @@ -502,12 +504,14 @@ void tst_tabletv2::destroysTool() { QCOMPOSITOR_TRY_VERIFY(tabletSeat()); exec([&] { + tabletSeat()->addTablet(); tabletSeat()->addTool(); }); QCOMPOSITOR_TRY_VERIFY(tabletTool()); exec([&] { tabletTool()->sendRemoved(); + tablet()->sendRemoved(); }); QCOMPOSITOR_TRY_VERIFY(!tabletTool()); @@ -530,6 +534,42 @@ void tst_tabletv2::destroysPad() QCOMPOSITOR_TRY_VERIFY(tabletSeat()->m_padsWaitingForDestroy.empty()); } +void tst_tabletv2::removeTabletBeforeTool() +{ + QCOMPOSITOR_TRY_VERIFY(tabletSeat()); + exec([&] { + tabletSeat()->addTablet(); + tabletSeat()->addTool(); + }); + QCOMPOSITOR_TRY_VERIFY(tablet()); + QCOMPOSITOR_TRY_VERIFY(tabletTool()); + + exec([&] { tablet()->sendRemoved(); }); + QCOMPOSITOR_TRY_VERIFY(tabletSeat()->m_tabletsWaitingForDestroy.empty()); + + exec([&] { tabletTool()->sendRemoved(); }); + QCOMPOSITOR_TRY_VERIFY(!tabletTool()); + QCOMPOSITOR_TRY_VERIFY(tabletSeat()->m_toolsWaitingForDestroy.empty()); +} + +void tst_tabletv2::removeTabletBeforePad() +{ + QCOMPOSITOR_TRY_VERIFY(tabletSeat()); + exec([&] { + tabletSeat()->addTablet(); + tabletSeat()->addPad(); + }); + QCOMPOSITOR_TRY_VERIFY(tablet()); + QCOMPOSITOR_TRY_VERIFY(tabletPad()); + + exec([&] { tablet()->sendRemoved(); }); + QCOMPOSITOR_TRY_VERIFY(tabletSeat()->m_tabletsWaitingForDestroy.empty()); + + exec([&] { tabletPad()->sendRemoved(); }); + QCOMPOSITOR_TRY_VERIFY(!tabletPad()); + QCOMPOSITOR_TRY_VERIFY(tabletSeat()->m_padsWaitingForDestroy.empty()); +} + void tst_tabletv2::proximityEvents() { ProximityFilter filter; From 34b61953851b680714d775c3ae278a44eccbaa86 Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Wed, 18 Sep 2024 14:19:16 +0100 Subject: [PATCH 1439/1507] Client: Implement frame-perfect resizing With synchronous delivery we can be sure that any exposeEvent blocks until the frame is rendered and committed. This patch introduces a new override to make the render thread back off starting a new frame when a resize is pending. If a configure event is received we do not need the render thread to dispatch a new frame as the main thread will do so explicitly when the configure event has been processed. To handle the case of a frame already being in flight at the time of the main thread processing a configure event, this patch submits a new exposeEvent with the old geometry. This will block until any existing frames are fully submitted and the new exposeEvent is handled. Together with the allowsIndependentThreadedRendering hook we can ensure that no frame of the old size are going to be committed after we finish processing and acking the incoming configure request. Change-Id: Ic8ec9803800b17d2b8419da1a93e8dc388e702ab Reviewed-by: Vlad Zahorodnii --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 14 ++++++++++++++ src/plugins/platforms/wayland/qwaylandwindow_p.h | 9 ++++++++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 6d4f11e8d83..c266b49bae5 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -276,11 +276,13 @@ bool QWaylandWindow::shouldCreateSubSurface() const void QWaylandWindow::beginFrame() { mSurfaceLock.lockForRead(); + mInFrameRender = true; } void QWaylandWindow::endFrame() { mSurfaceLock.unlock(); + mInFrameRender = false; } void QWaylandWindow::reset() @@ -335,6 +337,7 @@ void QWaylandWindow::resetSurfaceRole() killTimer(mFrameCallbackCheckIntervalTimerId); mFrameCallbackCheckIntervalTimerId = -1; } + mInFrameRender = false; mFrameCallbackTimedOut = false; mWaitingToApplyConfigure = false; mExposed = false; @@ -659,6 +662,12 @@ void QWaylandWindow::applyConfigure() Q_ASSERT_X(QThread::currentThreadId() == QThreadData::get2(thread())->threadId.loadRelaxed(), "QWaylandWindow::applyConfigure", "not called from main thread"); + // If we're mid paint, use an exposeEvent to flush the current frame. + // When this completes we know that no other frames will be rendering. + // This could be improved in future as we 're blocking for not just the frame to finish but one additional extra frame. + if (mInFrameRender) + QWindowSystemInterface::handleExposeEvent(window(), QRect(QPoint(0, 0), geometry().size())); + Q_ASSERT(!mInFrameRender); if (mShellSurface) mShellSurface->applyConfigure(); @@ -722,6 +731,11 @@ void QWaylandWindow::safeCommit(QWaylandBuffer *buffer, const QRegion &damage) } } +bool QWaylandWindow::allowsIndependentThreadedRendering() const +{ + return !mWaitingToApplyConfigure; +} + void QWaylandWindow::commit(QWaylandBuffer *buffer, const QRegion &damage) { Q_ASSERT(isExposed()); diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index 592125c6839..a1ac7a2d08c 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -100,6 +100,9 @@ public: void setWindowIcon(const QIcon &icon) override; void setGeometry(const QRect &rect) override; + + bool allowsIndependentThreadedRendering() const override; + void resizeFromApplyConfigure(const QSize &sizeWithMargins, const QPoint &offset = {0, 0}); void repositionFromApplyConfigure(const QPoint &position); void setGeometryFromApplyConfigure(const QPoint &globalPosition, const QSize &sizeWithMargins); @@ -307,7 +310,11 @@ protected: bool mWaitingForUpdate = false; bool mExposed = false; - bool mWaitingToApplyConfigure = false; + // written from the main thread, read by the render thread + std::atomic_bool mWaitingToApplyConfigure = false; + // written from the render thread, read by the main thread + std::atomic_bool mInFrameRender = false; + int mFrameCallbackTimeout = 100; QVariantMap m_properties; From 936260bbb9d4ee4deb3e34160634ca8b68e52496 Mon Sep 17 00:00:00 2001 From: Kai Uwe Broulik Date: Mon, 13 Nov 2023 17:34:52 +0100 Subject: [PATCH 1440/1507] QWaylandMimeData: Return converted MIME types in formats(), too This brings it in line with QXcbDropData where formats_sys() returns the format from mimeAtomToString (which contains the special-case for text/x-moz-url). Furthermore, in hasFormat_sys() just check formats() to avoid yet another place where a special-case is added, again in line with QXcbDropData. Pick-to: 6.8 Change-Id: Ia2b7c149b35110ff9dd8deed94c3378afb047ac1 Reviewed-by: David Edmundson --- .../platforms/wayland/qwaylanddataoffer.cpp | 37 +++++++++++++------ .../tst_primaryselectionv1.cpp | 2 +- 2 files changed, 26 insertions(+), 13 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylanddataoffer.cpp b/src/plugins/platforms/wayland/qwaylanddataoffer.cpp index 8110ce35fea..e15a5efdc34 100644 --- a/src/plugins/platforms/wayland/qwaylanddataoffer.cpp +++ b/src/plugins/platforms/wayland/qwaylanddataoffer.cpp @@ -17,6 +17,11 @@ QT_BEGIN_NAMESPACE namespace QtWaylandClient { +static QString plainText() +{ + return QStringLiteral("text/plain"); +} + static QString utf8Text() { return QStringLiteral("text/plain;charset=utf-8"); @@ -163,21 +168,29 @@ void QWaylandMimeData::appendFormat(const QString &mimeType) bool QWaylandMimeData::hasFormat_sys(const QString &mimeType) const { - if (m_types.contains(mimeType)) - return true; - - if (mimeType == QStringLiteral("text/plain") && m_types.contains(utf8Text())) - return true; - - if (mimeType == uriList() && m_types.contains(mozUrl())) - return true; - - return false; + return formats().contains(mimeType); } QStringList QWaylandMimeData::formats_sys() const { - return m_types; + QStringList types; + types.reserve(m_types.size()); + + for (const QString &type : m_types) { + QString mime = type; + + if (mime == utf8Text()) { + mime = plainText(); + } else if (mime == mozUrl()) { + mime = uriList(); + } + + if (!types.contains(mime)) { + types << mime; + } + } + + return types; } QVariant QWaylandMimeData::retrieveData_sys(const QString &mimeType, QMetaType type) const @@ -191,7 +204,7 @@ QVariant QWaylandMimeData::retrieveData_sys(const QString &mimeType, QMetaType t QString mime = mimeType; if (!m_types.contains(mimeType)) { - if (mimeType == QStringLiteral("text/plain") && m_types.contains(utf8Text())) + if (mimeType == plainText() && m_types.contains(utf8Text())) mime = utf8Text(); else if (mimeType == uriList() && m_types.contains(mozUrl())) mime = mozUrl(); diff --git a/tests/auto/wayland/primaryselectionv1/tst_primaryselectionv1.cpp b/tests/auto/wayland/primaryselectionv1/tst_primaryselectionv1.cpp index 53a048a3553..d23aed7b85c 100644 --- a/tests/auto/wayland/primaryselectionv1/tst_primaryselectionv1.cpp +++ b/tests/auto/wayland/primaryselectionv1/tst_primaryselectionv1.cpp @@ -352,7 +352,7 @@ void tst_primaryselectionv1::pasteUtf8() pointer()->sendButton(client(), BTN_MIDDLE, 0); pointer()->sendFrame(client()); }); - QTRY_COMPARE(window.m_formats, QStringList({"text/plain", "text/plain;charset=utf-8"})); + QTRY_COMPARE(window.m_formats, QStringList({"text/plain"})); QTRY_COMPARE(window.m_text, "face with tears of joy: 😂"); } From 6d3f6d3ae537acdf5d4c49a05aff08b2ca1fe27e Mon Sep 17 00:00:00 2001 From: Jie Liu Date: Fri, 29 Nov 2024 11:25:33 +0800 Subject: [PATCH 1441/1507] datacontrolv1: reset offer if receive null selection Change-Id: Ifc88b5cb54299df9177afe6ed9bcaa46b1fe21fb Reviewed-by: David Edmundson --- .../platforms/wayland/qwaylanddatacontrolv1.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylanddatacontrolv1.cpp b/src/plugins/platforms/wayland/qwaylanddatacontrolv1.cpp index 6d2b60b2db8..1d3a8e33898 100644 --- a/src/plugins/platforms/wayland/qwaylanddatacontrolv1.cpp +++ b/src/plugins/platforms/wayland/qwaylanddatacontrolv1.cpp @@ -96,8 +96,9 @@ void QWaylandDataControlDeviceV1::zwlr_data_control_device_v1_data_offer(zwlr_da void QWaylandDataControlDeviceV1::zwlr_data_control_device_v1_selection(zwlr_data_control_offer_v1 *id) { if (!id) - return; - m_selectionOffer.reset(static_cast(zwlr_data_control_offer_v1_get_user_data(id))); + m_selectionOffer.reset(); + else + m_selectionOffer.reset(static_cast(zwlr_data_control_offer_v1_get_user_data(id))); // The selection event may be sent before platfrmIntegration is set. if (auto* integration = QGuiApplicationPrivate::platformIntegration()) @@ -114,8 +115,9 @@ void QWaylandDataControlDeviceV1::zwlr_data_control_device_v1_finished() void QWaylandDataControlDeviceV1::zwlr_data_control_device_v1_primary_selection(struct ::zwlr_data_control_offer_v1 *id) { if (!id) - return; - m_primarySelectionOffer.reset(static_cast(zwlr_data_control_offer_v1_get_user_data(id))); + m_primarySelectionOffer.reset(); + else + m_primarySelectionOffer.reset(static_cast(zwlr_data_control_offer_v1_get_user_data(id))); // The selection event may be sent before platfrmIntegration is set. if (auto* integration = QGuiApplicationPrivate::platformIntegration()) From 0a8fe091f78bddb8e986953ee87fc2626f45e751 Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Wed, 4 Dec 2024 10:16:27 +0100 Subject: [PATCH 1442/1507] Client: Always trigger a commit in flush There are a few paths in wayland that require the client to always commit to apply changes or ack requests. We need this synchronized with any rendering so it is normally triggered with an expose or update event relying that this will always commit at the end. There is a path in QWidget code where if the window is not damaged we never call backingStore->beginPaint. If this doesn't happen we don't swap the front buffer, and the expose event will no-op. We want to avoid attaching in this case, but we should commit without attaching regardless to flush these events. This fixes an issue where Qt could fail to ack configure events which don't trigger updates. Pick-to: 6.8 Change-Id: Iaa606b0bf9fbbaefd3e67444cc768f95076967fe Reviewed-by: Vlad Zahorodnii --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index c266b49bae5..393f33cfd47 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -740,7 +740,8 @@ void QWaylandWindow::commit(QWaylandBuffer *buffer, const QRegion &damage) { Q_ASSERT(isExposed()); if (buffer->committed()) { - qCDebug(lcWaylandBackingstore) << "Buffer already committed, ignoring."; + mSurface->commit(); + qCDebug(lcWaylandBackingstore) << "Buffer already committed, not attaching."; return; } From 446c613fa79335a904fce9125d195d6308e2dfb5 Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Fri, 29 Nov 2024 15:15:27 +0000 Subject: [PATCH 1443/1507] Client: advertise utf-8 text formats when creating drags Some clients ignore text/plain only look for utf-8 text to be sent. When creating a clipboard source we advertise both, but this step was previously not copied for drag handling. Pick-to: 6.9 Change-Id: Ibe1476c309e88d6499ae0e6cb96a96aa07b4af71 Reviewed-by: David Edmundson --- src/plugins/platforms/wayland/qwaylanddatadevice.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/plugins/platforms/wayland/qwaylanddatadevice.cpp b/src/plugins/platforms/wayland/qwaylanddatadevice.cpp index 7de41da584e..4505a487bc4 100644 --- a/src/plugins/platforms/wayland/qwaylanddatadevice.cpp +++ b/src/plugins/platforms/wayland/qwaylanddatadevice.cpp @@ -98,6 +98,12 @@ bool QWaylandDataDevice::startDrag(QMimeData *mimeData, Qt::DropActions supporte if (mimeData->formats().isEmpty()) mimeData->setData("application/x-qt-avoid-empty-placeholder"_L1, QByteArray("1")); + static const QString plain = QStringLiteral("text/plain"); + static const QString utf8 = QStringLiteral("text/plain;charset=utf-8"); + + if (mimeData->hasFormat(plain) && !mimeData->hasFormat(utf8)) + mimeData->setData(utf8, mimeData->data(plain)); + m_dragSource.reset(new QWaylandDataSource(m_display->dndSelectionHandler(), mimeData)); if (version() >= 3) From c1c10fca776c65f4e96b69bdb6e13aa76a1c91b1 Mon Sep 17 00:00:00 2001 From: Inho Lee Date: Mon, 9 Dec 2024 12:13:56 +0100 Subject: [PATCH 1444/1507] textinputv3: use the cursorBegin as a cursor position of preedit When using preedit, CJ inputs use the cursor rectangle for showing a candidate list. The cursorBegin of preedit has been used for the position in most compositors and desktop input-methods. Done-by: lilydjwg li Fixes: QTBUG-129331 Pick-to: 6.9 6.8 6.5 Change-Id: Id8a1fa864189ced98672c3b20c169dd6a950d18d Reviewed-by: David Edmundson --- src/plugins/platforms/wayland/qwaylandtextinputv3.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandtextinputv3.cpp b/src/plugins/platforms/wayland/qwaylandtextinputv3.cpp index d98a7a5fca9..75c435a4c5f 100644 --- a/src/plugins/platforms/wayland/qwaylandtextinputv3.cpp +++ b/src/plugins/platforms/wayland/qwaylandtextinputv3.cpp @@ -146,7 +146,7 @@ void QWaylandTextInputv3::zwp_text_input_v3_done(uint32_t serial) // Current supported cursor shape is just line. // It means, cursorEnd and cursorBegin are the same. QInputMethodEvent::Attribute attribute1(QInputMethodEvent::Cursor, - m_pendingPreeditString.text.length(), + m_pendingPreeditString.cursorBegin, 1); attributes.append(attribute1); } From 638c9bd2595704606b53ba319c67568b479f9fc0 Mon Sep 17 00:00:00 2001 From: Kai Uwe Broulik Date: Tue, 10 Dec 2024 12:44:43 +0100 Subject: [PATCH 1445/1507] QWaylandXdgSurface: Always clean up xdg_activation_token If the token arrives after the surface has already been destroyed, the lambda containing the deleteLater would never be called. Pick-to: 6.9 6.8 Change-Id: Ic34d4e06e20fe522006afc55890cf42b8ba09979 Reviewed-by: Vlad Zahorodnii --- .../plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp index 1fced1af1db..0369476cb56 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp @@ -573,8 +573,8 @@ bool QWaylandXdgSurface::requestActivate() connect(tokenProvider, &QWaylandXdgActivationTokenV1::done, this, [this, tokenProvider](const QString &token) { m_shell->activation()->activate(token, window()->wlSurface()); - tokenProvider->deleteLater(); }); + connect(tokenProvider, &QWaylandXdgActivationTokenV1::done, tokenProvider, &QObject::deleteLater); return true; } } From e721189ae0dd5c4a0f5f4decd498d97f1840d3e6 Mon Sep 17 00:00:00 2001 From: Liang Qi Date: Wed, 11 Dec 2024 10:06:33 +0100 Subject: [PATCH 1446/1507] textinputv3: do commit when update_state_enter In some situation, like with "Focus follows mouse" in System Settings ->Window Management->Window Behavior->Focus on KDE 6 Wayland, during mouse clicks the lineedit to regain the focus, only zwp_text_input_v3_enter() happens, we need to also do commit() for the original state. The commit() was also done in "Click to focus" via QWaylandInputContext::update(). Done-by: lilydjwg li Fixes: QTBUG-131983 Pick-to: 6.9 6.8 Change-Id: Ic6270a531d40e369152845d9f6eb6eee90d03bcc Reviewed-by: David Edmundson --- src/plugins/platforms/wayland/qwaylandtextinputv3.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandtextinputv3.cpp b/src/plugins/platforms/wayland/qwaylandtextinputv3.cpp index 75c435a4c5f..02097993945 100644 --- a/src/plugins/platforms/wayland/qwaylandtextinputv3.cpp +++ b/src/plugins/platforms/wayland/qwaylandtextinputv3.cpp @@ -344,8 +344,8 @@ void QWaylandTextInputv3::updateState(Qt::InputMethodQueries queries, uint32_t f } } - if (needsCommit - && (flags == update_state_change || flags == update_state_enter)) + if (flags == update_state_enter + || (flags == update_state_change && needsCommit)) commit(); } From 0f521a0337ba14c90d36abe5a4cea2ba59c58d89 Mon Sep 17 00:00:00 2001 From: Michael Weghorn Date: Fri, 13 Dec 2024 11:36:48 +0100 Subject: [PATCH 1447/1507] Drop now unused lambda capture tokenProvider is unused inside the lambda since 638c9bd2595704606b53ba319c67568b479f9fc0, triggering .../qt5/qtwayland/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp:574:32: error: lambda capture 'tokenProvider' is not used [-Werror,-Wunused-lambda-capture] 574 | [this, tokenProvider](const QString &token) { in a local clang 19 build. Pick-to: 6.9 6.8 Change-Id: I69f7884afee46859c66a46edce3e7a8001c60e22 Reviewed-by: David Edmundson Reviewed-by: David Redondo --- .../plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp index 0369476cb56..1431e84b2b0 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp @@ -571,7 +571,7 @@ bool QWaylandXdgSurface::requestActivate() const auto tokenProvider = activation->requestXdgActivationToken( wlWindow->display(), wlWindow->wlSurface(), seat->serial(), appId); connect(tokenProvider, &QWaylandXdgActivationTokenV1::done, this, - [this, tokenProvider](const QString &token) { + [this](const QString &token) { m_shell->activation()->activate(token, window()->wlSurface()); }); connect(tokenProvider, &QWaylandXdgActivationTokenV1::done, tokenProvider, &QObject::deleteLater); From f646c1b30bb68d3139dad348155f96cfff444dd7 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Thu, 19 Dec 2024 10:26:34 +0100 Subject: [PATCH 1448/1507] Avoid calling handleScreenRemoved() recursively In some cases where a nested event loop is run as a result of a screen being removed (for instance if it's called from primaryScreenChanged() or similar signals) and multiple screens were added to the system, then we could end up calling handleScreenRemoved() for the placeholder screen recursively. This would cause a crash if anyone actually used the QScreen pointer passed through the screenRemoved() signal. This makes sure we set the placeholder screen to null before calling handleScreenRemoved() so that we don't call it again if we happen to end up in the same function in a nested event loop. Pick-to: 6.5 6.8 6.9 Change-Id: I237946851ed4dce03fd53093baba102c9686be46 Reviewed-by: David Edmundson --- src/plugins/platforms/wayland/qwaylanddisplay.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index 105877dcfe7..d7a5920afbf 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -621,9 +621,11 @@ void QWaylandDisplay::handleScreenInitialized(QWaylandScreen *screen) mScreens.append(screen); QWindowSystemInterface::handleScreenAdded(screen); if (mPlaceholderScreen) { - QWindowSystemInterface::handleScreenRemoved(mPlaceholderScreen); // handleScreenRemoved deletes the platform screen + QPlatformScreen *s = mPlaceholderScreen; mPlaceholderScreen = nullptr; + QWindowSystemInterface::handleScreenRemoved(s); + } } From c1a18d3edf3208cebd4538eac513160430be8461 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Sat, 21 Dec 2024 11:48:46 +0400 Subject: [PATCH 1449/1507] QWaylandXdgSurface: Always clean up xdg_activation_token in more places If the token arrives after the surface has already been destroyed, the lambda containing the deleteLater would never be called. Amends 638c9bd2595704606b53ba319c67568b479f9fc0 Pick-to: 6.9 6.8 Change-Id: Ibebeb441d9c115b0203703b8042a58e986ccff47 Reviewed-by: Vlad Zahorodnii Reviewed-by: Kai Uwe Broulik --- .../shellintegration/xdg-shell/qwaylandxdgshell.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp index 1431e84b2b0..29489acda89 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp @@ -603,11 +603,8 @@ void QWaylandXdgSurface::requestXdgActivationToken(quint32 serial) if (auto *activation = m_shell->activation()) { auto tokenProvider = activation->requestXdgActivationToken( m_shell->m_display, m_window->wlSurface(), serial, m_appId); - connect(tokenProvider, &QWaylandXdgActivationTokenV1::done, this, - [this, tokenProvider](const QString &token) { - Q_EMIT m_window->xdgActivationTokenCreated(token); - tokenProvider->deleteLater(); - }); + connect(tokenProvider, &QWaylandXdgActivationTokenV1::done, m_window, &QWaylandWindow::xdgActivationTokenCreated); + connect(tokenProvider, &QWaylandXdgActivationTokenV1::done, tokenProvider, &QObject::deleteLater); } else { QWaylandShellSurface::requestXdgActivationToken(serial); } @@ -639,10 +636,10 @@ void QWaylandXdgSurface::setAlertState(bool enabled) const auto tokenProvider = activation->requestXdgActivationToken( m_shell->m_display, m_window->wlSurface(), std::nullopt, m_appId); connect(tokenProvider, &QWaylandXdgActivationTokenV1::done, this, - [this, tokenProvider](const QString &token) { + [this](const QString &token) { m_shell->activation()->activate(token, m_window->wlSurface()); - tokenProvider->deleteLater(); }); + connect(tokenProvider, &QWaylandXdgActivationTokenV1::done, tokenProvider, &QObject::deleteLater); } QString QWaylandXdgSurface::externWindowHandle() From ec0f58f5cfe0289c3743e706a8054b28dd9530ce Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Sun, 29 Dec 2024 10:56:05 +0100 Subject: [PATCH 1450/1507] Fix -Wunused-result warnings in tests Existing ones, as well as the newly-popping up ones from QFile::open(). Pick-to: 6.9 6.8 Change-Id: I580f3a022c18bc9026e47df10da8cc7b78296366 Reviewed-by: Thiago Macieira --- tests/auto/wayland/datadevicev1/tst_datadevicev1.cpp | 8 ++++---- tests/auto/wayland/multithreaded/tst_multithreaded.cpp | 3 +-- .../wayland/primaryselectionv1/tst_primaryselectionv1.cpp | 4 ++-- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/tests/auto/wayland/datadevicev1/tst_datadevicev1.cpp b/tests/auto/wayland/datadevicev1/tst_datadevicev1.cpp index 50d78130a52..d225f7374f5 100644 --- a/tests/auto/wayland/datadevicev1/tst_datadevicev1.cpp +++ b/tests/auto/wayland/datadevicev1/tst_datadevicev1.cpp @@ -67,7 +67,7 @@ void tst_datadevicev1::pasteAscii() auto *offer = dataDevice()->sendDataOffer(client, {"text/plain"}); connect(offer, &DataOffer::receive, offer, [](QString mimeType, int fd) { QFile file; - file.open(fd, QIODevice::WriteOnly, QFile::FileHandleFlag::AutoCloseHandle); + QVERIFY(file.open(fd, QIODevice::WriteOnly, QFile::FileHandleFlag::AutoCloseHandle)); QCOMPARE(mimeType, "text/plain"); file.write(QByteArray("normal ascii")); file.close(); @@ -105,7 +105,7 @@ void tst_datadevicev1::pasteUtf8() auto *offer = dataDevice()->sendDataOffer(client, {"text/plain", "text/plain;charset=utf-8"}); connect(offer, &DataOffer::receive, offer, [](QString mimeType, int fd) { QFile file; - file.open(fd, QIODevice::WriteOnly, QFile::FileHandleFlag::AutoCloseHandle); + QVERIFY(file.open(fd, QIODevice::WriteOnly, QFile::FileHandleFlag::AutoCloseHandle)); QCOMPARE(mimeType, "text/plain;charset=utf-8"); file.write(QByteArray("face with tears of joy: 😂")); file.close(); @@ -143,7 +143,7 @@ void tst_datadevicev1::pasteMozUrl() auto *offer = dataDevice()->sendDataOffer(client, {"text/x-moz-url"}); connect(offer, &DataOffer::receive, offer, [](QString mimeType, int fd) { QFile file; - file.open(fd, QIODevice::WriteOnly, QFile::FileHandleFlag::AutoCloseHandle); + QVERIFY(file.open(fd, QIODevice::WriteOnly, QFile::FileHandleFlag::AutoCloseHandle)); QCOMPARE(mimeType, "text/x-moz-url"); const QString content("https://www.qt.io/\nQt\nhttps://www.example.com/\nExample Website"); // Need UTF-16. @@ -186,7 +186,7 @@ void tst_datadevicev1::pasteSingleUtf8MozUrl() auto *offer = dataDevice()->sendDataOffer(client, {"text/x-moz-url"}); connect(offer, &DataOffer::receive, offer, [](QString mimeType, int fd) { QFile file; - file.open(fd, QIODevice::WriteOnly, QFile::FileHandleFlag::AutoCloseHandle); + QVERIFY(file.open(fd, QIODevice::WriteOnly, QFile::FileHandleFlag::AutoCloseHandle)); QCOMPARE(mimeType, "text/x-moz-url"); const QString content("https://www.qt.io/"); file.write(content.toUtf8()); diff --git a/tests/auto/wayland/multithreaded/tst_multithreaded.cpp b/tests/auto/wayland/multithreaded/tst_multithreaded.cpp index a1a7d367ef3..eb9f56205b3 100644 --- a/tests/auto/wayland/multithreaded/tst_multithreaded.cpp +++ b/tests/auto/wayland/multithreaded/tst_multithreaded.cpp @@ -83,8 +83,7 @@ protected: if (fds[1].revents & POLLIN) { char pipeIn; - read(m_pipefd[0], &pipeIn, 1); - if (pipeIn == 'q') + if (read(m_pipefd[0], &pipeIn, 1) == 1 && pipeIn == 'q') break; } } diff --git a/tests/auto/wayland/primaryselectionv1/tst_primaryselectionv1.cpp b/tests/auto/wayland/primaryselectionv1/tst_primaryselectionv1.cpp index d23aed7b85c..1ce6d0f033d 100644 --- a/tests/auto/wayland/primaryselectionv1/tst_primaryselectionv1.cpp +++ b/tests/auto/wayland/primaryselectionv1/tst_primaryselectionv1.cpp @@ -292,7 +292,7 @@ void tst_primaryselectionv1::pasteAscii() auto *offer = device->sendDataOffer({"text/plain"}); connect(offer, &PrimarySelectionOfferV1::receive, offer, [](QString mimeType, int fd) { QFile file; - file.open(fd, QIODevice::WriteOnly, QFile::FileHandleFlag::AutoCloseHandle); + QVERIFY(file.open(fd, QIODevice::WriteOnly, QFile::FileHandleFlag::AutoCloseHandle)); QCOMPARE(mimeType, "text/plain"); file.write(QByteArray("normal ascii")); file.close(); @@ -338,7 +338,7 @@ void tst_primaryselectionv1::pasteUtf8() auto *offer = device->sendDataOffer({"text/plain", "text/plain;charset=utf-8"}); connect(offer, &PrimarySelectionOfferV1::receive, offer, [](QString mimeType, int fd) { QFile file; - file.open(fd, QIODevice::WriteOnly, QFile::FileHandleFlag::AutoCloseHandle); + QVERIFY(file.open(fd, QIODevice::WriteOnly, QFile::FileHandleFlag::AutoCloseHandle)); QCOMPARE(mimeType, "text/plain;charset=utf-8"); file.write(QByteArray("face with tears of joy: 😂")); file.close(); From a6059d4371356819aa1c3ef1bed8f8f28e0a0136 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Wed, 2 Aug 2023 09:02:27 +0200 Subject: [PATCH 1451/1507] Fix C++20 deprecated capture of *this in [=] The exec() function is synchronous, so we can just replace [=] with [&], cf. d8f03969619f3f23528f7771eb963698a84d84a9. Amends 0b82d95632e37ed790db303a580cd39320378434. Pick-to: 6.9 6.8 Change-Id: I6d3a531287dbf3c8c9be7103b5d936325627ca7e Reviewed-by: Thiago Macieira --- tests/auto/wayland/xdgshell/tst_xdgshell.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/auto/wayland/xdgshell/tst_xdgshell.cpp b/tests/auto/wayland/xdgshell/tst_xdgshell.cpp index 0bb3b3ecf9d..311c408a9e5 100644 --- a/tests/auto/wayland/xdgshell/tst_xdgshell.cpp +++ b/tests/auto/wayland/xdgshell/tst_xdgshell.cpp @@ -766,14 +766,14 @@ void tst_xdgshell::suspended() QVERIFY(!window.isExposed()); // not exposed until we're configured QCOMPOSITOR_TRY_VERIFY(xdgToplevel()); - exec([=] { xdgToplevel()->sendCompleteConfigure(); }); + exec([&] { xdgToplevel()->sendCompleteConfigure(); }); QCOMPOSITOR_TRY_VERIFY(xdgToplevel()->m_xdgSurface->m_committedConfigureSerial); QTRY_VERIFY(window.isExposed()); - exec([=] { xdgToplevel()->sendCompleteConfigure(QSize(), {XdgToplevel::state_suspended}); }); + exec([&] { xdgToplevel()->sendCompleteConfigure(QSize(), {XdgToplevel::state_suspended}); }); QTRY_VERIFY(!window.isExposed()); - exec([=] { xdgToplevel()->sendCompleteConfigure(QSize(), {}); }); + exec([&] { xdgToplevel()->sendCompleteConfigure(QSize(), {}); }); QTRY_VERIFY(window.isExposed()); } @@ -784,7 +784,7 @@ void tst_xdgshell::initiallySuspended() window.show(); QVERIFY(!window.isExposed()); QCOMPOSITOR_TRY_VERIFY(xdgToplevel()); - exec([=] { xdgToplevel()->sendCompleteConfigure(QSize(), {XdgToplevel::state_suspended}); }); + exec([&] { xdgToplevel()->sendCompleteConfigure(QSize(), {XdgToplevel::state_suspended}); }); QVERIFY(!window.isExposed()); } From 138c43a3211e1da2ea52767924fad1904198acd7 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Sun, 29 Dec 2024 11:03:54 +0100 Subject: [PATCH 1452/1507] QWaylandShmBuffer: don't ignore the result of Q(Temporary)File::open() The code checked isOpen() afterwards, so everything was ok, but the compiler still complained with QFile::open()-turned-nodiscard-in-6.10. Use a boolean to store the result of open() and use it in lieu of isOpen(). Amends 32daa1a5b9ac06ae89d3aab5b4638139e72814e2. Pick-to: 6.9 6.8 Change-Id: Ia7db2505e939e4f4614cfc8319e779812dd17353 Reviewed-by: Thiago Macieira --- src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp b/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp index 7b6bb4c0890..bdac6dc2416 100644 --- a/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp +++ b/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp @@ -60,19 +60,20 @@ QWaylandShmBuffer::QWaylandShmBuffer(QWaylandDisplay *display, #endif QScopedPointer filePointer; + bool opened; if (fd == -1) { auto tmpFile = new QTemporaryFile (QStandardPaths::writableLocation(QStandardPaths::RuntimeLocation) + QLatin1String("/wayland-shm-XXXXXX")); - tmpFile->open(); + opened = tmpFile->open(); filePointer.reset(tmpFile); } else { auto file = new QFile; - file->open(fd, QIODevice::ReadWrite | QIODevice::Unbuffered, QFile::AutoCloseHandle); + opened = file->open(fd, QIODevice::ReadWrite | QIODevice::Unbuffered, QFile::AutoCloseHandle); filePointer.reset(file); } // NOTE beginPaint assumes a new buffer be all zeroes, which QFile::resize does. - if (!filePointer->isOpen() || !filePointer->resize(alloc)) { + if (!opened || !filePointer->resize(alloc)) { qWarning("QWaylandShmBuffer: failed: %s", qUtf8Printable(filePointer->errorString())); return; } From 610397765433d13a6d018a7d909c33a1e347e8e0 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Sun, 29 Dec 2024 11:18:38 +0100 Subject: [PATCH 1453/1507] QWaylandShmBuffer: use make_unique / unique_ptr This keeps the QFile/QTemporaryFile objects inside a RAII wrapper at any time, which is safer. Since QScopedPointer doesn't have a similar function (and because of upcoming QT_NO_SCOPED_POINTER), also port to std::unique_ptr. Amends 32daa1a5b9ac06ae89d3aab5b4638139e72814e2. Pick-to: 6.9 6.8 Change-Id: If67a3a3bdb4fa2a06ecafd1c3dcb90e1121159b0 Reviewed-by: Thiago Macieira --- .../platforms/wayland/qwaylandshmbackingstore.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp b/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp index bdac6dc2416..b1ae2e1ae4f 100644 --- a/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp +++ b/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp @@ -16,6 +16,8 @@ #include +#include + #include #include #include @@ -59,18 +61,19 @@ QWaylandShmBuffer::QWaylandShmBuffer(QWaylandDisplay *display, fcntl(fd, F_ADD_SEALS, F_SEAL_SHRINK | F_SEAL_SEAL); #endif - QScopedPointer filePointer; + std::unique_ptr filePointer; bool opened; if (fd == -1) { - auto tmpFile = new QTemporaryFile (QStandardPaths::writableLocation(QStandardPaths::RuntimeLocation) + + auto tmpFile = + std::make_unique(QStandardPaths::writableLocation(QStandardPaths::RuntimeLocation) + QLatin1String("/wayland-shm-XXXXXX")); opened = tmpFile->open(); - filePointer.reset(tmpFile); + filePointer = std::move(tmpFile); } else { - auto file = new QFile; + auto file = std::make_unique(); opened = file->open(fd, QIODevice::ReadWrite | QIODevice::Unbuffered, QFile::AutoCloseHandle); - filePointer.reset(file); + filePointer = std::move(file); } // NOTE beginPaint assumes a new buffer be all zeroes, which QFile::resize does. if (!opened || !filePointer->resize(alloc)) { From ae3d9aa08172f08b58fbe1ecfe8f334cbc63fe9b Mon Sep 17 00:00:00 2001 From: Alexei Cazacov Date: Thu, 2 Jan 2025 10:13:34 +0200 Subject: [PATCH 1454/1507] Fix the module documentation structure for Qt Wayland Client MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes: QTBUG-132274 Pick-to: 6.9 Change-Id: Ibaa47274757a6bc22260f703becc69c4c0d5b702 Reviewed-by: Topi Reiniö --- src/plugins/platforms/wayland/doc/qtwaylandclient.qdocconf | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/plugins/platforms/wayland/doc/qtwaylandclient.qdocconf b/src/plugins/platforms/wayland/doc/qtwaylandclient.qdocconf index 20ceaef02de..c06be00479a 100644 --- a/src/plugins/platforms/wayland/doc/qtwaylandclient.qdocconf +++ b/src/plugins/platforms/wayland/doc/qtwaylandclient.qdocconf @@ -13,6 +13,12 @@ qhp.QtWaylandClient.virtualFolder = QtWaylandClient qhp.QtWaylandClient.indexTitle = Qt Wayland Client qhp.QtWaylandClient.indexRoot = +qhp.QtWaylandClient.subprojects = cmakecommand + +qhp.QtWaylandClient.subprojects.cmakecommand.title = qt_generate_wayland_protocol_client_sources +qhp.QtWaylandClient.subprojects.cmakecommand.indexTitle = qt_generate_wayland_protocol_client_sources +qhp.QtWaylandClient.subprojects.cmakecommand.selectors = group:cmakecommand + depends += qtcore \ qtqml \ qtquick \ From 9bb48c315c129842d9b50142c7f33ef4bd1a8df2 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Sun, 5 Jan 2025 11:52:08 +0100 Subject: [PATCH 1455/1507] QWaylandClientExtensionTemplate: reflow qWarning() in bind() As suggested in 6.9 API-review, reflow the long line and put the interface.name onto a separate line in the log output. Amends 8784a01787f72bfea7124ecb2b896ebf644d1824. Pick-to: 6.9 Change-Id: I12f00b65d7b22ac9330b25faca28edaa7a159a3a Reviewed-by: Volker Hilsheimer Reviewed-by: David Edmundson --- .../platforms/wayland/global/qwaylandclientextension.h | 4 +++- .../wayland/shellintegration/qwaylandshellintegration_p.h | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/wayland/global/qwaylandclientextension.h b/src/plugins/platforms/wayland/global/qwaylandclientextension.h index 774c5ba7750..6079e990168 100644 --- a/src/plugins/platforms/wayland/global/qwaylandclientextension.h +++ b/src/plugins/platforms/wayland/global/qwaylandclientextension.h @@ -84,7 +84,9 @@ public: // developer and the version specified in the protocol and also the // compositor version. if (this->version() > T::interface()->version) { - qWarning("Supplied protocol version to QWaylandClientExtensionTemplate is higher than the version of the protocol, using protocol version instead. interface.name: %s", + qWarning("Supplied protocol version to QWaylandClientExtensionTemplate is higher " + "than the version of the protocol, using protocol version instead.\n" + " interface.name: %s", T::interface()->name); } int minVersion = qMin(ver, qMin(T::interface()->version, this->version())); diff --git a/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegration_p.h b/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegration_p.h index 59b3c9e5a13..0f76e5aceb5 100644 --- a/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegration_p.h +++ b/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegration_p.h @@ -81,7 +81,9 @@ public: // developer and the version specified in the protocol and also the // compositor version. if (this->version() > T::interface()->version) { - qWarning("Supplied protocol version to QWaylandClientExtensionTemplate is higher than the version of the protocol, using protocol version instead. interface.name: %s", + qWarning("Supplied protocol version to QWaylandClientExtensionTemplate is higher " + "than the version of the protocol, using protocol version instead.\n" + " interface.name: %s", T::interface()->name); } int minVersion = qMin(ver, qMin(T::interface()->version, this->version())); From 8fb0ceeb95539f2958cf5f89bcc6c4ee08460b7d Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Sun, 5 Jan 2025 12:05:38 +0100 Subject: [PATCH 1456/1507] QWaylandShellIntegration: pin vtable to a single TU Fixes -Wweak-vtables, at least on the base class; the implementation is a template, so can't be fixed. Pick-to: 6.9 Change-Id: Ic697614995042e3e0cf130bbaf1bc21a891b497b Reviewed-by: Volker Hilsheimer --- .../wayland/shellintegration/qwaylandshellintegration.cpp | 3 +++ .../wayland/shellintegration/qwaylandshellintegration_p.h | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegration.cpp b/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegration.cpp index 3d2f21c777a..0cefa8a7c25 100644 --- a/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegration.cpp +++ b/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegration.cpp @@ -8,6 +8,9 @@ QT_BEGIN_NAMESPACE namespace QtWaylandClient { +QWaylandShellIntegration::~QWaylandShellIntegration() + = default; // MUST stay empty until Qt 7 (was inline in Qt < 6.9) + wl_surface *QWaylandShellIntegration::wlSurfaceForWindow(QWaylandWindow *window) { return window->wlSurface(); diff --git a/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegration_p.h b/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegration_p.h index 0f76e5aceb5..cd27317e567 100644 --- a/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegration_p.h +++ b/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegration_p.h @@ -40,7 +40,7 @@ class Q_WAYLANDCLIENT_EXPORT QWaylandShellIntegration { public: QWaylandShellIntegration() {} - virtual ~QWaylandShellIntegration() {} + virtual ~QWaylandShellIntegration(); virtual bool initialize(QWaylandDisplay *display) = 0; virtual QWaylandShellSurface *createShellSurface(QWaylandWindow *window) = 0; From 33db27aeaff08b989767d65f5df61825c849693c Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Sun, 5 Jan 2025 12:08:54 +0100 Subject: [PATCH 1457/1507] QWaylandShellIntegrationTemplate: swap order of base classes The QObject must alwyas come first. This is BiC, but it's a private header, so we don't care. Amends a7bb7210ac76a397b4aec8d8f32d902dc932d855. Pick-to: 6.9 Change-Id: I35edce36d1cc7f5d61f7c3457ca6541e827288a0 Reviewed-by: David Redondo Reviewed-by: Volker Hilsheimer --- .../wayland/shellintegration/qwaylandshellintegration_p.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegration_p.h b/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegration_p.h index cd27317e567..44c8cdb444b 100644 --- a/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegration_p.h +++ b/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegration_p.h @@ -55,7 +55,9 @@ public: }; template -class Q_WAYLANDCLIENT_EXPORT QWaylandShellIntegrationTemplate : public QWaylandShellIntegration, public QWaylandClientExtension +class Q_WAYLANDCLIENT_EXPORT QWaylandShellIntegrationTemplate + : public QWaylandClientExtension, + public QWaylandShellIntegration { public: QWaylandShellIntegrationTemplate(const int ver) : From 74e57c5d9d293858c021d026e618b20fac7284d2 Mon Sep 17 00:00:00 2001 From: Nicolas Fella Date: Sun, 12 Jan 2025 03:42:46 +0100 Subject: [PATCH 1458/1507] XdgToplevelIcon: Reserve instead of resize list resize() changes the size of the list, reserve() changes the capacity. If we resize and then append we end up with too many items, some of which are default-constructed (invalid) sizes. Later we use the invalid size to get a pixmap, which will be empty. In QWaylandShmBuffer we then try to mmap the empty pixmap, which fails and we return early, never calling init() and setting mBuffer. In QWaylandXdgToplevelIconV1 we then pass this null buffer to add_buffer, which results in a protocol error Fixes: QTBUG-132727 Pick-to: 6.9 Change-Id: I8f164c43423726367157fa9ce2e3af7a6fd3219c Reviewed-by: David Redondo --- .../shellintegration/xdg-shell/qwaylandxdgtopleveliconv1.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgtopleveliconv1.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgtopleveliconv1.cpp index f7774f50009..6ecf7e9c990 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgtopleveliconv1.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgtopleveliconv1.cpp @@ -79,7 +79,7 @@ void QWaylandXdgToplevelIconManagerV1::setIcon(const QIcon &icon, xdg_toplevel * QList iconSizes = icon.availableSizes(); // if icon has no default size (an SVG) if (iconSizes.isEmpty()) { - iconSizes.resize(mPreferredSizes.size()); + iconSizes.reserve(mPreferredSizes.size()); for (int size : std::as_const(mPreferredSizes)) { iconSizes.append(QSize(size, size)); } From dff8816c768747fedfaf071b8becb7e91b5da65b Mon Sep 17 00:00:00 2001 From: Nicolas Fella Date: Fri, 27 Dec 2024 02:46:08 +0100 Subject: [PATCH 1459/1507] QWaylandTablet: Use floating point tilt Change-Id: Ib8476fd74ade7c50cf36909fd9148c78f21c83b1 Reviewed-by: David Edmundson --- src/plugins/platforms/wayland/qwaylandtabletv2.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandtabletv2.cpp b/src/plugins/platforms/wayland/qwaylandtabletv2.cpp index cca00ca7d35..ce5261d0c62 100644 --- a/src/plugins/platforms/wayland/qwaylandtabletv2.cpp +++ b/src/plugins/platforms/wayland/qwaylandtabletv2.cpp @@ -550,8 +550,8 @@ void QWaylandTabletToolV2::zwp_tablet_tool_v2_frame(uint32_t time) Qt::MouseButtons buttons = m_pending.down ? Qt::MouseButton::LeftButton : Qt::MouseButton::NoButton; buttons |= m_pending.buttons; qreal pressure = m_pending.pressure; - int xTilt = int(m_pending.xTilt); - int yTilt = int(m_pending.yTilt); + qreal xTilt = m_pending.xTilt; + qreal yTilt = m_pending.yTilt; qreal tangentialPressure = m_pending.slider; qreal rotation = m_pending.rotation; int z = int(m_pending.distance); From faea5e128a29d1b75680283d7d496d08672998d5 Mon Sep 17 00:00:00 2001 From: Liang Qi Date: Fri, 17 Jan 2025 10:56:08 +0100 Subject: [PATCH 1460/1507] textinputv3: need to commit() after disable() https://gitlab.freedesktop.org/wayland/wayland-protocols/-/blob/master/unstable/text-input/text-input-unstable-v3.xml disable() - Disable Text Input On A Surface Explicitly disable text input on the current surface (typically when there is no focus on any text entry inside the surface). State set with this request is double-buffered. It will get applied on the next zwp_text_input_v3.commit request. Done-by: lilydjwg li Fixes: QTBUG-132195 Pick-to: 6.9 6.8 Change-Id: Iaae1d306fba235b9fc3eba3f0215ca85375f3a3d Reviewed-by: David Edmundson --- src/plugins/platforms/wayland/qwaylandtextinputv3.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/plugins/platforms/wayland/qwaylandtextinputv3.cpp b/src/plugins/platforms/wayland/qwaylandtextinputv3.cpp index 02097993945..b35f05b2f16 100644 --- a/src/plugins/platforms/wayland/qwaylandtextinputv3.cpp +++ b/src/plugins/platforms/wayland/qwaylandtextinputv3.cpp @@ -69,6 +69,7 @@ void QWaylandTextInputv3::zwp_text_input_v3_leave(struct ::wl_surface *surface) m_surface = nullptr; disable(); + commit(); qCDebug(qLcQpaWaylandTextInput) << Q_FUNC_INFO << "Done"; } From 71c4dab8d0881988bbe92b94e73bec0b4584ad2a Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Sat, 21 Dec 2024 11:49:56 +0400 Subject: [PATCH 1461/1507] QWaylandWindow: prevent a crash when calling requestXdgActivationToken It could crash if it's called when there's no mShellSurface Pick-to: 6.9 6.8 Change-Id: I9b279e915ea661b121da672ebd46be458a1a9218 Reviewed-by: David Edmundson --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 393f33cfd47..7b46ba22d54 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -1787,12 +1787,20 @@ void QWaylandWindow::setOpaqueArea(const QRegion &opaqueArea) void QWaylandWindow::requestXdgActivationToken(uint serial) { + if (!mShellSurface) { + qCWarning(lcQpaWayland) << "requestXdgActivationToken is called with no surface role created, emitting synthetic signal"; + Q_EMIT xdgActivationTokenCreated({}); + return; + } mShellSurface->requestXdgActivationToken(serial); } void QWaylandWindow::setXdgActivationToken(const QString &token) { - mShellSurface->setXdgActivationToken(token); + if (mShellSurface) + mShellSurface->setXdgActivationToken(token); + else + qCWarning(lcQpaWayland) << "setXdgActivationToken is called with no surface role created, token" << token << "discarded"; } void QWaylandWindow::addChildPopup(QWaylandWindow *child) From d8e205a0030cb35d72bc50be748647caf79ca083 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 22 Jan 2025 10:23:44 -0800 Subject: [PATCH 1462/1507] client: use QDesktopUnixServices instead of QGenericUnixServices Renamed in 3e29267df0e2f332290caad69e5bd5cfd61cf3da in qtbase. Pick-to: 6.9 Change-Id: If857e206071226c2d0f6f42ce1c9b4d091b0bc63 Reviewed-by: Liang Qi --- src/plugins/platforms/wayland/qwaylandplatformservices.cpp | 4 ++-- src/plugins/platforms/wayland/qwaylandplatformservices_p.h | 4 ++-- src/plugins/platforms/wayland/qwaylandwindow.cpp | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandplatformservices.cpp b/src/plugins/platforms/wayland/qwaylandplatformservices.cpp index e0eb690d792..74d8c2e2e3b 100644 --- a/src/plugins/platforms/wayland/qwaylandplatformservices.cpp +++ b/src/plugins/platforms/wayland/qwaylandplatformservices.cpp @@ -26,7 +26,7 @@ bool QWaylandPlatformServices::openUrl(const QUrl &url) windowManagerIntegration->openUrl(url); return true; } - return QGenericUnixServices::openUrl(url); + return QDesktopUnixServices::openUrl(url); } bool QWaylandPlatformServices::openDocument(const QUrl &url) @@ -35,7 +35,7 @@ bool QWaylandPlatformServices::openDocument(const QUrl &url) windowManagerIntegration->openUrl(url); return true; } - return QGenericUnixServices::openDocument(url); + return QDesktopUnixServices::openDocument(url); } QString QWaylandPlatformServices::portalWindowIdentifier(QWindow *window) diff --git a/src/plugins/platforms/wayland/qwaylandplatformservices_p.h b/src/plugins/platforms/wayland/qwaylandplatformservices_p.h index f8b09ccab90..017d222843b 100644 --- a/src/plugins/platforms/wayland/qwaylandplatformservices_p.h +++ b/src/plugins/platforms/wayland/qwaylandplatformservices_p.h @@ -16,7 +16,7 @@ // #include -#include +#include #include #include @@ -29,7 +29,7 @@ class QWaylandAppMenu; class QWaylandDisplay; class QWaylandWindow; -class Q_WAYLANDCLIENT_EXPORT QWaylandPlatformServices : public QGenericUnixServices +class Q_WAYLANDCLIENT_EXPORT QWaylandPlatformServices : public QDesktopUnixServices { public: explicit QWaylandPlatformServices(QWaylandDisplay *waylandDisplay); diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 7b46ba22d54..54cddf6876e 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -1065,7 +1065,7 @@ bool QWaylandWindow::createDecoration() } if (targetKey.isEmpty()) { - auto unixServices = dynamic_cast( + auto unixServices = dynamic_cast( QGuiApplicationPrivate::platformIntegration()->services()); const QList desktopNames = unixServices->desktopEnvironment().split(':'); if (desktopNames.contains("GNOME")) { From f277586291f365747ccdae2c82c60c9bbaab3c2f Mon Sep 17 00:00:00 2001 From: David Redondo Date: Mon, 27 Jan 2025 14:38:58 +0100 Subject: [PATCH 1463/1507] client: Clean up tablet_pad_group proxy While Qt cannot do anything with them right now, these are server created proxies and still need to be destroyed to be not leaked. Pick-to: 6.9 6.8 Change-Id: I5fad05c6bbb05782bb997204b3dada80ab28b98e Reviewed-by: David Edmundson --- src/plugins/platforms/wayland/qwaylandtabletv2.cpp | 7 +++++++ src/plugins/platforms/wayland/qwaylandtabletv2_p.h | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandtabletv2.cpp b/src/plugins/platforms/wayland/qwaylandtabletv2.cpp index ce5261d0c62..3cfcdfe7d00 100644 --- a/src/plugins/platforms/wayland/qwaylandtabletv2.cpp +++ b/src/plugins/platforms/wayland/qwaylandtabletv2.cpp @@ -615,6 +615,13 @@ void QWaylandTabletPadV2::zwp_tablet_pad_v2_buttons(uint32_t buttons) d->buttonCount = buttons; } +void QWaylandTabletPadV2::zwp_tablet_pad_v2_group(zwp_tablet_pad_group_v2 *pad_group) +{ + // As of writing Qt does not handle tablet pads group and the controls on it + // This proxy is server created so it is just deleted here to not leak it + zwp_tablet_pad_group_v2_destroy(pad_group); +} + void QWaylandTabletPadV2::zwp_tablet_pad_v2_done() { QWindowSystemInterface::registerInputDevice(this); diff --git a/src/plugins/platforms/wayland/qwaylandtabletv2_p.h b/src/plugins/platforms/wayland/qwaylandtabletv2_p.h index f0d7cd189bb..6c8ef272723 100644 --- a/src/plugins/platforms/wayland/qwaylandtabletv2_p.h +++ b/src/plugins/platforms/wayland/qwaylandtabletv2_p.h @@ -185,7 +185,7 @@ public: ~QWaylandTabletPadV2(); protected: -// void zwp_tablet_pad_v2_group(struct ::zwp_tablet_pad_group_v2 *pad_group) override; + void zwp_tablet_pad_v2_group(struct ::zwp_tablet_pad_group_v2 *pad_group) override; void zwp_tablet_pad_v2_path(const QString &path) override; void zwp_tablet_pad_v2_buttons(uint32_t buttons) override; void zwp_tablet_pad_v2_done() override; From 48ef1633a37f6d5caf0fafe861858d7fb7af5197 Mon Sep 17 00:00:00 2001 From: Alexey Edelev Date: Tue, 7 Jan 2025 18:13:53 +0100 Subject: [PATCH 1464/1507] Switch to qt_register_target_dependencies for Qt modules qt_record_extra_qt_package_dependency is deprecated since 6.9 Pick-to: 6.5 6.8 6.9 Change-Id: Ia21fd9a75d14fadefd4f9dd392aa908e1c84d274 Reviewed-by: Alexandru Croitor --- src/plugins/platforms/wayland/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/CMakeLists.txt b/src/plugins/platforms/wayland/CMakeLists.txt index 90cc673cb3e..9b1c84f7414 100644 --- a/src/plugins/platforms/wayland/CMakeLists.txt +++ b/src/plugins/platforms/wayland/CMakeLists.txt @@ -186,4 +186,4 @@ qt_internal_add_docs(WaylandClient ) qt_record_extra_qt_main_tools_package_dependency(WaylandClient WaylandScannerTools "${PROJECT_VERSION}") -qt_record_extra_qt_package_dependency(WaylandClient WaylandGlobalPrivate "${PROJECT_VERSION}") +qt_internal_register_target_dependencies(WaylandClient PUBLIC Qt6::WaylandGlobalPrivate) From 8a6d564a648e70bd87e8e91e1efc7ef0f31a2781 Mon Sep 17 00:00:00 2001 From: Yifan Zhu Date: Thu, 23 Jan 2025 21:48:02 -0800 Subject: [PATCH 1465/1507] client: update mouse position on enter Otherwise cursor position is not correctly set after a wl_pointer enter event. Fixes: QTBUG-133204 Pick-to: 6.9 6.8 Change-Id: I444fb63093ae08ae37f1e5b2863fb19fc7bb240a Reviewed-by: David Redondo --- src/plugins/platforms/wayland/qwaylandcursor.cpp | 5 +++++ src/plugins/platforms/wayland/qwaylandcursor_p.h | 1 + src/plugins/platforms/wayland/qwaylandwindow.cpp | 7 +++++++ 3 files changed, 13 insertions(+) diff --git a/src/plugins/platforms/wayland/qwaylandcursor.cpp b/src/plugins/platforms/wayland/qwaylandcursor.cpp index 4bdd053e8c8..00b1d7df2a3 100644 --- a/src/plugins/platforms/wayland/qwaylandcursor.cpp +++ b/src/plugins/platforms/wayland/qwaylandcursor.cpp @@ -339,6 +339,11 @@ void QWaylandCursor::setPos(const QPoint &pos) qCWarning(lcQpaWayland) << "Setting cursor position is not possible on wayland"; } +void QWaylandCursor::setPosFromEnterEvent(const QPoint &pos) +{ + mLastPos = pos; +} + QSize QWaylandCursor::size() const { if (const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme()) diff --git a/src/plugins/platforms/wayland/qwaylandcursor_p.h b/src/plugins/platforms/wayland/qwaylandcursor_p.h index 1f6d5109ed2..e31019e7f25 100644 --- a/src/plugins/platforms/wayland/qwaylandcursor_p.h +++ b/src/plugins/platforms/wayland/qwaylandcursor_p.h @@ -105,6 +105,7 @@ public: void pointerEvent(const QMouseEvent &event) override; QPoint pos() const override; void setPos(const QPoint &pos) override; + void setPosFromEnterEvent(const QPoint &pos); QSize size() const override; diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 54cddf6876e..f9acfa76fd1 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -4,6 +4,7 @@ #include "qwaylandwindow_p.h" #include "qwaylandbuffer_p.h" +#include "qwaylandcursor_p.h" #include "qwaylanddisplay_p.h" #include "qwaylandsurface_p.h" #include "qwaylandinputdevice_p.h" @@ -1184,6 +1185,9 @@ void QWaylandWindow::handleMouse(QWaylandInputDevice *inputDevice, const QWaylan switch (e.type) { case QEvent::Enter: QWindowSystemInterface::handleEnterEvent(window(), e.local, e.global); +#if QT_CONFIG(cursor) + mDisplay->waylandCursor()->setPosFromEnterEvent(e.global.toPoint()); +#endif break; case QEvent::MouseButtonPress: case QEvent::MouseButtonRelease: @@ -1387,6 +1391,9 @@ void QWaylandWindow::handleMouseEventWithDecoration(QWaylandInputDevice *inputDe switch (e.type) { case QEvent::Enter: QWindowSystemInterface::handleEnterEvent(window(), localTranslated, globalTranslated); +#if QT_CONFIG(cursor) + mDisplay->waylandCursor()->setPosFromEnterEvent(e.global.toPoint()); +#endif break; case QEvent::MouseButtonPress: case QEvent::MouseButtonRelease: From 412b1ecd5c8cd3bf70e58bbab3369aaf14ad0c42 Mon Sep 17 00:00:00 2001 From: Xaver Hugl Date: Thu, 3 Oct 2024 03:03:27 +0200 Subject: [PATCH 1466/1507] client: implement support for the color management protocol MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This uses an "experimental" tag of the proposed protocol, which has been implemented by several compositors. Once the protocol gets merged upstream, this should be updated to use the final version from that as well. Change-Id: I8653489fea44f404b759b046cd3fa910dc92479b Reviewed-by: Tor Arne Vestbø --- .../protocols/color-management/REUSE.toml | 11 + .../color-management/qt_attribution.json | 18 + .../xx-color-management-v4.xml | 1453 +++++++++++++++++ src/plugins/platforms/wayland/CMakeLists.txt | 2 + .../wayland/qwaylandcolormanagement.cpp | 252 +++ .../wayland/qwaylandcolormanagement_p.h | 147 ++ .../platforms/wayland/qwaylanddisplay.cpp | 6 + .../platforms/wayland/qwaylanddisplay_p.h | 6 + .../platforms/wayland/qwaylandwindow.cpp | 34 + .../platforms/wayland/qwaylandwindow_p.h | 10 + 10 files changed, 1939 insertions(+) create mode 100644 src/3rdparty/wayland/protocols/color-management/REUSE.toml create mode 100644 src/3rdparty/wayland/protocols/color-management/qt_attribution.json create mode 100644 src/3rdparty/wayland/protocols/color-management/xx-color-management-v4.xml create mode 100644 src/plugins/platforms/wayland/qwaylandcolormanagement.cpp create mode 100644 src/plugins/platforms/wayland/qwaylandcolormanagement_p.h diff --git a/src/3rdparty/wayland/protocols/color-management/REUSE.toml b/src/3rdparty/wayland/protocols/color-management/REUSE.toml new file mode 100644 index 00000000000..c7b978663b1 --- /dev/null +++ b/src/3rdparty/wayland/protocols/color-management/REUSE.toml @@ -0,0 +1,11 @@ +version = 1 + +[[annotations]] +path = "xx-color-management-v4.xml" +precedence = "closest" +SPDX-FileCopyrightText = ["Copyright 2019 Sebastian Wick", + "Copyright 2019 Erwin Burema", + "Copyright 2020 AMD", + "Copyright 2020-2024 Collabora, Ltd.", + "Copyright 2024 Xaver Hugl"] +SPDX-License-Identifier = "MIT" diff --git a/src/3rdparty/wayland/protocols/color-management/qt_attribution.json b/src/3rdparty/wayland/protocols/color-management/qt_attribution.json new file mode 100644 index 00000000000..246e9df70fa --- /dev/null +++ b/src/3rdparty/wayland/protocols/color-management/qt_attribution.json @@ -0,0 +1,18 @@ +[ + { + "Id": "wayland-color-management-protocol", + "Name": "Wayland Color Management Protocol", + "QDocModule": "qtwaylandcompositor", + "QtUsage": "Used in the Qt Wayland platform plugin.", + "Files": "xx-color-management-v4.xml", + + "Description": "An extension to use different colorspaces from sRGB", + "Homepage": "https://wayland.freedesktop.org", + "Version": "experimental v4", + "DownloadLocation": "https://gitlab.freedesktop.org/swick/wayland-protocols/-/blob/708a8b4119d4072820158a115166598733d378f4/staging/color-management/xx-color-management-v4.xml", + "LicenseId": "MIT", + "License": "MIT License", + "LicenseFile": "../MIT_LICENSE.txt", + "Copyright": "Copyright 2019 Sebastian Wick\nCopyright 2019 Erwin Burema\nCopyright 2020 AMD\nCopyright 2020-2024 Collabora, Ltd.\nCopyright 2024 Xaver Hugl" + } +] diff --git a/src/3rdparty/wayland/protocols/color-management/xx-color-management-v4.xml b/src/3rdparty/wayland/protocols/color-management/xx-color-management-v4.xml new file mode 100644 index 00000000000..eab84dfd992 --- /dev/null +++ b/src/3rdparty/wayland/protocols/color-management/xx-color-management-v4.xml @@ -0,0 +1,1453 @@ + + + + Copyright 2019 Sebastian Wick + Copyright 2019 Erwin Burema + Copyright 2020 AMD + Copyright 2020-2024 Collabora, Ltd. + Copyright 2024 Xaver Hugl + + 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. + + + + The aim of the color management extension is to allow clients to know + the color properties of outputs, and to tell the compositor about the color + properties of their content on surfaces. Doing this enables a compositor + to perform automatic color management of content for different outputs + according to how content is intended to look like. + + The color properties are represented as an image description object which + is immutable after it has been created. A wl_output always has an + associated image description that clients can observe. A wl_surface + always has an associated preferred image description as a hint chosen by + the compositor that clients can also observe. Clients can set an image + description on a wl_surface to denote the color characteristics of the + surface contents. + + An image description includes SDR and HDR colorimetry and encoding, HDR + metadata, and viewing environment parameters. An image description does + not include the properties set through color-representation extension. + It is expected that the color-representation extension is used in + conjunction with the color management extension when necessary, + particularly with the YUV family of pixel formats. + + Recommendation ITU-T H.273 + "Coding-independent code points for video signal type identification" + shall be referred to as simply H.273 here. + + The color-and-hdr repository + (https://gitlab.freedesktop.org/pq/color-and-hdr) contains + background information on the protocol design and legacy color management. + It also contains a glossary, learning resources for digital color, tools, + samples and more. + + The terminology used in this protocol is based on common color science and + color encoding terminology where possible. The glossary in the color-and-hdr + repository shall be the authority on the definition of terms in this + protocol. + + + + + A global interface used for getting color management extensions for + wl_surface and wl_output objects, and for creating client defined image + description objects. The extension interfaces allow + getting the image description of outputs and setting the image + description of surfaces. + + + + + Destroy the xx_color_manager_v4 object. This does not affect any other + objects in any way. + + + + + + + + + + + See the ICC.1:2022 specification from the International Color Consortium + for more details about rendering intents. + + The principles of ICC defined rendering intents apply with all types of + image descriptions, not only those with ICC file profiles. + + Compositors must support the perceptual rendering intent. Other + rendering intents are optional. + + + + + + + + + + + + + + + + + + + + The compositor supports set_mastering_display_primaries request with a + target color volume fully contained inside the primary color volume. + + + + + The compositor additionally supports target color volumes that + extend outside of the primary color volume. + + This can only be advertised if feature set_mastering_display_primaries + is supported as well. + + + + + + + Named color primaries used to encode well-known sets of primaries. H.273 + is the authority, when it comes to the exact values of primaries and + authoritative specifications, where an equivalent code point exists. + + Descriptions do list the specifications for convenience. + + + + + Color primaries as defined by + - Rec. ITU-R BT.709-6 + - Rec. ITU-R BT.1361-0 conventional colour gamut system and extended + colour gamut system (historical) + - IEC 61966-2-1 sRGB or sYCC + - IEC 61966-2-4 + - Society of Motion Picture and Television Engineers (SMPTE) RP 177 + (1993) Annex B + Equivalent to H.273 ColourPrimaries code point 1. + + + + + Color primaries as defined by + - Rec. ITU-R BT.470-6 System M (historical) + - United States National Television System Committee 1953 + Recommendation for transmission standards for color television + - United States Federal Communications Commission (2003) Title 47 Code + of Federal Regulations 73.682 (a)(20) + Equivalent to H.273 ColourPrimaries code point 4. + + + + + Color primaries as defined by + - Rec. ITU-R BT.470-6 System B, G (historical) + - Rec. ITU-R BT.601-7 625 + - Rec. ITU-R BT.1358-0 625 (historical) + - Rec. ITU-R BT.1700-0 625 PAL and 625 SECAM + Equivalent to H.273 ColourPrimaries code point 5. + + + + + Color primaries as defined by + - Rec. ITU-R BT.601-7 525 + - Rec. ITU-R BT.1358-1 525 or 625 (historical) + - Rec. ITU-R BT.1700-0 NTSC + - SMPTE 170M (2004) + - SMPTE 240M (1999) (historical) + Equivalent to H.273 ColourPrimaries code point 6 and 7. + + + + + Color primaries as defined by H.273 for generic film. + Equivalent to H.273 ColourPrimaries code point 8. + + + + + Color primaries as defined by + - Rec. ITU-R BT.2020-2 + - Rec. ITU-R BT.2100-0 + Equivalent to H.273 ColourPrimaries code point 9. + + + + + Color primaries as defined as the maximum of the CIE 1931 XYZ color + space by + - SMPTE ST 428-1 + - (CIE 1931 XYZ as in ISO 11664-1) + Equivalent to H.273 ColourPrimaries code point 10. + + + + + Color primaries as defined by Digital Cinema System and published in + SMPTE RP 431-2 (2011). Equivalent to H.273 ColourPrimaries code point + 11. + + + + + Color primaries as defined by Digital Cinema System and published in + SMPTE EG 432-1 (2010). + Equivalent to H.273 ColourPrimaries code point 12. + + + + + Color primaries as defined by Adobe as "Adobe RGB" and later published + by ISO 12640-4 (2011). + + + + + + + Named transfer functions used to encode well-known transfer + characteristics. H.273 is the authority, when it comes to the exact + formulas and authoritative specifications, where an equivalent code + point exists. + + Descriptions do list the specifications for convenience. + + + + + Transfer characteristics as defined by + - Rec. ITU-R BT.709-6 + - Rec. ITU-R BT.1361-0 conventional colour gamut system (historical) + Equivalent to H.273 TransferCharacteristics code point 1, 6, 14, 15. + + + + + Transfer characteristics as defined by + - Rec. ITU-R BT.470-6 System M (historical) + - United States National Television System Committee 1953 + Recommendation for transmission standards for color television + - United States Federal Communications Commission (2003) Title 47 Code + of Federal Regulations 73.682 (a) (20) + - Rec. ITU-R BT.1700-0 625 PAL and 625 SECAM + Equivalent to H.273 TransferCharacteristics code point 4. + + + + + Transfer characteristics as defined by + - Rec. ITU-R BT.470-6 System B, G (historical) + Equivalent to H.273 TransferCharacteristics code point 5. + + + + + Transfer characteristics as defined by + - SMPTE ST 240 (1999) + Equivalent to H.273 TransferCharacteristics code point 7. + + + + + Linear transfer characteristics. + Equivalent to H.273 TransferCharacteristics code point 8. + + + + + Logarithmic transfer characteristic (100:1 range). + Equivalent to H.273 TransferCharacteristics code point 9. + + + + + Logarithmic transfer characteristic (100 * Sqrt(10) : 1 range). + Equivalent to H.273 TransferCharacteristics code point 10. + + + + + Transfer characteristics as defined by + - IEC 61966-2-4 + Equivalent to H.273 TransferCharacteristics code point 11. + + + + + Transfer characteristics as defined by + - Rec. ITU-R BT.1361-0 extended colour gamut system (historical) + Equivalent to H.273 TransferCharacteristics code point 12. + + + + + Transfer characteristics as defined by + - IEC 61966-2-1 sRGB + Equivalent to H.273 TransferCharacteristics code point 13 with + MatrixCoefficients set to 0. + + + + + Transfer characteristics as defined by + - IEC 61966-2-1 sYCC + Equivalent to H.273 TransferCharacteristics code point 13 with + MatrixCoefficients set to anything but 0. + + + + + Transfer characteristics as defined by + - SMPTE ST 2084 (2014) for 10-, 12-, 14- and 16-bit systems + - Rec. ITU-R BT.2100-2 perceptual quantization (PQ) system + Equivalent to H.273 TransferCharacteristics code point 16. + + This TF implies these default luminances + - primary color volume minimum: 0.005 cd/m² + - primary color volume maximum: 10000 cd/m² + - reference white: 203 cd/m² + + + + + Transfer characteristics as defined by + - SMPTE ST 428-1 (2019) + Equivalent to H.273 TransferCharacteristics code point 17. + + + + + Transfer characteristics as defined by + - ARIB STD-B67 (2015) + - Rec. ITU-R BT.2100-2 hybrid log-gamma (HLG) system + Equivalent to H.273 TransferCharacteristics code point 18. + + This TF implies these default luminances + - primary color volume minimum: 0.005 cd/m² + - primary color volume maximum: 1000 cd/m² + - reference white: 203 cd/m² + Note: HLG is a scene referred signal. All absolute luminance values + used here for HLG assume a 1000 cd/m² display. + + + + + + + This creates a new xx_color_management_output_v4 object for the + given wl_output. + + See the xx_color_management_output_v4 interface for more details. + + + + + + + + + If a xx_color_management_surface_v4 object already exists for the given + wl_surface, the protocol error surface_exists is raised. + + This creates a new color xx_color_management_surface_v4 object for the + given wl_surface. + + See the xx_color_management_surface_v4 interface for more details. + + + + + + + + + This creates a new color xx_color_management_feedback_surface_v4 object + for the given wl_surface. + + See the xx_color_management_feedback_surface_v4 interface for more + details. + + + + + + + + + Makes a new ICC-based image description creator object with all + properties initially unset. The client can then use the object's + interface to define all the required properties for an image description + and finally create a xx_image_description_v4 object. + + This request can be used when the compositor advertises + xx_color_manager_v4.feature.icc_v2_v4. + Otherwise this request raises the protocol error unsupported_feature. + + + + + + + + Makes a new parametric image description creator object with all + properties initially unset. The client can then use the object's + interface to define all the required properties for an image description + and finally create a xx_image_description_v4 object. + + This request can be used when the compositor advertises + xx_color_manager_v4.feature.parametric. + Otherwise this request raises the protocol error unsupported_feature. + + + + + + + + When this object is created, it shall immediately send this event once + for each rendering intent the compositor supports. + + + + + + + + When this object is created, it shall immediately send this event once + for each compositor supported feature listed in the enumeration. + + + + + + + + When this object is created, it shall immediately send this event once + for each named transfer function the compositor supports with the + parametric image description creator. + + + + + + + + When this object is created, it shall immediately send this event once + for each named set of primaries the compositor supports with the + parametric image description creator. + + + + + + + + + A xx_color_management_output_v4 describes the color properties of an + output. + + The xx_color_management_output_v4 is associated with the wl_output global + underlying the wl_output object. Therefore the client destroying the + wl_output object has no impact, but the compositor removing the output + global makes the xx_color_management_output_v4 object inert. + + + + + Destroy the color xx_color_management_output_v4 object. This does not + affect any remaining protocol objects. + + + + + + This event is sent whenever the image description of the output changed, + followed by one wl_output.done event common to output events across all + extensions. + + If the client wants to use the updated image description, it needs to do + get_image_description again, because image description objects are + immutable. + + + + + + This creates a new xx_image_description_v4 object for the current image + description of the output. There always is exactly one image description + active for an output so the client should destroy the image description + created by earlier invocations of this request. This request is usually + sent as a reaction to the image_description_changed event or when + creating a xx_color_management_output_v4 object. + + The image description of an output represents the color encoding the + output expects. There might be performance and power advantages, as well + as improved color reproduction, if a content update matches the image + description of the output it is being shown on. If a content update is + shown on any other output than the one it matches the image description + of, then the color reproduction on those outputs might be considerably + worse. + + The created xx_image_description_v4 object preserves the image + description of the output from the time the object was created. + + The resulting image description object allows get_information request. + + If this protocol object is inert, the resulting image description object + shall immediately deliver the xx_image_description_v4.failed event with + the no_output cause. + + If the interface version is inadequate for the output's image + description, meaning that the client does not support all the events + needed to deliver the crucial information, the resulting image + description object shall immediately deliver the + xx_image_description_v4.failed event with the low_version cause. + + Otherwise the object shall immediately deliver the ready event. + + + + + + + + + A xx_color_management_surface_v4 allows the client to set the color + space and HDR properties of a surface. + + If the wl_surface associated with the xx_color_management_surface_v4 is + destroyed, the xx_color_management_surface_v4 object becomes inert. + + + + + Destroy the xx_color_management_surface_v4 object and do the same as + unset_image_description. + + + + + + + + + + + + Set the image description of the underlying surface. The image + description and rendering intent are double-buffered state, see + wl_surface.commit. + + It is the client's responsibility to understand the image description + it sets on a surface, and to provide content that matches that image + description. Compositors might convert images to match their own or any + other image descriptions. + + Image description whose creation gracefully failed (received + xx_image_description_v4.failed) are forbidden in this request, and in + such case the protocol error image_description is raised. + + All image descriptions whose creation succeeded (received + xx_image_description_v4.ready) are allowed and must always be accepted + by the compositor. + + A rendering intent provides the client's preference on how content + colors should be mapped to each output. The render_intent value must + be one advertised by the compositor with + xx_color_manager_v4.render_intent event, otherwise the protocol error + render_intent is raised. + + By default, a surface does not have an associated image description + nor a rendering intent. The handling of color on such surfaces is + compositor implementation defined. Compositors should handle such + surfaces as sRGB but may handle them differently if they have specific + requirements. + + + + + + + + + This request removes any image description from the surface. See + set_image_description for how a compositor handles a surface without + an image description. This is double-buffered state, see + wl_surface.commit. + + + + + + + A xx_color_management_feedback_surface_v4 allows the client to get the + preferred color description of a surface. + + If the wl_surface associated with this object is destroyed, the + xx_color_management_feedback_surface_v4 object becomes inert. + + + + + Destroy the xx_color_management_feedback_surface_v4 object. + + + + + + + + + + + The preferred image description is the one which likely has the most + performance and/or quality benefits for the compositor if used by the + client for its wl_surface contents. This event is sent whenever the + compositor changes the wl_surface's preferred image description. + + This event is merely a notification. When the client wants to know + what the preferred image description is, it shall use the get_preferred + request. + + The preferred image description is not automatically used for anything. + It is only a hint, and clients may set any valid image description with + set_image_description but there might be performance and color accuracy + improvements by providing the wl_surface contents in the preferred + image description. Therefore clients that can, should render according + to the preferred image description + + + + + + If this protocol object is inert, the protocol error inert is raised. + + The preferred image description represents the compositor's preferred + color encoding for this wl_surface at the current time. There might be + performance and power advantages, as well as improved color + reproduction, if the image description of a content update matches the + preferred image description. + + This creates a new xx_image_description_v4 object for the currently + preferred image description for the wl_surface. The client should + stop using and destroy the image descriptions created by earlier + invocations of this request for the associated wl_surface. + This request is usually sent as a reaction to the preferred_changed + event or when creating a xx_color_management_feedback_surface_v4 object + if the client is capable of adapting to image descriptions. + + The created xx_image_description_v4 object preserves the preferred image + description of the wl_surface from the time the object was created. + + The resulting image description object allows get_information request. + + If the interface version is inadequate for the preferred image + description, meaning that the client does not support all the + events needed to deliver the crucial information, the resulting image + description object shall immediately deliver the + xx_image_description_v4.failed event with the low_version cause, + otherwise the object shall immediately deliver the ready event. + + + + + + + + + This type of object is used for collecting all the information required + to create a xx_image_description_v4 object from an ICC file. A complete + set of required parameters consists of these properties: + - ICC file + + Each required property must be set exactly once if the client is to create + an image description. The set requests verify that a property was not + already set. The create request verifies that all required properties are + set. There may be several alternative requests for setting each property, + and in that case the client must choose one of them. + + Once all properties have been set, the create request must be used to + create the image description object, destroying the creator in the + process. + + + + + + + + + + + + + + + Create an image description object based on the ICC information + previously set on this object. A compositor must parse the ICC data in + some undefined but finite amount of time. + + The completeness of the parameter set is verified. If the set is not + complete, the protocol error incomplete_set is raised. For the + definition of a complete set, see the description of this interface. + + If the particular combination of the information is not supported + by the compositor, the resulting image description object shall + immediately deliver the xx_image_description_v4.failed event with the + 'unsupported' cause. If a valid image description was created from the + information, the xx_image_description_v4.ready event will eventually + be sent instead. + + This request destroys the xx_image_description_creator_icc_v4 object. + + The resulting image description object does not allow get_information + request. + + + + + + + + Sets the ICC profile file to be used as the basis of the image + description. + + The data shall be found through the given fd at the given offset, having + the given length. The fd must seekable and readable. Violating these + requirements raises the bad_fd protocol error. + + If reading the data fails due to an error independent of the client, the + compositor shall send the xx_image_description_v4.failed event on the + created xx_image_description_v4 with the 'operating_system' cause. + + The maximum size of the ICC profile is 4 MB. If length is greater than + that or zero, the protocol error bad_size is raised. If offset + length + exceeds the file size, the protocol error out_of_file is raised. + + A compositor may read the file at any time starting from this request + and only until whichever happens first: + - If create request was issued, the xx_image_description_v4 object + delivers either failed or ready event; or + - if create request was not issued, this + xx_image_description_creator_icc_v4 object is destroyed. + + A compositor shall not modify the contents of the file, and the fd may + be sealed for writes and size changes. The client must ensure to its + best ability that the data does not change while the compositor is + reading it. + + The data must represent a valid ICC profile. The ICC profile version + must be 2 or 4, it must be a 3 channel profile and the class must be + Display or ColorSpace. Violating these requirements will not result in a + protocol error but will eventually send the + xx_image_description_v4.failed event on the created + xx_image_description_v4 with the 'unsupported' cause. + + See the International Color Consortium specification ICC.1:2022 for more + details about ICC profiles. + + If ICC file has already been set on this object, the protocol error + already_set is raised. + + + + + + + + + + + This type of object is used for collecting all the parameters required + to create a xx_image_description_v4 object. A complete set of required + parameters consists of these properties: + - transfer characteristic function (tf) + - chromaticities of primaries and white point (primary color volume) + + The following properties are optional and have a well-defined default + if not explicitly set: + - primary color volume luminance range + - reference white luminance level + - mastering display primaries and white point (target color volume) + - mastering luminance range + - maximum content light level + - maximum frame-average light level + + Each required property must be set exactly once if the client is to create + an image description. The set requests verify that a property was not + already set. The create request verifies that all required properties are + set. There may be several alternative requests for setting each property, + and in that case the client must choose one of them. + + Once all properties have been set, the create request must be used to + create the image description object, destroying the creator in the + process. + + + + + + + + + + + + + + + + + + Create an image description object based on the parameters previously + set on this object. + + The completeness of the parameter set is verified. If the set is not + complete, the protocol error incomplete_set is raised. For the + definition of a complete set, see the description of this interface. + + Also, the combination of the parameter set is verified. If the set is + not consistent, the protocol error inconsistent_set is raised. + + If the particular combination of the parameter set is not supported + by the compositor, the resulting image description object shall + immediately deliver the xx_image_description_v4.failed event with the + 'unsupported' cause. If a valid image description was created from the + parameter set, the xx_image_description_v4.ready event will eventually + be sent instead. + + This request destroys the xx_image_description_creator_params_v4 + object. + + The resulting image description object does not allow get_information + request. + + + + + + + + Sets the transfer characteristic using explicitly enumerated named + functions. + + When the resulting image description is attached to an image, the + content should be encoded and decoded according to the industry standard + practices for the transfer characteristic. + + Only names advertised with xx_color_manager_v4 event supported_tf_named + are allowed. Other values shall raise the protocol error invalid_tf. + + If transfer characteristic has already been set on this object, the + protocol error already_set is raised. + + + + + + + + Sets the color component transfer characteristic to a power curve with + the given exponent. This curve represents the conversion from electrical + to optical pixel or color values. + + When the resulting image description is attached to an image, the + content should be encoded with the inverse of the power curve. + + The curve exponent shall be multiplied by 10000 to get the argument eexp + value to carry the precision of 4 decimals. + + The curve exponent must be at least 1.0 and at most 10.0. Otherwise the + protocol error invalid_tf is raised. + + If transfer characteristic has already been set on this object, the + protocol error already_set is raised. + + This request can be used when the compositor advertises + xx_color_manager_v4.feature.set_tf_power. Otherwise this request raises + the protocol error unsupported_feature. + + + + + + + + Sets the color primaries and white point using explicitly named sets. + This describes the primary color volume which is the basis for color + value encoding. + + Only names advertised with xx_color_manager_v4 event + supported_primaries_named are allowed. Other values shall raise the + protocol error invalid_primaries. + + If primaries have already been set on this object, the protocol error + already_set is raised. + + + + + + + + Sets the color primaries and white point using CIE 1931 xy chromaticity + coordinates. This describes the primary color volume which is the basis + for color value encoding. + + Each coordinate value is multiplied by 10000 to get the argument value + to carry precision of 4 decimals. + + If primaries have already been set on this object, the protocol error + already_set is raised. + + This request can be used if the compositor advertises + xx_color_manager_v4.feature.set_primaries. Otherwise this request raises + the protocol error unsupported_feature. + + + + + + + + + + + + + + + Sets the primary color volume luminance range and the reference white + luminance level. + + The default luminances are + - primary color volume minimum: 0.2 cd/m² + - primary color volume maximum: 80 cd/m² + - reference white: 80 cd/m² + + Setting a named transfer characteristic can imply other default + luminances. + + The default luminances get overwritten when this request is used. + + 'min_lum' and 'max_lum' specify the minimum and maximum luminances of + the primary color volume as reproduced by the targeted display. + + 'reference_lum' specifies the luminance of the reference white as + reproduced by the targeted display, and reflects the targeted viewing + environment. + + Compositors should make sure that all content is anchored, meaning that + an input signal level of 'reference_lum' on one image description and + another input signal level of 'reference_lum' on another image + description should produce the same output level, even though the + 'reference_lum' on both image representations can be different. + + If 'max_lum' is less than the 'reference_lum', or 'reference_lum' is + less than or equal to 'min_lum', the protocol error invalid_luminance is + raised. + + The minimum luminance is multiplied by 10000 to get the argument + 'min_lum' value and carries precision of 4 decimals. The maximum + luminance and reference white luminance values are unscaled. + + If the primary color volume luminance range and the reference white + luminance level have already been set on this object, the protocol error + already_set is raised. + + This request can be used if the compositor advertises + xx_color_manager_v4.feature.set_luminances. Otherwise this request + raises the protocol error unsupported_feature. + + + + + + + + + + Provides the color primaries and white point of the mastering display + using CIE 1931 xy chromaticity coordinates. This is compatible with the + SMPTE ST 2086 definition of HDR static metadata. + + The mastering display primaries define the target color volume. + + If mastering display primaries are not explicitly set, the target color + volume is assumed to be equal to the primary color volume. + + The target color volume is defined by all tristimulus values between 0.0 + and 1.0 (inclusive) of the color space defined by the given mastering + display primaries and white point. The colorimetry is identical between + the container color space and the mastering display color space, + including that no chromatic adaptation is applied even if the white + points differ. + + The target color volume can exceed the primary color volume to allow for + a greater color volume with an existing color space definition (for + example scRGB). It can be smaller than the primary color volume to + minimize gamut and tone mapping distances for big color spaces (HDR + metadata). + + To make use of the entire target color volume a suitable pixel format + has to be chosen (e.g. floating point to exceed the primary color + volume, or abusing limited quantization range as with xvYCC). + + Each coordinate value is multiplied by 10000 to get the argument value + to carry precision of 4 decimals. + + If mastering display primaries have already been set on this object, the + protocol error already_set is raised. + + This request can be used if the compositor advertises + xx_color_manager_v4.feature.set_mastering_display_primaries. Otherwise + this request raises the protocol error unsupported_feature. The + advertisement implies support only for target color volumes fully + contained within the primary color volume. + + If a compositor additionally supports target color volume exceeding the + primary color volume, it must advertise + xx_color_manager_v4.feature.extended_target_volume. If a client uses + target color volume exceeding the primary color volume and the + compositor does not support it, the result is implementation defined. + Compositors are recommended to detect this case and fail the image + description gracefully, but it may as well result in color artifacts. + + + + + + + + + + + + + + + Sets the luminance range that was used during the content mastering + process as the minimum and maximum absolute luminance L. This is + compatible with the SMPTE ST 2086 definition of HDR static metadata. + + The mastering luminance range is undefined by default. + + If max L is less than or equal to min L, the protocol error + invalid_luminance is raised. + + Min L value is multiplied by 10000 to get the argument min_lum value + and carry precision of 4 decimals. Max L value is unscaled for max_lum. + + + + + + + + + Sets the maximum content light level (max_cll) as defined by CTA-861-H. + + This can only be set when set_tf_cicp is used to set the transfer + characteristic to Rec. ITU-R BT.2100-2 perceptual quantization system. + Otherwise, 'create' request shall raise inconsistent_set protocol + error. + + max_cll is undefined by default. + + + + + + + + Sets the maximum frame-average light level (max_fall) as defined by + CTA-861-H. + + This can only be set when set_tf_cicp is used to set the transfer + characteristic to Rec. ITU-R BT.2100-2 perceptual quantization system. + Otherwise, 'create' request shall raise inconsistent_set protocol error. + + max_fall is undefined by default. + + + + + + + + + An image description carries information about the color encoding used on + a surface when attached to a wl_surface via + xx_color_management_surface_v4.set_image_description. A compositor can use + this information to decode pixel values into colorimetrically meaningful + quantities. + + Note, that the xx_image_description_v4 object is not ready to be used + immediately after creation. The object eventually delivers either the + 'ready' or the 'failed' event, specified in all requests creating it. The + object is deemed "ready" after receiving the 'ready' event. + + An object which is not ready is illegal to use, it can only be destroyed. + Any other request in this interface shall result in the 'not_ready' + protocol error. Attempts to use an object which is not ready through other + interfaces shall raise protocol errors defined there. + + Once created and regardless of how it was created, a + xx_image_description_v4 object always refers to one fixed image + description. It cannot change after creation. + + + + + Destroy this object. It is safe to destroy an object which is not ready. + + Destroying a xx_image_description_v4 object has no side-effects, not + even if a xx_color_management_surface_v4.set_image_description has not + yet been followed by a wl_surface.commit. + + + + + + + + + + + + + + + + + + + + + + If creating a xx_image_description_v4 object fails for a reason that is + not defined as a protocol error, this event is sent. + + The requests that create image description objects define whether and + when this can occur. Only such creation requests can trigger this event. + This event cannot be triggered after the image description was + successfully formed. + + Once this event has been sent, the xx_image_description_v4 object will + never become ready and it can only be destroyed. + + + + + + + + + Once this event has been sent, the xx_image_description_v4 object is + deemed "ready". Ready objects can be used to send requests and can be + used through other interfaces. + + Every ready xx_image_description_v4 protocol object refers to an + underlying image description record in the compositor. Multiple protocol + objects may end up referring to the same record. Clients may identify + these "copies" by comparing their id numbers: if the numbers from two + protocol objects are identical, the protocol objects refer to the same + image description record. Two different image description records + cannot have the same id number simultaneously. The id number does not + change during the lifetime of the image description record. + + The id number is valid only as long as the protocol object is alive. If + all protocol objects referring to the same image description record are + destroyed, the id number may be recycled for a different image + description record. + + Image description id number is not a protocol object id. Zero is + reserved as an invalid id number. It shall not be possible for a client + to refer to an image description by its id number in protocol. The id + numbers might not be portable between Wayland connections. + + This identity allows clients to de-duplicate image description records + and avoid get_information request if they already have the image + description information. + + + + + + + + Creates a xx_image_description_info_v4 object which delivers the + information that makes up the image description. + + Not all image description protocol objects allow get_information + request. Whether it is allowed or not is defined by the request that + created the object. If get_information is not allowed, the protocol + error no_information is raised. + + + + + + + + + Sends all matching events describing an image description object exactly + once and finally sends the 'done' event. + + Once a xx_image_description_info_v4 object has delivered a 'done' event it + is automatically destroyed. + + Every xx_image_description_info_v4 created from the same + xx_image_description_v4 shall always return the exact same data. + + + + + Signals the end of information events and destroys the object. + + + + + + The icc argument provides a file descriptor to the client which may be + memory-mapped to provide the ICC profile matching the image description. + The fd is read-only, and if mapped then it must be mapped with + MAP_PRIVATE by the client. + + The ICC profile version and other details are determined by the + compositor. There is no provision for a client to ask for a specific + kind of a profile. + + + + + + + + + + Delivers the primary color volume primaries and white point using CIE + 1931 xy chromaticity coordinates. + + Each coordinate value is multiplied by 10000 to get the argument value + to carry precision of 4 decimals. + + + + + + + + + + + + + + + Delivers the primary color volume primaries and white point using an + explicitly enumerated named set. + + + + + + + + The color component transfer characteristic of this image description is + a pure power curve. This event provides the exponent of the power + function. This curve represents the conversion from electrical to + optical pixel or color values. + + The curve exponent has been multiplied by 10000 to get the argument eexp + value to carry the precision of 4 decimals. + + + + + + + + Delivers the transfer characteristic using an explicitly enumerated + named function. + + + + + + + + Delivers the primary color volume luminance range and the reference + white luminance level. + + The minimum luminance is multiplied by 10000 to get the argument + 'min_lum' value and carries precision of 4 decimals. The maximum + luminance and reference white luminance values are unscaled. + + + + + + + + + + Provides the color primaries and white point of the target color volume + using CIE 1931 xy chromaticity coordinates. This is compatible with the + SMPTE ST 2086 definition of HDR static metadata for mastering displays. + + While primary color volume is about how color is encoded, the target + color volume is the actually displayable color volume. If target color + volume is equal to the primary color volume, then this event is not + sent. + + Each coordinate value is multiplied by 10000 to get the argument value + to carry precision of 4 decimals. + + + + + + + + + + + + + + + Provides the luminance range that the image description is targeting as + the minimum and maximum absolute luminance L. This is compatible with + the SMPTE ST 2086 definition of HDR static metadata. + + This luminance range is only theoretical and may not correspond to the + luminance of light emitted on an actual display. + + Min L value is multiplied by 10000 to get the argument min_lum value and + carry precision of 4 decimals. Max L value is unscaled for max_lum. + + + + + + + + + Provides the targeted max_cll of the image description. max_cll is + defined by CTA-861-H. + + This luminance is only theoretical and may not correspond to the + luminance of light emitted on an actual display. + + + + + + + + Provides the targeted max_fall of the image description. max_fall is + defined by CTA-861-H. + + This luminance is only theoretical and may not correspond to the + luminance of light emitted on an actual display. + + + + + + diff --git a/src/plugins/platforms/wayland/CMakeLists.txt b/src/plugins/platforms/wayland/CMakeLists.txt index 9b1c84f7414..4c62dc78ca2 100644 --- a/src/plugins/platforms/wayland/CMakeLists.txt +++ b/src/plugins/platforms/wayland/CMakeLists.txt @@ -28,6 +28,7 @@ qt_internal_add_module(WaylandClient qwaylandabstractdecoration.cpp qwaylandabstractdecoration_p.h qwaylandappmenu.cpp qwaylandappmenu_p.h qwaylandbuffer.cpp qwaylandbuffer_p.h + qwaylandcolormanagement.cpp qwaylandcolormanagement_p.h qwaylanddatacontrolv1.cpp qwaylanddatacontrolv1_p.h qwaylanddecorationfactory.cpp qwaylanddecorationfactory_p.h qwaylanddecorationplugin.cpp qwaylanddecorationplugin_p.h @@ -121,6 +122,7 @@ qt6_generate_wayland_protocol_client_sources(WaylandClient ${CMAKE_CURRENT_SOURCE_DIR}/../extensions/touch-extension.xml ${CMAKE_CURRENT_SOURCE_DIR}/hardwareintegration/../../extensions/hardware-integration.xml ${CMAKE_CURRENT_SOURCE_DIR}/hardwareintegration/../../extensions/server-buffer-extension.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/color-management/xx-color-management-v4.xml ) #### Keys ignored in scope 1:.:.:client.pro:: diff --git a/src/plugins/platforms/wayland/qwaylandcolormanagement.cpp b/src/plugins/platforms/wayland/qwaylandcolormanagement.cpp new file mode 100644 index 00000000000..f0e9bd9a21d --- /dev/null +++ b/src/plugins/platforms/wayland/qwaylandcolormanagement.cpp @@ -0,0 +1,252 @@ +// Copyright (C) 2024 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#include "qwaylandcolormanagement_p.h" +#include "qwaylanddisplay_p.h" + +#include + +QT_BEGIN_NAMESPACE + +namespace QtWaylandClient { + +ColorManager::ColorManager(struct ::wl_registry *registry, uint32_t id, int version) + : QtWayland::xx_color_manager_v4(registry, id, version) +{ +} + +ColorManager::~ColorManager() +{ + destroy(); +} + +void ColorManager::xx_color_manager_v4_supported_feature(uint32_t feature) +{ + switch (feature) { + case feature_icc_v2_v4: + mFeatures |= Feature::ICC; + break; + case feature_parametric: + mFeatures |= Feature::Parametric; + break; + case feature_set_primaries: + mFeatures |= Feature::SetPrimaries; + break; + case feature_set_tf_power: + mFeatures |= Feature::PowerTransferFunction; + break; + case feature_set_luminances: + mFeatures |= Feature::SetLuminances; + break; + case feature_set_mastering_display_primaries: + mFeatures |= Feature::SetMasteringDisplayPrimaries; + break; + case feature_extended_target_volume: + mFeatures |= Feature::ExtendedTargetVolume; + break; + } +} + +void ColorManager::xx_color_manager_v4_supported_primaries_named(uint32_t primaries) +{ + mPrimaries.push_back(QtWayland::xx_color_manager_v4::primaries(primaries)); +} + +void ColorManager::xx_color_manager_v4_supported_tf_named(uint32_t transferFunction) +{ + mTransferFunctions.push_back(QtWayland::xx_color_manager_v4::transfer_function(transferFunction)); +} + +ColorManager::Features ColorManager::supportedFeatures() const +{ + return mFeatures; +} + +bool ColorManager::supportsNamedPrimary(QtWayland::xx_color_manager_v4::primaries primaries) const +{ + return mPrimaries.contains(primaries); +} + +bool ColorManager::supportsTransferFunction(QtWayland::xx_color_manager_v4::transfer_function transferFunction) const +{ + return mTransferFunctions.contains(transferFunction); +} + +std::unique_ptr ColorManager::createImageDescription(const QColorSpace &colorspace) +{ + if (!(mFeatures & Feature::Parametric)) + return nullptr; + + constexpr std::array primaryMapping = { + std::make_pair(QColorSpace::Primaries::SRgb, primaries_srgb), + std::make_pair(QColorSpace::Primaries::AdobeRgb, primaries_adobe_rgb), + std::make_pair(QColorSpace::Primaries::DciP3D65, primaries_display_p3), + std::make_pair(QColorSpace::Primaries::Bt2020, primaries_bt2020), + }; + const auto primary = std::find_if(primaryMapping.begin(), primaryMapping.end(), [&colorspace](const auto &pair) { + return pair.first == colorspace.primaries(); + }); + if (!(supportedFeatures() & Feature::SetPrimaries) && (primary != primaryMapping.end() || !supportsNamedPrimary(primary->second))) + return nullptr; + + constexpr std::array tfMapping = { + std::make_pair(QColorSpace::TransferFunction::Linear, transfer_function_linear), + std::make_pair(QColorSpace::TransferFunction::SRgb, transfer_function_srgb), + std::make_pair(QColorSpace::TransferFunction::St2084, transfer_function_st2084_pq), + std::make_pair(QColorSpace::TransferFunction::Hlg, transfer_function_hlg), + }; + const auto tfIt = std::find_if(tfMapping.begin(), tfMapping.end(), [&colorspace](const auto &pair) { + return pair.first == colorspace.transferFunction(); + }); + auto transferFunction = tfIt == tfMapping.end() ? std::nullopt : std::make_optional(tfIt->second); + if (colorspace.transferFunction() == QColorSpace::TransferFunction::Gamma) { + if (qFuzzyCompare(colorspace.gamma(), 2.2f) && supportsTransferFunction(transfer_function_gamma22)) + transferFunction = transfer_function_gamma22; + else if (qFuzzyCompare(colorspace.gamma(), 2.8f) && supportsTransferFunction(transfer_function_gamma28)) + transferFunction = transfer_function_gamma28; + if (!transferFunction && !(mFeatures & Feature::PowerTransferFunction)) + return nullptr; + } else if (!transferFunction) { + return nullptr; + } + + auto creator = new_parametric_creator(); + if (primary != primaryMapping.end()) { + xx_image_description_creator_params_v4_set_primaries_named(creator, primary->second); + } else { + const auto primaries = colorspace.primaryPoints(); + xx_image_description_creator_params_v4_set_primaries(creator, + std::round(10'000 * primaries.redPoint.x()), std::round(10'000 * primaries.redPoint.y()), + std::round(10'000 * primaries.greenPoint.x()), std::round(10'000 * primaries.greenPoint.y()), + std::round(10'000 * primaries.bluePoint.x()), std::round(10'000 * primaries.bluePoint.y()), + std::round(10'000 * primaries.whitePoint.x()), std::round(10'000 * primaries.whitePoint.y()) + ); + } + if (transferFunction) { + xx_image_description_creator_params_v4_set_tf_named(creator, *transferFunction); + } else { + Q_ASSERT(colorspace.transferFunction() == QColorSpace::TransferFunction::Gamma); + xx_image_description_creator_params_v4_set_tf_power(creator, std::round(colorspace.gamma() * 10'000)); + } + return std::make_unique(xx_image_description_creator_params_v4_create(creator)); +} + +ImageDescriptionInfo::ImageDescriptionInfo(ImageDescription *descr) + : QtWayland::xx_image_description_info_v4(descr->get_information()) +{ +} + +ImageDescriptionInfo::~ImageDescriptionInfo() +{ + xx_image_description_info_v4_destroy(object()); +} + +void ImageDescriptionInfo::xx_image_description_info_v4_done() +{ + Q_EMIT done(); +} + +void ImageDescriptionInfo::xx_image_description_info_v4_primaries(int32_t r_x, int32_t r_y, int32_t g_x, int32_t g_y, int32_t b_x, int32_t b_y, int32_t w_x, int32_t w_y) +{ + mContainerRed = QPointF(r_x, r_y) / 10'000.0; + mContainerGreen = QPointF(g_x, g_y) / 10'000.0; + mContainerBlue = QPointF(b_x, b_y) / 10'000.0; + mContainerWhite = QPointF(w_x, w_y) / 10'000.0; +} + +void ImageDescriptionInfo::xx_image_description_info_v4_tf_named(uint32_t transferFunction) +{ + mTransferFunction = transferFunction; +} + +void ImageDescriptionInfo::xx_image_description_info_v4_luminances(uint32_t min_lum, uint32_t max_lum, uint32_t reference_lum) +{ + mMinLuminance = min_lum / 10'000.0; + mMaxLuminance = max_lum; + mReferenceLuminance = reference_lum; +} + +void ImageDescriptionInfo::xx_image_description_info_v4_target_primaries(int32_t r_x, int32_t r_y, int32_t g_x, int32_t g_y, int32_t b_x, int32_t b_y, int32_t w_x, int32_t w_y) +{ + mTargetRed = QPointF(r_x, r_y) / 10'000.0; + mTargetGreen = QPointF(g_x, g_y) / 10'000.0; + mTargetBlue = QPointF(b_x, b_y) / 10'000.0; + mTargetWhite = QPointF(w_x, w_y) / 10'000.0; +} + +void ImageDescriptionInfo::xx_image_description_info_v4_target_luminance(uint32_t min_lum, uint32_t max_lum) +{ + mTargetMinLuminance = min_lum / 10'000.0; + mTargetMaxLuminance = max_lum; +} + +ImageDescription::ImageDescription(::xx_image_description_v4 *descr) + : QtWayland::xx_image_description_v4(descr) +{ +} + +ImageDescription::~ImageDescription() +{ + xx_image_description_v4_destroy(object()); +} + +void ImageDescription::xx_image_description_v4_failed(uint32_t cause, const QString &msg) +{ + Q_UNUSED(cause); + qCWarning(lcQpaWayland) << "image description failed!" << msg; + // TODO handle this, somehow + // maybe fall back to the previous or preferred image description +} + +void ImageDescription::xx_image_description_v4_ready(uint32_t identity) +{ + Q_UNUSED(identity); + Q_EMIT ready(); +} + +ColorManagementFeedback::ColorManagementFeedback(::xx_color_management_feedback_surface_v4 *obj) + : QtWayland::xx_color_management_feedback_surface_v4(obj) + , mPreferred(std::make_unique(get_preferred())) +{ +} + +ColorManagementFeedback::~ColorManagementFeedback() +{ + xx_color_management_feedback_surface_v4_destroy(object()); +} + +void ColorManagementFeedback::xx_color_management_feedback_surface_v4_preferred_changed() +{ + mPreferred = std::make_unique(get_preferred()); + mPendingPreferredInfo = std::make_unique(mPreferred.get()); + connect(mPendingPreferredInfo.get(), &ImageDescriptionInfo::done, this, &ColorManagementFeedback::preferredChanged); +} + +void ColorManagementFeedback::handlePreferredDone() +{ + mPreferredInfo = std::move(mPendingPreferredInfo); +} + +ColorManagementSurface::ColorManagementSurface(::xx_color_management_surface_v4 *obj) + : QtWayland::xx_color_management_surface_v4(obj) +{ +} + +ColorManagementSurface::~ColorManagementSurface() +{ + xx_color_management_surface_v4_destroy(object()); +} + +void ColorManagementSurface::setImageDescription(ImageDescription *descr) +{ + if (descr) + xx_color_management_surface_v4_set_image_description(object(), descr->object(), QtWayland::xx_color_manager_v4::render_intent::render_intent_perceptual); + else + xx_color_management_surface_v4_unset_image_description(object()); +} + +} + +QT_END_NAMESPACE + +#include "moc_qwaylandcolormanagement_p.cpp" diff --git a/src/plugins/platforms/wayland/qwaylandcolormanagement_p.h b/src/plugins/platforms/wayland/qwaylandcolormanagement_p.h new file mode 100644 index 00000000000..752cbc27f1e --- /dev/null +++ b/src/plugins/platforms/wayland/qwaylandcolormanagement_p.h @@ -0,0 +1,147 @@ +// Copyright (C) 2024 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QWAYLANDCOLORMANAGEMENT_H +#define QWAYLANDCOLORMANAGEMENT_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include +#include +#include +#include + +#include "qwayland-xx-color-management-v4.h" + +QT_BEGIN_NAMESPACE + +namespace QtWaylandClient { + +class ImageDescription; + +class ColorManager : public QObject, public QtWayland::xx_color_manager_v4 +{ + Q_OBJECT +public: + enum class Feature { + ICC = 1 << 0, + Parametric = 1 << 1, + SetPrimaries = 1 << 2, + PowerTransferFunction = 1 << 3, + SetLuminances = 1 << 4, + SetMasteringDisplayPrimaries = 1 << 5, + ExtendedTargetVolume = 1 << 6, + }; + Q_ENUM(Feature); + Q_DECLARE_FLAGS(Features, Feature); + + explicit ColorManager(struct ::wl_registry *registry, uint32_t id, int version); + ~ColorManager() override; + + Features supportedFeatures() const; + bool supportsNamedPrimary(QtWayland::xx_color_manager_v4::primaries primaries) const; + bool supportsTransferFunction(QtWayland::xx_color_manager_v4::transfer_function transferFunction) const; + + std::unique_ptr createImageDescription(const QColorSpace &colorspace); + +private: + void xx_color_manager_v4_supported_feature(uint32_t feature) override; + void xx_color_manager_v4_supported_primaries_named(uint32_t primaries) override; + void xx_color_manager_v4_supported_tf_named(uint32_t transferFunction) override; + + Features mFeatures; + QList mPrimaries; + QList mTransferFunctions; +}; + +class ImageDescriptionInfo : public QObject, public QtWayland::xx_image_description_info_v4 +{ + Q_OBJECT +public: + explicit ImageDescriptionInfo(ImageDescription *descr); + ~ImageDescriptionInfo(); + + Q_SIGNAL void done(); + + uint32_t mTransferFunction = 0; + QPointF mContainerRed; + QPointF mContainerGreen; + QPointF mContainerBlue; + QPointF mContainerWhite; + QPointF mTargetRed; + QPointF mTargetGreen; + QPointF mTargetBlue; + QPointF mTargetWhite; + double mMinLuminance; + double mMaxLuminance; + double mReferenceLuminance; + double mTargetMinLuminance; + double mTargetMaxLuminance; + +private: + void xx_image_description_info_v4_done() override; + void xx_image_description_info_v4_primaries(int32_t r_x, int32_t r_y, int32_t g_x, int32_t g_y, int32_t b_x, int32_t b_y, int32_t w_x, int32_t w_y) override; + void xx_image_description_info_v4_tf_named(uint32_t transferFunction) override; + void xx_image_description_info_v4_luminances(uint32_t min_lum, uint32_t max_lum, uint32_t reference_lum) override; + void xx_image_description_info_v4_target_primaries(int32_t r_x, int32_t r_y, int32_t g_x, int32_t g_y, int32_t b_x, int32_t b_y, int32_t w_x, int32_t w_y) override; + void xx_image_description_info_v4_target_luminance(uint32_t min_lum, uint32_t max_lum) override; +}; + +class ImageDescription : public QObject, public QtWayland::xx_image_description_v4 +{ + Q_OBJECT +public: + explicit ImageDescription(::xx_image_description_v4 *descr); + ~ImageDescription(); + + Q_SIGNAL void ready(); + +private: + void xx_image_description_v4_failed(uint32_t cause, const QString &msg) override; + void xx_image_description_v4_ready(uint32_t identity) override; +}; + +class ColorManagementFeedback : public QObject, public QtWayland::xx_color_management_feedback_surface_v4 +{ + Q_OBJECT +public: + explicit ColorManagementFeedback(::xx_color_management_feedback_surface_v4 *obj); + ~ColorManagementFeedback(); + + Q_SIGNAL void preferredChanged(); + + std::unique_ptr mPreferredInfo; + +private: + void xx_color_management_feedback_surface_v4_preferred_changed() override; + void handlePreferredDone(); + + std::unique_ptr mPreferred; + std::unique_ptr mPendingPreferredInfo; + +}; + +class ColorManagementSurface : public QObject, public QtWayland::xx_color_management_surface_v4 +{ + Q_OBJECT +public: + explicit ColorManagementSurface(::xx_color_management_surface_v4 *obj); + ~ColorManagementSurface(); + + void setImageDescription(ImageDescription *descr); +}; + +} + +QT_END_NAMESPACE + +#endif diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index d7a5920afbf..ae773ed2b04 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -45,6 +45,8 @@ #endif #include "qwaylandqtkey_p.h" +#include "qwaylandcolormanagement_p.h" + #include #include #include @@ -813,6 +815,10 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin inputDevice->setDataControlDevice(mGlobals.dataControlManager->createDevice(inputDevice)); } #endif + } else if (interface == QLatin1String(QtWayland::xx_color_manager_v4::interface()->name)) { + mGlobals.colorManager = std::make_unique(registry, id, 1); + // we need a roundtrip to receive the features the compositor supports + forceRoundTrip(); } mRegistryGlobals.append(RegistryGlobal(id, interface, version, registry)); diff --git a/src/plugins/platforms/wayland/qwaylanddisplay_p.h b/src/plugins/platforms/wayland/qwaylanddisplay_p.h index 1a6a5ba8e91..2cad24dd6a2 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay_p.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay_p.h @@ -92,6 +92,7 @@ class QWaylandShellIntegration; class QWaylandCursor; class QWaylandCursorTheme; class EventThread; +class ColorManager; typedef void (*RegistryListener)(void *data, struct wl_registry *registry, @@ -226,6 +227,10 @@ public: { return mGlobals.appMenuManager.get(); } + ColorManager *colorManager() const + { + return mGlobals.colorManager.get(); + } struct RegistryGlobal { uint32_t id; @@ -363,6 +368,7 @@ private: std::unique_ptr xdgToplevelDragManager; std::unique_ptr windowManagerIntegration; std::unique_ptr appMenuManager; + std::unique_ptr colorManager; } mGlobals; int mFd = -1; diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index f9acfa76fd1..963a87ba4d1 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -19,6 +19,7 @@ #include "qwaylandshmbackingstore_p.h" #include "qwaylandshellintegration_p.h" #include "qwaylandviewport_p.h" +#include "qwaylandcolormanagement_p.h" #include #include @@ -213,6 +214,11 @@ void QWaylandWindow::initWindow() mSurface->commit(); } +void QWaylandWindow::setPendingImageDescription() +{ + mColorManagementSurface->setImageDescription(mPendingImageDescription.get()); +} + void QWaylandWindow::initializeWlSurface() { Q_ASSERT(!mSurface); @@ -240,6 +246,27 @@ void QWaylandWindow::initializeWlSurface() if (display()->viewporter() && display()->fractionalScaleManager()) { mViewport.reset(new QWaylandViewport(display()->createViewport(this))); } + + QColorSpace requestedColorSpace = window()->requestedFormat().colorSpace(); + if (requestedColorSpace != QColorSpace{} && mDisplay->colorManager()) { + // TODO try a similar (same primaries + supported transfer function) color space if this fails? + mPendingImageDescription = mDisplay->colorManager()->createImageDescription(requestedColorSpace); + if (mPendingImageDescription) { + if (!mColorManagementSurface) + mColorManagementSurface = std::make_unique(mDisplay->colorManager()->get_surface(surface())); + connect(mPendingImageDescription.get(), &ImageDescription::ready, this, &QWaylandWindow::setPendingImageDescription, Qt::SingleShotConnection); + mSurfaceFormat.setColorSpace(requestedColorSpace); + } else { + qCWarning(lcQpaWayland) << "couldn't create image description for requested color space" << requestedColorSpace; + } + } +} + +void QWaylandWindow::setFormat(const QSurfaceFormat &format) +{ + const auto colorSpace = mSurfaceFormat.colorSpace(); + mSurfaceFormat = format; + mSurfaceFormat.setColorSpace(colorSpace); } void QWaylandWindow::setShellIntegration(QWaylandShellIntegration *shellIntegration) @@ -297,6 +324,8 @@ void QWaylandWindow::reset() mSurface.reset(); mViewport.reset(); mFractionalScale.reset(); + mColorManagementSurface.reset(); + mPendingImageDescription.reset(); } emit wlSurfaceDestroyed(); } @@ -1851,6 +1880,11 @@ bool QWaylandWindow::windowEvent(QEvent *event) return QPlatformWindow::windowEvent(event); } +QSurfaceFormat QWaylandWindow::format() const +{ + return mSurfaceFormat; +} + } QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index a1ac7a2d08c..8e0843d89eb 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -60,6 +60,8 @@ class QWaylandPointerGesturePinchEvent; class QWaylandSurface; class QWaylandFractionalScale; class QWaylandViewport; +class ColorManagementSurface; +class ImageDescription; class Q_WAYLANDCLIENT_EXPORT QWaylandWindow : public QNativeInterface::Private::QWaylandWindow, public QPlatformWindow @@ -246,6 +248,8 @@ public: bool windowEvent(QEvent *event) override; + QSurfaceFormat format() const override; + public Q_SLOTS: void applyConfigure(); @@ -256,6 +260,7 @@ Q_SIGNALS: protected: virtual void doHandleFrameCallback(); virtual QRect defaultGeometry() const; + void setFormat(const QSurfaceFormat &format); // this should be called directly for buffer size changes only // use updateExposure for anything affecting the on/off state @@ -345,6 +350,9 @@ protected: Qt::ScreenOrientation mLastReportedContentOrientation = Qt::PrimaryOrientation; + std::unique_ptr mColorManagementSurface; + QSurfaceFormat mSurfaceFormat; + private: void setGeometry_helper(const QRect &rect); void initWindow(); @@ -357,6 +365,7 @@ private: void updateInputRegion(); void updateViewport(); bool calculateExposure() const; + void setPendingImageDescription(); void handleMouseEventWithDecoration(QWaylandInputDevice *inputDevice, const QWaylandPointerEvent &e); void handleScreensChanged(); @@ -370,6 +379,7 @@ private: bool mInResizeFromApplyConfigure = false; bool lastVisible = false; QRect mLastExposeGeometry; + std::unique_ptr mPendingImageDescription; static const wl_callback_listener callbackListener; void handleFrameCallback(struct ::wl_callback* callback); From a99d09f0b3b0bb534680f7ea7fe545119aeb9e27 Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Thu, 2 Jan 2025 03:56:43 +0200 Subject: [PATCH 1467/1507] Client: Prune stale buffers in QWaylandShmBackingStore A backing store may sometimes allocate an extra buffer and keep it even though the buffer is never touched again. This change makes the QWaylandShmBackingStore clean up the old buffers more aggressively. Specifically, * if a buffer is referenced by the compositor and has a different size, there is no need to wait for the buffer to be released, it can be destroyed immediately * if a buffer has not been used for the past 50 frames, it probably won't be used any time soon so it can be disposed Depending on the compositor implementation details, the QWaylandShmBackingStore is likely to hold either one or two buffers now. Note that the backing store can still sometimes have more buffers because Qt widgets not always use QWindow::requestUpdate(). Change-Id: I57428d457d889dd07c4beb641cf380b1aceb88c2 Reviewed-by: David Edmundson --- .../wayland/qwaylandshmbackingstore.cpp | 45 ++++++++++++------- .../wayland/qwaylandshmbackingstore_p.h | 9 ++-- 2 files changed, 34 insertions(+), 20 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp b/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp index b1ae2e1ae4f..1abd6808bbc 100644 --- a/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp +++ b/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp @@ -255,23 +255,33 @@ void QWaylandShmBackingStore::resize(const QSize &size, const QRegion &) QWaylandShmBuffer *QWaylandShmBackingStore::getBuffer(const QSize &size, bool &bufferWasRecreated) { + static const int MAX_BUFFERS = 5; + static const int MAX_AGE = 10 * MAX_BUFFERS; bufferWasRecreated = false; - const auto copy = mBuffers; // remove when ported to vector + remove_if - for (QWaylandShmBuffer *b : copy) { - if (!b->busy()) { - if (b->size() == size) { - return b; - } else { - mBuffers.remove(b); - if (mBackBuffer == b) - mBackBuffer = nullptr; - delete b; - } + // Prune buffers that have not been used in a while or with different size. + for (auto i = mBuffers.size() - 1; i >= 0; --i) { + QWaylandShmBuffer *buffer = mBuffers[i]; + if (buffer->age() > MAX_AGE || buffer->size() != size) { + mBuffers.removeAt(i); + if (mBackBuffer == buffer) + mBackBuffer = nullptr; + delete buffer; } } - static const size_t MAX_BUFFERS = 5; + QWaylandShmBuffer *buffer = nullptr; + for (QWaylandShmBuffer *candidate : std::as_const(mBuffers)) { + if (candidate->busy()) + continue; + + if (!buffer || candidate->age() < buffer->age()) + buffer = candidate; + } + + if (buffer) + return buffer; + if (mBuffers.size() < MAX_BUFFERS) { QImage::Format format = QPlatformScreen::platformScreenForWindow(window())->format(); QWaylandShmBuffer *b = new QWaylandShmBuffer(mDisplay, size, format, waylandWindow()->scale()); @@ -327,11 +337,12 @@ bool QWaylandShmBackingStore::recreateBackBufferIfNeeded() mBackBuffer = buffer; - // ensure the new buffer is at the beginning of the list so next time getBuffer() will pick - // it if possible - if (mBuffers.front() != buffer) { - mBuffers.remove(buffer); - mBuffers.push_front(buffer); + for (QWaylandShmBuffer *buffer : std::as_const(mBuffers)) { + if (mBackBuffer == buffer) { + buffer->setAge(0); + } else { + buffer->setAge(buffer->age() + 1); + } } if (windowDecoration() && window()->isVisible() && oldSizeInBytes != newSizeInBytes) diff --git a/src/plugins/platforms/wayland/qwaylandshmbackingstore_p.h b/src/plugins/platforms/wayland/qwaylandshmbackingstore_p.h index 6d276bf7b30..0f38ba11e23 100644 --- a/src/plugins/platforms/wayland/qwaylandshmbackingstore_p.h +++ b/src/plugins/platforms/wayland/qwaylandshmbackingstore_p.h @@ -22,8 +22,6 @@ #include #include -#include - QT_BEGIN_NAMESPACE namespace QtWaylandClient { @@ -44,12 +42,17 @@ public: QImage *imageInsideMargins(const QMargins &margins); QRegion &dirtyRegion() { return mDirtyRegion; } + + uint age() const { return mAge; } + void setAge(uint age) { mAge = age; } + private: QImage mImage; struct wl_shm_pool *mShmPool = nullptr; QMargins mMargins; QImage *mMarginsImage = nullptr; QRegion mDirtyRegion; + uint mAge = 0; }; class Q_WAYLANDCLIENT_EXPORT QWaylandShmBackingStore : public QPlatformBackingStore @@ -84,7 +87,7 @@ private: QWaylandShmBuffer *getBuffer(const QSize &size, bool &bufferWasRecreated); QWaylandDisplay *mDisplay = nullptr; - std::list mBuffers; + QList mBuffers; QWaylandShmBuffer *mFrontBuffer = nullptr; QWaylandShmBuffer *mBackBuffer = nullptr; bool mPainting = false; From 005927d089c316f502eeb75fdba7be6f448e5cc0 Mon Sep 17 00:00:00 2001 From: Xaver Hugl Date: Thu, 6 Feb 2025 15:34:21 +0100 Subject: [PATCH 1468/1507] client: fix inverted logic in color management code It was meant to return nullptr if the entry was *not* found Change-Id: I69ea904f4a3f61052858b04d018dc2195bc38a8c Reviewed-by: Vlad Zahorodnii --- src/plugins/platforms/wayland/qwaylandcolormanagement.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandcolormanagement.cpp b/src/plugins/platforms/wayland/qwaylandcolormanagement.cpp index f0e9bd9a21d..29e676fef75 100644 --- a/src/plugins/platforms/wayland/qwaylandcolormanagement.cpp +++ b/src/plugins/platforms/wayland/qwaylandcolormanagement.cpp @@ -86,7 +86,7 @@ std::unique_ptr ColorManager::createImageDescription(const QCo const auto primary = std::find_if(primaryMapping.begin(), primaryMapping.end(), [&colorspace](const auto &pair) { return pair.first == colorspace.primaries(); }); - if (!(supportedFeatures() & Feature::SetPrimaries) && (primary != primaryMapping.end() || !supportsNamedPrimary(primary->second))) + if (!(supportedFeatures() & Feature::SetPrimaries) && (primary == primaryMapping.end() || !supportsNamedPrimary(primary->second))) return nullptr; constexpr std::array tfMapping = { From c57da9bb0a2d475b72024997657e250d171dcbaa Mon Sep 17 00:00:00 2001 From: Inho Lee Date: Fri, 17 Jan 2025 11:02:27 +0100 Subject: [PATCH 1469/1507] textinputv3: implement enableSurface() and disableSurface() When enter() happens, it got enabled unconditionally. Then in QWaylandInputContext::setFocusObject(), we need to enable() or disable() it based on real situation.(If previous enter is not valid on the QObject, it will be disabled by disableSurface().) It fixes the issue for wayfire and kwin/plasma 6. Sway still has issues with input method events with popup menu, with and without this patch.(Sway doesn't make keyboard_leave/enter after surface_enter of popups.) See also https://github.com/swaywm/sway/issues/4406 Fixes: QTBUG-132196 Pick-to: 6.9 6.8 Done-with: Liang Qi Change-Id: I5b29a86e0256868c8bcbe48f936c09ee013728a6 Reviewed-by: Liang Qi --- .../wayland/qwaylandinputcontext.cpp | 35 +++++----- .../platforms/wayland/qwaylandtextinputv3.cpp | 65 +++++++++++++++---- .../platforms/wayland/qwaylandtextinputv3_p.h | 6 +- 3 files changed, 74 insertions(+), 32 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandinputcontext.cpp b/src/plugins/platforms/wayland/qwaylandinputcontext.cpp index 4d70f35facc..0ccc4dba57a 100644 --- a/src/plugins/platforms/wayland/qwaylandinputcontext.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputcontext.cpp @@ -189,25 +189,30 @@ void QWaylandInputContext::setFocusObject(QObject *object) QWindow *window = QGuiApplication::focusWindow(); - if (mCurrentWindow && mCurrentWindow->handle()) { - if (mCurrentWindow.data() != window || !inputMethodAccepted()) { - auto *surface = static_cast(mCurrentWindow->handle())->wlSurface(); - if (surface) - inputInterface->disableSurface(surface); - mCurrentWindow.clear(); - } - } - - if (window && window->handle() && inputMethodAccepted()) { + if (window && window->handle()) { if (mCurrentWindow.data() != window) { - auto *surface = static_cast(window->handle())->wlSurface(); - if (surface) { - inputInterface->enableSurface(surface); - mCurrentWindow = window; + if (!inputMethodAccepted()) { + auto *surface = static_cast(window->handle())->wlSurface(); + if (surface) + inputInterface->disableSurface(surface); + mCurrentWindow.clear(); + } else { + auto *surface = static_cast(window->handle())->wlSurface(); + if (surface) { + inputInterface->enableSurface(surface); + mCurrentWindow = window; + } else { + mCurrentWindow.clear(); + } } } - inputInterface->updateState(Qt::ImQueryAll, QWaylandTextInputInterface::update_state_enter); + if (mCurrentWindow) + inputInterface->updateState(Qt::ImQueryAll, QWaylandTextInputInterface::update_state_enter); + return; } + + if (mCurrentWindow) + mCurrentWindow.clear(); } QWaylandTextInputInterface *QWaylandInputContext::textInput() const diff --git a/src/plugins/platforms/wayland/qwaylandtextinputv3.cpp b/src/plugins/platforms/wayland/qwaylandtextinputv3.cpp index b35f05b2f16..a9538370781 100644 --- a/src/plugins/platforms/wayland/qwaylandtextinputv3.cpp +++ b/src/plugins/platforms/wayland/qwaylandtextinputv3.cpp @@ -40,12 +40,16 @@ const Qt::InputMethodQueries supportedQueries3 = Qt::ImEnabled | Qt::ImCursorRectangle; } -void QWaylandTextInputv3::zwp_text_input_v3_enter(struct ::wl_surface *surface) +void QWaylandTextInputv3::enableSurface(::wl_surface *surface) { - qCDebug(qLcQpaWaylandTextInput) << Q_FUNC_INFO << m_surface << surface; + qCDebug(qLcQpaWaylandTextInput) << Q_FUNC_INFO << surface; + + if (m_surface == surface) + return; // already enabled + if (m_surface) + qCWarning(qLcQpaWaylandTextInput()) << Q_FUNC_INFO << "Try to enable surface" << surface << "with focusing surface" << m_surface; m_surface = surface; - m_pendingPreeditString.clear(); m_pendingCommitString.clear(); m_pendingDeleteBeforeText = 0; @@ -55,27 +59,51 @@ void QWaylandTextInputv3::zwp_text_input_v3_enter(struct ::wl_surface *surface) updateState(supportedQueries3, update_state_enter); } +void QWaylandTextInputv3::disableSurface(::wl_surface *surface) +{ + qCDebug(qLcQpaWaylandTextInput) << Q_FUNC_INFO << surface; + + if (!m_surface) + return; // already disabled + if (m_surface != surface) + qCWarning(qLcQpaWaylandTextInput()) << Q_FUNC_INFO << "Try to disable surface" << surface << "with focusing surface" << m_surface; + + m_currentPreeditString.clear(); + m_surface = nullptr; + disable(); + commit(); +} + +void QWaylandTextInputv3::zwp_text_input_v3_enter(struct ::wl_surface *surface) +{ + qCDebug(qLcQpaWaylandTextInput) << Q_FUNC_INFO << m_surface << surface; + + if (m_surface) + qCWarning(qLcQpaWaylandTextInput) << Q_FUNC_INFO << "Got enter event without leaving a surface " << m_surface; + + enableSurface(surface); +} + void QWaylandTextInputv3::zwp_text_input_v3_leave(struct ::wl_surface *surface) { qCDebug(qLcQpaWaylandTextInput) << Q_FUNC_INFO; - if (m_surface != surface) { - qCWarning(qLcQpaWaylandTextInput()) << Q_FUNC_INFO << "Got leave event for surface" << surface << "focused surface" << m_surface; - return; - } + if (!m_surface) + return; // Nothing to leave - m_currentPreeditString.clear(); + if (m_surface != surface) + qCWarning(qLcQpaWaylandTextInput()) << Q_FUNC_INFO << "Got leave event for surface" << surface << "with focusing surface" << m_surface; - m_surface = nullptr; - - disable(); - commit(); - qCDebug(qLcQpaWaylandTextInput) << Q_FUNC_INFO << "Done"; + disableSurface(surface); } void QWaylandTextInputv3::zwp_text_input_v3_preedit_string(const QString &text, int32_t cursorBegin, int32_t cursorEnd) { qCDebug(qLcQpaWaylandTextInput) << Q_FUNC_INFO << text << cursorBegin << cursorEnd; + if (!m_surface) { + qCWarning(qLcQpaWaylandTextInput) << "Got preedit_string event without entering a surface"; + return; + } if (!QGuiApplication::focusObject()) return; @@ -88,6 +116,10 @@ void QWaylandTextInputv3::zwp_text_input_v3_preedit_string(const QString &text, void QWaylandTextInputv3::zwp_text_input_v3_commit_string(const QString &text) { qCDebug(qLcQpaWaylandTextInput) << Q_FUNC_INFO << text; + if (!m_surface) { + qCWarning(qLcQpaWaylandTextInput) << "Got commit_string event without entering a surface"; + return; + } if (!QGuiApplication::focusObject()) return; @@ -98,6 +130,10 @@ void QWaylandTextInputv3::zwp_text_input_v3_commit_string(const QString &text) void QWaylandTextInputv3::zwp_text_input_v3_delete_surrounding_text(uint32_t beforeText, uint32_t afterText) { qCDebug(qLcQpaWaylandTextInput) << Q_FUNC_INFO << beforeText << afterText; + if (!m_surface) { + qCWarning(qLcQpaWaylandTextInput) << "Got delete_surrounding_text event without entering a surface"; + return; + } if (!QGuiApplication::focusObject()) return; @@ -110,6 +146,9 @@ void QWaylandTextInputv3::zwp_text_input_v3_done(uint32_t serial) { qCDebug(qLcQpaWaylandTextInput) << Q_FUNC_INFO << "with serial" << serial << m_currentSerial; + if (!m_surface) + return; + // This is a case of double click. // text_input_v3 will ignore this done signal and just keep the selection of the clicked word. if (m_cursorPos != m_anchorPos && (m_pendingDeleteBeforeText != 0 || m_pendingDeleteAfterText != 0)) { diff --git a/src/plugins/platforms/wayland/qwaylandtextinputv3_p.h b/src/plugins/platforms/wayland/qwaylandtextinputv3_p.h index 4ea82b1f592..9a0d7e8a5f4 100644 --- a/src/plugins/platforms/wayland/qwaylandtextinputv3_p.h +++ b/src/plugins/platforms/wayland/qwaylandtextinputv3_p.h @@ -48,10 +48,8 @@ public: QLocale locale() const override; Qt::LayoutDirection inputDirection() const override; - // doing nothing in zwp_text_input_v3. - // enter() and leave() takes the role to enable/disable the surface - void enableSurface(::wl_surface *) override {}; - void disableSurface(::wl_surface *) override {}; + void enableSurface(::wl_surface *) override; + void disableSurface(::wl_surface *) override; protected: void zwp_text_input_v3_enter(struct ::wl_surface *surface) override; From 8de2aae8c173a52d02e5f4985cb0594a1661cd20 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Fri, 7 Feb 2025 14:13:36 +0100 Subject: [PATCH 1470/1507] Remove qt-key extension This was an extension to make sure we send the full key event the client was running against a Qt Wayland Compositor. But the world has moved on and this is now handled through official extensions. And we have to support multiple third-party compositors, so any issues that occur with key event handling should be handled on a more "official" level. Task-number: QTBUG-133223 Change-Id: I96cf394fa0e79eeaeba6dfec0c0fc81f5320fdd4 Reviewed-by: Vlad Zahorodnii --- .../wayland/extensions/qt-key-unstable-v1.xml | 40 ------------ src/plugins/platforms/wayland/CMakeLists.txt | 2 - .../platforms/wayland/qwaylanddisplay.cpp | 3 - .../platforms/wayland/qwaylanddisplay_p.h | 2 - .../platforms/wayland/qwaylandqtkey.cpp | 61 ------------------- .../platforms/wayland/qwaylandqtkey_p.h | 57 ----------------- 6 files changed, 165 deletions(-) delete mode 100644 src/3rdparty/wayland/extensions/qt-key-unstable-v1.xml delete mode 100644 src/plugins/platforms/wayland/qwaylandqtkey.cpp delete mode 100644 src/plugins/platforms/wayland/qwaylandqtkey_p.h diff --git a/src/3rdparty/wayland/extensions/qt-key-unstable-v1.xml b/src/3rdparty/wayland/extensions/qt-key-unstable-v1.xml deleted file mode 100644 index 23b04648ba0..00000000000 --- a/src/3rdparty/wayland/extensions/qt-key-unstable-v1.xml +++ /dev/null @@ -1,40 +0,0 @@ - - - - Copyright (C) 2018 The Qt Company Ltd. - SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause - - - - - This protocol is independent of the Wayland seat concept. Its - intention is to let a QKeyEvent be transferred from a Qt compositor - to a Qt client without losing or adding false information by going - through wl_seat and wl_keyboard. - - Note: This protocol is considered private to Qt. We will do our - best to bump version numbers when we make backwards compatible - changes, bump the protocol name and interface suffixes when we make - backwards incompatible changes, but we provide no guarantees. We - may also remove the protocol without warning. Implement this at - your own risk. - - - - The key event notifies the client that a QKeyEvent has occurred on - the server side. - - - - - - - - - - - - - - - diff --git a/src/plugins/platforms/wayland/CMakeLists.txt b/src/plugins/platforms/wayland/CMakeLists.txt index 4c62dc78ca2..0018f71307d 100644 --- a/src/plugins/platforms/wayland/CMakeLists.txt +++ b/src/plugins/platforms/wayland/CMakeLists.txt @@ -45,7 +45,6 @@ qt_internal_add_module(WaylandClient qwaylandnativeinterface.cpp qwaylandnativeinterface_p.h qwaylandplatformservices.cpp qwaylandplatformservices_p.h qwaylandpointergestures.cpp qwaylandpointergestures_p.h - qwaylandqtkey.cpp qwaylandqtkey_p.h qwaylandscreen.cpp qwaylandscreen_p.h qwaylandshellsurface.cpp qwaylandshellsurface_p.h qwaylandshm.cpp qwaylandshm_p.h @@ -116,7 +115,6 @@ qt6_generate_wayland_protocol_client_sources(WaylandClient ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/xdg-shell/xdg-shell.xml ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/xdg-system-bell/xdg-system-bell-v1.xml ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/xdg-toplevel-drag/xdg-toplevel-drag-v1.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../extensions/qt-key-unstable-v1.xml ${CMAKE_CURRENT_SOURCE_DIR}/../extensions/qt-text-input-method-unstable-v1.xml ${CMAKE_CURRENT_SOURCE_DIR}/../extensions/qt-windowmanager.xml ${CMAKE_CURRENT_SOURCE_DIR}/../extensions/touch-extension.xml diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index ae773ed2b04..1ff7d25141d 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -43,7 +43,6 @@ #if QT_CONFIG(tabletevent) #include "qwaylandtabletv2_p.h" #endif -#include "qwaylandqtkey_p.h" #include "qwaylandcolormanagement_p.h" @@ -671,8 +670,6 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin id, 1)); } else if (interface == QLatin1String(QWaylandTouchExtension::interface()->name)) { mGlobals.touchExtension.reset(new QWaylandTouchExtension(this, id)); - } else if (interface == QLatin1String(QWaylandQtKeyExtension::interface()->name)) { - mGlobals.qtKeyExtension.reset(new QWaylandQtKeyExtension(this, id)); #if QT_CONFIG(tabletevent) } else if (interface == QLatin1String(QWaylandTabletManagerV2::interface()->name)) { mGlobals.tabletManager.reset(new QWaylandTabletManagerV2(this, id, qMin(1, int(version)))); diff --git a/src/plugins/platforms/wayland/qwaylanddisplay_p.h b/src/plugins/platforms/wayland/qwaylanddisplay_p.h index 2cad24dd6a2..15c564b291e 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay_p.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay_p.h @@ -83,7 +83,6 @@ class QWaylandTabletManagerV2; #endif class QWaylandPointerGestures; class QWaylandTouchExtension; -class QWaylandQtKeyExtension; class QWaylandWindow; class QWaylandIntegration; class QWaylandHardwareIntegration; @@ -344,7 +343,6 @@ private: #endif std::unique_ptr subCompositor; std::unique_ptr touchExtension; - std::unique_ptr qtKeyExtension; #if QT_CONFIG(tabletevent) std::unique_ptr tabletManager; #endif diff --git a/src/plugins/platforms/wayland/qwaylandqtkey.cpp b/src/plugins/platforms/wayland/qwaylandqtkey.cpp deleted file mode 100644 index 079a03e0ddb..00000000000 --- a/src/plugins/platforms/wayland/qwaylandqtkey.cpp +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright (C) 2016 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only - -#include "qwaylandqtkey_p.h" -#include "qwaylandinputdevice_p.h" -#include "qwaylanddisplay_p.h" - -QT_BEGIN_NAMESPACE - -namespace QtWaylandClient { - -QWaylandQtKeyExtension::QWaylandQtKeyExtension(QWaylandDisplay *display, uint32_t id) - : QtWayland::zqt_key_v1(display->wl_registry(), id, 1) - , m_display(display) -{ -} - -QWaylandQtKeyExtension::~QWaylandQtKeyExtension() -{ - zqt_key_v1_destroy(object()); -} - -void QWaylandQtKeyExtension::zqt_key_v1_key(struct wl_surface *surface, - uint32_t time, - uint32_t type, - uint32_t key, - uint32_t modifiers, - uint32_t nativeScanCode, - uint32_t nativeVirtualKey, - uint32_t nativeModifiers, - const QString &text, - uint32_t autorep, - uint32_t count) -{ - QList inputDevices = m_display->inputDevices(); - if (!surface && inputDevices.isEmpty()) { - qWarning("qt_key_extension: handle_qtkey: No input device"); - return; - } - - QWaylandInputDevice *dev = inputDevices.first(); - - auto *win = surface ? QWaylandWindow::fromWlSurface(surface) : nullptr; - - if (!win) - win = dev->keyboardFocus(); - - if (!win || !win->window()) { - qWarning("qt_key_extension: handle_qtkey: No keyboard focus"); - return; - } - - QWindow *window = win->window(); - QWindowSystemInterface::handleExtendedKeyEvent(window, time, QEvent::Type(type), key, Qt::KeyboardModifiers(modifiers), - nativeScanCode, nativeVirtualKey, nativeModifiers, text, - autorep, count); -} - -} - -QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandqtkey_p.h b/src/plugins/platforms/wayland/qwaylandqtkey_p.h deleted file mode 100644 index 1544a01663d..00000000000 --- a/src/plugins/platforms/wayland/qwaylandqtkey_p.h +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright (C) 2018 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only - -#ifndef QWAYLANDQTKEY_H -#define QWAYLANDQTKEY_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include - -#include -#include -#include - -QT_BEGIN_NAMESPACE - -namespace QtWaylandClient { - -class QWaylandDisplay; - -class Q_WAYLANDCLIENT_EXPORT QWaylandQtKeyExtension : public QtWayland::zqt_key_v1 -{ -public: - QWaylandQtKeyExtension(QWaylandDisplay *display, uint32_t id); - ~QWaylandQtKeyExtension(); - -private: - QWaylandDisplay *m_display = nullptr; - - void zqt_key_v1_key(struct wl_surface *surface, - uint32_t time, - uint32_t type, - uint32_t key, - uint32_t modifiers, - uint32_t nativeScanCode, - uint32_t nativeVirtualKey, - uint32_t nativeModifiers, - const QString &text, - uint32_t autorep, - uint32_t count) override; - -}; - -} - -QT_END_NAMESPACE - -#endif // QWAYLANDQTKEY_H From d7731dd11063e4f1d9ca84a37d0b270b79a25a0e Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Tue, 11 Feb 2025 15:02:38 +0100 Subject: [PATCH 1471/1507] Remove touch-extension protocol This removes the special case touch-extension protocol for Qt. Touch input should work with all compositors, not just Qt-based, through the wl_touch interface, and the world has come a long way since this was added. Task-number: QTBUG-133223 Change-Id: I89d404ac87270d8b3c6a9015d3a72fac5919b0b9 Reviewed-by: Vlad Zahorodnii --- .../wayland/extensions/touch-extension.xml | 38 ---- src/plugins/platforms/wayland/CMakeLists.txt | 2 - .../platforms/wayland/qwaylanddisplay.cpp | 3 - .../platforms/wayland/qwaylanddisplay_p.h | 6 - .../platforms/wayland/qwaylandinputdevice.cpp | 5 - .../platforms/wayland/qwaylandtouch.cpp | 189 ------------------ .../platforms/wayland/qwaylandtouch_p.h | 79 -------- 7 files changed, 322 deletions(-) delete mode 100644 src/3rdparty/wayland/extensions/touch-extension.xml delete mode 100644 src/plugins/platforms/wayland/qwaylandtouch.cpp delete mode 100644 src/plugins/platforms/wayland/qwaylandtouch_p.h diff --git a/src/3rdparty/wayland/extensions/touch-extension.xml b/src/3rdparty/wayland/extensions/touch-extension.xml deleted file mode 100644 index 429dadfd9c7..00000000000 --- a/src/3rdparty/wayland/extensions/touch-extension.xml +++ /dev/null @@ -1,38 +0,0 @@ - - - - Copyright (C) 2015 The Qt Company Ltd. - SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/plugins/platforms/wayland/CMakeLists.txt b/src/plugins/platforms/wayland/CMakeLists.txt index 0018f71307d..577450439b4 100644 --- a/src/plugins/platforms/wayland/CMakeLists.txt +++ b/src/plugins/platforms/wayland/CMakeLists.txt @@ -52,7 +52,6 @@ qt_internal_add_module(WaylandClient qwaylandshmwindow.cpp qwaylandshmwindow_p.h qwaylandsubsurface.cpp qwaylandsubsurface_p.h qwaylandsurface.cpp qwaylandsurface_p.h - qwaylandtouch.cpp qwaylandtouch_p.h qwaylandviewport.cpp qwaylandviewport_p.h qwaylandwindow.cpp qwaylandwindow_p.h qwaylandwindowmanagerintegration.cpp qwaylandwindowmanagerintegration_p.h @@ -117,7 +116,6 @@ qt6_generate_wayland_protocol_client_sources(WaylandClient ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/xdg-toplevel-drag/xdg-toplevel-drag-v1.xml ${CMAKE_CURRENT_SOURCE_DIR}/../extensions/qt-text-input-method-unstable-v1.xml ${CMAKE_CURRENT_SOURCE_DIR}/../extensions/qt-windowmanager.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../extensions/touch-extension.xml ${CMAKE_CURRENT_SOURCE_DIR}/hardwareintegration/../../extensions/hardware-integration.xml ${CMAKE_CURRENT_SOURCE_DIR}/hardwareintegration/../../extensions/server-buffer-extension.xml ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/color-management/xx-color-management-v4.xml diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index 1ff7d25141d..c6334718b8e 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -39,7 +39,6 @@ #include "qwaylandpointergestures_p.h" #include "qwaylandsubsurface_p.h" -#include "qwaylandtouch_p.h" #if QT_CONFIG(tabletevent) #include "qwaylandtabletv2_p.h" #endif @@ -668,8 +667,6 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin mGlobals.subCompositor.reset( new WithDestructor(registry, id, 1)); - } else if (interface == QLatin1String(QWaylandTouchExtension::interface()->name)) { - mGlobals.touchExtension.reset(new QWaylandTouchExtension(this, id)); #if QT_CONFIG(tabletevent) } else if (interface == QLatin1String(QWaylandTabletManagerV2::interface()->name)) { mGlobals.tabletManager.reset(new QWaylandTabletManagerV2(this, id, qMin(1, int(version)))); diff --git a/src/plugins/platforms/wayland/qwaylanddisplay_p.h b/src/plugins/platforms/wayland/qwaylanddisplay_p.h index 15c564b291e..db9007a35f0 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay_p.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay_p.h @@ -82,7 +82,6 @@ class QWaylandPrimarySelectionDeviceManagerV1; class QWaylandTabletManagerV2; #endif class QWaylandPointerGestures; -class QWaylandTouchExtension; class QWaylandWindow; class QWaylandIntegration; class QWaylandHardwareIntegration; @@ -174,10 +173,6 @@ public: { return mGlobals.pointerGestures.get(); } - QWaylandTouchExtension *touchExtension() const - { - return mGlobals.touchExtension.get(); - } QtWayland::qt_text_input_method_manager_v1 *textInputMethodManager() const { return mGlobals.textInputMethodManager.get(); @@ -342,7 +337,6 @@ private: std::unique_ptr dndSelectionHandler; #endif std::unique_ptr subCompositor; - std::unique_ptr touchExtension; #if QT_CONFIG(tabletevent) std::unique_ptr tabletManager; #endif diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index ff2b22a613b..a612f3ef331 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -23,7 +23,6 @@ #include "qwaylandtabletv2_p.h" #endif #include "qwaylandpointergestures_p.h" -#include "qwaylandtouch_p.h" #include "qwaylandscreen_p.h" #include "qwaylandcursor_p.h" #include "qwaylanddisplay_p.h" @@ -1457,10 +1456,6 @@ void QWaylandInputDevice::Touch::touch_cancel() { mPendingTouchPoints.clear(); - QWaylandTouchExtension *touchExt = mParent->mQDisplay->touchExtension(); - if (touchExt) - touchExt->touchCanceled(); - mFocus = nullptr; QWindowSystemInterface::handleTouchCancelEvent(nullptr, mParent->mTouchDevice); } diff --git a/src/plugins/platforms/wayland/qwaylandtouch.cpp b/src/plugins/platforms/wayland/qwaylandtouch.cpp deleted file mode 100644 index b38c895520a..00000000000 --- a/src/plugins/platforms/wayland/qwaylandtouch.cpp +++ /dev/null @@ -1,189 +0,0 @@ -// Copyright (C) 2016 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only - -#include "qwaylandtouch_p.h" -#include "qwaylandinputdevice_p.h" -#include "qwaylanddisplay_p.h" -#include "qwaylandsurface_p.h" - -#include - -QT_BEGIN_NAMESPACE - -namespace QtWaylandClient { - -QWaylandTouchExtension::QWaylandTouchExtension(QWaylandDisplay *display, uint32_t id) - : QtWayland::qt_touch_extension(display->wl_registry(), id, 1), - mDisplay(display), - mTouchDevice(nullptr), - mPointsLeft(0), - mFlags(0), - mMouseSourceId(-1), - mInputDevice(nullptr) -{ -} - -QWaylandTouchExtension::~QWaylandTouchExtension() -{ - qt_touch_extension_destroy(object()); -} - -void QWaylandTouchExtension::registerDevice(int caps) -{ - // TODO number of touchpoints, actual name and ID - mTouchDevice = new QPointingDevice(QLatin1String("some touchscreen"), 0, - QInputDevice::DeviceType::TouchScreen, QPointingDevice::PointerType::Finger, - QInputDevice::Capabilities(caps), 10, 0); - QWindowSystemInterface::registerInputDevice(mTouchDevice); -} - -static inline qreal fromFixed(int f) -{ - return f / qreal(10000); -} - -void QWaylandTouchExtension::touch_extension_touch(uint32_t time, - uint32_t id, uint32_t state, int32_t x, int32_t y, - int32_t normalized_x, int32_t normalized_y, - int32_t width, int32_t height, uint32_t pressure, - int32_t velocity_x, int32_t velocity_y, - uint32_t flags, wl_array *rawdata) -{ - if (!mInputDevice) { - QList inputDevices = mDisplay->inputDevices(); - if (inputDevices.isEmpty()) { - qWarning("qt_touch_extension: handle_touch: No input devices"); - return; - } - mInputDevice = inputDevices.first(); - } - QWaylandWindow *win = mInputDevice->touchFocus(); - if (!win) - win = mInputDevice->pointerFocus(); - if (!win) - win = mInputDevice->keyboardFocus(); - if (!win || !win->window()) { - qWarning("qt_touch_extension: handle_touch: No pointer focus"); - return; - } - mTargetWindow = win->window(); - - QWindowSystemInterface::TouchPoint tp; - tp.id = id; - tp.state = QEventPoint::State(int(state & 0xFFFF)); - int sentPointCount = state >> 16; - if (!mPointsLeft) { - Q_ASSERT(sentPointCount > 0); - mPointsLeft = sentPointCount; - } - - if (!mTouchDevice) - registerDevice(flags >> 16); - - tp.area = QRectF(0, 0, fromFixed(width), fromFixed(height)); - // Got surface-relative coords but need a (virtual) screen position. - QPointF relPos = QPointF(fromFixed(x), fromFixed(y)); - tp.area.moveCenter(mTargetWindow->mapToGlobal(relPos)); - - tp.normalPosition.setX(fromFixed(normalized_x)); - tp.normalPosition.setY(fromFixed(normalized_y)); - tp.pressure = pressure / 255.0; - tp.velocity.setX(fromFixed(velocity_x)); - tp.velocity.setY(fromFixed(velocity_y)); - - if (rawdata) { - const int rawPosCount = rawdata->size / sizeof(float) / 2; - float *p = static_cast(rawdata->data); - for (int i = 0; i < rawPosCount; ++i) { - float x = *p++; - float y = *p++; - tp.rawPositions.append(QPointF(x, y)); - } - } - - mTouchPoints.append(tp); - mTimestamp = time; - - if (!--mPointsLeft) - sendTouchEvent(); -} - -void QWaylandTouchExtension::sendTouchEvent() -{ - // Copy all points, that are in the previous but not in the current list, as stationary. - for (int i = 0; i < mPrevTouchPoints.size(); ++i) { - const QWindowSystemInterface::TouchPoint &prevPoint(mPrevTouchPoints.at(i)); - if (prevPoint.state == QEventPoint::Released) - continue; - bool found = false; - for (int j = 0; j < mTouchPoints.size(); ++j) - if (mTouchPoints.at(j).id == prevPoint.id) { - found = true; - break; - } - if (!found) { - QWindowSystemInterface::TouchPoint p = prevPoint; - p.state = QEventPoint::Stationary; - mTouchPoints.append(p); - } - } - - if (mTouchPoints.isEmpty()) { - mPrevTouchPoints.clear(); - return; - } - - QWindowSystemInterface::handleTouchEvent(mTargetWindow, mTimestamp, mTouchDevice, mTouchPoints); - - QEventPoint::States states = {}; - for (int i = 0; i < mTouchPoints.size(); ++i) - states |= mTouchPoints.at(i).state; - - if (mFlags & QT_TOUCH_EXTENSION_FLAGS_MOUSE_FROM_TOUCH) { - const bool firstPress = states == QEventPoint::Pressed; - if (firstPress) - mMouseSourceId = mTouchPoints.first().id; - for (int i = 0; i < mTouchPoints.size(); ++i) { - const QWindowSystemInterface::TouchPoint &tp(mTouchPoints.at(i)); - if (tp.id == mMouseSourceId) { - const bool released = tp.state == QEventPoint::Released; - Qt::MouseButtons buttons = released ? Qt::NoButton : Qt::LeftButton; - QEvent::Type eventType = firstPress ? QEvent::MouseButtonPress - : released ? QEvent::MouseButtonRelease - : QEvent::MouseMove; - mLastMouseGlobal = tp.area.center(); - QPoint globalPoint = mLastMouseGlobal.toPoint(); - QPointF delta = mLastMouseGlobal - globalPoint; - mLastMouseLocal = mTargetWindow->mapFromGlobal(globalPoint) + delta; - QWindowSystemInterface::handleMouseEvent(mTargetWindow, mTimestamp, mLastMouseLocal, mLastMouseGlobal, - buttons, Qt::LeftButton, eventType); - if (buttons == Qt::NoButton) - mMouseSourceId = -1; - break; - } - } - } - - mPrevTouchPoints = mTouchPoints; - mTouchPoints.clear(); - - if (states == QEventPoint::Released) - mPrevTouchPoints.clear(); -} - -void QWaylandTouchExtension::touchCanceled() -{ - mTouchPoints.clear(); - mPrevTouchPoints.clear(); - if (mMouseSourceId != -1) - QWindowSystemInterface::handleMouseEvent(mTargetWindow, mTimestamp, mLastMouseLocal, mLastMouseGlobal, Qt::NoButton, Qt::LeftButton, QEvent::MouseButtonRelease); -} - -void QWaylandTouchExtension::touch_extension_configure(uint32_t flags) -{ - mFlags = flags; -} - -} - -QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandtouch_p.h b/src/plugins/platforms/wayland/qwaylandtouch_p.h deleted file mode 100644 index e283f90095c..00000000000 --- a/src/plugins/platforms/wayland/qwaylandtouch_p.h +++ /dev/null @@ -1,79 +0,0 @@ -// Copyright (C) 2020 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only - -#ifndef QWAYLANDTOUCH_H -#define QWAYLANDTOUCH_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include - -#include -#include -#include - -QT_BEGIN_NAMESPACE - -namespace QtWaylandClient { - -class QWaylandDisplay; -class QWaylandInputDevice; - -class Q_WAYLANDCLIENT_EXPORT QWaylandTouchExtension : public QtWayland::qt_touch_extension -{ -public: - QWaylandTouchExtension(QWaylandDisplay *display, uint32_t id); - ~QWaylandTouchExtension() override; - - void touchCanceled(); - -private: - void registerDevice(int caps); - - QWaylandDisplay *mDisplay = nullptr; - - void touch_extension_touch(uint32_t time, - uint32_t id, - uint32_t state, - int32_t x, - int32_t y, - int32_t normalized_x, - int32_t normalized_y, - int32_t width, - int32_t height, - uint32_t pressure, - int32_t velocity_x, - int32_t velocity_y, - uint32_t flags, - struct wl_array *rawdata) override; - void touch_extension_configure(uint32_t flags) override; - - void sendTouchEvent(); - - QList mTouchPoints; - QList mPrevTouchPoints; - QPointingDevice *mTouchDevice = nullptr; - uint32_t mTimestamp; - int mPointsLeft; - uint32_t mFlags; - int mMouseSourceId; - QPointF mLastMouseLocal; - QPointF mLastMouseGlobal; - QWindow *mTargetWindow = nullptr; - QWaylandInputDevice *mInputDevice = nullptr; -}; - -} - -QT_END_NAMESPACE - -#endif // QWAYLANDTOUCH_H From a0d203cf89d2ae8edf1f2d291d1d646ed2256b6c Mon Sep 17 00:00:00 2001 From: David Redondo Date: Tue, 11 Feb 2025 10:36:39 +0100 Subject: [PATCH 1472/1507] Use the same pointing device for releasing as all other events When we specify no pointing device QWindowSystemInterface will use QPointingDevice::primaryPointingDevice() which is slightly different than what QWaylandWindow will do where the seat name is passed. Task: QTBUG-127821 Pick-to: 6.9 6.8 Change-Id: I77bf7ce0c5b57c205d670923ba348bf6eeec2490 Reviewed-by: David Edmundson --- src/plugins/platforms/wayland/qwaylandinputdevice.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index a612f3ef331..dfd87bdec6f 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -1172,10 +1172,12 @@ void QWaylandInputDevice::Pointer::flushFrameEvent() } else if (mFrameData.event->type == QEvent::MouseButtonRelease) { // If the window has been destroyed, we still need to report an up event, but it can't // be handled by the destroyed window (obviously), so send the event here instead. - QWindowSystemInterface::handleMouseEvent(nullptr, event->timestamp, event->local, - event->global, event->buttons, - event->button, event->type, - event->modifiers);// , Qt::MouseEventSource source = Qt::MouseEventNotSynthesized); + QWindowSystemInterface::handleMouseEvent( + nullptr, event->timestamp, + QPointingDevice::primaryPointingDevice(mParent->seatname()), event->local, + event->global, event->buttons, event->button, event->type, + event->modifiers); // , Qt::MouseEventSource source = + // Qt::MouseEventNotSynthesized); } delete mFrameData.event; mFrameData.event = nullptr; From 71fc85f5942e920e8d479284c073c2fc9c81d9da Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Tue, 18 Feb 2025 15:22:41 +0200 Subject: [PATCH 1473/1507] Client: Fix potential file descriptor leak Qt doesn't use the ICC file information, but the file descriptor should be still closed. Change-Id: Ib793e7cc12dbd7dd338c4ab4528c17f30e48abcd Reviewed-by: David Edmundson --- src/plugins/platforms/wayland/qwaylandcolormanagement.cpp | 8 ++++++++ src/plugins/platforms/wayland/qwaylandcolormanagement_p.h | 1 + 2 files changed, 9 insertions(+) diff --git a/src/plugins/platforms/wayland/qwaylandcolormanagement.cpp b/src/plugins/platforms/wayland/qwaylandcolormanagement.cpp index 29e676fef75..2114e59328b 100644 --- a/src/plugins/platforms/wayland/qwaylandcolormanagement.cpp +++ b/src/plugins/platforms/wayland/qwaylandcolormanagement.cpp @@ -6,6 +6,8 @@ #include +#include + QT_BEGIN_NAMESPACE namespace QtWaylandClient { @@ -146,6 +148,12 @@ void ImageDescriptionInfo::xx_image_description_info_v4_done() Q_EMIT done(); } +void ImageDescriptionInfo::xx_image_description_info_v4_icc_file(int32_t icc, uint32_t icc_size) +{ + Q_UNUSED(icc_size) + close(icc); +} + void ImageDescriptionInfo::xx_image_description_info_v4_primaries(int32_t r_x, int32_t r_y, int32_t g_x, int32_t g_y, int32_t b_x, int32_t b_y, int32_t w_x, int32_t w_y) { mContainerRed = QPointF(r_x, r_y) / 10'000.0; diff --git a/src/plugins/platforms/wayland/qwaylandcolormanagement_p.h b/src/plugins/platforms/wayland/qwaylandcolormanagement_p.h index 752cbc27f1e..8e44bd66b7b 100644 --- a/src/plugins/platforms/wayland/qwaylandcolormanagement_p.h +++ b/src/plugins/platforms/wayland/qwaylandcolormanagement_p.h @@ -89,6 +89,7 @@ public: private: void xx_image_description_info_v4_done() override; + void xx_image_description_info_v4_icc_file(int32_t icc, uint32_t icc_size) override; void xx_image_description_info_v4_primaries(int32_t r_x, int32_t r_y, int32_t g_x, int32_t g_y, int32_t b_x, int32_t b_y, int32_t w_x, int32_t w_y) override; void xx_image_description_info_v4_tf_named(uint32_t transferFunction) override; void xx_image_description_info_v4_luminances(uint32_t min_lum, uint32_t max_lum, uint32_t reference_lum) override; From 0d11ab87ca51bee5195c5a343010f143aed4652c Mon Sep 17 00:00:00 2001 From: Harald Sitter Date: Tue, 25 Feb 2025 10:34:00 +0100 Subject: [PATCH 1474/1507] client: search for libvulkan.so.1 as first choice this aligns the libvulkan lookup with qxcb, which too looks for .so.1 first and .so second. linux distributions often put the .so in separate development packages that aren't installed by default. See also 888b75aa12e2cf35ee760bcf5cb1ed60fe0c0770 in qtbase. Pick-to: 6.9 6.8 Change-Id: I0639896b09df89a96696554f16b3ca4d06035ac0 Reviewed-by: Liang Qi --- src/plugins/platforms/wayland/qwaylandvulkaninstance.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandvulkaninstance.cpp b/src/plugins/platforms/wayland/qwaylandvulkaninstance.cpp index be55130a422..89f97f28f2c 100644 --- a/src/plugins/platforms/wayland/qwaylandvulkaninstance.cpp +++ b/src/plugins/platforms/wayland/qwaylandvulkaninstance.cpp @@ -13,7 +13,7 @@ namespace QtWaylandClient { QWaylandVulkanInstance::QWaylandVulkanInstance(QVulkanInstance *instance) : m_instance(instance) { - loadVulkanLibrary(QStringLiteral("vulkan")); + loadVulkanLibrary(QStringLiteral("vulkan"), 1); } QWaylandVulkanInstance::~QWaylandVulkanInstance() = default; From 9c4cd93ab41dcbeee4cc2bb83f5773d1edad80f1 Mon Sep 17 00:00:00 2001 From: Liang Qi Date: Fri, 28 Feb 2025 10:48:06 +0100 Subject: [PATCH 1475/1507] protocol: update version info of wayland.xml in qt_attribution.json This amends d4492782ed03a2ef6fc27f8b22e93b805ce7e092 . [ChangeLog][Third-Party Code] Update wayland.xml to 1.23.0. Pick-to: 6.9 Change-Id: I07cfe6e8eb715c115444cf24288f0b1362754176 Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/3rdparty/wayland/protocols/wayland/qt_attribution.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/3rdparty/wayland/protocols/wayland/qt_attribution.json b/src/3rdparty/wayland/protocols/wayland/qt_attribution.json index 3624f201288..413d1503767 100644 --- a/src/3rdparty/wayland/protocols/wayland/qt_attribution.json +++ b/src/3rdparty/wayland/protocols/wayland/qt_attribution.json @@ -8,8 +8,8 @@ "Description": "Wayland is a protocol for a compositor to talk to its clients.", "Homepage": "https://wayland.freedesktop.org", - "Version": "1.19.0", - "DownloadLocation": "https://gitlab.freedesktop.org/wayland/wayland/raw/1.19.0/protocol/wayland.xml", + "Version": "1.23.0", + "DownloadLocation": "https://gitlab.freedesktop.org/wayland/wayland/raw/1.23.0/protocol/wayland.xml", "LicenseId": "MIT", "License": "MIT License", "LicenseFile": "../MIT_LICENSE.txt", From 0772749b2cc438827b1a18b87cbe83622aab2134 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Fri, 28 Feb 2025 12:45:38 +0100 Subject: [PATCH 1476/1507] CMake: Fix test_waylandclient The test uses Qt6::WaylandClientPrivate and must now find_package(Qt6WaylandClientPrivate). Fixes: QTBUG-134205 Change-Id: Ia715ff9dd57ff4d19679f686fad64954c38289b6 Reviewed-by: Eskil Abrahamsen Blomfeldt Reviewed-by: Alexey Edelev --- tests/auto/cmake/test_waylandclient/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/cmake/test_waylandclient/CMakeLists.txt b/tests/auto/cmake/test_waylandclient/CMakeLists.txt index cad8d45d365..1cb8d53a2b2 100644 --- a/tests/auto/cmake/test_waylandclient/CMakeLists.txt +++ b/tests/auto/cmake/test_waylandclient/CMakeLists.txt @@ -6,6 +6,6 @@ project(test_plugins) cmake_minimum_required(VERSION 3.16) cmake_policy(SET CMP0056 NEW) -find_package(Qt6WaylandClient REQUIRED) +find_package(Qt6WaylandClientPrivate REQUIRED) add_executable(test_waylandclient_exe main.cpp) target_link_libraries(test_waylandclient_exe Qt6::WaylandClientPrivate) From abcea0d2496f55aeb98251c013cfe58d4f1afaab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Fri, 28 Feb 2025 10:54:51 +0100 Subject: [PATCH 1477/1507] Remove old qmake .pri files The .pro files for building the client and compositor modules have been removed already, so we don't need the .pri helpers. Change-Id: Ieb8ea7cc292e6b2c98e4f24932810ef426a54141 Reviewed-by: Liang Qi --- .../platforms/wayland/global/global.pri | 9 ------ .../hardwareintegration.pri | 24 --------------- .../inputdeviceintegration.pri | 11 ------- .../shellintegration/shellintegration.pri | 11 ------- tests/auto/wayland/shared/shared.pri | 29 ------------------- 5 files changed, 84 deletions(-) delete mode 100644 src/plugins/platforms/wayland/global/global.pri delete mode 100644 src/plugins/platforms/wayland/hardwareintegration/hardwareintegration.pri delete mode 100644 src/plugins/platforms/wayland/inputdeviceintegration/inputdeviceintegration.pri delete mode 100644 src/plugins/platforms/wayland/shellintegration/shellintegration.pri delete mode 100644 tests/auto/wayland/shared/shared.pri diff --git a/src/plugins/platforms/wayland/global/global.pri b/src/plugins/platforms/wayland/global/global.pri deleted file mode 100644 index 53c76cbc9db..00000000000 --- a/src/plugins/platforms/wayland/global/global.pri +++ /dev/null @@ -1,9 +0,0 @@ -INCLUDEPATH += $$PWD - -HEADERS += \ - $$PWD/qwaylandclientextension.h \ - $$PWD/qwaylandclientextension_p.h - -SOURCES += \ - $$PWD/qwaylandclientextension.cpp - diff --git a/src/plugins/platforms/wayland/hardwareintegration/hardwareintegration.pri b/src/plugins/platforms/wayland/hardwareintegration/hardwareintegration.pri deleted file mode 100644 index bb4fe76d6b0..00000000000 --- a/src/plugins/platforms/wayland/hardwareintegration/hardwareintegration.pri +++ /dev/null @@ -1,24 +0,0 @@ -WAYLANDCLIENTSOURCES += \ - $$PWD/../../extensions/server-buffer-extension.xml \ - $$PWD/../../extensions/hardware-integration.xml - -INCLUDEPATH += $$PWD - -SOURCES += \ - $$PWD/qwaylandclientbufferintegration.cpp \ - $$PWD/qwaylandclientbufferintegrationplugin.cpp \ - $$PWD/qwaylandclientbufferintegrationfactory.cpp \ - $$PWD/qwaylandserverbufferintegration.cpp \ - $$PWD/qwaylandserverbufferintegrationplugin.cpp \ - $$PWD/qwaylandserverbufferintegrationfactory.cpp \ - $$PWD/qwaylandhardwareintegration.cpp - -HEADERS += \ - $$PWD/qwaylandclientbufferintegration_p.h \ - $$PWD/qwaylandclientbufferintegrationplugin_p.h \ - $$PWD/qwaylandclientbufferintegrationfactory_p.h \ - $$PWD/qwaylandserverbufferintegration_p.h \ - $$PWD/qwaylandserverbufferintegrationplugin_p.h \ - $$PWD/qwaylandserverbufferintegrationfactory_p.h \ - $$PWD/qwaylandhardwareintegration_p.h - diff --git a/src/plugins/platforms/wayland/inputdeviceintegration/inputdeviceintegration.pri b/src/plugins/platforms/wayland/inputdeviceintegration/inputdeviceintegration.pri deleted file mode 100644 index f16dfc3c953..00000000000 --- a/src/plugins/platforms/wayland/inputdeviceintegration/inputdeviceintegration.pri +++ /dev/null @@ -1,11 +0,0 @@ -INCLUDEPATH += $$PWD - -SOURCES += \ - $$PWD/qwaylandinputdeviceintegrationplugin.cpp \ - $$PWD/qwaylandinputdeviceintegrationfactory.cpp - -HEADERS += \ - $$PWD/qwaylandinputdeviceintegration_p.h \ - $$PWD/qwaylandinputdeviceintegrationplugin_p.h \ - $$PWD/qwaylandinputdeviceintegrationfactory_p.h - diff --git a/src/plugins/platforms/wayland/shellintegration/shellintegration.pri b/src/plugins/platforms/wayland/shellintegration/shellintegration.pri deleted file mode 100644 index de889a47af2..00000000000 --- a/src/plugins/platforms/wayland/shellintegration/shellintegration.pri +++ /dev/null @@ -1,11 +0,0 @@ -INCLUDEPATH += $$PWD - -SOURCES += \ - $$PWD/qwaylandshellintegrationplugin.cpp \ - $$PWD/qwaylandshellintegrationfactory.cpp - -HEADERS += \ - $$PWD/qwaylandshellintegration_p.h \ - $$PWD/qwaylandshellintegrationplugin_p.h \ - $$PWD/qwaylandshellintegrationfactory_p.h - diff --git a/tests/auto/wayland/shared/shared.pri b/tests/auto/wayland/shared/shared.pri deleted file mode 100644 index e81ad9d4a64..00000000000 --- a/tests/auto/wayland/shared/shared.pri +++ /dev/null @@ -1,29 +0,0 @@ -QT += testlib waylandclient-private opengl -CONFIG += testcase wayland-scanner -QMAKE_USE += wayland-server - -WAYLANDSERVERSOURCES += \ - $$PWD/../../../../src/3rdparty/protocol/wayland/wayland.xml \ - $$PWD/../../../../src/3rdparty/protocol/xdg-output/xdg-output-unstable-v1.xml \ - $$PWD/../../../../src/3rdparty/protocol/xdg-shell/xdg-shell.xml \ - $$PWD/../../../../src/3rdparty/protocol/text-input/text-input-unstable-v2.xml - -INCLUDEPATH += ../shared - -HEADERS += \ - $$PWD/corecompositor.h \ - $$PWD/coreprotocol.h \ - $$PWD/datadevice.h \ - $$PWD/mockcompositor.h \ - $$PWD/xdgoutputv1.h \ - $$PWD/xdgshell.h \ - $$PWD/textinput.h - -SOURCES += \ - $$PWD/corecompositor.cpp \ - $$PWD/coreprotocol.cpp \ - $$PWD/datadevice.cpp \ - $$PWD/mockcompositor.cpp \ - $$PWD/xdgoutputv1.cpp \ - $$PWD/xdgshell.cpp \ - $$PWD/textinput.cpp From 12e55c95b23c766f9b968597fcf651173e78944c Mon Sep 17 00:00:00 2001 From: Kai Uwe Broulik Date: Fri, 28 Feb 2025 21:20:00 +0100 Subject: [PATCH 1478/1507] Honor request for (no) alpha channel in SHM windows Currently, all QWaylandShmWindows are ARGB32, even if the application did not request an alpha channel (most toplevel windows without client-side decoration). Instead, create an ARGB32 or RGB32 buffer depending on whether the surface requested an alpha channel. In order to do this, set the red/green/blue channel of the QSurfaceFormat to 8 (since that's all we support right now). Alpha channel is set to 8 or 0 depending on whether the surface requested alpha. Due to client-side decorations we cannot know in advance whether we need an alpha channel, so we have to update the surface format in setWindowFlags. While it doesn't particularly matter from the compositor's POV (ARGB and XRGB are the same size and there's the opaque region on the surface), Qt's backing store can skip certain steps in the rendering, such as clearing the paint region before painting when the surface is opaque. Change-Id: I7b74f19ddb05d8ca9ae325f8fd5f42f41875cc51 Reviewed-by: David Redondo Reviewed-by: Xaver Hugl --- .../platforms/wayland/qwaylandshmbackingstore.cpp | 4 +++- .../platforms/wayland/qwaylandshmwindow.cpp | 15 +++++++++++++++ .../platforms/wayland/qwaylandshmwindow_p.h | 3 ++- 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp b/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp index 1abd6808bbc..a0265bdc338 100644 --- a/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp +++ b/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp @@ -283,7 +283,9 @@ QWaylandShmBuffer *QWaylandShmBackingStore::getBuffer(const QSize &size, bool &b return buffer; if (mBuffers.size() < MAX_BUFFERS) { - QImage::Format format = QPlatformScreen::platformScreenForWindow(window())->format(); + QImage::Format format = QImage::Format_ARGB32_Premultiplied; + if (!waylandWindow()->format().hasAlpha()) + format = QImage::Format_RGB32; QWaylandShmBuffer *b = new QWaylandShmBuffer(mDisplay, size, format, waylandWindow()->scale()); bufferWasRecreated = true; mBuffers.push_front(b); diff --git a/src/plugins/platforms/wayland/qwaylandshmwindow.cpp b/src/plugins/platforms/wayland/qwaylandshmwindow.cpp index 8fecad178bd..10c90d1c157 100644 --- a/src/plugins/platforms/wayland/qwaylandshmwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandshmwindow.cpp @@ -14,6 +14,12 @@ namespace QtWaylandClient { QWaylandShmWindow::QWaylandShmWindow(QWindow *window, QWaylandDisplay *display) : QWaylandWindow(window, display) { + mSurfaceFormat.setRedBufferSize(8); + mSurfaceFormat.setGreenBufferSize(8); + mSurfaceFormat.setBlueBufferSize(8); + + const QSurfaceFormat format = window->requestedFormat(); + mSurfaceFormat.setAlphaBufferSize(format.hasAlpha() ? 8 : 0); } QWaylandShmWindow::~QWaylandShmWindow() @@ -25,6 +31,15 @@ QWaylandWindow::WindowType QWaylandShmWindow::windowType() const return QWaylandWindow::Shm; } +void QWaylandShmWindow::setWindowFlags(Qt::WindowFlags flags) +{ + QWaylandWindow::setWindowFlags(flags); + + const QSurfaceFormat format = window()->requestedFormat(); + if (!format.hasAlpha()) + mSurfaceFormat.setAlphaBufferSize(mWindowDecorationEnabled ? 8 : 0); +} + } QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandshmwindow_p.h b/src/plugins/platforms/wayland/qwaylandshmwindow_p.h index f11df5e4767..dab9e1e5350 100644 --- a/src/plugins/platforms/wayland/qwaylandshmwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandshmwindow_p.h @@ -29,7 +29,8 @@ public: ~QWaylandShmWindow() override; WindowType windowType() const override; - QSurfaceFormat format() const override { return QSurfaceFormat(); } + + void setWindowFlags(Qt::WindowFlags flags) override; }; } From dfed8e3c3d82e03cda9b35d658a16505e4d8f950 Mon Sep 17 00:00:00 2001 From: Kai Uwe Broulik Date: Mon, 26 Aug 2024 19:08:36 +0200 Subject: [PATCH 1479/1507] QWaylandShmBackingStore: Implement scroll Allows to more efficiently scroll existing buffer contents as opposed to having them redrawn by the application. Change-Id: I1005b718a18f078f6bbf47f08dbda4f87b3ab0f5 Reviewed-by: David Redondo --- .../wayland/qwaylandshmbackingstore.cpp | 36 +++++++++++++++++++ .../wayland/qwaylandshmbackingstore_p.h | 1 + 2 files changed, 37 insertions(+) diff --git a/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp b/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp index a0265bdc338..a993817654c 100644 --- a/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp +++ b/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp @@ -45,6 +45,8 @@ QT_BEGIN_NAMESPACE +extern void qt_scrollRectInImage(QImage &, const QRect &, const QPoint &); + namespace QtWaylandClient { QWaylandShmBuffer::QWaylandShmBuffer(QWaylandDisplay *display, @@ -210,6 +212,40 @@ void QWaylandShmBackingStore::endPaint() flush(window(), mPendingRegion, QPoint()); } +// Inspired by QCALayerBackingStore. +bool QWaylandShmBackingStore::scroll(const QRegion ®ion, int dx, int dy) +{ + if (!mBackBuffer) + return false; + + QImage *backBufferImage = mBackBuffer->image(); + const qreal devicePixelRatio = backBufferImage->devicePixelRatio(); + + // On Wayland, the window can have a device pixel ratio different from + // the window/screen, therefore we cannot rely on QHighDpi here, cf. QBackingStore::scroll. + // With fractional scaling we cannot easily scroll the existing pixels. + if (!qFuzzyIsNull(devicePixelRatio - static_cast(devicePixelRatio))) + return false; + + const QPoint scrollDelta(dx, dy); + const QMargins margins = windowDecorationMargins(); + const QRegion adjustedRegion = region.translated(margins.left(), margins.top()); + + const QRect boundingRect = adjustedRegion.boundingRect(); + const QPoint devicePixelDelta = scrollDelta * devicePixelRatio; + + qt_scrollRectInImage(*backBufferImage, + QRect(boundingRect.topLeft() * devicePixelRatio, + boundingRect.size() * devicePixelRatio), + devicePixelDelta); + + // We do not mark the source region as dirty, even though it technically has "moved". + // This matches the behavior of other backingstore implementations using qt_scrollRectInImage. + updateDirtyStates(adjustedRegion.translated(scrollDelta)); + + return true; +} + void QWaylandShmBackingStore::flush(QWindow *window, const QRegion ®ion, const QPoint &offset) { Q_UNUSED(offset) diff --git a/src/plugins/platforms/wayland/qwaylandshmbackingstore_p.h b/src/plugins/platforms/wayland/qwaylandshmbackingstore_p.h index 0f38ba11e23..1cd6135f250 100644 --- a/src/plugins/platforms/wayland/qwaylandshmbackingstore_p.h +++ b/src/plugins/platforms/wayland/qwaylandshmbackingstore_p.h @@ -66,6 +66,7 @@ public: void resize(const QSize &size, const QRegion &staticContents) override; void beginPaint(const QRegion ®ion) override; void endPaint() override; + bool scroll(const QRegion ®ion, int dx, int dy) override; QWaylandAbstractDecoration *windowDecoration() const; From 732ea4facab9c877a87dfa671de3cd034afb293d Mon Sep 17 00:00:00 2001 From: Kai Uwe Broulik Date: Sun, 9 Mar 2025 09:59:47 +0100 Subject: [PATCH 1480/1507] QWaylandShmBackingStore: Clear in beginPaint based on surface format MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It's the surface format that matters not the backing image format. Now that QWaylandShmWindow sets a proper QSurfaceFormat, we can actually check it. Change-Id: Ia17a9f06cd335b6e8f6989051bc9d0cef9bfe3f3 Reviewed-by: Tor Arne Vestbø --- src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp b/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp index a993817654c..9ca2415a320 100644 --- a/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp +++ b/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp @@ -196,7 +196,7 @@ void QWaylandShmBackingStore::beginPaint(const QRegion ®ion) // Although undocumented, QBackingStore::beginPaint expects the painted region // to be cleared before use if the window has a surface format with an alpha. // Fresh QWaylandShmBuffer are already cleared, so we don't need to clear those. - if (!bufferWasRecreated && mBackBuffer->image()->hasAlphaChannel()) { + if (!bufferWasRecreated && window()->format().hasAlpha()) { QPainter p(paintDevice()); p.setCompositionMode(QPainter::CompositionMode_Source); const QColor blank = Qt::transparent; From 5e9c9eba0feeb94533fb5b49666985026d7c2b91 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Sun, 9 Mar 2025 06:03:07 +0400 Subject: [PATCH 1481/1507] client: Attempt to request activate even if there's no last input device The compositor is likely to display some indication even if the activation fails but it doesn't happen if there were no input due to the last input device condition, resulting in no indication of activation failure on first window show. Amends 41a9ffeb0c7309e9e2b84c3b3666a423dedce317 Amends 0fc235c5030ee6fb70dd145b1faad1567cf39788 Pick-to: 6.9 6.8 Change-Id: I08308c3338c0d3fa2c36004eb8f75ad0c1bcce4f Reviewed-by: David Edmundson --- .../xdg-shell/qwaylandxdgshell.cpp | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp index 29489acda89..29c7cbf55d9 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp @@ -567,16 +567,18 @@ bool QWaylandXdgSurface::requestActivate() if (const auto xdgSurface = qobject_cast(wlWindow->shellSurface())) appId = xdgSurface->m_appId; - if (const auto seat = wlWindow->display()->lastInputDevice()) { - const auto tokenProvider = activation->requestXdgActivationToken( - wlWindow->display(), wlWindow->wlSurface(), seat->serial(), appId); - connect(tokenProvider, &QWaylandXdgActivationTokenV1::done, this, - [this](const QString &token) { - m_shell->activation()->activate(token, window()->wlSurface()); - }); - connect(tokenProvider, &QWaylandXdgActivationTokenV1::done, tokenProvider, &QObject::deleteLater); - return true; - } + std::optional serial; + if (const auto seat = wlWindow->display()->lastInputDevice()) + serial = seat->serial(); + + const auto tokenProvider = activation->requestXdgActivationToken( + wlWindow->display(), wlWindow->wlSurface(), serial, appId); + connect(tokenProvider, &QWaylandXdgActivationTokenV1::done, this, + [this](const QString &token) { + m_shell->activation()->activate(token, window()->wlSurface()); + }); + connect(tokenProvider, &QWaylandXdgActivationTokenV1::done, tokenProvider, &QObject::deleteLater); + return true; } } return false; From ab73b6c286ca79c4ab353e72ce0279ee4f7f5713 Mon Sep 17 00:00:00 2001 From: David Redondo Date: Fri, 28 Feb 2025 11:50:23 +0100 Subject: [PATCH 1482/1507] Consolidate the platform plugins MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Instead of having multiple platform plugins, have one that switches behavior depending on the requested platform. From the outside there is no behavior difference. Requesting wayland-egl or wayland-brcm fails if the feature was not enabled and initializes the client integration early. Task-number: QTBUG-133223 Change-Id: I6fbaec7309b78cfcc470ad18dd6b63008119760e Reviewed-by: Tor Arne Vestbø Reviewed-by: Eskil Abrahamsen Blomfeldt --- .../global/qwaylandclientextension.cpp | 3 +- .../platforms/wayland/plugins/CMakeLists.txt | 2 +- .../wayland/plugins/platform/CMakeLists.txt | 24 ++++++++++ .../wayland/plugins/platform/main.cpp | 45 +++++++++++++++++++ .../plugins/platform/qwayland-generic.json | 7 +++ .../platforms/wayland/qwaylandintegration.cpp | 12 ++++- .../platforms/wayland/qwaylandintegration_p.h | 3 +- 7 files changed, 91 insertions(+), 5 deletions(-) create mode 100644 src/plugins/platforms/wayland/plugins/platform/CMakeLists.txt create mode 100644 src/plugins/platforms/wayland/plugins/platform/main.cpp create mode 100644 src/plugins/platforms/wayland/plugins/platform/qwayland-generic.json diff --git a/src/plugins/platforms/wayland/global/qwaylandclientextension.cpp b/src/plugins/platforms/wayland/global/qwaylandclientextension.cpp index b2783088bf3..92c746d3541 100644 --- a/src/plugins/platforms/wayland/global/qwaylandclientextension.cpp +++ b/src/plugins/platforms/wayland/global/qwaylandclientextension.cpp @@ -10,6 +10,7 @@ QT_BEGIN_NAMESPACE using RegistryGlobal = QtWaylandClient::QWaylandDisplay::RegistryGlobal; +using namespace Qt::StringLiterals; QWaylandClientExtensionPrivate::QWaylandClientExtensionPrivate() { @@ -17,7 +18,7 @@ QWaylandClientExtensionPrivate::QWaylandClientExtensionPrivate() // but also add the possibility to run it as a QML component. waylandIntegration = QtWaylandClient::QWaylandIntegration::instance(); if (!waylandIntegration) - waylandIntegration = new QtWaylandClient::QWaylandIntegration(); + waylandIntegration = new QtWaylandClient::QWaylandIntegration("wayland"_L1); } void QWaylandClientExtensionPrivate::globalAdded(const RegistryGlobal &global) diff --git a/src/plugins/platforms/wayland/plugins/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/CMakeLists.txt index e0c91c5e46e..7b90c829453 100644 --- a/src/plugins/platforms/wayland/plugins/CMakeLists.txt +++ b/src/plugins/platforms/wayland/plugins/CMakeLists.txt @@ -5,7 +5,7 @@ add_subdirectory(hardwareintegration) if(TARGET Qt::WaylandClient) - add_subdirectory(platforms) + add_subdirectory(platform) add_subdirectory(decorations) add_subdirectory(shellintegration) endif() diff --git a/src/plugins/platforms/wayland/plugins/platform/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/platform/CMakeLists.txt new file mode 100644 index 00000000000..59b6b3efead --- /dev/null +++ b/src/plugins/platforms/wayland/plugins/platform/CMakeLists.txt @@ -0,0 +1,24 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause + +# Generated from qwayland-generic.pro. + +##################################################################### +## QWaylandIntegrationPlugin Plugin: +##################################################################### + +qt_internal_add_plugin(QWaylandIntegrationPlugin + OUTPUT_NAME qwayland + PLUGIN_TYPE platforms + DEFAULT_IF "wayland" IN_LIST QT_QPA_PLATFORMS + SOURCES + main.cpp + LIBRARIES + Qt::Core + Qt::Gui + Qt::WaylandClientPrivate + QT_LICENSE_ID QT_COMMERCIAL_OR_LGPL3 +) + +#### Keys ignored in scope 1:.:.:qwayland-generic.pro:: +# OTHER_FILES = "qwayland-generic.json" diff --git a/src/plugins/platforms/wayland/plugins/platform/main.cpp b/src/plugins/platforms/wayland/plugins/platform/main.cpp new file mode 100644 index 00000000000..19a8fa147f9 --- /dev/null +++ b/src/plugins/platforms/wayland/plugins/platform/main.cpp @@ -0,0 +1,45 @@ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#include +#include +#include + +QT_BEGIN_NAMESPACE + +namespace QtWaylandClient { + +class QWaylandIntegrationPlugin : public QPlatformIntegrationPlugin +{ + Q_OBJECT + Q_PLUGIN_METADATA(IID QPlatformIntegrationFactoryInterface_iid FILE "qwayland-generic.json") +public: + QPlatformIntegration *create(const QString&, const QStringList&) override; +}; + +QPlatformIntegration *QWaylandIntegrationPlugin::create(const QString& system, const QStringList& paramList) +{ + Q_UNUSED(paramList) +#if !QT_CONFIG(wayland_egl) + if (system == "wayland-egl") + return nullptr; +#endif +#if !QT_CONFIG(wayland_brcm) + if (system == "wayland-brcm") + return nullptr; +#endif + auto *integration = new QWaylandIntegration(system); + + if (!integration->init()) { + delete integration; + integration = nullptr; + } + + return integration; +} + +} // namespace QtWaylandClient + +QT_END_NAMESPACE + +#include "main.moc" diff --git a/src/plugins/platforms/wayland/plugins/platform/qwayland-generic.json b/src/plugins/platforms/wayland/plugins/platform/qwayland-generic.json new file mode 100644 index 00000000000..d07e7e1aa89 --- /dev/null +++ b/src/plugins/platforms/wayland/plugins/platform/qwayland-generic.json @@ -0,0 +1,7 @@ +{ + "Keys": [ + "wayland", + "wayland-egl", + "wayland-brcm" + ] +} diff --git a/src/plugins/platforms/wayland/qwaylandintegration.cpp b/src/plugins/platforms/wayland/qwaylandintegration.cpp index d5da84c2434..50fe5cbe2d1 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandintegration.cpp @@ -74,15 +74,17 @@ QT_BEGIN_NAMESPACE +using namespace Qt::StringLiterals; + namespace QtWaylandClient { QWaylandIntegration *QWaylandIntegration::sInstance = nullptr; -QWaylandIntegration::QWaylandIntegration() +QWaylandIntegration::QWaylandIntegration(const QString &platformName) #if defined(Q_OS_MACOS) : mFontDb(new QCoreTextFontDatabaseEngineFactory) #else - : mFontDb(new QGenericUnixFontDatabase()) + : mPlatformName(platformName), mFontDb(new QGenericUnixFontDatabase()) #endif { mDisplay.reset(new QWaylandDisplay(this)); @@ -92,6 +94,8 @@ QWaylandIntegration::QWaylandIntegration() !qEnvironmentVariableIsSet("QT_WAYLAND_DISABLE_FIXED_POSITIONS"); sInstance = this; + if (platformName != "wayland"_L1) + initializeClientBufferIntegration(); } QWaylandIntegration::~QWaylandIntegration() @@ -335,6 +339,10 @@ void QWaylandIntegration::initializeClientBufferIntegration() return; QString targetKey = QString::fromLocal8Bit(qgetenv("QT_WAYLAND_CLIENT_BUFFER_INTEGRATION")); + if (mPlatformName == "wayland-egl"_L1) + targetKey = "wayland-egl"_L1; + else if (mPlatformName == "wayland-brcm"_L1) + targetKey = "brcm"_L1; if (targetKey.isEmpty()) { if (mDisplay->hardwareIntegration() diff --git a/src/plugins/platforms/wayland/qwaylandintegration_p.h b/src/plugins/platforms/wayland/qwaylandintegration_p.h index d75fef6194a..e379668adb4 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration_p.h +++ b/src/plugins/platforms/wayland/qwaylandintegration_p.h @@ -39,7 +39,7 @@ class QWaylandPlatformServices; class Q_WAYLANDCLIENT_EXPORT QWaylandIntegration : public QPlatformIntegration { public: - QWaylandIntegration(); + QWaylandIntegration(const QString &platformName); ~QWaylandIntegration() override; static QWaylandIntegration *instance() { return sInstance; } @@ -127,6 +127,7 @@ private: void initializeInputDeviceIntegration(); QWaylandShellIntegration *createShellIntegration(const QString& interfaceName); + const QString mPlatformName; QScopedPointer mFontDb; #if QT_CONFIG(clipboard) QScopedPointer mClipboard; From 58e68f1981d0ba0a80e373dd5ca78a9260824c36 Mon Sep 17 00:00:00 2001 From: David Redondo Date: Fri, 28 Feb 2025 12:14:06 +0100 Subject: [PATCH 1483/1507] Move client hardware integration sources into the plugin folder Change-Id: I49629ce1d55d8762ab30c33062fb78b05fdb05d4 Reviewed-by: Eskil Abrahamsen Blomfeldt --- .../brcm-egl/CMakeLists.txt | 10 +- .../brcm-egl/qwaylandbrcmeglintegration.cpp | 121 +++++ .../brcm-egl/qwaylandbrcmeglintegration.h | 68 +++ .../brcm-egl/qwaylandbrcmeglwindow.cpp | 230 ++++++++++ .../brcm-egl/qwaylandbrcmeglwindow.h | 59 +++ .../brcm-egl/qwaylandbrcmglcontext.cpp | 76 ++++ .../brcm-egl/qwaylandbrcmglcontext.h | 48 ++ .../dmabuf-server/CMakeLists.txt | 4 +- .../dmabufserverbufferintegration.cpp | 152 +++++++ .../dmabufserverbufferintegration.h | 111 +++++ .../drm-egl-server/CMakeLists.txt | 4 +- .../drmeglserverbufferintegration.cpp | 155 +++++++ .../drmeglserverbufferintegration.h | 106 +++++ .../libhybris-egl-server/CMakeLists.txt | 6 +- .../libhybriseglserverbufferintegration.cpp | 167 +++++++ .../libhybriseglserverbufferintegration.h | 133 ++++++ .../shm-emulation-server/CMakeLists.txt | 4 +- .../shmserverbufferintegration.cpp | 107 +++++ .../shmserverbufferintegration.h | 55 +++ .../vulkan-server/CMakeLists.txt | 4 +- .../vulkanserverbufferintegration.cpp | 177 +++++++ .../vulkanserverbufferintegration.h | 66 +++ .../wayland-egl/CMakeLists.txt | 10 +- .../hardwareintegration/wayland-egl/main.cpp | 2 +- .../qwaylandeglclientbufferintegration.cpp | 166 +++++++ .../qwaylandeglclientbufferintegration_p.h | 60 +++ .../wayland-egl/qwaylandeglinclude_p.h | 27 ++ .../wayland-egl/qwaylandeglwindow.cpp | 201 ++++++++ .../wayland-egl/qwaylandeglwindow_p.h | 76 ++++ .../wayland-egl/qwaylandglcontext.cpp | 430 ++++++++++++++++++ .../wayland-egl/qwaylandglcontext_p.h | 74 +++ 31 files changed, 2885 insertions(+), 24 deletions(-) create mode 100644 src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/qwaylandbrcmeglintegration.cpp create mode 100644 src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/qwaylandbrcmeglintegration.h create mode 100644 src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/qwaylandbrcmeglwindow.cpp create mode 100644 src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/qwaylandbrcmeglwindow.h create mode 100644 src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/qwaylandbrcmglcontext.cpp create mode 100644 src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/qwaylandbrcmglcontext.h create mode 100644 src/plugins/platforms/wayland/plugins/hardwareintegration/dmabuf-server/dmabufserverbufferintegration.cpp create mode 100644 src/plugins/platforms/wayland/plugins/hardwareintegration/dmabuf-server/dmabufserverbufferintegration.h create mode 100644 src/plugins/platforms/wayland/plugins/hardwareintegration/drm-egl-server/drmeglserverbufferintegration.cpp create mode 100644 src/plugins/platforms/wayland/plugins/hardwareintegration/drm-egl-server/drmeglserverbufferintegration.h create mode 100644 src/plugins/platforms/wayland/plugins/hardwareintegration/libhybris-egl-server/libhybriseglserverbufferintegration.cpp create mode 100644 src/plugins/platforms/wayland/plugins/hardwareintegration/libhybris-egl-server/libhybriseglserverbufferintegration.h create mode 100644 src/plugins/platforms/wayland/plugins/hardwareintegration/shm-emulation-server/shmserverbufferintegration.cpp create mode 100644 src/plugins/platforms/wayland/plugins/hardwareintegration/shm-emulation-server/shmserverbufferintegration.h create mode 100644 src/plugins/platforms/wayland/plugins/hardwareintegration/vulkan-server/vulkanserverbufferintegration.cpp create mode 100644 src/plugins/platforms/wayland/plugins/hardwareintegration/vulkan-server/vulkanserverbufferintegration.h create mode 100644 src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/qwaylandeglclientbufferintegration.cpp create mode 100644 src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/qwaylandeglclientbufferintegration_p.h create mode 100644 src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/qwaylandeglinclude_p.h create mode 100644 src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/qwaylandeglwindow.cpp create mode 100644 src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/qwaylandeglwindow_p.h create mode 100644 src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/qwaylandglcontext.cpp create mode 100644 src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/qwaylandglcontext_p.h diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/CMakeLists.txt index f706632c0a6..ca6c0338614 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/CMakeLists.txt +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/CMakeLists.txt @@ -11,12 +11,10 @@ qt_internal_add_plugin(QWaylandBrcmEglClientBufferPlugin OUTPUT_NAME brcm-egl PLUGIN_TYPE wayland-graphics-integration-client SOURCES - ../../../../hardwareintegration/client/brcm-egl/qwaylandbrcmeglintegration.cpp ../../../../hardwareintegration/client/brcm-egl/qwaylandbrcmeglintegration.h - ../../../../hardwareintegration/client/brcm-egl/qwaylandbrcmeglwindow.cpp ../../../../hardwareintegration/client/brcm-egl/qwaylandbrcmeglwindow.h - ../../../../hardwareintegration/client/brcm-egl/qwaylandbrcmglcontext.cpp ../../../../hardwareintegration/client/brcm-egl/qwaylandbrcmglcontext.h + qwaylandbrcmeglintegration.cpp qwaylandbrcmeglintegration.h + qwaylandbrcmeglwindow.cpp qwaylandbrcmeglwindow.h + qwaylandbrcmglcontext.cpp qwaylandbrcmglcontext.h main.cpp - INCLUDE_DIRECTORIES - ../../../../hardwareintegration/client/brcm-egl PUBLIC_LIBRARIES ${CMAKE_DL_LIBS} EGL::EGL @@ -30,7 +28,7 @@ qt_internal_add_plugin(QWaylandBrcmEglClientBufferPlugin qt6_generate_wayland_protocol_client_sources(QWaylandBrcmEglClientBufferPlugin PRIVATE_CODE FILES - ${CMAKE_CURRENT_SOURCE_DIR}/../../../../hardwareintegration/client/brcm-egl/../../../extensions/brcm.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../../../extensions/brcm.xml ) #### Keys ignored in scope 1:.:.:brcm-egl.pro:: diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/qwaylandbrcmeglintegration.cpp b/src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/qwaylandbrcmeglintegration.cpp new file mode 100644 index 00000000000..8f9047993ed --- /dev/null +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/qwaylandbrcmeglintegration.cpp @@ -0,0 +1,121 @@ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#include "qwaylandbrcmeglintegration.h" + +#include + +#include "qwaylandbrcmeglwindow.h" +#include "qwaylandbrcmglcontext.h" + +#include + +#include "wayland-brcm-client-protocol.h" + +QT_BEGIN_NAMESPACE + +namespace QtWaylandClient { + +QWaylandBrcmEglIntegration::QWaylandBrcmEglIntegration() +{ + qDebug() << "Using Brcm-EGL"; +} + +void QWaylandBrcmEglIntegration::wlDisplayHandleGlobal(void *data, struct ::wl_registry *registry, uint32_t id, const QString &interface, uint32_t version) +{ + Q_UNUSED(version); + if (interface == "qt_brcm") { + QWaylandBrcmEglIntegration *integration = static_cast(data); + integration->m_waylandBrcm = static_cast(wl_registry_bind(registry, id, &qt_brcm_interface, 1)); + } +} + +qt_brcm *QWaylandBrcmEglIntegration::waylandBrcm() const +{ + return m_waylandBrcm; +} + +QWaylandBrcmEglIntegration::~QWaylandBrcmEglIntegration() +{ + eglTerminate(m_eglDisplay); +} + +void QWaylandBrcmEglIntegration::initialize(QWaylandDisplay *waylandDisplay) +{ + m_display = waylandDisplay; + m_waylandDisplay = waylandDisplay->wl_display(); + waylandDisplay->addRegistryListener(wlDisplayHandleGlobal, this); + EGLint major,minor; + m_eglDisplay = eglGetDisplay((EGLNativeDisplayType)EGL_DEFAULT_DISPLAY); + if (m_eglDisplay == NULL) { + qWarning("EGL not available"); + } else { + if (!eglInitialize(m_eglDisplay, &major, &minor)) { + qWarning("failed to initialize EGL display"); + return; + } + + eglFlushBRCM = (PFNEGLFLUSHBRCMPROC)eglGetProcAddress("eglFlushBRCM"); + if (!eglFlushBRCM) { + qWarning("failed to resolve eglFlushBRCM, performance will suffer"); + } + + eglCreateGlobalImageBRCM = (PFNEGLCREATEGLOBALIMAGEBRCMPROC)eglGetProcAddress("eglCreateGlobalImageBRCM"); + if (!eglCreateGlobalImageBRCM) { + qWarning("failed to resolve eglCreateGlobalImageBRCM"); + return; + } + + eglDestroyGlobalImageBRCM = (PFNEGLDESTROYGLOBALIMAGEBRCMPROC)eglGetProcAddress("eglDestroyGlobalImageBRCM"); + if (!eglDestroyGlobalImageBRCM) { + qWarning("failed to resolve eglDestroyGlobalImageBRCM"); + return; + } + } +} + +QWaylandWindow *QWaylandBrcmEglIntegration::createEglWindow(QWindow *window) +{ + return new QWaylandBrcmEglWindow(window, m_display); +} + +QPlatformOpenGLContext *QWaylandBrcmEglIntegration::createPlatformOpenGLContext(const QSurfaceFormat &glFormat, QPlatformOpenGLContext *share) const +{ + return new QWaylandBrcmGLContext(m_eglDisplay, glFormat, share); +} + +EGLDisplay QWaylandBrcmEglIntegration::eglDisplay() const +{ + return m_eglDisplay; +} + +void *QWaylandBrcmEglIntegration::nativeResource(NativeResource resource) +{ + switch (resource) { + case EglDisplay: + return m_eglDisplay; + default: + break; + } + return nullptr; +} + +void *QWaylandBrcmEglIntegration::nativeResourceForContext(NativeResource resource, QPlatformOpenGLContext *context) +{ + Q_ASSERT(context); + switch (resource) { + case EglConfig: + return static_cast(context)->eglConfig(); + case EglContext: + return static_cast(context)->eglContext(); + case EglDisplay: + return m_eglDisplay; + default: + break; + } + return nullptr; +} + +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/qwaylandbrcmeglintegration.h b/src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/qwaylandbrcmeglintegration.h new file mode 100644 index 00000000000..ac164ab9dac --- /dev/null +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/qwaylandbrcmeglintegration.h @@ -0,0 +1,68 @@ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QWAYLANDBRCMEGLINTEGRATION_H +#define QWAYLANDBRCMEGLINTEGRATION_H + +#include +#include +#include + +#include +#include + +#include + +#include + +struct qt_brcm; + +QT_BEGIN_NAMESPACE + +class QWindow; + +namespace QtWaylandClient { + +class QWaylandWindow; + +class QWaylandBrcmEglIntegration : public QWaylandClientBufferIntegration +{ +public: + QWaylandBrcmEglIntegration(); + ~QWaylandBrcmEglIntegration(); + + void initialize(QWaylandDisplay *waylandDisplay) override; + + bool supportsThreadedOpenGL() const override { return true; } + bool supportsWindowDecoration() const override { return false; } + + QWaylandWindow *createEglWindow(QWindow *window); + QPlatformOpenGLContext *createPlatformOpenGLContext(const QSurfaceFormat &glFormat, QPlatformOpenGLContext *share) const override; + + EGLDisplay eglDisplay() const; + + struct qt_brcm *waylandBrcm() const; + + PFNEGLFLUSHBRCMPROC eglFlushBRCM; + PFNEGLCREATEGLOBALIMAGEBRCMPROC eglCreateGlobalImageBRCM; + PFNEGLDESTROYGLOBALIMAGEBRCMPROC eglDestroyGlobalImageBRCM; + + void *nativeResource(NativeResource resource) override; + void *nativeResourceForContext(NativeResource resource, QPlatformOpenGLContext *context) override; + +private: + static void wlDisplayHandleGlobal(void *data, struct ::wl_registry *registry, uint32_t id, const QString &interface, uint32_t version); + + struct wl_display *m_waylandDisplay = nullptr; + struct qt_brcm *m_waylandBrcm = nullptr; + + EGLDisplay m_eglDisplay = EGL_NO_DISPLAY; + + QWaylandDisplay *m_display = nullptr; +}; + +} + +QT_END_NAMESPACE + +#endif // QWAYLANDBRCMEGLINTEGRATION_H diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/qwaylandbrcmeglwindow.cpp b/src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/qwaylandbrcmeglwindow.cpp new file mode 100644 index 00000000000..117e57807f6 --- /dev/null +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/qwaylandbrcmeglwindow.cpp @@ -0,0 +1,230 @@ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#include "qwaylandbrcmeglwindow.h" + +#include +#include +#include "qwaylandbrcmglcontext.h" + +#include + +#include +#include + +#include + +#include "wayland-brcm-client-protocol.h" + +QT_BEGIN_NAMESPACE + +namespace QtWaylandClient { + +class QWaylandBrcmBuffer : public QWaylandBuffer +{ +public: + QWaylandBrcmBuffer(QWaylandDisplay *display, + struct qt_brcm *brcm, + const QSize &size, + EGLint *data, + int count, + struct wl_event_queue *eventQueue) + : m_size(size) + , m_display(display) + , m_eventQueue(eventQueue) + { + wl_array_init(&m_array); + m_data = static_cast(wl_array_add(&m_array, count * sizeof(EGLint))); + + for (int i = 0; i < count; ++i) + m_data[i] = data[i]; + + mBuffer = qt_brcm_create_buffer(brcm, size.width(), size.height(), &m_array); + wl_proxy_set_queue(reinterpret_cast(mBuffer), m_eventQueue); + + static const struct wl_buffer_listener buffer_listener = { + QWaylandBrcmBuffer::buffer_release + }; + + wl_buffer_add_listener(mBuffer, &buffer_listener, this); + } + + ~QWaylandBrcmBuffer() + { + wl_array_release(&m_array); + wl_buffer_destroy(mBuffer); + mBuffer = nullptr; + } + + QSize size() const { return m_size; } + + void bind() + { + m_released = false; + } + + void waitForRelease() + { + if (m_released) + return; + while (!m_released) { + wl_display_dispatch_queue(m_display->wl_display(), m_eventQueue); + } + } + + static void buffer_release(void *data, wl_buffer *buffer) + { + Q_UNUSED(buffer); + static_cast(data)->m_released = true; + } + +private: + + QSize m_size; + bool m_released = true; + wl_array m_array; + EGLint *m_data = nullptr; + QWaylandDisplay *m_display = nullptr; + struct wl_event_queue *m_eventQueue = nullptr; +}; + +QWaylandBrcmEglWindow::QWaylandBrcmEglWindow(QWindow *window, QWaylandDisplay *display) + : QWaylandWindow(window, display) + , m_eglIntegration(static_cast(mDisplay->clientBufferIntegration())) + , m_format(window->format()) + , m_eventQueue(wl_display_create_queue(mDisplay->wl_display())) +{ +} + +QWaylandBrcmEglWindow::~QWaylandBrcmEglWindow() +{ + destroyEglSurfaces(); +} + +QWaylandWindow::WindowType QWaylandBrcmEglWindow::windowType() const +{ + return QWaylandWindow::Egl; +} + +void QWaylandBrcmEglWindow::setGeometry(const QRect &rect) +{ + destroyEglSurfaces(); + QWaylandWindow::setGeometry(rect); +} + +QSurfaceFormat QWaylandBrcmEglWindow::format() const +{ + return m_format; +} + +void QWaylandBrcmEglWindow::destroyEglSurfaces() +{ + for (int i = 0; i < m_count; ++i) { + if (m_eglSurfaces[i]) { + eglDestroySurface(m_eglIntegration->eglDisplay(), m_eglSurfaces[i]); + m_eglSurfaces[i] = 0; + // the server does this + //m_eglIntegration->eglDestroyGlobalImageBRCM(&m_globalImages[5*i]); + delete m_buffers[i]; + } + } + + m_count = 0; + m_current = 0; +} + +QSurfaceFormat brcmFixFormat(const QSurfaceFormat &f) +{ + QSurfaceFormat format = f; + format.setRedBufferSize(8); + format.setGreenBufferSize(8); + format.setBlueBufferSize(8); + format.setAlphaBufferSize(8); + return format; +} + +void QWaylandBrcmEglWindow::createEglSurfaces() +{ + QSize size(geometry().size()); + + m_count = window()->format().swapBehavior() == QSurfaceFormat::TripleBuffer ? 3 : 2; + + EGLConfig eglConfig = q_configFromGLFormat(m_eglIntegration->eglDisplay(), brcmFixFormat(window()->format()), true, EGL_PIXMAP_BIT); + + m_format = q_glFormatFromConfig(m_eglIntegration->eglDisplay(), eglConfig); + + EGLint pixel_format = EGL_PIXEL_FORMAT_ARGB_8888_BRCM; + + EGLint rt; + eglGetConfigAttrib(m_eglIntegration->eglDisplay(), eglConfig, EGL_RENDERABLE_TYPE, &rt); + + if (rt & EGL_OPENGL_ES_BIT) { + pixel_format |= EGL_PIXEL_FORMAT_RENDER_GLES_BRCM; + pixel_format |= EGL_PIXEL_FORMAT_GLES_TEXTURE_BRCM; + } + + if (rt & EGL_OPENGL_ES2_BIT) { + pixel_format |= EGL_PIXEL_FORMAT_RENDER_GLES2_BRCM; + pixel_format |= EGL_PIXEL_FORMAT_GLES2_TEXTURE_BRCM; + } + + if (rt & EGL_OPENVG_BIT) { + pixel_format |= EGL_PIXEL_FORMAT_RENDER_VG_BRCM; + pixel_format |= EGL_PIXEL_FORMAT_VG_IMAGE_BRCM; + } + + if (rt & EGL_OPENGL_BIT) { + pixel_format |= EGL_PIXEL_FORMAT_RENDER_GL_BRCM; + } + + memset(m_globalImages, 0, 5 * m_count * sizeof(EGLint)); + for (int i = 0; i < m_count; ++i) { + m_eglIntegration->eglCreateGlobalImageBRCM(size.width(), size.height(), pixel_format, + 0, size.width() * 4, &m_globalImages[5*i]); + + m_globalImages[5*i+2] = size.width(); + m_globalImages[5*i+3] = size.height(); + m_globalImages[5*i+4] = pixel_format; + + EGLint attrs[] = { + EGL_VG_COLORSPACE, EGL_VG_COLORSPACE_sRGB, + EGL_VG_ALPHA_FORMAT, pixel_format & EGL_PIXEL_FORMAT_ARGB_8888_PRE_BRCM ? EGL_VG_ALPHA_FORMAT_PRE : EGL_VG_ALPHA_FORMAT_NONPRE, + EGL_NONE + }; + + m_eglSurfaces[i] = eglCreatePixmapSurface(m_eglIntegration->eglDisplay(), eglConfig, (EGLNativePixmapType)&m_globalImages[5*i], attrs); + if (m_eglSurfaces[i] == EGL_NO_SURFACE) + qFatal("eglCreatePixmapSurface failed: %x, global image id: %d %d\n", eglGetError(), m_globalImages[5*i], m_globalImages[5*i+1]); + m_buffers[i] = new QWaylandBrcmBuffer(mDisplay, m_eglIntegration->waylandBrcm(), size, &m_globalImages[5*i], 5, m_eventQueue); + } +} + +void QWaylandBrcmEglWindow::swapBuffers() +{ + if (m_eglIntegration->eglFlushBRCM) { + m_eglIntegration->eglFlushBRCM(); + } else { + glFlush(); + glFinish(); + } + + if (!m_count) + return; + + m_buffers[m_current]->bind(); + commit(m_buffers[m_current], QRegion(0, 0, geometry().size().width(), geometry().size().height())); + + m_current = (m_current + 1) % m_count; + m_buffers[m_current]->waitForRelease(); +} + +bool QWaylandBrcmEglWindow::makeCurrent(EGLContext context) +{ + if (!m_count) + const_cast(this)->createEglSurfaces(); + return eglMakeCurrent(m_eglIntegration->eglDisplay(), m_eglSurfaces[m_current], m_eglSurfaces[m_current], context); +} + +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/qwaylandbrcmeglwindow.h b/src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/qwaylandbrcmeglwindow.h new file mode 100644 index 00000000000..3b9026f9c0a --- /dev/null +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/qwaylandbrcmeglwindow.h @@ -0,0 +1,59 @@ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QWAYLANDBRCMEGLWINDOW_H +#define QWAYLANDBRCMEGLWINDOW_H + +#include +#include "qwaylandbrcmeglintegration.h" + +#include + +#include + +QT_BEGIN_NAMESPACE + +namespace QtWaylandClient { + +class QWaylandBrcmBuffer; + +class QWaylandBrcmEglWindow : public QWaylandWindow +{ + Q_OBJECT +public: + QWaylandBrcmEglWindow(QWindow *window, QWaylandDisplay *display); + ~QWaylandBrcmEglWindow(); + WindowType windowType() const override; + void setGeometry(const QRect &rect) override; + + QSurfaceFormat format() const override; + + bool makeCurrent(EGLContext context); + void swapBuffers(); + +private: + void createEglSurfaces(); + void destroyEglSurfaces(); + + QWaylandBrcmEglIntegration *m_eglIntegration = nullptr; + struct wl_egl_window *m_waylandEglWindow = nullptr; + + const QWaylandWindow *m_parentWindow = nullptr; + + EGLint m_globalImages[3*5]; + EGLSurface m_eglSurfaces[3]; + + QWaylandBrcmBuffer *m_buffers[3]; + QSurfaceFormat m_format; + + struct wl_event_queue *m_eventQueue = nullptr; + + int m_current = 0; + int m_count = 0; +}; + +} + +QT_END_NAMESPACE + +#endif // QWAYLANDBRCMEGLWINDOW_H diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/qwaylandbrcmglcontext.cpp b/src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/qwaylandbrcmglcontext.cpp new file mode 100644 index 00000000000..66135a7cc43 --- /dev/null +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/qwaylandbrcmglcontext.cpp @@ -0,0 +1,76 @@ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#include "qwaylandbrcmglcontext.h" + +#include +#include +#include "qwaylandbrcmeglwindow.h" + +#include + +#include +#include + +#include + +QT_BEGIN_NAMESPACE + +namespace QtWaylandClient { + +extern QSurfaceFormat brcmFixFormat(const QSurfaceFormat &format); + +QWaylandBrcmGLContext::QWaylandBrcmGLContext(EGLDisplay eglDisplay, const QSurfaceFormat &format, QPlatformOpenGLContext *share) + : QPlatformOpenGLContext() + , m_eglDisplay(eglDisplay) + , m_config(q_configFromGLFormat(m_eglDisplay, brcmFixFormat(format), true)) + , m_format(q_glFormatFromConfig(m_eglDisplay, m_config)) +{ + EGLContext shareEGLContext = share ? static_cast(share)->eglContext() : EGL_NO_CONTEXT; + + eglBindAPI(EGL_OPENGL_ES_API); + + QList eglContextAttrs; + eglContextAttrs.append(EGL_CONTEXT_CLIENT_VERSION); + eglContextAttrs.append(format.majorVersion() == 1 ? 1 : 2); + eglContextAttrs.append(EGL_NONE); + + m_context = eglCreateContext(m_eglDisplay, m_config, shareEGLContext, eglContextAttrs.constData()); +} + +QWaylandBrcmGLContext::~QWaylandBrcmGLContext() +{ + eglDestroyContext(m_eglDisplay, m_context); +} + +bool QWaylandBrcmGLContext::makeCurrent(QPlatformSurface *surface) +{ + return static_cast(surface)->makeCurrent(m_context); +} + +void QWaylandBrcmGLContext::doneCurrent() +{ + eglMakeCurrent(m_eglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); +} + +void QWaylandBrcmGLContext::swapBuffers(QPlatformSurface *surface) +{ + static_cast(surface)->swapBuffers(); +} + +QFunctionPointer QWaylandBrcmGLContext::getProcAddress(const char *procName) +{ + QFunctionPointer proc = (QFunctionPointer) eglGetProcAddress(procName); + if (!proc) + proc = (QFunctionPointer) dlsym(RTLD_DEFAULT, procName); + return proc; +} + +EGLConfig QWaylandBrcmGLContext::eglConfig() const +{ + return m_config; +} + +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/qwaylandbrcmglcontext.h b/src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/qwaylandbrcmglcontext.h new file mode 100644 index 00000000000..e64a20d9b73 --- /dev/null +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/brcm-egl/qwaylandbrcmglcontext.h @@ -0,0 +1,48 @@ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QWAYLANDBRCMGLCONTEXT_H +#define QWAYLANDBRCMGLCONTEXT_H + +#include + +#include + +#include + +QT_BEGIN_NAMESPACE + +namespace QtWaylandClient { + +class QWaylandWindow; + +class QWaylandBrcmGLContext : public QPlatformOpenGLContext { +public: + QWaylandBrcmGLContext(EGLDisplay eglDisplay, const QSurfaceFormat &format, QPlatformOpenGLContext *share); + ~QWaylandBrcmGLContext(); + + void swapBuffers(QPlatformSurface *surface) override; + + bool makeCurrent(QPlatformSurface *surface) override; + void doneCurrent() override; + + QFunctionPointer getProcAddress(const char *procName) override; + + QSurfaceFormat format() const override { return m_format; } + + EGLConfig eglConfig() const; + EGLContext eglContext() const { return m_context; } + +private: + EGLDisplay m_eglDisplay = EGL_NO_DISPLAY; + + EGLContext m_context; + EGLConfig m_config; + QSurfaceFormat m_format; +}; + +} + +QT_END_NAMESPACE + +#endif // QWAYLANDBRCMGLCONTEXT_H diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/dmabuf-server/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/hardwareintegration/dmabuf-server/CMakeLists.txt index 7329aebc323..68c09f76e30 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/dmabuf-server/CMakeLists.txt +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/dmabuf-server/CMakeLists.txt @@ -11,10 +11,8 @@ qt_internal_add_plugin(DmaBufServerBufferPlugin OUTPUT_NAME dmabuf-server PLUGIN_TYPE wayland-graphics-integration-client SOURCES - ../../../../hardwareintegration/client/dmabuf-server/dmabufserverbufferintegration.cpp ../../../../hardwareintegration/client/dmabuf-server/dmabufserverbufferintegration.h + dmabufserverbufferintegration.cpp dmabufserverbufferintegration.h main.cpp - INCLUDE_DIRECTORIES - ../../../../hardwareintegration/client/dmabuf-server LIBRARIES EGL::EGL Qt::Core diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/dmabuf-server/dmabufserverbufferintegration.cpp b/src/plugins/platforms/wayland/plugins/hardwareintegration/dmabuf-server/dmabufserverbufferintegration.cpp new file mode 100644 index 00000000000..54df2badd2e --- /dev/null +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/dmabuf-server/dmabufserverbufferintegration.cpp @@ -0,0 +1,152 @@ +// Copyright (C) 2018 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#include "dmabufserverbufferintegration.h" +#include +#include +#include +#include + +#include +#include + +QT_BEGIN_NAMESPACE + +namespace QtWaylandClient { + +DmaBufServerBuffer::DmaBufServerBuffer(DmaBufServerBufferIntegration *integration + , struct ::qt_server_buffer *id + , int32_t fd + , int32_t width + , int32_t height + , int32_t stride + , int32_t offset + , int32_t fourcc_format) + : m_integration(integration) + , m_server_buffer(id) +{ + m_size = QSize(width, height); + + + EGLint import_attribs[] = { + EGL_WIDTH, width, + EGL_HEIGHT, height, + EGL_LINUX_DRM_FOURCC_EXT, fourcc_format, + EGL_DMA_BUF_PLANE0_FD_EXT, fd, + EGL_DMA_BUF_PLANE0_OFFSET_EXT, offset, + EGL_DMA_BUF_PLANE0_PITCH_EXT, stride, + EGL_NONE + }; + + m_image = integration->eglCreateImageKHR( + EGL_NO_CONTEXT, + EGL_LINUX_DMA_BUF_EXT, + (EGLClientBuffer)nullptr, + import_attribs); + + int err = eglGetError(); + qCDebug(lcQpaWayland) << "imported egl image" << m_image; + if (m_image == EGL_NO_IMAGE_KHR || err != EGL_SUCCESS) + qCWarning(lcQpaWayland) << "DmaBufServerBuffer error importing image. EGL error code" << Qt::hex << err; + + qt_server_buffer_set_user_data(id, this); + +} + +DmaBufServerBuffer::~DmaBufServerBuffer() +{ + int err = m_integration->eglDestroyImageKHR(m_image); + if (err != EGL_SUCCESS) + qCWarning(lcQpaWayland) << "~DmaBufServerBuffer error destroying image" << m_image << "error code " << Qt::hex << err; + qt_server_buffer_release(m_server_buffer); + qt_server_buffer_destroy(m_server_buffer); +} + +QOpenGLTexture *DmaBufServerBuffer::toOpenGlTexture() +{ + if (!QOpenGLContext::currentContext()) + qCWarning(lcQpaWayland) <<"DmaBufServerBuffer: creating texture with no current context"; + + if (!m_texture) { + m_texture = new QOpenGLTexture(QOpenGLTexture::Target2D); + m_texture->create(); + } + + m_texture->bind(); + m_integration->glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, m_image); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + m_texture->release(); + m_texture->setSize(m_size.width(), m_size.height()); + return m_texture; +} + +void DmaBufServerBufferIntegration::initializeEgl() +{ + if (m_egl_initialized) + return; + m_egl_initialized = true; + + m_egl_display = eglGetDisplay((EGLNativeDisplayType) m_display->wl_display()); + if (m_egl_display == EGL_NO_DISPLAY) { + qCWarning(lcQpaWayland) << "Failed to initialize drm egl server buffer integration. Could not get egl display from wl_display."; + return; + } + + const char *extensionString = eglQueryString(m_egl_display, EGL_EXTENSIONS); + + + if (!extensionString || !strstr(extensionString, "EGL_KHR_image")) { + qCWarning(lcQpaWayland) << "Failed to initialize dmabuf server buffer integration. There is no EGL_KHR_image extension.\n"; + return; + } + m_egl_create_image = reinterpret_cast(eglGetProcAddress("eglCreateImageKHR")); + m_egl_destroy_image = reinterpret_cast(eglGetProcAddress("eglDestroyImageKHR")); + if (!m_egl_create_image || !m_egl_destroy_image) { + qCWarning(lcQpaWayland) << "Failed to initialize dmabuf server buffer integration. Could not resolve eglCreateImageKHR or eglDestroyImageKHR"; + return; + } + + m_gl_egl_image_target_texture = reinterpret_cast(eglGetProcAddress("glEGLImageTargetTexture2DOES")); + if (!m_gl_egl_image_target_texture) { + qCWarning(lcQpaWayland) << "Failed to initialize dmabuf server buffer integration. Could not resolve glEGLImageTargetTexture2DOES"; + return; + } +} + +void DmaBufServerBufferIntegration::initialize(QWaylandDisplay *display) +{ + m_display = display; + display->addRegistryListener(&wlDisplayHandleGlobal, this); +} + +QWaylandServerBuffer *DmaBufServerBufferIntegration::serverBuffer(struct qt_server_buffer *buffer) +{ + return static_cast(qt_server_buffer_get_user_data(buffer)); +} + +void DmaBufServerBufferIntegration::wlDisplayHandleGlobal(void *data, ::wl_registry *registry, uint32_t id, const QString &interface, uint32_t version) +{ + Q_UNUSED(version); + if (interface == QStringLiteral("qt_dmabuf_server_buffer")) { + auto *integration = static_cast(data); + integration->QtWayland::qt_dmabuf_server_buffer::init(registry, id, 1); + } +} + +void DmaBufServerBufferIntegration::dmabuf_server_buffer_server_buffer_created(struct ::qt_server_buffer *id + , int32_t name + , int32_t width + , int32_t height + , int32_t stride + , int32_t offset + , int32_t format) +{ + (void) new DmaBufServerBuffer(this, id, name, width, height, stride, offset, format); +} + +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/dmabuf-server/dmabufserverbufferintegration.h b/src/plugins/platforms/wayland/plugins/hardwareintegration/dmabuf-server/dmabufserverbufferintegration.h new file mode 100644 index 00000000000..13dbdfbfbab --- /dev/null +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/dmabuf-server/dmabufserverbufferintegration.h @@ -0,0 +1,111 @@ +// Copyright (C) 2018 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef DMABUFSERVERBUFFERINTEGRATION_H +#define DMABUFSERVERBUFFERINTEGRATION_H + +#include +#include +#include "qwayland-qt-dmabuf-server-buffer.h" +#include + +#include "dmabufserverbufferintegration.h" +#include +#include + +#include +#include +#ifndef EGL_KHR_image +typedef void *EGLImageKHR; +typedef EGLImageKHR (EGLAPIENTRYP PFNEGLCREATEIMAGEKHRPROC) (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYIMAGEKHRPROC) (EGLDisplay dpy, EGLImageKHR image); +#endif + +#ifndef GL_OES_EGL_image +typedef void (GL_APIENTRYP PFNGLEGLIMAGETARGETTEXTURE2DOESPROC) (GLenum target, GLeglImageOES image); +#endif + +QT_BEGIN_NAMESPACE + +namespace QtWaylandClient { + +class DmaBufServerBufferIntegration; + +class DmaBufServerBuffer : public QWaylandServerBuffer +{ +public: + DmaBufServerBuffer(DmaBufServerBufferIntegration *integration, struct ::qt_server_buffer *id, int32_t fd, + int32_t width, int32_t height, int32_t stride, int32_t offset, int32_t fourcc_format); + ~DmaBufServerBuffer() override; + QOpenGLTexture* toOpenGlTexture() override; +private: + DmaBufServerBufferIntegration *m_integration = nullptr; + EGLImageKHR m_image = EGL_NO_IMAGE_KHR; + QOpenGLTexture *m_texture = nullptr; + struct ::qt_server_buffer *m_server_buffer = nullptr; +}; + +class DmaBufServerBufferIntegration + : public QWaylandServerBufferIntegration + , public QtWayland::qt_dmabuf_server_buffer +{ +public: + void initialize(QWaylandDisplay *display) override; + + QWaylandServerBuffer *serverBuffer(struct qt_server_buffer *buffer) override; + + inline EGLImageKHR eglCreateImageKHR(EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list); + inline EGLBoolean eglDestroyImageKHR(EGLImageKHR image); + inline void glEGLImageTargetTexture2DOES(GLenum target, GLeglImageOES image); +protected: + void dmabuf_server_buffer_server_buffer_created(struct ::qt_server_buffer *id, int32_t fd, + int32_t width, int32_t height, int32_t stride, + int32_t offset, int32_t fourcc_format) override; + +private: + static void wlDisplayHandleGlobal(void *data, struct ::wl_registry *registry, uint32_t id, + const QString &interface, uint32_t version); + void initializeEgl(); + + PFNEGLCREATEIMAGEKHRPROC m_egl_create_image = nullptr; + PFNEGLDESTROYIMAGEKHRPROC m_egl_destroy_image = nullptr; + PFNGLEGLIMAGETARGETTEXTURE2DOESPROC m_gl_egl_image_target_texture = nullptr; + QWaylandDisplay *m_display = nullptr; + EGLDisplay m_egl_display = EGL_NO_DISPLAY; + bool m_egl_initialized = false; +}; + +EGLImageKHR DmaBufServerBufferIntegration::eglCreateImageKHR(EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list) +{ + if (!m_egl_initialized) + initializeEgl(); + if (!m_egl_create_image) { + qCWarning(lcQpaWayland) << "DmaBufServerBufferIntegration: Trying to use unresolved function eglCreateImageKHR"; + return EGL_NO_IMAGE_KHR; + } + return m_egl_create_image(m_egl_display, ctx, target, buffer, attrib_list); +} + +EGLBoolean DmaBufServerBufferIntegration::eglDestroyImageKHR(EGLImageKHR image) +{ + if (!m_egl_destroy_image) { + qCWarning(lcQpaWayland) << "DmaBufServerBufferIntegration: Trying to use unresolved function eglDestroyImageKHR"; + return false; + } + return m_egl_destroy_image(m_egl_display, image); +} + +void DmaBufServerBufferIntegration::glEGLImageTargetTexture2DOES(GLenum target, GLeglImageOES image) +{ + if (!m_gl_egl_image_target_texture) { + qCWarning(lcQpaWayland) << "DmaBufServerBufferIntegration: Trying to use unresolved function glEGLImageTargetTexture2DOES"; + return; + } + m_gl_egl_image_target_texture(target, image); +} + +} + +QT_END_NAMESPACE + +#endif diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/drm-egl-server/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/hardwareintegration/drm-egl-server/CMakeLists.txt index 535b1024f0f..c552a9b2878 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/drm-egl-server/CMakeLists.txt +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/drm-egl-server/CMakeLists.txt @@ -11,10 +11,8 @@ qt_internal_add_plugin(DrmEglServerBufferPlugin OUTPUT_NAME drm-egl-server PLUGIN_TYPE wayland-graphics-integration-client SOURCES - ../../../../hardwareintegration/client/drm-egl-server/drmeglserverbufferintegration.cpp ../../../../hardwareintegration/client/drm-egl-server/drmeglserverbufferintegration.h + drmeglserverbufferintegration.cpp drmeglserverbufferintegration.h main.cpp - INCLUDE_DIRECTORIES - ../../../../hardwareintegration/client/drm-egl-server LIBRARIES EGL::EGL Qt::Core diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/drm-egl-server/drmeglserverbufferintegration.cpp b/src/plugins/platforms/wayland/plugins/hardwareintegration/drm-egl-server/drmeglserverbufferintegration.cpp new file mode 100644 index 00000000000..16a3aa4cf51 --- /dev/null +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/drm-egl-server/drmeglserverbufferintegration.cpp @@ -0,0 +1,155 @@ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#include "drmeglserverbufferintegration.h" +#include +#include +#include +#include + +#include + +QT_BEGIN_NAMESPACE + +namespace QtWaylandClient { + +DrmServerBuffer::DrmServerBuffer(DrmEglServerBufferIntegration *integration + , int32_t name + , int32_t width + , int32_t height + , int32_t stride + , int32_t format) + : m_integration(integration) +{ + m_size = QSize(width, height); + EGLint egl_format; + int32_t format_stride; + switch (format) { + case QtWayland::qt_drm_egl_server_buffer::format_RGBA32: + m_format = QWaylandServerBuffer::RGBA32; + egl_format = EGL_DRM_BUFFER_FORMAT_ARGB32_MESA; + format_stride = stride / 4; + break; +#ifdef EGL_DRM_BUFFER_FORMAT_A8_MESA + case QtWayland::qt_drm_egl_server_buffer::format_A8: + m_format = QWaylandServerBuffer::A8; + egl_format = EGL_DRM_BUFFER_FORMAT_A8_MESA; + format_stride = stride; + break; +#endif + default: + qWarning("DrmServerBuffer: unknown format"); + m_format = QWaylandServerBuffer::RGBA32; + egl_format = EGL_DRM_BUFFER_FORMAT_ARGB32_MESA; + format_stride = stride / 4; + break; + } + EGLint attribs[] = { + EGL_WIDTH, width, + EGL_HEIGHT, height, + EGL_DRM_BUFFER_STRIDE_MESA, format_stride, + EGL_DRM_BUFFER_FORMAT_MESA, egl_format, + EGL_NONE + }; + + qintptr name_pointer = name; + m_image = integration->eglCreateImageKHR(EGL_NO_CONTEXT, EGL_DRM_BUFFER_MESA, (EGLClientBuffer) name_pointer, attribs); + +} + +DrmServerBuffer::~DrmServerBuffer() +{ + m_integration->eglDestroyImageKHR(m_image); +} + +QOpenGLTexture *DrmServerBuffer::toOpenGlTexture() +{ + if (!QOpenGLContext::currentContext()) + qWarning("DrmServerBuffer: creating texture with no current context"); + + if (!m_texture) { + m_texture = new QOpenGLTexture(QOpenGLTexture::Target2D); + m_texture->create(); + } + + m_texture->bind(); + m_integration->glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, m_image); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + m_texture->release(); + m_texture->setSize(m_size.width(), m_size.height()); + return m_texture; +} + +void DrmEglServerBufferIntegration::initializeEgl() +{ + if (m_egl_initialized) + return; + m_egl_initialized = true; + +#if QT_CONFIG(egl_extension_platform_wayland) + m_egl_display = eglGetPlatformDisplay(EGL_PLATFORM_WAYLAND_EXT, m_display->wl_display(), nullptr); +#else + m_egl_display = eglGetDisplay((EGLNativeDisplayType) m_display->wl_display()); +#endif + if (m_egl_display == EGL_NO_DISPLAY) { + qWarning("Failed to initialize drm egl server buffer integration. Could not get egl display from wl_display."); + return; + } + + const char *extensionString = eglQueryString(m_egl_display, EGL_EXTENSIONS); + if (!extensionString || !strstr(extensionString, "EGL_KHR_image")) { + qWarning("Failed to initialize drm egl server buffer integration. There is no EGL_KHR_image extension.\n"); + return; + } + m_egl_create_image = reinterpret_cast(eglGetProcAddress("eglCreateImageKHR")); + m_egl_destroy_image = reinterpret_cast(eglGetProcAddress("eglDestroyImageKHR")); + if (!m_egl_create_image || !m_egl_destroy_image) { + qWarning("Failed to initialize drm egl server buffer integration. Could not resolve eglCreateImageKHR or eglDestroyImageKHR"); + return; + } + + m_gl_egl_image_target_texture = reinterpret_cast(eglGetProcAddress("glEGLImageTargetTexture2DOES")); + if (!m_gl_egl_image_target_texture) { + qWarning("Failed to initialize drm egl server buffer integration. Could not resolve glEGLImageTargetTexture2DOES"); + return; + } + m_egl_initialized = true; +} + +void DrmEglServerBufferIntegration::initialize(QWaylandDisplay *display) +{ + m_display = display; + display->addRegistryListener(&wlDisplayHandleGlobal, this); +} + +QWaylandServerBuffer *DrmEglServerBufferIntegration::serverBuffer(struct qt_server_buffer *buffer) +{ + return static_cast(qt_server_buffer_get_user_data(buffer)); +} + +void DrmEglServerBufferIntegration::wlDisplayHandleGlobal(void *data, ::wl_registry *registry, uint32_t id, const QString &interface, uint32_t version) +{ + Q_UNUSED(version); + if (interface == QStringLiteral("qt_drm_egl_server_buffer")) { + auto *integration = static_cast(data); + integration->QtWayland::qt_drm_egl_server_buffer::init(registry, id, 1); + } +} + +void DrmEglServerBufferIntegration::drm_egl_server_buffer_server_buffer_created(struct ::qt_server_buffer *id + , int32_t name + , int32_t width + , int32_t height + , int32_t stride + , int32_t format) +{ + DrmServerBuffer *server_buffer = new DrmServerBuffer(this, name, width, height, stride, format); + qt_server_buffer_set_user_data(id, server_buffer); +} + +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/drm-egl-server/drmeglserverbufferintegration.h b/src/plugins/platforms/wayland/plugins/hardwareintegration/drm-egl-server/drmeglserverbufferintegration.h new file mode 100644 index 00000000000..a06bc96b87d --- /dev/null +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/drm-egl-server/drmeglserverbufferintegration.h @@ -0,0 +1,106 @@ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef DRMEGLSERVERBUFFERINTEGRATION_H +#define DRMEGLSERVERBUFFERINTEGRATION_H + +#include +#include +#include "qwayland-drm-egl-server-buffer.h" +#include + +#include "drmeglserverbufferintegration.h" +#include +#include + +#include +#include +#ifndef EGL_KHR_image +typedef void *EGLImageKHR; +typedef EGLImageKHR (EGLAPIENTRYP PFNEGLCREATEIMAGEKHRPROC) (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYIMAGEKHRPROC) (EGLDisplay dpy, EGLImageKHR image); +#endif + +#ifndef GL_OES_EGL_image +typedef void (GL_APIENTRYP PFNGLEGLIMAGETARGETTEXTURE2DOESPROC) (GLenum target, GLeglImageOES image); +#endif + +QT_BEGIN_NAMESPACE + +namespace QtWaylandClient { + +class DrmEglServerBufferIntegration; + +class DrmServerBuffer : public QWaylandServerBuffer +{ +public: + DrmServerBuffer(DrmEglServerBufferIntegration *integration, int32_t name, int32_t width, int32_t height, int32_t stride, int32_t format); + ~DrmServerBuffer() override; + QOpenGLTexture* toOpenGlTexture() override; +private: + DrmEglServerBufferIntegration *m_integration = nullptr; + EGLImageKHR m_image; + QOpenGLTexture *m_texture = nullptr; +}; + +class DrmEglServerBufferIntegration + : public QWaylandServerBufferIntegration + , public QtWayland::qt_drm_egl_server_buffer +{ +public: + void initialize(QWaylandDisplay *display) override; + + QWaylandServerBuffer *serverBuffer(struct qt_server_buffer *buffer) override; + + inline EGLImageKHR eglCreateImageKHR(EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list); + inline EGLBoolean eglDestroyImageKHR (EGLImageKHR image); + inline void glEGLImageTargetTexture2DOES (GLenum target, GLeglImageOES image); +protected: + void drm_egl_server_buffer_server_buffer_created(struct ::qt_server_buffer *id, int32_t name, int32_t width, int32_t height, int32_t stride, int32_t format) override; +private: + static void wlDisplayHandleGlobal(void *data, struct ::wl_registry *registry, uint32_t id, + const QString &interface, uint32_t version); + void initializeEgl(); + + PFNEGLCREATEIMAGEKHRPROC m_egl_create_image; + PFNEGLDESTROYIMAGEKHRPROC m_egl_destroy_image; + PFNGLEGLIMAGETARGETTEXTURE2DOESPROC m_gl_egl_image_target_texture; + QWaylandDisplay *m_display = nullptr; + EGLDisplay m_egl_display = EGL_NO_DISPLAY; + bool m_egl_initialized = false; +}; + +EGLImageKHR DrmEglServerBufferIntegration::eglCreateImageKHR(EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list) +{ + if (!m_egl_initialized) + initializeEgl(); + if (!m_egl_create_image) { + qWarning("DrmEglServerBufferIntegration: Trying to used unresolved function eglCreateImageKHR"); + return EGL_NO_IMAGE_KHR; + } + return m_egl_create_image(m_egl_display, ctx, target, buffer,attrib_list); +} + +EGLBoolean DrmEglServerBufferIntegration::eglDestroyImageKHR (EGLImageKHR image) +{ + if (!m_egl_destroy_image) { + qWarning("DrmEglServerBufferIntegration: Trying to use unresolved function eglDestroyImageKHR"); + return false; + } + return m_egl_destroy_image(m_egl_display, image); +} + +void DrmEglServerBufferIntegration::glEGLImageTargetTexture2DOES (GLenum target, GLeglImageOES image) +{ + if (!m_gl_egl_image_target_texture) { + qWarning("DrmEglServerBufferIntegration: Trying to use unresolved function glEGLImageTargetRenderbufferStorageOES"); + return; + } + m_gl_egl_image_target_texture(target,image); +} + +} + +QT_END_NAMESPACE + +#endif diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/libhybris-egl-server/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/hardwareintegration/libhybris-egl-server/CMakeLists.txt index 6b7cd897e19..351f8f6d3f4 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/libhybris-egl-server/CMakeLists.txt +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/libhybris-egl-server/CMakeLists.txt @@ -11,10 +11,8 @@ qt_internal_add_plugin(LibHybrisEglServerBufferPlugin OUTPUT_NAME libhybris-egl-server PLUGIN_TYPE wayland-graphics-integration-client SOURCES - ../../../../hardwareintegration/client/libhybris-egl-server/libhybriseglserverbufferintegration.cpp ../../../../hardwareintegration/client/libhybris-egl-server/libhybriseglserverbufferintegration.h + libhybriseglserverbufferintegration.cpp libhybriseglserverbufferintegration.h main.cpp - INCLUDE_DIRECTORIES - ../../../../hardwareintegration/client/libhybris-egl-server PUBLIC_LIBRARIES EGL::EGL Qt::Core @@ -27,7 +25,7 @@ qt_internal_add_plugin(LibHybrisEglServerBufferPlugin qt6_generate_wayland_protocol_client_sources(LibHybrisEglServerBufferPlugin PRIVATE_CODE FILES - ${CMAKE_CURRENT_SOURCE_DIR}/../../../../hardwareintegration/client/libhybris-egl-server/../../../extensions/libhybris-egl-server-buffer.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../../../extensions/libhybris-egl-server-buffer.xml ) #### Keys ignored in scope 1:.:.:libhybris-egl-server.pro:: diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/libhybris-egl-server/libhybriseglserverbufferintegration.cpp b/src/plugins/platforms/wayland/plugins/hardwareintegration/libhybris-egl-server/libhybriseglserverbufferintegration.cpp new file mode 100644 index 00000000000..54081de97af --- /dev/null +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/libhybris-egl-server/libhybriseglserverbufferintegration.cpp @@ -0,0 +1,167 @@ +// Copyright (C) 2016 Jolla Ltd, author: +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#include "libhybriseglserverbufferintegration.h" +#include +#include +#include +#include +#include + +#include + +QT_BEGIN_NAMESPACE + +namespace QtWaylandClient { + +LibHybrisServerBuffer::LibHybrisServerBuffer(LibHybrisEglServerBufferIntegration *integration + , int32_t numFds + , wl_array *ints + , int32_t name + , int32_t width + , int32_t height + , int32_t stride + , int32_t format) + : QWaylandServerBuffer() + , m_integration(integration) + , m_stride(stride) + , m_hybrisFormat(format) +{ + m_numFds = numFds; + m_fds.reserve(numFds); + m_ints.resize(ints->size / sizeof(int32_t)); + memcpy(m_ints.data(), ints->data, ints->size); + m_image = 0; + + m_size = QSize(width, height); +} + +LibHybrisServerBuffer::~LibHybrisServerBuffer() +{ + m_integration->eglDestroyImageKHR(m_image); +} + +QOpenGLTexture * LibHybrisServerBuffer::toOpenGlTexture() +{ + if (!QOpenGLContext::currentContext()) { + qWarning("LibHybrisServerBuffer: creating texture with no current context"); + } + + if (!m_texture) { + m_texture = new QOpenGLTexture(QOpenGLTexture::Target2D); + m_texture->create(); + } + + m_texture->bind(); + m_integration->glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, m_image); + + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + m_texture->release(); + m_texture->setSize(m_size.width(), m_size.height()); + + return m_texture; +} + +void LibHybrisServerBuffer::libhybris_buffer_add_fd(int32_t fd) +{ + m_fds << fd; + + if (m_fds.size() == m_numFds) { + EGLint egl_format; + switch (m_hybrisFormat) { + case QtWayland::qt_libhybris_egl_server_buffer::format_RGBA32: + m_format = QWaylandServerBuffer::RGBA32; + egl_format = HYBRIS_PIXEL_FORMAT_RGBA_8888; + break; + default: + qWarning("LibHybrisServerBuffer: unknown format"); + m_format = QWaylandServerBuffer::RGBA32; + egl_format = HYBRIS_PIXEL_FORMAT_RGBA_8888; + break; + } + + EGLClientBuffer buf; + m_integration->eglHybrisCreateRemoteBuffer(m_size.width(), m_size.height(), HYBRIS_USAGE_HW_TEXTURE, egl_format, m_stride, m_ints.size(), m_ints.data(), m_fds.size(), m_fds.data(), &buf); + m_image = m_integration->eglCreateImageKHR(EGL_NO_CONTEXT, EGL_NATIVE_BUFFER_ANDROID, buf, 0); + } +} + +void LibHybrisEglServerBufferIntegration::initializeEgl() +{ + if (m_egl_initialized) + return; + m_egl_initialized = true; + + m_egl_display = eglGetDisplay((EGLNativeDisplayType) m_display->wl_display()); + if (m_egl_display == EGL_NO_DISPLAY) { + qWarning("Failed to initialize libhybris egl server buffer integration. Could not get egl display from wl_display."); + return; + } + + const char *extensionString = eglQueryString(m_egl_display, EGL_EXTENSIONS); + if (!extensionString || !strstr(extensionString, "EGL_KHR_image")) { + qWarning("Failed to initialize libhybris egl server buffer integration. There is no EGL_KHR_image extension.\n"); + return; + } + m_egl_create_image = reinterpret_cast(eglGetProcAddress("eglCreateImageKHR")); + m_egl_destroy_image = reinterpret_cast(eglGetProcAddress("eglDestroyImageKHR")); + if (!m_egl_create_image || !m_egl_destroy_image) { + qWarning("Failed to initialize libhybris egl server buffer integration. Could not resolve eglCreateImageKHR or eglDestroyImageKHR"); + return; + } + + m_gl_egl_image_target_texture = reinterpret_cast(eglGetProcAddress("glEGLImageTargetTexture2DOES")); + if (!m_gl_egl_image_target_texture) { + qWarning("Failed to initialize libhybris egl server buffer integration. Could not resolve glEGLImageTargetTexture2DOES"); + return; + } + + m_egl_create_buffer = reinterpret_cast(eglGetProcAddress("eglHybrisCreateRemoteBuffer")); + if (!m_egl_create_buffer) { + qWarning("Failed to initialize libhybris egl server buffer integration. Could not resolve eglHybrisCreateRemoteBuffer"); + return; + } + m_egl_initialized = true; +} + +void LibHybrisEglServerBufferIntegration::initialize(QWaylandDisplay *display) +{ + m_display = display; + display->addRegistryListener(&wlDisplayHandleGlobal, this); +} + +QWaylandServerBuffer *LibHybrisEglServerBufferIntegration::serverBuffer(struct qt_server_buffer *buffer) +{ + return static_cast(qt_server_buffer_get_user_data(buffer)); +} + +void LibHybrisEglServerBufferIntegration::wlDisplayHandleGlobal(void *data, ::wl_registry *registry, uint32_t id, const QString &interface, uint32_t version) +{ + Q_UNUSED(version); + if (interface == QStringLiteral("qt_libhybris_egl_server_buffer")) { + auto *integration = static_cast(data); + integration->QtWayland::qt_libhybris_egl_server_buffer::init(registry, id, 1); + } +} + +void LibHybrisEglServerBufferIntegration::libhybris_egl_server_buffer_server_buffer_created(struct ::qt_libhybris_buffer *id + , struct ::qt_server_buffer *qid + , int32_t numFds + , wl_array *ints + , int32_t name + , int32_t width + , int32_t height + , int32_t stride + , int32_t format) +{ + LibHybrisServerBuffer *server_buffer = new LibHybrisServerBuffer(this, numFds, ints, name, width, height, stride, format); + server_buffer->QtWayland::qt_libhybris_buffer::init(id); + qt_server_buffer_set_user_data(qid, server_buffer); +} + +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/libhybris-egl-server/libhybriseglserverbufferintegration.h b/src/plugins/platforms/wayland/plugins/hardwareintegration/libhybris-egl-server/libhybriseglserverbufferintegration.h new file mode 100644 index 00000000000..7fd4a2abbf8 --- /dev/null +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/libhybris-egl-server/libhybriseglserverbufferintegration.h @@ -0,0 +1,133 @@ +// Copyright (C) 2016 Jolla Ltd, author: +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef LIBHYBRISEGLSERVERBUFFERINTEGRATION_H +#define LIBHYBRISEGLSERVERBUFFERINTEGRATION_H + +#include +#include "qwayland-libhybris-egl-server-buffer.h" +#include +#include +#include +#include + +#include +#include +#ifndef EGL_KHR_image +typedef void *EGLImageKHR; +typedef EGLImageKHR (EGLAPIENTRYP PFNEGLCREATEIMAGEKHRPROC) (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYIMAGEKHRPROC) (EGLDisplay dpy, EGLImageKHR image); +#endif + +#ifndef GL_OES_EGL_image +typedef void (GL_APIENTRYP PFNGLEGLIMAGETARGETTEXTURE2DOESPROC) (GLenum target, GLeglImageOES image); +#endif + +#ifndef EGL_HYBRIS_native_buffer +typedef EGLBoolean (EGLAPIENTRYP PFNEGLHYBRISCREATEREMOTEBUFFERPROC)(EGLint width, EGLint height, EGLint usage, EGLint format, EGLint stride, + int num_ints, int *ints, int num_fds, int *fds, EGLClientBuffer *buffer); +#endif + +QT_BEGIN_NAMESPACE + +namespace QtWaylandClient { + +class LibHybrisEglServerBufferIntegration; + +class LibHybrisServerBuffer : public QWaylandServerBuffer, public QtWayland::qt_libhybris_buffer +{ +public: + LibHybrisServerBuffer(LibHybrisEglServerBufferIntegration *integration, int32_t numFds, wl_array *ints, int32_t name, int32_t width, int32_t height, int32_t stride, int32_t format); + ~LibHybrisServerBuffer(); + QOpenGLTexture* toOpenGlTexture() override; + +protected: + void libhybris_buffer_add_fd(int32_t fd) override; + +private: + LibHybrisEglServerBufferIntegration *m_integration = nullptr; + EGLImageKHR m_image; + QOpenGLTexture *m_texture = nullptr; + int m_numFds; + QList m_ints; + QList m_fds; + int32_t m_stride; + int32_t m_hybrisFormat; +}; + +class LibHybrisEglServerBufferIntegration + : public QWaylandServerBufferIntegration + , public QtWayland::qt_libhybris_egl_server_buffer +{ +public: + void initialize(QWaylandDisplay *display) override; + + virtual QWaylandServerBuffer *serverBuffer(struct qt_server_buffer *buffer) override; + + inline EGLImageKHR eglCreateImageKHR(EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list); + inline EGLBoolean eglDestroyImageKHR (EGLImageKHR image); + inline void glEGLImageTargetTexture2DOES (GLenum target, GLeglImageOES image); + inline EGLBoolean eglHybrisCreateRemoteBuffer(EGLint width, EGLint height, EGLint usage, EGLint format, EGLint stride, int num_ints, int *ints, int num_fds, int *fds, EGLClientBuffer *buffer); + +protected: + void libhybris_egl_server_buffer_server_buffer_created(struct ::qt_libhybris_buffer *id, struct ::qt_server_buffer *qid, + int32_t numFds, wl_array *ints, int32_t name, int32_t width, int32_t height, int32_t stride, int32_t format) override; +private: + static void wlDisplayHandleGlobal(void *data, struct ::wl_registry *registry, uint32_t id, + const QString &interface, uint32_t version); + void initializeEgl(); + + PFNEGLCREATEIMAGEKHRPROC m_egl_create_image; + PFNEGLDESTROYIMAGEKHRPROC m_egl_destroy_image; + PFNGLEGLIMAGETARGETTEXTURE2DOESPROC m_gl_egl_image_target_texture; + PFNEGLHYBRISCREATEREMOTEBUFFERPROC m_egl_create_buffer; + QWaylandDisplay *m_display = nullptr; + EGLDisplay m_egl_display = EGL_NO_DISPLAY; + bool m_egl_initialized = false; +}; + +EGLImageKHR LibHybrisEglServerBufferIntegration::eglCreateImageKHR(EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list) +{ + if (!m_egl_initialized) + initializeEgl(); + + if (!m_egl_create_image) { + qWarning("LibHybrisEglServerBufferIntegration: Trying to used unresolved function eglCreateImageKHR"); + return EGL_NO_IMAGE_KHR; + } + return m_egl_create_image(m_egl_display, ctx, target, buffer,attrib_list); +} + +EGLBoolean LibHybrisEglServerBufferIntegration::eglDestroyImageKHR (EGLImageKHR image) +{ + if (!m_egl_destroy_image) { + qWarning("LibHybrisEglServerBufferIntegration: Trying to use unresolved function eglDestroyImageKHR"); + return false; + } + return m_egl_destroy_image(m_egl_display, image); +} + +void LibHybrisEglServerBufferIntegration::glEGLImageTargetTexture2DOES (GLenum target, GLeglImageOES image) +{ + if (!m_gl_egl_image_target_texture) { + qWarning("LibHybrisEglServerBufferIntegration: Trying to use unresolved function glEGLImageTargetRenderbufferStorageOES"); + return; + } + m_gl_egl_image_target_texture(target,image); +} + +EGLBoolean LibHybrisEglServerBufferIntegration::eglHybrisCreateRemoteBuffer(EGLint width, EGLint height, EGLint usage, EGLint format, EGLint stride, + int num_ints, int *ints, int num_fds, int *fds, EGLClientBuffer *buffer) +{ + if (!m_egl_create_buffer) { + qWarning("LibHybrisEglServerBufferIntegration: Trying to use unresolved function eglHybrisCreateRemoteBuffer"); + return false; + } + return m_egl_create_buffer(width, height, usage, format, stride, num_ints, ints, num_fds, fds, buffer); +} + +} + +QT_END_NAMESPACE + +#endif diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/shm-emulation-server/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/hardwareintegration/shm-emulation-server/CMakeLists.txt index b979086d2c7..8f20ada4cb4 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/shm-emulation-server/CMakeLists.txt +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/shm-emulation-server/CMakeLists.txt @@ -11,10 +11,8 @@ qt_internal_add_plugin(ShmServerBufferPlugin OUTPUT_NAME shm-emulation-server PLUGIN_TYPE wayland-graphics-integration-client SOURCES - ../../../../hardwareintegration/client/shm-emulation-server/shmserverbufferintegration.cpp ../../../../hardwareintegration/client/shm-emulation-server/shmserverbufferintegration.h + shmserverbufferintegration.cpp shmserverbufferintegration.h main.cpp - INCLUDE_DIRECTORIES - ../../../../hardwareintegration/client/shm-emulation-server LIBRARIES Qt::Core Qt::Gui diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/shm-emulation-server/shmserverbufferintegration.cpp b/src/plugins/platforms/wayland/plugins/hardwareintegration/shm-emulation-server/shmserverbufferintegration.cpp new file mode 100644 index 00000000000..38065dbde16 --- /dev/null +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/shm-emulation-server/shmserverbufferintegration.cpp @@ -0,0 +1,107 @@ +// Copyright (C) 2017 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#include "shmserverbufferintegration.h" +#include +#include +#include +#include +#include +#include + +QT_BEGIN_NAMESPACE + +static QOpenGLTexture *createTextureFromShm(const QString &key, int w, int h, int bpl, int format) +{ + QT_IGNORE_DEPRECATIONS(QSharedMemory shm(key);) + bool ok; + ok = shm.attach(QSharedMemory::ReadOnly); + if (!ok) { + qWarning() << "Could not attach to" << key; + return nullptr; + } + ok = shm.lock(); + if (!ok) { + qWarning() << "Could not lock" << key << "for reading"; + return nullptr; + } + + QImage::Format imageFormat; + switch (format) { + case QtWayland::qt_shm_emulation_server_buffer::format_RGBA32: + imageFormat = QImage::Format_RGBA8888; + break; + case QtWayland::qt_shm_emulation_server_buffer::format_A8: + imageFormat = QImage::Format_Alpha8; + break; + default: + qWarning() << "ShmServerBuffer: unknown format" << format; + imageFormat = QImage::Format_RGBA8888; + break; + } + + QImage image(static_cast(shm.constData()), w, h, bpl, imageFormat); + + if (!QOpenGLContext::currentContext()) + qWarning("ShmServerBuffer: creating texture with no current context"); + + auto *tex = new QOpenGLTexture(image, QOpenGLTexture::DontGenerateMipMaps); + shm.unlock(); + return tex; +} + + +namespace QtWaylandClient { + +ShmServerBuffer::ShmServerBuffer(const QString &key, const QSize& size, int bytesPerLine, QWaylandServerBuffer::Format format) + : m_key(key) + , m_bpl(bytesPerLine) +{ + m_format = format; + m_size = size; +} + +ShmServerBuffer::~ShmServerBuffer() +{ +} + +QOpenGLTexture *ShmServerBuffer::toOpenGlTexture() +{ + if (!m_texture) + m_texture = createTextureFromShm(m_key, m_size.width(), m_size.height(), m_bpl, m_format); + + return m_texture; +} + +void ShmServerBufferIntegration::initialize(QWaylandDisplay *display) +{ + m_display = display; + display->addRegistryListener(&wlDisplayHandleGlobal, this); +} + +QWaylandServerBuffer *ShmServerBufferIntegration::serverBuffer(struct qt_server_buffer *buffer) +{ + return static_cast(qt_server_buffer_get_user_data(buffer)); +} + +void ShmServerBufferIntegration::wlDisplayHandleGlobal(void *data, ::wl_registry *registry, uint32_t id, const QString &interface, uint32_t version) +{ + Q_UNUSED(version); + if (interface == "qt_shm_emulation_server_buffer") { + auto *integration = static_cast(data); + integration->QtWayland::qt_shm_emulation_server_buffer::init(registry, id, 1); + } +} + + +void QtWaylandClient::ShmServerBufferIntegration::shm_emulation_server_buffer_server_buffer_created(qt_server_buffer *id, const QString &key, int32_t width, int32_t height, int32_t bytes_per_line, int32_t format) +{ + QSize size(width, height); + auto fmt = QWaylandServerBuffer::Format(format); + auto *server_buffer = new ShmServerBuffer(key, size, bytes_per_line, fmt); + qt_server_buffer_set_user_data(id, server_buffer); +} + +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/shm-emulation-server/shmserverbufferintegration.h b/src/plugins/platforms/wayland/plugins/hardwareintegration/shm-emulation-server/shmserverbufferintegration.h new file mode 100644 index 00000000000..344046ae182 --- /dev/null +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/shm-emulation-server/shmserverbufferintegration.h @@ -0,0 +1,55 @@ +// Copyright (C) 2017 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef SHMSERVERBUFFERINTEGRATION_H +#define SHMSERVERBUFFERINTEGRATION_H + +#include +#include "qwayland-shm-emulation-server-buffer.h" +#include + +#include "shmserverbufferintegration.h" +#include +#include + +QT_BEGIN_NAMESPACE + +namespace QtWaylandClient { + +class ShmServerBufferIntegration; + +class ShmServerBuffer : public QWaylandServerBuffer +{ +public: + ShmServerBuffer(const QString &key, const QSize &size, int bytesPerLine, QWaylandServerBuffer::Format format); + ~ShmServerBuffer() override; + QOpenGLTexture* toOpenGlTexture() override; +private: + QOpenGLTexture *m_texture = nullptr; + QString m_key; + int m_bpl; +}; + +class ShmServerBufferIntegration + : public QWaylandServerBufferIntegration + , public QtWayland::qt_shm_emulation_server_buffer +{ +public: + void initialize(QWaylandDisplay *display) override; + + QWaylandServerBuffer *serverBuffer(struct qt_server_buffer *buffer) override; + +protected: + void shm_emulation_server_buffer_server_buffer_created(qt_server_buffer *id, const QString &key, int32_t width, int32_t height, int32_t bytes_per_line, int32_t format) override; + +private: + static void wlDisplayHandleGlobal(void *data, struct ::wl_registry *registry, uint32_t id, + const QString &interface, uint32_t version); + QWaylandDisplay *m_display = nullptr; +}; + +} + +QT_END_NAMESPACE + +#endif diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/vulkan-server/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/hardwareintegration/vulkan-server/CMakeLists.txt index f0aeabf291a..34ce655330b 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/vulkan-server/CMakeLists.txt +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/vulkan-server/CMakeLists.txt @@ -11,10 +11,8 @@ qt_internal_add_plugin(VulkanServerBufferPlugin OUTPUT_NAME vulkan-server PLUGIN_TYPE wayland-graphics-integration-client SOURCES - ../../../../hardwareintegration/client/vulkan-server/vulkanserverbufferintegration.cpp ../../../../hardwareintegration/client/vulkan-server/vulkanserverbufferintegration.h + vulkanserverbufferintegration.cpp vulkanserverbufferintegration.h main.cpp - INCLUDE_DIRECTORIES - ../../../../hardwareintegration/client/vulkan-server LIBRARIES Qt::Core Qt::Gui diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/vulkan-server/vulkanserverbufferintegration.cpp b/src/plugins/platforms/wayland/plugins/hardwareintegration/vulkan-server/vulkanserverbufferintegration.cpp new file mode 100644 index 00000000000..8f1ff9a46d3 --- /dev/null +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/vulkan-server/vulkanserverbufferintegration.cpp @@ -0,0 +1,177 @@ +// Copyright (C) 2019 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#include "vulkanserverbufferintegration.h" +#include +#include +#include +#include +#include +#include +#include + +QT_BEGIN_NAMESPACE + +namespace QtWaylandClient { + +static constexpr bool sbiExtraDebug = +#ifdef VULKAN_SERVER_BUFFER_EXTRA_DEBUG + true; +#else + false; +#endif + +#define DECL_GL_FUNCTION(name, type) \ + type name + +#define FIND_GL_FUNCTION(name, type) \ + do { \ + name = reinterpret_cast(glContext->getProcAddress(#name)); \ + if (!name) { \ + qWarning() << "ERROR in GL proc lookup. Could not find " #name; \ + return false; \ + } \ + } while (0) + +struct VulkanServerBufferGlFunctions +{ + DECL_GL_FUNCTION(glCreateMemoryObjectsEXT, PFNGLCREATEMEMORYOBJECTSEXTPROC); + DECL_GL_FUNCTION(glImportMemoryFdEXT, PFNGLIMPORTMEMORYFDEXTPROC); + DECL_GL_FUNCTION(glTextureStorageMem2DEXT, PFNGLTEXTURESTORAGEMEM2DEXTPROC); + DECL_GL_FUNCTION(glTexStorageMem2DEXT, PFNGLTEXSTORAGEMEM2DEXTPROC); + DECL_GL_FUNCTION(glDeleteMemoryObjectsEXT, PFNGLDELETEMEMORYOBJECTSEXTPROC); + + bool init(QOpenGLContext *glContext) + { + FIND_GL_FUNCTION(glCreateMemoryObjectsEXT, PFNGLCREATEMEMORYOBJECTSEXTPROC); + FIND_GL_FUNCTION(glImportMemoryFdEXT, PFNGLIMPORTMEMORYFDEXTPROC); + FIND_GL_FUNCTION(glTextureStorageMem2DEXT, PFNGLTEXTURESTORAGEMEM2DEXTPROC); + FIND_GL_FUNCTION(glTexStorageMem2DEXT, PFNGLTEXSTORAGEMEM2DEXTPROC); + FIND_GL_FUNCTION(glDeleteMemoryObjectsEXT, PFNGLDELETEMEMORYOBJECTSEXTPROC); + + return true; + } + static bool create(QOpenGLContext *glContext); +}; + +static VulkanServerBufferGlFunctions *funcs = nullptr; + +bool VulkanServerBufferGlFunctions::create(QOpenGLContext *glContext) +{ + if (funcs) + return true; + funcs = new VulkanServerBufferGlFunctions; + if (!funcs->init(glContext)) { + delete funcs; + funcs = nullptr; + return false; + } + return true; +} + +VulkanServerBuffer::VulkanServerBuffer(VulkanServerBufferIntegration *integration, struct ::qt_server_buffer *id, + int32_t fd, uint32_t width, uint32_t height, uint32_t memory_size, uint32_t format) + : m_integration(integration) + , m_server_buffer(id) + , m_fd(fd) + , m_memorySize(memory_size) + , m_internalFormat(format) +{ + m_size = QSize(width, height); +} + +VulkanServerBuffer::~VulkanServerBuffer() +{ + if (QCoreApplication::closingDown()) + return; // can't trust anything at this point + + if (m_texture) { //only do gl cleanup if import has been called + m_integration->deleteGLTextureWhenPossible(m_texture); + + if (sbiExtraDebug) qDebug() << "glDeleteMemoryObjectsEXT" << m_memoryObject; + funcs->glDeleteMemoryObjectsEXT(1, &m_memoryObject); + } + qt_server_buffer_release(m_server_buffer); + qt_server_buffer_destroy(m_server_buffer); +} + +void VulkanServerBuffer::import() +{ + if (m_texture) + return; + + if (sbiExtraDebug) qDebug() << "importing" << m_fd << Qt::hex << glGetError(); + + auto *glContext = QOpenGLContext::currentContext(); + if (!glContext) + return; + + if (!funcs && !VulkanServerBufferGlFunctions::create(glContext)) + return; + + funcs->glCreateMemoryObjectsEXT(1, &m_memoryObject); + if (sbiExtraDebug) qDebug() << "glCreateMemoryObjectsEXT" << Qt::hex << glGetError(); + funcs->glImportMemoryFdEXT(m_memoryObject, m_memorySize, GL_HANDLE_TYPE_OPAQUE_FD_EXT, m_fd); + if (sbiExtraDebug) qDebug() << "glImportMemoryFdEXT" << Qt::hex << glGetError(); + + + m_texture = new QOpenGLTexture(QOpenGLTexture::Target2D); + m_texture->create(); + + if (sbiExtraDebug) qDebug() << "created texture" << m_texture->textureId() << Qt::hex << glGetError(); + + m_texture->bind(); + if (sbiExtraDebug) qDebug() << "bound texture" << Qt::hex << glGetError(); + funcs->glTexStorageMem2DEXT(GL_TEXTURE_2D, 1, m_internalFormat, m_size.width(), m_size.height(), m_memoryObject, 0 ); + if (sbiExtraDebug) qDebug() << "glTexStorageMem2DEXT" << Qt::hex << glGetError(); + if (sbiExtraDebug) qDebug() << "format" << Qt::hex << m_internalFormat << GL_RGBA8; +} + +QOpenGLTexture *VulkanServerBuffer::toOpenGlTexture() +{ + m_integration->deleteOrphanedTextures(); + if (!m_texture) + import(); + return m_texture; +} + +void VulkanServerBufferIntegration::initialize(QWaylandDisplay *display) +{ + m_display = display; + display->addRegistryListener(&wlDisplayHandleGlobal, this); +} + +QWaylandServerBuffer *VulkanServerBufferIntegration::serverBuffer(struct qt_server_buffer *buffer) +{ + return static_cast(qt_server_buffer_get_user_data(buffer)); +} + +void VulkanServerBufferIntegration::wlDisplayHandleGlobal(void *data, ::wl_registry *registry, uint32_t id, const QString &interface, uint32_t version) +{ + Q_UNUSED(version); + if (interface == "zqt_vulkan_server_buffer_v1") { + auto *integration = static_cast(data); + integration->QtWayland::zqt_vulkan_server_buffer_v1::init(registry, id, 1); + } +} + +void VulkanServerBufferIntegration::zqt_vulkan_server_buffer_v1_server_buffer_created(qt_server_buffer *id, int32_t fd, uint32_t width, uint32_t height, uint32_t memory_size, uint32_t format) +{ + if (sbiExtraDebug) qDebug() << "vulkan_server_buffer_server_buffer_created" << fd; + auto *server_buffer = new VulkanServerBuffer(this, id, fd, width, height, memory_size, format); + qt_server_buffer_set_user_data(id, server_buffer); +} + +void VulkanServerBufferIntegration::deleteOrphanedTextures() +{ + if (!QOpenGLContext::currentContext()) { + qWarning("VulkanServerBufferIntegration::deleteOrphanedTextures with no current context!"); + return; + } + qDeleteAll(orphanedTextures); + orphanedTextures.clear(); +} + +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/vulkan-server/vulkanserverbufferintegration.h b/src/plugins/platforms/wayland/plugins/hardwareintegration/vulkan-server/vulkanserverbufferintegration.h new file mode 100644 index 00000000000..2f0867a8197 --- /dev/null +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/vulkan-server/vulkanserverbufferintegration.h @@ -0,0 +1,66 @@ +// Copyright (C) 2019 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef VULKANSERVERBUFFERINTEGRATION_H +#define VULKANSERVERBUFFERINTEGRATION_H + +#include +#include "qwayland-qt-vulkan-server-buffer-unstable-v1.h" +#include + +#include "vulkanserverbufferintegration.h" +#include +#include + +QT_BEGIN_NAMESPACE + +namespace QtWaylandClient { + +class VulkanServerBufferIntegration; + +class VulkanServerBuffer : public QWaylandServerBuffer +{ +public: + VulkanServerBuffer(VulkanServerBufferIntegration *integration, struct ::qt_server_buffer *id, int32_t fd, uint32_t width, uint32_t height, uint32_t memory_size, uint32_t format); + ~VulkanServerBuffer() override; + QOpenGLTexture* toOpenGlTexture() override; + +private: + void import(); + + VulkanServerBufferIntegration *m_integration = nullptr; + struct ::qt_server_buffer *m_server_buffer = nullptr; + QOpenGLTexture *m_texture = nullptr; + int m_fd = -1; + uint m_memorySize = 0; + uint m_internalFormat = 0; + GLuint m_memoryObject = 0; +}; + +class VulkanServerBufferIntegration + : public QWaylandServerBufferIntegration + , public QtWayland::zqt_vulkan_server_buffer_v1 +{ +public: + void initialize(QWaylandDisplay *display) override; + + QWaylandServerBuffer *serverBuffer(struct qt_server_buffer *buffer) override; + + void deleteGLTextureWhenPossible(QOpenGLTexture *texture) { orphanedTextures << texture; } + void deleteOrphanedTextures(); + +protected: + void zqt_vulkan_server_buffer_v1_server_buffer_created(qt_server_buffer *id, int32_t fd, uint32_t width, uint32_t height, uint32_t memory_size, uint32_t format) override; + +private: + static void wlDisplayHandleGlobal(void *data, struct ::wl_registry *registry, uint32_t id, + const QString &interface, uint32_t version); + QWaylandDisplay *m_display = nullptr; + QList orphanedTextures; +}; + +} + +QT_END_NAMESPACE + +#endif diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/CMakeLists.txt index e75ce07e530..ef3df07a434 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/CMakeLists.txt +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/CMakeLists.txt @@ -13,11 +13,19 @@ qt_internal_add_plugin(QWaylandEglClientBufferPlugin PLUGIN_TYPE wayland-graphics-integration-client SOURCES main.cpp + qwaylandeglclientbufferintegration.cpp qwaylandeglclientbufferintegration_p.h + qwaylandeglinclude_p.h + qwaylandeglwindow.cpp qwaylandeglwindow_p.h + qwaylandglcontext.cpp qwaylandglcontext_p.h LIBRARIES + ${CMAKE_DL_LIBS} + EGL::EGL Qt::Core Qt::Gui + Qt::OpenGLPrivate Qt::WaylandClientPrivate - Qt::WaylandEglClientHwIntegrationPrivate + Wayland::Client + Wayland::Egl QT_LICENSE_ID QT_COMMERCIAL_OR_LGPL3 ) diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/main.cpp b/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/main.cpp index 9d4fd95edd3..4cb5930bc3b 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/main.cpp +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/main.cpp @@ -2,7 +2,7 @@ // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include -#include +#include "qwaylandeglclientbufferintegration_p.h" QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/qwaylandeglclientbufferintegration.cpp b/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/qwaylandeglclientbufferintegration.cpp new file mode 100644 index 00000000000..3b97aef208b --- /dev/null +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/qwaylandeglclientbufferintegration.cpp @@ -0,0 +1,166 @@ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#include "qwaylandeglclientbufferintegration_p.h" + +#include "qwaylandeglwindow_p.h" +#include "qwaylandglcontext_p.h" + +#include + +#include +#include + +#ifndef EGL_EXT_platform_base +typedef EGLDisplay (*PFNEGLGETPLATFORMDISPLAYEXTPROC) (EGLenum platform, void *native_display, const EGLint *attrib_list); +#endif + +#ifndef EGL_PLATFORM_WAYLAND_KHR +#define EGL_PLATFORM_WAYLAND_KHR 0x31D8 +#endif + +QT_BEGIN_NAMESPACE + +namespace QtWaylandClient { + +static const char *qwaylandegl_threadedgl_blacklist_vendor[] = { + 0 +}; + +QWaylandEglClientBufferIntegration::QWaylandEglClientBufferIntegration() +{ + qCDebug(lcQpaWayland) << "Using Wayland-EGL"; +} + + +QWaylandEglClientBufferIntegration::~QWaylandEglClientBufferIntegration() +{ + eglTerminate(m_eglDisplay); +} + +void QWaylandEglClientBufferIntegration::initialize(QWaylandDisplay *display) +{ +#if QT_CONFIG(egl_extension_platform_wayland) + m_eglDisplay = eglGetPlatformDisplay(EGL_PLATFORM_WAYLAND_EXT, display->wl_display(), nullptr); +#else + if (q_hasEglExtension(EGL_NO_DISPLAY, "EGL_EXT_platform_base")) { + if (q_hasEglExtension(EGL_NO_DISPLAY, "EGL_KHR_platform_wayland") || + q_hasEglExtension(EGL_NO_DISPLAY, "EGL_EXT_platform_wayland") || + q_hasEglExtension(EGL_NO_DISPLAY, "EGL_MESA_platform_wayland")) { + + static PFNEGLGETPLATFORMDISPLAYEXTPROC eglGetPlatformDisplay = nullptr; + if (!eglGetPlatformDisplay) + eglGetPlatformDisplay = (PFNEGLGETPLATFORMDISPLAYEXTPROC)eglGetProcAddress("eglGetPlatformDisplayEXT"); + + m_eglDisplay = eglGetPlatformDisplay(EGL_PLATFORM_WAYLAND_KHR, display->wl_display(), nullptr); + } else { + qCWarning(lcQpaWayland) << "The EGL implementation does not support the Wayland platform"; + return; + } + } else { + QByteArray eglPlatform = qgetenv("EGL_PLATFORM"); + if (eglPlatform.isEmpty()) { + setenv("EGL_PLATFORM","wayland",true); + } + + m_eglDisplay = eglGetDisplay((EGLNativeDisplayType) display->wl_display()); + } +#endif + + m_display = display; + + if (m_eglDisplay == EGL_NO_DISPLAY) { + qCWarning(lcQpaWayland) << "EGL not available"; + return; + } + + EGLint major,minor; + if (!eglInitialize(m_eglDisplay, &major, &minor)) { + qCWarning(lcQpaWayland) << "Failed to initialize EGL display" << Qt::hex << eglGetError(); + m_eglDisplay = EGL_NO_DISPLAY; + return; + } + + m_supportsThreading = true; + if (qEnvironmentVariableIsSet("QT_OPENGL_NO_SANITY_CHECK")) + return; + + const char *vendor = eglQueryString(m_eglDisplay, EGL_VENDOR); + for (int i = 0; qwaylandegl_threadedgl_blacklist_vendor[i]; ++i) { + if (strstr(vendor, qwaylandegl_threadedgl_blacklist_vendor[i]) != 0) { + m_supportsThreading = false; + break; + } + } + + // On desktop NVIDIA resizing QtQuick freezes them when using threaded rendering QTBUG-95817 + // In order to support threaded rendering on embedded platforms where resizing is not needed + // we check if XDG_CURRENT_DESKTOP is set which desktop environments should set + if (qstrcmp(vendor, "NVIDIA") == 0 && qEnvironmentVariableIsSet("XDG_CURRENT_DESKTOP")) { + m_supportsThreading = false; + } +} + +bool QWaylandEglClientBufferIntegration::isValid() const +{ + return m_eglDisplay != EGL_NO_DISPLAY; +} + +bool QWaylandEglClientBufferIntegration::supportsThreadedOpenGL() const +{ + return m_supportsThreading; +} + +bool QWaylandEglClientBufferIntegration::supportsWindowDecoration() const +{ + return true; +} + +QWaylandWindow *QWaylandEglClientBufferIntegration::createEglWindow(QWindow *window) +{ + return new QWaylandEglWindow(window, m_display); +} + +QPlatformOpenGLContext *QWaylandEglClientBufferIntegration::createPlatformOpenGLContext(const QSurfaceFormat &glFormat, QPlatformOpenGLContext *share) const +{ + QSurfaceFormat fmt = glFormat; + if (m_display->supportsWindowDecoration()) + fmt.setAlphaBufferSize(8); + return new QWaylandGLContext(m_eglDisplay, m_display, fmt, share); +} + +void *QWaylandEglClientBufferIntegration::nativeResource(NativeResource resource) +{ + switch (resource) { + case EglDisplay: + return m_eglDisplay; + default: + break; + } + return nullptr; +} + +void *QWaylandEglClientBufferIntegration::nativeResourceForContext(NativeResource resource, QPlatformOpenGLContext *context) +{ + Q_ASSERT(context); + switch (resource) { + case EglConfig: + return static_cast(context)->eglConfig(); + case EglContext: + return static_cast(context)->eglContext(); + case EglDisplay: + return m_eglDisplay; + default: + break; + } + return nullptr; +} + +EGLDisplay QWaylandEglClientBufferIntegration::eglDisplay() const +{ + return m_eglDisplay; +} + +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/qwaylandeglclientbufferintegration_p.h b/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/qwaylandeglclientbufferintegration_p.h new file mode 100644 index 00000000000..ed8fdec2d94 --- /dev/null +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/qwaylandeglclientbufferintegration_p.h @@ -0,0 +1,60 @@ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#ifndef QWAYLANDEGLINTEGRATION_H +#define QWAYLANDEGLINTEGRATION_H + +#include + +#include "qwaylandeglinclude_p.h" + +QT_BEGIN_NAMESPACE + +class QWindow; + +namespace QtWaylandClient { + +class QWaylandWindow; + +class Q_WAYLANDCLIENT_EXPORT QWaylandEglClientBufferIntegration : public QWaylandClientBufferIntegration +{ +public: + QWaylandEglClientBufferIntegration(); + ~QWaylandEglClientBufferIntegration() override; + + void initialize(QWaylandDisplay *display) override; + bool isValid() const override; + bool supportsThreadedOpenGL() const override; + bool supportsWindowDecoration() const override; + + QWaylandWindow *createEglWindow(QWindow *window) override; + QPlatformOpenGLContext *createPlatformOpenGLContext(const QSurfaceFormat &glFormat, QPlatformOpenGLContext *share) const override; + + void *nativeResource(NativeResource resource) override; + void *nativeResourceForContext(NativeResource resource, QPlatformOpenGLContext *context) override; + + EGLDisplay eglDisplay() const; + +private: + QWaylandDisplay *m_display = nullptr; + + EGLDisplay m_eglDisplay = EGL_NO_DISPLAY; + bool m_supportsThreading = false; +}; + +QT_END_NAMESPACE + +} + +#endif // QWAYLANDEGLINTEGRATION_H diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/qwaylandeglinclude_p.h b/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/qwaylandeglinclude_p.h new file mode 100644 index 00000000000..eb52ce8eecd --- /dev/null +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/qwaylandeglinclude_p.h @@ -0,0 +1,27 @@ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#ifndef QWAYLANDEGLINCLUDE_H +#define QWAYLANDEGLINCLUDE_H + +#include +#include + +#include + +#define EGL_EGLEXT_PROTOTYPES +#include + +#endif // QWAYLANDEGLINCLUDE_H diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/qwaylandeglwindow.cpp b/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/qwaylandeglwindow.cpp new file mode 100644 index 00000000000..8375d0e196d --- /dev/null +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/qwaylandeglwindow.cpp @@ -0,0 +1,201 @@ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#include "qwaylandeglwindow_p.h" + +#include +#include +#include "qwaylandglcontext_p.h" + +#include + +#include +#include +#include +#include +#include + +QT_BEGIN_NAMESPACE + +namespace QtWaylandClient { + +QWaylandEglWindow::QWaylandEglWindow(QWindow *window, QWaylandDisplay *display) + : QWaylandWindow(window, display) + , m_clientBufferIntegration(static_cast(mDisplay->clientBufferIntegration())) +{ + connect(display, &QWaylandDisplay::connected, this, [this] { + m_clientBufferIntegration = static_cast( + mDisplay->clientBufferIntegration()); + }); + ensureSize(); +} + +QWaylandEglWindow::~QWaylandEglWindow() +{ + if (m_eglSurface) { + eglDestroySurface(m_clientBufferIntegration->eglDisplay(), m_eglSurface); + m_eglSurface = 0; + } + + if (m_waylandEglWindow) + wl_egl_window_destroy(m_waylandEglWindow); + + delete m_contentFBO; +} + +QWaylandWindow::WindowType QWaylandEglWindow::windowType() const +{ + return QWaylandWindow::Egl; +} + +void QWaylandEglWindow::ensureSize() +{ + // this is always called on the main thread + QRect rect = geometry(); + QMargins margins = clientSideMargins(); + QSize sizeWithMargins = (rect.size() + QSize(margins.left() + margins.right(), margins.top() + margins.bottom())) * scale(); + { + QWriteLocker lock(&m_bufferSizeLock); + m_bufferSize = sizeWithMargins; + } + + QMutexLocker lock (&m_eglSurfaceLock); + updateSurface(false); +} + +void QWaylandEglWindow::updateSurface(bool create) +{ + // eglSurfaceLock should be locked before calling this method + + QSize sizeWithMargins; + { + QReadLocker lock(&m_bufferSizeLock); + sizeWithMargins = m_bufferSize; + } + + // wl_egl_windows must have both width and height > 0 + // mesa's egl returns NULL if we try to create a, invalid wl_egl_window, however not all EGL + // implementations may do that, so check the size ourself. Besides, we must deal with resizing + // a valid window to 0x0, which would make it invalid. Hence, destroy it. + if (sizeWithMargins.isEmpty()) { + if (m_eglSurface) { + eglDestroySurface(m_clientBufferIntegration->eglDisplay(), m_eglSurface); + m_eglSurface = 0; + } + if (m_waylandEglWindow) { + wl_egl_window_destroy(m_waylandEglWindow); + m_waylandEglWindow = 0; + } + mOffset = QPoint(); + } else { + QReadLocker locker(&mSurfaceLock); + if (m_waylandEglWindow) { + int current_width = 0; + int current_height = 0; + static bool disableResizeCheck = qgetenv("QT_WAYLAND_DISABLE_RESIZECHECK").toInt(); + + if (!disableResizeCheck) { + wl_egl_window_get_attached_size(m_waylandEglWindow, ¤t_width, ¤t_height); + } + if (disableResizeCheck || (current_width != sizeWithMargins.width() || current_height != sizeWithMargins.height()) || m_requestedSize != sizeWithMargins) { + wl_egl_window_resize(m_waylandEglWindow, sizeWithMargins.width(), sizeWithMargins.height(), mOffset.x(), mOffset.y()); + m_requestedSize = sizeWithMargins; + mOffset = QPoint(); + + m_resize = true; + } + } else if (create && mSurface) { + wl_egl_window *eglWindow = wl_egl_window_create(mSurface->object(), sizeWithMargins.width(), sizeWithMargins.height()); + if (Q_UNLIKELY(!eglWindow)) { + qCWarning(lcQpaWayland, "Could not create wl_egl_window with size %dx%d\n", sizeWithMargins.width(), sizeWithMargins.height()); + return; + } + + QSurfaceFormat fmt = window()->requestedFormat(); + if (mDisplay->supportsWindowDecoration()) + fmt.setAlphaBufferSize(8); + EGLConfig eglConfig = q_configFromGLFormat(m_clientBufferIntegration->eglDisplay(), fmt); + setFormat(q_glFormatFromConfig(m_clientBufferIntegration->eglDisplay(), eglConfig, fmt)); + + EGLSurface eglSurface = eglCreateWindowSurface(m_clientBufferIntegration->eglDisplay(), eglConfig, (EGLNativeWindowType) eglWindow, 0); + if (Q_UNLIKELY(eglSurface == EGL_NO_SURFACE)) { + qCWarning(lcQpaWayland, "Could not create EGL surface (EGL error 0x%x)\n", eglGetError()); + wl_egl_window_destroy(eglWindow); + return; + } + + m_waylandEglWindow = eglWindow; + m_eglSurface = eglSurface; + m_requestedSize = sizeWithMargins; + } + } +} + +QRect QWaylandEglWindow::contentsRect() const +{ + QRect r = geometry(); + QMargins m = clientSideMargins(); + return QRect(m.left(), m.bottom(), r.width(), r.height()); +} + +void QWaylandEglWindow::invalidateSurface() +{ + QMutexLocker lock (&m_eglSurfaceLock); + + if (m_eglSurface) { + eglDestroySurface(m_clientBufferIntegration->eglDisplay(), m_eglSurface); + m_eglSurface = 0; + } + if (m_waylandEglWindow) { + wl_egl_window_destroy(m_waylandEglWindow); + m_waylandEglWindow = nullptr; + } + delete m_contentFBO; + m_contentFBO = nullptr; +} + +EGLSurface QWaylandEglWindow::eglSurface() const +{ + return m_eglSurface; +} + +QMutex* QWaylandEglWindow::eglSurfaceLock() +{ + return &m_eglSurfaceLock; +} + +GLuint QWaylandEglWindow::contentFBO() const +{ + if (!decoration()) + return 0; + + if (m_resize || !m_contentFBO) { + QOpenGLFramebufferObject *old = m_contentFBO; + QSize fboSize = geometry().size() * scale(); + m_contentFBO = new QOpenGLFramebufferObject(fboSize.width(), fboSize.height(), QOpenGLFramebufferObject::CombinedDepthStencil); + + delete old; + m_resize = false; + } + + return m_contentFBO->handle(); +} + +GLuint QWaylandEglWindow::contentTexture() const +{ + return m_contentFBO->texture(); +} + +void QWaylandEglWindow::bindContentFBO() +{ + if (decoration()) { + contentFBO(); + m_contentFBO->bind(); + } +} + +} + +QT_END_NAMESPACE + +#include "moc_qwaylandeglwindow_p.cpp" diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/qwaylandeglwindow_p.h b/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/qwaylandeglwindow_p.h new file mode 100644 index 00000000000..dc2e0319519 --- /dev/null +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/qwaylandeglwindow_p.h @@ -0,0 +1,76 @@ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#ifndef QWAYLANDEGLWINDOW_H +#define QWAYLANDEGLWINDOW_H + +#include +#include "qwaylandeglinclude_p.h" +#include "qwaylandeglclientbufferintegration_p.h" + +QT_BEGIN_NAMESPACE + +class QOpenGLFramebufferObject; + +namespace QtWaylandClient { + +class QWaylandGLContext; + +class Q_WAYLANDCLIENT_EXPORT QWaylandEglWindow : public QWaylandWindow +{ + Q_OBJECT +public: + QWaylandEglWindow(QWindow *window, QWaylandDisplay *display); + ~QWaylandEglWindow(); + WindowType windowType() const override; + void ensureSize() override; + + void updateSurface(bool create); + QRect contentsRect() const; + + EGLSurface eglSurface() const; + GLuint contentFBO() const; + GLuint contentTexture() const; + bool needToUpdateContentFBO() const { return decoration() && (m_resize || !m_contentFBO); } + + void bindContentFBO(); + + void invalidateSurface() override; + + QMutex* eglSurfaceLock(); + +private: + QWaylandEglClientBufferIntegration *m_clientBufferIntegration = nullptr; + struct wl_egl_window *m_waylandEglWindow = nullptr; + + // Locks any manipulation of the eglSurface size + QMutex m_eglSurfaceLock; + EGLSurface m_eglSurface = EGL_NO_SURFACE; + mutable bool m_resize = false; + mutable QOpenGLFramebufferObject *m_contentFBO = nullptr; + + // Size used in the last call to wl_egl_window_resize + QSize m_requestedSize; + + // Size of the buffer used by QWaylandWindow + // This is always written to from the main thread, potentially read from the rendering thread + QReadWriteLock m_bufferSizeLock; + QSize m_bufferSize; +}; + +} + +QT_END_NAMESPACE + +#endif // QWAYLANDEGLWINDOW_H diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/qwaylandglcontext.cpp b/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/qwaylandglcontext.cpp new file mode 100644 index 00000000000..be5a36fa01a --- /dev/null +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/qwaylandglcontext.cpp @@ -0,0 +1,430 @@ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#include "qwaylandglcontext_p.h" + +#include +#include +#include +#include +#include +#include "qwaylandeglwindow_p.h" + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include + +#include + +// Constants from EGL_KHR_create_context +#ifndef EGL_CONTEXT_MINOR_VERSION_KHR +#define EGL_CONTEXT_MINOR_VERSION_KHR 0x30FB +#endif +#ifndef EGL_CONTEXT_FLAGS_KHR +#define EGL_CONTEXT_FLAGS_KHR 0x30FC +#endif +#ifndef EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR +#define EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR 0x30FD +#endif +#ifndef EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR +#define EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR 0x00000001 +#endif +#ifndef EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR +#define EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR 0x00000002 +#endif +#ifndef EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR +#define EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR 0x00000001 +#endif +#ifndef EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT_KHR +#define EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT_KHR 0x00000002 +#endif + +// Constants for OpenGL which are not available in the ES headers. +#ifndef GL_CONTEXT_FLAGS +#define GL_CONTEXT_FLAGS 0x821E +#endif +#ifndef GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT +#define GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT 0x0001 +#endif +#ifndef GL_CONTEXT_FLAG_DEBUG_BIT +#define GL_CONTEXT_FLAG_DEBUG_BIT 0x00000002 +#endif +#ifndef GL_CONTEXT_PROFILE_MASK +#define GL_CONTEXT_PROFILE_MASK 0x9126 +#endif +#ifndef GL_CONTEXT_CORE_PROFILE_BIT +#define GL_CONTEXT_CORE_PROFILE_BIT 0x00000001 +#endif +#ifndef GL_CONTEXT_COMPATIBILITY_PROFILE_BIT +#define GL_CONTEXT_COMPATIBILITY_PROFILE_BIT 0x00000002 +#endif + +QT_BEGIN_NAMESPACE + +namespace QtWaylandClient { + +class DecorationsBlitter : public QOpenGLFunctions +{ +public: + DecorationsBlitter(QWaylandGLContext *context) + : m_context(context) + { + initializeOpenGLFunctions(); + m_blitProgram = new QOpenGLShaderProgram(); + m_blitProgram->addShaderFromSourceCode(QOpenGLShader::Vertex, "attribute vec4 position;\n\ + attribute vec4 texCoords;\n\ + varying vec2 outTexCoords;\n\ + void main()\n\ + {\n\ + gl_Position = position;\n\ + outTexCoords = texCoords.xy;\n\ + }"); + m_blitProgram->addShaderFromSourceCode(QOpenGLShader::Fragment, "varying highp vec2 outTexCoords;\n\ + uniform sampler2D texture;\n\ + void main()\n\ + {\n\ + gl_FragColor = texture2D(texture, outTexCoords);\n\ + }"); + + m_blitProgram->bindAttributeLocation("position", 0); + m_blitProgram->bindAttributeLocation("texCoords", 1); + + if (!m_blitProgram->link()) { + qDebug() << "Shader Program link failed."; + qDebug() << m_blitProgram->log(); + } + + m_blitProgram->bind(); + m_blitProgram->enableAttributeArray(0); + m_blitProgram->enableAttributeArray(1); + + glDisable(GL_DEPTH_TEST); + glDisable(GL_BLEND); + glDisable(GL_CULL_FACE); + glDisable(GL_SCISSOR_TEST); + glDepthMask(GL_FALSE); + glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); + + m_buffer.create(); + m_buffer.bind(); + + static const GLfloat squareVertices[] = { + -1.f, -1.f, + 1.0f, -1.f, + -1.f, 1.0f, + 1.0f, 1.0f + }; + static const GLfloat inverseSquareVertices[] = { + -1.f, 1.f, + 1.f, 1.f, + -1.f, -1.f, + 1.f, -1.f + }; + static const GLfloat textureVertices[] = { + 0.0f, 0.0f, + 1.0f, 0.0f, + 0.0f, 1.0f, + 1.0f, 1.0f, + }; + + m_squareVerticesOffset = 0; + m_inverseSquareVerticesOffset = sizeof(squareVertices); + m_textureVerticesOffset = sizeof(squareVertices) + sizeof(textureVertices); + + m_buffer.allocate(sizeof(squareVertices) + sizeof(inverseSquareVertices) + sizeof(textureVertices)); + m_buffer.write(m_squareVerticesOffset, squareVertices, sizeof(squareVertices)); + m_buffer.write(m_inverseSquareVerticesOffset, inverseSquareVertices, sizeof(inverseSquareVertices)); + m_buffer.write(m_textureVerticesOffset, textureVertices, sizeof(textureVertices)); + + m_blitProgram->setAttributeBuffer(1, GL_FLOAT, m_textureVerticesOffset, 2); + + m_textureWrap = m_context->context()->functions()->hasOpenGLFeature(QOpenGLFunctions::NPOTTextureRepeat) ? GL_REPEAT : GL_CLAMP_TO_EDGE; + } + ~DecorationsBlitter() + { + delete m_blitProgram; + } + void blit(QWaylandEglWindow *window) + { + QOpenGLTextureCache *cache = QOpenGLTextureCache::cacheForContext(m_context->context()); + + QSize surfaceSize = window->surfaceSize(); + qreal scale = window->scale() ; + glViewport(0, 0, surfaceSize.width() * scale, surfaceSize.height() * scale); + + //Draw Decoration + if (auto *decoration = window->decoration()) { + m_blitProgram->setAttributeBuffer(0, GL_FLOAT, m_inverseSquareVerticesOffset, 2); + QImage decorationImage = decoration->contentImage(); + cache->bindTexture(m_context->context(), decorationImage); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, m_textureWrap); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, m_textureWrap); + glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); + } + + //Draw Content + m_blitProgram->setAttributeBuffer(0, GL_FLOAT, m_squareVerticesOffset, 2); + glBindTexture(GL_TEXTURE_2D, window->contentTexture()); + QRect r = window->contentsRect(); + glViewport(r.x() * scale, r.y() * scale, r.width() * scale, r.height() * scale); + glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); + } + + QOpenGLShaderProgram *m_blitProgram = nullptr; + QWaylandGLContext *m_context = nullptr; + QOpenGLBuffer m_buffer; + int m_squareVerticesOffset; + int m_inverseSquareVerticesOffset; + int m_textureVerticesOffset; + int m_textureWrap; +}; + +QWaylandGLContext::QWaylandGLContext(EGLDisplay eglDisplay, QWaylandDisplay *display, + const QSurfaceFormat &fmt, QPlatformOpenGLContext *share) + : QEGLPlatformContext(fmt, share, eglDisplay) + , m_display(display) + , m_decorationsContext(EGL_NO_CONTEXT) +{ + m_reconnectionWatcher = QObject::connect(m_display, &QWaylandDisplay::connected, + m_display, [this] { invalidateContext(); }); + + switch (format().renderableType()) { + case QSurfaceFormat::OpenVG: + m_api = EGL_OPENVG_API; + break; +#ifdef EGL_VERSION_1_4 + case QSurfaceFormat::OpenGL: + m_api = EGL_OPENGL_API; + break; +#endif // EGL_VERSION_1_4 + default: + m_api = EGL_OPENGL_ES_API; + break; + } + + if (m_display->supportsWindowDecoration()) { + // Create an EGL context for the decorations blitter. By using a dedicated context we are free to + // change its state and we also use OpenGL ES 2 API independently to what the app is using to draw. + QList eglDecorationsContextAttrs = { EGL_CONTEXT_CLIENT_VERSION, 2, EGL_NONE }; + m_decorationsContext = eglCreateContext(eglDisplay, eglConfig(), eglContext(), + eglDecorationsContextAttrs.constData()); + if (m_decorationsContext == EGL_NO_CONTEXT) + qWarning("QWaylandGLContext: Failed to create the decorations EGLContext. Decorations will not be drawn."); + } + + EGLint a = EGL_MIN_SWAP_INTERVAL; + EGLint b = EGL_MAX_SWAP_INTERVAL; + if (!eglGetConfigAttrib(eglDisplay, eglConfig(), a, &a) + || !eglGetConfigAttrib(eglDisplay, eglConfig(), b, &b) || a > 0) { + m_supportNonBlockingSwap = false; + } + { + bool ok; + int supportNonBlockingSwap = qEnvironmentVariableIntValue("QT_WAYLAND_FORCE_NONBLOCKING_SWAP_SUPPORT", &ok); + if (ok) + m_supportNonBlockingSwap = supportNonBlockingSwap != 0; + } + if (!m_supportNonBlockingSwap) { + qCWarning(lcQpaWayland) << "Non-blocking swap buffers not supported." + << "Subsurface rendering can be affected." + << "It may also cause the event loop to freeze in some situations"; + } +} + +EGLSurface QWaylandGLContext::createTemporaryOffscreenSurface() +{ + m_wlSurface = m_display->createSurface(nullptr); + m_eglWindow = wl_egl_window_create(m_wlSurface, 1, 1); +#if QT_CONFIG(egl_extension_platform_wayland) + EGLSurface eglSurface = + eglCreatePlatformWindowSurface(eglDisplay(), eglConfig(), m_eglWindow, nullptr); +#else + EGLSurface eglSurface = eglCreateWindowSurface(eglDisplay(), eglConfig(), m_eglWindow, nullptr); +#endif + return eglSurface; +} + +void QWaylandGLContext::destroyTemporaryOffscreenSurface(EGLSurface eglSurface) +{ + eglDestroySurface(eglDisplay(), eglSurface); + wl_egl_window_destroy(m_eglWindow); + m_eglWindow = nullptr; + wl_surface_destroy(m_wlSurface); + m_wlSurface = nullptr; +} + +void QWaylandGLContext::runGLChecks() +{ + bool ok; + const int doneCurrentWorkAround = qEnvironmentVariableIntValue("QT_WAYLAND_ENABLE_DONECURRENT_WORKAROUND", &ok); + if (ok) { + m_doneCurrentWorkAround = doneCurrentWorkAround != 0; + if (m_doneCurrentWorkAround) + qCDebug(lcQpaWayland) << "Enabling doneCurrent() workaround on request."; + else + qCDebug(lcQpaWayland) << "Disabling doneCurrent() workaround on request."; + + } else { + // Note that even though there is an EGL context current here, + // QOpenGLContext and QOpenGLFunctions are not yet usable at this stage. + const char *renderer = reinterpret_cast(glGetString(GL_RENDERER)); + if (renderer && strstr(renderer, "Mali")) { + qCDebug(lcQpaWayland) << "Enabling doneCurrent() workaround for Mali GPU." + << "Set QT_WAYLAND_ENABLE_DONECURRENT_WORKAROUND=0 to disable."; + m_doneCurrentWorkAround = true; + } + } + + QEGLPlatformContext::runGLChecks(); +} + +QWaylandGLContext::~QWaylandGLContext() +{ + QObject::disconnect(m_reconnectionWatcher); + delete m_blitter; + m_blitter = nullptr; + if (m_decorationsContext != EGL_NO_CONTEXT) + eglDestroyContext(eglDisplay(), m_decorationsContext); +} + +void QWaylandGLContext::beginFrame() +{ + Q_ASSERT(m_currentWindow != nullptr); + if (m_supportNonBlockingSwap) + m_currentWindow->beginFrame(); +} + +void QWaylandGLContext::endFrame() +{ + Q_ASSERT(m_currentWindow != nullptr); + if (m_doneCurrentWorkAround) { + doneCurrent(); + QOpenGLContextPrivate::setCurrentContext(nullptr); + } + + if (m_supportNonBlockingSwap) + m_currentWindow->endFrame(); +} + +bool QWaylandGLContext::makeCurrent(QPlatformSurface *surface) +{ + if (!isValid()) { + return false; + } + + // in QWaylandGLContext() we called eglBindAPI with the correct value. However, + // eglBindAPI's documentation says: + // "eglBindAPI defines the current rendering API for EGL in the thread it is called from" + // Since makeCurrent() can be called from a different thread than the one we created the + // context in make sure to call eglBindAPI in the correct thread. + if (eglQueryAPI() != m_api) { + eglBindAPI(m_api); + } + + m_currentWindow = static_cast(surface); + + QMutexLocker lock(m_currentWindow->eglSurfaceLock()); + EGLSurface eglSurface = m_currentWindow->eglSurface(); + + if (!m_currentWindow->needToUpdateContentFBO() && (eglSurface != EGL_NO_SURFACE)) { + if (!eglMakeCurrent(eglDisplay(), eglSurface, eglSurface, eglContext())) { + qWarning("QWaylandGLContext::makeCurrent: eglError: %#x, this: %p \n", eglGetError(), this); + return false; + } + return true; + } + + if (eglSurface == EGL_NO_SURFACE) { + m_currentWindow->updateSurface(true); + eglSurface = m_currentWindow->eglSurface(); + } + + if (!eglMakeCurrent(eglDisplay(), eglSurface, eglSurface, eglContext())) { + qWarning("QWaylandGLContext::makeCurrent: eglError: %#x, this: %p \n", eglGetError(), this); + return false; + } + + //### setCurrentContext will be called in QOpenGLContext::makeCurrent after this function + // returns, but that's too late, as we need a current context in order to bind the content FBO. + QOpenGLContextPrivate::setCurrentContext(context()); + m_currentWindow->bindContentFBO(); + + return true; +} + +void QWaylandGLContext::doneCurrent() +{ + eglMakeCurrent(eglDisplay(), EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); +} + +void QWaylandGLContext::swapBuffers(QPlatformSurface *surface) +{ + QWaylandEglWindow *window = static_cast(surface); + + EGLSurface eglSurface = window->eglSurface(); + + if (window->decoration()) { + if (m_api != EGL_OPENGL_ES_API) + eglBindAPI(EGL_OPENGL_ES_API); + + // save the current EGL content and surface to set it again after the blitter is done + EGLDisplay currentDisplay = eglGetCurrentDisplay(); + EGLContext currentContext = eglGetCurrentContext(); + EGLSurface currentSurfaceDraw = eglGetCurrentSurface(EGL_DRAW); + EGLSurface currentSurfaceRead = eglGetCurrentSurface(EGL_READ); + eglMakeCurrent(eglDisplay(), eglSurface, eglSurface, m_decorationsContext); + + if (!m_blitter) + m_blitter = new DecorationsBlitter(this); + m_blitter->blit(window); + + if (m_api != EGL_OPENGL_ES_API) + eglBindAPI(m_api); + eglMakeCurrent(currentDisplay, currentSurfaceDraw, currentSurfaceRead, currentContext); + } + + int swapInterval = m_supportNonBlockingSwap ? 0 : format().swapInterval(); + eglSwapInterval(eglDisplay(), swapInterval); + if (swapInterval == 0 && format().swapInterval() > 0) { + // Emulating a blocking swap + glFlush(); // Flush before waiting so we can swap more quickly when the frame event arrives + window->waitForFrameSync(100); + } + window->handleUpdate(); + if (!eglSwapBuffers(eglDisplay(), eglSurface)) + qCWarning(lcQpaWayland, "eglSwapBuffers failed with %#x, surface: %p", eglGetError(), eglSurface); +} + +GLuint QWaylandGLContext::defaultFramebufferObject(QPlatformSurface *surface) const +{ + return static_cast(surface)->contentFBO(); +} + +QFunctionPointer QWaylandGLContext::getProcAddress(const char *procName) +{ + QFunctionPointer proc = (QFunctionPointer) eglGetProcAddress(procName); + if (!proc) + proc = (QFunctionPointer) dlsym(RTLD_DEFAULT, procName); + return proc; +} + +EGLSurface QWaylandGLContext::eglSurfaceForPlatformSurface(QPlatformSurface *surface) +{ + return static_cast(surface)->eglSurface(); +} + +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/qwaylandglcontext_p.h b/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/qwaylandglcontext_p.h new file mode 100644 index 00000000000..bd9eb53f85e --- /dev/null +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/qwaylandglcontext_p.h @@ -0,0 +1,74 @@ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#ifndef QWAYLANDGLCONTEXT_H +#define QWAYLANDGLCONTEXT_H + +#include "qwaylandeglinclude_p.h" //must be first + +#include +#include +#include + +QT_BEGIN_NAMESPACE + +class QOpenGLShaderProgram; +class QOpenGLTextureCache; + +namespace QtWaylandClient { + +class QWaylandEglWindow; +class DecorationsBlitter; + +class Q_WAYLANDCLIENT_EXPORT QWaylandGLContext : public QEGLPlatformContext +{ +public: + QWaylandGLContext(EGLDisplay eglDisplay, QWaylandDisplay *display, const QSurfaceFormat &format, QPlatformOpenGLContext *share); + ~QWaylandGLContext(); + void swapBuffers(QPlatformSurface *surface) override; + + bool makeCurrent(QPlatformSurface *surface) override; + void doneCurrent() override; + + void beginFrame() override; + void endFrame() override; + + GLuint defaultFramebufferObject(QPlatformSurface *surface) const override; + + QFunctionPointer getProcAddress(const char *procName) override; + +protected: + EGLSurface eglSurfaceForPlatformSurface(QPlatformSurface *surface) override; + EGLSurface createTemporaryOffscreenSurface() override; + void destroyTemporaryOffscreenSurface(EGLSurface surface) override; + void runGLChecks() override; + +private: + QWaylandDisplay *m_display = nullptr; + EGLContext m_decorationsContext; + DecorationsBlitter *m_blitter = nullptr; + bool m_supportNonBlockingSwap = true; + EGLenum m_api; + wl_surface *m_wlSurface = nullptr; + wl_egl_window *m_eglWindow = nullptr; + QWaylandEglWindow *m_currentWindow = nullptr; + QMetaObject::Connection m_reconnectionWatcher; + bool m_doneCurrentWorkAround = false; +}; + +} + +QT_END_NAMESPACE + +#endif // QWAYLANDGLCONTEXT_H From 9155b2ecb45d297ffaa00d069e9d95bf95da537a Mon Sep 17 00:00:00 2001 From: Audun Sutterud Date: Thu, 27 Feb 2025 13:19:38 +0000 Subject: [PATCH 1484/1507] tests: Wait for output in tst_reconnect The test must wait for the output to have a client before placing a surface on it. If it fails to do so, flakiness may occur. Task-number: QTBUG-132699 Change-Id: I272742d3bee7ae1fe61b8df629aba2947785fc6c Reviewed-by: David Redondo --- tests/auto/wayland/reconnect/tst_reconnect.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/auto/wayland/reconnect/tst_reconnect.cpp b/tests/auto/wayland/reconnect/tst_reconnect.cpp index 22892494157..e32784ba0a3 100644 --- a/tests/auto/wayland/reconnect/tst_reconnect.cpp +++ b/tests/auto/wayland/reconnect/tst_reconnect.cpp @@ -158,6 +158,7 @@ void tst_WaylandReconnect::multipleScreens() window2.show(); QCOMPOSITOR_TRY_VERIFY(m_comp->xdgToplevel(0)); QCOMPOSITOR_TRY_VERIFY(m_comp->xdgToplevel(1)); + QCOMPOSITOR_TRY_VERIFY(!m_comp->output(1)->resourceMap().isEmpty()); // ensure they are on different outputs exec([this] { From 7d77e1d9f80958a3da2f2747a41b8f009d00d47a Mon Sep 17 00:00:00 2001 From: David Faure Date: Sun, 9 Mar 2025 13:04:39 +0100 Subject: [PATCH 1485/1507] QWaylandDisplay: fix data race on m_quitting WARNING: ThreadSanitizer: data race (pid=247514) Write of size 1 at 0x7214000026f5 by main thread (mutexes: write M0): #0 QtWaylandClient::EventThread::stop() (libQt6WaylandClient_tsan.so.6+0xbb696) Previous read of size 1 at 0x7214000026f5 by thread T3: #0 QtWaylandClient::EventThread::waitForReading() (libQt6WaylandClient_tsan.so.6+0xbbbf9) #1 QtWaylandClient::EventThread::run() (libQt6WaylandClient_tsan.so.6+0xbba27) Pick-to: 6.9 6.8 Change-Id: I4a5dc95668619d337181e6c5055cc94bbc5fc7ae Reviewed-by: David Edmundson --- .../platforms/wayland/qwaylanddisplay.cpp | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index c6334718b8e..cdab2947950 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -106,13 +106,13 @@ public: * not only the one issued from event thread's waitForReading(), which means functions * called from dispatch_pending() can safely spin an event loop. */ - if (m_quitting) + if (m_quitting.loadRelaxed()) return; for (;;) { if (dispatchQueuePending() < 0) { Q_EMIT waylandError(); - m_quitting = true; + m_quitting.storeRelaxed(true); return; } @@ -139,11 +139,8 @@ public: if (m_pipefd[1] != -1 && write(m_pipefd[1], "\0", 1) == -1) qWarning("Failed to write to the pipe: %s.", strerror(errno)); - { - QMutexLocker l(&m_mutex); - m_quitting = true; - m_cond.wakeOne(); - } + m_quitting.storeRelaxed(true); + m_cond.wakeOne(); wait(); } @@ -216,11 +213,11 @@ private: QMutexLocker lock(&m_mutex); // m_reading might be set from our emit or some other invocation of // readAndDispatchEvents(). - while (!m_reading.loadRelaxed() && !m_quitting) + while (!m_reading.loadRelaxed() && !m_quitting.loadRelaxed()) m_cond.wait(&m_mutex); } - return !m_quitting; + return !m_quitting.loadRelaxed(); } int dispatchQueuePending() @@ -255,7 +252,7 @@ private: */ QAtomicInteger m_reading; - bool m_quitting; + QAtomicInteger m_quitting; QMutex m_mutex; QWaitCondition m_cond; }; From 4472d1cd10e4775ef3ad95a523b7d183b34bb18a Mon Sep 17 00:00:00 2001 From: David Faure Date: Sat, 8 Mar 2025 20:59:38 +0100 Subject: [PATCH 1486/1507] QWaylandWindow: fix data race on mWaitingForUpdate Caught by TSAN when running examples/quick/particles/system/. deliverUpdateRequest() is called from the main thread (and doesn't lock) and handleUpdate() is called from the render thread (and locks mFrameSyncMutex). I made the bool atomic (like others in this file), rather than locking mFrameSyncMutex. Pick-to: 6.9 6.8 Change-Id: Ic2f2eafc2d91cc9676dee5a7cd1872f91dff09e2 Reviewed-by: David Edmundson --- src/plugins/platforms/wayland/qwaylandwindow_p.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index 8e0843d89eb..218dff15647 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -312,7 +312,7 @@ protected: QWaitCondition mFrameSyncWait; // True when we have called deliverRequestUpdate, but the client has not yet attached a new buffer - bool mWaitingForUpdate = false; + std::atomic_bool mWaitingForUpdate = false; bool mExposed = false; // written from the main thread, read by the render thread From b3d855be5922eccd959638b1f01be18c2e5af357 Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Tue, 18 Mar 2025 09:50:44 +0000 Subject: [PATCH 1487/1507] client: Drop assert in frame size syncing Whilst this assert is true for a normal application workflow such as QtQuick, it's not something we can guarantee with all applications. If the assert is not true, the absolutely worst case is the same glitchy resizing that we had in 6.8 and older. Fixes: QTBUG-134126 Pick-to: 6.9 Pick-to: 6.9.0 Change-Id: I43b660d771d628ceedce9407fd146b48074557f9 Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 963a87ba4d1..dc85d0f70fd 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -697,7 +697,6 @@ void QWaylandWindow::applyConfigure() // This could be improved in future as we 're blocking for not just the frame to finish but one additional extra frame. if (mInFrameRender) QWindowSystemInterface::handleExposeEvent(window(), QRect(QPoint(0, 0), geometry().size())); - Q_ASSERT(!mInFrameRender); if (mShellSurface) mShellSurface->applyConfigure(); From 54651971a260d65c987d03973168f7d274ed8930 Mon Sep 17 00:00:00 2001 From: Liang Qi Date: Tue, 11 Mar 2025 14:05:36 +0100 Subject: [PATCH 1488/1507] client: use qgenericunixtheme_p.h instead of qgenericunixthemes_p.h ... if available. Prepares the code for qtbase/53fb13456fffe8bfd192f9197c6d1703854b49a2. Change-Id: I599e3d47ed94c6e6fc0182495e483506b3ae7ff9 Reviewed-by: Marc Mutz Reviewed-by: Axel Spoerl --- src/plugins/platforms/wayland/qwaylandintegration.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/plugins/platforms/wayland/qwaylandintegration.cpp b/src/plugins/platforms/wayland/qwaylandintegration.cpp index 50fe5cbe2d1..b0033876bba 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandintegration.cpp @@ -26,7 +26,11 @@ # include #endif #include +#if __has_include() +#include +#else #include +#endif #include From f9e319dde3716583d00b83e2c4b8b56f203acc53 Mon Sep 17 00:00:00 2001 From: David Redondo Date: Wed, 19 Mar 2025 16:19:12 +0100 Subject: [PATCH 1489/1507] Move platform plugin to main client directory MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In preparation for the qtbase move Task-number: QTBUG-133223 Change-Id: I280448dfd88ffdcace9a04c95f5cd2f4591522a1 Reviewed-by: Tor Arne Vestbø --- src/plugins/platforms/wayland/CMakeLists.txt | 13 ++++++++++ .../wayland/{plugins/platform => }/main.cpp | 2 +- .../platforms/wayland/plugins/CMakeLists.txt | 1 - .../wayland/plugins/platform/CMakeLists.txt | 24 ------------------- .../qwayland-generic.json => qwayland.json} | 0 5 files changed, 14 insertions(+), 26 deletions(-) rename src/plugins/platforms/wayland/{plugins/platform => }/main.cpp (97%) delete mode 100644 src/plugins/platforms/wayland/plugins/platform/CMakeLists.txt rename src/plugins/platforms/wayland/{plugins/platform/qwayland-generic.json => qwayland.json} (100%) diff --git a/src/plugins/platforms/wayland/CMakeLists.txt b/src/plugins/platforms/wayland/CMakeLists.txt index 577450439b4..a3a153ce4de 100644 --- a/src/plugins/platforms/wayland/CMakeLists.txt +++ b/src/plugins/platforms/wayland/CMakeLists.txt @@ -95,6 +95,19 @@ qt_internal_add_module(WaylandClient ../3rdparty/protocol/wlr-data-control ) +qt_internal_add_plugin(QWaylandIntegrationPlugin + OUTPUT_NAME qwayland + PLUGIN_TYPE platforms + DEFAULT_IF "wayland" IN_LIST QT_QPA_PLATFORMS + SOURCES + main.cpp + LIBRARIES + Qt::Core + Qt::Gui + Qt::WaylandClientPrivate + QT_LICENSE_ID QT_COMMERCIAL_OR_LGPL3 +) + qt6_generate_wayland_protocol_client_sources(WaylandClient PRIVATE_CODE FILES diff --git a/src/plugins/platforms/wayland/plugins/platform/main.cpp b/src/plugins/platforms/wayland/main.cpp similarity index 97% rename from src/plugins/platforms/wayland/plugins/platform/main.cpp rename to src/plugins/platforms/wayland/main.cpp index 19a8fa147f9..1d7edf0ca65 100644 --- a/src/plugins/platforms/wayland/plugins/platform/main.cpp +++ b/src/plugins/platforms/wayland/main.cpp @@ -12,7 +12,7 @@ namespace QtWaylandClient { class QWaylandIntegrationPlugin : public QPlatformIntegrationPlugin { Q_OBJECT - Q_PLUGIN_METADATA(IID QPlatformIntegrationFactoryInterface_iid FILE "qwayland-generic.json") + Q_PLUGIN_METADATA(IID QPlatformIntegrationFactoryInterface_iid FILE "qwayland.json") public: QPlatformIntegration *create(const QString&, const QStringList&) override; }; diff --git a/src/plugins/platforms/wayland/plugins/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/CMakeLists.txt index 7b90c829453..09852e64c99 100644 --- a/src/plugins/platforms/wayland/plugins/CMakeLists.txt +++ b/src/plugins/platforms/wayland/plugins/CMakeLists.txt @@ -5,7 +5,6 @@ add_subdirectory(hardwareintegration) if(TARGET Qt::WaylandClient) - add_subdirectory(platform) add_subdirectory(decorations) add_subdirectory(shellintegration) endif() diff --git a/src/plugins/platforms/wayland/plugins/platform/CMakeLists.txt b/src/plugins/platforms/wayland/plugins/platform/CMakeLists.txt deleted file mode 100644 index 59b6b3efead..00000000000 --- a/src/plugins/platforms/wayland/plugins/platform/CMakeLists.txt +++ /dev/null @@ -1,24 +0,0 @@ -# Copyright (C) 2022 The Qt Company Ltd. -# SPDX-License-Identifier: BSD-3-Clause - -# Generated from qwayland-generic.pro. - -##################################################################### -## QWaylandIntegrationPlugin Plugin: -##################################################################### - -qt_internal_add_plugin(QWaylandIntegrationPlugin - OUTPUT_NAME qwayland - PLUGIN_TYPE platforms - DEFAULT_IF "wayland" IN_LIST QT_QPA_PLATFORMS - SOURCES - main.cpp - LIBRARIES - Qt::Core - Qt::Gui - Qt::WaylandClientPrivate - QT_LICENSE_ID QT_COMMERCIAL_OR_LGPL3 -) - -#### Keys ignored in scope 1:.:.:qwayland-generic.pro:: -# OTHER_FILES = "qwayland-generic.json" diff --git a/src/plugins/platforms/wayland/plugins/platform/qwayland-generic.json b/src/plugins/platforms/wayland/qwayland.json similarity index 100% rename from src/plugins/platforms/wayland/plugins/platform/qwayland-generic.json rename to src/plugins/platforms/wayland/qwayland.json From 727e115a8109c66e2b3008456ff2ff3fd859d63d Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Sat, 29 Mar 2025 11:28:47 +0200 Subject: [PATCH 1490/1507] Client: Notify about exposure changes when popup is repositioned QXdgSurface::Popup::setWindowPosition() changes the exposed state, but it doesn't call QWindowSystemInterface::handleExposeEvent() to notify the QGuiApplication layer about it. For example, this can result in the QMenu unexpectedly repainting with the new size even though QtWayland still waits for the reposition request to be completed. xdg_popup_repositioned doesn't need to call updateExposure() because it is going to be followed by a configure event and QWaylandXdgSurface::applyConfigure() already updates the exposed state. Pick-to: 6.9 Change-Id: Ia0435e2cd1a0d39e0edac61beb4c0d761314c1d6 Reviewed-by: David Edmundson --- .../plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp index 29c7cbf55d9..5fd718e697b 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp @@ -680,6 +680,7 @@ void QWaylandXdgSurface::setWindowPosition(const QPoint &position) m_popup->m_waitingForRepositionSerial++; m_popup->reposition(positioner->object(), m_popup->m_waitingForRepositionSerial); m_popup->m_waitingForReposition = true; + window()->updateExposure(); } std::unique_ptr QWaylandXdgSurface::createPositioner(QWaylandWindow *parent) From 6580ad906a539f6a0ce43897095f54c32039dc92 Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Mon, 31 Mar 2025 11:40:12 +0300 Subject: [PATCH 1491/1507] Client: Reset mFrameCallbackTimedOut when showing a window When a window is hidden, the corresponding expose event is sent asynchronously. So, a buffer (and a frame callback) can be attached after the window is hidden. QWaylandWindow::initWindow() handles that case by attaching a nil buffer to the surface, but it skips resetting the frame callback things. If mFrameCallbackTimedOut is not reset, then the window can get stuck in the unexposed state and not show up after the second setVisible(true). This change makes the initWindow() function also reset frame callback data. It fixes some windows not showing up after remapping them. Pick-to: 6.9 Change-Id: I8952ffed24844c73721c4f689786146c317e014d Reviewed-by: David Edmundson --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 13 ++++++++++--- src/plugins/platforms/wayland/qwaylandwindow_p.h | 1 + 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index dc85d0f70fd..92a338663d8 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -107,6 +107,7 @@ void QWaylandWindow::initWindow() */ mSurface->attach(nullptr, 0, 0); mSurface->commit(); + resetFrameCallback(); if (window()->type() == Qt::Desktop) return; @@ -354,6 +355,15 @@ void QWaylandWindow::resetSurfaceRole() delete std::exchange(mShellSurface, nullptr); delete std::exchange(mSubSurfaceWindow, nullptr); emit surfaceRoleDestroyed(); + + resetFrameCallback(); + mInFrameRender = false; + mWaitingToApplyConfigure = false; + mExposed = false; +} + +void QWaylandWindow::resetFrameCallback() +{ { QMutexLocker lock(&mFrameSyncMutex); if (mFrameCallback) { @@ -367,10 +377,7 @@ void QWaylandWindow::resetSurfaceRole() killTimer(mFrameCallbackCheckIntervalTimerId); mFrameCallbackCheckIntervalTimerId = -1; } - mInFrameRender = false; mFrameCallbackTimedOut = false; - mWaitingToApplyConfigure = false; - mExposed = false; } QWaylandWindow *QWaylandWindow::fromWlSurface(::wl_surface *surface) diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index 218dff15647..234c0645ef4 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -359,6 +359,7 @@ private: bool shouldCreateShellSurface() const; bool shouldCreateSubSurface() const; void resetSurfaceRole(); + void resetFrameCallback(); QPlatformScreen *calculateScreenFromSurfaceEvents() const; void setOpaqueArea(const QRegion &opaqueArea); bool isOpaque() const; From f197456481ef799b38ce37a7462e898214d6d899 Mon Sep 17 00:00:00 2001 From: David Faure Date: Wed, 19 Mar 2025 00:39:20 +0100 Subject: [PATCH 1492/1507] Don't call elapsed() on an invalid QElapsedTimer It's UB, and it returns garbage. In QWaylandWindow::timerEvent the value was unused if the timer was invalid (but that was tested only later). In QWaylandInputDevice / QWaylandTabletToolV2 however the garbage value was passed on to wl_cursor_frame_and_duration. Testcase: running tests/auto/client/client/tst_client and tests/auto/client/tabletv2/tst_tabletv2 in a UBSAN build. Pick-to: 6.9 6.8 6.5 Change-Id: Ie0f8610bbca49913942b2247d3e968197e12f47e Reviewed-by: Konstantin Ritt --- src/plugins/platforms/wayland/qwaylandinputdevice.cpp | 3 ++- src/plugins/platforms/wayland/qwaylandtabletv2.cpp | 3 ++- src/plugins/platforms/wayland/qwaylandwindow.cpp | 7 ++++--- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index dfd87bdec6f..9224e5fb43f 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -245,7 +245,8 @@ void QWaylandInputDevice::Pointer::updateCursor() return; // Set from shape using theme - uint time = seat()->mCursor.animationTimer.elapsed(); + const QElapsedTimer &timer = seat()->mCursor.animationTimer; + const uint time = timer.isValid() ? timer.elapsed() : 0; if (struct ::wl_cursor *waylandCursor = mCursor.theme->cursor(shape)) { uint duration = 0; diff --git a/src/plugins/platforms/wayland/qwaylandtabletv2.cpp b/src/plugins/platforms/wayland/qwaylandtabletv2.cpp index 3cfcdfe7d00..8973d67b72f 100644 --- a/src/plugins/platforms/wayland/qwaylandtabletv2.cpp +++ b/src/plugins/platforms/wayland/qwaylandtabletv2.cpp @@ -113,7 +113,8 @@ void QWaylandTabletToolV2::updateCursor() return; // Set from shape using theme - uint time = m_tabletSeat->seat()->mCursor.animationTimer.elapsed(); + QElapsedTimer &timer = m_tabletSeat->seat()->mCursor.animationTimer; + const uint time = timer.isValid() ? timer.elapsed() : 0; if (struct ::wl_cursor *waylandCursor = mCursor.theme->cursor(shape)) { uint duration = 0; diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 92a338663d8..a1534c0b0ff 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -1682,12 +1682,13 @@ void QWaylandWindow::timerEvent(QTimerEvent *event) { QMutexLocker lock(&mFrameSyncMutex); - bool callbackTimerExpired = mFrameCallbackElapsedTimer.hasExpired(mFrameCallbackTimeout); - if (!mFrameCallbackElapsedTimer.isValid() || callbackTimerExpired ) { + const bool callbackTimerValid = mFrameCallbackElapsedTimer.isValid(); + const bool callbackTimerExpired = callbackTimerValid && mFrameCallbackElapsedTimer.hasExpired(mFrameCallbackTimeout); + if (!callbackTimerValid || callbackTimerExpired) { killTimer(mFrameCallbackCheckIntervalTimerId); mFrameCallbackCheckIntervalTimerId = -1; } - if (!mFrameCallbackElapsedTimer.isValid() || !callbackTimerExpired) { + if (!callbackTimerValid || !callbackTimerExpired) { return; } mFrameCallbackElapsedTimer.invalidate(); From 26968c3802fdcd4d153b0ce7507387f45f9ac140 Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Thu, 3 Apr 2025 12:33:34 +0300 Subject: [PATCH 1493/1507] Client: Fix copying shm buffer data with fractional scaling The QWaylandShmBackingStore computes the device pixels in the source image manually. But it does not match what the QPainter does one to one. Visually, it produces artifacts where the contents of an app is jiggling or moves back and forth by one pixel. In order to address the issue, the QWaylandShmBackingStore can copy whole buffers but with a clip region set. That way, the QPainter can consistently compute the coordinates in the device pixels. Pick-to: 6.9 Change-Id: Ib4832c4d687f43f6cc1de4a1760c32f1abd2ab03 Reviewed-by: David Edmundson --- .../platforms/wayland/qwaylandshmbackingstore.cpp | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp b/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp index 9ca2415a320..5e6a00cf600 100644 --- a/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp +++ b/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp @@ -364,13 +364,8 @@ bool QWaylandShmBackingStore::recreateBackBufferIfNeeded() QPainter painter(targetImage); painter.setCompositionMode(QPainter::CompositionMode_Source); - - const qreal sourceDevicePixelRatio = sourceImage->devicePixelRatio(); - for (const QRect &rect : buffer->dirtyRegion()) { - QRectF sourceRect(QPointF(rect.topLeft()) * sourceDevicePixelRatio, - QSizeF(rect.size()) * sourceDevicePixelRatio); - painter.drawImage(rect, *sourceImage, sourceRect); - } + painter.setClipRegion(buffer->dirtyRegion()); + painter.drawImage(QRectF(QPointF(), targetImage->deviceIndependentSize()), *sourceImage, sourceImage->rect()); } mBackBuffer = buffer; From 0544249ea7278df7480882c0d3c54992656448f1 Mon Sep 17 00:00:00 2001 From: Konstantin Ritt Date: Mon, 31 Mar 2025 01:14:56 +0300 Subject: [PATCH 1494/1507] Client: Support wl_output.name of version 4 Change-Id: I937146f571460045ab0a3b8a7e5cd5f3d802ea62 Reviewed-by: David Edmundson --- .../platforms/wayland/qwaylandscreen.cpp | 22 ++++++++++++++++++- .../platforms/wayland/qwaylandscreen_p.h | 2 ++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandscreen.cpp b/src/plugins/platforms/wayland/qwaylandscreen.cpp index ef548925b62..e902ff27cc8 100644 --- a/src/plugins/platforms/wayland/qwaylandscreen.cpp +++ b/src/plugins/platforms/wayland/qwaylandscreen.cpp @@ -28,7 +28,7 @@ QWaylandXdgOutputManagerV1::~QWaylandXdgOutputManagerV1() } QWaylandScreen::QWaylandScreen(QWaylandDisplay *waylandDisplay, int version, uint32_t id) - : QtWayland::wl_output(waylandDisplay->wl_registry(), id, qMin(version, 3)) + : QtWayland::wl_output(waylandDisplay->wl_registry(), id, qMin(version, 4)) , m_outputId(id) , mWaylandDisplay(waylandDisplay) , mOutputName(QStringLiteral("Screen%1").arg(id)) @@ -322,8 +322,28 @@ void QWaylandScreen::output_done() } } +void QWaylandScreen::output_name(const QString &name) +{ + if (Q_UNLIKELY(mInitialized)) { + qCWarning(lcQpaWayland) << "wl_output.name received after output has been initialized, this is most likely a bug in the compositor"; + return; + } + + if (Q_UNLIKELY(mProcessedEvents & OutputNameEvent)) { + qCWarning(lcQpaWayland) << "wl_output.name received more than once, this is most likely a bug in the compositor"; + return; + } + + if (!name.isEmpty()) + mOutputName = name; + + mProcessedEvents |= OutputNameEvent; +} + void QWaylandScreen::updateOutputProperties() { + Q_ASSERT(mInitialized); + if (mTransform >= 0) { auto newOrientation = toScreenOrientation(mTransform, m_orientation); if (m_orientation != newOrientation) { diff --git a/src/plugins/platforms/wayland/qwaylandscreen_p.h b/src/plugins/platforms/wayland/qwaylandscreen_p.h index ff3d23217c7..de030732eb3 100644 --- a/src/plugins/platforms/wayland/qwaylandscreen_p.h +++ b/src/plugins/platforms/wayland/qwaylandscreen_p.h @@ -93,6 +93,7 @@ protected: XdgOutputDoneEvent = 0x1, OutputDoneEvent = 0x2, XdgOutputNameEvent = 0x4, + OutputNameEvent = 0x8, }; uint requiredEvents() const; @@ -105,6 +106,7 @@ protected: int32_t transform) override; void output_scale(int32_t factor) override; void output_done() override; + void output_name(const QString &name) override; void updateOutputProperties(); // XdgOutput From f5a940a34f823f98ad32697f92cff3b0a79c3b70 Mon Sep 17 00:00:00 2001 From: Konstantin Ritt Date: Mon, 31 Mar 2025 01:17:06 +0300 Subject: [PATCH 1495/1507] Client: Improve support of zxdg_output_v1 version 3 by applying recommendations regarding the deprecated events Change-Id: Ic462b1be83a1241f01f3fc909fa803615781ed2e Reviewed-by: David Edmundson --- .../xdg-output/xdg-output-unstable-v1.xml | 34 ++++++++++--------- .../platforms/wayland/qwaylandscreen.cpp | 16 +++++++-- 2 files changed, 32 insertions(+), 18 deletions(-) diff --git a/src/3rdparty/wayland/protocols/xdg-output/xdg-output-unstable-v1.xml b/src/3rdparty/wayland/protocols/xdg-output/xdg-output-unstable-v1.xml index fe3a70aab0d..a7306e4193e 100644 --- a/src/3rdparty/wayland/protocols/xdg-output/xdg-output-unstable-v1.xml +++ b/src/3rdparty/wayland/protocols/xdg-output/xdg-output-unstable-v1.xml @@ -35,12 +35,12 @@ Typically, the global compositor space on a desktop system is made of a contiguous or overlapping set of rectangular regions. - Some of the information provided in this protocol might be identical - to their counterparts already available from wl_output, in which case - the information provided by this protocol should be preferred to their - equivalent in wl_output. The goal is to move the desktop specific - concepts (such as output location within the global compositor space, - the connector name and types, etc.) out of the core wl_output protocol. + The logical_position and logical_size events defined in this protocol + might provide information identical to their counterparts already + available from wl_output, in which case the information provided by this + protocol should be preferred to their equivalent in wl_output. The goal is + to move the desktop specific concepts (such as output location within the + global compositor space, etc.) out of the core wl_output protocol. Warning! The protocol described in this file is experimental and backward incompatible changes may be made. Backward compatible @@ -117,10 +117,6 @@ The logical_size event describes the size of the output in the global compositor space. - For example, a surface without any buffer scale, transformation - nor rotation set, with the size matching the logical_size will - have the same size as the corresponding output when displayed. - Most regular Wayland clients should not pay attention to the logical size and would rather rely on xdg_shell interfaces. @@ -131,14 +127,14 @@ For example, for a wl_output mode 3840×2160 and a scale factor 2: - - A compositor not scaling the surface buffers will advertise a - logical size of 3840×2160, + - A compositor not scaling the monitor viewport in its compositing space + will advertise a logical size of 3840×2160, - - A compositor automatically scaling the surface buffers will + - A compositor scaling the monitor viewport with scale factor 2 will advertise a logical size of 1920×1080, - - A compositor using a fractional scale of 1.5 will advertise a - logical size to 2560×1620. + - A compositor scaling the monitor viewport using a fractional scale of + 1.5 will advertise a logical size of 2560×1440. For example, for a wl_output mode 1920×1080 and a 90 degree rotation, the compositor will advertise a logical size of 1080x1920. @@ -155,7 +151,7 @@ summary="height in global compositor space"/> - + This event is sent after all other properties of an xdg_output have been sent. @@ -191,6 +187,9 @@ xdg_output_manager.get_xdg_output). This event is only sent once per xdg_output, and the name does not change over the lifetime of the wl_output global. + + This event is deprecated, instead clients should use wl_output.name. + Compositors must still support this event. @@ -212,6 +211,9 @@ For objects of version 2 and lower, this event is only sent once per xdg_output, and the description does not change over the lifetime of the wl_output global. + + This event is deprecated, instead clients should use + wl_output.description. Compositors must still support this event. diff --git a/src/plugins/platforms/wayland/qwaylandscreen.cpp b/src/plugins/platforms/wayland/qwaylandscreen.cpp index e902ff27cc8..1cd3591083a 100644 --- a/src/plugins/platforms/wayland/qwaylandscreen.cpp +++ b/src/plugins/platforms/wayland/qwaylandscreen.cpp @@ -60,9 +60,10 @@ uint QWaylandScreen::requiredEvents() const uint ret = OutputDoneEvent; if (mWaylandDisplay->xdgOutputManager()) { - if (mWaylandDisplay->xdgOutputManager()->version() >= 2) + if (mWaylandDisplay->xdgOutputManager()->version() >= ZXDG_OUTPUT_V1_NAME_SINCE_VERSION) ret |= XdgOutputNameEvent; + // For objects version 3 onwards, zxdg_output_v1.done is deprecated. if (mWaylandDisplay->xdgOutputManager()->version() < 3) ret |= XdgOutputDoneEvent; } @@ -387,12 +388,23 @@ void QWaylandScreen::zxdg_output_v1_name(const QString &name) if (Q_UNLIKELY(mInitialized)) qCWarning(lcQpaWayland) << "zxdg_output_v1.name received after output has been initialized, this is most likely a bug in the compositor"; - mOutputName = name; + if (Q_UNLIKELY(mProcessedEvents & XdgOutputNameEvent)) { + qCWarning(lcQpaWayland) << "zxdg_output_v1.name received more than once, this is most likely a bug in the compositor"; + return; + } + + // This event is deprecated, instead clients should use wl_output.name. + if (!(mProcessedEvents & OutputNameEvent)) { + if (!name.isEmpty()) + mOutputName = name; + } + mProcessedEvents |= XdgOutputNameEvent; } void QWaylandScreen::updateXdgOutputProperties() { + Q_ASSERT(mInitialized); Q_ASSERT(zxdg_output_v1::isInitialized()); QWindowSystemInterface::handleScreenGeometryChange(screen(), geometry(), geometry()); } From 3dc73f701bab4e6a13896ccceadf65020dfc3360 Mon Sep 17 00:00:00 2001 From: Michael Weghorn Date: Sun, 13 Apr 2025 21:07:48 +0200 Subject: [PATCH 1496/1507] client: Include This fixes build errors like the following seen in a local -no-pch clang 19 build: 2/16] Building CXX object qtwayland/src/client/CMakeFiles/WaylandClient.dir/qwaylandprimaryselectionv1.cpp.o FAILED: qtwayland/src/client/CMakeFiles/WaylandClient.dir/qwaylandprimaryselectionv1.cpp.o /usr/bin/ccache /usr/bin/clang++ -DQT_ASCII_CAST_WARNINGS -DQT_BUILDING_QT -DQT_BUILD_WAYLANDCLIENT_LIB -DQT_CORE_LIB -DQT_DEPRECATED_WARNINGS -DQT_EXPLICIT_QFILE_CONSTRUCTION_FROM_PATH -DQT_GUI_LIB -DQT_MOC_COMPAT -DQT_NO_AS_CONST=1 -DQT_NO_CAST_TO_ASCII -DQT_NO_CONTEXTLESS_CONNECT=1 -DQT_NO_EXCEPTIONS -DQT_NO_FOREACH -DQT_NO_FOREACH=1 -DQT_NO_JAVA_STYLE_ITERATORS -DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT -DQT_NO_QASCONST -DQT_NO_QEXCHANGE -DQT_NO_QSNPRINTF -DQT_NO_STD_FORMAT_SUPPORT -DQT_STRICT_QLIST_ITERATORS -DQT_USE_QSTRINGBUILDER -DQT_WAYLANDGLOBAL_LIB -DWaylandClient_EXPORTS -D_GLIBCXX_ASSERTIONS -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -I/home/michi/development/git/qt5/qtwayland/src/client/WaylandClient_autogen/include -I/home/michi/development/git/qt5/qtbase/include -I/home/michi/development/git/qt5/qtbase/include/QtWaylandClient -I/home/michi/development/git/qt5/qtwayland/src/client -I/home/michi/development/git/qt5/qtwayland/src/client/../shared -I/home/michi/development/git/qt5/qtwayland/src/client/global -I/home/michi/development/git/qt5/qtwayland/src/client/hardwareintegration -I/home/michi/development/git/qt5/qtwayland/src/client/inputdeviceintegration -I/home/michi/development/git/qt5/qtwayland/src/client/shellintegration -I/home/michi/development/git/qt5/qtbase/include/QtWaylandClient/6.10.0 -I/home/michi/development/git/qt5/qtbase/include/QtWaylandClient/6.10.0/QtWaylandClient -I/home/michi/development/git/qt5/qtbase/include/QtCore -I/home/michi/development/git/qt5/qtbase/mkspecs/linux-clang -I/home/michi/development/git/qt5/qtbase/include/QtGui -I/home/michi/development/git/qt5/qtbase/src/corelib -I/home/michi/development/git/qt5/qtbase/include/QtCore/6.10.0 -I/home/michi/development/git/qt5/qtbase/include/QtCore/6.10.0/QtCore -I/home/michi/development/git/qt5/qtbase/src/gui -I/home/michi/development/git/qt5/qtbase/include/QtGui/6.10.0 -I/home/michi/development/git/qt5/qtbase/include/QtGui/6.10.0/QtGui -I/home/michi/development/git/qt5/qtbase/include/QtWaylandGlobal -I/home/michi/development/git/qt5/qtwayland/src -I/home/michi/development/git/qt5/qtbase/include/QtWaylandGlobal/6.10.0 -I/home/michi/development/git/qt5/qtbase/include/QtWaylandGlobal/6.10.0/QtWaylandGlobal -D_GLIBCXX_DEBUG -g -std=gnu++17 -fPIC -fvisibility=hidden -fvisibility-inlines-hidden -Wall -Wextra -fPIC -Werror "-Wno-error=#warnings" -Wno-error=deprecated-declarations -Wno-error=deprecated-enum-enum-conversion -Wno-error=deprecated-copy-with-user-provided-copy -Wno-error=unused-but-set-variable -fcf-protection=full -ftrivial-auto-var-init=pattern -fstack-protector-strong -fno-exceptions -MD -MT qtwayland/src/client/CMakeFiles/WaylandClient.dir/qwaylandprimaryselectionv1.cpp.o -MF qtwayland/src/client/CMakeFiles/WaylandClient.dir/qwaylandprimaryselectionv1.cpp.o.d -o qtwayland/src/client/CMakeFiles/WaylandClient.dir/qwaylandprimaryselectionv1.cpp.o -c /home/michi/development/git/qt5/qtwayland/src/client/qwaylandprimaryselectionv1.cpp /home/michi/development/git/qt5/qtwayland/src/client/qwaylandprimaryselectionv1.cpp:121:26: error: variable has incomplete type 'struct sigaction' 121 | struct sigaction action, oldAction; | ^ /home/michi/development/git/qt5/qtwayland/src/client/qwaylandprimaryselectionv1.cpp:121:16: note: forward declaration of 'sigaction' 121 | struct sigaction action, oldAction; | ^ /home/michi/development/git/qt5/qtwayland/src/client/qwaylandprimaryselectionv1.cpp:121:34: error: variable has incomplete type 'struct sigaction' 121 | struct sigaction action, oldAction; | ^ /home/michi/development/git/qt5/qtwayland/src/client/qwaylandprimaryselectionv1.cpp:121:16: note: forward declaration of 'sigaction' 121 | struct sigaction action, oldAction; | ^ /home/michi/development/git/qt5/qtwayland/src/client/qwaylandprimaryselectionv1.cpp:122:29: error: use of undeclared identifier 'SIG_IGN' 122 | action.sa_handler = SIG_IGN; | ^ /home/michi/development/git/qt5/qtwayland/src/client/qwaylandprimaryselectionv1.cpp:126:19: error: use of undeclared identifier 'SIGPIPE' 126 | sigaction(SIGPIPE, &action, &oldAction); | ^ /home/michi/development/git/qt5/qtwayland/src/client/qwaylandprimaryselectionv1.cpp:127:26: error: use of undeclared identifier 'write'; did you mean '_IO_cookie_io_functions_t::write'? 127 | ssize_t unused = write(fd, content.constData(), size_t(content.size())); | ^~~~~ | _IO_cookie_io_functions_t::write /usr/include/x86_64-linux-gnu/bits/types/cookie_io_functions_t.h:58:28: note: '_IO_cookie_io_functions_t::write' declared here 58 | cookie_write_function_t *write; /* Write bytes. */ | ^ /home/michi/development/git/qt5/qtwayland/src/client/qwaylandprimaryselectionv1.cpp:127:26: error: invalid use of non-static data member 'write' 127 | ssize_t unused = write(fd, content.constData(), size_t(content.size())); | ^~~~~ /home/michi/development/git/qt5/qtwayland/src/client/qwaylandprimaryselectionv1.cpp:129:19: error: use of undeclared identifier 'SIGPIPE' 129 | sigaction(SIGPIPE, &oldAction, nullptr); | ^ /home/michi/development/git/qt5/qtwayland/src/client/qwaylandprimaryselectionv1.cpp:131:5: error: use of undeclared identifier 'close' 131 | close(fd); | ^ 8 errors generated. ninja: build stopped: subcommand failed. Change-Id: Iee791fa5bc83184a597e95ae6424f42bfe2efd25 Reviewed-by: David Redondo --- src/plugins/platforms/wayland/qwaylanddatacontrolv1.cpp | 2 ++ src/plugins/platforms/wayland/qwaylandprimaryselectionv1.cpp | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/plugins/platforms/wayland/qwaylanddatacontrolv1.cpp b/src/plugins/platforms/wayland/qwaylanddatacontrolv1.cpp index 1d3a8e33898..33f49e2cb03 100644 --- a/src/plugins/platforms/wayland/qwaylanddatacontrolv1.cpp +++ b/src/plugins/platforms/wayland/qwaylanddatacontrolv1.cpp @@ -10,6 +10,8 @@ #include +#include + QT_BEGIN_NAMESPACE namespace QtWaylandClient { diff --git a/src/plugins/platforms/wayland/qwaylandprimaryselectionv1.cpp b/src/plugins/platforms/wayland/qwaylandprimaryselectionv1.cpp index d72b8f74930..c38193e3bfb 100644 --- a/src/plugins/platforms/wayland/qwaylandprimaryselectionv1.cpp +++ b/src/plugins/platforms/wayland/qwaylandprimaryselectionv1.cpp @@ -10,6 +10,8 @@ #include +#include + QT_BEGIN_NAMESPACE namespace QtWaylandClient { From 71dedf56d77b9075ac232d3b29a2f1f2c0a8a6e8 Mon Sep 17 00:00:00 2001 From: David Faure Date: Fri, 11 Apr 2025 14:17:33 +0200 Subject: [PATCH 1497/1507] QWaylandWindow: fix data race on mFrameCallbackTimedOut WARNING: ThreadSanitizer: data race Write of size 1 at 0x7b5000008aa0 by thread T51 (mutexes: write M1, write M2): #0 QtWaylandClient::QWaylandWindow::waitForFrameSync(int) qtwayland/src/client/qwaylandwindow.cpp:784 (libQt6WaylandClient.so.6+0xdd6a9) #1 QtWaylandClient::QWaylandGLContext::swapBuffers(QPlatformSurface*) qtwayland/src/hardwareintegration/client/wayland-egl/qwaylandglcontext.cpp:393 (libQt6WaylandEglClientHwIntegration.so.6+0xc706) #2 QOpenGLContext::swapBuffers(QSurface*) qtbase/src/gui/kernel/qopenglcontext.cpp:783 (libQt6Gui.so.6+0x80c6df) #3 QRhiGles2::endFrame(QRhiSwapChain*, QFlags) qtbase/src/gui/rhi/qrhigles2.cpp:1984 (libQt6Gui.so.6+0x85bbda) #4 QRhi::endFrame(QRhiSwapChain*, QFlags) qtbase/src/gui/rhi/qrhi.cpp:7689 (libQt6Gui.so.6+0x58faf0) #5 QSGRenderThread::syncAndRender() qtdeclarative/src/quick/scenegraph/qsgthreadedrenderloop.cpp:748 (libQt6Quick.so.6+0x7bb88a) Previous write of size 1 at 0x7b5000008aa0 by main thread: #0 QtWaylandClient::QWaylandWindow::timerEvent(QTimerEvent*) qtwayland/src/client/qwaylandwindow.cpp:1480 (libQt6WaylandClient.so.6+0xdc079) Pick-to: 6.9 6.8 6.5 Change-Id: Ieb8819c5a273e6581975b258d4728bb6f3325da6 Reviewed-by: Konstantin Ritt --- src/plugins/platforms/wayland/qwaylandwindow_p.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index 234c0645ef4..06d8dbed38b 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -301,7 +301,7 @@ protected: GestureState mGestureState = GestureNotActive; #endif - bool mFrameCallbackTimedOut = false; // Whether the frame callback has timed out + std::atomic_bool mFrameCallbackTimedOut = false; // Whether the frame callback has timed out int mFrameCallbackCheckIntervalTimerId = -1; QAtomicInt mWaitingForUpdateDelivery = false; From 745bbca004b87b8c910ed207db36535c100ea26e Mon Sep 17 00:00:00 2001 From: Michael Weghorn Date: Sun, 13 Apr 2025 21:10:34 +0200 Subject: [PATCH 1498/1507] tst_reconnect: Include This fixes this build error seen in a local -no-pch clang 19 build: [17/19] Building CXX object qtwayland/tests/auto/client/reconnect/CMakeFiles/tst_wl_reconnect.dir/tst_reconnect.cpp.o FAILED: qtwayland/tests/auto/client/reconnect/CMakeFiles/tst_wl_reconnect.dir/tst_reconnect.cpp.o /usr/bin/ccache /usr/bin/clang++ -DQT_CORE_LIB -DQT_EXPLICIT_QFILE_CONSTRUCTION_FROM_PATH -DQT_GUI_LIB -DQT_NO_AS_CONST=1 -DQT_NO_CONTEXTLESS_CONNECT=1 -DQT_NO_FOREACH -DQT_NO_FOREACH=1 -DQT_NO_JAVA_STYLE_ITERATORS -DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT -DQT_NO_QASCONST -DQT_NO_QEXCHANGE -DQT_NO_QSNPRINTF -DQT_OPENGL_LIB -DQT_STRICT_QLIST_ITERATORS -DQT_TESTCASE_BUILDDIR=\"/home/michi/development/git/qt5/qtwayland/tests/auto/client/reconnect\" -DQT_TESTCASE_SOURCEDIR=\"/home/michi/development/git/qt5/qtwayland/tests/auto/client/reconnect\" -DQT_TESTLIB_LIB -DQT_WAYLANDCLIENT_LIB -DQT_WAYLANDGLOBAL_LIB -D_GLIBCXX_ASSERTIONS -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -I/home/michi/development/git/qt5/qtwayland/tests/auto/client/reconnect/tst_wl_reconnect_autogen/include -I/home/michi/development/git/qt5/qtwayland/tests/auto/client/reconnect -I/home/michi/development/git/qt5/qtbase/include -I/home/michi/development/git/qt5/qtwayland/tests/auto/client/shared -I/home/michi/development/git/qt5/qtbase/include/QtGui -I/home/michi/development/git/qt5/qtbase/include/QtCore -I/home/michi/development/git/qt5/qtbase/mkspecs/linux-clang -I/home/michi/development/git/qt5/qtbase/include/QtOpenGL -I/home/michi/development/git/qt5/qtwayland/src/client -I/home/michi/development/git/qt5/qtbase/include/QtWaylandClient/6.10.0 -I/home/michi/development/git/qt5/qtbase/include/QtWaylandClient/6.10.0/QtWaylandClient -I/home/michi/development/git/qt5/qtbase/src/corelib -I/home/michi/development/git/qt5/qtbase/include/QtCore/6.10.0 -I/home/michi/development/git/qt5/qtbase/include/QtCore/6.10.0/QtCore -I/home/michi/development/git/qt5/qtbase/src/gui -I/home/michi/development/git/qt5/qtbase/include/QtGui/6.10.0 -I/home/michi/development/git/qt5/qtbase/include/QtGui/6.10.0/QtGui -I/home/michi/development/git/qt5/qtbase/include/QtWaylandGlobal -I/home/michi/development/git/qt5/qtwayland/src -I/home/michi/development/git/qt5/qtbase/include/QtWaylandGlobal/6.10.0 -I/home/michi/development/git/qt5/qtbase/include/QtWaylandGlobal/6.10.0/QtWaylandGlobal -I/home/michi/development/git/qt5/qtbase/include/QtWaylandClient -I/home/michi/development/git/qt5/qtbase/include/QtTest -D_GLIBCXX_DEBUG -g -std=gnu++17 -fPIE -fvisibility=hidden -fvisibility-inlines-hidden -Wall -Wextra -fPIC -fcf-protection=full -ftrivial-auto-var-init=pattern -fstack-protector-strong -fexceptions -MD -MT qtwayland/tests/auto/client/reconnect/CMakeFiles/tst_wl_reconnect.dir/tst_reconnect.cpp.o -MF qtwayland/tests/auto/client/reconnect/CMakeFiles/tst_wl_reconnect.dir/tst_reconnect.cpp.o.d -o qtwayland/tests/auto/client/reconnect/CMakeFiles/tst_wl_reconnect.dir/tst_reconnect.cpp.o -c /home/michi/development/git/qt5/qtwayland/tests/auto/client/reconnect/tst_reconnect.cpp /home/michi/development/git/qt5/qtwayland/tests/auto/client/reconnect/tst_reconnect.cpp:123:65: error: use of undeclared identifier 'dup' 123 | m_comp.reset(new DefaultCompositor(CoreCompositor::Default, dup(socketFd))); | ^ /home/michi/development/git/qt5/qtwayland/tests/auto/client/reconnect/tst_reconnect.cpp:130:65: error: use of undeclared identifier 'dup' 130 | m_comp.reset(new DefaultCompositor(CoreCompositor::Default, dup(socketFd))); | ^ 2 errors generated. ninja: build stopped: subcommand failed. Change-Id: I2bf139ec582f90e2b447223c3092836c79483156 Reviewed-by: David Redondo --- tests/auto/wayland/reconnect/tst_reconnect.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/auto/wayland/reconnect/tst_reconnect.cpp b/tests/auto/wayland/reconnect/tst_reconnect.cpp index e32784ba0a3..5f3d49bd38d 100644 --- a/tests/auto/wayland/reconnect/tst_reconnect.cpp +++ b/tests/auto/wayland/reconnect/tst_reconnect.cpp @@ -22,6 +22,8 @@ #include "wl-socket.h" +#include + using namespace MockCompositor; class TestWindow : public QRasterWindow From b964195096673628f094c9ebab3fa5a19057842b Mon Sep 17 00:00:00 2001 From: Kai Uwe Broulik Date: Tue, 15 Apr 2025 14:46:50 +0200 Subject: [PATCH 1499/1507] client: Include unistd.h It's needed for write. Change-Id: I0533ed01c5325c1b8313db1eeef0163bbf8c166c Reviewed-by: David Redondo --- src/plugins/platforms/wayland/qwaylanddatacontrolv1.cpp | 1 + src/plugins/platforms/wayland/qwaylandprimaryselectionv1.cpp | 1 + 2 files changed, 2 insertions(+) diff --git a/src/plugins/platforms/wayland/qwaylanddatacontrolv1.cpp b/src/plugins/platforms/wayland/qwaylanddatacontrolv1.cpp index 33f49e2cb03..05c0a8ffafe 100644 --- a/src/plugins/platforms/wayland/qwaylanddatacontrolv1.cpp +++ b/src/plugins/platforms/wayland/qwaylanddatacontrolv1.cpp @@ -11,6 +11,7 @@ #include #include +#include QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandprimaryselectionv1.cpp b/src/plugins/platforms/wayland/qwaylandprimaryselectionv1.cpp index c38193e3bfb..4d2d0e4ec86 100644 --- a/src/plugins/platforms/wayland/qwaylandprimaryselectionv1.cpp +++ b/src/plugins/platforms/wayland/qwaylandprimaryselectionv1.cpp @@ -11,6 +11,7 @@ #include #include +#include QT_BEGIN_NAMESPACE From 4468b5364592d945a7094f4414ecbf629bce8f22 Mon Sep 17 00:00:00 2001 From: Kai Uwe Broulik Date: Tue, 8 Apr 2025 14:08:46 +0200 Subject: [PATCH 1500/1507] QWaylandXdgSurface: Always use XDG Dialog for modal windows Even when it doesn't have a transient parent Qt knows about. The surface might get a parent assigned externally through XDG Foreign. Change-Id: I21dbfd00aa0ff78e26ce4c111fe260f18b9dc905 Reviewed-by: David Redondo Reviewed-by: David Edmundson --- .../xdg-shell/qwaylandxdgshell.cpp | 13 ++++---- tests/auto/wayland/xdgshell/tst_xdgshell.cpp | 31 +++++++++++++++++++ 2 files changed, 38 insertions(+), 6 deletions(-) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp index 5fd718e697b..8cdd0a681bd 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp @@ -36,13 +36,14 @@ QWaylandXdgSurface::Toplevel::Toplevel(QWaylandXdgSurface *xdgSurface) requestWindowFlags(window->flags()); if (auto transientParent = xdgSurface->window()->transientParent()) { auto parentSurface = qobject_cast(transientParent->shellSurface()); - if (parentSurface && parentSurface->m_toplevel) { + if (parentSurface && parentSurface->m_toplevel) set_parent(parentSurface->m_toplevel->object()); - if (window->modality() != Qt::NonModal && m_xdgSurface->m_shell->m_xdgDialogWm) { - m_xdgDialog.reset(m_xdgSurface->m_shell->m_xdgDialogWm->getDialog(object())); - m_xdgDialog->set_modal(); - } - } + } + + // Always use XDG Dialog, a window could be assigned a parent through XDG Foreign. + if (window->modality() != Qt::NonModal && m_xdgSurface->m_shell->m_xdgDialogWm) { + m_xdgDialog.reset(m_xdgSurface->m_shell->m_xdgDialogWm->getDialog(object())); + m_xdgDialog->set_modal(); } } diff --git a/tests/auto/wayland/xdgshell/tst_xdgshell.cpp b/tests/auto/wayland/xdgshell/tst_xdgshell.cpp index 311c408a9e5..45b78ed003f 100644 --- a/tests/auto/wayland/xdgshell/tst_xdgshell.cpp +++ b/tests/auto/wayland/xdgshell/tst_xdgshell.cpp @@ -35,6 +35,7 @@ private slots: void suspended(); void initiallySuspended(); void modality(); + void modalityWithoutTransientParent(); }; void tst_xdgshell::init() @@ -823,5 +824,35 @@ void tst_xdgshell::modality() QCOMPOSITOR_TRY_VERIFY(!xdgDialog()); } +void tst_xdgshell::modalityWithoutTransientParent() +{ + QRasterWindow child; + child.resize(400, 320); + child.show(); + QCOMPOSITOR_TRY_VERIFY(xdgToplevel()); + QCOMPOSITOR_VERIFY(!xdgDialog()); + + child.hide(); + child.setModality(Qt::WindowModal); + child.show(); + QCOMPOSITOR_TRY_VERIFY(xdgDialog()); + QCOMPOSITOR_VERIFY(xdgDialog()->modal); + + child.hide(); + QCOMPOSITOR_TRY_VERIFY(!xdgDialog()); + + child.setModality(Qt::ApplicationModal); + child.show(); + QCOMPOSITOR_TRY_VERIFY(xdgDialog()); + QCOMPOSITOR_VERIFY(xdgDialog()->modal); + + child.hide(); + QCOMPOSITOR_TRY_VERIFY(!xdgDialog()); + + child.show(); + child.setModality(Qt::NonModal); + QCOMPOSITOR_TRY_VERIFY(!xdgDialog()); +} + QCOMPOSITOR_TEST_MAIN(tst_xdgshell) #include "tst_xdgshell.moc" From d8f07f43e5f0731f6872507e53b9d7ef431350fe Mon Sep 17 00:00:00 2001 From: YAMAMOTO Atsushi Date: Thu, 24 Apr 2025 17:09:25 +0900 Subject: [PATCH 1501/1507] Fix build error when tablet support is disabled When Qt is configured with -no-feature-tabletevent, QtWayland fails to build because code referencing QWaylandInputDevice::mTabletSeat is still compiled, even though mTabletSeat is only available when tablet event support is enabled. Pick-to: 6.9 6.8 Change-Id: Iad82ea47cfc64040772429f469d9104b75490891 Reviewed-by: Liang Qi Reviewed-by: Tasuku Suzuki --- src/plugins/platforms/wayland/qwaylandinputdevice.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index 9224e5fb43f..fea7e77414c 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -641,8 +641,10 @@ void QWaylandInputDevice::setCursor(const QCursor *cursor, const QSharedPointer< if (mPointer) mPointer->updateCursor(); +#if QT_CONFIG(tabletevent) if (mTabletSeat) mTabletSeat->updateCursor(); +#endif } #endif From a0161a2b783c1cbea8f1faaa6fe9f14160515900 Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Wed, 16 Apr 2025 14:03:37 +0100 Subject: [PATCH 1502/1507] client: Use separate queue for SHM buffers With the current setup, clients can try and submit buffers without waiting for frame callbacks. This can lead to buffers being exhausted. When this happens we go into a blocking path waiting for buffers to be freed. The current implementation dispatches all events on the main queue, which means we can be processing input events in the middle of our drawing code, leading to obscure crashes. This code uses a separate queue for shm buffers. This queue is processed on the main thread manually before trying to re-use an old buffer this queue is dispatched. If we need to block, we poll, but only dispatch the one queue. In addition explicitly dispatching solves a separate race condition. Frame callbacks are always handled in the frame event thread. Depending on how threads are woken this can be processed before main event thread notifies of new events. This can lead the Qt main thread to be processing drawing before we process the buffer release and consider the buffer still busy. The end result is clients using one more buffer than necessary. The explicit dispatching of shm events solves that problem. Co-authored-by: Vlad Zahorodnii Pick-to: 6.9 Task-number: QTBUG-134234 Change-Id: Id8a84c72f669f187e368fd5ef32e8e4c150f8849 Reviewed-by: David Edmundson --- .../platforms/wayland/qwaylanddisplay.cpp | 12 --------- .../platforms/wayland/qwaylanddisplay_p.h | 1 - .../wayland/qwaylandshmbackingstore.cpp | 27 ++++++++++++++----- .../wayland/qwaylandshmbackingstore_p.h | 3 ++- 4 files changed, 23 insertions(+), 20 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index cdab2947950..c4cdbecf6ae 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -556,18 +556,6 @@ void QWaylandDisplay::checkWaylandError() _exit(-1); } -void QWaylandDisplay::blockingReadEvents() -{ - if (wl_display_dispatch(mDisplay) < 0) { - int ecode = wl_display_get_error(mDisplay); - if ((ecode == EPIPE || ecode == ECONNRESET)) - qWarning("The Wayland connection broke during blocking read event. Did the Wayland compositor die?"); - else - qWarning("The Wayland connection experienced a fatal error during blocking read event: %s", strerror(ecode)); - _exit(-1); - } -} - void QWaylandDisplay::checkTextInputProtocol() { QStringList tips, timps; // for text input protocols and text input manager protocols diff --git a/src/plugins/platforms/wayland/qwaylanddisplay_p.h b/src/plugins/platforms/wayland/qwaylanddisplay_p.h index db9007a35f0..c8ba4935cf6 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay_p.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay_p.h @@ -273,7 +273,6 @@ public: void initEventThread(); public Q_SLOTS: - void blockingReadEvents(); void flushRequests(); Q_SIGNALS: diff --git a/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp b/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp index 5e6a00cf600..0d59ffef33c 100644 --- a/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp +++ b/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp @@ -50,7 +50,7 @@ extern void qt_scrollRectInImage(QImage &, const QRect &, const QPoint &); namespace QtWaylandClient { QWaylandShmBuffer::QWaylandShmBuffer(QWaylandDisplay *display, - const QSize &size, QImage::Format format, qreal scale) + const QSize &size, QImage::Format format, qreal scale, wl_event_queue *customEventQueue) : mDirtyRegion(QRect(QPoint(0, 0), size / scale)) { int stride = size.width() * 4; @@ -101,6 +101,8 @@ QWaylandShmBuffer::QWaylandShmBuffer(QWaylandDisplay *display, mShmPool = wl_shm_create_pool(shm->object(), fd, alloc); init(wl_shm_pool_create_buffer(mShmPool,0, size.width(), size.height(), stride, wl_format)); + if (customEventQueue) + wl_proxy_set_queue(reinterpret_cast(buffer()), customEventQueue); } QWaylandShmBuffer::~QWaylandShmBuffer(void) @@ -144,7 +146,10 @@ QWaylandShmBackingStore::QWaylandShmBackingStore(QWindow *window, QWaylandDispla : QPlatformBackingStore(window) , mDisplay(display) { + mEventQueue = wl_display_create_queue(mDisplay->wl_display()); QObject::connect(mDisplay, &QWaylandDisplay::connected, window, [this]() { + auto oldEventQueue = mEventQueue; + mEventQueue = wl_display_create_queue(mDisplay->wl_display()); auto copy = mBuffers; // clear available buffers so we create new ones // actual deletion is deferred till after resize call so we can copy @@ -155,6 +160,7 @@ QWaylandShmBackingStore::QWaylandShmBackingStore(QWindow *window, QWaylandDispla if (mRequestedSize.isValid() && waylandWindow()) recreateBackBufferIfNeeded(); qDeleteAll(copy); + wl_event_queue_destroy(oldEventQueue); }); } @@ -167,6 +173,7 @@ QWaylandShmBackingStore::~QWaylandShmBackingStore() // waylandWindow()->attach(0); qDeleteAll(mBuffers); + wl_event_queue_destroy(mEventQueue); } QPaintDevice *QWaylandShmBackingStore::paintDevice() @@ -257,7 +264,7 @@ void QWaylandShmBackingStore::flush(QWindow *window, const QRegion ®ion, cons // however so no need to reimplement that. if (window != this->window()) { auto waylandWindow = static_cast(window->handle()); - auto newBuffer = new QWaylandShmBuffer(mDisplay, window->size(), mBackBuffer->image()->format(), mBackBuffer->scale()); + auto newBuffer = new QWaylandShmBuffer(mDisplay, window->size(), mBackBuffer->image()->format(), mBackBuffer->scale(), mEventQueue); newBuffer->setDeleteOnRelease(true); QRect sourceRect(window->position(), window->size()); QPainter painter(newBuffer->image()); @@ -322,7 +329,7 @@ QWaylandShmBuffer *QWaylandShmBackingStore::getBuffer(const QSize &size, bool &b QImage::Format format = QImage::Format_ARGB32_Premultiplied; if (!waylandWindow()->format().hasAlpha()) format = QImage::Format_RGB32; - QWaylandShmBuffer *b = new QWaylandShmBuffer(mDisplay, size, format, waylandWindow()->scale()); + QWaylandShmBuffer *b = new QWaylandShmBuffer(mDisplay, size, format, waylandWindow()->scale(), mEventQueue); bufferWasRecreated = true; mBuffers.push_front(b); return b; @@ -332,6 +339,8 @@ QWaylandShmBuffer *QWaylandShmBackingStore::getBuffer(const QSize &size, bool &b bool QWaylandShmBackingStore::recreateBackBufferIfNeeded() { + wl_display_dispatch_queue_pending(mDisplay->wl_display(), mEventQueue); + bool bufferWasRecreated = false; QMargins margins = windowDecorationMargins(); qreal scale = waylandWindow()->scale(); @@ -347,9 +356,15 @@ bool QWaylandShmBackingStore::recreateBackBufferIfNeeded() // run single buffered, while with the pixman renderer we have to use two. QWaylandShmBuffer *buffer = getBuffer(sizeWithMargins, bufferWasRecreated); while (!buffer) { - qCDebug(lcWaylandBackingstore, "QWaylandShmBackingStore: stalling waiting for a buffer to be released from the compositor..."); - - mDisplay->blockingReadEvents(); + struct ::wl_display *display = mDisplay->wl_display(); + if (wl_display_dispatch_queue(display, mEventQueue) < 0) { + int ecode = wl_display_get_error(display); + if ((ecode == EPIPE || ecode == ECONNRESET)) + qWarning("The Wayland connection broke during blocking read event. Did the Wayland compositor die?"); + else + qWarning("The Wayland connection experienced a fatal error during blocking read event: %s", strerror(ecode)); + _exit(-1); + } buffer = getBuffer(sizeWithMargins, bufferWasRecreated); } diff --git a/src/plugins/platforms/wayland/qwaylandshmbackingstore_p.h b/src/plugins/platforms/wayland/qwaylandshmbackingstore_p.h index 1cd6135f250..183c8c570d8 100644 --- a/src/plugins/platforms/wayland/qwaylandshmbackingstore_p.h +++ b/src/plugins/platforms/wayland/qwaylandshmbackingstore_p.h @@ -33,7 +33,7 @@ class QWaylandWindow; class Q_WAYLANDCLIENT_EXPORT QWaylandShmBuffer : public QWaylandBuffer { public: QWaylandShmBuffer(QWaylandDisplay *display, - const QSize &size, QImage::Format format, qreal scale = 1); + const QSize &size, QImage::Format format, qreal scale = 1, wl_event_queue *customEventQueue = nullptr); ~QWaylandShmBuffer() override; QSize size() const override { return mImage.size(); } int scale() const override { return int(mImage.devicePixelRatio()); } @@ -98,6 +98,7 @@ private: QSize mRequestedSize; Qt::WindowFlags mCurrentWindowFlags; + struct wl_event_queue *mEventQueue = nullptr; }; } From 991c83cc9637d3807804c2a4f14fea87cc733f66 Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Wed, 30 Apr 2025 09:02:12 +0100 Subject: [PATCH 1503/1507] Set geometry before creating shell window Otherwise we risk creating the window with one geometry only to immediately change it. Fixes: QTBUG-136494 Change-Id: I140b51f895a12c448dee7859b8fb12bb5b60227b Reviewed-by: David Redondo --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index a1534c0b0ff..d6fd087c256 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -614,9 +614,8 @@ void QWaylandWindow::setVisible(bool visible) lastVisible = visible; if (visible) { - initWindow(); - setGeometry(windowGeometry()); + initWindow(); updateExposure(); // Don't flush the events here, or else the newly visible window may start drawing, but since // there was no frame before it will be stuck at the waitForFrameSync() in From 8c0dd12f4bf7a09304a136c9ceacfb60e0632e50 Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Thu, 24 Apr 2025 18:07:51 +0200 Subject: [PATCH 1504/1507] Drop workaround to turn popups into main windows On Wayland there are additional requirements when making popups to Qt. In regular cases we can guess what the popup parent should be based on which window last received input, but as it's a heuristic with obscure enough timing events this can sometimes fail. In this situation the current code creates a toplevel instead of a regular popup, having a popup take focus with a window decoration is rarely a good UX. Rather than making an incorrect window, the new approach is to not create a popup over the wire and synthesise an immediate close event. Application code should be able to handle this as it's the same path if the popup was denied server side. Pick-to: 6.9 Task-number: QTBUG-136343 Change-Id: Ia76c36a047e93f2469a8bf0f4b94642f05179124 Reviewed-by: Vlad Zahorodnii --- .../xdg-shell/qwaylandxdgshell.cpp | 18 +++++++-- tests/auto/wayland/xdgshell/tst_xdgshell.cpp | 40 +++++++++++++++++++ 2 files changed, 54 insertions(+), 4 deletions(-) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp index 8cdd0a681bd..338d66ea19f 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp @@ -314,10 +314,20 @@ QWaylandXdgSurface::QWaylandXdgSurface(QWaylandXdgShell *shell, ::xdg_surface *s Qt::WindowType type = window->window()->type(); auto *transientParent = window->transientParent(); - if (type == Qt::ToolTip && transientParent) { - setPopup(transientParent); - } else if (type == Qt::Popup && transientParent && display->lastInputDevice()) { - setGrabPopup(transientParent, display->lastInputDevice(), display->lastInputSerial()); + if (type == Qt::ToolTip) { + if (transientParent) { + setPopup(transientParent); + } else { + qCWarning(lcQpaWayland) << "Failed to create popup. Ensure popup " << window->window() << "has a transientParent set."; + QWindowSystemInterface::handleCloseEvent(m_window->window()); + } + } else if (type == Qt::Popup ) { + if (transientParent && display->lastInputDevice()) { + setGrabPopup(transientParent, display->lastInputDevice(), display->lastInputSerial()); + } else { + qCWarning(lcQpaWayland) << "Failed to create grabbing popup. Ensure popup " << window->window() << "has a transientParent set and that parent window has received input."; + QWindowSystemInterface::handleCloseEvent(m_window->window()); + } } else { setToplevel(); } diff --git a/tests/auto/wayland/xdgshell/tst_xdgshell.cpp b/tests/auto/wayland/xdgshell/tst_xdgshell.cpp index 45b78ed003f..e23cc83f5b6 100644 --- a/tests/auto/wayland/xdgshell/tst_xdgshell.cpp +++ b/tests/auto/wayland/xdgshell/tst_xdgshell.cpp @@ -26,6 +26,7 @@ private slots: void tooltipAndSiblingPopup(); void switchPopups(); void hidePopupParent(); + void popupsWithoutParent(); void pongs(); void minMaxSize_data(); void minMaxSize(); @@ -608,6 +609,45 @@ void tst_xdgshell::hidePopupParent() QCOMPOSITOR_TRY_VERIFY(!xdgToplevel()); } +void tst_xdgshell::popupsWithoutParent() +{ + QRasterWindow popup; + QSignalSpy popupDoneSpy(&popup, &QWindow::visibilityChanged); + popup.setFlags(Qt::Popup); + popup.resize(100, 100); + popup.show(); + QVERIFY(popup.isVisible()); + + // popup cannot be created within the spec, so it gets auto-dismissed + QVERIFY(popupDoneSpy.wait()); + QVERIFY(!popup.isVisible()); + + QCOMPOSITOR_VERIFY(!xdgToplevel()); + + // now make a normal window with an input event + QRasterWindow window; + window.setTitle("main window"); + window.resize(200, 200); + window.show(); + + QCOMPOSITOR_TRY_VERIFY(xdgToplevel()); + exec([&] { xdgToplevel()->sendCompleteConfigure(); }); + QCOMPOSITOR_TRY_VERIFY(xdgToplevel()->m_xdgSurface->m_committedConfigureSerial); + exec([&] { + keyboard()->sendEnter(xdgToplevel()->surface()); + keyboard()->sendKey(client(), 72, Keyboard::key_state_pressed); // related with native scan code + keyboard()->sendKey(client(), 72, Keyboard::key_state_released); // related with native scan code + }); + QTRY_COMPARE(qGuiApp->focusWindow(), &window); + + // now re-show our popup, it should be able to guess a transient this time + // and correctly show as a popup + popup.show(); + QCOMPOSITOR_TRY_VERIFY(xdgPopup()); + exec([&] { xdgPopup()->sendCompleteConfigure(QRect(100, 100, 100, 100)); }); + QCOMPOSITOR_TRY_VERIFY(xdgPopup()->m_xdgSurface->m_committedConfigureSerial); +} + void tst_xdgshell::pongs() { // Create and show a window to trigger shell integration initialzation, From 3bd2a2f8ee869e23ba4b59337c496b946fc8dde6 Mon Sep 17 00:00:00 2001 From: Jie Liu Date: Tue, 10 Dec 2024 11:36:44 +0800 Subject: [PATCH 1505/1507] datacontrolv1: emit clipboard mode changed when selection changed Pick-to: 6.9 Change-Id: I47508a88d2115ee92521b0499f72faa566e6b3a3 Reviewed-by: Liang Qi --- src/plugins/platforms/wayland/qwaylanddatacontrolv1.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylanddatacontrolv1.cpp b/src/plugins/platforms/wayland/qwaylanddatacontrolv1.cpp index 05c0a8ffafe..294c74c989b 100644 --- a/src/plugins/platforms/wayland/qwaylanddatacontrolv1.cpp +++ b/src/plugins/platforms/wayland/qwaylanddatacontrolv1.cpp @@ -64,7 +64,7 @@ void QWaylandDataControlDeviceV1::invalidateSelectionOffer() return; m_selectionOffer.reset(); - QGuiApplicationPrivate::platformIntegration()->clipboard()->emitChanged(QClipboard::Selection); + QGuiApplicationPrivate::platformIntegration()->clipboard()->emitChanged(QClipboard::Clipboard); } void QWaylandDataControlDeviceV1::setSelectionSource(QWaylandDataControlSourceV1 *source) @@ -105,14 +105,14 @@ void QWaylandDataControlDeviceV1::zwlr_data_control_device_v1_selection(zwlr_dat // The selection event may be sent before platfrmIntegration is set. if (auto* integration = QGuiApplicationPrivate::platformIntegration()) - integration->clipboard()->emitChanged(QClipboard::Selection); + integration->clipboard()->emitChanged(QClipboard::Clipboard); } void QWaylandDataControlDeviceV1::zwlr_data_control_device_v1_finished() { m_selectionOffer.reset(); m_primarySelectionOffer.reset(); - QGuiApplicationPrivate::platformIntegration()->clipboard()->emitChanged(QClipboard::Selection); + QGuiApplicationPrivate::platformIntegration()->clipboard()->emitChanged(QClipboard::Clipboard); } void QWaylandDataControlDeviceV1::zwlr_data_control_device_v1_primary_selection(struct ::zwlr_data_control_offer_v1 *id) From 1d3de3e8c87c8ac963b3780abac8a93bf378dc0a Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Tue, 29 Apr 2025 23:16:12 +0200 Subject: [PATCH 1506/1507] tests: Fix role used by XdgPopups Change-Id: Iec367da682588f615f9d8a193d912f5367de7ae2 Reviewed-by: Vlad Zahorodnii --- tests/auto/wayland/shared/xdgshell.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/auto/wayland/shared/xdgshell.cpp b/tests/auto/wayland/shared/xdgshell.cpp index 2c9d61ff510..415039ced35 100644 --- a/tests/auto/wayland/shared/xdgshell.cpp +++ b/tests/auto/wayland/shared/xdgshell.cpp @@ -115,8 +115,8 @@ void XdgSurface::xdg_surface_get_popup(Resource *resource, uint32_t id, wl_resou QVERIFY(!m_toplevel); QVERIFY(!m_popup); if (!m_surface->m_role) { - m_surface->m_role = new SubSurfaceRole; - } else if (!qobject_cast(m_surface->m_role)) { + m_surface->m_role = new XdgPopupRole; + } else if (!qobject_cast(m_surface->m_role)) { qWarning() << "surface already has role" << m_surface->m_role->metaObject()->className(); return; } From c5a4ab54c9b99d5f62ed981b177bec5856e84e52 Mon Sep 17 00:00:00 2001 From: Liang Qi Date: Fri, 17 Jan 2025 10:09:59 +0100 Subject: [PATCH 1507/1507] client: add some debug info in QWaylandTextInputv2 Pick-to: 6.9 6.8 Change-Id: Ia34ef1bd7093c7aa71b862418595a0882e251131 Reviewed-by: Inho Lee --- .../platforms/wayland/qwaylandtextinputv2.cpp | 26 +++++++++++++++++++ .../platforms/wayland/qwaylandtextinputv2_p.h | 20 +++----------- 2 files changed, 30 insertions(+), 16 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandtextinputv2.cpp b/src/plugins/platforms/wayland/qwaylandtextinputv2.cpp index 9f767eaed00..eb327e4c765 100644 --- a/src/plugins/platforms/wayland/qwaylandtextinputv2.cpp +++ b/src/plugins/platforms/wayland/qwaylandtextinputv2.cpp @@ -49,8 +49,30 @@ QWaylandTextInputv2::~QWaylandTextInputv2() destroy(); } +void QWaylandTextInputv2::showInputPanel() +{ + qCDebug(qLcQpaInputMethods()) << Q_FUNC_INFO; + show_input_panel(); +} +void QWaylandTextInputv2::hideInputPanel() +{ + qCDebug(qLcQpaInputMethods()) << Q_FUNC_INFO; + hide_input_panel(); +} +void QWaylandTextInputv2::enableSurface(::wl_surface *surface) +{ + qCDebug(qLcQpaInputMethods()) << Q_FUNC_INFO << surface; + enable(surface); +} +void QWaylandTextInputv2::disableSurface(::wl_surface *surface) +{ + qCDebug(qLcQpaInputMethods()) << Q_FUNC_INFO << surface; + disable(surface); +} + void QWaylandTextInputv2::reset() { + qCDebug(qLcQpaInputMethods()) << Q_FUNC_INFO; m_builder.reset(); m_preeditCommit = QString(); updateState(Qt::ImQueryAll, QtWayland::zwp_text_input_v2::update_state_reset); @@ -58,6 +80,7 @@ void QWaylandTextInputv2::reset() void QWaylandTextInputv2::commit() { + qCDebug(qLcQpaInputMethods()) << Q_FUNC_INFO; if (QObject *o = QGuiApplication::focusObject()) { if (!m_preeditCommit.isEmpty()) { @@ -88,6 +111,7 @@ void QWaylandTextInputv2::resetCallback(void *data, wl_callback *, uint32_t) void QWaylandTextInputv2::updateState(Qt::InputMethodQueries queries, uint32_t flags) { + qCDebug(qLcQpaInputMethods()) << Q_FUNC_INFO << queries << flags; if (!QGuiApplication::focusObject()) return; @@ -181,6 +205,7 @@ Qt::LayoutDirection QWaylandTextInputv2::inputDirection() const void QWaylandTextInputv2::zwp_text_input_v2_enter(uint32_t serial, ::wl_surface *surface) { + qCDebug(qLcQpaInputMethods()) << Q_FUNC_INFO << serial << surface; m_serial = serial; m_surface = surface; @@ -189,6 +214,7 @@ void QWaylandTextInputv2::zwp_text_input_v2_enter(uint32_t serial, ::wl_surface void QWaylandTextInputv2::zwp_text_input_v2_leave(uint32_t serial, ::wl_surface *surface) { + qCDebug(qLcQpaInputMethods()) << Q_FUNC_INFO << serial << surface; m_serial = serial; if (m_surface != surface) { diff --git a/src/plugins/platforms/wayland/qwaylandtextinputv2_p.h b/src/plugins/platforms/wayland/qwaylandtextinputv2_p.h index 94b0408a9c6..0258fbe8840 100644 --- a/src/plugins/platforms/wayland/qwaylandtextinputv2_p.h +++ b/src/plugins/platforms/wayland/qwaylandtextinputv2_p.h @@ -47,22 +47,10 @@ public: QLocale locale() const override; Qt::LayoutDirection inputDirection() const override; - void showInputPanel() override - { - show_input_panel(); - } - void hideInputPanel() override - { - hide_input_panel(); - } - void enableSurface(::wl_surface *surface) override - { - enable(surface); - } - void disableSurface(::wl_surface *surface) override - { - disable(surface); - } + void showInputPanel() override; + void hideInputPanel() override; + void enableSurface(::wl_surface *surface) override; + void disableSurface(::wl_surface *surface) override; protected: void zwp_text_input_v2_enter(uint32_t serial, struct ::wl_surface *surface) override;